PageSourceSearch

https://spirithero.com/cdn/shopifycloud/checkout-web/assets/c1/component-CryptoModalManager.CsUQJ8h7.js

js spirithero.com collected 2026-09-28 08:52:11 UTC 11,352 bytes, 1 lines download raw bytes

1import{T as ie,q as i,u as e,S as ge,g as ve,e as u,f as $,h as V,i as ee,p as he}from"./esnext-vendor.B9Da21W6.js";import{bo as W,cE as D,cF as fe,cG as oe,cH as Ce,S as z,bO as xe,b7 as te,cp as ke,cI as _e}from"./addresses-is-address-empty.Bn2lNY_L.js";import{u as Se,t as O,l as we,k as C,L as ne,ai as T,B as se,G as I,ah as G,b$ as N,Z as Ee,I as Me,cB as Be,_ as Re,bu as Ie,cQ as ze,cR as Te}from"./hydrate.DZ4YTm7p.js";import{S as re,B as He}from"./hooks-useStableHostMethodsReferences.DObnt9s8.js";import{g as Pe,W as w}from"./cross-border-hooks.xPE4TSQ5.js";import{S as Ae}from"./app.DbSrjjlA.js";import"./graphql-PaymentSessionMutation.CAXCwUvV.js";import"./hooks-useShopPayExternalAppContext.DWwMuRnz.js";import"./hooks-useReplaceShopPayInHistory.DPpLejwu.js";import"./amazon-pay-useAmazonPayPaymentLine.Ju006AId.js";function Le(t){try{const o=new URL(t).pathname.split("/");return o.pop()||o.pop()}catch{return}}function We(t,r){if(t)switch(t){case"none":return"0px";case"small":return r?.small?`${r.small}px`:"4px";case"base":return r?.base?`${r.base}px`:"8px";case"large":return r?.large?`${r.large}px`:"12px";case"fullyRounded":return"36px";default:return"8px"}}function De(){const t=Se();return ie(()=>{const r=t.colors?.schemes?.scheme1,o=t.colors?.global,a=r?.base?.background??W(O.color.global.base.background),p=D({background:r?.base?.background??W(O.color.global.base.background)}),y=D({background:p}),s=fe({background:a,border:r?.base?.border}),x=o?.brand,E=r?.primaryButton?.hover?.background??D({background:o?.brand}),m=r?.primaryButton?.border?.toRgba()??"none",M=r?.base?.text??oe({background:a}),H=r?.primaryButton?.text??oe({background:x}),g=r?.base?.icon??Ce({text:M})??W(O.color.global.base.textSubdued);return{"--cb-color-background-primary":a?.toRgba(),"--cb-color-background-secondary":p?.toRgba(),"--cb-color-qr-background":void 0,"--cb-color-text-primary":M?.toRgba(),"--cb-color-link-hover":a?.toRgba(),"--cb-color-button-border-primary":m,"--cb-color-button-primary":x?.toRgba(),"--cb-color-button-primary-hover":E?.toRgba(),"--cb-color-button-primary-text":H?.toRgba(),"--cb-border-radius-button-primary":We(t.primaryButton?.cornerRadius??t.global?.cornerRadius,t.cornerRadius),"--cb-color-icon":g?.toRgba(),"--cb-color-icon-background-hover":p?.toRgba(),"--cb-color-navigation-hover":y?.toRgba(),"--cb-color-border-primary":s?.toRgba(),"--cb-color-accent-primary":o?.accent?.toRgba(),"--cb-typography-header-font-family":t.typographyPrimary?.fonts,"--cb-typography-body-font-family":t.typographySecondary?.fonts||t.typographyPrimary?.fonts}},[t])}function Oe(){const{observability:t,userEvents:r}=z(),{value:{defaultAttributes:o}}=xe();return i(({eventSubtype:a,event:p,walletId:y})=>{try{if(!o){t.log("crypto_modal_monorail_event_not_recorded","No default attributes found",{event:p,walletId:y,eventSubtype:a});return}const s=Pe({eventName:p,shopId:o?.shopId??0,defaultAttributes:o});s.payload={...s.payload,eventSubtype:a,instrumentId:y||"none_selected"},r.monorailEvent(s)}catch(s){t.log("crypto_modal_monorail_event_not_recorded",`Error recording crypto modal monorail event: ${s}`,{event:p,walletId:y,eventSubtype:a})}},[o,t,r])}const ae="363px",le="455px";class $e extends Ae{constructor(){super(...arguments),this.name="CryptoSandboxError"}}function Ge({onReload:t,onClose:r,errorType:o}){const{i18n:a}=z();return e(C,{padding:"large-500",alignItems:"center",justifyContent:"center",rowGap:"large-100",blockSize:"100%",children:[e(we,{children:o==="sandbox"?a.translate("payment.crypto_modal.error.sandbox_error"):a.translate("payment.crypto_modal.error.web_component_error")}),e(C,{alignItems:"center",justifyContent:"center",columnGap:"small-500",direction:"inline",children:a.translate("general.list_formatter.or.twoWordConnector",{firstWord:e(ne,{onClick:t,children:a.translate("payment.crypto_modal.error.refresh")}),secondWord:e(ne,{onClick:r,children:a.translate("payment.crypto_modal.error.close")})})})]})}const Ne="Fmfya",Fe={CloseButton:Ne},je="Select a wallet to connect",qe="Select your wallet to connect and pay",Ue="coinbase wallet",Ke="Pay Store X USDC",Qe=239,Xe=1,Ye=66;function Ze({onClose:t}
1){return e(ge,{children:[e(oo,{onClose:t}),e(Je,{}),e(Ve,{})]})}function Je(){return e(I,{gridAutoFlow:"column",gridTemplateColumns:`minmax(0, ${te(Qe)}) minmax(0, ${te(Xe)}) minmax(0, 1fr)`,gridTemplateRows:"minmax(0, 1fr)",maxBlockSize:"100%",display:"@media (inline-size >= small) auto, none",children:[e(C,{background:"subdued",rowGap:"none",alignItems:"start",borderRadius:"@media (inline-size >= small) none, small",children:[Array(7).fill(null).map((t,r)=>e(ce,{},r)),e(I,{padding:"small-100 base",alignItems:"center",justifyContent:"center",gridTemplateColumns:"25px 1fr",gap:"small-100",minInlineSize:"100%",minBlockSize:"60px",children:[e(G,{contentDisplay:"block",blockSize:"25px",inlineSize:"25px"}),e(C,{rowGap:"small-500",children:[e(N,{size:"extraSmall",lines:1}),e(N,{size:"extraSmall",lines:1})]})]})]}),e(Ee,{direction:"block"}),e(C,{alignItems:"center",justifyContent:"center",children:e(T,{children:qe})})]})}function Ve(){return e(C,{display:"@media (inline-size >= small) none, auto",gap:"small-200",padding:"none large-200 large-500 large-200",children:[e(T,{children:je}),e(se,{display:"auto",children:e(I,{background:"subdued",rowGap:"large",alignItems:"start",justifyContent:"space-around",gridTemplateColumns:"repeat(auto-fill, minmax(95px, calc(100% / 3)))",gridTemplateRows:"1fr",padding:"large-300 large",borderRadius:"small",children:Array(6).fill(null).map((t,r)=>e(ce,{mobile:!0},r))})})]})}function ce({mobile:t=!1}){return t?e(C,{alignItems:"center",justifyContent:"center",rowGap:"small-400",children:[e(G,{contentDisplay:"block",blockSize:"64px",inlineSize:"64px"}),e(T,{size:"small",children:Ue})]}):e(I,{padding:"small-100 base",alignItems:"center",justifyContent:"center",gridTemplateColumns:"25px 1fr",gap:"small-100",minInlineSize:"100%",children:[e(G,{contentDisplay:"block",blockSize:"25px",inlineSize:"25px"}),e(N,{lines:1})]})}function eo({onClose:t}){return e("button",{type:"button",className:ve(ke({position:"fixed",insetBlockStart:"large100",insetInlineEnd:"large200",display:"block",padding:"small400",backgroundColor:"base",transitionProperty:"colors",transitionTimingFunction:"base",transitionDuration:"base",zIndex:10}),Fe.CloseButton),onClick:t,children:e(Me,{type:"x",size:"base"})})}function oo({onClose:t}){return e(se,{padding:"@media (inline-size >= small) large-200, large-200 large-200 small-200 large-200",boxShadow:"@media (inline-size >= small) extraSmall, none",minBlockSize:`${Ye}px`,borderWidth:"@media (inline-size >= small) none none base none, none",minInlineSize:"100%",blockAlignment:"center",zIndex:"portal",children:[e(T,{children:Ke}),e(eo,{onClose:t})]})}function to({paymentLink:t}){const{i18n:r,observability:o,shop:a,url:p}=z(),y=Be(),s=a.hasFlagEnabled(_e),x=a.forceStablecoinSandboxPayments,E=De(),m=Re({small:!1,base:!0}),M=p.sandboxCrypto(),H=r.translate("payment.pay_with_payment_method",{payment_method:"crypto"}),g=u(null),P=u(void 0),A=u(!1),k=u(!1),de=$(()=>{const n=t.value;return!!(A.value&&n&&n!==P.value)}),b=u(!0),l=u(null),v=u(null),L=u(1),_=u(m?ae:le),h=u(!1),c=Oe(),d=i(()=>{h.value=!1,_.value=m?ae:le},[m,_,h]);V(()=>{A.value=!0},[A]),V(()=>{g.value&&!b.value&&(m?g.value.call.setSingleColumnLayoutAttribute():g.value.call.removeLayoutAttribute())},[g,m,b.value]);const S=i(()=>{P.value=t.value,k.value=!0,o.counter({name:"crypto_modal_cancel",value:1,attributes:{walletId:l.value}}),c({event:w.CryptoModalCancelled,walletId:l.value})},[P,k,t,o,l,c]),ue=i(()=>{k.value&&(k.value=!1,window.location.reload())},[k]),F=i(n=>{o.counter({name:"crypto_modal_render",value:1,attributes:{status:n}})},[o]),B=i(({errorMessage:n})=>o.error(new $e(n,{groupingHash:"CryptoSandboxError::reportError::SandboxError"})),[o]),pe=()=>{v.value=null,b.value=!0},me=i(async n=>{g.value=n,l.value=null,d();const f=t.value;if(!f){B({errorMessage:"No payment link provided"});return}const J=Le(f);if(!J){B({errorMessage:"Invalid payment link provided, unable to parse ID from URL"});return}const R=await n.call.configure({paymentLinkId:J,merchantBranding:E,mocked:s,sandbox:x});F(R.status),R.status!==re.Success&&(v.value="sandbox",R.status===re.Error&&B({errorMessage:R.message}))},[g,l,t,E,s,F,B,v,x,d]),j=i(n=>{o.counter({name:"crypto_modal_complete",value:1,attributes:{status:n,walletId:l.value}}),c({event:w.CryptoModalCompleted,eventSubtype:n,walletId:l.value}),y()},[y,o,l,c]),q=i(n=>{n==="wallet_select_view"&&(l.value=null,d()),o.leaveErrorBreadcrumb("[Crypto] Page navigated",{page:n})},[o,l,d]),U=i(({action:n,walletId:f})=>{n==="selected"&&(l.value=f),o.leaveErrorBreadcrumb("[Crypto] Wallet action",{action:n,walletId:f}),o.counter({name:"crypto_modal_wallet_action",value:1,attributes:{action:n,walletId:f}}),c({event:w.CryptoModalWalletAction,eventSubtype:n,walletId:f})},[o,l,c]),K=i(()=>{b.value=!1,o.counter({name:"crypto_modal_web_component_rendered",value:1}),c({event:w.CryptoModalRendered})},[o,b,c]),Q=i(n=>{n==="payment_link_callback_error"&&(d(),v.value="web_component"),o.leaveErrorBreadcrumb("[Crypto] Error occurred",{error:n}),o.counter({name:"crypto_modal_on_error",value:1,attributes:{error:n,walletId:l.value}}),c({event:w.CryptoModalError,eventSubtype:n,walletId:l.value})},[o,v,d,l,c]),X=i(n=>{o.leaveErrorBreadcrumb("[Crypto] Deeplink",{url:n}),window.location.assign(n)},[o]),Y=i(()=>{o.leaveErrorBreadcrumb("[Crypto] Reload triggered"),d(),b.value=!0,l.value=null,L.value+=1},[b,L,l,o,d]),Z=i(n=>{o.leaveErrorBreadcrumb("[Crypto] Modal height change event",{type:n.type,height:n.type==="size"?n.height:void 0}),n.type==="fullScreen"&&m?h.value=!0:n.type==="size"&&n.height?(h.value=!1,_.value=`${n.height}px`):n.type==="size"&&!n.height&&d()},[_,h,d,m,o]),be=ie(()=>({onComplete:j,onCancel:S,onDeeplink:X,onPageNavigated:q,onWalletAction:U,onWebComponentRendered:K,onWebComponentError:Q,onWebComponentReload:Y,onModalHeight
1Change:Z}),[j,S,X,q,U,K,Q,Y,Z]),ye=$(()=>b.value&&!v.value);return e(Ie,{id:"crypto-native-modal",open:de.value,closeButton:"hidden",padding:"none",blockSize:h.value?"100%":void 0,size:"550px",accessibilityLabel:r.translate("processing.action_required"),onHide:S,onAfterHide:ue,children:e("div",{style:{overflow:"hidden",width:"100%",height:h.value?"100vh":_.value,transition:h.value?"none":"height 0.25s ease-in-out"},children:[e(ee,{when:ye,children:e(Ze,{onClose:S})}),e(ee,{when:v,fallback:e(He,{sandboxUrl:M,endpointId:"crypto-coinbase",inlineStyle:{height:"100%",width:"100%",display:b.value?"none":"block"},hostMethods:be,onConnect:me,iframeTitle:H,iframeId:"crypto-iframe",iframeName:"crypto-iframe",allow:"payment; publickey-credentials-get; publickey-credentials-create; clipboard-write",sandbox:"allow-scripts allow-same-origin allow-forms allow-popups allow-top-navigation-by-user-activation"},`crypto-modal-sandbox-${L.value}`),children:e(Ge,{onReload:pe,onClose:S,errorType:v.value})})]})})}function bo(){const{checkout:t,observability:r}=z(),o=$(()=>{const a=t.latestReceipt.value;if(!(!a||!ze(a)||!Te(a.action)))return a.action.url});return he(()=>{const a=o.value;a&&r.log("crypto_modal_manager_modal_treatment_required","[CryptoModalManager] Receipt requires modal treatment",{paymentLink:a})}),e(to,{paymentLink:o})}export{bo 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.