@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.
@@ -10,7 +10,7 @@ import { catchError, switchMap, map } from 'rxjs/operators';
10
10
  import * as i3$2 from '@angular/material/dialog';
11
11
  import { MAT_DIALOG_DATA } from '@angular/material/dialog';
12
12
  import * as i5 from '@angular/router';
13
- import { RouterLink } from '@angular/router';
13
+ import { RouterLink, RouterModule } from '@angular/router';
14
14
  import * as i3 from '@angular/common';
15
15
  import { CommonModule } from '@angular/common';
16
16
  import * as i3$1 from '@angular/forms';
@@ -1635,37 +1635,47 @@ class CallProgressComponent {
1635
1635
  console.log('Call Progress Component');
1636
1636
  }
1637
1637
  ngOnChanges(changes) {
1638
- var _a, _b, _c, _d;
1639
- console.log('Call Progress Component ngOnChanges');
1640
- if (changes.callData) {
1641
- console.log('Call Progress Component ngOnChanges callData', changes.callData);
1642
- if (changes.callData.currentValue.isIncomingCall) {
1643
- changes.incomingCallDiv = true;
1638
+ var _a, _b;
1639
+ console.log('Call Progress Component ngOnChanges', changes);
1640
+ // Handle callData changes (outgoing calls)
1641
+ if (changes['callData'] && changes['callData'].currentValue) {
1642
+ console.log('Call Progress Component ngOnChanges callData', changes['callData'].currentValue);
1643
+ const callData = changes['callData'].currentValue;
1644
+ if (callData.isIncomingCall) {
1645
+ this.incomingCallDiv = true;
1646
+ this.callData = Object.assign({}, callData);
1647
+ this.showRingAnimation = true;
1648
+ this.startTimer();
1644
1649
  }
1645
1650
  else {
1646
- //for outgoing call
1647
- this.startCall(changes.callData.currentValue);
1651
+ // For outgoing call
1652
+ this.callData = Object.assign({}, callData);
1653
+ this.startCall(callData);
1648
1654
  }
1649
1655
  }
1650
- if (changes.newIncomingCallData) {
1656
+ // Handle new incoming call data from Twilio
1657
+ if (changes['newIncomingCallData'] && changes['newIncomingCallData'].currentValue) {
1651
1658
  try {
1652
- if (changes.newIncomingCallData.currentValue) {
1653
- if (this.call && (this.call.status() == 'open')) {
1654
- this.call.disconnect();
1655
- this.call = changes.newIncomingCallData.currentValue;
1656
- (_a = this.call) === null || _a === void 0 ? void 0 : _a.accept();
1657
- this.callData.phone = ((_b = this.call) === null || _b === void 0 ? void 0 : _b.parameters).From;
1658
- this.callData.name = ((_c = this.call) === null || _c === void 0 ? void 0 : _c.customParameters).get('name');
1659
- this.callData.img = ((_d = this.call) === null || _d === void 0 ? void 0 : _d.customParameters).get('image') || 'assets/images/user.jpg';
1660
- this.incomingCallInitiated.emit();
1661
- this.startTimer();
1662
- }
1659
+ const incomingCall = changes['newIncomingCallData'].currentValue;
1660
+ // If there's an active call, handle it appropriately
1661
+ if (this.call && this.call.status() === 'open') {
1662
+ // You might want to handle multiple calls here
1663
+ // For now, we'll just update the current call
1664
+ this.call.disconnect();
1663
1665
  }
1666
+ this.call = incomingCall;
1667
+ this.callData = Object.assign(Object.assign({}, this.callData), { phone: incomingCall.parameters.From, name: ((_a = incomingCall.customParameters) === null || _a === void 0 ? void 0 : _a.get('name')) || 'Unknown Caller', img: ((_b = incomingCall.customParameters) === null || _b === void 0 ? void 0 : _b.get('image')) || 'assets/images/user.jpg', isIncomingCall: true });
1668
+ this.incomingCallDiv = true;
1669
+ this.showRingAnimation = true;
1670
+ this.incomingCallInitiated.emit();
1671
+ this.startTimer();
1664
1672
  }
1665
1673
  catch (e) {
1666
- console.log(e);
1674
+ console.error('Error handling incoming call:', e);
1667
1675
  }
1668
1676
  }
1677
+ // Update the view
1678
+ this.cdr.detectChanges();
1669
1679
  }
1670
1680
  ngAfterViewInit() { }
1671
1681
  startCall(callData) {
@@ -2159,25 +2169,16 @@ class DialboxComponent {
2159
2169
  }
2160
2170
  }
2161
2171
  });
2162
- // Handle incoming call
2163
- const sub2 = this.twilioService.currentCall.subscribe((incomingCallData) => {
2164
- var _a, _b;
2165
- if (incomingCallData) {
2166
- console.log('Incoming call received:', incomingCallData);
2167
- this.isCallInProgress = true;
2168
- this.isDialpadHidden = false;
2169
- // Update call data for the UI
2170
- this.callData = Object.assign(Object.assign({}, this.callData), { phone: incomingCallData.parameters.From, name: ((_a = incomingCallData.customParameters) === null || _a === void 0 ? void 0 : _a.get('name')) || 'Unknown Caller', img: ((_b = incomingCallData.customParameters) === null || _b === void 0 ? void 0 : _b.get('image')) || 'assets/images/user.jpg', isIncomingCall: true, extNum: incomingCallData.parameters.To || '' });
2171
- // Add to incoming calls list if not already present
2172
- const callSid = incomingCallData.parameters.CallSid;
2173
- const existingCall = this.incomingCallsList.find((call) => call.parameters.CallSid === callSid);
2174
- if (!existingCall) {
2175
- this.incomingCallsList.push(incomingCallData);
2176
- this.incomingCallsNewInfoEvent.emit(this.incomingCallsList);
2177
- }
2178
- // Notify parent component about the incoming call
2179
- this.incomingCallInitiated.emit();
2180
- }
2172
+ // handle incoming call
2173
+ const sub2 = this.twilioService.currentCall.subscribe(incomingCallData => {
2174
+ // if (incomingCallData) {
2175
+ // this.isCallInProgress = true;
2176
+ // this.isDialpadHidden = false;
2177
+ // this.callData.phone = incomingCallData.parameters.From;
2178
+ // this.callData.name = incomingCallData.customParameters.get('name');
2179
+ // this.callData.img = incomingCallData.customParameters.get('image');
2180
+ // this.callData.isIncomingCall = true;
2181
+ // }
2181
2182
  if (incomingCallData) {
2182
2183
  if (this.isCallInProgress) {
2183
2184
  this.newIncomingCalls.push(incomingCallData);
@@ -3079,14 +3080,16 @@ DialboxModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version:
3079
3080
  FormsModule,
3080
3081
  ReactiveFormsModule,
3081
3082
  HttpClientModule,
3082
- RouterLink], exports: [DialboxComponent,
3083
+ RouterLink,
3084
+ RouterModule], exports: [DialboxComponent,
3083
3085
  CallProgressComponent,
3084
3086
  CallerIdDialogComponent,
3085
3087
  IncomingCallComponent] });
3086
3088
  DialboxModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: DialboxModule, imports: [CommonModule,
3087
3089
  FormsModule,
3088
3090
  ReactiveFormsModule,
3089
- HttpClientModule] });
3091
+ HttpClientModule,
3092
+ RouterModule] });
3090
3093
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: DialboxModule, decorators: [{
3091
3094
  type: NgModule,
3092
3095
  args: [{
@@ -3101,7 +3104,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImpo
3101
3104
  FormsModule,
3102
3105
  ReactiveFormsModule,
3103
3106
  HttpClientModule,
3104
- RouterLink
3107
+ RouterLink,
3108
+ RouterModule
3105
3109
  ],
3106
3110
  exports: [
3107
3111
  DialboxComponent,