@vgroup/dialbox 0.7.10 → 0.7.11

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.
@@ -1900,6 +1900,8 @@ class CallProgressComponent {
1900
1900
  this.C2ConfoList = {};
1901
1901
  this.lastActiveConferenceId = null;
1902
1902
  this.pendingAutoUnhold = false;
1903
+ this.pendingMuteParticipants = new Set();
1904
+ this.intendedMuteStates = new Map();
1903
1905
  this.isMinimised = false;
1904
1906
  this.showDisconnectModal = false;
1905
1907
  this.call = this.twilioService.call;
@@ -2027,6 +2029,31 @@ class CallProgressComponent {
2027
2029
  this.startTimer(this.currentCall?.joinedAt);
2028
2030
  }
2029
2031
  else if (index != -1 && !res?.isLeft) {
2032
+ //console.log(res);
2033
+ const participantId = res.id;
2034
+ // Check if a mute update is pending for this participant
2035
+ const isMutePending = this.pendingMuteParticipants.has(participantId);
2036
+ const intendedMute = this.intendedMuteStates.get(participantId);
2037
+ console.log("is mute pending =>", isMutePending);
2038
+ console.log("intended mute =>", intendedMute);
2039
+ console.log(participantId);
2040
+ let updatedMute;
2041
+ if (isMutePending) {
2042
+ // If the server already confirmed our change, accept it and clear pending
2043
+ if (res.isMute === intendedMute) {
2044
+ updatedMute = res.isMute;
2045
+ this.pendingMuteParticipants.delete(participantId);
2046
+ this.intendedMuteStates.delete(participantId);
2047
+ }
2048
+ else {
2049
+ // Otherwise, keep the current local value (ignore the stale server state)
2050
+ updatedMute = this.currentCallList[index].isMute;
2051
+ }
2052
+ }
2053
+ else {
2054
+ // No pending mute – trust the server value
2055
+ updatedMute = res.isMute;
2056
+ }
2030
2057
  this.currentCallList[index] = {
2031
2058
  ...res,
2032
2059
  fromName: this.getName(res?.from) || '',
@@ -2035,7 +2062,7 @@ class CallProgressComponent {
2035
2062
  isIncomingCall: res?.direction == "incoming-call",
2036
2063
  isHold: res?.isHold,
2037
2064
  isConferenceHold: this.newIncomingCallsList?.length > 1 ? ourNumberInfo?.isHold : false,
2038
- isMute: res?.isMute,
2065
+ isMute: updatedMute,
2039
2066
  isConference: res.isConference ? res.isConference : this.isConference,
2040
2067
  isAcceptCall: res.direction == "incoming-call" ? this.getStatus(res) : true,
2041
2068
  dial: true,
@@ -2371,6 +2398,7 @@ class CallProgressComponent {
2371
2398
  }
2372
2399
  }
2373
2400
  async participantListIndo(participants) {
2401
+ console.log("participantListIndo");
2374
2402
  if (!participants?.length) {
2375
2403
  if (this.allParticipentList?.length) {
2376
2404
  this.allParticipentList = [];
@@ -2395,12 +2423,23 @@ class CallProgressComponent {
2395
2423
  anyChange = true;
2396
2424
  return newP;
2397
2425
  }
2426
+ const isMutePending = this.pendingMuteParticipants.has(newP.id);
2427
+ const intendedMute = this.intendedMuteStates.get(newP.id);
2428
+ if (isMutePending && intendedMute !== undefined) {
2429
+ if (newP.isMute === intendedMute) {
2430
+ this.pendingMuteParticipants.delete(newP.id);
2431
+ this.intendedMuteStates.delete(newP.id);
2432
+ }
2433
+ else {
2434
+ newP = { ...newP, isMute: existing.isMute };
2435
+ }
2436
+ }
2398
2437
  const changed = Object.keys(newP).some(k => existing[k] !== newP[k]);
2399
2438
  if (changed) {
2400
2439
  anyChange = true;
2401
2440
  return { ...existing, ...newP };
2402
2441
  }
2403
- return existing; // unchanged — same object reference, *ngFor skips this row
2442
+ return existing;
2404
2443
  });
2405
2444
  if (anyChange) {
2406
2445
  this.selectedConfName = this.conferenceCallList.find((res) => res?.conferenceId == this.conferenceCallIDForParticipantList)?.conferenceName || '';
@@ -2558,14 +2597,26 @@ class CallProgressComponent {
2558
2597
  }
2559
2598
  }
2560
2599
  async onMuteUser(c) {
2600
+ const participantId = c.id;
2601
+ const newMuteState = !c.isMute;
2602
+ this.pendingMuteParticipants.add(participantId);
2603
+ this.intendedMuteStates.set(participantId, newMuteState);
2604
+ c.isMute = newMuteState;
2605
+ this.cdr.detectChanges();
2606
+ console.log(c.isMute);
2561
2607
  this.onMuteParticipant({
2562
- participantId: [c.id],
2608
+ participantId: [participantId],
2563
2609
  conferenceId: c?.conferenceId,
2564
2610
  hold: c.isHold,
2565
- mute: !c?.isMute
2611
+ mute: newMuteState
2566
2612
  });
2567
- c.isMute = !c.isMute;
2568
- this.cdr.detectChanges();
2613
+ //remove pending guard after 5 seconds if no confirmation
2614
+ setTimeout(() => {
2615
+ if (this.pendingMuteParticipants.has(participantId)) {
2616
+ this.pendingMuteParticipants.delete(participantId);
2617
+ this.intendedMuteStates.delete(participantId);
2618
+ }
2619
+ }, 5000);
2569
2620
  }
2570
2621
  async onHoldCall(c) {
2571
2622
  this.isHoldBtnDisable = true;