@vgroup/dialbox 0.7.32 → 0.7.33

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.
@@ -2136,7 +2136,7 @@ class CallProgressComponent {
2136
2136
  this.newIncomingCallsList.forEach((callInfo, i) => {
2137
2137
  var _a, _b;
2138
2138
  this.conferenceId = i == 0 ? this.newIncomingCallsList[i].conferenceId : this.conferenceId;
2139
- let ourNumberInfo = (_a = this.newIncomingCallsList[i]) === null || _a === void 0 ? void 0 : _a.participants.find((resData) => { var _a; return ((this.deviceNumberList.includes(resData === null || resData === void 0 ? void 0 : resData.from) && (resData === null || resData === void 0 ? void 0 : resData.direction) == 'outgoing-call') || (this.deviceNumberList.includes(resData === null || resData === void 0 ? void 0 : resData.to) && (resData === null || resData === void 0 ? void 0 : resData.direction) == 'incoming-call' && (!(resData === null || resData === void 0 ? void 0 : resData.businessNumber) || ((resData === null || resData === void 0 ? void 0 : resData.businessNumber) && ((_a = callInfo === null || callInfo === void 0 ? void 0 : callInfo.participants) === null || _a === void 0 ? void 0 : _a.length) == 1)))) && !(resData === null || resData === void 0 ? void 0 : resData.isLeft); });
2139
+ let ourNumberInfo = (_a = this.newIncomingCallsList[i]) === null || _a === void 0 ? void 0 : _a.participants.find((resData) => { var _a; return ((this.deviceNumberList.includes(resData === null || resData === void 0 ? void 0 : resData.from) && (resData === null || resData === void 0 ? void 0 : resData.direction) == 'outgoing-call' && (resData === null || resData === void 0 ? void 0 : resData.client)) || (this.deviceNumberList.includes(resData === null || resData === void 0 ? void 0 : resData.to) && (resData === null || resData === void 0 ? void 0 : resData.direction) == 'incoming-call' && (!(resData === null || resData === void 0 ? void 0 : resData.businessNumber) || ((resData === null || resData === void 0 ? void 0 : resData.businessNumber) && ((_a = callInfo === null || callInfo === void 0 ? void 0 : callInfo.participants) === null || _a === void 0 ? void 0 : _a.length) == 1)))) && !(resData === null || resData === void 0 ? void 0 : resData.isLeft); });
2140
2140
  if (!this.pendingMuteUpdate) {
2141
2141
  this.isMute = !(ourNumberInfo === null || ourNumberInfo === void 0 ? void 0 : ourNumberInfo.isHold) ? ourNumberInfo === null || ourNumberInfo === void 0 ? void 0 : ourNumberInfo.isMute : this.isMute;
2142
2142
  }
@@ -4493,9 +4493,15 @@ class DialboxComponent {
4493
4493
  this.incomeingCallSocketService.connect(this.deviceId);
4494
4494
  try {
4495
4495
  this.incomeingCallSocketService.listen().subscribe((incomingCallData) => __awaiter(this, void 0, void 0, function* () {
4496
- var _a, _b, _c;
4496
+ var _a, _b, _c, _d, _e, _f;
4497
4497
  this.twilioService.conferenceCallInfo = incomingCallData;
4498
4498
  this.conferenceCallList.emit(incomingCallData);
4499
+ this.token = localStorage.getItem('ext_token') || '';
4500
+ if (!this.token) {
4501
+ console.error('No authentication token found');
4502
+ (_a = this.twilioService.device) === null || _a === void 0 ? void 0 : _a.disconnectAll();
4503
+ return;
4504
+ }
4499
4505
  // Filter out conferences with no participants
4500
4506
  incomingCallData = (incomingCallData === null || incomingCallData === void 0 ? void 0 : incomingCallData.length) > 0
4501
4507
  ? incomingCallData.filter((item) => { var _a; return ((_a = item.participants) === null || _a === void 0 ? void 0 : _a.length) > 0; })
@@ -4567,7 +4573,7 @@ class DialboxComponent {
4567
4573
  const activeConferenceIds = new Set(finalList.filter((item) => !item._isNotification).map((item) => item.conferenceId));
4568
4574
  finalList = finalList.filter((item) => !(item._isNotification && activeConferenceIds.has(item.conferenceId)));
4569
4575
  this.incomingCallsList = finalList;
4570
- if (((_a = this.incomingCallsList) === null || _a === void 0 ? void 0 : _a.length) && (incomingCallData === null || incomingCallData === void 0 ? void 0 : incomingCallData.length)) {
4576
+ if (((_b = this.incomingCallsList) === null || _b === void 0 ? void 0 : _b.length) && (incomingCallData === null || incomingCallData === void 0 ? void 0 : incomingCallData.length)) {
4571
4577
  this.isCallInProgress = true;
4572
4578
  this.isDialpadHidden = false;
4573
4579
  this.isLoadershow = false;
@@ -4576,8 +4582,8 @@ class DialboxComponent {
4576
4582
  }
4577
4583
  else {
4578
4584
  const hasPendingNotifications = this.incomingCallsList.some((res) => (res === null || res === void 0 ? void 0 : res._isNotification) || (res === null || res === void 0 ? void 0 : res.direction) === 'incoming-call');
4579
- const hasAcceptedCalls = ((_b = this.twilioService.acceptedCallList) === null || _b === void 0 ? void 0 : _b.length) > 0;
4580
- if ((hasAcceptedCalls || hasPendingNotifications) && ((_c = this.incomingCallsList) === null || _c === void 0 ? void 0 : _c.length)) {
4585
+ const hasAcceptedCalls = ((_c = this.twilioService.acceptedCallList) === null || _c === void 0 ? void 0 : _c.length) > 0;
4586
+ if ((hasAcceptedCalls || hasPendingNotifications) && ((_d = this.incomingCallsList) === null || _d === void 0 ? void 0 : _d.length)) {
4581
4587
  this.isCallInProgress = true;
4582
4588
  this.cdk.detectChanges();
4583
4589
  }
@@ -4594,6 +4600,10 @@ class DialboxComponent {
4594
4600
  }, 2000);
4595
4601
  }
4596
4602
  }
4603
+ if (!((_e = this.incomingCallsList) === null || _e === void 0 ? void 0 : _e.length)) {
4604
+ this.isCallInProgress = false;
4605
+ (_f = this.twilioService.device) === null || _f === void 0 ? void 0 : _f.disconnectAll();
4606
+ }
4597
4607
  }));
4598
4608
  this.token = localStorage.getItem('ext_token') || '';
4599
4609
  this.getContactList();