'use client'; import { useState } from 'react'; type Status = 'ACTIVE' | 'DISCONNECTED' | 'BANNED' | 'PAIRING'; interface BotSummary { id: string; jid: string | null; displayName: string | null; status: Status; } export function BotSettingsCard({ initial }: { initial: { bot: BotSummary | null; shared: boolean; sharedBotId?: string } }) { const [bot, setBot] = useState(initial.bot); const [revealedJid, setRevealedJid] = useState(null); const [error, setError] = useState(null); async function onReveal() { setError(null); const res = await fetch('/api/bot/reveal', { method: 'POST', credentials: 'include', }); if (res.ok) { const data = (await res.json()) as { jid: string }; setRevealedJid(data.jid); } else { setError('Reveal failed'); } } if (!bot) { return (

Bot

No bot assigned yet. Contact your platform administrator to get one assigned.

); } return (

Bot

{bot.status}
Number:
{revealedJid ?? (bot.jid ? '••••••••••' : '—')} {!revealedJid && bot.status === 'ACTIVE' && ( )}
Display name:
{bot.displayName ?? '—'}

Bot is assigned by the platform administrator. Contact support to change or remove it.

{error &&

{error}

}
); }