@nortic/citronkaka-ui 0.2.1 → 0.2.2
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-BcL_GpLr.js → index-9yZ7-HXo.js} +20 -24
- package/dist/index-OnYWswXS.js +7258 -0
- package/dist/index.js +1 -1
- package/package.json +32 -31
- package/dist/index-CQ8BXiGX.js +0 -7474
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
function h() {
|
|
2
2
|
return location.hostname.split(".").slice(-2).join(".");
|
|
3
3
|
}
|
|
4
|
-
const
|
|
4
|
+
const f = {
|
|
5
5
|
domain: h(),
|
|
6
6
|
defaultModel: {
|
|
7
7
|
useraction: !1,
|
|
@@ -12,10 +12,10 @@ const m = {
|
|
|
12
12
|
categories: ["necessary", "functional", "analytics", "marketing"],
|
|
13
13
|
services: []
|
|
14
14
|
};
|
|
15
|
-
class
|
|
15
|
+
class l {
|
|
16
16
|
static createCookieString(e, t, o = {}) {
|
|
17
|
-
const { expires: s, path: i = "/", sameSite: n = "Strict", domain: c } = o,
|
|
18
|
-
return `${e}=${
|
|
17
|
+
const { expires: s, path: i = "/", sameSite: n = "Strict", domain: c } = o, u = encodeURIComponent(t), d = s ? `; expires=${s.toUTCString()}` : "", p = c ? `; domain=${c}` : "";
|
|
18
|
+
return `${e}=${u}${d}; path=${i}; SameSite=${n}${p}`;
|
|
19
19
|
}
|
|
20
20
|
/**
|
|
21
21
|
* Sets a cookie with the specified options.
|
|
@@ -37,7 +37,7 @@ class u {
|
|
|
37
37
|
const t = document.cookie.match(new RegExp(`(^| )${e}=([^;]+)`));
|
|
38
38
|
if (!t)
|
|
39
39
|
return null;
|
|
40
|
-
const o = decodeURIComponent(t[2]);
|
|
40
|
+
const o = decodeURIComponent(t[2] ?? "");
|
|
41
41
|
try {
|
|
42
42
|
return JSON.parse(o);
|
|
43
43
|
} catch {
|
|
@@ -56,15 +56,15 @@ class u {
|
|
|
56
56
|
});
|
|
57
57
|
}
|
|
58
58
|
}
|
|
59
|
-
class
|
|
59
|
+
class m {
|
|
60
60
|
/**
|
|
61
61
|
* Cleans up cookies based on a list of blacklist patterns.
|
|
62
62
|
* @param blacklist An array of RegExp patterns for cookies to delete.
|
|
63
63
|
*/
|
|
64
|
-
static run(e, t =
|
|
64
|
+
static run(e, t = l) {
|
|
65
65
|
function o(s) {
|
|
66
66
|
document.cookie.split(";").forEach((i) => {
|
|
67
|
-
const n = i.split("=")[0].trim();
|
|
67
|
+
const n = (i.split("=")[0] ?? "").trim();
|
|
68
68
|
s.test(n) && (t.delete(n), console.warn(`Removed cookie: ${n}`));
|
|
69
69
|
});
|
|
70
70
|
}
|
|
@@ -92,22 +92,20 @@ class k {
|
|
|
92
92
|
* @returns The current cookies as a string.
|
|
93
93
|
*/
|
|
94
94
|
get() {
|
|
95
|
-
|
|
96
|
-
return ((o = t.get) == null ? void 0 : o.call(document)) || "";
|
|
95
|
+
return t.get?.call(document) || "";
|
|
97
96
|
},
|
|
98
97
|
/**
|
|
99
98
|
* Setter for `document.cookie`. Intercepts and blocks cookies based on the blacklist.
|
|
100
99
|
* @param cookieString The cookie string to be set.
|
|
101
100
|
*/
|
|
102
101
|
set(o) {
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
n && new Date(n[1]).getTime() < Date.now() || !e.some((c) => c.test(i)) ? (s = t.set) == null || s.call(document, o) : console.warn(`Blocked cookie: ${i}`);
|
|
102
|
+
const s = (o?.split("=")[0] ?? "").trim(), i = o.match(/expires=([^;]+)/i);
|
|
103
|
+
i && typeof i[1] == "string" && new Date(i[1]).getTime() < Date.now() || !e.some((n) => n.test(s)) ? t.set?.call(document, o) : console.warn(`Blocked cookie: ${s}`);
|
|
106
104
|
}
|
|
107
105
|
});
|
|
108
106
|
}
|
|
109
107
|
}
|
|
110
|
-
class
|
|
108
|
+
class a {
|
|
111
109
|
/**
|
|
112
110
|
* Starts the script interception process with a list of blacklist patterns for script `src` attributes.
|
|
113
111
|
* @param blacklist An array of RegExp patterns for script `src` attributes to block.
|
|
@@ -142,16 +140,14 @@ class l {
|
|
|
142
140
|
configurable: !0,
|
|
143
141
|
enumerable: !0,
|
|
144
142
|
get() {
|
|
145
|
-
|
|
146
|
-
return (c = n.get) == null ? void 0 : c.call(i);
|
|
143
|
+
return n.get?.call(i);
|
|
147
144
|
},
|
|
148
145
|
set(c) {
|
|
149
|
-
|
|
150
|
-
if (l.shouldBlockScript(e, c)) {
|
|
146
|
+
if (a.shouldBlockScript(e, c)) {
|
|
151
147
|
console.warn(`Blocked script: ${c}`), i.type = "javascript/blocked";
|
|
152
148
|
return;
|
|
153
149
|
}
|
|
154
|
-
|
|
150
|
+
n.set?.call(i, c);
|
|
155
151
|
}
|
|
156
152
|
});
|
|
157
153
|
}
|
|
@@ -186,7 +182,7 @@ class l {
|
|
|
186
182
|
}
|
|
187
183
|
}
|
|
188
184
|
class g {
|
|
189
|
-
constructor(e =
|
|
185
|
+
constructor(e = f, t = { update: [] }, o = l, s = m, i = k, n = a) {
|
|
190
186
|
this.config = e, this.listeners = t, this.persistentService = o, this.cookieCleaner = s, this.cookieInterceptor = i, this.scriptInterceptor = n, s.run(this.blacklist.cookies), i.run(this.blacklist.cookies), n.run(this.blacklist.scripts);
|
|
191
187
|
}
|
|
192
188
|
/**
|
|
@@ -275,7 +271,7 @@ class g {
|
|
|
275
271
|
}
|
|
276
272
|
window.Citronkaka = window.Citronkaka || new g();
|
|
277
273
|
const y = window.Citronkaka;
|
|
278
|
-
class
|
|
274
|
+
class b {
|
|
279
275
|
constructor(e = null, t = y) {
|
|
280
276
|
this.ui = e, this.service = t, this.init();
|
|
281
277
|
}
|
|
@@ -292,7 +288,7 @@ class v {
|
|
|
292
288
|
*/
|
|
293
289
|
async loadUI() {
|
|
294
290
|
try {
|
|
295
|
-
const { NorticCookieConsentDialog: e } = await import("./index-
|
|
291
|
+
const { NorticCookieConsentDialog: e } = await import("./index-OnYWswXS.js");
|
|
296
292
|
window.customElements.get("nortic-cookie-consent-dialog") || window.customElements.define("nortic-cookie-consent-dialog", e), this.ui = document.createElement("nortic-cookie-consent-dialog"), this.ui.setAttribute("data-testid", "cookie-consent"), document.body.appendChild(this.ui);
|
|
297
293
|
} catch (e) {
|
|
298
294
|
console.error("Failed to load the cookie consent dialog:", e);
|
|
@@ -305,8 +301,8 @@ class v {
|
|
|
305
301
|
this.ui && (document.body.removeChild(this.ui), this.ui = null);
|
|
306
302
|
}
|
|
307
303
|
}
|
|
308
|
-
const
|
|
304
|
+
const v = new b();
|
|
309
305
|
export {
|
|
310
|
-
|
|
306
|
+
v as i,
|
|
311
307
|
y
|
|
312
308
|
};
|