UNPKG

@accounter/client

Version:
1 lines 2.54 kB
import{s as e}from"./dist-ypP48_Ax.js";import{i as t,o as n}from"./utils-CbS-oR5I.js";import{_ as r,c as i,t as a}from"./routes-Cawu7UJi.js";import{n as o}from"./auth0-react.esm-mnUP2_nu.js";import{t as s}from"./loader-circle-CfW9jOIr.js";import{t as c}from"./button-DUNsVBiu.js";import{t as l}from"./use-viewer-C2gor0AA.js";import{t as u}from"./use-logout-Be3xHiy2.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}=o(),{fetching:n,error:g,viewer:_}=l({pause:t||!e}),v=u(),y=r();if((0,m.useEffect)(()=>{_?.status===`ACTIVE`&&y(a.HOME,{replace:!0})},[_?.status,y]),t||n)return(0,h.jsx)(`div`,{className:`flex items-center justify-center h-screen`,children:(0,h.jsx)(s,{className:`h-10 w-10 animate-spin`})});if(!e)return(0,h.jsx)(i,{to:a.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};