@pagopa/selfcare-common-frontend 1.34.60 → 1.34.62
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 +19 -2
- package/build.info +2 -2
- package/lib/utils/api-utils.d.ts +1 -1
- package/lib/utils/api-utils.js +12 -2
- package/lib/utils/api-utils.js.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -4,8 +4,10 @@ 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.34.
|
|
7
|
+
#### [v1.34.62](https://github.com/pagopa/selfcare-common-frontend/compare/v1.35.0...v1.34.62)
|
|
8
8
|
|
|
9
|
+
- handle status code 403 [`#288`](https://github.com/pagopa/selfcare-common-frontend/pull/288)
|
|
10
|
+
- [SELC-7070] feat: handle list of success codes [`#287`](https://github.com/pagopa/selfcare-common-frontend/pull/287)
|
|
9
11
|
- [SELC-6995] feat: make the content of the diaolog avaible to the screen reader [`#286`](https://github.com/pagopa/selfcare-common-frontend/pull/286)
|
|
10
12
|
- [SELC-6986] feat: and new action and update mui italia [`#285`](https://github.com/pagopa/selfcare-common-frontend/pull/285)
|
|
11
13
|
- [SELC-6825] Add codeowners [`#284`](https://github.com/pagopa/selfcare-common-frontend/pull/284)
|
|
@@ -42,6 +44,7 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
|
|
42
44
|
- SELC-2590 [`#186`](https://github.com/pagopa/selfcare-common-frontend/pull/186)
|
|
43
45
|
- SELC-2590 - update common [`#185`](https://github.com/pagopa/selfcare-common-frontend/pull/185)
|
|
44
46
|
- Used a environment variable to manage correct links in the footer based to product and actual environment [`#184`](https://github.com/pagopa/selfcare-common-frontend/pull/184)
|
|
47
|
+
- [SELC-7070] feat: handle list of success codes (#287) [`#7070`](https://pagopa.atlassian.net/browse/7070)
|
|
45
48
|
- [SELC-6995] feat: make the content of the diaolog avaible to the screen reader (#286) [`#6995`](https://pagopa.atlassian.net/browse/6995)
|
|
46
49
|
- [SELC-6986] feat: and new action and update mui italia (#285) [`#6986`](https://pagopa.atlassian.net/browse/6986)
|
|
47
50
|
- [SELC-6825] Add codeowners (#284) [`#6825`](https://pagopa.atlassian.net/browse/6825)
|
|
@@ -106,10 +109,24 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
|
|
106
109
|
- Bump validator and @types/validator [`bca7ef1`](https://github.com/pagopa/selfcare-common-frontend/commit/bca7ef12f16fa24b75d5acbe5a96e1509c479b9e)
|
|
107
110
|
- Bump react and @types/react [`12e0229`](https://github.com/pagopa/selfcare-common-frontend/commit/12e02297e407502c4d1c4e97b1396e5e5de1cd9f)
|
|
108
111
|
|
|
109
|
-
#### [v1.35.0](https://github.com/pagopa/selfcare-common-frontend/compare/v1.34.
|
|
112
|
+
#### [v1.35.0](https://github.com/pagopa/selfcare-common-frontend/compare/v1.34.61...v1.35.0)
|
|
110
113
|
|
|
111
114
|
> 20 July 2023
|
|
112
115
|
|
|
116
|
+
#### [v1.34.61](https://github.com/pagopa/selfcare-common-frontend/compare/v1.34.60...v1.34.61)
|
|
117
|
+
|
|
118
|
+
> 19 June 2025
|
|
119
|
+
|
|
120
|
+
- [SELC-7070] feat: handle list of success codes [`#287`](https://github.com/pagopa/selfcare-common-frontend/pull/287)
|
|
121
|
+
- [SELC-7070] feat: handle list of success codes (#287) [`#7070`](https://pagopa.atlassian.net/browse/7070)
|
|
122
|
+
|
|
123
|
+
#### [v1.34.60](https://github.com/pagopa/selfcare-common-frontend/compare/v1.34.59...v1.34.60)
|
|
124
|
+
|
|
125
|
+
> 6 June 2025
|
|
126
|
+
|
|
127
|
+
- [SELC-6995] feat: make the content of the diaolog avaible to the screen reader [`#286`](https://github.com/pagopa/selfcare-common-frontend/pull/286)
|
|
128
|
+
- [SELC-6995] feat: make the content of the diaolog avaible to the screen reader (#286) [`#6995`](https://pagopa.atlassian.net/browse/6995)
|
|
129
|
+
|
|
113
130
|
#### [v1.34.59](https://github.com/pagopa/selfcare-common-frontend/compare/v1.34.58...v1.34.59)
|
|
114
131
|
|
|
115
132
|
> 26 May 2025
|
package/build.info
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
tags/v1.29.0~1^2
|
|
1
|
+
20250624.1 - selfcare-common-frontend.deploy(219666)
|
|
2
|
+
tags/v1.29.0~1^2 e8b39f0ff275b68191c1561ab2f054b519d9da04
|
package/lib/utils/api-utils.d.ts
CHANGED
|
@@ -13,4 +13,4 @@ If notValidTokenHttpStatus is not null and the returned status is equal to notVa
|
|
|
13
13
|
If notAuthorizedTokenHttpStatus is not null and the returned status is equal to notAuthorizedTokenHttpStatus, it will throw an Error with message "Operation not allowed".
|
|
14
14
|
If emptyResponseHttpStatus is not null and the returned status is equal to emptyResponseHttpStatus, it will return a promise that resolve to null value.
|
|
15
15
|
Other statuses will return will throw a generic error. */
|
|
16
|
-
export declare const extractResponse: <R>(response: t.Validation<TypeofApiResponse<ApiRequestType<any, any, any, IResponseType<any, any, any>>>>, successHttpStatus: number
|
|
16
|
+
export declare const extractResponse: <R>(response: t.Validation<TypeofApiResponse<ApiRequestType<any, any, any, IResponseType<any, any, any>>>>, successHttpStatus: number | Array<number>, onRedirectToLogin: () => void, notValidTokenHttpStatus?: number | null, notAuthorizedTokenHttpStatus?: number | null, emptyResponseHttpStatus?: number | null) => Promise<R>;
|
package/lib/utils/api-utils.js
CHANGED
|
@@ -32,8 +32,9 @@ If notAuthorizedTokenHttpStatus is not null and the returned status is equal to
|
|
|
32
32
|
If emptyResponseHttpStatus is not null and the returned status is equal to emptyResponseHttpStatus, it will return a promise that resolve to null value.
|
|
33
33
|
Other statuses will return will throw a generic error. */
|
|
34
34
|
const extractResponse = async (response, successHttpStatus, onRedirectToLogin, notValidTokenHttpStatus = 401, notAuthorizedTokenHttpStatus = 403, emptyResponseHttpStatus = 404) => {
|
|
35
|
+
const successCodes = Array.isArray(successHttpStatus) ? successHttpStatus : [successHttpStatus];
|
|
35
36
|
if ((0, Either_1.isRight)(response)) {
|
|
36
|
-
if (response.right.status
|
|
37
|
+
if (successCodes.includes(response.right.status)) {
|
|
37
38
|
return response.right.value;
|
|
38
39
|
}
|
|
39
40
|
else if (notValidTokenHttpStatus && response.right.status === notValidTokenHttpStatus) {
|
|
@@ -43,7 +44,16 @@ const extractResponse = async (response, successHttpStatus, onRedirectToLogin, n
|
|
|
43
44
|
}
|
|
44
45
|
else if (notAuthorizedTokenHttpStatus &&
|
|
45
46
|
response.right.status === notAuthorizedTokenHttpStatus) {
|
|
46
|
-
|
|
47
|
+
const error = new Error(`Operation not allowed!`);
|
|
48
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
49
|
+
// @ts-ignore
|
|
50
|
+
// eslint-disable-next-line functional/immutable-data
|
|
51
|
+
error.httpStatus = response.right.status;
|
|
52
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
53
|
+
// @ts-ignore
|
|
54
|
+
// eslint-disable-next-line functional/immutable-data
|
|
55
|
+
error.httpBody = response.right.value;
|
|
56
|
+
throw error;
|
|
47
57
|
}
|
|
48
58
|
else if (emptyResponseHttpStatus && response.right.status === emptyResponseHttpStatus) {
|
|
49
59
|
return Promise.resolve(null);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api-utils.js","sourceRoot":"","sources":["../../../src/lib/utils/api-utils.ts"],"names":[],"mappings":";;;AACA,6CAAoD;AAEpD,mDAA2C;AAC3C,wDAAwF;AAGxF,uCAAuC;AACvC,iEAAgE;AAEhE,gEAAgE;AACzD,MAAM,iBAAiB,GAAG,CAAC,KAAoB,EAAE,EAAE,CACxD,KAAK,CAAC,QAAQ,CACZ,+BAAe,CAAC,QAAQ,CAAC;IACvB,EAAE,EAAE,eAAe;IACnB,KAAK,EAAE,IAAI,KAAK,EAAE;IAClB,e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|
|
3
3
|
"description": "Shared React components for the pagopa selfcare project",
|
|
4
|
-
"version": "1.34.
|
|
4
|
+
"version": "1.34.62",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": "https://github.com/pagopa/selfcare-common-frontend",
|
|
7
7
|
"author": "https://www.pagopa.gov.it",
|