@duckduckgo/autoconsent 16.7.0 → 16.8.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/lib/heuristics.ts CHANGED
@@ -22,7 +22,13 @@ export function checkHeuristicPatterns(allText: string, detectPatterns = DETECT_
22
22
  const matches = allText?.match(p);
23
23
  if (matches) {
24
24
  patterns.push(p.toString());
25
- snippets.push(...matches.map((m) => m.substring(0, 200)));
25
+ // When a non-global regex has capture groups, `String.prototype.match`
26
+ // returns undefined entries for optional groups that did not match.
27
+ for (const m of matches) {
28
+ if (typeof m === 'string') {
29
+ snippets.push(m.substring(0, 200));
30
+ }
31
+ }
26
32
  }
27
33
  }
28
34
  return { patterns, snippets };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@duckduckgo/autoconsent",
3
- "version": "16.7.0",
3
+ "version": "16.8.1",
4
4
  "description": "",
5
5
  "types": "./dist/types/web.d.ts",
6
6
  "exports": {
@@ -12,12 +12,13 @@
12
12
  ],
13
13
  "detectPopup": [
14
14
  {
15
- "visible": "#gdpr-new-container,#voyager-gdpr > div"
15
+ "visible": "#gdpr-new-container,#voyager-gdpr > div",
16
+ "check": "any"
16
17
  }
17
18
  ],
18
19
  "optIn": [
19
20
  {
20
- "waitForThenClick": "#gdpr-new-container .btn-accept,#voyager-gdpr > div > div > button:nth-child(1)"
21
+ "waitForThenClick": "#gdpr-new-container button:last-of-type,#voyager-gdpr > div > div > button:nth-child(1)"
21
22
  }
22
23
  ],
23
24
  "optOut": [
@@ -30,18 +31,24 @@
30
31
  ],
31
32
  "else": [
32
33
  {
33
- "waitForThenClick": "#gdpr-new-container .btn-more"
34
- },
35
- {
36
- "waitFor": "#gdpr-new-container .gdpr-dialog-switcher"
37
- },
38
- {
39
- "click": "#gdpr-new-container .switcher-on",
40
- "all": true,
41
- "optional": true
42
- },
43
- {
44
- "click": "#gdpr-new-container .btn-save"
34
+ "if": { "exists": "#gdpr-new-container button:nth-of-type(3)" },
35
+ "then": [
36
+ {
37
+ "waitForThenClick": "#gdpr-new-container button:nth-of-type(2)"
38
+ }
39
+ ],
40
+ "else": [
41
+ {
42
+ "waitForThenClick": "#gdpr-new-container button:first-of-type"
43
+ },
44
+ {
45
+ "waitForVisible": "#voyager-gdpr-2025",
46
+ "timeout": 5000
47
+ },
48
+ {
49
+ "waitForThenClick": "#voyager-gdpr-2025 button:last-of-type"
50
+ }
51
+ ]
45
52
  }
46
53
  ]
47
54
  }