Loading
function(e,t,n){"use strict";n.d(t,{M:()=>y});var l=n(627968),i=n(64700),s=n(688810),r=n(795791),a=n(615310),o=n(192308),u=n(139033),c=n(626584),d=n(174459),m=n(38405),h=n(71804),p=n(652215),f=n(375708);let g=new c.A("CheckoutErrorBoundary.tsx");class E extends i.PureComponent{state={error:null,info:null};closeCheckoutAndShowAlert(){(0,o.closeAllModals)(),(0,u.A)({title:f.intl.string(f.t.iufib1),subtitle:f.intl.string(f.t.ZUEGFn),confirmText:f.intl.string(f.t.TyCVIq)})}getCrashedFlag(e){return e instanceof h.v?"rethrow"===e.errorHandlingBehavior:"rethrow"===this.props.errorHandlingBehavior}emitSentryException(e,t){let{loadId:n,selectedSkuId:l,selectedPlanId:i,skuIds:s,isGift:r,purchaseType:a,locationStack:o,additionalAnalyticsData:u}=this.props,c=this.getCrashedFlag(e),d={loadId:n,selectedSkuId:l,selectedPlanId:i,isGift:r,purchaseType:a,skuIds:s,locationStack:o,...e instanceof h.v?{checkoutErrorExtraInformation:e.extraSentryInformation}:{}},p={tags:{app_context:"billing",checkout_error:"true",billing_context:"checkout",...c?{crashed:"true"}:{}},extra:{...d,...u??{},...null!=t?{reactErrorInfo:t}:{}}};return m.A.captureException(e,p),g.error("Checkout error occurred:",{error:e,additionalErrorContext:d}),{sentryErrorOptions:p}}emitPaymentFlowErrorAnalytics(e){let t=this.getCrashedFlag(e),{loadId:n,locationStack:l,additionalAnalyticsData:i}=this.props,s="string"==typeof e?e:e.message;d.default.track(p.HAw.PAYMENT_FLOW_ERROR,{load_id:n,crashed:t,error_message:s,location_stack:l??[],...i})}componentDidCatch(e,t){let{sentryErrorOptions:n}=this.emitSentryException(e,t);if(this.emitPaymentFlowErrorAnalytics(e),this.setState({error:e,info:t}),null!=this.props.onUnhandledError&&this.props.onUnhandledError(e,t,n),e instanceof h.v){if("close-and-alert"===e.errorHandlingBehavior)this.closeCheckoutAndShowAlert();else throw e;return}if("close-and-alert"===this.props.errorHandlingBehavior)this.closeCheckoutAndShowAlert();else throw this.props.errorHandlingBehavior,e}render(){return null!=this.state.error?null!=this.props.renderCustomErrorComponent?this.props.renderCustomErrorComponent(this.state.error,this.state.info):null:this.props.children}}var A=n(426398),C=n(21713),x=n(211159),I=n(263885),_=n(783327),S=n(788868);function y(e){let{stepConfigs:t,breadcrumbs:n,loadId:s,discoverySessionId:o,purchaseType:u=p.VVm.SUBSCRIPTION,overrideCustomCheckoutFlow:c,...d}=e,m=JSON.stringify(d.skuIDs),h=i.useMemo(()=>d.skuIDs,[m]),f=JSON.stringify(d.currencySkuIDs??[]),g=i.useMemo(()=>d.currencySkuIDs??[],[f]),E=(0,r.$w)(),A=i.useMemo(()=>({skuIds:h,currencySkuIds:g,isGift:d.isGift??!1,referralTrialOfferId:d.referralTrialOfferId??null,activeSubscription:d.activeSubscription??null,excludeSubscriptionPlansBySKU:d.excludeSubscriptionPlansBySKU??!1,purchaseType:u,defaultPlanId:d.defaultPlanId,referralCode:d.referralCode,customCheckoutFlow:c??E,unifiedCheckoutFlow:d.unifiedCheckoutFlow,paymentGateway:d.paymentGateway,applicationId:d.applicationId??S.tv}),[h,g,u,d.isGift,d.referralTrialOfferId,d.activeSubscription,d.excludeSubscriptionPlansBySKU,d.applicationId,d.defaultPlanId,d.referralCode,c,E,d.unifiedCheckoutFlow,d.paymentGateway]);return(0,l.jsx)(a.mz,{stepConfigs:t,breadcrumbs:n,children:(0,l.jsx)(I.P,{loadId:s,discoverySessionId:o,checkoutInitParameters:A,children:(0,l.jsx)(v,{...d,skuIDs:h,purchaseType:u})})})}function v(e){let{errorHandlingBehavior:t="rethrow",onUnhandledError:n,skuIDs:r,children:a}=e,{paymentSources:o}=(0,A.jm)(),{contextMetadata:u,unifiedCheckoutFlow:c,purchaseType:d,isGift:m,selectedSkuId:h,selectedPlanId:p,paymentSourceId:f,paymentGateway:g}=(0,x.t4)(e=>({contextMetadata:e.contextMetadata,unifiedCheckoutFlow:e.unifiedCheckoutFlow,purchaseType:e.purchaseType,isGift:e.isGift,selectedSkuId:e.selectedSkuId,selectedPlanId:e.selectedPlanId,paymentSourceId:e.paymentSourceId,paymentGateway:e.paymentGateway})),I=null!=f&&null!=o[f]?o[f]?.type:null,S=i.useMemo(()=>({payment_source_id:f,payment_gateway:g,payment_source_type:I,checkout_flow:c}),[f,g,I,c]),y=(0,s.Db)();return(0,l.jsx)(C.yv,{children:(0,l.jsx)(_.R,{children:(0,l.jsx)(E,{errorHandlingBehavior:t,locationStack:y,onUnhandledError:n,loadId:u.loadId,selectedSkuId:h??null,selectedPlanId:p??null,isGift:m,skuIds:r,purchaseType:d,additionalAnalyticsData:S,children:a})})})}}