1import{T as e,s as a,u as o,S as r,v as n,q as t,t as l,m as i,w as c,C as s}from"./2c1ab0fe.GMbxnz74.js";import{bs as d,cH as u,cI as p,cJ as m,cK as b,S as y,c2 as g,bb as v,Q as h,cL as f}from"./4c290a1e.2OXqqQwu.js";import{a4 as x,t as w,o as k,c as C,L as _,ai as S,B as I,J as z,ah as R,c3 as j,a5 as B,I as E,cH as M,a6 as A,bz as L,cY as W,cZ as T}from"./164ad2e3.BmqNdq2P.js";import{S as D,B as $}from"./3a819064.D5LTh6Qs.js";import{g as N,W as P}from"./ed9f2238.OL0ogUQT.js";import{S as G}from"./app.iZwEIta_.js";import"./9f047e05.Bp-gLL-x.js";import"./0a7dffce.BIRsKacx.js";import"./5fda1420.C7SyMXTh.js";import"./60a453ce.fEeMtJEq.js";import"./21cc90a2.BYvnDDaS.js";import"./bb728e1c.D-ELh9cQ.js";import"./ac5a19ff.DlwW5UC8.js";function H(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 q="363px",F="455px";class U extends G{constructor(){super(...arguments),this.name="CryptoSandboxError"}}function J({onReload:e,onClose:a,errorType:r}){const{i18n:n}=y();return o(C,{padding:"large-500",alignItems:"center",justifyContent:"center",rowGap:"large-100",blockSize:"100%",children:[o(k,{children:"sandbox"===r?n.translate("payment.crypto_modal.error.sandbox_error"):n.translate("payment.crypto_modal.error.web_component_error")}),o(C,{alignItems:"center",justifyContent:"center",columnGap:"small-500",direction:"inline",children:n.translate("general.list_formatter.or.twoWordConnector",{firstWord:o(_,{onClick:e,children:n.translate("payment.crypto_modal.error.refresh")}),secondWord:o(_,{onClick:a,children:n.translate("payment.crypto_modal.error.close")})})})]})}function Q({onClose:e}){return o(r,{children:[o(O,{onClose:e}),o(K,{}),o(X,{})]})}function K(){return o(z,{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(C,{background:"subdued",rowGap:"none",alignItems:"start",borderRadius:"@media (inline-size >= small) none, small",children:[Array(7).fill(null).map((e,a)=>o(Y,{},a)),o(z,{padding:"small-100 base",alignItems:"center",justifyContent:"center",gridTemplateColumns:"25px 1fr",gap:"small-100",minInlineSize:"100%",minBlockSize:"60px",children:[o(R,{contentDisplay:"block",blockSize:"25px",inlineSize:"25px"}),o(C,{rowGap:"small-500",children:[o(j,{size:"extraSmall",lines:1}),o(j,{size:"extraSmall",lines:1})]})]})]}),o(B,{direction:"block"}),o(C,{alignItems:"center",justifyContent:"center",children:o(S,{children:"Select your wallet to connect and pay"})})]})}function X(){return o(C,{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(z,{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(Y,{mobile:!0},a))})})]})}function Y({mobile:e=!1}){return e?o(C,{alignItems:"center",justifyContent:"center",rowGap:"small-400",children:[o(R,{contentDisplay:"block",blockSize:"64px",inlineSize:"64px"}),o(S,{size:"small",children:"coinbase wallet"})]}):o(z,{padding:"small-100 base",alignItems:"center",justifyContent:"center",gridTemplateColumns:"25px 1fr",gap:"small-100",minInlineSize:"100%",children:[o(R,{contentDisplay:"block",blockSize:"25px",inlineSize:"25px"}),o(j,{lines:1})]})}function Z({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(E,{type:"x",size:"base"})})}function O({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(Z,{onClose:e})]})}function V({paymentLink:r}){const{i18n:n,observability:s,shop:v,url:h}=y(),k=M(),C=v.hasFlagEnabled(f),_=v.forceStablecoinSandboxPayments,S=function(){const a=x();return e(()=>{const e=a.colors?.schemes?.scheme1,o=a.colors?.global,r=e?.base?.background??d(w.color.global.base.background),n=u({background:e?.base?.background??d(w.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(w.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":H(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}),z=h.sandboxCrypto(),R=n.translate("payment.pay_with_payment_method",{payment_method:"crypto"}),j=t(null),B=t(void 0),E=t(!1),W=t(!1),T=l(()=>{const e=r.value;return Boolean(E.value&&e&&e!==B.value)}),G=t(!0),K=t(null),X=t(null),Y=t(1),Z=t(I?q:F),O=t(!1),V=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(()=>{O.value=!1,Z.value=I?q:F},[I,Z,O]);i(()=>{E.value=!0},[E]),i(()=>{j.value&&!G.value&&(I?j.value.call.setSingleColumnLayoutAttribute():j.value.call.removeLayoutAttribute())},[j,I,G.value]);const ae=a(()=>{B.value=r.value,W.value=!0,s.counter({name:"crypto_modal_cancel",value:1,attributes:{walletId:K.value}}),V({event:P.CryptoModalCancelled,walletId:K.value})},[B,W,r,s,K,V]),oe=a(()=>{W.value&&(W.value=!1,window.location.reload())},[W]),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,K.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:C,sandbox:_});re(n.status),n.status!==D.Success&&(X.value="sandbox",n.status===D.Error&&ne({errorMessage:n.message}))},[j,K,r,S,C,re,ne,X,_,ee]),le=a(e=>{s.counter({name:"crypto_modal_complete",value:1,attributes:{status:e,walletId:K.value}}),V({event:P.CryptoModalCompleted,eventSubtype:e,walletId:K.value}),k()},[k,s,K,V]),ie=a(e=>{"wallet_select_view"===e&&(K.value=null,ee()),s.leaveErrorBreadcrumb("[Crypto] Page navigated",{page:e})},[s,K,ee]),ce=a(({action:e,walletId:a})=>{"selected"===e&&(K.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}}),V({event:P.CryptoModalWalletAction,eventSubtype:e,walletId:a})},[s,K,V]),se=a(()=>
1{G.value=!1,s.counter({name:"crypto_modal_web_component_rendered",value:1}),V({event:P.CryptoModalRendered})},[s,G,V]),de=a(e=>{"payment_link_callback_error"===e&&(ee(),X.value="web_component"),s.leaveErrorBreadcrumb("[Crypto] Error occurred",{error:e}),s.counter({name:"crypto_modal_on_error",value:1,attributes:{error:e,walletId:K.value}}),V({event:P.CryptoModalError,eventSubtype:e,walletId:K.value})},[s,X,ee,K,V]),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,K.value=null,Y.value+=1},[G,Y,K,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?O.value=!0:"size"===e.type&&e.height?(O.value=!1,Z.value=`${e.height}px`):"size"!==e.type||e.height||ee()},[Z,O,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&&!X.value);return o(L,{id:"crypto-native-modal",open:T.value,closeButton:"hidden",padding:"none",blockSize:O.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:O.value?"100vh":Z.value,transition:O.value?"none":"height 0.25s ease-in-out"},children:[o(c,{when:ye,children:o(Q,{onClose:ae})}),o(c,{when:X,fallback:o($,{sandboxUrl:z,endpointId:"crypto-coinbase",inlineStyle:{height:"100%",width:"100%",display:G.value?"none":"block"},hostMethods:be,onConnect:te,iframeTitle:R,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-${Y.value}`),children:o(J,{onReload:()=>{X.value=null,G.value=!0},onClose:ae,errorType:X.value})})]})})}function ee(){const{checkout:e,observability:a}=y(),r=l(()=>{const a=e.latestReceipt.value;if(a&&W(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(V,{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.