import { UseStreamStatusResult, StreamState } from '../types'; /** * Options for the useStreamStatus hook. */ export interface UseStreamStatusOptions { /** * Update interval for elapsed time in milliseconds. * @default 100 */ updateInterval?: number; /** * Whether to track elapsed time. * @default true */ trackElapsedTime?: boolean; /** * Custom status message generator. */ formatStatusMessage?: (state: StreamState, details: StatusDetails) => string; } /** * Details provided to custom status message formatter. */ export interface StatusDetails { elapsedTime: number | null; bytesTransferred: number; chunksReceived: number; estimatedTimeRemaining: number | null; } /** * Hook for monitoring detailed stream status. * * @description * Provides comprehensive information about a stream's status, * including timing, transfer statistics, and human-readable messages. * * Features: * - Real-time state monitoring * - Elapsed time tracking * - Estimated time remaining calculation * - Transfer statistics (bytes, chunks) * - Customizable status messages * * @param boundaryId - Boundary ID to monitor * @param options - Optional configuration * @returns Detailed stream status * * @example * ```tsx * // Basic usage * const status = useStreamStatus('main-content'); * * // With options * const status = useStreamStatus('main-content', { * updateInterval: 50, * formatStatusMessage: (state, details) => { * if (state === StreamState.Streaming) { * return `Loading: ${details.bytesTransferred} bytes`; * } * return STATUS_MESSAGES[state]; * }, * }); * ``` */ export declare function useStreamStatus(boundaryId: string, options?: UseStreamStatusOptions): UseStreamStatusResult; /** * Extended result with additional details. */ export interface UseExtendedStreamStatusResult extends UseStreamStatusResult { /** Transfer rate in bytes per second */ bytesPerSecond: number | null; /** Human-readable transfer rate */ transferRate: string; /** Human-readable bytes transferred */ formattedBytes: string; /** Human-readable elapsed time */ formattedElapsed: string; /** Human-readable ETA */ formattedETA: string; /** Whether stream is active (streaming or paused) */ isActive: boolean; /** Whether stream has ended (completed, error, or aborted) */ hasEnded: boolean; } /** * Extended stream status hook with formatted values. * * @description * Provides all the information from useStreamStatus plus * human-readable formatted values for display. * * @example * ```tsx * function StreamDetails({ boundaryId }: { boundaryId: string }) { * const status = useExtendedStreamStatus(boundaryId); * * return ( *
*

{status.statusMessage}

*

Transferred: {status.formattedBytes}

*

Rate: {status.transferRate}

*

Elapsed: {status.formattedElapsed}

*

ETA: {status.formattedETA}

*
* ); * } * ``` */ export declare function useExtendedStreamStatus(boundaryId: string, options?: UseStreamStatusOptions): UseExtendedStreamStatusResult;