@vgroup/dialbox 0.1.99 → 0.1.101

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.
@@ -2,7 +2,7 @@ import * as i0 from '@angular/core';
2
2
  import { Injectable, EventEmitter, Component, Input, Output, ViewChild, Inject, NgModule } from '@angular/core';
3
3
  import swal from 'sweetalert2';
4
4
  import { AsYouType } from 'libphonenumber-js';
5
- import { throwError, BehaviorSubject, forkJoin, of, interval, Subscription } from 'rxjs';
5
+ import { throwError, BehaviorSubject, of, interval, Subscription } from 'rxjs';
6
6
  import * as i1 from '@angular/common/http';
7
7
  import { HttpHeaders, HttpParams, HttpClientModule } from '@angular/common/http';
8
8
  import { catchError, switchMap, map, tap, shareReplay } from 'rxjs/operators';
@@ -535,38 +535,6 @@ class ExtensionService {
535
535
  const httpOptions = { headers: new HttpHeaders(params) };
536
536
  return this.http.put(environment.apiUrl + '/utilities/softphone/update/callerid/label', dtModel, httpOptions);
537
537
  }
538
- // initiateCall(payload: any): Observable<any> {
539
- // return this.fetchBlockedCountries().pipe(
540
- // switchMap(blockedCountries => {
541
- // return this.ipAddressService.getIpAddressInfo().pipe(
542
- // switchMap(ipAddressInfo => {
543
- // const params = {
544
- // 'Content-Type': 'application/json',
545
- // 'Auth-Key': 'Bearer ' + localStorage.getItem('ext_token'),
546
- // 'ip-address': ipAddressInfo.ip,
547
- // 'ip-country': ipAddressInfo.address.country,
548
- // };
549
- // payload = {...payload, proxy:ipAddressInfo.proxy.toString()}
550
- // const httpOptions = { headers: new HttpHeaders(params) };
551
- // return this.http.post<[]>(environment.apiUrl + '/utilities/ext/ur/initiate/call', payload, httpOptions).pipe(
552
- // catchError(error => {
553
- // return throwError(error);
554
- // }),
555
- // );
556
- // return this.http.post<[]>(environment.apiUrl + '/ur/initiate/conference/call', payload, httpOptions).pipe(
557
- // catchError(error => {
558
- // return throwError(error);
559
- // }),
560
- // );
561
- // }),
562
- // catchError(error => {
563
- // // Catch error from getIpAddressInfo
564
- // return throwError(error);
565
- // })
566
- // );
567
- // })
568
- // );
569
- // }
570
538
  initiateCall(payload) {
571
539
  return this.fetchBlockedCountries().pipe(switchMap(blockedCountries => {
572
540
  return this.ipAddressService.getIpAddressInfo().pipe(switchMap(ipAddressInfo => {
@@ -576,20 +544,57 @@ class ExtensionService {
576
544
  'ip-address': ipAddressInfo.ip,
577
545
  'ip-country': ipAddressInfo.address.country,
578
546
  };
579
- const params1 = {
580
- "from": payload.from,
581
- "to": payload.to,
582
- "userId": payload.userId
583
- };
584
547
  payload = { ...payload, proxy: ipAddressInfo.proxy.toString() };
585
548
  const httpOptions = { headers: new HttpHeaders(params) };
586
- const api1$ = this.http.post(`${environment.apiUrl}/utilities/ext/ur/initiate/call`, payload, httpOptions);
587
- const api2$ = this.http.post(`${environment.apiUrl}/ur/initiate/conference/call`, params1, httpOptions);
588
- // Run both requests in parallel
589
- return forkJoin([api1$, api2$]).pipe(catchError(error => throwError(() => error)));
590
- }), catchError(error => throwError(() => error)));
549
+ return this.http.post(environment.apiUrl + '/utilities/ext/ur/initiate/call', payload, httpOptions).pipe(catchError(error => {
550
+ return throwError(error);
551
+ }));
552
+ return this.http.post(environment.apiUrl + '/ur/initiate/conference/call', payload, httpOptions).pipe(catchError(error => {
553
+ return throwError(error);
554
+ }));
555
+ }), catchError(error => {
556
+ // Catch error from getIpAddressInfo
557
+ return throwError(error);
558
+ }));
591
559
  }));
592
560
  }
561
+ // initiateCall(payload: any): Observable<any> {
562
+ // return this.fetchBlockedCountries().pipe(
563
+ // switchMap(blockedCountries => {
564
+ // return this.ipAddressService.getIpAddressInfo().pipe(
565
+ // switchMap(ipAddressInfo => {
566
+ // const params = {
567
+ // 'Content-Type': 'application/json',
568
+ // 'Auth-Key': 'Bearer ' + localStorage.getItem('ext_token'),
569
+ // 'ip-address': ipAddressInfo.ip,
570
+ // 'ip-country': ipAddressInfo.address.country,
571
+ // };
572
+ // const params1 = {
573
+ // "from": payload.from,
574
+ // "to": payload.to,
575
+ // "userId": payload.userId
576
+ // };
577
+ // payload = { ...payload, proxy: ipAddressInfo.proxy.toString() };
578
+ // const httpOptions = { headers: new HttpHeaders(params) };
579
+ // const api1$ = this.http.post(
580
+ // `${environment.apiUrl}/utilities/ext/ur/initiate/call`,
581
+ // payload,
582
+ // httpOptions
583
+ // );
584
+ // const api2$ = this.http.post(
585
+ // `${environment.apiUrl}/ur/initiate/conference/call`,
586
+ // params1,
587
+ // httpOptions
588
+ // );
589
+ // return forkJoin([api1$, api2$]).pipe(
590
+ // catchError(error => throwError(() => error))
591
+ // );
592
+ // }),
593
+ // catchError(error => throwError(() => error))
594
+ // );
595
+ // })
596
+ // );
597
+ // }
593
598
  fetchBlockedCountries() {
594
599
  return this.http.get(environment.apiUrl + '/global/master/ur/blacklisted/countrylist').pipe(map(response => {
595
600
  if (response.response === 'Success' && Array.isArray(response.countries)) {
@@ -1903,6 +1908,14 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImpo
1903
1908
  }] } });
1904
1909
 
1905
1910
  class CallProgressComponent {
1911
+ // contacts: any[] = [
1912
+ // { name: 'Pamela Cox', title: 'Product Designer', img: 'assets/images/user.jpg' },
1913
+ // { name: 'Roger S. Wood', title: 'JavaScript Programmer', img: 'assets/images/user.jpg' },
1914
+ // { name: 'Victor Blackston', title: 'Database Administrator', img: 'assets/images/user.jpg' },
1915
+ // { name: 'Tammy Rios', title: 'Support', img: 'assets/images/user.jpg' },
1916
+ // { name: 'Carlos Henderson', title: 'Software Architect', img: 'assets/images/user.jpg' },
1917
+ // { name: 'Elizabeth Bailey', title: 'HR', img: 'assets/images/user.jpg' }
1918
+ // ];
1906
1919
  constructor(extensionService, cdr, twilioService) {
1907
1920
  this.extensionService = extensionService;
1908
1921
  this.cdr = cdr;
@@ -1932,14 +1945,7 @@ class CallProgressComponent {
1932
1945
  this.showContactsPanel = false;
1933
1946
  this.isConcurrentIncoming = false;
1934
1947
  this.isCallOnHold = false;
1935
- this.contacts = [
1936
- { name: 'Pamela Cox', title: 'Product Designer', img: 'assets/images/user.jpg' },
1937
- { name: 'Roger S. Wood', title: 'JavaScript Programmer', img: 'assets/images/user.jpg' },
1938
- { name: 'Victor Blackston', title: 'Database Administrator', img: 'assets/images/user.jpg' },
1939
- { name: 'Tammy Rios', title: 'Support', img: 'assets/images/user.jpg' },
1940
- { name: 'Carlos Henderson', title: 'Software Architect', img: 'assets/images/user.jpg' },
1941
- { name: 'Elizabeth Bailey', title: 'HR', img: 'assets/images/user.jpg' }
1942
- ];
1948
+ this.contacts = [];
1943
1949
  this.isMinimised = false;
1944
1950
  console.log('Call Progress Component');
1945
1951
  }
@@ -2024,6 +2030,13 @@ class CallProgressComponent {
2024
2030
  // this.isRecording = false;
2025
2031
  // }, 3000);
2026
2032
  }
2033
+ GetContactsList() {
2034
+ const token = localStorage.getItem('ext_token') || '';
2035
+ this.extensionService.readContacts(token).subscribe((res) => {
2036
+ this.contacts = res;
2037
+ console.log(this.contacts, 'contacts');
2038
+ });
2039
+ }
2027
2040
  async startCall(callData) {
2028
2041
  try {
2029
2042
  this.showRingAnimation = true;
@@ -2196,6 +2209,7 @@ class CallProgressComponent {
2196
2209
  }
2197
2210
  toggleContactsPanel() {
2198
2211
  this.showContactsPanel = !this.showContactsPanel;
2212
+ this.GetContactsList();
2199
2213
  }
2200
2214
  callContact(contact) {
2201
2215
  }