From 646d6d90aed4d740f7584ea725e144f289a65523 Mon Sep 17 00:00:00 2001 From: Clement Mwimo Date: Wed, 11 Feb 2026 15:00:36 -0700 Subject: [PATCH 1/7] feat: adds a new demo connect guard screen --- src/components/RenderConnectStep.js | 5 ++ src/const/Connect.js | 1 + src/hooks/useSelectInstitution.tsx | 2 + src/redux/reducers/Connect.js | 3 + .../demoConnectGuard/DemoConnectGuard.tsx | 90 +++++++++++++++++++ 5 files changed, 101 insertions(+) create mode 100644 src/views/demoConnectGuard/DemoConnectGuard.tsx diff --git a/src/components/RenderConnectStep.js b/src/components/RenderConnectStep.js index 6e12918c19..6f3dc631b3 100644 --- a/src/components/RenderConnectStep.js +++ b/src/components/RenderConnectStep.js @@ -34,6 +34,7 @@ import { Microdeposits } from 'src/views/microdeposits/Microdeposits' import VerifyExistingMember from 'src/views/verification/VerifyExistingMember' import { VerifyError } from 'src/views/verification/VerifyError' import { ManualAccountConnect } from 'src/views/manualAccount/ManualAccountConnect' +import { DemoConnectGuard } from 'src/views/demoConnectGuard/DemoConnectGuard' import AdditionalProductStep, { ADDITIONAL_PRODUCT_OPTIONS, } from 'src/views/additionalProduct/AdditionalProductStep' @@ -110,6 +111,10 @@ const RenderConnectStep = (props) => { throw new Error('invalid product offer') connectStepView = + } else if (step === STEPS.DEMO_CONNECT_GUARD) { + connectStepView = ( + + ) } else if (step === STEPS.ADD_MANUAL_ACCOUNT) { connectStepView = ( { const dispatch = useDispatch() const consentIsEnabled = useSelector((state: RootState) => isConsentEnabled(state)) const connectConfig = useSelector(selectConnectConfig) + const user = useSelector((state: RootState) => state.profiles.user) const handleSelectInstitution = useCallback( (institution: InstitutionResponseType) => { @@ -42,6 +43,7 @@ const useSelectInstitution = () => { institutionStatus, consentIsEnabled: consentIsEnabled || false, additionalProductOption: connectConfig?.additional_product_option || null, + user, }, }) }), diff --git a/src/redux/reducers/Connect.js b/src/redux/reducers/Connect.js index 0bc93e513a..a0765b5c90 100644 --- a/src/redux/reducers/Connect.js +++ b/src/redux/reducers/Connect.js @@ -278,6 +278,7 @@ const selectInstitutionSuccess = (state, action) => { // 2. Additional product - if the client is offering a product AND the institution has support for the product // 3. Consent - if the Client has enabled consent // 4. Institution disabled - if the institution is disabled by the client + // 5. Demo connect guard - if the user is a demo user but the institution is not a demo institution let nextStep = STEPS.ENTER_CREDENTIALS const canOfferVerification = @@ -292,6 +293,8 @@ const selectInstitutionSuccess = (state, action) => { action.payload.institutionStatus === InstitutionStatus.UNAVAILABLE) ) { nextStep = STEPS.INSTITUTION_STATUS_DETAILS + } else if (action.payload.user?.is_demo && !action.payload.institution?.is_demo) { + nextStep = STEPS.DEMO_CONNECT_GUARD } else if (canOfferVerification || canOfferAggregation) { nextStep = STEPS.ADDITIONAL_PRODUCT } else if (action.payload.consentIsEnabled) { diff --git a/src/views/demoConnectGuard/DemoConnectGuard.tsx b/src/views/demoConnectGuard/DemoConnectGuard.tsx new file mode 100644 index 0000000000..7ff4c8a09d --- /dev/null +++ b/src/views/demoConnectGuard/DemoConnectGuard.tsx @@ -0,0 +1,90 @@ +import React, { useRef } from 'react' +import { useSelector } from 'react-redux' +import { Button } from '@mui/material' +import { P, H2 } from '@mxenabled/mxui' +import { Icon } from '@mxenabled/mxui' + +import { __ } from 'src/utilities/Intl' +import { InstitutionLogo } from '@mxenabled/mxui' +import { SlideDown } from 'src/components/SlideDown' +import { getSelectedInstitution } from 'src/redux/selectors/Connect' + +interface DemoConnectGuardProps { + onReturnToSearch: () => void +} + +export const DemoConnectGuard: React.FC = ({ onReturnToSearch }) => { + const institution = useSelector(getSelectedInstitution) + const containerRef = useRef(null) + const styles = getStyles() + + return ( +
+ +
+ + +
+

+ {__('Demo mode active')} +

+

+ {__( + 'Live institutions are not available in the demo environment. Please select MX Bank to test the connection process.', + )} +

+ +
+
+ ) +} + +const getStyles = () => ({ + container: { + display: 'flex', + flexDirection: 'column', + alignItems: 'center', + justifyContent: 'center', + textAlign: 'center', + paddingTop: 20, + } as React.CSSProperties, + logoContainer: { + position: 'relative', + display: 'inline-block', + } as React.CSSProperties, + icon: { + position: 'absolute', + top: '-16px', + right: '-16px', + background: 'white', + borderRadius: '50%', + }, + title: { + marginBottom: '4px', + marginTop: '32px', + fontSize: '23px', + fontWeight: 700, + lineHeight: '32px', + textAlign: 'center', + }, + body: { + textAlign: 'center', + marginBottom: '32px', + fontSize: '15px', + fontWeight: 400, + lineHeight: '24px', + } as React.CSSProperties, +}) From 7146fd9ae54c28976c013fa0b0c116032869fc0e Mon Sep 17 00:00:00 2001 From: Clement Mwimo Date: Wed, 11 Feb 2026 15:31:58 -0700 Subject: [PATCH 2/7] added a new action type --- src/components/RenderConnectStep.js | 4 +--- src/redux/actions/Connect.js | 1 + src/redux/reducers/Connect.js | 1 + .../demoConnectGuard/DemoConnectGuard.tsx | 20 ++++++++++++------- 4 files changed, 16 insertions(+), 10 deletions(-) diff --git a/src/components/RenderConnectStep.js b/src/components/RenderConnectStep.js index 6f3dc631b3..b615703f09 100644 --- a/src/components/RenderConnectStep.js +++ b/src/components/RenderConnectStep.js @@ -112,9 +112,7 @@ const RenderConnectStep = (props) => { connectStepView = } else if (step === STEPS.DEMO_CONNECT_GUARD) { - connectStepView = ( - - ) + connectStepView = } else if (step === STEPS.ADD_MANUAL_ACCOUNT) { connectStepView = ( ({ type: ActionTypes.LOAD_CONNECT, payload: config }) diff --git a/src/redux/reducers/Connect.js b/src/redux/reducers/Connect.js index a0765b5c90..e3e1b1b823 100644 --- a/src/redux/reducers/Connect.js +++ b/src/redux/reducers/Connect.js @@ -736,6 +736,7 @@ export const connect = createReducer(defaultState, { [ActionTypes.ADD_MANUAL_ACCOUNT_SUCCESS]: addManualAccount, [ActionTypes.LOGIN_ERROR_START_OVER]: loginErrorStartOver, [ActionTypes.CONNECT_GO_BACK]: connectGoBack, + [ActionTypes.DEMO_CONNECT_GUARD_RETURN_TO_SEARCH]: goBackSearchOrVerify, // Addtional product offer / step up reducers // These are here to manage changing the location/step of the widget diff --git a/src/views/demoConnectGuard/DemoConnectGuard.tsx b/src/views/demoConnectGuard/DemoConnectGuard.tsx index 7ff4c8a09d..c2760c7090 100644 --- a/src/views/demoConnectGuard/DemoConnectGuard.tsx +++ b/src/views/demoConnectGuard/DemoConnectGuard.tsx @@ -1,5 +1,5 @@ import React, { useRef } from 'react' -import { useSelector } from 'react-redux' +import { useDispatch, useSelector } from 'react-redux' import { Button } from '@mui/material' import { P, H2 } from '@mxenabled/mxui' import { Icon } from '@mxenabled/mxui' @@ -8,16 +8,17 @@ import { __ } from 'src/utilities/Intl' import { InstitutionLogo } from '@mxenabled/mxui' import { SlideDown } from 'src/components/SlideDown' import { getSelectedInstitution } from 'src/redux/selectors/Connect' +import * as connectActions from 'src/redux/actions/Connect' +import { selectInitialConfig } from 'src/redux/reducers/configSlice' -interface DemoConnectGuardProps { - onReturnToSearch: () => void -} - -export const DemoConnectGuard: React.FC = ({ onReturnToSearch }) => { +export const DemoConnectGuard: React.FC = () => { const institution = useSelector(getSelectedInstitution) + const initialConfig = useSelector(selectInitialConfig) const containerRef = useRef(null) const styles = getStyles() + const dispatch = useDispatch() + return (
@@ -42,7 +43,12 @@ export const DemoConnectGuard: React.FC = ({ onReturnToSe