feat(notifications): Phase B-2 — per-event-type granular preferences
This commit is contained in:
@@ -721,16 +721,38 @@ export type NotificationsResponse = {
|
||||
}
|
||||
|
||||
/**
|
||||
* Phase B — per-channel notification opt-in/out для current user. Backend
|
||||
* endpoint: GET/PUT /api/v1/me/notifications/preferences. Default semantics
|
||||
* (server-side, when row missing): email=true, express=false, telegram=false.
|
||||
* Phase B-2 — per-(eventType, channel) notification opt-in/out для current
|
||||
* user. Backend endpoint: GET/PUT /api/v1/me/notifications/preferences.
|
||||
*
|
||||
* <p>Express/Telegram channels пока not wired backend-side — toggles в UI
|
||||
* disabled с tooltip 'Скоро'. Email — единственный фактически работающий
|
||||
* канал в Phase A/B.
|
||||
* <p>Matrix shape: 4 known event types × 3 channels = 12 toggles. User может
|
||||
* opt-out 'Submitted via email' (queue noise) keep 'Approved via email'
|
||||
* (action confirmation).
|
||||
*
|
||||
* <p>Defaults (server-side, для missing rows):
|
||||
* email=true, express=false, telegram=false.
|
||||
*
|
||||
* <p>Resolution для каждой ячейки: specific row → wildcard '*' (Phase B
|
||||
* compat) → default policy.
|
||||
*
|
||||
* <p>Express/Telegram channels не wired backend-side — toggles в UI disabled.
|
||||
*/
|
||||
export type NotificationPreferences = {
|
||||
export type ChannelToggles = {
|
||||
email: boolean
|
||||
express: boolean
|
||||
telegram: boolean
|
||||
}
|
||||
|
||||
/** Map keyed по event type. Backend сейчас возвращает 4 known events. */
|
||||
export type NotificationPreferences = Record<string, ChannelToggles>
|
||||
|
||||
/**
|
||||
* Canonical event types — должны совпадать с backend
|
||||
* MeNotificationsPreferencesController.KNOWN_EVENT_TYPES.
|
||||
*/
|
||||
export const NOTIFICATION_EVENT_TYPES = [
|
||||
'RecordDraftSubmitted',
|
||||
'RecordDraftApproved',
|
||||
'RecordDraftRejected',
|
||||
'RecordDraftWithdrawn',
|
||||
] as const
|
||||
export type NotificationEventType = (typeof NOTIFICATION_EVENT_TYPES)[number]
|
||||
|
||||
Reference in New Issue
Block a user