ngx-sp-auth 3.0.1 → 3.0.3

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.
@@ -5,16 +5,16 @@ import { HTTP_INTERCEPTORS, HttpClient, HttpHeaders, HttpParams } from '@angular
5
5
  import * as i1$2 from '@azure/msal-angular';
6
6
  import { MsalInterceptor, MsalGuard, MsalModule, MSAL_GUARD_CONFIG } from '@azure/msal-angular';
7
7
  import { LogLevel, PublicClientApplication, InteractionType } from '@azure/msal-browser';
8
- import { BehaviorSubject, take, tap, Subscription, timer, map as map$1, Subject, filter, of, lastValueFrom, from } from 'rxjs';
8
+ import { take as take$1, tap as tap$1, map, switchMap } from 'rxjs/operators';
9
+ import * as i1$1 from '@angular/router';
10
+ import { RouterLink, NavigationEnd, RouterOutlet } from '@angular/router';
11
+ import { BehaviorSubject, take, tap, Subject, Subscription, timer, map as map$1, filter, of, lastValueFrom, from } from 'rxjs';
9
12
  import * as i3 from 'ngx-sp-infra';
10
13
  import { Utils, FormUtils, InfraModule } from 'ngx-sp-infra';
11
14
  import * as i3$2 from '@angular/common';
12
15
  import { CommonModule, NgIf } from '@angular/common';
13
16
  import * as i3$1 from '@angular/forms';
14
17
  import { Validators, ReactiveFormsModule } from '@angular/forms';
15
- import * as i1$1 from '@angular/router';
16
- import { RouterLink, NavigationEnd, RouterOutlet } from '@angular/router';
17
- import { take as take$1, tap as tap$1, map, switchMap } from 'rxjs/operators';
18
18
  import * as i8 from '@angular/platform-browser';
19
19
  import * as i10 from 'ngx-toastr';
20
20
  import * as i12 from 'ngx-bootstrap/popover';
@@ -104,113 +104,19 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImpo
104
104
  }]
105
105
  }] });
106
106
 
107
- class LibCustomLoginService {
108
- constructor() {
109
- // #region Propriedade Customizadas para o Componente login.component.ts
110
- this.loginTitle = "";
111
- this.loginSubtitle = "";
112
- this.loginBackground = "";
113
- this.loginLogotipo = "";
114
- this.loginAltLogotipo = "";
115
- this.loginPageTitle = "";
116
- this.loginDesenvDomain = "";
117
- this.loginDesenvUser = "";
118
- this.loginDesenvPassword = "";
119
- }
120
- // #endregion Propriedade Customizadas para o Componente login.component.ts
121
- // #region Métodos Customizadas para o Componente auth.service.ts
122
- /**
123
- * Método executado no auth.service.ts - método: login ()
124
- * Utilizado para inicializações diversas
125
- */
126
- authLogin() {
127
- this.storedAuthLogin();
128
- }
129
- /**
130
- * Método executado no auth.service.ts - método: logout ()
131
- * Utilizado para inicializações diversas
132
- */
133
- authLogout() {
134
- this.storedAuthLogout();
135
- }
136
- /**
137
- * Método executado no auth.service.ts - método: login ()
138
- * Utilizado para informar o redirecionamento para a tela inicial após o login ok
139
- *
140
- * @param router Objeto de Router que será utilizado
141
- */
142
- authNavigateToPage(router) {
143
- this.storedAuthNavigateToPage(router);
144
- }
145
- // #endregion Métodos recebidos do projeto
146
- // #region Métodos Publicos
147
- ConfigurarCustomLogin(customLoginService) {
148
- //passando propriedades do projeto para a lib
149
- this.loginTitle = customLoginService.loginTitle;
150
- this.loginSubtitle = customLoginService.loginSubtitle;
151
- this.loginBackground = customLoginService.loginBackground;
152
- this.loginLogotipo = customLoginService.loginLogotipo;
153
- this.loginAltLogotipo = customLoginService.loginAltLogotipo;
154
- this.loginPageTitle = customLoginService.loginPageTitle;
155
- this.loginDesenvDomain = customLoginService.loginDesenvDomain;
156
- this.loginDesenvUser = customLoginService.loginDesenvUser;
157
- this.loginDesenvPassword = customLoginService.loginDesenvPassword;
158
- //passando implementação dos métodos do projeto para a lib
159
- this.storedAuthLogin = customLoginService.authLogin;
160
- this.storedAuthLogout = customLoginService.authLogout;
161
- this.storedAuthNavigateToPage = customLoginService.authNavigateToPage;
162
- }
163
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: LibCustomLoginService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
164
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: LibCustomLoginService, providedIn: 'root' }); }
165
- }
166
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: LibCustomLoginService, decorators: [{
167
- type: Injectable,
168
- args: [{ providedIn: 'root' }]
169
- }], ctorParameters: () => [] });
107
+ var InfraInAuthTypeId;
108
+ (function (InfraInAuthTypeId) {
109
+ InfraInAuthTypeId[InfraInAuthTypeId["Local"] = 1] = "Local";
110
+ InfraInAuthTypeId[InfraInAuthTypeId["Azure"] = 2] = "Azure";
111
+ InfraInAuthTypeId[InfraInAuthTypeId["LDAP"] = 3] = "LDAP";
112
+ })(InfraInAuthTypeId || (InfraInAuthTypeId = {}));
170
113
 
171
- /**Service responsável por pegar as opções do menu do projeto em que está sendo utilizada*/
172
- class LibMenuConfigService {
173
- constructor() {
174
- this.menu = [];
175
- this.menuDropdown = [];
176
- }
177
- /** Inicializa as opções do menu com base na rota atual e em uma lista personalizada (opcional).
178
- * @param currentRoute A rota atual da aplicação
179
- * @param customList Uma lista personalizada de opções de menu (opcional).
180
- * @returns As opções do menu inicializadas.
181
- */
182
- initializeMenu(currentRoute, customList) {
183
- this.menu = this.storedInitializeMenu(currentRoute, customList);
184
- return this.menu;
185
- }
186
- setMenuType(isStaticMenu) {
187
- this.storedSetMenuType(isStaticMenu);
188
- }
189
- updateRouteSelection(currentRoute, currentList) {
190
- return this.updateRouteSelection(currentRoute, currentList);
191
- }
192
- /** Inicializa as opções do menu dropdown com base em uma lista personalizada (opcional).
193
- * @param primaryDropdownList Uma lista personalizada de opções do dropdown (opcional).
194
- * @returns As opções do dropdown inicializadas.
195
- */
196
- initializeMenuDropdown(primaryDropdownList) {
197
- this.menuDropdown = this.storedInitializeMenuDropdown(primaryDropdownList);
198
- return this.menuDropdown;
199
- }
200
- ConfigurarMenuConfig(menuConfig) {
201
- //passando implementação dos métodos do projeto para a lib
202
- this.storedInitializeMenu = menuConfig.initializeMenu;
203
- this.storedInitializeMenuDropdown = menuConfig.initializeMenuDropdown;
204
- this.storedSetMenuType = menuConfig.setMenuType;
205
- this.updateRouteSelection = menuConfig.updateRouteSelection;
206
- }
207
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: LibMenuConfigService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
208
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: LibMenuConfigService, providedIn: 'root' }); }
209
- }
210
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: LibMenuConfigService, decorators: [{
211
- type: Injectable,
212
- args: [{ providedIn: 'root' }]
213
- }] });
114
+ var InfraIn2FaTypeId;
115
+ (function (InfraIn2FaTypeId) {
116
+ InfraIn2FaTypeId[InfraIn2FaTypeId["Email"] = 1] = "Email";
117
+ InfraIn2FaTypeId[InfraIn2FaTypeId["Google"] = 2] = "Google";
118
+ InfraIn2FaTypeId[InfraIn2FaTypeId["Microsoft"] = 3] = "Microsoft";
119
+ })(InfraIn2FaTypeId || (InfraIn2FaTypeId = {}));
214
120
 
215
121
  class LibCustomStorageService {
216
122
  constructor() { }
@@ -725,101 +631,69 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImpo
725
631
  args: [{ providedIn: 'root' }]
726
632
  }], ctorParameters: () => [{ type: i1.HttpBackend }, { type: LibCustomStorageService }, { type: EnvironmentService }] });
727
633
 
728
- class LibCustomMenuService {
729
- /** Obtém as opções do menu. */
730
- get menuItems() {
731
- return this._menuItems;
732
- }
733
- set menuItems(value) {
734
- this._menuItems = value;
735
- }
736
- setEmpresa(value) { this.empresaId.next(value); }
737
- // ! Definição do BehaviorSubject: responsável principal da emissão do evento
738
- // #endregion Propriedade do Menu
739
- constructor(_menuConfig, _authStorageService) {
740
- this._menuConfig = _menuConfig;
741
- this._authStorageService = _authStorageService;
742
- // #region Propriedade Customizadas do Menu
743
- this.menuDynamic = false;
744
- this.menuDynamicCustom = false;
745
- this.moduleName = "";
746
- this.moduleImg = "";
747
- this.moduleSvg = "";
748
- this.themeColor = "";
749
- // #endregion Propriedade Customizadas do Menu
750
- // #region Propriedade do Menu
751
- this._menuItems = [];
752
- // ! Definição do BehaviorSubject: responsável principal da emissão do evento
753
- this.empresaId = new BehaviorSubject({ estabelecimentoID: "", empresaID: "" });
754
- this.applyEmpresa$ = this.empresaId.asObservable();
755
- // inicializações do Menu Dinâmico
756
- this.menuConfig = _menuConfig;
757
- }
758
- // #region - Métodos Customizadas para o Menu dinâmico
759
- // Método executado no menu-lateral.component.ts - método: onInit ()
760
- // Utilizado para obter o Módulo para montagem do Menu Dinâmico Lateral
761
- menuDynamicGetModuloId() {
762
- return this.storeMenuDynamicGetModuloId();
763
- }
764
- // Método executado no menu-lateral.component.ts - método: onInit ()
765
- // Utilizado para inicializações diversas
766
- menuDynamicOnInit() {
767
- this.storedMenuDynamicOnInit();
634
+ class LibCustomLoginService {
635
+ constructor() {
636
+ // #region Propriedade Customizadas para o Componente login.component.ts
637
+ this.loginTitle = "";
638
+ this.loginSubtitle = "";
639
+ this.loginBackground = "";
640
+ this.loginLogotipo = "";
641
+ this.loginAltLogotipo = "";
642
+ this.loginPageTitle = "";
643
+ this.loginDesenvDomain = "";
644
+ this.loginDesenvUser = "";
645
+ this.loginDesenvPassword = "";
768
646
  }
769
- // Método executado no menu-lateral.component.ts - método: onInit ()
770
- // Utilizado para inicializações diversas
771
- menuStaticOnInit() {
772
- this.storedMenuStaticOnInit();
647
+ // #endregion Propriedade Customizadas para o Componente login.component.ts
648
+ // #region Métodos Customizadas para o Componente auth.service.ts
649
+ /**
650
+ * Método executado no auth.service.ts - método: login ()
651
+ * Utilizado para inicializações diversas
652
+ */
653
+ authLogin() {
654
+ this.storedAuthLogin();
773
655
  }
774
- // Método executado no menu-lateral.component.ts - método: openExpansibleMenu()
775
- // Utilizado para inicializações ao Expandir a opção de Menu
776
- menuopenExpansibleMenu(ref) {
777
- this.storedMenuopenExpansibleMenu(ref);
656
+ /**
657
+ * Método executado no auth.service.ts - método: logout ()
658
+ * Utilizado para inicializações diversas
659
+ */
660
+ authLogout() {
661
+ this.storedAuthLogout();
778
662
  }
779
- /** Método que deve ser chamado na seleção de um novo estabelecimento, ele atualizará os valores do nosso BehaviorSubject para que possamos utilizá-lo em outras partes do sistema. */
780
- emitEstabelecimentoEvent() {
781
- this.setEmpresa({
782
- estabelecimentoID: this._authStorageService.infraEstabId,
783
- empresaID: this._authStorageService.infraEmpresaId
784
- });
663
+ /**
664
+ * Método executado no auth.service.ts - método: login ()
665
+ * Utilizado para informar o redirecionamento para a tela inicial após o login ok
666
+ *
667
+ * @param router Objeto de Router que será utilizado
668
+ */
669
+ authNavigateToPage(router) {
670
+ this.storedAuthNavigateToPage(router);
785
671
  }
786
672
  // #endregion Métodos recebidos do projeto
787
673
  // #region Métodos Publicos
788
- ConfigurarCustomMenuService(RealcustomMenuService) {
674
+ ConfigurarCustomLogin(customLoginService) {
789
675
  //passando propriedades do projeto para a lib
790
- this.menuDynamic = RealcustomMenuService.menuDynamic;
791
- this.menuDynamicCustom = RealcustomMenuService.menuDynamicCustom;
792
- this.moduleName = RealcustomMenuService.moduleName;
793
- this.moduleImg = RealcustomMenuService.moduleImg;
794
- this.moduleSvg = RealcustomMenuService.moduleSvg;
795
- this.themeColor = RealcustomMenuService.themeColor;
676
+ this.loginTitle = customLoginService.loginTitle;
677
+ this.loginSubtitle = customLoginService.loginSubtitle;
678
+ this.loginBackground = customLoginService.loginBackground;
679
+ this.loginLogotipo = customLoginService.loginLogotipo;
680
+ this.loginAltLogotipo = customLoginService.loginAltLogotipo;
681
+ this.loginPageTitle = customLoginService.loginPageTitle;
682
+ this.loginDesenvDomain = customLoginService.loginDesenvDomain;
683
+ this.loginDesenvUser = customLoginService.loginDesenvUser;
684
+ this.loginDesenvPassword = customLoginService.loginDesenvPassword;
796
685
  //passando implementação dos métodos do projeto para a lib
797
- this.storeMenuDynamicGetModuloId = RealcustomMenuService.menuDynamicGetModuloId;
798
- this.storedMenuStaticOnInit = RealcustomMenuService.menuStaticOnInit;
799
- this.storedMenuopenExpansibleMenu = RealcustomMenuService.menuopenExpansibleMenu;
800
- this.storedMenuDynamicOnInit = RealcustomMenuService.menuDynamicOnInit;
686
+ this.storedAuthLogin = customLoginService.authLogin;
687
+ this.storedAuthLogout = customLoginService.authLogout;
688
+ this.storedAuthNavigateToPage = customLoginService.authNavigateToPage;
801
689
  }
802
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: LibCustomMenuService, deps: [{ token: LibMenuConfigService }, { token: AuthStorageService }], target: i0.ɵɵFactoryTarget.Injectable }); }
803
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: LibCustomMenuService, providedIn: 'root' }); }
690
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: LibCustomLoginService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
691
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: LibCustomLoginService, providedIn: 'root' }); }
804
692
  }
805
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: LibCustomMenuService, decorators: [{
693
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: LibCustomLoginService, decorators: [{
806
694
  type: Injectable,
807
695
  args: [{ providedIn: 'root' }]
808
- }], ctorParameters: () => [{ type: LibMenuConfigService }, { type: AuthStorageService }] });
809
-
810
- var InfraInAuthTypeId;
811
- (function (InfraInAuthTypeId) {
812
- InfraInAuthTypeId[InfraInAuthTypeId["Local"] = 1] = "Local";
813
- InfraInAuthTypeId[InfraInAuthTypeId["Azure"] = 2] = "Azure";
814
- InfraInAuthTypeId[InfraInAuthTypeId["LDAP"] = 3] = "LDAP";
815
- })(InfraInAuthTypeId || (InfraInAuthTypeId = {}));
816
-
817
- var InfraIn2FaTypeId;
818
- (function (InfraIn2FaTypeId) {
819
- InfraIn2FaTypeId[InfraIn2FaTypeId["Email"] = 1] = "Email";
820
- InfraIn2FaTypeId[InfraIn2FaTypeId["Google"] = 2] = "Google";
821
- InfraIn2FaTypeId[InfraIn2FaTypeId["Microsoft"] = 3] = "Microsoft";
822
- })(InfraIn2FaTypeId || (InfraIn2FaTypeId = {}));
696
+ }], ctorParameters: () => [] });
823
697
 
824
698
  class ProjectUtilservice {
825
699
  constructor(router, authStorageService, checkUrlAndMethodService, messageService, _environmentService) {
@@ -1330,18 +1204,334 @@ class AuthService {
1330
1204
  setPendingWarning(message) {
1331
1205
  this._pendingWarning = message;
1332
1206
  }
1333
- consumePendingWarning() {
1334
- const message = this._pendingWarning;
1335
- this._pendingWarning = null;
1336
- return message;
1207
+ consumePendingWarning() {
1208
+ const message = this._pendingWarning;
1209
+ this._pendingWarning = null;
1210
+ return message;
1211
+ }
1212
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: AuthService, deps: [{ token: i1.HttpClient }, { token: i1$1.Router }, { token: AuthStorageService }, { token: i3.IpServiceService }, { token: LibCustomLoginService }, { token: ProjectUtilservice }, { token: EnvironmentService }], target: i0.ɵɵFactoryTarget.Injectable }); }
1213
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: AuthService, providedIn: 'root' }); }
1214
+ }
1215
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: AuthService, decorators: [{
1216
+ type: Injectable,
1217
+ args: [{ providedIn: 'root' }]
1218
+ }], ctorParameters: () => [{ type: i1.HttpClient }, { type: i1$1.Router }, { type: AuthStorageService }, { type: i3.IpServiceService }, { type: LibCustomLoginService }, { type: ProjectUtilservice }, { type: EnvironmentService }] });
1219
+
1220
+ class MenuServicesService {
1221
+ constructor(_authStorageService, _httpClient, _environmentService) {
1222
+ this._authStorageService = _authStorageService;
1223
+ this._httpClient = _httpClient;
1224
+ this._environmentService = _environmentService;
1225
+ this._BASE_URL = ""; // SpInfra2AplicWS
1226
+ this._HTTP_HEADERS = new HttpHeaders().set('Content-Type', 'application/json');
1227
+ // #endregion Menu Dinâmico
1228
+ // #endregion ==========> SERVICES <==========
1229
+ // #region ==========> UTILITIES <==========
1230
+ this._menuFooterImg = null;
1231
+ // #region NewImg Event
1232
+ // Implementação de lógica vista no link: https://hasangalakdinu.medium.com/how-to-call-a-function-in-another-component-angular-using-rxjs-3f2e85920705
1233
+ this._subject = new Subject();
1234
+ this._BASE_URL = `${this._environmentService.SpInfra2ErpWS}`; // SpInfra2ErpWS
1235
+ this._BASE_URL = !this._environmentService.production ? this._BASE_URL : `${this._environmentService.SpInfra2ErpWS}`;
1236
+ }
1237
+ // #region ==========> SERVICES <==========
1238
+ // #region PREPARATION
1239
+ // #region Menu: Usuário
1240
+ // [...]
1241
+ // #endregion Menu: Usuário
1242
+ // #region Menu: Estabelecimentos
1243
+ getEstabelecimentosModalList(usuarioID, pesquisa) {
1244
+ const params = new HttpParams()
1245
+ .set('pesquisa', pesquisa);
1246
+ const headers = new HttpHeaders()
1247
+ .set('Content-Type', 'application/json');
1248
+ const url = `${this._BASE_URL}/InfraEstabelecimento/GetEstabelecimentosModal`;
1249
+ return this._httpClient
1250
+ .get(url, { 'params': params, 'headers': headers })
1251
+ .pipe(take(1), tap(response => {
1252
+ if (response.Error) {
1253
+ throw Error(response.ErrorMessage);
1254
+ }
1255
+ }));
1256
+ }
1257
+ // #endregion Menu: Estabelecimentos
1258
+ // #endregion PREPARATION
1259
+ // #region GET
1260
+ // #region Menu: Usuário
1261
+ getImagemMenu() {
1262
+ const url = `${this._BASE_URL}/InfraUsuario/GetImagemMenu`;
1263
+ return this._httpClient
1264
+ .get(url, { 'headers': this._HTTP_HEADERS })
1265
+ .pipe(take(1), tap(response => {
1266
+ if (response.Error) {
1267
+ throw Error(response.ErrorMessage);
1268
+ }
1269
+ this.saveImageToStorage(response.InfraUsuarioImg.IMAGEM, response.InfraUsuarioImg.FILENAME);
1270
+ }));
1271
+ }
1272
+ // #endregion Menu: Usuário
1273
+ // #region Menu: Estabelecimentos
1274
+ getEstabelecimentoSession(estabID) {
1275
+ const params = new HttpParams()
1276
+ .set('id', estabID);
1277
+ const url = `${this._BASE_URL}/InfraEstabelecimento/GetEstabelecimentoSession`;
1278
+ return this._httpClient
1279
+ .get(url, { 'params': params, 'headers': this._HTTP_HEADERS })
1280
+ .pipe(take(1), tap(response => {
1281
+ if (response.Error) {
1282
+ throw Error(response.ErrorMessage);
1283
+ }
1284
+ }));
1285
+ }
1286
+ // #endregion Menu: Estabelecimentos
1287
+ // #region Get Usuario Email
1288
+ getUsuarioEmail() {
1289
+ const url = `${this._BASE_URL}/InfraUsuario/GetUsuarioEmail`;
1290
+ return this._httpClient
1291
+ .get(url, { 'headers': this._HTTP_HEADERS })
1292
+ .pipe(take(1), tap(response => {
1293
+ if (response.Error) {
1294
+ throw Error(response.ErrorMessage);
1295
+ }
1296
+ }));
1297
+ }
1298
+ // #endregion Get Usuario Email
1299
+ // #endregion GET
1300
+ // #region UPDATE
1301
+ // #region Menu: Usuário
1302
+ updateLastLogEstabID(estabID) {
1303
+ const params = new HttpParams()
1304
+ .set('estabID', estabID);
1305
+ const url = `${this._BASE_URL}/InfraUsuario/UpdateLastSelectedEstabelecimento`;
1306
+ return this._httpClient
1307
+ .post(url, null, { 'params': params, 'headers': this._HTTP_HEADERS })
1308
+ .pipe(take(1), tap(response => {
1309
+ if (response.Error) {
1310
+ throw Error(response.ErrorMessage);
1311
+ }
1312
+ }));
1313
+ }
1314
+ // #endregion Menu: Usuário
1315
+ // #region Menu: Estabelecimentos
1316
+ defineDefaultEstabelecimento(estabID, usuarioID, isDefault) {
1317
+ const params = new HttpParams()
1318
+ .set('estabID', estabID)
1319
+ .set('isDefault', isDefault);
1320
+ const url = `${this._BASE_URL}/InfraEstabelecimento/DefineDefaultEstab`;
1321
+ return this._httpClient
1322
+ .post(url, null, { 'params': params, 'headers': this._HTTP_HEADERS })
1323
+ .pipe(take(1), tap(response => {
1324
+ if (response.Error) {
1325
+ throw Error(response.ErrorMessage);
1326
+ }
1327
+ }));
1328
+ }
1329
+ // #endregion Menu: Estabelecimentos
1330
+ // #endregion UPDATE
1331
+ // #region Menu Dinâmico
1332
+ /** Método executado para pegar o Menu lateral levando em conta as permissões do usuário, grupo e o tenant ativo
1333
+ * Executado caso o getter do boolean Menu Dynamic seja true
1334
+ */
1335
+ getMenuLateral(moduloId) {
1336
+ const headers = new HttpHeaders().set("Content-Type", "application/json");
1337
+ const url = `${this._BASE_URL}/Menu/GetMenuLateral`;
1338
+ const params = new HttpParams()
1339
+ .set('moduloId', moduloId);
1340
+ return this._httpClient
1341
+ .get(url, { params: params, headers: headers })
1342
+ .pipe(take(1), tap((response) => {
1343
+ if (response.Error) {
1344
+ throw Error(response.ErrorMessage);
1345
+ }
1346
+ }));
1347
+ }
1348
+ /** Método executado para montar estrutura de título, submenu e telas de acordo com os modelos presentes na ngx-sp-infra
1349
+ * envia-se o título deste grupo de submenus, ícone e enum daqueles submenus que
1350
+ * ficarão alocados no grupo de determinado título enviado
1351
+ */
1352
+ getTelaSubmenus(NavSubmenuSearchItems) {
1353
+ const headers = new HttpHeaders()
1354
+ .set('Content-Type', 'application/json');
1355
+ const url = `${this._BASE_URL}/Menu/GetTelaSubmenus`;
1356
+ return this._httpClient
1357
+ .post(url, JSON.stringify(NavSubmenuSearchItems), { 'headers': headers })
1358
+ .pipe(take(1), tap(response => {
1359
+ if (response.Error) {
1360
+ throw Error(response.ErrorMessage);
1361
+ }
1362
+ }));
1363
+ }
1364
+ /** Método executado para montar estrutura da tela de submenu com os cards baseado no IdUnico do menu acessado em específico
1365
+ */
1366
+ getTelaSubmenusWithCards(MenuIdUnico) {
1367
+ const headers = new HttpHeaders()
1368
+ .set('Content-Type', 'application/json');
1369
+ const url = `${this._BASE_URL}/Menu/GetTelaSubmenusWithCards`;
1370
+ const params = new HttpParams()
1371
+ .set('MenuIdUnico', MenuIdUnico);
1372
+ return this._httpClient
1373
+ .get(url, { 'params': params, 'headers': headers })
1374
+ .pipe(take(1), tap(response => {
1375
+ if (response.Error) {
1376
+ throw Error(response.ErrorMessage);
1377
+ }
1378
+ }));
1379
+ }
1380
+ getMenuFooterImg() {
1381
+ const cachedFooterImg = JSON.parse(localStorage.getItem('menuFooterImg'));
1382
+ if (cachedFooterImg) {
1383
+ return cachedFooterImg;
1384
+ }
1385
+ return this._menuFooterImg;
1386
+ }
1387
+ setMenuFooterImg(value) {
1388
+ this._menuFooterImg = value;
1389
+ localStorage.setItem('menuFooterImg', JSON.stringify(value));
1390
+ }
1391
+ saveImageToStorage(footerImgSrc, footerImgName) {
1392
+ this.setMenuFooterImg({ USUARIOID: this._authStorageService.infraUsuarioId, FILENAME: footerImgName, FILE: footerImgSrc });
1393
+ }
1394
+ newUserImageEvent(value) {
1395
+ this._subject.next(value);
1396
+ }
1397
+ getNewUserImageEvent() {
1398
+ return this._subject.asObservable();
1399
+ }
1400
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: MenuServicesService, deps: [{ token: AuthStorageService }, { token: i1.HttpClient }, { token: EnvironmentService }], target: i0.ɵɵFactoryTarget.Injectable }); }
1401
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: MenuServicesService, providedIn: 'root' }); }
1402
+ }
1403
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: MenuServicesService, decorators: [{
1404
+ type: Injectable,
1405
+ args: [{
1406
+ providedIn: 'root'
1407
+ }]
1408
+ }], ctorParameters: () => [{ type: AuthStorageService }, { type: i1.HttpClient }, { type: EnvironmentService }] });
1409
+
1410
+ /**Service responsável por pegar as opções do menu do projeto em que está sendo utilizada*/
1411
+ class LibMenuConfigService {
1412
+ constructor() {
1413
+ this.menu = [];
1414
+ this.menuDropdown = [];
1415
+ }
1416
+ /** Inicializa as opções do menu com base na rota atual e em uma lista personalizada (opcional).
1417
+ * @param currentRoute A rota atual da aplicação
1418
+ * @param customList Uma lista personalizada de opções de menu (opcional).
1419
+ * @returns As opções do menu inicializadas.
1420
+ */
1421
+ initializeMenu(currentRoute, customList) {
1422
+ this.menu = this.storedInitializeMenu(currentRoute, customList);
1423
+ return this.menu;
1424
+ }
1425
+ setMenuType(isStaticMenu) {
1426
+ this.storedSetMenuType(isStaticMenu);
1427
+ }
1428
+ updateRouteSelection(currentRoute, currentList) {
1429
+ return this.updateRouteSelection(currentRoute, currentList);
1430
+ }
1431
+ /** Inicializa as opções do menu dropdown com base em uma lista personalizada (opcional).
1432
+ * @param primaryDropdownList Uma lista personalizada de opções do dropdown (opcional).
1433
+ * @returns As opções do dropdown inicializadas.
1434
+ */
1435
+ initializeMenuDropdown(primaryDropdownList) {
1436
+ this.menuDropdown = this.storedInitializeMenuDropdown(primaryDropdownList);
1437
+ return this.menuDropdown;
1438
+ }
1439
+ ConfigurarMenuConfig(menuConfig) {
1440
+ //passando implementação dos métodos do projeto para a lib
1441
+ this.storedInitializeMenu = menuConfig.initializeMenu;
1442
+ this.storedInitializeMenuDropdown = menuConfig.initializeMenuDropdown;
1443
+ this.storedSetMenuType = menuConfig.setMenuType;
1444
+ this.updateRouteSelection = menuConfig.updateRouteSelection;
1445
+ }
1446
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: LibMenuConfigService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
1447
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: LibMenuConfigService, providedIn: 'root' }); }
1448
+ }
1449
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: LibMenuConfigService, decorators: [{
1450
+ type: Injectable,
1451
+ args: [{ providedIn: 'root' }]
1452
+ }] });
1453
+
1454
+ class LibCustomMenuService {
1455
+ /** Obtém as opções do menu. */
1456
+ get menuItems() {
1457
+ return this._menuItems;
1458
+ }
1459
+ set menuItems(value) {
1460
+ this._menuItems = value;
1461
+ }
1462
+ setEmpresa(value) { this.empresaId.next(value); }
1463
+ // ! Definição do BehaviorSubject: responsável principal da emissão do evento
1464
+ // #endregion Propriedade do Menu
1465
+ constructor(_menuConfig, _authStorageService) {
1466
+ this._menuConfig = _menuConfig;
1467
+ this._authStorageService = _authStorageService;
1468
+ // #region Propriedade Customizadas do Menu
1469
+ this.menuDynamic = false;
1470
+ this.menuDynamicCustom = false;
1471
+ this.moduleName = "";
1472
+ this.moduleImg = "";
1473
+ this.moduleSvg = "";
1474
+ this.themeColor = "";
1475
+ // #endregion Propriedade Customizadas do Menu
1476
+ // #region Propriedade do Menu
1477
+ this._menuItems = [];
1478
+ // ! Definição do BehaviorSubject: responsável principal da emissão do evento
1479
+ this.empresaId = new BehaviorSubject({ estabelecimentoID: "", empresaID: "" });
1480
+ this.applyEmpresa$ = this.empresaId.asObservable();
1481
+ // inicializações do Menu Dinâmico
1482
+ this.menuConfig = _menuConfig;
1483
+ }
1484
+ // #region - Métodos Customizadas para o Menu dinâmico
1485
+ // Método executado no menu-lateral.component.ts - método: onInit ()
1486
+ // Utilizado para obter o Módulo para montagem do Menu Dinâmico Lateral
1487
+ menuDynamicGetModuloId() {
1488
+ return this.storeMenuDynamicGetModuloId();
1489
+ }
1490
+ // Método executado no menu-lateral.component.ts - método: onInit ()
1491
+ // Utilizado para inicializações diversas
1492
+ menuDynamicOnInit() {
1493
+ this.storedMenuDynamicOnInit();
1494
+ }
1495
+ // Método executado no menu-lateral.component.ts - método: onInit ()
1496
+ // Utilizado para inicializações diversas
1497
+ menuStaticOnInit() {
1498
+ this.storedMenuStaticOnInit();
1499
+ }
1500
+ // Método executado no menu-lateral.component.ts - método: openExpansibleMenu()
1501
+ // Utilizado para inicializações ao Expandir a opção de Menu
1502
+ menuopenExpansibleMenu(ref) {
1503
+ this.storedMenuopenExpansibleMenu(ref);
1504
+ }
1505
+ /** Método que deve ser chamado na seleção de um novo estabelecimento, ele atualizará os valores do nosso BehaviorSubject para que possamos utilizá-lo em outras partes do sistema. */
1506
+ emitEstabelecimentoEvent() {
1507
+ this.setEmpresa({
1508
+ estabelecimentoID: this._authStorageService.infraEstabId,
1509
+ empresaID: this._authStorageService.infraEmpresaId
1510
+ });
1337
1511
  }
1338
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: AuthService, deps: [{ token: i1.HttpClient }, { token: i1$1.Router }, { token: AuthStorageService }, { token: i3.IpServiceService }, { token: LibCustomLoginService }, { token: ProjectUtilservice }, { token: EnvironmentService }], target: i0.ɵɵFactoryTarget.Injectable }); }
1339
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: AuthService, providedIn: 'root' }); }
1512
+ // #endregion Métodos recebidos do projeto
1513
+ // #region Métodos Publicos
1514
+ ConfigurarCustomMenuService(RealcustomMenuService) {
1515
+ //passando propriedades do projeto para a lib
1516
+ this.menuDynamic = RealcustomMenuService.menuDynamic;
1517
+ this.menuDynamicCustom = RealcustomMenuService.menuDynamicCustom;
1518
+ this.moduleName = RealcustomMenuService.moduleName;
1519
+ this.moduleImg = RealcustomMenuService.moduleImg;
1520
+ this.moduleSvg = RealcustomMenuService.moduleSvg;
1521
+ this.themeColor = RealcustomMenuService.themeColor;
1522
+ //passando implementação dos métodos do projeto para a lib
1523
+ this.storeMenuDynamicGetModuloId = RealcustomMenuService.menuDynamicGetModuloId;
1524
+ this.storedMenuStaticOnInit = RealcustomMenuService.menuStaticOnInit;
1525
+ this.storedMenuopenExpansibleMenu = RealcustomMenuService.menuopenExpansibleMenu;
1526
+ this.storedMenuDynamicOnInit = RealcustomMenuService.menuDynamicOnInit;
1527
+ }
1528
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: LibCustomMenuService, deps: [{ token: LibMenuConfigService }, { token: AuthStorageService }], target: i0.ɵɵFactoryTarget.Injectable }); }
1529
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: LibCustomMenuService, providedIn: 'root' }); }
1340
1530
  }
1341
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: AuthService, decorators: [{
1531
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: LibCustomMenuService, decorators: [{
1342
1532
  type: Injectable,
1343
1533
  args: [{ providedIn: 'root' }]
1344
- }], ctorParameters: () => [{ type: i1.HttpClient }, { type: i1$1.Router }, { type: AuthStorageService }, { type: i3.IpServiceService }, { type: LibCustomLoginService }, { type: ProjectUtilservice }, { type: EnvironmentService }] });
1534
+ }], ctorParameters: () => [{ type: LibMenuConfigService }, { type: AuthStorageService }] });
1345
1535
 
1346
1536
  var LoginProgress;
1347
1537
  (function (LoginProgress) {
@@ -2238,196 +2428,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImpo
2238
2428
  args: [{ selector: 'app-notif-submenu', imports: [], template: "<div class=\"header-submenu\">\n <h1 class=\"titulo pb-3 pt-4\">Notifica\u00E7\u00F5es</h1>\n</div>\n<div class=\"body-notif\">\n <div class=\"new-notif\">\n <div class=\"session-header p-2\">\n <p class=\"session-h-item\">Novas (2)</p><p>Marcar todas como Lidas</p>\n </div>\n <div class=\"scroll\">\n <div>\n <div class=\"session mb-3 pb-3\">\n <div class=\"session-start mt-3 ms-3\">\n <img src=\"assets/icons/file-text.svg\" alt=\"\"><p>Contratos</p>\n </div>\n <div class=\"m-4\">\n <p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has </p>\n </div>\n <div class=\"item-end ms-4 mx-4\">\n <button>Marcar como lida</button>\n <p>2h atr\u00E1s</p>\n </div>\n </div>\n <div class=\"session mb-3 pb-3\">\n <div class=\"session-start mt-3 ms-3\">\n <img src=\"assets/icons/file-text.svg\" alt=\"\"><p>Contratos</p>\n </div>\n <div class=\"m-4\">\n <p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has </p>\n </div>\n <div class=\"item-end ms-4 mx-4\">\n <button>Marcar como lida</button>\n <p>2h atr\u00E1s</p>\n </div>\n </div>\n </div>\n </div>\n </div>\n \n <div class=\"read-notif\">\n <div class=\"session-header p-2\">\n <p class=\"session-h-item\">Lidas</p>\n </div>\n <div class=\"scroll-second\">\n <div>\n <div class=\"session mb-3 pb-3\">\n <div class=\"session-start mt-3 ms-3\">\n <img src=\"assets/icons/file-text.svg\" alt=\"\"><p>Contratos</p>\n </div>\n <div class=\"m-4\">\n <p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has\n Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has </p>\n </div>\n <div class=\"item-end ms-4 mx-4\">\n <button>Marcar como lida</button>\n <p>2h atr\u00E1s</p>\n </div>\n </div>\n <div class=\"session mb-3 pb-3\">\n <div class=\"session-start mt-3 ms-3\">\n <img src=\"assets/icons/file-text.svg\" alt=\"\"><p>Contratos</p>\n </div>\n <div class=\"m-4\">\n <p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has </p>\n </div>\n <div class=\"item-end ms-4 mx-4\">\n <button>Marcar como lida</button>\n <p>2h atr\u00E1s</p>\n </div>\n </div>\n <div class=\"session mb-3 pb-3\">\n <div class=\"session-start mt-3 ms-3\">\n <img src=\"assets/icons/file-text.svg\" alt=\"\"><p>Contratos</p>\n </div>\n <div class=\"m-4\">\n <p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has </p>\n </div>\n <div class=\"item-end ms-4 mx-4\">\n <button>Marcar como lida</button>\n <p>2h atr\u00E1s</p>\n </div>\n </div>\n <div class=\"session mb-3 pb-3\">\n <div class=\"session-start mt-3 ms-3\">\n <img src=\"assets/icons/file-text.svg\" alt=\"\"><p>Contratos</p>\n </div>\n <div class=\"m-4\">\n <p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has </p>\n </div>\n <div class=\"item-end ms-4 mx-4\">\n <button>Marcar como lida</button>\n <p>2h atr\u00E1s</p>\n </div>\n </div>\n <div class=\"session mb-3 pb-3\">\n <div class=\"session-start mt-3 ms-3\">\n <img src=\"assets/icons/file-text.svg\" alt=\"\"><p>Contratos</p>\n </div>\n <div class=\"m-4\">\n <p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has </p>\n </div>\n <div class=\"item-end ms-4 mx-4\">\n <button>Marcar como lida</button>\n <p>2h atr\u00E1s</p>\n </div>\n </div>\n <div class=\"session mb-3 pb-3\">\n <div class=\"session-start mt-3 ms-3\">\n <img src=\"assets/icons/file-text.svg\" alt=\"\"><p>Contratos</p>\n </div>\n <div class=\"m-4\">\n <p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has </p>\n </div>\n <div class=\"item-end ms-4 mx-4\">\n <button>Marcar como lida</button>\n <p>2h atr\u00E1s</p>\n </div>\n </div>\n <div class=\"session mb-3 pb-3\">\n <div class=\"session-start mt-3 ms-3\">\n <img src=\"assets/icons/file-text.svg\" alt=\"\"><p>Contratos</p>\n </div>\n <div class=\"m-4\">\n <p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has </p>\n </div>\n <div class=\"item-end ms-4 mx-4\">\n <button>Marcar como lida</button>\n <p>2h atr\u00E1s</p>\n </div>\n </div>\n <div class=\"session mb-3 pb-3\">\n <div class=\"session-start mt-3 ms-3\">\n <img src=\"assets/icons/file-text.svg\" alt=\"\"><p>Contratos</p>\n </div>\n <div class=\"m-4\">\n <p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has </p>\n </div>\n <div class=\"item-end ms-4 mx-4\">\n <button>Marcar como lida</button>\n <p>2h atr\u00E1s</p>\n </div>\n </div>\n <div class=\"session mb-3 pb-3\">\n <div class=\"session-start mt-3 ms-3\">\n <img src=\"assets/icons/file-text.svg\" alt=\"\"><p>Contratos</p>\n </div>\n <div class=\"m-4\">\n <p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has </p>\n </div>\n <div class=\"item-end ms-4 mx-4\">\n <button>Marcar como lida</button>\n <p>2h atr\u00E1s</p>\n </div>\n </div>\n <div class=\"session mb-3 pb-3\">\n <div class=\"session-start mt-3 ms-3\">\n <img src=\"assets/icons/file-text.svg\" alt=\"\"><p>Contratos</p>\n </div>\n <div class=\"m-4\">\n <p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has </p>\n </div>\n <div class=\"item-end ms-4 mx-4\">\n <button>Marcar como lida</button>\n <p>2h atr\u00E1s</p>\n </div>\n </div>\n <div class=\"session mb-3 pb-3\">\n <div class=\"session-start mt-3 ms-3\">\n <img src=\"assets/icons/file-text.svg\" alt=\"\"><p>Contratos</p>\n </div>\n <div class=\"m-4\">\n <p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has </p>\n </div>\n <div class=\"item-end ms-4 mx-4\">\n <button>Marcar como lida</button>\n <p>2h atr\u00E1s</p>\n </div>\n </div>\n </div>\n </div>\n</div>\n", styles: ["*{padding:0;margin:0;font-family:Open sans,Arial,Helvetica,sans-serif;color:#fff}ul{list-style:none;padding-left:0;display:inline;white-space:nowrap}::-webkit-scrollbar{width:4px;background:transparent}::-webkit-scrollbar-thumb{background:#fff;border-radius:16px}.titulo{font-size:20px;font-weight:700;display:flex;justify-content:center;border-bottom:1px solid #2847a0}ul{display:flex;flex-direction:column;margin:25px 26px 0 24px}ul li{font-size:20px;font-weight:600;line-height:22px;padding-bottom:18px}button{position:relative;border:none;background-color:transparent}.session-header{display:flex;justify-content:space-between;background-color:#2847a0}.session-header .session-h-item{font-weight:700}.session{border-bottom:1px solid #fff;overflow:auto;height:100%}.session:last-child{border-bottom:none}.session-start{display:flex}.item-end{display:flex;justify-content:space-between}.scroll{margin-right:2px;overflow:auto;max-height:300px}.scroll-second{margin-right:2px;overflow:auto;max-height:481px}\n"] }]
2239
2429
  }], ctorParameters: () => [] });
2240
2430
 
2241
- class MenuServicesService {
2242
- constructor(_authStorageService, _httpClient, _environmentService) {
2243
- this._authStorageService = _authStorageService;
2244
- this._httpClient = _httpClient;
2245
- this._environmentService = _environmentService;
2246
- this._BASE_URL = ""; // SpInfra2AplicWS
2247
- this._HTTP_HEADERS = new HttpHeaders().set('Content-Type', 'application/json');
2248
- // #endregion Menu Dinâmico
2249
- // #endregion ==========> SERVICES <==========
2250
- // #region ==========> UTILITIES <==========
2251
- this._menuFooterImg = null;
2252
- // #region NewImg Event
2253
- // Implementação de lógica vista no link: https://hasangalakdinu.medium.com/how-to-call-a-function-in-another-component-angular-using-rxjs-3f2e85920705
2254
- this._subject = new Subject();
2255
- this._BASE_URL = `${this._environmentService.SpInfra2ErpWS}`; // SpInfra2ErpWS
2256
- this._BASE_URL = !this._environmentService.production ? this._BASE_URL : `${this._environmentService.SpInfra2ErpWS}`;
2257
- }
2258
- // #region ==========> SERVICES <==========
2259
- // #region PREPARATION
2260
- // #region Menu: Usuário
2261
- // [...]
2262
- // #endregion Menu: Usuário
2263
- // #region Menu: Estabelecimentos
2264
- getEstabelecimentosModalList(usuarioID, pesquisa) {
2265
- const params = new HttpParams()
2266
- .set('pesquisa', pesquisa);
2267
- const headers = new HttpHeaders()
2268
- .set('Content-Type', 'application/json');
2269
- const url = `${this._BASE_URL}/InfraEstabelecimento/GetEstabelecimentosModal`;
2270
- return this._httpClient
2271
- .get(url, { 'params': params, 'headers': headers })
2272
- .pipe(take(1), tap(response => {
2273
- if (response.Error) {
2274
- throw Error(response.ErrorMessage);
2275
- }
2276
- }));
2277
- }
2278
- // #endregion Menu: Estabelecimentos
2279
- // #endregion PREPARATION
2280
- // #region GET
2281
- // #region Menu: Usuário
2282
- getImagemMenu() {
2283
- const url = `${this._BASE_URL}/InfraUsuario/GetImagemMenu`;
2284
- return this._httpClient
2285
- .get(url, { 'headers': this._HTTP_HEADERS })
2286
- .pipe(take(1), tap(response => {
2287
- if (response.Error) {
2288
- throw Error(response.ErrorMessage);
2289
- }
2290
- this.saveImageToStorage(response.InfraUsuarioImg.IMAGEM, response.InfraUsuarioImg.FILENAME);
2291
- }));
2292
- }
2293
- // #endregion Menu: Usuário
2294
- // #region Menu: Estabelecimentos
2295
- getEstabelecimentoSession(estabID) {
2296
- const params = new HttpParams()
2297
- .set('id', estabID);
2298
- const url = `${this._BASE_URL}/InfraEstabelecimento/GetEstabelecimentoSession`;
2299
- return this._httpClient
2300
- .get(url, { 'params': params, 'headers': this._HTTP_HEADERS })
2301
- .pipe(take(1), tap(response => {
2302
- if (response.Error) {
2303
- throw Error(response.ErrorMessage);
2304
- }
2305
- }));
2306
- }
2307
- // #endregion Menu: Estabelecimentos
2308
- // #region Get Usuario Email
2309
- getUsuarioEmail() {
2310
- const url = `${this._BASE_URL}/InfraUsuario/GetUsuarioEmail`;
2311
- return this._httpClient
2312
- .get(url, { 'headers': this._HTTP_HEADERS })
2313
- .pipe(take(1), tap(response => {
2314
- if (response.Error) {
2315
- throw Error(response.ErrorMessage);
2316
- }
2317
- }));
2318
- }
2319
- // #endregion Get Usuario Email
2320
- // #endregion GET
2321
- // #region UPDATE
2322
- // #region Menu: Usuário
2323
- updateLastLogEstabID(estabID) {
2324
- const params = new HttpParams()
2325
- .set('estabID', estabID);
2326
- const url = `${this._BASE_URL}/InfraUsuario/UpdateLastSelectedEstabelecimento`;
2327
- return this._httpClient
2328
- .post(url, null, { 'params': params, 'headers': this._HTTP_HEADERS })
2329
- .pipe(take(1), tap(response => {
2330
- if (response.Error) {
2331
- throw Error(response.ErrorMessage);
2332
- }
2333
- }));
2334
- }
2335
- // #endregion Menu: Usuário
2336
- // #region Menu: Estabelecimentos
2337
- defineDefaultEstabelecimento(estabID, usuarioID, isDefault) {
2338
- const params = new HttpParams()
2339
- .set('estabID', estabID)
2340
- .set('isDefault', isDefault);
2341
- const url = `${this._BASE_URL}/InfraEstabelecimento/DefineDefaultEstab`;
2342
- return this._httpClient
2343
- .post(url, null, { 'params': params, 'headers': this._HTTP_HEADERS })
2344
- .pipe(take(1), tap(response => {
2345
- if (response.Error) {
2346
- throw Error(response.ErrorMessage);
2347
- }
2348
- }));
2349
- }
2350
- // #endregion Menu: Estabelecimentos
2351
- // #endregion UPDATE
2352
- // #region Menu Dinâmico
2353
- /** Método executado para pegar o Menu lateral levando em conta as permissões do usuário, grupo e o tenant ativo
2354
- * Executado caso o getter do boolean Menu Dynamic seja true
2355
- */
2356
- getMenuLateral(moduloId) {
2357
- const headers = new HttpHeaders().set("Content-Type", "application/json");
2358
- const url = `${this._BASE_URL}/Menu/GetMenuLateral`;
2359
- const params = new HttpParams()
2360
- .set('moduloId', moduloId);
2361
- return this._httpClient
2362
- .get(url, { params: params, headers: headers })
2363
- .pipe(take(1), tap((response) => {
2364
- if (response.Error) {
2365
- throw Error(response.ErrorMessage);
2366
- }
2367
- }));
2368
- }
2369
- /** Método executado para montar estrutura de título, submenu e telas de acordo com os modelos presentes na ngx-sp-infra
2370
- * envia-se o título deste grupo de submenus, ícone e enum daqueles submenus que
2371
- * ficarão alocados no grupo de determinado título enviado
2372
- */
2373
- getTelaSubmenus(NavSubmenuSearchItems) {
2374
- const headers = new HttpHeaders()
2375
- .set('Content-Type', 'application/json');
2376
- const url = `${this._BASE_URL}/Menu/GetTelaSubmenus`;
2377
- return this._httpClient
2378
- .post(url, JSON.stringify(NavSubmenuSearchItems), { 'headers': headers })
2379
- .pipe(take(1), tap(response => {
2380
- if (response.Error) {
2381
- throw Error(response.ErrorMessage);
2382
- }
2383
- }));
2384
- }
2385
- /** Método executado para montar estrutura da tela de submenu com os cards baseado no IdUnico do menu acessado em específico
2386
- */
2387
- getTelaSubmenusWithCards(MenuIdUnico) {
2388
- const headers = new HttpHeaders()
2389
- .set('Content-Type', 'application/json');
2390
- const url = `${this._BASE_URL}/Menu/GetTelaSubmenusWithCards`;
2391
- const params = new HttpParams()
2392
- .set('MenuIdUnico', MenuIdUnico);
2393
- return this._httpClient
2394
- .get(url, { 'params': params, 'headers': headers })
2395
- .pipe(take(1), tap(response => {
2396
- if (response.Error) {
2397
- throw Error(response.ErrorMessage);
2398
- }
2399
- }));
2400
- }
2401
- getMenuFooterImg() {
2402
- const cachedFooterImg = JSON.parse(localStorage.getItem('menuFooterImg'));
2403
- if (cachedFooterImg) {
2404
- return cachedFooterImg;
2405
- }
2406
- return this._menuFooterImg;
2407
- }
2408
- setMenuFooterImg(value) {
2409
- this._menuFooterImg = value;
2410
- localStorage.setItem('menuFooterImg', JSON.stringify(value));
2411
- }
2412
- saveImageToStorage(footerImgSrc, footerImgName) {
2413
- this.setMenuFooterImg({ USUARIOID: this._authStorageService.infraUsuarioId, FILENAME: footerImgName, FILE: footerImgSrc });
2414
- }
2415
- newUserImageEvent(value) {
2416
- this._subject.next(value);
2417
- }
2418
- getNewUserImageEvent() {
2419
- return this._subject.asObservable();
2420
- }
2421
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: MenuServicesService, deps: [{ token: AuthStorageService }, { token: i1.HttpClient }, { token: EnvironmentService }], target: i0.ɵɵFactoryTarget.Injectable }); }
2422
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: MenuServicesService, providedIn: 'root' }); }
2423
- }
2424
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: MenuServicesService, decorators: [{
2425
- type: Injectable,
2426
- args: [{
2427
- providedIn: 'root'
2428
- }]
2429
- }], ctorParameters: () => [{ type: AuthStorageService }, { type: i1.HttpClient }, { type: EnvironmentService }] });
2430
-
2431
2431
  class SelecaoEstabelecimentosModalComponent {
2432
2432
  constructor(_authStorageService, _bsModalService, _customMenuService, _menuServicesService, _messageService, _projectUtilService) {
2433
2433
  this._authStorageService = _authStorageService;
@@ -3117,6 +3117,41 @@ class InfraUsuarioImg {
3117
3117
  }
3118
3118
  }
3119
3119
 
3120
+ class RetMenuItemStructure {
3121
+ constructor() {
3122
+ this.Error = false;
3123
+ this.ErrorMessage = "";
3124
+ this.MenuItem = [];
3125
+ }
3126
+ }
3127
+
3128
+ class RetMenuLateral {
3129
+ constructor() {
3130
+ this.Error = false;
3131
+ this.ErrorMessage = "";
3132
+ }
3133
+ }
3134
+
3135
+ class RetMenuPromise {
3136
+ constructor() {
3137
+ this.menuList = [];
3138
+ this.isAuthorized = false;
3139
+ }
3140
+ }
3141
+
3142
+ class RetNavSubMenu {
3143
+ constructor() {
3144
+ this.Error = false;
3145
+ this.ErrorMessage = "";
3146
+ }
3147
+ }
3148
+ class RetSubmenuWithCards {
3149
+ constructor() {
3150
+ this.Error = false;
3151
+ this.ErrorMessage = "";
3152
+ }
3153
+ }
3154
+
3120
3155
  class AuthGuard {
3121
3156
  constructor(router, authStorageService) {
3122
3157
  this.router = router;
@@ -3256,6 +3291,31 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImpo
3256
3291
  args: [{ providedIn: 'root' }]
3257
3292
  }], ctorParameters: () => [{ type: i1$1.Router }, { type: AuthStorageService }] });
3258
3293
 
3294
+ /** Protege a página de processamento de login integrado OS, só permite acessá-la se o payload for informado corretamente. */
3295
+ class LoginOSGuard {
3296
+ constructor(_router, _loginOSService) {
3297
+ this._router = _router;
3298
+ this._loginOSService = _loginOSService;
3299
+ }
3300
+ canActivate(route, state) {
3301
+ const payload = route.queryParamMap.get('payload');
3302
+ if (payload && payload.trim().length > 0) {
3303
+ return true;
3304
+ }
3305
+ else {
3306
+ this._loginOSService.setPendingWarning('Login integrado falhou: o parâmetro "payload" está inválido ou ausente');
3307
+ return this._router.parseUrl('/auth/login');
3308
+ }
3309
+ }
3310
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: LoginOSGuard, deps: [{ token: i1$1.Router }, { token: AuthService }], target: i0.ɵɵFactoryTarget.Injectable }); }
3311
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: LoginOSGuard, providedIn: 'root' }); }
3312
+ }
3313
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: LoginOSGuard, decorators: [{
3314
+ type: Injectable,
3315
+ args: [{ providedIn: 'root' }]
3316
+ }], ctorParameters: () => [{ type: i1$1.Router }, { type: AuthService }] });
3317
+ ;
3318
+
3259
3319
  /**
3260
3320
  * \brief Intercepta uma chamada HTTP para inserir o usuário logado no header em conjunto
3261
3321
  * com o login para uso da API.
@@ -3326,5 +3386,5 @@ const AUTH_ROUTES = [
3326
3386
  * Generated bundle index. Do not edit.
3327
3387
  */
3328
3388
 
3329
- export { AUTH_ROUTES, AuthAplicInterceptor, AuthGuard, AuthInfraInterceptor, AuthModule, AuthStorageService, DynamicMenuComponent, EnvironmentService, ExternaLoginlGuard, IMenu, InfraUsuarioImg, LibCustomLoginService, LibCustomMenuService, LibCustomStorageService, LibMenuConfigService, LoginComponent, LoginGuard, LoginOSComponent, LoginProgress, MenuLateralComponent, NotifSubmenuComponent, NovaSenhaComponent, PrimaryDropdownComponent, SecondaryDropdownComponent, SelecaoEstabelecimentosModalComponent, SituacaoLogin };
3389
+ export { AUTH_ROUTES, AuthAplicInterceptor, AuthGuard, AuthInfraInterceptor, AuthModule, AuthService, AuthStorageService, DynamicMenuComponent, EnvironmentService, ExternaLoginlGuard, IMenu, InfraUsuarioImg, LibCustomLoginService, LibCustomMenuService, LibCustomStorageService, LibMenuConfigService, LoginComponent, LoginGuard, LoginOSComponent, LoginOSGuard, LoginProgress, MenuLateralComponent, MenuServicesService, NotifSubmenuComponent, NovaSenhaComponent, PrimaryDropdownComponent, RetMenuItemStructure, RetMenuLateral, RetMenuPromise, RetNavSubMenu, RetSubmenuWithCards, SecondaryDropdownComponent, SelecaoEstabelecimentosModalComponent, SituacaoLogin };
3330
3390
  //# sourceMappingURL=ngx-sp-auth.mjs.map