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