TP-11|Kunal|Ameyo diagnostic tool (#1008)

* TP-11|Kunal| created fixed height virtualization component

* TP-11|Kunal| created fixed height virtualization component

* TP-111|Kunal|ameyo diagnostic tool

* TP-111|Kunal|ameyo diagnostic tool

* TP-68653|Kunal|Ameyo diagnostic tool

* TP-68653|Kunal|Ameyo diagnostic tool

* TP-68653|Kunal|Ameyo diagnostic tool

* TP-68653|Kunal|Ameyo diagnostic tool

* TP-68653|Kunal|resolved PR comments

* TP-68653|Kunal|resolved PR comments
This commit is contained in:
Kunal Sharma
2024-07-04 15:32:02 +05:30
committed by GitHub
parent 52e5f0e788
commit 79dd7aae95
9 changed files with 387 additions and 15 deletions

View File

@@ -77,6 +77,7 @@ import { LOCAL_STORAGE_KEYS } from '@cp/src/constants/StorageKeys';
import {
resetState,
setAmeyoCallData,
setAmeyoDowntimeTooltipVisiblity,
setAmeyoExtensionToggleOn,
setButtonLoadingStates,
setConnectedCustomerData,
@@ -90,10 +91,17 @@ import {
setShouldPlayRingtone,
setShowAmeyoErroneousMsg,
setTelephoneSource,
setToolbarAuthState,
setAmeyoDowntimeTooltipVisiblity
setToolbarAuthState
} from '@cp/reducers/ameyoSlice';
import { BUBBLE_COLORS, BUTTON_ENABLED_TIMEOUT } from '@cp/constants/ameyoConstants';
import {
AMEYO_DIAGNOSTIC_EVENT_INTERVAL,
AmeyoDiagnosticEventGroup,
AmeyoDiagnosticEventNames,
AmeyoDiagnosticsMetricTypes,
BUBBLE_COLORS,
BUTTON_ENABLED_TIMEOUT,
GAUGE_METRIC
} from '@cp/constants/ameyoConstants';
import { poll } from '@cp/utils/polling';
import { getCallBridgeData } from '@cp/pages/auth/AuthActions';
import { noop } from '@utils/common';
@@ -105,7 +113,7 @@ import {
PopperTrigger
} from '@cp/components/Popper/Popper';
import AmeyoPopper from '@cp/components/Ameyo/components/AmeyoPopper';
import { FloatingContext } from '@floating-ui/react';
import useAmeyoDiagnostics from '@cp/hooks/useAmeyoDiagnostics';
type IInteractionData = {
interactionId: string;
@@ -180,6 +188,7 @@ export const AmeyoCollapsibleToolbarV3 = (props: {
const [callCountEnabled, setCallCountEnabled] = useState(false);
const ameyoCallsCountIntervalRef = useRef<() => void>();
const isAgentOnline = useSelector((store: RootState) => store.common.isAgentOnline);
const { sendAmeyoDiagnostics } = useAmeyoDiagnostics();
// --------------- ***** ---------------------
// there is a third state called authError, in which the user
@@ -373,6 +382,12 @@ export const AmeyoCollapsibleToolbarV3 = (props: {
function onAmeyoAvailabiltyChanged(isAvailable: boolean) {
dispatch(setIsAvailable(isAvailable));
sendAmeyoDiagnostics({
metricName: AmeyoDiagnosticEventNames.ameyoAvailabilityStatus.name,
metricType: AmeyoDiagnosticEventNames.ameyoAvailabilityStatus.metricType,
value: isAvailable ? GAUGE_METRIC.ON : GAUGE_METRIC.OFF,
group: AmeyoDiagnosticEventGroup.TELE
});
}
function onAmeyoCallDataChanged(callData: AmeyoCallData) {
@@ -400,11 +415,23 @@ export const AmeyoCollapsibleToolbarV3 = (props: {
campaignId,
ameyoStatus: ExtensionHandler.currentAmeyoStatus()
});
dispatch(setIsAmeyoErronous(true));
sendAmeyoDiagnostics({
metricName: AmeyoDiagnosticEventNames.ameyoErroneousCount.name,
metricType: AmeyoDiagnosticEventNames.ameyoErroneousCount.metricType,
value: '',
group: AmeyoDiagnosticEventGroup.TELE
});
};
const onToggleAmeyoStatus = (onToggleAmeyoStatusData: onToggleAmeyoStatusDataProps) => {
sendAmeyoDiagnostics({
metricName: AmeyoDiagnosticEventNames.extensionStatus.name,
metricType: AmeyoDiagnosticEventNames.extensionStatus.metricType,
value:
onToggleAmeyoStatusData.ameyoToggleNewStatus === 'ON' ? GAUGE_METRIC.ON : GAUGE_METRIC.OFF,
group: AmeyoDiagnosticEventGroup.TELE
});
if (onToggleAmeyoStatusData.ameyoToggleNewStatus === AmeyoToggleNewStatus.OFF) {
addClickstreamEvent(AMEYO_SESSION_EVENTS.LH_AMEYO_EXTENSION_TOGGLE_OFF_CLICKED, {
campaignId,
@@ -986,11 +1013,37 @@ export const AmeyoCollapsibleToolbarV3 = (props: {
);
}, []);
const onAmeyoDiagnosticEventCallback = (messageType: string) => {
sendAmeyoDiagnostics({
metricName: messageType,
metricType: AmeyoDiagnosticEventNames?.[messageType]
.metricType as AmeyoDiagnosticsMetricTypes,
value: '',
group: AmeyoDiagnosticEventGroup.TELE
});
};
useEffect(() => {
ExtensionHelper.addExtensionListener(
EXTENSION_LISTENER_TYPES.toggleAmeyoStatus,
onToggleAmeyoStatus
);
ExtensionHelper.addExtensionListener(
EXTENSION_LISTENER_TYPES.acceptCallClickFailure,
onAmeyoDiagnosticEventCallback
);
ExtensionHelper.addExtensionListener(
EXTENSION_LISTENER_TYPES.rejectCallClickFailure,
onAmeyoDiagnosticEventCallback
);
ExtensionHelper.addExtensionListener(
EXTENSION_LISTENER_TYPES.disconnectCallClickFailure,
onAmeyoDiagnosticEventCallback
);
ExtensionHelper.addExtensionListener(
EXTENSION_LISTENER_TYPES.disposeCallClickFailure,
onAmeyoDiagnosticEventCallback
);
}, []);
useEffect(() => {
@@ -1022,6 +1075,30 @@ export const AmeyoCollapsibleToolbarV3 = (props: {
};
}, [isVisible]);
const extensionOnPolling = useRef<() => void>();
useEffect(() => {
if (ameyoExtensionToggleOn) {
extensionOnPolling.current = poll(
() => {
sendAmeyoDiagnostics({
metricName: AmeyoDiagnosticEventNames.extensionOnTime.name,
metricType: AmeyoDiagnosticEventNames.extensionOnTime.metricType,
value: '',
group: AmeyoDiagnosticEventGroup.TELE
});
},
undefined,
AMEYO_DIAGNOSTIC_EVENT_INTERVAL,
noop
);
} else {
isFunction(extensionOnPolling.current) && extensionOnPolling.current();
}
return () => {
isFunction(extensionOnPolling.current) && extensionOnPolling.current();
};
}, [ameyoExtensionToggleOn]);
return (
<div className={styles.container} ref={currentRef}>
<div className={styles.sideToolbarAmeyoIconsWrapper}>

View File

@@ -1,3 +1,5 @@
import { Roles } from '@cp/pages/auth/constants/AuthConstants';
export const BUBBLE_COLORS = {
TRANSPARENT: 'rgba(250,250,250,0)', // default/don't know
ORANGE: '#FA9E33', // ready
@@ -6,3 +8,113 @@ export const BUBBLE_COLORS = {
};
export const BUTTON_ENABLED_TIMEOUT = 10000;
export enum AmeyoDiagnosticsMetricTypes {
COUNTER = 'COUNTER',
GAUGE = 'GAUGE',
HISTOGRAM = 'HISTOGRAM'
}
export interface IAmeyoDiagnosticsEventNames {
name: string;
metricType: AmeyoDiagnosticsMetricTypes;
description?: string;
}
export enum AmeyoDiagnosticEventGroup {
TELE = 'TELE',
FIELD = 'FIELD',
HRC = 'HRC'
}
export interface IAmeyoDiagnosticPayload {
metricName: string;
metricType: AmeyoDiagnosticsMetricTypes;
value: number | string;
group: AmeyoDiagnosticEventGroup;
subFlow?: string;
metaData?: Record<string, any>;
}
export interface IPublishMetricPayload {
agentReferenedId?: string;
agentExtensionVersion: string;
latestExtensionVersion: string;
campaignId: string;
flow: string;
metricType: AmeyoDiagnosticsMetricTypes;
value: string;
roles?: Roles[];
group: AmeyoDiagnosticEventGroup;
clientTs: number;
subFlow?: string;
metaData?: Record<string, any>;
}
interface AmeyoDiagnosticsEvents<T> {
[key: string]: T;
}
export const AmeyoDiagnosticEventNames: AmeyoDiagnosticsEvents<IAmeyoDiagnosticsEventNames> =
Object.freeze({
agentExtensionVersion: {
name: 'agentExtensionVersion',
metricType: AmeyoDiagnosticsMetricTypes.GAUGE,
description: 'Agent Extension Version'
},
latestExtensionVersion: {
name: 'latestExtensionVersion',
metricType: AmeyoDiagnosticsMetricTypes.GAUGE,
description: 'Latest Extension Version'
},
ameyoErroneousCount: {
name: 'ameyoErroneousCount',
metricType: AmeyoDiagnosticsMetricTypes.COUNTER,
description: 'Ameyo Erroneous Count'
},
extensionStatus: {
name: 'extensionStatus',
metricType: AmeyoDiagnosticsMetricTypes.GAUGE,
description: 'Extension Status (ON/OFF)'
},
ameyoAvailabilityStatus: {
name: 'ameyoAvailabilityStatus',
metricType: AmeyoDiagnosticsMetricTypes.GAUGE
},
lastAmeyoActiveTimeStamp: {
name: 'lastAmeyoActiveTimeStamp',
metricType: AmeyoDiagnosticsMetricTypes.GAUGE
},
amverageCallHandlingTime: {
name: 'amverageCallHandlingTime',
metricType: AmeyoDiagnosticsMetricTypes.GAUGE
},
acceptButtonClickFailedCount: {
name: 'acceptButtonClickFailedCount',
metricType: AmeyoDiagnosticsMetricTypes.COUNTER
},
rejectButtonClickFailedCount: {
name: 'rejectButtonClickFailedCount',
metricType: AmeyoDiagnosticsMetricTypes.COUNTER
},
disconnectButtonClickFailedCount: {
name: 'disconnectButtonClickFailedCount',
metricType: AmeyoDiagnosticsMetricTypes.COUNTER
},
disposeButtonClickFailedCount: {
name: 'disconnectButtonClickFailedCount',
metricType: AmeyoDiagnosticsMetricTypes.COUNTER
},
extensionOnTime: {
name: 'extensionOnTime',
metricType: AmeyoDiagnosticsMetricTypes.COUNTER,
description: 'Extension On Time'
}
});
export const AMEYO_DIAGNOSTIC_EVENT_INTERVAL = 30 * 1000; // 30 seconds
export enum GAUGE_METRIC {
ON = 1,
OFF = 0
}

View File

@@ -0,0 +1,39 @@
import { RootState } from '@cp/src/store';
import { useSelector } from 'react-redux';
import { publishMetric } from '@cp/utils/ameyoDiagnostics';
import { useMemo } from 'react';
import { Roles } from '@cp/pages/auth/constants/AuthConstants';
import { LocalStorage } from '@cp/utils/StorageUtils';
import { WA_PLUGIN_VERSION } from '@cp/pages/auth/AuthActions';
import { IAmeyoDiagnosticPayload } from '@cp/constants/ameyoConstants';
const useAmeyoDiagnostics = () => {
const { referenceId, roles } = useSelector((state: RootState) => state.common.userData);
const teleAmeyoCampaignId = useSelector(
(store: RootState) => store?.common?.userData?.campaignId
);
const hrcAmeyoCampaignId = useSelector((store: RootState) => store?.humanReminder?.campaignId);
const isHRCAgent = useMemo(() => roles?.includes(Roles.ROLE_HUMAN_REMINDER_AGENT), [roles]);
const latestExtensionVersion = useSelector((state: RootState) => state?.common?.extensionVersion);
const sendAmeyoDiagnostics = (diagnostics: IAmeyoDiagnosticPayload) => {
publishMetric({
agentReferenedId: referenceId,
agentExtensionVersion: LocalStorage.getItem(WA_PLUGIN_VERSION),
latestExtensionVersion: latestExtensionVersion,
campaignId: `${isHRCAgent ? hrcAmeyoCampaignId : teleAmeyoCampaignId}`,
flow: diagnostics?.metricName,
metricType: diagnostics?.metricType,
value: diagnostics?.value,
roles: roles as Roles[],
group: diagnostics?.group,
clientTs: new Date().getTime(),
subFlow: diagnostics?.subFlow || '',
metaData: diagnostics?.metaData
});
};
return { sendAmeyoDiagnostics };
};
export default useAmeyoDiagnostics;

View File

@@ -69,6 +69,12 @@ import UpdateExtensionNudge from '@cp/components/UpdateExtensionNudge';
import BreakTime from '@cp/components/BreakTime/BreakTime';
import { ameyoDowntimeEventProcessor } from '@cp/utils/fcmProcessors';
import downloadAssetsFromFirestore from '../pages/LonghornTheme';
import {
AmeyoDiagnosticEventGroup,
AmeyoDiagnosticEventNames,
AmeyoDiagnosticsMetricTypes
} from '@cp/constants/ameyoConstants';
import useAmeyoDiagnostics from '@cp/hooks/useAmeyoDiagnostics';
const defaultRoute = {
key: 'DEFAULT',
@@ -382,10 +388,17 @@ function DefaultLayout() {
agentRefrenceId: referenceId
});
};
const { sendAmeyoDiagnostics } = useAmeyoDiagnostics();
useEffect(() => {
if (extensionVersion) {
const currentExtensionVersion = LocalStorage.getItem(WA_PLUGIN_VERSION);
sendAmeyoDiagnostics({
metricName: AmeyoDiagnosticEventNames.latestExtensionVersion.name,
metricType: AmeyoDiagnosticEventNames.latestExtensionVersion.metricType,
value: '',
group: isDc97User ? AmeyoDiagnosticEventGroup.HRC : AmeyoDiagnosticEventGroup.TELE
});
if (currentExtensionVersion !== extensionVersion && currentExtensionVersion) {
setShowUpdateExtensionPopper(true);
} else {

View File

@@ -13,7 +13,6 @@ import store, { RootState } from 'src/store';
import {
refreshCallData,
setCampaignId,
setDisconnectApiLoading,
setIsAgentOnline,
setIsAmeyoErroneous,
setIsCallConnected,
@@ -36,7 +35,6 @@ import {
getAgentStats,
getCustomerDetails,
getCustomerDetailsRecalibrate,
getCustomerImage,
sendSlackAlert,
setAgentAvailability,
setCallStatus,
@@ -47,7 +45,6 @@ import ameyoRinging from '../../assets/audio/ring.wav';
import CallWaitingScreen from './dc-97/CallWaitingScreen';
import {
resetHumanReminderCustomerDetails,
setHumanReminderCustomerDetails,
setHumanReminderCustomerDetailsLoading
} from 'src/reducers/commonSlice';
import HrCustomerDetails from './HrCustomerDetails';
@@ -66,12 +63,19 @@ import {
} from './dc-97/dc97Constant';
import { pushToLocalStorage } from '../../utils/StorageUtils';
import { noop } from '@utils/common';
import { resetState, setCurrentState } from '@cp/reducers/ameyoSlice';
import { AmeyoCallState } from '@cp/components/Ameyo/constants';
import { resetState } from '@cp/reducers/ameyoSlice';
import isLitmusExperimentEnabled from '@cp/utils/isLitmusExperimentEnabled';
import { LITMUS_EXPERIMENT_NAMES } from '@cp/constants/litmusExperimentNames';
import { getCurrentAmeyoCallState } from '@cp/components/Ameyo/utils';
import axiosInstance, { ApiKeys, getApiUrl, logError } from '@cp/utils/ApiHelper';
import {
AMEYO_DIAGNOSTIC_EVENT_INTERVAL,
AmeyoDiagnosticEventGroup,
AmeyoDiagnosticEventNames,
AmeyoDiagnosticsMetricTypes,
GAUGE_METRIC
} from '@cp/constants/ameyoConstants';
import useAmeyoDiagnostics from '@cp/hooks/useAmeyoDiagnostics';
import { poll } from '@cp/utils/polling';
import { isFunction } from '@cp/utils/commonUtils';
const HrDashBoard = () => {
const dispatch = useDispatch();
@@ -114,6 +118,7 @@ const HrDashBoard = () => {
}));
const callDisconnectSource = useRef<HRC_CALL_DISCONNECT_SOURCE_TYPE | null>(null);
const { sendAmeyoDiagnostics } = useAmeyoDiagnostics();
const sendSlackNotification = (refId: string) => {
setAgentAvailability(AGENT_AVAILABILITY.AGENT_IDLE, refId);
@@ -200,6 +205,30 @@ const HrDashBoard = () => {
}
}, [userData]);
const extensionOnPolling = useRef<() => void>();
useEffect(() => {
if (isAgentOnline) {
extensionOnPolling.current = poll(
() => {
sendAmeyoDiagnostics({
metricName: AmeyoDiagnosticEventNames.extensionOnTime.name,
metricType: AmeyoDiagnosticEventNames.extensionOnTime.metricType,
value: '',
group: AmeyoDiagnosticEventGroup.HRC
});
},
undefined,
AMEYO_DIAGNOSTIC_EVENT_INTERVAL,
noop
);
} else {
isFunction(extensionOnPolling.current) && extensionOnPolling.current();
}
return () => {
isFunction(extensionOnPolling.current) && extensionOnPolling.current();
};
}, [isAgentOnline]);
const onCallAcceptedHandler = () => {
ExtensionHandler.acceptCall();
setShowCallingPopup(false);
@@ -273,6 +302,12 @@ const HrDashBoard = () => {
campaignId,
agentReferenceId: userData?.referenceId
});
sendAmeyoDiagnostics({
metricName: AmeyoDiagnosticEventNames.ameyoErroneousCount.name,
metricType: AmeyoDiagnosticEventNames.ameyoErroneousCount.metricType,
value: '',
group: AmeyoDiagnosticEventGroup.HRC
});
dispatch(setIsAmeyoErroneous(true));
};
@@ -301,6 +336,13 @@ const HrDashBoard = () => {
ameyoTogglePrevStatus: 'OFF' | 'ON';
ameyoToggleNewStatus: 'OFF' | 'ON';
}) => {
sendAmeyoDiagnostics({
metricName: AmeyoDiagnosticEventNames.extensionStatus.name,
metricType: AmeyoDiagnosticEventNames.extensionStatus.metricType,
value:
onToggleAmeyoStatusData.ameyoToggleNewStatus === 'ON' ? GAUGE_METRIC.ON : GAUGE_METRIC.OFF,
group: AmeyoDiagnosticEventGroup.HRC
});
addClickstreamEvent(HRC_CLICKSTREAM.HRC_TOGGLE_AMEYO_CLICKED, {
reminderRefId,
campaignId,
@@ -335,6 +377,16 @@ const HrDashBoard = () => {
});
};
const onAmeyoDiagnosticEventCallback = (messageType: string) => {
sendAmeyoDiagnostics({
metricName: messageType,
metricType: AmeyoDiagnosticEventNames?.[messageType]
.metricType as AmeyoDiagnosticsMetricTypes,
value: '',
group: AmeyoDiagnosticEventGroup.HRC
});
};
useEffect(() => {
const onCallInComingCallback = (phoneNumber: number, lan: string, crtObjectId: string) => {
addClickstreamEvent(HRC_CLICKSTREAM[HRC_EVENTS.HRC_CALL_RINGING_EVENT], {
@@ -411,6 +463,12 @@ const HrDashBoard = () => {
setAgentAvailability(
isAvailable ? AGENT_AVAILABILITY.AGENT_ONLINE : AGENT_AVAILABILITY.AGENT_OFFLINE
);
sendAmeyoDiagnostics({
metricName: AmeyoDiagnosticEventNames.ameyoAvailabilityStatus.name,
metricType: AmeyoDiagnosticEventNames.ameyoAvailabilityStatus.metricType,
value: isAvailable ? GAUGE_METRIC.ON : GAUGE_METRIC.OFF,
group: AmeyoDiagnosticEventGroup.HRC
});
};
const onSendCurrentCallStatus = async (ameyoData: IAmeyoRecalibratedData) => {
@@ -605,6 +663,22 @@ const HrDashBoard = () => {
EXTENSION_LISTENER_TYPES.sendCurrentCallStatusAndRecalibrate,
onSendCurrentCallStatus
);
ExtensionHelper.addExtensionListener(
EXTENSION_LISTENER_TYPES.acceptCallClickFailure,
onAmeyoDiagnosticEventCallback
);
ExtensionHelper.addExtensionListener(
EXTENSION_LISTENER_TYPES.rejectCallClickFailure,
onAmeyoDiagnosticEventCallback
);
ExtensionHelper.addExtensionListener(
EXTENSION_LISTENER_TYPES.disconnectCallClickFailure,
onAmeyoDiagnosticEventCallback
);
ExtensionHelper.addExtensionListener(
EXTENSION_LISTENER_TYPES.disposeCallClickFailure,
onAmeyoDiagnosticEventCallback
);
}, []);
const onCallDisConnectedCallback = (phoneNumber: number, lan: string, crtObjectId: string) => {

View File

@@ -116,6 +116,18 @@ const originalCallbacks = {
},
sendCurrentCallStatusAndRecalibrate: (data?: IAmeyoRecalibratedData) => {
console.log('AMEYO_LH on sendCurrentCallStatusAndRecalibrate call callback found ');
},
acceptCallClickFailure: (messageType: MessagingType) => {
console.log('AMEYO_LH on acceptCallClickFailure call callback found ');
},
rejectCallClickFailure: (messageType: MessagingType) => {
console.log('AMEYO_LH on rejectCallClickFailure call callback found ');
},
disconnectCallClickFailure: (messageType: MessagingType) => {
console.log('AMEYO_LH on disconnectCallClickFailure call callback found ');
},
disposeCallClickFailure: (messageType: MessagingType) => {
console.log('AMEYO_LH on disposeCallClickFailure call callback found ');
}
//when ameyo becomes loggedout, reset the state()
};
@@ -489,6 +501,18 @@ function msgListner(msg: any) {
if (message.type === MessagingType.SEND_CURRENT_CALL_STATUS_AND_RECALIBRATE) {
extensionCallbacks.sendCurrentCallStatusAndRecalibrate(message?.data);
}
if (message.type === MessagingType.ACCEPT_CALL_CLICK_FAILURE) {
extensionCallbacks.acceptCallClickFailure(message.type);
}
if (message.type === MessagingType.REJECT_CALL_CLICK_FAILURE) {
extensionCallbacks.rejectCallClickFailure(message.type);
}
if (message.type === MessagingType.DISCONNECT_CALL_CLICK_FAILURE) {
extensionCallbacks.disconnectCallClickFailure(message.type);
}
if (message.type === MessagingType.DISPOSE_CALL_CLICK_FAILURE) {
extensionCallbacks.disposeCallClickFailure(message.type);
}
}
export interface NaviExtensionCallbackRegister {
onCallIncoming: (phoneNumber: string, lan: string, crtObjectId: string) => void;
@@ -552,7 +576,11 @@ enum MessagingType {
SEND_CURRENT_CALL_STATUS = 'sendCurrentCallStatus',
ACCEPT_CALL_ERROR = 'acceptCallError',
SEND_CURRENT_CALL_STATUS_AND_RECALIBRATE = 'sendCurrentCallStatusAndRecalibrate',
FOCUS_CHROME_EXTENSIONS_PAGE = 'focusChromeExtensionsPage'
FOCUS_CHROME_EXTENSIONS_PAGE = 'focusChromeExtensionsPage',
ACCEPT_CALL_CLICK_FAILURE = 'acceptCallClickFailure',
REJECT_CALL_CLICK_FAILURE = 'rejectCallClickFailure',
DISCONNECT_CALL_CLICK_FAILURE = 'disconnectCallClickFailure',
DISPOSE_CALL_CLICK_FAILURE = 'disposeCallClickFailure'
}
interface MessagingRequest {

View File

@@ -224,7 +224,8 @@ export enum ApiKeys {
GET_ALLOCATION_ORIGINAL_FILE,
GET_ALLOCATION_FAILURE_REPORT,
DOWNLOAD_ALLOCATION_ORIGINAL_FILE,
REQUEST_LOAN_ACCOUNT_STATEMENT
REQUEST_LOAN_ACCOUNT_STATEMENT,
PUBLISH_METRICS_TO_GRAPHANA
}
// TODO: try to get rid of `as`
@@ -448,6 +449,7 @@ API_URLS[ApiKeys.GET_ALLOCATION_FAILURE_REPORT] = 'uploads/{referenceId}/failure
API_URLS[ApiKeys.DOWNLOAD_ALLOCATION_ORIGINAL_FILE] =
'/case-allocations/{referenceId}/uploaded-file';
API_URLS[ApiKeys.REQUEST_LOAN_ACCOUNT_STATEMENT] = '/documents/{lan}/loan-account-statement';
API_URLS[ApiKeys.PUBLISH_METRICS_TO_GRAPHANA] = '/ameyo-stats/publish-diagnostic-data';
// TODO: try to get rid of `as`
const MOCK_API_URLS: Record<ApiKeys, string> = {} as Record<ApiKeys, string>;

View File

@@ -0,0 +1,7 @@
import axiosInstance, { ApiKeys, getApiUrl } from '@cp/utils/ApiHelper';
import { IPublishMetricPayload } from '@cp/constants/ameyoConstants';
export const publishMetric = (payload: IPublishMetricPayload) => {
const url = getApiUrl(ApiKeys.PUBLISH_METRICS_TO_GRAPHANA);
axiosInstance.post(url, payload);
};

View File

@@ -29,7 +29,11 @@ export const enum EXTENSION_LISTENER_TYPES {
'acceptCallError',
'sendCurrentCallStatus',
'sendCurrentCallStatusAndRecalibrate',
'focusChromeExtensionsPage'
'focusChromeExtensionsPage',
'acceptCallClickFailure',
'rejectCallClickFailure',
'disconnectCallClickFailure',
'disposeCallClickFailure'
}
export const ExtensionHelper = {
@@ -127,6 +131,22 @@ export const ExtensionHelper = {
naviExtension.registerCallBack({ sendCurrentCallStatusAndRecalibrate: cb });
return;
}
case EXTENSION_LISTENER_TYPES.acceptCallClickFailure: {
naviExtension.registerCallBack({ acceptCallClickFailure: cb });
return;
}
case EXTENSION_LISTENER_TYPES.rejectCallClickFailure: {
naviExtension.registerCallBack({ rejectCallClickFailure: cb });
return;
}
case EXTENSION_LISTENER_TYPES.disconnectCallClickFailure: {
naviExtension.registerCallBack({ disconnectCallClickFailure: cb });
return;
}
case EXTENSION_LISTENER_TYPES.disposeCallClickFailure: {
naviExtension.registerCallBack({ disposeCallClickFailure: cb });
return;
}
default: {
return;
}