Skip to content

Commit

Permalink
fix: fix segment event on reset password modal (#128)
Browse files Browse the repository at this point in the history
  • Loading branch information
attiyaIshaque committed Aug 12, 2024
1 parent f3ea511 commit e9fcfaf
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 8 deletions.
6 changes: 2 additions & 4 deletions src/forms/reset-password-popup/reset-password/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import {
} from './data/constants';
import { resetPassword, validatePassword, validateToken } from './data/reducers';
import {
COMPLETE_STATE,
DEFAULT_STATE, FORGOT_PASSWORD_FORM, FORM_SUBMISSION_ERROR, LOGIN_FORM, PENDING_STATE,
} from '../../../data/constants';
import { useDispatch, useSelector } from '../../../data/storeHooks';
Expand Down Expand Up @@ -49,7 +48,6 @@ const ResetPasswordPage = () => {
const newPasswordRef = useRef(null);

const status = useSelector(state => state.resetPassword.status);
const tokenValidationState = useSelector(state => state.resetPassword.status);
const errorMsg = useSelector(state => state.resetPassword?.errorMsg);
const backendValidationError = useSelector(state => state.resetPassword?.backendValidationError);

Expand Down Expand Up @@ -81,10 +79,10 @@ const ResetPasswordPage = () => {
}, [status]);

useEffect(() => {
if (tokenValidationState === COMPLETE_STATE && status === TOKEN_STATE.VALID) {
if (status === TOKEN_STATE.VALID) {
trackResetPasswordPageViewed();
}
}, [status, tokenValidationState]);
}, [status]);

const validateInput = (name, value, shouldValidateFromBackend = true) => {
switch (name) {
Expand Down
4 changes: 2 additions & 2 deletions src/tracking/trackers/login.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,15 @@ export const trackLoginPageViewed = () => {
createPageEventTracker(eventNames.loginAndRegistration, 'login')();
};

// Tracks the progressive profiling page event.
// Tracks the event when the register link is clicked on the login form.
export const trackRegisterFormToggled = () => {
createEventTracker(
eventNames.registerFormToggled,
{ category: categories.userEngagement },
)();
};

// Tracks the login sucess event.
// Tracks the login success event.
export const trackLoginSuccess = () => createEventTracker(
eventNames.loginSuccess,
{},
Expand Down
4 changes: 2 additions & 2 deletions src/tracking/trackers/register.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@ export const trackRegistrationSuccess = () => createEventTracker(
{},
)();

// Tracks the progressive profiling page event.
// Tracks the register page event.
export const trackRegistrationPageViewed = () => {
createPageEventTracker(eventNames.loginAndRegistration, 'register')();
};

// Tracks the progressive profiling page event.
// Tracks the event when the login link is clicked on the register form..
export const trackLoginFormToggled = () => {
createEventTracker(
eventNames.loginFormToggled,
Expand Down

0 comments on commit e9fcfaf

Please sign in to comment.