Merge pull request #31 from navi-commons/NTP-21033/hotfix-connected_call

Ntp-21033/hotfix for availability change
This commit is contained in:
Varnit Goyal
2025-01-15 09:37:46 +05:30
committed by GitHub
13 changed files with 171 additions and 28 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) ## 1.0.98 (2025-01-03)
**Note:** Version bump only for package @universal-call-sdk/adapter-ameyo **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) => { export const transferCallToAgent = (data: CallTransferData, sessionId: string, crtObjectId: string, userCRTObjectId: string, campaignId: string) => {
return getResponseWithoutCors({ return getResponseWithoutCors({

View File

@@ -12,6 +12,7 @@ export enum MessagingType {
ON_AMEYO_AGENT_ON_BREAK = 'onAmeyoAgentOnBreak', ON_AMEYO_AGENT_ON_BREAK = 'onAmeyoAgentOnBreak',
ON_AMEYO_FORCED_LOGOUT = 'onAmeyoForcedLogout', ON_AMEYO_FORCED_LOGOUT = 'onAmeyoForcedLogout',
ON_AMEYO_CALL_TRANSFER = 'onAmeyoCallTransfer', ON_AMEYO_CALL_TRANSFER = 'onAmeyoCallTransfer',
ON_AMEYO_AVAILABILITY_CHANGE = 'onAmeyoAvailabilityChange'
} }
@@ -117,15 +118,14 @@ function extractUserCallModelUpdatedPush(rawResponse) {
} }
if (jsonData?.pushType === pushResponseTypes.UserCCRuntimeUpdatedPush) { if (jsonData?.pushType === pushResponseTypes.UserCCRuntimeUpdatedPush) {
const payload = jsonData?.data; const payload = jsonData?.data;
//handle ameyo erroronous condition //handle ameyo availablility changes
if (payload?.isOnBreak) { window.postMessage({
window.postMessage({ type: messagingType.ON_AMEYO_AVAILABILITY_CHANGE,
type: MessagingType.ON_AMEYO_AGENT_ON_BREAK, data:{
data: { isOnBreak: payload?.isOnBreak,
reason: payload, reason: payload?.statusDescription
} }
}); })
}
} }
if (jsonData?.pushType == pushResponseTypes.UserLoggedOffPush) { if (jsonData?.pushType == pushResponseTypes.UserLoggedOffPush) {
const payload = jsonData?.data; const payload = jsonData?.data;

View File

@@ -19,7 +19,7 @@ import {
setAgentActive, setAgentOnBreak, setAgentActive, setAgentOnBreak,
setAutoStatus, setAutoStatus,
getCampaignId, ameyoDisposeCall, getCampaignId, ameyoDisposeCall,
getAllAgentsForTransferCall, transferCallToAgent getAllAgentsForTransferCall, transferCallToAgent, logoutFromAmeyo
} from "./api.ts"; } from "./api.ts";
import { import {
acceptSipCall, acceptSipCall,
@@ -39,7 +39,7 @@ class AmeyoAdapter implements IAdapter {
onCallDisconnected: (data: StateType) => void; onCallDisconnected: (data: StateType) => void;
onCallIncoming: (data: StateType) => void, onCallIncoming: (data: StateType) => void,
onAdapterReady: () => void, onAdapterReady: () => void,
onAgentAvailabilityChange: (isAgentAvailable: boolean) => void onAgentAvailabilityChange: (isAgentAvailable: boolean, reason: string) => void
onForcedLogout: () => void, onForcedLogout: () => void,
onLoginFailed: (err: GenericObject)=>void onLoginFailed: (err: GenericObject)=>void
onAgentsForCallTransfer: (data: GenericObject) => void onAgentsForCallTransfer: (data: GenericObject) => void
@@ -186,9 +186,6 @@ class AmeyoAdapter implements IAdapter {
} }
if (payload?.data?.requestKey === RequestKeys.AMEYO_AVAILABLE) { if (payload?.data?.requestKey === RequestKeys.AMEYO_AVAILABLE) {
setAutoStatus(this.sessionId); setAutoStatus(this.sessionId);
this.isAgentAvailable = true;
window.postMessage({type: 'onAmeyoAvailabiltyChange', data: true});
this.callbacks.onAgentAvailabilityChange(true)
} }
if (payload?.data?.requestKey === RequestKeys.OMNIQUEUE_SERVICE) { if (payload?.data?.requestKey === RequestKeys.OMNIQUEUE_SERVICE) {
@@ -198,13 +195,9 @@ class AmeyoAdapter implements IAdapter {
autoSelectExtension(this.sessionId, this.userName.toLowerCase()); autoSelectExtension(this.sessionId, this.userName.toLowerCase());
this.callbacks.onAdapterReady(); this.callbacks.onAdapterReady();
this.currentCallState = CALL_STATES.IDLE; this.currentCallState = CALL_STATES.IDLE;
this.callbacks.onAgentAvailabilityChange(true);
window.postMessage({type: 'onAmeyoAvailabiltyChange', data: false},);
} }
if (payload?.data?.requestKey === RequestKeys.AMEYO_ON_BREAK) { if (payload?.data?.requestKey === RequestKeys.AMEYO_ON_BREAK) {
setAutoStatus(this.sessionId); setAutoStatus(this.sessionId);
this.isAgentAvailable = false;
this.callbacks.onAgentAvailabilityChange(false);
window.postMessage({type: 'onAmeyoAvailabiltyChange', data: false},); window.postMessage({type: 'onAmeyoAvailabiltyChange', data: false},);
} }
if (payload?.data?.requestKey === RequestKeys.GET_AGENTS_FOR_CALL_TRANSFER) { if (payload?.data?.requestKey === RequestKeys.GET_AGENTS_FOR_CALL_TRANSFER) {
@@ -243,9 +236,11 @@ class AmeyoAdapter implements IAdapter {
audioElement?.play(); audioElement?.play();
} }
if (data?.type === MessagingType.ON_AMEYO_AGENT_ON_BREAK) { if (data?.type === MessagingType.ON_AMEYO_AVAILABILITY_CHANGE) {
this.isAgentAvailable = false; this.isAgentAvailable = !data?.data?.isOnBreak;
this.callbacks.onAgentAvailabilityChange(false); this.callbacks.onAgentAvailabilityChange(this.isAgentAvailable, data?.data?.reason || '');
window.postMessage({type: 'onAmeyoAvailabiltyChange', data: this.isAgentAvailable,});
} }
if (data?.type === MessagingType.ON_AMEYO_FORCED_LOGOUT) { if (data?.type === MessagingType.ON_AMEYO_FORCED_LOGOUT) {
this.callbacks.onForcedLogout() this.callbacks.onForcedLogout()
@@ -275,7 +270,7 @@ class AmeyoAdapter implements IAdapter {
this.callbacks.onAdapterReady = callback; this.callbacks.onAdapterReady = callback;
} }
registerOnAgentAvailabilityChange(callback: (isAgentAvailable: boolean) => void) { registerOnAgentAvailabilityChange(callback: (isAgentAvailable: boolean, reason: string) => void) {
console.log('registerOnAgentAvailabilityChange'); console.log('registerOnAgentAvailabilityChange');
this.callbacks.onAgentAvailabilityChange = callback; this.callbacks.onAgentAvailabilityChange = callback;
} }
@@ -348,6 +343,10 @@ class AmeyoAdapter implements IAdapter {
this.campaignId); this.campaignId);
} }
logOut() {
logoutFromAmeyo(this.sessionId);
}
private _appendTags: () => void = () => { private _appendTags: () => void = () => {
const script = document.createElement('script'); const script = document.createElement('script');
script.src = 'https://public-assets.np.navi-gi.in/jarvis/sip5ml.js'; // Assuming it's placed in the public folder script.src = 'https://public-assets.np.navi-gi.in/jarvis/sip5ml.js'; // Assuming it's placed in the public folder

View File

@@ -26,6 +26,7 @@ export enum RequestKeys {
GET_CAMPAIGN_ID = "get_campaign_id", GET_CAMPAIGN_ID = "get_campaign_id",
GET_AGENTS_FOR_CALL_TRANSFER = "get_agents_for_call_transfer", GET_AGENTS_FOR_CALL_TRANSFER = "get_agents_for_call_transfer",
TRANSFER_CALL_TO_AGENT = "transfer_call_to_agent", TRANSFER_CALL_TO_AGENT = "transfer_call_to_agent",
LOGOUT_FROM_AMEYO = 'logout_from_ameyo'
} }
export type AmeyoInitializationOptions = { export type AmeyoInitializationOptions = {

View File

@@ -1,6 +1,6 @@
{ {
"name": "@universal-call-sdk/adapter-ameyo", "name": "@universal-call-sdk/adapter-ameyo",
"version": "1.0.100", "version": "1.1.3",
"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.0.51", "@universal-call-sdk/common": "^1.0.54",
"uuid": "^11.0.3" "uuid": "^11.0.3"
}, },
"devDependencies": { "devDependencies": {

View File

@@ -7,6 +7,7 @@
ON_AMEYO_AGENT_ON_BREAK = 'onAmeyoAgentOnBreak', ON_AMEYO_AGENT_ON_BREAK = 'onAmeyoAgentOnBreak',
ON_AMEYO_FORCED_LOGOUT = 'onAmeyoForcedLogout', ON_AMEYO_FORCED_LOGOUT = 'onAmeyoForcedLogout',
ON_AMEYO_CALL_TRANSFER = 'onAmeyoCallTransfer', 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) ## 1.0.49 (2025-01-03)
**Note:** Version bump only for package @universal-call-sdk/common **Note:** Version bump only for package @universal-call-sdk/common

View File

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

View File

@@ -1,6 +1,6 @@
{ {
"name": "@universal-call-sdk/common", "name": "@universal-call-sdk/common",
"version": "1.0.51", "version": "1.0.54",
"type": "module", "type": "module",
"scripts": { "scripts": {
"dev": "vite", "dev": "vite",

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) ## 1.0.53 (2025-01-03)
**Note:** Version bump only for package @universal-call-sdk/core **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); adapter.registerOnAgentAvailabilityChange(callback);
} }
@@ -153,6 +153,10 @@ function UseCallSdk({AdapterClass, adapterOptions, metricsConfig, clickStreamCon
adapter.unmuteCall(); adapter.unmuteCall();
} }
function logOut() {
adapter.logOut();
}
function initialize() { function initialize() {
let metricProcessor; let metricProcessor;
let clickStreamProcessor; let clickStreamProcessor;
@@ -207,6 +211,7 @@ function UseCallSdk({AdapterClass, adapterOptions, metricsConfig, clickStreamCon
muteCall, muteCall,
unmuteCall, unmuteCall,
initialize, initialize,
logOut,
setAvailable, setAvailable,
getLatestCallState, getLatestCallState,
setOnBreak, setOnBreak,

View File

@@ -1,6 +1,6 @@
{ {
"name": "@universal-call-sdk/core", "name": "@universal-call-sdk/core",
"version": "1.0.55", "version": "1.0.58",
"type": "module", "type": "module",
"scripts": { "scripts": {
"dev": "vite", "dev": "vite",