@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/lib/cmps/airbnb.ts
CHANGED
|
@@ -4,9 +4,7 @@ import { waitFor } from "../utils";
|
|
|
4
4
|
import AutoConsentCMPBase from "./base";
|
|
5
5
|
|
|
6
6
|
export default class Airbnb extends AutoConsentCMPBase {
|
|
7
|
-
|
|
8
|
-
super("airbnb");
|
|
9
|
-
}
|
|
7
|
+
name: "airbnb";
|
|
10
8
|
|
|
11
9
|
runContext: RunContext = {
|
|
12
10
|
urlPattern: '^https://(www\\.)?airbnb\\.[^/]+/'
|
package/lib/cmps/all.ts
CHANGED
|
@@ -1,13 +1,10 @@
|
|
|
1
|
-
import { AutoConsentCMP } from './base';
|
|
2
1
|
import TrustArcTop from './trustarc-top';
|
|
3
2
|
import TrustArcFrame from './trustarc-frame';
|
|
4
3
|
import CookieBot from './cookiebot';
|
|
5
4
|
import SourcePointFrame from './sourcepoint-frame';
|
|
6
5
|
import ConsentManager from './consentmanager';
|
|
7
6
|
import Evidon from './evidon';
|
|
8
|
-
import { AutoConsentCMPRule } from '../rules';
|
|
9
7
|
import Onetrust from './onetrust';
|
|
10
|
-
import { AutoCMP } from '../types';
|
|
11
8
|
import Klaro from './klaro';
|
|
12
9
|
import Uniconsent from './uniconsent';
|
|
13
10
|
import Conversant from './conversant';
|
|
@@ -15,23 +12,17 @@ import Tiktok from './tiktok';
|
|
|
15
12
|
import Airbnb from './airbnb';
|
|
16
13
|
|
|
17
14
|
|
|
18
|
-
const
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
15
|
+
export const dynamicCMPs = [
|
|
16
|
+
TrustArcTop,
|
|
17
|
+
TrustArcFrame,
|
|
18
|
+
CookieBot,
|
|
19
|
+
SourcePointFrame,
|
|
20
|
+
ConsentManager,
|
|
21
|
+
Evidon,
|
|
22
|
+
Onetrust,
|
|
23
|
+
Klaro,
|
|
24
|
+
Uniconsent,
|
|
25
|
+
Conversant,
|
|
26
|
+
Tiktok,
|
|
27
|
+
Airbnb,
|
|
31
28
|
];
|
|
32
|
-
|
|
33
|
-
export function createAutoCMP(config: AutoConsentCMPRule): AutoConsentCMP {
|
|
34
|
-
return new AutoConsentCMP(config);
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
export default rules;
|
package/lib/cmps/base.ts
CHANGED
|
@@ -3,7 +3,10 @@
|
|
|
3
3
|
import { AutoCMP } from "../types";
|
|
4
4
|
import { AutoConsentCMPRule, AutoConsentRuleStep, RunContext } from "../rules";
|
|
5
5
|
import { enableLogs } from "../config";
|
|
6
|
-
import { click,
|
|
6
|
+
import { click, elementExists, elementVisible, hide, wait, waitForElement, waitForThenClick, waitForVisible } from "../rule-executors";
|
|
7
|
+
import { requestEval } from "../eval-handler";
|
|
8
|
+
import AutoConsent from "../web";
|
|
9
|
+
import { getFunctionBody, snippets } from "../eval-snippets";
|
|
7
10
|
|
|
8
11
|
export async function success(action: Promise<boolean>): Promise<boolean> {
|
|
9
12
|
const result = await action;
|
|
@@ -20,12 +23,12 @@ export const defaultRunContext: RunContext = {
|
|
|
20
23
|
}
|
|
21
24
|
|
|
22
25
|
export default class AutoConsentCMPBase implements AutoCMP {
|
|
23
|
-
|
|
24
26
|
name: string
|
|
25
27
|
runContext: RunContext = defaultRunContext;
|
|
28
|
+
autoconsent: AutoConsent;
|
|
26
29
|
|
|
27
|
-
constructor(
|
|
28
|
-
this.
|
|
30
|
+
constructor(autoconsentInstance: AutoConsent) {
|
|
31
|
+
this.autoconsent = autoconsentInstance;
|
|
29
32
|
}
|
|
30
33
|
|
|
31
34
|
get hasSelfTest(): boolean {
|
|
@@ -40,6 +43,33 @@ export default class AutoConsentCMPBase implements AutoCMP {
|
|
|
40
43
|
throw new Error('Not Implemented');
|
|
41
44
|
}
|
|
42
45
|
|
|
46
|
+
mainWorldEval(snippetId: keyof typeof snippets): Promise<boolean> {
|
|
47
|
+
const snippet = snippets[snippetId];
|
|
48
|
+
if (!snippet) {
|
|
49
|
+
console.warn('Snippet not found', snippetId);
|
|
50
|
+
return Promise.resolve(false);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
if (this.autoconsent.config.isMainWorld) {
|
|
54
|
+
enableLogs && console.log('inline eval:', snippetId, snippet);
|
|
55
|
+
let result = false;
|
|
56
|
+
try {
|
|
57
|
+
result = !!snippet.call(globalThis);
|
|
58
|
+
} catch (e) {
|
|
59
|
+
// ignore exceptions
|
|
60
|
+
enableLogs && console.error('error evaluating rule', snippetId, e);
|
|
61
|
+
}
|
|
62
|
+
return Promise.resolve(result);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
const snippetSrc = getFunctionBody(snippet);
|
|
66
|
+
enableLogs && console.log('async eval:', snippetId, snippetSrc);
|
|
67
|
+
return requestEval(snippetSrc).catch((e) => {
|
|
68
|
+
enableLogs && console.error('error evaluating rule', snippetId, e);
|
|
69
|
+
return false;
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
|
|
43
73
|
checkRunContext(): boolean {
|
|
44
74
|
const runCtx: RunContext = {
|
|
45
75
|
...defaultRunContext,
|
|
@@ -88,90 +118,11 @@ export default class AutoConsentCMPBase implements AutoCMP {
|
|
|
88
118
|
}
|
|
89
119
|
}
|
|
90
120
|
|
|
91
|
-
async function evaluateRuleStep(rule: AutoConsentRuleStep) {
|
|
92
|
-
const results = [];
|
|
93
|
-
if (rule.exists) {
|
|
94
|
-
results.push(elementExists(rule.exists));
|
|
95
|
-
}
|
|
96
|
-
if (rule.visible) {
|
|
97
|
-
results.push(elementVisible(rule.visible, rule.check));
|
|
98
|
-
}
|
|
99
|
-
if (rule.eval) {
|
|
100
|
-
const res = doEval(rule.eval)
|
|
101
|
-
results.push(res);
|
|
102
|
-
}
|
|
103
|
-
if (rule.waitFor) {
|
|
104
|
-
results.push(waitForElement(rule.waitFor, rule.timeout));
|
|
105
|
-
}
|
|
106
|
-
if (rule.waitForVisible) {
|
|
107
|
-
results.push(waitForVisible(rule.waitForVisible, rule.timeout, rule.check));
|
|
108
|
-
}
|
|
109
|
-
if (rule.click) {
|
|
110
|
-
results.push(click(rule.click, rule.all));
|
|
111
|
-
}
|
|
112
|
-
if (rule.waitForThenClick) {
|
|
113
|
-
results.push(waitForThenClick(rule.waitForThenClick, rule.timeout, rule.all));
|
|
114
|
-
}
|
|
115
|
-
if (rule.wait) {
|
|
116
|
-
results.push(wait(rule.wait));
|
|
117
|
-
}
|
|
118
|
-
if (rule.hide) {
|
|
119
|
-
results.push(hide(rule.hide, rule.method));
|
|
120
|
-
}
|
|
121
|
-
if (rule.if) {
|
|
122
|
-
if (!rule.if.exists && !rule.if.visible) {
|
|
123
|
-
console.error('invalid conditional rule', rule.if);
|
|
124
|
-
return false;
|
|
125
|
-
}
|
|
126
|
-
const condition = await evaluateRuleStep(rule.if);
|
|
127
|
-
enableLogs && console.log('Condition is', condition);
|
|
128
|
-
if (condition) {
|
|
129
|
-
results.push(_runRulesSequentially(rule.then));
|
|
130
|
-
} else if (rule.else) {
|
|
131
|
-
results.push(_runRulesSequentially(rule.else));
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
if (rule.any) {
|
|
135
|
-
for (const step of rule.any) {
|
|
136
|
-
if (await evaluateRuleStep(step)) {
|
|
137
|
-
return true
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
return false
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
if (results.length === 0) {
|
|
144
|
-
enableLogs && console.warn('Unrecognized rule', rule);
|
|
145
|
-
return false;
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
// boolean and of results
|
|
149
|
-
const all = await Promise.all(results);
|
|
150
|
-
return all.reduce((a, b) => a && b, true);
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
async function _runRulesParallel(rules: AutoConsentRuleStep[]): Promise<boolean> {
|
|
154
|
-
const results = rules.map(rule => evaluateRuleStep(rule));
|
|
155
|
-
const detections = await Promise.all(results);
|
|
156
|
-
return detections.every(r => !!r);
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
async function _runRulesSequentially(rules: AutoConsentRuleStep[]): Promise<boolean> {
|
|
160
|
-
for (const rule of rules) {
|
|
161
|
-
enableLogs && console.log('Running rule...', rule);
|
|
162
|
-
const result = await evaluateRuleStep(rule);
|
|
163
|
-
enableLogs && console.log('...rule result', result);
|
|
164
|
-
if (!result && !rule.optional) {
|
|
165
|
-
return false;
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
|
-
return true;
|
|
169
|
-
}
|
|
170
|
-
|
|
171
121
|
export class AutoConsentCMP extends AutoConsentCMPBase {
|
|
172
122
|
|
|
173
|
-
constructor(public config: AutoConsentCMPRule) {
|
|
174
|
-
super(
|
|
123
|
+
constructor(public config: AutoConsentCMPRule, autoconsentInstance: AutoConsent) {
|
|
124
|
+
super(autoconsentInstance);
|
|
125
|
+
this.name = config.name;
|
|
175
126
|
this.runContext = config.runContext || defaultRunContext;
|
|
176
127
|
}
|
|
177
128
|
|
|
@@ -193,14 +144,14 @@ export class AutoConsentCMP extends AutoConsentCMPBase {
|
|
|
193
144
|
|
|
194
145
|
async detectCmp() {
|
|
195
146
|
if (this.config.detectCmp) {
|
|
196
|
-
return _runRulesParallel(this.config.detectCmp);
|
|
147
|
+
return this._runRulesParallel(this.config.detectCmp);
|
|
197
148
|
}
|
|
198
149
|
return false;
|
|
199
150
|
}
|
|
200
151
|
|
|
201
152
|
async detectPopup() {
|
|
202
153
|
if (this.config.detectPopup) {
|
|
203
|
-
return _runRulesSequentially(this.config.detectPopup);
|
|
154
|
+
return this._runRulesSequentially(this.config.detectPopup);
|
|
204
155
|
}
|
|
205
156
|
return false;
|
|
206
157
|
}
|
|
@@ -208,7 +159,7 @@ export class AutoConsentCMP extends AutoConsentCMPBase {
|
|
|
208
159
|
async optOut() {
|
|
209
160
|
if (this.config.optOut) {
|
|
210
161
|
enableLogs && console.log('Initiated optOut()', this.config.optOut);
|
|
211
|
-
return _runRulesSequentially(this.config.optOut);
|
|
162
|
+
return this._runRulesSequentially(this.config.optOut);
|
|
212
163
|
}
|
|
213
164
|
return false;
|
|
214
165
|
}
|
|
@@ -216,22 +167,102 @@ export class AutoConsentCMP extends AutoConsentCMPBase {
|
|
|
216
167
|
async optIn() {
|
|
217
168
|
if (this.config.optIn) {
|
|
218
169
|
enableLogs && console.log('Initiated optIn()', this.config.optIn);
|
|
219
|
-
return _runRulesSequentially(this.config.optIn);
|
|
170
|
+
return this._runRulesSequentially(this.config.optIn);
|
|
220
171
|
}
|
|
221
172
|
return false;
|
|
222
173
|
}
|
|
223
174
|
|
|
224
175
|
async openCmp() {
|
|
225
176
|
if (this.config.openCmp) {
|
|
226
|
-
return _runRulesSequentially(this.config.openCmp);
|
|
177
|
+
return this._runRulesSequentially(this.config.openCmp);
|
|
227
178
|
}
|
|
228
179
|
return false;
|
|
229
180
|
}
|
|
230
181
|
|
|
231
182
|
async test() {
|
|
232
183
|
if (this.hasSelfTest) {
|
|
233
|
-
return _runRulesSequentially(this.config.test);
|
|
184
|
+
return this._runRulesSequentially(this.config.test);
|
|
234
185
|
}
|
|
235
186
|
return super.test();
|
|
236
187
|
}
|
|
188
|
+
|
|
189
|
+
async evaluateRuleStep(rule: AutoConsentRuleStep) {
|
|
190
|
+
const results = [];
|
|
191
|
+
if (rule.exists) {
|
|
192
|
+
results.push(elementExists(rule.exists));
|
|
193
|
+
}
|
|
194
|
+
if (rule.visible) {
|
|
195
|
+
results.push(elementVisible(rule.visible, rule.check));
|
|
196
|
+
}
|
|
197
|
+
if (rule.eval) {
|
|
198
|
+
const res = this.mainWorldEval(rule.eval)
|
|
199
|
+
results.push(res);
|
|
200
|
+
}
|
|
201
|
+
if (rule.waitFor) {
|
|
202
|
+
results.push(waitForElement(rule.waitFor, rule.timeout));
|
|
203
|
+
}
|
|
204
|
+
if (rule.waitForVisible) {
|
|
205
|
+
results.push(waitForVisible(rule.waitForVisible, rule.timeout, rule.check));
|
|
206
|
+
}
|
|
207
|
+
if (rule.click) {
|
|
208
|
+
results.push(click(rule.click, rule.all));
|
|
209
|
+
}
|
|
210
|
+
if (rule.waitForThenClick) {
|
|
211
|
+
results.push(waitForThenClick(rule.waitForThenClick, rule.timeout, rule.all));
|
|
212
|
+
}
|
|
213
|
+
if (rule.wait) {
|
|
214
|
+
results.push(wait(rule.wait));
|
|
215
|
+
}
|
|
216
|
+
if (rule.hide) {
|
|
217
|
+
results.push(hide(rule.hide, rule.method));
|
|
218
|
+
}
|
|
219
|
+
if (rule.if) {
|
|
220
|
+
if (!rule.if.exists && !rule.if.visible) {
|
|
221
|
+
console.error('invalid conditional rule', rule.if);
|
|
222
|
+
return false;
|
|
223
|
+
}
|
|
224
|
+
const condition = await this.evaluateRuleStep(rule.if);
|
|
225
|
+
enableLogs && console.log('Condition is', condition);
|
|
226
|
+
if (condition) {
|
|
227
|
+
results.push(this._runRulesSequentially(rule.then));
|
|
228
|
+
} else if (rule.else) {
|
|
229
|
+
results.push(this._runRulesSequentially(rule.else));
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
if (rule.any) {
|
|
233
|
+
for (const step of rule.any) {
|
|
234
|
+
if (await this.evaluateRuleStep(step)) {
|
|
235
|
+
return true
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
return false
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
if (results.length === 0) {
|
|
242
|
+
enableLogs && console.warn('Unrecognized rule', rule);
|
|
243
|
+
return false;
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
// boolean and of results
|
|
247
|
+
const all = await Promise.all(results);
|
|
248
|
+
return all.reduce((a, b) => a && b, true);
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
async _runRulesParallel(rules: AutoConsentRuleStep[]): Promise<boolean> {
|
|
252
|
+
const results = rules.map(rule => this.evaluateRuleStep(rule));
|
|
253
|
+
const detections = await Promise.all(results);
|
|
254
|
+
return detections.every(r => !!r);
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
async _runRulesSequentially(rules: AutoConsentRuleStep[]): Promise<boolean> {
|
|
258
|
+
for (const rule of rules) {
|
|
259
|
+
enableLogs && console.log('Running rule...', rule);
|
|
260
|
+
const result = await this.evaluateRuleStep(rule);
|
|
261
|
+
enableLogs && console.log('...rule result', result);
|
|
262
|
+
if (!result && !rule.optional) {
|
|
263
|
+
return false;
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
return true;
|
|
267
|
+
}
|
|
237
268
|
}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import { click,
|
|
1
|
+
import { click, elementExists, elementVisible, wait, waitForElement } from "../rule-executors";
|
|
2
2
|
import AutoConsentCMPBase from "./base";
|
|
3
3
|
|
|
4
4
|
// Note: JS API is also available:
|
|
5
5
|
// https://help.consentmanager.net/books/cmp/page/javascript-api
|
|
6
6
|
export default class ConsentManager extends AutoConsentCMPBase {
|
|
7
|
+
name = "consentmanager.net";
|
|
7
8
|
|
|
8
9
|
prehideSelectors = ["#cmpbox,#cmpbox2"];
|
|
9
10
|
apiAvailable = false;
|
|
@@ -20,12 +21,8 @@ export default class ConsentManager extends AutoConsentCMPBase {
|
|
|
20
21
|
return false;
|
|
21
22
|
}
|
|
22
23
|
|
|
23
|
-
constructor() {
|
|
24
|
-
super("consentmanager.net");
|
|
25
|
-
}
|
|
26
|
-
|
|
27
24
|
async detectCmp() {
|
|
28
|
-
this.apiAvailable = await
|
|
25
|
+
this.apiAvailable = await this.mainWorldEval('EVAL_CONSENTMANAGER_1');
|
|
29
26
|
if (!this.apiAvailable) {
|
|
30
27
|
return elementExists("#cmpbox");
|
|
31
28
|
} else {
|
|
@@ -38,7 +35,7 @@ export default class ConsentManager extends AutoConsentCMPBase {
|
|
|
38
35
|
// wait before making this check because early in the page lifecycle this may incorrectly return
|
|
39
36
|
// true, causing an opt-out when it is not needed.
|
|
40
37
|
await wait(500);
|
|
41
|
-
return await
|
|
38
|
+
return await this.mainWorldEval('EVAL_CONSENTMANAGER_2');
|
|
42
39
|
}
|
|
43
40
|
return elementVisible("#cmpbox .cmpmore", 'any');
|
|
44
41
|
}
|
|
@@ -46,7 +43,7 @@ export default class ConsentManager extends AutoConsentCMPBase {
|
|
|
46
43
|
async optOut() {
|
|
47
44
|
await wait(500);
|
|
48
45
|
if (this.apiAvailable) {
|
|
49
|
-
return await
|
|
46
|
+
return await this.mainWorldEval('EVAL_CONSENTMANAGER_3');
|
|
50
47
|
}
|
|
51
48
|
|
|
52
49
|
if (click(".cmpboxbtnno")) {
|
|
@@ -68,14 +65,14 @@ export default class ConsentManager extends AutoConsentCMPBase {
|
|
|
68
65
|
|
|
69
66
|
async optIn() {
|
|
70
67
|
if (this.apiAvailable) {
|
|
71
|
-
return await
|
|
68
|
+
return await this.mainWorldEval('EVAL_CONSENTMANAGER_4');
|
|
72
69
|
}
|
|
73
70
|
return click(".cmpboxbtnyes");
|
|
74
71
|
}
|
|
75
72
|
|
|
76
73
|
async test() {
|
|
77
74
|
if (this.apiAvailable) {
|
|
78
|
-
return await
|
|
75
|
+
return await this.mainWorldEval('EVAL_CONSENTMANAGER_5');
|
|
79
76
|
}
|
|
80
77
|
}
|
|
81
78
|
}
|
package/lib/cmps/conversant.ts
CHANGED
|
@@ -5,10 +5,7 @@ import AutoConsentCMPBase from "./base";
|
|
|
5
5
|
export default class Conversant extends AutoConsentCMPBase {
|
|
6
6
|
|
|
7
7
|
prehideSelectors = [".cmp-root"]
|
|
8
|
-
|
|
9
|
-
constructor() {
|
|
10
|
-
super("Conversant");
|
|
11
|
-
}
|
|
8
|
+
name = "Conversant";
|
|
12
9
|
|
|
13
10
|
get hasSelfTest(): boolean {
|
|
14
11
|
return true;
|
package/lib/cmps/cookiebot.ts
CHANGED
|
@@ -1,14 +1,10 @@
|
|
|
1
|
-
import { click,
|
|
1
|
+
import { click, elementExists, wait, waitForElement } from '../rule-executors';
|
|
2
2
|
import AutoConsentCMPBase from './base';
|
|
3
3
|
|
|
4
4
|
export default class Cookiebot extends AutoConsentCMPBase {
|
|
5
|
-
|
|
5
|
+
name = 'Cybotcookiebot';
|
|
6
6
|
prehideSelectors = ["#CybotCookiebotDialog,#dtcookie-container,#cookiebanner,#cb-cookieoverlay"]
|
|
7
7
|
|
|
8
|
-
constructor() {
|
|
9
|
-
super('Cybotcookiebot');
|
|
10
|
-
}
|
|
11
|
-
|
|
12
8
|
get hasSelfTest(): boolean {
|
|
13
9
|
return true;
|
|
14
10
|
}
|
|
@@ -64,14 +60,14 @@ export default class Cookiebot extends AutoConsentCMPBase {
|
|
|
64
60
|
}
|
|
65
61
|
|
|
66
62
|
// some sites have custom submit buttons with no obvious selectors. In this case we just call the submitConsent API.
|
|
67
|
-
if (await
|
|
68
|
-
await
|
|
63
|
+
if (await this.mainWorldEval('EVAL_COOKIEBOT_1')) {
|
|
64
|
+
await this.mainWorldEval('EVAL_COOKIEBOT_2');
|
|
69
65
|
await wait(500);
|
|
70
66
|
}
|
|
71
67
|
|
|
72
68
|
// site with 3rd confirm settings modal
|
|
73
69
|
if (elementExists('#cb-confirmedSettings')) {
|
|
74
|
-
await
|
|
70
|
+
await this.mainWorldEval('EVAL_COOKIEBOT_3');
|
|
75
71
|
}
|
|
76
72
|
|
|
77
73
|
return true;
|
|
@@ -89,6 +85,6 @@ export default class Cookiebot extends AutoConsentCMPBase {
|
|
|
89
85
|
}
|
|
90
86
|
|
|
91
87
|
async test() {
|
|
92
|
-
return
|
|
88
|
+
return this.mainWorldEval('EVAL_COOKIEBOT_4');
|
|
93
89
|
}
|
|
94
90
|
}
|
package/lib/cmps/evidon.ts
CHANGED
|
@@ -3,9 +3,7 @@ import { getStyleElement, hideElements } from "../utils";
|
|
|
3
3
|
import AutoConsentCMPBase from "./base";
|
|
4
4
|
|
|
5
5
|
export default class Evidon extends AutoConsentCMPBase {
|
|
6
|
-
|
|
7
|
-
super("Evidon");
|
|
8
|
-
}
|
|
6
|
+
name = "Evidon";
|
|
9
7
|
|
|
10
8
|
get hasSelfTest(): boolean {
|
|
11
9
|
return false;
|
package/lib/cmps/klaro.ts
CHANGED
|
@@ -1,15 +1,11 @@
|
|
|
1
|
-
import { click,
|
|
1
|
+
import { click, elementExists, elementVisible, waitForElement } from "../rule-executors";
|
|
2
2
|
import AutoConsentCMPBase from "./base";
|
|
3
3
|
|
|
4
4
|
export default class Klaro extends AutoConsentCMPBase {
|
|
5
|
-
|
|
5
|
+
name = "Klaro";
|
|
6
6
|
prehideSelectors = [".klaro"]
|
|
7
7
|
settingsOpen = false;
|
|
8
8
|
|
|
9
|
-
constructor() {
|
|
10
|
-
super("Klaro");
|
|
11
|
-
}
|
|
12
|
-
|
|
13
9
|
get hasSelfTest(): boolean {
|
|
14
10
|
return true;
|
|
15
11
|
}
|
|
@@ -65,6 +61,6 @@ export default class Klaro extends AutoConsentCMPBase {
|
|
|
65
61
|
}
|
|
66
62
|
|
|
67
63
|
async test() {
|
|
68
|
-
return await
|
|
64
|
+
return await this.mainWorldEval('EVAL_KLARO_1');
|
|
69
65
|
}
|
|
70
66
|
}
|
package/lib/cmps/onetrust.ts
CHANGED
|
@@ -1,16 +1,12 @@
|
|
|
1
|
-
import { click,
|
|
1
|
+
import { click, elementExists, elementVisible, wait, waitForElement } from "../rule-executors";
|
|
2
2
|
import { RunContext } from "../rules";
|
|
3
3
|
import { waitFor } from "../utils";
|
|
4
4
|
import AutoConsentCMPBase from "./base";
|
|
5
5
|
|
|
6
6
|
export default class Onetrust extends AutoConsentCMPBase {
|
|
7
|
-
|
|
7
|
+
name = "Onetrust";
|
|
8
8
|
prehideSelectors = ["#onetrust-banner-sdk,#onetrust-consent-sdk,.onetrust-pc-dark-filter,.js-consent-banner"]
|
|
9
9
|
|
|
10
|
-
constructor() {
|
|
11
|
-
super("Onetrust");
|
|
12
|
-
}
|
|
13
|
-
|
|
14
10
|
runContext: RunContext = {
|
|
15
11
|
urlPattern: '^(?!.*https://www\\.nba\\.com/)'
|
|
16
12
|
}
|
|
@@ -64,6 +60,6 @@ export default class Onetrust extends AutoConsentCMPBase {
|
|
|
64
60
|
}
|
|
65
61
|
|
|
66
62
|
async test() {
|
|
67
|
-
return await
|
|
63
|
+
return await this.mainWorldEval('EVAL_ONETRUST_1');
|
|
68
64
|
}
|
|
69
65
|
}
|
|
@@ -5,6 +5,7 @@ import { waitFor } from "../utils";
|
|
|
5
5
|
import AutoConsentCMPBase from "./base";
|
|
6
6
|
|
|
7
7
|
export default class SourcePoint extends AutoConsentCMPBase {
|
|
8
|
+
name = "Sourcepoint-frame";
|
|
8
9
|
prehideSelectors = ["div[id^='sp_message_container_'],.message-overlay",'#sp_privacy_manager_container']
|
|
9
10
|
|
|
10
11
|
ccpaNotice = false;
|
|
@@ -15,10 +16,6 @@ export default class SourcePoint extends AutoConsentCMPBase {
|
|
|
15
16
|
frame: true,
|
|
16
17
|
}
|
|
17
18
|
|
|
18
|
-
constructor() {
|
|
19
|
-
super("Sourcepoint-frame");
|
|
20
|
-
}
|
|
21
|
-
|
|
22
19
|
get hasSelfTest(): boolean {
|
|
23
20
|
return false; // self-test is done by parent frame
|
|
24
21
|
}
|
package/lib/cmps/tiktok.ts
CHANGED
|
@@ -5,9 +5,7 @@ import { isElementVisible } from "../utils";
|
|
|
5
5
|
import AutoConsentCMPBase from "./base";
|
|
6
6
|
|
|
7
7
|
export default class Tiktok extends AutoConsentCMPBase {
|
|
8
|
-
|
|
9
|
-
super("tiktok.com");
|
|
10
|
-
}
|
|
8
|
+
name = "tiktok.com";
|
|
11
9
|
|
|
12
10
|
runContext: RunContext = {
|
|
13
11
|
urlPattern: 'tiktok'
|
|
@@ -4,9 +4,7 @@ import { waitFor } from "../utils";
|
|
|
4
4
|
import AutoConsentCMPBase from "./base";
|
|
5
5
|
|
|
6
6
|
export default class TrustArcFrame extends AutoConsentCMPBase {
|
|
7
|
-
|
|
8
|
-
super("TrustArc-frame");
|
|
9
|
-
}
|
|
7
|
+
name = "TrustArc-frame";
|
|
10
8
|
|
|
11
9
|
runContext: RunContext = {
|
|
12
10
|
main: false,
|
package/lib/cmps/trustarc-top.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { click,
|
|
1
|
+
import { click, elementExists, elementVisible } from "../rule-executors";
|
|
2
2
|
import { RunContext } from "../rules";
|
|
3
3
|
import { getStyleElement, hideElements } from "../utils";
|
|
4
|
+
import AutoConsent from "../web";
|
|
4
5
|
import AutoConsentCMPBase from "./base";
|
|
5
6
|
|
|
6
7
|
const cookieSettingsButton = "#truste-show-consent";
|
|
@@ -11,7 +12,7 @@ const bannerOverlay = '#trustarc-banner-overlay';
|
|
|
11
12
|
const bannerContainer = '#truste-consent-track';
|
|
12
13
|
|
|
13
14
|
export default class TrustArcTop extends AutoConsentCMPBase {
|
|
14
|
-
|
|
15
|
+
name = "TrustArc-top";
|
|
15
16
|
prehideSelectors = [
|
|
16
17
|
".trustarc-banner-container",
|
|
17
18
|
`.truste_popframe,.truste_overlay,.truste_box_overlay,${bannerContainer}`,
|
|
@@ -24,8 +25,8 @@ export default class TrustArcTop extends AutoConsentCMPBase {
|
|
|
24
25
|
_shortcutButton: HTMLElement;
|
|
25
26
|
_optInDone: boolean;
|
|
26
27
|
|
|
27
|
-
constructor() {
|
|
28
|
-
super(
|
|
28
|
+
constructor(autoconsentInstance: AutoConsent) {
|
|
29
|
+
super(autoconsentInstance);
|
|
29
30
|
this._shortcutButton = null; // indicates if the "reject all" button is detected
|
|
30
31
|
this._optInDone = false;
|
|
31
32
|
}
|
|
@@ -97,6 +98,6 @@ export default class TrustArcTop extends AutoConsentCMPBase {
|
|
|
97
98
|
async test() {
|
|
98
99
|
//Test JS variable to check the user's preference
|
|
99
100
|
//PrefCookie = undefined means no consent is set, PrefCookie = '0' means consent is set to required only
|
|
100
|
-
return await
|
|
101
|
+
return await this.mainWorldEval('EVAL_TRUSTARC_TOP');
|
|
101
102
|
}
|
|
102
103
|
}
|
package/lib/cmps/uniconsent.ts
CHANGED
|
@@ -2,9 +2,7 @@ import { elementExists, elementVisible, wait, waitForElement, waitForThenClick }
|
|
|
2
2
|
import AutoConsentCMPBase from "./base";
|
|
3
3
|
|
|
4
4
|
export default class Uniconsent extends AutoConsentCMPBase {
|
|
5
|
-
|
|
6
|
-
super("Uniconsent");
|
|
7
|
-
}
|
|
5
|
+
name = "Uniconsent";
|
|
8
6
|
|
|
9
7
|
get prehideSelectors(): string[] {
|
|
10
8
|
return ['.unic', '.modal:has(.unic)'];
|