mirror of
https://github.com/fsolla/teqo.git
synced 2026-11-13 06:43:06 +00:00
openCampaignNotifications (lista + marca em 1 round trip) substitui listCampaignNotifications + markAllCampaignNotificationsRead; markAllNotificationsRead extraída (owner-scoped, idempotente, cap 200) com int test; bell vira Dialog desktop / Drawer mobile (par C94), sem título/rodapé/botões, skeleton de loading, safe-area, focus-visible, role=alert; readAt sai do contrato do item; P4-D ledger atualizado (batch sem transação agora no hot path, self-healing).
34 lines
982 B
TypeScript
34 lines
982 B
TypeScript
/** Payload `req.context` flag — domain hooks skip creating notifications when true. */
|
|
export const SKIP_CAMPAIGN_NOTIFICATION_CONTEXT_KEY = 'skipCampaignNotification'
|
|
|
|
/** Opt back into hook-fired notifications inside Vitest (default: skipped). */
|
|
export const ENABLE_CAMPAIGN_NOTIFICATION_CONTEXT_KEY = 'enableCampaignNotification'
|
|
|
|
export const notificationTypes = [
|
|
'municipality_update',
|
|
'new_supporter',
|
|
'activity_attention',
|
|
'invite_accepted',
|
|
] as const
|
|
|
|
export type NotificationType = (typeof notificationTypes)[number]
|
|
|
|
export type NotificationPayload = {
|
|
title: string
|
|
detail: string
|
|
href: string
|
|
}
|
|
|
|
export type NotificationListItem = {
|
|
id: number
|
|
type: NotificationType
|
|
payload: NotificationPayload
|
|
createdAt: string
|
|
}
|
|
|
|
export const notificationTypeLabels: Record<NotificationType, string> = {
|
|
municipality_update: 'Reporte de campo',
|
|
new_supporter: 'Novo apoiador',
|
|
activity_attention: 'Atividade',
|
|
invite_accepted: 'Convite aceito',
|
|
}
|