@vgroup/dialbox 0.4.198 → 0.4.199

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.
@@ -3789,163 +3789,157 @@ class DialboxComponent {
3789
3789
  this.registerDragElement();
3790
3790
  }
3791
3791
  ngOnChanges(changes) {
3792
- var _a, _b, _c, _d, _e, _f, _g, _h;
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
- }
3792
+ var _a, _b;
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.c2cInformation;
3810
+ this.incomingCallNotification(callerInfo);
3811
+ });
3821
3812
  }
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;
3832
- }
3813
+ else {
3814
+ this.incomingCallNotification({});
3833
3815
  }
3834
- console.log('notificationCallList', this.notificationCallList);
3835
- this.cdk.detectChanges();
3836
- // this.extensionService.setIncomingCallStatus(payload).subscribe((res: any) => {
3837
- // console.log(res)
3838
- // })
3839
3816
  }
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);
3817
+ else if (this.incomingCallnotification.data.content == "Missed Call") {
3818
+ let index = this.notificationCallList.findIndex((call) => { var _a; return call.participantId === ((_a = this.incomingCallnotification.data.data) === null || _a === void 0 ? void 0 : _a.recordId); });
3819
+ if (index > -1) {
3820
+ this.notificationCallList.splice(index, 1);
3821
+ let incomingCallIndex = this.incomingCallsList.findIndex((call) => { var _a; return call.participantId === ((_a = this.incomingCallnotification.data.data) === null || _a === void 0 ? void 0 : _a.recordId); });
3822
+ if (incomingCallIndex > -1) {
3823
+ this.incomingCallsList.splice(incomingCallIndex, 1);
3824
+ }
3825
+ console.log('test', this.incomingCallsList);
3826
+ this.isIncomingCallnotification = false;
3827
+ }
3844
3828
  }
3845
- if (this.userId) {
3846
- this.extensionService.userId = this.userId;
3829
+ console.log('notificationCallList', this.notificationCallList);
3830
+ this.cdk.detectChanges();
3831
+ // this.extensionService.setIncomingCallStatus(payload).subscribe((res: any) => {
3832
+ // console.log(res)
3833
+ // })
3834
+ }
3835
+ if (changes['deviceId']) {
3836
+ // localStorage.setItem('deviceId', changes['deviceId'].currentValue);
3837
+ this.twilioService.deviceId = changes['deviceId'].currentValue;
3838
+ console.log('Set deviceId in localStorage:', changes['deviceId'].currentValue);
3839
+ }
3840
+ if (this.userId) {
3841
+ this.extensionService.userId = this.userId;
3842
+ }
3843
+ if (changes['isDialpadHidden'] && !this.isDialpadHidden) {
3844
+ this.getContactList();
3845
+ this.getUserCallSetting();
3846
+ setTimeout(() => {
3847
+ this.dialInputElement.nativeElement.focus();
3848
+ }, 0);
3849
+ if (this.incomingCallData) {
3850
+ if (this.isCallInProgress) {
3851
+ this.newIncomingCalls.push(this.incomingCallData);
3852
+ console.log('404', this.incomingCallData);
3853
+ this.getUserInformation(this.incomingCallData);
3854
+ }
3855
+ else {
3856
+ console.log('dd5');
3857
+ this.isCallInProgress = true;
3858
+ this.isDialpadHidden = false;
3859
+ this.callData.phone = this.incomingCallData.parameters['From'];
3860
+ console.log('411', this.incomingCallData);
3861
+ this.getUserInformation(this.incomingCallData);
3862
+ this.callData.name = this.incomingCallData.customParameters.get('name');
3863
+ this.callData.img = this.incomingCallData.customParameters.get('image') || 'assets/images/user.jpg';
3864
+ this.callData.isIncomingCall = true;
3865
+ }
3866
+ this.incomingCallData.on('cancel', () => {
3867
+ this.incomingCallsList = this.incomingCallsList.filter((item) => item.parameters['CallSid'] !== this.incomingCallData.parameters['CallSid']);
3868
+ // if(this.incomingCallsList.length == 0){
3869
+ // console.log('dd6')
3870
+ // this.isCallInProgress = false;
3871
+ // }
3872
+ this.incomingCallData.disconnect();
3873
+ });
3874
+ this.incomingCallData.on('disconnect', () => {
3875
+ this.incomingCallsList = this.incomingCallsList.filter((item) => item.parameters['CallSid'] !== this.incomingCallData.parameters['CallSid']);
3876
+ this.incomingCallData.disconnect();
3877
+ // if(this.incomingCallsList.length == 0){
3878
+ // console.log('dd7')
3879
+ // this.isCallInProgress = false;
3880
+ // }
3881
+ });
3847
3882
  }
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);
3883
+ }
3884
+ if (changes['contactInfo'] && this.contactInfo) {
3885
+ let contact = this.contactInfo;
3886
+ if (contact.number) {
3887
+ this.isSmartDialCall = false;
3888
+ this.dialedNumber = contact.number;
3889
+ if (contact.isDialFromHistory) {
3890
+ //handle dialing from history page
3891
+ if (contact.callerId == 'smartDialing') {
3892
+ this.selectedCallerId = { number: contact.from };
3893
+ this.isSmartDialCall = true;
3894
+ setTimeout(() => {
3895
+ this.isDialpadHidden = false;
3896
+ }, 2000);
3897
+ this.callData.phone = contact.number;
3898
+ this.callData.name = contact.name;
3899
+ this.callData.img = contact.img;
3900
+ this.callData.from = contact.from;
3901
+ this.sanitizedNum = contact.number;
3902
+ console.log('274', contact);
3903
+ this.getUserInformation(contact);
3904
+ console.log('454', contact);
3905
+ // this.incomingCallsList.push(contact)
3906
+ this.initiateCall();
3859
3907
  }
3860
3908
  else {
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;
3909
+ this.getUserCallSetting();
3910
+ setTimeout(() => {
3911
+ this.isDialpadHidden = false;
3912
+ }, 1000);
3913
+ console.log('282', contact);
3914
+ this.getUserInformation(contact);
3915
+ console.log('464', contact);
3916
+ // this.incomingCallsList.push(contact)
3917
+ this.dialedNumber = contact.number;
3918
+ this.sanitizedNum = contact.number;
3870
3919
  }
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
- });
3887
3920
  }
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
- }
3921
+ else {
3922
+ if (contact.callerId == 'alwaysAsk' || contact.callerId == 'smartDialing') {
3923
+ this.getUserCallSetting();
3924
+ setTimeout(() => {
3925
+ this.isDialpadHidden = false;
3926
+ }, 1000);
3927
+ this.dialedNumber = contact.number;
3928
+ this.sanitizedNum = contact.number;
3925
3929
  }
3926
3930
  else {
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
- }
3931
+ setTimeout(() => {
3932
+ this.isDialpadHidden = false;
3933
+ }, 2000);
3934
+ this.callData.phone = contact.number;
3935
+ this.callData.name = contact.name;
3936
+ this.callData.img = contact.img;
3937
+ this.sanitizedNum = contact.number;
3938
+ this.initiateCall();
3945
3939
  }
3946
3940
  }
3947
3941
  }
3948
- });
3942
+ }
3949
3943
  }
3950
3944
  registerDragElement() {
3951
3945
  try {
@@ -3993,6 +3987,37 @@ class DialboxComponent {
3993
3987
  console.log(e);
3994
3988
  }
3995
3989
  }
3990
+ incomingCallNotification(callerInfo) {
3991
+ var _a, _b, _c, _d, _e, _f;
3992
+ let incomingCall = {
3993
+ conferenceId: 'no',
3994
+ isActive: true,
3995
+ isIncomingCall: true,
3996
+ participantId: (_a = this.incomingCallnotification.data.data) === null || _a === void 0 ? void 0 : _a.participantId,
3997
+ participants: [
3998
+ { direction: "incoming-call", img: 'assets/images/user.jpg', isIncomingCall: true, isHold: false, isConference: false, isAcceptCall: false, dial: true, phone: (_b = this.incomingCallnotification.data.data) === null || _b === void 0 ? void 0 : _b.fromNumber, participantId: (_c = this.incomingCallnotification.data.data) === null || _c === void 0 ? void 0 : _c.participantId, name: (_d = this.incomingCallnotification.data.data) === null || _d === void 0 ? void 0 : _d.fromName, time: '', id: (_e = this.incomingCallnotification.data.data) === null || _e === void 0 ? void 0 : _e.participantId }
3999
+ ],
4000
+ };
4001
+ if (callerInfo) {
4002
+ incomingCall.participants[0]['email'] = callerInfo.email;
4003
+ incomingCall.participants[0]['name'] = callerInfo.name;
4004
+ incomingCall.participants[0]['image'] = callerInfo.image;
4005
+ incomingCall.participants[0]['extension'] = callerInfo.extension;
4006
+ incomingCall.participants[0]['userInfoId'] = callerInfo.id;
4007
+ incomingCall.participants[0]['message'] = callerInfo.message;
4008
+ incomingCall.participants[0]['note'] = callerInfo.note;
4009
+ incomingCall.participants[0]['number'] = callerInfo.number;
4010
+ incomingCall.participants[0]['pointName'] = callerInfo.pointName;
4011
+ incomingCall.participants[0]['softphoneTwilioAuthId'] = callerInfo.softphoneTwilioAuthId;
4012
+ incomingCall.participants[0]['sourceName'] = callerInfo.sourceName;
4013
+ incomingCall.participants[0]['subject'] = callerInfo.subject;
4014
+ }
4015
+ this.incomingCallsList.push(incomingCall);
4016
+ this.notificationCallList.push(incomingCall);
4017
+ if ((_f = this.incomingCallnotification.data.data) === null || _f === void 0 ? void 0 : _f.participantId) {
4018
+ this.isCallInProgress = true;
4019
+ }
4020
+ }
3996
4021
  addNumber(num) {
3997
4022
  if (num == '#' || num == '*' || num == '+' || Number.isInteger(num)) {
3998
4023
  if (num == '#') {