@opengeoweb/shared 9.17.0 → 9.18.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 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 i18next from 'i18next';
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
 
@@ -2179,7 +2179,7 @@ const CustomDialog = _a => {
2179
2179
 
2180
2180
  const SHARED_NAMESPACE = 'shared';
2181
2181
  const initSharedI18n = () => {
2182
- i18next.use(initReactI18next).init({
2182
+ i18n.use(initReactI18next).init({
2183
2183
  lng: 'en',
2184
2184
  ns: SHARED_NAMESPACE,
2185
2185
  interpolation: {
@@ -2201,7 +2201,7 @@ const initSharedI18n = () => {
2201
2201
  }
2202
2202
  });
2203
2203
  };
2204
- const translateKeyOutsideComponents = (key, params = undefined) => i18next.t(key, Object.assign({
2204
+ const translateKeyOutsideComponents = (key, params = undefined) => i18n.t(key, Object.assign({
2205
2205
  ns: SHARED_NAMESPACE
2206
2206
  }, params));
2207
2207
 
@@ -8566,6 +8566,7 @@ var index = /*#__PURE__*/Object.freeze({
8566
8566
  startOfDay: startOfDay,
8567
8567
  parseISO: parseISO,
8568
8568
  isWithinInterval: isWithinInterval,
8569
+ getDayOfYear: getDayOfYear,
8569
8570
  getDay: getDay,
8570
8571
  getMonth: getMonth,
8571
8572
  getYear: getYear,
@@ -8621,39 +8622,6 @@ const createToolkitMockStoreWithEggs = storeConfig => {
8621
8622
  return store;
8622
8623
  };
8623
8624
 
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
8625
  /* *
8658
8626
  * Licensed under the Apache License, Version 2.0 (the "License");
8659
8627
  * you may not use this file except in compliance with the License.
@@ -8702,4 +8670,4 @@ class RenderCounter {
8702
8670
  }
8703
8671
  const renderCounter = new RenderCounter();
8704
8672
 
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, handleOutsideComponentTranslations, initSharedI18n, isAxiosError, pollingIntervalTimeout, renderCounter, sharedTranslations, showPrompt, sliderHeaderStyle, tooltipContainerStyles, translateKeyOutsideComponents, useConfirmationDialog, useControlledTooltip, useDebounce, useDialogActions, useIsMounted, useMakeSureContainerStaysInsideWindow, usePoller, usePreventBrowserClose, usePrevious, useUserMenu, withEggs };
8673
+ 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, isAxiosError, pollingIntervalTimeout, renderCounter, sharedTranslations, showPrompt, sliderHeaderStyle, tooltipContainerStyles, translateKeyOutsideComponents, useConfirmationDialog, useControlledTooltip, useDebounce, useDialogActions, useIsMounted, useMakeSureContainerStaysInsideWindow, usePoller, usePreventBrowserClose, usePrevious, useUserMenu, withEggs };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opengeoweb/shared",
3
- "version": "9.17.0",
3
+ "version": "9.18.0",
4
4
  "description": "GeoWeb shared library with shared components and utils for the opengeoweb project",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -4,6 +4,8 @@ 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;
@@ -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, };
@@ -1,5 +1,4 @@
1
1
  export * from './axiosErrorUtils';
2
2
  export * as dateUtils from './dateUtils';
3
3
  export * from './reduxTestUtils';
4
- export * from './translationUtils';
5
4
  export { renderCounter } from './renderCounter';
@@ -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;