@duckduckgo/autoconsent 16.49.0 → 16.51.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/release-labels.yml +2 -6
- package/AGENTS.md +1 -1
- package/CHANGELOG.md +130 -0
- package/build.sh +2 -0
- package/data/labelled-button-texts.csv +36 -36
- package/dist/addon-firefox/background.bundle.js +4 -1
- package/dist/addon-firefox/compact-rules.json +1 -1
- package/dist/addon-firefox/content.bundle.js +67 -46
- 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 +4 -1
- package/dist/addon-mv3/compact-rules.json +1 -1
- package/dist/addon-mv3/content.bundle.js +67 -46
- 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 +67 -46
- package/dist/autoconsent.esm.js +67 -46
- package/dist/autoconsent.playwright.js +68 -46
- package/dist/autoconsent.standalone.js +68 -47
- package/dist/heuristics.cjs.js +886 -0
- package/dist/heuristics.mjs +847 -0
- package/dist/types/eval-snippets.d.ts +2 -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/lib/eval-snippets.ts +4 -0
- package/lib/heuristic-classify.ts +136 -0
- package/lib/heuristic-patterns.ts +33 -16
- 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/amazon-hiring.json +16 -0
- package/rules/autoconsent/avada-cookie-consent.json +43 -0
- package/rules/autoconsent/avvio.json +22 -0
- package/rules/autoconsent/axeptio.json +22 -6
- package/rules/autoconsent/bdirect-booking-engine.json +33 -0
- package/rules/autoconsent/berelax.com.json +33 -0
- package/rules/autoconsent/bigcrunch.json +39 -0
- package/rules/autoconsent/bigid.json +59 -0
- package/rules/autoconsent/bluepark.json +31 -0
- package/rules/autoconsent/bricklink.json +33 -0
- package/rules/autoconsent/burpee-com.json +5 -1
- package/rules/autoconsent/bynder.json +33 -0
- package/rules/autoconsent/ceneo.json +9 -0
- package/rules/autoconsent/cinemaplus.json +9 -0
- package/rules/autoconsent/columbia-privacy-notice.json +32 -0
- package/rules/autoconsent/complianz-notice.json +1 -1
- package/rules/autoconsent/conjointly.json +43 -0
- 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/dhbbank.json +13 -0
- package/rules/autoconsent/duda-cookie-notification.json +41 -0
- package/rules/autoconsent/ee-consent-notice.json +40 -0
- package/rules/autoconsent/endocrine.org.json +35 -0
- package/rules/autoconsent/ezoic.json +2 -2
- package/rules/autoconsent/fera-cookies.json +67 -0
- 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/la7-cmp.json +30 -0
- package/rules/autoconsent/laravel-cookie-consent.json +45 -0
- package/rules/autoconsent/legislation-gov-uk.json +43 -0
- package/rules/autoconsent/lucrin.json +18 -0
- package/rules/autoconsent/mackeeper.json +34 -0
- package/rules/autoconsent/makitatools.json +41 -0
- package/rules/autoconsent/milestone-internet.json +32 -0
- package/rules/autoconsent/ndl-go-jp.json +35 -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/paypal-us.json +3 -3
- package/rules/autoconsent/paypal.json +5 -2
- package/rules/autoconsent/paytronix.json +30 -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/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/tempest-cookie-notice.json +9 -0
- package/rules/autoconsent/termsfeed.json +4 -4
- package/rules/autoconsent/texas-instruments.json +17 -0
- package/rules/autoconsent/thegrandyork.json +46 -0
- package/rules/autoconsent/thenounproject.json +61 -0
- 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/toyota.json +16 -5
- package/rules/autoconsent/tplink.json +57 -9
- package/rules/autoconsent/trust360.json +29 -0
- package/rules/autoconsent/uft-cookie-notice.json +15 -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/wbd-legal-terms.json +32 -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/amazon-hiring.spec.ts +3 -0
- package/tests/avada-cookie-consent.spec.ts +9 -0
- package/tests/avvio.spec.ts +8 -0
- package/tests/axeptio.spec.ts +11 -4
- package/tests/bdirect-booking-engine.spec.ts +9 -0
- package/tests/berelax.com.spec.ts +5 -0
- package/tests/bigcrunch.spec.ts +16 -0
- package/tests/bigid.spec.ts +8 -0
- package/tests/bluepark.spec.ts +8 -0
- package/tests/bricklink.spec.ts +3 -0
- package/tests/burpee-com.spec.ts +2 -0
- package/tests/bynder.spec.ts +3 -0
- package/tests/ceneo.spec.ts +3 -0
- package/tests/cinemaplus.spec.ts +8 -0
- package/tests/columbia-privacy-notice.spec.ts +8 -0
- package/tests/complianz-notice.spec.ts +7 -3
- package/tests/conjointly.spec.ts +3 -0
- 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/dhbbank.spec.ts +6 -0
- package/tests/duda-cookie-notification.spec.ts +8 -0
- package/tests/ee-consent-notice.spec.ts +9 -0
- package/tests/endocrine.org.spec.ts +3 -0
- package/tests/ezoic.spec.ts +1 -1
- package/tests/fera-cookies.spec.ts +6 -0
- 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/la7-cmp.spec.ts +6 -0
- package/tests/laravel-cookie-consent.spec.ts +10 -0
- package/tests/legislation-gov-uk.spec.ts +3 -0
- package/tests/lucrin.spec.ts +3 -0
- package/tests/mackeeper.spec.ts +3 -0
- package/tests/makitatools.spec.ts +5 -0
- package/tests/milestone-internet.spec.ts +8 -0
- package/tests/ndl-go-jp.spec.ts +8 -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/paypal-us.spec.ts +2 -3
- package/tests/paytronix.spec.ts +7 -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/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/tempest-cookie-notice.spec.ts +7 -0
- package/tests/termsfeed.spec.ts +4 -0
- package/tests/texas-instruments.spec.ts +3 -0
- package/tests/thegrandyork.spec.ts +3 -0
- package/tests/thenounproject.spec.ts +3 -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/uft-cookie-notice.spec.ts +3 -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/wbd-legal-terms.spec.ts +18 -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/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 +57 -6
- package/tsconfig.build.json +1 -1
- package/tsconfig.heuristics.json +10 -0
- package/rules/autoconsent/paypal-cookieprefs.json +0 -29
- package/tests/paypal-cookieprefs.spec.ts +0 -7
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import generateCMPTests from '../playwright/runner';
|
|
2
|
+
|
|
3
|
+
generateCMPTests('shopware', [
|
|
4
|
+
'https://www.platinlux.com/en/s8-55056/floating-globe-smokey-e27-led-bulb-by-segula',
|
|
5
|
+
'https://stoffkontor.eu/',
|
|
6
|
+
'https://www.mdf-verpackungen.de/',
|
|
7
|
+
'https://www.noblewine.de/',
|
|
8
|
+
]);
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import generateCMPTests from '../playwright/runner';
|
|
2
|
+
|
|
3
|
+
generateCMPTests('simpleview-cookie-banner', [
|
|
4
|
+
'https://www.poconomountains.com/listing/the-frogtown-chophouse/4896/',
|
|
5
|
+
'https://www.visitmadison.com/',
|
|
6
|
+
'https://www.gotocatalina.com/',
|
|
7
|
+
'https://www.experiencescottsdale.com/',
|
|
8
|
+
'https://www.visittampabay.com/',
|
|
9
|
+
'https://www.visitraleigh.com/',
|
|
10
|
+
]);
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import generateCMPTests from '../playwright/runner';
|
|
2
|
+
|
|
3
|
+
// the notice is shown in all regions, but non-US visitors get a bot challenge first
|
|
4
|
+
generateCMPTests(
|
|
5
|
+
'solvhealth.com',
|
|
6
|
+
['https://www.solvhealth.com/pa/c/east-stroudsburg-pa-srv-dot-physicals', 'https://www.solvhealth.com/urgent-care/ny/new-york'],
|
|
7
|
+
{
|
|
8
|
+
onlyRegions: ['US'],
|
|
9
|
+
},
|
|
10
|
+
);
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import generateCMPTests from '../playwright/runner';
|
|
2
|
+
|
|
3
|
+
generateCMPTests('squarespace-cookie-notice', [
|
|
4
|
+
'https://www.carraghersnyc.com/',
|
|
5
|
+
'https://www.chelseamarket.com/',
|
|
6
|
+
'https://www.tested.com/',
|
|
7
|
+
'https://www.pronuncian.com/',
|
|
8
|
+
'https://www.americanalpineclub.org/',
|
|
9
|
+
]);
|
package/tests/termsfeed.spec.ts
CHANGED
|
@@ -4,4 +4,8 @@ generateCMPTests('termsfeed', [
|
|
|
4
4
|
'https://ftbwiki.org/Feed_The_Beast_Wiki',
|
|
5
5
|
'https://inspirationaladventures.com/',
|
|
6
6
|
'http://www.campingplatz-suche.com/',
|
|
7
|
+
// freeprivacypolicy.com variant
|
|
8
|
+
'https://grovemade.com/',
|
|
9
|
+
'https://loot.farm/',
|
|
10
|
+
'https://tcdecks.net/',
|
|
7
11
|
]);
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import generateCMPTests from '../playwright/runner';
|
|
2
|
+
|
|
3
|
+
// saving preferences reloads the page when analytics was on by default (US), which interrupts the self-test
|
|
4
|
+
generateCMPTests('therealest', ['https://mls.therealest.com/', 'https://therealest.com/'], {
|
|
5
|
+
testSelfTest: false,
|
|
6
|
+
});
|
package/tests/tplink.spec.ts
CHANGED
|
@@ -1,3 +1,13 @@
|
|
|
1
1
|
import generateCMPTests from '../playwright/runner';
|
|
2
2
|
|
|
3
|
-
generateCMPTests('tplink', [
|
|
3
|
+
generateCMPTests('tplink', [
|
|
4
|
+
'https://www.tp-link.com/nl/',
|
|
5
|
+
'https://www.tp-link.com/us/',
|
|
6
|
+
'https://www.tp-link.com/us/home-networking/wifi-router/tl-wr3602be/',
|
|
7
|
+
'https://www.omadanetworks.com/us/',
|
|
8
|
+
]);
|
|
9
|
+
|
|
10
|
+
// opting out reloads the page, which interrupts the self-test
|
|
11
|
+
generateCMPTests('tplink', ['https://www.kasasmart.com/us'], {
|
|
12
|
+
testSelfTest: false,
|
|
13
|
+
});
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import generateCMPTests from '../playwright/runner';
|
|
2
|
+
|
|
3
|
+
generateCMPTests('up-cookie-consent', [
|
|
4
|
+
'https://marrableshotel.com/',
|
|
5
|
+
'https://crimsonhotels.com/',
|
|
6
|
+
'https://www.thegrove.co.uk/',
|
|
7
|
+
'https://www.thegilpin.co.uk/',
|
|
8
|
+
'https://www.thehari.com/',
|
|
9
|
+
]);
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import generateCMPTests from '../playwright/runner';
|
|
2
|
+
|
|
3
|
+
generateCMPTests('uw-madison-cookieconsent', [
|
|
4
|
+
'https://lafollette.wisc.edu/news/new-research-reveals-longevity-gains-slowing-life-expectancy-of-100-unlikely/',
|
|
5
|
+
'https://www.wisc.edu/',
|
|
6
|
+
'https://geography.wisc.edu/',
|
|
7
|
+
]);
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import generateCMPTests from '../playwright/runner';
|
|
2
|
+
|
|
3
|
+
generateCMPTests(
|
|
4
|
+
'wbd-legal-terms',
|
|
5
|
+
[
|
|
6
|
+
'https://www.foodnetwork.com/how-to/packages/shopping/product-reviews/best-food-processors',
|
|
7
|
+
'https://www.hgtv.com/',
|
|
8
|
+
'https://www.golfdigest.com/',
|
|
9
|
+
'https://www.tlc.com/',
|
|
10
|
+
'https://www.discovery.com/',
|
|
11
|
+
],
|
|
12
|
+
{
|
|
13
|
+
// shown only in some US states
|
|
14
|
+
onlyRegions: ['US'],
|
|
15
|
+
testOptIn: false,
|
|
16
|
+
testSelfTest: false,
|
|
17
|
+
},
|
|
18
|
+
);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { expect } from '@esm-bundle/chai';
|
|
2
|
-
import { classifyButtonTextRegex } from '../../lib/
|
|
2
|
+
import { classifyButtonTextRegex } from '../../lib/heuristic-classify';
|
|
3
3
|
import {
|
|
4
4
|
BENCHMARK_LABELS,
|
|
5
5
|
buildLabelBenchmarks,
|
|
@@ -23,14 +23,18 @@ describe('classifyButtonTextRegex against labelled button texts', () => {
|
|
|
23
23
|
benchmarks = buildLabelBenchmarks(classifyRows(rows, classifyButtonTextRegex));
|
|
24
24
|
});
|
|
25
25
|
|
|
26
|
-
|
|
26
|
+
const benchmarkFor = (label: string) => benchmarks.find((b) => b.label === label)!;
|
|
27
|
+
|
|
28
|
+
BENCHMARK_LABELS.forEach((label) => {
|
|
29
|
+
// includes rows labelled 'other', e.g. withdraw-consent or policy links that must not be clicked
|
|
27
30
|
it(`never predicts "${label}" for a button labelled differently`, () => {
|
|
28
|
-
const
|
|
29
|
-
|
|
31
|
+
const { falsePositiveExamples } = benchmarkFor(label);
|
|
32
|
+
const examples = falsePositiveExamples.slice(0, 10).map(formatExample).join('\n ');
|
|
33
|
+
expect(falsePositiveExamples.length).to.equal(0, `false positives for "${label}":\n ${examples}\n`);
|
|
30
34
|
});
|
|
31
35
|
|
|
32
36
|
it(`classifies >${MIN_WEIGHTED_ACCURACY * 100}% of weighted "${label}" buttons correctly`, () => {
|
|
33
|
-
const { weightedCorrect, weightedSupport } =
|
|
37
|
+
const { weightedCorrect, weightedSupport } = benchmarkFor(label);
|
|
34
38
|
expect(weightedSupport).to.be.greaterThan(0, `expected labelled rows for "${label}"`);
|
|
35
39
|
expect(weightedCorrect / weightedSupport).to.be.greaterThan(
|
|
36
40
|
MIN_WEIGHTED_ACCURACY,
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { expect } from '@esm-bundle/chai';
|
|
2
|
+
import { getPotentialPopups } from '../../lib/heuristics';
|
|
3
|
+
|
|
4
|
+
describe('getPotentialPopups', () => {
|
|
5
|
+
let container: HTMLDivElement;
|
|
6
|
+
|
|
7
|
+
beforeEach(() => {
|
|
8
|
+
container = document.createElement('div');
|
|
9
|
+
document.body.appendChild(container);
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
afterEach(() => {
|
|
13
|
+
container.remove();
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
it('returns positioned popups with their buttons', () => {
|
|
17
|
+
container.innerHTML = `
|
|
18
|
+
<div id="popup" style="position: fixed; bottom: 0;">
|
|
19
|
+
<p>We use cookies.</p>
|
|
20
|
+
<button>Reject all</button>
|
|
21
|
+
<button>Accept all</button>
|
|
22
|
+
</div>
|
|
23
|
+
`;
|
|
24
|
+
const popup = getPotentialPopups(1000).find((p) => p.element.id === 'popup');
|
|
25
|
+
expect(popup).to.exist;
|
|
26
|
+
expect(popup!.buttons.map((b) => b.text).sort()).to.deep.equal(['Accept all', 'Reject all']);
|
|
27
|
+
});
|
|
28
|
+
});
|
|
@@ -4,13 +4,9 @@ import {
|
|
|
4
4
|
cleanButtonText,
|
|
5
5
|
classifyButtonTextRegex,
|
|
6
6
|
classifyButtons,
|
|
7
|
-
getActionablePopups,
|
|
8
|
-
isDisabled,
|
|
9
|
-
excludeContainers,
|
|
10
|
-
getButtonData,
|
|
11
|
-
isDialogLikeElement,
|
|
12
7
|
isExcludedPopup,
|
|
13
|
-
} from '../../lib/
|
|
8
|
+
} from '../../lib/heuristic-classify';
|
|
9
|
+
import { getActionablePopups, isDisabled, excludeContainers, getButtonData, isDialogLikeElement } from '../../lib/heuristics';
|
|
14
10
|
import { ButtonData } from '../../lib/types';
|
|
15
11
|
|
|
16
12
|
function rejectButtons(buttons: ButtonData[]) {
|
|
@@ -78,6 +74,27 @@ describe('checkHeuristicPatterns', () => {
|
|
|
78
74
|
});
|
|
79
75
|
});
|
|
80
76
|
|
|
77
|
+
describe('checkHeuristicPatterns with a qualifier before "cookies"', () => {
|
|
78
|
+
it('detects "we use <qualifier> cookies" notices', () => {
|
|
79
|
+
const texts = [
|
|
80
|
+
// openrouter.ai
|
|
81
|
+
'Cookie Preferences We use essential cookies for site functionality and optional cookies for analytics.',
|
|
82
|
+
'We use optional cookies to measure traffic',
|
|
83
|
+
'We use analytics cookies and similar technologies',
|
|
84
|
+
'We serve necessary cookies only',
|
|
85
|
+
];
|
|
86
|
+
for (const text of texts) {
|
|
87
|
+
expect(checkHeuristicPatterns(text).patterns.length, text).to.be.greaterThan(0);
|
|
88
|
+
}
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
it('does not match when "cookies" is further away', () => {
|
|
92
|
+
expect(checkHeuristicPatterns('We use the best chocolate in our cookies', [/we use(?: \w+)? cookies/gi]).patterns).to.have.length(
|
|
93
|
+
0,
|
|
94
|
+
);
|
|
95
|
+
});
|
|
96
|
+
});
|
|
97
|
+
|
|
81
98
|
describe('checkHeuristicPatterns with Russian popups', () => {
|
|
82
99
|
it('detects Russian cookie notices', () => {
|
|
83
100
|
const texts = [
|
|
@@ -103,6 +120,23 @@ describe('checkHeuristicPatterns with Russian popups', () => {
|
|
|
103
120
|
});
|
|
104
121
|
});
|
|
105
122
|
|
|
123
|
+
describe('checkHeuristicPatterns with Japanese popups', () => {
|
|
124
|
+
it('detects Japanese cookie notices', () => {
|
|
125
|
+
const texts = [
|
|
126
|
+
'当サイトはサービス改善のためCookieを使用しています。',
|
|
127
|
+
'当ウェブサイトではクッキーを利用しています',
|
|
128
|
+
'このサイトはクッキー(Cookie)を使用しています',
|
|
129
|
+
];
|
|
130
|
+
for (const text of texts) {
|
|
131
|
+
expect(checkHeuristicPatterns(text).patterns.length, text).to.be.greaterThan(0);
|
|
132
|
+
}
|
|
133
|
+
});
|
|
134
|
+
|
|
135
|
+
it('does not detect unrelated Japanese text', () => {
|
|
136
|
+
expect(checkHeuristicPatterns('全国の旧車イベント情報を集約しています').patterns).to.have.length(0);
|
|
137
|
+
});
|
|
138
|
+
});
|
|
139
|
+
|
|
106
140
|
describe('isExcludedPopup', () => {
|
|
107
141
|
it('flags doublelist-style age verification popups', () => {
|
|
108
142
|
// Real-world text from the doublelist.com age gate (listings page)
|
|
@@ -188,6 +222,12 @@ describe('classifyButtonTextRegex', () => {
|
|
|
188
222
|
expect(classifyButtonTextRegex('I do not accept the use of cookies')).to.equal('reject');
|
|
189
223
|
});
|
|
190
224
|
|
|
225
|
+
it('matches CCPA "do not sell/share" variants', () => {
|
|
226
|
+
expect(classifyButtonTextRegex('Do Not Sell or Share My Personal Information')).to.equal('reject');
|
|
227
|
+
expect(classifyButtonTextRegex('Do Not Share My Personal Information')).to.equal('reject');
|
|
228
|
+
expect(classifyButtonTextRegex('Do not share my data')).to.equal('reject');
|
|
229
|
+
});
|
|
230
|
+
|
|
191
231
|
it('matches German continue-without-accepting variants', () => {
|
|
192
232
|
expect(classifyButtonTextRegex('Ohne Akzeptieren fortfahren')).to.equal('reject');
|
|
193
233
|
expect(classifyButtonTextRegex('Ohne zu akzeptieren fortfahren')).to.equal('reject');
|
|
@@ -229,6 +269,17 @@ describe('classifyButtonTextRegex', () => {
|
|
|
229
269
|
expect(classifyButtonTextRegex('Не принимаю')).to.equal('reject');
|
|
230
270
|
});
|
|
231
271
|
|
|
272
|
+
it('matches Japanese reject buttons', () => {
|
|
273
|
+
expect(classifyButtonTextRegex('拒否')).to.equal('reject');
|
|
274
|
+
expect(classifyButtonTextRegex('すべて拒否')).to.equal('reject');
|
|
275
|
+
expect(classifyButtonTextRegex('全て拒否する')).to.equal('reject');
|
|
276
|
+
expect(classifyButtonTextRegex('Cookieを拒否')).to.equal('reject');
|
|
277
|
+
expect(classifyButtonTextRegex('同意しない')).to.equal('reject');
|
|
278
|
+
expect(classifyButtonTextRegex('すべて 拒否')).to.equal('reject');
|
|
279
|
+
expect(classifyButtonTextRegex('同意しません')).to.equal('reject');
|
|
280
|
+
expect(classifyButtonTextRegex('同意して続ける')).not.to.equal('reject');
|
|
281
|
+
});
|
|
282
|
+
|
|
232
283
|
it('matches Russian settings buttons', () => {
|
|
233
284
|
expect(classifyButtonTextRegex('Настроить')).to.equal('settings');
|
|
234
285
|
expect(classifyButtonTextRegex('Настройки')).to.equal('settings');
|
package/tsconfig.build.json
CHANGED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "paypal-cookieprefs",
|
|
3
|
-
"comment": "Cookie preferences page (.privacy-sheet-content on desktop, #cookiePrefsModal on mobile). Only automate it when we got here from the banner's \"Manage your cookies\" link, which appends a query string; a user who opens the page themselves lands on it without one and must be left free to edit their own preferences.",
|
|
4
|
-
"runContext": { "urlPattern": "^https://www\\.paypal\\.com/myaccount/privacy/cookiePrefs\\?" },
|
|
5
|
-
"prehideSelectors": ["#cookiePrefsModal, .privacy-sheet-content"],
|
|
6
|
-
"detectCmp": [{ "exists": "#cookiePrefsModal #formContent, .privacy-sheet-content #formContent" }],
|
|
7
|
-
"detectPopup": [{ "visible": "#cookiePrefsModal #formContent, .privacy-sheet-content #formContent" }],
|
|
8
|
-
"optIn": [
|
|
9
|
-
{
|
|
10
|
-
"click": "#formContent input[type='checkbox']:not(:checked)",
|
|
11
|
-
"all": true,
|
|
12
|
-
"optional": true
|
|
13
|
-
},
|
|
14
|
-
{ "waitForThenClick": ".cookieAction #submitCookiesBtn", "timeout": 15000 }
|
|
15
|
-
],
|
|
16
|
-
"optOut": [
|
|
17
|
-
{
|
|
18
|
-
"click": "#formContent input[type='checkbox']:checked",
|
|
19
|
-
"all": true,
|
|
20
|
-
"optional": true
|
|
21
|
-
},
|
|
22
|
-
{
|
|
23
|
-
"comment": "In \"manage\" mode the submit button is present but its sticky bar stays hidden, so wait for existence rather than visibility.",
|
|
24
|
-
"waitForThenClick": ".cookieAction #submitCookiesBtn",
|
|
25
|
-
"timeout": 15000
|
|
26
|
-
}
|
|
27
|
-
],
|
|
28
|
-
"test": [{ "wait": 1000 }, { "cookieContains": "type%3Dexplicit" }]
|
|
29
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import generateCMPTests from '../playwright/runner';
|
|
2
|
-
|
|
3
|
-
// Only the banner's "Manage your cookies" link (which appends a locale query string) should be
|
|
4
|
-
// automated. Opening the same page without a query string is a deliberate user visit and is left
|
|
5
|
-
// untouched, so it is not covered here.
|
|
6
|
-
generateCMPTests('paypal-cookieprefs', ['https://www.paypal.com/myaccount/privacy/cookiePrefs?locale=en_US'], {});
|
|
7
|
-
generateCMPTests('paypal-cookieprefs', ['https://www.paypal.com/myaccount/privacy/cookiePrefs?locale=en_US'], { mobile: true });
|