import { NotificationFilter, NovuError } from '@novu/js'; type Count = { count: number; filter: NotificationFilter; }; /** * Props for the useCounts hook. * * @example * ```tsx * // Count unread notifications * const { counts } = useCounts({ * filters: [{ read: false }] * }); * * // Count unseen notifications with specific tags * const { counts } = useCounts({ * filters: [{ seen: false, tags: ['important'] }] * }); * * // Count seen but unread notifications * const { counts } = useCounts({ * filters: [{ seen: true, read: false }] * }); * * // Opt out of the built-in realtime count updates and drive them yourself * const { counts, refetch } = useCounts({ * filters: [{ read: false }], * realtime: false, * }); * ``` */ type UseCountsProps = { filters: NotificationFilter[]; /** * When `false`, disables the WebSocket subscriptions that auto-resync * counts on `notifications.notification_received` and * `notifications.unread_count_changed`. The filter-driven fetch and * `refetch()` keep working. Use alongside * `useNotifications({ realtime: false })` when you drive live updates * yourself. * * When set, this prop takes precedence over the `realtime` config on * ``. When omitted, the provider value (default `true`) is used. */ realtime?: boolean; onSuccess?: (data: Count[]) => void; onError?: (error: NovuError) => void; }; type UseCountsResult = { counts?: Count[]; error?: NovuError; isLoading: boolean; isFetching: boolean; refetch: () => Promise; }; declare const useCounts: (props: UseCountsProps) => UseCountsResult; export { useCounts }; export type { UseCountsProps, UseCountsResult };