@vgroup/dialbox 0.4.59 → 0.4.61

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.
@@ -1816,7 +1816,7 @@ class CallProgressComponent {
1816
1816
  this.GetContactsList();
1817
1817
  }
1818
1818
  ngOnChanges(changes) {
1819
- var _a, _b, _c, _d, _e, _f, _g, _h;
1819
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
1820
1820
  if (changes['callData']) {
1821
1821
  if ((_a = changes['callData'].currentValue) === null || _a === void 0 ? void 0 : _a.isIncomingCall) {
1822
1822
  this.incomingCallDiv = true;
@@ -1830,140 +1830,134 @@ class CallProgressComponent {
1830
1830
  }
1831
1831
  }
1832
1832
  if (changes['newIncomingCallsList']) {
1833
- try {
1834
- if (this.newIncomingCallsList.length) {
1835
- // Check if there's an active ongoing call
1836
- this.conferenceId = this.newIncomingCallsList[0].conferenceId;
1837
- this.newIncomingCallsList.forEach((res) => __awaiter(this, void 0, void 0, function* () {
1838
- var _j, _k, _l, _m, _o, _p, _q, _r, _s;
1839
- if (this.currentCallList.length > 0) {
1840
- let index = this.currentCallList.findIndex((item) => item.id == res.id);
1841
- if (index == -1 && !res.isLeft) {
1842
- this.currentCallList.push(Object.assign(Object.assign({}, res), { img: 'assets/images/user.jpg', isIncomingCall: res.direction == "incoming-call", isHold: res.isHold, isMute: false, isConference: res.isConference, isAcceptCall: res.direction == "incoming-call" ? this.getStatus(res) : true, dial: true, phone: res.direction == "incoming-call" ? res === null || res === void 0 ? void 0 : res.from : res === null || res === void 0 ? void 0 : res.to, participantId: res.id, name: res.name || (res === null || res === void 0 ? void 0 : res.fromName) || (res === null || res === void 0 ? void 0 : res.toName), time: this.getTimeDifference(res.joinedAt || new Date().toUTCString()) }));
1843
- if (this.showContactsPanel) {
1844
- this.getAllParticipants(this.twilioService.conferenceCallInfo.conferenceSid);
1845
- this.applyFilter();
1846
- }
1833
+ // try {
1834
+ if ((_h = this.newIncomingCallsList) === null || _h === void 0 ? void 0 : _h.length) {
1835
+ // Check if there's an active ongoing call
1836
+ this.conferenceId = this.newIncomingCallsList[0].conferenceId;
1837
+ this.newIncomingCallsList.forEach((res) => __awaiter(this, void 0, void 0, function* () {
1838
+ var _l, _m, _o, _p, _q, _r, _s, _t, _u;
1839
+ if (this.currentCallList.length > 0) {
1840
+ let index = this.currentCallList.findIndex((item) => item.id == res.id);
1841
+ if (index == -1 && !res.isLeft) {
1842
+ this.currentCallList.push(Object.assign(Object.assign({}, res), { img: 'assets/images/user.jpg', isIncomingCall: res.direction == "incoming-call", isHold: res.isHold, isMute: false, isConference: res.isConference, isAcceptCall: res.direction == "incoming-call" ? this.getStatus(res) : true, dial: true, phone: res.direction == "incoming-call" ? res === null || res === void 0 ? void 0 : res.from : res === null || res === void 0 ? void 0 : res.to, participantId: res.id, name: res.name || (res === null || res === void 0 ? void 0 : res.fromName) || (res === null || res === void 0 ? void 0 : res.toName), time: this.getTimeDifference(res.joinedAt || new Date().toUTCString()) }));
1843
+ if (this.showContactsPanel) {
1844
+ this.getAllParticipants(this.twilioService.conferenceCallInfo.conferenceSid);
1845
+ this.applyFilter();
1847
1846
  }
1848
- else if (index != -1 && res.isLeft) {
1849
- if (((_j = this.currentCallList[index]) === null || _j === void 0 ? void 0 : _j.id) == ((_k = this.currentCall) === null || _k === void 0 ? void 0 : _k.id)) {
1850
- this.currentCallList.splice(index, 1);
1851
- this.currentCall = this.currentCallList.length > 0 ? this.currentCallList[0] : {};
1852
- if (((_l = this.currentCall) === null || _l === void 0 ? void 0 : _l.isHold) && !((_m = this.currentCall) === null || _m === void 0 ? void 0 : _m.isConference)) {
1847
+ }
1848
+ else if (index != -1 && res.isLeft) {
1849
+ if (((_l = this.currentCallList[index]) === null || _l === void 0 ? void 0 : _l.id) == ((_m = this.currentCall) === null || _m === void 0 ? void 0 : _m.id)) {
1850
+ this.currentCallList.splice(index, 1);
1851
+ this.currentCall = this.currentCallList.length > 0 ? this.currentCallList[0] : {};
1852
+ if (((_o = this.currentCall) === null || _o === void 0 ? void 0 : _o.isHold) && !((_p = this.currentCall) === null || _p === void 0 ? void 0 : _p.isConference)) {
1853
+ yield this.onholdOrUnholdParticipant({
1854
+ participantId: [(_q = this.currentCall) === null || _q === void 0 ? void 0 : _q.participantId],
1855
+ conferenceId: this.conferenceId,
1856
+ hold: false,
1857
+ conference: (_r = this.currentCall) === null || _r === void 0 ? void 0 : _r.isConference
1858
+ });
1859
+ // this.currentCallList[0].isHold = false;
1860
+ }
1861
+ else if (((_s = this.currentCall) === null || _s === void 0 ? void 0 : _s.isHold) && ((_t = this.currentCall) === null || _t === void 0 ? void 0 : _t.isConference)) {
1862
+ let conferenceCalllist = this.currentCallList.filter((item) => item.isConference);
1863
+ if (conferenceCalllist.length > 0) {
1853
1864
  yield this.onholdOrUnholdParticipant({
1854
- participantId: [(_o = this.currentCall) === null || _o === void 0 ? void 0 : _o.participantId],
1865
+ participantId: conferenceCalllist.map((item) => item.participantId),
1855
1866
  conferenceId: this.conferenceId,
1856
1867
  hold: false,
1857
- conference: (_p = this.currentCall) === null || _p === void 0 ? void 0 : _p.isConference
1868
+ conference: (_u = this.currentCall) === null || _u === void 0 ? void 0 : _u.isConference
1858
1869
  });
1859
- // this.currentCallList[0].isHold = false;
1860
- }
1861
- else if (((_q = this.currentCall) === null || _q === void 0 ? void 0 : _q.isHold) && ((_r = this.currentCall) === null || _r === void 0 ? void 0 : _r.isConference)) {
1862
- let conferenceCalllist = this.currentCallList.filter((item) => item.isConference);
1863
- if (conferenceCalllist.length > 0) {
1864
- yield this.onholdOrUnholdParticipant({
1865
- participantId: conferenceCalllist.map((item) => item.participantId),
1866
- conferenceId: this.conferenceId,
1867
- hold: false,
1868
- conference: (_s = this.currentCall) === null || _s === void 0 ? void 0 : _s.isConference
1869
- });
1870
- // this.currentCallList.forEach((item: any) => {
1871
- // if (item.isConference) {
1872
- // item.isHold = false;
1873
- // } else {
1874
- // item.isHold = true;
1875
- // }
1876
- // })
1877
- this.isConferenceCallHold = false;
1878
- }
1870
+ // this.currentCallList.forEach((item: any) => {
1871
+ // if (item.isConference) {
1872
+ // item.isHold = false;
1873
+ // } else {
1874
+ // item.isHold = true;
1875
+ // }
1876
+ // })
1877
+ this.isConferenceCallHold = false;
1879
1878
  }
1880
1879
  }
1881
- else {
1882
- this.currentCallList.splice(index, 1);
1883
- }
1884
- if (this.showContactsPanel) {
1885
- this.getAllParticipants(this.twilioService.conferenceCallInfo.conferenceSid);
1886
- this.applyFilter();
1887
- }
1888
1880
  }
1889
- else if (index != -1) {
1890
- this.currentCallList[index] = Object.assign(Object.assign({}, res), { img: 'assets/images/user.jpg', isIncomingCall: res.direction == "incoming-call", isHold: res.isHold, isMute: false, isConference: res.isConference, isAcceptCall: res.direction == "incoming-call" ? this.getStatus(res) : true, dial: true, phone: res.direction == "incoming-call" ? res === null || res === void 0 ? void 0 : res.from : res === null || res === void 0 ? void 0 : res.to, participantId: res.id, name: res.name || (res === null || res === void 0 ? void 0 : res.fromName) || (res === null || res === void 0 ? void 0 : res.toName), time: this.getTimeDifference(res.joinedAt || new Date().toUTCString()) });
1881
+ else {
1882
+ this.currentCallList.splice(index, 1);
1891
1883
  }
1892
- if (this.currentCallList.length == 1 && this.currentCallList[0].isHold) {
1893
- setTimeout(() => {
1894
- if (this.currentCallList.length == 1 && this.currentCallList[0].isHold) {
1895
- this.onholdOrUnholdParticipant({
1896
- participantId: [this.currentCallList[0].participantId],
1897
- conferenceId: this.conferenceId,
1898
- hold: false,
1899
- conference: this.currentCallList[0].isConference
1900
- });
1901
- }
1902
- }, 1000);
1884
+ if (this.showContactsPanel) {
1885
+ this.getAllParticipants(this.twilioService.conferenceCallInfo.conferenceSid);
1886
+ this.applyFilter();
1903
1887
  }
1904
1888
  }
1905
- else {
1906
- this.currentCallList.push(Object.assign(Object.assign({}, res), { img: 'assets/images/user.jpg', isIncomingCall: res.direction == "incoming-call", isHold: res.isHold, isMute: false, isConference: res.isConference, isAcceptCall: res.direction == "incoming-call" ? this.getStatus(res) : true, dial: true, phone: res.direction == "incoming-call" ? res === null || res === void 0 ? void 0 : res.from : res === null || res === void 0 ? void 0 : res.to, participantId: res.id, name: res.name || (res === null || res === void 0 ? void 0 : res.fromName) || (res === null || res === void 0 ? void 0 : res.toName), time: this.getTimeDifference(res.joinedAt || new Date().toUTCString()) }));
1907
- this.timer = '00:00';
1908
- this.startTimer();
1909
- }
1910
- }));
1911
- let currentCall = this.currentCallList.find((item) => item.isAcceptCall && !item.isHold);
1912
- if (currentCall === null || currentCall === void 0 ? void 0 : currentCall.id) {
1913
- this.currentCall = currentCall;
1914
- }
1915
- if ((_h = this.selectedUserInfo) === null || _h === void 0 ? void 0 : _h.participantId) {
1916
- let selectedUser = this.currentCallList.find((item) => item.id == this.selectedUserInfo.participantId);
1917
- if (selectedUser) {
1918
- selectedUser.IsUserInfoShow = true;
1919
- this.selectedUserInfo = selectedUser;
1920
- this.checkTextHeight();
1889
+ else if (index != -1) {
1890
+ this.currentCallList[index] = Object.assign(Object.assign({}, res), { img: 'assets/images/user.jpg', isIncomingCall: res.direction == "incoming-call", isHold: res.isHold, isMute: false, isConference: res.isConference, isAcceptCall: res.direction == "incoming-call" ? this.getStatus(res) : true, dial: true, phone: res.direction == "incoming-call" ? res === null || res === void 0 ? void 0 : res.from : res === null || res === void 0 ? void 0 : res.to, participantId: res.id, name: res.name || (res === null || res === void 0 ? void 0 : res.fromName) || (res === null || res === void 0 ? void 0 : res.toName), time: this.getTimeDifference(res.joinedAt || new Date().toUTCString()) });
1921
1891
  }
1922
- else {
1923
- let incomingCall = this.currentCallList.find((item) => item === null || item === void 0 ? void 0 : item.businessNumber);
1924
- if (incomingCall === null || incomingCall === void 0 ? void 0 : incomingCall.participantId) {
1925
- this.selectedUserInfo = incomingCall;
1926
- if (this.isClickExpand) {
1927
- this.checkTextHeight();
1892
+ if (this.currentCallList.length == 1 && this.currentCallList[0].isHold) {
1893
+ setTimeout(() => {
1894
+ if (this.currentCallList.length == 1 && this.currentCallList[0].isHold) {
1895
+ this.onholdOrUnholdParticipant({
1896
+ participantId: [this.currentCallList[0].participantId],
1897
+ conferenceId: this.conferenceId,
1898
+ hold: false,
1899
+ conference: this.currentCallList[0].isConference
1900
+ });
1928
1901
  }
1929
- }
1930
- else {
1931
- this.selectedUserInfo = {};
1932
- this.isClickExpand = false;
1933
- }
1902
+ }, 1000);
1934
1903
  }
1935
1904
  }
1936
1905
  else {
1937
- let resIndex = this.currentCallList.findIndex((item) => !!(item === null || item === void 0 ? void 0 : item.businessNumber));
1938
- if (resIndex > -1) {
1939
- this.isClickExpand = true;
1940
- this.currentCallList[resIndex].IsUserInfoShow = true;
1941
- this.selectedUserInfo = this.currentCallList[resIndex];
1942
- this.checkTextHeight();
1943
- }
1906
+ this.currentCallList.push(Object.assign(Object.assign({}, res), { img: 'assets/images/user.jpg', isIncomingCall: res.direction == "incoming-call", isHold: res.isHold, isMute: false, isConference: res.isConference, isAcceptCall: res.direction == "incoming-call" ? this.getStatus(res) : true, dial: true, phone: res.direction == "incoming-call" ? res === null || res === void 0 ? void 0 : res.from : res === null || res === void 0 ? void 0 : res.to, participantId: res.id, name: res.name || (res === null || res === void 0 ? void 0 : res.fromName) || (res === null || res === void 0 ? void 0 : res.toName), time: this.getTimeDifference(res.joinedAt || new Date().toUTCString()) }));
1907
+ this.timer = '00:00';
1908
+ this.startTimer();
1944
1909
  }
1945
- this.cdr.detectChanges();
1910
+ }));
1911
+ let currentCall = this.currentCallList.find((item) => item.isAcceptCall && !item.isHold);
1912
+ if (currentCall === null || currentCall === void 0 ? void 0 : currentCall.id) {
1913
+ this.currentCall = currentCall;
1946
1914
  }
1947
- else if (!this.newIncomingCallsList.length) {
1948
- this.isConcurrentIncoming = false;
1949
- this.incomingCallDiv = false;
1950
- this.cdr.detectChanges();
1951
- this.currentCallList = [];
1952
- this.currentCall = {};
1953
- this.isCallInProgress = false;
1954
- this.isConferenceCallHold = false;
1955
- this.stopTimer();
1956
- if (this.call) {
1957
- this.call.disconnect();
1915
+ if ((_j = this.selectedUserInfo) === null || _j === void 0 ? void 0 : _j.participantId) {
1916
+ let selectedUser = this.currentCallList.find((item) => item.id == this.selectedUserInfo.participantId);
1917
+ if (selectedUser) {
1918
+ selectedUser.IsUserInfoShow = true;
1919
+ this.selectedUserInfo = selectedUser;
1920
+ this.checkTextHeight();
1921
+ }
1922
+ else {
1923
+ let incomingCall = this.currentCallList.find((item) => item === null || item === void 0 ? void 0 : item.businessNumber);
1924
+ if (incomingCall === null || incomingCall === void 0 ? void 0 : incomingCall.participantId) {
1925
+ this.selectedUserInfo = incomingCall;
1926
+ if (this.isClickExpand) {
1927
+ this.checkTextHeight();
1928
+ }
1929
+ }
1930
+ else {
1931
+ this.selectedUserInfo = {};
1932
+ this.isClickExpand = false;
1933
+ }
1958
1934
  }
1959
- if (this.twilioService.device) {
1960
- this.twilioService.device.disconnectAll();
1935
+ }
1936
+ else {
1937
+ let resIndex = this.currentCallList.findIndex((item) => !!(item === null || item === void 0 ? void 0 : item.businessNumber));
1938
+ if (resIndex > -1) {
1939
+ this.isClickExpand = true;
1940
+ this.currentCallList[resIndex].IsUserInfoShow = true;
1941
+ this.selectedUserInfo = this.currentCallList[resIndex];
1942
+ this.checkTextHeight();
1961
1943
  }
1962
1944
  }
1945
+ this.cdr.detectChanges();
1946
+ console.log('currentCallList', this.currentCallList);
1963
1947
  }
1964
- catch (e) {
1965
- console.log(e);
1948
+ else if (!((_k = this.newIncomingCallsList) === null || _k === void 0 ? void 0 : _k.length)) {
1949
+ this.isConcurrentIncoming = false;
1950
+ this.incomingCallDiv = false;
1951
+ this.cdr.detectChanges();
1952
+ this.currentCallList = [];
1953
+ this.currentCall = {};
1954
+ this.isCallInProgress = false;
1955
+ this.isConferenceCallHold = false;
1956
+ this.stopTimer();
1966
1957
  }
1958
+ // } catch (e) {
1959
+ // console.log(e);
1960
+ // }
1967
1961
  }
1968
1962
  }
1969
1963
  getStatus(res) {
@@ -2165,6 +2159,7 @@ class CallProgressComponent {
2165
2159
  rtcConstraints: { audio: { deviceId: 'default' } },
2166
2160
  });
2167
2161
  console.log('test98998111111', this.call);
2162
+ console.log('testdevice', this.twilioService.device);
2168
2163
  // this.call['callInfo'] = JSON.parse(JSON.stringify(callData));
2169
2164
  this.setupEventListeners();
2170
2165
  });
@@ -2336,13 +2331,13 @@ class CallProgressComponent {
2336
2331
  toggleMute(isConference) {
2337
2332
  var _a;
2338
2333
  return __awaiter(this, void 0, void 0, function* () {
2339
- yield this.onMuteParticipant({
2340
- participantId: [(_a = this.currentCall) === null || _a === void 0 ? void 0 : _a.participantId],
2341
- conferenceId: this.conferenceId,
2342
- mute: !this.isMute,
2343
- });
2334
+ // await this.onMuteParticipant({
2335
+ // participantId: [this.currentCall?.participantId],
2336
+ // conferenceId: this.conferenceId,
2337
+ // mute: !this.isMute,
2338
+ // })
2344
2339
  this.isMute = !this.isMute;
2345
- // this.call?.mute(this.isMute);
2340
+ (_a = this.call) === null || _a === void 0 ? void 0 : _a.mute(this.isMute);
2346
2341
  // if (isConference) {
2347
2342
  this.currentCall.isMute = this.isMute;
2348
2343
  });