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.

45 lines 2.13 kB
import { NotificationConfig, PermissionStatus, ScheduleOptions, Notification, NotificationChannel, NotificationEventCallback, NotificationEventMap, InAppOptions } from '../../types'; export interface UseNotificationsState { isInitialized: boolean; isInitializing: boolean; permission: PermissionStatus | null; token: string | null; error: Error | null; notifications: Notification[]; pendingNotifications: Notification[]; subscriptions: string[]; } export interface UseNotificationsReturn extends UseNotificationsState { init: (config: NotificationConfig) => Promise<void>; destroy: () => Promise<void>; requestPermission: () => Promise<boolean>; checkPermission: () => Promise<PermissionStatus>; getToken: () => Promise<string>; refreshToken: () => Promise<string>; subscribe: (topic: string) => Promise<void>; unsubscribe: (topic: string) => Promise<void>; scheduleNotification: (options: ScheduleOptions & { id: string; title: string; body: string; }) => Promise<void>; cancelNotification: (id: number) => Promise<void>; getPendingNotifications: () => Promise<Notification[]>; createChannel: (channel: NotificationChannel) => Promise<void>; deleteChannel: (channelId: string) => Promise<void>; listChannels: () => Promise<NotificationChannel[]>; addEventListener: <T extends keyof NotificationEventMap>(event: T, callback: NotificationEventCallback<NotificationEventMap[T]>) => () => void; showInApp: { show: (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>; }; clearNotifications: () => void; clearError: () => void; refresh: () => Promise<void>; isSupported: () => Promise<boolean>; } export declare function useNotifications(): UseNotificationsReturn; //# sourceMappingURL=useNotifications.d.ts.map