Skip to content

Commit 847861b

Browse files
ViczeimaxgfrcarolineBdam-maillotSocialGroovyBot
authored
feat: module trouver sa cc (#6267)
* fix: dsfr * fix: dsfr * fix: dsfr * fix: tests * fix: build * fix: build * fix: build * feat(dsfr): ajout du footer (#6079) * feat: add code * fix: tests * fix: tests * fix: tests * fix: tests * fix: tests * fix: dernier titi * fix: autoclick * fix: bug * feat(css): ajout de la lib `panda-css` (zero-runtime) (#6085) * fix: pandacss * fix: build * fix: build * feat(dsfr): ajout de la page stats (#6090) * fix: pandacss * fix: build * fix: build * fix(stats): add page * fix: stats * fix: tests * fix: tests * Update packages/code-du-travail-frontend/src/modules/mentions-legales/index.tsx Co-authored-by: Martial Maillot <[email protected]> * fix(recherche): remonter les pré-qualifiés dans la recherche (#6082) * chore(release): version 4.151.1 * fix(csp): remove reporting on sentry (#6092) * fix: config * fix: config * fix: config * empty * fix: config * empty * Update packages/code-du-travail-frontend/src/modules/mentions-legales/index.tsx Co-authored-by: Martial Maillot <[email protected]> * Update packages/code-du-travail-frontend/src/modules/mentions-legales/index.tsx Co-authored-by: Martial Maillot <[email protected]> * fix: config * chore(dsfr): mise à jour de la version DSFR * fix(dsfr): ignore les exceptions d'hydratation * feat(tests): ajout du module de testing (#6096) * fix: tests * fix: tests * fix: command * fix: merge date * fix: tests * fix: tests * fix: tests * fix: tests * fix(dsfr): ignore les exceptions d'hydratation * fix: readme * feat(DSFR): migration de la page article du code du travail (#6099) * feat: 6093 dsfr page politique de confidentialit (#6094) * feat: implémentation page politique confidentialité dsfr * chore: clean * fix: iframe dark mode * chore: refacto + e2e test * feat: convert a to Link * chore: review * chore: rename test --------- Co-authored-by: victor <[email protected]> * feat(dsfr): ajout des liens d'évitement (#6120) * feat(dsfr): migration de la page plan du site (#6097) * feat(dsfr): mise à jour des snapshots * feat(dsfr): mise à jour des snapshots * chore(dsfr): mise à jour de la lib DSFR * feat(dsfr): ajout du composant "Avez-vous trouvé une réponse à votre question" (#6121) * fix: merge date * fix: satisfaction * fix: retours preavis * fix: retours preavis * fix: tests * move feedback component to the page articleCodeDuTravail.tsx * clean-up css * fix: feedback * fix: feedback * fix: tests * fix: tests * feat(dsfr): création du composant "Besoin de plus d'information" (#6135) * fix: ui * fix: composant --------- Co-authored-by: carolineBda <[email protected]> Co-authored-by: Martial Maillot <[email protected]> * fix: retours * fix: tests * feat: nouvelle API pour les articles du code du travail (#6132) Co-authored-by: carolineBda <[email protected]> * fix(spec) : fix de la spec article-code-du-travail.spec.ts * fix(dsfr): ajout de la config pour supprimer le `insafe-inline` des `scripts` dans les `csp` (#6151) * feat(dsfr): ajout de matomo pour tracker les events (#6157) * fix: matomo * fix: matomo --------- Co-authored-by: Martial Maillot <[email protected]> * fix(feedback): ajout d'une logique de caractères restants (#6156) * fix: tests * feat: limiter à 500 caractères la saisie * feat: limiter à 500 caractères la saisie --------- Co-authored-by: Martial Maillot <[email protected]> * feat(dsfr): ajout du nouveau logo (#6159) * feat(dsfr): ajout des pages d'erreurs (404 + 500) (#6146) * fix: pages * fix: 404 * fix: tests * fix: tests * fix: tests * fix: lint * test error * fix errors * Fix spec * add button to test error page * feat: force error 500 for testing purpose * feat: revert errors --------- Co-authored-by: carolineBda <[email protected]> Co-authored-by: Martial Maillot <[email protected]> * feat: séparation des anciennes API et des nouvelles (#6183) * fix(article code du travail): retrait du tag Code du travail (#6182) * feat(config): correction de `husky`, ajout de `prettier` pour le formattage et de `lint-staged` pour runner le formattage au `precommit` (#6192) * fix: prettier * fix: prettier * fix: readme * fix: readme * fix: bug * fix: prettier * fix: prettier * fix: tests * fix: tests * fix: prettier * fix: prettier * fix: branch * merge dev * feat: implémentation simulateur brut net * chore: fix ts * chore: snap * chore: clean * chore: clean * chore: clean * chore: review * feat: update responsive * Revert "Merge branch 'dev' into simulateur-brut-net-dsfr" This reverts commit 0748928, reversing changes made to cd15bc7. * chore: clean * feat: chore clean * chore: clean * chore: remove undesired files * chore: remove undesired files * chore: clean * feat: implementation page convention collective * feat: update button link * fix: meta description share * feat: switch simu brut net couleur par defaut * feat: ajout de l'icone * feat: update svg * fix: ts * fix: bug load * chore: review * fix: mobile display * chore: review * chore: review * chore: review * feat: implémentation trouver cc * feat: implementation trouver CC * chore: common style * feat: add error alert entreprise search * feat: disable card * feat: ajout TU + fix * chore: clean * fix: e2e tests * chore: clean * fix: widget * fix: error * feat: info bulle * fix: widget * fix: home fetch agreement * feat: add postmessage searchCC * fix: home cc * feat: change contenu lié search cc * fix: related items * fix: message erreur lors de la recherche * fix: error message * fix: relatedItems * chore: add TU * refactor: move files to folders * fix: build * chore: review * chore: clean * fix: ajout des canonicals * fix: input info * fix: canonicals * feat: ajout d'un spinner * fix: tests * chore: review * feat: add spinner to enterprise search * fix: load on select item autocomplete * fix: bug widget selection entreprise * fix: disabled rule * chore: review * chore: review * chore: review * chore: review * chore: review * chore: review * chore: review * fix: garder la recherche entrerprise au click precedent * chore: review * chore: review * fix: TU + some styles * fix: e2e * refactor * fix: TU * fix: TU * chore: review * chore: review * chore: review * chore: review postalcode * chore: review * chore: review * fix: cypress test * chore: add widgetMode TU * chore: fix test * fix: cypress test * fix: cypress test * chore: cy * chore: fix cy * refactor * refactor * chore: review * chore: clean * chore: review * fix: largeur champs recherche entreprise * feat: ajout d'un message d'erreur pour les codes naf * feat: update design * chore: clean * chore: design review * chore: review * chore: test noindex * chore: nbsp * chore: review * chore: review * chore: fix test e2e --------- Co-authored-by: maxgfr <[email protected]> Co-authored-by: Caroline <[email protected]> Co-authored-by: Martial Maillot <[email protected]> Co-authored-by: Social Groovy Bot <[email protected]> Co-authored-by: victor <[email protected]> Co-authored-by: carolineBda <[email protected]>
1 parent b345f9f commit 847861b

File tree

71 files changed

+2554
-115
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

71 files changed

+2554
-115
lines changed

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@
4545
"url": "https://github.com/SocialGouv/code-du-travail-numerique/issues"
4646
},
4747
"devDependencies": {
48+
"cypress-iframe": "^1.0.1",
4849
"husky": "^9.1.6",
4950
"lerna": "8.1.8"
5051
},

packages/code-du-travail-frontend/app/convention-collective/page.tsx

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,24 +3,30 @@ import {
33
Agreements,
44
AgreementsPerLetter,
55
} from "../../src/modules/convention-collective/Agreements";
6-
import { fetchAgreements } from "../../src/modules/convention-collective";
6+
import { fetchAllAgreements } from "../../src/modules/convention-collective";
77
import { generateDefaultMetadata } from "../../src/modules/common/metas";
8+
import { notFound } from "next/navigation";
9+
import { SITE_URL } from "../../src/config";
810

911
export const metadata = generateDefaultMetadata({
1012
title: "Votre convention collective",
1113
description:
1214
"Retrouvez les questions/réponses fréquentes organisées par thème pour votre convention collective",
1315
path: "/convention-collective",
16+
overrideCanonical: `{${SITE_URL}/outils/convention-collective}`,
1417
});
1518

1619
const removeAccents = (text: string) =>
1720
text.normalize("NFD").replace(/[\u0300-\u036f]/g, "");
1821

1922
async function AgreementPage() {
20-
const agreements = await fetchAgreements(
21-
["slug", "shortTitle"],
22-
"shortTitle"
23-
);
23+
const agreements = await fetchAllAgreements({
24+
fields: ["slug", "shortTitle"],
25+
sortBy: "shortTitle",
26+
});
27+
if (!agreements.length) {
28+
return notFound();
29+
}
2430
const firstLettersAgreements = agreements.reduce<AgreementsPerLetter>(
2531
(agreementPerletter, agreement) => {
2632
const { shortTitle } = agreement;
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
import { DsfrLayout } from "../../../../src/modules/layout";
2+
import { DocumentElasticResult } from "../../../../src/modules/documents";
3+
import { fetchTool, FindAgreementLayout } from "../../../../src/modules/outils";
4+
import { notFound } from "next/navigation";
5+
import { generateDefaultMetadata } from "../../../../src/modules/common/metas";
6+
import { ElasticTool } from "../../../../src/modules/outils/type";
7+
import { AgreementSearch } from "../../../../src/modules/convention-collective";
8+
import { agreementRelatedItems } from "../../../../src/modules/convention-collective/agreementRelatedItems";
9+
import { SITE_URL } from "../../../../src/config";
10+
11+
export async function generateMetadata() {
12+
const { title, description } = await getTool();
13+
14+
return generateDefaultMetadata({
15+
title: `Simulateur - ${title}`,
16+
description: description,
17+
path: `${SITE_URL}/outils/convention-collective/convention`,
18+
overrideCanonical: `${SITE_URL}/outils/convention-collective`,
19+
});
20+
}
21+
22+
async function FindAgreementByNamePage() {
23+
const tool = await getTool();
24+
return (
25+
<DsfrLayout>
26+
<FindAgreementLayout
27+
relatedItems={agreementRelatedItems}
28+
description={tool.description}
29+
>
30+
<AgreementSearch />
31+
</FindAgreementLayout>
32+
</DsfrLayout>
33+
);
34+
}
35+
36+
const getTool = async () => {
37+
const tool = await fetchTool("convention-collective");
38+
39+
if (!tool) {
40+
return notFound();
41+
}
42+
return tool;
43+
};
44+
45+
export default FindAgreementByNamePage;
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
import { DsfrLayout } from "../../../../../src/modules/layout";
2+
import { DocumentElasticResult } from "../../../../../src/modules/documents";
3+
import {
4+
fetchTool,
5+
FindAgreementLayout,
6+
} from "../../../../../src/modules/outils";
7+
import { notFound } from "next/navigation";
8+
import { generateDefaultMetadata } from "../../../../../src/modules/common/metas";
9+
import { ElasticTool } from "../../../../../src/modules/outils/type";
10+
import { EnterpriseAgreementSelection } from "../../../../../src/modules/enterprise";
11+
import { searchEnterprises } from "../../../../../src/modules/enterprise/queries";
12+
import { agreementRelatedItems } from "../../../../../src/modules/convention-collective/agreementRelatedItems";
13+
import { SITE_URL } from "../../../../../src/config";
14+
15+
export async function generateMetadata({ params }) {
16+
const { title, description } = await getTool();
17+
18+
return generateDefaultMetadata({
19+
title: `Simulateur - ${title}`,
20+
description: description,
21+
path: `${SITE_URL}/outils/convention-collective/selection/${params.slug}`,
22+
overrideCanonical: `${SITE_URL}/outils/convention-collective`,
23+
});
24+
}
25+
26+
async function AgreementSelectionPage({ params }) {
27+
const [enterprise] = await searchEnterprises({
28+
query: params.slug,
29+
});
30+
if (!enterprise) {
31+
return notFound();
32+
}
33+
const tool = await getTool();
34+
return (
35+
<DsfrLayout>
36+
<meta name="robots" content="noindex,nofollow" />
37+
<FindAgreementLayout
38+
relatedItems={agreementRelatedItems}
39+
description={tool.description}
40+
>
41+
<EnterpriseAgreementSelection enterprise={enterprise} />
42+
</FindAgreementLayout>
43+
</DsfrLayout>
44+
);
45+
}
46+
47+
const getTool = async () => {
48+
const tool: DocumentElasticResult<ElasticTool> = await fetchTool(
49+
"convention-collective"
50+
);
51+
52+
if (!tool) {
53+
return notFound();
54+
}
55+
return tool;
56+
};
57+
58+
export default AgreementSelectionPage;
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
import { DsfrLayout } from "../../../../src/modules/layout";
2+
import { DocumentElasticResult } from "../../../../src/modules/documents";
3+
import { fetchTool, FindAgreementLayout } from "../../../../src/modules/outils";
4+
import { notFound } from "next/navigation";
5+
import { generateDefaultMetadata } from "../../../../src/modules/common/metas";
6+
import { ElasticTool } from "../../../../src/modules/outils/type";
7+
import { EnterpriseAgreementSearch } from "../../../../src/modules/enterprise";
8+
import { agreementRelatedItems } from "../../../../src/modules/convention-collective/agreementRelatedItems";
9+
import { SITE_URL } from "../../../../src/config";
10+
11+
export async function generateMetadata() {
12+
const { title, description } = await getTool();
13+
14+
return generateDefaultMetadata({
15+
title: `Simulateur - ${title}`,
16+
description: description,
17+
path: `${SITE_URL}/outils/convention-collective/entreprise`,
18+
overrideCanonical: `${SITE_URL}/outils/convention-collective`,
19+
});
20+
}
21+
22+
async function FindAgreementByEnterprisePage() {
23+
const tool = await getTool();
24+
return (
25+
<DsfrLayout>
26+
<FindAgreementLayout
27+
relatedItems={agreementRelatedItems}
28+
description={tool.description}
29+
>
30+
<EnterpriseAgreementSearch />
31+
</FindAgreementLayout>
32+
</DsfrLayout>
33+
);
34+
}
35+
36+
const getTool = async () => {
37+
const tool: DocumentElasticResult<ElasticTool> = await fetchTool(
38+
"convention-collective"
39+
);
40+
41+
if (!tool) {
42+
return notFound();
43+
}
44+
return tool;
45+
};
46+
47+
export default FindAgreementByEnterprisePage;
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
import { DsfrLayout } from "../../../src/modules/layout";
2+
import { DocumentElasticResult } from "../../../src/modules/documents";
3+
import { fetchTool, FindAgreementLayout } from "../../../src/modules/outils";
4+
import { notFound } from "next/navigation";
5+
import { generateDefaultMetadata } from "../../../src/modules/common/metas";
6+
import { ElasticTool } from "../../../src/modules/outils/type";
7+
import { AgreementSearchIntro } from "../../../src/modules/convention-collective";
8+
import { agreementRelatedItems } from "../../../src/modules/convention-collective/agreementRelatedItems";
9+
import { SITE_URL } from "../../../src/config";
10+
11+
export async function generateMetadata() {
12+
const { title, description } = await getTool();
13+
14+
return generateDefaultMetadata({
15+
title: `Simulateur - ${title}`,
16+
description: description,
17+
path: `/outils/convention-collective`,
18+
overrideCanonical: `${SITE_URL}/outils/convention-collective`,
19+
});
20+
}
21+
22+
async function FindAgreementPage() {
23+
const tool = await getTool();
24+
return (
25+
<DsfrLayout>
26+
<FindAgreementLayout
27+
relatedItems={agreementRelatedItems}
28+
description={tool.description}
29+
>
30+
<AgreementSearchIntro />
31+
</FindAgreementLayout>
32+
</DsfrLayout>
33+
);
34+
}
35+
36+
const getTool = async () => {
37+
const tool: DocumentElasticResult<ElasticTool> = await fetchTool(
38+
"convention-collective"
39+
);
40+
41+
if (!tool) {
42+
return notFound();
43+
}
44+
return tool;
45+
};
46+
47+
export default FindAgreementPage;
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
import { DocumentElasticResult } from "../../../../../src/modules/documents";
2+
import {
3+
fetchTool,
4+
FindAgreementWidgetLayout,
5+
} from "../../../../../src/modules/outils";
6+
import { notFound } from "next/navigation";
7+
import { generateDefaultMetadata } from "../../../../../src/modules/common/metas";
8+
import { ElasticTool } from "../../../../../src/modules/outils/type";
9+
import { EnterpriseAgreementSelection } from "../../../../../src/modules/enterprise";
10+
import { searchEnterprises } from "../../../../../src/modules/enterprise/queries";
11+
import { SITE_URL } from "../../../../../src/config";
12+
13+
export async function generateMetadata({ params }) {
14+
const { title, description } = await getTool();
15+
16+
return generateDefaultMetadata({
17+
title: `Simulateur - ${title}`,
18+
description: description,
19+
path: `${SITE_URL}/widgets/convention-collective/selection/${params.slug}`,
20+
overrideCanonical: `${SITE_URL}/outils/convention-collective`,
21+
});
22+
}
23+
24+
async function AgreementSelectionPage({ params }) {
25+
const [enterprise] = await searchEnterprises({
26+
query: params.slug,
27+
});
28+
return (
29+
<FindAgreementWidgetLayout>
30+
<EnterpriseAgreementSelection enterprise={enterprise} widgetMode />
31+
</FindAgreementWidgetLayout>
32+
);
33+
}
34+
35+
const getTool = async () => {
36+
const tool: DocumentElasticResult<ElasticTool> = await fetchTool(
37+
"convention-collective"
38+
);
39+
40+
if (!tool) {
41+
return notFound();
42+
}
43+
return tool;
44+
};
45+
46+
export default AgreementSelectionPage;
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
import { DocumentElasticResult } from "../../../src/modules/documents";
2+
import {
3+
fetchTool,
4+
FindAgreementWidgetLayout,
5+
} from "../../../src/modules/outils";
6+
import { notFound } from "next/navigation";
7+
import { generateDefaultMetadata } from "../../../src/modules/common/metas";
8+
import { ElasticTool } from "../../../src/modules/outils/type";
9+
import { EnterpriseAgreementSearch } from "../../../src/modules/enterprise";
10+
import { SITE_URL } from "../../../src/config";
11+
12+
export async function generateMetadata() {
13+
const { title, description } = await getTool();
14+
15+
return generateDefaultMetadata({
16+
title: `Simulateur - ${title}`,
17+
description: description,
18+
path: `${SITE_URL}/widgets/convention-collective`,
19+
overrideCanonical: `${SITE_URL}/outils/convention-collective`,
20+
});
21+
}
22+
23+
async function FindAgreementByEnterprisePage() {
24+
return (
25+
<FindAgreementWidgetLayout>
26+
<EnterpriseAgreementSearch widgetMode />
27+
</FindAgreementWidgetLayout>
28+
);
29+
}
30+
31+
const getTool = async () => {
32+
const tool: DocumentElasticResult<ElasticTool> = await fetchTool(
33+
"convention-collective"
34+
);
35+
36+
if (!tool) {
37+
return notFound();
38+
}
39+
return tool;
40+
};
41+
42+
export default FindAgreementByEnterprisePage;

packages/code-du-travail-frontend/cypress/integration/light/integration-convention-collective.spec.ts

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,3 @@
1-
Cypress.Commands.add("getIframe" as any, () => {
2-
return cy
3-
.get("iframe")
4-
.its("0.contentDocument.body")
5-
.should("not.be.empty")
6-
.then(cy.wrap);
7-
});
8-
91
describe("Pages integration convention collective", () => {
102
it("should display iframe convention collective", () => {
113
cy.visit("/integration/convention-collective", {
@@ -14,17 +6,25 @@ describe("Pages integration convention collective", () => {
146
},
157
});
168

17-
// @ts-ignore
18-
cy.getIframe().as("iframe");
9+
cy.frameLoaded({ url: "/widgets/convention-collective" });
10+
11+
cy.iframe()
12+
.findByRole("heading", { level: 1 })
13+
.should("have.text", "Trouver sa convention collective")
14+
.click();
15+
16+
cy.iframe()
17+
// @ts-ignore
18+
.findByLabel("Nom de votre entreprise ou numéro Siren/Siret")
19+
.as("inputSiret");
20+
21+
cy.get("@inputSiret").type("carrefour", { force: true });
1922

20-
cy.get("@iframe").contains("Trouver sa convention collective");
21-
cy.get("@iframe").find("#enterprise-search").as("entreprise-search");
22-
cy.get("@entreprise-search").type("carrefour");
23-
cy.get("@iframe").find("button[type=submit]").as("button-submit");
24-
cy.get("@button-submit").click();
25-
cy.get("@iframe").contains("CARREFOUR HYPERMARCHES").as("entreprise");
26-
cy.get("@entreprise").click();
27-
cy.get("@iframe").contains("Conventions collectives").as("cc");
23+
cy.iframe().find("button[type=submit]").contains("Rechercher").click();
24+
cy.iframe().contains("CARREFOUR HYPERMARCHES").click();
25+
cy.iframe()
26+
.contains("Commerce de détail et de gros à prédominance alimentaire")
27+
.as("cc");
2828
cy.get("@cc").click();
2929
cy.get("@postMessage")
3030
.should("have.been.calledOnce")

0 commit comments

Comments
 (0)