@opengeoweb/cap 10.2.0 → 10.2.1-spike-ol.0

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/README.md CHANGED
@@ -8,3 +8,7 @@ This library was generated with [Nx](https://nx.dev).
8
8
  ## Running unit tests
9
9
 
10
10
  Run `nx test cap` to execute the unit tests via [Jest](https://jestjs.io).
11
+
12
+ ### TypeScript Documentation
13
+
14
+ - [TypeScript Docs](https://opengeoweb.gitlab.io/opengeoweb/typescript-docs/cap/)
package/index.esm.js CHANGED
@@ -4,14 +4,14 @@ import { Grid2, Typography, Box, Card, CircularProgress } from '@mui/material';
4
4
  import { Box as Box$1 } from '@mui/system';
5
5
  import { dateUtils, AlertBanner } from '@opengeoweb/shared';
6
6
  import { useSelector, useDispatch } from 'react-redux';
7
- import { createEntityAdapter, createSlice, createSelector, combineReducers } from '@reduxjs/toolkit';
7
+ import { createEntityAdapter, createSlice, createSelector, combineReducers, configureStore } from '@reduxjs/toolkit';
8
8
  import React from 'react';
9
9
  import i18n from 'i18next';
10
10
  import { useTranslation } from 'react-i18next';
11
11
  import { ConfigurableMapConnect } from '@opengeoweb/core';
12
12
  import '@opengeoweb/timeslider';
13
13
  import { MapViewLayer, MapWarningProperties } from '@opengeoweb/webmap-react';
14
- import { coreModuleReducersMap, mapSelectors } from '@opengeoweb/store';
14
+ import { mapListener, serviceListener, layersListener, syncGroupsListener, genericListener, mapReducer, serviceReducer, layerReducer, syncGroupsReducer, mapSelectors } from '@opengeoweb/store';
15
15
  import { webmapUtils } from '@opengeoweb/webmap';
16
16
 
17
17
  var en = {
@@ -24,7 +24,7 @@ var en = {
24
24
  "warning-list-row-not-expired": "(not expired)"
25
25
  };
26
26
  var fi = {
27
- "map-view-cap-error-title": "🚧 ei käännetty",
27
+ "map-view-cap-error-title": "Jotain meni pieleen asetustiedostoa ladattaessa",
28
28
  "warning-list-cap-alert-banner-title": "🚧 ei käännetty",
29
29
  "warning-list-cap-error-title": "🚧 ei käännetty",
30
30
  "warning-list-row-event": "🚧 ei käännetty",
@@ -106,8 +106,8 @@ var slice = createSlice({
106
106
  }
107
107
  }
108
108
  });
109
- var reducer = slice.reducer;
110
- var capActions = slice.actions;
109
+ var capReducer = slice.reducer,
110
+ capActions = slice.actions;
111
111
 
112
112
  /* *
113
113
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -126,11 +126,17 @@ var capActions = slice.actions;
126
126
  * Copyright 2022 - Finnish Meteorological Institute (FMI)
127
127
  * Copyright 2024 - The Norwegian Meteorological Institute (MET Norway)
128
128
  * */
129
+ var getCapStore = function getCapStore(store) {
130
+ if (store && store.cap) {
131
+ return store.cap;
132
+ }
133
+ return null;
134
+ };
129
135
  var _feedAdapter$getSelec = feedAdapter.getSelectors(function (state) {
130
136
  return state.cap.feeds;
131
- });
132
- _feedAdapter$getSelec.selectById;
133
- var getCapFeeds = _feedAdapter$getSelec.selectAll;
137
+ }),
138
+ getCapFeedById = _feedAdapter$getSelec.selectById,
139
+ getCapFeeds = _feedAdapter$getSelec.selectAll;
134
140
  var _alertAdapter$getSele = alertAdapter.getSelectors(function (state) {
135
141
  return state.cap.alerts;
136
142
  }),
@@ -150,6 +156,18 @@ var getLastUpdatedTimes = createSelector(getCapFeeds, function (feeds) {
150
156
  });
151
157
  });
152
158
 
159
+ var selectors = /*#__PURE__*/Object.freeze({
160
+ __proto__: null,
161
+ getAlertById: getAlertById,
162
+ getAlertIds: getAlertIds,
163
+ getAlerts: getAlerts,
164
+ getAlertsInEffect: getAlertsInEffect,
165
+ getCapFeedById: getCapFeedById,
166
+ getCapFeeds: getCapFeeds,
167
+ getCapStore: getCapStore,
168
+ getLastUpdatedTimes: getLastUpdatedTimes
169
+ });
170
+
153
171
  function _arrayLikeToArray(r, a) {
154
172
  (null == a || a > r.length) && (a = r.length);
155
173
  for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
@@ -920,9 +938,123 @@ var createApi = function createApi(props) {
920
938
  return getApiRoutes(axiosInstance, nonAuthAxiosInstance);
921
939
  };
922
940
 
923
- combineReducers(_objectSpread2(_objectSpread2({}, coreModuleReducersMap), {}, {
924
- cap: reducer
925
- }));
941
+ var mockLastUpdated = {
942
+ lastUpdated: 1666096534
943
+ };
944
+
945
+ /* *
946
+ * Licensed under the Apache License, Version 2.0 (the "License");
947
+ * you may not use this file except in compliance with the License.
948
+ * You may obtain a copy of the License at
949
+ *
950
+ * http://www.apache.org/licenses/LICENSE-2.0
951
+ *
952
+ * Unless required by applicable law or agreed to in writing, software
953
+ * distributed under the License is distributed on an "AS IS" BASIS,
954
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
955
+ * See the License for the specific language governing permissions and
956
+ * limitations under the License.
957
+ *
958
+ * Copyright 2022 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
959
+ * Copyright 2022 - Finnish Meteorological Institute (FMI)
960
+ * Copyright 2024 - The Norwegian Meteorological Institute (MET Norway)
961
+ * */
962
+ var mockCapStateWithAlerts = {
963
+ alerts: {
964
+ ids: ['2.49.0.1.246.0.0.2022'],
965
+ entities: {
966
+ '2.49.0.1.246.0.0.2022': {
967
+ identifier: '2.49.0.1.246.0.0.2022',
968
+ feedAddress: 'https://alerts.fmi.fi/cap/feed/rss_en-GB.rss',
969
+ severity: 'Extreme',
970
+ certainty: 'Likely',
971
+ onset: '2022-07-07T00:00:00+03:00',
972
+ expires: '2022-07-07T23:53:10+03:00',
973
+ languages: [{
974
+ areaDesc: 'Uusimaa ja Kymenlaakso',
975
+ language: 'fi-FI',
976
+ event: 'Metsäpalovaroitus',
977
+ senderName: 'Ilmatieteen laitos',
978
+ headline: 'Oranssi metsäpalovaroitus: Uusimaa ja Kymenlaakso, to 0.00 - 23.53',
979
+ description: 'Metsäpalojen vaara on erittäin suuri keskiviikon ja torstain välisestä yöstä torstain ja perjantain väliseen yöhön 30 % todennäköisyydellä.'
980
+ }, {
981
+ areaDesc: 'Nyland och Kymmenedalen',
982
+ language: 'sv-FI',
983
+ event: 'Varning för skogsbrand',
984
+ senderName: 'Meteorologiska institutet',
985
+ headline: 'Orange varning för skogsbrand: Nyland och Kymmenedalen, to 0.00 - 23.53',
986
+ description: 'Risken för skogsbränder är mycket hög på från och med natten mellan onsdag och torsdag fram till natten mellan torsdag och fredag med 30 % sannolikhet.'
987
+ }, {
988
+ areaDesc: 'Uusimaa and Kymenlaakso',
989
+ language: 'en-GB',
990
+ event: 'Forest fire warning',
991
+ senderName: 'Finnish Meteorological Institute',
992
+ headline: 'Orange forest fire warning: Uusimaa and Kymenlaakso, Thu 0.00 - 23.53',
993
+ description: 'A risk of forest fires is very high on from the night between Wednesday and Thursday to the night between Thursday and Friday with probability of 30 %.'
994
+ }]
995
+ }
996
+ }
997
+ },
998
+ feeds: {
999
+ ids: [],
1000
+ entities: {}
1001
+ }
1002
+ };
1003
+ var mockCapStateWithFeeds = {
1004
+ alerts: {
1005
+ ids: [],
1006
+ entities: {}
1007
+ },
1008
+ feeds: {
1009
+ ids: ['https://alerts.fmi.fi/cap/feed/rss_en-GB.rss', 'https://api.met.no/weatherapi/metalerts/1.1'],
1010
+ entities: {
1011
+ 'https://alerts.fmi.fi/cap/feed/rss_en-GB.rss': {
1012
+ id: 'https://alerts.fmi.fi/cap/feed/rss_en-GB.rss',
1013
+ lastUpdated: mockLastUpdated.lastUpdated
1014
+ },
1015
+ 'https://api.met.no/weatherapi/metalerts/1.1': {
1016
+ id: 'https://api.met.no/weatherapi/metalerts/1.1',
1017
+ lastUpdated: mockLastUpdated.lastUpdated
1018
+ }
1019
+ }
1020
+ }
1021
+ };
1022
+
1023
+ /* *
1024
+ * Licensed under the Apache License, Version 2.0 (the "License");
1025
+ * you may not use this file except in compliance with the License.
1026
+ * You may obtain a copy of the License at
1027
+ *
1028
+ * http://www.apache.org/licenses/LICENSE-2.0
1029
+ *
1030
+ * Unless required by applicable law or agreed to in writing, software
1031
+ * distributed under the License is distributed on an "AS IS" BASIS,
1032
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1033
+ * See the License for the specific language governing permissions and
1034
+ * limitations under the License.
1035
+ *
1036
+ * Copyright 2022 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
1037
+ * Copyright 2022 - Finnish Meteorological Institute (FMI)
1038
+ * Copyright 2024 - The Norwegian Meteorological Institute (MET Norway)
1039
+ * */
1040
+ var capReducersMap = {
1041
+ webmap: mapReducer,
1042
+ services: serviceReducer,
1043
+ layers: layerReducer,
1044
+ syncGroups: syncGroupsReducer,
1045
+ cap: capReducer
1046
+ };
1047
+ var capMiddlewares = [mapListener.middleware, serviceListener.middleware, layersListener.middleware, syncGroupsListener.middleware, genericListener.middleware];
1048
+ var capRootReducer = combineReducers(capReducersMap);
1049
+ var createMockStore = function createMockStore(mockState) {
1050
+ return configureStore({
1051
+ reducer: capRootReducer,
1052
+ preloadedState: mockState,
1053
+ middleware: function middleware(getDefaultMiddleware) {
1054
+ return getDefaultMiddleware().concat(capMiddlewares);
1055
+ }
1056
+ });
1057
+ };
926
1058
 
927
1059
  /* *
928
1060
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -1339,8 +1471,9 @@ var MapViewCapConnect = function MapViewCapConnect(_ref) {
1339
1471
  title: title,
1340
1472
  layers: layers || [],
1341
1473
  "data-testid": "capWarningMap",
1342
- bbox: bbox,
1474
+ initialBbox: bbox,
1343
1475
  srs: srs,
1476
+ useOl: false,
1344
1477
  children: [jsx(MapViewLayer, {
1345
1478
  id: layerIdRef.current,
1346
1479
  geojson: geoJsonObject,
@@ -1447,27 +1580,4 @@ var ComponentsLookUp = function ComponentsLookUp(_ref) {
1447
1580
  }
1448
1581
  };
1449
1582
 
1450
- /* *
1451
- * Licensed under the Apache License, Version 2.0 (the "License");
1452
- * you may not use this file except in compliance with the License.
1453
- * You may obtain a copy of the License at
1454
- *
1455
- * http://www.apache.org/licenses/LICENSE-2.0
1456
- *
1457
- * Unless required by applicable law or agreed to in writing, software
1458
- * distributed under the License is distributed on an "AS IS" BASIS,
1459
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1460
- * See the License for the specific language governing permissions and
1461
- * limitations under the License.
1462
- *
1463
- * Copyright 2022 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
1464
- * Copyright 2022 - Finnish Meteorological Institute (FMI)
1465
- * Copyright 2024 - The Norwegian Meteorological Institute (MET Norway)
1466
- * */
1467
- var capModuleConfig = {
1468
- reducersMap: {
1469
- cap: reducer
1470
- }
1471
- };
1472
-
1473
- export { CAP_NAMESPACE, ComponentsLookUp, capModuleConfig, reducer as capReducer, capTrans as capTranslations };
1583
+ export { CAP_NAMESPACE, ComponentsLookUp, capActions, capMiddlewares, capReducer, capReducersMap, selectors as capSelectors, capTrans as capTranslations, createMockStore, mockCapStateWithAlerts, mockCapStateWithFeeds };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opengeoweb/cap",
3
- "version": "10.2.0",
3
+ "version": "10.2.1-spike-ol.0",
4
4
  "description": "GeoWeb Common Alerting Protocol (CAP) library for the opengeoweb project",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -1,6 +1,7 @@
1
1
  import * as React from 'react';
2
2
  declare const _default: {
3
3
  title: string;
4
+ tags: string[];
4
5
  };
5
6
  export default _default;
6
7
  export declare const CapDemoFakeApi: React.FC;
@@ -1,6 +1,6 @@
1
- import * as React from 'react';
2
- declare const _default: {
3
- title: string;
4
- };
5
- export default _default;
6
- export declare const GanttDemoRealApi: React.FC;
1
+ import type { Meta, StoryObj } from '@storybook/react';
2
+ import GanttModule from './GanttModule';
3
+ declare const meta: Meta<typeof GanttModule>;
4
+ export default meta;
5
+ type Story = StoryObj<typeof GanttModule>;
6
+ export declare const GanttDemoRealApi: Story;
@@ -1,8 +1,11 @@
1
- import * as React from 'react';
2
- declare const _default: {
3
- title: string;
4
- };
5
- export default _default;
6
- export declare const GanttDemo: () => React.ReactElement;
7
- export declare const GanttDemoDark: () => React.ReactElement;
8
- export declare const GanttDemoEmptyList: () => React.ReactElement;
1
+ import type { Meta, StoryObj } from '@storybook/react';
2
+ import GanttWrapper from './GanttWrapper';
3
+ declare const meta: Meta<typeof GanttWrapper>;
4
+ export default meta;
5
+ type Story = StoryObj<typeof GanttWrapper>;
6
+ export declare const Component: Story;
7
+ export declare const ComponentDark: Story;
8
+ export declare const EmptyList: Story;
9
+ export declare const GanttDemo: Story;
10
+ export declare const GanttDemoDark: Story;
11
+ export declare const GanttDemoEmptyList: Story;
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
2
  import { InitialMapProps } from '@opengeoweb/core';
3
3
  import { CapPresets } from '../types';
4
- interface MapViewCapConnectProps {
4
+ export interface MapViewCapConnectProps {
5
5
  id?: string;
6
6
  title?: string;
7
7
  bbox?: {
@@ -15,4 +15,3 @@ interface MapViewCapConnectProps {
15
15
  layers?: InitialMapProps['mapPreset']['layers'];
16
16
  }
17
17
  export declare const MapViewCapConnect: React.FC<MapViewCapConnectProps>;
18
- export {};
@@ -1,6 +1,6 @@
1
- import React from 'react';
2
- declare const _default: {
3
- title: string;
4
- };
5
- export default _default;
6
- export declare const MapViewCapConnectDemo: React.FC;
1
+ import type { Meta, StoryObj } from '@storybook/react';
2
+ import { MapViewCapConnect } from './MapViewCapConnect';
3
+ declare const meta: Meta<typeof MapViewCapConnect>;
4
+ export default meta;
5
+ type Story = StoryObj<typeof MapViewCapConnect>;
6
+ export declare const MapViewCapConnectDemo: Story;
@@ -1,4 +1,2 @@
1
1
  export * from './components/ComponentsLookUp';
2
- export { default as capModuleConfig } from './store/config';
3
- export type { CapModule } from './store/config';
4
- export { reducer as capReducer } from './store/reducer';
2
+ export * from './store';
@@ -1,4 +1,5 @@
1
- export { capActions } from './reducer';
1
+ export { capActions, capReducer } from './reducer';
2
2
  export * as capSelectors from './selectors';
3
3
  export * from './mockStore';
4
- export * from './utils';
4
+ export type { CapModule } from './types';
5
+ export * from './store';
@@ -5,8 +5,7 @@ export declare const feedInitialState: CapFeedState;
5
5
  export declare const alertAdapter: import("@reduxjs/toolkit").EntityAdapter<CapAlert>;
6
6
  export declare const alertInitialState: CapAlertState;
7
7
  export declare const initialState: CapStore;
8
- export declare const reducer: import("redux").Reducer<CapStore>;
9
- export declare const capActions: import("@reduxjs/toolkit").CaseReducerActions<{
8
+ export declare const capReducer: import("redux").Reducer<CapStore>, capActions: import("@reduxjs/toolkit").CaseReducerActions<{
10
9
  addManyAlerts: (draft: Draft<CapStore>, action: PayloadAction<CapAlert[]>) => void;
11
10
  addManyAlertsToFeed: (draft: Draft<CapStore>, action: PayloadAction<AddManyAlertsToFeedPayload>) => void;
12
11
  setFeedLastUpdatedTimes: (draft: Draft<CapStore>, action: PayloadAction<FeedLastUpdatedPayload[]>) => void;
@@ -0,0 +1,11 @@
1
+ import { ToolkitStore } from '@reduxjs/toolkit/dist/configureStore';
2
+ import { CapModule } from './types';
3
+ export declare const capReducersMap: {
4
+ webmap: import("redux").Reducer<import("dist/libs/store/src/store/map/types").WebMapState, import("redux").AnyAction>;
5
+ services: import("redux").Reducer<import("dist/libs/store/src/store/map/types").ServiceState, import("redux").AnyAction>;
6
+ layers: import("redux").Reducer<import("dist/libs/store/src/store/map/types").LayerState, import("redux").AnyAction>;
7
+ syncGroups: import("redux").Reducer<import("dist/libs/store/src/store/generic/syncGroups/types").SynchronizationGroupState, import("redux").AnyAction>;
8
+ cap: import("redux").Reducer<import("./types").CapStore>;
9
+ };
10
+ export declare const capMiddlewares: import("@reduxjs/toolkit").ListenerMiddleware<import("@opengeoweb/store").CoreAppStore, import("@reduxjs/toolkit").ThunkDispatch<import("@opengeoweb/store").CoreAppStore, unknown, import("redux").AnyAction>, unknown>[];
11
+ export declare const createMockStore: (mockState?: CapModule) => ToolkitStore;
@@ -1,8 +0,0 @@
1
- import { CapModule } from './types';
2
- export type { CapModule };
3
- declare const capModuleConfig: {
4
- reducersMap: {
5
- cap: import("redux").Reducer<import("./types").CapStore>;
6
- };
7
- };
8
- export default capModuleConfig;
@@ -1,2 +0,0 @@
1
- import { ToolkitStore } from '@reduxjs/toolkit/dist/configureStore';
2
- export declare const createTestCapStore: () => ToolkitStore;