import { useEffect, type VFC } from 'react'; import { useNavigate } from 'react-router-dom'; import { Box, Button } from '@mui/material'; import { Dialogue } from 'component/common/Dialogue/Dialogue'; import { ConditionallyRender } from 'component/common/ConditionallyRender/ConditionallyRender'; import { usePlausibleTracker } from 'hooks/usePlausibleTracker'; import useUiConfig from 'hooks/api/getters/useUiConfig/useUiConfig'; interface IErrorProps { error: Error; } const ZendeskButton = () => { const openZendeskSupport = () => { window?.open('https://getunleash.zendesk.com', '_blank'); }; return ; }; // biome-ignore lint/suspicious/noShadowRestrictedNames: export const Error: VFC = ({ error }) => { const navigate = useNavigate(); const { trackEvent } = usePlausibleTracker(); const { isOss } = useUiConfig(); const showZendeskButton = !isOss(); useEffect(() => { const { message, stack = 'unknown' } = error; trackEvent('unknown_ui_error', { props: { location: window?.location?.href || 'unknown', message, stack, }, }); }, []); return ( { navigate('/'); window?.location?.reload(); }} secondaryButtonText='Reload this page' onClose={() => { window?.location?.reload(); }} maxWidth='xl' customButton={ } elseShow={undefined} /> } > {error.message} {error.stack} } /> ); };