"use client" import { useState, useCallback } from "react" import { Mail, Loader2, CheckCircle2, ArrowRight } from "lucide-react" import { track } from "@vercel/analytics" import { Button } from "@/components/ui/button" import { Input } from "@/components/ui/input" type Status = "idle" | "loading" | "success" | "error" // The backend is proxied under the same origin via the rewrites in // next.config.mjs, so the form never needs the backend origin (no CORS). const WAITLIST_ENDPOINT = "/api/v1/waitlist" const INTERESTS = [ "I translate documents regularly", "I run a translation agency", "I manage a multilingual team", "I'm a developer (API integration)", "Just exploring", ] export function WaitlistSection() { const [email, setEmail] = useState("") const [interest, setInterest] = useState(INTERESTS[0]) const [status, setStatus] = useState("idle") const [message, setMessage] = useState("") const submit = useCallback( async (e: React.FormEvent) => { e.preventDefault() if (!email || status === "loading") return setStatus("loading") setMessage("") try { const res = await fetch(`/api/v1/waitlist`, { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ email, interest }), }) const data = await res.json().catch(() => ({})) if (res.ok) { setStatus("success") track("waitlist_joined", { interest }) setMessage( data?.data?.status === "already_joined" ? "You are already on the list. We will email you at launch." : "You are on the list. We will email you at launch." ) setEmail("") } else { setStatus("error") track("waitlist_error", { status: res.status }) setMessage(data?.message ?? "Something went wrong. Please try again.") } } catch { setStatus("error") setMessage("Network error. Please try again later.") } }, [email, interest, status] ) return (

Be first in line at launch

Join the waitlist and get early access, launch-day pricing and the “keep your format” playbook. No spam, one email at launch.

{status === "success" ? (

{message}

) : (
setEmail(e.target.value)} placeholder="you@company.com" aria-label="Email address" className="flex-1" disabled={status === "loading"} />
{status === "error" && (

{message}

)}

We only use your address to notify you at launch. Unsubscribe any time.

)}
) }