@duckduckgo/autoconsent 2.2.1 → 3.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 (62) hide show
  1. package/Jenkinsfile +2 -2
  2. package/dist/addon-firefox/background.bundle.js +1 -1
  3. package/dist/addon-firefox/content.bundle.js +1 -1
  4. package/dist/addon-firefox/manifest.json +1 -1
  5. package/dist/addon-firefox/rules.json +404 -7
  6. package/dist/addon-mv3/background.bundle.js +1 -1
  7. package/dist/addon-mv3/content.bundle.js +1 -1
  8. package/dist/addon-mv3/manifest.json +2 -1
  9. package/dist/addon-mv3/popup.bundle.js +1 -0
  10. package/dist/addon-mv3/popup.html +67 -0
  11. package/dist/addon-mv3/rules.json +404 -7
  12. package/dist/autoconsent.cjs.js +1 -1
  13. package/dist/autoconsent.esm.js +1 -1
  14. package/dist/autoconsent.playwright.js +1 -1
  15. package/lib/cmps/airbnb.ts +57 -0
  16. package/lib/cmps/all.ts +4 -0
  17. package/lib/cmps/base.ts +2 -2
  18. package/lib/cmps/tiktok.ts +73 -0
  19. package/lib/cmps/trustarc-frame.ts +1 -1
  20. package/lib/rule-executors.ts +15 -15
  21. package/lib/rules.ts +1 -1
  22. package/package.json +2 -2
  23. package/playwright/runner.ts +8 -2
  24. package/playwright.config.ts +9 -0
  25. package/readme.md +5 -1
  26. package/rollup.config.js +16 -2
  27. package/rules/autoconsent/amazon.json +20 -0
  28. package/rules/autoconsent/dailymotion.json +22 -0
  29. package/rules/autoconsent/dmgmedia.json +19 -0
  30. package/rules/autoconsent/facebook.json +21 -0
  31. package/rules/autoconsent/google-consent-standalone.json +17 -0
  32. package/rules/autoconsent/google.json +22 -0
  33. package/rules/autoconsent/linkedin.json +23 -0
  34. package/rules/autoconsent/monzo-com.json +1 -6
  35. package/rules/autoconsent/privacymanager.json +1 -1
  36. package/rules/autoconsent/reddit.json +22 -0
  37. package/rules/autoconsent/twitter.json +22 -0
  38. package/rules/autoconsent/vodafone-de.json +1 -1
  39. package/rules/autoconsent/youtube-desktop.json +23 -0
  40. package/rules/autoconsent/youtube-mobile.json +22 -0
  41. package/rules/rules.json +404 -7
  42. package/tests/airbnb.spec.ts +8 -0
  43. package/tests/amazon.spec.ts +17 -0
  44. package/tests/complianz-categories.spec.ts +1 -1
  45. package/tests/dailymotion.spec.ts +14 -0
  46. package/tests/dmgmedia.spec.ts +16 -0
  47. package/tests/facebook.spec.ts +14 -0
  48. package/tests/google.spec.ts +7 -0
  49. package/tests/linkedin.spec.ts +7 -0
  50. package/tests/reddit.spec.ts +8 -0
  51. package/tests/sibbo.spec.ts +0 -1
  52. package/tests/tiktok.spec.ts +14 -0
  53. package/tests/twitter.spec.ts +16 -0
  54. package/tests/wp-cookie-notice.spec.ts +1 -1
  55. package/tests/youtube-desktop.spec.ts +7 -0
  56. package/tests/youtube-mobile.spec.ts +8 -0
  57. package/.vscode/.idea/.vscode.iml +0 -9
  58. package/.vscode/.idea/modules.xml +0 -8
  59. package/.vscode/.idea/workspace.xml +0 -28
  60. package/.vscode/settings.json +0 -7
  61. package/lib/web/consentomatic/index.js +0 -188
  62. package/lib/web/consentomatic/tools.js +0 -177
@@ -0,0 +1,67 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <style>
5
+ html {
6
+ min-height: 10em;
7
+ min-width: 20em;
8
+ }
9
+ #proceed {
10
+ width: 100%;
11
+ height: 3em;
12
+ margin: 1em auto;
13
+ cursor: pointer;
14
+ border-radius: 3px;
15
+ }
16
+ </style>
17
+ </head>
18
+ <body>
19
+ <fieldset>
20
+ <div>
21
+ <input type="checkbox" id="enabled" name="enabled" checked>
22
+ <label for="enabled">Enable autoconsent</label>
23
+ </div>
24
+ </fieldset>
25
+ <fieldset>
26
+ <legend>Select autoconsent mode:</legend>
27
+
28
+ <div>
29
+ <input type="radio" id="optout" name="mode" value="optOut"
30
+ checked>
31
+ <label for="optout">Reject cookies when possible</label>
32
+ </div>
33
+
34
+ <div>
35
+ <input type="radio" id="optin" name="mode" value="optIn">
36
+ <label for="optin">Accept all cookies</label>
37
+ </div>
38
+
39
+ <div>
40
+ <input type="radio" id="prompt" name="mode" value="null">
41
+ <label for="prompt">Prompt every time</label>
42
+ </div>
43
+ </fieldset>
44
+ <fieldset>
45
+ <legend>Hide popups during operation</legend>
46
+
47
+ <div>
48
+ <input type="radio" id="prehide-on" name="prehide" value="true"
49
+ checked>
50
+ <label for="prehide-on">On</label>
51
+ </div>
52
+
53
+ <div>
54
+ <input type="radio" id="prehide-off" name="prehide" value="false">
55
+ <label for="prehide-off">Off</label>
56
+ </div>
57
+ </fieldset>
58
+ <fieldset>
59
+ <legend>Other</legend>
60
+ <div>
61
+ <input type="number" id="retries" name="retries" value="20">
62
+ <label for="retries">Detection attempts</label>
63
+ </div>
64
+ </fieldset>
65
+ <script src="popup.bundle.js"></script>
66
+ </body>
67
+ </html>
@@ -106,6 +106,44 @@
106
106
  }
107
107
  ]
108
108
  },
109
+ {
110
+ "name": "amazon.com",
111
+ "prehideSelectors": [
112
+ "span[data-action=\"sp-cc\"][data-sp-cc*=\"rejectAllAction\"]"
113
+ ],
114
+ "detectCmp": [
115
+ {
116
+ "exists": "span[data-action=\"sp-cc\"][data-sp-cc*=\"rejectAllAction\"]"
117
+ }
118
+ ],
119
+ "detectPopup": [
120
+ {
121
+ "visible": "span[data-action=\"sp-cc\"][data-sp-cc*=\"rejectAllAction\"]"
122
+ }
123
+ ],
124
+ "optIn": [
125
+ {
126
+ "waitForVisible": "#sp-cc-accept"
127
+ },
128
+ {
129
+ "wait": 500
130
+ },
131
+ {
132
+ "click": "#sp-cc-accept"
133
+ }
134
+ ],
135
+ "optOut": [
136
+ {
137
+ "waitForVisible": "#sp-cc-rejectall-link"
138
+ },
139
+ {
140
+ "wait": 500
141
+ },
142
+ {
143
+ "click": "#sp-cc-rejectall-link"
144
+ }
145
+ ]
146
+ },
109
147
  {
110
148
  "name": "arzt-auskunft.de",
111
149
  "prehideSelectors": [
@@ -756,6 +794,40 @@
756
794
  }
757
795
  ]
758
796
  },
797
+ {
798
+ "name": "dailymotion.com",
799
+ "runContext": {
800
+ "urlPattern": "^https://(www\\.)?dailymotion\\.com/"
801
+ },
802
+ "prehideSelectors": [
803
+ "div[class*=\"Overlay__container\"]:has(div[class*=\"TCF2Popup\"])"
804
+ ],
805
+ "detectCmp": [
806
+ {
807
+ "exists": "div[class*=\"TCF2Popup\"]"
808
+ }
809
+ ],
810
+ "detectPopup": [
811
+ {
812
+ "visible": "[class*=\"TCF2Popup\"] a[href^=\"https://www.dailymotion.com/legal/cookiemanagement\"]"
813
+ }
814
+ ],
815
+ "optIn": [
816
+ {
817
+ "waitForThenClick": "button[class*=\"TCF2Popup__button\"]:not([class*=\"TCF2Popup__personalize\"])"
818
+ }
819
+ ],
820
+ "optOut": [
821
+ {
822
+ "waitForThenClick": "button[class*=\"TCF2ContinueWithoutAcceptingButton\"]"
823
+ }
824
+ ],
825
+ "test": [
826
+ {
827
+ "eval": "!!document.cookie.match('dm-euconsent-v2')"
828
+ }
829
+ ]
830
+ },
759
831
  {
760
832
  "name": "deepl.com",
761
833
  "prehideSelectors": [
@@ -782,6 +854,42 @@
782
854
  }
783
855
  ]
784
856
  },
857
+ {
858
+ "name": "dmgmedia",
859
+ "prehideSelectors": [
860
+ "[data-project=\"mol-fe-cmp\"]"
861
+ ],
862
+ "detectCmp": [
863
+ {
864
+ "exists": "[data-project=\"mol-fe-cmp\"]"
865
+ }
866
+ ],
867
+ "detectPopup": [
868
+ {
869
+ "visible": "[data-project=\"mol-fe-cmp\"]"
870
+ }
871
+ ],
872
+ "optIn": [
873
+ {
874
+ "waitForThenClick": "[data-project=\"mol-fe-cmp\"] button[class*=primary]"
875
+ }
876
+ ],
877
+ "optOut": [
878
+ {
879
+ "waitForThenClick": "[data-project=\"mol-fe-cmp\"] button[class*=basic]"
880
+ },
881
+ {
882
+ "waitForVisible": "[data-project=\"mol-fe-cmp\"] div[class*=\"tabContent\"]"
883
+ },
884
+ {
885
+ "waitForThenClick": "[data-project=\"mol-fe-cmp\"] div[class*=\"toggle\"][class*=\"enabled\"]",
886
+ "all": true
887
+ },
888
+ {
889
+ "waitForThenClick": "[data-project=\"mol-fe-cmp\"] button[class*=white]"
890
+ }
891
+ ]
892
+ },
785
893
  {
786
894
  "name": "Drupal",
787
895
  "detectCmp": [
@@ -1032,6 +1140,43 @@
1032
1140
  }
1033
1141
  ]
1034
1142
  },
1143
+ {
1144
+ "name": "facebook",
1145
+ "runContext": {
1146
+ "urlPattern": "^https://([a-z0-9-]+\\.)?facebook\\.com/"
1147
+ },
1148
+ "prehideSelectors": [
1149
+ "div[data-testid=\"cookie-policy-manage-dialog\"]"
1150
+ ],
1151
+ "detectCmp": [
1152
+ {
1153
+ "exists": "div[data-testid=\"cookie-policy-manage-dialog\"]"
1154
+ }
1155
+ ],
1156
+ "detectPopup": [
1157
+ {
1158
+ "visible": "div[data-testid=\"cookie-policy-manage-dialog\"]"
1159
+ }
1160
+ ],
1161
+ "optIn": [
1162
+ {
1163
+ "waitForThenClick": "button[data-cookiebanner=\"accept_button\"]"
1164
+ },
1165
+ {
1166
+ "waitForVisible": "div[data-testid=\"cookie-policy-manage-dialog\"]",
1167
+ "check": "none"
1168
+ }
1169
+ ],
1170
+ "optOut": [
1171
+ {
1172
+ "waitForThenClick": "button[data-cookiebanner=\"accept_only_essential_button\"]"
1173
+ },
1174
+ {
1175
+ "waitForVisible": "div[data-testid=\"cookie-policy-manage-dialog\"]",
1176
+ "check": "none"
1177
+ }
1178
+ ]
1179
+ },
1035
1180
  {
1036
1181
  "name": "funding-choices",
1037
1182
  "prehideSelectors": [
@@ -1067,6 +1212,67 @@
1067
1212
  }
1068
1213
  ]
1069
1214
  },
1215
+ {
1216
+ "name": "google-consent-standalone",
1217
+ "prehideSelectors": [],
1218
+ "detectCmp": [
1219
+ {
1220
+ "exists": "a[href^=\"https://policies.google.com/technologies/cookies\""
1221
+ },
1222
+ {
1223
+ "exists": "form[action^=\"https://consent.\"][action$=\".com/save\"]"
1224
+ }
1225
+ ],
1226
+ "detectPopup": [
1227
+ {
1228
+ "visible": "a[href^=\"https://policies.google.com/technologies/cookies\""
1229
+ }
1230
+ ],
1231
+ "optIn": [
1232
+ {
1233
+ "waitForThenClick": "form[action^=\"https://consent.\"][action$=\".com/save\"]:has(input[name=set_eom][value=false]) button"
1234
+ }
1235
+ ],
1236
+ "optOut": [
1237
+ {
1238
+ "waitForThenClick": "form[action^=\"https://consent.\"][action$=\".com/save\"]:has(input[name=set_eom][value=true]) button"
1239
+ }
1240
+ ]
1241
+ },
1242
+ {
1243
+ "name": "google.com",
1244
+ "prehideSelectors": [
1245
+ ".HTjtHe#xe7COe"
1246
+ ],
1247
+ "detectCmp": [
1248
+ {
1249
+ "exists": ".HTjtHe#xe7COe"
1250
+ },
1251
+ {
1252
+ "exists": ".HTjtHe#xe7COe a[href^=\"https://policies.google.com/technologies/cookies\"]"
1253
+ }
1254
+ ],
1255
+ "detectPopup": [
1256
+ {
1257
+ "visible": ".HTjtHe#xe7COe button#W0wltc"
1258
+ }
1259
+ ],
1260
+ "optIn": [
1261
+ {
1262
+ "waitForThenClick": ".HTjtHe#xe7COe button#L2AGLb"
1263
+ }
1264
+ ],
1265
+ "optOut": [
1266
+ {
1267
+ "waitForThenClick": ".HTjtHe#xe7COe button#W0wltc"
1268
+ }
1269
+ ],
1270
+ "test": [
1271
+ {
1272
+ "eval": "!!document.cookie.match(/SOCS=CAE/)"
1273
+ }
1274
+ ]
1275
+ },
1070
1276
  {
1071
1277
  "name": "gov.uk",
1072
1278
  "detectCmp": [
@@ -1308,6 +1514,50 @@
1308
1514
  }
1309
1515
  ]
1310
1516
  },
1517
+ {
1518
+ "name": "linkedin.com",
1519
+ "prehideSelectors": [
1520
+ ".artdeco-global-alert[type=COOKIE_CONSENT]"
1521
+ ],
1522
+ "detectCmp": [
1523
+ {
1524
+ "exists": ".artdeco-global-alert[type=COOKIE_CONSENT]"
1525
+ }
1526
+ ],
1527
+ "detectPopup": [
1528
+ {
1529
+ "visible": ".artdeco-global-alert[type=COOKIE_CONSENT]"
1530
+ }
1531
+ ],
1532
+ "optIn": [
1533
+ {
1534
+ "waitForVisible": ".artdeco-global-alert[type=COOKIE_CONSENT] button[action-type=ACCEPT]"
1535
+ },
1536
+ {
1537
+ "wait": 500
1538
+ },
1539
+ {
1540
+ "waitForThenClick": ".artdeco-global-alert[type=COOKIE_CONSENT] button[action-type=ACCEPT]"
1541
+ }
1542
+ ],
1543
+ "optOut": [
1544
+ {
1545
+ "waitForVisible": ".artdeco-global-alert[type=COOKIE_CONSENT] button[action-type=DENY]"
1546
+ },
1547
+ {
1548
+ "wait": 500
1549
+ },
1550
+ {
1551
+ "waitForThenClick": ".artdeco-global-alert[type=COOKIE_CONSENT] button[action-type=DENY]"
1552
+ }
1553
+ ],
1554
+ "test": [
1555
+ {
1556
+ "waitForVisible": ".artdeco-global-alert[type=COOKIE_CONSENT]",
1557
+ "check": "none"
1558
+ }
1559
+ ]
1560
+ },
1311
1561
  {
1312
1562
  "name": "marksandspencer.com",
1313
1563
  "isHidingRule": true,
@@ -1512,11 +1762,6 @@
1512
1762
  {
1513
1763
  "click": ".js-decline-cookie-policy"
1514
1764
  }
1515
- ],
1516
- "test": [
1517
- {
1518
- "eval": "document.cookie.includes('_cookies_banner_dismissed=true') && !document.cookie.includes('_cookie_advertising_accepted')"
1519
- }
1520
1765
  ]
1521
1766
  },
1522
1767
  {
@@ -1876,7 +2121,7 @@
1876
2121
  "iframe[src^=\"https://cmp-consent-tool.privacymanager.io\"]"
1877
2122
  ],
1878
2123
  "runContext": {
1879
- "url": "https://cmp-consent-tool.privacymanager.io",
2124
+ "urlPattern": "^https://cmp-consent-tool\\.privacymanager\\.io/",
1880
2125
  "main": false,
1881
2126
  "frame": true
1882
2127
  },
@@ -2015,6 +2260,40 @@
2015
2260
  }
2016
2261
  ]
2017
2262
  },
2263
+ {
2264
+ "name": "reddit.com",
2265
+ "runContext": {
2266
+ "urlPattern": "^https://www\\.reddit\\.com/"
2267
+ },
2268
+ "prehideSelectors": [
2269
+ "section:has(section > span > a[href^=\"https://www.reddit.com/policies/cookies\"])"
2270
+ ],
2271
+ "detectCmp": [
2272
+ {
2273
+ "exists": "section:has(> span > a[href^=\"https://www.reddit.com/policies/cookies\"])"
2274
+ }
2275
+ ],
2276
+ "detectPopup": [
2277
+ {
2278
+ "visible": "section:has(> span > a[href^=\"https://www.reddit.com/policies/cookies\"])"
2279
+ }
2280
+ ],
2281
+ "optIn": [
2282
+ {
2283
+ "waitForThenClick": "section:has(> span > a[href^=\"https://www.reddit.com/policies/cookies\"]) section form:last-child button"
2284
+ }
2285
+ ],
2286
+ "optOut": [
2287
+ {
2288
+ "waitForThenClick": "section:has(> span > a[href^=\"https://www.reddit.com/policies/cookies\"]) section form:first-child button"
2289
+ }
2290
+ ],
2291
+ "test": [
2292
+ {
2293
+ "eval": "document.cookie.includes('eu_cookie={%22opted%22:true%2C%22nonessential%22:false}')"
2294
+ }
2295
+ ]
2296
+ },
2018
2297
  {
2019
2298
  "name": "sibbo",
2020
2299
  "prehideSelectors": [
@@ -2393,6 +2672,40 @@
2393
2672
  }
2394
2673
  ]
2395
2674
  },
2675
+ {
2676
+ "name": "twitter",
2677
+ "runContext": {
2678
+ "urlPattern": "^https://([a-z0-9-]+\\.)?twitter\\.com/"
2679
+ },
2680
+ "prehideSelectors": [
2681
+ "[data-testid=\"BottomBar\"]"
2682
+ ],
2683
+ "detectCmp": [
2684
+ {
2685
+ "exists": "[data-testid=\"BottomBar\"] div"
2686
+ }
2687
+ ],
2688
+ "detectPopup": [
2689
+ {
2690
+ "visible": "[data-testid=\"BottomBar\"] div"
2691
+ }
2692
+ ],
2693
+ "optIn": [
2694
+ {
2695
+ "waitForThenClick": "[data-testid=\"BottomBar\"] > div:has(>div:first-child>div:last-child>span[role=button]) > div:last-child > div[role=button]:first-child"
2696
+ }
2697
+ ],
2698
+ "optOut": [
2699
+ {
2700
+ "waitForThenClick": "[data-testid=\"BottomBar\"] > div:has(>div:first-child>div:last-child>span[role=button]) > div:last-child > div[role=button]:last-child"
2701
+ }
2702
+ ],
2703
+ "TODOtest": [
2704
+ {
2705
+ "eval": "document.cookie.includes('d_prefs=MjoxLGNvbnNlbnRfdmVyc2lvbjoy')"
2706
+ }
2707
+ ]
2708
+ },
2396
2709
  {
2397
2710
  "name": "UK Cookie Consent",
2398
2711
  "prehideSelectors": [
@@ -2520,7 +2833,7 @@
2520
2833
  {
2521
2834
  "name": "vodafone.de",
2522
2835
  "runContext": {
2523
- "url": "https://www.vodafone.de/"
2836
+ "urlPattern": "^https://www\\.vodafone\\.de/"
2524
2837
  },
2525
2838
  "prehideSelectors": [
2526
2839
  ".dip-consent,.dip-consent-container"
@@ -2673,6 +2986,90 @@
2673
2986
  "eval": "document.cookie.includes('userConsent=%7B%22marketing%22%3Afalse')"
2674
2987
  }
2675
2988
  ]
2989
+ },
2990
+ {
2991
+ "name": "youtube-desktop",
2992
+ "prehideSelectors": [
2993
+ "tp-yt-iron-overlay-backdrop.opened",
2994
+ "ytd-consent-bump-v2-lightbox"
2995
+ ],
2996
+ "detectCmp": [
2997
+ {
2998
+ "exists": "ytd-consent-bump-v2-lightbox tp-yt-paper-dialog"
2999
+ },
3000
+ {
3001
+ "exists": "ytd-consent-bump-v2-lightbox tp-yt-paper-dialog a[href^=\"https://consent.youtube.com/\"]"
3002
+ }
3003
+ ],
3004
+ "detectPopup": [
3005
+ {
3006
+ "visible": "ytd-consent-bump-v2-lightbox tp-yt-paper-dialog"
3007
+ }
3008
+ ],
3009
+ "optIn": [
3010
+ {
3011
+ "waitForThenClick": "ytd-consent-bump-v2-lightbox .eom-buttons .eom-button-row:first-child ytd-button-renderer:last-child #button,ytd-consent-bump-v2-lightbox .eom-buttons .eom-button-row:first-child ytd-button-renderer:last-child button"
3012
+ },
3013
+ {
3014
+ "wait": 500
3015
+ }
3016
+ ],
3017
+ "optOut": [
3018
+ {
3019
+ "waitForThenClick": "ytd-consent-bump-v2-lightbox .eom-buttons .eom-button-row:first-child ytd-button-renderer:first-child #button,ytd-consent-bump-v2-lightbox .eom-buttons .eom-button-row:first-child ytd-button-renderer:first-child button"
3020
+ },
3021
+ {
3022
+ "wait": 500
3023
+ }
3024
+ ],
3025
+ "test": [
3026
+ {
3027
+ "wait": 500
3028
+ },
3029
+ {
3030
+ "eval": "!!document.cookie.match(/SOCS=CAE/)"
3031
+ }
3032
+ ]
3033
+ },
3034
+ {
3035
+ "name": "youtube-mobile",
3036
+ "prehideSelectors": [
3037
+ ".consent-bump-v2-lightbox"
3038
+ ],
3039
+ "detectCmp": [
3040
+ {
3041
+ "exists": "ytm-consent-bump-v2-renderer"
3042
+ }
3043
+ ],
3044
+ "detectPopup": [
3045
+ {
3046
+ "visible": "ytm-consent-bump-v2-renderer"
3047
+ }
3048
+ ],
3049
+ "optIn": [
3050
+ {
3051
+ "waitForThenClick": "ytm-consent-bump-v2-renderer .privacy-terms + .one-col-dialog-buttons c3-material-button:first-child button, ytm-consent-bump-v2-renderer .privacy-terms + .one-col-dialog-buttons ytm-button-renderer:first-child button"
3052
+ },
3053
+ {
3054
+ "wait": 500
3055
+ }
3056
+ ],
3057
+ "optOut": [
3058
+ {
3059
+ "waitForThenClick": "ytm-consent-bump-v2-renderer .privacy-terms + .one-col-dialog-buttons c3-material-button:nth-child(2) button, ytm-consent-bump-v2-renderer .privacy-terms + .one-col-dialog-buttons ytm-button-renderer:nth-child(2) button"
3060
+ },
3061
+ {
3062
+ "wait": 500
3063
+ }
3064
+ ],
3065
+ "test": [
3066
+ {
3067
+ "wait": 500
3068
+ },
3069
+ {
3070
+ "eval": "!!document.cookie.match(/SOCS=CAE/)"
3071
+ }
3072
+ ]
2676
3073
  }
2677
3074
  ],
2678
3075
  "consentomatic": {