import { HydrationStatus, HydrationBoundaryId } from '../types'; /** * Extended status information with computed properties. */ export interface UseHydrationStatusReturn extends HydrationStatus { /** * Whether the boundary is fully hydrated and interactive. */ readonly isHydrated: boolean; /** * Whether the boundary is currently hydrating. */ readonly isHydrating: boolean; /** * Whether the boundary is pending hydration. */ readonly isPending: boolean; /** * Whether the boundary encountered an error. */ readonly hasError: boolean; /** * Whether the boundary was skipped (SSR-only). */ readonly isSkipped: boolean; /** * Progress percentage (0-100) based on state. */ readonly progress: number; /** * Human-readable status description. */ readonly description: string; } /** * Options for the useHydrationStatus hook. */ export interface UseHydrationStatusOptions { /** * Polling interval in milliseconds for status updates. * Set to 0 to disable polling (only event-driven updates). * * @default 100 */ readonly pollInterval?: number; /** * Whether to subscribe to scheduler events for real-time updates. * * @default true */ readonly subscribeToEvents?: boolean; } /** * Hook for tracking the hydration status of a specific boundary. * * Provides real-time status updates with computed convenience properties. * * @param boundaryId - ID of the boundary to track (string will be converted) * @param options - Hook options * @returns Extended hydration status with computed properties * * @example * ```tsx * function StatusIndicator({ boundaryId }: { boundaryId: string }) { * const { * isHydrated, * isHydrating, * isPending, * hasError, * progress, * description, * duration, * } = useHydrationStatus(boundaryId); * * if (hasError) { * return {description}; * } * * return ( *