@vgroup/dialbox 0.6.4 → 0.6.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.
@@ -3650,7 +3650,7 @@ class DialboxComponent {
3650
3650
  this.registerDragElement();
3651
3651
  }
3652
3652
  ngOnChanges(changes) {
3653
- var _a, _b, _c, _d, _e, _f, _g;
3653
+ var _a, _b, _c, _d, _e, _f, _g, _h;
3654
3654
  if (((_a = changes['incomingCallnotification']) === null || _a === void 0 ? void 0 : _a.currentValue) && this.incomingCallnotification) {
3655
3655
  this.isIncomingCallnotification = true;
3656
3656
  if (this.incomingCallnotification.data.content == "IncomingCall") {
@@ -3688,6 +3688,27 @@ class DialboxComponent {
3688
3688
  }
3689
3689
  }
3690
3690
  console.log('notificationCallList', this.notificationCallList);
3691
+ let parentCall = [];
3692
+ if ((_f = this.notificationCallList) === null || _f === void 0 ? void 0 : _f.length) {
3693
+ this.notificationCallList = this.notificationCallList.filter((res) => res.endTime >= (new Date().getTime()));
3694
+ this.notificationCallList.forEach((call) => {
3695
+ this.incomingCallsList.forEach((item) => {
3696
+ let info = item.participants.find((resInfo) => (resInfo === null || resInfo === void 0 ? void 0 : resInfo.id) === (call === null || call === void 0 ? void 0 : call.participantId));
3697
+ // return info?.id
3698
+ if (info) {
3699
+ parentCall.push(info.id);
3700
+ }
3701
+ });
3702
+ });
3703
+ }
3704
+ if ((parentCall === null || parentCall === void 0 ? void 0 : parentCall.length) > 0) {
3705
+ this.notificationCallList = this.notificationCallList.filter((item) => !parentCall.includes(item === null || item === void 0 ? void 0 : item.participantId));
3706
+ this.incomingCallsList = [...this.incomingCallsList, ...this.notificationCallList];
3707
+ console.log('.....', this.notificationCallList);
3708
+ }
3709
+ else {
3710
+ this.incomingCallsList = [...this.incomingCallsList, ...this.notificationCallList];
3711
+ }
3691
3712
  this.cdk.detectChanges();
3692
3713
  }
3693
3714
  if (changes['deviceId']) {
@@ -3695,10 +3716,10 @@ class DialboxComponent {
3695
3716
  this.twilioService.deviceId = changes['deviceId'].currentValue;
3696
3717
  console.log('Set deviceId in localStorage:', changes['deviceId'].currentValue);
3697
3718
  }
3698
- if (((_f = changes['userId']) === null || _f === void 0 ? void 0 : _f.currentValue) && this.userId) {
3719
+ if (((_g = changes['userId']) === null || _g === void 0 ? void 0 : _g.currentValue) && this.userId) {
3699
3720
  this.extensionService.userId = this.userId;
3700
3721
  }
3701
- if (((_g = changes['contactInfo']) === null || _g === void 0 ? void 0 : _g.currentValue) && this.contactInfo) {
3722
+ if (((_h = changes['contactInfo']) === null || _h === void 0 ? void 0 : _h.currentValue) && this.contactInfo) {
3702
3723
  let contact = this.contactInfo;
3703
3724
  console.log('contactInfo', contact);
3704
3725
  if (contact.number) {
@@ -3906,7 +3927,7 @@ class DialboxComponent {
3906
3927
  // this.dialInputRef.nativeElement.focus();
3907
3928
  }
3908
3929
  else if (num === 'voicemail') {
3909
- // this.showDedicatedPopup = true;
3930
+ this.showDedicatedPopup = true;
3910
3931
  this.router.navigate(['extension/voicemail/' + this.token]);
3911
3932
  }
3912
3933
  }
@@ -4056,232 +4077,6 @@ class DialboxComponent {
4056
4077
  this.endCallEvent.emit();
4057
4078
  }
4058
4079
  }
4059
- // async initiateCall() {
4060
- // try {
4061
- // console.log('Initiating call with number:', this.dialedNumber);
4062
- // if (!this.dialedNumber && this.lastDialed) {
4063
- // console.log('Using last dialed number:', this.lastDialed.number);
4064
- // this.sanitizedNum = this.lastDialed.number;
4065
- // }
4066
- // const isInvalid = await this.isInvalidNumber();
4067
- // if (isInvalid) {
4068
- // console.error('Invalid number format');
4069
- // return false;
4070
- // }
4071
- // this.saveLastDialed();
4072
- // this.isSavedContactDialled();
4073
- // // Check payment status
4074
- // this.isPaymentDue = localStorage.getItem('paymentDue') === 'true';
4075
- // if (this.isPaymentDue) {
4076
- // console.warn('Payment is due');
4077
- // swal('Warning', 'Please note that your payment is due. To continue using our services, kindly subscribe to avoid interruptions.');
4078
- // return false;
4079
- // }
4080
- // // Check if dialing own number
4081
- // if (this.sanitizedNum === localStorage.getItem('twilioNumber')) {
4082
- // console.error('Attempted to dial own number');
4083
- // swal('Error', 'You cannot dial your own number');
4084
- // return false;
4085
- // }
4086
- // // Check microphone permissions
4087
- // const hasPermission = await this.checkMicrophonePermission();
4088
- // if (!hasPermission) {
4089
- // console.warn('Microphone permission not granted');
4090
- // await this.askForMicrophonePermission();
4091
- // return false;
4092
- // }
4093
- // if (!this.selectedCallerId) {
4094
- // console.error('No caller ID selected');
4095
- // this.shakeDedicatedBtn = true;
4096
- // this.showDialAlert('Please select a C2C number to call from');
4097
- // setTimeout(() => {
4098
- // this.shakeDedicatedBtn = false;
4099
- // }, 3000);
4100
- // return false;
4101
- // }
4102
- // console.log('Getting number with country code...');
4103
- // this.callData.displayNum = '';
4104
- // try {
4105
- // await this.getToNumber(this.sanitizedNum);
4106
- // } catch (error) {
4107
- // console.error('Error getting number with country code:', error);
4108
- // this.showDialAlert('Error processing number. Please try again.');
4109
- // return false;
4110
- // }
4111
- // if (this.terminateCall) {
4112
- // console.log('Call terminated by user');
4113
- // this.terminateCall = false;
4114
- // return false;
4115
- // }
4116
- // // Prepare call data
4117
- // this.callData = {
4118
- // ...this.callData,
4119
- // phone: this.sanitizedNum,
4120
- // isIncomingCall: false,
4121
- // dial: true,
4122
- // from: this.isSmartDialCall ? this.callData.from : this.selectedCallerId.number,
4123
- // timestamp: new Date().toISOString()
4124
- // };
4125
- // console.log('Initiating call with data:', this.callData);
4126
- // this.isCallInProgress = true;
4127
- // this.callInitiated.emit({ ...this.callData });
4128
- // return true;
4129
- // } catch (error) {
4130
- // console.error('Error in initiateCall:', error);
4131
- // this.showDialAlert('Failed to initiate call. Please try again.');
4132
- // this.isCallInProgress = false;
4133
- // return false;
4134
- // }
4135
- // //this.clearAllDialed();
4136
- // // } else {
4137
- // // swal('Error', 'Trial period is over. Please setup payment method to continue services')
4138
- // // }
4139
- // }
4140
- // async initiateCall() {
4141
- // if (!this.dialedNumber && this.lastDialed) {
4142
- // this.sanitizedNum = this.lastDialed.number;
4143
- // }
4144
- // const isInvalid = await this.isInvalidNumber();
4145
- // if (isInvalid) {
4146
- // return false;
4147
- // }
4148
- // this.saveLastDialed();
4149
- // this.isSavedContactDialled();
4150
- // //let isCallerIdSet = await this.isCallerIdSet();
4151
- // this.isPaymentDue = localStorage.getItem('paymentDue') == 'false' ? false : true;
4152
- // if (this.isPaymentDue) {
4153
- // swal('Warning', 'Please note that your payment is due, To continue on your services kindly subscribe to use uninterrupted services.');
4154
- // return;
4155
- // }
4156
- // this.isTrialPeriodOver = localStorage.getItem('trialOver') == 'false' ? false : true;
4157
- // // if (!this.isTrialPeriodOver) {
4158
- // if (this.sanitizedNum == localStorage.getItem('twilioNumber')) {
4159
- // swal('Error', 'You can not dial this number');
4160
- // return;
4161
- // }
4162
- // const hasPermission = await this.checkMicrophonePermission();
4163
- // if (hasPermission) {
4164
- // if (this.selectedCallerId) {
4165
- // //clear displayNum if value is binded from previous call
4166
- // this.callData.displayNum = '';
4167
- // // get number to be dialled from backend
4168
- // await this.getToNumber(this.sanitizedNum);
4169
- // if (this.terminateCall) {
4170
- // this.terminateCall = false;
4171
- // return;
4172
- // }
4173
- // this.callData.phone = this.sanitizedNum;
4174
- // this.callData.isIncomingCall = false;
4175
- // this.callData.dial = true;
4176
- // if (!this.isSmartDialCall) {
4177
- // this.callData.from = this.selectedCallerId.number;
4178
- // }
4179
- // this.isCallInProgress = true;
4180
- // this.callData = {
4181
- // ...this.callData,
4182
- // phone: this.sanitizedNum,
4183
- // isIncomingCall: false,
4184
- // dial: true,
4185
- // from: this.isSmartDialCall ? this.callData.from : this.selectedCallerId.number,
4186
- // timestamp: new Date().toISOString()
4187
- // };
4188
- // console.log('Initiating call with data:', this.callData);
4189
- // this.isCallInProgress = true;
4190
- // this.callInitiated.emit({ ...this.callData });
4191
- // return true;
4192
- // } else {
4193
- // this.shakeDedicatedBtn = true;
4194
- // this.showDialAlert('Select a C2C number to call');
4195
- // setTimeout(() => {
4196
- // this.shakeDedicatedBtn = false;
4197
- // }, 3000);
4198
- // return false;
4199
- // }
4200
- // //this.callingOpenEvent.emit({ phone: this.dialedNumber });
4201
- // } else {
4202
- // await this.askForMicrophonePermission();
4203
- // }
4204
- // //this.clearAllDialed();
4205
- // // } else {
4206
- // // swal('Error', 'Trial period is over. Please setup payment method to continue services')
4207
- // // }
4208
- // }
4209
- // async initiateCall() {
4210
- // try{
4211
- // if (!this.dialedNumber && this.lastDialed) {
4212
- // this.sanitizedNum = this.lastDialed.number;
4213
- // }
4214
- // const isInvalid = await this.isInvalidNumber();
4215
- // if (isInvalid) {
4216
- // return false;
4217
- // }
4218
- // this.saveLastDialed();
4219
- // this.isSavedContactDialled();
4220
- // //let isCallerIdSet = await this.isCallerIdSet();
4221
- // this.isPaymentDue = localStorage.getItem('paymentDue') == 'false' ? false : true;
4222
- // if (this.isPaymentDue) {
4223
- // swal('Warning', 'Please note that your payment is due, To continue on your services kindly subscribe to use uninterrupted services.');
4224
- // return false;
4225
- // }
4226
- // this.isTrialPeriodOver = localStorage.getItem('trialOver') == 'false' ? false : true;
4227
- // // if (!this.isTrialPeriodOver) {
4228
- // if (this.sanitizedNum == localStorage.getItem('twilioNumber')) {
4229
- // swal('Error', 'You can not dial this number');
4230
- // return false;
4231
- // }
4232
- // const hasPermission = await this.checkMicrophonePermission();
4233
- // if (hasPermission) {
4234
- // if (this.selectedCallerId) {
4235
- // //clear displayNum if value is binded from previous call
4236
- // this.callData.displayNum = '';
4237
- // // get number to be dialled from backend
4238
- // await this.getToNumber(this.sanitizedNum);
4239
- // if (this.terminateCall) {
4240
- // this.terminateCall = false;
4241
- // return;
4242
- // }
4243
- // this.callData.phone = this.sanitizedNum;
4244
- // this.callData.isIncomingCall = false;
4245
- // this.callData.dial = true;
4246
- // if (!this.isSmartDialCall) {
4247
- // this.callData.from = this.selectedCallerId.number;
4248
- // }
4249
- // this.isCallInProgress = true;
4250
- // this.callData = {
4251
- // ...this.callData,
4252
- // phone: this.sanitizedNum,
4253
- // isIncomingCall: false,
4254
- // dial: true,
4255
- // from: this.isSmartDialCall ? this.callData.from : this.selectedCallerId.number,
4256
- // timestamp: new Date().toISOString()
4257
- // };
4258
- // console.log('Initiating call with data:', this.callData);
4259
- // this.isCallInProgress = true;
4260
- // this.callInitiated.emit({ ...this.callData });
4261
- // return true;
4262
- // } else {
4263
- // this.shakeDedicatedBtn = true;
4264
- // this.showDialAlert('Select a C2C number to call');
4265
- // setTimeout(() => {
4266
- // this.shakeDedicatedBtn = false;
4267
- // }, 3000);
4268
- // return false;
4269
- // }
4270
- // //this.callingOpenEvent.emit({ phone: this.dialedNumber });
4271
- // } else {
4272
- // await this.askForMicrophonePermission();
4273
- // }
4274
- // //this.clearAllDialed();
4275
- // // } else {
4276
- // // swal('Error', 'Trial period is over. Please setup payment method to continue services')
4277
- // // }
4278
- // }catch(e){
4279
- // console.error('Error in initiateCall:', e);
4280
- // this.showDialAlert('Failed to initiate call. Please try again.');
4281
- // this.isCallInProgress = false;
4282
- // return false;
4283
- // }
4284
- // }
4285
4080
  initiateCall() {
4286
4081
  return __awaiter(this, void 0, void 0, function* () {
4287
4082
  try {