@vgroup/dialbox 0.4.198 → 0.5.1

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