Skip to content

Commit

Permalink
fix: fixed event data (#1383)
Browse files Browse the repository at this point in the history
  • Loading branch information
ayesha-waris authored Nov 29, 2024
1 parent 5efe9d8 commit 76a5a5d
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 8 deletions.
9 changes: 7 additions & 2 deletions src/common-components/RedirectLogistration.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,16 @@ const RedirectLogistration = (props) => {
userId,
registrationEmbedded,
host,
currectProvider,
} = props;
const cohesionEventData = useSelector(state => state.cohesion.eventData);
let finalRedirectUrl = '';

if (success) {
// This event is used by cohesion upon successful login
trackCohesionEvent(cohesionEventData);
// This event is used by cohesion upon successful login and registration
if (!currectProvider) {
trackCohesionEvent(cohesionEventData);
}
// If we're in a third party auth pipeline, we must complete the pipeline
// once user has successfully logged in. Otherwise, redirect to the specified redirect url.
// Note: For multiple enterprise use case, we need to make sure that user first visits the
Expand Down Expand Up @@ -100,6 +103,7 @@ RedirectLogistration.defaultProps = {
userId: null,
registrationEmbedded: false,
host: '',
currectProvider: '',
};

RedirectLogistration.propTypes = {
Expand All @@ -114,6 +118,7 @@ RedirectLogistration.propTypes = {
userId: PropTypes.number,
registrationEmbedded: PropTypes.bool,
host: PropTypes.string,
currectProvider: PropTypes.string,
};

export default RedirectLogistration;
6 changes: 3 additions & 3 deletions src/login/LoginPage.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -160,9 +160,8 @@ const LoginPage = (props) => {
webElementText: ELEMENT_TEXT.SIGN_IN,
webElementName: ELEMENT_NAME.SIGN_IN,
};
if (currentProvider) {
dispatch(setCohesionEventStates(eventData));
}

dispatch(setCohesionEventStates(eventData));

if (showResetPasswordSuccessBanner) {
props.dismissPasswordResetBanner();
Expand Down Expand Up @@ -229,6 +228,7 @@ const LoginPage = (props) => {
success={loginResult.success}
redirectUrl={loginResult.redirectUrl}
finishAuthUrl={finishAuthUrl}
currentProvider={currentProvider}
/>
<div className="mw-xs mt-3 mb-2">
<LoginFailureMessage
Expand Down
6 changes: 3 additions & 3 deletions src/register/RegistrationPage.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -278,9 +278,8 @@ const RegistrationPage = (props) => {
webElementText: ELEMENT_TEXT.CREATE_ACCOUNT,
webElementName: ELEMENT_NAME.CREATE_ACCOUNT,
};
if (currentProvider) {
dispatch(setCohesionEventStates(eventData));
}

dispatch(setCohesionEventStates(eventData));
registerUser();
};

Expand Down Expand Up @@ -315,6 +314,7 @@ const RegistrationPage = (props) => {
redirectToProgressiveProfilingPage={
getConfig().ENABLE_PROGRESSIVE_PROFILING_ON_AUTHN && !!Object.keys(optionalFields.fields).length
}
currentProvider={currentProvider}
/>
{(autoSubmitRegForm && !errorCode.type)
|| (!autoGeneratedUsernameExpVariation && !(
Expand Down

0 comments on commit 76a5a5d

Please sign in to comment.