@eeacms/volto-clms-theme 1.1.164 → 1.1.166

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 (30) hide show
  1. package/CHANGELOG.md +27 -0
  2. package/jest-addon.config.js +2 -0
  3. package/jest.setup.js +19 -0
  4. package/package.json +3 -2
  5. package/src/components/Blocks/CclHomeBgImageBlock/HomeBgImg.jsx +18 -11
  6. package/src/components/Blocks/CustomTemplates/VoltoTabsBlock/CclTabsView.jsx +5 -3
  7. package/src/components/Blocks/CustomTemplates/VoltoTabsBlock/TabsWidget.jsx +23 -16
  8. package/src/components/Blocks/CustomTemplates/VoltoTabsBlock/fontAwesomeSchema.js +7 -6
  9. package/src/components/Blocks/CustomTemplates/VoltoTabsBlock/fontawesome.js +0 -5
  10. package/src/components/CLMSDatasetDetailView/CLMSDatasetDetailView.test.jsx +5 -0
  11. package/src/components/CLMSDownloadCartView/CLMSCartContent.jsx +8 -6
  12. package/src/components/CLMSDownloadCartView/CLMSDownloadCartView.jsx +2 -1
  13. package/src/components/CLMSDownloadCartView/Fields/ProjectionNaming.jsx +14 -4
  14. package/src/components/CLMSDownloadCartView/Fields/utils.js +7 -3
  15. package/src/components/CLMSDownloadsView/FileCard.jsx +18 -10
  16. package/src/components/CLMSLoginView/CLMSLogin.jsx +2 -6
  17. package/src/components/CLMSLoginView/Readme.md +15 -0
  18. package/src/components/CartIconCounter/CartIconCounter.jsx +3 -1
  19. package/src/components/CartIconCounter/CartIconCounter.test.jsx +6 -1
  20. package/src/components/CclCard/CclCard.jsx +8 -6
  21. package/src/components/CclInfoDescription/CclInfoDescription.jsx +6 -5
  22. package/src/components/CclInfoDescription/CclInfoDescription.test.js +30 -4
  23. package/src/components/CclLanguageSelector/CclLanguageSelector.test.jsx +5 -0
  24. package/src/components/CclModal/CclModal.jsx +6 -4
  25. package/src/components/CclModal/CclModal.test.js +29 -10
  26. package/src/components/Header/Header.jsx +1 -1
  27. package/src/components/Widgets/DownloadableFilesTableWidget.jsx +9 -2
  28. package/src/customizations/volto/components/theme/Footer/Footer.jsx +8 -4
  29. package/src/customizations/volto/components/theme/Unauthorized/Unauthorized.test.jsx +6 -0
  30. package/src/index.js +9 -2
package/CHANGELOG.md CHANGED
@@ -4,6 +4,33 @@ 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.1.166](https://github.com/eea/volto-clms-theme/compare/1.1.165...1.1.166) - 3 July 2024
8
+
9
+ #### :house: Internal changes
10
+
11
+ - style: Automated code fix [eea-jenkins - [`2fa089b`](https://github.com/eea/volto-clms-theme/commit/2fa089b73a2f2e203528b08c473f16a2b2b3307f)]
12
+
13
+ #### :hammer_and_wrench: Others
14
+
15
+ - fix eslint errors [ana-oprea - [`a7c8bad`](https://github.com/eea/volto-clms-theme/commit/a7c8badd68c523e3435a8684fe7a5e224924497e)]
16
+ - Add spread for rest of loadables [Tiberiu Ichim - [`ccd23df`](https://github.com/eea/volto-clms-theme/commit/ccd23df39c06b25df20f0ca2d7d4a1d7fbe2e741)]
17
+ - add jest.setup.js and modify unit tests [ana-oprea - [`1380a0b`](https://github.com/eea/volto-clms-theme/commit/1380a0b570df70f27fd3149d3f2af84b0c5f20e0)]
18
+ - Use release of clms-utils [Tiberiu Ichim - [`92d564a`](https://github.com/eea/volto-clms-theme/commit/92d564acf37d498c7578cbc48ab7643be81178b8)]
19
+ - Lazyload utmProjections [Tiberiu Ichim - [`d2483e9`](https://github.com/eea/volto-clms-theme/commit/d2483e90586763e1bb9a694c36b15ad655a29e93)]
20
+ - Add lazlib for utmProjections [Tiberiu Ichim - [`b60580c`](https://github.com/eea/volto-clms-theme/commit/b60580c58c8cbc67abd09f902e24c5b2540a62b1)]
21
+ - Bring back lazylib import [Tiberiu Ichim - [`987f130`](https://github.com/eea/volto-clms-theme/commit/987f130e2db4e25ee2a8ab7a04ea616137aac7c7)]
22
+ - Use fontawesome from volto-clms-utils [Tiberiu Ichim - [`7dacef3`](https://github.com/eea/volto-clms-theme/commit/7dacef35b7173c293b12bbfcbc1a53eb23825fdc)]
23
+ - Cleanup [Tiberiu Ichim - [`def0145`](https://github.com/eea/volto-clms-theme/commit/def014521ae56c2ded5044c7f26a555b41349903)]
24
+ - More lazyloaded [Tiberiu Ichim - [`f7ac8ae`](https://github.com/eea/volto-clms-theme/commit/f7ac8aed214d89c3b61a4585c658df54d0a03869)]
25
+ - Lazyload icons [Tiberiu Ichim - [`e4ef2d6`](https://github.com/eea/volto-clms-theme/commit/e4ef2d62f0a9d38381c63251d79cb20b64999f1e)]
26
+ - Add volto-taxonomy as dependency [Tiberiu Ichim - [`b1c6bf6`](https://github.com/eea/volto-clms-theme/commit/b1c6bf618002740bbc83bfbfc3e23faa45babc6e)]
27
+ - Lazyload table widget [Tiberiu Ichim - [`7634833`](https://github.com/eea/volto-clms-theme/commit/763483367f865cf0abb4d545db933d2be33ac57d)]
28
+ ### [1.1.165](https://github.com/eea/volto-clms-theme/compare/1.1.164...1.1.165) - 2 July 2024
29
+
30
+ #### :hammer_and_wrench: Others
31
+
32
+ - Code cleanup [Tiberiu Ichim - [`47e3633`](https://github.com/eea/volto-clms-theme/commit/47e3633511e5096d3691161b4538baa0a14cb86e)]
33
+ - Fix homepage image in backend [Tiberiu Ichim - [`ba27cb9`](https://github.com/eea/volto-clms-theme/commit/ba27cb938fb7e28fd9c228673c088a5c30ab3bc6)]
7
34
  ### [1.1.164](https://github.com/eea/volto-clms-theme/compare/1.1.163...1.1.164) - 27 June 2024
8
35
 
9
36
  #### :bug: Bug Fixes
@@ -41,4 +41,6 @@ module.exports = {
41
41
  statements: 5,
42
42
  },
43
43
  },
44
+
45
+ setupFilesAfterEnv: ['<rootDir>/src/addons/volto-clms-theme/jest.setup.js'],
44
46
  };
package/jest.setup.js ADDED
@@ -0,0 +1,19 @@
1
+ import { jest } from '@jest/globals';
2
+ import loadable from '@loadable/component';
3
+
4
+ var config = jest.requireActual('@plone/volto/registry').default;
5
+
6
+ config.settings.loadables = {
7
+ fontAwesome: loadable.lib(() => import('@fortawesome/react-fontawesome')),
8
+ fontAwesomeLibrary: loadable.lib(() =>
9
+ import('@fortawesome/fontawesome-svg-core'),
10
+ ),
11
+ fontAwesomeSolid: loadable.lib(() =>
12
+ import('@fortawesome/free-solid-svg-icons'),
13
+ ),
14
+ fontAwesomeRegular: loadable.lib(() =>
15
+ import('@fortawesome/free-regular-svg-icons'),
16
+ ),
17
+
18
+ ...config.settings.loadables,
19
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eeacms/volto-clms-theme",
3
- "version": "1.1.164",
3
+ "version": "1.1.166",
4
4
  "description": "volto-clms-theme: Volto theme for CLMS site",
5
5
  "main": "src/index.js",
6
6
  "author": "CodeSyntax for the European Environment Agency",
@@ -36,7 +36,7 @@
36
36
  "dependencies": {
37
37
  "@eeacms/volto-accordion-block": "7.0.0",
38
38
  "@eeacms/volto-arcgis-block": "*",
39
- "@eeacms/volto-clms-utils": "0.1.12",
39
+ "@eeacms/volto-clms-utils": "0.1.13",
40
40
  "@eeacms/volto-columns-block": "6.0.2",
41
41
  "@eeacms/volto-embed": "6.0.0",
42
42
  "@eeacms/volto-metadata-block": "5.0.1",
@@ -44,6 +44,7 @@
44
44
  "@eeacms/volto-resize-helper": "1.0.1",
45
45
  "@eeacms/volto-tableau": "1.3.0",
46
46
  "@eeacms/volto-tabs-block": "3.0.1",
47
+ "@eeacms/volto-taxonomy": "5.1.0",
47
48
  "@fortawesome/fontawesome-svg-core": "1.2.35",
48
49
  "@fortawesome/free-brands-svg-icons": "6.4.2",
49
50
  "@fortawesome/free-regular-svg-icons": "5.15.3",
@@ -1,19 +1,26 @@
1
+ import { flattenToAppURL } from '@plone/volto/helpers';
2
+
1
3
  export const HomeBgImg = ({ url, alt }) => {
4
+ url = url ? flattenToAppURL(url) : url;
5
+ const srcSet = url
6
+ ? `${url}/@@images/image/huge4000 4000w,
7
+ ${url}/@@images/image/huge3000 3000w,
8
+ ${url}/@@images/image/huge2400 2400w,
9
+ ${url}/@@images/image/huge 1600w,
10
+ ${url}/@@images/image/great 1200w,
11
+ ${url}/@@images/image/larger 1000w,
12
+ ${url}/@@images/image/large 800w,
13
+ ${url}/@@images/image/teaser 600w`
14
+ : '';
15
+
2
16
  return (
3
17
  <img
4
18
  src={
5
- `${url}/@@images/image/huge` ||
6
- 'https://eu-copernicus.github.io/copernicus-component-library/assets/images/image_placeholder.jpg'
19
+ url
20
+ ? `${url}/@@images/image/huge`
21
+ : 'https://eu-copernicus.github.io/copernicus-component-library/assets/images/image_placeholder.jpg'
7
22
  }
8
- srcSet={`${url}/@@images/image/huge4000 4000w,
9
- ${url}/@@images/image/huge3000 3000w,
10
- ${url}/@@images/image/huge2400 2400w,
11
- ${url}/@@images/image/huge 1600w,
12
- ${url}/@@images/image/great 1200w,
13
- ${url}/@@images/image/larger 1000w,
14
- ${url}/@@images/image/large 800w,
15
- ${url}/@@images/image/teaser 600w,
16
- `}
23
+ srcSet={srcSet}
17
24
  alt={alt}
18
25
  width={'100%'}
19
26
  height={349}
@@ -1,12 +1,12 @@
1
+ import cx from 'classnames';
1
2
  import React from 'react';
2
3
  import { connect } from 'react-redux';
3
4
  import { compose } from 'redux';
4
5
  import { withRouter } from 'react-router';
5
6
  import { RenderBlocks } from '@plone/volto/components';
6
7
  import { withScrollToTarget } from '@eeacms/volto-tabs-block/hocs';
7
- import './fontawesome';
8
- import cx from 'classnames';
9
- import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
8
+
9
+ import { FontAwesomeIcon } from '@eeacms/volto-clms-utils/components';
10
10
 
11
11
  const TabsComponent = (props) => {
12
12
  const { tabsList = [], setActiveTab } = props;
@@ -54,6 +54,7 @@ const TabsComponent = (props) => {
54
54
  </div>
55
55
  );
56
56
  };
57
+
57
58
  const PanelsComponent = (props) => {
58
59
  const { metadata = {}, tabsList = [], activeTab = null, tabs = {} } = props;
59
60
  return (
@@ -80,6 +81,7 @@ const PanelsComponent = (props) => {
80
81
  </div>
81
82
  );
82
83
  };
84
+
83
85
  const CclTabsView = (props) => {
84
86
  return (
85
87
  <div className="home-news-events-block">
@@ -1,4 +1,6 @@
1
- import './fontawesome';
1
+ import React from 'react';
2
+ import move from 'lodash-move';
3
+ import { v4 as uuid } from 'uuid';
2
4
 
3
5
  import {
4
6
  DragDropList,
@@ -7,25 +9,25 @@ import {
7
9
  SidebarPopup,
8
10
  } from '@plone/volto/components';
9
11
  import { Grid, Header } from 'semantic-ui-react';
10
- import { faExternalLinkAlt, faIcons } from '@fortawesome/free-solid-svg-icons';
11
12
  import { omit, without } from 'lodash';
12
13
 
13
- import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
14
14
  import InlineForm from '@plone/volto/components/manage/Form/InlineForm';
15
- import React from 'react';
16
15
  import { StyleWrapperEdit } from '@eeacms/volto-block-style/StyleWrapper';
17
- import clearSVG from '@plone/volto/icons/clear.svg';
18
- import dragSVG from '@plone/volto/icons/drag.svg';
19
16
  import { emptyTab } from '@eeacms/volto-tabs-block/helpers';
20
17
  import { fontAwesomeSchema } from './fontAwesomeSchema';
21
- import leftMenuSVG from '@plone/volto/icons/nav.svg';
22
- import move from 'lodash-move';
18
+ import { subTabSchema } from './subTabSchema';
19
+
20
+ import { withFontAwesomeLibs } from '@eeacms/volto-clms-utils/helpers';
21
+ import { FontAwesomeIcon } from '@eeacms/volto-clms-utils/components';
22
+
23
+ import clearSVG from '@plone/volto/icons/clear.svg';
24
+ import dragSVG from '@plone/volto/icons/drag.svg';
23
25
  import plusSVG from '@plone/volto/icons/circle-plus.svg';
24
26
  import rightSVG from '@plone/volto/icons/right-key.svg';
25
- import { subTabSchema } from './subTabSchema';
26
27
  import themeSVG from '@plone/volto/icons/theme.svg';
27
28
  import trashSVG from '@plone/volto/icons/delete.svg';
28
- import { v4 as uuid } from 'uuid';
29
+ import leftMenuSVG from '@plone/volto/icons/nav.svg';
30
+ // import { faExternalLinkAlt, faIcons } from '@fortawesome/free-solid-svg-icons';
29
31
 
30
32
  export function moveColumn(formData, source, destination) {
31
33
  return {
@@ -46,13 +48,18 @@ const TabsWidget = (props) => {
46
48
  const [activeFontAwesomePopup, setActiveFontAwesomePopup] = React.useState(0);
47
49
  const [activeSubTabPopup, setActiveSubTabPopup] = React.useState(0);
48
50
 
49
- const { value = {}, id, onChange } = props;
51
+ const { value = {}, id, onChange, fontAwesomeSolid } = props;
52
+ const { faExternalLinkAlt, faIcons } = fontAwesomeSolid;
53
+
50
54
  const { blocks = {} } = value;
51
55
  const tabsList = (value.blocks_layout?.items || []).map((tabId) => [
52
56
  tabId,
53
57
  blocks[tabId],
54
58
  ]);
55
59
  const activeTabData = blocks[activeTabId] || {};
60
+ const schema = fontAwesomeSchema(props);
61
+ const subSchema = subTabSchema();
62
+
56
63
  return (
57
64
  <FormFieldWrapper
58
65
  {...props}
@@ -128,10 +135,10 @@ const TabsWidget = (props) => {
128
135
 
129
136
  <SidebarPopup open={activeFontAwesomePopup}>
130
137
  <InlineForm
131
- schema={fontAwesomeSchema()}
138
+ schema={schema}
132
139
  title={
133
140
  <>
134
- {fontAwesomeSchema().title}
141
+ {schema.title}
135
142
  <button
136
143
  onClick={() => {
137
144
  setActiveFontAwesomePopup(false);
@@ -221,10 +228,10 @@ const TabsWidget = (props) => {
221
228
  </button>
222
229
  <SidebarPopup open={activeSubTabPopup}>
223
230
  <InlineForm
224
- schema={subTabSchema()}
231
+ schema={subSchema}
225
232
  title={
226
233
  <>
227
- {subTabSchema().title}
234
+ {subSchema.title}
228
235
  <button
229
236
  onClick={() => {
230
237
  setActiveSubTabPopup(false);
@@ -342,4 +349,4 @@ const TabsWidget = (props) => {
342
349
  );
343
350
  };
344
351
 
345
- export default TabsWidget;
352
+ export default withFontAwesomeLibs(TabsWidget);
@@ -1,11 +1,12 @@
1
1
  import { getFontAwesomeIconList } from './fontawesome';
2
- import { far } from '@fortawesome/free-regular-svg-icons';
3
2
 
4
- export const fontAwesomeSchema = () => {
5
- const choices = getFontAwesomeIconList([far]).map((item) => [
6
- item.iconName,
7
- item.iconName,
8
- ]);
3
+ export const fontAwesomeSchema = (props) => {
4
+ const { fontAwesomeRegular } = props;
5
+
6
+ const choices = getFontAwesomeIconList([
7
+ fontAwesomeRegular.far,
8
+ ]).map((item) => [item.iconName, item.iconName]);
9
+
9
10
  return {
10
11
  title: 'Font Awesome icons',
11
12
  fieldsets: [
@@ -1,8 +1,3 @@
1
- import { library } from '@fortawesome/fontawesome-svg-core';
2
- import { fas } from '@fortawesome/free-solid-svg-icons';
3
- import { far } from '@fortawesome/free-regular-svg-icons';
4
- library.add(fas, far);
5
-
6
1
  /**
7
2
  * Return fontAwesome icon list
8
3
  * @example
@@ -7,6 +7,11 @@ import { Provider } from 'react-redux';
7
7
  import configureStore from 'redux-mock-store';
8
8
  import { IntlProvider } from 'react-intl';
9
9
 
10
+ jest.mock('@plone/volto/helpers/Loadable/Loadable');
11
+ beforeAll(async () => {
12
+ await require('@plone/volto/helpers/Loadable/Loadable').__setLoadables();
13
+ });
14
+
10
15
  const mockStore = configureStore();
11
16
  let store = mockStore({
12
17
  intl: {
@@ -13,18 +13,13 @@ import {
13
13
  import { Icon } from '@plone/volto/components';
14
14
  import { Toast } from '@plone/volto/components';
15
15
  import { UniversalLink } from '@plone/volto/components';
16
- import addDocumentSVG from '@plone/volto/icons/add-document.svg';
17
- import removeSVG from '@plone/volto/icons/delete.svg';
18
- import paginationLeftSVG from '@plone/volto/icons/left-key.svg';
19
- import paginationRightSVG from '@plone/volto/icons/right-key.svg';
20
16
  import CclButton from '@eeacms/volto-clms-theme/components/CclButton/CclButton';
21
17
  import useCartState from '@eeacms/volto-clms-utils/cart/useCartState';
22
18
  import { cleanDuplicatesEntries } from '@eeacms/volto-clms-utils/utils';
23
- import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
19
+ import { FontAwesomeIcon } from '@eeacms/volto-clms-utils/components';
24
20
 
25
21
  import { getDownloadtool, postDownloadtool } from '../../actions';
26
22
  import { useFilteredPagination } from '../CclUtils/useFilteredPagination';
27
- import './cart-table.less';
28
23
  import {
29
24
  getDownloadToolPostBody,
30
25
  duplicateCartItem,
@@ -46,6 +41,13 @@ import {
46
41
 
47
42
  import { getProjectionsUID } from '../../actions';
48
43
 
44
+ import addDocumentSVG from '@plone/volto/icons/add-document.svg';
45
+ import removeSVG from '@plone/volto/icons/delete.svg';
46
+ import paginationLeftSVG from '@plone/volto/icons/left-key.svg';
47
+ import paginationRightSVG from '@plone/volto/icons/right-key.svg';
48
+
49
+ import './cart-table.less';
50
+
49
51
  const DownloadModal = ({
50
52
  openedModal,
51
53
  onConfirm,
@@ -5,9 +5,10 @@ import { Link } from 'react-router-dom';
5
5
 
6
6
  import { Forbidden, Unauthorized } from '@plone/volto/components';
7
7
  import { Helmet } from '@plone/volto/helpers';
8
+
8
9
  import { helmetTitle } from '@eeacms/volto-clms-theme/components/CclUtils';
9
10
  import useCartState from '@eeacms/volto-clms-utils/cart/useCartState';
10
- import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
11
+ import { FontAwesomeIcon } from '@eeacms/volto-clms-utils/components';
11
12
  import { getNutsIDList } from './cartUtils';
12
13
 
13
14
  import {
@@ -1,11 +1,18 @@
1
1
  import React, { useEffect, useState } from 'react';
2
2
  import { useSelector } from 'react-redux';
3
3
  import { Select, Loader, Popup } from 'semantic-ui-react';
4
- import { baseSources } from '../../../constants/utmProjections';
4
+ // import { baseSources } from '../../../constants/utmProjections';
5
5
  import { getUtm } from './utils';
6
- import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
6
+ import { FontAwesomeIcon } from '@eeacms/volto-clms-utils/components';
7
+ import { injectLazyLibs } from '@plone/volto/helpers/Loadable';
7
8
 
8
- export const ProjectionNaming = ({ item, cartItems, setCartItems }) => {
9
+ const _ProjectionNaming = ({
10
+ item,
11
+ cartItems,
12
+ setCartItems,
13
+ utmProjections,
14
+ }) => {
15
+ const { baseSources } = utmProjections;
9
16
  const [loading, setLoading] = useState(true);
10
17
  const projections_uid = useSelector(
11
18
  (state) => state.downloadtool.projections_in_progress_uid,
@@ -16,7 +23,7 @@ export const ProjectionNaming = ({ item, cartItems, setCartItems }) => {
16
23
  if (new_cartItems[objIndex]) new_cartItems[objIndex].projection = value;
17
24
  setCartItems([...new_cartItems]);
18
25
  };
19
- const utm = getUtm(item);
26
+ const utm = getUtm(item, utmProjections);
20
27
 
21
28
  let [choices, setChoices] = useState([]);
22
29
 
@@ -125,3 +132,6 @@ export const ProjectionNaming = ({ item, cartItems, setCartItems }) => {
125
132
  '-'
126
133
  );
127
134
  };
135
+ export const ProjectionNaming = injectLazyLibs(['utmProjections'])(
136
+ _ProjectionNaming,
137
+ );
@@ -1,5 +1,7 @@
1
- import { baseSources, utm, nutsBB } from '../../../constants/utmProjections';
2
- export const getUtm = (item) => {
1
+ // import { baseSources, utm, nutsBB } from '../../../constants/utmProjections';
2
+
3
+ export const getUtm = (item, utmProjections) => {
4
+ const { utm, nutsBB } = utmProjections;
3
5
  return utm
4
6
  .filter((d) => {
5
7
  if (!item?.area?.value) {
@@ -20,7 +22,9 @@ export const getUtm = (item) => {
20
22
  .map((u) => u.source);
21
23
  };
22
24
 
23
- export const getChoices = (projections, item) => {
25
+ // NOTE: TODO: this is unused. Where is it used?
26
+ export const getChoices = (projections, item, utmProjections) => {
27
+ const { utm, baseSources } = utmProjections;
24
28
  return projections
25
29
  ?.sort((a, b) => {
26
30
  if (Number(a.split(':')[1]) > Number(b.split(':')[1])) {
@@ -3,22 +3,25 @@
3
3
  * @module components/CLMSDownloadsView/FileCard
4
4
  */
5
5
 
6
- import './filecard.less';
6
+ import React from 'react';
7
+ import { defineMessages, useIntl } from 'react-intl';
7
8
 
8
9
  import { Grid, Header, Loader, Popup, Segment } from 'semantic-ui-react';
9
- import { defineMessages, useIntl } from 'react-intl';
10
10
 
11
- import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
12
11
  import { Icon } from '@plone/volto/components';
13
- import React from 'react';
12
+ import { cclDateTimeFormat } from '@eeacms/volto-clms-theme/components/CclUtils';
13
+
14
+ import { FontAwesomeIcon } from '@eeacms/volto-clms-utils/components';
15
+ import { withFontAwesomeLibs } from '@eeacms/volto-clms-utils/helpers';
16
+
14
17
  import pauseSVG from '@plone/volto/icons/pause.svg';
15
18
  import errorSVG from '@plone/volto/icons/error.svg';
16
19
  import warningSVG from '@plone/volto/icons/warning.svg';
17
- import { faInfoCircle } from '@fortawesome/free-solid-svg-icons';
18
20
  import packSVG from '@plone/volto/icons/pack.svg';
19
21
  import removeSVG from '@plone/volto/icons/delete.svg';
20
22
  import blockSVG from '@plone/volto/icons/block.svg';
21
- import { cclDateTimeFormat } from '@eeacms/volto-clms-theme/components/CclUtils';
23
+
24
+ import './filecard.less';
22
25
 
23
26
  const prettyBytes = require('pretty-bytes');
24
27
 
@@ -52,7 +55,12 @@ const DatasetNaming = (props) => {
52
55
  };
53
56
 
54
57
  const FileCard = (props) => {
55
- const { item, showDeleteTaskLoading, deleteTaskInProgress } = props;
58
+ const {
59
+ item,
60
+ showDeleteTaskLoading,
61
+ deleteTaskInProgress,
62
+ fontAwesomeSolid,
63
+ } = props;
56
64
  const { formatMessage } = useIntl();
57
65
  if (item?.FinalizationDateTime) {
58
66
  var FinalizationDate = new Date(Date.parse(item?.FinalizationDateTime));
@@ -166,7 +174,7 @@ const FileCard = (props) => {
166
174
  tooltip="Dates and times are in UTC"
167
175
  direction="up"
168
176
  >
169
- <FontAwesomeIcon icon={faInfoCircle} />
177
+ <FontAwesomeIcon icon={fontAwesomeSolid.faInfoCircle} />
170
178
  </span>
171
179
  <br />
172
180
  </>
@@ -179,7 +187,7 @@ const FileCard = (props) => {
179
187
  tooltip="Dates and times are in UTC"
180
188
  direction="up"
181
189
  >
182
- <FontAwesomeIcon icon={faInfoCircle} />
190
+ <FontAwesomeIcon icon={fontAwesomeSolid.faInfoCircle} />
183
191
  </span>
184
192
  </>
185
193
  )}
@@ -265,4 +273,4 @@ const FileCard = (props) => {
265
273
  );
266
274
  };
267
275
 
268
- export default FileCard;
276
+ export default withFontAwesomeLibs(FileCard);
@@ -72,12 +72,8 @@ function CLMSLoginView(props) {
72
72
  to create it.
73
73
  </p>
74
74
  <p>
75
- If you have othe questions, please contact our
76
- <UniversalLink
77
- openLinkInNewTab
78
- href="/en/contact-service-helpdesk"
79
- >
80
- {' '}
75
+ If you have othe questions, please contact our{' '}
76
+ <UniversalLink openLinkInNewTab href="/en/service-desk">
81
77
  Service desk
82
78
  </UniversalLink>
83
79
  .
@@ -0,0 +1,15 @@
1
+ # CLMS website integration with ECAS
2
+
3
+ CLMS uses pas.plugins.oidc, from the special branch `clms-site`.
4
+
5
+ The oidc plugin is not activated for any PAS interface or functionality, so the
6
+ entire functionality is setup client-side. On the client side, the website
7
+ provides a "EU Login" button which goes to the ECAS website and has a callback
8
+ URL set to the `/acl_users/oidc/@@callback` URL.
9
+
10
+ This callback first authenticates the request and then calls `rememberIdentity`
11
+ which generates a token. The token is used in the computed return url, passed
12
+ as `access_token`.
13
+
14
+ In the `Header` component the `access_token` is read, jwt-decoded and set as an
15
+ `auth_token` cookie, which is used by the jwt authentication plugin.
@@ -11,7 +11,7 @@ import {
11
11
  } from '@eeacms/volto-clms-theme/actions';
12
12
  import { getCartItems } from '@eeacms/volto-clms-utils/actions';
13
13
  import { Link } from 'react-router-dom';
14
- import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
14
+ import { FontAwesomeIcon } from '@eeacms/volto-clms-utils/components';
15
15
 
16
16
  export const onlyInLeft = (left, right, compareFunction) =>
17
17
  left.filter(
@@ -34,7 +34,9 @@ export const CartIconCounter = () => {
34
34
  const [cartDiff, setCartDiff] = useState(0);
35
35
  const [cartDiffItems, setCartDiffItems] = useState([]);
36
36
  const [hasTimeseries, setHasTimeseries] = useState(false);
37
+
37
38
  const dispatch = useDispatch();
39
+
38
40
  useEffect(() => {
39
41
  user_id &&
40
42
  user_id !== user_id_ref.current &&
@@ -7,6 +7,11 @@ import { Provider } from 'react-intl-redux';
7
7
  import configureStore from 'redux-mock-store';
8
8
  Enzyme.configure({ adapter: new Adapter() });
9
9
 
10
+ jest.mock('@plone/volto/helpers/Loadable/Loadable');
11
+ beforeAll(async () => {
12
+ await require('@plone/volto/helpers/Loadable/Loadable').__setLoadables();
13
+ });
14
+
10
15
  describe('onlyInLeft', () => {
11
16
  // Returns an array with items that are only in the left array, based on a compare function
12
17
  it('should return an array with items that are only in the left array', () => {
@@ -136,6 +141,6 @@ describe('CartIconCounter', () => {
136
141
 
137
142
  // Expect the component toBeDefined
138
143
  expect(component).toBeDefined();
139
- expect(component.toJSON().children[0].children[0]).toEqual('3');
144
+ expect(component.toJSON().children[1].children[0]).toEqual('3');
140
145
  });
141
146
  });
@@ -1,25 +1,27 @@
1
+ import PropTypes from 'prop-types';
2
+ import { FormattedMessage } from 'react-intl';
1
3
  import { useSelector } from 'react-redux';
2
4
  import { Link } from 'react-router-dom';
3
5
  import { Icon, Label } from 'semantic-ui-react';
4
6
 
7
+ import { flattenToAppURL } from '@plone/volto/helpers/Url/Url';
8
+ import { UniversalLink, Icon as VoltoIcon } from '@plone/volto/components';
9
+
5
10
  import PlaceHolder from '@eeacms/volto-clms-theme/../theme/clms/img/ccl-thumbnail-placeholder.jpg';
6
11
  import { cclDateFormat } from '@eeacms/volto-clms-theme/components/CclUtils';
7
- import { UniversalLink, Icon as VoltoIcon } from '@plone/volto/components';
8
- import penSVG from '@plone/volto/icons/pen.svg';
9
12
  // import { When } from '@plone/volto/components/theme/View/EventDatesInfo';
10
13
  import { When } from '@eeacms/volto-clms-theme/components/CclWhen/CclWhen';
11
- import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
14
+ import { FontAwesomeIcon } from '@eeacms/volto-clms-utils/components';
12
15
 
13
16
  import { portal_types_labels } from '../Blocks/CustomTemplates/VoltoSearchBlock';
14
17
  // import { HomeBgImg } from '@eeacms/volto-clms-theme/components/Blocks/CclHomeBgImageBlock/HomeBgImg';
15
18
 
16
- import PropTypes from 'prop-types';
17
- import { FormattedMessage } from 'react-intl';
18
19
  import CclLoginModal from '@eeacms/volto-clms-theme/components/CclLoginModal/CclLoginModal';
19
20
  import CclButton from '@eeacms/volto-clms-theme/components/CclButton/CclButton';
20
- import { flattenToAppURL } from '@plone/volto/helpers/Url/Url';
21
21
  import { CLMSTechnicalLibraryAdminInfo } from '../CLMSTechnicalLibraryAdminInfo';
22
22
 
23
+ import penSVG from '@plone/volto/icons/pen.svg';
24
+
23
25
  const CardImage = ({ card, size = 'preview', isCustomCard }) => {
24
26
  return card?.image_field ? (
25
27
  <img
@@ -1,7 +1,8 @@
1
- import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
2
1
  import PropTypes from 'prop-types';
3
2
  import React from 'react';
4
- import { faInfoCircle } from '@fortawesome/free-solid-svg-icons';
3
+
4
+ import { FontAwesomeIcon } from '@eeacms/volto-clms-utils/components';
5
+ import { withFontAwesomeLibs } from '@eeacms/volto-clms-utils/helpers';
5
6
 
6
7
  /**
7
8
  * CclInfoDescription component doc.
@@ -16,14 +17,14 @@ import { faInfoCircle } from '@fortawesome/free-solid-svg-icons';
16
17
  </CclInfoDescription>
17
18
  *
18
19
  */
19
- function CclInfoDescription({ title, description, tooltip }) {
20
+ function CclInfoDescription({ title, description, tooltip, fontAwesomeSolid }) {
20
21
  return (
21
22
  <div className="dataset-info-field">
22
23
  <div className="dataset-field-title">
23
24
  {title && <h3>{title}</h3>}
24
25
  {tooltip && (
25
26
  <span className="info-icon" tooltip={tooltip} direction="up">
26
- <FontAwesomeIcon icon={faInfoCircle} />
27
+ <FontAwesomeIcon icon={fontAwesomeSolid.faInfoCircle} />
27
28
  </span>
28
29
  )}
29
30
  </div>
@@ -36,4 +37,4 @@ CclInfoDescription.propTypes = {
36
37
  title: PropTypes.string,
37
38
  description: PropTypes.oneOfType([PropTypes.string, PropTypes.node]),
38
39
  };
39
- export default CclInfoDescription;
40
+ export default withFontAwesomeLibs(CclInfoDescription);
@@ -1,16 +1,42 @@
1
1
  import CclInfoDescription from './CclInfoDescription';
2
2
  import renderer from 'react-test-renderer';
3
3
  import React from 'react';
4
+ import { Provider } from 'react-intl-redux';
5
+ import configureStore from 'redux-mock-store';
6
+
7
+ jest.mock('@plone/volto/helpers/Loadable/Loadable');
8
+ beforeAll(async () => {
9
+ await require('@plone/volto/helpers/Loadable/Loadable').__setLoadables();
10
+ });
11
+
12
+ const mockStore = configureStore();
13
+ const store = mockStore({
14
+ intl: {
15
+ locale: 'en',
16
+ messages: {},
17
+ },
18
+ content: {
19
+ data: {
20
+ '@components': {
21
+ translations: {
22
+ items: [{ language: 'es', '@id': '/es' }],
23
+ },
24
+ },
25
+ },
26
+ },
27
+ });
4
28
 
5
29
  describe('CclInfoDescription', () => {
6
30
  it('Check values', () => {
7
31
  const component = renderer
8
32
  .create(
9
- <CclInfoDescription
10
- title="Validation status"
11
- description="Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis luctus
33
+ <Provider store={store}>
34
+ <CclInfoDescription
35
+ title="Validation status"
36
+ description="Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis luctus
12
37
  mauris ante, a iaculis leo placerat quis."
13
- ></CclInfoDescription>,
38
+ ></CclInfoDescription>
39
+ </Provider>,
14
40
  )
15
41
  .toJSON();
16
42
  expect(component).toBeDefined();
@@ -13,6 +13,11 @@ import renderer from 'react-test-renderer';
13
13
 
14
14
  Enzyme.configure({ adapter: new Adapter() });
15
15
 
16
+ jest.mock('@plone/volto/helpers/Loadable/Loadable');
17
+ beforeAll(async () => {
18
+ await require('@plone/volto/helpers/Loadable/Loadable').__setLoadables();
19
+ });
20
+
16
21
  beforeAll(() => {
17
22
  config.settings.supportedLanguages = ['es'];
18
23
  });
@@ -1,8 +1,9 @@
1
1
  import React from 'react';
2
2
  import { Segment, Modal } from 'semantic-ui-react';
3
3
  import Draggable from 'react-draggable';
4
- import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
5
- import { faArrowsAlt } from '@fortawesome/free-solid-svg-icons';
4
+
5
+ import { FontAwesomeIcon } from '@eeacms/volto-clms-utils/components';
6
+ import { withFontAwesomeLibs } from '@eeacms/volto-clms-utils/helpers';
6
7
 
7
8
  function CclModal(props) {
8
9
  let {
@@ -12,6 +13,7 @@ function CclModal(props) {
12
13
  modalStatus = () => {},
13
14
  onCloseExtra = () => {},
14
15
  draggable = false,
16
+ fontAwesomeSolid,
15
17
  } = props;
16
18
  const [open, setOpen] = React.useState(false);
17
19
 
@@ -42,7 +44,7 @@ function CclModal(props) {
42
44
  ></span>
43
45
  </div>
44
46
  <Segment compact className="handle">
45
- <FontAwesomeIcon icon={faArrowsAlt} size="lg" />
47
+ <FontAwesomeIcon icon={fontAwesomeSolid.faArrowsAlt} size="lg" />
46
48
  </Segment>
47
49
 
48
50
  {children}
@@ -84,4 +86,4 @@ function CclModal(props) {
84
86
  );
85
87
  }
86
88
 
87
- export default CclModal;
89
+ export default withFontAwesomeLibs(CclModal);
@@ -4,23 +4,42 @@ import Adapter from '@wojtekmaj/enzyme-adapter-react-17';
4
4
  import CclModal from './CclModal';
5
5
  import React from 'react';
6
6
  import renderer from 'react-test-renderer';
7
+ import configureStore from 'redux-mock-store';
8
+ import { Provider } from 'react-intl-redux';
7
9
 
8
10
  Enzyme.configure({ adapter: new Adapter() });
11
+ const mockStore = configureStore();
12
+
13
+ jest.mock('@plone/volto/helpers/Loadable/Loadable');
14
+ beforeAll(async () => {
15
+ await require('@plone/volto/helpers/Loadable/Loadable').__setLoadables();
16
+ });
9
17
 
10
18
  describe('CclModal', () => {
19
+ const store = mockStore({
20
+ intl: {
21
+ locale: 'en',
22
+ messages: {},
23
+ },
24
+ apierror: {
25
+ message: 'You are not authorized to access this resource',
26
+ },
27
+ });
11
28
  it('Check external link', () => {
12
29
  const component = renderer
13
30
  .create(
14
- <CclModal
15
- trigger={
16
- <div className="header-lang-icon">
17
- <i className="ccl-icon-language"></i>
18
- <span className="header-lang-code">EN</span>
19
- </div>
20
- }
21
- >
22
- <p>Hello test!</p>
23
- </CclModal>,
31
+ <Provider store={store}>
32
+ <CclModal
33
+ trigger={
34
+ <div className="header-lang-icon">
35
+ <i className="ccl-icon-language"></i>
36
+ <span className="header-lang-code">EN</span>
37
+ </div>
38
+ }
39
+ >
40
+ <p>Hello test!</p>
41
+ </CclModal>
42
+ </Provider>,
24
43
  )
25
44
  .toJSON();
26
45
  expect(component).toBeDefined();
@@ -9,7 +9,7 @@ import Cookies from 'universal-cookie';
9
9
  import { getUser } from '@plone/volto/actions';
10
10
  import { Logo, Navigation, SearchWidget } from '@plone/volto/components';
11
11
  import { BodyClass, getCookieOptions } from '@plone/volto/helpers';
12
- import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
12
+ import { FontAwesomeIcon } from '@eeacms/volto-clms-utils/components';
13
13
  import { UniversalLink } from '@plone/volto/components';
14
14
 
15
15
  import { getCartItems } from '@eeacms/volto-clms-utils/actions';
@@ -1,9 +1,12 @@
1
1
  import React from 'react';
2
2
  import { ReactTableWidget } from '@eeacms/volto-react-table-widget';
3
3
  import { useSchema } from './SchemaCreatorWidget';
4
- import { FormBuilder } from '@ginkgo-bioworks/react-json-schema-form-builder/dist/index';
5
4
  import CclButton from '../CclButton/CclButton';
6
5
  import { Segment, Loader, Header, Divider } from 'semantic-ui-react';
6
+ // import loadable from 'loadables/component';
7
+ import { injectLazyLibs } from '@plone/volto/helpers/Loadable';
8
+
9
+ // import { FormBuilder } from '@ginkgo-bioworks/react-json-schema-form-builder/dist/index';
7
10
 
8
11
  const orderKeysBy = (array, data) => {
9
12
  if (data) {
@@ -41,6 +44,8 @@ const fixSchema = (schema) => {
41
44
  };
42
45
 
43
46
  const DownloadableFilesTableWidget = (props) => {
47
+ const lib = props['react-json-schema-form-builder'];
48
+ const { FormBuilder } = lib;
44
49
  const { functions, data } = useSchema(
45
50
  props?.value?.schema,
46
51
  props?.value?.uiSchema,
@@ -162,4 +167,6 @@ const DownloadableFilesTableWidget = (props) => {
162
167
  );
163
168
  };
164
169
 
165
- export default DownloadableFilesTableWidget;
170
+ export default injectLazyLibs('react-json-schema-form-builder')(
171
+ DownloadableFilesTableWidget,
172
+ );
@@ -11,6 +11,14 @@ import { toast } from 'react-toastify';
11
11
  import { compose } from 'redux';
12
12
  import validator from 'validator';
13
13
 
14
+ import { Toast } from '@plone/volto/components';
15
+
16
+ import { FontAwesomeIcon } from '@eeacms/volto-clms-utils/components';
17
+
18
+ // TODO: this import needs to be lazy loaded
19
+ import faLinkedin from '@fortawesome/free-brands-svg-icons/faLinkedin';
20
+ import { subscribeTo } from '../../../../../actions';
21
+
14
22
  import AtmosphereImage from '@eeacms/volto-clms-theme/../theme/clms/img/ccl-icon-atmosphere.svg';
15
23
  import ClimateImage from '@eeacms/volto-clms-theme/../theme/clms/img/ccl-icon-climate.svg';
16
24
  import EmergencyImage from '@eeacms/volto-clms-theme/../theme/clms/img/ccl-icon-emergency.svg';
@@ -22,10 +30,6 @@ import EEAImage from '@eeacms/volto-clms-theme/../theme/clms/img/ec-logo-white.s
22
30
  import ECImage from '@eeacms/volto-clms-theme/../theme/clms/img/eea-logo.svg';
23
31
  import CclFooterColumn from '@eeacms/volto-clms-theme/components/CclFooterColumn/CclFooterColumn';
24
32
  import CclFooterMenu from '@eeacms/volto-clms-theme/components/CclTopMainMenu/CclFooterMenu';
25
- import { faLinkedin } from '@fortawesome/free-brands-svg-icons';
26
- import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
27
- import { Toast } from '@plone/volto/components';
28
- import { subscribeTo } from '../../../../../actions';
29
33
 
30
34
  const messages = defineMessages({
31
35
  copernicusServices: {
@@ -8,6 +8,11 @@ import Unauthorized from './Unauthorized';
8
8
 
9
9
  const mockStore = configureStore();
10
10
 
11
+ jest.mock('@plone/volto/helpers/Loadable/Loadable');
12
+ beforeAll(async () => {
13
+ await require('@plone/volto/helpers/Loadable/Loadable').__setLoadables();
14
+ });
15
+
11
16
  describe('Unauthorized', () => {
12
17
  it('renders a not found component', () => {
13
18
  const store = mockStore({
@@ -19,6 +24,7 @@ describe('Unauthorized', () => {
19
24
  message: 'You are not authorized to access this resource',
20
25
  },
21
26
  });
27
+
22
28
  const component = renderer.create(
23
29
  <Provider store={store}>
24
30
  <MemoryRouter>
package/src/index.js CHANGED
@@ -1,3 +1,4 @@
1
+ import loadable from '@loadable/component';
1
2
  import customBlocks, {
2
3
  customGroupBlocksOrder,
3
4
  } from '@eeacms/volto-clms-theme/components/Blocks/customBlocks';
@@ -41,7 +42,6 @@ import TaxonomyWidget from './components/Widgets/TaxonomyWidget';
41
42
  import ProductComponentsWidget from './components/Widgets/ProductComponentsWidget';
42
43
  import ImageSizeWidget from './components/Widgets/ImageSizeWidget';
43
44
  import { CLMSDateWidget } from './components/Widgets/CLMSDateWidget';
44
- // import { DateWidget } from '@eeacms/volto-widgets-view/components';
45
45
  import { getWidgetView } from '@eeacms/volto-widgets-view/helpers';
46
46
 
47
47
  // CUSTOM REDUCERS IMPORT
@@ -50,7 +50,6 @@ import TextLinkWidget from './components/Widgets/TextLinkWidget';
50
50
  import reducers from './reducers';
51
51
  import CookieBanner from 'volto-cookie-banner/CookieBannerContainer';
52
52
  import CLMSLoginView from './components/CLMSLoginView/CLMSLogin';
53
- // import Login from '@plone/volto/components/Login';
54
53
 
55
54
  //SLATE CONFIGURATION
56
55
  import installLinkEditor from '@plone/volto-slate/editor/plugins/AdvancedLink';
@@ -337,6 +336,14 @@ const applyConfig = (config) => {
337
336
 
338
337
  config.experimental.addBlockButton.enabled = true;
339
338
 
339
+ config.settings.loadables = {
340
+ 'react-json-schema-form-builder': loadable.lib(() =>
341
+ import('@ginkgo-bioworks/react-json-schema-form-builder/dist/index'),
342
+ ),
343
+ utmProjections: loadable.lib(() => import('./constants/utmProjections')),
344
+ ...config.settings.loadables,
345
+ };
346
+
340
347
  return config;
341
348
  };
342
349
  export default applyConfig;