1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1422],{25759:(e,a,t)=>{"use strict";t.d(a,{A:()=>m});var r=t(6029),o=t(79002),i=t.n(o),n=t(82203),s=t.n(n),c=t(42043),l=t(44761),d=t(42346),u=t(92520),p=t(82882);let m=e=>{let{children:a}=e,t=(0,c.useTranslations)("Global"),{isAuthenticated:o}=(0,u.uM)(),{channel:n}=(0,p.A)(),m="object"==typeof(null==a?void 0:a.props)&&(null==a?void 0:a.props)!=null&&"closeRedirection"in a.props&&"string"==typeof a.props.closeRedirection?null==a?void 0:a.props.closeRedirection:o?"/home":"/";return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("header",{className:"jsx-9cf79463701a0ae6 main-header",children:[(0,r.jsx)("div",{className:"jsx-9cf79463701a0ae6 logo-wrapper",children:(0,r.jsx)(s(),{href:o?"/home":"/",legacyBehavior:!0,children:(0,r.jsx)("a",{"data-testid":"LayoutModal-go-to-home",className:"jsx-9cf79463701a0ae6",children:(0,r.jsx)(d.A,{UNSAFE_className:"confirmation-logo",channel:n,variant:"LogoWithBackground",role:"img","aria-label":t("companyName")})})})}),(0,r.jsx)("div",{className:"jsx-9cf79463701a0ae6 close",children:(0,r.jsx)(s(),{href:m,legacyBehavior:!0,children:(0,r.jsx)("a",{"data-testid":"LayoutModal-close",className:"jsx-9cf79463701a0ae6",children:(0,r.jsx)(l.A,{width:14,height:14,"aria-hidden":!0})})})})]}),(0,r.jsx)("main",{className:"jsx-9cf79463701a0ae6",children:a}),(0,r.jsx)(i(),{id:"9cf79463701a0ae6",children:"header.main-header.jsx-9cf79463701a0ae6{position:relative;display:flex;flex-direction:column;align-items:center;background:var(--clr-primary-5)}.logo-wrapper.jsx-9cf79463701a0ae6{text-align:center;margin:var(--space-5)auto}.logo-wrapper.jsx-9cf79463701a0ae6 a.jsx-9cf79463701a0ae6{display:block}.close.jsx-9cf79463701a0ae6{position:absolute;top:var(--space-6);right:var(--space-6)}.close.jsx-9cf79463701a0ae6 a.jsx-9cf79463701a0ae6{padding:var(--space-2)}@media(max-width:800px){header.main-header.jsx-9cf79463701a0ae6{background:var(--white);min-height:60px}.logo-wrapper.jsx-9cf79463701a0ae6{margin:var(--space-2)auto 0}.logo-wrapper.jsx-9cf79463701a0ae6 .confirmation-logo{width:130px}}@media(min-width:801px){body{background:var(--clr-primary-5)}}"})]})}},42825:(e,a,t)=>{"use strict";t.r(a),t.d(a,{__N_SSG:()=>C,default:()=>E});var r=t(6029),o=t(55729),i=t(81278),n=t(7234),s=t(3948),c=t(78135),l=t(42043),d=t(60750),u=t(95295),p=t(7746),m=t(21347),h=t(22526),f=t(25759),y=t(48796),g=t(92520),x=t(31973),v=t(57674),_=t(70585),w=t(67792),k=t(89542),j=t(74363),b=t.n(j);let S=()=>{let e=(0,i.useRouter)(),a=e.query["cko-payment-id"];if((0,o.useEffect)(()=>{e.isReady&&!a&&(b().error("no payment id to process"),e.replace("/home"))},[e.isReady,a]),(0,o.useEffect)(()=>{let a=e.asPath;return e.beforePopState(()=>(e.replace(a),!1)),()=>{e.beforePopState(()=>!0)}},[e]),!e.isReady||!a)return(0,r.jsx)(m.A,{});let t=e.query.checkoutCartId||sessionStorage.getItem(y.HU)||"";return(0,r.jsx)(d.r_,{checkoutCartId:t,children:(0,r.jsx)(A,{paymentId:a,checkoutCartId:t})})},A=e=>{let{paymentId:a,checkoutCartId:t}=e,f=(0,i.useRouter)(),x=f.query["cko-session-id"]?"cko_redirect":"no_3ds",j=(0,l.useTranslations)("Global"),S=(0,l.useTranslations)("Checkout.Payment.Errors"),{isSubscriptionAvailable:A}=(0,p.X)(g.uM),{customer:C}=(0,g.uM)(),{checkEligibility:E}=(0,d.hO)(),[N]=(0,n.n)(u.bR),[I]=(0,n.n)(u.Bi),[O]=(0,s._)(u.PO),[P]=(0,s._)(u.Yy),[R]=(0,n.n)(u.rS),{deleteCurrentShoppingCart:T,shoppingCartId:F}=(0,v.UI)(),M=(0,o.useRef)(!1),[L,B]=(0,o.useState)(!1);return(0,o.useEffect)(()=>{let e=setTimeout(()=>B(!0),5e3);return()=>clearTimeout(e)},[]),(0,o.useEffect)(()=>{(F&&C||L)&&!M.current&&(M.current=!0,(async()=>{var e,r,o,i,n,s;try{b().info("Completing checkout order after Flow payment",{payment_id:a,checkout_cart_id:t,return_leg:x}),C||b().error("Completing the Flow payment without the customer document â savings, order count and cart deletion will be wrong",{payment_id:a,checkout_cart_id:t});let{data:n}=await O({variables:{tokenValue:t}}),s=null==n||null==(e=n.getCheckoutCartWithRefresh)?void 0:e.cart;if(!(null==s||null==(r=s.payment)?void 0:r.id))throw Error("Cart or payment not found after the Flow payment");
1if(s.checkoutState===h.ZL.COMPLETED){b().info("Flow payment already completed, skipping replay",{payment_id:a,checkout_cart_id:t,return_leg:x}),await f.replace({pathname:"/checkout/confirmation",query:{checkoutCartId:t}});return}let c=(null==(o=s.payment.method)?void 0:o.code)||"checkout_com_card";await N({variables:{tokenValue:t,cartPaymentId:s.payment.id,paymentMethodCode:c,financialPaymentIntentId:a}});let l=sessionStorage.getItem(y.Bk);if(sessionStorage.removeItem(y.Bk),l&&l!==h.iH.NO_SAVE)try{let{data:e}=await P({variables:{paymentId:a}});(null==e||null==(i=e.getPayment)?void 0:i.paymentMethodId)&&await R({variables:{paymentMethodId:e.getPayment.paymentMethodId,paymentMethodSource:h.vT.CHECKOUT,financialPaymentId:a}})}catch(e){b().info("Card attachment skipped or failed",{error:e})}let d=localStorage.getItem(_.r);localStorage.removeItem(_.r),await I({variables:{tokenValue:t,paymentMetadata:{app:(0,k.FS)(),platform:(0,k.BE)()},...A&&{withSubscription:!0,membershipPlan:h.cG.YEARLY,subscriptionPromotionCode:d||void 0}}}),await T(),s.shippingAddress&&E({street:s.shippingAddress.street,city:s.shippingAddress.city,postalCode:s.shippingAddress.postcode,country:s.shippingAddress.countryCode});let u=(s.items||[]).reduce((e,a)=>{let{variantOriginalPrice:t,unitPrice:r,quantity:o}=a;return t>0?e+(t-r)*o/100:e},0),p=(0,w.hN)({checkoutCart:s,customer:C,totalEconomy:u,isSubscriptionAvailable:A,selectedPaymentType:h.HH.CARD});await f.replace({pathname:"/checkout/confirmation",query:{checkoutCartId:t,pastSavingsAmount:p.pastSavingsAmount,newSavingsAmount:p.newSavingsAmount,isFirstOrder:p.isFirstOrder,"cs-free-trial-start":p.isFreeTrialStart}})}catch(r){b().error("Failed to complete checkout after the Flow payment",{error:r,payment_id:a,checkout_cart_id:t,return_leg:x});let e=(null==r||null==(s=r.graphQLErrors)||null==(n=s[0])?void 0:n.code)==="ORDER_OUT_OF_STOCK";c.oR.error(e?S("cannotCompleteOrderOutOfStock"):j("errorOccurredTryAgain")),await f.replace("/cart")}})())},[a,null==C?void 0:C.uid,F,A,L]),(0,r.jsx)("div",{className:"tw-flex tw-min-h-[300px] tw-items-center tw-justify-center",children:(0,r.jsx)(m.A,{})})};S.getLayout=()=>f.A;var C=!0;let E=(0,x.A)(S)},55665:(e,a,t)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/checkout/processing",function(){return t(42825)}])}},e=>{e.O(0,[2346,9364,6593,636,8792],()=>e(e.s=55665)),_N_E=e.O()}]); 2//# sourceMappingURL=processing-d7e98e956d1cda61.js.map
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.