@eeacms/volto-cca-policy 0.1.38 → 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 +11 -0
- package/docker-compose.yml +5 -1
- package/package.json +1 -1
- package/src/customizations/volto/components/theme/Sitemap/Sitemap.jsx +22 -1
- package/src/index.js +15 -5
- package/src/utils.js +7 -1
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,17 @@ 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)]
|
|
16
|
+
### [0.1.39](https://github.com/eea/volto-cca-policy/compare/0.1.38...0.1.39) - 22 August 2023
|
|
17
|
+
|
|
7
18
|
### [0.1.38](https://github.com/eea/volto-cca-policy/compare/0.1.37...0.1.38) - 21 August 2023
|
|
8
19
|
|
|
9
20
|
#### :hammer_and_wrench: Others
|
package/docker-compose.yml
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
version: "3"
|
|
2
2
|
services:
|
|
3
3
|
backend:
|
|
4
|
-
image:
|
|
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
|
@@ -10,7 +10,7 @@ import { connect } from 'react-redux';
|
|
|
10
10
|
import { asyncConnect } from '@plone/volto/helpers';
|
|
11
11
|
import { defineMessages, injectIntl } from 'react-intl';
|
|
12
12
|
import { Container } from 'semantic-ui-react';
|
|
13
|
-
import { Helmet
|
|
13
|
+
import { Helmet } from '@plone/volto/helpers';
|
|
14
14
|
import { Link } from 'react-router-dom';
|
|
15
15
|
import config from '@plone/volto/registry';
|
|
16
16
|
|
|
@@ -29,6 +29,27 @@ export function getSitemapPath(pathname = '', lang) {
|
|
|
29
29
|
return path;
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
+
export const toReactIntlLang = (language) => {
|
|
33
|
+
if (language.includes('_') || language.includes('-')) {
|
|
34
|
+
let langCode = language.split(/[-_]/);
|
|
35
|
+
langCode = `${langCode[0]}-${langCode[1].toUpperCase()}`;
|
|
36
|
+
return langCode;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
return language;
|
|
40
|
+
};
|
|
41
|
+
// export const toLangUnderscoreRegion = toReactIntlLang; // old name for backwards-compat
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Converts a language code like pt_BR or pt-BR to the format `pt-br`.
|
|
45
|
+
* This format is used on the backend and in volto config settings.
|
|
46
|
+
* @param {string} language Language to be converted
|
|
47
|
+
* @returns {string} Language converted
|
|
48
|
+
*/
|
|
49
|
+
export const toBackendLang = (language) => {
|
|
50
|
+
return toReactIntlLang(language).toLowerCase();
|
|
51
|
+
};
|
|
52
|
+
|
|
32
53
|
/**
|
|
33
54
|
* Sitemap class.
|
|
34
55
|
* @class Sitemap
|
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
|
-
|
|
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:
|
|
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
|
|
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;
|