@vgroup/dialbox 0.2.3 → 0.2.5

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.
@@ -1774,27 +1774,33 @@ class IncomingCallComponent {
1774
1774
  return false;
1775
1775
  }
1776
1776
  onClickExpand(data) {
1777
- if (this.selectedIncomingCall === data && this.isClickExpand) {
1778
- this.isClickExpand = false;
1777
+ if (this.selectedIncomingCall === data && this.selectedIncomingCall?.isClickExpand) {
1778
+ // Collapse if clicking the same expanded item
1779
+ const updatedCall = {
1780
+ ...this.selectedIncomingCall,
1781
+ isClickExpand: false
1782
+ };
1779
1783
  this.selectedIncomingCall = null;
1780
- this.selectedIncomingCallInfo.emit({});
1784
+ this.selectedIncomingCallInfo.emit(updatedCall);
1781
1785
  return;
1782
1786
  }
1783
- this.isClickExpand = true;
1784
- this.selectedIncomingCall = data;
1785
- if (this.selectedIncomingCall) {
1786
- this.selectedIncomingCall['isClickExpand'] = true;
1787
- if (this.newIncomingCallsList && this.newIncomingCallsList.length > 0) {
1788
- this.newIncomingCallsList.forEach((call) => {
1789
- if (call !== this.selectedIncomingCall) {
1790
- call['isClickExpand'] = false;
1791
- }
1792
- });
1793
- }
1794
- this.selectedIncomingCallInfo.emit(this.selectedIncomingCall);
1795
- if (!this.selectedIncomingCall.userInfo || this.selectedIncomingCall.userInfo.status == 201) {
1796
- this.getUserInformation(this.selectedIncomingCall);
1797
- }
1787
+ // Expand the clicked item
1788
+ const updatedCall = {
1789
+ ...data,
1790
+ isClickExpand: true
1791
+ };
1792
+ this.selectedIncomingCall = updatedCall;
1793
+ // Update the newIncomingCallsList with the updated call
1794
+ if (this.newIncomingCallsList?.length) {
1795
+ this.newIncomingCallsList = this.newIncomingCallsList.map((call) => call.parameters?.CallSid === updatedCall.parameters?.CallSid
1796
+ ? updatedCall
1797
+ : { ...call, isClickExpand: false });
1798
+ }
1799
+ // Emit the updated call to parent
1800
+ this.selectedIncomingCallInfo.emit(updatedCall);
1801
+ // Fetch user info if needed
1802
+ if (!updatedCall.userInfo || updatedCall.userInfo?.status === 201) {
1803
+ this.getUserInformation(updatedCall);
1798
1804
  }
1799
1805
  }
1800
1806
  getUserInformation(incomingCallData) {
@@ -2663,8 +2669,21 @@ class CallProgressComponent {
2663
2669
  this.newIncomingCallsList = data;
2664
2670
  this.incomingCallsNewInfo.emit(this.newIncomingCallsList);
2665
2671
  }
2666
- selectedIncomingCallInfo(data) {
2667
- this.selectedIncomingCall = data;
2672
+ selectedIncomingCallInfo(updatedCall) {
2673
+ if (!updatedCall || Object.keys(updatedCall).length === 0) {
2674
+ this.selectedIncomingCall = null;
2675
+ this.cdr.detectChanges();
2676
+ return;
2677
+ }
2678
+ // Update the call in the array if it exists
2679
+ if (this.newIncomingCallsList) {
2680
+ this.newIncomingCallsList = this.newIncomingCallsList.map((call) => call.parameters?.CallSid === updatedCall.parameters?.CallSid
2681
+ ? { ...call, ...updatedCall }
2682
+ : { ...call, isClickExpand: false });
2683
+ }
2684
+ // Update the selected call reference
2685
+ this.selectedIncomingCall = updatedCall;
2686
+ this.cdr.detectChanges();
2668
2687
  }
2669
2688
  ngOnDestroy() {
2670
2689
  this.callData.dial = false;