mirror of
https://github.com/pacnpal/thrilltrack-explorer.git
synced 2025-12-24 04:31:13 -05:00
feat: Implement notifications modernization
This commit is contained in:
78
src/types/notifications.ts
Normal file
78
src/types/notifications.ts
Normal file
@@ -0,0 +1,78 @@
|
||||
/**
|
||||
* Notification Type Definitions
|
||||
*
|
||||
* Centralized types for notification system.
|
||||
* Follows project patterns for type safety and validation.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Channel preferences for receiving notifications
|
||||
*/
|
||||
export interface ChannelPreferences {
|
||||
in_app: boolean;
|
||||
email: boolean;
|
||||
push: boolean;
|
||||
sms: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* Per-workflow notification preferences
|
||||
*/
|
||||
export interface WorkflowPreferences {
|
||||
[workflowId: string]: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* Notification frequency control settings
|
||||
*/
|
||||
export interface FrequencySettings {
|
||||
digest: 'realtime' | 'hourly' | 'daily' | 'weekly';
|
||||
max_per_hour: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* Complete notification preferences structure
|
||||
*/
|
||||
export interface NotificationPreferences {
|
||||
channelPreferences: ChannelPreferences;
|
||||
workflowPreferences: WorkflowPreferences;
|
||||
frequencySettings: FrequencySettings;
|
||||
}
|
||||
|
||||
/**
|
||||
* Notification template from database
|
||||
*/
|
||||
export interface NotificationTemplate {
|
||||
id: string;
|
||||
workflow_id: string;
|
||||
novu_workflow_id: string | null;
|
||||
name: string;
|
||||
description: string | null;
|
||||
category: string;
|
||||
is_active: boolean;
|
||||
created_at: string;
|
||||
updated_at: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Subscriber data for Novu
|
||||
*/
|
||||
export interface SubscriberData {
|
||||
subscriberId: string;
|
||||
email?: string;
|
||||
firstName?: string;
|
||||
lastName?: string;
|
||||
phone?: string;
|
||||
avatar?: string;
|
||||
data?: Record<string, any>;
|
||||
}
|
||||
|
||||
/**
|
||||
* Notification payload for triggering workflows
|
||||
*/
|
||||
export interface NotificationPayload {
|
||||
workflowId: string;
|
||||
subscriberId: string;
|
||||
payload: Record<string, any>;
|
||||
overrides?: Record<string, any>;
|
||||
}
|
||||
Reference in New Issue
Block a user