import React, { Component, ReactNode } from 'react';
/**
* Props for WidgetErrorBoundary component
*/
export interface WidgetErrorBoundaryProps {
/**
* Child components to wrap with error boundary
*/
children: ReactNode;
/**
* Optional custom fallback component to display on error
*/
fallback?: ReactNode;
/**
* Optional callback when an error is caught
*/
onError?: (error: Error, errorInfo: React.ErrorInfo) => void;
/**
* Optional widget name for error messages
*/
widgetName?: string;
/**
* Optional test ID for automated testing
*/
testId?: string;
}
/**
* State for WidgetErrorBoundary component
*/
interface WidgetErrorBoundaryState {
hasError: boolean;
error?: Error;
}
/**
* Error boundary component for wrapping widgets
*
* ## Business Perspective
*
* Prevents widget failures from crashing the entire application, ensuring
* users can continue working even when individual components encounter errors.
* Critical for maintaining operational continuity and user trust. 🛡️
*
* ## Technical Perspective
*
* React Error Boundary that catches JavaScript errors in child components,
* logs them, and displays a fallback UI. Implements the error boundary
* lifecycle methods to gracefully handle rendering errors.
*
* Per React best practices, error boundaries catch errors during:
* - Rendering
* - Lifecycle methods
* - Constructors of child components
*
* They do NOT catch errors in:
* - Event handlers (use try-catch)
* - Asynchronous code (use try-catch)
* - Server-side rendering
* - Errors in the error boundary itself
*
* @example
* ```tsx
* // Basic usage
*
*
*
*
* // With custom fallback
* }>
*
*
*
* // With error callback and widget name
* logError(error, info)}
* >
*
*
* ```
*/
export declare class WidgetErrorBoundary extends Component {
constructor(props: WidgetErrorBoundaryProps);
/**
* Update state when an error is caught
*/
static getDerivedStateFromError(error: Error): WidgetErrorBoundaryState;
/**
* Log error information and call optional callback
*/
componentDidCatch(error: Error, errorInfo: React.ErrorInfo): void;
/**
* Reset error state (for retry functionality)
*/
private resetError;
render(): ReactNode;
}
export default WidgetErrorBoundary;
//# sourceMappingURL=WidgetErrorBoundary.d.ts.map