From a7c65f30f4a7ec214e0d11f0a57f63b7607e309e Mon Sep 17 00:00:00 2001 From: Ashish Deo Date: Thu, 29 Aug 2024 16:31:02 +0530 Subject: [PATCH] TP-69871 | added clickstream events for Cosmos Sync Block longhorn (#1089) * TP-69871 | added clickstream events for Cosmos Sync Block longhorn * TP-69871 | added clickstream event * TP-69871 | prettier --- src/pages/LonghornBlock/LonghornWarning.tsx | 19 +++++++++++++------ src/pages/LonghornBlock/index.tsx | 9 +++++++-- src/service/clickStream.constant.ts | 12 ++++++++++++ 3 files changed, 32 insertions(+), 8 deletions(-) diff --git a/src/pages/LonghornBlock/LonghornWarning.tsx b/src/pages/LonghornBlock/LonghornWarning.tsx index b9213b4a..b146bbb5 100644 --- a/src/pages/LonghornBlock/LonghornWarning.tsx +++ b/src/pages/LonghornBlock/LonghornWarning.tsx @@ -1,4 +1,4 @@ -import { useRef, useState } from 'react'; +import { useEffect, useRef, useState } from 'react'; import ModalWarning from './ModalWarning'; import DraggableWarning from './DraggableWarning'; import Overlay from '@cp/src/components/Overlay/Overlay'; @@ -14,16 +14,19 @@ import { CALL_BRIDGE_STATUSES } from '@cp/pages/CaseDetails/feedbackForm/interfa import { RootState } from '@cp/src/store'; import { ExtensionHandler } from '@cp/utils/extension.utils'; import { useNavigate } from 'react-router-dom'; +import { addClickstreamEvent } from '@cp/src/service/clickStreamEventService'; +import { AgentTrackingEvents } from '@cp/src/service/clickStream.constant'; const LonghornWarning = () => { - const [isDraggableWarningVIsible, setIsDraggableWarningVIsible] = useState(false); + const [isDraggableWarningVisible, setIsDraggableWarningVisible] = useState(false); const lastSyncTimeStamp = useSelector((state: RootState) => state.common.lastSyncTimestamp); const timeRemaining = Date.now() - lastSyncTimeStamp; const timeRemainingInSeconds = Number((timeRemaining / 1000).toFixed(0)); const initialRemainingTime = COUNTDOWN_INTERVAL_BEFORE_BLOCKING - timeRemainingInSeconds; const [localTimeLeft, setLocalTimeLeft] = useState(initialRemainingTime); const handleOnClose = () => { - setIsDraggableWarningVIsible(true); + addClickstreamEvent(AgentTrackingEvents.LH_COSMOS_SYNC_WARNING_CTA_BUTTON_CLICKED); + setIsDraggableWarningVisible(true); }; const dispatch = useDispatch(); const slashCallStatus = useSelector((store: RootState) => store.common.slashCallStatus); @@ -45,15 +48,19 @@ const LonghornWarning = () => { dispatch(setCosmosSyncBlockStatus(CosmosSyncBlockStatus.BLOCKED)); ExtensionHandler.setAvailability(false); ExtensionHandler.blockSlash(); - setIsDraggableWarningVIsible(false); + setIsDraggableWarningVisible(false); }; + useEffect(() => { + addClickstreamEvent(AgentTrackingEvents.LH_COSMOS_SYNC_WARNING_MODAL_LOADED); + }, []); + return ( <> - {isDraggableWarningVIsible ? ( + {isDraggableWarningVisible ? ( ) : ( - + )} diff --git a/src/pages/LonghornBlock/index.tsx b/src/pages/LonghornBlock/index.tsx index 970bc864..6b01d826 100644 --- a/src/pages/LonghornBlock/index.tsx +++ b/src/pages/LonghornBlock/index.tsx @@ -1,11 +1,16 @@ +import { useEffect } from 'react'; import Content from './Content'; import Footer from './Footer'; import Header from './Header'; import styles from './index.module.scss'; -import { useNavigate } from 'react-router-dom'; -import { useEffect } from 'react'; +import { addClickstreamEvent } from '@cp/src/service/clickStreamEventService'; +import { AgentTrackingEvents } from '@cp/src/service/clickStream.constant'; const LonghornBlock = () => { + useEffect(() => { + addClickstreamEvent(AgentTrackingEvents.LH_COSMOS_SYNC_AGENT_BLOCKED); + }, []); + return (
diff --git a/src/service/clickStream.constant.ts b/src/service/clickStream.constant.ts index 6c53b6be..52122844 100644 --- a/src/service/clickStream.constant.ts +++ b/src/service/clickStream.constant.ts @@ -1527,6 +1527,18 @@ export const AgentTrackingEvents = { LH_MAP_AGENT_REDIRECTION_ICON_CLICKED: { name: 'LH_MAP_AGENT_REDIRECTION_CLICKED', description: 'Map agent redirection icon clicked' + }, + LH_COSMOS_SYNC_AGENT_BLOCKED: { + name: 'LH_COSMOS_SYNC_AGENT_BLOCKED', + description: 'Agent blocked due to failure of cosmos sync' + }, + LH_COSMOS_SYNC_WARNING_MODAL_LOADED: { + name: 'LH_COSMOS_SYNC_WARNING_MODAL_LOADED', + description: 'Cosmos sync warning modal appeared' + }, + LH_COSMOS_SYNC_WARNING_CTA_BUTTON_CLICKED: { + name: 'LH_COSMOS_SYNC_WARNING_CTA_CLICKED', + description: 'Agent clicked on the CTA in the cosmos sync warning modal' } };