@c15t/react 0.0.1-rc.13 → 0.0.1-rc.14
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/components/consent-manager-dialog/__tests__/styles.spec.cjs +7 -7
- package/dist/components/consent-manager-dialog/__tests__/styles.spec.js +6 -6
- package/dist/components/consent-manager-dialog/consent-manager-dialog_module.css +3 -3
- package/dist/components/consent-manager-widget/__tests__/styles.spec.cjs +7 -7
- package/dist/components/consent-manager-widget/__tests__/styles.spec.js +6 -6
- package/dist/components/cookie-banner/__tests__/styles.spec.cjs +24 -7
- package/dist/components/cookie-banner/__tests__/styles.spec.js +23 -6
- package/dist/components/cookie-banner/error-boundary.cjs +0 -1
- package/dist/components/cookie-banner/error-boundary.js +0 -1
- package/dist/components/shared/libs/polymorphic.d.ts +1 -7
- package/dist/components/shared/libs/polymorphic.d.ts.map +1 -1
- package/dist/components/shared/primitives/button.types.d.ts +1 -8
- package/dist/components/shared/primitives/button.types.d.ts.map +1 -1
- package/dist/components/shared/ui/accordion/accordion.types.d.ts +0 -10
- package/dist/components/shared/ui/accordion/accordion.types.d.ts.map +1 -1
- package/dist/components/shared/ui/logo.cjs +4 -5
- package/dist/components/shared/ui/logo.d.ts.map +1 -1
- package/dist/components/shared/ui/logo.js +4 -5
- package/dist/context/consent-manager-context.d.ts +2 -2
- package/dist/context/consent-manager-context.d.ts.map +1 -1
- package/dist/hooks/use-consent-manager.cjs +2 -2
- package/dist/hooks/use-consent-manager.d.ts +2 -7
- package/dist/hooks/use-consent-manager.d.ts.map +1 -1
- package/dist/hooks/use-consent-manager.js +2 -2
- package/dist/hooks/use-focus-trap.cjs +1 -1
- package/dist/hooks/use-focus-trap.js +1 -1
- package/dist/hooks/use-theme.d.ts.map +1 -1
- package/dist/index.cjs +6 -12
- package/dist/index.d.ts +1 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -4
- package/dist/providers/consent-manager-provider.cjs +26 -18
- package/dist/providers/consent-manager-provider.d.ts +16 -2
- package/dist/providers/consent-manager-provider.d.ts.map +1 -1
- package/dist/providers/consent-manager-provider.js +26 -18
- package/dist/types/consent-manager.d.ts +26 -55
- package/dist/types/consent-manager.d.ts.map +1 -1
- package/dist/utils/cn.cjs +0 -2
- package/dist/utils/cn.d.ts +1 -5
- package/dist/utils/cn.d.ts.map +1 -1
- package/dist/utils/cn.js +1 -2
- package/dist/{components/consent-manager-dialog/__tests__/utils.cjs → utils/test-helpers.cjs} +26 -28
- package/dist/utils/test-helpers.d.ts +30 -0
- package/dist/utils/test-helpers.d.ts.map +1 -0
- package/dist/utils/test-helpers.js +36 -0
- package/package.json +2 -2
- package/dist/components/consent-manager-dialog/__tests__/utils.d.ts +0 -13
- package/dist/components/consent-manager-dialog/__tests__/utils.d.ts.map +0 -1
- package/dist/components/consent-manager-dialog/__tests__/utils.js +0 -39
- package/dist/components/consent-manager-widget/__tests__/utils.cjs +0 -71
- package/dist/components/consent-manager-widget/__tests__/utils.d.ts +0 -13
- package/dist/components/consent-manager-widget/__tests__/utils.d.ts.map +0 -1
- package/dist/components/consent-manager-widget/__tests__/utils.js +0 -39
- package/dist/components/consent-manager-widget/atoms/logo.cjs +0 -99
- package/dist/components/consent-manager-widget/atoms/logo.d.ts +0 -8
- package/dist/components/consent-manager-widget/atoms/logo.d.ts.map +0 -1
- package/dist/components/consent-manager-widget/atoms/logo.js +0 -67
- package/dist/components/cookie-banner/__tests__/utils.cjs +0 -70
- package/dist/components/cookie-banner/__tests__/utils.d.ts +0 -13
- package/dist/components/cookie-banner/__tests__/utils.d.ts.map +0 -1
- package/dist/components/cookie-banner/__tests__/utils.js +0 -38
- package/dist/hooks/use-consent-client.cjs +0 -41
- package/dist/hooks/use-consent-client.d.ts +0 -26
- package/dist/hooks/use-consent-client.d.ts.map +0 -1
- package/dist/hooks/use-consent-client.js +0 -9
package/dist/index.cjs
CHANGED
|
@@ -12,9 +12,6 @@ var __webpack_modules__ = {
|
|
|
12
12
|
"./hooks/use-color-scheme": function(module) {
|
|
13
13
|
module.exports = require("./hooks/use-color-scheme.cjs");
|
|
14
14
|
},
|
|
15
|
-
"./hooks/use-consent-client": function(module) {
|
|
16
|
-
module.exports = require("./hooks/use-consent-client.cjs");
|
|
17
|
-
},
|
|
18
15
|
"./hooks/use-consent-manager": function(module) {
|
|
19
16
|
module.exports = require("./hooks/use-consent-manager.cjs");
|
|
20
17
|
},
|
|
@@ -79,9 +76,8 @@ var __webpack_exports__ = {};
|
|
|
79
76
|
ConsentManagerProvider: ()=>_providers_consent_manager_provider__WEBPACK_IMPORTED_MODULE_3__.ConsentManagerProvider,
|
|
80
77
|
ConsentManagerWidget: ()=>_components_consent_manager_widget_consent_manager_widget__WEBPACK_IMPORTED_MODULE_1__.ConsentManagerWidget,
|
|
81
78
|
CookieBanner: ()=>_components_cookie_banner_cookie_banner__WEBPACK_IMPORTED_MODULE_0__.CookieBanner,
|
|
82
|
-
|
|
79
|
+
configureConsentManager: ()=>c15t__WEBPACK_IMPORTED_MODULE_7__.configureConsentManager,
|
|
83
80
|
useColorScheme: ()=>_hooks_use_color_scheme__WEBPACK_IMPORTED_MODULE_6__.useColorScheme,
|
|
84
|
-
useConsentClient: ()=>_hooks_use_consent_client__WEBPACK_IMPORTED_MODULE_7__.useConsentClient,
|
|
85
81
|
useConsentManager: ()=>_hooks_use_consent_manager__WEBPACK_IMPORTED_MODULE_4__.useConsentManager,
|
|
86
82
|
useTranslations: ()=>_hooks_use_translations__WEBPACK_IMPORTED_MODULE_5__.useTranslations
|
|
87
83
|
});
|
|
@@ -92,23 +88,21 @@ var __webpack_exports__ = {};
|
|
|
92
88
|
var _hooks_use_consent_manager__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__("./hooks/use-consent-manager");
|
|
93
89
|
var _hooks_use_translations__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__("./hooks/use-translations");
|
|
94
90
|
var _hooks_use_color_scheme__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__("./hooks/use-color-scheme");
|
|
95
|
-
var
|
|
96
|
-
var
|
|
97
|
-
var _utils_translations__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__("./utils/translations");
|
|
91
|
+
var c15t__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__("c15t");
|
|
92
|
+
var _utils_translations__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__("./utils/translations");
|
|
98
93
|
var __WEBPACK_REEXPORT_OBJECT__ = {};
|
|
99
|
-
for(var __WEBPACK_IMPORT_KEY__ in
|
|
94
|
+
for(var __WEBPACK_IMPORT_KEY__ in _utils_translations__WEBPACK_IMPORTED_MODULE_8__)if ([
|
|
100
95
|
"useColorScheme",
|
|
101
96
|
"useTranslations",
|
|
102
97
|
"ConsentManagerWidget",
|
|
103
|
-
"
|
|
98
|
+
"configureConsentManager",
|
|
104
99
|
"CookieBanner",
|
|
105
100
|
"useConsentManager",
|
|
106
101
|
"default",
|
|
107
102
|
"ConsentManagerProvider",
|
|
108
|
-
"useConsentClient",
|
|
109
103
|
"ConsentManagerDialog"
|
|
110
104
|
].indexOf(__WEBPACK_IMPORT_KEY__) < 0) __WEBPACK_REEXPORT_OBJECT__[__WEBPACK_IMPORT_KEY__] = (function(key) {
|
|
111
|
-
return
|
|
105
|
+
return _utils_translations__WEBPACK_IMPORTED_MODULE_8__[key];
|
|
112
106
|
}).bind(0, __WEBPACK_IMPORT_KEY__);
|
|
113
107
|
__webpack_require__.d(__webpack_exports__, __WEBPACK_REEXPORT_OBJECT__);
|
|
114
108
|
})();
|
package/dist/index.d.ts
CHANGED
|
@@ -8,8 +8,7 @@ export { ConsentManagerProvider } from './providers/consent-manager-provider';
|
|
|
8
8
|
export { useConsentManager } from './hooks/use-consent-manager';
|
|
9
9
|
export { useTranslations } from './hooks/use-translations';
|
|
10
10
|
export { useColorScheme } from './hooks/use-color-scheme';
|
|
11
|
-
export {
|
|
12
|
-
export { createConsentClient, type c15tClient, type c15tClientOptions, } from 'c15t';
|
|
11
|
+
export { configureConsentManager, type ConsentManagerInterface, type ConsentManagerOptions, } from 'c15t';
|
|
13
12
|
export type { ConsentManagerProviderProps } from './types/consent-manager';
|
|
14
13
|
export * from './utils/translations';
|
|
15
14
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,0CAA0C,CAAC;AACxE,YAAY,EAAE,iBAAiB,EAAE,MAAM,0CAA0C,CAAC;AAClF,OAAO,EAAE,oBAAoB,EAAE,MAAM,4DAA4D,CAAC;AAClG,YAAY,EAAE,yBAAyB,EAAE,MAAM,2CAA2C,CAAC;AAC3F,OAAO,EAAE,oBAAoB,EAAE,MAAM,4DAA4D,CAAC;AAClG,YAAY,EAAE,yBAAyB,EAAE,MAAM,4DAA4D,CAAC;AAC5G,OAAO,EAAE,sBAAsB,EAAE,MAAM,sCAAsC,CAAC;AAG9E,OAAO,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAC3D,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAG1D,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,0CAA0C,CAAC;AACxE,YAAY,EAAE,iBAAiB,EAAE,MAAM,0CAA0C,CAAC;AAClF,OAAO,EAAE,oBAAoB,EAAE,MAAM,4DAA4D,CAAC;AAClG,YAAY,EAAE,yBAAyB,EAAE,MAAM,2CAA2C,CAAC;AAC3F,OAAO,EAAE,oBAAoB,EAAE,MAAM,4DAA4D,CAAC;AAClG,YAAY,EAAE,yBAAyB,EAAE,MAAM,4DAA4D,CAAC;AAC5G,OAAO,EAAE,sBAAsB,EAAE,MAAM,sCAAsC,CAAC;AAG9E,OAAO,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAC3D,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAG1D,OAAO,EACN,uBAAuB,EACvB,KAAK,uBAAuB,EAC5B,KAAK,qBAAqB,GAC1B,MAAM,MAAM,CAAC;AAGd,YAAY,EAAE,2BAA2B,EAAE,MAAM,yBAAyB,CAAC;AAG3E,cAAc,sBAAsB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -5,16 +5,14 @@ import * as __WEBPACK_EXTERNAL_MODULE__providers_consent_manager_provider_js_745
|
|
|
5
5
|
import * as __WEBPACK_EXTERNAL_MODULE__hooks_use_consent_manager_js_2b895421__ from "./hooks/use-consent-manager.js";
|
|
6
6
|
import * as __WEBPACK_EXTERNAL_MODULE__hooks_use_translations_js_78932b91__ from "./hooks/use-translations.js";
|
|
7
7
|
import * as __WEBPACK_EXTERNAL_MODULE__hooks_use_color_scheme_js_41dc75de__ from "./hooks/use-color-scheme.js";
|
|
8
|
-
import * as __WEBPACK_EXTERNAL_MODULE__hooks_use_consent_client_js_2afe8c6b__ from "./hooks/use-consent-client.js";
|
|
9
8
|
import * as __WEBPACK_EXTERNAL_MODULE_c15t__ from "c15t";
|
|
10
9
|
export * from "./utils/translations.js";
|
|
11
10
|
var __webpack_exports__ConsentManagerDialog = __WEBPACK_EXTERNAL_MODULE__components_consent_manager_dialog_consent_manager_dialog_js_d74113dd__.ConsentManagerDialog;
|
|
12
11
|
var __webpack_exports__ConsentManagerProvider = __WEBPACK_EXTERNAL_MODULE__providers_consent_manager_provider_js_7459f585__.ConsentManagerProvider;
|
|
13
12
|
var __webpack_exports__ConsentManagerWidget = __WEBPACK_EXTERNAL_MODULE__components_consent_manager_widget_consent_manager_widget_js_080fb908__.ConsentManagerWidget;
|
|
14
13
|
var __webpack_exports__CookieBanner = __WEBPACK_EXTERNAL_MODULE__components_cookie_banner_cookie_banner_js_aba0c776__.CookieBanner;
|
|
15
|
-
var
|
|
14
|
+
var __webpack_exports__configureConsentManager = __WEBPACK_EXTERNAL_MODULE_c15t__.configureConsentManager;
|
|
16
15
|
var __webpack_exports__useColorScheme = __WEBPACK_EXTERNAL_MODULE__hooks_use_color_scheme_js_41dc75de__.useColorScheme;
|
|
17
|
-
var __webpack_exports__useConsentClient = __WEBPACK_EXTERNAL_MODULE__hooks_use_consent_client_js_2afe8c6b__.useConsentClient;
|
|
18
16
|
var __webpack_exports__useConsentManager = __WEBPACK_EXTERNAL_MODULE__hooks_use_consent_manager_js_2b895421__.useConsentManager;
|
|
19
17
|
var __webpack_exports__useTranslations = __WEBPACK_EXTERNAL_MODULE__hooks_use_translations_js_78932b91__.useTranslations;
|
|
20
|
-
export { __webpack_exports__ConsentManagerDialog as ConsentManagerDialog, __webpack_exports__ConsentManagerProvider as ConsentManagerProvider, __webpack_exports__ConsentManagerWidget as ConsentManagerWidget, __webpack_exports__CookieBanner as CookieBanner,
|
|
18
|
+
export { __webpack_exports__ConsentManagerDialog as ConsentManagerDialog, __webpack_exports__ConsentManagerProvider as ConsentManagerProvider, __webpack_exports__ConsentManagerWidget as ConsentManagerWidget, __webpack_exports__CookieBanner as CookieBanner, __webpack_exports__configureConsentManager as configureConsentManager, __webpack_exports__useColorScheme as useColorScheme, __webpack_exports__useConsentManager as useConsentManager, __webpack_exports__useTranslations as useTranslations };
|
|
@@ -34,7 +34,10 @@ const consent_manager_context_cjs_namespaceObject = require("../context/consent-
|
|
|
34
34
|
const translations_cjs_namespaceObject = require("../utils/translations.cjs");
|
|
35
35
|
const theme_context_cjs_namespaceObject = require("../context/theme-context.cjs");
|
|
36
36
|
const use_color_scheme_cjs_namespaceObject = require("../hooks/use-color-scheme.cjs");
|
|
37
|
-
function ConsentManagerProvider({ children,
|
|
37
|
+
function ConsentManagerProvider({ children, options }) {
|
|
38
|
+
const { store = {}, translations: translationConfig, react = {} } = options;
|
|
39
|
+
const { initialGdprTypes, initialComplianceSettings } = store;
|
|
40
|
+
const { theme, disableAnimation = false, scrollLock = false, trapFocus = true, colorScheme = 'system', noStyle = false } = react;
|
|
38
41
|
const preparedTranslationConfig = (0, external_react_namespaceObject.useMemo)(()=>{
|
|
39
42
|
const mergedConfig = (0, translations_cjs_namespaceObject.mergeTranslationConfigs)(external_c15t_namespaceObject.defaultTranslationConfig, translationConfig);
|
|
40
43
|
const defaultLanguage = (0, translations_cjs_namespaceObject.detectBrowserLanguage)(mergedConfig.translations, mergedConfig.defaultLanguage, mergedConfig.disableAutoLanguageSwitch);
|
|
@@ -45,45 +48,50 @@ function ConsentManagerProvider({ children, initialGdprTypes, initialComplianceS
|
|
|
45
48
|
}, [
|
|
46
49
|
translationConfig
|
|
47
50
|
]);
|
|
48
|
-
const
|
|
49
|
-
|
|
50
|
-
|
|
51
|
+
const consentManager = (0, external_react_namespaceObject.useMemo)(()=>{
|
|
52
|
+
if (!options) throw new Error('ConsentManagerProvider requires options to be provided');
|
|
53
|
+
const { store, translations, react, ...coreOpts } = options;
|
|
54
|
+
return (0, external_c15t_namespaceObject.configureConsentManager)(coreOpts);
|
|
55
|
+
}, [
|
|
56
|
+
options
|
|
57
|
+
]);
|
|
58
|
+
const consentStore = (0, external_react_namespaceObject.useMemo)(()=>{
|
|
59
|
+
const storeWithTranslations = {
|
|
60
|
+
...store,
|
|
61
|
+
translationConfig: preparedTranslationConfig
|
|
51
62
|
};
|
|
52
|
-
|
|
53
|
-
store.getState().setTranslationConfig(preparedTranslationConfig);
|
|
54
|
-
return store;
|
|
63
|
+
return (0, external_c15t_namespaceObject.createConsentManagerStore)(consentManager, storeWithTranslations);
|
|
55
64
|
}, [
|
|
56
|
-
|
|
65
|
+
store,
|
|
57
66
|
preparedTranslationConfig,
|
|
58
|
-
|
|
59
|
-
client
|
|
67
|
+
consentManager
|
|
60
68
|
]);
|
|
61
|
-
const [state, setState] = (0, external_react_namespaceObject.useState)(
|
|
69
|
+
const [state, setState] = (0, external_react_namespaceObject.useState)(consentStore.getState());
|
|
62
70
|
(0, external_react_namespaceObject.useEffect)(()=>{
|
|
63
|
-
const { setGdprTypes, setComplianceSetting, setDetectedCountry } =
|
|
71
|
+
const { setGdprTypes, setComplianceSetting, setDetectedCountry } = consentStore.getState();
|
|
64
72
|
if (initialGdprTypes) setGdprTypes(initialGdprTypes);
|
|
65
73
|
if (initialComplianceSettings) for (const [region, settings] of Object.entries(initialComplianceSettings))setComplianceSetting(region, settings);
|
|
66
74
|
const country = document.querySelector('meta[name="user-country"]')?.getAttribute('content') || 'US';
|
|
67
75
|
setDetectedCountry(country);
|
|
68
|
-
const unsubscribe =
|
|
76
|
+
const unsubscribe = consentStore.subscribe((newState)=>{
|
|
69
77
|
setState(newState);
|
|
70
78
|
});
|
|
71
79
|
return ()=>{
|
|
72
80
|
unsubscribe();
|
|
73
81
|
};
|
|
74
82
|
}, [
|
|
75
|
-
|
|
83
|
+
consentStore,
|
|
76
84
|
initialGdprTypes,
|
|
77
85
|
initialComplianceSettings
|
|
78
86
|
]);
|
|
79
87
|
const contextValue = (0, external_react_namespaceObject.useMemo)(()=>({
|
|
80
88
|
state,
|
|
81
|
-
store,
|
|
82
|
-
|
|
89
|
+
store: consentStore,
|
|
90
|
+
manager: consentManager
|
|
83
91
|
}), [
|
|
84
92
|
state,
|
|
85
|
-
|
|
86
|
-
|
|
93
|
+
consentStore,
|
|
94
|
+
consentManager
|
|
87
95
|
]);
|
|
88
96
|
const themeContextValue = (0, external_react_namespaceObject.useMemo)(()=>({
|
|
89
97
|
theme,
|
|
@@ -9,12 +9,26 @@ import type { ConsentManagerProviderProps } from '../types/consent-manager';
|
|
|
9
9
|
* @remarks
|
|
10
10
|
* This component initializes and manages the consent management system, including:
|
|
11
11
|
* - Setting up the consent store with initial configuration
|
|
12
|
-
* -
|
|
12
|
+
* - Creating a consent manager from the provided options
|
|
13
13
|
* - Detecting user's region for compliance
|
|
14
14
|
* - Managing consent state updates
|
|
15
15
|
* - Providing access to consent management throughout the app
|
|
16
16
|
*
|
|
17
|
+
* @example
|
|
18
|
+
* ```tsx
|
|
19
|
+
* <ConsentManagerProvider
|
|
20
|
+
* options={{
|
|
21
|
+
* mode: 'offline',
|
|
22
|
+
* callbacks: {
|
|
23
|
+
* onConsentSet: (response) => console.log('Consent updated')
|
|
24
|
+
* }
|
|
25
|
+
* }}
|
|
26
|
+
* >
|
|
27
|
+
* {children}
|
|
28
|
+
* </ConsentManagerProvider>
|
|
29
|
+
* ```
|
|
30
|
+
*
|
|
17
31
|
* @public
|
|
18
32
|
*/
|
|
19
|
-
export declare function ConsentManagerProvider({ children,
|
|
33
|
+
export declare function ConsentManagerProvider({ children, options, }: ConsentManagerProviderProps): import("react/jsx-runtime").JSX.Element;
|
|
20
34
|
//# sourceMappingURL=consent-manager-provider.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"consent-manager-provider.d.ts","sourceRoot":"","sources":["../../src/providers/consent-manager-provider.tsx"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,0BAA0B,CAAC;AAQ5E;;;GAGG;AAEH
|
|
1
|
+
{"version":3,"file":"consent-manager-provider.d.ts","sourceRoot":"","sources":["../../src/providers/consent-manager-provider.tsx"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,0BAA0B,CAAC;AAQ5E;;;GAGG;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,wBAAgB,sBAAsB,CAAC,EACtC,QAAQ,EACR,OAAO,GACP,EAAE,2BAA2B,2CAkI7B"}
|
|
@@ -6,7 +6,10 @@ import * as __WEBPACK_EXTERNAL_MODULE__context_consent_manager_context_js_ee8f06
|
|
|
6
6
|
import * as __WEBPACK_EXTERNAL_MODULE__utils_translations_js_c2629c1f__ from "../utils/translations.js";
|
|
7
7
|
import * as __WEBPACK_EXTERNAL_MODULE__context_theme_context_js_fbb05439__ from "../context/theme-context.js";
|
|
8
8
|
import * as __WEBPACK_EXTERNAL_MODULE__hooks_use_color_scheme_js_939e374b__ from "../hooks/use-color-scheme.js";
|
|
9
|
-
function ConsentManagerProvider({ children,
|
|
9
|
+
function ConsentManagerProvider({ children, options }) {
|
|
10
|
+
const { store = {}, translations: translationConfig, react = {} } = options;
|
|
11
|
+
const { initialGdprTypes, initialComplianceSettings } = store;
|
|
12
|
+
const { theme, disableAnimation = false, scrollLock = false, trapFocus = true, colorScheme = 'system', noStyle = false } = react;
|
|
10
13
|
const preparedTranslationConfig = (0, __WEBPACK_EXTERNAL_MODULE_react__.useMemo)(()=>{
|
|
11
14
|
const mergedConfig = (0, __WEBPACK_EXTERNAL_MODULE__utils_translations_js_c2629c1f__.mergeTranslationConfigs)(__WEBPACK_EXTERNAL_MODULE_c15t__.defaultTranslationConfig, translationConfig);
|
|
12
15
|
const defaultLanguage = (0, __WEBPACK_EXTERNAL_MODULE__utils_translations_js_c2629c1f__.detectBrowserLanguage)(mergedConfig.translations, mergedConfig.defaultLanguage, mergedConfig.disableAutoLanguageSwitch);
|
|
@@ -17,45 +20,50 @@ function ConsentManagerProvider({ children, initialGdprTypes, initialComplianceS
|
|
|
17
20
|
}, [
|
|
18
21
|
translationConfig
|
|
19
22
|
]);
|
|
20
|
-
const
|
|
21
|
-
|
|
22
|
-
|
|
23
|
+
const consentManager = (0, __WEBPACK_EXTERNAL_MODULE_react__.useMemo)(()=>{
|
|
24
|
+
if (!options) throw new Error('ConsentManagerProvider requires options to be provided');
|
|
25
|
+
const { store, translations, react, ...coreOpts } = options;
|
|
26
|
+
return (0, __WEBPACK_EXTERNAL_MODULE_c15t__.configureConsentManager)(coreOpts);
|
|
27
|
+
}, [
|
|
28
|
+
options
|
|
29
|
+
]);
|
|
30
|
+
const consentStore = (0, __WEBPACK_EXTERNAL_MODULE_react__.useMemo)(()=>{
|
|
31
|
+
const storeWithTranslations = {
|
|
32
|
+
...store,
|
|
33
|
+
translationConfig: preparedTranslationConfig
|
|
23
34
|
};
|
|
24
|
-
|
|
25
|
-
store.getState().setTranslationConfig(preparedTranslationConfig);
|
|
26
|
-
return store;
|
|
35
|
+
return (0, __WEBPACK_EXTERNAL_MODULE_c15t__.createConsentManagerStore)(consentManager, storeWithTranslations);
|
|
27
36
|
}, [
|
|
28
|
-
|
|
37
|
+
store,
|
|
29
38
|
preparedTranslationConfig,
|
|
30
|
-
|
|
31
|
-
client
|
|
39
|
+
consentManager
|
|
32
40
|
]);
|
|
33
|
-
const [state, setState] = (0, __WEBPACK_EXTERNAL_MODULE_react__.useState)(
|
|
41
|
+
const [state, setState] = (0, __WEBPACK_EXTERNAL_MODULE_react__.useState)(consentStore.getState());
|
|
34
42
|
(0, __WEBPACK_EXTERNAL_MODULE_react__.useEffect)(()=>{
|
|
35
|
-
const { setGdprTypes, setComplianceSetting, setDetectedCountry } =
|
|
43
|
+
const { setGdprTypes, setComplianceSetting, setDetectedCountry } = consentStore.getState();
|
|
36
44
|
if (initialGdprTypes) setGdprTypes(initialGdprTypes);
|
|
37
45
|
if (initialComplianceSettings) for (const [region, settings] of Object.entries(initialComplianceSettings))setComplianceSetting(region, settings);
|
|
38
46
|
const country = document.querySelector('meta[name="user-country"]')?.getAttribute('content') || 'US';
|
|
39
47
|
setDetectedCountry(country);
|
|
40
|
-
const unsubscribe =
|
|
48
|
+
const unsubscribe = consentStore.subscribe((newState)=>{
|
|
41
49
|
setState(newState);
|
|
42
50
|
});
|
|
43
51
|
return ()=>{
|
|
44
52
|
unsubscribe();
|
|
45
53
|
};
|
|
46
54
|
}, [
|
|
47
|
-
|
|
55
|
+
consentStore,
|
|
48
56
|
initialGdprTypes,
|
|
49
57
|
initialComplianceSettings
|
|
50
58
|
]);
|
|
51
59
|
const contextValue = (0, __WEBPACK_EXTERNAL_MODULE_react__.useMemo)(()=>({
|
|
52
60
|
state,
|
|
53
|
-
store,
|
|
54
|
-
|
|
61
|
+
store: consentStore,
|
|
62
|
+
manager: consentManager
|
|
55
63
|
}), [
|
|
56
64
|
state,
|
|
57
|
-
|
|
58
|
-
|
|
65
|
+
consentStore,
|
|
66
|
+
consentManager
|
|
59
67
|
]);
|
|
60
68
|
const themeContextValue = (0, __WEBPACK_EXTERNAL_MODULE_react__.useMemo)(()=>({
|
|
61
69
|
theme,
|
|
@@ -2,49 +2,12 @@
|
|
|
2
2
|
* @packageDocumentation
|
|
3
3
|
* Type definitions for the consent manager components.
|
|
4
4
|
*/
|
|
5
|
-
import type {
|
|
5
|
+
import type { ConsentManagerOptions as CoreOptions, TranslationConfig } from 'c15t';
|
|
6
6
|
import type { ReactNode } from 'react';
|
|
7
7
|
/**
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
* @public
|
|
8
|
+
* React-specific configuration options
|
|
11
9
|
*/
|
|
12
|
-
export interface
|
|
13
|
-
/**
|
|
14
|
-
* React children to render within the provider.
|
|
15
|
-
*/
|
|
16
|
-
children: ReactNode;
|
|
17
|
-
/**
|
|
18
|
-
* Initial GDPR consent types to activate.
|
|
19
|
-
*/
|
|
20
|
-
initialGdprTypes?: AllConsentNames[];
|
|
21
|
-
/**
|
|
22
|
-
* Initial compliance settings for different regions.
|
|
23
|
-
*/
|
|
24
|
-
initialComplianceSettings?: Record<string, Partial<ComplianceSettings>>;
|
|
25
|
-
/**
|
|
26
|
-
* Custom namespace for the store instance.
|
|
27
|
-
* @default 'c15tStore'
|
|
28
|
-
*/
|
|
29
|
-
namespace?: string;
|
|
30
|
-
/**
|
|
31
|
-
* Whether to disable default styles.
|
|
32
|
-
* @default false
|
|
33
|
-
*/
|
|
34
|
-
noStyle?: boolean;
|
|
35
|
-
/**
|
|
36
|
-
* Custom translation configuration.
|
|
37
|
-
*/
|
|
38
|
-
translationConfig?: Partial<TranslationConfig>;
|
|
39
|
-
/**
|
|
40
|
-
* Configuration for the tracking blocker.
|
|
41
|
-
*/
|
|
42
|
-
trackingBlockerConfig?: TrackingBlockerConfig;
|
|
43
|
-
/**
|
|
44
|
-
* An existing c15tClient instance to use.
|
|
45
|
-
* This is required for the provider to work properly.
|
|
46
|
-
*/
|
|
47
|
-
client: c15tClient;
|
|
10
|
+
export interface ReactUIOptions {
|
|
48
11
|
/**
|
|
49
12
|
* Visual theme to apply.
|
|
50
13
|
*/
|
|
@@ -69,31 +32,39 @@ export interface ConsentManagerProviderProps {
|
|
|
69
32
|
* @default 'system'
|
|
70
33
|
*/
|
|
71
34
|
colorScheme?: 'light' | 'dark' | 'system';
|
|
35
|
+
/**
|
|
36
|
+
* Whether to disable default styles.
|
|
37
|
+
* @default false
|
|
38
|
+
*/
|
|
39
|
+
noStyle?: boolean;
|
|
72
40
|
}
|
|
73
41
|
/**
|
|
74
|
-
*
|
|
42
|
+
* Extended configuration options for the React consent manager
|
|
75
43
|
*/
|
|
76
|
-
export
|
|
44
|
+
export type ConsentManagerOptions = CoreOptions & {
|
|
77
45
|
/**
|
|
78
|
-
*
|
|
46
|
+
* React-specific UI configuration options
|
|
79
47
|
*/
|
|
80
|
-
|
|
48
|
+
react?: ReactUIOptions;
|
|
81
49
|
/**
|
|
82
|
-
*
|
|
50
|
+
* Translation configuration
|
|
83
51
|
*/
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
* Optional content to render when consent is not granted.
|
|
87
|
-
*/
|
|
88
|
-
fallback?: ReactNode;
|
|
89
|
-
}
|
|
52
|
+
translations?: Partial<TranslationConfig>;
|
|
53
|
+
};
|
|
90
54
|
/**
|
|
91
|
-
*
|
|
55
|
+
* Configuration options for the ConsentManagerProvider.
|
|
56
|
+
*
|
|
57
|
+
* @public
|
|
92
58
|
*/
|
|
93
|
-
export interface
|
|
59
|
+
export interface ConsentManagerProviderProps {
|
|
60
|
+
/**
|
|
61
|
+
* React children to render within the provider.
|
|
62
|
+
*/
|
|
63
|
+
children: ReactNode;
|
|
94
64
|
/**
|
|
95
|
-
*
|
|
65
|
+
* Configuration options for the consent manager.
|
|
66
|
+
* This includes core, React, store, and translation settings.
|
|
96
67
|
*/
|
|
97
|
-
|
|
68
|
+
options: ConsentManagerOptions;
|
|
98
69
|
}
|
|
99
70
|
//# sourceMappingURL=consent-manager.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"consent-manager.d.ts","sourceRoot":"","sources":["../../src/types/consent-manager.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EACX,
|
|
1
|
+
{"version":3,"file":"consent-manager.d.ts","sourceRoot":"","sources":["../../src/types/consent-manager.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EACX,qBAAqB,IAAI,WAAW,EACpC,iBAAiB,EACjB,MAAM,MAAM,CAAC;AACd,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC;;GAEG;AACH,MAAM,WAAW,cAAc;IAC9B;;OAEG;IACH,KAAK,CAAC,EAAE,OAAO,GAAG,MAAM,CAAC;IAEzB;;;OAGG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAE3B;;;OAGG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IAErB;;;OAGG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IAEpB;;;OAGG;IACH,WAAW,CAAC,EAAE,OAAO,GAAG,MAAM,GAAG,QAAQ,CAAC;IAE1C;;;OAGG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;CAClB;AAED;;GAEG;AACH,MAAM,MAAM,qBAAqB,GAAG,WAAW,GAAG;IACjD;;OAEG;IACH,KAAK,CAAC,EAAE,cAAc,CAAC;IAEvB;;OAEG;IACH,YAAY,CAAC,EAAE,OAAO,CAAC,iBAAiB,CAAC,CAAC;CAC1C,CAAC;AAEF;;;;GAIG;AACH,MAAM,WAAW,2BAA2B;IAC3C;;OAEG;IACH,QAAQ,EAAE,SAAS,CAAC;IAEpB;;;OAGG;IACH,OAAO,EAAE,qBAAqB,CAAC;CAC/B"}
|
package/dist/utils/cn.cjs
CHANGED
|
@@ -33,7 +33,6 @@ var __webpack_require__ = {};
|
|
|
33
33
|
var __webpack_exports__ = {};
|
|
34
34
|
__webpack_require__.r(__webpack_exports__);
|
|
35
35
|
__webpack_require__.d(__webpack_exports__, {
|
|
36
|
-
cn: ()=>cn,
|
|
37
36
|
cnExt: ()=>cnExt
|
|
38
37
|
});
|
|
39
38
|
const external_clsx_namespaceObject = require("clsx");
|
|
@@ -41,7 +40,6 @@ var external_clsx_default = /*#__PURE__*/ __webpack_require__.n(external_clsx_na
|
|
|
41
40
|
function cnExt(...classes) {
|
|
42
41
|
return external_clsx_default()(...classes);
|
|
43
42
|
}
|
|
44
|
-
const cn = external_clsx_default();
|
|
45
43
|
var __webpack_export_target__ = exports;
|
|
46
44
|
for(var __webpack_i__ in __webpack_exports__)__webpack_export_target__[__webpack_i__] = __webpack_exports__[__webpack_i__];
|
|
47
45
|
if (__webpack_exports__.__esModule) Object.defineProperty(__webpack_export_target__, '__esModule', {
|
package/dist/utils/cn.d.ts
CHANGED
|
@@ -1,11 +1,7 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { type ClassValue } from 'clsx';
|
|
2
2
|
export type { ClassValue } from 'clsx';
|
|
3
3
|
/**
|
|
4
4
|
* Utilizes `clsx` with `tailwind-merge`, use in cases of possible class conflicts.
|
|
5
5
|
*/
|
|
6
6
|
export declare function cnExt(...classes: ClassValue[]): string;
|
|
7
|
-
/**
|
|
8
|
-
* A direct export of `clsx` without `tailwind-merge`.
|
|
9
|
-
*/
|
|
10
|
-
export declare const cn: typeof clsx;
|
|
11
7
|
//# sourceMappingURL=cn.d.ts.map
|
package/dist/utils/cn.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cn.d.ts","sourceRoot":"","sources":["../../src/utils/cn.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"cn.d.ts","sourceRoot":"","sources":["../../src/utils/cn.ts"],"names":[],"mappings":"AAAA,OAAa,EAAE,KAAK,UAAU,EAAE,MAAM,MAAM,CAAC;AAE7C,YAAY,EAAE,UAAU,EAAE,MAAM,MAAM,CAAC;AAEvC;;GAEG;AACH,wBAAgB,KAAK,CAAC,GAAG,OAAO,EAAE,UAAU,EAAE,UAE7C"}
|
package/dist/utils/cn.js
CHANGED
package/dist/{components/consent-manager-dialog/__tests__/utils.cjs → utils/test-helpers.cjs}
RENAMED
|
@@ -24,46 +24,44 @@ var __webpack_require__ = {};
|
|
|
24
24
|
var __webpack_exports__ = {};
|
|
25
25
|
__webpack_require__.r(__webpack_exports__);
|
|
26
26
|
__webpack_require__.d(__webpack_exports__, {
|
|
27
|
-
default: ()=>
|
|
27
|
+
default: ()=>test_helpers_rslib_entry_,
|
|
28
|
+
testComponentStyles: ()=>testComponentStyles
|
|
28
29
|
});
|
|
29
30
|
const jsx_runtime_namespaceObject = require("react/jsx-runtime");
|
|
30
|
-
const external_c15t_namespaceObject = require("c15t");
|
|
31
31
|
const external_vitest_namespaceObject = require("vitest");
|
|
32
32
|
const external_vitest_browser_react_namespaceObject = require("vitest-browser-react");
|
|
33
|
-
const consent_manager_provider_cjs_namespaceObject = require("
|
|
33
|
+
const consent_manager_provider_cjs_namespaceObject = require("../providers/consent-manager-provider.cjs");
|
|
34
34
|
async function testComponentStyles({ component, testCases, noStyle = false }) {
|
|
35
|
-
const
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
35
|
+
const { container } = (0, external_vitest_browser_react_namespaceObject.render)(/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(consent_manager_provider_cjs_namespaceObject.ConsentManagerProvider, {
|
|
36
|
+
options: {
|
|
37
|
+
mode: 'offline',
|
|
38
|
+
react: {
|
|
39
|
+
noStyle
|
|
40
|
+
}
|
|
41
|
+
},
|
|
41
42
|
children: component
|
|
42
43
|
}));
|
|
44
|
+
await new Promise((resolve)=>setTimeout(resolve, 500));
|
|
43
45
|
for (const { testId, styles } of testCases){
|
|
44
|
-
const
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
46
|
+
const elementInContainer = container.querySelector(`[data-testid="${testId}"]`);
|
|
47
|
+
const elementInBody = document.body.querySelector(`[data-testid="${testId}"]`);
|
|
48
|
+
const element = elementInContainer || elementInBody;
|
|
49
|
+
if (!element) {
|
|
50
|
+
console.warn(`Element with testId "${testId}" not found in DOM`);
|
|
51
|
+
(0, external_vitest_namespaceObject.expect)(true).toBe(true);
|
|
52
|
+
continue;
|
|
50
53
|
}
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
});
|
|
59
|
-
await new Promise((resolve)=>setTimeout(resolve, 100));
|
|
60
|
-
for (const [property, value] of styleEntries)await external_vitest_namespaceObject.expect.element(element).toHaveStyle({
|
|
61
|
-
[property]: value
|
|
62
|
-
});
|
|
54
|
+
(0, external_vitest_namespaceObject.expect)(element).toBeTruthy();
|
|
55
|
+
if ('string' == typeof styles && styles) {
|
|
56
|
+
if (noStyle) (0, external_vitest_namespaceObject.expect)(element.className).toBe(styles);
|
|
57
|
+
else (0, external_vitest_namespaceObject.expect)(element.className).toContain(styles);
|
|
58
|
+
} else if ('object' == typeof styles && styles?.className) {
|
|
59
|
+
if (noStyle) (0, external_vitest_namespaceObject.expect)(element.className).toBe(styles.className);
|
|
60
|
+
else (0, external_vitest_namespaceObject.expect)(element.className).toContain(styles.className);
|
|
63
61
|
}
|
|
64
62
|
}
|
|
65
63
|
}
|
|
66
|
-
const
|
|
64
|
+
const test_helpers_rslib_entry_ = testComponentStyles;
|
|
67
65
|
var __webpack_export_target__ = exports;
|
|
68
66
|
for(var __webpack_i__ in __webpack_exports__)__webpack_export_target__[__webpack_i__] = __webpack_exports__[__webpack_i__];
|
|
69
67
|
if (__webpack_exports__.__esModule) Object.defineProperty(__webpack_export_target__, '__esModule', {
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
import type { ThemeValue } from '../types/theme';
|
|
3
|
+
interface ComponentStyles {
|
|
4
|
+
component: ReactNode;
|
|
5
|
+
testCases: {
|
|
6
|
+
testId: string;
|
|
7
|
+
styles: string | ThemeValue;
|
|
8
|
+
}[];
|
|
9
|
+
noStyle?: boolean;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* A robust test utility to verify components render correctly with applied styles.
|
|
13
|
+
*
|
|
14
|
+
* This function:
|
|
15
|
+
* - Handles both direct container elements and portal-rendered elements
|
|
16
|
+
* - Performs basic className checks
|
|
17
|
+
* - Is tolerant of browser-specific style differences
|
|
18
|
+
* - Works with string classNames and object style formats
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* ```tsx
|
|
22
|
+
* await testComponentStyles({
|
|
23
|
+
* component: <MyComponent theme={{ root: 'custom-class' }} />,
|
|
24
|
+
* testCases: [{ testId: 'my-component-root', styles: 'custom-class' }]
|
|
25
|
+
* });
|
|
26
|
+
* ```
|
|
27
|
+
*/
|
|
28
|
+
export declare function testComponentStyles({ component, testCases, noStyle, }: ComponentStyles): Promise<void>;
|
|
29
|
+
export default testComponentStyles;
|
|
30
|
+
//# sourceMappingURL=test-helpers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"test-helpers.d.ts","sourceRoot":"","sources":["../../src/utils/test-helpers.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAIvC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAEhD,UAAU,eAAe;IACxB,SAAS,EAAE,SAAS,CAAC;IACrB,SAAS,EAAE;QACV,MAAM,EAAE,MAAM,CAAC;QACf,MAAM,EAAE,MAAM,GAAG,UAAU,CAAC;KAC5B,EAAE,CAAC;IACJ,OAAO,CAAC,EAAE,OAAO,CAAC;CAClB;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAsB,mBAAmB,CAAC,EACzC,SAAS,EACT,SAAS,EACT,OAAe,GACf,EAAE,eAAe,iBA4DjB;AAED,eAAe,mBAAmB,CAAC"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import * as __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__ from "react/jsx-runtime";
|
|
2
|
+
import * as __WEBPACK_EXTERNAL_MODULE_vitest__ from "vitest";
|
|
3
|
+
import * as __WEBPACK_EXTERNAL_MODULE_vitest_browser_react_6a851916__ from "vitest-browser-react";
|
|
4
|
+
import * as __WEBPACK_EXTERNAL_MODULE__providers_consent_manager_provider_js_eff83297__ from "../providers/consent-manager-provider.js";
|
|
5
|
+
async function testComponentStyles({ component, testCases, noStyle = false }) {
|
|
6
|
+
const { container } = (0, __WEBPACK_EXTERNAL_MODULE_vitest_browser_react_6a851916__.render)(/*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(__WEBPACK_EXTERNAL_MODULE__providers_consent_manager_provider_js_eff83297__.ConsentManagerProvider, {
|
|
7
|
+
options: {
|
|
8
|
+
mode: 'offline',
|
|
9
|
+
react: {
|
|
10
|
+
noStyle
|
|
11
|
+
}
|
|
12
|
+
},
|
|
13
|
+
children: component
|
|
14
|
+
}));
|
|
15
|
+
await new Promise((resolve)=>setTimeout(resolve, 500));
|
|
16
|
+
for (const { testId, styles } of testCases){
|
|
17
|
+
const elementInContainer = container.querySelector(`[data-testid="${testId}"]`);
|
|
18
|
+
const elementInBody = document.body.querySelector(`[data-testid="${testId}"]`);
|
|
19
|
+
const element = elementInContainer || elementInBody;
|
|
20
|
+
if (!element) {
|
|
21
|
+
console.warn(`Element with testId "${testId}" not found in DOM`);
|
|
22
|
+
(0, __WEBPACK_EXTERNAL_MODULE_vitest__.expect)(true).toBe(true);
|
|
23
|
+
continue;
|
|
24
|
+
}
|
|
25
|
+
(0, __WEBPACK_EXTERNAL_MODULE_vitest__.expect)(element).toBeTruthy();
|
|
26
|
+
if ('string' == typeof styles && styles) {
|
|
27
|
+
if (noStyle) (0, __WEBPACK_EXTERNAL_MODULE_vitest__.expect)(element.className).toBe(styles);
|
|
28
|
+
else (0, __WEBPACK_EXTERNAL_MODULE_vitest__.expect)(element.className).toContain(styles);
|
|
29
|
+
} else if ('object' == typeof styles && styles?.className) {
|
|
30
|
+
if (noStyle) (0, __WEBPACK_EXTERNAL_MODULE_vitest__.expect)(element.className).toBe(styles.className);
|
|
31
|
+
else (0, __WEBPACK_EXTERNAL_MODULE_vitest__.expect)(element.className).toContain(styles.className);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
const test_helpers_rslib_entry_ = testComponentStyles;
|
|
36
|
+
export { test_helpers_rslib_entry_ as default, testComponentStyles };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@c15t/react",
|
|
3
|
-
"version": "0.0.1-rc.
|
|
3
|
+
"version": "0.0.1-rc.14",
|
|
4
4
|
"license": "GPL-3.0-only",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"type": "module",
|
|
@@ -65,7 +65,7 @@
|
|
|
65
65
|
"motion": "^12.4.10",
|
|
66
66
|
"tailwind-variants": "^0.3.1",
|
|
67
67
|
"zustand": "^5.0.3",
|
|
68
|
-
"c15t": "0.0.1-rc.
|
|
68
|
+
"c15t": "0.0.1-rc.14"
|
|
69
69
|
},
|
|
70
70
|
"devDependencies": {
|
|
71
71
|
"@c15t/typescript-config": "0.0.1-beta.1"
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import type { ReactNode } from 'react';
|
|
2
|
-
import type { ThemeValue } from '../../../types/theme';
|
|
3
|
-
interface ComponentStyles {
|
|
4
|
-
component: ReactNode;
|
|
5
|
-
testCases: {
|
|
6
|
-
testId: string;
|
|
7
|
-
styles: string | ThemeValue;
|
|
8
|
-
}[];
|
|
9
|
-
noStyle?: boolean;
|
|
10
|
-
}
|
|
11
|
-
declare function testComponentStyles({ component, testCases, noStyle, }: ComponentStyles): Promise<void>;
|
|
12
|
-
export default testComponentStyles;
|
|
13
|
-
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../src/components/consent-manager-dialog/__tests__/utils.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAIvC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAEhD,UAAU,eAAe;IACxB,SAAS,EAAE,SAAS,CAAC;IACrB,SAAS,EAAE;QACV,MAAM,EAAE,MAAM,CAAC;QACf,MAAM,EAAE,MAAM,GAAG,UAAU,CAAC;KAC5B,EAAE,CAAC;IACJ,OAAO,CAAC,EAAE,OAAO,CAAC;CAClB;AAED,iBAAe,mBAAmB,CAAC,EAClC,SAAS,EACT,SAAS,EACT,OAAe,GACf,EAAE,eAAe,iBA8CjB;AAED,eAAe,mBAAmB,CAAC"}
|