/* ============================================================ page-bots.jsx — Bot management: list, provision, register ============================================================ */ /* Re-bind parseDetail from primitives.jsx (defined there, exported via window) */ const parseDetail = window.parseDetail || ((body, status) => body?.message || `HTTP ${status}`); /* ── Password once callout ── */ function PasswordOnceCallout({ password, onConfirmed }) { const [copied, setCopied] = useState(false); const [confirmed, setConf] = useState(false); const copy = async () => { try { await navigator.clipboard.writeText(password); setCopied(true); setTimeout(() => setCopied(false), 2000); } catch (_e) { // Fallback for HTTP origins / Safari quirks. const ta = document.createElement('textarea'); ta.value = password; ta.setAttribute('readonly', ''); ta.style.position = 'absolute'; ta.style.left = '-9999px'; document.body.appendChild(ta); ta.select(); let ok = false; try { ok = document.execCommand && document.execCommand('copy'); } catch (_) { ok = false; } document.body.removeChild(ta); if (ok) { setCopied(true); setTimeout(() => setCopied(false), 2000); } else alert((window.appT||(s=>s))('Copy failed. Select the password manually and copy with Cmd/Ctrl+C.')); } }; return (
{password}
{(window.appT||(s=>s))('Permanently delete')} {bot.name}{(window.appT||(s=>s))('? This cannot be undone. Any rooms assigned to this bot will lose their bot assignment.')}
{err &&