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,z as c,p as s}from"./2c1ab0fe.qpvfywqb.js";import{b7 as d,cy as u,cz as p,cA as m,cB as b,e as y,aQ as g,a$ as v,C as h,cC as f}from"./4b4bc88f.DkycdxSK.js";import{J as x,Y as k,j as w,S as C,L as _,G as S,b as I,ab as z,az as R,cn as j,aj as E,a1 as B,cX as M,p as A,M as W,d9 as L,da as T}from"./164ad2e3.DcJn775M.js";import{S as $,B as D}from"./ee2bb050.DwFu9ie-.js";import{g as G,W as P}from"./78ab3dd0.DsAxQUAi.js";import{S as N}from"./app.DH8n-1bp.js";import"./d0bb51ec.CWfbNPnY.js";import"./f67abd2c.CNaB0QaR.js";import"./e12db40c.DhbHW8sF.js";import"./9dba8418.4R19B40l.js";import"./60a453ce.DBFo6PRx.js";import"./17e57de1.lSRGFmhc.js";import"./ca3e798e.XLlup-KR.js";function F(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",H="455px";class U extends N{constructor(){super(...arguments),this.name="CryptoSandboxError"}}function X({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(w,{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 J({onClose:e}){return o(r,{children:[o(V,{onClose:e}),o(Q,{}),o(Y,{})]})}function Q(){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(K,{},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(E,{direction:"block"}),o(C,{alignItems:"center",justifyContent:"center",children:o(S,{children:"Select your wallet to connect and pay"})})]})}function Y(){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(K,{mobile:!0},a))})})]})}function K({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 O({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 V({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(O,{onClose:e})]})}function Z({paymentLink:r}){const{i18n:n,observability:s,shop:v,url:h}=y(),w=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(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":F(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),E=t(void 0),B=t(!1),L=t(!1),T=l(()=>{const e=r.value;return Boolean(B.value&&e&&e!==E.value)}),N=t(!0),Q=t(null),Y=t(null),K=t(1),O=t(I?q:H),V=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=G({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(()=>{V.value=!1,O.value=I?q:H},[I,O,V]);i(()=>{B.value=!0},[B]),i(()=>{j.value&&!N.value&&(I?j.value.call.setSingleColumnLayoutAttribute():j.value.call.removeLayoutAttribute())},[j,I,N.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:C,sandbox:_});re(n.status),n.status!==$.Success&&(Y.value="sandbox",n.status===$.Error&&ne({errorMessage:n.message}))},[j,Q,r,S,C,re,ne,Y,_,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{N.value=!1,s.counter({name:"crypto_modal_web_component_rendered",value:1}),Z({event:P.CryptoModalRendered})},[s,N,Z]),de=a(e=>{"payment_link_callback_error"===e&&(ee(),Y.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,Y,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(),N.value=!0,Q.value=null,K.value+=1},[N,K,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?V.value=!0:"size"===e.type&&e.height?(V.value=!1,O.value=`${e.height}px`):"size"!==e.type||e.height||ee()},[O,V,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(()=>N.value&&!Y.value);return o(W,{id:"crypto-native-modal",open:T.value,closeButton:"hidden",padding:"none",blockSize:V.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:V.value?"100vh":O.value,transition:V.value?"none":"height 0.25s ease-in-out"},children:[o(c,{when:ye,children:o(J,{onClose:ae})}),o(c,{when:Y,fallback:o(D,{sandboxUrl:z,endpointId:"crypto-coinbase",inlineStyle:{height:"100%",width:"100%",display:N.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-${K.value}`),children:o(X,{onReload:()=>{Y.value=null,N.value=!0},onClose:ae,errorType:Y.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.