webitel-sdk 0.1.145 → 0.1.148
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bundles/index.esm.js +65 -23
- package/bundles/index.esm.js.map +1 -1
- package/bundles/index.esm.min.js +1 -1
- package/bundles/index.esm.min.js.map +1 -1
- package/bundles/index.umd.js +73 -27
- package/bundles/index.umd.js.map +1 -1
- package/bundles/index.umd.min.js +1 -1
- package/bundles/index.umd.min.js.map +1 -1
- package/esm2015/socket/call.js +5 -0
- package/esm2015/socket/call.js.map +1 -1
- package/esm2015/socket/client.js +28 -19
- package/esm2015/socket/client.js.map +1 -1
- package/esm2015/socket/conversation.js +30 -2
- package/esm2015/socket/conversation.js.map +1 -1
- package/esm5/socket/call.js +5 -0
- package/esm5/socket/call.js.map +1 -1
- package/esm5/socket/client.js +33 -24
- package/esm5/socket/client.js.map +1 -1
- package/esm5/socket/conversation.js +35 -2
- package/esm5/socket/conversation.js.map +1 -1
- package/package.json +1 -1
- package/types/api/engine-create-member-bulk-request.d.ts +1 -1
- package/types/api/engine-reset-members-request.d.ts +6 -0
- package/types/api/engine-reset-members-request.d.ts.map +1 -1
- package/types/api/engine-transcript-lookup.d.ts +7 -0
- package/types/api/engine-transcript-lookup.d.ts.map +1 -1
- package/types/socket/call.d.ts +6 -1
- package/types/socket/call.d.ts.map +1 -1
- package/types/socket/client.d.ts +3 -1
- package/types/socket/client.d.ts.map +1 -1
- package/types/socket/conversation.d.ts +13 -2
- package/types/socket/conversation.d.ts.map +1 -1
package/bundles/index.esm.js
CHANGED
|
@@ -25556,7 +25556,7 @@ async function getMediaStream(constraints) {
|
|
|
25556
25556
|
|
|
25557
25557
|
const getVersion = () => {
|
|
25558
25558
|
// @ts-ignore
|
|
25559
|
-
return '"0.1.
|
|
25559
|
+
return '"0.1.148"';
|
|
25560
25560
|
};
|
|
25561
25561
|
var version = getVersion();
|
|
25562
25562
|
|
|
@@ -26042,6 +26042,11 @@ var CallReportingStatus;
|
|
|
26042
26042
|
CallReportingStatus["Abandoned"] = "abandoned";
|
|
26043
26043
|
CallReportingStatus["Cancel"] = "cancel";
|
|
26044
26044
|
CallReportingStatus["Success"] = "success";
|
|
26045
|
+
CallReportingStatus["Failed"] = "failed";
|
|
26046
|
+
CallReportingStatus["Missed"] = "missed";
|
|
26047
|
+
CallReportingStatus["Timeout"] = "timeout";
|
|
26048
|
+
CallReportingStatus["Endless"] = "endless";
|
|
26049
|
+
CallReportingStatus["Transferred"] = "transferred";
|
|
26045
26050
|
})(CallReportingStatus || (CallReportingStatus = {}));
|
|
26046
26051
|
var CallActions;
|
|
26047
26052
|
(function (CallActions) {
|
|
@@ -26457,6 +26462,12 @@ function chunkString(str, len) {
|
|
|
26457
26462
|
}
|
|
26458
26463
|
|
|
26459
26464
|
const maxSizeMessage = 4096;
|
|
26465
|
+
var DeclineCause;
|
|
26466
|
+
(function (DeclineCause) {
|
|
26467
|
+
DeclineCause["Timeout"] = "TIMEOUT";
|
|
26468
|
+
DeclineCause["Busy"] = "BUSY";
|
|
26469
|
+
DeclineCause["Cancel"] = "CANCEL";
|
|
26470
|
+
})(DeclineCause || (DeclineCause = {}));
|
|
26460
26471
|
var ChatActions;
|
|
26461
26472
|
(function (ChatActions) {
|
|
26462
26473
|
ChatActions["Message"] = "message";
|
|
@@ -26496,6 +26507,8 @@ class Conversation {
|
|
|
26496
26507
|
this.variables = {};
|
|
26497
26508
|
this._hasReporting = !!(variables && variables.cc_reporting === 'true');
|
|
26498
26509
|
this._autoAnswer = false;
|
|
26510
|
+
this._cause = null;
|
|
26511
|
+
this.lastAction = null;
|
|
26499
26512
|
for (const k in variables) {
|
|
26500
26513
|
if (!k.startsWith('cc_') && variables.hasOwnProperty(k)) {
|
|
26501
26514
|
if (k === 'wbt_auto_answer') {
|
|
@@ -26532,9 +26545,19 @@ class Conversation {
|
|
|
26532
26545
|
this.state = ConversationState.Closed;
|
|
26533
26546
|
this.closedAt = timestamp;
|
|
26534
26547
|
}
|
|
26548
|
+
setDecline(e) {
|
|
26549
|
+
this.setClosed(e.timestamp);
|
|
26550
|
+
this._cause = e.cause || null;
|
|
26551
|
+
}
|
|
26552
|
+
setLeave(e) {
|
|
26553
|
+
this.setClosed(e.timestamp);
|
|
26554
|
+
}
|
|
26535
26555
|
get id() {
|
|
26536
26556
|
return this.channelId || this.inviteId || this.conversationId;
|
|
26537
26557
|
}
|
|
26558
|
+
get cause() {
|
|
26559
|
+
return this._cause;
|
|
26560
|
+
}
|
|
26538
26561
|
get messages() {
|
|
26539
26562
|
return this.getMessages();
|
|
26540
26563
|
}
|
|
@@ -26579,7 +26602,7 @@ class Conversation {
|
|
|
26579
26602
|
return !!this.inviteId;
|
|
26580
26603
|
}
|
|
26581
26604
|
get allowLeave() {
|
|
26582
|
-
return !!this.channelId && this.closedAt === 0;
|
|
26605
|
+
return !!this.channelId && (this.closedAt === 0 || !this.hasReporting);
|
|
26583
26606
|
}
|
|
26584
26607
|
get allowReporting() {
|
|
26585
26608
|
return this.answeredAt > 0 && this.hasReporting;
|
|
@@ -26601,11 +26624,16 @@ class Conversation {
|
|
|
26601
26624
|
/*
|
|
26602
26625
|
Actions
|
|
26603
26626
|
*/
|
|
26604
|
-
async decline() {
|
|
26627
|
+
async decline(cause) {
|
|
26605
26628
|
if (!this.inviteId)
|
|
26606
26629
|
throw new Error('This conversation is joined');
|
|
26630
|
+
let _cause = cause;
|
|
26631
|
+
if (!cause && this.answeredAt === 0) {
|
|
26632
|
+
_cause = DeclineCause.Busy;
|
|
26633
|
+
}
|
|
26607
26634
|
return this.client.request(`decline_chat`, {
|
|
26608
26635
|
invite_id: this.inviteId,
|
|
26636
|
+
cause: _cause,
|
|
26609
26637
|
});
|
|
26610
26638
|
}
|
|
26611
26639
|
async join() {
|
|
@@ -26627,6 +26655,11 @@ class Conversation {
|
|
|
26627
26655
|
async leave(cause) {
|
|
26628
26656
|
if (!this.channelId)
|
|
26629
26657
|
throw new Error('This conversation not active');
|
|
26658
|
+
if (this.closedAt !== 0 &&
|
|
26659
|
+
!this.hasReporting &&
|
|
26660
|
+
this.cause !== DeclineCause.Busy) {
|
|
26661
|
+
return this.client.destroyConversation(this);
|
|
26662
|
+
}
|
|
26630
26663
|
return this.client.request(`leave_chat`, {
|
|
26631
26664
|
channel_id: this.channelId,
|
|
26632
26665
|
conversation_id: this.conversationId,
|
|
@@ -27162,7 +27195,10 @@ class Client extends EventEmitter {
|
|
|
27162
27195
|
return call.hangupAt > 0 && !this.hasAgentTask(call.task);
|
|
27163
27196
|
}
|
|
27164
27197
|
conversationDestroyed(conv) {
|
|
27165
|
-
return conv.closedAt > 0 &&
|
|
27198
|
+
return (conv.closedAt > 0 &&
|
|
27199
|
+
!this.hasAgentTask(conv.task) &&
|
|
27200
|
+
(conv.hasReporting ||
|
|
27201
|
+
!(conv.lastAction === ChatActions.Close && conv.answeredAt > 0)));
|
|
27166
27202
|
}
|
|
27167
27203
|
reportingChannelTask(task) {
|
|
27168
27204
|
switch (task.channel) {
|
|
@@ -27188,29 +27224,34 @@ class Client extends EventEmitter {
|
|
|
27188
27224
|
}
|
|
27189
27225
|
async registerCallClient(phone) {
|
|
27190
27226
|
this.phone = phone;
|
|
27191
|
-
this.phone
|
|
27227
|
+
this.subscribePhone(phone);
|
|
27228
|
+
try {
|
|
27229
|
+
const conf = await this.deviceConfig(this.phone.type);
|
|
27230
|
+
await this.phone.register(conf);
|
|
27231
|
+
}
|
|
27232
|
+
catch (e) {
|
|
27233
|
+
// FIXME add handle error
|
|
27234
|
+
this.log.error(e);
|
|
27235
|
+
}
|
|
27236
|
+
}
|
|
27237
|
+
subscribePhone(phone) {
|
|
27238
|
+
phone.on('peerStreams', (session, streams) => {
|
|
27192
27239
|
const call = this.callBySession(session);
|
|
27193
27240
|
if (call && !call.peerStreams.length) {
|
|
27194
27241
|
call.setPeerStreams(streams);
|
|
27195
27242
|
this.eventHandler.emit(WEBSOCKET_EVENT_CALL, CallActions.PeerStream, call);
|
|
27196
27243
|
}
|
|
27197
27244
|
});
|
|
27198
|
-
|
|
27245
|
+
phone.on('localStreams', (session, streams) => {
|
|
27199
27246
|
const call = this.callBySession(session);
|
|
27200
27247
|
if (call && !call.localStreams.length) {
|
|
27201
27248
|
call.setLocalStreams(streams);
|
|
27202
27249
|
this.eventHandler.emit(WEBSOCKET_EVENT_CALL, CallActions.LocalStream, call);
|
|
27203
27250
|
}
|
|
27204
27251
|
});
|
|
27205
|
-
|
|
27206
|
-
|
|
27207
|
-
|
|
27208
|
-
await this.phone.register(conf);
|
|
27209
|
-
}
|
|
27210
|
-
catch (e) {
|
|
27211
|
-
// FIXME add handle error
|
|
27212
|
-
this.log.error(e);
|
|
27213
|
-
}
|
|
27252
|
+
phone.on('newSession', this.onNewCallSession.bind(this));
|
|
27253
|
+
phone.on('registered', () => this.emit('phone_registered', true));
|
|
27254
|
+
phone.on('unregistered', () => this.emit('phone_registered', false));
|
|
27214
27255
|
}
|
|
27215
27256
|
async deviceConfig(name) {
|
|
27216
27257
|
return this.request(WEBSOCKET_DEFAULT_DEVICE_CONFIG, { name });
|
|
@@ -27255,6 +27296,11 @@ class Client extends EventEmitter {
|
|
|
27255
27296
|
}
|
|
27256
27297
|
}
|
|
27257
27298
|
}
|
|
27299
|
+
destroyConversation(conv) {
|
|
27300
|
+
// FIXME sync channel & call event
|
|
27301
|
+
this.conversationStore.delete(conv.id);
|
|
27302
|
+
this.eventHandler.emit(WEBSOCKET_EVENT_CHAT, ChatActions.Destroy, conv);
|
|
27303
|
+
}
|
|
27258
27304
|
async onMessage(message) {
|
|
27259
27305
|
this.log.debug('receive message: ', message);
|
|
27260
27306
|
if (message.seq_reply > 0) {
|
|
@@ -27513,19 +27559,20 @@ class Client extends EventEmitter {
|
|
|
27513
27559
|
const l = event.data;
|
|
27514
27560
|
conversation = this.conversationById(l.leaved_channel_id);
|
|
27515
27561
|
if (conversation) {
|
|
27516
|
-
conversation.
|
|
27562
|
+
conversation.setLeave(l);
|
|
27517
27563
|
}
|
|
27518
27564
|
break;
|
|
27519
27565
|
case ChatActions.Decline:
|
|
27520
27566
|
const e = event.data;
|
|
27521
27567
|
conversation = this.conversationById(e.invite_id);
|
|
27522
27568
|
if (conversation) {
|
|
27523
|
-
conversation.
|
|
27569
|
+
conversation.setDecline(e);
|
|
27524
27570
|
}
|
|
27525
27571
|
break;
|
|
27526
27572
|
default:
|
|
27527
27573
|
}
|
|
27528
27574
|
if (conversation) {
|
|
27575
|
+
conversation.lastAction = event.action;
|
|
27529
27576
|
this.eventHandler.emit(WEBSOCKET_EVENT_CHAT, event.action, conversation);
|
|
27530
27577
|
if (this.conversationDestroyed(conversation)) {
|
|
27531
27578
|
this.destroyConversation(conversation);
|
|
@@ -27543,11 +27590,6 @@ class Client extends EventEmitter {
|
|
|
27543
27590
|
this.callStore.delete(call.id);
|
|
27544
27591
|
this.eventHandler.emit(WEBSOCKET_EVENT_CALL, CallActions.Destroy, call);
|
|
27545
27592
|
}
|
|
27546
|
-
destroyConversation(conv) {
|
|
27547
|
-
// FIXME sync channel & call event
|
|
27548
|
-
this.conversationStore.delete(conv.id);
|
|
27549
|
-
this.eventHandler.emit(WEBSOCKET_EVENT_CHAT, ChatActions.Destroy, conv);
|
|
27550
|
-
}
|
|
27551
27593
|
}
|
|
27552
27594
|
function isJobTask(task) {
|
|
27553
27595
|
return task.channel === ChannelName.Task;
|
|
@@ -27952,5 +27994,5 @@ class ExternalClient extends ee_3 {
|
|
|
27952
27994
|
|
|
27953
27995
|
// tslint:disable
|
|
27954
27996
|
|
|
27955
|
-
export { AgentPauseCauseServiceApiAxiosParamCreator, AgentPauseCauseServiceApiFp, AgentPauseCauseServiceApiFactory, AgentPauseCauseServiceApi, AgentServiceApiAxiosParamCreator, AgentServiceApiFp, AgentServiceApiFactory, AgentServiceApi, AgentSkillServiceApiAxiosParamCreator, AgentSkillServiceApiFp, AgentSkillServiceApiFactory, AgentSkillServiceApi, AgentTeamServiceApiAxiosParamCreator, AgentTeamServiceApiFp, AgentTeamServiceApiFactory, AgentTeamServiceApi, BackendProfileServiceApiAxiosParamCreator, BackendProfileServiceApiFp, BackendProfileServiceApiFactory, BackendProfileServiceApi, BucketServiceApiAxiosParamCreator, BucketServiceApiFp, BucketServiceApiFactory, BucketServiceApi, CalendarServiceApiAxiosParamCreator, CalendarServiceApiFp, CalendarServiceApiFactory, CalendarServiceApi, CallServiceApiAxiosParamCreator, CallServiceApiFp, CallServiceApiFactory, CallServiceApi, CognitiveProfileServiceApiAxiosParamCreator, CognitiveProfileServiceApiFp, CognitiveProfileServiceApiFactory, CognitiveProfileServiceApi, CommunicationTypeServiceApiAxiosParamCreator, CommunicationTypeServiceApiFp, CommunicationTypeServiceApiFactory, CommunicationTypeServiceApi, EmailProfileServiceApiAxiosParamCreator, EmailProfileServiceApiFp, EmailProfileServiceApiFactory, EmailProfileServiceApi, FileServiceApiAxiosParamCreator, FileServiceApiFp, FileServiceApiFactory, FileServiceApi, FileTranscriptServiceApiAxiosParamCreator, FileTranscriptServiceApiFp, FileTranscriptServiceApiFactory, FileTranscriptServiceApi, ImportTemplateServiceApiAxiosParamCreator, ImportTemplateServiceApiFp, ImportTemplateServiceApiFactory, ImportTemplateServiceApi, ListServiceApiAxiosParamCreator, ListServiceApiFp, ListServiceApiFactory, ListServiceApi, MediaFileServiceApiAxiosParamCreator, MediaFileServiceApiFp, MediaFileServiceApiFactory, MediaFileServiceApi, MemberServiceApiAxiosParamCreator, MemberServiceApiFp, MemberServiceApiFactory, MemberServiceApi, OutboundResourceGroupServiceApiAxiosParamCreator, OutboundResourceGroupServiceApiFp, OutboundResourceGroupServiceApiFactory, OutboundResourceGroupServiceApi, OutboundResourceServiceApiAxiosParamCreator, OutboundResourceServiceApiFp, OutboundResourceServiceApiFactory, OutboundResourceServiceApi, QueueBucketServiceApiAxiosParamCreator, QueueBucketServiceApiFp, QueueBucketServiceApiFactory, QueueBucketServiceApi, QueueHookServiceApiAxiosParamCreator, QueueHookServiceApiFp, QueueHookServiceApiFactory, QueueHookServiceApi, QueueResourcesServiceApiAxiosParamCreator, QueueResourcesServiceApiFp, QueueResourcesServiceApiFactory, QueueResourcesServiceApi, QueueServiceApiAxiosParamCreator, QueueServiceApiFp, QueueServiceApiFactory, QueueServiceApi, QueueSkillServiceApiAxiosParamCreator, QueueSkillServiceApiFp, QueueSkillServiceApiFactory, QueueSkillServiceApi, RegionServiceApiAxiosParamCreator, RegionServiceApiFp, RegionServiceApiFactory, RegionServiceApi, RoutingChatPlanServiceApiAxiosParamCreator, RoutingChatPlanServiceApiFp, RoutingChatPlanServiceApiFactory, RoutingChatPlanServiceApi, RoutingOutboundCallServiceApiAxiosParamCreator, RoutingOutboundCallServiceApiFp, RoutingOutboundCallServiceApiFactory, RoutingOutboundCallServiceApi, RoutingSchemaServiceApiAxiosParamCreator, RoutingSchemaServiceApiFp, RoutingSchemaServiceApiFactory, RoutingSchemaServiceApi, RoutingVariableServiceApiAxiosParamCreator, RoutingVariableServiceApiFp, RoutingVariableServiceApiFactory, RoutingVariableServiceApi, SkillServiceApiAxiosParamCreator, SkillServiceApiFp, SkillServiceApiFactory, SkillServiceApi, UserHelperServiceApiAxiosParamCreator, UserHelperServiceApiFp, UserHelperServiceApiFactory, UserHelperServiceApi, Configuration, EngineBoolFilter, HistoryFileJobHistoryFileJobAction, HistoryFileJobHistoryFileJobState, ProtobufNullValue, StorageImportSourceType, StorageProviderType, StorageServiceType, StorageUploadStatusCode, JobState, Response, Client, CallReportingStatus, CallActions, CallDirection, Call, AgentStatus, ChannelState, ChannelType, Agent, ChatActions, ConversationState, Conversation, DeviceNotFoundError, DeviceNotAllowPermissionError, SipClient, ExternalClient, SipPhone, Log };
|
|
27997
|
+
export { AgentPauseCauseServiceApiAxiosParamCreator, AgentPauseCauseServiceApiFp, AgentPauseCauseServiceApiFactory, AgentPauseCauseServiceApi, AgentServiceApiAxiosParamCreator, AgentServiceApiFp, AgentServiceApiFactory, AgentServiceApi, AgentSkillServiceApiAxiosParamCreator, AgentSkillServiceApiFp, AgentSkillServiceApiFactory, AgentSkillServiceApi, AgentTeamServiceApiAxiosParamCreator, AgentTeamServiceApiFp, AgentTeamServiceApiFactory, AgentTeamServiceApi, BackendProfileServiceApiAxiosParamCreator, BackendProfileServiceApiFp, BackendProfileServiceApiFactory, BackendProfileServiceApi, BucketServiceApiAxiosParamCreator, BucketServiceApiFp, BucketServiceApiFactory, BucketServiceApi, CalendarServiceApiAxiosParamCreator, CalendarServiceApiFp, CalendarServiceApiFactory, CalendarServiceApi, CallServiceApiAxiosParamCreator, CallServiceApiFp, CallServiceApiFactory, CallServiceApi, CognitiveProfileServiceApiAxiosParamCreator, CognitiveProfileServiceApiFp, CognitiveProfileServiceApiFactory, CognitiveProfileServiceApi, CommunicationTypeServiceApiAxiosParamCreator, CommunicationTypeServiceApiFp, CommunicationTypeServiceApiFactory, CommunicationTypeServiceApi, EmailProfileServiceApiAxiosParamCreator, EmailProfileServiceApiFp, EmailProfileServiceApiFactory, EmailProfileServiceApi, FileServiceApiAxiosParamCreator, FileServiceApiFp, FileServiceApiFactory, FileServiceApi, FileTranscriptServiceApiAxiosParamCreator, FileTranscriptServiceApiFp, FileTranscriptServiceApiFactory, FileTranscriptServiceApi, ImportTemplateServiceApiAxiosParamCreator, ImportTemplateServiceApiFp, ImportTemplateServiceApiFactory, ImportTemplateServiceApi, ListServiceApiAxiosParamCreator, ListServiceApiFp, ListServiceApiFactory, ListServiceApi, MediaFileServiceApiAxiosParamCreator, MediaFileServiceApiFp, MediaFileServiceApiFactory, MediaFileServiceApi, MemberServiceApiAxiosParamCreator, MemberServiceApiFp, MemberServiceApiFactory, MemberServiceApi, OutboundResourceGroupServiceApiAxiosParamCreator, OutboundResourceGroupServiceApiFp, OutboundResourceGroupServiceApiFactory, OutboundResourceGroupServiceApi, OutboundResourceServiceApiAxiosParamCreator, OutboundResourceServiceApiFp, OutboundResourceServiceApiFactory, OutboundResourceServiceApi, QueueBucketServiceApiAxiosParamCreator, QueueBucketServiceApiFp, QueueBucketServiceApiFactory, QueueBucketServiceApi, QueueHookServiceApiAxiosParamCreator, QueueHookServiceApiFp, QueueHookServiceApiFactory, QueueHookServiceApi, QueueResourcesServiceApiAxiosParamCreator, QueueResourcesServiceApiFp, QueueResourcesServiceApiFactory, QueueResourcesServiceApi, QueueServiceApiAxiosParamCreator, QueueServiceApiFp, QueueServiceApiFactory, QueueServiceApi, QueueSkillServiceApiAxiosParamCreator, QueueSkillServiceApiFp, QueueSkillServiceApiFactory, QueueSkillServiceApi, RegionServiceApiAxiosParamCreator, RegionServiceApiFp, RegionServiceApiFactory, RegionServiceApi, RoutingChatPlanServiceApiAxiosParamCreator, RoutingChatPlanServiceApiFp, RoutingChatPlanServiceApiFactory, RoutingChatPlanServiceApi, RoutingOutboundCallServiceApiAxiosParamCreator, RoutingOutboundCallServiceApiFp, RoutingOutboundCallServiceApiFactory, RoutingOutboundCallServiceApi, RoutingSchemaServiceApiAxiosParamCreator, RoutingSchemaServiceApiFp, RoutingSchemaServiceApiFactory, RoutingSchemaServiceApi, RoutingVariableServiceApiAxiosParamCreator, RoutingVariableServiceApiFp, RoutingVariableServiceApiFactory, RoutingVariableServiceApi, SkillServiceApiAxiosParamCreator, SkillServiceApiFp, SkillServiceApiFactory, SkillServiceApi, UserHelperServiceApiAxiosParamCreator, UserHelperServiceApiFp, UserHelperServiceApiFactory, UserHelperServiceApi, Configuration, EngineBoolFilter, HistoryFileJobHistoryFileJobAction, HistoryFileJobHistoryFileJobState, ProtobufNullValue, StorageImportSourceType, StorageProviderType, StorageServiceType, StorageUploadStatusCode, JobState, Response, Client, CallReportingStatus, CallActions, CallDirection, Call, AgentStatus, ChannelState, ChannelType, Agent, DeclineCause, ChatActions, ConversationState, Conversation, DeviceNotFoundError, DeviceNotAllowPermissionError, SipClient, ExternalClient, SipPhone, Log };
|
|
27956
27998
|
//# sourceMappingURL=index.esm.js.map
|