import { ArrowLeft, ArrowRight, Check, Eye, EyeOff, LockKeyhole, Mail, User } from 'lucide-react' import { useState } from 'react' import type { FormEvent } from 'react' import { Link, useLocation, useNavigate } from 'react-router-dom' import { authApi } from '../../lib/api' import { useAuth } from './auth-context' export function AuthPage({ initialMode }: { initialMode: 'login' | 'register' }) { const [mode, setMode] = useState(initialMode) const [name, setName] = useState('') const [email, setEmail] = useState('') const [password, setPassword] = useState('') const [showPassword, setShowPassword] = useState(false) const [error, setError] = useState('') const [submitting, setSubmitting] = useState(false) const { setUser } = useAuth() const navigate = useNavigate() const location = useLocation() async function submit(event: FormEvent) { event.preventDefault() setError('') setSubmitting(true) try { const user = mode === 'login' ? await authApi.login(email, password) : await authApi.register(name, email, password) setUser(user) const destination = (location.state as { from?: string } | null)?.from ?? '/console' navigate(destination, { replace: true }) } catch (reason) { setError(reason instanceof Error ? reason.message : 'Unable to continue') } finally { setSubmitting(false) } } function switchMode(nextMode: 'login' | 'register') { setMode(nextMode) setError('') navigate(nextMode === 'login' ? '/login' : '/register', { replace: true }) } return (
Urmi
CUSTOMER MESSAGING

Messages your customers actually receive.

Text, WhatsApp, verification codes, and calls in one workspace, with the approvals Indian businesses need.

SMS, WhatsApp, and phone KYC and DLT in setup Delivery you can check
Set up · Approve · Send · Review
Back to Urmi

{mode === 'login' ? 'Welcome back' : 'Create your workspace'}

{mode === 'login' ? 'Sign in to messages, calls, and your account.' : 'Set up Urmi and send your first message.'}

Continue with Google
or continue with email
{mode === 'register' && } {mode === 'login' &&
Secure, encrypted sign in
} {error &&

{error}

}

By continuing, you agree to Urmi’s Terms of Service and{' '} Privacy Policy.

) }