1import{k as y,d as p,r as s,j as t,L as k}from"./react-BVqF6wkN.js";import{e as j,H as E,B as N,l as v,g as S}from"./index-DBhDrNME.js";import{f as C}from"./useAuth-ISbwCCtf.js";import{A as R}from"./alert-XosN1OS1.js";import"./assets--OE6x10G.js";const b=60,w=5e3,V=()=>{const l=y(),[x]=p(),[o,h]=s.useState(""),[m,u]=s.useState(null),[r,d]=s.useState(null),[a,f]=s.useState(0),i=C(),{data:n}=j({queryKey:["auth","verification-status"],queryFn:()=>S.getMe(),refetchInterval:w,retry:!1});s.useEffect(()=>{const e=x.get("email");e?h(e):l("/login")},[]),s.useEffect(()=>{var e;(e=n==null?void 0:n.user)!=null&&e.isVerified&&l("/subscribe")},[n]),s.useEffect(()=>{if(a<=0)return;const e=setTimeout(()=>f(c=>c-1),1e3);return()=>clearTimeout(e)},[a]);const g=async()=>{d(null),u(null);try{const e=await i.mutateAsync({email:o});u(e.message||"Verification link sent. Check your email."),f(b)}catch(e){const c=e instanceof v?e.message:"Could not resend the link. Please try again.";d(c)}};return t.jsxs("main",{className:"relative flex min-h-dvh items-center justify-center",children:[t.jsx(E,{children:t.jsx("title",{children:"Check Your Email | Rankpilot"})}),t.jsxs("div",{className:"flex w-full max-w-md flex-col items-center space-y-8 px-6 py-20 md:py-10",children:[t.jsx("h2",{className:"mb-4! text-center text-3xl font-extrabold",children:"Check your email"}),t.jsxs("p",{className:"text-center text-sm text-gray-600",children:["We sent a verification link to ",t.jsx("span",{className:"font-semibold",children:o}),". Click it to activate your account."]}),(r||m)&&t.jsx(R,{variant:r?"error":"success",className:"w-full",children:r||m}),t.jsx(N,{className:"w-full",onClick:g,disabled:i.isPending||a>0,children:i.isPending?"Sending...":a>0?`Resend link in ${a}s`:"Resend link"}),t.jsx("div",{className:"text-center text-sm text-gray-600",children:t.jsx(k,{to:"/login",className:"font-medium text-blue hover:underline",children:"Back to Login"})})]})]})};export{V as CheckEmail};
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.