TP-66615 | Agent location infinite loading fix (#1019)
* TP-66615 | Agent location infinte loading fix * TP-66615 | Clickstream added
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import { useEffect } from 'react';
|
||||
import { Accordion } from '@navi/web-ui/lib/primitives';
|
||||
import { readQueryParams } from 'src/utils/QueryParamsHelper';
|
||||
import { createQueryParams, readQueryParams } from 'src/utils/QueryParamsHelper';
|
||||
import { AGENT_LIVE_LOCATION } from '../../constants/LiveLocatonTrackerConstants';
|
||||
import { useDispatch, useSelector } from 'react-redux';
|
||||
import { RootState } from 'src/store';
|
||||
@@ -15,7 +15,7 @@ import AccordionHeader from './AccordionHeader';
|
||||
import AccordionBody from './AccordionBody';
|
||||
import styles from './index.module.scss';
|
||||
import { addClickstreamEvent } from 'src/service/clickStreamEventService';
|
||||
import { AgentTrackingEvents } from 'src/service/clickStream.constant';
|
||||
import { AgentTrackingEvents, CLICKSTREAM_EVENT_NAMES } from 'src/service/clickStream.constant';
|
||||
import { DateFormat } from 'src/utils/DateHelper';
|
||||
import cx from 'classnames';
|
||||
|
||||
@@ -50,17 +50,40 @@ const AgentsAccordion = () => {
|
||||
return;
|
||||
}
|
||||
|
||||
if (queryParams?.AGENTID !== selectedAgent?.referenceId && agentLocations) {
|
||||
let selectedAgentData;
|
||||
if (agentLocations) {
|
||||
selectedAgentData = agentLocations?.find(
|
||||
agentLocation => agentLocation?.referenceId === queryParams?.AGENTID
|
||||
);
|
||||
if (!selectedAgentData) {
|
||||
addClickstreamEvent(CLICKSTREAM_EVENT_NAMES.LH_MAP_VIEW_INCORRECT_DATA, {
|
||||
refId: queryParams?.AGENTID
|
||||
});
|
||||
const url = createQueryParams({
|
||||
[AGENT_LIVE_LOCATION]: {
|
||||
...queryParams,
|
||||
AGENTID: '',
|
||||
LOCATION_TYPE: '',
|
||||
DATE: '',
|
||||
SELECTED_FEEDBACK_ID: '',
|
||||
CUSTOMER_ID: '',
|
||||
CASES_FILTER: ''
|
||||
}
|
||||
});
|
||||
navigate(url);
|
||||
return;
|
||||
}
|
||||
dispatch(setSelectedAgent(selectedAgentData));
|
||||
}
|
||||
|
||||
if (!selectedAgentData?.referenceId) return;
|
||||
|
||||
if (queryParams?.AGENTID !== selectedAgent?.referenceId) {
|
||||
const payload = {
|
||||
date: queryParams?.DATE || maxInputDate,
|
||||
referenceId: queryParams?.AGENTID
|
||||
};
|
||||
dispatch(getAgentDetails(payload));
|
||||
dispatch(
|
||||
setSelectedAgent(
|
||||
agentLocations?.find(agentLocation => agentLocation?.referenceId === queryParams?.AGENTID)
|
||||
)
|
||||
);
|
||||
}
|
||||
}, [agentLocations, queryParams?.AGENTID]);
|
||||
|
||||
|
||||
@@ -763,6 +763,10 @@ export const CLICKSTREAM_EVENT_NAMES = Object.freeze({
|
||||
LH_TASKS_UNREAD_TOGGLE_CLICKED: {
|
||||
name: 'LH_TASKS_UNREAD_TOGGLE_CLICKED',
|
||||
description: 'Tasks unread toggle clicked'
|
||||
},
|
||||
LH_MAP_VIEW_INCORRECT_DATA: {
|
||||
name: 'LH_MAP_VIEW_INCORRECT_DATA',
|
||||
description: 'Wrong reference id in url of map view'
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user