@duckduckgo/autoconsent 6.4.1 → 6.4.3
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/CHANGELOG.md +30 -0
- package/dist/addon-firefox/background.bundle.js +1 -0
- package/dist/addon-firefox/content.bundle.js +19 -40
- package/dist/addon-firefox/manifest.json +1 -1
- package/dist/addon-firefox/rules.json +97 -0
- package/dist/addon-mv3/background.bundle.js +1 -0
- package/dist/addon-mv3/content.bundle.js +19 -40
- package/dist/addon-mv3/manifest.json +1 -1
- package/dist/addon-mv3/rules.json +97 -0
- package/dist/autoconsent.cjs.js +19 -40
- package/dist/autoconsent.esm.js +19 -40
- package/dist/autoconsent.playwright.js +1 -1
- package/lib/cmps/base.ts +1 -0
- package/lib/cmps/cookiebot.ts +14 -50
- package/lib/eval-snippets.ts +6 -4
- package/package.json +2 -2
- package/rules/autoconsent/cookieyes.json +32 -0
- package/rules/autoconsent/yahoo.json +15 -0
- package/rules/rules.json +97 -0
- package/tests/cookiebot.spec.ts +11 -0
- package/tests/cookieyes.spec.ts +10 -0
- package/tests/yahoo.spec.ts +7 -0
package/lib/cmps/base.ts
CHANGED
|
@@ -63,6 +63,7 @@ export default class AutoConsentCMPBase implements AutoCMP {
|
|
|
63
63
|
}
|
|
64
64
|
|
|
65
65
|
const snippetSrc = getFunctionBody(snippet);
|
|
66
|
+
enableLogs && console.log('async eval:', snippetId, snippetSrc);
|
|
66
67
|
return requestEval(snippetSrc).catch((e) => {
|
|
67
68
|
enableLogs && console.error('error evaluating rule', snippetId, e);
|
|
68
69
|
return false;
|
package/lib/cmps/cookiebot.ts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import { click, elementExists, wait
|
|
1
|
+
import { click, elementExists, wait } from '../rule-executors';
|
|
2
|
+
import { waitFor } from '../utils';
|
|
2
3
|
import AutoConsentCMPBase from './base';
|
|
3
4
|
|
|
4
5
|
export default class Cookiebot extends AutoConsentCMPBase {
|
|
5
6
|
name = 'Cybotcookiebot';
|
|
6
|
-
prehideSelectors = ["#CybotCookiebotDialog,#dtcookie-container,#cookiebanner,#cb-cookieoverlay"]
|
|
7
|
+
prehideSelectors = ["#CybotCookiebotDialog,#CybotCookiebotDialogBodyUnderlay,#dtcookie-container,#cookiebanner,#cb-cookieoverlay,.modal--cookie-banner,#cookiebanner_outer,#CookieBanner"]
|
|
7
8
|
|
|
8
9
|
get hasSelfTest(): boolean {
|
|
9
10
|
return true;
|
|
@@ -18,59 +19,21 @@ export default class Cookiebot extends AutoConsentCMPBase {
|
|
|
18
19
|
}
|
|
19
20
|
|
|
20
21
|
async detectCmp() {
|
|
21
|
-
return
|
|
22
|
+
return await this.mainWorldEval('EVAL_COOKIEBOT_1');
|
|
22
23
|
}
|
|
23
24
|
|
|
24
25
|
async detectPopup() {
|
|
25
|
-
return
|
|
26
|
+
return await waitFor(() => {
|
|
27
|
+
return this.mainWorldEval('EVAL_COOKIEBOT_2')
|
|
28
|
+
}, 10, 500);
|
|
26
29
|
}
|
|
27
30
|
|
|
28
31
|
async optOut() {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
if (elementExists('#dtcookie-container')) {
|
|
37
|
-
return click('.h-dtcookie-decline');
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
if (click('.cookiebot__button--settings')) {
|
|
41
|
-
return true;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
if (click('#CybotCookiebotDialogBodyButtonDecline')) {
|
|
45
|
-
return true;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
click('.cookiebanner__link--details');
|
|
49
|
-
|
|
50
|
-
click('.CybotCookiebotDialogBodyLevelButton:checked:enabled,input[id*="CybotCookiebotDialogBodyLevelButton"]:checked:enabled', true);
|
|
51
|
-
|
|
52
|
-
click('#CybotCookiebotDialogBodyButtonDecline');
|
|
53
|
-
|
|
54
|
-
click('input[id^=CybotCookiebotDialogBodyLevelButton]:checked', true);
|
|
55
|
-
|
|
56
|
-
if (elementExists('#CybotCookiebotDialogBodyButtonAcceptSelected')) {
|
|
57
|
-
click('#CybotCookiebotDialogBodyButtonAcceptSelected');
|
|
58
|
-
} else {
|
|
59
|
-
click('#CybotCookiebotDialogBodyLevelButtonAccept,#CybotCookiebotDialogBodyButtonAccept,#CybotCookiebotDialogBodyLevelButtonLevelOptinAllowallSelection', true);
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
// some sites have custom submit buttons with no obvious selectors. In this case we just call the submitConsent API.
|
|
63
|
-
if (await this.mainWorldEval('EVAL_COOKIEBOT_1')) {
|
|
64
|
-
await this.mainWorldEval('EVAL_COOKIEBOT_2');
|
|
65
|
-
await wait(500);
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
// site with 3rd confirm settings modal
|
|
69
|
-
if (elementExists('#cb-confirmedSettings')) {
|
|
70
|
-
await this.mainWorldEval('EVAL_COOKIEBOT_3');
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
return true;
|
|
32
|
+
await wait(500);
|
|
33
|
+
let res = await this.mainWorldEval('EVAL_COOKIEBOT_3'); // withdraw
|
|
34
|
+
await wait(500); // prevent race conditions
|
|
35
|
+
res = res && await this.mainWorldEval('EVAL_COOKIEBOT_4'); // hide
|
|
36
|
+
return res;
|
|
74
37
|
}
|
|
75
38
|
|
|
76
39
|
async optIn() {
|
|
@@ -85,6 +48,7 @@ export default class Cookiebot extends AutoConsentCMPBase {
|
|
|
85
48
|
}
|
|
86
49
|
|
|
87
50
|
async test() {
|
|
88
|
-
|
|
51
|
+
await wait(500);
|
|
52
|
+
return await this.mainWorldEval('EVAL_COOKIEBOT_5');
|
|
89
53
|
}
|
|
90
54
|
}
|
package/lib/eval-snippets.ts
CHANGED
|
@@ -9,10 +9,11 @@ export const snippets = {
|
|
|
9
9
|
EVAL_CONSENTMANAGER_3: () => __cmp('setConsent', 0),
|
|
10
10
|
EVAL_CONSENTMANAGER_4: () => __cmp('setConsent', 1),
|
|
11
11
|
EVAL_CONSENTMANAGER_5: () => __cmp('consentStatus').userChoiceExists,
|
|
12
|
-
EVAL_COOKIEBOT_1: () => window.
|
|
13
|
-
EVAL_COOKIEBOT_2: () => window.Cookiebot.dialog
|
|
14
|
-
EVAL_COOKIEBOT_3: () =>
|
|
15
|
-
EVAL_COOKIEBOT_4: () => window.
|
|
12
|
+
EVAL_COOKIEBOT_1: () => !!window.Cookiebot,
|
|
13
|
+
EVAL_COOKIEBOT_2: () => !window.Cookiebot.hasResponse && window.Cookiebot.dialog?.visible === true,
|
|
14
|
+
EVAL_COOKIEBOT_3: () => window.Cookiebot.withdraw() || true,
|
|
15
|
+
EVAL_COOKIEBOT_4: () => window.Cookiebot.hide() || true,
|
|
16
|
+
EVAL_COOKIEBOT_5: () => window.Cookiebot.declined === true,
|
|
16
17
|
EVAL_KLARO_1: () => klaro.getManager().config.services.every(c => c.required || !klaro.getManager().consents[c.name]),
|
|
17
18
|
EVAL_ONETRUST_1: () => window.OnetrustActiveGroups.split(',').filter(s => s.length > 0).length <= 1,
|
|
18
19
|
EVAL_TRUSTARC_TOP: () => window && window.truste && window.truste.eu.bindMap.prefCookie === '0',
|
|
@@ -44,6 +45,7 @@ export const snippets = {
|
|
|
44
45
|
EVAL_COOKIEINFORMATION_0: () => CookieInformation.declineAllCategories() || true,
|
|
45
46
|
EVAL_COOKIEINFORMATION_1: () => CookieInformation.submitAllCategories() || true,
|
|
46
47
|
EVAL_COOKIEINFORMATION_2: () => document.cookie.includes('CookieInformationConsent='),
|
|
48
|
+
EVAL_COOKIEYES_0: () => document.cookie.includes('advertisement:no'),
|
|
47
49
|
EVAL_DAILYMOTION_0: () => !!document.cookie.match('dm-euconsent-v2'),
|
|
48
50
|
EVAL_DSGVO_0: () => !document.cookie.includes('sp_dsgvo_cookie_settings'),
|
|
49
51
|
EVAL_DUNELM_0: () => document.cookie.includes('cc_functional=0') && document.cookie.includes('cc_targeting=0'),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@duckduckgo/autoconsent",
|
|
3
|
-
"version": "6.4.
|
|
3
|
+
"version": "6.4.3",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "dist/autoconsent.cjs.js",
|
|
6
6
|
"module": "dist/autoconsent.esm.js",
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"clean": "rm -r dist",
|
|
12
12
|
"lint": "eslint lib/ playwright/ tests/ rules/autoconsent/*.json",
|
|
13
13
|
"bundle": "./build.sh",
|
|
14
|
-
"watch": "chokidar \"lib\" \"addon\" \"rules/autoconsent\" -c \"npm run prepublish\"",
|
|
14
|
+
"watch": "npm run prepublish && chokidar \"lib\" \"addon\" \"rules/autoconsent\" -c \"npm run prepublish\"",
|
|
15
15
|
"create-rule": "node rules/create-rule.mjs",
|
|
16
16
|
"test": "playwright test",
|
|
17
17
|
"test:webkit": "playwright test --project webkit",
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "cookieyes",
|
|
3
|
+
"prehideSelectors": [".cky-overlay,.cky-consent-container"],
|
|
4
|
+
"detectCmp": [{ "exists": ".cky-consent-container" }],
|
|
5
|
+
"detectPopup": [{ "visible": ".cky-consent-container" }],
|
|
6
|
+
"optIn": [
|
|
7
|
+
{ "waitForThenClick": ".cky-consent-container [data-cky-tag=accept-button]" }
|
|
8
|
+
],
|
|
9
|
+
"optOut": [
|
|
10
|
+
{
|
|
11
|
+
"if": { "exists": ".cky-consent-container [data-cky-tag=reject-button]" },
|
|
12
|
+
"then": [
|
|
13
|
+
{ "waitForThenClick": ".cky-consent-container [data-cky-tag=reject-button]" }
|
|
14
|
+
],
|
|
15
|
+
"else": [
|
|
16
|
+
{
|
|
17
|
+
"if": { "exists": ".cky-consent-container [data-cky-tag=settings-button]" },
|
|
18
|
+
"then": [
|
|
19
|
+
{ "click": ".cky-consent-container [data-cky-tag=settings-button]" },
|
|
20
|
+
{ "waitFor": ".cky-modal-open input[type=checkbox]" },
|
|
21
|
+
{ "click": ".cky-modal-open input[type=checkbox]:checked", "all": true, "optional": true },
|
|
22
|
+
{ "waitForThenClick": ".cky-modal [data-cky-tag=detail-save-button]" }
|
|
23
|
+
],
|
|
24
|
+
"else": [
|
|
25
|
+
{ "hide": [".cky-consent-container,.cky-overlay"] }
|
|
26
|
+
]
|
|
27
|
+
}
|
|
28
|
+
]
|
|
29
|
+
}
|
|
30
|
+
],
|
|
31
|
+
"test": [{ "eval": "EVAL_COOKIEYES_0" }]
|
|
32
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "Yahoo",
|
|
3
|
+
"runContext": {
|
|
4
|
+
"urlPattern": "^https://consent\\.yahoo\\.com/v2/"
|
|
5
|
+
},
|
|
6
|
+
"prehideSelectors": ["#reject-all"],
|
|
7
|
+
"detectCmp": [{ "exists": "#consent-page" }],
|
|
8
|
+
"detectPopup": [{ "visible": "#consent-page" }],
|
|
9
|
+
"optIn": [
|
|
10
|
+
{ "waitForThenClick": "#consent-page button[value=agree]" }
|
|
11
|
+
],
|
|
12
|
+
"optOut": [
|
|
13
|
+
{ "waitForThenClick": "#consent-page button[value=reject]" }
|
|
14
|
+
]
|
|
15
|
+
}
|
package/rules/rules.json
CHANGED
|
@@ -1496,6 +1496,74 @@
|
|
|
1496
1496
|
}
|
|
1497
1497
|
]
|
|
1498
1498
|
},
|
|
1499
|
+
{
|
|
1500
|
+
"name": "cookieyes",
|
|
1501
|
+
"prehideSelectors": [
|
|
1502
|
+
".cky-overlay,.cky-consent-container"
|
|
1503
|
+
],
|
|
1504
|
+
"detectCmp": [
|
|
1505
|
+
{
|
|
1506
|
+
"exists": ".cky-consent-container"
|
|
1507
|
+
}
|
|
1508
|
+
],
|
|
1509
|
+
"detectPopup": [
|
|
1510
|
+
{
|
|
1511
|
+
"visible": ".cky-consent-container"
|
|
1512
|
+
}
|
|
1513
|
+
],
|
|
1514
|
+
"optIn": [
|
|
1515
|
+
{
|
|
1516
|
+
"waitForThenClick": ".cky-consent-container [data-cky-tag=accept-button]"
|
|
1517
|
+
}
|
|
1518
|
+
],
|
|
1519
|
+
"optOut": [
|
|
1520
|
+
{
|
|
1521
|
+
"if": {
|
|
1522
|
+
"exists": ".cky-consent-container [data-cky-tag=reject-button]"
|
|
1523
|
+
},
|
|
1524
|
+
"then": [
|
|
1525
|
+
{
|
|
1526
|
+
"waitForThenClick": ".cky-consent-container [data-cky-tag=reject-button]"
|
|
1527
|
+
}
|
|
1528
|
+
],
|
|
1529
|
+
"else": [
|
|
1530
|
+
{
|
|
1531
|
+
"if": {
|
|
1532
|
+
"exists": ".cky-consent-container [data-cky-tag=settings-button]"
|
|
1533
|
+
},
|
|
1534
|
+
"then": [
|
|
1535
|
+
{
|
|
1536
|
+
"click": ".cky-consent-container [data-cky-tag=settings-button]"
|
|
1537
|
+
},
|
|
1538
|
+
{
|
|
1539
|
+
"waitFor": ".cky-modal-open input[type=checkbox]"
|
|
1540
|
+
},
|
|
1541
|
+
{
|
|
1542
|
+
"click": ".cky-modal-open input[type=checkbox]:checked",
|
|
1543
|
+
"all": true,
|
|
1544
|
+
"optional": true
|
|
1545
|
+
},
|
|
1546
|
+
{
|
|
1547
|
+
"waitForThenClick": ".cky-modal [data-cky-tag=detail-save-button]"
|
|
1548
|
+
}
|
|
1549
|
+
],
|
|
1550
|
+
"else": [
|
|
1551
|
+
{
|
|
1552
|
+
"hide": [
|
|
1553
|
+
".cky-consent-container,.cky-overlay"
|
|
1554
|
+
]
|
|
1555
|
+
}
|
|
1556
|
+
]
|
|
1557
|
+
}
|
|
1558
|
+
]
|
|
1559
|
+
}
|
|
1560
|
+
],
|
|
1561
|
+
"test": [
|
|
1562
|
+
{
|
|
1563
|
+
"eval": "EVAL_COOKIEYES_0"
|
|
1564
|
+
}
|
|
1565
|
+
]
|
|
1566
|
+
},
|
|
1499
1567
|
{
|
|
1500
1568
|
"name": "corona-in-zahlen.de",
|
|
1501
1569
|
"prehideSelectors": [
|
|
@@ -5193,6 +5261,35 @@
|
|
|
5193
5261
|
}
|
|
5194
5262
|
]
|
|
5195
5263
|
},
|
|
5264
|
+
{
|
|
5265
|
+
"name": "Yahoo",
|
|
5266
|
+
"runContext": {
|
|
5267
|
+
"urlPattern": "^https://consent\\.yahoo\\.com/v2/"
|
|
5268
|
+
},
|
|
5269
|
+
"prehideSelectors": [
|
|
5270
|
+
"#reject-all"
|
|
5271
|
+
],
|
|
5272
|
+
"detectCmp": [
|
|
5273
|
+
{
|
|
5274
|
+
"exists": "#consent-page"
|
|
5275
|
+
}
|
|
5276
|
+
],
|
|
5277
|
+
"detectPopup": [
|
|
5278
|
+
{
|
|
5279
|
+
"visible": "#consent-page"
|
|
5280
|
+
}
|
|
5281
|
+
],
|
|
5282
|
+
"optIn": [
|
|
5283
|
+
{
|
|
5284
|
+
"waitForThenClick": "#consent-page button[value=agree]"
|
|
5285
|
+
}
|
|
5286
|
+
],
|
|
5287
|
+
"optOut": [
|
|
5288
|
+
{
|
|
5289
|
+
"waitForThenClick": "#consent-page button[value=reject]"
|
|
5290
|
+
}
|
|
5291
|
+
]
|
|
5292
|
+
},
|
|
5196
5293
|
{
|
|
5197
5294
|
"name": "youporn.com",
|
|
5198
5295
|
"cosmetic": true,
|
package/tests/cookiebot.spec.ts
CHANGED
|
@@ -10,3 +10,14 @@ generateCMPTests('Cybotcookiebot', [
|
|
|
10
10
|
], {
|
|
11
11
|
skipRegions: ['US']
|
|
12
12
|
});
|
|
13
|
+
|
|
14
|
+
generateCMPTests('Cybotcookiebot', [
|
|
15
|
+
"https://dl.acm.org/",
|
|
16
|
+
"https://www.ifm.org/",
|
|
17
|
+
"https://www.thule.com/",
|
|
18
|
+
"https://www.dezeen.com/",
|
|
19
|
+
"https://www.l3harris.com/",
|
|
20
|
+
"https://www.gog.com/"
|
|
21
|
+
], {
|
|
22
|
+
});
|
|
23
|
+
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import generateCMPTests from "../playwright/runner";
|
|
2
|
+
|
|
3
|
+
generateCMPTests('cookieyes', [
|
|
4
|
+
'https://www.cookieyes.com/',
|
|
5
|
+
'https://www.primefaces.org/',
|
|
6
|
+
'https://www.undip.ac.id/',
|
|
7
|
+
'https://ttinteractive.com/',
|
|
8
|
+
'https://www.chronofhorse.com/',
|
|
9
|
+
'https://nl.flaminfitness.com/products/30l-tactical-backpack'
|
|
10
|
+
]);
|