@duckduckgo/autoconsent 13.0.0 → 14.0.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.
@@ -0,0 +1,63 @@
1
+ name: Create a config PR with updated rules
2
+
3
+ on:
4
+ workflow_dispatch:
5
+ inputs:
6
+ tag_name:
7
+ description: 'The tag of the release to use'
8
+ required: true
9
+ workflow_call:
10
+ inputs:
11
+ tag_name:
12
+ type: string
13
+ description: 'The tag of the release to use'
14
+ required: true
15
+
16
+ env:
17
+ TAG: ${{ inputs.tag_name }}
18
+
19
+ jobs:
20
+ privacy-config-pr:
21
+ runs-on: ubuntu-latest
22
+ steps:
23
+ - uses: actions/checkout@v3
24
+ with:
25
+ path: autoconsent/
26
+ - uses: ./autoconsent/.github/actions/setup-release-scripts
27
+
28
+ - name: Checkout config
29
+ uses: actions/checkout@v3
30
+ with:
31
+ repository: duckduckgo/privacy-configuration
32
+ path: privacy-configuration/
33
+ token: ${{ secrets.DAX_WEB_AUTOFILL_AUTOMATION }}
34
+ - uses: actions/setup-node@v3
35
+ with:
36
+ node-version: current
37
+ - name: Build and compact rules
38
+ run: |
39
+ cd autoconsent
40
+ npm ci
41
+ npm run build-rules
42
+ npm run bundle-config-rules ../privacy-configuration
43
+ - name: Prepare and update privacy-config
44
+ run: |
45
+ cd privacy-configuration
46
+ npm ci
47
+ npm run lint-fix
48
+ npm install @duckduckgo/autoconsent@${{ env.TAG }}
49
+ - name: Create config PR
50
+ uses: peter-evans/create-pull-request@v7
51
+ id: create-pr
52
+ with:
53
+ path: privacy-configuration/
54
+ add-paths: |
55
+ package.json
56
+ package-lock.json
57
+ overrides/*
58
+ features/autoconsent.json
59
+ commit-message: Update autoconsent to ${{ env.TAG }}
60
+ branch: update-autoconsent
61
+ title: Update autoconsent to ${{ env.TAG }}
62
+ body: ''
63
+ token: ${{ secrets.DAX_WEB_AUTOFILL_AUTOMATION }}
@@ -39,3 +39,12 @@ jobs:
39
39
  - name: Remember git tag
40
40
  id: remember_tag
41
41
  run: echo "tag_name=$(git describe --exact-match --tags)" >> "$GITHUB_OUTPUT"
42
+
43
+ rule-release:
44
+ name: Propagate rules to privacy config
45
+ needs: release
46
+ if: ${{ !contains(github.event.head_commit.message, 'ci skip') && !contains(github.event.head_commit.message, 'skip ci') && needs.release.outputs.tag_name != '' }}
47
+ uses: ./.github/workflows/privacy-config-pr.yml
48
+ secrets: inherit
49
+ with:
50
+ tag_name: ${{ needs.release.outputs.tag_name }}
package/CHANGELOG.md CHANGED
@@ -1,4 +1,4 @@
1
- # v13.0.0 (Mon May 19 2025)
1
+ # v13.0.0 (Tue May 20 2025)
2
2
 
3
3
  #### 💥 Breaking Change
4
4
 
@@ -6,6 +6,7 @@
6
6
 
7
7
  #### 🐛 Bug Fix
8
8
 
9
+ - CI: Release hook to update privacy-config repo. [#748](https://github.com/duckduckgo/autoconsent/pull/748) ([@sammacbeth](https://github.com/sammacbeth))
9
10
  - Disable auto release to native apps [#747](https://github.com/duckduckgo/autoconsent/pull/747) ([@sammacbeth](https://github.com/sammacbeth))
10
11
 
11
12
  #### Authors: 1
@@ -1,3 +1,4 @@
1
+ "use strict";
1
2
  (() => {
2
3
  // lib/eval-snippets.ts
3
4
  var snippets = {
@@ -1,3 +1,4 @@
1
+ "use strict";
1
2
  (() => {
2
3
  // lib/consentomatic/tools.ts
3
4
  var Tools = class _Tools {
@@ -12532,14 +12533,14 @@ ${createStylesheet([filter.getSelector()], filter.hasCustomStyle() ? filter.getS
12532
12533
  delete clonedStep[shortKey];
12533
12534
  }
12534
12535
  }
12535
- if (clonedStep.if) {
12536
+ if (step.if) {
12536
12537
  clonedStep.if = decodeRuleStep(step.if);
12537
12538
  clonedStep.then = step.then && step.then.map(decodeRuleStep);
12538
12539
  if (step.else) {
12539
12540
  clonedStep.else = step.else.map(decodeRuleStep);
12540
12541
  }
12541
12542
  }
12542
- if (clonedStep.any) {
12543
+ if (step.any) {
12543
12544
  clonedStep.any = step.any.map(decodeRuleStep);
12544
12545
  }
12545
12546
  return { ...clonedStep };
@@ -1,3 +1,4 @@
1
+ "use strict";
1
2
  (() => {
2
3
  // lib/eval-snippets.ts
3
4
  var snippets = {
@@ -1,3 +1,4 @@
1
+ "use strict";
1
2
  (() => {
2
3
  // lib/consentomatic/tools.ts
3
4
  var Tools = class _Tools {
@@ -12532,14 +12533,14 @@ ${createStylesheet([filter.getSelector()], filter.hasCustomStyle() ? filter.getS
12532
12533
  delete clonedStep[shortKey];
12533
12534
  }
12534
12535
  }
12535
- if (clonedStep.if) {
12536
+ if (step.if) {
12536
12537
  clonedStep.if = decodeRuleStep(step.if);
12537
12538
  clonedStep.then = step.then && step.then.map(decodeRuleStep);
12538
12539
  if (step.else) {
12539
12540
  clonedStep.else = step.else.map(decodeRuleStep);
12540
12541
  }
12541
12542
  }
12542
- if (clonedStep.any) {
12543
+ if (step.any) {
12543
12544
  clonedStep.any = step.any.map(decodeRuleStep);
12544
12545
  }
12545
12546
  return { ...clonedStep };
@@ -1,3 +1,4 @@
1
+ "use strict";
1
2
  (() => {
2
3
  // addon/mv-compat.ts
3
4
  var manifestVersion = chrome.runtime.getManifest().manifest_version;
@@ -1,3 +1,4 @@
1
+ "use strict";
1
2
  (() => {
2
3
  // addon/mv-compat.ts
3
4
  var manifestVersion = chrome.runtime.getManifest().manifest_version;
@@ -1,3 +1,4 @@
1
+ "use strict";
1
2
  var __create = Object.create;
2
3
  var __defProp = Object.defineProperty;
3
4
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
@@ -3767,14 +3768,14 @@ function decodeRules(encoded) {
3767
3768
  delete clonedStep[shortKey];
3768
3769
  }
3769
3770
  }
3770
- if (clonedStep.if) {
3771
+ if (step.if) {
3771
3772
  clonedStep.if = decodeRuleStep(step.if);
3772
3773
  clonedStep.then = step.then && step.then.map(decodeRuleStep);
3773
3774
  if (step.else) {
3774
3775
  clonedStep.else = step.else.map(decodeRuleStep);
3775
3776
  }
3776
3777
  }
3777
- if (clonedStep.any) {
3778
+ if (step.any) {
3778
3779
  clonedStep.any = step.any.map(decodeRuleStep);
3779
3780
  }
3780
3781
  return { ...clonedStep };
@@ -3705,14 +3705,14 @@ function decodeRules(encoded) {
3705
3705
  delete clonedStep[shortKey];
3706
3706
  }
3707
3707
  }
3708
- if (clonedStep.if) {
3708
+ if (step.if) {
3709
3709
  clonedStep.if = decodeRuleStep(step.if);
3710
3710
  clonedStep.then = step.then && step.then.map(decodeRuleStep);
3711
3711
  if (step.else) {
3712
3712
  clonedStep.else = step.else.map(decodeRuleStep);
3713
3713
  }
3714
3714
  }
3715
- if (clonedStep.any) {
3715
+ if (step.any) {
3716
3716
  clonedStep.any = step.any.map(decodeRuleStep);
3717
3717
  }
3718
3718
  return { ...clonedStep };
@@ -1,3 +1,4 @@
1
+ "use strict";
1
2
  var __create = Object.create;
2
3
  var __defProp = Object.defineProperty;
3
4
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
@@ -12592,14 +12593,14 @@ function decodeRules(encoded) {
12592
12593
  delete clonedStep[shortKey];
12593
12594
  }
12594
12595
  }
12595
- if (clonedStep.if) {
12596
+ if (step.if) {
12596
12597
  clonedStep.if = decodeRuleStep(step.if);
12597
12598
  clonedStep.then = step.then && step.then.map(decodeRuleStep);
12598
12599
  if (step.else) {
12599
12600
  clonedStep.else = step.else.map(decodeRuleStep);
12600
12601
  }
12601
12602
  }
12602
- if (clonedStep.any) {
12603
+ if (step.any) {
12603
12604
  clonedStep.any = step.any.map(decodeRuleStep);
12604
12605
  }
12605
12606
  return { ...clonedStep };
@@ -12530,14 +12530,14 @@ function decodeRules(encoded) {
12530
12530
  delete clonedStep[shortKey];
12531
12531
  }
12532
12532
  }
12533
- if (clonedStep.if) {
12533
+ if (step.if) {
12534
12534
  clonedStep.if = decodeRuleStep(step.if);
12535
12535
  clonedStep.then = step.then && step.then.map(decodeRuleStep);
12536
12536
  if (step.else) {
12537
12537
  clonedStep.else = step.else.map(decodeRuleStep);
12538
12538
  }
12539
12539
  }
12540
- if (clonedStep.any) {
12540
+ if (step.any) {
12541
12541
  clonedStep.any = step.any.map(decodeRuleStep);
12542
12542
  }
12543
12543
  return { ...clonedStep };
@@ -1,3 +1,4 @@
1
+ "use strict";
1
2
  (() => {
2
3
  var __defProp = Object.defineProperty;
3
4
  var __export = (target, all) => {
@@ -12537,14 +12538,14 @@ ${createStylesheet([filter.getSelector()], filter.hasCustomStyle() ? filter.getS
12537
12538
  delete clonedStep[shortKey];
12538
12539
  }
12539
12540
  }
12540
- if (clonedStep.if) {
12541
+ if (step.if) {
12541
12542
  clonedStep.if = decodeRuleStep(step.if);
12542
12543
  clonedStep.then = step.then && step.then.map(decodeRuleStep);
12543
12544
  if (step.else) {
12544
12545
  clonedStep.else = step.else.map(decodeRuleStep);
12545
12546
  }
12546
12547
  }
12547
- if (clonedStep.any) {
12548
+ if (step.any) {
12548
12549
  clonedStep.any = step.any.map(decodeRuleStep);
12549
12550
  }
12550
12551
  return { ...clonedStep };
package/lib/encoding.ts CHANGED
@@ -97,14 +97,14 @@ export function encodeRules(rules: AutoConsentCMPRule[]): CompactCMPRuleset {
97
97
  delete clonedStep[longKey];
98
98
  }
99
99
  }
100
- if (clonedStep.if) {
100
+ if (step.if) {
101
101
  clonedStep.if = encodeRuleStep(step.if);
102
102
  clonedStep.then = step.then && step.then.map(encodeRuleStep);
103
103
  if (step.else) {
104
104
  clonedStep.else = step.else.map(encodeRuleStep);
105
105
  }
106
106
  }
107
- if (clonedStep.any) {
107
+ if (step.any) {
108
108
  clonedStep.any = step.any.map(encodeRuleStep);
109
109
  }
110
110
  return clonedStep;
@@ -145,14 +145,14 @@ export function decodeRules(encoded: CompactCMPRuleset): AutoConsentCMPRule[] {
145
145
  delete clonedStep[shortKey];
146
146
  }
147
147
  }
148
- if (clonedStep.if) {
148
+ if (step.if) {
149
149
  clonedStep.if = decodeRuleStep(step.if);
150
150
  clonedStep.then = step.then && step.then.map(decodeRuleStep);
151
151
  if (step.else) {
152
152
  clonedStep.else = step.else.map(decodeRuleStep);
153
153
  }
154
154
  }
155
- if (clonedStep.any) {
155
+ if (step.any) {
156
156
  clonedStep.any = step.any.map(decodeRuleStep);
157
157
  }
158
158
  return { ...clonedStep };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@duckduckgo/autoconsent",
3
- "version": "13.0.0",
3
+ "version": "14.0.0",
4
4
  "description": "",
5
5
  "exports": {
6
6
  ".": {
@@ -8,11 +8,24 @@ if (process.argv.length !== 3) {
8
8
  }
9
9
 
10
10
  const privacyConfigPath = process.argv[2];
11
- const autoconsentConfigPath = join(privacyConfigPath, 'features', 'autoconsent.json');
12
- const config = JSON.parse(fs.readFileSync(autoconsentConfigPath, 'utf-8'));
11
+
12
+ const bundleLocations = [
13
+ // join(privacyConfigPath, 'features', 'autoconsent.json'),
14
+ join(privacyConfigPath, 'overrides', 'macos-override.json'),
15
+ ];
16
+
13
17
  const compactRules = JSON.parse(fs.readFileSync(join(dirname(fileURLToPath(import.meta.url)), '../rules/compact-rules.json'), 'utf-8'));
14
18
 
15
- config.settings.compactRuleList = compactRules;
16
- // generate standard pretty-printed output
17
- const outputData = JSON.stringify(config, undefined, 4);
18
- fs.writeFileSync(autoconsentConfigPath, outputData);
19
+ for (const location of bundleLocations) {
20
+ const config = JSON.parse(fs.readFileSync(location, 'utf-8'));
21
+ if (location.endsWith('autoconsent.json')) {
22
+ // global config
23
+ config.settings.compactRuleList = compactRules;
24
+ } else {
25
+ // platform override
26
+ config.features.autoconsent.settings.compactRuleList = compactRules;
27
+ }
28
+ // generate standard pretty-printed output
29
+ const outputData = JSON.stringify(config, undefined, 4);
30
+ fs.writeFileSync(location, outputData);
31
+ }
package/tsconfig.json CHANGED
@@ -7,6 +7,7 @@
7
7
  "moduleResolution": "NodeNext",
8
8
  "noImplicitAny": true,
9
9
  "allowSyntheticDefaultImports": true,
10
+ "strict": true,
10
11
  "module": "NodeNext"
11
12
  },
12
13
  "exclude": ["node_modules/*", "dist/*"]