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