1import{u as e,C as r,k as a,h as t,p as i,S as o,z as s,T as n,g as l,q as c}from"./2c1ab0fe.BJLJ3CAA.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 j}from"./6bfea526.28RUfbU7.js";import{L as g,P as v,R as _,u as P,S as E}from"./73a9b0a0.On65x5B7.js";import{aa as S,L as w,a9 as R,dr as k,x as T,v as C,R as z,cy as x,a5 as A,cd as F,cc as L,ds as I,o as M,p as B,ai as N,U as D,dt as O,i as V,S as H,H as U,c2 as Y,du as q,d as J,f as $,a1 as G,j as K,bi as W,a0 as Q,af as X,ag as Z,d5 as ee}from"./164ad2e3.BliOxCod.js";import{u as re,b as ae,V as te,a as ie,c as oe,d as se,e as ne}from"./86720dbb.BUCq2HT6.js";import{a as le,u as ce,b as de}from"./58314944.BdtN-93T.js";import{u as me}from"./ca5e9c49.BkLI9XlI.js";import{B as pe}from"./b9c0319a.C6uQzQep.js";import{C as ue}from"./b3389d5c.-nZ7jflJ.js";import{M as he}from"./0b8657b8.D5MJj2_w.js";import{b as fe,d as ye,c as be,P as je,a as ge}from"./0a30a815.BBrtz-aJ.js";import{P as ve}from"./4ea44c06.CQ1FMt13.js";import{u as _e,b as Pe,R as Ee,V as Se,S as we}from"./e129c76e.De01wXEv.js";import{P as Re}from"./e3e348f2.Du9ml3fg.js";import{T as ke}from"./7e8cd205.CHB3Bz5Y.js";import{e as Te,aR as Ce,cJ as ze,ab as xe,cK as Ae,bS as Fe,bN as Le,W as Ie,bh as Me,al as Be,J as Ne}from"./4b4bc88f.h7gG1l7a.js";import{i as De}from"./9dba8418.DyAkoh6h.js";import{B as Oe}from"./0627daf2.CJi2r1S9.js";import{u as Ve}from"./9f047e05.D89vgeT1.js";import{u as He,S as Ue}from"./71ae3d5c.BDBKMEmH.js";import{I as Ye}from"./55098bf1.DMNmHcmK.js";import{K as qe}from"./dfc03c53.BVt3Gj72.js";import"./app.DStHQ37m.js";import"./ac5a19ff.CoAC7sn2.js";import"./598fef4e.BFBxW_-q.js";import"./e77f7fe0.Dl3D9U3r.js";import"./22345fd4.BYeljJcs.js";import"./4b1c22b7.CqdaJTRs.js";import"./a422df8c.CREcwRwV.js";import"./efa0389a.o6SW91va.js";import"./cc6ff67d.CDSUSBqp.js";import"./e12db40c.D_72G_lt.js";import"./08a3b809.CHUwL7Mr.js";import"./d25d1b95.B2EtjZon.js";import"./bf513f9c.BXvINVI_.js";import"./e39bc11c.Cx-falZ4.js";import"./7a8217fd.CdraUwbe.js";import"./8599b02a.DUxdW4aP.js";import"./cf29e63b.B9drc3hB.js";import"./25604ae0.56pfEpxV.js";import"./dada7e07.CSByRqZL.js";import"./81e109b1.DOkM2TK2.js";import"./0e67bd3b.B8tUlgnj.js";import"./74835653.kQwzBz6x.js";import"./3ca8ef7e.BxaGrzZX.js";import"./2495faa4.B-KA3rQS.js";import"./a9fa9fda.cu4h3ZW8.js";import"./ca3e798e.0p3GU8xJ.js";import"./47b970b2.Bwt8Yl2e.js";import"./064f6ac1.p-CXKG_1.js";import"./e0989459.CPEeznZF.js";import"./cdfd59e6.C7SNqt2q.js";import"./d0bb51ec.DZ-duoYZ.js";import"./f67abd2c.n9-0t1C9.js";import"./60a453ce.nRY7TqlL.js";import"./dfca5da5.DE7F60MC.js";import"./dae24aab.CcpJ_w0r.js";import"./f692f62f.BbZ4LGV4.js";import"./9babe369.54u4ztB7.js";import"./b684bff6.DKFECZs4.js";import"./79974aab.CVYvOF2D.js";import"./434e3b0a.oup8Ur0H.js";import"./ccdf3592.alVwIc1W.js";import"./78ab3dd0.C_H7hxgP.js";import"./d4ea2faa.CVYF_W6U.js";import"./fe885b80.jl2q_bGF.js";import"./f78726c8.QwnxpNHr.js";import"./5fda1420.OjSSygSB.js";import"./50130ded.BRlRcUpA.js";import"./65f3d4da.Bb3QiqCm.js";import"./31cc568e.95lmLO5k.js";function Je(){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 $e=r=>e(V,{children:r});function Ge({hostedFieldsLoaded:n,children:l}){const{i18n:c,shop:f,source:y,checkout:b,observability:j}=Te(),{giftCardsEnabled:P,discountCodesEnabled:E,acceptTipPayments:w}=f,{configuration:X}=b,Z=b.latestReceipt.value,ee=k(),oe=E&&ee.value,{nextPage:se,previousPage:ne}=T(),[de,me]=r(!1),[Ye,qe]=r(!1),[Ge,We]=r(!1),Qe="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,sr]=r(!1),[nr,lr]=r(),{negotiate:cr,progress:dr,progressing:mr}=C(),pr=b.negotiator.isBlocked.value,ur=ze(),hr=xe(),fr=b.negotiator.current.fields.paymentMethods,yr=Ze&&!b.isShippingRequired.value,br=_e(),jr=!ur.value||hr.value,{billingAddressOption:gr,directPaymentErrors:vr,generalPaymentError:_r,generalPaymentErrorCode:Pr,paymentLines:{value:Er}}=b.negotiator.parts,Sr=De({shop:f,checkout:b,paymentMethods:fr?.value}),wr=Er.some(e=>"wallet"===e.method.type||"walletsPlatformPaymentMethod"===e.method.type),Rr=!(!jr&&b.isShippingRequired.value&&!wr&&"shipping"===gr.value)&&(Ae({lines:Er,paymentMethods:fr?.value,purchasingCompany:Boolean(Xe),isBillingAddressForced:!Sr})||!jr),kr=b.negotiator.parts.localizationExtensions.value,{value:Tr}=Fe(),Cr=0!==Tr.length,zr=jr&&Cr||!jr,xr=Er.some(e=>"direct"===e.method.type),{displayedPaymentMethods:Ar}=re({experienceType:"list"}),Fr="knownBuyerShared"===ae(Ar).mode,Lr=z().value,Ir=x(),Mr="error"===A({isPayWithPayPalButton:!0}).value.status;d();const Br=b.negotiator.current.fields.managedByMarketsPro,Nr=pr||Qe&&"review"!==se.id||Ir.value&&Mr||ir,{lastJourneyProgression:Dr}=b.negotiator,Or=F(),Vr=a(()=>le(vr)),Hr="failed"===Z?.status,Ur=Hr&&"payment"===Z?.failure.type?Z.failure:void 0,Yr="AUTHENTICATION_ERROR"===Ur?.code,qr=Hr&&"inventory"===Z?.failure?.type?Z.failure:void 0,Jr=Ge,$r=Boolean(Ye||Hr&&"order"===Z?.failure?.type),Gr=null!=Ur&&!Yr,Kr=L(Ur),Wr=_r.value&&!Le(Pr.value),Qr=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=I(),aa="failed"===Z?.status&&"payment"===Z.failure.type&&"GENERIC_ERROR"===Z.failure.code&&"walletsPlatformPaymentMethod"===Er[0]?.method.type&&Er[0]?.method.name===Ie.AmazonPay;He({stage:xr&&!n?Ue.Usable:Ue.Complete,id:"Payment"}),Ve("payment");const ta=Boolean(Ur),ia=Z?.id,oa=Boolean(Ur&&Me.has(Ur.code));if(t(()=>{Or||!ta||Ze||(oa?j.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,j,oa,ia]),nr)throw nr;const sa=M("Checkout::Dynamic::Render","PAYMENT1"),na=M("Checkout::Dynamic::Render","PAYMENT2"),la=M("Checkout::Dynamic::Render","PAYMENT3"),ca=M("Checkout::Dynamic::Render","PAYMENT4"),da=M("purchase.checkout.payment-method-list.render-before"),ma=M("purchase.checkout.payment-method-list.render-after"),pa=X.visibility.showReductions,ua=Be(),ha=B({base:!0,medium:!1}),fa=!ua.value||ha;let ya=null;X.visibility.showAside?fa&&(ya=e(Q,{above:"small",children:e(W,{headerLevel:1,monorailSection:"payment"})})):ya=e(W,{headerLevel:1,monorailSection:"payment"});const ba=pa&&!rr&&(P||E)?ya:null,ja=!rr&&!ar.value&&w&&!Ne(y),ga=Br.value&&zr&&"review"!==se.id,va=or||mr.value;return i(()=>{"failed"===Dr.value.type&&qe(!0)}),e(o,{children:[e(ke,{children:Xr}),e(N,{onSubmit:async()=>
1{if(!Nr){sr(!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;sr(!1),We("fetch_failed"===e.status),qe(r||a),me(t)})}catch(e){e instanceof Error&&lr(e)}finally{sr(!1)}}},disabled:or||pr,implicitSubmit:Zr,children:e(fe,{children:[e(ye,{children:[e(D,{customizations:sa,render:$e}),e(Ke,{genericPaymentError:Gr,shouldSuppressReceiptError:Or,inventoryReservationFailure:qr,isAmazonPaymentDeclineScenario:aa,networkFailure:Jr,orderFailure:$r,paymentErrorMessage:Kr,processingFailed:de}),e(Je,{}),ba,ja?e(o,{children:[e(O,{sectionId:"tips",children:e(m,{renderInSection:!0,headingLevel:1})}),e(D,{customizations:na,render:$e})]}):null,kr.length>0&&e(o,{children:e(V,{accessibilityLabel:c.translate("localized_fields.additional_information.title"),children:e(H,{gap:"base",children:[e(U,{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(g,{localizationExtension:r,index:a},t)})]})})}),e(o,{}),e(V,{accessibilityRole:"group",accessibilityLabelledBy:Y,children:e(H,{gap:"base",children:[e(v,{headingId:Y,autoFocus:!ea}),e(s,{when:X.visibility.showStoreCreditRedemption,children:e(p,{})}),Wr?e(R,{errorType:S.PaymentError,tone:"critical",children:Qr}):null,e(s,{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(D,{customizations:da}),e(s,{when:X.visibility.showStoreCreditRedemption,children:e(u,{})}),l,e(D,{customizations:ma}),e(s,{when:br,children:e(ue,{})})]})}),e(h,{}),e(D,w?{customizations:la,render:$e}:{customizations:na,render:$e}),!Rr||!(b.isShippingRequired.value||Ne(y)||yr)||ra.value||Fr&&xr?null:e(pe,{}),e(D,w?{customizations:ca,render:$e}:{customizations:la,render:$e}),e(_,{compact:!0}),!w&&e(D,{customizations:ca,render:$e}),!Lr||Fr&&xr?null:e(V,{children:e(te,{})}),e(s,{when:hr,children:e(Re,{placement:"default",wrapInSection:!0})}),e(s,{when:X.visibility.showPurchaseOrderNumberField,children:e(ie,{})})]}),ga&&e(he,{}),e(Pe,{}),oe&&e(q,{targetSelector:'input[name="reductions"]',icon:"discount",label:c.translate("order_summary.discount_discovery.add_code")}),e(s,{when:hr,children:e(Re,{placement:"above-pay-button"})}),e(be,{children:[e(je,{children:[e(Ee,{children:e(ve,{disabled:!zr||Nr,loading:va,defaultLabel:se.label,pixelId:"go_to_next_step"})}),se.notice?e(o,{children:[e(J,{blockSize:"small-200"}),e($,{textAlign:"center",color:"subdued",type:"small",children:se.notice})]}):null]}),ne.route?e(ge,{children:e(Oe,{href:ne.route,variant:"plain",inlineSize:"fill",textDecoration:"none",pixelId:"go_to_previous_step",children:e(H,{direction:"inline",gap:"small-200",alignItems:"center",children:[e(G,{type:"chevron-left",size:"small"}),e(K,{children:ne.label})]})})}):null]}),"review"===se.id?null:e(o,{children:[e(Se,{}),e(we,{})]})]})})]})}const Ke=({orderFailure:r,inventoryReservationFailure:a,isAmazonPaymentDeclineScenario:t,genericPaymentError:i,processingFailed:o,shouldSuppressReceiptError:s,paymentErrorMessage:n,networkFailure:l})=>{const{i18n:c,checkout:{negotiator:d}}=Te(),{lastJourneyProgression:m}=d;return t?null:!i&&!o||s?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:n})};function We(){const r=f({enableAutoSelect:!1}),{expandedSlot:a}=y(r);return e(qe,{msiSlot:a,hideChoiceListChrome:!1,detailsPresentation:"boxed"})}function Qe(){const{displayedPaymentMethods:r}=re({experienceType:"list"}),a=ae(r),t=n(()=>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(se,{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(Qe,{}),e(s,{when:a,children:e(E,{})})]})})})}),i&&e(j,{})]})}function Ze(){return ne(),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.