PageSourceSearch

https://linnpower.com/cdn/shopifycloud/checkout-web/assets/c1/page-ShopPayLoginLoader.Dk9FVr_p.js

js linnpower.com collected 2026-09-29 01:27:17 UTC 26,278 bytes, 1 lines download raw bytes

1import{u as l,i as Pe,T as B,S as Ee,q as A,h as O,e as j,o as Ke,f as $,A as Y,D as je,g as re,k as we,a as $e,_ as Ye,l as Je}from"./esnext-vendor.DDpcaSqU.js";import{an as ae,T as v,bF as J,fo as Qe,fp as ce,fq as Xe,fr as Ze,D as en,fs as Ae,f6 as nn,ft as Q,a5 as le,fu as Re,f1 as ue,dg as K,f2 as tn,aA as Se,fv as on,fw as sn,fx as rn,bI as an}from"./utilities-previous.Cnwy8G2v.js";import{u as Ce,a as cn,S as ln}from"./models-ShopPayBuyerDetails.model.B8_PHLfa.js";import{u as Ie,U as un}from"./hooks-useShopPayNewSignupLoginExperiment.DrmS3FLj.js";import{L as Ue,B as q,fa as dn,fg as gn,b as hn,bn as de,f0 as Oe,e as De,ag as mn,fh as pn,fi as fn,fj as _n,f1 as oe,a4 as yn,t as x,fk as Sn,bp as He,aW as bn,k as W,aj as M,e$ as vn,bx as Ln,O as kn,Q as Pn,H as En,q as wn}from"./hydrate.BcfGVx0L.js";import{i as X,a as An}from"./helpers-isSwitchAccountBootRequest.C3tmXnb7.js";import{MobileOrderSummary as Rn}from"./component-MobileOrderSummary.BDntaiIY.js";import{c as te}from"./Section.J2ZFesxe.js";import{R as be,D as ie,c as Cn,d as In,u as Un,a as On,p as Dn,S as Hn,b as Bn}from"./utilities-publishMessage.DgMwhdOZ.js";import{R as Fn,n as Tn,i as xn,a as Mn,s as Nn}from"./hooks-useShouldRevealCustomization.djt7DCHB.js";import{g as zn}from"./ShippingMethodRateLabel.D5IEFYQ5.js";import{u as qn,S as Vn}from"./CalloutHeader.DC7jgv42.js";import"./app.DdDscdWN.js";import"./shop-pay-normalizeBuyerDetails.CDJVtFmS.js";import"./graphql-PaymentSessionMutation.C-nDEOnn.js";import"./shared-permissions.B59tuyWB.js";import"./hooks-useShopPayExternalAppContext.R6pnDxYu.js";import"./TransitionHeight.Bhh9D1te.js";import"./styles-floating-layer.module.CZ3-lUNr.js";function Gn({isShopPayExternal:e}){const n=ae();return e?null:l(Pe,{when:n,children:l(Wn,{})})}function Wn(){const{i18n:e}=v(),n=B(()=>{const o=document.referrer!=="",i=window.history&&window.history.length>1;return o||i},[]),t=()=>{window.history.back()};return n?l(q,{inlineAlignment:"center",children:l(Ue,{onClick:t,accessibilityLabel:e.translate("account_management.back"),textDecoration:"none",children:e.translate("account_management.back")})}):null}function Kn(){const{href:e,label:n,onClick:t}=dn(gn.Login);return l(Ee,{children:[l(hn,{blockSize:"large-100"}),l(q,{inlineAlignment:"center",children:l(Ue,{href:e,onClick:t,textDecoration:"none",children:n})})]})}const jn=(e,n)=>e===n||In.includes(e),$n=e=>e&&typeof e=="object"&&e.type==="redirect_url_on_complete"&&e.postSignInUrl,Yn=e=>e&&typeof e=="string"&&e.includes(ie);function Be({iframeOrigin:e,observability:n,onError:t,onLoaded:o,onLoggedIn:i,skip:r=!1}){const s=A(a=>{switch(a.action){case be.Loaded:return o?.();case be.Error:return t?.(a.message)}},[o,t]);O(()=>{if(r)return;const a=c=>{if(!jn(c.origin,e))return;const{data:u}=c;if($n(u))try{const g=new URL(u.postSignInUrl).searchParams.get("token");g&&i?.(g)}catch{t?.("shop_pay_embedded_login_url_parse_error"),n?.log("shop_pay_embedded_login_url_parse_error","Failed to parse redirect URL")}else if(Yn(u))try{const[d,...g]=u.split(ie);if(d!==Cn)return;const p=JSON.parse(g.join(ie));s(p)}catch{t?.("shop_pay_embedded_login_event_error"),n?.log("shop_pay_embedded_login_event_error","Failed to parse event")}};return window.addEventListener("message",a),()=>window.removeEventListener("message",a)},[i,n,e,t,s,r])}var I=(e=>(e.Seamless="seamless",e.OAuth="oauth",e.OAuthWithEmbeddedContext="oauthWithEmbeddedContext",e.Embedded="embedded",e))(I||{});function Z(){const{shop:e,shopPay:n,embed:t,mobileCheckoutSdk:o}=v(),i=o.enabled||t?.isCheckoutKit();return J(t?.embedder)?"embedded":t?.isFlagshipPartner||Qe(n)?"seamless":ce(n)||i&&e.hasFlagEnabled(Xe)?"embedded":i&&e.hasFlagEnabled(Ze)?"oauthWithEmbeddedContext":i?"seamless":"oauth"}function Jn(){return en()}function ge(e,n,t){return!!e?.isFlagshipPartner||t&&Ae(n)}function Qn({customProperties:e}){return e?.color?.schemes?.scheme1?.base?.background}const Xn="(prefers-color-scheme: dark)";function Zn(){const e=j(!1);return Ke(()=>{if(typeof window>"u"||typeof window.matchMedia!="function")return;const n=window.matchMedia(Xn);e.value=n.matches;const t=o=>{e.value=o.matches};if(typeof n.addEventListener=="function")return n.addEventListener("change",t),()=>n.removeEventListener("change",t)}),e}function et(){const{checkout:e}=v(),n=Zn();return $(()=>{const{customProperties:t,darkModeCustomProperties:o}=e.configuration.branding.theme,r=n.value&&o.value||t.value,s=Qn({customProperties:r});if(typeof document<"u"&&typeof window<"u"&&typeof window.getComputedStyle=="function"){const c=zn(document.body);if(Fn.test(c))return c}return s})}const nt="rgba(255, 255, 255, 1)";function Fe(){const e=et();return $(()=>{const n=Tn(e.value??nt);
1return{isDark:xn(n,"rgb(255, 255, 255)"),parentBackgroundColor:n}})}function Te(){const e=Fe();return Y(e.peek()).current}function he(e){const n=Y("");return!n.current&&nn(e)&&(n.current=e),n.current}const xe=(e="")=>{const{client:n,shopPay:t,environment:o,i18n:{locale:i},shop:r,source:{checkoutSessionIdentifier:s},embed:a,checkout:{proposal:{proposed:c}}}=v(),u=r.hasFlagEnabled(Q),d=ge(a,t,u),g=he(c.email.value),p=u?g:c.email.value,f=X(n.initialRequest.url),S=le().buyerIdentity.value?.customerProfile,y=t.signup.skipAutomaticLoginAttempt.value,m=de({include:{shopId:!0}}),{parentBackgroundColor:k,isDark:E}=Te();return B(()=>{if(!s)return{origin:"c1_login",frameUrl:"",flow:"pay_checkout_login"};const{origin:_,flowVersion:L}=tt(t),P=new URLSearchParams(n.initialRequest.url.search),h=new URLSearchParams;h.set("locale",i),h.set("analytics_trace_id",e),h.set("origin",_),h.set("checkout_token",s),h.set("flow","pay_checkout_login"),h.set("flow_version",L??""),h.set("authentication_level","phone"),h.set("target_origin",window.location.origin),h.set("storefront_domain",r.domain),h.set("layout","full"),E&&h.set("theme","dark"),k&&h.set("parent_background_color",k),f&&(h.set("force_authentication","true"),h.set("prompt","login"));const w=P.get("login_hint");
1w?h.set("login_hint",w):d&&p&&!f&&!y?h.set("login_hint",p):!y&&S?.email&&h.set("login_hint",S.email);const U=P.get("shop_client_uuid")??a?.shopClientUuid??P.get("client_uuid");U&&h.set("client_uuid",U),m(h,P);const C=new URL("/accounts/login/embedded",o.services.shopServer.url);return C.search=h.toString(),{origin:_,frameUrl:C.href,flow:"pay_checkout_login"}},[e,E,k,s,n.initialRequest.url.search,S?.email,o.services.shopServer.url,f,i,a?.shopClientUuid,m,r.domain,p,t,y,d])};function tt(e){return ce(e)?{origin:Oe.PaymentRequest,flowVersion:"iframe"}:{origin:"c1_login",flowVersion:"iframe"}}function me({analyticsTraceId:e,loginData:n}){const{progress:t}=De(),{shopPay:o,observability:i}=v(),{config:r,updateAccessToken:s}=o,{log:a}=mn(),{exchangeSessionTokenForCookie:c}=Un(),{extendBuyerIdentity:u}=On(),{checkoutAsGuestUrl:d}=r,{replaceShopPayInHistory:g}=Re(),{flow:p,origin:f}=n;return A(async(S,y)=>{if(a("ecp_spi_debug_login_succeeded","Shop Pay login frame onLoggedIn fired",{source:f,flow:p,hasShopPayAccessToken:!!y,hasSessionToken:!!S}),y)s(y);else if(S){const m=await c({token:S,origin:f,analytics_trace_id:e,flow:p});a("ecp_spi_debug_session_exchange","Session token exchange completed",{ok:m.ok,status:m.status,origin:f,flow:p}),m.ok||(i.log("shop_pay_login_frame_session_token_exchange_failed","exchangeSessionTokenForCookie request failed",{status:m.status}),m.status>=500&&g(d))}await u(),o.signup.unstable_setSkipAutomaticLoginAttempt(!1),t("shop-pay-login-success")},[t,s,c,f,p,e,u,d,g,i,o.signup,a])}function ot({frameUrl:e,loginVariant:n,sdkLoginHintFlagEnabled:t,shopPaySdkCheckout:o}){const{checkout:i,client:r,observability:s}=v(),a=!!e,c=it(e),u=!!i.proposal.proposed.email.value,d=new URLSearchParams(r.initialRequest.url.search).has("login_hint");O(()=>{a&&s.counter({name:"shop_pay_login_hint",value:1,attributes:{checkoutUrlHint:d,loginHintSent:c,loginVariant:n,proposedEmailAvailable:u,sdkLoginHintFlagEnabled:t,shopPaySdkCheckout:o}})},[d,a,c,n,s,u,t,o])}function it(e){try{return new URL(e).searchParams.has("login_hint")}catch{return!1}}const st="_5Z70J",rt="vUvXb",at="K7GTB",ct="WC8Ph",lt="oX06g",N={LoginIframe:st,LoginIframeHidden:rt,ShopPayLoginFrameLoadingContainer:at,ShopPayLoginFrameLoadingContainerLoading:ct,ShopPayLoginFrameSkeleton:lt},ut=je(function({title:n,src:t,height:o,hidden:i=!1,onLoad:r,className:s,allow:a=dt()},c){return l("iframe",{ref:c,id:fn,title:n,src:t,onLoad:r,height:o,width:pn,className:re(N.LoginIframe,{[N.LoginIframeHidden]:i},s),"aria-hidden":i?!0:void 0,allow:a})});function dt(){return _n}function ee({hidden:e=!1,iframeLoaded:n=!1,loginData:t,onIframeLoad:o,renderListeners:i,serverDrivenAuth:r,serverRenderedIframe:s=!1}){const a=j(!1),{client:c,environment:u,i18n:d,observability:g,shop:p,shopPay:f}=v(),S=Y(null),y=Z(),{frameUrl:m}=t,k=!!m,E=!(n||a.value);Ce(E);const _=B(()=>{try{return new URL(m).origin}catch{return""}},[m]),L=Ae(f);let P="empty";_===u.services.shopServer.url?P="shop_server":_===u.services.payShopifyCom.url?P="pay_shopify":_&&(P="merchant_storefront"),ot({frameUrl:m,loginVariant:y,sdkLoginHintFlagEnabled:p.hasFlagEnabled(Q),shopPaySdkCheckout:L});const h={serverDrivenAuth:r,hidden:e,shopPaySdkCheckout:L,serverRendered:c.initialRequest.isServerRendered,serverRenderedIframe:s,loginVariant:y};oe({enabled:k&&E,onTimeout:R=>{const b={timeout:R,...h,frameHostKind:P,documentReadyState:document.readyState};g.counter({name:"shop_pay_login_frame_load_timeout",value:1,exportImmediately:!0,attributes:b}),g.log("shop_pay_login_frame_load_timeout","Shop Pay login iframe never fired its load event",{...b,iframeOrigin:_},{exportImmediately:!0})}}),oe({enabled:!k,onTimeout:R=>{const b={timeout:R,...h,documentReadyState:document.readyState};g.counter({name:"shop_pay_login_frame_url_missing",value:1,exportImmediately:!0,attributes:b}),g.log("shop_pay_login_frame_url_missing","Shop Pay login frame never received a URL",b,{exportImmediately:!0})}});const w=r?370:250,[U,C]=we(w),D=A(R=>{C(R)},[]),F=A(()=>{a.value=!0,o?.()},[a,o]);return m?l(Ee,{children:[i?.({iframeOrigin:_,iframeRef:S,onResized:D}),l(ut,{ref:S,title:d.translate("verification.title"),src:m,onLoad:F,height:U,hidden:e})]}):null}function Me({iFrameRef:e,iframeOrigin:n,isEmbeddedShopPayTheme:t=!1}){const o=yn(),i=Fe(),r=t&&n?n:window.location.origin,s=A(()=>{if(!e.current?.contentWindow)return;
1const{isDark:c,parentBackgroundColor:u}=i.value,d={theme:c?"dark":"light",type:"theme"};u&&(d.parentBackgroundColor=u),e.current.contentWindow.postMessage(d,r)},[e,i,r]),a=A(()=>{if(!e.current?.contentWindow)return;const c=ht(o.customProperties.value);mt(c,o,t),e.current.contentWindow.postMessage({type:"style",style:pt(c)},r)},[e,o,r,t]);return{dispatchThemeMessage:s,dispatchStyleMessage:a,resolvedParentBackground:i}}const gt=e=>["borderRadius","control"].includes(e);function Ne(e,n){const t=Object.entries(e).flatMap(([o,i])=>typeof i=="object"&&!Array.isArray(i)&&i!=null?n[o]?Object.entries(Ne(i,n[o])):[]:n[o]!=null&&i!=null?[[n[o],i]]:[]);return Object.fromEntries(t)}function ht(e){const n=Object.fromEntries(Object.entries(e).filter(([t])=>gt(t)));return Ne(n,K)}function mt(e,n,t){const o=ue(),i=K.borderRadius.base,r=K.borderRadius.large,s=K.control.borderRadius,a=g=>o||!e[g],c=n.configuration.cornerRadius.base?`${n.configuration.cornerRadius.base}px`:x.borderRadius.base,u=n.configuration.primaryButton.cornerRadius;let d=x.borderRadius.base;u==="none"?d="0px":u&&(d=x.borderRadius[u]??x.borderRadius.base),a(i)&&(e[i]=c),t?e[r]=x.borderRadius.base:a(r)&&(e[r]=d),e[s]||(e[s]=x.borderRadius.base)}const pt=e=>Object.entries(e).map(([n,t])=>`${n}: ${t};`).join("");function ze({iframeRef:e,iframeOrigin:n,onLoggedIn:t}){const{checkout:o,observability:i}=v(),{isEmbeddedShopPayTheme:r}=o.configuration.branding,{dispatchThemeMessage:s,dispatchStyleMessage:a,resolvedParentBackground:c}=Me({iFrameRef:e,iframeOrigin:n,isEmbeddedShopPayTheme:r}),u=c.value,d=A(()=>{s(),a()},[s,a]);return O(()=>{s()},[s,u]),Be({iframeOrigin:n,observability:i,onLoaded:d,onLoggedIn:t}),null}function ft({analyticsTraceId:e,...n}){const t=xe(e),o=me({analyticsTraceId:e,loginData:t});return l(ee,{...n,loginData:t,renderListeners:({iframeOrigin:i,iframeRef:r})=>l(ze,{iframeRef:r,iframeOrigin:i,onLoggedIn:o}),serverDrivenAuth:!0})}function _t(){const e=new Uint8Array(16);return crypto.getRandomValues(e),Array.from(e,n=>n.toString(36)).join("")}const pe="c1_login",fe="pay_checkout_login";function ve(){return{origin:pe,frameUrl:"",flow:fe}}function yt(e,{analyticsTraceId:n,checkoutSessionIdentifier:t,domain:o,locale:i,oAuthState:r,sourceId:s}){e.set("client_id",""),e.set("redirect_uri",`https://${o}/services/login_with_shop/callback`),e.set("scope","openid email profile"),e.set("response_type","code"),e.set("state",r),e.set("storefront_domain",o),e.set("locale",i),e.set("analytics_trace_id",n),e.set("origin",pe),e.set("checkout_token",t),e.set("checkout_source_id",s),e.set("flow",fe),e.set("target_origin",`https://${o}`),e.set("ux_mode","iframe"),e.set("layout","full")}function St(e,n){return e.get("shop_client_uuid")??n??e.get("client_uuid")}function qe(e="",{includeEmbeddedContext:n=!1}={}){const{client:t,embed:o,shopPay:i,i18n:{locale:r},shop:s,source:{checkoutSessionIdentifier:a,sourceId:c},checkout:{proposal:{proposed:u}}}=v(),{config:d,signup:g}=i,p=s.hasFlagEnabled(Q),f=he(u.email.value),S=p?f:u.email.value,y=ge(o,i,p),m=X(t.initialRequest.url),k=le().buyerIdentity.value?.customerProfile,E=Sn(),_=g.skipAutomaticLoginAttempt.value,{redirectUrl:L}=d,P=de({include:{shopId:!0}}),{parentBackgroundColor:h,isDark:w}=Te(),U=n?P:void 0,C=n?o?.shopClientUuid:void 0,D=n?void 0:E,F=t.unstable_getSerialization("shopPayLoginOAuthState"),R=B(()=>F??_t(),[F]);return B(()=>{if(!a)return ve();const b=new URLSearchParams;yt(b,{analyticsTraceId:e,checkoutSessionIdentifier:a,domain:s.domain,locale:r,oAuthState:R,sourceId:c}),D!==void 0&&b.set("shop_id",String(D)),w&&b.set("theme","dark"),h&&b.set("parent_background_color",h),L&&b.set("checkout_redirect_url",L),m&&(b.set("force_authentication","true"),b.set("prompt","login")),d.transactionParams&&b.set("transaction_params",d.transactionParams);const z=new URLSearchParams(t.initialRequest.url.search),V=z.get("login_hint");V?b.set("login_hint",V):y&&S&&!m&&!_?b.set("login_hint",S):!_&&k?.email&&b.set("login_hint",k.email);const G=St(z,C);G&&b.set("client_uuid",G),U?.(b,z);try{const T=new URL("/services/login_with_shop/authorize",`https://${s.domain}`);
1return T.search=b.toString(),{origin:pe,frameUrl:T.href,flow:fe}}catch{return ve()}},[d.transactionParams,e,U,a,t.initialRequest.url.search,y,k?.email,s.domain,C,m,S,w,h,r,D,L,_,R,c])}const Ve=(e="")=>qe(e,{includeEmbeddedContext:!0});function bt({analyticsTraceId:e,...n}){const t=Ve(e),o=me({analyticsTraceId:e,loginData:t});return l(ee,{...n,loginData:t,renderListeners:({iframeOrigin:i,iframeRef:r})=>l(ze,{iframeRef:r,iframeOrigin:i,onLoggedIn:o}),serverDrivenAuth:!0})}const Ge=(e="")=>qe(e);function vt({iframeRef:e}){const{checkout:n,environment:t,observability:o,router:i,source:r}=v(),{replaceShopPayInHistory:s}=Re(),a=new URL(t.services.shopServer.url).origin,c=r.checkoutSessionIdentifier,u=Y(!1);return O(()=>{const d=({data:g,origin:p,source:f})=>{if(u.current||p!==a||!e.current?.contentWindow||f!==e.current.contentWindow||!g||typeof g!="object"||!("type"in g)||g.type!=="pay_guest_session_ready")return;const y=new URL(window.location.href);An(y.pathname)&&(u.current=!0,o.counter({name:"guest_handoff_received",value:1,exportImmediately:!0,requiresKeepalive:!0}),o.log("guest_handoff_received","Shop Pay guest handoff received",{checkoutToken:c},{exportImmediately:!0,requiresKeepalive:!0}),y.pathname=i.resolve("/shoppay").pathname,n.unstable_setRedirectingExternally(!0),setTimeout(()=>s(y.toString()),0))};return window.addEventListener("message",d),()=>window.removeEventListener("message",d)},[n,c,e,o,s,i,a]),null}function Lt({analyticsTraceId:e,hidden:n,iframeLoaded:t,onIframeLoad:o,serverRenderedIframe:i}){const r=Ge(e);return l(ee,{hidden:n,iframeLoaded:t,loginData:r,onIframeLoad:o,renderListeners:({iframeRef:s})=>l(vt,{iframeRef:s}),serverDrivenAuth:!0,serverRenderedIframe:i})}var se=(e=>(e.Partner="sdk_partner",e.Merchant="sdk_merchant",e))(se||{});const kt="c1_login",We=(e="")=>{const{client:n,shopPay:t,embed:o,environment:i,i18n:{locale:r},observability:s,shop:a,source:{checkoutSessionIdentifier:c},mobileCheckoutSdk:u,checkout:{proposal:{proposed:d}}}=v(),g=a.hasFlagEnabled(Q),p=he(d.email.value),f=g?p:d.email.value,{config:S}=t,y=X(n.initialRequest.url),{transactionParams:m,tokens:k}=S,E=le().buyerIdentity.value?.customerProfile,_=He().value,L=Mn(),P=Ie(),h=i.services.payShopifyCom.url,w=n.unstable_getSerialization("shopClientUuid"),U=de({include:{shopId:!0}}),C=!!o?.isFlagshipPartner,D=ge(o,t,g),F=o?.shopClientUuid,R=t.signup.skipAutomaticLoginAttempt.value;return B(()=>{if(!c)throw new tn({groupingHash:"ShopPayCheckoutIdentifierMissingError::LoginFrame"});const{origin:b,flowVersion:z,flow:V}=Pt(t),G=z??(C?"iframe":void 0),T=new URLSearchParams(n.initialRequest.url.search),ne=Le(T,"shop_client_uuid")??F??Le(T,"client_uuid")??w;C&&!ne&&s.log("shop_pay_login_seamless_missing_client_uuid","[ShopPayLoginFrame] Embedded checkout missing shop_client_uuid for Login Seamless.");const H=new URLSearchParams({flow:V??"",locale:r,origin:b,isPointOfSale:String(_),transaction_params:m??"",flow_version:G??"",shopify_domain:a.myshopifyDomain,checkout_token:c,analytics_trace_id:e,shop_pay_button_variant:t.logoBrand,shop_pay_new_signup_login_variant:P});ne&&H.set("client_uuid",ne);const _e=T.get("login_hint");_e?H.set("login_hint",_e):D&&f&&!y&&!R&&H.set("login_hint",f),!R&&E?.email&&H.set("storefront_account_email",E.email),L&&H.set(Nn,u.variant.isPartner()?se.Partner:se.Merchant),y||H.set("authorization",k.authorization??""),U(H,T);const ye=new URL("/pay/authentication/login-seamless",h);return ye.search=H.toString(),{origin:b,frameUrl:ye.href}},[e,U,n.initialRequest.url.search,k,c,E?.email,y,h,L,C,_,r,a.myshopifyDomain,u,F,f,w,t,P,D,R,s,m])};function Le(e,n){return e.get(n)||void 0}function Pt(e){return ce(e)?{origin:Oe.PaymentRequest,flowVersion:e.flowVersion,flow:"payment_request"}:{origin:kt,flowVersion:void 0,flow:void 0}}function Et({iframeRef:e,iframeOrigin:n,onLoggedIn:t,onResized:o}){const{checkout:i,shopPay:r}=v(),{isEmbeddedShopPayTheme:s}=i.configuration.branding,{dispatchThemeMessage:a,dispatchStyleMessage:c,resolvedParentBackground:u}=Me({iFrameRef:e,iframeOrigin:n,isEmbeddedShopPayTheme:s}),d=u.value,g=A(()=>{Dn(e.current,{action:Hn.Ready}),e.current?.contentDocument?.body&&bn(e.current.contentDocument.body)?.focu
1s(),s&&(a(),c())},[a,c,e,s]);O(()=>{s&&a()},[a,s,d]);const p=A(f=>{r.signup.unstable_setHcaptchaToken(f)},[r.signup]);return Bn({onLoaded:g,onLoggedIn:t,onResized:o,onShareCaptchaToken:p}),null}function wt({analyticsTraceId:e,...n}){const t=We(e),o=me({analyticsTraceId:e,loginData:t});return l(ee,{...n,loginData:t,renderListeners:({iframeOrigin:i,iframeRef:r,onResized:s})=>l(Et,{iframeRef:r,iframeOrigin:i,onLoggedIn:o,onResized:s}),serverDrivenAuth:!1})}function At({serverRenderedIframe:e,...n}){const{client:t}=v(),o=Z(),i=t.unstable_getSerialization("shopPayLoginAnalyticsTraceId"),r=B(()=>i??Jn(),[i]);switch(o){case I.OAuth:return l(Lt,{...n,analyticsTraceId:r,serverRenderedIframe:e});case I.OAuthWithEmbeddedContext:return l(bt,{...n,analyticsTraceId:r});case I.Embedded:return l(ft,{...n,analyticsTraceId:r});case I.Seamless:return l(wt,{...n,analyticsTraceId:r});default:return $e(o)}}function ke({className:e}){const{i18n:n}=v(),t=n.translate("general.loading");return l(q,{accessibilityRole:"status",accessibilityLabel:t,"aria-live":"polite",className:e,children:l(W,{blockSize:"100%",padding:"large-200",gap:"large-100",children:[l(W,{alignItems:"center",gap:"large-100",children:[l(M,{delay:!1,contentDisplay:"block",inlineSize:"92px",blockSize:"32px"}),l(M,{delay:!1,contentDisplay:"block",inlineSize:"50%",blockSize:"16px"})]}),l(W,{gap:"small-400",children:l(M,{delay:!1,contentDisplay:"block",inlineSize:"100%",blockSize:"52px"})}),l(M,{delay:!1,contentDisplay:"block",inlineSize:"100%",blockSize:"52px"}),l(q,{paddingBlockStart:"large-200",children:l(W,{alignItems:"center",gap:"large-400",children:[l(M,{delay:!1,contentDisplay:"block",inlineSize:"34%",blockSize:"14px"}),l(M,{delay:!1,contentDisplay:"block",inlineSize:"100%",blockSize:"14px"})]})})]})})}function Rt({serverRenderedIframe:e=!1}={}){const{client:n,environment:t,observability:o}=v(),i=t.services.shopServer.url,r=n.unstable_legacyNavigationPerformance,s=ae(),a=j(!1),c=j(e&&!s.peek()),u=c.value,d=s.value||u,g=a.value,p=!g,f=r?.navigationStartTime??0,S=n.initialRequest.isServerRendered,y=A((_,L)=>{o.histogram({name:"shop_pay_login_form_visible_duration",value:Math.round(_-f),unit:"ms",attributes:{serverRendered:S,serverRenderedIframe:c.value,revealSource:L}})},[f,o,S,c]),m=A((_,L=performance.now())=>{a.value||(a.value=!0,y(L,_))},[a,y]),k=A(()=>{m("iframe_load")},[m]),E=A(()=>{m("login_message")},[m]);return Be({iframeOrigin:i,observability:o,onLoaded:E,skip:!d}),Ye(()=>{if(!u||!s.value)return;const _=()=>{m("page_load_fallback")};if(document.readyState==="complete"){_();return}return window.addEventListener("load",_,{once:!0}),()=>{window.removeEventListener("load",_)}},[s.value,u,m]),d?l("div",{className:re(N.ShopPayLoginFrameLoadingContainer,{[N.ShopPayLoginFrameLoadingContainerLoading]:p}),children:[p&&l(ke,{className:N.ShopPayLoginFrameSkeleton}),l(At,{hidden:!g,iframeLoaded:a.value,onIframeLoad:k,serverRenderedIframe:u})]}):l(ke,{className:N.ShopPayLoginFrameSkeleton})}const Ct="UC_LOGIN_REQUIRED";function It(e,n){!e||!J(e.embedder)||e.client?.error({code:Ct,message:JSON.stringify(n),severity:"recoverable",timestamp:Date.now()})}function Ut(e=""){const n=We(e),t=xe(e),o=Ge(e),i=Ve(e),r={seamless:n,embedded:t,oauth:o,oauthWithEmbeddedContext:i},s=Z(),{serverDrivenAuth:a,variant:c}=Ot(s),{frameUrl:u,origin:d,flow:g}=r[c],p=B(()=>{try{return new URL(u).origin}catch{return""}},[u]);return{flow:g,iframeOrigin:p,serverDrivenAuth:a,source:d,iframeUrl:u,variant:c}}const Ot=e=>{switch(e){case I.OAuth:return{serverDrivenAuth:!0,variant:"oauth"};case I.OAuthWithEmbeddedContext:return{serverDrivenAuth:!0,variant:"oauthWithEmbeddedContext"};case I.Embedded:return{serverDrivenAuth:!0,variant:"embedded"};case I.Seamless:default:return{serverDrivenAuth:!1,variant:"seamless"}}};function Dt(){const e=ae(),{embed:n}=v();return J(n?.embedder)?l(Pe,{when:e,children:l(Ht,{})}):null}function Ht(){const{observability:e,source:n,embed:t,environment:o,url:i,shop:r}=v(),{iframeUrl:s,source:a}=Ut(),c=t?.client?.embedderHostname;return O(()=>{if(!J(t?.embedder)||!s||!c)return;const u=new URL(s);u.searchParams.set("target_origin",`https://${c}`),It(t,{loginUrl:u.href,exchangeUrl:new URL(i.shopPaySession(),o.services.shopServer.url).href,origin:a,shopifyDomain:r.mysh
1opifyDomain,checkoutToken:n.checkoutSessionIdentifier??void 0}),e.counter({name:"universal_checkout_shop_pay_login_required_emitted",value:1})},[t,c,s,a,o.services.shopServer.url,i,r.myshopifyDomain,n.checkoutSessionIdentifier,e]),null}function Bt(){const{client:e,userEvents:n,source:t,checkout:o,shop:i,shopPay:r}=v(),{redirectSource:s,tracking:a}=r.config,{checkoutSessionIdentifier:c="checkout_identifier_undefined"}=t,u=vn(on.SHOP_PAY_LOGIN),d=He().value;qn({stage:Vn.Complete,id:"ShopPayLogin"}),O(()=>{ue()&&n.monorailEvent({schemaId:"shop_app_page_load/9.0",payload:{...Se(t,o,i),platform:"web",locale:navigator.language,userToken:a.unique??e.cookies.get("_shopify_y")??"",webSessionToken:a.visit??e.cookies.get("_shopify_s")??"",pageType:"pay_checkout_login",pageValue:c}}),n.monorailEvent({schemaId:"shopify_pay_page_load/2.6",payload:{...Se(t,o,i),pageType:"checkout_login",clientTimestampMs:Date.now(),redirectSource:s}}),d&&n.monorailEvent({schemaId:"retail_shop_pay/2.0",payload:u})},[e.cookies,n,t,o,i,s,u,d,c,a.unique,a.visit])}const Ft="oSdnC",Tt={ShopPayLogin:Ft};function xt(){Bt();const{client:e,router:n,shop:t,source:o,shopPay:i}=v(),r=o.type==="shopPayExternal",s=Z(),a=s===I.Seamless,c=n.currentUrl.value,d=c.href===e.initialRequest.url.href&&e.initialRequest.isServerRendered&&s===I.OAuth,{isAppLayout:g}=Ln(),p=t.hasFlagEnabled(sn)&&!r&&!g&&!ue(c.search)&&!i.config.isReferral&&!c.searchParams.has(rn)&&e.unstable_getSerialization("shopPayConfig").has_remember_me_cookie===!0&&i.visibility.showCheckoutAsGuestFeature;return l("div",{children:[l(Dt,{}),l(te,{padding:"none",dividerDisplay:"@media (inline-size >= medium) none, auto",children:l(q,{padding:"@media (inline-size >= small) none none large-300 none, none",maxInlineSize:"@media (inline-size >= small) 425px, 432px",className:re(Tt.ShopPayLogin),children:l(te,{padding:"none",borderWidth:a?"@media (inline-size >= small) base, none":void 0,borderRadius:a?"@media (inline-size >= small) base, none":void 0,hideDivider:!0,children:l(Rt,{serverRenderedIframe:d})})})}),i.visibility.showUnauthedOrderSummary&&l(kn,{section:"summary",children:l(Pn,{section:"summary",children:l(En,{above:"small",children:l(te,{hideDivider:!0,padding:"none none large-200 none",children:l(Rn,{})})})})}),p?l(Kn,{}):l(Gn,{isShopPayExternal:r})]})}function io(){const{client:e,observability:n,shopPay:t}=v(),{shouldUseAccessToken:o,user:i}=t,r=X(e.initialRequest.url),s=Ie(),a=s?un.includes(s):!1,c=Je(s),u=wn(),d=$(()=>u.value.currentDetour?.type==="shopPayLogin"),g=cn(),p=$(()=>g()),f=t.accessToken.value,{refetch:S}=an(ln,{isOnShopPayLoginDetour:d,newSignupLoginVariant:c,simulatedBuyerDetails:p}),[y,m]=we(!1),k=o?!!f:!0,E=i.email.value,_=a&&!r||!!(y&&E&&k),L=s==null||_;Ce(L);const P=e.unstable_legacyNavigationPerformance,{progress:h}=De();return O(()=>{const w=t.session.initialization.peek();w.status==="failed"&&w.reason==="fetch"&&t.session.unstable_setInitialization({status:"pending"})},[t.session]),O(()=>{f&&(r||(S(),m(!0)))},[f,r,S]),O(()=>{_&&(P?.usable(),h("shop-pay-login-loader-complete"))},[_,P,h]),oe({enabled:L,onTimeout:w=>{n.counter({name:"shop_pay_login_loader_loading_timeout",value:1}),n.log("shop_pay_login_loader_loading_timeout","ShopPayLoginLoader loading timeout",{timeout:w,variant:s,isUnauthenticatedVariant:a})}}),L?null:l(xt,{})}export{io 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.