@eeacms/volto-arcgis-block 0.1.400 → 0.1.401

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,11 @@ 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.1.401](https://github.com/eea/volto-arcgis-block/compare/0.1.400...0.1.401) - 29 October 2025
8
+
9
+ #### :hammer_and_wrench: Others
10
+
11
+ - (bug): HOTPSOT widget bugs corrected for sentry and loading mapviewer without downloading unecessary files if widget is not in use [Unai Bolivar - [`d83bcdf`](https://github.com/eea/volto-arcgis-block/commit/d83bcdfafe6979e012ac848362269fe23277bd5b)]
7
12
  ### [0.1.400](https://github.com/eea/volto-arcgis-block/compare/0.1.399...0.1.400) - 29 October 2025
8
13
 
9
14
  #### :hammer_and_wrench: Others
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eeacms/volto-arcgis-block",
3
- "version": "0.1.400",
3
+ "version": "0.1.401",
4
4
  "description": "volto-arcgis-block: Volto add-on",
5
5
  "main": "src/index.js",
6
6
  "author": "European Environment Agency: CodeSyntax",
@@ -75,14 +75,37 @@ class HotspotWidget extends React.Component {
75
75
  this.props.urls.klc_bbox;
76
76
  return esriRequest(url, {
77
77
  responseType: 'json',
78
- }).then((response) => {
79
- const responseJSON = response.data;
80
- this.dataBBox = responseJSON;
81
- });
78
+ })
79
+ .then((response) => {
80
+ const responseJSON = response.data;
81
+ if (Array.isArray(responseJSON)) {
82
+ this.dataBBox = responseJSON;
83
+ } else {
84
+ this.dataBBox = [];
85
+ }
86
+ })
87
+ .catch(async () => {
88
+ try {
89
+ const res = await fetch(url, { credentials: 'same-origin' });
90
+ const text = await res.text();
91
+ const start = text.indexOf('[');
92
+ const end = text.lastIndexOf(']');
93
+ if (start !== -1 && end !== -1) {
94
+ const json = JSON.parse(text.substring(start, end + 1));
95
+ this.dataBBox = Array.isArray(json) ? json : [];
96
+ } else {
97
+ this.dataBBox = [];
98
+ }
99
+ } catch (_) {
100
+ this.dataBBox = [];
101
+ }
102
+ });
82
103
  };
83
104
 
84
105
  setBBoxCoordinates = (data) => {
106
+ if (!data || !Array.isArray(data)) return;
85
107
  let klc_array = data.find((e) => e.klc_code === this.dataKlc_code);
108
+ if (!klc_array || !klc_array.bbox) return;
86
109
  let klc_bbox_coordinates = klc_array.bbox.split(',');
87
110
  let xmin_ymin = klc_bbox_coordinates[0].split(' ');
88
111
  let xmax_ymax = klc_bbox_coordinates[1].split(' ');
@@ -92,10 +115,6 @@ class HotspotWidget extends React.Component {
92
115
  ymin: this.mapCfg.geometryZoomIn.ymin,
93
116
  xmax: this.mapCfg.geometryZoomIn.xmax,
94
117
  ymax: this.mapCfg.geometryZoomIn.ymax,
95
- // xmin: -200,
96
- // ymin: -85,
97
- // xmax: 200,
98
- // ymax: 85,
99
118
  spatialReference: 4326,
100
119
  });
101
120
  this.props.view.constraints.geometry = constraintExtent;
@@ -205,19 +224,15 @@ class HotspotWidget extends React.Component {
205
224
  typeLegend,
206
225
  selectBoxTime,
207
226
  ) {
208
- //sweep the old filtered data
227
+ if (!bboxData || !Array.isArray(bboxData)) return;
209
228
  if (filteredLayersData[typeLegend] !== undefined) {
210
229
  delete filteredLayersData[typeLegend];
211
230
  }
212
- //Find the bbox data for the chosen region
213
231
  let klc_array = bboxData.find((e) => e.klc_code === this.dataKlc_code);
214
-
215
- //Parse the bbox data into finer detail
232
+ if (!klc_array || !klc_array.bbox) return;
216
233
  let klc_bbox_coordinates = klc_array.bbox.split(',');
217
234
  let xmin_ymin = klc_bbox_coordinates[0].split(' ');
218
235
  let xmax_ymax = klc_bbox_coordinates[1].split(' ');
219
-
220
- //Add the filtered data to the filteredLayersData object
221
236
  filteredLayersData[typeLegend] = {
222
237
  klc_code: this.dataKlc_code,
223
238
  year: selectBoxTime,
@@ -242,7 +257,9 @@ class HotspotWidget extends React.Component {
242
257
  this.props.hotspotData && this.props.hotspotData['filteredLayers']
243
258
  ? Object.keys(this.props.hotspotData['filteredLayers'])
244
259
  : [];
245
- let filteredLayersData = this.props.hotspotData['filteredLayerData'] || [];
260
+ let filteredLayersData =
261
+ (this.props.hotspotData && this.props.hotspotData['filteredLayerData']) ||
262
+ [];
246
263
  let layersToAdd = {};
247
264
  let bookmarkHotspotFilter = JSON.parse(
248
265
  localStorage.getItem('bookmarkHotspotFilter'),
@@ -441,9 +458,14 @@ class HotspotWidget extends React.Component {
441
458
  }
442
459
 
443
460
  filteredLayersToHotspotData(layerIds, layersData) {
444
- let updatedFilteredLayers = this.props.hotspotData['filteredLayers'] || {};
445
- let filteredLayersData = this.props.hotspotData['filteredLayersData'] || {};
446
- let newHotspotData = this.props.hotspotData;
461
+ let updatedFilteredLayers =
462
+ (this.props.hotspotData && this.props.hotspotData['filteredLayers']) ||
463
+ {};
464
+ let filteredLayersData =
465
+ (this.props.hotspotData &&
466
+ this.props.hotspotData['filteredLayersData']) ||
467
+ {};
468
+ let newHotspotData = this.props.hotspotData || {};
447
469
  layerIds.forEach((layerId) => {
448
470
  let layer = Object.entries(this.layers).find(
449
471
  ([key, value]) => key === layerId,
@@ -536,7 +558,10 @@ class HotspotWidget extends React.Component {
536
558
 
537
559
  renderApplyFilterButton() {
538
560
  let typeFilter = [];
539
- const activeLayers = Object.keys(this.props.hotspotData['activeLayers']);
561
+ const activeLayers =
562
+ this.props.hotspotData && this.props.hotspotData['activeLayers']
563
+ ? Object.keys(this.props.hotspotData['activeLayers'])
564
+ : [];
540
565
 
541
566
  if (
542
567
  this.container.current.querySelector('.presentLandCoverContainer').style