@propmix/profet-common-header 3.1.1 → 3.1.2

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.
@@ -29,8 +29,8 @@ import { MatTooltipModule } from '@angular/material/tooltip';
29
29
  import { DomSanitizer } from '@angular/platform-browser';
30
30
  import * as i1$1 from '@angular/router';
31
31
  import { Router } from '@angular/router';
32
- import { getCurrentUser, signOut } from 'aws-amplify/auth';
33
- import { Observable, ReplaySubject, reduce, forkJoin } from 'rxjs';
32
+ import { signOut } from 'aws-amplify/auth';
33
+ import { Observable, ReplaySubject, reduce } from 'rxjs';
34
34
  import * as i10 from '@angular/material/core';
35
35
 
36
36
  class CompanySwitchWarningComponent {
@@ -56,7 +56,7 @@ EndPoints.API_URLS = {
56
56
  getUserCompanies: '/api/profile/getUserCompanies',
57
57
  updateUserCompany: '/api/company/updateUserCompany',
58
58
  fetchCompanyProfile: '/fetchCompanyProfile',
59
- findByEmail: '/api/users/search/findByEmail',
59
+ getUserDetails: '/api/user/getUserInformation',
60
60
  getCompanyList: '/api/user/getUserCompanies',
61
61
  getAppMenu: '/api/user/getAppMenu',
62
62
  updateLastAccessedApplication: '/api/user/updateLastAccessedApplication'
@@ -285,8 +285,8 @@ class CommonHeaderService {
285
285
  return acc;
286
286
  }, {}));
287
287
  }
288
- getUserDetailsByEmail(reqBody) {
289
- let url = `${this.baseUrl + EndPoints.API_URLS.findByEmail + '?' + Utilities.convertObjectToQueryString(reqBody)}`;
288
+ getUserDetails() {
289
+ let url = `${this.baseUrl + EndPoints.API_URLS.getUserDetails}`;
290
290
  return this._apiGatewayService.doGet(url);
291
291
  }
292
292
  getCompanyList() {
@@ -397,7 +397,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImpo
397
397
 
398
398
  class HeaderComponent {
399
399
  constructor() {
400
- this.username = '';
401
400
  this.portalUrl = '';
402
401
  this.userImageLink = null;
403
402
  this.userCompanyLogo = '';
@@ -415,24 +414,34 @@ class HeaderComponent {
415
414
  async ngOnInit() {
416
415
  this.updateLastAccessedAppInfo();
417
416
  this.getCompanyList();
418
- let userInfo = await getCurrentUser();
419
- if (userInfo?.username) {
420
- let userDetails = this._headerSer.getUserDetailsByEmail({
421
- email: userInfo.username,
422
- });
423
- forkJoin([userDetails]).subscribe({
424
- next: (res) => {
425
- if (res && res[0]) {
426
- this.userAuthData = res[0];
427
- this.username = this.userAuthData.firstName;
428
- this.getMenuList();
429
- if (this.userAuthData?._links?.profileImage?.href) {
430
- this.getUserProfile();
431
- }
417
+ this._headerSer.getUserDetails().subscribe({
418
+ next: (res) => {
419
+ if (res) {
420
+ this.userAuthData = res;
421
+ this.getMenuList();
422
+ if (res.profileImage) {
423
+ this.userImageLink = res.profileImage.locationUrl
424
+ ? this._domSanitizer.bypassSecurityTrustUrl(res.profileImage.locationUrl)
425
+ : null;
432
426
  }
433
- },
434
- });
435
- }
427
+ }
428
+ }
429
+ });
430
+ // if (userInfo?.username) {
431
+ // let userDetails = this._headerSer.getUserDetails();
432
+ // forkJoin([userDetails]).subscribe({
433
+ // next: (res) => {
434
+ // if (res && res[0]) {
435
+ // this.userAuthData = res[0];
436
+ // this.username = this.userAuthData.firstName;
437
+ // this.getMenuList();
438
+ // if (this.userAuthData?._links?.profileImage?.href) {
439
+ // this.getUserProfile();
440
+ // }
441
+ // }
442
+ // },
443
+ // });
444
+ // }
436
445
  this.resetTimer();
437
446
  }
438
447
  resetTimer() {
@@ -521,17 +530,6 @@ class HeaderComponent {
521
530
  }
522
531
  });
523
532
  }
524
- getUserProfile() {
525
- this._headerSer
526
- .obtainDataByUrl(this.userAuthData._links.profileImage.href)
527
- .subscribe((img) => {
528
- if (img?.locationUrl) {
529
- this.userImageLink = img.locationUrl
530
- ? this._domSanitizer.bypassSecurityTrustUrl(img.locationUrl)
531
- : null;
532
- }
533
- });
534
- }
535
533
  profile() {
536
534
  if (this._headerSer.headerConfig.appType == PROFET_APPS.profet_portal) {
537
535
  this._router.navigateByUrl('/app/profile');