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/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 02b77b6..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,6 +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, 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 }