PageSourceSearch

https://www.yuoto.se/cdn/shopifycloud/checkout-web/assets/c1/cc6ff67d.RYXq9KZi.js

js yuoto.se collected 2026-10-09 23:19:18 UTC 5,869 bytes, 1 lines download raw bytes

1import{T as e,g as t,h as n,q as a,s as r,k as s}from"./2c1ab0fe.qpvfywqb.js";import{aQ as o,e as i,bT as d,bU as u,aT as p,L as l,bV as c,aU as y,bW as m,bX as h,bY as v,bZ as f,b_ as g,b$ as b,c0 as P,c1 as C,y as A,Z as M,c2 as T,a as k,bl as S}from"./4b4bc88f.DkycdxSK.js";import{v as _,cg as w,ch as I,ci as E}from"./164ad2e3.DcJn775M.js";import{h as U}from"./e12db40c.DhbHW8sF.js";import{s as q,i as x}from"./08a3b809.BKNVX2Vm.js";class L extends Error{constructor(){super(...arguments),this.name="UnsupportedShopPayCustomerCardError"}}function N({allowPreselect:r=!0,displayedPaymentMethods:s}={}){const M=o(),{checkout:{identity:T,negotiator:k},observability:S,userEvents:E,shop:q}=i(),{hasNegotiatedAlternativePaymentCurrencySignal:x,newCardSignal:N}=k.context,B=k.current.fields.paymentMethods,{value:J}=d(),{negotiate:R}=_(),D=k.current.fields.paymentLines,G=u(),{currencyCode:H,id:V,paymentMethodAutoSelectionDisabled:Z}=q,Q="shopPay"===T.current.value,W=!Q,X=s??J,Y=e(()=>j(X,Q),[X,Q]),{value:$}=k.current.fields.buyerIdentity,z=k.parts.paymentLines,{value:K}=k.current.fields.deferredTotal,{value:ee}=k.current.fields.paymentFlexibilityPaymentTermsTemplate,te=p(),ne=$?.presentmentCurrency||H,ae=w(),re=t(!1),se=t(!1),oe=Q?z.value.find(e=>e.method.type===l.CreditCard)?.method.type:void 0;n(()=>{oe&&!se.current&&(se.current=!0,S.counter({name:"shop_pay_unsupported_customer_card_on_payline",value:1,attributes:{payment_method_type:oe}}),S.error(new L("Shop Pay proposed payment line contains an unsupported Customer Account saved card"),{severity:"warning",metadata:{value:{paymentMethodType:oe}}}))},[S,oe]);const ie=e(()=>{const e=Y.find(c);if(W&&e&&y(z.value))return m(e);const t=z.value.filter(e=>h(e,Y,{identity:T})||v(e)),n=f(t),[a]=n;return void 0!==a?a:(S.leaveErrorBreadcrumb("Unexpected: Selected payment method is empty because `paymentLines` array is empty",{displayedPaymentMethods:JSON.stringify(Y),displayedProposedPaymentLines:JSON.stringify(t)}),"")},[Y,T,S,z.value,W]),de=a((e,t,{rebuild:n=!1,buyerInitiated:a=!1}={})=>{const r=z.value,o=j(s??B.value??[],Q),i=O(r,o),d=r.some(e=>"direct"===e.method.type),u=g([e],[...r,...!d&&N.value?[{method:N.value}]:[]],o,{negotiatedPaymentLines:D.value?.lines,deferredTotal:K,hasPayableDeposit:Boolean(G.value?.amount),hasFixedSellingPlan:te.value,rebuild:n,paymentTermsTemplateType:ee?.type,preserveShopPayApproval:W});z.value=t?function(e,t){return e.map(e=>function(e,t){return e.method.type===t.type?{...e,method:{...e.method,...t}}:e}(e,t))}(u,t):u;const p=O(u,o),l=b(i,p,ne);l&&(x.value=!0,E.monorailEvent(function({uniqueToken:e,shopGid:t,shopCurrencyCode:n,presentmentCurrencyCode:a,checkoutSessionIdentifier:r,previousPaymentMethod:s,currentPaymentMethod:o}){return{schemaId:"multi_currency_checkout_payment_method_change/2.0",payload:{shopId:parseInt(A(t),10),userToken:e,checkoutToken:r||"",shopCurrencyCode:n,checkoutPresentmentCurrencyCode:a,priorPaymentMethodHandle:F(s),priorPaymentType:I(s?.type||""),newPaymentMethodHandle:F(o),newPaymentType:I(o?.type||""),isPriorPaymentMethodMc:C(a,s),isNewPaymentMethodMc:C(a,o)}}}({uniqueToken:M.value.defaultAttributes?.uniqToken||"",shopGid:V,shopCurrencyCode:H,presentmentCurrencyCode:ne,previousPaymentMethod:i,currentPaymentMethod:p})));const c=a&&P(i,p);(l||c)&&R({})},[x,B,D.value?.lines,N,K,G.value?.amount,ne,z,E,M.value.defaultAttributes?.uniqToken,V,H,R,ee,te,s,Q,W]);n(()=>{ae&&!ie&&0===z.value.length&&(re.current=!1)},[ie]);const ue=Y.at(0);if(r&&!ie&&!re.current&&ue&&!U(z.value)&&!(Z&&Y.length>1)){const e=m(ue);S.leaveErrorBreadcrumb("rebuilding payment lines on missing selected payment line",{displayedPaymentMethods:JSON.stringify(Y),selectedPaymentMethod:e}),de(e,void 0,{rebuild:!0}),re.current=!0}return e(()=>[ie,de],[ie,de])}function j(e,t){return t?e.filter(e=>e.type!==l.CreditCard):e}function F(e){if(void 0===e)return"";const t="name"in e&&e.name||void 0,n="paymentMethodIdentifier"in e&&e.paymentMethodIdentifier||void 0;return E(e.type,t,n)}function O(e,t){return t.find(t=>e.find(e=>"paymentMethodIdentifier"in e.method&&"paymentMethodIdentifier"in t?e.method.paymentMethodIdentifier===t.paymentMethodIdentifier:"wallet"===e.method.type&&"wallet"===t.type?e.method.name===t.name:e.method.type===t.type))}function B({isApplePayAvailable:t}){const{checkout:{identity:n,negotiator:a},shopPay:s}=i(),o=r(t);return e(()=>q({identity:n,shopPay:s,negotiatedFields:a.current.fields},{isApplePayAvailable:o}),[n,o,a.current.fields,s])}function J(){const{shop:e}=i(),t=e.hasFlagEnabled(M),n=T();return s(()=>!t&&n.value)}function R(){const{negotiate:e}=_(),{shopPay:t,checkout:n,observability:r}=i(),s=n.configuration.addressSettings.nonBillingAddressSettings;return{updateCheckoutAddress:a(async({shippingAddress:a,billingAddress:o,fallbackPhoneNumber:i},d=!1)=>
1{if(!a&&!o)return;const u=[];if(a){u.push("shippingAddress");const e=s.value.isRequired("phone",{countryCode:a.countryCode,useMerchantSettings:!0})&&!a.phone?i:a.phone;r.log("wallets_shipping_address_update","useUpdateCheckoutAddress: update with Shop Pay vaulted address",{isPostalCodePadded:k(a.postalCode,a.countryCode),countryCode:a.countryCode}),n.negotiator.parts.shippingAddress.value={...a,phone:e,oneTimeUse:a.oneTimeUse||!1}}if(o){u.push("billingAddress");const e=s.value.isRequired("phone",{countryCode:o.countryCode,useMerchantSettings:!0})&&!o.phone?i:o.phone;n.negotiator.parts.billingAddress.value={...o,phone:e}}const p=x(a??n.negotiator.parts.shippingAddress.value,o??n.negotiator.parts.billingAddress.value);t.user.hasCreditCards.value&&(n.negotiator.parts.billingAddressOption.value=p?"shipping":"custom"),d||await e({silenceViolations:["non-stock",...S],fieldsToResolve:u})},[e,n.negotiator.parts.shippingAddress,n.negotiator.parts.billingAddress,n.negotiator.parts.billingAddressOption,s,t.user,r])}}export{J as a,R as b,B as c,N as u};

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.