import React from 'react'; export type ConnectionStatus = 'online' | 'slow' | 'offline'; export interface UseConnectionStatusOptions { /** Poll interval in ms. Default 10000. */ interval?: number; /** A successful probe slower than this counts as a slow probe. Default 8000. */ slowThreshold?: number; /** Hard abort timeout for a probe. Default 12000. Aborts are treated as slow, not offline. */ hardTimeout?: number; /** Consecutive network-error probes required before flipping to 'offline'. Default 3. */ offlineAfter?: number; /** Consecutive slow probes required before flipping to 'slow'. Default 2. */ slowAfter?: number; } /** * Probes a URL on an interval and reports a three-state connection status. * * Detection rules: * - A probe that resolves within `slowThreshold` ms → resets all counters, status `online`. * - A probe that resolves but exceeded `slowThreshold`, or aborted at `hardTimeout` → counts as slow. * Status flips to `slow` only after `slowAfter` consecutive slow probes. * - A probe rejected with a real network error (not an abort) → counts as a network failure. * Status flips to `offline` only after `offlineAfter` consecutive network failures. * - `navigator.onLine === false` (or the `offline` window event) is trusted as an immediate * `offline` signal; the `online` event clears it back to `online`. * - Polling pauses while the tab is hidden to avoid accumulating failures from a throttled tab. */ export declare function useConnectionStatus(url: string, options?: UseConnectionStatusOptions): ConnectionStatus; /** * Backward-compatible boolean hook. `true` means not offline (online or slow). * @deprecated Prefer `useConnectionStatus` for finer-grained state. */ export declare function useOnlineStatus(url: string, interval?: number): boolean; export interface OfflineNotifierProps { url?: string; /** Show a subtle indicator on sustained slow connections. Default true. */ showSlowIndicator?: boolean; /** Probe interval in ms. Default 10000. */ interval?: number; /** Threshold above which a successful probe is considered slow. Default 8000. */ slowThreshold?: number; /** Hard probe timeout. Default 12000. */ hardTimeout?: number; /** Consecutive network errors before showing the offline pill. Default 3. */ offlineAfter?: number; /** Consecutive slow probes before showing the slow indicator. Default 2. */ slowAfter?: number; } /** * Renders a connection status indicator at the bottom-right. * - Online: nothing. * - Slow (rare, by design): a small amber dot with a tooltip. * - Offline: a subtle red pill. */ export declare function OfflineNotifier({ url, showSlowIndicator, interval, slowThreshold, hardTimeout, offlineAfter, slowAfter, }: OfflineNotifierProps): React.JSX.Element | null; //# sourceMappingURL=OfflineChecker.d.ts.map