@duckduckgo/autoconsent 16.2.0 → 16.4.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 (40) hide show
  1. package/.agents/skills/proxy-testing/scripts/regional-proxy.mjs +4 -1
  2. package/.github/PULL_REQUEST_TEMPLATE.md +2 -2
  3. package/.github/dependabot.yml +1 -1
  4. package/.github/labeler.yml +6 -6
  5. package/CHANGELOG.md +41 -0
  6. package/dist/addon-firefox/compact-rules.json +1 -1
  7. package/dist/addon-firefox/devtools/panel.html +5 -0
  8. package/dist/addon-firefox/devtools/panel.ts +18 -1
  9. package/dist/addon-firefox/manifest.json +1 -1
  10. package/dist/addon-firefox/rule-index.json +1 -1
  11. package/dist/addon-firefox/rules.json +1 -1
  12. package/dist/addon-mv3/compact-rules.json +1 -1
  13. package/dist/addon-mv3/devtools/panel.html +5 -0
  14. package/dist/addon-mv3/devtools/panel.js +12 -0
  15. package/dist/addon-mv3/devtools/panel.ts +18 -1
  16. package/dist/addon-mv3/manifest.json +1 -1
  17. package/dist/addon-mv3/rule-index.json +1 -1
  18. package/dist/addon-mv3/rules.json +1 -1
  19. package/dist/autoconsent.standalone.js +2 -2
  20. package/docs/puppeteer.md +1 -1
  21. package/docs/release-notes.md +12 -43
  22. package/package.json +15 -15
  23. package/rules/autoconsent/ketch.json +58 -19
  24. package/rules/autoconsent/msn.json +18 -0
  25. package/rules/compact-rules.json +1 -1
  26. package/rules/rule-index.json +1 -1
  27. package/rules/rules.json +1 -1
  28. package/scripts/check-pr-release-labels.ts +24 -24
  29. package/standalone/content.ts +1 -1
  30. package/tests/ketch.spec.ts +33 -19
  31. package/tests/msn.spec.ts +5 -0
  32. package/tests-wtr/lifecycle/find-cmp.ts +2 -2
  33. package/tests-wtr/web/do-opt-in.test.ts +1 -1
  34. package/tests-wtr/web/do-opt-out.test.ts +1 -1
  35. package/tests-wtr/web/do-self-test.test.ts +1 -1
  36. package/tests-wtr/web/filter-cmps.test.ts +1 -1
  37. package/tests-wtr/web/receive-message-callback.test.ts +1 -1
  38. package/tests-wtr/web/update-state.test.ts +1 -1
  39. package/rules/autoconsent/theverge.json +0 -36
  40. package/tests/theverge.spec.ts +0 -3
@@ -1,23 +1,23 @@
1
1
  import fs from 'fs';
2
2
  import { Octokit } from '@octokit/rest';
3
3
 
4
- const RELEASE_IMPACT_LABELS = ['major', 'minor', 'patch'] as const;
4
+ const VERSION_LABELS = ['version: major', 'version: minor', 'version: patch'] as const;
5
5
  const CATEGORY_LABELS = [
6
- 'rules',
7
- 'bug',
8
- 'enhancement',
9
- 'performance',
10
- 'dependencies',
11
- 'ci',
12
- 'ai',
13
- 'documentation',
14
- 'tests',
15
- 'internal',
16
- 'other',
6
+ 'category: rules',
7
+ 'category: bug',
8
+ 'category: enhancement',
9
+ 'category: performance',
10
+ 'category: dependencies',
11
+ 'category: ci',
12
+ 'category: ai',
13
+ 'category: documentation',
14
+ 'category: tests',
15
+ 'category: internal',
16
+ 'category: other',
17
17
  ] as const;
18
18
  const COMMENT_MARKER = '<!-- autoconsent-release-label-check -->';
19
19
 
20
- type LabelName = (typeof RELEASE_IMPACT_LABELS)[number] | (typeof CATEGORY_LABELS)[number];
20
+ type LabelName = (typeof VERSION_LABELS)[number] | (typeof CATEGORY_LABELS)[number];
21
21
 
22
22
  interface Args {
23
23
  event?: string;
@@ -44,7 +44,7 @@ interface PullRequestEvent {
44
44
  interface ValidationResult {
45
45
  ok: boolean;
46
46
  labels: string[];
47
- releaseImpactLabels: string[];
47
+ versionLabels: string[];
48
48
  categoryLabels: string[];
49
49
  errors: string[];
50
50
  comment?: string;
@@ -119,18 +119,18 @@ function isKnownLabel(labelSet: readonly LabelName[], label: string): boolean {
119
119
 
120
120
  export function validateLabels(labels: string[]): ValidationResult {
121
121
  const currentLabels = uniqueLabels(labels);
122
- const releaseImpactLabels = currentLabels.filter((label) => isKnownLabel(RELEASE_IMPACT_LABELS, label));
122
+ const versionLabels = currentLabels.filter((label) => isKnownLabel(VERSION_LABELS, label));
123
123
  const categoryLabels = currentLabels.filter((label) => isKnownLabel(CATEGORY_LABELS, label));
124
124
  const errors: string[] = [];
125
125
 
126
- if (releaseImpactLabels.length === 0) {
127
- errors.push(`Add exactly one release impact label: ${RELEASE_IMPACT_LABELS.join(', ')}.`);
128
- } else if (releaseImpactLabels.length > 1) {
129
- errors.push(`Keep exactly one release impact label; found ${releaseImpactLabels.join(', ')}.`);
126
+ if (versionLabels.length === 0) {
127
+ errors.push('Add exactly one version label with the `version:` prefix.');
128
+ } else if (versionLabels.length > 1) {
129
+ errors.push(`Keep exactly one version label; found ${versionLabels.join(', ')}.`);
130
130
  }
131
131
 
132
132
  if (categoryLabels.length === 0) {
133
- errors.push(`Add exactly one release-note category label: ${CATEGORY_LABELS.join(', ')}.`);
133
+ errors.push('Add exactly one release-note category label with the `category:` prefix.');
134
134
  } else if (categoryLabels.length > 1) {
135
135
  errors.push(`Keep exactly one release-note category label; found ${categoryLabels.join(', ')}.`);
136
136
  }
@@ -138,7 +138,7 @@ export function validateLabels(labels: string[]): ValidationResult {
138
138
  return {
139
139
  ok: errors.length === 0,
140
140
  labels: currentLabels,
141
- releaseImpactLabels,
141
+ versionLabels,
142
142
  categoryLabels,
143
143
  errors,
144
144
  };
@@ -171,8 +171,8 @@ Problems:
171
171
  ${result.errors.map((error) => `- ${error}`).join('\n')}
172
172
 
173
173
  Required labels:
174
- - One release impact label: ${formatLabels(RELEASE_IMPACT_LABELS)}
175
- - One release-note category label: ${formatLabels(CATEGORY_LABELS)}
174
+ - One version label using the \`version:\` prefix, for example \`version: patch\`
175
+ - One release-note category label using the \`category:\` prefix, for example \`category: rules\`
176
176
 
177
177
  See [docs/release-notes.md](https://github.com/duckduckgo/autoconsent/blob/main/docs/release-notes.md) for examples.`;
178
178
  }
@@ -252,4 +252,4 @@ if (require.main === module) {
252
252
  });
253
253
  }
254
254
 
255
- export { CATEGORY_LABELS, RELEASE_IMPACT_LABELS };
255
+ export { CATEGORY_LABELS, VERSION_LABELS };
@@ -55,7 +55,7 @@ if (!window.autoconsentReceiveMessage) {
55
55
  const config: Partial<Config> = {
56
56
  isMainWorld: true,
57
57
  enableHeuristicDetection: true,
58
- enableHeuristicAction: true,
58
+ heuristicMode: 'tier2',
59
59
  enablePopupMutationObserver: false,
60
60
  logs: {
61
61
  lifecycle: true,
@@ -1,21 +1,35 @@
1
1
  import generateCMPTests from '../playwright/runner';
2
2
 
3
- generateCMPTests('ketch', [
4
- 'https://time.com/',
5
- 'https://www.rover.com/nl/',
6
- 'https://purple.com/',
7
- 'https://www.ncsasports.org/',
8
- 'https://www.pret.co.uk/en-GB',
9
- 'https://www.greatpetcare.com/',
10
- 'https://www.smartsheet.com/',
11
- 'https://www.ketch.com/',
12
- 'https://www.forbes.com/',
13
- 'https://yumearth.com/products/variety-pack-30ct',
14
- // Disclosure-only banner variant (US/CCPA): the standard banner ships with
15
- // a single acknowledge button (e.g. "I understand"/"Learn more") and no
16
- // reject option consent is decided by Ketch's jurisdiction defaults.
17
- 'https://shift.com/state-of-browsing/',
18
- 'https://www.altec.com/',
19
- 'https://www.akro-mils.com/',
20
- 'https://www.ascensus.com/',
21
- ]);
3
+ generateCMPTests(
4
+ 'ketch',
5
+ [
6
+ 'https://www.rover.com/nl/',
7
+ 'https://purple.com/',
8
+ 'https://www.ncsasports.org/',
9
+ 'https://www.pret.co.uk/en-GB',
10
+ 'https://www.greatpetcare.com/',
11
+ 'https://www.smartsheet.com/',
12
+ 'https://www.ketch.com/',
13
+ 'https://www.forbes.com/',
14
+ 'https://yumearth.com/products/variety-pack-30ct',
15
+ // Disclosure-only banner variant (US/CCPA): the standard banner ships with
16
+ // a single acknowledge button (e.g. "I understand"/"Learn more") and no
17
+ // reject option — consent is decided by Ketch's jurisdiction defaults.
18
+ 'https://shift.com/state-of-browsing/',
19
+ 'https://www.altec.com/',
20
+ 'https://www.akro-mils.com/',
21
+ 'https://www.ascensus.com/',
22
+ // Banner with "Manage Cookie Settings" + "Accept All Cookies" only (no
23
+ // direct reject); preferences modal has per-purpose toggles and a
24
+ // "Save Settings" button but no "Reject All".
25
+ 'https://my.equifax.ca/login',
26
+ // 3-button banner where the direct reject (aria-label="Reject
27
+ // Optional Cookies") is #ketch-banner-button-secondary while
28
+ // #ketch-banner-button-tertiary is "Cookie Settings" — verifies we
29
+ // prefer the aria-label-based direct reject over id-position guesses.
30
+ 'https://www.pbs.org/newshour/economy/tomatoes-become-latest-symbol-of-americas-affordability-squeeze',
31
+ ],
32
+ {
33
+ onlyRegions: ['US', 'DE'],
34
+ },
35
+ );
@@ -0,0 +1,5 @@
1
+ import generateCMPTests from '../playwright/runner';
2
+
3
+ generateCMPTests('msn', ['https://www.msn.com/en-gb', 'https://www.msn.com/de-de', 'https://www.msn.com/fr-fr'], {
4
+ onlyRegions: ['UK', 'DE', 'FR'],
5
+ });
@@ -5,7 +5,7 @@ import Onetrust from '../../lib/cmps/onetrust';
5
5
  describe('Autoconsent.findCmp', () => {
6
6
  let autoconsent: Autoconsent;
7
7
 
8
- describe('enableHeuristicAction = false', () => {
8
+ describe('heuristicMode = off', () => {
9
9
  beforeEach(() => {
10
10
  autoconsent = new Autoconsent((msg) => Promise.resolve(), {
11
11
  enabled: false, // bypass initialization
@@ -135,7 +135,7 @@ describe('Autoconsent.findCmp', () => {
135
135
  });
136
136
  });
137
137
 
138
- describe('enableHeuristicAction = true', () => {
138
+ describe('heuristicMode = reject', () => {
139
139
  beforeEach(() => {
140
140
  autoconsent = new Autoconsent((msg) => Promise.resolve(), {
141
141
  enabled: false,
@@ -19,7 +19,7 @@ function createTestConfig(overrides: Partial<Config> = {}): Config {
19
19
  isMainWorld: false,
20
20
  prehideTimeout: 2000,
21
21
  enableHeuristicDetection: false,
22
- enableHeuristicAction: false,
22
+ heuristicMode: 'off',
23
23
  visualTest: false,
24
24
  logs: {
25
25
  lifecycle: false,
@@ -19,7 +19,7 @@ function createTestConfig(overrides: Partial<Config> = {}): Config {
19
19
  isMainWorld: false,
20
20
  prehideTimeout: 2000,
21
21
  enableHeuristicDetection: false,
22
- enableHeuristicAction: false,
22
+ heuristicMode: 'off',
23
23
  visualTest: false,
24
24
  logs: {
25
25
  lifecycle: false,
@@ -19,7 +19,7 @@ function createTestConfig(overrides: Partial<Config> = {}): Config {
19
19
  isMainWorld: false,
20
20
  prehideTimeout: 2000,
21
21
  enableHeuristicDetection: false,
22
- enableHeuristicAction: false,
22
+ heuristicMode: 'off',
23
23
  visualTest: false,
24
24
  logs: {
25
25
  lifecycle: false,
@@ -41,7 +41,7 @@ function createTestConfig(overrides: Partial<Config> = {}): Config {
41
41
  isMainWorld: false,
42
42
  prehideTimeout: 2000,
43
43
  enableHeuristicDetection: false,
44
- enableHeuristicAction: false,
44
+ heuristicMode: 'off',
45
45
  visualTest: false,
46
46
  logs: {
47
47
  lifecycle: false,
@@ -18,7 +18,7 @@ function createTestConfig(overrides: Partial<Config> = {}): Config {
18
18
  isMainWorld: false,
19
19
  prehideTimeout: 2000,
20
20
  enableHeuristicDetection: false,
21
- enableHeuristicAction: false,
21
+ heuristicMode: 'off',
22
22
  visualTest: false,
23
23
  logs: {
24
24
  lifecycle: false,
@@ -18,7 +18,7 @@ function createTestConfig(overrides: Partial<Config> = {}): Config {
18
18
  isMainWorld: false,
19
19
  prehideTimeout: 2000,
20
20
  enableHeuristicDetection: false,
21
- enableHeuristicAction: false,
21
+ heuristicMode: 'off',
22
22
  visualTest: false,
23
23
  logs: {
24
24
  lifecycle: false,
@@ -1,36 +0,0 @@
1
- {
2
- "name": "theverge",
3
- "runContext": {
4
- "frame": false,
5
- "main": true,
6
- "urlPattern": "^https://(www)?\\.theverge\\.com"
7
- },
8
- "intermediate": false,
9
- "prehideSelectors": [".duet--cta--cookie-banner"],
10
- "detectCmp": [
11
- {
12
- "exists": ".duet--cta--cookie-banner"
13
- }
14
- ],
15
- "detectPopup": [
16
- {
17
- "visible": ".duet--cta--cookie-banner"
18
- }
19
- ],
20
- "optIn": [
21
- {
22
- "click": ".duet--cta--cookie-banner button.tracking-12",
23
- "all": false
24
- }
25
- ],
26
- "optOut": [
27
- {
28
- "click": ".duet--cta--cookie-banner button.tracking-12 > span"
29
- }
30
- ],
31
- "test": [
32
- {
33
- "cookieContains": "_duet_gdpr_acknowledged=1"
34
- }
35
- ]
36
- }
@@ -1,3 +0,0 @@
1
- import generateCMPTests from '../playwright/runner';
2
-
3
- generateCMPTests('theverge', ['https://www.theverge.com/']);