const VerifyGate = () => { const {user, toast, setUser, logout} = useApp(); const [sent, setSent] = useState(false); const [checking, setChecking] = useState(false); const resend = async () => { try { await api.resendVerify(); toast('Email de verificacion reenviado'); setSent(true); } catch(e) { if (e && (e.status === 401 || e.error === 'unauthorized')) { toast('Tu sesión ha caducado. Vuelve a iniciar sesión.'); await logout(); } else { toast('No se pudo reenviar. Inténtalo de nuevo en unos segundos.'); } } }; const checkNow = async () => { setChecking(true); try { const r = await api.me(); if (r && r.user && r.user.email_verified) { setUser(u => ({...u, email_verified: true})); try { const s=JSON.parse(localStorage.getItem('ap_user')||'{}'); s.email_verified=true; localStorage.setItem('ap_user',JSON.stringify(s)); } catch(e){} toast('Email verificado'); } else { toast('Aun no verificado — revisa tu bandeja (y spam)'); } } catch(e) { // Nunca tragarse el error: el piloto se quedaba atrapado en esta pantalla. // Si la sesión caducó (401), la única salida fiable es volver a iniciar sesión: // el login devuelve el email_verified real de la BD y desbloquea la cuenta. if (e && (e.status === 401 || e.error === 'unauthorized')) { toast('Tu sesión ha caducado. Vuelve a iniciar sesión para continuar.'); await logout(); } else { toast('No se pudo comprobar. Revisa tu conexión e inténtalo de nuevo.'); } } finally { setChecking(false); } }; return

Confirma tu email

Hemos enviado un enlace de verificacion a:

{user.email}

Revisa tu bandeja de entrada (y spam). Pulsa el enlace del email para activar tu cuenta.

¿Otra cuenta o sesión caducada?
; }; const App = () => { const {route, user} = useApp(); const needsAuth = ['dashboard','plan-editor','send-flow','history','profile','admin','ifr-table'].includes(route.screen); const effective = (!user && needsAuth) ? 'landing' : route.screen; const needsVerify = user && !user.email_verified && user.role !== 'admin' && effective !== 'landing' && effective !== 'auth'; return
{needsVerify ? : <> {user && effective!=='landing' && effective!=='auth' && } {effective==='landing' && } {effective==='auth' && } {effective==='dashboard' && } {effective==='plan-editor' && } {effective==='send-flow' && } {effective==='history' && } {effective==='profile' && } {effective==='admin' && } {effective==='ifr-table' && } {user && effective!=='landing' && effective!=='auth' && } }
; }; const root = ReactDOM.createRoot(document.getElementById('root')); root.render();