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.
@@ -25556,7 +25556,7 @@ async function getMediaStream(constraints) {
25556
25556
 
25557
25557
  const getVersion = () => {
25558
25558
  // @ts-ignore
25559
- return '"0.1.147"';
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) {
@@ -26503,6 +26508,7 @@ class Conversation {
26503
26508
  this._hasReporting = !!(variables && variables.cc_reporting === 'true');
26504
26509
  this._autoAnswer = false;
26505
26510
  this._cause = null;
26511
+ this.lastAction = null;
26506
26512
  for (const k in variables) {
26507
26513
  if (!k.startsWith('cc_') && variables.hasOwnProperty(k)) {
26508
26514
  if (k === 'wbt_auto_answer') {
@@ -26540,10 +26546,12 @@ class Conversation {
26540
26546
  this.closedAt = timestamp;
26541
26547
  }
26542
26548
  setDecline(e) {
26543
- this.state = ConversationState.Closed;
26544
- this.closedAt = e.timestamp;
26549
+ this.setClosed(e.timestamp);
26545
26550
  this._cause = e.cause || null;
26546
26551
  }
26552
+ setLeave(e) {
26553
+ this.setClosed(e.timestamp);
26554
+ }
26547
26555
  get id() {
26548
26556
  return this.channelId || this.inviteId || this.conversationId;
26549
26557
  }
@@ -27187,11 +27195,10 @@ class Client extends EventEmitter {
27187
27195
  return call.hangupAt > 0 && !this.hasAgentTask(call.task);
27188
27196
  }
27189
27197
  conversationDestroyed(conv) {
27190
- const res = conv.closedAt > 0 &&
27191
- (!this.hasAgentTask(conv.task) &&
27192
- (conv.hasReporting ||
27193
- [DeclineCause.Busy, DeclineCause.Timeout].indexOf(conv.cause) > -1));
27194
- return res;
27198
+ return (conv.closedAt > 0 &&
27199
+ !this.hasAgentTask(conv.task) &&
27200
+ (conv.hasReporting ||
27201
+ !(conv.lastAction === ChatActions.Close && conv.answeredAt > 0)));
27195
27202
  }
27196
27203
  reportingChannelTask(task) {
27197
27204
  switch (task.channel) {
@@ -27552,7 +27559,7 @@ class Client extends EventEmitter {
27552
27559
  const l = event.data;
27553
27560
  conversation = this.conversationById(l.leaved_channel_id);
27554
27561
  if (conversation) {
27555
- conversation.setClosed(timestamp);
27562
+ conversation.setLeave(l);
27556
27563
  }
27557
27564
  break;
27558
27565
  case ChatActions.Decline:
@@ -27565,6 +27572,7 @@ class Client extends EventEmitter {
27565
27572
  default:
27566
27573
  }
27567
27574
  if (conversation) {
27575
+ conversation.lastAction = event.action;
27568
27576
  this.eventHandler.emit(WEBSOCKET_EVENT_CHAT, event.action, conversation);
27569
27577
  if (this.conversationDestroyed(conversation)) {
27570
27578
  this.destroyConversation(conversation);