@eeacms/volto-bise-policy 1.2.32 → 1.2.34

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.
Files changed (34) hide show
  1. package/CHANGELOG.md +34 -0
  2. package/package.json +3 -1
  3. package/src/components/Widgets/GeolocationWidget.jsx +143 -0
  4. package/src/components/Widgets/GeolocationWidgetMapContainer.jsx +131 -0
  5. package/src/components/Widgets/NRRWidgets.jsx +95 -0
  6. package/src/components/manage/Blocks/CaseStudyExplorer/CaseStudyExplorerEdit.jsx +5 -0
  7. package/src/components/manage/Blocks/CaseStudyExplorer/CaseStudyExplorerView.jsx +107 -0
  8. package/src/components/manage/Blocks/CaseStudyExplorer/CaseStudyExplorerView.test.jsx +89 -0
  9. package/src/components/manage/Blocks/CaseStudyExplorer/CaseStudyFilters.jsx +339 -0
  10. package/src/components/manage/Blocks/CaseStudyExplorer/CaseStudyFilters.test.jsx +111 -0
  11. package/src/components/manage/Blocks/CaseStudyExplorer/CaseStudyListing.jsx +330 -0
  12. package/src/components/manage/Blocks/CaseStudyExplorer/CaseStudyListing.test.jsx +166 -0
  13. package/src/components/manage/Blocks/CaseStudyExplorer/CaseStudyMap.jsx +237 -0
  14. package/src/components/manage/Blocks/CaseStudyExplorer/CaseStudyMap.test.jsx +176 -0
  15. package/src/components/manage/Blocks/CaseStudyExplorer/FeatureDisplay.jsx +41 -0
  16. package/src/components/manage/Blocks/CaseStudyExplorer/FeatureDisplay.test.jsx +32 -0
  17. package/src/components/manage/Blocks/CaseStudyExplorer/FeatureInteraction.jsx +98 -0
  18. package/src/components/manage/Blocks/CaseStudyExplorer/FeatureInteraction.test.jsx +160 -0
  19. package/src/components/manage/Blocks/CaseStudyExplorer/InfoOverlay.jsx +82 -0
  20. package/src/components/manage/Blocks/CaseStudyExplorer/InfoOverlay.test.jsx +153 -0
  21. package/src/components/manage/Blocks/CaseStudyExplorer/hooks.js +20 -0
  22. package/src/components/manage/Blocks/CaseStudyExplorer/images/icon-depth.png +0 -0
  23. package/src/components/manage/Blocks/CaseStudyExplorer/images/icon-light.png +0 -0
  24. package/src/components/manage/Blocks/CaseStudyExplorer/images/search.svg +3 -0
  25. package/src/components/manage/Blocks/CaseStudyExplorer/index.js +16 -0
  26. package/src/components/manage/Blocks/CaseStudyExplorer/mockJsdom.js +8 -0
  27. package/src/components/manage/Blocks/CaseStudyExplorer/styles.less +359 -0
  28. package/src/components/manage/Blocks/CaseStudyExplorer/styles.less_old +201 -0
  29. package/src/components/manage/Blocks/CaseStudyExplorer/utils.js +144 -0
  30. package/src/components/manage/Blocks/CaseStudyExplorer/utils.test.js +88 -0
  31. package/src/components/manage/Blocks/index.js +2 -0
  32. package/src/express-middleware.js +37 -0
  33. package/src/index.js +29 -0
  34. package/theme/globals/site.overrides +12 -4
@@ -0,0 +1,88 @@
1
+ import './mockJsdom';
2
+ import '@testing-library/jest-dom/extend-expect';
3
+ import { getFeatures, filterCases, getFilters } from './utils';
4
+
5
+ describe('utils.js', () => {
6
+ const mockCases = [
7
+ {
8
+ geometry: { coordinates: [0, 0] },
9
+ properties: {
10
+ title: 'test case study',
11
+ image: '',
12
+ nwrm_type: 'light',
13
+ measures: [{ id: 'test-measure1', title: 'test measure 1' }],
14
+ description: 'test',
15
+ typology_of_measures: ['testsector'],
16
+ path: '/test-case-study',
17
+ url: 'localhost.com/test-case-study',
18
+ },
19
+ },
20
+ {
21
+ geometry: { coordinates: [0, 0] },
22
+ properties: {
23
+ title: 'case study 2',
24
+ image: '',
25
+ nwrm_type: 'light',
26
+ measures: [{ id: 'test-measure1', title: 'test measure 1' }],
27
+ description: 'test',
28
+ typology_of_measures: ['testsector'],
29
+ path: '/test-case-study',
30
+ url: 'localhost.com/test-case-study',
31
+ },
32
+ },
33
+ ];
34
+
35
+ test('getFeatures', () => {
36
+ const mockFeature = {
37
+ setId: jest.fn(),
38
+ setProperties: jest.fn(),
39
+ };
40
+
41
+ const ol = {
42
+ ol: {
43
+ Feature: jest.fn().mockImplementation(() => mockFeature),
44
+ },
45
+ geom: {
46
+ Point: jest.fn().mockImplementation(() => ({})),
47
+ },
48
+ proj: {
49
+ fromLonLat: jest.fn().mockReturnValue([0, 0]),
50
+ },
51
+ };
52
+
53
+ expect(() => {
54
+ getFeatures({ cases: mockCases, ol });
55
+ }).not.toThrowError();
56
+ });
57
+
58
+ test('filterCases', () => {
59
+ const mockActiveFilters = {
60
+ measures_implemented: ['test measure 1'],
61
+ typology_of_measures: ['testsector'],
62
+ };
63
+ const mockCaseStudiesIds = ['test-case-study'];
64
+ const mockCasesFiltered = filterCases(
65
+ mockCases,
66
+ mockActiveFilters,
67
+ mockCaseStudiesIds,
68
+ 'test',
69
+ );
70
+ expect(mockCasesFiltered).toStrictEqual([]);
71
+ });
72
+
73
+ test('getFilters', () => {
74
+ const mockCasesObject = mockCases.reduce((acc, item, index) => {
75
+ acc[index] = item;
76
+ return acc;
77
+ }, {});
78
+ const mockFilters = getFilters(mockCasesObject);
79
+ expect(mockFilters).toStrictEqual({
80
+ measures_implemented: {
81
+ 'test-measure1': 'test measure 1',
82
+ },
83
+ typology_of_measures: {
84
+ testsector: 'testsector',
85
+ },
86
+ });
87
+ });
88
+ });
@@ -6,6 +6,7 @@ import installFactsheetsListing from './FactsheetsListing';
6
6
  import installKeyFacts from './KeyFacts';
7
7
  import installMaesViewer from './MaesViewer';
8
8
  import installNavigation from './Navigation';
9
+ import installCaseStudyExplorer from './CaseStudyExplorer';
9
10
 
10
11
  const config = (config) => {
11
12
  return [
@@ -17,6 +18,7 @@ const config = (config) => {
17
18
  installKeyFacts,
18
19
  installMaesViewer,
19
20
  installNavigation,
21
+ installCaseStudyExplorer,
20
22
  ].reduce((acc, apply) => apply(acc), config);
21
23
  };
22
24
 
@@ -0,0 +1,37 @@
1
+ import express from 'express';
2
+ import { getAPIResourceWithAuth } from '@plone/volto/helpers';
3
+
4
+ const HEADERS = [
5
+ 'Accept-Ranges',
6
+ 'Cache-Control',
7
+ 'Content-Disposition',
8
+ 'Content-Range',
9
+ 'Content-Type',
10
+ ];
11
+
12
+ function viewMiddleware(req, res, next) {
13
+ getAPIResourceWithAuth(req)
14
+ .then((resource) => {
15
+ // Just forward the headers that we need
16
+ HEADERS.forEach((header) => {
17
+ if (resource.get(header)) {
18
+ res.set(header, resource.get(header));
19
+ }
20
+ });
21
+ res.status(resource.statusCode);
22
+ res.send(resource.body);
23
+ })
24
+ .catch(next);
25
+ }
26
+
27
+ export default function middleware(config) {
28
+ const middleware = express.Router();
29
+
30
+ // TODO: do we want catch all?
31
+ // middleware.all(['**/@@*'], viewMiddleware);
32
+
33
+ middleware.all(['**/@@case-studies-map.arcgis.json'], viewMiddleware);
34
+ middleware.id = 'viewsMiddleware';
35
+ config.settings.expressMiddleware.push(middleware);
36
+ return config;
37
+ }
package/src/index.js CHANGED
@@ -25,6 +25,12 @@ import {
25
25
  EUNISCountryCodeView,
26
26
  EUNISCountryCodeWidget,
27
27
  } from './components/Widgets/EUNISObjectListWidget';
28
+ import GeolocationWidget from './components/Widgets/GeolocationWidget';
29
+ import {
30
+ NRRTypologyOfMeasuresView,
31
+ NRREcosystemTypologyView,
32
+ NRRArticleView,
33
+ } from './components/Widgets/NRRWidgets';
28
34
 
29
35
  const restrictedBlocks = ['imagecards', 'embed_eea_tableau_block'];
30
36
 
@@ -35,6 +41,7 @@ const customBlocks = [
35
41
  'body_classname',
36
42
  'redirect',
37
43
  'navigationBlock',
44
+ 'caseStudyExplorer',
38
45
  ];
39
46
 
40
47
  const n2kLanguages = [
@@ -95,6 +102,11 @@ const applyConfig = (config) => {
95
102
  },
96
103
  };
97
104
 
105
+ config.settings.allowed_cors_destinations = [
106
+ ...(config.settings.allowed_cors_destinations || []),
107
+ 'nominatim.openstreetmap.org',
108
+ ];
109
+
98
110
  // EEA customizations
99
111
  config.settings.eea = {
100
112
  ...(config.settings.eea || {}),
@@ -237,6 +249,23 @@ const applyConfig = (config) => {
237
249
  }
238
250
  });
239
251
 
252
+ if (__SERVER__) {
253
+ const installExpressMiddleware = require('./express-middleware').default;
254
+ config = installExpressMiddleware(config);
255
+
256
+ const devsource = __DEVELOPMENT__
257
+ ? ` http://localhost:${parseInt(process.env.PORT || '3000') + 1}`
258
+ : '';
259
+ config.settings.serverConfig.csp = {
260
+ 'script-src': `'self' {nonce}${devsource}`,
261
+ };
262
+ }
263
+
264
+ config.widgets.id.geolocation = GeolocationWidget;
265
+ config.widgets.views.id.nrr_typology_of_measures = NRRTypologyOfMeasuresView;
266
+ config.widgets.views.id.nrr_ecosystem_typology = NRREcosystemTypologyView;
267
+ config.widgets.views.id.nrr_article = NRRArticleView;
268
+ // EUNIS Widgets
240
269
  config.widgets.id.eunis_national_json = EUNISCountryCodeWidget;
241
270
  config.widgets.views.id.eunis_national_json = EUNISCountryCodeView;
242
271
  config.widgets.id.eunis_regional_sea_convention_value_json =
@@ -23,6 +23,7 @@ body {
23
23
  }
24
24
 
25
25
  @media @mobile {
26
+
26
27
  &.has-toolbar,
27
28
  &.has-toolbar-collapsed {
28
29
  --toolbar-width: 0px;
@@ -82,6 +83,10 @@ body {
82
83
  src: url('../fonts/Rajdhani-Bold.ttf') format('truetype');
83
84
  }
84
85
 
86
+ .eea.header {
87
+ z-index: 1001;
88
+ }
89
+
85
90
  a {
86
91
  color: @linkColor;
87
92
 
@@ -105,6 +110,7 @@ p.has--clear--both:empty {
105
110
 
106
111
  .contenttype-bise_factsheet {
107
112
  #main {
113
+
108
114
  h1,
109
115
  h2,
110
116
  h3,
@@ -131,7 +137,7 @@ p.has--clear--both:empty {
131
137
  display: flex;
132
138
  align-items: center;
133
139
 
134
- > div {
140
+ >div {
135
141
  width: 100%;
136
142
  }
137
143
  }
@@ -147,7 +153,8 @@ p.has--clear--both:empty {
147
153
  .ui.search {
148
154
  .ui.input {
149
155
  max-width: unset;
150
- > input {
156
+
157
+ >input {
151
158
  border-radius: 12px;
152
159
  }
153
160
  }
@@ -255,6 +262,7 @@ p.has--clear--both:empty {
255
262
  }
256
263
 
257
264
  .light-links {
265
+
258
266
  h1,
259
267
  h2,
260
268
  h3,
@@ -328,7 +336,7 @@ p.has--clear--both:empty {
328
336
  }
329
337
  }
330
338
 
331
- #sidebar > .sidebar-container > .tabs-wrapper > .ui.menu {
339
+ #sidebar>.sidebar-container>.tabs-wrapper>.ui.menu {
332
340
  flex-wrap: nowrap;
333
341
  }
334
342
 
@@ -358,4 +366,4 @@ p.has--clear--both:empty {
358
366
  border-right: 0.1rem solid @secondaryColor !important;
359
367
  }
360
368
  }
361
- }
369
+ }