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.
130 lines • 3.54 kB
TypeScript
import { ScheduleOptions } from './scheduling';
export interface Notification {
id: string;
title: string;
body: string;
data?: Record<string, any>;
image?: string;
icon?: string;
badge?: string;
sound?: string;
vibration?: boolean | number[];
group?: string;
groupSummary?: boolean;
priority?: NotificationPriority;
visibility?: NotificationVisibility;
autoCancel?: boolean;
ongoing?: boolean;
channelId?: string;
category?: string;
threadId?: string;
subtitle?: string;
largeIcon?: string;
smallIcon?: string;
color?: string;
lights?: NotificationLights;
actions?: NotificationAction[];
attachments?: NotificationAttachment[];
summaryText?: string;
at?: Date;
every?: RepeatInterval;
repeats?: boolean;
extra?: Record<string, any>;
}
export type NotificationPriority = 'min' | 'low' | 'default' | 'high' | 'max';
export type NotificationVisibility = 'public' | 'private' | 'secret';
export interface NotificationLights {
color: string;
on: number;
off: number;
}
export interface NotificationAction {
id: string;
title: string;
icon?: string;
requiresAuth?: boolean;
destructive?: boolean;
input?: NotificationActionInput;
}
export interface NotificationActionInput {
placeholder?: string;
buttonTitle?: string;
choices?: string[];
}
export interface NotificationAttachment {
id: string;
url: string;
options?: NotificationAttachmentOptions;
}
export interface NotificationAttachmentOptions {
typeHint?: string;
hiddenPreviewsBodyText?: string;
hiddenPreviewsShowTitle?: boolean;
hiddenPreviewsShowSubtitle?: boolean;
thumbnailHidden?: boolean;
thumbnailClippingRect?: NotificationAttachmentRect;
thumbnailTime?: number;
}
export interface NotificationAttachmentRect {
x: number;
y: number;
width: number;
height: number;
}
export type RepeatInterval = 'minute' | 'hour' | 'day' | 'week' | 'month' | 'year';
export interface NotificationDeliveryStatus {
id: string;
delivered: boolean;
opened: boolean;
dismissed: boolean;
deliveredAt?: Date;
openedAt?: Date;
dismissedAt?: Date;
}
export interface NotificationStatistics {
total: number;
delivered: number;
opened: number;
dismissed: number;
deliveryRate: number;
openRate: number;
dismissRate: number;
}
export interface PushNotificationPayload {
notification?: {
title?: string;
body?: string;
icon?: string;
image?: string;
badge?: string;
sound?: string;
tag?: string;
data?: Record<string, any>;
requireInteraction?: boolean;
silent?: boolean;
timestamp?: number;
vibrate?: number[];
actions?: NotificationAction[];
};
data?: Record<string, any>;
to?: string | string[];
topic?: string;
condition?: string;
collapse_key?: string;
priority?: 'normal' | 'high';
time_to_live?: number;
delay_while_idle?: boolean;
restricted_package_name?: string;
dry_run?: boolean;
}
export interface LocalNotificationPayload extends Omit<Notification, 'id'> {
id?: string;
schedule?: ScheduleOptions;
}
export type WeekDay = 'sunday' | 'monday' | 'tuesday' | 'wednesday' | 'thursday' | 'friday' | 'saturday';
export interface NotificationProgress {
value: number;
max: number;
indeterminate?: boolean;
}
//# sourceMappingURL=notification.d.ts.map