feat: add page event for reset password (#1253)

Description: Add page event for reset password page
VAN-1929
This commit is contained in:
Blue
2024-06-04 16:27:14 +05:00
committed by mubbsharanwar
parent ad0d75ab0d
commit 1819edc9b7
3 changed files with 10 additions and 1 deletions

View File

@@ -41,7 +41,7 @@ const ForgotPasswordPage = (props) => {
const navigate = useNavigate();
useEffect(() => {
sendPageEvent('login_and_registration', 'reset');
sendPageEvent('login_and_registration', 'forgot-password');
sendTrackEvent('edx.bi.password_reset_form.viewed', { category: 'user-engagement' });
}, []);

View File

@@ -2,6 +2,7 @@ import React, { useEffect, useState } from 'react';
import { connect } from 'react-redux';
import { getConfig } from '@edx/frontend-platform';
import { sendPageEvent } from '@edx/frontend-platform/analytics';
import { useIntl } from '@edx/frontend-platform/i18n';
import {
Form,
@@ -42,6 +43,10 @@ const ResetPasswordPage = (props) => {
const { token } = useParams();
const navigate = useNavigate();
useEffect(() => {
sendPageEvent('login_and_registration', 'reset-password');
}, []);
useEffect(() => {
if (props.status !== TOKEN_STATE.PENDING && props.status !== PASSWORD_RESET_ERROR) {
setErrorCode(props.status);

View File

@@ -19,6 +19,10 @@ import ResetPasswordPage from '../ResetPasswordPage';
const mockedNavigator = jest.fn();
const token = '1c-bmjdkc-5e60e084cf8113048ca7';
jest.mock('@edx/frontend-platform/analytics', () => ({
sendPageEvent: jest.fn(),
}));
jest.mock('@edx/frontend-platform/auth');
jest.mock('react-router-dom', () => ({
...(jest.requireActual('react-router-dom')),