@pagopa/selfcare-common-frontend 0.1.1 → 0.1.2
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/build.info +2 -2
- package/common-polyfill.js +11 -8
- package/common-polyfill.js.map +1 -0
- package/components/CustomAvatar.js +10 -5
- package/components/CustomAvatar.js.map +1 -0
- package/components/CustomPagination.js +11 -6
- package/components/CustomPagination.js.map +1 -0
- package/components/ErrorBoundary/ErrorBoundary.js +24 -20
- package/components/ErrorBoundary/ErrorBoundary.js.map +1 -0
- package/components/ErrorBoundary/components/BlockingErrorPage.js +8 -5
- package/components/ErrorBoundary/components/BlockingErrorPage.js.map +1 -0
- package/components/FilterModal.js +17 -12
- package/components/FilterModal.js.map +1 -0
- package/components/Footer/Footer.js +14 -11
- package/components/Footer/Footer.js.map +1 -0
- package/components/Header/Header.js +14 -10
- package/components/Header/Header.js.map +1 -0
- package/components/Header/subHeader/SubHeader.js +9 -5
- package/components/Header/subHeader/SubHeader.js.map +1 -0
- package/components/Loading/LoadingOverlay.js +16 -11
- package/components/Loading/LoadingOverlay.js.map +1 -0
- package/components/SessionModal.js +15 -10
- package/components/SessionModal.js.map +1 -0
- package/components/TitleBox.js +9 -5
- package/components/TitleBox.js.map +1 -0
- package/components/Toast.js +15 -10
- package/components/Toast.js.map +1 -0
- package/config/env.js +7 -2
- package/config/env.js.map +1 -0
- package/decorators/__mocks__/withLogin.js +17 -12
- package/decorators/__mocks__/withLogin.js.map +1 -0
- package/decorators/withLogin.js +18 -13
- package/decorators/withLogin.js.map +1 -0
- package/hooks/useErrorDispatcher.js +9 -5
- package/hooks/useErrorDispatcher.js.map +1 -0
- package/hooks/useLoading.js +12 -8
- package/hooks/useLoading.js.map +1 -0
- package/hooks/useLogin.js +21 -15
- package/hooks/useLogin.js.map +1 -0
- package/index.js +35 -20
- package/index.js.map +1 -0
- package/model/Page.js +3 -1
- package/model/Page.js.map +1 -0
- package/model/PageRequest.js +3 -1
- package/model/PageRequest.js.map +1 -0
- package/model/PageResource.js +3 -1
- package/model/PageResource.js.map +1 -0
- package/model/Party.js +3 -1
- package/model/Party.js.map +1 -0
- package/model/User.js +3 -1
- package/model/User.js.map +1 -0
- package/package.json +1 -1
- package/redux/slices/appStateSlice.js +9 -5
- package/redux/slices/appStateSlice.js.map +1 -0
- package/redux/slices/userSlice.js +9 -5
- package/redux/slices/userSlice.js.map +1 -0
- package/services/errorService.js +6 -1
- package/services/errorService.js.map +1 -0
- package/utils/constants.js +8 -4
- package/utils/constants.js.map +1 -0
- package/utils/routes-utils.js +6 -1
- package/utils/routes-utils.js.map +1 -0
- package/utils/storage-utils.js +10 -3
- package/utils/storage-utils.js.map +1 -0
- package/utils/utils.js +6 -1
- package/utils/utils.js.map +1 -0
package/components/Toast.js
CHANGED
|
@@ -1,15 +1,18 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
const
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const react_1 = require("react");
|
|
6
|
+
const material_1 = require("@mui/material");
|
|
7
|
+
const system_1 = require("@mui/system");
|
|
8
|
+
const Close_1 = (0, tslib_1.__importDefault)(require("@mui/icons-material/Close"));
|
|
9
|
+
const confirmUserUpdate_svg_1 = require("../assets/confirmUserUpdate.svg");
|
|
10
|
+
const CustomAlert = (0, system_1.styled)(material_1.Alert)({
|
|
8
11
|
'.MuiAlert-icon': { display: 'none' },
|
|
9
12
|
});
|
|
10
13
|
/** Selfcare's toast */
|
|
11
|
-
|
|
12
|
-
return (
|
|
14
|
+
function Toast({ open, title, message, onCloseToast, logo = confirmUserUpdate_svg_1.ReactComponent, leftBorderColor = '#00CF86', }) {
|
|
15
|
+
return ((0, jsx_runtime_1.jsx)(react_1.Fragment, { children: open && ((0, jsx_runtime_1.jsx)(CustomAlert, Object.assign({ className: "userToast", variant: "outlined", sx: {
|
|
13
16
|
position: 'fixed',
|
|
14
17
|
bottom: '64px',
|
|
15
18
|
right: '64px',
|
|
@@ -20,5 +23,7 @@ export default function Toast({ open, title, message, onCloseToast, logo = confi
|
|
|
20
23
|
borderRadius: '5px',
|
|
21
24
|
boxShadow: '0px 0px 45px rgba(0, 0, 0, 0.1) ',
|
|
22
25
|
border: 'none',
|
|
23
|
-
} }, { children:
|
|
26
|
+
} }, { children: (0, jsx_runtime_1.jsxs)(material_1.Grid, Object.assign({ container: true }, { children: [(0, jsx_runtime_1.jsx)(material_1.Grid, Object.assign({ item: true, xs: 2 }, { children: (0, jsx_runtime_1.jsx)(material_1.SvgIcon, { component: logo, viewBox: "0 0 80 24", sx: { width: '80px', height: '37px', marginLeft: '13px' } }, void 0) }), void 0), (0, jsx_runtime_1.jsxs)(material_1.Grid, Object.assign({ item: true, xs: 8 }, { children: [(0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ pt: 1, pb: 1, sx: { fontSize: '15px', fontWeight: '600' } }, { children: title }), void 0), (0, jsx_runtime_1.jsx)(material_1.Typography, { children: message }, void 0)] }), void 0), (0, jsx_runtime_1.jsx)(material_1.Grid, Object.assign({ item: true, xs: 2 }, { children: (0, jsx_runtime_1.jsx)(material_1.IconButton, Object.assign({ onClick: onCloseToast }, { children: (0, jsx_runtime_1.jsx)(Close_1.default, {}, void 0) }), void 0) }), void 0)] }), void 0) }), void 0)) }, void 0));
|
|
24
27
|
}
|
|
28
|
+
exports.default = Toast;
|
|
29
|
+
//# sourceMappingURL=Toast.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Toast.js","sourceRoot":"","sources":["../../src/lib/components/Toast.tsx"],"names":[],"mappings":";;;;AAAA,iCAAwC;AACxC,4CAA6E;AAC7E,wCAAqC;AACrC,mFAAkD;AAClD,2EAAgF;AAiBhF,MAAM,WAAW,GAAG,IAAA,eAAM,EAAC,gBAAK,CAAC,CAAC;IAChC,gBAAgB,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE;CACtC,CAAC,CAAC;AAEH,uBAAuB;AACvB,SAAwB,KAAK,CAAC,EAC5B,IAAI,EACJ,KAAK,EACL,OAAO,EACP,YAAY,EACZ,IAAI,GAAG,sCAAW,EAClB,eAAe,GAAG,SAAS,GACrB;IACN,OAAO,CACL,uBAAC,gBAAQ,cACN,IAAI,IAAI,CACP,uBAAC,WAAW,kBACV,SAAS,EAAC,WAAW,EACrB,OAAO,EAAC,UAAU,EAClB,EAAE,EAAE;gBACF,QAAQ,EAAE,OAAO;gBACjB,MAAM,EAAE,MAAM;gBACd,KAAK,EAAE,MAAM;gBACb,MAAM,EAAE,GAAG;gBACX,KAAK,EAAE,OAAO;gBACd,eAAe,EAAE,OAAO;gBACxB,UAAU,EAAE,aAAa,eAAe,aAAa;gBACrD,YAAY,EAAE,KAAK;gBACnB,SAAS,EAAE,kCAAkC;gBAC7C,MAAM,EAAE,MAAM;aACf,gBAED,wBAAC,eAAI,kBAAC,SAAS,uBACb,uBAAC,eAAI,kBAAC,IAAI,QAAC,EAAE,EAAE,CAAC,gBACd,uBAAC,kBAAO,IACN,SAAS,EAAE,IAAI,EACf,OAAO,EAAC,WAAW,EACnB,EAAE,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,WACzD,YACG,EACP,wBAAC,eAAI,kBAAC,IAAI,QAAC,EAAE,EAAE,CAAC,iBACd,uBAAC,qBAAU,kBAAC,EAAE,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,EAAE,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,UAAU,EAAE,KAAK,EAAE,gBAClE,KAAK,YACK,EACb,uBAAC,qBAAU,cAAE,OAAO,WAAc,aAC7B,EACP,uBAAC,eAAI,kBAAC,IAAI,QAAC,EAAE,EAAE,CAAC,gBACd,uBAAC,qBAAU,kBAAC,OAAO,EAAE,YAAY,gBAC/B,uBAAC,eAAS,aAAG,YACF,YACR,aACF,YACK,CACf,WACQ,CACZ,CAAC;AACJ,CAAC;AAnDD,wBAmDC"}
|
package/config/env.js
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CONFIG = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const env = (0, tslib_1.__importStar)(require("env-var"));
|
|
6
|
+
exports.CONFIG = {
|
|
3
7
|
URL_FE: {
|
|
4
8
|
LOGIN: '/auth/login',
|
|
5
9
|
LOGOUT: '/auth/logout',
|
|
@@ -8,3 +12,4 @@ export const CONFIG = {
|
|
|
8
12
|
MOCK_USER: env.get('REACT_APP_MOCK_USER').default('false').asBool(),
|
|
9
13
|
},
|
|
10
14
|
};
|
|
15
|
+
//# sourceMappingURL=env.js.map
|
|
@@ -0,0 +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;KACvB;IAED,KAAK,EAAE;QACL,SAAS,EAAE,GAAG,CAAC,GAAG,CAAC,qBAAqB,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,MAAM,EAAE;KACpE;CACF,CAAC"}
|
|
@@ -1,21 +1,26 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.verifyMockExecution = exports.mockedUser = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const react_1 = require("react");
|
|
6
|
+
const react_redux_1 = require("react-redux");
|
|
7
|
+
const userSlice_1 = require("../../redux/slices/userSlice");
|
|
8
|
+
exports.mockedUser = {
|
|
6
9
|
name: 'NAME',
|
|
7
10
|
surname: 'SURNAME',
|
|
8
11
|
uid: 'UID',
|
|
9
12
|
taxCode: 'AAAAAA00A00A000A',
|
|
10
13
|
email: 'a@a.aa',
|
|
11
14
|
};
|
|
12
|
-
|
|
13
|
-
expect(state.user.logged).toMatchObject(mockedUser);
|
|
15
|
+
const verifyMockExecution = (state) => {
|
|
16
|
+
expect(state.user.logged).toMatchObject(exports.mockedUser);
|
|
14
17
|
};
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
18
|
+
exports.verifyMockExecution = verifyMockExecution;
|
|
19
|
+
exports.default = (WrappedComponent) => () => {
|
|
20
|
+
const dispatch = (0, react_redux_1.useDispatch)();
|
|
21
|
+
(0, react_1.useEffect)(() => {
|
|
22
|
+
dispatch(userSlice_1.userActions.setLoggedUser(exports.mockedUser));
|
|
19
23
|
}, []);
|
|
20
|
-
return
|
|
24
|
+
return (0, jsx_runtime_1.jsx)(WrappedComponent, {}, void 0);
|
|
21
25
|
};
|
|
26
|
+
//# sourceMappingURL=withLogin.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"withLogin.js","sourceRoot":"","sources":["../../../src/lib/decorators/__mocks__/withLogin.tsx"],"names":[],"mappings":";;;;AAAA,iCAAkC;AAClC,6CAA0C;AAE1C,4DAA2D;AAE9C,QAAA,UAAU,GAAS;IAC9B,IAAI,EAAE,MAAM;IACZ,OAAO,EAAE,SAAS;IAClB,GAAG,EAAE,KAAK;IACV,OAAO,EAAE,kBAAkB;IAC3B,KAAK,EAAE,QAAQ;CAChB,CAAC;AAEK,MAAM,mBAAmB,GAAG,CAAC,KAAU,EAAE,EAAE;IAChD,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,aAAa,CAAC,kBAAU,CAAC,CAAC;AACtD,CAAC,CAAC;AAFW,QAAA,mBAAmB,uBAE9B;AAEF,kBAAe,CAAC,gBAA0C,EAAE,EAAE,CAAC,GAAG,EAAE;IAClE,MAAM,QAAQ,GAAG,IAAA,yBAAW,GAAE,CAAC;IAC/B,IAAA,iBAAS,EAAC,GAAG,EAAE;QACb,QAAQ,CAAC,uBAAW,CAAC,aAAa,CAAC,kBAAU,CAAC,CAAC,CAAC;IAClD,CAAC,EAAE,EAAE,CAAC,CAAC;IACP,OAAO,uBAAC,gBAAgB,aAAG,CAAC;AAC9B,CAAC,CAAC"}
|
package/decorators/withLogin.js
CHANGED
|
@@ -1,21 +1,24 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const react_1 = require("react");
|
|
6
|
+
const react_redux_1 = require("react-redux");
|
|
7
|
+
const useLoading_1 = (0, tslib_1.__importDefault)(require("../hooks/useLoading"));
|
|
8
|
+
const useLogin_1 = require("../hooks/useLogin");
|
|
9
|
+
const userSlice_1 = require("../redux/slices/userSlice");
|
|
10
|
+
const constants_1 = require("../utils/constants");
|
|
8
11
|
/** This feature is based on react-redux library and require to register the reducer build in userSlice into the application's redux store.
|
|
9
12
|
This decorator has to be applied to components whose acces require an active session.
|
|
10
13
|
Accessing to the components decorated with it without a session will brought to the login page.
|
|
11
14
|
It's possible to modify the login path changing the value in CONFIG.login inside the index.tsx file */
|
|
12
|
-
|
|
15
|
+
function withLogin(WrappedComponent) {
|
|
13
16
|
const displayName = WrappedComponent.displayName || WrappedComponent.name || 'Component';
|
|
14
17
|
const ComponentWithLogin = (props) => {
|
|
15
|
-
const user = useSelector(userSelectors.selectLoggedUser);
|
|
16
|
-
const { attemptSilentLogin } = useLogin();
|
|
17
|
-
const setLoading =
|
|
18
|
-
useEffect(() => {
|
|
18
|
+
const user = (0, react_redux_1.useSelector)(userSlice_1.userSelectors.selectLoggedUser);
|
|
19
|
+
const { attemptSilentLogin } = (0, useLogin_1.useLogin)();
|
|
20
|
+
const setLoading = (0, useLoading_1.default)(constants_1.LOADING_TASK_LOGIN_CHECK);
|
|
21
|
+
(0, react_1.useEffect)(() => {
|
|
19
22
|
async function asyncAttemptSilentLogin() {
|
|
20
23
|
await attemptSilentLogin();
|
|
21
24
|
}
|
|
@@ -25,9 +28,11 @@ export default function withLogin(WrappedComponent) {
|
|
|
25
28
|
asyncAttemptSilentLogin().finally(() => setLoading(false));
|
|
26
29
|
}
|
|
27
30
|
}, []); // eslint-disable-line react-hooks/exhaustive-deps
|
|
28
|
-
return user ?
|
|
31
|
+
return user ? (0, jsx_runtime_1.jsx)(WrappedComponent, Object.assign({}, props), void 0) : (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, {}, void 0);
|
|
29
32
|
};
|
|
30
33
|
// eslint-disable-next-line functional/immutable-data
|
|
31
34
|
ComponentWithLogin.displayName = `withLogin(${displayName})`;
|
|
32
35
|
return ComponentWithLogin;
|
|
33
36
|
}
|
|
37
|
+
exports.default = withLogin;
|
|
38
|
+
//# sourceMappingURL=withLogin.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"withLogin.js","sourceRoot":"","sources":["../../src/lib/decorators/withLogin.tsx"],"names":[],"mappings":";;;;AAAA,iCAAkC;AAClC,6CAA0C;AAC1C,kFAA6C;AAC7C,gDAA6C;AAC7C,yDAA0D;AAC1D,kDAA8D;AAK9D;;;uGAGuG;AACvG,SAAwB,SAAS,CAC/B,gBAAwC;IAExC,MAAM,WAAW,GAAG,gBAAgB,CAAC,WAAW,IAAI,gBAAgB,CAAC,IAAI,IAAI,WAAW,CAAC;IAEzF,MAAM,kBAAkB,GAAG,CAAC,KAAgC,EAAE,EAAE;QAC9D,MAAM,IAAI,GAAG,IAAA,yBAAW,EAAC,yBAAa,CAAC,gBAAgB,CAAC,CAAC;QACzD,MAAM,EAAE,kBAAkB,EAAE,GAAG,IAAA,mBAAQ,GAAE,CAAC;QAC1C,MAAM,UAAU,GAAG,IAAA,oBAAU,EAAC,oCAAwB,CAAC,CAAC;QAExD,IAAA,iBAAS,EAAC,GAAG,EAAE;YACb,KAAK,UAAU,uBAAuB;gBACpC,MAAM,kBAAkB,EAAE,CAAC;YAC7B,CAAC;YAED,IAAI,CAAC,IAAI,EAAE;gBACT,UAAU,CAAC,IAAI,CAAC,CAAC;gBAEjB,mEAAmE;gBACnE,uBAAuB,EAAE,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC;aAC5D;QACH,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,kDAAkD;QAE1D,OAAO,IAAI,CAAC,CAAC,CAAC,uBAAC,gBAAgB,oBAAM,KAAW,UAAI,CAAC,CAAC,CAAC,0DAAK,CAAC;IAC/D,CAAC,CAAC;IAEF,qDAAqD;IACrD,kBAAkB,CAAC,WAAW,GAAG,aAAa,WAAW,GAAG,CAAC;IAE7D,OAAO,kBAAkB,CAAC;AAC5B,CAAC;AA9BD,4BA8BC"}
|
|
@@ -1,7 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
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");
|
|
3
5
|
/** @see ErrorBoundary */
|
|
4
|
-
|
|
5
|
-
const dispatch = useDispatch();
|
|
6
|
-
return (error) => dispatch(appStateActions.addError(error));
|
|
6
|
+
function default_1() {
|
|
7
|
+
const dispatch = (0, react_redux_1.useDispatch)();
|
|
8
|
+
return (error) => dispatch(appStateSlice_1.appStateActions.addError(error));
|
|
7
9
|
}
|
|
10
|
+
exports.default = default_1;
|
|
11
|
+
//# sourceMappingURL=useErrorDispatcher.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useErrorDispatcher.js","sourceRoot":"","sources":["../../src/lib/hooks/useErrorDispatcher.ts"],"names":[],"mappings":";;AAAA,6CAA0C;AAC1C,iEAA0E;AAE1E,yBAAyB;AACzB;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.js
CHANGED
|
@@ -1,10 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const lodash_1 = require("lodash");
|
|
4
|
+
const react_1 = require("react");
|
|
5
|
+
const react_redux_1 = require("react-redux");
|
|
6
|
+
const appStateSlice_1 = require("../redux/slices/appStateSlice");
|
|
5
7
|
/** @see LoadingOverlay */
|
|
6
|
-
|
|
7
|
-
const dispatch = useDispatch();
|
|
8
|
-
const ref = useRef(uniqueId());
|
|
9
|
-
return (loading) => dispatch(appStateActions.setLoading({ task: `${task}[${ref.current}]`, loading }));
|
|
8
|
+
function default_1(task) {
|
|
9
|
+
const dispatch = (0, react_redux_1.useDispatch)();
|
|
10
|
+
const ref = (0, react_1.useRef)((0, lodash_1.uniqueId)());
|
|
11
|
+
return (loading) => dispatch(appStateSlice_1.appStateActions.setLoading({ task: `${task}[${ref.current}]`, loading }));
|
|
10
12
|
}
|
|
13
|
+
exports.default = default_1;
|
|
14
|
+
//# sourceMappingURL=useLoading.js.map
|
|
@@ -0,0 +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,0BAA0B;AAC1B,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
|
@@ -1,15 +1,19 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useLogin = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const isEmpty_1 = (0, tslib_1.__importDefault)(require("lodash/isEmpty"));
|
|
6
|
+
const react_redux_1 = require("react-redux");
|
|
7
|
+
const storage_utils_1 = require("../utils/storage-utils");
|
|
8
|
+
const env_1 = require("../config/env");
|
|
9
|
+
const constants_1 = require("../utils/constants");
|
|
10
|
+
const userSlice_1 = require("../redux/slices/userSlice");
|
|
7
11
|
const testToken = 'eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCIsImtpZCI6Imp3dF9kZjplNjoxOTplYToxZTpjZTplNjo3Yjo3MDo0MjoyYzphMjpjZDo4Yjo1MjowYiJ9.eyJlbWFpbCI6ImZ1cmlvdml0YWxlQG1hcnRpbm8uaXQiLCJmYW1pbHlfbmFtZSI6IlNhcnRvcmkiLCJmaXNjYWxfbnVtYmVyIjoiU1JUTkxNMDlUMDZHNjM1UyIsIm5hbWUiOiJBbnNlbG1vIiwiZnJvbV9hYSI6ZmFsc2UsInVpZCI6IjliMTdjZTcwLWY3OWYtNDJkOS04YjBlLTRlN2ViNGQ4ODA3NCIsImxldmVsIjoiTDIiLCJpYXQiOjE2Mzk1OTI2NTMsImlzcyI6IlNQSUQiLCJqdGkiOiIwMUZQWk5DV1c0RFhIQ0JZNFlHVFBKTkM2UiJ9.Cz6bZ1degD0APpJS3rfLPdjpjBE9JBGByVoLcFtqGhDxRAOhP_5aKqE0-1S9u9QUCakmhLA8i1auV7ImP8CLMaJTyUGUwz85yYL9KgqcRZ9qsYghFDqBQsh-n5_4Ldsu1-vBp2klwpJA87ppdzEyLZnSp6kUhpytFf00XtmSOYvt6-OMI6K6bBVFGXk_IYGs4KHx3-fij1DGg-_8BhghtkvJVyC2p9R4XezT8oXg55H-sBigTPdk9LssDa75Pj91zwPrbwTOBp9Tgk0HqOgieEDDpIuVplJI2uaq9YpDNyZkR8RnkSV072gPWlrJXDEb1-zXty7nT8NcGdRGTHDkkQ';
|
|
8
|
-
|
|
9
|
-
const dispatch = useDispatch();
|
|
10
|
-
const setUser = (user) => dispatch(userActions.setLoggedUser(user));
|
|
12
|
+
const useLogin = () => {
|
|
13
|
+
const dispatch = (0, react_redux_1.useDispatch)();
|
|
14
|
+
const setUser = (user) => dispatch(userSlice_1.userActions.setLoggedUser(user));
|
|
11
15
|
const attemptSilentLogin = async () => {
|
|
12
|
-
if (CONFIG.MOCKS.MOCK_USER) {
|
|
16
|
+
if (env_1.CONFIG.MOCKS.MOCK_USER) {
|
|
13
17
|
setUser({
|
|
14
18
|
uid: '0',
|
|
15
19
|
taxCode: 'AAAAAA00A00A000A',
|
|
@@ -17,16 +21,16 @@ export const useLogin = () => {
|
|
|
17
21
|
surname: 'loggedSurname',
|
|
18
22
|
email: 'loggedEmail@aa.aa',
|
|
19
23
|
});
|
|
20
|
-
storageWrite(STORAGE_KEY_TOKEN, testToken, 'string');
|
|
24
|
+
(0, storage_utils_1.storageWrite)(constants_1.STORAGE_KEY_TOKEN, testToken, 'string');
|
|
21
25
|
return;
|
|
22
26
|
}
|
|
23
|
-
const sessionStorageUser = storageRead(STORAGE_KEY_USER, 'object');
|
|
27
|
+
const sessionStorageUser = (0, storage_utils_1.storageRead)(constants_1.STORAGE_KEY_USER, 'object');
|
|
24
28
|
// If there are no credentials, it is impossible to get the user, so
|
|
25
|
-
if (
|
|
29
|
+
if ((0, isEmpty_1.default)(sessionStorageUser)) {
|
|
26
30
|
// Remove any partial data that might have remained, just for safety
|
|
27
|
-
storageDelete(STORAGE_KEY_USER);
|
|
31
|
+
(0, storage_utils_1.storageDelete)(constants_1.STORAGE_KEY_USER);
|
|
28
32
|
// Go to the login view
|
|
29
|
-
window.location.assign(CONFIG.URL_FE.LOGIN);
|
|
33
|
+
window.location.assign(env_1.CONFIG.URL_FE.LOGIN);
|
|
30
34
|
// This return is necessary
|
|
31
35
|
return;
|
|
32
36
|
}
|
|
@@ -35,3 +39,5 @@ export const useLogin = () => {
|
|
|
35
39
|
};
|
|
36
40
|
return { attemptSilentLogin };
|
|
37
41
|
};
|
|
42
|
+
exports.useLogin = useLogin;
|
|
43
|
+
//# sourceMappingURL=useLogin.js.map
|
|
@@ -0,0 +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;AAEtxB,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;gBACN,GAAG,EAAE,GAAG;gBACR,OAAO,EAAE,kBAAkB;gBAC3B,IAAI,EAAE,YAAY;gBAClB,OAAO,EAAE,eAAe;gBACxB,KAAK,EAAE,mBAAmB;aAC3B,CAAC,CAAC;YACH,IAAA,4BAAY,EAAC,6BAAiB,EAAE,SAAS,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;AAlCW,QAAA,QAAQ,YAkCnB"}
|
package/index.js
CHANGED
|
@@ -1,20 +1,35 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
1
|
+
"use strict";
|
|
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;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
var Header_1 = require("./components/Header/Header");
|
|
6
|
+
Object.defineProperty(exports, "Header", { enumerable: true, get: function () { return (0, tslib_1.__importDefault)(Header_1).default; } });
|
|
7
|
+
(0, tslib_1.__exportStar)(require("./components/Header/Header"), exports);
|
|
8
|
+
var Footer_1 = require("./components/Footer/Footer");
|
|
9
|
+
Object.defineProperty(exports, "Footer", { enumerable: true, get: function () { return (0, tslib_1.__importDefault)(Footer_1).default; } });
|
|
10
|
+
(0, tslib_1.__exportStar)(require("./components/Footer/Footer"), exports);
|
|
11
|
+
var CustomAvatar_1 = require("./components/CustomAvatar");
|
|
12
|
+
Object.defineProperty(exports, "CustomAvatar", { enumerable: true, get: function () { return (0, tslib_1.__importDefault)(CustomAvatar_1).default; } });
|
|
13
|
+
(0, tslib_1.__exportStar)(require("./components/CustomAvatar"), exports);
|
|
14
|
+
var CustomPagination_1 = require("./components/CustomPagination");
|
|
15
|
+
Object.defineProperty(exports, "CustomPagination", { enumerable: true, get: function () { return (0, tslib_1.__importDefault)(CustomPagination_1).default; } });
|
|
16
|
+
(0, tslib_1.__exportStar)(require("./components/CustomPagination"), exports);
|
|
17
|
+
var FilterModal_1 = require("./components/FilterModal");
|
|
18
|
+
Object.defineProperty(exports, "FilterModal", { enumerable: true, get: function () { return (0, tslib_1.__importDefault)(FilterModal_1).default; } });
|
|
19
|
+
(0, tslib_1.__exportStar)(require("./components/FilterModal"), exports);
|
|
20
|
+
var SessionModal_1 = require("./components/SessionModal");
|
|
21
|
+
Object.defineProperty(exports, "SessionModal", { enumerable: true, get: function () { return (0, tslib_1.__importDefault)(SessionModal_1).default; } });
|
|
22
|
+
(0, tslib_1.__exportStar)(require("./components/SessionModal"), exports);
|
|
23
|
+
var TitleBox_1 = require("./components/TitleBox");
|
|
24
|
+
Object.defineProperty(exports, "TitleBox", { enumerable: true, get: function () { return (0, tslib_1.__importDefault)(TitleBox_1).default; } });
|
|
25
|
+
(0, tslib_1.__exportStar)(require("./components/TitleBox"), exports);
|
|
26
|
+
var Toast_1 = require("./components/Toast");
|
|
27
|
+
Object.defineProperty(exports, "Toast", { enumerable: true, get: function () { return (0, tslib_1.__importDefault)(Toast_1).default; } });
|
|
28
|
+
(0, tslib_1.__exportStar)(require("./components/Toast"), exports);
|
|
29
|
+
var ErrorBoundary_1 = require("./components/ErrorBoundary/ErrorBoundary");
|
|
30
|
+
Object.defineProperty(exports, "ErrorBoundary", { enumerable: true, get: function () { return (0, tslib_1.__importDefault)(ErrorBoundary_1).default; } });
|
|
31
|
+
(0, tslib_1.__exportStar)(require("./components/ErrorBoundary/ErrorBoundary"), exports);
|
|
32
|
+
var LoadingOverlay_1 = require("./components/Loading/LoadingOverlay");
|
|
33
|
+
Object.defineProperty(exports, "LoadingOverlay", { enumerable: true, get: function () { return (0, tslib_1.__importDefault)(LoadingOverlay_1).default; } });
|
|
34
|
+
(0, tslib_1.__exportStar)(require("./components/Loading/LoadingOverlay"), exports);
|
|
35
|
+
//# sourceMappingURL=index.js.map
|
package/index.js.map
ADDED
|
@@ -0,0 +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"}
|
package/model/Page.js
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Page.js","sourceRoot":"","sources":["../../src/lib/model/Page.ts"],"names":[],"mappings":""}
|
package/model/PageRequest.js
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PageRequest.js","sourceRoot":"","sources":["../../src/lib/model/PageRequest.ts"],"names":[],"mappings":""}
|
package/model/PageResource.js
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PageResource.js","sourceRoot":"","sources":["../../src/lib/model/PageResource.ts"],"names":[],"mappings":""}
|
package/model/Party.js
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Party.js","sourceRoot":"","sources":["../../src/lib/model/Party.tsx"],"names":[],"mappings":""}
|
package/model/User.js
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"User.js","sourceRoot":"","sources":["../../src/lib/model/User.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": "0.1.
|
|
4
|
+
"version": "0.1.2",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": "https://github.com/pagopa/selfcare-common-frontend",
|
|
7
7
|
"author": "https://www.pagopa.gov.it",
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
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");
|
|
2
5
|
const initialState = {
|
|
3
6
|
loading: {
|
|
4
7
|
result: false,
|
|
@@ -7,7 +10,7 @@ const initialState = {
|
|
|
7
10
|
errors: [],
|
|
8
11
|
};
|
|
9
12
|
/* eslint-disable functional/immutable-data */
|
|
10
|
-
|
|
13
|
+
exports.appStateSlice = (0, toolkit_1.createSlice)({
|
|
11
14
|
name: 'appState',
|
|
12
15
|
initialState,
|
|
13
16
|
reducers: {
|
|
@@ -29,9 +32,10 @@ export const appStateSlice = createSlice({
|
|
|
29
32
|
},
|
|
30
33
|
},
|
|
31
34
|
});
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
+
exports.appStateActions = exports.appStateSlice.actions;
|
|
36
|
+
exports.appStateReducer = exports.appStateSlice.reducer;
|
|
37
|
+
exports.appStateSelectors = {
|
|
35
38
|
selectLoading: (state) => state.appState.loading.result,
|
|
36
39
|
selectErrors: (state) => state.appState.errors,
|
|
37
40
|
};
|
|
41
|
+
//# sourceMappingURL=appStateSlice.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"appStateSlice.js","sourceRoot":"","sources":["../../../src/lib/redux/slices/appStateSlice.ts"],"names":[],"mappings":";;;AAAA,8CAA8D;AAiC9D,MAAM,YAAY,GAAkB;IAClC,OAAO,EAAE;QACP,MAAM,EAAE,KAAK;QACb,KAAK,EAAE,EAAE;KACV;IACD,MAAM,EAAE,EAAE;CACX,CAAC;AAEF,8CAA8C;AACjC,QAAA,aAAa,GAAG,IAAA,qBAAW,EAAC;IACvC,IAAI,EAAE,UAAU;IAChB,YAAY;IACZ,QAAQ,EAAE;QACR,UAAU,EAAE,CAAC,KAAK,EAAE,MAAyD,EAAE,EAAE;YAC/E,IAAI,MAAM,CAAC,OAAO,CAAC,OAAO,EAAE;gBAC1B,KAAK,CAAC,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC;gBAC5B,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;aACjD;iBAAM;gBACL,OAAO,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;gBAChD,KAAK,CAAC,OAAO,CAAC,MAAM,GAAG,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC;aACpE;QACH,CAAC;QACD,QAAQ,EAAE,CAAC,KAAK,EAAE,MAA+B,EAAE,EAAE;YACnD,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;QACpC,CAAC;QACD,WAAW,EAAE,CAAC,KAAK,EAAE,MAA+B,EAAE,EAAE;YACtD,KAAK,CAAC,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,MAAM,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;QACxE,CAAC;KACF;CACF,CAAC,CAAC;AAEU,QAAA,eAAe,GAAG,qBAAa,CAAC,OAAO,CAAC;AACxC,QAAA,eAAe,GAAG,qBAAa,CAAC,OAAO,CAAC;AAExC,QAAA,iBAAiB,GAAG;IAC/B,aAAa,EAAE,CAAC,KAAU,EAAE,EAAE,CAAC,KAAK,CAAC,QAAQ,CAAC,OAAO,CAAC,MAAM;IAC5D,YAAY,EAAE,CAAC,KAAU,EAAE,EAAE,CAAC,KAAK,CAAC,QAAQ,CAAC,MAAM;CACpD,CAAC"}
|
|
@@ -1,7 +1,10 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.userSelectors = exports.userReducer = exports.userActions = exports.userSlice = void 0;
|
|
4
|
+
const toolkit_1 = require("@reduxjs/toolkit");
|
|
2
5
|
const initialState = {};
|
|
3
6
|
/* eslint-disable functional/immutable-data */
|
|
4
|
-
|
|
7
|
+
exports.userSlice = (0, toolkit_1.createSlice)({
|
|
5
8
|
name: 'user',
|
|
6
9
|
initialState,
|
|
7
10
|
reducers: {
|
|
@@ -10,8 +13,9 @@ export const userSlice = createSlice({
|
|
|
10
13
|
},
|
|
11
14
|
},
|
|
12
15
|
});
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
+
exports.userActions = exports.userSlice.actions;
|
|
17
|
+
exports.userReducer = exports.userSlice.reducer;
|
|
18
|
+
exports.userSelectors = {
|
|
16
19
|
selectLoggedUser: (state) => state.user.logged,
|
|
17
20
|
};
|
|
21
|
+
//# sourceMappingURL=userSlice.js.map
|
|
@@ -0,0 +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,KAAU,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM;CACpD,CAAC"}
|
package/services/errorService.js
CHANGED
|
@@ -1,7 +1,12 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.handleErrors = void 0;
|
|
4
|
+
const handleErrors = (errors) => {
|
|
2
5
|
errors
|
|
3
6
|
.filter((e) => e.toNotify)
|
|
4
7
|
.forEach((e) => {
|
|
5
8
|
console.error('An error occurred: ', e);
|
|
6
9
|
});
|
|
7
10
|
};
|
|
11
|
+
exports.handleErrors = handleErrors;
|
|
12
|
+
//# sourceMappingURL=errorService.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errorService.js","sourceRoot":"","sources":["../../src/lib/services/errorService.ts"],"names":[],"mappings":";;;AAEO,MAAM,YAAY,GAAG,CAAC,MAAuB,EAAE,EAAE;IACtD,MAAM;SACH,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC;SACzB,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE;QACb,OAAO,CAAC,KAAK,CAAC,qBAAqB,EAAE,CAAC,CAAC,CAAC;IAC1C,CAAC,CAAC,CAAC;AACP,CAAC,CAAC;AANW,QAAA,YAAY,gBAMvB"}
|
package/utils/constants.js
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.roleLabels = exports.LOADING_TASK_LOGIN_CHECK = exports.STORAGE_KEY_TOKEN = exports.STORAGE_KEY_USER = void 0;
|
|
4
|
+
exports.STORAGE_KEY_USER = 'user';
|
|
5
|
+
exports.STORAGE_KEY_TOKEN = 'token';
|
|
6
|
+
exports.LOADING_TASK_LOGIN_CHECK = 'LOGIN_CHECK';
|
|
7
|
+
exports.roleLabels = {
|
|
5
8
|
ADMIN: { shortLabel: 'Ref. Amministrativo', longLabel: 'Referente Amministrativo' },
|
|
6
9
|
LIMITED: { shortLabel: 'Ref. Operativo', longLabel: 'Referente Operativo' },
|
|
7
10
|
};
|
|
11
|
+
//# sourceMappingURL=constants.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/lib/utils/constants.ts"],"names":[],"mappings":";;;AAEa,QAAA,gBAAgB,GAAG,MAAM,CAAC;AAC1B,QAAA,iBAAiB,GAAG,OAAO,CAAC;AAE5B,QAAA,wBAAwB,GAAG,aAAa,CAAC;AAEzC,QAAA,UAAU,GAAqE;IAC1F,KAAK,EAAE,EAAE,UAAU,EAAE,qBAAqB,EAAE,SAAS,EAAE,0BAA0B,EAAE;IACnF,OAAO,EAAE,EAAE,UAAU,EAAE,gBAAgB,EAAE,SAAS,EAAE,qBAAqB,EAAE;CAC5E,CAAC"}
|
package/utils/routes-utils.js
CHANGED
|
@@ -1 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.resolvePathVariables = void 0;
|
|
4
|
+
const resolvePathVariables = (path, pathVariables) => Object.keys(pathVariables).reduce((result, key) => result.replace(`:${key}`, pathVariables[key]), path);
|
|
5
|
+
exports.resolvePathVariables = resolvePathVariables;
|
|
6
|
+
//# sourceMappingURL=routes-utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"routes-utils.js","sourceRoot":"","sources":["../../src/lib/utils/routes-utils.tsx"],"names":[],"mappings":";;;AAAO,MAAM,oBAAoB,GAAG,CAAC,IAAY,EAAE,aAAwC,EAAE,EAAE,CAC7F,MAAM,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,MAAM,CAC/B,CAAC,MAAM,EAAE,GAAG,EAAE,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,GAAG,EAAE,EAAE,aAAa,CAAC,GAAG,CAAC,CAAC,EAC9D,IAAI,CACL,CAAC;AAJS,QAAA,oBAAoB,wBAI7B"}
|
package/utils/storage-utils.js
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.storageRead = exports.storageWrite = exports.storageDelete = void 0;
|
|
4
|
+
function storageDelete(key) {
|
|
2
5
|
window.sessionStorage.removeItem(key);
|
|
3
6
|
}
|
|
4
|
-
|
|
7
|
+
exports.storageDelete = storageDelete;
|
|
8
|
+
function storageWrite(key, value, type) {
|
|
5
9
|
const stringifyFn = {
|
|
6
10
|
string: () => value,
|
|
7
11
|
number: () => String(value),
|
|
@@ -10,7 +14,8 @@ export function storageWrite(key, value, type) {
|
|
|
10
14
|
const stringified = stringifyFn[type]();
|
|
11
15
|
window.sessionStorage.setItem(key, stringified);
|
|
12
16
|
}
|
|
13
|
-
|
|
17
|
+
exports.storageWrite = storageWrite;
|
|
18
|
+
function storageRead(key, type) {
|
|
14
19
|
const value = window.sessionStorage.getItem(key);
|
|
15
20
|
if (value === null) {
|
|
16
21
|
return;
|
|
@@ -22,3 +27,5 @@ export function storageRead(key, type) {
|
|
|
22
27
|
};
|
|
23
28
|
return parseFn[type]();
|
|
24
29
|
}
|
|
30
|
+
exports.storageRead = storageRead;
|
|
31
|
+
//# sourceMappingURL=storage-utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"storage-utils.js","sourceRoot":"","sources":["../../src/lib/utils/storage-utils.ts"],"names":[],"mappings":";;;AAIA,SAAgB,aAAa,CAAC,GAAW;IACvC,MAAM,CAAC,cAAc,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC;AACxC,CAAC;AAFD,sCAEC;AAED,SAAgB,YAAY,CAAC,GAAW,EAAE,KAAmB,EAAE,IAAsB;IACnF,MAAM,WAAW,GAAgD;QAC/D,MAAM,EAAE,GAAG,EAAE,CAAC,KAAe;QAC7B,MAAM,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC;QAC3B,MAAM,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC;KACpC,CAAC;IAEF,MAAM,WAAW,GAAG,WAAW,CAAC,IAAI,CAAC,EAAE,CAAC;IAExC,MAAM,CAAC,cAAc,CAAC,OAAO,CAAC,GAAG,EAAE,WAAW,CAAC,CAAC;AAClD,CAAC;AAVD,oCAUC;AAED,SAAgB,WAAW,CAAC,GAAW,EAAE,IAAsB;IAC7D,MAAM,KAAK,GAAkB,MAAM,CAAC,cAAc,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IAEhE,IAAI,KAAK,KAAK,IAAI,EAAE;QAClB,OAAO;KACR;IAED,MAAM,OAAO,GAAG;QACd,MAAM,EAAE,GAAG,EAAE,CAAC,KAAK;QACnB,MAAM,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC;QAC3B,MAAM,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC;KAChC,CAAC;IAEF,OAAO,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC;AACzB,CAAC;AAdD,kCAcC"}
|
package/utils/utils.js
CHANGED
|
@@ -1,6 +1,11 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.formatDateAsLongString = void 0;
|
|
4
|
+
const formatDateAsLongString = (date) => {
|
|
2
5
|
const ye = new Intl.DateTimeFormat('it', { year: 'numeric' }).format(date);
|
|
3
6
|
const mo = new Intl.DateTimeFormat('it', { month: 'long' }).format(date);
|
|
4
7
|
const da = new Intl.DateTimeFormat('it', { day: '2-digit' }).format(date);
|
|
5
8
|
return `${da} ${mo} ${ye}`;
|
|
6
9
|
};
|
|
10
|
+
exports.formatDateAsLongString = formatDateAsLongString;
|
|
11
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/lib/utils/utils.ts"],"names":[],"mappings":";;;AAAO,MAAM,sBAAsB,GAAG,CAAC,IAAU,EAAU,EAAE;IAEzD,MAAM,EAAE,GAAG,IAAI,IAAI,CAAC,cAAc,CAAC,IAAI,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IAC3E,MAAM,EAAE,GAAG,IAAI,IAAI,CAAC,cAAc,CAAC,IAAI,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IACzE,MAAM,EAAE,GAAG,IAAI,IAAI,CAAC,cAAc,CAAC,IAAI,EAAE,EAAE,GAAG,EAAE,SAAS,EAAE,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IAE1E,OAAO,GAAG,EAAE,IAAI,EAAE,IAAI,EAAE,EAAE,CAAC;AAC/B,CAAC,CAAC;AAPW,QAAA,sBAAsB,0BAOjC"}
|