Loading
function(e,t,n){"use strict";n.d(t,{_:()=>Z}),n(321073);var l=n(627968),i=n(64700),s=n(854354),r=n(38785),a=n(463376),o=n(266060),u=n(214891),c=n(669510),d=n(211159),m=n(683071),h=n(834730),p=n(212739);n(25827);var f=n(788868),g=n(594387),E=n(375708),A=n(234419),C=n(361597),x=n(815545),I=n(17928),_=n(546605),S=n(531260),y=n(364995),v=n(31823),T=n(426398),N=n(473617),j=n(937008),b=n(800471),R=n(216641),P=n(67480),L=n(45938),M=n(428262),O=n(881489),w=n(344159),k=n(299301),D=n(222707),U=n(559778),G=n(376843);let F=e=>{let{handlePaymentSourceAdd:t,isTrial:n,isDiscount:s,disabled:r,hasEntitlements:a,eligiblePaymentGateways:o,label:u=E.intl.string(E.t["u+Cw58"]),shouldUseUnifiedCheckoutUI:c,paymentSourceDropdownClassName:d,paymentSourceDropdownPrependOption:m,location:h="PremiumSubscriptionReview"}=e,p=i.useMemo(()=>({newPaymentMethodOptionLabel:a&&!n?E.intl.string(E.t.IGU7El):null,isTrial:n,paymentGatewayRestrictions:o,shouldUseUnifiedCheckoutUI:c,className:d,prependOption:m}),[a,n,o,c,d,m]);return(0,l.jsx)(G.N,{label:u,disabled:r,onPaymentSourceAdd:t,additionalPaymentSourceDropdownProps:p,location:h,hideCurrencySelect:s})};var V=n(340034),B=n(622631),H=n(755880),W=n(134638),K=n(888751),Y=n(906234),z=n(327105);let Z=e=>{let{reviewWarningMessage:t,selectedPlanId:n,handlePaymentSourceAdd:G,isTrial:Z,planGroup:q,isDiscount:$,metadata:J}=e,X=(e=>{let{selectedPlanId:t,paymentSources:n,trialId:l,metadata:s,isTrial:r=!1}=e,{selectedSkuId:o,priceOptions:u,activeSubscription:c,defaultPlanId:m,startedPaymentFlowWithPaymentSources:h}=(0,d.t4)(e=>({selectedSkuId:e.selectedSkuId,priceOptions:e.checkoutPriceOptions,activeSubscription:e.activeSubscription,defaultPlanId:e.defaultPlanId,startedPaymentFlowWithPaymentSources:e.startedPaymentFlowWithPaymentSources})),{hasPaymentSources:p}=(0,T.jm)(),{isEmbeddedIAP:g}=(0,v.V)(),{isPremium:A,isPremiumGroupPurchase:C,isEligibleForDiscount:x}=(0,a.i)(),{checkoutPaymentSources:k}=(0,y.t)(),{isGift:D,giftRecipient:U,selectedGiftStyle:G}=(0,j.Pv)(),F=(0,O.ds)()&&!D,V=o??"",B=(0,I.bG)([P.A],()=>P.A.get(V),[V]),H=B?.eligiblePaymentGateways,W=(0,b.vT)({isTrial:r,isGift:D,selectedSkuId:o,startedPaymentFlowWithPaymentSources:h}),{subscriptionPlan:K,purchaseDisabled:Y,checkoutInvoicePreview:z,invoiceSummaryTypeWithPreview:Z,proratedInvoicePreview:q,renewalInvoicePreview:$,subscriptionPeriodEnd:J}=(0,N.V)({selectedPlanId:t,priceOptions:u,trialId:l,metadata:s,isTrial:r}),X=D&&(0,L.Ik)(U),Q=u.paymentSourceId,ee=(0,R.g)(n,Q),et=(0,_.vg)("PremiumSubscriptionReview")?k?.find(e=>e.id===Q)?.relocationCountry??null:null,{hasEntitlements:en,entitlements:el}=(0,w.X)(K.id,D),ei=(0,M.J$)(u.paymentSourceId),es=(0,S.A)({forceFetch:!1,excludeReverseTrial:!1,excludeReverseTrialFromCountdown:!0}),er=!W&&(es.isFractionalPremiumActive||F)&&f.JM.has(t),ea=i.useMemo(()=>(0,M.Tm)({skuId:o,isPremium:A,defaultPlanId:m}),[o,m,A]),eo=i.useMemo(()=>en&&null==Q?E.intl.format(E.t["2wPRSF"],{months:el.length}):null,[en,Q,el]);return{disabled:Y,activeSubscription:c,subscriptionPeriodEnd:J,plan:K,premiumPlanOptions:ea,checkoutInvoicePreview:z,invoiceSummaryTypeWithPreview:Z,renewalInvoicePreview:$,proratedInvoicePreview:q,isGift:D,isEmbeddedIAP:g,paymentSourceType:ee,giftRecipient:U,selectedGiftStyle:G,isInOneStepSubscriptionCheckout:W,shouldAllowPlanSelect:W&&!C,hasPaymentSources:p,paymentSourceId:Q,eligiblePaymentGateways:H,inReverseTrial:F,fractionalPremiumInfo:es,showFractionalPremiumBannerInInvoiceSummary:er,isPrepaid:ei,isCustomGift:X,isPremium:A,isPremiumGroupPurchase:C,isEligibleForDiscount:x,hasEntitlements:en,entitlements:el,paymentSourceOptionalWarningCopy:eo,selectedSourceRelocationCountry:et}})(e),Q=(0,o.K)(),{isEligibleForTrial:ee,discountOffer:et,premiumGroupDiscountOffer:en}=(0,a.i)(),el=en??et,{checkoutPriceOptions:ei,checkoutInvoiceError:es,referralTrialOfferId:er}=(0,d.t4)(e=>({checkoutPriceOptions:e.checkoutPriceOptions,checkoutInvoiceError:e.checkoutInvoiceError,referralTrialOfferId:e.referralTrialOfferId??void 0})),ea=J?.guild_id??void 0,{isGift:eo,giftRecipient:eu,invoiceSummaryTypeWithPreview:ec,subscriptionPeriodEnd:ed,proratedInvoicePreview:em,plan:eh,isPrepaid:ep,premiumPlanOptions:ef,shouldAllowPlanSelect:eg,isCustomGift:eE,hasEntitlements:eA,paymentSourceType:eC,eligiblePaymentGateways:ex,activeSubscription:eI,fractionalPremiumInfo:e_,disabled:eS,isPremiumGroupPurchase:ey,paymentSourceOptionalWarningCopy:ev}=X,eT=(0,l.jsx)(F,{label:E.intl.string(E.t["u+Cw58"]),handlePaymentSourceAdd:G,isTrial:Z,isDiscount:$,disabled:eS,hasEntitlements:eA,eligiblePaymentGateways:ex,shouldUseUnifiedCheckoutUI:!0}),eN=(0,A.V)(er),{copy:ej,daysCount:eb,userTrialOffer:eR}=(0,C.O8)(),eP=(0,D.pt)({fractionalPremiumInfo:e_,selectedPlanId:n,planGroup:q,premiumSubscription:eI,isGift:eo}),eL=i.useMemo(()=>null!=el&&null!=el.discount&&null!=em&&(0,x.Ro)(em,el.discount.id),[el,em]),{setHeaderBadgeText:eM,unsetHeaderBadgeText:eO}=(0,u.v)(),ew=eo&&eh.interval===f.WT.YEAR&&(0,M.xq)(eh.id),ek=(0,M.L_)({planId:eh.id,isGift:!0,priceOptions:ei,subscriptionPlan:eh});i.useEffect(()=>(null!=ek&&ew&&eM(E.intl.formatToPlainString(z.default["Mi5BH/"],{percentOff:ek})),()=>{eO()}),[ek,eM,eO,ew]);let eD=i.useMemo(()=>{if(null!=ec&&ec.type===k.N$.PREMIUM_WITH_TRIAL&&null!=eR)return(0,l.jsx)(U.Y,{text:E.intl.format(z.default.IAsfR5,{daysCount:eb})});if(null!=el&&eL){let e=el.discount,t=el.getFullIntervalCount();if(e.userUsageLimitInterval===f.Ff.MONTH)return(0,l.jsx)(U.Y,{text:E.intl.format(z.default.wCkwJf,{percentOff:e.amount,intervalCount:t})});if(e.userUsageLimitInterval===f.Ff.YEAR)return(0,l.jsx)(U.Y,{text:E.intl.format(z.default["tUzT/U"],{percentOff:e.amount})})}return ew&&null!=ek?(0,l.jsx)(U.Y,{text:E.intl.format(z.default["7sYIBL"],{savingsPercent:ek})}):null},[eR,eL,el,eb,ec,ek,ew]),eU=(0,Y.G)(eh.id),eG=i.useMemo(()=>eU?(0,l.jsx)(H.a,{}):null,[eU]),eF=function(e){let{skuId:t,isGift:n}=e,s=(0,p.O)();return i.useMemo(()=>n||t!==f.pe.TIER_2||!1===s?null:(0,l.jsx)(m.w,{type:"info",children:(0,l.jsx)(h.E,{variant:"text-sm/medium",children:E.intl.format(g.default.Urtyu9,{days:7})})}),[n,t,s])}({skuId:eh.skuId,isGift:eo}),eV=i.useMemo(()=>null!=eD?eD:null!=eG?eG:null,[eD,eG]),eB=i.useMemo(()=>{let e=[];return null!=t&&""!==t&&e.push({type:"warning",message:t,key:"review-warning"}),null!=ev&&e.push({type:"info",message:ev,key:"payment-source-optional-warning"}),eP?e.push({directContent:(0,l.jsx)(V.l$,{fractionalPremiumInfo:e_,isEligibleForTrial:ee,trialPeriodCopy:ej,subscriptionPeriodEnd:ed}),key:"fractional-premium-notice"}):ey&&e.push({type:"info",message:(0,D.Nn)(),key:"premium-group-purchase-notice"}),null!=eF&&e.push({directContent:eF,key:"xbox-perks-notice"}),e.length>0?e:null},[t,ev,eP,e_,ee,ej,ed,ey,eF]),eH=null!=ec?ec.invoicePreview:null,{priceOptions:eW,planPricesLoading:eK}=(0,M.Pr)(ei,eH,es),eY={shouldShowGlobalNotices:!0,upperInlineNoticeProps:eB,planSelectContent:eg?(0,l.jsx)(B.X,{disabled:X.disabled,selectedPlanId:n,priceOptions:eW,planOptions:ef,subscriptionPeriodEnd:ed,planPricesLoading:eK}):void 0,paymentMethodContent:eT,promotionalNoticeContent:eV};if(null==ec&&null!=es)return(0,l.jsx)(r.T,{...eY,legalContent:null});if(null==ec||ec.type===k.N$.LOADING)return(0,l.jsx)(r.E,{});let ez=null!=eN?eN.subscription_trial:void 0,eZ=ec.type===k.N$.PREMIUM_WITH_TRIAL?null:(0,l.jsx)(V.W9,{invoiceSummaryTypeWithPreview:ec,subscriptionPlan:eh,isPrepaidPaymentSource:ep,subscriptionTrial:ez,isCustomGift:eE}),eq=null;if(!ep&&(k.IJ.has(ec.type)||ec.type===k.N$.PREMIUM_WITH_TRIAL)&&"renewalInvoicePreview"in ec&&null!=ec.renewalInvoicePreview){let e=(0,K.Gj)(ec.invoicePreview,ec.renewalInvoicePreview,ez,{discountOffer:el,isSubscriptionUpdate:null!=eI,fractionalPremiumInfo:e_});eq=(0,l.jsx)(c._,{...e})}let e$=eg?void 0:(0,l.jsx)(W._,{type:ec.type,invoicePreview:ec.invoicePreview,storeListing:Q,subscriptionPlan:eh,isPrepaidPaymentSource:ep,giftRecipient:eu,isPremiumGroupPurchase:ey,guildId:ea}),eJ=(0,l.jsx)(V.PI,{planGroup:q,activeSubscription:eI,isTrial:Z,plan:eh,isGift:eo,paymentSourceType:eC,isPrepaidPaymentSource:ep,invoiceSummaryTypeWithPreview:ec,fractionalPremiumInfo:e_}),eX=ec.type===k.N$.PREMIUM_WITH_TRIAL?(0,K.ib)(ec.invoicePreview.currency):(0,s.kw)({subscriptionInvoiceRecord:ec.invoicePreview});return(0,l.jsx)(r.T,{...eY,purchaseItemContent:e$,subscriptionDetailsContent:eq,invoiceSummaryContent:eZ,legalContent:eJ,invoiceTotalDueValue:eX,invoiceTotalDueLabel:eo?E.intl.string(z.default.Zxav97):E.intl.string(z.default.R0cZsM)})}}