2016-12-22 14:09:16 +01:00
|
|
|
import 'whatwg-fetch';
|
2022-04-01 10:28:15 +02:00
|
|
|
import 'themes/app.css';
|
2022-05-05 17:15:22 +02:00
|
|
|
import 'regenerator-runtime/runtime';
|
2019-03-11 21:10:45 +01:00
|
|
|
|
2016-11-10 14:26:24 +01:00
|
|
|
import ReactDOM from 'react-dom';
|
2022-05-05 13:42:18 +02:00
|
|
|
import { BrowserRouter } from 'react-router-dom';
|
2023-12-01 15:53:05 +01:00
|
|
|
import { QueryParamProvider } from 'use-query-params';
|
|
|
|
import { ReactRouter6Adapter } from 'use-query-params/adapters/react-router-6';
|
2022-05-02 15:52:41 +02:00
|
|
|
import { ThemeProvider } from 'themes/ThemeProvider';
|
2022-04-01 10:28:15 +02:00
|
|
|
import { App } from 'component/App';
|
|
|
|
import { ScrollTop } from 'component/common/ScrollTop/ScrollTop';
|
2022-05-02 15:52:41 +02:00
|
|
|
import { AccessProvider } from 'component/providers/AccessProvider/AccessProvider';
|
2022-05-19 14:06:18 +02:00
|
|
|
import { basePath } from 'utils/formatPath';
|
2022-03-31 09:23:46 +02:00
|
|
|
import { FeedbackCESProvider } from 'component/feedback/FeedbackCESContext/FeedbackCESProvider';
|
2022-04-22 14:03:58 +02:00
|
|
|
import { AnnouncerProvider } from 'component/common/Announcer/AnnouncerProvider/AnnouncerProvider';
|
2022-05-19 14:06:18 +02:00
|
|
|
import { InstanceStatus } from 'component/common/InstanceStatus/InstanceStatus';
|
2022-08-23 14:20:02 +02:00
|
|
|
import { UIProviderContainer } from 'component/providers/UIProvider/UIProviderContainer';
|
2023-10-19 16:50:37 +02:00
|
|
|
import { StickyProvider } from 'component/common/Sticky/StickyProvider';
|
2024-01-10 10:31:41 +01:00
|
|
|
import { FeedbackProvider } from 'component/feedbackNew/FeedbackProvider';
|
|
|
|
import { PlausibleProvider } from 'component/providers/PlausibleProvider/PlausibleProvider';
|
|
|
|
import { Error as LayoutError } from './component/layout/Error/Error';
|
|
|
|
import { ErrorBoundary } from 'react-error-boundary';
|
2024-02-09 13:07:44 +01:00
|
|
|
import { useRecordUIErrorApi } from 'hooks/api/actions/useRecordUIErrorApi/useRecordUiErrorApi';
|
2016-11-10 14:26:24 +01:00
|
|
|
|
2023-04-18 11:56:15 +02:00
|
|
|
window.global ||= window;
|
|
|
|
|
2024-02-09 13:07:44 +01:00
|
|
|
const ApplicationRoot = () => {
|
|
|
|
const { recordUiError } = useRecordUIErrorApi();
|
|
|
|
|
|
|
|
const sendErrorToApi = async (
|
|
|
|
error: Error,
|
|
|
|
info: { componentStack: string },
|
|
|
|
) => {
|
|
|
|
try {
|
|
|
|
await recordUiError({
|
|
|
|
errorMessage: error.message,
|
|
|
|
errorStack: error.stack || '',
|
|
|
|
});
|
|
|
|
} catch (e) {
|
|
|
|
console.error('Unable to log error');
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
return (
|
|
|
|
<UIProviderContainer>
|
|
|
|
<AccessProvider>
|
|
|
|
<BrowserRouter basename={basePath}>
|
|
|
|
<QueryParamProvider adapter={ReactRouter6Adapter}>
|
|
|
|
<ThemeProvider>
|
|
|
|
<AnnouncerProvider>
|
|
|
|
<ErrorBoundary
|
|
|
|
FallbackComponent={LayoutError}
|
|
|
|
onError={sendErrorToApi}
|
|
|
|
>
|
|
|
|
<PlausibleProvider>
|
|
|
|
<FeedbackProvider>
|
|
|
|
<FeedbackCESProvider>
|
|
|
|
<StickyProvider>
|
|
|
|
<InstanceStatus>
|
|
|
|
<ScrollTop />
|
|
|
|
<App />
|
|
|
|
</InstanceStatus>
|
|
|
|
</StickyProvider>
|
|
|
|
</FeedbackCESProvider>
|
|
|
|
</FeedbackProvider>
|
|
|
|
</PlausibleProvider>
|
|
|
|
</ErrorBoundary>
|
|
|
|
</AnnouncerProvider>
|
|
|
|
</ThemeProvider>
|
|
|
|
</QueryParamProvider>
|
|
|
|
</BrowserRouter>
|
|
|
|
</AccessProvider>
|
|
|
|
</UIProviderContainer>
|
|
|
|
);
|
|
|
|
};
|
|
|
|
|
|
|
|
ReactDOM.render(<ApplicationRoot />, document.getElementById('app'));
|