@eeacms/volto-cca-policy 0.1.39 → 0.1.40

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,15 @@ 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.40](https://github.com/eea/volto-cca-policy/compare/0.1.39...0.1.40) - 28 August 2023
8
+
9
+ #### :hammer_and_wrench: Others
10
+
11
+ - Bring back some code that was lost [Tiberiu Ichim - [`a8d34d9`](https://github.com/eea/volto-cca-policy/commit/a8d34d95f5a8857968bf1fdac14930ff987b7f11)]
12
+ - Add readme [Tiberiu Ichim - [`487e146`](https://github.com/eea/volto-cca-policy/commit/487e146f71c8495887f8caf1d35e84644b2c07cd)]
13
+ - Rewrite the way we compute the additional volto paths [Tiberiu Ichim - [`bb599ce`](https://github.com/eea/volto-cca-policy/commit/bb599ceb45f340a2b861c9753fe6a7e030ab16fb)]
14
+ - Fix issue with group block [kreafox - [`6ecde58`](https://github.com/eea/volto-cca-policy/commit/6ecde585ddae8529f05bc4acba4b8526d9c86b8f)]
15
+ - test: Update Makefile and docker-compose to align it with Jenkinsfile [valentinab25 - [`e00c532`](https://github.com/eea/volto-cca-policy/commit/e00c532a2fa31612e3bb3d20ca1781e68b6c6fc3)]
7
16
  ### [0.1.39](https://github.com/eea/volto-cca-policy/compare/0.1.38...0.1.39) - 22 August 2023
8
17
 
9
18
  ### [0.1.38](https://github.com/eea/volto-cca-policy/compare/0.1.37...0.1.38) - 21 August 2023
@@ -1,11 +1,12 @@
1
1
  version: "3"
2
2
  services:
3
3
  backend:
4
- image: plone/plone-backend:${PLONE_VERSION:-6}
4
+ image: eeacms/plone-backend
5
5
  ports:
6
6
  - "8080:8080"
7
7
  environment:
8
8
  SITE: "Plone"
9
+ PROFILES: "eea.kitkat:testing"
9
10
 
10
11
  frontend:
11
12
  build:
@@ -23,6 +24,9 @@ services:
23
24
  volumes:
24
25
  - ./:/app/src/addons/${ADDON_PATH}
25
26
  environment:
27
+ CI: "true"
28
+ NODE_ENV: "development"
29
+ RAZZLE_JEST_CONFIG: "src/addons/${ADDON_PATH}/jest-addon.config.js"
26
30
  RAZZLE_INTERNAL_API_PATH: "http://backend:8080/Plone"
27
31
  RAZZLE_DEV_PROXY_API_PATH: "http://backend:8080/Plone"
28
32
  HOST: "0.0.0.0"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eeacms/volto-cca-policy",
3
- "version": "0.1.39",
3
+ "version": "0.1.40",
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
@@ -26,20 +26,30 @@ import GeolocationWidget from './components/theme/Widgets/GeolocationWidget';
26
26
 
27
27
  const getEnv = () => (typeof window !== 'undefined' ? window.env : process.env);
28
28
 
29
+ const pathToNegRegex = (p) => `(?!(${p}))`;
30
+
29
31
  const restrictedBlocks = ['countryFlag'];
30
32
 
31
33
  const applyConfig = (config) => {
32
- const notInEnMission = /^(?!(\/en\/mission)).*$/;
33
34
  const env = getEnv();
34
- const isStaging = !!env.RAZZLE_IS_STAGING;
35
- const enableMissionIsExternal = !isStaging && !__DEVELOPMENT__;
36
35
 
37
- if (enableMissionIsExternal) {
36
+ // VOLTO_LOCATIONS is a list of paths that should be handled by Volto.
37
+ // All other paths (meaning, everything that's not specifically set in this
38
+ // variable) will be treated as an external path and the browser will fully
39
+ // load the link as a separate document, and it will load from Plone 4
40
+ const voltoLocations = (env.RAZZLE_VOLTO_LOCATIONS || '')
41
+ .split(';')
42
+ .map((s) => s.trim().replaceAll('/', '\\/'))
43
+ .filter((s) => !!s);
44
+
45
+ if (voltoLocations.length) {
46
+ const voltoLocationsRegex =
47
+ '^' + voltoLocations.map(pathToNegRegex).join('') + '.*$';
38
48
  config.settings.externalRoutes = [
39
49
  ...(config.settings.externalRoutes || []),
40
50
  {
41
51
  match: {
42
- path: notInEnMission,
52
+ path: new RegExp(voltoLocationsRegex),
43
53
  exact: false,
44
54
  strict: false,
45
55
  },
package/src/utils.js CHANGED
@@ -1,6 +1,12 @@
1
1
  export const blockAvailableInMission = (properties, block) => {
2
2
  const missionBlocks = ['mkh_map', 'rastBlock'];
3
- const isMission = properties['@id'].includes('/en/mission');
3
+ const id = properties?.['@id'];
4
+
5
+ if (!id) {
6
+ return false;
7
+ }
8
+
9
+ const isMission = id.includes('/en/mission');
4
10
 
5
11
  if (isMission) {
6
12
  return missionBlocks.includes(block.id) ? false : true;