From a029ac398c7f5983ef7b35354ab5d2835725c216 Mon Sep 17 00:00:00 2001 From: manojleaton Date: Wed, 27 Sep 2023 14:56:52 +0530 Subject: [PATCH 1/3] forgot password success screen code changes --- .../ForgotPasswordScreen.tsx | 121 +++++++++++------- .../ForgotPasswordScreenBase.tsx | 17 ++- 2 files changed, 88 insertions(+), 50 deletions(-) diff --git a/login-workflow/src/screens/ForgotPasswordScreen/ForgotPasswordScreen.tsx b/login-workflow/src/screens/ForgotPasswordScreen/ForgotPasswordScreen.tsx index ec2d207a..fbea3440 100644 --- a/login-workflow/src/screens/ForgotPasswordScreen/ForgotPasswordScreen.tsx +++ b/login-workflow/src/screens/ForgotPasswordScreen/ForgotPasswordScreen.tsx @@ -6,7 +6,6 @@ import { useLanguageLocale } from '../../hooks'; import { ForgotPasswordScreenBase } from './ForgotPasswordScreenBase'; import { ForgotPasswordScreenProps } from './types'; import Typography from '@mui/material/Typography'; -import { SuccessScreenBase } from '../SuccessScreen'; import CheckCircle from '@mui/icons-material/CheckCircle'; import { LinkStyles } from '../../styles'; import { useErrorManager } from '../../contexts/ErrorContext/useErrorManager'; @@ -77,7 +76,7 @@ export const ForgotPasswordScreen: React.FC = (props) WorkflowCardInstructionProps, WorkflowCardActionsProps, showSuccessScreen: enableSuccessScreen = true, - slotProps = { SuccessScreen: {} }, + slotProps, slots, emailTextFieldProps, } = props; @@ -142,49 +141,83 @@ export const ForgotPasswordScreen: React.FC = (props) emailValidator={emailValidator} emailTextFieldProps={emailTextFieldProps} showSuccessScreen={enableSuccessScreen && showSuccessScreen} - slots={{ - SuccessScreen: - slots?.SuccessScreen ?? - ((): JSX.Element => ( - } - messageTitle={t('bluiCommon:MESSAGES.EMAIL_SENT')} - message={ - - - Link has been sent to {emailInput}. - - - } - {...slotProps.SuccessScreen} - WorkflowCardHeaderProps={{ - title: t('bluiAuth:HEADER.FORGOT_PASSWORD'), - ...slotProps.SuccessScreen.WorkflowCardHeaderProps, + // slots={{ + // SuccessScreen: + // slots?.SuccessScreen ?? + // ((): JSX.Element => ( + // } + // messageTitle={t('bluiCommon:MESSAGES.EMAIL_SENT')} + // message={ + // + // + // Link has been sent to {emailInput}. + // + // + // } + // {...slotProps.SuccessScreen} + // WorkflowCardHeaderProps={{ + // title: t('bluiAuth:HEADER.FORGOT_PASSWORD'), + // ...slotProps.SuccessScreen.WorkflowCardHeaderProps, + // }} + // WorkflowCardActionsProps={{ + // showNext: true, + // nextLabel: t('bluiCommon:ACTIONS.DONE'), + // canGoNext: true, + // fullWidthButton: true, + // ...slotProps.SuccessScreen.WorkflowCardActionsProps, + // onNext: (): void => { + // navigate(routeConfig.LOGIN); + // if (slotProps.SuccessScreen.WorkflowCardActionsProps) + // slotProps.SuccessScreen.WorkflowCardActionsProps?.onNext?.(); + // }, + // }} + // /> + // )), + // }} + slots={slots} + slotProps={{ + SuccessScreen: { + icon: , + messageTitle: t('bluiCommon:MESSAGES.EMAIL_SENT'), + message: ( + { - navigate(routeConfig.LOGIN); - if (slotProps.SuccessScreen.WorkflowCardActionsProps) - slotProps.SuccessScreen.WorkflowCardActionsProps?.onNext?.(); - }, - }} - /> - )), + component={'span'} + > + + Link has been sent to {emailInput}. + + + ), + WorkflowCardHeaderProps: { + title: t('bluiAuth:HEADER.FORGOT_PASSWORD'), + }, + WorkflowCardActionsProps: { + showNext: true, + nextLabel: t('bluiCommon:ACTIONS.DONE'), + canGoNext: true, + fullWidthButton: true, + onNext: (): void => { + navigate(routeConfig.LOGIN); + }, + }, + }, + ...slotProps, }} errorDisplayConfig={errorDisplayConfig} /> diff --git a/login-workflow/src/screens/ForgotPasswordScreen/ForgotPasswordScreenBase.tsx b/login-workflow/src/screens/ForgotPasswordScreen/ForgotPasswordScreenBase.tsx index 975b6dbc..07d2f4ad 100644 --- a/login-workflow/src/screens/ForgotPasswordScreen/ForgotPasswordScreenBase.tsx +++ b/login-workflow/src/screens/ForgotPasswordScreen/ForgotPasswordScreenBase.tsx @@ -8,12 +8,12 @@ import { WorkflowCardInstructions, } from '../../components'; import { ForgotPasswordScreenProps } from './types'; -import { SuccessScreenProps } from '../SuccessScreen'; +import { SuccessScreenBase, SuccessScreenProps } from '../SuccessScreen'; import ErrorManager from '../../components/Error/ErrorManager'; -type ForgotPasswordScreenBaseProps = Omit & { - slots: { SuccessScreen: (props: SuccessScreenProps) => JSX.Element }; -}; +// type ForgotPasswordScreenBaseProps = Omit & { +// slots: { SuccessScreen: (props: SuccessScreenProps) => JSX.Element }; +// }; /** * Component renders a screen with forgot password for support with the application. @@ -35,7 +35,7 @@ type ForgotPasswordScreenBaseProps = Omit & * @category Component */ -export const ForgotPasswordScreenBase: React.FC> = (props) => { +export const ForgotPasswordScreenBase: React.FC> = (props) => { const [emailInput, setEmailInput] = useState(props.initialEmailValue ?? ''); const { @@ -79,10 +79,15 @@ export const ForgotPasswordScreenBase: React.FC JSX.Element + ): JSX.Element => (SuccessScreen ? SuccessScreen(_props) : ); + return ( <> {showSuccessScreen ? ( - + getSuccessScreen(slotProps?.SuccessScreen, slots?.SuccessScreen) ) : ( From d62b65555ae1c1080c6d47de5e51f5f4ce0b02c9 Mon Sep 17 00:00:00 2001 From: manojleaton Date: Wed, 27 Sep 2023 15:08:30 +0530 Subject: [PATCH 2/3] removed commented code --- .../ForgotPasswordScreen.tsx | 44 ------------------- .../ForgotPasswordScreenBase.tsx | 4 -- 2 files changed, 48 deletions(-) diff --git a/login-workflow/src/screens/ForgotPasswordScreen/ForgotPasswordScreen.tsx b/login-workflow/src/screens/ForgotPasswordScreen/ForgotPasswordScreen.tsx index fbea3440..cad3d1d2 100644 --- a/login-workflow/src/screens/ForgotPasswordScreen/ForgotPasswordScreen.tsx +++ b/login-workflow/src/screens/ForgotPasswordScreen/ForgotPasswordScreen.tsx @@ -141,50 +141,6 @@ export const ForgotPasswordScreen: React.FC = (props) emailValidator={emailValidator} emailTextFieldProps={emailTextFieldProps} showSuccessScreen={enableSuccessScreen && showSuccessScreen} - // slots={{ - // SuccessScreen: - // slots?.SuccessScreen ?? - // ((): JSX.Element => ( - // } - // messageTitle={t('bluiCommon:MESSAGES.EMAIL_SENT')} - // message={ - // - // - // Link has been sent to {emailInput}. - // - // - // } - // {...slotProps.SuccessScreen} - // WorkflowCardHeaderProps={{ - // title: t('bluiAuth:HEADER.FORGOT_PASSWORD'), - // ...slotProps.SuccessScreen.WorkflowCardHeaderProps, - // }} - // WorkflowCardActionsProps={{ - // showNext: true, - // nextLabel: t('bluiCommon:ACTIONS.DONE'), - // canGoNext: true, - // fullWidthButton: true, - // ...slotProps.SuccessScreen.WorkflowCardActionsProps, - // onNext: (): void => { - // navigate(routeConfig.LOGIN); - // if (slotProps.SuccessScreen.WorkflowCardActionsProps) - // slotProps.SuccessScreen.WorkflowCardActionsProps?.onNext?.(); - // }, - // }} - // /> - // )), - // }} slots={slots} slotProps={{ SuccessScreen: { diff --git a/login-workflow/src/screens/ForgotPasswordScreen/ForgotPasswordScreenBase.tsx b/login-workflow/src/screens/ForgotPasswordScreen/ForgotPasswordScreenBase.tsx index 07d2f4ad..f705d538 100644 --- a/login-workflow/src/screens/ForgotPasswordScreen/ForgotPasswordScreenBase.tsx +++ b/login-workflow/src/screens/ForgotPasswordScreen/ForgotPasswordScreenBase.tsx @@ -11,10 +11,6 @@ import { ForgotPasswordScreenProps } from './types'; import { SuccessScreenBase, SuccessScreenProps } from '../SuccessScreen'; import ErrorManager from '../../components/Error/ErrorManager'; -// type ForgotPasswordScreenBaseProps = Omit & { -// slots: { SuccessScreen: (props: SuccessScreenProps) => JSX.Element }; -// }; - /** * Component renders a screen with forgot password for support with the application. * From 0053708978f88c843c3e079d44cf0f14181a79f2 Mon Sep 17 00:00:00 2001 From: manojleaton Date: Wed, 27 Sep 2023 15:21:00 +0530 Subject: [PATCH 3/3] Merge branch 'dev' into forgot-password-success-screen --- .../screens/ForgotPasswordScreen/ForgotPasswordScreen.tsx | 6 +++--- .../src/screens/ResetPasswordScreen/ResetPasswordScreen.tsx | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/login-workflow/src/screens/ForgotPasswordScreen/ForgotPasswordScreen.tsx b/login-workflow/src/screens/ForgotPasswordScreen/ForgotPasswordScreen.tsx index cad3d1d2..5b29f69e 100644 --- a/login-workflow/src/screens/ForgotPasswordScreen/ForgotPasswordScreen.tsx +++ b/login-workflow/src/screens/ForgotPasswordScreen/ForgotPasswordScreen.tsx @@ -76,8 +76,8 @@ export const ForgotPasswordScreen: React.FC = (props) WorkflowCardInstructionProps, WorkflowCardActionsProps, showSuccessScreen: enableSuccessScreen = true, - slotProps, - slots, + slots = {}, + slotProps = {}, emailTextFieldProps, } = props; @@ -172,8 +172,8 @@ export const ForgotPasswordScreen: React.FC = (props) navigate(routeConfig.LOGIN); }, }, + ...slotProps.SuccessScreen, }, - ...slotProps, }} errorDisplayConfig={errorDisplayConfig} /> diff --git a/login-workflow/src/screens/ResetPasswordScreen/ResetPasswordScreen.tsx b/login-workflow/src/screens/ResetPasswordScreen/ResetPasswordScreen.tsx index 7becc0b5..0e0c43d5 100644 --- a/login-workflow/src/screens/ResetPasswordScreen/ResetPasswordScreen.tsx +++ b/login-workflow/src/screens/ResetPasswordScreen/ResetPasswordScreen.tsx @@ -40,8 +40,8 @@ export const ResetPasswordScreen: React.FC = (props) = WorkflowCardActionsProps, PasswordProps, errorDisplayConfig = errorManagerConfig, - slots, - slotProps, + slots = {}, + slotProps = {}, } = props; const [passwordInput, setPasswordInput] = useState(PasswordProps?.initialNewPasswordValue ?? ''); @@ -184,8 +184,8 @@ export const ResetPasswordScreen: React.FC = (props) = navigate(routeConfig.LOGIN); }, }, + ...slotProps.SuccessScreen, }, - ...slotProps, }} errorDisplayConfig={{ ...errorDisplayConfig,