1import{u as e,k as C,f as vt,h as bt,o as Ct,S as f,i as m,T as _t,A as Et,q as Rt}from"./esnext-vendor.BDPAaZdq.js";import{u as Ft,T as Mt,S as At,e as kt,G as wt,f as Bt,h as Tt,D as Dt,i as It}from"./components-useVaultedMsiInstallments.Br5peiWP.js";import{L as zt,P as Lt,R as xt,u as Ht,S as Ot}from"./RememberMeSection.BvcUNZhk.js";import{E as c,L as Nt,W as d,df as Vt,Q as Wt,h as Ut,d as qt,ca as Gt,y as Yt,bO as $t,bN as Jt,d2 as Kt,R as Qt,v as S,a6 as jt,_ as Xt,q as Zt,Y as ea,U as l,dg as ta,a3 as M,c as x,H as aa,b_ as H,dh as ra,r as na,m as ia,b as sa,P as oa,p as la,$ as ca,I as da,o as ua,di as ce,n as ma,V as pa,X as ha,cU as ya}from"./hydrate.B0xlt2dG.js";import{u as ye,a as Pe,V as Pa,e as ga,f as fa,h as Sa,i as va}from"./components-PaymentMethodProgressionHost.BmXVNMRw.js";import{a as ba,u as Ca,b as _a}from"./hooks-useGeneralPaymentErrorMessage.Zl8_48Ok.js";import{u as Ea,S as de,c as Ra}from"./hooks-usePostPurchase.BPY08f0g.js";import{B as Fa}from"./BillingAddressSelector.5rPdOC_H.js";import{C as Ma}from"./Captcha.DnnR7xVp.js";import{M as Aa}from"./hooks-useShopPayNewSignupLoginExperiment.CrD2gvGR.js";import{u as ka,P as wa,R as Ba,a as Ta,V as Da,S as Ia}from"./PaymentButtons.bhaFVFMx.js";import{P as ue}from"./hooks-useWalletsTimeout.i08rvNYN.js";import{a as za,T as La}from"./helpers-getNormalizedPaymentMethodName.B-mE5wnL.js";import{O as N,P as me,aW as xa,aS as Ha,a6 as O,cB as Oa,a7 as Na,Q as pe,cI as Va,bY as Wa,bS as Ua,_ as qa,cJ as Ga,ad as Ya,a$ as he}from"./hooks-useReplaceShopPayInHistory.C8UL-mAH.js";import{I as $a}from"./ImpressionEventCapture.iMEQlBKs.js";import{K as Ja}from"./KnownBuyerPaymentMethodSelector.CdxuW0E9.js";import"./app.D1P6yWfp.js";import"./amazon-pay-useAmazonPayPaymentLine.BXwZMsYY.js";import"./PaymentIcon.CQXs-ePm.js";import"./PaymentLine.BkPc0Zsc.js";import"./EmptyState.b83C9ddY.js";import"./Choice.BIzIW4rp.js";import"./Checkbox.CiixBh9Z.js";import"./localization-index.Bo8bPuxq.js";import"./helpers-credit-card-disabled.BnSr1GsQ.js";import"./hooks-useUpdateCheckoutAddress.xu8w67CI.js";import"./hooks-useShopPayExternalAppContext.DyGXtar4.js";import"./helpers-derivations.DLW2fhKL.js";import"./graphql-PaymentSessionMutation.BhOnX3QJ.js";import"./money-toShopPayMoneyInput.-nuohgDW.js";import"./redemption-promotions.CgqGtCd-.js";import"./shop-pay-normalizeBuyerDetails.ThnUnxcv.js";import"./checkout-updaters-helpers.BAeH3ddd.js";import"./helpers-setAddressErrors.BA8OjimY.js";import"./ChangeCompanyLocationLink.Ci5U9F_D.js";import"./BillingAddressForm.aTSlVDrG.js";import"./FormLayout.CMVyKzjL.js";import"./PhoneField.ykPh8SPx.js";import"./hooks-useSuppressShopPayModalOnLoad.brztd70E.js";
1import"./Popover.BUTwaoOa.js";import"./AddressPresenter.B0qw2vWQ.js";import"./hooks-useShowShopPayOptin.DZ4Mf9YD.js";import"./shared-permissions.BaDWlj5_.js";import"./Section._KuAKpGQ.js";import"./hooks-useShopPayProgressIntercepts.Sxhi7oHx.js";import"./MissingFields.DB7ri4eR.js";import"./components-RedirectionNotice.module.BGJWZ6-9.js";import"./useAddressMutationsWithNegotiation.BfzEjUy6.js";import"./Rollup.iQVJ47hC.js";import"./utilities-publishMessage.BORnEDuA.js";import"./utilities-stable-ref.Dvd2X3ul.js";import"./PayButton-helpers.Dg5kgVMm.js";import"./ShopPayCaptcha.CPpzhmEJ.js";import"./PaymentErrorBanner.CHfgrXa-.js";import"./hooks-useHasOrdersFromMultipleShops.C_XGQrjx.js";import"./hooks-useWalletsMonorailTrack.CvfUTPBc.js";import"./hooks-usePaypalRowEffects.CTzKbnMt.js";function Ka(){const{i18n:a,shop:{developmentShop:n},url:r}=N();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(Nt,{href:r.developmentStoreOrderTestingDocs(),children:a.translate("payment_errors.development_store_order_testing_docs_link")})})}):null}const y=a=>e(M,{children:a});function Qa({hostedFieldsLoaded:a,children:n}){const{i18n:r,shop:i,source:u,checkout:o,observability:_}=N(),{giftCardsEnabled:A,discountCodesEnabled:p,acceptTipPayments:h}=i,{configuration:v}=o,s=o.latestReceipt.value,ge=Vt(),fe=p&&ge.value,{nextPage:P,previousPage:k}=Wt(),[Se,ve]=C(!1),[be,V]=C(!1),[Ce,_e]=C(!1),Ee=u.type==="simulated",W=me().buyerIdentity.value?.purchasingCompany,E=!!W,Re=u.type==="draftOrder",U=E&&Re,Fe=xa(),{cartLineChangeLoadingSignal:Me}=Ha(),Ae=Me.value,[q,w]=C(!1),[G,ke]=C(),{negotiate:Y,progress:we,progressing:Be}=Ut(),$=O().isBlocked.value,Te=Oa(),B=Na(),J=me(),K=J.paymentMethods,De=E&&!o.isShippingRequired.value,Ie=ka(),R=!Te.value||B.value,{billingAddressOption:ze,directPaymentErrors:Le,generalPaymentError:Q,generalPaymentErrorCode:j,paymentLines:{value:b}}=pe(),xe=za({shop:i,checkout:o,paymentMethods:K?.value}),He=b.some(t=>t.method.type==="wallet"||t.method.type==="walletsPlatformPaymentMethod"),Oe=!R&&o.isShippingRequired.value&&!He&&ze.value==="shipping"?!1:Va({lines:b,paymentMethods:K?.value,purchasingCompany:!!W,isBillingAddressForced:!xe})||!R,X=pe().localizationExtensions.value,{value:Ne}=Wa(),Ve=Ne.length!==0,Z=R&&Ve||!R,T=b.some(t=>t.method.type==="direct"),{displayedPaymentMethods:We}=ye({experienceType:"list"}),ee=Pe(We).mode==="knownBuyerShared",Ue=qt().value,qe=Gt(),Ge=Yt({isPayWithPayPalButton:!0}).value.status==="error";Ft();const Ye=J.managedByMarketsPro,te=$||Ee&&P.id!=="review"||qe.value&&Ge||Ae,{lastJourneyProgression:$e}=O(),Je=async()=>{if(!te){w(!0);try{await we("payment-form-submit",t=>{const F=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),_e(t.status==="fetch_failed"),V(F||L),ve(St)})}catch(t){t instanceof Error&&ke(t)}finally{w(!1)}}},D=$t(),Ke=vt(()=>ba(Le)),I=s?.status==="failed",g=I&&s?.failure.type==="payment"?s.failure:void 0,ae=g?.code==="AUTHENTICATION_ERROR",Qe=I&&s?.failure?.type==="inventory"?s.failure:void 0,je=Ce,Xe=!!(be||I&&s?.failure?.type==="order"),Ze=g!=null&&!ae,et=Jt(g),tt=Q.value&&!Ua(j.value),at=Ca(Q.value,j.value),rt=r.translate("payment.title"),nt=r.translate("general.pay_now_button_label"),it=o.configuration.layout.isOnePage.value,st=Kt(),ot=s?.status==="failed"&&s.failure.type==="payment"&&s.failure.code==="GENERIC_ERROR"&&b[0]?.method.type==="walletsPlatformPaymentMethod"&&b[0]?.method.name===qa.AmazonPay;Ea({stage:T&&!a?de.Usable:de.Complete,id:"Payment"}),Qt("payment");const re=!!g,ne=s?.id,ie=!!(g&&Ga.has(g.code));if(bt(()=>{if(!(D||!re||E)){if(ie){_.log("payment_form_skip_negotiate_captcha","[PaymentForm] Skipped negotiate for CAPTCHA_REQUIRED receipt â handled by useHandleReceipt",{receiptId:ne});return}(async()=>await Y({silenceViolations:["all"],fieldsToResolve:["paymentLines"]}))()}},[re,D,E,Y,_,ie,ne]),G)throw G;const lt=S("Checkout::Dynamic::Render","PAYMENT1"),se=S("Checkout::Dynamic::Render","PAYMENT2"),oe=S("Checkout::Dynamic::Render","PAYMENT3"),le=S("Checkout::Dynamic::Render","PAYMENT4"),ct=S("purchase.checkout.payment-method-list.render-before"),dt=S("purchase.checkout.payment-method-list.render-after"),ut=v.visibility.showReductions,mt=Ya(),pt=jt({base:!0,medium:!1}),ht=!mt.value||pt;let z=null;v.visibility.showAside?ht&&(z=e(ma,{above:"small",children:e(ce,{headerLevel:1,monorailSection:"payment"})})):z=e(ce,{headerLevel:1,monorailSection:"payment"});const yt=ut&&!U&&(A||p)?z:null,Pt=U||Fe.value?!1:h&&!he(u),gt=Ye.value&&Z&&P.id!=="review",ft=q||Be.value;return Ct(()=>{$e.value.type==="failed"&&V(!0)}),e(f,{children:[e(La,{children:rt}),e(Xt,{onSubmit:Je,disabled:q||$,implicitSubmit:nt,children:e(Zt,{children:[e(ea,{children:[e(l,{customizations:lt,render:y}),e(ja,{genericPaymentError:Ze,shouldSuppressReceiptError:D,inventoryReservationFailure:Qe,isAmazonPaymentDeclineScenario:ot,networkFailure:je,orderFailure:Xe,paymentErrorMessage:et,processingFailed:Se}),e(Ka,{}),yt,Pt?e(f,{children:[e(ta,{sectionId:"tips",children:e(Mt,{renderInSection:!0,headingLevel:1})}),e(l,{customizations:se,render:y})]}):null,X.length>0&&e(f,{children:e(M,{accessibilityLabel:r.translate("localized_fields.additional_information.title"),children:e(x,{gap:"base",children:[e(aa,{id:`${H}-localized-fields`,level:1,children:r.translate("localized_fields.additional_information.title")}),X.map((t,F)=>{const L=`${t.value.key}${F}`;return e(zt,{localizationExtension:t,index:F},L)})]})})}),e(f,{}),e(M,{accessibilityRole:"group",accessibilityLabelledBy:H,children:e(x,{gap:"base",children:[e(Lt,{headingId:H,autoFocus:!it}),e(m,{when:v.visibility.showStoreCreditRedemption,children:e(At,{})}),tt?e(d,{errorType:c.PaymentError,tone:"critical",children:at}):null,e(m,{when:Ke,children:e(d,{errorType:c.PaymentError,tone:"critical",children:r.translate("payment.generic_incorrect_card_info")})}),ae?e(d,{errorType:c.PaymentError,tone:"critical",children:r.translate("payment_errors.three_d_secure_failed")}):null,e(l,{customizations:ct}),e(m,{when:v.visibility.showStoreCreditRedemption,children:e(kt,{})}),n,e(l,{customizations:dt}),e(m,{when:Ie,children:e(Ma,{})})]})}),e(wt,{}),h?e(l,{customizations:oe,render:y}):e(l,{customizations:se,render:y}),Oe&&(o.isShippingRequired.value||he(u)||De)&&!st.value&&!(ee&&T)?e(Fa,{}):null,h?e(l,{customizations:le,render:y}):e(l,{customizations:oe,render:y}),e(xt,{compact:!0}),!h&&e(l,{customizations:le,render:y}),Ue&&!(ee&&T)?e(M,{children:e(Pa,{})}):null,e(m,{when:B,children:e(ue,{placement:"default",wrapInSection:!0}
1)}),e(m,{when:v.visibility.showPurchaseOrderNumberField,children:e(ga,{})})]}),gt&&e(Aa,{}),e(wa,{}),fe&&e(ra,{targetSelector:'input[name="reductions"]',icon:"discount",label:r.translate("order_summary.discount_discovery.add_code")}),e(m,{when:B,children:e(ue,{placement:"above-pay-button"})}),e(na,{children:[e(ia,{children:[e(Ba,{children:e(Ta,{disabled:!Z||te,loading:ft,defaultLabel:P.label,pixelId:"go_to_next_step"})}),P.notice?e(f,{children:[e(sa,{blockSize:"small-200"}),e(oa,{textAlign:"center",color:"subdued",type:"small",children:P.notice})]}):null]}),k.route?e(la,{children:e(ca,{href:k.route,variant:"plain",inlineSize:"fill",textDecoration:"none",pixelId:"go_to_previous_step",children:e(x,{direction:"inline",gap:"small-200",alignItems:"center",children:[e(da,{type:"chevron-left",size:"small"}),e(ua,{children:k.label})]})})}):null]}),P.id==="review"?null:e(f,{children:[e(Da,{}),e(Ia,{})]})]})})]})}const ja=({orderFailure:a,inventoryReservationFailure:n,isAmazonPaymentDeclineScenario:r,genericPaymentError:i,processingFailed:u,shouldSuppressReceiptError:o,paymentErrorMessage:_,networkFailure:A})=>{const{i18n:p}=N(),{lastJourneyProgression:h}=O();return r?null:(i||u)&&!o?e(d,{errorType:c.PaymentError,tone:"critical",children:_}):A?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}=ye({experienceType:"list"}),n=Pe(a),r=_t(()=>a.map(i=>"name"in i?i.name:i.type),[a]);return n.mode==="knownBuyerShared"?e($a,{impressionType:"payment",impressionFeatures:fa(r,n),children:e(Xa,{})}):e(Sa,{renderVaultingAgreementInline:!1})}function on(){const a=Et(!1),n=Ht(),r=_a(),{postPurchaseEnabled:i}=Ra(),u=Rt(()=>{a.current=!0},[]);return e(ya,{target:"cart.paymentLines[0]",children:[e(pa,{section:"payment",children:e(ha,{section:"payment",children:e(Qa,{hostedFieldsLoaded:a.current,children:e(Dt,{blurValidationEnabled:!0,onSetFieldErrors:r,onLoadSuccess:u,children:[e(er,{}),e(Za,{}),e(m,{when:n,children:e(Ot,{})})]})})})}),i&&e(It,{})]})}function er(){return va(),null}export{er as PaymentMethodCustomizations,on 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.