PageSourceSearch

https://www.theatlas.com/assets/AtlasLinkPage-C9eYpIvc.js

js theatlas.com collected 2026-10-02 02:33:12 UTC 4,810 bytes, 2 lines download raw bytes

1const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-C8_YkK9q.js","assets/index-qNKcM8nB.css"])))=>i.map(i=>d[i]);
2import{i as b,b as E,J as C,k as N,e as _,r as k,A as w,j as e,Z as d,ad as P,ab as T,W as S,Y as W,ay as p}from"./index-C8_YkK9q.js";function I(){const{whopId:s}=b(),h=E(),[m]=C(),{user:r,signOut:y}=N(),{addPendingAction:x}=_(),t=m.get("token"),[o,c]=k.useState({isLoading:!0,isLinked:!1,hasExistingLink:!1,success:m.get("success")==="true"});k.useEffect(()=>{(async()=>{if(!r||!s){c(i=>({...i,isLoading:!1}));return}try{const{supabase:i}=await P(async()=>{const{supabase:l}=await import("./index-C8_YkK9q.js").then(f=>f.aU);return{supabase:l}},__vite__mapDeps([0,1])),{data:n,error:j}=await i.from("profiles").select("whop_id").eq("whop_id",s).single();if(n){c(l=>({...l,isLoading:!1,hasExistingLink:!0,existingWhopId:n.whop_id,error:"This SaaS account is already linked to another marketplace account."}));return}c(l=>({...l,isLoading:!1}))}catch(i){console.error("Error in checkExistingLink:",i),c(n=>({...n,isLoading:!1,error:"An unexpected error occurred"}))}})()},[r,s]);const A=async()=>{if(!(!s||!r||!t)){c(a=>({...a,isLoading:!0,error:void 0}));try{const i=await(await T("link-whop-account",{method:"POST",body:JSON.stringify({whop_id:s,token:t})})).json();i.success?c(n=>({...n,isLoading:!1,isLinked:!0,success:!0})):c(n=>({...n,isLoading:!1,error:i.message||"Failed to link accounts"}))}catch(a){console.error("Error linking accounts:",a),c(i=>({...i,isLoading:!1,error:"An unexpected error occurred while linking accounts"}))}}},L=()=>{s&&t&&x(w.LINK_WHOP_ACCOUNT,{whopId:s,token:t}),y(),h("/login")},g=()=>{window.close(),h("/error")},v=()=>{h("/")};k.useEffect(()=>{!r&&s&&t&&(x(w.LINK_WHOP_ACCOUNT,{whopId:s,token:t}),h("/login"))},[r,s,t,x,h]);function u({icon:a,title:i,subtitle:n,children:j,error:l,showEmail:f}){return e.jsx("div",{className:"min-h-screen flex items-center justify-center bg-base-200",children:e.jsx("div",{className:"w-full max-w-md px-4",children:e.jsx(S,{title:i,userType:"buyer",children:e.jsxs("div",{className:"flex flex-col items-center gap-6",children:[a&&e.jsx("div",{className:"w-16 h-16 rounded-full flex items-center justify-center mb-2",children:a}),l&&e.jsx(W,{message:l}),n&&e.jsx("div",{className:"text-center text-base-content/80 text-sm mb-2",children:n}),f&&r&&e.jsxs("div",{className:"text-sm text-gray-500 mb-2",children:["Logged in as: ",e.jsx("b",{children:r.email})]}),j]})})})})}return!s||!t?u({icon:e.jsx("svg",{className:"w-10 h-10 text-red-500",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})}),title:"Invalid Link",subtitle:"The account linking URL is invalid or missing required parameters."+(s?"":" Missing account ID.")+(t?"":" Missing verification token."),children:e.jsx(d,{onClick:()=>
2h("/"),children:"Go to Homepage"}),showEmail:!!r}):r?o.isLoading?u({icon:e.jsx(p,{size:"lg"}),title:"Checking account status...",showEmail:!0}):o.success||o.isLinked?u({icon:e.jsx("div",{className:"w-16 h-16 rounded-full bg-green-100 flex items-center justify-center",children:e.jsx("svg",{className:"w-8 h-8 text-green-600",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})})}),title:"Accounts Successfully Linked!",subtitle:e.jsxs(e.Fragment,{children:["Your ",e.jsx("b",{children:"The Atlas"})," account has been successfully linked to your ",e.jsx("b",{children:"The Wholesale Atlas"})," account."]}),children:e.jsx(d,{onClick:v,children:"Continue"}),showEmail:!0}):o.hasExistingLink?u({title:"Accounts Already Linked",subtitle:"Your accounts are already linked",children:e.jsx("div",{className:"flex flex-col gap-3 w-full",children:e.jsx(d,{onClick:g,children:"Close"})}),showEmail:!0}):o.error?u({title:"Error Linking Accounts",error:o.error,children:e.jsxs("div",{className:"flex flex-col gap-3 w-full",children:[e.jsx(d,{onClick:g,variant:"secondary",children:"Close"}),e.jsx(d,{onClick:L,children:"Login with Different Account"})]}),showEmail:!0}):u({title:"Link Your Accounts",subtitle:e.jsxs(e.Fragment,{children:["Do you want to link your current ",e.jsx("b",{children:"The Atlas"})," account with your ",e.jsx("b",{children:"The Wholesale Atlas"})," account?"]}),children:e.jsxs("div",{className:"flex flex-col gap-3 w-full",children:[e.jsx(d,{onClick:A,disabled:o.isLoading,children:o.isLoading?"Linking...":"Yes, Link Accounts"}),e.jsx(d,{onClick:L,variant:"secondary",children:"Login with Different Account"}),e.jsx(d,{onClick:g,variant:"secondary",children:"No, Close Window"})]}),showEmail:!0}):u({icon:e.jsx(p,{size:"lg"}),title:"Redirecting to login..."})}export{I 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.