File
Description
Email Best Practices Configuration
Default email limits based on industry best practices and user comfort levels.
These are the base limits that apply to all users unless overridden.
|
quietHours
|
quietHours: literal type
|
Type : literal type
|
|
Optional
|
|
weekendPolicy
|
weekendPolicy: "send_all" | "skip_non_critical" | "skip_all"
|
Type : "send_all" | "skip_non_critical" | "skip_all"
|
export interface ParticipantEmailLimits {
daily: number; // Max emails per day
weekly: number; // Max emails per week
monthly: number; // Max emails per month
hourly: number; // Max emails per hour
batching: boolean; // Enable batching of related emails
aggregation: boolean; // Enable aggregation (participants don't need this)
quietHours?: {
start: number; // Hour (0-23)
end: number; // Hour (0-23)
};
weekendPolicy: 'send_all' | 'skip_non_critical' | 'skip_all';
}
export interface AdminEmailLimits {
daily: number; // Max emails per day (aggregated)
weekly: number; // Max emails per week
monthly: number; // Max emails per month
hourly: number; // Max emails per hour
batching: boolean; // Enable batching
aggregation: boolean; // Enable aggregation for admin emails
aggregationThreshold: number; // Aggregate if participant count > threshold
digestEnabled: boolean; // Enable daily digest
digestTime: string; // Digest send time (HH:mm format)
}
export interface EmailBestPractices {
participant: ParticipantEmailLimits;
admin: AdminEmailLimits;
}
/**
* Best Practices Configuration
*
* Based on user comfort levels:
* - Participants: 1-2 emails per day (comfortable)
* - Admins: 3-5 emails per day (aggregated)
*/
export const EMAIL_BEST_PRACTICES: EmailBestPractices = {
participant: {
daily: 2, // Max 2 emails per day (comfortable limit)
weekly: 10, // Max 10 emails per week
monthly: 30, // Max 30 emails per month
hourly: 1, // Max 1 email per hour
batching: true, // Enable batching of related emails
aggregation: false, // Participants don't need aggregation
quietHours: {
start: 22, // 10 PM
end: 7, // 7 AM
},
weekendPolicy: 'skip_non_critical', // Skip non-critical emails on weekends
},
admin: {
daily: 5, // Max 5 emails per day (aggregated)
weekly: 25, // Max 25 emails per week
monthly: 80, // Max 80 emails per month
hourly: 2, // Max 2 emails per hour
batching: false, // Admins don't need batching (they get aggregated)
aggregation: true, // Enable aggregation for admin emails
aggregationThreshold: 3, // Aggregate if >3 participants
digestEnabled: true, // Enable daily digest
digestTime: '09:00', // 9 AM daily digest
},
};
/**
* Absolute Maximum Limits (Safety Caps)
* These are hard limits that cannot be exceeded even with overrides.
*/
export const ABSOLUTE_MAX_LIMITS: EmailBestPractices = {
participant: {
daily: 5, // Never exceed 5 per day
weekly: 20, // Never exceed 20 per week
monthly: 60, // Never exceed 60 per month
hourly: 2, // Never exceed 2 per hour
batching: true,
aggregation: false,
quietHours: {
start: 22,
end: 7,
},
weekendPolicy: 'skip_non_critical',
},
admin: {
daily: 10, // Never exceed 10 per day
weekly: 50, // Never exceed 50 per week
monthly: 200, // Never exceed 200 per month
hourly: 5, // Never exceed 5 per hour
batching: false,
aggregation: true,
aggregationThreshold: 3,
digestEnabled: true,
digestTime: '09:00',
},
};