@duckduckgo/autoconsent 5.3.0 → 6.0.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/.eslintrc +1 -1
- package/CHANGELOG.md +17 -0
- package/data/coverage.json +958 -1010
- package/dist/addon-firefox/background.bundle.js +13 -12
- package/dist/addon-firefox/content.bundle.js +1074 -930
- package/dist/addon-firefox/manifest.json +1 -1
- package/dist/addon-firefox/rules.json +83 -83
- package/dist/addon-mv3/background.bundle.js +13 -12
- package/dist/addon-mv3/content.bundle.js +1074 -930
- package/dist/addon-mv3/manifest.json +1 -1
- package/dist/addon-mv3/popup.bundle.js +38 -0
- package/dist/addon-mv3/popup.html +2 -1
- package/dist/addon-mv3/rules.json +83 -83
- package/dist/autoconsent.cjs.js +1074 -937
- package/dist/autoconsent.esm.js +1074 -932
- package/dist/autoconsent.playwright.js +1 -1
- package/lib/cmps/airbnb.ts +1 -3
- package/lib/cmps/all.ts +13 -22
- package/lib/cmps/base.ts +123 -92
- package/lib/cmps/consentmanager.ts +7 -10
- package/lib/cmps/conversant.ts +1 -4
- package/lib/cmps/cookiebot.ts +6 -10
- package/lib/cmps/evidon.ts +1 -3
- package/lib/cmps/klaro.ts +3 -7
- package/lib/cmps/onetrust.ts +3 -7
- package/lib/cmps/sourcepoint-frame.ts +1 -4
- package/lib/cmps/tiktok.ts +1 -3
- package/lib/cmps/trustarc-frame.ts +1 -3
- package/lib/cmps/trustarc-top.ts +6 -5
- package/lib/cmps/uniconsent.ts +1 -3
- package/lib/eval-snippets.ts +105 -0
- package/lib/rule-executors.ts +0 -8
- package/lib/rules.ts +3 -1
- package/lib/types.ts +1 -1
- package/lib/web.ts +26 -13
- package/package.json +1 -1
- package/readme.md +3 -3
- package/rules/autoconsent/192.json +1 -1
- package/rules/autoconsent/adroll.json +1 -1
- package/rules/autoconsent/affinity-serif-com.json +1 -1
- package/rules/autoconsent/axeptio.json +1 -1
- package/rules/autoconsent/bing.json +1 -1
- package/rules/autoconsent/borlabs.json +1 -1
- package/rules/autoconsent/bundesregierung-de.json +1 -1
- package/rules/autoconsent/canva.json +1 -1
- package/rules/autoconsent/clickio.json +1 -1
- package/rules/autoconsent/clinch.json +1 -1
- package/rules/autoconsent/coinbase.json +1 -1
- package/rules/autoconsent/complianz-banner.json +1 -1
- package/rules/autoconsent/complianz-categories.json +1 -1
- package/rules/autoconsent/complianz-optin.json +1 -1
- package/rules/autoconsent/cookie-law-info.json +2 -2
- package/rules/autoconsent/cookie-manager-popup.json +1 -1
- package/rules/autoconsent/cookiealert.json +3 -3
- package/rules/autoconsent/cookiefirst.json +7 -8
- package/rules/autoconsent/cookieinformation.json +3 -3
- package/rules/autoconsent/dailymotion.json +1 -1
- package/rules/autoconsent/dsgvo.json +1 -1
- package/rules/autoconsent/dunelm.json +1 -1
- package/rules/autoconsent/etsy.json +2 -2
- package/rules/autoconsent/eu-cookie-compliance.json +1 -1
- package/rules/autoconsent/eu-cookie-law.json +1 -1
- package/rules/autoconsent/ezoic.json +2 -2
- package/rules/autoconsent/google.json +1 -1
- package/rules/autoconsent/iubenda.json +2 -2
- package/rules/autoconsent/jquery-cookiebar.json +1 -1
- package/rules/autoconsent/mediavine.json +1 -1
- package/rules/autoconsent/microsoft.json +3 -3
- package/rules/autoconsent/moove.json +1 -1
- package/rules/autoconsent/paypal.json +1 -1
- package/rules/autoconsent/primebox.json +1 -1
- package/rules/autoconsent/pubtech.json +1 -1
- package/rules/autoconsent/reddit.json +1 -1
- package/rules/autoconsent/sibbo.json +1 -1
- package/rules/autoconsent/sirdata.json +1 -1
- package/rules/autoconsent/snigel.json +1 -1
- package/rules/autoconsent/steampowered.json +1 -1
- package/rules/autoconsent/tarteaucitron.json +3 -3
- package/rules/autoconsent/tealium.json +4 -4
- package/rules/autoconsent/testcmp-cosmetic.json +1 -1
- package/rules/autoconsent/testcmp.json +1 -1
- package/rules/autoconsent/thefreedictionary.json +2 -2
- package/rules/autoconsent/theverge.json +1 -1
- package/rules/autoconsent/twitter.json +1 -1
- package/rules/autoconsent/ubuntu.com.json +1 -1
- package/rules/autoconsent/uk-cookie-consent.json +1 -1
- package/rules/autoconsent/usercentrics-api.json +7 -7
- package/rules/autoconsent/usercentrics-button.json +1 -1
- package/rules/autoconsent/waitrose.json +2 -2
- package/rules/autoconsent/wp-cookie-notice.json +1 -1
- package/rules/autoconsent/xing.json +1 -1
- package/rules/autoconsent/youtube-desktop.json +1 -1
- package/rules/autoconsent/youtube-mobile.json +1 -1
- package/rules/rules.json +83 -83
- package/lib/index.ts +0 -4
package/dist/autoconsent.esm.js
CHANGED
|
@@ -1,53 +1,404 @@
|
|
|
1
|
-
// lib/
|
|
2
|
-
var
|
|
1
|
+
// lib/consentomatic/tools.ts
|
|
2
|
+
var _Tools = class _Tools {
|
|
3
|
+
static setBase(base) {
|
|
4
|
+
_Tools.base = base;
|
|
5
|
+
}
|
|
6
|
+
static findElement(options, parent = null, multiple = false) {
|
|
7
|
+
let possibleTargets = null;
|
|
8
|
+
if (parent != null) {
|
|
9
|
+
possibleTargets = Array.from(parent.querySelectorAll(options.selector));
|
|
10
|
+
} else {
|
|
11
|
+
if (_Tools.base != null) {
|
|
12
|
+
possibleTargets = Array.from(
|
|
13
|
+
_Tools.base.querySelectorAll(options.selector)
|
|
14
|
+
);
|
|
15
|
+
} else {
|
|
16
|
+
possibleTargets = Array.from(
|
|
17
|
+
document.querySelectorAll(options.selector)
|
|
18
|
+
);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
if (options.textFilter != null) {
|
|
22
|
+
possibleTargets = possibleTargets.filter((possibleTarget) => {
|
|
23
|
+
const textContent = possibleTarget.textContent.toLowerCase();
|
|
24
|
+
if (Array.isArray(options.textFilter)) {
|
|
25
|
+
let foundText = false;
|
|
26
|
+
for (const text of options.textFilter) {
|
|
27
|
+
if (textContent.indexOf(text.toLowerCase()) !== -1) {
|
|
28
|
+
foundText = true;
|
|
29
|
+
break;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
return foundText;
|
|
33
|
+
} else if (options.textFilter != null) {
|
|
34
|
+
return textContent.indexOf(options.textFilter.toLowerCase()) !== -1;
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
if (options.styleFilters != null) {
|
|
39
|
+
possibleTargets = possibleTargets.filter((possibleTarget) => {
|
|
40
|
+
const styles = window.getComputedStyle(possibleTarget);
|
|
41
|
+
let keep = true;
|
|
42
|
+
for (const styleFilter of options.styleFilters) {
|
|
43
|
+
const option = styles[styleFilter.option];
|
|
44
|
+
if (styleFilter.negated) {
|
|
45
|
+
keep = keep && option !== styleFilter.value;
|
|
46
|
+
} else {
|
|
47
|
+
keep = keep && option === styleFilter.value;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
return keep;
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
if (options.displayFilter != null) {
|
|
54
|
+
possibleTargets = possibleTargets.filter((possibleTarget) => {
|
|
55
|
+
if (options.displayFilter) {
|
|
56
|
+
return possibleTarget.offsetHeight !== 0;
|
|
57
|
+
} else {
|
|
58
|
+
return possibleTarget.offsetHeight === 0;
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
if (options.iframeFilter != null) {
|
|
63
|
+
possibleTargets = possibleTargets.filter(() => {
|
|
64
|
+
if (options.iframeFilter) {
|
|
65
|
+
return window.location !== window.parent.location;
|
|
66
|
+
} else {
|
|
67
|
+
return window.location === window.parent.location;
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
if (options.childFilter != null) {
|
|
72
|
+
possibleTargets = possibleTargets.filter((possibleTarget) => {
|
|
73
|
+
const oldBase = _Tools.base;
|
|
74
|
+
_Tools.setBase(possibleTarget);
|
|
75
|
+
const childResults = _Tools.find(options.childFilter);
|
|
76
|
+
_Tools.setBase(oldBase);
|
|
77
|
+
return childResults.target != null;
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
if (multiple) {
|
|
81
|
+
return possibleTargets;
|
|
82
|
+
} else {
|
|
83
|
+
if (possibleTargets.length > 1) {
|
|
84
|
+
console.warn(
|
|
85
|
+
"Multiple possible targets: ",
|
|
86
|
+
possibleTargets,
|
|
87
|
+
options,
|
|
88
|
+
parent
|
|
89
|
+
);
|
|
90
|
+
}
|
|
91
|
+
return possibleTargets[0];
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
static find(options, multiple = false) {
|
|
95
|
+
const results = [];
|
|
96
|
+
if (options.parent != null) {
|
|
97
|
+
const parent = _Tools.findElement(options.parent, null, multiple);
|
|
98
|
+
if (parent != null) {
|
|
99
|
+
if (parent instanceof Array) {
|
|
100
|
+
parent.forEach((p) => {
|
|
101
|
+
const targets = _Tools.findElement(options.target, p, multiple);
|
|
102
|
+
if (targets instanceof Array) {
|
|
103
|
+
targets.forEach((target) => {
|
|
104
|
+
results.push({
|
|
105
|
+
parent: p,
|
|
106
|
+
target
|
|
107
|
+
});
|
|
108
|
+
});
|
|
109
|
+
} else {
|
|
110
|
+
results.push({
|
|
111
|
+
parent: p,
|
|
112
|
+
target: targets
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
});
|
|
116
|
+
return results;
|
|
117
|
+
} else {
|
|
118
|
+
const targets = _Tools.findElement(options.target, parent, multiple);
|
|
119
|
+
if (targets instanceof Array) {
|
|
120
|
+
targets.forEach((target) => {
|
|
121
|
+
results.push({
|
|
122
|
+
parent,
|
|
123
|
+
target
|
|
124
|
+
});
|
|
125
|
+
});
|
|
126
|
+
} else {
|
|
127
|
+
results.push({
|
|
128
|
+
parent,
|
|
129
|
+
target: targets
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
} else {
|
|
135
|
+
const targets = _Tools.findElement(options.target, null, multiple);
|
|
136
|
+
if (targets instanceof Array) {
|
|
137
|
+
targets.forEach((target) => {
|
|
138
|
+
results.push({
|
|
139
|
+
parent: null,
|
|
140
|
+
target
|
|
141
|
+
});
|
|
142
|
+
});
|
|
143
|
+
} else {
|
|
144
|
+
results.push({
|
|
145
|
+
parent: null,
|
|
146
|
+
target: targets
|
|
147
|
+
});
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
if (results.length === 0) {
|
|
151
|
+
results.push({
|
|
152
|
+
parent: null,
|
|
153
|
+
target: null
|
|
154
|
+
});
|
|
155
|
+
}
|
|
156
|
+
if (multiple) {
|
|
157
|
+
return results;
|
|
158
|
+
} else {
|
|
159
|
+
if (results.length !== 1) {
|
|
160
|
+
console.warn(
|
|
161
|
+
"Multiple results found, even though multiple false",
|
|
162
|
+
results
|
|
163
|
+
);
|
|
164
|
+
}
|
|
165
|
+
return results[0];
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
};
|
|
169
|
+
_Tools.base = null;
|
|
170
|
+
var Tools = _Tools;
|
|
3
171
|
|
|
4
|
-
// lib/
|
|
5
|
-
function
|
|
6
|
-
|
|
7
|
-
|
|
172
|
+
// lib/consentomatic/index.ts
|
|
173
|
+
function matches(config) {
|
|
174
|
+
const result = Tools.find(config);
|
|
175
|
+
if (config.type === "css") {
|
|
176
|
+
return !!result.target;
|
|
177
|
+
} else if (config.type === "checkbox") {
|
|
178
|
+
return !!result.target && result.target.checked;
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
async function executeAction(config, param) {
|
|
182
|
+
switch (config.type) {
|
|
183
|
+
case "click":
|
|
184
|
+
return clickAction(config);
|
|
185
|
+
case "list":
|
|
186
|
+
return listAction(config, param);
|
|
187
|
+
case "consent":
|
|
188
|
+
return consentAction(config, param);
|
|
189
|
+
case "ifcss":
|
|
190
|
+
return ifCssAction(config, param);
|
|
191
|
+
case "waitcss":
|
|
192
|
+
return waitCssAction(config);
|
|
193
|
+
case "foreach":
|
|
194
|
+
return forEachAction(config, param);
|
|
195
|
+
case "hide":
|
|
196
|
+
return hideAction(config);
|
|
197
|
+
case "slide":
|
|
198
|
+
return slideAction(config);
|
|
199
|
+
case "close":
|
|
200
|
+
return closeAction();
|
|
201
|
+
case "wait":
|
|
202
|
+
return waitAction(config);
|
|
203
|
+
case "eval":
|
|
204
|
+
return evalAction(config);
|
|
205
|
+
default:
|
|
206
|
+
throw "Unknown action type: " + config.type;
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
var STEP_TIMEOUT = 0;
|
|
210
|
+
function waitTimeout(timeout) {
|
|
211
|
+
return new Promise((resolve) => {
|
|
212
|
+
setTimeout(() => {
|
|
213
|
+
resolve();
|
|
214
|
+
}, timeout);
|
|
215
|
+
});
|
|
216
|
+
}
|
|
217
|
+
async function clickAction(config) {
|
|
218
|
+
const result = Tools.find(config);
|
|
219
|
+
if (result.target != null) {
|
|
220
|
+
result.target.click();
|
|
221
|
+
}
|
|
222
|
+
return waitTimeout(STEP_TIMEOUT);
|
|
223
|
+
}
|
|
224
|
+
async function listAction(config, param) {
|
|
225
|
+
for (const action of config.actions) {
|
|
226
|
+
await executeAction(action, param);
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
async function consentAction(config, consentTypes) {
|
|
230
|
+
for (const consentConfig of config.consents) {
|
|
231
|
+
const shouldEnable = consentTypes.indexOf(consentConfig.type) !== -1;
|
|
232
|
+
if (consentConfig.matcher && consentConfig.toggleAction) {
|
|
233
|
+
const isEnabled = matches(consentConfig.matcher);
|
|
234
|
+
if (isEnabled !== shouldEnable) {
|
|
235
|
+
await executeAction(consentConfig.toggleAction);
|
|
236
|
+
}
|
|
237
|
+
} else {
|
|
238
|
+
if (shouldEnable) {
|
|
239
|
+
await executeAction(consentConfig.trueAction);
|
|
240
|
+
} else {
|
|
241
|
+
await executeAction(consentConfig.falseAction);
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
async function ifCssAction(config, param) {
|
|
247
|
+
const result = Tools.find(config);
|
|
248
|
+
if (!result.target) {
|
|
249
|
+
if (config.trueAction) {
|
|
250
|
+
await executeAction(config.trueAction, param);
|
|
251
|
+
}
|
|
252
|
+
} else {
|
|
253
|
+
if (config.falseAction) {
|
|
254
|
+
await executeAction(config.falseAction, param);
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
async function waitCssAction(config) {
|
|
259
|
+
await new Promise((resolve) => {
|
|
260
|
+
let numRetries = config.retries || 10;
|
|
261
|
+
const waitTime = config.waitTime || 250;
|
|
262
|
+
const checkCss = () => {
|
|
263
|
+
const result = Tools.find(config);
|
|
264
|
+
if (config.negated && result.target || !config.negated && !result.target) {
|
|
265
|
+
if (numRetries > 0) {
|
|
266
|
+
numRetries -= 1;
|
|
267
|
+
setTimeout(checkCss, waitTime);
|
|
268
|
+
} else {
|
|
269
|
+
resolve();
|
|
270
|
+
}
|
|
271
|
+
} else {
|
|
272
|
+
resolve();
|
|
273
|
+
}
|
|
274
|
+
};
|
|
275
|
+
checkCss();
|
|
276
|
+
});
|
|
277
|
+
}
|
|
278
|
+
async function forEachAction(config, param) {
|
|
279
|
+
const results = Tools.find(config, true);
|
|
280
|
+
const oldBase = Tools.base;
|
|
281
|
+
for (const result of results) {
|
|
282
|
+
if (result.target) {
|
|
283
|
+
Tools.setBase(result.target);
|
|
284
|
+
await executeAction(config.action, param);
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
Tools.setBase(oldBase);
|
|
288
|
+
}
|
|
289
|
+
async function hideAction(config) {
|
|
290
|
+
const result = Tools.find(config);
|
|
291
|
+
if (result.target) {
|
|
292
|
+
result.target.classList.add("Autoconsent-Hidden");
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
async function slideAction(config) {
|
|
296
|
+
const result = Tools.find(config);
|
|
297
|
+
const dragResult = Tools.find(config.dragTarget);
|
|
298
|
+
if (result.target) {
|
|
299
|
+
const targetBounds = result.target.getBoundingClientRect();
|
|
300
|
+
const dragTargetBounds = dragResult.target.getBoundingClientRect();
|
|
301
|
+
let yDiff = dragTargetBounds.top - targetBounds.top;
|
|
302
|
+
let xDiff = dragTargetBounds.left - targetBounds.left;
|
|
303
|
+
if (this.config.axis.toLowerCase() === "y") {
|
|
304
|
+
xDiff = 0;
|
|
305
|
+
}
|
|
306
|
+
if (this.config.axis.toLowerCase() === "x") {
|
|
307
|
+
yDiff = 0;
|
|
308
|
+
}
|
|
309
|
+
const screenX = window.screenX + targetBounds.left + targetBounds.width / 2;
|
|
310
|
+
const screenY = window.screenY + targetBounds.top + targetBounds.height / 2;
|
|
311
|
+
const clientX = targetBounds.left + targetBounds.width / 2;
|
|
312
|
+
const clientY = targetBounds.top + targetBounds.height / 2;
|
|
313
|
+
const mouseDown = document.createEvent("MouseEvents");
|
|
314
|
+
mouseDown.initMouseEvent(
|
|
315
|
+
"mousedown",
|
|
316
|
+
true,
|
|
317
|
+
true,
|
|
318
|
+
window,
|
|
319
|
+
0,
|
|
320
|
+
screenX,
|
|
321
|
+
screenY,
|
|
322
|
+
clientX,
|
|
323
|
+
clientY,
|
|
324
|
+
false,
|
|
325
|
+
false,
|
|
326
|
+
false,
|
|
327
|
+
false,
|
|
328
|
+
0,
|
|
329
|
+
result.target
|
|
330
|
+
);
|
|
331
|
+
const mouseMove = document.createEvent("MouseEvents");
|
|
332
|
+
mouseMove.initMouseEvent(
|
|
333
|
+
"mousemove",
|
|
334
|
+
true,
|
|
335
|
+
true,
|
|
336
|
+
window,
|
|
337
|
+
0,
|
|
338
|
+
screenX + xDiff,
|
|
339
|
+
screenY + yDiff,
|
|
340
|
+
clientX + xDiff,
|
|
341
|
+
clientY + yDiff,
|
|
342
|
+
false,
|
|
343
|
+
false,
|
|
344
|
+
false,
|
|
345
|
+
false,
|
|
346
|
+
0,
|
|
347
|
+
result.target
|
|
348
|
+
);
|
|
349
|
+
const mouseUp = document.createEvent("MouseEvents");
|
|
350
|
+
mouseUp.initMouseEvent(
|
|
351
|
+
"mouseup",
|
|
352
|
+
true,
|
|
353
|
+
true,
|
|
354
|
+
window,
|
|
355
|
+
0,
|
|
356
|
+
screenX + xDiff,
|
|
357
|
+
screenY + yDiff,
|
|
358
|
+
clientX + xDiff,
|
|
359
|
+
clientY + yDiff,
|
|
360
|
+
false,
|
|
361
|
+
false,
|
|
362
|
+
false,
|
|
363
|
+
false,
|
|
364
|
+
0,
|
|
365
|
+
result.target
|
|
366
|
+
);
|
|
367
|
+
result.target.dispatchEvent(mouseDown);
|
|
368
|
+
await this.waitTimeout(10);
|
|
369
|
+
result.target.dispatchEvent(mouseMove);
|
|
370
|
+
await this.waitTimeout(10);
|
|
371
|
+
result.target.dispatchEvent(mouseUp);
|
|
8
372
|
}
|
|
9
|
-
return Math.random().toString();
|
|
10
373
|
}
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
var Deferred = class {
|
|
14
|
-
constructor(id, timeout = 1e3) {
|
|
15
|
-
this.id = id;
|
|
16
|
-
this.promise = new Promise((resolve, reject) => {
|
|
17
|
-
this.resolve = resolve;
|
|
18
|
-
this.reject = reject;
|
|
19
|
-
});
|
|
20
|
-
this.timer = window.setTimeout(() => {
|
|
21
|
-
this.reject(new Error("timeout"));
|
|
22
|
-
}, timeout);
|
|
23
|
-
}
|
|
24
|
-
};
|
|
25
|
-
var evalState = {
|
|
26
|
-
pending: /* @__PURE__ */ new Map(),
|
|
27
|
-
sendContentMessage: null
|
|
28
|
-
};
|
|
29
|
-
function requestEval(code) {
|
|
30
|
-
const id = getRandomID();
|
|
31
|
-
evalState.sendContentMessage({
|
|
32
|
-
type: "eval",
|
|
33
|
-
id,
|
|
34
|
-
code
|
|
35
|
-
});
|
|
36
|
-
const deferred = new Deferred(id);
|
|
37
|
-
evalState.pending.set(deferred.id, deferred);
|
|
38
|
-
return deferred.promise;
|
|
374
|
+
async function waitAction(config) {
|
|
375
|
+
await waitTimeout(config.waitTime);
|
|
39
376
|
}
|
|
40
|
-
function
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
377
|
+
async function closeAction() {
|
|
378
|
+
window.close();
|
|
379
|
+
}
|
|
380
|
+
async function evalAction(config) {
|
|
381
|
+
console.log("eval!", config.code);
|
|
382
|
+
return new Promise((resolve) => {
|
|
383
|
+
try {
|
|
384
|
+
if (config.async) {
|
|
385
|
+
window.eval(config.code);
|
|
386
|
+
setTimeout(() => {
|
|
387
|
+
resolve(window.eval("window.__consentCheckResult"));
|
|
388
|
+
}, config.timeout || 250);
|
|
389
|
+
} else {
|
|
390
|
+
resolve(window.eval(config.code));
|
|
391
|
+
}
|
|
392
|
+
} catch (e) {
|
|
393
|
+
console.warn("eval error", e, config.code);
|
|
394
|
+
resolve(false);
|
|
395
|
+
}
|
|
396
|
+
});
|
|
49
397
|
}
|
|
50
398
|
|
|
399
|
+
// lib/config.ts
|
|
400
|
+
var enableLogs = false;
|
|
401
|
+
|
|
51
402
|
// lib/utils.ts
|
|
52
403
|
function getStyleElement(styleOverrideElementId = "autoconsent-css-rules") {
|
|
53
404
|
const styleSelector = `style#${styleOverrideElementId}`;
|
|
@@ -100,12 +451,6 @@ function isElementVisible(elem) {
|
|
|
100
451
|
}
|
|
101
452
|
|
|
102
453
|
// lib/rule-executors.ts
|
|
103
|
-
function doEval(expr) {
|
|
104
|
-
return requestEval(expr).catch((e) => {
|
|
105
|
-
enableLogs && console.error("error evaluating rule", expr, e);
|
|
106
|
-
return false;
|
|
107
|
-
});
|
|
108
|
-
}
|
|
109
454
|
function click(selector, all = false) {
|
|
110
455
|
const elem = elementSelector(selector);
|
|
111
456
|
enableLogs && console.log("[click]", selector, all, elem);
|
|
@@ -227,6 +572,163 @@ function elementSelector(selector) {
|
|
|
227
572
|
return querySelectorChain(selector);
|
|
228
573
|
}
|
|
229
574
|
|
|
575
|
+
// lib/random.ts
|
|
576
|
+
function getRandomID() {
|
|
577
|
+
if (crypto && typeof crypto.randomUUID !== "undefined") {
|
|
578
|
+
return crypto.randomUUID();
|
|
579
|
+
}
|
|
580
|
+
return Math.random().toString();
|
|
581
|
+
}
|
|
582
|
+
|
|
583
|
+
// lib/eval-handler.ts
|
|
584
|
+
var Deferred = class {
|
|
585
|
+
constructor(id, timeout = 1e3) {
|
|
586
|
+
this.id = id;
|
|
587
|
+
this.promise = new Promise((resolve, reject) => {
|
|
588
|
+
this.resolve = resolve;
|
|
589
|
+
this.reject = reject;
|
|
590
|
+
});
|
|
591
|
+
this.timer = window.setTimeout(() => {
|
|
592
|
+
this.reject(new Error("timeout"));
|
|
593
|
+
}, timeout);
|
|
594
|
+
}
|
|
595
|
+
};
|
|
596
|
+
var evalState = {
|
|
597
|
+
pending: /* @__PURE__ */ new Map(),
|
|
598
|
+
sendContentMessage: null
|
|
599
|
+
};
|
|
600
|
+
function requestEval(code) {
|
|
601
|
+
const id = getRandomID();
|
|
602
|
+
evalState.sendContentMessage({
|
|
603
|
+
type: "eval",
|
|
604
|
+
id,
|
|
605
|
+
code
|
|
606
|
+
});
|
|
607
|
+
const deferred = new Deferred(id);
|
|
608
|
+
evalState.pending.set(deferred.id, deferred);
|
|
609
|
+
return deferred.promise;
|
|
610
|
+
}
|
|
611
|
+
function resolveEval(id, value) {
|
|
612
|
+
const deferred = evalState.pending.get(id);
|
|
613
|
+
if (deferred) {
|
|
614
|
+
evalState.pending.delete(id);
|
|
615
|
+
deferred.timer && window.clearTimeout(deferred.timer);
|
|
616
|
+
deferred.resolve(value);
|
|
617
|
+
} else {
|
|
618
|
+
console.warn("no eval #", id);
|
|
619
|
+
}
|
|
620
|
+
}
|
|
621
|
+
|
|
622
|
+
// lib/eval-snippets.ts
|
|
623
|
+
var snippets = {
|
|
624
|
+
// code-based rules
|
|
625
|
+
EVAL_0: () => console.log(1),
|
|
626
|
+
EVAL_CONSENTMANAGER_1: () => window.__cmp && typeof __cmp("getCMPData") === "object",
|
|
627
|
+
EVAL_CONSENTMANAGER_2: () => !__cmp("consentStatus").userChoiceExists,
|
|
628
|
+
EVAL_CONSENTMANAGER_3: () => __cmp("setConsent", 0),
|
|
629
|
+
EVAL_CONSENTMANAGER_4: () => __cmp("setConsent", 1),
|
|
630
|
+
EVAL_CONSENTMANAGER_5: () => __cmp("consentStatus").userChoiceExists,
|
|
631
|
+
EVAL_COOKIEBOT_1: () => window.CookieConsent.hasResponse !== true,
|
|
632
|
+
EVAL_COOKIEBOT_2: () => window.Cookiebot.dialog.submitConsent(),
|
|
633
|
+
EVAL_COOKIEBOT_3: () => endCookieProcess(),
|
|
634
|
+
EVAL_COOKIEBOT_4: () => window.CookieConsent.declined === true,
|
|
635
|
+
EVAL_KLARO_1: () => klaro.getManager().config.services.every((c) => c.required || !klaro.getManager().consents[c.name]),
|
|
636
|
+
EVAL_ONETRUST_1: () => window.OnetrustActiveGroups.split(",").filter((s) => s.length > 0).length <= 1,
|
|
637
|
+
EVAL_TRUSTARC_TOP: () => window && window.truste && window.truste.eu.bindMap.prefCookie === "0",
|
|
638
|
+
// declarative rules
|
|
639
|
+
EVAL_ADROLL_0: () => !document.cookie.includes("__adroll_fpc"),
|
|
640
|
+
EVAL_AFFINITY_SERIF_COM_0: () => document.cookie.includes("serif_manage_cookies_viewed") && !document.cookie.includes("serif_allow_analytics"),
|
|
641
|
+
EVAL_AXEPTIO_0: () => document.cookie.includes("axeptio_authorized_vendors=%2C%2C"),
|
|
642
|
+
EVAL_BING_0: () => document.cookie.includes("AL=0") && document.cookie.includes("AD=0") && document.cookie.includes("SM=0"),
|
|
643
|
+
EVAL_BORLABS_0: () => !JSON.parse(decodeURIComponent(document.cookie.split(";").find((c) => c.indexOf("borlabs-cookie") !== -1).split("=", 2)[1])).consents.statistics,
|
|
644
|
+
EVAL_BUNDESREGIERUNG_DE_0: () => document.cookie.match("cookie-allow-tracking=0"),
|
|
645
|
+
EVAL_CANVA_0: () => !document.cookie.includes("gtm_fpc_engagement_event"),
|
|
646
|
+
EVAL_CLICKIO_0: () => document.cookie.includes("__lxG__consent__v2_daisybit="),
|
|
647
|
+
EVAL_CLINCH_0: () => document.cookie.includes("ctc_rejected=1"),
|
|
648
|
+
EVAL_COINBASE_0: () => JSON.parse(decodeURIComponent(document.cookie.match(/cm_(eu|default)_preferences=([0-9a-zA-Z\\{\\}\\[\\]%:]*);?/)[2])).consent.length <= 1,
|
|
649
|
+
EVAL_COMPLIANZ_BANNER_0: () => document.cookie.includes("cmplz_banner-status=dismissed"),
|
|
650
|
+
EVAL_COMPLIANZ_CATEGORIES_0: () => !!document.cookie.match(/cmplz_[^=]+=deny/),
|
|
651
|
+
EVAL_COMPLIANZ_OPTIN_0: () => !!document.cookie.match(/cookieconsent_preferences_disabled=[^;]+/),
|
|
652
|
+
EVAL_COOKIE_LAW_INFO_0: () => CLI.disableAllCookies() || CLI.reject_close() || true,
|
|
653
|
+
EVAL_COOKIE_LAW_INFO_1: () => document.cookie.indexOf("cookielawinfo-checkbox-non-necessary=yes") === -1,
|
|
654
|
+
EVAL_COOKIE_MANAGER_POPUP_0: () => JSON.parse(document.cookie.split(";").find((c) => c.trim().startsWith("CookieLevel")).split("=")[1]).social === false,
|
|
655
|
+
EVAL_COOKIEALERT_0: () => document.querySelector("body").removeAttribute("style") || true,
|
|
656
|
+
EVAL_COOKIEALERT_1: () => document.querySelector("body").removeAttribute("style") || true,
|
|
657
|
+
EVAL_COOKIEALERT_2: () => window.CookieConsent.declined === true,
|
|
658
|
+
EVAL_COOKIEFIRST_0: () => ((o) => o.performance === false && o.functional === false && o.advertising === false)(JSON.parse(decodeURIComponent(document.cookie.split(";").find((c) => c.indexOf("cookiefirst") !== -1).trim()).split("=")[1])),
|
|
659
|
+
EVAL_COOKIEFIRST_1: () => document.querySelectorAll("button[data-cookiefirst-accent-color=true][role=checkbox]:not([disabled])").forEach((i) => i.getAttribute("aria-checked") == "true" && i.click()) || true,
|
|
660
|
+
EVAL_COOKIEINFORMATION_0: () => CookieInformation.declineAllCategories() || true,
|
|
661
|
+
EVAL_COOKIEINFORMATION_1: () => CookieInformation.submitAllCategories() || true,
|
|
662
|
+
EVAL_COOKIEINFORMATION_2: () => document.cookie.includes("CookieInformationConsent="),
|
|
663
|
+
EVAL_DAILYMOTION_0: () => !!document.cookie.match("dm-euconsent-v2"),
|
|
664
|
+
EVAL_DSGVO_0: () => !document.cookie.includes("sp_dsgvo_cookie_settings"),
|
|
665
|
+
EVAL_DUNELM_0: () => document.cookie.includes("cc_functional=0") && document.cookie.includes("cc_targeting=0"),
|
|
666
|
+
EVAL_ETSY_0: () => document.querySelectorAll(".gdpr-overlay-body input").forEach((toggle) => {
|
|
667
|
+
toggle.checked = false;
|
|
668
|
+
}) || true,
|
|
669
|
+
EVAL_ETSY_1: () => document.querySelector(".gdpr-overlay-view button[data-wt-overlay-close]").click() || true,
|
|
670
|
+
EVAL_EU_COOKIE_COMPLIANCE_0: () => document.cookie.indexOf("cookie-agreed=2") === -1,
|
|
671
|
+
EVAL_EU_COOKIE_LAW_0: () => !document.cookie.includes("euCookie"),
|
|
672
|
+
EVAL_EZOIC_0: () => ezCMP.handleAcceptAllClick(),
|
|
673
|
+
EVAL_EZOIC_1: () => !!document.cookie.match(/ezCMPCookieConsent=[^;]+\|2=0\|3=0\|4=0/),
|
|
674
|
+
EVAL_GOOGLE_0: () => !!document.cookie.match(/SOCS=CAE/),
|
|
675
|
+
EVAL_IUBENDA_0: () => document.querySelectorAll(".purposes-item input[type=checkbox]:not([disabled])").forEach((x) => {
|
|
676
|
+
if (x.checked)
|
|
677
|
+
x.click();
|
|
678
|
+
}) || true,
|
|
679
|
+
EVAL_IUBENDA_1: () => !!document.cookie.match(/_iub_cs-\d+=/),
|
|
680
|
+
EVAL_JQUERY_COOKIEBAR_0: () => !document.cookie.includes("cookies-state=accepted"),
|
|
681
|
+
EVAL_MEDIAVINE_0: () => document.querySelectorAll('[data-name="mediavine-gdpr-cmp"] input[type=checkbox]').forEach((x) => x.checked && x.click()) || true,
|
|
682
|
+
EVAL_MICROSOFT_0: () => Array.from(document.querySelectorAll("div > button")).filter((el) => el.innerText.match("Reject|Ablehnen"))[0].click() || true,
|
|
683
|
+
EVAL_MICROSOFT_1: () => Array.from(document.querySelectorAll("div > button")).filter((el) => el.innerText.match("Accept|Annehmen"))[0].click() || true,
|
|
684
|
+
EVAL_MICROSOFT_2: () => !!document.cookie.match("MSCC"),
|
|
685
|
+
EVAL_MOOVE_0: () => document.querySelectorAll("#moove_gdpr_cookie_modal input").forEach((i) => {
|
|
686
|
+
if (!i.disabled && i.name !== "moove_gdpr_strict_cookies")
|
|
687
|
+
i.checked = false;
|
|
688
|
+
}) || true,
|
|
689
|
+
EVAL_ONENINETWO_0: () => document.cookie.includes("CC_ADVERTISING=NO") && document.cookie.includes("CC_ANALYTICS=NO"),
|
|
690
|
+
EVAL_PAYPAL_0: () => document.cookie.includes("cookie_prefs") === true,
|
|
691
|
+
EVAL_PRIMEBOX_0: () => !document.cookie.includes("cb-enabled=accepted"),
|
|
692
|
+
EVAL_PUBTECH_0: () => document.cookie.includes("euconsent-v2") && (document.cookie.match(/.YAAAAAAAAAAA/) || document.cookie.match(/.aAAAAAAAAAAA/) || document.cookie.match(/.YAAACFgAAAAA/)),
|
|
693
|
+
EVAL_REDDIT_0: () => document.cookie.includes("eu_cookie={%22opted%22:true%2C%22nonessential%22:false}"),
|
|
694
|
+
EVAL_SIBBO_0: () => !!window.localStorage.getItem("euconsent-v2"),
|
|
695
|
+
EVAL_SIRDATA_0: () => document.cookie.includes("euconsent-v2"),
|
|
696
|
+
EVAL_SNIGEL_0: () => !!document.cookie.match("snconsent"),
|
|
697
|
+
EVAL_STEAMPOWERED_0: () => JSON.parse(decodeURIComponent(document.cookie.split(";").find((s) => s.trim().startsWith("cookieSettings")).split("=")[1])).preference_state === 2,
|
|
698
|
+
EVAL_TARTEAUCITRON_0: () => tarteaucitron.userInterface.respondAll(false) || true,
|
|
699
|
+
EVAL_TARTEAUCITRON_1: () => tarteaucitron.userInterface.respondAll(true) || true,
|
|
700
|
+
EVAL_TARTEAUCITRON_2: () => document.cookie.match(/tarteaucitron=[^;]*/)[0].includes("false"),
|
|
701
|
+
EVAL_TEALIUM_0: () => typeof window.utag !== "undefined" && typeof utag.gdpr === "object",
|
|
702
|
+
EVAL_TEALIUM_1: () => utag.gdpr.setConsentValue(false) || true,
|
|
703
|
+
EVAL_TEALIUM_2: () => utag.gdpr.setConsentValue(true) || true,
|
|
704
|
+
EVAL_TEALIUM_3: () => utag.gdpr.getConsentState() !== 1,
|
|
705
|
+
EVAL_TESTCMP_0: () => window.results.results[0] === "button_clicked",
|
|
706
|
+
EVAL_TESTCMP_COSMETIC_0: () => window.results.results[0] === "banner_hidden",
|
|
707
|
+
EVAL_THEFREEDICTIONARY_0: () => cmpUi.showPurposes() || cmpUi.rejectAll() || true,
|
|
708
|
+
EVAL_THEFREEDICTIONARY_1: () => cmpUi.allowAll() || true,
|
|
709
|
+
EVAL_THEVERGE_0: () => document.cookie.includes("_duet_gdpr_acknowledged=1"),
|
|
710
|
+
EVAL_UBUNTU_COM_0: () => document.cookie === "_cookies_accepted=essential",
|
|
711
|
+
EVAL_UK_COOKIE_CONSENT_0: () => !document.cookie.includes("catAccCookies"),
|
|
712
|
+
EVAL_USERCENTRICS_API_0: () => typeof UC_UI === "object",
|
|
713
|
+
EVAL_USERCENTRICS_API_1: () => !!UC_UI.closeCMP(),
|
|
714
|
+
EVAL_USERCENTRICS_API_2: () => !!UC_UI.denyAllConsents(),
|
|
715
|
+
EVAL_USERCENTRICS_API_3: () => !!UC_UI.acceptAllConsents(),
|
|
716
|
+
EVAL_USERCENTRICS_API_4: () => !!UC_UI.closeCMP(),
|
|
717
|
+
EVAL_USERCENTRICS_API_5: () => UC_UI.areAllConsentsAccepted() === true,
|
|
718
|
+
EVAL_USERCENTRICS_API_6: () => UC_UI.areAllConsentsAccepted() === false,
|
|
719
|
+
EVAL_USERCENTRICS_BUTTON_0: () => JSON.parse(localStorage.getItem("usercentrics")).consents.every((c) => c.isEssential || !c.consentStatus),
|
|
720
|
+
EVAL_WAITROSE_0: () => Array.from(document.querySelectorAll("label[id$=cookies-deny-label]")).forEach((e) => e.click()) || true,
|
|
721
|
+
EVAL_WAITROSE_1: () => document.cookie.includes("wtr_cookies_advertising=0") && document.cookie.includes("wtr_cookies_analytics=0"),
|
|
722
|
+
EVAL_WP_COOKIE_NOTICE_0: () => document.cookie.includes("wpl_viewed_cookie=no"),
|
|
723
|
+
EVAL_XING_0: () => document.cookie.includes("userConsent=%7B%22marketing%22%3Afalse"),
|
|
724
|
+
EVAL_YOUTUBE_DESKTOP_0: () => !!document.cookie.match(/SOCS=CAE/),
|
|
725
|
+
EVAL_YOUTUBE_MOBILE_0: () => !!document.cookie.match(/SOCS=CAE/)
|
|
726
|
+
};
|
|
727
|
+
function getFunctionBody(snippetFunc) {
|
|
728
|
+
const snippetStr = snippetFunc.toString();
|
|
729
|
+
return snippetStr.substring(snippetStr.indexOf("=>") + 2);
|
|
730
|
+
}
|
|
731
|
+
|
|
230
732
|
// lib/cmps/base.ts
|
|
231
733
|
var defaultRunContext = {
|
|
232
734
|
main: true,
|
|
@@ -234,9 +736,9 @@ var defaultRunContext = {
|
|
|
234
736
|
urlPattern: ""
|
|
235
737
|
};
|
|
236
738
|
var AutoConsentCMPBase = class {
|
|
237
|
-
constructor(
|
|
739
|
+
constructor(autoconsentInstance) {
|
|
238
740
|
this.runContext = defaultRunContext;
|
|
239
|
-
this.
|
|
741
|
+
this.autoconsent = autoconsentInstance;
|
|
240
742
|
}
|
|
241
743
|
get hasSelfTest() {
|
|
242
744
|
throw new Error("Not Implemented");
|
|
@@ -247,6 +749,29 @@ var AutoConsentCMPBase = class {
|
|
|
247
749
|
get isCosmetic() {
|
|
248
750
|
throw new Error("Not Implemented");
|
|
249
751
|
}
|
|
752
|
+
mainWorldEval(snippetId) {
|
|
753
|
+
const snippet = snippets[snippetId];
|
|
754
|
+
if (!snippet) {
|
|
755
|
+
console.warn("Snippet not found", snippetId);
|
|
756
|
+
return Promise.resolve(false);
|
|
757
|
+
}
|
|
758
|
+
if (this.autoconsent.config.isMainWorld) {
|
|
759
|
+
enableLogs && console.log("inline eval:", snippetId, snippet);
|
|
760
|
+
let result = false;
|
|
761
|
+
try {
|
|
762
|
+
result = !!snippet.call(globalThis);
|
|
763
|
+
} catch (e) {
|
|
764
|
+
enableLogs && console.error("error evaluating rule", snippetId, e);
|
|
765
|
+
}
|
|
766
|
+
return Promise.resolve(result);
|
|
767
|
+
}
|
|
768
|
+
const snippetSrc = getFunctionBody(snippet);
|
|
769
|
+
enableLogs && console.log("async eval:", snippetId, snippetSrc);
|
|
770
|
+
return requestEval(snippetSrc).catch((e) => {
|
|
771
|
+
enableLogs && console.error("error evaluating rule", snippetId, e);
|
|
772
|
+
return false;
|
|
773
|
+
});
|
|
774
|
+
}
|
|
250
775
|
checkRunContext() {
|
|
251
776
|
const runCtx = {
|
|
252
777
|
...defaultRunContext,
|
|
@@ -283,84 +808,11 @@ var AutoConsentCMPBase = class {
|
|
|
283
808
|
return Promise.resolve(true);
|
|
284
809
|
}
|
|
285
810
|
};
|
|
286
|
-
async function evaluateRuleStep(rule) {
|
|
287
|
-
const results = [];
|
|
288
|
-
if (rule.exists) {
|
|
289
|
-
results.push(elementExists(rule.exists));
|
|
290
|
-
}
|
|
291
|
-
if (rule.visible) {
|
|
292
|
-
results.push(elementVisible(rule.visible, rule.check));
|
|
293
|
-
}
|
|
294
|
-
if (rule.eval) {
|
|
295
|
-
const res = doEval(rule.eval);
|
|
296
|
-
results.push(res);
|
|
297
|
-
}
|
|
298
|
-
if (rule.waitFor) {
|
|
299
|
-
results.push(waitForElement(rule.waitFor, rule.timeout));
|
|
300
|
-
}
|
|
301
|
-
if (rule.waitForVisible) {
|
|
302
|
-
results.push(waitForVisible(rule.waitForVisible, rule.timeout, rule.check));
|
|
303
|
-
}
|
|
304
|
-
if (rule.click) {
|
|
305
|
-
results.push(click(rule.click, rule.all));
|
|
306
|
-
}
|
|
307
|
-
if (rule.waitForThenClick) {
|
|
308
|
-
results.push(waitForThenClick(rule.waitForThenClick, rule.timeout, rule.all));
|
|
309
|
-
}
|
|
310
|
-
if (rule.wait) {
|
|
311
|
-
results.push(wait(rule.wait));
|
|
312
|
-
}
|
|
313
|
-
if (rule.hide) {
|
|
314
|
-
results.push(hide(rule.hide, rule.method));
|
|
315
|
-
}
|
|
316
|
-
if (rule.if) {
|
|
317
|
-
if (!rule.if.exists && !rule.if.visible) {
|
|
318
|
-
console.error("invalid conditional rule", rule.if);
|
|
319
|
-
return false;
|
|
320
|
-
}
|
|
321
|
-
const condition = await evaluateRuleStep(rule.if);
|
|
322
|
-
enableLogs && console.log("Condition is", condition);
|
|
323
|
-
if (condition) {
|
|
324
|
-
results.push(_runRulesSequentially(rule.then));
|
|
325
|
-
} else if (rule.else) {
|
|
326
|
-
results.push(_runRulesSequentially(rule.else));
|
|
327
|
-
}
|
|
328
|
-
}
|
|
329
|
-
if (rule.any) {
|
|
330
|
-
for (const step of rule.any) {
|
|
331
|
-
if (await evaluateRuleStep(step)) {
|
|
332
|
-
return true;
|
|
333
|
-
}
|
|
334
|
-
}
|
|
335
|
-
return false;
|
|
336
|
-
}
|
|
337
|
-
if (results.length === 0) {
|
|
338
|
-
enableLogs && console.warn("Unrecognized rule", rule);
|
|
339
|
-
return false;
|
|
340
|
-
}
|
|
341
|
-
const all = await Promise.all(results);
|
|
342
|
-
return all.reduce((a, b) => a && b, true);
|
|
343
|
-
}
|
|
344
|
-
async function _runRulesParallel(rules3) {
|
|
345
|
-
const results = rules3.map((rule) => evaluateRuleStep(rule));
|
|
346
|
-
const detections = await Promise.all(results);
|
|
347
|
-
return detections.every((r) => !!r);
|
|
348
|
-
}
|
|
349
|
-
async function _runRulesSequentially(rules3) {
|
|
350
|
-
for (const rule of rules3) {
|
|
351
|
-
enableLogs && console.log("Running rule...", rule);
|
|
352
|
-
const result = await evaluateRuleStep(rule);
|
|
353
|
-
enableLogs && console.log("...rule result", result);
|
|
354
|
-
if (!result && !rule.optional) {
|
|
355
|
-
return false;
|
|
356
|
-
}
|
|
357
|
-
}
|
|
358
|
-
return true;
|
|
359
|
-
}
|
|
360
811
|
var AutoConsentCMP = class extends AutoConsentCMPBase {
|
|
361
|
-
constructor(config) {
|
|
362
|
-
super(
|
|
812
|
+
constructor(config, autoconsentInstance) {
|
|
813
|
+
super(autoconsentInstance);
|
|
363
814
|
this.config = config;
|
|
815
|
+
this.name = config.name;
|
|
364
816
|
this.runContext = config.runContext || defaultRunContext;
|
|
365
817
|
}
|
|
366
818
|
get hasSelfTest() {
|
|
@@ -377,41 +829,180 @@ var AutoConsentCMP = class extends AutoConsentCMPBase {
|
|
|
377
829
|
}
|
|
378
830
|
async detectCmp() {
|
|
379
831
|
if (this.config.detectCmp) {
|
|
380
|
-
return _runRulesParallel(this.config.detectCmp);
|
|
832
|
+
return this._runRulesParallel(this.config.detectCmp);
|
|
381
833
|
}
|
|
382
834
|
return false;
|
|
383
835
|
}
|
|
384
836
|
async detectPopup() {
|
|
385
837
|
if (this.config.detectPopup) {
|
|
386
|
-
return _runRulesSequentially(this.config.detectPopup);
|
|
838
|
+
return this._runRulesSequentially(this.config.detectPopup);
|
|
387
839
|
}
|
|
388
840
|
return false;
|
|
389
841
|
}
|
|
390
842
|
async optOut() {
|
|
391
843
|
if (this.config.optOut) {
|
|
392
844
|
enableLogs && console.log("Initiated optOut()", this.config.optOut);
|
|
393
|
-
return _runRulesSequentially(this.config.optOut);
|
|
845
|
+
return this._runRulesSequentially(this.config.optOut);
|
|
394
846
|
}
|
|
395
847
|
return false;
|
|
396
848
|
}
|
|
397
849
|
async optIn() {
|
|
398
850
|
if (this.config.optIn) {
|
|
399
851
|
enableLogs && console.log("Initiated optIn()", this.config.optIn);
|
|
400
|
-
return _runRulesSequentially(this.config.optIn);
|
|
852
|
+
return this._runRulesSequentially(this.config.optIn);
|
|
401
853
|
}
|
|
402
854
|
return false;
|
|
403
855
|
}
|
|
404
856
|
async openCmp() {
|
|
405
857
|
if (this.config.openCmp) {
|
|
406
|
-
return _runRulesSequentially(this.config.openCmp);
|
|
858
|
+
return this._runRulesSequentially(this.config.openCmp);
|
|
859
|
+
}
|
|
860
|
+
return false;
|
|
861
|
+
}
|
|
862
|
+
async test() {
|
|
863
|
+
if (this.hasSelfTest) {
|
|
864
|
+
return this._runRulesSequentially(this.config.test);
|
|
865
|
+
}
|
|
866
|
+
return super.test();
|
|
867
|
+
}
|
|
868
|
+
async evaluateRuleStep(rule) {
|
|
869
|
+
const results = [];
|
|
870
|
+
if (rule.exists) {
|
|
871
|
+
results.push(elementExists(rule.exists));
|
|
872
|
+
}
|
|
873
|
+
if (rule.visible) {
|
|
874
|
+
results.push(elementVisible(rule.visible, rule.check));
|
|
875
|
+
}
|
|
876
|
+
if (rule.eval) {
|
|
877
|
+
const res = this.mainWorldEval(rule.eval);
|
|
878
|
+
results.push(res);
|
|
879
|
+
}
|
|
880
|
+
if (rule.waitFor) {
|
|
881
|
+
results.push(waitForElement(rule.waitFor, rule.timeout));
|
|
882
|
+
}
|
|
883
|
+
if (rule.waitForVisible) {
|
|
884
|
+
results.push(waitForVisible(rule.waitForVisible, rule.timeout, rule.check));
|
|
885
|
+
}
|
|
886
|
+
if (rule.click) {
|
|
887
|
+
results.push(click(rule.click, rule.all));
|
|
888
|
+
}
|
|
889
|
+
if (rule.waitForThenClick) {
|
|
890
|
+
results.push(waitForThenClick(rule.waitForThenClick, rule.timeout, rule.all));
|
|
891
|
+
}
|
|
892
|
+
if (rule.wait) {
|
|
893
|
+
results.push(wait(rule.wait));
|
|
894
|
+
}
|
|
895
|
+
if (rule.hide) {
|
|
896
|
+
results.push(hide(rule.hide, rule.method));
|
|
897
|
+
}
|
|
898
|
+
if (rule.if) {
|
|
899
|
+
if (!rule.if.exists && !rule.if.visible) {
|
|
900
|
+
console.error("invalid conditional rule", rule.if);
|
|
901
|
+
return false;
|
|
902
|
+
}
|
|
903
|
+
const condition = await this.evaluateRuleStep(rule.if);
|
|
904
|
+
enableLogs && console.log("Condition is", condition);
|
|
905
|
+
if (condition) {
|
|
906
|
+
results.push(this._runRulesSequentially(rule.then));
|
|
907
|
+
} else if (rule.else) {
|
|
908
|
+
results.push(this._runRulesSequentially(rule.else));
|
|
909
|
+
}
|
|
910
|
+
}
|
|
911
|
+
if (rule.any) {
|
|
912
|
+
for (const step of rule.any) {
|
|
913
|
+
if (await this.evaluateRuleStep(step)) {
|
|
914
|
+
return true;
|
|
915
|
+
}
|
|
916
|
+
}
|
|
917
|
+
return false;
|
|
918
|
+
}
|
|
919
|
+
if (results.length === 0) {
|
|
920
|
+
enableLogs && console.warn("Unrecognized rule", rule);
|
|
921
|
+
return false;
|
|
922
|
+
}
|
|
923
|
+
const all = await Promise.all(results);
|
|
924
|
+
return all.reduce((a, b) => a && b, true);
|
|
925
|
+
}
|
|
926
|
+
async _runRulesParallel(rules) {
|
|
927
|
+
const results = rules.map((rule) => this.evaluateRuleStep(rule));
|
|
928
|
+
const detections = await Promise.all(results);
|
|
929
|
+
return detections.every((r) => !!r);
|
|
930
|
+
}
|
|
931
|
+
async _runRulesSequentially(rules) {
|
|
932
|
+
for (const rule of rules) {
|
|
933
|
+
enableLogs && console.log("Running rule...", rule);
|
|
934
|
+
const result = await this.evaluateRuleStep(rule);
|
|
935
|
+
enableLogs && console.log("...rule result", result);
|
|
936
|
+
if (!result && !rule.optional) {
|
|
937
|
+
return false;
|
|
938
|
+
}
|
|
407
939
|
}
|
|
940
|
+
return true;
|
|
941
|
+
}
|
|
942
|
+
};
|
|
943
|
+
|
|
944
|
+
// lib/cmps/consentomatic.ts
|
|
945
|
+
var ConsentOMaticCMP = class {
|
|
946
|
+
constructor(name, config) {
|
|
947
|
+
this.name = name;
|
|
948
|
+
this.config = config;
|
|
949
|
+
this.methods = /* @__PURE__ */ new Map();
|
|
950
|
+
this.runContext = defaultRunContext;
|
|
951
|
+
this.isCosmetic = false;
|
|
952
|
+
config.methods.forEach((methodConfig) => {
|
|
953
|
+
if (methodConfig.action) {
|
|
954
|
+
this.methods.set(methodConfig.name, methodConfig.action);
|
|
955
|
+
}
|
|
956
|
+
});
|
|
957
|
+
this.hasSelfTest = false;
|
|
958
|
+
}
|
|
959
|
+
get isIntermediate() {
|
|
408
960
|
return false;
|
|
409
961
|
}
|
|
962
|
+
checkRunContext() {
|
|
963
|
+
return true;
|
|
964
|
+
}
|
|
965
|
+
async detectCmp() {
|
|
966
|
+
const matchResults = this.config.detectors.map(
|
|
967
|
+
(detectorConfig) => matches(detectorConfig.presentMatcher)
|
|
968
|
+
);
|
|
969
|
+
return matchResults.some((r) => !!r);
|
|
970
|
+
}
|
|
971
|
+
async detectPopup() {
|
|
972
|
+
const matchResults = this.config.detectors.map(
|
|
973
|
+
(detectorConfig) => matches(detectorConfig.showingMatcher)
|
|
974
|
+
);
|
|
975
|
+
return matchResults.some((r) => !!r);
|
|
976
|
+
}
|
|
977
|
+
async executeAction(method, param) {
|
|
978
|
+
if (this.methods.has(method)) {
|
|
979
|
+
return executeAction(this.methods.get(method), param);
|
|
980
|
+
}
|
|
981
|
+
return true;
|
|
982
|
+
}
|
|
983
|
+
async optOut() {
|
|
984
|
+
await this.executeAction("HIDE_CMP");
|
|
985
|
+
await this.executeAction("OPEN_OPTIONS");
|
|
986
|
+
await this.executeAction("HIDE_CMP");
|
|
987
|
+
await this.executeAction("DO_CONSENT", []);
|
|
988
|
+
await this.executeAction("SAVE_CONSENT");
|
|
989
|
+
return true;
|
|
990
|
+
}
|
|
991
|
+
async optIn() {
|
|
992
|
+
await this.executeAction("HIDE_CMP");
|
|
993
|
+
await this.executeAction("OPEN_OPTIONS");
|
|
994
|
+
await this.executeAction("HIDE_CMP");
|
|
995
|
+
await this.executeAction("DO_CONSENT", ["D", "A", "B", "E", "F", "X"]);
|
|
996
|
+
await this.executeAction("SAVE_CONSENT");
|
|
997
|
+
return true;
|
|
998
|
+
}
|
|
999
|
+
async openCmp() {
|
|
1000
|
+
await this.executeAction("HIDE_CMP");
|
|
1001
|
+
await this.executeAction("OPEN_OPTIONS");
|
|
1002
|
+
return true;
|
|
1003
|
+
}
|
|
410
1004
|
async test() {
|
|
411
|
-
|
|
412
|
-
return _runRulesSequentially(this.config.test);
|
|
413
|
-
}
|
|
414
|
-
return super.test();
|
|
1005
|
+
return true;
|
|
415
1006
|
}
|
|
416
1007
|
};
|
|
417
1008
|
|
|
@@ -423,8 +1014,9 @@ var popupContent = "#truste-consent-content";
|
|
|
423
1014
|
var bannerOverlay = "#trustarc-banner-overlay";
|
|
424
1015
|
var bannerContainer = "#truste-consent-track";
|
|
425
1016
|
var TrustArcTop = class extends AutoConsentCMPBase {
|
|
426
|
-
constructor() {
|
|
427
|
-
super(
|
|
1017
|
+
constructor(autoconsentInstance) {
|
|
1018
|
+
super(autoconsentInstance);
|
|
1019
|
+
this.name = "TrustArc-top";
|
|
428
1020
|
this.prehideSelectors = [
|
|
429
1021
|
".trustarc-banner-container",
|
|
430
1022
|
`.truste_popframe,.truste_overlay,.truste_box_overlay,${bannerContainer}`
|
|
@@ -484,14 +1076,15 @@ var TrustArcTop = class extends AutoConsentCMPBase {
|
|
|
484
1076
|
return true;
|
|
485
1077
|
}
|
|
486
1078
|
async test() {
|
|
487
|
-
return await
|
|
1079
|
+
return await this.mainWorldEval("EVAL_TRUSTARC_TOP");
|
|
488
1080
|
}
|
|
489
1081
|
};
|
|
490
1082
|
|
|
491
1083
|
// lib/cmps/trustarc-frame.ts
|
|
492
1084
|
var TrustArcFrame = class extends AutoConsentCMPBase {
|
|
493
1085
|
constructor() {
|
|
494
|
-
super(
|
|
1086
|
+
super(...arguments);
|
|
1087
|
+
this.name = "TrustArc-frame";
|
|
495
1088
|
this.runContext = {
|
|
496
1089
|
main: false,
|
|
497
1090
|
frame: true,
|
|
@@ -575,7 +1168,8 @@ var TrustArcFrame = class extends AutoConsentCMPBase {
|
|
|
575
1168
|
// lib/cmps/cookiebot.ts
|
|
576
1169
|
var Cookiebot = class extends AutoConsentCMPBase {
|
|
577
1170
|
constructor() {
|
|
578
|
-
super(
|
|
1171
|
+
super(...arguments);
|
|
1172
|
+
this.name = "Cybotcookiebot";
|
|
579
1173
|
this.prehideSelectors = ["#CybotCookiebotDialog,#dtcookie-container,#cookiebanner,#cb-cookieoverlay"];
|
|
580
1174
|
}
|
|
581
1175
|
get hasSelfTest() {
|
|
@@ -618,12 +1212,12 @@ var Cookiebot = class extends AutoConsentCMPBase {
|
|
|
618
1212
|
} else {
|
|
619
1213
|
click("#CybotCookiebotDialogBodyLevelButtonAccept,#CybotCookiebotDialogBodyButtonAccept,#CybotCookiebotDialogBodyLevelButtonLevelOptinAllowallSelection", true);
|
|
620
1214
|
}
|
|
621
|
-
if (await
|
|
622
|
-
await
|
|
1215
|
+
if (await this.mainWorldEval("EVAL_COOKIEBOT_1")) {
|
|
1216
|
+
await this.mainWorldEval("EVAL_COOKIEBOT_2");
|
|
623
1217
|
await wait(500);
|
|
624
1218
|
}
|
|
625
1219
|
if (elementExists("#cb-confirmedSettings")) {
|
|
626
|
-
await
|
|
1220
|
+
await this.mainWorldEval("EVAL_COOKIEBOT_3");
|
|
627
1221
|
}
|
|
628
1222
|
return true;
|
|
629
1223
|
}
|
|
@@ -637,14 +1231,15 @@ var Cookiebot = class extends AutoConsentCMPBase {
|
|
|
637
1231
|
return true;
|
|
638
1232
|
}
|
|
639
1233
|
async test() {
|
|
640
|
-
return
|
|
1234
|
+
return this.mainWorldEval("EVAL_COOKIEBOT_4");
|
|
641
1235
|
}
|
|
642
1236
|
};
|
|
643
1237
|
|
|
644
1238
|
// lib/cmps/sourcepoint-frame.ts
|
|
645
1239
|
var SourcePoint = class extends AutoConsentCMPBase {
|
|
646
1240
|
constructor() {
|
|
647
|
-
super(
|
|
1241
|
+
super(...arguments);
|
|
1242
|
+
this.name = "Sourcepoint-frame";
|
|
648
1243
|
this.prehideSelectors = ["div[id^='sp_message_container_'],.message-overlay", "#sp_privacy_manager_container"];
|
|
649
1244
|
this.ccpaNotice = false;
|
|
650
1245
|
this.ccpaPopup = false;
|
|
@@ -753,7 +1348,8 @@ var SourcePoint = class extends AutoConsentCMPBase {
|
|
|
753
1348
|
// lib/cmps/consentmanager.ts
|
|
754
1349
|
var ConsentManager = class extends AutoConsentCMPBase {
|
|
755
1350
|
constructor() {
|
|
756
|
-
super(
|
|
1351
|
+
super(...arguments);
|
|
1352
|
+
this.name = "consentmanager.net";
|
|
757
1353
|
this.prehideSelectors = ["#cmpbox,#cmpbox2"];
|
|
758
1354
|
this.apiAvailable = false;
|
|
759
1355
|
}
|
|
@@ -767,7 +1363,7 @@ var ConsentManager = class extends AutoConsentCMPBase {
|
|
|
767
1363
|
return false;
|
|
768
1364
|
}
|
|
769
1365
|
async detectCmp() {
|
|
770
|
-
this.apiAvailable = await
|
|
1366
|
+
this.apiAvailable = await this.mainWorldEval("EVAL_CONSENTMANAGER_1");
|
|
771
1367
|
if (!this.apiAvailable) {
|
|
772
1368
|
return elementExists("#cmpbox");
|
|
773
1369
|
} else {
|
|
@@ -777,14 +1373,14 @@ var ConsentManager = class extends AutoConsentCMPBase {
|
|
|
777
1373
|
async detectPopup() {
|
|
778
1374
|
if (this.apiAvailable) {
|
|
779
1375
|
await wait(500);
|
|
780
|
-
return await
|
|
1376
|
+
return await this.mainWorldEval("EVAL_CONSENTMANAGER_2");
|
|
781
1377
|
}
|
|
782
1378
|
return elementVisible("#cmpbox .cmpmore", "any");
|
|
783
1379
|
}
|
|
784
1380
|
async optOut() {
|
|
785
1381
|
await wait(500);
|
|
786
1382
|
if (this.apiAvailable) {
|
|
787
|
-
return await
|
|
1383
|
+
return await this.mainWorldEval("EVAL_CONSENTMANAGER_3");
|
|
788
1384
|
}
|
|
789
1385
|
if (click(".cmpboxbtnno")) {
|
|
790
1386
|
return true;
|
|
@@ -802,13 +1398,13 @@ var ConsentManager = class extends AutoConsentCMPBase {
|
|
|
802
1398
|
}
|
|
803
1399
|
async optIn() {
|
|
804
1400
|
if (this.apiAvailable) {
|
|
805
|
-
return await
|
|
1401
|
+
return await this.mainWorldEval("EVAL_CONSENTMANAGER_4");
|
|
806
1402
|
}
|
|
807
1403
|
return click(".cmpboxbtnyes");
|
|
808
1404
|
}
|
|
809
1405
|
async test() {
|
|
810
1406
|
if (this.apiAvailable) {
|
|
811
|
-
return await
|
|
1407
|
+
return await this.mainWorldEval("EVAL_CONSENTMANAGER_5");
|
|
812
1408
|
}
|
|
813
1409
|
}
|
|
814
1410
|
};
|
|
@@ -816,264 +1412,11 @@ var ConsentManager = class extends AutoConsentCMPBase {
|
|
|
816
1412
|
// lib/cmps/evidon.ts
|
|
817
1413
|
var Evidon = class extends AutoConsentCMPBase {
|
|
818
1414
|
constructor() {
|
|
819
|
-
super(
|
|
820
|
-
|
|
821
|
-
get hasSelfTest() {
|
|
822
|
-
return false;
|
|
823
|
-
}
|
|
824
|
-
get isIntermediate() {
|
|
825
|
-
return false;
|
|
826
|
-
}
|
|
827
|
-
get isCosmetic() {
|
|
828
|
-
return false;
|
|
829
|
-
}
|
|
830
|
-
async detectCmp() {
|
|
831
|
-
return elementExists("#_evidon_banner");
|
|
832
|
-
}
|
|
833
|
-
async detectPopup() {
|
|
834
|
-
return elementVisible("#_evidon_banner", "any");
|
|
835
|
-
}
|
|
836
|
-
async optOut() {
|
|
837
|
-
if (click("#_evidon-decline-button")) {
|
|
838
|
-
return true;
|
|
839
|
-
}
|
|
840
|
-
hideElements(getStyleElement(), ["#evidon-prefdiag-overlay", "#evidon-prefdiag-background"]);
|
|
841
|
-
click("#_evidon-option-button");
|
|
842
|
-
await waitForElement("#evidon-prefdiag-overlay", 5e3);
|
|
843
|
-
click("#evidon-prefdiag-decline");
|
|
844
|
-
return true;
|
|
845
|
-
}
|
|
846
|
-
async optIn() {
|
|
847
|
-
return click("#_evidon-accept-button");
|
|
848
|
-
}
|
|
849
|
-
};
|
|
850
|
-
|
|
851
|
-
// lib/cmps/onetrust.ts
|
|
852
|
-
var Onetrust = class extends AutoConsentCMPBase {
|
|
853
|
-
constructor() {
|
|
854
|
-
super("Onetrust");
|
|
855
|
-
this.prehideSelectors = ["#onetrust-banner-sdk,#onetrust-consent-sdk,.onetrust-pc-dark-filter,.js-consent-banner"];
|
|
856
|
-
this.runContext = {
|
|
857
|
-
urlPattern: "^(?!.*https://www\\.nba\\.com/)"
|
|
858
|
-
};
|
|
859
|
-
}
|
|
860
|
-
get hasSelfTest() {
|
|
861
|
-
return true;
|
|
862
|
-
}
|
|
863
|
-
get isIntermediate() {
|
|
864
|
-
return false;
|
|
865
|
-
}
|
|
866
|
-
get isCosmetic() {
|
|
867
|
-
return false;
|
|
868
|
-
}
|
|
869
|
-
async detectCmp() {
|
|
870
|
-
return elementExists("#onetrust-banner-sdk");
|
|
871
|
-
}
|
|
872
|
-
async detectPopup() {
|
|
873
|
-
return elementVisible("#onetrust-banner-sdk", "all");
|
|
874
|
-
}
|
|
875
|
-
async optOut() {
|
|
876
|
-
if (elementExists("#onetrust-pc-btn-handler")) {
|
|
877
|
-
click("#onetrust-pc-btn-handler");
|
|
878
|
-
} else {
|
|
879
|
-
click(".ot-sdk-show-settings,button.js-cookie-settings");
|
|
880
|
-
}
|
|
881
|
-
await waitForElement("#onetrust-consent-sdk", 2e3);
|
|
882
|
-
await wait(1e3);
|
|
883
|
-
click("#onetrust-consent-sdk input.category-switch-handler:checked,.js-editor-toggle-state:checked", true);
|
|
884
|
-
await wait(1e3);
|
|
885
|
-
await waitForElement(".save-preference-btn-handler,.js-consent-save", 2e3);
|
|
886
|
-
click(".save-preference-btn-handler,.js-consent-save");
|
|
887
|
-
await waitFor(
|
|
888
|
-
() => elementVisible("#onetrust-banner-sdk", "none"),
|
|
889
|
-
10,
|
|
890
|
-
500
|
|
891
|
-
);
|
|
892
|
-
return true;
|
|
893
|
-
}
|
|
894
|
-
async optIn() {
|
|
895
|
-
return click("#onetrust-accept-btn-handler,.js-accept-cookies");
|
|
896
|
-
}
|
|
897
|
-
async test() {
|
|
898
|
-
return await doEval("window.OnetrustActiveGroups.split(',').filter(s => s.length > 0).length <= 1");
|
|
899
|
-
}
|
|
900
|
-
};
|
|
901
|
-
|
|
902
|
-
// lib/cmps/klaro.ts
|
|
903
|
-
var Klaro = class extends AutoConsentCMPBase {
|
|
904
|
-
constructor() {
|
|
905
|
-
super("Klaro");
|
|
906
|
-
this.prehideSelectors = [".klaro"];
|
|
907
|
-
this.settingsOpen = false;
|
|
908
|
-
}
|
|
909
|
-
get hasSelfTest() {
|
|
910
|
-
return true;
|
|
911
|
-
}
|
|
912
|
-
get isIntermediate() {
|
|
913
|
-
return false;
|
|
914
|
-
}
|
|
915
|
-
get isCosmetic() {
|
|
916
|
-
return false;
|
|
917
|
-
}
|
|
918
|
-
async detectCmp() {
|
|
919
|
-
if (elementExists(".klaro > .cookie-modal")) {
|
|
920
|
-
this.settingsOpen = true;
|
|
921
|
-
return true;
|
|
922
|
-
}
|
|
923
|
-
return elementExists(".klaro > .cookie-notice");
|
|
924
|
-
}
|
|
925
|
-
async detectPopup() {
|
|
926
|
-
return elementVisible(".klaro > .cookie-notice,.klaro > .cookie-modal", "any");
|
|
927
|
-
}
|
|
928
|
-
async optOut() {
|
|
929
|
-
if (click(".klaro .cn-decline")) {
|
|
930
|
-
return true;
|
|
931
|
-
}
|
|
932
|
-
if (!this.settingsOpen) {
|
|
933
|
-
click(".klaro .cn-learn-more");
|
|
934
|
-
await waitForElement(".klaro > .cookie-modal", 2e3);
|
|
935
|
-
this.settingsOpen = true;
|
|
936
|
-
}
|
|
937
|
-
if (click(".klaro .cn-decline")) {
|
|
938
|
-
return true;
|
|
939
|
-
}
|
|
940
|
-
click(".cm-purpose:not(.cm-toggle-all) > input:not(.half-checked)", true);
|
|
941
|
-
return click(".cm-btn-accept");
|
|
942
|
-
}
|
|
943
|
-
async optIn() {
|
|
944
|
-
if (click(".klaro .cm-btn-accept-all")) {
|
|
945
|
-
return true;
|
|
946
|
-
}
|
|
947
|
-
if (this.settingsOpen) {
|
|
948
|
-
click(".cm-purpose:not(.cm-toggle-all) > input.half-checked", true);
|
|
949
|
-
return click(".cm-btn-accept");
|
|
950
|
-
}
|
|
951
|
-
return click(".klaro .cookie-notice .cm-btn-success");
|
|
952
|
-
}
|
|
953
|
-
async test() {
|
|
954
|
-
return await doEval("klaro.getManager().config.services.every(c => c.required || !klaro.getManager().consents[c.name])");
|
|
955
|
-
}
|
|
956
|
-
};
|
|
957
|
-
|
|
958
|
-
// lib/cmps/uniconsent.ts
|
|
959
|
-
var Uniconsent = class extends AutoConsentCMPBase {
|
|
960
|
-
constructor() {
|
|
961
|
-
super("Uniconsent");
|
|
962
|
-
}
|
|
963
|
-
get prehideSelectors() {
|
|
964
|
-
return [".unic", ".modal:has(.unic)"];
|
|
965
|
-
}
|
|
966
|
-
get hasSelfTest() {
|
|
967
|
-
return true;
|
|
968
|
-
}
|
|
969
|
-
get isIntermediate() {
|
|
970
|
-
return false;
|
|
971
|
-
}
|
|
972
|
-
get isCosmetic() {
|
|
973
|
-
return false;
|
|
974
|
-
}
|
|
975
|
-
async detectCmp() {
|
|
976
|
-
return elementExists(".unic .unic-box,.unic .unic-bar");
|
|
977
|
-
}
|
|
978
|
-
async detectPopup() {
|
|
979
|
-
return elementVisible(".unic .unic-box,.unic .unic-bar", "any");
|
|
980
|
-
}
|
|
981
|
-
async optOut() {
|
|
982
|
-
await waitForElement(".unic button", 1e3);
|
|
983
|
-
document.querySelectorAll(".unic button").forEach((button) => {
|
|
984
|
-
const text = button.textContent;
|
|
985
|
-
if (text.includes("Manage Options") || text.includes("Optionen verwalten")) {
|
|
986
|
-
button.click();
|
|
987
|
-
}
|
|
988
|
-
});
|
|
989
|
-
if (await waitForElement(".unic input[type=checkbox]", 1e3)) {
|
|
990
|
-
await waitForElement(".unic button", 1e3);
|
|
991
|
-
document.querySelectorAll(".unic input[type=checkbox]").forEach((c) => {
|
|
992
|
-
if (c.checked) {
|
|
993
|
-
c.click();
|
|
994
|
-
}
|
|
995
|
-
});
|
|
996
|
-
for (const b of document.querySelectorAll(".unic button")) {
|
|
997
|
-
const text = b.textContent;
|
|
998
|
-
for (const pattern of ["Confirm Choices", "Save Choices", "Auswahl speichern"]) {
|
|
999
|
-
if (text.includes(pattern)) {
|
|
1000
|
-
b.click();
|
|
1001
|
-
await wait(500);
|
|
1002
|
-
return true;
|
|
1003
|
-
}
|
|
1004
|
-
}
|
|
1005
|
-
}
|
|
1006
|
-
}
|
|
1007
|
-
return false;
|
|
1008
|
-
}
|
|
1009
|
-
async optIn() {
|
|
1010
|
-
return waitForThenClick(".unic #unic-agree");
|
|
1011
|
-
}
|
|
1012
|
-
async test() {
|
|
1013
|
-
await wait(1e3);
|
|
1014
|
-
const res = elementExists(".unic .unic-box,.unic .unic-bar");
|
|
1015
|
-
return !res;
|
|
1016
|
-
}
|
|
1017
|
-
};
|
|
1018
|
-
|
|
1019
|
-
// lib/cmps/conversant.ts
|
|
1020
|
-
var Conversant = class extends AutoConsentCMPBase {
|
|
1021
|
-
constructor() {
|
|
1022
|
-
super("Conversant");
|
|
1023
|
-
this.prehideSelectors = [".cmp-root"];
|
|
1024
|
-
}
|
|
1025
|
-
get hasSelfTest() {
|
|
1026
|
-
return true;
|
|
1027
|
-
}
|
|
1028
|
-
get isIntermediate() {
|
|
1029
|
-
return false;
|
|
1030
|
-
}
|
|
1031
|
-
get isCosmetic() {
|
|
1032
|
-
return false;
|
|
1033
|
-
}
|
|
1034
|
-
async detectCmp() {
|
|
1035
|
-
return elementExists(".cmp-root .cmp-receptacle");
|
|
1036
|
-
}
|
|
1037
|
-
async detectPopup() {
|
|
1038
|
-
return elementVisible(".cmp-root .cmp-receptacle", "any");
|
|
1039
|
-
}
|
|
1040
|
-
async optOut() {
|
|
1041
|
-
if (!await waitForThenClick(".cmp-main-button:not(.cmp-main-button--primary)")) {
|
|
1042
|
-
return false;
|
|
1043
|
-
}
|
|
1044
|
-
if (!await waitForElement(".cmp-view-tab-tabs")) {
|
|
1045
|
-
return false;
|
|
1046
|
-
}
|
|
1047
|
-
await waitForThenClick(".cmp-view-tab-tabs > :first-child");
|
|
1048
|
-
await waitForThenClick(".cmp-view-tab-tabs > .cmp-view-tab--active:first-child");
|
|
1049
|
-
for (const item of Array.from(document.querySelectorAll(".cmp-accordion-item"))) {
|
|
1050
|
-
item.querySelector(".cmp-accordion-item-title").click();
|
|
1051
|
-
await waitFor(() => !!item.querySelector(".cmp-accordion-item-content.cmp-active"), 10, 50);
|
|
1052
|
-
const content = item.querySelector(".cmp-accordion-item-content.cmp-active");
|
|
1053
|
-
content.querySelectorAll(".cmp-toggle-actions .cmp-toggle-deny:not(.cmp-toggle-deny--active)").forEach((e) => e.click());
|
|
1054
|
-
content.querySelectorAll(".cmp-toggle-actions .cmp-toggle-checkbox:not(.cmp-toggle-checkbox--active)").forEach((e) => e.click());
|
|
1055
|
-
}
|
|
1056
|
-
await click(".cmp-main-button:not(.cmp-main-button--primary)");
|
|
1057
|
-
return true;
|
|
1058
|
-
}
|
|
1059
|
-
async optIn() {
|
|
1060
|
-
return waitForThenClick(".cmp-main-button.cmp-main-button--primary");
|
|
1061
|
-
}
|
|
1062
|
-
async test() {
|
|
1063
|
-
return document.cookie.includes("cmp-data=0");
|
|
1064
|
-
}
|
|
1065
|
-
};
|
|
1066
|
-
|
|
1067
|
-
// lib/cmps/tiktok.ts
|
|
1068
|
-
var Tiktok = class extends AutoConsentCMPBase {
|
|
1069
|
-
constructor() {
|
|
1070
|
-
super("tiktok.com");
|
|
1071
|
-
this.runContext = {
|
|
1072
|
-
urlPattern: "tiktok"
|
|
1073
|
-
};
|
|
1415
|
+
super(...arguments);
|
|
1416
|
+
this.name = "Evidon";
|
|
1074
1417
|
}
|
|
1075
1418
|
get hasSelfTest() {
|
|
1076
|
-
return
|
|
1419
|
+
return false;
|
|
1077
1420
|
}
|
|
1078
1421
|
get isIntermediate() {
|
|
1079
1422
|
return false;
|
|
@@ -1081,63 +1424,36 @@ var Tiktok = class extends AutoConsentCMPBase {
|
|
|
1081
1424
|
get isCosmetic() {
|
|
1082
1425
|
return false;
|
|
1083
1426
|
}
|
|
1084
|
-
getShadowRoot() {
|
|
1085
|
-
const container = document.querySelector("tiktok-cookie-banner");
|
|
1086
|
-
if (!container) {
|
|
1087
|
-
return null;
|
|
1088
|
-
}
|
|
1089
|
-
return container.shadowRoot;
|
|
1090
|
-
}
|
|
1091
1427
|
async detectCmp() {
|
|
1092
|
-
return elementExists("
|
|
1428
|
+
return elementExists("#_evidon_banner");
|
|
1093
1429
|
}
|
|
1094
1430
|
async detectPopup() {
|
|
1095
|
-
|
|
1096
|
-
return isElementVisible(banner);
|
|
1431
|
+
return elementVisible("#_evidon_banner", "any");
|
|
1097
1432
|
}
|
|
1098
1433
|
async optOut() {
|
|
1099
|
-
|
|
1100
|
-
if (declineButton) {
|
|
1101
|
-
enableLogs && console.log("[clicking]", declineButton);
|
|
1102
|
-
declineButton.click();
|
|
1434
|
+
if (click("#_evidon-decline-button")) {
|
|
1103
1435
|
return true;
|
|
1104
|
-
} else {
|
|
1105
|
-
enableLogs && console.log("no decline button found");
|
|
1106
|
-
return false;
|
|
1107
1436
|
}
|
|
1437
|
+
hideElements(getStyleElement(), ["#evidon-prefdiag-overlay", "#evidon-prefdiag-background"]);
|
|
1438
|
+
click("#_evidon-option-button");
|
|
1439
|
+
await waitForElement("#evidon-prefdiag-overlay", 5e3);
|
|
1440
|
+
click("#evidon-prefdiag-decline");
|
|
1441
|
+
return true;
|
|
1108
1442
|
}
|
|
1109
1443
|
async optIn() {
|
|
1110
|
-
|
|
1111
|
-
if (acceptButton) {
|
|
1112
|
-
enableLogs && console.log("[clicking]", acceptButton);
|
|
1113
|
-
acceptButton.click();
|
|
1114
|
-
return true;
|
|
1115
|
-
} else {
|
|
1116
|
-
enableLogs && console.log("no accept button found");
|
|
1117
|
-
return false;
|
|
1118
|
-
}
|
|
1119
|
-
}
|
|
1120
|
-
async test() {
|
|
1121
|
-
const match = document.cookie.match(/cookie-consent=([^;]+)/);
|
|
1122
|
-
if (!match) {
|
|
1123
|
-
return false;
|
|
1124
|
-
}
|
|
1125
|
-
const value = JSON.parse(decodeURIComponent(match[1]));
|
|
1126
|
-
return Object.values(value).every((x) => typeof x !== "boolean" || x === false);
|
|
1444
|
+
return click("#_evidon-accept-button");
|
|
1127
1445
|
}
|
|
1128
1446
|
};
|
|
1129
1447
|
|
|
1130
|
-
// lib/cmps/
|
|
1131
|
-
var
|
|
1448
|
+
// lib/cmps/onetrust.ts
|
|
1449
|
+
var Onetrust = class extends AutoConsentCMPBase {
|
|
1132
1450
|
constructor() {
|
|
1133
|
-
super(
|
|
1451
|
+
super(...arguments);
|
|
1452
|
+
this.name = "Onetrust";
|
|
1453
|
+
this.prehideSelectors = ["#onetrust-banner-sdk,#onetrust-consent-sdk,.onetrust-pc-dark-filter,.js-consent-banner"];
|
|
1134
1454
|
this.runContext = {
|
|
1135
|
-
urlPattern: "^https://
|
|
1455
|
+
urlPattern: "^(?!.*https://www\\.nba\\.com/)"
|
|
1136
1456
|
};
|
|
1137
|
-
this.prehideSelectors = [
|
|
1138
|
-
"div[data-testid=main-cookies-banner-container]",
|
|
1139
|
-
'div:has(> div:first-child):has(> div:last-child):has(> section [data-testid="strictly-necessary-cookies"])'
|
|
1140
|
-
];
|
|
1141
1457
|
}
|
|
1142
1458
|
get hasSelfTest() {
|
|
1143
1459
|
return true;
|
|
@@ -1149,520 +1465,336 @@ var Airbnb = class extends AutoConsentCMPBase {
|
|
|
1149
1465
|
return false;
|
|
1150
1466
|
}
|
|
1151
1467
|
async detectCmp() {
|
|
1152
|
-
return elementExists("
|
|
1468
|
+
return elementExists("#onetrust-banner-sdk");
|
|
1153
1469
|
}
|
|
1154
1470
|
async detectPopup() {
|
|
1155
|
-
return elementVisible("
|
|
1471
|
+
return elementVisible("#onetrust-banner-sdk", "all");
|
|
1156
1472
|
}
|
|
1157
1473
|
async optOut() {
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
while (check = document.querySelector("[data-testid=modal-container] button[aria-checked=true]:not([disabled])")) {
|
|
1161
|
-
check.click();
|
|
1162
|
-
}
|
|
1163
|
-
return waitForThenClick("button[data-testid=save-btn]");
|
|
1164
|
-
}
|
|
1165
|
-
async optIn() {
|
|
1166
|
-
return waitForThenClick("div[data-testid=main-cookies-banner-container] button._148dgdpk");
|
|
1167
|
-
}
|
|
1168
|
-
async test() {
|
|
1169
|
-
return await waitFor(
|
|
1170
|
-
() => !!document.cookie.match("OptanonAlertBoxClosed"),
|
|
1171
|
-
20,
|
|
1172
|
-
200
|
|
1173
|
-
);
|
|
1174
|
-
}
|
|
1175
|
-
};
|
|
1176
|
-
|
|
1177
|
-
// lib/cmps/all.ts
|
|
1178
|
-
var rules = [
|
|
1179
|
-
new TrustArcTop(),
|
|
1180
|
-
new TrustArcFrame(),
|
|
1181
|
-
new Cookiebot(),
|
|
1182
|
-
new SourcePoint(),
|
|
1183
|
-
new ConsentManager(),
|
|
1184
|
-
new Evidon(),
|
|
1185
|
-
new Onetrust(),
|
|
1186
|
-
new Klaro(),
|
|
1187
|
-
new Uniconsent(),
|
|
1188
|
-
new Conversant(),
|
|
1189
|
-
new Tiktok(),
|
|
1190
|
-
new Airbnb()
|
|
1191
|
-
];
|
|
1192
|
-
function createAutoCMP(config) {
|
|
1193
|
-
return new AutoConsentCMP(config);
|
|
1194
|
-
}
|
|
1195
|
-
var all_default = rules;
|
|
1196
|
-
|
|
1197
|
-
// lib/index.ts
|
|
1198
|
-
var rules2 = all_default;
|
|
1199
|
-
|
|
1200
|
-
// lib/consentomatic/tools.ts
|
|
1201
|
-
var _Tools = class _Tools {
|
|
1202
|
-
static setBase(base) {
|
|
1203
|
-
_Tools.base = base;
|
|
1204
|
-
}
|
|
1205
|
-
static findElement(options, parent = null, multiple = false) {
|
|
1206
|
-
let possibleTargets = null;
|
|
1207
|
-
if (parent != null) {
|
|
1208
|
-
possibleTargets = Array.from(parent.querySelectorAll(options.selector));
|
|
1209
|
-
} else {
|
|
1210
|
-
if (_Tools.base != null) {
|
|
1211
|
-
possibleTargets = Array.from(
|
|
1212
|
-
_Tools.base.querySelectorAll(options.selector)
|
|
1213
|
-
);
|
|
1214
|
-
} else {
|
|
1215
|
-
possibleTargets = Array.from(
|
|
1216
|
-
document.querySelectorAll(options.selector)
|
|
1217
|
-
);
|
|
1218
|
-
}
|
|
1219
|
-
}
|
|
1220
|
-
if (options.textFilter != null) {
|
|
1221
|
-
possibleTargets = possibleTargets.filter((possibleTarget) => {
|
|
1222
|
-
const textContent = possibleTarget.textContent.toLowerCase();
|
|
1223
|
-
if (Array.isArray(options.textFilter)) {
|
|
1224
|
-
let foundText = false;
|
|
1225
|
-
for (const text of options.textFilter) {
|
|
1226
|
-
if (textContent.indexOf(text.toLowerCase()) !== -1) {
|
|
1227
|
-
foundText = true;
|
|
1228
|
-
break;
|
|
1229
|
-
}
|
|
1230
|
-
}
|
|
1231
|
-
return foundText;
|
|
1232
|
-
} else if (options.textFilter != null) {
|
|
1233
|
-
return textContent.indexOf(options.textFilter.toLowerCase()) !== -1;
|
|
1234
|
-
}
|
|
1235
|
-
});
|
|
1236
|
-
}
|
|
1237
|
-
if (options.styleFilters != null) {
|
|
1238
|
-
possibleTargets = possibleTargets.filter((possibleTarget) => {
|
|
1239
|
-
const styles = window.getComputedStyle(possibleTarget);
|
|
1240
|
-
let keep = true;
|
|
1241
|
-
for (const styleFilter of options.styleFilters) {
|
|
1242
|
-
const option = styles[styleFilter.option];
|
|
1243
|
-
if (styleFilter.negated) {
|
|
1244
|
-
keep = keep && option !== styleFilter.value;
|
|
1245
|
-
} else {
|
|
1246
|
-
keep = keep && option === styleFilter.value;
|
|
1247
|
-
}
|
|
1248
|
-
}
|
|
1249
|
-
return keep;
|
|
1250
|
-
});
|
|
1251
|
-
}
|
|
1252
|
-
if (options.displayFilter != null) {
|
|
1253
|
-
possibleTargets = possibleTargets.filter((possibleTarget) => {
|
|
1254
|
-
if (options.displayFilter) {
|
|
1255
|
-
return possibleTarget.offsetHeight !== 0;
|
|
1256
|
-
} else {
|
|
1257
|
-
return possibleTarget.offsetHeight === 0;
|
|
1258
|
-
}
|
|
1259
|
-
});
|
|
1260
|
-
}
|
|
1261
|
-
if (options.iframeFilter != null) {
|
|
1262
|
-
possibleTargets = possibleTargets.filter(() => {
|
|
1263
|
-
if (options.iframeFilter) {
|
|
1264
|
-
return window.location !== window.parent.location;
|
|
1265
|
-
} else {
|
|
1266
|
-
return window.location === window.parent.location;
|
|
1267
|
-
}
|
|
1268
|
-
});
|
|
1269
|
-
}
|
|
1270
|
-
if (options.childFilter != null) {
|
|
1271
|
-
possibleTargets = possibleTargets.filter((possibleTarget) => {
|
|
1272
|
-
const oldBase = _Tools.base;
|
|
1273
|
-
_Tools.setBase(possibleTarget);
|
|
1274
|
-
const childResults = _Tools.find(options.childFilter);
|
|
1275
|
-
_Tools.setBase(oldBase);
|
|
1276
|
-
return childResults.target != null;
|
|
1277
|
-
});
|
|
1278
|
-
}
|
|
1279
|
-
if (multiple) {
|
|
1280
|
-
return possibleTargets;
|
|
1281
|
-
} else {
|
|
1282
|
-
if (possibleTargets.length > 1) {
|
|
1283
|
-
console.warn(
|
|
1284
|
-
"Multiple possible targets: ",
|
|
1285
|
-
possibleTargets,
|
|
1286
|
-
options,
|
|
1287
|
-
parent
|
|
1288
|
-
);
|
|
1289
|
-
}
|
|
1290
|
-
return possibleTargets[0];
|
|
1291
|
-
}
|
|
1292
|
-
}
|
|
1293
|
-
static find(options, multiple = false) {
|
|
1294
|
-
const results = [];
|
|
1295
|
-
if (options.parent != null) {
|
|
1296
|
-
const parent = _Tools.findElement(options.parent, null, multiple);
|
|
1297
|
-
if (parent != null) {
|
|
1298
|
-
if (parent instanceof Array) {
|
|
1299
|
-
parent.forEach((p) => {
|
|
1300
|
-
const targets = _Tools.findElement(options.target, p, multiple);
|
|
1301
|
-
if (targets instanceof Array) {
|
|
1302
|
-
targets.forEach((target) => {
|
|
1303
|
-
results.push({
|
|
1304
|
-
parent: p,
|
|
1305
|
-
target
|
|
1306
|
-
});
|
|
1307
|
-
});
|
|
1308
|
-
} else {
|
|
1309
|
-
results.push({
|
|
1310
|
-
parent: p,
|
|
1311
|
-
target: targets
|
|
1312
|
-
});
|
|
1313
|
-
}
|
|
1314
|
-
});
|
|
1315
|
-
return results;
|
|
1316
|
-
} else {
|
|
1317
|
-
const targets = _Tools.findElement(options.target, parent, multiple);
|
|
1318
|
-
if (targets instanceof Array) {
|
|
1319
|
-
targets.forEach((target) => {
|
|
1320
|
-
results.push({
|
|
1321
|
-
parent,
|
|
1322
|
-
target
|
|
1323
|
-
});
|
|
1324
|
-
});
|
|
1325
|
-
} else {
|
|
1326
|
-
results.push({
|
|
1327
|
-
parent,
|
|
1328
|
-
target: targets
|
|
1329
|
-
});
|
|
1330
|
-
}
|
|
1331
|
-
}
|
|
1332
|
-
}
|
|
1333
|
-
} else {
|
|
1334
|
-
const targets = _Tools.findElement(options.target, null, multiple);
|
|
1335
|
-
if (targets instanceof Array) {
|
|
1336
|
-
targets.forEach((target) => {
|
|
1337
|
-
results.push({
|
|
1338
|
-
parent: null,
|
|
1339
|
-
target
|
|
1340
|
-
});
|
|
1341
|
-
});
|
|
1342
|
-
} else {
|
|
1343
|
-
results.push({
|
|
1344
|
-
parent: null,
|
|
1345
|
-
target: targets
|
|
1346
|
-
});
|
|
1347
|
-
}
|
|
1348
|
-
}
|
|
1349
|
-
if (results.length === 0) {
|
|
1350
|
-
results.push({
|
|
1351
|
-
parent: null,
|
|
1352
|
-
target: null
|
|
1353
|
-
});
|
|
1354
|
-
}
|
|
1355
|
-
if (multiple) {
|
|
1356
|
-
return results;
|
|
1474
|
+
if (elementExists("#onetrust-pc-btn-handler")) {
|
|
1475
|
+
click("#onetrust-pc-btn-handler");
|
|
1357
1476
|
} else {
|
|
1358
|
-
|
|
1359
|
-
console.warn(
|
|
1360
|
-
"Multiple results found, even though multiple false",
|
|
1361
|
-
results
|
|
1362
|
-
);
|
|
1363
|
-
}
|
|
1364
|
-
return results[0];
|
|
1477
|
+
click(".ot-sdk-show-settings,button.js-cookie-settings");
|
|
1365
1478
|
}
|
|
1479
|
+
await waitForElement("#onetrust-consent-sdk", 2e3);
|
|
1480
|
+
await wait(1e3);
|
|
1481
|
+
click("#onetrust-consent-sdk input.category-switch-handler:checked,.js-editor-toggle-state:checked", true);
|
|
1482
|
+
await wait(1e3);
|
|
1483
|
+
await waitForElement(".save-preference-btn-handler,.js-consent-save", 2e3);
|
|
1484
|
+
click(".save-preference-btn-handler,.js-consent-save");
|
|
1485
|
+
await waitFor(
|
|
1486
|
+
() => elementVisible("#onetrust-banner-sdk", "none"),
|
|
1487
|
+
10,
|
|
1488
|
+
500
|
|
1489
|
+
);
|
|
1490
|
+
return true;
|
|
1491
|
+
}
|
|
1492
|
+
async optIn() {
|
|
1493
|
+
return click("#onetrust-accept-btn-handler,.js-accept-cookies");
|
|
1494
|
+
}
|
|
1495
|
+
async test() {
|
|
1496
|
+
return await this.mainWorldEval("EVAL_ONETRUST_1");
|
|
1366
1497
|
}
|
|
1367
1498
|
};
|
|
1368
|
-
_Tools.base = null;
|
|
1369
|
-
var Tools = _Tools;
|
|
1370
1499
|
|
|
1371
|
-
// lib/
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1500
|
+
// lib/cmps/klaro.ts
|
|
1501
|
+
var Klaro = class extends AutoConsentCMPBase {
|
|
1502
|
+
constructor() {
|
|
1503
|
+
super(...arguments);
|
|
1504
|
+
this.name = "Klaro";
|
|
1505
|
+
this.prehideSelectors = [".klaro"];
|
|
1506
|
+
this.settingsOpen = false;
|
|
1378
1507
|
}
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
switch (config.type) {
|
|
1382
|
-
case "click":
|
|
1383
|
-
return clickAction(config);
|
|
1384
|
-
case "list":
|
|
1385
|
-
return listAction(config, param);
|
|
1386
|
-
case "consent":
|
|
1387
|
-
return consentAction(config, param);
|
|
1388
|
-
case "ifcss":
|
|
1389
|
-
return ifCssAction(config, param);
|
|
1390
|
-
case "waitcss":
|
|
1391
|
-
return waitCssAction(config);
|
|
1392
|
-
case "foreach":
|
|
1393
|
-
return forEachAction(config, param);
|
|
1394
|
-
case "hide":
|
|
1395
|
-
return hideAction(config);
|
|
1396
|
-
case "slide":
|
|
1397
|
-
return slideAction(config);
|
|
1398
|
-
case "close":
|
|
1399
|
-
return closeAction();
|
|
1400
|
-
case "wait":
|
|
1401
|
-
return waitAction(config);
|
|
1402
|
-
case "eval":
|
|
1403
|
-
return evalAction(config);
|
|
1404
|
-
default:
|
|
1405
|
-
throw "Unknown action type: " + config.type;
|
|
1508
|
+
get hasSelfTest() {
|
|
1509
|
+
return true;
|
|
1406
1510
|
}
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
function waitTimeout(timeout) {
|
|
1410
|
-
return new Promise((resolve) => {
|
|
1411
|
-
setTimeout(() => {
|
|
1412
|
-
resolve();
|
|
1413
|
-
}, timeout);
|
|
1414
|
-
});
|
|
1415
|
-
}
|
|
1416
|
-
async function clickAction(config) {
|
|
1417
|
-
const result = Tools.find(config);
|
|
1418
|
-
if (result.target != null) {
|
|
1419
|
-
result.target.click();
|
|
1511
|
+
get isIntermediate() {
|
|
1512
|
+
return false;
|
|
1420
1513
|
}
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
async function listAction(config, param) {
|
|
1424
|
-
for (const action of config.actions) {
|
|
1425
|
-
await executeAction(action, param);
|
|
1514
|
+
get isCosmetic() {
|
|
1515
|
+
return false;
|
|
1426
1516
|
}
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
if (consentConfig.matcher && consentConfig.toggleAction) {
|
|
1432
|
-
const isEnabled = matches(consentConfig.matcher);
|
|
1433
|
-
if (isEnabled !== shouldEnable) {
|
|
1434
|
-
await executeAction(consentConfig.toggleAction);
|
|
1435
|
-
}
|
|
1436
|
-
} else {
|
|
1437
|
-
if (shouldEnable) {
|
|
1438
|
-
await executeAction(consentConfig.trueAction);
|
|
1439
|
-
} else {
|
|
1440
|
-
await executeAction(consentConfig.falseAction);
|
|
1441
|
-
}
|
|
1517
|
+
async detectCmp() {
|
|
1518
|
+
if (elementExists(".klaro > .cookie-modal")) {
|
|
1519
|
+
this.settingsOpen = true;
|
|
1520
|
+
return true;
|
|
1442
1521
|
}
|
|
1522
|
+
return elementExists(".klaro > .cookie-notice");
|
|
1443
1523
|
}
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
const result = Tools.find(config);
|
|
1447
|
-
if (!result.target) {
|
|
1448
|
-
if (config.trueAction) {
|
|
1449
|
-
await executeAction(config.trueAction, param);
|
|
1450
|
-
}
|
|
1451
|
-
} else {
|
|
1452
|
-
if (config.falseAction) {
|
|
1453
|
-
await executeAction(config.falseAction, param);
|
|
1454
|
-
}
|
|
1524
|
+
async detectPopup() {
|
|
1525
|
+
return elementVisible(".klaro > .cookie-notice,.klaro > .cookie-modal", "any");
|
|
1455
1526
|
}
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
let numRetries = config.retries || 10;
|
|
1460
|
-
const waitTime = config.waitTime || 250;
|
|
1461
|
-
const checkCss = () => {
|
|
1462
|
-
const result = Tools.find(config);
|
|
1463
|
-
if (config.negated && result.target || !config.negated && !result.target) {
|
|
1464
|
-
if (numRetries > 0) {
|
|
1465
|
-
numRetries -= 1;
|
|
1466
|
-
setTimeout(checkCss, waitTime);
|
|
1467
|
-
} else {
|
|
1468
|
-
resolve();
|
|
1469
|
-
}
|
|
1470
|
-
} else {
|
|
1471
|
-
resolve();
|
|
1472
|
-
}
|
|
1473
|
-
};
|
|
1474
|
-
checkCss();
|
|
1475
|
-
});
|
|
1476
|
-
}
|
|
1477
|
-
async function forEachAction(config, param) {
|
|
1478
|
-
const results = Tools.find(config, true);
|
|
1479
|
-
const oldBase = Tools.base;
|
|
1480
|
-
for (const result of results) {
|
|
1481
|
-
if (result.target) {
|
|
1482
|
-
Tools.setBase(result.target);
|
|
1483
|
-
await executeAction(config.action, param);
|
|
1527
|
+
async optOut() {
|
|
1528
|
+
if (click(".klaro .cn-decline")) {
|
|
1529
|
+
return true;
|
|
1484
1530
|
}
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
const result = Tools.find(config);
|
|
1490
|
-
if (result.target) {
|
|
1491
|
-
result.target.classList.add("Autoconsent-Hidden");
|
|
1492
|
-
}
|
|
1493
|
-
}
|
|
1494
|
-
async function slideAction(config) {
|
|
1495
|
-
const result = Tools.find(config);
|
|
1496
|
-
const dragResult = Tools.find(config.dragTarget);
|
|
1497
|
-
if (result.target) {
|
|
1498
|
-
const targetBounds = result.target.getBoundingClientRect();
|
|
1499
|
-
const dragTargetBounds = dragResult.target.getBoundingClientRect();
|
|
1500
|
-
let yDiff = dragTargetBounds.top - targetBounds.top;
|
|
1501
|
-
let xDiff = dragTargetBounds.left - targetBounds.left;
|
|
1502
|
-
if (this.config.axis.toLowerCase() === "y") {
|
|
1503
|
-
xDiff = 0;
|
|
1531
|
+
if (!this.settingsOpen) {
|
|
1532
|
+
click(".klaro .cn-learn-more");
|
|
1533
|
+
await waitForElement(".klaro > .cookie-modal", 2e3);
|
|
1534
|
+
this.settingsOpen = true;
|
|
1504
1535
|
}
|
|
1505
|
-
if (
|
|
1506
|
-
|
|
1536
|
+
if (click(".klaro .cn-decline")) {
|
|
1537
|
+
return true;
|
|
1507
1538
|
}
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
|
|
1514
|
-
"mousedown",
|
|
1515
|
-
true,
|
|
1516
|
-
true,
|
|
1517
|
-
window,
|
|
1518
|
-
0,
|
|
1519
|
-
screenX,
|
|
1520
|
-
screenY,
|
|
1521
|
-
clientX,
|
|
1522
|
-
clientY,
|
|
1523
|
-
false,
|
|
1524
|
-
false,
|
|
1525
|
-
false,
|
|
1526
|
-
false,
|
|
1527
|
-
0,
|
|
1528
|
-
result.target
|
|
1529
|
-
);
|
|
1530
|
-
const mouseMove = document.createEvent("MouseEvents");
|
|
1531
|
-
mouseMove.initMouseEvent(
|
|
1532
|
-
"mousemove",
|
|
1533
|
-
true,
|
|
1534
|
-
true,
|
|
1535
|
-
window,
|
|
1536
|
-
0,
|
|
1537
|
-
screenX + xDiff,
|
|
1538
|
-
screenY + yDiff,
|
|
1539
|
-
clientX + xDiff,
|
|
1540
|
-
clientY + yDiff,
|
|
1541
|
-
false,
|
|
1542
|
-
false,
|
|
1543
|
-
false,
|
|
1544
|
-
false,
|
|
1545
|
-
0,
|
|
1546
|
-
result.target
|
|
1547
|
-
);
|
|
1548
|
-
const mouseUp = document.createEvent("MouseEvents");
|
|
1549
|
-
mouseUp.initMouseEvent(
|
|
1550
|
-
"mouseup",
|
|
1551
|
-
true,
|
|
1552
|
-
true,
|
|
1553
|
-
window,
|
|
1554
|
-
0,
|
|
1555
|
-
screenX + xDiff,
|
|
1556
|
-
screenY + yDiff,
|
|
1557
|
-
clientX + xDiff,
|
|
1558
|
-
clientY + yDiff,
|
|
1559
|
-
false,
|
|
1560
|
-
false,
|
|
1561
|
-
false,
|
|
1562
|
-
false,
|
|
1563
|
-
0,
|
|
1564
|
-
result.target
|
|
1565
|
-
);
|
|
1566
|
-
result.target.dispatchEvent(mouseDown);
|
|
1567
|
-
await this.waitTimeout(10);
|
|
1568
|
-
result.target.dispatchEvent(mouseMove);
|
|
1569
|
-
await this.waitTimeout(10);
|
|
1570
|
-
result.target.dispatchEvent(mouseUp);
|
|
1571
|
-
}
|
|
1572
|
-
}
|
|
1573
|
-
async function waitAction(config) {
|
|
1574
|
-
await waitTimeout(config.waitTime);
|
|
1575
|
-
}
|
|
1576
|
-
async function closeAction() {
|
|
1577
|
-
window.close();
|
|
1578
|
-
}
|
|
1579
|
-
async function evalAction(config) {
|
|
1580
|
-
console.log("eval!", config.code);
|
|
1581
|
-
return new Promise((resolve) => {
|
|
1582
|
-
try {
|
|
1583
|
-
if (config.async) {
|
|
1584
|
-
window.eval(config.code);
|
|
1585
|
-
setTimeout(() => {
|
|
1586
|
-
resolve(window.eval("window.__consentCheckResult"));
|
|
1587
|
-
}, config.timeout || 250);
|
|
1588
|
-
} else {
|
|
1589
|
-
resolve(window.eval(config.code));
|
|
1590
|
-
}
|
|
1591
|
-
} catch (e) {
|
|
1592
|
-
console.warn("eval error", e, config.code);
|
|
1593
|
-
resolve(false);
|
|
1539
|
+
click(".cm-purpose:not(.cm-toggle-all) > input:not(.half-checked)", true);
|
|
1540
|
+
return click(".cm-btn-accept");
|
|
1541
|
+
}
|
|
1542
|
+
async optIn() {
|
|
1543
|
+
if (click(".klaro .cm-btn-accept-all")) {
|
|
1544
|
+
return true;
|
|
1594
1545
|
}
|
|
1595
|
-
|
|
1596
|
-
|
|
1546
|
+
if (this.settingsOpen) {
|
|
1547
|
+
click(".cm-purpose:not(.cm-toggle-all) > input.half-checked", true);
|
|
1548
|
+
return click(".cm-btn-accept");
|
|
1549
|
+
}
|
|
1550
|
+
return click(".klaro .cookie-notice .cm-btn-success");
|
|
1551
|
+
}
|
|
1552
|
+
async test() {
|
|
1553
|
+
return await this.mainWorldEval("EVAL_KLARO_1");
|
|
1554
|
+
}
|
|
1555
|
+
};
|
|
1597
1556
|
|
|
1598
|
-
// lib/cmps/
|
|
1599
|
-
var
|
|
1600
|
-
constructor(
|
|
1601
|
-
|
|
1602
|
-
this.
|
|
1603
|
-
|
|
1604
|
-
|
|
1605
|
-
|
|
1606
|
-
|
|
1607
|
-
|
|
1608
|
-
|
|
1609
|
-
}
|
|
1610
|
-
});
|
|
1611
|
-
this.hasSelfTest = false;
|
|
1557
|
+
// lib/cmps/uniconsent.ts
|
|
1558
|
+
var Uniconsent = class extends AutoConsentCMPBase {
|
|
1559
|
+
constructor() {
|
|
1560
|
+
super(...arguments);
|
|
1561
|
+
this.name = "Uniconsent";
|
|
1562
|
+
}
|
|
1563
|
+
get prehideSelectors() {
|
|
1564
|
+
return [".unic", ".modal:has(.unic)"];
|
|
1565
|
+
}
|
|
1566
|
+
get hasSelfTest() {
|
|
1567
|
+
return true;
|
|
1612
1568
|
}
|
|
1613
1569
|
get isIntermediate() {
|
|
1614
1570
|
return false;
|
|
1615
1571
|
}
|
|
1616
|
-
|
|
1617
|
-
return
|
|
1572
|
+
get isCosmetic() {
|
|
1573
|
+
return false;
|
|
1618
1574
|
}
|
|
1619
1575
|
async detectCmp() {
|
|
1620
|
-
|
|
1621
|
-
(detectorConfig) => matches(detectorConfig.presentMatcher)
|
|
1622
|
-
);
|
|
1623
|
-
return matchResults.some((r) => !!r);
|
|
1576
|
+
return elementExists(".unic .unic-box,.unic .unic-bar");
|
|
1624
1577
|
}
|
|
1625
1578
|
async detectPopup() {
|
|
1626
|
-
|
|
1627
|
-
(detectorConfig) => matches(detectorConfig.showingMatcher)
|
|
1628
|
-
);
|
|
1629
|
-
return matchResults.some((r) => !!r);
|
|
1579
|
+
return elementVisible(".unic .unic-box,.unic .unic-bar", "any");
|
|
1630
1580
|
}
|
|
1631
|
-
async
|
|
1632
|
-
|
|
1633
|
-
|
|
1581
|
+
async optOut() {
|
|
1582
|
+
await waitForElement(".unic button", 1e3);
|
|
1583
|
+
document.querySelectorAll(".unic button").forEach((button) => {
|
|
1584
|
+
const text = button.textContent;
|
|
1585
|
+
if (text.includes("Manage Options") || text.includes("Optionen verwalten")) {
|
|
1586
|
+
button.click();
|
|
1587
|
+
}
|
|
1588
|
+
});
|
|
1589
|
+
if (await waitForElement(".unic input[type=checkbox]", 1e3)) {
|
|
1590
|
+
await waitForElement(".unic button", 1e3);
|
|
1591
|
+
document.querySelectorAll(".unic input[type=checkbox]").forEach((c) => {
|
|
1592
|
+
if (c.checked) {
|
|
1593
|
+
c.click();
|
|
1594
|
+
}
|
|
1595
|
+
});
|
|
1596
|
+
for (const b of document.querySelectorAll(".unic button")) {
|
|
1597
|
+
const text = b.textContent;
|
|
1598
|
+
for (const pattern of ["Confirm Choices", "Save Choices", "Auswahl speichern"]) {
|
|
1599
|
+
if (text.includes(pattern)) {
|
|
1600
|
+
b.click();
|
|
1601
|
+
await wait(500);
|
|
1602
|
+
return true;
|
|
1603
|
+
}
|
|
1604
|
+
}
|
|
1605
|
+
}
|
|
1634
1606
|
}
|
|
1607
|
+
return false;
|
|
1608
|
+
}
|
|
1609
|
+
async optIn() {
|
|
1610
|
+
return waitForThenClick(".unic #unic-agree");
|
|
1611
|
+
}
|
|
1612
|
+
async test() {
|
|
1613
|
+
await wait(1e3);
|
|
1614
|
+
const res = elementExists(".unic .unic-box,.unic .unic-bar");
|
|
1615
|
+
return !res;
|
|
1616
|
+
}
|
|
1617
|
+
};
|
|
1618
|
+
|
|
1619
|
+
// lib/cmps/conversant.ts
|
|
1620
|
+
var Conversant = class extends AutoConsentCMPBase {
|
|
1621
|
+
constructor() {
|
|
1622
|
+
super(...arguments);
|
|
1623
|
+
this.prehideSelectors = [".cmp-root"];
|
|
1624
|
+
this.name = "Conversant";
|
|
1625
|
+
}
|
|
1626
|
+
get hasSelfTest() {
|
|
1635
1627
|
return true;
|
|
1636
1628
|
}
|
|
1629
|
+
get isIntermediate() {
|
|
1630
|
+
return false;
|
|
1631
|
+
}
|
|
1632
|
+
get isCosmetic() {
|
|
1633
|
+
return false;
|
|
1634
|
+
}
|
|
1635
|
+
async detectCmp() {
|
|
1636
|
+
return elementExists(".cmp-root .cmp-receptacle");
|
|
1637
|
+
}
|
|
1638
|
+
async detectPopup() {
|
|
1639
|
+
return elementVisible(".cmp-root .cmp-receptacle", "any");
|
|
1640
|
+
}
|
|
1637
1641
|
async optOut() {
|
|
1638
|
-
await
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
await
|
|
1642
|
-
|
|
1642
|
+
if (!await waitForThenClick(".cmp-main-button:not(.cmp-main-button--primary)")) {
|
|
1643
|
+
return false;
|
|
1644
|
+
}
|
|
1645
|
+
if (!await waitForElement(".cmp-view-tab-tabs")) {
|
|
1646
|
+
return false;
|
|
1647
|
+
}
|
|
1648
|
+
await waitForThenClick(".cmp-view-tab-tabs > :first-child");
|
|
1649
|
+
await waitForThenClick(".cmp-view-tab-tabs > .cmp-view-tab--active:first-child");
|
|
1650
|
+
for (const item of Array.from(document.querySelectorAll(".cmp-accordion-item"))) {
|
|
1651
|
+
item.querySelector(".cmp-accordion-item-title").click();
|
|
1652
|
+
await waitFor(() => !!item.querySelector(".cmp-accordion-item-content.cmp-active"), 10, 50);
|
|
1653
|
+
const content = item.querySelector(".cmp-accordion-item-content.cmp-active");
|
|
1654
|
+
content.querySelectorAll(".cmp-toggle-actions .cmp-toggle-deny:not(.cmp-toggle-deny--active)").forEach((e) => e.click());
|
|
1655
|
+
content.querySelectorAll(".cmp-toggle-actions .cmp-toggle-checkbox:not(.cmp-toggle-checkbox--active)").forEach((e) => e.click());
|
|
1656
|
+
}
|
|
1657
|
+
await click(".cmp-main-button:not(.cmp-main-button--primary)");
|
|
1643
1658
|
return true;
|
|
1644
1659
|
}
|
|
1645
1660
|
async optIn() {
|
|
1646
|
-
|
|
1647
|
-
await this.executeAction("OPEN_OPTIONS");
|
|
1648
|
-
await this.executeAction("HIDE_CMP");
|
|
1649
|
-
await this.executeAction("DO_CONSENT", ["D", "A", "B", "E", "F", "X"]);
|
|
1650
|
-
await this.executeAction("SAVE_CONSENT");
|
|
1651
|
-
return true;
|
|
1661
|
+
return waitForThenClick(".cmp-main-button.cmp-main-button--primary");
|
|
1652
1662
|
}
|
|
1653
|
-
async
|
|
1654
|
-
|
|
1655
|
-
|
|
1663
|
+
async test() {
|
|
1664
|
+
return document.cookie.includes("cmp-data=0");
|
|
1665
|
+
}
|
|
1666
|
+
};
|
|
1667
|
+
|
|
1668
|
+
// lib/cmps/tiktok.ts
|
|
1669
|
+
var Tiktok = class extends AutoConsentCMPBase {
|
|
1670
|
+
constructor() {
|
|
1671
|
+
super(...arguments);
|
|
1672
|
+
this.name = "tiktok.com";
|
|
1673
|
+
this.runContext = {
|
|
1674
|
+
urlPattern: "tiktok"
|
|
1675
|
+
};
|
|
1676
|
+
}
|
|
1677
|
+
get hasSelfTest() {
|
|
1656
1678
|
return true;
|
|
1657
1679
|
}
|
|
1680
|
+
get isIntermediate() {
|
|
1681
|
+
return false;
|
|
1682
|
+
}
|
|
1683
|
+
get isCosmetic() {
|
|
1684
|
+
return false;
|
|
1685
|
+
}
|
|
1686
|
+
getShadowRoot() {
|
|
1687
|
+
const container = document.querySelector("tiktok-cookie-banner");
|
|
1688
|
+
if (!container) {
|
|
1689
|
+
return null;
|
|
1690
|
+
}
|
|
1691
|
+
return container.shadowRoot;
|
|
1692
|
+
}
|
|
1693
|
+
async detectCmp() {
|
|
1694
|
+
return elementExists("tiktok-cookie-banner");
|
|
1695
|
+
}
|
|
1696
|
+
async detectPopup() {
|
|
1697
|
+
const banner = this.getShadowRoot().querySelector(".tiktok-cookie-banner");
|
|
1698
|
+
return isElementVisible(banner);
|
|
1699
|
+
}
|
|
1700
|
+
async optOut() {
|
|
1701
|
+
const declineButton = this.getShadowRoot().querySelector(".button-wrapper button:first-child");
|
|
1702
|
+
if (declineButton) {
|
|
1703
|
+
enableLogs && console.log("[clicking]", declineButton);
|
|
1704
|
+
declineButton.click();
|
|
1705
|
+
return true;
|
|
1706
|
+
} else {
|
|
1707
|
+
enableLogs && console.log("no decline button found");
|
|
1708
|
+
return false;
|
|
1709
|
+
}
|
|
1710
|
+
}
|
|
1711
|
+
async optIn() {
|
|
1712
|
+
const acceptButton = this.getShadowRoot().querySelector(".button-wrapper button:last-child");
|
|
1713
|
+
if (acceptButton) {
|
|
1714
|
+
enableLogs && console.log("[clicking]", acceptButton);
|
|
1715
|
+
acceptButton.click();
|
|
1716
|
+
return true;
|
|
1717
|
+
} else {
|
|
1718
|
+
enableLogs && console.log("no accept button found");
|
|
1719
|
+
return false;
|
|
1720
|
+
}
|
|
1721
|
+
}
|
|
1658
1722
|
async test() {
|
|
1723
|
+
const match = document.cookie.match(/cookie-consent=([^;]+)/);
|
|
1724
|
+
if (!match) {
|
|
1725
|
+
return false;
|
|
1726
|
+
}
|
|
1727
|
+
const value = JSON.parse(decodeURIComponent(match[1]));
|
|
1728
|
+
return Object.values(value).every((x) => typeof x !== "boolean" || x === false);
|
|
1729
|
+
}
|
|
1730
|
+
};
|
|
1731
|
+
|
|
1732
|
+
// lib/cmps/airbnb.ts
|
|
1733
|
+
var Airbnb = class extends AutoConsentCMPBase {
|
|
1734
|
+
constructor() {
|
|
1735
|
+
super(...arguments);
|
|
1736
|
+
this.runContext = {
|
|
1737
|
+
urlPattern: "^https://(www\\.)?airbnb\\.[^/]+/"
|
|
1738
|
+
};
|
|
1739
|
+
this.prehideSelectors = [
|
|
1740
|
+
"div[data-testid=main-cookies-banner-container]",
|
|
1741
|
+
'div:has(> div:first-child):has(> div:last-child):has(> section [data-testid="strictly-necessary-cookies"])'
|
|
1742
|
+
];
|
|
1743
|
+
}
|
|
1744
|
+
get hasSelfTest() {
|
|
1659
1745
|
return true;
|
|
1660
1746
|
}
|
|
1747
|
+
get isIntermediate() {
|
|
1748
|
+
return false;
|
|
1749
|
+
}
|
|
1750
|
+
get isCosmetic() {
|
|
1751
|
+
return false;
|
|
1752
|
+
}
|
|
1753
|
+
async detectCmp() {
|
|
1754
|
+
return elementExists("div[data-testid=main-cookies-banner-container]");
|
|
1755
|
+
}
|
|
1756
|
+
async detectPopup() {
|
|
1757
|
+
return elementVisible("div[data-testid=main-cookies-banner-container", "any");
|
|
1758
|
+
}
|
|
1759
|
+
async optOut() {
|
|
1760
|
+
await waitForThenClick("div[data-testid=main-cookies-banner-container] button._snbhip0");
|
|
1761
|
+
let check;
|
|
1762
|
+
while (check = document.querySelector("[data-testid=modal-container] button[aria-checked=true]:not([disabled])")) {
|
|
1763
|
+
check.click();
|
|
1764
|
+
}
|
|
1765
|
+
return waitForThenClick("button[data-testid=save-btn]");
|
|
1766
|
+
}
|
|
1767
|
+
async optIn() {
|
|
1768
|
+
return waitForThenClick("div[data-testid=main-cookies-banner-container] button._148dgdpk");
|
|
1769
|
+
}
|
|
1770
|
+
async test() {
|
|
1771
|
+
return await waitFor(
|
|
1772
|
+
() => !!document.cookie.match("OptanonAlertBoxClosed"),
|
|
1773
|
+
20,
|
|
1774
|
+
200
|
|
1775
|
+
);
|
|
1776
|
+
}
|
|
1661
1777
|
};
|
|
1662
1778
|
|
|
1779
|
+
// lib/cmps/all.ts
|
|
1780
|
+
var dynamicCMPs = [
|
|
1781
|
+
TrustArcTop,
|
|
1782
|
+
TrustArcFrame,
|
|
1783
|
+
Cookiebot,
|
|
1784
|
+
SourcePoint,
|
|
1785
|
+
ConsentManager,
|
|
1786
|
+
Evidon,
|
|
1787
|
+
Onetrust,
|
|
1788
|
+
Klaro,
|
|
1789
|
+
Uniconsent,
|
|
1790
|
+
Conversant,
|
|
1791
|
+
Tiktok,
|
|
1792
|
+
Airbnb
|
|
1793
|
+
];
|
|
1794
|
+
|
|
1663
1795
|
// lib/web.ts
|
|
1664
|
-
function filterCMPs(
|
|
1665
|
-
return
|
|
1796
|
+
function filterCMPs(rules, config) {
|
|
1797
|
+
return rules.filter((cmp) => {
|
|
1666
1798
|
return (!config.disabledCmps || !config.disabledCmps.includes(cmp.name)) && (config.enableCosmeticRules || !cmp.isCosmetic);
|
|
1667
1799
|
});
|
|
1668
1800
|
}
|
|
@@ -1681,14 +1813,15 @@ var AutoConsent = class {
|
|
|
1681
1813
|
};
|
|
1682
1814
|
evalState.sendContentMessage = sendContentMessage;
|
|
1683
1815
|
this.sendContentMessage = sendContentMessage;
|
|
1684
|
-
this.rules = [
|
|
1816
|
+
this.rules = [];
|
|
1685
1817
|
enableLogs && console.log("autoconsent init", window.location.href);
|
|
1686
1818
|
this.updateState({ lifecycle: "loading" });
|
|
1819
|
+
this.addDynamicRules();
|
|
1687
1820
|
if (config) {
|
|
1688
1821
|
this.initialize(config, declarativeRules);
|
|
1689
1822
|
} else {
|
|
1690
1823
|
if (declarativeRules) {
|
|
1691
|
-
this.
|
|
1824
|
+
this.parseDeclarativeRules(declarativeRules);
|
|
1692
1825
|
}
|
|
1693
1826
|
const initMsg = {
|
|
1694
1827
|
type: "init",
|
|
@@ -1705,7 +1838,7 @@ var AutoConsent = class {
|
|
|
1705
1838
|
return;
|
|
1706
1839
|
}
|
|
1707
1840
|
if (declarativeRules) {
|
|
1708
|
-
this.
|
|
1841
|
+
this.parseDeclarativeRules(declarativeRules);
|
|
1709
1842
|
}
|
|
1710
1843
|
this.rules = filterCMPs(this.rules, config);
|
|
1711
1844
|
if (config.enablePrehide) {
|
|
@@ -1730,17 +1863,22 @@ var AutoConsent = class {
|
|
|
1730
1863
|
}
|
|
1731
1864
|
this.updateState({ lifecycle: "initialized" });
|
|
1732
1865
|
}
|
|
1733
|
-
|
|
1866
|
+
addDynamicRules() {
|
|
1867
|
+
dynamicCMPs.forEach((cmp) => {
|
|
1868
|
+
this.rules.push(new cmp(this));
|
|
1869
|
+
});
|
|
1870
|
+
}
|
|
1871
|
+
parseDeclarativeRules(declarativeRules) {
|
|
1734
1872
|
Object.keys(declarativeRules.consentomatic).forEach((name) => {
|
|
1735
1873
|
this.addConsentomaticCMP(name, declarativeRules.consentomatic[name]);
|
|
1736
1874
|
});
|
|
1737
|
-
declarativeRules.autoconsent.forEach((
|
|
1738
|
-
this.
|
|
1875
|
+
declarativeRules.autoconsent.forEach((ruleset) => {
|
|
1876
|
+
this.addDeclarativeCMP(ruleset);
|
|
1739
1877
|
});
|
|
1740
1878
|
enableLogs && console.log("added rules", this.rules);
|
|
1741
1879
|
}
|
|
1742
|
-
|
|
1743
|
-
this.rules.push(
|
|
1880
|
+
addDeclarativeCMP(ruleset) {
|
|
1881
|
+
this.rules.push(new AutoConsentCMP(ruleset, this));
|
|
1744
1882
|
}
|
|
1745
1883
|
addConsentomaticCMP(name, config) {
|
|
1746
1884
|
this.rules.push(new ConsentOMaticCMP(`com_${name}`, config));
|
|
@@ -1840,7 +1978,10 @@ var AutoConsent = class {
|
|
|
1840
1978
|
});
|
|
1841
1979
|
result.push(cmp);
|
|
1842
1980
|
}
|
|
1843
|
-
}).catch(() =>
|
|
1981
|
+
}).catch((e) => {
|
|
1982
|
+
enableLogs && console.warn(`error waiting for a popup for ${cmp.name}`, e);
|
|
1983
|
+
return null;
|
|
1984
|
+
}));
|
|
1844
1985
|
await Promise.all(popupLookups);
|
|
1845
1986
|
return result;
|
|
1846
1987
|
}
|
|
@@ -1933,7 +2074,10 @@ var AutoConsent = class {
|
|
|
1933
2074
|
}
|
|
1934
2075
|
async waitForPopup(cmp, retries = 5, interval = 500) {
|
|
1935
2076
|
enableLogs && console.log("checking if popup is open...", cmp.name);
|
|
1936
|
-
const isOpen = await cmp.detectPopup()
|
|
2077
|
+
const isOpen = await cmp.detectPopup().catch((e) => {
|
|
2078
|
+
enableLogs && console.warn(`error detecting popup for ${cmp.name}`, e);
|
|
2079
|
+
return false;
|
|
2080
|
+
});
|
|
1937
2081
|
if (!isOpen && retries > 0) {
|
|
1938
2082
|
await wait(interval);
|
|
1939
2083
|
return this.waitForPopup(cmp, retries - 1, interval);
|
|
@@ -1998,7 +2142,5 @@ var AutoConsent = class {
|
|
|
1998
2142
|
}
|
|
1999
2143
|
};
|
|
2000
2144
|
export {
|
|
2001
|
-
|
|
2002
|
-
AutoConsent as default,
|
|
2003
|
-
rules2 as rules
|
|
2145
|
+
AutoConsent as default
|
|
2004
2146
|
};
|