This reverts commit 78693f4fc6.
This commit is contained in:
committed by
GitHub
parent
78693f4fc6
commit
a7704edb9c
@@ -9,7 +9,7 @@ import { setCookie } from '../data/utils';
|
||||
|
||||
function RedirectLogistration(props) {
|
||||
const {
|
||||
finishAuthUrl, redirectUrl, redirectToProgressiveProfilingPage, success, optionalFields,
|
||||
finishAuthUrl, redirectUrl, redirectToWelcomePage, success, optionalFields,
|
||||
} = props;
|
||||
let finalRedirectUrl = '';
|
||||
|
||||
@@ -25,7 +25,7 @@ function RedirectLogistration(props) {
|
||||
}
|
||||
|
||||
// Redirect to Progressive Profiling after successful registration
|
||||
if (redirectToProgressiveProfilingPage) {
|
||||
if (redirectToWelcomePage) {
|
||||
// TODO: Do we still need this cookie?
|
||||
setCookie('van-504-returning-user', true);
|
||||
const registrationResult = { redirectUrl: finalRedirectUrl, success };
|
||||
@@ -50,7 +50,7 @@ RedirectLogistration.defaultProps = {
|
||||
finishAuthUrl: null,
|
||||
success: false,
|
||||
redirectUrl: '',
|
||||
redirectToProgressiveProfilingPage: false,
|
||||
redirectToWelcomePage: false,
|
||||
optionalFields: {},
|
||||
};
|
||||
|
||||
@@ -58,7 +58,7 @@ RedirectLogistration.propTypes = {
|
||||
finishAuthUrl: PropTypes.string,
|
||||
success: PropTypes.bool,
|
||||
redirectUrl: PropTypes.string,
|
||||
redirectToProgressiveProfilingPage: PropTypes.bool,
|
||||
redirectToWelcomePage: PropTypes.bool,
|
||||
optionalFields: PropTypes.shape({}),
|
||||
};
|
||||
|
||||
|
||||
@@ -23,21 +23,15 @@ const reducer = (state = defaultState, action) => {
|
||||
...state,
|
||||
thirdPartyAuthApiStatus: PENDING_STATE,
|
||||
};
|
||||
case THIRD_PARTY_AUTH_CONTEXT.SUCCESS: {
|
||||
const extendedProfile = action.payload.optionalFields.extended_profile;
|
||||
const extendedProfileArray = extendedProfile && JSON.parse(extendedProfile.replaceAll('\'', '"'));
|
||||
case THIRD_PARTY_AUTH_CONTEXT.SUCCESS:
|
||||
return {
|
||||
...state,
|
||||
extendedProfile: extendedProfileArray,
|
||||
extendedProfile: action.payload.fieldDescriptions.extended_profile,
|
||||
fieldDescriptions: action.payload.fieldDescriptions.fields,
|
||||
optionalFields: {
|
||||
...action.payload.optionalFields,
|
||||
extended_profile: extendedProfileArray,
|
||||
},
|
||||
optionalFields: action.payload.optionalFields,
|
||||
thirdPartyAuthContext: action.payload.thirdPartyAuthContext,
|
||||
thirdPartyAuthApiStatus: COMPLETE_STATE,
|
||||
};
|
||||
}
|
||||
case THIRD_PARTY_AUTH_CONTEXT.FAILURE:
|
||||
return {
|
||||
...state,
|
||||
|
||||
@@ -1,49 +0,0 @@
|
||||
import { THIRD_PARTY_AUTH_CONTEXT } from '../actions';
|
||||
import reducer from '../reducers';
|
||||
|
||||
describe('common components reducer', () => {
|
||||
it('should convert extended profile from string to array', () => {
|
||||
const state = {
|
||||
extendedProfile: [],
|
||||
fieldDescriptions: {},
|
||||
optionalFields: {},
|
||||
thirdPartyAuthApiStatus: null,
|
||||
thirdPartyAuthContext: {
|
||||
currentProvider: null,
|
||||
finishAuthUrl: null,
|
||||
countryCode: null,
|
||||
providers: [],
|
||||
secondaryProviders: [],
|
||||
pipelineUserDetails: null,
|
||||
},
|
||||
};
|
||||
const fieldDescriptions = {
|
||||
fields: [],
|
||||
extended_profile: "['state', 'profession']",
|
||||
};
|
||||
const optionalFields = {
|
||||
fields: [],
|
||||
extended_profile: "['state', 'profession']",
|
||||
};
|
||||
const thirdPartyAuthContext = { ...state.thirdPartyAuthContext };
|
||||
const action = {
|
||||
type: THIRD_PARTY_AUTH_CONTEXT.SUCCESS,
|
||||
payload: { fieldDescriptions, optionalFields, thirdPartyAuthContext },
|
||||
};
|
||||
|
||||
expect(
|
||||
reducer(state, action),
|
||||
).toEqual(
|
||||
{
|
||||
...state,
|
||||
extendedProfile: ['state', 'profession'],
|
||||
fieldDescriptions: [],
|
||||
optionalFields: {
|
||||
fields: [],
|
||||
extended_profile: ['state', 'profession'],
|
||||
},
|
||||
thirdPartyAuthApiStatus: 'complete',
|
||||
},
|
||||
);
|
||||
});
|
||||
});
|
||||
@@ -46,13 +46,11 @@ const ProgressiveProfiling = (props) => {
|
||||
|
||||
useEffect(() => {
|
||||
configureAuth(AxiosJwtAuthService, { loggingService: getLoggingService(), config: getConfig() });
|
||||
ensureAuthenticatedUser(DASHBOARD_URL)
|
||||
.then(() => {
|
||||
hydrateAuthenticatedUser().then(() => {
|
||||
setReady(true);
|
||||
});
|
||||
})
|
||||
.catch(() => {});
|
||||
ensureAuthenticatedUser(DASHBOARD_URL).then(() => {
|
||||
hydrateAuthenticatedUser().then(() => {
|
||||
setReady(true);
|
||||
});
|
||||
});
|
||||
|
||||
if (props.location.state && props.location.state.registrationResult) {
|
||||
setRegistrationResult(props.location.state.registrationResult);
|
||||
@@ -196,6 +194,7 @@ const ProgressiveProfiling = (props) => {
|
||||
};
|
||||
|
||||
ProgressiveProfiling.propTypes = {
|
||||
// eslint-disable-next-line react/no-unused-prop-types
|
||||
formRenderState: PropTypes.string.isRequired,
|
||||
intl: intlShape.isRequired,
|
||||
location: PropTypes.shape({
|
||||
|
||||
@@ -461,7 +461,7 @@ const RegistrationPage = (props) => {
|
||||
redirectUrl={registrationResult.redirectUrl}
|
||||
finishAuthUrl={finishAuthUrl}
|
||||
optionalFields={optionalFields}
|
||||
redirectToProgressiveProfilingPage={
|
||||
redirectToWelcomePage={
|
||||
getConfig().ENABLE_PROGRESSIVE_PROFILING_ON_AUTHN && Object.keys(optionalFields).length !== 0
|
||||
}
|
||||
/>
|
||||
|
||||
Reference in New Issue
Block a user