teqo-backup/src/lib/campaignConsentKeys.ts
Francisco Solla cd4942d9e2 feat(C242/C243): abre a busca por selfie a qualquer visitante (escopo B) + seção na homepage
O escopo A/C do gate (PR #1370) é superado por decisão do dono (2026-10-01, aval jurídico declarado): o índice vira anônimo (archivePhotoFace, foto + descritor 128-d, sem nome/vínculo), o enrollment por pessoa morre (faceSubject/faces:enroll removidos) e qualquer visitante encontra as próprias fotos aprovadas.

- faces:index persiste os descritores por foto (transação substitui as linhas + marker = modelo); desaprovar/remover/deletar foto apaga os descritores (hooks + FK cascade)
- POST /api/fotos/selfie casa o vetor da consulta contra o índice em memória (TTL 60 s) e devolve só a interseção com o read aprovado do C233, sem score/nome de terceiro; leave-index apaga os descritores que casarem
- Consentimentos seguem fail-closed: busca-selfie-fotos (consulta) e busca-selfie-indice (aviso público do índice), textos versionados em scripts/lib/faceConsentTexts.mjs e provisionados por pnpm seed:face-consents
- pnpm archive:publish aprova o acervo em lote (draft -> approved; removed nunca) com guardas e recibo
- C243: seção condicional SelfieSearchHomeSection (port do design hi-fi, cenas 390/1280) entre a Central e a newsletter; sem engine/captura na home e sem CTA morto quando fechada
- docs: planos C242/C243, AGENTS-public, runbook §C242, changelog

Provas: gate:fast 457 arquivos/5.055 testes; int full 109/1.075; e2e frontendFotosSelfie 9/9; knip verde.
2026-10-01 12:54:47 -03:00

54 lines
2.7 KiB
TypeScript

/**
* Stable LGPD consent keys the app resolves at runtime (fail-closed: the flows
* refuse to run while the admin has not created the Consent row with the exact
* key). Client-safe constants — the resolution logic lives in
* `src/utilities/campaignConsent.ts` (server-only).
*/
export const CAMPAIGN_INVITE_CONSENT_KEY = 'lideranca-autopreenchimento'
export const SUPPORTER_REGISTRATION_CONSENT_KEY = 'apoiador-cadastro'
export const SUPPORTER_VOTE_INTENTION_CONSENT_KEY = 'apoiador-intencao-voto'
/**
* Fail-closed refusals shown while the keyed Consent row is missing — matched
* verbatim by the routes' `safeMessages`, so they live next to their keys.
*/
export const SUPPORTER_REGISTRATION_CONSENT_MISSING_MESSAGE =
'Consentimento de cadastro de apoiador ainda não configurado.'
export const SUPPORTER_VOTE_INTENTION_CONSENT_MISSING_MESSAGE =
'Consentimento de intenção de voto ainda não configurado.'
/**
* Public-site WhatsApp subscription consent. Historically the flow hardcoded
* `consent: 2`; migration `20260725_170000_whatsapp_subscription_consent_key`
* tags that live document with this stable key (Pass 2 D3).
*/
export const WHATSAPP_SUBSCRIPTION_CONSENT_KEY = 'whatsapp-inscricao'
export const CAMPAIGN_PUSH_CONSENT_KEY = 'campanha-notificacoes-push'
export const CAMPAIGN_PUSH_CONSENT_MISSING_MESSAGE =
'Consentimento de notificações push ainda não configurado.'
/**
* C242 — the public selfie search on the photo album (scope B: the anonymous
* descriptor index of the approved archive). Two keys because the two
* biometric documents are distinct: `FACE_SEARCH_CONSENT_KEY` is the visitor's
* consent for the temporary use of their own face in this query (the vector is
* discarded with the request), while `FACE_INDEX_CONSENT_KEY` is the PUBLIC
* NOTICE of the anonymous archive index (transparency + self-service opt-out;
* there is no per-person enrollment). Both fail closed: without the Consent row
* with the exact key the flow is closed, and the texts are versioned in
* `scripts/lib/faceConsentTexts.mjs` (provisioned by `pnpm seed:face-consents`).
*/
export const FACE_SEARCH_CONSENT_KEY = 'busca-selfie-fotos'
export const FACE_INDEX_CONSENT_KEY = 'busca-selfie-indice'
/**
* S9 — campaign home "novidades" capture (name + WhatsApp, engagement level
* toggle). Fail-closed like every public flow: while the admin has not created
* the Consent row with this key (jurídico-approved text pending), the form
* refuses to record anything.
*/
export const CAMPAIGN_NEWSLETTER_CONSENT_KEY = 'campanha-novidades'
export const CAMPAIGN_NEWSLETTER_CONSENT_MISSING_MESSAGE =
'Consentimento de novidades da campanha ainda não configurado.'