@eeacms/volto-eea-website-policy 1.15.0 → 2.1.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.
package/CHANGELOG.md CHANGED
@@ -4,6 +4,50 @@ 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
+ ### [2.1.0](https://github.com/eea/volto-eea-website-policy/compare/2.0.0...2.1.0) - 9 May 2024
8
+
9
+ #### :rocket: New Features
10
+
11
+ - feat: integrated EEA Azure AD authentication - refs #258877 [Alexandru Ghica - [`7ff72c1`](https://github.com/eea/volto-eea-website-policy/commit/7ff72c1567524ce73ec72e6a30e91d6d29342510)]
12
+
13
+ #### :hammer_and_wrench: Others
14
+
15
+ - Release 2.1.0 [alin - [`da22af4`](https://github.com/eea/volto-eea-website-policy/commit/da22af436092236d7ef6e8568e3eca4813d517b5)]
16
+ ## [2.0.0](https://github.com/eea/volto-eea-website-policy/compare/1.15.0...2.0.0) - 22 April 2024
17
+
18
+ #### :rocket: New Features
19
+
20
+ - feat: Release 2.0.0 - Volto 17 support [alin - [`d6cf5c8`](https://github.com/eea/volto-eea-website-policy/commit/d6cf5c8f41950a94cd68e7a36a45b5be8cc6195b)]
21
+
22
+ #### :nail_care: Enhancements
23
+
24
+ - refactor: Move customizations to volto-eea-website-theme [alin - [`9641437`](https://github.com/eea/volto-eea-website-policy/commit/9641437c7f10ba6c7ec1f896b180b49d2718a7d0)]
25
+
26
+ ### [1.15.0](https://github.com/eea/volto-eea-website-policy/compare/1.14.1-beta.1...1.15.0) - 9 May 2024
27
+
28
+ #### :rocket: New Features
29
+
30
+ - feat: integrated EEA Azure AD authentication - refs #258877 [Alexandru Ghica - [`1897659`](https://github.com/eea/volto-eea-website-policy/commit/18976594a9c7b4f2640dc79ab6420f509e7de668)]
31
+ - feat: Default view layout restriction to Manager - refs #268249 [ichim-david - [`1840c1b`](https://github.com/eea/volto-eea-website-policy/commit/1840c1bd9aae6ce18a23800ce618f8bbe47525ab)]
32
+
33
+ #### :hammer_and_wrench: Others
34
+
35
+ - Release 1.15.0 [alin - [`f0d61d8`](https://github.com/eea/volto-eea-website-policy/commit/f0d61d8bd99687f0460acd0a1ad6e200206b5b6a)]
36
+ ### [1.14.1-beta.1](https://github.com/eea/volto-eea-website-policy/compare/1.14.1-beta.0...1.14.1-beta.1) - 19 April 2024
37
+
38
+ #### :hammer_and_wrench: Others
39
+
40
+ - Release 1.14.1-beta.1 [nileshgulia1 - [`417ea33`](https://github.com/eea/volto-eea-website-policy/commit/417ea33818550b3f94a576e0a8c98dfd1b1b0d30)]
41
+ ### [1.14.1-beta.0](https://github.com/eea/volto-eea-website-policy/compare/1.14.0...1.14.1-beta.0) - 19 April 2024
42
+
43
+ #### :house: Internal changes
44
+
45
+ - style: Automated code fix [eea-jenkins - [`6738335`](https://github.com/eea/volto-eea-website-policy/commit/6738335d49068446818199eb5eee352b3ff03f38)]
46
+
47
+ #### :hammer_and_wrench: Others
48
+
49
+ - ensure logout works [dobri1408 - [`bf0dca4`](https://github.com/eea/volto-eea-website-policy/commit/bf0dca4f615ef687da8309aef1bf894b3fea4938)]
50
+ - azure_login [dobri1408 - [`c6222f9`](https://github.com/eea/volto-eea-website-policy/commit/c6222f9a97cf7956020f715f76a012051332503b)]
7
51
  ### [1.14.0](https://github.com/eea/volto-eea-website-policy/compare/1.13.1...1.14.0) - 16 April 2024
8
52
 
9
53
  #### :rocket: New Features
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eeacms/volto-eea-website-policy",
3
- "version": "1.15.0",
3
+ "version": "2.1.0",
4
4
  "description": "@eeacms/volto-eea-website-policy: Volto add-on",
5
5
  "main": "src/index.js",
6
6
  "author": "European Environment Agency: IDM2 A-Team",
@@ -1,306 +0,0 @@
1
- import React, { Component, Fragment } from 'react';
2
- import PropTypes from 'prop-types';
3
- import { connect } from 'react-redux';
4
- import { compose } from 'redux';
5
- import { injectLazyLibs } from '@plone/volto/helpers/Loadable/Loadable';
6
-
7
- import jwtDecode from 'jwt-decode';
8
- import {
9
- getSchema,
10
- getUser,
11
- updateContent,
12
- getContent,
13
- } from '@plone/volto/actions';
14
- import { getLayoutFieldname } from '@plone/volto/helpers';
15
- import { FormFieldWrapper, Icon } from '@plone/volto/components';
16
- import { defineMessages, injectIntl } from 'react-intl';
17
- import config from '@plone/volto/registry';
18
-
19
- import downSVG from '@plone/volto/icons/down-key.svg';
20
- import upSVG from '@plone/volto/icons/up-key.svg';
21
- import checkSVG from '@plone/volto/icons/check.svg';
22
-
23
- const messages = defineMessages({
24
- Viewmode: {
25
- id: 'Viewmode',
26
- defaultMessage: 'View',
27
- },
28
- });
29
-
30
- const Option = injectLazyLibs('reactSelect')((props) => {
31
- const { Option } = props.reactSelect.components;
32
- return (
33
- <Option {...props}>
34
- <div>{props.label}</div>
35
- {props.isFocused && !props.isSelected && (
36
- <Icon name={checkSVG} size="18px" color="#b8c6c8" />
37
- )}
38
- {props.isSelected && <Icon name={checkSVG} size="18px" color="#007bc1" />}
39
- </Option>
40
- );
41
- });
42
-
43
- const DropdownIndicator = injectLazyLibs('reactSelect')((props) => {
44
- const { DropdownIndicator } = props.reactSelect.components;
45
- return (
46
- <DropdownIndicator {...props}>
47
- {props.selectProps.menuIsOpen ? (
48
- <Icon name={upSVG} size="24px" color="#007bc1" />
49
- ) : (
50
- <Icon name={downSVG} size="24px" color="#007bc1" />
51
- )}
52
- </DropdownIndicator>
53
- );
54
- });
55
-
56
- const selectTheme = (theme) => ({
57
- ...theme,
58
- borderRadius: 0,
59
- colors: {
60
- ...theme.colors,
61
- primary25: 'hotpink',
62
- primary: '#b8c6c8',
63
- },
64
- });
65
-
66
- const customSelectStyles = {
67
- control: (styles, state) => ({
68
- ...styles,
69
- border: 'none',
70
- borderBottom: '2px solid #b8c6c8',
71
- boxShadow: 'none',
72
- borderBottomStyle: state.menuIsOpen ? 'dotted' : 'solid',
73
- }),
74
- menu: (styles, state) => ({
75
- ...styles,
76
- top: null,
77
- marginTop: 0,
78
- boxShadow: 'none',
79
- borderBottom: '2px solid #b8c6c8',
80
- }),
81
- menuList: (styles, state) => ({
82
- ...styles,
83
- maxHeight: '400px',
84
- }),
85
- indicatorSeparator: (styles) => ({
86
- ...styles,
87
- width: null,
88
- }),
89
- valueContainer: (styles) => ({
90
- ...styles,
91
- padding: 0,
92
- }),
93
- option: (styles, state) => ({
94
- ...styles,
95
- backgroundColor: null,
96
- minHeight: '50px',
97
- display: 'flex',
98
- justifyContent: 'space-between',
99
- alignItems: 'center',
100
- padding: '12px 12px',
101
- color: state.isSelected
102
- ? '#007bc1'
103
- : state.isFocused
104
- ? '#4a4a4a'
105
- : 'inherit',
106
- ':active': {
107
- backgroundColor: null,
108
- },
109
- span: {
110
- flex: '0 0 auto',
111
- },
112
- svg: {
113
- flex: '0 0 auto',
114
- },
115
- }),
116
- };
117
-
118
- /**
119
- * Display container class.
120
- * @class Display
121
- * @extends Component
122
- */
123
- class DisplaySelect extends Component {
124
- /**
125
- * Property types.
126
- * @property {Object} propTypes Property types.
127
- * @static
128
- */
129
- static propTypes = {
130
- getSchema: PropTypes.func.isRequired,
131
- updateContent: PropTypes.func.isRequired,
132
- getContent: PropTypes.func.isRequired,
133
- loaded: PropTypes.bool.isRequired,
134
- pathname: PropTypes.string.isRequired,
135
- layouts: PropTypes.arrayOf(PropTypes.string),
136
- layout: PropTypes.string,
137
- type: PropTypes.string.isRequired,
138
- };
139
-
140
- /**
141
- * Default properties
142
- * @property {Object} defaultProps Default properties.
143
- * @static
144
- */
145
- static defaultProps = {
146
- layouts: [],
147
- layout: '',
148
- rolesWhoCanChangeLayout: [],
149
- };
150
-
151
- state = {
152
- hasMatchingRole: false,
153
- selectedOption: {
154
- value: this.props.layout,
155
- label: config.views.layoutViewsNamesMapping?.[this.props.layout]
156
- ? this.props.intl.formatMessage({
157
- id: config.views.layoutViewsNamesMapping?.[this.props.layout],
158
- defaultMessage:
159
- config.views.layoutViewsNamesMapping?.[this.props.layout],
160
- })
161
- : this.props.layout,
162
- },
163
- };
164
-
165
- componentDidMount() {
166
- this.props.getSchema(this.props.type);
167
- }
168
-
169
- UNSAFE_componentWillMount() {
170
- if (!this.props.rolesWhoCanChangeLayout.length) {
171
- this.props.rolesWhoCanChangeLayout.push(
172
- ...(config?.settings?.eea?.rolesWhoCanChangeLayout || []),
173
- );
174
- }
175
- if (!this.props.layouts.length) {
176
- this.props.getSchema(this.props.type);
177
- }
178
- if (Object.keys(this.props.user).length === 0) {
179
- this.props.getUser(this.props.userId);
180
- } else {
181
- const hasMatchingRole = this.props.user.roles.some((role) =>
182
- this.props.rolesWhoCanChangeLayout.includes(role),
183
- );
184
- if (hasMatchingRole !== this.state.hasMatchingRole) {
185
- this.setState({ hasMatchingRole });
186
- }
187
- }
188
- }
189
-
190
- /**
191
- * Component will receive props
192
- * @method componentWillReceiveProps
193
- * @param {Object} nextProps Next properties
194
- * @returns {undefined}
195
- */
196
- UNSAFE_componentWillReceiveProps(nextProps) {
197
- if (nextProps.pathname !== this.props.pathname) {
198
- this.props.getSchema(nextProps.type);
199
- }
200
- if (!this.props.loaded && nextProps.loaded) {
201
- this.props.getContent(nextProps.pathname);
202
- }
203
-
204
- if (Object.keys(nextProps.user).length !== 0) {
205
- const hasMatchingRole = nextProps.user.roles.some((role) =>
206
- this.props.rolesWhoCanChangeLayout.includes(role),
207
- );
208
- if (hasMatchingRole !== this.state.hasMatchingRole) {
209
- this.setState({ hasMatchingRole });
210
- }
211
- }
212
- }
213
-
214
- /**
215
- * On set layout handler
216
- * @method setLayout
217
- * @param {Object} event Event object
218
- * @returns {undefined}
219
- */
220
- setLayout = (selectedOption) => {
221
- this.props.updateContent(this.props.pathname, {
222
- layout: selectedOption.value,
223
- });
224
- this.setState({ selectedOption });
225
- };
226
-
227
- selectValue = (option) => (
228
- <Fragment>
229
- <span className="Select-value-label">{option.label}</span>
230
- </Fragment>
231
- );
232
-
233
- optionRenderer = (option) => (
234
- <Fragment>
235
- <span style={{ marginRight: 'auto' }}>{option.label}</span>
236
- <Icon name={checkSVG} size="24px" />
237
- </Fragment>
238
- );
239
-
240
- render() {
241
- if (!this.state.hasMatchingRole) {
242
- return null;
243
- }
244
- const { selectedOption } = this.state;
245
- const Select = this.props.reactSelect.default;
246
- const layoutsNames = config.views.layoutViewsNamesMapping;
247
- const layoutOptions = this.props.layouts
248
- .filter(
249
- (layout) =>
250
- Object.keys(config.views.contentTypesViews).includes(layout) ||
251
- Object.keys(config.views.layoutViews).includes(layout),
252
- )
253
- .map((item) => ({
254
- value: item,
255
- label:
256
- this.props.intl.formatMessage({
257
- id: layoutsNames[item],
258
- defaultMessage: layoutsNames[item],
259
- }) || item,
260
- }));
261
-
262
- return layoutOptions?.length > 1 ? (
263
- <FormFieldWrapper
264
- id="display-select"
265
- title={this.props.intl.formatMessage(messages.Viewmode)}
266
- {...this.props}
267
- >
268
- <Select
269
- name="display-select"
270
- className="react-select-container"
271
- classNamePrefix="react-select"
272
- options={layoutOptions}
273
- styles={customSelectStyles}
274
- theme={selectTheme}
275
- components={{ DropdownIndicator, Option }}
276
- onChange={this.setLayout}
277
- defaultValue={selectedOption}
278
- isSearchable={false}
279
- />
280
- </FormFieldWrapper>
281
- ) : null;
282
- }
283
- }
284
-
285
- export default compose(
286
- injectIntl,
287
- injectLazyLibs('reactSelect'),
288
- connect(
289
- (state) => ({
290
- loaded: state.content.update.loaded,
291
- layouts: state.schema.schema ? state.schema.schema.layouts : [],
292
- layout: state.content.data
293
- ? state.content.data[getLayoutFieldname(state.content.data)]
294
- : '',
295
- layout_fieldname: state.content.data
296
- ? getLayoutFieldname(state.content.data)
297
- : '',
298
- type: state.content.data ? state.content.data['@type'] : '',
299
- user: state.users.user,
300
- userId: state.userSession.token
301
- ? jwtDecode(state.userSession.token).sub
302
- : '',
303
- }),
304
- { getSchema, getUser, updateContent, getContent },
305
- ),
306
- )(DisplaySelect);
@@ -1 +0,0 @@
1
- Added customization to condition the display of the layout options based on the user's roles.