Build 576754stable
Module 735305
2,321 characters · in a47768fc7477158e.jsDependencies
Source Raw
function(e,t,n){n.d(t,{x:()=>P});var l=n(284009),i=n.n(l),r=n(976634),a=n(446044),s=n(426398),o=n(211083),u=n(463376),c=n(21713),d=n(6938),p=n(61299),m=n(174459),C=n(723702),h=n(937008),E=n(166532),A=n(566980),f=n(615310),y=n(652215),S=n(202541);function P(e){let{analyticsData:t,initialPlanId:n,breadcrumbSteps:l,handleStepChange:P,onReturn:T,continueSessionToInitialStep:I}=e,{paymentSources:_}=(0,s.jm)(),{selectedSkuId:g,setPurchaseState:x,contextMetadata:v,paymentSourceId:N,setPaymentSourceId:b,purchaseError:R,setPurchaseError:M,activeSubscription:O}=(0,d.t4)(e=>({selectedSkuId:e.selectedSkuId,setPurchaseState:e.setPurchaseState,contextMetadata:e.contextMetadata,paymentSourceId:e.paymentSourceId,setPaymentSourceId:e.setPaymentSourceId,purchaseError:e.purchaseError,setPurchaseError:e.setPurchaseError,activeSubscription:e.activeSubscription})),{purchaseErrorBlockRef:j}=(0,c.Gm)(),{paymentAuthenticationState:L}=(0,o.o)(),{enabled:w}=(0,a.Y)({location:"PaymentModalAddPaymentStep"}),{isPremiumGroupPurchase:D,isEligibleForTrial:k}=(0,u.i)(),{step:U,previousStep:G}=(0,f.Ay)(),{isGift:F}=(0,h.Pv)(),B={...(0,p._V)(),paymentSources:_,paymentSourceId:N,setPaymentSourceId:b,purchaseError:R,setPurchaseError:M,purchaseErrorBlockRef:j,paymentAuthenticationState:L,selectedSkuId:g,isGift:F},Y=T??function(){P(Object.values(_).length<1&&null==n?E.pn.PLAN_SELECT:E.pn.REVIEW,{trackedFromStep:w?E.pn.PAYMENT_ELEMENT:E.pn.PAYMENT_TYPE})};i()(U,"Step should be set here");let H=(0,r.A)(()=>Date.now(),[U]),W=(0,r.A)(()=>null!=I&&null==G?w?E.pn.PAYMENT_ELEMENT:I:w?E.pn.PAYMENT_ELEMENT:E.pn.PAYMENT_TYPE,[I,G,w]);return(0,p.Y)({paymentModalArgs:B,initialStep:W,prependSteps:[E.pn.PROMOTION_INFO],appendSteps:[E.pn.REVIEW,E.pn.CONFIRM],breadcrumpSteps:l,currentBreadcrumpStep:U,usePaymentModalStep:!0,analyticsData:t,onReturn:D?void 0:Y,onComplete:e=>{E.l_.has(e)?(x(A.h.COMPLETED),P(E.pn.CONFIRM,{trackedFromStep:e})):P(E.pn.REVIEW,{trackedFromStep:e})},onStepChange:e=>{let{currentStep:n,toStep:l}=e,i=Date.now();m.default.track(y.HAw.PAYMENT_FLOW_STEP,{...t,from_step:n,to_step:l,step_duration_ms:i-H,flow_duration_ms:i-v.startTime})},isEligibleForTrial:k,allowDesktopRedirectPurchase:(0,C.isDesktop)()&&null!=g&&[S.pe.TIER_0,S.pe.TIER_2].includes(g)&&!F&&null==O,continueSessionToInitialStep:I,shouldUseManaModal:!0})}}