PageSourceSearch

https://hairmax.com/cdn/shopifycloud/checkout-web/assets/c1/cc6ff67d.D2x8Yxrg.js

js hairmax.com collected 2026-10-03 19:43:58 UTC 5,690 bytes, 1 lines download raw bytes

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