/** * Client for "Vāṇī of the Day" — the home page's daily content pick. * * Public endpoint (no auth): the BFF returns the same pick to everyone for the * current day, chosen from a prose chapter, verse, or transcript and not * repeated within 90 days. */ const BFF_BASE = process.env.NEXT_PUBLIC_BFF_URL || "http://localhost:8080"; export type Vani = { kind: "verse" | "prose" | "transcript"; label: string; // "Verse" | "Chapter" | "Lecture" | "Conversation" title: string; subtitle: string; href: string; book_title?: string; date?: string; // transcript date, for the "Lecture • DATE" line }; type Envelope = { success?: boolean; data?: T }; export async function getVaniOfTheDay(): Promise { try { const res = await fetch(`${BFF_BASE}/api/v1/vani/today`, { headers: { Accept: "application/json" }, }); if (!res.ok) return null; const body = (await res.json().catch(() => ({}))) as Envelope; return body.data ?? null; } catch { return null; } }