@duckduckgo/autoconsent 9.5.0 → 9.6.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.
@@ -2070,8 +2070,14 @@
2070
2070
  }
2071
2071
  return foundCMPs;
2072
2072
  }
2073
+ /**
2074
+ * Detect if a CMP has a popup open. Fullfils with the CMP if a popup is open, otherwise rejects.
2075
+ */
2073
2076
  async detectPopup(cmp) {
2074
- const isOpen = await this.waitForPopup(cmp);
2077
+ const isOpen = await this.waitForPopup(cmp).catch((error) => {
2078
+ this.config.logs.errors && console.warn(`error waiting for a popup for ${cmp.name}`, error);
2079
+ return false;
2080
+ });
2075
2081
  if (isOpen) {
2076
2082
  this.updateState({ detectedPopups: this.state.detectedPopups.concat([cmp.name]) });
2077
2083
  this.sendContentMessage({
@@ -2079,15 +2085,16 @@
2079
2085
  cmp: cmp.name,
2080
2086
  url: location.href
2081
2087
  });
2088
+ return cmp;
2082
2089
  }
2083
- return cmp;
2090
+ throw new Error("Popup is not shown");
2084
2091
  }
2092
+ /**
2093
+ * Detect if any of the CMPs has a popup open. Returns a list of CMPs with open popups.
2094
+ */
2085
2095
  async detectPopups(cmps, onFirstPopupAppears) {
2086
2096
  const tasks = cmps.map(
2087
- (cmp) => this.detectPopup(cmp).catch((error) => {
2088
- this.config.logs.errors && console.warn(`error waiting for a popup for ${cmp.name}`, error);
2089
- throw error;
2090
- })
2097
+ (cmp) => this.detectPopup(cmp)
2091
2098
  );
2092
2099
  await Promise.any(tasks).then((cmp) => {
2093
2100
  onFirstPopupAppears(cmp);
@@ -6599,26 +6606,32 @@
6599
6606
  urlPattern: "^https://www\\.reddit\\.com/"
6600
6607
  },
6601
6608
  prehideSelectors: [
6602
- 'section:has(a[href^="https://www.reddit.com/policies/cookies"])'
6609
+ "[bundlename=reddit_cookie_banner]"
6603
6610
  ],
6604
6611
  detectCmp: [
6605
6612
  {
6606
- exists: 'section:has(a[href^="https://www.reddit.com/policies/cookies"])'
6613
+ exists: "reddit-cookie-banner"
6607
6614
  }
6608
6615
  ],
6609
6616
  detectPopup: [
6610
6617
  {
6611
- visible: 'section:has(a[href^="https://www.reddit.com/policies/cookies"])'
6618
+ visible: "reddit-cookie-banner"
6612
6619
  }
6613
6620
  ],
6614
6621
  optIn: [
6615
6622
  {
6616
- waitForThenClick: `section:has(a[href^="https://www.reddit.com/policies/cookies"]) section[class^='_'] > section:first-child form button`
6623
+ waitForThenClick: [
6624
+ "reddit-cookie-banner",
6625
+ "#accept-all-cookies-button > button"
6626
+ ]
6617
6627
  }
6618
6628
  ],
6619
6629
  optOut: [
6620
6630
  {
6621
- waitForThenClick: `section:has(a[href^="https://www.reddit.com/policies/cookies"]) section[class^='_'] > section:last-child form button`
6631
+ waitForThenClick: [
6632
+ "reddit-cookie-banner",
6633
+ "#reject-nonessential-cookies-button > button"
6634
+ ]
6622
6635
  }
6623
6636
  ],
6624
6637
  test: [
@@ -7008,11 +7021,11 @@
7008
7021
  {
7009
7022
  name: "Tealium",
7010
7023
  prehideSelectors: [
7011
- "#__tealiumGDPRecModal,#__tealiumGDPRcpPrefs,#consent-layer"
7024
+ "#__tealiumGDPRecModal,#__tealiumGDPRcpPrefs,#__tealiumImplicitmodal,#consent-layer"
7012
7025
  ],
7013
7026
  detectCmp: [
7014
7027
  {
7015
- exists: "#__tealiumGDPRecModal *,#__tealiumGDPRcpPrefs *"
7028
+ exists: "#__tealiumGDPRecModal *,#__tealiumGDPRcpPrefs *,#__tealiumImplicitmodal *"
7016
7029
  },
7017
7030
  {
7018
7031
  eval: "EVAL_TEALIUM_0"
@@ -7020,7 +7033,7 @@
7020
7033
  ],
7021
7034
  detectPopup: [
7022
7035
  {
7023
- visible: "#__tealiumGDPRecModal *,#__tealiumGDPRcpPrefs *",
7036
+ visible: "#__tealiumGDPRecModal *,#__tealiumGDPRcpPrefs *,#__tealiumImplicitmodal *",
7024
7037
  check: "any"
7025
7038
  }
7026
7039
  ],
@@ -7032,7 +7045,7 @@
7032
7045
  eval: "EVAL_TEALIUM_DONOTSELL"
7033
7046
  },
7034
7047
  {
7035
- hide: "#__tealiumGDPRecModal,#__tealiumGDPRcpPrefs"
7048
+ hide: "#__tealiumGDPRecModal,#__tealiumGDPRcpPrefs,#__tealiumImplicitmodal"
7036
7049
  },
7037
7050
  {
7038
7051
  waitForThenClick: "#cm-acceptNone,.js-accept-essential-cookies",
@@ -7996,6 +8009,42 @@
7996
8009
  }
7997
8010
  ]
7998
8011
  },
8012
+ {
8013
+ name: "webflow",
8014
+ vendorUrl: "https://webflow.com/",
8015
+ prehideSelectors: [
8016
+ ".fs-cc-components"
8017
+ ],
8018
+ detectCmp: [
8019
+ {
8020
+ exists: ".fs-cc-components"
8021
+ }
8022
+ ],
8023
+ detectPopup: [
8024
+ {
8025
+ visible: ".fs-cc-components"
8026
+ },
8027
+ {
8028
+ visible: "[fs-cc=banner]"
8029
+ }
8030
+ ],
8031
+ optIn: [
8032
+ {
8033
+ wait: 500
8034
+ },
8035
+ {
8036
+ waitForThenClick: "[fs-cc=banner] [fs-cc=allow]"
8037
+ }
8038
+ ],
8039
+ optOut: [
8040
+ {
8041
+ wait: 500
8042
+ },
8043
+ {
8044
+ waitForThenClick: "[fs-cc=banner] [fs-cc=deny]"
8045
+ }
8046
+ ]
8047
+ },
7999
8048
  {
8000
8049
  name: "wetransfer.com",
8001
8050
  detectCmp: [
package/lib/web.ts CHANGED
@@ -223,8 +223,14 @@ export default class AutoConsent {
223
223
  return foundCMPs;
224
224
  }
225
225
 
226
+ /**
227
+ * Detect if a CMP has a popup open. Fullfils with the CMP if a popup is open, otherwise rejects.
228
+ */
226
229
  async detectPopup(cmp: AutoCMP): Promise<AutoCMP> {
227
- const isOpen = await this.waitForPopup(cmp);
230
+ const isOpen = await this.waitForPopup(cmp).catch(error => {
231
+ this.config.logs.errors && console.warn(`error waiting for a popup for ${cmp.name}`, error);
232
+ return false;
233
+ });
228
234
 
229
235
  if (isOpen) {
230
236
  this.updateState({ detectedPopups: this.state.detectedPopups.concat([cmp.name]) });
@@ -233,21 +239,18 @@ export default class AutoConsent {
233
239
  cmp: cmp.name,
234
240
  url: location.href,
235
241
  }); // notify the browser
242
+ return cmp;
236
243
  }
237
-
238
- return cmp
244
+ throw new Error('Popup is not shown');
239
245
  }
240
246
 
247
+ /**
248
+ * Detect if any of the CMPs has a popup open. Returns a list of CMPs with open popups.
249
+ */
241
250
  async detectPopups(cmps: AutoCMP[], onFirstPopupAppears: (cmp: AutoCMP) => Promise<unknown>) {
242
251
  const tasks = cmps.map(
243
252
  cmp => this.detectPopup(cmp)
244
- // Handle errors immediately and propagate the error to next handler: Promise.allSettled
245
- .catch(error => {
246
- this.config.logs.errors && console.warn(`error waiting for a popup for ${cmp.name}`, error)
247
-
248
- throw error
249
- })
250
- )
253
+ );
251
254
 
252
255
  await Promise.any(tasks)
253
256
  .then(cmp => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@duckduckgo/autoconsent",
3
- "version": "9.5.0",
3
+ "version": "9.6.0",
4
4
  "description": "",
5
5
  "main": "dist/autoconsent.cjs.js",
6
6
  "module": "dist/autoconsent.esm.js",
@@ -3,18 +3,32 @@
3
3
  "runContext": {
4
4
  "urlPattern": "^https://www\\.reddit\\.com/"
5
5
  },
6
- "prehideSelectors": ["section:has(a[href^=\"https://www.reddit.com/policies/cookies\"])"],
6
+ "prehideSelectors": ["[bundlename=reddit_cookie_banner]"],
7
7
  "detectCmp": [
8
- { "exists": "section:has(a[href^=\"https://www.reddit.com/policies/cookies\"])" }
8
+ {
9
+ "exists": "reddit-cookie-banner"
10
+ }
9
11
  ],
10
12
  "detectPopup": [
11
- { "visible": "section:has(a[href^=\"https://www.reddit.com/policies/cookies\"])" }
13
+ {
14
+ "visible": "reddit-cookie-banner"
15
+ }
12
16
  ],
13
17
  "optIn": [
14
- { "waitForThenClick": "section:has(a[href^=\"https://www.reddit.com/policies/cookies\"]) section[class^='_'] > section:first-child form button" }
18
+ {
19
+ "waitForThenClick": [
20
+ "reddit-cookie-banner",
21
+ "#accept-all-cookies-button > button"
22
+ ]
23
+ }
15
24
  ],
16
25
  "optOut": [
17
- { "waitForThenClick": "section:has(a[href^=\"https://www.reddit.com/policies/cookies\"]) section[class^='_'] > section:last-child form button" }
26
+ {
27
+ "waitForThenClick": [
28
+ "reddit-cookie-banner",
29
+ "#reject-nonessential-cookies-button > button"
30
+ ]
31
+ }
18
32
  ],
19
33
  "test": [
20
34
  {"eval": "EVAL_REDDIT_0"}
@@ -1,17 +1,17 @@
1
1
  {
2
2
  "name": "Tealium",
3
- "prehideSelectors": ["#__tealiumGDPRecModal,#__tealiumGDPRcpPrefs,#consent-layer"],
3
+ "prehideSelectors": ["#__tealiumGDPRecModal,#__tealiumGDPRcpPrefs,#__tealiumImplicitmodal,#consent-layer"],
4
4
  "detectCmp": [
5
- { "exists": "#__tealiumGDPRecModal *,#__tealiumGDPRcpPrefs *" },
5
+ { "exists": "#__tealiumGDPRecModal *,#__tealiumGDPRcpPrefs *,#__tealiumImplicitmodal *" },
6
6
  { "eval": "EVAL_TEALIUM_0" }
7
7
  ],
8
8
  "detectPopup": [
9
- { "visible": "#__tealiumGDPRecModal *,#__tealiumGDPRcpPrefs *", "check": "any" }
9
+ { "visible": "#__tealiumGDPRecModal *,#__tealiumGDPRcpPrefs *,#__tealiumImplicitmodal *", "check": "any" }
10
10
  ],
11
11
  "optOut": [
12
12
  { "eval": "EVAL_TEALIUM_1" },
13
13
  { "eval": "EVAL_TEALIUM_DONOTSELL" },
14
- { "hide": "#__tealiumGDPRecModal,#__tealiumGDPRcpPrefs" },
14
+ { "hide": "#__tealiumGDPRecModal,#__tealiumGDPRcpPrefs,#__tealiumImplicitmodal" },
15
15
  {
16
16
  "waitForThenClick": "#cm-acceptNone,.js-accept-essential-cookies",
17
17
  "timeout": 1000,
@@ -0,0 +1,34 @@
1
+ {
2
+ "name": "webflow",
3
+ "vendorUrl": "https://webflow.com/",
4
+ "prehideSelectors": [".fs-cc-components"],
5
+ "detectCmp": [
6
+ {
7
+ "exists": ".fs-cc-components"
8
+ }
9
+ ],
10
+ "detectPopup": [
11
+ {
12
+ "visible": ".fs-cc-components"
13
+ },
14
+ {
15
+ "visible": "[fs-cc=banner]"
16
+ }
17
+ ],
18
+ "optIn": [
19
+ {
20
+ "wait": 500
21
+ },
22
+ {
23
+ "waitForThenClick": "[fs-cc=banner] [fs-cc=allow]"
24
+ }
25
+ ],
26
+ "optOut": [
27
+ {
28
+ "wait": 500
29
+ },
30
+ {
31
+ "waitForThenClick": "[fs-cc=banner] [fs-cc=deny]"
32
+ }
33
+ ]
34
+ }
package/rules/rules.json CHANGED
@@ -4312,26 +4312,32 @@
4312
4312
  "urlPattern": "^https://www\\.reddit\\.com/"
4313
4313
  },
4314
4314
  "prehideSelectors": [
4315
- "section:has(a[href^=\"https://www.reddit.com/policies/cookies\"])"
4315
+ "[bundlename=reddit_cookie_banner]"
4316
4316
  ],
4317
4317
  "detectCmp": [
4318
4318
  {
4319
- "exists": "section:has(a[href^=\"https://www.reddit.com/policies/cookies\"])"
4319
+ "exists": "reddit-cookie-banner"
4320
4320
  }
4321
4321
  ],
4322
4322
  "detectPopup": [
4323
4323
  {
4324
- "visible": "section:has(a[href^=\"https://www.reddit.com/policies/cookies\"])"
4324
+ "visible": "reddit-cookie-banner"
4325
4325
  }
4326
4326
  ],
4327
4327
  "optIn": [
4328
4328
  {
4329
- "waitForThenClick": "section:has(a[href^=\"https://www.reddit.com/policies/cookies\"]) section[class^='_'] > section:first-child form button"
4329
+ "waitForThenClick": [
4330
+ "reddit-cookie-banner",
4331
+ "#accept-all-cookies-button > button"
4332
+ ]
4330
4333
  }
4331
4334
  ],
4332
4335
  "optOut": [
4333
4336
  {
4334
- "waitForThenClick": "section:has(a[href^=\"https://www.reddit.com/policies/cookies\"]) section[class^='_'] > section:last-child form button"
4337
+ "waitForThenClick": [
4338
+ "reddit-cookie-banner",
4339
+ "#reject-nonessential-cookies-button > button"
4340
+ ]
4335
4341
  }
4336
4342
  ],
4337
4343
  "test": [
@@ -4721,11 +4727,11 @@
4721
4727
  {
4722
4728
  "name": "Tealium",
4723
4729
  "prehideSelectors": [
4724
- "#__tealiumGDPRecModal,#__tealiumGDPRcpPrefs,#consent-layer"
4730
+ "#__tealiumGDPRecModal,#__tealiumGDPRcpPrefs,#__tealiumImplicitmodal,#consent-layer"
4725
4731
  ],
4726
4732
  "detectCmp": [
4727
4733
  {
4728
- "exists": "#__tealiumGDPRecModal *,#__tealiumGDPRcpPrefs *"
4734
+ "exists": "#__tealiumGDPRecModal *,#__tealiumGDPRcpPrefs *,#__tealiumImplicitmodal *"
4729
4735
  },
4730
4736
  {
4731
4737
  "eval": "EVAL_TEALIUM_0"
@@ -4733,7 +4739,7 @@
4733
4739
  ],
4734
4740
  "detectPopup": [
4735
4741
  {
4736
- "visible": "#__tealiumGDPRecModal *,#__tealiumGDPRcpPrefs *",
4742
+ "visible": "#__tealiumGDPRecModal *,#__tealiumGDPRcpPrefs *,#__tealiumImplicitmodal *",
4737
4743
  "check": "any"
4738
4744
  }
4739
4745
  ],
@@ -4745,7 +4751,7 @@
4745
4751
  "eval": "EVAL_TEALIUM_DONOTSELL"
4746
4752
  },
4747
4753
  {
4748
- "hide": "#__tealiumGDPRecModal,#__tealiumGDPRcpPrefs"
4754
+ "hide": "#__tealiumGDPRecModal,#__tealiumGDPRcpPrefs,#__tealiumImplicitmodal"
4749
4755
  },
4750
4756
  {
4751
4757
  "waitForThenClick": "#cm-acceptNone,.js-accept-essential-cookies",
@@ -5709,6 +5715,42 @@
5709
5715
  }
5710
5716
  ]
5711
5717
  },
5718
+ {
5719
+ "name": "webflow",
5720
+ "vendorUrl": "https://webflow.com/",
5721
+ "prehideSelectors": [
5722
+ ".fs-cc-components"
5723
+ ],
5724
+ "detectCmp": [
5725
+ {
5726
+ "exists": ".fs-cc-components"
5727
+ }
5728
+ ],
5729
+ "detectPopup": [
5730
+ {
5731
+ "visible": ".fs-cc-components"
5732
+ },
5733
+ {
5734
+ "visible": "[fs-cc=banner]"
5735
+ }
5736
+ ],
5737
+ "optIn": [
5738
+ {
5739
+ "wait": 500
5740
+ },
5741
+ {
5742
+ "waitForThenClick": "[fs-cc=banner] [fs-cc=allow]"
5743
+ }
5744
+ ],
5745
+ "optOut": [
5746
+ {
5747
+ "wait": 500
5748
+ },
5749
+ {
5750
+ "waitForThenClick": "[fs-cc=banner] [fs-cc=deny]"
5751
+ }
5752
+ ]
5753
+ },
5712
5754
  {
5713
5755
  "name": "wetransfer.com",
5714
5756
  "detectCmp": [
@@ -0,0 +1,7 @@
1
+ import generateCMPTests from "../playwright/runner";
2
+
3
+ generateCMPTests('webflow', [
4
+ 'https://www.nexaas.com/',
5
+ 'https://www.boltive.com/',
6
+ 'https://www.hk.co/',
7
+ ]);