@duckduckgo/autoconsent 12.7.0 → 12.9.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/CHANGELOG.md +61 -0
- package/data/coverage.json +1348 -1305
- package/dist/addon-firefox/background.bundle.js +9 -1
- package/dist/addon-firefox/content.bundle.js +21 -3
- package/dist/addon-firefox/manifest.json +1 -1
- package/dist/addon-firefox/rules.json +390 -84
- package/dist/addon-mv3/background.bundle.js +9 -1
- package/dist/addon-mv3/content.bundle.js +21 -3
- package/dist/addon-mv3/manifest.json +1 -1
- package/dist/addon-mv3/popup.bundle.js +1 -1
- package/dist/addon-mv3/rules.json +390 -84
- package/dist/autoconsent.cjs.js +19 -1
- package/dist/autoconsent.esm.js +19 -1
- package/dist/autoconsent.extra.cjs.js +21 -3
- package/dist/autoconsent.extra.esm.js +21 -3
- package/dist/autoconsent.playwright.js +411 -87
- package/lib/cmps/sourcepoint-frame.ts +13 -0
- package/lib/eval-snippets.ts +14 -0
- package/lib/filterlist-engine.ts +2 -2
- package/lib/rules.ts +2 -1
- package/package.json +6 -3
- package/rules/autoconsent/civic-cookie-control.json +23 -12
- package/rules/autoconsent/cookie-law-info.json +4 -4
- package/rules/autoconsent/dsgvo.json +1 -1
- package/rules/autoconsent/fides.json +3 -3
- package/rules/autoconsent/gov-uk.json +19 -5
- package/rules/autoconsent/gravito.json +44 -0
- package/rules/autoconsent/johnlewis.json +1 -1
- package/rules/autoconsent/opera.com.json +7 -10
- package/rules/autoconsent/postnl.json +34 -0
- package/rules/autoconsent/privado.json +48 -0
- package/rules/autoconsent/quantcast.json +22 -4
- package/rules/autoconsent/shopify.json +31 -0
- package/rules/autoconsent/squiz.json +39 -0
- package/rules/autoconsent/tccCmpAlert.json +25 -0
- package/rules/autoconsent/tealium.json +1 -1
- package/rules/autoconsent/termly.json +2 -2
- package/rules/autoconsent/true-car.json +1 -1
- package/rules/autoconsent/twitter.json +1 -2
- package/rules/autoconsent/womenshealthmag-us.json +31 -0
- package/rules/filterlist.txt +96 -330
- package/rules/rules.json +390 -84
- package/scripts/get-text-for-xpath.ts +5 -2
- package/scripts/validate-json-rules.js +45 -0
- package/tests/civic-cookie-control.spec.ts +7 -3
- package/tests/cookielawinfo.spec.ts +3 -1
- package/tests/fides.spec.ts +1 -1
- package/tests/gravito.spec.ts +3 -0
- package/tests/postnl.spec.ts +3 -0
- package/tests/privado.spec.ts +3 -0
- package/tests/shopify.spec.ts +7 -0
- package/tests/squiz.spec.ts +3 -0
- package/tests/tccCmpAlert.spec.ts +3 -0
- package/tests/termly.spec.ts +11 -1
- package/tests/womenshealthmag-us.spec.ts +3 -0
- package/rules/autoconsent/wetransfer.json +0 -7
- package/tests/wetransfer.spec.ts +0 -5
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
const Ajv = require('ajv').default;
|
|
2
|
+
const fs = require('fs');
|
|
3
|
+
const path = require('path');
|
|
4
|
+
const schemaGenerator = require('ts-json-schema-generator');
|
|
5
|
+
|
|
6
|
+
function createGenerator() {
|
|
7
|
+
try {
|
|
8
|
+
return schemaGenerator.createGenerator({
|
|
9
|
+
path: path.join(__dirname, '../lib/rules.ts'),
|
|
10
|
+
type: 'AutoConsentCMPRule',
|
|
11
|
+
});
|
|
12
|
+
} catch (e) {
|
|
13
|
+
console.error(e.diagnostic);
|
|
14
|
+
throw e;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
function formatErrors(errors) {
|
|
19
|
+
if (!Array.isArray(errors)) {
|
|
20
|
+
return '';
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
return errors.map((item) => `${item.instancePath}: ${item.message}`).join(', ');
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
const ajv = new Ajv({ allowUnionTypes: true });
|
|
27
|
+
const schema = createGenerator().createSchema('AutoConsentCMPRule');
|
|
28
|
+
const validator = ajv.compile(schema);
|
|
29
|
+
|
|
30
|
+
const rulesDir = path.join(__dirname, '../rules/autoconsent');
|
|
31
|
+
const ruleFiles = fs.readdirSync(rulesDir).filter((f) => f.endsWith('.json'));
|
|
32
|
+
|
|
33
|
+
for (const ruleFile of ruleFiles) {
|
|
34
|
+
const rulePath = path.join(rulesDir, ruleFile);
|
|
35
|
+
const ruleJson = JSON.parse(fs.readFileSync(rulePath, 'utf8'));
|
|
36
|
+
|
|
37
|
+
const valid = validator(ruleJson);
|
|
38
|
+
if (!valid) {
|
|
39
|
+
console.error(`Validation failed for ${ruleFile}:`);
|
|
40
|
+
console.error(formatErrors(validator.errors));
|
|
41
|
+
process.exit(1);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
console.log('All rules look good!');
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import generateCMPTests from '../playwright/runner';
|
|
2
2
|
|
|
3
|
-
generateCMPTests(
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
generateCMPTests(
|
|
4
|
+
'civic-cookie-control',
|
|
5
|
+
['https://www.birmingham.gov.uk/', 'https://planning.org.uk/', 'https://www.jessops.com/', 'https://www.bcs.org/'],
|
|
6
|
+
{
|
|
7
|
+
skipRegions: ['US', 'DE'],
|
|
8
|
+
},
|
|
9
|
+
);
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import generateCMPTests from '../playwright/runner';
|
|
2
2
|
|
|
3
|
-
generateCMPTests('cookie-law-info', ['https://www.
|
|
3
|
+
generateCMPTests('cookie-law-info', ['https://www.omas-gegen-rechts.org/', 'https://www.fitundattraktiv.de/'], {
|
|
4
4
|
skipRegions: ['US', 'GB'],
|
|
5
5
|
});
|
|
6
|
+
|
|
7
|
+
generateCMPTests('cookie-law-info', ['https://www.sbid.org/']);
|
package/tests/fides.spec.ts
CHANGED
package/tests/termly.spec.ts
CHANGED
|
@@ -1,6 +1,16 @@
|
|
|
1
1
|
import generateCMPTests from '../playwright/runner';
|
|
2
2
|
|
|
3
|
-
generateCMPTests(
|
|
3
|
+
generateCMPTests(
|
|
4
|
+
'Termly',
|
|
5
|
+
[
|
|
6
|
+
'https://itsalovelylife.com/',
|
|
7
|
+
'https://www.iccsafe.org/',
|
|
8
|
+
'https://cooper.edu/',
|
|
9
|
+
'https://www.chateauelan.com/',
|
|
10
|
+
'https://www.bentley.edu/',
|
|
11
|
+
],
|
|
12
|
+
{},
|
|
13
|
+
);
|
|
4
14
|
|
|
5
15
|
generateCMPTests('Termly', ['https://visualsbyimpulse.com/'], {
|
|
6
16
|
skipRegions: ['DE'],
|