@pagopa/selfcare-common-frontend 1.34.93 → 1.34.95
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 +17 -2
- package/build.info +2 -2
- package/examples/locale/en.js +1 -3
- package/examples/locale/en.js.map +1 -1
- package/examples/locale/index.js +4 -7
- package/examples/locale/index.js.map +1 -1
- package/examples/locale/it.js +1 -3
- package/examples/locale/it.js.map +1 -1
- package/lib/common-polyfill.d.ts +0 -1
- package/lib/common-polyfill.js +9 -12
- package/lib/common-polyfill.js.map +1 -1
- package/lib/components/BackComponent.js +7 -10
- package/lib/components/BackComponent.js.map +1 -1
- package/lib/components/CustomAlert.js +6 -9
- package/lib/components/CustomAlert.js.map +1 -1
- package/lib/components/CustomAvatar.js +5 -9
- package/lib/components/CustomAvatar.js.map +1 -1
- package/lib/components/CustomPagination.js +6 -10
- package/lib/components/CustomPagination.js.map +1 -1
- package/lib/components/EndingPage.js +3 -5
- package/lib/components/EndingPage.js.map +1 -1
- package/lib/components/ErrorBoundary/ErrorBoundary.d.ts +2 -2
- package/lib/components/ErrorBoundary/ErrorBoundary.js +25 -29
- package/lib/components/ErrorBoundary/ErrorBoundary.js.map +1 -1
- package/lib/components/ErrorBoundary/components/BlockingErrorPage.js +9 -12
- package/lib/components/ErrorBoundary/components/BlockingErrorPage.js.map +1 -1
- package/lib/components/FilterModal.js +16 -23
- package/lib/components/FilterModal.js.map +1 -1
- package/lib/components/Footer/Footer.js +35 -39
- package/lib/components/Footer/Footer.js.map +1 -1
- package/lib/components/Footer/FooterConfig.js +4 -7
- package/lib/components/Footer/FooterConfig.js.map +1 -1
- package/lib/components/Header/Header.d.ts +1 -1
- package/lib/components/Header/Header.js +16 -18
- package/lib/components/Header/Header.js.map +1 -1
- package/lib/components/Loading/LoadingOverlay.js +7 -11
- package/lib/components/Loading/LoadingOverlay.js.map +1 -1
- package/lib/components/LoadingOverlayComponent.js +9 -13
- package/lib/components/LoadingOverlayComponent.js.map +1 -1
- package/lib/components/NavigationBar.js +9 -13
- package/lib/components/NavigationBar.js.map +1 -1
- package/lib/components/SessionModal.d.ts +1 -1
- package/lib/components/SessionModal.js +12 -14
- package/lib/components/SessionModal.js.map +1 -1
- package/lib/components/TitleBox.js +5 -8
- package/lib/components/TitleBox.js.map +1 -1
- package/lib/components/Toast.js +10 -14
- package/lib/components/Toast.js.map +1 -1
- package/lib/components/ToastWrapper.js +5 -8
- package/lib/components/ToastWrapper.js.map +1 -1
- package/lib/components/UnloadEventHandler.js +13 -18
- package/lib/components/UnloadEventHandler.js.map +1 -1
- package/lib/components/UserNotifyHandle.js +18 -22
- package/lib/components/UserNotifyHandle.js.map +1 -1
- package/lib/components/icons/CheckIllustrationIcon.js +3 -6
- package/lib/components/icons/CheckIllustrationIcon.js.map +1 -1
- package/lib/components/icons/ConfirmIcon.js +4 -6
- package/lib/components/icons/ConfirmIcon.js.map +1 -1
- package/lib/components/icons/ErrorIcon.js +3 -6
- package/lib/components/icons/ErrorIcon.js.map +1 -1
- package/lib/components/icons/ErrorIconExclamation.js +4 -6
- package/lib/components/icons/ErrorIconExclamation.js.map +1 -1
- package/lib/components/icons/FaultIcon.js +4 -6
- package/lib/components/icons/FaultIcon.js.map +1 -1
- package/lib/components/icons/PagoPaIcon.js +3 -6
- package/lib/components/icons/PagoPaIcon.js.map +1 -1
- package/lib/components/icons/PagoPaIconColored.js +3 -6
- package/lib/components/icons/PagoPaIconColored.js.map +1 -1
- package/lib/components/icons/PagoPaMiniIcon.js +3 -6
- package/lib/components/icons/PagoPaMiniIcon.js.map +1 -1
- package/lib/components/tests/FilterModal.test.js +15 -18
- package/lib/components/tests/FilterModal.test.js.map +1 -1
- package/lib/config/env.d.ts +2 -2
- package/lib/config/env.js +9 -14
- package/lib/config/env.js.map +1 -1
- package/lib/consentManagementConfigure.js +5 -7
- package/lib/consentManagementConfigure.js.map +1 -1
- package/lib/decorators/__mocks__/withLogin.js +13 -17
- package/lib/decorators/__mocks__/withLogin.js.map +1 -1
- package/lib/decorators/withLogin.js +21 -26
- package/lib/decorators/withLogin.js.map +1 -1
- package/lib/decorators/withRetrievedValue.js +9 -13
- package/lib/decorators/withRetrievedValue.js.map +1 -1
- package/lib/hooks/useErrorDispatcher.js +5 -8
- package/lib/hooks/useErrorDispatcher.js.map +1 -1
- package/lib/hooks/useFakePagination.js +9 -14
- package/lib/hooks/useFakePagination.js.map +1 -1
- package/lib/hooks/useFocus.js +3 -7
- package/lib/hooks/useFocus.js.map +1 -1
- package/lib/hooks/useLiveAnnouncerWithRegion.js +5 -9
- package/lib/hooks/useLiveAnnouncerWithRegion.js.map +1 -1
- package/lib/hooks/useLoading.js +8 -11
- package/lib/hooks/useLoading.js.map +1 -1
- package/lib/hooks/useLogin.js +16 -21
- package/lib/hooks/useLogin.js.map +1 -1
- package/lib/hooks/usePermissions.js +6 -9
- package/lib/hooks/usePermissions.js.map +1 -1
- package/lib/hooks/useReduxCachedValue.js +10 -16
- package/lib/hooks/useReduxCachedValue.js.map +1 -1
- package/lib/hooks/useUnloadEventInterceptor.js +24 -31
- package/lib/hooks/useUnloadEventInterceptor.js.map +1 -1
- package/lib/hooks/useUserNotify.js +5 -8
- package/lib/hooks/useUserNotify.js.map +1 -1
- package/lib/index.js +36 -79
- package/lib/index.js.map +1 -1
- package/lib/locale/de.js +1 -3
- package/lib/locale/de.js.map +1 -1
- package/lib/locale/en.js +1 -3
- package/lib/locale/en.js.map +1 -1
- package/lib/locale/fr.js +1 -3
- package/lib/locale/fr.js.map +1 -1
- package/lib/locale/it.js +1 -3
- package/lib/locale/it.js.map +1 -1
- package/lib/locale/locale-utils.js +20 -25
- package/lib/locale/locale-utils.js.map +1 -1
- package/lib/locale/sl.js +1 -3
- package/lib/locale/sl.js.map +1 -1
- package/lib/model/AppError.js +1 -2
- package/lib/model/JwtUser.js +1 -2
- package/lib/model/Page.js +1 -2
- package/lib/model/PageRequest.js +1 -2
- package/lib/model/PageResource.js +1 -2
- package/lib/model/User.js +1 -2
- package/lib/model/UserNotify.js +1 -2
- package/lib/redux/slices/appStateSlice.d.ts +13 -31
- package/lib/redux/slices/appStateSlice.js +15 -8
- package/lib/redux/slices/appStateSlice.js.map +1 -1
- package/lib/redux/slices/permissionsSlice.js +5 -10
- package/lib/redux/slices/permissionsSlice.js.map +1 -1
- package/lib/redux/slices/userSlice.d.ts +20 -2
- package/lib/redux/slices/userSlice.js +5 -8
- package/lib/redux/slices/userSlice.js.map +1 -1
- package/lib/services/analyticsService.js +20 -27
- package/lib/services/analyticsService.js.map +1 -1
- package/lib/services/assistanceService.js +9 -14
- package/lib/services/assistanceService.js.map +1 -1
- package/lib/services/errorService.js +3 -7
- package/lib/services/errorService.js.map +1 -1
- package/lib/utils/api-utils.js +14 -20
- package/lib/utils/api-utils.js.map +1 -1
- package/lib/utils/constants.d.ts +6 -1
- package/lib/utils/constants.js +14 -12
- package/lib/utils/constants.js.map +1 -1
- package/lib/utils/productId2ProductTitle.js +1 -5
- package/lib/utils/productId2ProductTitle.js.map +1 -1
- package/lib/utils/routes-utils.js +1 -5
- package/lib/utils/routes-utils.js.map +1 -1
- package/lib/utils/storage-utils.js +4 -10
- package/lib/utils/storage-utils.js.map +1 -1
- package/lib/utils/storage.js +7 -13
- package/lib/utils/storage.js.map +1 -1
- package/lib/utils/utils.js +5 -10
- package/lib/utils/utils.js.map +1 -1
- package/lib/utils/verifyChecksumMatchWithTaxCode.js +1 -5
- package/lib/utils/verifyChecksumMatchWithTaxCode.js.map +1 -1
- package/lib/utils/verifyNameMatchWithTaxCode.js +15 -13
- package/lib/utils/verifyNameMatchWithTaxCode.js.map +1 -1
- package/lib/utils/verifySurnameMatchWithTaxCode.js +7 -12
- package/lib/utils/verifySurnameMatchWithTaxCode.js.map +1 -1
- package/package.json +21 -66
package/lib/config/env.js
CHANGED
|
@@ -1,25 +1,20 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.CONFIG = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const env = tslib_1.__importStar(require("env-var"));
|
|
6
|
-
exports.CONFIG = {
|
|
1
|
+
export const CONFIG = {
|
|
7
2
|
URL_FE: {
|
|
8
3
|
LOGIN_GOOGLE: '/auth/google',
|
|
9
4
|
LOGIN: '/auth/login',
|
|
10
5
|
LOGOUT: '/auth/logout',
|
|
11
6
|
LOGOUT_GOOGLE: '/auth/logout/google',
|
|
12
|
-
LOGIN_ADMIN_GOOGLE: env.
|
|
7
|
+
LOGIN_ADMIN_GOOGLE: import.meta.env.VITE_GOOGLE_LOGIN_URL || '',
|
|
13
8
|
ASSISTANCE: '/assistenza',
|
|
14
9
|
},
|
|
15
10
|
MOCKS: {
|
|
16
|
-
MOCK_USER: env.
|
|
11
|
+
MOCK_USER: import.meta.env.VITE_MOCK_USER === 'true',
|
|
17
12
|
},
|
|
18
13
|
ANALYTCS: {
|
|
19
|
-
ENABLE: env.
|
|
20
|
-
MOCK: env.
|
|
21
|
-
DEBUG: env.
|
|
22
|
-
TOKEN: env.
|
|
14
|
+
ENABLE: import.meta.env.VITE_ANALYTICS_ENABLE === 'true',
|
|
15
|
+
MOCK: import.meta.env.VITE_ANALYTICS_MOCK === 'true',
|
|
16
|
+
DEBUG: import.meta.env.VITE_ANALYTICS_DEBUG === 'true',
|
|
17
|
+
TOKEN: import.meta.env.VITE_MIXPANEL_TOKEN || '',
|
|
23
18
|
API_HOST: 'https://api-eu.mixpanel.com',
|
|
24
19
|
PERSISTENCE: 'localStorage',
|
|
25
20
|
LOG_IP: false,
|
|
@@ -36,8 +31,8 @@ exports.CONFIG = {
|
|
|
36
31
|
FOOTER: {
|
|
37
32
|
LINK: {
|
|
38
33
|
PAGOPALINK: 'https://www.pagopa.it/',
|
|
39
|
-
PRIVACYPOLICY: env.
|
|
40
|
-
TERMSANDCONDITIONS: env.
|
|
34
|
+
PRIVACYPOLICY: import.meta.env.VITE_URL_PRIVACY_DISCLAIMER || '',
|
|
35
|
+
TERMSANDCONDITIONS: import.meta.env.VITE_URL_TERMS_AND_CONDITIONS || '',
|
|
41
36
|
PROTECTIONOFPERSONALDATA: 'https://privacyportal-de.onetrust.com/webform/77f17844-04c3-4969-a11d-462ee77acbe1/9ab6533d-be4a-482e-929a-0d8d2ab29df8',
|
|
42
37
|
ABOUTUS: 'https://www.pagopa.it/it/societa/chi-siamo/',
|
|
43
38
|
MEDIA: 'https://www.pagopa.it/it/',
|
package/lib/config/env.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"env.js","sourceRoot":"","sources":["../../../src/lib/config/env.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"env.js","sourceRoot":"","sources":["../../../src/lib/config/env.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,MAAM,GAAG;IACpB,MAAM,EAAE;QACN,YAAY,EAAE,cAAc;QAC5B,KAAK,EAAE,aAAa;QACpB,MAAM,EAAE,cAAc;QACtB,aAAa,EAAE,qBAAqB;QACpC,kBAAkB,EAAG,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,qBAAgC,IAAI,EAAE;QAC3E,UAAU,EAAE,aAAa;KAC1B;IAED,KAAK,EAAE;QACL,SAAS,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,cAAc,KAAK,MAAM;KACrD;IAED,QAAQ,EAAE;QACR,MAAM,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,qBAAqB,KAAK,MAAM;QACxD,IAAI,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,mBAAmB,KAAK,MAAM;QACpD,KAAK,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,oBAAoB,KAAK,MAAM;QACtD,KAAK,EAAG,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,mBAA8B,IAAI,EAAE;QAC5D,QAAQ,EAAE,6BAA6B;QACvC,WAAW,EAAE,cAAc;QAC3B,MAAM,EAAE,KAAK;QACb,kBAAkB,EAAE,CAAC,cAAc,EAAE,mBAAmB,EAAE,WAAW,CAAC;QACtE,qBAAqB,EAAE,EAAE;QACzB,+BAA+B,EAAE,EAAE;KACpC;IAED,OAAO,EAAE;QACP,sBAAsB,EAAE,OAAO;KAChC;IAED,IAAI,EAAE;QACJ,GAAG,EAAE,+TAA+T;KACrU;IAED,MAAM,EAAE;QACN,IAAI,EAAE;YACJ,UAAU,EAAE,wBAAwB;YACpC,aAAa,EAAG,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,2BAAsC,IAAI,EAAE;YAC5E,kBAAkB,EAAG,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,6BAAwC,IAAI,EAAE;YACnF,wBAAwB,EACtB,yHAAyH;YAC3H,OAAO,EAAE,6CAA6C;YACtD,KAAK,EAAE,2BAA2B;YAClC,UAAU,EAAE,0CAA0C;YACtD,cAAc,EAAE,0CAA0C;YAC1D,mBAAmB,EACjB,yEAAyE;YAC3E,kBAAkB,EAAE,sDAAsD;YAC1E,gBAAgB,EAAE,yDAAyD;YAC3E,QAAQ,EACN,oFAAoF;YACtF,QAAQ,EAAE,0CAA0C;YACpD,OAAO,EAAE,4BAA4B;YACrC,SAAS,EAAE,sCAAsC;YACjD,MAAM,EAAE,+BAA+B;YACvC,aAAa,EAAE,oEAAoE;YACnF,eAAe;SAChB;KACF;IAED,MAAM,EAAE;QACN,IAAI,EAAE;YACJ,QAAQ,EAAE,wBAAwB;YAClC,UAAU,EAAE,YAAY;SACzB;KACF;CACF,CAAC"}
|
|
@@ -1,16 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
const env_1 = require("./config/env");
|
|
4
|
-
const analyticsService_1 = require("./services/analyticsService");
|
|
1
|
+
import { CONFIG } from './config/env';
|
|
2
|
+
import { initAnalytics } from './services/analyticsService';
|
|
5
3
|
// target cookies (Mixpanel)
|
|
6
|
-
const targCookiesGroup =
|
|
4
|
+
const targCookiesGroup = CONFIG.CONSENT.COOKIE_GROUP_ANALYTICS;
|
|
7
5
|
// OneTrust callback at first time
|
|
8
6
|
// eslint-disable-next-line functional/immutable-data
|
|
9
7
|
window.OptanonWrapper = function () {
|
|
10
8
|
OneTrust.OnConsentChanged(function () {
|
|
11
9
|
const activeGroups = OnetrustActiveGroups;
|
|
12
10
|
if (activeGroups.indexOf(targCookiesGroup) > -1) {
|
|
13
|
-
|
|
11
|
+
initAnalytics();
|
|
14
12
|
}
|
|
15
13
|
});
|
|
16
14
|
};
|
|
@@ -18,6 +16,6 @@ window.OptanonWrapper = function () {
|
|
|
18
16
|
const OTCookieValue = document.cookie.split('; ').find((row) => row.startsWith('OptanonConsent=')) || '';
|
|
19
17
|
const checkValue = `${targCookiesGroup}%3A1`;
|
|
20
18
|
if (OTCookieValue.indexOf(checkValue) > -1) {
|
|
21
|
-
|
|
19
|
+
initAnalytics();
|
|
22
20
|
}
|
|
23
21
|
//# sourceMappingURL=consentManagementConfigure.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"consentManagementConfigure.js","sourceRoot":"","sources":["../../src/lib/consentManagementConfigure.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"consentManagementConfigure.js","sourceRoot":"","sources":["../../src/lib/consentManagementConfigure.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACtC,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAM5D,4BAA4B;AAC5B,MAAM,gBAAgB,GAAG,MAAM,CAAC,OAAO,CAAC,sBAAsB,CAAC;AAE/D,kCAAkC;AAClC,qDAAqD;AACrD,MAAM,CAAC,cAAc,GAAG;IACtB,QAAQ,CAAC,gBAAgB,CAAC;QACxB,MAAM,YAAY,GAAG,oBAAoB,CAAC;QAC1C,IAAI,YAAY,CAAC,OAAO,CAAC,gBAAgB,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC;YAChD,aAAa,EAAE,CAAC;QAClB,CAAC;IACH,CAAC,CAAC,CAAC;AACL,CAAC,CAAC;AACF,0CAA0C;AAC1C,MAAM,aAAa,GACjB,QAAQ,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,UAAU,CAAC,iBAAiB,CAAC,CAAC,IAAI,EAAE,CAAC;AACrF,MAAM,UAAU,GAAG,GAAG,gBAAgB,MAAM,CAAC;AAC7C,IAAI,aAAa,CAAC,OAAO,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC;IAC3C,aAAa,EAAE,CAAC;AAClB,CAAC"}
|
|
@@ -1,23 +1,19 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
const
|
|
6
|
-
const react_redux_1 = require("react-redux");
|
|
7
|
-
const userSlice_1 = require("../../redux/slices/userSlice");
|
|
8
|
-
exports.mockedUser = {
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { useEffect } from 'react';
|
|
3
|
+
import { useDispatch, useSelector } from 'react-redux';
|
|
4
|
+
import { userActions, userSelectors } from '../../redux/slices/userSlice';
|
|
5
|
+
export const mockedUser = {
|
|
9
6
|
uid: 'UID',
|
|
10
7
|
};
|
|
11
|
-
const verifyMockExecution = (state) => {
|
|
12
|
-
expect(state.user.logged).toMatchObject(
|
|
8
|
+
export const verifyMockExecution = (state) => {
|
|
9
|
+
expect(state.user.logged).toMatchObject(mockedUser);
|
|
13
10
|
};
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
const
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
dispatch(userSlice_1.userActions.setLoggedUser(exports.mockedUser));
|
|
11
|
+
export default (WrappedComponent) => (props) => {
|
|
12
|
+
const dispatch = useDispatch();
|
|
13
|
+
const loggedUser = useSelector(userSelectors.selectLoggedUser);
|
|
14
|
+
useEffect(() => {
|
|
15
|
+
dispatch(userActions.setLoggedUser(mockedUser));
|
|
20
16
|
}, []);
|
|
21
|
-
return loggedUser ? (
|
|
17
|
+
return loggedUser ? _jsx(WrappedComponent, { ...props }) : _jsx(_Fragment, {});
|
|
22
18
|
};
|
|
23
19
|
//# sourceMappingURL=withLogin.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"withLogin.js","sourceRoot":"","sources":["../../../../src/lib/decorators/__mocks__/withLogin.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"withLogin.js","sourceRoot":"","sources":["../../../../src/lib/decorators/__mocks__/withLogin.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAClC,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAEvD,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAE1E,MAAM,CAAC,MAAM,UAAU,GAAS;IAC9B,GAAG,EAAE,KAAK;CACX,CAAC;AAEF,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,KAAU,EAAE,EAAE;IAChD,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,aAAa,CAAC,UAAU,CAAC,CAAC;AACtD,CAAC,CAAC;AAEF,eAAe,CAAC,gBAA0C,EAAE,EAAE,CAAC,CAAC,KAAU,EAAE,EAAE;IAC5E,MAAM,QAAQ,GAAG,WAAW,EAAE,CAAC;IAC/B,MAAM,UAAU,GAAG,WAAW,CAAC,aAAa,CAAC,gBAAgB,CAAC,CAAC;IAC/D,SAAS,CAAC,GAAG,EAAE;QACb,QAAQ,CAAC,WAAW,CAAC,aAAa,CAAC,UAAU,CAAC,CAAC,CAAC;IAClD,CAAC,EAAE,EAAE,CAAC,CAAC;IACP,OAAO,UAAU,CAAC,CAAC,CAAC,KAAC,gBAAgB,OAAK,KAAK,GAAI,CAAC,CAAC,CAAC,mBAAK,CAAC;AAC9D,CAAC,CAAC"}
|
|
@@ -1,46 +1,41 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
const useLogin_1 = require("../hooks/useLogin");
|
|
11
|
-
const userSlice_1 = require("../redux/slices/userSlice");
|
|
12
|
-
const constants_1 = require("../utils/constants");
|
|
13
|
-
const storage_1 = require("../utils/storage");
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { useEffect } from 'react';
|
|
3
|
+
import { useSelector } from 'react-redux';
|
|
4
|
+
import { CONFIG } from '../config/env';
|
|
5
|
+
import useLoading from '../hooks/useLoading';
|
|
6
|
+
import { useLogin } from '../hooks/useLogin';
|
|
7
|
+
import { userSelectors } from '../redux/slices/userSlice';
|
|
8
|
+
import { LOADING_TASK_LOGIN_CHECK } from '../utils/constants';
|
|
9
|
+
import { storageUserOps } from '../utils/storage';
|
|
14
10
|
/** This feature is based on react-redux library and require to register the reducer build in userSlice into the application's redux store.
|
|
15
11
|
This decorator has to be applied to components whose acces require an active session.
|
|
16
12
|
Accessing to the components decorated with it without a session will brought to the login page.
|
|
17
13
|
It's possible to modify the login path changing the value in CONFIG.login inside the index.tsx file */
|
|
18
|
-
function withLogin(WrappedComponent) {
|
|
14
|
+
export default function withLogin(WrappedComponent) {
|
|
19
15
|
const displayName = WrappedComponent.displayName || WrappedComponent.name || 'Component';
|
|
20
16
|
const ComponentWithLogin = (props) => {
|
|
21
|
-
|
|
22
|
-
const
|
|
23
|
-
const
|
|
24
|
-
const setLoading = (0, useLoading_1.default)(constants_1.LOADING_TASK_LOGIN_CHECK);
|
|
17
|
+
const user = useSelector(userSelectors.selectLoggedUser);
|
|
18
|
+
const { attemptSilentLogin } = useLogin();
|
|
19
|
+
const setLoading = useLoading(LOADING_TASK_LOGIN_CHECK);
|
|
25
20
|
const currentPath = window.location.pathname;
|
|
26
21
|
const currentHash = window.location.hash;
|
|
27
|
-
const isPagoPaUser =
|
|
28
|
-
|
|
22
|
+
const isPagoPaUser = storageUserOps.read()?.iss === 'PAGOPA';
|
|
23
|
+
useEffect(() => {
|
|
29
24
|
// eslint-disable-next-line no-console
|
|
30
25
|
console.log('Checking user login status...', { currentPath, currentHash });
|
|
31
26
|
if (currentPath.includes('/auth/login/success') &&
|
|
32
27
|
currentHash.includes('token=') &&
|
|
33
28
|
!isPagoPaUser) {
|
|
34
|
-
|
|
35
|
-
globalThis.location.assign(
|
|
29
|
+
storageUserOps.delete();
|
|
30
|
+
globalThis.location.assign(CONFIG.URL_FE.LOGOUT_GOOGLE);
|
|
36
31
|
return;
|
|
37
32
|
}
|
|
38
33
|
if (currentPath.includes('/auth/login') && !currentHash.includes('token=') && isPagoPaUser) {
|
|
39
|
-
|
|
40
|
-
globalThis.location.assign(
|
|
34
|
+
storageUserOps.delete();
|
|
35
|
+
globalThis.location.assign(CONFIG.URL_FE.LOGOUT);
|
|
41
36
|
}
|
|
42
37
|
}, [currentPath, currentHash, isPagoPaUser]);
|
|
43
|
-
|
|
38
|
+
useEffect(() => {
|
|
44
39
|
async function asyncAttemptSilentLogin() {
|
|
45
40
|
await attemptSilentLogin();
|
|
46
41
|
}
|
|
@@ -50,7 +45,7 @@ function withLogin(WrappedComponent) {
|
|
|
50
45
|
asyncAttemptSilentLogin().finally(() => setLoading(false));
|
|
51
46
|
}
|
|
52
47
|
}, []); // eslint-disable-line react-hooks/exhaustive-deps
|
|
53
|
-
return user ? (
|
|
48
|
+
return user ? _jsx(WrappedComponent, { ...props }) : _jsx(_Fragment, {});
|
|
54
49
|
};
|
|
55
50
|
// eslint-disable-next-line functional/immutable-data
|
|
56
51
|
ComponentWithLogin.displayName = `withLogin(${displayName})`;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"withLogin.js","sourceRoot":"","sources":["../../../src/lib/decorators/withLogin.tsx"],"names":[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
|
|
3
|
-
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
6
|
-
const react_1 = require("react");
|
|
7
|
-
const useErrorDispatcher_1 = tslib_1.__importDefault(require("../hooks/useErrorDispatcher"));
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { useEffect, useState } from 'react';
|
|
3
|
+
import useErrorDispatcher from '../hooks/useErrorDispatcher';
|
|
8
4
|
/** Decorator to retrieve a value and serve it once ready to the decorated component */
|
|
9
|
-
function withRetrievedValue(
|
|
5
|
+
export default function withRetrievedValue(
|
|
10
6
|
/** The name of the prop to which serve the value when available */
|
|
11
7
|
propEntityName,
|
|
12
8
|
/** A function that will return an other function to retrieve the expected value. This for allow the use of custom hook */
|
|
@@ -19,13 +15,13 @@ onError,
|
|
|
19
15
|
onLoading) {
|
|
20
16
|
const displayName = WrappedComponent.displayName || WrappedComponent.name || 'Component';
|
|
21
17
|
const ComponentWithParties = (props) => {
|
|
22
|
-
const [value, setValue] =
|
|
18
|
+
const [value, setValue] = useState();
|
|
23
19
|
const retrieverService = getRetrieverService();
|
|
24
|
-
const addError = (
|
|
20
|
+
const addError = useErrorDispatcher();
|
|
25
21
|
const doRetrieve = () => {
|
|
26
22
|
retrieverService()
|
|
27
23
|
.then((v) => setValue(v))
|
|
28
|
-
.catch((reason) => (onError
|
|
24
|
+
.catch((reason) => (onError ?? addError)({
|
|
29
25
|
id: `RETRIEVE_VALUE_${propEntityName}`,
|
|
30
26
|
blocking: false,
|
|
31
27
|
techDescription: `Something gone wrong while retrieving ${propEntityName}`,
|
|
@@ -34,12 +30,12 @@ onLoading) {
|
|
|
34
30
|
onRetry: doRetrieve,
|
|
35
31
|
}));
|
|
36
32
|
};
|
|
37
|
-
|
|
33
|
+
useEffect(() => {
|
|
38
34
|
if (!value) {
|
|
39
35
|
doRetrieve();
|
|
40
36
|
}
|
|
41
37
|
}, []);
|
|
42
|
-
return value !== undefined ? ((
|
|
38
|
+
return value !== undefined ? (_jsx(WrappedComponent, { ...props, [propEntityName]: value, reload: doRetrieve })) : (onLoading ?? _jsx(_Fragment, {}));
|
|
43
39
|
};
|
|
44
40
|
// eslint-disable-next-line functional/immutable-data
|
|
45
41
|
ComponentWithParties.displayName = `withRetrieve${propEntityName}(${displayName})`;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"withRetrievedValue.js","sourceRoot":"","sources":["../../../src/lib/decorators/withRetrievedValue.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"withRetrievedValue.js","sourceRoot":"","sources":["../../../src/lib/decorators/withRetrievedValue.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAa,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACvD,OAAO,kBAAkB,MAAM,6BAA6B,CAAC;AAG7D,uFAAuF;AACvF,MAAM,CAAC,OAAO,UAAU,kBAAkB;AAKxC,mEAAmE;AACnE,cAAyB;AACzB,2HAA2H;AAC3H,mBAAqD;AACrD,8BAA8B;AAC9B,gBAA4C;AAC5C,qFAAqF;AACrF,OAAsC;AACtC,sDAAsD;AACtD,SAAqB;IAErB,MAAM,WAAW,GAAG,gBAAgB,CAAC,WAAW,IAAI,gBAAgB,CAAC,IAAI,IAAI,WAAW,CAAC;IAEzF,MAAM,oBAAoB,GAAG,CAAC,KAAY,EAAE,EAAE;QAC5C,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,QAAQ,EAAe,CAAC;QAClD,MAAM,gBAAgB,GAAG,mBAAmB,EAAE,CAAC;QAE/C,MAAM,QAAQ,GAAG,kBAAkB,EAAE,CAAC;QAEtC,MAAM,UAAU,GAAG,GAAS,EAAE;YAC5B,gBAAgB,EAAE;iBACf,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;iBACxB,KAAK,CAAC,CAAC,MAAM,EAAE,EAAE,CAChB,CAAC,OAAO,IAAI,QAAQ,CAAC,CAAC;gBACpB,EAAE,EAAE,kBAAkB,cAAc,EAAE;gBACtC,QAAQ,EAAE,KAAK;gBACf,eAAe,EAAE,yCAAyC,cAAc,EAAE;gBAC1E,QAAQ,EAAE,IAAI;gBACd,KAAK,EAAE,MAAM;gBACb,OAAO,EAAE,UAAU;aACpB,CAAC,CACH,CAAC;QACN,CAAC,CAAC;QAEF,SAAS,CAAC,GAAG,EAAE;YACb,IAAI,CAAC,KAAK,EAAE,CAAC;gBACX,UAAU,EAAE,CAAC;YACf,CAAC;QACH,CAAC,EAAE,EAAE,CAAC,CAAC;QAEP,OAAO,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,CAC3B,KAAC,gBAAgB,OACV,KAAe,EACd,CAAC,cAAc,CAAC,EAAE,KAAK,EAC7B,MAAM,EAAE,UAAU,GAClB,CACH,CAAC,CAAC,CAAC,CACF,SAAS,IAAI,mBAAK,CACnB,CAAC;IACJ,CAAC,CAAC;IAEF,qDAAqD;IACrD,oBAAoB,CAAC,WAAW,GAAG,eAAe,cAAc,IAAI,WAAW,GAAG,CAAC;IAEnF,OAAO,oBAA8E,CAAC;AACxF,CAAC"}
|
|
@@ -1,11 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.default = default_1;
|
|
4
|
-
const react_redux_1 = require("react-redux");
|
|
5
|
-
const appStateSlice_1 = require("../redux/slices/appStateSlice");
|
|
1
|
+
import { useDispatch } from 'react-redux';
|
|
2
|
+
import { appStateActions } from '../redux/slices/appStateSlice';
|
|
6
3
|
/** @see {@link ErrorBoundary} */
|
|
7
|
-
function
|
|
8
|
-
const dispatch =
|
|
9
|
-
return (error) => dispatch(
|
|
4
|
+
export default function () {
|
|
5
|
+
const dispatch = useDispatch();
|
|
6
|
+
return (error) => dispatch(appStateActions.addError(error));
|
|
10
7
|
}
|
|
11
8
|
//# sourceMappingURL=useErrorDispatcher.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useErrorDispatcher.js","sourceRoot":"","sources":["../../../src/lib/hooks/useErrorDispatcher.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"useErrorDispatcher.js","sourceRoot":"","sources":["../../../src/lib/hooks/useErrorDispatcher.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAY,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAE1E,iCAAiC;AACjC,MAAM,CAAC,OAAO;IACZ,MAAM,QAAQ,GAAG,WAAW,EAAE,CAAC;IAC/B,OAAO,CAAC,KAAe,EAAE,EAAE,CAAC,QAAQ,CAAC,eAAe,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC;AACxE,CAAC"}
|
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.applySort = exports.extractPageRequest = void 0;
|
|
4
|
-
const react_1 = require("react");
|
|
1
|
+
import { useRef } from 'react';
|
|
5
2
|
const toPageResource = (content, page, size, totalElements) => ({
|
|
6
3
|
content,
|
|
7
4
|
page: {
|
|
@@ -11,14 +8,13 @@ const toPageResource = (content, page, size, totalElements) => ({
|
|
|
11
8
|
totalPages: size > 0 ? Math.ceil(totalElements / size) : 0,
|
|
12
9
|
},
|
|
13
10
|
});
|
|
14
|
-
const extractPageRequest = (data, pageRequest) => {
|
|
11
|
+
export const extractPageRequest = (data, pageRequest) => {
|
|
15
12
|
const firstIndex = pageRequest.page * pageRequest.size;
|
|
16
13
|
return toPageResource(firstIndex < data.length && pageRequest.size > 0
|
|
17
14
|
? data.slice(firstIndex, firstIndex + pageRequest.size)
|
|
18
15
|
: [], pageRequest.page, pageRequest.size, data.length);
|
|
19
16
|
};
|
|
20
|
-
|
|
21
|
-
const applySort = (data, sort) => {
|
|
17
|
+
export const applySort = (data, sort) => {
|
|
22
18
|
const sortConfiguration = sort.split(' ').map((order) => {
|
|
23
19
|
const [key, direction] = order.split(',');
|
|
24
20
|
return { key, asc: direction === 'asc' };
|
|
@@ -34,18 +30,17 @@ const applySort = (data, sort) => {
|
|
|
34
30
|
return 0;
|
|
35
31
|
});
|
|
36
32
|
};
|
|
37
|
-
exports.applySort = applySort;
|
|
38
33
|
/**
|
|
39
34
|
* Custom hook used to simulate paginated resources when the external service doesn't implement it, caching values when filter doesn't change and serving them a page at time.
|
|
40
35
|
* Cached values are stored using useRef, so they are local to the component using this hook.
|
|
41
36
|
* The sorting actually is applied using string representation
|
|
42
37
|
*/
|
|
43
38
|
const useFakePagination = (fetch) => {
|
|
44
|
-
const cachedData =
|
|
45
|
-
const cachedDataSort =
|
|
39
|
+
const cachedData = useRef();
|
|
40
|
+
const cachedDataSort = useRef();
|
|
46
41
|
const checkAndApplySort = (sort) => {
|
|
47
42
|
if (sort && cachedDataSort.current !== sort) {
|
|
48
|
-
|
|
43
|
+
applySort(cachedData.current, sort);
|
|
49
44
|
// eslint-disable-next-line functional/immutable-data
|
|
50
45
|
cachedDataSort.current = sort;
|
|
51
46
|
}
|
|
@@ -53,17 +48,17 @@ const useFakePagination = (fetch) => {
|
|
|
53
48
|
return (pageRequest, filterChanged) => {
|
|
54
49
|
if (!filterChanged && cachedData.current) {
|
|
55
50
|
checkAndApplySort(pageRequest.sort);
|
|
56
|
-
return new Promise((resolve) => setTimeout(() => resolve(
|
|
51
|
+
return new Promise((resolve) => setTimeout(() => resolve(extractPageRequest(cachedData.current, pageRequest)), 100));
|
|
57
52
|
}
|
|
58
53
|
else {
|
|
59
54
|
return fetch().then((results) => {
|
|
60
55
|
// eslint-disable-next-line functional/immutable-data
|
|
61
56
|
cachedData.current = results;
|
|
62
57
|
checkAndApplySort(pageRequest.sort);
|
|
63
|
-
return
|
|
58
|
+
return extractPageRequest(cachedData.current, pageRequest);
|
|
64
59
|
});
|
|
65
60
|
}
|
|
66
61
|
};
|
|
67
62
|
};
|
|
68
|
-
|
|
63
|
+
export default useFakePagination;
|
|
69
64
|
//# sourceMappingURL=useFakePagination.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useFakePagination.js","sourceRoot":"","sources":["../../../src/lib/hooks/useFakePagination.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"useFakePagination.js","sourceRoot":"","sources":["../../../src/lib/hooks/useFakePagination.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAI/B,MAAM,cAAc,GAAG,CACrB,OAAiB,EACjB,IAAY,EACZ,IAAY,EACZ,aAAqB,EACJ,EAAE,CAAC,CAAC;IACrB,OAAO;IACP,IAAI,EAAE;QACJ,MAAM,EAAE,IAAI;QACZ,IAAI;QACJ,aAAa;QACb,UAAU,EAAE,IAAI,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;KAC3D;CACF,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAChC,IAAc,EACd,WAAwB,EACP,EAAE;IACnB,MAAM,UAAU,GAAG,WAAW,CAAC,IAAI,GAAG,WAAW,CAAC,IAAI,CAAC;IACvD,OAAO,cAAc,CACnB,UAAU,GAAG,IAAI,CAAC,MAAM,IAAI,WAAW,CAAC,IAAI,GAAG,CAAC;QAC9C,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,UAAU,EAAE,UAAU,GAAG,WAAW,CAAC,IAAI,CAAC;QACvD,CAAC,CAAC,EAAE,EACN,WAAW,CAAC,IAAI,EAChB,WAAW,CAAC,IAAI,EAChB,IAAI,CAAC,MAAM,CACZ,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,SAAS,GAAG,CAAgC,IAAc,EAAE,IAAY,EAAE,EAAE;IACvF,MAAM,iBAAiB,GAAyC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,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AAI,CAAC,aAAa,IAAI,UAAU,CAAC,OAAO,EAAE,CAAC;YACzC,iBAAiB,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;YACpC,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAC7B,UAAU,CACR,GAAG,EAAE,CAAC,OAAO,CAAC,kBAAkB,CAAC,UAAU,CAAC,OAAmB,EAAE,WAAW,CAAC,CAAC,EAC9E,GAAG,CACJ,CACF,CAAC;QACJ,CAAC;aAAM,CAAC;YACN,OAAO,KAAK,EAAE,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,EAAE;gBAC9B,qDAAqD;gBACrD,UAAU,CAAC,OAAO,GAAG,OAAO,CAAC;gBAC7B,iBAAiB,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;gBACpC,OAAO,kBAAkB,CAAC,UAAU,CAAC,OAAO,EAAE,WAAW,CAAC,CAAC;YAC7D,CAAC,CAAC,CAAC;QACL,CAAC;IACH,CAAC,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,iBAAiB,CAAC"}
|
package/lib/hooks/useFocus.js
CHANGED
|
@@ -1,13 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const react_1 = require("react");
|
|
5
|
-
const useFocus = (elementRef, dependencies = []) => {
|
|
6
|
-
(0, react_1.useEffect)(() => {
|
|
1
|
+
import { useEffect } from 'react';
|
|
2
|
+
export const useFocus = (elementRef, dependencies = []) => {
|
|
3
|
+
useEffect(() => {
|
|
7
4
|
if (elementRef.current) {
|
|
8
5
|
elementRef.current.focus();
|
|
9
6
|
}
|
|
10
7
|
}, [dependencies]);
|
|
11
8
|
};
|
|
12
|
-
exports.useFocus = useFocus;
|
|
13
9
|
//# sourceMappingURL=useFocus.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useFocus.js","sourceRoot":"","sources":["../../../src/lib/hooks/useFocus.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"useFocus.js","sourceRoot":"","sources":["../../../src/lib/hooks/useFocus.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAElC,MAAM,CAAC,MAAM,QAAQ,GAAG,CACtB,UAAgC,EAChC,eAAoB,EAAE,EAChB,EAAE;IACR,SAAS,CAAC,GAAG,EAAE;QACX,IAAI,UAAU,CAAC,OAAO,EAAE,CAAC;YACvB,UAAU,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC;QAC7B,CAAC;IACL,CAAC,EAAE,CAAC,YAAY,CAAC,CAAC,CAAC;AACrB,CAAC,CAAC"}
|
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.useLiveAnnouncerWithRegion = void 0;
|
|
4
|
-
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
-
const react_1 = require("react");
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useState } from 'react';
|
|
6
3
|
const visuallyHiddenStyle = {
|
|
7
4
|
border: 0,
|
|
8
5
|
clip: 'rect(0 0 0 0)',
|
|
@@ -14,11 +11,10 @@ const visuallyHiddenStyle = {
|
|
|
14
11
|
whiteSpace: 'nowrap',
|
|
15
12
|
width: '1px',
|
|
16
13
|
};
|
|
17
|
-
const useLiveAnnouncerWithRegion = () => {
|
|
18
|
-
const [message, setMessage] =
|
|
14
|
+
export const useLiveAnnouncerWithRegion = () => {
|
|
15
|
+
const [message, setMessage] = useState('');
|
|
19
16
|
const announce = (msg) => setMessage(msg);
|
|
20
|
-
const LiveRegion = ((
|
|
17
|
+
const LiveRegion = (_jsx("div", { "aria-live": "polite", "aria-atomic": "true", "data-testid": "live-region-announcer", style: visuallyHiddenStyle, children: message }));
|
|
21
18
|
return { announce, LiveRegion };
|
|
22
19
|
};
|
|
23
|
-
exports.useLiveAnnouncerWithRegion = useLiveAnnouncerWithRegion;
|
|
24
20
|
//# sourceMappingURL=useLiveAnnouncerWithRegion.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useLiveAnnouncerWithRegion.js","sourceRoot":"","sources":["../../../src/lib/hooks/useLiveAnnouncerWithRegion.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"useLiveAnnouncerWithRegion.js","sourceRoot":"","sources":["../../../src/lib/hooks/useLiveAnnouncerWithRegion.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEjC,MAAM,mBAAmB,GAAwB;IAC/C,MAAM,EAAE,CAAC;IACT,IAAI,EAAE,iBAAiB;IACvB,MAAM,EAAE,KAAK;IACb,MAAM,EAAE,MAAM;IACd,QAAQ,EAAE,QAAQ;IAClB,OAAO,EAAE,CAAC;IACV,QAAQ,EAAE,UAAU;IACpB,UAAU,EAAE,QAAQ;IACpB,KAAK,EAAE,KAAK;CACb,CAAC;AAEF,MAAM,CAAC,MAAM,0BAA0B,GAAG,GAAG,EAAE;IAC7C,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,GAAG,QAAQ,CAAC,EAAE,CAAC,CAAC;IAE3C,MAAM,QAAQ,GAAG,CAAC,GAAW,EAAE,EAAE,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC;IAElD,MAAM,UAAU,GAAG,CACjB,2BACY,QAAQ,iBACN,MAAM,iBACN,uBAAuB,EACnC,KAAK,EAAE,mBAAmB,YAEzB,OAAO,GACJ,CACP,CAAC;IAEF,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,CAAC;AAClC,CAAC,CAAC"}
|
package/lib/hooks/useLoading.js
CHANGED
|
@@ -1,14 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
const react_1 = require("react");
|
|
6
|
-
const react_redux_1 = require("react-redux");
|
|
7
|
-
const appStateSlice_1 = require("../redux/slices/appStateSlice");
|
|
1
|
+
import { uniqueId } from 'lodash';
|
|
2
|
+
import { useRef } from 'react';
|
|
3
|
+
import { useDispatch } from 'react-redux';
|
|
4
|
+
import { appStateActions } from '../redux/slices/appStateSlice';
|
|
8
5
|
/** @see {@link LoadingOverlay} */
|
|
9
|
-
function
|
|
10
|
-
const dispatch =
|
|
11
|
-
const ref =
|
|
12
|
-
return (loading) => dispatch(
|
|
6
|
+
export default function (task) {
|
|
7
|
+
const dispatch = useDispatch();
|
|
8
|
+
const ref = useRef(uniqueId());
|
|
9
|
+
return (loading) => dispatch(appStateActions.setLoading({ task: `${task}[${ref.current}]`, loading }));
|
|
13
10
|
}
|
|
14
11
|
//# sourceMappingURL=useLoading.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useLoading.js","sourceRoot":"","sources":["../../../src/lib/hooks/useLoading.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"useLoading.js","sourceRoot":"","sources":["../../../src/lib/hooks/useLoading.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAC;AAClC,OAAO,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAEhE,kCAAkC;AAClC,MAAM,CAAC,OAAO,WAAW,IAAY;IACnC,MAAM,QAAQ,GAAG,WAAW,EAAE,CAAC;IAC/B,MAAM,GAAG,GAAG,MAAM,CAAC,QAAQ,EAAE,CAAC,CAAC;IAC/B,OAAO,CAAC,OAAgB,EAAE,EAAE,CAC1B,QAAQ,CAAC,eAAe,CAAC,UAAU,CAAC,EAAE,IAAI,EAAE,GAAG,IAAI,IAAI,GAAG,CAAC,OAAO,GAAG,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC;AACvF,CAAC"}
|
package/lib/hooks/useLogin.js
CHANGED
|
@@ -1,13 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
const
|
|
7
|
-
const env_1 = require("../config/env");
|
|
8
|
-
const userSlice_1 = require("../redux/slices/userSlice");
|
|
9
|
-
const storage_1 = require("../utils/storage");
|
|
10
|
-
const testToken = env_1.CONFIG.TEST.JWT;
|
|
1
|
+
import isEmpty from 'lodash/isEmpty';
|
|
2
|
+
import { useDispatch } from 'react-redux';
|
|
3
|
+
import { CONFIG } from '../config/env';
|
|
4
|
+
import { userActions } from '../redux/slices/userSlice';
|
|
5
|
+
import { isPagoPaUser, storageTokenOps, storageUserOps } from '../utils/storage';
|
|
6
|
+
const testToken = CONFIG.TEST.JWT;
|
|
11
7
|
const mockedUser = {
|
|
12
8
|
uid: '0',
|
|
13
9
|
taxCode: 'AAAAAA00A00A000A',
|
|
@@ -16,22 +12,22 @@ const mockedUser = {
|
|
|
16
12
|
email: 'loggedEmail@aa.aa',
|
|
17
13
|
iss: 'SPID',
|
|
18
14
|
};
|
|
19
|
-
const useLogin = () => {
|
|
20
|
-
const dispatch =
|
|
21
|
-
const setUser = (user) => dispatch(
|
|
15
|
+
export const useLogin = () => {
|
|
16
|
+
const dispatch = useDispatch();
|
|
17
|
+
const setUser = (user) => dispatch(userActions.setLoggedUser(user));
|
|
22
18
|
const attemptSilentLogin = async () => {
|
|
23
|
-
if (
|
|
19
|
+
if (CONFIG.MOCKS.MOCK_USER) {
|
|
24
20
|
setUser(mockedUser);
|
|
25
|
-
|
|
26
|
-
|
|
21
|
+
storageTokenOps.write(testToken);
|
|
22
|
+
storageUserOps.write(mockedUser);
|
|
27
23
|
return;
|
|
28
24
|
}
|
|
29
|
-
const sessionStorageUser =
|
|
30
|
-
const LOGIN_URL =
|
|
25
|
+
const sessionStorageUser = storageUserOps.read();
|
|
26
|
+
const LOGIN_URL = isPagoPaUser ? CONFIG.URL_FE.LOGOUT_GOOGLE : CONFIG.URL_FE.LOGIN;
|
|
31
27
|
// If there are no credentials, it is impossible to get the user, so
|
|
32
|
-
if ((
|
|
28
|
+
if (isEmpty(sessionStorageUser)) {
|
|
33
29
|
// Remove any partial data that might have remained, just for safety
|
|
34
|
-
|
|
30
|
+
storageUserOps.delete();
|
|
35
31
|
// Go to the login view
|
|
36
32
|
window.location.assign(LOGIN_URL);
|
|
37
33
|
// This return is necessary
|
|
@@ -42,5 +38,4 @@ const useLogin = () => {
|
|
|
42
38
|
};
|
|
43
39
|
return { attemptSilentLogin };
|
|
44
40
|
};
|
|
45
|
-
exports.useLogin = useLogin;
|
|
46
41
|
//# sourceMappingURL=useLogin.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useLogin.js","sourceRoot":"","sources":["../../../src/lib/hooks/useLogin.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"useLogin.js","sourceRoot":"","sources":["../../../src/lib/hooks/useLogin.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,gBAAgB,CAAC;AACrC,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAEvC,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AACxD,OAAO,EAAE,YAAY,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAEjF,MAAM,SAAS,GAAG,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC;AAElC,MAAM,UAAU,GAAG;IACjB,GAAG,EAAE,GAAG;IACR,OAAO,EAAE,kBAAkB;IAC3B,IAAI,EAAE,YAAY;IAClB,OAAO,EAAE,eAAe;IACxB,KAAK,EAAE,mBAAmB;IAC1B,GAAG,EAAE,MAAM;CACZ,CAAC;AAEF,MAAM,CAAC,MAAM,QAAQ,GAAG,GAAG,EAAE;IAC3B,MAAM,QAAQ,GAAG,WAAW,EAAE,CAAC;IAC/B,MAAM,OAAO,GAAG,CAAC,IAAU,EAAE,EAAE,CAAC,QAAQ,CAAC,WAAW,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC,CAAC;IAE1E,MAAM,kBAAkB,GAAG,KAAK,IAAI,EAAE;QACpC,IAAI,MAAM,CAAC,KAAK,CAAC,SAAS,EAAE,CAAC;YAC3B,OAAO,CAAC,UAAU,CAAC,CAAC;YACpB,eAAe,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;YACjC,cAAc,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC;YACjC,OAAO;QACT,CAAC;QAED,MAAM,kBAAkB,GAAG,cAAc,CAAC,IAAI,EAAE,CAAC;QACjD,MAAM,SAAS,GAAG,YAAY,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC;QAEnF,oEAAoE;QACpE,IAAI,OAAO,CAAC,kBAAkB,CAAC,EAAE,CAAC;YAChC,oEAAoE;YACpE,cAAc,CAAC,MAAM,EAAE,CAAC;YACxB,uBAAuB;YACvB,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;YAClC,2BAA2B;YAC3B,OAAO;QACT,CAAC;QAED,2DAA2D;QAC3D,OAAO,CAAC,kBAAkB,CAAC,CAAC;IAC9B,CAAC,CAAC;IAEF,OAAO,EAAE,kBAAkB,EAAE,CAAC;AAChC,CAAC,CAAC"}
|
|
@@ -1,19 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const
|
|
5
|
-
const permissionsSlice_1 = require("./../redux/slices/permissionsSlice");
|
|
6
|
-
function usePermissions() {
|
|
7
|
-
const productPermissions = (0, react_redux_1.useSelector)(permissionsSlice_1.selectProductPermissions);
|
|
1
|
+
import { useSelector } from 'react-redux';
|
|
2
|
+
import { selectProductPermissions } from './../redux/slices/permissionsSlice';
|
|
3
|
+
export function usePermissions() {
|
|
4
|
+
const productPermissions = useSelector(selectProductPermissions);
|
|
8
5
|
// Function to check if a user has permission for a specific action.
|
|
9
6
|
const hasPermission = (productId, action) => {
|
|
10
7
|
const product = productPermissions.find((p) => p.productId === productId);
|
|
11
|
-
return
|
|
8
|
+
return product?.actions.includes(action) || false;
|
|
12
9
|
};
|
|
13
10
|
// Function that returns an array of actions for a given product ID.
|
|
14
11
|
const getProductPermissions = (productId) => {
|
|
15
12
|
const product = productPermissions.find((p) => p.productId === productId);
|
|
16
|
-
return
|
|
13
|
+
return product?.actions || [];
|
|
17
14
|
};
|
|
18
15
|
// Function that returns an array of product IDs that have a specific action.
|
|
19
16
|
const getAllProductsWithPermission = (action) => productPermissions
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"usePermissions.js","sourceRoot":"","sources":["../../../src/lib/hooks/usePermissions.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"usePermissions.js","sourceRoot":"","sources":["../../../src/lib/hooks/usePermissions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,wBAAwB,EAAsB,MAAM,oCAAoC,CAAC;AAElG,MAAM,UAAU,cAAc;IAC5B,MAAM,kBAAkB,GAA8B,WAAW,CAAC,wBAAwB,CAAC,CAAC;IAE5F,oEAAoE;IACpE,MAAM,aAAa,GAAG,CAAC,SAAiB,EAAE,MAAc,EAAW,EAAE;QACnE,MAAM,OAAO,GAAG,kBAAkB,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,SAAS,KAAK,SAAS,CAAC,CAAC;QAC1E,OAAO,OAAO,EAAE,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,KAAK,CAAC;IACpD,CAAC,CAAC;IAEF,qEAAqE;IACrE,MAAM,qBAAqB,GAAG,CAAC,SAAiB,EAAiB,EAAE;QACjE,MAAM,OAAO,GAAG,kBAAkB,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,SAAS,KAAK,SAAS,CAAC,CAAC;QAC1E,OAAO,OAAO,EAAE,OAAO,IAAI,EAAE,CAAC;IAChC,CAAC,CAAC;IAEF,6EAA6E;IAC7E,MAAM,4BAA4B,GAAG,CAAC,MAAc,EAAiB,EAAE,CACrE,kBAAkB;SACf,MAAM,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;SACrD,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IAEzC,OAAO;QACL,aAAa;QACb,qBAAqB;QACrB,4BAA4B;QAC5B,kBAAkB;KACnB,CAAC;AACJ,CAAC"}
|