diff --git a/src/components/Ameyo/AmeyoCollapsibleToolbarV2.tsx b/src/components/Ameyo/AmeyoCollapsibleToolbarV2.tsx index b3ad1898..b900fccd 100644 --- a/src/components/Ameyo/AmeyoCollapsibleToolbarV2.tsx +++ b/src/components/Ameyo/AmeyoCollapsibleToolbarV2.tsx @@ -182,6 +182,7 @@ export const AmeyoCollapsibleToolbarV2 = (props: { const onCallInComingCallback = (phoneNumber: number, lan: string, crtObjectId: string) => { dispatch(setCurrentState(AmeyoCallState.RINGING)); + fetchAndSetConnectedCustomerData(); // this check is present in HRC and it is not required here , // it to make sure that all calls coming from ameyo while the agent is on call get automatically rejected // if (!ExtensionHandler.getIsPending()) { @@ -556,6 +557,9 @@ export const AmeyoCollapsibleToolbarV2 = (props: { }); }); }; + const onAmeyoAcceptError = () => { + resetButtonState(); + }; function navigateToCaseDetail() { if (!connectedCustomerData?.customerName) { @@ -629,6 +633,10 @@ export const AmeyoCollapsibleToolbarV2 = (props: { EXTENSION_LISTENER_TYPES.onAmeyoCallStatusChanged, onAmeyoCallDataChanged ); + ExtensionHelper.addExtensionListener( + EXTENSION_LISTENER_TYPES.ameyoAcceptError, + onAmeyoAcceptError + ); }, []); useEffect(() => { diff --git a/src/service/naviExtension.service.ts b/src/service/naviExtension.service.ts index 635c9a7f..28e4b805 100644 --- a/src/service/naviExtension.service.ts +++ b/src/service/naviExtension.service.ts @@ -107,6 +107,9 @@ const originalCallbacks = { } else { console.log('AMEYO_LH no pingPongClickstream callback found for sender', data?.sender); } + }, + acceptCallError: () => { + console.log('AMEYO_LH on accept call callback found '); } //when ameyo becomes loggedout, reset the state() }; @@ -430,6 +433,10 @@ function msgListner(msg: any) { if (message.type === MessagingType.PING_PONG_CLICKSTREAM) { extensionCallbacks.pingPongClickstream(message.data); } + if (message.type === MessagingType.ACCEPT_CALL_ERROR) { + console.log('message type in accept call error', message.type); + extensionCallbacks.acceptCallError(); + } if (message.type === MessagingType.SEND_CURRENT_CALL_STATUS) { const currentExtensionStatus = message.data; @@ -529,7 +536,8 @@ enum MessagingType { AMEYO_RELOADED = 'ameyoReloaded', PING_PONG_CLICKSTREAM = 'pingPongClickstream', GET_CURRENT_CALL_STATUS = 'getCurrentCallStatus', - SEND_CURRENT_CALL_STATUS = 'sendCurrentCallStatus' + SEND_CURRENT_CALL_STATUS = 'sendCurrentCallStatus', + ACCEPT_CALL_ERROR = 'acceptCallError' } interface MessagingRequest { diff --git a/src/utils/extension.utils.ts b/src/utils/extension.utils.ts index d42114fc..f730f269 100644 --- a/src/utils/extension.utils.ts +++ b/src/utils/extension.utils.ts @@ -25,7 +25,8 @@ export const enum EXTENSION_LISTENER_TYPES { 'manualLogin', 'extensionToggleMidCallClickEvent', 'ameyoReloaded', - 'recieveCallStatus' + 'recieveCallStatus', + 'acceptCallError' } export const ExtensionHelper = { @@ -111,6 +112,10 @@ export const ExtensionHelper = { naviExtension.registerCallBack({ recieveCallStatus: cb }); return; } + case EXTENSION_LISTENER_TYPES.acceptCallError: { + naviExtension.registerCallBack({ acceptCallError: cb }); + return; + } default: { return; }