Build 582977stable
Module 465657
2,188 characters · in 0c7bb03f35ecce71.jsDependencies
Source Raw
function(e,t,n){n.d(t,{Y:()=>A});var l=n(627968),i=n(64700),r=n(284009),a=n.n(r),s=n(606267),o=n(166532),u=n(482132),c=n(216641),d=n(649791),p=n(364995),m=n(426398),h=n(883645),C=n(666646),E=n(316915),f=n(26279);function A(e){let{customFooterProps:t,onFooterBackClick:n,isBackButtonEligible:r,subscriptionMetadata:A,renderStepBody:S,resolveInternalState:y,resolveTenantReviewButtonProps:P,handleStepChange:I,openInvoiceId:_,analyticsData:T,analyticsLocation:g}=e,{paymentSourceId:x,purchasePreviewError:v,customCheckoutFlow:N,contextMetadata:R,purchaseError:M,setCheckoutCurrency:b,setLinkWalletEnabled:j}=(0,E.t4)(e=>({customCheckoutFlow:e.customCheckoutFlow,contextMetadata:e.contextMetadata,paymentSourceId:e.paymentSourceId,purchasePreviewError:e.purchasePreviewError,purchaseError:e.purchaseError,setCheckoutCurrency:e.setCheckoutCurrency,setLinkWalletEnabled:e.setLinkWalletEnabled})),O=(0,h.s2)();a()(null!=O,"Step should be set");let L=i.useRef(null),{paymentSources:k}=(0,m.jm)(),{checkoutPaymentSources:w,hasInvoiceOrderContextLoaded:D}=(0,p.t)(),U=(0,C.sw)(),G=(0,c.W)(k,x),F=i.useMemo(()=>{if(null==x)return!1;if(!D)return!0;let e=w.find(e=>e.id===x);return null!=e&&!e.enabled},[w,D,x]),H=(0,s.iB)({checkoutPaymentSources:w,paymentSourceId:x,location:"CheckoutBaseReviewStep"}),{disablePurchase:B}=i.useMemo(()=>{let e={disablePurchase:H||N===f.uH.DEV_STORYBOOK_CHECKOUT};return null!=y?y({...e},{paymentSource:G,paymentSourceId:x,isSelectedPaymentSourceDisabled:F,invoicePreview:U,purchasePreviewError:v}):e},[y,G,x,F,U,v,H,N]);i.useEffect(()=>{null!=M&&null!=L.current&&L.current.scrollIntoView({behavior:"smooth"})},[M]);let Y=i.useCallback(()=>{b(void 0),n()},[b,n]),W=i.useCallback(e=>{j(e?.linkWalletEnabled??!0),I(o.pn.ADD_PAYMENT_STEPS)},[I,j]),V=i.useMemo(()=>S({handlePaymentSourceAdd:W}),[S,W]),K=(0,l.jsx)(d.U,{resolveTenantReviewButtonProps:P,onBack:Y,flowStartTime:R.startTime,onPaymentSourceAdd:W,disablePurchase:B,analyticsLocation:g,baseAnalyticsData:T,openInvoiceId:_,handleStepChange:I,postPurchaseStep:o.pn.CONFIRM,backButtonEligible:r,metadata:A,...t});return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(u.dZ,{children:V}),(0,l.jsx)(u.UX,{children:K})]})}}