PageSourceSearch

https://www.travelling-technicians.ca/_next/static/chunks/pages/cancel-booking-acc6a6faa61ff78a.js

js travelling-technicians.ca collected 2026-10-04 04:54:31 UTC 13,247 bytes, 1 lines download raw bytes

1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[8681],{65553:function(e,t,a){(window.__NEXT_P=window.__NEXT_P||[]).push(["/cancel-booking",function(){return a(1659)}])},89556:function(e,t,a){"use strict";a.d(t,{Z:function(){return l}});var n=a(85893),r=a(9008),s=a.n(r),i=a(18755),o=a(64566);function l(e){let{children:t,title:a,metaDescription:r,canonical:l,noindex:c}=e,d=a?"".concat(a," | The Travelling Technicians"):"The Travelling Technicians | Mobile & Laptop Repair at Your Doorstep",m=r||"Expert mobile phone and laptop repair services right at your doorstep across the Lower Mainland, BC. Book online for convenient tech repair that comes to you.";return(0,n.jsxs)("div",{className:"flex flex-col min-h-screen",children:[(0,n.jsxs)(s(),{children:[(0,n.jsx)("title",{children:d},"title"),(0,n.jsx)("meta",{name:"viewport",content:"width=device-width, initial-scale=1"}),(0,n.jsx)("meta",{name:"description",content:m},"description"),(0,n.jsx)("link",{rel:"icon",href:"/favicon.ico"}),(0,n.jsx)("link",{rel:"apple-touch-icon",href:"/favicons/favicon-192x192.png"}),(0,n.jsx)("link",{rel:"icon",type:"image/png",sizes:"32x32",href:"/favicons/favicon-32x32.png"}),(0,n.jsx)("link",{rel:"icon",type:"image/png",sizes:"192x192",href:"/favicons/favicon-192x192.png"}),(0,n.jsx)("link",{rel:"manifest",href:"/manifest.json"}),(0,n.jsx)("meta",{name:"theme-color",content:"#102a43"}),(0,n.jsx)("meta",{property:"og:title",content:d},"og:title"),(0,n.jsx)("meta",{property:"og:description",content:m},"og:description"),(0,n.jsx)("meta",{property:"og:type",content:"website"},"og:type"),(0,n.jsx)("meta",{property:"og:image",content:"https://www.travelling-technicians.ca/images/og/og-default.png"},"og:image"),(0,n.jsx)("meta",{property:"og:image:width",content:"1200"}),(0,n.jsx)("meta",{property:"og:image:height",content:"630"}),(0,n.jsx)("meta",{name:"twitter:card",content:"summary_large_image"},"twitter:card"),(0,n.jsx)("meta",{name:"twitter:title",content:d},"twitter:title"),(0,n.jsx)("meta",{name:"twitter:description",content:m},"twitter:description"),(0,n.jsx)("meta",{name:"twitter:image",content:"https://www.travelling-technicians.ca/images/og/og-default.png"},"twitter:image"),l&&(0,n.jsx)("link",{rel:"canonical",href:l},"canonical"),c&&(0,n.jsx)("meta",{name:"robots",content:"noindex, nofollow"})]}),(0,n.jsx)("a",{href:"#main-content",className:"sr-only focus:not-sr-only focus:absolute focus:top-2 focus:left-2 focus:z-[60] focus:bg-white dark:focus:bg-primary-900 focus:text-primary-900 dark:focus:text-primary-100 focus:px-4 focus:py-2 focus:rounded-lg focus:shadow-lg focus:outline-none focus:ring-2 focus:ring-accent-500",children:"Skip to content"}),(0,n.jsx)(i.Z,{}),(0,n.jsx)("main",{id:"main-content",className:"flex-grow",children:t}),(0,n.jsx)(o.Z,{})]})}},1659:function(e,t,a){"use strict";a.r(t);var n=a(85893),r=a(67294),s=a(9008),i=a.n(s),o=a(11163),l=a(89556),c=a(1688);let d=new Set(["pending","pending-payment","confirmed","assigned"]);t.default=()=>{var e,t,a,s,m;let x=(0,o.useRouter)(),[u,p]=(0,r.useState)(null),[h,g]=(0,r.useState)(null),[b,f]=(0,r.useState)(!1),[k,y]=(0,r.useState)("loading"),[j,v]=(0,r.useState)(null),[w,N]=(0,r.useState)(""),[_,C]=(0,r.useState)(!1),[S,E]=(0,r.useState)(!1),[T,A]=(0,r.useState)(""),[R,Y]=(0,r.useState)(!1),[L,P]=(0,r.useState)(null),[X,B]=(0,r.useState)(null);(0,r.useEffect)(()=>{if(b||!x.isReady)return;let e="string"==typeof x.query.token?x.query.token:null,t="string"==typeof x.query.reference?x.query.reference:null;p(e),g(t),f(!0),e&&t&&x.replace("/cancel-booking",void 0,{shallow:!0})},[x,x.isReady,x.query,b]),(0,r.useEffect)(()=>{if(!b)return;if(!u||!h){y("error"),A("Cancellation link is missing or invalid. Please use the link from your booking confirmation email.");return}let e=!1;return(async()=>{try{let t=await fetch("/api/bookings/reference/".concat(h)),a=await t.json();if(e)return;if(!t.ok||!a.success||!a.booking)throw Error(a.message||"Booking not found");let n=a.booking;v(n),Y("paid"===n.payment_status||"partially_refunded"===n.payment_status),y("confirm")}catch(t){if(e)return;y("error"),A("Unable to load this booking. Please check your link or call us.")}})(),()=>{e=!0}},[b,u,h]);let q=e=>{let t=function(e,t){var a;if(!e||!t)return null;
1let n=null===(a=t.split("-")[0])||void 0===a?void 0:a.trim(),r=null==n?void 0:n.match(/^(\d{1,2}):(\d{2})\s*(AM|PM)$/i);if(!r)return null;let s=parseInt(r[1],10),i=parseInt(r[2],10);"PM"===r[3].toUpperCase()&&12!==s&&(s+=12),"AM"===r[3].toUpperCase()&&12===s&&(s=0);let o=new Date("".concat(e,"T").concat(String(s).padStart(2,"0"),":").concat(String(i).padStart(2,"0"),":00-07:00"));return isNaN(o.getTime())?null:o}(e.booking_date,e.booking_time);return!!t&&t.getTime()-Date.now()<72e5},D=async()=>{if(j&&u&&_){if(q(j)){A("Your appointment is within 2 hours. Please call ".concat(c.YX," to cancel."));return}E(!0),A("");try{let a=await fetch("/api/bookings/cancel",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({bookingRef:j.booking_ref,token:u,reason:w.trim()||void 0})}),n=await a.json();if(502===a.status&&"EMAIL_FAILED"===n.code){Y(!!n.refundRequired),A("Your booking has been cancelled but we could not send the confirmation email. "+"Please call ".concat(c.YX," if you need a receipt.")),y("success");return}if(410===a.status&&"LINK_EXPIRED"===n.code){A(n.message),y("link-expired");return}if(409===a.status&&"TOO_CLOSE"===n.code||409===a.status&&"NOT_CANCELLABLE"===n.code){A(n.message);return}if("ALREADY_CANCELLED"===n.code&&n.alreadyCancelled){var e,t;Y(!!n.refundRequired),P(null!==(e=n.previousReason)&&void 0!==e?e:null),B(null!==(t=n.cancelledAt)&&void 0!==t?t:null),y("already-cancelled");return}if(!a.ok||!n.success)throw Error(n.message||"Cancellation failed");Y(!!n.refundRequired),y("success")}catch(e){A(e.message||"Cancellation failed. Please try again or call us.")}finally{E(!1)}}},O=!!j&&d.has(j.status),I=!!j&&q(j);return(0,n.jsxs)(l.Z,{children:[(0,n.jsxs)(i(),{children:[(0,n.jsx)("title",{children:"Cancel Booking — The Travelling Technicians"}),(0,n.jsx)("meta",{name:"robots",content:"noindex,nofollow"}),(0,n.jsx)("meta",{name:"referrer",content:"same-origin"})]}),(0,n.jsx)("main",{className:"min-h-[60vh] bg-slate-50 dark:bg-primary-950 py-12",children:(0,n.jsxs)("div",{className:"max-w-2xl mx-auto px-4",children:[(0,n.jsx)("h1",{className:"text-2xl font-bold text-slate-900 dark:text-primary-100 mb-2",children:"Cancel a Booking"}),(0,n.jsxs)("p",{className:"text-sm text-slate-600 dark:text-primary-300 mb-8",children:["Cancellations within 2 hours of your appointment require a phone call to"," ",(0,n.jsx)("a",{href:c._A,className:"text-orange-600 dark:text-orange-400 font-medium",children:c.YX}),"."]}),"loading"===k&&(0,n.jsx)("div",{className:"bg-white dark:bg-primary-800/60 rounded-lg shadow p-8 text-center text-slate-600 dark:text-primary-300",children:"Loading your booking…"}),"error"===k&&(0,n.jsxs)("div",{className:"bg-white dark:bg-primary-800/60 rounded-lg shadow p-8 text-center",children:[(0,n.jsx)("h2",{className:"text-lg font-semibold text-red-700 dark:text-red-400 mb-3",children:"Unable to load booking"}),(0,n.jsx)("p",{className:"text-slate-600 dark:text-primary-300 mb-4",children:T}),(0,n.jsxs)("a",{href:c._A,className:"inline-block bg-orange-500 hover:bg-orange-600 text-white font-semibold px-6 py-3 rounded",children:["Call ",c.YX]})]}),"confirm"===k&&j&&(0,n.jsxs)("div",{className:"bg-white dark:bg-primary-800/60 rounded-lg shadow p-6",children:[(0,n.jsx)("h2",{className:"text-lg font-semibold text-slate-900 dark:text-primary-100 mb-3",children:"Confirm cancellation"}),(0,n.jsxs)("div",{className:"bg-red-50 dark:bg-red-900/30 border border-red-200 dark:border-red-700 rounded p-4 mb-4",children:[(0,n.jsx)("div",{className:"font-mono text-sm text-slate-500 dark:text-primary-400",children:j.booking_ref}),(0,n.jsxs)("div",{className:"font-semibold",children:[(null===(e=j.service)||void 0===e?void 0:e.name)||"Repair",(null===(t=j.device)||void 0===t?void 0:t.brand)||(null===(a=j.device)||void 0===a?void 0:a.model)?" — ".concat([null===(s=j.device)||void 0===s?void 0:s.brand,null===(m=j.device)||void 0===m?void 0:m.model].filter(Boolean).join(" ")):""]}),(0,n.jsxs)("div",{className:"text-sm text-slate-700 dark:text-primary-300 mt-1",children:[j.booking_date," ",j.booking_time?"\xb7 ".concat(j.booking_time):""]})]}
1),!O&&(0,n.jsxs)("div",{className:"bg-slate-100 dark:bg-primary-900/50 border border-slate-200 dark:border-primary-700 rounded p-4 mb-4 text-sm text-slate-700 dark:text-primary-300",children:["This booking cannot be cancelled — current status is"," ",(0,n.jsx)("strong",{children:j.status}),". Please call ",c.YX," for help."]}),O&&I&&(0,n.jsxs)("div",{className:"bg-amber-50 dark:bg-amber-900/30 border border-amber-200 dark:border-amber-700 rounded p-4 mb-4 text-sm text-amber-900 dark:text-amber-200",children:["Your appointment is within 2 hours. Please call ",c.YX," to cancel."]}),R&&O&&!I&&(0,n.jsx)("div",{className:"bg-amber-50 dark:bg-amber-900/30 border border-amber-200 dark:border-amber-700 rounded p-4 mb-4 text-sm text-amber-900 dark:text-amber-200",children:"You paid for this repair. Your refund will be processed to your original payment method — typically 5–10 business days, depending on your bank."}),O&&!I&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("label",{className:"block text-sm font-medium text-slate-700 dark:text-primary-300 mb-1",children:"Reason for cancelling (optional)"}),(0,n.jsx)("textarea",{value:w,onChange:e=>N(e.target.value.slice(0,500)),placeholder:"Help us improve — why are you cancelling?",className:"w-full border border-slate-300 rounded p-2 text-sm mb-4",rows:3}),(0,n.jsxs)("label",{className:"flex items-start gap-2 mb-4 text-sm text-slate-700 dark:text-primary-300",children:[(0,n.jsx)("input",{type:"checkbox",checked:_,onChange:e=>C(e.target.checked),className:"mt-0.5"}),"I understand this cancellation cannot be undone."]})]}),T&&(0,n.jsx)("p",{className:"text-sm text-red-700 dark:text-red-400 mb-3",children:T}),(0,n.jsx)("div",{className:"flex gap-3",children:O&&!I?(0,n.jsx)("button",{onClick:D,disabled:!_||S,className:"bg-red-600 hover:bg-red-700 disabled:bg-slate-300 text-white font-medium px-6 py-2 rounded",children:S?"Cancelling…":"Confirm cancellation"}):(0,n.jsxs)("a",{href:c._A,className:"inline-block bg-orange-500 hover:bg-orange-600 text-white font-semibold px-6 py-2 rounded",children:["Call ",c.YX]})})]}),"link-expired"===k&&(0,n.jsxs)("div",{className:"bg-white dark:bg-primary-800/60 rounded-lg shadow p-8 text-center",children:[(0,n.jsx)("div",{className:"text-amber-600 text-4xl mb-3",children:"⏱"}),(0,n.jsx)("h2",{className:"text-lg font-semibold text-slate-900 dark:text-primary-100 mb-3",children:"Cancellation link expired"}),(0,n.jsx)("p",{className:"text-slate-600 dark:text-primary-300 mb-4",children:T}),(0,n.jsxs)("a",{href:c._A,className:"inline-block bg-orange-500 hover:bg-orange-600 text-white font-semibold px-6 py-3 rounded",children:["Call ",c.YX]})]}),"already-cancelled"===k&&j&&(0,n.jsxs)("div",{className:"bg-white dark:bg-primary-800/60 rounded-lg shadow p-8 text-center",children:[(0,n.jsx)("div",{className:"text-slate-500 dark:text-primary-400 text-4xl mb-3",children:"ℹ️"}),(0,n.jsx)("h2",{className:"text-xl font-semibold text-slate-900 dark:text-primary-100 mb-2",children:"Already cancelled"}),(0,n.jsxs)("p",{className:"text-slate-600 dark:text-primary-300 mb-2",children:[(0,n.jsx)("span",{className:"line-through font-mono",children:j.booking_ref})," was already cancelled",X?" on ".concat(new Date(X).toLocaleDateString("en-CA",{timeZone:"America/Vancouver"})):"","."]}),L&&(0,n.jsxs)("p",{className:"text-sm text-slate-500 dark:text-primary-400 mb-4",children:["Reason: ",L]}),R&&(0,n.jsx)("p",{className:"text-sm text-amber-700 mb-4",children:"Refund to original payment method (5–10 business days)."}),(0,n.jsx)("p",{className:"text-xs text-slate-400 mb-4",children:"No further action needed."}),(0,n.jsx)("a",{href:"/book-online",className:"inline-block bg-orange-500 hover:bg-orange-600 text-white font-semibold px-6 py-3 rounded",children:"Book a New Repair"})]}),"success"===k&&j&&(0,n.jsxs)("div",{className:"bg-white dark:bg-primary-800/60 rounded-lg shadow p-8 text-center",children:[(0,n.jsx)("div",{className:"text-emerald-600 text-5xl mb-3",children:"✓"}),(0,n.jsx)("h2",{className:"text-xl font-semibold text-slate-900 dark:text-primary-100 mb-2",children:"Booking cancelled"}
1),(0,n.jsxs)("p",{className:"text-slate-600 dark:text-primary-300 mb-2",children:[(0,n.jsx)("span",{className:"line-through font-mono",children:j.booking_ref})," has been cancelled."]}),R&&(0,n.jsx)("p",{className:"text-sm text-amber-700 mb-4",children:"Your refund will be processed to your original payment method (5–10 business days)."}),T&&(0,n.jsx)("p",{className:"text-sm text-slate-600 dark:text-primary-300 mb-4",children:T}),(0,n.jsx)("a",{href:"/book-online",className:"inline-block bg-orange-500 hover:bg-orange-600 text-white font-semibold px-6 py-3 rounded mt-2",children:"Book a New Repair"})]})]})})]})}}},function(e){e.O(0,[2840,274,2465,9371,512,2888,9774,179],function(){return e(e.s=65553)}),_N_E=e.O()}]);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.