@vgroup/dialbox 0.4.196 → 0.4.198

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.
@@ -3790,160 +3790,162 @@ class DialboxComponent {
3790
3790
  }
3791
3791
  ngOnChanges(changes) {
3792
3792
  var _a, _b, _c, _d, _e, _f, _g, _h;
3793
- if (changes['incomingCallnotification'].currentValue && this.incomingCallnotification) {
3794
- this.isIncomingCallnotification = true;
3795
- // let payload = {
3796
- // recordId: this.incomingCallnotification.data.data.participantId,
3797
- // ipAddress: '',
3798
- // ipCountry: '',
3799
- // callStatus: 'answered',
3800
- // deviceId: this.deviceId,
3801
- // conferenceId: this.incomingCallnotification.data.data.conferenceId || 'no'
3802
- // }
3803
- console.log(',,,,,', this.incomingCallnotification);
3804
- if (this.incomingCallnotification.data.content == "IncomingCall") {
3805
- let callerInfo;
3806
- if (((_a = this.incomingCallnotification.data.data) === null || _a === void 0 ? void 0 : _a.c2cBusiness) == 'false') {
3807
- this.extensionService.getUserInformation((_b = this.incomingCallnotification.data.data) === null || _b === void 0 ? void 0 : _b.participantId).subscribe((resInfo) => {
3808
- console.log('uesrInfo', resInfo);
3809
- callerInfo = resInfo;
3810
- });
3811
- }
3812
- let incomingCall = Object.assign({ conferenceId: 'no', isActive: true, isIncomingCall: true, participantId: (_c = this.incomingCallnotification.data.data) === null || _c === void 0 ? void 0 : _c.participantId, participants: [
3813
- { direction: "incoming-call", img: 'assets/images/user.jpg', isIncomingCall: true, isHold: false, isConference: false, isAcceptCall: false, dial: true, phone: (_d = this.incomingCallnotification.data.data) === null || _d === void 0 ? void 0 : _d.fromNumber, participantId: (_e = this.incomingCallnotification.data.data) === null || _e === void 0 ? void 0 : _e.participantId, name: (_f = this.incomingCallnotification.data.data) === null || _f === void 0 ? void 0 : _f.fromName, time: '', id: (_g = this.incomingCallnotification.data.data) === null || _g === void 0 ? void 0 : _g.participantId }
3814
- ] }, callerInfo);
3815
- this.incomingCallsList.push(incomingCall);
3816
- this.notificationCallList.push(incomingCall);
3817
- if ((_h = this.incomingCallnotification.data.data) === null || _h === void 0 ? void 0 : _h.participantId) {
3818
- this.isCallInProgress = true;
3793
+ return __awaiter(this, void 0, void 0, function* () {
3794
+ if (changes['incomingCallnotification'].currentValue && this.incomingCallnotification) {
3795
+ this.isIncomingCallnotification = true;
3796
+ // let payload = {
3797
+ // recordId: this.incomingCallnotification.data.data.participantId,
3798
+ // ipAddress: '',
3799
+ // ipCountry: '',
3800
+ // callStatus: 'answered',
3801
+ // deviceId: this.deviceId,
3802
+ // conferenceId: this.incomingCallnotification.data.data.conferenceId || 'no'
3803
+ // }
3804
+ console.log(',,,,,', this.incomingCallnotification);
3805
+ if (this.incomingCallnotification.data.content == "IncomingCall") {
3806
+ let callerInfo;
3807
+ if (((_a = this.incomingCallnotification.data.data) === null || _a === void 0 ? void 0 : _a.c2cBusiness) == 'false') {
3808
+ yield this.extensionService.getUserInformation((_b = this.incomingCallnotification.data.data) === null || _b === void 0 ? void 0 : _b.participantId).subscribe((resInfo) => {
3809
+ console.log('uesrInfo', resInfo);
3810
+ callerInfo = resInfo.c2cInformation;
3811
+ });
3812
+ }
3813
+ let incomingCall = Object.assign({ conferenceId: 'no', isActive: true, isIncomingCall: true, participantId: (_c = this.incomingCallnotification.data.data) === null || _c === void 0 ? void 0 : _c.participantId, participants: [
3814
+ { direction: "incoming-call", img: 'assets/images/user.jpg', isIncomingCall: true, isHold: false, isConference: false, isAcceptCall: false, dial: true, phone: (_d = this.incomingCallnotification.data.data) === null || _d === void 0 ? void 0 : _d.fromNumber, participantId: (_e = this.incomingCallnotification.data.data) === null || _e === void 0 ? void 0 : _e.participantId, name: (_f = this.incomingCallnotification.data.data) === null || _f === void 0 ? void 0 : _f.fromName, time: '', id: (_g = this.incomingCallnotification.data.data) === null || _g === void 0 ? void 0 : _g.participantId }
3815
+ ] }, callerInfo);
3816
+ this.incomingCallsList.push(incomingCall);
3817
+ this.notificationCallList.push(incomingCall);
3818
+ if ((_h = this.incomingCallnotification.data.data) === null || _h === void 0 ? void 0 : _h.participantId) {
3819
+ this.isCallInProgress = true;
3820
+ }
3819
3821
  }
3820
- }
3821
- else if (this.incomingCallnotification.data.content == "Missed Call") {
3822
- let index = this.notificationCallList.findIndex((call) => { var _a; return call.participantId === ((_a = this.incomingCallnotification.data.data) === null || _a === void 0 ? void 0 : _a.recordId); });
3823
- if (index > -1) {
3824
- this.notificationCallList.splice(index, 1);
3825
- let incomingCallIndex = this.incomingCallsList.findIndex((call) => { var _a; return call.participantId === ((_a = this.incomingCallnotification.data.data) === null || _a === void 0 ? void 0 : _a.recordId); });
3826
- if (incomingCallIndex > -1) {
3827
- this.incomingCallsList.splice(incomingCallIndex, 1);
3822
+ else if (this.incomingCallnotification.data.content == "Missed Call") {
3823
+ let index = this.notificationCallList.findIndex((call) => { var _a; return call.participantId === ((_a = this.incomingCallnotification.data.data) === null || _a === void 0 ? void 0 : _a.recordId); });
3824
+ if (index > -1) {
3825
+ this.notificationCallList.splice(index, 1);
3826
+ let incomingCallIndex = this.incomingCallsList.findIndex((call) => { var _a; return call.participantId === ((_a = this.incomingCallnotification.data.data) === null || _a === void 0 ? void 0 : _a.recordId); });
3827
+ if (incomingCallIndex > -1) {
3828
+ this.incomingCallsList.splice(incomingCallIndex, 1);
3829
+ }
3830
+ console.log('test', this.incomingCallsList);
3831
+ this.isIncomingCallnotification = false;
3828
3832
  }
3829
- console.log('test', this.incomingCallsList);
3830
- this.isIncomingCallnotification = false;
3831
3833
  }
3834
+ console.log('notificationCallList', this.notificationCallList);
3835
+ this.cdk.detectChanges();
3836
+ // this.extensionService.setIncomingCallStatus(payload).subscribe((res: any) => {
3837
+ // console.log(res)
3838
+ // })
3832
3839
  }
3833
- console.log('notificationCallList', this.notificationCallList);
3834
- this.cdk.detectChanges();
3835
- // this.extensionService.setIncomingCallStatus(payload).subscribe((res: any) => {
3836
- // console.log(res)
3837
- // })
3838
- }
3839
- if (changes['deviceId']) {
3840
- // localStorage.setItem('deviceId', changes['deviceId'].currentValue);
3841
- this.twilioService.deviceId = changes['deviceId'].currentValue;
3842
- console.log('Set deviceId in localStorage:', changes['deviceId'].currentValue);
3843
- }
3844
- if (this.userId) {
3845
- this.extensionService.userId = this.userId;
3846
- }
3847
- if (changes['isDialpadHidden'] && !this.isDialpadHidden) {
3848
- this.getContactList();
3849
- this.getUserCallSetting();
3850
- setTimeout(() => {
3851
- this.dialInputElement.nativeElement.focus();
3852
- }, 0);
3853
- if (this.incomingCallData) {
3854
- if (this.isCallInProgress) {
3855
- this.newIncomingCalls.push(this.incomingCallData);
3856
- console.log('404', this.incomingCallData);
3857
- this.getUserInformation(this.incomingCallData);
3858
- }
3859
- else {
3860
- console.log('dd5');
3861
- this.isCallInProgress = true;
3862
- this.isDialpadHidden = false;
3863
- this.callData.phone = this.incomingCallData.parameters['From'];
3864
- console.log('411', this.incomingCallData);
3865
- this.getUserInformation(this.incomingCallData);
3866
- this.callData.name = this.incomingCallData.customParameters.get('name');
3867
- this.callData.img = this.incomingCallData.customParameters.get('image') || 'assets/images/user.jpg';
3868
- this.callData.isIncomingCall = true;
3869
- }
3870
- this.incomingCallData.on('cancel', () => {
3871
- this.incomingCallsList = this.incomingCallsList.filter((item) => item.parameters['CallSid'] !== this.incomingCallData.parameters['CallSid']);
3872
- // if(this.incomingCallsList.length == 0){
3873
- // console.log('dd6')
3874
- // this.isCallInProgress = false;
3875
- // }
3876
- this.incomingCallData.disconnect();
3877
- });
3878
- this.incomingCallData.on('disconnect', () => {
3879
- this.incomingCallsList = this.incomingCallsList.filter((item) => item.parameters['CallSid'] !== this.incomingCallData.parameters['CallSid']);
3880
- this.incomingCallData.disconnect();
3881
- // if(this.incomingCallsList.length == 0){
3882
- // console.log('dd7')
3883
- // this.isCallInProgress = false;
3884
- // }
3885
- });
3840
+ if (changes['deviceId']) {
3841
+ // localStorage.setItem('deviceId', changes['deviceId'].currentValue);
3842
+ this.twilioService.deviceId = changes['deviceId'].currentValue;
3843
+ console.log('Set deviceId in localStorage:', changes['deviceId'].currentValue);
3886
3844
  }
3887
- }
3888
- if (changes['contactInfo'] && this.contactInfo) {
3889
- let contact = this.contactInfo;
3890
- if (contact.number) {
3891
- this.isSmartDialCall = false;
3892
- this.dialedNumber = contact.number;
3893
- if (contact.isDialFromHistory) {
3894
- //handle dialing from history page
3895
- if (contact.callerId == 'smartDialing') {
3896
- this.selectedCallerId = { number: contact.from };
3897
- this.isSmartDialCall = true;
3898
- setTimeout(() => {
3899
- this.isDialpadHidden = false;
3900
- }, 2000);
3901
- this.callData.phone = contact.number;
3902
- this.callData.name = contact.name;
3903
- this.callData.img = contact.img;
3904
- this.callData.from = contact.from;
3905
- this.sanitizedNum = contact.number;
3906
- console.log('274', contact);
3907
- this.getUserInformation(contact);
3908
- console.log('454', contact);
3909
- // this.incomingCallsList.push(contact)
3910
- this.initiateCall();
3845
+ if (this.userId) {
3846
+ this.extensionService.userId = this.userId;
3847
+ }
3848
+ if (changes['isDialpadHidden'] && !this.isDialpadHidden) {
3849
+ this.getContactList();
3850
+ this.getUserCallSetting();
3851
+ setTimeout(() => {
3852
+ this.dialInputElement.nativeElement.focus();
3853
+ }, 0);
3854
+ if (this.incomingCallData) {
3855
+ if (this.isCallInProgress) {
3856
+ this.newIncomingCalls.push(this.incomingCallData);
3857
+ console.log('404', this.incomingCallData);
3858
+ this.getUserInformation(this.incomingCallData);
3911
3859
  }
3912
3860
  else {
3913
- this.getUserCallSetting();
3914
- setTimeout(() => {
3915
- this.isDialpadHidden = false;
3916
- }, 1000);
3917
- console.log('282', contact);
3918
- this.getUserInformation(contact);
3919
- console.log('464', contact);
3920
- // this.incomingCallsList.push(contact)
3921
- this.dialedNumber = contact.number;
3922
- this.sanitizedNum = contact.number;
3861
+ console.log('dd5');
3862
+ this.isCallInProgress = true;
3863
+ this.isDialpadHidden = false;
3864
+ this.callData.phone = this.incomingCallData.parameters['From'];
3865
+ console.log('411', this.incomingCallData);
3866
+ this.getUserInformation(this.incomingCallData);
3867
+ this.callData.name = this.incomingCallData.customParameters.get('name');
3868
+ this.callData.img = this.incomingCallData.customParameters.get('image') || 'assets/images/user.jpg';
3869
+ this.callData.isIncomingCall = true;
3923
3870
  }
3871
+ this.incomingCallData.on('cancel', () => {
3872
+ this.incomingCallsList = this.incomingCallsList.filter((item) => item.parameters['CallSid'] !== this.incomingCallData.parameters['CallSid']);
3873
+ // if(this.incomingCallsList.length == 0){
3874
+ // console.log('dd6')
3875
+ // this.isCallInProgress = false;
3876
+ // }
3877
+ this.incomingCallData.disconnect();
3878
+ });
3879
+ this.incomingCallData.on('disconnect', () => {
3880
+ this.incomingCallsList = this.incomingCallsList.filter((item) => item.parameters['CallSid'] !== this.incomingCallData.parameters['CallSid']);
3881
+ this.incomingCallData.disconnect();
3882
+ // if(this.incomingCallsList.length == 0){
3883
+ // console.log('dd7')
3884
+ // this.isCallInProgress = false;
3885
+ // }
3886
+ });
3924
3887
  }
3925
- else {
3926
- if (contact.callerId == 'alwaysAsk' || contact.callerId == 'smartDialing') {
3927
- this.getUserCallSetting();
3928
- setTimeout(() => {
3929
- this.isDialpadHidden = false;
3930
- }, 1000);
3931
- this.dialedNumber = contact.number;
3932
- this.sanitizedNum = contact.number;
3888
+ }
3889
+ if (changes['contactInfo'] && this.contactInfo) {
3890
+ let contact = this.contactInfo;
3891
+ if (contact.number) {
3892
+ this.isSmartDialCall = false;
3893
+ this.dialedNumber = contact.number;
3894
+ if (contact.isDialFromHistory) {
3895
+ //handle dialing from history page
3896
+ if (contact.callerId == 'smartDialing') {
3897
+ this.selectedCallerId = { number: contact.from };
3898
+ this.isSmartDialCall = true;
3899
+ setTimeout(() => {
3900
+ this.isDialpadHidden = false;
3901
+ }, 2000);
3902
+ this.callData.phone = contact.number;
3903
+ this.callData.name = contact.name;
3904
+ this.callData.img = contact.img;
3905
+ this.callData.from = contact.from;
3906
+ this.sanitizedNum = contact.number;
3907
+ console.log('274', contact);
3908
+ this.getUserInformation(contact);
3909
+ console.log('454', contact);
3910
+ // this.incomingCallsList.push(contact)
3911
+ this.initiateCall();
3912
+ }
3913
+ else {
3914
+ this.getUserCallSetting();
3915
+ setTimeout(() => {
3916
+ this.isDialpadHidden = false;
3917
+ }, 1000);
3918
+ console.log('282', contact);
3919
+ this.getUserInformation(contact);
3920
+ console.log('464', contact);
3921
+ // this.incomingCallsList.push(contact)
3922
+ this.dialedNumber = contact.number;
3923
+ this.sanitizedNum = contact.number;
3924
+ }
3933
3925
  }
3934
3926
  else {
3935
- setTimeout(() => {
3936
- this.isDialpadHidden = false;
3937
- }, 2000);
3938
- this.callData.phone = contact.number;
3939
- this.callData.name = contact.name;
3940
- this.callData.img = contact.img;
3941
- this.sanitizedNum = contact.number;
3942
- this.initiateCall();
3927
+ if (contact.callerId == 'alwaysAsk' || contact.callerId == 'smartDialing') {
3928
+ this.getUserCallSetting();
3929
+ setTimeout(() => {
3930
+ this.isDialpadHidden = false;
3931
+ }, 1000);
3932
+ this.dialedNumber = contact.number;
3933
+ this.sanitizedNum = contact.number;
3934
+ }
3935
+ else {
3936
+ setTimeout(() => {
3937
+ this.isDialpadHidden = false;
3938
+ }, 2000);
3939
+ this.callData.phone = contact.number;
3940
+ this.callData.name = contact.name;
3941
+ this.callData.img = contact.img;
3942
+ this.sanitizedNum = contact.number;
3943
+ this.initiateCall();
3944
+ }
3943
3945
  }
3944
3946
  }
3945
3947
  }
3946
- }
3948
+ });
3947
3949
  }
3948
3950
  registerDragElement() {
3949
3951
  try {