import { LitElement, ReactiveController, ReactiveControllerHost } from 'lit'; import { QueryController } from './query-controller'; import { NotificationsResultType, NotificationTypes } from '../types/notifications.types'; import { ContextConsumer } from '@lit/context'; import { WeavyType } from '../contexts/weavy-context'; import { getMarkNotificationsMutation } from '../data/notifications'; import { QueryObserverResult } from '@tanstack/query-core'; export interface UnreadNotificationsProps { /** * Number of unread notifications. */ readonly unread: number; /** * Marks all notifications as read. */ markAllAsRead: () => Promise; } export interface NotificationFilterProps { /** * Optional app id for unread scoping. */ appId?: number; /** * Optional directory identifier (`id` or `name`) for unread scoping. * When set, only notifications from apps belonging to this directory are counted. * Has no effect when `appId` is set (app scoping takes priority). */ directory?: string | number; /** * Type of notifications for the scope. * * @type "" | "activity" | "mention" | "reaction" */ typeFilter: NotificationTypes; } /** * Lit element controller for Notification live data. * * - Requires a weavy context. * - May be filtered for different notification types and app id scopes. * * @fires {WyUnreadEventType} wy-unread - Emitted when the number of unread notifications change. */ export declare class UnreadNotificationsController implements ReactiveController, UnreadNotificationsProps, NotificationFilterProps { #private; host: LitElement & ReactiveControllerHost; /** * Optional app id for unread scoping. */ appId?: number; /** * Optional directory identifier (`id` or `name`) for unread scoping. */ directory?: string | number; /** * Type of notifications for the scope. * * @type "" | "activity" | "mention" | "reaction" */ typeFilter: NotificationTypes; /** * The number of unread notifications for the current scope */ get unread(): number; /** * Is the unread count pending? */ get isUnreadPending(): boolean; /** * The underlying query result for the unread count. */ get unreadResult(): QueryObserverResult; protected unreadQuery: QueryController; protected markNotificationsMutation?: ReturnType; protected registrationRequested: boolean; protected weavyContext?: ContextConsumer<{ __context__: WeavyType; }, LitElement>; protected whenWeavyContext: Promise; protected resolveWeavyContext?: (value: WeavyType | PromiseLike) => void; protected get weavy(): WeavyType | undefined; constructor(host: LitElement); /** * Initiates context consumers */ setContexts(): Promise; /** * Dispatch a `wy-unread` event on the host. * * @fires {WyUnreadEventType} wy-unread - Emitted when the number of unread notifications change. */ dispatchNotificationUnreadEvent(): void; /** * Request an update of the notification query data. */ private handleRefresh; /** * Register realtime handlers. */ registerRealtime(): Promise; /** * Unregister realtime handlers. * * @param skipAwait - Skip waiting for any context. */ unregisterRealtime(skipAwait?: boolean): Promise; /** * Tracks unread data. Initiates the query data with the given filtering scope. * * @param typeFilter - The notification types to track. * @param appId - Optional app id for the filtering scope. * @param directory - Optional directory identifier for the filtering scope. */ track(typeFilter: NotificationTypes, appId?: number, directory?: string | number): Promise; markAllAsRead(): Promise; hostUpdate(): void; hostDisconnected(): void; } //# sourceMappingURL=unread-notifications-controller.d.ts.map