diff --git a/test/integration/cra/src/Home.tsx b/test/integration/cra/src/Home.tsx
index b0b74791d..45f6fda8c 100644
--- a/test/integration/cra/src/Home.tsx
+++ b/test/integration/cra/src/Home.tsx
@@ -3,9 +3,7 @@ import { fr } from "@codegouvfr/react-dsfr";
import { useIsDark } from "@codegouvfr/react-dsfr/useIsDark";
import { SideMenu } from "@codegouvfr/react-dsfr/SideMenu";
import { Table } from "@codegouvfr/react-dsfr/Table";
-import { useGdprStore } from "@codegouvfr/react-dsfr/useGdprStore"
import { ButtonsGroup } from '@codegouvfr/react-dsfr/ButtonsGroup';
-import { consentModalNativeButtonProps } from '@codegouvfr/react-dsfr/ConsentBanner';
const sideMenuItems = [
{
@@ -109,7 +107,6 @@ export function Home() {
/>
{JSON.stringify({consents, firstChoiceMade})}- >; -} \ No newline at end of file diff --git a/test/integration/cra/src/index.tsx b/test/integration/cra/src/index.tsx index b2d594ffb..5fe5a990e 100644 --- a/test/integration/cra/src/index.tsx +++ b/test/integration/cra/src/index.tsx @@ -9,19 +9,12 @@ import { Header } from "@codegouvfr/react-dsfr/Header"; import { fr } from "@codegouvfr/react-dsfr"; import { routes } from "./router"; import { headerFooterDisplayItem } from "@codegouvfr/react-dsfr/Display"; -import { GdprStoreProvider } from "@codegouvfr/react-dsfr/gdpr"; -import { ConsentBanner } from '@codegouvfr/react-dsfr/ConsentBanner'; startReactDsfr({ "defaultColorScheme": "system" }); -declare module "@codegouvfr/react-dsfr/gdpr" { - interface RegisterGdprServices { - matomo: never; - } -} createRoot(document.getElementById("root")!).render(
{JSON.stringify({consents, firstChoiceMade})}- >; -} diff --git a/test/integration/vite/src/gdpr.tsx b/test/integration/vite/src/gdpr.tsx new file mode 100644 index 000000000..64bf5c4c1 --- /dev/null +++ b/test/integration/vite/src/gdpr.tsx @@ -0,0 +1,46 @@ +"use client"; + +import { createGdprApi } from "@codegouvfr/react-dsfr/gdpr"; + +export const { + ConsentBannerAndConsentManagement, + useGdpr, + FooterConsentManagementItem, + FooterPersonalDataPolicyItem +} = createGdprApi({ + "finalityDescription": ({ lang }) => ({ + "advertising": { + "title": "Publicité", + "description": "Nous utilisons des cookies pour vous proposer des publicités adaptées à vos centres d’intérêts et mesurer leur efficacité." + }, + "analytics": { + "title": "Analyse", + "description": "Nous utilisons des cookies pour mesurer l’audience de notre site et améliorer son contenu." + }, + "personalization": { + "title": "Personnalisation", + "description": "Nous utilisons des cookies pour vous proposer des contenus adaptés à vos centres d’intérêts." + }, + "statistics": { + "title": "Statistiques", + "description": "Nous utilisons des cookies pour mesurer l’audience de notre site et améliorer son contenu.", + "subFinalities": { + "deviceInfo": "Informations sur votre appareil", + "traffic": "Informations sur votre navigation", + } + } + }), + "personalDataPolicyLinkProps": { + "to": "#", + "onClick": ()=> { + alert("Navigate or display your data policy"); + } + }, + "consentCallback": async ({ finalityConsent, finalityConsent_prev })=> { + console.log("callback from gdpr hook", { finalityConsent, finalityConsent_prev }); + } +}); + + + + diff --git a/test/integration/vite/src/main.tsx b/test/integration/vite/src/main.tsx index 4f67f9f98..f9719f8da 100644 --- a/test/integration/vite/src/main.tsx +++ b/test/integration/vite/src/main.tsx @@ -10,8 +10,7 @@ import { Routes, Route, Link, useLocation } from "react-router-dom"; import { headerFooterDisplayItem } from "@codegouvfr/react-dsfr/Display"; import { GlobalStyles } from "tss-react"; import { fr } from "@codegouvfr/react-dsfr"; -import { GdprStoreProvider } from "@codegouvfr/react-dsfr/gdpr"; -import { ConsentBanner } from '@codegouvfr/react-dsfr/ConsentBanner'; +import { ConsentBannerAndConsentManagement, FooterConsentManagementItem, FooterPersonalDataPolicyItem } from "./gdpr"; startReactDsfr({ "defaultColorScheme": "system", Link }); @@ -21,11 +20,6 @@ declare module "@codegouvfr/react-dsfr/spa" { } } -declare module "@codegouvfr/react-dsfr/gdpr" { - interface RegisterGdprServices { - matomo: never; - } -} ReactDOM.createRoot(document.getElementById("root") as HTMLElement).render(