NTP-26126 | synced with master
This commit is contained in:
@@ -11,7 +11,9 @@ export enum MessagingType {
|
||||
ON_AMEYO_AGENT_ON_BREAK = 'onAmeyoAgentOnBreak',
|
||||
ON_AMEYO_FORCED_LOGOUT = 'onAmeyoForcedLogout',
|
||||
ON_AMEYO_CALL_TRANSFER = 'onAmeyoCallTransfer',
|
||||
ON_AMEYO_AVAILABILITY_CHANGE = 'onAmeyoAvailabilityChange'
|
||||
ON_AMEYO_AVAILABILITY_CHANGE = 'onAmeyoAvailabilityChange',
|
||||
ON_SIP_RINGING = "onSipRinging",
|
||||
ON_CRM_NOTIFY_PUSH = 'onCrmNotifyPush'
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
|
||||
import exp from 'constants';
|
||||
import {SipAccountInfo} from "../../types.ts";
|
||||
import {MessagingType} from "./ajaxClient.ts";
|
||||
const noop = ()=>{}
|
||||
|
||||
let sTransferNumber;
|
||||
@@ -793,6 +794,10 @@ function onSipEventStack(e /*SIPml.Stack.Event*/) {
|
||||
btnHangUp.disabled = false;
|
||||
|
||||
startRingTone();
|
||||
window.postMessage({
|
||||
type: MessagingType.ON_SIP_RINGING
|
||||
});
|
||||
|
||||
|
||||
const sRemoteNumber = oSipSessionCall.getRemoteFriendlyName() || 'unknown';
|
||||
txtCallStatus.innerHTML = '<i>Incoming call from [<b>' + sRemoteNumber + '</b>]</i>';
|
||||
|
||||
@@ -2,8 +2,6 @@ import {MessagingType} from "./assets/js/ajaxClient.ts";
|
||||
import {CallStatus, PushType, CallState} from "./types.ts";
|
||||
import {parseQuerystring} from "@universal-call-sdk/common/lib/utils/parsingUtils.ts";
|
||||
import messagingType from "../types/MessagingType.ts";
|
||||
import metricsProcessor from "@universal-call-sdk/common/lib/utils/metricsProcessor.ts";
|
||||
import MetricsProcessor from "@universal-call-sdk/common/lib/utils/metricsProcessor.ts";
|
||||
|
||||
class CallStateManager {
|
||||
private state: CallState = {
|
||||
@@ -17,7 +15,6 @@ class CallStateManager {
|
||||
|
||||
private readonly MAX_CONNECTION_ATTEMPTS = 3;
|
||||
private connectionTimeout: ReturnType<typeof setTimeout> | null = null;
|
||||
private metricProcessor : metricsProcessor = {} as metricsProcessor
|
||||
|
||||
public sendConnectedMessage() {
|
||||
const customerInfo = this.state.customerInfo;
|
||||
@@ -98,10 +95,6 @@ class CallStateManager {
|
||||
type: MessagingType.ON_AMEYO_CALL_INCOMING,
|
||||
data: this.state.customerInfo
|
||||
});
|
||||
this?.metricProcessor?.pushCounterMetric({
|
||||
metricName: 'ringing_event_counter',
|
||||
flow: "ringing_event_counter"
|
||||
});
|
||||
break;
|
||||
case 'hungup':
|
||||
this.handleCallDisconnect();
|
||||
@@ -134,10 +127,13 @@ class CallStateManager {
|
||||
|
||||
const parsedQuery = parseQuerystring(crmURL);
|
||||
const userCRTObjectId = parsedQuery?.userCrtObjectId?.replaceAll('%40', '@');
|
||||
this?.metricProcessor?.pushCounterMetric({
|
||||
metricName: 'notify_push_event_counter',
|
||||
flow: "notify_push_event_counter"
|
||||
});
|
||||
window.postMessage({
|
||||
type: MessagingType.ON_CRM_NOTIFY_PUSH
|
||||
})
|
||||
window.postMessage({
|
||||
type: MessagingType.ON_AMEYO_CALL_TRANSFER,
|
||||
data
|
||||
})
|
||||
|
||||
this.state.customerInfo = {
|
||||
...this.state.customerInfo,
|
||||
@@ -196,10 +192,6 @@ class CallStateManager {
|
||||
};
|
||||
this.clearConnectionTimeout();
|
||||
}
|
||||
|
||||
public setMetricProcessor(metricProcessor: MetricsProcessor) {
|
||||
this.metricProcessor = metricProcessor
|
||||
}
|
||||
}
|
||||
|
||||
export const callStateManager = new CallStateManager();
|
||||
|
||||
@@ -120,7 +120,6 @@ class AmeyoAdapter implements IAdapter {
|
||||
this.initializeAmeyo();
|
||||
this.metricProcessor = metricProcessor;
|
||||
this.clickStreamProcessor = clickStreamProcessor;
|
||||
callStateManager.setMetricProcessor(metricProcessor)
|
||||
this.metricProcessor?.pushCounterMetric({
|
||||
metricName: 'initSdk',
|
||||
flow: "sdk_init_count"
|
||||
@@ -175,7 +174,21 @@ class AmeyoAdapter implements IAdapter {
|
||||
case MessagingType.ON_AMEYO_CALL_TRANSFER:
|
||||
this.callbacks.onCallTransferStatus(data.data);
|
||||
break;
|
||||
case MessagingType.ON_SIP_RINGING:
|
||||
this?.metricProcessor?.pushCounterMetric({
|
||||
metricName: "on_sip_ringing",
|
||||
flow: "",
|
||||
subFlow: "",
|
||||
})
|
||||
break;
|
||||
case MessagingType.ON_CRM_NOTIFY_PUSH:
|
||||
this?.metricProcessor?.pushCounterMetric({
|
||||
metricName: "on_crm_notify_push",
|
||||
flow: "",
|
||||
subFlow:"",
|
||||
})
|
||||
}
|
||||
|
||||
} catch (error) {
|
||||
console.error('Error handling message:', error);
|
||||
this.handleError('MESSAGE_HANDLING_ERROR', error);
|
||||
|
||||
@@ -7,7 +7,9 @@
|
||||
ON_AMEYO_AGENT_ON_BREAK = 'onAmeyoAgentOnBreak',
|
||||
ON_AMEYO_FORCED_LOGOUT = 'onAmeyoForcedLogout',
|
||||
ON_AMEYO_CALL_TRANSFER = 'onAmeyoCallTransfer',
|
||||
ON_AMEYO_AVAILABILITY_CHANGE= 'onAmeyoAvailablityChange'
|
||||
ON_AMEYO_AVAILABILITY_CHANGE= 'onAmeyoAvailablityChange',
|
||||
ON_SIP_RINGING = "onSipRinging",
|
||||
ON_CRM_NOTIFY_PUSH = 'onCrmNotifyPush'
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -7,10 +7,12 @@ import dts from 'vite-plugin-dts'
|
||||
export default defineConfig({
|
||||
plugins: [react(), dts({tsconfigPath: resolve(__dirname, 'tsconfig.build.json')})],
|
||||
build: {
|
||||
minify: 'esbuild', // Enable minification
|
||||
target: 'es2015', // Specify target environment
|
||||
lib: {
|
||||
entry: resolve(__dirname, 'lib/main.ts'),
|
||||
formats: ['es']
|
||||
},
|
||||
copyPublicDir:false,
|
||||
}
|
||||
},
|
||||
})
|
||||
|
||||
@@ -7,6 +7,8 @@ import dts from 'vite-plugin-dts'
|
||||
export default defineConfig({
|
||||
plugins: [react(), dts({tsconfigPath: resolve(__dirname, 'tsconfig.build.json')})],
|
||||
build: {
|
||||
minify: 'esbuild', // Enable minification
|
||||
target: 'es2015', // Specify target environment,
|
||||
lib: {
|
||||
entry: resolve(__dirname, 'lib/main.ts'),
|
||||
formats: ['es']
|
||||
|
||||
@@ -7,6 +7,8 @@ import dts from 'vite-plugin-dts'
|
||||
export default defineConfig({
|
||||
plugins: [react(), dts({tsconfigPath: resolve(__dirname, 'tsconfig.build.json')})],
|
||||
build: {
|
||||
minify: 'esbuild', // Enable minification
|
||||
target: 'es2015', // Specify target environment
|
||||
lib: {
|
||||
entry: resolve(__dirname, 'lib/main.ts'),
|
||||
formats: ['es']
|
||||
|
||||
Reference in New Issue
Block a user