répare l'integration iframe et ajoute les redirection pour les pages prérendues

pull/527/head
Johan Girod 2019-04-18 16:30:11 +02:00
parent e0f3178834
commit b32e4b8c81
No known key found for this signature in database
GPG Key ID: 9E27B57DA2E8AE12
13 changed files with 134 additions and 60 deletions

View File

@ -17,14 +17,20 @@ from = "https://mycompanyinfrance.fr/sitemap.txt"
to = "/sitemap.infrance.en.txt"
status = 200
## Redirection pour les pages prérendues
[[redirects]]
from = "https://mycompanyinfrance.fr"
to = "/prerender/infrance/index.html"
status = 200
[[redirects]]
from = "https://mycompanyinfrance.fr/social-security"
to = "/prerender/infrance/social-security/index.html"
from = "https://mycompanyinfrance.fr/social-security/salaried"
to = "/prerender/infrance/social-security/salaried/index.html"
status = 200
[[redirects]]
from = "https://mycompanyinfrance.fr/iframes/simulateur-embauche"
to = "/prerender/infrance/iframes/simulateur-embauche/index.html"
status = 200
[[redirects]]
@ -49,18 +55,30 @@ from = "https://mon-entreprise.fr/sitemap.txt"
to = "/sitemap.infrance.fr.txt"
status = 200
## Redirection pour les pages prérendues
[[redirects]]
from = "https://mon-entreprise.fr"
to = "/prerender/mon-entreprise/index.html"
status = 200
[[redirects]]
from = "https://mon-entreprise.fr/social-security/salaried"
to = "/prerender/mon-entreprise/sécurité-sociale/salarié/index.html"
status = 200
[[redirects]]
from = "https://mon-entreprise.fr/iframes/simulateur-embauche"
to = "/prerender/mon-entreprise/iframes/simulateur-embauche/index.html"
status = 200
[[redirects]]
from = "https://mon-entreprise.fr/*"
to = "/mon-entreprise.html"
status = 200
# Embauche PRODUCTION settings
# Embauche redirection settings
[[redirects]]
from = "https://embauche.beta.gouv.fr/"
@ -72,22 +90,17 @@ from = "https://embauche.beta.gouv.fr/documentation/*"
to = "https://mon-entreprise.fr/documentation/:splat"
status = 301
## Old iframe adresse
[[redirects]]
from = "https://embauche.beta.gouv.fr/"
to = "https://mon-entreprise.fr/sécurité-sociale/salarié"
from = "https://embauche.beta.gouv.fr/modules/v2/dist/simulateur.js"
to = "https://mon-entreprise.fr/simulateur-iframe-integration-script.js"
status = 301
# Old iframe adresse
[[redirects]]
from = "https://embauche.beta.gouv.fr/modules/v2/*"
to = "/:splat"
from = "https://embauche.beta.gouv.fr/dist/simulateur.js"
to = "https://mon-entreprise.fr/simulateur-iframe-integration-script.js"
status = 301
# When in iframe, we don't prerender the page
[[redirects]]
from = "https://embauche.beta.gouv.fr/"
query = {iframe=":iframe", s=":e", couleur=":couleur", integratorUrl=":integratorUrl", lang=":lang"}
to = "/embauche.html?iframe=:iframe&s=:e&couleur=:couleur&integratorUrl=:integratorUrl&lang=:lang"
status = 200
# Redirect to mycompanyinfrance in staging and development settings
@ -109,6 +122,17 @@ status = 200
from = "/"
to = "/prerender/mon-entreprise/index.html"
status = 200
[[redirects]]
from = "/sécurité-sociale/salarié"
to = "/prerender/mon-entreprise/sécurité-sociale/salarié/index.html"
status = 200
[[redirects]]
from = "/iframes/simulateur-embauche"
to = "/prerender/mon-entreprise/iframes/simulateur-embauche/index.html"
status = 200
[[redirects]]
from = "/*"
to = "/mon-entreprise.html"

View File

@ -81,13 +81,11 @@
"test-lib": "yarn test-common --grep 'library'",
"compile-lib": "yarn webpack --config source/webpack.lib.js",
"compile-dev": "FR_SITE='http://localhost:5000${path}' EN_SITE='http://localhost:5001${path}' yarn run compile",
"mon-entreprise:serve": "PORT=5000 serve --config serve.mon-entreprise.json",
"mon-entreprise:serve": "PORT=5000 serve --config serve.mon-entreprise.json --no-clipboard",
"mon-entreprise:test": "cypress open",
"mycompanyinfrance:serve": "PORT=5001 serve --config serve.infrance.json",
"mycompanyinfrance:serve": "PORT=5001 serve --config serve.infrance.json --no-clipboard",
"mycompanyinfrance:test": "cypress open --env language=en --config baseUrl=http://localhost:8080/infrance",
"embauche:serve": "cp dist/embauche.html dist/index.html && PORT=5002 serve -s dist",
"embauche:test": "cypress open --config baseUrl=http://localhost:8080/embauche,integrationFolder=cypress/integration/embauche",
"serve-dev": "yarn run mon-entreprise:serve & yarn run mycompanyinfrance:serve & yarn run embauche:serve"
"serve-dev": "yarn run mon-entreprise:serve & yarn run mycompanyinfrance:serve"
},
"devDependencies": {
"@babel/core": "^7.1.0",
@ -143,7 +141,7 @@
"ramda-fantasy": "^0.8.0",
"raw-loader": "^0.5.1",
"react-hot-loader": "^4.7.1",
"serve": "^10.0.2",
"serve": "^11.0.0",
"serve-handler": "^5.0.5",
"sinon": "^4.5.0",
"sinon-chai": "^3.0.0",

View File

@ -33,8 +33,8 @@
vertical-align: middle;
border-radius: 20px;
cursor: pointer;
box-shadow: 0 0 0px 1.5px var(--colour);
box-shadow: 0 0 0px 1.5px rgb(41, 117, 209);
box-shadow: 0 0 0px 1.5px var(--colour);
transition: all 0.1s;
border: 0.5em solid white;
}

View File

@ -541,7 +541,7 @@ contrat salarié . salaire:
contrat salarié . salaire . brut de base:
titre.en: Gross salary
titre.fr: Salaire brut de base
résumé.en: Written in the employment contract.
résumé.en: Written in the employment contract
résumé.fr: Inscrit dans le contrat de travail
question.en: What is the monthly gross salary?
question.fr: Quel est le salaire de base ?
@ -749,7 +749,7 @@ contrat salarié . salaire . net:
titre.fr: Salaire net
question.en: What is the net salary?
question.fr: Quel est le salaire net ?
résumé.en: Received by the employee.
résumé.en: Received by the employee
résumé.fr: Salaire net avant impôt
description.en: >
The gross salary minus the social contributions.
@ -829,7 +829,7 @@ contrat salarié . rémunération . total:
titre.fr: Total chargé
question.en: 'What is the monthly remuneration, contributions included ?'
question.fr: Quel est la rémunération chargée ?
résumé.en: Spent by the employer.
résumé.en: Spent by the employer
résumé.fr: Dépensé par l'employeur
description.en: >-
It is the gross salary, plus the employer contributions. It is the total

View File

@ -28,6 +28,7 @@ import Header from './layout/Header/Header'
import Navigation from './layout/Navigation/Navigation'
import trackSimulatorActions from './middlewares/trackSimulatorActions'
import CompanyIndex from './pages/Company'
import Couleur from './pages/Dev/Couleur'
import IntegrationTest from './pages/Dev/IntegrationTest'
import Sitemap from './pages/Dev/Sitemap'
import Documentation from './pages/Documentation'
@ -131,6 +132,7 @@ const App = compose(
path="/dev/integration-test"
component={IntegrationTest}
/>
<Route exact path="/dev/couleur" component={Couleur} />
<Route component={Route404} />
</Switch>

View File

@ -1,10 +1,14 @@
import { iframeResizer } from 'iframe-resizer';
let script = document.getElementById('script-simulateur-embauche'),
couleur = script.dataset.couleur,
baseUrl =
script.dataset.iframeUrl || script.getAttribute('src').split('dist')[0] + 'iframes/simulateur-embauche',
integratorUrl = encodeURIComponent(window.location.href.toString()),
lang = script.dataset.lang,
baseUrl =
script.dataset.iframeUrl ||
(lang === 'en' ? process.env.EN_SITE : process.env.FR_SITE).replace(
'${path}',
'/iframes/simulateur-embauche'
),
integratorUrl = encodeURIComponent(window.location.href.toString()),
src =
baseUrl +
`?s=e&couleur=${couleur}&iframe&integratorUrl=${integratorUrl}&lang=${lang}`

View File

@ -39,7 +39,11 @@ export default function Integration() {
<strong>choisir la couleur principale du module</strong> pour le
fondre dans le thème visuel de votre page : changez simplement
la valeur de <i>data-couleur</i> ci-dessus. Pour la choisir,
utilisez notre <Link to="/dev/couleur">outil interactif</Link>.
utilisez notre{' '}
<Link onClick={() => setOpened(false)} to="/dev/couleur">
outil interactif
</Link>
.
</p>
<p>
L'attribut <i>data-lang="en"</i> vous permet quand à lui de

View File

@ -50,7 +50,9 @@ export default withLanguage(
height: '200px',
width: '100%'
}}
src={`https://stats.data.gouv.fr/index.php?module=CoreAdminHome&action=optOut&language=${language}`}
src={`https://stats.data.gouv.fr/index.php?module=CoreAdminHome&action=optOut&language=${
this.props.language
}`}
/>
</Overlay>
)}

View File

@ -2,13 +2,14 @@
import withColours, { ThemeColoursProvider } from 'Components/utils/withColours'
import React, { Suspense, useState } from 'react'
import Home from './Home'
import Home from '../Iframes/SimulateurEmbauche'
let LazyColorPicker = React.lazy(() => import('./ColorPicker'))
const Couleur = ({ colours: { colour: defaultColour } }) => {
const [colour, setColour] = useState(defaultColour)
return (
<div className="ui__ container">
<>
<h1>Changez la couleur de l'integration </h1>
<p className="indication">
Visualisez sur cette page lapparence du module pour différentes
couleurs principales.
@ -20,10 +21,12 @@ const Couleur = ({ colours: { colour: defaultColour } }) => {
La couleur sélectionnée, à déclarer comme attribut
&quot;data-couleur&quot; du script sur votre page est : <b>{colour}</b>
</p>
<ThemeColoursProvider colour={colour}>
<Home />
</ThemeColoursProvider>
</div>
<div className="ui__ card">
<ThemeColoursProvider colour={colour}>
<Home />
</ThemeColoursProvider>
</div>
</>
)
}

View File

@ -1,12 +1,22 @@
import Banner from 'Components/Banner'
import withSitePaths from 'Components/utils/withSitePaths'
import { compose } from 'ramda'
import React from 'react'
import { Helmet } from 'react-helmet'
import { connect } from 'react-redux'
import SalariéSimulation from '../SocialSecurity/Salarié'
export default connect(state => ({
showMonEntrepriseLink: !state.conversationStarted
}))(function IframeSimulateurEmbauche({ showMonEntrepriseLink }) {
export default compose(
withSitePaths,
connect(state => ({
showMonEntrepriseLink: !state.conversationStarted
}))
)(function IframeSimulateurEmbauche({ showMonEntrepriseLink, sitePaths }) {
return (
<>
<Helmet>
<link rel="canonical" href={sitePaths.sécuritéSociale.salarié} />
</Helmet>
{showMonEntrepriseLink && (
<Banner icon="✨">
Dirigeants de société, travailleurs indépendants, ou

View File

@ -1,2 +1,2 @@
User-agent: *
Disallow: /dev/
Disallow: /dev

View File

@ -21,9 +21,7 @@ module.exports = {
entry: {
'mon-entreprise': './source/sites/mon-entreprise.fr/entry.fr.js',
infrance: './source/sites/mon-entreprise.fr/entry.en.js',
// To not introduce breaking into the iframe integration, we serve simulateur.js from a 'dist' subdirectory
'dist/simulateur':
'simulateur-iframe-integration-script':
'./source/sites/mon-entreprise.fr/iframe-integration-script.js'
},
output: {

View File

@ -1000,6 +1000,7 @@ abbrev@1:
accepts@~1.3.5:
version "1.3.5"
resolved "https://registry.yarnpkg.com/accepts/-/accepts-1.3.5.tgz#eb777df6011723a3b14e8a72c0805c8e86746bd2"
integrity sha1-63d99gEXI6OxTopywIBcjoZ0a9I=
dependencies:
mime-types "~2.1.18"
negotiator "0.6.1"
@ -2353,11 +2354,11 @@ component-emitter@^1.2.1:
integrity sha1-E3kY1teCg/ffemt8WmPhQOaUJeY=
compressible@~2.0.14:
version "2.0.15"
resolved "https://registry.yarnpkg.com/compressible/-/compressible-2.0.15.tgz#857a9ab0a7e5a07d8d837ed43fe2defff64fe212"
integrity sha512-4aE67DL33dSW9gw4CI2H/yTxqHLNcxp0yS6jB+4h+wr3e43+1z7vm0HU9qXOH8j+qjKuL8+UtkOxYQSMq60Ylw==
version "2.0.16"
resolved "https://registry.yarnpkg.com/compressible/-/compressible-2.0.16.tgz#a49bf9858f3821b64ce1be0296afc7380466a77f"
integrity sha512-JQfEOdnI7dASwCuSPWIeVYwc/zMsu/+tRhoUvEfXz2gxOA2DNjmG5vhtFdBlhWPPGo+RdT9S3tgc/uH5qgDiiA==
dependencies:
mime-db ">= 1.36.0 < 2"
mime-db ">= 1.38.0 < 2"
compression@1.7.3:
version "1.7.3"
@ -5669,10 +5670,10 @@ miller-rabin@^4.0.0:
bn.js "^4.0.0"
brorand "^1.0.1"
"mime-db@>= 1.36.0 < 2", mime-db@~1.38.0:
version "1.38.0"
resolved "https://registry.yarnpkg.com/mime-db/-/mime-db-1.38.0.tgz#1a2aab16da9eb167b49c6e4df2d9c68d63d8e2ad"
integrity sha512-bqVioMFFzc2awcdJZIzR3HjZFX20QhilVS7hytkKrv7xFAn8bM1gzc/FOX2awLISvWe0PV8ptFKcon+wZ5qYkg==
"mime-db@>= 1.38.0 < 2", mime-db@~1.39.0:
version "1.39.0"
resolved "https://registry.yarnpkg.com/mime-db/-/mime-db-1.39.0.tgz#f95a20275742f7d2ad0429acfe40f4233543780e"
integrity sha512-DTsrw/iWVvwHH+9Otxccdyy0Tgiil6TWK/xhfARJZF/QFhwOgZgOIvA2/VIGpM8U7Q8z5nDmdDWC6tuVMJNibw==
mime-db@~1.33.0:
version "1.33.0"
@ -5684,6 +5685,11 @@ mime-db@~1.37.0:
resolved "https://registry.yarnpkg.com/mime-db/-/mime-db-1.37.0.tgz#0b6a0ce6fdbe9576e25f1f2d2fde8830dc0ad0d8"
integrity sha512-R3C4db6bgQhlIhPU48fUtdVmKnflq+hRdad7IyKhtFj06VPNVdk2RhiYL3UjQIlso8L+YxAtFkobT0VK+S/ybg==
mime-db@~1.38.0:
version "1.38.0"
resolved "https://registry.yarnpkg.com/mime-db/-/mime-db-1.38.0.tgz#1a2aab16da9eb167b49c6e4df2d9c68d63d8e2ad"
integrity sha512-bqVioMFFzc2awcdJZIzR3HjZFX20QhilVS7hytkKrv7xFAn8bM1gzc/FOX2awLISvWe0PV8ptFKcon+wZ5qYkg==
mime-types@2.1.18:
version "2.1.18"
resolved "https://registry.yarnpkg.com/mime-types/-/mime-types-2.1.18.tgz#6f323f60a83d11146f831ff11fd66e2fe5503bb8"
@ -5698,7 +5704,14 @@ mime-types@^2.1.12:
dependencies:
mime-db "~1.38.0"
mime-types@~2.1.18, mime-types@~2.1.19:
mime-types@~2.1.18:
version "2.1.23"
resolved "https://registry.yarnpkg.com/mime-types/-/mime-types-2.1.23.tgz#d4eacd87de99348a6858fe1e479aad877388d977"
integrity sha512-ROk/m+gMVSrRxTkMlaQOvFmFmYDc7sZgrjjM76abqmd2Cc5fCV7jAMA5XUccEtJ3cYiYdgixUVI+fApc2LkXlw==
dependencies:
mime-db "~1.39.0"
mime-types@~2.1.19:
version "2.1.21"
resolved "https://registry.yarnpkg.com/mime-types/-/mime-types-2.1.21.tgz#28995aa1ecb770742fe6ae7e58f9181c744b3f96"
integrity sha512-3iL6DbwpyLzjR3xHSFNFeb9Nz/M8WDkX33t1GFQnFOllWk8pOrh/LSrB5OXlnlW5P9LH73X6loW/eogc+F5lJg==
@ -5983,6 +5996,7 @@ needle@^2.2.1:
negotiator@0.6.1:
version "0.6.1"
resolved "https://registry.yarnpkg.com/negotiator/-/negotiator-0.6.1.tgz#2b327184e8992101177b28563fb5e7102acd0ca9"
integrity sha1-KzJxhOiZIQEXeyhWP7XnECrNDKk=
neo-async@^2.5.0:
version "2.6.0"
@ -6276,9 +6290,9 @@ on-finished@~2.3.0:
ee-first "1.1.1"
on-headers@~1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/on-headers/-/on-headers-1.0.1.tgz#928f5d0f470d49342651ea6794b0857c100693f7"
integrity sha1-ko9dD0cNSTQmUepnlLCFfBAGk/c=
version "1.0.2"
resolved "https://registry.yarnpkg.com/on-headers/-/on-headers-1.0.2.tgz#772b0ae6aaa525c399e489adfad90c403eb3c28f"
integrity sha512-pZAE+FJLoyITytdqK0U5s+FIpjN0JP3OzFi/u8Rx+EV5/W+JTWGXG8xFzevE7AjBfDqHv/8vL8qQsIhHnqRkrA==
once@^1.3.0, once@^1.3.1, once@^1.4.0:
version "1.4.0"
@ -8122,7 +8136,21 @@ serialize-javascript@^1.4.0:
resolved "https://registry.yarnpkg.com/serialize-javascript/-/serialize-javascript-1.6.1.tgz#4d1f697ec49429a847ca6f442a2a755126c4d879"
integrity sha512-A5MOagrPFga4YaKQSWHryl7AXvbQkEqpw4NNYMTNYUNV51bA8ABHgYFpqKx+YFFrw59xMV1qGH1R4AgoNIVgCw==
serve-handler@5.0.8, serve-handler@^5.0.5:
serve-handler@6.0.0:
version "6.0.0"
resolved "https://registry.yarnpkg.com/serve-handler/-/serve-handler-6.0.0.tgz#c6eaf6f89881adede09cd737b54e8b2eff4fd585"
integrity sha512-2/e0+N1abV1HAN+YN8uCOPi1B0bIYaR6kRcSfzezRwszak5Yzr6QhT34XJk2Bw89rhXenqwLNJb4NnF2/krnGQ==
dependencies:
bytes "3.0.0"
content-disposition "0.5.2"
fast-url-parser "1.1.3"
mime-types "2.1.18"
minimatch "3.0.4"
path-is-inside "1.0.2"
path-to-regexp "2.2.1"
range-parser "1.2.0"
serve-handler@^5.0.5:
version "5.0.8"
resolved "https://registry.yarnpkg.com/serve-handler/-/serve-handler-5.0.8.tgz#790dbe340dabf1d61bdbaa02ea37dcab372377a8"
integrity sha512-pqk0SChbBLLHfMIxQ55czjdiW7tj2cFy53svvP8e5VqEN/uB/QpfiTJ8k1uIYeFTDVoi+FGi5aqXScuu88bymg==
@ -8145,10 +8173,10 @@ serve-static@1.13.2:
parseurl "~1.3.2"
send "0.16.2"
serve@^10.0.2:
version "10.1.2"
resolved "https://registry.yarnpkg.com/serve/-/serve-10.1.2.tgz#805917f2692ed5d8720bbd1981ac3974d38b7d8d"
integrity sha512-TVH35uwndRlCqSeX3grR3Ntrjx2aBTeu6sx+zTD2CzN2N/rHuEDTvxiBwWbrellJNyWiQFz2xZmoW+UxV+Zahg==
serve@^11.0.0:
version "11.0.0"
resolved "https://registry.yarnpkg.com/serve/-/serve-11.0.0.tgz#577f4e0f4b57058d12e3be19373f1a3d6d8826dc"
integrity sha512-Gnyyp3JAtRUo0dRH1/YWPKbnaXHfzQBiVh9+qSUi6tyVcVA8twUP2c+GnOwsoe9Ss7dfOHJUTSA4fdWP//Y4gQ==
dependencies:
"@zeit/schemas" "2.6.0"
ajv "6.5.3"
@ -8157,7 +8185,7 @@ serve@^10.0.2:
chalk "2.4.1"
clipboardy "1.2.3"
compression "1.7.3"
serve-handler "5.0.8"
serve-handler "6.0.0"
update-check "1.5.2"
set-blocking@^2.0.0, set-blocking@~2.0.0:
@ -9158,6 +9186,7 @@ value-equal@^0.4.0:
vary@~1.1.2:
version "1.1.2"
resolved "https://registry.yarnpkg.com/vary/-/vary-1.1.2.tgz#2299f02c6ded30d4a5961b0b9f74524a18f634fc"
integrity sha1-IpnwLG3tMNSllhsLn3RSShj2NPw=
vendors@^1.0.0:
version "1.0.2"