From 7032c9f0f62a14a2c8ec0a1a52e345a3df414e0a Mon Sep 17 00:00:00 2001 From: Akshata Katwal Date: Wed, 8 Jan 2025 17:50:15 +0530 Subject: [PATCH 1/3] Issue feat:Add telemetry events for board-endrollment --- src/components/SortingModal.tsx | 19 ++++++++++++++++++ .../student-detail/[userId].tsx | 20 ++++++++++++++++++- src/pages/topic-detail-view.tsx | 20 ++++++++++++++++++- 3 files changed, 57 insertions(+), 2 deletions(-) diff --git a/src/components/SortingModal.tsx b/src/components/SortingModal.tsx index 0071127a..4ba79ea4 100644 --- a/src/components/SortingModal.tsx +++ b/src/components/SortingModal.tsx @@ -15,6 +15,8 @@ import { useTheme } from '@mui/material/styles'; import { useTranslation } from 'react-i18next'; import ModalComponent from './Modal'; import { avgLearnerAttendanceLimit, lowLearnerAttendanceLimit } from '../../app.config'; +import { Telemetry } from '@/utils/app.constant'; +import { telemetryFactory } from '../utils/telemetry'; interface sortCardProps { handleSorting?: ( @@ -140,6 +142,23 @@ const SortingModal: React.FC = ({ sortByStages ], }); + const windowUrl = window.location.pathname; + const cleanedUrl = windowUrl.replace(/^\//, ''); + const env = cleanedUrl.split("/")[0]; + const telemetryInteract = { + context: { + env: env, + cdata: [], + }, + edata: { + id: 'sort-by-applied', + + type: Telemetry.CLICK, + subtype: '', + pageid: cleanedUrl, + }, + }; + telemetryFactory.interact(telemetryInteract); } handleCloseModal(); }; diff --git a/src/pages/board-enrollment/student-detail/[userId].tsx b/src/pages/board-enrollment/student-detail/[userId].tsx index c5b605cd..bdb73a17 100644 --- a/src/pages/board-enrollment/student-detail/[userId].tsx +++ b/src/pages/board-enrollment/student-detail/[userId].tsx @@ -18,7 +18,7 @@ import { logEvent } from '@/utils/googleAnalytics'; import { useTheme } from '@mui/material/styles'; import { useTranslation } from 'react-i18next'; import HorizontalLinearStepper from '@/components/HorizontalLinearStepper'; -import { FeesStepBoards } from '@/utils/app.constant'; +import { FeesStepBoards, Telemetry } from '@/utils/app.constant'; import { useDirection } from '../../../hooks/useDirection'; import BoardEnrollmentProfile from '@/components/BoardEnrollmentProfile'; import { GetStaticPaths } from 'next'; @@ -40,6 +40,7 @@ import useStore from '@/store/store'; import { updateCohortMemberStatus } from '@/services/MyClassDetailsService'; import ConfirmationModal from '@/components/ConfirmationModal'; import { showToastMessage } from '../../../components/Toastify'; +import { telemetryFactory } from '@/utils/telemetry'; interface BoardEnrollment { boardEnrollmentData: { @@ -435,6 +436,23 @@ const BoardEnrollmentDetail = () => { console.log('API Response:', response); if (response && response.params.status === 'successful' && response.responseCode === 201) { + const windowUrl = window.location.pathname; + const cleanedUrl = windowUrl.replace(/^\//, ''); + const env = cleanedUrl.split("/")[0]; + const telemetryInteract = { + context: { + env: env, + cdata: [], + }, + edata: { + id: `endrolled-student(${userId})-to step ` + nextStep, + + type: Telemetry.CLICK, + subtype: '', + pageid: cleanedUrl, + }, + }; + telemetryFactory.interact(telemetryInteract); // API successful, update step state to nextStep setActiveStep(nextStep); } else { diff --git a/src/pages/topic-detail-view.tsx b/src/pages/topic-detail-view.tsx index b548cacb..ed740a02 100644 --- a/src/pages/topic-detail-view.tsx +++ b/src/pages/topic-detail-view.tsx @@ -1,7 +1,7 @@ import CourseAccordion from '@/components/CourseAccordion'; import Header from '@/components/Header'; import useCourseStore from '@/store/coursePlannerStore'; -import { ResourcesType } from '@/utils/app.constant'; +import { ResourcesType, Telemetry } from '@/utils/app.constant'; import { logEvent } from '@/utils/googleAnalytics'; import KeyboardBackspaceOutlinedIcon from '@mui/icons-material/KeyboardBackspaceOutlined'; import { Box, Tab, Tabs } from '@mui/material'; @@ -12,6 +12,7 @@ import router from 'next/router'; import React, { useEffect, useState } from 'react'; import { useDirection } from '../hooks/useDirection'; import { RequisiteType } from '../../app.config'; +import { telemetryFactory } from '@/utils/telemetry'; const TopicDetailView = () => { const [value, setValue] = React.useState(1); @@ -42,6 +43,23 @@ const TopicDetailView = () => { }; const handleChange = (event: React.SyntheticEvent, newValue: number) => { + const windowUrl = window.location.pathname; + const cleanedUrl = windowUrl.replace(/^\//, ''); + const env = cleanedUrl.split("/")[0]; + const telemetryInteract = { + context: { + env: env, + cdata: [], + }, + edata: { + id: + newValue === 1 ? 'change-tab-to-facilitator' : 'change-tab-to-learner', + type: Telemetry.CLICK, + subtype: '', + pageid: cleanedUrl, + }, + }; + telemetryFactory.interact(telemetryInteract); setValue(newValue); }; From 7362d2830ad24cf434fe0b36518f05558b640ebd Mon Sep 17 00:00:00 2001 From: Akshata Katwal Date: Wed, 8 Jan 2025 17:57:00 +0530 Subject: [PATCH 2/3] update pr --- src/components/Header.tsx | 19 +++++++++++++++++++ src/pages/login.tsx | 18 ++++++++++++++++++ 2 files changed, 37 insertions(+) diff --git a/src/components/Header.tsx b/src/components/Header.tsx index 5470ee98..6fd79fd6 100644 --- a/src/components/Header.tsx +++ b/src/components/Header.tsx @@ -20,6 +20,8 @@ import ConfirmationModal from './ConfirmationModal'; import StyledMenu from './StyledMenu'; import { UpdateDeviceNotification } from '@/services/NotificationService'; import { getUserId } from '../services/ProfileService'; +import { Telemetry } from '@/utils/app.constant'; +import { telemetryFactory } from '@/utils/telemetry'; interface HeaderProps { toggleDrawer?: (newOpen: boolean) => () => void; @@ -83,6 +85,23 @@ const Header: React.FC = ({ toggleDrawer, openDrawer }) => { const tenantid = localStorage.getItem('tenantId') const deviceID = localStorage.getItem('deviceID'); + const windowUrl = window.location.pathname; + const cleanedUrl = windowUrl.replace(/^\//, ''); + const env = cleanedUrl.split("/")[0]; + const telemetryInteract = { + context: { + env: env, + cdata: [], + }, + edata: { + id: 'logout-user', + + type: Telemetry.CLICK, + subtype: '', + pageid: cleanedUrl, + }, + }; + telemetryFactory.interact(telemetryInteract); if (deviceID) { try { diff --git a/src/pages/login.tsx b/src/pages/login.tsx index 467b4f65..bccf0310 100644 --- a/src/pages/login.tsx +++ b/src/pages/login.tsx @@ -360,6 +360,24 @@ const LoginPage = () => { 'error' ); } + + const windowUrl = window.location.pathname; + const cleanedUrl = windowUrl.replace(/^\//, ''); + const env = cleanedUrl.split("/")[0]; + const telemetryInteract = { + context: { + env: env, + cdata: [], + }, + edata: { + id: 'failed-login', + + type: Telemetry.CLICK, + subtype: '', + pageid: cleanedUrl, + }, + }; + telemetryFactory.interact(telemetryInteract); } } }; From 1956c6b5d24673804e60d794ea1bae6eaed9ef7f Mon Sep 17 00:00:00 2001 From: Akshata Katwal Date: Wed, 8 Jan 2025 19:37:49 +0530 Subject: [PATCH 3/3] Issure bug:Resolve regular attendance comparaison graph --- src/components/AttendanceComparison.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/src/components/AttendanceComparison.tsx b/src/components/AttendanceComparison.tsx index ddfa17f0..14e4f60e 100644 --- a/src/components/AttendanceComparison.tsx +++ b/src/components/AttendanceComparison.tsx @@ -295,6 +295,7 @@ const AttendanceComparison: React.FC = ({ tickFormatter={(value: any) => `${value}%`} height={0} reversed={isRTL ? true : false} + domain={[0, 100]} />