1import{d6 as x,d8 as y,da as l,d5 as e,dt as p,du as b,dv as j,dw as w}from"./index-nWb-lFPJ.js";import{F}from"./ArrowsRightLeftIcon-G82rmAlb.js";import{F as C}from"./CheckCircleIcon-CHej5Qd1.js";import{T as S,u as k,m as D}from"./ModalHeader-CxoNYPcm-GUOUaE7I.js";import{a as I}from"./Layouts-BlFm53ED-Ch46qOnB.js";import{t as M}from"./analytics-mkkvFRju-DOXuftJB.js";const G={component:()=>{let{data:r,setModalData:t,navigate:n,navigateBack:a}=x(),{closePrivyModal:i,createAnalyticsEvent:c,client:h}=y(),[d,u]=l.useState("pending-in-flow"),g=l.useRef(0),o={...r?.funding,showAlternateFundingMethod:!0};o.usingDefaultFundingMethod&&(o.usingDefaultFundingMethod=!1);let{partnerUserId:m,popup:f}=r?.coinbaseOnrampStatus??{};return l.useEffect((()=>{if(d==="pending-in-flow"||d==="pending-after-flow"){let v=setInterval((async()=>{if(m)try{let{status:s}=await h.getCoinbaseOnRampStatus({partnerUserId:m});if(s==="success")return void u("success");if(s==="failure")throw Error("There was an error completing Coinbase Onramp flow.");if(g.current>=3)return t({funding:o,solanaFundingData:r?.solanaFundingData}),void n("FundingMethodSelectionScreen");f?.closed&&(g.current=g.current+1,u("pending-after-flow"))}catch(s){console.error(s),u("error"),c({eventName:M,payload:{status:"failure",provider:"coinbase-onramp",error:s.message}}),t({funding:{...o,errorMessage:"Something went wrong adding funds. Please try again or use another method."},solanaFundingData:r?.solanaFundingData}),n("FundingMethodSelectionScreen")}}),1500);return()=>clearInterval(v)}}),[m,f,d]),e.jsxs(e.Fragment,{children:[e.jsx(S,{title:"Fund account",backFn:()=>{t({funding:o,solanaFundingData:r?.solanaFundingData}),a()}},"header"),e.jsx(R,{status:d,onClickCta:i}),e.jsx(k,{})]})}};let R=({status:r,onClickCta:t})=>{let{title:n,body:a,cta:i}=l.useMemo((()=>(c=>{switch(c){case"success":return{title:"You've funded your account!",body:"It may take a few minutes for the assets to appear.",cta:"Continue"};case"pending-after-flow":return{title:"In Progress",body:"Almost done. Retrieving transaction status from Coinbase",cta:""};case"error":case"pending-in-flow":return{title:"In Progress",body:"Go back to Coinbase Onramp to finish funding your account.",cta:""}}})(r)),[r]);return e.jsxs(e.Fragment,{children:[e.jsxs(P,{children:[e.jsx(E,{isSucccess:r==="success"}),e.jsxs(I,{children:[e.jsx("h3",{children:n}),e.jsx(O,{children:a})]})]}),i&&e.jsx(D,{onClick:t,children:i})]})},E=({isSucccess:r})=>{if(!r){let a="var(--privy-color-foreground-4)";return e.jsxs("div",{style:{position:"relative"},children:[e.jsx(b,{color:a,style:{position:"absolute"}}),e.jsx(j,{color:a}),e.jsx(w,{style:{position:"absolute",width:"2.8rem",height:"2.8rem",top:"1.2rem",left:"1.2rem"}})]})}let t=r?C:()=>e.jsx(F,{width:"3rem",height:"3rem",style:{backgroundColor:"var(--privy-color-foreground-4)",color:"var(--privy-color-background)",borderRadius:"100%",padding:"0.5rem",margin:"0.5rem"}}),n=r?"var(--privy-color-success)":"var(--privy-color-foreground-4)";return e.jsx("div",{style:{borderColor:n,display:"flex",justifyContent:"center",alignItems:"center",borderRadius:"100%",borderWidth:2,padding:"0.5rem",marginBottom:"0.5rem"},children:t&&e.jsx(t,{width:"4rem",height:"4rem",color:n})})},O=p.p` 2 font-size: 1rem; 3 color: var(--privy-color-foreground-3); 4 margin-bottom: 1rem; 5 display: flex; 6 flex-direction: column; 7 gap: 1rem; 8`,P=p.div` 9 display: flex; 10 flex-direction: column; 11 align-items: center; 12 justify-content: center; 13 margin-left: 1.75rem; 14 margin-right: 1.75rem; 15 padding: 2rem 0; 16`;export{G as CoinbaseOnrampStatusScreen,G 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.