@duckduckgo/autoconsent 10.1.0 → 10.3.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.
@@ -0,0 +1,61 @@
1
+ /**
2
+ * Execs a string.replace and ensures the searchRegex is found
3
+ * @param {string} string
4
+ * @param {RegExp} searchRegex - Use groupings for more complex operations
5
+ * @param {string} replace
6
+ * @returns {string}
7
+ * @throws {Error} - If the string does not contain the searchRegex
8
+ */
9
+ function replaceInString (string, searchRegex, replace) {
10
+ if (!searchRegex.test(string)) {
11
+ const errorMsg = 'No match found in the string. Check both string and regex.'
12
+ console.log(errorMsg)
13
+ console.log(string)
14
+ throw new Error(errorMsg)
15
+ }
16
+ return string.replaceAll(
17
+ new RegExp(searchRegex.source, 'gi'),
18
+ replace
19
+ )
20
+ }
21
+
22
+ /**
23
+ * Execs multiple string.replace and ensures the searchRegexes are found
24
+ * @param {string} string
25
+ * @param {[searchRegex: RegExp, replace?: string][]} changes
26
+ * @returns {string}
27
+ * @throws {Error} - If the string does not contain the searchRegex
28
+ */
29
+ function replaceAllInString (string, changes) {
30
+ let updatedFile = string
31
+ for (const [searchRegex, replace = ''] of changes) {
32
+ updatedFile = replaceInString(updatedFile, searchRegex, replace)
33
+ }
34
+ return updatedFile
35
+ }
36
+
37
+ /**
38
+ * Creates an html <a> tag from a url and an optional anchor text
39
+ * @param {string} url
40
+ * @param {string} [anchor]
41
+ * @returns {string}
42
+ */
43
+ function getLink (url, anchor) {
44
+ return `<a href="${url}">${anchor || url}</a>`
45
+ }
46
+
47
+ /**
48
+ * Wraps the passed content string within a <li></li>
49
+ * @param {string} content
50
+ * @returns {string}
51
+ */
52
+ function wrapInLi (content) {
53
+ return `<li>${content}</li>`
54
+ }
55
+
56
+ module.exports = {
57
+ replaceInString,
58
+ replaceAllInString,
59
+ getLink,
60
+ wrapInLi
61
+ }
@@ -1436,14 +1436,14 @@
1436
1436
  return false;
1437
1437
  }
1438
1438
  async detectCmp() {
1439
- return this.elementExists("#onetrust-banner-sdk");
1439
+ return this.elementExists("#onetrust-banner-sdk,#onetrust-pc-sdk");
1440
1440
  }
1441
1441
  async detectPopup() {
1442
- return this.elementVisible("#onetrust-banner-sdk", "all");
1442
+ return this.elementVisible("#onetrust-banner-sdk,#onetrust-pc-sdk", "any");
1443
1443
  }
1444
1444
  async optOut() {
1445
- if (this.elementVisible("#onetrust-reject-all-handler,.js-reject-cookies", "any")) {
1446
- return this.click("#onetrust-reject-all-handler,.js-reject-cookies");
1445
+ if (this.elementVisible("#onetrust-reject-all-handler,.ot-pc-refuse-all-handler,.js-reject-cookies", "any")) {
1446
+ return this.click("#onetrust-reject-all-handler,.ot-pc-refuse-all-handler,.js-reject-cookies");
1447
1447
  }
1448
1448
  if (this.elementExists("#onetrust-pc-btn-handler")) {
1449
1449
  this.click("#onetrust-pc-btn-handler");
@@ -1460,7 +1460,7 @@
1460
1460
  return true;
1461
1461
  }
1462
1462
  async optIn() {
1463
- return this.click("#onetrust-accept-btn-handler,.js-accept-cookies");
1463
+ return this.click("#onetrust-accept-btn-handler,#accept-recommended-btn-handler,.js-accept-cookies");
1464
1464
  }
1465
1465
  async test() {
1466
1466
  return await waitFor(
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "manifest_version": 2,
3
3
  "name": "Autoconsent",
4
- "version": "2024.3.1",
4
+ "version": "2024.3.5",
5
5
  "background": {
6
6
  "scripts": [
7
7
  "background.bundle.js"
@@ -5201,7 +5201,7 @@
5201
5201
  },
5202
5202
  {
5203
5203
  "name": "Sirdata",
5204
- "cosmetic": true,
5204
+ "cosmetic": false,
5205
5205
  "prehideSelectors": [
5206
5206
  "#sd-cmp"
5207
5207
  ],
@@ -5222,10 +5222,10 @@
5222
5222
  ],
5223
5223
  "optOut": [
5224
5224
  {
5225
- "hide": "#sd-cmp"
5226
- },
5227
- {
5228
- "eval": "EVAL_SIRDATA_UNBLOCK_SCROLL"
5225
+ "waitForThenClick": [
5226
+ "#sd-cmp",
5227
+ "xpath///span[contains(., 'Do not accept') or contains(., 'Acceptera inte') or contains(., 'No aceptar') or contains(., 'Ikke acceptere') or contains(., 'Nicht akzeptieren') or contains(., 'Не приемам') or contains(., 'Να μην γίνει αποδοχή') or contains(., 'Niet accepteren') or contains(., 'Nepřijímat') or contains(., 'Nie akceptuj') or contains(., 'Nu acceptați') or contains(., 'Não aceitar') or contains(., 'Continuer sans accepter') or contains(., 'Non accettare') or contains(., 'Nem fogad el')]"
5228
+ ]
5229
5229
  }
5230
5230
  ]
5231
5231
  },
@@ -1436,14 +1436,14 @@
1436
1436
  return false;
1437
1437
  }
1438
1438
  async detectCmp() {
1439
- return this.elementExists("#onetrust-banner-sdk");
1439
+ return this.elementExists("#onetrust-banner-sdk,#onetrust-pc-sdk");
1440
1440
  }
1441
1441
  async detectPopup() {
1442
- return this.elementVisible("#onetrust-banner-sdk", "all");
1442
+ return this.elementVisible("#onetrust-banner-sdk,#onetrust-pc-sdk", "any");
1443
1443
  }
1444
1444
  async optOut() {
1445
- if (this.elementVisible("#onetrust-reject-all-handler,.js-reject-cookies", "any")) {
1446
- return this.click("#onetrust-reject-all-handler,.js-reject-cookies");
1445
+ if (this.elementVisible("#onetrust-reject-all-handler,.ot-pc-refuse-all-handler,.js-reject-cookies", "any")) {
1446
+ return this.click("#onetrust-reject-all-handler,.ot-pc-refuse-all-handler,.js-reject-cookies");
1447
1447
  }
1448
1448
  if (this.elementExists("#onetrust-pc-btn-handler")) {
1449
1449
  this.click("#onetrust-pc-btn-handler");
@@ -1460,7 +1460,7 @@
1460
1460
  return true;
1461
1461
  }
1462
1462
  async optIn() {
1463
- return this.click("#onetrust-accept-btn-handler,.js-accept-cookies");
1463
+ return this.click("#onetrust-accept-btn-handler,#accept-recommended-btn-handler,.js-accept-cookies");
1464
1464
  }
1465
1465
  async test() {
1466
1466
  return await waitFor(
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "manifest_version": 3,
3
3
  "name": "Autoconsent",
4
- "version": "2024.3.1",
4
+ "version": "2024.3.5",
5
5
  "background": {
6
6
  "service_worker": "background.bundle.js"
7
7
  },
@@ -5201,7 +5201,7 @@
5201
5201
  },
5202
5202
  {
5203
5203
  "name": "Sirdata",
5204
- "cosmetic": true,
5204
+ "cosmetic": false,
5205
5205
  "prehideSelectors": [
5206
5206
  "#sd-cmp"
5207
5207
  ],
@@ -5222,10 +5222,10 @@
5222
5222
  ],
5223
5223
  "optOut": [
5224
5224
  {
5225
- "hide": "#sd-cmp"
5226
- },
5227
- {
5228
- "eval": "EVAL_SIRDATA_UNBLOCK_SCROLL"
5225
+ "waitForThenClick": [
5226
+ "#sd-cmp",
5227
+ "xpath///span[contains(., 'Do not accept') or contains(., 'Acceptera inte') or contains(., 'No aceptar') or contains(., 'Ikke acceptere') or contains(., 'Nicht akzeptieren') or contains(., 'Не приемам') or contains(., 'Να μην γίνει αποδοχή') or contains(., 'Niet accepteren') or contains(., 'Nepřijímat') or contains(., 'Nie akceptuj') or contains(., 'Nu acceptați') or contains(., 'Não aceitar') or contains(., 'Continuer sans accepter') or contains(., 'Non accettare') or contains(., 'Nem fogad el')]"
5228
+ ]
5229
5229
  }
5230
5230
  ]
5231
5231
  },
@@ -1459,14 +1459,14 @@ var Onetrust = class extends AutoConsentCMPBase {
1459
1459
  return false;
1460
1460
  }
1461
1461
  async detectCmp() {
1462
- return this.elementExists("#onetrust-banner-sdk");
1462
+ return this.elementExists("#onetrust-banner-sdk,#onetrust-pc-sdk");
1463
1463
  }
1464
1464
  async detectPopup() {
1465
- return this.elementVisible("#onetrust-banner-sdk", "all");
1465
+ return this.elementVisible("#onetrust-banner-sdk,#onetrust-pc-sdk", "any");
1466
1466
  }
1467
1467
  async optOut() {
1468
- if (this.elementVisible("#onetrust-reject-all-handler,.js-reject-cookies", "any")) {
1469
- return this.click("#onetrust-reject-all-handler,.js-reject-cookies");
1468
+ if (this.elementVisible("#onetrust-reject-all-handler,.ot-pc-refuse-all-handler,.js-reject-cookies", "any")) {
1469
+ return this.click("#onetrust-reject-all-handler,.ot-pc-refuse-all-handler,.js-reject-cookies");
1470
1470
  }
1471
1471
  if (this.elementExists("#onetrust-pc-btn-handler")) {
1472
1472
  this.click("#onetrust-pc-btn-handler");
@@ -1483,7 +1483,7 @@ var Onetrust = class extends AutoConsentCMPBase {
1483
1483
  return true;
1484
1484
  }
1485
1485
  async optIn() {
1486
- return this.click("#onetrust-accept-btn-handler,.js-accept-cookies");
1486
+ return this.click("#onetrust-accept-btn-handler,#accept-recommended-btn-handler,.js-accept-cookies");
1487
1487
  }
1488
1488
  async test() {
1489
1489
  return await waitFor(
@@ -1434,14 +1434,14 @@ var Onetrust = class extends AutoConsentCMPBase {
1434
1434
  return false;
1435
1435
  }
1436
1436
  async detectCmp() {
1437
- return this.elementExists("#onetrust-banner-sdk");
1437
+ return this.elementExists("#onetrust-banner-sdk,#onetrust-pc-sdk");
1438
1438
  }
1439
1439
  async detectPopup() {
1440
- return this.elementVisible("#onetrust-banner-sdk", "all");
1440
+ return this.elementVisible("#onetrust-banner-sdk,#onetrust-pc-sdk", "any");
1441
1441
  }
1442
1442
  async optOut() {
1443
- if (this.elementVisible("#onetrust-reject-all-handler,.js-reject-cookies", "any")) {
1444
- return this.click("#onetrust-reject-all-handler,.js-reject-cookies");
1443
+ if (this.elementVisible("#onetrust-reject-all-handler,.ot-pc-refuse-all-handler,.js-reject-cookies", "any")) {
1444
+ return this.click("#onetrust-reject-all-handler,.ot-pc-refuse-all-handler,.js-reject-cookies");
1445
1445
  }
1446
1446
  if (this.elementExists("#onetrust-pc-btn-handler")) {
1447
1447
  this.click("#onetrust-pc-btn-handler");
@@ -1458,7 +1458,7 @@ var Onetrust = class extends AutoConsentCMPBase {
1458
1458
  return true;
1459
1459
  }
1460
1460
  async optIn() {
1461
- return this.click("#onetrust-accept-btn-handler,.js-accept-cookies");
1461
+ return this.click("#onetrust-accept-btn-handler,#accept-recommended-btn-handler,.js-accept-cookies");
1462
1462
  }
1463
1463
  async test() {
1464
1464
  return await waitFor(