@duckduckgo/autoconsent 18.0.0 → 18.1.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 (42) hide show
  1. package/.github/workflows/ddg-release.yml +6 -3
  2. package/CHANGELOG.md +23 -0
  3. package/dist/addon-firefox/background.bundle.js +2 -1
  4. package/dist/addon-firefox/compact-rules.json +1 -1
  5. package/dist/addon-firefox/content.bundle.js +6 -8
  6. package/dist/addon-firefox/manifest.json +1 -1
  7. package/dist/addon-firefox/rule-index.json +1 -1
  8. package/dist/addon-firefox/rules.json +1 -1
  9. package/dist/addon-mv3/background.bundle.js +2 -1
  10. package/dist/addon-mv3/compact-rules.json +1 -1
  11. package/dist/addon-mv3/content.bundle.js +6 -8
  12. package/dist/addon-mv3/manifest.json +1 -1
  13. package/dist/addon-mv3/rule-index.json +1 -1
  14. package/dist/addon-mv3/rules.json +1 -1
  15. package/dist/autoconsent.cjs.js +6 -8
  16. package/dist/autoconsent.esm.js +6 -8
  17. package/dist/autoconsent.playwright.js +6 -8
  18. package/dist/autoconsent.standalone.js +7 -9
  19. package/dist/types/cmps/tiktok.d.ts +0 -2
  20. package/dist/types/eval-snippets.d.ts +1 -0
  21. package/lib/cmps/evidon.ts +5 -4
  22. package/lib/cmps/tiktok.ts +0 -5
  23. package/lib/eval-snippets.ts +1 -0
  24. package/package.json +1 -1
  25. package/rules/autoconsent/hmgroup-turbocookie.json +18 -0
  26. package/rules/autoconsent/hmrc-tracking-consent.json +40 -0
  27. package/rules/autoconsent/meta-cookie-dialog-v2.json +40 -0
  28. package/rules/autoconsent/reverb-gdpr-nag.json +18 -0
  29. package/rules/autoconsent/reverb.json +24 -0
  30. package/rules/autoconsent/zoho.json +23 -0
  31. package/rules/compact-rules.json +1 -1
  32. package/rules/rule-index.json +1 -1
  33. package/rules/rules.json +1 -1
  34. package/tests/evidon.spec.ts +2 -1
  35. package/tests/hmgroup-turbocookie.spec.ts +7 -0
  36. package/tests/hmrc-tracking-consent.spec.ts +7 -0
  37. package/tests/meta-cookie-dialog-v2.spec.ts +10 -0
  38. package/tests/reverb.spec.ts +7 -0
  39. package/tests/tiktok.spec.ts +2 -2
  40. package/tests/zoho.spec.ts +5 -0
  41. package/rules/generated/auto_GB_capcut.com_0.json +0 -28
  42. package/tests/generated/auto_GB_capcut.com_0.spec.ts +0 -2
@@ -1,8 +1,6 @@
1
- import { RunContext } from '../rules';
2
1
  import AutoConsentCMPBase from './base';
3
2
  export default class Tiktok extends AutoConsentCMPBase {
4
3
  name: string;
5
- runContext: RunContext;
6
4
  get hasSelfTest(): boolean;
7
5
  get isIntermediate(): boolean;
8
6
  get isCosmetic(): boolean;
@@ -94,5 +94,6 @@ export declare const snippets: {
94
94
  EVAL_USERCENTRICS_BUTTON_0: () => any;
95
95
  EVAL_WAITROSE_0: () => boolean;
96
96
  EVAL_WBD_LTP_CLOSE: () => any;
97
+ EVAL_ZOHO_TEST: () => boolean;
97
98
  };
98
99
  export declare function getFunctionBody(snippetFunc: () => any): string;
@@ -17,15 +17,16 @@ export default class Evidon extends AutoConsentCMPBase {
17
17
  }
18
18
 
19
19
  async detectCmp() {
20
- return this.elementExists('#_evidon_banner');
20
+ return this.elementExists('#_evidon_banner, #_evidon-barrier-wrapper');
21
21
  }
22
22
 
23
23
  async detectPopup() {
24
- return this.elementVisible('#_evidon_banner', 'any');
24
+ return this.elementVisible('#_evidon_banner, #_evidon-barrier-wrapper #_evidon-banner', 'any');
25
25
  }
26
26
 
27
27
  async optOut() {
28
- if (await this.click('#_evidon-decline-button')) {
28
+ // some sites put a custom reject link into the banner text instead of a decline button
29
+ if (await this.click('#_evidon-decline-button, #_evidon-barrier-declinebutton, #_evidon_banner #RejectLink')) {
29
30
  return true;
30
31
  }
31
32
 
@@ -40,6 +41,6 @@ export default class Evidon extends AutoConsentCMPBase {
40
41
  }
41
42
 
42
43
  async optIn() {
43
- return await this.click('#_evidon-accept-button');
44
+ return await this.click('#_evidon-accept-button, #_evidon-banner-acceptbutton');
44
45
  }
45
46
  }
@@ -1,14 +1,9 @@
1
- import { RunContext } from '../rules';
2
1
  import { isElementVisible } from '../utils';
3
2
  import AutoConsentCMPBase from './base';
4
3
 
5
4
  export default class Tiktok extends AutoConsentCMPBase {
6
5
  name = 'tiktok.com';
7
6
 
8
- runContext: RunContext = {
9
- urlPattern: 'tiktok',
10
- };
11
-
12
7
  get hasSelfTest(): boolean {
13
8
  return true;
14
9
  }
@@ -298,6 +298,7 @@ export const snippets = {
298
298
  JSON.parse(localStorage.getItem('usercentrics')).consents.every((c) => c.isEssential || !c.consentStatus),
299
299
  EVAL_WAITROSE_0: () => Array.from(document.querySelectorAll('label[id$=cookies-deny-label]')).forEach((e) => e.click()) || true,
300
300
  EVAL_WBD_LTP_CLOSE: () => document.querySelector('dialog#ltp-dialog').close() || true,
301
+ EVAL_ZOHO_TEST: () => localStorage.getItem('zglobal_Acookie_optOut') === '3',
301
302
  };
302
303
 
303
304
  export function getFunctionBody(snippetFunc: () => any) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@duckduckgo/autoconsent",
3
- "version": "18.0.0",
3
+ "version": "18.1.0",
4
4
  "description": "",
5
5
  "types": "./dist/types/web.d.ts",
6
6
  "exports": {
@@ -0,0 +1,18 @@
1
+ {
2
+ "name": "hmgroup-turbocookie",
3
+ "prehideSelectors": [".cookie-consent-popup"],
4
+ "detectCmp": [{ "exists": ".cookie-consent-popup #banner-accept-btn" }],
5
+ "detectPopup": [{ "visible": ".cookie-consent-popup" }],
6
+ "optIn": [{ "waitForThenClick": ".cookie-consent-popup #banner-accept-btn" }],
7
+ "optOut": [
8
+ {
9
+ "if": { "exists": ".cookie-consent-popup #banner-reject-btn" },
10
+ "then": [{ "waitForThenClick": ".cookie-consent-popup #banner-reject-btn" }],
11
+ "else": [
12
+ { "waitForThenClick": ".cookie-consent-popup #banner-cookie-setting-btn" },
13
+ { "waitForThenClick": ".settings-page #settings-only-required-btn" }
14
+ ]
15
+ }
16
+ ],
17
+ "test": [{ "wait": 500 }, { "cookieContains": "groups=C0001:1,C0002:0,C0003:0,C0004:0" }]
18
+ }
@@ -0,0 +1,40 @@
1
+ {
2
+ "name": "hmrc-tracking-consent",
3
+ "prehideSelectors": [".cbanner-govuk-cookie-banner"],
4
+ "detectCmp": [
5
+ {
6
+ "exists": ".cbanner-govuk-cookie-banner button[value=reject]"
7
+ }
8
+ ],
9
+ "detectPopup": [
10
+ {
11
+ "visible": ".cbanner-govuk-cookie-banner button[value=reject]"
12
+ }
13
+ ],
14
+ "optIn": [
15
+ {
16
+ "waitForThenClick": ".cbanner-govuk-cookie-banner button[value=accept]"
17
+ },
18
+ {
19
+ "waitForThenClick": ".cbanner-govuk-cookie-banner button:not([value])",
20
+ "timeout": 3000,
21
+ "optional": true
22
+ }
23
+ ],
24
+ "optOut": [
25
+ {
26
+ "waitForThenClick": ".cbanner-govuk-cookie-banner button[value=reject]"
27
+ },
28
+ {
29
+ "comment": "a confirmation message with a hide button replaces the banner after the choice",
30
+ "waitForThenClick": ".cbanner-govuk-cookie-banner button:not([value])",
31
+ "timeout": 3000,
32
+ "optional": true
33
+ }
34
+ ],
35
+ "test": [
36
+ {
37
+ "cookieContains": "%22measurement%22:false"
38
+ }
39
+ ]
40
+ }
@@ -0,0 +1,40 @@
1
+ {
2
+ "name": "meta-cookie-dialog-v2",
3
+ "vendorUrl": "https://www.meta.com/",
4
+ "runContext": {
5
+ "urlPattern": "^https?://(\\w+\\.)?meta\\.com/"
6
+ },
7
+ "prehideSelectors": [],
8
+ "detectCmp": [
9
+ {
10
+ "exists": "xpath///div[@role='dialog' and @aria-modal='true']//div[following-sibling::div[@aria-hidden='true'][.//div[@role='button' and @aria-disabled='true']]]/div[@role='button' and @tabindex='0']"
11
+ }
12
+ ],
13
+ "detectPopup": [
14
+ {
15
+ "visible": "xpath///div[@role='dialog' and @aria-modal='true']//div[following-sibling::div[@aria-hidden='true'][.//div[@role='button' and @aria-disabled='true']]]/div[@role='button' and @tabindex='0']"
16
+ }
17
+ ],
18
+ "optIn": [
19
+ {
20
+ "waitForThenClick": "xpath///div[@role='dialog' and @aria-modal='true']//div[preceding-sibling::div[@aria-hidden='true'][.//div[@role='button' and @aria-disabled='true']]]/div[@role='button' and @tabindex='0']",
21
+ "retry": 20,
22
+ "retryInterval": 500
23
+ },
24
+ {
25
+ "waitForVisible": "xpath///div[@role='dialog' and @aria-modal='true']//div[preceding-sibling::div[@aria-hidden='true'][.//div[@role='button' and @aria-disabled='true']]]/div[@role='button' and @tabindex='0']",
26
+ "check": "none"
27
+ }
28
+ ],
29
+ "optOut": [
30
+ {
31
+ "waitForThenClick": "xpath///div[@role='dialog' and @aria-modal='true']//div[following-sibling::div[@aria-hidden='true'][.//div[@role='button' and @aria-disabled='true']]]/div[@role='button' and @tabindex='0']",
32
+ "retry": 20,
33
+ "retryInterval": 500
34
+ },
35
+ {
36
+ "waitForVisible": "xpath///div[@role='dialog' and @aria-modal='true']//div[following-sibling::div[@aria-hidden='true'][.//div[@role='button' and @aria-disabled='true']]]/div[@role='button' and @tabindex='0']",
37
+ "check": "none"
38
+ }
39
+ ]
40
+ }
@@ -0,0 +1,18 @@
1
+ {
2
+ "name": "reverb-gdpr-nag",
3
+ "vendorUrl": "https://reverb.com/",
4
+ "runContext": {
5
+ "urlPattern": "^https?://(www\\.)?reverb\\.com/"
6
+ },
7
+ "prehideSelectors": [],
8
+ "detectCmp": [
9
+ {
10
+ "comment": "only once a choice is stored in the main notice, which also reloads the page",
11
+ "cookieContains": "privacy_settings="
12
+ },
13
+ { "exists": ".gdpr-alert .gdpr-alert__close" }
14
+ ],
15
+ "detectPopup": [{ "visible": ".gdpr-alert .gdpr-alert__overview" }],
16
+ "optIn": [{ "waitForThenClick": ".gdpr-alert .gdpr-alert__close", "retry": 5, "retryInterval": 500 }],
17
+ "optOut": [{ "waitForThenClick": ".gdpr-alert .gdpr-alert__close", "retry": 5, "retryInterval": 500 }]
18
+ }
@@ -0,0 +1,24 @@
1
+ {
2
+ "name": "reverb",
3
+ "vendorUrl": "https://reverb.com/",
4
+ "runContext": {
5
+ "urlPattern": "^https?://(www\\.)?reverb\\.com/"
6
+ },
7
+ "prehideSelectors": [".rc-notice:has(a[href$='/cookies-policy'])"],
8
+ "detectCmp": [{ "exists": ".rc-notice a[href$='/cookies-policy']" }],
9
+ "detectPopup": [{ "visible": ".rc-notice a[href$='/cookies-policy']" }],
10
+ "optIn": [{ "waitForThenClick": ".rc-notice:has(a[href$='/cookies-policy']) .rc-notice__actions button[data-slot=primary]" }],
11
+ "optOut": [
12
+ {
13
+ "if": { "exists": ".rc-notice:has(a[href$='/cookies-policy']) .rc-notice__actions button[data-slot=secondary]" },
14
+ "then": [{ "waitForThenClick": ".rc-notice:has(a[href$='/cookies-policy']) .rc-notice__actions button[data-slot=secondary]" }],
15
+ "else": [
16
+ { "waitForThenClick": ".rc-notice:has(a[href$='/cookies-policy']) .rc-notice__description button" },
17
+ { "waitFor": ".rc-modal input[name=adData]" },
18
+ { "click": ".rc-modal input.rc-checkbox__input:checked", "all": true, "optional": true },
19
+ { "waitForThenClick": ".rc-modal:has(input[name=adData]) .rc-modal__footer button[data-slot=primary]" }
20
+ ]
21
+ }
22
+ ],
23
+ "test": [{ "cookieContains": "third_party_ad_storage_consent%22%3Afalse" }]
24
+ }
@@ -0,0 +1,23 @@
1
+ {
2
+ "name": "zoho",
3
+ "vendorUrl": "https://www.zoho.com/",
4
+ "cosmetic": false,
5
+ "prehideSelectors": [".zbottom-cp-container"],
6
+ "detectCmp": [{ "exists": ".zbottom-cp-container .zbc-cta-accept" }],
7
+ "detectPopup": [{ "visible": ".zbottom-cp-container" }],
8
+ "optIn": [{ "waitForThenClick": ".zbottom-cp-container .zbc-cta-accept button" }],
9
+ "optOut": [
10
+ {
11
+ "if": { "visible": ".zbottom-cp-container .zbc-cta-ignore button" },
12
+ "then": [{ "click": ".zbottom-cp-container .zbc-cta-ignore button" }],
13
+ "else": [
14
+ { "click": ".zbottom-cp-container .zbc-manage-cta" },
15
+ { "waitForVisible": ".zbc-main .zbc-cta-se" },
16
+ { "click": ".zbc-main .ctog-container.ctog-active:not(.ctog-no)", "all": true, "optional": true },
17
+ { "click": ".zbc-main .zbc-cta-se" }
18
+ ]
19
+ },
20
+ { "waitForVisible": ".zbottom-cp-container", "check": "none", "timeout": 2000 }
21
+ ],
22
+ "test": [{ "eval": "EVAL_ZOHO_TEST" }]
23
+ }