@eeacms/volto-cca-policy 0.2.79 → 0.2.80

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
+ ### [0.2.80](https://github.com/eea/volto-cca-policy/compare/0.2.79...0.2.80) - 15 November 2024
8
+
9
+ #### :rocket: Dependency updates
10
+
11
+ - Release @eeacms/volto-eea-website-theme@3.2.0 [EEA Jenkins - [`1308dd8`](https://github.com/eea/volto-cca-policy/commit/1308dd86de26ed38680967f31b4e83874b54160b)]
12
+
13
+ #### :hammer_and_wrench: Others
14
+
15
+ - Cleanup [Tiberiu Ichim - [`965ac84`](https://github.com/eea/volto-cca-policy/commit/965ac84f05dea092dff9b9900dfc41259b3b2caf)]
16
+ - Downgrade eea website theme [Tiberiu Ichim - [`d074718`](https://github.com/eea/volto-cca-policy/commit/d0747189db37e3496baf11b0886c91b18f70b9d4)]
17
+ - Downgrade eea website theme [Tiberiu Ichim - [`38f482f`](https://github.com/eea/volto-cca-policy/commit/38f482fdb52bf7f35c6102021347d3d77b4ee177)]
18
+ - Add patch for compatibility with volto 17 [Tiberiu Ichim - [`393bb08`](https://github.com/eea/volto-cca-policy/commit/393bb085551b8cdef7a0a29fcddb72e5c95f6255)]
19
+ - Add override for LinkView [Tiberiu Ichim - [`b478df3`](https://github.com/eea/volto-cca-policy/commit/b478df3b6cdaa24cdfffd7146181f66c5e3e5ddb)]
7
20
  ### [0.2.79](https://github.com/eea/volto-cca-policy/compare/0.2.78...0.2.79) - 14 November 2024
8
21
 
9
22
  #### :hammer_and_wrench: Others
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eeacms/volto-cca-policy",
3
- "version": "0.2.79",
3
+ "version": "0.2.80",
4
4
  "description": "@eeacms/volto-cca-policy: Volto add-on",
5
5
  "main": "src/index.js",
6
6
  "author": "European Environment Agency: IDM2 A-Team",
@@ -30,7 +30,7 @@
30
30
  "@eeacms/volto-block-style": "github:eea/volto-block-style#6.x.x",
31
31
  "@eeacms/volto-datablocks": "^7.2.5",
32
32
  "@eeacms/volto-eea-design-system": "*",
33
- "@eeacms/volto-eea-website-theme": "1.35.0",
33
+ "@eeacms/volto-eea-website-theme": "^1.35.0",
34
34
  "@eeacms/volto-embed": "^9.1.1",
35
35
  "@eeacms/volto-globalsearch": "^1.1.0",
36
36
  "@eeacms/volto-hero-block": "^7.1.0",
@@ -0,0 +1,105 @@
1
+ /**
2
+ * Link View.
3
+ * @module components/theme/View/LinkView
4
+ */
5
+
6
+ import React, { Component } from 'react';
7
+ import PropTypes from 'prop-types';
8
+ import { isInternalURL, flattenToAppURL } from '@plone/volto/helpers';
9
+ import { Container as SemanticContainer } from 'semantic-ui-react';
10
+ import { UniversalLink } from '@plone/volto/components';
11
+ import { Redirect } from 'react-router-dom';
12
+ import { FormattedMessage } from 'react-intl';
13
+ import config from '@plone/volto/registry';
14
+
15
+ /**
16
+ * View container class.
17
+ * @class View
18
+ * @extends Component
19
+ */
20
+ class LinkView extends Component {
21
+ /**
22
+ * Property types.
23
+ * @property {Object} propTypes Property types.
24
+ * @static
25
+ */
26
+ static propTypes = {
27
+ content: PropTypes.shape({
28
+ title: PropTypes.string,
29
+ description: PropTypes.string,
30
+ remoteUrl: PropTypes.string,
31
+ }),
32
+ token: PropTypes.string,
33
+ };
34
+
35
+ /**
36
+ * Default properties.
37
+ * @property {Object} defaultProps Default properties.
38
+ * @static
39
+ */
40
+ static defaultProps = {
41
+ content: null,
42
+ token: null,
43
+ };
44
+
45
+ componentDidMount() {
46
+ if (!this.props.token) {
47
+ let { remoteUrl } = this.props.content;
48
+ // eslint-disable-next-line
49
+ remoteUrl = remoteUrl.replaceAll('${portal_url}', '');
50
+
51
+ if (isInternalURL(remoteUrl)) {
52
+ this.props.history.replace(flattenToAppURL(remoteUrl));
53
+ } else if (!__SERVER__) {
54
+ window.location.href = flattenToAppURL(remoteUrl);
55
+ }
56
+ }
57
+ }
58
+
59
+ /**
60
+ * Render method.
61
+ * @method render
62
+ * @returns {string} Markup for the component.
63
+ */
64
+ render() {
65
+ let { remoteUrl } = this.props.content;
66
+ // eslint-disable-next-line
67
+ remoteUrl = flattenToAppURL(remoteUrl.replaceAll('${portal_url}', ''));
68
+
69
+ if (__SERVER__ && !this.props.token && remoteUrl) {
70
+ return <Redirect to={remoteUrl} />;
71
+ }
72
+ const { openExternalLinkInNewTab } = config.settings;
73
+ const Container =
74
+ config.getComponent({ name: 'Container' }).component || SemanticContainer;
75
+
76
+ return (
77
+ <Container id="page-document">
78
+ <h1 className="documentFirstHeading">{this.props.content.title}</h1>
79
+ {this.props.content.description && (
80
+ <p className="documentDescription">
81
+ {this.props.content.description}
82
+ </p>
83
+ )}
84
+ {remoteUrl && (
85
+ <p>
86
+ <FormattedMessage
87
+ id="The link address is:"
88
+ defaultMessage="The link address is:"
89
+ />{' '}
90
+ <UniversalLink
91
+ href={remoteUrl}
92
+ openLinkInNewTab={
93
+ openExternalLinkInNewTab && !isInternalURL(remoteUrl)
94
+ }
95
+ >
96
+ {flattenToAppURL(remoteUrl)}
97
+ </UniversalLink>
98
+ </p>
99
+ )}
100
+ </Container>
101
+ );
102
+ }
103
+ }
104
+
105
+ export default LinkView;