PageSourceSearch

https://www.thesoapdispensary.com/cdn/shopifycloud/checkout-web/as…onent-ShopPayVerificationSwitch.BcdwC4q_.js

js thesoapdispensary.com collected 2026-09-25 23:36:57 UTC 24,075 bytes, 1 lines download raw bytes

1import{q as b,T as R,k as x,_ as ve,u as C,A as L,h as P,g as pe,W as De,S as ke,a7 as Ve,p as Ue}from"./esnext-vendor.B9Da21W6.js";import{S as Y,a4 as de,f2 as ie,f3 as xe,f4 as Re,ae as Pe,an as ce,f5 as _e,bg as Ce,f6 as re,f7 as ue,f8 as le,f9 as Oe,dw as me,dy as Fe,eA as Be,dc as He,fa as $e,bv as ze}from"./addresses-is-address-empty.Bn2lNY_L.js";import{eT as F,b1 as We,z as Ge,f2 as Ke,F as qe,aQ as Ye,aR as Je,f4 as Me,f5 as we,be as Ie,_ as Qe}from"./hydrate.DZ4YTm7p.js";import{d as Se}from"./stopwatch.CfKlh48v.js";import{L as Xe}from"./BillingAddressForm.pnsu7UK8.js";import{a as je}from"./hooks-useShopPayNewSignupLoginExperiment.vaE9WYHy.js";import{u as Ze}from"./hooks-useForceShopPayUrl.BFRInJvm.js";import{a as be}from"./hooks-useSuppressShopPayModalOnLoad.DFOLDSdS.js";import{p as K,S as z,u as et,a as tt,M as Le,A as X,b as nt}from"./utilities-publishMessage.DAF0fAuB.js";import{d as q}from"./graphql-PaymentSessionMutation.CAXCwUvV.js";import{u as ot}from"./useShopPayButtonClassName.FG1djxr9.js";import{i as rt,a as oe,u as fe,b as Ae,c as he,d as st,A as at,e as it,r as ct,S as ut,M as dt,I as lt,f as ft,R as ht,P as ye,g as U,h as pt,j as mt,k as St}from"./useAuthorizeUrl-index.DpCFC7uh.js";import"./app.DbSrjjlA.js";import"./hooks-useShopPayExternalAppContext.DWwMuRnz.js";import"./hooks-useReplaceShopPayInHistory.DPpLejwu.js";import"./localization-index.1YNaS8kx.js";import"./components-RedirectionNotice.module.CsVdFi0g.js";import"./amazon-pay-useAmazonPayPaymentLine.Ju006AId.js";import"./PhoneField.C0TeiZrn.js";import"./Popover.BScgzCsS.js";import"./AddressPresenter.BIgrto4P.js";import"./Choice.DSKmQsTS.js";import"./Checkbox.DQyvbr9E.js";import"./shared-shop-theme.DIHIQUEd.js";import"./hooks-useShowShopPayOptin.Br0M25ky.js";import"./hooks-useShouldRevealCustomization.D_kH_Ics.js";import"./dist-v4.EwEgHOG0.js";function Te({element:e}){return b(()=>{e?.current&&e.current?.focus&&e.current.focus()},[e])}const yt=e=>{const{environment:n,i18n:{locale:t},shop:{myshopifyDomain:o},source:{checkoutSessionIdentifier:r},shopPay:h}=Y(),d=Ze(),s=de().buyerIdentity.value?.customerProfile,{redirectUrl:i,transactionParams:a,tokens:E}=h.config,p=E.iframe,l=je();return R(()=>{if(!r)throw new ie({groupingHash:"ShopPayCheckoutIdentifierMissingError::ULCFrame"});if(!l||!(p&&i))return;const m=new URLSearchParams({shopify_domain:o,checkout_token:r,origin:e,locale:t,iframe_token:p,redirect_url:i,transaction_params:a??"",shop_pay_new_signup_login_variant:l});for(const[k,c]of d.entries())m.set(k,c);e===F.C1InlineModal&&m.set(xe,Re.ShopPayAsPaymentMethod),s?.email&&m.set("fast_login","true");const v=m.toString(),_=new URL("/pay/transactions/new/email",n.services.payShopifyCom.url);return _.search=v,_.href},[e,o,r,t,p,i,a,l,d,s,n])};function gt(){const[e,n]=x(null),t=b(o=>{o!==null&&n(o.getBoundingClientRect())},[]);return[e,t]}function Et(e){const[n,t]=x(null),o=b(()=>{e!==null&&t(e.getBoundingClientRect())},[e]);return ve(()=>(o(),window.addEventListener("resize",o),window.addEventListener("scroll",o),()=>{window.removeEventListener("resize",o),window.removeEventListener("scroll",o)}),[o]),n}const ge=10;function vt({x:e,y:n}){const t=window.devicePixelRatio||1;return{x:Math.round(e*t)/t||0,y:Math.round(n*t)/t||0}}function kt(e,n,t,o,{offset:r=0,arrowOffset:h=0}={}){let d={x:0,y:0},s={left:0,right:0},i=0;if(!n&&!t)return{offsets:d,spacing:i};if(!o){const{clientWidth:a,clientHeight:E}=document.documentElement;return d={x:a/2-n/2,y:E/2-t/2},{offsets:d,spacing:i}}switch(e){case"blockEnd":d={x:(document?.dir??"ltr")==="rtl"?o.left:o.right-n,y:o.bottom+r};break;case"inlineEnd":d={x:(document?.dir??"ltr")==="rtl"?o.left-n-r:o.right+r,y:o.top+o.height/2-h};break}return s=Pt(d,n),s.right&&!s.left?(d.x+=s.right,i=-ge):!s.right&&s.left&&(d.x=0,i=ge),{offsets:d,spacing:i}}function Pt(e,n){const t=document.documentElement.clientWidth,o=e.x+n;let r={left:0,right:0};return o>t&&(r={...r,right:t-o}),e.x<0&&(r={...r,left:-e.x}),r}const _t="qdHCv",Ct={Popper:_t};function Mt({children:e,offset:n,arrowOffset:t,contentWidth:o,contentHeight:r,placement:h="inlineEnd",activator:d,open:s}){const i=Et(d??null),[a,E]=gt(),{offsets:p,spacing:l}=R(()=>s?kt(h,(o||a?.width)??0,(r||a?.height)??0,i,{offset:n,arrowOffset:t}):{offsets:{x:0,y:0},spacing:0},[n,t,h,a,i,s,o,r]),{x:f,y:m}=R(()=>s?vt({x:p.x+l+(window.scrollX||window.pageXOffset),y:p.y+(window.scrollY||window.pageYOffset)}):{x:0,y:0},[p,l,s]),v=R(()=>s?(window.devicePixelRatio||1)<2?`translate(${f}px, ${m}px)`:`translate3d(${f}px, ${m}px, 0)`:"none",[s,f,m]);return C(We,{children:C("div",{className:Ct.Popper,style:{...a&&{transform:v,MozTransform:v,WebkitTransform:v}},ref:E,"aria-hidden":!s,children:e})})}
1const wt="hgqpU",It="axmya",bt="JHj7j",Lt="hQvGd",At="PMbsk",Tt="wA8HY",Nt="xnzQ4",B={Backdrop:wt,"Backdrop-visible":"LTbS5",BackdropLinearGradient:It,Popover:bt,Content:Lt,PopoverArrow:At,PopoverOpen:Tt,"Popover-placementInlineEnd":"trTaz","Popover-placementBlockEnd":"KMvI7",Bumper:Nt},Dt=qe("Popover");function Vt({children:e,activator:n,open:t,placement:o="inlineEnd",contentWidth:r,contentHeight:h,onClose:d}){const s=L(null),i=L(null),a=L(null),E=Ge(void 0,Dt),p=Ke(),l=b(()=>{n?.tagName==="BUTTON"&&(n?.setAttribute("aria-controls",E),n?.setAttribute("aria-expanded",String(t)))},[n,t,E]),f=b(c=>{d?.(c)},[d]),m=b(c=>{c.target instanceof Node&&!n?.contains(c.target)&&document.contains(c.target)&&!a.current?.contains(c.target)&&t&&f(c)},[f,n,t,a]),v=b(c=>{if(t)switch(c.key){case"Escape":case"Esc":f(),n?.focus();break}},[f,n,t]);P(()=>(document.addEventListener("click",m),()=>{document.removeEventListener("click",m)}),[m]),P(()=>(t&&document.addEventListener("keydown",v,!1),()=>{document.removeEventListener("keydown",v,!1)}),[t,v]),P(()=>{l()}),ve(()=>{t&&a.current?.focus({preventScroll:!0})},[t]);const _=c=>{const S=a.current;if(S){const M=c?Ye(S):Je(S);M?M.focus():S.focus()}},k=pe(B.Popover,B[De("Popover-placement",o)],t&&B.PopoverOpen,n&&B.PopoverArrow);return C(ke,{children:[C(Mt,{activator:n,placement:o,offset:15,arrowOffset:30,open:t,contentWidth:r,contentHeight:h,children:[t&&C("button",{className:B.Bumper,ref:s,"aria-hidden":"true",onFocus:()=>_(!1),type:"button"}),C("div",{className:k,id:E,ref:a,children:C("div",{className:B.Content,children:e})}),t&&C("button",{className:B.Bumper,ref:i,"aria-hidden":"true",onFocus:()=>_(!0),type:"button"})]}),C("div",{className:pe(B.Backdrop,t&&B["Backdrop-visible"],t&&p&&B.BackdropLinearGradient)})]})}var ae=(e=>(e.Normal="normal",e.CustomerAccount="customer_account",e.AccountsSameStore="accounts_same_store",e.AccountsCrossStore="accounts_cross_store",e))(ae||{});function Ut({email:e,skipVerifyOnLoad:n,iframeReady:t,iframeRef:o,dismissedModalKey:r,readyToDismiss:h,onReadyToDismiss:d,showPopover:s,showToggle:i,popoverActivator:a,open:E,automaticVerificationEnabled:p}){const l=de().buyerIdentity.value?.customerProfile,{inMemoryPayPalParts:{accountStatus:f}}=Pe(),{isDismissedGuestModal:m}=Me(),{client:v,shopPay:_,source:k}=Y(),{checkoutProtocolModalEventSignal:c}=ce(),S=we(Ce.ShopPayVerification,{scope:_e(k)}),M=Ie().current.token,y=L();P(()=>{if(!t){y.current=void 0;return}if(n.current){n.current=!1;return}const N=l&&v.cookies.get(r),H=e&&re(e),u=f.value.status==="connected",g=l&&xt();if(!H){y.current=void 0;return}if(N||u||g)return;if(S.value===q.Verified){S.value=void 0;return}(p||E)&&y.current!==e&&(y.current=e,K(o?.current,{action:z.Create,email:e,flow:ae.Normal,disableAutoFocus:m()}))},[e,t,p,E]);function I(){if(!k.checkoutSessionIdentifier)throw new ie({groupingHash:"ShopPayCheckoutIdentifierMissingError::GuestCheckout"});if(!(l&&v.cookies.get(r))&&e&&re(e)){h||d(),M&&K(o?.current,{action:z.CheckoutQueueToken,queueToken:M}),_.setUserIdentified(escape(k.checkoutSessionIdentifier));const N=new URL(window.location.href);N.searchParams.delete(ue),history.replaceState(null,"",N.href),window.dispatchEvent(new Event("shop_pay_user_identified_cookie_set")),S.value=q.Pending,m()?i?.(!0):(s(!0,e),i?.(!1))}}function A(){h&&(S.value=q.Dismissed,l&&v.cookies.set(r,"true"),a?.current?.focus(),s(!1),i?.(!0))}function T(){le(),S.value=q.Verified,c.value="none"}return{onShow:I,onHidden:A,onLoggedIn:T}}function xt(){const e=sessionStorage.getItem(Oe);if(!e)return!1;const n=Number.parseInt(e,10);return isNaN(n)?!1:Date.now()<n}const Rt=[X.FraudGuard,X.InvalidPhone,X.LimitExceeded,X.PhoneBlocked];function Ot({email:e,onSetEmail:n,skipVerifyOnLoad:t,iframeReady:o,iframeRef:r,readyToDismiss:h,onReadyToDismiss:d,showPopover:s,popoverActivator:i,origin:a,open:E,automaticVerificationEnabled:p}){const{shopPay:l,source:{checkoutSessionIdentifier:f}}=Y(),{openModal:m}=ot(),{exchangeSessionTokenForCookie:v}=et(),{extendBuyerIdentity:_}=tt(),k=L(null),c=L(!1),S=L(),{checkoutProtocolModalEventSignal:M}=ce(),y=b(()=>{r.current&&K(r.current,{action:z.Create,email:"",flow:ae.Normal})},[r]);P(()=>{r.current&&o&&a===F.C1ModalShopPaySignIn&&(K(r.current,{action:z.AllowNoInitialEmail}),y(),K(r.current,{action:z.Ready}))},[o,r,a,y]),P(()=>{E&&(k.current=null)},[E]),P(()=>{c.current&&r.current&&o&&(c.current=!1,y())}),P(()=>{function u(){n&&(l.updateUserVerification({status:"none"}),n(""),i?.current?.focus()),c.current=!0}return window.addEventListener("shop_pay_verification_reset",u),()=>{window.removeEventListener("shop_pay_verification_reset",u)}},[i,s,n,r,l]),P(()=>{if(!o){S.current=void 0;return}if(t.current){t.current=!1;return}const u=e&&re(e),g=p||E;if(!(u&&a!==F.C1ModalShopPaySignIn&&!g))if(u&&a!==F.C1ModalShopPaySignIn){if(S.current===e)return;S.current=e,l.updateUserVerification({email:e,status:"loading"}),K(r?.current,{action:z.Create,email:e,flow:ae.Normal})}else a!==F.C1ModalShopPaySignIn&&(S.current=void 0,y(),l.updateUserVerification({status:"none"}))},[e,o,t,r,a,p,E,l,y,s]);function I(){if(!f)throw new ie({groupingHash:"ShopPayCheckoutIdentifierMissingError::S
1hopPayCheckout"});a===F.C1ModalShopPay&&e&&re(e)&&(h||d(),l.updateUserVerification({email:e,status:"found"}),s(!0,e))}function A(){if(a===F.C1ModalShopPay&&!h)return;const u=k.current;n!=null&&u!=null&&(u.status!=="found"||a===F.C1ModalShopPay||!e)&&(n(u.email??""),l.updateUserVerification(u),i?.current?.focus()),l.userVerification.value.status==="found"?m({type:me.ContinueWithShopPay,email:l.userVerification.value.email}):i?.current?.focus(),s(!1),k.current=null}function T(u,g,w){if(!(w&&w!==l.userVerification.value.email)&&(u===Le.ShopifyPayUserNotFound&&Rt.includes(g)&&(s(!1),m({type:me.Generic})),w)){const O=g===X.InvalidEmail;l.updateUserVerification({email:w,status:O?"invalid":"new"})}}function N(u,g){u?(k.current||l.userVerification.value.email!==u)&&(k.current={email:u,status:g?"found":"new"}):k.current={status:"none"}}async function H(u){le(),M.value="none",u&&(await v({token:u,origin:a}),_(),window.location.reload())}return{onShow:I,onHidden:A,onEmailChange:N,onError:T,onLoggedIn:H}}function Ft(e){const{observability:n}=Y(),t=L(e),o=t.current,r=e===t.current?void 0:`Callback hook changed from ${t.current.name} to ${e.name} between renders.`;return P(()=>{r&&n.error(new Fe(`${r} Only the original hook is called.`,{groupingHash:"ShopPayError::OnlyOriginalHookCalled"}),{severity:"warning",errorClass:"ShopPay::ShopPayVerification::useStableHook"})},[r,n]),o}const Bt="B1y2m",Ht={VerificationIframe:Bt},$t="shop-pay-verification-iframe",Ee=320,zt=300,Wt=1e3;function Gt({email:e,onSetEmail:n,open:t,popoverActivator:o,showPopover:r,showToggle:h,urlOrigin:d=F.C1Modal,updatedOrigin:s=d,onIframeLoaded:i,automaticVerificationEnabled:a=!0}){const E=Qe({base:"blockEnd",medium:"inlineEnd"}),[p,l]=x(!1),[f,m]=x(zt),[v,_]=x(!1),{i18n:k,shopPay:c,shop:S,source:{checkoutSessionIdentifier:M}}=Y(),y=L(null),[I,A]=x(!1),{checkoutProtocolModalEventSignal:T}=ce(),N=Be(e,$e),H=`${M}-${e.replace(/[^a-zA-Z0-9]/g,"")}`,u=be().value,g=L(u),{onShow:w,onHidden:O,onError:W,onEmailChange:V,onLoggedIn:J}=Ft(c.user.isUnauthenticatedUser.value?Ot:Ut)({email:N,onSetEmail:n,skipVerifyOnLoad:g,iframeReady:p,iframeRef:y,dismissedModalKey:H,readyToDismiss:v,onReadyToDismiss:()=>{setTimeout(()=>_(!0),Wt)},showPopover:r,showToggle:h,popoverActivator:o,origin:s,open:t,automaticVerificationEnabled:a});nt({targetId:d,onReady:w,onClosed:ee,onLoggedIn:J,onHidden:O,onError:te,onResized:Z,onLoaded:()=>{l(!0),i()},onEmailChange:V}),P(()=>{K(y?.current,{action:z.OriginChanged,origin:s})},[s]),P(()=>{const D=t?z.Ready:z.Hidden;if(K(y?.current,{action:D}),T.value=t?"shopPayVerification":"none",y.current&&t&&y.current.focus(),!(!t||!S.hasFlagEnabled(He)))return()=>{T.value="none"}},[T,t,S]);const $=yt(d);if(P(()=>()=>{l(!1)},[$]),!$)return null;const j=t?o?.current:void 0;return C(Vt,{activator:j,open:t,onClose:O,placement:E,contentWidth:Ee,contentHeight:f,children:C(Xe,{active:I||!p,size:"large",children:C("iframe",{id:$t,title:k.translate("verification.title"),ref:y,src:$,height:f,width:Ee,className:Ht.VerificationIframe,allow:"publickey-credentials-get *",referrerPolicy:"origin"},$)})});function Z(D){!isNaN(D)&&D&&m(D)}function ee(){A(!0)}function te(D,G,se){W?.(D,G,se),D===Le.ShopifyPayUserNotFound&&c.setUserIdentified(null);const ne=new URL(window.location.href);G===X.LimitExceeded?ne.searchParams.set(ue,"true"):ne.searchParams.delete(ue),history.replaceState(null,"",ne.href),window.dispatchEvent(new Event("shop_pay_user_identified_cookie_set"))}}function Kt(){if(!rt())return;const e="shop-pay-safari-unzoom",n=oe.getElementById(e);if(n)return n.focus();const t=oe.createElement("input");t.id=e,t.style.fontSize="16px",t.style.width="1px",t.style.height="1px",t.style.position="fixed",t.style.bottom="-1000px",t.style.right="-1000px",t.style.transform="translate(1000px, 1000px)",t.setAttribute("aria-hidden","true"),oe.body.appendChild(t),t.focus({preventScroll:!0})}const qt=100;function Yt({emailInputSelector:e}){const[n,t]=x(),[o,r]=x();return P(()=>{function d(s){this.type==="password"?r(s.timeStamp):t(s.timeStamp)}if(e){const s=oe.querySelector(e);if(s){s.addEventListener("input",d);const i=s.form?.querySelector('input[type="password"]');return i&&i instanceof HTMLInputElement&&i.addEventListener("input",d),()=>{s.removeEventListener("input",d),i&&i.removeEventListener("input",d)}}}},[e]),{isFilledWithPasswordManager:R(()=>n===void 0||o===void 0?!1:Math.abs(n-o)<qt,[n,o])}}function Jt({email:e,emailInputSelector:n,onGetEmailInput:t,hideChange:o,iframeRef:r,shouldListen:h=!0,shouldOpenOnMatch:d=!0}){const{loaded:s,modalVisible:i}=fe(),{leaveBreadcrumb:a,notify:E}=Ae(),{trackUserAction:p}=he(),{isFilledWithPasswordManager:l}=Yt({emailInputSelector:n}),f=L(null),[m,v]=x(),[_,k]=x(),[c,S]=x(),M=L(null),y=L(""),I=R(()=>new Set,[]),A=()=>y.current,T=b(async(u,g="",w="")=>{const O=st(u);if(l&&!I.has("PASSWORD_MANAGER_AUTOFILL_DETECTED")&&(I.add("PASSWORD_MANAGER_AUTOFILL_DETECTED"),p({userAction:"PASSWORD_MANAGER_AUTOFILL_DETECTED"})),O&&!I.has("EMAIL_ENTERED")&&(I.add("EMAIL_ENTERED"),p({userAction:"EMAIL_ENTERED"})),a("email entered",{}
1,"state"),!r.current||i||!s)return;const W=O?u:"";f.current&&!f.current?.signal.aborted&&f.current.abort(),f.current=new AbortController;try{const{open:V,postMessage:J,waitForMessage:$}=r.current;y.current=W,J({firstName:g,lastName:w,type:"namesubmitted"}),J({email:W,hideChange:o===void 0?W.length>0:o,type:"emailsubmitted"}),a("email submitted",{email:W?"redacted":""},"state");const j=$("shop_user_matched",f.current.signal),Z=new Promise((ee,te)=>{const D=async()=>{try{const G=await $("error",f.current.signal);G.type==="error"&&G.code==="captcha_challenge"?ee(void 0):await D()}catch(G){te(G)}};D()});await Promise.race([j,Z]),d&&(V("event_shop_user_matched"),M?.current?.blur(),Kt()),f.current.abort(),v(void 0)}catch(V){if(V instanceof at&&V.name==="AbortSignalReceivedError")return;V instanceof Error&&E(new Error(`Error updating user info: ${V.name} - ${V.message}`))}},[o,r,l,a,s,i,E,d,p,I]),N=it((u,g,w)=>{T(u,g,w)},200);P(()=>{m!==void 0&&s&&N(m,_,c)},[N,m,s,_,c]),P(()=>{if(!n&&!t)return;const u=n?oe.querySelector(n):t?.();if(!u)return;M.current=u;const g=()=>{u&&v(u.value)};if(u?.value&&g(),!h){u?.removeEventListener("input",g);return}return u?.addEventListener("input",g),()=>{u?.removeEventListener("input",g)}},[n,t,h]),P(()=>{e!==void 0&&v(e)},[e]);const H=(u="",g="")=>{k(u),S(g)};return{getSubmittedEmail:A,updateEmailToPost:u=>v(u||""),updateNamesToPost:(u,g)=>H(u,g)}}function Qt({iframeRef:e}){const{loaded:n}=fe();async function t(o){if(!e.current)return;const{postMessage:r,waitForMessage:h}=e.current;n||await h("loaded"),r(o)}return{postMessageAfterLoad:t}}function Xt(){const{analyticsData:e,produceMonorailEvent:n}=he();return{trackShopPayModalStateChange:b(({currentState:o,zoom:r})=>{const{analyticsTraceId:h,checkoutToken:d,checkoutVersion:s,shopPermanentDomain:i}=e,a={previousState:"",currentState:o,clientTimestampMs:new Date().getTime(),analyticsTraceId:h,checkoutToken:d||"",checkoutVersion:s||"",shopifyDomain:i||"",zoom:r};n({event:{payload:a,schemaId:"shopify_pay_modal_state_change/1.3"}})},[e,n])}}function jt(e){const{checkoutToken:n,checkoutVersion:t,shopPermanentDomain:o}=e;return{checkoutVersion:t,checkoutToken:n,flow:"checkout_modal",shopPermanentDomain:o}}const Zt="e_7585671bd434a1fca2d05deff50a41ee",en="treatment",tn=({anchorTo:e,email:n,experiments:t,preventOverlayDismissOnClick:o,queueToken:r,totalDue:h,...d})=>{const{modalVisible:s}=fe(),i=L(null);Jt({email:n,iframeRef:i});const{postMessageAfterLoad:a}=Qt({iframeRef:i}),{trackUserAction:E}=he(),{leaveBreadcrumb:p}=Ae();P(()=>{const c=new URL(ye).origin,S=M=>{if(M.origin===c&&M.data?.type==="completed"&&(p("oauth completed from popup",{},"state"),typeof U<"u"&&"parent"in U&&U.parent&&U.parent!==U)){p("forwarding completion to parent window",{},"state");const I=("ancestorOrigins"in U.location?U.location.ancestorOrigins:void 0)?.[0];I&&U.parent.postMessage({type:"completed",origin:ye},I)}};return U.addEventListener("message",S),()=>{U.removeEventListener("message",S)}},[p]);const l=R(()=>({open:async()=>{s||(i.current?.open("user_button_clicked"),E({userAction:"OPEN_CALLED"}),p("open called",{},"state"))}}),[s,E,p]);pt(l);const{trackShopPayModalStateChange:f}=Xt(),m=b(()=>{f({currentState:"loaded",zoom:`${U.visualViewport?.scale}`})},[f]),v=b(c=>{f({currentState:c?"shown":"hidden",zoom:`${U.visualViewport?.scale}`})},[f]);P(()=>{if(r||h){const c={totalDue:Number(h)||0,checkoutQueueToken:r||""};a({type:"checkoutcontextsubmitted",checkoutContext:c}),r&&a({type:"checkoutqueuetokensubmitted",checkoutQueueToken:r})}},[a,r,h]);const{authorizeUrl:_}=mt({analyticsContext:"loginWithShopCheckoutModal",avoidSdkSession:!0,clientId:"",disableSignUp:!0,flow:"checkout_modal",proxy:!0,redirectType:"iframe",responseType:"code",uxMode:"iframe",...d}),k=R(()=>{if(o)return!1;
1try{return t?JSON.parse(t)[Zt]!==en:!0}catch{return!0}},[t,o]);return C(St,{anchorTo:e,dismissable:k,keepModalOpen:!0,onLoaded:m,onModalVisibleChange:v,proxy:!0,ref:i,src:_,sandbox:!0,variant:"checkoutModal",scrolling:"no"})},nn=()=>ct(({element:e,...n})=>C(ht,{element:e,featureName:"ShopCheckoutModal",children:C(ut,{children:C(dt,{monorailProps:jt(n),children:C(lt,{children:C(ft,{children:C(tn,{...n})})})})})}),{methods:["open"],name:"shop-checkout-modal",props:{anchorTo:"string",checkoutRedirectUrl:"string",checkoutToken:"string",checkoutVersion:"string",email:"string",embed:"string",experiments:"string",preventOverlayDismissOnClick:"boolean",queueToken:"string",shopId:"number",shopPermanentDomain:"string",shopifyEssential:"string",totalDue:"string",transactionParams:"string",storefrontDomain:"string"},shadow:"open"}),Q=({shopCheckoutModal:e,eventName:n,eventListener:t})=>{P(()=>(e?.addEventListener(n,t),()=>e?.removeEventListener(n,t)),[t,n,e])};typeof window<"u"&&typeof customElements<"u"&&!customElements.get("shop-checkout-modal")&&nn();function on({email:e,open:n,popoverActivator:t,popoverAnchorSelector:o,showPopover:r,showToggle:h,onIframeLoaded:d,automaticVerificationEnabled:s=!0}){const i=t?.current,a=Ve(null),[E,p]=x(!1),l=L(!1),{client:f,shop:{myshopifyDomain:m,storefrontUrl:v},shopPay:_,source:k,checkout:{wallets:c}}=Y(),{redirectUrl:S,transactionParams:M}=_.config,y=de().buyerIdentity.value?.customerProfile,{inMemoryPayPalParts:{accountStatus:I}}=Pe(),{isDismissedGuestModal:A}=Me(),T=Ie(),N=Te({element:t}),H=R(()=>T.current.token,[T]),{value:u}=ze(),{checkoutProtocolModalEventSignal:g}=ce(),w=we(Ce.ShopPayVerification,{scope:_e(k)}),O=`${k.checkoutSessionIdentifier}-${e.replace(/[^a-zA-Z0-9]/g,"")}`,W=be().value,V=L(W);P(()=>{if(V.current){V.current=!1,p(!1);return}const se=A(),ne=y&&f.cookies.get(O),Ne=I.value.status==="connected";if(se||ne||Ne){p(!1);return}if(w.value===q.Verified){w.value=void 0,p(!1);return}p(!0)},[e]);const J=b(()=>{le(),w.value=q.Verified,g.value="none"},[g,w]);Q({shopCheckoutModal:a.value,eventName:"completed",eventListener:J});const $=b(()=>{if(!k.checkoutSessionIdentifier)throw new ie({groupingHash:"ShopPayCheckoutIdentifierMissingError::ShopJSVerification"});_.setUserIdentified(escape(k.checkoutSessionIdentifier)),window.dispatchEvent(new Event("shop_pay_user_identified_cookie_set")),w.value=q.Pending,r?.(!0,e),h?.(!1)},[k.checkoutSessionIdentifier,e,_,w,r,h]);Q({shopCheckoutModal:a.value,eventName:"modalopened",eventListener:$});const j=b(()=>{w.value=q.Dismissed,y&&f.cookies.set(O,"true"),r?.(!1),h?.(l.current),p(!1),N()},[y,O,w,r,h,N,f.cookies]);Q({shopCheckoutModal:a.value,eventName:"modalclosed",eventListener:j});const Z=b(()=>{l.current=!0},[]);Q({shopCheckoutModal:a.value,eventName:"shopusermatched",eventListener:Z});const ee=b(se=>{l.current=!1,_.setUserIdentified(null),window.dispatchEvent(new Event("shop_pay_user_identified_cookie_set"))},[_]);Q({shopCheckoutModal:a.value,eventName:"shopusernotmatched",eventListener:ee}),Q({shopCheckoutModal:a.value,eventName:"loaded",eventListener:d}),P(()=>{i&&n&&(a.peek()?.open(),i.blur())},[i,e,n,a]),P(()=>{if(n)return g.value="shopPayVerification",()=>{g.value="none"}},[g,n]);const te=n||s&&E?e:"";if(!S||c.activeSession.value)return null;const D=i?.id?`input#${sn(i.id)}`:"";return C("shop-checkout-modal",{"anchor-to":o??D,"checkout-redirect-url":S,"checkout-token":k.checkoutSessionIdentifier,"checkout-version":"checkout_one",email:te,"prevent-overlay-dismiss-on-click":!0,"queue-token":H||"","total-due":u?.amount?.toString()||"0",ref:a,"shop-permanent-domain":m,"transaction-params":M,"storefront-domain":v})}const rn=e=>C(ke,{children:C(on,{...e})});function sn(e){return typeof CSS<"u"&&CSS.escape?CSS.escape(e):e}const Vn=({email:e,onSetEmail:n,open:t,popoverActivator:o,popoverAnchorSelector:r,showPopover:h,showToggle:d,urlOrigin:s=F.C1Modal,updatedOrigin:i=F.C1Modal})=>{const{shopPay:{user:{hasFlow:a}},embed:E,webMcp:p,checkout:{identity:l},observability:f}=Y(),m=l.current.value==="shopPay",v=p?.hasToolCallStarted.value??!1,_=!E&&(m||!v),k=Te({element:o});Ue(()=>{p?.hasToolCallStarted.value&&t&&!m&&(h(!1),k())});const c=R(()=>Se(),[]),S=R(()=>Se(),[]),M=L(!0),y=R(()=>({isC1:!0,shopJsVerification:!m}),[m]);P(()=>{re(e)&&(c.mark("start"),M.current=!0)},[c,e]),P(()=>{if(t&&M.current&&c.marks.start&&y){c.mark("open"),M.current=!1;const A=Math.round(c.marks.open-c.marks.start);f.histogram({name:"shop_pay_verification_time_to_interactive",value:A,attributes:y});const T=Math.round(c.marks.open-Math.max(c.marks.start,c.marks.loaded||0));f.histogram({name:"shop_pay_verification_time_to_interactive_after_load",value:T,attributes:y})}},[t,f,c,y]),P(()=>{S.mark("start")},[S]);const I=b(()=>{if(S.marks.start){S.mark("loaded"),c.mark("loaded");const A=Math.round(S.marks.loaded-S.marks.start);f.histogram({name:"shop_pay_verification_iframe_ready_duration",value:A,attributes:y})}},[S,c,f,y]);return m&&!a.value?null:m?C(Gt,{popoverActivator:o,email:e,onSetEmail:n,open:t,showPopover:h,showToggle:d,urlOrigin:s,updatedOrigin:i,onIframeLoaded:I,automaticVerificationEnabled:_}):v&&!t?null:C(rn,{popoverActivator:o,popoverAnchorSelector:r,email:e,open:t,showPopover:h,showToggle:d,onIframeLoaded:I,automaticVerificationEnabled:_})};export{Vn 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.