From e2250c65a23c7ff8c009e4023ca7c821e2c41824 Mon Sep 17 00:00:00 2001 From: Carlotta Dimatteo Date: Tue, 27 Feb 2024 10:10:41 +0100 Subject: [PATCH 1/9] v2.4.0-RC.0 --- CHANGELOG.md | 23 +++++++++++++++++++ lerna.json | 2 +- packages/pn-commons/CHANGELOG.md | 16 +++++++++++++ packages/pn-commons/package.json | 2 +- packages/pn-pa-webapp/CHANGELOG.md | 21 +++++++++++++++++ packages/pn-pa-webapp/package.json | 2 +- packages/pn-personafisica-login/CHANGELOG.md | 8 +++++++ packages/pn-personafisica-login/package.json | 2 +- packages/pn-personafisica-webapp/CHANGELOG.md | 16 +++++++++++++ packages/pn-personafisica-webapp/package.json | 2 +- .../pn-personagiuridica-webapp/CHANGELOG.md | 16 +++++++++++++ .../pn-personagiuridica-webapp/package.json | 2 +- packages/pn-validator/CHANGELOG.md | 8 +++++++ packages/pn-validator/package.json | 2 +- 14 files changed, 115 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a4dd77afda..bfdf32210c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,29 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +# [2.4.0-RC.0](https://github.com/pagopa/pn-frontend/compare/v2.3.2...v2.4.0-RC.0) (2024-02-27) + + +### Bug Fixes + +* **PN-10025:** added aria-label to button with IDP name ([#1138](https://github.com/pagopa/pn-frontend/issues/1138)) ([c24c02b](https://github.com/pagopa/pn-frontend/commit/c24c02be95d92e1e44e5128070d98f0a3c5f3061)) +* **pn-9145:** added test case for duplicated protocol error ([#1120](https://github.com/pagopa/pn-frontend/issues/1120)) ([d2ca754](https://github.com/pagopa/pn-frontend/commit/d2ca754e07ed665211dab7a6d9e92d35b89ddee6)) + + +### Features + +* **PN-9684:** implemented alert in notificationDetail for alternative-RADD ([#1134](https://github.com/pagopa/pn-frontend/issues/1134)) ([bfc1d4a](https://github.com/pagopa/pn-frontend/commit/bfc1d4ad8d085d5691853fb54d1dad6049ca5f92)) + + +### Reverts + +* Revert "Release/v2.3.2" (#1143) ([7cfe17e](https://github.com/pagopa/pn-frontend/commit/7cfe17e1dffd43d0ffc7c0081dbdd538e0691fb6)), closes [#1143](https://github.com/pagopa/pn-frontend/issues/1143) +* Revert "fix(PN-10025): added aria-label to button with IDP name (#1138)" (#1140) ([2559495](https://github.com/pagopa/pn-frontend/commit/25594959e7184c0ae7dc59839845eda7cbd900d5)), closes [#1138](https://github.com/pagopa/pn-frontend/issues/1138) [#1140](https://github.com/pagopa/pn-frontend/issues/1140) + + + + + ## [2.3.2](https://github.com/pagopa/pn-frontend/compare/v2.3.1...v2.3.2) (2024-02-20) diff --git a/lerna.json b/lerna.json index c8dd74545d..dc7e944f4d 100644 --- a/lerna.json +++ b/lerna.json @@ -2,7 +2,7 @@ "packages": [ "packages/*" ], - "version": "2.3.2", + "version": "2.4.0-RC.0", "npmClient": "yarn", "useWorkspaces": true, "command": { diff --git a/packages/pn-commons/CHANGELOG.md b/packages/pn-commons/CHANGELOG.md index 11202f9d15..02dfcaf07d 100644 --- a/packages/pn-commons/CHANGELOG.md +++ b/packages/pn-commons/CHANGELOG.md @@ -3,6 +3,22 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +# [2.4.0-RC.0](https://github.com/pagopa/pn-frontend/compare/v2.3.2...v2.4.0-RC.0) (2024-02-27) + + +### Features + +* **PN-9684:** implemented alert in notificationDetail for alternative-RADD ([#1134](https://github.com/pagopa/pn-frontend/issues/1134)) ([bfc1d4a](https://github.com/pagopa/pn-frontend/commit/bfc1d4ad8d085d5691853fb54d1dad6049ca5f92)) + + +### Reverts + +* Revert "Release/v2.3.2" (#1143) ([7cfe17e](https://github.com/pagopa/pn-frontend/commit/7cfe17e1dffd43d0ffc7c0081dbdd538e0691fb6)), closes [#1143](https://github.com/pagopa/pn-frontend/issues/1143) + + + + + ## [2.3.2](https://github.com/pagopa/pn-frontend/compare/v2.3.1...v2.3.2) (2024-02-20) **Note:** Version bump only for package @pagopa-pn/pn-commons diff --git a/packages/pn-commons/package.json b/packages/pn-commons/package.json index 2bdf6d61af..47ba6a737e 100644 --- a/packages/pn-commons/package.json +++ b/packages/pn-commons/package.json @@ -1,6 +1,6 @@ { "name": "@pagopa-pn/pn-commons", - "version": "2.3.2", + "version": "2.4.0-RC.0", "private": true, "main": "./src/index.ts", "dependencies": { diff --git a/packages/pn-pa-webapp/CHANGELOG.md b/packages/pn-pa-webapp/CHANGELOG.md index 620e581afe..b9920329f0 100644 --- a/packages/pn-pa-webapp/CHANGELOG.md +++ b/packages/pn-pa-webapp/CHANGELOG.md @@ -3,6 +3,27 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +# [2.4.0-RC.0](https://github.com/pagopa/pn-frontend/compare/v2.3.2...v2.4.0-RC.0) (2024-02-27) + + +### Bug Fixes + +* **pn-9145:** added test case for duplicated protocol error ([#1120](https://github.com/pagopa/pn-frontend/issues/1120)) ([d2ca754](https://github.com/pagopa/pn-frontend/commit/d2ca754e07ed665211dab7a6d9e92d35b89ddee6)) + + +### Features + +* **PN-9684:** implemented alert in notificationDetail for alternative-RADD ([#1134](https://github.com/pagopa/pn-frontend/issues/1134)) ([bfc1d4a](https://github.com/pagopa/pn-frontend/commit/bfc1d4ad8d085d5691853fb54d1dad6049ca5f92)) + + +### Reverts + +* Revert "Release/v2.3.2" (#1143) ([7cfe17e](https://github.com/pagopa/pn-frontend/commit/7cfe17e1dffd43d0ffc7c0081dbdd538e0691fb6)), closes [#1143](https://github.com/pagopa/pn-frontend/issues/1143) + + + + + ## [2.3.2](https://github.com/pagopa/pn-frontend/compare/v2.3.1...v2.3.2) (2024-02-20) **Note:** Version bump only for package @pagopa-pn/pn-pa-webapp diff --git a/packages/pn-pa-webapp/package.json b/packages/pn-pa-webapp/package.json index 47a6652476..3fcb61e35b 100644 --- a/packages/pn-pa-webapp/package.json +++ b/packages/pn-pa-webapp/package.json @@ -1,7 +1,7 @@ { "name": "@pagopa-pn/pn-pa-webapp", "description": "Backoffice di SEND per la Pubblica Amministrazione", - "version": "2.3.2", + "version": "2.4.0-RC.0", "private": true, "dependencies": { "@emotion/react": "^11.11.1", diff --git a/packages/pn-personafisica-login/CHANGELOG.md b/packages/pn-personafisica-login/CHANGELOG.md index 66f94538bc..c07ef8cf94 100644 --- a/packages/pn-personafisica-login/CHANGELOG.md +++ b/packages/pn-personafisica-login/CHANGELOG.md @@ -3,6 +3,14 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +# [2.4.0-RC.0](https://github.com/pagopa/pn-frontend/compare/v2.3.2...v2.4.0-RC.0) (2024-02-27) + +**Note:** Version bump only for package @pagopa-pn/pn-personafisica-login + + + + + ## [2.3.2](https://github.com/pagopa/pn-frontend/compare/v2.3.1...v2.3.2) (2024-02-20) diff --git a/packages/pn-personafisica-login/package.json b/packages/pn-personafisica-login/package.json index bd595f2e14..067a78cc44 100644 --- a/packages/pn-personafisica-login/package.json +++ b/packages/pn-personafisica-login/package.json @@ -1,7 +1,7 @@ { "name": "@pagopa-pn/pn-personafisica-login", "description": "Pagina di login di SEND per il cittadino", - "version": "2.3.2", + "version": "2.4.0-RC.0", "private": true, "homepage": "auth", "dependencies": { diff --git a/packages/pn-personafisica-webapp/CHANGELOG.md b/packages/pn-personafisica-webapp/CHANGELOG.md index 8182b9ed3c..3093b83908 100644 --- a/packages/pn-personafisica-webapp/CHANGELOG.md +++ b/packages/pn-personafisica-webapp/CHANGELOG.md @@ -3,6 +3,22 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +# [2.4.0-RC.0](https://github.com/pagopa/pn-frontend/compare/v2.3.2...v2.4.0-RC.0) (2024-02-27) + + +### Features + +* **PN-9684:** implemented alert in notificationDetail for alternative-RADD ([#1134](https://github.com/pagopa/pn-frontend/issues/1134)) ([bfc1d4a](https://github.com/pagopa/pn-frontend/commit/bfc1d4ad8d085d5691853fb54d1dad6049ca5f92)) + + +### Reverts + +* Revert "Release/v2.3.2" (#1143) ([7cfe17e](https://github.com/pagopa/pn-frontend/commit/7cfe17e1dffd43d0ffc7c0081dbdd538e0691fb6)), closes [#1143](https://github.com/pagopa/pn-frontend/issues/1143) + + + + + ## [2.3.2](https://github.com/pagopa/pn-frontend/compare/v2.3.1...v2.3.2) (2024-02-20) **Note:** Version bump only for package @pagopa-pn/pn-personafisica-webapp diff --git a/packages/pn-personafisica-webapp/package.json b/packages/pn-personafisica-webapp/package.json index 2b90d09999..88da9489cd 100644 --- a/packages/pn-personafisica-webapp/package.json +++ b/packages/pn-personafisica-webapp/package.json @@ -1,7 +1,7 @@ { "name": "@pagopa-pn/pn-personafisica-webapp", "description": "SEND - Servizio Notifiche Digitali per il cittadino", - "version": "2.3.2", + "version": "2.4.0-RC.0", "private": true, "dependencies": { "@emotion/react": "^11.11.1", diff --git a/packages/pn-personagiuridica-webapp/CHANGELOG.md b/packages/pn-personagiuridica-webapp/CHANGELOG.md index 6e18ce1d00..7acb556de4 100644 --- a/packages/pn-personagiuridica-webapp/CHANGELOG.md +++ b/packages/pn-personagiuridica-webapp/CHANGELOG.md @@ -3,6 +3,22 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +# [2.4.0-RC.0](https://github.com/pagopa/pn-frontend/compare/v2.3.2...v2.4.0-RC.0) (2024-02-27) + + +### Features + +* **PN-9684:** implemented alert in notificationDetail for alternative-RADD ([#1134](https://github.com/pagopa/pn-frontend/issues/1134)) ([bfc1d4a](https://github.com/pagopa/pn-frontend/commit/bfc1d4ad8d085d5691853fb54d1dad6049ca5f92)) + + +### Reverts + +* Revert "Release/v2.3.2" (#1143) ([7cfe17e](https://github.com/pagopa/pn-frontend/commit/7cfe17e1dffd43d0ffc7c0081dbdd538e0691fb6)), closes [#1143](https://github.com/pagopa/pn-frontend/issues/1143) + + + + + ## [2.3.2](https://github.com/pagopa/pn-frontend/compare/v2.3.1...v2.3.2) (2024-02-20) **Note:** Version bump only for package @pagopa-pn/pn-personagiuridica-webapp diff --git a/packages/pn-personagiuridica-webapp/package.json b/packages/pn-personagiuridica-webapp/package.json index 069183fb53..d616c3f9b1 100644 --- a/packages/pn-personagiuridica-webapp/package.json +++ b/packages/pn-personagiuridica-webapp/package.json @@ -1,7 +1,7 @@ { "name": "@pagopa-pn/pn-personagiuridica-webapp", "description": "SEND per la persona giuridica", - "version": "2.3.2", + "version": "2.4.0-RC.0", "private": true, "dependencies": { "@emotion/react": "^11.11.1", diff --git a/packages/pn-validator/CHANGELOG.md b/packages/pn-validator/CHANGELOG.md index 52144cbd7c..e77afc29ed 100644 --- a/packages/pn-validator/CHANGELOG.md +++ b/packages/pn-validator/CHANGELOG.md @@ -3,6 +3,14 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +# [2.4.0-RC.0](https://github.com/pagopa/pn-frontend/compare/v2.3.2...v2.4.0-RC.0) (2024-02-27) + +**Note:** Version bump only for package @pagopa-pn/pn-validator + + + + + ## [2.3.2](https://github.com/pagopa/pn-frontend/compare/v2.3.1...v2.3.2) (2024-02-20) **Note:** Version bump only for package @pagopa-pn/pn-validator diff --git a/packages/pn-validator/package.json b/packages/pn-validator/package.json index b9a07c8676..19d60ff0e0 100644 --- a/packages/pn-validator/package.json +++ b/packages/pn-validator/package.json @@ -1,6 +1,6 @@ { "name": "@pagopa-pn/pn-validator", - "version": "2.3.2", + "version": "2.4.0-RC.0", "private": true, "main": "./src/index.ts", "dependencies": { From 5fecd782150f13fa97a1c0862e201ada1c093578 Mon Sep 17 00:00:00 2001 From: Carlotta Dimatteo Date: Thu, 7 Mar 2024 14:17:31 +0100 Subject: [PATCH 2/9] v2.4.0 --- CHANGELOG.md | 8 ++++++++ lerna.json | 2 +- packages/pn-commons/CHANGELOG.md | 8 ++++++++ packages/pn-commons/package.json | 2 +- packages/pn-pa-webapp/CHANGELOG.md | 8 ++++++++ packages/pn-pa-webapp/package.json | 2 +- packages/pn-personafisica-login/CHANGELOG.md | 8 ++++++++ packages/pn-personafisica-login/package.json | 2 +- packages/pn-personafisica-webapp/CHANGELOG.md | 8 ++++++++ packages/pn-personafisica-webapp/package.json | 2 +- packages/pn-personagiuridica-webapp/CHANGELOG.md | 8 ++++++++ packages/pn-personagiuridica-webapp/package.json | 2 +- packages/pn-validator/CHANGELOG.md | 8 ++++++++ packages/pn-validator/package.json | 2 +- 14 files changed, 63 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index bfdf32210c..af4813bf5b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,14 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +# [2.4.0](https://github.com/pagopa/pn-frontend/compare/v2.4.0-RC.0...v2.4.0) (2024-03-07) + +**Note:** Version bump only for package send-monorepo + + + + + # [2.4.0-RC.0](https://github.com/pagopa/pn-frontend/compare/v2.3.2...v2.4.0-RC.0) (2024-02-27) diff --git a/lerna.json b/lerna.json index dc7e944f4d..c43139337a 100644 --- a/lerna.json +++ b/lerna.json @@ -2,7 +2,7 @@ "packages": [ "packages/*" ], - "version": "2.4.0-RC.0", + "version": "2.4.0", "npmClient": "yarn", "useWorkspaces": true, "command": { diff --git a/packages/pn-commons/CHANGELOG.md b/packages/pn-commons/CHANGELOG.md index 02dfcaf07d..a63d0ed06d 100644 --- a/packages/pn-commons/CHANGELOG.md +++ b/packages/pn-commons/CHANGELOG.md @@ -3,6 +3,14 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +# [2.4.0](https://github.com/pagopa/pn-frontend/compare/v2.4.0-RC.0...v2.4.0) (2024-03-07) + +**Note:** Version bump only for package @pagopa-pn/pn-commons + + + + + # [2.4.0-RC.0](https://github.com/pagopa/pn-frontend/compare/v2.3.2...v2.4.0-RC.0) (2024-02-27) diff --git a/packages/pn-commons/package.json b/packages/pn-commons/package.json index 47ba6a737e..4f53652c3e 100644 --- a/packages/pn-commons/package.json +++ b/packages/pn-commons/package.json @@ -1,6 +1,6 @@ { "name": "@pagopa-pn/pn-commons", - "version": "2.4.0-RC.0", + "version": "2.4.0", "private": true, "main": "./src/index.ts", "dependencies": { diff --git a/packages/pn-pa-webapp/CHANGELOG.md b/packages/pn-pa-webapp/CHANGELOG.md index b9920329f0..d0603dab89 100644 --- a/packages/pn-pa-webapp/CHANGELOG.md +++ b/packages/pn-pa-webapp/CHANGELOG.md @@ -3,6 +3,14 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +# [2.4.0](https://github.com/pagopa/pn-frontend/compare/v2.4.0-RC.0...v2.4.0) (2024-03-07) + +**Note:** Version bump only for package @pagopa-pn/pn-pa-webapp + + + + + # [2.4.0-RC.0](https://github.com/pagopa/pn-frontend/compare/v2.3.2...v2.4.0-RC.0) (2024-02-27) diff --git a/packages/pn-pa-webapp/package.json b/packages/pn-pa-webapp/package.json index 3fcb61e35b..3014c19e9d 100644 --- a/packages/pn-pa-webapp/package.json +++ b/packages/pn-pa-webapp/package.json @@ -1,7 +1,7 @@ { "name": "@pagopa-pn/pn-pa-webapp", "description": "Backoffice di SEND per la Pubblica Amministrazione", - "version": "2.4.0-RC.0", + "version": "2.4.0", "private": true, "dependencies": { "@emotion/react": "^11.11.1", diff --git a/packages/pn-personafisica-login/CHANGELOG.md b/packages/pn-personafisica-login/CHANGELOG.md index c07ef8cf94..8569061cec 100644 --- a/packages/pn-personafisica-login/CHANGELOG.md +++ b/packages/pn-personafisica-login/CHANGELOG.md @@ -3,6 +3,14 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +# [2.4.0](https://github.com/pagopa/pn-frontend/compare/v2.4.0-RC.0...v2.4.0) (2024-03-07) + +**Note:** Version bump only for package @pagopa-pn/pn-personafisica-login + + + + + # [2.4.0-RC.0](https://github.com/pagopa/pn-frontend/compare/v2.3.2...v2.4.0-RC.0) (2024-02-27) **Note:** Version bump only for package @pagopa-pn/pn-personafisica-login diff --git a/packages/pn-personafisica-login/package.json b/packages/pn-personafisica-login/package.json index 067a78cc44..f2cff4a44b 100644 --- a/packages/pn-personafisica-login/package.json +++ b/packages/pn-personafisica-login/package.json @@ -1,7 +1,7 @@ { "name": "@pagopa-pn/pn-personafisica-login", "description": "Pagina di login di SEND per il cittadino", - "version": "2.4.0-RC.0", + "version": "2.4.0", "private": true, "homepage": "auth", "dependencies": { diff --git a/packages/pn-personafisica-webapp/CHANGELOG.md b/packages/pn-personafisica-webapp/CHANGELOG.md index 3093b83908..42ea53b202 100644 --- a/packages/pn-personafisica-webapp/CHANGELOG.md +++ b/packages/pn-personafisica-webapp/CHANGELOG.md @@ -3,6 +3,14 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +# [2.4.0](https://github.com/pagopa/pn-frontend/compare/v2.4.0-RC.0...v2.4.0) (2024-03-07) + +**Note:** Version bump only for package @pagopa-pn/pn-personafisica-webapp + + + + + # [2.4.0-RC.0](https://github.com/pagopa/pn-frontend/compare/v2.3.2...v2.4.0-RC.0) (2024-02-27) diff --git a/packages/pn-personafisica-webapp/package.json b/packages/pn-personafisica-webapp/package.json index 88da9489cd..b03e40a4af 100644 --- a/packages/pn-personafisica-webapp/package.json +++ b/packages/pn-personafisica-webapp/package.json @@ -1,7 +1,7 @@ { "name": "@pagopa-pn/pn-personafisica-webapp", "description": "SEND - Servizio Notifiche Digitali per il cittadino", - "version": "2.4.0-RC.0", + "version": "2.4.0", "private": true, "dependencies": { "@emotion/react": "^11.11.1", diff --git a/packages/pn-personagiuridica-webapp/CHANGELOG.md b/packages/pn-personagiuridica-webapp/CHANGELOG.md index 7acb556de4..b1a046463b 100644 --- a/packages/pn-personagiuridica-webapp/CHANGELOG.md +++ b/packages/pn-personagiuridica-webapp/CHANGELOG.md @@ -3,6 +3,14 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +# [2.4.0](https://github.com/pagopa/pn-frontend/compare/v2.4.0-RC.0...v2.4.0) (2024-03-07) + +**Note:** Version bump only for package @pagopa-pn/pn-personagiuridica-webapp + + + + + # [2.4.0-RC.0](https://github.com/pagopa/pn-frontend/compare/v2.3.2...v2.4.0-RC.0) (2024-02-27) diff --git a/packages/pn-personagiuridica-webapp/package.json b/packages/pn-personagiuridica-webapp/package.json index d616c3f9b1..e65bc0ab89 100644 --- a/packages/pn-personagiuridica-webapp/package.json +++ b/packages/pn-personagiuridica-webapp/package.json @@ -1,7 +1,7 @@ { "name": "@pagopa-pn/pn-personagiuridica-webapp", "description": "SEND per la persona giuridica", - "version": "2.4.0-RC.0", + "version": "2.4.0", "private": true, "dependencies": { "@emotion/react": "^11.11.1", diff --git a/packages/pn-validator/CHANGELOG.md b/packages/pn-validator/CHANGELOG.md index e77afc29ed..bc01188df8 100644 --- a/packages/pn-validator/CHANGELOG.md +++ b/packages/pn-validator/CHANGELOG.md @@ -3,6 +3,14 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +# [2.4.0](https://github.com/pagopa/pn-frontend/compare/v2.4.0-RC.0...v2.4.0) (2024-03-07) + +**Note:** Version bump only for package @pagopa-pn/pn-validator + + + + + # [2.4.0-RC.0](https://github.com/pagopa/pn-frontend/compare/v2.3.2...v2.4.0-RC.0) (2024-02-27) **Note:** Version bump only for package @pagopa-pn/pn-validator diff --git a/packages/pn-validator/package.json b/packages/pn-validator/package.json index 19d60ff0e0..06f0da3583 100644 --- a/packages/pn-validator/package.json +++ b/packages/pn-validator/package.json @@ -1,6 +1,6 @@ { "name": "@pagopa-pn/pn-validator", - "version": "2.4.0-RC.0", + "version": "2.4.0", "private": true, "main": "./src/index.ts", "dependencies": { From e6a3ca8ad436db89051ed52ef1cfc4ef2307097e Mon Sep 17 00:00:00 2001 From: Sarah Donvito <73442810+SarahDonvito@users.noreply.github.com> Date: Fri, 22 Mar 2024 15:26:41 +0100 Subject: [PATCH 3/9] fix(PN-10122): PG - change active tab when clicking on the side menu item (#1165) --- packages/pn-personagiuridica-webapp/src/App.tsx | 2 +- .../src/pages/Deleghe.page.tsx | 10 ++++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/packages/pn-personagiuridica-webapp/src/App.tsx b/packages/pn-personagiuridica-webapp/src/App.tsx index ef8c362e6a..63ba6ecdf4 100644 --- a/packages/pn-personagiuridica-webapp/src/App.tsx +++ b/packages/pn-personagiuridica-webapp/src/App.tsx @@ -185,7 +185,7 @@ const ActualApp = () => { menuItems.splice(1, 0, { label: t('menu.deleghe'), icon: () => , - route: routes.DELEGHEACARICO, + route: routes.DELEGHE, rightBadgeNotification: pendingDelegators ? pendingDelegators : undefined, }); } diff --git a/packages/pn-personagiuridica-webapp/src/pages/Deleghe.page.tsx b/packages/pn-personagiuridica-webapp/src/pages/Deleghe.page.tsx index 65b1f07819..6de0212349 100644 --- a/packages/pn-personagiuridica-webapp/src/pages/Deleghe.page.tsx +++ b/packages/pn-personagiuridica-webapp/src/pages/Deleghe.page.tsx @@ -52,6 +52,12 @@ const Deleghe = () => { }; }, []); + useEffect(() => { + const tabToBeSelected = pathname === routes.DELEGATI ? 1 : 0; + if (value !== tabToBeSelected) { + setValue(tabToBeSelected); + } + }, [pathname]); return ( { centered variant="fullWidth" > - - + + From f0d032b8008abd3018c97f5ec9dfa3c99ebb268b Mon Sep 17 00:00:00 2001 From: AndreaCimini90 <99173401+AndreaCimini90@users.noreply.github.com> Date: Tue, 26 Mar 2024 09:22:44 +0100 Subject: [PATCH 4/9] feat(pn-10040): support page (#1145) --- .../src/components/Header/Header.tsx | 8 +- .../src/components/Layout/Layout.tsx | 6 +- packages/pn-commons/src/components/Prompt.tsx | 8 +- .../src/components/__test__/Prompt.test.tsx | 8 +- packages/pn-commons/src/hooks/usePrompt.ts | 8 +- .../pn-pa-webapp/src/pages/NewApiKey.page.tsx | 8 +- .../pages/__test__/NewApiKey.page.test.tsx | 6 +- .../__test__/NewNotification.page.test.tsx | 11 +- .../__test__/NotificationDetail.page.test.tsx | 6 +- .../public/conf/env/config.dev.json | 3 +- .../public/conf/env/config.hotfix.json | 3 +- .../public/conf/env/config.prod.json | 3 +- .../public/conf/env/config.test.json | 3 +- .../public/conf/env/config.uat.json | 3 +- .../public/locales/it/common.json | 1 + .../public/locales/it/support.json | 16 ++ packages/pn-personafisica-webapp/src/App.tsx | 91 ++++---- .../src/api/support/Support.api.ts | 10 + .../api/support/__test__/Support.api.test.ts | 37 ++++ .../support/__test__/support.routes.test.ts | 8 + .../src/api/support/support.routes.ts | 16 ++ .../__test__/DigitalContactElem.test.tsx | 4 +- .../src/components/Support/ZendeskForm.tsx | 25 +++ .../src/models/Support.ts | 10 + .../src/navigation/routes.const.ts | 1 + .../src/navigation/routes.tsx | 11 +- .../src/pages/Support.page.tsx | 208 ++++++++++++++++++ .../src/pages/__test__/NuovaDelega.test.tsx | 8 +- .../src/pages/__test__/Support.page.test.tsx | 161 ++++++++++++++ .../src/redux/support/actions.ts | 10 + .../src/services/configuration.service.ts | 10 +- .../pn-personafisica-webapp/src/setupTests.ts | 2 +- .../utility/__test__/layout.utility.test.ts | 53 +++++ .../src/utility/layout.utility.ts | 47 ++++ .../src/validators/SupportFormValidator.ts | 28 +++ .../__test__/SupportFormValidator.test.ts | 35 +++ .../pages/__test__/NuovaDelega.page.test.tsx | 11 +- packages/pn-validator/src/index.ts | 4 +- packages/pn-validator/src/rules/IsEqual.ts | 15 +- .../pn-validator/src/types/ValidationError.ts | 6 +- 40 files changed, 794 insertions(+), 118 deletions(-) create mode 100644 packages/pn-personafisica-webapp/public/locales/it/support.json create mode 100644 packages/pn-personafisica-webapp/src/api/support/Support.api.ts create mode 100644 packages/pn-personafisica-webapp/src/api/support/__test__/Support.api.test.ts create mode 100644 packages/pn-personafisica-webapp/src/api/support/__test__/support.routes.test.ts create mode 100644 packages/pn-personafisica-webapp/src/api/support/support.routes.ts create mode 100644 packages/pn-personafisica-webapp/src/components/Support/ZendeskForm.tsx create mode 100644 packages/pn-personafisica-webapp/src/models/Support.ts create mode 100644 packages/pn-personafisica-webapp/src/pages/Support.page.tsx create mode 100644 packages/pn-personafisica-webapp/src/pages/__test__/Support.page.test.tsx create mode 100644 packages/pn-personafisica-webapp/src/redux/support/actions.ts create mode 100644 packages/pn-personafisica-webapp/src/utility/__test__/layout.utility.test.ts create mode 100644 packages/pn-personafisica-webapp/src/utility/layout.utility.ts create mode 100644 packages/pn-personafisica-webapp/src/validators/SupportFormValidator.ts create mode 100644 packages/pn-personafisica-webapp/src/validators/__test__/SupportFormValidator.test.ts diff --git a/packages/pn-commons/src/components/Header/Header.tsx b/packages/pn-commons/src/components/Header/Header.tsx index 36b16e7597..20c0787b12 100644 --- a/packages/pn-commons/src/components/Header/Header.tsx +++ b/packages/pn-commons/src/components/Header/Header.tsx @@ -38,9 +38,11 @@ type HeaderProps = { eventTrackingCallbackProductSwitch?: (target: string) => void; /** Whether there is a logged user */ isLogged?: boolean; + /** Enable assistance button */ + enableAssistanceButton?: boolean; }; -const Header = ({ +const Header: React.FC = ({ onExitAction = () => window.location.assign(''), productsList, showHeaderProduct = true, @@ -53,7 +55,8 @@ const Header = ({ onAssistanceClick, eventTrackingCallbackProductSwitch, isLogged, -}: HeaderProps) => { + enableAssistanceButton, +}) => { const pagoPAHeaderLink: RootLinkType = { ...pagoPALink(), label: 'PagoPA S.p.A.', @@ -107,6 +110,7 @@ const Header = ({ onLogout={onExitAction} enableDropdown={enableDropdown} userActions={userActions} + enableAssistanceButton={enableAssistanceButton} /> {enableHeaderProduct && ( = ({ @@ -68,7 +70,7 @@ const Layout: React.FC = ({ loggedUser, enableUserDropdown, userActions, - onLanguageChanged = () => { }, + onLanguageChanged = () => {}, eventTrackingCallbackAppCrash, eventTrackingCallbackProductSwitch, eventTrackingCallbackRefreshPage, @@ -79,6 +81,7 @@ const Layout: React.FC = ({ hasTermsOfService, privacyPolicyHref, termsOfServiceHref, + enableAssistanceButton = true, }) => ( = ({ onAssistanceClick={onAssistanceClick} eventTrackingCallbackProductSwitch={eventTrackingCallbackProductSwitch} isLogged={isLogged} + enableAssistanceButton={enableAssistanceButton} /> )} diff --git a/packages/pn-commons/src/components/Prompt.tsx b/packages/pn-commons/src/components/Prompt.tsx index 869f619b05..c0fd686d9b 100644 --- a/packages/pn-commons/src/components/Prompt.tsx +++ b/packages/pn-commons/src/components/Prompt.tsx @@ -11,9 +11,9 @@ import PnDialogContent from './PnDialog/PnDialogContent'; type Props = { title: string; message: string; - eventTrackingCallbackPromptOpened: () => void; - eventTrackingCallbackCancel: () => void; - eventTrackingCallbackConfirm: () => void; + eventTrackingCallbackPromptOpened?: () => void; + eventTrackingCallbackCancel?: () => void; + eventTrackingCallbackConfirm?: () => void; children?: React.ReactNode; }; @@ -33,7 +33,7 @@ const Prompt: React.FC = ({ useEffect(() => { if (showPrompt) { - eventTrackingCallbackPromptOpened(); + eventTrackingCallbackPromptOpened?.(); } }); diff --git a/packages/pn-commons/src/components/__test__/Prompt.test.tsx b/packages/pn-commons/src/components/__test__/Prompt.test.tsx index b9b06b0b5b..d241b86b64 100644 --- a/packages/pn-commons/src/components/__test__/Prompt.test.tsx +++ b/packages/pn-commons/src/components/__test__/Prompt.test.tsx @@ -15,13 +15,7 @@ const WrappedPrompt = () => { {}} - eventTrackingCallbackCancel={() => {}} - eventTrackingCallbackConfirm={() => {}} - > +
navigate
} diff --git a/packages/pn-commons/src/hooks/usePrompt.ts b/packages/pn-commons/src/hooks/usePrompt.ts index cfc53b80d3..f0a4aefb51 100644 --- a/packages/pn-commons/src/hooks/usePrompt.ts +++ b/packages/pn-commons/src/hooks/usePrompt.ts @@ -6,8 +6,8 @@ import { useBlocker } from './useBlocker'; export function usePrompt( when: boolean, - callbackCancel: () => void, - callbackConfirm: () => void + callbackCancel?: () => void, + callbackConfirm?: () => void ): [boolean, () => void, () => void] { const location = useLocation(); const navigate = useNavigate(); @@ -17,7 +17,7 @@ export function usePrompt( const cancelNavigation = useCallback(() => { setShowPrompt(false); - callbackCancel(); + callbackCancel?.(); }, []); // handle blocking when user click on another route prompt will be shown @@ -37,7 +37,7 @@ export function usePrompt( const confirmNavigation = useCallback(() => { setShowPrompt(false); setConfirmedNavigation(true); - callbackConfirm(); + callbackConfirm?.(); }, []); useEffect(() => { diff --git a/packages/pn-pa-webapp/src/pages/NewApiKey.page.tsx b/packages/pn-pa-webapp/src/pages/NewApiKey.page.tsx index a924462edd..92b5baf2dc 100644 --- a/packages/pn-pa-webapp/src/pages/NewApiKey.page.tsx +++ b/packages/pn-pa-webapp/src/pages/NewApiKey.page.tsx @@ -90,13 +90,7 @@ const NewApiKey = () => { return ( <> {!apiKeySent && ( - {}} // impostare eventi tracking previsti - eventTrackingCallbackCancel={() => {}} // impostare eventi tracking previsti - eventTrackingCallbackConfirm={() => {}} // impostare eventi tracking previsti - > + diff --git a/packages/pn-pa-webapp/src/pages/__test__/NewApiKey.page.test.tsx b/packages/pn-pa-webapp/src/pages/__test__/NewApiKey.page.test.tsx index 33ab91ae24..e19503915d 100644 --- a/packages/pn-pa-webapp/src/pages/__test__/NewApiKey.page.test.tsx +++ b/packages/pn-pa-webapp/src/pages/__test__/NewApiKey.page.test.tsx @@ -1,4 +1,5 @@ import MockAdapter from 'axios-mock-adapter'; +import { createBrowserHistory } from 'history'; import { Route, Routes } from 'react-router-dom'; import { vi } from 'vitest'; @@ -113,13 +114,14 @@ describe('NewApiKey component', async () => { it('clicks on the breadcrumb button', async () => { // simulate the current URL - window.history.pushState({}, '', '/new-api-key'); + const history = createBrowserHistory(); + history.push(routes.NUOVA_API_KEY); // render using an ad-hoc router await act(async () => { result = render( - } /> + } /> hello} diff --git a/packages/pn-pa-webapp/src/pages/__test__/NewNotification.page.test.tsx b/packages/pn-pa-webapp/src/pages/__test__/NewNotification.page.test.tsx index d07d2464e4..3ed0642555 100644 --- a/packages/pn-pa-webapp/src/pages/__test__/NewNotification.page.test.tsx +++ b/packages/pn-pa-webapp/src/pages/__test__/NewNotification.page.test.tsx @@ -1,4 +1,5 @@ import MockAdapter from 'axios-mock-adapter'; +import { createBrowserHistory } from 'history'; import { Route, Routes } from 'react-router-dom'; import { vi } from 'vitest'; @@ -86,7 +87,8 @@ describe('NewNotification Page without payment', async () => { it('clicks on the breadcrumb button', async () => { // insert one entry into the history, so the initial render will refer // to the path /new-notification - window.history.pushState({}, '', '/new-notification'); + const history = createBrowserHistory(); + history.push(routes.NUOVA_NOTIFICA); // render with an ad-hoc router, will render initially NewNotification // since it corresponds to the top of the mocked history stack @@ -97,7 +99,7 @@ describe('NewNotification Page without payment', async () => { path={routes.DASHBOARD} element={
hello
} /> - } /> + } />
, { preloadedState: { userState: { user: userResponse } } } ); @@ -129,7 +131,8 @@ describe('NewNotification Page without payment', async () => { it('clicks on api keys button', async () => { // insert one entry into the history, so the initial render will refer // to the path /new-notification - window.history.pushState({}, '', '/new-notification'); + const history = createBrowserHistory(); + history.push(routes.NUOVA_NOTIFICA); // render with an ad-hoc router, will render initially NewNotification // since it corresponds to the top of the mocked history stack @@ -140,7 +143,7 @@ describe('NewNotification Page without payment', async () => { path={routes.API_KEYS} element={
hello
} /> - } /> + } /> , { preloadedState: { userState: { user: userResponse } } } ); diff --git a/packages/pn-pa-webapp/src/pages/__test__/NotificationDetail.page.test.tsx b/packages/pn-pa-webapp/src/pages/__test__/NotificationDetail.page.test.tsx index c81ceb083f..4b2021fe4b 100644 --- a/packages/pn-pa-webapp/src/pages/__test__/NotificationDetail.page.test.tsx +++ b/packages/pn-pa-webapp/src/pages/__test__/NotificationDetail.page.test.tsx @@ -1,4 +1,5 @@ import MockAdapter from 'axios-mock-adapter'; +import { createBrowserHistory } from 'history'; import { Route, Routes } from 'react-router-dom'; import { vi } from 'vitest'; @@ -349,8 +350,9 @@ describe('NotificationDetail Page', async () => { // insert two entries into the history, so the initial render will refer to the path / // and when the back button is pressed and so navigate(-1) is invoked, // the path will change to /mock-path - window.history.pushState({}, '', '/mock-path'); - window.history.pushState({}, '', '/'); + const history = createBrowserHistory(); + history.push('/mock-path'); + history.push('/'); // render with an ad-hoc router await act(async () => { diff --git a/packages/pn-personafisica-webapp/public/conf/env/config.dev.json b/packages/pn-personafisica-webapp/public/conf/env/config.dev.json index 10c0168cbb..2d25f4f91b 100644 --- a/packages/pn-personafisica-webapp/public/conf/env/config.dev.json +++ b/packages/pn-personafisica-webapp/public/conf/env/config.dev.json @@ -11,5 +11,6 @@ "LANDING_SITE_URL": "https://www.dev.notifichedigitali.it", "DELEGATIONS_TO_PG_ENABLED": true, "WORK_IN_PROGRESS": false, - "F24_DOWNLOAD_WAIT_TIME": 15000 + "F24_DOWNLOAD_WAIT_TIME": 15000, + "PAGOPA_HELP_PP": "https://www.pagopa.it/it/privacy-policy-assistenza" } diff --git a/packages/pn-personafisica-webapp/public/conf/env/config.hotfix.json b/packages/pn-personafisica-webapp/public/conf/env/config.hotfix.json index 93851a33ee..944fa5dc27 100644 --- a/packages/pn-personafisica-webapp/public/conf/env/config.hotfix.json +++ b/packages/pn-personafisica-webapp/public/conf/env/config.hotfix.json @@ -11,5 +11,6 @@ "LANDING_SITE_URL": "https://www.hotfix.notifichedigitali.it", "DELEGATIONS_TO_PG_ENABLED": true, "WORK_IN_PROGRESS": false, - "F24_DOWNLOAD_WAIT_TIME": 15000 + "F24_DOWNLOAD_WAIT_TIME": 15000, + "PAGOPA_HELP_PP": "https://www.pagopa.it/it/privacy-policy-assistenza" } diff --git a/packages/pn-personafisica-webapp/public/conf/env/config.prod.json b/packages/pn-personafisica-webapp/public/conf/env/config.prod.json index b3c58c7fe6..9bb9aa3efc 100644 --- a/packages/pn-personafisica-webapp/public/conf/env/config.prod.json +++ b/packages/pn-personafisica-webapp/public/conf/env/config.prod.json @@ -11,5 +11,6 @@ "LANDING_SITE_URL": "https://notifichedigitali.pagopa.it", "DELEGATIONS_TO_PG_ENABLED": true, "WORK_IN_PROGRESS": false, - "F24_DOWNLOAD_WAIT_TIME": 15000 + "F24_DOWNLOAD_WAIT_TIME": 15000, + "PAGOPA_HELP_PP": "https://www.pagopa.it/it/privacy-policy-assistenza" } diff --git a/packages/pn-personafisica-webapp/public/conf/env/config.test.json b/packages/pn-personafisica-webapp/public/conf/env/config.test.json index a3bd8c8d5b..bff3b53aea 100644 --- a/packages/pn-personafisica-webapp/public/conf/env/config.test.json +++ b/packages/pn-personafisica-webapp/public/conf/env/config.test.json @@ -11,5 +11,6 @@ "LANDING_SITE_URL": "https://www.test.notifichedigitali.it", "DELEGATIONS_TO_PG_ENABLED": true, "WORK_IN_PROGRESS": false, - "F24_DOWNLOAD_WAIT_TIME": 15000 + "F24_DOWNLOAD_WAIT_TIME": 15000, + "PAGOPA_HELP_PP": "https://www.pagopa.it/it/privacy-policy-assistenza" } diff --git a/packages/pn-personafisica-webapp/public/conf/env/config.uat.json b/packages/pn-personafisica-webapp/public/conf/env/config.uat.json index 3c53c5338a..94ff65bd57 100644 --- a/packages/pn-personafisica-webapp/public/conf/env/config.uat.json +++ b/packages/pn-personafisica-webapp/public/conf/env/config.uat.json @@ -11,5 +11,6 @@ "LANDING_SITE_URL": "https://www.uat.notifichedigitali.it", "DELEGATIONS_TO_PG_ENABLED": true, "WORK_IN_PROGRESS": false, - "F24_DOWNLOAD_WAIT_TIME": 15000 + "F24_DOWNLOAD_WAIT_TIME": 15000, + "PAGOPA_HELP_PP": "https://www.pagopa.it/it/privacy-policy-assistenza" } diff --git a/packages/pn-personafisica-webapp/public/locales/it/common.json b/packages/pn-personafisica-webapp/public/locales/it/common.json index f6e7c351e4..45355799f2 100644 --- a/packages/pn-personafisica-webapp/public/locales/it/common.json +++ b/packages/pn-personafisica-webapp/public/locales/it/common.json @@ -15,6 +15,7 @@ "close": "Chiudi", "enable": "Attiva", "disable": "Disattiva", + "continue": "Avanti", "go-to-home": "Vai alla homepage", "go-to-login": "Accedi" }, diff --git a/packages/pn-personafisica-webapp/public/locales/it/support.json b/packages/pn-personafisica-webapp/public/locales/it/support.json new file mode 100644 index 0000000000..6834abc9d4 --- /dev/null +++ b/packages/pn-personafisica-webapp/public/locales/it/support.json @@ -0,0 +1,16 @@ +{ + "title": "Come possiamo aiutarti?", + "sub-title": "Indica l’indirizzo email in cui desideri ricevere le risposte dell’assistenza.", + "form": { + "email": "Inserisci l'indirizzo email", + "confirm-email": "Conferma l'indirizzo email", + "errors": { + "not-valid": "L'indirizzo email non è valido", + "required": "Campo obbligatorio", + "not-the-same": "L'indirizzo email di conferma non è uguale all'indirizzo email inserito" + } + }, + "disclaimer": "Proseguendo dichiari di aver letto la <0>Privacy Policy Assistenza", + "exit-title": "Vuoi davvero uscire?", + "exit-message": "Se esci, la richiesta di assistenza andrà persa." +} diff --git a/packages/pn-personafisica-webapp/src/App.tsx b/packages/pn-personafisica-webapp/src/App.tsx index 4468b63911..17b5eb7df1 100644 --- a/packages/pn-personafisica-webapp/src/App.tsx +++ b/packages/pn-personafisica-webapp/src/App.tsx @@ -40,6 +40,7 @@ import { RootState } from './redux/store'; import { getConfiguration } from './services/configuration.service'; import { PFAppErrorFactory } from './utility/AppError/PFAppErrorFactory'; import { TrackEventType } from './utility/events'; +import showLayoutParts from './utility/layout.utility'; import { trackEventByType } from './utility/mixpanel'; import './utility/onetrust'; @@ -61,34 +62,13 @@ const productsList: Array = [ // E.g. if a user types the URL with the path /non-accessbile, the App component runs just once. // In "normal" cases, the SessionGuard initialization forces App to render more than one // and therefore to make i18n to be initialized by the time something actually renders. -// -// In turn, adding the ternary operator in the return statement provokes -// the "too high computational complexity" warning to appear -// (in fact it jumps to <= 15 to 30!!). -// The only way I found to prevent it is to split the initialization in a separate React component. // ---------------------------------------- // Carlos Lombardi, 2023.05.26 // ---------------------------------------- const App = () => { - const { t } = useTranslation(['common', 'notifiche']); - const [isInitialized, setIsInitialized] = useState(false); - - useEffect(() => { - if (!isInitialized) { - setIsInitialized(true); - // init localization - initLocalization((namespace, path, data) => t(path, { ns: namespace, ...data })); - // eslint-disable-next-line functional/immutable-data - errorFactoryManager.factory = new PFAppErrorFactory((path, ns) => t(path, { ns })); - } - }, [isInitialized]); - - return isInitialized ? :
; -}; - -const ActualApp = () => { const dispatch = useAppDispatch(); const { t, i18n } = useTranslation(['common', 'notifiche']); + const [isInitialized, setIsInitialized] = useState(false); const loggedUser = useAppSelector((state: RootState) => state.userState.user); const { tosConsent, fetchedTos, privacyConsent, fetchedPrivacy } = useAppSelector( (state: RootState) => state.userState @@ -113,7 +93,16 @@ const ActualApp = () => { [loggedUser] ); - const isPrivacyPage = path[1] === 'privacy-tos'; + const [showHeader, showFooter, showSideMenu, showHeaderProduct, showAssistanceButton] = useMemo( + () => + showLayoutParts( + path[1], + !!sessionToken, + tosConsent && tosConsent.accepted && fetchedTos, + privacyConsent && privacyConsent.accepted && fetchedPrivacy + ), + [path[1], sessionToken, tosConsent, fetchedTos, privacyConsent, fetchedPrivacy] + ); const userActions = useMemo(() => { const profiloAction = { @@ -138,14 +127,6 @@ const ActualApp = () => { useTracking(MIXPANEL_TOKEN, process.env.NODE_ENV); - useEffect(() => { - if (sessionToken !== '') { - void dispatch(getDomicileInfo()); - void dispatch(getSidemenuInformation()); - void dispatch(getCurrentAppStatus()); - } - }, [sessionToken]); - const mapDelegatorSideMenuItem = (): Array | undefined => { // Implementazione esplorativa su come potrebbe gestire l'errore dell'API // che restituisce i delegators per il sideMenu. @@ -222,6 +203,12 @@ const ActualApp = () => { }; const handleAssistanceClick = () => { + // if user is logged in, we redirect to support page + // otherwise, we open the email provider + if (sessionToken) { + navigate(routes.SUPPORT); + return; + } /* eslint-disable-next-line functional/immutable-data */ window.location.href = `mailto:${PAGOPA_HELP_EMAIL}`; }; @@ -269,27 +256,38 @@ const ActualApp = () => { }); }; + useEffect(() => { + if (sessionToken !== '') { + void dispatch(getDomicileInfo()); + void dispatch(getSidemenuInformation()); + void dispatch(getCurrentAppStatus()); + } + }, [sessionToken]); + + useEffect(() => { + if (!isInitialized) { + setIsInitialized(true); + // init localization + initLocalization((namespace, path, data) => t(path, { ns: namespace, ...data })); + // eslint-disable-next-line functional/immutable-data + errorFactoryManager.factory = new PFAppErrorFactory((path, ns) => t(path, { ns })); + } + }, [isInitialized]); + + if (!isInitialized) { + return
; + } + return ( <> } - showSideMenu={ - !!sessionToken && - tosConsent && - tosConsent.accepted && - fetchedTos && - privacyConsent && - privacyConsent.accepted && - fetchedPrivacy && - !isPrivacyPage - } + showSideMenu={showSideMenu} productsList={productsList} - showHeaderProduct={ - tosConsent && tosConsent.accepted && privacyConsent && privacyConsent.accepted - } + showHeaderProduct={showHeaderProduct} loggedUser={jwtUser} enableUserDropdown userActions={userActions} @@ -299,6 +297,7 @@ const ActualApp = () => { hasTermsOfService={true} eventTrackingCallbackAppCrash={handleEventTrackingCallbackAppCrash} eventTrackingCallbackRefreshPage={handleEventTrackingCallbackRefreshPage} + enableAssistanceButton={showAssistanceButton} > {/* await dispatch(logout())} /> */} diff --git a/packages/pn-personafisica-webapp/src/api/support/Support.api.ts b/packages/pn-personafisica-webapp/src/api/support/Support.api.ts new file mode 100644 index 0000000000..91ff132a2f --- /dev/null +++ b/packages/pn-personafisica-webapp/src/api/support/Support.api.ts @@ -0,0 +1,10 @@ +import { ZendeskAuthorizationDTO } from '../../models/Support'; +import { apiClient } from '../apiClients'; +import { ZENDESK_AUTHORIZATION } from './support.routes'; + +export const SupportApi = { + zendeskAuthorization: (params: string): Promise => + apiClient + .post(ZENDESK_AUTHORIZATION(), { email: params }) + .then((response) => response.data), +}; diff --git a/packages/pn-personafisica-webapp/src/api/support/__test__/Support.api.test.ts b/packages/pn-personafisica-webapp/src/api/support/__test__/Support.api.test.ts new file mode 100644 index 0000000000..e37da55bc6 --- /dev/null +++ b/packages/pn-personafisica-webapp/src/api/support/__test__/Support.api.test.ts @@ -0,0 +1,37 @@ +import MockAdapter from 'axios-mock-adapter'; + +import { mockAuthentication } from '../../../__mocks__/Auth.mock'; +import { apiClient } from '../../apiClients'; +import { SupportApi } from '../Support.api'; +import { ZENDESK_AUTHORIZATION } from '../support.routes'; + +describe('Support api tests', () => { + let mock: MockAdapter; + + mockAuthentication(); + + beforeAll(() => { + mock = new MockAdapter(apiClient); + }); + + afterEach(() => { + mock.reset(); + }); + + afterAll(() => { + mock.restore(); + }); + + it('zendeskAuthorization', async () => { + const mail = 'mail@di-prova.it'; + const response = { + action: 'https://zendesk-url.com', + jwt: 'zendesk-jwt', + return_to: 'https://suuport-url.com', + }; + + mock.onPost(ZENDESK_AUTHORIZATION(), { email: mail }).reply(200, response); + const res = await SupportApi.zendeskAuthorization(mail); + expect(res).toStrictEqual(response); + }); +}); diff --git a/packages/pn-personafisica-webapp/src/api/support/__test__/support.routes.test.ts b/packages/pn-personafisica-webapp/src/api/support/__test__/support.routes.test.ts new file mode 100644 index 0000000000..63245ae7be --- /dev/null +++ b/packages/pn-personafisica-webapp/src/api/support/__test__/support.routes.test.ts @@ -0,0 +1,8 @@ +import { ZENDESK_AUTHORIZATION } from '../support.routes'; + +describe('Support routes', () => { + it('should compile ZENDESK_AUTHORIZATION', () => { + const route = ZENDESK_AUTHORIZATION(); + expect(route).toEqual('/zendesk-authorization/new-support-request'); + }); +}); diff --git a/packages/pn-personafisica-webapp/src/api/support/support.routes.ts b/packages/pn-personafisica-webapp/src/api/support/support.routes.ts new file mode 100644 index 0000000000..a644b7e275 --- /dev/null +++ b/packages/pn-personafisica-webapp/src/api/support/support.routes.ts @@ -0,0 +1,16 @@ +import { compileRoute } from '@pagopa-pn/pn-commons'; + +// Segments +const API_SUPPORT_AUTHORIZATION_BASE = 'zendesk-authorization'; +const API_NEW_SUPPORT_REQUEST = 'new-support-request'; + +// Paths +const API_SUPPORT_AUTHORIZATION_PATH = `${API_SUPPORT_AUTHORIZATION_BASE}/${API_NEW_SUPPORT_REQUEST}`; + +// APIs +export function ZENDESK_AUTHORIZATION() { + return compileRoute({ + prefix: '', + path: API_SUPPORT_AUTHORIZATION_PATH, + }); +} diff --git a/packages/pn-personafisica-webapp/src/components/Contacts/__test__/DigitalContactElem.test.tsx b/packages/pn-personafisica-webapp/src/components/Contacts/__test__/DigitalContactElem.test.tsx index 3829586c2e..687eb238e9 100644 --- a/packages/pn-personafisica-webapp/src/components/Contacts/__test__/DigitalContactElem.test.tsx +++ b/packages/pn-personafisica-webapp/src/components/Contacts/__test__/DigitalContactElem.test.tsx @@ -28,11 +28,11 @@ const fields = [ id: 'label', component: 'PEC', size: 'variable' as 'variable' | 'auto', - key: 'key', + key: 'label-key', }, { id: 'value', - key: 'key', + key: 'value-key', component: ( = ({ data }) => { + const { action_url: url, jwt, return_to: returnTo } = data; + + useEffect(() => { + if (url && jwt && returnTo) { + const form = document.getElementById('jwtForm') as HTMLFormElement; + if (form) { + form.submit(); + } + } + }, [url, jwt, returnTo]); + + return ( +
+ + +
+ ); +}; + +export default ZendeskForm; diff --git a/packages/pn-personafisica-webapp/src/models/Support.ts b/packages/pn-personafisica-webapp/src/models/Support.ts new file mode 100644 index 0000000000..aa0f36d4c3 --- /dev/null +++ b/packages/pn-personafisica-webapp/src/models/Support.ts @@ -0,0 +1,10 @@ +export interface SupportForm { + email: string; + confirmEmail: string; +} + +export interface ZendeskAuthorizationDTO { + action_url: string; + jwt: string; + return_to: string; +} diff --git a/packages/pn-personafisica-webapp/src/navigation/routes.const.ts b/packages/pn-personafisica-webapp/src/navigation/routes.const.ts index 95271e62fb..5654c629c7 100644 --- a/packages/pn-personafisica-webapp/src/navigation/routes.const.ts +++ b/packages/pn-personafisica-webapp/src/navigation/routes.const.ts @@ -22,3 +22,4 @@ export const APP_STATUS = '/app-status'; export { PRIVACY_POLICY, TERMS_OF_SERVICE }; export const PARTICIPATING_ENTITIES = '/informativa-aderenti'; export const NOT_ACCESSIBLE = '/non-accessibile'; +export const SUPPORT = '/assistenza'; diff --git a/packages/pn-personafisica-webapp/src/navigation/routes.tsx b/packages/pn-personafisica-webapp/src/navigation/routes.tsx index 2cb14cc61a..7e8f4b83bd 100644 --- a/packages/pn-personafisica-webapp/src/navigation/routes.tsx +++ b/packages/pn-personafisica-webapp/src/navigation/routes.tsx @@ -1,13 +1,14 @@ import { Suspense } from 'react'; -import { Routes, Route } from 'react-router-dom'; +import { Route, Routes } from 'react-router-dom'; + import { AppNotAccessible, LoadingPage, NotFound, lazyRetry } from '@pagopa-pn/pn-commons'; import { getConfiguration } from '../services/configuration.service'; -import * as routes from './routes.const'; -import SessionGuard from './SessionGuard'; +import AARGuard from './AARGuard'; import RouteGuard from './RouteGuard'; +import SessionGuard from './SessionGuard'; import ToSGuard from './ToSGuard'; -import AARGuard from './AARGuard'; +import * as routes from './routes.const'; const Profile = lazyRetry(() => import('../pages/Profile.page')); const Notifiche = lazyRetry(() => import('../pages/Notifiche.page')); @@ -19,6 +20,7 @@ const PrivacyPolicyPage = lazyRetry(() => import('../pages/PrivacyPolicy.page')) const TermsOfServicePage = lazyRetry(() => import('../pages/TermsOfService.page')); const AppStatus = lazyRetry(() => import('../pages/AppStatus.page')); const ParticipatingEntitiesPage = lazyRetry(() => import('../pages/ParticipatingEntities.page')); +const SupportPage = lazyRetry(() => import('../pages/Support.page')); const handleAssistanceClick = () => { /* eslint-disable-next-line functional/immutable-data */ @@ -43,6 +45,7 @@ function Router() { } /> } /> } /> + } /> {/* not found - non-logged users will see the common AccessDenied component */} diff --git a/packages/pn-personafisica-webapp/src/pages/Support.page.tsx b/packages/pn-personafisica-webapp/src/pages/Support.page.tsx new file mode 100644 index 0000000000..e36b37d367 --- /dev/null +++ b/packages/pn-personafisica-webapp/src/pages/Support.page.tsx @@ -0,0 +1,208 @@ +import { useReducer, useState } from 'react'; +import { Trans, useTranslation } from 'react-i18next'; +import { useNavigate } from 'react-router-dom'; + +import { Box, Button, Paper, Stack, TextField, Typography } from '@mui/material'; +import { Prompt, TitleBox } from '@pagopa-pn/pn-commons'; +import { ValidationError } from '@pagopa-pn/pn-validator'; +import { ButtonNaked } from '@pagopa/mui-italia'; + +import ZendeskForm from '../components/Support/ZendeskForm'; +import { SupportForm, ZendeskAuthorizationDTO } from '../models/Support'; +import { useAppDispatch } from '../redux/hooks'; +import { zendeskAuthorization } from '../redux/support/actions'; +import { getConfiguration } from '../services/configuration.service'; +import validator from '../validators/SupportFormValidator'; + +type FormState = { + email: { + touched: boolean; + value: string; + }; + confirmEmail: { + touched: boolean; + value: string; + }; + errors: null | ValidationError; +}; + +const reducer = (state: FormState, action: { type: string; payload: string }) => { + switch (action.type) { + case 'UPDATE_EMAIL': + return { + ...state, + email: { + value: action.payload, + touched: true, + }, + errors: validator.validate({ + email: action.payload, + confirmEmail: state.confirmEmail.value, + }), + }; + case 'UPDATE_CONFIRM_EMAIL': + return { + ...state, + confirmEmail: { + value: action.payload, + touched: true, + }, + errors: validator.validate({ + email: state.email.value, + confirmEmail: action.payload, + }), + }; + default: + return state; + } +}; + +const SupportPPButton: React.FC<{ children?: React.ReactNode }> = ({ children }) => { + const { PAGOPA_HELP_PP } = getConfiguration(); + const handleClick = () => { + window.location.assign(PAGOPA_HELP_PP); + }; + + return ( + + + {children} + + + ); +}; + +const SupportPage: React.FC = () => { + const { t } = useTranslation(['support', 'common']); + const [formData, formDispatch] = useReducer(reducer, { + email: { + value: '', + touched: false, + }, + confirmEmail: { + value: '', + touched: false, + }, + errors: validator.validate({ email: '', confirmEmail: '' }), + }); + const [zendeskAuthData, setZendeskAuthData] = useState({ + action_url: '', + return_to: '', + jwt: '', + }); + const navigate = useNavigate(); + const dispatch = useAppDispatch(); + + const handleChange = ( + type: 'UPDATE_EMAIL' | 'UPDATE_CONFIRM_EMAIL', + event: React.ChangeEvent + ) => { + formDispatch({ type, payload: event.target.value }); + }; + + const handleCancel = () => { + navigate(-1); + }; + + const handleConfirm = () => { + if (!formData.errors) { + dispatch(zendeskAuthorization(formData.email.value)) + .unwrap() + .then((response) => { + setZendeskAuthData(response); + }) + .catch(() => {}); + } + }; + + return ( + + + + + +
+ handleChange('UPDATE_EMAIL', e)} + value={formData.email.value} + error={formData.email.touched && !!formData.errors?.email} + helperText={ + formData.email.touched && + !!formData.errors?.email && + t('form.errors.' + formData.errors?.email) + } + /> + handleChange('UPDATE_CONFIRM_EMAIL', e)} + value={formData.confirmEmail.value} + error={formData.confirmEmail.touched && !!formData.errors?.confirmEmail} + helperText={ + formData.confirmEmail.touched && + !!formData.errors?.confirmEmail && + t('form.errors.' + formData.errors?.confirmEmail) + } + /> + +
+ + ]} + variant="body2" + /> + + + + + +
+ +
+
+ ); +}; + +export default SupportPage; diff --git a/packages/pn-personafisica-webapp/src/pages/__test__/NuovaDelega.test.tsx b/packages/pn-personafisica-webapp/src/pages/__test__/NuovaDelega.test.tsx index 4e1a6ee546..3a64ecc374 100644 --- a/packages/pn-personafisica-webapp/src/pages/__test__/NuovaDelega.test.tsx +++ b/packages/pn-personafisica-webapp/src/pages/__test__/NuovaDelega.test.tsx @@ -1,4 +1,5 @@ import MockAdapter from 'axios-mock-adapter'; +import { createBrowserHistory } from 'history'; import { Route, Routes } from 'react-router-dom'; import { vi } from 'vitest'; @@ -133,15 +134,16 @@ describe('NuovaDelega page', async () => { let result: RenderResult | undefined; // simulate the current URL - window.history.pushState({}, '', '/nuova-delega'); + const history = createBrowserHistory(); + history.push(routes.NUOVA_DELEGA); // render with an ad-hoc router, will render initially NuovaDelega // since it corresponds to the top of the mocked history stack await act(async () => { result = render( - hello
} /> - } /> + hello} /> + } /> ); }); diff --git a/packages/pn-personafisica-webapp/src/pages/__test__/Support.page.test.tsx b/packages/pn-personafisica-webapp/src/pages/__test__/Support.page.test.tsx new file mode 100644 index 0000000000..42c4f6a445 --- /dev/null +++ b/packages/pn-personafisica-webapp/src/pages/__test__/Support.page.test.tsx @@ -0,0 +1,161 @@ +import MockAdapter from 'axios-mock-adapter'; +import { createBrowserHistory } from 'history'; +import { ReactNode } from 'react'; +import { Route, Routes } from 'react-router-dom'; +import { vi } from 'vitest'; + +import { getById, testInput } from '@pagopa-pn/pn-commons/src/test-utils'; + +import { RenderResult, act, fireEvent, render, waitFor, within } from '../../__test__/test-utils'; +import { apiClient } from '../../api/apiClients'; +import { ZENDESK_AUTHORIZATION } from '../../api/support/support.routes'; +import * as routes from '../../navigation/routes.const'; +import SupportPage from '../Support.page'; + +// mock imports +vi.mock('react-i18next', () => ({ + // this mock makes sure any components using the translate hook can use it without a warning being shown + useTranslation: () => ({ + t: (str: string) => str, + }), + Trans: (props: { i18nKey: string; components?: Array }) => ( + <> + {props.i18nKey} {props.components!.map((c) => c)} + + ), +})); + +describe('Support page', async () => { + let result: RenderResult; + let mock: MockAdapter; + + beforeAll(() => { + mock = new MockAdapter(apiClient); + }); + + afterEach(() => { + mock.reset(); + }); + + afterAll(() => { + mock.restore(); + }); + + it('render page', () => { + const { container, getByTestId } = render(); + expect(container).toHaveTextContent(/title/); + expect(container).toHaveTextContent(/sub-title/); + const form = getByTestId('supportForm'); + expect(form).toBeInTheDocument(); + const email = getById(form, 'mail'); + expect(email).toBeInTheDocument(); + expect(email).toHaveValue(''); + const confirmEmail = getById(form, 'confirmMail'); + expect(confirmEmail).toBeInTheDocument(); + expect(confirmEmail).toHaveValue(''); + const backButton = getByTestId('backButton'); + expect(backButton).toBeInTheDocument(); + const continueButton = getByTestId('continueButton'); + expect(continueButton).toBeInTheDocument(); + expect(continueButton).toBeDisabled(); + }); + + it('fill values - OK', () => { + const { getByTestId } = render(); + const form = getByTestId('supportForm'); + testInput(form, 'mail', 'mail@example.it'); + testInput(form, 'confirmMail', 'mail@example.it'); + const continueButton = getByTestId('continueButton'); + expect(continueButton).toBeEnabled(); + }); + + it('fill values - KO - emails not the same', () => { + const { getByTestId } = render(); + const form = getByTestId('supportForm'); + testInput(form, 'mail', 'mail@example.it'); + testInput(form, 'confirmMail', 'mail-divergent@example.it'); + const continueButton = getByTestId('continueButton'); + expect(continueButton).toBeDisabled(); + const helperText = getById(form, 'confirmMail-helper-text'); + expect(helperText).toHaveTextContent('form.errors.not-the-same'); + }); + + it('fill values - KO - invalid emails', () => { + const { getByTestId } = render(); + const form = getByTestId('supportForm'); + testInput(form, 'mail', 'mail-wrong.it'); + testInput(form, 'confirmMail', 'mail-wrong.it'); + const continueButton = getByTestId('continueButton'); + expect(continueButton).toBeDisabled(); + const helperTextMail = getById(form, 'mail-helper-text'); + expect(helperTextMail).toHaveTextContent('form.errors.not-valid'); + const helperTextConfirmMail = getById(form, 'confirmMail-helper-text'); + expect(helperTextConfirmMail).toHaveTextContent('form.errors.not-valid'); + }); + + it('click back button and show prompt', async () => { + // insert two entries into the history, so the initial render will refer to the path /assistenza + // and when the back button is pressed and so navigate(-1) is invoked, + // the path will change to /notifiche + const history = createBrowserHistory(); + history.push(routes.NOTIFICHE); + history.push(routes.SUPPORT); + + // render with an ad-hoc router, will render initially SupportPage + // since it corresponds to the top of the mocked history stack + await act(async () => { + result = render( + + hello} + /> + } /> + + ); + }); + + // before clicking the button - mocked dashboard not present + const mockedPageBefore = result.queryByTestId('mocked-dashboard'); + expect(mockedPageBefore).not.toBeInTheDocument(); + + // simulate clicking the button + const backButton = result.getByTestId('backButton'); + fireEvent.click(backButton); + + // prompt must be shown + const promptDialog = await waitFor(() => result.getByTestId('promptDialog')); + expect(promptDialog).toBeInTheDocument(); + const confirmExitBtn = within(promptDialog!).getByTestId('confirmExitBtn'); + fireEvent.click(confirmExitBtn); + + // after clicking button - mocked dashboard present + await waitFor(() => { + const mockedPageAfter = result.queryByTestId('mocked-dashboard'); + expect(mockedPageAfter).toBeInTheDocument(); + }); + }); + + it('submit form', async () => { + const mail = 'mail@example.it'; + const response = { + action: 'https://zendesk-url.com', + jwt: 'zendesk-jwt', + return_to: 'https://suuport-url.com', + }; + + mock.onPost(ZENDESK_AUTHORIZATION(), { email: mail }).reply(200, response); + + const { getByTestId } = render(); + const form = getByTestId('supportForm'); + testInput(form, 'mail', mail); + testInput(form, 'confirmMail', mail); + const continueButton = getByTestId('continueButton'); + expect(continueButton).toBeEnabled(); + fireEvent.click(continueButton); + await waitFor(() => { + expect(mock.history.post).toHaveLength(1); + expect(mock.history.post[0].url).toBe(ZENDESK_AUTHORIZATION()); + }); + }); +}); diff --git a/packages/pn-personafisica-webapp/src/redux/support/actions.ts b/packages/pn-personafisica-webapp/src/redux/support/actions.ts new file mode 100644 index 0000000000..f42280739a --- /dev/null +++ b/packages/pn-personafisica-webapp/src/redux/support/actions.ts @@ -0,0 +1,10 @@ +import { performThunkAction } from '@pagopa-pn/pn-commons'; +import { createAsyncThunk } from '@reduxjs/toolkit'; + +import { SupportApi } from '../../api/support/Support.api'; +import { ZendeskAuthorizationDTO } from '../../models/Support'; + +export const zendeskAuthorization = createAsyncThunk( + 'zendeskAuthorization', + performThunkAction((params: string) => SupportApi.zendeskAuthorization(params)) +); diff --git a/packages/pn-personafisica-webapp/src/services/configuration.service.ts b/packages/pn-personafisica-webapp/src/services/configuration.service.ts index 1dbf9afb45..a1e49b978b 100644 --- a/packages/pn-personafisica-webapp/src/services/configuration.service.ts +++ b/packages/pn-personafisica-webapp/src/services/configuration.service.ts @@ -19,26 +19,22 @@ interface PfConfigurationFromFile { DELEGATIONS_TO_PG_ENABLED: boolean; WORK_IN_PROGRESS?: boolean; F24_DOWNLOAD_WAIT_TIME: number; + PAGOPA_HELP_PP: string; } interface PfConfiguration extends PfConfigurationFromFile { DISABLE_INACTIVITY_HANDLER: boolean; IS_DEVELOP: boolean; LOG_REDUX_ACTIONS: boolean; - MOCK_USER: boolean; ONE_TRUST_DRAFT_MODE: boolean; ONE_TRUST_PARTICIPATING_ENTITIES: string; ONE_TRUST_PP: string; ONE_TRUST_TOS: string; OT_DOMAIN_ID: string; - PAGOPA_HELP_EMAIL: string; PAYMENT_DISCLAIMER_URL: string; VERSION: string; URL_FE_LOGOUT: string; - LANDING_SITE_URL: string; - DELEGATIONS_TO_PG_ENABLED: boolean; WORK_IN_PROGRESS: boolean; - F24_DOWNLOAD_WAIT_TIME: number; } class PfConfigurationValidator extends Validator { @@ -58,6 +54,7 @@ class PfConfigurationValidator extends Validator { this.ruleFor('DELEGATIONS_TO_PG_ENABLED').isBoolean(); this.ruleFor('WORK_IN_PROGRESS').isBoolean(); this.ruleFor('F24_DOWNLOAD_WAIT_TIME').isNumber(); + this.ruleFor('PAGOPA_HELP_PP').isString(); } makeRequired(rule: StringRuleValidator): void { @@ -80,9 +77,8 @@ export function getConfiguration(): PfConfiguration { OT_DOMAIN_ID: configurationFromFile.OT_DOMAIN_ID || '', PAYMENT_DISCLAIMER_URL: configurationFromFile.PAYMENT_DISCLAIMER_URL || '', IS_DEVELOP, - MOCK_USER: IS_DEVELOP, LOG_REDUX_ACTIONS: IS_DEVELOP, - URL_FE_LOGOUT: "/auth/logout", + URL_FE_LOGOUT: '/auth/logout', VERSION, LANDING_SITE_URL: configurationFromFile.LANDING_SITE_URL || '', DELEGATIONS_TO_PG_ENABLED: Boolean(configurationFromFile.DELEGATIONS_TO_PG_ENABLED), diff --git a/packages/pn-personafisica-webapp/src/setupTests.ts b/packages/pn-personafisica-webapp/src/setupTests.ts index 3f2288caac..77f3f1db22 100644 --- a/packages/pn-personafisica-webapp/src/setupTests.ts +++ b/packages/pn-personafisica-webapp/src/setupTests.ts @@ -21,7 +21,6 @@ beforeAll(() => { PAGOPA_HELP_EMAIL: 'assistenza@pn.it', IS_DEVELOP: false, MIXPANEL_TOKEN: 'DUMMY', - MOCK_USER: false, LOG_REDUX_ACTIONS: false, APP_VERSION: 'mock-version', SELFCARE_URL_FE_LOGIN: 'mock-selfcare-login', @@ -29,6 +28,7 @@ beforeAll(() => { IS_PAYMENT_ENABLED: false, DELEGATIONS_TO_PG_ENABLED: true, LANDING_SITE_URL: 'https://www.dev.notifichedigitali.it', + PAGOPA_HELP_PP: 'https://www.fake-page.it', }); initStore(false); initAxiosClients(); diff --git a/packages/pn-personafisica-webapp/src/utility/__test__/layout.utility.test.ts b/packages/pn-personafisica-webapp/src/utility/__test__/layout.utility.test.ts new file mode 100644 index 0000000000..84fec649c0 --- /dev/null +++ b/packages/pn-personafisica-webapp/src/utility/__test__/layout.utility.test.ts @@ -0,0 +1,53 @@ +import showLayoutParts from '../layout.utility'; + +describe('Tests layout utility', () => { + it('everything is shown', () => { + const [showHeader, showFooter, showSideMenu, showHeaderProduct, showAssistanceButton] = + showLayoutParts('test-path', true, true, true); + expect(showHeader).toBeTruthy(); + expect(showFooter).toBeTruthy(); + expect(showSideMenu).toBeTruthy(); + expect(showHeaderProduct).toBeTruthy(); + expect(showAssistanceButton).toBeTruthy(); + }); + + it('privacy-tos page', () => { + const [showHeader, showFooter, showSideMenu, showHeaderProduct, showAssistanceButton] = + showLayoutParts('privacy-tos', true, true, true); + expect(showHeader).toBeFalsy(); + expect(showFooter).toBeFalsy(); + expect(showSideMenu).toBeFalsy(); + expect(showHeaderProduct).toBeTruthy(); + expect(showAssistanceButton).toBeTruthy(); + }); + + it('assistance page', () => { + const [showHeader, showFooter, showSideMenu, showHeaderProduct, showAssistanceButton] = + showLayoutParts('assistenza', true, true, true); + expect(showHeader).toBeTruthy(); + expect(showFooter).toBeTruthy(); + expect(showSideMenu).toBeFalsy(); + expect(showHeaderProduct).toBeFalsy(); + expect(showAssistanceButton).toBeFalsy(); + }); + + it('not logged user', () => { + const [showHeader, showFooter, showSideMenu, showHeaderProduct, showAssistanceButton] = + showLayoutParts('test-path', false, true, true); + expect(showHeader).toBeTruthy(); + expect(showFooter).toBeTruthy(); + expect(showSideMenu).toBeFalsy(); + expect(showHeaderProduct).toBeTruthy(); + expect(showAssistanceButton).toBeTruthy(); + }); + + it('privacy and tos not accepted', () => { + const [showHeader, showFooter, showSideMenu, showHeaderProduct, showAssistanceButton] = + showLayoutParts('test-path', true, false, false); + expect(showHeader).toBeTruthy(); + expect(showFooter).toBeTruthy(); + expect(showSideMenu).toBeFalsy(); + expect(showHeaderProduct).toBeFalsy(); + expect(showAssistanceButton).toBeTruthy(); + }); +}); diff --git a/packages/pn-personafisica-webapp/src/utility/layout.utility.ts b/packages/pn-personafisica-webapp/src/utility/layout.utility.ts new file mode 100644 index 0000000000..3bae2e7d0a --- /dev/null +++ b/packages/pn-personafisica-webapp/src/utility/layout.utility.ts @@ -0,0 +1,47 @@ +import * as routes from '../navigation/routes.const'; + +function showHeader(path: string): boolean { + return path !== 'privacy-tos'; +} + +function showFooter(path: string): boolean { + return path !== 'privacy-tos'; +} + +function showSideMenu( + path: string, + isLogged: boolean, + tosAccepted: boolean, + privacyAccepted: boolean +): boolean { + return ( + path !== 'privacy-tos' && + path !== routes.SUPPORT.slice(1) && + isLogged && + tosAccepted && + privacyAccepted + ); +} + +function showHeaderProduct(path: string, tosAccepted: boolean, privacyAccepted: boolean): boolean { + return path !== routes.SUPPORT.slice(1) && tosAccepted && privacyAccepted; +} + +function showAssistanceButton(path: string): boolean { + return path !== routes.SUPPORT.slice(1); +} + +export default function showLayoutParts( + path: string, + isLogged: boolean, + tosAccepted: boolean, + privacyAccepted: boolean +) { + return [ + showHeader(path), + showFooter(path), + showSideMenu(path, isLogged, tosAccepted, privacyAccepted), + showHeaderProduct(path, tosAccepted, privacyAccepted), + showAssistanceButton(path), + ]; +} diff --git a/packages/pn-personafisica-webapp/src/validators/SupportFormValidator.ts b/packages/pn-personafisica-webapp/src/validators/SupportFormValidator.ts new file mode 100644 index 0000000000..9072434af3 --- /dev/null +++ b/packages/pn-personafisica-webapp/src/validators/SupportFormValidator.ts @@ -0,0 +1,28 @@ +import { dataRegex } from '@pagopa-pn/pn-commons'; +import { Validator } from '@pagopa-pn/pn-validator'; + +import { SupportForm } from '../models/Support'; + +function makeRequired(rule: any): void { + rule.not().isEmpty('required').not().isUndefined('required').not().isNull('required'); +} + +class SupportFormValidator extends Validator { + constructor() { + super(); + makeRequired(this.ruleFor('email').isString().matches(dataRegex.email, 'not-valid')); + makeRequired( + this.ruleFor('confirmEmail') + .isString() + .matches(dataRegex.email, 'not-valid') + .customValidator((value: string, model: SupportForm) => { + if (value === model.email) { + return null; + } + return 'not-the-same'; + }) + ); + } +} + +export default new SupportFormValidator(); diff --git a/packages/pn-personafisica-webapp/src/validators/__test__/SupportFormValidator.test.ts b/packages/pn-personafisica-webapp/src/validators/__test__/SupportFormValidator.test.ts new file mode 100644 index 0000000000..f84a834601 --- /dev/null +++ b/packages/pn-personafisica-webapp/src/validators/__test__/SupportFormValidator.test.ts @@ -0,0 +1,35 @@ +import validator from '../SupportFormValidator'; + +describe('Tests SupportFormValidator', () => { + it('validation OK', () => { + const result = validator.validate({ email: 'test@mail.it', confirmEmail: 'test@mail.it' }); + expect(result).toBeNull(); + }); + + it('validation KO - divergent emails', () => { + const result = validator.validate({ + email: 'test@mail.it', + confirmEmail: 'test-divergent@mail.it', + }); + expect(result).toEqual({ confirmEmail: 'not-the-same' }); + }); + + it('validation KO - empty email', () => { + const result = validator.validate({ + email: '', + confirmEmail: 'test@mail.it', + }); + expect(result).toEqual({ + email: 'not-valid', + confirmEmail: 'not-the-same', + }); + }); + + it('validation KO - empty confirmation email', () => { + const result = validator.validate({ + email: 'test@mail.it', + confirmEmail: '', + }); + expect(result).toEqual({ confirmEmail: 'not-valid' }); + }); +}); diff --git a/packages/pn-personagiuridica-webapp/src/pages/__test__/NuovaDelega.page.test.tsx b/packages/pn-personagiuridica-webapp/src/pages/__test__/NuovaDelega.page.test.tsx index 205e62dc0d..ada564f71f 100644 --- a/packages/pn-personagiuridica-webapp/src/pages/__test__/NuovaDelega.page.test.tsx +++ b/packages/pn-personagiuridica-webapp/src/pages/__test__/NuovaDelega.page.test.tsx @@ -1,4 +1,5 @@ import MockAdapter from 'axios-mock-adapter'; +import { createBrowserHistory } from 'history'; import { Route, Routes } from 'react-router-dom'; import { vi } from 'vitest'; @@ -16,6 +17,7 @@ import { RenderResult, act, fireEvent, render, waitFor } from '../../__test__/te import { apiClient } from '../../api/apiClients'; import { CREATE_DELEGATION } from '../../api/delegations/delegations.routes'; import { GET_ALL_ACTIVATED_PARTIES } from '../../api/external-registries/external-registries-routes'; +import * as routes from '../../navigation/routes.const'; import { createDelegationMapper } from '../../redux/newDelegation/actions'; import NuovaDelega from '../NuovaDelega.page'; @@ -125,16 +127,17 @@ describe('NuovaDelega page', async () => { // insert two entries into the history, so the initial render will refer to the path / // and when the back button is pressed and so navigate(-1) is invoked, // the path will change to /mock-path - window.history.pushState({}, '', '/mock-path'); - window.history.pushState({}, '', '/deleghe/delegati/nuova'); + const history = createBrowserHistory(); + history.push(routes.NOTIFICHE); + history.push(routes.NUOVA_DELEGA); // render with an ad-hoc router, will render initially NuovaDelega // since it corresponds to the top of the mocked history stack await act(async () => { result = render( - hello} /> - } /> + hello} /> + } /> ); }); diff --git a/packages/pn-validator/src/index.ts b/packages/pn-validator/src/index.ts index 457534678b..0ac1beaaad 100644 --- a/packages/pn-validator/src/index.ts +++ b/packages/pn-validator/src/index.ts @@ -1,3 +1,5 @@ import { Validator } from './Validator'; +import { ValidationError } from './types/ValidationError'; -export { Validator} \ No newline at end of file +export { Validator }; +export type { ValidationError }; diff --git a/packages/pn-validator/src/rules/IsEqual.ts b/packages/pn-validator/src/rules/IsEqual.ts index 62107ac304..042a680180 100644 --- a/packages/pn-validator/src/rules/IsEqual.ts +++ b/packages/pn-validator/src/rules/IsEqual.ts @@ -26,12 +26,11 @@ export class IsEqual extends Rule { ): boolean => { if (isObject(value) && isObject(valueToCompare)) { if (Object.keys(value).length === Object.keys(valueToCompare).length) { - return Object.keys(value).every((key) => { - return ( - (valueToCompare as Object).hasOwnProperty(key) && + return Object.keys(value).every( + (key) => + Object.prototype.hasOwnProperty.call(valueToCompare, key) && this.compare(value[key as TPropertyName], valueToCompare[key as TPropertyName]) - ); - }); + ); } return false; } @@ -41,9 +40,7 @@ export class IsEqual extends Rule { private compareArray = (value: TArg, valueToCompare: TArg): boolean => { if (isArray(value) && isArray(valueToCompare)) { if (value.length === valueToCompare.length) { - return value.every((elem, index) => { - return this.compare(elem, valueToCompare[index]); - }); + return value.every((elem, index) => this.compare(elem, valueToCompare[index])); } return false; } @@ -77,7 +74,7 @@ export class IsEqual extends Rule { public valueValidator = (value: TValue) => { if (this.compare(value, this.valueToCompare)) { - return !this.not ? null : `Value mustn\'t be equal to ${this.printValue()}`; + return !this.not ? null : `Value mustn't be equal to ${this.printValue()}`; } return !this.not ? `Value must be equal to ${this.printValue()}` : null; }; diff --git a/packages/pn-validator/src/types/ValidationError.ts b/packages/pn-validator/src/types/ValidationError.ts index 1cea84de64..e1c156bad1 100644 --- a/packages/pn-validator/src/types/ValidationError.ts +++ b/packages/pn-validator/src/types/ValidationError.ts @@ -1,5 +1,5 @@ -import { ValidationResult } from "./ValidationResult"; +import { ValidationResult } from './ValidationResult'; export type ValidationError = { - [propertyName in keyof TModel]?: ValidationResult -} \ No newline at end of file + [propertyName in keyof TModel]?: ValidationResult; +}; From 2e0e3db6d3ab67adc045480c1a53a83e4ea5d918 Mon Sep 17 00:00:00 2001 From: Sarah Donvito <73442810+SarahDonvito@users.noreply.github.com> Date: Tue, 26 Mar 2024 12:51:47 +0100 Subject: [PATCH 5/9] fix(PN-10111): update link assistenza when logged for PA (#1168) --- packages/pn-pa-webapp/src/App.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/pn-pa-webapp/src/App.tsx b/packages/pn-pa-webapp/src/App.tsx index d216ece221..d341288216 100644 --- a/packages/pn-pa-webapp/src/App.tsx +++ b/packages/pn-pa-webapp/src/App.tsx @@ -213,7 +213,7 @@ const ActualApp = () => { }); /* eslint-disable-next-line functional/immutable-data */ window.location.href = sessionToken - ? `${SELFCARE_BASE_URL}/assistenza` + ? `${SELFCARE_BASE_URL}/assistenza?productId=${productId}` : `mailto:${configuration.PAGOPA_HELP_EMAIL}`; }; From a346a81554555f03e84c4aa067d5cf3b1b954329 Mon Sep 17 00:00:00 2001 From: Carlotta Dimatteo Date: Wed, 27 Mar 2024 16:53:49 +0100 Subject: [PATCH 6/9] Revert "Release/2.3.0 (#1125)" This reverts commit c59c440ba6b2e4aafb107453d572126c82a87f28. --- CHANGELOG.md | 28 - README.md | 6 +- aws-cdn-templates/one-cdn.yaml | 276 +- lerna.json | 2 +- package.json | 25 +- packages/pn-commons/.gitignore | 1 + packages/pn-commons/CHANGELOG.md | 27 - packages/pn-commons/babel.config.js | 23 - packages/pn-commons/package.json | 80 +- .../src/__mocks__/NotificationDetail.mock.ts | 26 +- packages/pn-commons/src/assets/question.svg | 15 - .../src/components/ApiError/ApiError.tsx | 1 - .../components/ApiError/ApiErrorWrapper.tsx | 1 - .../ApiError/__test__/ApiError.test.tsx | 61 +- .../__test__/ApiErrorWrapper.test.tsx | 154 +- .../src/components/AppStatus/AppStatusBar.tsx | 1 - .../components/AppStatus/AppStatusRender.tsx | 7 +- .../AppStatus/__test__/AppStatusBar.test.tsx | 6 +- .../__test__/AppStatusRender.test.tsx | 16 +- .../__test__/DesktopDowntimeLog.test.tsx | 8 +- .../__test__/DowntimeLogDataSwitch.test.tsx | 4 +- .../__test__/MobileDowntimeLog.test.tsx | 11 +- .../src/components/CodeModal/CodeModal.tsx | 62 +- .../CodeModal/__test__/CodeInput.test.tsx | 30 +- .../CodeModal/__test__/CodeModal.test.tsx | 8 +- .../src/components/CustomDatePicker.tsx | 52 +- .../src/components/CustomDropdown.tsx | 5 +- .../CustomMobileDialog.context.tsx | 4 +- .../CustomMobileDialog/CustomMobileDialog.tsx | 2 +- .../CustomMobileDialogAction.tsx | 1 - .../CustomMobileDialogToggle.tsx | 1 - .../CustomMobileDialog.context.test.tsx | 1 + .../__test__/CustomMobileDialog.test.tsx | 2 + .../CustomMobileDialogAction.test.tsx | 2 + .../CustomMobileDialogContent.test.tsx | 2 + .../CustomMobileDialogToggle.test.tsx | 2 + .../CustomTagGroup/CustomTagGroup.tsx | 2 - .../__test__/CustomTagGroup.test.tsx | 8 +- .../Data/PnCard/__test__/PnCard.test.tsx | 2 + .../PnCard/__test__/PnCardActions.test.tsx | 2 + .../__test__/PnCardContactItem.test.tsx | 2 + .../PnCard/__test__/PnCardContent.test.tsx | 2 + .../PnCard/__test__/PnCardHeader.test.tsx | 2 + .../PnCard/__test__/PnCardHeaderItem.test.tsx | 2 + .../PnTable/__test__/PnTableBody.test.tsx | 2 + .../PnTable/__test__/PnTableBodyCell.test.tsx | 4 +- .../PnTable/__test__/PnTableBodyRow.test.tsx | 2 + .../PnTable/__test__/PnTableHeader.test.tsx | 2 + .../__test__/PnTableHeaderCell.test.tsx | 4 +- .../Data/SmartTable/SmartFilter.tsx | 11 +- .../SmartTable/__test__/SmartActions.test.tsx | 2 + .../SmartTable/__test__/SmartBody.test.tsx | 2 + .../__test__/SmartBodyCell.test.tsx | 2 + .../SmartTable/__test__/SmartBodyRow.test.tsx | 2 + .../SmartTable/__test__/SmartData.test.tsx | 12 +- .../SmartTable/__test__/SmartFilter.test.tsx | 11 +- .../SmartTable/__test__/SmartHeader.test.tsx | 2 + .../SmartTable/__test__/SmartSort.test.tsx | 8 +- .../Data/__test__/PnCardsList.test.tsx | 8 +- .../components/Data/__test__/PnTable.test.tsx | 6 +- .../Data/__test__/SmartTable.test.tsx | 8 +- .../src/components/DisclaimerModal.tsx | 49 +- .../pn-commons/src/components/EmptyState.tsx | 1 - .../src/components/ErrorBoundary.tsx | 2 +- .../src/components/Footer/Footer.tsx | 14 +- .../Footer/__test__/Footer.test.tsx | 36 +- .../Header/__test__/Header.test.tsx | 10 +- .../Illustrations/IllusQuestion.tsx | 8 - .../src/components/Layout/Layout.tsx | 122 +- .../Layout/__test__/Layout.test.tsx | 2 + .../src/components/Loading/LoadingOverlay.tsx | 6 +- .../Loading/__test__/LoadingOverlay.test.tsx | 2 + .../NotificationDetailDocuments.tsx | 2 +- .../NotificationDetailTable.tsx | 1 - .../NotificationDetailTimeline.tsx | 4 +- .../NotificationDetailTimelineStep.tsx | 340 +- .../NotificationPaymentF24Item.tsx | 4 - .../NotificationPaymentRecipient.tsx | 23 +- .../NotificationPaymentTitle.tsx | 4 +- .../NotificationRelatedDowntimes.tsx | 9 - .../NotificationDetailDocuments.test.tsx | 8 +- .../__test__/NotificationDetailTable.test.tsx | 2 + .../NotificationDetailTimeline.test.tsx | 2 + .../NotificationDetailTimelineStep.test.tsx | 6 +- .../NotificationPaymentF24Item.test.tsx | 163 +- .../NotificationPaymentPagoPAItem.test.tsx | 6 +- .../NotificationPaymentRecipient.test.tsx | 115 +- .../NotificationPaymentTitle.test.tsx | 44 +- .../NotificationRelatedDowntimes.test.tsx | 12 +- .../Notifications/NewNotificationBadge.tsx | 3 +- .../__test__/MobileNotificationsSort.test.tsx | 42 +- .../NewNotificationBadge.a11y.test.tsx | 1 + .../__test__/NewNotificationBadge.test.tsx | 2 + .../__test__/NotificationsDataSwitch.test.tsx | 4 +- .../__test__/StatusTooltip.test.tsx | 4 +- .../Pagination/CustomPagination.tsx | 2 +- .../__test__/CustomPagination.test.tsx | 6 +- .../src/components/PnDialog/PnDialog.tsx | 19 +- .../components/PnDialog/PnDialogActions.tsx | 14 +- .../components/PnDialog/PnDialogContent.tsx | 11 +- .../PnDialog/__test__/PnDialog.test.tsx | 5 +- .../__test__/PnDialogActions.test.tsx | 8 +- .../__test__/PnDialogContent.test.tsx | 5 +- packages/pn-commons/src/components/Prompt.tsx | 50 +- .../src/components/SectionHeading.tsx | 29 +- .../src/components/SessionModal.tsx | 30 +- .../components/SideMenu/NotificationBadge.tsx | 10 +- .../src/components/SideMenu/SideMenuList.tsx | 18 +- .../components/SideMenu/SideMenuListItem.tsx | 6 +- .../__test__/NotificationBadge.test.tsx | 2 + .../SideMenu/__test__/SideMenu.a11y.test.tsx | 1 + .../SideMenu/__test__/SideMenu.test.tsx | 12 +- .../SideMenu/__test__/SideMenuList.test.tsx | 6 +- .../__test__/SideMenuListItem.test.tsx | 10 +- .../SnackBar/__test__/SnackBar.test.tsx | 27 +- .../components/SpecialContacts.context.tsx | 2 +- .../pn-commons/src/components/TabPanel.tsx | 2 - .../__test__/TimedMessage.test.tsx | 4 +- .../pn-commons/src/components/TitleBox.tsx | 2 - .../components/__test__/AppMessage.test.tsx | 2 + .../__test__/AppNotAccessible.test.tsx | 4 +- .../__test__/AppResponseMessage.test.tsx | 2 + .../__test__/CollapsedList.test.tsx | 6 +- .../__test__/CopyToClipboard.test.tsx | 6 +- .../__test__/CustomDatePicker.test.tsx | 20 +- .../__test__/CustomDropdown.test.tsx | 2 + .../__test__/CustomTableRow.test.tsx | 2 + .../__test__/CustomTooltip.test.tsx | 4 +- .../__test__/DisclaimerModal.test.tsx | 6 +- .../components/__test__/EmptyState.test.tsx | 4 +- .../__test__/ErrorBoundary.test.tsx | 22 +- .../components/__test__/FileUpload.test.tsx | 18 +- .../__test__/InactivityHandler.test.tsx | 8 +- .../components/__test__/LoadingPage.test.tsx | 2 + .../__test__/PnAutocomplete.test.tsx | 4 +- .../components/__test__/PnBreadcrumb.test.tsx | 12 +- .../src/components/__test__/Prompt.test.tsx | 1 + .../__test__/SectionHeading.test.tsx | 2 + .../components/__test__/SessionModal.test.tsx | 4 +- .../__test__/SpecialContacts.context.test.tsx | 6 +- .../src/components/__test__/TabPanel.test.tsx | 2 + .../src/components/__test__/TitleBox.test.tsx | 4 +- packages/pn-commons/src/components/index.ts | 2 - .../src/hooks/__test__/useBlocker.test.tsx | 35 +- .../src/hooks/__test__/useErrors.test.tsx | 24 +- .../src/hooks/__test__/useFieldSpecs.test.tsx | 4 +- .../hooks/__test__/useHasPermissions.test.tsx | 2 + .../hooks/__test__/useIsCancelled.test.tsx | 2 + .../src/hooks/__test__/useIsMobile.test.tsx | 2 + .../src/hooks/__test__/useMultiEvent.test.tsx | 35 +- .../src/hooks/__test__/useProcess.test.tsx | 35 +- .../src/hooks/__test__/usePrompt.test.tsx | 6 +- .../__test__/useRewriteLinks.test.tsx} | 8 +- .../hooks/__test__/useSessionCheck.test.tsx | 9 +- .../src/hooks/__test__/useTracking.test.tsx | 31 +- .../src/hooks/__test__/useUnload.test.tsx | 6 +- packages/pn-commons/src/hooks/index.ts | 2 + packages/pn-commons/src/hooks/useBlocker.ts | 6 +- packages/pn-commons/src/hooks/usePrompt.ts | 21 +- .../pn-commons/src/hooks/useRewriteLinks.ts | 14 + packages/pn-commons/src/index.ts | 1 - .../pn-commons/src/models/MixpanelEvents.ts | 2 - .../src/models/NotificationDetail.ts | 5 +- packages/pn-commons/src/models/Pagination.ts | 9 +- .../pn-commons/src/models/PaymentCache.ts | 113 - packages/pn-commons/src/models/index.ts | 2 - .../navigation/__test__/PrivateRoute.test.tsx | 2 + .../pn-commons/src/pages/AccessDenied.tsx | 10 +- .../src/pages/__test__/AccessDenied.test.tsx | 6 +- .../src/pages/__test__/CourtesyPage.test.tsx | 4 +- .../src/pages/__test__/NotFound.test.tsx | 2 + .../slices/__test__/appStateSlice.test.ts | 28 +- packages/pn-commons/src/setupTests.ts | 8 +- packages/pn-commons/src/test-utils.tsx | 18 +- .../__test__/AppResponsePublisher.test.tsx | 6 +- .../__test__/children.utility.test.tsx | 2 + .../src/utility/__test__/dom.utility.test.tsx | 5 +- .../fetch.configuration.utility.test.ts | 3 +- .../__test__/lazyRetry.utility.test.tsx | 40 +- .../__test__/notification.utility.test.ts | 3 +- .../__test__/paymentCaching.utility.test.ts | 173 - .../utility/__test__/redux.utility.test.ts | 16 +- .../__test__/searchString.utility.test.tsx | 4 +- .../utility/__test__/styles.utility.test.tsx | 2 + .../utility/fetch.configuration.utility.ts | 2 +- packages/pn-commons/src/utility/index.ts | 15 +- .../src/utility/onetrust.utility.ts | 15 +- .../src/utility/paymentCaching.utility.ts | 154 - .../pn-commons/src/utility/redux.utility.ts | 2 +- packages/pn-commons/src/vite-env.d.ts | 1 - packages/pn-commons/tsconfig.json | 15 +- packages/pn-commons/tsconfig.prod.json | 4 - packages/pn-commons/vite.config.a11y.ts | 18 - packages/pn-commons/vite.config.all.ts | 17 - packages/pn-commons/vite.config.ts | 26 - packages/pn-pa-webapp/.env | 3 +- packages/pn-pa-webapp/.gitignore | 1 - packages/pn-pa-webapp/CHANGELOG.md | 27 - packages/pn-pa-webapp/babel.config.js | 23 - packages/pn-pa-webapp/craco.config.js | 22 + packages/pn-pa-webapp/package.json | 93 +- .../public/conf/env/config.dev.json | 1 - .../public/conf/env/config.hotfix.json | 1 - .../public/conf/env/config.prod.json | 1 - .../public/conf/env/config.test.json | 1 - .../public/conf/env/config.uat.json | 1 - packages/pn-pa-webapp/{ => public}/index.html | 13 +- .../public/locales/de/apikeys.json | 8 +- .../public/locales/en/apikeys.json | 8 +- .../public/locales/fr/apikeys.json | 8 +- .../public/locales/it/apikeys.json | 8 +- .../public/locales/it/notifiche.json | 2 - .../public/locales/sl/apikeys.json | 8 +- .../src/__mocks__/Notifications.mock.ts | 2 +- .../src/__test__/App.a11y.test.tsx | 6 +- .../pn-pa-webapp/src/__test__/App.test.tsx | 55 +- .../pn-pa-webapp/src/__test__/test-utils.tsx | 2 +- packages/pn-pa-webapp/src/api/apiClients.ts | 5 +- .../consents/__test__/Consents.api.test.ts | 2 +- packages/pn-pa-webapp/src/api/interceptors.ts | 15 + .../components/ApiKeys/ApiKeyDataSwitch.tsx | 72 +- .../src/components/ApiKeys/ApiKeyModal.tsx | 101 +- .../src/components/ApiKeys/DesktopApiKeys.tsx | 3 +- .../__test__/ApiKeyDataSwitch.test.tsx | 72 +- .../ApiKeys/__test__/ApiKeyModal.test.tsx | 36 +- .../ApiKeys/__test__/DesktopApiKeys.test.tsx | 17 +- .../__test__/SyncFeedbackApiKey.test.tsx | 14 +- .../__test__/Attachments.test.tsx | 131 +- .../__test__/FormTextField.test.tsx | 10 +- .../__test__/NewNotificationCard.test.tsx | 10 +- .../__test__/PaymentMethods.test.tsx | 28 +- .../__test__/PhysicalAddress.test.tsx | 6 +- .../__test__/PreliminaryInformations.test.tsx | 139 +- .../__test__/Recipient.test.tsx | 151 +- .../__test__/SyncFeedback.test.tsx | 14 +- .../ConfirmCancellationDialog.tsx | 20 +- .../Notifications/DesktopNotifications.tsx | 21 +- .../FilterNotificationsFormActions.tsx | 25 +- .../FilterNotificationsFormBody.tsx | 76 +- .../Notifications/MobileNotifications.tsx | 21 +- .../ConfirmCancellationDialog.test.tsx | 21 +- .../DesktopNotifications.a11y.test.tsx | 4 +- .../__test__/DesktopNotifications.test.tsx | 14 +- .../FilterNotifications.a11y.test.tsx | 4 +- .../__test__/FilterNotifications.test.tsx | 129 +- .../MobileNotifications.a11y.test.tsx | 4 +- .../__test__/MobileNotifications.test.tsx | 14 +- .../NotificationDetailTableSender.test.tsx | 8 +- .../__test__/NotificationPaymentF24.test.tsx | 6 +- .../NotificationPaymentPagoPa.test.tsx | 20 +- .../NotificationPaymentSender.test.tsx | 4 +- .../NotificationRecipientsDetail.test.tsx | 12 +- .../__test__/NotificationsDataSwitch.test.tsx | 4 +- .../pn-pa-webapp/src/{main.tsx => index.tsx} | 39 +- .../__test__/OrganizationPartyGuard.test.tsx | 4 +- .../navigation/__test__/RouteGuard.test.tsx | 3 +- .../navigation/__test__/SessionGuard.test.tsx | 25 +- .../src/navigation/__test__/ToSGuard.test.tsx | 13 +- .../__test__/navigation.utility.test.ts | 3 +- .../pn-pa-webapp/src/navigation/routes.tsx | 4 +- .../pn-pa-webapp/src/pages/ApiKeys.page.tsx | 306 +- .../pn-pa-webapp/src/pages/Dashboard.page.tsx | 27 +- .../src/pages/NotificationDetail.page.tsx | 8 +- .../src/pages/PrivacyPolicy.page.tsx | 20 +- .../src/pages/TermsOfService.page.tsx | 24 +- .../pages/__test__/ApiKeys.page.a11y.test.tsx | 4 +- .../src/pages/__test__/ApiKeys.page.test.tsx | 53 +- .../pages/__test__/AppStatus.page.test.tsx | 15 +- .../__test__/Dashboard.page.a11y.test.tsx | 4 +- .../pages/__test__/Dashboard.page.test.tsx | 77 +- .../pages/__test__/NewApiKey.page.test.tsx | 105 +- .../__test__/NewNotification.page.test.tsx | 185 +- .../NotificationDetail.page.a11y.test.tsx | 4 +- .../__test__/NotificationDetail.page.test.tsx | 213 +- .../__test__/PrivacyPolicy.page.test.tsx | 12 +- .../pages/__test__/Statistics.page.test.tsx | 4 +- .../__test__/TermsOfService.page.test.tsx | 12 +- .../__test__/ToSAcceptance.page.test.tsx | 23 +- packages/pn-pa-webapp/src/react-app-env.d.ts | 2 +- .../newNotification/__test__/reducers.test.ts | 6 +- packages/pn-pa-webapp/src/redux/store.ts | 5 +- .../src/services/configuration.service.ts | 8 +- packages/pn-pa-webapp/src/setupTests.ts | 10 +- .../utility/__test__/apikeys.utility.test.tsx | 4 +- .../src/utility/apikeys.utility.tsx | 43 +- .../src/utility/notification.utility.ts | 6 +- packages/pn-pa-webapp/src/vite-env.d.ts | 1 - packages/pn-pa-webapp/tsconfig.json | 13 +- packages/pn-pa-webapp/vite.config.a11y.ts | 18 - packages/pn-pa-webapp/vite.config.all.ts | 17 - packages/pn-pa-webapp/vite.config.ts | 49 - packages/pn-personafisica-login/.env | 2 +- packages/pn-personafisica-login/.gitignore | 1 - packages/pn-personafisica-login/CHANGELOG.md | 27 - .../pn-personafisica-login/babel.config.js | 23 - .../pn-personafisica-login/craco.config.js | 22 + packages/pn-personafisica-login/index.html | 32 - packages/pn-personafisica-login/package.json | 73 +- .../public/conf/env/config.dev.json | 4 +- .../public/conf/env/config.hotfix.json | 4 +- .../public/conf/env/config.prod.json | 2 + .../public/conf/env/config.test.json | 4 +- .../public/conf/env/config.uat.json | 4 +- .../pn-personafisica-login/public/index.html | 33 + .../public/js/redirect.js | 10 - .../it.json | 1 - .../logos/static/ot_guard_logo.svg | 1 - .../it.json | 1 - .../logos/static/ot_guard_logo.svg | 1 - .../googleData.json | 1 - .../it.json | 1 + .../logo-pagopa-onetrust.png | Bin .../logos/static/ot_close.svg | 0 .../logos/static/ot_external_link.svg | 0 .../static/ot_persistent_cookie_icon.png | Bin .../logos/static/powered_by_logo.svg | 0 ...b72-7a44-43c2-b3bb-49e22f78edb9-test.json} | 2 +- .../it.json | 1 + .../logo-pagopa-onetrust.png | Bin .../logos/static/ot_close.svg | 0 .../logos/static/ot_external_link.svg | 0 .../static/ot_persistent_cookie_icon.png | Bin .../logos/static/powered_by_logo.svg | 0 ...ff3d2b72-7a44-43c2-b3bb-49e22f78edb9.json} | 2 +- .../assets/modern_rtl.json | 0 .../assets/optanon.json | 0 .../202303.2.0}/assets/otCenterRounded.json | 2 +- .../assets/otCenterRoundedRtl.json | 2 +- .../202303.2.0/assets/otChoicesBanner.json | 6 + .../202303.2.0/assets/otChoicesBannerRtl.json | 6 + .../202303.2.0/assets/otCommonStyles.css | 1 + .../202303.2.0/assets/otCommonStylesRtl.css | 1 + .../assets/otCookieSettingsButton.json | 4 +- .../assets/otCookieSettingsButtonRtl.json | 4 +- .../assets/otFlat.json | 2 +- .../202303.2.0}/assets/otFlatRtl.json | 2 +- .../202303.2.0}/assets/otFloatingFlat.json | 2 +- .../assets/otFloatingFlatRtl.json | 2 +- .../202303.2.0}/assets/otFloatingRounded.json | 2 +- .../assets/otFloatingRoundedCorner.json | 2 +- .../assets/otFloatingRoundedCornerRtl.json | 2 +- .../assets/otFloatingRoundedIcon.json | 6 + .../assets/otFloatingRoundedIconRtl.json | 6 + .../assets/otFloatingRoundedRtl.json | 2 +- .../202303.2.0/assets/otPcCenter.json | 6 + .../202303.2.0/assets/otPcCenterRtl.json | 6 + .../assets/otPcList.json | 4 +- .../assets/otPcListRtl.json | 4 +- .../202303.2.0/assets/otPcPanel.json | 6 + .../202303.2.0/assets/otPcPanelRtl.json | 6 + .../assets/otPcPopup.json | 4 +- .../assets/otPcPopupRtl.json | 4 +- .../assets/otPcTab.json | 4 +- .../202303.2.0}/assets/otPcTabRtl.json | 4 +- .../assets/otSyncNotification.json | 0 .../assets/otSyncNotificationRtl.json | 0 .../202303.2.0/assets/v2/otPcCenter.json | 6 + .../202303.2.0/assets/v2/otPcCenterRtl.json | 6 + .../202303.2.0/assets/v2/otPcPanel.json | 6 + .../202303.2.0/assets/v2/otPcPanelRtl.json | 6 + .../202303.2.0/assets/v2/otPcTab.json | 6 + .../202303.2.0/assets/v2/otPcTabRtl.json | 6 + .../scripttemplates/202303.2.0/hbbtv.js | 7 + .../scripttemplates/202303.2.0/otBannerSdk.js | 7 + .../scripttemplates/202303.2.0/otGPP.js | 1 + .../scripttemplates/202303.2.0/otStub.js | 1 + .../scripttemplates/202303.2.0/otTCF.js | 1 + .../trackingTechnologies.js | 4 +- .../202401.1.0/assets/otChoicesBanner.json | 6 - .../202401.1.0/assets/otChoicesBannerRtl.json | 6 - .../202401.1.0/assets/otCommonStyles.css | 1 - .../202401.1.0/assets/otCommonStylesRtl.css | 1 - .../assets/otFloatingRoundedIcon.json | 6 - .../assets/otFloatingRoundedIconRtl.json | 6 - .../202401.1.0/assets/otPcCenter.json | 6 - .../202401.1.0/assets/otPcCenterRtl.json | 6 - .../202401.1.0/assets/otPcPanel.json | 6 - .../202401.1.0/assets/otPcPanelRtl.json | 6 - .../202401.1.0/assets/v2/otPcCenter.json | 6 - .../202401.1.0/assets/v2/otPcCenterRtl.json | 6 - .../202401.1.0/assets/v2/otPcPanel.json | 6 - .../202401.1.0/assets/v2/otPcPanelRtl.json | 6 - .../202401.1.0/assets/v2/otPcTab.json | 6 - .../202401.1.0/assets/v2/otPcTabRtl.json | 6 - .../scripttemplates/202401.1.0/hbbtv.js | 7 - .../scripttemplates/202401.1.0/otBannerSdk.js | 7 - .../scripttemplates/202401.1.0/otGPP.js | 1 - .../scripttemplates/202401.1.0/otStub.js | 1 - .../scripttemplates/202401.1.0/otTCF.js | 1 - .../onetrust/scripttemplates/otSDKStub.js | 2 +- packages/pn-personafisica-login/src/App.tsx | 12 +- .../src/__test__/App.test.tsx | 10 +- packages/pn-personafisica-login/src/i18n.ts | 7 +- .../src/{main.tsx => index.tsx} | 16 +- .../src/navigation/routes.tsx | 21 +- .../src/pages/login/Login.tsx | 7 +- .../src/pages/login/__test__/Login.test.tsx | 15 +- .../pages/login/__test__/SpidSelect.test.tsx | 11 +- .../loginError/__test__/LoginError.test.tsx | 33 +- .../src/pages/logout/Logout.tsx | 3 +- .../src/pages/logout/__test__/Logout.test.tsx | 16 +- .../src/pages/privacyPolicy/PrivacyPolicy.tsx | 50 + .../__test__/PrivacyPolicy.test.tsx | 37 + .../pages/success/__test__/Success.test.tsx | 6 +- .../src/react-app-env.d.ts | 2 +- .../src/services/configuration.service.ts | 25 +- .../pn-personafisica-login/src/setupTests.ts | 7 +- .../src/utility/__test__/storage.test.tsx | 18 +- .../src/utility/mixpanel.ts | 10 +- .../src/utility/storage.ts | 3 + .../pn-personafisica-login/src/vite-env.d.ts | 1 - packages/pn-personafisica-login/tsconfig.json | 14 +- .../pn-personafisica-login/vite.config.ts | 48 - packages/pn-personafisica-webapp/.env | 2 +- packages/pn-personafisica-webapp/.gitignore | 1 - packages/pn-personafisica-webapp/CHANGELOG.md | 28 - .../pn-personafisica-webapp/babel.config.js | 23 - .../pn-personafisica-webapp/craco.config.js | 22 + packages/pn-personafisica-webapp/package.json | 97 +- .../public/conf/env/config.dev.json | 1 + .../public/conf/env/config.hotfix.json | 1 + .../public/conf/env/config.prod.json | 1 + .../public/conf/env/config.test.json | 1 + .../public/conf/env/config.uat.json | 1 + .../{ => public}/index.html | 13 +- .../public/locales/it/common.json | 2 +- .../public/locales/it/deleghe.json | 2 - .../public/locales/it/notifiche.json | 3 +- .../it.json | 2 +- .../logos/static/ot_guard_logo.svg | 1 - ...1c86-f2ef-494d-8242-9bec8009cd29-test.json | 2 +- .../it.json | 1 + .../logo-pagopa-onetrust.png | Bin .../logos/static/ot_close.svg | 0 .../logos/static/ot_external_link.svg | 0 .../static/ot_persistent_cookie_icon.png | Bin .../logos/static/powered_by_logo.svg | 0 .../29cc1c86-f2ef-494d-8242-9bec8009cd29.json | 2 +- .../it.json | 1 - .../logos/static/ot_guard_logo.svg | 1 - .../googleData.json | 1 - .../assets/modern_rtl.json | 0 .../assets/optanon.json | 0 .../202303.2.0}/assets/otCenterRounded.json | 2 +- .../assets/otCenterRoundedRtl.json | 2 +- .../202303.2.0/assets/otChoicesBanner.json | 6 + .../202303.2.0/assets/otChoicesBannerRtl.json | 6 + .../202303.2.0/assets/otCommonStyles.css | 1 + .../202303.2.0/assets/otCommonStylesRtl.css | 1 + .../assets/otCookieSettingsButton.json | 4 +- .../assets/otCookieSettingsButtonRtl.json | 4 +- .../assets/otFlat.json | 2 +- .../202303.2.0}/assets/otFlatRtl.json | 2 +- .../202303.2.0}/assets/otFloatingFlat.json | 2 +- .../assets/otFloatingFlatRtl.json | 2 +- .../202303.2.0}/assets/otFloatingRounded.json | 2 +- .../assets/otFloatingRoundedCorner.json | 2 +- .../assets/otFloatingRoundedCornerRtl.json | 2 +- .../assets/otFloatingRoundedIcon.json | 6 + .../assets/otFloatingRoundedIconRtl.json | 6 + .../assets/otFloatingRoundedRtl.json | 2 +- .../202303.2.0/assets/otPcCenter.json | 6 + .../202303.2.0/assets/otPcCenterRtl.json | 6 + .../assets/otPcList.json | 4 +- .../assets/otPcListRtl.json | 4 +- .../202303.2.0/assets/otPcPanel.json | 6 + .../202303.2.0/assets/otPcPanelRtl.json | 6 + .../assets/otPcPopup.json | 4 +- .../assets/otPcPopupRtl.json | 4 +- .../assets/otPcTab.json | 4 +- .../202303.2.0}/assets/otPcTabRtl.json | 4 +- .../assets/otSyncNotification.json | 0 .../assets/otSyncNotificationRtl.json | 0 .../202303.2.0/assets/v2/otPcCenter.json | 6 + .../202303.2.0/assets/v2/otPcCenterRtl.json | 6 + .../202303.2.0/assets/v2/otPcPanel.json | 6 + .../202303.2.0/assets/v2/otPcPanelRtl.json | 6 + .../202303.2.0/assets/v2/otPcTab.json | 6 + .../202303.2.0/assets/v2/otPcTabRtl.json | 6 + .../scripttemplates/202303.2.0/hbbtv.js | 7 + .../scripttemplates/202303.2.0/otBannerSdk.js | 7 + .../scripttemplates/202303.2.0/otGPP.js | 1 + .../scripttemplates/202303.2.0/otStub.js | 1 + .../scripttemplates/202303.2.0/otTCF.js | 1 + .../trackingTechnologies.js | 4 +- .../202401.1.0/assets/otChoicesBanner.json | 6 - .../202401.1.0/assets/otChoicesBannerRtl.json | 6 - .../202401.1.0/assets/otCommonStyles.css | 1 - .../202401.1.0/assets/otCommonStylesRtl.css | 1 - .../assets/otFloatingRoundedIcon.json | 6 - .../assets/otFloatingRoundedIconRtl.json | 6 - .../202401.1.0/assets/otPcCenter.json | 6 - .../202401.1.0/assets/otPcCenterRtl.json | 6 - .../202401.1.0/assets/otPcPanel.json | 6 - .../202401.1.0/assets/otPcPanelRtl.json | 6 - .../202401.1.0/assets/v2/otPcCenter.json | 6 - .../202401.1.0/assets/v2/otPcCenterRtl.json | 6 - .../202401.1.0/assets/v2/otPcPanel.json | 6 - .../202401.1.0/assets/v2/otPcPanelRtl.json | 6 - .../202401.1.0/assets/v2/otPcTab.json | 6 - .../202401.1.0/assets/v2/otPcTabRtl.json | 6 - .../scripttemplates/202401.1.0/hbbtv.js | 7 - .../scripttemplates/202401.1.0/otBannerSdk.js | 7 - .../scripttemplates/202401.1.0/otGPP.js | 1 - .../scripttemplates/202401.1.0/otStub.js | 1 - .../scripttemplates/202401.1.0/otTCF.js | 1 - .../onetrust/scripttemplates/otSDKStub.js | 2 +- packages/pn-personafisica-webapp/src/App.tsx | 3 +- .../src/__mocks__/NotificationDetail.mock.ts | 14 - .../src/__mocks__/Notifications.mock.ts | 2 +- .../src/__test__/App.a11y.test.tsx | 26 +- .../src/__test__/App.test.tsx | 64 +- .../src/__test__/test-utils.tsx | 6 +- .../src/api/apiClients.ts | 2 +- .../Contacts/CancelVerificationModal.tsx | 21 +- .../Contacts/CourtesyContactItem.tsx | 4 +- .../Contacts/DigitalContactElem.tsx | 71 +- ...igitalContactsCodeVerification.context.tsx | 66 +- .../components/Contacts/LegalContactsList.tsx | 7 +- .../Contacts/SpecialContactElem.tsx | 3 +- .../components/Contacts/SpecialContacts.tsx | 3 +- .../__test__/CancelVerificationModal.test.tsx | 17 +- .../CourtesyContactItem.a11y.test.tsx | 50 +- .../__test__/CourtesyContactItem.test.tsx | 18 +- .../__test__/CourtesyContacts.a11y.test.tsx | 18 +- .../__test__/CourtesyContacts.test.tsx | 55 +- .../CourtesyContactsList.a11y.test.tsx | 4 +- .../__test__/CourtesyContactsList.test.tsx | 4 +- .../__test__/DigitalContactElem.a11y.test.tsx | 6 +- .../__test__/DigitalContactElem.test.tsx | 38 +- .../DigitalContactsCard.a11y.test.tsx | 4 +- .../__test__/DigitalContactsCard.test.tsx | 4 +- ...actsCodeVerification.context.a11y.test.tsx | 22 +- ...ctsCodeVerification.context.test-utils.tsx | 2 + ...lContactsCodeVerification.context.test.tsx | 37 +- .../Contacts/__test__/IOContact.a11y.test.tsx | 4 +- .../Contacts/__test__/IOContact.test.tsx | 66 +- .../__test__/InsertLegalContact.a11y.test.tsx | 6 +- .../__test__/InsertLegalContact.test.tsx | 4 +- .../__test__/LegalContactsList.a11y.test.tsx | 4 +- .../__test__/LegalContactsList.test.tsx | 91 +- .../__test__/SpecialContactElem.a11y.test.tsx | 4 +- .../__test__/SpecialContactElem.test.tsx | 56 +- .../__test__/SpecialContacts.a11y.test.tsx | 15 +- .../__test__/SpecialContacts.test.tsx | 90 +- .../components/Deleghe/ConfirmationModal.tsx | 2 +- .../src/components/Deleghe/Delegates.tsx | 10 +- .../Deleghe/DelegationsElements.tsx | 9 +- .../components/Deleghe/MobileDelegates.tsx | 16 +- .../__test__/ConfirmationModal.a11y.test.tsx | 4 +- .../__test__/ConfirmationModal.test.tsx | 6 +- .../Deleghe/__test__/Delegates.a11y.test.tsx | 10 +- .../Deleghe/__test__/Delegates.test.tsx | 30 +- .../__test__/DelegationDataSwitch.test.tsx | 4 +- .../DelegationsElements.a11y.test.tsx | 4 +- .../__test__/DelegationsElements.test.tsx | 21 +- .../Deleghe/__test__/Delegators.a11y.test.tsx | 9 +- .../Deleghe/__test__/Delegators.test.tsx | 21 +- .../__test__/MobileDelegates.a11y.test.tsx | 8 +- .../Deleghe/__test__/MobileDelegates.test.tsx | 17 +- .../__test__/MobileDelegators.a11y.test.tsx | 9 +- .../__test__/MobileDelegators.test.tsx | 4 +- .../VerificationCodeComponent.a11y.test.tsx | 4 +- .../VerificationCodeComponent.test.tsx | 2 + .../__test__/DomicileBanner.a11y.test.tsx | 4 +- .../__test__/DomicileBanner.test.tsx | 10 +- .../LoadingPageWrapper/LoadingPageWrapper.tsx | 13 +- .../__test__/LoadingPageWrapper.a11y.test.tsx | 6 +- .../__test__/LoadingPageWrapper.test.tsx | 2 + .../Notifications/DesktopNotifications.tsx | 9 +- .../Notifications/FilterNotifications.tsx | 18 +- .../FilterNotificationsFormBody.tsx | 66 +- .../Notifications/MobileNotifications.tsx | 9 +- .../DesktopNotifications.a11y.test.tsx | 8 +- .../__test__/DesktopNotifications.test.tsx | 17 +- .../FilterNotifications.a11y.test.tsx | 4 +- .../__test__/FilterNotifications.test.tsx | 109 +- .../MobileNotifications.a11y.test.tsx | 8 +- .../__test__/MobileNotifications.test.tsx | 15 +- .../src/components/Party/DropDownParty.tsx | 2 +- .../__test__/DropDownParty.a11y.test.tsx | 2 + .../Party/__test__/DropDownParty.test.tsx | 2 + .../src/{main.tsx => index.tsx} | 39 +- .../src/navigation/AARGuard.tsx | 9 +- .../src/navigation/__test__/AARGuard.test.tsx | 36 +- .../navigation/__test__/RouteGuard.test.tsx | 1 + .../navigation/__test__/SessionGuard.test.tsx | 24 +- .../src/navigation/__test__/ToSGuard.test.tsx | 13 +- .../__test__/navigation.utility.test.ts | 5 +- .../src/pages/Contacts.page.tsx | 2 +- .../src/pages/NotificationDetail.page.tsx | 93 +- .../src/pages/NuovaDelega.page.tsx | 36 +- .../src/pages/PrivacyPolicy.page.tsx | 16 +- .../src/pages/TermsOfService.page.tsx | 23 +- .../pages/__test__/AppStatus.page.test.tsx | 15 +- .../__test__/Contacts.page.a11y.test.tsx | 15 +- .../src/pages/__test__/Contacts.page.test.tsx | 85 +- .../pages/__test__/Deleghe.page.a11y.test.tsx | 13 +- .../src/pages/__test__/Deleghe.page.test.tsx | 15 +- .../NotificationDetail.page.a11y.test.tsx | 49 +- .../__test__/NotificationDetail.page.test.tsx | 284 +- .../__test__/Notifiche.page.a11y.test.tsx | 13 +- .../pages/__test__/Notifiche.page.test.tsx | 70 +- .../src/pages/__test__/NuovaDelega.test.tsx | 100 +- .../ParticipatingEntities.page.test.tsx | 4 +- .../__test__/PrivacyPolicy.page.test.tsx | 4 +- .../pages/__test__/Profile.page.a11y.test.tsx | 4 +- .../src/pages/__test__/Profile.page.test.tsx | 10 +- .../__test__/TermsOfService.page.test.tsx | 4 +- .../__test__/ToSAcceptance.page.test.tsx | 21 +- .../src/react-app-env.d.ts | 2 +- .../redux/dashboard/__test__/reducers.test.ts | 8 +- .../notification/__test__/reducers.test.ts | 2 - .../src/redux/notification/actions.ts | 57 +- .../src/redux/store.ts | 5 +- .../src/services/configuration.service.ts | 6 +- .../pn-personafisica-webapp/src/setupTests.ts | 18 +- .../utility/__test__/contacts.utility.test.ts | 3 +- .../pn-personafisica-webapp/src/vite-env.d.ts | 1 - .../pn-personafisica-webapp/tsconfig.json | 13 +- .../vite.config.a11y.ts | 18 - .../vite.config.all.ts | 17 - .../pn-personafisica-webapp/vite.config.ts | 55 - packages/pn-personagiuridica-webapp/.env | 2 +- .../pn-personagiuridica-webapp/.gitignore | 1 - .../pn-personagiuridica-webapp/CHANGELOG.md | 28 - .../babel.config.js | 23 - .../craco.config.js | 22 + .../pn-personagiuridica-webapp/package.json | 96 +- .../{ => public}/index.html | 13 +- .../public/locales/it/common.json | 2 +- .../public/locales/it/deleghe.json | 2 - .../public/locales/it/notifiche.json | 3 +- .../pn-personagiuridica-webapp/src/App.tsx | 2 + .../src/__mocks__/NotificationDetail.mock.ts | 14 - .../src/__mocks__/Notifications.mock.ts | 2 +- .../src/__test__/App.a11y.test.tsx | 17 +- .../src/__test__/App.test.tsx | 20 +- .../src/__test__/test-utils.tsx | 6 +- .../src/api/apiClients.ts | 3 +- .../consents/__test__/Consents.api.test.ts | 2 +- .../contacts/__test__/Contacts.api.test.ts | 2 +- .../Contacts/CancelVerificationModal.tsx | 21 +- .../Contacts/CourtesyContactItem.tsx | 4 +- .../Contacts/DigitalContactElem.tsx | 71 +- ...igitalContactsCodeVerification.context.tsx | 56 +- .../components/Contacts/LegalContactsList.tsx | 5 +- .../Contacts/SpecialContactElem.tsx | 3 +- .../components/Contacts/SpecialContacts.tsx | 3 +- .../__test__/CancelVerificationModal.test.tsx | 21 +- .../CourtesyContactItem.a11y.test.tsx | 10 +- .../__test__/CourtesyContactItem.test.tsx | 8 +- .../__test__/CourtesyContacts.a11y.test.tsx | 6 +- .../__test__/CourtesyContacts.test.tsx | 45 +- .../CourtesyContactsList.a11y.test.tsx | 4 +- .../__test__/CourtesyContactsList.test.tsx | 22 +- .../__test__/DigitalContactElem.a11y.test.tsx | 14 +- .../__test__/DigitalContactElem.test.tsx | 29 +- .../DigitalContactsCard.a11y.test.tsx | 4 +- .../__test__/DigitalContactsCard.test.tsx | 4 +- ...actsCodeVerification.context.a11y.test.tsx | 19 +- ...ctsCodeVerification.context.test-utils.tsx | 2 + ...lContactsCodeVerification.context.test.tsx | 33 +- .../__test__/InsertLegalContact.a11y.test.tsx | 6 +- .../__test__/InsertLegalContact.test.tsx | 4 +- .../__test__/LegalContactsList.a11y.test.tsx | 4 +- .../__test__/LegalContactsList.test.tsx | 63 +- .../__test__/SpecialContactElem.a11y.test.tsx | 6 +- .../__test__/SpecialContactElem.test.tsx | 4 +- .../__test__/SpecialContacts.a11y.test.tsx | 15 +- .../__test__/SpecialContacts.test.tsx | 72 +- .../Deleghe/AcceptDelegationModal.tsx | 48 +- .../components/Deleghe/ConfirmationModal.tsx | 96 +- .../components/Deleghe/DelegatesByCompany.tsx | 10 +- .../Deleghe/DelegationsElements.tsx | 42 +- .../Deleghe/DelegationsOfTheCompany.tsx | 10 +- .../AcceptDelegationModal.a11y.test.tsx | 4 +- .../__test__/AcceptDelegationModal.test.tsx | 12 +- .../__test__/ConfirmationModal.a11y.test.tsx | 2 + .../__test__/ConfirmationModal.test.tsx | 10 +- .../__test__/DelegatesByCompany.a11y.test.tsx | 6 +- .../__test__/DelegatesByCompany.test.tsx | 23 +- .../__test__/DelegationDataSwitch.test.tsx | 4 +- .../DelegationsElements.a11y.test.tsx | 4 +- .../__test__/DelegationsElements.test.tsx | 77 +- .../DelegationsOfTheCompany.a11y.test.tsx | 6 +- .../__test__/DelegationsOfTheCompany.test.tsx | 14 +- .../VerificationCodeComponent.a11y.test.tsx | 4 +- .../VerificationCodeComponent.test.tsx | 2 + .../__test__/DomicileBanner.a11y.test.tsx | 6 +- .../__test__/DomicileBanner.test.tsx | 10 +- .../__test__/LoadingPageWrapper.a11y.test.tsx | 6 +- .../__test__/LoadingPageWrapper.test.tsx | 2 + .../Notifications/DesktopNotifications.tsx | 7 +- .../Notifications/FilterNotifications.tsx | 18 +- .../FilterNotificationsFormBody.tsx | 64 +- .../Notifications/GroupSelector.tsx | 7 +- .../Notifications/MobileNotifications.tsx | 7 +- .../DesktopNotifications.a11y.test.tsx | 4 +- .../__test__/DesktopNotifications.test.tsx | 14 +- .../FilterNotifications.a11y.test.tsx | 4 +- .../__test__/FilterNotifications.test.tsx | 55 +- .../__test__/GroupSelector.test.tsx | 16 +- .../MobileNotifications.a11y.test.tsx | 4 +- .../__test__/MobileNotifications.test.tsx | 14 +- .../src/components/Party/DropDownParty.tsx | 2 +- .../__test__/DropDownParty.a11y.test.tsx | 4 +- .../Party/__test__/DropDownParty.test.tsx | 2 + .../src/{main.tsx => index.tsx} | 39 +- .../src/navigation/AARGuard.tsx | 29 +- .../src/navigation/RouteGuard.tsx | 14 +- .../src/navigation/__test__/AARGuard.test.tsx | 63 +- .../navigation/__test__/RouteGuard.test.tsx | 31 +- .../navigation/__test__/SessionGuard.test.tsx | 26 +- .../src/navigation/__test__/ToSGuard.test.tsx | 13 +- .../__test__/navigation.utility.test.ts | 5 +- .../src/navigation/routes.const.ts | 5 +- .../src/pages/Contacts.page.tsx | 2 +- .../src/pages/NotificationDetail.page.tsx | 1 - .../src/pages/NuovaDelega.page.tsx | 38 +- .../src/pages/PrivacyPolicy.page.tsx | 15 +- .../src/pages/TermsOfService.page.tsx | 21 +- .../pages/__test__/AppStatus.page.test.tsx | 15 +- .../__test__/Contacts.page.a11y.test.tsx | 13 +- .../src/pages/__test__/Contacts.page.test.tsx | 19 +- .../pages/__test__/Deleghe.page.a11y.test.tsx | 13 +- .../src/pages/__test__/Deleghe.page.test.tsx | 13 +- .../NotificationDetail.page.a11y.test.tsx | 56 +- .../__test__/NotificationDetail.page.test.tsx | 146 +- .../__test__/Notifiche.page.a11y.test.tsx | 15 +- .../pages/__test__/Notifiche.page.test.tsx | 88 +- .../pages/__test__/NuovaDelega.page.test.tsx | 86 +- .../__test__/PrivacyPolicy.page.test.tsx | 8 +- .../__test__/TermsOfService.page.test.tsx | 8 +- .../__test__/ToSAcceptance.page.test.tsx | 21 +- .../src/react-app-env.d.ts | 2 +- .../redux/dashboard/__test__/reducers.test.ts | 8 +- .../notification/__test__/reducers.test.ts | 2 - .../src/redux/notification/actions.ts | 57 +- .../src/redux/store.ts | 5 +- .../src/services/configuration.service.ts | 2 +- .../src/setupTests.ts | 8 +- .../src/vite-env.d.ts | 1 - .../pn-personagiuridica-webapp/tsconfig.json | 14 +- .../vite.config.a11y.ts | 18 - .../vite.config.all.ts | 17 - .../pn-personagiuridica-webapp/vite.config.ts | 55 - packages/pn-validator/.babelrc | 3 + packages/pn-validator/.gitignore | 1 + packages/pn-validator/CHANGELOG.md | 27 - packages/pn-validator/package.json | 27 +- .../src/__test__/Validator.test.ts | 10 - .../src/__test__/ValidatorBuilder.test.ts | 2 +- .../__test__/ArrayRuleValidator.test.ts | 15 +- .../__test__/CommonRuleValidator.test.ts | 27 +- .../__test__/DateRuleValidator.test.ts | 15 +- .../__test__/NumberRuleValidator.test.ts | 19 +- .../__test__/ObjectRuleValidator.test.ts | 15 +- .../__test__/StringRuleValidator.test.ts | 19 +- .../src/rules/__test__/ForEachElement.test.ts | 27 +- .../src/rules/__test__/InnerValidator.test.ts | 6 +- packages/pn-validator/tsconfig.json | 5 +- packages/pn-validator/tsconfig.prod.json | 4 - packages/pn-validator/vite.config.ts | 18 - yarn.lock | 11766 ++++++++++++---- 765 files changed, 14674 insertions(+), 10149 deletions(-) delete mode 100644 packages/pn-commons/babel.config.js delete mode 100644 packages/pn-commons/src/assets/question.svg delete mode 100644 packages/pn-commons/src/components/Illustrations/IllusQuestion.tsx rename packages/pn-commons/src/{utility/__test__/onetrust.utility.test.tsx => hooks/__test__/useRewriteLinks.test.tsx} (69%) create mode 100644 packages/pn-commons/src/hooks/useRewriteLinks.ts delete mode 100644 packages/pn-commons/src/models/PaymentCache.ts delete mode 100644 packages/pn-commons/src/utility/__test__/paymentCaching.utility.test.ts delete mode 100644 packages/pn-commons/src/utility/paymentCaching.utility.ts delete mode 100644 packages/pn-commons/src/vite-env.d.ts delete mode 100644 packages/pn-commons/tsconfig.prod.json delete mode 100644 packages/pn-commons/vite.config.a11y.ts delete mode 100644 packages/pn-commons/vite.config.all.ts delete mode 100644 packages/pn-commons/vite.config.ts delete mode 100644 packages/pn-pa-webapp/babel.config.js create mode 100644 packages/pn-pa-webapp/craco.config.js rename packages/pn-pa-webapp/{ => public}/index.html (66%) rename packages/pn-pa-webapp/src/{main.tsx => index.tsx} (67%) delete mode 100644 packages/pn-pa-webapp/src/vite-env.d.ts delete mode 100644 packages/pn-pa-webapp/vite.config.a11y.ts delete mode 100644 packages/pn-pa-webapp/vite.config.all.ts delete mode 100644 packages/pn-pa-webapp/vite.config.ts delete mode 100644 packages/pn-personafisica-login/babel.config.js create mode 100644 packages/pn-personafisica-login/craco.config.js delete mode 100644 packages/pn-personafisica-login/index.html create mode 100644 packages/pn-personafisica-login/public/index.html delete mode 100644 packages/pn-personafisica-login/public/js/redirect.js delete mode 100644 packages/pn-personafisica-login/public/onetrust/consent/29cc1c86-f2ef-494d-8242-9bec8009cd29-test/0ef21c96-33d4-4492-9669-6063f1b8b5a4/it.json delete mode 100644 packages/pn-personafisica-login/public/onetrust/consent/29cc1c86-f2ef-494d-8242-9bec8009cd29-test/0ef21c96-33d4-4492-9669-6063f1b8b5a4/logos/static/ot_guard_logo.svg delete mode 100644 packages/pn-personafisica-login/public/onetrust/consent/29cc1c86-f2ef-494d-8242-9bec8009cd29/4bdef2c1-1303-4347-9736-dd867b1ac445/it.json delete mode 100644 packages/pn-personafisica-login/public/onetrust/consent/29cc1c86-f2ef-494d-8242-9bec8009cd29/4bdef2c1-1303-4347-9736-dd867b1ac445/logos/static/ot_guard_logo.svg delete mode 100644 packages/pn-personafisica-login/public/onetrust/consent/29cc1c86-f2ef-494d-8242-9bec8009cd29/googleData.json create mode 100644 packages/pn-personafisica-login/public/onetrust/consent/ff3d2b72-7a44-43c2-b3bb-49e22f78edb9-test/0ef21c96-33d4-4492-9669-6063f1b8b5a4/it.json rename packages/pn-personafisica-login/public/onetrust/consent/{29cc1c86-f2ef-494d-8242-9bec8009cd29-test => ff3d2b72-7a44-43c2-b3bb-49e22f78edb9-test}/0ef21c96-33d4-4492-9669-6063f1b8b5a4/logos/77f17844-04c3-4969-a11d-462ee77acbe1/7ee55bc9-5005-445b-bf67-d9f9c7dc2723/4fd1e0be-cc08-4afc-9259-94acf1f8b1fb/logo-pagopa-onetrust.png (100%) rename packages/pn-personafisica-login/public/onetrust/consent/{29cc1c86-f2ef-494d-8242-9bec8009cd29-test => ff3d2b72-7a44-43c2-b3bb-49e22f78edb9-test}/0ef21c96-33d4-4492-9669-6063f1b8b5a4/logos/static/ot_close.svg (100%) rename packages/pn-personafisica-login/public/onetrust/consent/{29cc1c86-f2ef-494d-8242-9bec8009cd29-test => ff3d2b72-7a44-43c2-b3bb-49e22f78edb9-test}/0ef21c96-33d4-4492-9669-6063f1b8b5a4/logos/static/ot_external_link.svg (100%) rename packages/pn-personafisica-login/public/onetrust/consent/{29cc1c86-f2ef-494d-8242-9bec8009cd29-test => ff3d2b72-7a44-43c2-b3bb-49e22f78edb9-test}/0ef21c96-33d4-4492-9669-6063f1b8b5a4/logos/static/ot_persistent_cookie_icon.png (100%) rename packages/pn-personafisica-login/public/onetrust/consent/{29cc1c86-f2ef-494d-8242-9bec8009cd29-test => ff3d2b72-7a44-43c2-b3bb-49e22f78edb9-test}/0ef21c96-33d4-4492-9669-6063f1b8b5a4/logos/static/powered_by_logo.svg (100%) rename packages/pn-personafisica-login/public/onetrust/consent/{29cc1c86-f2ef-494d-8242-9bec8009cd29-test/29cc1c86-f2ef-494d-8242-9bec8009cd29-test.json => ff3d2b72-7a44-43c2-b3bb-49e22f78edb9-test/ff3d2b72-7a44-43c2-b3bb-49e22f78edb9-test.json} (57%) create mode 100644 packages/pn-personafisica-login/public/onetrust/consent/ff3d2b72-7a44-43c2-b3bb-49e22f78edb9/0ef21c96-33d4-4492-9669-6063f1b8b5a4/it.json rename packages/pn-personafisica-login/public/onetrust/consent/{29cc1c86-f2ef-494d-8242-9bec8009cd29/4bdef2c1-1303-4347-9736-dd867b1ac445 => ff3d2b72-7a44-43c2-b3bb-49e22f78edb9/0ef21c96-33d4-4492-9669-6063f1b8b5a4}/logos/77f17844-04c3-4969-a11d-462ee77acbe1/7ee55bc9-5005-445b-bf67-d9f9c7dc2723/4fd1e0be-cc08-4afc-9259-94acf1f8b1fb/logo-pagopa-onetrust.png (100%) rename packages/pn-personafisica-login/public/onetrust/consent/{29cc1c86-f2ef-494d-8242-9bec8009cd29/4bdef2c1-1303-4347-9736-dd867b1ac445 => ff3d2b72-7a44-43c2-b3bb-49e22f78edb9/0ef21c96-33d4-4492-9669-6063f1b8b5a4}/logos/static/ot_close.svg (100%) rename packages/pn-personafisica-login/public/onetrust/consent/{29cc1c86-f2ef-494d-8242-9bec8009cd29/4bdef2c1-1303-4347-9736-dd867b1ac445 => ff3d2b72-7a44-43c2-b3bb-49e22f78edb9/0ef21c96-33d4-4492-9669-6063f1b8b5a4}/logos/static/ot_external_link.svg (100%) rename packages/pn-personafisica-login/public/onetrust/consent/{29cc1c86-f2ef-494d-8242-9bec8009cd29/4bdef2c1-1303-4347-9736-dd867b1ac445 => ff3d2b72-7a44-43c2-b3bb-49e22f78edb9/0ef21c96-33d4-4492-9669-6063f1b8b5a4}/logos/static/ot_persistent_cookie_icon.png (100%) rename packages/pn-personafisica-login/public/onetrust/consent/{29cc1c86-f2ef-494d-8242-9bec8009cd29/4bdef2c1-1303-4347-9736-dd867b1ac445 => ff3d2b72-7a44-43c2-b3bb-49e22f78edb9/0ef21c96-33d4-4492-9669-6063f1b8b5a4}/logos/static/powered_by_logo.svg (100%) rename packages/pn-personafisica-login/public/onetrust/consent/{29cc1c86-f2ef-494d-8242-9bec8009cd29/29cc1c86-f2ef-494d-8242-9bec8009cd29.json => ff3d2b72-7a44-43c2-b3bb-49e22f78edb9/ff3d2b72-7a44-43c2-b3bb-49e22f78edb9.json} (54%) rename packages/pn-personafisica-login/public/onetrust/scripttemplates/{202401.1.0 => 202303.2.0}/assets/modern_rtl.json (100%) rename packages/pn-personafisica-login/public/onetrust/scripttemplates/{202401.1.0 => 202303.2.0}/assets/optanon.json (100%) rename packages/{pn-personafisica-webapp/public/onetrust/scripttemplates/202401.1.0 => pn-personafisica-login/public/onetrust/scripttemplates/202303.2.0}/assets/otCenterRounded.json (85%) rename packages/pn-personafisica-login/public/onetrust/scripttemplates/{202401.1.0 => 202303.2.0}/assets/otCenterRoundedRtl.json (85%) create mode 100644 packages/pn-personafisica-login/public/onetrust/scripttemplates/202303.2.0/assets/otChoicesBanner.json create mode 100644 packages/pn-personafisica-login/public/onetrust/scripttemplates/202303.2.0/assets/otChoicesBannerRtl.json create mode 100644 packages/pn-personafisica-login/public/onetrust/scripttemplates/202303.2.0/assets/otCommonStyles.css create mode 100644 packages/pn-personafisica-login/public/onetrust/scripttemplates/202303.2.0/assets/otCommonStylesRtl.css rename packages/{pn-personafisica-webapp/public/onetrust/scripttemplates/202401.1.0 => pn-personafisica-login/public/onetrust/scripttemplates/202303.2.0}/assets/otCookieSettingsButton.json (70%) rename packages/pn-personafisica-login/public/onetrust/scripttemplates/{202401.1.0 => 202303.2.0}/assets/otCookieSettingsButtonRtl.json (70%) rename packages/pn-personafisica-login/public/onetrust/scripttemplates/{202401.1.0 => 202303.2.0}/assets/otFlat.json (88%) rename packages/{pn-personafisica-webapp/public/onetrust/scripttemplates/202401.1.0 => pn-personafisica-login/public/onetrust/scripttemplates/202303.2.0}/assets/otFlatRtl.json (88%) rename packages/{pn-personafisica-webapp/public/onetrust/scripttemplates/202401.1.0 => pn-personafisica-login/public/onetrust/scripttemplates/202303.2.0}/assets/otFloatingFlat.json (88%) rename packages/pn-personafisica-login/public/onetrust/scripttemplates/{202401.1.0 => 202303.2.0}/assets/otFloatingFlatRtl.json (88%) rename packages/{pn-personafisica-webapp/public/onetrust/scripttemplates/202401.1.0 => pn-personafisica-login/public/onetrust/scripttemplates/202303.2.0}/assets/otFloatingRounded.json (85%) rename packages/{pn-personafisica-webapp/public/onetrust/scripttemplates/202401.1.0 => pn-personafisica-login/public/onetrust/scripttemplates/202303.2.0}/assets/otFloatingRoundedCorner.json (86%) rename packages/pn-personafisica-login/public/onetrust/scripttemplates/{202401.1.0 => 202303.2.0}/assets/otFloatingRoundedCornerRtl.json (86%) create mode 100644 packages/pn-personafisica-login/public/onetrust/scripttemplates/202303.2.0/assets/otFloatingRoundedIcon.json create mode 100644 packages/pn-personafisica-login/public/onetrust/scripttemplates/202303.2.0/assets/otFloatingRoundedIconRtl.json rename packages/pn-personafisica-login/public/onetrust/scripttemplates/{202401.1.0 => 202303.2.0}/assets/otFloatingRoundedRtl.json (85%) create mode 100644 packages/pn-personafisica-login/public/onetrust/scripttemplates/202303.2.0/assets/otPcCenter.json create mode 100644 packages/pn-personafisica-login/public/onetrust/scripttemplates/202303.2.0/assets/otPcCenterRtl.json rename packages/pn-personafisica-login/public/onetrust/scripttemplates/{202401.1.0 => 202303.2.0}/assets/otPcList.json (60%) rename packages/pn-personafisica-login/public/onetrust/scripttemplates/{202401.1.0 => 202303.2.0}/assets/otPcListRtl.json (60%) create mode 100644 packages/pn-personafisica-login/public/onetrust/scripttemplates/202303.2.0/assets/otPcPanel.json create mode 100644 packages/pn-personafisica-login/public/onetrust/scripttemplates/202303.2.0/assets/otPcPanelRtl.json rename packages/pn-personafisica-login/public/onetrust/scripttemplates/{202401.1.0 => 202303.2.0}/assets/otPcPopup.json (58%) rename packages/pn-personafisica-login/public/onetrust/scripttemplates/{202401.1.0 => 202303.2.0}/assets/otPcPopupRtl.json (58%) rename packages/pn-personafisica-login/public/onetrust/scripttemplates/{202401.1.0 => 202303.2.0}/assets/otPcTab.json (52%) rename packages/{pn-personafisica-webapp/public/onetrust/scripttemplates/202401.1.0 => pn-personafisica-login/public/onetrust/scripttemplates/202303.2.0}/assets/otPcTabRtl.json (53%) rename packages/pn-personafisica-login/public/onetrust/scripttemplates/{202401.1.0 => 202303.2.0}/assets/otSyncNotification.json (100%) rename packages/pn-personafisica-login/public/onetrust/scripttemplates/{202401.1.0 => 202303.2.0}/assets/otSyncNotificationRtl.json (100%) create mode 100644 packages/pn-personafisica-login/public/onetrust/scripttemplates/202303.2.0/assets/v2/otPcCenter.json create mode 100644 packages/pn-personafisica-login/public/onetrust/scripttemplates/202303.2.0/assets/v2/otPcCenterRtl.json create mode 100644 packages/pn-personafisica-login/public/onetrust/scripttemplates/202303.2.0/assets/v2/otPcPanel.json create mode 100644 packages/pn-personafisica-login/public/onetrust/scripttemplates/202303.2.0/assets/v2/otPcPanelRtl.json create mode 100644 packages/pn-personafisica-login/public/onetrust/scripttemplates/202303.2.0/assets/v2/otPcTab.json create mode 100644 packages/pn-personafisica-login/public/onetrust/scripttemplates/202303.2.0/assets/v2/otPcTabRtl.json create mode 100644 packages/pn-personafisica-login/public/onetrust/scripttemplates/202303.2.0/hbbtv.js create mode 100644 packages/pn-personafisica-login/public/onetrust/scripttemplates/202303.2.0/otBannerSdk.js create mode 100644 packages/pn-personafisica-login/public/onetrust/scripttemplates/202303.2.0/otGPP.js create mode 100644 packages/pn-personafisica-login/public/onetrust/scripttemplates/202303.2.0/otStub.js create mode 100644 packages/pn-personafisica-login/public/onetrust/scripttemplates/202303.2.0/otTCF.js rename packages/pn-personafisica-login/public/onetrust/scripttemplates/{202401.1.0 => 202303.2.0}/trackingTechnologies.js (94%) delete mode 100644 packages/pn-personafisica-login/public/onetrust/scripttemplates/202401.1.0/assets/otChoicesBanner.json delete mode 100644 packages/pn-personafisica-login/public/onetrust/scripttemplates/202401.1.0/assets/otChoicesBannerRtl.json delete mode 100644 packages/pn-personafisica-login/public/onetrust/scripttemplates/202401.1.0/assets/otCommonStyles.css delete mode 100644 packages/pn-personafisica-login/public/onetrust/scripttemplates/202401.1.0/assets/otCommonStylesRtl.css delete mode 100644 packages/pn-personafisica-login/public/onetrust/scripttemplates/202401.1.0/assets/otFloatingRoundedIcon.json delete mode 100644 packages/pn-personafisica-login/public/onetrust/scripttemplates/202401.1.0/assets/otFloatingRoundedIconRtl.json delete mode 100644 packages/pn-personafisica-login/public/onetrust/scripttemplates/202401.1.0/assets/otPcCenter.json delete mode 100644 packages/pn-personafisica-login/public/onetrust/scripttemplates/202401.1.0/assets/otPcCenterRtl.json delete mode 100644 packages/pn-personafisica-login/public/onetrust/scripttemplates/202401.1.0/assets/otPcPanel.json delete mode 100644 packages/pn-personafisica-login/public/onetrust/scripttemplates/202401.1.0/assets/otPcPanelRtl.json delete mode 100644 packages/pn-personafisica-login/public/onetrust/scripttemplates/202401.1.0/assets/v2/otPcCenter.json delete mode 100644 packages/pn-personafisica-login/public/onetrust/scripttemplates/202401.1.0/assets/v2/otPcCenterRtl.json delete mode 100644 packages/pn-personafisica-login/public/onetrust/scripttemplates/202401.1.0/assets/v2/otPcPanel.json delete mode 100644 packages/pn-personafisica-login/public/onetrust/scripttemplates/202401.1.0/assets/v2/otPcPanelRtl.json delete mode 100644 packages/pn-personafisica-login/public/onetrust/scripttemplates/202401.1.0/assets/v2/otPcTab.json delete mode 100644 packages/pn-personafisica-login/public/onetrust/scripttemplates/202401.1.0/assets/v2/otPcTabRtl.json delete mode 100644 packages/pn-personafisica-login/public/onetrust/scripttemplates/202401.1.0/hbbtv.js delete mode 100644 packages/pn-personafisica-login/public/onetrust/scripttemplates/202401.1.0/otBannerSdk.js delete mode 100644 packages/pn-personafisica-login/public/onetrust/scripttemplates/202401.1.0/otGPP.js delete mode 100644 packages/pn-personafisica-login/public/onetrust/scripttemplates/202401.1.0/otStub.js delete mode 100644 packages/pn-personafisica-login/public/onetrust/scripttemplates/202401.1.0/otTCF.js rename packages/pn-personafisica-login/src/{main.tsx => index.tsx} (81%) create mode 100644 packages/pn-personafisica-login/src/pages/privacyPolicy/PrivacyPolicy.tsx create mode 100644 packages/pn-personafisica-login/src/pages/privacyPolicy/__test__/PrivacyPolicy.test.tsx delete mode 100644 packages/pn-personafisica-login/src/vite-env.d.ts delete mode 100644 packages/pn-personafisica-login/vite.config.ts delete mode 100644 packages/pn-personafisica-webapp/babel.config.js create mode 100644 packages/pn-personafisica-webapp/craco.config.js rename packages/pn-personafisica-webapp/{ => public}/index.html (65%) delete mode 100644 packages/pn-personafisica-webapp/public/onetrust/consent/29cc1c86-f2ef-494d-8242-9bec8009cd29-test/0ef21c96-33d4-4492-9669-6063f1b8b5a4/logos/static/ot_guard_logo.svg create mode 100644 packages/pn-personafisica-webapp/public/onetrust/consent/29cc1c86-f2ef-494d-8242-9bec8009cd29/0ef21c96-33d4-4492-9669-6063f1b8b5a4/it.json rename packages/pn-personafisica-webapp/public/onetrust/consent/29cc1c86-f2ef-494d-8242-9bec8009cd29/{4bdef2c1-1303-4347-9736-dd867b1ac445 => 0ef21c96-33d4-4492-9669-6063f1b8b5a4}/logos/77f17844-04c3-4969-a11d-462ee77acbe1/7ee55bc9-5005-445b-bf67-d9f9c7dc2723/4fd1e0be-cc08-4afc-9259-94acf1f8b1fb/logo-pagopa-onetrust.png (100%) rename packages/pn-personafisica-webapp/public/onetrust/consent/29cc1c86-f2ef-494d-8242-9bec8009cd29/{4bdef2c1-1303-4347-9736-dd867b1ac445 => 0ef21c96-33d4-4492-9669-6063f1b8b5a4}/logos/static/ot_close.svg (100%) rename packages/pn-personafisica-webapp/public/onetrust/consent/29cc1c86-f2ef-494d-8242-9bec8009cd29/{4bdef2c1-1303-4347-9736-dd867b1ac445 => 0ef21c96-33d4-4492-9669-6063f1b8b5a4}/logos/static/ot_external_link.svg (100%) rename packages/pn-personafisica-webapp/public/onetrust/consent/29cc1c86-f2ef-494d-8242-9bec8009cd29/{4bdef2c1-1303-4347-9736-dd867b1ac445 => 0ef21c96-33d4-4492-9669-6063f1b8b5a4}/logos/static/ot_persistent_cookie_icon.png (100%) rename packages/pn-personafisica-webapp/public/onetrust/consent/29cc1c86-f2ef-494d-8242-9bec8009cd29/{4bdef2c1-1303-4347-9736-dd867b1ac445 => 0ef21c96-33d4-4492-9669-6063f1b8b5a4}/logos/static/powered_by_logo.svg (100%) delete mode 100644 packages/pn-personafisica-webapp/public/onetrust/consent/29cc1c86-f2ef-494d-8242-9bec8009cd29/4bdef2c1-1303-4347-9736-dd867b1ac445/it.json delete mode 100644 packages/pn-personafisica-webapp/public/onetrust/consent/29cc1c86-f2ef-494d-8242-9bec8009cd29/4bdef2c1-1303-4347-9736-dd867b1ac445/logos/static/ot_guard_logo.svg delete mode 100644 packages/pn-personafisica-webapp/public/onetrust/consent/29cc1c86-f2ef-494d-8242-9bec8009cd29/googleData.json rename packages/pn-personafisica-webapp/public/onetrust/scripttemplates/{202401.1.0 => 202303.2.0}/assets/modern_rtl.json (100%) rename packages/pn-personafisica-webapp/public/onetrust/scripttemplates/{202401.1.0 => 202303.2.0}/assets/optanon.json (100%) rename packages/{pn-personafisica-login/public/onetrust/scripttemplates/202401.1.0 => pn-personafisica-webapp/public/onetrust/scripttemplates/202303.2.0}/assets/otCenterRounded.json (85%) rename packages/pn-personafisica-webapp/public/onetrust/scripttemplates/{202401.1.0 => 202303.2.0}/assets/otCenterRoundedRtl.json (85%) create mode 100644 packages/pn-personafisica-webapp/public/onetrust/scripttemplates/202303.2.0/assets/otChoicesBanner.json create mode 100644 packages/pn-personafisica-webapp/public/onetrust/scripttemplates/202303.2.0/assets/otChoicesBannerRtl.json create mode 100644 packages/pn-personafisica-webapp/public/onetrust/scripttemplates/202303.2.0/assets/otCommonStyles.css create mode 100644 packages/pn-personafisica-webapp/public/onetrust/scripttemplates/202303.2.0/assets/otCommonStylesRtl.css rename packages/{pn-personafisica-login/public/onetrust/scripttemplates/202401.1.0 => pn-personafisica-webapp/public/onetrust/scripttemplates/202303.2.0}/assets/otCookieSettingsButton.json (70%) rename packages/pn-personafisica-webapp/public/onetrust/scripttemplates/{202401.1.0 => 202303.2.0}/assets/otCookieSettingsButtonRtl.json (70%) rename packages/pn-personafisica-webapp/public/onetrust/scripttemplates/{202401.1.0 => 202303.2.0}/assets/otFlat.json (88%) rename packages/{pn-personafisica-login/public/onetrust/scripttemplates/202401.1.0 => pn-personafisica-webapp/public/onetrust/scripttemplates/202303.2.0}/assets/otFlatRtl.json (88%) rename packages/{pn-personafisica-login/public/onetrust/scripttemplates/202401.1.0 => pn-personafisica-webapp/public/onetrust/scripttemplates/202303.2.0}/assets/otFloatingFlat.json (88%) rename packages/pn-personafisica-webapp/public/onetrust/scripttemplates/{202401.1.0 => 202303.2.0}/assets/otFloatingFlatRtl.json (88%) rename packages/{pn-personafisica-login/public/onetrust/scripttemplates/202401.1.0 => pn-personafisica-webapp/public/onetrust/scripttemplates/202303.2.0}/assets/otFloatingRounded.json (85%) rename packages/{pn-personafisica-login/public/onetrust/scripttemplates/202401.1.0 => pn-personafisica-webapp/public/onetrust/scripttemplates/202303.2.0}/assets/otFloatingRoundedCorner.json (86%) rename packages/pn-personafisica-webapp/public/onetrust/scripttemplates/{202401.1.0 => 202303.2.0}/assets/otFloatingRoundedCornerRtl.json (86%) create mode 100644 packages/pn-personafisica-webapp/public/onetrust/scripttemplates/202303.2.0/assets/otFloatingRoundedIcon.json create mode 100644 packages/pn-personafisica-webapp/public/onetrust/scripttemplates/202303.2.0/assets/otFloatingRoundedIconRtl.json rename packages/pn-personafisica-webapp/public/onetrust/scripttemplates/{202401.1.0 => 202303.2.0}/assets/otFloatingRoundedRtl.json (85%) create mode 100644 packages/pn-personafisica-webapp/public/onetrust/scripttemplates/202303.2.0/assets/otPcCenter.json create mode 100644 packages/pn-personafisica-webapp/public/onetrust/scripttemplates/202303.2.0/assets/otPcCenterRtl.json rename packages/pn-personafisica-webapp/public/onetrust/scripttemplates/{202401.1.0 => 202303.2.0}/assets/otPcList.json (60%) rename packages/pn-personafisica-webapp/public/onetrust/scripttemplates/{202401.1.0 => 202303.2.0}/assets/otPcListRtl.json (60%) create mode 100644 packages/pn-personafisica-webapp/public/onetrust/scripttemplates/202303.2.0/assets/otPcPanel.json create mode 100644 packages/pn-personafisica-webapp/public/onetrust/scripttemplates/202303.2.0/assets/otPcPanelRtl.json rename packages/pn-personafisica-webapp/public/onetrust/scripttemplates/{202401.1.0 => 202303.2.0}/assets/otPcPopup.json (58%) rename packages/pn-personafisica-webapp/public/onetrust/scripttemplates/{202401.1.0 => 202303.2.0}/assets/otPcPopupRtl.json (58%) rename packages/pn-personafisica-webapp/public/onetrust/scripttemplates/{202401.1.0 => 202303.2.0}/assets/otPcTab.json (52%) rename packages/{pn-personafisica-login/public/onetrust/scripttemplates/202401.1.0 => pn-personafisica-webapp/public/onetrust/scripttemplates/202303.2.0}/assets/otPcTabRtl.json (53%) rename packages/pn-personafisica-webapp/public/onetrust/scripttemplates/{202401.1.0 => 202303.2.0}/assets/otSyncNotification.json (100%) rename packages/pn-personafisica-webapp/public/onetrust/scripttemplates/{202401.1.0 => 202303.2.0}/assets/otSyncNotificationRtl.json (100%) create mode 100644 packages/pn-personafisica-webapp/public/onetrust/scripttemplates/202303.2.0/assets/v2/otPcCenter.json create mode 100644 packages/pn-personafisica-webapp/public/onetrust/scripttemplates/202303.2.0/assets/v2/otPcCenterRtl.json create mode 100644 packages/pn-personafisica-webapp/public/onetrust/scripttemplates/202303.2.0/assets/v2/otPcPanel.json create mode 100644 packages/pn-personafisica-webapp/public/onetrust/scripttemplates/202303.2.0/assets/v2/otPcPanelRtl.json create mode 100644 packages/pn-personafisica-webapp/public/onetrust/scripttemplates/202303.2.0/assets/v2/otPcTab.json create mode 100644 packages/pn-personafisica-webapp/public/onetrust/scripttemplates/202303.2.0/assets/v2/otPcTabRtl.json create mode 100644 packages/pn-personafisica-webapp/public/onetrust/scripttemplates/202303.2.0/hbbtv.js create mode 100644 packages/pn-personafisica-webapp/public/onetrust/scripttemplates/202303.2.0/otBannerSdk.js create mode 100644 packages/pn-personafisica-webapp/public/onetrust/scripttemplates/202303.2.0/otGPP.js create mode 100644 packages/pn-personafisica-webapp/public/onetrust/scripttemplates/202303.2.0/otStub.js create mode 100644 packages/pn-personafisica-webapp/public/onetrust/scripttemplates/202303.2.0/otTCF.js rename packages/pn-personafisica-webapp/public/onetrust/scripttemplates/{202401.1.0 => 202303.2.0}/trackingTechnologies.js (94%) delete mode 100644 packages/pn-personafisica-webapp/public/onetrust/scripttemplates/202401.1.0/assets/otChoicesBanner.json delete mode 100644 packages/pn-personafisica-webapp/public/onetrust/scripttemplates/202401.1.0/assets/otChoicesBannerRtl.json delete mode 100644 packages/pn-personafisica-webapp/public/onetrust/scripttemplates/202401.1.0/assets/otCommonStyles.css delete mode 100644 packages/pn-personafisica-webapp/public/onetrust/scripttemplates/202401.1.0/assets/otCommonStylesRtl.css delete mode 100644 packages/pn-personafisica-webapp/public/onetrust/scripttemplates/202401.1.0/assets/otFloatingRoundedIcon.json delete mode 100644 packages/pn-personafisica-webapp/public/onetrust/scripttemplates/202401.1.0/assets/otFloatingRoundedIconRtl.json delete mode 100644 packages/pn-personafisica-webapp/public/onetrust/scripttemplates/202401.1.0/assets/otPcCenter.json delete mode 100644 packages/pn-personafisica-webapp/public/onetrust/scripttemplates/202401.1.0/assets/otPcCenterRtl.json delete mode 100644 packages/pn-personafisica-webapp/public/onetrust/scripttemplates/202401.1.0/assets/otPcPanel.json delete mode 100644 packages/pn-personafisica-webapp/public/onetrust/scripttemplates/202401.1.0/assets/otPcPanelRtl.json delete mode 100644 packages/pn-personafisica-webapp/public/onetrust/scripttemplates/202401.1.0/assets/v2/otPcCenter.json delete mode 100644 packages/pn-personafisica-webapp/public/onetrust/scripttemplates/202401.1.0/assets/v2/otPcCenterRtl.json delete mode 100644 packages/pn-personafisica-webapp/public/onetrust/scripttemplates/202401.1.0/assets/v2/otPcPanel.json delete mode 100644 packages/pn-personafisica-webapp/public/onetrust/scripttemplates/202401.1.0/assets/v2/otPcPanelRtl.json delete mode 100644 packages/pn-personafisica-webapp/public/onetrust/scripttemplates/202401.1.0/assets/v2/otPcTab.json delete mode 100644 packages/pn-personafisica-webapp/public/onetrust/scripttemplates/202401.1.0/assets/v2/otPcTabRtl.json delete mode 100644 packages/pn-personafisica-webapp/public/onetrust/scripttemplates/202401.1.0/hbbtv.js delete mode 100644 packages/pn-personafisica-webapp/public/onetrust/scripttemplates/202401.1.0/otBannerSdk.js delete mode 100644 packages/pn-personafisica-webapp/public/onetrust/scripttemplates/202401.1.0/otGPP.js delete mode 100644 packages/pn-personafisica-webapp/public/onetrust/scripttemplates/202401.1.0/otStub.js delete mode 100644 packages/pn-personafisica-webapp/public/onetrust/scripttemplates/202401.1.0/otTCF.js rename packages/pn-personafisica-webapp/src/{main.tsx => index.tsx} (67%) delete mode 100644 packages/pn-personafisica-webapp/src/vite-env.d.ts delete mode 100644 packages/pn-personafisica-webapp/vite.config.a11y.ts delete mode 100644 packages/pn-personafisica-webapp/vite.config.all.ts delete mode 100644 packages/pn-personafisica-webapp/vite.config.ts delete mode 100644 packages/pn-personagiuridica-webapp/babel.config.js create mode 100644 packages/pn-personagiuridica-webapp/craco.config.js rename packages/pn-personagiuridica-webapp/{ => public}/index.html (65%) rename packages/pn-personagiuridica-webapp/src/{main.tsx => index.tsx} (67%) delete mode 100644 packages/pn-personagiuridica-webapp/src/vite-env.d.ts delete mode 100644 packages/pn-personagiuridica-webapp/vite.config.a11y.ts delete mode 100644 packages/pn-personagiuridica-webapp/vite.config.all.ts delete mode 100644 packages/pn-personagiuridica-webapp/vite.config.ts create mode 100644 packages/pn-validator/.babelrc delete mode 100644 packages/pn-validator/tsconfig.prod.json delete mode 100644 packages/pn-validator/vite.config.ts diff --git a/CHANGELOG.md b/CHANGELOG.md index be828fc83e..a37b1c55bb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,34 +3,6 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. -# [2.3.0](https://github.com/pagopa/pn-frontend/compare/v2.3.0-RC.2...v2.3.0) (2024-01-25) - -**Note:** Version bump only for package send-monorepo - - - - - -# [2.3.0-RC.2](https://github.com/pagopa/pn-frontend/compare/v2.3.0-RC.1...v2.3.0-RC.2) (2024-01-24) - - -### Bug Fixes - -* **PN-9541:** Logout from ToS and PP page ([#1118](https://github.com/pagopa/pn-frontend/issues/1118)) ([b143072](https://github.com/pagopa/pn-frontend/commit/b143072f7ac4f03383117aa05db7afed7f5c28bf)) -* **pn-9624:** updated vitest config for coverage analysis ([#1115](https://github.com/pagopa/pn-frontend/issues/1115)) ([c940dd9](https://github.com/pagopa/pn-frontend/commit/c940dd9f3be6b78f5c2ef0df0e9628caf05d245a)) - - - - - -# [2.3.0-RC.1](https://github.com/pagopa/pn-frontend/compare/v2.3.0-RC.0...v2.3.0-RC.1) (2024-01-19) - -**Note:** Version bump only for package send-monorepo - - - - - ## [2.2.4](https://github.com/pagopa/pn-frontend/compare/v2.2.4-RC.0...v2.2.4) (2024-01-12) **Note:** Version bump only for package send-monorepo diff --git a/README.md b/README.md index 5ab1f9dd8d..47e879822d 100644 --- a/README.md +++ b/README.md @@ -28,7 +28,7 @@ To run test for all packages To run test for one file `cd ` -`yarn test ` +`yarn test --testPathPattern=` To build all the monorepo `yarn build` @@ -38,10 +38,6 @@ Other scripts - `yarn refresh:monorepo` reinstalls all the dependencies of the whole workspace - `yarn clean` deletes node_modules folder recursively in the workspace -### Development mode - -When running the application in development mode, uncheck the "Disable cache" flag in chrome console. Vite uses the dependency pre-building (https://vitejs.dev/guide/dep-pre-bundling) and if the flag is checked, the code is runned twice at start-up. - ### How to contribute Our branching model is based on [GitFlow](https://www.atlassian.com/git/tutorials/comparing-workflows/gitflow-workflow). Usually you can conclude your changes opening a PR. diff --git a/aws-cdn-templates/one-cdn.yaml b/aws-cdn-templates/one-cdn.yaml index 4e5d337482..73e2f0e22b 100644 --- a/aws-cdn-templates/one-cdn.yaml +++ b/aws-cdn-templates/one-cdn.yaml @@ -9,14 +9,6 @@ Parameters: Description: "Domain for webapp" Type: String - SubCdnDomain: - Description: "Domain for sub cdn" - Type: String - - RootWebDomain: - Description: "Domain for root webapp" - Type: String - WebDomainReferenceToSite: Description: true if the website must be reachable using the WebDomain Type: String @@ -71,21 +63,10 @@ Parameters: S3LogsBucket: Type: String - Default: "-" + Default: '-' Description: Access Log bucket name Conditions: - # Is Portale PF site if name startsWith 'webapp-pf-cdn-' - IsPortalePf: - Fn::And: - - !Not [!Equals [!Ref Name, ""]] - - !Equals [!Select [0, !Split [webapp-pf-cdn-, !Ref Name]], ""] - - # Is Portale PF Login site if name startsWith 'webapp-pfl-cdn-' - IsPortalePfLogin: - Fn::And: - - !Not [!Equals [!Ref Name, ""]] - - !Equals [!Select [0, !Split [webapp-pfl-cdn-, !Ref Name]], ""] # Is Portale PG site if name startsWith 'webapp-pg-cdn-' IsPortalePg: @@ -97,7 +78,7 @@ Conditions: IsPortalePgProd: Fn::And: - !Not [!Equals [!Ref Name, ""]] - - !Equals [webapp-pg-cdn-prod, !Ref Name] + - !Equals [ webapp-pg-cdn-prod, !Ref Name ] # If domain is used in certificate, add this domain to CloudFront CreateDNSname: !Equals @@ -105,7 +86,7 @@ Conditions: - "true" # If domain is used in certificate, add this domain to CloudFront - HasLogsBucket: !Not [!Equals [!Ref S3LogsBucket, "-"]] + HasLogsBucket: !Not [!Equals [!Ref S3LogsBucket, "-" ]] # If alternate domain is provided and is used in certificate, add this domain to CloudFront CreateAlternateDNSname: @@ -306,103 +287,89 @@ Resources: ResponseHeadersPolicyId: !Ref DefaultHeaderPolicy PathPattern: /icons* - Fn::If: - - IsPortalePg - - AllowedMethods: - - GET - - HEAD - CachedMethods: - - GET - - HEAD - TargetOriginId: pn-SelfCare-PG - ViewerProtocolPolicy: redirect-to-https - CachePolicyId: b2884449-e4de-46a7-ac36-70bc7f1ddd6d - ResponseHeadersPolicyId: !Ref SelfcareHeaderPolicy - PathPattern: /auth* - - !Ref "AWS::NoValue" - - Fn::If: - - IsPortalePg - - AllowedMethods: - - GET - - HEAD - CachedMethods: - - GET - - HEAD - TargetOriginId: pn-SelfCare-PG - ViewerProtocolPolicy: redirect-to-https - CachePolicyId: b2884449-e4de-46a7-ac36-70bc7f1ddd6d - ResponseHeadersPolicyId: !Ref SelfcareHeaderPolicy - PathPattern: /dashboard* - - !Ref "AWS::NoValue" + - IsPortalePg + - AllowedMethods: + - GET + - HEAD + CachedMethods: + - GET + - HEAD + TargetOriginId: pn-SelfCare-PG + ViewerProtocolPolicy: redirect-to-https + CachePolicyId: b2884449-e4de-46a7-ac36-70bc7f1ddd6d + ResponseHeadersPolicyId: !Ref SelfcareHeaderPolicy + PathPattern: /auth* + - !Ref "AWS::NoValue" - Fn::If: - - IsPortalePg - - AllowedMethods: - - GET - - HEAD - CachedMethods: - - GET - - HEAD - TargetOriginId: pn-SelfCare-PG - ViewerProtocolPolicy: redirect-to-https - CachePolicyId: b2884449-e4de-46a7-ac36-70bc7f1ddd6d - ResponseHeadersPolicyId: !Ref SelfcareHeaderPolicy - PathPattern: /assistenza* - - !Ref "AWS::NoValue" + - IsPortalePg + - AllowedMethods: + - GET + - HEAD + CachedMethods: + - GET + - HEAD + TargetOriginId: pn-SelfCare-PG + ViewerProtocolPolicy: redirect-to-https + CachePolicyId: b2884449-e4de-46a7-ac36-70bc7f1ddd6d + ResponseHeadersPolicyId: !Ref SelfcareHeaderPolicy + PathPattern: /dashboard* + - !Ref "AWS::NoValue" - Fn::If: - - IsPortalePg - - AllowedMethods: - - GET - - HEAD - CachedMethods: - - GET - - HEAD - TargetOriginId: pn-SelfCare-PG - ViewerProtocolPolicy: redirect-to-https - CachePolicyId: b2884449-e4de-46a7-ac36-70bc7f1ddd6d - ResponseHeadersPolicyId: !Ref SelfcareHeaderPolicy - PathPattern: /onboarding* - - !Ref "AWS::NoValue" + - IsPortalePg + - AllowedMethods: + - GET + - HEAD + CachedMethods: + - GET + - HEAD + TargetOriginId: pn-SelfCare-PG + ViewerProtocolPolicy: redirect-to-https + CachePolicyId: b2884449-e4de-46a7-ac36-70bc7f1ddd6d + ResponseHeadersPolicyId: !Ref SelfcareHeaderPolicy + PathPattern: /assistenza* + - !Ref "AWS::NoValue" - Fn::If: - - IsPortalePg - - AllowedMethods: - - GET - - HEAD - CachedMethods: - - GET - - HEAD - TargetOriginId: pn-SelfCare-PG - ViewerProtocolPolicy: redirect-to-https - CachePolicyId: b2884449-e4de-46a7-ac36-70bc7f1ddd6d - ResponseHeadersPolicyId: !Ref SelfcareHeaderPolicy - PathPattern: /assets* - - !Ref "AWS::NoValue" + - IsPortalePg + - AllowedMethods: + - GET + - HEAD + CachedMethods: + - GET + - HEAD + TargetOriginId: pn-SelfCare-PG + ViewerProtocolPolicy: redirect-to-https + CachePolicyId: b2884449-e4de-46a7-ac36-70bc7f1ddd6d + ResponseHeadersPolicyId: !Ref SelfcareHeaderPolicy + PathPattern: /onboarding* + - !Ref "AWS::NoValue" - Fn::If: - - IsPortalePg - - AllowedMethods: - - GET - - HEAD - CachedMethods: - - GET - - HEAD - TargetOriginId: pn-SelfCare-PG - ViewerProtocolPolicy: redirect-to-https - CachePolicyId: b2884449-e4de-46a7-ac36-70bc7f1ddd6d - ResponseHeadersPolicyId: !Ref SelfcareHeaderPolicy - PathPattern: /microcomponents* - - !Ref "AWS::NoValue" + - IsPortalePg + - AllowedMethods: + - GET + - HEAD + CachedMethods: + - GET + - HEAD + TargetOriginId: pn-SelfCare-PG + ViewerProtocolPolicy: redirect-to-https + CachePolicyId: b2884449-e4de-46a7-ac36-70bc7f1ddd6d + ResponseHeadersPolicyId: !Ref SelfcareHeaderPolicy + PathPattern: /assets* + - !Ref "AWS::NoValue" - Fn::If: - - IsPortalePf - - AllowedMethods: - - GET - - HEAD - CachedMethods: - - GET - - HEAD - TargetOriginId: pn-Login-PF - ViewerProtocolPolicy: redirect-to-https - CachePolicyId: !Ref WebsiteCDNCachingPolicy - ResponseHeadersPolicyId: !Ref DefaultHeaderPolicy - PathPattern: /auth* - - !Ref "AWS::NoValue" + - IsPortalePg + - AllowedMethods: + - GET + - HEAD + CachedMethods: + - GET + - HEAD + TargetOriginId: pn-SelfCare-PG + ViewerProtocolPolicy: redirect-to-https + CachePolicyId: b2884449-e4de-46a7-ac36-70bc7f1ddd6d + ResponseHeadersPolicyId: !Ref SelfcareHeaderPolicy + PathPattern: /microcomponents* + - !Ref "AWS::NoValue" DefaultCacheBehavior: AllowedMethods: - GET @@ -414,23 +381,15 @@ Resources: ViewerProtocolPolicy: redirect-to-https CachePolicyId: !Ref WebsiteCDNCachingPolicy ResponseHeadersPolicyId: !Ref DefaultHeaderPolicy - #FunctionAssociations: - # - Fn::If: - # - IsPortalePfLogin - # - EventType: viewer-request - # FunctionARN: !GetAtt RedirectFunction.FunctionMetadata.FunctionARN - # - !Ref "AWS::NoValue" - DefaultRootObject: - !If [IsPortalePfLogin, "auth/index.html", "index.html"] + FunctionAssociations: !Ref "AWS::NoValue" + DefaultRootObject: "index.html" CustomErrorResponses: - ErrorCode: 404 ResponseCode: 200 - ResponsePagePath: - !If [IsPortalePfLogin, "/auth/index.html", "/index.html"] + ResponsePagePath: "/index.html" - ErrorCode: 403 ResponseCode: 200 - ResponsePagePath: - !If [IsPortalePfLogin, "/auth/index.html", "/index.html"] + ResponsePagePath: "/index.html" Origins: - DomainName: !Sub "${S3BucketForWebsiteContent.RegionalDomainName}" Id: !Sub "S3-${S3BucketForWebsiteContent}" @@ -441,28 +400,14 @@ Resources: - - origin-access-identity/cloudfront/ - Ref: CloudFrontOriginAccessIdentity - Fn::If: - - IsPortalePg - - DomainName: - !If [ - IsPortalePgProd, - "pnpg.selfcare.pagopa.it", - "pnpg.uat.selfcare.pagopa.it", - ] - Id: "pn-SelfCare-PG" - CustomOriginConfig: - OriginProtocolPolicy: "https-only" - OriginSSLProtocols: - - TLSv1.2 - - !Ref "AWS::NoValue" - - Fn::If: - - IsPortalePf - - DomainName: !Ref SubCdnDomain - Id: "pn-Login-PF" - CustomOriginConfig: - OriginProtocolPolicy: "https-only" - OriginSSLProtocols: - - TLSv1.2 - - !Ref "AWS::NoValue" + - IsPortalePg + - DomainName: !If [ IsPortalePgProd, 'pnpg.selfcare.pagopa.it', 'pnpg.uat.selfcare.pagopa.it' ] + Id: "pn-SelfCare-PG" + CustomOriginConfig: + OriginProtocolPolicy: 'https-only' + OriginSSLProtocols: + - TLSv1.2 + - !Ref "AWS::NoValue" Logging: Fn::If: - HasLogsBucket @@ -485,7 +430,7 @@ Resources: # add_header Content-Security-Policy ContentSecurityPolicy: ContentSecurityPolicy: - "default-src 'self' https://pnpg.uat.selfcare.pagopa.it/ https://pnpg.selfcare.pagopa.it/ ; \ + "default-src 'self' https://pnpg.uat.selfcare.pagopa.it/ https://pnpg.selfcare.pagopa.it/ ; \ connect-src 'self' https://api-eu.mixpanel.com/track/ \ https://uat.selfcare.pagopa.it/assets/ \ https://selfcare.pagopa.it/assets/ \ @@ -498,7 +443,7 @@ Resources: https://pnpg.uat.selfcare.pagopa.it/ \ https://pnpg.selfcare.pagopa.it/ \ https://privacyportalde-cdn.onetrust.com/ ; \ - worker-src 'none'; \ + worker-src 'none'; \ font-src 'self'; \ frame-ancestors 'self' ; \ img-src 'self' https://assets.cdn.io.italia.it/ https://selcpweupnpgcheckoutsa.z6.web.core.windows.net/ https://selcuweupnpgcheckoutsa.z6.web.core.windows.net/ https://imprese.uat.notifichedigitali.it/ https://imprese.notifichedigitali.it/ data:" @@ -618,35 +563,6 @@ Resources: Runtime: cloudfront-js-1.0 Name: !Sub "${AWS::StackName}-RewriteDefaultIndexRequest" - RedirectFunction: - Condition: IsPortalePfLogin - Type: AWS::CloudFront::Function - Properties: - AutoPublish: true - FunctionCode: !Sub | - function handler(event) { - var request = event.request; - var headers = request.headers; - var domain = "${WebDomain}"; - var uri = request.uri; - - if (headers.host.value === domain) { - return { - statusCode: 301, - statusDescription: "Moved Permanently", - headers: { - location: { value: "https://${RootWebDomain}/auth" + uri }, - }, - }; - } - - return request; - } - FunctionConfig: - Comment: "Redirect the request from a sub-domain CloudFront Distribution to the root one" - Runtime: cloudfront-js-1.0 - Name: !Sub "${AWS::StackName}-RedirectSubDomainRequest" - # Alarms TooManyRequestsAlarm: Type: AWS::CloudWatch::Alarm @@ -767,7 +683,7 @@ Outputs: DistributionId: Description: Cloudfront distribution ID Value: !Ref WebsiteCDN - + TooManyErrorsAlarmArn: Value: !GetAtt TooManyErrorsAlarm.Arn Description: ARN of distribution too many errors alarm diff --git a/lerna.json b/lerna.json index bc56d99465..281e05882d 100644 --- a/lerna.json +++ b/lerna.json @@ -2,7 +2,7 @@ "packages": [ "packages/*" ], - "version": "2.3.0", + "version": "2.2.4", "npmClient": "yarn", "useWorkspaces": true, "command": { diff --git a/package.json b/package.json index df9545f755..d5df8f2387 100644 --- a/package.json +++ b/package.json @@ -2,14 +2,15 @@ "name": "send-monorepo", "private": true, "devDependencies": { + "@craco/craco": "^7.0.0", "lerna": "^6.4.1" }, "scripts": { "postinstall": "lerna bootstrap", - "start:pa": "lerna exec --scope @pagopa-pn/pn-pa-webapp -- yarn dev", - "start:pf": "lerna exec --scope @pagopa-pn/pn-personafisica-webapp -- yarn dev", - "start:pg": "lerna exec --scope @pagopa-pn/pn-personagiuridica-webapp -- yarn dev", - "start:login": "lerna exec --scope @pagopa-pn/pn-personafisica-login -- yarn dev", + "start:pa": "lerna exec --scope @pagopa-pn/pn-pa-webapp -- yarn start", + "start:pf": "lerna exec --scope @pagopa-pn/pn-personafisica-webapp -- yarn start", + "start:pg": "lerna exec --scope @pagopa-pn/pn-personagiuridica-webapp -- yarn start", + "start:login": "lerna exec --scope @pagopa-pn/pn-personafisica-login -- yarn start", "build:pa": "lerna run build --include-dependencies --scope @pagopa-pn/pn-pa-webapp --scope @pagopa-pn/pn-commons", "build:pf": "lerna run build --include-dependencies --scope @pagopa-pn/pn-personafisica-webapp --scope @pagopa-pn/pn-commons --scope @pagopa-pn/pn-validator", "build:pg": "lerna run build --include-dependencies --scope @pagopa-pn/pn-personagiuridica-webapp --scope @pagopa-pn/pn-commons --scope @pagopa-pn/pn-validator", @@ -26,7 +27,21 @@ "packages/**" ] }, + "dependencies": { + "@types/node": "*", + "autoprefixer": "^10.0.2", + "postcss": "^8.1.0", + "react": "17.0.2", + "typescript": "^5.2.2" + }, "resolutions": { - "**/tsconfig-paths": "^4.1.2" + "**/@svgr/webpack": "^6.5.1", + "**/tsconfig-paths": "^4.1.2", + "**/file-loader/loader-utils": "^2.0.4", + "**/react-scripts/react-dev-utils/loader-utils": "^3.2.1", + "**/recursive-readdir": "^2.2.3", + "**/terser": "^5.16.1", + "**/react-scripts/react-dev-utils/fork-ts-checker-webpack-plugin": "6.5.3", + "**/@babel/traverse": "^7.23.2" } } diff --git a/packages/pn-commons/.gitignore b/packages/pn-commons/.gitignore index bb6b5d1104..342f582f32 100644 --- a/packages/pn-commons/.gitignore +++ b/packages/pn-commons/.gitignore @@ -15,6 +15,7 @@ test-report.xml # production /build /dist +/lib # misc .DS_Store diff --git a/packages/pn-commons/CHANGELOG.md b/packages/pn-commons/CHANGELOG.md index 9ec4f798ba..51d577b3aa 100644 --- a/packages/pn-commons/CHANGELOG.md +++ b/packages/pn-commons/CHANGELOG.md @@ -3,33 +3,6 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. -# [2.3.0](https://github.com/pagopa/pn-frontend/compare/v2.3.0-RC.2...v2.3.0) (2024-01-25) - -**Note:** Version bump only for package @pagopa-pn/pn-commons - - - - - -# [2.3.0-RC.2](https://github.com/pagopa/pn-frontend/compare/v2.3.0-RC.1...v2.3.0-RC.2) (2024-01-24) - - -### Bug Fixes - -* **pn-9624:** updated vitest config for coverage analysis ([#1115](https://github.com/pagopa/pn-frontend/issues/1115)) ([c940dd9](https://github.com/pagopa/pn-frontend/commit/c940dd9f3be6b78f5c2ef0df0e9628caf05d245a)) - - - - - -# [2.3.0-RC.1](https://github.com/pagopa/pn-frontend/compare/v2.3.0-RC.0...v2.3.0-RC.1) (2024-01-19) - -**Note:** Version bump only for package @pagopa-pn/pn-commons - - - - - ## [2.2.4](https://github.com/pagopa/pn-frontend/compare/v2.2.4-RC.0...v2.2.4) (2024-01-12) **Note:** Version bump only for package @pagopa-pn/pn-commons diff --git a/packages/pn-commons/babel.config.js b/packages/pn-commons/babel.config.js deleted file mode 100644 index 43c5343b9f..0000000000 --- a/packages/pn-commons/babel.config.js +++ /dev/null @@ -1,23 +0,0 @@ -module.exports = { - presets: [ - '@babel/preset-env', - '@babel/preset-typescript', - [ - '@babel/preset-react', - { - runtime: 'automatic', - }, - ], - ], - plugins: [ - function () { - return { - visitor: { - MetaProperty(path) { - path.replaceWithSourceString('process') - }, - }, - } - }, - ] -}; diff --git a/packages/pn-commons/package.json b/packages/pn-commons/package.json index a56b4c8092..2c2b9ee8b1 100644 --- a/packages/pn-commons/package.json +++ b/packages/pn-commons/package.json @@ -1,43 +1,43 @@ { "name": "@pagopa-pn/pn-commons", - "version": "2.3.0", + "version": "2.2.4", "private": true, "main": "./src/index.ts", "dependencies": { "@date-io/date-fns": "^2.15.0", - "@mui/icons-material": "^5.14.3", - "@mui/lab": "^5.0.0-alpha.140", - "@mui/material": "^5.14.5", - "@mui/system": "^5.14.5", - "@mui/x-date-pickers": "^6.10.1", - "@pagopa/mui-italia": "^1.1.0", - "@reduxjs/toolkit": "^1.9.5", - "@types/node": "^17.0.8", - "@types/react": "^18.2.24", - "@types/react-dom": "^18.2.8", - "date-fns": "^2.30.0", - "mixpanel-browser": "^2.45.0", - "react": "^18.2.0", - "react-dom": "^18.2.0", - "react-redux": "^8.1.3", + "@mui/icons-material": "5.11.11", + "@mui/lab": "5.0.0-alpha.100", + "@mui/material": "5.10.9", + "@mui/system": "5.10.8", + "@mui/x-date-pickers": "5.0.13", + "@octokit/core": "^4.1.0", + "@reduxjs/toolkit": "^1.7.1", + "@types/node": "^16.11.21", + "@types/react": "^17.0.38", + "@types/react-dom": "^17.0.11", + "autoprefixer": "^10.0.2", + "postcss": "^8.1.0", + "react": "^17.0.2", + "react-dom": "^17.0.2", "typescript": "^5.2.2", - "web-vitals": "^2.1.4", - "yup": "^0.32.11" + "web-vitals": "^2.1.4" }, "scripts": { - "build": "tsc -p tsconfig.prod.json", - "test": "tsc --noEmit && vitest --run", - "test:fast": "vitest --run", - "test:a11y": "vitest --run --config ./vite.config.a11y.ts", - "test:all": "vitest --run --config ./vite.config.all.ts", - "test:coverage": "tsc --noEmit && vitest run --coverage", + "start": "tsc -w --sourceMap=true", + "build": "tsc", + "test": "tsc && react-scripts test --watchAll=false --testPathIgnorePatterns=\"\\.a11y\\.test\\.(tsx|ts)$\"", + "test:a11y": "react-scripts test --watchAll=false --testPathPattern=\"\\.a11y\\.test\\.(tsx|ts)$\"", + "test:all": "react-script test --watchAll=false", + "test:coverage": "tsc && react-scripts test --watchAll=false --ci --coverage --testResultsProcessor=jest-sonar-reporter --testPathIgnorePatterns=\"\\.a11y\\.test\\.(tsx|ts)$\" --coveragePathIgnorePatterns=\"\\.a11y\\.test\\.(tsx|ts)$|.src.types|.src.assets\"", + "eject": "react-scripts eject", "lint": "eslint . -c .eslintrc.js --ext .ts,.tsx --fix", "format": "prettier \"./**/*.{ts,tsx}\" --write", "sonar": "node sonarqube-scanner.js" }, "eslintConfig": { "extends": [ - "react-app" + "react-app", + "react-app/jest" ] }, "browserslist": { @@ -54,18 +54,15 @@ }, "devDependencies": { "@babel/core": "^7.23.2", - "@babel/preset-env": "^7.23.2", - "@babel/preset-react": "^7.23.2", - "@babel/preset-typescript": "^7.23.2", - "@testing-library/jest-dom": "^5.17.0", - "@testing-library/react": "^14.0.0", - "@testing-library/user-event": "^14.5.1", - "@trivago/prettier-plugin-sort-imports": "^4.3.0", + "@testing-library/jest-dom": "^5.16.1", + "@testing-library/react": "^12.1.2", + "@testing-library/react-hooks": "^8.0.1", + "@testing-library/user-event": "^13.5.0", + "@trivago/prettier-plugin-sort-imports": "^4.2.0", "@types/css-mediaquery": "^0.1.1", + "@types/jest": "^27.4.0", "@typescript-eslint/eslint-plugin": "^6.7.3", "@typescript-eslint/parser": "^6.7.3", - "@vitejs/plugin-react": "~4.1.1", - "@vitest/coverage-v8": "0.34.6", "css-mediaquery": "^0.1.2", "eslint": "7.11.0", "eslint-config-prettier": "^8.3.0", @@ -74,11 +71,16 @@ "eslint-plugin-react": "^7.27.1", "eslint-plugin-react-hooks": "^4.3.0", "eslint-plugin-sonarjs": "^0.10.0", - "jsdom": "^16.7.0", + "jest-sonar-reporter": "^2.0.0", + "npm-run-all": "^4.1.5", "prettier": "^2.4.1", - "sonarqube-scanner": "^3.3.0", - "vite": "^4.5.0", - "vitest": "0.34.6", - "vitest-sonar-reporter": "0.5.0" + "react-scripts": "^5.0.1", + "rimraf": "^3.0.2", + "sonarqube-scanner": "^3.0.0" + }, + "jest": { + "moduleNameMapper": { + "^axios$": "axios/dist/browser/axios.cjs" + } } } diff --git a/packages/pn-commons/src/__mocks__/NotificationDetail.mock.ts b/packages/pn-commons/src/__mocks__/NotificationDetail.mock.ts index 08df860d2f..f762ebcc9a 100644 --- a/packages/pn-commons/src/__mocks__/NotificationDetail.mock.ts +++ b/packages/pn-commons/src/__mocks__/NotificationDetail.mock.ts @@ -12,19 +12,11 @@ import { NotificationFeePolicy, NotificationStatus, NotificationStatusHistory, - PaymentCache, - PaymentsData, PhysicalCommunicationType, RecipientType, TimelineCategory, } from '../models'; -import { - getF24Payments, - getPagoPaF24Payments, - parseNotificationDetail, - populatePaymentsPagoPaF24, -} from '../utility'; -import { paymentInfo } from './ExternalRegistry.mock'; +import { parseNotificationDetail } from '../utility'; function getOneRecipientNotification(): NotificationDetail { const oneRecipientNotification = _.cloneDeep(notificationDTOMultiRecipient); @@ -665,19 +657,3 @@ export const getTimelineElem = ( timestamp: '2023-08-25T11:38:05.392Z', details, }); - -export const paymentsData: PaymentsData = { - pagoPaF24: getPagoPaF24Payments(payments, 2), - f24Only: getF24Payments(payments, 2), -}; - -export const cachedPayments: PaymentCache = { - iun: notificationDTO.iun, - timestamp: new Date().toISOString(), - currentPaymentPage: 0, - payments: populatePaymentsPagoPaF24( - notificationDTO.timeline, - paymentsData.pagoPaF24, - paymentInfo - ), -}; diff --git a/packages/pn-commons/src/assets/question.svg b/packages/pn-commons/src/assets/question.svg deleted file mode 100644 index 09e0726793..0000000000 --- a/packages/pn-commons/src/assets/question.svg +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - - - - - - - - - - diff --git a/packages/pn-commons/src/components/ApiError/ApiError.tsx b/packages/pn-commons/src/components/ApiError/ApiError.tsx index 7718971a4b..bdb742767b 100644 --- a/packages/pn-commons/src/components/ApiError/ApiError.tsx +++ b/packages/pn-commons/src/components/ApiError/ApiError.tsx @@ -8,7 +8,6 @@ type ApiErrorProps = { mt?: number; mainText?: string; apiId?: string; - children?: React.ReactNode; }; const StyledStack = styled(Stack)` diff --git a/packages/pn-commons/src/components/ApiError/ApiErrorWrapper.tsx b/packages/pn-commons/src/components/ApiError/ApiErrorWrapper.tsx index 3f6b5000cd..ef5eb526f4 100644 --- a/packages/pn-commons/src/components/ApiError/ApiErrorWrapper.tsx +++ b/packages/pn-commons/src/components/ApiError/ApiErrorWrapper.tsx @@ -3,7 +3,6 @@ import ApiError from './ApiError'; interface ApiErrorWrapperCommonProps { apiId?: string; - children?: React.ReactNode; } interface ApiErrorWrapperProps extends ApiErrorWrapperCommonProps { diff --git a/packages/pn-commons/src/components/ApiError/__test__/ApiError.test.tsx b/packages/pn-commons/src/components/ApiError/__test__/ApiError.test.tsx index c33f4bd0a3..a568b476ff 100644 --- a/packages/pn-commons/src/components/ApiError/__test__/ApiError.test.tsx +++ b/packages/pn-commons/src/components/ApiError/__test__/ApiError.test.tsx @@ -1,51 +1,50 @@ -import { vi } from 'vitest'; - -import { fireEvent, render, screen } from '../../../test-utils'; +import React from 'react'; import ApiError from '../ApiError'; +import { render, screen, fireEvent } from '../../../test-utils'; describe('ApiError', () => { - it('renders main text and action text correctly', () => { - const mainText = 'Custom error message'; - const actionText = 'Ricarica'; + it('renders main text and action text correctly', () => { + const mainText = 'Custom error message'; + const actionText = 'Ricarica'; - render(); + render(); - const mainTextElement = screen.getByText(mainText); - const actionTextElement = screen.getByText(actionText); + const mainTextElement = screen.getByText(mainText); + const actionTextElement = screen.getByText(actionText); - expect(mainTextElement).toBeInTheDocument(); - expect(actionTextElement).toBeInTheDocument(); - }); + expect(mainTextElement).toBeInTheDocument(); + expect(actionTextElement).toBeInTheDocument(); + }); - it('calls onClick callback when action text is clicked', () => { - const onClickMock = vi.fn(); + it('calls onClick callback when action text is clicked', () => { + const onClickMock = jest.fn(); - render(); + render(); - const actionTextElement = screen.getByText('Ricarica'); + const actionTextElement = screen.getByText('Ricarica'); - fireEvent.click(actionTextElement); + fireEvent.click(actionTextElement); - expect(onClickMock).toHaveBeenCalledTimes(1); - }); + expect(onClickMock).toHaveBeenCalledTimes(1); + }); - it('uses default main text when not provided', () => { - render(); + it('uses default main text when not provided', () => { + render(); - const defaultMainText = 'Non siamo riusciti a recuperare questi dati.'; + const defaultMainText = 'Non siamo riusciti a recuperare questi dati.'; - const mainTextElement = screen.getByText(defaultMainText); + const mainTextElement = screen.getByText(defaultMainText); - expect(mainTextElement).toBeInTheDocument(); - }); + expect(mainTextElement).toBeInTheDocument(); + }); - it('renders with custom apiId', () => { - const apiId = 'customApiId'; + it('renders with custom apiId', () => { + const apiId = 'customApiId'; - render(); + render(); - const apiErrorElement = screen.getByTestId(`api-error-${apiId}`); + const apiErrorElement = screen.getByTestId(`api-error-${apiId}`); - expect(apiErrorElement).toBeInTheDocument(); - }); + expect(apiErrorElement).toBeInTheDocument(); + }); }); diff --git a/packages/pn-commons/src/components/ApiError/__test__/ApiErrorWrapper.test.tsx b/packages/pn-commons/src/components/ApiError/__test__/ApiErrorWrapper.test.tsx index 1a79755dec..c7e6eb5414 100644 --- a/packages/pn-commons/src/components/ApiError/__test__/ApiErrorWrapper.test.tsx +++ b/packages/pn-commons/src/components/ApiError/__test__/ApiErrorWrapper.test.tsx @@ -1,92 +1,94 @@ -import { vi } from 'vitest'; - +import React from 'react'; import userEvent from '@testing-library/user-event'; - -import { render, screen, waitFor } from '../../../test-utils'; import ApiErrorWrapper from '../ApiErrorWrapper'; +import { render, screen, waitFor } from '../../../test-utils'; const mockApiError = 'mockApiId'; // Mocking the useErrors hook, since the hook is already tested -vi.mock('../../../hooks', () => ({ - useErrors: () => ({ - hasApiErrors: (apiId: string) => apiId === mockApiError, // Mocking hasApiErrors function - }), +jest.mock('../../../hooks', () => ({ + useErrors: () => ({ + hasApiErrors: (apiId) => apiId === mockApiError, // Mocking hasApiErrors function + }), })); describe('ApiErrorWrapper', () => { - const original = window.location; - const reloadText = 'Ricarica'; + const original = window.location; + const reloadText = 'Ricarica'; + + beforeAll(() => { + Object.defineProperty(window, 'location', { + configurable: true, + value: { reload: jest.fn() }, + }); + }); + + + afterAll(() => { + Object.defineProperty(window, 'location', { configurable: true, value: original }); + }); + + + it('mocks reload function', () => { + expect(jest.isMockFunction(window.location.reload)).toBe(true); + }); + + it('renders children when there are no API errors', () => { + render( + +
Child Content
+
+ ); - beforeAll(() => { - Object.defineProperty(window, 'location', { - configurable: true, - value: { reload: vi.fn() }, + const childElement = screen.getByTestId('child-element'); + expect(childElement).toBeInTheDocument(); }); - }); - - afterAll(() => { - Object.defineProperty(window, 'location', { configurable: true, value: original }); - }); - - it('mocks reload function', () => { - expect(vi.isMockFunction(window.location.reload)).toBe(true); - }); - - it('renders children when there are no API errors', () => { - render( - -
Child Content
-
- ); - - const childElement = screen.getByTestId('child-element'); - expect(childElement).toBeInTheDocument(); - }); - - it('renders errorComponent when there are API errors', () => { - const errorText = 'Error Text'; - render( - -
Child content
-
- ); - - const errorComponent = screen.getByTestId(`api-error-${mockApiError}`); - expect(errorComponent).toBeInTheDocument(); - expect(errorComponent).toHaveTextContent(errorText); - }); - - it('calls reloadAction when errorComponent is clicked and if a reloadAcion is specified', async () => { - const reloadActionMock = vi.fn(); - - render( - -
Child content
-
- ); - - const reloadItemComponent = screen.getByText(reloadText); - expect(reloadItemComponent).toBeInTheDocument(); - await userEvent.click(reloadItemComponent); - - await waitFor(() => { - expect(reloadActionMock).toHaveBeenCalled(); + + it('renders errorComponent when there are API errors', () => { + const errorText = "Error Text"; + render( + +
Child content
+
+ ); + + const errorComponent = screen.getByTestId(`api-error-${mockApiError}`); + expect(errorComponent).toBeInTheDocument(); + expect(errorComponent).toHaveTextContent(errorText); + }); + + it('calls reloadAction when errorComponent is clicked and if a reloadAcion is specified', async () => { + const reloadActionMock = jest.fn(); + + render( + +
Child content
+
+ ); + + const reloadItemComponent = screen.getByText(reloadText); + expect(reloadItemComponent).toBeInTheDocument(); + userEvent.click(reloadItemComponent); + + await waitFor(() => { + expect(reloadActionMock).toHaveBeenCalled(); + }); + }); - }); - it('calls reloadAction when errorComponent is clicked - no reloadAction Defined ', async () => { - render( - -
Child content
-
- ); + it('calls reloadAction when errorComponent is clicked - no reloadAction Defined ', async () => { + render( + +
Child content
+
+ ); + + const reloadItemComponent = screen.getByText(reloadText); + expect(reloadItemComponent).toBeInTheDocument(); + userEvent.click(reloadItemComponent); - const reloadItemComponent = screen.getByText(reloadText); - expect(reloadItemComponent).toBeInTheDocument(); - await userEvent.click(reloadItemComponent); + await waitFor(() => { + expect(window.location.reload).toHaveBeenCalled(); + }); - await waitFor(() => { - expect(window.location.reload).toHaveBeenCalled(); }); - }); }); diff --git a/packages/pn-commons/src/components/AppStatus/AppStatusBar.tsx b/packages/pn-commons/src/components/AppStatus/AppStatusBar.tsx index 4d3bb7e46b..c390b87b2f 100644 --- a/packages/pn-commons/src/components/AppStatus/AppStatusBar.tsx +++ b/packages/pn-commons/src/components/AppStatus/AppStatusBar.tsx @@ -28,7 +28,6 @@ export const AppStatusBar = ({ status }: { status: AppCurrentStatus }) => { { > {currentStatus && } {currentStatus && ( - + { - const original = await vi.importActual('@mui/material'); +jest.mock('@mui/material', () => { + const original = jest.requireActual('@mui/material'); return { ...original, useTheme: () => ({ diff --git a/packages/pn-commons/src/components/AppStatus/__test__/AppStatusRender.test.tsx b/packages/pn-commons/src/components/AppStatus/__test__/AppStatusRender.test.tsx index f006516f9b..979978bdf4 100644 --- a/packages/pn-commons/src/components/AppStatus/__test__/AppStatusRender.test.tsx +++ b/packages/pn-commons/src/components/AppStatus/__test__/AppStatusRender.test.tsx @@ -1,4 +1,4 @@ -import { vi } from 'vitest'; +import React from 'react'; import { exampleDowntimeLogPage } from '../../../__mocks__/AppStatus.mock'; import { KnownFunctionality } from '../../../models'; @@ -37,12 +37,12 @@ const mockAppStatus: AppStatusData = { describe('AppStatusRender component', () => { let result: RenderResult; const original = window.matchMedia; - const clearLegalFactDocument = vi.fn(); - const clearPagination = vi.fn(); - const fetchCurrentStatus = vi.fn(); - const fetchDowntimeLegalFactDocumentDetails = vi.fn(); - const fetchDowntimeLogPage = vi.fn(); - const setPagination = vi.fn(); + const clearLegalFactDocument = jest.fn(); + const clearPagination = jest.fn(); + const fetchCurrentStatus = jest.fn(); + const fetchDowntimeLegalFactDocumentDetails = jest.fn(); + const fetchDowntimeLogPage = jest.fn(); + const setPagination = jest.fn(); beforeAll(() => { initLocalizationForTest(); @@ -50,7 +50,7 @@ describe('AppStatusRender component', () => { afterEach(() => { window.matchMedia = original; - vi.clearAllMocks(); + jest.clearAllMocks(); }); it('empty downtime list', async () => { diff --git a/packages/pn-commons/src/components/AppStatus/__test__/DesktopDowntimeLog.test.tsx b/packages/pn-commons/src/components/AppStatus/__test__/DesktopDowntimeLog.test.tsx index 83b6be1b2e..50289db446 100644 --- a/packages/pn-commons/src/components/AppStatus/__test__/DesktopDowntimeLog.test.tsx +++ b/packages/pn-commons/src/components/AppStatus/__test__/DesktopDowntimeLog.test.tsx @@ -1,4 +1,4 @@ -import { vi } from 'vitest'; +import React from 'react'; import { exampleDowntimeLogPage } from '../../../__mocks__/AppStatus.mock'; import { DowntimeStatus, KnownFunctionality } from '../../../models'; @@ -17,7 +17,7 @@ import DesktopDowntimeLog from '../DesktopDowntimeLog'; const columns = ['startDate', 'endDate', 'functionality', 'legalFactId', 'status']; -const checkDateField = (date: string | undefined, column: HTMLElement) => { +const checkDateField = (date: string, column: HTMLElement) => { const text = date ? `${formatDate(date)},${formatTimeWithLegend(date)}` : '-'; expect(column).toHaveTextContent(text); }; @@ -59,7 +59,7 @@ const checkStatusField = (status: DowntimeStatus, column: HTMLElement) => { describe('DesktopDowntimeLog component', () => { let result: RenderResult; - const getLegalFactDetailsMock = vi.fn(); + const getLegalFactDetailsMock = jest.fn(); beforeAll(() => { initLocalizationForTest(); @@ -88,7 +88,7 @@ describe('DesktopDowntimeLog component', () => { const currentLog = exampleDowntimeLogPage.downtimes[index]; dataColumns.forEach((column, jindex) => { if (columns[jindex] === 'startDate' || columns[jindex] === 'endDate') { - checkDateField(currentLog[columns[jindex] as 'startDate' | 'endDate'], column); + checkDateField(currentLog[columns[jindex]], column); } if (columns[jindex] === 'functionality') { checkFunctionalityField( diff --git a/packages/pn-commons/src/components/AppStatus/__test__/DowntimeLogDataSwitch.test.tsx b/packages/pn-commons/src/components/AppStatus/__test__/DowntimeLogDataSwitch.test.tsx index e39344481c..34f1de7803 100644 --- a/packages/pn-commons/src/components/AppStatus/__test__/DowntimeLogDataSwitch.test.tsx +++ b/packages/pn-commons/src/components/AppStatus/__test__/DowntimeLogDataSwitch.test.tsx @@ -1,4 +1,4 @@ -import { vi } from 'vitest'; +import React from 'react'; import { exampleDowntimeLogPage } from '../../../__mocks__/AppStatus.mock'; import { fireEvent, initLocalizationForTest, render } from '../../../test-utils'; @@ -112,7 +112,7 @@ describe('DowntimeLogDataSwitch Component', () => { id: '0', ...exampleDowntimeLogPage.downtimes.find((d) => d.fileAvailable)!, }; - const getDowntimeLegalFactDocumentDetailsMock = vi.fn(); + const getDowntimeLegalFactDocumentDetailsMock = jest.fn(); const { container, getByTestId } = render( { }); }; -const checkDateField = (date: string | undefined, cardElem: HTMLElement) => { +const checkDateField = (date: string, cardElem: HTMLElement) => { const text = date ? `${formatDate(date)}, ${formatTimeWithLegend(date)}` : '-'; expect(cardElem).toHaveTextContent(text); }; @@ -59,7 +59,7 @@ const checkLegalFactField = ( describe('MobileDowntimeLog component', () => { let result: RenderResult; - const getLegalFactDetailsMock = vi.fn(); + const getLegalFactDetailsMock = jest.fn(); beforeAll(() => { initLocalizationForTest(); @@ -88,10 +88,7 @@ describe('MobileDowntimeLog component', () => { cardBodyLabel.forEach((label, jindex) => { expect(label).toHaveTextContent(`appStatus - downtimeList.columnHeader.${data[jindex]}`); if (data[jindex] === 'startDate' || data[jindex] === 'endDate') { - checkDateField( - currentLog[data[jindex] as 'startDate' | 'endDate'], - cardBodyValue[jindex] - ); + checkDateField(currentLog[data[jindex]], cardBodyValue[jindex]); } if (data[jindex] === 'functionality') { checkFunctionalityField( diff --git a/packages/pn-commons/src/components/CodeModal/CodeModal.tsx b/packages/pn-commons/src/components/CodeModal/CodeModal.tsx index f1594f8083..8bc3dbb137 100644 --- a/packages/pn-commons/src/components/CodeModal/CodeModal.tsx +++ b/packages/pn-commons/src/components/CodeModal/CodeModal.tsx @@ -1,10 +1,13 @@ -import { ReactNode, memo, useCallback, useState } from 'react'; +import { ReactNode, memo, useCallback, useMemo, useState } from 'react'; import { Alert, AlertTitle, Box, Button, + Dialog, + DialogActions, + DialogContent, DialogContentText, DialogTitle, Divider, @@ -12,10 +15,8 @@ import { } from '@mui/material'; import { CopyToClipboardButton } from '@pagopa/mui-italia'; +import { useIsMobile } from '../../hooks'; import { getLocalizedOrDefaultLabel } from '../../utility/localization.utility'; -import PnDialog from '../PnDialog/PnDialog'; -import PnDialogActions from '../PnDialog/PnDialogActions'; -import PnDialogContent from '../PnDialog/PnDialogContent'; import CodeInput from './CodeInput'; type Props = { @@ -68,6 +69,8 @@ const CodeModal = memo( errorMessage, }: Props) => { const [code, setCode] = useState(initialValues); + const isMobile = useIsMobile(); + const textPosition = useMemo(() => (isMobile ? 'center' : 'left'), [isMobile]); const codeIsValid = code.every((v) => v); const changeHandler = useCallback((inputsValues: Array) => { @@ -82,7 +85,7 @@ const CodeModal = memo( }; return ( - - {title} - - {subtitle} - - + + {title} + + + + {subtitle} + + + {codeSectionTitle} - + )} - {codeSectionAdditional && {codeSectionAdditional}} + {codeSectionAdditional} + {hasError && ( - - - {errorTitle} - + + {errorTitle} {errorMessage} )} - - + + {cancelLabel && cancelCallback && ( @@ -146,12 +167,13 @@ const CodeModal = memo( data-testid="codeConfirmButton" onClick={confirmHandler} disabled={!codeIsValid} + fullWidth={isMobile} > {confirmLabel} )} - - + + ); } ); diff --git a/packages/pn-commons/src/components/CodeModal/__test__/CodeInput.test.tsx b/packages/pn-commons/src/components/CodeModal/__test__/CodeInput.test.tsx index 22b2a185e8..ba424e3e9d 100644 --- a/packages/pn-commons/src/components/CodeModal/__test__/CodeInput.test.tsx +++ b/packages/pn-commons/src/components/CodeModal/__test__/CodeInput.test.tsx @@ -1,17 +1,13 @@ -import { vi } from 'vitest'; +import React from 'react'; import userEvent from '@testing-library/user-event'; -import { act, fireEvent, render, theme, waitFor } from '../../../test-utils'; +import { fireEvent, render, theme, waitFor } from '../../../test-utils'; import CodeInput from '../CodeInput'; -const handleChangeMock = vi.fn(); +const handleChangeMock = jest.fn(); describe('CodeInput Component', () => { - afterEach(() => { - vi.clearAllMocks(); - }); - it('renders CodeInput (empty inputs)', () => { // render component const { getAllByTestId } = render( @@ -86,24 +82,24 @@ describe('CodeInput Component', () => { }); // change the value of the input and check that it is updated correctly // set the cursor position to the end - act(() => (codeInputs[2] as HTMLInputElement).focus()); + (codeInputs[2] as HTMLInputElement).focus(); (codeInputs[2] as HTMLInputElement).setSelectionRange(1, 1); // when we try to edit an input, we insert a second value and after, based on cursor position, we change the value // we must use userEvent because the keyboard event must trigger also the change event (fireEvent doesn't do that) - await userEvent.keyboard('4'); + userEvent.keyboard('4'); await waitFor(() => { expect(codeInputs[2]).toHaveValue('4'); }); // move the cursor at the start of the input and try to edit again - act(() => (codeInputs[2] as HTMLInputElement).focus()); + (codeInputs[2] as HTMLInputElement).focus(); (codeInputs[2] as HTMLInputElement).setSelectionRange(0, 0); - await userEvent.keyboard('3'); + userEvent.keyboard('3'); await waitFor(() => { expect(codeInputs[2]).toHaveValue('3'); }); // delete the value - act(() => (codeInputs[2] as HTMLInputElement).focus()); - await userEvent.keyboard('{Backspace}'); + (codeInputs[2] as HTMLInputElement).focus(); + userEvent.keyboard('[Backspace]'); await waitFor(() => { expect(codeInputs[2]).toHaveValue(''); }); @@ -111,12 +107,12 @@ describe('CodeInput Component', () => { it('keyboard events', async () => { // render component - const { getAllByTestId } = render( + const { getAllByTestId, container } = render( ); // focus on first input and moove to the next const codeInputs = getAllByTestId(/code-input-[0-4]/); - act(() => (codeInputs[0] as HTMLInputElement).focus()); + (codeInputs[0] as HTMLInputElement).focus(); // press enter fireEvent.keyDown(codeInputs[0], { key: 'Enter', code: 'Enter' }); await waitFor(() => { @@ -144,7 +140,7 @@ describe('CodeInput Component', () => { expect(document.body).toBe(document.activeElement); }); // focus on last input and moove back - act(() => (codeInputs[4] as HTMLInputElement).focus()); + (codeInputs[4] as HTMLInputElement).focus(); // press backspace fireEvent.keyDown(codeInputs[4], { key: 'Backspace', code: 'Backspace' }); await waitFor(() => { @@ -161,7 +157,7 @@ describe('CodeInput Component', () => { expect(codeInputs[1]).toBe(document.activeElement); }); // focus on first element and try to go back - act(() => (codeInputs[0] as HTMLInputElement).focus()); + (codeInputs[0] as HTMLInputElement).focus(); fireEvent.keyDown(codeInputs[0], { key: 'Backspace', code: 'Backspace' }); // nothing happens await waitFor(() => { diff --git a/packages/pn-commons/src/components/CodeModal/__test__/CodeModal.test.tsx b/packages/pn-commons/src/components/CodeModal/__test__/CodeModal.test.tsx index 1c741eb6ce..20f7afd35e 100644 --- a/packages/pn-commons/src/components/CodeModal/__test__/CodeModal.test.tsx +++ b/packages/pn-commons/src/components/CodeModal/__test__/CodeModal.test.tsx @@ -1,10 +1,10 @@ -import { vi } from 'vitest'; +import React from 'react'; import { fireEvent, render, screen, waitFor, within } from '../../../test-utils'; import CodeModal from '../CodeModal'; -const cancelButtonMock = vi.fn(); -const confirmButtonMock = vi.fn(); +const cancelButtonMock = jest.fn(); +const confirmButtonMock = jest.fn(); const openedModalComponent = ( open: boolean, @@ -34,7 +34,7 @@ describe('CodeModal Component', () => { beforeAll(() => { Object.assign(window.navigator, { clipboard: { - writeText: vi.fn().mockImplementation(() => Promise.resolve()), + writeText: jest.fn().mockImplementation(() => Promise.resolve()), }, }); }); diff --git a/packages/pn-commons/src/components/CustomDatePicker.tsx b/packages/pn-commons/src/components/CustomDatePicker.tsx index 20652ebceb..4e024721a1 100644 --- a/packages/pn-commons/src/components/CustomDatePicker.tsx +++ b/packages/pn-commons/src/components/CustomDatePicker.tsx @@ -19,7 +19,7 @@ const locales: { [key: string]: Locale } = { export type DatePickerTypes = Date | null; const CustomDatePicker = ( - props: DesktopDatePickerProps & + props: DesktopDatePickerProps & React.RefAttributes & { language?: string } ) => { const language = props.language ? props.language : 'it'; @@ -27,22 +27,42 @@ const CustomDatePicker = ( - view === 'year' - ? getLocalizedOrDefaultLabel('common', 'date-picker.switch-to-calendar') - : getLocalizedOrDefaultLabel('common', 'date-picker.switch-to-year'), - openDatePickerDialogue: (value, utils) => { - if (value instanceof Date && !isNaN(value.getTime())) { - const date = utils.format(utils.date(value), 'fullDate'); - return getLocalizedOrDefaultLabel('common', 'date-picker.date-selected', undefined, { + leftArrowButtonText={getLocalizedOrDefaultLabel( + 'common', + 'date-picker.left-arrow', + 'Vai al mese precedente' + )} // deprecated + rightArrowButtonText={getLocalizedOrDefaultLabel( + 'common', + 'date-picker.right-arrow', + 'Vai al mese successivo' + )} // deprecated + getViewSwitchingButtonText={(view) => + view === 'year' + ? getLocalizedOrDefaultLabel( + 'common', + 'date-picker.switch-to-calendar', + "modalità di scelta dell'anno attiva, passa alla modalità calendario" + ) + : getLocalizedOrDefaultLabel( + 'common', + 'date-picker.switch-to-year', + "modalità calendario attiva, passa alla modalità di scelta dell'anno" + ) + } + getOpenDialogAriaText={(value, utils) => { + if (value instanceof Date && !isNaN(value.getTime())) { + const date = utils.format(utils.date(value), 'fullDate'); + return getLocalizedOrDefaultLabel( + 'common', + 'date-picker.date-selected', + `Scegli data, la data selezionata è ${date}`, + { date, - }); - } - return getLocalizedOrDefaultLabel('common', 'date-picker.select-date'); - }, + } + ); + } + return getLocalizedOrDefaultLabel('common', 'date-picker.select-date', 'Scegli data'); }} // OpenPickerButtonProps={{ 'aria-label': 'Scegli data'}} // props for calendar button /> diff --git a/packages/pn-commons/src/components/CustomDropdown.tsx b/packages/pn-commons/src/components/CustomDropdown.tsx index 72bee4a8a0..d5589a3718 100644 --- a/packages/pn-commons/src/components/CustomDropdown.tsx +++ b/packages/pn-commons/src/components/CustomDropdown.tsx @@ -1,6 +1,5 @@ import { ChangeEvent, useEffect, useState } from 'react'; - -import { MenuItem, SxProps, TextField } from '@mui/material'; +import { TextField, SxProps, MenuItem } from '@mui/material'; type Props = { /** id */ @@ -35,8 +34,6 @@ type Props = { emptyItemKey?: string; /** map label string for empty item (default: '------') */ emptyItemLabel?: string; - /** dropdown items */ - children?: React.ReactNode; }; const CustomDropdown: React.FC = ({ diff --git a/packages/pn-commons/src/components/CustomMobileDialog/CustomMobileDialog.context.tsx b/packages/pn-commons/src/components/CustomMobileDialog/CustomMobileDialog.context.tsx index 84b4d4fb43..81112bc6a2 100644 --- a/packages/pn-commons/src/components/CustomMobileDialog/CustomMobileDialog.context.tsx +++ b/packages/pn-commons/src/components/CustomMobileDialog/CustomMobileDialog.context.tsx @@ -1,4 +1,4 @@ -import { FC, ReactNode, createContext, useContext, useState } from 'react'; +import { createContext, FC, ReactNode, useContext, useState } from 'react'; interface ICustomMobileDialogContext { open: boolean; @@ -7,7 +7,7 @@ interface ICustomMobileDialogContext { const CustomMobileDialogContext = createContext(undefined); -const CustomMobileDialogProvider: FC<{ children?: ReactNode }> = ({ children }) => { +const CustomMobileDialogProvider: FC = ({ children }) => { const [open, setOpen] = useState(false); const toggleOpen = () => { diff --git a/packages/pn-commons/src/components/CustomMobileDialog/CustomMobileDialog.tsx b/packages/pn-commons/src/components/CustomMobileDialog/CustomMobileDialog.tsx index 8654fb0010..60f6876fdc 100644 --- a/packages/pn-commons/src/components/CustomMobileDialog/CustomMobileDialog.tsx +++ b/packages/pn-commons/src/components/CustomMobileDialog/CustomMobileDialog.tsx @@ -3,7 +3,7 @@ import { CustomMobileDialogProvider } from './CustomMobileDialog.context'; /** * Container for mobile version of the dialog */ -const CustomMobileDialog: React.FC<{ children?: React.ReactNode }> = ({ children }) => ( +const CustomMobileDialog: React.FC = ({ children }) => ( {children} ); diff --git a/packages/pn-commons/src/components/CustomMobileDialog/CustomMobileDialogAction.tsx b/packages/pn-commons/src/components/CustomMobileDialog/CustomMobileDialogAction.tsx index f623894609..bce684e1dd 100644 --- a/packages/pn-commons/src/components/CustomMobileDialog/CustomMobileDialogAction.tsx +++ b/packages/pn-commons/src/components/CustomMobileDialog/CustomMobileDialogAction.tsx @@ -4,7 +4,6 @@ import { useCustomMobileDialogContext } from './CustomMobileDialog.context'; type Props = { closeOnClick?: boolean; - children?: React.ReactNode; }; /** diff --git a/packages/pn-commons/src/components/CustomMobileDialog/CustomMobileDialogToggle.tsx b/packages/pn-commons/src/components/CustomMobileDialog/CustomMobileDialogToggle.tsx index 7a2367b128..024402914a 100644 --- a/packages/pn-commons/src/components/CustomMobileDialog/CustomMobileDialogToggle.tsx +++ b/packages/pn-commons/src/components/CustomMobileDialog/CustomMobileDialogToggle.tsx @@ -7,7 +7,6 @@ type Props = { sx?: SxProps; hasCounterBadge?: boolean; bagdeCount?: number; - children?: React.ReactNode; }; const StyledBadge = styled(Badge)(({ theme }) => ({ diff --git a/packages/pn-commons/src/components/CustomMobileDialog/__test__/CustomMobileDialog.context.test.tsx b/packages/pn-commons/src/components/CustomMobileDialog/__test__/CustomMobileDialog.context.test.tsx index 010b79f5c9..0cb16d2713 100644 --- a/packages/pn-commons/src/components/CustomMobileDialog/__test__/CustomMobileDialog.context.test.tsx +++ b/packages/pn-commons/src/components/CustomMobileDialog/__test__/CustomMobileDialog.context.test.tsx @@ -1,4 +1,5 @@ import { ReactNode } from 'react'; +import React from 'react'; import { RenderResult, fireEvent, render, waitFor } from '../../../test-utils'; import { diff --git a/packages/pn-commons/src/components/CustomMobileDialog/__test__/CustomMobileDialog.test.tsx b/packages/pn-commons/src/components/CustomMobileDialog/__test__/CustomMobileDialog.test.tsx index a5dee3471e..13ef802052 100644 --- a/packages/pn-commons/src/components/CustomMobileDialog/__test__/CustomMobileDialog.test.tsx +++ b/packages/pn-commons/src/components/CustomMobileDialog/__test__/CustomMobileDialog.test.tsx @@ -1,3 +1,5 @@ +import React from 'react'; + import DialogActions from '@mui/material/DialogActions'; import DialogContent from '@mui/material/DialogContent'; diff --git a/packages/pn-commons/src/components/CustomMobileDialog/__test__/CustomMobileDialogAction.test.tsx b/packages/pn-commons/src/components/CustomMobileDialog/__test__/CustomMobileDialogAction.test.tsx index c13f459f7f..043aec53a0 100644 --- a/packages/pn-commons/src/components/CustomMobileDialog/__test__/CustomMobileDialogAction.test.tsx +++ b/packages/pn-commons/src/components/CustomMobileDialog/__test__/CustomMobileDialogAction.test.tsx @@ -1,3 +1,5 @@ +import React from 'react'; + import { fireEvent, render, screen, waitFor, within } from '../../../test-utils'; import CustomMobileDialog from '../CustomMobileDialog'; import CustomMobileDialogAction from '../CustomMobileDialogAction'; diff --git a/packages/pn-commons/src/components/CustomMobileDialog/__test__/CustomMobileDialogContent.test.tsx b/packages/pn-commons/src/components/CustomMobileDialog/__test__/CustomMobileDialogContent.test.tsx index 36ec531721..cd9759dd8f 100644 --- a/packages/pn-commons/src/components/CustomMobileDialog/__test__/CustomMobileDialogContent.test.tsx +++ b/packages/pn-commons/src/components/CustomMobileDialog/__test__/CustomMobileDialogContent.test.tsx @@ -1,3 +1,5 @@ +import React from 'react'; + import { fireEvent, render, screen, waitFor, within } from '../../../test-utils'; import CustomMobileDialog from '../CustomMobileDialog'; import CustomMobileDialogContent from '../CustomMobileDialogContent'; diff --git a/packages/pn-commons/src/components/CustomMobileDialog/__test__/CustomMobileDialogToggle.test.tsx b/packages/pn-commons/src/components/CustomMobileDialog/__test__/CustomMobileDialogToggle.test.tsx index 47e47cdf22..3b67776fbb 100644 --- a/packages/pn-commons/src/components/CustomMobileDialog/__test__/CustomMobileDialogToggle.test.tsx +++ b/packages/pn-commons/src/components/CustomMobileDialog/__test__/CustomMobileDialogToggle.test.tsx @@ -1,3 +1,5 @@ +import React from 'react'; + import { fireEvent, getById, queryById, render, screen, waitFor } from '../../../test-utils'; import CustomMobileDialog from '../CustomMobileDialog'; import CustomMobileDialogContent from '../CustomMobileDialogContent'; diff --git a/packages/pn-commons/src/components/CustomTagGroup/CustomTagGroup.tsx b/packages/pn-commons/src/components/CustomTagGroup/CustomTagGroup.tsx index 2768e5c66f..6aca0ded31 100644 --- a/packages/pn-commons/src/components/CustomTagGroup/CustomTagGroup.tsx +++ b/packages/pn-commons/src/components/CustomTagGroup/CustomTagGroup.tsx @@ -12,8 +12,6 @@ interface CustomTagGroupProps { disableTooltip?: boolean; /** callback function when tooltip is opened */ onOpen?: () => void; - /** tags list */ - children?: React.ReactNode; } const TagIndicator: React.FC<{ diff --git a/packages/pn-commons/src/components/CustomTagGroup/__test__/CustomTagGroup.test.tsx b/packages/pn-commons/src/components/CustomTagGroup/__test__/CustomTagGroup.test.tsx index 182a14ef9e..fef17241d7 100644 --- a/packages/pn-commons/src/components/CustomTagGroup/__test__/CustomTagGroup.test.tsx +++ b/packages/pn-commons/src/components/CustomTagGroup/__test__/CustomTagGroup.test.tsx @@ -1,4 +1,4 @@ -import { vi } from 'vitest'; +import React from 'react'; import { Box } from '@mui/material'; @@ -8,11 +8,7 @@ import CustomTagGroup from '../CustomTagGroup'; describe('CustomTagGroup component', () => { const tagsArray = ['mock-tag-1', 'mock-tag-2', 'mock-tag-3', 'mock-tag-4']; const tags = tagsArray.map((v, i) => {v}); - const mockCallbackFn = vi.fn(); - - beforeEach(() => { - vi.clearAllMocks(); - }); + const mockCallbackFn = jest.fn(); it('renders component with all tags', () => { const { container } = render({tags}); diff --git a/packages/pn-commons/src/components/Data/PnCard/__test__/PnCard.test.tsx b/packages/pn-commons/src/components/Data/PnCard/__test__/PnCard.test.tsx index f660c87013..f6cc66a608 100644 --- a/packages/pn-commons/src/components/Data/PnCard/__test__/PnCard.test.tsx +++ b/packages/pn-commons/src/components/Data/PnCard/__test__/PnCard.test.tsx @@ -1,3 +1,5 @@ +import React from 'react'; + import { Box } from '@mui/material'; import { disableConsoleLogging, render } from '../../../../test-utils'; diff --git a/packages/pn-commons/src/components/Data/PnCard/__test__/PnCardActions.test.tsx b/packages/pn-commons/src/components/Data/PnCard/__test__/PnCardActions.test.tsx index 699f853705..66b0044be7 100644 --- a/packages/pn-commons/src/components/Data/PnCard/__test__/PnCardActions.test.tsx +++ b/packages/pn-commons/src/components/Data/PnCard/__test__/PnCardActions.test.tsx @@ -1,3 +1,5 @@ +import React from 'react'; + import { Box } from '@mui/material'; import { render } from '../../../../test-utils'; diff --git a/packages/pn-commons/src/components/Data/PnCard/__test__/PnCardContactItem.test.tsx b/packages/pn-commons/src/components/Data/PnCard/__test__/PnCardContactItem.test.tsx index 15bc50e53e..0d4965748b 100644 --- a/packages/pn-commons/src/components/Data/PnCard/__test__/PnCardContactItem.test.tsx +++ b/packages/pn-commons/src/components/Data/PnCard/__test__/PnCardContactItem.test.tsx @@ -1,3 +1,5 @@ +import React from 'react'; + import { render } from '../../../../test-utils'; import PnCardContentItem from '../PnCardContentItem'; diff --git a/packages/pn-commons/src/components/Data/PnCard/__test__/PnCardContent.test.tsx b/packages/pn-commons/src/components/Data/PnCard/__test__/PnCardContent.test.tsx index f403ec1111..10bc703139 100644 --- a/packages/pn-commons/src/components/Data/PnCard/__test__/PnCardContent.test.tsx +++ b/packages/pn-commons/src/components/Data/PnCard/__test__/PnCardContent.test.tsx @@ -1,3 +1,5 @@ +import React from 'react'; + import { Box } from '@mui/material'; import { disableConsoleLogging, render } from '../../../../test-utils'; diff --git a/packages/pn-commons/src/components/Data/PnCard/__test__/PnCardHeader.test.tsx b/packages/pn-commons/src/components/Data/PnCard/__test__/PnCardHeader.test.tsx index d857758852..6653579136 100644 --- a/packages/pn-commons/src/components/Data/PnCard/__test__/PnCardHeader.test.tsx +++ b/packages/pn-commons/src/components/Data/PnCard/__test__/PnCardHeader.test.tsx @@ -1,3 +1,5 @@ +import React from 'react'; + import { Box } from '@mui/material'; import { Row } from '../../../../models'; diff --git a/packages/pn-commons/src/components/Data/PnCard/__test__/PnCardHeaderItem.test.tsx b/packages/pn-commons/src/components/Data/PnCard/__test__/PnCardHeaderItem.test.tsx index 468f9bc192..a8e82e3ef6 100644 --- a/packages/pn-commons/src/components/Data/PnCard/__test__/PnCardHeaderItem.test.tsx +++ b/packages/pn-commons/src/components/Data/PnCard/__test__/PnCardHeaderItem.test.tsx @@ -1,3 +1,5 @@ +import React from 'react'; + import { Row } from '../../../../models'; import { render } from '../../../../test-utils'; import PnCardHeaderItem from '../PnCardHeaderItem'; diff --git a/packages/pn-commons/src/components/Data/PnTable/__test__/PnTableBody.test.tsx b/packages/pn-commons/src/components/Data/PnTable/__test__/PnTableBody.test.tsx index 5cdaca4d8f..0bc87da293 100644 --- a/packages/pn-commons/src/components/Data/PnTable/__test__/PnTableBody.test.tsx +++ b/packages/pn-commons/src/components/Data/PnTable/__test__/PnTableBody.test.tsx @@ -1,3 +1,5 @@ +import React from 'react'; + import { Box } from '@mui/material'; import { disableConsoleLogging, render } from '../../../../test-utils'; diff --git a/packages/pn-commons/src/components/Data/PnTable/__test__/PnTableBodyCell.test.tsx b/packages/pn-commons/src/components/Data/PnTable/__test__/PnTableBodyCell.test.tsx index 93fa385e1b..56a8fe2318 100644 --- a/packages/pn-commons/src/components/Data/PnTable/__test__/PnTableBodyCell.test.tsx +++ b/packages/pn-commons/src/components/Data/PnTable/__test__/PnTableBodyCell.test.tsx @@ -1,4 +1,4 @@ -import { vi } from 'vitest'; +import React from 'react'; import { disableConsoleLogging, fireEvent, render } from '../../../../test-utils'; import PnTableBodyCell from '../PnTableBodyCell'; @@ -6,7 +6,7 @@ import PnTableBodyCell from '../PnTableBodyCell'; describe('PnTableBodyCell', () => { disableConsoleLogging('error'); - const mockFn = vi.fn(); + const mockFn = jest.fn(); it('render component', () => { const { container, queryByTestId } = render( diff --git a/packages/pn-commons/src/components/Data/PnTable/__test__/PnTableBodyRow.test.tsx b/packages/pn-commons/src/components/Data/PnTable/__test__/PnTableBodyRow.test.tsx index abbe639976..a325dbbc36 100644 --- a/packages/pn-commons/src/components/Data/PnTable/__test__/PnTableBodyRow.test.tsx +++ b/packages/pn-commons/src/components/Data/PnTable/__test__/PnTableBodyRow.test.tsx @@ -1,3 +1,5 @@ +import React from 'react'; + import { Box } from '@mui/material'; import { disableConsoleLogging, render } from '../../../../test-utils'; diff --git a/packages/pn-commons/src/components/Data/PnTable/__test__/PnTableHeader.test.tsx b/packages/pn-commons/src/components/Data/PnTable/__test__/PnTableHeader.test.tsx index a4f7fa6952..83974a0196 100644 --- a/packages/pn-commons/src/components/Data/PnTable/__test__/PnTableHeader.test.tsx +++ b/packages/pn-commons/src/components/Data/PnTable/__test__/PnTableHeader.test.tsx @@ -1,3 +1,5 @@ +import React from 'react'; + import { Box } from '@mui/material'; import { disableConsoleLogging, render } from '../../../../test-utils'; diff --git a/packages/pn-commons/src/components/Data/PnTable/__test__/PnTableHeaderCell.test.tsx b/packages/pn-commons/src/components/Data/PnTable/__test__/PnTableHeaderCell.test.tsx index 3a3ebc7b17..976796044d 100644 --- a/packages/pn-commons/src/components/Data/PnTable/__test__/PnTableHeaderCell.test.tsx +++ b/packages/pn-commons/src/components/Data/PnTable/__test__/PnTableHeaderCell.test.tsx @@ -1,4 +1,4 @@ -import { vi } from 'vitest'; +import React from 'react'; import { Sort } from '../../../../models'; import { disableConsoleLogging, fireEvent, render } from '../../../../test-utils'; @@ -7,7 +7,7 @@ import PnTableHeaderCell from '../PnTableHeaderCell'; describe('PnTableHeaderCell', () => { disableConsoleLogging('error'); - const mockFn = vi.fn(); + const mockFn = jest.fn(); type Item = { 'mock-column-id': string; diff --git a/packages/pn-commons/src/components/Data/SmartTable/SmartFilter.tsx b/packages/pn-commons/src/components/Data/SmartTable/SmartFilter.tsx index 9fae396360..ac66ce266a 100644 --- a/packages/pn-commons/src/components/Data/SmartTable/SmartFilter.tsx +++ b/packages/pn-commons/src/components/Data/SmartTable/SmartFilter.tsx @@ -2,6 +2,7 @@ import _ from 'lodash'; import { FormEvent, PropsWithChildren, useRef } from 'react'; import { Box, Button, DialogActions, DialogContent, Grid } from '@mui/material'; +import { makeStyles } from '@mui/styles'; import { useIsMobile } from '../../../hooks'; import { filtersApplied } from '../../../utility'; @@ -27,6 +28,13 @@ type Props = { initialValues: FormValues; }; +const useStyles = makeStyles({ + helperTextFormat: { + // Use existing space / prevents shifting content below field + alignItems: 'flex', + }, +}); + /** * SmartFilter show filter in desktop view and dialog in mobile view. */ @@ -41,6 +49,7 @@ const SmartFilter = ({ initialValues, }: PropsWithChildren>) => { const isMobile = useIsMobile(); + const classes = useStyles(); const currentFilters = useRef(formValues); const isPreviousSearch = _.isEqual(formValues, currentFilters.current); const filtersCount = filtersApplied(currentFilters.current, initialValues); @@ -108,7 +117,7 @@ const SmartFilter = ({ return (
- + {children} {confirmAction} diff --git a/packages/pn-commons/src/components/Data/SmartTable/__test__/SmartActions.test.tsx b/packages/pn-commons/src/components/Data/SmartTable/__test__/SmartActions.test.tsx index 13c0362504..4738b940e9 100644 --- a/packages/pn-commons/src/components/Data/SmartTable/__test__/SmartActions.test.tsx +++ b/packages/pn-commons/src/components/Data/SmartTable/__test__/SmartActions.test.tsx @@ -1,3 +1,5 @@ +import React from 'react'; + import { Box } from '@mui/material'; import { render } from '../../../../test-utils'; diff --git a/packages/pn-commons/src/components/Data/SmartTable/__test__/SmartBody.test.tsx b/packages/pn-commons/src/components/Data/SmartTable/__test__/SmartBody.test.tsx index 8d390416d8..a4dd9a2e1e 100644 --- a/packages/pn-commons/src/components/Data/SmartTable/__test__/SmartBody.test.tsx +++ b/packages/pn-commons/src/components/Data/SmartTable/__test__/SmartBody.test.tsx @@ -1,3 +1,5 @@ +import React from 'react'; + import { Box } from '@mui/material'; import { disableConsoleLogging, render } from '../../../../test-utils'; diff --git a/packages/pn-commons/src/components/Data/SmartTable/__test__/SmartBodyCell.test.tsx b/packages/pn-commons/src/components/Data/SmartTable/__test__/SmartBodyCell.test.tsx index e43668f310..e87f565058 100644 --- a/packages/pn-commons/src/components/Data/SmartTable/__test__/SmartBodyCell.test.tsx +++ b/packages/pn-commons/src/components/Data/SmartTable/__test__/SmartBodyCell.test.tsx @@ -1,3 +1,5 @@ +import React from 'react'; + import { render } from '../../../../test-utils'; import SmartBodyCell from '../SmartBodyCell'; diff --git a/packages/pn-commons/src/components/Data/SmartTable/__test__/SmartBodyRow.test.tsx b/packages/pn-commons/src/components/Data/SmartTable/__test__/SmartBodyRow.test.tsx index d5be93114e..2f36205ee0 100644 --- a/packages/pn-commons/src/components/Data/SmartTable/__test__/SmartBodyRow.test.tsx +++ b/packages/pn-commons/src/components/Data/SmartTable/__test__/SmartBodyRow.test.tsx @@ -1,3 +1,5 @@ +import React from 'react'; + import { Box } from '@mui/material'; import { disableConsoleLogging, render } from '../../../../test-utils'; diff --git a/packages/pn-commons/src/components/Data/SmartTable/__test__/SmartData.test.tsx b/packages/pn-commons/src/components/Data/SmartTable/__test__/SmartData.test.tsx index 31ae4c9236..63b5242e93 100644 --- a/packages/pn-commons/src/components/Data/SmartTable/__test__/SmartData.test.tsx +++ b/packages/pn-commons/src/components/Data/SmartTable/__test__/SmartData.test.tsx @@ -1,4 +1,4 @@ -import { vi } from 'vitest'; +import React from 'react'; import { Box } from '@mui/material'; @@ -18,9 +18,9 @@ import SmartData from '../SmartData'; import SmartHeader from '../SmartHeader'; import SmartHeaderCell from '../SmartHeaderCell'; -const handleSort = vi.fn(); -const handleColumnClick = vi.fn(); -const clickActionMockFn = vi.fn(); +const handleSort = jest.fn(); +const handleColumnClick = jest.fn(); +const clickActionMockFn = jest.fn(); type Item = { 'column-1': string; @@ -103,9 +103,9 @@ const RenderSmartData: React.FC<{ ))} - +
Mocked action - +
))} diff --git a/packages/pn-commons/src/components/Data/SmartTable/__test__/SmartFilter.test.tsx b/packages/pn-commons/src/components/Data/SmartTable/__test__/SmartFilter.test.tsx index ed3760bf7a..2e7bfc64a0 100644 --- a/packages/pn-commons/src/components/Data/SmartTable/__test__/SmartFilter.test.tsx +++ b/packages/pn-commons/src/components/Data/SmartTable/__test__/SmartFilter.test.tsx @@ -1,5 +1,4 @@ -import { useState } from 'react'; -import { vi } from 'vitest'; +import React from 'react'; import { createMatchMedia, @@ -11,12 +10,12 @@ import { } from '../../../../test-utils'; import SmartFilter from '../SmartFilter'; -const submitHandler = vi.fn(); -const cancelHandler = vi.fn(); +const submitHandler = jest.fn(); +const cancelHandler = jest.fn(); const ExampleForm = ({ inputUsername = '', inputEmail = '' }) => { - const [username, setUsername] = useState(inputUsername); - const [email, setEmail] = useState(inputEmail); + const [username, setUsername] = React.useState(inputUsername); + const [email, setEmail] = React.useState(inputEmail); return ( { - beforeEach(() => { - vi.clearAllMocks(); - }); - it('renders component', () => { const { getByTestId } = render( ( ))} - clickActionMockFn(data)} data-testid="mockedAction"> +
clickActionMockFn(data)} data-testid="mockedAction"> Mocked action - +
))} diff --git a/packages/pn-commons/src/components/Data/__test__/PnTable.test.tsx b/packages/pn-commons/src/components/Data/__test__/PnTable.test.tsx index 269e38c655..583b731127 100644 --- a/packages/pn-commons/src/components/Data/__test__/PnTable.test.tsx +++ b/packages/pn-commons/src/components/Data/__test__/PnTable.test.tsx @@ -1,4 +1,4 @@ -import { vi } from 'vitest'; +import React from 'react'; import { Box } from '@mui/material'; @@ -11,8 +11,8 @@ import PnTableBodyRow from '../PnTable/PnTableBodyRow'; import PnTableHeader from '../PnTable/PnTableHeader'; import PnTableHeaderCell from '../PnTable/PnTableHeaderCell'; -const handleSort = vi.fn(); -const handleColumnClick = vi.fn(); +const handleSort = jest.fn(); +const handleColumnClick = jest.fn(); type Item = { id: string; 'column-1': string; 'column-2': string; 'column-3': string }; diff --git a/packages/pn-commons/src/components/Data/__test__/SmartTable.test.tsx b/packages/pn-commons/src/components/Data/__test__/SmartTable.test.tsx index fe0738f87c..4e0b90b455 100644 --- a/packages/pn-commons/src/components/Data/__test__/SmartTable.test.tsx +++ b/packages/pn-commons/src/components/Data/__test__/SmartTable.test.tsx @@ -1,4 +1,4 @@ -import { vi } from 'vitest'; +import React from 'react'; import { Box } from '@mui/material'; @@ -13,9 +13,9 @@ import SmartFilter from '../SmartTable/SmartFilter'; import SmartHeader from '../SmartTable/SmartHeader'; import SmartHeaderCell from '../SmartTable/SmartHeaderCell'; -const handleSort = vi.fn(); -const handleColumnClick = vi.fn(); -const handleChangePagination = vi.fn(); +const handleSort = jest.fn(); +const handleColumnClick = jest.fn(); +const handleChangePagination = jest.fn(); type Item = { 'column-1': string; diff --git a/packages/pn-commons/src/components/DisclaimerModal.tsx b/packages/pn-commons/src/components/DisclaimerModal.tsx index b2985821b4..0be9daf44e 100644 --- a/packages/pn-commons/src/components/DisclaimerModal.tsx +++ b/packages/pn-commons/src/components/DisclaimerModal.tsx @@ -1,11 +1,18 @@ -import { useState } from 'react'; +import { useMemo, useState } from 'react'; -import { Box, Button, Checkbox, DialogTitle, FormControlLabel } from '@mui/material'; +import { + Box, + Button, + Checkbox, + Dialog, + DialogActions, + DialogContent, + DialogTitle, + FormControlLabel, +} from '@mui/material'; +import { useIsMobile } from '../hooks'; import { getLocalizedOrDefaultLabel } from '../utility/localization.utility'; -import PnDialog from './PnDialog/PnDialog'; -import PnDialogActions from './PnDialog/PnDialogActions'; -import PnDialogContent from './PnDialog/PnDialogContent'; type Props = { onConfirm: () => void; @@ -24,6 +31,8 @@ const DisclaimerModal: React.FC = ({ content, checkboxLabel, }) => { + const isMobile = useIsMobile(); + const textPosition = useMemo(() => (isMobile ? 'center' : 'left'), [isMobile]); const [checked, setChecked] = useState(false); const disabledConfirm = !checked && !!checkboxLabel; @@ -32,16 +41,15 @@ const DisclaimerModal: React.FC = ({ }; return ( - - {title && {title}} - + + {title && {title}} + {content && {content}} {checkboxLabel && ( - + = ({ /> )} - - + + - - + + ); }; diff --git a/packages/pn-commons/src/components/EmptyState.tsx b/packages/pn-commons/src/components/EmptyState.tsx index ea7595fb1a..21e63db192 100644 --- a/packages/pn-commons/src/components/EmptyState.tsx +++ b/packages/pn-commons/src/components/EmptyState.tsx @@ -5,7 +5,6 @@ import { KnownSentiment, iconForKnownSentiment } from '../models/EmptyState'; type Props = { sentimentIcon?: KnownSentiment | SvgIconComponent; - children?: React.ReactNode; }; const EmptyState: React.FC = ({ sentimentIcon = KnownSentiment.DISSATISFIED, children }) => { diff --git a/packages/pn-commons/src/components/ErrorBoundary.tsx b/packages/pn-commons/src/components/ErrorBoundary.tsx index 77ed52a409..056b05b3a3 100644 --- a/packages/pn-commons/src/components/ErrorBoundary.tsx +++ b/packages/pn-commons/src/components/ErrorBoundary.tsx @@ -7,9 +7,9 @@ import { getLocalizedOrDefaultLabel } from '../utility/localization.utility'; type Props = { sx?: SxProps; + printError?: boolean; eventTrackingCallback?: (error: Error, errorInfo: ErrorInfo) => void; eventTrackingCallbackRefreshPage?: () => void; - children?: React.ReactNode; }; type State = { hasError: boolean }; diff --git a/packages/pn-commons/src/components/Footer/Footer.tsx b/packages/pn-commons/src/components/Footer/Footer.tsx index d7578134ab..992c51798c 100644 --- a/packages/pn-commons/src/components/Footer/Footer.tsx +++ b/packages/pn-commons/src/components/Footer/Footer.tsx @@ -15,19 +15,9 @@ type Props = { loggedUser?: boolean; /** Enables the Terms of Service Link */ hasTermsOfService?: boolean; - /** Url to privacy policy page */ - privacyPolicyHref?: string; - /** Url to terms of service page */ - termsOfServiceHref?: string; }; -const Footer: React.FC = ({ - onLanguageChanged = () => {}, - loggedUser = false, - hasTermsOfService, - privacyPolicyHref, - termsOfServiceHref, -}) => { +const Footer = ({ onLanguageChanged = () => {}, loggedUser = false, hasTermsOfService }: Props) => { const [currentLangCode, setCurrentLangCode] = useState('it'); const localizedPagoPALink = pagoPALink(); const changeLanguageHandler = (langCode: LangCode) => { @@ -44,7 +34,7 @@ const Footer: React.FC = ({ }} legalInfo={companyLegalInfo()} postLoginLinks={postLoginLinks()} - preLoginLinks={preLoginLinks(hasTermsOfService, privacyPolicyHref, termsOfServiceHref)} + preLoginLinks={preLoginLinks(hasTermsOfService)} languages={LANGUAGES} onLanguageChanged={changeLanguageHandler} currentLangCode={currentLangCode} diff --git a/packages/pn-commons/src/components/Footer/__test__/Footer.test.tsx b/packages/pn-commons/src/components/Footer/__test__/Footer.test.tsx index 2303628fbf..3cdd845c54 100644 --- a/packages/pn-commons/src/components/Footer/__test__/Footer.test.tsx +++ b/packages/pn-commons/src/components/Footer/__test__/Footer.test.tsx @@ -1,12 +1,10 @@ -import { vi } from 'vitest'; - -import { Languages } from '@pagopa/mui-italia'; +import React from 'react'; import { fireEvent, render, screen } from '../../../test-utils'; import { LANGUAGES, pagoPALink, postLoginLinks } from '../../../utility/costants'; import Footer from '../Footer'; -const mockOpenFn = vi.fn(); +const mockOpenFn = jest.fn(); describe('Footer Component', () => { const original = window.open; @@ -24,26 +22,25 @@ describe('Footer Component', () => { it('renders footer', () => { // render component - const { getAllByRole, getByRole } = render(