@opengeoweb/cap 12.2.0 → 12.4.1

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 (32) hide show
  1. package/index.esm.js +272 -951
  2. package/package.json +16 -16
  3. package/src/lib/CapDemo.stories.d.ts +2 -1
  4. package/src/lib/components/ComponentsLookUp/componentsLookUp.d.ts +1 -3
  5. package/src/lib/components/GanttChart/GanttModule.stories.d.ts +1 -0
  6. package/src/lib/components/MapViewCap/MapViewCapConnect.d.ts +1 -1
  7. package/src/lib/components/MapViewCap/MapViewCapConnectWrapper.d.ts +1 -1
  8. package/src/lib/components/Providers/Providers.d.ts +6 -6
  9. package/src/lib/components/WarningListCap/WarningListCap.d.ts +4 -2
  10. package/src/lib/components/WarningListCap/WarningListRowCap/WarningListRowCapConnect.d.ts +2 -1
  11. package/src/lib/components/types.d.ts +0 -3
  12. package/src/lib/store/index.d.ts +0 -4
  13. package/src/lib/store/store.d.ts +2 -11
  14. package/src/lib/store/types.d.ts +0 -27
  15. package/src/lib/utils/addFeedAddressToCustomGeoJsonFeature.d.ts +1 -1
  16. package/src/lib/utils/cap-api/api.d.ts +12 -0
  17. package/src/lib/utils/cap-api/fakeApi.d.ts +2 -0
  18. package/src/lib/utils/cap-api/hooks.d.ts +10 -0
  19. package/src/lib/utils/highlightGeoJson.d.ts +1 -1
  20. package/src/lib/utils/i18n.d.ts +1 -0
  21. package/src/lib/utils/mockAlert.d.ts +0 -17
  22. package/src/lib/utils/mockCapData.d.ts +1 -4
  23. package/src/lib/utils/mockGeoJson.d.ts +0 -2
  24. package/src/lib/store/mockStore.d.ts +0 -21
  25. package/src/lib/store/reducer.d.ts +0 -12
  26. package/src/lib/store/reducer.spec.d.ts +0 -1
  27. package/src/lib/store/selector.spec.d.ts +0 -1
  28. package/src/lib/store/selectors.d.ts +0 -15
  29. package/src/lib/utils/api.d.ts +0 -20
  30. package/src/lib/utils/api.spec.d.ts +0 -1
  31. package/src/lib/utils/fakeApi.d.ts +0 -2
  32. package/src/lib/utils/fakeApi.spec.d.ts +0 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opengeoweb/cap",
3
- "version": "12.2.0",
3
+ "version": "12.4.1",
4
4
  "description": "GeoWeb Common Alerting Protocol (CAP) library for the opengeoweb project",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -8,23 +8,23 @@
8
8
  "url": "git@gitlab.com:opengeoweb/opengeoweb.git"
9
9
  },
10
10
  "dependencies": {
11
- "@opengeoweb/api": "12.2.0",
12
- "@opengeoweb/core": "12.2.0",
11
+ "@opengeoweb/api": "12.4.1",
12
+ "@opengeoweb/core": "12.4.1",
13
13
  "frappe-gantt": "^0.6.1",
14
- "@opengeoweb/shared": "12.2.0",
15
- "@opengeoweb/store": "12.2.0",
16
- "react-redux": "^8.1.3",
17
- "@opengeoweb/webmap": "12.2.0",
18
- "@opengeoweb/webmap-react": "12.2.0",
19
- "@mui/system": "^6.1.1",
14
+ "@opengeoweb/shared": "12.4.1",
15
+ "@opengeoweb/store": "12.4.1",
16
+ "react-redux": "^9.2.0",
17
+ "@opengeoweb/webmap": "12.4.1",
18
+ "@opengeoweb/webmap-react": "12.4.1",
19
+ "@mui/system": "^7.0.1",
20
20
  "react-i18next": "^15.1.1",
21
- "@reduxjs/toolkit": "^1.9.7",
22
- "@opengeoweb/theme": "12.2.0",
23
- "i18next": "^23.11.5",
24
- "axios": "^1.7.7",
25
- "@opengeoweb/timeslider": "12.2.0",
26
- "@mui/material": "^6.1.1",
27
- "ol": "^10.4.0"
21
+ "@reduxjs/toolkit": "^2.6.1",
22
+ "@opengeoweb/theme": "12.4.1",
23
+ "i18next": "^25.0.1",
24
+ "@opengeoweb/timeslider": "12.4.1",
25
+ "@mui/material": "^7.0.1",
26
+ "ol": "^10.4.0",
27
+ "@tanstack/react-query": "^5.69.2"
28
28
  },
29
29
  "peerDependencies": {
30
30
  "react": "18",
@@ -1,8 +1,9 @@
1
1
  import * as React from 'react';
2
+ import { StoryObj } from '@storybook/react/*';
2
3
  declare const _default: {
3
4
  title: string;
4
5
  tags: string[];
5
6
  };
6
7
  export default _default;
7
8
  export declare const CapDemoFakeApi: React.FC;
8
- export declare const CapDemoRealApi: React.FC;
9
+ export declare const CapDemoRealApi: StoryObj;
@@ -1,5 +1,4 @@
1
1
  import React from 'react';
2
- import { ApiUrls } from '@opengeoweb/api';
3
2
  import { InitialMapProps } from '@opengeoweb/core';
4
3
  import { CapFeatures } from '../types';
5
4
  export type SupportedComponentTypes = 'CapWarningList' | 'CapWarningMap';
@@ -23,12 +22,11 @@ export interface ComponentsLookUpPayload {
23
22
  componentType: SupportedComponentTypes;
24
23
  id: string;
25
24
  initialProps: InitialProps;
26
- config: ApiUrls;
27
25
  }
28
26
  /**
29
27
  * The lookup table is for registering your own components with the workspace.
30
28
  * @param payload
31
29
  * @returns
32
30
  */
33
- export declare const ComponentsLookUp: ({ componentType, initialProps, productConfigKey, config, id, }: ComponentsLookUpPayload) => React.ReactElement;
31
+ export declare const ComponentsLookUp: ({ componentType, initialProps, productConfigKey, id, }: ComponentsLookUpPayload) => React.ReactElement;
34
32
  export {};
@@ -3,4 +3,5 @@ import GanttModule from './GanttModule';
3
3
  declare const meta: Meta<typeof GanttModule>;
4
4
  export default meta;
5
5
  type Story = StoryObj<typeof GanttModule>;
6
+ export declare const GanttDemoFakeApi: Story;
6
7
  export declare const GanttDemoRealApi: Story;
@@ -11,7 +11,7 @@ export interface MapViewCapConnectProps {
11
11
  top: number;
12
12
  };
13
13
  srs?: string;
14
- capWarningPresets?: CapPresets;
14
+ capWarningPresets: CapPresets;
15
15
  layers?: InitialMapProps['mapPreset']['layers'];
16
16
  children?: React.ReactNode;
17
17
  }
@@ -10,7 +10,7 @@ interface MapViewCapConnectWrapperProps {
10
10
  top: number;
11
11
  };
12
12
  srs?: string;
13
- productConfigKey?: string;
13
+ productConfigKey: string;
14
14
  layers?: InitialMapProps['mapPreset']['layers'];
15
15
  }
16
16
  export declare const MapViewCapConnectWrapper: React.FC<MapViewCapConnectWrapperProps>;
@@ -3,13 +3,13 @@ import { Store } from '@reduxjs/toolkit';
3
3
  import { ThemeProviderProps } from '@opengeoweb/theme';
4
4
  import { Theme } from '@mui/material';
5
5
  import i18n from 'i18next';
6
+ import { QueryClient } from '@tanstack/react-query';
6
7
  export declare const CapThemeWrapper: React.FC<ThemeProviderProps>;
7
- interface CapApiProviderProps {
8
+ interface CapQueryClientProviderProps {
8
9
  children: React.ReactNode;
9
- createApi?: () => void;
10
+ customClient?: QueryClient;
10
11
  }
11
- interface CapThemeStoreProviderProps {
12
- children?: React.ReactNode;
12
+ interface CapThemeStoreProviderProps extends CapQueryClientProviderProps {
13
13
  theme?: Theme;
14
14
  store: Store;
15
15
  i18nInstance?: typeof i18n;
@@ -19,11 +19,11 @@ interface CapTranslationsWrapperProps {
19
19
  i18nInstance?: typeof i18n;
20
20
  }
21
21
  /**
22
- * A Provider component which returns the Api Provider for the Cap library
22
+ * A Provider component which returns the QueryClientProvider for the Cap library
23
23
  * @param children
24
24
  * @returns
25
25
  */
26
- export declare const CapApiProvider: React.FC<CapApiProviderProps>;
26
+ export declare const CapQueryClientProvider: React.FC<CapQueryClientProviderProps>;
27
27
  export interface CapStoreProviderProps extends ThemeProviderProps {
28
28
  store: Store;
29
29
  }
@@ -1,8 +1,10 @@
1
1
  import React from 'react';
2
2
  import { CapPresets } from '../types';
3
+ import { CapAlert } from '../../store/types';
3
4
  interface WarningListCapProps {
4
- capWarningPresets?: CapPresets;
5
- alertIds: string[];
5
+ capWarningPresets: CapPresets;
6
+ alerts: CapAlert[];
7
+ isPending?: boolean;
6
8
  }
7
9
  export declare const WarningListCap: React.FC<WarningListCapProps>;
8
10
  export {};
@@ -1,7 +1,8 @@
1
1
  import React from 'react';
2
+ import { CapAlert } from '../../../store/types';
2
3
  import { CapPresets } from '../../types';
3
4
  interface WarningListRowCapConnectProps {
4
- alertId: string;
5
+ alert: CapAlert;
5
6
  capWarningPresets: CapPresets;
6
7
  }
7
8
  export declare const WarningListRowCapConnect: React.FC<WarningListRowCapConnectProps>;
@@ -6,9 +6,6 @@ interface Feed {
6
6
  feedAddress: string;
7
7
  feedType: string;
8
8
  }
9
- export interface FeedLastUpdated {
10
- lastUpdated: number;
11
- }
12
9
  export interface CapWarnings {
13
10
  alert: CapAlert;
14
11
  features: CapFeatures;
@@ -1,5 +1 @@
1
- export { capActions, capReducer } from './reducer';
2
- export * as capSelectors from './selectors';
3
- export * from './mockStore';
4
- export type { CapModule } from './types';
5
1
  export * from './store';
@@ -1,11 +1,2 @@
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
+ import { Store } from '@reduxjs/toolkit';
2
+ export declare const createMockStore: (mockState?: any) => Store;
@@ -1,5 +1,3 @@
1
- import { EntityState } from '@reduxjs/toolkit';
2
- import { CoreAppStore } from '@opengeoweb/store';
3
1
  import { Language } from '../components/types';
4
2
  export interface CapAlert {
5
3
  feedAddress: string;
@@ -10,33 +8,8 @@ export interface CapAlert {
10
8
  expires: string;
11
9
  languages: Language[];
12
10
  }
13
- export type CapAlertState = EntityState<CapAlert>;
14
11
  export interface CapFeed {
15
12
  id: string;
16
13
  lastUpdated: number;
17
14
  alertIds: string[];
18
15
  }
19
- export type CapFeedState = EntityState<CapFeed>;
20
- export interface CapStore {
21
- feeds: CapFeedState;
22
- alerts: CapAlertState;
23
- }
24
- export interface CapModule {
25
- cap?: CapStore;
26
- }
27
- export interface AddAllFeedAlertsPayload {
28
- feedId: string;
29
- alertUrls: string[];
30
- }
31
- export interface AddManyAlertsToFeedPayload {
32
- feedId: string;
33
- alertIds: string[];
34
- }
35
- export interface FeedLastUpdatedPayload {
36
- id: string;
37
- changes: {
38
- lastUpdated: number;
39
- };
40
- }
41
- export interface AppStore extends CoreAppStore, CapModule {
42
- }
@@ -1,2 +1,2 @@
1
1
  import { CustomFeature } from '../components/types';
2
- export declare const addFeedAdressToCustomGeoJSonFeature: (feedAddress: string, features: CustomFeature[]) => CustomFeature[];
2
+ export declare const addFeedAddressToCustomGeoJSonFeature: (feedAddress: string, features: CustomFeature[]) => CustomFeature[];
@@ -0,0 +1,12 @@
1
+ import { CapAlert, CapPresets, CustomFeature } from '../../components/types';
2
+ export interface FeedAddressLink {
3
+ feedAddress: string;
4
+ link: string;
5
+ }
6
+ export interface CapAlertAndFeatures {
7
+ alert: CapAlert;
8
+ features: CustomFeature[];
9
+ }
10
+ export declare const getConfig: (productConfigKey: string) => Promise<CapPresets>;
11
+ export declare const getFeedLinks: (feedAddress: string) => Promise<FeedAddressLink[]>;
12
+ export declare const getSingleAlert: (alertUrl: FeedAddressLink) => Promise<CapAlertAndFeatures>;
@@ -0,0 +1,2 @@
1
+ export declare const generateAlertId: () => string;
2
+ export declare const capApiEndpoints: import("msw").HttpHandler[];
@@ -0,0 +1,10 @@
1
+ import { UseQueryResult } from '@tanstack/react-query';
2
+ import { CapPresets } from '../../components/types';
3
+ import { CapAlertAndFeatures } from './api';
4
+ interface CombinePendingResult<T> {
5
+ results: T;
6
+ pending: boolean;
7
+ }
8
+ export declare const useGetConfig: (productConfigKey: string) => UseQueryResult<CapPresets>;
9
+ export declare const useAllFeedAlerts: (capPresets: CapPresets) => CombinePendingResult<CapAlertAndFeatures[]>;
10
+ export {};
@@ -1,3 +1,3 @@
1
1
  import { FeatureEvent } from '@opengeoweb/webmap-react';
2
2
  import { CustomFeature } from '../components/types';
3
- export declare const highlightGeoJson: (currentFeatures: Record<string, CustomFeature[]>, featureResults: FeatureEvent) => Record<string, CustomFeature[]>;
3
+ export declare const highlightGeoJson: (currentFeatures: Record<string, CustomFeature[]>, featureResults?: FeatureEvent) => Record<string, CustomFeature[]>;
@@ -3,3 +3,4 @@ import { UseTranslationResponse } from 'react-i18next';
3
3
  export declare const CAP_NAMESPACE = "cap";
4
4
  export declare const initCapI18n: () => typeof i18n;
5
5
  export declare const useCapTranslation: () => UseTranslationResponse<typeof CAP_NAMESPACE, typeof i18n>;
6
+ export { i18n };
@@ -1,19 +1,2 @@
1
1
  import { CapAlert } from '../components/types';
2
2
  export declare const mockAlert: CapAlert;
3
- export declare const mockAlert2: CapAlert;
4
- export declare const mockAlert3: {
5
- identifier: string;
6
- feedAddress: string;
7
- severity: string;
8
- certainty: string;
9
- onset: string;
10
- expires: string;
11
- languages: {
12
- areaDesc: string;
13
- language: string;
14
- event: string;
15
- senderName: string;
16
- headline: string;
17
- description: string;
18
- }[];
19
- };
@@ -1,6 +1,3 @@
1
- import { CapPresets, CapWarnings, FeedLastUpdated } from '../components/types';
1
+ import { CapPresets, CapWarnings } from '../components/types';
2
2
  export declare const mockCapWarningPresets: CapPresets;
3
3
  export declare const mockCapWarnings: CapWarnings;
4
- export declare const mockCapWarnings2: CapWarnings;
5
- export declare const mockCapWarnings3: CapWarnings;
6
- export declare const mockLastUpdated: FeedLastUpdated;
@@ -1,4 +1,2 @@
1
1
  import { CapFeatures } from '../components/types';
2
2
  export declare const mockGeoJson: CapFeatures;
3
- export declare const mockGeoJson2: CapFeatures;
4
- export declare const mockGeoJson3: CapFeatures;
@@ -1,21 +0,0 @@
1
- import { CapStore } from './types';
2
- export declare const mockCapStateWithAlerts: CapStore;
3
- export declare const mockCapStateWithFeeds: {
4
- alerts: {
5
- ids: never[];
6
- entities: {};
7
- };
8
- feeds: {
9
- ids: string[];
10
- entities: {
11
- 'https://alerts.fmi.fi/cap/feed/rss_en-GB.rss': {
12
- id: string;
13
- lastUpdated: number;
14
- };
15
- 'https://api.met.no/weatherapi/metalerts/1.1': {
16
- id: string;
17
- lastUpdated: number;
18
- };
19
- };
20
- };
21
- };
@@ -1,12 +0,0 @@
1
- import { Draft, PayloadAction } from '@reduxjs/toolkit';
2
- import { CapFeed, CapFeedState, CapAlert, CapAlertState, AddManyAlertsToFeedPayload, FeedLastUpdatedPayload, CapStore } from './types';
3
- export declare const feedAdapter: import("@reduxjs/toolkit").EntityAdapter<CapFeed>;
4
- export declare const feedInitialState: CapFeedState;
5
- export declare const alertAdapter: import("@reduxjs/toolkit").EntityAdapter<CapAlert>;
6
- export declare const alertInitialState: CapAlertState;
7
- export declare const initialState: CapStore;
8
- export declare const capReducer: import("redux").Reducer<CapStore>, capActions: import("@reduxjs/toolkit").CaseReducerActions<{
9
- addManyAlerts: (draft: Draft<CapStore>, action: PayloadAction<CapAlert[]>) => void;
10
- addManyAlertsToFeed: (draft: Draft<CapStore>, action: PayloadAction<AddManyAlertsToFeedPayload>) => void;
11
- setFeedLastUpdatedTimes: (draft: Draft<CapStore>, action: PayloadAction<FeedLastUpdatedPayload[]>) => void;
12
- }, "capReducer">;
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1,15 +0,0 @@
1
- import { CoreAppStore } from '@opengeoweb/store';
2
- import { CapAlert, CapModule, CapStore, CapFeed } from './types';
3
- export declare const getCapStore: (store: CapModule) => CapStore;
4
- export declare const getCapFeedById: (state: CapModule, id: import("@reduxjs/toolkit").EntityId) => CapFeed | undefined, getCapFeeds: (state: CapModule) => CapFeed[];
5
- export declare const getAlertById: (state: CapModule, id: import("@reduxjs/toolkit").EntityId) => CapAlert | undefined, getAlerts: (state: CapModule) => CapAlert[], getAlertIds: (state: CapModule) => import("@reduxjs/toolkit").EntityId[];
6
- export declare const getAlertsInEffect: ((state: CapModule & CoreAppStore, selectedTime: string) => CapAlert[]) & import("reselect").OutputSelectorFields<(args_0: CapAlert[], args_1: string) => CapAlert[], {
7
- clearCache: () => void;
8
- }> & {
9
- clearCache: () => void;
10
- };
11
- export declare const getLastUpdatedTimes: ((state: CapModule) => number[]) & import("reselect").OutputSelectorFields<(args_0: CapFeed[]) => number[], {
12
- clearCache: () => void;
13
- }> & {
14
- clearCache: () => void;
15
- };
@@ -1,20 +0,0 @@
1
- import { CreateApiProps } from '@opengeoweb/api';
2
- import { CapFeatures, CapPresets, CapWarnings, FeedLastUpdated } from '../components/types';
3
- export interface CapApi {
4
- getCapConfiguration?: (productConfigKey: string) => Promise<{
5
- data: CapPresets;
6
- }>;
7
- getAllAlerts?: (thirdPartyApiUrl: string) => Promise<{
8
- data: CapFeatures;
9
- }>;
10
- getFeedLinks?: (thirdPartyApiUrl: string) => Promise<{
11
- data: string[];
12
- }>;
13
- getSingleAlert?: (alertUrl: string) => Promise<{
14
- data: CapWarnings;
15
- }>;
16
- getLastUpdated?: (thirdPartyApiUrl: string) => Promise<{
17
- data: FeedLastUpdated;
18
- }>;
19
- }
20
- export declare const createApi: (props: CreateApiProps) => CapApi;
@@ -1 +0,0 @@
1
- export {};
@@ -1,2 +0,0 @@
1
- import { CapApi } from './api';
2
- export declare const createApi: () => CapApi;
@@ -1 +0,0 @@
1
- export {};