import { default as React, ReactNode } from 'react'; /** * Error severity levels */ export type ErrorSeverity = 'info' | 'warning' | 'error' | 'fatal'; /** * Error category */ export type ErrorCategory = 'network' | 'auth' | 'validation' | 'permission' | 'notFound' | 'timeout' | 'server' | 'critical' | 'unknown'; /** * Error info with context */ export interface ErrorInfo { error: Error; category: ErrorCategory; severity: ErrorSeverity; isRetryable: boolean; userMessage: string; technicalMessage: string; suggestions: string[]; timestamp: number; context?: Record; } /** * Recovery action */ export interface RecoveryAction { id: string; label: string; description?: string; action: () => void | Promise; primary?: boolean; destructive?: boolean; } /** * Error recovery props */ export interface ErrorRecoveryProps { /** The error that occurred */ error: Error | null; /** Error category override */ category?: ErrorCategory; /** Custom error message */ message?: string; /** Retry callback */ onRetry?: () => void | Promise; /** Reset/dismiss callback */ onReset?: () => void; /** Navigate away callback */ onNavigate?: (path: string) => void; /** Custom recovery actions */ actions?: RecoveryAction[]; /** Enable automatic retry */ autoRetry?: boolean; /** Auto retry delay in ms */ autoRetryDelay?: number; /** Maximum auto retry attempts */ maxAutoRetries?: number; /** Show technical details */ showTechnicalDetails?: boolean; /** Custom fallback component */ fallback?: ReactNode; /** Children to render when no error */ children?: ReactNode; /** Full screen error */ fullScreen?: boolean; /** Compact mode */ compact?: boolean; /** Additional class name */ className?: string; } /** * Offline recovery props */ export interface OfflineRecoveryProps { /** Pending actions to sync */ pendingActions?: number; /** Last sync timestamp */ lastSync?: number; /** Force retry callback */ onForceRetry?: () => void; /** Children to render when online */ children?: ReactNode; /** Custom offline message */ offlineMessage?: string; } /** * Degraded state props */ export interface DegradedStateProps { /** Features that are unavailable */ unavailableFeatures: string[]; /** Reason for degradation */ reason: string; /** Expected recovery time */ estimatedRecoveryTime?: string; /** Children to render */ children?: ReactNode; /** Dismiss callback */ onDismiss?: () => void; } /** * Classify an error into a category */ export declare function classifyError(error: Error): ErrorCategory; /** * Check if error is retryable */ export declare function isRetryable(category: ErrorCategory): boolean; /** * Get user-friendly error message */ export declare function getUserMessage(category: ErrorCategory, error: Error): string; /** * Get recovery suggestions */ export declare function getRecoverySuggestions(category: ErrorCategory): string[]; /** * Create error info from an error */ export declare function createErrorInfo(error: Error, categoryOverride?: ErrorCategory): ErrorInfo; /** * Error recovery component with retry and navigation */ export declare function ErrorRecovery({ error, category: categoryOverride, message, onRetry, onReset, onNavigate, actions, autoRetry, autoRetryDelay, maxAutoRetries, showTechnicalDetails, fallback, children, fullScreen, compact, className, }: ErrorRecoveryProps): React.ReactElement; /** * Offline detection and recovery component */ export declare function OfflineRecovery({ pendingActions, lastSync, onForceRetry, children, offlineMessage, }: OfflineRecoveryProps): React.ReactElement; /** * Degraded state indicator */ export declare function DegradedState({ unavailableFeatures, reason, estimatedRecoveryTime, children, onDismiss, }: DegradedStateProps): React.ReactElement; export declare const errorRecoveryStyles = "\n .error-recovery {\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n padding: 2rem;\n text-align: center;\n gap: 1.5rem;\n }\n\n .error-recovery--fullscreen {\n min-height: 100vh;\n background: #f9fafb;\n }\n\n .error-recovery--compact {\n padding: 1rem;\n gap: 1rem;\n }\n\n .error-recovery__title {\n margin: 0;\n font-size: 1.5rem;\n font-weight: 600;\n color: #111827;\n }\n\n .error-recovery__message {\n margin: 0;\n color: #6b7280;\n max-width: 400px;\n }\n\n .error-recovery__suggestions {\n text-align: left;\n background: #f3f4f6;\n padding: 1rem;\n border-radius: 8px;\n max-width: 400px;\n }\n\n .error-recovery__suggestions h3 {\n margin: 0 0 0.5rem;\n font-size: 0.875rem;\n font-weight: 600;\n }\n\n .error-recovery__suggestions ul {\n margin: 0;\n padding-left: 1.25rem;\n color: #6b7280;\n font-size: 0.875rem;\n }\n\n .error-recovery__actions {\n display: flex;\n gap: 0.75rem;\n flex-wrap: wrap;\n justify-content: center;\n }\n\n .error-recovery__action {\n padding: 0.5rem 1rem;\n border-radius: 6px;\n border: 1px solid #d1d5db;\n background: white;\n color: #374151;\n cursor: pointer;\n font-size: 0.875rem;\n transition: all 0.2s;\n }\n\n .error-recovery__action:hover {\n background: #f9fafb;\n }\n\n .error-recovery__action--primary {\n background: #3b82f6;\n border-color: #3b82f6;\n color: white;\n }\n\n .error-recovery__action--primary:hover {\n background: #2563eb;\n }\n\n .error-recovery__action--destructive {\n color: #ef4444;\n border-color: #fca5a5;\n }\n\n .offline-banner {\n position: fixed;\n top: 0;\n left: 0;\n right: 0;\n z-index: 9999;\n padding: 0.75rem 1rem;\n }\n\n .offline-banner--offline {\n background: #fef3c7;\n color: #92400e;\n }\n\n .offline-banner--online {\n background: #d1fae5;\n color: #065f46;\n }\n\n .offline-banner__content {\n display: flex;\n align-items: center;\n gap: 0.75rem;\n max-width: 1200px;\n margin: 0 auto;\n }\n\n .degraded-state {\n background: #fef3c7;\n border-bottom: 1px solid #fcd34d;\n padding: 0.75rem 1rem;\n }\n\n .degraded-state__content {\n display: flex;\n align-items: center;\n gap: 0.75rem;\n max-width: 1200px;\n margin: 0 auto;\n }\n";