@duckduckgo/autoconsent 1.0.6 → 2.0.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 (165) hide show
  1. package/.eslintrc.cjs +14 -0
  2. package/.vscode/settings.json +7 -0
  3. package/Jenkinsfile +68 -39
  4. package/api.md +104 -0
  5. package/dist/autoconsent.cjs.js +1 -1371
  6. package/dist/autoconsent.esm.js +1 -1363
  7. package/dist/autoconsent.playwright.js +1 -0
  8. package/dist/autoconsent.standalone.js +1 -0
  9. package/lib/cmps/all.ts +15 -10
  10. package/lib/cmps/base.ts +91 -91
  11. package/lib/cmps/consentmanager.ts +31 -19
  12. package/lib/cmps/consentomatic.ts +89 -0
  13. package/lib/cmps/cookiebot.ts +62 -53
  14. package/lib/cmps/evidon.ts +29 -18
  15. package/lib/cmps/onetrust.ts +37 -19
  16. package/lib/cmps/sourcepoint-frame.ts +102 -0
  17. package/lib/cmps/sourcepoint-top.ts +47 -0
  18. package/lib/cmps/trustarc-frame.ts +115 -0
  19. package/lib/cmps/trustarc-top.ts +91 -0
  20. package/lib/consentomatic/index.ts +233 -70
  21. package/lib/{web/consentomatic → consentomatic}/tools.ts +0 -0
  22. package/lib/eval-handler.ts +58 -0
  23. package/lib/index.ts +0 -2
  24. package/lib/messages.ts +100 -0
  25. package/lib/rule-executors.ts +108 -0
  26. package/lib/rules.ts +82 -0
  27. package/lib/types.ts +35 -0
  28. package/lib/utils.ts +64 -0
  29. package/lib/web.ts +283 -74
  30. package/package.json +17 -14
  31. package/playwright/content.ts +27 -0
  32. package/playwright/runner.ts +131 -0
  33. package/playwright/standalone.ts +36 -0
  34. package/playwright.config.ts +7 -0
  35. package/readme.md +57 -47
  36. package/rollup.config.js +23 -15
  37. package/rules/autoconsent/192.json +17 -0
  38. package/rules/autoconsent/ausopen.json +7 -0
  39. package/rules/autoconsent/aws-amazon.json +1 -1
  40. package/rules/autoconsent/baden-wuerttemberg-de.json +7 -3
  41. package/rules/autoconsent/bing.json +14 -0
  42. package/rules/autoconsent/bundesregierung-de.json +6 -2
  43. package/rules/autoconsent/cc-banner.json +0 -1
  44. package/rules/autoconsent/cookie-notice.json +0 -1
  45. package/rules/autoconsent/cookieconsent.json +5 -6
  46. package/rules/autoconsent/destatis-de.json +0 -1
  47. package/rules/autoconsent/dunelm.json +18 -0
  48. package/rules/autoconsent/etsy.json +3 -2
  49. package/rules/autoconsent/eu-cookie-compliance.json +0 -1
  50. package/rules/autoconsent/gov-uk.json +10 -0
  51. package/rules/autoconsent/hl-co-uk.json +8 -9
  52. package/rules/autoconsent/johnlewis.json +5 -2
  53. package/rules/autoconsent/marksandspencer.json +7 -0
  54. package/rules/autoconsent/notice-cookie.json +0 -1
  55. package/rules/autoconsent/osano.json +0 -1
  56. package/rules/autoconsent/{paypal-de.json → paypal.json} +6 -2
  57. package/rules/autoconsent/tealium.json +4 -5
  58. package/rules/autoconsent/uswitch.json +8 -0
  59. package/rules/autoconsent/waitrose.json +28 -0
  60. package/rules/autoconsent/wetransfer.json +7 -0
  61. package/rules/rules.json +314 -39
  62. package/tests/192.spec.ts +7 -0
  63. package/tests/arzt-auskunft.spec.ts +1 -1
  64. package/tests/asus.spec.ts +1 -1
  65. package/tests/ausopen.spec.ts +7 -0
  66. package/tests/aws.amazon.spec.ts +1 -1
  67. package/tests/baden-wuerttemberg.spec.ts +1 -1
  68. package/tests/borlabs.spec.ts +1 -1
  69. package/tests/bundesregierung.spec.ts +5 -2
  70. package/tests/ccbanner.spec.ts +1 -1
  71. package/tests/consentmanager.spec.ts +3 -3
  72. package/tests/cookiebot.spec.ts +8 -1
  73. package/tests/cookieconsent.spec.ts +1 -1
  74. package/tests/cookielawinfo.spec.ts +1 -1
  75. package/tests/cookienotice.spec.ts +1 -1
  76. package/tests/corona-in-zahlen.spec.ts +1 -1
  77. package/tests/deepl.spec.ts +1 -1
  78. package/tests/destatis.spec.ts +1 -1
  79. package/tests/didomi.spec.ts +6 -2
  80. package/tests/drupal.spec.ts +8 -0
  81. package/tests/dunelm.spec.ts +7 -0
  82. package/tests/etsy.spec.ts +1 -1
  83. package/tests/eu-cookie-compliance-banner.spec.ts +1 -1
  84. package/tests/evidon.spec.ts +1 -1
  85. package/tests/fundingchoices.spec.ts +2 -1
  86. package/tests/gov-uk.spec.ts +9 -0
  87. package/tests/hl-co-uk.spec.ts +1 -1
  88. package/tests/hubspot.spec.ts +1 -1
  89. package/tests/ionos.spec.ts +1 -1
  90. package/tests/johnlewis.spec.ts +2 -2
  91. package/tests/klaro.spec.ts +1 -1
  92. package/tests/marksandspencer.spec.ts +7 -0
  93. package/tests/mediamarkt.spec.ts +1 -1
  94. package/tests/metoffice-gov-uk.spec.ts +1 -1
  95. package/tests/microsoft.spec.ts +1 -1
  96. package/tests/moneysavingexpert.spec.ts +1 -1
  97. package/tests/motor-talk.spec.ts +1 -1
  98. package/tests/national-lottery.spec.ts +1 -1
  99. package/tests/netflix.spec.ts +1 -1
  100. package/tests/nhs.spec.ts +1 -1
  101. package/tests/notice-cookie.spec.ts +1 -1
  102. package/tests/obi.spec.ts +1 -1
  103. package/tests/oil.spec.ts +1 -1
  104. package/tests/onetrust.spec.ts +10 -1
  105. package/tests/osano.spec.ts +1 -1
  106. package/tests/otto.spec.ts +1 -1
  107. package/tests/paypal.spec.ts +8 -6
  108. package/tests/quantcast.spec.ts +4 -1
  109. package/tests/snigel.spec.ts +1 -1
  110. package/tests/sourcepoint.spec.ts +8 -8
  111. package/tests/springer.spec.ts +1 -1
  112. package/tests/steampowered.spec.ts +1 -1
  113. package/tests/tealium.spec.ts +1 -1
  114. package/tests/testcmp.spec.ts +1 -1
  115. package/tests/thalia.spec.ts +1 -1
  116. package/tests/thefreedictionary.spec.ts +1 -1
  117. package/tests/trustarc.spec.ts +25 -3
  118. package/tests/usercentrics-1.spec.ts +1 -1
  119. package/tests/uswitch.spec.ts +7 -0
  120. package/tests/vodafone.spec.ts +1 -1
  121. package/tests/waitrose.spec.ts +7 -0
  122. package/tests/wetransfer.spec.ts +7 -0
  123. package/tests/wordpressgdpr.spec.ts +1 -1
  124. package/tests/xing.spec.ts +1 -1
  125. package/tsconfig.json +2 -2
  126. package/.eslintrc +0 -12
  127. package/cosmetics/rules.json +0 -110
  128. package/dist/autoconsent.puppet.js +0 -1072
  129. package/lib/cmps/all.js +0 -19
  130. package/lib/cmps/base.js +0 -174
  131. package/lib/cmps/consentmanager.js +0 -31
  132. package/lib/cmps/cookiebot.js +0 -73
  133. package/lib/cmps/evidon.js +0 -26
  134. package/lib/cmps/onetrust.js +0 -32
  135. package/lib/cmps/sourcepoint.js +0 -82
  136. package/lib/cmps/sourcepoint.ts +0 -95
  137. package/lib/cmps/trustarc.js +0 -106
  138. package/lib/cmps/trustarc.ts +0 -147
  139. package/lib/config.js +0 -1
  140. package/lib/consentomatic/index.js +0 -52
  141. package/lib/detector.js +0 -33
  142. package/lib/detector.ts +0 -34
  143. package/lib/hider.js +0 -13
  144. package/lib/hider.ts +0 -16
  145. package/lib/index.js +0 -4
  146. package/lib/messages.d.ts +0 -61
  147. package/lib/node.js +0 -35
  148. package/lib/node.ts +0 -43
  149. package/lib/puppet/tab.js +0 -121
  150. package/lib/puppet/tab.ts +0 -146
  151. package/lib/rules.d.ts +0 -80
  152. package/lib/tabwrapper.js +0 -67
  153. package/lib/tabwrapper.ts +0 -74
  154. package/lib/types.d.ts +0 -61
  155. package/lib/web/consentomatic/index.js +0 -188
  156. package/lib/web/consentomatic/index.ts +0 -249
  157. package/lib/web/consentomatic/tools.js +0 -177
  158. package/lib/web/content-utils.js +0 -29
  159. package/lib/web/content-utils.ts +0 -31
  160. package/lib/web/content.js +0 -79
  161. package/lib/web/content.ts +0 -71
  162. package/lib/web/tab.js +0 -112
  163. package/lib/web/tab.ts +0 -178
  164. package/lib/web.js +0 -95
  165. package/tests/runner.ts +0 -61
@@ -1,6 +1,6 @@
1
1
  {
2
- "name": "hl.co.uk",
3
- "prehideSelectors": [".cookieModalContent", "#cookie-banner-overlay"],
2
+ "name": "hl.co.uk",
3
+ "prehideSelectors": [".cookieModalContent", "#cookie-banner-overlay"],
4
4
  "detectCmp": [{ "exists": "#cookie-banner-overlay" }],
5
5
  "detectPopup": [{ "exists": "#cookie-banner-overlay" }],
6
6
  "optIn": [{ "click": "#acceptCookieButton" }],
@@ -12,19 +12,18 @@
12
12
  "hide": [".cookieSettingsModal"]
13
13
  },
14
14
  {
15
- "wait": 500
15
+ "waitFor": "#AOCookieToggle"
16
16
  },
17
17
  {
18
- "click": "#AOCookieToggle"
18
+ "click": "#AOCookieToggle[aria-pressed=true]",
19
+ "optional": true
19
20
  },
20
21
  {
21
- "eval": "document.querySelector('#AOCookieToggle').getAttribute('aria-pressed') === 'false'"
22
+ "waitFor": "#TPCookieToggle"
22
23
  },
23
24
  {
24
- "click": "#TPCookieToggle"
25
- },
26
- {
27
- "eval": "document.querySelector('#TPCookieToggle').getAttribute('aria-pressed') === 'false'"
25
+ "click": "#TPCookieToggle[aria-pressed=true]",
26
+ "optional": true
28
27
  },
29
28
  {
30
29
  "click": "#updateCookieButton"
@@ -6,8 +6,11 @@
6
6
  "optOut": [
7
7
  {"click": "button[data-test^=manage-cookies]"},
8
8
  {"wait": "500"},
9
- {"eval": "!!Array.from(document.querySelectorAll('label[data-test^=toggle]')).forEach(e => e.click())", "optional": true },
10
- {"eval": "Array.from(document.querySelectorAll('label[data-test^=toggle]')).filter(e => e.className.match('checked') && !e.className.match('disabled')).length === 0"},
9
+ {
10
+ "click": "label[data-test^=toggle][class*=checked]:not([class*=disabled])",
11
+ "all": true,
12
+ "optional": true
13
+ },
11
14
  {"click": "button[data-test=save-preferences]"}
12
15
  ],
13
16
  "optIn": [{ "click": "button[data-test=allow-all]"}]
@@ -0,0 +1,7 @@
1
+ {
2
+ "name": "marksandspencer.com",
3
+ "isHidingRule": true,
4
+ "detectCmp": [{ "exists": ".navigation-cookiebbanner" }],
5
+ "detectPopup": [{ "visible": ".navigation-cookiebbanner" }],
6
+ "optOut": [{ "hide": [".navigation-cookiebbanner"]}]
7
+ }
@@ -1,7 +1,6 @@
1
1
  {
2
2
  "name": "notice-cookie",
3
3
  "prehideSelectors": [".button--notice"],
4
- "isHidingRule": true,
5
4
  "detectCmp": [{ "exists": ".notice--cookie" }],
6
5
  "detectPopup": [{ "visible": ".notice--cookie" }],
7
6
  "optIn": [{ "click": ".button--notice" }],
@@ -1,7 +1,6 @@
1
1
  {
2
2
  "name": "osano",
3
3
  "prehideSelectors": [".osano-cm-window"],
4
- "isHidingRule": true,
5
4
  "detectCmp": [{ "exists": ".osano-cm-window" }],
6
5
  "detectPopup": [{ "visible": ".osano-cm-dialog" }],
7
6
  "optIn": [{ "click": ".osano-cm-accept-all" }],
@@ -1,12 +1,16 @@
1
1
  {
2
- "name": "paypal.de",
2
+ "name": "paypal.com",
3
3
  "prehideSelectors": ["#gdprCookieBanner"],
4
4
  "detectCmp": [{ "exists": "#gdprCookieBanner"}],
5
5
  "detectPopup": [{ "visible": "#gdprCookieContent_wrapper" }],
6
6
  "optIn": [{ "click": "#acceptAllButton" }],
7
7
  "optOut": [
8
+ {
9
+ "wait": 200
10
+ },
8
11
  {
9
12
  "click": ".gdprCookieBanner_decline-button"
10
13
  }
11
- ]
14
+ ],
15
+ "test": [{"eval": "document.cookie.includes('cookie_prefs') === true"}]
12
16
  }
@@ -1,19 +1,18 @@
1
1
  {
2
2
  "name": "Tealium",
3
3
  "prehideSelectors": ["#__tealiumGDPRecModal,#__tealiumGDPRcpPrefs,#consent-layer"],
4
- "isHidingRule": false,
5
- "detectCmp": [{ "exists": "#__tealiumGDPRecModal" }, { "eval": "window.utag && typeof utag.gdpr === 'object'" }],
4
+ "detectCmp": [{ "visible": "#__tealiumGDPRecModal" }, { "eval": "typeof window.utag !== 'undefined' && typeof utag.gdpr === 'object'" }],
6
5
  "detectPopup": [{ "visible": "#__tealiumGDPRecModal" }],
7
6
  "optOut": [
8
7
  { "hide": ["#__tealiumGDPRecModal", "#__tealiumGDPRcpPrefs", "#consent-layer"] },
9
- { "click": "#cm-acceptNone,.js-accept-essential-cookies"}
8
+ { "waitForThenClick": "#cm-acceptNone,.js-accept-essential-cookies", "timeout": 1000 },
9
+ { "eval": "utag.gdpr.setConsentValue(false) || true" }
10
10
  ],
11
11
  "optIn": [
12
12
  { "hide": ["#__tealiumGDPRecModal"] },
13
- { "eval": "utag.gdpr.setConsentValue(true)" }
13
+ { "eval": "utag.gdpr.setConsentValue(true) || true" }
14
14
  ],
15
15
  "test": [
16
16
  { "eval": "utag.gdpr.getConsentState() !== 1" }
17
17
  ]
18
18
  }
19
-
@@ -0,0 +1,8 @@
1
+ {
2
+ "name": "uswitch.com",
3
+ "prehideSelectors": ["#cookie-banner-wrapper"],
4
+ "detectCmp": [{ "exists": "#cookie-banner-wrapper"}],
5
+ "detectPopup": [{ "visible": "#cookie-banner-wrapper" }],
6
+ "optIn": [{ "click": "#cookie_banner_accept_mobile" }],
7
+ "optOut": [{ "click": "#cookie_banner_save"}]
8
+ }
@@ -0,0 +1,28 @@
1
+ {
2
+ "name": "waitrose.com",
3
+ "prehideSelectors": [
4
+ "div[aria-labelledby=CookieAlertModalHeading]",
5
+ "section[data-test=initial-waitrose-cookie-consent-banner]",
6
+ "section[data-test=cookie-consent-modal]"
7
+ ],
8
+ "detectCmp": [{ "exists": "section[data-test=initial-waitrose-cookie-consent-banner]"}],
9
+ "detectPopup": [{ "visible": "section[data-test=initial-waitrose-cookie-consent-banner]" }],
10
+ "optIn": [{ "click": "button[data-test=accept-all]" }],
11
+ "optOut": [
12
+ {
13
+ "click": "button[data-test=manage-cookies]"
14
+ },
15
+ {
16
+ "wait": 200
17
+ },
18
+ {
19
+ "eval": "Array.from(document.querySelectorAll('label[id$=cookies-deny-label]')).forEach(e => e.click()) || true"
20
+ },
21
+ {
22
+ "click": "button[data-test=submit]"
23
+ }
24
+ ],
25
+ "test": [
26
+ {"eval": "document.cookie.includes('wtr_cookies_advertising=0') && document.cookie.includes('wtr_cookies_analytics=0')"}
27
+ ]
28
+ }
@@ -0,0 +1,7 @@
1
+ {
2
+ "name": "wetransfer.com",
3
+ "detectCmp": [{ "exists": ".welcome__cookie-notice"}],
4
+ "detectPopup": [{ "visible": ".welcome__cookie-notice" }],
5
+ "optIn": [{ "click": ".welcome__button--accept" }],
6
+ "optOut": [{ "click": ".welcome__button--decline"}]
7
+ }