@duckduckgo/autoconsent 10.3.1 → 10.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.
@@ -1210,7 +1210,7 @@ var SourcePoint = class extends AutoConsentCMPBase {
1210
1210
  this.ccpaNotice = false;
1211
1211
  this.ccpaPopup = false;
1212
1212
  this.runContext = {
1213
- main: false,
1213
+ main: true,
1214
1214
  frame: true
1215
1215
  };
1216
1216
  }
@@ -1750,6 +1750,63 @@ var Airbnb = class extends AutoConsentCMPBase {
1750
1750
  }
1751
1751
  };
1752
1752
 
1753
+ // lib/cmps/tumblr-com.ts
1754
+ var Tumblr = class extends AutoConsentCMPBase {
1755
+ constructor() {
1756
+ super(...arguments);
1757
+ this.name = "tumblr-com";
1758
+ this.runContext = {
1759
+ "urlPattern": "^https://(www\\.)?tumblr\\.com/"
1760
+ };
1761
+ }
1762
+ get hasSelfTest() {
1763
+ return false;
1764
+ }
1765
+ get isIntermediate() {
1766
+ return false;
1767
+ }
1768
+ get isCosmetic() {
1769
+ return false;
1770
+ }
1771
+ get prehideSelectors() {
1772
+ return ["#cmp-app-container"];
1773
+ }
1774
+ async detectCmp() {
1775
+ return this.elementExists("#cmp-app-container");
1776
+ }
1777
+ async detectPopup() {
1778
+ return this.elementVisible("#cmp-app-container", "any");
1779
+ }
1780
+ async optOut() {
1781
+ let iframe = document.querySelector("#cmp-app-container iframe");
1782
+ let settingsButton = iframe.contentDocument?.querySelector(".cmp-components-button.is-secondary");
1783
+ if (!settingsButton) {
1784
+ return false;
1785
+ }
1786
+ settingsButton.click();
1787
+ await waitFor(() => {
1788
+ const iframe2 = document.querySelector("#cmp-app-container iframe");
1789
+ return !!iframe2.contentDocument?.querySelector(".cmp__dialog input");
1790
+ }, 5, 500);
1791
+ iframe = document.querySelector("#cmp-app-container iframe");
1792
+ settingsButton = iframe.contentDocument?.querySelector(".cmp-components-button.is-secondary");
1793
+ if (!settingsButton) {
1794
+ return false;
1795
+ }
1796
+ settingsButton.click();
1797
+ return true;
1798
+ }
1799
+ async optIn() {
1800
+ const iframe = document.querySelector("#cmp-app-container iframe");
1801
+ const acceptButton = iframe.contentDocument.querySelector(".cmp-components-button.is-primary");
1802
+ if (acceptButton) {
1803
+ acceptButton.click();
1804
+ return true;
1805
+ }
1806
+ return false;
1807
+ }
1808
+ };
1809
+
1753
1810
  // lib/cmps/all.ts
1754
1811
  var dynamicCMPs = [
1755
1812
  TrustArcTop,
@@ -1763,7 +1820,8 @@ var dynamicCMPs = [
1763
1820
  Uniconsent,
1764
1821
  Conversant,
1765
1822
  Tiktok,
1766
- Airbnb
1823
+ Airbnb,
1824
+ Tumblr
1767
1825
  ];
1768
1826
 
1769
1827
  // lib/dom-actions.ts
@@ -2238,12 +2296,7 @@ var AutoConsent = class {
2238
2296
  const globalHidden = [
2239
2297
  "#didomi-popup,.didomi-popup-container,.didomi-popup-notice,.didomi-consent-popup-preferences,#didomi-notice,.didomi-popup-backdrop,.didomi-screen-medium"
2240
2298
  ];
2241
- const selectors = this.rules.reduce((selectorList, rule) => {
2242
- if (rule.prehideSelectors) {
2243
- return [...selectorList, ...rule.prehideSelectors];
2244
- }
2245
- return selectorList;
2246
- }, globalHidden);
2299
+ const selectors = this.rules.filter((rule) => rule.prehideSelectors && rule.checkRunContext()).reduce((selectorList, rule) => [...selectorList, ...rule.prehideSelectors], globalHidden);
2247
2300
  this.updateState({ prehideOn: true });
2248
2301
  setTimeout(() => {
2249
2302
  if (this.config.enablePrehide && this.state.prehideOn && !["runningOptOut", "runningOptIn"].includes(this.state.lifecycle)) {