PageSourceSearch

https://www.staynaitly.com/_next/static/chunks/pages/book/purchase/[id]-5fb7fde77f5733ad.js

js staynaitly.com collected 2026-10-07 00:35:49 UTC 27,102 bytes, 1 lines download raw bytes

1!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},t=(new e.Error).stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="d3631e94-45c0-45ae-9434-fb4033669aae",e._sentryDebugIdIdentifier="sentry-dbid-d3631e94-45c0-45ae-9434-fb4033669aae")}catch(e){}}(),(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[7341],{66418:function(e,t,n){(window.__NEXT_P=window.__NEXT_P||[]).push(["/book/purchase/[id]",function(){return n(67507)}])},57200:function(e,t,n){"use strict";n.d(t,{Z:function(){return a.Z}});var a=n(44222)},20396:function(e,t,n){"use strict";n.d(t,{Z:function(){return a.Z}});var a=n(74050)},64637:function(e,t,n){"use strict";var a=n(85893),r=n(93967),i=n.n(r),o=n(87036),s=n.n(o);t.Z=e=>{let{children:t,noPadding:n}=e;return(0,a.jsx)("div",{className:i()(s().actions,{[s().noPadding]:n}),children:t})}},67507:function(e,t,n){"use strict";n.r(t),n.d(t,{__N_SSP:function(){return e$},default:function(){return eF}});var a=n(85893),r=n(25874),i=n(73076),o=n(67294),s=n(13297),c=n(23609),l=n(9173),d=n(31205),u=n(35716),m=n(11163),p=n(20396),h=n(31399),_=n(99734),y=n.n(_);let v=e=>{let{reservations:t,onRetry:n}=e,{t:i}=(0,l.$G)("book"),{reload:o}=(0,m.useRouter)();return(0,a.jsx)("div",{className:"grid",children:(0,a.jsx)("div",{className:y().content,children:(0,a.jsx)("div",{children:(0,a.jsx)(r.D7,{icon:(0,a.jsx)(p.Z,{type:"error"}),title:i("purchase_cancelled.contentTitle"),titleAs:"h2",titleDisplay:"block",centered:!0,size:"l",elevation:1,subtitle:i("purchase_cancelled.subtitle"),actions:(0,a.jsx)(r.zx,{onClick:n||o,className:y().retryLink,children:i("purchase_cancelled.retry")}),children:(0,a.jsx)(r.Mr,{compact:!0,className:y().cardContent,children:t.map((e,t)=>(0,a.jsxs)("div",{className:y().reservation,children:[e.requestedCategory.name&&(0,a.jsx)("strong",{children:e.requestedCategory.name}),(0,a.jsxs)("ul",{children:[(0,a.jsx)("li",{children:i("purchase_cancelled.arrivalTime",{arrivalTime:h.Z.fromUtc(e.checkinTime,e.asset.timezone)})}),(0,a.jsx)("li",{children:i("purchase_cancelled.departureTime",{departureTime:h.Z.fromUtc(e.checkoutTime,e.asset.timezone)})})]})]},t))})})})})})};var f=n(22312),g=n(46844),x=n.n(g),k=()=>{let{t:e}=(0,l.$G)("book");return(0,a.jsx)("div",{className:"grid",children:(0,a.jsx)("div",{className:x().content,children:(0,a.jsx)(r.D7,{icon:(0,a.jsx)(r.JO,{className:x().iconLoader,type:"contrast",children:(0,a.jsx)(f.Z,{})}),title:e("payment_confirmation_awaiting.title"),titleAs:"h2",titleDisplay:"block",centered:!0,size:"l",elevation:1,children:(0,a.jsx)(r.Mr,{children:(0,a.jsx)("p",{children:e("payment_confirmation_awaiting.description")})})})})})},j=n(50722),P=n.n(j),T=()=>{let{t:e}=(0,l.$G)("book");return(0,a.jsx)("div",{className:"grid",children:(0,a.jsx)("div",{className:P().content,children:(0,a.jsx)(r.D7,{icon:(0,a.jsx)(p.Z,{type:"info"}),title:e("payment_confirmation_timeout.contentTitle"),titleAs:"h2",titleDisplay:"block",centered:!0,size:"l",elevation:1,subtitle:e("payment_confirmation_timeout.subtitle"),children:(0,a.jsx)(r.Mr,{compact:!0,className:P().cardContent,children:(0,a.jsx)("p",{children:e("payment_confirmation_timeout.body")})})})})})},b=n(89549),I=(e,t,n)=>{let a="".concat(window.location.origin,"/").concat(t,"/book/purchase/").concat(e);return{clientActionOptions:{redirect:{okUrl:"".concat(a,"?ref=payment_ok"),koUrl:"".concat(a,"?ref=payment_failed")}},...(null==n?void 0:n.isWallet)?{paymentContext:[b.Lq.Wallet]}:{}}},w=n(72887),S=n(95278),N=n(48255),C=n(11333),L=n(48240),A=n(64637),M=n(50697),E=n(30030),Z=n(20865),O=e=>{let t=e=>{if(!e)return null;let t=(h.Z.fromUtc(e,h.Z.userTimezone()).date.getTime()-h.Z.fromNow(h.Z.userTimezone()).date.getTime())/1e3;if(t<=0)return null;let n={min:0,sec:0};return t>=60&&(n.min=Math.floor(t/60),t-=60*n.min),n.sec=Math.floor(t),n},[n,a]=(0,o.useState)(t(e)),r=(0,o.useRef)(null);return(0,o.useEffect)(()=>(r.current=setTimeout(()=>a(t(e)),1e3),()=>{r.current&&clearTimeout(r.current)}),[n]),n},D=n(48228),Y=n(59660);let $="\n    mutation BookPurchaseAddPayment($purchaseId: ID!, $paymentMethodId: ID, $selectedPaymentMethod: SelectedPaymentMethodInput, $paymentIntentOptions: PaymentIntentOptionsInput) {\n  purchaseAddPayment(\n    input: {purchaseId: $purchaseId, paymentMethodId: $paymentMethodId, selectedPaymentMethod: $selectedPaymentMethod, paymentIntentOptions: $paymentIntentOptions}\n  ) {\n    paymentIntent {\n      ...PurchaseAddPaymentPaymentIntent\n    }\n    userErrors {\n      __typename\n    }\n  }\n}\n    ".concat("\n    fragment PurchaseAddPaymentPaymentIntent on PaymentIntent {\n  pendingAmount\n  forcedThreeDSecure\n  clientAction {\n    __typename\n    ... on PaymentIntentSdkAction {\n      provider\n      jsLibraryUrl\n      params {\n        key\n        value\n      }\n    }\n    ... on PaymentIntentRedirectAction {\n      url\n    }\n  }\n}
1\n    "),F=e=>(0,D.D)(["BookPurchaseAddPayment"],e=>(0,Y._i)($,e)(),e);var z=n(99801),q=n(98844),B=n.n(q);let K=async(e,t,n,a,r)=>{var i;let o=await e({purchaseId:t,selectedPaymentMethod:n,paymentIntentOptions:a}),s=o.purchaseAddPayment.userErrors||[];if(0!==s.length){if(s.find(e=>"PurchaseAddPaymentNoPendingBalanceError"===e.__typename))return null;throw Error("Unknown Purchase add payment error on StepPaymentFailed: ".concat(s.map(e=>e.__typename).join(", ")))}let c=o.purchaseAddPayment.paymentIntent;if(!c)throw Error("Missing payment intent at StepPaymentFailed");let l=(null==r?void 0:r.isWallet)?N.Qk:(null==r?void 0:r.isSavedCard)?N.T8:null;return l&&(null===(i=c.clientAction)||void 0===i?void 0:i.__typename)==="PaymentIntentSdkAction"?{...c,clientAction:{...c.clientAction,params:[...c.clientAction.params,{key:l,value:"true"}]}}:c},R=e=>{var t;let{availablePaymentMethods:n,paymentMethodId:r,purchase:i,onCreateReservationsSuccess:s,onReleaseTime:c}=e;(0,Z.Z)();let{t:d}=(0,l.$G)("book"),u=(0,l.ZK)(),m=O(i.releaseTime),{charge:p,stripeWallet:h,isLoading:_,error:y}=(0,S.Ig)(),{mutateAsync:v}=F(),{trackSelected:g}=(0,C.Z)({context:"retry",availablePaymentMethods:n,wallet:h}),[x,k]=(0,o.useState)(null===(t=n[0])||void 0===t?void 0:t.__typename),[j,P]=(0,o.useState)(null),[T,b]=(0,o.useState)(!1);m||(window.dataLayer.push({event:"purchase_cancelled"}),c()),(0,o.useEffect)(()=>{!x&&n.length>0&&k(n[0].__typename)},[n,x]);let D=async e=>{e.preventDefault(),b(!0),P(null);let t=n.find(e=>e.__typename===x);if(!t){P(d("errors.no_payment_method_selected")),b(!1);return}g(t);try{let e="AvailablePaymentMethodWallet"===t.__typename,n="AvailablePaymentMethodSavedCard"===t.__typename,a=n?t.id:r,o=await K(v,i.id,(0,N.Os)(t,a),I(i.id,u,{isWallet:e}),{isWallet:e,isSavedCard:n});if(!o||!o.clientAction){window.dataLayer.push({event:"retry_succeeded",event_category:"booking_engine_payment",event_location:"retry"}),s();return}await p(o),window.dataLayer.push({event:"retry_succeeded",event_category:"booking_engine_payment",event_location:"retry"}),s()}catch(e){if(window.dataLayer.push({event:"retry_failed",event_category:"booking_engine_payment",event_location:"retry"}),e instanceof S.Ou){var a;P((null===(a=e.details)||void 0===a?void 0:a.message)||d("common:validation.unknownError"))}else e instanceof S.Wn||S.Lk,(0,z.O7)(e,{extra:{purchaseId:i.id}}),P(d("common:validation.unknownError"));b(!1)}};return(0,a.jsx)("div",{className:"grid",children:(0,a.jsx)("div",{className:B().formContent,children:(0,a.jsx)("form",{onSubmit:D,children:(0,a.jsxs)(L.Z,{title:d("purchase_pending.formTitle"),children:[j&&(0,a.jsx)(M.Z,{className:B().alert,type:"error",title:d("common:validation.level.error"),children:j}),(0,a.jsx)(E.Z,{className:B().timeLeftProse,children:(0,a.jsx)(U,{timeLeft:m})}),y&&!_?(0,a.jsx)(M.Z,{className:B().alert,type:"error",title:d("common:validation.level.error"),children:d("common:validation.unknownError")}):(0,a.jsx)(w.A,{availablePaymentMethods:n,selectedOptionId:x,onSelectedOptionChanged:e=>k(e),wallet:h,isLoading:_}),(0,a.jsx)(A.Z,{children:(0,a.jsx)(S.a0,{paymentMethodType:x,disabled:_||T||!!y,icon:T&&(0,a.jsx)(f.Z,{}),children:d("purchase_pending.pay")})})]})})})})},U=e=>{let{timeLeft:t}=e;return(0,a.jsxs)("div",{className:B().timeLeft,children:[(0,a.jsxs)("svg",{viewBox:"0 0 23 22",className:B().timeLeftIcon,children:[(0,a.jsx)("path",{d:"M17.688 21.313H1.874L3.938 6.188h13.75l1.003 6.998"}),(0,a.jsx)("path",{d:"M7.375 8.938V4.125A3.404 3.404 0 0 1 10.813.687a3.404 3.404 0 0 1 3.437 3.438v4.813M17.688 21.313a4.125 4.125 0 1 0 0-8.25 4.125 4.125 0 0 0 0 8.25Z"}),(0,a.jsx)("path",{d:"M17.688 15.813v1.374h1.375"})]}),(0,a.jsx)("span",{children:(0,a.jsx)(l.cC,{i18nKey:"book:purchase_pending.subtitle",components:{paymentCountdown:(0,a.jsxs)("span",{className:B().timeLeftTime,children:[null==t?void 0:t.min.toString().padStart(2,"0"),":",null==t?void 0:t.sec.toString().padStart(2,"0")," min"]})}})})]})};var G=e=>{var t,n,r,i;let{assetId:o,paymentContinuation:s,purchase:c,payNowTotal:l,onCreateReservationsSuccess:d,onReleaseTime:u}=e;return(0,a.jsx)(S.P8,{assetId:o,availablePaymentMethods:s.availablePaymentMethods,payNowTotal:l,children:(0,a.jsx)(R,{availablePaymentMethods:s.availablePaymentMethods,paymentMethodId:(null===(n=s.selectedPaymentMethod)||void 0===n?void 0:null===(t=n.newCard)||void 0===t?void 0:t.paymentMethodId)||(null===(i=s.selectedPaymentMethod)||void 0===i?void 0:null===(r=i.wallet)||void 0===r?void 0:r.paymentMethodId)||void 0,purchase:c,onCreateReservationsSuccess:d,onReleaseTime:u})})},V=n(32621),W=n(31847),X=e=>{(0,d.mr)("be-24hleadtime-3ds-forced",e?1:0)},Q=e=>{let{purchaseId:t,selectedPaymentMethod:n,onSuccess:a,onNoPendingPayment:r,onFail:i}=e,s=(0,o.useRef)(null),c=(0,l.ZK)(),{mutateAsync:d}=F(),u=async e=>{try{let e=await d({purchaseId:t,selectedPaymentMethod:n,paymentIntentOptions:I(t,c)}),o=e.purchaseAddPayment.userErrors||[];
1if(0!==o.length){if(o.find(e=>"PurchaseAddPaymentNoPendingBalanceError"===e.__typename)){r();return}(0,z.O7)(Error("Purchase add payment error ".concat(o.map(e=>e.__typename).join(", "))),{extra:{purchaseId:t}}),i();return}if(e.purchaseAddPayment.paymentIntent){X(e.purchaseAddPayment.paymentIntent.forcedThreeDSecure),a(e.purchaseAddPayment.paymentIntent);return}(0,z.O7)(Error("Purchase add payment returned no payment intent"),{extra:{purchaseId:t}}),i()}catch(n){if(n instanceof Y.ci&&n.errors.find(e=>{var t;return(null===(t=e.extensions)||void 0===t?void 0:t.code)==="UNAVAILABLE"})&&e>0){s.current=setTimeout(()=>u(e-1),2e3);return}(0,z.O7)(n,{extra:{purchaseId:t}}),i()}};(0,o.useEffect)(()=>(u(5),()=>{s.current&&clearTimeout(s.current)}),[t])},J=n(57875),H=n.n(J);let ee=e=>{let{purchase:t,paymentContinuation:n,onPaymentSuccess:i,onPaymentError:s}=e,{t:c}=(0,l.$G)("book"),{charge:d}=(0,V.Ig)(),[u,m]=(0,o.useState)(!1);return Q({purchaseId:t.id,selectedPaymentMethod:n.selectedPaymentMethod,onSuccess:async e=>{try{await d(e),i()}catch(e){e instanceof V.Ou||(0,z.O7)(e,{extra:{purchaseId:t.id}}),s()}},onFail:()=>{m(!0)},onNoPendingPayment:()=>{i()}}),(0,a.jsx)("div",{className:"grid",children:(0,a.jsx)("div",{className:H().content,children:(0,a.jsx)(r.D7,{icon:u?(0,a.jsx)(r.zM,{type:"error"}):(0,a.jsx)(r.JO,{className:H().iconLoader,type:"contrast",children:(0,a.jsx)(f.Z,{})}),title:c("purchase_processing.title"),titleAs:"h2",titleDisplay:"block",centered:!0,size:"l",elevation:1,children:u?(0,a.jsx)("div",{className:H().error,children:(0,a.jsx)(W.Z,{type:"error",title:c("common:validation.level.error"),children:c("common:validation.unknownError")})}):(0,a.jsx)(r.Mr,{children:(0,a.jsx)("p",{children:c("purchase_processing.description")})})})})})};var et=e=>{let{assetId:t,purchase:n,paymentContinuation:r,onPaymentSuccess:i,onPaymentError:o}=e;return(0,a.jsx)(V.P8,{assetId:t,availablePaymentMethods:r.availablePaymentMethods,children:(0,a.jsx)(ee,{purchase:n,paymentContinuation:r,onPaymentSuccess:i,onPaymentError:o})})},en=n(57200),ea=n(55765),er=n(43304),ei=n(58122),eo=n(37015),es=n(93362),ec=function(e){let{reservations:t,purchaseId:n,assetId:a}=e,{enabled:r}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{enabled:!0},[i,s]=(0,o.useState)(!1);(0,o.useEffect)(()=>{if(r&&0!==t.length&&!i){let e=t[0],r=t.reduce((e,t)=>{var n;return(0,es.QM)(e,(null===(n=t.billingSummary)||void 0===n?void 0:n.balance.totalAmount.grossValue)||es.fK)},es.fK);(0,d.L9)({event:"purchase",purchase_id:n,purchase_asset_id:a,purchase_accounting_balance_total_amount_value:r.amount/100,purchase_accounting_balance_total_amount_currency:r.currency,purchase_checkin_time:null==e?void 0:e.checkinTime,purchase_checkout_time:null==e?void 0:e.checkoutTime}),(0,d.L9)({event:"page_view",page:window.location.pathname,page_type:"thank_you"}),s(!0)}},[r,t,i])},el=n(92424),ed=n(36492);n(59403);let eu=(e,t)=>(0,ed.a)(["StepThankYou",e],(0,Y._i)("\n    query StepThankYou($assetId: ID!) {\n  asset(id: $assetId) {\n    id\n    displayName\n    timezone\n    spaceCategories {\n      id\n      name\n    }\n  }\n}\n    ",e),t);eu.getKey=e=>["StepThankYou",e];let em=(e,t)=>(0,ed.a)(["StepThankYouExtras",e],(0,Y._i)("\n    query StepThankYouExtras($purchaseId: ID!) {\n  purchase(id: $purchaseId) {\n    id\n    reservations {\n      nodes {\n        id\n        createdAt\n        storeOrders {\n          nodes {\n            id\n            lines {\n              id\n              fulfilmentStatus\n              product {\n                name\n                image {\n                  url\n                }\n              }\n            }\n          }\n        }\n      }\n    }\n  }\n}\n    ",e),t);em.getKey=e=>["StepThankYouExtras",e];var ep=n(95926),eh=n.n(ep);let e_=e=>{let{assetId:t,purchaseId:n,reservations:i,firePurchaseEvent:o=!0}=e,{t:s}=(0,l.$G)("book"),{session:c}=(0,ea.k)(),{data:d,isLoading:u,isError:m}=eu({assetId:t}),_=ev(n);ec({reservations:i,purchaseId:n,assetId:t},{enabled:o});let y=null==d?void 0:d.asset,v=(0,a.jsxs)(a.Fragment,{children:[m&&(0,a.jsx)(en.Z,{className:eh().alert,type:"info",children:s("thank_you.error.unknownError")}),i.map((e,t)=>(0,a.jsxs)("div",{className:eh().reservation,children:[(0,a.jsx)("div",{className:eh().categoryName,children:e.requestedCategory.name}),(0,a.jsxs)("div",{className:eh().details,children:[(0,a.jsx)("div",{children:s("thank_you.confirmationNumber",{confirmationNumber:e.confirmationNumber})}),y&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("div",{children:s("thank_you.checkinTime",{checkinTime:h.Z.fromUtc(e.checkinTime,y.timezone)})}),(0,a.jsx)("div",{children:s("thank_you.checkoutTime",{checkoutTime:h.Z.fromUtc(e.checkoutTime,y.timezone)})})]})]}),(0,a.jsx)(ey,{lines:_[e.id]||[]}),e.billingSummary&&(0,a.jsxs)("div",{className:eh().price,children:[(0,a.jsx)("span",{className:eh().priceLabel,children:s("thank_you.total")}),(0,a.jsx)("strong",{children:s("common:money",{money:e.billingSummary.balance.totalAmount.grossValue})})]})]},t)),i&&n&&(null==c?void 0:c.accountId)&&(0,a.jsx)(eo.Z,{className:eh().button,href:"/myplace/purchase/".concat(n),children:s("thank_you.goToReservation")})]});return(0,a.jsx)("div",{className:"grid",children:(0,a.jsx)("div",{className:eh().content,children:(0,a.jsx)(r.D7,{icon:u?(0,a.jsx)(r.JO,{className:eh().iconLoader,type:"contrast",children:(0,a.jsx)(f.Z,{})}):(0,a.jsx)(p.Z,{type:"success"}),title:s("thank_you.contentTitle"),titleAs:"h2",titleDisplay:"block",subtitle:s("thank_you.subtitle",{assetName:null==y?void 0:y.displayName}),centered:!0,size:"l",elevation:1,children:(0,a.jsx)("div",{className:eh().cardContent,children:v})})})})},ey=e=>{let{lines:t}=e,{t:n}=(0,l.$G)("book");return 0===t.length?null:(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("strong",{className:eh().extrasTitle,children:n("thank_you.extras.title")}),(0,a.jsx)("ul",{className:eh().extras,children:t.map(e=>{var t;let r=(0,el.oS)(e.fulfilmentStatus);return(0,a.jsx)(ei.Z,{disabled:!0,startElement:(0,a.jsx)(er.Z,{imgClassName:eh().extraImage,src:(null===(t=e.product.image)||void 0===t?void 0:t.url)||"",sizes:"40px"}),title:e.product.name,children:(0,a.jsx)("span",{className:eh().extraStatus,style:{color:(0,el.DL)(r)},children:n("storeStatus:fulfilmentStatus.".concat(r))})},e.id)})})]})},ev=e=>{let{data:t,refetch:n}=em({purchaseId:e}),[a,r]=(0,o.useState)(!1),i=!a&&ef(t);return(0,o.useEffect)(()=>
1{if(!i)return;let e=setTimeout(async()=>{await n(),r(!0)},2e3);return()=>clearTimeout(e)},[i,n]),eg(t)},ef=e=>{var t,n;return((null==e?void 0:null===(n=e.purchase)||void 0===n?void 0:null===(t=n.reservations)||void 0===t?void 0:t.nodes)||[]).some(e=>{var t;return 0===((null===(t=e.storeOrders)||void 0===t?void 0:t.nodes)||[]).length&&Date.now()-new Date(e.createdAt).getTime()<6e3})},eg=e=>{var t,n;return((null==e?void 0:null===(n=e.purchase)||void 0===n?void 0:null===(t=n.reservations)||void 0===t?void 0:t.nodes)||[]).reduce((e,t)=>{var n;let a=((null===(n=t.storeOrders)||void 0===n?void 0:n.nodes)||[]).reduce((e,t)=>[...e,...t.lines],[]);return a.length>0&&(e[t.id]=a),e},{})};var ex=e=>{let t=e.map(e=>{var t,n,a;return null===(a=e.billingSummary)||void 0===a?void 0:null===(n=a.balance)||void 0===n?void 0:null===(t=n.totalAmount)||void 0===t?void 0:t.grossValue}).filter(e=>!!e);return 0===t.length?null:t.reduce((e,t)=>(0,es.QM)(e,t),{amount:0,currency:t[0].currency})},ek=n(22387),ej=n(82944);let eP="\n    query BookPurchaseFlow($purchaseId: ID!) {\n  purchase(id: $purchaseId) {\n    id\n    status\n    viewerIsOwner\n    asset {\n      id\n      displayName\n      timezone\n    }\n    defaultPaymentMethod {\n      id\n    }\n    availablePaymentMethods {\n      ...BookPaymentProviderAvailablePaymentMethod\n    }\n    reservations {\n      nodes {\n        ...BookCartContextReservation\n        requestedCategory {\n          id\n        }\n        rate {\n          id\n        }\n      }\n    }\n  }\n}\n    ".concat(ej.G,"\n").concat(ek.mt),eT=(e,t)=>(0,ed.a)(["BookPurchaseFlow",e],(0,Y._i)(eP,e),t);eT.getKey=e=>["BookPurchaseFlow",e];var eb=n(26287),eI=n.n(eb),ew=n(86e3),eS=n.n(ew),eN=e=>{let{reason:t,purchaseId:n,onRetry:i,cause:s}=e,{t:c}=(0,l.$G)("book");return(0,o.useEffect)(()=>{(0,z.O7)(null!=s?s:Error("BookPurchaseFlow error: ".concat(t)),{extra:{purchaseId:n,reason:t}})},[]),(0,a.jsx)("div",{className:"grid",children:(0,a.jsx)("div",{className:eS().content,children:(0,a.jsx)(r.D7,{icon:(0,a.jsx)(p.Z,{type:"error"}),title:c("common:validation.level.error"),titleAs:"h2",titleDisplay:"block",centered:!0,size:"l",elevation:1,actions:(0,a.jsx)(r.zx,{onClick:i,children:c("purchase_cancelled.retry")}),children:(0,a.jsx)(r.Mr,{children:(0,a.jsx)("p",{children:c("flowError.".concat(t))})})})})})};let eC=[b.L0.Confirmed,b.L0.CheckedIn,b.L0.CheckedOut],eL=e=>{switch(e.type){case"loading":return"loading";case"error":return"error_loading";case"thank_you":return"thank_you";case"cancelled":return"purchase_cancelled";case"charging":return"purchase_processing";case"payment_confirmation_awaiting":return"payment_confirmation_awaiting";case"payment_failed":return"purchase_pending";case"payment_confirmation_timeout":return"payment_confirmation_timeout"}};var eA=e=>{let{isLoading:t,isError:n,purchase:a,phase:r,releaseTimeExpired:i,assetId:o,paymentContinuation:s,reservations:c}=e;return!a&&t?{type:"loading"}:n||!a?{type:"error",reason:"load_failed"}:a.status&&eC.includes(a.status)?{type:"thank_you",purchaseId:a.id,assetId:null!=o?o:null,reservations:c}:a.status===b.L0.Cancelled?{type:"cancelled",assetId:null!=o?o:null,reservations:c}:"failed"===r.type?o&&s?{type:"payment_failed",purchaseId:a.id,assetId:o,paymentContinuation:s}:{type:"error",reason:"missing_payment_data"}:"payment_confirmation_awaiting"===r.type?{type:"payment_confirmation_awaiting"}:"payment_confirmation_timeout"===r.type?{type:"payment_confirmation_timeout"}:i?{type:"cancelled",assetId:null!=o?o:null,reservations:c}:"charging"===r.type?o&&s?{type:"charging",purchaseId:a.id,assetId:o,paymentContinuation:s}:{type:"error",reason:"missing_payment_data"}:{type:"loading"}};let eM=[b.L0.Confirmed,b.L0.CheckedIn,b.L0.CheckedOut,b.L0.Cancelled],eE=()=>(0,a.jsx)("div",{className:"grid",children:(0,a.jsx)("div",{className:eI().loader,children:(0,a.jsx)(r.JO,{type:"contrast",children:(0,a.jsx)(f.Z,{})})})});var eZ=e=>{var t,n;let{purchaseId:r,initialPurchase:i,onStepChange:s}=e,c=(0,m.useRouter)(),[l,d]=(0,o.useState)({type:"idle"}),p=(0,o.useRef)(!1),{data:_,isLoading:y,isError:f,error:g,refetch:x}=eT({purchaseId:r},{initialData:{purchase:i},refetchInterval:e=>{var t;return!((null==e?void 0:null===(t=e.purchase)||void 0===t?void 0:t.status)&&eM.includes(e.purchase.status))&&2e3}
1,refetchIntervalInBackground:!0}),j=null==_?void 0:_.purchase,P=null==j?void 0:null===(t=j.asset)||void 0===t?void 0:t.id,I=(null==j?void 0:null===(n=j.reservations)||void 0===n?void 0:n.nodes)||[],w=Array.isArray(c.query.ref)?c.query.ref[0]:c.query.ref,S=(0,o.useMemo)(()=>{var e;let t=((null==j?void 0:null===(e=j.reservations)||void 0===e?void 0:e.nodes)||[]).map(e=>e.releaseTime).filter(e=>!!e).sort();return t.length>0?t[0]:null},[j]),N=O(S),C=null!=S&&null===N,L=(0,o.useMemo)(()=>{var e;return ex((null==j?void 0:null===(e=j.reservations)||void 0===e?void 0:e.nodes)||[])},[j]),A=(0,o.useMemo)(()=>j?{...j.defaultPaymentMethod?{selectedPaymentMethod:{savedCard:{paymentMethodId:j.defaultPaymentMethod.id}}}:{},availablePaymentMethods:j.availablePaymentMethods||[]}:null,[j]),M=eA({isLoading:y,isError:f,purchase:j,phase:l,releaseTimeExpired:C,assetId:P,paymentContinuation:A,reservations:I}),E=eL(M);(null==j?void 0:j.status)&&j.status!==b.L0.Confirmed&&j.status!==b.L0.CheckedIn&&j.status!==b.L0.CheckedOut&&(p.current=!0);let Z=!!w||p.current;switch((0,o.useEffect)(()=>{s(E)},[E]),(0,o.useEffect)(()=>{if(c.isReady&&"idle"===l.type&&(null==j?void 0:j.status)===b.L0.Pending&&!C)switch(w){case"checkout":d({type:"charging"});break;case"payment_ok":d({type:"payment_confirmation_awaiting"});break;default:d({type:"failed"})}},[c.isReady,l.type,null==j?void 0:j.status,w,C]),(0,o.useEffect)(()=>{if("payment_confirmation_awaiting"!==l.type)return;let e=setTimeout(()=>d({type:"payment_confirmation_timeout"}),2e4);return()=>clearTimeout(e)},[l.type]),(0,o.useEffect)(()=>{"thank_you"===M.type&&w&&c.replace({pathname:c.pathname,query:{id:r}},void 0,{shallow:!0})},[M.type,w]),M.type){case"loading":return(0,a.jsx)(eE,{});case"payment_confirmation_awaiting":return(0,a.jsx)(k,{});case"error":return(0,a.jsx)(eN,{reason:M.reason,purchaseId:r,cause:g,onRetry:()=>x()});case"payment_confirmation_timeout":return(0,a.jsx)(T,{});case"thank_you":return(0,a.jsx)(e_,{assetId:M.assetId||"",purchaseId:M.purchaseId,reservations:M.reservations,firePurchaseEvent:Z});case"cancelled":{let e=M.reservations[0],t=t=>(0,u.WU)(h.Z.fromUtc(t,e.asset.timezone).date,"yyyy-MM-dd"),n=e&&M.assetId?"/book?".concat(new URLSearchParams({from:t(e.checkinTime),to:t(e.checkoutTime),voucher:"",asset_id:M.assetId,space_category_id:e.requestedCategory.id,rate_id:e.rate.id}).toString()):"/";return(0,a.jsx)(v,{reservations:M.reservations,onRetry:()=>c.push(n)})}case"charging":return(0,a.jsx)(et,{assetId:M.assetId,purchase:{id:M.purchaseId},paymentContinuation:M.paymentContinuation,onPaymentSuccess:()=>{d({type:"payment_confirmation_awaiting"}),x()},onPaymentError:()=>{d({type:"failed"})}});case"payment_failed":return(0,a.jsx)(G,{assetId:M.assetId,paymentContinuation:M.paymentContinuation,purchase:{id:M.purchaseId,releaseTime:S},payNowTotal:L,onCreateReservationsSuccess:()=>{d({type:"payment_confirmation_awaiting"}),x()},onReleaseTime:()=>{d({type:"idle"}),x()}});default:return(0,z.O7)(Error("Unhandled case in BookPurchaseFlow")),null}},eO=n(13718),eD=n.n(eO);let eY=["thank_you","purchase_processing","purchase_pending","purchase_cancelled","payment_confirmation_awaiting","payment_confirmation_timeout"];var e$=!0,eF=e=>{let{purchase:t}=e,{t:n}=(0,l.$G)("book"),[u,m]=(0,o.useState)("loading"),p=n(eY.includes(u)?"".concat(u,".title"):"title");return(0,o.useEffect)(()=>{var e;let n=(0,i.nZ)();return n.setTag("purchase_id",t.id),(null===(e=t.asset)||void 0===e?void 0:e.id)&&n.setTag("asset_id",t.asset.id),()=>{n.setTag("purchase_id",void 0),n.setTag("asset_id",void 0)}},[]),(0,o.useEffect)(()=>{let e=(0,i.nZ)();return e.setTag("book_step",u),()=>{e.setTag("book_step",void 0)}},[u]),(0,o.useEffect)(()=>{window.scrollTo(0,0),("purchase_processing"===u||"purchase_pending"===u||"purchase_cancelled"===u||"payment_confirmation_awaiting"===u||"payment_confirmation_timeout"===u)&&(0,d.L9)({event:"page_view",page:window.location.pathname,page_type:u})},[u]),(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(s.T3,{title:p,backOnClick:()=>{history.back()}}),(0,a.jsx)(c.pQ,{title:p,noindex:!0}),(0,a.jsx)(r.VM,{className:eD().hero,title:p,breadcrumbs:[],noDescriptionProse:!0}),(0,a.jsx)("div",{className:eD().content,children:(0,a.jsx)(eZ,{purchaseId:t.id,initialPurchase:t,onStepChange:m})})]})}},87036:function(e){e.exports={actions:"CardKleeActions_actions__6F8a1",noPadding:"CardKleeActions_noPadding__w2AqX"}},13718:function(e){e.exports={content:"_id__content__Twb_X",hero:"_id__hero__fS5u_"}},99734:function(e){e.exports={retryLink:"StepNotCompletedOnTime_retryLink___x0Gd",reservation:"StepNotCompletedOnTime_reservation__k2Kf8",cardContent:"StepNotCompletedOnTime_cardContent__7e6At",iconLoader:"StepNotCompletedOnTime_iconLoader__qut7U",content:"StepNotCompletedOnTime_content__mBK4h"}},46844:function(e){e.exports={iconLoader:"StepPaymentConfirmationAwaiting_iconLoader__qv_L7",content:"StepPaymentConfirmationAwaiting_content__CTr67"}},50722:function(e){e.exports={cardContent:"StepPaymentConfirmationTimeout_cardContent__XcuiY",content:"StepPaymentConfirmationTimeout_content__o6sot"}},98844:function(e){e.exports={timeLeftProse:"StepPaymentFailed_timeLeftProse__sNVP6",alert:"StepPaymentFailed_alert__ihygr",timeLeft:"StepPaymentFailed_timeLeft__NPN2Y",timeLeftTime:"StepPaymentFailed_timeLeftTime__fC7KL",timeLeftIcon:"StepPaymentFailed_timeLeftIcon__ALCGv",balancedAction:"StepPaymentFailed_balancedAction__hTwep",formContent:"StepPaymentFailed_formContent__4VvSl"}},57875:function(e){e.exports={error:"StepPaymentProcessing_error__VwTv5",iconLoader:"StepPaymentProcessing_iconLoader__TN2tQ",content:"StepPaymentProcessing_content__e1g_y"}},95926:function(e){e.exports={reservation:"StepThankYou_reservation__uiLWK",details:"StepThankYou_details__UwkWI",price:"StepThankYou_price__fnTbK",priceLabel:"StepThankYou_priceLabel__dXjB_",categoryName:"StepThankYou_categoryName__k3GqK",extrasTitle:"StepThankYou_extrasTitle__AY3T7",extras:"StepThankYou_extras__rL6Uz",extraImage:"StepThankYou_extraImage___sPL3",extraStatus:"StepThankYou_extraStatus__xfknt",cardContent:"StepThankYou_cardContent__cVcmM",iconLoader:"StepThankYou_iconLoader__my5_h",alert:"StepThankYou_alert__6pjaq",button:"StepThankYou_button__gMKvR",content:"StepThankYou_content__PdtvH"}},26287:function(e){e.exports={loader:"BookPurchaseFlow_loader__jI5eb"}},86e3:function(e){e.exports={content:"BookPurchaseFlowError_content__g3KCI"}}},function(e){e.O(0,[2411,4300,2888,9774,179],function(){return e(e.s=66418)}),_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.