@pagopa/selfcare-common-frontend 1.34.90 → 1.34.92
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/lib/decorators/withLogin.js +21 -0
- package/lib/decorators/withLogin.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.92](https://github.com/pagopa/selfcare-common-frontend/compare/v1.35.0...v1.34.92)
|
|
8
8
|
|
|
9
|
+
- Automatic logout [`#327`](https://github.com/pagopa/selfcare-common-frontend/pull/327)
|
|
10
|
+
- automatic logout logic [`#326`](https://github.com/pagopa/selfcare-common-frontend/pull/326)
|
|
9
11
|
- [SELC-8079] feat : handle redirect for backstage [`#324`](https://github.com/pagopa/selfcare-common-frontend/pull/324)
|
|
10
12
|
- hide header chip in backstage [`#323`](https://github.com/pagopa/selfcare-common-frontend/pull/323)
|
|
11
13
|
- [SELC-8042] feat: update role label for backstage header [`#322`](https://github.com/pagopa/selfcare-common-frontend/pull/322)
|
|
@@ -148,10 +150,23 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
|
|
148
150
|
- Bump rimraf from 3.0.2 to 6.0.1 [`e6941b9`](https://github.com/pagopa/selfcare-common-frontend/commit/e6941b9e6b05c973d991e2470a851b5ca03926ce)
|
|
149
151
|
- Used a environment variable to manage correct links in the footer based to product and actual environment [`960e2fb`](https://github.com/pagopa/selfcare-common-frontend/commit/960e2fbaa8aa8f79061639b26dc1a27f28b8aae3)
|
|
150
152
|
|
|
151
|
-
#### [v1.35.0](https://github.com/pagopa/selfcare-common-frontend/compare/v1.34.
|
|
153
|
+
#### [v1.35.0](https://github.com/pagopa/selfcare-common-frontend/compare/v1.34.91...v1.35.0)
|
|
152
154
|
|
|
153
155
|
> 20 July 2023
|
|
154
156
|
|
|
157
|
+
#### [v1.34.91](https://github.com/pagopa/selfcare-common-frontend/compare/v1.34.90...v1.34.91)
|
|
158
|
+
|
|
159
|
+
> 16 February 2026
|
|
160
|
+
|
|
161
|
+
- automatic logout logic [`#326`](https://github.com/pagopa/selfcare-common-frontend/pull/326)
|
|
162
|
+
|
|
163
|
+
#### [v1.34.90](https://github.com/pagopa/selfcare-common-frontend/compare/v1.34.89...v1.34.90)
|
|
164
|
+
|
|
165
|
+
> 28 January 2026
|
|
166
|
+
|
|
167
|
+
- [SELC-8079] feat : handle redirect for backstage [`#324`](https://github.com/pagopa/selfcare-common-frontend/pull/324)
|
|
168
|
+
- [SELC-8079] feat : handle redirect for backstage (#324) [`#8079`](https://pagopa.atlassian.net/browse/8079)
|
|
169
|
+
|
|
155
170
|
#### [v1.34.89](https://github.com/pagopa/selfcare-common-frontend/compare/v1.34.88...v1.34.89)
|
|
156
171
|
|
|
157
172
|
> 27 January 2026
|
package/build.info
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
tags/v1.29.0~1^2
|
|
1
|
+
20260216.2 - selfcare-common-frontend.deploy(258176)
|
|
2
|
+
tags/v1.29.0~1^2 f49a0878e3ad71f0fb84868d20a2844182ff8ee2
|
|
@@ -5,10 +5,12 @@ const tslib_1 = require("tslib");
|
|
|
5
5
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
6
6
|
const react_1 = require("react");
|
|
7
7
|
const react_redux_1 = require("react-redux");
|
|
8
|
+
const env_1 = require("../config/env");
|
|
8
9
|
const useLoading_1 = tslib_1.__importDefault(require("../hooks/useLoading"));
|
|
9
10
|
const useLogin_1 = require("../hooks/useLogin");
|
|
10
11
|
const userSlice_1 = require("../redux/slices/userSlice");
|
|
11
12
|
const constants_1 = require("../utils/constants");
|
|
13
|
+
const storage_1 = require("../utils/storage");
|
|
12
14
|
/** This feature is based on react-redux library and require to register the reducer build in userSlice into the application's redux store.
|
|
13
15
|
This decorator has to be applied to components whose acces require an active session.
|
|
14
16
|
Accessing to the components decorated with it without a session will brought to the login page.
|
|
@@ -16,9 +18,28 @@ It's possible to modify the login path changing the value in CONFIG.login inside
|
|
|
16
18
|
function withLogin(WrappedComponent) {
|
|
17
19
|
const displayName = WrappedComponent.displayName || WrappedComponent.name || 'Component';
|
|
18
20
|
const ComponentWithLogin = (props) => {
|
|
21
|
+
var _a;
|
|
19
22
|
const user = (0, react_redux_1.useSelector)(userSlice_1.userSelectors.selectLoggedUser);
|
|
20
23
|
const { attemptSilentLogin } = (0, useLogin_1.useLogin)();
|
|
21
24
|
const setLoading = (0, useLoading_1.default)(constants_1.LOADING_TASK_LOGIN_CHECK);
|
|
25
|
+
const currentPath = window.location.pathname;
|
|
26
|
+
const currentHash = window.location.hash;
|
|
27
|
+
const isPagoPaUser = ((_a = storage_1.storageUserOps.read()) === null || _a === void 0 ? void 0 : _a.iss) === 'PAGOPA';
|
|
28
|
+
(0, react_1.useEffect)(() => {
|
|
29
|
+
// eslint-disable-next-line no-console
|
|
30
|
+
console.log('Checking user login status...', { currentPath, currentHash });
|
|
31
|
+
if (currentPath.includes('/auth/login/success') &&
|
|
32
|
+
currentHash.includes('token=') &&
|
|
33
|
+
!isPagoPaUser) {
|
|
34
|
+
storage_1.storageUserOps.delete();
|
|
35
|
+
globalThis.location.assign(env_1.CONFIG.URL_FE.LOGOUT_GOOGLE);
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
if (currentPath.includes('/auth/login') && !currentHash.includes('token=') && isPagoPaUser) {
|
|
39
|
+
storage_1.storageUserOps.delete();
|
|
40
|
+
globalThis.location.assign(env_1.CONFIG.URL_FE.LOGOUT);
|
|
41
|
+
}
|
|
42
|
+
}, [currentPath, currentHash, isPagoPaUser]);
|
|
22
43
|
(0, react_1.useEffect)(() => {
|
|
23
44
|
async function asyncAttemptSilentLogin() {
|
|
24
45
|
await attemptSilentLogin();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"withLogin.js","sourceRoot":"","sources":["../../../src/lib/decorators/withLogin.tsx"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"withLogin.js","sourceRoot":"","sources":["../../../src/lib/decorators/withLogin.tsx"],"names":[],"mappings":";;AAgBA,4BAsDC;;;AAtED,iCAAkC;AAClC,6CAA0C;AAC1C,uCAAuC;AACvC,6EAA6C;AAC7C,gDAA6C;AAC7C,yDAA0D;AAC1D,kDAA8D;AAC9D,8CAAkD;AAKlD;;;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,MAAM,WAAW,GAAG,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAAC;QAC7C,MAAM,WAAW,GAAG,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC;QACzC,MAAM,YAAY,GAAG,CAAA,MAAA,wBAAc,CAAC,IAAI,EAAE,0CAAE,GAAG,MAAK,QAAQ,CAAC;QAE7D,IAAA,iBAAS,EAAC,GAAG,EAAE;YACb,sCAAsC;YACtC,OAAO,CAAC,GAAG,CAAC,+BAA+B,EAAE,EAAE,WAAW,EAAE,WAAW,EAAE,CAAC,CAAC;YAE3E,IACE,WAAW,CAAC,QAAQ,CAAC,qBAAqB,CAAC;gBAC3C,WAAW,CAAC,QAAQ,CAAC,QAAQ,CAAC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project",
|
|
4
|
-
"version": "1.34.
|
|
4
|
+
"version": "1.34.92",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": "https://github.com/pagopa/selfcare-common-frontend",
|
|
7
7
|
"author": "https://www.pagopa.gov.it",
|