@pagopa/selfcare-common-frontend 1.5.16 → 1.5.19
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/CHANGELOG.md +19 -0
- package/README.md +12 -1
- package/build.info +2 -2
- package/components/Toast.d.ts +7 -1
- package/components/Toast.js +5 -5
- package/components/Toast.js.map +1 -1
- package/components/ToastWrapper.d.ts +11 -0
- package/components/ToastWrapper.js +16 -0
- package/components/ToastWrapper.js.map +1 -0
- package/components/UserNotifyHandle.js +17 -13
- package/components/UserNotifyHandle.js.map +1 -1
- package/model/UserNotify.d.ts +1 -1
- package/package.json +1 -1
- package/redux/slices/appStateSlice.js +5 -2
- package/redux/slices/appStateSlice.js.map +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -4,8 +4,27 @@ All notable changes to this project will be documented in this file. Dates are d
|
|
|
4
4
|
|
|
5
5
|
Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
|
6
6
|
|
|
7
|
+
#### [v1.5.19](https://github.com/pagopa/selfcare-common-frontend/compare/v1.5.18...v1.5.19)
|
|
8
|
+
|
|
9
|
+
- Fixed toast notify default timeout [`#49`](https://github.com/pagopa/selfcare-common-frontend/pull/49)
|
|
10
|
+
- Bump urijs from 1.19.8 to 1.19.10 [`#48`](https://github.com/pagopa/selfcare-common-frontend/pull/48)
|
|
11
|
+
|
|
12
|
+
#### [v1.5.18](https://github.com/pagopa/selfcare-common-frontend/compare/v1.5.17...v1.5.18)
|
|
13
|
+
|
|
14
|
+
> 2 March 2022
|
|
15
|
+
|
|
16
|
+
- Fix ToastWrapper render [`#46`](https://github.com/pagopa/selfcare-common-frontend/pull/46)
|
|
17
|
+
|
|
18
|
+
#### [v1.5.17](https://github.com/pagopa/selfcare-common-frontend/compare/v1.5.16...v1.5.17)
|
|
19
|
+
|
|
20
|
+
> 1 March 2022
|
|
21
|
+
|
|
22
|
+
- UserNotifyHandle will draw a stack of Toast [`#45`](https://github.com/pagopa/selfcare-common-frontend/pull/45)
|
|
23
|
+
|
|
7
24
|
#### [v1.5.16](https://github.com/pagopa/selfcare-common-frontend/compare/v1.5.15...v1.5.16)
|
|
8
25
|
|
|
26
|
+
> 28 February 2022
|
|
27
|
+
|
|
9
28
|
- SessionModal confirm button can be disabled [`#44`](https://github.com/pagopa/selfcare-common-frontend/pull/44)
|
|
10
29
|
|
|
11
30
|
#### [v1.5.15](https://github.com/pagopa/selfcare-common-frontend/compare/v1.5.14...v1.5.15)
|
package/README.md
CHANGED
|
@@ -114,6 +114,17 @@ Selfcare's toast
|
|
|
114
114
|
| message | React.ReactNode | Y | The toast body |
|
|
115
115
|
| onCloseToast | ()=>void | Y | The function to be invoked when closing the toast |
|
|
116
116
|
| width | string | N | The toast width |
|
|
117
|
+
| wrapped | boolean | N | If true, it will not position itself as fixed. Default false |
|
|
118
|
+
| bottom | string | N | If not wrapped, the pixel from the bottom of the viewport where to place the toast. Default "64px" |
|
|
119
|
+
| rigth | string | N | If not wrapped, the pixel from the right side of the viewport where to place the toast. Default "64px" |
|
|
120
|
+
|
|
121
|
+
## ToastWrapper
|
|
122
|
+
To stack multiple Toast component. Each Toast should have the prop wrapped setted to true
|
|
123
|
+
|
|
124
|
+
| Prop | Type | Mandatory | Description |
|
|
125
|
+
|------|------|-----------|-------------|
|
|
126
|
+
| bottom | string | N | The pixel from the bottom of the viewport where to place the toast. Default "64px" |
|
|
127
|
+
| rigth | string | N | The pixel from the right side of the viewport where to place the toast. Default "64px" |
|
|
117
128
|
|
|
118
129
|
## Ending Page
|
|
119
130
|
Selfcare's ending page
|
|
@@ -302,7 +313,7 @@ The user notify to be submitted has type UserNotify which has the following fiel
|
|
|
302
313
|
| closeLabel | string | N | If component === 'SessionModal'. The close button label |
|
|
303
314
|
| component | string | N | Can render a SessionModal or Toast component |
|
|
304
315
|
| autoclosable | string | N | If component === 'Toast'. The notify will be autoclosed using this configuration, as default timer. If none, it will not be closed automatically. If timer, it will be closed after autocloseMilliseconds milliseconds |
|
|
305
|
-
| autocloseMilliseconds | boolean | N | If component === 'Toast' and autoclosable === 'timer'. The millisecond after which close the notify. As default
|
|
316
|
+
| autocloseMilliseconds | boolean | N | If component === 'Toast' and autoclosable === 'timer'. The millisecond after which close the notify. As default 10000 |
|
|
306
317
|
| width | string | N | The SessionModal or Toast width |
|
|
307
318
|
|
|
308
319
|
## UnloadEventHandler
|
package/build.info
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
20220310.1 - selfcare-common-frontend.deploy(23330)
|
|
2
|
+
remotes/origin/SELC-222 58d81624542acd349d93c3f65e9b23967db04c7c
|
package/components/Toast.d.ts
CHANGED
|
@@ -14,7 +14,13 @@ declare type Props = {
|
|
|
14
14
|
onCloseToast: () => void;
|
|
15
15
|
/** The toast width */
|
|
16
16
|
width?: string | undefined;
|
|
17
|
+
/** If true, it will not position itself as fixed */
|
|
18
|
+
wrapped?: boolean;
|
|
19
|
+
/** If not wrapped, the pixel from the bottom of the viewport where to place the toast. Default "64px" */
|
|
20
|
+
bottom?: string;
|
|
21
|
+
/** If not wrapped, the pixel from the right side of the viewport where to place the toast. Default "64px" */
|
|
22
|
+
right?: string;
|
|
17
23
|
};
|
|
18
24
|
/** Selfcare's toast */
|
|
19
|
-
export default function Toast({ open, title, message, onCloseToast, logo, leftBorderColor, width, }: Props): JSX.Element;
|
|
25
|
+
export default function Toast({ open, title, message, onCloseToast, logo, leftBorderColor, width, wrapped, bottom, right, }: Props): JSX.Element;
|
|
20
26
|
export {};
|
package/components/Toast.js
CHANGED
|
@@ -11,12 +11,12 @@ const CustomAlert = (0, system_1.styled)(material_1.Alert)({
|
|
|
11
11
|
'.MuiAlert-icon': { display: 'none' },
|
|
12
12
|
});
|
|
13
13
|
/** Selfcare's toast */
|
|
14
|
-
function Toast({ open, title, message, onCloseToast, logo = ConfirmIcon_1.default, leftBorderColor = '#00CF86', width = '376px', }) {
|
|
14
|
+
function Toast({ open, title, message, onCloseToast, logo = ConfirmIcon_1.default, leftBorderColor = '#00CF86', width = '376px', wrapped = false, bottom = '64px', right = '64px', }) {
|
|
15
|
+
const positionStyle = !wrapped
|
|
16
|
+
? { position: 'fixed', bottom, right, zIndex: 100 }
|
|
17
|
+
: { marginTop: 2 };
|
|
15
18
|
return ((0, jsx_runtime_1.jsx)(react_1.Fragment, { children: open && ((0, jsx_runtime_1.jsx)(CustomAlert, Object.assign({ className: "userToast", variant: "outlined", sx: {
|
|
16
|
-
|
|
17
|
-
bottom: '64px',
|
|
18
|
-
right: '64px',
|
|
19
|
-
zIndex: 100,
|
|
19
|
+
...positionStyle,
|
|
20
20
|
width: { width },
|
|
21
21
|
backgroundColor: 'white',
|
|
22
22
|
borderLeft: `4px solid ${leftBorderColor} !important`,
|
package/components/Toast.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Toast.js","sourceRoot":"","sources":["../../src/lib/components/Toast.tsx"],"names":[],"mappings":";;;;AAAA,
|
|
1
|
+
{"version":3,"file":"Toast.js","sourceRoot":"","sources":["../../src/lib/components/Toast.tsx"],"names":[],"mappings":";;;;AAAA,iCAAuD;AACvD,4CAA6E;AAC7E,wCAAqC;AACrC,mFAAkD;AAClD,mFAA8C;AAyB9C,MAAM,WAAW,GAAG,IAAA,eAAM,EAAC,gBAAK,CAAC,CAAC;IAChC,gBAAgB,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE;CACtC,CAAC,CAAC;AAEH,uBAAuB;AACvB,SAAwB,KAAK,CAAC,EAC5B,IAAI,EACJ,KAAK,EACL,OAAO,EACP,YAAY,EACZ,IAAI,GAAG,qBAAW,EAClB,eAAe,GAAG,SAAS,EAC3B,KAAK,GAAG,OAAO,EACf,OAAO,GAAG,KAAK,EACf,MAAM,GAAG,MAAM,EACf,KAAK,GAAG,MAAM,GACR;IACN,MAAM,aAAa,GAAkB,CAAC,OAAO;QAC3C,CAAC,CAAC,EAAE,QAAQ,EAAE,OAAO,EAAE,MA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props = {
|
|
3
|
+
children: Array<ReactNode>;
|
|
4
|
+
/** The pixel from the bottom of the viewport where to place the toast. Default "64px" */
|
|
5
|
+
bottom?: string;
|
|
6
|
+
/** The pixel from the right side of the viewport where to place the toast. Default "64px" */
|
|
7
|
+
right?: string;
|
|
8
|
+
};
|
|
9
|
+
/** To stack multiple Toast component. Each Toast should have the prop wrapped setted to true */
|
|
10
|
+
export default function ToastWrapper({ children, bottom, right }: Props): JSX.Element;
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
4
|
+
const react_1 = require("react");
|
|
5
|
+
const material_1 = require("@mui/material");
|
|
6
|
+
/** To stack multiple Toast component. Each Toast should have the prop wrapped setted to true */
|
|
7
|
+
function ToastWrapper({ children, bottom = '64px', right = '64px' }) {
|
|
8
|
+
return ((0, jsx_runtime_1.jsx)(react_1.Fragment, { children: (0, jsx_runtime_1.jsx)(material_1.Box, Object.assign({ sx: {
|
|
9
|
+
position: 'fixed',
|
|
10
|
+
bottom: { bottom },
|
|
11
|
+
right: { right },
|
|
12
|
+
zIndex: 100,
|
|
13
|
+
} }, { children: children.slice().reverse() }), void 0) }, void 0));
|
|
14
|
+
}
|
|
15
|
+
exports.default = ToastWrapper;
|
|
16
|
+
//# sourceMappingURL=ToastWrapper.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ToastWrapper.js","sourceRoot":"","sources":["../../src/lib/components/ToastWrapper.tsx"],"names":[],"mappings":";;;AAAA,iCAA4C;AAC5C,4CAAoC;AAUpC,gGAAgG;AAChG,SAAwB,YAAY,CAAC,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,EAAE,KAAK,GAAG,MAAM,EAAS;IACvF,OAAO,CACL,uBAAC,gBAAQ,cACP,uBAAC,cAAG,kBACF,EAAE,EAAE;gBACF,QAAQ,EAAE,OAAO;gBACjB,MAAM,EAAE,EAAE,MAAM,EAAE;gBAClB,KAAK,EAAE,EAAE,KAAK,EAAE;gBAChB,MAAM,EAAE,GAAG;aACZ,gBAEA,QAAQ,CAAC,KAAK,EAAE,CAAC,OAAO,EAAE,YACvB,WACG,CACZ,CAAC;AACJ,CAAC;AAfD,+BAeC"}
|
|
@@ -1,20 +1,22 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
3
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
4
5
|
const react_1 = require("react");
|
|
5
6
|
const react_redux_1 = require("react-redux");
|
|
6
7
|
const __1 = require("..");
|
|
7
8
|
const appStateSlice_1 = require("../redux/slices/appStateSlice");
|
|
9
|
+
const ToastWrapper_1 = (0, tslib_1.__importDefault)(require("./ToastWrapper"));
|
|
8
10
|
/** This feature is based on react-redux library and require to register the reducer build in appStateSlice into the application's redux store.
|
|
9
11
|
It allows to dispatch User Notifies in order to display a pop up or a toast notification.
|
|
10
12
|
|
|
11
13
|
To use this feature you have to put UserNotifyHandle in your App as a child of a redux Provider component.
|
|
12
14
|
In order to dispatch a User Notify, you have to use the custom hook useUserNotify which will return a fuction to be used to dispatch the User Notify. */
|
|
13
15
|
function UserNotifyHandle() {
|
|
14
|
-
var _a
|
|
16
|
+
var _a;
|
|
15
17
|
const dispatch = (0, react_redux_1.useDispatch)();
|
|
16
18
|
const notifies = (0, react_redux_1.useSelector)(appStateSlice_1.appStateSelectors.selectNotifies);
|
|
17
|
-
const
|
|
19
|
+
const lastNotifiesToast = (0, react_1.useRef)([]);
|
|
18
20
|
const lastNotifyModal = (0, react_1.useRef)();
|
|
19
21
|
const onClose = (notify) => {
|
|
20
22
|
dispatch(appStateSlice_1.appStateActions.removeNotify(notify));
|
|
@@ -28,27 +30,29 @@ function UserNotifyHandle() {
|
|
|
28
30
|
notify.onConfirm();
|
|
29
31
|
}
|
|
30
32
|
};
|
|
31
|
-
const { openModal, openToast } = updateCurrents(lastNotifyModal,
|
|
33
|
+
const { openModal, openToast } = updateCurrents(lastNotifyModal, lastNotifiesToast, notifies, onClose);
|
|
32
34
|
const notifyModal = lastNotifyModal.current;
|
|
33
|
-
const
|
|
34
|
-
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(
|
|
35
|
+
const notifiesToast = lastNotifiesToast.current;
|
|
36
|
+
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(ToastWrapper_1.default, { children: notifiesToast.map((n) => ((0, jsx_runtime_1.jsx)(__1.Toast, { wrapped: true, open: openToast, title: n.title, message: n.message, logo: n.logo, leftBorderColor: n.leftBorderColor, onCloseToast: () => onClose(n), width: n.width }, n.id))) }, void 0), (0, jsx_runtime_1.jsx)(__1.SessionModal, { open: openModal, title: (_a = notifyModal === null || notifyModal === void 0 ? void 0 : notifyModal.title) !== null && _a !== void 0 ? _a : 'Notify Title', message: notifyModal === null || notifyModal === void 0 ? void 0 : notifyModal.message, onConfirm: (notifyModal === null || notifyModal === void 0 ? void 0 : notifyModal.onConfirm) ? () => onConfirm(notifyModal) : undefined, onConfirmLabel: notifyModal === null || notifyModal === void 0 ? void 0 : notifyModal.confirmLabel, handleClose: () => onClose(notifyModal), onCloseLabel: notifyModal === null || notifyModal === void 0 ? void 0 : notifyModal.closeLabel, width: notifyModal === null || notifyModal === void 0 ? void 0 : notifyModal.width }, void 0)] }, void 0));
|
|
35
37
|
}
|
|
36
38
|
exports.default = UserNotifyHandle;
|
|
37
|
-
function updateCurrents(lastNotifyModalRef,
|
|
38
|
-
const
|
|
39
|
+
function updateCurrents(lastNotifyModalRef, lastNotifiesToastRef, notifies, onClose) {
|
|
40
|
+
const lastNotifiesToast = notifies.filter((e) => e.component === 'Toast');
|
|
39
41
|
const lastNotifySessionModal = notifies.find((e) => e.component === 'SessionModal');
|
|
40
|
-
const openToast =
|
|
42
|
+
const openToast = lastNotifiesToast.length > 0;
|
|
41
43
|
const openModal = !!lastNotifySessionModal;
|
|
42
44
|
if (lastNotifySessionModal && lastNotifySessionModal !== (lastNotifyModalRef === null || lastNotifyModalRef === void 0 ? void 0 : lastNotifyModalRef.current)) {
|
|
43
45
|
// eslint-disable-next-line functional/immutable-data
|
|
44
46
|
lastNotifyModalRef.current = lastNotifySessionModal;
|
|
45
47
|
}
|
|
46
|
-
if (
|
|
48
|
+
if (openToast) {
|
|
47
49
|
// eslint-disable-next-line functional/immutable-data
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
50
|
+
lastNotifiesToastRef.current = lastNotifiesToast;
|
|
51
|
+
lastNotifiesToast.forEach((n) => {
|
|
52
|
+
if (n.autoclosable === 'timer') {
|
|
53
|
+
setTimeout(() => onClose(n), n.autocloseMilliseconds);
|
|
54
|
+
}
|
|
55
|
+
});
|
|
52
56
|
}
|
|
53
57
|
return {
|
|
54
58
|
openToast,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UserNotifyHandle.js","sourceRoot":"","sources":["../../src/lib/components/UserNotifyHandle.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"UserNotifyHandle.js","sourceRoot":"","sources":["../../src/lib/components/UserNotifyHandle.tsx"],"names":[],"mappings":";;;;AAAA,iCAAiD;AACjD,6CAAuD;AACvD,0BAAyC;AAEzC,iEAAmF;AACnF,+EAA0C;AAE1C;;;;wJAIwJ;AACxJ,SAAS,gBAAgB;;IACvB,MAAM,QAAQ,GAAG,IAAA,yBAAW,GAAE,CAAC;IAC/B,MAAM,QAAQ,GAAG,IAAA,yBAAW,EAAC,iCAAiB,CAAC,cAAc,CAAC,CAAC;IAC/D,MAAM,iBAAiB,GAAG,IAAA,cAAM,EAAoB,EAAE,CAAC,CAAC;IACxD,MAAM,eAAe,GAAG,IAAA,cAAM,GAAc,CAAC;IA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GAAG,iBAAiB,CAAC;QAEjD,iBAAiB,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE;YAC9B,IAAI,CAAC,CAAC,YAAY,KAAK,OAAO,EAAE;gBAC9B,UAAU,CAAC,GAAG,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,qBAAqB,CAAC,CAAC;aACvD;QACH,CAAC,CAAC,CAAC;KACJ;IACD,OAAO;QACL,SAAS;QACT,SAAS;KACV,CAAC;AACJ,CAAC"}
|
package/model/UserNotify.d.ts
CHANGED
|
@@ -13,7 +13,7 @@ export declare type UserNotify = {
|
|
|
13
13
|
* If timer, it will be closed after autocloseMilliseconds milliseconds
|
|
14
14
|
*/
|
|
15
15
|
autoclosable?: 'none' | 'timer';
|
|
16
|
-
/** If component === 'Toast' and autoclosable === 'timer'. The millisecond after which close the notify. As default
|
|
16
|
+
/** If component === 'Toast' and autoclosable === 'timer'. The millisecond after which close the notify. As default 10000 */
|
|
17
17
|
autocloseMilliseconds?: number;
|
|
18
18
|
/** If component === 'Toast'. The color used for the left border */
|
|
19
19
|
leftBorderColor?: string;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pagopa/selfcare-common-frontend",
|
|
3
3
|
"description": "Shared React components for the pagopa selfcare project",
|
|
4
|
-
"version": "1.5.
|
|
4
|
+
"version": "1.5.19",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": "https://github.com/pagopa/selfcare-common-frontend",
|
|
7
7
|
"author": "https://www.pagopa.gov.it",
|
|
@@ -14,6 +14,7 @@ const initialState = {
|
|
|
14
14
|
open: false,
|
|
15
15
|
},
|
|
16
16
|
};
|
|
17
|
+
const defaultToastNotifyTimeoutMs = 10000;
|
|
17
18
|
const keepOnPage = (e) => {
|
|
18
19
|
const message = "Warning!\n\nNavigating away from this page will delete your text if you haven't already saved it.";
|
|
19
20
|
e.preventDefault();
|
|
@@ -39,6 +40,7 @@ exports.appStateSlice = (0, toolkit_1.createSlice)({
|
|
|
39
40
|
},
|
|
40
41
|
// ErrorBoundary actions
|
|
41
42
|
addError: (state, action) => {
|
|
43
|
+
action.payload.id = `${action.payload.id}_${Date.now()}`;
|
|
42
44
|
if (!action.payload.component) {
|
|
43
45
|
action.payload.component = 'SessionModal';
|
|
44
46
|
}
|
|
@@ -48,7 +50,7 @@ exports.appStateSlice = (0, toolkit_1.createSlice)({
|
|
|
48
50
|
}
|
|
49
51
|
if (action.payload.autoclosable === 'timer' &&
|
|
50
52
|
(!action.payload.autocloseMilliseconds || action.payload.autocloseMilliseconds < 0)) {
|
|
51
|
-
action.payload.autocloseMilliseconds =
|
|
53
|
+
action.payload.autocloseMilliseconds = defaultToastNotifyTimeoutMs;
|
|
52
54
|
}
|
|
53
55
|
}
|
|
54
56
|
state.errors.push(action.payload);
|
|
@@ -58,6 +60,7 @@ exports.appStateSlice = (0, toolkit_1.createSlice)({
|
|
|
58
60
|
},
|
|
59
61
|
// UserNotifyHandle actions
|
|
60
62
|
addNotify: (state, action) => {
|
|
63
|
+
action.payload.id = `${action.payload.id}_${Date.now()}`;
|
|
61
64
|
if (!action.payload.component) {
|
|
62
65
|
action.payload.component = 'SessionModal';
|
|
63
66
|
}
|
|
@@ -67,7 +70,7 @@ exports.appStateSlice = (0, toolkit_1.createSlice)({
|
|
|
67
70
|
}
|
|
68
71
|
if (action.payload.autoclosable === 'timer' &&
|
|
69
72
|
(!action.payload.autocloseMilliseconds || action.payload.autocloseMilliseconds < 0)) {
|
|
70
|
-
action.payload.autocloseMilliseconds =
|
|
73
|
+
action.payload.autocloseMilliseconds = defaultToastNotifyTimeoutMs;
|
|
71
74
|
}
|
|
72
75
|
}
|
|
73
76
|
state.userNotifies.push(action.payload);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"appStateSlice.js","sourceRoot":"","sources":["../../../src/lib/redux/slices/appStateSlice.ts"],"names":[],"mappings":";;;AAAA,8CAA8D;AA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