@c15t/react 0.0.1-rc.12 → 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.cjs +2 -52
- package/dist/components/shared/primitives/button.d.ts.map +1 -1
- package/dist/components/shared/primitives/button.js +2 -52
- 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
|
@@ -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/cookie-banner/__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;AAKD,iBAAe,mBAAmB,CAAC,EAClC,SAAS,EACT,SAAS,EACT,OAAe,GACf,EAAE,eAAe,iBA0CjB;AAED,eAAe,mBAAmB,CAAC"}
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import * as __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__ from "react/jsx-runtime";
|
|
2
|
-
import * as __WEBPACK_EXTERNAL_MODULE_c15t__ from "c15t";
|
|
3
|
-
import * as __WEBPACK_EXTERNAL_MODULE_vitest__ from "vitest";
|
|
4
|
-
import * as __WEBPACK_EXTERNAL_MODULE_vitest_browser_react_6a851916__ from "vitest-browser-react";
|
|
5
|
-
import * as __WEBPACK_EXTERNAL_MODULE__providers_consent_manager_provider_js_47c65d87__ from "../../../providers/consent-manager-provider.js";
|
|
6
|
-
const c15tClient = (0, __WEBPACK_EXTERNAL_MODULE_c15t__.createConsentClient)({
|
|
7
|
-
baseURL: '/api/c15t'
|
|
8
|
-
});
|
|
9
|
-
async function testComponentStyles({ component, testCases, noStyle = false }) {
|
|
10
|
-
const { getByTestId } = (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_47c65d87__.ConsentManagerProvider, {
|
|
11
|
-
client: c15tClient,
|
|
12
|
-
children: component
|
|
13
|
-
}));
|
|
14
|
-
for (const { testId, styles } of testCases){
|
|
15
|
-
const element = getByTestId(testId);
|
|
16
|
-
if ('string' == typeof styles || styles?.className) {
|
|
17
|
-
const classNames = 'string' == typeof styles ? styles : styles?.className;
|
|
18
|
-
if (classNames) await __WEBPACK_EXTERNAL_MODULE_vitest__.expect.element(element).toHaveClass(classNames, {
|
|
19
|
-
exact: noStyle
|
|
20
|
-
});
|
|
21
|
-
}
|
|
22
|
-
if ('object' == typeof styles && styles?.style) {
|
|
23
|
-
const styleEntries = Object.entries(styles.style).map(([key, value])=>{
|
|
24
|
-
const cssKey = key.replace(/([A-Z])/g, '-$1').toLowerCase();
|
|
25
|
-
return [
|
|
26
|
-
cssKey,
|
|
27
|
-
value
|
|
28
|
-
];
|
|
29
|
-
});
|
|
30
|
-
await new Promise((resolve)=>setTimeout(resolve, 100));
|
|
31
|
-
for (const [property, value] of styleEntries)await __WEBPACK_EXTERNAL_MODULE_vitest__.expect.element(element).toHaveStyle({
|
|
32
|
-
[property]: value
|
|
33
|
-
});
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
const utils_rslib_entry_ = testComponentStyles;
|
|
38
|
-
export { utils_rslib_entry_ as default };
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __webpack_require__ = {};
|
|
3
|
-
(()=>{
|
|
4
|
-
__webpack_require__.d = (exports1, definition)=>{
|
|
5
|
-
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
6
|
-
enumerable: true,
|
|
7
|
-
get: definition[key]
|
|
8
|
-
});
|
|
9
|
-
};
|
|
10
|
-
})();
|
|
11
|
-
(()=>{
|
|
12
|
-
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
13
|
-
})();
|
|
14
|
-
(()=>{
|
|
15
|
-
__webpack_require__.r = function(exports1) {
|
|
16
|
-
if ('undefined' != typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
17
|
-
value: 'Module'
|
|
18
|
-
});
|
|
19
|
-
Object.defineProperty(exports1, '__esModule', {
|
|
20
|
-
value: true
|
|
21
|
-
});
|
|
22
|
-
};
|
|
23
|
-
})();
|
|
24
|
-
var __webpack_exports__ = {};
|
|
25
|
-
__webpack_require__.r(__webpack_exports__);
|
|
26
|
-
__webpack_require__.d(__webpack_exports__, {
|
|
27
|
-
useConsentClient: ()=>useConsentClient
|
|
28
|
-
});
|
|
29
|
-
const external_react_namespaceObject = require("react");
|
|
30
|
-
const consent_manager_context_cjs_namespaceObject = require("../context/consent-manager-context.cjs");
|
|
31
|
-
function useConsentClient() {
|
|
32
|
-
const context = (0, external_react_namespaceObject.useContext)(consent_manager_context_cjs_namespaceObject.ConsentStateContext);
|
|
33
|
-
if (void 0 === context) throw new Error('useConsentClient must be used within a ConsentManagerProvider');
|
|
34
|
-
if (null === context.client) throw new Error('No API client available. Make sure to provide clientOptions to ConsentManagerProvider.');
|
|
35
|
-
return context.client;
|
|
36
|
-
}
|
|
37
|
-
var __webpack_export_target__ = exports;
|
|
38
|
-
for(var __webpack_i__ in __webpack_exports__)__webpack_export_target__[__webpack_i__] = __webpack_exports__[__webpack_i__];
|
|
39
|
-
if (__webpack_exports__.__esModule) Object.defineProperty(__webpack_export_target__, '__esModule', {
|
|
40
|
-
value: true
|
|
41
|
-
});
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @packageDocumentation
|
|
3
|
-
* Hook for accessing the c15t API client instance.
|
|
4
|
-
*/
|
|
5
|
-
/**
|
|
6
|
-
* Hook for accessing the c15t API client instance.
|
|
7
|
-
*
|
|
8
|
-
* @remarks
|
|
9
|
-
* This hook provides access to the c15t API client, allowing components
|
|
10
|
-
* to interact with the consent management API for operations like:
|
|
11
|
-
* - Fetching consent purposes
|
|
12
|
-
* - Updating consent preferences on the server
|
|
13
|
-
* - Retrieving consent history
|
|
14
|
-
*
|
|
15
|
-
* The hook must be used within a ConsentManagerProvider component
|
|
16
|
-
* that has been initialized with clientOptions.
|
|
17
|
-
*
|
|
18
|
-
* @throws {Error}
|
|
19
|
-
* Throws if used outside of a ConsentManagerProvider context or if
|
|
20
|
-
* no client was initialized (missing clientOptions).
|
|
21
|
-
*
|
|
22
|
-
* @returns The c15t API client instance
|
|
23
|
-
* @public
|
|
24
|
-
*/
|
|
25
|
-
export declare function useConsentClient(): import("c15t").c15tClient;
|
|
26
|
-
//# sourceMappingURL=use-consent-client.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"use-consent-client.d.ts","sourceRoot":"","sources":["../../src/hooks/use-consent-client.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,gBAAgB,8BAgB/B"}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import * as __WEBPACK_EXTERNAL_MODULE_react__ from "react";
|
|
2
|
-
import * as __WEBPACK_EXTERNAL_MODULE__context_consent_manager_context_js_ee8f06d2__ from "../context/consent-manager-context.js";
|
|
3
|
-
function useConsentClient() {
|
|
4
|
-
const context = (0, __WEBPACK_EXTERNAL_MODULE_react__.useContext)(__WEBPACK_EXTERNAL_MODULE__context_consent_manager_context_js_ee8f06d2__.ConsentStateContext);
|
|
5
|
-
if (void 0 === context) throw new Error('useConsentClient must be used within a ConsentManagerProvider');
|
|
6
|
-
if (null === context.client) throw new Error('No API client available. Make sure to provide clientOptions to ConsentManagerProvider.');
|
|
7
|
-
return context.client;
|
|
8
|
-
}
|
|
9
|
-
export { useConsentClient };
|