{"version":3,"sources":["MsalConfig.ts","i18n.ts","registerServiceWorker.js","index.tsx","configService.ts"],"names":["getMsalConfig","auth","clientId","ConfigService","get","authority","tenantId","connexionPolicy","redirectUri","knownAuthorities","cache","cacheLocation","secureCookies","system","loggerOptions","loggerCallback","level","message","containsPii","LogLevel","Error","console","error","Info","info","Verbose","debug","Warning","warn","getLoginRequest","scopes","acquireTokenScopes","i18n","use","initReactI18next","languageDetector","init","supportedLngs","detection","order","nonExplicitSupportedLngs","fallbackLng","interpolation","escapeValue","isLocalhost","Boolean","window","location","hostname","match","register","navigator","URL","process","origin","addEventListener","swUrl","fetch","then","response","status","headers","indexOf","serviceWorker","ready","registration","unregister","reload","registerValidSW","catch","log","checkValidServiceWorker","onupdatefound","installingWorker","installing","onstatechange","state","controller","msalInstance","AppBasic","React","lazy","document","title","buildinfo","versionMajorMinor","build","buildNumber","Promise","resolve","reject","xhr","XMLHttpRequest","open","onload","responseText","onerror","statusText","send","res","setup","PublicClientApplication","configMsalInstance","rootElement","getElementById","ReactDOM","render","basename","Suspense","fallback","instance","registerServiceWorker","renderApp","addEventCallback","event","accounts","eventType","EventType","HANDLE_REDIRECT_END","getAllAccounts","length","setActiveAccount","setupAxiosInterceptors","displayGenericError","err","genericErrorHandler","axios","interceptors","request","config","account","getActiveAccount","silentRequest","acquireTokenSilent","responseOfAcquireTokenSilent","accessToken","Authorization","lang","language","errorOfAcquireTokenSilent","InteractionRequiredAuthError","acquireTokenRedirect","undefined","logoutRedirect","postLogoutRedirectUri","__colas_xroad_disableGenericErrorHandler","_config","JSON","parse"],"mappings":"oGAAA,wFAIaA,EAAiB,WAC1B,MAAO,CACHC,KAAM,CACJC,SAAWC,IAAcC,MAAMH,KAAKC,SACpCG,UAAU,WAAD,OAAaF,IAAcC,MAAMH,KAAKK,SAAtC,yBAA+DH,IAAcC,MAAMH,KAAKK,SAAxF,4BAAoHH,IAAcC,MAAMH,KAAKM,iBACtJC,YAAa,IACbC,iBAAkB,CAAC,GAAD,O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import { ConfigService } from './configService';\r\n\r\n \r\nexport const getMsalConfig = () : Configuration => {\r\n return {\r\n auth: {\r\n clientId: ConfigService.get().auth.clientId,\r\n authority: `https://${ConfigService.get().auth.tenantId}.b2clogin.com/${ConfigService.get().auth.tenantId}.onmicrosoft.com/${ConfigService.get().auth.connexionPolicy}`,\r\n redirectUri: \"/\",\r\n knownAuthorities: [`${ConfigService.get().auth.tenantId}.b2clogin.com`],\r\n // navigateToLoginRequestUrl: true,\r\n },\r\n cache: {\r\n //Location of token cache in browser. Default: \"sessionStorage\"\r\n cacheLocation: \"sessionStorage\", // This configures where your cache will be stored\r\n \r\n //If true, stores cache items in cookies as well as browser cache. Should be set to true for use cases using IE. Default: false\r\n // Set this to \"true\" if you are having issues on IE11 or Edge\r\n //storeAuthStateInCookie: true,\r\n \r\n //If true and storeAuthStateInCookies is also enabled, MSAL adds the Secure flag to the browser cookie so it can only be sent over HTTPS. Default: false\r\n secureCookies: false\r\n },\r\n system: {\t\r\n loggerOptions: {\t\r\n loggerCallback: (level, message, containsPii) => {\t\r\n if (containsPii) {\t\t\r\n return;\t\t\r\n }\t\t\r\n switch (level) {\r\n case LogLevel.Error:\r\n console.error(message);\r\n return;\r\n case LogLevel.Info:\r\n console.info(message);\r\n return;\r\n case LogLevel.Verbose:\r\n console.debug(message);\r\n return;\r\n case LogLevel.Warning:\r\n console.warn(message);\r\n return;\r\n default:\r\n return;\r\n }\t\r\n }\t\r\n }\t\r\n }\r\n };\r\n}\r\n\r\nexport const getLoginRequest = () =>{\r\n return {\r\n scopes: [\"openid\"],\r\n acquireTokenScopes: [`https://${ConfigService.get().auth.tenantId}.onmicrosoft.com/default/user_impersonation`]\r\n };\r\n}\r\n","import i18n from \"i18next\";\r\nimport languageDetector from 'i18next-browser-languagedetector';\r\nimport { initReactI18next } from \"react-i18next\";\r\n\r\n\r\ni18n\r\n .use(initReactI18next)\r\n .use(languageDetector)\r\n .init({\r\n supportedLngs: [\"en\", \"fr\"],\r\n detection: { order: [\"path\", \"navigator\"] },\r\n nonExplicitSupportedLngs: true,\r\n fallbackLng: \"en\",\r\n interpolation: {\r\n escapeValue: false \r\n }\r\n });\r\n\r\nexport default i18n;\r\n\r\n","// In production, we register a service worker to serve assets from local cache.\r\n\r\n// This lets the app load faster on subsequent visits in production, and gives\r\n// it offline capabilities. However, it also means that developers (and users)\r\n// will only see deployed updates on the \"N+1\" visit to a page, since previously\r\n// cached resources are updated in the background.\r\n\r\n// To learn more about the benefits of this model, read https://goo.gl/KwvDNy.\r\n// This link also includes instructions on opting out of this behavior.\r\n\r\nconst isLocalhost = Boolean(\r\n window.location.hostname === 'localhost' ||\r\n // [::1] is the IPv6 localhost address.\r\n window.location.hostname === '[::1]' ||\r\n // 127.0.0.1/8 is considered localhost for IPv4.\r\n window.location.hostname.match(\r\n /^127(?:\\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$/\r\n )\r\n);\r\n\r\nexport default function register () {\r\n if (process.env.NODE_ENV === 'production' && 'serviceWorker' in navigator) {\r\n // The URL constructor is available in all browsers that support SW.\r\n const publicUrl = new URL(process.env.PUBLIC_URL, window.location);\r\n if (publicUrl.origin !== window.location.origin) {\r\n // Our service worker won't work if PUBLIC_URL is on a different origin\r\n // from what our page is served on. This might happen if a CDN is used to\r\n // serve assets; see https://github.com/facebookincubator/create-react-app/issues/2374\r\n return;\r\n }\r\n\r\n window.addEventListener('load', () => {\r\n const swUrl = `${process.env.PUBLIC_URL}/service-worker.js`;\r\n\r\n if (isLocalhost) {\r\n // This is running on localhost. Lets check if a service worker still exists or not.\r\n checkValidServiceWorker(swUrl);\r\n } else {\r\n // Is not local host. Just register service worker\r\n registerValidSW(swUrl);\r\n }\r\n });\r\n }\r\n}\r\n\r\nfunction registerValidSW (swUrl) {\r\n navigator.serviceWorker\r\n .register(swUrl)\r\n .then(registration => {\r\n registration.onupdatefound = () => {\r\n const installingWorker = registration.installing;\r\n installingWorker.onstatechange = () => {\r\n if (installingWorker.state === 'installed') {\r\n if (navigator.serviceWorker.controller) {\r\n // At this point, the old content will have been purged and\r\n // the fresh content will have been added to the cache.\r\n // It's the perfect time to display a \"New content is\r\n // available; please refresh.\" message in your web app.\r\n console.log('New content is available; please refresh.');\r\n } else {\r\n // At this point, everything has been precached.\r\n // It's the perfect time to display a\r\n // \"Content is cached for offline use.\" message.\r\n console.log('Content is cached for offline use.');\r\n }\r\n }\r\n };\r\n };\r\n })\r\n .catch(error => {\r\n console.error('Error during service worker registration:', error);\r\n });\r\n}\r\n\r\nfunction checkValidServiceWorker (swUrl) {\r\n // Check if the service worker can be found. If it can't reload the page.\r\n fetch(swUrl)\r\n .then(response => {\r\n // Ensure service worker exists, and that we really are getting a JS file.\r\n if (\r\n response.status === 404 ||\r\n response.headers.get('content-type').indexOf('javascript') === -1\r\n ) {\r\n // No service worker found. Probably a different app. Reload the page.\r\n navigator.serviceWorker.ready.then(registration => {\r\n registration.unregister().then(() => {\r\n window.location.reload();\r\n });\r\n });\r\n } else {\r\n // Service worker found. Proceed as normal.\r\n registerValidSW(swUrl);\r\n }\r\n })\r\n .catch(() => {\r\n console.log(\r\n 'No internet connection found. App is running in offline mode.'\r\n );\r\n });\r\n}\r\n\r\nexport function unregister () {\r\n if ('serviceWorker' in navigator) {\r\n navigator.serviceWorker.ready.then(registration => {\r\n registration.unregister();\r\n });\r\n }\r\n}\r\n","import \"react-app-polyfill/ie11\";\r\nimport \"react-app-polyfill/stable\";\r\nimport i18n from './i18n';\r\nimport React from 'react';\r\nimport ReactDOM from 'react-dom';\r\nimport { BrowserRouter } from 'react-router-dom';\r\nimport registerServiceWorker from './registerServiceWorker';\r\nimport { ConfigService } from './configService';\r\nimport buildinfo from './config/buildinfo.json';\r\n// const App = React.lazy(() => import('./App'));\r\nconst AppBasic = React.lazy(() => import('./AppBasic'));\r\nimport { getLoginRequest, getMsalConfig } from \"./MsalConfig\";\r\nimport { Configuration, EventMessage, EventType, IPublicClientApplication, InteractionRequiredAuthError, PublicClientApplication, SilentRequest } from \"@azure/msal-browser\";\r\nimport { MsalProvider } from \"@azure/msal-react\";\r\nimport axios, { AxiosRequestConfig } from 'axios';\r\nimport { toast } from \"react-toastify\";\r\n\r\nwindow.document.title += ` v3.${buildinfo.versionMajorMinor}.${buildinfo.build.buildNumber}`;\r\n\r\nlet msalInstance : PublicClientApplication;\r\n\r\nfunction renderApp(){\r\n const baseUrl = \"/\";\r\n const rootElement = document.getElementById('root');\r\n\r\n ReactDOM.render(\r\n \r\n }>\r\n \r\n \r\n \r\n \r\n ,\r\n rootElement);\r\n registerServiceWorker();\r\n}\r\n\r\nvar settingsPromise = new Promise((resolve, reject)=> {\r\n const xhr = new XMLHttpRequest();\r\n xhr.open(\"GET\", 'config/appsettings.json');\r\n xhr.onload = () => resolve(xhr.responseText);\r\n xhr.onerror = () => reject(xhr.statusText);\r\n xhr.send();\r\n });\r\n settingsPromise.then((res)=>{\r\n ConfigService.setup(res);\r\n msalInstance = new PublicClientApplication(getMsalConfig() );\r\n configMsalInstance(msalInstance);\r\n renderApp();\r\n });\r\n\r\nconst configMsalInstance = (msalInstance : PublicClientApplication) => {\r\n\r\n msalInstance.addEventCallback((event: EventMessage) => {\r\n\r\n let accounts; \r\n switch (event.eventType) {\r\n \r\n case EventType.HANDLE_REDIRECT_END:\r\n \r\n accounts = msalInstance.getAllAccounts()\r\n if (accounts.length > 0) {\r\n msalInstance.setActiveAccount(accounts[0]);\r\n \r\n //setup interceptors\r\n setupAxiosInterceptors(msalInstance, displayGenericError);\r\n }\r\n break;\r\n default:\r\n break;\r\n }\r\n });\r\n }\r\n\r\nconst displayGenericError = (err) => {\r\n console.error(err);\r\n // Pas de notif à l'utilisateur de manière générique globale\r\n}\r\n\r\nconst setupAxiosInterceptors = (msalInstance: IPublicClientApplication, genericErrorHandler: (error: any) => void) => {\r\n\r\n axios.interceptors.request.use(\r\n\r\n //onFulfilled\r\n (config: AxiosRequestConfig) => {\r\n\r\n const account = msalInstance.getActiveAccount();\r\n if (!account) {\r\n throw Error(\"No active account! Verify a user has been signed in and setActiveAccount has been called.\");\r\n }\r\n\r\n return new Promise((resolve, reject) => {\r\n\r\n //See: Token Lifetimes, Expiration, and Renewal\r\n //https://github.com/AzureAD/microsoft-authentication-library-for-js/blob/dev/lib/msal-browser/docs/token-lifetimes.md#token-renewal\r\n\r\n const silentRequest: SilentRequest = { scopes: getLoginRequest().acquireTokenScopes, account: account };\r\n return msalInstance.acquireTokenSilent(silentRequest)\r\n\r\n .then((responseOfAcquireTokenSilent) => {\r\n if (responseOfAcquireTokenSilent?.accessToken) {\r\n config.headers.Authorization = `Bearer ${responseOfAcquireTokenSilent.accessToken}`;\r\n config.headers.lang = i18n.language;\r\n resolve(config);\r\n } else {\r\n // Do something with error of acquiring the token\r\n console.error(responseOfAcquireTokenSilent);\r\n reject(config);\r\n }\r\n })\r\n\r\n .catch((errorOfAcquireTokenSilent) => {\r\n // fallback to interaction when silent call fails\r\n if (errorOfAcquireTokenSilent instanceof InteractionRequiredAuthError) {\r\n console.warn(errorOfAcquireTokenSilent);\r\n return msalInstance.acquireTokenRedirect(silentRequest);\r\n } else {\r\n console.error(errorOfAcquireTokenSilent);\r\n return Promise.reject(config);\r\n }\r\n });\r\n })\r\n },\r\n\r\n //onRejected\r\n (error: any) => {\r\n // Do something with error of the request\r\n return Promise.reject(error)\r\n });\r\n\r\n //En cas de session expirée, l'utilisateur est redirigé vers la page d'authentification\r\n axios.interceptors.response.use(\r\n\r\n undefined,\r\n\r\n err => {\r\n\r\n if (err && err.response && err.response.status === 401) {\r\n msalInstance.logoutRedirect({ postLogoutRedirectUri: \"/\" });\r\n }\r\n\r\n if (!err.config?.__colas_xroad_disableGenericErrorHandler) {\r\n genericErrorHandler(err);\r\n }\r\n\r\n return Promise.reject(err);\r\n });\r\n}\r\n\r\n\r\n\r\n\r\n\r\n","/*eslint-disable*/\r\nimport { MatomoSettings } from './shared/MatomoSettings';\r\n\r\ninterface IConfig {\r\n azureMapKey: string;\r\n powerBiUrl: string,\r\n minimumLoadCapacity: number,\r\n UseSPAAndApiSeparately: boolean,\r\n cartoUrl: string,\r\n cartoToken: string,\r\n vectuelMapUrl: string,\r\n mapprUrl: string,\r\n vectuelProjectName: string,\r\n chantier360Url: string,\r\n carbonCounterUrl: string,\r\n mapBoxToken: string,\r\n dataProxyApiUrl: string,\r\n inexApiUrl: string,\r\n configMapBoxLayersUrl: string,\r\n matomo: MatomoSettings,\r\n mapillaryToken: string,\r\n auth: Auth,\r\n maxPOIsToCreate: number\r\n}\r\n\r\ninterface Auth {\r\n clientId : string,\r\n connexionPolicy : string,\r\n tenantId : string\r\n}\r\n\r\nexport class ConfigService {\r\n private static _config: IConfig = null;\r\n\r\n private constructor() {\r\n\r\n }\r\n\r\n static get = () => {\r\n if (ConfigService._config)\r\n return ConfigService._config;\r\n throw console.error('get conf erreur: vous devez réinitialiser votre configuration');\r\n }\r\n\r\n public static setup = (res) => {\r\n if (res) {\r\n var config = JSON.parse(res);\r\n ConfigService._config = config;\r\n }\r\n }\r\n}"],"sourceRoot":""}