@eeacms/volto-cca-policy 0.3.131 → 1.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.
Files changed (181) hide show
  1. package/.eslintrc.js +7 -7
  2. package/CHANGELOG.md +9 -14
  3. package/docker-compose.yml +16 -16
  4. package/jest-addon.config.js +25 -420
  5. package/package.json +1 -1
  6. package/src/components/MigrationButtons.jsx +5 -1
  7. package/src/components/manage/Blocks/ASTNavigation/ASTNavigationEdit.jsx +2 -1
  8. package/src/components/manage/Blocks/ASTNavigation/ASTNavigationView.jsx +10 -4
  9. package/src/components/manage/Blocks/ASTNavigation/ASTNavigationView.test.jsx +87 -35
  10. package/src/components/manage/Blocks/C3SIndicatorsGlossaryBlock/C3SIndicatorsGlossaryBlockEdit.jsx +1 -1
  11. package/src/components/manage/Blocks/C3SIndicatorsGlossaryBlock/C3SIndicatorsGlossaryBlockView.test.jsx +1 -1
  12. package/src/components/manage/Blocks/C3SIndicatorsListingBlock/C3SIndicatorsListingBlockEdit.jsx +1 -1
  13. package/src/components/manage/Blocks/C3SIndicatorsListingBlock/C3SIndicatorsListingBlockView.jsx +1 -1
  14. package/src/components/manage/Blocks/C3SIndicatorsListingBlock/C3SIndicatorsListingBlockView.test.jsx +1 -1
  15. package/src/components/manage/Blocks/C3SIndicatorsOverviewBlock/C3SIndicatorsOverviewBlockEdit.jsx +1 -1
  16. package/src/components/manage/Blocks/C3SIndicatorsOverviewBlock/schema.js +0 -20
  17. package/src/components/manage/Blocks/CaseStudyExplorer/CaseStudyExplorerEdit.test.jsx +1 -1
  18. package/src/components/manage/Blocks/CaseStudyExplorer/{CaseStudyExplorerView.js → CaseStudyExplorerView.jsx} +1 -1
  19. package/src/components/manage/Blocks/CaseStudyExplorer/CaseStudyExplorerView.test.jsx +2 -2
  20. package/src/components/manage/Blocks/CaseStudyExplorer/CaseStudyFilters.test.jsx +1 -1
  21. package/src/components/manage/Blocks/CaseStudyExplorer/CaseStudyMap.test.jsx +1 -1
  22. package/src/components/manage/Blocks/CaseStudyExplorer/FeatureDisplay.jsx +2 -1
  23. package/src/components/manage/Blocks/CaseStudyExplorer/FeatureDisplay.test.jsx +1 -1
  24. package/src/components/manage/Blocks/CaseStudyExplorer/styles.less +0 -4
  25. package/src/components/manage/Blocks/CaseStudyExplorer/utils.js +0 -30
  26. package/src/components/manage/Blocks/CollectionStatistics/CollectionStatsEdit.jsx +1 -1
  27. package/src/components/manage/Blocks/CollectionStatistics/CollectionStatsView.jsx +3 -2
  28. package/src/components/manage/Blocks/CollectionStatistics/CollectionStatsView.test.jsx +1 -1
  29. package/src/components/manage/Blocks/ContentLinks/ContentLinksEdit.jsx +1 -1
  30. package/src/components/manage/Blocks/ContentLinks/ContentLinksView.jsx +1 -1
  31. package/src/components/manage/Blocks/ContentLinks/ContentLinksView.test.jsx +1 -1
  32. package/src/components/manage/Blocks/ContentLinks/DropdownListView.jsx +1 -1
  33. package/src/components/manage/Blocks/ContentLinks/DropdownListView.test.jsx +1 -1
  34. package/src/components/manage/Blocks/CountryMapHeatIndex/Filter.test.jsx +1 -1
  35. package/src/components/manage/Blocks/CountryMapHeatIndex/{View.js → View.jsx} +14 -10
  36. package/src/components/manage/Blocks/CountryMapHeatIndex/mapstyle.js +1 -3
  37. package/src/components/manage/Blocks/CountryMapObservatory/CountryMapObservatoryEdit.jsx +2 -1
  38. package/src/components/manage/Blocks/CountryMapObservatory/CountryMapObservatoryOLView.jsx +4 -3
  39. package/src/components/manage/Blocks/CountryMapProfile/Filter.test.jsx +1 -1
  40. package/src/components/manage/Blocks/CountryMapProfile/OLView.jsx +5 -12
  41. package/src/components/manage/Blocks/CountryProfileDetail/{CountryTabPane.js → CountryTabPane.jsx} +11 -4
  42. package/src/components/manage/Blocks/CountryProfileDetail/CountryTabPane.test.jsx +1 -1
  43. package/src/components/manage/Blocks/CountryProfileDetail/{View.js → View.jsx} +20 -15
  44. package/src/components/manage/Blocks/CountryProfileDetail/View.test.jsx +134 -20
  45. package/src/components/manage/Blocks/CountryProfileDetail/index.js +0 -1
  46. package/src/components/manage/Blocks/DataConnectedEmbedBlock/index.js +0 -2
  47. package/src/components/manage/Blocks/ECDEIndicators/ECDEIndicatorsView.jsx +1 -1
  48. package/src/components/manage/Blocks/FilterAceContent/FilterAceContentEdit.jsx +3 -3
  49. package/src/components/manage/Blocks/FilterAceContent/FilterAceContentView.jsx +2 -2
  50. package/src/components/manage/Blocks/FilterAceContent/FilterAceContentView.test.jsx +1 -1
  51. package/src/components/manage/Blocks/FlourishEmbedBlock/FlourishEmbedBlockEdit.jsx +1 -1
  52. package/src/components/manage/Blocks/Listing/DropdownListingView.jsx +1 -1
  53. package/src/components/manage/Blocks/Listing/EventAccordionListingView.jsx +1 -1
  54. package/src/components/manage/Blocks/Listing/EventAccordionListingView.test.jsx +5 -3
  55. package/src/components/manage/Blocks/Listing/EventCardsListingView.jsx +2 -1
  56. package/src/components/manage/Blocks/Listing/EventCardsListingView.test.jsx +10 -4
  57. package/src/components/manage/Blocks/Listing/IndicatorCardsListingView.jsx +2 -2
  58. package/src/components/manage/Blocks/Listing/OrganisationCardsListingView.jsx +3 -1
  59. package/src/components/manage/Blocks/Listing/SimpleCardsListingView.jsx +1 -1
  60. package/src/components/manage/Blocks/Listing/SimpleCardsListingView.test.jsx +5 -3
  61. package/src/components/manage/Blocks/Listing/SimpleItemListingView.jsx +2 -2
  62. package/src/components/manage/Blocks/Listing/SimpleItemListingView.test.jsx +6 -4
  63. package/src/components/manage/Blocks/RASTBlock/ContextNavigation.jsx +0 -1
  64. package/src/components/manage/Blocks/RASTBlock/RASTAccordion.jsx +1 -1
  65. package/src/components/manage/Blocks/RASTBlock/RASTAccordion.test.jsx +1 -1
  66. package/src/components/manage/Blocks/RASTBlock/RASTAccordionContent.jsx +2 -2
  67. package/src/components/manage/Blocks/RASTBlock/RASTEdit.jsx +1 -1
  68. package/src/components/manage/Blocks/RASTBlock/RASTMap.jsx +1 -1
  69. package/src/components/manage/Blocks/RASTBlock/RASTMap.test.jsx +1 -1
  70. package/src/components/manage/Blocks/RASTBlock/RASTView.jsx +1 -1
  71. package/src/components/manage/Blocks/ReadMore/ReadMoreEdit.jsx +1 -1
  72. package/src/components/manage/Blocks/ReadMore/ReadMoreView.jsx +1 -1
  73. package/src/components/manage/Blocks/ReadMore/ReadMoreView.test.jsx +1 -1
  74. package/src/components/manage/Blocks/RedirectBlock/{RedirectBlock.test.js → RedirectBlock.test.jsx} +1 -1
  75. package/src/components/manage/Blocks/RedirectBlock/RedirectBlockEdit.jsx +2 -1
  76. package/src/components/manage/Blocks/RedirectBlock/RedirectBlockView.jsx +2 -2
  77. package/src/components/manage/Blocks/RelevantAceContent/RelevantAceContentEdit.jsx +1 -1
  78. package/src/components/manage/Blocks/RelevantAceContent/RelevantAceContentView.jsx +1 -1
  79. package/src/components/manage/Blocks/RelevantAceContent/RelevantAceContentView.test.jsx +1 -1
  80. package/src/components/manage/Blocks/SearchAceContent/SearchAceContentEdit.jsx +1 -1
  81. package/src/components/manage/Blocks/SearchAceContent/SearchAceContentView.jsx +1 -1
  82. package/src/components/manage/Blocks/SearchAceContent/SearchAceContentView.test.jsx +1 -1
  83. package/src/components/manage/Blocks/TabsBlock/Spotlight.jsx +2 -2
  84. package/src/components/manage/Blocks/TabsBlock/Spotlight.test.jsx +7 -1
  85. package/src/components/manage/Blocks/TransRegionSelect/TransRegionSelectEdit.jsx +1 -1
  86. package/src/components/manage/Blocks/TransRegionSelect/TransRegionSelectView.jsx +1 -1
  87. package/src/components/manage/Blocks/TransRegionSelect/TransRegionSelectView.test.jsx +1 -1
  88. package/src/components/manage/CreateArchivedCopyButton/CreateArchivedCopyButton.jsx +5 -2
  89. package/src/components/manage/CreateArchivedCopyButton/CreateArchivedCopyButton.test.jsx +3 -6
  90. package/src/components/manage/Workflow/WorkflowLinkIntegrityModal.jsx +1 -1
  91. package/src/components/manage/Workflow/WorkflowLinkIntegrityModal.test.jsx +1 -1
  92. package/src/components/theme/ASTNavigation/ASTAccordion.test.jsx +1 -1
  93. package/src/components/theme/ASTNavigation/ASTLogoMap.jsx +1 -1
  94. package/src/components/theme/ASTNavigation/ASTLogoMap.test.jsx +1 -1
  95. package/src/components/theme/ASTNavigation/ASTNavigation.jsx +9 -5
  96. package/src/components/theme/ASTNavigation/ASTNavigation.test.jsx +323 -0
  97. package/src/components/theme/ASTNavigation/{utils.js → LinkWrap.jsx} +4 -9
  98. package/src/components/theme/ASTNavigation/UASTLogoMap.jsx +1 -1
  99. package/src/components/theme/ASTNavigation/UASTLogoMap.test.jsx +1 -1
  100. package/src/components/theme/Header/Header.jsx +5 -5
  101. package/src/components/theme/Header/LanguageSwitch.jsx +5 -5
  102. package/src/components/theme/MissionSignatoryProfile/MissionSignatoryProfileView.jsx +1 -1
  103. package/src/components/theme/TranslationDisclaimer/TranslationDisclaimer.jsx +1 -1
  104. package/src/components/theme/TranslationDisclaimer/TranslationInfo.jsx +1 -1
  105. package/src/components/theme/Views/AdaptationOptionView.jsx +1 -1
  106. package/src/components/theme/Views/AdaptationOptionView.test.jsx +5 -3
  107. package/src/components/theme/Views/ArchivedVersionListing.jsx +1 -1
  108. package/src/components/theme/Views/ArchivedVersionListing.test.jsx +2 -2
  109. package/src/components/theme/Views/ArchivedVersionNotice.jsx +1 -1
  110. package/src/components/theme/Views/ArchivedVersionNotice.test.jsx +1 -1
  111. package/src/components/theme/Views/BrokenLinks.jsx +1 -1
  112. package/src/components/theme/Views/BrokenLinks.test.jsx +1 -1
  113. package/src/components/theme/Views/CaseStudyView.test.jsx +1 -1
  114. package/src/components/theme/Views/DatabaseItemView.test.jsx +1 -1
  115. package/src/components/theme/Views/NewsItemView.jsx +1 -1
  116. package/src/components/theme/Views/ProjectView.test.jsx +1 -1
  117. package/src/components/theme/Views/VersionsGroup.jsx +1 -1
  118. package/src/components/theme/Views/VersionsGroup.test.jsx +1 -1
  119. package/src/components/theme/Widgets/GeocharsWidget.jsx +1 -1
  120. package/src/components/theme/Widgets/GeolocationWidget.jsx +1 -1
  121. package/src/components/theme/Widgets/GeolocationWidget.test.jsx +1 -1
  122. package/src/components/theme/Widgets/ImageWidget.jsx +7 -8
  123. package/src/components/theme/Widgets/ImageWidget.test.jsx +1 -1
  124. package/src/components/theme/Widgets/PromotionalImageWidget.jsx +6 -4
  125. package/src/components/theme/Widgets/utils.js +1 -1
  126. package/src/constants.js +538 -2
  127. package/src/customizations/@eeacms/volto-eea-design-system/ui/Header/Header.jsx +1 -1
  128. package/src/customizations/@eeacms/volto-eea-design-system/ui/Header/HeaderMenuPopUp.js +52 -24
  129. package/src/customizations/@eeacms/volto-eea-design-system/ui/Header/HeaderSearchPopUp.js +1 -0
  130. package/src/customizations/@eeacms/volto-eea-website-theme/components/theme/DraftBackground/DraftBackground.jsx +2 -1
  131. package/src/customizations/@eeacms/volto-listing-block/blocks/Listing/item-templates/SimpleItemTemplates.jsx +2 -2
  132. package/src/customizations/@eeacms/volto-listing-block/components/UniversalCard/fragments/CardTitle.jsx +1 -1
  133. package/src/customizations/@plone/volto-slate/blocks/Table/TableBlockView.jsx +3 -3
  134. package/src/customizations/@plone/volto-slate/blocks/Text/{index.js → index.jsx} +2 -21
  135. package/src/customizations/@plone/volto-slate/editor/extensions/normalizeNode.js +1 -1
  136. package/src/customizations/@plone/volto-slate/utils/blocks.js +11 -8
  137. package/src/customizations/@plone/volto-slate/utils/volto-blocks.js +2 -2
  138. package/src/customizations/@plone/volto-slate/widgets/HtmlSlateWidget.jsx +2 -2
  139. package/src/customizations/@plone-collective/volto-authomatic/components/Login/Login.jsx +7 -4
  140. package/src/customizations/@plone-collective/volto-rss-provider/components/RSSFeedView.jsx +5 -8
  141. package/src/customizations/@plone-collective/volto-rss-provider/express-middleware.js +2 -1
  142. package/src/customizations/volto/components/manage/AnchorPlugin/components/LinkButton/AddLinkForm.jsx +3 -3
  143. package/src/customizations/volto/components/manage/Blocks/Grid/templates.js +1 -1
  144. package/src/customizations/volto/components/manage/Contents/ContentsBreadcrumbs.jsx +1 -1
  145. package/src/customizations/volto/components/manage/Controlpanels/ContentTypeLayout.jsx +12 -14
  146. package/src/customizations/volto/components/manage/Display/Display.jsx +10 -5
  147. package/src/customizations/volto/components/manage/Multilingual/TranslationObject.jsx +7 -6
  148. package/src/customizations/volto/components/manage/Widgets/ObjectBrowserWidget.jsx +4 -1
  149. package/src/customizations/volto/components/manage/Workflow/Workflow.jsx +12 -8
  150. package/src/customizations/volto/components/theme/App/App.jsx +16 -23
  151. package/src/customizations/volto/components/theme/Sitemap/Sitemap.jsx +3 -2
  152. package/src/customizations/volto/components/theme/View/DefaultView.jsx +5 -4
  153. package/src/customizations/volto/components/theme/View/LinkView.jsx +2 -2
  154. package/src/customizations/volto/components/theme/View/View.jsx +10 -11
  155. package/src/customizations/volto/helpers/Url/Url-old.js +2 -1
  156. package/src/customizations/volto/middleware/api.js +6 -4
  157. package/src/customizations/volto/reducers/actions/actions.js +2 -5
  158. package/src/customizations/volto/reducers/breadcrumbs/breadcrumbs.js +3 -6
  159. package/src/customizations/volto/reducers/navigation/navigation.js +3 -6
  160. package/src/customizations/volto/server.jsx +9 -8
  161. package/src/express-middleware.js +1 -1
  162. package/src/helpers/ContentMetadata.jsx +4 -4
  163. package/src/helpers/Utils.jsx +5 -5
  164. package/src/helpers/index.js +1 -8
  165. package/src/hocs/index.js +2 -0
  166. package/src/index.js +9 -7
  167. package/src/search/common.js +4 -41
  168. package/src/search/utils.test.js +1 -1
  169. package/src/search/vocabulary.js +2 -2
  170. package/src/store/reducers/physical-breadcrumbs.js +2 -2
  171. package/src/utils.js +1 -1
  172. package/src/helpers/Constants.jsx +0 -535
  173. package/theme/assets/images/administrative_support_service.png +0 -0
  174. /package/src/components/manage/Blocks/CaseStudyExplorer/{CaseStudyExplorerEdit.js → CaseStudyExplorerEdit.jsx} +0 -0
  175. /package/src/components/manage/Blocks/CountryMapHeatIndex/{Edit.js → Edit.jsx} +0 -0
  176. /package/src/components/manage/Blocks/CountryMapProfile/{Edit.js → Edit.jsx} +0 -0
  177. /package/src/components/manage/Blocks/CountryProfileDetail/{Edit.js → Edit.jsx} +0 -0
  178. /package/src/components/manage/Blocks/ReadMore/{schema.js → schema.jsx} +0 -0
  179. /package/src/helpers/{clientOnly.js → clientOnly.jsx} +0 -0
  180. /package/src/{components/manage/Blocks/withResponsiveContainer.js → hocs/withResponsiveContainer.jsx} +0 -0
  181. /package/src/{components/manage/Blocks → hocs}/withVisibilitySensor.jsx +0 -0
@@ -1,5 +1,9 @@
1
1
  import { Plug } from '@plone/volto/components/manage/Pluggable';
2
- import { getBaseUrl, toPublicURL, addAppURL } from '@plone/volto/helpers';
2
+ import {
3
+ getBaseUrl,
4
+ toPublicURL,
5
+ addAppURL,
6
+ } from '@plone/volto/helpers/Url/Url';
3
7
 
4
8
  const button = (id, title, label, destination) => (
5
9
  <button
@@ -1,6 +1,7 @@
1
1
  import React from 'react';
2
2
 
3
- import { BlockDataForm, SidebarPortal } from '@plone/volto/components';
3
+ import BlockDataForm from '@plone/volto/components/manage/Form/BlockDataForm';
4
+ import SidebarPortal from '@plone/volto/components/manage/Sidebar/SidebarPortal';
4
5
 
5
6
  import ASTNavigationView from './ASTNavigationView';
6
7
  import schema from './schema';
@@ -1,10 +1,16 @@
1
1
  import loadable from '@loadable/component';
2
2
 
3
- const ASTLogoMap = loadable(() =>
4
- import('@eeacms/volto-cca-policy/components/theme/ASTNavigation/ASTLogoMap'),
3
+ const ASTLogoMap = loadable(
4
+ () =>
5
+ import(
6
+ '@eeacms/volto-cca-policy/components/theme/ASTNavigation/ASTLogoMap'
7
+ ),
5
8
  );
6
- const UASTLogoMap = loadable(() =>
7
- import('@eeacms/volto-cca-policy/components/theme/ASTNavigation/UASTLogoMap'),
9
+ const UASTLogoMap = loadable(
10
+ () =>
11
+ import(
12
+ '@eeacms/volto-cca-policy/components/theme/ASTNavigation/UASTLogoMap'
13
+ ),
8
14
  );
9
15
 
10
16
  export default function ASTNavigationView(props) {
@@ -1,48 +1,100 @@
1
1
  import React from 'react';
2
- import '@testing-library/jest-dom/extend-expect';
3
- import { MemoryRouter } from 'react-router-dom';
4
- import configureStore from 'redux-mock-store';
5
- import { render } from '@testing-library/react';
6
- import { Provider } from 'react-intl-redux';
2
+ import '@testing-library/jest-dom';
3
+ import { render, screen } from '@testing-library/react';
7
4
  import ASTNavigationView from './ASTNavigationView';
8
5
 
9
- const mockStore = configureStore();
6
+ jest.mock('@loadable/component', () => {
7
+ let callCount = 0;
10
8
 
11
- describe('ASTLogoMap', () => {
12
- it('should render the component', () => {
9
+ return () => {
10
+ callCount += 1;
11
+ const componentName = callCount === 1 ? 'ASTLogoMap' : 'UASTLogoMap';
12
+
13
+ return ({ items, pathname, href }) => (
14
+ <div
15
+ data-testid={componentName}
16
+ data-items={JSON.stringify(items)}
17
+ data-pathname={pathname}
18
+ data-href={href}
19
+ >
20
+ {componentName}
21
+ </div>
22
+ );
23
+ };
24
+ });
25
+
26
+ describe('ASTNavigationView', () => {
27
+ const makeItems = () =>
28
+ Array.from({ length: 6 }, (_, index) => ({
29
+ href: [`/en/source-${index + 1}`],
30
+ title: `Source ${index + 1}`,
31
+ }));
32
+
33
+ it('renders an incomplete source warning when items length is not 6', () => {
34
+ const data = {
35
+ items: [],
36
+ image_type: 'ast',
37
+ href: ['/en/ast-nav'],
38
+ };
39
+
40
+ const { container } = render(
41
+ <ASTNavigationView path="/en/ast-nav" data={data} />,
42
+ );
43
+
44
+ expect(container).toHaveTextContent('Incomplete number of sources');
45
+ });
46
+
47
+ it('renders ASTLogoMap when image_type is ast and items length is 6', () => {
13
48
  const data = {
14
- items: {
15
- 'step-0': {
16
- '@id': '/en/knowledge/tools/adaptation-support-tool',
17
- title: 'Preparing the ground for adaptation',
18
- items: [
19
- {
20
- '@id': '/en/knowledge/tools/adaptation-support-tool/step-1-1',
21
- title:
22
- '1.1 Obtaining high-level political support for adaptation',
23
- },
24
- ],
25
- },
26
- },
27
- pathname: '/en/knowledge/tools/adaptation-support-tool',
49
+ items: makeItems(),
28
50
  image_type: 'ast',
51
+ href: ['/en/ast-nav'],
29
52
  };
30
53
 
31
- const store = mockStore({
32
- userSession: { token: '1234' },
33
- intl: {
34
- locale: 'en',
35
- messages: {},
36
- },
37
- });
54
+ render(<ASTNavigationView path="/en/ast-nav" data={data} />);
55
+
56
+ const astLogoMap = screen.getByTestId('ASTLogoMap');
57
+ expect(astLogoMap).toBeInTheDocument();
58
+ expect(astLogoMap.dataset.pathname).toBe('/en/ast-nav');
59
+ expect(astLogoMap.dataset.href).toBe('/en/ast-nav');
60
+ expect(astLogoMap.dataset.items).toBe(
61
+ JSON.stringify({
62
+ 'step-1': '/en/source-1',
63
+ 'step-2': '/en/source-2',
64
+ 'step-3': '/en/source-3',
65
+ 'step-4': '/en/source-4',
66
+ 'step-5': '/en/source-5',
67
+ 'step-6': '/en/source-6',
68
+ }),
69
+ );
70
+ });
71
+
72
+ it('renders UASTLogoMap when image_type is uast and items length is 6', () => {
73
+ const data = {
74
+ items: makeItems(),
75
+ image_type: 'uast',
76
+ href: ['/en/ast-nav'],
77
+ };
78
+
79
+ render(<ASTNavigationView path="/en/ast-nav" data={data} />);
80
+
81
+ const uastLogoMap = screen.getByTestId('UASTLogoMap');
82
+ expect(uastLogoMap).toBeInTheDocument();
83
+ expect(uastLogoMap.dataset.pathname).toBe('/en/ast-nav');
84
+ expect(uastLogoMap.dataset.href).toBe('/en/ast-nav');
85
+ });
86
+
87
+ it('renders nothing when image_type is unsupported and items length is 6', () => {
88
+ const data = {
89
+ items: makeItems(),
90
+ image_type: 'unsupported',
91
+ href: ['/en/ast-nav'],
92
+ };
38
93
 
39
94
  const { container } = render(
40
- <Provider store={store}>
41
- <MemoryRouter>
42
- <ASTNavigationView path="/en/ast-nav" data={data} />
43
- </MemoryRouter>
44
- </Provider>,
95
+ <ASTNavigationView path="/en/ast-nav" data={data} />,
45
96
  );
46
- expect(container).toBeTruthy();
97
+
98
+ expect(container).toBeEmptyDOMElement();
47
99
  });
48
100
  });
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
 
3
- import { SidebarPortal } from '@plone/volto/components';
3
+ import SidebarPortal from '@plone/volto/components/manage/Sidebar/SidebarPortal';
4
4
  import BlockDataForm from '@plone/volto/components/manage/Form/BlockDataForm';
5
5
 
6
6
  import C3SIndicatorsGlossaryBlockView from './C3SIndicatorsGlossaryBlockView';
@@ -2,7 +2,7 @@ import React from 'react';
2
2
  import { MemoryRouter } from 'react-router-dom';
3
3
  import configureStore from 'redux-mock-store';
4
4
  import { render } from '@testing-library/react';
5
- import '@testing-library/jest-dom/extend-expect';
5
+ import '@testing-library/jest-dom';
6
6
  import { Provider } from 'react-intl-redux';
7
7
  import C3SIndicatorsGlossaryBlockView from './C3SIndicatorsGlossaryBlockView';
8
8
 
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
 
3
- import { SidebarPortal } from '@plone/volto/components';
3
+ import SidebarPortal from '@plone/volto/components/manage/Sidebar/SidebarPortal';
4
4
  import BlockDataForm from '@plone/volto/components/manage/Form/BlockDataForm';
5
5
 
6
6
  import C3SIndicatorsListingBlockView from './C3SIndicatorsListingBlockView';
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { UniversalLink } from '@plone/volto/components';
2
+ import UniversalLink from '@plone/volto/components/manage/UniversalLink/UniversalLink';
3
3
 
4
4
  export default function C3SIndicatorsListingBlockView(props) {
5
5
  const { metadata, properties, mode = 'view' } = props;
@@ -2,7 +2,7 @@ import React from 'react';
2
2
  import { MemoryRouter } from 'react-router-dom';
3
3
  import configureStore from 'redux-mock-store';
4
4
  import { render } from '@testing-library/react';
5
- import '@testing-library/jest-dom/extend-expect';
5
+ import '@testing-library/jest-dom';
6
6
  import { Provider } from 'react-intl-redux';
7
7
  import C3SIndicatorsListingBlockView from './C3SIndicatorsListingBlockView';
8
8
 
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
 
3
- import { SidebarPortal } from '@plone/volto/components';
3
+ import SidebarPortal from '@plone/volto/components/manage/Sidebar/SidebarPortal';
4
4
  import BlockDataForm from '@plone/volto/components/manage/Form/BlockDataForm';
5
5
 
6
6
  import C3SIndicatorsOverviewBlockView from './C3SIndicatorsOverviewBlockView';
@@ -1,23 +1,3 @@
1
- // const fields = ['category'];
2
- //
3
- // category: {
4
- // title: 'Category',
5
- // type: 'string',
6
- // factory: 'Choice',
7
- // choices: [
8
- // ['health', 'Health'],
9
- // ['agriculture', 'Agriculture'],
10
- // ['forestry', 'Forestry'],
11
- // ['energy', 'Energy'],
12
- // ['tourism', 'Tourism'],
13
- // ['water-and-coastal', 'Water and Coastal'],
14
- // ],
15
- // default: 'health',
16
- // description: 'Choose indicators category to be used as filter.',
17
- // required: true,
18
- // noValueOption: false,
19
- // },
20
-
21
1
  const schema = {
22
2
  title: 'C3S Indicators Overview',
23
3
 
@@ -2,7 +2,7 @@ import React from 'react';
2
2
  import { MemoryRouter } from 'react-router-dom';
3
3
  import configureStore from 'redux-mock-store';
4
4
  import { render } from '@testing-library/react';
5
- import '@testing-library/jest-dom/extend-expect';
5
+ import '@testing-library/jest-dom';
6
6
  import { Provider } from 'react-intl-redux';
7
7
  import CaseStudyExplorerEdit from './CaseStudyExplorerEdit';
8
8
  import { useCases } from './hooks';
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
  import { Grid } from 'semantic-ui-react'; // Dropdown,
3
- import { addAppURL } from '@plone/volto/helpers';
3
+ import { addAppURL } from '@plone/volto/helpers/Url/Url';
4
4
 
5
5
  import CaseStudyMap from './CaseStudyMap';
6
6
  import CaseStudyFilters from './CaseStudyFilters';
@@ -2,7 +2,7 @@ import React from 'react';
2
2
  import { MemoryRouter } from 'react-router-dom';
3
3
  import configureStore from 'redux-mock-store';
4
4
  import { render } from '@testing-library/react';
5
- import '@testing-library/jest-dom/extend-expect';
5
+ import '@testing-library/jest-dom';
6
6
  import { Provider } from 'react-intl-redux';
7
7
  import CaseStudyExplorerView from './CaseStudyExplorerView';
8
8
  import { useCases } from './hooks';
@@ -22,7 +22,7 @@ jest.mock('./utils', () => ({
22
22
  getFilters: jest.fn(),
23
23
  }));
24
24
 
25
- jest.mock('@plone/volto/helpers', () => ({
25
+ jest.mock('@plone/volto/helpers/Url/Url', () => ({
26
26
  addAppURL: jest.fn((url) => url),
27
27
  }));
28
28
 
@@ -2,7 +2,7 @@ import React from 'react';
2
2
  import { MemoryRouter } from 'react-router-dom';
3
3
  import configureStore from 'redux-mock-store';
4
4
  import { render } from '@testing-library/react';
5
- import '@testing-library/jest-dom/extend-expect';
5
+ import '@testing-library/jest-dom';
6
6
  import { Provider } from 'react-intl-redux';
7
7
  import CaseStudyFilters from './CaseStudyFilters';
8
8
 
@@ -2,7 +2,7 @@ import React from 'react';
2
2
  import { MemoryRouter } from 'react-router-dom';
3
3
  import configureStore from 'redux-mock-store';
4
4
  import { render } from '@testing-library/react';
5
- import '@testing-library/jest-dom/extend-expect';
5
+ import '@testing-library/jest-dom';
6
6
  import { Provider } from 'react-intl-redux';
7
7
  import CaseStudyMap from './CaseStudyMap';
8
8
  import * as utils from './utils';
@@ -1,6 +1,7 @@
1
1
  import React from 'react';
2
2
  import { FormattedMessage } from 'react-intl';
3
3
  import { Icon } from 'semantic-ui-react';
4
+ import Image from '@plone/volto/components/theme/Image/Image';
4
5
 
5
6
  export default function FeatureDisplay({ feature, onClose }) {
6
7
  return feature ? (
@@ -30,7 +31,7 @@ export default function FeatureDisplay({ feature, onClose }) {
30
31
  {feature.image && (
31
32
  <span className="img">
32
33
  <center>
33
- <img src={feature.image} alt={feature.title} />
34
+ <Image src={feature.image} alt={feature.title} />
34
35
  </center>
35
36
  </span>
36
37
  )}
@@ -2,7 +2,7 @@ import React from 'react';
2
2
  import { MemoryRouter } from 'react-router-dom';
3
3
  import configureStore from 'redux-mock-store';
4
4
  import { render } from '@testing-library/react';
5
- import '@testing-library/jest-dom/extend-expect';
5
+ import '@testing-library/jest-dom';
6
6
  import { Provider } from 'react-intl-redux';
7
7
  import FeatureDisplay from './FeatureDisplay';
8
8
 
@@ -100,10 +100,6 @@
100
100
  margin-right: 5px;
101
101
  background-color: #005c96 !important;
102
102
  background-color: #bbb;
103
-
104
- // &.light-blue {
105
- // background-color: #00ffff !important;
106
- // }
107
103
  }
108
104
  }
109
105
  }
@@ -23,7 +23,6 @@ export function getFeatures(cases, ol) {
23
23
  },
24
24
  false,
25
25
  );
26
- //return new Feature({ labelPoint: point, index: index });
27
26
  return point;
28
27
  });
29
28
  }
@@ -45,35 +44,16 @@ export function filterCases(cases, activeFilters) {
45
44
  impacts: false,
46
45
  };
47
46
 
48
- // activeFilters.sectors.forEach((filter) => {
49
- // if (_case.properties.sectors.includes(',' + filter + ','))
50
- // flag.sectors = true;
51
- // });
52
47
  flag.sectors = activeFilters.sectors.every((sub) =>
53
48
  _case.properties.sectors.includes(sub),
54
49
  );
55
-
56
- // ADAPTATION APPROACHES
57
- // activeFilters.elements.forEach((filter) => {
58
- // if (_case.properties.elements.includes(',' + filter + ','))
59
- // flag.elements = true;
60
- // });
61
50
  flag.elements = activeFilters.elements.every((sub) =>
62
51
  _case.properties.elements.includes(sub),
63
52
  );
64
53
 
65
- // activeFilters.impacts.forEach((filter) => {
66
- // if (_case.properties.impacts.includes(',' + filter + ','))
67
- // flag.impacts = true;
68
- // });
69
54
  flag.impacts = activeFilters.impacts.every((sub) =>
70
55
  _case.properties.impacts.includes(sub),
71
56
  );
72
-
73
- // activeFilters.measures.forEach((filter) => {
74
- // if (_case.properties.ktms.includes(',' + filter + ','))
75
- // flag.measures = true;
76
- // });
77
57
  flag.measures = activeFilters.measures.every((sub) =>
78
58
  _case.properties.ktms.includes(sub),
79
59
  );
@@ -121,16 +101,6 @@ export function getFilters(cases) {
121
101
  _filters.elements[elementKeys[i + 1]] = elementNames[i];
122
102
  }
123
103
  }
124
-
125
- // let ktmKeys = _case.properties.ktms.split(',');
126
- // let ktmNames = _case.properties.impacts_str.split(',');
127
- // for (let i = 0; i < ktmKeys.length; i++) {
128
- // if (!_filters.ktms.hasOwnProperty(ktmKeys[i])) {
129
- // _filters.ktms[ktmKeys[i]] = 1;
130
- // }
131
- // }
132
104
  }
133
- // console.log('getFilters:', _filters);
134
-
135
105
  return _filters;
136
106
  }
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { SidebarPortal } from '@plone/volto/components';
2
+ import SidebarPortal from '@plone/volto/components/manage/Sidebar/SidebarPortal';
3
3
  import InlineForm from '@plone/volto/components/manage/Form/InlineForm';
4
4
  import Schema from './schema';
5
5
  import View from './CollectionStatsView';
@@ -3,8 +3,9 @@ import { useSelector, useDispatch } from 'react-redux';
3
3
  import { useLocation } from 'react-router-dom';
4
4
  import { getQueryStats } from '@eeacms/volto-cca-policy/store';
5
5
  import { getBaseUrl as getBase } from '@eeacms/volto-cca-policy/utils';
6
- import { getBaseUrl } from '@plone/volto/helpers';
7
- import { Icon, UniversalLink } from '@plone/volto/components';
6
+ import { getBaseUrl } from '@plone/volto/helpers/Url/Url';
7
+ import Icon from '@plone/volto/components/theme/Icon/Icon';
8
+ import UniversalLink from '@plone/volto/components/manage/UniversalLink/UniversalLink';
8
9
  import { Icon as UiIcon } from 'semantic-ui-react';
9
10
  import config from '@plone/volto/registry';
10
11
  import { useIntl } from 'react-intl';
@@ -2,7 +2,7 @@ import React from 'react';
2
2
  import { MemoryRouter } from 'react-router-dom';
3
3
  import configureStore from 'redux-mock-store';
4
4
  import { render } from '@testing-library/react';
5
- import '@testing-library/jest-dom/extend-expect';
5
+ import '@testing-library/jest-dom';
6
6
  import { Provider } from 'react-intl-redux';
7
7
  import CollectionStatsView from './CollectionStatsView';
8
8
  import config from '@plone/volto/registry';
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
 
3
- import { SidebarPortal } from '@plone/volto/components';
3
+ import SidebarPortal from '@plone/volto/components/manage/Sidebar/SidebarPortal';
4
4
  import BlockDataForm from '@plone/volto/components/manage/Form/BlockDataForm';
5
5
 
6
6
  import schema from './schema';
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
2
  import { List } from 'semantic-ui-react';
3
3
  import { Link, useLocation } from 'react-router-dom';
4
- import { flattenToAppURL } from '@plone/volto/helpers';
4
+ import { flattenToAppURL } from '@plone/volto/helpers/Url/Url';
5
5
  import config from '@plone/volto/registry';
6
6
  import cx from 'classnames';
7
7
 
@@ -2,7 +2,7 @@ import React from 'react';
2
2
  import { MemoryRouter } from 'react-router-dom';
3
3
  import configureStore from 'redux-mock-store';
4
4
  import renderer from 'react-test-renderer';
5
- import '@testing-library/jest-dom/extend-expect';
5
+ import '@testing-library/jest-dom';
6
6
  import { Provider } from 'react-intl-redux';
7
7
  import ContentLinksView from './ContentLinksView';
8
8
  import config from '@plone/volto/registry';
@@ -2,7 +2,7 @@ import React from 'react';
2
2
  import { Link } from 'react-router-dom';
3
3
  import { Dropdown } from 'semantic-ui-react';
4
4
  import { useIntl, defineMessages } from 'react-intl';
5
- import { flattenToAppURL } from '@plone/volto/helpers';
5
+ import { flattenToAppURL } from '@plone/volto/helpers/Url/Url';
6
6
 
7
7
  const messages = defineMessages({
8
8
  select: {
@@ -2,7 +2,7 @@ import React from 'react';
2
2
  import { MemoryRouter } from 'react-router-dom';
3
3
  import configureStore from 'redux-mock-store';
4
4
  import renderer from 'react-test-renderer';
5
- import '@testing-library/jest-dom/extend-expect';
5
+ import '@testing-library/jest-dom';
6
6
  import { Provider } from 'react-intl-redux';
7
7
  import DropdownListView from './DropdownListView';
8
8
  import config from '@plone/volto/registry';
@@ -2,7 +2,7 @@ import React from 'react';
2
2
  import { MemoryRouter } from 'react-router-dom';
3
3
  import configureStore from 'redux-mock-store';
4
4
  import { render } from '@testing-library/react';
5
- import '@testing-library/jest-dom/extend-expect';
5
+ import '@testing-library/jest-dom';
6
6
  import { Provider } from 'react-intl-redux';
7
7
  import Filter from './Filter';
8
8
 
@@ -3,7 +3,7 @@ import { compose } from 'redux';
3
3
  import { clientOnly } from '@eeacms/volto-cca-policy/helpers';
4
4
 
5
5
  import { Map, Layer, Layers, Controls } from '@eeacms/volto-openlayers-map/api';
6
- import { openlayers as ol } from '@eeacms/volto-openlayers-map';
6
+ import { withOpenLayers } from '@eeacms/volto-openlayers-map';
7
7
  import {
8
8
  euCountryNames as euCountryNamesRaw,
9
9
  tooltipStyle,
@@ -11,16 +11,17 @@ import {
11
11
  adjustEuCountryNames,
12
12
  } from '@eeacms/volto-cca-policy/helpers/country_map/countryMap';
13
13
  import { withGeoJsonData } from '@eeacms/volto-cca-policy/helpers/country_map/hocs';
14
-
15
- import withResponsiveContainer from '../withResponsiveContainer';
16
- import withVisibilitySensor from '../withVisibilitySensor';
14
+ import {
15
+ withResponsiveContainer,
16
+ withVisibilitySensor,
17
+ } from '@eeacms/volto-cca-policy/hocs';
17
18
  import { makeStyles } from './mapstyle';
18
19
  import { Interactions } from './Interactions';
19
20
 
20
21
  import Filter from './Filter';
21
22
  import { Grid } from 'semantic-ui-react';
22
23
  import { useCountriesMetadata } from './hooks';
23
- import { addAppURL } from '@plone/volto/helpers';
24
+ import { addAppURL } from '@plone/volto/helpers/Url/Url';
24
25
 
25
26
  import './styles.less';
26
27
 
@@ -28,13 +29,15 @@ import './styles.less';
28
29
  // 'https://raw.githubusercontent.com/eurostat/Nuts2json/master/pub/v2/2021/4326/20M/cntrg.json';
29
30
 
30
31
  const View = (props) => {
31
- const { geofeatures, projection } = props;
32
+ const { geofeatures, projection, ol } = props;
32
33
 
33
34
  const highlight = React.useRef();
34
35
  const [stateHighlight, setStateHighlight] = React.useState();
35
36
 
36
- // eslint-disable-next-line react-hooks/exhaustive-deps
37
- const styles = React.useMemo(() => makeStyles(highlight), [stateHighlight]);
37
+ const styles = React.useMemo(
38
+ () => makeStyles(highlight, ol),
39
+ [stateHighlight, ol], // eslint-disable-line react-hooks/exhaustive-deps
40
+ );
38
41
  const tooltipRef = React.useRef();
39
42
  const [tileWMSSources, setTileWMSSources] = React.useState();
40
43
  const [euCountriesSource, setEuCountriessource] = React.useState();
@@ -124,7 +127,7 @@ const View = (props) => {
124
127
 
125
128
  const euSource = new ol.source.Vector({ features: filtered });
126
129
  setEuCountriessource(euSource);
127
- }, [geofeatures, countries_metadata, thematicMapMode, euCountryNames]);
130
+ }, [geofeatures, countries_metadata, thematicMapMode, euCountryNames, ol]);
128
131
 
129
132
  return (
130
133
  <div>
@@ -186,8 +189,9 @@ const View = (props) => {
186
189
  };
187
190
 
188
191
  export default compose(
189
- withGeoJsonData(),
190
192
  clientOnly,
193
+ withGeoJsonData(),
191
194
  withResponsiveContainer('countryMapHeatIndex'),
192
195
  withVisibilitySensor(),
196
+ withOpenLayers,
193
197
  )(View);
@@ -1,5 +1,3 @@
1
- import { openlayers as ol } from '@eeacms/volto-openlayers-map';
2
-
3
1
  // const flagRenderer = ({ stroke, fill }) => (pixelCoordinates, state) => {
4
2
  // const context = state.context;
5
3
  // const geometry = state.geometry.clone();
@@ -29,7 +27,7 @@ import { openlayers as ol } from '@eeacms/volto-openlayers-map';
29
27
  // context.restore();
30
28
  // };
31
29
 
32
- export const makeStyles = (highlight) => {
30
+ export const makeStyles = (highlight, ol) => {
33
31
  const stroke = new ol.style.Stroke({
34
32
  // color: 'rgba(255,255,255,0.8)',
35
33
  color: '#d1d1d1',
@@ -1,4 +1,5 @@
1
- import { BlockDataForm, SidebarPortal } from '@plone/volto/components';
1
+ import BlockDataForm from '@plone/volto/components/manage/Form/BlockDataForm';
2
+ import SidebarPortal from '@plone/volto/components/manage/Sidebar/SidebarPortal';
2
3
  import CountryMapObservatoryView from './CountryMapObservatoryOLView';
3
4
  import Schema from './schema';
4
5
 
@@ -12,9 +12,10 @@ import {
12
12
  getImageUrl,
13
13
  } from '@eeacms/volto-cca-policy/helpers/country_map/countryMap';
14
14
  import { withGeoJsonData } from '@eeacms/volto-cca-policy/helpers/country_map/hocs';
15
-
16
- import withResponsiveContainer from '../withResponsiveContainer';
17
- import withVisibilitySensor from '../withVisibilitySensor';
15
+ import {
16
+ withResponsiveContainer,
17
+ withVisibilitySensor,
18
+ } from '@eeacms/volto-cca-policy/hocs';
18
19
  import { makeStyles } from './mapstyle';
19
20
  import { Interactions } from './Interactions';
20
21
 
@@ -2,7 +2,7 @@ import React from 'react';
2
2
  import { MemoryRouter } from 'react-router-dom';
3
3
  import configureStore from 'redux-mock-store';
4
4
  import { render } from '@testing-library/react';
5
- import '@testing-library/jest-dom/extend-expect';
5
+ import '@testing-library/jest-dom';
6
6
  import { Provider } from 'react-intl-redux';
7
7
  import Filter from './Filter';
8
8