@duckduckgo/autoconsent 16.59.0 → 16.61.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.
- package/.agents/lib/regional-testing/harness.mjs +4 -172
- package/.agents/skills/oxylabs-testing/SKILL.md +4 -4
- package/.agents/skills/oxylabs-testing/scripts/oxylabs.mjs +17 -164
- package/.agents/skills/oxylabs-testing/scripts/oxylabs.test.mjs +6 -3
- package/.agents/skills/verify-pr/SKILL.md +1 -1
- package/AGENTS.md +1 -1
- package/CHANGELOG.md +107 -0
- package/Jenkinsfile +36 -1
- package/dist/addon-firefox/background.bundle.js +21 -0
- package/dist/addon-firefox/compact-rules.json +1 -1
- package/dist/addon-firefox/content.bundle.js +253 -93
- package/dist/addon-firefox/manifest.json +1 -1
- package/dist/addon-firefox/rule-index.json +1 -1
- package/dist/addon-firefox/rules.json +1 -1
- package/dist/addon-mv3/background.bundle.js +21 -0
- package/dist/addon-mv3/compact-rules.json +1 -1
- package/dist/addon-mv3/content.bundle.js +253 -93
- package/dist/addon-mv3/manifest.json +1 -1
- package/dist/addon-mv3/rule-index.json +1 -1
- package/dist/addon-mv3/rules.json +1 -1
- package/dist/autoconsent.cjs.js +253 -93
- package/dist/autoconsent.esm.js +253 -93
- package/dist/autoconsent.playwright.js +253 -93
- package/dist/autoconsent.standalone.js +254 -94
- package/dist/heuristics.cjs.js +29 -3
- package/dist/heuristics.mjs +28 -3
- package/dist/types/cmps/onetrust.d.ts +1 -0
- package/dist/types/eval-snippets.d.ts +3 -0
- package/dist/types/heuristic-classify.d.ts +1 -0
- package/dist/types/heuristics.d.ts +10 -1
- package/lib/cmps/onetrust.ts +15 -0
- package/lib/eval-snippets.ts +21 -0
- package/lib/heuristic-classify.ts +6 -0
- package/lib/heuristic-patterns.ts +26 -1
- package/lib/heuristics.ts +256 -104
- package/package.json +1 -1
- package/playwright/isolated-world.mjs +217 -0
- package/playwright/oxylabs.mjs +196 -0
- package/playwright/runner.ts +183 -39
- package/playwright.config.ts +4 -1
- package/rules/autoconsent/aeolservice.json +39 -0
- package/rules/autoconsent/airbnb.json +32 -0
- package/rules/autoconsent/amazon-music.json +13 -0
- package/rules/autoconsent/annunci69.json +19 -0
- package/rules/autoconsent/appconsent.json +6 -1
- package/rules/autoconsent/arbeidsplassen-nav-no.json +33 -0
- package/rules/autoconsent/att.json +36 -0
- package/rules/autoconsent/auctionet.json +39 -0
- package/rules/autoconsent/autodoc.json +18 -0
- package/rules/autoconsent/bbc.com-orb-cosmetic.json +34 -0
- package/rules/autoconsent/bbc.com.json +8 -5
- package/rules/autoconsent/bokadirekt.se.json +50 -0
- package/rules/autoconsent/bouvet-cookiepanel.json +29 -0
- package/rules/autoconsent/com-consent-layer.json +10 -0
- package/rules/autoconsent/consent-studio.json +25 -13
- package/rules/autoconsent/cookielegit.json +21 -0
- package/rules/autoconsent/cookieprompter.json +21 -0
- package/rules/autoconsent/cookiereports.json +10 -0
- package/rules/autoconsent/cookietractor.json +37 -0
- package/rules/autoconsent/de-volksbank.json +14 -0
- package/rules/autoconsent/dpgmedia-nl.json +20 -8
- package/rules/autoconsent/eon.pl.json +18 -0
- package/rules/autoconsent/eroticiracconti-it.json +13 -0
- package/rules/autoconsent/ersatzteile-24.json +49 -0
- package/rules/autoconsent/fastweb-cookie-center.json +13 -0
- package/rules/autoconsent/futurabolzano-it.json +35 -0
- package/rules/autoconsent/gobasic.json +10 -0
- package/rules/autoconsent/gravito.json +23 -16
- package/rules/autoconsent/hacon-next-gen.json +41 -0
- package/rules/autoconsent/ing-de.json +31 -0
- package/rules/autoconsent/interia.json +1 -4
- package/rules/autoconsent/intesasanpaolo.json +37 -0
- package/rules/autoconsent/jobindex.json +40 -0
- package/rules/autoconsent/kaspersky-cookies-notification.json +9 -0
- package/rules/autoconsent/lantmateriet.json +13 -0
- package/rules/autoconsent/livsmedelsverket.json +18 -0
- package/rules/autoconsent/mainichi.json +39 -0
- package/rules/autoconsent/mango.json +56 -0
- package/rules/autoconsent/nederlandseloterij.json +35 -0
- package/rules/autoconsent/newsbreak.json +16 -0
- package/rules/autoconsent/nhsapp.json +10 -0
- package/rules/autoconsent/nordea.json +21 -0
- package/rules/autoconsent/nordnet.json +33 -0
- package/rules/autoconsent/ok.json +4 -12
- package/rules/autoconsent/onlineradiobox.json +35 -0
- package/rules/autoconsent/pe-cookies.json +30 -0
- package/rules/autoconsent/pensionsmyndigheten.json +13 -0
- package/rules/autoconsent/pro-euclp-cookies-box.json +31 -0
- package/rules/autoconsent/pubfactory.json +45 -0
- package/rules/autoconsent/puesc-gov-pl.json +37 -0
- package/rules/autoconsent/rambler.json +30 -0
- package/rules/autoconsent/rejestr-io.json +36 -0
- package/rules/autoconsent/sas.json +6 -6
- package/rules/autoconsent/scb.se.json +13 -0
- package/rules/autoconsent/schumacher.com.json +53 -0
- package/rules/autoconsent/sitevision.json +18 -1
- package/rules/autoconsent/skatteverket-se.json +33 -0
- package/rules/autoconsent/smile-insurances.json +13 -0
- package/rules/autoconsent/studentapan.json +16 -0
- package/rules/autoconsent/svt.se.json +7 -7
- package/rules/autoconsent/temu.json +12 -16
- package/rules/autoconsent/thecode.json +21 -0
- package/rules/autoconsent/tv2reg-cookie-notice.json +39 -0
- package/rules/autoconsent/uk-parliament.json +19 -0
- package/rules/autoconsent/wirtualna-polska.json +13 -10
- package/rules/autoconsent/xenforo-cookie-consent.json +62 -0
- package/rules/autoconsent/zorginstituut-cookiewarning.json +33 -0
- package/rules/compact-rules.json +1 -1
- package/rules/rule-index.json +1 -1
- package/rules/rules.json +1 -1
- package/tests/aeolservice.spec.ts +5 -0
- package/tests/airbnb.spec.ts +3 -0
- package/tests/amazon-music.spec.ts +9 -0
- package/tests/annunci69.spec.ts +5 -0
- package/tests/appconsent.spec.ts +6 -0
- package/tests/arbeidsplassen-nav-no.spec.ts +3 -0
- package/tests/att.spec.ts +3 -0
- package/tests/auctionet.spec.ts +3 -0
- package/tests/autodoc.spec.ts +8 -0
- package/tests/bbc.com-orb-cosmetic.spec.ts +8 -0
- package/tests/bbc.com.spec.ts +11 -9
- package/tests/bokadirekt.se.spec.ts +3 -0
- package/tests/bouvet-cookiepanel.spec.ts +9 -0
- package/tests/com-consent-layer.spec.ts +6 -0
- package/tests/consent-studio.spec.ts +5 -0
- package/tests/cookiebot.spec.ts +1 -0
- package/tests/cookielegit.spec.ts +3 -0
- package/tests/cookieprompter.spec.ts +9 -0
- package/tests/cookiereports.spec.ts +13 -0
- package/tests/cookietractor.spec.ts +12 -0
- package/tests/de-volksbank.spec.ts +5 -0
- package/tests/dpgmedia-nl.spec.ts +15 -1
- package/tests/eon.pl.spec.ts +3 -0
- package/tests/eroticiracconti-it.spec.ts +3 -0
- package/tests/ersatzteile-24.spec.ts +6 -0
- package/tests/fastweb-cookie-center.spec.ts +3 -0
- package/tests/futurabolzano-it.spec.ts +3 -0
- package/tests/gobasic.spec.ts +3 -0
- package/tests/gravito.spec.ts +7 -1
- package/tests/hacon-next-gen.spec.ts +6 -0
- package/tests/ing-de.spec.ts +3 -0
- package/tests/interia.spec.ts +1 -1
- package/tests/intesasanpaolo.spec.ts +3 -0
- package/tests/jobindex.spec.ts +3 -0
- package/tests/kaspersky-cookies-notification.spec.ts +8 -0
- package/tests/lantmateriet.spec.ts +3 -0
- package/tests/livsmedelsverket.spec.ts +5 -0
- package/tests/mainichi.spec.ts +10 -0
- package/tests/mango.spec.ts +3 -0
- package/tests/nederlandseloterij.spec.ts +9 -0
- package/tests/newsbreak.spec.ts +3 -0
- package/tests/nhsapp.spec.ts +3 -0
- package/tests/nordea.spec.ts +6 -0
- package/tests/nordnet.spec.ts +8 -0
- package/tests/onlineradiobox.spec.ts +5 -0
- package/tests/pe-cookies.spec.ts +6 -0
- package/tests/pensionsmyndigheten.spec.ts +3 -0
- package/tests/pro-euclp-cookies-box.spec.ts +8 -0
- package/tests/pubfactory.spec.ts +10 -0
- package/tests/puesc-gov-pl.spec.ts +3 -0
- package/tests/rambler.spec.ts +3 -0
- package/tests/rejestr-io.spec.ts +3 -0
- package/tests/sas.spec.ts +1 -1
- package/tests/scb.se.spec.ts +4 -0
- package/tests/schumacher.com.spec.ts +6 -0
- package/tests/sitevision-cookie-consent.spec.ts +1 -0
- package/tests/sitevision.spec.ts +7 -0
- package/tests/skatteverket-se.spec.ts +3 -0
- package/tests/smile-insurances.spec.ts +6 -0
- package/tests/studentapan.spec.ts +3 -0
- package/tests/svt.se.spec.ts +1 -3
- package/tests/temu.spec.ts +3 -1
- package/tests/thecode.spec.ts +3 -0
- package/tests/tv2reg-cookie-notice.spec.ts +16 -0
- package/tests/uk-parliament.spec.ts +8 -0
- package/tests/wirtualna-polska.spec.ts +6 -1
- package/tests/xenforo-cookie-consent.spec.ts +6 -0
- package/tests/zorginstituut-cookiewarning.spec.ts +10 -0
- package/tests-wtr/heuristics/get-potential-popups.test.ts +330 -9
- package/tests-wtr/heuristics/heuristics-utils.test.ts +98 -0
- package/rules/autoconsent/twitter.json +0 -34
- package/rules/generated/auto_AU_flysas.com_r1s.json +0 -40
- package/rules/generated/auto_CH_airbnb.de_83z.json +0 -40
- package/rules/generated/auto_CH_autodoc.de_krd.json +0 -40
- package/rules/generated/auto_CH_svtplay.se_d39.json +0 -40
- package/rules/generated/auto_GB_parliamentlive.tv_r3v.json +0 -28
- package/rules/generated/auto_NL_asnbank.nl_e28.json +0 -40
- package/rules/generated/auto_NL_eurojackpot.nederlandseloterij.nl_7hr.json +0 -40
- package/rules/generated/auto_NL_lotto.nederlandseloterij.nl_7c8.json +0 -40
- package/rules/generated/auto_NL_nederlandseloterij.nl_b60.json +0 -40
- package/rules/generated/auto_NL_staatsloterij.nederlandseloterij.nl_197.json +0 -40
- package/rules/generated/auto_NO_arronet.se_vo5.json +0 -40
- package/rules/generated/auto_NO_liseberg.se_qy4.json +0 -40
- package/rules/generated/auto_NO_nordnet.se_2en.json +0 -40
- package/rules/generated/auto_NO_regeringen.se_uhv.json +0 -40
- package/rules/generated/auto_NO_svtplay.se_ujn.json +0 -40
- package/rules/generated/auto_NO_uu.se_eea.json +0 -40
- package/rules/generated/auto_US_newsbreak.com_0.json +0 -28
- package/tests/generated/auto_AU_flysas.com_r1s.spec.ts +0 -2
- package/tests/generated/auto_CH_airbnb.de_83z.spec.ts +0 -2
- package/tests/generated/auto_CH_autodoc.de_krd.spec.ts +0 -2
- package/tests/generated/auto_CH_svtplay.se_d39.spec.ts +0 -2
- package/tests/generated/auto_GB_parliamentlive.tv_r3v.spec.ts +0 -6
- package/tests/generated/auto_NL_asnbank.nl_e28.spec.ts +0 -6
- package/tests/generated/auto_NL_eurojackpot.nederlandseloterij.nl_7hr.spec.ts +0 -6
- package/tests/generated/auto_NL_lotto.nederlandseloterij.nl_7c8.spec.ts +0 -6
- package/tests/generated/auto_NL_nederlandseloterij.nl_b60.spec.ts +0 -6
- package/tests/generated/auto_NL_staatsloterij.nederlandseloterij.nl_197.spec.ts +0 -6
- package/tests/generated/auto_NO_arronet.se_vo5.spec.ts +0 -2
- package/tests/generated/auto_NO_liseberg.se_qy4.spec.ts +0 -2
- package/tests/generated/auto_NO_nordnet.se_2en.spec.ts +0 -2
- package/tests/generated/auto_NO_regeringen.se_uhv.spec.ts +0 -6
- package/tests/generated/auto_NO_svtplay.se_ujn.spec.ts +0 -2
- package/tests/generated/auto_NO_uu.se_eea.spec.ts +0 -2
- package/tests/generated/auto_US_newsbreak.com_0.spec.ts +0 -2
- package/tests/twitter.spec.ts +0 -10
package/dist/heuristics.cjs.js
CHANGED
|
@@ -32,6 +32,7 @@ __export(heuristic_classify_exports, {
|
|
|
32
32
|
classifyButtons: () => classifyButtons,
|
|
33
33
|
classifyPopup: () => classifyPopup,
|
|
34
34
|
cleanButtonText: () => cleanButtonText,
|
|
35
|
+
hasHeuristicPatterns: () => hasHeuristicPatterns,
|
|
35
36
|
isExcludedPopup: () => isExcludedPopup
|
|
36
37
|
});
|
|
37
38
|
module.exports = __toCommonJS(heuristic_classify_exports);
|
|
@@ -190,10 +191,20 @@ var DETECT_PATTERNS = [
|
|
|
190
191
|
// "файлы cookie" / "cookie-файлы" / "куки-файлы" in any phrasing
|
|
191
192
|
/(?:файл[а-яё]*[\s-]+(?:cookie|куки)|(?:cookie|куки)[\s-]+файл[а-яё]*)/gi,
|
|
192
193
|
// Italian (IT)
|
|
193
|
-
|
|
194
|
+
// e.g. "usiamo i cookie", "utilizziamo cookie tecnici", "questo sito utilizza i cookie", "noi e i nostri partner utilizziamo i cookie"
|
|
195
|
+
/(?:usiamo|utilizziamo).{0,20}cookie/gi,
|
|
196
|
+
/sito.{0,50}(?:usa|utilizza).{0,20}cookie/gi,
|
|
197
|
+
/noi e i nostri.{0,20}partner.{0,100}cookie/gi,
|
|
198
|
+
/(?:archiviare|memorizzare) e\/o accedere a informazioni su un dispositivo/gi,
|
|
199
|
+
// Swedish (SV)
|
|
200
|
+
// e.g. "vi använder cookies", "vi använder spårningstekniker såsom cookies", "webbplatsen använder kakor"
|
|
201
|
+
/(?:vi|webbplatsen|webbplats|sajten|sidan)\s+använder.{0,60}(?:cookies|kakor)/gi,
|
|
194
202
|
// Japanese (JA)
|
|
195
203
|
// e.g. "当サイトはCookieを使用しています", "クッキー(Cookie)を利用しています"
|
|
196
|
-
/(?:cookie|クッキー).{0,10}を(?:使用|利用)/gi
|
|
204
|
+
/(?:cookie|クッキー).{0,10}を(?:使用|利用)/gi,
|
|
205
|
+
// Danish (DA)
|
|
206
|
+
// e.g. "vi bruger cookies", "hjemmesiden bruger cookies til at ..."
|
|
207
|
+
/bruger cookies/gi
|
|
197
208
|
];
|
|
198
209
|
var REJECT_PATTERNS_ENGLISH = [
|
|
199
210
|
// e.g. "reject", "reject all", "reject all cookies", "deny all", "refuse cookies", "decline",
|
|
@@ -327,6 +338,14 @@ var REJECT_PATTERNS_SWEDISH = [
|
|
|
327
338
|
"till\xE5t inte cookies",
|
|
328
339
|
"jag accepterar endast grundl\xE4ggande kakor"
|
|
329
340
|
];
|
|
341
|
+
var REJECT_PATTERNS_DANISH = [
|
|
342
|
+
// afvis / afvis alle / afvis alle cookies (reject verbs)
|
|
343
|
+
/(^|\s)afvis/is,
|
|
344
|
+
// (accept/allow) only necessary cookies
|
|
345
|
+
/^(accepter\s+|tillad\s+)?(kun|udelukkende)\s+(strengt\s+)?nødvendige( cookies)?$/is,
|
|
346
|
+
// "nej tak" (no thanks)
|
|
347
|
+
/^nej(,?\s+tak)?$/is
|
|
348
|
+
];
|
|
330
349
|
var REJECT_PATTERNS_CATALAN = [/(^|\s)rebutj/is, "no accepto", "no, gr\xE0cies"];
|
|
331
350
|
var REJECT_PATTERNS_GALICIAN = [/(^|\s)rexeitar/is];
|
|
332
351
|
var REJECT_PATTERNS_BASQUE = [/(^|\s)(baztertu|ukatu)/is];
|
|
@@ -373,6 +392,7 @@ var REJECT_PATTERNS = [
|
|
|
373
392
|
...REJECT_PATTERNS_BRAZILIAN_PORTUGUESE,
|
|
374
393
|
...REJECT_PATTERNS_SPANISH,
|
|
375
394
|
...REJECT_PATTERNS_SWEDISH,
|
|
395
|
+
...REJECT_PATTERNS_DANISH,
|
|
376
396
|
...REJECT_PATTERNS_CATALAN,
|
|
377
397
|
...REJECT_PATTERNS_GALICIAN,
|
|
378
398
|
...REJECT_PATTERNS_BASQUE,
|
|
@@ -722,7 +742,8 @@ var ACCEPT_PATTERNS = [
|
|
|
722
742
|
"kabul et",
|
|
723
743
|
// Italian (IT)
|
|
724
744
|
"accetta",
|
|
725
|
-
"accetta tutti i cookie"
|
|
745
|
+
"accetta tutti i cookie",
|
|
746
|
+
"accetto tutti i cookie"
|
|
726
747
|
];
|
|
727
748
|
var ACKNOWLEDGE_PATTERNS = [
|
|
728
749
|
// close / dismiss the banner/dialog/message (multilingual). The negative lookahead avoids
|
|
@@ -798,6 +819,10 @@ function checkHeuristicPatterns(allText, detectPatterns = DETECT_PATTERNS) {
|
|
|
798
819
|
}
|
|
799
820
|
return { patterns, snippets };
|
|
800
821
|
}
|
|
822
|
+
function hasHeuristicPatterns(allText, detectPatterns = DETECT_PATTERNS) {
|
|
823
|
+
const text = allText.slice(0, TEXT_LIMIT);
|
|
824
|
+
return detectPatterns.some((p) => text.search(p) !== -1);
|
|
825
|
+
}
|
|
801
826
|
function classifyButtons(buttons) {
|
|
802
827
|
for (const button of buttons) {
|
|
803
828
|
button.regexClassification = classifyButtonTextRegex(button.text);
|
|
@@ -882,5 +907,6 @@ function classifyButtonTextRegex(buttonText) {
|
|
|
882
907
|
classifyButtons,
|
|
883
908
|
classifyPopup,
|
|
884
909
|
cleanButtonText,
|
|
910
|
+
hasHeuristicPatterns,
|
|
885
911
|
isExcludedPopup
|
|
886
912
|
});
|
package/dist/heuristics.mjs
CHANGED
|
@@ -152,10 +152,20 @@ var DETECT_PATTERNS = [
|
|
|
152
152
|
// "файлы cookie" / "cookie-файлы" / "куки-файлы" in any phrasing
|
|
153
153
|
/(?:файл[а-яё]*[\s-]+(?:cookie|куки)|(?:cookie|куки)[\s-]+файл[а-яё]*)/gi,
|
|
154
154
|
// Italian (IT)
|
|
155
|
-
|
|
155
|
+
// e.g. "usiamo i cookie", "utilizziamo cookie tecnici", "questo sito utilizza i cookie", "noi e i nostri partner utilizziamo i cookie"
|
|
156
|
+
/(?:usiamo|utilizziamo).{0,20}cookie/gi,
|
|
157
|
+
/sito.{0,50}(?:usa|utilizza).{0,20}cookie/gi,
|
|
158
|
+
/noi e i nostri.{0,20}partner.{0,100}cookie/gi,
|
|
159
|
+
/(?:archiviare|memorizzare) e\/o accedere a informazioni su un dispositivo/gi,
|
|
160
|
+
// Swedish (SV)
|
|
161
|
+
// e.g. "vi använder cookies", "vi använder spårningstekniker såsom cookies", "webbplatsen använder kakor"
|
|
162
|
+
/(?:vi|webbplatsen|webbplats|sajten|sidan)\s+använder.{0,60}(?:cookies|kakor)/gi,
|
|
156
163
|
// Japanese (JA)
|
|
157
164
|
// e.g. "当サイトはCookieを使用しています", "クッキー(Cookie)を利用しています"
|
|
158
|
-
/(?:cookie|クッキー).{0,10}を(?:使用|利用)/gi
|
|
165
|
+
/(?:cookie|クッキー).{0,10}を(?:使用|利用)/gi,
|
|
166
|
+
// Danish (DA)
|
|
167
|
+
// e.g. "vi bruger cookies", "hjemmesiden bruger cookies til at ..."
|
|
168
|
+
/bruger cookies/gi
|
|
159
169
|
];
|
|
160
170
|
var REJECT_PATTERNS_ENGLISH = [
|
|
161
171
|
// e.g. "reject", "reject all", "reject all cookies", "deny all", "refuse cookies", "decline",
|
|
@@ -289,6 +299,14 @@ var REJECT_PATTERNS_SWEDISH = [
|
|
|
289
299
|
"till\xE5t inte cookies",
|
|
290
300
|
"jag accepterar endast grundl\xE4ggande kakor"
|
|
291
301
|
];
|
|
302
|
+
var REJECT_PATTERNS_DANISH = [
|
|
303
|
+
// afvis / afvis alle / afvis alle cookies (reject verbs)
|
|
304
|
+
/(^|\s)afvis/is,
|
|
305
|
+
// (accept/allow) only necessary cookies
|
|
306
|
+
/^(accepter\s+|tillad\s+)?(kun|udelukkende)\s+(strengt\s+)?nødvendige( cookies)?$/is,
|
|
307
|
+
// "nej tak" (no thanks)
|
|
308
|
+
/^nej(,?\s+tak)?$/is
|
|
309
|
+
];
|
|
292
310
|
var REJECT_PATTERNS_CATALAN = [/(^|\s)rebutj/is, "no accepto", "no, gr\xE0cies"];
|
|
293
311
|
var REJECT_PATTERNS_GALICIAN = [/(^|\s)rexeitar/is];
|
|
294
312
|
var REJECT_PATTERNS_BASQUE = [/(^|\s)(baztertu|ukatu)/is];
|
|
@@ -335,6 +353,7 @@ var REJECT_PATTERNS = [
|
|
|
335
353
|
...REJECT_PATTERNS_BRAZILIAN_PORTUGUESE,
|
|
336
354
|
...REJECT_PATTERNS_SPANISH,
|
|
337
355
|
...REJECT_PATTERNS_SWEDISH,
|
|
356
|
+
...REJECT_PATTERNS_DANISH,
|
|
338
357
|
...REJECT_PATTERNS_CATALAN,
|
|
339
358
|
...REJECT_PATTERNS_GALICIAN,
|
|
340
359
|
...REJECT_PATTERNS_BASQUE,
|
|
@@ -684,7 +703,8 @@ var ACCEPT_PATTERNS = [
|
|
|
684
703
|
"kabul et",
|
|
685
704
|
// Italian (IT)
|
|
686
705
|
"accetta",
|
|
687
|
-
"accetta tutti i cookie"
|
|
706
|
+
"accetta tutti i cookie",
|
|
707
|
+
"accetto tutti i cookie"
|
|
688
708
|
];
|
|
689
709
|
var ACKNOWLEDGE_PATTERNS = [
|
|
690
710
|
// close / dismiss the banner/dialog/message (multilingual). The negative lookahead avoids
|
|
@@ -760,6 +780,10 @@ function checkHeuristicPatterns(allText, detectPatterns = DETECT_PATTERNS) {
|
|
|
760
780
|
}
|
|
761
781
|
return { patterns, snippets };
|
|
762
782
|
}
|
|
783
|
+
function hasHeuristicPatterns(allText, detectPatterns = DETECT_PATTERNS) {
|
|
784
|
+
const text = allText.slice(0, TEXT_LIMIT);
|
|
785
|
+
return detectPatterns.some((p) => text.search(p) !== -1);
|
|
786
|
+
}
|
|
763
787
|
function classifyButtons(buttons) {
|
|
764
788
|
for (const button of buttons) {
|
|
765
789
|
button.regexClassification = classifyButtonTextRegex(button.text);
|
|
@@ -843,5 +867,6 @@ export {
|
|
|
843
867
|
classifyButtons,
|
|
844
868
|
classifyPopup,
|
|
845
869
|
cleanButtonText,
|
|
870
|
+
hasHeuristicPatterns,
|
|
846
871
|
isExcludedPopup
|
|
847
872
|
};
|
|
@@ -5,6 +5,7 @@ export default class Onetrust extends AutoConsentCMPBase {
|
|
|
5
5
|
get hasSelfTest(): boolean;
|
|
6
6
|
get isIntermediate(): boolean;
|
|
7
7
|
get isCosmetic(): boolean;
|
|
8
|
+
waitForSdk(): Promise<void>;
|
|
8
9
|
detectCmp(): Promise<boolean>;
|
|
9
10
|
detectPopup(): Promise<boolean>;
|
|
10
11
|
optOut(): Promise<boolean>;
|
|
@@ -40,6 +40,9 @@ export declare const snippets: {
|
|
|
40
40
|
EVAL_COOKIEFIRST_1: () => boolean;
|
|
41
41
|
EVAL_COOKIEINFORMATION_0: () => any;
|
|
42
42
|
EVAL_COOKIEINFORMATION_1: () => any;
|
|
43
|
+
EVAL_COOKIEREPORTS_OPT_OUT: () => boolean;
|
|
44
|
+
EVAL_COOKIEREPORTS_OPT_IN: () => boolean;
|
|
45
|
+
EVAL_COOKIEREPORTS_TEST: () => boolean;
|
|
43
46
|
EVAL_EE_CONSENT_DECLINE_0: () => boolean;
|
|
44
47
|
EVAL_ETSY_0: () => boolean;
|
|
45
48
|
EVAL_ETSY_1: () => any;
|
|
@@ -9,6 +9,7 @@ export declare function checkHeuristicPatterns(allText: string, detectPatterns?:
|
|
|
9
9
|
patterns: string[];
|
|
10
10
|
snippets: string[];
|
|
11
11
|
};
|
|
12
|
+
export declare function hasHeuristicPatterns(allText: string, detectPatterns?: RegExp[]): boolean;
|
|
12
13
|
export declare function classifyButtons(buttons: ClassifiableButton[]): void;
|
|
13
14
|
export declare function isExcludedPopup(popupText: string, excludePatterns?: RegExp[]): boolean;
|
|
14
15
|
export declare function classifyPopup(buttons: ClassifiableButton[]): PopupClassification;
|
|
@@ -1,11 +1,20 @@
|
|
|
1
1
|
import { ButtonData, HeuristicLevel, PopupData } from './types';
|
|
2
2
|
export declare function getActionablePopups(mode?: HeuristicLevel, timeout?: number): PopupData[];
|
|
3
|
+
/**
|
|
4
|
+
* @param timeout time budget for the whole search, in ms
|
|
5
|
+
*/
|
|
3
6
|
export declare function getPotentialPopups(timeout?: number): PopupData[];
|
|
7
|
+
/**
|
|
8
|
+
* The whole document of a frame, if it is rendered and has text. The body can have zero height when all of its
|
|
9
|
+
* content is positioned, so only check visibility styles, not size.
|
|
10
|
+
*/
|
|
11
|
+
export declare function getFramePopupElement(doc: Document): HTMLElement | null;
|
|
4
12
|
export declare function isDialogLikeElement(node: HTMLElement): boolean;
|
|
5
13
|
/**
|
|
6
14
|
* Serialize all actionable buttons on the page
|
|
15
|
+
* @param shadowHosts open shadow hosts on the page, if already known; otherwise they are searched for under el
|
|
7
16
|
*/
|
|
8
|
-
export declare function getButtonData(el: HTMLElement): ButtonData[];
|
|
17
|
+
export declare function getButtonData(el: HTMLElement, shadowHosts?: HTMLElement[]): ButtonData[];
|
|
9
18
|
export declare function isDisabled(el: HTMLElement): boolean;
|
|
10
19
|
/**
|
|
11
20
|
* Leave only elements that do not contain any other elements
|
package/lib/cmps/onetrust.ts
CHANGED
|
@@ -17,6 +17,19 @@ export default class Onetrust extends AutoConsentCMPBase {
|
|
|
17
17
|
return false;
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
+
// Some sites pre-render the banner before the SDK loads, and clicks before then may be lost.
|
|
21
|
+
// Sites that copy the markup without the SDK never get #onetrust-style, so only wait when the page loads the SDK.
|
|
22
|
+
async waitForSdk() {
|
|
23
|
+
if (this.elementExists('#onetrust-style')) {
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
const sdkRef = /cookielaw\.org|otSDKStub|otBannerSdk/;
|
|
27
|
+
const sdkExpected = Array.from(document.scripts).some((s) => sdkRef.test(s.src) || (!s.src && sdkRef.test(s.textContent || '')));
|
|
28
|
+
if (sdkExpected) {
|
|
29
|
+
await this.waitForElement('#onetrust-style', 10000);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
20
33
|
async detectCmp() {
|
|
21
34
|
return this.elementExists('#onetrust-banner-sdk') || this.elementVisible('#onetrust-pc-sdk', 'any');
|
|
22
35
|
}
|
|
@@ -27,6 +40,7 @@ export default class Onetrust extends AutoConsentCMPBase {
|
|
|
27
40
|
|
|
28
41
|
async optOut() {
|
|
29
42
|
await this.wait(500);
|
|
43
|
+
await this.waitForSdk();
|
|
30
44
|
// 'reject all' shortcuts
|
|
31
45
|
if (this.elementVisible('#onetrust-reject-all-handler', 'any')) {
|
|
32
46
|
return await this.click('#onetrust-reject-all-handler');
|
|
@@ -86,6 +100,7 @@ export default class Onetrust extends AutoConsentCMPBase {
|
|
|
86
100
|
}
|
|
87
101
|
|
|
88
102
|
async optIn() {
|
|
103
|
+
await this.waitForSdk();
|
|
89
104
|
return await this.click('#onetrust-accept-btn-handler,#accept-recommended-btn-handler,.js-accept-cookies');
|
|
90
105
|
}
|
|
91
106
|
|
package/lib/eval-snippets.ts
CHANGED
|
@@ -148,6 +148,27 @@ export const snippets = {
|
|
|
148
148
|
.forEach((i) => i.getAttribute('aria-checked') === 'true' && i.click()) || true,
|
|
149
149
|
EVAL_COOKIEINFORMATION_0: () => CookieInformation.declineAllCategories() || true,
|
|
150
150
|
EVAL_COOKIEINFORMATION_1: () => CookieInformation.submitAllCategories() || true,
|
|
151
|
+
// banner button order and meaning are configurable per site, so set the consent levels through the public API
|
|
152
|
+
EVAL_COOKIEREPORTS_OPT_OUT: () => {
|
|
153
|
+
const cr = window._cookiereports;
|
|
154
|
+
if (typeof cr?.saveConsent !== 'function') return false;
|
|
155
|
+
cr.saveConsent({ 1: true, 2: false, 3: false, 4: false, 5: false });
|
|
156
|
+
cr.processConsent('banner', { trigger: 'ok' });
|
|
157
|
+
cr.hideBanner();
|
|
158
|
+
return true;
|
|
159
|
+
},
|
|
160
|
+
EVAL_COOKIEREPORTS_OPT_IN: () => {
|
|
161
|
+
const cr = window._cookiereports;
|
|
162
|
+
if (typeof cr?.saveConsent !== 'function') return false;
|
|
163
|
+
cr.saveConsent({ 1: true, 2: true, 3: true, 4: true, 5: true });
|
|
164
|
+
cr.processConsent('banner', { trigger: 'ok' });
|
|
165
|
+
cr.hideBanner();
|
|
166
|
+
return true;
|
|
167
|
+
},
|
|
168
|
+
EVAL_COOKIEREPORTS_TEST: () => {
|
|
169
|
+
const levels = window._cookiereports?.loadConsent?.();
|
|
170
|
+
return !!levels && Object.keys(levels).length > 0 && Object.values(levels).every((v) => !v);
|
|
171
|
+
},
|
|
151
172
|
// turn the single-button form into a decline submission, same fields as the CMP's own decline form
|
|
152
173
|
EVAL_EE_CONSENT_DECLINE_0: () =>
|
|
153
174
|
document.querySelectorAll('#cookieConsentFormAccept input[name^="ee:cookies_"]').forEach((i) => (i.value = 'n')) || true,
|
|
@@ -44,6 +44,12 @@ export function checkHeuristicPatterns(allText: string, detectPatterns = DETECT_
|
|
|
44
44
|
return { patterns, snippets };
|
|
45
45
|
}
|
|
46
46
|
|
|
47
|
+
// same result as checking checkHeuristicPatterns() for patterns, but stops at the first match
|
|
48
|
+
export function hasHeuristicPatterns(allText: string, detectPatterns = DETECT_PATTERNS): boolean {
|
|
49
|
+
const text = allText.slice(0, TEXT_LIMIT);
|
|
50
|
+
return detectPatterns.some((p) => text.search(p) !== -1);
|
|
51
|
+
}
|
|
52
|
+
|
|
47
53
|
export function classifyButtons(buttons: ClassifiableButton[]) {
|
|
48
54
|
for (const button of buttons) {
|
|
49
55
|
button.regexClassification = classifyButtonTextRegex(button.text);
|
|
@@ -165,11 +165,23 @@ export const DETECT_PATTERNS = [
|
|
|
165
165
|
/(?:файл[а-яё]*[\s-]+(?:cookie|куки)|(?:cookie|куки)[\s-]+файл[а-яё]*)/gi,
|
|
166
166
|
|
|
167
167
|
// Italian (IT)
|
|
168
|
-
|
|
168
|
+
// e.g. "usiamo i cookie", "utilizziamo cookie tecnici", "questo sito utilizza i cookie", "noi e i nostri partner utilizziamo i cookie"
|
|
169
|
+
/(?:usiamo|utilizziamo).{0,20}cookie/gi,
|
|
170
|
+
/sito.{0,50}(?:usa|utilizza).{0,20}cookie/gi,
|
|
171
|
+
/noi e i nostri.{0,20}partner.{0,100}cookie/gi,
|
|
172
|
+
/(?:archiviare|memorizzare) e\/o accedere a informazioni su un dispositivo/gi,
|
|
173
|
+
|
|
174
|
+
// Swedish (SV)
|
|
175
|
+
// e.g. "vi använder cookies", "vi använder spårningstekniker såsom cookies", "webbplatsen använder kakor"
|
|
176
|
+
/(?:vi|webbplatsen|webbplats|sajten|sidan)\s+använder.{0,60}(?:cookies|kakor)/gi,
|
|
169
177
|
|
|
170
178
|
// Japanese (JA)
|
|
171
179
|
// e.g. "当サイトはCookieを使用しています", "クッキー(Cookie)を利用しています"
|
|
172
180
|
/(?:cookie|クッキー).{0,10}を(?:使用|利用)/gi,
|
|
181
|
+
|
|
182
|
+
// Danish (DA)
|
|
183
|
+
// e.g. "vi bruger cookies", "hjemmesiden bruger cookies til at ..."
|
|
184
|
+
/bruger cookies/gi,
|
|
173
185
|
];
|
|
174
186
|
|
|
175
187
|
const REJECT_PATTERNS_ENGLISH = [
|
|
@@ -350,6 +362,17 @@ const REJECT_PATTERNS_SWEDISH = [
|
|
|
350
362
|
'jag accepterar endast grundläggande kakor',
|
|
351
363
|
];
|
|
352
364
|
|
|
365
|
+
const REJECT_PATTERNS_DANISH = [
|
|
366
|
+
// afvis / afvis alle / afvis alle cookies (reject verbs)
|
|
367
|
+
/(^|\s)afvis/is,
|
|
368
|
+
|
|
369
|
+
// (accept/allow) only necessary cookies
|
|
370
|
+
/^(accepter\s+|tillad\s+)?(kun|udelukkende)\s+(strengt\s+)?nødvendige( cookies)?$/is,
|
|
371
|
+
|
|
372
|
+
// "nej tak" (no thanks)
|
|
373
|
+
/^nej(,?\s+tak)?$/is,
|
|
374
|
+
];
|
|
375
|
+
|
|
353
376
|
const REJECT_PATTERNS_CATALAN = [/(^|\s)rebutj/is, 'no accepto', 'no, gràcies'];
|
|
354
377
|
|
|
355
378
|
const REJECT_PATTERNS_GALICIAN = [/(^|\s)rexeitar/is];
|
|
@@ -415,6 +438,7 @@ export const REJECT_PATTERNS = [
|
|
|
415
438
|
...REJECT_PATTERNS_BRAZILIAN_PORTUGUESE,
|
|
416
439
|
...REJECT_PATTERNS_SPANISH,
|
|
417
440
|
...REJECT_PATTERNS_SWEDISH,
|
|
441
|
+
...REJECT_PATTERNS_DANISH,
|
|
418
442
|
...REJECT_PATTERNS_CATALAN,
|
|
419
443
|
...REJECT_PATTERNS_GALICIAN,
|
|
420
444
|
...REJECT_PATTERNS_BASQUE,
|
|
@@ -806,6 +830,7 @@ export const ACCEPT_PATTERNS = [
|
|
|
806
830
|
// Italian (IT)
|
|
807
831
|
'accetta',
|
|
808
832
|
'accetta tutti i cookie',
|
|
833
|
+
'accetto tutti i cookie',
|
|
809
834
|
];
|
|
810
835
|
|
|
811
836
|
export const ACKNOWLEDGE_PATTERNS = [
|