diff --git a/packages/adapter-ameyo/CHANGELOG.md b/packages/adapter-ameyo/CHANGELOG.md index d644163..b3d2552 100644 --- a/packages/adapter-ameyo/CHANGELOG.md +++ b/packages/adapter-ameyo/CHANGELOG.md @@ -3,6 +3,14 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +## 1.0.61 (2024-11-27) + +**Note:** Version bump only for package @universal-call-sdk/adapter-ameyo + + + + + ## 1.0.60 (2024-11-25) **Note:** Version bump only for package @universal-call-sdk/adapter-ameyo diff --git a/packages/adapter-ameyo/lib/main.ts b/packages/adapter-ameyo/lib/main.ts index f3d4506..94349cd 100644 --- a/packages/adapter-ameyo/lib/main.ts +++ b/packages/adapter-ameyo/lib/main.ts @@ -1,6 +1,6 @@ import IAdapter from "@universal-call-sdk/common/lib/Interfaces/IAdapter.ts"; import GenericObject from "@universal-call-sdk/common/lib/types/GenericObject.ts"; -import {AmeyoInitializationOptions, RequestKeys, SipAccountInfo, StateType} from "./types.ts"; +import {AmeyoInitializationOptions, CALL_STATES, RequestKeys, SipAccountInfo, StateType} from "./types.ts"; import MessagingType from "../types/MessagingType.ts"; import { ameyoHangupUser, @@ -32,6 +32,7 @@ class AmeyoAdapter implements IAdapter { onAgentAvailabilityChange: (isAgentAvailable: boolean) => void onForcedLogout: () => void }; + private currentCallState: string; private eventListenerUrl: string; private baseUrl: string; private sessionId: string; @@ -51,6 +52,7 @@ class AmeyoAdapter implements IAdapter { document.body.appendChild(script); this.baseUrl = options.baseUrl; this.eventListenerUrl = options.eventListenerUrl; + this.currentCallState = CALL_STATES.IDLE; this.callbacks = { onCallIncoming: () => { }, @@ -143,6 +145,7 @@ class AmeyoAdapter implements IAdapter { console.log('campaign selected', payload?.data?.response); autoSelectExtension(this.sessionId, this.userName.toLowerCase()); this.callbacks.onAdapterReady(); + this.currentCallState = CALL_STATES.IDLE; this.callbacks.onAgentAvailabilityChange(true); window.postMessage({type: 'onAmeyoAvailabiltyChange', data: false},); } @@ -160,14 +163,17 @@ class AmeyoAdapter implements IAdapter { } if (data?.type === MessagingType.ON_AMEYO_CALL_INCOMING) { this.callbacks.onCallIncoming(data?.data); + this.currentCallState = CALL_STATES.CALL_INCOMING; this.currentCallMetadata = {...this.currentCallMetadata, ...data?.data} } if (data?.type === MessagingType.ON_AMEYO_CALL_ACCEPTED) { this.callbacks.onCallConnected(data?.data); + this.currentCallState = CALL_STATES.CALL_CONNECTED; this.currentCallMetadata = {...this.currentCallMetadata, ...data?.data} } if (data?.type === MessagingType.ON_AMEYO_CALL_DISCONNECTED) { this.callbacks.onCallDisconnected(data?.data); + this.currentCallState = CALL_STATES.CALL_DISCONNECTED; ameyoHangupUser(this.sessionId, this.currentCallMetadata?.userCRTObjectId); this.currentCallMetadata = {...this.currentCallMetadata, ...data?.data} } @@ -250,7 +256,7 @@ class AmeyoAdapter implements IAdapter { } getLatestCallState() { - return this.currentCallMetadata; + return this.currentCallState; } private _appendTags: () => void = () => { diff --git a/packages/adapter-ameyo/lib/types.ts b/packages/adapter-ameyo/lib/types.ts index 1d84b22..eb2c8ae 100644 --- a/packages/adapter-ameyo/lib/types.ts +++ b/packages/adapter-ameyo/lib/types.ts @@ -55,3 +55,11 @@ export type SipAccountInfo = { domain: string, password: string } + + +export enum CALL_STATES { + CALL_INCOMING = 'CALL_INCOMING', + CALL_CONNECTED = 'CALL_CONNECTED', + CALL_DISCONNECTED = 'CALL_DISCONNECTED', + IDLE = 'IDLE', +} diff --git a/packages/adapter-ameyo/package.json b/packages/adapter-ameyo/package.json index 5c70759..d068806 100644 --- a/packages/adapter-ameyo/package.json +++ b/packages/adapter-ameyo/package.json @@ -1,6 +1,6 @@ { "name": "@universal-call-sdk/adapter-ameyo", - "version": "1.0.60", + "version": "1.0.61", "type": "module", "scripts": { "dev": "vite", @@ -9,7 +9,7 @@ "preview": "vite preview" }, "dependencies": { - "@universal-call-sdk/common": "^1.0.15" + "@universal-call-sdk/common": "^1.0.16" }, "devDependencies": { "@eslint/js": "^9.11.1", diff --git a/packages/common/CHANGELOG.md b/packages/common/CHANGELOG.md index 72e3e99..243706d 100644 --- a/packages/common/CHANGELOG.md +++ b/packages/common/CHANGELOG.md @@ -3,6 +3,14 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +## 1.0.16 (2024-11-27) + +**Note:** Version bump only for package @universal-call-sdk/common + + + + + ## 1.0.15 (2024-11-25) **Note:** Version bump only for package @universal-call-sdk/common diff --git a/packages/common/package.json b/packages/common/package.json index 8867392..62a3ff4 100644 --- a/packages/common/package.json +++ b/packages/common/package.json @@ -1,6 +1,6 @@ { "name": "@universal-call-sdk/common", - "version": "1.0.15", + "version": "1.0.16", "type": "module", "scripts": { "dev": "vite", diff --git a/packages/core/CHANGELOG.md b/packages/core/CHANGELOG.md index 5ba7eda..c2ccfa8 100644 --- a/packages/core/CHANGELOG.md +++ b/packages/core/CHANGELOG.md @@ -3,6 +3,14 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +## 1.0.21 (2024-11-27) + +**Note:** Version bump only for package @universal-call-sdk/core + + + + + ## 1.0.20 (2024-11-25) **Note:** Version bump only for package @universal-call-sdk/core diff --git a/packages/core/package.json b/packages/core/package.json index 811756e..479644b 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -1,6 +1,6 @@ { "name": "@universal-call-sdk/core", - "version": "1.0.20", + "version": "1.0.21", "type": "module", "scripts": { "dev": "vite",