Module 312649

3,773 characters · in no known chunk
Dependencies
Source Raw
function(e,t,n){"use strict";n.d(t,{A:()=>P});var r=n(627968),i=n(64700),s=n(503698),a=n.n(s),o=n(284009),l=n.n(o),u=n(311907),c=n(732955),d=n(688810),_=n(742810),f=n(558620),p=n(427675),h=n(169797),m=n(94420),E=n(810498),g=n(155984),A=n(683433),I=n(344159),T=n(367921),S=n(79387),y=n(45938),v=n(927578),N=n(123633),C=n(937008),R=n(156312),O=n(495263),b=n(216641),D=n(999784),L=n(652215),w=n(650098);let M=e=>{let{showBackButton:t,onBackClick:n}=e,{premiumSubscription:s,isGift:a,planGroup:o,isPrepaid:l}=e,{buttonLabel:u,analyticsLocations:c,application:d,hasAcceptedTerms:_,paymentSourceId:f,activeSubscription:p,devShelfFetchState:m,hasPaymentSources:E}=(0,T.Ke)({premiumSubscription:s,isGift:a,planGroup:o,isPrepaid:l}),g=i.useMemo(()=>(0,T.X1)(e,{buttonLabel:u,analyticsLocations:c,application:d,hasAcceptedTerms:_,paymentSourceId:f,activeSubscription:p,devShelfFetchState:m,hasPaymentSources:E}),[e,u,c,d,_,f,p,m,E]);return(0,r.jsx)(h.lo,{onBackClick:t?n:void 0,primaryButtonProps:g})};function P(e){let{premiumSubscription:t,setPurchaseState:n,onBack:s,onNext:o,legalTermsNodeRef:h,flashLegalTerms:P,invoiceError:x,planError:k,baseAnalyticsData:U,flowStartTime:G,trialId:F,planGroup:V,analyticsLocation:B,openInvoiceId:H,metadata:j,backButtonEligible:Y,disablePurchase:W,isTrial:K=!1,onPaymentSourceAdd:$}=e,{selectedSkuId:z,invoicePreview:q}=(0,m.t4)(e=>{let{selectedSkuId:t,checkoutInvoicePreview:n}=e;return{selectedSkuId:t,invoicePreview:n}}),{priceOptions:Z,setHasAcceptedTerms:X,setPurchaseError:Q,purchaseType:J,paymentSourceId:ee,paymentSources:et,referralCode:en,contextMetadata:er}=(0,R.P5)(),ei=(0,f.A)(),es=(0,p.gU)(),ea=(0,p.RR)(),{isGift:eo,selectedGiftStyle:el,customGiftMessage:eu,emojiConfetti:ec,soundEffect:ed,giftRecipient:e_,selectedGiftingPromotionReward:ef}=(0,C.Pv)(),ep=(0,E.Mq)(ei),eh=(0,y.lo)(e_),em={};em.gift_style=el,em.reward_sku_ids=ep&&null!=ef?[ef]:[],eh===y.tB.CUSTOM_MESSAGE_EMOJI_SOUNDBOARD&&(l()(null!=e_,"Gift recipient must be set at purchase review step for these gift options."),em.recipient_id=e_.id,em.custom_message=eu,em.emoji_id=ec?.id,em.emoji_name=ec?.id==null?ec?.surrogates:void 0,em.sound_id=ed?.soundId);let eE=ei?.id,{analyticsLocations:eg}=(0,d.Ay)(),eA=(0,b.W)(et,ee),[eI,eT]=i.useState(!1),[eS,ey]=i.useState(!1),{hasEntitlements:ev}=(0,I.X)(eE,eo),eN=(0,v.J$)(Z.paymentSourceId),eC=(0,g.l)(),eR=(0,u.bG)([N.A],()=>N.A.currentOrderId),eO=null,eb=null;if(J===L.VVm.ONE_TIME){l()(null!=z,"SKU must be selected for one-time purchases"),eO=es[z]??null,l()(null!=eO,"SKU must exist and be fetched.");let e=ea[z],t=ee??S.B;eb=null!=e?e[t]??e[S.B]:null}let eD=async()=>{await (0,O.l)({setPurchaseState:n,setHasAcceptedTerms:X,setIsSubmitting:eT,setPurchaseError:Q,hasRedirectURL:eS,setHasRedirectURL:ey,isGift:eo,baseAnalyticsData:U,analyticsLocation:B,analyticsLocations:eg,flowStartTime:G,subscriptionPlan:ei,planGroup:V,trialId:F,priceOptions:Z,paymentSource:eA,isPrepaidPaymentPastDue:eC,openInvoiceId:H,premiumSubscription:t,onNext:o,metadata:j,sku:eO,skuPricePreview:eb,purchaseType:J,referralCode:en,loadId:er.loadId,giftInfoOptions:em,invoicePreview:q,orderId:eR})},eL=(0,_.D7)({location:"PaymentModalReviewStepFooter"}),ew=null!=H||J===L.VVm.ONE_TIME&&!eo,eM=Y&&!ew,eP={legalTermsNodeRef:h,invoiceError:x,planError:k,disablePurchase:W,flashLegalTerms:P,isSubmitting:eI,premiumSubscription:t,isGift:eo,planGroup:V,isPrepaid:eN,isTrial:K,makePurchase:eD,needsPaymentSource:null==eA&&!ev,onNext:o,onPaymentSourceAdd:$};return eL?(0,r.jsx)(M,{...eP,selectedSkuId:z,showBackButton:eM,onBackClick:s}):(0,r.jsx)(c.jlY,{children:(0,r.jsxs)("div",{className:a()(w.eT,{[w.U3]:eM}),children:[eM?(0,r.jsx)("div",{className:w.aX,children:(0,r.jsx)(A.A,{onClick:s})}):null,(0,r.jsx)(D.A,{}),(0,r.jsx)(T.Ay,{...eP})]})})}}