1import{u as e,z as r,k as a,h as t,p as i,S as o,w as n,T as s,g as l,q as c}from"./2c1ab0fe.Bf8FS-kA.js";import{u as d,T as m,S as p,e as u,G as h,f,h as y,D as b,i as g}from"./6bfea526.B5GUEyb-.js";import{L as j,P as v,R as _,u as P,S as E}from"./73a9b0a0.BDi-HnGV.js";import{aa as S,L as w,a9 as R,dp as k,x as T,v as C,R as z,cw as L,a5 as M,c3 as A,c2 as x,dq as B,o as F,p as I,ai as D,U as N,dr as O,i as V,S as U,H,cc as Y,ds as $,d as q,f as J,a1 as G,j as Q,bp as W,a0 as K,af as X,ag as Z,d3 as ee}from"./164ad2e3.D0nOfU9-.js";import{u as re,b as ae,V as te,a as ie,c as oe,d as ne,e as se}from"./86720dbb.CeAI6sBI.js";import{a as le,u as ce,b as de}from"./58314944.Dze0G8W1.js";import{u as me}from"./ca5e9c49.DNC1C3VF.js";import{B as pe}from"./b9c0319a.BqVgxqpx.js";import{C as ue}from"./b3389d5c.CfctyB83.js";import{M as he}from"./0b8657b8.D1jsqafr.js";import{b as fe,d as ye,c as be,P as ge,a as je}from"./0a30a815.CReyh2E5.js";import{P as ve}from"./4ea44c06.BFtVoVYm.js";import{u as _e,b as Pe,R as Ee,V as Se,S as we}from"./e129c76e.B7-qOHjq.js";import{P as Re}from"./e3e348f2.BgMrBibQ.js";import{T as ke}from"./7e8cd205.Cr9qtWiV.js";import{c as Te,aM as Ce,cD as ze,a7 as Le,cE as Me,bM as Ae,bE as xe,W as Be,bc as Fe,ag as Ie,J as De}from"./4b4bc88f.DcJe9bVW.js";import{i as Ne}from"./9dba8418.CZTcH8_l.js";import{B as Oe}from"./0627daf2.C9dykehD.js";import{u as Ve}from"./9f047e05.CskjbG7J.js";import{u as Ue,S as He}from"./71ae3d5c.BGylAywU.js";import{I as Ye}from"./55098bf1.BWRIbi3t.js";import{K as $e}from"./dfc03c53.CmrSyDxn.js";import"./app.C_ntWzAC.js";import"./ac5a19ff.z0QySLm7.js";import"./598fef4e.DelGI2ri.js";import"./e77f7fe0.EoNDLyBl.js";import"./22345fd4.v5I5uNqg.js";import"./4b1c22b7.BASQngy4.js";import"./a422df8c.C_n6Vcf8.js";import"./efa0389a.WJQGJ9HI.js";import"./cc6ff67d.CEUXuJKJ.js";import"./e12db40c.B4InVJ1F.js";import"./08a3b809.L9SK5hyj.js";import"./d25d1b95.9jazcINI.js";import"./bf513f9c.BX9hBPrT.js";import"./e39bc11c.BZmT2SRz.js";import"./7a8217fd.CEN_aCN9.js";import"./8599b02a.B7SA4xfN.js";import"./cf29e63b.BinfTolV.js";import"./81e109b1.DOkM2TK2.js";import"./0e67bd3b.Dil4tpl_.js";import"./74835653.C_weFRW1.js";import"./3ca8ef7e.C6XOR-ST.js";import"./2495faa4.DwUvctcv.js";import"./a9fa9fda.ChMkqhXw.js";import"./ca3e798e.Dc6mNaNz.js";import"./47b970b2.Dc6LZ4kt.js";import"./064f6ac1.CkTWd7ab.js";import"./e0989459.-cJI74wm.js";import"./cdfd59e6.D-38Fsy6.js";import"./d0bb51ec.CL_3Kdjr.js";import"./f67abd2c.CMIDVCe_.js";import"./60a453ce.0K3_0kXS.js";import"./dfca5da5.DfWeVy9W.js";import"./dae24aab.CuEJarRZ.js";import"./f692f62f.DfPNgFdL.js";import"./9babe369.Bsq76oiT.js";import"./b684bff6.8OTNC0Bz.js";import"./79974aab.D3Nz6hz7.js";import"./434e3b0a.oup8Ur0H.js";import"./ccdf3592.DwF6-jXW.js";import"./78ab3dd0.CrM-OED9.js";import"./d4ea2faa.BWjkOEd3.js";import"./fe885b80.Dj9dQ3oE.js";import"./f78726c8.B-9Rxer-.js";import"./5fda1420.5IhuB_38.js";import"./50130ded.B9rAql31.js";import"./65f3d4da.Bb3QiqCm.js";import"./31cc568e.95lmLO5k.js";function qe(){const{i18n:r,shop:{developmentShop:a},url:t}=Te();return a?e(R,{errorType:S.PaymentError,tone:"warning",children:r.translate("payment_errors.development_store_with_order_limit",{development_store_order_testing_docs_link:e(w,{href:t.developmentStoreOrderTestingDocs(),children:r.translate("payment_errors.development_store_order_testing_docs_link")})})}):null}const Je=r=>e(V,{children:r});function Ge({hostedFieldsLoaded:s,children:l}){const{i18n:c,shop:f,source:y,checkout:b,observability:g}=Te(),{giftCardsEnabled:P,discountCodesEnabled:E,acceptTipPayments:w}=f,{configuration:X}=b,Z=b.latestReceipt.value,ee=k(),oe=E&&ee.value,{nextPage:ne,previousPage:se}=T(),[de,me]=r(!1),[Ye,$e]=r(!1),[Ge,We]=r(!1),Ke="simulated"===y.type,Xe=b.negotiator.current.fields.buyerIdentity.value?.purchasingCompany,Ze=Boolean(Xe),er="draftOrder"===y.type,rr=Ze&&er,ar=Ce(),{cartLineChangeLoadingSignal:tr}=b.negotiator.context,ir=tr.value,[or,nr]=r(!1),[sr,lr]=r(),{negotiate:cr,progress:dr,progressing:mr}=C(),pr=b.negotiator.isBlocked.value,ur=ze(),hr=Le(),fr=b.negotiator.current.fields.paymentMethods,yr=Ze&&!b.isShippingRequired.value,br=_e(),gr=!ur.value||hr.value,{billingAddressOption:jr,directPaymentErrors:vr,generalPaymentError:_r,generalPaymentErrorCode:Pr,paymentLines:{value:Er}}=b.negotiator.parts,Sr=Ne({shop:f,checkout:b,paymentMethods:fr?.value}),wr=Er.some(e=>"wallet"===e.method.type||"walletsPlatformPaymentMethod"===e.method.type),Rr=!(!gr&&b.isShippingRequired.value&&!wr&&"shipping"===jr.value)&&(Me({lines:Er,paymentMethods:fr?.value,purchasingCompany:Boolean(Xe),isBillingAddressForced:!Sr})||!gr),kr=b.negotiator.parts.localizationExtensions.value,{value:Tr}=Ae(),Cr=0!==Tr.length,zr=gr&&Cr||!gr,Lr=Er.some(e=>"direct"===e.method.type),{displayedPaymentMethods:Mr}=re({experienceType:"list"}),Ar="knownBuyerShared"===ae(Mr).mode,xr=z().value,Br=L(),Fr="error"===M({isPayWithPayPalButton:!0}).value.status;d();const Ir=b.negotiator.current.fields.managedByMarketsPro,Dr=pr||Ke&&"review"!==ne.id||Br.value&&Fr||ir,{lastJourneyProgression:Nr}=b.negotiator,Or=A(),Vr=a(()=>le(vr)),Ur="failed"===Z?.status,Hr=Ur&&"payment"===Z?.failure.type?Z.failure:void 0,Yr="AUTHENTICATION_ERROR"===Hr?.code,$r=Ur&&"inventory"===Z?.failure?.type?Z.failure:void 0,qr=Ge,Jr=Boolean(Ye||Ur&&"order"===Z?.failure?.type),Gr=null!=Hr&&!Yr,Qr=x(Hr),Wr=_r.value&&!xe(Pr.value),Kr=ce(_r.value,Pr.value),Xr=c.translate("payment.title"),Zr=c.translate("general.pay_now_button_label"),ea=b.configuration.layout.isOnePage.value,ra=B(),aa="failed"===Z?.status&&"payment"===Z.failure.type&&"GENERIC_ERROR"===Z.failure.code&&"walletsPlatformPaymentMethod"===Er[0]?.method.type&&Er[0]?.method.name===Be.AmazonPay;Ue({stage:Lr&&!s?He.Usable:He.Complete,id:"Payment"}),Ve("payment");const ta=Boolean(Hr),ia=Z?.id,oa=Boolean(Hr&&Fe.has(Hr.code));if(t(()=>{Or||!ta||Ze||(oa?g.log("payment_form_skip_negotiate_captcha","[PaymentForm] Skipped negotiate for CAPTCHA_REQUIRED receipt â handled by useHandleReceipt",{receiptId:ia}):(async()=>{await cr({silenceViolations:["all"],fieldsToResolve:["paymentLines"]})})())},[ta,Or,Ze,cr,g,oa,ia]),sr)throw sr;const na=F("Checkout::Dynamic::Render","PAYMENT1"),sa=F("Checkout::Dynamic::Render","PAYMENT2"),la=F("Checkout::Dynamic::Render","PAYMENT3"),ca=F("Checkout::Dynamic::Render","PAYMENT4"),da=F("purchase.checkout.payment-method-list.render-before"),ma=F("purchase.checkout.payment-method-list.render-after"),pa=X.visibility.showReductions,ua=Ie(),ha=I({base:!0,medium:!1}),fa=!ua.value||ha;let ya=null;X.visibility.showAside?fa&&(ya=e(K,{above:"small",children:e(W,{headerLevel:1,monorailSection:"payment"})})):ya=e(W,{headerLevel:1,monorailSection:"payment"});const ba=pa&&!rr&&(P||E)?ya:null,ga=!rr&&!ar.value&&w&&!De(y),ja=Ir.value&&zr&&"review"!==ne.id,va=or||mr.value;return i(()=>{"failed"===Nr.value.type&&$e(!0)}),e(o,{children:[e(ke,{children:Xr}),e(D,{onSubmit:async()=>
1{if(!Dr){nr(!0);try{await dr("payment-form-submit",e=>{const r="failed"===e.status,a="receipt"in e&&"failed"===e.receipt?.status&&"order"===e.receipt?.failure?.type,t="success"===e.status&&"receipt"in e&&"failed"===e.receipt.status;nr(!1),We("fetch_failed"===e.status),$e(r||a),me(t)})}catch(e){e instanceof Error&&lr(e)}finally{nr(!1)}}},disabled:or||pr,implicitSubmit:Zr,children:e(fe,{children:[e(ye,{children:[e(N,{customizations:na,render:Je}),e(Qe,{genericPaymentError:Gr,shouldSuppressReceiptError:Or,inventoryReservationFailure:$r,isAmazonPaymentDeclineScenario:aa,networkFailure:qr,orderFailure:Jr,paymentErrorMessage:Qr,processingFailed:de}),e(qe,{}),ba,ga?e(o,{children:[e(O,{sectionId:"tips",children:e(m,{renderInSection:!0,headingLevel:1})}),e(N,{customizations:sa,render:Je})]}):null,kr.length>0&&e(o,{children:e(V,{accessibilityLabel:c.translate("localized_fields.additional_information.title"),children:e(U,{gap:"base",children:[e(H,{id:`${Y}-localized-fields`,level:1,children:c.translate("localized_fields.additional_information.title")}),kr.map((r,a)=>{const t=`${r.value.key}${a}`;return e(j,{localizationExtension:r,index:a},t)})]})})}),e(o,{}),e(V,{accessibilityRole:"group",accessibilityLabelledBy:Y,children:e(U,{gap:"base",children:[e(v,{headingId:Y,autoFocus:!ea}),e(n,{when:X.visibility.showStoreCreditRedemption,children:e(p,{})}),Wr?e(R,{errorType:S.PaymentError,tone:"critical",children:Kr}):null,e(n,{when:Vr,children:e(R,{errorType:S.PaymentError,tone:"critical",children:c.translate("payment.generic_incorrect_card_info")})}),Yr?e(R,{errorType:S.PaymentError,tone:"critical",children:c.translate("payment_errors.three_d_secure_failed")}):null,e(N,{customizations:da}),e(n,{when:X.visibility.showStoreCreditRedemption,children:e(u,{})}),l,e(N,{customizations:ma}),e(n,{when:br,children:e(ue,{})})]})}),e(h,{}),e(N,w?{customizations:la,render:Je}:{customizations:sa,render:Je}),!Rr||!(b.isShippingRequired.value||De(y)||yr)||ra.value||Ar&&Lr?null:e(pe,{}),e(N,w?{customizations:ca,render:Je}:{customizations:la,render:Je}),e(_,{compact:!0}),!w&&e(N,{customizations:ca,render:Je}),!xr||Ar&&Lr?null:e(V,{children:e(te,{})}),e(n,{when:hr,children:e(Re,{placement:"default",wrapInSection:!0})}),e(n,{when:X.visibility.showPurchaseOrderNumberField,children:e(ie,{})})]}),ja&&e(he,{}),e(Pe,{}),oe&&e($,{targetSelector:'input[name="reductions"]',icon:"discount",label:c.translate("order_summary.discount_discovery.add_code")}),e(n,{when:hr,children:e(Re,{placement:"above-pay-button"})}),e(be,{children:[e(ge,{children:[e(Ee,{children:e(ve,{disabled:!zr||Dr,loading:va,defaultLabel:ne.label,pixelId:"go_to_next_step"})}),ne.notice?e(o,{children:[e(q,{blockSize:"small-200"}),e(J,{textAlign:"center",color:"subdued",type:"small",children:ne.notice})]}):null]}),se.route?e(je,{children:e(Oe,{href:se.route,variant:"plain",inlineSize:"fill",textDecoration:"none",pixelId:"go_to_previous_step",children:e(U,{direction:"inline",gap:"small-200",alignItems:"center",children:[e(G,{type:"chevron-left",size:"small"}),e(Q,{children:se.label})]})})}):null]}),"review"===ne.id?null:e(o,{children:[e(Se,{}),e(we,{})]})]})})]})}const Qe=({orderFailure:r,inventoryReservationFailure:a,isAmazonPaymentDeclineScenario:t,genericPaymentError:i,processingFailed:o,shouldSuppressReceiptError:n,paymentErrorMessage:s,networkFailure:l})=>{const{i18n:c,checkout:{negotiator:d}}=Te(),{lastJourneyProgression:m}=d;return t?null:!i&&!o||n?l?e(R,{errorType:S.PaymentError,tone:"critical",children:c.translate("order_errors.network_failure")}):a?e(R,{errorType:S.PaymentError,tone:"critical",children:c.translate("order_errors.inventory_reservation_failure")}):r?"failed"===m.value.type&&"decision_rule_block"===m.value.reason?e(R,{errorType:S.PaymentError,tone:"critical",children:c.translate("payment_errors.generic_error")}):e(R,{errorType:S.PaymentError,tone:"critical",children:c.translate("order_errors.creation_failure")}):null:e(R,{errorType:S.PaymentError,tone:"critical",children:s})};function We(){const r=f({enableAutoSelect:!1}),{expandedSlot:a}=y(r);return e($e,{msiSlot:a,hideChoiceListChrome:!1,detailsPresentation:"boxed"})}function Ke(){const{displayedPaymentMethods:r}=re({experienceType:"list"}),a=ae(r),t=s(()=>r.map(e=>"name"in e?e.name:e.type),[r]);return"knownBuyerShared"===a.mode?e(Ye,{impressionType:"payment",impressionFeatures:oe(t,a),children:e(We,{})}):e(ne,{renderVaultingAgreementInline:!1})}function Xe(){const r=l(!1),a=P(),t=de(),{postPurchaseEnabled:i}=me(),o=c(()=>{r.current=!0},[]);return e(ee,{target:"cart.paymentLines[0]",children:[e(X,{section:"payment",children:e(Z,{section:"payment",children:e(Ge,{hostedFieldsLoaded:r.current,children:e(b,{blurValidationEnabled:!0,onSetFieldErrors:t,onLoadSuccess:o,children:[e(Ze,{}),e(Ke,{}),e(n,{when:a,children:e(E,{})})]})})})}),i&&e(g,{})]})}function Ze(){return se(),null}export{Ze as PaymentMethodCustomizations,Xe 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.