@@ -3,37 +3,49 @@ import { BrowserRouter as Router, Routes, Route } from 'react-router-dom'
33import { createRoot } from 'react-dom/client'
44import { routes } from './routes.tsx'
55import { Box , CssBaseline } from '@mui/material'
6+ import { CacheProvider } from '@emotion/react'
7+ import createCache from '@emotion/cache'
68import { SnackbarProvider } from 'notistack'
79import PiwikPro from '@piwikpro/react-piwik-pro'
810
11+ // to test the nonce, we need to build the app and serve it with CSP policy
12+ const nonce = '8IBTHwOdqNKAWeKl7plt8g==' // nonce placeholder
13+ const cache = createCache ( {
14+ key : 'css' ,
15+ prepend : true ,
16+ nonce : nonce
17+ } )
18+
919PiwikPro . initialize (
1020 '957285ba-7867-4c6b-a8be-5e3e6c069b71' ,
1121 'https://astralprojection.promilci.com' ,
12- { dataLayerName : 'myDataLayer' }
22+ { dataLayerName : 'myDataLayer' , nonce }
1323)
1424
1525const App = ( ) => (
16- < SnackbarProvider
17- anchorOrigin = { { vertical : 'bottom' , horizontal : 'right' } }
18- maxSnack = { 10 }
19- >
20- < Router >
21- < Box sx = { { display : 'flex' } } >
22- < CssBaseline />
23- < Header />
24- < Box
25- component = 'main'
26- sx = { { flexGrow : 1 , bgcolor : 'background.default' , p : 3 } }
27- >
28- < Routes >
29- { routes . map ( ( { path, element } , index ) => (
30- < Route key = { index } path = { path } element = { element } />
31- ) ) }
32- </ Routes >
26+ < CacheProvider value = { cache } >
27+ < SnackbarProvider
28+ anchorOrigin = { { vertical : 'bottom' , horizontal : 'right' } }
29+ maxSnack = { 10 }
30+ >
31+ < Router >
32+ < Box sx = { { display : 'flex' } } >
33+ < CssBaseline />
34+ < Header />
35+ < Box
36+ component = 'main'
37+ sx = { { flexGrow : 1 , bgcolor : 'background.default' , p : 3 } }
38+ >
39+ < Routes >
40+ { routes . map ( ( { path, element } , index ) => (
41+ < Route key = { index } path = { path } element = { element } />
42+ ) ) }
43+ </ Routes >
44+ </ Box >
3345 </ Box >
34- </ Box >
35- </ Router >
36- </ SnackbarProvider >
46+ </ Router >
47+ </ SnackbarProvider >
48+ </ CacheProvider >
3749)
3850
3951const container = document . getElementById ( 'root' )
0 commit comments