@compagnat/dc-common-ui 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +144 -0
- package/dist/index.js +8273 -0
- package/dist/src/hooks/CookieConsent.d.ts +28 -0
- package/dist/src/hooks/CookieConsent.test.d.ts +1 -0
- package/dist/src/hooks/MessageContext.d.ts +22 -0
- package/dist/src/hooks/MessageContext.test.d.ts +1 -0
- package/dist/src/index.d.ts +2 -0
- package/dist/src/test/setup.d.ts +0 -0
- package/package.json +61 -0
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { default as React, ReactNode } from 'react';
|
|
2
|
+
interface CookieConsentState {
|
|
3
|
+
/** null = pas encore répondu, true = accepté, false = refusé */
|
|
4
|
+
analytics: boolean | null;
|
|
5
|
+
/** Toujours true — cookies nécessaires au fonctionnement */
|
|
6
|
+
necessary: true;
|
|
7
|
+
}
|
|
8
|
+
interface CookieConsentContextValue {
|
|
9
|
+
consent: CookieConsentState;
|
|
10
|
+
/** true tant que l'utilisateur n'a pas répondu */
|
|
11
|
+
showBanner: boolean;
|
|
12
|
+
acceptAnalytics: () => void;
|
|
13
|
+
declineAnalytics: () => void;
|
|
14
|
+
/** Permet de ré-ouvrir le choix (ex: depuis les paramètres) */
|
|
15
|
+
resetConsent: () => void;
|
|
16
|
+
}
|
|
17
|
+
export declare function CookieConsentProvider({ gtmId, children }: {
|
|
18
|
+
gtmId: string;
|
|
19
|
+
children: ReactNode;
|
|
20
|
+
}): React.JSX.Element;
|
|
21
|
+
export declare function useCookieConsent(): CookieConsentContextValue;
|
|
22
|
+
export declare function CookieConsentBanner(): React.JSX.Element;
|
|
23
|
+
declare global {
|
|
24
|
+
interface Window {
|
|
25
|
+
dataLayer: Record<string, unknown>[];
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
export declare enum Severity {
|
|
3
|
+
Success = "success",
|
|
4
|
+
Error = "error",
|
|
5
|
+
Info = "info",
|
|
6
|
+
Warning = "warning"
|
|
7
|
+
}
|
|
8
|
+
interface MessageContextType {
|
|
9
|
+
sendMessage: (msg: string, sev?: Severity, ttl?: string | null) => void;
|
|
10
|
+
sendSuccessMessage: (msgKey: string, titleKey?: string | null) => void;
|
|
11
|
+
sendErrorMessage: (msgKey: string, titleKey?: string | null) => void;
|
|
12
|
+
sendInfoMessage: (msgKey: string, titleKey?: string | null) => void;
|
|
13
|
+
sendWarningMessage: (msgKey: string, titleKey?: string | null) => void;
|
|
14
|
+
}
|
|
15
|
+
export declare function sendGlobalSuccessMessage(msgKey: string, titleKey?: string | null): void;
|
|
16
|
+
export declare function sendGlobalErrorMessage(msgKey: string, titleKey?: string | null): void;
|
|
17
|
+
export declare function sendGlobalMessage(msg: string, sev?: Severity, ttl?: string | null): void;
|
|
18
|
+
export declare function useMessage(): MessageContextType;
|
|
19
|
+
export declare function MessageProvider({ children }: {
|
|
20
|
+
children: React.ReactNode;
|
|
21
|
+
}): React.JSX.Element;
|
|
22
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
File without changes
|
package/package.json
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@compagnat/dc-common-ui",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"private": false,
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./dist/index.cjs",
|
|
7
|
+
"module": "./dist/index.js",
|
|
8
|
+
"types": "./dist/index.d.ts",
|
|
9
|
+
"exports": {
|
|
10
|
+
".": {
|
|
11
|
+
"types": "./dist/index.d.ts",
|
|
12
|
+
"import": "./dist/index.js",
|
|
13
|
+
"require": "./dist/index.cjs"
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
"publishConfig": {
|
|
17
|
+
"access": "public"
|
|
18
|
+
},
|
|
19
|
+
"files": [
|
|
20
|
+
"dist"
|
|
21
|
+
],
|
|
22
|
+
"scripts": {
|
|
23
|
+
"dev": "vite build --watch",
|
|
24
|
+
"build": "vite build",
|
|
25
|
+
"lint": "eslint src/",
|
|
26
|
+
"format": "prettier --write \"src/**/*.{ts,tsx,css,json}\"",
|
|
27
|
+
"format:check": "prettier --check \"src/**/*.{ts,tsx,css,json}\"",
|
|
28
|
+
"test": "vitest run",
|
|
29
|
+
"test:watch": "vitest",
|
|
30
|
+
"typecheck": "tsc --noEmit"
|
|
31
|
+
},
|
|
32
|
+
"peerDependencies": {
|
|
33
|
+
"@emotion/react": "^11.14.0",
|
|
34
|
+
"@emotion/styled": "^11.14.1",
|
|
35
|
+
"@mui/icons-material": "^9.0.1",
|
|
36
|
+
"@mui/material": "^9.0.1",
|
|
37
|
+
"i18next": "^26.3.1",
|
|
38
|
+
"react": "^18.0.0 || ^19.0.0",
|
|
39
|
+
"react-dom": "^18.0.0 || ^19.0.0",
|
|
40
|
+
"react-gtm-module": "^2.0.11",
|
|
41
|
+
"react-i18next": "^17.0.8"
|
|
42
|
+
},
|
|
43
|
+
"devDependencies": {
|
|
44
|
+
"@eslint/js": "^10.0.1",
|
|
45
|
+
"@testing-library/jest-dom": "^6.9.1",
|
|
46
|
+
"@testing-library/react": "^16.3.2",
|
|
47
|
+
"@types/react": "^19.2.17",
|
|
48
|
+
"@types/react-dom": "^19.2.3",
|
|
49
|
+
"@vitejs/plugin-react": "^6.0.2",
|
|
50
|
+
"eslint": "^10.4.1",
|
|
51
|
+
"eslint-plugin-react-hooks": "^7.1.1",
|
|
52
|
+
"globals": "^17.6.0",
|
|
53
|
+
"jsdom": "^29.1.1",
|
|
54
|
+
"prettier": "^3.8.3",
|
|
55
|
+
"typescript": "^6.0.3",
|
|
56
|
+
"typescript-eslint": "^8.60.1",
|
|
57
|
+
"vite": "^8.0.16",
|
|
58
|
+
"vite-plugin-dts": "^5.0.2",
|
|
59
|
+
"vitest": "^4.1.8"
|
|
60
|
+
}
|
|
61
|
+
}
|