NTP-26125 | resolved merged conflicts

This commit is contained in:
varnit goyal
2025-01-15 09:54:46 +05:30
11 changed files with 174 additions and 22 deletions

View File

@@ -19,6 +19,46 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
## 1.1.3 (2025-01-06)
**Note:** Version bump only for package @universal-call-sdk/adapter-ameyo
## 1.1.2 (2025-01-06)
**Note:** Version bump only for package @universal-call-sdk/adapter-ameyo
## 1.1.1 (2025-01-06)
**Note:** Version bump only for package @universal-call-sdk/adapter-ameyo
## 1.0.100 (2025-01-06)
**Note:** Version bump only for package @universal-call-sdk/adapter-ameyo
## 1.0.99 (2025-01-06)
**Note:** Version bump only for package @universal-call-sdk/adapter-ameyo
## 1.0.98 (2025-01-03)
**Note:** Version bump only for package @universal-call-sdk/adapter-ameyo

View File

@@ -207,6 +207,21 @@ export const getAllAgentsForTransferCall = (sessionId: string) => {
});
}
export const logoutFromAmeyo = (sessionId: string) => {
const LOGOUT_PAYLOAD_TEXT = `7|0|7|${window.BASE_AMEYO_URL}/app/application_ui/|C066834E4747CF348FD8D1A68865C24D|com.drishti.ameyo.common.ui.rpc.CommonGwtRpcService|doLogout|java.lang.String/2004016611|${sessionId}|Logout from UI|1|2|3|4|2|5|5|6|7|${sessionId}|`;
return getResponseWithoutCors({
url: `${window.BASE_AMEYO_URL}/ameyo40/service`,
method: 'POST',
requestKey: RequestKeys.LOGOUT_FROM_AMEYO,
requestType: RequestType.RAW,
data: LOGOUT_PAYLOAD_TEXT,
headers: {
'Content-Type': 'text/x-gwt-rpc; charset=UTF-8',
'X-GWT-Permutation': '11B39EE372921423BCA4DF11986A500D'
}
});
};
export const transferCallToAgent = (data: CallTransferData, sessionId: string, crtObjectId: string, userCRTObjectId: string, campaignId: string) => {
return getResponseWithoutCors({

View File

@@ -11,6 +11,8 @@ export enum MessagingType {
ON_AMEYO_AGENT_ON_BREAK = 'onAmeyoAgentOnBreak',
ON_AMEYO_FORCED_LOGOUT = 'onAmeyoForcedLogout',
ON_AMEYO_CALL_TRANSFER = 'onAmeyoCallTransfer',
ON_AMEYO_AVAILABILITY_CHANGE = 'onAmeyoAvailabilityChange'
}

View File

@@ -1,6 +1,7 @@
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";
class CallStateManager {
private state: CallState = {
@@ -149,14 +150,14 @@ class CallStateManager {
}
private handleUserCCRuntimeUpdate(data: any) {
if (data?.isOnBreak) {
const payload = data;
window.postMessage({
type: MessagingType.ON_AMEYO_AGENT_ON_BREAK,
type: messagingType.ON_AMEYO_AVAILABILITY_CHANGE,
data:{
reason: data
}
});
isOnBreak: payload?.isOnBreak,
reason: payload?.statusDescription
}
})
}
private handleUserLoggedOff() {

View File

@@ -22,7 +22,7 @@ import {
getCampaignId,
ameyoDisposeCall,
getAllAgentsForTransferCall,
transferCallToAgent
transferCallToAgent, logoutFromAmeyo
} from "./api";
import {
acceptSipCall,
@@ -165,8 +165,8 @@ class AmeyoAdapter implements IAdapter {
case MessagingType.ON_AMEYO_CALL_DISCONNECTED:
await this.handleCallDisconnected(data);
break;
case MessagingType.ON_AMEYO_AGENT_ON_BREAK:
this.handleAgentBreak();
case MessagingType.ON_AMEYO_AVAILABILITY_CHANGE:
this.handleAgentAvailabilityChange(data);
break;
case MessagingType.ON_AMEYO_FORCED_LOGOUT:
this.callbacks.onForcedLogout();
@@ -300,9 +300,10 @@ class AmeyoAdapter implements IAdapter {
private handleAgentAvailable(): void {
setAutoStatus(this.sessionId);
this.isAgentAvailable = true;
window.postMessage({type: 'onAmeyoAvailabiltyChange', data: true});
this.callbacks.onAgentAvailabilityChange(true);
}
private handleAgentBreak(): void {
setAutoStatus(this.sessionId);
}
private async handleOmniQueueService(): Promise<void> {
@@ -313,13 +314,13 @@ class AmeyoAdapter implements IAdapter {
await autoSelectExtension(this.sessionId, this.userName.toLowerCase());
this.callbacks.onAdapterReady();
this.currentCallState = CALL_STATES.IDLE;
this.callbacks.onAgentAvailabilityChange(true);
window.postMessage({type: 'onAmeyoAvailabiltyChange', data: false});
}
private handleAgentBreak(): void {
this.isAgentAvailable = false;
this.callbacks.onAgentAvailabilityChange(false);
private handleAgentAvailabilityChange(payload :GenericObject): void {
this.isAgentAvailable = !payload?.data?.isOnBreak;
this.callbacks.onAgentAvailabilityChange(this.isAgentAvailable, payload?.data?.reason || '');
window.postMessage({type: 'onAmeyoAvailabiltyChange', data: this.isAgentAvailable,});
}
private handleAgentsForTransfer(payload: GenericObject): void {
@@ -348,6 +349,10 @@ class AmeyoAdapter implements IAdapter {
await audioElement?.play();
}
public logOut() {
logoutFromAmeyo(this.sessionId);
}
public acceptCall(): void {
acceptSipCall();
callStateManager.sendConnectedMessage();
@@ -421,7 +426,7 @@ class AmeyoAdapter implements IAdapter {
this.callbacks.onAdapterReady = callback;
}
public registerOnAgentAvailabilityChange(callback: (isAgentAvailable: boolean) => void): void {
public registerOnAgentAvailabilityChange(callback: (isAgentAvailable: boolean, reason: string) => void): void {
this.callbacks.onAgentAvailabilityChange = callback;
}

View File

@@ -26,6 +26,7 @@ export enum RequestKeys {
GET_CAMPAIGN_ID = "get_campaign_id",
GET_AGENTS_FOR_CALL_TRANSFER = "get_agents_for_call_transfer",
TRANSFER_CALL_TO_AGENT = "transfer_call_to_agent",
LOGOUT_FROM_AMEYO = 'logout_from_ameyo'
}
export type AmeyoInitializationOptions = {
@@ -69,7 +70,7 @@ export type CallbackFunctions = {
onCallDisconnected: (data: StateType) => void;
onCallIncoming: (data: StateType) => void;
onAdapterReady: () => void;
onAgentAvailabilityChange: (isAgentAvailable: boolean) => void;
onAgentAvailabilityChange: (isAgentAvailable: boolean, reason: string) => void;
onForcedLogout: () => void;
onLoginFailed: (err: GenericObject) => void;
onAgentsForCallTransfer: (data: GenericObject) => void;

View File

@@ -7,6 +7,7 @@
ON_AMEYO_AGENT_ON_BREAK = 'onAmeyoAgentOnBreak',
ON_AMEYO_FORCED_LOGOUT = 'onAmeyoForcedLogout',
ON_AMEYO_CALL_TRANSFER = 'onAmeyoCallTransfer',
ON_AMEYO_AVAILABILITY_CHANGE= 'onAmeyoAvailablityChange'
}

View File

@@ -19,6 +19,46 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
## 1.0.54 (2025-01-06)
**Note:** Version bump only for package @universal-call-sdk/common
## 1.0.53 (2025-01-06)
**Note:** Version bump only for package @universal-call-sdk/common
## 1.0.52 (2025-01-06)
**Note:** Version bump only for package @universal-call-sdk/common
## 1.0.51 (2025-01-06)
**Note:** Version bump only for package @universal-call-sdk/common
## 1.0.50 (2025-01-06)
**Note:** Version bump only for package @universal-call-sdk/common
## 1.0.49 (2025-01-03)
**Note:** Version bump only for package @universal-call-sdk/common

View File

@@ -8,7 +8,7 @@ class IAdapter {
registerOnCallConnected(callback: (callState: GenericObject)=>void) {callback({})}
registerOnCallDisconnected(callback: (callState: GenericObject)=>void) {callback({})}
registerOnAdapterReady(callback: ()=> void) {callback()}
registerOnAgentAvailabilityChange(callback: (isAgentAvailable: boolean) => void) {callback(false)}
registerOnAgentAvailabilityChange(callback: (isAgentAvailable: boolean, reason: string) => void) {callback(false, '')}
registerOnForcedLogoutListener(callback:()=>void) {callback()}
registerOnLoginFailedListener(callback:()=>void) {callback()}
registerOnAgentsForCallTransfer(callback: (data : GenericObject) => void) {callback({})}
@@ -21,6 +21,8 @@ class IAdapter {
setOnBreak() {}
setAvailable() {}
logOut() {}
init(metricProcessor: (MetricsProcessor) | undefined, clickStreamProcessor: (ClickStreamProcessor)| undefined) {
console.log('metric processor and click stream processor', metricProcessor, clickStreamProcessor)
}

View File

@@ -19,6 +19,46 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
## 1.0.58 (2025-01-06)
**Note:** Version bump only for package @universal-call-sdk/core
## 1.0.57 (2025-01-06)
**Note:** Version bump only for package @universal-call-sdk/core
## 1.0.56 (2025-01-06)
**Note:** Version bump only for package @universal-call-sdk/core
## 1.0.55 (2025-01-06)
**Note:** Version bump only for package @universal-call-sdk/core
## 1.0.54 (2025-01-06)
**Note:** Version bump only for package @universal-call-sdk/core
## 1.0.53 (2025-01-03)
**Note:** Version bump only for package @universal-call-sdk/core

View File

@@ -113,7 +113,7 @@ function UseCallSdk({AdapterClass, adapterOptions, metricsConfig, clickStreamCon
}
function registerOnAgentAvailabilityChange(callback : (isAgentAvailable: boolean) => void) {
function registerOnAgentAvailabilityChange(callback : (isAgentAvailable: boolean, reason: string) => void) {
adapter.registerOnAgentAvailabilityChange(callback);
}
@@ -153,6 +153,10 @@ function UseCallSdk({AdapterClass, adapterOptions, metricsConfig, clickStreamCon
adapter.unmuteCall();
}
function logOut() {
adapter.logOut();
}
function initialize() {
let metricProcessor;
let clickStreamProcessor;
@@ -207,6 +211,7 @@ function UseCallSdk({AdapterClass, adapterOptions, metricsConfig, clickStreamCon
muteCall,
unmuteCall,
initialize,
logOut,
setAvailable,
getLatestCallState,
setOnBreak,