@vgroup/dialbox 0.7.89 → 0.7.90

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.
@@ -63,23 +63,23 @@ const keypad = [
63
63
  ];
64
64
 
65
65
  const environment = {
66
- abb: "u",
66
+ abb: "t",
67
67
  production: false,
68
68
  secureCookies: true,
69
- feUrl: 'https://c2c-uat.contexttocall.com:85/',
70
- apiUrl: 'https://c2c-uatapi-t10.contexttocall.com/uat_softphone',
71
- websocketUrl: 'wss://c2c-uatapi-t10.contexttocall.com/uat_softphone/',
69
+ feUrl: 'https://test.vgroupinc.com:91/',
70
+ apiUrl: 'https://apis.vgroupinc.com/test_softphone',
71
+ websocketUrl: 'wss://apis.vgroupinc.com/test_softphone/',
72
72
  captchaKey: "6LfpOmEaAAAAAGsI6JXlMzOl3b7rW4YmYXFDjldD",
73
- stripePublishableKey: "pk_live_51NbMVaA3guus6fhl85gdcvAWHzfHba5LdGlsnV7DxBT9spHghn4IHT9rDCjSRgFh2ijTiZn9qeazdciY1PbreOuB00t1GdQAZJ",
73
+ stripePublishableKey: "pk_test_51NbMVaA3guus6fhlTuCV5ycFTIJmwgN38dDUf9pNPfM319x5CkLbV6EbTQaZiNOrRsfR16RWLE8hQmR0eZFTBqTy00Wlsug4qS",
74
74
  sessionTimeout: 15,
75
75
  deviceType: "web",
76
- appVersion: "2.9",
77
- channelId: '6511738039ee10367cbde2e9',
76
+ appVersion: "2.3",
77
+ channelId: '61481b12e138eb7dc3007579',
78
78
  c2c_support_point_id: '60424735f74ac306c1bfa900',
79
- c2c_support_channel_id: '677f68fcbe93ab507fbbfe0b',
80
- c2c_point_url: 'https://bit.ly/3blWnPv',
81
- c2c_call_label_id: '5M4taT8xzAg9pPIUADOW',
82
- c2c_email_label_id: 'MUUC4NV5bLqHixXyhmok',
79
+ c2c_support_channel_id: '677f6726be93ab507fbbfdf0',
80
+ c2c_point_url: 'https://app.contexttocall.com/assets/cdn/c2c.js',
81
+ c2c_call_label_id: '6NU5fKE2mGTyXDC3yhmK',
82
+ c2c_email_label_id: 'YPMamj8RvsGORVvqXWyc',
83
83
  radarAPIKey: 'prj_live_sk_569b6f639edde6120a26f703511c61aaecd3f7ef',
84
84
  firebase: {
85
85
  apiKey: "AIzaSyCA8LSPrqlDq_thk26LhBQexAQeY6pkU5Y",
@@ -1656,6 +1656,11 @@ class TwilioService {
1656
1656
  };
1657
1657
  this.currentDeviceErrorHandler = onDeviceError;
1658
1658
  device.on('error', onDeviceError);
1659
+ device.on('disconnect', () => {
1660
+ console.log('Twilio Device disconnected');
1661
+ this.isShowIncomingCall = false;
1662
+ this.scheduleDeviceRecovery();
1663
+ });
1659
1664
  const onDeviceUnregistered = () => {
1660
1665
  // Stale event from a device we've already intentionally replaced — ignore.
1661
1666
  if (this.device !== device)
@@ -2585,7 +2590,7 @@ class CallProgressComponent {
2585
2590
  if (!((_8 = this.currentConferenceCall) === null || _8 === void 0 ? void 0 : _8.conferenceId) && ((_9 = this.currentCall) === null || _9 === void 0 ? void 0 : _9.conferenceId)) {
2586
2591
  this.timer = this.getTimeDifference((_10 = this.currentCall) === null || _10 === void 0 ? void 0 : _10.joinedAt);
2587
2592
  }
2588
- if ((_11 = this.selectedUserInfo) === null || _11 === void 0 ? void 0 : _11.participantId) {
2593
+ if ((_11 = this.selectedUserInfo) === null || _11 === void 0 ? void 0 : _11.id) {
2589
2594
  let selectedUser = this.currentCallList.find((item) => { var _a; return (item === null || item === void 0 ? void 0 : item.id) == ((_a = this.selectedUserInfo) === null || _a === void 0 ? void 0 : _a.id); });
2590
2595
  if (selectedUser && ((selectedUser === null || selectedUser === void 0 ? void 0 : selectedUser.conferenceId) == ((_12 = this.currentConferenceCall) === null || _12 === void 0 ? void 0 : _12.conferenceId) || this.isClickExpand)) {
2591
2596
  selectedUser.IsUserInfoShow = true;
@@ -2936,7 +2941,7 @@ class CallProgressComponent {
2936
2941
  setTimeout(() => __awaiter(this, void 0, void 0, function* () {
2937
2942
  var _c, _d, _e, _f, _g;
2938
2943
  try {
2939
- let addClientParticipantRes = yield this.addClientParticipant({
2944
+ let addClientParticipantRes = this.addClientParticipant({
2940
2945
  from: callData === null || callData === void 0 ? void 0 : callData.from,
2941
2946
  route: "OUTGOING",
2942
2947
  participantNumber: callData === null || callData === void 0 ? void 0 : callData.phone,
@@ -2947,9 +2952,9 @@ class CallProgressComponent {
2947
2952
  deviceId: this.deviceId,
2948
2953
  clientSid: (_d = this.call) === null || _d === void 0 ? void 0 : _d.parameters['CallSid']
2949
2954
  });
2950
- if ((addClientParticipantRes === null || addClientParticipantRes === void 0 ? void 0 : addClientParticipantRes.status) != 200) {
2951
- swal("Error", addClientParticipantRes === null || addClientParticipantRes === void 0 ? void 0 : addClientParticipantRes.message, "error");
2952
- }
2955
+ // if(addClientParticipantRes?.status != 200) {
2956
+ // swal("Error", addClientParticipantRes?.message.join("<br/>"), "error");
2957
+ // }
2953
2958
  this.addRes = yield this.addParticipantToCall({
2954
2959
  from: callData === null || callData === void 0 ? void 0 : callData.from,
2955
2960
  route: "OUTGOING",
@@ -2987,34 +2992,14 @@ class CallProgressComponent {
2987
2992
  this.unholdPendingConference();
2988
2993
  }
2989
2994
  else {
2990
- console.log(896);
2991
- this.endCallEvent.emit();
2992
2995
  this.endCall(); // regular call failure – disconnect everything
2993
2996
  }
2994
2997
  }
2995
2998
  }
2996
2999
  catch (error) {
2997
3000
  this.showRingAnimation = false;
2998
- // Whatever failed above (backend call, Twilio connect, etc.), the "Connecting..."
2999
- // loader must always come down — previously this was left to endCall()/the socket
3000
- // feed, and if either of those didn't run (or threw), the loader stayed on screen
3001
- // forever with no way back to the dialpad.
3002
- this.extensionService.isLoadershow.next(false);
3003
- this.isLoadershown.emit(false);
3004
- if (isNewConference) {
3005
- this.unholdPendingConference();
3006
- }
3007
- else {
3008
- console.log(896);
3009
- this.endCallEvent.emit();
3010
- try {
3011
- this.endCall(); // regular call failure – disconnect everything
3012
- }
3013
- catch (cleanupError) {
3014
- console.error('Error during call failure cleanup:', cleanupError);
3015
- }
3016
- }
3017
- this.handleError('Call not initiating due to a technical issue. Please try again.');
3001
+ this.handleError(error);
3002
+ this.endCall();
3018
3003
  return false;
3019
3004
  }
3020
3005
  });
@@ -3116,25 +3101,15 @@ class CallProgressComponent {
3116
3101
  });
3117
3102
  }
3118
3103
  onEndCall(c, isAllCallEnd, isContect) {
3119
- var _a, _b;
3104
+ var _a;
3120
3105
  return __awaiter(this, void 0, void 0, function* () {
3121
- let participantId = isAllCallEnd ? 'all' : (c === null || c === void 0 ? void 0 : c.participantId) || (c === null || c === void 0 ? void 0 : c.id);
3106
+ let participantId = isAllCallEnd ? 'all' : c.participantId || (c === null || c === void 0 ? void 0 : c.id);
3122
3107
  const currentConferenceCallInfo = this.getCurrentCallInfo();
3123
- // A call that failed/aborted before the backend ever created a conference for it
3124
- // (e.g. initiateCall()/connectToDevice() threw) has no `c` and no matching entry
3125
- // here — there is nothing to remove server-side, so just fall through to the
3126
- // local cleanup below instead of throwing on `undefined.participants`.
3127
- if (!(c === null || c === void 0 ? void 0 : c.conferenceId) && !isAllCallEnd) {
3128
- this.conferenceCallIDForParticipantList = currentConferenceCallInfo === null || currentConferenceCallInfo === void 0 ? void 0 : currentConferenceCallInfo.conferenceId;
3129
- this.incomeingCallSocketService.pause();
3130
- this.cdr.detectChanges();
3131
- return false;
3132
- }
3133
- const participantList = ((_a = this.newIncomingCallsList.find((callInfo) => (callInfo === null || callInfo === void 0 ? void 0 : callInfo.conferenceId) == (c === null || c === void 0 ? void 0 : c.conferenceId))) === null || _a === void 0 ? void 0 : _a.participants.filter((resData) => !(resData === null || resData === void 0 ? void 0 : resData.isLeft))) || [];
3108
+ const participantList = this.newIncomingCallsList.find((callInfo) => (callInfo === null || callInfo === void 0 ? void 0 : callInfo.conferenceId) == (c === null || c === void 0 ? void 0 : c.conferenceId)).participants.filter((resData) => !(resData === null || resData === void 0 ? void 0 : resData.isLeft));
3134
3109
  if ((participantList === null || participantList === void 0 ? void 0 : participantList.length) <= 2 && !isContect) {
3135
3110
  participantId = 'all';
3136
3111
  }
3137
- if (((_b = this.newIncomingCallsList) === null || _b === void 0 ? void 0 : _b.length) == 2) {
3112
+ if (((_a = this.newIncomingCallsList) === null || _a === void 0 ? void 0 : _a.length) == 2) {
3138
3113
  this.pendingAutoUnhold = true;
3139
3114
  }
3140
3115
  let conferenceId = c.conferenceId || (currentConferenceCallInfo === null || currentConferenceCallInfo === void 0 ? void 0 : currentConferenceCallInfo.conferenceId);
@@ -3443,7 +3418,7 @@ class CallProgressComponent {
3443
3418
  if (!this.C2ConfoList[userInfo === null || userInfo === void 0 ? void 0 : userInfo.participantId] && !this.C2ConfoList[userInfo === null || userInfo === void 0 ? void 0 : userInfo.businessParticipantId]) {
3444
3419
  this.extensionService.getUserInformation(participantID).subscribe({
3445
3420
  next: (resInfo) => {
3446
- let index = this.currentCallList.findIndex((item) => (item === null || item === void 0 ? void 0 : item.participantId) == (userInfo === null || userInfo === void 0 ? void 0 : userInfo.id));
3421
+ let index = this.currentCallList.findIndex((item) => (item === null || item === void 0 ? void 0 : item.participantId) == participantID);
3447
3422
  this.currentCallList[index] = this.mapUserInfo(this.currentCallList[index], resInfo === null || resInfo === void 0 ? void 0 : resInfo.c2cInformation);
3448
3423
  this.selectedUserInfo = this.currentCallList[index];
3449
3424
  this.C2ConfoList[participantID] = this.currentCallList[index];
@@ -3638,7 +3613,7 @@ class CallProgressComponent {
3638
3613
  else if (((_d = (_c = (_b = this.missCallInfo) === null || _b === void 0 ? void 0 : _b.data) === null || _c === void 0 ? void 0 : _c.data) === null || _d === void 0 ? void 0 : _d.recordId) == (data === null || data === void 0 ? void 0 : data.id) && !((_e = callToAccept.parameters) === null || _e === void 0 ? void 0 : _e.CallSid)) {
3639
3614
  clearInterval(intervalId);
3640
3615
  const sid = (_f = callToAccept.parameters) === null || _f === void 0 ? void 0 : _f.CallSid;
3641
- this.twilioService.isConnectingIncomingCallId.next('');
3616
+ this.isConnectingIncomingCallId = '';
3642
3617
  this.isConnectingIncomingCallId = '';
3643
3618
  this.acceptedCallList = this.acceptedCallList.filter(c => c.callSid !== sid);
3644
3619
  this.twilioService.acceptedCallList = this.twilioService.acceptedCallList.filter((c) => { var _a; return ((_a = c.parameters) === null || _a === void 0 ? void 0 : _a.CallSid) !== sid; });
@@ -3783,7 +3758,7 @@ class CallProgressComponent {
3783
3758
  catch (error) {
3784
3759
  console.error('Error adding participant:', error);
3785
3760
  this.showRingAnimation = false;
3786
- this.handleError('Failed to add participant. Please try again.');
3761
+ this.handleError(error);
3787
3762
  }
3788
3763
  });
3789
3764
  }
@@ -4109,7 +4084,9 @@ class CallProgressComponent {
4109
4084
  console.log(ev);
4110
4085
  try {
4111
4086
  let selfCall = (_a = this.newIncomingCallsList.find((res) => { var _a; return (res === null || res === void 0 ? void 0 : res.conferenceId) == ((_a = this.currentCall) === null || _a === void 0 ? void 0 : _a.conferenceId); })) === null || _a === void 0 ? void 0 : _a.participants.find((resData) => ((this.deviceNumberList.includes(resData === null || resData === void 0 ? void 0 : resData.from) && (resData === null || resData === void 0 ? void 0 : resData.client)) || (this.deviceNumberList.includes(resData === null || resData === void 0 ? void 0 : resData.to) && (resData === null || resData === void 0 ? void 0 : resData.direction) == 'incoming-call' && (resData === null || resData === void 0 ? void 0 : resData.host))) && !(resData === null || resData === void 0 ? void 0 : resData.isLeft));
4087
+ console.log(selfCall);
4112
4088
  let device = this.twilioService.getIncomingCallById((selfCall === null || selfCall === void 0 ? void 0 : selfCall.callSid) || (selfCall === null || selfCall === void 0 ? void 0 : selfCall.clientSid));
4089
+ console.log(device);
4113
4090
  if (device && (device === null || device === void 0 ? void 0 : device._status) == 'open') {
4114
4091
  device.sendDigits(String(ev.key));
4115
4092
  }
@@ -4894,7 +4871,7 @@ class DialboxComponent {
4894
4871
  this.incomeingCallSocketService.connect(this.deviceId);
4895
4872
  try {
4896
4873
  this.incomeingCallSocketService.listen().subscribe((incomingCallData) => __awaiter(this, void 0, void 0, function* () {
4897
- var _a, _b, _c, _d, _e, _f;
4874
+ var _a, _b, _c, _d, _e;
4898
4875
  this.twilioService.conferenceCallInfo = incomingCallData;
4899
4876
  this.conferenceCallList.emit(incomingCallData);
4900
4877
  this.token = localStorage.getItem('ext_token') || '';
@@ -4907,6 +4884,7 @@ class DialboxComponent {
4907
4884
  incomingCallData = (incomingCallData === null || incomingCallData === void 0 ? void 0 : incomingCallData.length) > 0
4908
4885
  ? incomingCallData.filter((item) => { var _a; return ((_a = item.participants) === null || _a === void 0 ? void 0 : _a.length) > 0; })
4909
4886
  : [];
4887
+ console.log('244', incomingCallData);
4910
4888
  // All conferenceIds received from socket this tick
4911
4889
  const socketConferenceIds = incomingCallData.map((c) => c.conferenceId);
4912
4890
  incomingCallData.forEach((callInfo) => {
@@ -4935,11 +4913,14 @@ class DialboxComponent {
4935
4913
  }
4936
4914
  }
4937
4915
  });
4916
+ console.log('incomingCallsList 275', this.incomingCallsList);
4938
4917
  // Remove active-call entries whose conferenceId is no longer in the socket
4939
4918
  // but keep incoming-call notifications (they are managed by notificationCallList expiry)
4940
4919
  this.incomingCallsList = this.incomingCallsList.filter((res) => socketConferenceIds.includes(res.conferenceId) || res.direction === 'incoming-call');
4920
+ console.log('incomingCallsList 281', this.incomingCallsList);
4941
4921
  // Remove expired notification entries
4942
4922
  this.notificationCallList = this.notificationCallList.filter((res) => res.endTime >= new Date().getTime());
4923
+ console.log('notificationCallList 286', this.notificationCallList, this.incomingCallsList);
4943
4924
  // Merge notificationCallList ONCE (not inside forEach). A pending incoming-call
4944
4925
  // notification is identified by its OWN participantId — never by conferenceId —
4945
4926
  // because it can legitimately share the conferenceId of a conference we are already
@@ -4948,8 +4929,10 @@ class DialboxComponent {
4948
4929
  const existingNotificationParticipantIds = new Set(this.incomingCallsList
4949
4930
  .filter((r) => r === null || r === void 0 ? void 0 : r._isNotification)
4950
4931
  .map((r) => r === null || r === void 0 ? void 0 : r.participantId));
4932
+ console.log('existingNotificationParticipantIds 296', existingNotificationParticipantIds);
4951
4933
  const notificationsToAdd = this.notificationCallList.filter((n) => !existingNotificationParticipantIds.has(n === null || n === void 0 ? void 0 : n.participantId));
4952
4934
  this.incomingCallsList = [...this.incomingCallsList, ...notificationsToAdd];
4935
+ console.log('incomingCallsList 305', this.incomingCallsList, notificationsToAdd);
4953
4936
  // Final deduplication. Active conference entries are keyed by conferenceId (socket data
4954
4937
  // wins — last write wins). Pending incoming-call notifications are keyed in a SEPARATE
4955
4938
  // namespace by participantId, so a notification and an active conference that share the
@@ -4961,11 +4944,13 @@ class DialboxComponent {
4961
4944
  : `conf:${item === null || item === void 0 ? void 0 : item.conferenceId}`;
4962
4945
  seen.set(key, item);
4963
4946
  }
4947
+ console.log('incomingCallsList 320', this.incomingCallsList, Array.from(seen.values()));
4964
4948
  let finalList = Array.from(seen.values());
4965
4949
  // Remove any notification entry if an active conference with the same conferenceId already exists
4966
4950
  // added for 7472 bug
4967
4951
  const activeConferenceIds = new Set(finalList.filter((item) => !item._isNotification).map((item) => item.conferenceId));
4968
4952
  finalList = finalList.filter((item) => !(item._isNotification && activeConferenceIds.has(item.conferenceId)));
4953
+ console.log('incomingCallsList 33=0', this.incomingCallsList, finalList);
4969
4954
  this.incomingCallsList = finalList;
4970
4955
  if (((_b = this.incomingCallsList) === null || _b === void 0 ? void 0 : _b.length) && (incomingCallData === null || incomingCallData === void 0 ? void 0 : incomingCallData.length)) {
4971
4956
  this.isCallInProgress = true;
@@ -4994,13 +4979,13 @@ class DialboxComponent {
4994
4979
  }, 2000);
4995
4980
  }
4996
4981
  }
4997
- if (!((_e = this.incomingCallsList) === null || _e === void 0 ? void 0 : _e.length) && !((_f = this.twilioService.acceptedCallList) === null || _f === void 0 ? void 0 : _f.length)) {
4982
+ if (!((_e = this.incomingCallsList) === null || _e === void 0 ? void 0 : _e.length)) {
4998
4983
  setTimeout(() => {
4999
- var _a, _b, _c, _d;
5000
- if (!((_a = this.incomingCallsList) === null || _a === void 0 ? void 0 : _a.length) && !((_b = this.twilioService.acceptedCallList) === null || _b === void 0 ? void 0 : _b.length)) {
4984
+ var _a, _b, _c;
4985
+ if (!((_a = this.incomingCallsList) === null || _a === void 0 ? void 0 : _a.length)) {
5001
4986
  this.isCallInProgress = false;
5002
- (_c = this.twilioService.device) === null || _c === void 0 ? void 0 : _c.disconnectAll();
5003
- (_d = this.twilioService.spareDevice) === null || _d === void 0 ? void 0 : _d.disconnectAll();
4987
+ (_b = this.twilioService.device) === null || _b === void 0 ? void 0 : _b.disconnectAll();
4988
+ (_c = this.twilioService.spareDevice) === null || _c === void 0 ? void 0 : _c.disconnectAll();
5004
4989
  }
5005
4990
  }, 2000);
5006
4991
  }
@@ -5256,7 +5241,7 @@ class DialboxComponent {
5256
5241
  if (this.twilioService.incomingCallToken != this.updatedTwilioToken) {
5257
5242
  this.twilioService.incomingCallToken = this.updatedTwilioToken;
5258
5243
  this.twilioService.tokenInitialized = true;
5259
- this.twilioService.initializeTwilioDevice(localStorage.getItem('deviceId'));
5244
+ this.twilioService.initializeTwilioDevice(this.deviceId || localStorage.getItem('deviceId'));
5260
5245
  }
5261
5246
  }
5262
5247
  if (((_y = changes['userId']) === null || _y === void 0 ? void 0 : _y.currentValue) && this.userId) {
@@ -5972,7 +5957,6 @@ class DialboxComponent {
5972
5957
  this.incomingCallsList = [];
5973
5958
  // Clean up Twilio device when component is destroyed
5974
5959
  if (this.twilioService['device']) {
5975
- console.log('Destroying Twilio device...');
5976
5960
  this.twilioService['device'].disconnectAll();
5977
5961
  this.twilioService['device'].destroy();
5978
5962
  }