import type { FirebaseApp } from 'firebase/app'; import { type Firestore, type Unsubscribe } from 'firebase/firestore'; import { type ReactiveController, type ReactiveControllerHost } from 'lit'; import type { AppNotificationData, NewNotificationInput, NotificationControllerOptions, PushPermissionState } from './models.js'; /** * A Lit Reactive Controller that manages real-time Firestore notifications, * unread counters, in-tab arrival toasts, and Web Push device registration. * * @example * ```typescript * class NotificationBellElement extends LitElement { * private notifCtrl = new NotificationController(this, { * firestore: db, * app, * uid: () => auth.currentUser?.uid, * push: { vapidKey: FCM_VAPID_KEY }, * onNotificationReceived: (notif) => { * // Trigger butter-bar / toast * }, * }); * * render() { * return html` * * `; * } * } * ``` */ export declare class NotificationController implements ReactiveController { protected host: ReactiveControllerHost; protected options: NotificationControllerOptions; protected unsubscribeFn?: Unsubscribe; protected isHostConnected: boolean; protected currentUid?: string | null; protected isInitialSnapshot: boolean; /** * List of recent notifications synchronized in real-time. */ notifications: AppNotificationData[]; /** * Number of unread notifications in the current synced window. */ unreadCount: number; /** * Whether the controller is waiting for initial Firestore sync. */ loading: boolean; /** * Web Push status for this device ('enabled', 'off', 'denied', or 'unsupported'). */ pushState: PushPermissionState; /** * Error that occurred during Firestore listener or push registration. */ error?: Error; constructor(host: ReactiveControllerHost, options?: NotificationControllerOptions); /** * Host connected to DOM lifecycle callback. */ hostConnected(): void; /** * Host disconnected from DOM lifecycle callback. */ hostDisconnected(): void; /** * Host update lifecycle hook: detects if the target user ID changed dynamically. */ hostUpdate(): void; /** * Subscribes to real-time notifications for the active user. */ subscribe(): void; /** * Unsubscribes from active Firestore snapshot listener. */ unsubscribe(): void; /** * Manually refreshes both notifications and push status. */ refresh(): void; /** * Marks a specific notification as read in Firestore. */ markAsRead(notificationId: string): Promise; /** * Marks all currently loaded unread notifications as read. */ markAllAsRead(): Promise; /** * Completely removes a notification from Firestore. */ deleteNotification(notificationId: string): Promise; /** * Removes all currently loaded notifications for this user. */ clearAllNotifications(): Promise; /** * Creates a new notification for this user in Firestore. * * @param input Notification input payload. * @returns Generated notification document ID, or undefined on failure. */ createNotification(input: NewNotificationInput): Promise; /** * Checks the active device's push permission and token registration status. */ checkPushStatus(): Promise; /** * Toggles Web Push notifications on or off for this device. */ togglePush(): Promise; protected resolveFirestore(): Firestore | null; protected resolveApp(): FirebaseApp | null; protected resolveUid(): string | null; protected resolveRegisteredTokens(): string[] | undefined; } //# sourceMappingURL=notification.controller.d.ts.map