@eeacms/volto-cca-policy 1.0.10 → 1.0.12

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 CHANGED
@@ -4,6 +4,21 @@ 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.12](https://github.com/eea/volto-cca-policy/compare/1.0.11...1.0.12) - 24 August 2026
8
+
9
+ #### :bug: Bug Fixes
10
+
11
+ - fix: disable unavailable navigator guide options [kreafox - [`4b114c2`](https://github.com/eea/volto-cca-policy/commit/4b114c2b0ea7a6a6528ae8ae378c2e671b640945)]
12
+
13
+ #### :nail_care: Enhancements
14
+
15
+ - change: add custom hook for guide facet options and add tests [kreafox - [`872eb9b`](https://github.com/eea/volto-cca-policy/commit/872eb9b35c41fc2094c605b113411448a8cef9a8)]
16
+
17
+ #### :hammer_and_wrench: Others
18
+
19
+ - test: increase utility coverage [kreafox - [`d9c3db8`](https://github.com/eea/volto-cca-policy/commit/d9c3db8cc6fb91ead00f83b822f6fe48c26a70b1)]
20
+ ### [1.0.11](https://github.com/eea/volto-cca-policy/compare/1.0.10...1.0.11) - 21 August 2026
21
+
7
22
  ### [1.0.10](https://github.com/eea/volto-cca-policy/compare/1.0.9...1.0.10) - 19 August 2026
8
23
 
9
24
  #### :rocket: New Features
@@ -281,12 +296,59 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
281
296
 
282
297
  #### :house: Internal changes
283
298
 
299
+ - chore: [JENKINSFILE] sanitize sonarqube command Refs #305084 [valentinab25 - [`8106a44`](https://github.com/eea/volto-cca-policy/commit/8106a44e8f40dd360a274cede4b3f9c215d026cf)]
284
300
 
285
301
  #### :hammer_and_wrench: Others
286
302
 
287
303
  - test: pin Chromium version 149 to work with Cypress [valentinab25 - [`659ec82`](https://github.com/eea/volto-cca-policy/commit/659ec823dd71fe592a3a7accda22effbe1fb07bc)]
288
- ## [1.0.0](https://github.com/eea/volto-cca-policy/compare/1.0.0-alpha.21...1.0.0) - 12 June 2026
304
+ ## [1.0.0](https://github.com/eea/volto-cca-policy/compare/1.0.0-alpha.24...1.0.0) - 12 June 2026
305
+
306
+ ### [1.0.0-alpha.24](https://github.com/eea/volto-cca-policy/compare/1.0.0-alpha.23...1.0.0-alpha.24) - 24 August 2026
289
307
 
308
+ ### [1.0.0-alpha.23](https://github.com/eea/volto-cca-policy/compare/1.0.0-alpha.22...1.0.0-alpha.23) - 19 August 2026
309
+
310
+ ### [1.0.0-alpha.22](https://github.com/eea/volto-cca-policy/compare/1.0.0-alpha.21...1.0.0-alpha.22) - 19 August 2026
311
+
312
+ #### :rocket: New Features
313
+
314
+ - feat: add FieldValueList component and update CompareToolsView for better display of adaptation steps and sectors [kreafox - [`0b3cd95`](https://github.com/eea/volto-cca-policy/commit/0b3cd951ec38982d50a10fc76932bf46788a5c96)]
315
+ - feat: improve ExtendedToolView and RelatedTools with improved layout and additional tags [kreafox - [`5d0b971`](https://github.com/eea/volto-cca-policy/commit/5d0b971e6777725b6007ed888e8226d962292999)]
316
+ - feat: add related tools section to ExtendedToolView [kreafox - [`b60b794`](https://github.com/eea/volto-cca-policy/commit/b60b794f7b69174a8b6cc690da1734dab062a214)]
317
+ - feat: update ExtendedToolView with tool usage and spatial resolution details [kreafox - [`0fcb769`](https://github.com/eea/volto-cca-policy/commit/0fcb769b1f9e00c809463a1eccb9c260b40cb0ab)]
318
+ - feat: update ExtendedToolView [kreafox - [`ac4b0a0`](https://github.com/eea/volto-cca-policy/commit/ac4b0a06cdb00d506b93a0a2613415850f69f590)]
319
+ - feat: add ExtendedToolGeographicMetadata [kreafox - [`60cb434`](https://github.com/eea/volto-cca-policy/commit/60cb4345a7ba74a3061df877593155aadadb7dc3)]
320
+ - feat: improve LinkedMetadataItemList and MetadataItemList components to support inline and list rendering [kreafox - [`845164a`](https://github.com/eea/volto-cca-policy/commit/845164aefb7ae94ba59befbaa4482aa6a025b3c1)]
321
+ - feat: improve MetadataItemList to support list rendering and add GeographicMetadata to ExtendedToolView [kreafox - [`0909eb3`](https://github.com/eea/volto-cca-policy/commit/0909eb3e53bd4f8058f66dcd1d9a717be6c40b24)]
322
+ - feat: update metadata section [kreafox - [`666c84f`](https://github.com/eea/volto-cca-policy/commit/666c84fcc0de41b80d5d019fa6ab6ebdfed07a62)]
323
+ - feat: add climate impacts and sectors metadata to ExtendedToolView and update tests [kreafox - [`09226a4`](https://github.com/eea/volto-cca-policy/commit/09226a43fc60e337f1111b1750aa7469c22d4074)]
324
+ - feat: add share functionality to ExtendedToolView [kreafox - [`cbd015f`](https://github.com/eea/volto-cca-policy/commit/cbd015f7d467594391a448e546a980a93d371473)]
325
+ - feat: enhance ExtendedToolView layout and styles [kreafox - [`ec4d7a6`](https://github.com/eea/volto-cca-policy/commit/ec4d7a6841e2b19605a153eedd9dde69064865c5)]
326
+
327
+ #### :bug: Bug Fixes
328
+
329
+ - fix: update heading from 'Climate impacts' to 'Climate hazards' in ExtendedToolView tests [kreafox - [`affee3f`](https://github.com/eea/volto-cca-policy/commit/affee3fc5afe303a6c69a743605f9fc5f44b53ed)]
330
+ - fix: improve language handling and refactor hyperlink section in ExtendedToolView [kreafox - [`aefc8c5`](https://github.com/eea/volto-cca-policy/commit/aefc8c58298523a22a23b9b8ff6359053c5e49fb)]
331
+ - fix(tool): update related tools and adjust styles [kreafox - [`04f89ff`](https://github.com/eea/volto-cca-policy/commit/04f89ff38abfe50a6c5ae21e71f884c58f4db787)]
332
+ - fix(test): remove unused ItemLogo mock [kreafox - [`8593036`](https://github.com/eea/volto-cca-policy/commit/85930369fea097c53092727faef30749e628eee3)]
333
+ - fix(styles): update background colors to use secondaryColor [kreafox - [`d333b75`](https://github.com/eea/volto-cca-policy/commit/d333b753b6b1821e9fd3b4f6191028b91c356cd3)]
334
+ - fix(search): update colors & style [kreafox - [`06e3a27`](https://github.com/eea/volto-cca-policy/commit/06e3a273a8b978d35f8a64bab533427909c88c69)]
335
+ - fix: add labelPosition to ExternalLink [kreafox - [`ef93ef2`](https://github.com/eea/volto-cca-policy/commit/ef93ef208744e19d3cba0828294df76a2bfc1b3b)]
336
+
337
+ #### :nail_care: Enhancements
338
+
339
+ - change: functionality to dots in compare page [kreafox - [`047aabf`](https://github.com/eea/volto-cca-policy/commit/047aabf61d3152b94cfb4ccfcedfbfcf21483987)]
340
+ - change: move user groups in metadata section [kreafox - [`95f33b8`](https://github.com/eea/volto-cca-policy/commit/95f33b8e4040e69cb435aa550bc446f3174575f0)]
341
+ - refactor: rename climate impacts to climate hazards and update related messages [kreafox - [`921da15`](https://github.com/eea/volto-cca-policy/commit/921da159ec96a8d633aa3b8617382ef761259df8)]
342
+ - refactor(test): clean up ExtendedToolView tests [kreafox - [`fbe7978`](https://github.com/eea/volto-cca-policy/commit/fbe797823e297fd92467c6d4f250d0647e48f9e6)]
343
+ - refactor: clean up ExtendedToolView component and tests, remove unused fields and mocks [kreafox - [`7ee545f`](https://github.com/eea/volto-cca-policy/commit/7ee545f2361ebc877917e5911c37d5d2ed6a5dda)]
344
+ - refactor: code cleanup in ExtendedToolView [kreafox - [`8b89379`](https://github.com/eea/volto-cca-policy/commit/8b89379c20976abe5aa7060ad12a8a684ea972dc)]
345
+ - refactor: adjust theme variables [kreafox - [`cbe7df4`](https://github.com/eea/volto-cca-policy/commit/cbe7df4d08a76f652d012acd1ae8983a32dd8fcf)]
346
+
347
+ #### :hammer_and_wrench: Others
348
+
349
+ - Refs #307245 - Add test for visualizations. [GhitaB - [`15d7a0b`](https://github.com/eea/volto-cca-policy/commit/15d7a0bc514e6ac09bbec19303e42ceb120647dc)]
350
+ - core(i18n): update locales [kreafox - [`e81e7ce`](https://github.com/eea/volto-cca-policy/commit/e81e7ce14f6dff4d0a8969e465cb0685d844aed5)]
351
+ - test: update heading in ExtendedToolView tests [kreafox - [`7a3a854`](https://github.com/eea/volto-cca-policy/commit/7a3a85435050bafe164feaa6e8f0e09b3e20fd25)]
290
352
  ### [1.0.0-alpha.21](https://github.com/eea/volto-cca-policy/compare/1.0.0-alpha.20...1.0.0-alpha.21) - 18 August 2026
291
353
 
292
354
  #### :hammer_and_wrench: Others
@@ -544,6 +606,7 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
544
606
 
545
607
  #### :house: Internal changes
546
608
 
609
+ - chore: [JENKINSFILE] sanitize sonarqube command Refs #305084 [valentinab25 - [`8106a44`](https://github.com/eea/volto-cca-policy/commit/8106a44e8f40dd360a274cede4b3f9c215d026cf)]
547
610
 
548
611
  #### :hammer_and_wrench: Others
549
612
 
@@ -1080,6 +1143,7 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
1080
1143
 
1081
1144
  #### :house: Internal changes
1082
1145
 
1146
+ - chore: [JENKINSFILE] add package version in sonarqube [valentinab25 - [`e901251`](https://github.com/eea/volto-cca-policy/commit/e901251592eb54609fbc7eb8fcf7bd452c2da9cd)]
1083
1147
 
1084
1148
  ### [0.3.102](https://github.com/eea/volto-cca-policy/compare/0.3.101...0.3.102) - 24 February 2026
1085
1149
 
@@ -1089,6 +1153,7 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
1089
1153
 
1090
1154
  #### :house: Internal changes
1091
1155
 
1156
+ - chore: [JENKINSFILE] use sonarqube branches [EEA Jenkins - [`8b3699a`](https://github.com/eea/volto-cca-policy/commit/8b3699a6cbaef662b5e80884ac2c1f7dc9c6591e)]
1092
1157
 
1093
1158
  ### [0.3.101](https://github.com/eea/volto-cca-policy/compare/0.3.100...0.3.101) - 28 January 2026
1094
1159
 
@@ -1376,6 +1441,7 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
1376
1441
  - style: fix item spacing [kreafox - [`7d4535d`](https://github.com/eea/volto-cca-policy/commit/7d4535dbc486e6cb80fc55d6ac8c7c01d9cf48af)]
1377
1442
  - chore: code cleanup [kreafox - [`842419b`](https://github.com/eea/volto-cca-policy/commit/842419b1bce3dc624755c81c9dea672198cab9e2)]
1378
1443
  - style: update teaser block styling [kreafox - [`1e0cad8`](https://github.com/eea/volto-cca-policy/commit/1e0cad8e1ed3ae827ee868dce8ad50b292a937ba)]
1444
+ - chore: update Makefile, run yarn i18n [kreafox - [`61e6962`](https://github.com/eea/volto-cca-policy/commit/61e6962901068ae6512265417a730bd9befd65fe)]
1379
1445
  - chore: move styling to theme folder [kreafox - [`8cf6a1b`](https://github.com/eea/volto-cca-policy/commit/8cf6a1b8b14abf472a9c61b28db574f6d9e0bd3b)]
1380
1446
  - chore: remove ArrayWidget customization [kreafox - [`249bf93`](https://github.com/eea/volto-cca-policy/commit/249bf93054f7726c3d57a8b8ca01b75cd0d30522)]
1381
1447
  - chore: remove Footer customization [kreafox - [`7038af3`](https://github.com/eea/volto-cca-policy/commit/7038af37d48a328dfc31746f3fa84973e2f840ab)]
@@ -4138,10 +4204,13 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
4138
4204
  - Refs #260715 rast-block wip [Tripon Eugen - [`f19d54e`](https://github.com/eea/volto-cca-policy/commit/f19d54e0b9a6a86bf344eb85b6a1cda7f3de91bf)]
4139
4205
  - Refs #260715 rast-block wip [Tripon Eugen - [`2828537`](https://github.com/eea/volto-cca-policy/commit/2828537b6c084cd1a82162d552fb4ef025b71f9f)]
4140
4206
  - Refs #260715 rast-block updates [Tripon Eugen - [`1e803e5`](https://github.com/eea/volto-cca-policy/commit/1e803e5bd3d3fb7558f261c76c68866be7beb8b5)]
4207
+ - test: [JENKINS] Use java17 for sonarqube scanner [valentinab25 - [`0a15e1b`](https://github.com/eea/volto-cca-policy/commit/0a15e1b2ad081233685e80d5b3c60a8663f6b896)]
4208
+ - test: [JENKINS] Run cypress in started frontend container [valentinab25 - [`9554e44`](https://github.com/eea/volto-cca-policy/commit/9554e44c92a621a52b2adb5a4830fb084ee5734b)]
4141
4209
  ### [0.1.49](https://github.com/eea/volto-cca-policy/compare/0.1.48...0.1.49) - 15 November 2023
4142
4210
 
4143
4211
  #### :house: Internal changes
4144
4212
 
4213
+ - chore: [JENKINS] Refactor automated testing [valentinab25 - [`7b820a6`](https://github.com/eea/volto-cca-policy/commit/7b820a6369c2ddd5203b1a4abe352cb4bb43db7a)]
4145
4214
  - chore: husky, lint-staged use fixed versions [valentinab25 - [`f0a8061`](https://github.com/eea/volto-cca-policy/commit/f0a8061c275c236deb00087c23fac9860a073106)]
4146
4215
 
4147
4216
  #### :hammer_and_wrench: Others
@@ -4158,6 +4227,9 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
4158
4227
  - Refs #259267 - jenkins test [Tripon Eugen - [`cacd31e`](https://github.com/eea/volto-cca-policy/commit/cacd31e7b1afe0983674ed5c7632d2e1d7fa752e)]
4159
4228
  - Refs #259267 - jenkins [Tripon Eugen - [`5b3affe`](https://github.com/eea/volto-cca-policy/commit/5b3affee8401239de10097884c1b7f2349d15ec0)]
4160
4229
  - Refs #259267 - add When, lead image and title to files [Tripon Eugen - [`2cedb23`](https://github.com/eea/volto-cca-policy/commit/2cedb237f898af9057e13fba94b615ef71077204)]
4230
+ - test: [JENKINS] Add cpu limit on cypress docker [valentinab25 - [`4d607a5`](https://github.com/eea/volto-cca-policy/commit/4d607a576e9d0a5c34e48c41b409e7df616ee3d6)]
4231
+ - test: [JENKINS] Increase shm-size to cypress docker [valentinab25 - [`b7f74d5`](https://github.com/eea/volto-cca-policy/commit/b7f74d53513a6edbfbca5cb6d19687929bb1e5db)]
4232
+ - test: [JENKINS] Improve cypress time [valentinab25 - [`db65617`](https://github.com/eea/volto-cca-policy/commit/db656173391f65157098d95d388c25f6429753d8)]
4161
4233
  - Refs #259267 - cca event blocks attachments and check not mandatoty fields [Tripon Eugen - [`3138e5a`](https://github.com/eea/volto-cca-policy/commit/3138e5afb5bfbdbed14e27ed457b16867b7fa414)]
4162
4234
  - 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)]
4163
4235
  - Refs #161485 - Fix ECDE name conflict. [GhitaB - [`8bfd99f`](https://github.com/eea/volto-cca-policy/commit/8bfd99ff68bb82a04d1c0ed625fa514fcf46289e)]
@@ -4374,6 +4446,7 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
4374
4446
 
4375
4447
  #### :house: Internal changes
4376
4448
 
4449
+ - chore: [JENKINS] Remove alpha testing version [valentinab25 - [`ad1ced0`](https://github.com/eea/volto-cca-policy/commit/ad1ced0971ba116c13a3b5fcc039172cc915c919)]
4377
4450
 
4378
4451
  #### :hammer_and_wrench: Others
4379
4452
 
@@ -4854,6 +4927,7 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
4854
4927
  #### :hammer_and_wrench: Others
4855
4928
 
4856
4929
  - Refs #158294 - Update supported languages list. [GhitaB - [`0a4f91f`](https://github.com/eea/volto-cca-policy/commit/0a4f91f39b7edc367bd4c127d6a8f273c7788361)]
4930
+ - Add Sonarqube tag using cca-frontend addons list [EEA Jenkins - [`8f1f9ce`](https://github.com/eea/volto-cca-policy/commit/8f1f9ce6c22805670cc0800d3c779b6d619d0f31)]
4857
4931
  ### [0.1.1](https://github.com/eea/volto-cca-policy/compare/0.1.0...0.1.1) - 13 December 2022
4858
4932
 
4859
4933
  #### :hammer_and_wrench: Others
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eeacms/volto-cca-policy",
3
- "version": "1.0.10",
3
+ "version": "1.0.12",
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",
@@ -8,6 +8,8 @@ import URLManager from '@elastic/search-ui/lib/cjs/URLManager';
8
8
  import { useSearchContext } from '@eeacms/search/lib/hocs';
9
9
  import guideSteps from '../../../search/navigator_guide/guideSteps';
10
10
  import { navigatorGuideStepAtom } from '../../../state';
11
+ import { mergeGuideOptions } from './utils';
12
+ import useGuideFacetOptions from './useGuideFacetOptions';
11
13
 
12
14
  const messages = defineMessages({
13
15
  noSteps: {
@@ -111,6 +113,7 @@ const NavigatorGuideContentView = ({ appConfig }) => {
111
113
  totalResults,
112
114
  } = searchContext;
113
115
  const steps = guideSteps;
116
+ const allFacetOptions = useGuideFacetOptions(appConfig, steps);
114
117
  const [storedActiveStep, setActiveStep] = useAtom(navigatorGuideStepAtom);
115
118
  const activeStep =
116
119
  Number.isInteger(storedActiveStep) &&
@@ -122,11 +125,16 @@ const NavigatorGuideContentView = ({ appConfig }) => {
122
125
  const selectedValues =
123
126
  (filters || []).find((filter) => filter.field === step?.field)?.values ||
124
127
  [];
125
- const options = getFacetOptions(facets, step?.field);
126
- const isLastStep = activeStep === steps.length - 1;
127
128
  const hasSelections = steps.some(({ field }) =>
128
129
  isStepSelected(filters, field),
129
130
  );
131
+ const options = mergeGuideOptions(
132
+ allFacetOptions?.[step?.field],
133
+ getFacetOptions(facets, step?.field),
134
+ selectedValues,
135
+ hasSelections,
136
+ );
137
+ const isLastStep = activeStep === steps.length - 1;
130
138
  const selectedStepLabels = steps
131
139
  .filter(({ field }) => isStepSelected(filters, field))
132
140
  .map(({ label }) =>
@@ -262,10 +270,12 @@ const NavigatorGuideContentView = ({ appConfig }) => {
262
270
  key={option.value}
263
271
  className={`navigator-guide-option${
264
272
  selectedValues.includes(option.value) ? ' selected' : ''
265
- }`}
273
+ }${option.disabled ? ' disabled' : ''}`}
274
+ aria-disabled={option.disabled || undefined}
266
275
  >
267
276
  <Checkbox
268
277
  checked={selectedValues.includes(option.value)}
278
+ disabled={option.disabled}
269
279
  onChange={() => toggleValue(option.value)}
270
280
  />
271
281
  <span>{option.value}</span>
@@ -0,0 +1,27 @@
1
+ import React from 'react';
2
+ import { getFacetOptions } from '@eeacms/search/components/SearchApp/useFacetsWithAllOptions';
3
+
4
+ const useGuideFacetOptions = (appConfig, steps) => {
5
+ const [allFacetOptions, setAllFacetOptions] = React.useState({});
6
+
7
+ React.useEffect(() => {
8
+ let isCurrent = true;
9
+ const stepFields = steps.map(({ field }) => field);
10
+
11
+ getFacetOptions(appConfig, stepFields)
12
+ .then((facetOptions) => {
13
+ if (isCurrent) setAllFacetOptions(facetOptions);
14
+ })
15
+ .catch(() => {
16
+ // Live facet options remain available if the supplementary request fails.
17
+ });
18
+
19
+ return () => {
20
+ isCurrent = false;
21
+ };
22
+ }, [appConfig, steps]);
23
+
24
+ return allFacetOptions;
25
+ };
26
+
27
+ export default useGuideFacetOptions;
@@ -0,0 +1,58 @@
1
+ import { act, renderHook } from '@testing-library/react-hooks';
2
+ import { getFacetOptions } from '@eeacms/search/components/SearchApp/useFacetsWithAllOptions';
3
+ import useGuideFacetOptions from './useGuideFacetOptions';
4
+
5
+ jest.mock(
6
+ '@eeacms/search/components/SearchApp/useFacetsWithAllOptions',
7
+ () => ({ getFacetOptions: jest.fn() }),
8
+ );
9
+
10
+ const flushPromises = () => act(() => Promise.resolve());
11
+
12
+ describe('useGuideFacetOptions', () => {
13
+ const appConfig = { facets: [] };
14
+ const steps = [{ field: 'sector' }, { field: 'stage' }];
15
+
16
+ beforeEach(() => {
17
+ getFacetOptions.mockReset();
18
+ });
19
+
20
+ it('loads the complete option list for every guide field', async () => {
21
+ const facetOptions = { sector: ['Energy'], stage: ['Step 1'] };
22
+ getFacetOptions.mockResolvedValue(facetOptions);
23
+
24
+ const { result } = renderHook(() => useGuideFacetOptions(appConfig, steps));
25
+ await flushPromises();
26
+
27
+ expect(getFacetOptions).toHaveBeenCalledWith(appConfig, [
28
+ 'sector',
29
+ 'stage',
30
+ ]);
31
+ expect(result.current).toEqual(facetOptions);
32
+ });
33
+
34
+ it('keeps the fallback state when loading fails', async () => {
35
+ getFacetOptions.mockRejectedValue(new Error('Search unavailable'));
36
+
37
+ const { result } = renderHook(() => useGuideFacetOptions(appConfig, steps));
38
+ await flushPromises();
39
+
40
+ expect(result.current).toEqual({});
41
+ });
42
+
43
+ it('does not update state after unmounting', async () => {
44
+ let resolveRequest;
45
+ getFacetOptions.mockReturnValue(
46
+ new Promise((resolve) => {
47
+ resolveRequest = resolve;
48
+ }),
49
+ );
50
+
51
+ const { unmount } = renderHook(() =>
52
+ useGuideFacetOptions(appConfig, steps),
53
+ );
54
+ unmount();
55
+ resolveRequest({ sector: ['Energy'] });
56
+ await flushPromises();
57
+ });
58
+ });
@@ -0,0 +1,30 @@
1
+ export const mergeGuideOptions = (
2
+ availableValues = [],
3
+ facetOptions = [],
4
+ selectedValues = [],
5
+ hasGuideSelections = false,
6
+ ) => {
7
+ const optionsByValue = new Map(
8
+ facetOptions.map(({ value, count }) => [value, { value, count }]),
9
+ );
10
+
11
+ availableValues.forEach((value) => {
12
+ if (!optionsByValue.has(value)) {
13
+ optionsByValue.set(value, { value, count: 0 });
14
+ }
15
+ });
16
+
17
+ selectedValues.forEach((value) => {
18
+ if (!optionsByValue.has(value)) {
19
+ optionsByValue.set(value, { value, count: 0 });
20
+ }
21
+ });
22
+
23
+ return Array.from(optionsByValue.values()).map((option) => ({
24
+ ...option,
25
+ disabled:
26
+ hasGuideSelections &&
27
+ option.count === 0 &&
28
+ !selectedValues.includes(option.value),
29
+ }));
30
+ };
@@ -0,0 +1,40 @@
1
+ import { mergeGuideOptions } from './utils';
2
+
3
+ describe('Navigator Guide utilities', () => {
4
+ it('keeps unavailable values and marks them as disabled', () => {
5
+ expect(
6
+ mergeGuideOptions(
7
+ ['Step 1', 'Step 2', 'Step 6'],
8
+ [
9
+ { value: 'Step 1', count: 4 },
10
+ { value: 'Step 2', count: 2 },
11
+ ],
12
+ [],
13
+ true,
14
+ ),
15
+ ).toEqual([
16
+ { value: 'Step 1', count: 4, disabled: false },
17
+ { value: 'Step 2', count: 2, disabled: false },
18
+ { value: 'Step 6', count: 0, disabled: true },
19
+ ]);
20
+ });
21
+
22
+ it('keeps a selected zero-count value enabled so it can be removed', () => {
23
+ expect(mergeGuideOptions([], [], ['Step 6'], true)).toEqual([
24
+ { value: 'Step 6', count: 0, disabled: false },
25
+ ]);
26
+ });
27
+
28
+ it('keeps every value enabled before the guide has been refined', () => {
29
+ expect(mergeGuideOptions(['Step 1', 'Step 6'], [], [])).toEqual([
30
+ { value: 'Step 1', count: 0, disabled: false },
31
+ { value: 'Step 6', count: 0, disabled: false },
32
+ ]);
33
+ });
34
+
35
+ it('falls back to live facet options while the full list is loading', () => {
36
+ expect(mergeGuideOptions([], [{ value: 'Energy', count: 3 }], [])).toEqual([
37
+ { value: 'Energy', count: 3, disabled: false },
38
+ ]);
39
+ });
40
+ });
package/src/constants.js CHANGED
@@ -55,6 +55,10 @@ export const DOWNLOAD_FIELDS = [
55
55
  { field: 'cca_sub_nationals', name: 'Sub national regions' },
56
56
  { field: 'cca_city', name: 'City' },
57
57
  { field: 'cca_adaptation_elements', name: 'Adaptation Approaches' },
58
+ {
59
+ field: 'cca_adaptation_options',
60
+ name: 'Adaptation options used in this case',
61
+ },
58
62
  { field: 'cca_funding_programme', name: 'Funding programme' },
59
63
  { field: 'cca_key_type_measure', name: 'Key type measure' },
60
64
  { field: 'cca_geographic_countries', name: 'Countries' },
@@ -0,0 +1,127 @@
1
+ import { flattenToAppURL } from '@plone/volto/helpers/Url/Url';
2
+ import {
3
+ blockAvailableInMission,
4
+ extractPlanNameAndURL,
5
+ filterBlocks,
6
+ formatTextToHTML,
7
+ getBaseUrl,
8
+ getFilteredBlocks,
9
+ hasTypeOfBlock,
10
+ isEmpty,
11
+ normalizeImageFileName,
12
+ } from './utils';
13
+
14
+ jest.mock('@plone/volto/helpers/Url/Url', () => ({
15
+ flattenToAppURL: jest.fn((url) => url.replace('https://example.com', '')),
16
+ }));
17
+
18
+ describe('general utilities', () => {
19
+ it('checks whether blocks are available inside and outside Mission', () => {
20
+ expect(blockAvailableInMission({}, { id: 'text' })).toBe(false);
21
+ expect(
22
+ blockAvailableInMission(
23
+ { '@id': 'https://example.com/en/mission/page' },
24
+ { id: 'mkh_map' },
25
+ ),
26
+ ).toBe(false);
27
+ expect(
28
+ blockAvailableInMission(
29
+ { '@id': 'https://example.com/en/mission/page' },
30
+ { id: 'text' },
31
+ ),
32
+ ).toBe(true);
33
+ expect(
34
+ blockAvailableInMission(
35
+ { '@id': 'https://example.com/en/page' },
36
+ { id: 'rastBlock' },
37
+ ),
38
+ ).toBe(true);
39
+ });
40
+
41
+ it('resolves a block base URL from the supported properties', () => {
42
+ expect(
43
+ getBaseUrl({ data: { href: [{ '@id': 'https://example.com/page' }] } }),
44
+ ).toBe('/page');
45
+ expect(getBaseUrl({ path: '/from-path' })).toBe('/from-path');
46
+ expect(getBaseUrl({ location: { pathname: '/from-location' } })).toBe(
47
+ '/from-location',
48
+ );
49
+ expect(getBaseUrl({})).toBe('');
50
+ expect(flattenToAppURL).toHaveBeenCalledTimes(3);
51
+ });
52
+
53
+ it('finds nested block types and removes selected block types', () => {
54
+ expect(
55
+ hasTypeOfBlock({ blocks: { child: { '@type': 'listing' } } }, 'listing'),
56
+ ).toBe(true);
57
+ expect(hasTypeOfBlock({ child: null }, 'listing')).toBe(false);
58
+
59
+ expect(
60
+ filterBlocks(
61
+ {
62
+ blocks: {
63
+ one: { '@type': 'text' },
64
+ two: { '@type': 'listing' },
65
+ },
66
+ blocks_layout: { items: ['one', 'two'] },
67
+ },
68
+ ['listing'],
69
+ ),
70
+ ).toEqual({
71
+ blocks: { one: { '@type': 'text' } },
72
+ blocks_layout: { items: ['one'] },
73
+ hasBlockTypes: true,
74
+ });
75
+ });
76
+
77
+ it('formats escaped text, paragraphs, bullets, and links as HTML', () => {
78
+ expect(formatTextToHTML()).toBe('');
79
+ expect(formatTextToHTML('Simple text')).toBe('<p>Simple text</p>');
80
+ expect(formatTextToHTML('First\\n\\nSecond')).toBe('First</p><p>Second');
81
+ expect(formatTextToHTML('Item\\no next')).toBe('<p>Item<br />• next</p>');
82
+ expect(formatTextToHTML('See https://example.com')).toContain(
83
+ '<a href="https://example.com"',
84
+ );
85
+ });
86
+
87
+ it('keeps only parent blocks without the excluded nested type', () => {
88
+ const result = getFilteredBlocks(
89
+ {
90
+ blocks: {
91
+ keep: { '@type': 'group', blocks: { child: { '@type': 'text' } } },
92
+ exclude: {
93
+ '@type': 'group',
94
+ data: { blocks: { child: { '@type': 'map' } } },
95
+ },
96
+ other: { '@type': 'text' },
97
+ },
98
+ blocks_layout: { items: ['keep', 'exclude', 'other'] },
99
+ },
100
+ 'group',
101
+ 'map',
102
+ );
103
+
104
+ expect(result.keptKeys).toEqual(['keep']);
105
+ expect(result.blocks_layout.items).toEqual(['keep']);
106
+ expect(result.hasMatches).toBe(true);
107
+ });
108
+
109
+ it('extracts plan links and normalizes common values', () => {
110
+ expect(extractPlanNameAndURL()).toEqual({ name: '', url: '' });
111
+ expect(
112
+ extractPlanNameAndURL('Adaptation plan (https://example.com/plan)'),
113
+ ).toEqual({ name: 'Adaptation plan', url: 'https://example.com/plan' });
114
+ expect(
115
+ extractPlanNameAndURL(
116
+ 'Plan https://example.com/source https://example.com/document',
117
+ ),
118
+ ).toEqual({ name: 'Plan', url: 'https://example.com/document' });
119
+
120
+ expect(isEmpty()).toBe(true);
121
+ expect(isEmpty([])).toBe(true);
122
+ expect(isEmpty(['value'])).toBe(false);
123
+ expect(normalizeImageFileName()).toBe('');
124
+ expect(normalizeImageFileName('map(final).png')).toBe('map-final.png');
125
+ expect(normalizeImageFileName('map(final)')).toBe('map-final-');
126
+ });
127
+ });
@@ -1004,6 +1004,12 @@ body.searchlib-page .searchapp-navigatorCatalogueSearch {
1004
1004
  background: fade(@primaryColor, 5%);
1005
1005
  }
1006
1006
 
1007
+ &.disabled {
1008
+ background: #f5f5f5;
1009
+ color: @navigatorInactiveColor;
1010
+ opacity: 0.65;
1011
+ }
1012
+
1007
1013
  > span {
1008
1014
  flex: 1;
1009
1015
  }