From de9c3852c340e7e436e94888ba61e43fc7e9e7a3 Mon Sep 17 00:00:00 2001 From: Embbnux Ji Date: Mon, 9 Sep 2024 13:33:18 +0800 Subject: [PATCH] fix: disposition undefined issue (#109) --- src/adapter.ts | 2 ++ src/modules/EvCallDisposition/index.ts | 31 ++++++++++++++++++++++++++ src/modules/Phone/index.ts | 2 +- 3 files changed, 34 insertions(+), 1 deletion(-) create mode 100644 src/modules/EvCallDisposition/index.ts diff --git a/src/adapter.ts b/src/adapter.ts index bd8fcc4..58b5f51 100644 --- a/src/adapter.ts +++ b/src/adapter.ts @@ -33,6 +33,7 @@ const { enablePopup, popupPageUri, jwt, + hideCallNote, } = parseUri(paramsUri); function obj2uri(obj) { @@ -58,6 +59,7 @@ const appUri = `${appUrl}?${obj2uri({ fromAdapter: 1, fromPopup, jwt, + hideCallNote, _t: Date.now(), })}`; diff --git a/src/modules/EvCallDisposition/index.ts b/src/modules/EvCallDisposition/index.ts new file mode 100644 index 0000000..983aed2 --- /dev/null +++ b/src/modules/EvCallDisposition/index.ts @@ -0,0 +1,31 @@ +import { Module } from '@ringcentral-integration/commons/lib/di'; + +import { EvCallDisposition as BaseEvCallDisposition } from '@ringcentral-integration/engage-voice-widgets/modules/EvCallDisposition'; + +@Module({ + deps: [], +}) +class EvCallDisposition extends BaseEvCallDisposition { + // override to fix call disposition undefined issue. + override disposeCall(id: string) { + const call = this._deps.evCallHistory.callsMapping[id]; + const callDisposition = this.callsMapping[id]; + if (!callDisposition) { + return; + } + const isDisposed = + this.dispositionStateMapping[id] && + this.dispositionStateMapping[id].disposed; + if (!call.outdialDispositions || isDisposed) return; + + this._deps.evClient.dispositionCall({ + uii: call.uii, + dispId: callDisposition.dispositionId, + notes: callDisposition.notes, + }); + + this.setDispositionState(id, { disposed: true }); + } +} + +export { EvCallDisposition }; diff --git a/src/modules/Phone/index.ts b/src/modules/Phone/index.ts index d0ee26e..f0d9ccf 100644 --- a/src/modules/Phone/index.ts +++ b/src/modules/Phone/index.ts @@ -10,7 +10,6 @@ import { EvActiveCallListUI } from '@ringcentral-integration/engage-voice-widget import { EvAgentScript } from '@ringcentral-integration/engage-voice-widgets/modules/EvAgentScript'; // import { EvAuth } from '@ringcentral-integration/engage-voice-widgets/modules/EvAuth'; import { EvCallDataSource } from '@ringcentral-integration/engage-voice-widgets/modules/EvCallDataSource'; -import { EvCallDisposition } from '@ringcentral-integration/engage-voice-widgets/modules/EvCallDisposition'; import { EvCallMonitor } from '@ringcentral-integration/engage-voice-widgets/modules/EvCallMonitor'; import { EvDialerUI } from '@ringcentral-integration/engage-voice-widgets/modules/EvDialerUI'; import { EvManualDialSettingsUI } from '@ringcentral-integration/engage-voice-widgets/modules/EvManualDialSettingsUI'; @@ -67,6 +66,7 @@ import OAuth from '../OAuth'; import { Adapter } from '../Adapter'; import { ThirdPartyService } from '../ThirdPartyService'; import { EvCall } from '../EvCall'; +import { EvCallDisposition } from '../EvCallDisposition'; import { EvActivityCallUI } from '../EvActivityCallUI'; import { EvCallHistoryUI } from '../EvCallHistoryUI'; import { EvCallHistory } from '../EvCallHistory';