ngx-sp-auth 4.22.4 → 4.22.5
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.
package/fesm2022/ngx-sp-auth.mjs
CHANGED
|
@@ -8,7 +8,7 @@ import { LogLevel, PublicClientApplication, InteractionType } from '@azure/msal-
|
|
|
8
8
|
import { take as take$1, tap as tap$1, map, switchMap as switchMap$1 } from 'rxjs/operators';
|
|
9
9
|
import * as i1$1 from '@angular/router';
|
|
10
10
|
import { RouterLink, NavigationEnd, RouterOutlet } from '@angular/router';
|
|
11
|
-
import { BehaviorSubject, take, tap, Subject, Subscription, debounceTime, distinctUntilChanged, filter, switchMap, timer, map as map$1,
|
|
11
|
+
import { BehaviorSubject, take, tap, Subject, firstValueFrom, Subscription, debounceTime, distinctUntilChanged, filter, switchMap, timer, map as map$1, of, lastValueFrom, from } from 'rxjs';
|
|
12
12
|
import * as i3 from 'ngx-sp-infra';
|
|
13
13
|
import { Utils, SearchInputComponent, InfraModule, FormUtils, Usuario, RetPasswordPolicy, RetCheckPassword, CheckPasswordRecord, PasswordPolicyComponent, LibIconsComponent, ContentContainerComponent } from 'ngx-sp-infra';
|
|
14
14
|
import { openDB, deleteDB } from 'idb';
|
|
@@ -1819,6 +1819,21 @@ class MenuServicesService {
|
|
|
1819
1819
|
}
|
|
1820
1820
|
}));
|
|
1821
1821
|
}
|
|
1822
|
+
/**
|
|
1823
|
+
* **ESTE MÉTODO FOI DUPLICADO DO MÉTODO `GetHostServerOutSystems` PARA SER UTILIZADO DE FORMA ASSÍNCRONA, SEM *OBSERVABLE*, PARA EVITAR PROBLEMAS DE SINCRONIA NA CONSTRUÇÃO DO MENU DINÂMICO.**
|
|
1824
|
+
*
|
|
1825
|
+
* Método async executado para pegar o HostName de direcionamento para OS de forma estática, sem Observable.
|
|
1826
|
+
* Este método utiliza a função `firstValueFrom` do RxJS para converter o Observable retornado pelo HttpClient em uma Promise.
|
|
1827
|
+
*
|
|
1828
|
+
* @returns Promise<RetString> - Retorna uma Promise que resolve para um objeto RetString contendo o HostName de direcionamento para OS.
|
|
1829
|
+
* @throws Error - Lança um erro se a resposta da API contiver um erro.
|
|
1830
|
+
*/
|
|
1831
|
+
async getHostServerOutSystemsStatic() {
|
|
1832
|
+
const url = `${this._BASE_URL}/Menu/GetHostServerOutSystems`;
|
|
1833
|
+
const response = await firstValueFrom(this._httpClient.get(url, { headers: this._HTTP_HEADERS }).pipe(take(1), tap(response => { if (response.Error)
|
|
1834
|
+
throw Error(response.ErrorMessage); })));
|
|
1835
|
+
return response;
|
|
1836
|
+
}
|
|
1822
1837
|
getMenuFooterImg() {
|
|
1823
1838
|
const cachedFooterImg = JSON.parse(localStorage.getItem('menuFooterImg'));
|
|
1824
1839
|
if (cachedFooterImg) {
|
|
@@ -3504,8 +3519,8 @@ class MenuLateralComponent {
|
|
|
3504
3519
|
// Método com customizações obter o Módulo para montagem do Menu Dinâmico Lateral
|
|
3505
3520
|
const projetoId = this._customMenuService.menuDynamicGetProjetoId();
|
|
3506
3521
|
this._menuServices.getMenuLateral(projetoId).subscribe({
|
|
3507
|
-
next: response => {
|
|
3508
|
-
const menus = this.constroiRegrasDynamicMenu(response.MenuSubmenu);
|
|
3522
|
+
next: async (response) => {
|
|
3523
|
+
const menus = await this.constroiRegrasDynamicMenu(response.MenuSubmenu);
|
|
3509
3524
|
this._customMenuService.menuItems = this._customMenuService.menuConfig.initializeMenu(this._router.url, menus);
|
|
3510
3525
|
}, error: error => {
|
|
3511
3526
|
this._customMenuService.menuItems = this._customMenuService.menuConfig.initializeMenu(this._router.url);
|
|
@@ -3668,9 +3683,10 @@ class MenuLateralComponent {
|
|
|
3668
3683
|
return url;
|
|
3669
3684
|
return (isOutroModulo ? `https://${window.location.host}/SisproErpCloud/${url}` : `${this.HostServerOutSystems == "" ? `https://${window.location.host}` : this.HostServerOutSystems}/${url}`);
|
|
3670
3685
|
}
|
|
3671
|
-
constroiRegrasDynamicMenu(menus) {
|
|
3686
|
+
async constroiRegrasDynamicMenu(menus) {
|
|
3687
|
+
const hostOutsystems = await this._menuServices.getHostServerOutSystemsStatic();
|
|
3672
3688
|
const home = { id: 0, label: "Início", descricao: "Tela inicial", icon: "casa", route: "home", isExternal: false, isSelected: this._router.url.includes("home"), isOutroModulo: false };
|
|
3673
|
-
const cloud = { id: 1, label: "Ir para a Cloud", descricao: "Cloud OS", icon: "p-nuvem", route:
|
|
3689
|
+
const cloud = { id: 1, label: "Ir para a Cloud", descricao: "Cloud OS", icon: "p-nuvem", route: `${hostOutsystems.String}/SisproErp/`, isExternal: true, isSelected: this._router.url.includes("cloud"), isOutroModulo: true };
|
|
3674
3690
|
menus.unshift(cloud);
|
|
3675
3691
|
menus.unshift(home);
|
|
3676
3692
|
return menus;
|