@eeacms/volto-embed 9.0.7 → 9.1.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.
package/CHANGELOG.md CHANGED
@@ -4,7 +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
- ### [9.0.7](https://github.com/eea/volto-embed/compare/9.0.6...9.0.7) - 11 January 2024
7
+ ### [9.1.1](https://github.com/eea/volto-embed/compare/9.1.0...9.1.1) - 6 February 2024
8
+
9
+ #### :hammer_and_wrench: Others
10
+
11
+ - make sure url is valid [Razvan - [`807f833`](https://github.com/eea/volto-embed/commit/807f833caf8fd5e040b874d043cba0818e5b836f)]
12
+ - fallbacks [Razvan - [`53441ff`](https://github.com/eea/volto-embed/commit/53441ffa005800032ceb7577d20b6f29c30905dd)]
13
+ ### [9.1.0](https://github.com/eea/volto-embed/compare/9.0.7...9.1.0) - 17 January 2024
14
+
15
+ #### :hammer_and_wrench: Others
16
+
17
+ - Release 9.1.0 [Alin Voinea - [`b9921a5`](https://github.com/eea/volto-embed/commit/b9921a52564c7a1ca5664ca26d10f429c32f0e71)]
18
+ - fix tests [Razvan - [`5c75f20`](https://github.com/eea/volto-embed/commit/5c75f20483de681ff5c8dd39e7f0016771dc4472)]
19
+ ### [9.0.7](https://github.com/eea/volto-embed/compare/9.0.6...9.0.7) - 16 January 2024
8
20
 
9
21
  #### :hammer_and_wrench: Others
10
22
 
@@ -15,7 +27,6 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
15
27
  - tests update [andreiggr - [`c2483e1`](https://github.com/eea/volto-embed/commit/c2483e1fd2e788f5d990c5a0791beb43dd8ef4cf)]
16
28
  - clean console [andreiggr - [`a2da2be`](https://github.com/eea/volto-embed/commit/a2da2beb10ebb00ab257f5992a75c2fedce0f094)]
17
29
  - set publicUrl in tests [andreiggr - [`fb9e209`](https://github.com/eea/volto-embed/commit/fb9e209c67745c7053f8f08efe5d4f77d66721a8)]
18
- - screenshot url should be absolute [andreiggr - [`78e4a11`](https://github.com/eea/volto-embed/commit/78e4a1123d2ce7169f87b1e2a2be6411dca1f041)]
19
30
  ### [9.0.6](https://github.com/eea/volto-embed/compare/9.0.5...9.0.6) - 10 January 2024
20
31
 
21
32
  #### :rocket: New Features
@@ -31,6 +42,7 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
31
42
 
32
43
  - test: increase coverage [kreafox - [`2d8e43c`](https://github.com/eea/volto-embed/commit/2d8e43cf3988564306b6aa7b885b0ff398043ce0)]
33
44
  - test: increase coverage [kreafox - [`1fa9052`](https://github.com/eea/volto-embed/commit/1fa9052a3c015361e3a7eae043c418b696262fbe)]
45
+ - test: [JENKINS] fail with logs on coverage [valentinab25 - [`eaabce8`](https://github.com/eea/volto-embed/commit/eaabce87f1ed4b88a25bfc59a75285e858413d6a)]
34
46
  - test: increase cypress timeout [kreafox - [`9bb40a5`](https://github.com/eea/volto-embed/commit/9bb40a5df2b29a55edec24a57fcd6e65f270f13c)]
35
47
  - test: updates [kreafox - [`5b54d02`](https://github.com/eea/volto-embed/commit/5b54d02c6b6392e25f07ef1e286bdbced999592e)]
36
48
  - test: update snapshot [kreafox - [`338f23e`](https://github.com/eea/volto-embed/commit/338f23ee5c6c75ccb6ee2d8d474298553fe3bd53)]
@@ -87,11 +99,13 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
87
99
  - update [Miu Razvan - [`926beb8`](https://github.com/eea/volto-embed/commit/926beb87d2c44907aebe57369312eea7bf22d656)]
88
100
  - update [Miu Razvan - [`da351ae`](https://github.com/eea/volto-embed/commit/da351ae9ffaaef756f7a665618a03fd04cb9b01d)]
89
101
  - use volto-datablocks@develop dependency [Miu Razvan - [`b379d84`](https://github.com/eea/volto-embed/commit/b379d8478657dd39dad066181b349cee7ac2531d)]
102
+ - test: [JENKINS] Use java17 for sonarqube scanner [valentinab25 - [`ddf685a`](https://github.com/eea/volto-embed/commit/ddf685a9481d780a1df2e4f991f93676478c3e05)]
90
103
  ## [8.0.0](https://github.com/eea/volto-embed/compare/7.0.2...8.0.0) - 17 November 2023
91
104
 
92
105
  #### :hammer_and_wrench: Others
93
106
 
94
107
  - tests: add cypress tests [nileshgulia1 - [`e4b2803`](https://github.com/eea/volto-embed/commit/e4b28033114170639787d77976dc13b7f697f704)]
108
+ - test: [JENKINS] Run cypress in started frontend container [valentinab25 - [`83d91d5`](https://github.com/eea/volto-embed/commit/83d91d5716a9ce8ebbbff01a7838711298684be4)]
95
109
  - fix error [Claudia Ifrim - [`553f3af`](https://github.com/eea/volto-embed/commit/553f3af004af034c721dcd6b01de55c258a88c49)]
96
110
  - bump version [Miu Razvan - [`363694a`](https://github.com/eea/volto-embed/commit/363694ae50cdec941fb53b396b75e9a4554d44fb)]
97
111
  ### [7.0.2](https://github.com/eea/volto-embed/compare/7.0.1...7.0.2) - 10 November 2023
@@ -101,6 +115,7 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
101
115
  #### :hammer_and_wrench: Others
102
116
 
103
117
  - add missing less variable [Miu Razvan - [`47683a7`](https://github.com/eea/volto-embed/commit/47683a7816581d117bb88f16e3087864aaa52f5e)]
118
+ - test: [JENKINS] Add cpu limit on cypress docker [valentinab25 - [`ba168e4`](https://github.com/eea/volto-embed/commit/ba168e49554a51a6015a98a77dc0ceab76320218)]
104
119
  ## [7.0.0](https://github.com/eea/volto-embed/compare/6.0.1...7.0.0) - 6 November 2023
105
120
 
106
121
  #### :rocket: New Features
@@ -110,12 +125,15 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
110
125
  #### :house: Internal changes
111
126
 
112
127
  - style: Automated code fix [eea-jenkins - [`c34d6f4`](https://github.com/eea/volto-embed/commit/c34d6f47fd33f728d40254a12c05fe385b27f2e9)]
128
+ - chore: [JENKINS] Refactor automated testing [valentinab25 - [`673f3ff`](https://github.com/eea/volto-embed/commit/673f3ff355baa8d3646e4558ff2be00f36b5a45a)]
113
129
  - chore: husky, lint-staged use fixed versions [valentinab25 - [`31169f7`](https://github.com/eea/volto-embed/commit/31169f73887837463daee76d63b6516046ad49aa)]
114
130
 
115
131
  #### :hammer_and_wrench: Others
116
132
 
117
133
  - update tests [Miu Razvan - [`c906b79`](https://github.com/eea/volto-embed/commit/c906b79149e853f718d924871ce2e633e5e427c8)]
118
134
  - update tests [Miu Razvan - [`11625b6`](https://github.com/eea/volto-embed/commit/11625b65846388a846d1bdf7ebb2e1f8bd103c91)]
135
+ - test: [JENKINS] Increase shm-size to cypress docker [valentinab25 - [`5e7a155`](https://github.com/eea/volto-embed/commit/5e7a15505334c9b81f07172116b49eaefc692ebf)]
136
+ - test: [JENKINS] Improve cypress time [valentinab25 - [`eeb6dcb`](https://github.com/eea/volto-embed/commit/eeb6dcb4b0f8af07496450e6e7783932ebe88bf7)]
119
137
  - Release 7.0.0 [Alin Voinea - [`cbc5c79`](https://github.com/eea/volto-embed/commit/cbc5c79f1b66daf0d599d9de5a1bc7d137bafed8)]
120
138
  - add act in unit tests [Miu Razvan - [`ecf5b2f`](https://github.com/eea/volto-embed/commit/ecf5b2fe553d99ad6a11570d3d34852d557fbe85)]
121
139
  - update [Miu Razvan - [`049cc14`](https://github.com/eea/volto-embed/commit/049cc140bb6ffea4eb3f1555e693e9973ef63d0e)]
@@ -138,6 +156,7 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
138
156
 
139
157
  - test: EN locales, pre-commit fix, feature PRs checks Refs #257193 [valentinab25 - [`dc2de20`](https://github.com/eea/volto-embed/commit/dc2de2084b53043f240ee1efa2588b5037326ed7)]
140
158
  - test: Fix package.json scripts to use makefile [Alin Voinea - [`b4ffca2`](https://github.com/eea/volto-embed/commit/b4ffca24bb8cc4ba2007cc1040cc7b55dc7cc779)]
159
+ - test: Fix eslint and yarn i18n [Alin Voinea - [`1563d0a`](https://github.com/eea/volto-embed/commit/1563d0ab1f54e775a16705bfd3d267303eb2a526)]
141
160
  - i18n: Add en [Alin Voinea - [`b4e0694`](https://github.com/eea/volto-embed/commit/b4e0694ee40ecc195536fd1826adfab8876c5061)]
142
161
  - test: Update Makefile and docker-compose to align it with Jenkinsfile [valentinab25 - [`8f228ca`](https://github.com/eea/volto-embed/commit/8f228ca0644cee0f777a01114895583f387a395c)]
143
162
  - test: increase test coverage - refs #254313 [ana-oprea - [`30354d8`](https://github.com/eea/volto-embed/commit/30354d8a10a78e4fc322e37f4be20ff85cd00bbc)]
@@ -166,6 +185,9 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
166
185
 
167
186
  - Add react-countup to resolutions [kreafox - [`36eb637`](https://github.com/eea/volto-embed/commit/36eb637c0cb9413b0b0e0ce53e621b2289929d65)]
168
187
  - Move generic classes to privacy-protection [kreafox - [`715d559`](https://github.com/eea/volto-embed/commit/715d559e370bf7a3489b64d357b0a6cd7b1a3af2)]
188
+ - Add Sonarqube tag using eea-website-frontend addons list [EEA Jenkins - [`5715b4d`](https://github.com/eea/volto-embed/commit/5715b4d3fcc14a34e031c383275c685d88f4db44)]
189
+ - Add Sonarqube tag using eea-website-frontend addons list [EEA Jenkins - [`ef24ac0`](https://github.com/eea/volto-embed/commit/ef24ac05b17f4f4dbf05ceafbee677012a7f28f5)]
190
+ - Add Sonarqube tag using eea-website-frontend addons list [EEA Jenkins - [`81f957b`](https://github.com/eea/volto-embed/commit/81f957b51aef7be59214530b774de8547bee3f5f)]
169
191
  ### [5.0.2](https://github.com/eea/volto-embed/compare/5.0.1...5.0.2) - 20 March 2023
170
192
 
171
193
  #### :hammer_and_wrench: Others
@@ -180,6 +202,7 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
180
202
  - update .project.eslintrc.js [Miu Razvan - [`628fd40`](https://github.com/eea/volto-embed/commit/628fd402b00d075ce319b9be92ff5f0e4d0ca2c4)]
181
203
  - rename schema.jsx [Miu Razvan - [`62794e3`](https://github.com/eea/volto-embed/commit/62794e398eab5117132e5622cab735f6cf4f79fd)]
182
204
  - improving code quality as per sonarqube reported issues [tedw87 - [`c7842f7`](https://github.com/eea/volto-embed/commit/c7842f7795f344e9d30538ddf2da04e97e319ebe)]
205
+ - Add Sonarqube tag using cca-frontend addons list [EEA Jenkins - [`fe3a2de`](https://github.com/eea/volto-embed/commit/fe3a2de6180796c3d6b569733d2b9365a669c23e)]
183
206
  ## [5.0.0](https://github.com/eea/volto-embed/compare/4.0.4...5.0.0) - 31 October 2022
184
207
 
185
208
  #### :hammer_and_wrench: Others
@@ -199,6 +222,8 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
199
222
 
200
223
  - use specific alpha for addon test [andreiggr - [`e6df633`](https://github.com/eea/volto-embed/commit/e6df633aa4d2b0ee7eeb6b5aafa21528f14cd1df)]
201
224
  - add optional height to privacy container [andreiggr - [`e2ac711`](https://github.com/eea/volto-embed/commit/e2ac711db4e461b474cade42109346a73bb8ecbd)]
225
+ - Add Sonarqube tag using marine-frontend addons list [EEA Jenkins - [`9f3f358`](https://github.com/eea/volto-embed/commit/9f3f35882fb367d72c7916abe7cbf366dbd8d5b6)]
226
+ - Add Sonarqube tag using bise-frontend addons list [EEA Jenkins - [`7677140`](https://github.com/eea/volto-embed/commit/767714006abf7cbe336c5ab00d76c7232d5bc798)]
202
227
  ### [4.0.2](https://github.com/eea/volto-embed/compare/4.0.1...4.0.2) - 15 July 2022
203
228
 
204
229
  #### :hammer_and_wrench: Others
@@ -238,6 +263,7 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
238
263
 
239
264
  - Update package.json [Nilesh - [`0ec673a`](https://github.com/eea/volto-embed/commit/0ec673a8178731b8c1e010101caee2a3c9fafaca)]
240
265
  - Update package.json [Nilesh - [`b8b94ec`](https://github.com/eea/volto-embed/commit/b8b94ec64672229f464b9108b4ac01a848827c00)]
266
+ - Add Sonarqube tag using freshwater-frontend addons list [EEA Jenkins - [`cfe04d8`](https://github.com/eea/volto-embed/commit/cfe04d885255bb8e472a3b268b98e3d7b9022437)]
241
267
  - Refs #142010 - Optimize Volto-addons gitflow pipelines [valentinab25 - [`bf197dd`](https://github.com/eea/volto-embed/commit/bf197dd6516f9c18994add19b1141e061a96e2b6)]
242
268
  - no hardcoded text [Daniela Mormocea - [`4001bb4`](https://github.com/eea/volto-embed/commit/4001bb414df05c1516f95e4dcec4a328406dc63f)]
243
269
  - fix [Daniela Mormocea - [`a41ca9a`](https://github.com/eea/volto-embed/commit/a41ca9a2795a59f2633fb97938244e335dca8c43)]
@@ -311,6 +337,8 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
311
337
  - revert use of custom bg image [nileshgulia1 - [`63a74b7`](https://github.com/eea/volto-embed/commit/63a74b7e671d85b602b0190c7a18e6d6ad71341b)]
312
338
  - PrivacyProtection update & accept bg image [Andrei Grigore - [`f3f05d1`](https://github.com/eea/volto-embed/commit/f3f05d1d21fc88b90de3f68a995242b6c359e03a)]
313
339
  - fix loading of cookies [nileshgulia1 - [`46348d8`](https://github.com/eea/volto-embed/commit/46348d8321b4633a3d5fdcbfb2c4f01912d7ed2a)]
340
+ - Add Sonarqube tag using frontend addons list [EEA Jenkins - [`a1e1f50`](https://github.com/eea/volto-embed/commit/a1e1f50db8a1ebc11261c3a24c39687c00ca7eea)]
341
+ - Add Sonarqube tag using frontend addons list [EEA Jenkins - [`1e1471e`](https://github.com/eea/volto-embed/commit/1e1471ebab5ba6e5bf0c231ddd0de94d8fe6c846)]
314
342
  ### [2.0.1](https://github.com/eea/volto-embed/compare/2.0.0...2.0.1) - 28 May 2021
315
343
 
316
344
  #### :hammer_and_wrench: Others
@@ -1,3 +1,5 @@
1
+ require('dotenv').config({ path: __dirname + '/.env' });
2
+
1
3
  module.exports = {
2
4
  testMatch: ['**/src/addons/**/?(*.)+(spec|test).[jt]s?(x)'],
3
5
  collectCoverageFrom: [
@@ -36,7 +38,9 @@ module.exports = {
36
38
  statements: 5,
37
39
  },
38
40
  },
39
- setupFilesAfterEnv: [
40
- '<rootDir>/node_modules/@eeacms/volto-embed/jest.setup.js',
41
- ],
41
+ ...(process.env.JEST_USE_SETUP === 'ON' && {
42
+ setupFilesAfterEnv: [
43
+ '<rootDir>/node_modules/@eeacms/volto-embed/jest.setup.js',
44
+ ],
45
+ }),
42
46
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eeacms/volto-embed",
3
- "version": "9.0.7",
3
+ "version": "9.1.1",
4
4
  "description": "Embed external content",
5
5
  "main": "src/index.js",
6
6
  "author": "European Environment Agency: IDM2 A-Team",
@@ -27,6 +27,7 @@
27
27
  "@plone/scripts": "*",
28
28
  "babel-plugin-transform-class-properties": "^6.24.1",
29
29
  "cypress-fail-fast": "^5.0.1",
30
+ "dotenv": "16.3.2",
30
31
  "husky": "^8.0.3",
31
32
  "lint-staged": "^14.0.1",
32
33
  "md5": "^2.3.0"
@@ -65,7 +65,6 @@ function View(props) {
65
65
  parameters,
66
66
  useVisibilitySensor = true,
67
67
  with_notes = true,
68
- with_sources = true,
69
68
  with_more_info = true,
70
69
  with_share = true,
71
70
  with_enlarge = true,
@@ -92,7 +91,7 @@ function View(props) {
92
91
 
93
92
  useEffect(() => {
94
93
  const mapsId = maps['@id'] ? flattenToAppURL(maps['@id']) : undefined;
95
- if (url && url !== mapsId) {
94
+ if (mode === 'edit' && !maps.error && url && url !== mapsId) {
96
95
  getContent(url, null, id);
97
96
  }
98
97
  }, [id, getContent, mode, url, maps]);
@@ -101,6 +100,10 @@ function View(props) {
101
100
  return <Message>Please select a map from block editor.</Message>;
102
101
  }
103
102
 
103
+ if (maps?.error) {
104
+ return <p dangerouslySetInnerHTML={{ __html: maps.error }} />;
105
+ }
106
+
104
107
  if (!maps) {
105
108
  return null;
106
109
  }
@@ -114,7 +117,7 @@ function View(props) {
114
117
  parameters: queryParams,
115
118
  height: height || maps.height,
116
119
  with_notes,
117
- with_sources,
120
+ with_sources: true,
118
121
  with_more_info,
119
122
  with_share,
120
123
  with_enlarge,
@@ -39,13 +39,7 @@ export default (props) => {
39
39
  {
40
40
  id: 'toolbar',
41
41
  title: 'Toolbar',
42
- fields: [
43
- 'with_notes',
44
- 'with_sources',
45
- 'with_more_info',
46
- 'with_share',
47
- 'with_enlarge',
48
- ],
42
+ fields: ['with_notes', 'with_more_info', 'with_share', 'with_enlarge'],
49
43
  },
50
44
  {
51
45
  id: 'parameters',
@@ -145,11 +145,17 @@ class Edit extends Component {
145
145
  * @returns {undefined}
146
146
  */
147
147
  onSubmitUrl() {
148
- this.props.onChangeBlock(this.props.block, {
149
- ...this.props.data,
150
- url: this.getSrc(this.state.url),
151
- privacy_notification: this.state.privacy_notification,
152
- });
148
+ try {
149
+ const url = this.getSrc(this.state.url);
150
+ new URL(url);
151
+ this.props.onChangeBlock(this.props.block, {
152
+ ...this.props.data,
153
+ url: this.getSrc(this.state.url),
154
+ privacy_notification: this.state.privacy_notification,
155
+ });
156
+ } catch {
157
+ this.setState({ error: true });
158
+ }
153
159
  }
154
160
 
155
161
  /**
@@ -21,8 +21,8 @@ const messages = defineMessages({
21
21
 
22
22
  function MapEditorModal({ id, onClose, onChange, ...rest }) {
23
23
  const intl = useIntl();
24
- const [value, setValue] = useState(rest.value);
25
- const [url, setUrl] = useState(rest.value.url);
24
+ const [value, setValue] = useState(rest.value || {});
25
+ const [url, setUrl] = useState(rest.value?.url || '');
26
26
  const [error, setError] = useState(false);
27
27
 
28
28
  const schema = useMemo(
@@ -213,11 +213,11 @@ export default function MapsWidget(props) {
213
213
  </Button>
214
214
  </div>
215
215
  {description && <p className="help">{description}</p>}
216
- {value.url && <EmbedMap {...props} data={value} />}
216
+ {value?.url && <EmbedMap {...props} data={value} />}
217
217
  {mapEditor && (
218
218
  <MapEditorModal
219
219
  id={id}
220
- value={value}
220
+ value={value || {}}
221
221
  onChange={onChange}
222
222
  onClose={() => setMapEditor(false)}
223
223
  />