@vgroup/dialbox 0.0.20 → 0.0.21
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.
|
@@ -2161,7 +2161,6 @@ class DialboxComponent {
|
|
|
2161
2161
|
});
|
|
2162
2162
|
// handle incoming call
|
|
2163
2163
|
const sub2 = this.twilioService.currentCall.subscribe(incomingCallData => {
|
|
2164
|
-
var _a, _b, _c;
|
|
2165
2164
|
// if (incomingCallData) {
|
|
2166
2165
|
// this.isCallInProgress = true;
|
|
2167
2166
|
// this.isDialpadHidden = false;
|
|
@@ -2170,29 +2169,61 @@ class DialboxComponent {
|
|
|
2170
2169
|
// this.callData.img = incomingCallData.customParameters.get('image');
|
|
2171
2170
|
// this.callData.isIncomingCall = true;
|
|
2172
2171
|
// }
|
|
2172
|
+
// if (incomingCallData) {
|
|
2173
|
+
// if (this.isCallInProgress) {
|
|
2174
|
+
// this.newIncomingCalls.push(incomingCallData);
|
|
2175
|
+
// this.getUserInformation(incomingCallData);
|
|
2176
|
+
// } else {
|
|
2177
|
+
// this.isCallInProgress = true;
|
|
2178
|
+
// this.isDialpadHidden = false;
|
|
2179
|
+
// this.callData.phone = (incomingCallData.parameters as any).From;
|
|
2180
|
+
// this.getUserInformation(incomingCallData);
|
|
2181
|
+
// this.callData.name = incomingCallData.customParameters.get('name');
|
|
2182
|
+
// this.callData.img = incomingCallData.customParameters.get('image') || 'assets/images/user.jpg';
|
|
2183
|
+
// this.callData.isIncomingCall = true;
|
|
2184
|
+
// }
|
|
2185
|
+
// incomingCallData.on('cancel', () => {
|
|
2186
|
+
// this.incomingCallsList = this.incomingCallsList.filter((item: any) => item.parameters.CallSid !== (incomingCallData.parameters as any).CallSid);
|
|
2187
|
+
// if(this.incomingCallsList.length == 0){
|
|
2188
|
+
// this.isCallInProgress = false;
|
|
2189
|
+
// }
|
|
2190
|
+
// });
|
|
2191
|
+
// incomingCallData.on('disconnect', () => {
|
|
2192
|
+
// this.incomingCallsList = this.incomingCallsList.filter((item: any) => item.parameters.CallSid !== (incomingCallData.parameters as any).CallSid);
|
|
2193
|
+
// if(this.incomingCallsList.length == 0){
|
|
2194
|
+
// this.isCallInProgress = false;
|
|
2195
|
+
// }
|
|
2196
|
+
// });
|
|
2197
|
+
// }
|
|
2173
2198
|
if (incomingCallData) {
|
|
2174
2199
|
if (this.isCallInProgress) {
|
|
2175
2200
|
this.newIncomingCalls.push(incomingCallData);
|
|
2201
|
+
this.incomingCallsList = [...this.incomingCallsList, incomingCallData]; // Add to incomingCallsList
|
|
2202
|
+
this.incomingCallsNewInfoEvent.emit(this.incomingCallsList); // Emit the updated list
|
|
2176
2203
|
this.getUserInformation(incomingCallData);
|
|
2177
2204
|
}
|
|
2178
2205
|
else {
|
|
2179
2206
|
this.isCallInProgress = true;
|
|
2180
2207
|
this.isDialpadHidden = false;
|
|
2181
|
-
this.callData.phone =
|
|
2182
|
-
this.
|
|
2183
|
-
this.callData.
|
|
2184
|
-
this.callData.img = ((_c = incomingCallData.customParameters) === null || _c === void 0 ? void 0 : _c.get('image')) || 'assets/images/user.jpg';
|
|
2208
|
+
this.callData.phone = incomingCallData.parameters.From;
|
|
2209
|
+
this.callData.name = incomingCallData.customParameters.get('name');
|
|
2210
|
+
this.callData.img = incomingCallData.customParameters.get('image') || 'assets/images/user.jpg';
|
|
2185
2211
|
this.callData.isIncomingCall = true;
|
|
2212
|
+
// Add to incomingCallsList for the first call
|
|
2213
|
+
this.incomingCallsList = [incomingCallData];
|
|
2214
|
+
this.incomingCallsNewInfoEvent.emit(this.incomingCallsList);
|
|
2186
2215
|
}
|
|
2187
2216
|
incomingCallData.on('cancel', () => {
|
|
2188
|
-
this.incomingCallsList = this.incomingCallsList.filter((item) =>
|
|
2189
|
-
|
|
2217
|
+
this.incomingCallsList = this.incomingCallsList.filter((item) => item.parameters.CallSid !== incomingCallData.parameters.CallSid);
|
|
2218
|
+
this.incomingCallsNewInfoEvent.emit(this.incomingCallsList); // Emit on update
|
|
2219
|
+
if (this.incomingCallsList.length === 0) {
|
|
2190
2220
|
this.isCallInProgress = false;
|
|
2191
2221
|
}
|
|
2192
2222
|
});
|
|
2193
2223
|
incomingCallData.on('disconnect', () => {
|
|
2194
|
-
this.incomingCallsList = this.incomingCallsList.filter((item) =>
|
|
2195
|
-
|
|
2224
|
+
this.incomingCallsList = this.incomingCallsList.filter((item) => item.parameters.CallSid !== incomingCallData.parameters.CallSid);
|
|
2225
|
+
this.incomingCallsNewInfoEvent.emit(this.incomingCallsList); // Emit on update
|
|
2226
|
+
if (this.incomingCallsList.length === 0) {
|
|
2196
2227
|
this.isCallInProgress = false;
|
|
2197
2228
|
}
|
|
2198
2229
|
});
|
|
@@ -2232,50 +2263,6 @@ class DialboxComponent {
|
|
|
2232
2263
|
}, 0);
|
|
2233
2264
|
}
|
|
2234
2265
|
}
|
|
2235
|
-
// private registerDragElement() {
|
|
2236
|
-
// try {
|
|
2237
|
-
// const elmnt = document.getElementById('dragparent1');
|
|
2238
|
-
// let pos1 = 0, pos2 = 0, pos3 = 0, pos4 = 0;
|
|
2239
|
-
// const dragMouseDown = (e: any) => {
|
|
2240
|
-
// // If the target is an input, return and don't initiate dragging
|
|
2241
|
-
// if (e.target.tagName.toLowerCase() === 'input') {
|
|
2242
|
-
// return;
|
|
2243
|
-
// }
|
|
2244
|
-
// e = e || window.event;
|
|
2245
|
-
// // get the mouse cursor position at startup:
|
|
2246
|
-
// pos3 = e.clientX;
|
|
2247
|
-
// pos4 = e.clientY;
|
|
2248
|
-
// document.onmouseup = closeDragElement;
|
|
2249
|
-
// // call a function whenever the cursor moves:
|
|
2250
|
-
// document.onmousemove = elementDrag;
|
|
2251
|
-
// };
|
|
2252
|
-
// const elementDrag = (e: any) => {
|
|
2253
|
-
// e = e || window.event;
|
|
2254
|
-
// // calculate the new cursor position:
|
|
2255
|
-
// pos1 = pos3 - e.clientX;
|
|
2256
|
-
// pos2 = pos4 - e.clientY;
|
|
2257
|
-
// pos3 = e.clientX;
|
|
2258
|
-
// pos4 = e.clientY;
|
|
2259
|
-
// // set the element's new position:
|
|
2260
|
-
// elmnt.style.top = elmnt.offsetTop - pos2 + 'px';
|
|
2261
|
-
// elmnt.style.left = elmnt.offsetLeft - pos1 + 'px';
|
|
2262
|
-
// };
|
|
2263
|
-
// const closeDragElement = () => {
|
|
2264
|
-
// /* stop moving when mouse button is released:*/
|
|
2265
|
-
// document.onmouseup = null;
|
|
2266
|
-
// document.onmousemove = null;
|
|
2267
|
-
// };
|
|
2268
|
-
// if (document.getElementById(elmnt.id + 'header')) {
|
|
2269
|
-
// /* if present, the header is where you move the DIV from:*/
|
|
2270
|
-
// document.getElementById(elmnt.id + 'header').onmousedown = dragMouseDown;
|
|
2271
|
-
// } else {
|
|
2272
|
-
// /* otherwise, move the DIV from anywhere inside the DIV:*/
|
|
2273
|
-
// elmnt.onmousedown = dragMouseDown;
|
|
2274
|
-
// }
|
|
2275
|
-
// } catch (e) {
|
|
2276
|
-
// console.log(e)
|
|
2277
|
-
// }
|
|
2278
|
-
// }
|
|
2279
2266
|
registerDragElement() {
|
|
2280
2267
|
try {
|
|
2281
2268
|
const elmnt = document.getElementById('dragparent1');
|
|
@@ -2789,7 +2776,7 @@ class DialboxComponent {
|
|
|
2789
2776
|
});
|
|
2790
2777
|
}
|
|
2791
2778
|
saveLastDialed() {
|
|
2792
|
-
const contact = this.filteredContactList.find(c => c.numbersList.some((n) => n.number === this.dialedNumber));
|
|
2779
|
+
const contact = this.filteredContactList.find((c) => c.numbersList.some((n) => n.number === this.dialedNumber));
|
|
2793
2780
|
if (contact) {
|
|
2794
2781
|
this.lastDialed = {
|
|
2795
2782
|
name: contact.name,
|