/** * Event name dispatched when limits are updated via SSE. * Other components can listen to this event to get real-time updates. */ export declare const LIMITS_UPDATED_EVENT = "grafana-assistant-limits-updated"; /** * Detail payload for the LIMITS_UPDATED_EVENT custom event. */ export interface LimitsUpdatedEventDetail { count: number; limit: number; } /** * Result type for limits data. */ export interface LimitsData { /** Current prompt count for the month */ count: number; /** Monthly prompt limit (0 = unlimited) */ limit: number; /** Current month in YYYY-MM format */ month: string; /** Whether the limit has been reached */ isLimitReached: boolean; } /** * Checks whether the user has reached their monthly prompt limit. * * @returns A promise that resolves to `true` if limits are reached, `false` otherwise * @throws Error if the API call fails * * @example * ```typescript * import { checkLimits } from '@grafana/assistant'; * * const data = await checkLimits(); * if (data.isLimitReached) { * console.log('Monthly limit reached'); * } * ``` */ export declare function checkLimits(): Promise; /** * React hook to check user prompt limits. * Automatically fetches limits data on mount and listens to real-time updates * via the LIMITS_UPDATED_EVENT custom event. * * @returns An object containing limit data, loading state, error state, and refetch function * * @example * ```typescript * import { useLimits } from '@grafana/assistant'; * * function MyComponent() { * const { count, limit, isLimitReached, loading, error, refetch } = useLimits(); * * if (loading) return
Loading...
; * if (error) return
Error: {error}
; * if (isLimitReached) return
Monthly limit reached ({count}/{limit})
; * return
Prompts used: {count}/{limit || 'unlimited'}
; * } * ``` */ export declare function useLimits(): { count: number; limit: number; month: string; isLimitReached: boolean; loading: boolean; error: string | null; refetch: () => Promise; }; //# sourceMappingURL=index.d.ts.map