From 37e811d7e56ed061e869999a40720e2373abd5d4 Mon Sep 17 00:00:00 2001 From: Syed Sajjad Hussain Shah <52817156+syedsajjadkazmii@users.noreply.github.com> Date: Thu, 7 Sep 2023 09:31:19 +0500 Subject: [PATCH] fix: updated optional fields check based on updated response (#1055) --- src/common-components/data/reducers.js | 4 +++- src/register/RegistrationPage.jsx | 2 +- src/register/RegistrationPage.test.jsx | 4 +++- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/common-components/data/reducers.js b/src/common-components/data/reducers.js index a4c99fcf..841ab966 100644 --- a/src/common-components/data/reducers.js +++ b/src/common-components/data/reducers.js @@ -2,7 +2,9 @@ import { THIRD_PARTY_AUTH_CONTEXT, THIRD_PARTY_AUTH_CONTEXT_CLEAR_ERROR_MSG } fr import { COMPLETE_STATE, FAILURE_STATE, PENDING_STATE } from '../../data/constants'; export const defaultState = { - fieldDescriptions: {}, + fieldDescriptions: { + fields: {}, + }, optionalFields: { fields: {}, extended_profile: [], diff --git a/src/register/RegistrationPage.jsx b/src/register/RegistrationPage.jsx index 9ab262bb..896f7551 100644 --- a/src/register/RegistrationPage.jsx +++ b/src/register/RegistrationPage.jsx @@ -296,7 +296,7 @@ const RegistrationPage = (props) => { optionalFields={optionalFields} registrationEmbedded={registrationEmbedded} redirectToProgressiveProfilingPage={ - getConfig().ENABLE_PROGRESSIVE_PROFILING_ON_AUTHN && Object.keys(optionalFields).includes('fields') + getConfig().ENABLE_PROGRESSIVE_PROFILING_ON_AUTHN && !!Object.keys(optionalFields.fields).length } /> {autoSubmitRegForm && !errorCode.type ? ( diff --git a/src/register/RegistrationPage.test.jsx b/src/register/RegistrationPage.test.jsx index 6bf4ac43..5310f162 100644 --- a/src/register/RegistrationPage.test.jsx +++ b/src/register/RegistrationPage.test.jsx @@ -627,7 +627,9 @@ describe('RegistrationPage', () => { }, commonComponents: { ...initialState.commonComponents, - optionalFields: {}, + optionalFields: { + fields: {}, + }, }, }); delete window.location;