teqo/src/lib/campaignConsentKeys.ts
Francisco Solla 2eab8dc07b
All checks were successful
CI (PR) / checks (pull_request) Successful in 8m33s
PR Ready + auto-merge / ready-automerge (pull_request) Successful in 17m6s
Promote plan-issue Related on main merge / plan-issue-ready (pull_request) Has been skipped
Main merge flips claimed issues to done + in-prod / issue-done (pull_request) Successful in 13s
feat(S9): captura de novidades da campanha na home pública (form + CTA do hero)
Seção 'Receba as novidades da campanha' acima do rodapé: nome + WhatsApp
obrigatórios, e-mail/estado/cidade/comentário opcionais, toggle pré-selecionado
'Quero fazer parte do time' gravado como subscription.campaignLevel
(time|esporadico). CTA secundário do hero vira o atalho (#novidades, scroll
suave). Contact + Subscription em withPayloadTransaction com consentimento
novo fail-closed por chave estável 'campanha-novidades' — nada é gravado sem o
texto aprovado no admin. Migration 20260819_192605 (state de contact nullable
+ coluna campaign_level). Impl plan, changelog, int + e2e.
2026-08-19 17:24:44 -03:00

40 lines
1.8 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.'
/**
* 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.'