// Onboarding — seven steps, one question each. The three textarea steps feed // Claude directly (name/age/situation/struggles/goals/lang_pref/delivery_hour). const { useState: useState_O } = React; const STEPS = [ { id: "name", eyebrow: "Step 1 of 7", question: "What do they call you?", help: "First name is enough.", kind: "text", placeholder: "Kaku" }, { id: "age", eyebrow: "Step 2 of 7", question: "How old are you?", help: "Context, not judgement.", kind: "choice", options: ["Under 25", "25 – 34", "35 – 44", "45 – 54", "55 +"] }, { id: "situation", eyebrow: "Step 3 of 7", question: "What’s going on in your life right now?", help: "A few honest sentences. This shapes every affirmation you hear.", kind: "textarea", placeholder: "Company just got acquired. Trying to figure out what’s next.", minChars: 20 }, { id: "struggles", eyebrow: "Step 4 of 7", question: "What’s the #1 thing you want to fix?", help: "Be specific. \"Sleep, weight, motivation\" beats \"feel better\".", kind: "textarea", placeholder: "Weight crept up. Mornings feel heavy. Keep drifting to my phone.", minChars: 20 }, { id: "goals", eyebrow: "Step 5 of 7", question: "Where do you want to be in 6 months?", help: "Name it in your own words. No templates.", kind: "textarea", placeholder: "Back in shape. A business I’ve shipped. Calmer mornings.", minChars: 20 }, { id: "lang_pref", eyebrow: "Step 6 of 7", question: "Which language feels most like you?", help: "Your affirmations will be written in this.", kind: "choice", options: ["English", "Hindi", "Hinglish"] }, { id: "delivery_hour", eyebrow: "Step 7 of 7", question: "When do you listen?", help: "We’ll time the drop for then.", kind: "choice", options: [ "Before 7 AM", "7 – 9 AM", "Commute", "Evening", "No fixed time" ] } ]; function Onboarding({ onComplete, errorMessage }) { const [step, setStep] = useState_O(0); const [answers, setAnswers] = useState_O({}); const [submitting, setSubmitting] = useState_O(false); const s = STEPS[step]; const setAnswer = (v) => setAnswers(a => ({ ...a, [s.id]: v })); const value = answers[s.id]; const trimmed = typeof value === "string" ? value.trim() : ""; const canNext = s.kind === "text" ? trimmed.length > 0 : s.kind === "textarea" ? trimmed.length >= (s.minChars || 1) : value !== undefined; const next = async () => { if (!canNext || submitting) return; if (step === STEPS.length - 1) { setSubmitting(true); try { await onComplete(answers); } finally { setSubmitting(false); } } else { setStep(step + 1); } }; const back = () => step > 0 && setStep(step - 1); return (
{STEPS.map((_, i) => (
))}
{s.eyebrow}
{s.kind === "text" && (
setAnswer(e.target.value)} autoFocus />
)} {s.kind === "textarea" && (