PageSourceSearch

https://hubigs.com/cdn/shopifycloud/checkout-web/assets/c1/ShopPayCheckout.DWa_3cLG.js

js hubigs.com collected 2026-09-26 10:08:35 UTC 35,591 bytes, 2 lines download raw bytes

1const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["component-TransitionProgress.DW4-sFgP.js","esnext-vendor.B9Da21W6.js","addresses-is-address-empty.Bn2lNY_L.js","app.DbSrjjlA.js","assets/app.Sxsz5knT.css","assets/is-address-empty.DJksNKpk.css","assets/TransitionProgress.BAeLDej3.css","ShopPayCaptcha.DPBCCrUk.js","hydrate.DZ4YTm7p.js","graphql-PaymentSessionMutation.CAXCwUvV.js","hooks-useShopPayExternalAppContext.DWwMuRnz.js","hooks-useReplaceShopPayInHistory.DPpLejwu.js","assets/previous.owLoDmpy.css"])))=>i.map(i=>d[i]);
2import{o as $,j as ge,y as Tt,G as Ae,l as Ee,A as D,h as _,T as Y,u as h,d as ct,r as lt,f as se,k as Ce,q as B,D as Lt,g as Ot,W as Ye,S as X,i as ke,p as Me}from"./esnext-vendor.B9Da21W6.js";import{aW as Nt,S as k,bv as ut,a4 as ee,f_ as Rt,cV as xt,bB as dt,bt as Je,by as Bt,T as ce,bs as pt,cW as Te,cR as Ft,aB as x,f$ as Dt,bc as fe,g0 as Ut,g1 as wt,g2 as Vt,cQ as Ht,g3 as qt,g4 as zt,m as Gt,Z as $t,dw as w,f1 as ht,aX as Wt,fY as Kt,H as Yt,dR as Jt,aS as jt,g5 as Qt,g6 as Zt,g7 as Xt,g8 as en,g9 as tn,ga as je,gb as nn,gc as sn,x as an,gd as Qe,bU as ve,br as Se,ge as on,gf as rn,f4 as Ze,aV as cn,gg as ln}from"./addresses-is-address-empty.Bn2lNY_L.js";import{fH as Xe,a as un,fI as dn,fJ as et,fK as pn,fL as hn,bg as mn,dL as Le,fM as yn,fN as gn,fO as fn,fP as mt,j as Ie,bu as tt,k as yt,f7 as Pe,f1 as vn,fQ as nt,I as Sn,l as Pn,eU as _n,n as gt,i as bn,fR as Cn,eW as kn,fS as In,f as An}from"./hydrate.DZ4YTm7p.js";import{S as En,a as Mn,u as Tn}from"./payment-usePaymentExemptionReason.B4VABxaE.js";import{t as re,a as _e,u as Ln,b as On,c as Nn}from"./hooks-usePreselectSpi.zcfP7GH7.js";import{_ as ft}from"./app.DbSrjjlA.js";import{g as Oe}from"./shop-pay-installments-monorail.BAOukcZ1.js";import{i as Rn}from"./graphql-PaymentSessionMutation.CAXCwUvV.js";import{u as vt}from"./hooks-useReplaceShopPayInHistory.DPpLejwu.js";import{a as St,b as xn,c as Bn,u as Fn}from"./hooks-useUpdateCheckoutAddress.DUYbpduS.js";import{r as Dn}from"./shared-buyer-consent.B_gDyRCR.js";import{a as Un,S as wn,u as Vn}from"./models-ShopPayBuyerDetails.model.BN177Cps.js";import{a as Hn}from"./hooks-useShopPayNewSignupLoginExperiment.vaE9WYHy.js";import{a as qn}from"./cross-border-hooks.xPE4TSQ5.js";import{u as zn}from"./hooks-useShopPayExternalAppContext.DWwMuRnz.js";import"./helpers-derivations.Dug6X2_v.js";import"./redemption-promotions.DicFJEgz.js";import"./shop-pay-normalizeBuyerDetails.CCnGCeBZ.js";const Gn={cashbackBanner:"COMPONENT_SHOP_CASH_CASHBACK_BANNER",minimumOrderValueBanner:"COMPONENT_SHOP_CAMPAIGN_MINIMUM_ORDER_VALUE_BANNER"};function $n(e){return e.__typename==="ShopCashCheckoutFlatAmountCashbackIncentive"}function Wn(e){return e.__typename==="ShopCashCheckoutCashbackIncentive"&&e.expectedAmount.amount>0}function st(e,[n,t]){return{type:e,rendered:!0,component:Gn[n],displayLabel:t.displayLabel}}function Kn(e){const t=e.reduce((r,l)=>!r||l[1].sequence>r[1].sequence?l:r,void 0)?.[1].snapshot;if(!t?.resolutionId)return;const o=e.filter(([,r])=>r.snapshot.resolutionId===t.resolutionId),s=o.find(([r])=>r==="cashbackBanner"),a=o.find(([r])=>r==="minimumOrderValueBanner"),i=t.incentives.find($n),c=[];if(i){const r=i.minimumOrderValueSatisfied?s:a;r&&c.push(st("INCENTIVE_TYPE_SHOP_CAMPAIGN_CASHBACK_OFFER",r))}if(s&&t.incentives.some(Wn)&&c.push(st("INCENTIVE_TYPE_SHOP_CASH_CASHBACK_PROMOTION",s)),c.length!==0)return{eventTypeName:"shopify.advertising.incentives.IncentivePresentedEvent",resolutionId:t.resolutionId,checkoutToken:t.checkoutToken,incentives:c}}class at extends Error{constructor(n){super("A non-Error value was thrown while recording a presentation",{cause:n}),this.name="IncentivePresentationUnknownError"}}class Yn{#n;#s;#a=new Map;#i;#o=0;#t=!1;#e=!1;constructor({emit:n,observability:t}){this.#n=n,this.#s=t}recordPresentation(n,t){return this.#e?()=>{}:this.#r(()=>t.resolutionId?(this.#o+=1,this.#a.set(n.component,{displayLabel:n.displayLabel,sequence:this.#o,snapshot:t}),this.#l(),()=>{}):()=>{})??(()=>{})}dispose(){this.#e||(this.#e=!0)}#l(){this.#t||(this.#t=!0,Promise.resolve().then(()=>{this.#r(()=>{this.#t=!1,this.#u()})}).catch(n=>this.#c(n)))}#u(){if(this.#e)return;const n=Kn([...this.#a.entries()]);if(!n)return;const t=JSON.stringify(n);t!==this.#i&&(this.#n(n),this.#i=t)}#r(n){try{return n()}catch(t){this.#c(t);return}}#c(n){let t;try{t=n instanceof Error?n:new at(n)}catch{t=new at(n)}try{this.#s.error(t,{severity:"warning"})}catch{}}}const Jn={id:"6ad2de4357fc9115d8c9c3d1f349fe7784cea96335888d8ec145d7a0bf08e79a",type:"query",name:"CheckoutCashbackIncentive",source:"query CheckoutCashbackIncentive($checkoutIdentifier:String!,$checkoutSourceId:ID,$shopifyShopId:ID!,$eligibleOrderTotal:MoneyInput!,$eligibleOrderSubtotal:MoneyInput!){shopCashCheckoutCashback(checkoutIdentifier:$checkoutIdentifier checkoutSourceId:$checkoutSourceId shopifyShopId:$shopifyShopId eligibleOrderTotal:$eligibleOrderTotal eligibleOrderSubtotal:$eligibleOrderSubtotal){resolutionId incentives{...on ShopCashCheckoutCashbackIncentive{campaignHandle ratePercentage maxApplicableOrderAmount{...MoneyFragment __typename}expectedAmount{...MoneyFragment __typename}remainingRewardLimit{...MoneyFragment __typename}displayName expiresAt __typename}...on ShopCashCheckoutFlatAmountCashbackIncentive{campaignHandle cashbackAmount{...MoneyFragment __typename}minimumOrderValue{...MoneyFragment __typename}minimumOrderValueSatisfied minimumOrderValueRemainder{...MoneyFragment __typename}__typename}__typename}expectedAmount{...MoneyFragment __typename}__typename}}fragment MoneyFragment on Money{value currency __typename}"},jn=1440*60*1e3,Qn=Nt(({checkout:e,graphql:n,shop:t,source:o},{cashbackState:s,eligibleOrderTotal:a,skip:i})=>{const c=$(()=>e.proposal.negotiated.fields.subtotalAfterMerchandiseDiscounts.value),r=$(()=>c.value?.amount),l=$(()=>c.value?.currencyCode),d=$(()=>a.value?.amount),p=$(()=>a.value?.currencyCode),u=$(()=>{const{checkoutSessionIdentifier:b,sourceId:f}=o;if(!(!b||!f)&&!(d.value===void 0||!p.value||r.value===void 0||!l.value))return{checkoutIdentifier:b,checkoutSourceId:f,eligibleOrderTotal:Xe({amount:d.value,currencyCode:p.value}),eligibleOrderSubtotal:Xe({amount:r.value,currencyCode:l.value}),shopifyShopId:t.id}}),m=$(()=>i.value||u.value===void 0),y=n.shopPayGraphql.query(Jn,{variables:()=>u.value,skip:()=>m.value});let g=r.peek();ge(function(){const f=r.value;m.value||g===f||(g=f,y.refetch({deduplicate:!0}))}),ge(function(){!s?.stale.value||m.value||(s.stale.value=!1,y.refetch({deduplicate:!0}))});const E=Tt(Date.now());let P=!1;return ge(function(){const f=y.data.value?.shopCashCheckoutCashback,C=E.value,T=Zn(f,P?C:void 0);if(!f||!T)return;const L=Date.parse(T);if(!Number.isFinite(L))return;const v=()=>{P=!0,E.value=Date.now(),u.peek()!==void 0&&Ae(()=>y.refetch())},A=L-Date.now();if(A<=0){v();return}if(A>jn)return;const O=setTimeout(v,A);return()=>{clearTimeout(O)}}),{cashback:$(()=>{const b=y.data.value?.shopCashCheckoutCashback,f=E.value,C=ts(b,f);return C&&s?{...C,state:s}:C}),error:y.error,loading:y.loading}});function Zn(e,n=Number.NEGATIVE_INFINITY){let t,o=Number.POSITIVE_INFINITY;for(const s of e?.incentives??[]){if(s?.__typename!=="ShopCashCheckoutCashbackIncentive"||!s.expiresAt)continue;const a=Date.parse(s.expiresAt);Number.isFinite(a)&&a>n&&a<o&&(t=s.expiresAt,o=a)}return t}function Xn(e){switch(e.__typename){case"ShopCashCheckoutCashbackIncentive":return{...e,ratePercentage:parseFloat(e.ratePercentage),maxApplicableOrderAmount:re(e.maxApplicableOrderAmount),expectedAmount:re(e.expectedAmount),remainingRewardLimit:_e(e.remainingRewardLimit),displayName:e.displayName??null,expiresAt:e.expiresAt??null};case"ShopCashCheckoutFlatAmountCashbackIncentive":return{...e,cashbackAmount:re(e.cashbackAmount),minimumOrderValue:_e(e.minimumOrderValue),minimumOrderValueRemainder:_e(e.minimumOrderValueRemainder),ratePercentage:0};default:return}}function es(e){return e.__typename==="ShopCashCheckoutCashbackIncentive"?e.expectedAmount.amount:e.minimumOrderValueSatisfied?e.cashbackAmount.amount:0}
2function ts(e,n=Date.now()){if(!e)return;const t=[];let o,s,a=!1;for(const c of e.incentives??[]){if(c==null)continue;if(c.__typename==="ShopCashCheckoutCashbackIncentive"&&c.expiresAt&&Date.parse(c.expiresAt)<=n){a=!0;continue}const r=Xn(c);r&&(t.push(r),r.__typename==="ShopCashCheckoutFlatAmountCashbackIncentive"&&(o??=r),r.__typename==="ShopCashCheckoutCashbackIncentive"&&(s??=r))}if(a&&t.length===0)return;const i=re(e.expectedAmount);return{resolutionId:e.resolutionId,expectedAmount:a?{...i,amount:t.reduce((c,r)=>c+es(r),0)}:i,incentive:o??s,incentives:t}}function ns(e,n){return e?[null,Je.ShopCashInvalidBillingAddress,Je.ShopCashInvalidShippingAddress].includes(n):n==null}function ss({apiClientId:e,embedder:n,shopCashBalanceFlagEnabled:t}){const o=dn(e),s=Bt(n);return o||t||s}function as(e,n){if(!e?.incentive)return{};const t=e.incentive,o={campaignHandle:t.campaignHandle??void 0,cashbackPercent:t.ratePercentage??void 0,cashbackValue:e.expectedAmount.amount,cashbackValueCurrency:e.expectedAmount.currencyCode};return t.__typename==="ShopCashCheckoutFlatAmountCashbackIncentive"&&(o.minimumOrderValue=t.minimumOrderValue?.amount,o.eligibleOrderSubtotal=n),o}function it(e){const n=e?.incentive?[e.incentive]:[];return e?.incentives??n}function is(e,n){const t=it(n),o=Date.now();return it(e).some(s=>{if(s.__typename!=="ShopCashCheckoutCashbackIncentive"||!s.expiresAt)return!1;const a=Date.parse(s.expiresAt);return!Number.isFinite(a)||a>o?!1:!t.some(i=>i.__typename==="ShopCashCheckoutCashbackIncentive"&&i.campaignHandle===s.campaignHandle&&i.expiresAt===s.expiresAt)})}function os(e={}){const{shop:n,shopPay:t,client:o,embed:s,i18n:a}=k(),{recordRewardEligibilityEvent:i}=Ln(),c=t.user.isUnauthenticatedSession.value,{value:r}=ut(),l=ee(),{value:d}=l.subtotalAfterMerchandiseDiscounts,{value:p}=l.shopCashBalance,{nonEligibleReason:u,serverConfirmed:m}=On().value,y=p?.status==="unavailable",g=m&&(ns(c,u)||y),E=o.unstable_getSerialization("apiClientId"),P=n.hasFlagEnabled(Rt),M=ss({apiClientId:E,embedder:s?.embedder,shopCashBalanceFlagEnabled:P}),b=g&&M,f=b&&Number(r?.amount)>0,C=xt(),T=Ee(!f),{cashback:L}=dt(Qn,{skip:T,eligibleOrderTotal:C,cashbackState:e.cashbackState}),v=L.value,A=D();_(()=>{const V=A.current;A.current=v,is(V,v)&&un({content:a.translate("shop_cash.reward_expired_announcement"),role:"status"})},[v,a]);const O=b&&(v?.incentive?.__typename==="ShopCashCheckoutFlatAmountCashbackIncentive"&&v.incentive.cashbackAmount.amount>0&&v.incentive.minimumOrderValueSatisfied||v?.incentive?.__typename==="ShopCashCheckoutCashbackIncentive"&&v.expectedAmount.amount>0),F=!!(v&&(f||O)),H=v?.incentive?.ratePercentage,q=D();return _(()=>{if(!r?.amount)return;const V=as(v,d?.amount),N={isTransactionCashbackEligible:f,totalPrice:Number(r.amount),totalPriceCurrency:r.currencyCode,...V},I=JSON.stringify(N);I!==q.current&&(q.current=I,i(N))},[f,r,i,v,d]),_(()=>{t.shopCashExpectedEarnings.value=F?v?.expectedAmount:void 0},[t,F,v?.expectedAmount]),{cashback:v,isEarningCashback:F,cashbackRate:H}}function Pt({children:e}){const{observability:n,userEvents:t,shop:o,source:s}=k(),a=et({stale:!1}),{isEarningCashback:i,cashbackRate:c,cashback:r}=os({cashbackState:a}),l=et({applying:!1}),d=Y(()=>new Yn({emit:m=>t.refineryEvent(pn(m,{shopId:o.id,checkoutSessionIdentifier:m.checkoutToken,customerId:void 0})),observability:n}),[n,t,o.id]);_(()=>()=>d.dispose(),[d]);const p=Y(()=>{const m=s.checkoutSessionIdentifier,y=r?.resolutionId;if(!m||!y)return;const g={checkoutToken:m,resolutionId:y,incentives:r?.incentives??[]};return{recordPresentation:E=>d.recordPresentation(E,g)}},[r?.incentives,r?.resolutionId,d,s.checkoutSessionIdentifier]);return h(En,{value:{redemption:l,cashback:r,cashbackState:a,isEarningCashback:i,cashbackRate:c,incentivePresentation:p},children:e})}function rs(){return ft(()=>import("./component-TransitionProgress.DW4-sFgP.js"),__vite__mapDeps([0,1,2,3,4,5,6]))}const ot=ct({displayName:"TransitionProgress",suspense:!1,load:()=>lt(rs),useError:hn("TransitionProgress")});function cs({errors:e,selectedShippingAddress:n}){const t=[...e.keys()].filter(i=>i!=="phone"),o=n!=null&&t.length>0&&t.every(i=>i==="firstName"),s=t.length>0&&!o,a=n?.valid===!1&&!o;return s||a}function ls(){const{checkout:e,shopPay:n,shop:{shippingCountries:t}}=k(),s=ce().shippingAddress.value,a=mn(s.countryCode,t),i=n.session.selectedShippingAddress.value,c=Y(()=>{const l=a(s);return cs({errors:l,selectedShippingAddress:i})},[a,s,i]),r=e.installments;_(()=>{us(r,c)},[r,c])}function us(e,n){e.unstable_setHasInvalidShippingAddress?.(n)}function ds(){return ls(),null}function ps(){const{userEvents:e,source:n,checkout:t,shop:o,shopPay:s,embed:a}=k(),i=Le(),c=t.installments.isCheckoutEligible.value,r=s.session.selectedPaymentMethod.value,l=pt(r),d=i!==null&&c&&s.session.isInstallmentsSelected.value&&l!=null,p=l!=null&&(l.supportsInstallmentsSplitPayLoan||l.supportsInstallmentsInterestLoan);_(()=>{d&&e.monorailEvent({schemaId:"shopify_pay_payment_page_installments/1.4",payload:{...Oe(n,t,o,{embedPlatform:a?.platform,shopAppSurface:s.app.c
2onfig.surface}),errorMessage:p?void 0:JSON.stringify(["selected_card_unsupported"]),eventType:Te.CheckoutEligibility,success:p}})},[e,n,t,o,a?.platform,s.app.config.surface,d,p])}function hs(){const{userEvents:e,source:n,checkout:t,shop:o,shopPay:s,embed:a}=k(),c=Le()!==null,r=t.installments.isCheckoutEligible.value,l=se(()=>{if(t.installments.ineligibilityReasons.value.length!==0)return JSON.stringify(t.installments.ineligibilityReasons.value)});_(()=>{c&&e.monorailEvent({schemaId:"shopify_pay_payment_page_installments/1.4",payload:{...Oe(n,t,o,{embedPlatform:a?.platform,shopAppSurface:s.app.config.surface}),errorMessage:l.value,eventType:Te.CheckoutEligibility,success:r}})},[l,c,r,e,n,t,o,a?.platform,s.app.config.surface])}function ms(){const{userEvents:e,source:n,checkout:t,shop:o,shopPay:s,embed:a}=k(),i=Le(),c=t.installments.isCheckoutEligible.value,r=i!==null,l=!s.user.installments.isRejected.value;_(()=>{!r||!c||e.monorailEvent({schemaId:"shopify_pay_payment_page_installments/1.4",payload:{...Oe(n,t,o,{embedPlatform:a?.platform,shopAppSurface:s.app.config.surface}),eventType:Te.UserEligibility,success:l}})},[r,c,l,e,n,t,o,a?.platform,s.app.config.surface])}function ys(){ms(),hs(),ps()}function gs(){const{shopPay:e,checkout:n}=k(),t=e.user.creditCards;return se(()=>{const o=n.installments.paymentMethodMustSupportInterestBearingLoans.value;return t.value.filter(s=>s.expired?!1:!o||s.supportsInstallmentsInterestLoan)})}function _t(){const{shopPay:e,checkout:n}=k(),t=gs(),o=Ft(),s=Ee(yn()),a=ce();return se(()=>{const i=e.session.isLoading.value,c=e.user.addresses.value.length>0,r=n.isShippingRequired.value&&(i||c),l=!i&&!c,d=!l&&t.value.length>0,p=!i&&!l&&!d&&!o.value,u=a.deliveryLines.value.some(m=>m.value.type==="SUBSCRIPTION");return{showShipping:r,showPayment:d,promptAddress:l,promptCreditCard:p,installments:s.value,hasSubscriptions:u}})}function fs(){const{userEvents:e,shop:n,source:t,checkout:o,shopPay:s}=k(),a=s.config.tracking.unique,i=s.user.shopAccountUuid;_(()=>{!i.value||!a||e.monorailEvent({schemaId:"shop_pay_session_tracking/2.0",payload:{...x(t,o,n),shopAppAccountUuid:i.value,uniqueToken:a}})},[e,t,o,n,i.value,a])}function vs(){const{shop:e,source:n,checkout:t,checkout:{extensibility:o},observability:s,userEvents:a,shopPay:i}=k(),c=t.installments.isSupported.value,r=ee(),l=Dt(),d=i.app.config,p=i.user.flow.value,u=i.user.addresses.value,m=i.user.creditCards.value,y=i.session.selectedShippingAddress.value,g=D(y),[E,P]=Ce(0),M=D(0),{value:b}=r.deliveryNext,f=fe("deliveryNext").value,C=i.session.showSessionRevalidator.value,T=r.shippingAddress,L=Ut(),v=i.user.shopAccountUuid,A=i.user.publicId.value,O=wt(b,"ONE_TIME_PURCHASE"),F=O?.status==="available",H=F&&l.value.enabledDeliveryMethods.includes("PICK_UP"),q=F&&l.value.enabledDeliveryMethods.includes("LOCAL"),V=F?l.value.enabledDeliveryMethods.length:0,N=F?O?.methods.find(({handle:S})=>O?.selectedDeliveryMethodHandle===S):null,{value:I}=ut(),{value:z}=r.discountLines,{value:U}=r.taxes,W=fe("taxes").value,{value:J}=r.duties,le=fe("duties").value,{hasSubscriptions:ae}=_t().value,j=t.installments.config.value,kt=i.session.isLoading.value,K=c&&!t.installments.isUnavailable.value,ie=Nn(),Ne=U?.status==="available_total"?U.totalTax:null,It=t.proposal.facts.duty,At=gn(It,J),Re=Y(()=>z?.lines.reduce((S,R)=>{if(!Rn(R))return S;const G=R.amount?.amount;return G?S+G:S},0),[z]),xe=z?.lines.length||0,te=kt||W||le||f,{value:Et}=r.tipLines,Be=Et?.[0],Fe=Vt(d),De=n.type==="cartNext"?n.sourceId:"",{value:ue=[]}=r.allViolations,Ue=Ht(ue),Q=i.session.selectedPaymentMethod.value,de=pt(Q),we=Y(()=>fn(ue),[ue]),Ve=o.ui.search().value.length>0,oe=i.user.installments.prequalifiedAmount.value,pe=i.user.installments.credential.value,He=mt()?.trackingVisit;_(()=>{te||(a.monorailEvent({schemaId:"shopify_pay_payment_page_checkout_state/5.8",payload:{...x(n,t,e),checkoutEligibleForLocalPickupBanner:(T||!1)&&H,merchantHasLocalPickup:H,checkoutHasSubscriptionProduct:ae,totalLineItemsPrice:L.value?.toString()||"",paymentDue:I?.amount?.toString()||"",currency:I?.currencyCode||"",installmentsAvailable:t.installments.isSupported.value,requiresVerification:C,checkoutEligibleForInstallments:K,checkoutEligibleForSplitPayInstallments:ne("SPLIT_PAY"),checkoutEligibleForInterestBearingInstallments:K&&qt(j?.availableLoanTypes),counter:E+1,merchantHasLocalDelivery:q,taxAmount:Ne?.amount?.toString()||"",dutyAmount:At?.amount.toString()||"",numAppliedDiscounts:xe,discountAmount:Re?.toString()||"",numShippingOptions:V,shippingAmount:N?.cost?.amount?.toString()||"",tipAmount:Be?.amount?.amount.toString()||"",shopAccountUuid:v.value,isFromShopApp:Fe,cartToken:De,merchandiseIssueType:Ue?we:"",trackingVisit:He,hasCheckoutExtension:Ve,requiresShipping:t.isShippingRequired.value,flow:p}}),P(S=>S+1))},[c,K,L.value,H,q,I,a,n,t,e,T,v.value,Ne,xe,Re,V,N,C,Be,we,De,Fe,Ue,He,Ve,t.isShippingRequired.value,p]),_(()=>{if(te)return;M.current++;const S=zt(u)?.address,R=m.length;let G=0,Ke=0,me=0;m.forEach(ye=>{ye.funding==="credit"?G++:ye.funding==="debit"&&Ke++,ye.expired&&me
2++});const Mt=R>0&&R===me;a.monorailEvent({schemaId:"shopify_pay_payment_page_wallet_state/1.2",payload:{...x(n,t,e),shopAccountUuid:v.value,counter:M.current,numCreditCards:G,numDebitCards:Ke,numCards:R,numExpiredCards:me,isDefaultCardExpired:Mt,numShippingAddresses:u.length,defaultShippingAddressHasCompanyName:!!S?.company?.trim(),defaultShippingAddressHasAddress2:!!S?.address2?.trim(),defaultShippingAddressHasPhoneNumber:!!S?.phone?.trim(),installmentsPrequalifiedAmount:oe?.amount?.toString(),installmentsPrequalifiedCurrency:oe?.currencyCode,isPrequalifiedForInstallments:!!oe,installmentsAdditionalInformationRequired:!pe||pe.requiresAdditionalInformation}})},[te,M,u,m,v.value,a,n,t,e,oe,pe]);const ne=B(S=>!K||!j?.availableLoanTypes?!1:j.availableLoanTypes.includes(S),[K,j?.availableLoanTypes]),qe=t.installments.ineligibilityReasons,ze=i.user.installments.isRejected.value,Ge=Y(()=>{const S=qe.value;return ze||!c?JSON.stringify(["user_rejected"]):S.length>0?JSON.stringify(S):""},[ze,c,qe.value]);_(()=>{te||I&&!isNaN(I.amount)&&a.monorailEvent({schemaId:"shop_pay_installments_eligibility/2.1",payload:{...x(n,t,e),userId:A,checkoutEligible:K,splitPayEligible:ne("SPLIT_PAY"),interestBearingEligible:ne("INTEREST"),zeroPercentEligible:ne("ZERO_PERCENT"),paymentDue:I.amount,currency:I.currencyCode,ineligibilityReason:Ge,spiPreselected:ie.value.spiPreselected,preselectionReason:ie.value.preselectionReason}})},[K,A,Ge,ne,te,I,ie.value.spiPreselected,ie.value.preselectionReason,a,n,t,e]);const he=B(()=>{a.monorailEvent({schemaId:"shopify_pay_payment_page_ui_interaction/1.2",payload:{...x(n,t,e),action:"credit_card_select"}})},[a,n,t,e]),$e=B(()=>{a.monorailEvent({schemaId:"shopify_pay_payment_page_ui_interaction/1.2",payload:{...x(n,t,e),action:"payment_method_ideal"}})},[a,n,t,e]);_(()=>{if(!Q){de&&(s.error(new Ss("Selected credit card and payment method misaligned"),{severity:"warning",metadata:{selectedCreditCard:{value:JSON.stringify(de)},selectedPaymentMethod:{value:JSON.stringify(Q)}}}),he());return}Gt(Q)?he():$t(Q)&&$e()},[de,he,Q,$e,s]);const We=B((S,R)=>{const G="isEphemeralAddress"in S&&S.isEphemeralAddress;a.monorailEvent({schemaId:"shopify_pay_payment_page_select_shipping_address/1.4",payload:{...x(n,t,e),previousAddressId:isNaN(Number(R?.id))?-1:Number(R?.id),previousAddressCountry:R?.address?.countryCode??"",currentAddressId:isNaN(Number(S.id))?-1:Number(S.id??-1),currentAddressCountry:S.address.countryCode??"",...R?.id&&isNaN(Number(R.id))?{previousAddressUuid:R.id}:{},...!G&&S.id&&isNaN(Number(S.id))?{currentAddressUuid:S.id}:{},ephemeral:G,previousAddressPreferred:R?.userPreferred,currentAddressPreferred:S.userPreferred}})},[a,n,t,e]);_(()=>{y&&g.current?.id!==y.id&&We(y,g.current),g.current=y},[y,We])}
2class Ss extends Error{constructor(){super(...arguments),this.name="MissingCreditCardOnPaymentMethod"}}const Ps=ct({displayName:"ShopPayCaptcha",load:()=>lt(()=>ft(()=>import("./ShopPayCaptcha.DPBCCrUk.js").then(e=>e.S),__vite__mapDeps([7,1,8,2,3,4,5,9,10,11,12])))}),_s="sYMP2",bs="aPplN",Cs="N5SeL",ks="fdTMm",Is="ekZTm",As="UmHzB",Es="JPhUL",Ms="_7k6aq",Ts="CmqN5",Ls="Evr2B",Z={Button:_s,disabled:bs,borderRadiusBase:Cs,displayInlineBlock:ks,paddingInlineSmall400:Is,paddingInlineSmall300:As,paddingInlineBase:Es,paddingBlockSmall400:Ms,paddingBlockSmall300:Ts,paddingBlockBase:Ls},Os=Lt(function({children:n,displayInlineBlock:t=!1,borderRadiusBase:o=!1,paddingInline:s="small300",paddingBlock:a="small300",...i},c){return h("div",{className:Ot(Z.Button,o&&Z.borderRadiusBase,t&&Z.displayInlineBlock,i.disabled&&Z.disabled,Z[Ye("paddingInline",s)],Z[Ye("paddingBlock",a)]),children:h(Ie,{variant:"plain",ref:c,...i,children:n})})});function be({open:e,blocking:n,title:t,description:o,onClose:s,cta:a,onClickCta:i,secondaryAction:c,onPressSecondaryAction:r,cancel:l,onPressCancel:d}){const m=h(X,{children:[o,h(yt,{gap:"small-200",padding:"base none none none",children:[h(Ie,{inlineSize:"fill",variant:"primary",onClick:i,children:a}),c?h(Ie,{inlineSize:"fill",onClick:r,children:c}):null,l?h(Os,{borderRadiusBase:!0,inlineSize:"fill",onClick:d,paddingBlock:"base",children:l}):null]})]});return n?h(tt,{blocking:!0,open:e,heading:t,children:m}):h(tt,{open:e,heading:t,onHide:s,children:m})}const Ns={[w.Generic]:Pe.PaymentErrorModalGeneric,[w.SignInFailed]:Pe.PaymentErrorModalSignInFailed,[w.ContinueWithShopPay]:Pe.PaymentErrorModalContinueWithShopPay};function Rs(){const{i18n:e,userEvents:n,source:t,checkout:o,shop:s,shop:{name:a},shopPay:i,router:c}=k(),r=c.currentUrl.value,{buyerIdentity:l}=ee(),[d,p]=Ce(!1),[u,m]=Ce(null),y=Ns[u?.type??w.Generic],{href:g,redirectToGuestCheckout:E}=vn(y),P=B(()=>{i.session.unstable_setUnauthenticatedErrorModal(void 0)},[i.session]),M=B(()=>{n.monorailEvent({schemaId:"shopify_pay_payment_page_ui_interaction/1.1",payload:{...x(t,o,s),action:`${y}_close`}}),P()},[P,y,n,t,o,s]),b=B(()=>{if(!g){P();return}E()},[g,P,E]),f=B(async()=>{n.monorailEvent({schemaId:"shopify_pay_payment_page_ui_interaction/1.1",payload:{...x(t,o,s),action:"change_email"}}),P(),setTimeout(()=>{!!l.value?.customerProfile?i.session.unstable_updateVerificationTrigger({source:nt.ErrorModalClearEmail}):window.dispatchEvent(new Event("shop_pay_verification_reset"))},0)},[l,P,n,t,o,s,i.session]),C=B(async()=>{n.monorailEvent({schemaId:"shopify_pay_payment_page_ui_interaction/1.1",payload:{...x(t,o,s),action:"continue_with_shop_pay"}}),P(),i.session.unstable_updateVerificationTrigger({source:nt.ErrorModalContinue})},[P,n,t,o,s,i.session]),T=i.session.unauthenticatedErrorModal.value;_(()=>{if(!T){p(!1);return}m(T),p(!0)},[T]);const L=Y(()=>{switch(u?.type){case w.Generic:return e.translate("unauthenticated_modals.generic.title");case w.SignInFailed:return e.translate("unauthenticated_modals.sign_in_failed.title");case w.ContinueWithShopPay:return e.translate("unauthenticated_modals.continue_with_shop_pay.title");default:return""}},[u,e]);if(!u)return null;const A=ht(r.search)?h(yt,{direction:"inline",gap:"small-500",alignItems:"center",children:[e.translate("unauthenticated_modals.continue_with_shop_pay.cancel",{shopName:a}),h(Sn,{type:"external",size:"small"})]}):e.translate("unauthenticated_modals.generic.cta");switch(u.type){case w.Generic:return h(be,{blocking:!0,open:d,onClose:M,title:L,description:e.translate("unauthenticated_modals.generic.description",{shopName:a}),cta:A,onClickCta:b});case w.SignInFailed:return h(be,{open:d,onClose:M,title:L,description:e.translate("unauthenticated_modals.sign_in_failed.description",{shopName:a}),cta:A,onClickCta:b});case w.ContinueWithShopPay:return h(be,{blocking:!0,open:d,onClose:M,title:L,description:e.translate("unauthenticated_modals.continue_with_shop_pay.description",{email:h(Pn,{type:"strong",children:u.email}),shopName:a}),cta:e.translate("unauthenticated_modals.continue_with_shop_pay.cta"),onClickCta:C,secondaryAction:e.translate("unauthenticated_modals.continue_with_shop_pay.secondary"),onPressSecondaryAction:f,cancel:A,onPressCancel:b});default:return null}}function xs(){const{checkout:e,router:n,shopPay:t}=k(),{currentDetour:o}=gt().value,s=bn(),a=Cn()&&!e.configuration.isUniversalCheckoutFinalizer&&!s&&!o,i=n.currentUrl.value.normalizedPath;return _(()=>()=>e.checkoutExit.cancelRedirectProgress(),[e.checkoutExit,i]),h(X,{children:[h(ke,{when:()=>a&&t.session.isInternalProgressing.value,children:h(ot.Preload,{})}),h(ke,{when:()=>a&&e.checkoutExit.progressPhase.value==="visible",children:h(ot,{})})]})}function Bs({children:e}){const{checkout:n,source:t,observability:o,userEvents:s,shop:a,shopPay:i}=k(),c=n.latestReceipt.value,{promptCreditCard:r}=_t().value,l=n.installments.paymentMethodMustSupportInterestBearingLoans.value,d=i.user.isUnauthenticatedSession.value,p=D(null),u=p.current?.id||"no-failed-receipt";return _(()=>{c&&c.status==="failed"&&(p.current=c)},[c]),_(()=>{r&&l&&s.monorailEvent({schemaId:"shopify_pay_payment_page_ui_interaction/1.2",payload:{...x(t,n,a),action:"new_debit_card_form"}})},[l,r,s,t,n,a]),ys(),vs(),fs(),_n({enabled:i.session.isLoading.value,onTimeout:m=>{o.counter({name:"shop_pay_root_loading_timeout",value:1}),o.log("shop_pay_root_loading_timeout","ShopPayRoot loading timeout",{timeout:m})}}),h(X,{children:[h(ds,{}),h(X,{children:[h(xs,{}),e,h(ke,{when:i.user.isUnauthenticatedUser,children:h(Rs,{})}),d&&h(Ps,{})]},u)]})}function Fs(){const{shopPay:e}=k(),n=St(),t=e.session.initialization.value.status;_(()=>{t==="initialized"&&e.user.unstable_setApplePayAvailable(n.value)},[t,n.value,e])}const Ds={id:"8b0aa9c5a6b1f77d064216d93704ed01ecc60aca1a2317877fc6478cdfa553e8",type:"mutation",name:"CheckoutSessionUpdateSelections",source:"mutation CheckoutSessionUpdateSelections($checkoutContextInput:CheckoutContextInput!,$selectedPaymentMethodId:String,$selectedPaymentMethodOption:String){checkoutSessionUpdateSelections(checkoutContextInput:$checkoutContextInput selectedPaymentMethodId:$selectedPaymentMethodId selectedPaymentMethodOption:$selectedPaymentMethodOption){userErrors{message field __typename}__typename}}"};function Us(){const{shopPay:e,graphql:{shopPayGraphql:n},source:t,shop:o}=k(),s=Wt({source:t}),a=D(void 0),i=D(!1);!i.current&&e.session.initialization.peek().status==="initialized"&&(i.current=!0,a.current={selectedPaymentMethodOption:e.session.paymentMethodOption.peek(),userSelectedPaymentMethod:e.session.selectedPaymentMethod.peek()}),Me(()=>{if(e.session.isLoading.value)return;const c=e.session.selectedPaymentMethod.value,r={selectedPaymentMethodOption:e.session.paymentMethodOption.value,userSelectedPaymentMethod:c};
2if(!(Kt(a.current,r)||ws(r))){if(a.current===void 0){i.current=!0,a.current=r;return}n.mutate(Ds,{variables:{checkoutContextInput:{checkoutIdentifier:t.checkoutSessionIdentifier??"unknown",checkoutVersion:s,shopId:Yt(o.id),shopifyDomain:o.myshopifyDomain},selectedPaymentMethodId:r.userSelectedPaymentMethod?.id,selectedPaymentMethodOption:r.selectedPaymentMethodOption?.name}}),a.current=r}})}const ws=e=>Object.values(e).every(n=>!n);function Vs(e){return e.type==="customOnsite"?e.name:e.type}function rt(e){return[...e].map(Vs).sort().join("|")}function bt(){const{observability:e,userEvents:n,checkout:t,shop:o,shopPay:s,consentManager:a,checkout:{addressManager:{shipping:i}}}=k(),c=Ee(Hn()),r=gt(),l=se(()=>r.value.currentDetour?.type==="shopPayLogin"),d=Un(),p=se(()=>d()),{data:u,loading:m}=dt(wn,{isOnShopPayLoginDetour:l,newSignupLoginVariant:c,simulatedBuyerDetails:p}),y=typeof window>"u",g=ce(),E=Mn(),P=ee(),M=Tn(),b=Jt(),{updateCheckoutAddress:f}=xn(),C=P.buyerIdentity.value?.customerProfile,T=g.shippingAddress.value,{value:L}=P.paymentMethods,v=jt({managedByMarketsPro:P.managedByMarketsPro.value}),A=St(),{value:O}=Bn({isApplePayAvailable:A.value}),F=D(L?rt(O):void 0),H=Qt({paymentRequiredMethod:M.value,isIdealEnabledForShopPay:v}),q=B(N=>Zt(N,O),[O]);async function V(N){const I=i.value.immutableAddresses.value.filter(({id:J})=>J!==je),z=M.value,U=s.applyBuyerDetailsToCheckout(N,{checkout:t,observability:e,userEvents:n,shop:o,hydration:{negotiatedPaymentMethods:O,isApplePayAvailable:A.value,immutableAddresses:I,proposedShippingAddress:T,canUpdateDeliveryAddress:b.value,mustSelectProvidedAddress:P.mustSelectProvidedAddress.value??!1,paymentRequiredMethod:z,negotiatedCardUuid:sn({proposedPaymentLines:g.paymentLines.value})},customerProfile:C,paymentExemptionReason:E.value,idealEnabledForShopPay:v});if(U.status==="card_vaulting_disabled")return;const{shippingAddress:W}=U.appliedAddresses;W&&!an(T,W)&&e.log("shipping_address_auto_applied","[useShopPayParts] Shop Pay hydration applied a new shipping address to the proposal",{address_id:U.hydrationResult.selectedShippingAddress?.id}),y||Dn({consentManager:a,shop:o},N)}_(()=>{const N=s.session.initialization.peek(),I=u.value,z=N.status==="initialized"&&I===void 0;if(s.session.unstable_setLoading(z?!1:m.value),m.value)return;const U=s.session.unstable_receiveBuyerDetailsResult(I);U.status==="initialize"&&V(U.buyerDetails)},[m.value,u.value]),_(()=>{if(!u.value||u.value.status!=="success"||L===void 0)return;const N=q(u.value.paymentMethods),I=Xt(N,u.value.creditCards);if(!(u.value.creditCards.length>0||I.some(en)))return;const W=rt(O);if(W===F.current)return;F.current=W,s.user.unstable_setApplePayAvailable(A.value),s.user.unstable_setPaymentMethodsFromBuyerDetails(I);const J=s.session.selectedPaymentMethod.value;if(!J)return;const le=tn({addressesForUI:u.value.addresses,immutableAddresses:i.value.immutableAddresses.value.filter(({id:j})=>j!==je),proposedShippingAddress:g.shippingAddress.value,mustSelectProvidedAddress:P.mustSelectProvidedAddress.value}),ae=nn({paymentMethod:J,billingAddressToSelect:le,shouldUseLpmBillingAddress:H});ae&&f({billingAddress:ae},!0)},[i,q,u.value,A.value,P.mustSelectProvidedAddress,L,O,g.shippingAddress,s.session,H,s.user,f]),y&&u.value&&u.value.status==="success"&&s.session.initialization.peek().status==="pending"&&V(u.value)}function Ct(){const{observability:e,shopPay:n}=k(),t=ee(),o=ce(),[,s]=Fn({allowPreselect:!1}),a=D(void 0);Me(()=>{const i=n.session.selectedPaymentMethod.value,c=t.paymentMethods.value,r=n.user.paymentMethods.value,l=n.session.promotedPaymentMethods.value;Ae(()=>{if(!i){const p=a.current;if(p===void 0||Qe(p.method,r)||Qe(p.method,l))return;const u=o.paymentLines.value,m=u.some(g=>ve(g.method)===p.primaryLineKey);if(a.current=void 0,!m)return;const y=u.filter(g=>Se(g)||!p.lineKeys.includes(ve(g.method)));y.length!==u.length&&(o.paymentLines.value=y);return}const d=on({paymentMethod:i,negotiatedPaymentMethods:c,observability:e});if(d===void 0){a.current=void 0,o.paymentLines.value=o.paymentLines.value.filter(Se);return}d==="SHOP_PAY"&&rn(o.paymentLines.value)!==void 0||(s(d),a.current={method:i,primaryLineKey:d,lineKeys:o.paymentLines.value.filter(p=>!Se(p)).map(p=>ve(p.method))})})})}const Hs=["begin_page_load","first_meaningful_paint","page_loaded"];function qs(){const{client:e,userEvents:n,source:t,checkout:o,shop:s,shopPay:a}=k(),i=D(new Set),c=B(f=>{i.current.has(f)||(i.current.add(f),n.monorailEvent({schemaId:"shopify_pay_payment_page_ready/2.1",payload:{...x(t,o,s),success:!0,status:f,clientTimestampMs:Date.now()}}))},[n,t,o,s]),r=B(f=>{for(const C of Hs)if(c(C),C===f)return},[c]);Me(()=>{const f=a.session.isLoading.value,C=a.session.initialization.value.status==="initialized";Ae(()=>{r("begin_page_load"),f&&r("first_meaningful_paint"),C&&r("page_loaded")})});const l=t.type==="shopPayExternal",d=mt(),p=kn(qn.ShopifyPay,a.config.redirectSource,d?.trackingUnique,d?.trackingVisit),u=D(!1);_(()=>{!u.current&&!l&&(u.current=!0,p())},[p,l]);const m=In().value,y=l||m,g=zn(),E=l?g.analyticsTraceId.value:void 0,{checkoutSessionIdentifier:P="checkout_identifier_undefined"}=t,{redirectSource:M,tracking:b}=a.config;return _(()=>{if(!y)return;const T=window.location.pathname.split("/").pop()==="shoppay_login";ht()&&!T&&n.monorailEvent({schemaId:"shop_app_page_load/9.0",payload:{...x(t,o,s),platform:"web",locale:navigator.language,userToken:b.unique??e.cookies.get("_shopify_y")??"",webSessionToken:b.visit??e.cookies.get("_shopify_s")??"",pageType:"pay_payment_page",pageValue:P}}),n.monorailEvent({schemaId:"shopify_pay_page_load/2.6",payload:{...x(t,o,s),pageType:"payment_page",clientTimestampMs:Date.now(),redirectSource:M,analyticsTraceId:E}})},[P,e.cookies,n,t,o,s,M,y,E,b.unique,b.visit]),null}function zs({hasUnauthorizedError:e,isShopPayExternal:n,redirectSource:t}){return e&&t!==Ze.CheckoutAutomaticRedirect&&t!==Ze.CheckoutUniversalRedirect?{type:"login"}:n?{type:"externalDetour",route:e?"shopPayLogin":"terminalError",replace:e}:{type:"guestCheckout"}}function Gs({children:e}){const{observability:n,source:t,shopPay:{config:o,session:{initialization:s}}}=k(),{checkoutAsGuestUrl:a,redirectSource:i}=o,{detour:c}=An(),{replaceShopPayInHistory:r}=vt(),l=t.type==="shopPayExternal",d=s.value,p=d.status==="pending";Vn(p);const u=d.status==="failed",m=d.status==="failed"&&d.reason==="fetch"?d.errors:void 0,y=!!m?.some(g=>g.message===cn);if(_(()=>{u&&!y&&(n.counter({name:"shop_pay_failed_to_fetch_buyer_session_details",value:1}),n.log("shop_pay_provider_buyer_session_details_fetch_failed","Unexpected error fetching buyer session details",{errors:m}))},[u,y,m,n]),u){const g=zs({hasUnauthorizedError:y,isShopPayExternal:l,redirectSource:i});return g.type==="login"?(c("shopPayLogin",{routerOptions:{replace:!0}}),null):g.type==="externalDetour"?(n.leaveErrorBreadcrumb("shouldRedirect=true",{route:g.route}),c(g.route,{routerOptions:{replace:g.replace}}),null):(n.error(new ln("Failed to fetch buyer session details. Redirecting to guest checkout"),{severity:"warning"}),n.log("shop_pay_provider_guest_checkout_redirected","[ShopPayProvider] Redirecting to guest checkout"),r(a),null)}return h(X,{children:e})}function pa({simulated:e,children:n}){Us();const{observability:t,shopPay:o}=k(),s=ee().buyerIdentity.value?.purchasingCompany,{replaceShopPayInHistory:a}=vt();return e?h(Ws,{children:n}):s?(t.log("shop_pay_shell_redirected","Shop Pay is not supported for B2B customers. Redirecting to guest checkout."),a(o.c
2onfig.checkoutAsGuestUrl),null):h(X,{children:[h(qs,{}),h($s,{children:n})]})}function $s({children:e}){return bt(),Fs(),Ct(),h(Gs,{children:h(Pt,{children:h(Bs,{children:e})})})}function Ws({children:e}){return bt(),Ct(),h(Pt,{children:e})}export{pa as ShopPayCheckout};

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.