import { useState } from β€œreact”; const VALUES = [ β€œAcceptance”, β€œAuthenticity”, β€œAwakening”, β€œBalance”, β€œBelonging”, β€œBoundaries”, β€œClarity”, β€œCompassion”, β€œConnection”, β€œCourage”, β€œCreativity”, β€œDevotion”, β€œEase”, β€œEmbodiment”, β€œEmpathy”, β€œExpression”, β€œFaith”, β€œFlow”, β€œForgiveness”, β€œFreedom”, β€œGenerosity”, β€œGrace”, β€œGratitude”, β€œGrowth”, β€œHealing”, β€œHope”, β€œHumility”, β€œIntegrity”, β€œIntuition”, β€œJoy”, β€œKindness”, β€œLove”, β€œMagic”, β€œNourishment”, β€œOpenness”, β€œPatience”, β€œPeace”, β€œPlay”, β€œPresence”, β€œProtection”, β€œPurpose”, β€œReceptivity”, β€œResilience”, β€œRest”, β€œSacredness”, β€œSafety”, β€œSelf-Love”, β€œSensitivity”, β€œService”, β€œSoftness”, β€œSovereignty”, β€œStillness”, β€œSurrender”, β€œTransformation”, β€œTrust”, β€œTruth”, β€œVision”, β€œVitality”, β€œWholeness”, β€œWonder” ]; const MAX = 20; // ── tiny helpers ────────────────────────────────────────────────────────────── const Label = ({ children, style = {} }) => (
{children}
); export default function SoulMission() { const [selected, setSelected] = useState([]); const [phase, setPhase] = useState(β€œselect”); // select | email | result const [name, setName] = useState(””); const [email, setEmail] = useState(””); const [emailError, setEmailError] = useState(””); const [missionText, setMissionText] = useState(””); const [loading, setLoading] = useState(false); const [copied, setCopied] = useState(false); // ── value toggling ────────────────────────────────────────────────────────── const toggle = (v) => { if (selected.includes(v)) setSelected(selected.filter(x => x !== v)); else if (selected.length < MAX) setSelected([…selected, v]); }; // ── email gate ────────────────────────────────────────────────────────────── const handleEmailSubmit = async () => { if (!name.trim()) { setEmailError(β€œPlease enter your name.”); return; } if (!/\S+@\S+.\S+/.test(email)) { setEmailError(β€œPlease enter a valid email.”); return; } setEmailError(””); await generate(); }; // ── AI generation ─────────────────────────────────────────────────────────── const generate = async () => { setLoading(true); setMissionText(””); setPhase(β€œresult”); ``` const prompt = `You are a warm, nurturing guide who helps people reconnect with their soul's deepest truth. ``` A person named ${name || β€œthis person”} has chosen these 20 values as the core of who they are: ${selected.join(”, β€œ)}. Write a soul mission statement addressed to them personally. It should: - Open by addressing them by first name warmly (e.g. β€œ${name || β€œDear one”},”) - Be 3–5 sentences, written in first person (β€œI am…”, β€œI choose…”, β€œI trust…”) - Feel like a warm embrace β€” loving, grounding, and deeply affirming - Weave in the spirit of their values naturally (don’t list them all literally) - Have a gentle, flowing rhythm β€” like something read aloud by candlelight - End with a single short power mantra on its own line, beginning with β€œI am” β€” something they can whisper to themselves each morning Output only the greeting, mission statement, and mantra. No titles, no extra commentary.`; ``` try { const response = await fetch("https://api.anthropic.com/v1/messages", { method: "POST", headers: { "Content-Type": "application/json", "x-api-key": "", "anthropic-version": "2023-06-01", "anthropic-dangerous-direct-browser-access": "true" }, body: JSON.stringify({ model: "claude-sonnet-4-20250514", max_tokens: 1000, messages: [{ role: "user", content: prompt }] }) }); const data = await response.json(); const text = data?.content?.[0]?.text || "Something tender got interrupted. Please try again."; setMissionText(text); } catch (e) { setMissionText("Something tender got interrupted. Please try again."); } setLoading(false); ``` }; const reset = () => { setSelected([]); setName(””); setEmail(””); setMissionText(””); setEmailError(””); setPhase(β€œselect”); }; const copyMantra = () => { const lines = missionText.split(”\n”).filter(Boolean); const mantra = lines[lines.length - 1]; navigator.clipboard.writeText(mantra).then(() => { setCopied(true); setTimeout(() => setCopied(false), 2000); }); }; // ── parse mission text ────────────────────────────────────────────────────── const paragraphs = missionText.split(”\n”).filter(Boolean); const mantraLine = paragraphs[paragraphs.length - 1]; const bodyLines = paragraphs.slice(0, -1); const isReady = !loading && missionText && mantraLine?.toLowerCase().startsWith(β€œi am”); return (
{/* ── Brand header ── */}
Tahiti Kulia

Your Soul
Mission Statement

Select 20 values that feel most true to who you are. Your personal soul mission β€” a mantra written just for you β€” will be revealed.

{/* ══════════════════════════════════════════ PHASE 1 β€” VALUE SELECTION ══════════════════════════════════════════ */} {phase === "select" && ( <> {/* Progress bar */}
{selected.length} / {MAX}
{selected.length === MAX && (

Beautiful. Your constellation is complete.

)}
{VALUES.map(v => (
toggle(v)}>{v}
))}
{selected.length < MAX && (

{MAX - selected.length} more to go

)}
)} {/* ══════════════════════════════════════════ PHASE 2 β€” EMAIL GATE ══════════════════════════════════════════ */} {phase === "email" && (

Almost there…

Enter your name and email to receive your Soul Mission Statement β€” plus occasional offerings from Tahiti to support your path.

setName(e.target.value)} onKeyDown={e => e.key === "Enter" && handleEmailSubmit()} />
setEmail(e.target.value)} onKeyDown={e => e.key === "Enter" && handleEmailSubmit()} />
{emailError && (

{emailError}

)}

No spam, ever. Unsubscribe anytime.

)} {/* ══════════════════════════════════════════ PHASE 3 β€” RESULT + CTA ══════════════════════════════════════════ */} {phase === "result" && (
{/* Chosen values */}
{selected.map(v => ( {v} ))}

{/* Mission statement */}
{loading && (

Listening for your soul's voice…

)} {missionText && ( <>

{bodyLines.join(" ")}

{isReady && (

{mantraLine}

)} )}
{/* ── SESSION CTA ── */} {isReady && (
Ready to go deeper?

Your values are your map.
Let's learn to live them fully.

In a 1:1 session with Tahiti, we go beneath the surface β€” using breathwork, Human Design, and somatic tools to help you embody the truth your soul just named.

)} {/* Reset / regenerate */} {!loading && (
)}
)}
``` ); }