@eeacms/volto-cca-policy 0.3.61 → 0.3.63

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,13 @@ 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.3.63](https://github.com/eea/volto-cca-policy/compare/0.3.62...0.3.63) - 9 July 2025
8
+
9
+ #### :hammer_and_wrench: Others
10
+
11
+ - Bring back geolocation widget [Tiberiu Ichim - [`7d388ac`](https://github.com/eea/volto-cca-policy/commit/7d388ac905688d67fd64a382d853afb562e593e2)]
12
+ ### [0.3.62](https://github.com/eea/volto-cca-policy/compare/0.3.61...0.3.62) - 4 July 2025
13
+
7
14
  ### [0.3.61](https://github.com/eea/volto-cca-policy/compare/0.3.60...0.3.61) - 4 July 2025
8
15
 
9
16
  #### :hammer_and_wrench: Others
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eeacms/volto-cca-policy",
3
- "version": "0.3.61",
3
+ "version": "0.3.63",
4
4
  "description": "@eeacms/volto-cca-policy: Volto add-on",
5
5
  "main": "src/index.js",
6
6
  "author": "European Environment Agency: IDM2 A-Team",
@@ -1,4 +1,5 @@
1
- import { openlayers as ol } from '@eeacms/volto-openlayers-map';
1
+ import { withOpenLayers } from '@eeacms/volto-openlayers-map';
2
+ // import { openlayers as ol } from '@eeacms/volto-openlayers-map';
2
3
  import {
3
4
  Controls,
4
5
  Interactions,
@@ -9,7 +10,7 @@ import {
9
10
  import React, { useState } from 'react';
10
11
  import { useMapContext } from '@eeacms/volto-openlayers-map/hocs';
11
12
 
12
- function PinInteraction({ longitude, latitude, onChange }) {
13
+ function PinInteraction({ longitude, latitude, onChange, ol }) {
13
14
  const mapContext = useMapContext();
14
15
  const { addLayer, addInteraction, map } = mapContext;
15
16
 
@@ -63,13 +64,14 @@ function PinInteraction({ longitude, latitude, onChange }) {
63
64
  const [longitude, latitude] = lonLat;
64
65
  onChange({ latitude, longitude });
65
66
  });
66
- }, [addInteraction, addLayer, map, onChange, latitude, longitude]);
67
+ }, [addInteraction, addLayer, map, onChange, latitude, longitude, ol]);
67
68
 
68
69
  return null;
69
70
  }
70
71
 
71
72
  const TileSetLoader = (props) => {
72
73
  const [tileWMSSources, setTileWMSSources] = useState([]);
74
+ const { ol } = props;
73
75
 
74
76
  React.useEffect(() => {
75
77
  setTileWMSSources([
@@ -83,7 +85,7 @@ const TileSetLoader = (props) => {
83
85
  transition: 0,
84
86
  }),
85
87
  ]);
86
- }, []);
88
+ }, [ol]);
87
89
 
88
90
  return tileWMSSources ? (
89
91
  <MapContainer {...props} source={tileWMSSources[0]} />
@@ -91,7 +93,7 @@ const TileSetLoader = (props) => {
91
93
  };
92
94
 
93
95
  const MapContainer = (props) => {
94
- const { longitude, latitude, source, onChange } = props;
96
+ const { longitude, latitude, source, onChange, ol } = props;
95
97
  return (
96
98
  <Map
97
99
  view={{
@@ -105,6 +107,7 @@ const MapContainer = (props) => {
105
107
  <Layers>
106
108
  <Controls attribution={false} zoom={false} />
107
109
  <PinInteraction
110
+ ol={ol}
108
111
  latitude={latitude}
109
112
  longitude={longitude}
110
113
  onChange={onChange}
@@ -125,4 +128,4 @@ const MapContainer = (props) => {
125
128
  );
126
129
  };
127
130
 
128
- export default TileSetLoader;
131
+ export default withOpenLayers(TileSetLoader);
@@ -204,16 +204,21 @@ class View extends Component {
204
204
  render() {
205
205
  const { views } = config;
206
206
  if (this.props.error && this.props.error.code === 301) {
207
- const base = typeof window !== 'undefined' ? window.location.origin : '';
207
+ // const base = typeof window !== 'undefined' ? window.location.origin : '';
208
208
 
209
209
  const redirect = flattenToAppURL(this.props.error.url)
210
210
  .replaceAll('/++api++', '/')
211
+ .replaceAll('//', '/')
211
212
  .split('?')[0];
213
+ const redirParams = {
214
+ pathname: redirect,
215
+ search: this.props.location.search,
216
+ };
217
+
212
218
  // eslint-disable-next-line no-console
213
- console.log('Redirecting', redirect);
214
- return (
215
- <Redirect to={`${base}${redirect}${this.props.location.search}`} />
216
- );
219
+ console.log('Redirecting', redirParams);
220
+
221
+ return <Redirect to={redirParams} push={true} />;
217
222
  } else if (this.props.error && !this.props.connectionRefused) {
218
223
  let FoundView;
219
224
  if (this.props.error.status === undefined) {
package/src/index.js CHANGED
@@ -43,7 +43,7 @@ import BrokenLinks from './components/theme/Views/BrokenLinks';
43
43
 
44
44
  import { eea_languages, non_eu_langs } from './constants';
45
45
 
46
- // import GeolocationWidget from './components/theme/Widgets/GeolocationWidget';
46
+ import GeolocationWidget from './components/theme/Widgets/GeolocationWidget';
47
47
  // import MigrationButtons from './components/MigrationButtons';
48
48
 
49
49
  const getEnv = () => (typeof window !== 'undefined' ? window.env : process.env);
@@ -430,7 +430,7 @@ const applyConfig = (config) => {
430
430
  };
431
431
  // Custom widgets
432
432
  config.widgets.id.geochars = GeocharsWidget;
433
- // config.widgets.id.geolocation = GeolocationWidget;
433
+ config.widgets.id.geolocation = GeolocationWidget;
434
434
  config.widgets.id.promotional_image = PromotionalImageWidget;
435
435
 
436
436
  if (config.widgets.views?.widget) {