UNPKG

@accounter/client

Version:
1 lines 2.58 kB
import{s as e}from"./dist-ypP48_Ax.js";import{i as t,o as n}from"./utils-CbS-oR5I.js";import{d as r,n as i}from"./chunk-62JRHF6Z-CBbOZODe.js";import{n as a}from"./auth0-react.esm-anvOA90g.js";import{t as o}from"./loader-circle-CZACSY-b.js";import{t as s}from"./routes-4W-duEv9.js";import{t as c}from"./button-DUNsVBiu.js";import{t as l}from"./use-logout-gbs_knRl.js";import{k as u}from"./index-U1vN7cBF.js";import{n as d,r as f,t as p}from"./alert-55QsYEfR.js";var m=e(n(),1),h=t();function g(){let{isAuthenticated:e,isLoading:t}=a(),{fetching:n,error:g,viewer:_}=u({pause:t||!e}),v=l(),y=r();if((0,m.useEffect)(()=>{_?.status===`ACTIVE`&&y(s.APP_HOME,{replace:!0})},[_?.status,y]),t||n)return(0,h.jsx)(`div`,{className:`flex items-center justify-center h-screen`,children:(0,h.jsx)(o,{className:`h-10 w-10 animate-spin`})});if(!e)return(0,h.jsx)(i,{to:s.LOGIN,replace:!0});if(g)return(0,h.jsx)(`div`,{className:`flex items-center justify-center h-screen px-4`,children:(0,h.jsxs)(`div`,{className:`max-w-md space-y-6`,children:[(0,h.jsxs)(p,{variant:`destructive`,children:[(0,h.jsx)(f,{children:`Could not check your account`}),(0,h.jsx)(d,{children:`We could not reach the server to see which businesses you belong to. Check your connection and try again.`})]}),(0,h.jsxs)(`div`,{className:`flex gap-2 justify-center`,children:[(0,h.jsx)(c,{onClick:()=>window.location.reload(),children:`Try again`}),(0,h.jsx)(c,{variant:`outline`,onClick:v,children:`Sign out`})]})]})});let b=_?.status===`EMAIL_UNVERIFIED`;return(0,h.jsx)(`div`,{className:`flex items-center justify-center h-screen px-4`,children:(0,h.jsxs)(`div`,{className:`text-center max-w-md space-y-6`,children:[(0,h.jsxs)(`div`,{className:`space-y-2`,children:[(0,h.jsx)(`h1`,{className:`text-3xl font-bold`,children:b?`Verify your email`:`No workspace yet`}),_?.email?(0,h.jsxs)(`p`,{className:`text-sm text-muted-foreground`,children:[`Signed in as `,_.email]}):null]}),b?(0,h.jsx)(`p`,{className:`text-muted-foreground`,children:`We sent a verification link to your email address. Open it, then reload this page to continue.`}):(0,h.jsx)(`p`,{className:`text-muted-foreground`,children:`Accounter is invitation-only. Your account is not linked to any business yet — ask an administrator of the business you should belong to for an invitation, then open the link they send you.`}),(0,h.jsxs)(`div`,{className:`flex gap-2 justify-center`,children:[(0,h.jsx)(c,{onClick:()=>window.location.reload(),children:`Check again`}),(0,h.jsx)(c,{variant:`outline`,onClick:v,children:`Sign out`})]})]})})}export{g as WelcomePage};