@duckduckgo/autoconsent 16.50.0 → 16.52.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/skills/optimize-button-patterns/SKILL.md +4 -4
- package/.github/workflows/ddg-release.yml +2 -2
- package/AGENTS.md +2 -1
- package/CHANGELOG.md +120 -0
- package/build.sh +2 -0
- package/data/labelled-button-texts.csv +36 -36
- package/dist/addon-firefox/compact-rules.json +1 -1
- package/dist/addon-firefox/content.bundle.js +52 -42
- 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/compact-rules.json +1 -1
- package/dist/addon-mv3/content.bundle.js +52 -42
- 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 +52 -42
- package/dist/autoconsent.esm.js +52 -42
- package/dist/autoconsent.playwright.js +53 -42
- package/dist/autoconsent.standalone.js +53 -43
- package/dist/heuristics.cjs.js +886 -0
- package/dist/heuristics.mjs +847 -0
- package/dist/types/heuristic-classify.d.ts +16 -0
- package/dist/types/heuristics.d.ts +2 -9
- package/dist/types/types.d.ts +3 -5
- package/docs/rule-syntax.md +1 -1
- package/lib/dom-actions.ts +5 -1
- package/lib/heuristic-classify.ts +136 -0
- package/lib/heuristic-patterns.ts +18 -14
- package/lib/heuristics.ts +3 -124
- package/lib/types.ts +3 -5
- package/lib/web.ts +1 -1
- package/package.json +7 -2
- package/playwright/content.ts +5 -0
- package/readme.md +12 -0
- package/rules/autoconsent/abcacupuncture1.json +34 -0
- package/rules/autoconsent/aceodds.json +13 -0
- package/rules/autoconsent/allabout-japan.json +42 -0
- package/rules/autoconsent/avvio.json +22 -0
- package/rules/autoconsent/axeptio.json +5 -2
- package/rules/autoconsent/bdirect-booking-engine.json +33 -0
- package/rules/autoconsent/berelax.com.json +33 -0
- package/rules/autoconsent/bigid.json +59 -0
- package/rules/autoconsent/bluepark.json +31 -0
- package/rules/autoconsent/burpee-com.json +5 -1
- package/rules/autoconsent/bynder.json +33 -0
- package/rules/autoconsent/cinemaplus.json +9 -0
- package/rules/autoconsent/columbia-privacy-notice.json +32 -0
- package/rules/autoconsent/community.screwfix.com.json +23 -0
- package/rules/autoconsent/complianz-notice.json +1 -1
- package/rules/autoconsent/cookieconsent2-legacy.json +44 -0
- package/rules/autoconsent/cookiesjsr.json +27 -0
- package/rules/autoconsent/copaamerica.json +29 -0
- package/rules/autoconsent/cornerstone-brands.json +51 -0
- package/rules/autoconsent/darkounity.com.json +35 -0
- package/rules/autoconsent/duda-cookie-notification.json +41 -0
- package/rules/autoconsent/endocrine.org.json +35 -0
- package/rules/autoconsent/ezoic.json +2 -2
- package/rules/autoconsent/fis-data-exchange.json +13 -0
- package/rules/autoconsent/getproven.json +33 -0
- package/rules/autoconsent/givedirectly.json +36 -0
- package/rules/autoconsent/godaddy-website-builder-cosmetic.json +13 -0
- package/rules/autoconsent/godaddy-website-builder.json +9 -0
- package/rules/autoconsent/guesty.json +31 -0
- package/rules/autoconsent/gundam-base-entry.json +40 -0
- package/rules/autoconsent/hearst-us.json +1 -1
- package/rules/autoconsent/indy-systems.json +26 -0
- package/rules/autoconsent/ing-nl.json +54 -0
- package/rules/autoconsent/iubenda.json +25 -3
- package/rules/autoconsent/la-becanerie.json +13 -0
- package/rules/autoconsent/lta.json +22 -0
- package/rules/autoconsent/lucrin.json +18 -0
- package/rules/autoconsent/makitatools.json +41 -0
- package/rules/autoconsent/milestone-internet.json +32 -0
- package/rules/autoconsent/mizuno-com.json +13 -0
- package/rules/autoconsent/nhm-ac-uk.json +29 -0
- package/rules/autoconsent/npo-ccm.json +42 -0
- package/rules/autoconsent/opalcollection-com.json +12 -0
- package/rules/autoconsent/orw-cookie-banner.json +42 -0
- package/rules/autoconsent/osf-io.json +29 -0
- package/rules/autoconsent/palace-company.json +13 -0
- package/rules/autoconsent/paytronix.json +30 -0
- package/rules/autoconsent/pigu.json +35 -0
- package/rules/autoconsent/pitt-edu.json +12 -0
- package/rules/autoconsent/pizzapilgrims.co.uk.json +49 -0
- package/rules/autoconsent/podimo.json +73 -0
- package/rules/autoconsent/publicmobile.json +16 -0
- package/rules/autoconsent/quantcast.json +85 -34
- package/rules/autoconsent/rakshaos.json +45 -0
- package/rules/autoconsent/rutjes.json +13 -0
- package/rules/autoconsent/saturdaysnyc.json +33 -0
- package/rules/autoconsent/serpstat-com.json +13 -0
- package/rules/autoconsent/shopquarters.json +41 -0
- package/rules/autoconsent/shopware.json +71 -0
- package/rules/autoconsent/simpleview-cookie-banner.json +27 -0
- package/rules/autoconsent/solvhealth-com.json +12 -0
- package/rules/autoconsent/spermidinelife-us.json +29 -0
- package/rules/autoconsent/squarespace-cookie-banner.json +1 -1
- package/rules/autoconsent/squarespace-cookie-notice.json +29 -0
- package/rules/autoconsent/store2000-fr.json +17 -0
- package/rules/autoconsent/tealium.json +10 -4
- package/rules/autoconsent/tempest-cookie-notice.json +9 -0
- package/rules/autoconsent/termsfeed.json +4 -4
- package/rules/autoconsent/therealest.json +42 -0
- package/rules/autoconsent/tineye.json +35 -0
- package/rules/autoconsent/tk-aerztefuehrer.de.json +18 -0
- package/rules/autoconsent/tplink.json +57 -9
- package/rules/autoconsent/trust360.json +29 -0
- package/rules/autoconsent/up-cookie-consent.json +53 -0
- package/rules/autoconsent/uw-madison-cookieconsent.json +10 -0
- package/rules/autoconsent/vowels.json +13 -0
- package/rules/autoconsent/web-rewind.com.json +21 -0
- package/rules/autoconsent/wildling-com.json +29 -0
- package/rules/autoconsent/worldbank.json +30 -0
- package/rules/autoconsent/yuntrack.json +50 -0
- package/rules/compact-rules.json +1 -1
- package/rules/rule-index.json +1 -1
- package/rules/rules.json +1 -1
- package/scripts/benchmark-button-classification.ts +18 -3
- package/scripts/button-text-benchmark.ts +5 -5
- package/tests/abcacupuncture1.spec.ts +3 -0
- package/tests/aceodds.spec.ts +3 -0
- package/tests/allabout-japan.spec.ts +3 -0
- package/tests/avvio.spec.ts +8 -0
- package/tests/axeptio.spec.ts +3 -0
- package/tests/bdirect-booking-engine.spec.ts +9 -0
- package/tests/berelax.com.spec.ts +5 -0
- package/tests/bigid.spec.ts +8 -0
- package/tests/bluepark.spec.ts +8 -0
- package/tests/burpee-com.spec.ts +2 -0
- package/tests/bynder.spec.ts +3 -0
- package/tests/cinemaplus.spec.ts +8 -0
- package/tests/columbia-privacy-notice.spec.ts +8 -0
- package/tests/community.screwfix.com.spec.ts +5 -0
- package/tests/complianz-notice.spec.ts +7 -3
- package/tests/cookieconsent2-legacy.spec.ts +8 -0
- package/tests/cookiesjsr.spec.ts +9 -0
- package/tests/copaamerica.spec.ts +3 -0
- package/tests/cornerstone-brands.spec.ts +8 -0
- package/tests/darkounity.com.spec.ts +6 -0
- package/tests/duda-cookie-notification.spec.ts +8 -0
- package/tests/endocrine.org.spec.ts +3 -0
- package/tests/ezoic.spec.ts +1 -1
- package/tests/fis-data-exchange.spec.ts +9 -0
- package/tests/getproven.spec.ts +5 -0
- package/tests/givedirectly.spec.ts +3 -0
- package/tests/godaddy-website-builder-cosmetic.spec.ts +7 -0
- package/tests/godaddy-website-builder.spec.ts +8 -0
- package/tests/guesty.spec.ts +7 -0
- package/tests/gundam-base-entry.spec.ts +3 -0
- package/tests/hearst-us.spec.ts +1 -0
- package/tests/indy-systems.spec.ts +8 -0
- package/tests/ing-nl.spec.ts +6 -0
- package/tests/iubenda.spec.ts +5 -0
- package/tests/la-becanerie.spec.ts +3 -0
- package/tests/lta.spec.ts +7 -0
- package/tests/lucrin.spec.ts +3 -0
- package/tests/makitatools.spec.ts +5 -0
- package/tests/milestone-internet.spec.ts +8 -0
- package/tests/mizuno-com.spec.ts +7 -0
- package/tests/nhm-ac-uk.spec.ts +3 -0
- package/tests/npo-ccm.spec.ts +17 -0
- package/tests/opalcollection-com.spec.ts +3 -0
- package/tests/orw-cookie-banner.spec.ts +5 -0
- package/tests/osf-io.spec.ts +3 -0
- package/tests/palace-company.spec.ts +8 -0
- package/tests/paytronix.spec.ts +7 -0
- package/tests/pigu.spec.ts +3 -0
- package/tests/pitt-edu.spec.ts +3 -0
- package/tests/pizzapilgrims.co.uk.spec.ts +3 -0
- package/tests/podimo.spec.ts +3 -0
- package/tests/publicmobile.spec.ts +3 -0
- package/tests/quantcast.spec.ts +15 -7
- package/tests/rakshaos.spec.ts +9 -0
- package/tests/rutjes.spec.ts +3 -0
- package/tests/saturdaysnyc.spec.ts +3 -0
- package/tests/serpstat-com.spec.ts +3 -0
- package/tests/shopquarters.spec.ts +5 -0
- package/tests/shopware.spec.ts +8 -0
- package/tests/simpleview-cookie-banner.spec.ts +10 -0
- package/tests/solvhealth-com.spec.ts +10 -0
- package/tests/spermidinelife-us.spec.ts +3 -0
- package/tests/squarespace-cookie-notice.spec.ts +9 -0
- package/tests/store2000-fr.spec.ts +5 -0
- package/tests/tealium.spec.ts +3 -0
- package/tests/tempest-cookie-notice.spec.ts +7 -0
- package/tests/termsfeed.spec.ts +4 -0
- package/tests/therealest.spec.ts +6 -0
- package/tests/tineye.spec.ts +3 -0
- package/tests/tk-aerztefuehrer.de.spec.ts +6 -0
- package/tests/tplink.spec.ts +11 -1
- package/tests/trust360.spec.ts +8 -0
- package/tests/up-cookie-consent.spec.ts +9 -0
- package/tests/uw-madison-cookieconsent.spec.ts +7 -0
- package/tests/vowels.spec.ts +3 -0
- package/tests/web-rewind.com.spec.ts +5 -0
- package/tests/wildling-com.spec.ts +3 -0
- package/tests/worldbank.spec.ts +7 -0
- package/tests/yuntrack.spec.ts +6 -0
- package/tests-wtr/dom-actions/dom-actions.click.ts +18 -0
- package/tests-wtr/heuristics/button-classification-accuracy.test.ts +9 -5
- package/tests-wtr/heuristics/get-potential-popups.test.ts +28 -0
- package/tests-wtr/heuristics/heuristics-utils.test.ts +2 -6
- package/tsconfig.build.json +1 -1
- package/tsconfig.heuristics.json +10 -0
- package/Dockerfile +0 -9
|
@@ -606,7 +606,8 @@
|
|
|
606
606
|
/^\s*(i\s+)?(want\s+to\s+)?only\s+(strictly\s+)?(necessary|essential|essentials|functional|required|minimal)\s*(cookies)?\s*(continue|only)?\s*$/is,
|
|
607
607
|
/^\s*(strictly\s+)?(necessary|essential|essentials|functional|required|minimal)\s+((cookies\s+)?only|only\s+cookies)\s*$/is,
|
|
608
608
|
// e.g. "do not sell or share my personal information", "do not share my personal information", "opt out of sale ..." (CCPA)
|
|
609
|
-
|
|
609
|
+
// "do not sell page" is a link; "do not sellcookie settings" is two concatenated buttons
|
|
610
|
+
/do\s+not\s+sell(?!\s*(page|cookie settings))|do\s+not\s+share\s+my\s+(personal\s+)?(information|info|data)|opt\s+out\s+of\s+sale/is,
|
|
610
611
|
// e.g. "opt-out of sale/share or targeted advertising", "opt-out of advertising/social media cookies"
|
|
611
612
|
/^opt[ -]?out of /is,
|
|
612
613
|
// e.g. "reject all except strictly necessary", "reject all (except necessary cookies)"
|
|
@@ -617,7 +618,6 @@
|
|
|
617
618
|
/^no,? thank(s| you)$/is,
|
|
618
619
|
/^opt[ -]out$/is,
|
|
619
620
|
"dont enable",
|
|
620
|
-
"withdraw consent",
|
|
621
621
|
"i do not agree"
|
|
622
622
|
];
|
|
623
623
|
var REJECT_PATTERNS_DUTCH = [
|
|
@@ -644,9 +644,10 @@
|
|
|
644
644
|
var REJECT_PATTERNS_FRENCH = [
|
|
645
645
|
// refuser / rejeter / interdire / décliner (reject verbs, any position)
|
|
646
646
|
// "refuser et s'abonner" / "refuser et payer" are excluded via BUTTON_NEVER_MATCH_PATTERNS
|
|
647
|
-
|
|
647
|
+
// skip English prose such as "cookies that you can refuse"
|
|
648
|
+
/^(?!.*\bcan refuse\b)(.*\s)?(refus|rejet|rejeter|interdire|interdis|déclin|declin)/is,
|
|
648
649
|
// only necessary / essential / technical / functional
|
|
649
|
-
|
|
650
|
+
/^(?=.*(cookie|nécessaire|essentiel|techni|requis|obligatoire|fonctionnel|indispensable|sdk)).*(uniquement|seulement|indispensable|strictement nécessaire|que les cookies\s+(nécessaires|techniques|essentiels|indispensables|fonctionnels))/is,
|
|
650
651
|
// continue/proceed without accepting; refuse everything; disable purposes
|
|
651
652
|
/(sans accepter|ne pas accepter|je naccepte rien|je désactive)/is,
|
|
652
653
|
// "non" / "non, merci"
|
|
@@ -704,7 +705,7 @@
|
|
|
704
705
|
// "solo/sólo/no, sólo ... necessary/essential"
|
|
705
706
|
/^(no,?\s+)?(solo|sólo|només)\s+(usar\s+|las?\s+|los\s+|lo\s+)?.{0,20}(necesari|esencial|estrictamente)/is,
|
|
706
707
|
// refusals / opt-outs
|
|
707
|
-
/^(no acept|no consentir|no permitir|no estoy de acuerdo|no,? gracias|sin consentimiento|
|
|
708
|
+
/^(no acept|no consentir|no permitir|no estoy de acuerdo|no,? gracias|sin consentimiento|continuar sin aceptar|prefiero rechazarlas|descartar todas)/is,
|
|
708
709
|
"acceptar nom\xE9s les necess\xE0ries",
|
|
709
710
|
"nom\xE9s sutilitzen cookies quan \xE9s necessari",
|
|
710
711
|
"pulsa aqu\xED para desactivar las cookies opcionales"
|
|
@@ -780,6 +781,9 @@
|
|
|
780
781
|
...REJECT_PATTERNS_JAPANESE
|
|
781
782
|
];
|
|
782
783
|
var BUTTON_NEVER_MATCH_PATTERNS = [
|
|
784
|
+
// text of several concatenated buttons, or popup body text rather than a button
|
|
785
|
+
/accept all.*reject all|reject all.*accept all/is,
|
|
786
|
+
/^.{300,}$/s,
|
|
783
787
|
/pay|subscribe/is,
|
|
784
788
|
/abonneer/is,
|
|
785
789
|
/abonnier/is,
|
|
@@ -820,8 +824,10 @@
|
|
|
820
824
|
// Multilingual "open customization" patterns: a customization verb next to a
|
|
821
825
|
// cookie/preference/settings/options/details/purposes noun (both word orders).
|
|
822
826
|
// The negative lookahead avoids policy links and save/confirm/accept phrases (those are accept/acknowledge/other).
|
|
823
|
-
/^(?!.*\b(policy|policies|notice|statement|impressum
|
|
824
|
-
/^(?!.*\b(policy|policies|notice|statement|impressum
|
|
827
|
+
/^(?!.*\b(policy|policies|notice|statement|impressum|\w*richtlinie\w*|\w*erklärung|page|beschrijving|privacy$|beleid|politique|política|polityk|speichern|guardar|opslaan|zapisz|enregistrer|sauvegarder|bevestig|bestätig|confirm|save|submit|akzeptier|accept|zaakcept)\b)(customi[sz]e|manage|adjust|configure|personali[sz]e|let me choose|edit|change|set|select|view|see|review|update|open|show|choose|anpassen|verwalten|konfigurieren|bearbeiten|öffnen|anzeigen|einblenden|einstellen|festlegen|auswählen|wählen|aanpassen|beheren|instellen|wijzig\w*|personaliseren|personaliseer|kies|bekijk|toon|personnaliser|paramétrer|gérer|configurer|choisir|afficher|définir|modifier|configurar|personalizar|gestionar|administrar|ajustar|seleccionar|modificar|establecer|dostosuj|zarządzaj|personalizuj|ustaw\w*|zmień|pokaż|wybierz)\b.{0,20}(cookies?|preferences?|settings?|options?|choices?|controls?|details?|purposes?|services?|consent|einstellung\w*|optionen|präferenzen|einzelheiten|zwecke|dienste|datenschutz\w*|auswahl|voorkeur\w*|instelling\w*|opties|diensten|préférences|paramètres|réglages|choix|détails|finalités|témoins|preferencia\w*|opciones|ajustes|configuraci\w*|detalles|servicios|elección|preferencj\w*|ustawie\w*|opcje|szczegół\w*|cele|galetes)\b/is,
|
|
828
|
+
/^(?!.*\b(policy|policies|notice|statement|impressum|\w*richtlinie\w*|\w*erklärung|page|beschrijving|privacy$|beleid|politique|política|polityk|speichern|guardar|opslaan|zapisz|enregistrer|sauvegarder|bevestig|bestätig|confirm|save|submit|akzeptier|accept|zaakcept)\b)(cookies?|preferences?|settings?|options?|choices?|controls?|details?|purposes?|services?|consent|einstellung\w*|optionen|präferenzen|einzelheiten|zwecke|dienste|datenschutz\w*|auswahl|voorkeur\w*|instelling\w*|opties|diensten|préférences|paramètres|réglages|choix|détails|finalités|témoins|preferencia\w*|opciones|ajustes|configuraci\w*|detalles|servicios|elección|preferencj\w*|ustawie\w*|opcje|szczegół\w*|cele|galetes)\b(.{0,14}\W)?(customi[sz]e|manage|adjust|configure|personali[sz]e|let me choose|edit|change|set|select|view|see|review|update|open|show|choose|anpassen|verwalten|konfigurieren|bearbeiten|öffnen|anzeigen|einblenden|einstellen|festlegen|auswählen|wählen|aanpassen|beheren|instellen|wijzig\w*|personaliseren|personaliseer|kies|bekijk|toon|personnaliser|paramétrer|gérer|configurer|choisir|afficher|définir|modifier|configurar|personalizar|gestionar|administrar|ajustar|seleccionar|modificar|establecer|dostosuj|zarządzaj|personalizuj|ustaw\w*|zmień|pokaż|wybierz)\b/is,
|
|
829
|
+
// settings noun + cookies, e.g. "paramètres des cookies", "ajustes de cookies", "instellingen voor cookies en diensten"
|
|
830
|
+
/^(paramètres|préférences|réglages|ajustes|opciones|elección|preferencias|instellingen)( (de|des|les|voor|van))? cookies( (et des|en|y) (services|diensten|servicios))?$/is,
|
|
825
831
|
"settings",
|
|
826
832
|
"preferences",
|
|
827
833
|
/customi(s|z)e/is,
|
|
@@ -835,8 +841,8 @@
|
|
|
835
841
|
"cookieconsent preferences",
|
|
836
842
|
/privacy choices/is,
|
|
837
843
|
/^(privacy|cookie|custom) settings$/is,
|
|
838
|
-
/^cookies? (settings|preferences|setting)
|
|
839
|
-
|
|
844
|
+
/^cookies? (settings|preferences|setting)(?!.*\bdo not\b)/is,
|
|
845
|
+
/^(?!.*\bpolic(y|ies)\b).*(manage|customize|customise|opt-out|edit).*(cookies|preferences|settings|options)/is,
|
|
840
846
|
"cookie consent options",
|
|
841
847
|
"privacy controls",
|
|
842
848
|
// German
|
|
@@ -1007,7 +1013,7 @@
|
|
|
1007
1013
|
"yes",
|
|
1008
1014
|
/accept all above/is,
|
|
1009
1015
|
"close and accept",
|
|
1010
|
-
/accept all$/is,
|
|
1016
|
+
/(^|\s)accept all$/is,
|
|
1011
1017
|
"im ok with that",
|
|
1012
1018
|
// Spanish (ES)
|
|
1013
1019
|
/^acept(ar|o)( cookies)?$/,
|
|
@@ -1033,6 +1039,8 @@
|
|
|
1033
1039
|
"accepta",
|
|
1034
1040
|
"accepta totes les cookies",
|
|
1035
1041
|
"accepta-ho tot",
|
|
1042
|
+
// FR/CA "d'accord" / "d'acord"
|
|
1043
|
+
/^dac?cord( fermer)?$/is,
|
|
1036
1044
|
"accepta-les totes",
|
|
1037
1045
|
"acceptar galetes",
|
|
1038
1046
|
"acceptar i tancar",
|
|
@@ -1074,7 +1082,6 @@
|
|
|
1074
1082
|
"akceptuj\u0119!",
|
|
1075
1083
|
"ok, zgadzam si\u0119",
|
|
1076
1084
|
"potwierdzam wszystkie",
|
|
1077
|
-
"przejd\u017A do serwisu",
|
|
1078
1085
|
"tak",
|
|
1079
1086
|
"tak, zgadzam si\u0119 na wszystkie pliki cookie",
|
|
1080
1087
|
"tak, zgadzam si\u0119",
|
|
@@ -1145,8 +1152,6 @@
|
|
|
1145
1152
|
"seguir",
|
|
1146
1153
|
"vale",
|
|
1147
1154
|
"\xA1vamos!",
|
|
1148
|
-
// Catalan (CA)
|
|
1149
|
-
"dacord",
|
|
1150
1155
|
// Polish (PL)
|
|
1151
1156
|
"kontynuuj",
|
|
1152
1157
|
"ok, zrozumia\u0142em",
|
|
@@ -1170,10 +1175,8 @@
|
|
|
1170
1175
|
"\u043F\u0440\u043E\u0434\u043E\u043B\u0436\u0438\u0442\u044C"
|
|
1171
1176
|
];
|
|
1172
1177
|
|
|
1173
|
-
// lib/
|
|
1174
|
-
var BUTTON_LIKE_ELEMENT_SELECTOR = 'button, input[type="button"], input[type="submit"], a, [role="button"], [class*="button"]';
|
|
1178
|
+
// lib/heuristic-classify.ts
|
|
1175
1179
|
var TEXT_LIMIT = 1e5;
|
|
1176
|
-
var POPUP_SEARCH_MAX_TIME = 100;
|
|
1177
1180
|
function checkHeuristicPatterns(allText, detectPatterns = DETECT_PATTERNS) {
|
|
1178
1181
|
allText = allText.slice(0, TEXT_LIMIT);
|
|
1179
1182
|
const patterns = [];
|
|
@@ -1191,31 +1194,6 @@
|
|
|
1191
1194
|
}
|
|
1192
1195
|
return { patterns, snippets: snippets2 };
|
|
1193
1196
|
}
|
|
1194
|
-
function getActionablePopups(mode = "reject", timeout = POPUP_SEARCH_MAX_TIME) {
|
|
1195
|
-
const acceptedLevels = mode === "tier2" ? ["reject", "tier1", "tier2"] : mode === "tier1" ? ["reject", "tier1"] : ["reject"];
|
|
1196
|
-
if (acceptedLevels.length === 0) {
|
|
1197
|
-
return [];
|
|
1198
|
-
}
|
|
1199
|
-
const popups = getPotentialPopups(timeout);
|
|
1200
|
-
const result = popups.reduce((acc, popup) => {
|
|
1201
|
-
const popupText = popup.text?.trim();
|
|
1202
|
-
if (popupText) {
|
|
1203
|
-
if (isExcludedPopup(popupText)) {
|
|
1204
|
-
return acc;
|
|
1205
|
-
}
|
|
1206
|
-
const { patterns } = checkHeuristicPatterns(popupText);
|
|
1207
|
-
if (patterns.length > 0) {
|
|
1208
|
-
classifyButtons(popup.buttons);
|
|
1209
|
-
popup.regexClassification = classifyPopup(popup.buttons);
|
|
1210
|
-
acc.push({
|
|
1211
|
-
...popup
|
|
1212
|
-
});
|
|
1213
|
-
}
|
|
1214
|
-
}
|
|
1215
|
-
return acc;
|
|
1216
|
-
}, []);
|
|
1217
|
-
return result.filter((popup) => popup.regexClassification !== void 0 && acceptedLevels.includes(popup.regexClassification)).sort((a, b) => (a.regexClassification ?? "") > (b.regexClassification ?? "") ? 1 : -1);
|
|
1218
|
-
}
|
|
1219
1197
|
function classifyButtons(buttons) {
|
|
1220
1198
|
for (const button of buttons) {
|
|
1221
1199
|
button.regexClassification = classifyButtonTextRegex(button.text);
|
|
@@ -1286,6 +1264,35 @@
|
|
|
1286
1264
|
}
|
|
1287
1265
|
return "other";
|
|
1288
1266
|
}
|
|
1267
|
+
|
|
1268
|
+
// lib/heuristics.ts
|
|
1269
|
+
var BUTTON_LIKE_ELEMENT_SELECTOR = 'button, input[type="button"], input[type="submit"], a, [role="button"], [class*="button"]';
|
|
1270
|
+
var POPUP_SEARCH_MAX_TIME = 100;
|
|
1271
|
+
function getActionablePopups(mode = "reject", timeout = POPUP_SEARCH_MAX_TIME) {
|
|
1272
|
+
const acceptedLevels = mode === "tier2" ? ["reject", "tier1", "tier2"] : mode === "tier1" ? ["reject", "tier1"] : ["reject"];
|
|
1273
|
+
if (acceptedLevels.length === 0) {
|
|
1274
|
+
return [];
|
|
1275
|
+
}
|
|
1276
|
+
const popups = getPotentialPopups(timeout);
|
|
1277
|
+
const result = popups.reduce((acc, popup) => {
|
|
1278
|
+
const popupText = popup.text?.trim();
|
|
1279
|
+
if (popupText) {
|
|
1280
|
+
if (isExcludedPopup(popupText)) {
|
|
1281
|
+
return acc;
|
|
1282
|
+
}
|
|
1283
|
+
const { patterns } = checkHeuristicPatterns(popupText);
|
|
1284
|
+
if (patterns.length > 0) {
|
|
1285
|
+
classifyButtons(popup.buttons);
|
|
1286
|
+
popup.regexClassification = classifyPopup(popup.buttons);
|
|
1287
|
+
acc.push({
|
|
1288
|
+
...popup
|
|
1289
|
+
});
|
|
1290
|
+
}
|
|
1291
|
+
}
|
|
1292
|
+
return acc;
|
|
1293
|
+
}, []);
|
|
1294
|
+
return result.filter((popup) => popup.regexClassification !== void 0 && acceptedLevels.includes(popup.regexClassification)).sort((a, b) => (a.regexClassification ?? "") > (b.regexClassification ?? "") ? 1 : -1);
|
|
1295
|
+
}
|
|
1289
1296
|
function getPotentialPopups(timeout = POPUP_SEARCH_MAX_TIME) {
|
|
1290
1297
|
const isFramed = !isTopFrame();
|
|
1291
1298
|
if (isFramed && window.parent && window.parent !== window.top) {
|
|
@@ -2578,7 +2585,10 @@
|
|
|
2578
2585
|
this.autoconsentInstance.config.logs.rulesteps && console.log("[click]", selector, all, elements);
|
|
2579
2586
|
if (elements.length > 0) {
|
|
2580
2587
|
if (all) {
|
|
2581
|
-
|
|
2588
|
+
for (const e of elements) {
|
|
2589
|
+
e.click();
|
|
2590
|
+
await new Promise((resolve) => setTimeout(resolve, 0));
|
|
2591
|
+
}
|
|
2582
2592
|
} else {
|
|
2583
2593
|
elements[0].click();
|
|
2584
2594
|
}
|