1import{T as e,q as a,u as o,S as r,m as n,o as t,k as l,h as i,w as c,p as s}from"./2c1ab0fe.RaLGJvq2.js";import{aX as d,cj as u,ck as p,cl as m,cm as b,a as y,aI as g,aQ as v,v as h,cn as f}from"./f67abd2c.BTHhdhoM.js";import{J as x,X as k,i as w,S as _,L as C,E as S,b as I,aa as R,at as z,ce as j,ai as E,a0 as B,cN as M,o as A,M as W,c$ as L,d0 as T}from"./164ad2e3.bPUx3Fg0.js";import{S as D,B as $}from"./ee2bb050.Cl9T4Znf.js";import{g as N,W as P}from"./78ab3dd0.DVuP3OIA.js";import{S as G}from"./app.CPIYcwpp.js";import"./d0bb51ec.BIqtCEEY.js";import"./60a453ce.BHWO3gHr.js";import"./e12db40c.CeuzD2R-.js";import"./9dba8418.DCzpk36x.js";import"./17e57de1.BQ0yd3rN.js";import"./ca3e798e.BWruLT5k.js";function q(e,a){if(e)switch(e){case"none":return"0px";case"small":return a?.small?`${a.small}px`:"4px";case"base":return a?.base?`${a.base}px`:"8px";case"large":return a?.large?`${a.large}px`:"12px";case"fullyRounded":return"36px";default:return"8px"}}const F="363px",H="455px";class U extends G{constructor(){super(...arguments),this.name="CryptoSandboxError"}}function X({onReload:e,onClose:a,errorType:r}){const{i18n:n}=y();return o(_,{padding:"large-500",alignItems:"center",justifyContent:"center",rowGap:"large-100",blockSize:"100%",children:[o(w,{children:"sandbox"===r?n.translate("payment.crypto_modal.error.sandbox_error"):n.translate("payment.crypto_modal.error.web_component_error")}),o(_,{alignItems:"center",justifyContent:"center",columnGap:"small-500",direction:"inline",children:n.translate("general.list_formatter.or.twoWordConnector",{firstWord:o(C,{onClick:e,children:n.translate("payment.crypto_modal.error.refresh")}),secondWord:o(C,{onClick:a,children:n.translate("payment.crypto_modal.error.close")})})})]})}function J({onClose:e}){return o(r,{children:[o(Y,{onClose:e}),o(Q,{}),o(K,{})]})}function Q(){return o(R,{gridAutoFlow:"column",gridTemplateColumns:`minmax(0, ${v(239)}) minmax(0, ${v(1)}) minmax(0, 1fr)`,gridTemplateRows:"minmax(0, 1fr)",maxBlockSize:"100%",display:"@media (inline-size >= small) auto, none",children:[o(_,{background:"subdued",rowGap:"none",alignItems:"start",borderRadius:"@media (inline-size >= small) none, small",children:[Array(7).fill(null).map((e,a)=>o(O,{},a)),o(R,{padding:"small-100 base",alignItems:"center",justifyContent:"center",gridTemplateColumns:"25px 1fr",gap:"small-100",minInlineSize:"100%",minBlockSize:"60px",children:[o(z,{contentDisplay:"block",blockSize:"25px",inlineSize:"25px"}),o(_,{rowGap:"small-500",children:[o(j,{size:"extraSmall",lines:1}),o(j,{size:"extraSmall",lines:1})]})]})]}),o(E,{direction:"block"}),o(_,{alignItems:"center",justifyContent:"center",children:o(S,{children:"Select your wallet to connect and pay"})})]})}function K(){return o(_,{display:"@media (inline-size >= small) none, auto",gap:"small-200",padding:"none large-200 large-500 large-200",children:[o(S,{children:"Select a wallet to connect"}),o(I,{display:"auto",children:o(R,{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((e,a)=>o(O,{mobile:!0},a))})})]})}function O({mobile:e=!1}){return e?o(_,{alignItems:"center",justifyContent:"center",rowGap:"small-400",children:[o(z,{contentDisplay:"block",blockSize:"64px",inlineSize:"64px"}),o(S,{size:"small",children:"coinbase wallet"})]}):o(R,{padding:"small-100 base",alignItems:"center",justifyContent:"center",gridTemplateColumns:"25px 1fr",gap:"small-100",minInlineSize:"100%",children:[o(z,{contentDisplay:"block",blockSize:"25px",inlineSize:"25px"}),o(j,{lines:1})]})}function V({onClose:e}){return o("button",{type:"button",className:n(h({position:"fixed",insetBlockStart:"large100",insetInlineEnd:"large200",display:"block",padding:"small400",backgroundColor:"base",transitionProperty:"colors",transitionTimingFunction:"base",transitionDuration:"base",zIndex:10}),"Fmfya"),onClick:e,children:o(B,{type:"x",size:"base"})})}function Y({onClose:e}){return o(I,{padding:"@media (inline-size >
1= small) large-200, large-200 large-200 small-200 large-200",boxShadow:"@media (inline-size >= small) extraSmall, none",minBlockSize:"66px",borderWidth:"@media (inline-size >= small) none none base none, none",minInlineSize:"100%",blockAlignment:"center",zIndex:"portal",children:[o(S,{children:"Pay Store X USDC"}),o(V,{onClose:e})]})}function Z({paymentLink:r}){const{i18n:n,observability:s,shop:v,url:h}=y(),w=M(),_=v.hasFlagEnabled(f),C=v.forceStablecoinSandboxPayments,S=function(){const a=x();return e(()=>{const e=a.colors?.schemes?.scheme1,o=a.colors?.global,r=e?.base?.background??d(k.color.global.base.background),n=u({background:e?.base?.background??d(k.color.global.base.background)}),t=u({background:n}),l=p({background:r,border:e?.base?.border}),i=o?.brand,c=e?.primaryButton?.hover?.background??u({background:o?.brand}),s=e?.primaryButton?.border?.toRgba()??"none",y=e?.base?.text??m({background:r}),g=e?.primaryButton?.text??m({background:i}),v=e?.base?.icon??b({text:y})??d(k.color.global.base.textSubdued);return{"--cb-color-background-primary":r?.toRgba(),"--cb-color-background-secondary":n?.toRgba(),"--cb-color-qr-background":void 0,"--cb-color-text-primary":y?.toRgba(),"--cb-color-link-hover":r?.toRgba(),"--cb-color-button-border-primary":s,"--cb-color-button-primary":i?.toRgba(),"--cb-color-button-primary-hover":c?.toRgba(),"--cb-color-button-primary-text":g?.toRgba(),"--cb-border-radius-button-primary":q(a.primaryButton?.cornerRadius??a.global?.cornerRadius,a.cornerRadius),"--cb-color-icon":v?.toRgba(),"--cb-color-icon-background-hover":n?.toRgba(),"--cb-color-navigation-hover":t?.toRgba(),"--cb-color-border-primary":l?.toRgba(),"--cb-color-accent-primary":o?.accent?.toRgba(),"--cb-typography-header-font-family":a.typographyPrimary?.fonts,"--cb-typography-body-font-family":a.typographySecondary?.fonts||a.typographyPrimary?.fonts}},[a])}(),I=A({small:!1,base:!0}),R=h.sandboxCrypto(),z=n.translate("payment.pay_with_payment_method",{payment_method:"crypto"}),j=t(null),E=t(void 0),B=t(!1),L=t(!1),T=l(()=>{const e=r.value;return Boolean(B.value&&e&&e!==E.value)}),G=t(!0),Q=t(null),K=t(null),O=t(1),V=t(I?F:H),Y=t(!1),Z=function(){const{observability:e,userEvents:o}=y(),{value:{defaultAttributes:r}}=g();return a(({eventSubtype:a,event:n,walletId:t})=>{try{if(!r)return void e.log("crypto_modal_monorail_event_not_recorded","No default attributes found",{event:n,walletId:t,eventSubtype:a});const l=N({eventName:n,shopId:r?.shopId??0,defaultAttributes:r});l.payload={...l.payload,eventSubtype:a,instrumentId:t||"none_selected"},o.monorailEvent(l)}catch(l){e.log("crypto_modal_monorail_event_not_recorded",`Error recording crypto modal monorail event: ${l}`,{event:n,walletId:t,eventSubtype:a})}},[r,e,o])}(),ee=a(()=>{Y.value=!1,V.value=I?F:H},[I,V,Y]);i(()=>{B.value=!0},[B]),i(()=>{j.value&&!G.value&&(I?j.value.call.setSingleColumnLayoutAttribute():j.value.call.removeLayoutAttribute())},[j,I,G.value]);const ae=a(()=>{E.value=r.value,L.value=!0,s.counter({name:"crypto_modal_cancel",value:1,attributes:{walletId:Q.value}}),Z({event:P.CryptoModalCancelled,walletId:Q.value})},[E,L,r,s,Q,Z]),oe=a(()=>{L.value&&(L.value=!1,window.location.reload())},[L]),re=a(e=>{s.counter({name:"crypto_modal_render",value:1,attributes:{status:e}})},[s]),ne=a(({errorMessage:e})=>s.error(new U(e,{groupingHash:"CryptoSandboxError::reportError::SandboxError"})),[s]),te=a(async e=>{j.value=e,Q.value=null,ee();const a=r.value;if(!a)return void ne({errorMessage:"No payment link provided"});const o=function(e){try{const a=new URL(e).pathname.split("/");return a.pop()||a.pop()}catch{return}}(a);if(!o)return void ne({errorMessage:"Invalid payment link provided, unable to parse ID from URL"});const n=await e.call.configure({paymentLinkId:o,merchantBranding:S,mocked:_,sandbox:C});re(n.status),n.status!==D.Success&&(K.value="sandbox",n.status===D.Error&&ne({errorMessage:n.message}))},[j,Q,r,S,_,re,ne,K,C,ee]),le=a(e=>{s.counter({name:"crypto_modal_complete",value:1,attributes:{status:e,walletId:Q.value}}),Z({event:P.CryptoModalCompleted,eventSubtype:e,walletId:Q.value}),w()},[w,s,Q,Z]),ie=a(e=>{"wallet_select_view"===e&&(Q.value=null,ee()),s.leaveErrorBreadcrumb("[Crypto] Page navigated",{page:e})},[s,Q,ee]),ce=a(({action:e,walletId:a})=>{"selected"===e&&(Q.value=a),s.leaveErrorBreadcrumb("[Crypto] Wallet action",{action:e,walletId:a}),s.counter({name:"crypto_modal_wallet_action",value:1,attributes:{action:e,walletId:a}}),Z({event:P.CryptoModalWalletAction,eventSubtype:e,walletId:a})},[s,Q,Z]),se=a(()=>
1{G.value=!1,s.counter({name:"crypto_modal_web_component_rendered",value:1}),Z({event:P.CryptoModalRendered})},[s,G,Z]),de=a(e=>{"payment_link_callback_error"===e&&(ee(),K.value="web_component"),s.leaveErrorBreadcrumb("[Crypto] Error occurred",{error:e}),s.counter({name:"crypto_modal_on_error",value:1,attributes:{error:e,walletId:Q.value}}),Z({event:P.CryptoModalError,eventSubtype:e,walletId:Q.value})},[s,K,ee,Q,Z]),ue=a(e=>{s.leaveErrorBreadcrumb("[Crypto] Deeplink",{url:e}),window.location.assign(e)},[s]),pe=a(()=>{s.leaveErrorBreadcrumb("[Crypto] Reload triggered"),ee(),G.value=!0,Q.value=null,O.value+=1},[G,O,Q,s,ee]),me=a(e=>{s.leaveErrorBreadcrumb("[Crypto] Modal height change event",{type:e.type,height:"size"===e.type?e.height:void 0}),"fullScreen"===e.type&&I?Y.value=!0:"size"===e.type&&e.height?(Y.value=!1,V.value=`${e.height}px`):"size"!==e.type||e.height||ee()},[V,Y,ee,I,s]),be=e(()=>({onComplete:le,onCancel:ae,onDeeplink:ue,onPageNavigated:ie,onWalletAction:ce,onWebComponentRendered:se,onWebComponentError:de,onWebComponentReload:pe,onModalHeight
1Change:me}),[le,ae,ue,ie,ce,se,de,pe,me]),ye=l(()=>G.value&&!K.value);return o(W,{id:"crypto-native-modal",open:T.value,closeButton:"hidden",padding:"none",blockSize:Y.value?"100%":void 0,size:"550px",accessibilityLabel:n.translate("processing.action_required"),onHide:ae,onAfterHide:oe,children:o("div",{style:{overflow:"hidden",width:"100%",height:Y.value?"100vh":V.value,transition:Y.value?"none":"height 0.25s ease-in-out"},children:[o(c,{when:ye,children:o(J,{onClose:ae})}),o(c,{when:K,fallback:o($,{sandboxUrl:R,endpointId:"crypto-coinbase",inlineStyle:{height:"100%",width:"100%",display:G.value?"none":"block"},hostMethods:be,onConnect:te,iframeTitle:z,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-${O.value}`),children:o(X,{onReload:()=>{K.value=null,G.value=!0},onClose:ae,errorType:K.value})})]})})}function ee(){const{checkout:e,observability:a}=y(),r=l(()=>{const a=e.latestReceipt.value;if(a&&L(a)&&T(a.action))return a.action.url});return s(()=>{const e=r.value;e&&a.log("crypto_modal_manager_modal_treatment_required","[CryptoModalManager] Receipt requires modal treatment",{paymentLink:e})}),o(Z,{paymentLink:r})}export{ee 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.