ngx-sp-auth 4.3.9 → 4.3.11
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
|
@@ -236,7 +236,7 @@ class IndexedDBService {
|
|
|
236
236
|
if (!window.indexedDB) {
|
|
237
237
|
alert("Seu navegador não suporta uma versão estável do IndexedDB. Salvamento de filtros em sessão não estará disponível.");
|
|
238
238
|
}
|
|
239
|
-
this._dbName = `Sp_${_customEnvironment.product}_Filtros`;
|
|
239
|
+
this._dbName = `Sp_${_customEnvironment.product ?? 'Modelo'}_Filtros`;
|
|
240
240
|
}
|
|
241
241
|
// #region ==========> ACTIONS <==========
|
|
242
242
|
// #region ADD
|
|
@@ -248,7 +248,15 @@ class IndexedDBService {
|
|
|
248
248
|
*/
|
|
249
249
|
async add(value) {
|
|
250
250
|
const db = await openDB(this._dbName, 1);
|
|
251
|
-
|
|
251
|
+
try {
|
|
252
|
+
await db.add('filters', value);
|
|
253
|
+
}
|
|
254
|
+
finally {
|
|
255
|
+
try {
|
|
256
|
+
db.close();
|
|
257
|
+
}
|
|
258
|
+
catch (e) { /* não faz nada */ }
|
|
259
|
+
}
|
|
252
260
|
}
|
|
253
261
|
// #endregion ADD
|
|
254
262
|
// #region GET
|
|
@@ -261,7 +269,15 @@ class IndexedDBService {
|
|
|
261
269
|
*/
|
|
262
270
|
async get(key) {
|
|
263
271
|
const db = await openDB(this._dbName, 1);
|
|
264
|
-
|
|
272
|
+
try {
|
|
273
|
+
return await db.get('filters', key);
|
|
274
|
+
}
|
|
275
|
+
finally {
|
|
276
|
+
try {
|
|
277
|
+
db.close();
|
|
278
|
+
}
|
|
279
|
+
catch (e) { /* não faz nada */ }
|
|
280
|
+
}
|
|
265
281
|
}
|
|
266
282
|
// #endregion GET
|
|
267
283
|
// #region UPDATE
|
|
@@ -272,7 +288,15 @@ class IndexedDBService {
|
|
|
272
288
|
*/
|
|
273
289
|
async update(value) {
|
|
274
290
|
const db = await openDB(this._dbName, 1);
|
|
275
|
-
|
|
291
|
+
try {
|
|
292
|
+
await db.put('filters', value);
|
|
293
|
+
}
|
|
294
|
+
finally {
|
|
295
|
+
try {
|
|
296
|
+
db.close();
|
|
297
|
+
}
|
|
298
|
+
catch (e) { /* não faz nada */ }
|
|
299
|
+
}
|
|
276
300
|
}
|
|
277
301
|
// #endregion UPDATE
|
|
278
302
|
// #region DELETE
|
|
@@ -283,7 +307,15 @@ class IndexedDBService {
|
|
|
283
307
|
*/
|
|
284
308
|
async delete(key) {
|
|
285
309
|
const db = await openDB(this._dbName, 1);
|
|
286
|
-
|
|
310
|
+
try {
|
|
311
|
+
await db.delete('filters', key);
|
|
312
|
+
}
|
|
313
|
+
finally {
|
|
314
|
+
try {
|
|
315
|
+
db.close();
|
|
316
|
+
}
|
|
317
|
+
catch (e) { /* não faz nada */ }
|
|
318
|
+
}
|
|
287
319
|
}
|
|
288
320
|
// #endregion DELETE
|
|
289
321
|
// #endregion ==========> ACTIONS <==========
|
|
@@ -321,8 +353,33 @@ class IndexedDBService {
|
|
|
321
353
|
* @param name Nome da database
|
|
322
354
|
*/
|
|
323
355
|
async deleteDatabase() {
|
|
356
|
+
// Fecha a conexão persistente local, se existir, antes de tentar excluir a DB
|
|
357
|
+
if (this.request) {
|
|
358
|
+
try {
|
|
359
|
+
this.request.close();
|
|
360
|
+
}
|
|
361
|
+
catch (err) {
|
|
362
|
+
console.warn('deleteDatabase() => erro ao fechar conexão local', err);
|
|
363
|
+
}
|
|
364
|
+
this.request = undefined;
|
|
365
|
+
}
|
|
324
366
|
return await deleteDB(this._dbName);
|
|
325
367
|
}
|
|
368
|
+
/**
|
|
369
|
+
* Fecha a conexão persistente (se existir) sem excluir a database.
|
|
370
|
+
* Útil para cenários onde se precisa liberar a conexão antes de chamar `deleteDatabase()`.
|
|
371
|
+
*/
|
|
372
|
+
async closeOpenConnection() {
|
|
373
|
+
if (this.request) {
|
|
374
|
+
try {
|
|
375
|
+
this.request.close();
|
|
376
|
+
}
|
|
377
|
+
catch (err) {
|
|
378
|
+
console.warn('closeOpenConnection() => erro ao fechar conexão', err);
|
|
379
|
+
}
|
|
380
|
+
this.request = undefined;
|
|
381
|
+
}
|
|
382
|
+
}
|
|
326
383
|
/**
|
|
327
384
|
* Valida se já existe um valor cadastrado na base com a chave-única que foi informada, se houver retorna ele, caso contrário cria um registro placeholder para poder atualizar depois.
|
|
328
385
|
*
|
|
@@ -700,8 +757,11 @@ class AuthStorageService {
|
|
|
700
757
|
this.__azureTenantId = "";
|
|
701
758
|
this.__azureClientId = "";
|
|
702
759
|
localStorage.removeItem(this.__local_key);
|
|
703
|
-
//
|
|
704
|
-
|
|
760
|
+
// Limpa o armazenamento local do navegador que contém os filtros de um produto específico
|
|
761
|
+
// Fecha a conexão local (se houver) antes de excluir a database para evitar o callback 'blocking'
|
|
762
|
+
this._indexedDBService.closeOpenConnection()
|
|
763
|
+
.then(() => this._indexedDBService.deleteDatabase())
|
|
764
|
+
.catch((err) => console.warn('logout() => falha ao limpar conexão', err));
|
|
705
765
|
// Método com customizações para finalizações da storage
|
|
706
766
|
this._customStorageService.storageLogout();
|
|
707
767
|
}
|
|
@@ -1061,7 +1121,9 @@ class AuthService {
|
|
|
1061
1121
|
.post(url, login, { 'params': params, 'headers': headers })
|
|
1062
1122
|
.pipe(take$1(1), tap$1((response) => {
|
|
1063
1123
|
// Limnpa o armazenamento local do navegador que contém os filtros de um produto específico (com base na prop 'product' do environment)
|
|
1064
|
-
this._indexedDBService.
|
|
1124
|
+
this._indexedDBService.closeOpenConnection()
|
|
1125
|
+
.then(() => this._indexedDBService.deleteDatabase())
|
|
1126
|
+
.catch((err) => console.warn('login() => falha ao limpar conexão', err));
|
|
1065
1127
|
if (response.FeedbackMessage != "") {
|
|
1066
1128
|
return;
|
|
1067
1129
|
}
|
|
@@ -4127,7 +4189,7 @@ class SubMenuCardComponent {
|
|
|
4127
4189
|
});
|
|
4128
4190
|
}
|
|
4129
4191
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: SubMenuCardComponent, deps: [{ token: MenuServicesService }, { token: ProjectUtilservice }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
4130
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.15", type: SubMenuCardComponent, isStandalone: true, selector: "sub-menu-card", inputs: { subMenuCards: "subMenuCards" }, ngImport: i0, template: `
|
|
4192
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.15", type: SubMenuCardComponent, isStandalone: true, selector: "sub-menu-card, lib-submenu-card", inputs: { subMenuCards: "subMenuCards" }, ngImport: i0, template: `
|
|
4131
4193
|
<div class="max-card-menu row">
|
|
4132
4194
|
@for(card of subMenuCards; track $index) {
|
|
4133
4195
|
<a href="{{ card.isExternal ? GetExternalUrl(card.urlPath) : card.urlPath }}" class="card-link col-4" target="_blank">
|
|
@@ -4155,7 +4217,7 @@ class SubMenuCardComponent {
|
|
|
4155
4217
|
}
|
|
4156
4218
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: SubMenuCardComponent, decorators: [{
|
|
4157
4219
|
type: Component,
|
|
4158
|
-
args: [{ selector: 'sub-menu-card', imports: [LibIconsComponent], template: `
|
|
4220
|
+
args: [{ selector: 'sub-menu-card, lib-submenu-card', imports: [LibIconsComponent], template: `
|
|
4159
4221
|
<div class="max-card-menu row">
|
|
4160
4222
|
@for(card of subMenuCards; track $index) {
|
|
4161
4223
|
<a href="{{ card.isExternal ? GetExternalUrl(card.urlPath) : card.urlPath }}" class="card-link col-4" target="_blank">
|
|
@@ -4317,11 +4379,11 @@ class SubMenuComponent {
|
|
|
4317
4379
|
});
|
|
4318
4380
|
}
|
|
4319
4381
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: SubMenuComponent, deps: [{ token: MenuServicesService }, { token: ProjectUtilservice }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
4320
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.15", type: SubMenuComponent, isStandalone: true, selector: "app-nav-sub-menu", inputs: { navSubmenus: "navSubmenus", isProduction: "isProduction", hostname: "hostname", activeItem: "activeItem" }, outputs: { onTituloSelecionado: "onTituloSelecionado", onTelaSelecionada: "onTelaSelecionada" }, ngImport: i0, template: "<lib-container>\n <div class=\"px-5\" innerContent1>\n @for(subMenu of navSubmenus; track $index) {\n <div [class]=\"$first && subMenu.titulo == '' && subMenu.icon == '' ? ' mb-2' : 'mt-4 mb-2'\">\n @if (subMenu.icon != '') {\n <lib-icon class=\"bold engrenagem-ajustada\" iconName=\"{{ subMenu.icon }}\" />\n }\n @if (subMenu.titulo != ''){\n <span class=\"fw-bold fs-4 ms-1\">{{ subMenu.titulo }}</span>\n }\n\n <app-nav-tabs [activeItem]=\"activeItem\" [subMenus]=\"navSubmenus[$index].subMenuItem\" [hostName]=\"hostNameOutSystems\"\n (onTelaSelecionada)=\"onTelaSelecionada.emit($event)\" (onTituloSelecionado)=\"onTituloSelecionado.emit($event)\" />\n </div>\n\n @if(!$last){ <hr /> }\n }\n </div>\n</lib-container>\n", styles: [".engrenagem-ajustada{position:relative;top:-4px}\n"], dependencies: [{ kind: "component", type: NavTabsComponent, selector: "app-nav-tabs", inputs: ["subMenus", "hostName", "activeItem"], outputs: ["onTituloSelecionado", "onTelaSelecionada"] }, { kind: "component", type: LibIconsComponent, selector: "lib-icon", inputs: ["iconName", "iconColor", "iconSize", "iconFill"] }, { kind: "component", type: ContentContainerComponent, selector: "lib-container", inputs: ["documentation", "tabs", "advancedTabs", "containerTitle", "useBorder", "currentTab"], outputs: ["onChangeTab"] }] }); }
|
|
4382
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.15", type: SubMenuComponent, isStandalone: true, selector: "app-nav-sub-menu, lib-submenu", inputs: { navSubmenus: "navSubmenus", isProduction: "isProduction", hostname: "hostname", activeItem: "activeItem" }, outputs: { onTituloSelecionado: "onTituloSelecionado", onTelaSelecionada: "onTelaSelecionada" }, ngImport: i0, template: "<lib-container>\n <div class=\"px-5\" innerContent1>\n @for(subMenu of navSubmenus; track $index) {\n <div [class]=\"$first && subMenu.titulo == '' && subMenu.icon == '' ? ' mb-2' : 'mt-4 mb-2'\">\n @if (subMenu.icon != '') {\n <lib-icon class=\"bold engrenagem-ajustada\" iconName=\"{{ subMenu.icon }}\" />\n }\n @if (subMenu.titulo != ''){\n <span class=\"fw-bold fs-4 ms-1\">{{ subMenu.titulo }}</span>\n }\n\n <app-nav-tabs [activeItem]=\"activeItem\" [subMenus]=\"navSubmenus[$index].subMenuItem\" [hostName]=\"hostNameOutSystems\"\n (onTelaSelecionada)=\"onTelaSelecionada.emit($event)\" (onTituloSelecionado)=\"onTituloSelecionado.emit($event)\" />\n </div>\n\n @if(!$last){ <hr /> }\n }\n </div>\n</lib-container>\n", styles: [".engrenagem-ajustada{position:relative;top:-4px}\n"], dependencies: [{ kind: "component", type: NavTabsComponent, selector: "app-nav-tabs", inputs: ["subMenus", "hostName", "activeItem"], outputs: ["onTituloSelecionado", "onTelaSelecionada"] }, { kind: "component", type: LibIconsComponent, selector: "lib-icon", inputs: ["iconName", "iconColor", "iconSize", "iconFill"] }, { kind: "component", type: ContentContainerComponent, selector: "lib-container", inputs: ["documentation", "tabs", "advancedTabs", "containerTitle", "useBorder", "currentTab"], outputs: ["onChangeTab"] }] }); }
|
|
4321
4383
|
}
|
|
4322
4384
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: SubMenuComponent, decorators: [{
|
|
4323
4385
|
type: Component,
|
|
4324
|
-
args: [{ selector: 'app-nav-sub-menu', imports: [
|
|
4386
|
+
args: [{ selector: 'app-nav-sub-menu, lib-submenu', imports: [
|
|
4325
4387
|
NavTabsComponent,
|
|
4326
4388
|
LibIconsComponent,
|
|
4327
4389
|
ContentContainerComponent
|