@pagopa/selfcare-common-frontend 1.35.0 → 1.36.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/CHANGELOG.md +883 -1
- package/README.md +34 -8
- package/examples/locale/en.d.ts +20 -0
- package/examples/locale/en.js +18 -0
- package/examples/locale/index.js +4 -0
- package/examples/locale/it.d.ts +20 -0
- package/examples/locale/it.js +19 -0
- package/{common-polyfill.d.ts → lib/common-polyfill.d.ts} +0 -1
- package/lib/common-polyfill.js +9 -0
- package/lib/components/BackComponent.d.ts +7 -0
- package/lib/components/BackComponent.js +8 -0
- package/lib/components/CustomAlert.d.ts +12 -0
- package/lib/components/CustomAlert.js +7 -0
- package/{components → lib/components}/CustomAvatar.d.ts +2 -3
- package/lib/components/CustomAvatar.js +13 -0
- package/{components → lib/components}/CustomPagination.d.ts +7 -3
- package/lib/components/CustomPagination.js +25 -0
- package/{components → lib/components}/EndingPage.d.ts +15 -3
- package/lib/components/EndingPage.js +4 -0
- package/lib/components/ErrorBoundary/ErrorBoundary.d.ts +11 -0
- package/lib/components/ErrorBoundary/ErrorBoundary.js +93 -0
- package/{components → lib/components}/ErrorBoundary/components/BlockingErrorPage.d.ts +2 -3
- package/lib/components/ErrorBoundary/components/BlockingErrorPage.js +11 -0
- package/{components → lib/components}/FilterModal.d.ts +3 -3
- package/lib/components/FilterModal.js +29 -0
- package/{components → lib/components}/Footer/Footer.d.ts +2 -3
- package/lib/components/Footer/Footer.js +179 -0
- package/{components → lib/components}/Footer/FooterConfig.js +5 -9
- package/{components → lib/components}/Header/Header.d.ts +11 -6
- package/lib/components/Header/Header.js +45 -0
- package/{components → lib/components}/Loading/LoadingOverlay.d.ts +1 -2
- package/lib/components/Loading/LoadingOverlay.js +13 -0
- package/lib/components/LoadingOverlayComponent.d.ts +7 -0
- package/lib/components/LoadingOverlayComponent.js +25 -0
- package/{components → lib/components}/NavigationBar.d.ts +5 -4
- package/lib/components/NavigationBar.js +17 -0
- package/{components → lib/components}/SessionModal.d.ts +3 -3
- package/lib/components/SessionModal.js +17 -0
- package/{components → lib/components}/TitleBox.d.ts +7 -7
- package/lib/components/TitleBox.js +9 -0
- package/{components → lib/components}/Toast.d.ts +3 -3
- package/lib/components/Toast.js +25 -0
- package/{components → lib/components}/ToastWrapper.d.ts +2 -2
- package/lib/components/ToastWrapper.js +12 -0
- package/{components → lib/components}/UnloadEventHandler.d.ts +1 -2
- package/lib/components/UnloadEventHandler.js +29 -0
- package/{components → lib/components}/UserNotifyHandle.d.ts +1 -2
- package/lib/components/UserNotifyHandle.js +62 -0
- package/{components → lib/components}/icons/CheckIllustrationIcon.d.ts +1 -2
- package/lib/components/icons/CheckIllustrationIcon.js +3 -0
- package/lib/components/icons/ConfirmIcon.js +4 -0
- package/{components → lib/components}/icons/ErrorIcon.d.ts +1 -2
- package/lib/components/icons/ErrorIcon.js +3 -0
- package/lib/components/icons/ErrorIconExclamation.js +4 -0
- package/lib/components/icons/FaultIcon.js +4 -0
- package/{components → lib/components}/icons/PagoPaIcon.d.ts +1 -2
- package/lib/components/icons/PagoPaIcon.js +3 -0
- package/{components → lib/components}/icons/PagoPaIconColored.d.ts +1 -2
- package/lib/components/icons/PagoPaIconColored.js +3 -0
- package/{components → lib/components}/icons/PagoPaMiniIcon.d.ts +1 -2
- package/lib/components/icons/PagoPaMiniIcon.js +3 -0
- package/lib/components/tests/FilterModal.test.d.ts +1 -0
- package/lib/components/tests/FilterModal.test.js +37 -0
- package/{config → lib/config}/env.d.ts +4 -1
- package/{config → lib/config}/env.js +13 -17
- package/lib/consentManagementConfigure.d.ts +1 -0
- package/{consentManagementConfigure.js → lib/consentManagementConfigure.js} +5 -8
- package/{decorators → lib/decorators}/__mocks__/withLogin.d.ts +1 -2
- package/lib/decorators/__mocks__/withLogin.js +18 -0
- package/{decorators → lib/decorators}/withLogin.d.ts +1 -2
- package/{decorators → lib/decorators}/withLogin.js +13 -18
- package/{decorators → lib/decorators}/withRetrievedValue.d.ts +1 -1
- package/{decorators → lib/decorators}/withRetrievedValue.js +9 -14
- package/lib/hooks/useErrorDispatcher.js +7 -0
- package/{hooks → lib/hooks}/useFakePagination.d.ts +3 -3
- package/{hooks → lib/hooks}/useFakePagination.js +9 -15
- package/lib/hooks/useFocus.d.ts +1 -0
- package/lib/hooks/useFocus.js +8 -0
- package/lib/hooks/useLiveAnnouncerWithRegion.d.ts +4 -0
- package/lib/hooks/useLiveAnnouncerWithRegion.js +19 -0
- package/lib/hooks/useLoading.js +10 -0
- package/lib/hooks/useLogin.js +40 -0
- package/lib/hooks/usePermissions.d.ts +7 -0
- package/lib/hooks/usePermissions.js +25 -0
- package/lib/hooks/useReduxCachedValue.d.ts +22 -0
- package/{hooks → lib/hooks}/useReduxCachedValue.js +10 -17
- package/{hooks → lib/hooks}/useUnloadEventInterceptor.d.ts +3 -3
- package/{hooks → lib/hooks}/useUnloadEventInterceptor.js +24 -32
- package/lib/hooks/useUserNotify.js +7 -0
- package/{index.d.ts → lib/index.d.ts} +11 -8
- package/lib/index.js +36 -0
- package/{locale/it.d.ts → lib/locale/de.d.ts} +4 -1
- package/{locale → lib/locale}/de.js +31 -31
- package/{locale → lib/locale}/en.d.ts +4 -1
- package/{locale → lib/locale}/en.js +30 -30
- package/{locale → lib/locale}/fr.d.ts +5 -2
- package/{locale → lib/locale}/fr.js +26 -26
- package/{locale/de.d.ts → lib/locale/it.d.ts} +8 -2
- package/{locale → lib/locale}/it.js +11 -8
- package/lib/locale/locale-utils.js +45 -0
- package/{locale → lib/locale}/sl.d.ts +5 -2
- package/{locale → lib/locale}/sl.js +31 -31
- package/{model → lib/model}/AppError.d.ts +1 -1
- package/lib/model/AppError.js +1 -0
- package/lib/model/JwtUser.d.ts +9 -0
- package/lib/model/JwtUser.js +1 -0
- package/{model → lib/model}/Page.d.ts +1 -1
- package/lib/model/Page.js +1 -0
- package/{model → lib/model}/PageRequest.d.ts +1 -1
- package/lib/model/PageRequest.js +1 -0
- package/{model → lib/model}/PageResource.d.ts +1 -1
- package/lib/model/PageResource.js +1 -0
- package/lib/model/User.d.ts +8 -0
- package/lib/model/User.js +1 -0
- package/{model → lib/model}/UserNotify.d.ts +1 -2
- package/lib/model/UserNotify.js +1 -0
- package/lib/redux/slices/appStateSlice.d.ts +58 -0
- package/{redux → lib/redux}/slices/appStateSlice.js +15 -9
- package/lib/redux/slices/permissionsSlice.d.ts +12 -0
- package/lib/redux/slices/permissionsSlice.js +23 -0
- package/lib/redux/slices/productsSlice.d.ts +204 -0
- package/lib/redux/slices/productsSlice.js +26 -0
- package/lib/redux/slices/userSlice.d.ts +36 -0
- package/lib/redux/slices/userSlice.js +17 -0
- package/{services → lib/services}/analyticsService.d.ts +2 -1
- package/{services → lib/services}/analyticsService.js +31 -28
- package/{services → lib/services}/assistanceService.d.ts +1 -1
- package/lib/services/assistanceService.js +14 -0
- package/lib/services/errorService.js +8 -0
- package/{utils → lib/utils}/api-utils.d.ts +3 -3
- package/{utils → lib/utils}/api-utils.js +28 -23
- package/lib/utils/constants.d.ts +69 -0
- package/lib/utils/constants.js +83 -0
- package/lib/utils/productId2ProductTitle.d.ts +1 -0
- package/lib/utils/productId2ProductTitle.js +13 -0
- package/lib/utils/routes-utils.js +2 -0
- package/{utils → lib/utils}/storage-utils.d.ts +3 -3
- package/{utils → lib/utils}/storage-utils.js +4 -12
- package/{utils → lib/utils}/storage.d.ts +6 -0
- package/lib/utils/storage.js +31 -0
- package/lib/utils/utils.d.ts +11 -0
- package/lib/utils/utils.js +148 -0
- package/{utils → lib/utils}/verifyChecksumMatchWithTaxCode.js +1 -6
- package/{utils → lib/utils}/verifyNameMatchWithTaxCode.d.ts +1 -1
- package/lib/utils/verifyNameMatchWithTaxCode.js +27 -0
- package/{utils → lib/utils}/verifySurnameMatchWithTaxCode.d.ts +1 -1
- package/lib/utils/verifySurnameMatchWithTaxCode.js +17 -0
- package/package.json +54 -79
- package/build.info +0 -2
- package/common-polyfill.js +0 -13
- package/common-polyfill.js.map +0 -1
- package/components/BackComponent.d.ts +0 -6
- package/components/BackComponent.js +0 -12
- package/components/BackComponent.js.map +0 -1
- package/components/CustomAvatar.js +0 -18
- package/components/CustomAvatar.js.map +0 -1
- package/components/CustomPagination.js +0 -31
- package/components/CustomPagination.js.map +0 -1
- package/components/EndingPage.js +0 -7
- package/components/EndingPage.js.map +0 -1
- package/components/ErrorBoundary/ErrorBoundary.d.ts +0 -11
- package/components/ErrorBoundary/ErrorBoundary.js +0 -98
- package/components/ErrorBoundary/ErrorBoundary.js.map +0 -1
- package/components/ErrorBoundary/components/BlockingErrorPage.js +0 -15
- package/components/ErrorBoundary/components/BlockingErrorPage.js.map +0 -1
- package/components/FilterModal.js +0 -37
- package/components/FilterModal.js.map +0 -1
- package/components/Footer/Footer.js +0 -213
- package/components/Footer/Footer.js.map +0 -1
- package/components/Footer/FooterConfig.js.map +0 -1
- package/components/Header/Header.js +0 -24
- package/components/Header/Header.js.map +0 -1
- package/components/Loading/LoadingOverlay.js +0 -18
- package/components/Loading/LoadingOverlay.js.map +0 -1
- package/components/LoadingOverlayComponent.d.ts +0 -7
- package/components/LoadingOverlayComponent.js +0 -20
- package/components/LoadingOverlayComponent.js.map +0 -1
- package/components/NavigationBar.js +0 -21
- package/components/NavigationBar.js.map +0 -1
- package/components/SessionModal.js +0 -21
- package/components/SessionModal.js.map +0 -1
- package/components/TitleBox.js +0 -13
- package/components/TitleBox.js.map +0 -1
- package/components/Toast.js +0 -29
- package/components/Toast.js.map +0 -1
- package/components/ToastWrapper.js +0 -16
- package/components/ToastWrapper.js.map +0 -1
- package/components/UnloadEventHandler.js +0 -35
- package/components/UnloadEventHandler.js.map +0 -1
- package/components/UserNotifyHandle.js +0 -67
- package/components/UserNotifyHandle.js.map +0 -1
- package/components/icons/CheckIllustrationIcon.js +0 -7
- package/components/icons/CheckIllustrationIcon.js.map +0 -1
- package/components/icons/ConfirmIcon.js +0 -7
- package/components/icons/ConfirmIcon.js.map +0 -1
- package/components/icons/ErrorIcon.js +0 -7
- package/components/icons/ErrorIcon.js.map +0 -1
- package/components/icons/ErrorIconExclamation.js +0 -7
- package/components/icons/ErrorIconExclamation.js.map +0 -1
- package/components/icons/FaultIcon.js +0 -7
- package/components/icons/FaultIcon.js.map +0 -1
- package/components/icons/PagoPaIcon.js +0 -7
- package/components/icons/PagoPaIcon.js.map +0 -1
- package/components/icons/PagoPaIconColored.js +0 -7
- package/components/icons/PagoPaIconColored.js.map +0 -1
- package/components/icons/PagoPaMiniIcon.js +0 -7
- package/components/icons/PagoPaMiniIcon.js.map +0 -1
- package/config/env.js.map +0 -1
- package/consentManagementConfigure.js.map +0 -1
- package/decorators/__mocks__/withLogin.js +0 -27
- package/decorators/__mocks__/withLogin.js.map +0 -1
- package/decorators/withLogin.js.map +0 -1
- package/decorators/withRetrievedValue.js.map +0 -1
- package/hooks/useErrorDispatcher.js +0 -11
- package/hooks/useErrorDispatcher.js.map +0 -1
- package/hooks/useFakePagination.js.map +0 -1
- package/hooks/useLoading.js +0 -14
- package/hooks/useLoading.js.map +0 -1
- package/hooks/useLogin.js +0 -44
- package/hooks/useLogin.js.map +0 -1
- package/hooks/useReduxCachedValue.d.ts +0 -14
- package/hooks/useReduxCachedValue.js.map +0 -1
- package/hooks/useUnloadEventInterceptor.js.map +0 -1
- package/hooks/useUserNotify.js +0 -11
- package/hooks/useUserNotify.js.map +0 -1
- package/index.js +0 -76
- package/index.js.map +0 -1
- package/locale/de.js.map +0 -1
- package/locale/en.js.map +0 -1
- package/locale/fr.js.map +0 -1
- package/locale/it.js.map +0 -1
- package/locale/locale-utils.js +0 -36
- package/locale/locale-utils.js.map +0 -1
- package/locale/sl.js.map +0 -1
- package/model/AppError.js +0 -3
- package/model/AppError.js.map +0 -1
- package/model/Page.js +0 -3
- package/model/Page.js.map +0 -1
- package/model/PageRequest.js +0 -3
- package/model/PageRequest.js.map +0 -1
- package/model/PageResource.js +0 -3
- package/model/PageResource.js.map +0 -1
- package/model/User.d.ts +0 -7
- package/model/User.js +0 -3
- package/model/User.js.map +0 -1
- package/model/UserNotify.js +0 -3
- package/model/UserNotify.js.map +0 -1
- package/redux/slices/appStateSlice.d.ts +0 -76
- package/redux/slices/appStateSlice.js.map +0 -1
- package/redux/slices/userSlice.d.ts +0 -18
- package/redux/slices/userSlice.js +0 -21
- package/redux/slices/userSlice.js.map +0 -1
- package/services/analyticsService.js.map +0 -1
- package/services/assistanceService.js +0 -20
- package/services/assistanceService.js.map +0 -1
- package/services/errorService.js +0 -13
- package/services/errorService.js.map +0 -1
- package/utils/api-utils.js.map +0 -1
- package/utils/constants.d.ts +0 -19
- package/utils/constants.js +0 -32
- package/utils/constants.js.map +0 -1
- package/utils/routes-utils.js +0 -7
- package/utils/routes-utils.js.map +0 -1
- package/utils/storage-utils.js.map +0 -1
- package/utils/storage.js +0 -9
- package/utils/storage.js.map +0 -1
- package/utils/utils.d.ts +0 -3
- package/utils/utils.js +0 -13
- package/utils/utils.js.map +0 -1
- package/utils/verifyChecksumMatchWithTaxCode.js.map +0 -1
- package/utils/verifyNameMatchWithTaxCode.js +0 -26
- package/utils/verifyNameMatchWithTaxCode.js.map +0 -1
- package/utils/verifySurnameMatchWithTaxCode.js +0 -23
- package/utils/verifySurnameMatchWithTaxCode.js.map +0 -1
- /package/{consentManagementConfigure.d.ts → examples/locale/index.d.ts} +0 -0
- /package/{components → lib/components}/Footer/FooterConfig.d.ts +0 -0
- /package/{components → lib/components}/icons/ConfirmIcon.d.ts +0 -0
- /package/{components → lib/components}/icons/ErrorIconExclamation.d.ts +0 -0
- /package/{components → lib/components}/icons/FaultIcon.d.ts +0 -0
- /package/{hooks → lib/hooks}/useErrorDispatcher.d.ts +0 -0
- /package/{hooks → lib/hooks}/useLoading.d.ts +0 -0
- /package/{hooks → lib/hooks}/useLogin.d.ts +0 -0
- /package/{hooks → lib/hooks}/useUserNotify.d.ts +0 -0
- /package/{locale → lib/locale}/locale-utils.d.ts +0 -0
- /package/{services → lib/services}/errorService.d.ts +0 -0
- /package/{utils → lib/utils}/routes-utils.d.ts +0 -0
- /package/{utils → lib/utils}/verifyChecksumMatchWithTaxCode.d.ts +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
export declare type UserNotify = {
|
|
1
|
+
export type UserNotify = {
|
|
3
2
|
/** The identifier used to recognize the user notify: it cannot be possible to have the same error id at the same time */
|
|
4
3
|
id: string;
|
|
5
4
|
/** The title to show in the popup or toast */
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { AppError } from '../../model/AppError';
|
|
2
|
+
import { UserNotify } from '../../model/UserNotify';
|
|
3
|
+
export type { AppError } from '../../model/AppError';
|
|
4
|
+
interface AppStateState {
|
|
5
|
+
loading: {
|
|
6
|
+
result: boolean;
|
|
7
|
+
tasks: {
|
|
8
|
+
[taskId: string]: boolean;
|
|
9
|
+
};
|
|
10
|
+
};
|
|
11
|
+
errors: Array<AppError>;
|
|
12
|
+
userNotifies: Array<UserNotify>;
|
|
13
|
+
unloadEventConfiguration: {
|
|
14
|
+
enabled: boolean;
|
|
15
|
+
open: boolean;
|
|
16
|
+
title?: string;
|
|
17
|
+
description?: string;
|
|
18
|
+
exitAction?: () => void;
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
export declare const appStateActions: {
|
|
22
|
+
setLoading: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
23
|
+
task: string;
|
|
24
|
+
loading: boolean;
|
|
25
|
+
}, "appState/setLoading">;
|
|
26
|
+
addError: import("@reduxjs/toolkit").ActionCreatorWithPayload<AppError, "appState/addError">;
|
|
27
|
+
removeError: import("@reduxjs/toolkit").ActionCreatorWithPayload<AppError, "appState/removeError">;
|
|
28
|
+
addNotify: import("@reduxjs/toolkit").ActionCreatorWithPayload<UserNotify, "appState/addNotify">;
|
|
29
|
+
removeNotify: import("@reduxjs/toolkit").ActionCreatorWithPayload<UserNotify, "appState/removeNotify">;
|
|
30
|
+
enableUnloadEventInterceptor: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
31
|
+
title?: string;
|
|
32
|
+
description?: string;
|
|
33
|
+
}, "appState/enableUnloadEventInterceptor">;
|
|
34
|
+
disableUnloadEventInterceptor: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"appState/disableUnloadEventInterceptor">;
|
|
35
|
+
openUnloadEventNotify: import("@reduxjs/toolkit").ActionCreatorWithPayload<() => void, "appState/openUnloadEventNotify">;
|
|
36
|
+
closeUnloadEventNotify: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"appState/closeUnloadEventNotify">;
|
|
37
|
+
};
|
|
38
|
+
export declare const appStateReducer: import("redux").Reducer<AppStateState>;
|
|
39
|
+
export declare const appStateSelectors: {
|
|
40
|
+
selectLoading: (state: {
|
|
41
|
+
appState: AppStateState;
|
|
42
|
+
}) => boolean;
|
|
43
|
+
selectErrors: (state: {
|
|
44
|
+
appState: AppStateState;
|
|
45
|
+
}) => AppError[];
|
|
46
|
+
selectNotifies: (state: {
|
|
47
|
+
appState: AppStateState;
|
|
48
|
+
}) => UserNotify[];
|
|
49
|
+
selectUnloadEventConfiguration: (state: {
|
|
50
|
+
appState: AppStateState;
|
|
51
|
+
}) => {
|
|
52
|
+
enabled: boolean;
|
|
53
|
+
open: boolean;
|
|
54
|
+
title?: string;
|
|
55
|
+
description?: string;
|
|
56
|
+
exitAction?: () => void;
|
|
57
|
+
};
|
|
58
|
+
};
|
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.appStateSelectors = exports.appStateReducer = exports.appStateActions = exports.appStateSlice = void 0;
|
|
4
|
-
const toolkit_1 = require("@reduxjs/toolkit");
|
|
1
|
+
import { createSlice } from '@reduxjs/toolkit';
|
|
5
2
|
const initialState = {
|
|
6
3
|
loading: {
|
|
7
4
|
result: false,
|
|
@@ -23,7 +20,7 @@ const keepOnPage = (e) => {
|
|
|
23
20
|
return message;
|
|
24
21
|
};
|
|
25
22
|
/* eslint-disable functional/immutable-data */
|
|
26
|
-
|
|
23
|
+
const appStateSlice = createSlice({
|
|
27
24
|
name: 'appState',
|
|
28
25
|
initialState,
|
|
29
26
|
reducers: {
|
|
@@ -101,12 +98,21 @@ exports.appStateSlice = (0, toolkit_1.createSlice)({
|
|
|
101
98
|
},
|
|
102
99
|
},
|
|
103
100
|
});
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
101
|
+
export const appStateActions = {
|
|
102
|
+
setLoading: appStateSlice.actions.setLoading,
|
|
103
|
+
addError: appStateSlice.actions.addError,
|
|
104
|
+
removeError: appStateSlice.actions.removeError,
|
|
105
|
+
addNotify: appStateSlice.actions.addNotify,
|
|
106
|
+
removeNotify: appStateSlice.actions.removeNotify,
|
|
107
|
+
enableUnloadEventInterceptor: appStateSlice.actions.enableUnloadEventInterceptor,
|
|
108
|
+
disableUnloadEventInterceptor: appStateSlice.actions.disableUnloadEventInterceptor,
|
|
109
|
+
openUnloadEventNotify: appStateSlice.actions.openUnloadEventNotify,
|
|
110
|
+
closeUnloadEventNotify: appStateSlice.actions.closeUnloadEventNotify,
|
|
111
|
+
};
|
|
112
|
+
export const appStateReducer = appStateSlice.reducer;
|
|
113
|
+
export const appStateSelectors = {
|
|
107
114
|
selectLoading: (state) => state.appState.loading.result,
|
|
108
115
|
selectErrors: (state) => state.appState.errors,
|
|
109
116
|
selectNotifies: (state) => state.appState.userNotifies,
|
|
110
117
|
selectUnloadEventConfiguration: (state) => state.appState.unloadEventConfiguration,
|
|
111
118
|
};
|
|
112
|
-
//# sourceMappingURL=appStateSlice.js.map
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export interface ProductPermissions {
|
|
2
|
+
productId: string;
|
|
3
|
+
actions: Array<string>;
|
|
4
|
+
}
|
|
5
|
+
export interface PermissionsState {
|
|
6
|
+
productPermissions: Array<ProductPermissions>;
|
|
7
|
+
}
|
|
8
|
+
export declare const setProductPermissions: import("@reduxjs/toolkit").ActionCreatorWithPayload<ProductPermissions[], "permissions/setProductPermissions">, resetPermissions: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"permissions/resetPermissions">;
|
|
9
|
+
export declare const permissionsReducer: import("redux").Reducer<PermissionsState>;
|
|
10
|
+
export declare const selectProductPermissions: (state: {
|
|
11
|
+
permissions: PermissionsState;
|
|
12
|
+
}) => ProductPermissions[];
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { createSlice } from '@reduxjs/toolkit';
|
|
2
|
+
const initialState = {
|
|
3
|
+
productPermissions: [],
|
|
4
|
+
};
|
|
5
|
+
const permissionsSlice = createSlice({
|
|
6
|
+
name: 'permissions',
|
|
7
|
+
initialState,
|
|
8
|
+
reducers: {
|
|
9
|
+
setProductPermissions: (state, action) => ({
|
|
10
|
+
...state,
|
|
11
|
+
productPermissions: action.payload,
|
|
12
|
+
}),
|
|
13
|
+
resetPermissions: (state) => ({
|
|
14
|
+
...state,
|
|
15
|
+
productPermissions: [],
|
|
16
|
+
}),
|
|
17
|
+
},
|
|
18
|
+
});
|
|
19
|
+
// Actions
|
|
20
|
+
export const { setProductPermissions, resetPermissions } = permissionsSlice.actions;
|
|
21
|
+
export const permissionsReducer = permissionsSlice.reducer;
|
|
22
|
+
// Selectors
|
|
23
|
+
export const selectProductPermissions = (state) => state.permissions.productPermissions;
|
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
import { PayloadAction } from '@reduxjs/toolkit';
|
|
2
|
+
export declare enum StatusEnum {
|
|
3
|
+
'ACTIVE' = "ACTIVE",
|
|
4
|
+
'TESTING' = "TESTING",
|
|
5
|
+
'PHASE_OUT' = "PHASE_OUT",
|
|
6
|
+
'INACTIVE' = "INACTIVE"
|
|
7
|
+
}
|
|
8
|
+
export interface SubProductResource {
|
|
9
|
+
/** Product's unique identifier */
|
|
10
|
+
id: string;
|
|
11
|
+
/** Product's title */
|
|
12
|
+
title: string;
|
|
13
|
+
/** Product's onBoarding status */
|
|
14
|
+
productOnBoardingStatus: 'ACTIVE' | 'PENDING' | 'INACTIVE';
|
|
15
|
+
/** Product's status */
|
|
16
|
+
status: StatusEnum;
|
|
17
|
+
/** If a product is delegable to a technical partner */
|
|
18
|
+
delegable: boolean;
|
|
19
|
+
/** Product's depict image */
|
|
20
|
+
imageUrl: string;
|
|
21
|
+
/** Product's logo */
|
|
22
|
+
logo: string;
|
|
23
|
+
/** Product logo's background color */
|
|
24
|
+
logoBgColor: string;
|
|
25
|
+
/** Product's description */
|
|
26
|
+
description: string;
|
|
27
|
+
/** URL that redirects to the public information webpage of the product */
|
|
28
|
+
urlPublic: string;
|
|
29
|
+
/** If a product is invoiceable */
|
|
30
|
+
invoiceable: boolean;
|
|
31
|
+
}
|
|
32
|
+
export interface Product {
|
|
33
|
+
description: string;
|
|
34
|
+
id: string;
|
|
35
|
+
logo: string;
|
|
36
|
+
title: string;
|
|
37
|
+
urlBO: string;
|
|
38
|
+
backOfficeEnvironmentConfigurations?: Array<{
|
|
39
|
+
environment?: string;
|
|
40
|
+
url?: string;
|
|
41
|
+
}>;
|
|
42
|
+
urlPublic?: string;
|
|
43
|
+
tag?: string;
|
|
44
|
+
status: StatusEnum;
|
|
45
|
+
imageUrl: string;
|
|
46
|
+
subProducts?: Array<SubProductResource>;
|
|
47
|
+
logoBgColor?: string;
|
|
48
|
+
delegable: boolean;
|
|
49
|
+
invoiceable?: boolean;
|
|
50
|
+
}
|
|
51
|
+
export declare const InitialState: never[];
|
|
52
|
+
export declare const productsSlice: import("@reduxjs/toolkit").Slice<Product[], {
|
|
53
|
+
setProducts: (state: {
|
|
54
|
+
description: string;
|
|
55
|
+
id: string;
|
|
56
|
+
logo: string;
|
|
57
|
+
title: string;
|
|
58
|
+
urlBO: string;
|
|
59
|
+
backOfficeEnvironmentConfigurations?: {
|
|
60
|
+
environment?: string | undefined;
|
|
61
|
+
url?: string | undefined;
|
|
62
|
+
}[] | undefined;
|
|
63
|
+
urlPublic?: string | undefined;
|
|
64
|
+
tag?: string | undefined;
|
|
65
|
+
status: StatusEnum;
|
|
66
|
+
imageUrl: string;
|
|
67
|
+
subProducts?: {
|
|
68
|
+
id: string;
|
|
69
|
+
title: string;
|
|
70
|
+
productOnBoardingStatus: "ACTIVE" | "PENDING" | "INACTIVE";
|
|
71
|
+
status: StatusEnum;
|
|
72
|
+
delegable: boolean;
|
|
73
|
+
imageUrl: string;
|
|
74
|
+
logo: string;
|
|
75
|
+
logoBgColor: string;
|
|
76
|
+
description: string;
|
|
77
|
+
urlPublic: string;
|
|
78
|
+
invoiceable: boolean;
|
|
79
|
+
}[] | undefined;
|
|
80
|
+
logoBgColor?: string | undefined;
|
|
81
|
+
delegable: boolean;
|
|
82
|
+
invoiceable?: boolean | undefined;
|
|
83
|
+
}[], action: PayloadAction<Array<Product>>) => {
|
|
84
|
+
[x: number]: Product | {
|
|
85
|
+
description: string;
|
|
86
|
+
id: string;
|
|
87
|
+
logo: string;
|
|
88
|
+
title: string;
|
|
89
|
+
urlBO: string;
|
|
90
|
+
backOfficeEnvironmentConfigurations?: {
|
|
91
|
+
environment?: string | undefined;
|
|
92
|
+
url?: string | undefined;
|
|
93
|
+
}[] | undefined;
|
|
94
|
+
urlPublic?: string | undefined;
|
|
95
|
+
tag?: string | undefined;
|
|
96
|
+
status: StatusEnum;
|
|
97
|
+
imageUrl: string;
|
|
98
|
+
subProducts?: {
|
|
99
|
+
id: string;
|
|
100
|
+
title: string;
|
|
101
|
+
productOnBoardingStatus: "ACTIVE" | "PENDING" | "INACTIVE";
|
|
102
|
+
status: StatusEnum;
|
|
103
|
+
delegable: boolean;
|
|
104
|
+
imageUrl: string;
|
|
105
|
+
logo: string;
|
|
106
|
+
logoBgColor: string;
|
|
107
|
+
description: string;
|
|
108
|
+
urlPublic: string;
|
|
109
|
+
invoiceable: boolean;
|
|
110
|
+
}[] | undefined;
|
|
111
|
+
logoBgColor?: string | undefined;
|
|
112
|
+
delegable: boolean;
|
|
113
|
+
invoiceable?: boolean | undefined;
|
|
114
|
+
};
|
|
115
|
+
length: number;
|
|
116
|
+
toString(): string;
|
|
117
|
+
toLocaleString(): string;
|
|
118
|
+
toLocaleString(locales: string | string[], options?: Intl.NumberFormatOptions & Intl.DateTimeFormatOptions): string;
|
|
119
|
+
pop(): Product | undefined;
|
|
120
|
+
push(...items: Product[]): number;
|
|
121
|
+
concat(...items: ConcatArray<Product>[]): Product[];
|
|
122
|
+
concat(...items: (Product | ConcatArray<Product>)[]): Product[];
|
|
123
|
+
join(separator?: string): string;
|
|
124
|
+
reverse(): Product[];
|
|
125
|
+
shift(): Product | undefined;
|
|
126
|
+
slice(start?: number, end?: number): Product[];
|
|
127
|
+
sort(compareFn?: ((a: Product, b: Product) => number) | undefined): Product[];
|
|
128
|
+
splice(start: number, deleteCount?: number): Product[];
|
|
129
|
+
splice(start: number, deleteCount: number, ...items: Product[]): Product[];
|
|
130
|
+
unshift(...items: Product[]): number;
|
|
131
|
+
indexOf(searchElement: Product, fromIndex?: number): number;
|
|
132
|
+
lastIndexOf(searchElement: Product, fromIndex?: number): number;
|
|
133
|
+
every<S extends Product>(predicate: (value: Product, index: number, array: Product[]) => value is S, thisArg?: any): this is S[];
|
|
134
|
+
every(predicate: (value: Product, index: number, array: Product[]) => unknown, thisArg?: any): boolean;
|
|
135
|
+
some(predicate: (value: Product, index: number, array: Product[]) => unknown, thisArg?: any): boolean;
|
|
136
|
+
forEach(callbackfn: (value: Product, index: number, array: Product[]) => void, thisArg?: any): void;
|
|
137
|
+
map<U>(callbackfn: (value: Product, index: number, array: Product[]) => U, thisArg?: any): U[];
|
|
138
|
+
filter<S extends Product>(predicate: (value: Product, index: number, array: Product[]) => value is S, thisArg?: any): S[];
|
|
139
|
+
filter(predicate: (value: Product, index: number, array: Product[]) => unknown, thisArg?: any): Product[];
|
|
140
|
+
reduce(callbackfn: (previousValue: Product, currentValue: Product, currentIndex: number, array: Product[]) => Product): Product;
|
|
141
|
+
reduce(callbackfn: (previousValue: Product, currentValue: Product, currentIndex: number, array: Product[]) => Product, initialValue: Product): Product;
|
|
142
|
+
reduce<U>(callbackfn: (previousValue: U, currentValue: Product, currentIndex: number, array: Product[]) => U, initialValue: U): U;
|
|
143
|
+
reduceRight(callbackfn: (previousValue: Product, currentValue: Product, currentIndex: number, array: Product[]) => Product): Product;
|
|
144
|
+
reduceRight(callbackfn: (previousValue: Product, currentValue: Product, currentIndex: number, array: Product[]) => Product, initialValue: Product): Product;
|
|
145
|
+
reduceRight<U>(callbackfn: (previousValue: U, currentValue: Product, currentIndex: number, array: Product[]) => U, initialValue: U): U;
|
|
146
|
+
find<S extends Product>(predicate: (value: Product, index: number, obj: Product[]) => value is S, thisArg?: any): S | undefined;
|
|
147
|
+
find(predicate: (value: Product, index: number, obj: Product[]) => unknown, thisArg?: any): Product | undefined;
|
|
148
|
+
findIndex(predicate: (value: Product, index: number, obj: Product[]) => unknown, thisArg?: any): number;
|
|
149
|
+
fill(value: Product, start?: number, end?: number): Product[];
|
|
150
|
+
copyWithin(target: number, start: number, end?: number): Product[];
|
|
151
|
+
entries(): ArrayIterator<[number, Product]>;
|
|
152
|
+
keys(): ArrayIterator<number>;
|
|
153
|
+
values(): ArrayIterator<Product>;
|
|
154
|
+
includes(searchElement: Product, fromIndex?: number): boolean;
|
|
155
|
+
flatMap<U, This = undefined>(callback: (this: This, value: Product, index: number, array: Product[]) => U | readonly U[], thisArg?: This | undefined): U[];
|
|
156
|
+
flat<A, D extends number = 1>(this: A, depth?: D | undefined): FlatArray<A, D>[];
|
|
157
|
+
[Symbol.iterator](): ArrayIterator<Product>;
|
|
158
|
+
[Symbol.unscopables]: {
|
|
159
|
+
[x: number]: boolean | undefined;
|
|
160
|
+
length?: boolean | undefined;
|
|
161
|
+
toString?: boolean | undefined;
|
|
162
|
+
toLocaleString?: boolean | undefined;
|
|
163
|
+
pop?: boolean | undefined;
|
|
164
|
+
push?: boolean | undefined;
|
|
165
|
+
concat?: boolean | undefined;
|
|
166
|
+
join?: boolean | undefined;
|
|
167
|
+
reverse?: boolean | undefined;
|
|
168
|
+
shift?: boolean | undefined;
|
|
169
|
+
slice?: boolean | undefined;
|
|
170
|
+
sort?: boolean | undefined;
|
|
171
|
+
splice?: boolean | undefined;
|
|
172
|
+
unshift?: boolean | undefined;
|
|
173
|
+
indexOf?: boolean | undefined;
|
|
174
|
+
lastIndexOf?: boolean | undefined;
|
|
175
|
+
every?: boolean | undefined;
|
|
176
|
+
some?: boolean | undefined;
|
|
177
|
+
forEach?: boolean | undefined;
|
|
178
|
+
map?: boolean | undefined;
|
|
179
|
+
filter?: boolean | undefined;
|
|
180
|
+
reduce?: boolean | undefined;
|
|
181
|
+
reduceRight?: boolean | undefined;
|
|
182
|
+
find?: boolean | undefined;
|
|
183
|
+
findIndex?: boolean | undefined;
|
|
184
|
+
fill?: boolean | undefined;
|
|
185
|
+
copyWithin?: boolean | undefined;
|
|
186
|
+
entries?: boolean | undefined;
|
|
187
|
+
keys?: boolean | undefined;
|
|
188
|
+
values?: boolean | undefined;
|
|
189
|
+
includes?: boolean | undefined;
|
|
190
|
+
flatMap?: boolean | undefined;
|
|
191
|
+
flat?: boolean | undefined;
|
|
192
|
+
[Symbol.iterator]?: boolean | undefined;
|
|
193
|
+
readonly [Symbol.unscopables]?: boolean | undefined;
|
|
194
|
+
at?: boolean | undefined;
|
|
195
|
+
};
|
|
196
|
+
at(index: number): Product | undefined;
|
|
197
|
+
};
|
|
198
|
+
resetProducts: () => never[];
|
|
199
|
+
}, "products", "products", import("@reduxjs/toolkit").SliceSelectors<Product[]>>;
|
|
200
|
+
export declare const setProducts: import("@reduxjs/toolkit").ActionCreatorWithPayload<Product[], "products/setProducts">, resetProducts: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"products/resetProducts">;
|
|
201
|
+
export declare const productsReducer: import("redux").Reducer<Product[]>;
|
|
202
|
+
export declare const selectProducts: (state: {
|
|
203
|
+
products: Array<Product>;
|
|
204
|
+
}) => Product[];
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/* eslint-disable functional/immutable-data */
|
|
2
|
+
import { createSlice } from '@reduxjs/toolkit';
|
|
3
|
+
export var StatusEnum;
|
|
4
|
+
(function (StatusEnum) {
|
|
5
|
+
StatusEnum["ACTIVE"] = "ACTIVE";
|
|
6
|
+
StatusEnum["TESTING"] = "TESTING";
|
|
7
|
+
StatusEnum["PHASE_OUT"] = "PHASE_OUT";
|
|
8
|
+
StatusEnum["INACTIVE"] = "INACTIVE";
|
|
9
|
+
})(StatusEnum || (StatusEnum = {}));
|
|
10
|
+
export const InitialState = [];
|
|
11
|
+
export const productsSlice = createSlice({
|
|
12
|
+
name: 'products',
|
|
13
|
+
initialState: InitialState,
|
|
14
|
+
reducers: {
|
|
15
|
+
setProducts: (state, action) => ({
|
|
16
|
+
...state,
|
|
17
|
+
...action.payload,
|
|
18
|
+
}),
|
|
19
|
+
resetProducts: () => InitialState,
|
|
20
|
+
},
|
|
21
|
+
});
|
|
22
|
+
// Actions
|
|
23
|
+
export const { setProducts, resetProducts } = productsSlice.actions;
|
|
24
|
+
export const productsReducer = productsSlice.reducer;
|
|
25
|
+
// Selectors
|
|
26
|
+
export const selectProducts = (state) => state.products;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { PayloadAction } from '@reduxjs/toolkit';
|
|
2
|
+
import { User } from '../../model/User';
|
|
3
|
+
interface UserState {
|
|
4
|
+
logged?: User;
|
|
5
|
+
}
|
|
6
|
+
export declare const userSlice: import("@reduxjs/toolkit").Slice<UserState, {
|
|
7
|
+
setLoggedUser: (state: {
|
|
8
|
+
logged?: {
|
|
9
|
+
uid: string;
|
|
10
|
+
taxCode?: string | undefined;
|
|
11
|
+
name?: string | undefined;
|
|
12
|
+
surname?: string | undefined;
|
|
13
|
+
email?: string | undefined;
|
|
14
|
+
iss?: string | undefined;
|
|
15
|
+
} | undefined;
|
|
16
|
+
}, action: PayloadAction<User>) => void;
|
|
17
|
+
}, "user", "user", import("@reduxjs/toolkit").SliceSelectors<UserState>>;
|
|
18
|
+
export declare const userActions: import("@reduxjs/toolkit").CaseReducerActions<{
|
|
19
|
+
setLoggedUser: (state: {
|
|
20
|
+
logged?: {
|
|
21
|
+
uid: string;
|
|
22
|
+
taxCode?: string | undefined;
|
|
23
|
+
name?: string | undefined;
|
|
24
|
+
surname?: string | undefined;
|
|
25
|
+
email?: string | undefined;
|
|
26
|
+
iss?: string | undefined;
|
|
27
|
+
} | undefined;
|
|
28
|
+
}, action: PayloadAction<User>) => void;
|
|
29
|
+
}, "user">;
|
|
30
|
+
export declare const userReducer: import("redux").Reducer<UserState>;
|
|
31
|
+
export declare const userSelectors: {
|
|
32
|
+
selectLoggedUser: (state: {
|
|
33
|
+
user: UserState;
|
|
34
|
+
}) => User | undefined;
|
|
35
|
+
};
|
|
36
|
+
export {};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { createSlice } from '@reduxjs/toolkit';
|
|
2
|
+
const initialState = {};
|
|
3
|
+
/* eslint-disable functional/immutable-data */
|
|
4
|
+
export const userSlice = createSlice({
|
|
5
|
+
name: 'user',
|
|
6
|
+
initialState,
|
|
7
|
+
reducers: {
|
|
8
|
+
setLoggedUser: (state, action) => {
|
|
9
|
+
state.logged = action.payload;
|
|
10
|
+
},
|
|
11
|
+
},
|
|
12
|
+
});
|
|
13
|
+
export const userActions = userSlice.actions;
|
|
14
|
+
export const userReducer = userSlice.reducer;
|
|
15
|
+
export const userSelectors = {
|
|
16
|
+
selectLoggedUser: (state) => state.user.logged,
|
|
17
|
+
};
|
|
@@ -9,4 +9,5 @@ export declare const trackAppError: (error: AppError) => void;
|
|
|
9
9
|
* @property properties: the additional payload sent with the event
|
|
10
10
|
* @property callback: an action taken when the track has completed (If the action taken immediately after the track is an exit action from the application, it's better to use this callback to perform the exit, in order to give to mixPanel the time to send the event)
|
|
11
11
|
*/
|
|
12
|
-
export declare const trackEvent: (event_name: string, properties?: any, callback?: (
|
|
12
|
+
export declare const trackEvent: (event_name: string, properties?: any, callback?: () => void) => void;
|
|
13
|
+
export declare const registerSuperProperty: (properties: Record<string, any>) => void;
|
|
@@ -1,49 +1,43 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.trackEvent = exports.trackAppError = exports.initAnalytics = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const mixpanel_browser_1 = tslib_1.__importDefault(require("mixpanel-browser"));
|
|
6
|
-
const env_1 = require("../config/env");
|
|
1
|
+
import mixpanel from 'mixpanel-browser';
|
|
2
|
+
import { CONFIG } from '../config/env';
|
|
7
3
|
/** To call in order to start the analytics service, otherwise no event will be sent */
|
|
8
|
-
const initAnalytics = () => {
|
|
9
|
-
if (
|
|
4
|
+
export const initAnalytics = () => {
|
|
5
|
+
if (CONFIG.ANALYTCS.ENABLE) {
|
|
10
6
|
// eslint-disable-next-line functional/immutable-data
|
|
11
7
|
window.initMixPanel = true;
|
|
12
|
-
if (
|
|
8
|
+
if (CONFIG.ANALYTCS.MOCK) {
|
|
13
9
|
// eslint-disable-next-line no-console
|
|
14
10
|
console.log('Mixpanel events mock on console log.');
|
|
15
11
|
}
|
|
16
12
|
else {
|
|
17
|
-
|
|
18
|
-
api_host:
|
|
19
|
-
persistence:
|
|
20
|
-
ip:
|
|
21
|
-
property_blacklist:
|
|
22
|
-
debug:
|
|
13
|
+
mixpanel.init(CONFIG.ANALYTCS.TOKEN, {
|
|
14
|
+
api_host: CONFIG.ANALYTCS.API_HOST,
|
|
15
|
+
persistence: CONFIG.ANALYTCS.PERSISTENCE,
|
|
16
|
+
ip: CONFIG.ANALYTCS.LOG_IP,
|
|
17
|
+
property_blacklist: CONFIG.ANALYTCS.PROPERTY_BLACKLIST,
|
|
18
|
+
debug: CONFIG.ANALYTCS.DEBUG,
|
|
23
19
|
});
|
|
24
20
|
}
|
|
25
21
|
}
|
|
26
22
|
};
|
|
27
|
-
exports.initAnalytics = initAnalytics;
|
|
28
23
|
/** To notify an error through the analytics tool */
|
|
29
|
-
const trackAppError = (error) => {
|
|
30
|
-
if (
|
|
31
|
-
|
|
24
|
+
export const trackAppError = (error) => {
|
|
25
|
+
if (CONFIG.ANALYTCS.ENABLE && window.initMixPanel) {
|
|
26
|
+
trackEvent('GENERIC_ERROR', error);
|
|
32
27
|
}
|
|
33
28
|
else {
|
|
34
29
|
console.error(error);
|
|
35
30
|
}
|
|
36
31
|
};
|
|
37
|
-
exports.trackAppError = trackAppError;
|
|
38
32
|
/**
|
|
39
33
|
* To notify an event through the analytics tool:
|
|
40
34
|
* @property event_name: the name of the event
|
|
41
35
|
* @property properties: the additional payload sent with the event
|
|
42
36
|
* @property callback: an action taken when the track has completed (If the action taken immediately after the track is an exit action from the application, it's better to use this callback to perform the exit, in order to give to mixPanel the time to send the event)
|
|
43
37
|
*/
|
|
44
|
-
const trackEvent = (event_name, properties, callback) => {
|
|
45
|
-
if (
|
|
46
|
-
if (
|
|
38
|
+
export const trackEvent = (event_name, properties, callback) => {
|
|
39
|
+
if (CONFIG.ANALYTCS.ENABLE && window.initMixPanel) {
|
|
40
|
+
if (CONFIG.ANALYTCS.MOCK) {
|
|
47
41
|
// eslint-disable-next-line no-console
|
|
48
42
|
console.log(event_name, properties);
|
|
49
43
|
if (callback) {
|
|
@@ -60,7 +54,6 @@ const trackEvent = (event_name, properties, callback) => {
|
|
|
60
54
|
}
|
|
61
55
|
}
|
|
62
56
|
};
|
|
63
|
-
exports.trackEvent = trackEvent;
|
|
64
57
|
const trackEventThroughAnalyticTool = (event_name, properties, callback) => {
|
|
65
58
|
// eslint-disable-next-line functional/no-let
|
|
66
59
|
let called = false;
|
|
@@ -76,10 +69,10 @@ const trackEventThroughAnalyticTool = (event_name, properties, callback) => {
|
|
|
76
69
|
}
|
|
77
70
|
: undefined;
|
|
78
71
|
try {
|
|
79
|
-
|
|
80
|
-
...
|
|
72
|
+
mixpanel.track(event_name, {
|
|
73
|
+
...CONFIG.ANALYTCS.ADDITIONAL_PROPERTIES,
|
|
81
74
|
...properties,
|
|
82
|
-
...
|
|
75
|
+
...CONFIG.ANALYTCS.ADDITIONAL_PROPERTIES_IMPORTANT,
|
|
83
76
|
}, wrappedCallback ? { send_immediately: true } : undefined, wrappedCallback);
|
|
84
77
|
}
|
|
85
78
|
catch (reason) {
|
|
@@ -91,4 +84,14 @@ const trackEventThroughAnalyticTool = (event_name, properties, callback) => {
|
|
|
91
84
|
}
|
|
92
85
|
}
|
|
93
86
|
};
|
|
94
|
-
|
|
87
|
+
export const registerSuperProperty = (properties) => {
|
|
88
|
+
if (CONFIG.ANALYTCS.ENABLE && window.initMixPanel) {
|
|
89
|
+
if (CONFIG.ANALYTCS.MOCK) {
|
|
90
|
+
// eslint-disable-next-line no-console
|
|
91
|
+
console.log('registerSuperProperty', properties);
|
|
92
|
+
}
|
|
93
|
+
else {
|
|
94
|
+
mixpanel.register(properties);
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const buildAssistanceURI: (assistanceEmail?: string
|
|
1
|
+
export declare const buildAssistanceURI: (assistanceEmail?: string) => string;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import isEmpty from 'lodash/isEmpty';
|
|
2
|
+
import { CONFIG } from '../config/env';
|
|
3
|
+
import { storageUserOps } from '../utils/storage';
|
|
4
|
+
import { trackEvent } from './analyticsService';
|
|
5
|
+
export const buildAssistanceURI = (assistanceEmail) => {
|
|
6
|
+
const sessionStorageUser = storageUserOps.read();
|
|
7
|
+
if (isEmpty(sessionStorageUser)) {
|
|
8
|
+
trackEvent('CUSTOMER_CARE_MAILTO');
|
|
9
|
+
return `mailto:${assistanceEmail}`;
|
|
10
|
+
}
|
|
11
|
+
else {
|
|
12
|
+
return CONFIG.URL_FE.ASSISTANCE;
|
|
13
|
+
}
|
|
14
|
+
};
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { ApiRequestType, IResponseType, TypeofApiResponse } from '@pagopa/ts-commons/lib/requests';
|
|
2
|
-
import * as t from 'io-ts';
|
|
3
2
|
import { EnhancedStore } from '@reduxjs/toolkit';
|
|
3
|
+
import * as t from 'io-ts';
|
|
4
4
|
/** To show an error popup to inform of the not valid session */
|
|
5
5
|
export declare const onRedirectToLogin: (store: EnhancedStore) => {
|
|
6
6
|
payload: import("../model/AppError").AppError;
|
|
7
7
|
type: "appState/addError";
|
|
8
8
|
};
|
|
9
9
|
/** Return the implementation of fetch configured with a timeout */
|
|
10
|
-
export declare const buildFetchApi: (timeoutMs?: number) => (input: RequestInfo | URL, init?: RequestInit | undefined) => Promise<Response
|
|
10
|
+
export declare const buildFetchApi: (timeoutMs?: number) => ((input: RequestInfo | URL, init?: RequestInit | undefined) => Promise<Response>);
|
|
11
11
|
/** Extract the response of a @pagopa/openapi-codegen-ts generated client rest invocation having status code successHttpStatus.
|
|
12
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
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
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
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
|
|
16
|
+
export declare const extractResponse: <R>(response: t.Validation<TypeofApiResponse<ApiRequestType<any, any, any, IResponseType<any, any, any>>>>, successHttpStatus: number | Array<number>, onRedirectToLogin: () => void, notValidTokenHttpStatus?: number | null, notAuthorizedTokenHttpStatus?: number | null, emptyResponseHttpStatus?: number | null) => Promise<R>;
|