// Atlas · Onboarding — shown once after first Google sign-in const { useState: useOBState } = React; const STEPS = [ { id: "profile", label: "Your profile" }, { id: "role", label: "Your role" }, ]; const USE_CASES = [ "Technology Landscape", "Market Intelligence", "Corporate R&D", "Biotech / Pharma", "Investment Due Diligence", "Academic / University Research", "Other", ]; const COMPANY_SIZES = ["1–10", "11–50", "51–200", "201–1,000", "1,000+"]; function Onboarding({ user, onComplete }) { const [step, setStep] = useOBState(0); const [saving, setSaving] = useOBState(false); const [form, setForm] = useOBState({ name: user?.name || "", title: "", company: "", department: "", companySize: "", useCase: "", }); const set = (k, v) => setForm((f) => ({ ...f, [k]: v })); const canNext = () => { if (step === 0) return form.name.trim().length > 1; if (step === 1) return form.title.trim().length > 0 && form.company.trim().length > 0; return true; }; const handleFinish = async () => { setSaving(true); try { await fetch("/api/profile", { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ ...form, onboardingDone: true }), }); // Track completion safely try { if (window.posthog && typeof posthog.capture === 'function') { posthog.capture('onboarding_complete', { ...form }); if (posthog.people && typeof posthog.people.set === 'function') { posthog.people.set({ ...form, onboardingDone: true }); } } } catch (err) { console.warn("PostHog capture failed:", err); } onComplete({ ...user, name: form.name, profile: { ...form, onboardingDone: true } }); } catch (e) { alert("Could not save profile: " + e.message); } finally { setSaving(false); } }; return (
Let's get your account set up. We'll start with the basics.
This helps Atlas tailor reports to the right depth and audience.