import { QuotaExhaustedExtensions } from '../utils/quotaErrors'; /** * Global error event the host shell can dispatch when any GraphQL response * carries a QUOTA_EXHAUSTED error. The hook listens for it and surfaces a * toast through the shell's GlobalUiProvider — this avoids every MFE having * to wire its own error link/handler for a global concern. */ export declare const QUOTA_EXHAUSTED_EVENT = "burdenoff:quota-exhausted"; export interface QuotaExhaustedEventDetail { /** The raw error object surfaced by Apollo (or any GraphQL client). */ error?: unknown; /** Pre-extracted extensions, if the dispatcher already parsed the error. */ extensions?: QuotaExhaustedExtensions; } export interface UseQuotaErrorToastOptions { /** Toast cooldown in ms — suppresses duplicate toasts inside this window. */ cooldownMs?: number; /** Override the default toast message builder. */ buildMessage?: (ext: QuotaExhaustedExtensions | null) => string; } /** * `useQuotaErrorToast` — install a global listener that surfaces a toast * whenever a `QUOTA_EXHAUSTED` GraphQL error is observed anywhere in the app. * * Mount once per shell (e.g. inside the AppShellProvider). Returns a manual * `report(error)` callback that MFEs can call directly when their mutation * fails so the toast shows immediately without waiting for the global event. * * @example * ```tsx * function AppShell() { * useQuotaErrorToast(); * return {/* ... *\/}; * } * * // From a mutation handler * const { report } = useQuotaErrorToast(); * try { await mutate(); } catch (e) { if (!report(e)) throw e; } * ``` */ export declare function useQuotaErrorToast(options?: UseQuotaErrorToastOptions): { report: (err: unknown) => boolean; }; /** * Dispatch the global `QUOTA_EXHAUSTED` event. Call from an Apollo error link * (or any GraphQL client error handler) so a host shell that mounts * `useQuotaErrorToast` will surface a toast. */ export declare function dispatchQuotaExhausted(detail: QuotaExhaustedEventDetail): void; //# sourceMappingURL=useQuotaErrorToast.d.ts.map