webitel-sdk 0.1.147 → 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.
@@ -28509,7 +28509,7 @@
28509
28509
 
28510
28510
  var getVersion = function () {
28511
28511
  // @ts-ignore
28512
- return '"0.1.147"';
28512
+ return '"0.1.148"';
28513
28513
  };
28514
28514
  var version = getVersion();
28515
28515
 
@@ -29175,6 +29175,11 @@
29175
29175
  CallReportingStatus["Abandoned"] = "abandoned";
29176
29176
  CallReportingStatus["Cancel"] = "cancel";
29177
29177
  CallReportingStatus["Success"] = "success";
29178
+ CallReportingStatus["Failed"] = "failed";
29179
+ CallReportingStatus["Missed"] = "missed";
29180
+ CallReportingStatus["Timeout"] = "timeout";
29181
+ CallReportingStatus["Endless"] = "endless";
29182
+ CallReportingStatus["Transferred"] = "transferred";
29178
29183
  })(exports.CallReportingStatus || (exports.CallReportingStatus = {}));
29179
29184
  (function (CallActions) {
29180
29185
  CallActions["Ringing"] = "ringing";
@@ -29794,6 +29799,7 @@
29794
29799
  this._hasReporting = !!(variables && variables.cc_reporting === 'true');
29795
29800
  this._autoAnswer = false;
29796
29801
  this._cause = null;
29802
+ this.lastAction = null;
29797
29803
  for (var k in variables) {
29798
29804
  if (!k.startsWith('cc_') && variables.hasOwnProperty(k)) {
29799
29805
  if (k === 'wbt_auto_answer') {
@@ -29832,10 +29838,12 @@
29832
29838
  this.closedAt = timestamp;
29833
29839
  };
29834
29840
  Conversation.prototype.setDecline = function (e) {
29835
- this.state = exports.ConversationState.Closed;
29836
- this.closedAt = e.timestamp;
29841
+ this.setClosed(e.timestamp);
29837
29842
  this._cause = e.cause || null;
29838
29843
  };
29844
+ Conversation.prototype.setLeave = function (e) {
29845
+ this.setClosed(e.timestamp);
29846
+ };
29839
29847
  Object.defineProperty(Conversation.prototype, "id", {
29840
29848
  get: function () {
29841
29849
  return this.channelId || this.inviteId || this.conversationId;
@@ -30775,11 +30783,10 @@
30775
30783
  return call.hangupAt > 0 && !this.hasAgentTask(call.task);
30776
30784
  };
30777
30785
  Client.prototype.conversationDestroyed = function (conv) {
30778
- var res = conv.closedAt > 0 &&
30779
- (!this.hasAgentTask(conv.task) &&
30780
- (conv.hasReporting ||
30781
- [exports.DeclineCause.Busy, exports.DeclineCause.Timeout].indexOf(conv.cause) > -1));
30782
- return res;
30786
+ return (conv.closedAt > 0 &&
30787
+ !this.hasAgentTask(conv.task) &&
30788
+ (conv.hasReporting ||
30789
+ !(conv.lastAction === exports.ChatActions.Close && conv.answeredAt > 0)));
30783
30790
  };
30784
30791
  Client.prototype.reportingChannelTask = function (task) {
30785
30792
  switch (task.channel) {
@@ -31239,7 +31246,7 @@
31239
31246
  l = event.data;
31240
31247
  conversation = this.conversationById(l.leaved_channel_id);
31241
31248
  if (conversation) {
31242
- conversation.setClosed(timestamp);
31249
+ conversation.setLeave(l);
31243
31250
  }
31244
31251
  break;
31245
31252
  case exports.ChatActions.Decline:
@@ -31252,6 +31259,7 @@
31252
31259
  default:
31253
31260
  }
31254
31261
  if (conversation) {
31262
+ conversation.lastAction = event.action;
31255
31263
  this.eventHandler.emit(WEBSOCKET_EVENT_CHAT, event.action, conversation);
31256
31264
  if (this.conversationDestroyed(conversation)) {
31257
31265
  this.destroyConversation(conversation);