@ecomconsult/consentkit 0.3.5 → 0.5.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/README.md +262 -20
- package/npm/core.mjs +4 -1
- package/npm/index.cjs +4 -1
- package/npm/index.d.ts +228 -2
- package/npm/index.mjs +14 -2
- package/npm/internal-stub.mjs +12 -1
- package/package.json +1 -1
- package/src/ck-core.js +524 -38
- package/src/ck-debug.js +137 -3
- package/src/ck-saas.js +36 -1
- package/src/ck-ui-branding.js +511 -0
- package/src/ck-ui.js +530 -457
package/npm/index.mjs
CHANGED
|
@@ -3,7 +3,9 @@
|
|
|
3
3
|
* re-exports the public API.
|
|
4
4
|
*
|
|
5
5
|
* Load order is contractual: ck-core.js (blocking starts at parse time) →
|
|
6
|
-
* ck-locales.js (extra language packs) → ck-ui.js (
|
|
6
|
+
* ck-locales.js (extra language packs) → ck-ui-branding.js (optional logo /
|
|
7
|
+
* attribution extension, which must register before the UI mounts) →
|
|
8
|
+
* ck-ui.js (Shadow DOM layer).
|
|
7
9
|
*
|
|
8
10
|
* Only the core is DOM-optional. `src/ck-ui.js` touches `document` at module
|
|
9
11
|
* scope, so it is imported dynamically behind a `typeof document` guard —
|
|
@@ -25,6 +27,13 @@ if (hasDom) {
|
|
|
25
27
|
await import('../src/ck-locales.js');
|
|
26
28
|
} catch (e) { /* locales are optional; ck-ui falls back to built-in en/ru */ }
|
|
27
29
|
|
|
30
|
+
// Optional branding extension. Before ck-ui.js on purpose: it registers
|
|
31
|
+
// itself on ConsentKit._uiExtensions and must be there before the first
|
|
32
|
+
// mount(). Absent, the UI simply draws no logo and no attribution line.
|
|
33
|
+
try {
|
|
34
|
+
await import('../src/ck-ui-branding.js');
|
|
35
|
+
} catch (e) { /* branding is optional; the UI renders without it */ }
|
|
36
|
+
|
|
28
37
|
// Required in the browser, fatal in Node — hence the guard above.
|
|
29
38
|
try {
|
|
30
39
|
await import('../src/ck-ui.js');
|
|
@@ -42,6 +51,9 @@ export const {
|
|
|
42
51
|
rejectAll,
|
|
43
52
|
withdraw,
|
|
44
53
|
show,
|
|
45
|
-
hide
|
|
54
|
+
hide,
|
|
55
|
+
// v0.4.0 (§1.3): merging service overrides into the tracker database is part
|
|
56
|
+
// of the public surface, so it must be reachable as a named import too.
|
|
57
|
+
_extendHostDb
|
|
46
58
|
} = ConsentKit;
|
|
47
59
|
export { ConsentKit };
|
package/npm/internal-stub.mjs
CHANGED
|
@@ -28,7 +28,7 @@ export function undecidedState() {
|
|
|
28
28
|
*/
|
|
29
29
|
export function createStub() {
|
|
30
30
|
const stub = {
|
|
31
|
-
version: '0.
|
|
31
|
+
version: '0.5.0',
|
|
32
32
|
config: {},
|
|
33
33
|
init: function () { return undecidedState(); },
|
|
34
34
|
allowed: function (cat) { return cat === 'necessary'; },
|
|
@@ -39,6 +39,17 @@ export function createStub() {
|
|
|
39
39
|
show: function () {},
|
|
40
40
|
hide: function () {},
|
|
41
41
|
_categories: CATEGORIES.slice(),
|
|
42
|
+
// v0.4.0: the stub mirrors the real surface, so consumer code that calls
|
|
43
|
+
// these needs no branching when the core failed to attach.
|
|
44
|
+
_extendHostDb: function () { return 0; },
|
|
45
|
+
_baseAllow: [],
|
|
46
|
+
_categoryForUrl: function () { return null; },
|
|
47
|
+
// v0.4.1 (§8): the infrastructure list. Empty here for the same reason
|
|
48
|
+
// _baseAllow is — a stub means the engine never attached, so it is not
|
|
49
|
+
// letting anything through and must not claim a list it does not enforce.
|
|
50
|
+
_infra: function () { return []; },
|
|
51
|
+
_isInfra: function () { return false; },
|
|
52
|
+
_blocked: function () { return []; },
|
|
42
53
|
_isStub: true
|
|
43
54
|
};
|
|
44
55
|
return stub;
|
package/package.json
CHANGED