@eeacms/volto-arcgis-block 0.1.446 → 0.1.448

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,14 @@ 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.448](https://github.com/eea/volto-arcgis-block/compare/0.1.447...0.1.448) - 11 May 2026
8
+
9
+ #### :hammer_and_wrench: Others
10
+
11
+ - (bug): fix for tickets CLMS-297970, CLMS-288681, CLMS-288445, and implement proxy switching [Unai Bolivar - [`ce3e215`](https://github.com/eea/volto-arcgis-block/commit/ce3e215ed660836bc0f94fcd06536993b448d1b8)]
12
+ - (bug): Area widget loads nuts and countries after using swipe widget [Unai Bolivar - [`324cee2`](https://github.com/eea/volto-arcgis-block/commit/324cee2be67845fd1170425180b5e6562c381fad)]
13
+ ### [0.1.447](https://github.com/eea/volto-arcgis-block/compare/0.1.446...0.1.447) - 8 May 2026
14
+
7
15
  ### [0.1.446](https://github.com/eea/volto-arcgis-block/compare/0.1.445...0.1.446) - 7 May 2026
8
16
 
9
17
  ### [0.1.445](https://github.com/eea/volto-arcgis-block/compare/0.1.444...0.1.445) - 28 April 2026
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eeacms/volto-arcgis-block",
3
- "version": "0.1.446",
3
+ "version": "0.1.448",
4
4
  "description": "volto-arcgis-block: Volto add-on",
5
5
  "main": "src/index.js",
6
6
  "author": "European Environment Agency: CodeSyntax",
@@ -358,7 +358,18 @@ class AreaWidget extends React.Component {
358
358
  });
359
359
  }
360
360
 
361
+ resolveNutsGroupLayerState() {
362
+ if (!this.nutsGroupLayer || !this.props.map || !this.props.map.layers) {
363
+ return;
364
+ }
365
+
366
+ if (!this.props.map.layers.includes(this.nutsGroupLayer)) {
367
+ this.props.map.add(this.nutsGroupLayer);
368
+ }
369
+ }
370
+
361
371
  loadNutsService(id, levels) {
372
+ this.resolveNutsGroupLayerState();
362
373
  this.clearWidget();
363
374
  document.querySelector('.esri-attribution__powered-by').style.display =
364
375
  'flex';
@@ -374,6 +385,7 @@ class AreaWidget extends React.Component {
374
385
  }
375
386
 
376
387
  loadCountriesService(id) {
388
+ this.resolveNutsGroupLayerState();
377
389
  document.querySelector('.esri-attribution__powered-by').style.display =
378
390
  'flex';
379
391
  var layer = new FeatureLayer({
@@ -2307,8 +2307,8 @@ class MenuWidget extends React.Component {
2307
2307
  }
2308
2308
 
2309
2309
  getProxyBase = () => {
2310
- const href = window.location.href || '';
2311
- return href.replace('/en/map-viewer', '/ogcproxy/');
2310
+ const origin = window?.location?.origin || '';
2311
+ return origin ? `${origin}/ogcproxy/` : '/ogcproxy/';
2312
2312
  // return 'https://clmsdemo.devel6cph.eea.europa.eu/ogcproxy/';
2313
2313
  // return 'https://land.copernicus.eu/ogcproxy/';
2314
2314
  };
@@ -2316,7 +2316,12 @@ class MenuWidget extends React.Component {
2316
2316
  buildProxiedUrl(url) {
2317
2317
  if (!url) return url;
2318
2318
  const hasProxy = /\/ogcproxy\//i.test(url);
2319
- return hasProxy ? url : this.getProxyBase() + this.stripProtocol(url);
2319
+ if (hasProxy) {
2320
+ const strippedUrl = this.stripProtocol(url);
2321
+ const proxyPath = strippedUrl.split(/\/ogcproxy\//i)[1] || '';
2322
+ return this.getProxyBase() + proxyPath.replace(/^\/+/, '');
2323
+ }
2324
+ return this.getProxyBase() + this.stripProtocol(url);
2320
2325
  }
2321
2326
 
2322
2327
  parseWMSLayers(xml) {
@@ -284,12 +284,9 @@ class UploadWidget extends React.Component {
284
284
  return queryService;
285
285
  }
286
286
  const pathName = (parsedUrl.pathname || '').toLowerCase();
287
- const pathSegments = pathName.split('/').filter(Boolean);
288
- const serviceMatch = pathSegments.find((segment) =>
289
- /^(wmts|wms|wfs)$/i.test(segment),
290
- );
291
- if (serviceMatch) {
292
- return serviceMatch.toUpperCase();
287
+ const pathServiceType = this.resolveServiceTypeFromPath(pathName);
288
+ if (pathServiceType) {
289
+ return pathServiceType;
293
290
  }
294
291
  return null;
295
292
  } catch (e) {
@@ -297,6 +294,23 @@ class UploadWidget extends React.Component {
297
294
  }
298
295
  };
299
296
 
297
+ resolveServiceTypeFromPath = (pathName) => {
298
+ const value = (pathName || '').toLowerCase();
299
+ if (!value) {
300
+ return null;
301
+ }
302
+ if (/\bwmts\b|\/wmts(?:[/._-]|$)/i.test(value)) {
303
+ return 'WMTS';
304
+ }
305
+ if (/\bwfs\b|\/wfs(?:[/._-]|$)/i.test(value)) {
306
+ return 'WFS';
307
+ }
308
+ if (/\bwms\b|\/wms(?:[/._-]|$)/i.test(value)) {
309
+ return 'WMS';
310
+ }
311
+ return null;
312
+ };
313
+
300
314
  isServiceTypeMatchingUrl = (serviceUrl, selectedServiceType) => {
301
315
  const encodedServiceType = this.getServiceTypeFromUrl(serviceUrl);
302
316
  if (!encodedServiceType) {
@@ -305,18 +319,40 @@ class UploadWidget extends React.Component {
305
319
  return encodedServiceType === selectedServiceType;
306
320
  };
307
321
 
322
+ clearUploadForm = (clearServiceType = false) => {
323
+ this.setState({
324
+ ...this.buildUploadResetState(),
325
+ ...(clearServiceType ? { selectedServiceType: '' } : {}),
326
+ });
327
+ if (this.fileInput && this.fileInput.current) {
328
+ this.fileInput.current.value = null;
329
+ }
330
+ };
331
+
332
+ handleServiceTypeMismatch = () => {
333
+ this.errorPopup('serviceTypeMismatch');
334
+ this.clearUploadForm(true);
335
+ };
336
+
308
337
  stripProtocol = (url) => {
309
338
  return (url || '').replace(/^https?:\/\//i, '');
310
339
  };
311
340
 
312
341
  getProxyBase = () => {
313
- const href = window.location.href || '';
314
- return href.replace('/en/map-viewer', '/ogcproxy/');
342
+ const origin = window?.location?.origin || '';
343
+ return origin ? `${origin}/ogcproxy/` : '/ogcproxy/';
315
344
  // return 'https://clmsdemo.devel6cph.eea.europa.eu/ogcproxy/';
316
345
  // return 'https://land.copernicus.eu/ogcproxy/';
317
346
  };
318
347
 
319
348
  buildProxiedUrl = (url) => {
349
+ if (!url) return url;
350
+ const hasProxy = /\/ogcproxy\//i.test(url);
351
+ if (hasProxy) {
352
+ const strippedUrl = this.stripProtocol(url);
353
+ const proxyPath = strippedUrl.split(/\/ogcproxy\//i)[1] || '';
354
+ return this.getProxyBase() + proxyPath.replace(/^\/+/, '');
355
+ }
320
356
  return this.getProxyBase() + this.stripProtocol(url);
321
357
  };
322
358
 
@@ -528,6 +564,15 @@ class UploadWidget extends React.Component {
528
564
  handleSelectLayers = async () => {
529
565
  const { serviceUrl, selectedServiceType } = this.state;
530
566
  const trimmedServiceUrl = (serviceUrl || '').trim();
567
+ if (
568
+ selectedServiceType &&
569
+ trimmedServiceUrl !== '' &&
570
+ this.isValidUrl(trimmedServiceUrl) &&
571
+ !this.isServiceTypeMatchingUrl(trimmedServiceUrl, selectedServiceType)
572
+ ) {
573
+ this.handleServiceTypeMismatch();
574
+ return;
575
+ }
531
576
  if (
532
577
  selectedServiceType === 'WFS' &&
533
578
  trimmedServiceUrl !== '' &&
@@ -553,6 +598,15 @@ class UploadWidget extends React.Component {
553
598
  const trimmedServiceUrl = (serviceUrl || '').trim();
554
599
  const selectedServiceType = this.state.selectedServiceType;
555
600
  const selectedFeatures = this.state.selectedFeatures;
601
+ if (
602
+ selectedServiceType &&
603
+ trimmedServiceUrl !== '' &&
604
+ this.isValidUrl(trimmedServiceUrl) &&
605
+ !this.isServiceTypeMatchingUrl(trimmedServiceUrl, selectedServiceType)
606
+ ) {
607
+ this.handleServiceTypeMismatch();
608
+ return;
609
+ }
556
610
  if (
557
611
  selectedServiceType &&
558
612
  trimmedServiceUrl !== '' &&
@@ -1018,6 +1072,16 @@ class UploadWidget extends React.Component {
1018
1072
  </div>
1019
1073
  </>
1020
1074
  )}
1075
+ {this.state.infoPopupType === 'serviceTypeMismatch' && (
1076
+ <>
1077
+ <span className="drawRectanglePopup-icon">
1078
+ <FontAwesomeIcon icon={['fas', 'info-circle']} />
1079
+ </span>
1080
+ <div className="drawRectanglePopup-text">
1081
+ Selected service type does not match the provided URL.
1082
+ </div>
1083
+ </>
1084
+ )}
1021
1085
  </div>
1022
1086
  </div>
1023
1087
  </div>