@eeacms/volto-cca-policy 0.3.131 → 1.0.1

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 +44 -14
  3. package/docker-compose.yml +16 -16
  4. package/jest-addon.config.js +25 -420
  5. package/package.json +1 -2
  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 +29 -13
  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 +539 -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,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';
@@ -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, FormattedMessage } 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
  chooseARegion: {
@@ -1,4 +1,4 @@
1
- import '@testing-library/jest-dom/extend-expect';
1
+ import '@testing-library/jest-dom';
2
2
  import { render, screen } from '@testing-library/react';
3
3
  import { MemoryRouter } from 'react-router-dom';
4
4
  import { Provider } from 'react-intl-redux';
@@ -4,8 +4,11 @@ import { Plug } from '@plone/volto/components/manage/Pluggable';
4
4
  import { Modal, Button, Form, Message } from 'semantic-ui-react';
5
5
  import superagent from 'superagent';
6
6
  import { toast } from 'react-toastify';
7
- import { Toast } from '@plone/volto/components';
8
- import { flattenToAppURL, expandToBackendURL } from '@plone/volto/helpers';
7
+ import Toast from '@plone/volto/components/manage/Toast/Toast';
8
+ import {
9
+ flattenToAppURL,
10
+ expandToBackendURL,
11
+ } from '@plone/volto/helpers/Url/Url';
9
12
  import { INDICATOR } from '@eeacms/volto-cca-policy/constants';
10
13
 
11
14
  function CreateArchivedCopyButton(props) {
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
2
  import { MemoryRouter } from 'react-router-dom';
3
3
  import configureStore from 'redux-mock-store';
4
- import '@testing-library/jest-dom/extend-expect';
4
+ import '@testing-library/jest-dom';
5
5
  import { Provider } from 'react-intl-redux';
6
6
  import { render, fireEvent } from '@testing-library/react';
7
7
  import CreateArchivedCopyButton from './CreateArchivedCopyButton';
@@ -29,11 +29,8 @@ jest.mock('react-toastify', () => ({
29
29
  toast: { success: jest.fn(), error: jest.fn() },
30
30
  }));
31
31
 
32
- jest.mock('@plone/volto/components', () => ({
33
- Toast: () => null,
34
- }));
35
-
36
- jest.mock('@plone/volto/helpers', () => ({
32
+ jest.mock('@plone/volto/components/manage/Toast/Toast', () => () => null);
33
+ jest.mock('@plone/volto/helpers/Url/Url', () => ({
37
34
  flattenToAppURL: (url) => url.replace('http://localhost:3000', ''),
38
35
  expandToBackendURL: (url) =>
39
36
  url.replace('http://localhost:3000', 'http://localhost:8080/Plone'),
@@ -4,7 +4,7 @@ import PropTypes from 'prop-types';
4
4
  import { useSelector } from 'react-redux';
5
5
  import { Link } from 'react-router-dom';
6
6
  import { defineMessages, useIntl, FormattedMessage } from 'react-intl';
7
- import { flattenToAppURL } from '@plone/volto/helpers';
7
+ import { flattenToAppURL } from '@plone/volto/helpers/Url/Url';
8
8
 
9
9
  const messages = defineMessages({
10
10
  confirmHeader: {
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
2
  import { MemoryRouter } from 'react-router-dom';
3
3
  import configureStore from 'redux-mock-store';
4
- import '@testing-library/jest-dom/extend-expect';
4
+ import '@testing-library/jest-dom';
5
5
  import { Provider } from 'react-intl-redux';
6
6
  import { render, screen } from '@testing-library/react';
7
7
  import WorkflowLinkIntegrityModal from './WorkflowLinkIntegrityModal';
@@ -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 ASTAccordion from './ASTAccordion';
8
8
 
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { LinkWrap } from './utils';
2
+ import { LinkWrap } from './LinkWrap';
3
3
 
4
4
  export default function ASTLogoMap(props) {
5
5
  const { pathname, items, href } = 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 ASTLogoMap from './ASTLogoMap';
8
8
 
@@ -1,14 +1,18 @@
1
1
  import React from 'react';
2
2
  import { useDispatch, useSelector } from 'react-redux';
3
- import { searchContent } from '@plone/volto/actions';
3
+ import { searchContent } from '@plone/volto/actions/search/search';
4
4
  import { useLocation } from 'react-router-dom';
5
5
  import ASTAccordion from './ASTAccordion';
6
- import {
7
- isAdaptationSupportToolURL,
8
- isUrbanAdaptationSupportToolURL,
9
- } from './utils';
10
6
  import './styles.less';
11
7
 
8
+ const isAdaptationSupportToolURL = (url) => {
9
+ return url.includes('/knowledge/tools/adaptation-support-tool');
10
+ };
11
+
12
+ const isUrbanAdaptationSupportToolURL = (url) => {
13
+ return url.includes('/knowledge/tools/urban-ast');
14
+ };
15
+
12
16
  const ASTNavigation = (props) => {
13
17
  const dispatch = useDispatch();
14
18
  const location = useLocation();
@@ -0,0 +1,323 @@
1
+ import React from 'react';
2
+ import '@testing-library/jest-dom';
3
+ import { render } from '@testing-library/react';
4
+ import { Provider } from 'react-redux';
5
+ import { MemoryRouter } from 'react-router-dom';
6
+ import configureStore from 'redux-mock-store';
7
+ import { IntlProvider } from 'react-intl';
8
+ import ASTNavigation from './ASTNavigation';
9
+ import * as searchActions from '@plone/volto/actions/search/search';
10
+
11
+ const mockStore = configureStore();
12
+
13
+ jest.mock('@plone/volto/actions/search/search', () => ({
14
+ searchContent: jest.fn(() => ({
15
+ type: 'SEARCH_CONTENT',
16
+ payload: {},
17
+ })),
18
+ }));
19
+
20
+ jest.mock('./ASTAccordion', () => {
21
+ return function MockASTAccordion() {
22
+ return <div data-testid="ast-accordion">ASTAccordion</div>;
23
+ };
24
+ });
25
+
26
+ describe('ASTNavigation', () => {
27
+ const defaultProps = {
28
+ astNavigation: {
29
+ root_path: 'knowledge/tools/adaptation-support-tool',
30
+ },
31
+ };
32
+
33
+ const mockLocation = {
34
+ pathname: '/en/knowledge/tools/adaptation-support-tool',
35
+ };
36
+
37
+ beforeEach(() => {
38
+ jest.clearAllMocks();
39
+ });
40
+
41
+ it('should render the navigation wrapper with ASTAccordion when items exist', () => {
42
+ const items = [
43
+ {
44
+ '@id': '/en/knowledge/tools/adaptation-support-tool/step-1',
45
+ title: 'Step 1',
46
+ },
47
+ {
48
+ '@id': '/en/knowledge/tools/adaptation-support-tool/step-2',
49
+ title: 'Step 2',
50
+ },
51
+ ];
52
+
53
+ const store = mockStore({
54
+ intl: {
55
+ locale: 'en',
56
+ messages: {},
57
+ },
58
+ search: {
59
+ subrequests: {
60
+ ast: {
61
+ items: items,
62
+ },
63
+ },
64
+ },
65
+ });
66
+
67
+ const { container, getByTestId } = render(
68
+ <Provider store={store}>
69
+ <MemoryRouter initialEntries={[mockLocation.pathname]}>
70
+ <IntlProvider locale="en" messages={{}}>
71
+ <ASTNavigation {...defaultProps} />
72
+ </IntlProvider>
73
+ </MemoryRouter>
74
+ </Provider>,
75
+ );
76
+
77
+ const navigationDiv = container.querySelector('.ast-navigation');
78
+ expect(navigationDiv).toBeInTheDocument();
79
+ expect(getByTestId('ast-accordion')).toBeInTheDocument();
80
+ });
81
+
82
+ it('should not render anything when no items exist', () => {
83
+ const store = mockStore({
84
+ intl: {
85
+ locale: 'en',
86
+ messages: {},
87
+ },
88
+ search: {
89
+ subrequests: {
90
+ ast: {
91
+ items: [],
92
+ },
93
+ },
94
+ },
95
+ });
96
+
97
+ const { container } = render(
98
+ <Provider store={store}>
99
+ <MemoryRouter initialEntries={[mockLocation.pathname]}>
100
+ <IntlProvider locale="en" messages={{}}>
101
+ <ASTNavigation {...defaultProps} />
102
+ </IntlProvider>
103
+ </MemoryRouter>
104
+ </Provider>,
105
+ );
106
+
107
+ expect(container.querySelector('.ast-navigation')).not.toBeInTheDocument();
108
+ });
109
+
110
+ it('should not render anything when items are undefined', () => {
111
+ const store = mockStore({
112
+ intl: {
113
+ locale: 'en',
114
+ messages: {},
115
+ },
116
+ search: {
117
+ subrequests: null,
118
+ },
119
+ });
120
+
121
+ const { container } = render(
122
+ <Provider store={store}>
123
+ <MemoryRouter initialEntries={[mockLocation.pathname]}>
124
+ <IntlProvider locale="en" messages={{}}>
125
+ <ASTNavigation {...defaultProps} />
126
+ </IntlProvider>
127
+ </MemoryRouter>
128
+ </Provider>,
129
+ );
130
+
131
+ expect(container.querySelector('.ast-navigation')).not.toBeInTheDocument();
132
+ });
133
+
134
+ it('should dispatch searchContent for adaptation support tool', () => {
135
+ const items = [
136
+ {
137
+ '@id': '/en/knowledge/tools/adaptation-support-tool/step-1',
138
+ title: 'Step 1',
139
+ },
140
+ ];
141
+
142
+ const store = mockStore({
143
+ intl: {
144
+ locale: 'en',
145
+ messages: {},
146
+ },
147
+ search: {
148
+ subrequests: {
149
+ ast: {
150
+ items: items,
151
+ },
152
+ },
153
+ },
154
+ });
155
+
156
+ store.dispatch = jest.fn();
157
+
158
+ render(
159
+ <Provider store={store}>
160
+ <MemoryRouter
161
+ initialEntries={['/en/knowledge/tools/adaptation-support-tool']}
162
+ >
163
+ <IntlProvider locale="en" messages={{}}>
164
+ <ASTNavigation
165
+ {...defaultProps}
166
+ astNavigation={{
167
+ root_path: 'knowledge/tools/adaptation-support-tool',
168
+ }}
169
+ />
170
+ </IntlProvider>
171
+ </MemoryRouter>
172
+ </Provider>,
173
+ );
174
+
175
+ expect(searchActions.searchContent).toHaveBeenCalledWith(
176
+ '/en/knowledge/tools/adaptation-support-tool',
177
+ {
178
+ 'path.depth': 1,
179
+ portal_type: ['Folder'],
180
+ object_provides: 'eea.climateadapt.interfaces.ICover',
181
+ review_state: 'published',
182
+ b_size: 100,
183
+ },
184
+ 'ast',
185
+ );
186
+ });
187
+
188
+ it('should dispatch searchContent for urban adaptation support tool', () => {
189
+ const items = [
190
+ {
191
+ '@id': '/en/knowledge/tools/urban-ast/step-1',
192
+ title: 'Step 1',
193
+ },
194
+ ];
195
+
196
+ const store = mockStore({
197
+ intl: {
198
+ locale: 'en',
199
+ messages: {},
200
+ },
201
+ search: {
202
+ subrequests: {
203
+ ast: {
204
+ items: items,
205
+ },
206
+ },
207
+ },
208
+ });
209
+
210
+ store.dispatch = jest.fn();
211
+
212
+ render(
213
+ <Provider store={store}>
214
+ <MemoryRouter initialEntries={['/en/knowledge/tools/urban-ast']}>
215
+ <IntlProvider locale="en" messages={{}}>
216
+ <ASTNavigation
217
+ {...defaultProps}
218
+ astNavigation={{
219
+ root_path: 'knowledge/tools/urban-ast',
220
+ }}
221
+ />
222
+ </IntlProvider>
223
+ </MemoryRouter>
224
+ </Provider>,
225
+ );
226
+
227
+ expect(searchActions.searchContent).toHaveBeenCalledWith(
228
+ '/en/knowledge/tools/urban-ast',
229
+ {
230
+ 'path.depth': 1,
231
+ portal_type: ['Folder'],
232
+ review_state: 'published',
233
+ b_size: 100,
234
+ },
235
+ 'ast',
236
+ );
237
+ });
238
+
239
+ it('should pass correct props to ASTAccordion', () => {
240
+ const items = [
241
+ {
242
+ '@id': '/en/knowledge/tools/adaptation-support-tool/step-1',
243
+ title: 'Step 1',
244
+ },
245
+ ];
246
+
247
+ const store = mockStore({
248
+ intl: {
249
+ locale: 'en',
250
+ messages: {},
251
+ },
252
+ search: {
253
+ subrequests: {
254
+ ast: {
255
+ items: items,
256
+ },
257
+ },
258
+ },
259
+ });
260
+
261
+ const { getByTestId } = render(
262
+ <Provider store={store}>
263
+ <MemoryRouter initialEntries={[mockLocation.pathname]}>
264
+ <IntlProvider locale="en" messages={{}}>
265
+ <ASTNavigation {...defaultProps} />
266
+ </IntlProvider>
267
+ </MemoryRouter>
268
+ </Provider>,
269
+ );
270
+
271
+ expect(getByTestId('ast-accordion')).toBeInTheDocument();
272
+ });
273
+
274
+ it('should handle different language locales', () => {
275
+ const items = [
276
+ {
277
+ '@id': '/fr/knowledge/tools/adaptation-support-tool/step-1',
278
+ title: 'Étape 1',
279
+ },
280
+ ];
281
+
282
+ const store = mockStore({
283
+ intl: {
284
+ locale: 'fr',
285
+ messages: {},
286
+ },
287
+ search: {
288
+ subrequests: {
289
+ ast: {
290
+ items: items,
291
+ },
292
+ },
293
+ },
294
+ });
295
+
296
+ store.dispatch = jest.fn();
297
+
298
+ const { container } = render(
299
+ <Provider store={store}>
300
+ <MemoryRouter
301
+ initialEntries={['/fr/knowledge/tools/adaptation-support-tool']}
302
+ >
303
+ <IntlProvider locale="fr" messages={{}}>
304
+ <ASTNavigation
305
+ {...defaultProps}
306
+ astNavigation={{
307
+ root_path: 'knowledge/tools/adaptation-support-tool',
308
+ }}
309
+ />
310
+ </IntlProvider>
311
+ </MemoryRouter>
312
+ </Provider>,
313
+ );
314
+
315
+ expect(searchActions.searchContent).toHaveBeenCalledWith(
316
+ '/fr/knowledge/tools/adaptation-support-tool',
317
+ expect.any(Object),
318
+ 'ast',
319
+ );
320
+
321
+ expect(container.querySelector('.ast-navigation')).toBeInTheDocument();
322
+ });
323
+ });
@@ -1,14 +1,7 @@
1
- import { UniversalLink } from '@plone/volto/components';
1
+ import React from 'react';
2
+ import UniversalLink from '@plone/volto/components/manage/UniversalLink/UniversalLink';
2
3
  import cx from 'classnames';
3
4
 
4
- export const isAdaptationSupportToolURL = (url) => {
5
- return url.indexOf('/knowledge/tools/adaptation-support-tool') > -1;
6
- };
7
-
8
- export const isUrbanAdaptationSupportToolURL = (url) => {
9
- return url.indexOf('/knowledge/tools/urban-ast') > -1;
10
- };
11
-
12
5
  export const LinkWrap = ({ item, pathname, children, className }) => {
13
6
  const substeps = item?.items || [];
14
7
  const activeSubstep = substeps.some((obj) => obj['@id'] === pathname);
@@ -29,3 +22,5 @@ export const LinkWrap = ({ item, pathname, children, className }) => {
29
22
  <g>{children}</g>
30
23
  );
31
24
  };
25
+
26
+ export default LinkWrap;
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { LinkWrap } from './utils';
2
+ import { LinkWrap } from './LinkWrap';
3
3
 
4
4
  export default function UASTLogoMap(props) {
5
5
  const { pathname, items, href } = 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 UASTLogoMap from './UASTLogoMap';
8
8
 
@@ -8,15 +8,15 @@ import { Dropdown, Image } from 'semantic-ui-react';
8
8
  import { connect, useDispatch, useSelector } from 'react-redux';
9
9
 
10
10
  import { withRouter } from 'react-router-dom';
11
- import { UniversalLink } from '@plone/volto/components';
11
+ import UniversalLink from '@plone/volto/components/manage/UniversalLink/UniversalLink';
12
12
  import {
13
13
  getBaseUrl,
14
- hasApiExpander,
15
14
  flattenToAppURL,
16
15
  toPublicURL,
17
- BodyClass,
18
- } from '@plone/volto/helpers';
19
- import { getNavigation } from '@plone/volto/actions';
16
+ } from '@plone/volto/helpers/Url/Url';
17
+ import { hasApiExpander } from '@plone/volto/helpers/Utils/Utils';
18
+ import BodyClass from '@plone/volto/helpers/BodyClass/BodyClass';
19
+ import { getNavigation } from '@plone/volto/actions/navigation/navigation';
20
20
  import { Header, Logo } from '@eeacms/volto-eea-design-system/ui';
21
21
  import { usePrevious } from '@eeacms/volto-eea-design-system/helpers';
22
22
  import eeaFlag from '@eeacms/volto-eea-design-system/../theme/themes/eea/assets/images/Header/eea.png';
@@ -1,10 +1,10 @@
1
1
  import React from 'react';
2
- import { find } from 'lodash';
2
+ import find from 'lodash/find';
3
3
  import { useAtom } from 'jotai';
4
4
  import { useSelector } from 'react-redux';
5
5
  import { FormattedMessage } from 'react-intl';
6
6
  import { Dropdown, Image } from 'semantic-ui-react';
7
- import { flattenToAppURL } from '@plone/volto/helpers';
7
+ import { flattenToAppURL } from '@plone/volto/helpers/Url/Url';
8
8
  import { Header } from '@eeacms/volto-eea-design-system/ui';
9
9
  import config from '@plone/volto/registry';
10
10
  import cx from 'classnames';
@@ -75,11 +75,11 @@ export default function LanguageSwitch({ history }) {
75
75
  });
76
76
 
77
77
  const euLanguages = eea.languages.filter(
78
- (item) => eea.non_eu_langs.indexOf(item.code) === -1,
78
+ (item) => !eea.NON_EU_LANGS.includes(item.code),
79
79
  );
80
80
 
81
- const nonEuLanguages = eea.languages.filter(
82
- (item) => eea.non_eu_langs.indexOf(item.code) !== -1,
81
+ const nonEuLanguages = eea.languages.filter((item) =>
82
+ eea.NON_EU_LANGS.includes(item.code),
83
83
  );
84
84
 
85
85
  return (
@@ -3,7 +3,7 @@ import { Link } from 'react-router-dom';
3
3
  import { Tab, Container, Divider, Button, Icon } from 'semantic-ui-react';
4
4
  import { formatTextToHTML } from '@eeacms/volto-cca-policy/utils';
5
5
  import { BannerTitle, HTMLField } from '@eeacms/volto-cca-policy/helpers';
6
- import { flattenToAppURL } from '@plone/volto/helpers';
6
+ import { flattenToAppURL } from '@plone/volto/helpers/Url/Url';
7
7
 
8
8
  import GovernanceTab from './TabSections/GovernanceTab';
9
9
  import AssessmentTab from './TabSections/AssessmentTab';
@@ -2,7 +2,7 @@ import React from 'react';
2
2
  import { useSelector } from 'react-redux';
3
3
  import { useLocation } from 'react-router-dom';
4
4
  import { Container, Segment } from 'semantic-ui-react';
5
- import { isCmsUi } from '@plone/volto/helpers';
5
+ import { isCmsUi } from '@plone/volto/helpers/Url/Url';
6
6
  import config from '@plone/volto/registry';
7
7
 
8
8
  import LanguagePreference from './LanguagePreference';
@@ -1,7 +1,7 @@
1
1
  import React, { useEffect, useState, useRef } from 'react';
2
2
  import { Icon, Button } from 'semantic-ui-react';
3
3
  import { FormattedMessage } from 'react-intl';
4
- import { UniversalLink } from '@plone/volto/components';
4
+ import UniversalLink from '@plone/volto/components/manage/UniversalLink/UniversalLink';
5
5
 
6
6
  const TranslationInfo = (props) => {
7
7
  const { defaultLanguage, currentLanguage } = props;
@@ -16,7 +16,7 @@ import {
16
16
  import { Callout } from '@eeacms/volto-eea-design-system/ui';
17
17
  import { Container, Grid, Image, Icon } from 'semantic-ui-react';
18
18
  import { getFilteredBlocks } from '@eeacms/volto-cca-policy/utils';
19
- import { UniversalLink } from '@plone/volto/components';
19
+ import UniversalLink from '@plone/volto/components/manage/UniversalLink/UniversalLink';
20
20
  import RenderBlocks from '@plone/volto/components/theme/View/RenderBlocks';
21
21
 
22
22
  const PhotoGallery = ({ content }) => {
@@ -45,9 +45,11 @@ jest.mock('@plone/volto/components/theme/View/RenderBlocks', () => () => (
45
45
  <div data-testid="render-blocks" />
46
46
  ));
47
47
 
48
- jest.mock('@plone/volto/components', () => ({
49
- UniversalLink: ({ href, children }) => <a href={href}>{children}</a>,
50
- }));
48
+ jest.mock(
49
+ '@plone/volto/components/manage/UniversalLink/UniversalLink',
50
+ () =>
51
+ ({ href, children }) => <a href={href}>{children}</a>,
52
+ );
51
53
 
52
54
  jest.mock('semantic-ui-react', () => ({
53
55
  ...jest.requireActual('semantic-ui-react'),
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
2
  import { Link } from 'react-router-dom';
3
3
  import { FormattedMessage } from 'react-intl';
4
- import { flattenToAppURL } from '@plone/volto/helpers';
4
+ import { flattenToAppURL } from '@plone/volto/helpers/Url/Url';
5
5
  import { AccordionList } from '@eeacms/volto-cca-policy/components';
6
6
 
7
7
  function ArchivedVersionListing({ content }) {
@@ -1,11 +1,11 @@
1
1
  import React from 'react';
2
2
  import { MemoryRouter } from 'react-router-dom';
3
3
  import { IntlProvider } from 'react-intl';
4
- import '@testing-library/jest-dom/extend-expect';
4
+ import '@testing-library/jest-dom';
5
5
  import { render, screen } from '@testing-library/react';
6
6
  import ArchivedVersionListing from './ArchivedVersionListing';
7
7
 
8
- jest.mock('@plone/volto/helpers', () => ({
8
+ jest.mock('@plone/volto/helpers/Url/Url', () => ({
9
9
  flattenToAppURL: (url) => url.replace('http://localhost:3000', ''),
10
10
  }));
11
11
 
@@ -2,7 +2,7 @@ import React from 'react';
2
2
  import { Link } from 'react-router-dom';
3
3
  import { Message } from 'semantic-ui-react';
4
4
  import { FormattedMessage } from 'react-intl';
5
- import { flattenToAppURL } from '@plone/volto/helpers';
5
+ import { flattenToAppURL } from '@plone/volto/helpers/Url/Url';
6
6
 
7
7
  function ArchivedVersionNotice({ content }) {
8
8
  if (content?.review_state !== 'archived') return null;
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
2
  import { MemoryRouter } from 'react-router-dom';
3
3
  import configureStore from 'redux-mock-store';
4
- import '@testing-library/jest-dom/extend-expect';
4
+ import '@testing-library/jest-dom';
5
5
  import { Provider } from 'react-intl-redux';
6
6
  import { render } from '@testing-library/react';
7
7
  import ArchivedVersionNotice from './ArchivedVersionNotice';
@@ -1,4 +1,4 @@
1
- import { expandToBackendURL } from '@plone/volto/helpers';
1
+ import { expandToBackendURL } from '@plone/volto/helpers/Url/Url';
2
2
  import { injectLazyLibs } from '@plone/volto/helpers/Loadable';
3
3
  import React from 'react';
4
4
  import {