@duckduckgo/autoconsent 14.69.0 → 14.71.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 (49) hide show
  1. package/CHANGELOG.md +42 -0
  2. package/Jenkinsfile +8 -22
  3. package/dist/addon-firefox/background.bundle.js +15 -2
  4. package/dist/addon-firefox/compact-rules.json +1 -1
  5. package/dist/addon-firefox/content.bundle.js +13 -0
  6. package/dist/addon-firefox/manifest.json +1 -1
  7. package/dist/addon-firefox/popup.bundle.js +1 -1
  8. package/dist/addon-firefox/rules.json +1 -1
  9. package/dist/addon-mv3/background.bundle.js +15 -2
  10. package/dist/addon-mv3/compact-rules.json +1 -1
  11. package/dist/addon-mv3/content.bundle.js +13 -0
  12. package/dist/addon-mv3/manifest.json +1 -1
  13. package/dist/addon-mv3/popup.bundle.js +1 -1
  14. package/dist/addon-mv3/rules.json +1 -1
  15. package/dist/autoconsent.cjs.js +13 -0
  16. package/dist/autoconsent.esm.js +13 -0
  17. package/dist/autoconsent.extra.cjs.js +14 -1
  18. package/dist/autoconsent.extra.esm.js +14 -1
  19. package/dist/autoconsent.playwright.js +14 -1
  20. package/dist/types/eval-snippets.d.ts +2 -0
  21. package/docs/puppeteer.md +82 -0
  22. package/lib/eval-snippets.ts +13 -0
  23. package/package.json +1 -1
  24. package/readme.md +4 -0
  25. package/rules/autoconsent/consentmo.json +44 -0
  26. package/rules/autoconsent/didomi.json +22 -0
  27. package/rules/autoconsent/gallup.json +9 -0
  28. package/rules/autoconsent/real-cookie-banner.json +1 -1
  29. package/rules/autoconsent/squarespace-cookie-banner.json +31 -0
  30. package/rules/build.ts +1 -1
  31. package/rules/compact-rules.json +1 -1
  32. package/rules/consentomatic.json +1 -1
  33. package/rules/generated/auto_AU_goodmoodprints.com_9fy.json +11 -11
  34. package/rules/generated/auto_GB_supremecourt.uk_0.json +9 -9
  35. package/rules/generated/auto_US_musicnotes.com_0.json +20 -5
  36. package/rules/rules.json +1 -1
  37. package/scripts/get-tests-to-run.js +79 -0
  38. package/tests/consentmo.spec.ts +15 -0
  39. package/tests/didomi.spec.ts +5 -4
  40. package/tests/gallup.spec.ts +6 -0
  41. package/tests/squarespace-cookie-banner.spec.ts +9 -0
  42. package/rules/generated/auto_AU_urallawoolroom.com.au_3ng.json +0 -28
  43. package/rules/generated/auto_CH_degussa-goldhandel.ch_mqc.json +0 -40
  44. package/rules/generated/auto_GB_filofax.com_uxo.json +0 -40
  45. package/rules/generated/auto_GB_musicnotes.com_0.json +0 -28
  46. package/tests/generated/auto_AU_urallawoolroom.com.au_3ng.spec.ts +0 -6
  47. package/tests/generated/auto_CH_degussa-goldhandel.ch_mqc.spec.ts +0 -6
  48. package/tests/generated/auto_GB_filofax.com_uxo.spec.ts +0 -2
  49. package/tests/generated/auto_GB_musicnotes.com_0.spec.ts +0 -6
@@ -0,0 +1,79 @@
1
+ const fs = require('fs');
2
+ const path = require('path');
3
+
4
+ function buildCmpTestMap() {
5
+ const map = new Map();
6
+ const testsDir = path.resolve('tests');
7
+ if (!fs.existsSync(testsDir)) {
8
+ return map;
9
+ }
10
+ const files = fs.readdirSync(testsDir).filter((f) => f.endsWith('.spec.ts'));
11
+ for (const file of files) {
12
+ const filePath = path.join('tests', file);
13
+ const content = fs.readFileSync(filePath, 'utf-8');
14
+ const regex = /generateCMPTests\(\s*['"]([^'"]+)['"]/g;
15
+ let match;
16
+ while ((match = regex.exec(content)) !== null) {
17
+ const key = match[1].toLowerCase();
18
+ if (!map.has(key)) {
19
+ map.set(key, new Set());
20
+ }
21
+ map.get(key).add(filePath);
22
+ }
23
+ }
24
+ return map;
25
+ }
26
+
27
+ function getCmpName(filePath) {
28
+ try {
29
+ const content = fs.readFileSync(filePath, 'utf-8');
30
+ const match = content.match(/^\s*name\s*=\s*['"]([^'"]+)['"]/m);
31
+ return match ? match[1] : null;
32
+ } catch {
33
+ return null;
34
+ }
35
+ }
36
+
37
+ const modifiedFiles = process.argv.slice(2);
38
+ const cmpTestMap = buildCmpTestMap();
39
+ const testsToRun = new Set();
40
+
41
+ for (const file of modifiedFiles) {
42
+ if (file.startsWith('tests/') && file.endsWith('.spec.ts')) {
43
+ if (fs.existsSync(file)) {
44
+ testsToRun.add(file);
45
+ }
46
+ }
47
+
48
+ if (file.startsWith('rules/autoconsent/') && file.endsWith('.json')) {
49
+ const baseName = path.basename(file, '.json');
50
+ const testFile = path.join('tests', `${baseName}.spec.ts`);
51
+ if (fs.existsSync(testFile)) {
52
+ testsToRun.add(testFile);
53
+ }
54
+ }
55
+
56
+ if (file.startsWith('rules/generated/') && file.endsWith('.json')) {
57
+ const baseName = path.basename(file, '.json');
58
+ const testFile = path.join('tests', 'generated', `${baseName}.spec.ts`);
59
+ if (fs.existsSync(testFile)) {
60
+ testsToRun.add(testFile);
61
+ }
62
+ }
63
+
64
+ if (file.startsWith('lib/cmps/') && file.endsWith('.ts')) {
65
+ const cmpName = getCmpName(file);
66
+ if (cmpName) {
67
+ const tests = cmpTestMap.get(cmpName.toLowerCase());
68
+ if (tests) {
69
+ for (const testFile of tests) {
70
+ testsToRun.add(testFile);
71
+ }
72
+ }
73
+ }
74
+ }
75
+ }
76
+
77
+ for (const testFile of testsToRun) {
78
+ console.log(testFile);
79
+ }
@@ -0,0 +1,15 @@
1
+ import generateCMPTests from '../playwright/runner';
2
+
3
+ generateCMPTests(
4
+ 'consentmo',
5
+ [
6
+ 'https://filofax.com/',
7
+ 'https://www.consentmo.com/',
8
+ 'https://mgemi.com/products/the-felize-saddle-suede',
9
+ 'https://eu.blackdiamondequipment.com/',
10
+ 'https://www.directdoors.com/',
11
+ ],
12
+ {
13
+ skipRegions: ['US'],
14
+ },
15
+ );
@@ -1,16 +1,17 @@
1
1
  import generateCMPTests from '../playwright/runner';
2
2
 
3
3
  generateCMPTests(
4
- 'com_didomi.io',
4
+ 'didomi',
5
5
  [
6
- 'https://www.ghacks.net/',
7
- 'https://www.20minutes.fr/',
6
+ 'https://nothing.tech/',
8
7
  'https://www.planet.fr/',
9
8
  'http://www.allocine.fr/',
10
9
  'https://www.boursorama.com/',
10
+ 'https://www.theoriginalshotels.com/en/hotels/la-villa-vicha',
11
+ 'https://support.didomi.io/set-up-the-absence-of-interaction-as-a-cookie-denial',
11
12
  ],
12
13
  {
13
- testOptIn: false,
14
+ testOptIn: true,
14
15
  testSelfTest: false,
15
16
  skipRegions: ['US'],
16
17
  },
@@ -0,0 +1,6 @@
1
+ import generateCMPTests from '../playwright/runner';
2
+
3
+ generateCMPTests('gallup', [
4
+ 'https://www.gallup.com/analytics/651674/gen-z-research.aspx',
5
+ 'https://www.gallupstudentpoll.com.au/home.aspx',
6
+ ]);
@@ -0,0 +1,9 @@
1
+ import generateCMPTests from '../playwright/runner';
2
+
3
+ generateCMPTests(
4
+ 'squarespace-cookie-banner',
5
+ ['https://www.petersen.org/', 'https://insidethesquare.co/', 'https://www.urallawoolroom.com.au/'],
6
+ {
7
+ skipRegions: ['US'],
8
+ },
9
+ );
@@ -1,28 +0,0 @@
1
- {
2
- "name": "auto_AU_urallawoolroom.com.au_3ng",
3
- "vendorUrl": "https://www.urallawoolroom.com.au/",
4
- "cosmetic": false,
5
- "runContext": {
6
- "main": true,
7
- "frame": false,
8
- "urlPattern": "^https?://(www\\.)?urallawoolroom\\.com\\.au/"
9
- },
10
- "prehideSelectors": [],
11
- "detectCmp": [
12
- {
13
- "exists": "body#collection-59d726c7f6576e961db44d2c > div:not([id]) > section:not([id]) > div:nth-child(2):not([id]) > button:nth-child(2):not([id])"
14
- }
15
- ],
16
- "detectPopup": [
17
- {
18
- "visible": "body#collection-59d726c7f6576e961db44d2c > div:not([id]) > section:not([id]) > div:nth-child(2):not([id]) > button:nth-child(2):not([id])"
19
- }
20
- ],
21
- "optIn": [],
22
- "optOut": [
23
- {
24
- "waitForThenClick": "body#collection-59d726c7f6576e961db44d2c > div:not([id]) > section:not([id]) > div:nth-child(2):not([id]) > button:nth-child(2):not([id])",
25
- "comment": "Decline"
26
- }
27
- ]
28
- }
@@ -1,40 +0,0 @@
1
- {
2
- "name": "auto_CH_degussa-goldhandel.ch_mqc",
3
- "cosmetic": false,
4
- "_metadata": {
5
- "vendorUrl": "http://www.degussa-goldhandel.ch/"
6
- },
7
- "runContext": {
8
- "main": true,
9
- "frame": false,
10
- "urlPattern": "^https?://(www\\.)?degussa-goldhandel\\.ch/"
11
- },
12
- "prehideSelectors": [],
13
- "detectCmp": [
14
- {
15
- "exists": "body > div#a52a380d7-7829-4b5e-8585-b929383da38e > dialog:not([id]) > div:not([id]) > div:not([id]) > div:nth-child(3):not([id]) > div:nth-child(1):not([id]) > div:nth-child(2):not([id]) > a:nth-child(2):not([id])"
16
- }
17
- ],
18
- "detectPopup": [
19
- {
20
- "visible": "body > div#a52a380d7-7829-4b5e-8585-b929383da38e > dialog:not([id]) > div:not([id]) > div:not([id]) > div:nth-child(3):not([id]) > div:nth-child(1):not([id]) > div:nth-child(2):not([id]) > a:nth-child(2):not([id])"
21
- }
22
- ],
23
- "optIn": [],
24
- "optOut": [
25
- {
26
- "wait": 500
27
- },
28
- {
29
- "waitForThenClick": "body > div#a52a380d7-7829-4b5e-8585-b929383da38e > dialog:not([id]) > div:not([id]) > div:not([id]) > div:nth-child(3):not([id]) > div:nth-child(1):not([id]) > div:nth-child(2):not([id]) > a:nth-child(2):not([id])",
30
- "comment": "Ablehnen"
31
- }
32
- ],
33
- "test": [
34
- {
35
- "waitForVisible": "body > div#a52a380d7-7829-4b5e-8585-b929383da38e > dialog:not([id]) > div:not([id]) > div:not([id]) > div:nth-child(3):not([id]) > div:nth-child(1):not([id]) > div:nth-child(2):not([id]) > a:nth-child(2):not([id])",
36
- "timeout": 1000,
37
- "check": "none"
38
- }
39
- ]
40
- }
@@ -1,40 +0,0 @@
1
- {
2
- "name": "auto_GB_filofax.com_uxo",
3
- "cosmetic": false,
4
- "_metadata": {
5
- "vendorUrl": "http://filofax.com/"
6
- },
7
- "runContext": {
8
- "main": true,
9
- "frame": false,
10
- "urlPattern": "^https?://(www\\.)?filofax\\.com/"
11
- },
12
- "prehideSelectors": [],
13
- "detectCmp": [
14
- {
15
- "exists": "body > div:not([id]) > div#csm-wrapper > div:not([id]) > div:not([id]) > div:nth-child(2):not([id]) > button:nth-child(2):not([id])"
16
- }
17
- ],
18
- "detectPopup": [
19
- {
20
- "visible": "body > div:not([id]) > div#csm-wrapper > div:not([id]) > div:not([id]) > div:nth-child(2):not([id]) > button:nth-child(2):not([id])"
21
- }
22
- ],
23
- "optIn": [],
24
- "optOut": [
25
- {
26
- "wait": 500
27
- },
28
- {
29
- "waitForThenClick": "body > div:not([id]) > div#csm-wrapper > div:not([id]) > div:not([id]) > div:nth-child(2):not([id]) > button:nth-child(2):not([id])",
30
- "comment": "REJECT"
31
- }
32
- ],
33
- "test": [
34
- {
35
- "waitForVisible": "body > div:not([id]) > div#csm-wrapper > div:not([id]) > div:not([id]) > div:nth-child(2):not([id]) > button:nth-child(2):not([id])",
36
- "timeout": 1000,
37
- "check": "none"
38
- }
39
- ]
40
- }
@@ -1,28 +0,0 @@
1
- {
2
- "name": "auto_GB_musicnotes.com_0",
3
- "vendorUrl": "https://www.musicnotes.com/",
4
- "cosmetic": false,
5
- "runContext": {
6
- "main": true,
7
- "frame": false,
8
- "urlPattern": "^https?://(www\\.)?musicnotes\\.com/"
9
- },
10
- "prehideSelectors": [],
11
- "detectCmp": [
12
- {
13
- "exists": "body:not([id]) > div#cookie-consent > div:nth-child(3):not([id]) > button:nth-child(1)#reject-cookies"
14
- }
15
- ],
16
- "detectPopup": [
17
- {
18
- "visible": "body:not([id]) > div#cookie-consent > div:nth-child(3):not([id]) > button:nth-child(1)#reject-cookies"
19
- }
20
- ],
21
- "optIn": [],
22
- "optOut": [
23
- {
24
- "waitForThenClick": "body:not([id]) > div#cookie-consent > div:nth-child(3):not([id]) > button:nth-child(1)#reject-cookies",
25
- "comment": "Reject"
26
- }
27
- ]
28
- }
@@ -1,6 +0,0 @@
1
- import generateCMPTests from '../../playwright/runner';
2
- generateCMPTests('auto_AU_urallawoolroom.com.au_3ng', ['https://www.urallawoolroom.com.au/'], {
3
- testOptIn: false,
4
- testSelfTest: false,
5
- onlyRegions: ['AU'],
6
- });
@@ -1,6 +0,0 @@
1
- import generateCMPTests from '../../playwright/runner';
2
- generateCMPTests('auto_CH_degussa-goldhandel.ch_mqc', ['https://www.degussa-goldhandel.ch/'], {
3
- testOptIn: false,
4
- testSelfTest: true,
5
- onlyRegions: ['CH'],
6
- });
@@ -1,2 +0,0 @@
1
- import generateCMPTests from '../../playwright/runner';
2
- generateCMPTests('auto_GB_filofax.com_uxo', ['https://filofax.com/'], { testOptIn: false, testSelfTest: true, onlyRegions: ['GB'] });
@@ -1,6 +0,0 @@
1
- import generateCMPTests from '../../playwright/runner';
2
- generateCMPTests('auto_GB_musicnotes.com_0', ['https://www.musicnotes.com/'], {
3
- testOptIn: false,
4
- testSelfTest: false,
5
- onlyRegions: ['GB'],
6
- });