@pagopa/selfcare-common-frontend 1.0.0 → 1.2.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/CHANGELOG.md +22 -0
- package/README.md +97 -1
- package/build.info +2 -2
- package/components/EndingPage.d.ts +17 -0
- package/components/EndingPage.js +9 -0
- package/components/EndingPage.js.map +1 -0
- package/components/ErrorBoundary/ErrorBoundary.js +29 -8
- package/components/ErrorBoundary/ErrorBoundary.js.map +1 -1
- package/components/ErrorBoundary/components/BlockingErrorPage.js +3 -2
- package/components/ErrorBoundary/components/BlockingErrorPage.js.map +1 -1
- package/components/FilterModal.d.ts +1 -1
- package/components/Footer/Footer.d.ts +2 -1
- package/components/Footer/Footer.js +10 -5
- package/components/Footer/Footer.js.map +1 -1
- package/components/TitleBox.d.ts +6 -3
- package/components/TitleBox.js +2 -2
- package/components/TitleBox.js.map +1 -1
- package/components/UnloadEventHandler.d.ts +8 -0
- package/components/UnloadEventHandler.js +33 -0
- package/components/UnloadEventHandler.js.map +1 -0
- package/components/UserNotifyHandle.d.ts +7 -0
- package/components/UserNotifyHandle.js +55 -0
- package/components/UserNotifyHandle.js.map +1 -0
- package/components/icons/CheckIllustrationIcon.d.ts +4 -0
- package/components/icons/CheckIllustrationIcon.js +7 -0
- package/components/icons/CheckIllustrationIcon.js.map +1 -0
- package/components/icons/FaultIcon.d.ts +4 -0
- package/components/icons/FaultIcon.js +7 -0
- package/components/icons/FaultIcon.js.map +1 -0
- package/config/env.d.ts +1 -0
- package/config/env.js +1 -0
- package/config/env.js.map +1 -1
- package/hooks/useErrorDispatcher.d.ts +1 -1
- package/hooks/useErrorDispatcher.js +1 -1
- package/hooks/useErrorDispatcher.js.map +1 -1
- package/hooks/useLoading.d.ts +1 -1
- package/hooks/useLoading.js +1 -1
- package/hooks/useLoading.js.map +1 -1
- package/hooks/useLogin.js +9 -7
- package/hooks/useLogin.js.map +1 -1
- package/hooks/useUnloadEventInterceptor.d.ts +17 -0
- package/hooks/useUnloadEventInterceptor.js +60 -0
- package/hooks/useUnloadEventInterceptor.js.map +1 -0
- package/hooks/useUserNotify.d.ts +3 -0
- package/hooks/useUserNotify.js +11 -0
- package/hooks/useUserNotify.js.map +1 -0
- package/index.d.ts +1 -0
- package/index.js +3 -1
- package/index.js.map +1 -1
- package/model/UserNotify.d.ts +23 -0
- package/model/UserNotify.js +3 -0
- package/model/UserNotify.js.map +1 -0
- package/package.json +16 -6
- package/redux/slices/appStateSlice.d.ts +47 -2
- package/redux/slices/appStateSlice.js +43 -0
- package/redux/slices/appStateSlice.js.map +1 -1
- package/redux/slices/userSlice.d.ts +3 -1
- package/redux/slices/userSlice.js.map +1 -1
- package/services/assistanceService.d.ts +1 -0
- package/services/assistanceService.js +19 -0
- package/services/assistanceService.js.map +1 -0
- package/utils/api-utils.d.ts +16 -0
- package/utils/api-utils.js +63 -0
- package/utils/api-utils.js.map +1 -0
- package/utils/constants.d.ts +3 -0
- package/utils/constants.js +3 -0
- package/utils/constants.js.map +1 -1
- package/utils/fixSwagger20ArraySchemaDef.js +67 -0
- package/utils/routes-utils.d.ts +1 -0
- package/utils/routes-utils.js +1 -0
- package/utils/routes-utils.js.map +1 -1
- package/utils/storage-utils.d.ts +3 -0
- package/utils/storage-utils.js +3 -0
- package/utils/storage-utils.js.map +1 -1
package/config/env.d.ts
CHANGED
package/config/env.js
CHANGED
package/config/env.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"env.js","sourceRoot":"","sources":["../../src/lib/config/env.ts"],"names":[],"mappings":";;;;AAAA,0DAA+B;AAElB,QAAA,MAAM,GAAG;IACpB,MAAM,EAAE;QACN,KAAK,EAAE,aAAa;QACpB,MAAM,EAAE,cAAc;
|
|
1
|
+
{"version":3,"file":"env.js","sourceRoot":"","sources":["../../src/lib/config/env.ts"],"names":[],"mappings":";;;;AAAA,0DAA+B;AAElB,QAAA,MAAM,GAAG;IACpB,MAAM,EAAE;QACN,KAAK,EAAE,aAAa;QACpB,MAAM,EAAE,cAAc;QACtB,UAAU,EAAE,aAAa;KAC1B;IAED,KAAK,EAAE;QACL,SAAS,EAAE,GAAG,CAAC,GAAG,CAAC,qBAAqB,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,MAAM,EAAE;KACpE;CACF,CAAC"}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const react_redux_1 = require("react-redux");
|
|
4
4
|
const appStateSlice_1 = require("../redux/slices/appStateSlice");
|
|
5
|
-
/** @see ErrorBoundary */
|
|
5
|
+
/** @see {@link ErrorBoundary} */
|
|
6
6
|
function default_1() {
|
|
7
7
|
const dispatch = (0, react_redux_1.useDispatch)();
|
|
8
8
|
return (error) => dispatch(appStateSlice_1.appStateActions.addError(error));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useErrorDispatcher.js","sourceRoot":"","sources":["../../src/lib/hooks/useErrorDispatcher.ts"],"names":[],"mappings":";;AAAA,6CAA0C;AAC1C,iEAA0E;AAE1E,
|
|
1
|
+
{"version":3,"file":"useErrorDispatcher.js","sourceRoot":"","sources":["../../src/lib/hooks/useErrorDispatcher.ts"],"names":[],"mappings":";;AAAA,6CAA0C;AAC1C,iEAA0E;AAE1E,iCAAiC;AACjC;IACE,MAAM,QAAQ,GAAG,IAAA,yBAAW,GAAE,CAAC;IAC/B,OAAO,CAAC,KAAe,EAAE,EAAE,CAAC,QAAQ,CAAC,+BAAe,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC;AACxE,CAAC;AAHD,4BAGC"}
|
package/hooks/useLoading.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/** @see LoadingOverlay */
|
|
1
|
+
/** @see {@link LoadingOverlay} */
|
|
2
2
|
export default function (task: string): (loading: boolean) => void;
|
package/hooks/useLoading.js
CHANGED
|
@@ -4,7 +4,7 @@ const lodash_1 = require("lodash");
|
|
|
4
4
|
const react_1 = require("react");
|
|
5
5
|
const react_redux_1 = require("react-redux");
|
|
6
6
|
const appStateSlice_1 = require("../redux/slices/appStateSlice");
|
|
7
|
-
/** @see LoadingOverlay */
|
|
7
|
+
/** @see {@link LoadingOverlay} */
|
|
8
8
|
function default_1(task) {
|
|
9
9
|
const dispatch = (0, react_redux_1.useDispatch)();
|
|
10
10
|
const ref = (0, react_1.useRef)((0, lodash_1.uniqueId)());
|
package/hooks/useLoading.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useLoading.js","sourceRoot":"","sources":["../../src/lib/hooks/useLoading.ts"],"names":[],"mappings":";;AAAA,mCAAkC;AAClC,iCAA+B;AAC/B,6CAA0C;AAC1C,iEAAgE;AAEhE,
|
|
1
|
+
{"version":3,"file":"useLoading.js","sourceRoot":"","sources":["../../src/lib/hooks/useLoading.ts"],"names":[],"mappings":";;AAAA,mCAAkC;AAClC,iCAA+B;AAC/B,6CAA0C;AAC1C,iEAAgE;AAEhE,kCAAkC;AAClC,mBAAyB,IAAY;IACnC,MAAM,QAAQ,GAAG,IAAA,yBAAW,GAAE,CAAC;IAC/B,MAAM,GAAG,GAAG,IAAA,cAAM,EAAC,IAAA,iBAAQ,GAAE,CAAC,CAAC;IAC/B,OAAO,CAAC,OAAgB,EAAE,EAAE,CAC1B,QAAQ,CAAC,+BAAe,CAAC,UAAU,CAAC,EAAE,IAAI,EAAE,GAAG,IAAI,IAAI,GAAG,CAAC,OAAO,GAAG,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC;AACvF,CAAC;AALD,4BAKC"}
|
package/hooks/useLogin.js
CHANGED
|
@@ -9,19 +9,21 @@ const env_1 = require("../config/env");
|
|
|
9
9
|
const constants_1 = require("../utils/constants");
|
|
10
10
|
const userSlice_1 = require("../redux/slices/userSlice");
|
|
11
11
|
const testToken = 'eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCIsImtpZCI6Imp3dF9kZjplNjoxOTplYToxZTpjZTplNjo3Yjo3MDo0MjoyYzphMjpjZDo4Yjo1MjowYiJ9.eyJlbWFpbCI6ImZ1cmlvdml0YWxlQG1hcnRpbm8uaXQiLCJmYW1pbHlfbmFtZSI6IlNhcnRvcmkiLCJmaXNjYWxfbnVtYmVyIjoiU1JUTkxNMDlUMDZHNjM1UyIsIm5hbWUiOiJBbnNlbG1vIiwiZnJvbV9hYSI6ZmFsc2UsInVpZCI6IjliMTdjZTcwLWY3OWYtNDJkOS04YjBlLTRlN2ViNGQ4ODA3NCIsImxldmVsIjoiTDIiLCJpYXQiOjE2Mzk1OTI2NTMsImlzcyI6IlNQSUQiLCJqdGkiOiIwMUZQWk5DV1c0RFhIQ0JZNFlHVFBKTkM2UiJ9.Cz6bZ1degD0APpJS3rfLPdjpjBE9JBGByVoLcFtqGhDxRAOhP_5aKqE0-1S9u9QUCakmhLA8i1auV7ImP8CLMaJTyUGUwz85yYL9KgqcRZ9qsYghFDqBQsh-n5_4Ldsu1-vBp2klwpJA87ppdzEyLZnSp6kUhpytFf00XtmSOYvt6-OMI6K6bBVFGXk_IYGs4KHx3-fij1DGg-_8BhghtkvJVyC2p9R4XezT8oXg55H-sBigTPdk9LssDa75Pj91zwPrbwTOBp9Tgk0HqOgieEDDpIuVplJI2uaq9YpDNyZkR8RnkSV072gPWlrJXDEb1-zXty7nT8NcGdRGTHDkkQ';
|
|
12
|
+
const mockedUser = {
|
|
13
|
+
uid: '0',
|
|
14
|
+
taxCode: 'AAAAAA00A00A000A',
|
|
15
|
+
name: 'loggedName',
|
|
16
|
+
surname: 'loggedSurname',
|
|
17
|
+
email: 'loggedEmail@aa.aa',
|
|
18
|
+
};
|
|
12
19
|
const useLogin = () => {
|
|
13
20
|
const dispatch = (0, react_redux_1.useDispatch)();
|
|
14
21
|
const setUser = (user) => dispatch(userSlice_1.userActions.setLoggedUser(user));
|
|
15
22
|
const attemptSilentLogin = async () => {
|
|
16
23
|
if (env_1.CONFIG.MOCKS.MOCK_USER) {
|
|
17
|
-
setUser(
|
|
18
|
-
uid: '0',
|
|
19
|
-
taxCode: 'AAAAAA00A00A000A',
|
|
20
|
-
name: 'loggedName',
|
|
21
|
-
surname: 'loggedSurname',
|
|
22
|
-
email: 'loggedEmail@aa.aa',
|
|
23
|
-
});
|
|
24
|
+
setUser(mockedUser);
|
|
24
25
|
(0, storage_utils_1.storageWrite)(constants_1.STORAGE_KEY_TOKEN, testToken, 'string');
|
|
26
|
+
(0, storage_utils_1.storageWrite)(constants_1.STORAGE_KEY_USER, mockedUser, 'object');
|
|
25
27
|
return;
|
|
26
28
|
}
|
|
27
29
|
const sessionStorageUser = (0, storage_utils_1.storageRead)(constants_1.STORAGE_KEY_USER, 'object');
|
package/hooks/useLogin.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useLogin.js","sourceRoot":"","sources":["../../src/lib/hooks/useLogin.ts"],"names":[],"mappings":";;;;AAAA,0EAAqC;AACrC,6CAA0C;AAC1C,0DAAkF;AAClF,uCAAuC;AACvC,kDAAyE;AAEzE,yDAAwD;AAExD,MAAM,SAAS,GACb,0xBAA0xB,CAAC;
|
|
1
|
+
{"version":3,"file":"useLogin.js","sourceRoot":"","sources":["../../src/lib/hooks/useLogin.ts"],"names":[],"mappings":";;;;AAAA,0EAAqC;AACrC,6CAA0C;AAC1C,0DAAkF;AAClF,uCAAuC;AACvC,kDAAyE;AAEzE,yDAAwD;AAExD,MAAM,SAAS,GACb,0xBAA0xB,CAAC;AAE7xB,MAAM,UAAU,GAAE;IAChB,GAAG,EAAE,GAAG;IACR,OAAO,EAAE,kBAAkB;IAC3B,IAAI,EAAE,YAAY;IAClB,OAAO,EAAE,eAAe;IACxB,KAAK,EAAE,mBAAmB;CAC3B,CAAC;AAEK,MAAM,QAAQ,GAAG,GAAG,EAAE;IAC3B,MAAM,QAAQ,GAAG,IAAA,yBAAW,GAAE,CAAC;IAC/B,MAAM,OAAO,GAAG,CAAC,IAAU,EAAE,EAAE,CAAC,QAAQ,CAAC,uBAAW,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC,CAAC;IAE1E,MAAM,kBAAkB,GAAG,KAAK,IAAI,EAAE;QACpC,IAAI,YAAM,CAAC,KAAK,CAAC,SAAS,EAAE;YAC1B,OAAO,CAAC,UAAU,CAAC,CAAC;YACpB,IAAA,4BAAY,EAAC,6BAAiB,EAAE,SAAS,EAAE,QAAQ,CAAC,CAAC;YACrD,IAAA,4BAAY,EAAC,4BAAgB,EAAE,UAAU,EAAE,QAAQ,CAAC,CAAC;YACrD,OAAO;SACR;QAED,MAAM,kBAAkB,GAAG,IAAA,2BAAW,EAAC,4BAAgB,EAAE,QAAQ,CAAC,CAAC;QAEnE,oEAAoE;QACpE,IAAI,IAAA,iBAAO,EAAC,kBAAkB,CAAC,EAAE;YAC/B,oEAAoE;YACpE,IAAA,6BAAa,EAAC,4BAAgB,CAAC,CAAC;YAChC,uBAAuB;YACvB,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,YAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;YAC5C,2BAA2B;YAC3B,OAAO;SACR;QAED,2DAA2D;QAC3D,OAAO,CAAC,kBAAkB,CAAC,CAAC;IAC9B,CAAC,CAAC;IAEF,OAAO,EAAE,kBAAkB,EAAE,CAAC;AAChC,CAAC,CAAC;AA7BW,QAAA,QAAQ,YA6BnB"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/** In order to use this feature you have to use the custom hook useUnloadEventInterceptor, which will return an object having the following keys:
|
|
2
|
+
1. registerUnloadEvent: an arrow function which takes two optional parameters to customize the title and the description of the pop-up opened when invoking the exitAction function (see below) and enable the functionality.
|
|
3
|
+
2. unregisterUnloadEvent: an arrow function to call in order to disable this functionality.
|
|
4
|
+
*/
|
|
5
|
+
export declare const useUnloadEventInterceptor: () => {
|
|
6
|
+
registerUnloadEvent: (title?: string | undefined, description?: string | undefined) => void;
|
|
7
|
+
unregisterUnloadEvent: () => void;
|
|
8
|
+
};
|
|
9
|
+
/** If you wont to enable immediately this functionality when invoking the custom hook you can use the hook useUnloadEventInterceptorAndActivate, which will enable the functionality and will disable it when unmounting the component. */
|
|
10
|
+
export declare const useUnloadEventInterceptorAndActivate: (title?: string | undefined, description?: string | undefined) => {
|
|
11
|
+
registerUnloadEvent: (title?: string | undefined, description?: string | undefined) => void;
|
|
12
|
+
unregisterUnloadEvent: () => void;
|
|
13
|
+
};
|
|
14
|
+
/** In order to show a custom pop-up when the user trigger an exit action you have to use the custom hook useUnloadEventOnExit which will return an arrow function to invoke instead of the exit action passing to it the exitAction itself. */
|
|
15
|
+
export declare const useUnloadEventOnExit: () => (exitAction: () => void) => void;
|
|
16
|
+
/** When the exitAction is the Logout you can use the custom hook useUnloadEventLogout which is the customization of the useUnloadEventOnExit using the logout as an exit action. */
|
|
17
|
+
export declare const useUnloadEventLogout: () => () => void;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useUnloadEventLogout = exports.useUnloadEventOnExit = exports.useUnloadEventInterceptorAndActivate = exports.useUnloadEventInterceptor = void 0;
|
|
4
|
+
const react_1 = require("react");
|
|
5
|
+
const react_redux_1 = require("react-redux");
|
|
6
|
+
const env_1 = require("../config/env");
|
|
7
|
+
const appStateSlice_1 = require("../redux/slices/appStateSlice");
|
|
8
|
+
const appStateSlice_2 = require("./../redux/slices/appStateSlice");
|
|
9
|
+
/** In order to use this feature you have to use the custom hook useUnloadEventInterceptor, which will return an object having the following keys:
|
|
10
|
+
1. registerUnloadEvent: an arrow function which takes two optional parameters to customize the title and the description of the pop-up opened when invoking the exitAction function (see below) and enable the functionality.
|
|
11
|
+
2. unregisterUnloadEvent: an arrow function to call in order to disable this functionality.
|
|
12
|
+
*/
|
|
13
|
+
const useUnloadEventInterceptor = () => {
|
|
14
|
+
const dispatch = (0, react_redux_1.useDispatch)();
|
|
15
|
+
const registerUnloadEvent = (title, description) => {
|
|
16
|
+
dispatch(appStateSlice_1.appStateActions.enableUnloadEventInterceptor({ title, description }));
|
|
17
|
+
};
|
|
18
|
+
const unregisterUnloadEvent = () => {
|
|
19
|
+
dispatch(appStateSlice_1.appStateActions.disableUnloadEventInterceptor());
|
|
20
|
+
};
|
|
21
|
+
return {
|
|
22
|
+
registerUnloadEvent,
|
|
23
|
+
unregisterUnloadEvent,
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
exports.useUnloadEventInterceptor = useUnloadEventInterceptor;
|
|
27
|
+
/** If you wont to enable immediately this functionality when invoking the custom hook you can use the hook useUnloadEventInterceptorAndActivate, which will enable the functionality and will disable it when unmounting the component. */
|
|
28
|
+
const useUnloadEventInterceptorAndActivate = (title, description) => {
|
|
29
|
+
const { registerUnloadEvent, unregisterUnloadEvent } = (0, exports.useUnloadEventInterceptor)();
|
|
30
|
+
(0, react_1.useEffect)(() => {
|
|
31
|
+
registerUnloadEvent(title, description);
|
|
32
|
+
return () => unregisterUnloadEvent();
|
|
33
|
+
}, []);
|
|
34
|
+
return {
|
|
35
|
+
registerUnloadEvent,
|
|
36
|
+
unregisterUnloadEvent,
|
|
37
|
+
};
|
|
38
|
+
};
|
|
39
|
+
exports.useUnloadEventInterceptorAndActivate = useUnloadEventInterceptorAndActivate;
|
|
40
|
+
/** In order to show a custom pop-up when the user trigger an exit action you have to use the custom hook useUnloadEventOnExit which will return an arrow function to invoke instead of the exit action passing to it the exitAction itself. */
|
|
41
|
+
const useUnloadEventOnExit = () => {
|
|
42
|
+
const dispatch = (0, react_redux_1.useDispatch)();
|
|
43
|
+
const eventconfiguration = (0, react_redux_1.useSelector)(appStateSlice_2.appStateSelectors.selectUnloadEventConfiguration);
|
|
44
|
+
return (exitAction) => {
|
|
45
|
+
if (eventconfiguration.enabled) {
|
|
46
|
+
dispatch(appStateSlice_1.appStateActions.openUnloadEventNotify(exitAction));
|
|
47
|
+
}
|
|
48
|
+
else {
|
|
49
|
+
exitAction();
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
};
|
|
53
|
+
exports.useUnloadEventOnExit = useUnloadEventOnExit;
|
|
54
|
+
/** When the exitAction is the Logout you can use the custom hook useUnloadEventLogout which is the customization of the useUnloadEventOnExit using the logout as an exit action. */
|
|
55
|
+
const useUnloadEventLogout = () => {
|
|
56
|
+
const onExit = (0, exports.useUnloadEventOnExit)();
|
|
57
|
+
return () => onExit(() => window.location.assign(env_1.CONFIG.URL_FE.LOGOUT));
|
|
58
|
+
};
|
|
59
|
+
exports.useUnloadEventLogout = useUnloadEventLogout;
|
|
60
|
+
//# sourceMappingURL=useUnloadEventInterceptor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useUnloadEventInterceptor.js","sourceRoot":"","sources":["../../src/lib/hooks/useUnloadEventInterceptor.ts"],"names":[],"mappings":";;;AAAA,iCAAkC;AAClC,6CAAuD;AACvD,uCAAuC;AACvC,iEAAgE;AAChE,mEAAoE;AAEpE;;;GAGG;AACI,MAAM,yBAAyB,GAAG,GAAG,EAAE;IAC5C,MAAM,QAAQ,GAAG,IAAA,yBAAW,GAAE,CAAC;IAC/B,MAAM,mBAAmB,GAAG,CAAC,KAAc,EAAE,WAAoB,EAAE,EAAE;QACnE,QAAQ,CAAC,+BAAe,CAAC,4BAA4B,CAAC,EAAE,KAAK,EAAE,WAAW,EAAE,CAAC,CAAC,CAAC;IACjF,CAAC,CAAC;IAEF,MAAM,qBAAqB,GAAG,GAAG,EAAE;QACjC,QAAQ,CAAC,+BAAe,CAAC,6BAA6B,EAAE,CAAC,CAAC;IAC5D,CAAC,CAAC;IAEF,OAAO;QACL,mBAAmB;QACnB,qBAAqB;KACtB,CAAC;AACJ,CAAC,CAAC;AAdW,QAAA,yBAAyB,6BAcpC;AAEF,2OAA2O;AACpO,MAAM,oCAAoC,GAAG,CAAC,KAAc,EAAE,WAAoB,EAAE,EAAE;IAC3F,MAAM,EAAE,mBAAmB,EAAE,qBAAqB,EAAE,GAAG,IAAA,iCAAyB,GAAE,CAAC;IACnF,IAAA,iBAAS,EAAC,GAAG,EAAE;QACb,mBAAmB,CAAC,KAAK,EAAE,WAAW,CAAC,CAAC;QACxC,OAAO,GAAG,EAAE,CAAC,qBAAqB,EAAE,CAAC;IACvC,CAAC,EAAE,EAAE,CAAC,CAAC;IACP,OAAO;QACL,mBAAmB;QACnB,qBAAqB;KACtB,CAAC;AACJ,CAAC,CAAC;AAVW,QAAA,oCAAoC,wCAU/C;AAEF,+OAA+O;AACxO,MAAM,oBAAoB,GAAG,GAAG,EAAE;IACvC,MAAM,QAAQ,GAAG,IAAA,yBAAW,GAAE,CAAC;IAC/B,MAAM,kBAAkB,GAAG,IAAA,yBAAW,EAAC,iCAAiB,CAAC,8BAA8B,CAAC,CAAC;IACzF,OAAO,CAAC,UAAsB,EAAE,EAAE;QAChC,IAAI,kBAAkB,CAAC,OAAO,EAAE;YAC9B,QAAQ,CAAC,+BAAe,CAAC,qBAAqB,CAAC,UAAU,CAAC,CAAC,CAAC;SAC7D;aAAM;YACL,UAAU,EAAE,CAAC;SACd;IACH,CAAC,CAAC;AACJ,CAAC,CAAC;AAVW,QAAA,oBAAoB,wBAU/B;AAEF,oLAAoL;AAC7K,MAAM,oBAAoB,GAAG,GAAG,EAAE;IACvC,MAAM,MAAM,GAAG,IAAA,4BAAoB,GAAE,CAAC;IACtC,OAAO,GAAG,EAAE,CAAC,MAAM,CAAC,GAAG,EAAE,CAAC,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,YAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC;AAC1E,CAAC,CAAC;AAHW,QAAA,oBAAoB,wBAG/B"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const react_redux_1 = require("react-redux");
|
|
4
|
+
const appStateSlice_1 = require("../redux/slices/appStateSlice");
|
|
5
|
+
/** @see {@link UserNotifyHandle} */
|
|
6
|
+
function default_1() {
|
|
7
|
+
const dispatch = (0, react_redux_1.useDispatch)();
|
|
8
|
+
return (notify) => dispatch(appStateSlice_1.appStateActions.addNotify(notify));
|
|
9
|
+
}
|
|
10
|
+
exports.default = default_1;
|
|
11
|
+
//# sourceMappingURL=useUserNotify.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useUserNotify.js","sourceRoot":"","sources":["../../src/lib/hooks/useUserNotify.ts"],"names":[],"mappings":";;AAAA,6CAA0C;AAE1C,iEAAgE;AAEhE,oCAAoC;AACpC;IACE,MAAM,QAAQ,GAAG,IAAA,yBAAW,GAAE,CAAC;IAC/B,OAAO,CAAC,MAAkB,EAAE,EAAE,CAAC,QAAQ,CAAC,+BAAe,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC;AAC7E,CAAC;AAHD,4BAGC"}
|
package/index.d.ts
CHANGED
|
@@ -18,3 +18,4 @@ export { default as ErrorBoundary } from './components/ErrorBoundary/ErrorBounda
|
|
|
18
18
|
export * from './components/ErrorBoundary/ErrorBoundary';
|
|
19
19
|
export { default as LoadingOverlay } from './components/Loading/LoadingOverlay';
|
|
20
20
|
export * from './components/Loading/LoadingOverlay';
|
|
21
|
+
export { default as EndingPage } from './components/EndingPage';
|
package/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.LoadingOverlay = exports.ErrorBoundary = exports.Toast = exports.TitleBox = exports.SessionModal = exports.FilterModal = exports.CustomPagination = exports.CustomAvatar = exports.Footer = exports.Header = void 0;
|
|
3
|
+
exports.EndingPage = exports.LoadingOverlay = exports.ErrorBoundary = exports.Toast = exports.TitleBox = exports.SessionModal = exports.FilterModal = exports.CustomPagination = exports.CustomAvatar = exports.Footer = exports.Header = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
var Header_1 = require("./components/Header/Header");
|
|
6
6
|
Object.defineProperty(exports, "Header", { enumerable: true, get: function () { return (0, tslib_1.__importDefault)(Header_1).default; } });
|
|
@@ -32,4 +32,6 @@ Object.defineProperty(exports, "ErrorBoundary", { enumerable: true, get: functio
|
|
|
32
32
|
var LoadingOverlay_1 = require("./components/Loading/LoadingOverlay");
|
|
33
33
|
Object.defineProperty(exports, "LoadingOverlay", { enumerable: true, get: function () { return (0, tslib_1.__importDefault)(LoadingOverlay_1).default; } });
|
|
34
34
|
(0, tslib_1.__exportStar)(require("./components/Loading/LoadingOverlay"), exports);
|
|
35
|
+
var EndingPage_1 = require("./components/EndingPage");
|
|
36
|
+
Object.defineProperty(exports, "EndingPage", { enumerable: true, get: function () { return (0, tslib_1.__importDefault)(EndingPage_1).default; } });
|
|
35
37
|
//# sourceMappingURL=index.js.map
|
package/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/lib/index.ts"],"names":[],"mappings":";;;;AAAA,qDAA+D;AAAtD,8HAAA,OAAO,OAAU;AAC1B,0EAA2C;AAE3C,qDAA+D;AAAtD,8HAAA,OAAO,OAAU;AAC1B,0EAA2C;AAE3C,0DAAoE;AAA3D,0IAAA,OAAO,OAAgB;AAChC,yEAA0C;AAE1C,kEAA4E;AAAnE,kJAAA,OAAO,OAAoB;AACpC,6EAA8C;AAE9C,wDAAkE;AAAzD,wIAAA,OAAO,OAAe;AAC/B,wEAAyC;AAEzC,0DAAoE;AAA3D,0IAAA,OAAO,OAAgB;AAChC,yEAA0C;AAE1C,kDAA4D;AAAnD,kIAAA,OAAO,OAAY;AAC5B,qEAAsC;AAEtC,4CAAsD;AAA7C,4HAAA,OAAO,OAAS;AACzB,kEAAmC;AAEnC,0EAAoF;AAA3E,4IAAA,OAAO,OAAiB;AACjC,wFAAyD;AAEzD,sEAAgF;AAAvE,8IAAA,OAAO,OAAkB;AAClC,mFAAoD"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/lib/index.ts"],"names":[],"mappings":";;;;AAAA,qDAA+D;AAAtD,8HAAA,OAAO,OAAU;AAC1B,0EAA2C;AAE3C,qDAA+D;AAAtD,8HAAA,OAAO,OAAU;AAC1B,0EAA2C;AAE3C,0DAAoE;AAA3D,0IAAA,OAAO,OAAgB;AAChC,yEAA0C;AAE1C,kEAA4E;AAAnE,kJAAA,OAAO,OAAoB;AACpC,6EAA8C;AAE9C,wDAAkE;AAAzD,wIAAA,OAAO,OAAe;AAC/B,wEAAyC;AAEzC,0DAAoE;AAA3D,0IAAA,OAAO,OAAgB;AAChC,yEAA0C;AAE1C,kDAA4D;AAAnD,kIAAA,OAAO,OAAY;AAC5B,qEAAsC;AAEtC,4CAAsD;AAA7C,4HAAA,OAAO,OAAS;AACzB,kEAAmC;AAEnC,0EAAoF;AAA3E,4IAAA,OAAO,OAAiB;AACjC,wFAAyD;AAEzD,sEAAgF;AAAvE,8IAAA,OAAO,OAAkB;AAClC,mFAAoD;AAEpD,sDAAgE;AAAvD,sIAAA,OAAO,OAAc"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export declare type UserNotify = {
|
|
3
|
+
/** The identifier used to recognize the user notify: it cannot be possible to have the same error id at the same time */
|
|
4
|
+
id: string;
|
|
5
|
+
/** The title to show in the popup or toast */
|
|
6
|
+
title: string;
|
|
7
|
+
/** The body to show in the popup or toast */
|
|
8
|
+
message: React.ReactNode;
|
|
9
|
+
/** If component === 'Toast'. The logo to be rendered. As default a confirm logo will be used */
|
|
10
|
+
logo?: React.ElementType;
|
|
11
|
+
/** If component === 'Toast'. The color used for the left border */
|
|
12
|
+
leftBorderColor?: string;
|
|
13
|
+
/** If component === 'SessionModal'. If defined, it will render a confirm button which will execute this function */
|
|
14
|
+
onConfirm?: () => void;
|
|
15
|
+
/** If component === 'SessionModal'. If present, this string will rappresent the confirm button label */
|
|
16
|
+
confirmLabel?: string;
|
|
17
|
+
/** If defined, it will be executed when closing the popup */
|
|
18
|
+
onClose?: () => void;
|
|
19
|
+
/** If component === 'SessionModal'. The close button label */
|
|
20
|
+
closeLabel?: string;
|
|
21
|
+
/** Can render a SessionModal or Toast component */
|
|
22
|
+
component?: 'SessionModal' | 'Toast';
|
|
23
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"UserNotify.js","sourceRoot":"","sources":["../../src/lib/model/UserNotify.ts"],"names":[],"mappings":""}
|
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.
|
|
4
|
+
"version": "1.2.1",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": "https://github.com/pagopa/selfcare-common-frontend",
|
|
7
7
|
"author": "https://www.pagopa.gov.it",
|
|
@@ -55,15 +55,16 @@
|
|
|
55
55
|
"build": "yarn setTsConfigStart && react-scripts build",
|
|
56
56
|
"clean:build": "rimraf build",
|
|
57
57
|
"setTsConfigDist": "copyfiles tsconfigDist.json build && renamer --replace tsconfig.json build/tsconfigDist.json && copyfiles -u 1 build/tsconfig.json . && rimraf build/tsconfig.json",
|
|
58
|
-
"cpDistStatic": "copyfiles -u 2 src/lib/index.css dist && copyfiles package.json README.md dist",
|
|
58
|
+
"cpDistStatic": "copyfiles -u 2 src/lib/index.css src/lib/utils/fixSwagger20ArraySchemaDef.js dist && copyfiles package.json README.md CHANGELOG.md dist",
|
|
59
59
|
"dist": "yarn setTsConfigDist && tsc && yarn cpDistStatic",
|
|
60
60
|
"clean:dist": "rimraf dist",
|
|
61
|
-
"test": "yarn setTsConfigStart && react-scripts test
|
|
62
|
-
"test:coverage": "react-scripts test
|
|
61
|
+
"test": "yarn setTsConfigStart && react-scripts test -i",
|
|
62
|
+
"test:coverage": "react-scripts test -i --coverage",
|
|
63
63
|
"clean:coverage": "rimraf coverage",
|
|
64
64
|
"lint-autofix": "yarn setTsConfigStart && eslint . -c .eslintrc.js --ext .ts,.tsx --fix",
|
|
65
65
|
"lint": "yarn setTsConfigStart && eslint . -c .eslintrc.js --ext .ts,.tsx ",
|
|
66
|
-
"prettify": "prettier --write \"./**/*.{ts,tsx}\""
|
|
66
|
+
"prettify": "prettier --write \"./**/*.{ts,tsx}\"",
|
|
67
|
+
"version": "auto-changelog -p --config .auto-changelog.json --tag-pattern \\d+\\.\\d+.\\d+$ --unreleased --unreleased --ignore-commit-pattern \"Bump version to\" --starting-version v1.0.0 && git add CHANGELOG.md"
|
|
67
68
|
},
|
|
68
69
|
"eslintConfig": {
|
|
69
70
|
"extends": [
|
|
@@ -88,6 +89,7 @@
|
|
|
88
89
|
"@typescript-eslint/eslint-plugin": "^5.0.0",
|
|
89
90
|
"@typescript-eslint/parser": "^5.0.0",
|
|
90
91
|
"api-spec-converter": "^2.12.0",
|
|
92
|
+
"auto-changelog": "^2.3.0",
|
|
91
93
|
"copyfiles": "^2.4.1",
|
|
92
94
|
"eslint": "7.11.0",
|
|
93
95
|
"eslint-config-prettier": "^8.3.0",
|
|
@@ -110,7 +112,15 @@
|
|
|
110
112
|
"coveragePathIgnorePatterns": [
|
|
111
113
|
"src/index.tsx",
|
|
112
114
|
"src/reportWebVitals.ts",
|
|
113
|
-
"src/api/generated"
|
|
115
|
+
"src/api/generated",
|
|
116
|
+
"src/examples/*",
|
|
117
|
+
"src/AppExample.tsx",
|
|
118
|
+
"src/lib/utils/fixSwagger20ArraySchemaDef.js",
|
|
119
|
+
"src/lib/common-polyfill.ts",
|
|
120
|
+
"src/lib/index.ts",
|
|
121
|
+
"src/lib/components/icons/*",
|
|
122
|
+
"src/lib/model/*",
|
|
123
|
+
"src/store.ts"
|
|
114
124
|
]
|
|
115
125
|
}
|
|
116
126
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { PayloadAction } from '@reduxjs/toolkit';
|
|
2
2
|
import { ErrorInfo } from 'react';
|
|
3
|
+
import { UserNotify } from '../../model/UserNotify';
|
|
3
4
|
export declare type AppError = {
|
|
4
5
|
/** The identifier used to recognize the error: it cannot be possible to have the same error id at the same time */
|
|
5
6
|
id: string;
|
|
@@ -20,6 +21,8 @@ export declare type AppError = {
|
|
|
20
21
|
onClose?: () => void;
|
|
21
22
|
/** If true, it will notify the error */
|
|
22
23
|
toNotify: boolean;
|
|
24
|
+
/** Can render a SessionModal or Toast component */
|
|
25
|
+
component?: 'SessionModal' | 'Toast';
|
|
23
26
|
};
|
|
24
27
|
interface AppStateState {
|
|
25
28
|
loading: {
|
|
@@ -29,6 +32,14 @@ interface AppStateState {
|
|
|
29
32
|
};
|
|
30
33
|
};
|
|
31
34
|
errors: Array<AppError>;
|
|
35
|
+
userNotifies: Array<UserNotify>;
|
|
36
|
+
unloadEventConfiguration: {
|
|
37
|
+
enabled: boolean;
|
|
38
|
+
open: boolean;
|
|
39
|
+
title?: string;
|
|
40
|
+
description?: string;
|
|
41
|
+
exitAction?: () => void;
|
|
42
|
+
};
|
|
32
43
|
}
|
|
33
44
|
export declare const appStateSlice: import("@reduxjs/toolkit").Slice<AppStateState, {
|
|
34
45
|
setLoading: (state: import("immer/dist/internal").WritableDraft<AppStateState>, action: PayloadAction<{
|
|
@@ -37,6 +48,15 @@ export declare const appStateSlice: import("@reduxjs/toolkit").Slice<AppStateSta
|
|
|
37
48
|
}>) => void;
|
|
38
49
|
addError: (state: import("immer/dist/internal").WritableDraft<AppStateState>, action: PayloadAction<AppError>) => void;
|
|
39
50
|
removeError: (state: import("immer/dist/internal").WritableDraft<AppStateState>, action: PayloadAction<AppError>) => void;
|
|
51
|
+
addNotify: (state: import("immer/dist/internal").WritableDraft<AppStateState>, action: PayloadAction<UserNotify>) => void;
|
|
52
|
+
removeNotify: (state: import("immer/dist/internal").WritableDraft<AppStateState>, action: PayloadAction<UserNotify>) => void;
|
|
53
|
+
enableUnloadEventInterceptor: (state: import("immer/dist/internal").WritableDraft<AppStateState>, action: PayloadAction<{
|
|
54
|
+
title?: string;
|
|
55
|
+
description?: string;
|
|
56
|
+
}>) => void;
|
|
57
|
+
disableUnloadEventInterceptor: (state: import("immer/dist/internal").WritableDraft<AppStateState>) => void;
|
|
58
|
+
openUnloadEventNotify: (state: import("immer/dist/internal").WritableDraft<AppStateState>, action: PayloadAction<() => void>) => void;
|
|
59
|
+
closeUnloadEventNotify: (state: import("immer/dist/internal").WritableDraft<AppStateState>) => void;
|
|
40
60
|
}, "appState">;
|
|
41
61
|
export declare const appStateActions: import("@reduxjs/toolkit").CaseReducerActions<{
|
|
42
62
|
setLoading: (state: import("immer/dist/internal").WritableDraft<AppStateState>, action: PayloadAction<{
|
|
@@ -45,10 +65,35 @@ export declare const appStateActions: import("@reduxjs/toolkit").CaseReducerActi
|
|
|
45
65
|
}>) => void;
|
|
46
66
|
addError: (state: import("immer/dist/internal").WritableDraft<AppStateState>, action: PayloadAction<AppError>) => void;
|
|
47
67
|
removeError: (state: import("immer/dist/internal").WritableDraft<AppStateState>, action: PayloadAction<AppError>) => void;
|
|
68
|
+
addNotify: (state: import("immer/dist/internal").WritableDraft<AppStateState>, action: PayloadAction<UserNotify>) => void;
|
|
69
|
+
removeNotify: (state: import("immer/dist/internal").WritableDraft<AppStateState>, action: PayloadAction<UserNotify>) => void;
|
|
70
|
+
enableUnloadEventInterceptor: (state: import("immer/dist/internal").WritableDraft<AppStateState>, action: PayloadAction<{
|
|
71
|
+
title?: string;
|
|
72
|
+
description?: string;
|
|
73
|
+
}>) => void;
|
|
74
|
+
disableUnloadEventInterceptor: (state: import("immer/dist/internal").WritableDraft<AppStateState>) => void;
|
|
75
|
+
openUnloadEventNotify: (state: import("immer/dist/internal").WritableDraft<AppStateState>, action: PayloadAction<() => void>) => void;
|
|
76
|
+
closeUnloadEventNotify: (state: import("immer/dist/internal").WritableDraft<AppStateState>) => void;
|
|
48
77
|
}>;
|
|
49
78
|
export declare const appStateReducer: import("redux").Reducer<AppStateState, import("redux").AnyAction>;
|
|
50
79
|
export declare const appStateSelectors: {
|
|
51
|
-
selectLoading: (state:
|
|
52
|
-
|
|
80
|
+
selectLoading: (state: {
|
|
81
|
+
appState: AppStateState;
|
|
82
|
+
}) => boolean;
|
|
83
|
+
selectErrors: (state: {
|
|
84
|
+
appState: AppStateState;
|
|
85
|
+
}) => AppError[];
|
|
86
|
+
selectNotifies: (state: {
|
|
87
|
+
appState: AppStateState;
|
|
88
|
+
}) => UserNotify[];
|
|
89
|
+
selectUnloadEventConfiguration: (state: {
|
|
90
|
+
appState: AppStateState;
|
|
91
|
+
}) => {
|
|
92
|
+
enabled: boolean;
|
|
93
|
+
open: boolean;
|
|
94
|
+
title?: string | undefined;
|
|
95
|
+
description?: string | undefined;
|
|
96
|
+
exitAction?: (() => void) | undefined;
|
|
97
|
+
};
|
|
53
98
|
};
|
|
54
99
|
export {};
|
|
@@ -8,6 +8,18 @@ const initialState = {
|
|
|
8
8
|
tasks: {},
|
|
9
9
|
},
|
|
10
10
|
errors: [],
|
|
11
|
+
userNotifies: [],
|
|
12
|
+
unloadEventConfiguration: {
|
|
13
|
+
enabled: false,
|
|
14
|
+
open: false,
|
|
15
|
+
},
|
|
16
|
+
};
|
|
17
|
+
const keepOnPage = (e) => {
|
|
18
|
+
const message = "Warning!\n\nNavigating away from this page will delete your text if you haven't already saved it.";
|
|
19
|
+
e.preventDefault();
|
|
20
|
+
// eslint-disable-next-line functional/immutable-data
|
|
21
|
+
e.returnValue = message;
|
|
22
|
+
return message;
|
|
11
23
|
};
|
|
12
24
|
/* eslint-disable functional/immutable-data */
|
|
13
25
|
exports.appStateSlice = (0, toolkit_1.createSlice)({
|
|
@@ -25,11 +37,40 @@ exports.appStateSlice = (0, toolkit_1.createSlice)({
|
|
|
25
37
|
}
|
|
26
38
|
},
|
|
27
39
|
addError: (state, action) => {
|
|
40
|
+
if (!action.payload.component) {
|
|
41
|
+
action.payload.component = 'SessionModal';
|
|
42
|
+
}
|
|
28
43
|
state.errors.push(action.payload);
|
|
29
44
|
},
|
|
30
45
|
removeError: (state, action) => {
|
|
31
46
|
state.errors = state.errors.filter((e) => e.id !== action.payload.id);
|
|
32
47
|
},
|
|
48
|
+
addNotify: (state, action) => {
|
|
49
|
+
state.userNotifies.push(action.payload);
|
|
50
|
+
},
|
|
51
|
+
removeNotify: (state, action) => {
|
|
52
|
+
state.userNotifies = state.userNotifies.filter((e) => e.id !== action.payload.id);
|
|
53
|
+
},
|
|
54
|
+
enableUnloadEventInterceptor: (state, action) => {
|
|
55
|
+
state.unloadEventConfiguration.open = false;
|
|
56
|
+
state.unloadEventConfiguration.enabled = true;
|
|
57
|
+
state.unloadEventConfiguration.title = action.payload.title;
|
|
58
|
+
state.unloadEventConfiguration.description = action.payload.description;
|
|
59
|
+
window.addEventListener('beforeunload', keepOnPage);
|
|
60
|
+
},
|
|
61
|
+
disableUnloadEventInterceptor: (state) => {
|
|
62
|
+
state.unloadEventConfiguration.open = false;
|
|
63
|
+
state.unloadEventConfiguration.enabled = false;
|
|
64
|
+
window.removeEventListener('beforeunload', keepOnPage);
|
|
65
|
+
},
|
|
66
|
+
openUnloadEventNotify: (state, action) => {
|
|
67
|
+
state.unloadEventConfiguration.open = true;
|
|
68
|
+
state.unloadEventConfiguration.exitAction = action.payload;
|
|
69
|
+
},
|
|
70
|
+
closeUnloadEventNotify: (state) => {
|
|
71
|
+
state.unloadEventConfiguration.open = false;
|
|
72
|
+
state.unloadEventConfiguration.exitAction = undefined;
|
|
73
|
+
},
|
|
33
74
|
},
|
|
34
75
|
});
|
|
35
76
|
exports.appStateActions = exports.appStateSlice.actions;
|
|
@@ -37,5 +78,7 @@ exports.appStateReducer = exports.appStateSlice.reducer;
|
|
|
37
78
|
exports.appStateSelectors = {
|
|
38
79
|
selectLoading: (state) => state.appState.loading.result,
|
|
39
80
|
selectErrors: (state) => state.appState.errors,
|
|
81
|
+
selectNotifies: (state) => state.appState.userNotifies,
|
|
82
|
+
selectUnloadEventConfiguration: (state) => state.appState.unloadEventConfiguration,
|
|
40
83
|
};
|
|
41
84
|
//# sourceMappingURL=appStateSlice.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"appStateSlice.js","sourceRoot":"","sources":["../../../src/lib/redux/slices/appStateSlice.ts"],"names":[],"mappings":";;;AAAA,8CAA8D;
|
|
1
|
+
{"version":3,"file":"appStateSlice.js","sourceRoot":"","sources":["../../../src/lib/redux/slices/appStateSlice.ts"],"names":[],"mappings":"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"}
|
|
@@ -11,6 +11,8 @@ export declare const userActions: import("@reduxjs/toolkit").CaseReducerActions<
|
|
|
11
11
|
}>;
|
|
12
12
|
export declare const userReducer: import("redux").Reducer<UserState, import("redux").AnyAction>;
|
|
13
13
|
export declare const userSelectors: {
|
|
14
|
-
selectLoggedUser: (state:
|
|
14
|
+
selectLoggedUser: (state: {
|
|
15
|
+
user: UserState;
|
|
16
|
+
}) => User | undefined;
|
|
15
17
|
};
|
|
16
18
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"userSlice.js","sourceRoot":"","sources":["../../../src/lib/redux/slices/userSlice.ts"],"names":[],"mappings":";;;AAAA,8CAA8D;AAO9D,MAAM,YAAY,GAAc,EAAE,CAAC;AAEnC,8CAA8C;AACjC,QAAA,SAAS,GAAG,IAAA,qBAAW,EAAC;IACnC,IAAI,EAAE,MAAM;IACZ,YAAY;IACZ,QAAQ,EAAE;QACR,aAAa,EAAE,CAAC,KAAK,EAAE,MAA2B,EAAE,EAAE;YACpD,KAAK,CAAC,MAAM,GAAG,MAAM,CAAC,OAAO,CAAC;QAChC,CAAC;KACF;CACF,CAAC,CAAC;AAEU,QAAA,WAAW,GAAG,iBAAS,CAAC,OAAO,CAAC;AAChC,QAAA,WAAW,GAAG,iBAAS,CAAC,OAAO,CAAC;AAEhC,QAAA,aAAa,GAAG;IAC3B,gBAAgB,EAAE,CAAC,
|
|
1
|
+
{"version":3,"file":"userSlice.js","sourceRoot":"","sources":["../../../src/lib/redux/slices/userSlice.ts"],"names":[],"mappings":";;;AAAA,8CAA8D;AAO9D,MAAM,YAAY,GAAc,EAAE,CAAC;AAEnC,8CAA8C;AACjC,QAAA,SAAS,GAAG,IAAA,qBAAW,EAAC;IACnC,IAAI,EAAE,MAAM;IACZ,YAAY;IACZ,QAAQ,EAAE;QACR,aAAa,EAAE,CAAC,KAAK,EAAE,MAA2B,EAAE,EAAE;YACpD,KAAK,CAAC,MAAM,GAAG,MAAM,CAAC,OAAO,CAAC;QAChC,CAAC;KACF;CACF,CAAC,CAAC;AAEU,QAAA,WAAW,GAAG,iBAAS,CAAC,OAAO,CAAC;AAChC,QAAA,WAAW,GAAG,iBAAS,CAAC,OAAO,CAAC;AAEhC,QAAA,aAAa,GAAG;IAC3B,gBAAgB,EAAE,CAAC,KAA0B,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM;CACpE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const buildAssistanceURI: (assistanceEmail?: string | undefined) => string;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.buildAssistanceURI = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const isEmpty_1 = (0, tslib_1.__importDefault)(require("lodash/isEmpty"));
|
|
6
|
+
const env_1 = require("../config/env");
|
|
7
|
+
const storage_utils_1 = require("../utils/storage-utils");
|
|
8
|
+
const constants_1 = require("../utils/constants");
|
|
9
|
+
const buildAssistanceURI = (assistanceEmail) => {
|
|
10
|
+
const sessionStorageUser = (0, storage_utils_1.storageRead)(constants_1.STORAGE_KEY_USER, 'object');
|
|
11
|
+
if ((0, isEmpty_1.default)(sessionStorageUser)) {
|
|
12
|
+
return `mailto:${assistanceEmail}`;
|
|
13
|
+
}
|
|
14
|
+
else {
|
|
15
|
+
return env_1.CONFIG.URL_FE.ASSISTANCE;
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
exports.buildAssistanceURI = buildAssistanceURI;
|
|
19
|
+
//# sourceMappingURL=assistanceService.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"assistanceService.js","sourceRoot":"","sources":["../../src/lib/services/assistanceService.ts"],"names":[],"mappings":";;;;AACA,0EAAqC;AACrC,uCAAuC;AACvC,0DAAqD;AACrD,kDAAsD;AAE/C,MAAM,kBAAkB,GAAG,CAAC,eAAwB,EAAE,EAAE;IAE3D,MAAM,kBAAkB,GAAG,IAAA,2BAAW,EAAC,4BAAgB,EAAE,QAAQ,CAAC,CAAC;IAEnE,IAAI,IAAA,iBAAO,EAAC,kBAAkB,CAAC,EAAE;QAC7B,OAAO,UAAU,eAAe,EAAE,CAAC;KACtC;SAAO;QACJ,OAAO,YAAM,CAAC,MAAM,CAAC,UAAU,CAAC;KACnC;AACL,CAAC,CAAC;AATW,QAAA,kBAAkB,sBAS7B"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { ApiRequestType, IResponseType, TypeofApiResponse } from '@pagopa/ts-commons/lib/requests';
|
|
2
|
+
import * as t from 'io-ts';
|
|
3
|
+
import { EnhancedStore } from '@reduxjs/toolkit';
|
|
4
|
+
/** To show an error popup to inform of the not valid session */
|
|
5
|
+
export declare const onRedirectToLogin: (store: EnhancedStore) => {
|
|
6
|
+
payload: import("../redux/slices/appStateSlice").AppError;
|
|
7
|
+
type: string;
|
|
8
|
+
};
|
|
9
|
+
/** Return the implementation of fetch configured with a timeout */
|
|
10
|
+
export declare const buildFetchApi: (timeoutMs?: number) => (input: string | Request, init?: RequestInit | undefined) => Promise<Response>;
|
|
11
|
+
/** Extract the response of a @pagopa/openapi-codegen-ts generated client rest invocation having status code successHttpStatus.
|
|
12
|
+
If notValidTokenHttpStatus is not null and the returned status is equal to notValidTokenHttpStatus, it will call the onRedirectToLogin function and will schedule the redirect towards logout path.
|
|
13
|
+
If notAuthorizedTokenHttpStatus is not null and the returned status is equal to notAuthorizedTokenHttpStatus, it will throw an Error with message "Operation not allowed".
|
|
14
|
+
If emptyResponseHttpStatus is not null and the returned status is equal to emptyResponseHttpStatus, it will return a promise that resolve to null value.
|
|
15
|
+
Other statuses will return will throw a generic error. */
|
|
16
|
+
export declare const extractResponse: <R>(response: t.Validation<TypeofApiResponse<ApiRequestType<any, any, any, IResponseType<any, any, any>>>>, successHttpStatus: number, onRedirectToLogin: () => void, notValidTokenHttpStatus?: number | null, notAuthorizedTokenHttpStatus?: number | null, emptyResponseHttpStatus?: number | null) => Promise<R>;
|