From e9fcfaf2c2e23bbccbce6b5bb1fd321ec7283e13 Mon Sep 17 00:00:00 2001 From: Attiya Ishaque Date: Mon, 12 Aug 2024 18:46:29 +0500 Subject: [PATCH] fix: fix segment event on reset password modal (#128) --- src/forms/reset-password-popup/reset-password/index.jsx | 6 ++---- src/tracking/trackers/login.js | 4 ++-- src/tracking/trackers/register.js | 4 ++-- 3 files changed, 6 insertions(+), 8 deletions(-) diff --git a/src/forms/reset-password-popup/reset-password/index.jsx b/src/forms/reset-password-popup/reset-password/index.jsx index 92b279ba..0348a821 100644 --- a/src/forms/reset-password-popup/reset-password/index.jsx +++ b/src/forms/reset-password-popup/reset-password/index.jsx @@ -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'; @@ -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); @@ -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) { diff --git a/src/tracking/trackers/login.js b/src/tracking/trackers/login.js index c57d9a3d..a4f13693 100644 --- a/src/tracking/trackers/login.js +++ b/src/tracking/trackers/login.js @@ -22,7 +22,7 @@ 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, @@ -30,7 +30,7 @@ export const trackRegisterFormToggled = () => { )(); }; -// Tracks the login sucess event. +// Tracks the login success event. export const trackLoginSuccess = () => createEventTracker( eventNames.loginSuccess, {}, diff --git a/src/tracking/trackers/register.js b/src/tracking/trackers/register.js index 71d62eda..1f44e15e 100644 --- a/src/tracking/trackers/register.js +++ b/src/tracking/trackers/register.js @@ -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,