@opengeoweb/snackbar 9.28.1 → 9.29.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.
package/index.esm.js CHANGED
@@ -1145,84 +1145,48 @@ typeof SuppressedError === "function" ? SuppressedError : function (error, suppr
1145
1145
  return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
1146
1146
  };
1147
1147
 
1148
- /* *
1149
- * Licensed under the Apache License, Version 2.0 (the "License");
1150
- * you may not use this file except in compliance with the License.
1151
- * You may obtain a copy of the License at
1152
- *
1153
- * http://www.apache.org/licenses/LICENSE-2.0
1154
- *
1155
- * Unless required by applicable law or agreed to in writing, software
1156
- * distributed under the License is distributed on an "AS IS" BASIS,
1157
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1158
- * See the License for the specific language governing permissions and
1159
- * limitations under the License.
1160
- *
1161
- * Copyright 2024 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
1162
- * Copyright 2024 - Finnish Meteorological Institute (FMI)
1163
- * Copyright 2024 - The Norwegian Meteorological Institute (MET Norway)
1148
+ /* *
1149
+ * Licensed under the Apache License, Version 2.0 (the "License");
1150
+ * you may not use this file except in compliance with the License.
1151
+ * You may obtain a copy of the License at
1152
+ *
1153
+ * http://www.apache.org/licenses/LICENSE-2.0
1154
+ *
1155
+ * Unless required by applicable law or agreed to in writing, software
1156
+ * distributed under the License is distributed on an "AS IS" BASIS,
1157
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1158
+ * See the License for the specific language governing permissions and
1159
+ * limitations under the License.
1160
+ *
1161
+ * Copyright 2024 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
1162
+ * Copyright 2024 - Finnish Meteorological Institute (FMI)
1163
+ * Copyright 2024 - The Norwegian Meteorological Institute (MET Norway)
1164
1164
  * */
1165
1165
  const SNACKBAR_NAMESPACE = 'snackbar';
1166
- const useSnackbarTranslation = () => useTranslation(SNACKBAR_NAMESPACE);
1167
-
1168
- const SnackbarWrapper = _a => {
1169
- var {
1170
- children,
1171
- isOpen,
1172
- onCloseSnackbar,
1173
- id
1174
- } = _a,
1175
- props = __rest(_a, ["children", "isOpen", "onCloseSnackbar", "id"]);
1176
- const {
1177
- t
1178
- } = useSnackbarTranslation();
1179
- return jsxs(Fragment, {
1180
- children: [children, jsx(Snackbar, Object.assign({
1181
- "data-testid": "snackbarComponent",
1182
- open: isOpen,
1183
- onClose: onCloseSnackbar,
1184
- autoHideDuration: null,
1185
- ClickAwayListenerProps: {
1186
- mouseEvent: false
1187
- },
1188
- action: jsx(CustomIconButton, Object.assign({
1189
- "aria-label": t('snackbar-close'),
1190
- "data-testid": "snackbarCloseButton",
1191
- onClick: onCloseSnackbar,
1192
- size: "large",
1193
- sx: {
1194
- '&.MuiButtonBase-root': {
1195
- borderRadius: 20,
1196
- color: 'geowebColors.snackbar.action',
1197
- '&:hover': {
1198
- color: 'geowebColors.snackbar.action',
1199
- backgroundColor: 'geowebColors.snackbar.actionHover.rgba'
1200
- }
1201
- }
1202
- }
1203
- }, {
1204
- children: jsx(Close, {})
1205
- }))
1206
- }, props), id)]
1207
- });
1208
- };
1166
+ const WORKSPACE_NAMESPACE = 'workspace';
1167
+ const WARN_NAMESPACE = 'warn';
1168
+ const LAYER_SELECT_NAMESPACE = 'layerselect';
1169
+ const AUTH_NAMESPACE = 'auth';
1170
+ const useSnackbarTranslation = () => useTranslation([SNACKBAR_NAMESPACE, WORKSPACE_NAMESPACE, WARN_NAMESPACE, LAYER_SELECT_NAMESPACE, AUTH_NAMESPACE], {
1171
+ nsMode: 'fallback'
1172
+ });
1209
1173
 
1210
- /* *
1211
- * Licensed under the Apache License, Version 2.0 (the "License");
1212
- * you may not use this file except in compliance with the License.
1213
- * You may obtain a copy of the License at
1214
- *
1215
- * http://www.apache.org/licenses/LICENSE-2.0
1216
- *
1217
- * Unless required by applicable law or agreed to in writing, software
1218
- * distributed under the License is distributed on an "AS IS" BASIS,
1219
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1220
- * See the License for the specific language governing permissions and
1221
- * limitations under the License.
1222
- *
1223
- * Copyright 2022 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
1224
- * Copyright 2022 - Finnish Meteorological Institute (FMI)
1225
- * Copyright 2024 - The Norwegian Meteorological Institute (MET Norway)
1174
+ /* *
1175
+ * Licensed under the Apache License, Version 2.0 (the "License");
1176
+ * you may not use this file except in compliance with the License.
1177
+ * You may obtain a copy of the License at
1178
+ *
1179
+ * http://www.apache.org/licenses/LICENSE-2.0
1180
+ *
1181
+ * Unless required by applicable law or agreed to in writing, software
1182
+ * distributed under the License is distributed on an "AS IS" BASIS,
1183
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1184
+ * See the License for the specific language governing permissions and
1185
+ * limitations under the License.
1186
+ *
1187
+ * Copyright 2022 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
1188
+ * Copyright 2022 - Finnish Meteorological Institute (FMI)
1189
+ * Copyright 2024 - The Norwegian Meteorological Institute (MET Norway)
1226
1190
  * */
1227
1191
  const snackbarAdapter = createEntityAdapter();
1228
1192
  const initialState = snackbarAdapter.getInitialState();
@@ -1258,22 +1222,22 @@ const {
1258
1222
  } = slice;
1259
1223
  const snackbarActions = slice.actions;
1260
1224
 
1261
- /* *
1262
- * Licensed under the Apache License, Version 2.0 (the "License");
1263
- * you may not use this file except in compliance with the License.
1264
- * You may obtain a copy of the License at
1265
- *
1266
- * http://www.apache.org/licenses/LICENSE-2.0
1267
- *
1268
- * Unless required by applicable law or agreed to in writing, software
1269
- * distributed under the License is distributed on an "AS IS" BASIS,
1270
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1271
- * See the License for the specific language governing permissions and
1272
- * limitations under the License.
1273
- *
1274
- * Copyright 2022 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
1275
- * Copyright 2022 - Finnish Meteorological Institute (FMI)
1276
- * Copyright 2024 - The Norwegian Meteorological Institute (MET Norway)
1225
+ /* *
1226
+ * Licensed under the Apache License, Version 2.0 (the "License");
1227
+ * you may not use this file except in compliance with the License.
1228
+ * You may obtain a copy of the License at
1229
+ *
1230
+ * http://www.apache.org/licenses/LICENSE-2.0
1231
+ *
1232
+ * Unless required by applicable law or agreed to in writing, software
1233
+ * distributed under the License is distributed on an "AS IS" BASIS,
1234
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1235
+ * See the License for the specific language governing permissions and
1236
+ * limitations under the License.
1237
+ *
1238
+ * Copyright 2022 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
1239
+ * Copyright 2022 - Finnish Meteorological Institute (FMI)
1240
+ * Copyright 2024 - The Norwegian Meteorological Institute (MET Norway)
1277
1241
  * */
1278
1242
  const getSnackbarStore = store => {
1279
1243
  if (store && store.snackbar) {
@@ -1301,26 +1265,32 @@ var selectors = /*#__PURE__*/Object.freeze({
1301
1265
  getSnackbarStore: getSnackbarStore
1302
1266
  });
1303
1267
 
1304
- /* *
1305
- * Licensed under the Apache License, Version 2.0 (the "License");
1306
- * you may not use this file except in compliance with the License.
1307
- * You may obtain a copy of the License at
1308
- *
1309
- * http://www.apache.org/licenses/LICENSE-2.0
1310
- *
1311
- * Unless required by applicable law or agreed to in writing, software
1312
- * distributed under the License is distributed on an "AS IS" BASIS,
1313
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1314
- * See the License for the specific language governing permissions and
1315
- * limitations under the License.
1316
- *
1317
- * Copyright 2022 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
1318
- * Copyright 2022 - Finnish Meteorological Institute (FMI)
1319
- * Copyright 2024 - The Norwegian Meteorological Institute (MET Norway)
1268
+ /* *
1269
+ * Licensed under the Apache License, Version 2.0 (the "License");
1270
+ * you may not use this file except in compliance with the License.
1271
+ * You may obtain a copy of the License at
1272
+ *
1273
+ * http://www.apache.org/licenses/LICENSE-2.0
1274
+ *
1275
+ * Unless required by applicable law or agreed to in writing, software
1276
+ * distributed under the License is distributed on an "AS IS" BASIS,
1277
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1278
+ * See the License for the specific language governing permissions and
1279
+ * limitations under the License.
1280
+ *
1281
+ * Copyright 2022 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
1282
+ * Copyright 2022 - Finnish Meteorological Institute (FMI)
1283
+ * Copyright 2024 - The Norwegian Meteorological Institute (MET Norway)
1320
1284
  * */
1285
+ var SnackbarMessageType;
1286
+ (function (SnackbarMessageType) {
1287
+ SnackbarMessageType["TRANSLATABLE_MESSAGE"] = "TRANSLATABLE_MESSAGE";
1288
+ SnackbarMessageType["VERBATIM_MESSAGE"] = "VERBATIM_MESSAGE";
1289
+ })(SnackbarMessageType || (SnackbarMessageType = {}));
1321
1290
 
1322
1291
  var types = /*#__PURE__*/Object.freeze({
1323
- __proto__: null
1292
+ __proto__: null,
1293
+ get SnackbarMessageType () { return SnackbarMessageType; }
1324
1294
  });
1325
1295
 
1326
1296
  var wellKnownSymbol$1 = wellKnownSymbol$3;
@@ -1436,9 +1406,6 @@ snackbarListener.startListening({
1436
1406
  payload
1437
1407
  }, listenerApi) => __awaiter(void 0, void 0, void 0, function* () {
1438
1408
  listenerApi.cancelActiveListeners();
1439
- const {
1440
- message: snackbarMessage
1441
- } = payload;
1442
1409
  const currentSnackbarMessages = getCurrentSnackbarMessages(listenerApi.getState());
1443
1410
  // If there are currently opened snackbars we need to close these first
1444
1411
  if (currentSnackbarMessages.length) {
@@ -1448,7 +1415,7 @@ snackbarListener.startListening({
1448
1415
  const id = `snackbar${Date.now().toString()}`;
1449
1416
  listenerApi.dispatch(snackbarActions.triggerOpenSnackbarByListener({
1450
1417
  snackbarContent: {
1451
- message: snackbarMessage,
1418
+ message: payload,
1452
1419
  id
1453
1420
  }
1454
1421
  }));
@@ -1461,22 +1428,22 @@ snackbarListener.startListening({
1461
1428
  })
1462
1429
  });
1463
1430
 
1464
- /* *
1465
- * Licensed under the Apache License, Version 2.0 (the "License");
1466
- * you may not use this file except in compliance with the License.
1467
- * You may obtain a copy of the License at
1468
- *
1469
- * http://www.apache.org/licenses/LICENSE-2.0
1470
- *
1471
- * Unless required by applicable law or agreed to in writing, software
1472
- * distributed under the License is distributed on an "AS IS" BASIS,
1473
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1474
- * See the License for the specific language governing permissions and
1475
- * limitations under the License.
1476
- *
1477
- * Copyright 2022 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
1478
- * Copyright 2022 - Finnish Meteorological Institute (FMI)
1479
- * Copyright 2024 - The Norwegian Meteorological Institute (MET Norway)
1431
+ /* *
1432
+ * Licensed under the Apache License, Version 2.0 (the "License");
1433
+ * you may not use this file except in compliance with the License.
1434
+ * You may obtain a copy of the License at
1435
+ *
1436
+ * http://www.apache.org/licenses/LICENSE-2.0
1437
+ *
1438
+ * Unless required by applicable law or agreed to in writing, software
1439
+ * distributed under the License is distributed on an "AS IS" BASIS,
1440
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1441
+ * See the License for the specific language governing permissions and
1442
+ * limitations under the License.
1443
+ *
1444
+ * Copyright 2022 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
1445
+ * Copyright 2022 - Finnish Meteorological Institute (FMI)
1446
+ * Copyright 2024 - The Norwegian Meteorological Institute (MET Norway)
1480
1447
  * */
1481
1448
  const snackbarModuleConfig = {
1482
1449
  id: 'snackbar-module',
@@ -1486,6 +1453,57 @@ const snackbarModuleConfig = {
1486
1453
  middlewares: [snackbarListener.middleware]
1487
1454
  };
1488
1455
 
1456
+ const getMessageString = (t, snackbarMessage) => {
1457
+ if (!snackbarMessage) {
1458
+ return '';
1459
+ }
1460
+ return snackbarMessage.type === SnackbarMessageType.TRANSLATABLE_MESSAGE ? t(snackbarMessage.key, snackbarMessage.params) : snackbarMessage.message;
1461
+ };
1462
+ const SnackbarWrapper = _a => {
1463
+ var {
1464
+ children,
1465
+ isOpen,
1466
+ onCloseSnackbar,
1467
+ id,
1468
+ snackbarMessage
1469
+ } = _a,
1470
+ props = __rest(_a, ["children", "isOpen", "onCloseSnackbar", "id", "snackbarMessage"]);
1471
+ const {
1472
+ t
1473
+ } = useSnackbarTranslation();
1474
+ const messageString = getMessageString(t, snackbarMessage);
1475
+ return jsxs(Fragment, {
1476
+ children: [children, jsx(Snackbar, Object.assign({
1477
+ message: messageString,
1478
+ "data-testid": "snackbarComponent",
1479
+ open: isOpen,
1480
+ onClose: onCloseSnackbar,
1481
+ autoHideDuration: null,
1482
+ ClickAwayListenerProps: {
1483
+ mouseEvent: false
1484
+ },
1485
+ action: jsx(CustomIconButton, Object.assign({
1486
+ "aria-label": t('snackbar-close'),
1487
+ "data-testid": "snackbarCloseButton",
1488
+ onClick: onCloseSnackbar,
1489
+ size: "large",
1490
+ sx: {
1491
+ '&.MuiButtonBase-root': {
1492
+ borderRadius: 20,
1493
+ color: 'geowebColors.snackbar.action',
1494
+ '&:hover': {
1495
+ color: 'geowebColors.snackbar.action',
1496
+ backgroundColor: 'geowebColors.snackbar.actionHover.rgba'
1497
+ }
1498
+ }
1499
+ }
1500
+ }, {
1501
+ children: jsx(Close, {})
1502
+ }))
1503
+ }, props), id)]
1504
+ });
1505
+ };
1506
+
1489
1507
  const SnackbarWrapperConnect = withEggs([snackbarModuleConfig])(props => {
1490
1508
  const dispatch = useDispatch();
1491
1509
  const onCloseSnackbar = () => {
@@ -1495,7 +1513,7 @@ const SnackbarWrapperConnect = withEggs([snackbarModuleConfig])(props => {
1495
1513
  return jsx(SnackbarWrapper, Object.assign({
1496
1514
  isOpen: !!currentSnackbarMessage,
1497
1515
  onCloseSnackbar: onCloseSnackbar,
1498
- message: currentSnackbarMessage ? currentSnackbarMessage.message : '',
1516
+ snackbarMessage: currentSnackbarMessage === null || currentSnackbarMessage === void 0 ? void 0 : currentSnackbarMessage.message,
1499
1517
  id: currentSnackbarMessage ? currentSnackbarMessage.id : ''
1500
1518
  }, props));
1501
1519
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opengeoweb/snackbar",
3
- "version": "9.28.1",
3
+ "version": "9.29.1",
4
4
  "description": "GeoWeb snackbar library for the opengeoweb project",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
package/src/index.d.ts CHANGED
@@ -1 +1 @@
1
- export * from './lib';
1
+ export * from './lib';
@@ -1,12 +1,12 @@
1
- import * as React from 'react';
2
- import { Store } from '@reduxjs/toolkit';
3
- interface SnackbarTranslationsWrapperProps {
4
- children?: React.ReactNode;
5
- }
6
- export declare const DemoWrapper: React.FC<SnackbarTranslationsWrapperProps>;
7
- interface ProviderProps {
8
- children?: React.ReactNode;
9
- store: Store;
10
- }
11
- export declare const DemoWrapperConnect: React.FC<ProviderProps>;
12
- export {};
1
+ import * as React from 'react';
2
+ import { Store } from '@reduxjs/toolkit';
3
+ interface SnackbarTranslationsWrapperProps {
4
+ children?: React.ReactNode;
5
+ }
6
+ export declare const DemoWrapper: React.FC<SnackbarTranslationsWrapperProps>;
7
+ interface ProviderProps {
8
+ children?: React.ReactNode;
9
+ store: Store;
10
+ }
11
+ export declare const DemoWrapperConnect: React.FC<ProviderProps>;
12
+ export {};
@@ -1,9 +1,11 @@
1
- import * as React from 'react';
2
- import { SnackbarProps } from '@mui/material';
3
- interface SnackBarWrapperProps extends SnackbarProps {
4
- isOpen: boolean;
5
- id: string;
6
- onCloseSnackbar: () => void;
7
- }
8
- export declare const SnackbarWrapper: React.FC<SnackBarWrapperProps>;
9
- export {};
1
+ import * as React from 'react';
2
+ import { SnackbarProps } from '@mui/material';
3
+ import { snackbarTypes } from '../../store';
4
+ interface SnackBarWrapperProps extends SnackbarProps {
5
+ isOpen: boolean;
6
+ id: string;
7
+ snackbarMessage?: snackbarTypes.SnackbarMessage;
8
+ onCloseSnackbar: () => void;
9
+ }
10
+ export declare const SnackbarWrapper: React.FC<SnackBarWrapperProps>;
11
+ export {};
@@ -1 +1 @@
1
- export {};
1
+ export {};
@@ -1,7 +1,7 @@
1
- import * as React from 'react';
2
- export declare const SnackbarDemo: () => React.ReactElement;
3
- export declare const TwoSnackbarsDemo: () => React.ReactElement;
4
- declare const _default: {
5
- title: string;
6
- };
7
- export default _default;
1
+ import * as React from 'react';
2
+ export declare const SnackbarDemo: () => React.ReactElement;
3
+ export declare const TwoSnackbarsDemo: () => React.ReactElement;
4
+ declare const _default: {
5
+ title: string;
6
+ };
7
+ export default _default;
@@ -1,3 +1,3 @@
1
- import * as React from 'react';
2
- import { SnackbarProps } from '@mui/material';
3
- export declare const SnackbarWrapperConnect: React.FC<SnackbarProps>;
1
+ import * as React from 'react';
2
+ import { SnackbarProps } from '@mui/material';
3
+ export declare const SnackbarWrapperConnect: React.FC<SnackbarProps>;
@@ -1 +1 @@
1
- export {};
1
+ export {};
@@ -1 +1 @@
1
- export { SnackbarWrapperConnect } from './SnackbarWrapperConnect';
1
+ export { SnackbarWrapperConnect } from './SnackbarWrapperConnect';
@@ -1,5 +1,5 @@
1
- import snackbarTranslations from './locales/snackbar.json';
2
- export * from './components/Snackbar';
3
- export * from './store';
4
- export { SNACKBAR_NAMESPACE } from './utils/i18n';
5
- export { snackbarTranslations };
1
+ import snackbarTranslations from './locales/snackbar.json';
2
+ export * from './components/Snackbar';
3
+ export * from './store';
4
+ export { SNACKBAR_NAMESPACE } from './utils/i18n';
5
+ export { snackbarTranslations };
@@ -1,4 +1,4 @@
1
- import { Egg } from '@redux-eggs/core';
2
- import { Store } from '@reduxjs/toolkit';
3
- import { SnackbarModuleStore } from './types';
4
- export declare const snackbarModuleConfig: Egg<Store<SnackbarModuleStore>>;
1
+ import { Egg } from '@redux-eggs/core';
2
+ import { Store } from '@reduxjs/toolkit';
3
+ import { SnackbarModuleStore } from './types';
4
+ export declare const snackbarModuleConfig: Egg<Store<SnackbarModuleStore>>;
@@ -1,6 +1,6 @@
1
- export { snackbarActions } from './reducer';
2
- export * as snackbarSelectors from './selectors';
3
- export * as snackbarTypes from './types';
4
- export * from './config';
5
- export { reducer as snackbarReducer } from './reducer';
6
- export * from './listener';
1
+ export { snackbarActions } from './reducer';
2
+ export * as snackbarSelectors from './selectors';
3
+ export * as snackbarTypes from './types';
4
+ export * from './config';
5
+ export { reducer as snackbarReducer } from './reducer';
6
+ export * from './listener';
@@ -1,3 +1,3 @@
1
- import { SnackbarModuleStore } from './types';
2
- export declare const hideTime = 4000;
3
- export declare const snackbarListener: import("@reduxjs/toolkit").ListenerMiddlewareInstance<SnackbarModuleStore, import("@reduxjs/toolkit").ThunkDispatch<SnackbarModuleStore, unknown, import("redux").AnyAction>, unknown>;
1
+ import { SnackbarModuleStore } from './types';
2
+ export declare const hideTime = 4000;
3
+ export declare const snackbarListener: import("@reduxjs/toolkit").ListenerMiddlewareInstance<SnackbarModuleStore, import("@reduxjs/toolkit").ThunkDispatch<SnackbarModuleStore, unknown, import("redux").AnyAction>, unknown>;
@@ -1 +1 @@
1
- export {};
1
+ export {};
@@ -1,11 +1,11 @@
1
- import { PayloadAction, Draft } from '@reduxjs/toolkit';
2
- import { OpenSnackbarPayload, SnackbarItem, SnackbarState, TriggerOpenSnackbarByListenerPayload } from './types';
3
- export declare const snackbarAdapter: import("@reduxjs/toolkit").EntityAdapter<SnackbarItem>;
4
- export declare const initialState: SnackbarState;
5
- export declare const reducer: import("redux").Reducer<SnackbarState, import("redux").AnyAction>;
6
- export declare const snackbarActions: import("@reduxjs/toolkit").CaseReducerActions<{
7
- openSnackbar: (draft: Draft<SnackbarState>, action: PayloadAction<OpenSnackbarPayload>) => void;
8
- triggerOpenSnackbarByListener: (draft: Draft<SnackbarState>, action: PayloadAction<TriggerOpenSnackbarByListenerPayload>) => void;
9
- closeSnackbar: (draft: Draft<SnackbarState>) => void;
10
- }, "snackbar">;
11
- export type SnackbarActions = ReturnType<typeof snackbarActions.openSnackbar> | ReturnType<typeof snackbarActions.triggerOpenSnackbarByListener> | ReturnType<typeof snackbarActions.closeSnackbar>;
1
+ import { PayloadAction, Draft } from '@reduxjs/toolkit';
2
+ import { OpenSnackbarPayload, SnackbarItem, SnackbarState, TriggerOpenSnackbarByListenerPayload } from './types';
3
+ export declare const snackbarAdapter: import("@reduxjs/toolkit").EntityAdapter<SnackbarItem>;
4
+ export declare const initialState: SnackbarState;
5
+ export declare const reducer: import("redux").Reducer<SnackbarState>;
6
+ export declare const snackbarActions: import("@reduxjs/toolkit").CaseReducerActions<{
7
+ openSnackbar: (draft: Draft<SnackbarState>, action: PayloadAction<OpenSnackbarPayload>) => void;
8
+ triggerOpenSnackbarByListener: (draft: Draft<SnackbarState>, action: PayloadAction<TriggerOpenSnackbarByListenerPayload>) => void;
9
+ closeSnackbar: (draft: Draft<SnackbarState>) => void;
10
+ }, "snackbar">;
11
+ export type SnackbarActions = ReturnType<typeof snackbarActions.openSnackbar> | ReturnType<typeof snackbarActions.triggerOpenSnackbarByListener> | ReturnType<typeof snackbarActions.closeSnackbar>;
@@ -1 +1 @@
1
- export {};
1
+ export {};
@@ -1,8 +1,8 @@
1
- import { SnackbarModuleStore, SnackbarState } from './types';
2
- export declare const getSnackbarStore: (store: SnackbarModuleStore) => SnackbarState;
3
- export declare const getCurrentSnackbarMessages: (state: SnackbarModuleStore) => import("./types").SnackbarItem[];
4
- export declare const getFirstSnackbarMessage: ((state: SnackbarModuleStore) => import("./types").SnackbarItem | undefined) & import("reselect").OutputSelectorFields<(args_0: import("./types").SnackbarItem[]) => import("./types").SnackbarItem | undefined, {
5
- clearCache: () => void;
6
- }> & {
7
- clearCache: () => void;
8
- };
1
+ import { SnackbarModuleStore, SnackbarState } from './types';
2
+ export declare const getSnackbarStore: (store: SnackbarModuleStore) => SnackbarState;
3
+ export declare const getCurrentSnackbarMessages: (state: SnackbarModuleStore) => import("./types").SnackbarItem[];
4
+ export declare const getFirstSnackbarMessage: ((state: SnackbarModuleStore) => import("./types").SnackbarItem | undefined) & import("reselect").OutputSelectorFields<(args_0: import("./types").SnackbarItem[]) => import("./types").SnackbarItem | undefined, {
5
+ clearCache: () => void;
6
+ }> & {
7
+ clearCache: () => void;
8
+ };
@@ -1 +1 @@
1
- export {};
1
+ export {};
@@ -1,15 +1,27 @@
1
- import { EntityState } from '@reduxjs/toolkit';
2
- export interface SnackbarItem {
3
- message: string;
4
- id: string;
5
- }
6
- export type SnackbarState = EntityState<SnackbarItem>;
7
- export interface SnackbarModuleStore {
8
- snackbar?: SnackbarState;
9
- }
10
- export interface OpenSnackbarPayload {
11
- message: string;
12
- }
13
- export interface TriggerOpenSnackbarByListenerPayload {
14
- snackbarContent: SnackbarItem;
15
- }
1
+ import { EntityState } from '@reduxjs/toolkit';
2
+ export interface SnackbarItem {
3
+ message: SnackbarMessage;
4
+ id: string;
5
+ }
6
+ export type SnackbarState = EntityState<SnackbarItem>;
7
+ export interface SnackbarModuleStore {
8
+ snackbar?: SnackbarState;
9
+ }
10
+ export declare enum SnackbarMessageType {
11
+ TRANSLATABLE_MESSAGE = "TRANSLATABLE_MESSAGE",
12
+ VERBATIM_MESSAGE = "VERBATIM_MESSAGE"
13
+ }
14
+ export interface TranslatableMessage {
15
+ type: SnackbarMessageType.TRANSLATABLE_MESSAGE;
16
+ key: string;
17
+ params?: Record<string, string | number> | undefined;
18
+ }
19
+ export interface VerbatimMessage {
20
+ type: SnackbarMessageType.VERBATIM_MESSAGE;
21
+ message: string;
22
+ }
23
+ export type SnackbarMessage = TranslatableMessage | VerbatimMessage;
24
+ export type OpenSnackbarPayload = SnackbarMessage;
25
+ export interface TriggerOpenSnackbarByListenerPayload {
26
+ snackbarContent: SnackbarItem;
27
+ }
@@ -1,5 +1,5 @@
1
- import i18n from 'i18next';
2
- import { UseTranslationResponse } from 'react-i18next';
3
- export declare const SNACKBAR_NAMESPACE = "snackbar";
4
- export declare const initSnackbarI18n: () => void;
5
- export declare const useSnackbarTranslation: () => UseTranslationResponse<typeof SNACKBAR_NAMESPACE, typeof i18n>;
1
+ import i18n from 'i18next';
2
+ import { UseTranslationResponse } from 'react-i18next';
3
+ export declare const SNACKBAR_NAMESPACE = "snackbar";
4
+ export declare const initSnackbarI18n: () => void;
5
+ export declare const useSnackbarTranslation: () => UseTranslationResponse<typeof SNACKBAR_NAMESPACE, typeof i18n>;