import { OnboardingForm } from './OnboardingForm'; interface PublicOnboardInfo { groupName: string; tenantName: string; policyVersion: string; defaultScopes: string[]; defaultRetentionDays: number; } export default async function OnboardPage({ searchParams, }: { searchParams: Promise<{ token?: string }>; }) { const { token } = await searchParams; if (!token) { return (

Invalid link

This onboarding link is missing the token parameter.

); } let info: PublicOnboardInfo | null = null; let error: string | null = null; try { const res = await fetch( `${process.env['API_URL'] ?? 'http://localhost:3001'}/public/onboard/${encodeURIComponent(token)}`, { headers: { Accept: 'application/json' }, cache: 'no-store' }, ); if (res.ok) { info = (await res.json()) as PublicOnboardInfo; } else { const body = (await res.json().catch(() => ({}))) as { message?: string }; error = body.message ?? `Onboarding link rejected (${res.status})`; } } catch (e) { error = e instanceof Error ? e.message : 'Network error'; } if (error || !info) { return (

Cannot start onboarding

{error ?? 'Unknown error'}

); } return (

Join {info.groupName}

Managed by {info.tenantName}

Policy version: {info.policyVersion} ยท Default retention: {info.defaultRetentionDays} days

); }