@opengeoweb/warnings 21.1.0 → 21.2.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.
@@ -1,5 +1,6 @@
1
1
  import warningsTranslations from '../locales/warnings.json';
2
2
  export * from './lib/components/AreaDrawingManager';
3
+ export { AreaDrawingLoaderConnect } from './lib/components/AreaDrawingLoader/AreaDrawingLoaderConnect';
3
4
  export * from './lib/components/DrawingTool';
4
5
  export * from './lib/components/DrawingToolForm';
5
6
  export * from './lib/components/PublicWarningsFormDialog';
@@ -9,6 +10,8 @@ export * from './lib/components/ComponentsLookUp';
9
10
  export * from './lib/components/WarningsTimeline';
10
11
  export * from './lib/store';
11
12
  export { WARN_NAMESPACE } from './lib/utils/i18n';
13
+ export { getWarningsFeatures } from './lib/utils/warningsFeatures';
14
+ export type { WarningsFeatures } from './lib/utils/warningsFeatures';
12
15
  export { warningsTranslations };
13
16
  export * as publicWarningsSelectors from './lib/store/warningsFilters/selectors';
14
17
  export type * from './lib/store/types';
@@ -1,5 +1,6 @@
1
1
  import type { TimeFilter } from '../components/FilterList/filter-utils';
2
2
  import type { Warning } from '../store/warningsForm/types';
3
+ export declare const markRunOutPublicWarnings: (warnings: Warning[], now: Date) => Warning[];
3
4
  interface WarningsResponse {
4
5
  combinedWarnings: Warning[];
5
6
  refetchWarnings: () => void;
@@ -8,5 +9,5 @@ interface WarningsResponse {
8
9
  dataUpdatedAt: number;
9
10
  }
10
11
  export declare const useWarnings: (disabled?: boolean, timeFilter?: TimeFilter) => WarningsResponse;
11
- export declare function useAutoRefetchOnExpiry(combinedWarnings: Warning[], refetchWarnings: () => void): void;
12
+ export declare function useRefetchAtNextWarningEnd(combinedWarnings: Warning[], refetchWarnings: () => void): void;
12
13
  export {};
@@ -28,6 +28,7 @@ interface UpdateWarningProps {
28
28
  }
29
29
  export declare const useMutateWarning: (snackBarMessage: string) => MutationReturnType<UpdateWarningProps>;
30
30
  export declare const useFetchPublicWarning: () => ((id: string) => Promise<PublicWarning>);
31
+ export declare const usePublicWarning: (id?: string | null) => UseQueryResult<PublicWarning>;
31
32
  export declare const useMutateDeleteWarning: () => MutationReturnType<{
32
33
  id: string;
33
34
  }>;
@@ -7,6 +7,7 @@ export interface ConfirmDialogProps {
7
7
  confirmLabel: string;
8
8
  callback?: (data?: unknown) => void;
9
9
  isLocked?: boolean;
10
+ content?: React.ReactNode;
10
11
  }
11
12
  export declare const ConfirmDeleteWarningDialog: React.FC<{
12
13
  onClose: () => void;
@@ -0,0 +1,2 @@
1
+ import type { ReactElement } from 'react';
2
+ export declare const ExpireWarningPreview: () => ReactElement;
@@ -2,10 +2,10 @@ import type { ListItemProps } from '@mui/material';
2
2
  import React from 'react';
3
3
  import type { PublicWarningStatus } from '../../store/warningsForm/types';
4
4
  import type { TimeFilter } from '../FilterList/filter-utils';
5
- declare const WarningListItemSeperator: React.FC<{
5
+ declare const WarningListItemSeparator: React.FC<{
6
6
  totalWarnings: number;
7
7
  status: PublicWarningStatus;
8
8
  isExpanded: boolean;
9
9
  timeFilter: TimeFilter;
10
10
  } & ListItemProps>;
11
- export default WarningListItemSeperator;
11
+ export default WarningListItemSeparator;
@@ -20,4 +20,5 @@ export declare const levelOptionsDict: Record<string, LevelDetails>;
20
20
  export declare const LevelField: React.FC<{
21
21
  isDisabled?: boolean;
22
22
  isReadOnly?: boolean;
23
+ isExpiryMessage?: boolean;
23
24
  }>;
@@ -45,6 +45,11 @@ export interface FormProps {
45
45
  isDrawingModeActive?: boolean;
46
46
  publicWarningStatus?: PublicWarningStatus;
47
47
  isPublicUpdateDraft?: boolean;
48
+ previousValidFrom?: string;
49
+ isPublishDisabled?: boolean;
50
+ publishDisabledTooltip?: string;
51
+ originalWarningLoadFailed?: boolean;
52
+ onRetryOriginalWarning?: () => void;
48
53
  }
49
54
  export declare function warningLevelFeatureColors(level: WarningLevel | undefined, geoJSON: FeatureCollection<Geometry, GeoJsonProperties> | undefined, // Allow undefined
50
55
  isAviationWarning?: boolean, // Determines if it's an aviation warning
@@ -2,7 +2,6 @@ import type { TFunction } from 'i18next';
2
2
  import React from 'react';
3
3
  export declare const VALID_FROM_MAX_HOURS_AFTER_CURRENT = 192;
4
4
  export declare const VALID_UNTIL_DEFAULT_OFFSET = 6;
5
- export declare const isValueBeforeCurrentTime: (value: string, t: TFunction) => boolean | string;
6
5
  export declare const isMaxHoursAfterCurrentTime: (value: string, t: TFunction) => boolean | string;
7
6
  /**
8
7
  * Automatically adjusts the valid until field when valid from is changed
@@ -16,4 +15,5 @@ export declare const offsetTimeValidUntilField: (validFrom: string, validUntil:
16
15
  export declare const ValidFrom: React.FC<{
17
16
  isDisabled?: boolean;
18
17
  isReadOnly?: boolean;
18
+ previousValidFrom?: string;
19
19
  }>;
@@ -65,6 +65,7 @@ export interface PublicWarning extends BaseWarning {
65
65
  gw_type?: PublicWarningGwType | null;
66
66
  previous_id?: string | null;
67
67
  next_id?: string | null;
68
+ hasRunOut?: boolean;
68
69
  }
69
70
  export interface AirmetWarning extends BaseWarning {
70
71
  type: 'airmet';
@@ -1,6 +1,11 @@
1
1
  import { uiTypes } from '@opengeoweb/store';
2
2
  import { PublicWarningStatus } from './types';
3
+ import type { Warning } from './types';
3
4
  export declare const publicWarningDialogType = uiTypes.DialogTypes.PublicWarnings;
4
5
  export declare const isEndedStatus: (status?: PublicWarningStatus) => boolean;
6
+ export declare const hasWarningEndTimePassed: (warning: Warning, now: Date) => boolean;
7
+ export declare const canPublicWarningRunOut: (warning: Warning) => boolean;
8
+ export declare const hasPublicWarningRunOut: (warning: Warning, now: Date) => boolean;
9
+ export declare const getDisplayStatus: (warning?: Warning) => PublicWarningStatus | undefined;
5
10
  export declare const warningEventDialogType = uiTypes.DialogTypes.WarningsEvent;
6
11
  export declare const warningEventsSummaryDialogType = uiTypes.DialogTypes.WarningsEventSummary;
@@ -0,0 +1,12 @@
1
+ export declare const MAX_TIMEOUT_MS: number;
2
+ /**
3
+ * Like setTimeout, but also works for delays longer than about 24.8 days,
4
+ * such as the end time of a warning that lasts for weeks. Long delays are
5
+ * split into steps of at most MAX_TIMEOUT_MS.
6
+ *
7
+ * A delay that is not a finite number (for example from an invalid date)
8
+ * never runs the callback. Plain setTimeout would run it immediately.
9
+ *
10
+ * Returns a function that cancels the timeout.
11
+ */
12
+ export declare const setLongTimeout: (callback: () => void, delayMs: number) => (() => void);
@@ -0,0 +1,7 @@
1
+ type Validator = (value: string) => boolean | string;
2
+ export interface UseWarningTimeValidation {
3
+ validFromRules: Record<string, Validator>;
4
+ getValidFromWarning: (value: string) => string | undefined;
5
+ }
6
+ export declare const useWarningTimeValidation: (previousValidFrom?: string) => UseWarningTimeValidation;
7
+ export {};
@@ -0,0 +1,6 @@
1
+ import type { TFunction } from 'i18next';
2
+ export declare const VALID_FROM_MAX_HOURS_BEFORE_CURRENT = 1;
3
+ export declare const isValidFromMaxHoursBeforeCurrentTime: (value: string, t: TFunction, previousValidFrom?: string) => boolean | string;
4
+ export declare const getValidFromMinDateTime: (previousValidFrom?: string) => Date;
5
+ export declare const isValidFromNotBeforePrevious: (value: string, t: TFunction, previousValidFrom?: string) => boolean | string;
6
+ export declare const getValidFromWarning: (value: string, t: TFunction) => string | undefined;
@@ -3,8 +3,9 @@ import React from 'react';
3
3
  import type { PickedFilterState, OptionKey } from '../components/FilterList/filter-hooks';
4
4
  import type { FormError } from '../store/warningsEventForm/reducer';
5
5
  import { PublicWarningStatus } from '../store/warningsForm/types';
6
- import type { Warning, WarningEvent, EventWarningForWarningList } from '../store/warningsForm/types';
6
+ import type { Warning, WarningEvent, EventWarningForWarningList, MaritimeWarningsType, WarningType } from '../store/warningsForm/types';
7
7
  export declare const ERROR_NOT_FOUND = "Request failed with status code 400";
8
+ export declare const isMaritimeWarningType: (type?: WarningType) => type is MaritimeWarningsType;
8
9
  export declare const MOCK_USERNAME = "user.name";
9
10
  /** Formats a date or date string (default: now) like `31/01/2024 14:05 UTC` */
10
11
  export declare const getUtcDateLabel: (date?: Date | string) => string;
@@ -13,8 +14,7 @@ interface OverflowCheckResult {
13
14
  isOverflowing: boolean;
14
15
  }
15
16
  export declare const getSortedStatus: (status: PublicWarningStatus) => PublicWarningStatus;
16
- export declare const isExpireMessage: (warning?: Warning) => boolean;
17
- export declare const isExpireOrWithdrawMessage: (warning: Warning) => boolean;
17
+ export declare const isExpireOrWithdrawMessage: (warning?: Warning) => boolean;
18
18
  export declare const isPublicUpdateDraft: (warning?: Warning) => boolean;
19
19
  export declare const getWarningWithoutIdStatusEditor: (warning: Warning) => Warning;
20
20
  export declare const getWarningWithLinkedToId: (warning: Warning) => Warning;
@@ -0,0 +1,15 @@
1
+ import type { ConfigType } from '@opengeoweb/shared';
2
+ export interface WarningsFeatures {
3
+ /** public warnings: needs the warnings backend, enabled by default */
4
+ hasPublicWarnings: boolean;
5
+ /** maritime warnings: needs the warnings backend, disabled by default */
6
+ hasMaritimeWarnings: boolean;
7
+ /** warning events: needs the warnings backend, disabled by default */
8
+ hasWarningEvents: boolean;
9
+ }
10
+ /**
11
+ * Reads which warning types backed by the warnings backend
12
+ * (GW_DRAWINGS_BASE_URL) are enabled. Requests for a disabled type should not
13
+ * be made.
14
+ */
15
+ export declare const getWarningsFeatures: (config?: ConfigType) => WarningsFeatures;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opengeoweb/warnings",
3
- "version": "21.1.0",
3
+ "version": "21.2.0",
4
4
  "description": "GeoWeb warinings library for the opengeoweb project",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -20,24 +20,24 @@
20
20
  }
21
21
  },
22
22
  "dependencies": {
23
- "@opengeoweb/api": "21.1.0",
24
- "@opengeoweb/shared": "21.1.0",
25
- "@opengeoweb/store": "21.1.0",
26
- "@opengeoweb/webmap-react": "21.1.0",
23
+ "@opengeoweb/api": "21.2.0",
24
+ "@opengeoweb/shared": "21.2.0",
25
+ "@opengeoweb/store": "21.2.0",
26
+ "@opengeoweb/webmap-react": "21.2.0",
27
27
  "@tanstack/react-query": "^5.85.5",
28
28
  "react-redux": "^9.2.0",
29
- "@opengeoweb/theme": "21.1.0",
30
- "@opengeoweb/form-fields": "21.1.0",
29
+ "@opengeoweb/theme": "21.2.0",
30
+ "@opengeoweb/form-fields": "21.2.0",
31
31
  "react-hook-form": "^7.50.1",
32
32
  "lodash": "^4.18.1",
33
33
  "@reduxjs/toolkit": "^2.6.1",
34
- "@opengeoweb/snackbar": "21.1.0",
34
+ "@opengeoweb/snackbar": "21.2.0",
35
35
  "react-window": "^2.2.6",
36
36
  "axios": "^1.20.0",
37
- "@opengeoweb/core": "21.1.0",
38
- "@opengeoweb/webmap": "21.1.0",
39
- "@opengeoweb/authentication": "21.1.0",
40
- "@opengeoweb/sigmet-airmet": "21.1.0",
37
+ "@opengeoweb/core": "21.2.0",
38
+ "@opengeoweb/webmap": "21.2.0",
39
+ "@opengeoweb/authentication": "21.2.0",
40
+ "@opengeoweb/sigmet-airmet": "21.2.0",
41
41
  "react-i18next": "^15.1.1",
42
42
  "i18next": "^25.0.1",
43
43
  "@mui/material": "^9.0.1",
@@ -53,7 +53,7 @@
53
53
  "@emotion/styled": "*"
54
54
  },
55
55
  "devDependencies": {
56
- "eslint-plugin-storybook": "10.3.3"
56
+ "eslint-plugin-storybook": "^10.3.3"
57
57
  },
58
58
  "files": [
59
59
  "dist",