@eeacms/volto-cca-policy 0.1.25 → 0.1.27

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,11 +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
- ### [0.1.25](https://github.com/eea/volto-cca-policy/compare/0.1.24...0.1.25) - 13 June 2023
7
+ ### [0.1.27](https://github.com/eea/volto-cca-policy/compare/0.1.26...0.1.27) - 14 June 2023
8
+
9
+ #### :hammer_and_wrench: Others
10
+
11
+ - Better env [Tiberiu Ichim - [`bca1e73`](https://github.com/eea/volto-cca-policy/commit/bca1e73a033f0ba950505087ad36baf0250f98e8)]
12
+ ### [0.1.26](https://github.com/eea/volto-cca-policy/compare/0.1.25...0.1.26) - 13 June 2023
8
13
 
9
14
  #### :hammer_and_wrench: Others
10
15
 
11
- - Temporary disable external routes config (test issue in demo). [GhitaB - [`ea7ddfd`](https://github.com/eea/volto-cca-policy/commit/ea7ddfdb7311891d9e6f5946c2f6d4bca93cfef8)]
16
+ - Fix condition for external routes. [GhitaB - [`9d30963`](https://github.com/eea/volto-cca-policy/commit/9d3096380aa920d7ca7d14020689c491e5c74821)]
17
+ - Restore external routes config. [GhitaB - [`6ffa31c`](https://github.com/eea/volto-cca-policy/commit/6ffa31c698f79eae4d0701c8ff545c3921dda3e4)]
18
+ ### [0.1.25](https://github.com/eea/volto-cca-policy/compare/0.1.24...0.1.25) - 13 June 2023
19
+
12
20
  ### [0.1.24](https://github.com/eea/volto-cca-policy/compare/0.1.23...0.1.24) - 12 June 2023
13
21
 
14
22
  #### :hammer_and_wrench: Others
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eeacms/volto-cca-policy",
3
- "version": "0.1.25",
3
+ "version": "0.1.27",
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",
package/src/index.js CHANGED
@@ -23,24 +23,29 @@ import installSearchEngine from './search';
23
23
  import GeocharsWidget from './components/theme/Widgets/GeocharsWidget';
24
24
  import GeolocationWidget from './components/theme/Widgets/GeolocationWidget';
25
25
 
26
+ const getEnv = () => (typeof window !== 'undefined' ? window.env : process.env);
27
+
26
28
  const applyConfig = (config) => {
27
- // const notInEnMission = /^(?!(\/en\/mission)).*$/;
28
- // WIP, test redirect issue (do not deploy in production)
29
- // if (!__DEVELOPMENT__ && !process.env.RAZZLE_DISABLE_EXTERNAL_ROUTES) {
30
- // config.settings.externalRoutes = [
31
- // ...(config.settings.externalRoutes || []),
32
- // {
33
- // match: {
34
- // path: notInEnMission,
35
- // exact: false,
36
- // strict: false,
37
- // },
38
- // url(payload) {
39
- // return payload.location.pathname;
40
- // },
41
- // },
42
- // ];
43
- // }
29
+ const notInEnMission = /^(?!(\/en\/mission)).*$/;
30
+ const env = getEnv();
31
+ const isStaging = !!env.RAZZLE_IS_STAGING;
32
+ const enableMissionIsExternal = !isStaging && !__DEVELOPMENT__;
33
+
34
+ if (enableMissionIsExternal) {
35
+ config.settings.externalRoutes = [
36
+ ...(config.settings.externalRoutes || []),
37
+ {
38
+ match: {
39
+ path: notInEnMission,
40
+ exact: false,
41
+ strict: false,
42
+ },
43
+ url(payload) {
44
+ return payload.location.pathname;
45
+ },
46
+ },
47
+ ];
48
+ }
44
49
 
45
50
  config.settings.loadables.d3 = loadable.lib(() => import('d3'));
46
51