Skip to content

Commit 029fbf3

Browse files
committed
self review
1 parent 4c7163e commit 029fbf3

File tree

3 files changed

+16
-4
lines changed

3 files changed

+16
-4
lines changed

src/gdpr/types.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,19 @@
11
/**
22
* format: `<serviceName>: never`
3+
*
4+
* The value can be anything (or `never`), but you can set `true`
5+
* as a reminder that this service is mandatory.
36
* @example
47
* ```ts
58
* declare module "@codegouvfr/react-dsfr/gdpr" {
69
* interface RegisterGdprServices {
7-
* matomo: never;
10+
* matomo: true;
811
* youtube: never;
912
* }
1013
* }
1114
* ```
1215
*/
13-
// eslint-disable-next-line @typescript-eslint/no-empty-interface
16+
// eslint-disable-next-line @typescript-eslint/no-empty-interface -- for later augment
1417
export interface RegisterGdprServices {}
1518
export type GdprServiceName = keyof RegisterGdprServices extends never
1619
? string

stories/ConsentBanner.stories.tsx

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,16 @@ the consent state.
2525
import { Footer } from "@codegouvfr/react-dsfr/Footer";
2626
import { ConsentBanner, consentModalButtonProps } from "@codegouvfr/react-dsfr/ConsentBanner";
2727
28+
// You can augment the service registry to have autocomplete when using useGdprStore
29+
declare module "@codegouvfr/react-dsfr/gdpr" {
30+
interface RegisterGdprServices {
31+
// the value can be anything (or never), but you can set true
32+
// as a reminder that this service is mandatory
33+
mandatory-cookie-consumer: true;
34+
cookie-consumer: never;
35+
}
36+
}
37+
2838
function App(){
2939
3040
return (

test/integration/next-appdir/app/layout.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,14 @@ import { Footer } from "@codegouvfr/react-dsfr/Footer";
1111
import { Display, headerFooterDisplayItem } from "@codegouvfr/react-dsfr/Display";
1212
import { fr } from "@codegouvfr/react-dsfr";
1313
import { Navigation } from "./Navigation";
14-
import Link from 'next/link';
1514

1615
const brandTop = <>INTITULE<br />OFFICIEL</>;
1716

1817
const homeLinkPops = { "href": "/", "title": "Accueil - Nom de l’entité (ministère, secrétariat d‘état, gouvernement)" };
1918

2019
declare module "@codegouvfr/react-dsfr/gdpr" {
2120
interface RegisterGdprServices {
22-
matomo: true;
21+
matomo: never;
2322
}
2423
}
2524

0 commit comments

Comments
 (0)