From e101eb332e1b9053667c99224417f00f8ab7cfdd Mon Sep 17 00:00:00 2001 From: Deepak Agarwal Date: Sun, 18 Jul 2021 14:39:30 +0530 Subject: [PATCH 1/2] api for call status update --- package.json | 13 ++++++------- src/lib/api/Livechat.ts | 1 + 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/package.json b/package.json index 79c225d..e324abf 100644 --- a/package.json +++ b/package.json @@ -47,13 +47,13 @@ }, "husky": { "hooks": { - "pre-push": "npm run test:hook" + "pre-push": "npm run test:hook" } }, "devDependencies": { - "@types/event-emitter": "^0.3.2", - "@types/eventemitter3": "^2.0.2", - "@types/chai": "^4.1.2", + "@types/event-emitter": "^0.3.2", + "@types/eventemitter3": "^2.0.2", + "@types/chai": "^4.1.2", "@types/mocha": "^2.2.48", "@types/sinon": "^4.3.0", "@types/ws": "^5.1.2", @@ -64,8 +64,8 @@ "dotenv": "^5.0.1", "husky": "^0.14.3", "mocha": "^5.0.1", - "node-fetch": "^2.2.1", - "node-fetch-polyfill": "^2.0.6", + "node-fetch": "^2.2.1", + "node-fetch-polyfill": "^2.0.6", "nyc": "^11.4.1", "package-preview": "^1.0.5", "rimraf": "^2.6.2", @@ -81,7 +81,6 @@ "webpack-cli": "^3.1.0" }, "dependencies": { - "js-sha256": "^0.9.0", "lru-cache": "^4.1.1", "mem": "^4.0.0", diff --git a/src/lib/api/Livechat.ts b/src/lib/api/Livechat.ts index 02b77b6..5bc08f4 100644 --- a/src/lib/api/Livechat.ts +++ b/src/lib/api/Livechat.ts @@ -40,6 +40,7 @@ export default class ApiLivechat extends ApiBase { } async deleteVisitor () { return (await this.del(`livechat/visitor/${this.credentials.token}`)).visitor } async updateVisitorStatus (status: string) { return (await this.post(`livechat/visitor.status`, { token: this.credentials.token, status })).status } + async updateCallStatus (callStatus: string) { return (await this.post(`livechat/visitor.callStatus`, { token: this.credentials.token, callStatus })).callStatus} async nextAgent (department: string = '') { return (await this.get(`livechat/agent.next/${this.credentials.token}`, { department })).agent } async agent ({ rid }: any) { return (await this.get(`livechat/agent.info/${rid}/${this.credentials.token}`)).agent } async message (id: string, params: ILivechatRoom) { return (await this.get(`livechat/message/${id}`, { token: this.credentials.token, ...params })).message } From e311cd4306a2f7f9d037886c0a018f3dac38d4f6 Mon Sep 17 00:00:00 2001 From: Deepak Agarwal Date: Tue, 3 Aug 2021 22:54:38 +0530 Subject: [PATCH 2/2] add code for update call status --- src/interfaces/index.ts | 7 +++++++ src/lib/api/Livechat.ts | 3 ++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/interfaces/index.ts b/src/interfaces/index.ts index 88950db..39024c3 100644 --- a/src/interfaces/index.ts +++ b/src/interfaces/index.ts @@ -811,6 +811,13 @@ export interface INewLivechatOfflineMessageAPI { message: string // Message text } +export interface webrtcMessage { + callId: string + rid:string + status:string + user:string +} + /** Result structure for Livechat Offline Message */ export interface ILivechatOfflineMessageResultAPI { message: string diff --git a/src/lib/api/Livechat.ts b/src/lib/api/Livechat.ts index 5bc08f4..1709e58 100644 --- a/src/lib/api/Livechat.ts +++ b/src/lib/api/Livechat.ts @@ -13,6 +13,7 @@ import { INewLivechatNavigationAPI, INewLivechatCustomFieldAPI, INewLivechatOfflineMessageAPI, + webrtcMessage, INewLivechatCustomFieldsAPI, ILivechatRoom, INewLivechatRoomCredentialAPI, @@ -40,7 +41,7 @@ export default class ApiLivechat extends ApiBase { } async deleteVisitor () { return (await this.del(`livechat/visitor/${this.credentials.token}`)).visitor } async updateVisitorStatus (status: string) { return (await this.post(`livechat/visitor.status`, { token: this.credentials.token, status })).status } - async updateCallStatus (callStatus: string) { return (await this.post(`livechat/visitor.callStatus`, { token: this.credentials.token, callStatus })).callStatus} + async updateCallStatus (callStatus: string, rid: string) { return (await this.post(`livechat/visitor.callStatus`, { token: this.credentials.token, callStatus, rid })).callStatus} async nextAgent (department: string = '') { return (await this.get(`livechat/agent.next/${this.credentials.token}`, { department })).agent } async agent ({ rid }: any) { return (await this.get(`livechat/agent.info/${rid}/${this.credentials.token}`)).agent } async message (id: string, params: ILivechatRoom) { return (await this.get(`livechat/message/${id}`, { token: this.credentials.token, ...params })).message }