"use client" import { RotateCwIcon } from "lucide-react" import { Component, type ReactNode } from "react" import { Button } from "@/components/ui/button" import { useI18n } from "@/i18n/provider" function ChatCrashFallback({ onReset }: { onReset: () => void }) { const t = useI18n() return (
{t("supportChat.crashTitle")}

{t("supportChat.crashDescription")}

) } type State = { failed: boolean } /** * Keeps a rendering failure inside the chat from blanking the whole embedded * frame; the visitor gets a recoverable state instead. */ export class SupportChatErrorBoundary extends Component<{ children: ReactNode }, State> { state: State = { failed: false } static getDerivedStateFromError(): State { return { failed: true } } componentDidCatch(error: unknown) { console.error("Support chat crashed", error) } render() { if (this.state.failed) { return this.setState({ failed: false })} /> } return this.props.children } }