1import{bQ as v,bS as x,r as l,j as r,eF as b,eG as w,eH as j,bU as p}from"./index-C_XK7NmV.js";import{F as C}from"./ArrowsRightLeftIcon-Dmd1vbXw.js";import{F}from"./CheckCircleIcon-DcWElfPi.js";import{n as S}from"./Button-OlK_6fKk-BLYKzc7C.js";import{c as I}from"./Layouts-Bmf8DxNP-DV0_JIXx.js";import{y as k,s as D}from"./ModalHeader-CxHK1IKF-COkWfTy4.js";import{t as M}from"./analytics-mkkvFRju-DOXuftJB.js";const W={component:()=>{let{data:e,setModalData:n,navigate:t,navigateBack:a}=v(),{closePrivyModal:i,createAnalyticsEvent:u,client:h}=x(),[c,m]=l.useState("pending-in-flow"),f=l.useRef(0),o={...e==null?void 0:e.funding,showAlternateFundingMethod:!0};o.usingDefaultFundingMethod&&(o.usingDefaultFundingMethod=!1);let{partnerUserId:g,popup:d}=(e==null?void 0:e.coinbaseOnrampStatus)??{};return l.useEffect(()=>{if(c==="pending-in-flow"||c==="pending-after-flow"){let y=setInterval(async()=>{if(g)try{let{status:s}=await h.getCoinbaseOnRampStatus({partnerUserId:g});if(s==="success")return void m("success");if(s==="failure")throw Error("There was an error completing Coinbase Onramp flow.");if(f.current>=3)return n({funding:o,solanaFundingData:e==null?void 0:e.solanaFundingData}),void t("FundingMethodSelectionScreen");d!=null&&d.closed&&(f.current=f.current+1,m("pending-after-flow"))}catch(s){console.error(s),m("error"),u({eventName:M,payload:{status:"failure",provider:"coinbase-onramp",error:s.message}}),n({funding:{...o,errorMessage:"Something went wrong adding funds. Please try again or use another method."},solanaFundingData:e==null?void 0:e.solanaFundingData}),t("FundingMethodSelectionScreen")}},1500);return()=>clearInterval(y)}},[g,d,c]),r.jsxs(r.Fragment,{children:[r.jsx(k,{title:"Fund account",backFn:()=>{n({funding:o,solanaFundingData:e==null?void 0:e.solanaFundingData}),a()}},"header"),r.jsx(R,{status:c,onClickCta:i}),r.jsx(D,{})]})}};let R=({status:e,onClickCta:n})=>{let{title:t,body:a,cta:i}=l.useMemo(()=>(u=>{switch(u){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:""}}})(e),[e]);return r.jsxs(r.Fragment,{children:[r.jsxs(O,{children:[r.jsx(P,{isSucccess:e==="success"}),r.jsxs(I,{children:[r.jsx("h3",{children:t}),r.jsx(E,{children:a})]})]}),i&&r.jsx(S,{onClick:n,children:i})]})},P=({isSucccess:e})=>{if(!e){let a="var(--privy-color-foreground-4)";return r.jsxs("div",{style:{position:"relative"},children:[r.jsx(b,{color:a,style:{position:"absolute"}}),r.jsx(w,{color:a}),r.jsx(j,{style:{position:"absolute",width:"2.8rem",height:"2.8rem",top:"1.2rem",left:"1.2rem"}})]})}let n=e?F:()=>r.jsx(C,{width:"3rem",height:"3rem",style:{backgroundColor:"var(--privy-color-foreground-4)",color:"var(--privy-color-background)",borderRadius:"100%",padding:"0.5rem",margin:"0.5rem"}}),t=e?"var(--privy-color-success)":"var(--privy-color-foreground-4)";return r.jsx("div",{style:{borderColor:t,display:"flex",justifyContent:"center",alignItems:"center",borderRadius:"100%",borderWidth:2,padding:"0.5rem",marginBottom:"0.5rem"},children:n&&r.jsx(n,{width:"4rem",height:"4rem",color:t})})},E=p.p.withConfig({displayName:"StatusBody",componentId:"sc-e4350fdc-0"})(["font-size:1rem;color:var(--privy-color-foreground-3);margin-bottom:1rem;display:flex;flex-direction:column;gap:1rem;"]),O=p.div.withConfig({displayName:"ConnectContainer",componentId:"sc-e4350fdc-1"})(["display:flex;flex-direction:column;align-items:center;justify-content:center;margin-left:1.75rem;margin-right:1.75rem;padding:2rem 0;"]);export{W as CoinbaseOnrampStatusScreen,W 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.