@vgroup/dialbox 0.6.2-9.30 → 0.6.2-9.31

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.
@@ -1826,83 +1826,86 @@ class CallProgressComponent {
1826
1826
  let numberList = this.callerIdList.map((res) => res.number);
1827
1827
  this.newIncomingCallsList.forEach((callInfo, i) => {
1828
1828
  this.conferenceId = i == 0 ? this.newIncomingCallsList[i].conferenceId : this.conferenceId;
1829
- this.newIncomingCallsList[i].participants.forEach((res) => __awaiter(this, void 0, void 0, function* () {
1830
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
1831
- if ((res === null || res === void 0 ? void 0 : res.to) == 'client' && numberList.includes(res === null || res === void 0 ? void 0 : res.from)) {
1832
- this.hostnumber = res;
1833
- }
1834
- else {
1835
- let contact = {};
1836
- if ((_a = this.contacts) === null || _a === void 0 ? void 0 : _a.length) {
1837
- contact = this.contacts.find((resData) => { var _a; return ((_a = resData === null || resData === void 0 ? void 0 : resData.numbersList[0]) === null || _a === void 0 ? void 0 : _a.number) == (res.direction == "incoming-call" ? res === null || res === void 0 ? void 0 : res.from : res === null || res === void 0 ? void 0 : res.to); });
1829
+ let ourNumber = this.newIncomingCallsList[i].participants.find((resData) => numberList.includes((resData === null || resData === void 0 ? void 0 : resData.from) || (resData === null || resData === void 0 ? void 0 : resData.to)) && !(resData === null || resData === void 0 ? void 0 : resData.isLeft));
1830
+ if (ourNumber === null || ourNumber === void 0 ? void 0 : ourNumber.id) {
1831
+ this.newIncomingCallsList[i].participants.forEach((res) => __awaiter(this, void 0, void 0, function* () {
1832
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
1833
+ if ((res === null || res === void 0 ? void 0 : res.to) == 'c2c_softphone_client' && numberList.includes(res === null || res === void 0 ? void 0 : res.from)) {
1834
+ this.hostnumber = res;
1838
1835
  }
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: res.direction == "incoming-call" ? res === null || res === void 0 ? void 0 : res.toImage : (res === null || res === void 0 ? void 0 : res.fromImage) || (contact === null || contact === void 0 ? void 0 : contact.image) || '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, conferenceSid: callInfo.conferenceSid, 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.currentCall.conferenceSid);
1845
- this.applyFilter();
1846
- }
1836
+ else {
1837
+ let contact = {};
1838
+ if ((_a = this.contacts) === null || _a === void 0 ? void 0 : _a.length) {
1839
+ contact = this.contacts.find((resData) => { var _a; return ((_a = resData === null || resData === void 0 ? void 0 : resData.numbersList[0]) === null || _a === void 0 ? void 0 : _a.number) == (res.direction == "incoming-call" ? res === null || res === void 0 ? void 0 : res.from : res === null || res === void 0 ? void 0 : res.to); });
1847
1840
  }
1848
- else if (index != -1 && res.isLeft) {
1849
- if (((_b = this.currentCallList[index]) === null || _b === void 0 ? void 0 : _b.id) == ((_c = this.currentCall) === null || _c === void 0 ? void 0 : _c.id)) {
1850
- this.currentCallList.splice(index, 1);
1851
- this.currentCall = this.currentCallList.length > 0 ? this.currentCallList[0] : {};
1852
- if (((_d = this.currentCall) === null || _d === void 0 ? void 0 : _d.isHold) && !((_e = this.currentCall) === null || _e === void 0 ? void 0 : _e.isConference)) {
1853
- yield this.onholdOrUnholdParticipant({
1854
- participantId: [(_f = this.currentCall) === null || _f === void 0 ? void 0 : _f.participantId],
1855
- conferenceId: (_g = this.currentCall) === null || _g === void 0 ? void 0 : _g.conferenceId,
1856
- hold: false,
1857
- mute: ((_h = this.currentCall) === null || _h === void 0 ? void 0 : _h.mute) || false,
1858
- conference: (_j = this.currentCall) === null || _j === void 0 ? void 0 : _j.isConference
1859
- });
1841
+ if (this.currentCallList.length > 0) {
1842
+ let index = this.currentCallList.findIndex((item) => item.id == res.id);
1843
+ if (index == -1 && !res.isLeft) {
1844
+ this.currentCallList.push(Object.assign(Object.assign({}, res), { img: res.direction == "incoming-call" ? res === null || res === void 0 ? void 0 : res.toImage : (res === null || res === void 0 ? void 0 : res.fromImage) || (contact === null || contact === void 0 ? void 0 : contact.image) || '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, conferenceSid: callInfo.conferenceSid, 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()) }));
1845
+ if (this.showContactsPanel) {
1846
+ this.getAllParticipants(this.currentCall.conferenceSid);
1847
+ this.applyFilter();
1860
1848
  }
1861
- else if (((_k = this.currentCall) === null || _k === void 0 ? void 0 : _k.isHold) && ((_l = this.currentCall) === null || _l === void 0 ? void 0 : _l.isConference)) {
1862
- let conferenceCalllist = this.currentCallList.filter((item) => { var _a; return item.isConference && item.conferenceId == ((_a = this.currentCall) === null || _a === void 0 ? void 0 : _a.conferenceId); });
1863
- if (conferenceCalllist.length > 0) {
1864
- // await this.onholdOrUnholdParticipant({
1865
- // participantId: conferenceCalllist.map((item: any) => item.participantId),
1866
- // conferenceId: conferenceCalllist[0]?.conferenceId,
1867
- // hold: false,
1868
- // mute: this.currentCall?.mute || false,
1869
- // conference: this.currentCall?.isConference || false
1870
- // });
1849
+ }
1850
+ else if (index != -1 && res.isLeft) {
1851
+ if (((_b = this.currentCallList[index]) === null || _b === void 0 ? void 0 : _b.id) == ((_c = this.currentCall) === null || _c === void 0 ? void 0 : _c.id)) {
1852
+ this.currentCallList.splice(index, 1);
1853
+ this.currentCall = this.currentCallList.length > 0 ? this.currentCallList[0] : {};
1854
+ if (((_d = this.currentCall) === null || _d === void 0 ? void 0 : _d.isHold) && !((_e = this.currentCall) === null || _e === void 0 ? void 0 : _e.isConference)) {
1871
1855
  yield this.onholdOrUnholdParticipant({
1872
- participantId: [(_m = this.hostnumber) === null || _m === void 0 ? void 0 : _m.participantId],
1873
- conferenceId: (_o = this.currentCall) === null || _o === void 0 ? void 0 : _o.conferenceId,
1856
+ participantId: [(_f = this.currentCall) === null || _f === void 0 ? void 0 : _f.participantId],
1857
+ conferenceId: (_g = this.currentCall) === null || _g === void 0 ? void 0 : _g.conferenceId,
1874
1858
  hold: false,
1875
- mute: ((_p = this.currentCall) === null || _p === void 0 ? void 0 : _p.mute) || false,
1876
- conference: (_q = this.currentCall) === null || _q === void 0 ? void 0 : _q.isConference
1859
+ mute: ((_h = this.currentCall) === null || _h === void 0 ? void 0 : _h.mute) || false,
1860
+ conference: (_j = this.currentCall) === null || _j === void 0 ? void 0 : _j.isConference
1877
1861
  });
1878
- this.isConferenceCallHold = false;
1862
+ }
1863
+ else if (((_k = this.currentCall) === null || _k === void 0 ? void 0 : _k.isHold) && ((_l = this.currentCall) === null || _l === void 0 ? void 0 : _l.isConference)) {
1864
+ let conferenceCalllist = this.currentCallList.filter((item) => { var _a; return item.isConference && item.conferenceId == ((_a = this.currentCall) === null || _a === void 0 ? void 0 : _a.conferenceId); });
1865
+ if (conferenceCalllist.length > 0) {
1866
+ // await this.onholdOrUnholdParticipant({
1867
+ // participantId: conferenceCalllist.map((item: any) => item.participantId),
1868
+ // conferenceId: conferenceCalllist[0]?.conferenceId,
1869
+ // hold: false,
1870
+ // mute: this.currentCall?.mute || false,
1871
+ // conference: this.currentCall?.isConference || false
1872
+ // });
1873
+ yield this.onholdOrUnholdParticipant({
1874
+ participantId: [(_m = this.hostnumber) === null || _m === void 0 ? void 0 : _m.participantId],
1875
+ conferenceId: (_o = this.currentCall) === null || _o === void 0 ? void 0 : _o.conferenceId,
1876
+ hold: false,
1877
+ mute: ((_p = this.currentCall) === null || _p === void 0 ? void 0 : _p.mute) || false,
1878
+ conference: (_q = this.currentCall) === null || _q === void 0 ? void 0 : _q.isConference
1879
+ });
1880
+ this.isConferenceCallHold = false;
1881
+ }
1879
1882
  }
1880
1883
  }
1884
+ else {
1885
+ this.currentCallList.splice(index, 1);
1886
+ }
1887
+ if (this.showContactsPanel) {
1888
+ this.getAllParticipants(this.currentCall.conferenceSid);
1889
+ this.applyFilter();
1890
+ }
1881
1891
  }
1882
- else {
1883
- this.currentCallList.splice(index, 1);
1884
- }
1885
- if (this.showContactsPanel) {
1886
- this.getAllParticipants(this.currentCall.conferenceSid);
1887
- this.applyFilter();
1892
+ else if (index != -1) {
1893
+ this.currentCallList[index] = Object.assign(Object.assign({}, res), { img: res.direction == "incoming-call" ? res === null || res === void 0 ? void 0 : res.toImage : (res === null || res === void 0 ? void 0 : res.fromImage) || (contact === null || contact === void 0 ? void 0 : contact.image) || '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, conferenceSid: callInfo.conferenceSid, 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()) });
1888
1894
  }
1889
1895
  }
1890
- else if (index != -1) {
1891
- this.currentCallList[index] = Object.assign(Object.assign({}, res), { img: res.direction == "incoming-call" ? res === null || res === void 0 ? void 0 : res.toImage : (res === null || res === void 0 ? void 0 : res.fromImage) || (contact === null || contact === void 0 ? void 0 : contact.image) || '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, conferenceSid: callInfo.conferenceSid, 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()) });
1892
- }
1893
- }
1894
- else if (!res.isLeft) {
1895
- this.currentCallList.push(Object.assign(Object.assign({}, res), { img: res.direction == "incoming-call" ? res === null || res === void 0 ? void 0 : res.toImage : (res === null || res === void 0 ? void 0 : res.fromImage) || (contact === null || contact === void 0 ? void 0 : contact.image) || '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, conferenceSid: callInfo.conferenceSid, 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()) }));
1896
- if (((_r = this.currentCallList) === null || _r === void 0 ? void 0 : _r.length) == 1) {
1897
- this.currentCall = this.currentCallList[0];
1896
+ else if (!res.isLeft) {
1897
+ this.currentCallList.push(Object.assign(Object.assign({}, res), { img: res.direction == "incoming-call" ? res === null || res === void 0 ? void 0 : res.toImage : (res === null || res === void 0 ? void 0 : res.fromImage) || (contact === null || contact === void 0 ? void 0 : contact.image) || '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, conferenceSid: callInfo.conferenceSid, 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()) }));
1898
+ if (((_r = this.currentCallList) === null || _r === void 0 ? void 0 : _r.length) == 1) {
1899
+ this.currentCall = this.currentCallList[0];
1900
+ }
1901
+ this.timer = '00:00';
1902
+ this.startTimer();
1898
1903
  }
1899
- this.timer = '00:00';
1900
- this.startTimer();
1901
1904
  }
1902
- }
1903
- }));
1904
- this.leftParticipent[callInfo === null || callInfo === void 0 ? void 0 : callInfo.conferenceId] = [...new Map(callInfo === null || callInfo === void 0 ? void 0 : callInfo.participants.filter((item) => (item === null || item === void 0 ? void 0 : item.isLeft) === true).map((item) => [(item === null || item === void 0 ? void 0 : item.direction) == 'outgoing-call' ? (item === null || item === void 0 ? void 0 : item.to) || 'Unknown' : item === null || item === void 0 ? void 0 : item.from, item])).values()
1905
- ];
1905
+ }));
1906
+ this.leftParticipent[callInfo === null || callInfo === void 0 ? void 0 : callInfo.conferenceId] = [...new Map(callInfo === null || callInfo === void 0 ? void 0 : callInfo.participants.filter((item) => (item === null || item === void 0 ? void 0 : item.isLeft) === true).map((item) => [(item === null || item === void 0 ? void 0 : item.direction) == 'outgoing-call' ? (item === null || item === void 0 ? void 0 : item.to) || 'Unknown' : item === null || item === void 0 ? void 0 : item.from, item])).values()
1907
+ ];
1908
+ }
1906
1909
  });
1907
1910
  let validValues = new Set(this.newIncomingCallsList.flatMap((item) => item === null || item === void 0 ? void 0 : item.participants.map((val) => val === null || val === void 0 ? void 0 : val.id)));
1908
1911
  this.currentCallList = this.currentCallList.filter((item) => validValues.has(item === null || item === void 0 ? void 0 : item.participantId));
@@ -4222,16 +4225,16 @@ class DialboxComponent {
4222
4225
  }
4223
4226
  }
4224
4227
  incomingCallNotification(callerInfo) {
4225
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
4228
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t;
4226
4229
  return __awaiter(this, void 0, void 0, function* () {
4227
4230
  let incomingCall = {
4228
- conferenceId: 'no',
4231
+ conferenceId: ((_c = (_b = (_a = this.incomingCallnotification) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.data) === null || _c === void 0 ? void 0 : _c.conferenceId) || 'no',
4229
4232
  isActive: true,
4230
4233
  isIncomingCall: true,
4231
- participantId: (_a = this.incomingCallnotification.data.data) === null || _a === void 0 ? void 0 : _a.participantId,
4234
+ participantId: (_d = this.incomingCallnotification.data.data) === null || _d === void 0 ? void 0 : _d.participantId,
4232
4235
  participants: [
4233
- { direction: "incoming-call", businessNumber: ((_b = this.incomingCallnotification.data.data) === null || _b === void 0 ? void 0 : _b.c2cBusiness) == 'true' ? true : false, img: ((_c = this.incomingCallnotification.data.data) === null || _c === void 0 ? void 0 : _c.fromImage) || ((_d = this.incomingCallnotification.data.data) === null || _d === void 0 ? void 0 : _d.image) || 'assets/images/user.jpg', isIncomingCall: true, isHold: false, isConference: false, isAcceptCall: false, dial: true, phone: (_e = this.incomingCallnotification.data.data) === null || _e === void 0 ? void 0 : _e.fromNumber, to: (_f = this.incomingCallnotification.data.data) === null || _f === void 0 ? void 0 : _f.toNumber,
4234
- from: (_g = this.incomingCallnotification.data.data) === null || _g === void 0 ? void 0 : _g.fromNumber, fromName: (_h = this.incomingCallnotification.data.data) === null || _h === void 0 ? void 0 : _h.fromName, participantId: (_j = this.incomingCallnotification.data.data) === null || _j === void 0 ? void 0 : _j.participantId, name: (_k = this.incomingCallnotification.data.data) === null || _k === void 0 ? void 0 : _k.fromName, time: '', id: (_l = this.incomingCallnotification.data.data) === null || _l === void 0 ? void 0 : _l.participantId }
4236
+ { direction: "incoming-call", businessNumber: ((_e = this.incomingCallnotification.data.data) === null || _e === void 0 ? void 0 : _e.c2cBusiness) == 'true' ? true : false, img: ((_f = this.incomingCallnotification.data.data) === null || _f === void 0 ? void 0 : _f.fromImage) || ((_g = this.incomingCallnotification.data.data) === null || _g === void 0 ? void 0 : _g.image) || 'assets/images/user.jpg', isIncomingCall: true, isHold: false, isConference: false, isAcceptCall: false, dial: true, phone: (_h = this.incomingCallnotification.data.data) === null || _h === void 0 ? void 0 : _h.fromNumber, to: (_j = this.incomingCallnotification.data.data) === null || _j === void 0 ? void 0 : _j.toNumber,
4237
+ from: (_k = this.incomingCallnotification.data.data) === null || _k === void 0 ? void 0 : _k.fromNumber, fromName: (_l = this.incomingCallnotification.data.data) === null || _l === void 0 ? void 0 : _l.fromName, participantId: (_m = this.incomingCallnotification.data.data) === null || _m === void 0 ? void 0 : _m.participantId, name: (_o = this.incomingCallnotification.data.data) === null || _o === void 0 ? void 0 : _o.fromName, time: '', id: (_p = this.incomingCallnotification.data.data) === null || _p === void 0 ? void 0 : _p.participantId, conferenceId: (_s = (_r = (_q = this.incomingCallnotification) === null || _q === void 0 ? void 0 : _q.data) === null || _r === void 0 ? void 0 : _r.data) === null || _s === void 0 ? void 0 : _s.conferenceId }
4235
4238
  ],
4236
4239
  };
4237
4240
  this.notificationCallList = yield this.notificationCallList.filter((res) => (res === null || res === void 0 ? void 0 : res.endTime) > (new Date().getTime()));
@@ -4253,7 +4256,7 @@ class DialboxComponent {
4253
4256
  this.notificationCallList.push(incomingCall);
4254
4257
  this.incomingCallsList = [...this.incomingCallsList, ...this.notificationCallList];
4255
4258
  this.cdk.detectChanges();
4256
- if ((_m = this.incomingCallnotification.data.data) === null || _m === void 0 ? void 0 : _m.participantId) {
4259
+ if ((_t = this.incomingCallnotification.data.data) === null || _t === void 0 ? void 0 : _t.participantId) {
4257
4260
  this.isCallInProgress = true;
4258
4261
  this.cdk.detectChanges();
4259
4262
  this.isDialpadHidden = false;