@duckduckgo/autoconsent 10.6.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/CHANGELOG.md +12 -0
- package/dist/addon-firefox/background.bundle.js +16 -0
- package/dist/addon-firefox/content.bundle.js +21 -5
- package/dist/addon-firefox/manifest.json +1 -1
- package/dist/addon-mv3/background.bundle.js +16 -0
- package/dist/addon-mv3/content.bundle.js +21 -5
- package/dist/addon-mv3/manifest.json +1 -1
- package/dist/autoconsent.cjs.js +21 -5
- package/dist/autoconsent.esm.js +21 -5
- package/dist/autoconsent.playwright.js +1 -1
- package/dist/autoconsent.unit.js +21 -5
- package/lib/cmps/klaro.ts +8 -5
- package/lib/eval-snippets.ts +17 -0
- package/package.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
|
|
@@ -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
|
}
|
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
|
|