@eeacms/volto-arcgis-block 0.1.389 → 0.1.391

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,18 @@ 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.391](https://github.com/eea/volto-arcgis-block/compare/0.1.390...0.1.391) - 24 September 2025
8
+
9
+ #### :hammer_and_wrench: Others
10
+
11
+ - Merge pull request #1022 from eea/CLMS-292477 [Unai Bolivar - [`4ccf86e`](https://github.com/eea/volto-arcgis-block/commit/4ccf86e244145c0b3e3e899ef122449d0e7e37fa)]
12
+ - (bug): The time slider doesn't load when the web service URL is in proxy format. FIXED [Unai Bolivar - [`fb9980b`](https://github.com/eea/volto-arcgis-block/commit/fb9980b17a0754fe0f50c87c0c8bbc0d20422a27)]
13
+ ### [0.1.390](https://github.com/eea/volto-arcgis-block/compare/0.1.389...0.1.390) - 23 September 2025
14
+
15
+ #### :hammer_and_wrench: Others
16
+
17
+ - Merge pull request #1021 from eea/develop [Unai Bolivar - [`3a1db8d`](https://github.com/eea/volto-arcgis-block/commit/3a1db8db8d64e7ca63f1f1551255df9f443dd695)]
18
+ - (bug): Download area button didn't popup no available data showed up for cdse datasets in certain NUTS 3 counties. [Unai Bolivar - [`1b46d88`](https://github.com/eea/volto-arcgis-block/commit/1b46d88642fdae3ae5235c2a5b91ba02e2a6bbdc)]
7
19
  ### [0.1.389](https://github.com/eea/volto-arcgis-block/compare/0.1.388...0.1.389) - 18 September 2025
8
20
 
9
21
  #### :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.389",
3
+ "version": "0.1.391",
4
4
  "description": "volto-arcgis-block: Volto add-on",
5
5
  "main": "src/index.js",
6
6
  "author": "European Environment Agency: CodeSyntax",
@@ -92,7 +92,8 @@ export const AddCartItem = ({
92
92
  }
93
93
  });
94
94
  };
95
- const checkExtent = (e) => {
95
+ const checkExtent = async (e) => {
96
+ let target = e?.currentTarget;
96
97
  let intersection = false;
97
98
  let areaExtent = null;
98
99
  let check = document.querySelector('.area-panel input:checked')?.value;
@@ -123,7 +124,7 @@ export const AddCartItem = ({
123
124
  areaExtent = areaData?.geometry;
124
125
  }
125
126
  if (dataset?.DatasetTitle) {
126
- Object.keys(props.layers).forEach((id) => {
127
+ for (const id of Object.keys(props.layers)) {
127
128
  if (
128
129
  props.layers[id]?.DatasetTitle &&
129
130
  dataset.DatasetTitle === props.layers[id].DatasetTitle
@@ -140,25 +141,38 @@ export const AddCartItem = ({
140
141
  props.layers[id].fullExtents &&
141
142
  props.layers[id].fullExtents[0]
142
143
  ) {
143
- layerExtent = new Extent({
144
- xmin: props.layers[id].fullExtents[0].xmin,
145
- ymin: props.layers[id].fullExtents[0].ymin,
146
- xmax: props.layers[id].fullExtents[0].xmax,
147
- ymax: props.layers[id].fullExtents[0].ymax,
148
- spatialReference:
149
- props.layers[id].fullExtents[0].spatialReference ||
150
- mapViewer?.view?.spatialReference,
151
- });
152
144
  if (isCDSE) {
153
- try {
154
- const projected = projection.project(
155
- layerExtent,
156
- mapViewer.view.spatialReference,
157
- );
158
- if (projected) {
159
- layerExtent = projected;
160
- }
161
- } catch (e) {}
145
+ let e0 = props.layers[id].fullExtents[0];
146
+ let xmin = e0.xmin;
147
+ let ymin = e0.ymin;
148
+ let xmax = e0.xmax;
149
+ let ymax = e0.ymax;
150
+ for (let i = 1; i < props.layers[id].fullExtents.length; i++) {
151
+ let ex = props.layers[id].fullExtents[i];
152
+ if (!ex) continue;
153
+ if (ex.xmin < xmin) xmin = ex.xmin;
154
+ if (ex.ymin < ymin) ymin = ex.ymin;
155
+ if (ex.xmax > xmax) xmax = ex.xmax;
156
+ if (ex.ymax > ymax) ymax = ex.ymax;
157
+ }
158
+ layerExtent = new Extent({
159
+ xmin: xmin,
160
+ ymin: ymin,
161
+ xmax: xmax,
162
+ ymax: ymax,
163
+ spatialReference:
164
+ e0.spatialReference || mapViewer?.view?.spatialReference,
165
+ });
166
+ } else {
167
+ layerExtent = new Extent({
168
+ xmin: props.layers[id].fullExtents[0].xmin,
169
+ ymin: props.layers[id].fullExtents[0].ymin,
170
+ xmax: props.layers[id].fullExtents[0].xmax,
171
+ ymax: props.layers[id].fullExtents[0].ymax,
172
+ spatialReference:
173
+ props.layers[id].fullExtents[0].spatialReference ||
174
+ mapViewer?.view?.spatialReference,
175
+ });
162
176
  }
163
177
  } else {
164
178
  layerExtent = new Extent({
@@ -179,13 +193,15 @@ export const AddCartItem = ({
179
193
  intersection = true;
180
194
  }
181
195
  }
182
- });
196
+ }
183
197
  if (intersection) {
184
- checkArea();
198
+ try {
199
+ checkArea();
200
+ } catch (error) {}
185
201
  } else {
186
202
  const popupContainer = document.querySelector('.popup-container');
187
203
  if (popupContainer) {
188
- e.currentTarget.appendChild(popupContainer);
204
+ target.appendChild(popupContainer);
189
205
  handleOpenPopup();
190
206
  }
191
207
  }
@@ -86,7 +86,6 @@ class TimesliderWidget extends React.Component {
86
86
 
87
87
  async getCDSEWFSTemporalData(url, layer) {
88
88
  if (!url) return {};
89
- const match = /\/ogc\/(?:wmts|wms)\/([^/?]+)/i.exec(url);
90
89
  const datasetDownloadInformation =
91
90
  layer?.DatasetDownloadInformation ||
92
91
  layer?.DatasetDownloadInformation ||
@@ -95,8 +94,47 @@ class TimesliderWidget extends React.Component {
95
94
  const byocCollectionId =
96
95
  datasetDownloadInformation?.items[0].byoc_collection || null;
97
96
  if (!byocCollectionId) return {};
98
- if (!match) return {};
99
- const fetchUrl = `https://sh.dataspace.copernicus.eu/ogc/wfs/${match[1]}?SERVICE=WFS&REQUEST=GetFeature&VERSION=2.0.0&TYPENAMES=byoc-${byocCollectionId}&COUNT=100&BBOX=-21039383,-22375217,21039383,22375217&OUTPUTFORMAT=application/json`;
97
+ let revProxyUrl = '';
98
+ let cdseDatasetId = '';
99
+ if (typeof url === 'string') {
100
+ try {
101
+ const u = new URL(
102
+ url,
103
+ window.location && window.location.href
104
+ ? window.location.href
105
+ : undefined,
106
+ );
107
+ const parts = u.pathname.split('/').filter(Boolean);
108
+ const idx = parts.indexOf('cdse');
109
+ if (idx !== -1) {
110
+ revProxyUrl = u.origin + '/' + parts[idx] + '/';
111
+ cdseDatasetId = parts[idx + 1] || '';
112
+ } else {
113
+ const base = url.split('?')[0];
114
+ const b = new URL(
115
+ base,
116
+ window.location && window.location.href
117
+ ? window.location.href
118
+ : undefined,
119
+ );
120
+ const bparts = b.pathname.split('/').filter(Boolean);
121
+ cdseDatasetId = bparts[bparts.length - 1] || '';
122
+ revProxyUrl = b.origin + '/';
123
+ }
124
+ } catch (_e) {
125
+ const base = url.split('?')[0];
126
+ const path = base.split('/');
127
+ cdseDatasetId = path[path.length - 1] || '';
128
+ const idx = path.findIndex((p) => p === 'cdse');
129
+ if (idx > 0) {
130
+ revProxyUrl = path.slice(0, idx + 1).join('/') + '/';
131
+ } else {
132
+ revProxyUrl = base.replace(cdseDatasetId, '');
133
+ }
134
+ }
135
+ }
136
+ if (!revProxyUrl || !cdseDatasetId) return {};
137
+ const fetchUrl = `${revProxyUrl}wfs/${cdseDatasetId}?SERVICE=WFS&REQUEST=GetFeature&VERSION=2.0.0&TYPENAMES=byoc-${byocCollectionId}&COUNT=100&BBOX=-21039383,-22375217,21039383,22375217&OUTPUTFORMAT=application/json`;
100
138
  try {
101
139
  const res = await fetch(fetchUrl);
102
140
  const data = await res.json();