@pagopa/selfcare-common-frontend 1.5.12 → 1.5.15

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 CHANGED
@@ -4,8 +4,28 @@ All notable changes to this project will be documented in this file. Dates are d
4
4
 
5
5
  Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
6
6
 
7
+ #### [v1.5.15](https://github.com/pagopa/selfcare-common-frontend/compare/v1.5.14...v1.5.15)
8
+
9
+ - SessionModal message can accept ReactNode [`#43`](https://github.com/pagopa/selfcare-common-frontend/pull/43)
10
+ - Bump url-parse from 1.5.7 to 1.5.10 [`#42`](https://github.com/pagopa/selfcare-common-frontend/pull/42)
11
+ - Bump urijs from 1.19.7 to 1.19.8 [`#41`](https://github.com/pagopa/selfcare-common-frontend/pull/41)
12
+
13
+ #### [v1.5.14](https://github.com/pagopa/selfcare-common-frontend/compare/v1.5.13...v1.5.14)
14
+
15
+ > 23 February 2022
16
+
17
+ - Exporting utils fakePagination functions [`#40`](https://github.com/pagopa/selfcare-common-frontend/pull/40)
18
+
19
+ #### [v1.5.13](https://github.com/pagopa/selfcare-common-frontend/compare/v1.5.12...v1.5.13)
20
+
21
+ > 23 February 2022
22
+
23
+ - storageOpsBuilder + token and user storageOps methods [`#39`](https://github.com/pagopa/selfcare-common-frontend/pull/39)
24
+
7
25
  #### [v1.5.12](https://github.com/pagopa/selfcare-common-frontend/compare/v1.5.11...v1.5.12)
8
26
 
27
+ > 23 February 2022
28
+
9
29
  - storage-utils can writes to local storage [`#38`](https://github.com/pagopa/selfcare-common-frontend/pull/38)
10
30
 
11
31
  #### [v1.5.11](https://github.com/pagopa/selfcare-common-frontend/compare/v1.5.10...v1.5.11)
package/README.md CHANGED
@@ -141,12 +141,6 @@ If emptyResponseHttpStatus is not null and the returned status is equal to empt
141
141
  Other statuses will return will throw a generic error.
142
142
 
143
143
  ## constants
144
- ### STORAGE_KEY_USER: string
145
- The key used to store in the session storage the loggedUser in selfcare projects
146
-
147
- ### STORAGE_KEY_TOKEN: string
148
- The key used to store in the session storage the logged user token in selfcare projects
149
-
150
144
  ### roleLabels: { [key in UserRole]: { shortLabel: string; longLabel: string } }
151
145
  The short and long labels used for the roles of selfcare's projects
152
146
 
@@ -163,10 +157,13 @@ If local is true, it will use the local session storage instead.
163
157
  It will store a key/value pair in the session storage.
164
158
  If local is true, it will use the local session storage instead.
165
159
 
166
- ### function storageRead: (key: string, type: StorageValueType, local?: boolean) => void
160
+ ### storageRead: (key: string, type: StorageValueType, local?: boolean) => void
167
161
  It will read a key from the session storage.
168
162
  If local is true, it will use the local session storage instead.
169
163
 
164
+ ### storageOpsBuilder(key: string, type: StorageValueType, local: boolean): StorageOps
165
+ It will build an object containing a complete set of operation to perform on the same key.
166
+
170
167
  ## utils
171
168
  ### formatDateAsLongString: (date: Date) => string
172
169
  It will return a string representing the provided date in the italian format gg mmm aaaa
@@ -174,6 +171,13 @@ It will return a string representing the provided date in the italian format gg
174
171
  ## fixSwagger20ArraySchemaDef.js
175
172
  An utility script to use when generating the stub through @pagopa/openapi-codegen-ts in order to handle the REST api whose operations returns an array of objects
176
173
 
174
+ ## storage
175
+ ### storageTokenOps
176
+ An object containing a complete set of operation on the storage regarding the key used to store in the storage the loggedUser token in selfcare projects.
177
+
178
+ ### storageUserOps
179
+ An object containing a complete set of operation on the storage regarding the key used to store in the storage the loggedUser in selfcare projects.
180
+
177
181
  # Decorators
178
182
  ## withLogin
179
183
  This feature is based on react-redux library and require to register the reducer build in userSlice into the application's redux store.
package/build.info CHANGED
@@ -1,2 +1,2 @@
1
- 20220223.1 - selfcare-common-frontend.deploy(21349)
2
- tags/v1.5.12^0 7f7fd366bd7b9ff1cfe4f041dfa0382e097dd0b7
1
+ 20220228.1 - selfcare-common-frontend.deploy(21838)
2
+ tags/v1.5.15^0 9850f39b8f4d90907b9862c27b2aee21f52c45e3
@@ -11,7 +11,7 @@ const ClearOutlined_1 = (0, tslib_1.__importDefault)(require("@mui/icons-materia
11
11
  function SessionModal({ open, title, message, onConfirm, onConfirmLabel = 'Riprova', handleClose, handleExit = handleClose, onCloseLabel = 'Annulla', height, minHeight, width = '21.9em', }) {
12
12
  const theme = (0, styles_1.useTheme)();
13
13
  const fullScreen = (0, useMediaQuery_1.default)(theme.breakpoints.down('xs'));
14
- return ((0, jsx_runtime_1.jsx)(Dialog_1.default, Object.assign({ fullScreen: fullScreen, open: open, onClose: handleClose, "aria-labelledby": "responsive-dialog-title" }, { children: (0, jsx_runtime_1.jsx)(material_1.Grid, Object.assign({ container: true, direction: "column", sx: { height, minHeight, width } }, { children: (0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ mx: 3, sx: { height: '100%' } }, { children: [(0, jsx_runtime_1.jsx)(material_1.Grid, Object.assign({ container: true, item: true, mt: 4 }, { children: (0, jsx_runtime_1.jsxs)(material_1.Grid, Object.assign({ item: true, xs: 10 }, { children: [(0, jsx_runtime_1.jsx)(material_1.IconButton, Object.assign({ onClick: handleExit, style: { position: 'absolute', top: '20px', right: '16px', zIndex: 100 } }, { children: (0, jsx_runtime_1.jsx)(ClearOutlined_1.default, {}, void 0) }), void 0), (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "h5", sx: { fontSize: '18px', fontWeight: '600' } }, { children: title }), void 0)] }), void 0) }), void 0), (0, jsx_runtime_1.jsx)(material_1.Grid, Object.assign({ container: true, item: true }, { children: (0, jsx_runtime_1.jsx)(material_1.Grid, Object.assign({ item: true, xs: 12, my: 3 }, { children: (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "body2" }, { children: message }), void 0) }), void 0) }), void 0), onConfirm && ((0, jsx_runtime_1.jsx)(material_1.Grid, Object.assign({ item: true, xs: 12, mb: 2 }, { children: (0, jsx_runtime_1.jsx)(material_1.Button, Object.assign({ sx: { width: '100%' }, color: "primary", variant: "contained", onClick: onConfirm }, { children: onConfirmLabel }), void 0) }), void 0)), (0, jsx_runtime_1.jsx)(material_1.Grid, Object.assign({ item: true, xs: 12, mb: 3, mt: onConfirm ? 0 : 7 }, { children: (0, jsx_runtime_1.jsx)(material_1.Button, Object.assign({ onClick: handleClose, sx: { width: '100%' }, color: "primary", variant: "outlined" }, { children: onCloseLabel }), void 0) }), void 0)] }), void 0) }), void 0) }), void 0));
14
+ return ((0, jsx_runtime_1.jsx)(Dialog_1.default, Object.assign({ fullScreen: fullScreen, open: open, onClose: handleClose, "aria-labelledby": "responsive-dialog-title" }, { children: (0, jsx_runtime_1.jsx)(material_1.Grid, Object.assign({ container: true, direction: "column", sx: { height, minHeight, width } }, { children: (0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ mx: 3, sx: { height: '100%' } }, { children: [(0, jsx_runtime_1.jsx)(material_1.Grid, Object.assign({ container: true, item: true, mt: 4 }, { children: (0, jsx_runtime_1.jsxs)(material_1.Grid, Object.assign({ item: true, xs: 10 }, { children: [(0, jsx_runtime_1.jsx)(material_1.IconButton, Object.assign({ onClick: handleExit, style: { position: 'absolute', top: '20px', right: '16px', zIndex: 100 } }, { children: (0, jsx_runtime_1.jsx)(ClearOutlined_1.default, {}, void 0) }), void 0), (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "h5", sx: { fontSize: '18px', fontWeight: '600' } }, { children: title }), void 0)] }), void 0) }), void 0), (0, jsx_runtime_1.jsx)(material_1.Grid, Object.assign({ container: true, item: true }, { children: (0, jsx_runtime_1.jsx)(material_1.Grid, Object.assign({ item: true, xs: 12, my: 3 }, { children: (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ component: "div", variant: "body2" }, { children: message }), void 0) }), void 0) }), void 0), onConfirm && ((0, jsx_runtime_1.jsx)(material_1.Grid, Object.assign({ item: true, xs: 12, mb: 2 }, { children: (0, jsx_runtime_1.jsx)(material_1.Button, Object.assign({ sx: { width: '100%' }, color: "primary", variant: "contained", onClick: onConfirm }, { children: onConfirmLabel }), void 0) }), void 0)), (0, jsx_runtime_1.jsx)(material_1.Grid, Object.assign({ item: true, xs: 12, mb: 3, mt: 0 }, { children: (0, jsx_runtime_1.jsx)(material_1.Button, Object.assign({ onClick: handleClose, sx: { width: '100%' }, color: "primary", variant: "outlined" }, { children: onCloseLabel }), void 0) }), void 0)] }), void 0) }), void 0) }), void 0));
15
15
  }
16
16
  exports.default = SessionModal;
17
17
  //# sourceMappingURL=SessionModal.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"SessionModal.js","sourceRoot":"","sources":["../../src/lib/components/SessionModal.tsx"],"names":[],"mappings":";;;;AACA,4CAA0E;AAC1E,+EAA0C;AAC1C,6FAAwD;AACxD,iDAAgD;AAChD,mGAAkE;AA2BlE,uBAAuB;AACvB,SAAwB,YAAY,CAAC,EACnC,IAAI,EACJ,KAAK,EACL,OAAO,EACP,SAAS,EACT,cAAc,GAAG,SAAS,EAC1B,WAAW,EACX,UAAU,GAAG,WAAW,EACxB,YAAY,GAAG,SAAS,EACxB,MAAM,EACN,SAAS,EACT,KAAK,GAAG,QAAQ,GACV;IACN,MAAM,KAAK,GAAG,IAAA,iBAAQ,GAAE,CAAC;IACzB,MAAM,UAAU,GAAG,IAAA,uBAAa,EAAC,KAAK,CAAC,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;IAE/D,OAAO,CACL,uBAAC,gBAAM,kBACL,UAAU,EAAE,UAAU,EACtB,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,WAAW,qBACJ,yBAAyB,gBAEzC,uBAAC,eAAI,kBAAC,SAAS,QAAC,SAAS,EAAC,QAAQ,EAAC,EAAE,EAAE,EAAE,MAAM,EAAE,SAAS,EAAE,KAAK,EAAE,gBACjE,wBAAC,cAAG,kBAAC,EAAE,EAAE,CAAC,EAAE,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,iBAChC,uBAAC,eAAI,kBAAC,SAAS,QAAC,IAAI,QAAC,EAAE,EAAE,CAAC,gBACxB,wBAAC,eAAI,kBAAC,IAAI,QAAC,E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,EAAE,QAAQ,EAAE,MAAM,EAAE,UAAU,EAAE,KAAK,EAAE,gBACjE,KAAK,YACK,aACR,YACF,EAEP,uBAAC,eAAI,kBAAC,SAAS,QAAC,IAAI,sBAClB,uBAAC,eAAI,kBAAC,IAAI,QAAC,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,gBACtB,uBAAC,qBAAU,kBAAC,SAAS,EAAC,KAAK,EAAC,OAAO,EAAC,OAAO,gBACxC,OAAO,YACG,YACR,YACF,EAEN,SAAS,IAAI,CACZ,uBAAC,eAAI,kBAAC,IAAI,QAAC,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,gBACtB,uBAAC,iBAAM,kBACL,EAAE,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,EACrB,KAAK,EAAC,SAAS,EACf,OAAO,EAAC,WAAW,EACnB,OAAO,EAAE,SAAS,gBAEjB,cAAc,YACR,YACJ,CACR,EAED,uBAAC,eAAI,kBAAC,IAAI,QAAC,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,gBAC7B,uBAAC,iBAAM,kBAAC,OAAO,EAAE,WAAW,EAAE,EAAE,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE,KAAK,EAAC,SAAS,EAAC,OAAO,EAAC,UAAU,gBACpF,YAAY,YACN,YACJ,aACH,YACD,YACA,CACV,CAAC;AACJ,CAAC;AArED,+BAqEC"}
@@ -1,5 +1,7 @@
1
1
  import { PageRequest } from '../model/PageRequest';
2
2
  import { PageResource } from '../model/PageResource';
3
+ export declare const extractPageRequest: <T extends Record<string, any>>(data: T[], pageRequest: PageRequest) => PageResource<T>;
4
+ export declare const applySort: <T extends Record<string, any>>(data: T[], sort: string) => void;
3
5
  /**
4
6
  * 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.
5
7
  * Cached values are stored using useRef, so they are local to the component using this hook.
@@ -1,5 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.applySort = exports.extractPageRequest = void 0;
3
4
  const react_1 = require("react");
4
5
  const toPageResource = (content, page, size, totalElements) => ({
5
6
  content,
@@ -16,6 +17,7 @@ const extractPageRequest = (data, pageRequest) => {
16
17
  ? data.slice(firstIndex, firstIndex + pageRequest.size)
17
18
  : [], pageRequest.page, pageRequest.size, data.length);
18
19
  };
20
+ exports.extractPageRequest = extractPageRequest;
19
21
  const applySort = (data, sort) => {
20
22
  const sortConfiguration = sort.split(' ').map((order) => {
21
23
  const [key, direction] = order.split(',');
@@ -32,6 +34,7 @@ const applySort = (data, sort) => {
32
34
  return 0;
33
35
  });
34
36
  };
37
+ exports.applySort = applySort;
35
38
  /**
36
39
  * 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.
37
40
  * Cached values are stored using useRef, so they are local to the component using this hook.
@@ -42,7 +45,7 @@ const useFakePagination = (fetch) => {
42
45
  const cachedDataSort = (0, react_1.useRef)();
43
46
  const checkAndApplySort = (sort) => {
44
47
  if (sort && cachedDataSort.current !== sort) {
45
- applySort(cachedData.current, sort);
48
+ (0, exports.applySort)(cachedData.current, sort);
46
49
  // eslint-disable-next-line functional/immutable-data
47
50
  cachedDataSort.current = sort;
48
51
  }
@@ -50,14 +53,14 @@ const useFakePagination = (fetch) => {
50
53
  return (pageRequest, filterChanged) => {
51
54
  if (!filterChanged && cachedData.current) {
52
55
  checkAndApplySort(pageRequest.sort);
53
- return new Promise((resolve) => setTimeout(() => resolve(extractPageRequest(cachedData.current, pageRequest)), 100));
56
+ return new Promise((resolve) => setTimeout(() => resolve((0, exports.extractPageRequest)(cachedData.current, pageRequest)), 100));
54
57
  }
55
58
  else {
56
59
  return fetch().then((results) => {
57
60
  // eslint-disable-next-line functional/immutable-data
58
61
  cachedData.current = results;
59
62
  checkAndApplySort(pageRequest.sort);
60
- return extractPageRequest(cachedData.current, pageRequest);
63
+ return (0, exports.extractPageRequest)(cachedData.current, pageRequest);
61
64
  });
62
65
  }
63
66
  };
@@ -1 +1 @@
1
- {"version":3,"file":"useFakePagination.js","sourceRoot":"","sources":["../../src/lib/hooks/useFakePagination.ts"],"names":[],"mappings":";;AAAA,iCAA+B;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,kBAAkB,GAAG,CACzB,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,SAAS,GAAG,CAAgC,IAAc,EAAE,IAAY,EAAE,EAAE;IAChF,MAAM,iBAAiB,GAAyC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE;QAC5F,MAAM,CAAC,GAAG,EAAE,SAAS,CAAC,GAAG,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QAC1C,OAAO,EAAE,GAAG,EAAE,GAAG,EAAE,S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AAC,OAAO,KAAK,IAAI,EAAE;YAC3C,IAAA,iBAAS,EAAC,UAAU,CAAC,OAAmB,EAAE,IAAI,CAAC,CAAC;YAChD,qDAAqD;YACrD,cAAc,CAAC,OAAO,GAAG,IAAI,CAAC;SAC/B;IACH,CAAC,CAAC;IAEF,OAAO,CAAC,WAAwB,EAAE,aAAsB,EAA4B,EAAE;QACpF,IAAI,CAAC,aAAa,IAAI,UAAU,CAAC,OAAO,EAAE;YACxC,iBAAiB,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;YACpC,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAC7B,UAAU,CACR,GAAG,EAAE,CAAC,OAAO,CAAC,IAAA,0BAAkB,EAAC,UAAU,CAAC,OAAmB,EAAE,WAAW,CAAC,CAAC,EAC9E,GAAG,CACJ,CACF,CAAC;SACH;aAAM;YACL,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,IAAA,0BAAkB,EAAC,UAAU,CAAC,OAAO,EAAE,WAAW,CAAC,CAAC;YAC7D,CAAC,CAAC,CAAC;SACJ;IACH,CAAC,CAAC;AACJ,CAAC,CAAC;AAEF,kBAAe,iBAAiB,CAAC"}
package/hooks/useLogin.js CHANGED
@@ -4,10 +4,9 @@ exports.useLogin = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const isEmpty_1 = (0, tslib_1.__importDefault)(require("lodash/isEmpty"));
6
6
  const react_redux_1 = require("react-redux");
7
- const storage_utils_1 = require("../utils/storage-utils");
8
7
  const env_1 = require("../config/env");
9
- const constants_1 = require("../utils/constants");
10
8
  const userSlice_1 = require("../redux/slices/userSlice");
9
+ const storage_1 = require("../utils/storage");
11
10
  const testToken = 'eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCIsImtpZCI6Imp3dF9kZjplNjoxOTplYToxZTpjZTplNjo3Yjo3MDo0MjoyYzphMjpjZDo4Yjo1MjowYiJ9.eyJlbWFpbCI6ImZ1cmlvdml0YWxlQG1hcnRpbm8uaXQiLCJmYW1pbHlfbmFtZSI6IlNhcnRvcmkiLCJmaXNjYWxfbnVtYmVyIjoiU1JUTkxNMDlUMDZHNjM1UyIsIm5hbWUiOiJBbnNlbG1vIiwiZnJvbV9hYSI6ZmFsc2UsInVpZCI6IjliMTdjZTcwLWY3OWYtNDJkOS04YjBlLTRlN2ViNGQ4ODA3NCIsImxldmVsIjoiTDIiLCJpYXQiOjE2Mzk1OTI2NTMsImlzcyI6IlNQSUQiLCJqdGkiOiIwMUZQWk5DV1c0RFhIQ0JZNFlHVFBKTkM2UiJ9.Cz6bZ1degD0APpJS3rfLPdjpjBE9JBGByVoLcFtqGhDxRAOhP_5aKqE0-1S9u9QUCakmhLA8i1auV7ImP8CLMaJTyUGUwz85yYL9KgqcRZ9qsYghFDqBQsh-n5_4Ldsu1-vBp2klwpJA87ppdzEyLZnSp6kUhpytFf00XtmSOYvt6-OMI6K6bBVFGXk_IYGs4KHx3-fij1DGg-_8BhghtkvJVyC2p9R4XezT8oXg55H-sBigTPdk9LssDa75Pj91zwPrbwTOBp9Tgk0HqOgieEDDpIuVplJI2uaq9YpDNyZkR8RnkSV072gPWlrJXDEb1-zXty7nT8NcGdRGTHDkkQ';
12
11
  const mockedUser = {
13
12
  uid: '0',
@@ -22,15 +21,15 @@ const useLogin = () => {
22
21
  const attemptSilentLogin = async () => {
23
22
  if (env_1.CONFIG.MOCKS.MOCK_USER) {
24
23
  setUser(mockedUser);
25
- (0, storage_utils_1.storageWrite)(constants_1.STORAGE_KEY_TOKEN, testToken, 'string');
26
- (0, storage_utils_1.storageWrite)(constants_1.STORAGE_KEY_USER, mockedUser, 'object');
24
+ storage_1.storageTokenOps.write(testToken);
25
+ storage_1.storageUserOps.write(mockedUser);
27
26
  return;
28
27
  }
29
- const sessionStorageUser = (0, storage_utils_1.storageRead)(constants_1.STORAGE_KEY_USER, 'object');
28
+ const sessionStorageUser = storage_1.storageUserOps.read();
30
29
  // If there are no credentials, it is impossible to get the user, so
31
30
  if ((0, isEmpty_1.default)(sessionStorageUser)) {
32
31
  // Remove any partial data that might have remained, just for safety
33
- (0, storage_utils_1.storageDelete)(constants_1.STORAGE_KEY_USER);
32
+ storage_1.storageUserOps.delete();
34
33
  // Go to the login view
35
34
  window.location.assign(env_1.CONFIG.URL_FE.LOGIN);
36
35
  // This return is necessary
@@ -1 +1 @@
1
- {"version":3,"file":"useLogin.js","sourceRoot":"","sources":["../../src/lib/hooks/useLogin.ts"],"names":[],"mappings":";;;;AAAA,0EAAqC;AACrC,6CAA0C;AAC1C,0DAAkF;AAClF,uCAAuC;AACvC,kDAAyE;AAEzE,yDAAwD;AAExD,MAAM,SAAS,GACb,0xBAA0xB,CAAC;AAE7xB,MAAM,UAAU,GAAE;IAChB,GAAG,EAAE,GAAG;IACR,OAAO,EAAE,kBAAkB;IAC3B,IAAI,EAAE,YAAY;IAClB,OAAO,EAAE,eAAe;IACxB,KAAK,EAAE,mBAAmB;CAC3B,CAAC;AAEK,MAAM,QAAQ,GAAG,GAAG,EAAE;IAC3B,MAAM,QAAQ,GAAG,IAAA,yBAAW,GAAE,CAAC;IAC/B,MAAM,OAAO,GAAG,CAAC,IAAU,EAAE,EAAE,CAAC,QAAQ,CAAC,uBAAW,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC,CAAC;IAE1E,MAAM,kBAAkB,GAAG,KAAK,IAAI,EAAE;QACpC,IAAI,YAAM,CAAC,KAAK,CAAC,SAAS,EAAE;YAC1B,OAAO,CAAC,UAAU,CAAC,CAAC;YACpB,IAAA,4BAAY,EAAC,6BAAiB,EAAE,SAAS,EAAE,QAAQ,CAAC,CAAC;YACrD,IAAA,4BAAY,EAAC,4BAAgB,EAAE,UAAU,EAAE,QAAQ,CAAC,CAAC;YACrD,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AAK,CAAC,SAAS,CAAC,CAAC;YACjC,wBAAc,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC;YACjC,OAAO;SACR;QAED,MAAM,kBAAkB,GAAG,wBAAc,CAAC,IAAI,EAAE,CAAC;QAEjD,oEAAoE;QACpE,IAAI,IAAA,iBAAO,EAAC,kBAAkB,CAAC,EAAE;YAC/B,oEAAoE;YACpE,wBAAc,CAAC,MAAM,EAAE,CAAC;YACxB,uBAAuB;YACvB,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,YAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;YAC5C,2BAA2B;YAC3B,OAAO;SACR;QAED,2DAA2D;QAC3D,OAAO,CAAC,kBAAkB,CAAC,CAAC;IAC9B,CAAC,CAAC;IAEF,OAAO,EAAE,kBAAkB,EAAE,CAAC;AAChC,CAAC,CAAC;AA7BW,QAAA,QAAQ,YA6BnB"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@pagopa/selfcare-common-frontend",
3
3
  "description": "Shared React components for the pagopa selfcare project",
4
- "version": "1.5.12",
4
+ "version": "1.5.15",
5
5
  "license": "MIT",
6
6
  "repository": "https://github.com/pagopa/selfcare-common-frontend",
7
7
  "author": "https://www.pagopa.gov.it",
@@ -4,11 +4,10 @@ exports.buildAssistanceURI = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const isEmpty_1 = (0, tslib_1.__importDefault)(require("lodash/isEmpty"));
6
6
  const env_1 = require("../config/env");
7
- const storage_utils_1 = require("../utils/storage-utils");
8
- const constants_1 = require("../utils/constants");
7
+ const storage_1 = require("../utils/storage");
9
8
  const analyticsService_1 = require("./analyticsService");
10
9
  const buildAssistanceURI = (assistanceEmail) => {
11
- const sessionStorageUser = (0, storage_utils_1.storageRead)(constants_1.STORAGE_KEY_USER, 'object');
10
+ const sessionStorageUser = storage_1.storageUserOps.read();
12
11
  if ((0, isEmpty_1.default)(sessionStorageUser)) {
13
12
  (0, analyticsService_1.trackEvent)('CUSTOMER_CARE_MAILTO');
14
13
  return `mailto:${assistanceEmail}`;
@@ -1 +1 @@
1
- {"version":3,"file":"assistanceService.js","sourceRoot":"","sources":["../../src/lib/services/assistanceService.ts"],"names":[],"mappings":";;;;AAAA,0EAAqC;AACrC,uCAAuC;AACvC,0DAAqD;AACrD,kDAAsD;AACtD,yDAAgD;AAEzC,MAAM,kBAAkB,GAAG,CAAC,eAAwB,EAAE,EAAE;IAC7D,MAAM,kBAAkB,GAAG,IAAA,2BAAW,EAAC,4BAAgB,EAAE,QAAQ,CAAC,CAAC;IAEnE,IAAI,IAAA,iBAAO,EAAC,kBAAkB,CAAC,EAAE;QAC/B,IAAA,6BAAU,EAAC,sBAAsB,CAAC,CAAC;QACnC,OAAO,UAAU,eAAe,EAAE,CAAC;KACpC;SAAM;QACL,OAAO,YAAM,CAAC,MAAM,CAAC,UAAU,CAAC;KACjC;AACH,CAAC,CAAC;AATW,QAAA,kBAAkB,sBAS7B"}
1
+ {"version":3,"file":"assistanceService.js","sourceRoot":"","sources":["../../src/lib/services/assistanceService.ts"],"names":[],"mappings":";;;;AAAA,0EAAqC;AACrC,uCAAuC;AACvC,8CAAkD;AAClD,yDAAgD;AAEzC,MAAM,kBAAkB,GAAG,CAAC,eAAwB,EAAE,EAAE;IAC7D,MAAM,kBAAkB,GAAG,wBAAc,CAAC,IAAI,EAAE,CAAC;IAEjD,IAAI,IAAA,iBAAO,EAAC,kBAAkB,CAAC,EAAE;QAC/B,IAAA,6BAAU,EAAC,sBAAsB,CAAC,CAAC;QACnC,OAAO,UAAU,eAAe,EAAE,CAAC;KACpC;SAAM;QACL,OAAO,YAAM,CAAC,MAAM,CAAC,UAAU,CAAC;KACjC;AACH,CAAC,CAAC;AATW,QAAA,kBAAkB,sBAS7B"}
@@ -1,8 +1,4 @@
1
1
  import { UserRole } from '../model/Party';
2
- /** The key used to store in the session storage the loggedUser in selfcare projects */
3
- export declare const STORAGE_KEY_USER = "user";
4
- /** The key used to store in the session storage the logged user token in selfcare projects */
5
- export declare const STORAGE_KEY_TOKEN = "token";
6
2
  export declare const LOADING_TASK_LOGIN_CHECK = "LOGIN_CHECK";
7
3
  export declare const LOADING_TASK_RETRIEVE_CACHED_VALUES = "RETRIEVE_CACHED_VALUES";
8
4
  /** The short and long labels used for the roles of selfcare's projects */
@@ -1,10 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.roleLabels = exports.LOADING_TASK_RETRIEVE_CACHED_VALUES = exports.LOADING_TASK_LOGIN_CHECK = exports.STORAGE_KEY_TOKEN = exports.STORAGE_KEY_USER = void 0;
4
- /** The key used to store in the session storage the loggedUser in selfcare projects */
5
- exports.STORAGE_KEY_USER = 'user';
6
- /** The key used to store in the session storage the logged user token in selfcare projects */
7
- exports.STORAGE_KEY_TOKEN = 'token';
3
+ exports.roleLabels = exports.LOADING_TASK_RETRIEVE_CACHED_VALUES = exports.LOADING_TASK_LOGIN_CHECK = void 0;
8
4
  exports.LOADING_TASK_LOGIN_CHECK = 'LOGIN_CHECK';
9
5
  exports.LOADING_TASK_RETRIEVE_CACHED_VALUES = 'RETRIEVE_CACHED_VALUES';
10
6
  /** The short and long labels used for the roles of selfcare's projects */
@@ -1 +1 @@
1
- {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/lib/utils/constants.ts"],"names":[],"mappings":";;;AAEA,uFAAuF;AAC1E,QAAA,gBAAgB,GAAG,MAAM,CAAC;AACvC,8FAA8F;AACjF,QAAA,iBAAiB,GAAG,OAAO,CAAC;AAE5B,QAAA,wBAAwB,GAAG,aAAa,CAAC;AACzC,QAAA,mCAAmC,GAAG,wBAAwB,CAAC;AAE5E,0EAA0E;AAC7D,QAAA,UAAU,GAEnB;IACF,KAAK,EAAE;QACL,UAAU,EAAE,qBAAqB;QACjC,SAAS,EAAE,0BAA0B;QACrC,WAAW,EAAE,yCAAyC;KACvD;IACD,OAAO,EAAE;QACP,UAAU,EAAE,gBAAgB;QAC5B,SAAS,EAAE,qBAAqB;QAChC,WAAW,EAAE,oBAAoB;KAClC;CACF,CAAC"}
1
+ {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/lib/utils/constants.ts"],"names":[],"mappings":";;;AAEa,QAAA,wBAAwB,GAAG,aAAa,CAAC;AACzC,QAAA,mCAAmC,GAAG,wBAAwB,CAAC;AAE5E,0EAA0E;AAC7D,QAAA,UAAU,GAEnB;IACF,KAAK,EAAE;QACL,UAAU,EAAE,qBAAqB;QACjC,SAAS,EAAE,0BAA0B;QACrC,WAAW,EAAE,yCAAyC;KACvD;IACD,OAAO,EAAE;QACP,UAAU,EAAE,gBAAgB;QAC5B,SAAS,EAAE,qBAAqB;QAChC,WAAW,EAAE,oBAAoB;KAClC;CACF,CAAC"}
@@ -6,4 +6,11 @@ export declare function storageDelete(key: string, local?: boolean): void;
6
6
  export declare function storageWrite(key: string, value: StorageValue, type: StorageValueType, local?: boolean): void;
7
7
  /** It will read a key from the session storage. If local is true, it will use the local session storage instead. */
8
8
  export declare function storageRead(key: string, type: StorageValueType, local?: boolean): any;
9
+ export declare type StorageOps<T> = {
10
+ delete: () => void;
11
+ read: () => T;
12
+ write: (value: T) => void;
13
+ };
14
+ /** Build an object with a complete set of operation to perform on the same key */
15
+ export declare function storageOpsBuilder<T extends StorageValue>(key: string, type: StorageValueType, local: boolean): StorageOps<T>;
9
16
  export {};
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.storageRead = exports.storageWrite = exports.storageDelete = void 0;
3
+ exports.storageOpsBuilder = exports.storageRead = exports.storageWrite = exports.storageDelete = void 0;
4
4
  /** It will delete a key from the session storage. If local is true, it will use the local session storage instead. */
5
5
  function storageDelete(key, local) {
6
6
  const storage = local ? window.localStorage : window.sessionStorage;
@@ -34,4 +34,13 @@ function storageRead(key, type, local) {
34
34
  return parseFn[type]();
35
35
  }
36
36
  exports.storageRead = storageRead;
37
+ /** Build an object with a complete set of operation to perform on the same key */
38
+ function storageOpsBuilder(key, type, local) {
39
+ return {
40
+ delete: () => storageDelete(key, local),
41
+ read: () => storageRead(key, type, local),
42
+ write: (value) => storageWrite(key, value, type, local),
43
+ };
44
+ }
45
+ exports.storageOpsBuilder = storageOpsBuilder;
37
46
  //# sourceMappingURL=storage-utils.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"storage-utils.js","sourceRoot":"","sources":["../../src/lib/utils/storage-utils.ts"],"names":[],"mappings":";;;AAIA,sHAAsH;AACtH,SAAgB,aAAa,CAAC,GAAW,EAAE,KAAe;IACxD,MAAM,OAAO,GAAY,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC,CAAC,MAAM,CAAC,cAAc,CAAC;IAC7E,OAAO,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC;AAC1B,CAAC;AAHD,sCAGC;AAED,8HAA8H;AAC9H,SAAgB,YAAY,CAC1B,GAAW,EACX,KAAmB,EACnB,IAAsB,EACtB,KAAe;IAEf,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,OAAO,GAAY,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC,CAAC,MAAM,CAAC,cAAc,CAAC;IAC7E,OAAO,CAAC,OAAO,CAAC,GAAG,EAAE,WAAW,CAAC,CAAC;AACpC,CAAC;AAhBD,oCAgBC;AAED,oHAAoH;AACpH,SAAgB,WAAW,CAAC,GAAW,EAAE,IAAsB,EAAE,KAAe;IAC9E,MAAM,OAAO,GAAY,KAAK,CAAC,CAAC,CAAC,MAAM,CA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CAAC,cAAc,CAAC;IAC7E,OAAO,CAAC,OAAO,CAAC,GAAG,EAAE,WAAW,CAAC,CAAC;AACpC,CAAC;AAhBD,oCAgBC;AAED,oHAAoH;AACpH,SAAgB,WAAW,CAAC,GAAW,EAAE,IAAsB,EAAE,KAAe;IAC9E,MAAM,OAAO,GAAY,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC,CAAC,MAAM,CAAC,cAAc,CAAC;IAC7E,MAAM,KAAK,GAAkB,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IAElD,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;AAfD,kCAeC;AAQD,kFAAkF;AAClF,SAAgB,iBAAiB,CAC/B,GAAW,EACX,IAAsB,EACtB,KAAc;IAEd,OAAO;QACL,MAAM,EAAE,GAAG,EAAE,CAAC,aAAa,CAAC,GAAG,EAAE,KAAK,CAAC;QACvC,IAAI,EAAE,GAAG,EAAE,CAAC,WAAW,CAAC,GAAG,EAAE,IAAI,EAAE,KAAK,CAAC;QACzC,KAAK,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,YAAY,CAAC,GAAG,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,CAAC;KACxD,CAAC;AACJ,CAAC;AAVD,8CAUC"}
@@ -0,0 +1,5 @@
1
+ import { User } from '../model/User';
2
+ /** An object containing a complete set of operation on the storage regarding the key used to store in the storage the loggedUser token in selfcare projects */
3
+ export declare const storageTokenOps: import("./storage-utils").StorageOps<string>;
4
+ /** An object containing a complete set of operation on the storage regarding the key used to store in the storage the loggedUser in selfcare projects */
5
+ export declare const storageUserOps: import("./storage-utils").StorageOps<User>;
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.storageUserOps = exports.storageTokenOps = void 0;
4
+ const storage_utils_1 = require("./storage-utils");
5
+ /** An object containing a complete set of operation on the storage regarding the key used to store in the storage the loggedUser token in selfcare projects */
6
+ exports.storageTokenOps = (0, storage_utils_1.storageOpsBuilder)('token', 'string', true);
7
+ /** An object containing a complete set of operation on the storage regarding the key used to store in the storage the loggedUser in selfcare projects */
8
+ exports.storageUserOps = (0, storage_utils_1.storageOpsBuilder)('user', 'object', true);
9
+ //# sourceMappingURL=storage.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"storage.js","sourceRoot":"","sources":["../../src/lib/utils/storage.ts"],"names":[],"mappings":";;;AACA,mDAAoD;AAEpD,+JAA+J;AAClJ,QAAA,eAAe,GAAG,IAAA,iCAAiB,EAAS,OAAO,EAAE,QAAQ,EAAE,IAAI,CAAC,CAAC;AAClF,yJAAyJ;AAC5I,QAAA,cAAc,GAAG,IAAA,iCAAiB,EAAO,MAAM,EAAE,QAAQ,EAAE,IAAI,CAAC,CAAC"}