@vgroup/dialbox 0.0.13 → 0.0.15

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.
@@ -9,7 +9,7 @@ import { catchError, switchMap, map } from 'rxjs/operators';
9
9
  import * as i3$2 from '@angular/material/dialog';
10
10
  import { MAT_DIALOG_DATA } from '@angular/material/dialog';
11
11
  import * as i5 from '@angular/router';
12
- import { RouterLink } from '@angular/router';
12
+ import { RouterLink, RouterModule } from '@angular/router';
13
13
  import * as i3 from '@angular/common';
14
14
  import { CommonModule } from '@angular/common';
15
15
  import * as i3$1 from '@angular/forms';
@@ -1634,36 +1634,52 @@ class CallProgressComponent {
1634
1634
  console.log('Call Progress Component');
1635
1635
  }
1636
1636
  ngOnChanges(changes) {
1637
- console.log('Call Progress Component ngOnChanges');
1638
- if (changes.callData) {
1639
- console.log('Call Progress Component ngOnChanges callData', changes.callData);
1640
- if (changes.callData.currentValue.isIncomingCall) {
1641
- changes.incomingCallDiv = true;
1637
+ console.log('Call Progress Component ngOnChanges', changes);
1638
+ // Handle callData changes (outgoing calls)
1639
+ if (changes['callData'] && changes['callData'].currentValue) {
1640
+ console.log('Call Progress Component ngOnChanges callData', changes['callData'].currentValue);
1641
+ const callData = changes['callData'].currentValue;
1642
+ if (callData.isIncomingCall) {
1643
+ this.incomingCallDiv = true;
1644
+ this.callData = { ...callData };
1645
+ this.showRingAnimation = true;
1646
+ this.startTimer();
1642
1647
  }
1643
1648
  else {
1644
- //for outgoing call
1645
- this.startCall(changes.callData.currentValue);
1649
+ // For outgoing call
1650
+ this.callData = { ...callData };
1651
+ this.startCall(callData);
1646
1652
  }
1647
1653
  }
1648
- if (changes.newIncomingCallData) {
1654
+ // Handle new incoming call data from Twilio
1655
+ if (changes['newIncomingCallData'] && changes['newIncomingCallData'].currentValue) {
1649
1656
  try {
1650
- if (changes.newIncomingCallData.currentValue) {
1651
- if (this.call && (this.call.status() == 'open')) {
1652
- this.call.disconnect();
1653
- this.call = changes.newIncomingCallData.currentValue;
1654
- this.call?.accept();
1655
- this.callData.phone = (this.call?.parameters).From;
1656
- this.callData.name = (this.call?.customParameters).get('name');
1657
- this.callData.img = (this.call?.customParameters).get('image') || 'assets/images/user.jpg';
1658
- this.incomingCallInitiated.emit();
1659
- this.startTimer();
1660
- }
1657
+ const incomingCall = changes['newIncomingCallData'].currentValue;
1658
+ // If there's an active call, handle it appropriately
1659
+ if (this.call && this.call.status() === 'open') {
1660
+ // You might want to handle multiple calls here
1661
+ // For now, we'll just update the current call
1662
+ this.call.disconnect();
1661
1663
  }
1664
+ this.call = incomingCall;
1665
+ this.callData = {
1666
+ ...this.callData,
1667
+ phone: incomingCall.parameters.From,
1668
+ name: incomingCall.customParameters?.get('name') || 'Unknown Caller',
1669
+ img: incomingCall.customParameters?.get('image') || 'assets/images/user.jpg',
1670
+ isIncomingCall: true
1671
+ };
1672
+ this.incomingCallDiv = true;
1673
+ this.showRingAnimation = true;
1674
+ this.incomingCallInitiated.emit();
1675
+ this.startTimer();
1662
1676
  }
1663
1677
  catch (e) {
1664
- console.log(e);
1678
+ console.error('Error handling incoming call:', e);
1665
1679
  }
1666
1680
  }
1681
+ // Update the view
1682
+ this.cdr.detectChanges();
1667
1683
  }
1668
1684
  ngAfterViewInit() { }
1669
1685
  async startCall(callData) {
@@ -2143,31 +2159,16 @@ class DialboxComponent {
2143
2159
  }
2144
2160
  }
2145
2161
  });
2146
- // Handle incoming call
2147
- const sub2 = this.twilioService.currentCall.subscribe((incomingCallData) => {
2148
- if (incomingCallData) {
2149
- console.log('Incoming call received:', incomingCallData);
2150
- this.isCallInProgress = true;
2151
- this.isDialpadHidden = false;
2152
- // Update call data for the UI
2153
- this.callData = {
2154
- ...this.callData,
2155
- phone: incomingCallData.parameters.From,
2156
- name: incomingCallData.customParameters?.get('name') || 'Unknown Caller',
2157
- img: incomingCallData.customParameters?.get('image') || 'assets/images/user.jpg',
2158
- isIncomingCall: true,
2159
- extNum: incomingCallData.parameters.To || ''
2160
- };
2161
- // Add to incoming calls list if not already present
2162
- const callSid = incomingCallData.parameters.CallSid;
2163
- const existingCall = this.incomingCallsList.find((call) => call.parameters.CallSid === callSid);
2164
- if (!existingCall) {
2165
- this.incomingCallsList.push(incomingCallData);
2166
- this.incomingCallsNewInfoEvent.emit(this.incomingCallsList);
2167
- }
2168
- // Notify parent component about the incoming call
2169
- this.incomingCallInitiated.emit();
2170
- }
2162
+ // handle incoming call
2163
+ const sub2 = this.twilioService.currentCall.subscribe(incomingCallData => {
2164
+ // if (incomingCallData) {
2165
+ // this.isCallInProgress = true;
2166
+ // this.isDialpadHidden = false;
2167
+ // this.callData.phone = incomingCallData.parameters.From;
2168
+ // this.callData.name = incomingCallData.customParameters.get('name');
2169
+ // this.callData.img = incomingCallData.customParameters.get('image');
2170
+ // this.callData.isIncomingCall = true;
2171
+ // }
2171
2172
  if (incomingCallData) {
2172
2173
  if (this.isCallInProgress) {
2173
2174
  this.newIncomingCalls.push(incomingCallData);
@@ -3060,14 +3061,16 @@ DialboxModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version:
3060
3061
  FormsModule,
3061
3062
  ReactiveFormsModule,
3062
3063
  HttpClientModule,
3063
- RouterLink], exports: [DialboxComponent,
3064
+ RouterLink,
3065
+ RouterModule], exports: [DialboxComponent,
3064
3066
  CallProgressComponent,
3065
3067
  CallerIdDialogComponent,
3066
3068
  IncomingCallComponent] });
3067
3069
  DialboxModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: DialboxModule, imports: [CommonModule,
3068
3070
  FormsModule,
3069
3071
  ReactiveFormsModule,
3070
- HttpClientModule] });
3072
+ HttpClientModule,
3073
+ RouterModule] });
3071
3074
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: DialboxModule, decorators: [{
3072
3075
  type: NgModule,
3073
3076
  args: [{
@@ -3082,7 +3085,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImpo
3082
3085
  FormsModule,
3083
3086
  ReactiveFormsModule,
3084
3087
  HttpClientModule,
3085
- RouterLink
3088
+ RouterLink,
3089
+ RouterModule
3086
3090
  ],
3087
3091
  exports: [
3088
3092
  DialboxComponent,