import { OverlayProvider } from '@react-aria/overlays' import { ErrorBoundary } from '@sentry/react' import { ThemeColorsProvider } from '@/components/utils/colors' import { DisableAnimationOnPrintProvider } from '@/components/utils/DisableAnimationContext' import { IsEmbeddedProvider } from '@/components/utils/embeddedContext' import { SitePathProvider, SitePaths, } from '@/components/utils/SitePathsContext' import { GlobalStyle } from '@/design-system/global-style' import { Container } from '@/design-system/layout' import DesignSystemThemeProvider from '@/design-system/root' import { H1 } from '@/design-system/typography/heading' import { Link } from '@/design-system/typography/link' import { Body, Intro } from '@/design-system/typography/paragraphs' import { createBrowserHistory } from 'history' import i18next from 'i18next' import logo from '@/images/logo-monentreprise.svg' import { useIframeResizer } from '@/hooks/useIframeResizer' import { createContext, ReactNode, useMemo } from 'react' import { HelmetProvider } from 'react-helmet-async' import { I18nextProvider } from 'react-i18next' import { Provider as ReduxProvider } from 'react-redux' import { Router } from 'react-router-dom' import { inIframe } from './utils' import { store } from './store' import * as safeLocalStorage from './storage/safeLocalStorage' // ATInternet Tracking import { TrackingContext } from './ATInternetTracking' import { createTracker } from './ATInternetTracking/Tracker' if ( !import.meta.env.SSR && import.meta.env.MODE === 'production' && 'serviceWorker' in navigator && !inIframe() ) { window.addEventListener('load', () => { navigator.serviceWorker .register('/sw.js') .then((registration) => { // eslint-disable-next-line no-console console.log('SW registered: ', registration) }) .catch((registrationError) => { // eslint-disable-next-line no-console console.log('SW registration failed: ', registrationError) }) }) } type SiteName = 'mon-entreprise' | 'infrance' | 'publicodes' export const SiteNameContext = createContext(null) export type ProviderProps = { basename: SiteName children: ReactNode sitePaths?: SitePaths } export default function Provider({ basename, children, sitePaths = {} as SitePaths, }: ProviderProps): JSX.Element { useIframeResizer() return ( logo service mon-entreprise urssaf

Une erreur est survenue

L'équipe technique mon-entreprise a été automatiquement prévenue. Vous pouvez également nous contacter directement à l'adresse{' '} contact@mon-entreprise.beta.gouv.fr {' '} si vous souhaitez partager une remarque. Veuillez nous excuser pour la gêne occasionnée. } > <>{children}
) } function BrowserRouterProvider({ children, basename, }: { children: ReactNode basename: string }) { // The server rouer is only provided in the entry-server file if (import.meta.env.SSR) { return <>{children} } // eslint-disable-next-line react-hooks/rules-of-hooks const history = useMemo( () => createBrowserHistory({ basename: import.meta.env.MODE === 'production' ? '' : basename, }), [basename] ) const ATTracker = createTracker( import.meta.env.VITE_AT_INTERNET_SITE_ID, safeLocalStorage.getItem('tracking:do_not_track') === '1' || navigator.doNotTrack === '1' ) return ( <>{children} ) }