From 00743fd5708ce4af62039ca7f6422bd22dbd747e Mon Sep 17 00:00:00 2001 From: Alice Di Rico <83651704+Ladirico@users.noreply.github.com> Date: Mon, 5 Feb 2024 10:12:55 +0100 Subject: [PATCH] fix: [IOPID-1436], [IOPID-1453] Delete helper button and header title on email validate screen and add logic to show support buttons in faq screen (#5484) ## Short description delete helper button and header title on email validate screen and add logic to show support buttons in faq screen. ## List of changes proposed in this pull request ### [IOPID-1436]: delete helper button and header title on email validate screen Delete header title and helper in validate/validated email screens.

| validate email | validated email | | - | - | | delete_header_validate_Email | delete_header_email_validated |

### How to test Run the application and execute the email validation flow ### [IOPID-1453]: add logic to show support buttons in faq screen Change logic to show support buttons. The buttons for requesting assistance are only shown if the user has the e-mail validated or if the user is not yet logged in with SPID/CIE. If the user has not validated the email, the buttons are not shown.

| not logged | logged with validated email | logged no validated email | | - | - | - | | visible_assistence_buttons_before_auth | visible_assistence_buttons | not_visible_assistence_buttons_email_not_validated |

### How to test Run the application with [this line commented](https://github.com/pagopa/io-app/blob/6c076a1fee25c0a0853644d63aa894ff26854aa3/ts/sagas/startup.ts#L492) in order to disable the blocks that do not allow you to continue in the app if you do not have a validated email [IOPID-1436]: https://pagopa.atlassian.net/browse/IOPID-1436?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ [IOPID-1453]: https://pagopa.atlassian.net/browse/IOPID-1453?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ --- .../NewRemindEmailValidationOverlay.tsx | 5 - .../components/ZendeskSupportComponent.tsx | 100 ++++++++++-------- ts/store/reducers/assistanceTools.ts | 13 +-- ts/utils/__tests__/supportAssistance.test.ts | 12 +-- ts/utils/supportAssistance.ts | 7 +- 5 files changed, 64 insertions(+), 73 deletions(-) diff --git a/ts/components/NewRemindEmailValidationOverlay.tsx b/ts/components/NewRemindEmailValidationOverlay.tsx index 504a705386b..8c2f931172b 100644 --- a/ts/components/NewRemindEmailValidationOverlay.tsx +++ b/ts/components/NewRemindEmailValidationOverlay.tsx @@ -213,11 +213,6 @@ const NewRemindEmailValidationOverlay = (props: Props) => { diff --git a/ts/features/zendesk/components/ZendeskSupportComponent.tsx b/ts/features/zendesk/components/ZendeskSupportComponent.tsx index 95816b08f05..3917b028915 100644 --- a/ts/features/zendesk/components/ZendeskSupportComponent.tsx +++ b/ts/features/zendesk/components/ZendeskSupportComponent.tsx @@ -18,7 +18,10 @@ import { IOStackNavigationProp } from "../../../navigation/params/AppParamsList"; import { useIOSelector } from "../../../store/hooks"; -import { profileSelector } from "../../../store/reducers/profile"; +import { + isProfileEmailValidatedSelector, + profileSelector +} from "../../../store/reducers/profile"; import { showToast } from "../../../utils/showToast"; import { openWebUrl } from "../../../utils/url"; import ZENDESK_ROUTES from "../navigation/routes"; @@ -48,6 +51,7 @@ const ZendeskSupportComponent = ({ const maybeProfile: O.Option = pot.toOption(profile); const zendeskRemoteConfig = useIOSelector(zendeskConfigSelector); const navigation = useNavigation>(); + const isEmailValidated = useIOSelector(isProfileEmailValidatedSelector); const handleContactSupportPress = React.useCallback( () => @@ -67,6 +71,8 @@ const ZendeskSupportComponent = ({ ] ); + const showRequestSupportButtons = isEmailValidated || !pot.isSome(profile); + return ( <>

{I18n.t("support.helpCenter.supportComponent.title")}

@@ -91,52 +97,56 @@ const ZendeskSupportComponent = ({ - { - void mixpanelTrack("ZENDESK_SHOW_TICKETS_STARTS"); - if (O.isNone(maybeProfile)) { - navigation.navigate(ZENDESK_ROUTES.MAIN, { - screen: ZENDESK_ROUTES.SEE_REPORTS_ROUTERS, - params: { - assistanceForPayment, - assistanceForCard, - assistanceForFci - } - }); - } else { - navigation.navigate(ZENDESK_ROUTES.MAIN, { - screen: ZENDESK_ROUTES.ASK_SEE_REPORTS_PERMISSIONS, - params: { - assistanceForPayment, - assistanceForCard, - assistanceForFci + {showRequestSupportButtons && ( + <> + { + void mixpanelTrack("ZENDESK_SHOW_TICKETS_STARTS"); + if (O.isNone(maybeProfile)) { + navigation.navigate(ZENDESK_ROUTES.MAIN, { + screen: ZENDESK_ROUTES.SEE_REPORTS_ROUTERS, + params: { + assistanceForPayment, + assistanceForCard, + assistanceForFci + } + }); + } else { + navigation.navigate(ZENDESK_ROUTES.MAIN, { + screen: ZENDESK_ROUTES.ASK_SEE_REPORTS_PERMISSIONS, + params: { + assistanceForPayment, + assistanceForCard, + assistanceForFci + } + }); } - }); - } - }} - style={{ - alignSelf: "stretch" - }} - disabled={false} - bordered={true} - testID={"showTicketsButton"} - > - - - + }} + style={{ + alignSelf: "stretch" + }} + disabled={false} + bordered={true} + testID={"showTicketsButton"} + > + + + - - - + + + + + )} ); }; diff --git a/ts/store/reducers/assistanceTools.ts b/ts/store/reducers/assistanceTools.ts index ec01f4826c8..f58e131b0b0 100644 --- a/ts/store/reducers/assistanceTools.ts +++ b/ts/store/reducers/assistanceTools.ts @@ -1,5 +1,4 @@ import { combineReducers } from "redux"; -import * as pot from "@pagopa/ts-commons/lib/pot"; import { createSelector } from "reselect"; import { Action } from "../actions/types"; import zendeskReducer, { @@ -10,7 +9,6 @@ import { canShowHelp } from "../../utils/supportAssistance"; import { assistanceToolConfigSelector } from "./backendStatus"; -import { isProfileEmailValidatedSelector, profileSelector } from "./profile"; export type AssistanceToolsState = { zendesk: ZendeskState; @@ -21,17 +19,12 @@ const assistanceToolsReducer = combineReducers({ }); // This selector contains the logic to show or not the help button: -// if remote FF is zendesk + ff local + the profile is not potSome or the email is validated +// if remote FF is zendesk + ff local export const canShowHelpSelector = createSelector( assistanceToolConfigSelector, - profileSelector, - isProfileEmailValidatedSelector, - (assistanceToolConfig, profile, isProfileEmailValidated): boolean => { + (assistanceToolConfig): boolean => { const remoteTool = assistanceToolRemoteConfig(assistanceToolConfig); - return canShowHelp( - remoteTool, - !pot.isSome(profile) || isProfileEmailValidated - ); + return canShowHelp(remoteTool); } ); diff --git a/ts/utils/__tests__/supportAssistance.test.ts b/ts/utils/__tests__/supportAssistance.test.ts index ed6499c7d13..f26b926ada1 100644 --- a/ts/utils/__tests__/supportAssistance.test.ts +++ b/ts/utils/__tests__/supportAssistance.test.ts @@ -29,16 +29,12 @@ describe("anonymousAssistanceAddress", () => { describe("canShowHelp", () => { it("if assistanceTool is Zendesk, should return true if the email is validated", () => { - expect(canShowHelp(ToolEnum.zendesk, true)).toBeTruthy(); - expect(canShowHelp(ToolEnum.zendesk, false)).toBeFalsy(); + expect(canShowHelp(ToolEnum.zendesk)).toBeTruthy(); }); it("if assistanceTool is instabug, web or none, should return false", () => { - expect(canShowHelp(ToolEnum.instabug, true)).toBeFalsy(); - expect(canShowHelp(ToolEnum.instabug, false)).toBeFalsy(); - expect(canShowHelp(ToolEnum.web, true)).toBeFalsy(); - expect(canShowHelp(ToolEnum.none, true)).toBeFalsy(); - expect(canShowHelp(ToolEnum.web, false)).toBeFalsy(); - expect(canShowHelp(ToolEnum.none, false)).toBeFalsy(); + expect(canShowHelp(ToolEnum.instabug)).toBeFalsy(); + expect(canShowHelp(ToolEnum.web)).toBeFalsy(); + expect(canShowHelp(ToolEnum.none)).toBeFalsy(); }); }); diff --git a/ts/utils/supportAssistance.ts b/ts/utils/supportAssistance.ts index ab446628975..0bafd417473 100644 --- a/ts/utils/supportAssistance.ts +++ b/ts/utils/supportAssistance.ts @@ -144,13 +144,10 @@ export const resetAssistanceData = () => { export const hasSubCategories = (zendeskCategory: ZendeskCategory): boolean => (zendeskCategory.zendeskSubCategories?.subCategories ?? []).length > 0; // help can be shown only when remote FF is zendesk + local FF + emailValidated -export const canShowHelp = ( - assistanceTool: ToolEnum, - isEmailValidated: boolean -): boolean => { +export const canShowHelp = (assistanceTool: ToolEnum): boolean => { switch (assistanceTool) { case ToolEnum.zendesk: - return zendeskEnabled && isEmailValidated; + return zendeskEnabled; case ToolEnum.instabug: case ToolEnum.web: case ToolEnum.none: