From 7de3f1124fdfa7aecc348c97de0919ba1afb6df1 Mon Sep 17 00:00:00 2001 From: Suraj Karambe Date: Tue, 19 Nov 2024 17:58:20 +0530 Subject: [PATCH 1/2] Fixed change passsword dialog onclose --- .../ChangePasswordDialog.tsx | 27 +++++++++---------- 1 file changed, 12 insertions(+), 15 deletions(-) diff --git a/login-workflow/src/components/ChangePasswordDialog/ChangePasswordDialog.tsx b/login-workflow/src/components/ChangePasswordDialog/ChangePasswordDialog.tsx index 12680766..92a7849f 100644 --- a/login-workflow/src/components/ChangePasswordDialog/ChangePasswordDialog.tsx +++ b/login-workflow/src/components/ChangePasswordDialog/ChangePasswordDialog.tsx @@ -45,15 +45,21 @@ export const ChangePasswordDialog: React.FC = (props) const { actions, navigate, routeConfig } = useAuthContext(); const { triggerError, errorManagerConfig } = useErrorManager(); + const [hasVerifyCodeError, setHasVerifyCodeError] = useState(false); + + const handleErrorClose = useCallback(() => { + if (hasVerifyCodeError) { + navigate(routeConfig.LOGIN as string); + } + props.errorDisplayConfig?.onClose?.(); + errorManagerConfig.onClose?.(); + }, [hasVerifyCodeError, navigate, routeConfig.LOGIN, props.errorDisplayConfig, errorManagerConfig]); + const errorDisplayConfig = { ...errorManagerConfig, ...props.errorDisplayConfig, - onClose: (): void => { - if (props.errorDisplayConfig && props.errorDisplayConfig.onClose) props.errorDisplayConfig.onClose(); - if (errorManagerConfig.onClose) errorManagerConfig?.onClose(); - }, + onClose: handleErrorClose, }; - const [hasVerifyCodeError, setHasVerifyCodeError] = useState(false); const passwordReqs = PasswordProps?.passwordRequirements ?? defaultPasswordRequirements(t); @@ -169,16 +175,7 @@ export const ChangePasswordDialog: React.FC = (props) }, }} showSuccessScreen={showSuccessScreen} - errorDisplayConfig={{ - ...errorDisplayConfig, - onClose: hasVerifyCodeError - ? (): void => { - navigate(routeConfig.LOGIN as string); - // eslint-disable-next-line no-unused-expressions - errorDisplayConfig.onClose; - } - : errorDisplayConfig.onClose, - }} + errorDisplayConfig={errorDisplayConfig} /> ); }; From 10807bf6a3d483489031aad25381c313bf48b839 Mon Sep 17 00:00:00 2001 From: Suraj Karambe Date: Thu, 21 Nov 2024 14:58:44 +0530 Subject: [PATCH 2/2] Updated the package version and the changelog --- login-workflow/CHANGELOG.md | 9 ++++++++- login-workflow/example/src/index.tsx | 14 ++++++++++++++ login-workflow/package.json | 2 +- 3 files changed, 23 insertions(+), 2 deletions(-) diff --git a/login-workflow/CHANGELOG.md b/login-workflow/CHANGELOG.md index 1345397f..9571026f 100644 --- a/login-workflow/CHANGELOG.md +++ b/login-workflow/CHANGELOG.md @@ -5,6 +5,13 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## v5.0.1 (Unreleased) + +### Fixed + +- Issue with ChangePasswordDialog `errorDisplayConfig` ([#656](https://github.com/etn-ccis/blui-react-workflows/issues/656)). +- Issue with `errorDisplayConfig` in screens unable to display the custom error ([#664](https://github.com/etn-ccis/blui-react-workflows/issues/664)). + ## v5.0.0 (September 11, 2024) ### Added @@ -17,7 +24,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Fixed - Reload EULA should not be tied to checkbox status ([#549](https://github.com/etn-ccis/blui-react-workflows/issues/549)). -- Updated password validation callback function ([#560]https://github.com/etn-ccis/blui-react-workflows/issues/560). +- Updated password validation callback function ([#560](https://github.com/etn-ccis/blui-react-workflows/issues/560)). ### Changed diff --git a/login-workflow/example/src/index.tsx b/login-workflow/example/src/index.tsx index 4c59f820..30ee7504 100644 --- a/login-workflow/example/src/index.tsx +++ b/login-workflow/example/src/index.tsx @@ -13,6 +13,20 @@ import { createRoot } from 'react-dom/client'; const container = document.getElementById('root'); const root = createRoot(container || document.createDocumentFragment()); +// TODO: Remove this after the issues with @types/react goes away + +// https://github.com/DefinitelyTyped/DefinitelyTyped/discussions/68444 +/* eslint-disable */ +declare global { + namespace React { + interface DOMAttributes { + placeholder?: string | undefined; + onPointerEnterCapture?: React.PointerEventHandler | undefined; + onPointerLeaveCapture?: any; + } + } +} + root.render( // Enable Strict Mode for more error checking diff --git a/login-workflow/package.json b/login-workflow/package.json index e683f02a..ef925af5 100644 --- a/login-workflow/package.json +++ b/login-workflow/package.json @@ -1,6 +1,6 @@ { "name": "@brightlayer-ui/react-auth-workflow", - "version": "5.0.0", + "version": "5.0.1-alpha.0", "author": "Brightlayer UI (https://github.com/brightlayer-ui)", "license": "BSD-3-Clause", "description": "Re-usable workflow components for Authentication and Registration within Eaton applications.",