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