NTP-26126 | adapter sanity (#34)
* NTP-26126 | adapter sanity * NTP-26126 | package bump * Publish - @universal-call-sdk/adapter-ameyo@1.1.23 - @universal-call-sdk/common@1.1.16 - @universal-call-sdk/core@1.1.14 * NTP-26126 | added more events * NTP-26126 | adapter sanity * NTP-26126v | metric processor * NTP-26126 | package bump * Publish - @universal-call-sdk/adapter-ameyo@1.1.33 - @universal-call-sdk/common@1.1.18 - @universal-call-sdk/core@1.1.15 --------- Co-authored-by: varnit goyal <github.cicd@navi.com>
This commit is contained in:
@@ -3,6 +3,22 @@
|
|||||||
All notable changes to this project will be documented in this file.
|
All notable changes to this project will be documented in this file.
|
||||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||||
|
|
||||||
|
## 1.1.33 (2025-01-17)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @universal-call-sdk/adapter-ameyo
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## 1.1.23 (2025-01-16)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @universal-call-sdk/adapter-ameyo
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## 1.1.15 (2025-01-16)
|
## 1.1.15 (2025-01-16)
|
||||||
|
|
||||||
**Note:** Version bump only for package @universal-call-sdk/adapter-ameyo
|
**Note:** Version bump only for package @universal-call-sdk/adapter-ameyo
|
||||||
|
|||||||
@@ -6,6 +6,9 @@ import {v4 as uuid} from 'uuid';
|
|||||||
|
|
||||||
export const loginInAmeyo = (userId: string, password: string) => {
|
export const loginInAmeyo = (userId: string, password: string) => {
|
||||||
console.log('loginInAmeyo', userId, password);
|
console.log('loginInAmeyo', userId, password);
|
||||||
|
if(!userId || !password) {
|
||||||
|
return
|
||||||
|
}
|
||||||
return getResponseWithoutCors({
|
return getResponseWithoutCors({
|
||||||
url: `${window.BASE_AMEYO_URL}/ameyorestapi/userLogin/login`,
|
url: `${window.BASE_AMEYO_URL}/ameyorestapi/userLogin/login`,
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
|
|||||||
@@ -2,6 +2,8 @@ import {MessagingType} from "./assets/js/ajaxClient.ts";
|
|||||||
import {CallStatus, PushType, CallState} from "./types.ts";
|
import {CallStatus, PushType, CallState} from "./types.ts";
|
||||||
import {parseQuerystring} from "@universal-call-sdk/common/lib/utils/parsingUtils.ts";
|
import {parseQuerystring} from "@universal-call-sdk/common/lib/utils/parsingUtils.ts";
|
||||||
import messagingType from "../types/MessagingType.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 {
|
class CallStateManager {
|
||||||
private state: CallState = {
|
private state: CallState = {
|
||||||
@@ -15,6 +17,7 @@ class CallStateManager {
|
|||||||
|
|
||||||
private readonly MAX_CONNECTION_ATTEMPTS = 3;
|
private readonly MAX_CONNECTION_ATTEMPTS = 3;
|
||||||
private connectionTimeout: ReturnType<typeof setTimeout> | null = null;
|
private connectionTimeout: ReturnType<typeof setTimeout> | null = null;
|
||||||
|
private metricProcessor : metricsProcessor = {} as metricsProcessor
|
||||||
|
|
||||||
public sendConnectedMessage() {
|
public sendConnectedMessage() {
|
||||||
const customerInfo = this.state.customerInfo;
|
const customerInfo = this.state.customerInfo;
|
||||||
@@ -35,6 +38,7 @@ class CallStateManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private setConnectionTimeout() {
|
private setConnectionTimeout() {
|
||||||
this.clearConnectionTimeout();
|
this.clearConnectionTimeout();
|
||||||
this.connectionTimeout = setTimeout(() => {
|
this.connectionTimeout = setTimeout(() => {
|
||||||
@@ -94,6 +98,10 @@ class CallStateManager {
|
|||||||
type: MessagingType.ON_AMEYO_CALL_INCOMING,
|
type: MessagingType.ON_AMEYO_CALL_INCOMING,
|
||||||
data: this.state.customerInfo
|
data: this.state.customerInfo
|
||||||
});
|
});
|
||||||
|
this?.metricProcessor?.pushCounterMetric({
|
||||||
|
metricName: 'ringing_event_counter',
|
||||||
|
flow: "ringing_event_counter"
|
||||||
|
});
|
||||||
break;
|
break;
|
||||||
case 'hungup':
|
case 'hungup':
|
||||||
this.handleCallDisconnect();
|
this.handleCallDisconnect();
|
||||||
@@ -126,6 +134,10 @@ class CallStateManager {
|
|||||||
|
|
||||||
const parsedQuery = parseQuerystring(crmURL);
|
const parsedQuery = parseQuerystring(crmURL);
|
||||||
const userCRTObjectId = parsedQuery?.userCrtObjectId?.replaceAll('%40', '@');
|
const userCRTObjectId = parsedQuery?.userCrtObjectId?.replaceAll('%40', '@');
|
||||||
|
this?.metricProcessor?.pushCounterMetric({
|
||||||
|
metricName: 'notify_push_event_counter',
|
||||||
|
flow: "notify_push_event_counter"
|
||||||
|
});
|
||||||
|
|
||||||
this.state.customerInfo = {
|
this.state.customerInfo = {
|
||||||
...this.state.customerInfo,
|
...this.state.customerInfo,
|
||||||
@@ -184,6 +196,10 @@ class CallStateManager {
|
|||||||
};
|
};
|
||||||
this.clearConnectionTimeout();
|
this.clearConnectionTimeout();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public setMetricProcessor(metricProcessor: MetricsProcessor) {
|
||||||
|
this.metricProcessor = metricProcessor
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export const callStateManager = new CallStateManager();
|
export const callStateManager = new CallStateManager();
|
||||||
|
|||||||
@@ -120,6 +120,7 @@ class AmeyoAdapter implements IAdapter {
|
|||||||
this.initializeAmeyo();
|
this.initializeAmeyo();
|
||||||
this.metricProcessor = metricProcessor;
|
this.metricProcessor = metricProcessor;
|
||||||
this.clickStreamProcessor = clickStreamProcessor;
|
this.clickStreamProcessor = clickStreamProcessor;
|
||||||
|
callStateManager.setMetricProcessor(metricProcessor)
|
||||||
this.metricProcessor?.pushCounterMetric({
|
this.metricProcessor?.pushCounterMetric({
|
||||||
metricName: 'initSdk',
|
metricName: 'initSdk',
|
||||||
flow: "sdk_init_count"
|
flow: "sdk_init_count"
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@universal-call-sdk/adapter-ameyo",
|
"name": "@universal-call-sdk/adapter-ameyo",
|
||||||
"version": "1.1.15",
|
"version": "1.1.33",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "vite",
|
"dev": "vite",
|
||||||
@@ -9,7 +9,7 @@
|
|||||||
"preview": "vite preview"
|
"preview": "vite preview"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@universal-call-sdk/common": "^1.1.13",
|
"@universal-call-sdk/common": "^1.1.18",
|
||||||
"uuid": "^11.0.3"
|
"uuid": "^11.0.3"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
|||||||
@@ -3,6 +3,22 @@
|
|||||||
All notable changes to this project will be documented in this file.
|
All notable changes to this project will be documented in this file.
|
||||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||||
|
|
||||||
|
## 1.1.18 (2025-01-17)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @universal-call-sdk/common
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## 1.1.16 (2025-01-16)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @universal-call-sdk/common
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## 1.1.13 (2025-01-16)
|
## 1.1.13 (2025-01-16)
|
||||||
|
|
||||||
**Note:** Version bump only for package @universal-call-sdk/common
|
**Note:** Version bump only for package @universal-call-sdk/common
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@universal-call-sdk/common",
|
"name": "@universal-call-sdk/common",
|
||||||
"version": "1.1.13",
|
"version": "1.1.18",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "vite",
|
"dev": "vite",
|
||||||
|
|||||||
@@ -3,6 +3,22 @@
|
|||||||
All notable changes to this project will be documented in this file.
|
All notable changes to this project will be documented in this file.
|
||||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||||
|
|
||||||
|
## 1.1.15 (2025-01-17)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @universal-call-sdk/core
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## 1.1.14 (2025-01-16)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @universal-call-sdk/core
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## 1.1.12 (2025-01-16)
|
## 1.1.12 (2025-01-16)
|
||||||
|
|
||||||
**Note:** Version bump only for package @universal-call-sdk/core
|
**Note:** Version bump only for package @universal-call-sdk/core
|
||||||
|
|||||||
@@ -74,7 +74,7 @@ const initialState: StateType = {
|
|||||||
callStartTime: Date.now(),
|
callStartTime: Date.now(),
|
||||||
}
|
}
|
||||||
|
|
||||||
let adapter: IAdapter;
|
let adapter: IAdapter
|
||||||
|
|
||||||
function UseCallSdk({AdapterClass, adapterOptions, metricsConfig, clickStreamConfig}: {
|
function UseCallSdk({AdapterClass, adapterOptions, metricsConfig, clickStreamConfig}: {
|
||||||
AdapterClass: new (adapterOptions: IAdapter) => IAdapter,
|
AdapterClass: new (adapterOptions: IAdapter) => IAdapter,
|
||||||
@@ -90,71 +90,73 @@ function UseCallSdk({AdapterClass, adapterOptions, metricsConfig, clickStreamCon
|
|||||||
}
|
}
|
||||||
}) {
|
}) {
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
adapter = new AdapterClass(adapterOptions);
|
if(adapterOptions) {
|
||||||
|
adapter = new AdapterClass(adapterOptions);
|
||||||
|
}
|
||||||
}, [adapterOptions]);
|
}, [adapterOptions]);
|
||||||
// @ts-expect-error sdfsf
|
// @ts-expect-error sdfsf
|
||||||
const [callState] = useReducer<any>(reducer, initialState,()=> initialState);
|
const [callState] = useReducer<any>(reducer, initialState,()=> initialState);
|
||||||
|
|
||||||
function registerOnCallIncoming(callback : (callState: GenericObject)=>void) {
|
function registerOnCallIncoming(callback : (callState: GenericObject)=>void) {
|
||||||
//dispatch({type: actionTypes.CALL_INCOMING, payload: {}})
|
//dispatch({type: actionTypes.CALL_INCOMING, payload: {}})
|
||||||
adapter.registerOnCallIncoming(callback);
|
adapter?.registerOnCallIncoming(callback);
|
||||||
}
|
}
|
||||||
|
|
||||||
function registerOnCallConnected(callback : (callState: GenericObject)=>void) {
|
function registerOnCallConnected(callback : (callState: GenericObject)=>void) {
|
||||||
adapter.registerOnCallConnected(callback);
|
adapter?.registerOnCallConnected(callback);
|
||||||
}
|
}
|
||||||
|
|
||||||
function registerOnCallDisconnected(callback : (callState: GenericObject)=>void) {
|
function registerOnCallDisconnected(callback : (callState: GenericObject)=>void) {
|
||||||
adapter.registerOnCallDisconnected(callback);
|
adapter?.registerOnCallDisconnected(callback);
|
||||||
}
|
}
|
||||||
|
|
||||||
function registerOnAdapterReady(callback : ()=> void) {
|
function registerOnAdapterReady(callback : ()=> void) {
|
||||||
adapter.registerOnAdapterReady(callback);
|
adapter?.registerOnAdapterReady(callback);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function registerOnAgentAvailabilityChange(callback : (isAgentAvailable: boolean, reason: string) => void) {
|
function registerOnAgentAvailabilityChange(callback : (isAgentAvailable: boolean, reason: string) => void) {
|
||||||
adapter.registerOnAgentAvailabilityChange(callback);
|
adapter?.registerOnAgentAvailabilityChange(callback);
|
||||||
}
|
}
|
||||||
|
|
||||||
function registerOnForcedLogoutListener(callback:()=>void) {
|
function registerOnForcedLogoutListener(callback:()=>void) {
|
||||||
adapter.registerOnForcedLogoutListener(callback);
|
adapter?.registerOnForcedLogoutListener(callback);
|
||||||
}
|
}
|
||||||
|
|
||||||
function registerOnAgentsForCallTransfer(callback: (data: GenericObject) => void) {
|
function registerOnAgentsForCallTransfer(callback: (data: GenericObject) => void) {
|
||||||
adapter.registerOnAgentsForCallTransfer(callback);
|
adapter?.registerOnAgentsForCallTransfer(callback);
|
||||||
}
|
}
|
||||||
|
|
||||||
function registerOnCallTransferStatus(callback: (data: GenericObject) => void) {
|
function registerOnCallTransferStatus(callback: (data: GenericObject) => void) {
|
||||||
adapter.registerOnCallTransferStatus(callback);
|
adapter?.registerOnCallTransferStatus(callback);
|
||||||
}
|
}
|
||||||
|
|
||||||
function registerOnLoginFailedListener(callback:()=>void) {
|
function registerOnLoginFailedListener(callback:()=>void) {
|
||||||
adapter.registerOnLoginFailedListener(callback);
|
adapter?.registerOnLoginFailedListener(callback);
|
||||||
}
|
}
|
||||||
|
|
||||||
function acceptCall() {
|
function acceptCall() {
|
||||||
adapter.acceptCall();
|
adapter?.acceptCall();
|
||||||
}
|
}
|
||||||
|
|
||||||
function rejectCall() {
|
function rejectCall() {
|
||||||
adapter.rejectCall();
|
adapter?.rejectCall();
|
||||||
}
|
}
|
||||||
|
|
||||||
function disposeCall() {
|
function disposeCall() {
|
||||||
adapter.disposeCall();
|
adapter?.disposeCall();
|
||||||
}
|
}
|
||||||
|
|
||||||
function muteCall() {
|
function muteCall() {
|
||||||
adapter.muteCall();
|
adapter?.muteCall();
|
||||||
}
|
}
|
||||||
|
|
||||||
function unmuteCall() {
|
function unmuteCall() {
|
||||||
adapter.unmuteCall();
|
adapter?.unmuteCall();
|
||||||
}
|
}
|
||||||
|
|
||||||
function logOut() {
|
function logOut() {
|
||||||
adapter.logOut();
|
adapter?.logOut();
|
||||||
}
|
}
|
||||||
|
|
||||||
function initialize() {
|
function initialize() {
|
||||||
@@ -167,15 +169,15 @@ function UseCallSdk({AdapterClass, adapterOptions, metricsConfig, clickStreamCon
|
|||||||
if(clickStreamConfig?.clickStreamTransporter) {
|
if(clickStreamConfig?.clickStreamTransporter) {
|
||||||
clickStreamProcessor = new ClickStreamProcessor(clickStreamConfig?.clickStreamTransporter || noop);
|
clickStreamProcessor = new ClickStreamProcessor(clickStreamConfig?.clickStreamTransporter || noop);
|
||||||
}
|
}
|
||||||
adapter.init(metricProcessor, clickStreamProcessor);
|
adapter?.init(metricProcessor, clickStreamProcessor);
|
||||||
}
|
}
|
||||||
|
|
||||||
function setOnBreak() {
|
function setOnBreak() {
|
||||||
adapter.setOnBreak();
|
adapter?.setOnBreak();
|
||||||
}
|
}
|
||||||
|
|
||||||
function setAvailable() {
|
function setAvailable() {
|
||||||
adapter.setAvailable();
|
adapter?.setAvailable();
|
||||||
}
|
}
|
||||||
|
|
||||||
function getAgentAvailability(): boolean {
|
function getAgentAvailability(): boolean {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@universal-call-sdk/core",
|
"name": "@universal-call-sdk/core",
|
||||||
"version": "1.1.12",
|
"version": "1.1.15",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "vite",
|
"dev": "vite",
|
||||||
|
|||||||
Reference in New Issue
Block a user