@pagopa/selfcare-common-frontend 1.34.90 → 1.34.91

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,9 @@ 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.90](https://github.com/pagopa/selfcare-common-frontend/compare/v1.35.0...v1.34.90)
7
+ #### [v1.34.91](https://github.com/pagopa/selfcare-common-frontend/compare/v1.35.0...v1.34.91)
8
8
 
9
+ - automatic logout logic [`#326`](https://github.com/pagopa/selfcare-common-frontend/pull/326)
9
10
  - [SELC-8079] feat : handle redirect for backstage [`#324`](https://github.com/pagopa/selfcare-common-frontend/pull/324)
10
11
  - hide header chip in backstage [`#323`](https://github.com/pagopa/selfcare-common-frontend/pull/323)
11
12
  - [SELC-8042] feat: update role label for backstage header [`#322`](https://github.com/pagopa/selfcare-common-frontend/pull/322)
@@ -148,10 +149,17 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
148
149
  - Bump rimraf from 3.0.2 to 6.0.1 [`e6941b9`](https://github.com/pagopa/selfcare-common-frontend/commit/e6941b9e6b05c973d991e2470a851b5ca03926ce)
149
150
  - 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
151
 
151
- #### [v1.35.0](https://github.com/pagopa/selfcare-common-frontend/compare/v1.34.89...v1.35.0)
152
+ #### [v1.35.0](https://github.com/pagopa/selfcare-common-frontend/compare/v1.34.90...v1.35.0)
152
153
 
153
154
  > 20 July 2023
154
155
 
156
+ #### [v1.34.90](https://github.com/pagopa/selfcare-common-frontend/compare/v1.34.89...v1.34.90)
157
+
158
+ > 28 January 2026
159
+
160
+ - [SELC-8079] feat : handle redirect for backstage [`#324`](https://github.com/pagopa/selfcare-common-frontend/pull/324)
161
+ - [SELC-8079] feat : handle redirect for backstage (#324) [`#8079`](https://pagopa.atlassian.net/browse/8079)
162
+
155
163
  #### [v1.34.89](https://github.com/pagopa/selfcare-common-frontend/compare/v1.34.88...v1.34.89)
156
164
 
157
165
  > 27 January 2026
package/build.info CHANGED
@@ -1,2 +1,2 @@
1
- 20260128.1 - selfcare-common-frontend.deploy(255372)
2
- tags/v1.29.0~1^2 a74b32e66e30fd99780c1367be16e6092abfa4bb
1
+ 20260216.1 - selfcare-common-frontend.deploy(258141)
2
+ tags/v1.29.0~1^2 020b209597d1ec3e1b752ce9e715d2ce804c8c43
@@ -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,10 +18,27 @@ 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';
22
28
  (0, react_1.useEffect)(() => {
29
+ // eslint-disable-next-line no-console
30
+ console.log('Checking user login status...', { currentPath, currentHash });
31
+ // Check if coming from Google login (path contains /auth/login/success with token fragment)
32
+ if (currentPath.includes('/auth/login/success') &&
33
+ currentHash.includes('token=') &&
34
+ !isPagoPaUser) {
35
+ window.location.assign(env_1.CONFIG.URL_FE.LOGOUT_GOOGLE);
36
+ return;
37
+ }
38
+ if (currentPath.includes('/auth/login') && !currentHash.includes('token=') && isPagoPaUser) {
39
+ window.location.assign(env_1.CONFIG.URL_FE.LOGOUT);
40
+ return;
41
+ }
23
42
  async function asyncAttemptSilentLogin() {
24
43
  await attemptSilentLogin();
25
44
  }
@@ -1 +1 @@
1
- {"version":3,"file":"withLogin.js","sourceRoot":"","sources":["../../../src/lib/decorators/withLogin.tsx"],"names":[],"mappings":";;AAcA,4BA8BC;;;AA5CD,iCAAkC;AAClC,6CAA0C;AAC1C,6EAA6C;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,CAAC;gBACV,UAAU,CAAC,IA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@ -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.34.90",
4
+ "version": "1.34.91",
5
5
  "license": "MIT",
6
6
  "repository": "https://github.com/pagopa/selfcare-common-frontend",
7
7
  "author": "https://www.pagopa.gov.it",