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.

69 lines 3.76 kB
import { NotificationConfig, NotificationProvider, Notification, PermissionStatus, ScheduleOptions, InAppOptions, NotificationChannel, PushNotificationPayload, LocalNotificationPayload, NotificationEventCallback, NotificationEventMap, Platform, PlatformCapabilities } from '../types'; import { DeliveredNotificationSchema } from '@capacitor/local-notifications'; export declare class NotificationKit { private static instance; private provider; private config; private initialized; private eventListeners; private platform; private capabilities; private constructor(); static getInstance(): NotificationKit; static init(config: NotificationConfig): Promise<void>; init(config: NotificationConfig): Promise<void>; destroy(): Promise<void>; isInitialized(): boolean; getPlatform(): Platform; getCapabilities(): PlatformCapabilities | null; getProvider(): NotificationProvider | null; requestPermission(): Promise<boolean>; checkPermission(): Promise<PermissionStatus>; getToken(): Promise<string>; subscribe(topic: string): Promise<void>; unsubscribe(topic: string): Promise<void>; sendPushNotification(payload: PushNotificationPayload): Promise<void>; scheduleLocalNotification(options: ScheduleOptions & LocalNotificationPayload): Promise<void>; cancelLocalNotification(id: string | number): Promise<void>; getPendingLocalNotifications(): Promise<Notification[]>; showInAppNotification(options: InAppOptions): Promise<string>; isSupported(): Promise<boolean>; createChannel(channel: NotificationChannel): Promise<void>; deleteChannel(channelId: string): Promise<void>; listChannels(): Promise<NotificationChannel[]>; on<T extends keyof NotificationEventMap>(event: T, callback: NotificationEventCallback<NotificationEventMap[T]>): () => void; off<T extends keyof NotificationEventMap>(event: T, callback?: NotificationEventCallback<NotificationEventMap[T]>): void; private emit; private detectPlatform; private initializeProvider; private setupEventListeners; private ensureInitialized; } export declare const notifications: { init: (config: NotificationConfig) => Promise<void>; requestPermission: () => Promise<boolean>; checkPermission: () => Promise<PermissionStatus>; isPermissionGranted: () => Promise<boolean>; getPermissionState: () => Promise<PermissionStatus>; getToken: () => Promise<string>; deleteToken: () => Promise<void>; subscribe: (topic: string) => Promise<void>; unsubscribe: (topic: string) => Promise<void>; schedule: (options: ScheduleOptions & LocalNotificationPayload) => Promise<void>; cancel: (id: number) => Promise<void>; getPending: () => Promise<Notification[]>; getDelivered: () => Promise< DeliveredNotificationSchema[]>; removeDelivered: (id: string) => Promise<void>; removeAllDelivered: () => Promise<void>; cancelAll: () => Promise<void>; onPush: (callback: (notification: any) => void) => () => void; onPushOpened: (callback: (notification: any) => void) => () => void; showInApp: (options: InAppOptions) => Promise<string>; success: (title: string, message?: string) => Promise<string>; error: (title: string, message?: string) => Promise<string>; warning: (title: string, message?: string) => Promise<string>; info: (title: string, message?: string) => Promise<string>; on: <T extends keyof NotificationEventMap>(event: T, callback: NotificationEventCallback<NotificationEventMap[T]>) => () => void; off: <T extends keyof NotificationEventMap>(event: T, callback?: NotificationEventCallback<NotificationEventMap[T]>) => void; }; //# sourceMappingURL=NotificationKit.d.ts.map