From 776c25c3deb5dcba495088bb530b072d5aa0bb5d Mon Sep 17 00:00:00 2001 From: VPS 4 Builder Date: Sun, 28 Jun 2026 17:59:08 +0200 Subject: [PATCH] =?UTF-8?q?docs(newwhats):=20frontend=20(plugin/views)=20+?= =?UTF-8?q?=20pend=C3=AAncias=20(proxy=20auth,=20ponte=20de=20config)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Opus 4.8 --- backend/newwhats/INTEGRACAO-MOTOR.md | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/backend/newwhats/INTEGRACAO-MOTOR.md b/backend/newwhats/INTEGRACAO-MOTOR.md index fdcd8cf..f0d5d09 100644 --- a/backend/newwhats/INTEGRACAO-MOTOR.md +++ b/backend/newwhats/INTEGRACAO-MOTOR.md @@ -41,10 +41,27 @@ - **Motor → Satélite**: webhook `POST /api/webhook/newwhats` (HMAC `webhook_secret`); Secretária consulta `/nw/*` (`integration_key`). +## Frontend (React SPA) +- Plugin `newwhats` registrado em `frontend/views/PluginsView.tsx` (catálogo + PLUGINS) — **config exclusiva do superadmin** (a view `plugins` já é gateada em + `App.tsx isViewAllowed`). +- `ALWAYS_ON` em `pluginRegistry.ts` → Inbox/Secretária aparecem para **todos** os + usuários (a ativação por plugin é localStorage e não propaga entre contas). +- Views: `frontend/views/WaInboxView.tsx` (conversas/thread/envio) e + `WaSecretariaView.tsx` (ask) — consomem `/api/nw/v1/*`. **Estágio 1** (funcional, + visual aproximado do motor; refinar para ficar idêntico). +- Sidebar: itens WHATSAPP + SECRETÁRIA IA (gated por `isPluginActive('newwhats')`). + ## Pendências / TODO +- [ ] **Segurança**: gatear o proxy `/api/nw/v1/*` com a auth do scoreodonto (hoje + aberto — qualquer um que alcance a rota é proxiado ao motor). +- [ ] **Ponte de config**: a config do plugin no frontend é localStorage e **não + chega ao backend** (que lê ENV). Definir: backend ler de `settings`/DB + UI + salvar lá (endpoint), OU manter ENV no deploy (UI só informativa). - [ ] `webhook message.new`: capturar lead / acionar fluxo (hoje só loga). -- [ ] Proxy WS (`/api/nw/v1/stream`) — só o REST foi portado. +- [ ] Proxy WS (`/api/nw/v1/stream`) — só o REST foi portado (Inbox sem tempo real). - [ ] Parear scoreodonto com o motor (criar apiKey/pair + agente) e preencher as ENV. - [ ] Endpoint/admin para disparar `syncKnowledge` (hoje exportado, sem rota). +- [ ] Refinar Inbox/Secretária para ficarem idênticas ao motor. > Fonte da verdade do contrato: `documentos-unicos/projetos/newwhats.clube67.com/`.