webitel-sdk 23.7.5 → 23.7.6

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.
@@ -39284,7 +39284,8 @@ class Agent {
39284
39284
  this._channels = new Map();
39285
39285
  this.initChannels(info.channels);
39286
39286
  this._listOfflineMembers = null;
39287
- this.waitingList = [];
39287
+ this.waitingListChats = [];
39288
+ this.waitingListCalls = [];
39288
39289
  this.lastStatusChange = Date.now() - this.info.status_duration * 1000;
39289
39290
  }
39290
39291
  get agentId() {
@@ -39327,18 +39328,26 @@ class Agent {
39327
39328
  setWaitingList(e) {
39328
39329
  if (e) {
39329
39330
  const list = e.list;
39330
- this.waitingList.length = 0;
39331
- this.waitingList = this.waitingList.concat(...list);
39331
+ this.waitingListCalls.length = 0;
39332
+ this.waitingListChats.length = 0;
39333
+ for (const el of list) {
39334
+ switch (el.channel) {
39335
+ case ChannelType.Call:
39336
+ this.waitingListCalls.push(el);
39337
+ break;
39338
+ case ChannelType.Chat:
39339
+ this.waitingListChats.push(el);
39340
+ break;
39341
+ default:
39342
+ }
39343
+ }
39332
39344
  }
39333
39345
  }
39334
39346
  deleteWaitingAttempt(e) {
39335
39347
  if (e) {
39336
39348
  const attemptId = e.attempt_id;
39337
- for (let i = 0; i < this.waitingList.length; i++) {
39338
- if (this.waitingList[i].attempt_id === attemptId) {
39339
- this.waitingList.splice(i, 1);
39340
- break;
39341
- }
39349
+ if (!removeWaitingList(this.waitingListCalls, attemptId)) {
39350
+ removeWaitingList(this.waitingListChats, attemptId);
39342
39351
  }
39343
39352
  }
39344
39353
  }
@@ -39551,6 +39560,15 @@ class Agent {
39551
39560
  }
39552
39561
  }
39553
39562
  }
39563
+ function removeWaitingList(list, attemptId) {
39564
+ for (let i = 0; i < list.length; i++) {
39565
+ if (list[i].attempt_id === attemptId) {
39566
+ list.splice(i, 1);
39567
+ return true;
39568
+ }
39569
+ }
39570
+ return false;
39571
+ }
39554
39572
 
39555
39573
  var CallReportingStatus;
39556
39574
  (function (CallReportingStatus) {