@pagopa/selfcare-common-frontend 2.2.1 → 2.4.0

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,16 @@ 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
+ #### [v2.4.0](https://github.com/pagopa/selfcare-common-frontend/compare/v2.2.1...v2.4.0)
8
+
9
+ - [SELC-9222] feat: update privacy policy handling and add tests for environment configurations [`#360`](https://github.com/pagopa/selfcare-common-frontend/pull/360)
10
+ - chore: release v2.2.1 [`#359`](https://github.com/pagopa/selfcare-common-frontend/pull/359)
11
+ - [SELC-9222] feat: update privacy policy handling and add tests for environment configurations (#360) [`#9222`](https://pagopa.atlassian.net/browse/9222)
12
+
7
13
  #### [v2.2.1](https://github.com/pagopa/selfcare-common-frontend/compare/v2.2.0...v2.2.1)
8
14
 
15
+ > 30 July 2026
16
+
9
17
  - feat: append origin=backstage query param to privacy policy and terms links [`#358`](https://github.com/pagopa/selfcare-common-frontend/pull/358)
10
18
  - chore: release v2.2.0 [`#357`](https://github.com/pagopa/selfcare-common-frontend/pull/357)
11
19
 
@@ -55,7 +55,10 @@ export default function Footer({ loggedUser, productsJsonUrl, onExit = (exitActi
55
55
  label: t('common.footer.preLoginLinks.resources.links.privacyPolicy'),
56
56
  href: CONFIG.FOOTER.LINK.PRIVACYPOLICY,
57
57
  ariaLabel: `${t('common.footer.preLoginLinks.resources.links.privacyPolicy')}: vai al link`,
58
- linkType: 'internal',
58
+ linkType: 'external',
59
+ onClick: CONFIG.FOOTER.LINK.PRIVACYPOLICY_OPEN_IN_NEW_TAB
60
+ ? () => window.open(CONFIG.FOOTER.LINK.PRIVACYPOLICY, '_blank', 'noopener,noreferrer')
61
+ : undefined,
59
62
  },
60
63
  {
61
64
  label: t('common.footer.preLoginLinks.resources.links.certifications'),
@@ -152,6 +155,9 @@ export default function Footer({ loggedUser, productsJsonUrl, onExit = (exitActi
152
155
  href: CONFIG.FOOTER.LINK.PRIVACYPOLICY,
153
156
  ariaLabel: `${t('common.footer.postLoginLinks.privacyPolicy')}: vai al link`,
154
157
  linkType: 'internal',
158
+ onClick: CONFIG.FOOTER.LINK.PRIVACYPOLICY_OPEN_IN_NEW_TAB
159
+ ? () => window.open(CONFIG.FOOTER.LINK.PRIVACYPOLICY, '_blank', 'noopener,noreferrer')
160
+ : undefined,
155
161
  },
156
162
  {
157
163
  label: t('common.footer.postLoginLinks.protectionofpersonaldata'),
@@ -38,6 +38,7 @@ export declare const CONFIG: {
38
38
  LINK: {
39
39
  PAGOPALINK: string;
40
40
  PRIVACYPOLICY: string;
41
+ PRIVACYPOLICY_OPEN_IN_NEW_TAB: boolean;
41
42
  TERMSANDCONDITIONS: string;
42
43
  PROTECTIONOFPERSONALDATA: string;
43
44
  ABOUTUS: string;
package/lib/config/env.js CHANGED
@@ -8,6 +8,28 @@ const appendBackstageParam = (url) => {
8
8
  const separator = url.includes('?') ? '&' : '?';
9
9
  return `${url}${separator}origin=backstage`;
10
10
  };
11
+ const currentEnv = import.meta.env.VITE_ENV || '';
12
+ const isProd = currentEnv === 'PROD';
13
+ /**
14
+ * Computes the Privacy Policy link shown in the footer.
15
+ * - Backstage context or PROD environment: legacy SPA route (OneTrust), with `origin=backstage` param when applicable.
16
+ * - Non-backstage, non-PROD (DEV/UAT/local/test): new static CDN page, bypassing the SPA route entirely.
17
+ * Falls back to the legacy SPA route (without backstage param) if the static URL env var is not configured.
18
+ */
19
+ const privacyPolicyUrl = () => {
20
+ const legacyUrl = import.meta.env.VITE_URL_PRIVACY_DISCLAIMER || '';
21
+ if (isFromBackstage || isProd) {
22
+ return appendBackstageParam(legacyUrl);
23
+ }
24
+ const staticUrl = import.meta.env.VITE_URL_PRIVACY_POLICY_STATIC || '';
25
+ return staticUrl || legacyUrl;
26
+ };
27
+ /**
28
+ * `true` when the Privacy Policy link currently points to the static CDN page (i.e. non-backstage,
29
+ * non-PROD, with the static URL configured), so consumers can open it in a new tab instead of
30
+ * navigating away from the SPA. `false` for the legacy SPA route, to preserve the current behavior.
31
+ */
32
+ const isStaticPrivacyPolicy = () => !isFromBackstage && !isProd && !!import.meta.env.VITE_URL_PRIVACY_POLICY_STATIC;
11
33
  export const CONFIG = {
12
34
  URL_FE: {
13
35
  LOGIN_GOOGLE: '/auth/google',
@@ -47,7 +69,8 @@ export const CONFIG = {
47
69
  FOOTER: {
48
70
  LINK: {
49
71
  PAGOPALINK: 'https://www.pagopa.it/',
50
- PRIVACYPOLICY: appendBackstageParam(import.meta.env.VITE_URL_PRIVACY_DISCLAIMER || ''),
72
+ PRIVACYPOLICY: privacyPolicyUrl(),
73
+ PRIVACYPOLICY_OPEN_IN_NEW_TAB: isStaticPrivacyPolicy(),
51
74
  TERMSANDCONDITIONS: appendBackstageParam(import.meta.env.VITE_URL_TERMS_AND_CONDITIONS || ''),
52
75
  PROTECTIONOFPERSONALDATA: 'https://privacyportal-de.onetrust.com/webform/77f17844-04c3-4969-a11d-462ee77acbe1/9ab6533d-be4a-482e-929a-0d8d2ab29df8',
53
76
  ABOUTUS: 'https://www.pagopa.it/it/societa/chi-siamo/',
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": "2.2.1",
4
+ "version": "2.4.0",
5
5
  "license": "MIT",
6
6
  "repository": "https://github.com/pagopa/selfcare-common-frontend",
7
7
  "author": "https://www.pagopa.gov.it",