@duckduckgo/autoconsent 16.11.0 → 16.13.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.
@@ -528,7 +528,7 @@
528
528
  var REJECT_PATTERNS_ENGLISH = [
529
529
  // e.g. "reject", "reject all", "reject all cookies", "deny all", "refuse cookies", "decline",
530
530
  // "reject non-essential cookies", "reject unnecessary cookies", "reject all but necessary", "reject all and close"
531
- // note that "reject and subscribe" and "reject and pay" are excluded via NEVER_MATCH_PATTERNS
531
+ // note that "reject and subscribe" and "reject and pay" are excluded via BUTTON_NEVER_MATCH_PATTERNS
532
532
  /^\s*(no,?\s*)?(i\s+)?(reject|deny|refuse|decline|disable)\s*(all)?\s*(but|except)?\s*(non[- ]?essential|un(necessary|required)|optional|additional|targeting|analytics|marketing|non[- ]?necessary|extra|tracking|advertising|necessary|essential)?\s*(cookies)?\s*(and\s+close)?\s*$/is,
533
533
  // e.g. "i do not accept", "do not accept cookies"
534
534
  /^\s*(i\s+)?do\s+not\s+accept\s*(cookies)?\s*$/is,
@@ -576,7 +576,7 @@
576
576
  ];
577
577
  var REJECT_PATTERNS_FRENCH = [
578
578
  // refuser / rejeter / interdire / décliner (reject verbs, any position)
579
- // "refuser et s'abonner" / "refuser et payer" are excluded via NEVER_MATCH_PATTERNS
579
+ // "refuser et s'abonner" / "refuser et payer" are excluded via BUTTON_NEVER_MATCH_PATTERNS
580
580
  /(^|\s)(refus|rejet|rejeter|interdire|interdis|déclin|declin)/is,
581
581
  // only necessary / essential / technical / functional
582
582
  /(uniquement|seulement|indispensable|strictement nécessaire|que les cookies\s+(nécessaires|techniques|essentiels|indispensables|fonctionnels))/is,
@@ -631,7 +631,7 @@
631
631
  ];
632
632
  var REJECT_PATTERNS_SPANISH = [
633
633
  // rechazar / denegar / declinar / negar (reject verbs, any position)
634
- // "rechazar y pagar" / "rechazar y suscribirse" are excluded via NEVER_MATCH_PATTERNS
634
+ // "rechazar y pagar" / "rechazar y suscribirse" are excluded via BUTTON_NEVER_MATCH_PATTERNS
635
635
  /(^|\s)(rechaz|recház|deneg|negar|declin)/is,
636
636
  // accept/allow/use (only) necessary / essential / technical / functional / own
637
637
  /^\s*(aceptar?|acepta|permitir|permite|usar|utilizar)?\s*(solo|sólo|només|únicamente)?\s*(las?\s+|los\s+)?(cookies?\s+)?(estrictamente\s+)?(necesari\w*|esencial\w*|técnic\w*|obligatori\w*|funcional\w*|propias)\s*$/is,
@@ -699,7 +699,7 @@
699
699
  ...REJECT_PATTERNS_TURKISH,
700
700
  ...REJECT_PATTERNS_INDONESIAN
701
701
  ];
702
- var NEVER_MATCH_PATTERNS = [
702
+ var BUTTON_NEVER_MATCH_PATTERNS = [
703
703
  /pay|subscribe/is,
704
704
  /abonneer/is,
705
705
  /abonnier/is,
@@ -720,6 +720,20 @@
720
720
  // Polish (PL)
721
721
  /subskrybuj/
722
722
  ];
723
+ var DETECT_NEVER_MATCH_PATTERNS = [
724
+ // e.g. "age verification", "age confirmation", "age check", "age gate", "age restriction"
725
+ /age\s+(?:verification|confirmation|check|gate|restriction)/i,
726
+ // e.g. "over 18 years", "at least 21 years", "older than 21", "18+"
727
+ /(?:over|above|at\s*least|minimum|older\s+than)\s*(?:18|21)\s*(?:years|yo|y\.?o\.?|\+)?/i,
728
+ // e.g. "18 years of age", "18+ years old", "21 years or older"
729
+ /(?:18|21)\s*(?:\+|years?)\s*(?:of\s*age|or\s*older|or\s*above)/i,
730
+ // e.g. "I am 18+", "I am over 18", "I'm 21 or older"
731
+ /(?:i'?m|i\s*am)\s*(?:over|above|at\s*least)?\s*(?:18|21)(?:\+|\s*(?:or\s*older|years))?/i,
732
+ // e.g. "you must be 18", "users must be at least 21", "visitors must be over 18"
733
+ /(?:you|users?|visitors?)\s+must\s+be\s+(?:over|above|at\s*least)?\s*(?:18|21)/i,
734
+ // e.g. "adult oriented material", "adult content", "adult-only website"
735
+ /adult[\s-]+(?:oriented|only|content|material|websites?)/i
736
+ ];
723
737
  var SETTINGS_PATTERNS = [
724
738
  // Multilingual "open customization" patterns: a customization verb next to a
725
739
  // cookie/preference/settings/options/details/purposes noun (both word orders).
@@ -1093,6 +1107,9 @@
1093
1107
  const result = popups.reduce((acc, popup) => {
1094
1108
  const popupText = popup.text?.trim();
1095
1109
  if (popupText) {
1110
+ if (isExcludedPopup(popupText)) {
1111
+ return acc;
1112
+ }
1096
1113
  const { patterns } = checkHeuristicPatterns(popupText);
1097
1114
  if (patterns.length > 0) {
1098
1115
  classifyButtons(popup.buttons);
@@ -1111,6 +1128,13 @@
1111
1128
  button.regexClassification = classifyButtonTextRegex(button.text);
1112
1129
  }
1113
1130
  }
1131
+ function isExcludedPopup(popupText, excludePatterns = DETECT_NEVER_MATCH_PATTERNS) {
1132
+ if (!popupText) {
1133
+ return false;
1134
+ }
1135
+ const truncated = popupText.slice(0, TEXT_LIMIT);
1136
+ return excludePatterns.some((p) => p.test(truncated));
1137
+ }
1114
1138
  function classifyPopup(buttons) {
1115
1139
  const { reject, settings, accept, acknowledge } = buttons.reduce(
1116
1140
  (acc, button) => {
@@ -1155,16 +1179,16 @@
1155
1179
  return result;
1156
1180
  }
1157
1181
  function classifyButtonTextRegex(buttonText) {
1158
- if (testButtonMatches(buttonText, REJECT_PATTERNS, NEVER_MATCH_PATTERNS)) {
1182
+ if (testButtonMatches(buttonText, REJECT_PATTERNS, BUTTON_NEVER_MATCH_PATTERNS)) {
1159
1183
  return "reject";
1160
1184
  }
1161
- if (testButtonMatches(buttonText, SETTINGS_PATTERNS, NEVER_MATCH_PATTERNS)) {
1185
+ if (testButtonMatches(buttonText, SETTINGS_PATTERNS, BUTTON_NEVER_MATCH_PATTERNS)) {
1162
1186
  return "settings";
1163
1187
  }
1164
- if (testButtonMatches(buttonText, ACCEPT_PATTERNS, NEVER_MATCH_PATTERNS)) {
1188
+ if (testButtonMatches(buttonText, ACCEPT_PATTERNS, BUTTON_NEVER_MATCH_PATTERNS)) {
1165
1189
  return "accept";
1166
1190
  }
1167
- if (testButtonMatches(buttonText, ACKNOWLEDGE_PATTERNS, NEVER_MATCH_PATTERNS)) {
1191
+ if (testButtonMatches(buttonText, ACKNOWLEDGE_PATTERNS, BUTTON_NEVER_MATCH_PATTERNS)) {
1168
1192
  return "acknowledge";
1169
1193
  }
1170
1194
  return "other";
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "manifest_version": 3,
3
3
  "name": "Autoconsent",
4
- "version": "2026.7.11",
4
+ "version": "2026.7.18",
5
5
  "background": {
6
6
  "scripts": [
7
7
  "background.bundle.js"