1import{u as e,k as C,f as bt,h as vt,p as Ct,S as f,i as m,T as _t,A as Et,q as Rt}from"./esnext-vendor.BBoIVOQW.js";import{u as Mt,T as Ft,S as kt,b as At,G as wt,c as Bt,d as Tt,D as Dt,e as zt}from"./useAddressMutationsWithNegotiation.DnKIHuqy.js";import{L as It,P as Lt,R as xt,u as Ht,S as Nt}from"./RememberMeSection.CxtiwvMS.js";import{A as c,L as Ot,W as d,cL as Wt,J as Ut,f as Vt,cM as qt,c2 as Gt,v as Kt,bK as Yt,bJ as Jt,cN as Qt,q as S,_ as $t,m as jt,N as Xt,U as l,cO as Zt,Y as F,k as x,n as ea,by as H,cP as ta,b as aa,P as ra,Q as na,I as sa,l as ia,cQ as le,H as oa,K as la,M as ca,cE as da}from"./hydrate.CpZpwHoK.js";import{u as he,a as ye,V as ua,b as ma,c as pa,d as ha,e as ya}from"./components-PaymentMethodProgressionHost.nPiADfGK.js";import{a as Pa,u as ga,b as fa}from"./hooks-useGeneralPaymentErrorMessage.BUpvFj0M.js";import{u as Sa}from"./components-RedirectionNotice.module.DDnytvlU.js";import{B as ba}from"./BillingAddressSelector.BtpqrMGX.js";import{C as va}from"./Captcha.DuggnmrF.js";import{M as Ca}from"./hooks-useShopPayNewSignupLoginExperiment.D_bc4jcm.js";import{u as _a,S as ce,b as Ea,d as Ra,c as Ma,P as Fa,a as ka}from"./Page.BD2h8hg5.js";import{u as Aa,P as wa,R as Ba,a as Ta,V as Da,S as za}from"./PaymentButtons.DOoh09u2.js";import{P as de}from"./hooks-useWalletsTimeout.vhPmlgu_.js";import{P as O,a1 as ue,bZ as Ia,am as La,ad as N,cW as xa,af as Ha,Q as me,m as Na,cX as Oa,bW as Wa,cl as Ua,ao as Va,ae as qa,cY as Ga,al as Ka,b5 as pe}from"./addresses-is-address-empty.PepcBFSY.js";import{I as Ya}from"./ImpressionEventCapture.BrCPTj4L.js";import{K as Ja}from"./KnownBuyerPaymentMethodSelector.Bt8Km1dn.js";import"./app.Czj2iPYR.js";import"./amazon-pay-useAmazonPayPaymentLine.ChQlUcWY.js";import"./PaymentIcon.D2vAu0mI.js";import"./PaymentLine.CPDOxqup.js";import"./shop-pay-installments-types.cEpCPfy-.js";import"./localization-index.D9ESi5Ky.js";import"./Theme-ThemeOverride.BHeH_ile.js";import"./IncentiveBadge.D7_F8OEV.js";import"./Choice.D2ntPel3.js";import"./Checkbox.ZKPSb1ei.js";import"./hooks-useUpdateCheckoutAddress.CezRg3B5.js";import"./hooks-useShopPayExternalAppContext.DBGG1iea.js";import"./helpers-derivations.88O-3nuU.js";import"./redemption-promotions.Cmc-1N2h.js";import"./graphql-PaymentSessionMutation.BE_WYAaU.js";import"./payment-usePaymentExemptionReason.Bgjy5l3_.js";import"./shop-pay-ProgressIntercepts.DIZEf3O7.js";import"./shop-pay-normalizeBuyerDetails.DoluEQkc.js";import"./hooks-useShopPayProgressIntercepts.CEPB46wr.js";import"./helpers-setAddressErrors.BK55aVdY.js";import"./hooks-useShowShopPayOptin.wWMt_SYO.js";import"./AddressPresenter.CV8R5hEA.js";import"./shared-permissions.DRm-hbfF.js";import"./Section.COCwDebZ.js";import"./ChangeCompanyLocationLink.D2y3vk18.js";import"./BillingAddressForm.By3LdC6k.js";import"./shipping-methods-grouping.C0avpDO6.js";import"./PhoneField.luKJG2aZ.js";import"./hooks-useSuppressShopPayModalOnLoad.Dc6HdrYh.js";import"./PayButton-helpers.BcSEFMjA.js";import"./ShopPayCaptcha.D7A2kVNv.js";import"./PaymentErrorBanner.CBWbp3aJ.js";import"./cross-border-hooks.EgRi9PIs.js";import"./hooks-usePaypalRowEffects.ByLJHPt_.js";function Qa(){const{i18n:a,shop:{developmentShop:n},url:r}=O();return n?e(d,{errorType:c.PaymentError,tone:"warning",children:a.translate("payment_errors.development_store_with_order_limit",{development_store_order_testing_docs_link:e(Ot,{href:r.developmentStoreOrderTestingDocs(),children:a.translate("payment_errors.development_store_order_testing_docs_link")})})}):null}const y=a=>e(F,{children:a});function $a({hostedFieldsLoaded:a,children:n}){const{i18n:r,shop:s,source:u,checkout:o,observability:_}=O(),{giftCardsEnabled:k,discountCodesEnabled:p,acceptTipPayments:h}=s,{configuration:b}=o,i=o.latestReceipt.value,Pe=Wt(),ge=p&&Pe.value,{nextPage:P,previousPage:A}=Ut(),[fe,Se]=C(!1),[be,W]=C(!1),[ve,Ce]=C(!1),_e=u.type==="simulated",U=ue().buyerIdentity.value?.purchasingCompany,E=!!U,Ee=u.type==="draftOrder",V=E&&Ee,Re=Ia(),{cartLineChangeLoadingSignal:Me}=La(),Fe=Me.value,[q,w]=C(!1),[G,ke]=C(),{negotiate:K,progress:Ae,progressing:we}=Vt(),Y=N().isBlocked.value,Be=xa(),B=Ha(),J=ue(),Q=J.paymentMethods,Te=E&&!o.isShippingRequired.value,De=Aa(),R=!Be.value||B.value,{billingAddressOption:ze,directPaymentErrors:Ie,generalPaymentError:$,generalPaymentErrorCode:j,paymentLines:{value:v}}=me(),Le=Na({shop:s,checkout:o,paymentMethods:Q?.value}),xe=v.some(t=>t.method.type==="wallet"||t.method.type==="walletsPlatformPaymentMethod"),He=!R&&o.isShippingRequired.value&&!xe&&ze.value==="shipping"?!1:Oa({lines:v,paymentMethods:Q?.value,purchasingCompany:!!U,isBillingAddressForced:!Le})||!R,X=me().localizationExtensions.value,{value:Ne}=Wa(),Oe=Ne.length!==0,Z=R&&Oe||!R,T=v.some(t=>t.method.type==="direct"),{displayedPaymentMethods:We}=he({experienceType:"list"}
1),Ue=ye(We).mode==="knownBuyerShared",Ve=qt().value,qe=Gt(),Ge=Kt({isPayWithPayPalButton:!0}).value.status==="error";Mt();const Ke=J.managedByMarketsPro,ee=Y||_e&&P.id!=="review"||qe.value&&Ge||Fe,{lastJourneyProgression:Ye}=N(),Je=async()=>{if(!ee){w(!0);try{await Ae("payment-form-submit",t=>{const M=t.status==="failed",L="receipt"in t&&t.receipt?.status==="failed"&&t.receipt?.failure?.type==="order",St=t.status==="success"&&"receipt"in t&&t.receipt.status==="failed";w(!1),Ce(t.status==="fetch_failed"),W(M||L),Se(St)})}catch(t){t instanceof Error&&ke(t)}finally{w(!1)}}},D=Yt(),Qe=bt(()=>Pa(Ie)),z=i?.status==="failed",g=z&&i?.failure.type==="payment"?i.failure:void 0,te=g?.code==="AUTHENTICATION_ERROR",$e=z&&i?.failure?.type==="inventory"?i.failure:void 0,je=ve,Xe=!!(be||z&&i?.failure?.type==="order"),Ze=g!=null&&!te,et=Jt(g),tt=$.value&&!Ua(j.value),at=ga($.value,j.value),rt=r.translate("payment.title"),nt=r.translate("general.pay_now_button_label"),st=o.configuration.layout.isOnePage.value,it=Qt(),ot=i?.status==="failed"&&i.failure.type==="payment"&&i.failure.code==="GENERIC_ERROR"&&v[0]?.method.type==="walletsPlatformPaymentMethod"&&v[0]?.method.name===Va.AmazonPay;_a({stage:T&&!a?ce.Usable:ce.Complete,id:"Payment"}),qa("payment");const ae=!!g,re=i?.id,ne=!!(g&&Ga.has(g.code));if(vt(()=>{if(!(D||!ae||E)){if(ne){_.log("payment_form_skip_negotiate_captcha","[PaymentForm] Skipped negotiate for CAPTCHA_REQUIRED receipt â handled by useHandleReceipt",{receiptId:re});return}(async()=>await K({silenceViolations:["all"],fieldsToResolve:["paymentLines"]}))()}},[ae,D,E,K,_,ne,re]),G)throw G;const lt=S("Checkout::Dynamic::Render","PAYMENT1"),se=S("Checkout::Dynamic::Render","PAYMENT2"),ie=S("Checkout::Dynamic::Render","PAYMENT3"),oe=S("Checkout::Dynamic::Render","PAYMENT4"),ct=S("purchase.checkout.payment-method-list.render-before"),dt=S("purchase.checkout.payment-method-list.render-after"),ut=b.visibility.showReductions,mt=Ka(),pt=$t({base:!0,medium:!1}),ht=!mt.value||pt;let I=null;b.visibility.showAside?ht&&(I=e(oa,{above:"small",children:e(le,{headerLevel:1,monorailSection:"payment"})})):I=e(le,{headerLevel:1,monorailSection:"payment"});const yt=ut&&!V&&(k||p)?I:null,Pt=V||Re.value?!1:h&&!pe(u),gt=Ke.value&&Z&&P.id!=="review",ft=q||we.value;return Ct(()=>{Ye.value.type==="failed"&&W(!0)}),e(f,{children:[e(jt,{children:rt}),e(Xt,{onSubmit:Je,disabled:q||Y,implicitSubmit:nt,children:e(Ea,{children:[e(Ra,{children:[e(l,{customizations:lt,render:y}),e(ja,{genericPaymentError:Ze,shouldSuppressReceiptError:D,inventoryReservationFailure:$e,isAmazonPaymentDeclineScenario:ot,networkFailure:je,orderFailure:Xe,paymentErrorMessage:et,processingFailed:fe}),e(Qa,{}),yt,Pt?e(f,{children:[e(Zt,{sectionId:"tips",children:e(Ft,{renderInSection:!0,headingLevel:1})}),e(l,{customizations:se,render:y})]}):null,X.length>0&&e(f,{children:e(F,{accessibilityLabel:r.translate("localized_fields.additional_information.title"),children:e(x,{gap:"base",children:[e(ea,{id:`${H}-localized-fields`,level:1,children:r.translate("localized_fields.additional_information.title")}),X.map((t,M)=>{const L=`${t.value.key}${M}`;return e(It,{localizationExtension:t,index:M},L)})]})})}),e(f,{}),e(F,{accessibilityRole:"group",accessibilityLabelledBy:H,children:e(x,{gap:"base",children:[e(Lt,{headingId:H,autoFocus:!st}),e(m,{when:b.visibility.showStoreCreditRedemption,children:e(kt,{})}),tt?e(d,{errorType:c.PaymentError,tone:"critical",children:at}):null,e(m,{when:Qe,children:e(d,{errorType:c.PaymentError,tone:"critical",children:r.translate("payment.generic_incorrect_card_info")})}),te?e(d,{errorType:c.PaymentError,tone:"critical",children:r.translate("payment_errors.three_d_secure_failed")}):null,e(l,{customizations:ct}),e(m,{when:b.visibility.showStoreCreditRedemption,children:e(At,{})}),n,e(l,{customizations:dt}),e(m,{when:De,children:e(va,{})})]})}),e(wt,{}),h?e(l,{customizations:ie,render:y}):e(l,{customizations:se,render:y}),He&&(o.isShippingRequired.value||pe(u)||Te)&&!it.value&&!(Ue&&T)?e(ba,{}):null,h?e(l,{customizations:oe,render:y}):e(l,{customizations:ie,render:y}),e(xt,{compact:!0}),!h&&e(l,{customizations:oe,render:y}),Ve&&!T?e(F,{children:e(ua,{})}):null,e(m,{when:B,children:e(de,{placement:"default",wrapInSection:!0}
1)}),e(m,{when:b.visibility.showPurchaseOrderNumberField,children:e(ma,{})})]}),gt&&e(Ca,{}),e(wa,{}),ge&&e(ta,{targetSelector:'input[name="reductions"]',icon:"discount",label:r.translate("order_summary.discount_discovery.add_code")}),e(m,{when:B,children:e(de,{placement:"above-pay-button"})}),e(Ma,{children:[e(Fa,{children:[e(Ba,{children:e(Ta,{disabled:!Z||ee,loading:ft,defaultLabel:P.label,pixelId:"go_to_next_step"})}),P.notice?e(f,{children:[e(aa,{blockSize:"small-200"}),e(ra,{textAlign:"center",color:"subdued",type:"small",children:P.notice})]}):null]}),A.route?e(ka,{children:e(na,{href:A.route,variant:"plain",inlineSize:"fill",textDecoration:"none",pixelId:"go_to_previous_step",children:e(x,{direction:"inline",gap:"small-200",alignItems:"center",children:[e(sa,{type:"chevron-left",size:"small"}),e(ia,{children:A.label})]})})}):null]}),P.id==="review"?null:e(f,{children:[e(Da,{}),e(za,{})]})]})})]})}const ja=({orderFailure:a,inventoryReservationFailure:n,isAmazonPaymentDeclineScenario:r,genericPaymentError:s,processingFailed:u,shouldSuppressReceiptError:o,paymentErrorMessage:_,networkFailure:k})=>{const{i18n:p}=O(),{lastJourneyProgression:h}=N();return r?null:(s||u)&&!o?e(d,{errorType:c.PaymentError,tone:"critical",children:_}):k?e(d,{errorType:c.PaymentError,tone:"critical",children:p.translate("order_errors.network_failure")}):n?e(d,{errorType:c.PaymentError,tone:"critical",children:p.translate("order_errors.inventory_reservation_failure")}):a?h.value.type==="failed"&&h.value.reason==="decision_rule_block"?e(d,{errorType:c.PaymentError,tone:"critical",children:p.translate("payment_errors.generic_error")}):e(d,{errorType:c.PaymentError,tone:"critical",children:p.translate("order_errors.creation_failure")}):null};function Xa(){const a=Bt({enableAutoSelect:!1}),{expandedSlot:n}=Tt(a);return e(Ja,{msiSlot:n,hideChoiceListChrome:!1,detailsPresentation:"boxed"})}function Za(){const{displayedPaymentMethods:a}=he({experienceType:"list"}),n=ye(a),r=_t(()=>a.map(s=>"name"in s?s.name:s.type),[a]);return n.mode==="knownBuyerShared"?e(Ya,{impressionType:"payment",impressionFeatures:pa(r,n),children:e(Xa,{})}):e(ha,{})}function Zr(){const a=Et(!1),n=Ht(),r=fa(),{postPurchaseEnabled:s}=Sa(),u=Rt(()=>{a.current=!0},[]);return e(da,{target:"cart.paymentLines[0]",children:[e(la,{section:"payment",children:e(ca,{section:"payment",children:e($a,{hostedFieldsLoaded:a.current,children:e(Dt,{blurValidationEnabled:!0,onSetFieldErrors:r,onLoadSuccess:u,children:[e(er,{}),e(Za,{}),e(m,{when:n,children:e(Nt,{})})]})})})}),s&&e(zt,{})]})}function er(){return ya(),null}export{er as PaymentMethodCustomizations,Zr as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.