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(531260),S=n(364995),y=n(31823),v=n(426398),T=n(473617),N=n(937008),j=n(800471),b=n(216641),R=n(67480),P=n(45938),L=n(428262),M=n(881489),O=n(344159),w=n(299301),k=n(71867),D=n(222707),U=n(559778),G=n(376843);function 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);function Z(e){let{reviewWarningMessage:t,selectedPlanId:n,handlePaymentSourceAdd:G,isTrial:Z,planGroup:q,isDiscount:$,metadata:J}=e,X=function(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,v.jm)(),{isEmbeddedIAP:g}=(0,y.V)(),{isPremium:A,isPremiumGroupPurchase:C,isEligibleForDiscount:x}=(0,a.i)(),{checkoutPaymentSources:w}=(0,S.t)(),{isGift:k,giftRecipient:D,selectedGiftStyle:U}=(0,N.Pv)(),G=(0,M.ds)()&&!k,F=o??"",V=(0,I.bG)([R.A],()=>R.A.get(F),[F]),B=V?.eligiblePaymentGateways,H=(0,j.vT)({isTrial:r,isGift:k,selectedSkuId:o,startedPaymentFlowWithPaymentSources:h}),{subscriptionPlan:W,purchaseDisabled:K,checkoutInvoicePreview:Y,invoiceSummaryTypeWithPreview:z,proratedInvoicePreview:Z,renewalInvoicePreview:q,subscriptionPeriodEnd:$}=(0,T.V)({selectedPlanId:t,priceOptions:u,trialId:l,metadata:s,isTrial:r}),J=k&&(0,P.Ik)(D),X=u.paymentSourceId,Q=(0,b.g)(n,X),ee=w?.find(e=>e.id===X)?.relocationCountry??null,{hasEntitlements:et,entitlements:en}=(0,O.X)(W.id,k),el=(0,L.J$)(u.paymentSourceId),ei=(0,_.A)({forceFetch:!1,excludeReverseTrial:!1,excludeReverseTrialFromCountdown:!0}),es=!H&&(ei.isFractionalPremiumActive||G)&&f.JM.has(t),er=i.useMemo(()=>(0,L.Tm)({skuId:o,isPremium:A,defaultPlanId:m}),[o,m,A]),ea=i.useMemo(()=>et&&null==X?E.intl.format(E.t["2wPRSF"],{months:en.length}):null,[et,X,en]);return{disabled:K,activeSubscription:c,subscriptionPeriodEnd:$,plan:W,premiumPlanOptions:er,checkoutInvoicePreview:Y,invoiceSummaryTypeWithPreview:z,renewalInvoicePreview:q,proratedInvoicePreview:Z,isGift:k,isEmbeddedIAP:g,paymentSourceType:Q,giftRecipient:D,selectedGiftStyle:U,isInOneStepSubscriptionCheckout:H,shouldAllowPlanSelect:H&&!C,hasPaymentSources:p,paymentSourceId:X,eligiblePaymentGateways:B,inReverseTrial:G,fractionalPremiumInfo:ei,showFractionalPremiumBannerInInvoiceSummary:es,isPrepaid:el,isCustomGift:J,isPremium:A,isPremiumGroupPurchase:C,isEligibleForDiscount:x,hasEntitlements:et,entitlements:en,paymentSourceOptionalWarningCopy:ea,selectedSourceRelocationCountry:ee}}(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,L.xq)(eh.id),ek=(0,L.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===w.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=(0,k.i)({planSkuId:eh.skuId}),eB=i.useMemo(()=>null!=eD?eD:null!=eV?eV:null!=eG?eG:null,[eD,eV,eG]),eH=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]),eW=null!=ec?ec.invoicePreview:null,{priceOptions:eK,planPricesLoading:eY}=(0,L.Pr)(ei,eW,es),ez={shouldShowGlobalNotices:!0,upperInlineNoticeProps:eH,planSelectContent:eg?(0,l.jsx)(B.X,{disabled:X.disabled,selectedPlanId:n,priceOptions:eK,planOptions:ef,subscriptionPeriodEnd:ed,planPricesLoading:eY}):void 0,paymentMethodContent:eT,promotionalNoticeContent:eB};if(null==ec&&null!=es)return(0,l.jsx)(r.T,{...ez,legalContent:null});if(null==ec||ec.type===w.N$.LOADING)return(0,l.jsx)(r.E,{});let eZ=null!=eN?eN.subscription_trial:void 0,eq=ec.type===w.N$.PREMIUM_WITH_TRIAL?null:(0,l.jsx)(V.W9,{invoiceSummaryTypeWithPreview:ec,subscriptionPlan:eh,isPrepaidPaymentSource:ep,subscriptionTrial:eZ,isCustomGift:eE}),e$=null;if(!ep&&(w.IJ.has(ec.type)||ec.type===w.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_});e$=(0,l.jsx)(c._,{...e})}let eJ=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}),eX=(0,l.jsx)(V.PI,{planGroup:q,activeSubscription:eI,isTrial:Z,plan:eh,isGift:eo,paymentSourceType:eC,isPrepaidPaymentSource:ep,invoiceSummaryTypeWithPreview:ec,fractionalPremiumInfo:e_}),eQ=ec.type===w.N$.PREMIUM_WITH_TRIAL?(0,K.ib)(ec.invoicePreview.currency):(0,s.kw)({subscriptionInvoiceRecord:ec.invoicePreview});return(0,l.jsx)(r.T,{...ez,purchaseItemContent:eJ,subscriptionDetailsContent:e$,invoiceSummaryContent:eq,legalContent:eX,invoiceTotalDueValue:eQ,invoiceTotalDueLabel:eo?E.intl.string(z.default.Zxav97):E.intl.string(z.default.R0cZsM)})}}