@duckduckgo/autoconsent 10.5.0 → 10.6.1
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/.github/workflows/ddg-release.yml +84 -26
- package/CHANGELOG.md +36 -0
- package/ci/asana-create-tasks.js +1 -3
- package/ci/create-pr-template.js +1 -1
- package/data/coverage.json +1107 -1027
- package/dist/addon-firefox/background.bundle.js +17 -1
- package/dist/addon-firefox/content.bundle.js +22 -6
- package/dist/addon-firefox/manifest.json +1 -1
- package/dist/addon-firefox/rules.json +1 -1
- package/dist/addon-mv3/background.bundle.js +17 -1
- package/dist/addon-mv3/content.bundle.js +22 -6
- package/dist/addon-mv3/manifest.json +1 -1
- package/dist/addon-mv3/rules.json +1 -1
- package/dist/autoconsent.cjs.js +22 -6
- package/dist/autoconsent.esm.js +22 -6
- package/dist/autoconsent.playwright.js +1 -1
- package/dist/autoconsent.unit.js +23 -7
- package/lib/cmps/klaro.ts +8 -5
- package/lib/eval-snippets.ts +18 -1
- package/package.json +1 -1
- package/rules/autoconsent/tarteaucitron.json +1 -1
- package/rules/rules.json +1 -1
package/dist/autoconsent.unit.js
CHANGED
|
@@ -480,6 +480,22 @@
|
|
|
480
480
|
return Object.keys(consents).filter((k) => optionalServices.includes(k)).every((k) => consents[k] === false);
|
|
481
481
|
}
|
|
482
482
|
},
|
|
483
|
+
EVAL_KLARO_OPEN_POPUP: () => {
|
|
484
|
+
klaro.show(void 0, true);
|
|
485
|
+
},
|
|
486
|
+
EVAL_KLARO_TRY_API_OPT_OUT: () => {
|
|
487
|
+
if (window.klaro && typeof klaro.show === "function" && typeof klaro.getManager === "function") {
|
|
488
|
+
try {
|
|
489
|
+
klaro.getManager().changeAll(false);
|
|
490
|
+
klaro.getManager().saveAndApplyConsents();
|
|
491
|
+
return true;
|
|
492
|
+
} catch (e) {
|
|
493
|
+
console.warn(e);
|
|
494
|
+
return false;
|
|
495
|
+
}
|
|
496
|
+
}
|
|
497
|
+
return false;
|
|
498
|
+
},
|
|
483
499
|
EVAL_ONETRUST_1: () => window.OnetrustActiveGroups.split(",").filter((s) => s.length > 0).length <= 1,
|
|
484
500
|
EVAL_TRUSTARC_TOP: () => window && window.truste && window.truste.eu.bindMap.prefCookie === "0",
|
|
485
501
|
// declarative rules
|
|
@@ -563,7 +579,7 @@
|
|
|
563
579
|
EVAL_TAKEALOT_0: () => document.body.classList.remove("freeze") || (document.body.style = "") || true,
|
|
564
580
|
EVAL_TARTEAUCITRON_0: () => tarteaucitron.userInterface.respondAll(false) || true,
|
|
565
581
|
EVAL_TARTEAUCITRON_1: () => tarteaucitron.userInterface.respondAll(true) || true,
|
|
566
|
-
EVAL_TARTEAUCITRON_2: () => document.cookie.match(/tarteaucitron=[^;]*/)[0].includes("false"),
|
|
582
|
+
EVAL_TARTEAUCITRON_2: () => document.cookie.match(/tarteaucitron=[^;]*/)?.[0].includes("false"),
|
|
567
583
|
EVAL_TAUNTON_TEST: () => document.cookie.includes("taunton_user_consent_submitted=true"),
|
|
568
584
|
EVAL_TEALIUM_0: () => typeof window.utag !== "undefined" && typeof utag.gdpr === "object",
|
|
569
585
|
EVAL_TEALIUM_1: () => utag.gdpr.setConsentValue(false) || true,
|
|
@@ -1504,14 +1520,14 @@
|
|
|
1504
1520
|
return this.elementVisible(".klaro > .cookie-notice,.klaro > .cookie-modal", "any");
|
|
1505
1521
|
}
|
|
1506
1522
|
async optOut() {
|
|
1507
|
-
|
|
1523
|
+
const apiOptOutSuccess = await this.mainWorldEval("EVAL_KLARO_TRY_API_OPT_OUT");
|
|
1524
|
+
if (apiOptOutSuccess) {
|
|
1508
1525
|
return true;
|
|
1509
1526
|
}
|
|
1510
|
-
if (
|
|
1511
|
-
|
|
1512
|
-
await this.waitForElement(".klaro > .cookie-modal", 2e3);
|
|
1513
|
-
this.settingsOpen = true;
|
|
1527
|
+
if (this.click(".klaro .cn-decline")) {
|
|
1528
|
+
return true;
|
|
1514
1529
|
}
|
|
1530
|
+
await this.mainWorldEval("EVAL_KLARO_OPEN_POPUP");
|
|
1515
1531
|
if (this.click(".klaro .cn-decline")) {
|
|
1516
1532
|
return true;
|
|
1517
1533
|
}
|
|
@@ -7909,7 +7925,7 @@
|
|
|
7909
7925
|
],
|
|
7910
7926
|
detectPopup: [
|
|
7911
7927
|
{
|
|
7912
|
-
visible: "#tarteaucitronRoot #
|
|
7928
|
+
visible: "#tarteaucitronRoot #tarteaucitronAlertBig",
|
|
7913
7929
|
check: "any"
|
|
7914
7930
|
}
|
|
7915
7931
|
],
|
package/lib/cmps/klaro.ts
CHANGED
|
@@ -30,15 +30,18 @@ export default class Klaro extends AutoConsentCMPBase {
|
|
|
30
30
|
}
|
|
31
31
|
|
|
32
32
|
async optOut() {
|
|
33
|
+
const apiOptOutSuccess = await this.mainWorldEval("EVAL_KLARO_TRY_API_OPT_OUT")
|
|
34
|
+
if (apiOptOutSuccess) {
|
|
35
|
+
return true
|
|
36
|
+
}
|
|
37
|
+
// if the API is broken for some reason, try clicking instead
|
|
38
|
+
|
|
33
39
|
if (this.click('.klaro .cn-decline')) {
|
|
34
40
|
return true;
|
|
35
41
|
}
|
|
36
42
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
await this.waitForElement('.klaro > .cookie-modal', 2000);
|
|
40
|
-
this.settingsOpen = true;
|
|
41
|
-
}
|
|
43
|
+
// open popup via Javascript API
|
|
44
|
+
await this.mainWorldEval("EVAL_KLARO_OPEN_POPUP")
|
|
42
45
|
|
|
43
46
|
if (this.click('.klaro .cn-decline')) {
|
|
44
47
|
return true;
|
package/lib/eval-snippets.ts
CHANGED
|
@@ -30,6 +30,23 @@ export const snippets = {
|
|
|
30
30
|
return Object.keys(consents).filter(k => optionalServices.includes(k)).every(k => consents[k] === false)
|
|
31
31
|
}
|
|
32
32
|
},
|
|
33
|
+
EVAL_KLARO_OPEN_POPUP: () => {
|
|
34
|
+
klaro.show(undefined, true)
|
|
35
|
+
},
|
|
36
|
+
EVAL_KLARO_TRY_API_OPT_OUT: () => {
|
|
37
|
+
if (window.klaro && typeof klaro.show === 'function' && typeof klaro.getManager === 'function') {
|
|
38
|
+
try {
|
|
39
|
+
// opt-out directly via API
|
|
40
|
+
klaro.getManager().changeAll(false)
|
|
41
|
+
klaro.getManager().saveAndApplyConsents()
|
|
42
|
+
return true
|
|
43
|
+
} catch (e) {
|
|
44
|
+
console.warn(e)
|
|
45
|
+
return false
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
return false
|
|
49
|
+
},
|
|
33
50
|
EVAL_ONETRUST_1: () => window.OnetrustActiveGroups.split(',').filter(s => s.length > 0).length <= 1,
|
|
34
51
|
EVAL_TRUSTARC_TOP: () => window && window.truste && window.truste.eu.bindMap.prefCookie === '0',
|
|
35
52
|
|
|
@@ -105,7 +122,7 @@ export const snippets = {
|
|
|
105
122
|
EVAL_TAKEALOT_0: () => document.body.classList.remove('freeze') || (document.body.style = '') || true,
|
|
106
123
|
EVAL_TARTEAUCITRON_0: () => tarteaucitron.userInterface.respondAll(false) || true,
|
|
107
124
|
EVAL_TARTEAUCITRON_1: () => tarteaucitron.userInterface.respondAll(true) || true,
|
|
108
|
-
EVAL_TARTEAUCITRON_2: () => document.cookie.match(/tarteaucitron=[^;]*/)[0].includes('false'),
|
|
125
|
+
EVAL_TARTEAUCITRON_2: () => document.cookie.match(/tarteaucitron=[^;]*/)?.[0].includes('false'),
|
|
109
126
|
EVAL_TAUNTON_TEST: () => document.cookie.includes('taunton_user_consent_submitted=true'),
|
|
110
127
|
EVAL_TEALIUM_0: () => typeof window.utag !== 'undefined' && typeof utag.gdpr === 'object',
|
|
111
128
|
EVAL_TEALIUM_1: () => utag.gdpr.setConsentValue(false) || true,
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"prehideSelectors": ["#tarteaucitronRoot"],
|
|
4
4
|
"detectCmp": [{ "exists": "#tarteaucitronRoot" }],
|
|
5
5
|
"detectPopup": [{
|
|
6
|
-
"visible": "#tarteaucitronRoot #
|
|
6
|
+
"visible": "#tarteaucitronRoot #tarteaucitronAlertBig",
|
|
7
7
|
"check": "any"
|
|
8
8
|
}],
|
|
9
9
|
"optIn": [
|
package/rules/rules.json
CHANGED