@eeacms/volto-marine-policy 2.0.28 → 2.0.30

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,7 +4,25 @@ 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
- ### [2.0.28](https://github.com/eea/volto-marine-policy/compare/2.0.27...2.0.28) - 11 September 2025
7
+ ### [2.0.30](https://github.com/eea/volto-marine-policy/compare/2.0.29...2.0.30) - 22 September 2025
8
+
9
+ #### :house: Internal changes
10
+
11
+ - style: Automated code fix [eea-jenkins - [`5d52587`](https://github.com/eea/volto-marine-policy/commit/5d525877d8d3f93b75ac0f2f71853e754a0f1b3b)]
12
+
13
+ #### :hammer_and_wrench: Others
14
+
15
+ - fix eslint [laszlocseh - [`da4441c`](https://github.com/eea/volto-marine-policy/commit/da4441ca4a77b97d0aebc967120a61e2b87e14ca)]
16
+ - fix eslint [laszlocseh - [`390c0ad`](https://github.com/eea/volto-marine-policy/commit/390c0addf4a174f1fe452302a88df978cb24b684)]
17
+ - fix eslint [laszlocseh - [`c704506`](https://github.com/eea/volto-marine-policy/commit/c7045065771916ba77437143e1916875537687e3)]
18
+ - fix msfd data explorer scripts loading [laszlocseh - [`cb5d9ea`](https://github.com/eea/volto-marine-policy/commit/cb5d9eab1efb988f523b579ca4fa193fdaaf64bd)]
19
+ ### [2.0.29](https://github.com/eea/volto-marine-policy/compare/2.0.28...2.0.29) - 22 September 2025
20
+
21
+ #### :hammer_and_wrench: Others
22
+
23
+ - cleanup [laszlocseh - [`2d9cd7c`](https://github.com/eea/volto-marine-policy/commit/2d9cd7c4e37f36c92e0ecc604812cd7ee9703ec7)]
24
+ - add nonce to script-src [laszlocseh - [`a35b6f5`](https://github.com/eea/volto-marine-policy/commit/a35b6f5f31d9cdc7039ef43c52b0efb37397b679)]
25
+ ### [2.0.28](https://github.com/eea/volto-marine-policy/compare/2.0.27...2.0.28) - 12 September 2025
8
26
 
9
27
  #### :house: Internal changes
10
28
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eeacms/volto-marine-policy",
3
- "version": "2.0.28",
3
+ "version": "2.0.30",
4
4
  "description": "@eeacms/volto-marine-policy: Volto add-on",
5
5
  "main": "src/index.js",
6
6
  "author": "European Environment Agency: IDM2 A-Team",
@@ -39,41 +39,76 @@ const MsfdDataExplorerBlockView = (props) => {
39
39
  window.jQuery = $;
40
40
  global.jQuery = $;
41
41
 
42
- const scripts = [
43
- 'https://cdnjs.cloudflare.com/ajax/libs/select2/3.5.4/select2.min.js',
44
- '/marine/++api++/++resource++msfd/js/jquery-ui.js',
45
- '/marine/++api++/++resource++msfd/js/tabs.js',
46
- '/marine/++api++/++resource++msfd/js/msfd_search.js',
47
- '/marine/++api++/++resource++msfd/bs3/js/bootstrap.min.js',
48
- ];
49
-
50
42
  if (!loading) {
51
- $.getScript(scripts[0], () => {
52
- $.getScript(scripts[1], () => {
53
- $.getScript(scripts[2], () => {
54
- $.getScript(scripts[3], () => {
55
- $.getScript(scripts[4]);
56
- });
43
+ const scripts = [
44
+ 'https://cdnjs.cloudflare.com/ajax/libs/select2/3.5.4/select2.min.js',
45
+ '/marine/++api++/++resource++msfd/js/jquery-ui.js',
46
+ '/marine/++api++/++resource++msfd/js/tabs.js',
47
+ '/marine/++api++/++resource++msfd/js/msfd_search.js',
48
+ '/marine/++api++/++resource++msfd/bs3/js/bootstrap.min.js',
49
+ ];
50
+ const loadScripts = async () => {
51
+ for (const src of scripts) {
52
+ await new Promise((resolve, reject) => {
53
+ const script = document.createElement('script');
54
+ script.src = src;
55
+ script.type = 'text/javascript';
56
+ script.async = false; // load in order
57
+ script.onload = resolve;
58
+ script.onerror = reject;
59
+ document.body.appendChild(script);
57
60
  });
58
- });
59
- });
60
-
61
- // scripts.forEach((element) => {
62
- // // $.getScript(element);
63
- // const script = document.createElement('script');
64
- // script.src = element;
65
- // script.setAttribute('type', 'text/javascript');
66
- // script.async = false;
67
- // // script.defer = 'defer';
68
-
69
- // document.body.appendChild(script);
70
- // });
71
- // setTimeout(() => {
72
- // $.getScript('/++api++/++resource++msfd/js/msfd_search.js');
73
- // }, 200);
61
+ }
62
+ };
63
+ loadScripts();
64
+ // .then(() => {
65
+ // console.log('All scripts loaded');
66
+ // // $('.msfd-search-wrapper select').select2();
67
+ // })
68
+ // .catch((err) => console.error('Script load error', err));
74
69
  }
75
70
  }, [loading]);
76
71
 
72
+ // useEffect(() => {
73
+ // window.$ = $;
74
+ // window.jQuery = $;
75
+ // global.jQuery = $;
76
+
77
+ // const scripts = [
78
+ // 'https://cdnjs.cloudflare.com/ajax/libs/select2/3.5.4/select2.min.js',
79
+ // '/++api++/++resource++msfd/js/jquery-ui.js',
80
+ // '/++api++/++resource++msfd/js/tabs.js',
81
+ // '/++api++/++resource++msfd/js/msfd_search.js',
82
+ // '/++api++/++resource++msfd/bs3/js/bootstrap.min.js',
83
+ // ];
84
+
85
+ // if (!loading) {
86
+ // $.getScript(scripts[0], () => {
87
+ // $.getScript(scripts[1], () => {
88
+ // $.getScript(scripts[2], () => {
89
+ // $.getScript(scripts[3], () => {
90
+ // $.getScript(scripts[4]);
91
+ // });
92
+ // });
93
+ // });
94
+ // });
95
+
96
+ // // scripts.forEach((element) => {
97
+ // // // $.getScript(element);
98
+ // // const script = document.createElement('script');
99
+ // // script.src = element;
100
+ // // script.setAttribute('type', 'text/javascript');
101
+ // // script.async = false;
102
+ // // // script.defer = 'defer';
103
+
104
+ // // document.body.appendChild(script);
105
+ // // });
106
+ // // setTimeout(() => {
107
+ // // $.getScript('/++api++/++resource++msfd/js/msfd_search.js');
108
+ // // }, 200);
109
+ // }
110
+ // }, [loading]);
111
+
77
112
  return (
78
113
  <>
79
114
  {article_select ? (
package/src/index.js CHANGED
@@ -98,6 +98,14 @@ const applyConfig = (config) => {
98
98
  if (__SERVER__) {
99
99
  const installExpressMiddleware = require('./express-middleware').default;
100
100
  config = installExpressMiddleware(config);
101
+
102
+ // CSP Header
103
+ const devsource = __DEVELOPMENT__
104
+ ? ` http://localhost:${parseInt(process.env.PORT || '3000') + 1}`
105
+ : '';
106
+ config.settings.serverConfig.csp = {
107
+ 'script-src': `'self' {nonce}${devsource}`,
108
+ };
101
109
  }
102
110
 
103
111
  config.widgets.widget.text_align = TextAlignWidget;