"use client"; import { Component, type ReactNode } from "react"; import { Card, CardContent } from "@/components/ui/card"; export * from "./plan"; export * from "./schema"; // ============================================================================ // Error Boundary // ============================================================================ interface PlanErrorBoundaryProps { children: ReactNode; fallback?: ReactNode; } interface PlanErrorBoundaryState { hasError: boolean; error?: Error; } export class PlanErrorBoundary extends Component { constructor(props: PlanErrorBoundaryProps) { super(props); this.state = { hasError: false }; } static getDerivedStateFromError(error: Error): PlanErrorBoundaryState { return { hasError: true, error }; } render() { if (this.state.hasError) { if (this.props.fallback) { return this.props.fallback; } return (
Failed to render plan
); } return this.props.children; } }