import { StrictMode } from 'react';
import { createRoot } from 'react-dom/client';
import { ApolloProvider } from '@apollo/client';
import { Shop } from '@assets/js-shop/Shop';
import { apolloClient } from './apolloClient';
import { SentryErrorBoundary } from '@assets/js-shop/sentry/SentryErrorBoundary';

const root = document.getElementById('js-shop');

if (root) {
   const reactRoot = createRoot(root);

   reactRoot.render(
      <StrictMode>
         <SentryErrorBoundary>
            <ApolloProvider client={apolloClient}>
               <Shop client={apolloClient} />
            </ApolloProvider>
         </SentryErrorBoundary>
      </StrictMode>,
   );
}
