1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[747],{17172:function(e,n,r){"use strict";r.r(n),r.d(n,{__N_SSG:function(){return N},PaymentRedirect:function(){return P}});var t=r(30266),a=r(79056),o=r(809),i=r.n(o),c=r(52866),u=r(67461),s=r(27310),d=r(87692),l=r(36808),p=r.n(l),f=r(67294),v=r(2804),m=r(68415),g=r(38388),k=r(93273),b=r(35474),x=r(59634),_=r(87444),h=r(36897),S=r(37547),w=r(81621),y=r(45774),E=r(27316),I=r(85893),N=!0,P=function(){var e=(0,k.mr)(),n=(0,g.ph)(),r=(0,v.Zl)(b.rk),o=(0,v.Zl)(b.Fg),l=(0,_.P)(),S=(0,(0,a.Z)(l,1)[0])(),N=(0,f.useState)(!1),P=N[0],Z=N[1],C=(0,h.PN)(),A=(0,(0,a.Z)(C,1)[0])(),F=(0,s.nr)(),O=(0,a.Z)(F,2),R=O[0],T=O[1],V=(0,u.b)(),L=(0,a.Z)(V,1)[0],X=(0,d.X8)(),J=(0,a.Z)(X,1)[0],j=(0,d.ZS)(),z=(0,a.Z)(j,1)[0],Y=(0,v.sJ)(b.Vn),G=(0,f.useRef)(void 0),K=(0,f.useRef)(!1),U=R(),q=L(),B=J(),D=z();if(U&&T(U),!e)throw new Error("Expected market and locale");var M=k.vl.includes(S)?"/vitasignup/payment":"/signup/payment",W=k.vl.includes(S)?"/vitasignup/success":"/signup/success",H=(0,f.useCallback)((0,t.Z)(i().mark((function t(){var a,c,u,s,d,l,f,v,g,b,_,h,w,I,N,P,C,F,O;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!K.current){t.next=2;break}return t.abrupt("return");case 2:if(K.current=!0,a=decodeURIComponent(window.location.search),c=new URLSearchParams(a),u=c.get("memberId"),s=u||Y.id,"KLARNA"!==(d=c.get("source"))){t.next=17;break}return(l=c.get("token"))||(alert("Error: Klarna agreement creation failed"),E.logger.error("klarna agreement failed for ".concat(s)),(0,x.VF)(e,M)),t.next=13,n.saveCustomerAuthorizationToken(s,l,e.market,e.locale,!0);case 13:(f=t.sent)&&(E.logger.info("klarna agreement created for ".concat(s,", AgreementId:").concat(f.customerToken)),"Executed"!==f.status&&(alert("Error: Signup payment failed"),(0,x.VF)(e,M))),t.next=27;break;case 17:return t.next=19,(0,y.Ff)((function(){return n.fetchAgreementStatus(s)}));case 19:if("Accepted"===(null===(v=t.sent)||void 0===v?void 0:v.status)){t.next=27;break}return E.logger.error("Agreement not accepted for member ".concat(s),{response:v}),alert("Error: Could not confirm payment. Please try again."),Z(!1),K.current=!1,(0,x.VF)(e,M),t.abrupt("return");case 27:return g=p().getJSON(m._L),b=p().getJSON(m.qL),(_=p().getJSON(m.lk))&&(w=_.ip,h={ip:w}),t.prev=31,F=(0,k.zx)(S,e.market),t.next=35,n.createSubscription({subscriptionType:S,isFirstSubscription:!0,productPlan:F,discountCode:null!==A&&void 0!==A?A:void 0,giftcardId:null!==(I=G.current)&&void 0!==I?I:void 0,atGdCookie:null!==(N=null===g||void 0===g?void 0:g.at_gd)&&void 0!==N?N:void 0,memberScope:null!==U&&void 0!==U?U:void 0,transactionId:null!==(P=null===b||void 0===b?void 0:b.transactionId)&&void 0!==P?P:void 0,offerId:null!==(C=null===b||void 0===b?void 0:b.offerId)&&void 0!==C?C:void 0,makeInfluence:h,includeImmediateBox:!0,source:"vitasignup-payment-redirect",gaClientId:q,gbExp:B,gbVar:D});case 35:if("invalid discount code"!=(O=t.sent)){t.next=42;break}r((function(e){return e-1})),Z(!1),K.current=!1,t.next=49;break;case 42:return o(O),t.next=45,n.updateOrderWithPaymentDetails({paymentMethod:d,subscriptionId:O});case 45:(0,k.YX)(void 0),r(2),Z(!1),(0,x.VF)(e,W);case 49:t.next=57;break;case 51:t.prev=51,t.t0=t.catch(31),(0,k.YX)(void 0),r((function(e){return e-1})),Z(!1),K.current=!1;case 57:case"end":return t.stop()}}),t,null,[[31,51]])}))),[]);return(0,I.jsx)(c.fz,{isLoading:P,children:(0,I.jsx)(w.Y,{onSuccess:H,pathToPaymentPage:M})})};n.default=(0,S.j)(P)},66344:function(e,n,r){(window.__NEXT_P=window.__NEXT_P||[]).push(["/[market]/[locale]/vitasignup/payment-redirect",function(){return r(17172)}])}},function(e){e.O(0,[1121,9955,456,1152,478,4825,9774,2888,179],(function(){return n=66344,e(e.s=n);var n}));var n=e.O();_N_E=n}]);
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.