@eeacms/volto-clms-theme 1.1.85 → 1.1.86

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -4,6 +4,19 @@ 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.86](https://github.com/eea/volto-clms-theme/compare/1.1.85...1.1.86) - 28 November 2023
8
+
9
+ #### :bug: Bug Fixes
10
+
11
+ - fix: compare deeply nutsnames to update correctly the cart area [Ion Lizarazu - [`9fee39c`](https://github.com/eea/volto-clms-theme/commit/9fee39c5c75699d68262b2ddd52e78c16965dcb8)]
12
+ - fix: CLMS-2727 - Header search value modification modifies search block search input value [Ion Lizarazu - [`968fd9a`](https://github.com/eea/volto-clms-theme/commit/968fd9a1a0c5a44903d6a00999ecf08d3061196b)]
13
+
14
+ #### :hammer_and_wrench: Others
15
+
16
+ - CclHomeProductsBlockView snapshot [Ion Lizarazu - [`9be8053`](https://github.com/eea/volto-clms-theme/commit/9be8053f36a13cd4cedb8d7e9f2e62fee4702bac)]
17
+ - changed Link with UniversalLink [Unai - [`30a21f5`](https://github.com/eea/volto-clms-theme/commit/30a21f5e80f9e98114276ed0968d22bbbcf0a909)]
18
+ - Link used for product block view [Unai - [`d45ef23`](https://github.com/eea/volto-clms-theme/commit/d45ef2354c4fd5d3ae35efe69e58d59aa55374df)]
19
+ - new branch for cache error fixes [Unai - [`9646921`](https://github.com/eea/volto-clms-theme/commit/96469217a90a531b3c686ae8f394c4a9f52e38ce)]
7
20
  ### [1.1.85](https://github.com/eea/volto-clms-theme/compare/1.1.84...1.1.85) - 27 November 2023
8
21
 
9
22
  #### :bug: Bug Fixes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eeacms/volto-clms-theme",
3
- "version": "1.1.85",
3
+ "version": "1.1.86",
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",
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { isUrl } from '@plone/volto/helpers';
2
+ import { UniversalLink } from '@plone/volto/components';
3
3
 
4
4
  const CclHomeProductsBlockView = (props) => {
5
5
  const { data } = props;
@@ -9,31 +9,49 @@ const CclHomeProductsBlockView = (props) => {
9
9
  return (
10
10
  <div className="home-products-container">
11
11
  {products?.map((product, index) => (
12
- <div
12
+ <UniversalLink
13
13
  key={index}
14
- role="button"
14
+ href={product?.linkSelector}
15
+ openLinkInNewTab={false}
16
+ // {
17
+ // isUrl(product?.linkSelector)
18
+ // ? flattenToAppURL(product.linkSelector)
19
+ // : isUrl('http://' + product?.linkSelector)
20
+ // ? flattenToAppURL('http://' + product.linkSelector)
21
+ // : flattenToAppURL(window.location + '#')
22
+ // }
15
23
  className={
16
24
  product.productIcon === 'iconless'
17
25
  ? 'home-product home-product-main'
18
26
  : 'home-product'
19
27
  }
20
- tabIndex={0}
21
- onClick={() => {
22
- isUrl(product?.linkSelector)
23
- ? window.location.assign(product.linkSelector)
24
- : isUrl('http://' + product?.linkSelector)
25
- ? window.location.assign('http://' + product.linkSelector)
26
- : window.location.replace(window.location + '#');
27
- }}
28
- onKeyDown={() => {
29
- isUrl(product?.linkSelector)
30
- ? window.location.assign(product.linkSelector)
31
- : isUrl('http://' + product?.linkSelector)
32
- ? window.location.assign('http://' + product.linkSelector)
33
- : window.location.replace(window.location + '#');
34
- }}
35
28
  id={product.productIcon === 'iconless' ? '' : product.productIcon}
36
29
  >
30
+ {/* <div
31
+ key={index}
32
+ role="button"
33
+ className={
34
+ product.productIcon === 'iconless'
35
+ ? 'home-product home-product-main'
36
+ : 'home-product'
37
+ }
38
+ tabIndex={0}
39
+ onClick={() => {
40
+ isUrl(product?.linkSelector)
41
+ ? window.location.assign(product.linkSelector)
42
+ : isUrl('http://' + product?.linkSelector)
43
+ ? window.location.assign('http://' + product.linkSelector)
44
+ : window.location.replace(window.location + '#');
45
+ }}
46
+ onKeyDown={() => {
47
+ isUrl(product?.linkSelector)
48
+ ? window.location.assign(product.linkSelector)
49
+ : isUrl('http://' + product?.linkSelector)
50
+ ? window.location.assign('http://' + product.linkSelector)
51
+ : window.location.replace(window.location + '#');
52
+ }}
53
+ id={product.productIcon === 'iconless' ? '' : product.productIcon}
54
+ > */}
37
55
  {product.productIcon === 'iconless' ? (
38
56
  <h3>{product.title}</h3>
39
57
  ) : (
@@ -44,7 +62,8 @@ const CclHomeProductsBlockView = (props) => {
44
62
  </div>
45
63
  </>
46
64
  )}
47
- </div>
65
+ {/* </div> */}
66
+ </UniversalLink>
48
67
  ))}
49
68
  </div>
50
69
  );
@@ -1,7 +1,17 @@
1
1
  import React from 'react';
2
2
  import renderer from 'react-test-renderer';
3
3
  import CclHomeProductsBlockView from './CclHomeProductsBlockView';
4
+ import { Provider } from 'react-intl-redux';
5
+ import { MemoryRouter } from 'react-router-dom';
6
+ import configureStore from 'redux-mock-store';
4
7
 
8
+ const mockStore = configureStore();
9
+ const store = mockStore({
10
+ intl: {
11
+ locale: 'en',
12
+ messages: {},
13
+ },
14
+ });
5
15
  describe('renders a CclHomeProductsBlockView component', () => {
6
16
  it('iconless style', () => {
7
17
  const data = {
@@ -24,7 +34,13 @@ describe('renders a CclHomeProductsBlockView component', () => {
24
34
  },
25
35
  };
26
36
 
27
- const component = renderer.create(<CclHomeProductsBlockView data={data} />);
37
+ const component = renderer.create(
38
+ <Provider store={store}>
39
+ <MemoryRouter>
40
+ <CclHomeProductsBlockView data={data} />
41
+ </MemoryRouter>
42
+ </Provider>,
43
+ );
28
44
  expect(component).toMatchSnapshot();
29
45
  });
30
46
  it('home-product style', () => {
@@ -48,7 +64,13 @@ describe('renders a CclHomeProductsBlockView component', () => {
48
64
  },
49
65
  };
50
66
 
51
- const component = renderer.create(<CclHomeProductsBlockView data={data} />);
67
+ const component = renderer.create(
68
+ <Provider store={store}>
69
+ <MemoryRouter>
70
+ <CclHomeProductsBlockView data={data} />
71
+ </MemoryRouter>
72
+ </Provider>,
73
+ );
52
74
  expect(component).toMatchSnapshot();
53
75
  });
54
76
  });
@@ -4,13 +4,13 @@ exports[`renders a CclHomeProductsBlockView component home-product style 1`] = `
4
4
  <div
5
5
  className="home-products-container"
6
6
  >
7
- <div
7
+ <a
8
8
  className="home-product"
9
+ href="/example"
9
10
  id="home-product"
10
11
  onClick={[Function]}
11
- onKeyDown={[Function]}
12
- role="button"
13
- tabIndex={0}
12
+ target={null}
13
+ title={null}
14
14
  >
15
15
  <div
16
16
  className="home-product-title"
@@ -20,14 +20,14 @@ exports[`renders a CclHomeProductsBlockView component home-product style 1`] = `
20
20
  <div
21
21
  className="home-product-description"
22
22
  />
23
- </div>
24
- <div
23
+ </a>
24
+ <a
25
25
  className="home-product"
26
+ href="/example"
26
27
  id="home-product"
27
28
  onClick={[Function]}
28
- onKeyDown={[Function]}
29
- role="button"
30
- tabIndex={0}
29
+ target={null}
30
+ title={null}
31
31
  >
32
32
  <div
33
33
  className="home-product-title"
@@ -37,7 +37,7 @@ exports[`renders a CclHomeProductsBlockView component home-product style 1`] = `
37
37
  <div
38
38
  className="home-product-description"
39
39
  />
40
- </div>
40
+ </a>
41
41
  </div>
42
42
  `;
43
43
 
@@ -45,29 +45,29 @@ exports[`renders a CclHomeProductsBlockView component iconless style 1`] = `
45
45
  <div
46
46
  className="home-products-container"
47
47
  >
48
- <div
48
+ <a
49
49
  className="home-product home-product-main"
50
+ href="/example"
50
51
  id=""
51
52
  onClick={[Function]}
52
- onKeyDown={[Function]}
53
- role="button"
54
- tabIndex={0}
53
+ target={null}
54
+ title={null}
55
55
  >
56
56
  <h3>
57
57
  example title1
58
58
  </h3>
59
- </div>
60
- <div
59
+ </a>
60
+ <a
61
61
  className="home-product home-product-main"
62
+ href="/example"
62
63
  id=""
63
64
  onClick={[Function]}
64
- onKeyDown={[Function]}
65
- role="button"
66
- tabIndex={0}
65
+ target={null}
66
+ title={null}
67
67
  >
68
68
  <h3>
69
69
  example title2
70
70
  </h3>
71
- </div>
71
+ </a>
72
72
  </div>
73
73
  `;
@@ -88,6 +88,8 @@ const CLMSCartContent = (props) => {
88
88
  useEffect(() => {
89
89
  p_f.setOriginalDataList(cartItems);
90
90
  }, [cartItems]);
91
+
92
+ const nutsnamesDeepCompare = JSON.stringify(nutsnames.nutsnames);
91
93
  useEffect(() => {
92
94
  const array_ids =
93
95
  cart.length > 0 ? cart?.map((item) => item?.unique_id) : [];
@@ -115,7 +117,7 @@ const CLMSCartContent = (props) => {
115
117
  } else {
116
118
  setCartItems(cleanDuplicatesEntries(newCart));
117
119
  }
118
- }, [cart, datasets_items, nutsnames]);
120
+ }, [cart, datasets_items, nutsnamesDeepCompare]);
119
121
 
120
122
  const selectAllCart = (checked) => {
121
123
  if (checked && cartItems.length > 0) {
@@ -284,6 +284,11 @@ const withSearch = (options) => (WrappedComponent) => {
284
284
  ),
285
285
  );
286
286
  const previousUrlQuery = usePrevious(urlQuery);
287
+ const previousUrlSearchText = usePrevious(urlSearchText);
288
+
289
+ React.useEffect(() => {
290
+ if (urlSearchText !== previousUrlSearchText) setSearchText(urlSearchText);
291
+ }, [previousUrlSearchText, urlSearchText]);
287
292
 
288
293
  React.useEffect(() => {
289
294
  if (!isEqual(urlQuery, previousUrlQuery)) {
@@ -74,7 +74,7 @@ class SearchWidget extends Component {
74
74
  onSubmit(event) {
75
75
  const section = this.state.section ? `&path=${this.props.pathname}` : '';
76
76
  this.props.history.push(
77
- `/${this.props.locale}/global-search?SearchableText=${this.state.text}${section}`,
77
+ `/${this.props.locale}/global-search?query=%5B%7B"i"%3A"SearchableText"%2C"o"%3A"paqo.string.contains"%2C"v"%3A"${this.state.text}${section}"%7D%5D`,
78
78
  );
79
79
  event.preventDefault();
80
80
  }