feat(p6): route-admin demo + route smoke; P6 verification green
Task 6.6: apps/route-admin (Vite, port 5176) — create bindings, simulate a message (preview-first, no send), see color-coded per-destination decisions with reason codes + preview, approve/deny REVIEW rows; built on the community-web SDK via CommunityProvider. scripts/smoke-route.mjs: 3 MANUAL bindings → 'party at 9 PM' → children(CHILD) DENY / adults+seniors REVIEW / 0 sends on simulate; approve → exactly one sandbox forward; AUTOMATIC safe binding auto-forwards via RouteProjector. P6 verification: 63 tests green, pnpm -r build all packages+demos, boundary passes and fails on community-web→service, route smoke PASS, prior smokes (realtime/inbox/support/adapter) PASS. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
import { createRoot } from 'react-dom/client';
|
||||
import { CommunityProvider } from '@insignia/iios-community-web';
|
||||
import { App, SERVICE } from './App';
|
||||
import { useEffect, useState } from 'react';
|
||||
|
||||
const APP_ID = 'portal-demo';
|
||||
|
||||
async function devToken(userId: string): Promise<string> {
|
||||
const r = await fetch(`${SERVICE}/v1/dev/token`, {
|
||||
method: 'POST',
|
||||
headers: { 'content-type': 'application/json' },
|
||||
body: JSON.stringify({ appId: APP_ID, userId, name: userId }),
|
||||
});
|
||||
if (!r.ok) throw new Error(`devToken ${r.status} (service running with IIOS_DEV_TOKENS=1?)`);
|
||||
return ((await r.json()) as { token: string }).token;
|
||||
}
|
||||
|
||||
function Root() {
|
||||
const [token, setToken] = useState<string | null>(null);
|
||||
useEffect(() => {
|
||||
void devToken('route-admin').then(setToken);
|
||||
}, []);
|
||||
if (!token) return <div style={{ padding: 16, fontFamily: 'sans-serif' }}>loading…</div>;
|
||||
return (
|
||||
<CommunityProvider serviceUrl={SERVICE} token={token}>
|
||||
<App token={token} />
|
||||
</CommunityProvider>
|
||||
);
|
||||
}
|
||||
|
||||
const el = document.getElementById('root');
|
||||
if (el) createRoot(el).render(<Root />);
|
||||
Reference in New Issue
Block a user