Skip to content

Commit e73ef4b

Browse files
committed
Fix integration vite app build
1 parent 7832eee commit e73ef4b

File tree

2 files changed

+13
-14
lines changed

2 files changed

+13
-14
lines changed

test/integration/vite/src/gdpr.tsx renamed to test/integration/vite/src/consentManagement.tsx

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
"use client";
22

3-
import { createGdprApi } from "@codegouvfr/react-dsfr/gdpr";
3+
import { createConsentManagement } from "@codegouvfr/react-dsfr/consentManagement";
44

55
export const {
66
ConsentBannerAndConsentManagement,
7-
useGdpr,
87
FooterConsentManagementItem,
9-
FooterPersonalDataPolicyItem
10-
} = createGdprApi({
8+
FooterPersonalDataPolicyItem,
9+
useConsent
10+
} = createConsentManagement({
1111
"finalityDescription": ({ lang }) => ({
1212
"advertising": {
1313
"title": "Publicité",
@@ -31,16 +31,15 @@ export const {
3131
}
3232
}),
3333
"personalDataPolicyLinkProps": {
34-
"to": "#",
35-
"onClick": ()=> {
36-
alert("Navigate or display your data policy");
37-
}
34+
"to": "/politique-de-confidentialite",
3835
},
3936
"consentCallback": async ({ finalityConsent, finalityConsent_prev })=> {
40-
console.log("callback from gdpr hook", { finalityConsent, finalityConsent_prev });
41-
}
42-
});
43-
44-
4537

38+
if( finalityConsent_prev === undefined && !finalityConsent.isFullConsent ){
39+
location.reload();
40+
await new Promise(()=> {/*never*/});
41+
}
4642

43+
console.log("callback from gdpr hook");
44+
}
45+
});

test/integration/vite/src/main.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import { Routes, Route, Link, useLocation } from "react-router-dom";
1010
import { headerFooterDisplayItem } from "@codegouvfr/react-dsfr/Display";
1111
import { GlobalStyles } from "tss-react";
1212
import { fr } from "@codegouvfr/react-dsfr";
13-
import { ConsentBannerAndConsentManagement, FooterConsentManagementItem, FooterPersonalDataPolicyItem } from "./gdpr";
13+
import { ConsentBannerAndConsentManagement, FooterConsentManagementItem, FooterPersonalDataPolicyItem } from "./consentManagement";
1414

1515
startReactDsfr({ "defaultColorScheme": "system", Link });
1616

0 commit comments

Comments
 (0)