// Tatava Studio, Booking page: interactive 3-step intake → confirmation. // Uses Tatava DS form primitives (Input/Select/Textarea/Checkbox/Button). const TBK = window.TATAVA_DATA; const DS = window.TatavaStudioDesignSystem_6fc387; const { Input, Select, Textarea, Checkbox, Button } = DS; // Where the visitor came from: tracking tags on the link, else the referring site. const TRACK = (() => { try { const q = new URLSearchParams(window.location.search); const tags = ["utm_source", "utm_medium", "utm_campaign"].map((k) => q.get(k)).filter(Boolean).join("/"); const ref = document.referrer ? new URL(document.referrer).host : ""; return tags || (ref && ref !== window.location.host ? "ref:" + ref : ""); } catch (e) { return ""; } })(); const SOURCES = [ { value: "", label: "Choose one (optional)" }, { value: "Google search", label: "Google search" }, { value: "Google Maps", label: "Google Maps" }, { value: "Instagram", label: "Instagram" }, { value: "Facebook", label: "Facebook" }, { value: "LinkedIn", label: "LinkedIn" }, { value: "Doctor or therapist", label: "A doctor or therapist referred me" }, { value: "Friend or family", label: "A friend or family member" }, { value: "Directory", label: "Practo or another directory" }, { value: "Other", label: "Other" } ]; // Live availability: both endpoints read/write Aarti's Google Calendar via n8n. // The slots shown here are the calendar's real open slots, not a fixed list. const API = "https://stinger.tail06551e.ts.net:10000/webhook/"; const AVAILABILITY_URL = API + "tatava-availability"; const BOOK_URL = API + "tatava-book"; const STEPS = ["About you", "Time & mode", "Your details"]; function Stepper({ step }) { return (
{STEPS.map((label, i) => (
{i < step ? ( ) : (i + 1)} {label}
{i < STEPS.length - 1 ? : null}
))}
); } function ServiceChoice({ value, onChange }) { return (
{TBK.services.map((s) => ( ))}
); } function ModeChoice({ value, onChange }) { const opts = [ { id: "in-person", icon: "users", h: "In person", p: "At our Swasthya Vihar room, New Delhi." }, { id: "tele", icon: "wind", h: "Online (Tatava Connect)", p: "Secure video, from anywhere in India or abroad." } ]; return (
{opts.map((o) => ( ))}
); } function serviceLabel(id) { const s = TBK.services.find((x) => x.id === id); return s ? s.name : id; } // The day rail + slot grid, fed by the availability endpoint. Renders three // honest states: loading, unreachable (with a human fallback), and open days. function SlotPicker({ mode, date, time, onPick }) { const [state, setState] = React.useState({ status: "loading", days: [] }); React.useEffect(() => { let live = true; setState({ status: "loading", days: [] }); fetch(AVAILABILITY_URL + "?mode=" + encodeURIComponent(mode)) .then((r) => { if (!r.ok) throw new Error("availability " + r.status); return r.json(); }) .then((d) => { if (!live) return; const days = Array.isArray(d.days) ? d.days : []; setState({ status: "ready", days }); // Preselect the first open day so the grid is never empty on arrival. if (days.length) onPick(days[0].date, "", days[0].label); }) .catch(() => { if (live) setState({ status: "error", days: [] }); }); return () => { live = false; }; }, [mode]); if (state.status === "loading") { return (
Pick a day
); } if (state.status === "error") { return (
Pick a day

We could not load the live calendar just now. Please{" "} message us on WhatsApp{" "} or call {TBK.phoneDisplay} and we'll book you in directly.

); } if (!state.days.length) { return (
Pick a day

No open slots in the next three weeks for this format.{" "} Message us and we'll find you a time.

); } const selected = state.days.find((d) => d.date === date) || state.days[0]; return (
Pick a day · next 3 weeks
{state.days.map((d) => { const [, , dd] = d.date.split("-"); const mon = d.label.split(" ")[2]; return ( ); })}
Pick a time · {selected.label} · IST
{selected.slots.map((t) => ( ))}

50-minute session. These are Aarti's genuinely open slots, so the time you pick is the time you get.

); } function BookingForm() { const [step, setStep] = React.useState(0); const [sent, setSent] = React.useState(false); const [errors, setErrors] = React.useState({}); const [busy, setBusy] = React.useState(false); const [f, setF] = React.useState({ service: "stress-anxiety", note: "", mode: "in-person", date: "", dayLabel: "", time: "", name: "", contact: "", source: "", consent: false }); const set = (k, v) => setF((prev) => ({ ...prev, [k]: v })); // One stable callback, so SlotPicker's effect doesn't refire on every render. const pickSlot = React.useCallback((date, time, dayLabel) => { setF((prev) => ({ ...prev, date, time, dayLabel })); }, []); const next = () => setStep((s) => Math.min(2, s + 1)); const back = () => setStep((s) => Math.max(0, s - 1)); const canStep1 = !!f.service; const canStep2 = !!f.date && !!f.time; const submit = (e) => { e.preventDefault(); const errs = {}; if (!f.name.trim()) errs.name = "Please tell us your name."; if (!f.contact.trim()) errs.contact = "A phone or email so we can confirm."; if (!f.consent) errs.consent = "We need your consent to hold your details."; setErrors(errs); if (Object.keys(errs).length !== 0) return; setBusy(true); fetch(BOOK_URL, { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ name: f.name, contact: f.contact, service: serviceLabel(f.service), note: f.note, mode: f.mode, date: f.date, time: f.time, consent: f.consent, source: f.source, utm: TRACK, website: "" }) }) .then((r) => r.json().then((d) => ({ ok: r.ok, status: r.status, d }))) .then(({ ok, status, d }) => { setBusy(false); if (ok && d.ok) { setSent(true); return; } // 409: someone took the slot between the picker loading and this submit. if (status === 409) { setErrors({ slot: "Sorry, that slot was just taken. Please pick another time." }); setF((prev) => ({ ...prev, time: "" })); setStep(1); return; } setErrors({ slot: d.error || "We could not confirm that booking. Please try another slot." }); }) .catch(() => { setBusy(false); setErrors({ slot: "We could not reach the booking system. Please WhatsApp or call " + TBK.phoneDisplay + "." }); }); }; if (sent) { return (

You're booked, {f.name.split(" ")[0]}.

Your {f.mode === "in-person" ? "in-person" : "online"} session on {serviceLabel(f.service).toLowerCase()} is confirmed for {f.dayLabel} at {f.time} IST, 50 minutes. {f.contact.includes("@") ? " A calendar invite is on its way to your email." : " We'll message you the details shortly."} {" "}Take care of yourself in the meantime.

Back to home Message on WhatsApp

Consultation By Appointment Only

); } return (
{step === 0 && (

What brings you in?

Pick the closest fit, we'll talk through the details on the call. There's no wrong answer.

set("service", v)} />