diff --git a/site/source/iframe-integration-script.js b/site/source/iframe-integration-script.js index a4aa3953f..f03022df3 100644 --- a/site/source/iframe-integration-script.js +++ b/site/source/iframe-integration-script.js @@ -1,7 +1,11 @@ import { hexToHSL } from './hexToHSL' import getSimulationData from './pages/Simulateurs/metadata-src' +import { absoluteSitePaths } from './sitePaths' -const simulationData = getSimulationData((_, text) => text) +const simulationData = getSimulationData( + (_, text) => text, + absoluteSitePaths.fr +) const script = document.currentScript const moduleName = script.dataset.module || 'simulateur-embauche' diff --git a/site/source/pages/Simulateurs/configs/types.ts b/site/source/pages/Simulateurs/configs/types.ts index fd333332d..f001d3fd4 100644 --- a/site/source/pages/Simulateurs/configs/types.ts +++ b/site/source/pages/Simulateurs/configs/types.ts @@ -83,6 +83,7 @@ export interface PageConfig { simulation?: SimulationConfig component?: () => JSX.Element - lazyComponent?: LazyExoticComponent> + // eslint-disable-next-line @typescript-eslint/no-explicit-any + lazyComponent?: LazyExoticComponent> seoExplanations?: JSX.Element } diff --git a/site/source/pages/Simulateurs/metadata.tsx b/site/source/pages/Simulateurs/metadata.tsx index 1d77c9b5b..3df44f5d5 100644 --- a/site/source/pages/Simulateurs/metadata.tsx +++ b/site/source/pages/Simulateurs/metadata.tsx @@ -63,7 +63,7 @@ import salaireBrutNetPreviewEN from './images/SalaireBrutNetPreviewEN.png' import salaireBrutNetPreviewFR from './images/SalaireBrutNetPreviewFR.png' import urlIllustrationNetBrutEn from './images/illustration-net-brut-en.png' import urlIllustrationNetBrut from './images/illustration-net-brut.png' -import getData from './metadata-src.js' +import getData from './metadata-src' export interface SimulatorsDataParams { t: TFunction diff --git a/site/source/sitePaths.ts b/site/source/sitePaths.ts index 2ad3ff817..de554275f 100644 --- a/site/source/sitePaths.ts +++ b/site/source/sitePaths.ts @@ -1,6 +1,6 @@ -import { MetadataSrc } from 'pages/Simulateurs/metadata-src' import { useTranslation } from 'react-i18next' +import { MetadataSrc } from '@/pages/Simulateurs/metadata-src' import { LegalStatus } from '@/selectors/companyStatusSelectors' export const LANDING_LEGAL_STATUS_LIST: Array = [ diff --git a/site/vite-iframe-script.config.ts b/site/vite-iframe-script.config.ts index 6f201d1bb..0441ed49c 100644 --- a/site/vite-iframe-script.config.ts +++ b/site/vite-iframe-script.config.ts @@ -1,6 +1,12 @@ +import yaml from '@rollup/plugin-yaml' +import path from 'path' import { defineConfig } from 'vite' +import { VitePWA } from 'vite-plugin-pwa' export default defineConfig({ + resolve: { + alias: [{ find: '@', replacement: path.resolve('./source') }], + }, build: { lib: { entry: './source/iframe-integration-script.js', @@ -10,4 +16,5 @@ export default defineConfig({ }, emptyOutDir: false, }, + plugins: [yaml(), VitePWA({ disable: true })], }) diff --git a/site/vite.config.ts b/site/vite.config.ts index 735c83448..f657d15ba 100644 --- a/site/vite.config.ts +++ b/site/vite.config.ts @@ -16,7 +16,7 @@ const env = (mode: string) => loadEnv(mode, process.cwd(), '') export default defineConfig(({ command, mode }) => ({ resolve: { - alias: { '@': path.resolve('./source') }, + alias: [{ find: '@', replacement: path.resolve('./source') }], extensions: ['.js', '.ts', '.jsx', '.tsx', '.json'], }, publicDir: 'source/public',