@eeacms/volto-cca-policy 1.0.0 → 1.0.2

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,133 @@
1
+ name: Betterleaks
2
+
3
+ on:
4
+ push:
5
+ pull_request:
6
+
7
+ permissions:
8
+ contents: read
9
+
10
+ jobs:
11
+ scan:
12
+ name: Scan for secrets
13
+ runs-on: ubuntu-latest
14
+ env:
15
+ SMTP_URL: ${{ secrets.SMTP_URL }}
16
+ SMTP_PORT: ${{ secrets.SMTP_PORT || '25' }}
17
+ SMTP_EMAIL: ${{ secrets.SMTP_EMAIL }}
18
+ SMTP_PASSWORD: ${{ secrets.SMTP_PASSWORD }}
19
+ steps:
20
+ - name: Checkout repository
21
+ uses: actions/checkout@v4
22
+ with:
23
+ fetch-depth: 1
24
+ ref: ${{ github.event.pull_request.head.sha || github.sha }}
25
+
26
+ - name: Run Betterleaks
27
+ id: betterleaks
28
+ continue-on-error: true
29
+ uses: dortort/betterleaks-action@v0.1.0
30
+ with:
31
+ github-token: ${{ secrets.GITHUB_TOKEN }}
32
+ scan-mode: dir
33
+ scan-path: .
34
+ config: .gitleaks.toml
35
+ report-format: json
36
+ report-path: betterleaks-report.json
37
+ redact: "true"
38
+ no-color: "true"
39
+ no-banner: "true"
40
+ fail-on-leak: "true"
41
+
42
+ - name: Upload Betterleaks report
43
+ if: always()
44
+ uses: actions/upload-artifact@v4
45
+ with:
46
+ name: betterleaks-report
47
+ path: betterleaks-report.json
48
+ if-no-files-found: ignore
49
+
50
+ - name: Build Betterleaks email summary
51
+ id: leak_summary
52
+ if: steps.betterleaks.outcome == 'failure'
53
+ shell: bash
54
+ run: |
55
+ if [[ -s betterleaks-report.json ]]; then
56
+ jq -r '
57
+ def one_line:
58
+ tostring
59
+ | gsub("[\r\n]+"; " ")
60
+ | if length > 240 then .[0:240] + "..." else . end;
61
+
62
+ .[:20][]
63
+ | "- " + (.RuleID // "unknown-rule")
64
+ + " at " + (.File // "unknown-file")
65
+ + ":" + ((.StartLine // 0) | tostring)
66
+ + "\n match: " + ((.Match // .Secret // "REDACTED") | one_line)
67
+ ' betterleaks-report.json > betterleaks-email-summary.txt
68
+
69
+ count="$(jq 'length' betterleaks-report.json)"
70
+ if (( count > 20 )); then
71
+ {
72
+ echo ""
73
+ echo "... and $((count - 20)) more finding(s). Download the artifact for full details."
74
+ } >> betterleaks-email-summary.txt
75
+ fi
76
+ else
77
+ echo "No JSON report was generated. Download the workflow logs for details." > betterleaks-email-summary.txt
78
+ fi
79
+
80
+ {
81
+ echo "text<<BETTERLEAKS_SUMMARY"
82
+ cat betterleaks-email-summary.txt
83
+ echo "BETTERLEAKS_SUMMARY"
84
+ } >> "$GITHUB_OUTPUT"
85
+
86
+ - name: Resolve committer email
87
+ id: committer
88
+ if: steps.betterleaks.outcome == 'failure'
89
+ shell: bash
90
+ run: |
91
+ committer_email="$(git log -1 --format='%ce')"
92
+ author_email="$(git log -1 --format='%ae')"
93
+ email="$committer_email"
94
+ if [[ -z "$email" || "$email" == *"noreply.github.com"* ]]; then
95
+ email="$author_email"
96
+ fi
97
+ if [[ "$email" =~ ^[^[:space:]@]+@[^[:space:]@]+\.[^[:space:]@]+$ && "$email" != *"noreply.github.com"* ]]; then
98
+ echo "email=$email" >> "$GITHUB_OUTPUT"
99
+ else
100
+ echo "No deliverable committer email found; skipping Betterleaks email notification."
101
+ echo "email=" >> "$GITHUB_OUTPUT"
102
+ fi
103
+
104
+ - name: Email committer on Betterleaks failure
105
+ if: steps.betterleaks.outcome == 'failure' && steps.committer.outputs.email != '' && env.SMTP_URL != '' && env.SMTP_EMAIL != ''
106
+ uses: dawidd6/action-send-mail@v18
107
+ with:
108
+ server_address: ${{ env.SMTP_URL }}
109
+ server_port: ${{ env.SMTP_PORT }}
110
+ secure: ${{ env.SMTP_PORT == '465' }}
111
+ username: ${{ env.SMTP_EMAIL }}
112
+ password: ${{ env.SMTP_PASSWORD }}
113
+ from: ${{ env.SMTP_EMAIL }}
114
+ to: ${{ steps.committer.outputs.email }}
115
+ subject: "[Betterleaks] Secret scan failed in ${{ github.repository }}"
116
+ body: |
117
+ Betterleaks detected one or more potential secrets.
118
+
119
+ Repository: ${{ github.repository }}
120
+ Branch: ${{ github.ref_name }}
121
+ Commit: ${{ github.sha }}
122
+ Workflow run: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
123
+
124
+ Findings:
125
+ ${{ steps.leak_summary.outputs.text }}
126
+
127
+ Download the betterleaks-report artifact from the workflow run for details.
128
+
129
+ - name: Fail if Betterleaks found leaks
130
+ if: steps.betterleaks.outcome == 'failure'
131
+ run: |
132
+ echo "Betterleaks detected one or more secrets. Download the betterleaks-report artifact from this workflow run for details."
133
+ exit 1
package/.gitleaks.toml ADDED
@@ -0,0 +1,89 @@
1
+ title = "Betterleaks config"
2
+
3
+ [extend]
4
+ useDefault = true
5
+
6
+ [[rules]]
7
+ id = "secret-literal-assignment"
8
+ description = "Secret-like literal assignment in source, YAML, env and config files"
9
+ regex = '''(?i)([A-Za-z0-9_.-]*(?:password|passwd|pwd|api[_-]?key|apikey|access[_-]?key|secret[_-]?access[_-]?key|private[_-]?key|client[_-]?secret|consumer[_-]?key|consumer[_-]?secret|(?:auth|access|refresh|session|api|bearer|id|jwt|csrf|xsrf|oauth)[_-]?token|translate[_-]?auth|translation[_-]?auth|auth[_-]?password|auth[_-]?key|auth[_-]?credentials|database[_-]?url|connection[_-]?string)[A-Za-z0-9_.-]*)[ \t]*[:=][ \t]*["'']?([^"''[:space:]#{}$.][^"''\n#{}]{2,})["'']?'''
10
+ secretGroup = 2
11
+ keywords = [
12
+ "password",
13
+ "passwd",
14
+ "pwd",
15
+ "api_key",
16
+ "apikey",
17
+ "access_key",
18
+ "private_key",
19
+ "client_secret",
20
+ "consumer_key",
21
+ "consumer_secret",
22
+ "auth_token",
23
+ "access_token",
24
+ "refresh_token",
25
+ "session_token",
26
+ "api_token",
27
+ "bearer_token",
28
+ "id_token",
29
+ "jwt_token",
30
+ "csrf_token",
31
+ "xsrf_token",
32
+ "oauth_token",
33
+ "translate_auth",
34
+ "translation_auth",
35
+ "auth_password",
36
+ "auth_key",
37
+ "auth_credentials",
38
+ "database_url",
39
+ "connection_string"
40
+ ]
41
+ tags = ["literal-secret"]
42
+
43
+ [[rules]]
44
+ id = "env-short-secret-assignment"
45
+ description = "Uppercase env-style PASS/TOKEN/SECRET assignment"
46
+ regex = '''\b((?:PASS|TOKEN|SECRET|[A-Z0-9_]*(?:_PASS|_TOKEN|_SECRET|PASS_|TOKEN_|SECRET_)[A-Z0-9_]*))[ \t]*[:=][ \t]*["'']?([^"''[:space:]#{}$.][^"''\n#{}]{2,})["'']?'''
47
+ secretGroup = 2
48
+ keywords = [
49
+ "PASS",
50
+ "TOKEN",
51
+ "SECRET"
52
+ ]
53
+ tags = ["env", "literal-secret"]
54
+
55
+ [[rules]]
56
+ id = "standalone-sk-token"
57
+ description = "Standalone sk-* token not attached to a secret-like variable name"
58
+ regex = '''(?i)\b(sk-[A-Za-z0-9][A-Za-z0-9_-]{20,})\b'''
59
+ secretGroup = 1
60
+ entropy = 2.5
61
+ keywords = ["sk-"]
62
+ tags = ["standalone-token", "generic"]
63
+
64
+ [[rules]]
65
+ id = "dotenv-only-jest-setup"
66
+ description = ".env may only contain the committed Jest setup lines"
67
+ path = '''(?i)(^|/)\.env$'''
68
+ regex = '''(?m)^(.+)$'''
69
+ secretGroup = 1
70
+ tags = ["file", "dotenv"]
71
+ [[rules.allowlists]]
72
+ regexTarget = "match"
73
+ regexes = [
74
+ '''^JEST_USE_SETUP=OFF # Jest configuration variables: ON, OFF\r?$''',
75
+ ]
76
+
77
+ [[rules]]
78
+ id = "forbidden-secret-file"
79
+ description = "Forbidden secret-bearing file committed to repository"
80
+ path = '''(?i)(^|/)(\.env\..*|\.npmrc|\.pypirc|id_rsa|id_ed25519|.*\.(pem|key|p12|pfx|jks|kubeconfig))$'''
81
+ regex = '''(?s).{1,}'''
82
+ tags = ["file", "secret-file"]
83
+
84
+ [[allowlists]]
85
+ description = "Allow Jenkins SonarQube token environment variable reference"
86
+ regexTarget = "match"
87
+ regexes = [
88
+ '''SONAR_AUTH_TOKEN''',
89
+ ]
package/CHANGELOG.md CHANGED
@@ -4,12 +4,82 @@ All notable changes to this project will be documented in this file. Dates are d
4
4
 
5
5
  Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
6
6
 
7
- ### [1.0.0](https://github.com/eea/volto-cca-policy/compare/1.0.0-alpha.4...1.0.0) - 12 June 2026
7
+ ### [1.0.2](https://github.com/eea/volto-cca-policy/compare/1.0.1...1.0.2) - 21 July 2026
8
+
9
+ #### :bug: Bug Fixes
10
+
11
+ - fix: add uuid module mapping to jest configuration [kreafox - [`7b56e58`](https://github.com/eea/volto-cca-policy/commit/7b56e5855457a9fb26f2f0d8aa81138e72a7ff32)]
12
+ - fix: Add Jest snapshot for ExtendedToolView component and fix GeoChar rendering logic [kreafox - [`dc6be99`](https://github.com/eea/volto-cca-policy/commit/dc6be99ad49bcc100203eb8d7da436540e59d5bc)]
13
+ - fix: Add betterleaks github action - refs #304517 [dobri1408 - [`ed997d7`](https://github.com/eea/volto-cca-policy/commit/ed997d7794b063b3113f97dfe11ac3b02e1c1075)]
14
+
15
+ #### :hammer_and_wrench: Others
16
+
17
+ - Refs #304613 - uuid version [iugin - [`60e3e0a`](https://github.com/eea/volto-cca-policy/commit/60e3e0a2c866ea344e4eaf486ecef3db3aaa0689)]
18
+ - Refs #304613 - uuid [iugin - [`a8d7a98`](https://github.com/eea/volto-cca-policy/commit/a8d7a98dd435e71a22b090786ba37aa02c7145b6)]
19
+ - Refs #304613 - extended tool view template [iugin - [`a8b3e53`](https://github.com/eea/volto-cca-policy/commit/a8b3e535e801495f767ca2ba60da351c1ec9deff)]
20
+ - Refs #304613 - extended tool view template [iugin - [`0783553`](https://github.com/eea/volto-cca-policy/commit/0783553b70e38b20fd2aa1772367eeb7a738c7a4)]
21
+ - Refs #304613 - extended tool view [iugin - [`632c3fc`](https://github.com/eea/volto-cca-policy/commit/632c3fca4da0b7972d9120443b187fe2fad278bf)]
22
+ ### [1.0.1](https://github.com/eea/volto-cca-policy/compare/1.0.0...1.0.1) - 10 July 2026
23
+
24
+ #### :bug: Bug Fixes
25
+
26
+ - fix: remove duplicated @eeacms/volto-datablocks from package.json [kreafox - [`241febd`](https://github.com/eea/volto-cca-policy/commit/241febd890230dff62b67fe905bc359bb0c90f5c)]
27
+ - fix: improve parseDataURL function to validate input and extract data correctly [kreafox - [`0e5e534`](https://github.com/eea/volto-cca-policy/commit/0e5e534fab73426613a628880c27f6f39f9586ea)]
28
+
29
+ #### :house: Internal changes
30
+
31
+ - chore: [JENKINSFILE] sanitize sonarqube command Refs #305084 [valentinab25 - [`8106a44`](https://github.com/eea/volto-cca-policy/commit/8106a44e8f40dd360a274cede4b3f9c215d026cf)]
32
+
33
+ #### :hammer_and_wrench: Others
34
+
35
+ - test: pin Chromium version 149 to work with Cypress [valentinab25 - [`659ec82`](https://github.com/eea/volto-cca-policy/commit/659ec823dd71fe592a3a7accda22effbe1fb07bc)]
36
+ ## [1.0.0](https://github.com/eea/volto-cca-policy/compare/1.0.0-alpha.11...1.0.0) - 12 June 2026
37
+
38
+ ### [1.0.0-alpha.11](https://github.com/eea/volto-cca-policy/compare/1.0.0-alpha.10...1.0.0-alpha.11) - 20 July 2026
39
+
40
+ #### :bug: Bug Fixes
41
+
42
+ - fix: Add Jest snapshot for ExtendedToolView component and fix GeoChar rendering logic [kreafox - [`dc6be99`](https://github.com/eea/volto-cca-policy/commit/dc6be99ad49bcc100203eb8d7da436540e59d5bc)]
43
+ - fix: Add betterleaks github action - refs #304517 [dobri1408 - [`ed997d7`](https://github.com/eea/volto-cca-policy/commit/ed997d7794b063b3113f97dfe11ac3b02e1c1075)]
44
+
45
+ #### :hammer_and_wrench: Others
46
+
47
+ - Refs #304613 - uuid version [iugin - [`60e3e0a`](https://github.com/eea/volto-cca-policy/commit/60e3e0a2c866ea344e4eaf486ecef3db3aaa0689)]
48
+ - Refs #304613 - uuid [iugin - [`a8d7a98`](https://github.com/eea/volto-cca-policy/commit/a8d7a98dd435e71a22b090786ba37aa02c7145b6)]
49
+ - Refs #304613 - extended tool view template [iugin - [`a8b3e53`](https://github.com/eea/volto-cca-policy/commit/a8b3e535e801495f767ca2ba60da351c1ec9deff)]
50
+ - Refs #304613 - extended tool view template [iugin - [`0783553`](https://github.com/eea/volto-cca-policy/commit/0783553b70e38b20fd2aa1772367eeb7a738c7a4)]
51
+ - Refs #304613 - extended tool view [iugin - [`632c3fc`](https://github.com/eea/volto-cca-policy/commit/632c3fca4da0b7972d9120443b187fe2fad278bf)]
52
+ ### [1.0.0-alpha.10](https://github.com/eea/volto-cca-policy/compare/1.0.0-alpha.9...1.0.0-alpha.10) - 13 July 2026
53
+
54
+ ### [1.0.0-alpha.9](https://github.com/eea/volto-cca-policy/compare/1.0.0-alpha.8...1.0.0-alpha.9) - 10 July 2026
55
+
56
+ ### [1.0.0-alpha.8](https://github.com/eea/volto-cca-policy/compare/1.0.0-alpha.7...1.0.0-alpha.8) - 8 July 2026
57
+
58
+ ### [1.0.0-alpha.7](https://github.com/eea/volto-cca-policy/compare/1.0.0-alpha.6...1.0.0-alpha.7) - 7 July 2026
59
+
60
+ ### [1.0.0-alpha.6](https://github.com/eea/volto-cca-policy/compare/1.0.0-alpha.5...1.0.0-alpha.6) - 7 July 2026
61
+
62
+ #### :hammer_and_wrench: Others
63
+
64
+ - Refs #296263 - wip document updated resolve ESLint [iugin - [`3aab87b`](https://github.com/eea/volto-cca-policy/commit/3aab87b48a7a0bff3d088971e8880bb481650255)]
65
+ - Refs #296263 - wip document updated resolve ESLint [iugin - [`b016fa6`](https://github.com/eea/volto-cca-policy/commit/b016fa6f82ccbc8b353ea77dfd29519bafd97f47)]
66
+ - Refs #296263 - wip document updated request [iugin - [`baf89fd`](https://github.com/eea/volto-cca-policy/commit/baf89fd3f56350f71933ff63d7517faf88fb0b44)]
67
+ - test: pin Chromium version 149 to work with Cypress [valentinab25 - [`659ec82`](https://github.com/eea/volto-cca-policy/commit/659ec823dd71fe592a3a7accda22effbe1fb07bc)]
68
+ ### [1.0.0-alpha.5](https://github.com/eea/volto-cca-policy/compare/1.0.0-alpha.4...1.0.0-alpha.5) - 30 June 2026
69
+
70
+ #### :bug: Bug Fixes
71
+
72
+ - fix: remove duplicated @eeacms/volto-datablocks from package.json [kreafox - [`241febd`](https://github.com/eea/volto-cca-policy/commit/241febd890230dff62b67fe905bc359bb0c90f5c)]
73
+ - fix: improve parseDataURL function to validate input and extract data correctly [kreafox - [`0e5e534`](https://github.com/eea/volto-cca-policy/commit/0e5e534fab73426613a628880c27f6f39f9586ea)]
8
74
 
9
75
  #### :nail_care: Enhancements
10
76
 
11
77
  - refactor: remove deprecated Volto 17 stages from Jenkinsfile [kreafox - [`5297ddf`](https://github.com/eea/volto-cca-policy/commit/5297ddf10604963c08554080aee636c642b08f82)]
12
78
 
79
+ #### :house: Internal changes
80
+
81
+ - chore: [JENKINSFILE] sanitize sonarqube command Refs #305084 [valentinab25 - [`8106a44`](https://github.com/eea/volto-cca-policy/commit/8106a44e8f40dd360a274cede4b3f9c215d026cf)]
82
+
13
83
  #### :hammer_and_wrench: Others
14
84
 
15
85
  - test: increase code coverage for View component & improve rendering logic [kreafox - [`9b946a3`](https://github.com/eea/volto-cca-policy/commit/9b946a3eb36b0c3161c01733823a22cf8437e40e)]
@@ -545,6 +615,7 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
545
615
 
546
616
  #### :house: Internal changes
547
617
 
618
+ - chore: [JENKINSFILE] add package version in sonarqube [valentinab25 - [`e901251`](https://github.com/eea/volto-cca-policy/commit/e901251592eb54609fbc7eb8fcf7bd452c2da9cd)]
548
619
 
549
620
  ### [0.3.102](https://github.com/eea/volto-cca-policy/compare/0.3.101...0.3.102) - 24 February 2026
550
621
 
@@ -554,6 +625,7 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
554
625
 
555
626
  #### :house: Internal changes
556
627
 
628
+ - chore: [JENKINSFILE] use sonarqube branches [EEA Jenkins - [`8b3699a`](https://github.com/eea/volto-cca-policy/commit/8b3699a6cbaef662b5e80884ac2c1f7dc9c6591e)]
557
629
 
558
630
  ### [0.3.101](https://github.com/eea/volto-cca-policy/compare/0.3.100...0.3.101) - 28 January 2026
559
631
 
@@ -841,6 +913,7 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
841
913
  - style: fix item spacing [kreafox - [`7d4535d`](https://github.com/eea/volto-cca-policy/commit/7d4535dbc486e6cb80fc55d6ac8c7c01d9cf48af)]
842
914
  - chore: code cleanup [kreafox - [`842419b`](https://github.com/eea/volto-cca-policy/commit/842419b1bce3dc624755c81c9dea672198cab9e2)]
843
915
  - style: update teaser block styling [kreafox - [`1e0cad8`](https://github.com/eea/volto-cca-policy/commit/1e0cad8e1ed3ae827ee868dce8ad50b292a937ba)]
916
+ - chore: update Makefile, run yarn i18n [kreafox - [`61e6962`](https://github.com/eea/volto-cca-policy/commit/61e6962901068ae6512265417a730bd9befd65fe)]
844
917
  - chore: move styling to theme folder [kreafox - [`8cf6a1b`](https://github.com/eea/volto-cca-policy/commit/8cf6a1b8b14abf472a9c61b28db574f6d9e0bd3b)]
845
918
  - chore: remove ArrayWidget customization [kreafox - [`249bf93`](https://github.com/eea/volto-cca-policy/commit/249bf93054f7726c3d57a8b8ca01b75cd0d30522)]
846
919
  - chore: remove Footer customization [kreafox - [`7038af3`](https://github.com/eea/volto-cca-policy/commit/7038af37d48a328dfc31746f3fa84973e2f840ab)]
@@ -3603,10 +3676,13 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
3603
3676
  - Refs #260715 rast-block wip [Tripon Eugen - [`f19d54e`](https://github.com/eea/volto-cca-policy/commit/f19d54e0b9a6a86bf344eb85b6a1cda7f3de91bf)]
3604
3677
  - Refs #260715 rast-block wip [Tripon Eugen - [`2828537`](https://github.com/eea/volto-cca-policy/commit/2828537b6c084cd1a82162d552fb4ef025b71f9f)]
3605
3678
  - Refs #260715 rast-block updates [Tripon Eugen - [`1e803e5`](https://github.com/eea/volto-cca-policy/commit/1e803e5bd3d3fb7558f261c76c68866be7beb8b5)]
3679
+ - test: [JENKINS] Use java17 for sonarqube scanner [valentinab25 - [`0a15e1b`](https://github.com/eea/volto-cca-policy/commit/0a15e1b2ad081233685e80d5b3c60a8663f6b896)]
3680
+ - test: [JENKINS] Run cypress in started frontend container [valentinab25 - [`9554e44`](https://github.com/eea/volto-cca-policy/commit/9554e44c92a621a52b2adb5a4830fb084ee5734b)]
3606
3681
  ### [0.1.49](https://github.com/eea/volto-cca-policy/compare/0.1.48...0.1.49) - 15 November 2023
3607
3682
 
3608
3683
  #### :house: Internal changes
3609
3684
 
3685
+ - chore: [JENKINS] Refactor automated testing [valentinab25 - [`7b820a6`](https://github.com/eea/volto-cca-policy/commit/7b820a6369c2ddd5203b1a4abe352cb4bb43db7a)]
3610
3686
  - chore: husky, lint-staged use fixed versions [valentinab25 - [`f0a8061`](https://github.com/eea/volto-cca-policy/commit/f0a8061c275c236deb00087c23fac9860a073106)]
3611
3687
 
3612
3688
  #### :hammer_and_wrench: Others
@@ -3623,6 +3699,9 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
3623
3699
  - Refs #259267 - jenkins test [Tripon Eugen - [`cacd31e`](https://github.com/eea/volto-cca-policy/commit/cacd31e7b1afe0983674ed5c7632d2e1d7fa752e)]
3624
3700
  - Refs #259267 - jenkins [Tripon Eugen - [`5b3affe`](https://github.com/eea/volto-cca-policy/commit/5b3affee8401239de10097884c1b7f2349d15ec0)]
3625
3701
  - Refs #259267 - add When, lead image and title to files [Tripon Eugen - [`2cedb23`](https://github.com/eea/volto-cca-policy/commit/2cedb237f898af9057e13fba94b615ef71077204)]
3702
+ - test: [JENKINS] Add cpu limit on cypress docker [valentinab25 - [`4d607a5`](https://github.com/eea/volto-cca-policy/commit/4d607a576e9d0a5c34e48c41b409e7df616ee3d6)]
3703
+ - test: [JENKINS] Increase shm-size to cypress docker [valentinab25 - [`b7f74d5`](https://github.com/eea/volto-cca-policy/commit/b7f74d53513a6edbfbca5cb6d19687929bb1e5db)]
3704
+ - test: [JENKINS] Improve cypress time [valentinab25 - [`db65617`](https://github.com/eea/volto-cca-policy/commit/db656173391f65157098d95d388c25f6429753d8)]
3626
3705
  - Refs #259267 - cca event blocks attachments and check not mandatoty fields [Tripon Eugen - [`3138e5a`](https://github.com/eea/volto-cca-policy/commit/3138e5afb5bfbdbed14e27ed457b16867b7fa414)]
3627
3706
  - Refs #256681 - Fix error in CCA Event view menu. ([React Intl] An id must be provided to format a message.) [GhitaB - [`517eeb8`](https://github.com/eea/volto-cca-policy/commit/517eeb817264a47bbfd6b9b7d22aaf22d44ed224)]
3628
3707
  - Refs #161485 - Fix ECDE name conflict. [GhitaB - [`8bfd99f`](https://github.com/eea/volto-cca-policy/commit/8bfd99ff68bb82a04d1c0ed625fa514fcf46289e)]
@@ -3839,6 +3918,7 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
3839
3918
 
3840
3919
  #### :house: Internal changes
3841
3920
 
3921
+ - chore: [JENKINS] Remove alpha testing version [valentinab25 - [`ad1ced0`](https://github.com/eea/volto-cca-policy/commit/ad1ced0971ba116c13a3b5fcc039172cc915c919)]
3842
3922
 
3843
3923
  #### :hammer_and_wrench: Others
3844
3924
 
@@ -4319,6 +4399,7 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
4319
4399
  #### :hammer_and_wrench: Others
4320
4400
 
4321
4401
  - Refs #158294 - Update supported languages list. [GhitaB - [`0a4f91f`](https://github.com/eea/volto-cca-policy/commit/0a4f91f39b7edc367bd4c127d6a8f273c7788361)]
4402
+ - Add Sonarqube tag using cca-frontend addons list [EEA Jenkins - [`8f1f9ce`](https://github.com/eea/volto-cca-policy/commit/8f1f9ce6c22805670cc0800d3c779b6d619d0f31)]
4322
4403
  ### [0.1.1](https://github.com/eea/volto-cca-policy/compare/0.1.0...0.1.1) - 13 December 2022
4323
4404
 
4324
4405
  #### :hammer_and_wrench: Others
package/README.md CHANGED
@@ -26,6 +26,65 @@ See [RELEASE.md](https://github.com/eea/volto-cca-policy/blob/master/RELEASE.md)
26
26
 
27
27
  See [DEVELOP.md](https://github.com/eea/volto-cca-policy/blob/master/DEVELOP.md).
28
28
 
29
+ ## Secret Scanning
30
+
31
+ This repository uses the Betterleaks GitHub Action to scan the current
32
+ repository content on every push and pull request. The scan uses the rules in
33
+ `.gitleaks.toml` and uploads a `betterleaks-report` artifact when a finding is
34
+ detected.
35
+
36
+ If the optional SMTP secrets are configured, failed scans also send an email to
37
+ the last commit committer. The workflow expects these repository or
38
+ organization secrets:
39
+
40
+ - `SMTP_URL`
41
+ - `SMTP_PORT` (optional, defaults to `25`)
42
+ - `SMTP_EMAIL`
43
+ - `SMTP_PASSWORD` (optional if the SMTP server does not require authentication)
44
+
45
+ Port `465` is sent with direct TLS; other ports use the default SMTP handshake.
46
+ The email includes a short finding summary from the redacted Betterleaks report,
47
+ including the redacted matched line from each finding.
48
+
49
+ There are three common outcomes:
50
+
51
+ 1. **Everything is OK.** The `Betterleaks / Scan for secrets` check is green and
52
+ no action is needed. Regular references to runtime values are OK, for example:
53
+
54
+ ```js
55
+ const tokenFromCookie = req.universalCookies.get('auth_token');
56
+ ```
57
+
58
+ 2. **A real secret was found.** The check is red and the workflow log asks you to
59
+ download the `betterleaks-report` artifact. Open the artifact from the GitHub
60
+ Actions run and check the reported file, line and rule. Remove the committed
61
+ value, move it to the proper secret store, and rotate it if it was exposed.
62
+ A report entry looks like this:
63
+
64
+ ```json
65
+ {
66
+ "RuleID": "secret-literal-assignment",
67
+ "File": "src/config.js",
68
+ "StartLine": 12,
69
+ "Secret": "[REDACTED]"
70
+ }
71
+ ```
72
+
73
+ 3. **The finding is a false positive.** Keep the value only if it is clearly not
74
+ sensitive, such as a test fixture, placeholder, or public example. Add
75
+ `betterleaks:allow` on the same line and include a short explanation in the
76
+ pull request.
77
+
78
+ ```js
79
+ const testPassword = 'admin'; //betterleaks:allow
80
+ ```
81
+
82
+ ```yaml
83
+ password: "admin" #betterleaks:allow
84
+ ```
85
+
86
+ Do not add `betterleaks:allow` to real credentials.
87
+
29
88
  ## Copyright and license
30
89
 
31
90
  The Initial Owner of the Original Code is European Environment Agency (EEA).
package/RELEASE.md CHANGED
@@ -33,7 +33,7 @@ Release-it is a tool that automates 4 important steps in the release process:
33
33
  To configure the authentification, you need to export GITHUB_TOKEN for [GitHub](https://github.com/settings/tokens)
34
34
 
35
35
  ```
36
- export GITHUB_TOKEN=XXX-XXXXXXXXXXXXXXXXXXXXXX
36
+ export GITHUB_TOKEN="${GITHUB_TOKEN}"
37
37
  ```
38
38
 
39
39
  To configure npm, you can use the `npm login` command or use a configuration file with a TOKEN :
@@ -26,7 +26,9 @@ module.exports = {
26
26
  '!src/**/*.d.ts',
27
27
  ],
28
28
  moduleNameMapper: {
29
- '^node:crypto$': '<rootDir>/src/addons/volto-cca-policy/jest-node-crypto-mock.js',
29
+ '^uuid$': require.resolve('uuid'),
30
+ '^node:crypto$':
31
+ '<rootDir>/src/addons/volto-cca-policy/jest-node-crypto-mock.js',
30
32
  '\\.(css|less|scss|sass)$': 'identity-obj-proxy',
31
33
  '@plone-collective/volto-authomatic/(.*)$':
32
34
  '<rootDir>/node_modules/@plone-collective/volto-authomatic/src/$1',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eeacms/volto-cca-policy",
3
- "version": "1.0.0",
3
+ "version": "1.0.2",
4
4
  "description": "@eeacms/volto-cca-policy: Volto add-on",
5
5
  "main": "src/index.js",
6
6
  "author": "European Environment Agency: IDM2 A-Team",
@@ -23,7 +23,6 @@
23
23
  "@eeacms/volto-eea-design-system",
24
24
  "@eeacms/volto-eea-website-theme",
25
25
  "@eeacms/volto-tabs-block",
26
- "@eeacms/volto-datablocks",
27
26
  "@eeacms/volto-embed",
28
27
  "@eeacms/volto-globalsearch",
29
28
  "@plone-collective/volto-authomatic"
@@ -46,7 +45,8 @@
46
45
  "d3-array": "^2.12.1",
47
46
  "jotai": "^1.6.0",
48
47
  "query-string": "7.1.0",
49
- "react-visibility-sensor": "5.1.1"
48
+ "react-visibility-sensor": "5.1.1",
49
+ "uuid": "^8.3.2"
50
50
  },
51
51
  "devDependencies": {
52
52
  "@babel/plugin-proposal-export-default-from": "7.24.7",
@@ -17,6 +17,7 @@ import {
17
17
  ACE_PROJECT,
18
18
  PUBLICATION_REPORT,
19
19
  TOOL,
20
+ EXTENDED_TOOL,
20
21
  VIDEO,
21
22
  C3S_INDICATOR,
22
23
  NEWS_ITEM,
@@ -89,6 +90,7 @@ describe('CollectionStatsView', () => {
89
90
  [ORGANISATION]: 22,
90
91
  [PUBLICATION_REPORT]: 187,
91
92
  [TOOL]: 14,
93
+ [EXTENDED_TOOL]: 10,
92
94
  [VIDEO]: 17,
93
95
  },
94
96
  },
@@ -0,0 +1,409 @@
1
+ import { Container, Grid } from 'semantic-ui-react';
2
+ import { PortalMessage } from '@eeacms/volto-cca-policy/components';
3
+ import {
4
+ HTMLField,
5
+ ContentMetadata,
6
+ ItemLogo,
7
+ DocumentsList,
8
+ ExternalLink,
9
+ } from '@eeacms/volto-cca-policy/helpers';
10
+ import { defineMessages, useIntl } from 'react-intl';
11
+ import config from '@plone/volto/registry';
12
+
13
+ const ExtendedToolView = (props) => {
14
+ const { content } = props;
15
+ const {
16
+ title,
17
+ acronym,
18
+ long_description,
19
+ tool_provider,
20
+ public_private_mode,
21
+ hyperlink,
22
+ description,
23
+ coder_1,
24
+ coder_2,
25
+ only_interactive_support_tool,
26
+ adaptation_cycle_step,
27
+ updating_cycle_of_the_tool,
28
+ language_accessibility,
29
+ free_access,
30
+ intended_user_groups,
31
+ place_of_implementation,
32
+ type_of_data,
33
+ data_sources,
34
+ license_status,
35
+ user_support_provisions,
36
+ tool_validation_use,
37
+ number_of_users_tool,
38
+ tool_provider_mode,
39
+ adaptation_support_cycle_step,
40
+ tool_available_english,
41
+ tool_available_language,
42
+ type_of_outputs,
43
+ temporality_of_data,
44
+ spatial_resolution,
45
+ underlying_data_maintenance,
46
+ // nature_based_solution,
47
+ // just_resilience,
48
+ // cost_benefit_ratio,
49
+ accessibility_and_usability,
50
+ functionality,
51
+ strengths_and_possible_limitations,
52
+ } = content;
53
+
54
+ let tool_available_language_list = [];
55
+ if (tool_available_english) {
56
+ tool_available_language_list.push('English');
57
+ }
58
+ if (tool_available_language) {
59
+ tool_available_language_list.push(tool_available_language);
60
+ }
61
+
62
+ const item_title = acronym ? title + ' (' + acronym + ')' : title;
63
+
64
+ const messages = defineMessages({
65
+ yes: { id: 'YES', defaultMessage: 'YES' },
66
+ no: { id: 'NO', defaultMessage: 'NO' },
67
+ intended_user_groups: {
68
+ id: 'Intended User Groups',
69
+ defaultMessage: 'Intended User Groups',
70
+ },
71
+ tool_provider: { id: 'Tool provider', defaultMessage: 'Tool provider' },
72
+ only_interactive_support_tool: {
73
+ id: 'Only online interactive support tool',
74
+ defaultMessage: 'Only online interactive support tool',
75
+ },
76
+ adaptation_cycle_step: {
77
+ id: 'Supports ≥1 adaptation cycle step ',
78
+ defaultMessage: 'Supports ≥1 adaptation cycle step ',
79
+ },
80
+ updating_cycle_of_the_tool: {
81
+ id: 'Updating cycle of the tool',
82
+ defaultMessage: 'Updating cycle of the tool',
83
+ },
84
+ language_accessibility: {
85
+ id: 'Language Accessibility',
86
+ defaultMessage: 'Language Accessibility',
87
+ },
88
+ free_access: {
89
+ id: 'Free [full or core functionality] access ',
90
+ defaultMessage: 'Free [full or core functionality] access ',
91
+ },
92
+ place_of_implementation: {
93
+ id: 'Place of implementation',
94
+ defaultMessage: 'Place of implementation',
95
+ },
96
+ type_of_data: { id: 'Type of data', defaultMessage: 'Type of data' },
97
+ data_sources: { id: 'Data sources', defaultMessage: 'Data sources' },
98
+ license_status: { id: 'License status', defaultMessage: 'License status' },
99
+ user_support_provisions: {
100
+ id: 'User support provisions ',
101
+ defaultMessage: 'User support provisions ',
102
+ },
103
+ tool_validation_use: {
104
+ id: 'Tool validation use',
105
+ defaultMessage: 'Tool validation use',
106
+ },
107
+ number_of_users_tool: {
108
+ id: 'Number of users / uptake',
109
+ defaultMessage: 'Number of users / uptake',
110
+ },
111
+ tool_provider_mode: {
112
+ id: 'Tool provider',
113
+ defaultMessage: 'Tool provider',
114
+ },
115
+ adaptation_support_cycle_step: {
116
+ id: 'Adaptation Support Cycle Step',
117
+ defaultMessage: 'Adaptation Support Cycle Step',
118
+ },
119
+ tool_available_language: {
120
+ id: 'Available language',
121
+ defaultMessage: 'Available language',
122
+ },
123
+ type_of_outputs: {
124
+ id: 'Type of outputs',
125
+ defaultMessage: 'Type of outputs',
126
+ },
127
+ temporality_of_data: {
128
+ id: 'Temporality of data',
129
+ defaultMessage: 'Temporality of data',
130
+ },
131
+ nature_based_solution: {
132
+ id: 'Nature-based solution',
133
+ defaultMessage: 'Nature-based solution',
134
+ },
135
+ just_resilience: {
136
+ id: 'Just resilience',
137
+ defaultMessage: 'Just resilience',
138
+ },
139
+ cost_benefit_ratio: {
140
+ id: 'Cost-benefit ratio',
141
+ defaultMessage: 'Cost-benefit ratio',
142
+ },
143
+ accessibility_and_usability: {
144
+ id: 'Accessibility and usability',
145
+ defaultMessage: 'Accessibility and usability',
146
+ },
147
+ functionality: { id: 'Functionality', defaultMessage: 'Functionality' },
148
+ strengths_and_possible_limitations: {
149
+ id: 'Strengths and possible limitations of the tool',
150
+ defaultMessage: 'Strengths and possible limitations of the tool',
151
+ },
152
+ public_private_mode: {
153
+ id: 'Public/private',
154
+ defaultMessage: 'Public/private',
155
+ },
156
+ spatial_resolution: {
157
+ id: 'Spatial resolution',
158
+ defaultMessage: 'Spatial resolution',
159
+ },
160
+ underlying_data_maintenance: {
161
+ id: 'Underlying data maintenance',
162
+ defaultMessage: 'Underlying data maintenance',
163
+ },
164
+ hyperlink: { id: 'Tool hyperlink', defaultMessage: 'Tool hyperlink' },
165
+ });
166
+ const intl = useIntl();
167
+ const {
168
+ blocks: { blocksConfig },
169
+ } = config;
170
+ const TitleBlockView = blocksConfig?.title?.view;
171
+ const titleBlockData = { ...content, title: item_title, image: '' };
172
+
173
+ return (
174
+ <div className="db-item-view">
175
+ <TitleBlockView
176
+ {...props}
177
+ data={{
178
+ '@type': 'title',
179
+ info: [{ description: '' }],
180
+ hideContentType: true,
181
+ hideCreationDate: true,
182
+ hideModificationDate: true,
183
+ hidePublishingDate: true,
184
+ hideDownloadButton: false,
185
+ hideShareButton: false,
186
+ subtitle: 'Tool',
187
+ }}
188
+ metadata={titleBlockData}
189
+ properties={titleBlockData}
190
+ />
191
+ <Container>
192
+ <PortalMessage content={content} />
193
+ <Grid columns="12">
194
+ <Grid.Row>
195
+ <Grid.Column
196
+ mobile={12}
197
+ tablet={12}
198
+ computer={8}
199
+ className="col-left"
200
+ >
201
+ <ItemLogo {...props} />
202
+
203
+ <HTMLField value={long_description} />
204
+ {tool_provider && tool_provider.length > 0 && (
205
+ <>
206
+ <h4>{intl.formatMessage(messages.tool_provider)}</h4>
207
+ <p>{tool_provider}</p>
208
+ </>
209
+ )}
210
+ {public_private_mode && public_private_mode.length > 0 && (
211
+ <>
212
+ <h5>{intl.formatMessage(messages.public_private_mode)}</h5>
213
+ <p>{public_private_mode}</p>
214
+ </>
215
+ )}
216
+ <HTMLField value={description} />
217
+ {coder_1 && coder_1.length > 0 && (
218
+ <>
219
+ <h5>Coder1</h5>
220
+ <p>{coder_1}</p>
221
+ </>
222
+ )}
223
+ {coder_2 && coder_2.length > 0 && (
224
+ <>
225
+ <h5>Coder2</h5>
226
+ <p>{coder_2}</p>
227
+ </>
228
+ )}
229
+ <h5>
230
+ {intl.formatMessage(messages.only_interactive_support_tool)}
231
+ </h5>
232
+ {only_interactive_support_tool
233
+ ? intl.formatMessage(messages.yes)
234
+ : intl.formatMessage(messages.no)}
235
+ <h5>{intl.formatMessage(messages.adaptation_cycle_step)}</h5>
236
+ {adaptation_cycle_step
237
+ ? intl.formatMessage(messages.yes)
238
+ : intl.formatMessage(messages.no)}
239
+ <h5>{intl.formatMessage(messages.updating_cycle_of_the_tool)}</h5>
240
+ {updating_cycle_of_the_tool
241
+ ? intl.formatMessage(messages.yes)
242
+ : intl.formatMessage(messages.no)}
243
+ <h5>{intl.formatMessage(messages.language_accessibility)}</h5>
244
+ {language_accessibility
245
+ ? intl.formatMessage(messages.yes)
246
+ : intl.formatMessage(messages.no)}
247
+ <h5>{intl.formatMessage(messages.free_access)}</h5>
248
+ {free_access
249
+ ? intl.formatMessage(messages.yes)
250
+ : intl.formatMessage(messages.no)}
251
+ {hyperlink && hyperlink.length > 0 && (
252
+ <>
253
+ <h5>{intl.formatMessage(messages.hyperlink)}</h5>
254
+ <ExternalLink url={hyperlink} text={hyperlink} />
255
+ </>
256
+ )}
257
+ {intended_user_groups && intended_user_groups.length > 0 && (
258
+ <>
259
+ <h5>{intl.formatMessage(messages.intended_user_groups)}</h5>
260
+ {intended_user_groups.map((item) => item.title).join(', ')}
261
+ </>
262
+ )}
263
+ {place_of_implementation &&
264
+ place_of_implementation.length > 0 && (
265
+ <>
266
+ <h5>
267
+ {intl.formatMessage(messages.place_of_implementation)}
268
+ </h5>
269
+ {place_of_implementation
270
+ .map((item) => item.title)
271
+ .join(', ')}
272
+ </>
273
+ )}
274
+ {type_of_data && type_of_data.length > 0 && (
275
+ <>
276
+ <h5>{intl.formatMessage(messages.type_of_data)}</h5>
277
+ {type_of_data.map((item) => item.title).join(', ')}
278
+ </>
279
+ )}
280
+ {data_sources && data_sources.length > 0 && (
281
+ <>
282
+ <h5>{intl.formatMessage(messages.data_sources)}</h5>
283
+ {data_sources.map((item) => item.title).join(', ')}
284
+ </>
285
+ )}
286
+ {license_status && license_status.length > 0 && (
287
+ <>
288
+ <h5>{intl.formatMessage(messages.license_status)}</h5>
289
+ {license_status.map((item) => item.title).join(', ')}
290
+ </>
291
+ )}
292
+ {user_support_provisions &&
293
+ user_support_provisions.length > 0 && (
294
+ <>
295
+ <h5>
296
+ {intl.formatMessage(messages.user_support_provisions)}
297
+ </h5>
298
+ {user_support_provisions
299
+ .map((item) => item.title)
300
+ .join(', ')}
301
+ </>
302
+ )}
303
+ {tool_validation_use && tool_validation_use.length > 0 && (
304
+ <>
305
+ <h5>{intl.formatMessage(messages.tool_validation_use)}</h5>
306
+ {tool_validation_use.map((item) => item.title).join(', ')}
307
+ </>
308
+ )}
309
+ {number_of_users_tool && number_of_users_tool.length > 0 && (
310
+ <>
311
+ <h5>{intl.formatMessage(messages.number_of_users_tool)}</h5>
312
+ {number_of_users_tool.map((item) => item.title).join(', ')}
313
+ </>
314
+ )}
315
+ {tool_provider_mode && tool_provider_mode.length > 0 && (
316
+ <>
317
+ <h5>{intl.formatMessage(messages.tool_provider_mode)}</h5>
318
+ {tool_provider_mode.map((item) => item.title).join(', ')}
319
+ </>
320
+ )}
321
+ {adaptation_support_cycle_step &&
322
+ adaptation_support_cycle_step.length > 0 && (
323
+ <>
324
+ <h5>
325
+ {intl.formatMessage(
326
+ messages.adaptation_support_cycle_step,
327
+ )}
328
+ </h5>
329
+ {adaptation_support_cycle_step
330
+ .map((item) => item.title)
331
+ .join(', ')}
332
+ </>
333
+ )}
334
+ <h5>{intl.formatMessage(messages.tool_available_language)}</h5>
335
+ {tool_available_language_list.join(', ')}
336
+ {type_of_outputs && type_of_outputs.length > 0 && (
337
+ <>
338
+ <h5>{intl.formatMessage(messages.type_of_outputs)}</h5>
339
+ {type_of_outputs.map((item) => item.title).join(', ')}
340
+ </>
341
+ )}
342
+ <h5>{intl.formatMessage(messages.tool_available_language)}</h5>
343
+ {tool_available_english ? 'English' : tool_available_language}
344
+ {temporality_of_data && temporality_of_data.length > 0 && (
345
+ <>
346
+ <h5>{intl.formatMessage(messages.temporality_of_data)}</h5>
347
+ {temporality_of_data.map((item) => item.title).join(', ')}
348
+ </>
349
+ )}
350
+ {spatial_resolution && spatial_resolution.length > 0 && (
351
+ <p>
352
+ <strong>
353
+ {intl.formatMessage(messages.spatial_resolution)}
354
+ </strong>
355
+ {spatial_resolution}
356
+ </p>
357
+ )}
358
+ <h5>{intl.formatMessage(messages.functionality)}</h5>
359
+ <p>{functionality}</p>
360
+ {underlying_data_maintenance && (
361
+ <>
362
+ <p>
363
+ <strong>
364
+ {intl.formatMessage(messages.underlying_data_maintenance)}
365
+ </strong>
366
+ </p>
367
+ <p>{underlying_data_maintenance}</p>
368
+ </>
369
+ )}
370
+ {accessibility_and_usability && (
371
+ <>
372
+ <p>
373
+ <strong>
374
+ {intl.formatMessage(messages.accessibility_and_usability)}
375
+ </strong>
376
+ </p>
377
+ <p>{accessibility_and_usability.title}</p>
378
+ </>
379
+ )}
380
+ {strengths_and_possible_limitations && (
381
+ <>
382
+ <p>
383
+ <strong>
384
+ {intl.formatMessage(
385
+ messages.strengths_and_possible_limitations,
386
+ )}
387
+ </strong>
388
+ </p>
389
+ <p>{strengths_and_possible_limitations}</p>
390
+ </>
391
+ )}
392
+ </Grid.Column>
393
+ <Grid.Column
394
+ mobile={12}
395
+ tablet={12}
396
+ computer={4}
397
+ className="col-right"
398
+ >
399
+ <ContentMetadata {...props} />
400
+ <DocumentsList {...props} />
401
+ </Grid.Column>
402
+ </Grid.Row>
403
+ </Grid>
404
+ </Container>
405
+ </div>
406
+ );
407
+ };
408
+
409
+ export default ExtendedToolView;
@@ -0,0 +1,74 @@
1
+ import React from 'react';
2
+ import { MemoryRouter } from 'react-router-dom';
3
+ import configureStore from 'redux-mock-store';
4
+ import '@testing-library/jest-dom';
5
+ import { Provider } from 'react-intl-redux';
6
+ import ExtendedToolView from './ExtendedToolView';
7
+ import renderer from 'react-test-renderer';
8
+ import config from '@plone/volto/registry';
9
+
10
+ config.blocks = {
11
+ blocksConfig: {
12
+ title: {
13
+ view: () => <div>Title Block Component</div>,
14
+ },
15
+ },
16
+ };
17
+
18
+ const mockStore = configureStore();
19
+
20
+ jest.mock('semantic-ui-react', () => ({
21
+ ...jest.requireActual('semantic-ui-react'),
22
+ }));
23
+
24
+ jest.mock('@eeacms/volto-embed', () => {
25
+ return {
26
+ PrivacyProtection: jest.fn(({ children }) => <div>{children}</div>),
27
+ };
28
+ });
29
+
30
+ describe('ExtendedToolView', () => {
31
+ it('should render the component', () => {
32
+ const content = {
33
+ title: 'My ExtendedToolView',
34
+ long_description: {
35
+ 'content-type': null,
36
+ data: '<p>Nam commodo suscipit quam. Praesent egestas neque eu enim. Quisque rutrum.</p>',
37
+ encoding: 'utf-8',
38
+ },
39
+ publication_date: '2022-06-24',
40
+ geochars:
41
+ '{\r\n "geoElements":{"element":"GLOBAL",\r\n "macrotrans":null,"biotrans":null,"countries":[],\r\n "subnational":[],"city":""}}',
42
+ keywords: ['keyword 1', 'keyword 2'],
43
+ websites: ['https://example.org/'],
44
+ contributions: [
45
+ {
46
+ title: 'Contributor 1',
47
+ url: '/contributor-1',
48
+ },
49
+ {
50
+ title: 'Contributor 2',
51
+ url: '/contributor-2',
52
+ },
53
+ ],
54
+ };
55
+
56
+ const store = mockStore({
57
+ userSession: { token: '1234' },
58
+ intl: {
59
+ locale: 'en',
60
+ messages: {},
61
+ },
62
+ });
63
+
64
+ const component = renderer.create(
65
+ <Provider store={store}>
66
+ <MemoryRouter>
67
+ <ExtendedToolView content={content} />
68
+ </MemoryRouter>
69
+ </Provider>,
70
+ );
71
+ const json = component.toJSON();
72
+ expect(json).toMatchSnapshot();
73
+ });
74
+ });
@@ -116,13 +116,30 @@ const getImageFilename = (value) => {
116
116
  };
117
117
 
118
118
  const parseDataURL = (dataUrl) => {
119
- const fields = dataUrl?.match(/^data:(.*);(.*),(.*)$/);
120
- if (!fields) return null;
119
+ const DATA_URL_PREFIX = 'data:';
120
+
121
+ if (typeof dataUrl !== 'string' || !dataUrl.startsWith(DATA_URL_PREFIX)) {
122
+ return null;
123
+ }
124
+
125
+ const start = DATA_URL_PREFIX.length;
126
+ const dataSeparator = dataUrl.indexOf(',', start);
127
+
128
+ if (dataSeparator === -1) return null;
129
+
130
+ const encodingSeparator = dataUrl.lastIndexOf(';', dataSeparator);
131
+
132
+ if (encodingSeparator < start) return null;
133
+
134
+ const contentType = dataUrl.slice(start, encodingSeparator);
135
+ const encoding = dataUrl.slice(encodingSeparator + 1, dataSeparator);
136
+
137
+ if (!contentType || !encoding) return null;
121
138
 
122
139
  return {
123
- 'content-type': fields[1],
124
- encoding: fields[2],
125
- data: fields[3],
140
+ 'content-type': contentType,
141
+ encoding,
142
+ data: dataUrl.slice(dataSeparator + 1),
126
143
  };
127
144
  };
128
145
 
package/src/constants.js CHANGED
@@ -7,6 +7,7 @@ export const ORGANISATION = 'eea.climateadapt.organisation';
7
7
  export const ACE_PROJECT = 'eea.climateadapt.aceproject';
8
8
  export const PUBLICATION_REPORT = 'eea.climateadapt.publicationreport';
9
9
  export const TOOL = 'eea.climateadapt.tool';
10
+ export const EXTENDED_TOOL = 'eea.climateadapt.extendedtool';
10
11
  export const VIDEO = 'eea.climateadapt.video';
11
12
  export const C3S_INDICATOR = 'eea.climateadapt.c3sindicator';
12
13
  export const MISSION_SIGNATORY_PROFILE = 'mission_signatory_profile';
@@ -241,6 +242,7 @@ export const EU_COUNTRIES = [
241
242
  'SI',
242
243
  'SK',
243
244
  'TR',
245
+ 'UA',
244
246
  'XK',
245
247
  'GB',
246
248
  ];
@@ -46,7 +46,7 @@ async function getRssFeedData(apiPath, APISUFFIX, req, settings) {
46
46
  .accept('json')
47
47
  .use(addHeadersFactory(req));
48
48
 
49
- const authToken = req.universalCookies?.get?.('auth_token');
49
+ const authToken = req.universalCookies?.get?.('auth_token'); //betterleaks:allow
50
50
  if (authToken) {
51
51
  request.set('Authorization', `Bearer ${authToken}`);
52
52
  }
@@ -39,7 +39,7 @@ class LinkView extends Component {
39
39
  */
40
40
  static defaultProps = {
41
41
  content: null,
42
- token: null,
42
+ token: null, //betterleaks:allow
43
43
  };
44
44
 
45
45
  componentDidMount() {
@@ -238,7 +238,7 @@ server.get('/*', (req, res) => {
238
238
  .toString(),
239
239
  );
240
240
 
241
- const authToken = req.universalCookies.get('auth_token');
241
+ const authToken = req.universalCookies.get('auth_token'); //betterleaks:allow
242
242
  const initialState = {
243
243
  userSession: { ...userSession(), token: authToken },
244
244
  form: req.body,
package/src/index.js CHANGED
@@ -18,6 +18,7 @@ import {
18
18
  import CcaEventView from './components/theme/Views/CcaEventView';
19
19
  import NewsItemView from './components/theme/Views/NewsItemView';
20
20
  import EventView from './components/theme/Views/EventView';
21
+ import ExtendedToolView from './components/theme/Views/ExtendedToolView';
21
22
  import AdaptationOptionView from './components/theme/Views/AdaptationOptionView';
22
23
  import CaseStudyView from './components/theme/Views/CaseStudyView';
23
24
  import ProjectView from './components/theme/Views/ProjectView';
@@ -33,6 +34,7 @@ import {
33
34
  ACE_PROJECT,
34
35
  PUBLICATION_REPORT,
35
36
  TOOL,
37
+ EXTENDED_TOOL,
36
38
  VIDEO,
37
39
  C3S_INDICATOR,
38
40
  CCA_EVENT,
@@ -357,6 +359,7 @@ const applyConfig = (config) => {
357
359
  [EVENT]: EventView,
358
360
  [CCA_EVENT]: CcaEventView,
359
361
  [TOOL]: DatabaseItemView,
362
+ [EXTENDED_TOOL]: ExtendedToolView,
360
363
  [INDICATOR]: DatabaseItemView,
361
364
  [ORGANISATION]: DatabaseItemView,
362
365
  [GUIDANCE]: DatabaseItemView,