From 407ededb366b062d6170a31172ee957ec51b0a7c Mon Sep 17 00:00:00 2001
From: maxgfr <25312957+maxgfr@users.noreply.github.com>
Date: Sat, 28 Dec 2024 11:34:58 +0100
Subject: [PATCH] fix: modif v2
---
.../pages/outils/[slug].tsx | 2 +
.../src/modules/common/Html.tsx | 27 +-
.../AgreementInput/AgreementTile.tsx | 57 ---
.../AgreementInput/SearchAgreementInput.tsx | 160 -------
.../AgreementSearch/AgreementNoResult.tsx | 135 ------
.../AgreementSearch/AgreementSearch.tsx | 97 -----
.../Agreement/AgreementSearch/index.ts | 3 -
.../EnterpriseSearch/EnterpriseSearch.tsx | 133 ------
.../EnterpriseButton.tsx | 71 ----
.../SearchEnterpriseInput.tsx | 172 --------
.../EntrepriseSearchResult.tsx | 133 ------
.../EnterpriseSearch/Location/Search.tsx | 208 ---------
.../EnterpriseSearch/Location/searchCities.ts | 37 --
.../EnterpriseSearch/SelectedEnterprise.tsx | 39 --
.../EnterpriseSearch/ShowAgreement.tsx | 41 --
.../EnterpriseSearch/ShowAgreements.tsx | 105 -----
.../Agreement/EnterpriseSearch/index.ts | 3 -
.../RouteSelection/RouteSelection.tsx | 127 ------
.../Agreement/RouteSelection/ShowAlert.tsx | 44 --
.../Agreement/RouteSelection/index.ts | 3 -
.../components/Agreement/SelectAgreement.tsx | 173 --------
.../__tests__/AgreementSearch.test.tsx | 243 -----------
.../__tests__/EnterpriseSearch.test.tsx | 395 ------------------
.../__tests__/RouteSelection.test.tsx | 145 -------
.../__tests__/SelectAgreement.test.tsx | 108 -----
.../components/Agreement/components/Modal.tsx | 32 --
.../Agreement/components/ResultList.tsx | 88 ----
.../Agreement/components/ShowAlert.tsx | 117 ------
.../Agreement/components/Suggester.ts | 118 ------
.../components/Agreement/form-constants.ts | 4 -
.../common/components/Agreement/index.ts | 4 -
.../__tests__/handleTrackEvent.test.tsx | 70 ----
.../__tests__/pushAgreementEvents.test.tsx | 255 -----------
.../Agreement/tracking/handleTrackEvent.ts | 49 ---
.../components/Agreement/tracking/index.ts | 4 -
.../Agreement/tracking/pushAgreementEvents.ts | 78 ----
.../common/components/Agreement/types.ts | 13 -
.../components/Feedback/Questionnaire.tsx | 59 ---
.../Feedback/QuestionnaireAdvanced.tsx | 112 -----
.../components/Feedback/QuestionnaireEnd.tsx | 19 -
.../components/Feedback/QuestionnaireItem.tsx | 114 -----
.../components/Feedback/QuestionnaireText.tsx | 48 ---
.../Feedback/__tests__/feedback.test.tsx | 129 ------
.../components/Feedback/__tests__/ui.ts | 53 ---
.../common/components/Feedback/index.tsx | 113 -----
.../components/Feedback/introduction.tsx | 22 -
.../common/components/Feedback/tracking.ts | 52 ---
.../common/components/Informations/index.ts | 1 -
.../common/components/RadioQuestion.tsx | 45 +-
.../common/components/SelectQuestion.tsx | 81 ++--
.../components/SimulatorLayout/index.tsx | 78 ++--
.../outils/common/components/TextQuestion.tsx | 76 ++--
.../modules/outils/common/components/types.ts | 5 -
.../Informations.tsx | 17 +-
.../Informations.tsx | 18 +-
.../1672-societes-assurances/Informations.tsx | 17 +-
.../Informations.tsx | 17 +-
.../Informations.tsx | 18 +-
.../agreements/2120-banques/Component.tsx | 10 +-
.../2148-telecommunications/Informations.tsx | 17 +-
.../agreements/2596-coiffure/Informations.tsx | 17 +-
.../agreements/ui-customizations/index.ts | 1 -
.../agreements/ui-customizations/tooltip.tsx | 10 -
.../outils/common/indemnite-depart/index.tsx | 72 ++--
.../Agreement/components/AgreementStep.tsx | 10 +-
.../steps/Agreement/index.tsx | 27 +-
.../steps/Agreement/store/store.ts | 3 +-
.../steps/Agreement/store/types.ts | 2 +-
.../Anciennete/components/AbsencePeriod.tsx | 177 +++-----
.../Anciennete/components/AbsencePeriods.tsx | 50 ++-
.../components/SectionTitleWithTooltip.tsx | 50 ---
.../SectionTitleWithTooltip.test.tsx | 18 -
.../steps/Anciennete/components/index.ts | 1 -
.../steps/Anciennete/store/store.ts | 2 +-
.../steps/Anciennete/store/types.ts | 2 +-
.../store/validator/absencePeriods.ts | 2 +-
.../components}/PubliQuestion.tsx | 50 +--
.../__tests__/PubliQuestion.test.tsx | 2 +-
.../steps/Informations/index.tsx | 2 +-
.../steps/Informations/store/store.ts | 2 +-
.../__tests__/informationToSituation.test.ts | 2 +-
.../steps}/Informations/utils/index.ts | 0
.../utils/informationToSituation.ts | 2 +-
.../Resultat/components/AbsenceTable.tsx | 5 +-
.../Resultat/components/FilledElements.tsx | 5 +-
.../__tests__/FilledElements.test.tsx | 2 +-
.../steps/Resultat/store/store.ts | 2 +-
...{TooltipSalary.tsx => HighlightSalary.tsx} | 13 +-
.../Salaires/components/SalaireTempsPlein.tsx | 37 +-
.../steps/Salaires/components/index.ts | 2 +-
.../indemnite-depart/steps/Salaires/index.tsx | 21 +-
.../steps/Salaires/store/store.ts | 2 +-
.../absence-date-onchange-motif.test.tsx | 112 -----
.../absence-date-with-agreement.test.tsx | 116 -----
.../absence-date-without-agreement.test.tsx | 73 ----
.../__tests__/arret-travail.test.tsx | 134 ------
.../__tests__/cc1404.test.tsx | 100 -----
.../__tests__/cc1486.test.tsx | 82 ----
.../__tests__/cc1516.test.tsx | 127 ------
.../__tests__/cc1517.test.tsx | 61 ---
.../__tests__/cc1527.test.tsx | 103 -----
.../__tests__/cc16.test.tsx | 227 ----------
.../__tests__/cc1672.test.tsx | 176 --------
.../__tests__/cc1702.test.tsx | 211 ----------
.../__tests__/cc2098.test.tsx | 71 ----
.../__tests__/cc2120.test.tsx | 66 ---
.../__tests__/cc2148.test.tsx | 129 ------
.../__tests__/cc2596.test.tsx | 239 -----------
.../__tests__/cc2609.test.tsx | 108 -----
.../__tests__/cc3127.test.tsx | 68 ---
.../__tests__/cc3239-reset-data.test.tsx | 96 -----
.../__tests__/cc3239.test.tsx | 235 -----------
.../__tests__/cc3248.test.tsx | 99 -----
.../__tests__/cc44.test.tsx | 287 -------------
.../__tests__/cc573.test.tsx | 67 ---
.../__tests__/cc675.test.tsx | 61 ---
.../__tests__/cc86.test.tsx | 59 ---
.../eligibility-error-result.test.tsx | 138 ------
...ntation-1-jour-anciennet\303\251.test.tsx" | 41 --
.../indemnite-licenciement-cc-select.test.tsx | 68 ---
.../indemnite-licenciement-contract.test.tsx | 47 ---
.../__tests__/information.test.tsx | 212 ----------
.../__tests__/no-agreement-result.test.tsx | 128 ------
.../__tests__/notification.test.tsx | 74 ----
.../__tests__/resultat-formules.test.tsx | 141 -------
.../__tests__/salary-validation.test.tsx | 165 --------
.../__tests__/seniority-validation.test.tsx | 230 ----------
.../__tests__/tracking.test.tsx | 287 -------------
...dation-anciennet\303\251-absence.test.tsx" | 39 --
.../agreements/ui-customizations/index.ts | 1 -
.../agreements/ui-customizations/messages.ts | 27 --
.../useIndemniteLicenciementEventEmitter.tsx | 33 --
.../outils/indemnite-licenciement/index.tsx | 82 ----
.../steps/Anciennet\303\251/index.tsx" | 168 --------
.../steps/ContratTravail/index.tsx | 164 --------
.../steps/Introduction/components/Intro.tsx | 19 -
.../components/__tests__/Intro.test.tsx | 9 -
.../steps/Introduction/components/index.ts | 1 -
.../steps/Introduction/index.tsx | 6 -
.../steps/Resultat/Eligible.tsx | 247 -----------
.../steps/Resultat/Ineligible.tsx | 39 --
.../steps/Resultat/index.tsx | 15 -
.../indemnite-licenciement/steps/index.ts | 4 -
.../IndemniteRuptureCoSimulator.tsx | 71 ++--
.../steps/Anciennete/index.tsx | 44 +-
.../steps/ContratTravail/index.tsx | 10 +-
.../steps/Resultat/Eligible.tsx | 2 +-
147 files changed, 448 insertions(+), 10378 deletions(-)
delete mode 100644 packages/code-du-travail-frontend/src/modules/outils/common/components/Agreement/AgreementSearch/AgreementInput/AgreementTile.tsx
delete mode 100644 packages/code-du-travail-frontend/src/modules/outils/common/components/Agreement/AgreementSearch/AgreementInput/SearchAgreementInput.tsx
delete mode 100644 packages/code-du-travail-frontend/src/modules/outils/common/components/Agreement/AgreementSearch/AgreementNoResult.tsx
delete mode 100644 packages/code-du-travail-frontend/src/modules/outils/common/components/Agreement/AgreementSearch/AgreementSearch.tsx
delete mode 100644 packages/code-du-travail-frontend/src/modules/outils/common/components/Agreement/AgreementSearch/index.ts
delete mode 100644 packages/code-du-travail-frontend/src/modules/outils/common/components/Agreement/EnterpriseSearch/EnterpriseSearch.tsx
delete mode 100644 packages/code-du-travail-frontend/src/modules/outils/common/components/Agreement/EnterpriseSearch/EntrepriseSearchInput/EnterpriseButton.tsx
delete mode 100644 packages/code-du-travail-frontend/src/modules/outils/common/components/Agreement/EnterpriseSearch/EntrepriseSearchInput/SearchEnterpriseInput.tsx
delete mode 100644 packages/code-du-travail-frontend/src/modules/outils/common/components/Agreement/EnterpriseSearch/EntrepriseSearchResult.tsx
delete mode 100644 packages/code-du-travail-frontend/src/modules/outils/common/components/Agreement/EnterpriseSearch/Location/Search.tsx
delete mode 100644 packages/code-du-travail-frontend/src/modules/outils/common/components/Agreement/EnterpriseSearch/Location/searchCities.ts
delete mode 100644 packages/code-du-travail-frontend/src/modules/outils/common/components/Agreement/EnterpriseSearch/SelectedEnterprise.tsx
delete mode 100644 packages/code-du-travail-frontend/src/modules/outils/common/components/Agreement/EnterpriseSearch/ShowAgreement.tsx
delete mode 100644 packages/code-du-travail-frontend/src/modules/outils/common/components/Agreement/EnterpriseSearch/ShowAgreements.tsx
delete mode 100644 packages/code-du-travail-frontend/src/modules/outils/common/components/Agreement/EnterpriseSearch/index.ts
delete mode 100644 packages/code-du-travail-frontend/src/modules/outils/common/components/Agreement/RouteSelection/RouteSelection.tsx
delete mode 100644 packages/code-du-travail-frontend/src/modules/outils/common/components/Agreement/RouteSelection/ShowAlert.tsx
delete mode 100644 packages/code-du-travail-frontend/src/modules/outils/common/components/Agreement/RouteSelection/index.ts
delete mode 100644 packages/code-du-travail-frontend/src/modules/outils/common/components/Agreement/SelectAgreement.tsx
delete mode 100644 packages/code-du-travail-frontend/src/modules/outils/common/components/Agreement/__tests__/AgreementSearch.test.tsx
delete mode 100644 packages/code-du-travail-frontend/src/modules/outils/common/components/Agreement/__tests__/EnterpriseSearch.test.tsx
delete mode 100644 packages/code-du-travail-frontend/src/modules/outils/common/components/Agreement/__tests__/RouteSelection.test.tsx
delete mode 100644 packages/code-du-travail-frontend/src/modules/outils/common/components/Agreement/__tests__/SelectAgreement.test.tsx
delete mode 100644 packages/code-du-travail-frontend/src/modules/outils/common/components/Agreement/components/Modal.tsx
delete mode 100644 packages/code-du-travail-frontend/src/modules/outils/common/components/Agreement/components/ResultList.tsx
delete mode 100644 packages/code-du-travail-frontend/src/modules/outils/common/components/Agreement/components/ShowAlert.tsx
delete mode 100644 packages/code-du-travail-frontend/src/modules/outils/common/components/Agreement/components/Suggester.ts
delete mode 100644 packages/code-du-travail-frontend/src/modules/outils/common/components/Agreement/form-constants.ts
delete mode 100644 packages/code-du-travail-frontend/src/modules/outils/common/components/Agreement/index.ts
delete mode 100644 packages/code-du-travail-frontend/src/modules/outils/common/components/Agreement/tracking/__tests__/handleTrackEvent.test.tsx
delete mode 100644 packages/code-du-travail-frontend/src/modules/outils/common/components/Agreement/tracking/__tests__/pushAgreementEvents.test.tsx
delete mode 100644 packages/code-du-travail-frontend/src/modules/outils/common/components/Agreement/tracking/handleTrackEvent.ts
delete mode 100644 packages/code-du-travail-frontend/src/modules/outils/common/components/Agreement/tracking/index.ts
delete mode 100644 packages/code-du-travail-frontend/src/modules/outils/common/components/Agreement/tracking/pushAgreementEvents.ts
delete mode 100644 packages/code-du-travail-frontend/src/modules/outils/common/components/Agreement/types.ts
delete mode 100644 packages/code-du-travail-frontend/src/modules/outils/common/components/Feedback/Questionnaire.tsx
delete mode 100644 packages/code-du-travail-frontend/src/modules/outils/common/components/Feedback/QuestionnaireAdvanced.tsx
delete mode 100644 packages/code-du-travail-frontend/src/modules/outils/common/components/Feedback/QuestionnaireEnd.tsx
delete mode 100644 packages/code-du-travail-frontend/src/modules/outils/common/components/Feedback/QuestionnaireItem.tsx
delete mode 100644 packages/code-du-travail-frontend/src/modules/outils/common/components/Feedback/QuestionnaireText.tsx
delete mode 100644 packages/code-du-travail-frontend/src/modules/outils/common/components/Feedback/__tests__/feedback.test.tsx
delete mode 100644 packages/code-du-travail-frontend/src/modules/outils/common/components/Feedback/__tests__/ui.ts
delete mode 100644 packages/code-du-travail-frontend/src/modules/outils/common/components/Feedback/index.tsx
delete mode 100644 packages/code-du-travail-frontend/src/modules/outils/common/components/Feedback/introduction.tsx
delete mode 100644 packages/code-du-travail-frontend/src/modules/outils/common/components/Feedback/tracking.ts
delete mode 100644 packages/code-du-travail-frontend/src/modules/outils/common/components/Informations/index.ts
delete mode 100644 packages/code-du-travail-frontend/src/modules/outils/common/components/types.ts
delete mode 100644 packages/code-du-travail-frontend/src/modules/outils/common/indemnite-depart/agreements/ui-customizations/tooltip.tsx
delete mode 100644 packages/code-du-travail-frontend/src/modules/outils/common/indemnite-depart/steps/Anciennete/components/SectionTitleWithTooltip.tsx
delete mode 100644 packages/code-du-travail-frontend/src/modules/outils/common/indemnite-depart/steps/Anciennete/components/__tests__/SectionTitleWithTooltip.test.tsx
rename packages/code-du-travail-frontend/src/modules/outils/common/{components/Informations => indemnite-depart/steps/Informations/components}/PubliQuestion.tsx (67%)
rename packages/code-du-travail-frontend/src/modules/outils/common/{components/Informations => indemnite-depart/steps/Informations/components}/__tests__/PubliQuestion.test.tsx (98%)
rename packages/code-du-travail-frontend/src/modules/outils/common/{components => indemnite-depart/steps}/Informations/utils/__tests__/informationToSituation.test.ts (93%)
rename packages/code-du-travail-frontend/src/modules/outils/common/{components => indemnite-depart/steps}/Informations/utils/index.ts (100%)
rename packages/code-du-travail-frontend/src/modules/outils/common/{components => indemnite-depart/steps}/Informations/utils/informationToSituation.ts (63%)
rename packages/code-du-travail-frontend/src/modules/outils/common/indemnite-depart/steps/Salaires/components/{TooltipSalary.tsx => HighlightSalary.tsx} (89%)
delete mode 100644 packages/code-du-travail-frontend/src/modules/outils/indemnite-licenciement/__tests__/absence-date-onchange-motif.test.tsx
delete mode 100644 packages/code-du-travail-frontend/src/modules/outils/indemnite-licenciement/__tests__/absence-date-with-agreement.test.tsx
delete mode 100644 packages/code-du-travail-frontend/src/modules/outils/indemnite-licenciement/__tests__/absence-date-without-agreement.test.tsx
delete mode 100644 packages/code-du-travail-frontend/src/modules/outils/indemnite-licenciement/__tests__/arret-travail.test.tsx
delete mode 100644 packages/code-du-travail-frontend/src/modules/outils/indemnite-licenciement/__tests__/cc1404.test.tsx
delete mode 100644 packages/code-du-travail-frontend/src/modules/outils/indemnite-licenciement/__tests__/cc1486.test.tsx
delete mode 100644 packages/code-du-travail-frontend/src/modules/outils/indemnite-licenciement/__tests__/cc1516.test.tsx
delete mode 100644 packages/code-du-travail-frontend/src/modules/outils/indemnite-licenciement/__tests__/cc1517.test.tsx
delete mode 100644 packages/code-du-travail-frontend/src/modules/outils/indemnite-licenciement/__tests__/cc1527.test.tsx
delete mode 100644 packages/code-du-travail-frontend/src/modules/outils/indemnite-licenciement/__tests__/cc16.test.tsx
delete mode 100644 packages/code-du-travail-frontend/src/modules/outils/indemnite-licenciement/__tests__/cc1672.test.tsx
delete mode 100644 packages/code-du-travail-frontend/src/modules/outils/indemnite-licenciement/__tests__/cc1702.test.tsx
delete mode 100644 packages/code-du-travail-frontend/src/modules/outils/indemnite-licenciement/__tests__/cc2098.test.tsx
delete mode 100644 packages/code-du-travail-frontend/src/modules/outils/indemnite-licenciement/__tests__/cc2120.test.tsx
delete mode 100644 packages/code-du-travail-frontend/src/modules/outils/indemnite-licenciement/__tests__/cc2148.test.tsx
delete mode 100644 packages/code-du-travail-frontend/src/modules/outils/indemnite-licenciement/__tests__/cc2596.test.tsx
delete mode 100644 packages/code-du-travail-frontend/src/modules/outils/indemnite-licenciement/__tests__/cc2609.test.tsx
delete mode 100644 packages/code-du-travail-frontend/src/modules/outils/indemnite-licenciement/__tests__/cc3127.test.tsx
delete mode 100644 packages/code-du-travail-frontend/src/modules/outils/indemnite-licenciement/__tests__/cc3239-reset-data.test.tsx
delete mode 100644 packages/code-du-travail-frontend/src/modules/outils/indemnite-licenciement/__tests__/cc3239.test.tsx
delete mode 100644 packages/code-du-travail-frontend/src/modules/outils/indemnite-licenciement/__tests__/cc3248.test.tsx
delete mode 100644 packages/code-du-travail-frontend/src/modules/outils/indemnite-licenciement/__tests__/cc44.test.tsx
delete mode 100644 packages/code-du-travail-frontend/src/modules/outils/indemnite-licenciement/__tests__/cc573.test.tsx
delete mode 100644 packages/code-du-travail-frontend/src/modules/outils/indemnite-licenciement/__tests__/cc675.test.tsx
delete mode 100644 packages/code-du-travail-frontend/src/modules/outils/indemnite-licenciement/__tests__/cc86.test.tsx
delete mode 100644 packages/code-du-travail-frontend/src/modules/outils/indemnite-licenciement/__tests__/eligibility-error-result.test.tsx
delete mode 100644 "packages/code-du-travail-frontend/src/modules/outils/indemnite-licenciement/__tests__/incrementation-1-jour-anciennet\303\251.test.tsx"
delete mode 100644 packages/code-du-travail-frontend/src/modules/outils/indemnite-licenciement/__tests__/indemnite-licenciement-cc-select.test.tsx
delete mode 100644 packages/code-du-travail-frontend/src/modules/outils/indemnite-licenciement/__tests__/indemnite-licenciement-contract.test.tsx
delete mode 100644 packages/code-du-travail-frontend/src/modules/outils/indemnite-licenciement/__tests__/information.test.tsx
delete mode 100644 packages/code-du-travail-frontend/src/modules/outils/indemnite-licenciement/__tests__/no-agreement-result.test.tsx
delete mode 100644 packages/code-du-travail-frontend/src/modules/outils/indemnite-licenciement/__tests__/notification.test.tsx
delete mode 100644 packages/code-du-travail-frontend/src/modules/outils/indemnite-licenciement/__tests__/resultat-formules.test.tsx
delete mode 100644 packages/code-du-travail-frontend/src/modules/outils/indemnite-licenciement/__tests__/salary-validation.test.tsx
delete mode 100644 packages/code-du-travail-frontend/src/modules/outils/indemnite-licenciement/__tests__/seniority-validation.test.tsx
delete mode 100644 packages/code-du-travail-frontend/src/modules/outils/indemnite-licenciement/__tests__/tracking.test.tsx
delete mode 100644 "packages/code-du-travail-frontend/src/modules/outils/indemnite-licenciement/__tests__/validation-anciennet\303\251-absence.test.tsx"
delete mode 100644 packages/code-du-travail-frontend/src/modules/outils/indemnite-licenciement/agreements/ui-customizations/index.ts
delete mode 100644 packages/code-du-travail-frontend/src/modules/outils/indemnite-licenciement/agreements/ui-customizations/messages.ts
delete mode 100644 packages/code-du-travail-frontend/src/modules/outils/indemnite-licenciement/events/useIndemniteLicenciementEventEmitter.tsx
delete mode 100644 packages/code-du-travail-frontend/src/modules/outils/indemnite-licenciement/index.tsx
delete mode 100644 "packages/code-du-travail-frontend/src/modules/outils/indemnite-licenciement/steps/Anciennet\303\251/index.tsx"
delete mode 100644 packages/code-du-travail-frontend/src/modules/outils/indemnite-licenciement/steps/ContratTravail/index.tsx
delete mode 100644 packages/code-du-travail-frontend/src/modules/outils/indemnite-licenciement/steps/Introduction/components/Intro.tsx
delete mode 100644 packages/code-du-travail-frontend/src/modules/outils/indemnite-licenciement/steps/Introduction/components/__tests__/Intro.test.tsx
delete mode 100644 packages/code-du-travail-frontend/src/modules/outils/indemnite-licenciement/steps/Introduction/components/index.ts
delete mode 100644 packages/code-du-travail-frontend/src/modules/outils/indemnite-licenciement/steps/Introduction/index.tsx
delete mode 100644 packages/code-du-travail-frontend/src/modules/outils/indemnite-licenciement/steps/Resultat/Eligible.tsx
delete mode 100644 packages/code-du-travail-frontend/src/modules/outils/indemnite-licenciement/steps/Resultat/Ineligible.tsx
delete mode 100644 packages/code-du-travail-frontend/src/modules/outils/indemnite-licenciement/steps/Resultat/index.tsx
delete mode 100644 packages/code-du-travail-frontend/src/modules/outils/indemnite-licenciement/steps/index.ts
diff --git a/packages/code-du-travail-frontend/pages/outils/[slug].tsx b/packages/code-du-travail-frontend/pages/outils/[slug].tsx
index e3437959af..a061cb3d37 100644
--- a/packages/code-du-travail-frontend/pages/outils/[slug].tsx
+++ b/packages/code-du-travail-frontend/pages/outils/[slug].tsx
@@ -18,6 +18,7 @@ import {
HeuresRechercheEmploi,
SimulateurIndemnitePrecarite,
CalculateurPreavisRetraite,
+ CalculateurIndemniteLicenciement,
} from "../../src/outils";
import {
getBySlugTools,
@@ -33,6 +34,7 @@ const toolsBySlug = {
"preavis-licenciement": DureePreavisLicenciement,
"preavis-retraite": CalculateurPreavisRetraite,
"procedure-licenciement": DismissalProcess,
+ "indemnite-licenciement": CalculateurIndemniteLicenciement,
};
export interface Props {
diff --git a/packages/code-du-travail-frontend/src/modules/common/Html.tsx b/packages/code-du-travail-frontend/src/modules/common/Html.tsx
index fb16015420..a057998ba3 100644
--- a/packages/code-du-travail-frontend/src/modules/common/Html.tsx
+++ b/packages/code-du-travail-frontend/src/modules/common/Html.tsx
@@ -4,13 +4,36 @@ import { xssWrapper } from "../../lib";
type Props = {
children: string;
as?: string;
- inline?: boolean;
};
const Html = ({ children, ...props }: Props): JSX.Element => {
+ if (props.as === "p") {
+ return (
+
+ );
+ } else if (props.as === "span") {
+ return (
+
+ );
+ } else if (props.as === "div") {
+ return (
+
+ );
+ }
return (
{
- onUserAction(UserAction.SelectAgreement, `idcc${agreement.num.toString()}`);
- window.parent?.postMessage(
- {
- name: "agreement",
- kind: "select",
- extra: { idcc: agreement.num, title: agreement.title },
- },
- "*"
- );
- };
- return (
-
-
- {agreement.contributions
- ? "Retrouvez les questions-réponses les plus fréquentes organisées par thème et élaborées par le Ministère du travail concernant cette convention collective"
- : "Consultez les dispositions de cette convention collective"}
-
-
- );
-}
diff --git a/packages/code-du-travail-frontend/src/modules/outils/common/components/Agreement/AgreementSearch/AgreementInput/SearchAgreementInput.tsx b/packages/code-du-travail-frontend/src/modules/outils/common/components/Agreement/AgreementSearch/AgreementInput/SearchAgreementInput.tsx
deleted file mode 100644
index 3d5c3679e1..0000000000
--- a/packages/code-du-travail-frontend/src/modules/outils/common/components/Agreement/AgreementSearch/AgreementInput/SearchAgreementInput.tsx
+++ /dev/null
@@ -1,160 +0,0 @@
-import { Label, Text, theme } from "@socialgouv/cdtn-ui";
-import React, { useState } from "react";
-import styled from "styled-components";
-import { formatIdcc } from "@socialgouv/modeles-social";
-import { InfoBulle } from "../../../InfoBulle";
-import { searchAgreements } from "../../../../../conventions/Search/api/agreements.service";
-import {
- TrackingProps,
- UserAction,
-} from "../../../../ConventionCollective/types";
-import { AgreementNoResult } from "../AgreementNoResult";
-import { Agreement } from "../../../../../outils/types";
-import { useCombobox } from "downshift";
-import {
- StyledSuggestion,
- StyledList,
- StyledInput,
-} from "../../../../../search/SearchBar";
-import { push as matopush } from "@socialgouv/matomo-next";
-
-type Props = {
- onSelectAgreement: (agreement: Agreement) => void;
- searchResultOverride?: (query: string, results: Agreement[]) => Agreement[];
-} & TrackingProps;
-
-export const SearchAgreementInput = ({
- onUserAction,
- onSelectAgreement,
- searchResultOverride,
-}: Props): JSX.Element => {
- const [query, setQuery] = useState
(null);
- const [suggestions, setSuggestions] = useState([]);
- const [isLoading, setIsLoading] = useState(false);
- const [error, setError] = useState(null);
-
- const {
- isOpen,
- getMenuProps,
- getInputProps,
- getLabelProps,
- highlightedIndex,
- getItemProps,
- } = useCombobox({
- items: suggestions,
- onInputValueChange: async ({ inputValue }) => {
- setIsLoading(true);
- setQuery(inputValue);
- try {
- const results = await searchAgreements(inputValue);
- if (inputValue) {
- onUserAction(UserAction.SearchAgreement, { query: inputValue });
- }
- if (searchResultOverride) {
- setSuggestions(searchResultOverride(inputValue, results));
- } else {
- setSuggestions(results);
- }
- } catch (error) {
- setError(error);
- } finally {
- setIsLoading(false);
- }
- },
- onSelectedItemChange(changes) {
- const suggestion: Agreement = changes.selectedItem;
- if (suggestion) {
- onSelectAgreement(suggestion);
- }
- },
- itemToString(item) {
- return item ? item.shortTitle : "";
- },
- });
-
- return (
- <>
-
- Nom de la convention collective ou son numéro d’identification{" "}
- IDCC {" "}
-
- (champ obligatoire)
-
-
- {
- matopush(["trackEvent", "outil", `click_tooltip_cc`]);
- }}
- >
-
- L’Identifiant de la Convention Collective (IDCC) est un numéro unique
- de 4 chiffres déterminant chaque convention
- collective (Ex : 1090 ou 1486).
-
-
- Attention à ne pas confondre avec les codes APE
- (Activité Principale Exercée) ou NAF (Nomenclature des Activités
- Françaises) qui sont des numéros composés de 4 chiffres et d’une
- lettre dont l’objectif est d’identifier l’activité principale de
- l’entreprise (Ex : 4752A).
-
-
-
-
-
-
- {isOpen &&
- suggestions.map((item: Agreement, index) => (
-
- {item.shortTitle} (IDCC {formatIdcc(item.num)})
-
- ))}
-
- {query !== null && query !== "" && (
-
- )}
- >
- );
-};
-
-const StyledSearch = styled(StyledInput)`
- margin-top: ${theme.spacings.small};
- padding-right: 1.6rem;
-`;
-
-const StyledUl = styled(StyledList)`
- position: initial;
- border: ${({ hideBorder }) =>
- hideBorder ? "0px" : `1px solid ${theme.colors.border}`};
- box-shadow: initial;
-`;
-
-const InlineLabel = styled(Label)`
- display: inline;
-`;
diff --git a/packages/code-du-travail-frontend/src/modules/outils/common/components/Agreement/AgreementSearch/AgreementNoResult.tsx b/packages/code-du-travail-frontend/src/modules/outils/common/components/Agreement/AgreementSearch/AgreementNoResult.tsx
deleted file mode 100644
index 0da9f4bf1e..0000000000
--- a/packages/code-du-travail-frontend/src/modules/outils/common/components/Agreement/AgreementSearch/AgreementNoResult.tsx
+++ /dev/null
@@ -1,135 +0,0 @@
-import { SOURCES } from "@socialgouv/cdtn-utils";
-import { Agreement } from "../../../../outils/types";
-import {
- AlertWithIcon,
- Button,
- Heading,
- ScreenReaderOnly,
- Section as SectionUi,
- Title,
- Wrapper,
-} from "@socialgouv/cdtn-ui";
-import Link from "next/link";
-import React from "react";
-import Spinner from "react-svg-spinner";
-import styled from "styled-components";
-
-import { TrackingProps, UserAction } from "../../../ConventionCollective/types";
-import { Error } from "../../ErrorField";
-import { HelpModal } from "../components/Modal";
-
-type Props = {
- isLoading: boolean;
- error?: any;
- data?: Agreement[];
- onUserAction: (action: UserAction) => void;
-} & TrackingProps;
-
-const AgreementNoResult = ({
- isLoading,
- error,
- data,
- onUserAction,
-}: Props): JSX.Element => {
- function openModalHandler(openModal: () => void) {
- onUserAction(UserAction.OpenAgreementHelp);
- openModal();
- }
-
- if (isLoading) {
- return (
-
- {" "}
- recherche en cours
-
- );
- }
- if (error) {
- if (typeof error === "string") {
- return {error} ;
- }
- return ;
- }
-
- if (data && !data.length) {
- return (
-
- 0 résultat
-
-
-
- Aucune convention collective n’a été trouvée
-
- .
-
- Suggestions :
-
- Vérifiez l’orthographe des termes de recherche
-
- Utilisez la rubrique ci-dessous “Vous ne trouvez pas votre
- convention collective ?”
-
-
-
-
- Vous ne trouvez pas votre convention collective ?
-
- (
- openModalHandler(openModal)}
- >
- Consulter notre aide
-
- )}
- >
-
- Vous ne trouvez pas votre convention collective ?
-
- Il peut y avoir plusieurs explications à cela :
-
-
- Votre convention collective a un autre code : si vous le pouvez,
- utilisez le numéro Siret de votre entreprise. Ce dernier doit
- être présent sur votre bulletin de paie.
-
-
- Votre convention collective a un statut particulier :
- administration ou établissements publics, associations, secteur
- agricole, La Poste, La Croix Rouge etc.
-
-
- Votre entreprise n’est rattachée à aucune convention collective.
-
-
- Essayez avec la recherche par entreprise
-
- Avec le nom de l’entreprise, il est possible de retrouver la
- convention collective associée
-
-
-
- Je recherche avec le nom de l’entreprise
-
- {" "}
-
-
-
-
- );
- }
-
- return <>>;
-};
-
-export { AgreementNoResult };
-
-const Section = styled(SectionUi)`
- padding-top: 1rem;
-`;
diff --git a/packages/code-du-travail-frontend/src/modules/outils/common/components/Agreement/AgreementSearch/AgreementSearch.tsx b/packages/code-du-travail-frontend/src/modules/outils/common/components/Agreement/AgreementSearch/AgreementSearch.tsx
deleted file mode 100644
index 0324fc8ef1..0000000000
--- a/packages/code-du-travail-frontend/src/modules/outils/common/components/Agreement/AgreementSearch/AgreementSearch.tsx
+++ /dev/null
@@ -1,97 +0,0 @@
-import {
- Paragraph,
- Section as SectionUi,
- theme,
- Toast,
-} from "@socialgouv/cdtn-ui";
-import React from "react";
-import { Field } from "react-final-form";
-import styled from "styled-components";
-
-import { TrackingProps } from "../../../ConventionCollective/types";
-import { ErrorField } from "../../ErrorField";
-import { Question } from "../../Question";
-import { required } from "../../validators";
-import { AGREEMENT_NAME } from "../form-constants";
-import ShowAlert from "../components/ShowAlert";
-import { AgreementSupportInfo } from "../types";
-import { SearchAgreementInput } from "./AgreementInput/SearchAgreementInput";
-import { Agreement } from "../../../types";
-
-export type Props = {
- supportedAgreements: AgreementSupportInfo[];
- selectedAgreement?: Agreement;
- onSelectAgreement: (agreement: Agreement | null) => void;
- alertAgreementNotSupported?: (string) => JSX.Element;
-} & TrackingProps;
-
-const AgreementSearch = ({
- supportedAgreements,
- selectedAgreement,
- onSelectAgreement,
- onUserAction,
- alertAgreementNotSupported,
-}: Props): JSX.Element => {
- if (selectedAgreement) {
- return (
- <>
-
- Vous avez sélectionné la convention collective :
-
- {
- event.preventDefault();
- onSelectAgreement(null);
- }}
- >
- {selectedAgreement.shortTitle}
-
-
- >
- );
- }
- return (
-
- );
-};
-
-const { spacings } = theme;
-
-const Section = styled(SectionUi)`
- padding-top: 0;
-
- label {
- font-weight: 400;
- }
-`;
-const SelectedAgreement = styled(Toast)`
- margin-bottom: ${spacings.base};
-`;
-
-export default AgreementSearch;
diff --git a/packages/code-du-travail-frontend/src/modules/outils/common/components/Agreement/AgreementSearch/index.ts b/packages/code-du-travail-frontend/src/modules/outils/common/components/Agreement/AgreementSearch/index.ts
deleted file mode 100644
index 0038e2c23b..0000000000
--- a/packages/code-du-travail-frontend/src/modules/outils/common/components/Agreement/AgreementSearch/index.ts
+++ /dev/null
@@ -1,3 +0,0 @@
-import AgreementSearch from "./AgreementSearch";
-
-export { AgreementSearch };
diff --git a/packages/code-du-travail-frontend/src/modules/outils/common/components/Agreement/EnterpriseSearch/EnterpriseSearch.tsx b/packages/code-du-travail-frontend/src/modules/outils/common/components/Agreement/EnterpriseSearch/EnterpriseSearch.tsx
deleted file mode 100644
index e1e3286799..0000000000
--- a/packages/code-du-travail-frontend/src/modules/outils/common/components/Agreement/EnterpriseSearch/EnterpriseSearch.tsx
+++ /dev/null
@@ -1,133 +0,0 @@
-import React, { useState } from "react";
-import { Field } from "react-final-form";
-import { Paragraph, Section as SectionUi } from "@socialgouv/cdtn-ui";
-import { Enterprise } from "../../../../conventions/Search/api/enterprises.service";
-import { TrackingProps } from "../../../ConventionCollective/types";
-import { ErrorField } from "../../ErrorField";
-import { required } from "../../validators";
-import { ENTERPRISE_NAME } from "../form-constants";
-import { AgreementSupportInfo, OnSelectAgreementFn } from "../types";
-import SelectedEnterprise from "./SelectedEnterprise";
-import ShowAgreement from "./ShowAgreement";
-import ShowAgreements from "./ShowAgreements";
-import {
- SearchEnterpriseInput,
- SearchParams,
-} from "./EntrepriseSearchInput/SearchEnterpriseInput";
-import styled from "styled-components";
-import { PublicodesSimulator } from "@socialgouv/modeles-social";
-import { Simulator } from "../../NoticeExample";
-import { Agreement } from "../../../types";
-
-export type Props = {
- supportedAgreements: AgreementSupportInfo[];
- selectedEnterprise?: Enterprise;
- selectedAgreement?: Agreement;
- onSelectAgreement: OnSelectAgreementFn;
- alertAgreementNotSupported?: (string) => JSX.Element;
- isDisabled?: boolean;
- setHasSelectedEnterprise?: (hasSelectedEnterprise: boolean) => void;
- simulator: Simulator;
-} & TrackingProps;
-
-const EnterpriseSearch = ({
- supportedAgreements,
- selectedEnterprise,
- onSelectAgreement,
- onUserAction,
- alertAgreementNotSupported,
- isDisabled,
- setHasSelectedEnterprise,
- simulator,
-}: Props): JSX.Element => {
- const [enterprise, setEnterprise] = useState(
- selectedEnterprise
- );
- const [searchParams, setSearchParams] = useState({
- query: "",
- });
-
- if (enterprise) {
- return (
- <>
- {
- setEnterprise(undefined);
- setHasSelectedEnterprise?.(false);
- onSelectAgreement(null);
- }}
- />
- {enterprise.conventions.length === 1 ? (
-
- ) : (
- {
- onSelectAgreement(agreement, enterprise);
- }}
- supportedAgreements={supportedAgreements}
- alertAgreementNotSupported={alertAgreementNotSupported}
- simulator={simulator}
- />
- )}
- >
- );
- }
- const handleEnterpriseSelection = (enterprise) => {
- if (enterprise.conventions.length === 1) {
- onSelectAgreement(enterprise.conventions[0], enterprise);
- }
- setEnterprise(enterprise);
- setHasSelectedEnterprise?.(true);
- };
- return (
-
- );
-};
-
-export default EnterpriseSearch;
-
-const Section = styled(SectionUi)`
- padding-top: 0;
-
- label {
- font-weight: 400;
- }
-`;
diff --git a/packages/code-du-travail-frontend/src/modules/outils/common/components/Agreement/EnterpriseSearch/EntrepriseSearchInput/EnterpriseButton.tsx b/packages/code-du-travail-frontend/src/modules/outils/common/components/Agreement/EnterpriseSearch/EntrepriseSearchInput/EnterpriseButton.tsx
deleted file mode 100644
index 2e44433f41..0000000000
--- a/packages/code-du-travail-frontend/src/modules/outils/common/components/Agreement/EnterpriseSearch/EntrepriseSearchInput/EnterpriseButton.tsx
+++ /dev/null
@@ -1,71 +0,0 @@
-import { Tag, Text, theme } from "@socialgouv/cdtn-ui";
-import React from "react";
-import styled from "styled-components";
-
-import { Enterprise } from "../../../../../conventions/Search/api/enterprises.service";
-import { ResultItem } from "../../components/ResultList";
-import Html from "../../../../../common/Html";
-import {
- TrackingProps,
- UserAction,
-} from "../../../../ConventionCollective/types";
-
-type CompagnyItemProps = {
- enterprise: Enterprise;
- isFirst: boolean;
- showAddress: boolean;
- onClick: (enterprise: Enterprise) => void;
-} & TrackingProps;
-
-export function EnterpriseButton({
- enterprise,
- isFirst,
- showAddress,
- onClick,
- onUserAction,
-}: CompagnyItemProps): JSX.Element {
- const {
- matching,
- highlightLabel,
- activitePrincipale,
- address,
- siren,
- firstMatchingEtablissement,
- } = enterprise;
-
- const clickHandler = () => {
- onUserAction(UserAction.SelectEnterprise, { label: highlightLabel, siren });
- onClick(enterprise);
- };
- return (
-
- {highlightLabel}
- {activitePrincipale && (
- Activité : {activitePrincipale}
- )}
- {!showAddress && matching > 1 ? (
- {matching} établissements
- ) : (
- {address || firstMatchingEtablissement?.address}
- )}
-
- );
-}
-
-const { spacings } = theme;
-
-const Activity = styled(Text)`
- color: ${({ theme }) => theme.altText};
- padding-bottom: ${spacings.xsmall};
-`;
-
-const ItemButton = styled(ResultItem)`
- &:hover ${Activity} {
- color: ${({ theme }) => theme.paragraph};
- }
-`;
-
-const Title = styled(Html)`
- padding-bottom: ${spacings.xsmall};
- font-weight: 700;
-`;
diff --git a/packages/code-du-travail-frontend/src/modules/outils/common/components/Agreement/EnterpriseSearch/EntrepriseSearchInput/SearchEnterpriseInput.tsx b/packages/code-du-travail-frontend/src/modules/outils/common/components/Agreement/EnterpriseSearch/EntrepriseSearchInput/SearchEnterpriseInput.tsx
deleted file mode 100644
index dbd59c4d4a..0000000000
--- a/packages/code-du-travail-frontend/src/modules/outils/common/components/Agreement/EnterpriseSearch/EntrepriseSearchInput/SearchEnterpriseInput.tsx
+++ /dev/null
@@ -1,172 +0,0 @@
-import { Button, icons, Input, Label, Text, theme } from "@socialgouv/cdtn-ui";
-import React, { useState } from "react";
-import styled from "styled-components";
-import { createSuggesterHook } from "../../components/Suggester";
-import {
- Enterprise,
- searchEnterprises,
-} from "../../../../../conventions/Search/api/enterprises.service";
-import {
- TrackingProps,
- UserAction,
-} from "../../../../ConventionCollective/types";
-import { InfoBulle } from "../../../InfoBulle";
-import { EntrepriseSearchResults } from "../EntrepriseSearchResult";
-import {
- ApiGeoResultWithSelectedPostCode,
- LocationSearchInput,
-} from "../Location/Search";
-import { Error } from "../../../ErrorField";
-import { push as matopush } from "@socialgouv/matomo-next";
-
-type Props = {
- searchParams?: SearchParams;
- placeholder?: string;
- onSearchParamsChange: (params: SearchParams) => void;
- isDisabled?: boolean;
- handleEnterpriseSelection: (
- enterprise: Enterprise,
- params?: SearchParams
- ) => void;
-} & TrackingProps;
-
-export type SearchParams = {
- query: string;
- apiGeoResult?: ApiGeoResultWithSelectedPostCode;
-};
-
-export const SearchEnterpriseInput = ({
- searchParams = { query: "" },
- onUserAction,
- onSearchParamsChange,
- isDisabled,
- handleEnterpriseSelection,
-}: Props): JSX.Element => {
- const useEnterpriseSuggester = createSuggesterHook(
- searchEnterprises,
- (searchParams) => {
- onUserAction(UserAction.SearchEnterprise, searchParams);
- }
- );
- const state = useEnterpriseSuggester(searchParams);
- const [query, setQuery] = useState(searchParams.query);
- const [hasLocationSearchError, setHasLocationSearchError] = useState(false);
- const [selectedApiGeoResult, setSelectedApiGeoResult] = useState<
- ApiGeoResultWithSelectedPostCode | undefined
- >(searchParams.apiGeoResult);
-
- const searchInputHandler = (e) => {
- e.preventDefault();
- onSearchParamsChange({
- ...searchParams,
- query,
- apiGeoResult: selectedApiGeoResult,
- });
- };
-
- return (
- <>
-
-
-
- Nom de votre entreprise ou numéro Siren/Siret
-
- {
- matopush(["trackEvent", "outil", `click_tooltip_entreprise`]);
- }}
- >
-
- Le numéro Siren est un{" "}
- numéro unique de 9 chiffres attribué à chaque
- entreprise (ex : 401237780).
-
- Le numéro Siret est un numéro de 14 chiffres {" "}
- unique pour chaque établissement de l'entreprise. Il est
- présent sur la fiche de paie du salarié (ex :
- 40123778000127).
-
-
-
- setQuery(e.target.value)}
- autoComplete="off"
- data-testid="agreement-company-search-input"
- disabled={isDisabled}
- />
-
-
-
-
-
- {hasLocationSearchError && (
-
- Une erreur est survenue lors de la recherche par ville, veuillez
- réessayer plus tard.
-
- )}
-
- >
- );
-};
-
-const BlockInput = styled(Input)`
- width: 100%;
-`;
-
-const BlockInputLeft = styled(BlockInput)`
- @media (min-width: ${theme.breakpoints.tablet}) {
- input {
- border-top-right-radius: 0;
- border-bottom-right-radius: 0;
- }
- }
-`;
-
-const InlineLabel = styled(Label)`
- display: inline;
- color: ${({ theme, disabled }) =>
- disabled ? theme.placeholder : theme.paragraph};
-`;
-
-const Flex = styled.div`
- display: flex;
- align-items: flex-end;
- justify-content: space-between;
- @media (max-width: ${theme.breakpoints.mobile}) {
- flex-direction: column;
- align-items: center;
- }
-`;
-
-const Box = styled.div`
- flex: 1;
- width: 100%;
-
- & + & {
- @media (min-width: ${theme.breakpoints.mobile}) {
- flex: 0 1 32rem;
- }
- @media (max-width: ${theme.breakpoints.mobile}) {
- padding-top: ${theme.spacings.xmedium};
- }
- }
-`;
diff --git a/packages/code-du-travail-frontend/src/modules/outils/common/components/Agreement/EnterpriseSearch/EntrepriseSearchResult.tsx b/packages/code-du-travail-frontend/src/modules/outils/common/components/Agreement/EnterpriseSearch/EntrepriseSearchResult.tsx
deleted file mode 100644
index 5a9c9a81e6..0000000000
--- a/packages/code-du-travail-frontend/src/modules/outils/common/components/Agreement/EnterpriseSearch/EntrepriseSearchResult.tsx
+++ /dev/null
@@ -1,133 +0,0 @@
-import {
- Button,
- ScreenReaderOnly,
- Section as SectionUi,
- Title,
- Wrapper,
-} from "@socialgouv/cdtn-ui";
-import React from "react";
-import Spinner from "react-svg-spinner";
-import styled from "styled-components";
-import { FetchReducerState } from "../components/Suggester";
-import { TrackingProps, UserAction } from "../../../ConventionCollective/types";
-import { Error } from "../../ErrorField";
-import { ListItem, ResultList } from "../components/ResultList";
-import { HelpModal } from "../components/Modal";
-import { Enterprise } from "../../../../conventions/Search/api/enterprises.service";
-import { SearchParams } from "./EntrepriseSearchInput/SearchEnterpriseInput";
-import { EnterpriseButton } from "./EntrepriseSearchInput/EnterpriseButton";
-
-type Props = {
- handleEnterpriseSelection: (
- enterprise: Enterprise,
- params?: SearchParams
- ) => void;
- state: FetchReducerState;
- params: SearchParams;
-} & TrackingProps;
-
-const EntrepriseSearchResults = ({
- handleEnterpriseSelection,
- onUserAction,
- state,
- params,
-}: Props): JSX.Element => {
- function openModalHandler(openModal: () => void) {
- onUserAction(UserAction.OpenEnterpriseHelp);
- openModal();
- }
-
- const isSiret = /^\d{14}$/.test(params.query.replace(/\s/g, ""));
- if (state.isLoading) {
- return (
-
- {" "}
- recherche en cours
-
- );
- }
-
- if (state.error) {
- if (typeof state.error === "string") {
- return {state.error} ;
- }
- return {JSON.stringify(state.error)} ;
- }
- if (!state.data) {
- return <>>;
- }
- return state.data.length > 0 ? (
-
-
- {state.data.length} résultats
-
-
- {state.data.map((item, index) => {
- return (
-
- handleEnterpriseSelection(item, params)}
- onUserAction={onUserAction}
- />
-
- );
- })}
-
-
- ) : (
-
-
-
- Aucune entreprise n’a été trouvée .
-
- Suggestions :
-
- Vérifiez l’orthographe des termes de recherche
-
- Utilisez la rubrique ci-dessous “Vous ne trouvez pas votre
- entreprise ? Consultez notre aide”
-
-
-
-
- Vous ne trouvez pas votre entreprise ?
-
- (
- openModalHandler(openModal)}>
- Consulter notre aide
-
- )}
- >
-
- Vous ne trouvez pas votre convention collective ?
-
- Il peut y avoir plusieurs explications à cela :
-
-
- Votre entreprise a été enregistrée sous un autre nom ou un autre
- code : si vous le pouvez, utilisez son numéro Siret. Ce dernier
- doit être présent sur votre bulletin de paie.
-
-
- Votre entreprise a un statut particulier : administration ou
- établissements publics, associations, secteur agricole, La Poste,
- La Croix Rouge etc. ;
-
- Votre entreprise n’a pas de convention collective.
-
-
-
-
- );
-};
-
-export { EntrepriseSearchResults };
-
-const Section = styled(SectionUi)`
- padding-top: 1rem;
-`;
diff --git a/packages/code-du-travail-frontend/src/modules/outils/common/components/Agreement/EnterpriseSearch/Location/Search.tsx b/packages/code-du-travail-frontend/src/modules/outils/common/components/Agreement/EnterpriseSearch/Location/Search.tsx
deleted file mode 100644
index 30fd693ede..0000000000
--- a/packages/code-du-travail-frontend/src/modules/outils/common/components/Agreement/EnterpriseSearch/Location/Search.tsx
+++ /dev/null
@@ -1,208 +0,0 @@
-import { Button, icons, Label, Input, Text, theme } from "@socialgouv/cdtn-ui";
-import styled from "styled-components";
-import { useCombobox } from "downshift";
-import { useState } from "react";
-import { ApiGeoResult, searchCities } from "./searchCities";
-import { StyledList, StyledSuggestion } from "../../../../../search/SearchBar";
-import { detectIfPostalCode } from "../../../../../conventions/Search/api/utils";
-import { captureException } from "@sentry/nextjs";
-
-const { Search: SearchIcon } = icons;
-
-type Props = {
- selectedApiGeoResult?: ApiGeoResultWithSelectedPostCode;
- setSelectedApiGeoResult: (
- apiGeoResult?: ApiGeoResultWithSelectedPostCode
- ) => void;
- isDisabled?: boolean;
- searchInputHandler: (e: React.FormEvent) => void;
- setHasLocationSearchError: (hasError: boolean) => void;
-};
-
-export type ApiGeoResultWithSelectedPostCode = ApiGeoResult & {
- selectedPostCode: string[];
-};
-
-export const LocationSearchInput = (props: Props) => {
- const [suggestions, setSuggestions] = useState([]);
- const [postalCode, setPostalCode] = useState(
- props.selectedApiGeoResult?.selectedPostCode &&
- props.selectedApiGeoResult.selectedPostCode.length > 1
- ? props.selectedApiGeoResult.codeDepartement
- : props.selectedApiGeoResult?.selectedPostCode[0]
- );
- const {
- isOpen,
- getMenuProps,
- getInputProps,
- getLabelProps,
- highlightedIndex,
- getItemProps,
- setInputValue,
- } = useCombobox({
- items: suggestions,
- itemToString,
- onInputValueChange: async ({ inputValue }) => {
- if (!inputValue) {
- props.setSelectedApiGeoResult(undefined);
- }
- try {
- const results = await searchCities(inputValue);
- setSuggestions(results);
- const isPostalCode = detectIfPostalCode(inputValue);
- setPostalCode(isPostalCode ? inputValue : undefined);
- props.setHasLocationSearchError(false);
- } catch (error) {
- console.error(error);
- captureException(error);
- setSuggestions([]);
- props.setHasLocationSearchError(true);
- }
- },
- selectedItem: props.selectedApiGeoResult,
- onSelectedItemChange(changes) {
- props.setSelectedApiGeoResult({
- ...changes.selectedItem,
- selectedPostCode: postalCode
- ? [postalCode]
- : changes.selectedItem.codesPostaux,
- });
- },
- });
-
- function itemToString(item: ApiGeoResult | null) {
- const result = item
- ? `${item.nom} (${postalCode ?? (item.codesPostaux.length > 1 ? item.codeDepartement : item.codesPostaux[0])})`
- : "";
- return result;
- }
-
- const onSearch = (e: React.MouseEvent) => {
- if (!props.selectedApiGeoResult) {
- setInputValue("");
- }
- props.searchInputHandler(e);
- };
-
- return (
- <>
-
- Code postal ou ville
- {" "}
-
- (facultatif)
-
-
-
-
-
-
- {isOpen &&
- suggestions.map((item, index) => (
-
- {itemToString(item)}
-
- ))}
-
-
-
-
- Rechercher
-
-
-
- >
- );
-};
-
-const BlockInputRight = styled(Input)`
- width: 100%;
- input {
- padding-right: 6rem;
- }
-
- @media (min-width: ${theme.breakpoints.tablet}) {
- input {
- border-top-left-radius: 0;
- border-bottom-left-radius: 0;
- }
- }
-`;
-
-const InlineLabel = styled(Label)`
- display: inline;
- color: ${({ theme, disabled }) =>
- disabled ? theme.placeholder : theme.paragraph};
-`;
-
-const InlineText = styled(Text)`
- color: ${({ theme, disabled }) =>
- disabled ? theme.placeholder : theme.paragraph};
-`;
-
-const InputWithButton = styled.div`
- position: relative;
-`;
-const SubmitIcon = styled(Button)`
- @media (min-width: ${theme.breakpoints.mobile}) {
- position: absolute;
- top: 6px;
- right: 6px;
- width: 2.5rem;
- }
- @media (max-width: ${theme.breakpoints.mobile}) {
- width: 100%;
- margin-top: ${theme.spacings.xmedium};
- box-sizing: inherit;
- }
- color: ${({ theme }) => theme.white};
- background-color: ${({ theme, disabled }) =>
- disabled ? theme.placeholder : theme.secondary};
- border-color: ${({ theme, disabled }) =>
- disabled ? theme.placeholder : theme.secondary};
-`;
-
-const StyledSearchIcon = styled(SearchIcon)`
- @media (max-width: ${theme.breakpoints.mobile}) {
- display: none;
- }
- color: ${({ theme }) => theme.white};
- height: 25px;
- width: 25px;
-`;
-
-const MobileOnly = styled.span`
- @media (min-width: ${theme.breakpoints.mobile}) {
- display: none;
- }
-`;
diff --git a/packages/code-du-travail-frontend/src/modules/outils/common/components/Agreement/EnterpriseSearch/Location/searchCities.ts b/packages/code-du-travail-frontend/src/modules/outils/common/components/Agreement/EnterpriseSearch/Location/searchCities.ts
deleted file mode 100644
index 6f8ae95e29..0000000000
--- a/packages/code-du-travail-frontend/src/modules/outils/common/components/Agreement/EnterpriseSearch/Location/searchCities.ts
+++ /dev/null
@@ -1,37 +0,0 @@
-import { captureException } from "@sentry/nextjs";
-import {
- API_GEO_MAX_SEARCH_RESULTS,
- API_GEO_URL,
- DEBOUNCE_TIME_MS,
-} from "../../../../../config";
-import debounce from "debounce-promise";
-
-export type ApiGeoResult = {
- code: string;
- nom: string;
- population: number;
- codeDepartement: string;
- codesPostaux: string[];
- _score?: number;
-};
-
-const apiGeoSearchCommunes = async (
- search: string
-): Promise => {
- const fields = "nom,codesPostaux,population,codeDepartement";
- const response = await Promise.all([
- fetch(`${API_GEO_URL}/communes?nom=${search}&fields=${fields}`),
- fetch(`${API_GEO_URL}/communes?codePostal=${search}&fields=${fields}`),
- ]);
- const apiResults = await Promise.all(
- response.map((r) => r.json() as any as ApiGeoResult[])
- );
- const results = [
- ...apiResults[0].slice(0, API_GEO_MAX_SEARCH_RESULTS),
- ...apiResults[1],
- ];
- const sortedResult = results.sort((a, b) => b.population - a.population);
- return sortedResult;
-};
-
-export const searchCities = debounce(apiGeoSearchCommunes, DEBOUNCE_TIME_MS);
diff --git a/packages/code-du-travail-frontend/src/modules/outils/common/components/Agreement/EnterpriseSearch/SelectedEnterprise.tsx b/packages/code-du-travail-frontend/src/modules/outils/common/components/Agreement/EnterpriseSearch/SelectedEnterprise.tsx
deleted file mode 100644
index 7bf13bcfa0..0000000000
--- a/packages/code-du-travail-frontend/src/modules/outils/common/components/Agreement/EnterpriseSearch/SelectedEnterprise.tsx
+++ /dev/null
@@ -1,39 +0,0 @@
-import { theme, Toast } from "@socialgouv/cdtn-ui";
-import React from "react";
-import styled from "styled-components";
-
-import { Enterprise } from "../../../../conventions/Search/api/enterprises.service";
-import { Question } from "../../Question";
-
-type Props = {
- enterprise: Enterprise;
- onRemoveEnterprise: () => void;
-};
-
-const SelectedEnterprise = ({
- enterprise,
- onRemoveEnterprise,
-}: Props): JSX.Element => {
- return (
- <>
-
- Vous avez sélectionné l'entreprise :
-
- {
- event.preventDefault();
- onRemoveEnterprise();
- }}
- >
- {enterprise.simpleLabel}
-
- >
- );
-};
-
-export default SelectedEnterprise;
-
-const Selected = styled(Toast)`
- margin-bottom: ${theme.spacings.small};
-`;
diff --git a/packages/code-du-travail-frontend/src/modules/outils/common/components/Agreement/EnterpriseSearch/ShowAgreement.tsx b/packages/code-du-travail-frontend/src/modules/outils/common/components/Agreement/EnterpriseSearch/ShowAgreement.tsx
deleted file mode 100644
index 3d8bc13fe6..0000000000
--- a/packages/code-du-travail-frontend/src/modules/outils/common/components/Agreement/EnterpriseSearch/ShowAgreement.tsx
+++ /dev/null
@@ -1,41 +0,0 @@
-import { formatIdcc, PublicodesSimulator } from "@socialgouv/modeles-social";
-import { Text } from "@socialgouv/cdtn-ui";
-import React from "react";
-
-import { Agreement } from "../../../types";
-import { Question } from "../../Question";
-import ShowAlert from "../components/ShowAlert";
-import { AgreementSupportInfo } from "../types";
-
-type Props = {
- agreement: Agreement;
- supportedAgreements: AgreementSupportInfo[];
- alertAgreementNotSupported?: (string) => JSX.Element;
- simulator: PublicodesSimulator | "QUESTIONNAIRE";
-};
-
-const ShowAgreement = ({
- agreement,
- supportedAgreements,
- alertAgreementNotSupported,
- simulator,
-}: Props): JSX.Element => {
- return (
- <>
-
- Une convention collective a été trouvée pour cette entreprise :
-
-
- {agreement.shortTitle} (IDCC {formatIdcc(agreement.num)})
-
-
- >
- );
-};
-
-export default ShowAgreement;
diff --git a/packages/code-du-travail-frontend/src/modules/outils/common/components/Agreement/EnterpriseSearch/ShowAgreements.tsx b/packages/code-du-travail-frontend/src/modules/outils/common/components/Agreement/EnterpriseSearch/ShowAgreements.tsx
deleted file mode 100644
index c0ff7e6bc2..0000000000
--- a/packages/code-du-travail-frontend/src/modules/outils/common/components/Agreement/EnterpriseSearch/ShowAgreements.tsx
+++ /dev/null
@@ -1,105 +0,0 @@
-import { formatIdcc } from "@socialgouv/modeles-social";
-import { InputRadio, Text } from "@socialgouv/cdtn-ui";
-import React, { useState } from "react";
-import { Field } from "react-final-form";
-import { OnChange } from "react-final-form-listeners";
-
-import { Enterprise } from "../../../../conventions/Search/api/enterprises.service";
-import { Agreement } from "../../../types";
-import { ErrorField } from "../../ErrorField";
-import { Question } from "../../Question";
-import { RadioContainer } from "../../stepStyles";
-import { required } from "../../validators";
-import { AGREEMENT_ID_NAME } from "../form-constants";
-import ShowAlert from "../components/ShowAlert";
-import { AgreementSupportInfo } from "../types";
-import { Alert } from "../../../../common/Alert";
-import { Simulator } from "../../NoticeExample";
-
-type Props = {
- enterprise: Enterprise;
- onChange: (enterprise: Enterprise, agreement: Agreement | null) => void;
- supportedAgreements: AgreementSupportInfo[];
- alertAgreementNotSupported?: (string) => JSX.Element;
- simulator?: Simulator;
-};
-
-const ShowAgreements = ({
- enterprise,
- onChange,
- supportedAgreements,
- alertAgreementNotSupported,
- simulator,
-}: Props): JSX.Element => {
- const [agreement, setAgreement] = useState();
-
- return (
- <>
- {enterprise.conventions.length > 0 ? (
-
- {enterprise.conventions.length} conventions collectives ont été
- trouvées pour cette entreprise, sélectionnez la vôtre :
-
- ) : (
- <>
- {simulator === Simulator.HEURES_RECHERCHE_EMPLOI ||
- simulator === Simulator.PREAVIS_DEMISSION ? (
-
- ) : (
-
- )}
- >
- )}
-
- {enterprise.conventions.map((agreement) => {
- return (
-
- {(props) => (
-
- {agreement.shortTitle} (IDCC {formatIdcc(agreement.num)})
-
- }
- id={`agreement-${agreement.id}`}
- {...props.input}
- />
- )}
-
- );
- })}
-
- {(values) => {
- const agreementChanged = enterprise?.conventions?.find(
- (agreement) => agreement.id.toString() === values.toString()
- );
- setAgreement(agreementChanged);
- onChange(enterprise, agreementChanged ?? null);
- }}
-
-
-
- {agreement && (
-
- )}
- >
- );
-};
-
-export default ShowAgreements;
diff --git a/packages/code-du-travail-frontend/src/modules/outils/common/components/Agreement/EnterpriseSearch/index.ts b/packages/code-du-travail-frontend/src/modules/outils/common/components/Agreement/EnterpriseSearch/index.ts
deleted file mode 100644
index 432ffb1e35..0000000000
--- a/packages/code-du-travail-frontend/src/modules/outils/common/components/Agreement/EnterpriseSearch/index.ts
+++ /dev/null
@@ -1,3 +0,0 @@
-import EnterpriseSearch from "./EnterpriseSearch";
-
-export { EnterpriseSearch };
diff --git a/packages/code-du-travail-frontend/src/modules/outils/common/components/Agreement/RouteSelection/RouteSelection.tsx b/packages/code-du-travail-frontend/src/modules/outils/common/components/Agreement/RouteSelection/RouteSelection.tsx
deleted file mode 100644
index 9febef0f1b..0000000000
--- a/packages/code-du-travail-frontend/src/modules/outils/common/components/Agreement/RouteSelection/RouteSelection.tsx
+++ /dev/null
@@ -1,127 +0,0 @@
-import { InputRadio, Text, Fieldset } from "@socialgouv/cdtn-ui";
-import { FormApi } from "final-form";
-import React from "react";
-import { Field } from "react-final-form";
-import { OnChange } from "react-final-form-listeners";
-import styled from "styled-components";
-
-import { ErrorField } from "../../ErrorField";
-import { Question } from "../../Question";
-import { RadioContainer } from "../../stepStyles";
-import { AgreementRoute, FormContent } from "../../type/WizardType";
-import { required } from "../../validators";
-import { ROUTE_NAME } from "../form-constants";
-import ShowAlert from "./ShowAlert";
-
-type Props = {
- form: FormApi;
- canBeSkip: boolean;
- onChange: (AgreementRoute) => void;
-};
-
-const RouteSelection = ({
- form,
- onChange,
- canBeSkip = true,
-}: Props): JSX.Element => {
- const values = form.getState().values;
- return (
- <>
-
-
- Vous pouvez trouver le nom de votre convention collective sur
- votre bulletin de paie .
-
- ),
- }}
- >
- Quel est le nom de la convention collective applicable ?
-
-
-
- type="radio"
- name={ROUTE_NAME}
- value="agreement"
- validate={required}
- >
- {(props) => (
-
- Je sais quelle est ma convention collective (je la saisis)
-
- }
- id={`agreement`}
- {...props.input}
- checked={values.ccn?.selected ?? props.input.checked}
- />
- )}
-
-
- type="radio"
- name={ROUTE_NAME}
- value="enterprise"
- validate={required}
- >
- {(props) => (
-
- Je ne sais pas quelle est ma convention collective (je la
- recherche)
-
- }
- id={`enterprise`}
- {...props.input}
- />
- )}
-
- {canBeSkip && (
-
- type="radio"
- name={ROUTE_NAME}
- value="not-selected"
- validate={required}
- >
- {(props) => (
-
- Je ne souhaite pas renseigner ma convention collective (je
- passe l'étape)
-
- }
- id={`not-selected`}
- {...props.input}
- />
- )}
-
- )}
-
- {values.ccn && }
-
- {(
- values: AgreementRoute | null | undefined,
- _previous: AgreementRoute | null | undefined
- ) => {
- if (values) {
- onChange(values);
- }
- }}
-
-
-
- >
- );
-};
-
-export default RouteSelection;
-
-const StyledFieldset = styled(Fieldset)`
- display: contents;
-`;
diff --git a/packages/code-du-travail-frontend/src/modules/outils/common/components/Agreement/RouteSelection/ShowAlert.tsx b/packages/code-du-travail-frontend/src/modules/outils/common/components/Agreement/RouteSelection/ShowAlert.tsx
deleted file mode 100644
index 7174d40635..0000000000
--- a/packages/code-du-travail-frontend/src/modules/outils/common/components/Agreement/RouteSelection/ShowAlert.tsx
+++ /dev/null
@@ -1,44 +0,0 @@
-import { Alert, Paragraph, theme } from "@socialgouv/cdtn-ui";
-import React from "react";
-import styled from "styled-components";
-
-import { AgreementRoute } from "../../type/WizardType";
-
-type ShowAlertProps = {
- route: AgreementRoute;
-};
-
-const ShowAlert = ({ route }: ShowAlertProps): JSX.Element => {
- return (
- <>
- {route === "not-selected" && (
-
-
- Attention
-
-
- Vous pouvez passer cette étape et poursuivre la simulation qui vous
- fournira un résultat basé sur le code du travail. Nous vous
- recommandons de renseigner votre convention collective qui peut
- prévoir un résultat plus favorable que celui défini par le code du
- travail.
-
-
- )}
- >
- );
-};
-
-const { spacings } = theme;
-
-const StyledAlert = styled(Alert)`
- margin-top: ${spacings.medium};
- width: 100%;
-`;
-
-export default ShowAlert;
diff --git a/packages/code-du-travail-frontend/src/modules/outils/common/components/Agreement/RouteSelection/index.ts b/packages/code-du-travail-frontend/src/modules/outils/common/components/Agreement/RouteSelection/index.ts
deleted file mode 100644
index b72d753b83..0000000000
--- a/packages/code-du-travail-frontend/src/modules/outils/common/components/Agreement/RouteSelection/index.ts
+++ /dev/null
@@ -1,3 +0,0 @@
-import RouteSelection from "./RouteSelection";
-
-export { RouteSelection };
diff --git a/packages/code-du-travail-frontend/src/modules/outils/common/components/Agreement/SelectAgreement.tsx b/packages/code-du-travail-frontend/src/modules/outils/common/components/Agreement/SelectAgreement.tsx
deleted file mode 100644
index b6f83b31c1..0000000000
--- a/packages/code-du-travail-frontend/src/modules/outils/common/components/Agreement/SelectAgreement.tsx
+++ /dev/null
@@ -1,173 +0,0 @@
-import { FormApi } from "final-form";
-import React, { useCallback, useEffect, useState } from "react";
-
-import { Enterprise } from "../../../conventions/Search/api/enterprises.service";
-import { useLocalStorageForAgreement } from "../../../lib/useLocalStorage";
-import { OnUserAction } from "../../ConventionCollective/types";
-import { AgreementRoute, FormContent } from "../type/WizardType";
-import { AgreementSearch } from "./AgreementSearch";
-import { EnterpriseSearch } from "./EnterpriseSearch";
-import { AGREEMENT_NAME, ENTERPRISE_NAME, ROUTE_NAME } from "./form-constants";
-import { RouteSelection } from "./RouteSelection";
-import { handleTrackEvent } from "./tracking";
-import { AgreementSupportInfo, OnSelectAgreementFn } from "./types";
-import { SmallText } from "../stepStyles";
-import { ErrorField } from "../ErrorField";
-import { getCc3239Informations } from "../../publicodes/api";
-import { Agreement } from "../../../outils/types";
-import { Simulator } from "../NoticeExample";
-import { NoEnterprise } from "../../Components/Agreements";
-
-export type Props = {
- title: string;
- form: FormApi;
- supportedAgreements: AgreementSupportInfo[];
- onChange?: (oldValue: Agreement | null, newValue: Agreement | null) => void;
- defaultSelectedAgreement?: Agreement;
- required?: boolean;
- note?: string;
- alertAgreementNotSupported?: (string) => JSX.Element;
- simulator: Simulator;
-};
-
-const SelectAgreement = ({
- title,
- form,
- supportedAgreements,
- onChange,
- defaultSelectedAgreement,
- required = false,
- note,
- alertAgreementNotSupported,
- simulator,
-}: Props): JSX.Element => {
- const [storedConvention, setConvention] = useLocalStorageForAgreement(
- defaultSelectedAgreement
- );
- const [hasSelectedEnterprise, setHasSelectedEnterprise] = useState(false);
- const [enterprise, setEnterprise] = useState(
- form.getState().values.ccn?.enterprise
- );
-
- const onSelectAgreement = useCallback(
- (agreement, enterprise) => {
- const oldData = storedConvention;
- setConvention(agreement);
- setEnterprise(enterprise);
- if (oldData !== agreement && onChange) {
- onChange(storedConvention, agreement);
- }
- },
- [storedConvention, setConvention, onChange]
- );
-
- const onUserAction: OnUserAction = (action, extra) => {
- handleTrackEvent(title, action, extra);
- };
-
- useEffect(() => {
- form.batch(() => {
- form.change(AGREEMENT_NAME, storedConvention);
- form.change(ENTERPRISE_NAME, enterprise);
- if (
- storedConvention != null &&
- form.getState().values.ccn?.route === undefined
- ) {
- form.change(ROUTE_NAME, "agreement" as AgreementRoute);
- }
- });
- // eslint-disable-next-line
- }, [storedConvention, enterprise]);
-
- const values = form.getState().values;
- const onRouteChange = (route: AgreementRoute) => {
- switch (route) {
- case "not-selected": {
- setConvention(undefined);
- setEnterprise(undefined);
- break;
- }
- case "agreement": {
- setEnterprise(undefined);
- break;
- }
- case "enterprise": {
- setConvention(undefined);
- break;
- }
- }
- initNoEnterprise();
- };
-
- const initNoEnterprise = () => {
- if (values.hasNoEnterpriseSelected) {
- onSelectAgreement(null);
- }
- form.change("hasNoEnterpriseSelected", undefined);
- };
-
- return (
- <>
-
- {note && {note} }
- {values.ccn?.route === "agreement" && (
-
- )}
- {values.ccn?.route === "enterprise" && (
- <>
- {
- setHasSelectedEnterprise(hasSelectedEnterprise);
- }}
- simulator={simulator}
- />
- {!hasSelectedEnterprise && !enterprise && (
- {
- form.change(
- "hasNoEnterpriseSelected",
- !values.hasNoEnterpriseSelected
- );
- }}
- onCheckboxChange={async (isCheckboxChecked) => {
- const cc3239 = await getCc3239Informations();
- onSelectAgreement(isCheckboxChecked ? cc3239 : null);
- }}
- />
- )}
- >
- )}
-
-
- >
- );
-};
-
-export default SelectAgreement;
diff --git a/packages/code-du-travail-frontend/src/modules/outils/common/components/Agreement/__tests__/AgreementSearch.test.tsx b/packages/code-du-travail-frontend/src/modules/outils/common/components/Agreement/__tests__/AgreementSearch.test.tsx
deleted file mode 100644
index 0265a165fe..0000000000
--- a/packages/code-du-travail-frontend/src/modules/outils/common/components/Agreement/__tests__/AgreementSearch.test.tsx
+++ /dev/null
@@ -1,243 +0,0 @@
-import { render } from "@testing-library/react";
-import React from "react";
-
-import { EmbeddedForm } from "../../../../../test/TestForm";
-import { Agreement } from "../../../../outils/types";
-import { AgreementSearch } from "../AgreementSearch";
-import type { Props } from "../AgreementSearch/AgreementSearch";
-import { SupportedTypes } from "@socialgouv/modeles-social";
-
-const callback: (agreement: Agreement | null) => void = () => {
- /* nothing to do */
-};
-const onSelectAgreement = jest.fn(callback);
-
-const onUserAction = () => {
- /* stub */
-};
-
-const selectedAgreement: Agreement = {
- id: "KALICONT000044594539",
- url: "hello.com",
- num: 3239,
- shortTitle: "Particuliers employeurs et emploi à domicile",
- slug: "3239-particuliers-employeurs-et-emploi-a-domicile",
- title: "Particuliers employeurs et emploi à domicile",
- contributions: false,
-};
-
-const dataWithoutSelectedAgreement: Props = {
- onSelectAgreement,
- onUserAction,
- supportedAgreements: [],
-};
-
-const dataWithSelectedAgreement: Props = {
- ...dataWithoutSelectedAgreement,
- selectedAgreement,
-};
-
-const dataWithSelectedAgreementNotSupported: Props = {
- ...dataWithoutSelectedAgreement,
- selectedAgreement,
- supportedAgreements: [],
-};
-const dataWithSelectedAgreementNotSupportedWithCustomText: Props = {
- ...dataWithoutSelectedAgreement,
- selectedAgreement,
- supportedAgreements: [],
- alertAgreementNotSupported: (url: string) => (
- This is my custom text with the url: {url}
- ),
-};
-
-const dataWithSelectedAgreementNotFullySupported: Props = {
- ...dataWithoutSelectedAgreement,
- selectedAgreement,
- supportedAgreements: [
- {
- fullySupported: SupportedTypes.SOON_SUPPORTED,
- idcc: selectedAgreement.num,
- },
- ],
-};
-
-const dataWithSelectedAgreementSupported: Props = {
- ...dataWithoutSelectedAgreement,
- selectedAgreement,
- supportedAgreements: [
- {
- fullySupported: SupportedTypes.FULLY_SUPPORTED,
- idcc: selectedAgreement.num,
- },
- ],
-};
-
-describe("AgreementSearch", () => {
- describe("no selected agreement", () => {
- it("should render the mandatory question 'Précisez et sélectionnez votre convention collective'", () => {
- const { getByText } = render(
-
- Step={AgreementSearch}
- props={dataWithoutSelectedAgreement}
- />
- );
- expect(
- getByText(/Précisez et sélectionnez votre convention collective/)
- ).toBeInTheDocument();
- expect(getByText("(champ obligatoire)")).toBeInTheDocument();
- });
-
- it("should show an input to search the agreement", () => {
- const { getByPlaceholderText } = render(
-
- Step={AgreementSearch}
- props={dataWithoutSelectedAgreement}
- />
- );
- expect(
- getByPlaceholderText("Ex : Transports routiers ou 1486")
- ).toBeInTheDocument();
- });
-
- it("should show an error when submit without select an agreement", () => {
- const { getByText } = render(
-
- Step={AgreementSearch}
- props={dataWithoutSelectedAgreement}
- />
- );
- getByText("Submit").click();
- expect(
- getByText(/Vous devez sélectionner une convention collective/)
- ).toBeDefined();
- });
- });
-
- describe("selected agreement", () => {
- it("should render the text 'Vous avez sélectionné la convention collective'", () => {
- const { getByText } = render(
-
- Step={AgreementSearch}
- props={dataWithSelectedAgreement}
- />
- );
- expect(
- getByText(/Vous avez sélectionné la convention collective/)
- ).toBeInTheDocument();
- });
-
- it("should show the agreement short title", () => {
- const { getByText } = render(
-
- Step={AgreementSearch}
- props={dataWithSelectedAgreement}
- />
- );
- expect(getByText(selectedAgreement.shortTitle)).toBeInTheDocument();
- });
-
- it("should show a button to remove the selection", () => {
- const { getByRole } = render(
-
- Step={AgreementSearch}
- props={dataWithSelectedAgreement}
- />
- );
- const button = getByRole("button", { name: "Fermer" });
- expect(button).toBeInTheDocument();
- });
-
- it("should invite the user to click on next to continue the simulation", () => {
- const { getByText } = render(
-
- Step={AgreementSearch}
- props={dataWithSelectedAgreement}
- />
- );
- expect(
- getByText("Cliquez sur Suivant pour poursuivre la simulation.")
- ).toBeInTheDocument();
- });
-
- it("should not show an error when submit", () => {
- const { getByText, queryByText } = render(
-
- Step={AgreementSearch}
- props={dataWithSelectedAgreement}
- />
- );
- getByText("Submit").click();
- expect(
- queryByText(/Vous devez répondre à cette question/)
- ).not.toBeInTheDocument();
- });
-
- it("should callback when user remove the selected agreement", () => {
- const { getByRole } = render(
-
- Step={AgreementSearch}
- props={dataWithSelectedAgreement}
- />
- );
- const button = getByRole("button", { name: "Fermer" });
- button.click();
- expect(onSelectAgreement.mock.calls).toHaveLength(1);
- expect(onSelectAgreement.mock.calls[0][0]).toBeNull();
- });
- });
-
- describe("selected agreement not supported / not fully supported", () => {
- it("should render a warning about the not supported agreement", () => {
- const { getByText } = render(
-
- Step={AgreementSearch}
- props={dataWithSelectedAgreementNotSupported}
- />
- );
- expect(
- getByText(/Convention collective non traitée/)
- ).toBeInTheDocument();
- });
- it("should render the alert with custom content provided", () => {
- const { getByText } = render(
-
- Step={AgreementSearch}
- props={dataWithSelectedAgreementNotSupportedWithCustomText}
- />
- );
- expect(
- getByText(/This is my custom text with the url: hello.com/)
- ).toBeInTheDocument();
- });
- });
-
- describe("selected agreement not fully supported", () => {
- it("should render a warning about the not fully supported agreement", () => {
- const { getByText } = render(
-
- Step={AgreementSearch}
- props={dataWithSelectedAgreementNotFullySupported}
- />
- );
- expect(getByText(/Convention prochainement traitée/)).toBeInTheDocument();
- });
- });
-
- describe("selected agreement supported", () => {
- it("should not render a warning", () => {
- const { queryByText } = render(
-
- Step={AgreementSearch}
- props={dataWithSelectedAgreementSupported}
- />
- );
- expect(
- queryByText(/Convention collective non traitée/)
- ).not.toBeInTheDocument();
- expect(
- queryByText(/Convention prochainement traitée/)
- ).not.toBeInTheDocument();
- });
- });
-});
diff --git a/packages/code-du-travail-frontend/src/modules/outils/common/components/Agreement/__tests__/EnterpriseSearch.test.tsx b/packages/code-du-travail-frontend/src/modules/outils/common/components/Agreement/__tests__/EnterpriseSearch.test.tsx
deleted file mode 100644
index 312bf43e31..0000000000
--- a/packages/code-du-travail-frontend/src/modules/outils/common/components/Agreement/__tests__/EnterpriseSearch.test.tsx
+++ /dev/null
@@ -1,395 +0,0 @@
-import { render } from "@testing-library/react";
-import React from "react";
-
-import { EmbeddedForm } from "../../../../../test/TestForm";
-import { Enterprise } from "../../../../conventions/Search/api/enterprises.service";
-import { Agreement } from "../../../../outils/types";
-import type { Props } from "../EnterpriseSearch/EnterpriseSearch";
-import EnterpriseSearch from "../EnterpriseSearch/EnterpriseSearch";
-import { EnterpriseAgreement } from "../../../../api/modules/enterprises/types";
-import { Simulator } from "../../NoticeExample";
-import { SupportedTypes } from "@socialgouv/modeles-social";
-
-const callback: (
- agreement: Agreement | null,
- enterprise?: Enterprise
-) => void = () => {
- /* nothing to do */
-};
-const onSelectAgreement = jest.fn(callback);
-const onUserAction = () => {
- /* dummy */
-};
-
-const agreement1: EnterpriseAgreement = {
- id: "KALICONT000005635093",
- url: "hello.com",
- num: 2156,
- shortTitle: "Grands magasins et magasins populaires",
- slug: "2156-grands-magasins-et-magasins-populaires",
- title:
- "Convention collective nationale des grand magasins et des magasins populaires du 30 juin 2000. Etendue par arrêté du 20 décembre 2001 JORF 19 janvier 2002.",
- contributions: true,
-};
-
-const agreement2: EnterpriseAgreement = {
- id: "KALICONT000005635085",
- num: 2216,
- shortTitle: "Commerce de détail et de gros à prédominance alimentaire",
- slug: "2216-commerce-de-detail-et-de-gros-a-predominance-alimentaire",
- title:
- "Convention collective nationale du commerce de détail et de gros à prédominance alimentaire du 12 juillet 2001. Etendue par arrêté du 26 juillet 2002 JORF 6 août 2002.",
- contributions: false,
-};
-
-const selectedEnterpriseOneAgreement: Enterprise = {
- activitePrincipale:
- "Commerce de détail en magasin non spécialisé à prédominance alimentaire",
- conventions: [agreement1],
- etablissements: 335,
- highlightLabel: "MONOPRIX EXPLOITATION, PAR ABREVIATION MPX",
- label: "MONOPRIX EXPLOITATION, PAR ABREVIATION MPX",
- matching: 272,
- simpleLabel: "MONOPRIX EXPLOITATION",
- siren: "552083297",
-};
-
-const selectedEnterpriseTwoAgreements: Enterprise = {
- activitePrincipale:
- "Commerce de détail en magasin non spécialisé à prédominance alimentaire",
- conventions: [agreement1, agreement2],
- etablissements: 335,
- highlightLabel: "MONOPRIX EXPLOITATION, PAR ABREVIATION MPX",
- label: "MONOPRIX EXPLOITATION, PAR ABREVIATION MPX",
- matching: 272,
- simpleLabel: "MONOPRIX EXPLOITATION",
- siren: "552083297",
-};
-
-describe("EnterpriseSearch", () => {
- describe("no selected enterprise", () => {
- const dataWithoutSelectedEnterprise: Props = {
- onSelectAgreement,
- onUserAction,
- supportedAgreements: [],
- simulator: Simulator.HEURES_RECHERCHE_EMPLOI,
- };
-
- it("should render the mandatory question 'Nom de votre entreprise ou numéro Siren/Siret' and not mandatory 'Code postal ou ville'", () => {
- const { getByText } = render(
-
- Step={EnterpriseSearch}
- props={dataWithoutSelectedEnterprise}
- />
- );
- expect(
- getByText(/Nom de votre entreprise ou numéro Siren\/Siret/)
- ).toBeInTheDocument();
- expect(getByText(/Code postal ou ville/)).toBeInTheDocument();
- expect(getByText(/\(facultatif\)/)).toBeInTheDocument();
- });
-
- it("should show inputs to search the enterprise", () => {
- const { getByPlaceholderText } = render(
-
- Step={EnterpriseSearch}
- props={dataWithoutSelectedEnterprise}
- />
- );
- expect(
- getByPlaceholderText("Ex : Café de la gare ou 40123778000127")
- ).toBeInTheDocument();
- expect(
- getByPlaceholderText("Ex : 31000 ou Toulouse")
- ).toBeInTheDocument();
- });
-
- it("should show an error when submit", () => {
- const { getByText, queryByText } = render(
-
- Step={EnterpriseSearch}
- props={dataWithoutSelectedEnterprise}
- />
- );
- getByText("Submit").click();
- expect(
- queryByText(/Vous devez sélectionner une entreprise/)
- ).toBeInTheDocument();
- });
- });
-
- describe("selected enterprise with one agreement", () => {
- const dataWithSelectedEnterpriseWithOneAgreement: Props = {
- onSelectAgreement,
- onUserAction,
- selectedEnterprise: selectedEnterpriseOneAgreement,
- supportedAgreements: [],
- simulator: Simulator.HEURES_RECHERCHE_EMPLOI,
- };
-
- it("should show the default agreement", () => {
- const { getByText } = render(
-
- Step={EnterpriseSearch}
- props={dataWithSelectedEnterpriseWithOneAgreement}
- />
- );
- expect(
- getByText(
- /Une convention collective a été trouvée pour cette entreprise/
- )
- ).toBeInTheDocument();
- expect(getByText(new RegExp(agreement1.shortTitle))).toBeInTheDocument();
- });
-
- it("should show the enterprise title", () => {
- const { getByText } = render(
-
- Step={EnterpriseSearch}
- props={dataWithSelectedEnterpriseWithOneAgreement}
- />
- );
- expect(
- getByText(new RegExp(selectedEnterpriseOneAgreement.simpleLabel))
- ).toBeInTheDocument();
- });
-
- it("should show a button to remove the selection", () => {
- const { getByRole } = render(
-
- Step={EnterpriseSearch}
- props={dataWithSelectedEnterpriseWithOneAgreement}
- />
- );
- const button = getByRole("button", { name: "Fermer" });
- expect(button).toBeInTheDocument();
- });
-
- it("should invite the user to click on next to continue the simulation", () => {
- const { getByText } = render(
-
- Step={EnterpriseSearch}
- props={dataWithSelectedEnterpriseWithOneAgreement}
- />
- );
- expect(
- getByText("Cliquez sur Suivant pour poursuivre la simulation.")
- ).toBeInTheDocument();
- });
-
- it("should not show an error when submit", () => {
- const { getByText, queryByText } = render(
-
- Step={EnterpriseSearch}
- props={dataWithSelectedEnterpriseWithOneAgreement}
- />
- );
- getByText("Submit").click();
- expect(
- queryByText(/Vous devez répondre à cette question/)
- ).not.toBeInTheDocument();
- });
-
- it("should callback when user remove the selected enterprise", () => {
- onSelectAgreement.mockClear();
- const { getByRole } = render(
-
- Step={EnterpriseSearch}
- props={dataWithSelectedEnterpriseWithOneAgreement}
- />
- );
- const button = getByRole("button", { name: "Fermer" });
- button.click();
- expect(onSelectAgreement.mock.calls).toHaveLength(1);
- expect(onSelectAgreement.mock.calls[0][0]).toBeNull();
- });
- });
-
- describe("selected enterprise with two agreements", () => {
- const dataWithSelectedEnterpriseWithTwoAgreements: Props = {
- onSelectAgreement,
- onUserAction,
- selectedEnterprise: selectedEnterpriseTwoAgreements,
- supportedAgreements: [],
- simulator: Simulator.HEURES_RECHERCHE_EMPLOI,
- };
- it("should show the agreements selection", () => {
- const { getByText, queryByText } = render(
-
- Step={EnterpriseSearch}
- props={dataWithSelectedEnterpriseWithTwoAgreements}
- />
- );
- expect(
- getByText(
- /2 conventions collectives ont été trouvées pour cette entreprise, sélectionnez la vôtre/
- )
- ).toBeInTheDocument();
- expect(getByText(new RegExp(agreement1.shortTitle))).toBeInTheDocument();
- expect(getByText(new RegExp(agreement2.shortTitle))).toBeInTheDocument();
- expect(
- queryByText(/Cliquez sur Suivant pour poursuivre la simulation/)
- ).not.toBeInTheDocument();
- });
-
- it("should show the enterprise title", () => {
- const { getByText } = render(
-
- Step={EnterpriseSearch}
- props={dataWithSelectedEnterpriseWithTwoAgreements}
- />
- );
- expect(
- getByText(new RegExp(selectedEnterpriseOneAgreement.simpleLabel))
- ).toBeInTheDocument();
- });
-
- it("should show a button to remove the selection", () => {
- const { getByRole } = render(
-
- Step={EnterpriseSearch}
- props={dataWithSelectedEnterpriseWithTwoAgreements}
- />
- );
- const button = getByRole("button", { name: "Fermer" });
- expect(button).toBeInTheDocument();
- });
-
- it("should show an error when submit", () => {
- const { getByText, queryByText } = render(
-
- Step={EnterpriseSearch}
- props={dataWithSelectedEnterpriseWithTwoAgreements}
- />
- );
- getByText("Submit").click();
- expect(
- queryByText(/Vous devez répondre à cette question/)
- ).toBeInTheDocument();
- });
-
- it("should callback when user remove the selected enterprise", () => {
- onSelectAgreement.mockClear();
- const { getByRole } = render(
-
- Step={EnterpriseSearch}
- props={dataWithSelectedEnterpriseWithTwoAgreements}
- />
- );
- const button = getByRole("button", { name: "Fermer" });
- button.click();
- expect(onSelectAgreement.mock.calls).toHaveLength(1);
- expect(onSelectAgreement.mock.calls[0][0]).toBeNull();
- });
-
- it("should show the message to continue the simulation when select the agreement", () => {
- const { getByText, queryByText } = render(
-
- Step={EnterpriseSearch}
- props={dataWithSelectedEnterpriseWithTwoAgreements}
- />
- );
- getByText(/Grands magasins et magasins populaires/).click();
- expect(
- queryByText(/Cliquez sur Suivant pour poursuivre la simulation/)
- ).toBeInTheDocument();
- });
- });
-
- describe("selected agreement not supported / not fully supported", () => {
- it("should render a warning about the not supported agreement", () => {
- const data: Props = {
- onSelectAgreement,
- onUserAction,
- selectedEnterprise: selectedEnterpriseOneAgreement,
- supportedAgreements: [],
- simulator: Simulator.HEURES_RECHERCHE_EMPLOI,
- };
- const { getByText } = render(
- Step={EnterpriseSearch} props={data} />
- );
- expect(
- getByText(/Convention collective non traitée/)
- ).toBeInTheDocument();
- });
-
- it("should render a warning about the not supported agreement (multiple agreements)", () => {
- const data: Props = {
- onSelectAgreement,
- onUserAction,
- selectedEnterprise: selectedEnterpriseTwoAgreements,
- supportedAgreements: [],
- simulator: Simulator.HEURES_RECHERCHE_EMPLOI,
- };
- const { getByText } = render(
- Step={EnterpriseSearch} props={data} />
- );
- getByText(/Grands magasins et magasins populaires/).click();
- expect(
- getByText(/Convention collective non traitée/)
- ).toBeInTheDocument();
- });
-
- it("should not render a warning about the supported agreement", () => {
- const data: Props = {
- onSelectAgreement,
- onUserAction,
- selectedEnterprise: selectedEnterpriseOneAgreement,
- supportedAgreements: [
- {
- fullySupported: SupportedTypes.FULLY_SUPPORTED,
- idcc: selectedEnterpriseOneAgreement.conventions[0].num,
- },
- ],
- simulator: Simulator.HEURES_RECHERCHE_EMPLOI,
- };
- const { queryByText } = render(
- Step={EnterpriseSearch} props={data} />
- );
- expect(
- queryByText(/Convention collective non traitée/)
- ).not.toBeInTheDocument();
- });
-
- it("should not render a warning when agreement is supported (multiple agreements)", () => {
- const data: Props = {
- onSelectAgreement,
- onUserAction,
- selectedEnterprise: selectedEnterpriseTwoAgreements,
- supportedAgreements: [
- {
- fullySupported: SupportedTypes.FULLY_SUPPORTED,
- idcc: selectedEnterpriseTwoAgreements.conventions[0].num,
- },
- ],
- simulator: Simulator.HEURES_RECHERCHE_EMPLOI,
- };
- const { getByText, queryByText } = render(
- Step={EnterpriseSearch} props={data} />
- );
- getByText(/Grands magasins et magasins populaires/).click();
- expect(
- queryByText(/Convention collective non traitée/)
- ).not.toBeInTheDocument();
- });
-
- it("should render the alert with custom content provided", () => {
- const data: Props = {
- onSelectAgreement,
- onUserAction,
- selectedEnterprise: selectedEnterpriseOneAgreement,
- supportedAgreements: [],
- alertAgreementNotSupported: (agreementUrl: string) => (
- This is my custom text with the url: {agreementUrl}
- ),
- simulator: Simulator.HEURES_RECHERCHE_EMPLOI,
- };
- const { getByText } = render(
- Step={EnterpriseSearch} props={data} />
- );
- expect(
- getByText(/This is my custom text with the url: hello.com/)
- ).toBeInTheDocument();
- });
- });
-});
diff --git a/packages/code-du-travail-frontend/src/modules/outils/common/components/Agreement/__tests__/RouteSelection.test.tsx b/packages/code-du-travail-frontend/src/modules/outils/common/components/Agreement/__tests__/RouteSelection.test.tsx
deleted file mode 100644
index 3e01f2f376..0000000000
--- a/packages/code-du-travail-frontend/src/modules/outils/common/components/Agreement/__tests__/RouteSelection.test.tsx
+++ /dev/null
@@ -1,145 +0,0 @@
-import { render } from "@testing-library/react";
-import React from "react";
-
-import { EmbeddedInjectedForm } from "../../../../../test/TestForm";
-import { RouteSelection } from "../RouteSelection";
-
-describe("RouteSelection: Skip the agreement selection", () => {
- describe("without data in form", () => {
- it("should render the mandatory question 'Je ne souhaite pas renseigner ma convention collective.'", () => {
- const { getByText } = render(
-
- );
- expect(
- getByText(/Je ne souhaite pas renseigner ma convention collective/)
- ).toBeInTheDocument();
- expect(getByText("(obligatoire)")).toBeInTheDocument();
- });
-
- it("should show all routes", () => {
- const { getByText } = render(
-
- );
- expect(
- getByText(/Je sais quelle est ma convention collective/)
- ).toBeInTheDocument();
- expect(
- getByText(/Je ne sais pas quelle est ma convention collective/)
- ).toBeInTheDocument();
- expect(
- getByText(/Je ne souhaite pas renseigner ma convention collective/)
- ).toBeInTheDocument();
- });
-
- it("should show an alert when submit without select an option", () => {
- const { getByText } = render(
-
- );
- getByText("Submit").click();
- expect(getByText(/Vous devez répondre à cette question/)).toBeDefined();
- });
-
- it("should show an alert when select to skip the agreement selection", () => {
- const { getByText } = render(
- {},
- }}
- />
- );
- getByText(
- /Je ne souhaite pas renseigner ma convention collective/
- ).click();
-
- expect(
- getByText(
- /Vous pouvez passer cette étape et poursuivre la simulation qui vous fournira un résultat basé sur le code du travail./
- )
- ).toBeInTheDocument();
- });
-
- it("should not show an alert when select to search the agreement selection", () => {
- const { getByText, queryByText } = render(
- {},
- }}
- />
- );
- getByText(/Je sais quelle est ma convention collective/).click();
-
- expect(queryByText(/À noter/)).not.toBeInTheDocument();
- });
-
- it("should not show an alert when select i don't know my agreement", () => {
- const { getByText, queryByText } = render(
- {},
- }}
- />
- );
- getByText(/Je ne sais pas quelle est ma convention collective/).click();
-
- expect(queryByText(/À noter/)).not.toBeInTheDocument();
- });
- });
-
- describe("with data in form (come back on the step)", () => {
- it("should show an alert when skip the agreement selection selected", () => {
- const { getByText, getByRole } = render(
-
- );
-
- expect(
- getByRole("radio", {
- checked: true,
- name: /Je ne souhaite pas renseigner ma convention collective/,
- })
- ).toBeInTheDocument();
- expect(
- getByText(
- /Vous pouvez passer cette étape et poursuivre la simulation qui vous fournira un résultat basé sur le code du travail./
- )
- ).toBeInTheDocument();
- });
- });
-
- it("should not show an alert when search the agreement selected", () => {
- const { queryByText, getByRole } = render(
-
- );
-
- expect(
- getByRole("radio", {
- checked: true,
- name: /Je sais quelle est ma convention collective/,
- })
- ).toBeInTheDocument();
- expect(queryByText(/À noter/)).not.toBeInTheDocument();
- });
-
- it("should not show the skip option", () => {
- const { queryByText, getAllByRole } = render(
-
- );
-
- expect(getAllByRole("radio")).toHaveLength(2);
- expect(
- queryByText(/Je ne souhaite pas renseigner/)
- ).not.toBeInTheDocument();
- });
-});
diff --git a/packages/code-du-travail-frontend/src/modules/outils/common/components/Agreement/__tests__/SelectAgreement.test.tsx b/packages/code-du-travail-frontend/src/modules/outils/common/components/Agreement/__tests__/SelectAgreement.test.tsx
deleted file mode 100644
index 3d4fa008a2..0000000000
--- a/packages/code-du-travail-frontend/src/modules/outils/common/components/Agreement/__tests__/SelectAgreement.test.tsx
+++ /dev/null
@@ -1,108 +0,0 @@
-import { render } from "@testing-library/react";
-import React from "react";
-
-import { EmbeddedInjectedForm } from "../../../../../test/TestForm";
-import { Agreement } from "../../../../outils/types";
-import { FormContent } from "../../type/WizardType";
-import { SelectAgreement } from "../index";
-import type { Props } from "../SelectAgreement";
-import { Simulator } from "../../NoticeExample";
-
-const selectedAgreement: Agreement = {
- id: "KALICONT000044594539",
- num: 3239,
- shortTitle: "Particuliers employeurs et emploi à domicile",
- slug: "3239-particuliers-employeurs-et-emploi-a-domicile",
- title: "Particuliers employeurs et emploi à domicile",
- contributions: false,
-};
-
-describe("SelectAgreement", () => {
- describe("no preselected agreement (in local storage)", () => {
- it("should render the form without prechecked option", () => {
- const { getByRole } = render(
- >
- Step={SelectAgreement}
- props={{
- supportedAgreements: [],
- title: "Outil",
- simulator: Simulator.HEURES_RECHERCHE_EMPLOI,
- }}
- />
- );
- expect(
- getByRole("radio", {
- checked: false,
- name: /Je ne souhaite pas renseigner ma convention collective/,
- })
- ).toBeInTheDocument();
- expect(
- getByRole("radio", {
- checked: false,
- name: /Je sais quelle est ma convention collective/,
- })
- ).toBeInTheDocument();
- expect(
- getByRole("radio", {
- checked: false,
- name: /Je ne sais pas quelle est ma convention collective/,
- })
- ).toBeInTheDocument();
- });
- it("should not show skip option & show message if passed in param", () => {
- const { getByRole, getByText, queryByText } = render(
- >
- Step={SelectAgreement}
- props={{
- supportedAgreements: [],
- title: "Outil",
- required: true,
- note: "This is my note",
- simulator: Simulator.HEURES_RECHERCHE_EMPLOI,
- }}
- />
- );
- expect(
- queryByText(/Je ne souhaite pas renseigner ma convention collective/)
- ).not.toBeInTheDocument();
- expect(
- getByRole("radio", {
- checked: false,
- name: /Je sais quelle est ma convention collective/,
- })
- ).toBeInTheDocument();
- expect(
- getByRole("radio", {
- checked: false,
- name: /Je ne sais pas quelle est ma convention collective/,
- })
- ).toBeInTheDocument();
- expect(getByText(/This is my note/)).toBeInTheDocument();
- });
- });
-
- describe("preselected agreement (in local storage)", () => {
- it("should render the route 'Je connais ma convention collective' by default with the selected agreements", () => {
- const { getByText, getByRole } = render(
- >
- Step={SelectAgreement}
- props={{
- defaultSelectedAgreement: selectedAgreement,
- supportedAgreements: [],
- title: "Outil",
- simulator: Simulator.HEURES_RECHERCHE_EMPLOI,
- }}
- />
- );
- expect(
- getByRole("radio", {
- checked: true,
- name: /Je sais quelle est ma convention collective/,
- })
- ).toBeInTheDocument();
- expect(
- getByText(/Particuliers employeurs et emploi à domicile/)
- ).toBeInTheDocument();
- });
- });
-});
diff --git a/packages/code-du-travail-frontend/src/modules/outils/common/components/Agreement/components/Modal.tsx b/packages/code-du-travail-frontend/src/modules/outils/common/components/Agreement/components/Modal.tsx
deleted file mode 100644
index c370846ddd..0000000000
--- a/packages/code-du-travail-frontend/src/modules/outils/common/components/Agreement/components/Modal.tsx
+++ /dev/null
@@ -1,32 +0,0 @@
-import { Modal } from "@socialgouv/cdtn-ui";
-import React, { useState } from "react";
-
-type Props = {
- title: string;
- renderButton: (openModel: () => void) => JSX.Element;
- children: React.ReactNode;
-};
-
-export function HelpModal({
- title,
- renderButton,
- children,
-}: Props): JSX.Element {
- const [isModalOpen, setModalOpen] = useState(false);
- const openModal = () => {
- setModalOpen(true);
- };
-
- const closeModal = () => {
- setModalOpen(false);
- };
-
- return (
- <>
- {renderButton(openModal)}
-
- {children}
-
- >
- );
-}
diff --git a/packages/code-du-travail-frontend/src/modules/outils/common/components/Agreement/components/ResultList.tsx b/packages/code-du-travail-frontend/src/modules/outils/common/components/Agreement/components/ResultList.tsx
deleted file mode 100644
index 43a339b696..0000000000
--- a/packages/code-du-travail-frontend/src/modules/outils/common/components/Agreement/components/ResultList.tsx
+++ /dev/null
@@ -1,88 +0,0 @@
-import { Button, theme, ViewMore, Wrapper } from "@socialgouv/cdtn-ui";
-import React, { ReactNode } from "react";
-import styled from "styled-components";
-
-type Props = {
- query: string;
- children: ReactNode;
-};
-
-export function ResultList({ query, children }: Props): JSX.Element {
- const viewMoreButton = (onClick) => (
-
- Voir plus
-
- );
-
- return (
-
-
- {children}
-
-
- );
-}
-
-export const ListItem = (props: any) => {
- return (
-
- {props.children}
-
- );
-};
-
-const Li = styled.li`
- margin-left: 0;
-
- & + &::before {
- content: "";
- display: block;
- margin: 0 ${theme.spacings.xmedium};
- border-top: 1px solid ${({ theme }) => theme.border};
- }
-`;
-
-const WrapperNoPadding = styled(Wrapper)`
- padding: 0;
-`;
-
-const ViewMoreButton = styled(Button)`
- margin-top: ${theme.spacings.base};
- margin-bottom: ${theme.spacings.base};
- @media (max-width: ${theme.breakpoints.mobile}) {
- flex: 1 0 auto;
- }
-`;
-
-export const ResultItem = styled.button.attrs({
- type: "button",
-})`
- display: block;
- appearance: none;
- width: 100%;
- background-color: transparent;
- font-weight: 500;
- border: none;
- font-size: ${theme.fonts.sizes.default};
- padding: ${({ small }) =>
- small ? theme.spacings.xsmall : theme.spacings.medium}
- ${theme.spacings.xmedium};
- color: ${({ theme }) => theme.paragraph};
- text-align: left;
- text-decoration: none;
- cursor: pointer;
- position: relative;
-
- &:active,
- &:focus,
- &:hover,
- &[aria-selected="true"] {
- color: ${({ theme }) => theme.title};
- background-color: ${({ theme }) => theme.bgTertiary};
- }
-`;
diff --git a/packages/code-du-travail-frontend/src/modules/outils/common/components/Agreement/components/ShowAlert.tsx b/packages/code-du-travail-frontend/src/modules/outils/common/components/Agreement/components/ShowAlert.tsx
deleted file mode 100644
index 1902f911ac..0000000000
--- a/packages/code-du-travail-frontend/src/modules/outils/common/components/Agreement/components/ShowAlert.tsx
+++ /dev/null
@@ -1,117 +0,0 @@
-import { Alert, Paragraph, Text, theme } from "@socialgouv/cdtn-ui";
-import React from "react";
-
-import { AgreementSupportInfo } from "../types";
-import { Agreement } from "../../../types";
-import styled from "styled-components";
-import {
- PublicodesSimulator,
- SupportedTypes,
-} from "@socialgouv/modeles-social";
-
-type Props = {
- currentAgreement: Agreement;
- supportedAgreements: AgreementSupportInfo[];
- alertAgreementNotSupported?: (string) => JSX.Element;
- simulator?: PublicodesSimulator | "QUESTIONNAIRE";
-};
-
-const ShowAlert = ({
- currentAgreement,
- supportedAgreements,
- alertAgreementNotSupported,
- simulator = PublicodesSimulator.PREAVIS_RETRAITE,
-}: Props): JSX.Element => {
- const idccInfo = supportedAgreements.find(
- (item) => item.idcc == currentAgreement.num
- );
- if (!idccInfo || idccInfo.fullySupported === SupportedTypes.NEVER_SUPPORTED) {
- return (
- <>
-
- {simulator !== "QUESTIONNAIRE" && (
-
- Convention collective non traitée
-
- )}
- {alertAgreementNotSupported ? (
- alertAgreementNotSupported(currentAgreement.url)
- ) : (
- <>
-
- La convention collective sélectionnée n'est pas traitée par
- nos services.
-
-
- Vous pouvez tout de même poursuivre la simulation qui vous
- fournira un résultat basé sur le code du travail.
-
- >
- )}
-
- {!alertAgreementNotSupported && (
-
- Cliquez sur Suivant pour poursuivre la simulation.
-
- )}
- >
- );
- }
- if (idccInfo.fullySupported === SupportedTypes.SOON_SUPPORTED) {
- return (
- <>
-
-
- Convention prochainement traitée
-
-
- {simulator === PublicodesSimulator.PREAVIS_RETRAITE ? (
- <>
- Cette convention collective n'est pas encore traitée par
- nos services mais le sera très prochainement. Vous pouvez
- poursuivre la simulation pour connaître la durée prévue par le
- code du travail mais nous vous conseillons de vérifier si votre
- convention collective prévoit un délai plus favorable qui vous
- serait applicable.
- >
- ) : (
- <>
- Cette convention collective n'est pas encore traitée par
- nos services mais le sera très prochainement. Vous pouvez
- poursuivre la simulation pour connaître le montant prévu par le
- code du travail mais nous vous conseillons de vérifier si votre
- convention collective prévoit un montant plus favorable pour le
- salarié.
- >
- )}
-
-
-
- Cliquez sur Suivant pour poursuivre la simulation.
-
- >
- );
- }
-
- return simulator !== "QUESTIONNAIRE" ? (
-
- Cliquez sur Suivant pour poursuivre la simulation.
-
- ) : (
- <>>
- );
-};
-
-export default ShowAlert;
-
-const StyledAlert = styled(Alert)`
- margin-top: ${theme.spacings.small};
-`;
-const StyledParagraph = styled(Paragraph)`
- margin-top: ${theme.spacings.large};
-`;
diff --git a/packages/code-du-travail-frontend/src/modules/outils/common/components/Agreement/components/Suggester.ts b/packages/code-du-travail-frontend/src/modules/outils/common/components/Agreement/components/Suggester.ts
deleted file mode 100644
index a5879f0321..0000000000
--- a/packages/code-du-travail-frontend/src/modules/outils/common/components/Agreement/components/Suggester.ts
+++ /dev/null
@@ -1,118 +0,0 @@
-import { Reducer, useEffect, useReducer } from "react";
-import { SearchParams } from "../EnterpriseSearch/EntrepriseSearchInput/SearchEnterpriseInput";
-
-export enum Status {
- idle = "idle",
- loading = "loading",
- success = "success",
- error = "error",
-}
-
-export enum Actions {
- reset = "reset",
- init = "init",
- success = "success",
- failure = "failure",
-}
-
-export type FecthActions =
- | { type: Actions.init }
- | { type: Actions.reset }
- | { type: Actions.success; payload: A }
- | { type: Actions.failure; payload: Error };
-
-export type FetchReducerState = {
- isError: boolean;
- isLoading: boolean;
- data?: A;
- error?: Error;
-};
-
-const dataFetchReducer = (
- state: FetchReducerState ,
- action: FecthActions
-): FetchReducerState => {
- switch (action.type) {
- case Actions.init:
- return {
- isError: false,
- isLoading: true,
- };
- case Actions.reset:
- return {
- ...state,
- data: undefined,
- error: undefined,
- isError: false,
- isLoading: false,
- };
- case Actions.success:
- return {
- ...state,
- data: action.payload,
- isError: false,
- isLoading: false,
- };
- case Actions.failure:
- return {
- ...state,
- error: action.payload,
- isError: true,
- isLoading: false,
- };
- default:
- throw new Error(`Actions ${action["type"]} is not implemented`);
- }
-};
-
-type Fetcher = (searchParams: SearchParams) => Promise;
-
-/**
- * a factory function that return a suggesterHook that
- * use fetcher to return result
- * @param fetcher an async function that should receive only one argument
- * @param onResult callback when new results are found
- * @returns a hook function
- */
-export function createSuggesterHook(
- fetcher: Fetcher,
- onResult: (searchParams: SearchParams) => void
-) {
- return function (searchParams: SearchParams): FetchReducerState {
- const [state, dispatch] = useReducer<
- Reducer, FecthActions>
- >(dataFetchReducer, {
- isError: false,
- isLoading: false,
- });
- useEffect(() => {
- let shouldCancel = false;
-
- async function fetchData() {
- if (!searchParams.query) {
- dispatch({ type: Actions.reset });
- return;
- }
- dispatch({ type: Actions.init });
- try {
- const results = await fetcher(searchParams);
- if (shouldCancel) {
- return;
- }
-
- onResult(searchParams);
-
- dispatch({ payload: results, type: Actions.success });
- } catch (error) {
- dispatch({ payload: error, type: Actions.failure });
- }
- }
-
- fetchData();
- return () => {
- shouldCancel = true;
- };
- }, [JSON.stringify(searchParams)]);
- return state;
- };
-}
diff --git a/packages/code-du-travail-frontend/src/modules/outils/common/components/Agreement/form-constants.ts b/packages/code-du-travail-frontend/src/modules/outils/common/components/Agreement/form-constants.ts
deleted file mode 100644
index 46da50d2a5..0000000000
--- a/packages/code-du-travail-frontend/src/modules/outils/common/components/Agreement/form-constants.ts
+++ /dev/null
@@ -1,4 +0,0 @@
-export const ROUTE_NAME = "ccn.route";
-export const AGREEMENT_NAME = "ccn.selected";
-export const AGREEMENT_ID_NAME = "ccn.selected.id";
-export const ENTERPRISE_NAME = "ccn.enterprise";
diff --git a/packages/code-du-travail-frontend/src/modules/outils/common/components/Agreement/index.ts b/packages/code-du-travail-frontend/src/modules/outils/common/components/Agreement/index.ts
deleted file mode 100644
index ed063a6c05..0000000000
--- a/packages/code-du-travail-frontend/src/modules/outils/common/components/Agreement/index.ts
+++ /dev/null
@@ -1,4 +0,0 @@
-import SelectAgreement from "./SelectAgreement";
-import { pushAgreementEvents } from "./tracking";
-
-export { pushAgreementEvents, SelectAgreement };
diff --git a/packages/code-du-travail-frontend/src/modules/outils/common/components/Agreement/tracking/__tests__/handleTrackEvent.test.tsx b/packages/code-du-travail-frontend/src/modules/outils/common/components/Agreement/tracking/__tests__/handleTrackEvent.test.tsx
deleted file mode 100644
index eb95139308..0000000000
--- a/packages/code-du-travail-frontend/src/modules/outils/common/components/Agreement/tracking/__tests__/handleTrackEvent.test.tsx
+++ /dev/null
@@ -1,70 +0,0 @@
-import {
- MatomoBaseEvent,
- MatomoSearchAgreementCategory,
-} from "../../../../../lib";
-import { push as matopush } from "@socialgouv/matomo-next";
-import { UserAction } from "../../../../ConventionCollective/types";
-import { handleTrackEvent } from "../index";
-
-jest.mock("@socialgouv/matomo-next", () => ({
- push: jest.fn(),
-}));
-
-describe("Handle event on user action", () => {
- beforeEach(() => {
- const ma = matopush as jest.MockedFunction;
- ma.mockReset();
- });
-
- describe("user searching an enterprise", () => {
- it("should send a matomo event", () => {
- const pageTitle = "Préavis de retraite";
- const extra = {
- query: "company",
- };
- handleTrackEvent(pageTitle, UserAction.SearchEnterprise, extra);
- expect(matopush).toHaveBeenCalledTimes(1);
- expect(matopush).toHaveBeenCalledWith([
- MatomoBaseEvent.TRACK_EVENT,
- MatomoSearchAgreementCategory.ENTERPRISE_SEARCH,
- pageTitle,
- JSON.stringify(extra),
- ]);
- });
- });
-
- describe("user searching an agreement", () => {
- it("should send a matomo event", () => {
- const pageTitle = "Préavis de retraite";
- const extra = {
- query: "Boulangerie",
- };
- handleTrackEvent(pageTitle, UserAction.SearchAgreement, extra);
- expect(matopush).toHaveBeenCalledTimes(1);
- expect(matopush).toHaveBeenCalledWith([
- MatomoBaseEvent.TRACK_EVENT,
- MatomoSearchAgreementCategory.AGREEMENT_SEARCH,
- pageTitle,
- JSON.stringify(extra),
- ]);
- });
- });
-
- describe("on user action", () => {
- const excludedEvent = [
- UserAction.SearchEnterprise,
- UserAction.SearchAgreement,
- UserAction.OpenAgreementHelp,
- UserAction.OpenEnterpriseHelp,
- ];
- const values = Object.values(UserAction).filter(
- (action) => !excludedEvent.includes(action)
- );
- values.forEach((value) => {
- it(`should not send matomo event for user action ${value}`, () => {
- handleTrackEvent("Préavis de retraite", value as UserAction);
- expect(matopush).toHaveBeenCalledTimes(0);
- });
- });
- });
-});
diff --git a/packages/code-du-travail-frontend/src/modules/outils/common/components/Agreement/tracking/__tests__/pushAgreementEvents.test.tsx b/packages/code-du-travail-frontend/src/modules/outils/common/components/Agreement/tracking/__tests__/pushAgreementEvents.test.tsx
deleted file mode 100644
index 084d9b434c..0000000000
--- a/packages/code-du-travail-frontend/src/modules/outils/common/components/Agreement/tracking/__tests__/pushAgreementEvents.test.tsx
+++ /dev/null
@@ -1,255 +0,0 @@
-import {
- Enterprise,
- EnterpriseAgreement,
-} from "../../../../../conventions/Search/api/enterprises.service";
-import {
- MatomoAgreementEvent,
- MatomoBaseEvent,
- MatomoSearchAgreementCategory,
- MatomoSimulatorEvent,
-} from "../../../../../lib";
-import { push as matopush } from "@socialgouv/matomo-next";
-import { ConventionCollective } from "../../../type/WizardType";
-import { pushAgreementEvents } from "../index";
-
-jest.mock("@socialgouv/matomo-next", () => ({
- push: jest.fn(),
-}));
-
-const agreement: EnterpriseAgreement = {
- id: "AGREEMENT_ID",
- num: 3239,
- shortTitle: "Service à la personne",
- slug: "/convention/3239-service-a-la-personne",
- title: "Service à la personne",
- contributions: false,
-};
-
-const enterprise: Enterprise = {
- activitePrincipale:
- "Commerce de détail en magasin non spécialisé à prédominance alimentaire",
- conventions: [agreement],
- etablissements: 335,
- highlightLabel: "MONOPRIX EXPLOITATION, PAR ABREVIATION MPX",
- label: "MONOPRIX EXPLOITATION, PAR ABREVIATION MPX",
- matching: 272,
- simpleLabel: "MONOPRIX EXPLOITATION",
- siren: "552083297",
-};
-
-describe("Push agreement events on click next", () => {
- beforeEach(() => {
- const ma = matopush as jest.MockedFunction;
- ma.mockReset();
- });
-
- describe("user without agreement selected", () => {
- const data: ConventionCollective = {
- route: "not-selected",
- };
- it("should send a search type of users matomo event", () => {
- const pageTitle = "Préavis de retraite";
- pushAgreementEvents(pageTitle, data, false, false);
- expect(matopush).toHaveBeenCalledTimes(1);
- expect(matopush).toHaveBeenCalledWith([
- MatomoBaseEvent.TRACK_EVENT,
- MatomoSearchAgreementCategory.AGREEMENT_SEARCH_TYPE_OF_USERS,
- "click_p3",
- pageTitle,
- ]);
- });
- });
-
- describe("user with agreement selected", () => {
- const data: ConventionCollective = {
- route: "agreement",
- selected: agreement,
- };
- describe("agreement not treated", () => {
- it("should send matomo events", () => {
- const pageTitle = "Préavis de retraite";
- pushAgreementEvents(pageTitle, data, false, false);
- expect(matopush).toHaveBeenCalledTimes(3);
- expect(matopush).toHaveBeenNthCalledWith(1, [
- MatomoBaseEvent.TRACK_EVENT,
- MatomoSearchAgreementCategory.AGREEMENT_SEARCH_TYPE_OF_USERS,
- "click_p1",
- pageTitle,
- ]);
- expect(matopush).toHaveBeenNthCalledWith(2, [
- MatomoBaseEvent.TRACK_EVENT,
- MatomoSearchAgreementCategory.AGREEMENT_SELECT_P1,
- pageTitle,
- `idcc${agreement.num.toString()}`,
- ]);
- expect(matopush).toHaveBeenNthCalledWith(3, [
- MatomoBaseEvent.TRACK_EVENT,
- MatomoBaseEvent.OUTIL,
- MatomoAgreementEvent.CC_UNTREATED,
- agreement.num,
- ]);
- });
- });
- describe("agreement treated", () => {
- it("should send matomo events", () => {
- const pageTitle = "Préavis de retraite";
- pushAgreementEvents(pageTitle, data, true, false);
- expect(matopush).toHaveBeenCalledTimes(3);
- expect(matopush).toHaveBeenNthCalledWith(1, [
- MatomoBaseEvent.TRACK_EVENT,
- MatomoSearchAgreementCategory.AGREEMENT_SEARCH_TYPE_OF_USERS,
- "click_p1",
- pageTitle,
- ]);
- expect(matopush).toHaveBeenNthCalledWith(2, [
- MatomoBaseEvent.TRACK_EVENT,
- MatomoSearchAgreementCategory.AGREEMENT_SELECT_P1,
- pageTitle,
- `idcc${agreement.num.toString()}`,
- ]);
- expect(matopush).toHaveBeenNthCalledWith(3, [
- MatomoBaseEvent.TRACK_EVENT,
- MatomoBaseEvent.OUTIL,
- MatomoAgreementEvent.CC_TREATED,
- agreement.num,
- ]);
- });
- });
- });
-
- describe("user with enterprise selected", () => {
- const data: ConventionCollective = {
- enterprise: enterprise,
- route: "enterprise",
- selected: agreement,
- };
-
- it("should send matomo events", () => {
- const pageTitle = "Préavis de retraite";
- pushAgreementEvents(pageTitle, data, false, false);
- expect(matopush).toHaveBeenCalledTimes(4);
- expect(matopush).toHaveBeenNthCalledWith(1, [
- MatomoBaseEvent.TRACK_EVENT,
- MatomoSearchAgreementCategory.AGREEMENT_SEARCH_TYPE_OF_USERS,
- "click_p2",
- pageTitle,
- ]);
- expect(matopush).toHaveBeenNthCalledWith(2, [
- MatomoBaseEvent.TRACK_EVENT,
- MatomoSearchAgreementCategory.ENTERPRISE_SELECT,
- pageTitle,
- JSON.stringify({ label: enterprise.label, siren: enterprise.siren }),
- ]);
- expect(matopush).toHaveBeenNthCalledWith(3, [
- MatomoBaseEvent.TRACK_EVENT,
- MatomoSearchAgreementCategory.AGREEMENT_SELECT_P2,
- pageTitle,
- `idcc${agreement.num.toString()}`,
- ]);
- expect(matopush).toHaveBeenNthCalledWith(4, [
- MatomoBaseEvent.TRACK_EVENT,
- MatomoBaseEvent.OUTIL,
- MatomoAgreementEvent.CC_UNTREATED,
- agreement.num,
- ]);
- });
- });
-
- describe("user with no enterprise", () => {
- const data: ConventionCollective = {
- enterprise: undefined,
- route: "enterprise",
- selected: agreement,
- };
-
- it("should send matomo events", () => {
- const pageTitle = "Préavis de retraite";
- pushAgreementEvents(pageTitle, data, false, true);
- expect(matopush).toHaveBeenCalledTimes(4);
- expect(matopush).toHaveBeenNthCalledWith(1, [
- MatomoBaseEvent.TRACK_EVENT,
- MatomoSearchAgreementCategory.AGREEMENT_SEARCH_TYPE_OF_USERS,
- "click_p2",
- pageTitle,
- ]);
- expect(matopush).toHaveBeenNthCalledWith(2, [
- MatomoBaseEvent.TRACK_EVENT,
- MatomoSearchAgreementCategory.AGREEMENT_SELECT_P2,
- pageTitle,
- `idcc${agreement.num.toString()}`,
- ]);
- expect(matopush).toHaveBeenNthCalledWith(3, [
- MatomoBaseEvent.TRACK_EVENT,
- MatomoBaseEvent.OUTIL,
- MatomoAgreementEvent.CC_UNTREATED,
- agreement.num,
- ]);
- expect(matopush).toHaveBeenNthCalledWith(4, [
- MatomoBaseEvent.TRACK_EVENT,
- MatomoSearchAgreementCategory.AGREEMENT_SEARCH_TYPE_OF_USERS,
- MatomoSimulatorEvent.SELECT_NO_COMPANY,
- pageTitle,
- ]);
- });
- });
-
- describe("not tracking", () => {
- it("should not send matomo events if agreement is 9999", () => {
- const agreement9999: EnterpriseAgreement = {
- id: "AGREEMENT_ID",
- num: 9999,
- shortTitle: "?",
- slug: "/convention/9999",
- title: "?",
- contributions: false,
- };
- const pageTitle = "Blabla";
- pushAgreementEvents(
- pageTitle,
- {
- enterprise: {
- activitePrincipale:
- "Commerce de détail en magasin non spécialisé à prédominance alimentaire",
- conventions: [agreement9999],
- etablissements: 335,
- highlightLabel:
- "MONOPRIX EXPLOITATION, PAR ABREVIATION MPX",
- label: "MONOPRIX EXPLOITATION, PAR ABREVIATION MPX",
- matching: 272,
- simpleLabel: "MONOPRIX EXPLOITATION",
- siren: "552083297",
- },
- route: "enterprise",
- selected: agreement9999,
- },
- false,
- false
- );
- expect(matopush).toHaveBeenCalledTimes(4);
- expect(matopush).toHaveBeenNthCalledWith(1, [
- MatomoBaseEvent.TRACK_EVENT,
- MatomoSearchAgreementCategory.AGREEMENT_SEARCH_TYPE_OF_USERS,
- "click_p2",
- pageTitle,
- ]);
- expect(matopush).toHaveBeenNthCalledWith(2, [
- MatomoBaseEvent.TRACK_EVENT,
- MatomoSearchAgreementCategory.ENTERPRISE_SELECT,
- pageTitle,
- JSON.stringify({ label: enterprise.label, siren: enterprise.siren }),
- ]);
- expect(matopush).toHaveBeenNthCalledWith(3, [
- "trackEvent",
- "cc_select_p2",
- "Blabla",
- "idcc9999",
- ]);
- expect(matopush).toHaveBeenNthCalledWith(4, [
- "trackEvent",
- "outil",
- "cc_select_non_traitée",
- 9999,
- ]);
- });
- });
-});
diff --git a/packages/code-du-travail-frontend/src/modules/outils/common/components/Agreement/tracking/handleTrackEvent.ts b/packages/code-du-travail-frontend/src/modules/outils/common/components/Agreement/tracking/handleTrackEvent.ts
deleted file mode 100644
index ad535ad912..0000000000
--- a/packages/code-du-travail-frontend/src/modules/outils/common/components/Agreement/tracking/handleTrackEvent.ts
+++ /dev/null
@@ -1,49 +0,0 @@
-import {
- MatomoBaseEvent,
- MatomoSearchAgreementCategory,
-} from "../../../../lib";
-import { push as matopush } from "@socialgouv/matomo-next";
-import { UserAction } from "../../../ConventionCollective/types";
-
-const handleTrackEvent = (
- title: string,
- action: UserAction,
- extra?: unknown
-): void => {
- switch (action) {
- case UserAction.OpenAgreementHelp:
- matopush([
- MatomoBaseEvent.TRACK_EVENT,
- MatomoSearchAgreementCategory.AGREEMENT_SEARCH_HELP,
- "click_cc_search_help_p1",
- title,
- ]);
- break;
- case UserAction.OpenEnterpriseHelp:
- matopush([
- MatomoBaseEvent.TRACK_EVENT,
- MatomoSearchAgreementCategory.AGREEMENT_SEARCH_HELP,
- "click_cc_search_help_p2",
- title,
- ]);
- break;
- case UserAction.SearchEnterprise:
- matopush([
- MatomoBaseEvent.TRACK_EVENT,
- MatomoSearchAgreementCategory.ENTERPRISE_SEARCH,
- title,
- JSON.stringify(extra),
- ]);
- break;
- case UserAction.SearchAgreement:
- matopush([
- MatomoBaseEvent.TRACK_EVENT,
- MatomoSearchAgreementCategory.AGREEMENT_SEARCH,
- title,
- JSON.stringify(extra),
- ]);
- break;
- }
-};
-
-export default handleTrackEvent;
diff --git a/packages/code-du-travail-frontend/src/modules/outils/common/components/Agreement/tracking/index.ts b/packages/code-du-travail-frontend/src/modules/outils/common/components/Agreement/tracking/index.ts
deleted file mode 100644
index 5ff1b74852..0000000000
--- a/packages/code-du-travail-frontend/src/modules/outils/common/components/Agreement/tracking/index.ts
+++ /dev/null
@@ -1,4 +0,0 @@
-import handleTrackEvent from "./handleTrackEvent";
-import pushAgreementEvents from "./pushAgreementEvents";
-
-export { handleTrackEvent, pushAgreementEvents };
diff --git a/packages/code-du-travail-frontend/src/modules/outils/common/components/Agreement/tracking/pushAgreementEvents.ts b/packages/code-du-travail-frontend/src/modules/outils/common/components/Agreement/tracking/pushAgreementEvents.ts
deleted file mode 100644
index 86f0e92e9d..0000000000
--- a/packages/code-du-travail-frontend/src/modules/outils/common/components/Agreement/tracking/pushAgreementEvents.ts
+++ /dev/null
@@ -1,78 +0,0 @@
-import {
- MatomoAgreementEvent,
- MatomoBaseEvent,
- MatomoSearchAgreementCategory,
- MatomoSimulatorEvent,
-} from "../../../../lib";
-import { push as matopush } from "@socialgouv/matomo-next";
-import { ConventionCollective } from "../../type/WizardType";
-
-const pushAgreementEvents = (
- simulatorTitle: string,
- values: ConventionCollective | undefined,
- isAgreementTreated: boolean,
- hasNoEnterpriseSelected: boolean
-): void => {
- if (!values) {
- // no agreement section, no event to send. Should never happen.
- return;
- }
- let parcours: MatomoSearchAgreementCategory | undefined = undefined;
- let agreementSelect: MatomoSearchAgreementCategory | undefined = undefined;
- switch (values.route) {
- case "agreement":
- parcours = MatomoSearchAgreementCategory.PARCOURS_1;
- agreementSelect = MatomoSearchAgreementCategory.AGREEMENT_SELECT_P1;
- break;
- case "enterprise":
- parcours = MatomoSearchAgreementCategory.PARCOURS_2;
- agreementSelect = MatomoSearchAgreementCategory.AGREEMENT_SELECT_P2;
- break;
- case "not-selected":
- parcours = MatomoSearchAgreementCategory.PARCOURS_3;
- break;
- }
- matopush([
- MatomoBaseEvent.TRACK_EVENT,
- MatomoSearchAgreementCategory.AGREEMENT_SEARCH_TYPE_OF_USERS,
- parcours,
- simulatorTitle,
- ]);
- if (values.enterprise) {
- matopush([
- MatomoBaseEvent.TRACK_EVENT,
- MatomoSearchAgreementCategory.ENTERPRISE_SELECT,
- simulatorTitle,
- JSON.stringify({
- label: values.enterprise.label,
- siren: values.enterprise.siren,
- }),
- ]);
- }
- if (values.selected && agreementSelect) {
- matopush([
- MatomoBaseEvent.TRACK_EVENT,
- agreementSelect,
- simulatorTitle,
- `idcc${values.selected.num}`,
- ]);
- matopush([
- MatomoBaseEvent.TRACK_EVENT,
- MatomoBaseEvent.OUTIL,
- isAgreementTreated
- ? MatomoAgreementEvent.CC_TREATED
- : MatomoAgreementEvent.CC_UNTREATED,
- values.selected.num,
- ]);
- }
- if (hasNoEnterpriseSelected) {
- matopush([
- MatomoBaseEvent.TRACK_EVENT,
- MatomoSearchAgreementCategory.AGREEMENT_SEARCH_TYPE_OF_USERS,
- MatomoSimulatorEvent.SELECT_NO_COMPANY,
- simulatorTitle,
- ]);
- }
-};
-
-export default pushAgreementEvents;
diff --git a/packages/code-du-travail-frontend/src/modules/outils/common/components/Agreement/types.ts b/packages/code-du-travail-frontend/src/modules/outils/common/components/Agreement/types.ts
deleted file mode 100644
index 0735b0c708..0000000000
--- a/packages/code-du-travail-frontend/src/modules/outils/common/components/Agreement/types.ts
+++ /dev/null
@@ -1,13 +0,0 @@
-import { SupportedTypes } from "@socialgouv/modeles-social";
-import { Enterprise } from "../../../conventions/Search/api/enterprises.service";
-import { Agreement } from "../../../outils/types";
-
-export type AgreementSupportInfo = {
- fullySupported: SupportedTypes;
- idcc: number;
-};
-
-export type OnSelectAgreementFn = (
- agreement: Agreement | null,
- enterprise?: Enterprise
-) => void;
diff --git a/packages/code-du-travail-frontend/src/modules/outils/common/components/Feedback/Questionnaire.tsx b/packages/code-du-travail-frontend/src/modules/outils/common/components/Feedback/Questionnaire.tsx
deleted file mode 100644
index c4a86e33dd..0000000000
--- a/packages/code-du-travail-frontend/src/modules/outils/common/components/Feedback/Questionnaire.tsx
+++ /dev/null
@@ -1,59 +0,0 @@
-import styled from "styled-components";
-import { Button, Heading, theme } from "@socialgouv/cdtn-ui";
-
-import { QuestionnaireItem } from "./QuestionnaireItem";
-import {
- EVENT_ACTION,
- EVENT_CATEGORY,
- FEEDBACK_RESULT,
- trackFeedback,
-} from "./tracking";
-import { useState } from "react";
-
-type QuestionnaireProps = {
- onClick: () => void;
- category: EVENT_CATEGORY;
-};
-
-export const Questionnaire = ({
- onClick,
- category,
-}: QuestionnaireProps): JSX.Element => {
- const [status, setStatus] = useState();
- const [displayError, setDisplayError] = useState(false);
- return (
- <>
-
- Comment s'est passée cette simulation pour vous ?
-
- {
- setStatus(status);
- setDisplayError(false);
- }}
- displayError={displayError}
- />
- {
- if (!status) {
- setDisplayError(true);
- } else {
- trackFeedback(EVENT_ACTION.GLOBAL, status, category);
- onClick();
- }
- }}
- variant="primary"
- >
- Envoyer
-
- >
- );
-};
-
-const StyledButton = styled(Button)`
- margin: 0 ${theme.spacings.xmedium};
-`;
diff --git a/packages/code-du-travail-frontend/src/modules/outils/common/components/Feedback/QuestionnaireAdvanced.tsx b/packages/code-du-travail-frontend/src/modules/outils/common/components/Feedback/QuestionnaireAdvanced.tsx
deleted file mode 100644
index 675021d11e..0000000000
--- a/packages/code-du-travail-frontend/src/modules/outils/common/components/Feedback/QuestionnaireAdvanced.tsx
+++ /dev/null
@@ -1,112 +0,0 @@
-import { Button, Heading, theme } from "@socialgouv/cdtn-ui";
-import { QuestionnaireItem } from "./QuestionnaireItem";
-import { QuestionnaireText } from "./QuestionnaireText";
-import styled from "styled-components";
-import { useState } from "react";
-import {
- EVENT_ACTION,
- EVENT_CATEGORY,
- FEEDBACK_RESULT,
- trackFeedback,
- trackFeedbackText,
-} from "./tracking";
-import { useRouter } from "next/router";
-
-type QuestionnaireAdvancedProps = {
- onClick: () => void;
- category: EVENT_CATEGORY;
-};
-
-export const QuestionnaireAdvanced = ({
- onClick,
- category,
-}: QuestionnaireAdvancedProps): React.ReactElement => {
- const router = useRouter();
- const [statusSimulator, setStatusSimulator] = useState();
- const [statusQuestion, setStatusQuestion] = useState();
- const [statusExplanation, setStatusExplanation] = useState();
- const [feedbackText, setFeedbackText] = useState();
- return (
- <>
-
- Merci pour votre aide ! Pouvez-vous nous en dire plus ?
-
-
- {
- setStatusSimulator(status);
- }}
- dataTestId="simulator"
- />
- {
- setStatusQuestion(status);
- }}
- dataTestId="questionClarity"
- />
- {
- setStatusExplanation(status);
- }}
- dataTestId="resultClarity"
- />
-
-
- {
- if (statusSimulator) {
- trackFeedback(EVENT_ACTION.EASINESS, statusSimulator, category);
- }
- if (statusQuestion) {
- trackFeedback(
- EVENT_ACTION.QUESTION_CLARITY,
- statusQuestion,
- category
- );
- }
- if (statusExplanation) {
- trackFeedback(
- EVENT_ACTION.RESULT_CLARITY,
- statusExplanation,
- category
- );
- }
- if (feedbackText) {
- trackFeedbackText(feedbackText, router.asPath, category);
- }
- onClick();
- }}
- >
- Envoyer
-
- >
- );
-};
-
-const StyledButton = styled(Button)`
- margin: 0 ${theme.spacings.xmedium};
-`;
diff --git a/packages/code-du-travail-frontend/src/modules/outils/common/components/Feedback/QuestionnaireEnd.tsx b/packages/code-du-travail-frontend/src/modules/outils/common/components/Feedback/QuestionnaireEnd.tsx
deleted file mode 100644
index 1d4b82b08e..0000000000
--- a/packages/code-du-travail-frontend/src/modules/outils/common/components/Feedback/QuestionnaireEnd.tsx
+++ /dev/null
@@ -1,19 +0,0 @@
-import { Heading, theme } from "@socialgouv/cdtn-ui";
-import styled from "styled-components";
-
-export const QuestionnaireEnd = (): JSX.Element => {
- return (
- <>
-
- Merci pour votre aide !
-
-
- Votre évaluation sera étudiée au plus vite par nos équipes
-
- >
- );
-};
-
-const StyledText = styled.p`
- padding: 0 ${theme.spacings.medium};
-`;
diff --git a/packages/code-du-travail-frontend/src/modules/outils/common/components/Feedback/QuestionnaireItem.tsx b/packages/code-du-travail-frontend/src/modules/outils/common/components/Feedback/QuestionnaireItem.tsx
deleted file mode 100644
index 1964061bfc..0000000000
--- a/packages/code-du-travail-frontend/src/modules/outils/common/components/Feedback/QuestionnaireItem.tsx
+++ /dev/null
@@ -1,114 +0,0 @@
-import { Button } from "@socialgouv/cdtn-ui";
-import { icons, theme } from "@socialgouv/cdtn-ui";
-import { useState } from "react";
-import styled from "styled-components";
-import { FEEDBACK_RESULT } from "./tracking";
-
-type QuestionnaireItemProps = {
- badEventValue: FEEDBACK_RESULT;
- averageEventValue: FEEDBACK_RESULT;
- goodEventValue: FEEDBACK_RESULT;
- badText?: string;
- averageText?: string;
- goodText?: string;
- className?: string;
- title?: string;
- displayError?: boolean;
- onChange: (status: FEEDBACK_RESULT) => void;
- dataTestId?: string;
-};
-
-export enum Status {
- BAD = "bad",
- AVERAGE = "average",
- GOOD = "good",
-}
-
-export const QuestionnaireItem = ({
- badEventValue,
- averageEventValue,
- goodEventValue,
- badText,
- averageText,
- goodText,
- className,
- title,
- displayError,
- onChange,
- dataTestId,
-}: QuestionnaireItemProps): JSX.Element => {
- const [status, setStatus] = useState();
- return (
-
- {title && {title} }
-
- {
- setStatus(Status.BAD);
- onChange(badEventValue);
- }}
- data-testId={`${dataTestId}-bad`}
- >
-
- {badText ?? "Pas bien"}
-
- {
- setStatus(Status.AVERAGE);
- onChange(averageEventValue);
- }}
- data-testId={`${dataTestId}-average`}
- >
-
- {averageText ?? "Moyen"}
-
- {
- setStatus(Status.GOOD);
- onChange(goodEventValue);
- }}
- data-testId={`${dataTestId}-good`}
- >
-
- {goodText ?? "Très bien"}
-
-
- {displayError && (
- Vous devez choisir une des réponses
- )}
-
- );
-};
-
-const { colors } = theme;
-
-const ButtonContainer = styled.div`
- display: flex;
- flex-direction: row;
- padding: 6px 0;
- max-width: 300px;
- justify-content: space-between;
-`;
-
-const StyledButton = styled(Button)`
- display: flex;
- flex-direction: column;
- width: 80px;
- height: 60px;
- padding: 0;
- border: 1px solid ${colors.secondary};
- border-radius: 3px;
- font-size: 12px;
- font-weight: bold;
-`;
-
-const StyledError = styled.span`
- color: ${colors.error};
-`;
-
-const Div = styled.div`
- padding: 0 ${theme.spacings.xmedium} ${theme.spacings.large};
-`;
diff --git a/packages/code-du-travail-frontend/src/modules/outils/common/components/Feedback/QuestionnaireText.tsx b/packages/code-du-travail-frontend/src/modules/outils/common/components/Feedback/QuestionnaireText.tsx
deleted file mode 100644
index c03a3ed445..0000000000
--- a/packages/code-du-travail-frontend/src/modules/outils/common/components/Feedback/QuestionnaireText.tsx
+++ /dev/null
@@ -1,48 +0,0 @@
-import { Textarea, theme } from "@socialgouv/cdtn-ui";
-import styled from "styled-components";
-
-type QuestionnaireItemProps = {
- className?: string;
- title?: string;
- placeholder?: string;
- onChange: (text: string) => void;
- dataTestId?: string;
-};
-
-export const QuestionnaireText = ({
- className,
- title,
- placeholder,
- onChange,
- dataTestId,
-}: QuestionnaireItemProps): JSX.Element => {
- const maxCharacters = 200;
- return (
-
- {title && {title} }
- onChange(event.target.value)}
- data-testid={dataTestId}
- />
- {maxCharacters} caractères maximum
-
- );
-};
-
-const StyledContainer = styled.div`
- display: flex;
- flex-direction: column;
- padding: 0 ${theme.spacings.xmedium} ${theme.spacings.large};
-`;
-
-const StyledTextarea = styled(Textarea)`
- width: 420px;
- max-width: 100%;
-`;
-
-const MaxCharacterText = styled.p`
- margin: 12px 0;
- font-size: 14px;
-`;
diff --git a/packages/code-du-travail-frontend/src/modules/outils/common/components/Feedback/__tests__/feedback.test.tsx b/packages/code-du-travail-frontend/src/modules/outils/common/components/Feedback/__tests__/feedback.test.tsx
deleted file mode 100644
index 8b5f3dbb44..0000000000
--- a/packages/code-du-travail-frontend/src/modules/outils/common/components/Feedback/__tests__/feedback.test.tsx
+++ /dev/null
@@ -1,129 +0,0 @@
-import { fireEvent, render } from "@testing-library/react";
-import { Feedback } from "..";
-import { ui } from "./ui";
-import { push as matopush } from "@socialgouv/matomo-next";
-import { EVENT_CATEGORY } from "../tracking";
-
-jest.mock("@socialgouv/matomo-next", () => {
- return {
- push: jest.fn(),
- };
-});
-
-describe("Etant donné un composant Feedback", () => {
- beforeEach(() => {
- render( );
- });
- test("Vérification que l'introduction s'affiche", () => {
- expect(ui.introduction.title.query()).toBeInTheDocument();
- expect(ui.introduction.button.query()).toBeInTheDocument();
- });
- describe("Lors d'un clique sur le bouton 'Fermer'", () => {
- beforeEach(() => {
- fireEvent.click(ui.closeButton.get());
- });
- test("Vérification que le composant ne s'affiche plus", () => {
- expect(ui.introduction.title.query()).not.toBeInTheDocument();
- expect(ui.introduction.button.query()).not.toBeInTheDocument();
- });
- });
- describe("Lors d'un clique sur le bouton 'Donner mon avis'", () => {
- beforeEach(() => {
- fireEvent.click(ui.introduction.button.get());
- });
- test("Vérification que le 1er questionnaire s'affiche bien", () => {
- expect(ui.questionnaire1.title.query()).toBeInTheDocument();
- expect(ui.questionnaire1.bad.query()).toBeInTheDocument();
- expect(ui.questionnaire1.average.query()).toBeInTheDocument();
- expect(ui.questionnaire1.good.query()).toBeInTheDocument();
- expect(ui.sendButton.query()).toBeInTheDocument();
- });
- describe("Lors d'un clic directement sur le bouton 'Envoyer'", () => {
- beforeEach(() => {
- fireEvent.click(ui.sendButton.get());
- });
- test("Vérification que le message d'erreur s'affiche bien", () => {
- expect(ui.questionnaire1.requiredError.query()).toBeInTheDocument();
- });
- });
- describe("Lors d'une sélection et clique sur le bouton 'Envoyer'", () => {
- beforeEach(() => {
- fireEvent.click(ui.questionnaire1.average.get());
- fireEvent.click(ui.sendButton.get());
- });
- test("Vérification du tracking et que le 2e questionnaire s'affiche", () => {
- expect(matopush).toHaveBeenCalledWith([
- "trackEvent",
- "feedback_simulateurs",
- "Comment_s_est_passée_la_simulation",
- "moyen",
- ]);
-
- expect(ui.questionnaire2.simulator.title.query()).toBeInTheDocument();
- expect(ui.questionnaire2.simulator.bad.query()).toBeInTheDocument();
- expect(ui.questionnaire2.simulator.average.query()).toBeInTheDocument();
- expect(ui.questionnaire2.simulator.good.query()).toBeInTheDocument();
-
- expect(
- ui.questionnaire2.questionClarity.title.query()
- ).toBeInTheDocument();
- expect(
- ui.questionnaire2.questionClarity.bad.query()
- ).toBeInTheDocument();
- expect(
- ui.questionnaire2.questionClarity.average.query()
- ).toBeInTheDocument();
- expect(
- ui.questionnaire2.questionClarity.good.query()
- ).toBeInTheDocument();
-
- expect(
- ui.questionnaire2.resultClarity.title.query()
- ).toBeInTheDocument();
- expect(ui.questionnaire2.resultClarity.bad.query()).toBeInTheDocument();
- expect(
- ui.questionnaire2.resultClarity.average.query()
- ).toBeInTheDocument();
- expect(
- ui.questionnaire2.resultClarity.good.query()
- ).toBeInTheDocument();
-
- expect(ui.questionnaire2.more.title.query()).toBeInTheDocument();
- expect(ui.questionnaire2.more.input.query()).toBeInTheDocument();
- });
- describe("Lors d'une sélection et clique sur le bouton 'Envoyer'", () => {
- beforeEach(() => {
- fireEvent.click(ui.questionnaire2.simulator.bad.get());
- fireEvent.click(ui.questionnaire2.questionClarity.average.get());
- fireEvent.click(ui.questionnaire2.resultClarity.good.get());
- fireEvent.change(ui.questionnaire2.more.input.get(), {
- target: { value: "test" },
- });
- fireEvent.click(ui.sendButton.get());
- });
- test("Vérification du tracking et que la fin du questionnaire s'affiche", () => {
- expect(matopush).toHaveBeenCalledWith([
- "trackEvent",
- "feedback_simulateurs",
- "Comment_s_est_passée_la_simulation",
- "moyen",
- ]);
- expect(matopush).toHaveBeenCalledWith([
- "trackEvent",
- "feedback_simulateurs",
- "Facilité_utilisation_simulateur",
- "pas_du_tout",
- ]);
- expect(matopush).toHaveBeenCalledWith([
- "trackEvent",
- "feedback_simulateurs",
- "Clarté_questions",
- "moyen",
- ]);
- expect(ui.questionnaireEnd.title.query()).toBeInTheDocument();
- expect(ui.questionnaireEnd.description.query()).toBeInTheDocument();
- });
- });
- });
- });
-});
diff --git a/packages/code-du-travail-frontend/src/modules/outils/common/components/Feedback/__tests__/ui.ts b/packages/code-du-travail-frontend/src/modules/outils/common/components/Feedback/__tests__/ui.ts
deleted file mode 100644
index 3ca0dd5542..0000000000
--- a/packages/code-du-travail-frontend/src/modules/outils/common/components/Feedback/__tests__/ui.ts
+++ /dev/null
@@ -1,53 +0,0 @@
-import { byTestId, byText } from "testing-library-selector";
-
-export const ui = {
- closeButton: byTestId("feedbackCloseButton"),
- sendButton: byText("Envoyer"),
- introduction: {
- title: byText("Votre avis sur ce simulateur nous intéresse"),
- button: byText("Donner mon avis"),
- },
- questionnaire1: {
- title: byText(/Comment s'est passée cette simulation pour vous \?/),
- bad: byText("Pas bien"),
- average: byText("Moyen"),
- good: byText("Très bien"),
- requiredError: byText("Vous devez choisir une des réponses"),
- },
- questionnaire2: {
- title: byText(/Merci pour votre aide ! Pouvez-vous nous en dire plus \?/),
- simulator: {
- title: byText(/Le simulateur était-il facile à utiliser \?/),
- bad: byTestId("simulator-bad"),
- average: byTestId("simulator-average"),
- good: byTestId("simulator-good"),
- },
- questionClarity: {
- title: byText(
- /Les questions étaient-elles claires et compréhensibles \?/
- ),
- bad: byTestId("questionClarity-bad"),
- average: byTestId("questionClarity-average"),
- good: byTestId("questionClarity-good"),
- },
- resultClarity: {
- title: byText(
- /Les explications du résultat obtenu étaient-elles claires et compréhensibles \?/
- ),
- bad: byTestId("resultClarity-bad"),
- average: byTestId("resultClarity-average"),
- good: byTestId("resultClarity-good"),
- },
- more: {
- title: byText(/Vous souhaitez nous en dire davantage \?/),
- input: byTestId("more-input"),
- },
- requiredError: byText("Vous devez choisir une des réponses"),
- },
- questionnaireEnd: {
- title: byText(/Merci pour votre aide !/),
- description: byText(
- /Votre évaluation sera étudiée au plus vite par nos équipes/
- ),
- },
-};
diff --git a/packages/code-du-travail-frontend/src/modules/outils/common/components/Feedback/index.tsx b/packages/code-du-travail-frontend/src/modules/outils/common/components/Feedback/index.tsx
deleted file mode 100644
index 6bf4c6a806..0000000000
--- a/packages/code-du-travail-frontend/src/modules/outils/common/components/Feedback/index.tsx
+++ /dev/null
@@ -1,113 +0,0 @@
-import styled from "styled-components";
-import { Button, icons, theme } from "@socialgouv/cdtn-ui";
-import { Introduction } from "./introduction";
-import { useState } from "react";
-import { Questionnaire } from "./Questionnaire";
-import { QuestionnaireAdvanced } from "./QuestionnaireAdvanced";
-import { QuestionnaireEnd } from "./QuestionnaireEnd";
-import { EVENT_CATEGORY } from "./tracking";
-
-type Props = {
- category: EVENT_CATEGORY;
-};
-
-export const Feedback = ({ category }: Props): JSX.Element => {
- const [status, setStatus] = useState<
- "questionnaire" | "questionnaireAdvanced" | "questionnaireEnd"
- >();
- const [closed, setClosed] = useState(false);
- const [position, setPosition] = useState(0);
- const [bodyPosition, setBodyPosition] = useState(0);
- const closeButton = (
- setClosed(true)}
- >
- setClosed(true)}
- data-testid="feedbackCloseButton"
- title="Fermer la modale"
- />
-
- );
- return !closed ? (
-
- {!status && (
-
- {closeButton}
- {
- setStatus("questionnaire");
- }}
- />
-
- )}
- {status && (
- {
- if (!el) return;
-
- setPosition(el.getBoundingClientRect().top);
- setBodyPosition(document.body.getBoundingClientRect().top);
- }}
- >
- {closeButton}
- {status === "questionnaire" && (
- {
- setStatus("questionnaireAdvanced");
- }}
- category={category}
- />
- )}
- {status === "questionnaireAdvanced" && (
- {
- setStatus("questionnaireEnd");
- window.scrollTo(0, position - bodyPosition - 220);
- }}
- category={category}
- />
- )}
- {status === "questionnaireEnd" && }
-
- )}
-
- ) : (
- <>>
- );
-};
-
-const { colors, box } = theme;
-
-const Div = styled.div`
- display: flex;
- justify-content: flex-end;
-`;
-
-const IntroContainer = styled.div`
- border: 1px solid ${colors.secondary};
- border-radius: ${box.borderRadius};
- background-color: ${theme.colors.white};
- min-width: 460px;
- max-width: 100%;
- padding: 0;
- position: relative;
-`;
-
-const StyledContainer = styled(IntroContainer)`
- width: 520px;
- padding: ${theme.spacings.xmedium} 0;
-`;
-
-const CloseButton = styled(Button)`
- position: absolute;
- top: 8px;
- right: 8px;
- width: 24px;
- color: ${({ theme }) => theme.secondary};
-`;
diff --git a/packages/code-du-travail-frontend/src/modules/outils/common/components/Feedback/introduction.tsx b/packages/code-du-travail-frontend/src/modules/outils/common/components/Feedback/introduction.tsx
deleted file mode 100644
index daf4f97916..0000000000
--- a/packages/code-du-travail-frontend/src/modules/outils/common/components/Feedback/introduction.tsx
+++ /dev/null
@@ -1,22 +0,0 @@
-import styled from "styled-components";
-import { Button, Paragraph, theme } from "@socialgouv/cdtn-ui";
-
-type IntroductionProps = {
- onClick: () => void;
-};
-
-export const Introduction = ({ onClick }: IntroductionProps): JSX.Element => {
- return (
-
-
- Votre avis sur ce simulateur nous intéresse
-
-
Donner mon avis
-
- );
-};
-
-const Div = styled.div`
- text-align: center;
- padding: ${theme.spacings.large};
-`;
diff --git a/packages/code-du-travail-frontend/src/modules/outils/common/components/Feedback/tracking.ts b/packages/code-du-travail-frontend/src/modules/outils/common/components/Feedback/tracking.ts
deleted file mode 100644
index 9848adb69a..0000000000
--- a/packages/code-du-travail-frontend/src/modules/outils/common/components/Feedback/tracking.ts
+++ /dev/null
@@ -1,52 +0,0 @@
-import { MatomoBaseEvent } from "src/lib/matomo";
-import { push as matopush } from "@socialgouv/matomo-next";
-
-export enum EVENT_CATEGORY {
- indemniteLicenciement = "feedback_simulateurs",
- ruptureConventionnelle = "feedback_simulateurs_rupture_co",
-}
-
-export enum EVENT_SUGGESTION {
- indemniteLicenciement = "feedback_suggestion",
- ruptureConventionnelle = "feedback_suggestion_rupture_co",
-}
-
-export enum EVENT_ACTION {
- GLOBAL = "Comment_s_est_passée_la_simulation",
- EASINESS = "Facilité_utilisation_simulateur",
- QUESTION_CLARITY = "Clarté_questions",
- RESULT_CLARITY = "Clarté_résultat",
- SUGGESTION = "Suggestion",
-}
-
-export enum FEEDBACK_RESULT {
- NOT_GOOD = "pas_bien",
- NOT_AT_ALL = "pas_du_tout",
- AVERAGE = "moyen",
- GOOD = "très_bien",
- EASY = "facile",
- YES = "oui",
-}
-
-export const trackFeedback = (
- event: EVENT_ACTION,
- feedback: FEEDBACK_RESULT,
- category: EVENT_CATEGORY
-) => {
- matopush([MatomoBaseEvent.TRACK_EVENT, category, event, feedback]);
-};
-
-export const trackFeedbackText = (
- text: string,
- url: string,
- category: EVENT_CATEGORY
-) => {
- matopush([
- "trackEvent",
- category === EVENT_CATEGORY.indemniteLicenciement
- ? EVENT_SUGGESTION.indemniteLicenciement
- : EVENT_SUGGESTION.ruptureConventionnelle,
- text,
- url.replace(/\?.*$/, ""),
- ]);
-};
diff --git a/packages/code-du-travail-frontend/src/modules/outils/common/components/Informations/index.ts b/packages/code-du-travail-frontend/src/modules/outils/common/components/Informations/index.ts
deleted file mode 100644
index 6749274222..0000000000
--- a/packages/code-du-travail-frontend/src/modules/outils/common/components/Informations/index.ts
+++ /dev/null
@@ -1 +0,0 @@
-export { default as PubliQuestion } from "./PubliQuestion";
diff --git a/packages/code-du-travail-frontend/src/modules/outils/common/components/RadioQuestion.tsx b/packages/code-du-travail-frontend/src/modules/outils/common/components/RadioQuestion.tsx
index 678bec2218..a97d79f4f3 100644
--- a/packages/code-du-travail-frontend/src/modules/outils/common/components/RadioQuestion.tsx
+++ b/packages/code-du-travail-frontend/src/modules/outils/common/components/RadioQuestion.tsx
@@ -1,6 +1,6 @@
import React from "react";
-import { Tooltip } from "./types";
import Html from "src/modules/common/Html";
+import { RadioButtons } from "@codegouvfr/react-dsfr/RadioButtons";
type Question = {
label: string;
@@ -16,21 +16,18 @@ type Props = {
questions: Question[];
showRequired?: boolean;
name: string;
- tooltip?: Tooltip;
subLabel?: string;
note?: string;
autoFocus?: boolean;
};
-export default function RadioQuestion({
+export function RadioQuestion({
selectedOption,
onChangeSelectedOption,
error,
label,
questions,
- showRequired,
name,
- tooltip,
subLabel,
note,
autoFocus = false,
@@ -41,26 +38,24 @@ export default function RadioQuestion({
return (
- {/* */}
- {label}
- {/* */}
- {/* {subLabel && {subLabel} } */}
- {/*
- {questions.map((question, index) => (
- onChange(question.value)}
- autoFocus={autoFocus ? index === 0 : false}
- />
- ))}
- {error && {error} }
- */}
+ {label}