UNPKG

notification-kit

Version:

A unified notification library for React + Capacitor apps. One API for push notifications, in-app notifications, and local notifications across Web, iOS, and Android.

644 lines 19.5 kB
export interface NotificationChannel { id: string; name: string; description?: string; importance: ChannelImportance; visibility?: ChannelVisibility; sound?: string; vibration?: boolean; vibrationPattern?: number[]; lights?: boolean; lightColor?: string; badge?: boolean; bypassDnd?: boolean; showOnLockScreen?: boolean; group?: string; conversationId?: string; enableVibration?: boolean; enableLights?: boolean; lockscreenVisibility?: ChannelLockscreenVisibility; soundUri?: string; audioAttributes?: AudioAttributes; blockedByUser?: boolean; canBypassDnd?: boolean; canShowBadge?: boolean; hasUserSetImportance?: boolean; hasUserSetSound?: boolean; shouldShowLights?: boolean; shouldVibrate?: boolean; metadata?: ChannelMetadata; } export type ChannelImportance = 'none' | 'min' | 'low' | 'default' | 'high' | 'max'; export type ChannelVisibility = 'public' | 'private' | 'secret'; export type ChannelLockscreenVisibility = 'public' | 'private' | 'secret' | 'no_override'; export type ChannelLockScreenVisibility = ChannelLockscreenVisibility; export interface AudioAttributes { usage: AudioUsage; contentType: AudioContentType; flags?: AudioFlags[]; hapticChannelsMuted?: boolean; allowedCapturePolicy?: AudioCapturePolicy; spatializationBehavior?: AudioSpatializationBehavior; tags?: string[]; } export type AudioUsage = 'unknown' | 'media' | 'voice_communication' | 'voice_communication_signalling' | 'alarm' | 'notification' | 'notification_ringtone' | 'notification_communication_request' | 'notification_communication_instant' | 'notification_communication_delayed' | 'notification_event' | 'assistance_accessibility' | 'assistance_navigation_guidance' | 'assistance_sonification' | 'game' | 'virtual_source' | 'assistant'; export type AudioContentType = 'unknown' | 'speech' | 'music' | 'movie' | 'sonification'; export type AudioFlags = 'audibility_enforced' | 'secure' | 'scn_cpn_microphone' | 'beacon' | 'hw_av_sync' | 'hw_hotword' | 'bypass_interruption_policy' | 'bypass_mute' | 'low_latency' | 'deep_buffer' | 'no_media_projection' | 'mute_haptic' | 'no_system_capture' | 'capture_private'; export type AudioCapturePolicy = 'allow' | 'disallow' | 'disallow_capture_by_system'; export type AudioSpatializationBehavior = 'auto' | 'never'; export interface ChannelMetadata { createdAt: Date; updatedAt: Date; version: number; createdBy?: string; tags?: string[]; category?: string; priority?: number; archived?: boolean; template?: string; parentChannelId?: string; childChannelIds?: string[]; usage?: ChannelUsage; analytics?: ChannelAnalytics; customData?: Record<string, any>; } export interface ChannelUsage { totalNotifications: number; uniqueNotifications: number; deliveredNotifications: number; openedNotifications: number; dismissedNotifications: number; blockedNotifications: number; lastUsed?: Date; averageDeliveryTime: number; peakUsageHour: number; dailyUsage: number[]; weeklyUsage: number[]; monthlyUsage: number[]; } export interface ChannelAnalytics { impressions: number; clicks: number; conversions: number; conversionRate: number; engagementRate: number; retentionRate: number; unsubscribeRate: number; bounceRate: number; timeToAction: number; sessionDuration: number; pageViews: number; uniqueUsers: number; returningUsers: number; demographics: ChannelDemographics; devices: ChannelDevices; locations: ChannelLocations; timeZones: ChannelTimeZones; } export interface ChannelDemographics { ageGroups: Record<string, number>; genders: Record<string, number>; languages: Record<string, number>; countries: Record<string, number>; interests: Record<string, number>; } export interface ChannelDevices { platforms: Record<string, number>; browsers: Record<string, number>; osVersions: Record<string, number>; appVersions: Record<string, number>; deviceTypes: Record<string, number>; screenSizes: Record<string, number>; } export interface ChannelLocations { countries: Record<string, number>; states: Record<string, number>; cities: Record<string, number>; regions: Record<string, number>; coordinates: LocationCoordinate[]; } export interface LocationCoordinate { latitude: number; longitude: number; count: number; timestamp: Date; } export interface ChannelTimeZones { zones: Record<string, number>; activeHours: Record<string, number>; peakHours: Record<string, number>; seasonality: Record<string, number>; } export interface NotificationChannelGroup { id: string; name: string; description?: string; channels: string[]; blocked?: boolean; importance?: ChannelImportance; sound?: string; vibration?: boolean; lights?: boolean; badge?: boolean; metadata?: ChannelGroupMetadata; } export interface ChannelGroupMetadata { createdAt: Date; updatedAt: Date; version: number; createdBy?: string; tags?: string[]; category?: string; priority?: number; archived?: boolean; usage?: ChannelGroupUsage; analytics?: ChannelGroupAnalytics; customData?: Record<string, any>; } export interface ChannelGroupUsage { totalChannels: number; activeChannels: number; totalNotifications: number; averageNotificationsPerChannel: number; lastUsed?: Date; mostUsedChannel?: string; leastUsedChannel?: string; usage: ChannelUsage; } export interface ChannelGroupAnalytics { performance: ChannelGroupPerformance; engagement: ChannelGroupEngagement; trends: ChannelGroupTrends; comparisons: ChannelGroupComparisons; } export interface ChannelGroupPerformance { deliveryRate: number; openRate: number; clickRate: number; conversionRate: number; unsubscribeRate: number; bounceRate: number; averageDeliveryTime: number; averageResponseTime: number; errorRate: number; successRate: number; } export interface ChannelGroupEngagement { totalEngagements: number; uniqueEngagements: number; averageEngagementTime: number; engagementRate: number; interactionTypes: Record<string, number>; contentTypes: Record<string, number>; engagementPatterns: EngagementPattern[]; } export interface EngagementPattern { type: string; frequency: number; duration: number; timeOfDay: number; dayOfWeek: number; seasonality: number; } export interface ChannelGroupTrends { growth: TrendData[]; usage: TrendData[]; performance: TrendData[]; engagement: TrendData[]; predictions: TrendPrediction[]; } export interface TrendData { date: Date; value: number; change: number; changePercentage: number; forecast?: number; confidence?: number; } export interface TrendPrediction { metric: string; prediction: number; confidence: number; timeframe: string; factors: string[]; } export interface ChannelGroupComparisons { benchmarks: ChannelGroupBenchmark[]; competitors: ChannelGroupCompetitor[]; historical: ChannelGroupHistorical[]; } export interface ChannelGroupBenchmark { metric: string; value: number; benchmark: number; industry: string; percentile: number; status: 'above' | 'below' | 'at'; } export interface ChannelGroupCompetitor { name: string; metric: string; value: number; comparison: number; status: 'better' | 'worse' | 'similar'; } export interface ChannelGroupHistorical { period: string; metrics: Record<string, number>; comparison: Record<string, number>; trends: Record<string, 'up' | 'down' | 'stable'>; } export interface ChannelSettings { defaultImportance: ChannelImportance; defaultVisibility: ChannelVisibility; defaultSound: string; defaultVibration: boolean; defaultLights: boolean; defaultBadge: boolean; autoCreateChannels: boolean; channelPrefix: string; channelSuffix: string; maxChannels: number; cleanupInterval: number; archiveOldChannels: boolean; archiveThreshold: number; migrateChannels: boolean; backupChannels: boolean; validateChannels: boolean; optimizeChannels: boolean; monitorChannels: boolean; reportChannels: boolean; customDefaults: Record<string, Partial<NotificationChannel>>; } export interface ChannelOperations { create: (channel: Omit<NotificationChannel, 'metadata'>) => Promise<NotificationChannel>; update: (id: string, updates: Partial<NotificationChannel>) => Promise<NotificationChannel>; delete: (id: string) => Promise<void>; get: (id: string) => Promise<NotificationChannel | null>; list: (options?: ChannelListOptions) => Promise<NotificationChannel[]>; exists: (id: string) => Promise<boolean>; clone: (id: string, newId: string) => Promise<NotificationChannel>; archive: (id: string) => Promise<void>; restore: (id: string) => Promise<void>; reset: (id: string) => Promise<void>; validate: (channel: NotificationChannel) => Promise<ChannelValidationResult>; migrate: (from: string, to: string) => Promise<void>; backup: (ids?: string[]) => Promise<string>; restoreBackup: (backup: string) => Promise<void>; optimize: (id: string) => Promise<ChannelOptimization>; monitor: (id: string) => Promise<ChannelMonitoring>; analyze: (id: string) => Promise<ChannelAnalysis>; compare: (ids: string[]) => Promise<ChannelComparison>; export: (ids: string[], format: string) => Promise<string>; import: (data: string, format: string) => Promise<string[]>; } export interface ChannelListOptions { filter?: ChannelFilter; sort?: ChannelSort; pagination?: ChannelPagination; include?: ChannelInclude; } export interface ChannelFilter { importance?: ChannelImportance[]; visibility?: ChannelVisibility[]; group?: string[]; blocked?: boolean; archived?: boolean; tags?: string[]; category?: string[]; createdAfter?: Date; createdBefore?: Date; updatedAfter?: Date; updatedBefore?: Date; usageMin?: number; usageMax?: number; search?: string; } export interface ChannelSort { field: 'name' | 'importance' | 'createdAt' | 'updatedAt' | 'usage'; direction: 'asc' | 'desc'; } export interface ChannelPagination { page: number; limit: number; offset?: number; } export interface ChannelInclude { metadata?: boolean; usage?: boolean; analytics?: boolean; group?: boolean; notifications?: boolean; } export interface ChannelValidationResult { valid: boolean; errors: ChannelValidationError[]; warnings: ChannelValidationWarning[]; suggestions: ChannelValidationSuggestion[]; } export interface ChannelValidationError { field: string; message: string; code: string; value: any; } export interface ChannelValidationWarning { field: string; message: string; code: string; value: any; severity: 'low' | 'medium' | 'high'; } export interface ChannelValidationSuggestion { field: string; message: string; code: string; suggestion: any; benefit: string; } export interface ChannelOptimization { recommendations: ChannelOptimizationRecommendation[]; impact: ChannelOptimizationImpact; implementation: ChannelOptimizationImplementation; } export interface ChannelOptimizationRecommendation { type: 'performance' | 'engagement' | 'delivery' | 'conversion' | 'retention'; priority: 'low' | 'medium' | 'high' | 'critical'; description: string; benefit: string; effort: 'low' | 'medium' | 'high'; timeframe: string; dependencies: string[]; risks: string[]; } export interface ChannelOptimizationImpact { performance: number; engagement: number; delivery: number; conversion: number; retention: number; cost: number; resource: number; complexity: number; } export interface ChannelOptimizationImplementation { steps: ChannelOptimizationStep[]; timeline: ChannelOptimizationTimeline; resources: ChannelOptimizationResource[]; monitoring: ChannelOptimizationMonitoring; } export interface ChannelOptimizationStep { id: string; name: string; description: string; priority: number; estimated_time: number; dependencies: string[]; resources: string[]; status: 'pending' | 'in_progress' | 'completed' | 'failed'; } export interface ChannelOptimizationTimeline { start: Date; end: Date; milestones: ChannelOptimizationMilestone[]; phases: ChannelOptimizationPhase[]; } export interface ChannelOptimizationMilestone { id: string; name: string; date: Date; description: string; criteria: string[]; status: 'pending' | 'completed' | 'missed'; } export interface ChannelOptimizationPhase { id: string; name: string; start: Date; end: Date; description: string; goals: string[]; metrics: string[]; status: 'pending' | 'in_progress' | 'completed' | 'failed'; } export interface ChannelOptimizationResource { type: 'human' | 'technical' | 'financial' | 'time'; name: string; quantity: number; unit: string; cost: number; availability: Date; requirements: string[]; } export interface ChannelOptimizationMonitoring { metrics: string[]; frequency: string; thresholds: Record<string, number>; alerts: ChannelOptimizationAlert[]; reports: ChannelOptimizationReport[]; } export interface ChannelOptimizationAlert { metric: string; threshold: number; condition: 'above' | 'below' | 'equal'; actions: string[]; recipients: string[]; frequency: string; } export interface ChannelOptimizationReport { name: string; frequency: string; metrics: string[]; format: string; recipients: string[]; template: string; } export interface ChannelMonitoring { health: ChannelHealth; performance: ChannelPerformance; alerts: ChannelAlert[]; trends: ChannelTrend[]; } export interface ChannelHealth { status: 'healthy' | 'warning' | 'critical'; score: number; issues: ChannelIssue[]; recommendations: string[]; lastCheck: Date; nextCheck: Date; } export interface ChannelPerformance { delivery: number; open: number; click: number; conversion: number; unsubscribe: number; bounce: number; response_time: number; throughput: number; error_rate: number; success_rate: number; } export interface ChannelAlert { id: string; type: 'info' | 'warning' | 'error' | 'critical'; message: string; timestamp: Date; metric: string; value: number; threshold: number; resolved: boolean; actions: string[]; } export interface ChannelTrend { metric: string; direction: 'up' | 'down' | 'stable'; change: number; changePercentage: number; period: string; forecast: number; confidence: number; } export interface ChannelIssue { id: string; type: 'configuration' | 'performance' | 'delivery' | 'engagement'; severity: 'low' | 'medium' | 'high' | 'critical'; message: string; timestamp: Date; resolved: boolean; resolution: string; impact: string; recommendations: string[]; } export interface ChannelAnalysis { summary: ChannelAnalysisSummary; detailed: ChannelAnalysisDetailed; insights: ChannelAnalysisInsight[]; recommendations: ChannelAnalysisRecommendation[]; } export interface ChannelAnalysisSummary { totalNotifications: number; deliveryRate: number; openRate: number; clickRate: number; conversionRate: number; unsubscribeRate: number; averageEngagementTime: number; topPerformingContent: string[]; lowPerformingContent: string[]; trendsDirection: 'positive' | 'negative' | 'stable'; overallScore: number; } export interface ChannelAnalysisDetailed { demographics: ChannelDemographics; devices: ChannelDevices; locations: ChannelLocations; timeZones: ChannelTimeZones; content: ChannelContentAnalysis; timing: ChannelTimingAnalysis; frequency: ChannelFrequencyAnalysis; segmentation: ChannelSegmentationAnalysis; } export interface ChannelContentAnalysis { types: Record<string, number>; topics: Record<string, number>; sentiment: Record<string, number>; length: Record<string, number>; media: Record<string, number>; actions: Record<string, number>; performance: Record<string, ChannelPerformance>; } export interface ChannelTimingAnalysis { optimalHours: number[]; optimalDays: number[]; optimalMonths: number[]; timeZonePreferences: Record<string, number>; seasonalPatterns: Record<string, number>; responseTimeDistribution: Record<string, number>; } export interface ChannelFrequencyAnalysis { optimal: number; current: number; saturation: number; engagement: Record<number, number>; unsubscribe: Record<number, number>; recommendations: string[]; } export interface ChannelSegmentationAnalysis { segments: ChannelSegment[]; performance: Record<string, ChannelPerformance>; preferences: Record<string, Record<string, number>>; behavior: Record<string, Record<string, number>>; } export interface ChannelSegment { id: string; name: string; description: string; size: number; criteria: Record<string, any>; characteristics: Record<string, any>; performance: ChannelPerformance; } export interface ChannelAnalysisInsight { type: 'opportunity' | 'risk' | 'trend' | 'anomaly'; priority: 'low' | 'medium' | 'high' | 'critical'; title: string; description: string; impact: string; confidence: number; data: Record<string, any>; actions: string[]; } export interface ChannelAnalysisRecommendation { type: 'content' | 'timing' | 'frequency' | 'segmentation' | 'technical'; priority: 'low' | 'medium' | 'high' | 'critical'; title: string; description: string; benefit: string; effort: 'low' | 'medium' | 'high'; timeframe: string; implementation: string[]; metrics: string[]; expected_impact: Record<string, number>; } export interface ChannelComparison { channels: string[]; metrics: Record<string, Record<string, number>>; rankings: Record<string, string[]>; insights: ChannelComparisonInsight[]; recommendations: ChannelComparisonRecommendation[]; } export interface ChannelComparisonInsight { metric: string; leader: string; laggard: string; gap: number; trend: 'widening' | 'narrowing' | 'stable'; significance: 'low' | 'medium' | 'high'; explanation: string; } export interface ChannelComparisonRecommendation { channel: string; action: string; justification: string; expected_improvement: number; timeframe: string; resources: string[]; } export interface ChannelSound { sound?: string; enableSound?: boolean; } export interface ChannelVibration { vibrationPattern?: number[]; enableVibration?: boolean; } export interface ChannelLights { lightColor?: string; enableLights?: boolean; } export interface ChannelGroup { groupId?: string; groupName?: string; } //# sourceMappingURL=channels.d.ts.map