@opengeoweb/shared 9.17.0 → 9.19.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/index.esm.js +29 -44
- package/package.json +1 -1
- package/src/lib/components/StatusTag/StatusTag.d.ts +1 -0
- package/src/lib/types/types.d.ts +3 -0
- package/src/lib/utils/axiosErrorUtils/axiosErrorUtils.d.ts +1 -0
- package/src/lib/utils/dateUtils/dateUtils.d.ts +2 -2
- package/src/lib/utils/index.d.ts +0 -1
- package/src/lib/utils/translationUtils/index.d.ts +0 -1
- package/src/lib/utils/translationUtils/translationUtils.d.ts +0 -7
- package/src/lib/utils/translationUtils/translationUtils.spec.d.ts +0 -1
package/index.esm.js
CHANGED
|
@@ -2,7 +2,7 @@ import * as React from 'react';
|
|
|
2
2
|
import React__default, { useRef, Component } from 'react';
|
|
3
3
|
import { Box, Typography, Tooltip, IconButton, Dialog, DialogTitle, DialogContent, DialogActions, Button, CircularProgress, Alert, AlertTitle, useTheme, Drawer, Link, Avatar as Avatar$1, Paper, ClickAwayListener, MenuList, MenuItem, Grid, RadioGroup, FormControlLabel, Radio, List, ListItem, Tabs, Tab, Backdrop, Switch, Slider, ToggleButton, Menu, ListSubheader, ListItemText, ListItemIcon, Select, Accordion, AccordionSummary, AccordionDetails, FormLabel, TextField, InputAdornment } from '@mui/material';
|
|
4
4
|
import { Close, Exclamation, Success, Info, ChevronRight, GeoWebLogo, HamburgerMenu, Resize, Admin, useThemeContext, DragHandle, ArrowLeft, ArrowRight, KeyOption, ArrowUp, ArrowDown, KeyCommand, Options, ChevronDown, Search, Clear, Cached } from '@opengeoweb/theme';
|
|
5
|
-
import
|
|
5
|
+
import i18n from 'i18next';
|
|
6
6
|
import { initReactI18next, useTranslation } from 'react-i18next';
|
|
7
7
|
import { throttle, escapeRegExp, debounce } from 'lodash';
|
|
8
8
|
import Draggable from 'react-draggable';
|
|
@@ -10,7 +10,7 @@ import { Resizable } from 're-resizable';
|
|
|
10
10
|
import * as Sentry from '@sentry/react';
|
|
11
11
|
import { styled } from '@mui/material/styles';
|
|
12
12
|
import { useStore } from 'react-redux';
|
|
13
|
-
import { parseISO, parse, format, isEqual, add as add$1, sub as sub$1, differenceInYears as differenceInYears$1, differenceInMonths as differenceInMonths$1, differenceInDays as differenceInDays$1, differenceInMinutes as differenceInMinutes$1, differenceInHours as differenceInHours$1, differenceInSeconds as differenceInSeconds$1, isBefore as isBefore$1, isAfter as isAfter$1, isValid as isValid$1, getUnixTime, fromUnixTime, set as set$3, getHours as getHours$1, startOfDay, addMinutes, addHours, isWithinInterval, getDay, getMonth, getYear, getWeek } from 'date-fns';
|
|
13
|
+
import { parseISO, parse, format, isEqual, add as add$1, sub as sub$1, differenceInYears as differenceInYears$1, differenceInMonths as differenceInMonths$1, differenceInDays as differenceInDays$1, differenceInMinutes as differenceInMinutes$1, differenceInHours as differenceInHours$1, differenceInSeconds as differenceInSeconds$1, isBefore as isBefore$1, isAfter as isAfter$1, isValid as isValid$1, getUnixTime, fromUnixTime, set as set$3, getHours as getHours$1, startOfDay, addMinutes, addHours, isWithinInterval, getDayOfYear, getDay, getMonth, getYear, getWeek } from 'date-fns';
|
|
14
14
|
import configureStore from 'redux-mock-store';
|
|
15
15
|
import { configureStore as configureStore$1 } from '@reduxjs/toolkit';
|
|
16
16
|
|
|
@@ -533,10 +533,10 @@ var SHARED = '__core-js_shared__';
|
|
|
533
533
|
var store$3 = sharedStore.exports = globalThis$1[SHARED] || defineGlobalProperty$2(SHARED, {});
|
|
534
534
|
|
|
535
535
|
(store$3.versions || (store$3.versions = [])).push({
|
|
536
|
-
version: '3.
|
|
536
|
+
version: '3.37.1',
|
|
537
537
|
mode: 'global',
|
|
538
538
|
copyright: '© 2014-2024 Denis Pushkarev (zloirock.ru)',
|
|
539
|
-
license: 'https://github.com/zloirock/core-js/blob/v3.
|
|
539
|
+
license: 'https://github.com/zloirock/core-js/blob/v3.37.1/LICENSE',
|
|
540
540
|
source: 'https://github.com/zloirock/core-js'
|
|
541
541
|
});
|
|
542
542
|
|
|
@@ -1370,17 +1370,27 @@ const tagStyle = color => {
|
|
|
1370
1370
|
const StatusTag = _a => {
|
|
1371
1371
|
var {
|
|
1372
1372
|
content,
|
|
1373
|
-
color
|
|
1373
|
+
color,
|
|
1374
|
+
icon
|
|
1374
1375
|
} = _a,
|
|
1375
|
-
props = __rest(_a, ["content", "color"]);
|
|
1376
|
+
props = __rest(_a, ["content", "color", "icon"]);
|
|
1376
1377
|
return /*#__PURE__*/React.createElement(Box, {
|
|
1377
1378
|
display: "flex",
|
|
1378
1379
|
alignItems: "center",
|
|
1379
|
-
|
|
1380
|
+
textAlign: "center",
|
|
1380
1381
|
"data-testid": "statusTag",
|
|
1381
1382
|
className: "statusTag",
|
|
1383
|
+
position: "relative",
|
|
1382
1384
|
sx: Object.assign(Object.assign({}, tagStyle(color)), props.sx)
|
|
1383
|
-
}, /*#__PURE__*/React.createElement(
|
|
1385
|
+
}, /*#__PURE__*/React.createElement(Box, {
|
|
1386
|
+
sx: {
|
|
1387
|
+
position: 'absolute',
|
|
1388
|
+
color: 'geowebColors.iconButtons.flat.default.color'
|
|
1389
|
+
}
|
|
1390
|
+
}, icon), /*#__PURE__*/React.createElement(Typography, {
|
|
1391
|
+
sx: {
|
|
1392
|
+
width: '100%'
|
|
1393
|
+
},
|
|
1384
1394
|
variant: "caption"
|
|
1385
1395
|
}, content));
|
|
1386
1396
|
};
|
|
@@ -2179,7 +2189,7 @@ const CustomDialog = _a => {
|
|
|
2179
2189
|
|
|
2180
2190
|
const SHARED_NAMESPACE = 'shared';
|
|
2181
2191
|
const initSharedI18n = () => {
|
|
2182
|
-
|
|
2192
|
+
i18n.use(initReactI18next).init({
|
|
2183
2193
|
lng: 'en',
|
|
2184
2194
|
ns: SHARED_NAMESPACE,
|
|
2185
2195
|
interpolation: {
|
|
@@ -2201,7 +2211,7 @@ const initSharedI18n = () => {
|
|
|
2201
2211
|
}
|
|
2202
2212
|
});
|
|
2203
2213
|
};
|
|
2204
|
-
const translateKeyOutsideComponents = (key, params = undefined) =>
|
|
2214
|
+
const translateKeyOutsideComponents = (key, params = undefined) => i18n.t(key, Object.assign({
|
|
2205
2215
|
ns: SHARED_NAMESPACE
|
|
2206
2216
|
}, params));
|
|
2207
2217
|
|
|
@@ -7839,6 +7849,13 @@ const DEFAULT_ERROR_MESSAGE = 'An error has occurred';
|
|
|
7839
7849
|
const isAxiosError = error => {
|
|
7840
7850
|
return error.isAxiosError !== undefined;
|
|
7841
7851
|
};
|
|
7852
|
+
const isAxiosAuthError = error => {
|
|
7853
|
+
var _a, _b;
|
|
7854
|
+
if (isAxiosError(error)) {
|
|
7855
|
+
return ((_a = error.response) === null || _a === void 0 ? void 0 : _a.status) === 401 || ((_b = error.response) === null || _b === void 0 ? void 0 : _b.status) === 403;
|
|
7856
|
+
}
|
|
7857
|
+
return false;
|
|
7858
|
+
};
|
|
7842
7859
|
const getAxiosErrorMessage = error => {
|
|
7843
7860
|
const data = error.response && error.response.data;
|
|
7844
7861
|
if (data && typeof data === 'string') {
|
|
@@ -8566,6 +8583,7 @@ var index = /*#__PURE__*/Object.freeze({
|
|
|
8566
8583
|
startOfDay: startOfDay,
|
|
8567
8584
|
parseISO: parseISO,
|
|
8568
8585
|
isWithinInterval: isWithinInterval,
|
|
8586
|
+
getDayOfYear: getDayOfYear,
|
|
8569
8587
|
getDay: getDay,
|
|
8570
8588
|
getMonth: getMonth,
|
|
8571
8589
|
getYear: getYear,
|
|
@@ -8621,39 +8639,6 @@ const createToolkitMockStoreWithEggs = storeConfig => {
|
|
|
8621
8639
|
return store;
|
|
8622
8640
|
};
|
|
8623
8641
|
|
|
8624
|
-
/**
|
|
8625
|
-
* Update i18next translations on the fly when used outside React components
|
|
8626
|
-
* NOTE: If possible pass the `t` function instead of using this
|
|
8627
|
-
* Because this doesnt trigger a rerender when using a language select
|
|
8628
|
-
* This only works for simple values, no interpolation
|
|
8629
|
-
*/
|
|
8630
|
-
const handleOutsideComponentTranslations = (translationList, namespace, defaultLanguage = 'en') => {
|
|
8631
|
-
var _a;
|
|
8632
|
-
// we need to create a new object, do not reference the original list directly
|
|
8633
|
-
const outsideComponentTranslations = Object.assign({}, translationList[defaultLanguage]);
|
|
8634
|
-
const updateOutsideComponentTranslations = () => {
|
|
8635
|
-
Object.keys(outsideComponentTranslations).forEach(key => {
|
|
8636
|
-
// @ts-expect-error we need to reassign the translations
|
|
8637
|
-
outsideComponentTranslations[key] = i18next.t(key, {
|
|
8638
|
-
ns: namespace
|
|
8639
|
-
});
|
|
8640
|
-
});
|
|
8641
|
-
};
|
|
8642
|
-
if (i18next.isInitialized) {
|
|
8643
|
-
updateOutsideComponentTranslations();
|
|
8644
|
-
}
|
|
8645
|
-
i18next.on('initialized', () => {
|
|
8646
|
-
updateOutsideComponentTranslations();
|
|
8647
|
-
});
|
|
8648
|
-
i18next.on('languageChanged', () => {
|
|
8649
|
-
updateOutsideComponentTranslations();
|
|
8650
|
-
});
|
|
8651
|
-
(_a = i18next.store) === null || _a === void 0 ? void 0 : _a.on('added', () => {
|
|
8652
|
-
updateOutsideComponentTranslations();
|
|
8653
|
-
});
|
|
8654
|
-
return outsideComponentTranslations;
|
|
8655
|
-
};
|
|
8656
|
-
|
|
8657
8642
|
/* *
|
|
8658
8643
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
8659
8644
|
* you may not use this file except in compliance with the License.
|
|
@@ -8702,4 +8687,4 @@ class RenderCounter {
|
|
|
8702
8687
|
}
|
|
8703
8688
|
const renderCounter = new RenderCounter();
|
|
8704
8689
|
|
|
8705
|
-
export { AlertBanner, AlertIcon, AppHeader, AppLayout, Avatar, CanvasComponent, ConfirmationDialog, ConfirmationServiceProvider, CustomAccordion, CustomDialog, CustomIconButton, CustomSlider, CustomToggleButton, CustomTooltip, DEFAULT_ERROR_MESSAGE, DraggableComponent$1 as Draggable, ErrorBoundary, LastUpdateTime, ResizeComponent as Resizable, SHARED_NAMESPACE, SearchField, SearchFieldButton, SearchHighlight, StatusTag, SwitchButton, ToggleMenu, ToolContainer, DraggableComponent as ToolContainerDraggable, ToolFooter, ToolHeader, TooltipSelect, UserMenu, UserMenuItemCheatSheet, UserMenuItemSentryRecording, MenuItemTheme as UserMenuItemTheme, adjustPosition, calculateDialogSizeAndPosition, calculateStartSize, createMockStoreWithEggs, createMockStoreWithEggsAndMiddleware, createToolkitMockStoreWithEggs, index as dateUtils, defaultDelay, getAxiosErrorMessage, getAxiosWarningMessage, getErrorMessage, getInitials, getLastUpdateTitle, getPosition, getWarningMessage,
|
|
8690
|
+
export { AlertBanner, AlertIcon, AppHeader, AppLayout, Avatar, CanvasComponent, ConfirmationDialog, ConfirmationServiceProvider, CustomAccordion, CustomDialog, CustomIconButton, CustomSlider, CustomToggleButton, CustomTooltip, DEFAULT_ERROR_MESSAGE, DraggableComponent$1 as Draggable, ErrorBoundary, LastUpdateTime, ResizeComponent as Resizable, SHARED_NAMESPACE, SearchField, SearchFieldButton, SearchHighlight, StatusTag, SwitchButton, ToggleMenu, ToolContainer, DraggableComponent as ToolContainerDraggable, ToolFooter, ToolHeader, TooltipSelect, UserMenu, UserMenuItemCheatSheet, UserMenuItemSentryRecording, MenuItemTheme as UserMenuItemTheme, adjustPosition, calculateDialogSizeAndPosition, calculateStartSize, createMockStoreWithEggs, createMockStoreWithEggsAndMiddleware, createToolkitMockStoreWithEggs, index as dateUtils, defaultDelay, getAxiosErrorMessage, getAxiosWarningMessage, getErrorMessage, getInitials, getLastUpdateTitle, getPosition, getWarningMessage, initSharedI18n, isAxiosAuthError, isAxiosError, pollingIntervalTimeout, renderCounter, sharedTranslations, showPrompt, sliderHeaderStyle, tooltipContainerStyles, translateKeyOutsideComponents, useConfirmationDialog, useControlledTooltip, useDebounce, useDialogActions, useIsMounted, useMakeSureContainerStaysInsideWindow, usePoller, usePreventBrowserClose, usePrevious, useUserMenu, withEggs };
|
package/package.json
CHANGED
package/src/lib/types/types.d.ts
CHANGED
|
@@ -4,12 +4,15 @@ export interface ConfigType {
|
|
|
4
4
|
GW_AUTH_LOGOUT_URL?: string;
|
|
5
5
|
GW_AUTH_TOKEN_URL?: string;
|
|
6
6
|
GW_AUTH_CLIENT_ID?: string;
|
|
7
|
+
GW_AUTH_ROLE_CLAIM_NAME?: string;
|
|
8
|
+
GW_AUTH_ROLE_CLAIM_VALUE_PRESETS_ADMIN?: string;
|
|
7
9
|
GW_BE_VERSION_BASE_URL?: string;
|
|
8
10
|
GW_APP_URL?: string;
|
|
9
11
|
GW_INITIAL_PRESETS_FILENAME?: string;
|
|
10
12
|
GW_CAP_CONFIGURATION_FILENAME?: string;
|
|
11
13
|
GW_TIMESERIES_CONFIGURATION_FILENAME?: string;
|
|
12
14
|
GW_DEFAULT_THEME?: ThemeTypes;
|
|
15
|
+
GW_INITIAL_WORKSPACE_PRESET?: string;
|
|
13
16
|
GW_SW_BASE_URL?: string;
|
|
14
17
|
GW_SIGMET_BASE_URL?: string;
|
|
15
18
|
GW_AIRMET_BASE_URL?: string;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { AxiosError } from 'axios';
|
|
2
2
|
export declare const DEFAULT_ERROR_MESSAGE = "An error has occurred";
|
|
3
3
|
export declare const isAxiosError: (error: AxiosError | Error) => error is AxiosError<unknown, any>;
|
|
4
|
+
export declare const isAxiosAuthError: (error: AxiosError | Error) => boolean;
|
|
4
5
|
export declare const getAxiosErrorMessage: (error: AxiosError) => string;
|
|
5
6
|
export declare const getErrorMessage: (error: Error | AxiosError) => string;
|
|
6
7
|
export declare const getAxiosWarningMessage: (error: AxiosError) => string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { parseISO, isEqual, Duration, startOfDay, isWithinInterval, getDay, getMonth, getYear, getWeek } from 'date-fns';
|
|
1
|
+
import { parseISO, isEqual, Duration, startOfDay, isWithinInterval, getDayOfYear, getDay, getMonth, getYear, getWeek } from 'date-fns';
|
|
2
2
|
export interface DateValues {
|
|
3
3
|
year?: number;
|
|
4
4
|
month?: number;
|
|
@@ -331,4 +331,4 @@ export declare const convertNOWandTODAYFormatsToUTC: (timeValue: string) => stri
|
|
|
331
331
|
* @param {Date} date - second date
|
|
332
332
|
* @returns {boolean} - True if dates are equal
|
|
333
333
|
*/
|
|
334
|
-
export { isEqual, startOfDay, parseISO, isWithinInterval, getDay, getMonth, getYear, getWeek, };
|
|
334
|
+
export { isEqual, startOfDay, parseISO, isWithinInterval, getDayOfYear, getDay, getMonth, getYear, getWeek, };
|
package/src/lib/utils/index.d.ts
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './translationUtils';
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Update i18next translations on the fly when used outside React components
|
|
3
|
-
* NOTE: If possible pass the `t` function instead of using this
|
|
4
|
-
* Because this doesnt trigger a rerender when using a language select
|
|
5
|
-
* This only works for simple values, no interpolation
|
|
6
|
-
*/
|
|
7
|
-
export declare const handleOutsideComponentTranslations: <T extends Record<string, string>>(translationList: Record<string, T>, namespace: string, defaultLanguage?: string) => T;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|