@duckduckgo/autoconsent 14.74.0 → 14.76.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.
Files changed (35) hide show
  1. package/CHANGELOG.md +40 -0
  2. package/dist/addon-firefox/background.bundle.js +5 -3
  3. package/dist/addon-firefox/compact-rules.json +1 -1
  4. package/dist/addon-firefox/content.bundle.js +25 -12
  5. package/dist/addon-firefox/manifest.json +1 -1
  6. package/dist/addon-firefox/rules.json +1 -1
  7. package/dist/addon-mv3/background.bundle.js +5 -3
  8. package/dist/addon-mv3/compact-rules.json +1 -1
  9. package/dist/addon-mv3/content.bundle.js +25 -12
  10. package/dist/addon-mv3/manifest.json +1 -1
  11. package/dist/addon-mv3/rules.json +1 -1
  12. package/dist/autoconsent.cjs.js +25 -12
  13. package/dist/autoconsent.esm.js +25 -12
  14. package/dist/autoconsent.extra.cjs.js +317 -230
  15. package/dist/autoconsent.extra.esm.js +317 -230
  16. package/dist/autoconsent.playwright.js +25 -12
  17. package/lib/cmps/onetrust.ts +25 -4
  18. package/lib/cmps/trustarc-frame.ts +1 -6
  19. package/lib/eval-snippets.ts +8 -3
  20. package/lib/filterlist-engine.ts +2 -2
  21. package/lib/heuristic-patterns.ts +2 -2
  22. package/package.json +1 -1
  23. package/rules/autoconsent/cookieconsent2.json +2 -2
  24. package/rules/autoconsent/cookieconsent3.json +14 -1
  25. package/rules/autoconsent/didomi.json +2 -2
  26. package/rules/compact-rules.json +1 -1
  27. package/rules/filterlist.txt +198 -180
  28. package/rules/rules.json +1 -1
  29. package/tests/cookieconsent3.spec.ts +1 -1
  30. package/tests/didomi.spec.ts +11 -0
  31. package/tests/onetrust.spec.ts +21 -0
  32. package/tests/trustarc.spec.ts +1 -1
  33. package/tests-wtr/heuristics/heuristics-utils.test.ts +9 -0
  34. package/tests-wtr/lifecycle/find-cmp.html +1 -0
  35. package/tests-wtr/lifecycle/find-cmp.ts +7 -0
@@ -460,10 +460,12 @@
460
460
  return false;
461
461
  },
462
462
  EVAL_DIDOMI_TEST: () => {
463
- if (window.Didomi) {
464
- return window.Didomi.getUserConsentStatusForAll().purposes.disabled.length > 0;
463
+ const purposes = window.Didomi?.getCurrentUserStatus?.()?.purposes;
464
+ if (purposes) {
465
+ return Object.values(purposes).some((p) => !p.enabled);
465
466
  }
466
- return false;
467
+ const disabled = window.Didomi?.getUserConsentStatusForAll?.()?.purposes?.disabled;
468
+ return Array.isArray(disabled) && disabled.length > 0;
467
469
  },
468
470
  EVAL_CONSENTMANAGER_1: () => window.__cmp && typeof __cmp("getCMPData") === "object",
469
471
  EVAL_CONSENTMANAGER_2: () => !__cmp("consentStatus").userChoiceExists,
@@ -853,9 +855,9 @@
853
855
  /wijs alles af/gi
854
856
  ];
855
857
  var REJECT_PATTERNS_ENGLISH = [
856
- // e.g. "i reject cookies", "reject all", "reject all cookies", "reject cookies", "deny all", "deny all cookies", "refuse", "refuse all", "refuse cookies", "refuse all cookies", "deny", "reject all and close", "deny all and close", "reject non-essential cookies", "reject all non-essential cookies and continue", "reject optional cookies", "reject additional cookies", "reject targeting cookies", "reject marketing cookies", "reject analytics cookies", "reject tracking cookies", "reject advertising cookies", "reject all and close", "deny all and close"
858
+ // e.g. "i reject cookies", "reject all", "reject all cookies", "reject cookies", "deny all", "deny all cookies", "refuse", "refuse all", "refuse cookies", "refuse all cookies", "deny", "reject all and close", "deny all and close", "reject non-essential cookies", "reject all non-essential cookies and continue", "reject optional cookies", "reject additional cookies", "reject targeting cookies", "reject marketing cookies", "reject analytics cookies", "reject tracking cookies", "reject advertising cookies", "reject all and close", "deny all and close", "i reject all (except strictly necessary)"
857
859
  // note that "reject and subscribe" and "reject and pay" are excluded
858
- /^\s*(i)?\s*(reject|deny|refuse|decline|disable)\s*(all)?\s*(non-essential|optional|additional|targeting|analytics|marketing|unrequired|non-necessary|extra|tracking|advertising)?\s*(cookies)?\s*$/is,
860
+ /^\s*(i)?\s*(reject|deny|refuse|decline|disable)\s*(all)?\s*(non-essential|optional|additional|targeting|analytics|marketing|unrequired|non-necessary|extra|tracking|advertising)?\s*(cookies)?\s*(\(?\s*except\s+(strictly\s+)?(necessary|essential)\s*\)?)?\s*$/is,
859
861
  // e.g. "i do not accept", "i do not accept cookies", "do not accept", "do not accept cookies"
860
862
  /^\s*(i)?\s*do\s+not\s+accept\s*(cookies)?\s*$/is,
861
863
  // e.g. "continue without accepting", "continue without agreeing", "continue without agreeing →"
@@ -2203,16 +2205,13 @@
2203
2205
  return await waitFor(() => this.elementVisible(".switch span:first-child", "any"), 5, 1e3);
2204
2206
  }
2205
2207
  async optOut() {
2206
- if (await this.mainWorldEval("EVAL_TRUSTARC_FRAME_TEST")) {
2207
- return true;
2208
- }
2209
2208
  let timeout = 3e3;
2210
2209
  if (await this.mainWorldEval("EVAL_TRUSTARC_FRAME_GTM")) {
2211
2210
  timeout = 1500;
2212
2211
  }
2213
2212
  await waitFor(() => document.readyState === "complete", 20, 100);
2214
2213
  await this.waitForElement(".mainContent[aria-hidden=false]", timeout);
2215
- if (await this.click(".rejectAll")) {
2214
+ if (await this.click(".rejectAll,.declineAllButtonLower", true)) {
2216
2215
  return true;
2217
2216
  }
2218
2217
  if (this.elementExists(".prefPanel")) {
@@ -2558,14 +2557,21 @@
2558
2557
  return false;
2559
2558
  }
2560
2559
  async detectCmp() {
2561
- return this.elementExists("#onetrust-banner-sdk,#onetrust-pc-sdk");
2560
+ return this.elementExists("#onetrust-banner-sdk") || this.elementVisible("#onetrust-pc-sdk", "any");
2562
2561
  }
2563
2562
  async detectPopup() {
2564
2563
  return this.elementVisible("#onetrust-banner-sdk,#onetrust-pc-sdk", "any");
2565
2564
  }
2566
2565
  async optOut() {
2567
- if (this.elementVisible("#onetrust-reject-all-handler,.ot-pc-refuse-all-handler,.js-reject-cookies", "any")) {
2568
- return await this.click("#onetrust-reject-all-handler,.ot-pc-refuse-all-handler,.js-reject-cookies");
2566
+ await this.wait(500);
2567
+ if (this.elementVisible("#onetrust-reject-all-handler", "any")) {
2568
+ return await this.click("#onetrust-reject-all-handler");
2569
+ }
2570
+ if (this.elementVisible(".ot-pc-refuse-all-handler", "any")) {
2571
+ return await this.click(".ot-pc-refuse-all-handler");
2572
+ }
2573
+ if (this.elementVisible(".js-reject-cookies", "any")) {
2574
+ return await this.click(".js-reject-cookies");
2569
2575
  }
2570
2576
  if (this.elementVisible(".onetrust-close-btn-handler", "any")) {
2571
2577
  const closeBtn = document.querySelector(".onetrust-close-btn-handler");
@@ -2574,6 +2580,13 @@
2574
2580
  if (rejectPatterns.some((pattern) => btnText.includes(pattern))) {
2575
2581
  return await this.click(".onetrust-close-btn-handler");
2576
2582
  }
2583
+ const banner = document.getElementById("onetrust-banner-sdk");
2584
+ const isCloseOnlyNotice = banner?.classList.contains("ot-close-btn-link") && !this.elementExists(
2585
+ "#onetrust-accept-btn-handler,#onetrust-reject-all-handler,#onetrust-pc-btn-handler,.ot-sdk-show-settings,button.js-cookie-settings"
2586
+ );
2587
+ if (isCloseOnlyNotice) {
2588
+ return await this.click(".onetrust-close-btn-handler");
2589
+ }
2577
2590
  }
2578
2591
  if (this.elementExists("#onetrust-pc-btn-handler")) {
2579
2592
  await this.click("#onetrust-pc-btn-handler");
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "manifest_version": 3,
3
3
  "name": "Autoconsent",
4
- "version": "2026.4.18",
4
+ "version": "2026.4.23",
5
5
  "background": {
6
6
  "service_worker": "background.bundle.js"
7
7
  },