Fix iframe intégration

pull/2494/head
Johan Girod 2023-02-01 15:00:05 +01:00
parent 78ebdc555f
commit bb74d4c873
3 changed files with 8 additions and 19 deletions

View File

@ -1,18 +1,8 @@
import { hexToHSL } from './hexToHSL'
import getSimulationData from './pages/Simulateurs/metadata-src'
import { absoluteSitePaths } from './sitePaths'
const simulationData = getSimulationData(
(_, text) => text,
absoluteSitePaths.fr
)
const script = document.currentScript
const moduleName = script.dataset.module || 'simulateur-embauche'
const moduleData = simulationData[moduleName]
const moduleIframeTitle = moduleData?.title || ''
const couleur =
script.dataset.couleur &&
@ -24,8 +14,8 @@ const src = new URL(
(lang === 'fr'
? import.meta.env.VITE_FR_BASE_URL
: import.meta.env.VITE_EN_BASE_URL) +
'/iframes/' +
moduleName
'/iframes/' +
moduleName
)
src.searchParams.set('iframe', true)
@ -40,6 +30,7 @@ if (couleur) {
const iframe = document.createElement('iframe')
const iframeAttributes = {
title: 'Simulateur',
id: 'simulateurEmbauche',
src: src.toString(),
style: 'border: none; width: 100%; display: block; height: 700px',
@ -47,7 +38,6 @@ const iframeAttributes = {
allowfullscreen: true,
webkitallowfullscreen: true,
mozallowfullscreen: true,
title: moduleIframeTitle,
}
for (var key in iframeAttributes) {
iframe.setAttribute(key, iframeAttributes[key])

View File

@ -1,5 +1,4 @@
import { lazy } from 'react'
import CoutCreationEntreprise from '.'
import { PageConfig } from '../configs/types'
import { SimulatorsDataParams } from '../metadata'
@ -46,7 +45,7 @@ export const configCoûtCréationEntreprise = function <
},
situation: {},
},
lazyComponent: lazy(async () => await import('.')),
component: CoutCreationEntreprise,
// Remove this "as const" when we upgrade to typescript v5:
} as const,

View File

@ -25642,8 +25642,8 @@ __metadata:
linkType: hard
"rollup@npm:^3.7.2":
version: 3.12.0
resolution: "rollup@npm:3.12.0"
version: 3.12.1
resolution: "rollup@npm:3.12.1"
dependencies:
fsevents: ~2.3.2
dependenciesMeta:
@ -25651,7 +25651,7 @@ __metadata:
optional: true
bin:
rollup: dist/bin/rollup
checksum: 66182947ea74bd4777e1a02514124f49eacc6b123e23738cf31342f8e73b79e43da05671aebe6d5f55b5830ebf3dd11f2eaba1b98b8fc6a9e6d96fd4c3ecc534
checksum: b6b3aa4bcc13b1f15c1945201f3837be07b249854ed8a73bd67411ffe56f691b808d5b563246b78ecea4110afdb9e9e6cc7d5a3f82965a5592187dbb10d3671f
languageName: node
linkType: hard