From 8dd5ef113b3a7b754b15e67d6848f27318ce8347 Mon Sep 17 00:00:00 2001 From: Johan Girod Date: Mon, 21 Feb 2022 12:17:21 +0100 Subject: [PATCH 01/15] =?UTF-8?q?R=C3=A9pare=20le=20pr=C3=A9rendu=20lorsqu?= =?UTF-8?q?e=20les=20variables=20d'environnement=20sont=20manquante?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- site/scripts/fetch-stats.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/site/scripts/fetch-stats.js b/site/scripts/fetch-stats.js index fbf7cfab0..7e70b802e 100644 --- a/site/scripts/fetch-stats.js +++ b/site/scripts/fetch-stats.js @@ -278,7 +278,9 @@ async function main() { // have a static ressource accessible without authentification. writeInDataDir('stats.json', { visitesJours: [], - visitesMois: [], + visitesMois: { + pages: [] + }, satisfaction: [], retoursUtilisateurs: { open: [], From 6ba4e35f51203f77432220ea48b97e0c47510d56 Mon Sep 17 00:00:00 2001 From: Dimitri Bourreau Date: Sat, 19 Feb 2022 11:24:42 +0100 Subject: [PATCH 02/15] =?UTF-8?q?R=C3=A9pare=20"yarn=20prepare"=20=C3=A9ch?= =?UTF-8?q?ouant=20si=20pr=C3=A9sence=20d'un=20espace=20dans=20le=20chemin?= =?UTF-8?q?=20d'un=20fichier?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Dimitri Bourreau --- site/scripts/fetch-stats.js | 6 ++++-- site/scripts/utils.js | 3 ++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/site/scripts/fetch-stats.js b/site/scripts/fetch-stats.js index 7e70b802e..c2cc84242 100644 --- a/site/scripts/fetch-stats.js +++ b/site/scripts/fetch-stats.js @@ -4,13 +4,15 @@ import fs from 'fs' import path from 'path' import { filter, flatten, map, partition, pipe } from 'ramda' import { compose } from 'redux' +import { fileURLToPath } from 'url'; import { createDataDir, writeInDataDir } from './utils.js' const matomoSiteVisitsHistory = JSON.parse( fs.readFileSync( path.join( - import.meta.url.replace('file:', ''), - '../matomoVisitHistory.json' + fileURLToPath(import.meta.url), + '..', + 'matomoVisitHistory.json' ) ) ) diff --git a/site/scripts/utils.js b/site/scripts/utils.js index b2c9fc3ae..65cf1dd66 100644 --- a/site/scripts/utils.js +++ b/site/scripts/utils.js @@ -1,7 +1,8 @@ import { existsSync, mkdirSync, writeFileSync } from 'fs' import { join } from 'path' +import { fileURLToPath } from 'url' -const dataDir = new URL('../source/data/', import.meta.url).pathname +const dataDir = join(fileURLToPath(import.meta.url), '..', '..', 'source', 'data') export function createDataDir() { if (!existsSync(dataDir)) { From fe5430cbcdb2b5d23f467c751ba485e67c22e07b Mon Sep 17 00:00:00 2001 From: Johan Girod Date: Mon, 21 Feb 2022 16:15:29 +0100 Subject: [PATCH 03/15] =?UTF-8?q?Met=20=C3=A0=20jour=20les=20paquets=20pub?= =?UTF-8?q?licodes=20=C3=A0=20la=20derni=C3=A8re=20version?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit fix #2015 --- site/package.json | 4 ++-- yarn.lock | 38 +++++++++++++------------------------- 2 files changed, 15 insertions(+), 27 deletions(-) diff --git a/site/package.json b/site/package.json index 7003f9dea..54e3299ef 100644 --- a/site/package.json +++ b/site/package.json @@ -73,8 +73,8 @@ "fuse.js": "^6.4.6", "markdown-to-jsx": "^7.1.5", "modele-social": "^0.6.0", - "publicodes": "^1.0.0-beta.30", - "publicodes-react": "^1.0.0-beta.30", + "publicodes": "^1.0.0-beta.31", + "publicodes-react": "^1.0.0-beta.31", "ramda": "^0.27.0", "react": "^17.0.0", "react-color": "^2.14.0", diff --git a/yarn.lock b/yarn.lock index 3e1bbdd81..2983a9f71 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3640,20 +3640,6 @@ flush-write-stream@^1.0.2: inherits "^2.0.3" readable-stream "^2.3.6" -focus-trap-react@^8.8.2: - version "8.9.1" - resolved "https://registry.yarnpkg.com/focus-trap-react/-/focus-trap-react-8.9.1.tgz#5f2b3bce6a7c4de6485fd6f4c5e8c0cbaa6e9ad3" - integrity sha512-QGVw4ch1ZfT2IcCL1ehBgrwnFuPA0nP7hXcrZzC8SThbktt/jiXCWQSKhA2WL0nVbxTiZ7YpIu/foTekp+dcqA== - dependencies: - focus-trap "^6.7.2" - -focus-trap@^6.7.2: - version "6.7.2" - resolved "https://registry.yarnpkg.com/focus-trap/-/focus-trap-6.7.2.tgz#02e63b12f4d4b3d00bfac4309cfd223e9b4ed44e" - integrity sha512-mRVv9QPCXITaDreu+pNXiPk1Rpn0WQtGvGrDo3Z/s2kdwtzFw/WOPfbLkdxWWvcahoInm9eRztuQOr1RNyQGrw== - dependencies: - tabbable "^5.2.1" - foreach@^2.0.5: version "2.0.5" resolved "https://registry.yarnpkg.com/foreach/-/foreach-2.0.5.tgz#0bee005018aeb260d0a3af3ae658dd0136ec1b99" @@ -5137,14 +5123,12 @@ psl@^1.1.28: resolved "https://registry.yarnpkg.com/psl/-/psl-1.8.0.tgz#9326f8bcfb013adcc005fdff056acce020e51c24" integrity sha512-RIdOzyoavK+hA18OGGWDqUTsCLhtA7IcZ/6NCs4fFJaHBDab+pDDmDIByWFRQJq2Cd7r1OoQxBGKOaztq+hjIQ== -publicodes-react@^1.0.0-beta.30: - version "1.0.0-beta.30" - resolved "https://registry.yarnpkg.com/publicodes-react/-/publicodes-react-1.0.0-beta.30.tgz#ff1b815c69da4f5f6616f425535f109aae169005" - integrity sha512-8WtZLUVx7NPTSpD2ikmpUwkA9rLZ4oMNANijN9lUqka8rjIQUStYQely4whk4QwAlkUeTgtzoATAws5Qe46CDg== +publicodes-react@^1.0.0-beta.31: + version "1.0.0-beta.31" + resolved "https://registry.yarnpkg.com/publicodes-react/-/publicodes-react-1.0.0-beta.31.tgz#96929254097ffa9fa837c517776a8c223fb3e09f" + integrity sha512-k/3dHxGupQTjI3B5w0+dVOxOs1nfJTGdXWCzKiZaRv3M+Fd/bgLz8zKOWgqiAQMKdeItz36FUPKelWvxL5dOwA== dependencies: - focus-trap-react "^8.8.2" styled-components "^5.1.0" - yaml "^1.9.2" publicodes@^1.0.0-beta.30: version "1.0.0-beta.30" @@ -5155,6 +5139,15 @@ publicodes@^1.0.0-beta.30: nearley "^2.19.2" yaml "^1.9.2" +publicodes@^1.0.0-beta.31: + version "1.0.0-beta.31" + resolved "https://registry.yarnpkg.com/publicodes/-/publicodes-1.0.0-beta.31.tgz#580e7c466fc21ccd27428ea13a3874eff9551db6" + integrity sha512-Bhy/BKy4eP3u/ms0K2x0uH9CYDpjiA/utgagr65A9PpL7lToiMACRrLXJLkwh+xHXy9f/32OD92FZoTB026TCA== + dependencies: + moo "^0.5.1" + nearley "^2.19.2" + yaml "^1.9.2" + pump@^2.0.0: version "2.0.1" resolved "https://registry.yarnpkg.com/pump/-/pump-2.0.1.tgz#12399add6e4cf7526d973cbc8b5ce2e2908b3909" @@ -6107,11 +6100,6 @@ systemjs@^6.11.0: resolved "https://registry.yarnpkg.com/systemjs/-/systemjs-6.12.1.tgz#47cdd23a6ec9f1b01cf5b5f70562c8550da229d3" integrity sha512-hqTN6kW+pN6/qro6G9OZ7ceDQOcYno020zBQKpZQLsJhYTDMCMNfXi/Y8duF5iW+4WWZr42ry0MMkcRGpbwG2A== -tabbable@^5.2.1: - version "5.2.1" - resolved "https://registry.yarnpkg.com/tabbable/-/tabbable-5.2.1.tgz#e3fda7367ddbb172dcda9f871c0fdb36d1c4cd9c" - integrity sha512-40pEZ2mhjaZzK0BnI+QGNjJO8UYx9pP5v7BGe17SORTO0OEuuaAwQTkAp8whcZvqon44wKFOikD+Al11K3JICQ== - text-table@^0.2.0: version "0.2.0" resolved "https://registry.yarnpkg.com/text-table/-/text-table-0.2.0.tgz#7f5ee823ae805207c00af2df4a84ec3fcfa570b4" From 15626375e4823770f9b4e24bbd4a1293b69a3cf2 Mon Sep 17 00:00:00 2001 From: Johan Girod Date: Mon, 21 Feb 2022 16:19:53 +0100 Subject: [PATCH 04/15] (ci) fix linting --- site/scripts/fetch-stats.js | 10 +++------- site/scripts/utils.js | 8 +++++++- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/site/scripts/fetch-stats.js b/site/scripts/fetch-stats.js index c2cc84242..4ab27028b 100644 --- a/site/scripts/fetch-stats.js +++ b/site/scripts/fetch-stats.js @@ -4,16 +4,12 @@ import fs from 'fs' import path from 'path' import { filter, flatten, map, partition, pipe } from 'ramda' import { compose } from 'redux' -import { fileURLToPath } from 'url'; +import { fileURLToPath } from 'url' import { createDataDir, writeInDataDir } from './utils.js' const matomoSiteVisitsHistory = JSON.parse( fs.readFileSync( - path.join( - fileURLToPath(import.meta.url), - '..', - 'matomoVisitHistory.json' - ) + path.join(fileURLToPath(import.meta.url), '..', 'matomoVisitHistory.json') ) ) @@ -281,7 +277,7 @@ async function main() { writeInDataDir('stats.json', { visitesJours: [], visitesMois: { - pages: [] + pages: [], }, satisfaction: [], retoursUtilisateurs: { diff --git a/site/scripts/utils.js b/site/scripts/utils.js index 65cf1dd66..ac327fcaa 100644 --- a/site/scripts/utils.js +++ b/site/scripts/utils.js @@ -2,7 +2,13 @@ import { existsSync, mkdirSync, writeFileSync } from 'fs' import { join } from 'path' import { fileURLToPath } from 'url' -const dataDir = join(fileURLToPath(import.meta.url), '..', '..', 'source', 'data') +const dataDir = join( + fileURLToPath(import.meta.url), + '..', + '..', + 'source', + 'data' +) export function createDataDir() { if (!existsSync(dataDir)) { From b4c8cf6a3f12ce6b4158f802773ea6b9a216fd2e Mon Sep 17 00:00:00 2001 From: Johan Girod Date: Mon, 21 Feb 2022 18:29:22 +0100 Subject: [PATCH 05/15] =?UTF-8?q?R=C3=A9pare=20la=20selection=20de=20p?= =?UTF-8?q?=C3=A9riode=20sur=20les=20simulateurs?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit fix #2019 --- site/source/components/PeriodSwitch.tsx | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/site/source/components/PeriodSwitch.tsx b/site/source/components/PeriodSwitch.tsx index e6ef0458f..a2ab37e16 100644 --- a/site/source/components/PeriodSwitch.tsx +++ b/site/source/components/PeriodSwitch.tsx @@ -9,7 +9,6 @@ export default function PeriodSwitch() { const currentUnit = useSelector(targetUnitSelector) const { t } = useTranslation() - const periods = [ { label: t('Mensuel'), @@ -23,7 +22,7 @@ export default function PeriodSwitch() { return (
dispatch(updateUnit(unit))} > {periods.map(({ label, unit }) => ( From f9315f75d119a8af1f85072b572c526818cfca7c Mon Sep 17 00:00:00 2001 From: Johan Girod Date: Mon, 21 Feb 2022 18:39:14 +0100 Subject: [PATCH 06/15] =?UTF-8?q?Enl=C3=A8ve=20la=20question=20sur=20la=20?= =?UTF-8?q?DFS=20pour=20les=20SASU=20(non=20applicable)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- modele-social/règles/dirigeant.yaml | 13 +++++----- site/source/locales/rules-en.yaml | 24 +++++++++---------- .../Simulateurs/configs/dirigeant-sasu.yaml | 5 +++- 3 files changed, 22 insertions(+), 20 deletions(-) diff --git a/modele-social/règles/dirigeant.yaml b/modele-social/règles/dirigeant.yaml index 73c230d7c..fd2824404 100644 --- a/modele-social/règles/dirigeant.yaml +++ b/modele-social/règles/dirigeant.yaml @@ -91,7 +91,6 @@ dirigeant . assimilé salarié: rend non applicable: - contrat salarié . convention collective - contrat salarié . activité partielle - - contrat salarié . déduction forfaitaire spécifique - contrat salarié . rémunération . primes - contrat salarié . rémunération . primes . fin d'année - contrat salarié . rémunération . primes . activité @@ -1295,17 +1294,17 @@ dirigeant . indépendant . cotisations et contributions . exonérations . pensio acronyme: PI question: Êtes-vous titulaire d’une pension d’invalidité à titre de travailleur indépendant ? description: |- - Si vous êtes titulaire d’une **pension d’invalidité** versée par un régime des travailleurs non-salariés - non agricoles, vous bénécifiez d’une **exonération totale des cotisations de retraite complémentaire et + Si vous êtes titulaire d’une **pension d’invalidité** versée par un régime des travailleurs non-salariés + non agricoles, vous bénécifiez d’une **exonération totale des cotisations de retraite complémentaire et des cotisations maladie**. - Pour que vous puissiez **continuer à accumuler des points de retraite complémentaire** comme les autres travailleurs, + Pour que vous puissiez **continuer à accumuler des points de retraite complémentaire** comme les autres travailleurs, il vous est attribué des **"points gratuits"**. - Dans le cas général, le nombre de points reçu correspond à la **moyenne mensuelle des points cotisés - pendant la période d'activité indépendante** avant versement de la pension. + Dans le cas général, le nombre de points reçu correspond à la **moyenne mensuelle des points cotisés + pendant la période d'activité indépendante** avant versement de la pension. - > Par exemple, si vous avez cotisé pendant 6 ans et 11 mois pour un total de 588 points, le nombre de points gratuits reçu chaque mois sera de : + > Par exemple, si vous avez cotisé pendant 6 ans et 11 mois pour un total de 588 points, le nombre de points gratuits reçu chaque mois sera de : > `588 / (6 * 12 + 11) = 7,08` type: notification diff --git a/site/source/locales/rules-en.yaml b/site/source/locales/rules-en.yaml index d2c0d0303..4c1e9c295 100644 --- a/site/source/locales/rules-en.yaml +++ b/site/source/locales/rules-en.yaml @@ -5854,47 +5854,47 @@ dirigeant . indépendant . cotisations et contributions . exonérations . pensio description.en: >- [automatic] If you are the holder of a **disability pension** paid by a non-agricultural non-salaried worker scheme, you benefit from a **total - exemption from supplementary pension and + exemption from supplementary pension and - non-agricultural non-salaried workers, you are entitled to a **total exemption from supplementary pension contributions and + non-agricultural non-salaried workers, you are entitled to a **total exemption from supplementary pension contributions and health insurance contributions**. - So that you can **continue to accumulate complementary pension points** like other workers, + So that you can **continue to accumulate complementary pension points** like other workers, you are allocated **"free points "**. - In the general case, the number of points received corresponds to the **average monthly points contributed during the period of + In the general case, the number of points received corresponds to the **average monthly points contributed during the period of - during the period of self-employment** before the pension is paid. + during the period of self-employment** before the pension is paid. - > For example, if you have contributed for 6 years and 11 months for a total of 588 points, the number of free points received each month will be : + > For example, if you have contributed for 6 years and 11 months for a total of 588 points, the number of free points received each month will be : > `588 / (6 * 12 + 11) = 7,08` description.fr: >- Si vous êtes titulaire d’une **pension d’invalidité** versée par un régime - des travailleurs non-salariés + des travailleurs non-salariés - non agricoles, vous bénécifiez d’une **exonération totale des cotisations de retraite complémentaire et + non agricoles, vous bénécifiez d’une **exonération totale des cotisations de retraite complémentaire et des cotisations maladie**. - Pour que vous puissiez **continuer à accumuler des points de retraite complémentaire** comme les autres travailleurs, + Pour que vous puissiez **continuer à accumuler des points de retraite complémentaire** comme les autres travailleurs, il vous est attribué des **"points gratuits"**. - Dans le cas général, le nombre de points reçu correspond à la **moyenne mensuelle des points cotisés + Dans le cas général, le nombre de points reçu correspond à la **moyenne mensuelle des points cotisés - pendant la période d'activité indépendante** avant versement de la pension. + pendant la période d'activité indépendante** avant versement de la pension. - > Par exemple, si vous avez cotisé pendant 6 ans et 11 mois pour un total de 588 points, le nombre de points gratuits reçu chaque mois sera de : + > Par exemple, si vous avez cotisé pendant 6 ans et 11 mois pour un total de 588 points, le nombre de points gratuits reçu chaque mois sera de : > `588 / (6 * 12 + 11) = 7,08` diff --git a/site/source/pages/Simulateurs/configs/dirigeant-sasu.yaml b/site/source/pages/Simulateurs/configs/dirigeant-sasu.yaml index 6c42247e2..3be08a72e 100644 --- a/site/source/pages/Simulateurs/configs/dirigeant-sasu.yaml +++ b/site/source/pages/Simulateurs/configs/dirigeant-sasu.yaml @@ -28,4 +28,7 @@ questions: unité par défaut: €/an situation: dirigeant: "'assimilé salarié'" - contrat salarié . activité partielle: non #TODO : en attendant que la transitivité du remplacement soit implémentée + + #TODO : en attendant que la transitivité du remplacement soit implémentée (https://github.com/betagouv/publicodes/issues/55) + contrat salarié . activité partielle: non + contrat salarié . déduction forfaitaire spécifique: non From 904d380cc4ddfcaeb22f361175eb3ba388ed0ea3 Mon Sep 17 00:00:00 2001 From: Julien Bouquillon Date: Fri, 18 Feb 2022 19:37:55 +0100 Subject: [PATCH 07/15] =?UTF-8?q?=20=E2=9C=A8=20Refacto=20:=20MAJ=20de=20l?= =?UTF-8?q?'url=20recherche-entreprises?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- site/.env.template | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/site/.env.template b/site/.env.template index 5f7a0649e..1f380c662 100644 --- a/site/.env.template +++ b/site/.env.template @@ -19,7 +19,7 @@ VITE_FR_BASE_URL="http://localhost:3000/mon-entreprise" VITE_EN_BASE_URL="http://localhost:3000/infrance" # Variables optionnelles -VITE_COMPANY_SEARCH_HOST=https://search-recherche-entreprises.fabrique.social.gouv.fr +VITE_COMPANY_SEARCH_HOST=https://api.recherche-entreprises.fabrique.social.gouv.fr # https://github.com/reduxjs/redux-devtools/blob/main/extension/docs/Features/Trace.md VITE_REDUX_TRACE=true From a2bb289b745a67421d82ad22cfdd3f3db8fca8ad Mon Sep 17 00:00:00 2001 From: Julien Bouquillon Date: Mon, 21 Feb 2022 18:05:59 +0100 Subject: [PATCH 08/15] =?UTF-8?q?=E2=9C=A8=20Refacto=20:=20MAJ=20netlify?= =?UTF-8?q?=20recherche-entreprises?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- site/netlify.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/site/netlify.toml b/site/netlify.toml index 7c67d25aa..18e582334 100644 --- a/site/netlify.toml +++ b/site/netlify.toml @@ -1,7 +1,7 @@ [[headers]] for = "/*" [headers.values] -Content-Security-Policy = "default-src 'self' mon-entreprise.fr; style-src 'self' 'unsafe-inline' mon-entreprise.zammad.com; connect-src 'self' *.sentry.io raw.githubusercontent.com *.xiti.com mon-entreprise.zammad.com search-recherche-entreprises.fabrique.social.gouv.fr geo.api.gouv.fr *.algolianet.com; form-action 'self' *.sibforms.com *.sentry.io mon-entreprise.zammad.com; script-src 'self' 'unsafe-inline' 'unsafe-eval' *.xiti.com stonly.com code.jquery.com mon-entreprise.zammad.com polyfill.io; img-src 'self' data: *.xiti.com user-images.githubusercontent.com; frame-src 'self' https://www.youtube-nocookie.com https://codesandbox.io" +Content-Security-Policy = "default-src 'self' mon-entreprise.fr; style-src 'self' 'unsafe-inline' mon-entreprise.zammad.com; connect-src 'self' *.sentry.io raw.githubusercontent.com *.xiti.com mon-entreprise.zammad.com api.recherche-entreprises.fabrique.social.gouv.fr geo.api.gouv.fr *.algolianet.com; form-action 'self' *.sibforms.com *.sentry.io mon-entreprise.zammad.com; script-src 'self' 'unsafe-inline' 'unsafe-eval' *.xiti.com stonly.com code.jquery.com mon-entreprise.zammad.com polyfill.io; img-src 'self' data: *.xiti.com user-images.githubusercontent.com; frame-src 'self' https://www.youtube-nocookie.com https://codesandbox.io" ## Twemoji proxy for client privacy #1219 [[redirects]] From c29cee32e5752532ee630773ccf7bb987050a91f Mon Sep 17 00:00:00 2001 From: Julien Bouquillon Date: Mon, 21 Feb 2022 18:06:42 +0100 Subject: [PATCH 09/15] =?UTF-8?q?=E2=9C=A8=20Refacto=20:=20MAJ=20cypress?= =?UTF-8?q?=20recherche-entreprises?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- site/cypress/integration/mon-entreprise/landing.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/site/cypress/integration/mon-entreprise/landing.js b/site/cypress/integration/mon-entreprise/landing.js index 572eeee24..f9d9b3fad 100644 --- a/site/cypress/integration/mon-entreprise/landing.js +++ b/site/cypress/integration/mon-entreprise/landing.js @@ -19,7 +19,7 @@ describe('Landing page', function () { let pendingRequests = new Set() let responses = {} const hostnamesToRecord = [ - 'search-recherche-entreprises.fabrique.social.gouv.fr', + 'api.recherche-entreprises.fabrique.social.gouv.fr', 'geo.api.gouv.fr', ] cy.clearLocalStorage() // Try to avoid flaky tests From 3f5e9414a5e2075b040eecd069fc27a6d747abc6 Mon Sep 17 00:00:00 2001 From: Julien Bouquillon Date: Mon, 21 Feb 2022 18:07:35 +0100 Subject: [PATCH 10/15] =?UTF-8?q?=E2=9C=A8=20Refacto=20:=20MAJ=20cypress?= =?UTF-8?q?=20recherche-entreprises?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- site/cypress/integration/mon-entreprise/english/navigation.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/site/cypress/integration/mon-entreprise/english/navigation.js b/site/cypress/integration/mon-entreprise/english/navigation.js index fd20c6a49..842cb7dd0 100644 --- a/site/cypress/integration/mon-entreprise/english/navigation.js +++ b/site/cypress/integration/mon-entreprise/english/navigation.js @@ -30,7 +30,7 @@ describe(`Navigation to income simulator using company name (${ let pendingRequests = new Set() let responses = {} const hostnamesToRecord = [ - 'search-recherche-entreprises.fabrique.social.gouv.fr', + 'api.recherche-entreprises.fabrique.social.gouv.fr', 'geo.api.gouv.fr', ] beforeEach(function () { From a9548652bbd75215dfbf61985b6864f754de43cc Mon Sep 17 00:00:00 2001 From: Julien Bouquillon Date: Mon, 21 Feb 2022 18:08:39 +0100 Subject: [PATCH 11/15] =?UTF-8?q?=E2=9C=A8=20Refacto=20:=20MAJ=20api=20url?= =?UTF-8?q?=20recherche-entreprises?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- site/source/api/fabrique-social.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/site/source/api/fabrique-social.ts b/site/source/api/fabrique-social.ts index 3e5bc77d0..87b7a4a20 100644 --- a/site/source/api/fabrique-social.ts +++ b/site/source/api/fabrique-social.ts @@ -47,7 +47,7 @@ type FabriqueSocialSearchPayload = { const COMPANY_SEARCH_HOST = import.meta.env.VITE_COMPANY_SEARCH_HOST || - 'https://search-recherche-entreprises.fabrique.social.gouv.fr' + 'https://api.recherche-entreprises.fabrique.social.gouv.fr' const makeSearchUrl = (query: string, limit: number) => `${COMPANY_SEARCH_HOST}/api/v1/search?query=${query}&open=true&convention=false&employer=false&ranked=false&limit=${limit}` From 1d99e6253bee170ad6662f1108427cda06126d83 Mon Sep 17 00:00:00 2001 From: Johan Girod Date: Tue, 22 Feb 2022 12:47:25 +0100 Subject: [PATCH 12/15] Update README.md --- exoneration-covid/README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/exoneration-covid/README.md b/exoneration-covid/README.md index 5469c868b..103967bfc 100644 --- a/exoneration-covid/README.md +++ b/exoneration-covid/README.md @@ -20,10 +20,10 @@ engine.setSituation({ "début d'activité": "'mai 2021'", secteur: "'S1'", - 'mois . avril 2021': 'LFSS 600', + 'mois . avril 2021': "'LFSS 600'", 'mois . mai 2021': 'non', - 'mois . juin 2021': 'LFSS 600', - 'mois . décembre 2021': 'LFSS 300', + 'mois . juin 2021': "'LFSS 600'", + 'mois . décembre 2021': "'LFSS 300'", }) console.log(formatValue(engine.evaluate('montant total'))) From 8875ecdcb9738bf655f7a7031b36117d042fbb0a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Rialland?= Date: Tue, 22 Feb 2022 18:34:31 +0100 Subject: [PATCH 13/15] =?UTF-8?q?=F0=9F=90=9B=20Fix=20la=20non=20prise=20e?= =?UTF-8?q?n=20compte=20du=20param=C3=A8tre=20d'url=20par=20defaut=20(#200?= =?UTF-8?q?6)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * 🐛 Fix la non prise en compte du parametre d'url par defaut * ✨ Fix plusieurs types * 🐛 Fix componentCSS refacto --- .../design-system/field/Select/ListBox.tsx | 33 +++++----- .../design-system/field/Select/PopOver.tsx | 8 +-- .../design-system/field/Select/index.tsx | 7 ++- site/source/pages/Documentation.tsx | 62 +++++++++++++------ site/source/pages/Simulateurs/Page/index.tsx | 4 +- site/source/pages/integration/Iframe.tsx | 13 ++-- 6 files changed, 81 insertions(+), 46 deletions(-) diff --git a/site/source/design-system/field/Select/ListBox.tsx b/site/source/design-system/field/Select/ListBox.tsx index 781ec664d..ac066ccfc 100644 --- a/site/source/design-system/field/Select/ListBox.tsx +++ b/site/source/design-system/field/Select/ListBox.tsx @@ -1,13 +1,18 @@ -/* eslint-disable @typescript-eslint/no-use-before-define */ -import type { AriaListBoxOptions } from '@react-aria/listbox' -import { useListBox, useOption } from '@react-aria/listbox' +import { useListBox, useOption, AriaListBoxOptions } from '@react-aria/listbox' import type { ListState } from '@react-stately/list' import type { Node } from '@react-types/shared' -import * as React from 'react' +import { + RefObject, + useRef, + HTMLAttributes, + createContext, + ReactNode, + useContext, +} from 'react' import styled, { css } from 'styled-components' interface ListBoxProps extends AriaListBoxOptions { - listBoxRef?: React.RefObject + listBoxRef?: RefObject state: ListState } @@ -67,7 +72,7 @@ const ItemContent = styled.div` ` export function ListBox(props: ListBoxProps) { - const ref = React.useRef(null) + const ref = useRef(null) const { listBoxRef = ref, state } = props const { listBoxProps } = useListBox(props, state, listBoxRef) @@ -81,17 +86,17 @@ export function ListBox(props: ListBoxProps) { } interface OptionContextValue { - labelProps: React.HTMLAttributes - descriptionProps: React.HTMLAttributes + labelProps: HTMLAttributes + descriptionProps: HTMLAttributes } -const OptionContext = React.createContext({ +const OptionContext = createContext({ labelProps: {}, descriptionProps: {}, }) function Option({ item, state }: OptionProps) { - const ref = React.useRef(null) + const ref = useRef(null) const { optionProps, labelProps, descriptionProps, isSelected, isFocused } = useOption( { @@ -123,8 +128,8 @@ function Option({ item, state }: OptionProps) { // described by the description, which makes for better announcements // for screen reader users. -export function Label({ children }: { children: React.ReactNode }) { - const { labelProps } = React.useContext(OptionContext) +export function Label({ children }: { children: ReactNode }) { + const { labelProps } = useContext(OptionContext) return
{children}
} @@ -133,7 +138,7 @@ const StyledDescription = styled.div` font-size: 12px; ` -export function Description({ children }: { children: React.ReactNode }) { - const { descriptionProps } = React.useContext(OptionContext) +export function Description({ children }: { children: ReactNode }) { + const { descriptionProps } = useContext(OptionContext) return {children} } diff --git a/site/source/design-system/field/Select/PopOver.tsx b/site/source/design-system/field/Select/PopOver.tsx index dfaa2da48..9d2dc430e 100644 --- a/site/source/design-system/field/Select/PopOver.tsx +++ b/site/source/design-system/field/Select/PopOver.tsx @@ -1,11 +1,11 @@ import { FocusScope } from '@react-aria/focus' import { DismissButton, useOverlay } from '@react-aria/overlays' -import * as React from 'react' +import { RefObject, ReactNode, useRef } from 'react' import styled from 'styled-components' interface PopoverProps { - popoverRef?: React.RefObject - children: React.ReactNode + popoverRef?: RefObject + children: ReactNode isOpen?: boolean onClose?: () => void } @@ -23,7 +23,7 @@ const Wrapper = styled.div` ` export function Popover(props: PopoverProps) { - const ref = React.useRef(null) + const ref = useRef(null) const { popoverRef = ref, isOpen, onClose, children } = props // Handle events that should cause the popup to close, diff --git a/site/source/design-system/field/Select/index.tsx b/site/source/design-system/field/Select/index.tsx index 506174a76..b78c8aeeb 100644 --- a/site/source/design-system/field/Select/index.tsx +++ b/site/source/design-system/field/Select/index.tsx @@ -5,7 +5,7 @@ import { mergeProps } from '@react-aria/utils' import { useSelectState } from '@react-stately/select' import type { AriaSelectProps } from '@react-types/select' import { CarretDown } from 'DesignSystem/icons/carret-down' -import * as React from 'react' +import { useEffect, useRef } from 'react' import { useTranslation } from 'react-i18next' import styled, { css } from 'styled-components' import { ListBox } from './ListBox' @@ -175,16 +175,17 @@ export function Select>( // Create state based on the incoming props const state = useSelectState(props) - React.useEffect(() => { + useEffect(() => { if (props.value && props.value !== state.selectedKey) { state.setSelectedKey(props.value) } // On ne veut pas d'update bidirectionnel, c'est pourquoi state n'est pas dans // les dépendances + // eslint-disable-next-line react-hooks/exhaustive-deps }, [props.value]) // Get props for child elements from useSelect - const ref = React.useRef(null) + const ref = useRef(null) const { labelProps, triggerProps, valueProps, menuProps } = useSelect( props, state, diff --git a/site/source/pages/Documentation.tsx b/site/source/pages/Documentation.tsx index c6c45cfb9..0ccabfd1a 100644 --- a/site/source/pages/Documentation.tsx +++ b/site/source/pages/Documentation.tsx @@ -14,7 +14,7 @@ import { Li, Ul } from 'DesignSystem/typography/list' import { Body } from 'DesignSystem/typography/paragraphs' import rules, { DottedName } from 'modele-social' import { getDocumentationSiteMap, RulePage } from 'publicodes-react' -import { useContext, useMemo } from 'react' +import { ComponentType, useContext, useMemo } from 'react' import { Helmet } from 'react-helmet-async' import { Trans, useTranslation } from 'react-i18next' import { useSelector } from 'react-redux' @@ -69,10 +69,10 @@ export default function MonEntrepriseRulePage() { documentationPath={documentationPath} renderers={{ Head: Helmet, - Link: Link as React.ComponentType<{ + Link: Link as ComponentType<{ to: string }>, - Text: Markdown as any, + Text: Markdown, References, }} /> @@ -147,9 +147,13 @@ const referencesImages = { 'bpifrance-creation.fr': '/références-images/bpi-création.png', } -type ReferencesProps = React.ComponentProps< - NonNullable['renderers']['References']> -> +type ReferencesProps = { + references: React.ComponentProps< + NonNullable< + React.ComponentProps['renderers']['References'] + > + >['references'] +} export function References({ references }: ReferencesProps) { const cleanDomain = (link: string) => @@ -217,10 +221,31 @@ const StyledReferences = styled.ul` } ` +type OverrideComponentType = { + componentStyle: { + rules: Array< + | (( + props: Record + ) => + | string + | false + | null + | undefined + | OverrideComponentType['componentStyle']['rules']) + | string + > + } +} + // HACKKKKY THING. DO NOT DO THIS AT HOME -function componentCSS(rules: any, props: any) { +function componentCSS(Compo: unknown, props: Record): string { + const rules = + 'componentStyle' in (Compo as OverrideComponentType) + ? (Compo as OverrideComponentType).componentStyle.rules + : (Compo as string[]) + return rules - .map((x: any) => { + .map((x) => { if (typeof x !== 'function') { return x } @@ -234,39 +259,40 @@ function componentCSS(rules: any, props: any) { if (Array.isArray(result)) { return componentCSS(result, props) } - console.error('Should not happen', result) + // eslint-disable-next-line no-console + console.error('Should not happen', result, typeof result) }) .join('') } const StyledDocumentation = styled.div` h1 { - ${(props) => componentCSS((H1.componentStyle as any).rules, props)} + ${(props) => componentCSS(H1, props)} margin-top: 1rem; } h2 { - ${(props) => componentCSS((H2.componentStyle as any).rules, props)} + ${(props) => componentCSS(H2, props)} } h3 { - ${(props) => componentCSS((H3.componentStyle as any).rules, props)} + ${(props) => componentCSS(H3, props)} } h4 { - ${(props) => componentCSS((H4.componentStyle as any).rules, props)} + ${(props) => componentCSS(H4, props)} } h5 { - ${(props) => componentCSS((H5.componentStyle as any).rules, props)} + ${(props) => componentCSS(H5, props)} } p { - ${(props) => componentCSS((Body.componentStyle as any).rules, props)} + ${(props) => componentCSS(Body, props)} } Ul { - ${(props) => componentCSS((Ul.componentStyle as any).rules, props)} + ${(props) => componentCSS(Ul, props)} } Li { - ${(props) => componentCSS((Li.componentStyle as any).rules, props)} + ${(props) => componentCSS(Li, props)} } a { - ${(props) => componentCSS((StyledLink.componentStyle as any).rules, props)} + ${(props) => componentCSS(StyledLink, props)} } button { font-size: 1rem; diff --git a/site/source/pages/Simulateurs/Page/index.tsx b/site/source/pages/Simulateurs/Page/index.tsx index a63bfab14..da7415304 100644 --- a/site/source/pages/Simulateurs/Page/index.tsx +++ b/site/source/pages/Simulateurs/Page/index.tsx @@ -32,7 +32,7 @@ export default function PageData(props: SimulatorData[keyof SimulatorData]) { const année = useContext(EngineContext).evaluate('année') .nodeValue as Evaluation - const year = année != null && année != 2022 ? ' - ' + année : '' + const year = typeof année === 'number' && année != 2022 ? ` - ${année}` : '' const inIframe = useIsEmbedded() const fromGérer = !!useLocation<{ fromGérer?: boolean }>().state?.fromGérer @@ -68,7 +68,7 @@ export default function PageData(props: SimulatorData[keyof SimulatorData]) { return ( - {meta && } + {meta && } {title && !inIframe && ( <>

diff --git a/site/source/pages/integration/Iframe.tsx b/site/source/pages/integration/Iframe.tsx index 54ba46c7d..f1052617c 100644 --- a/site/source/pages/integration/Iframe.tsx +++ b/site/source/pages/integration/Iframe.tsx @@ -43,15 +43,17 @@ function IntegrationCustomizer() { const defaultModuleFromUrl = new URLSearchParams(search ?? '').get('module') ?? '' + const [currentModule, setCurrentModule] = useState( - simulators['defaultModuleFromUrl'] ? defaultModuleFromUrl : 'salarié' + simulators[defaultModuleFromUrl] ? defaultModuleFromUrl : 'salarié' ) useEffect(() => { history.replace({ search: `?module=${currentModule}` }) - }, [currentModule]) - console.log(currentModule, simulators[currentModule]) + }, [currentModule, history]) + const [color, setColor] = useState() + return ( <>

@@ -65,7 +67,7 @@ function IntegrationCustomizer() {