intelica-library-components 1.1.175 → 1.1.176

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.
@@ -1,6 +1,6 @@
1
1
  import * as i0 from '@angular/core';
2
2
  import { Injectable, inject, signal, Pipe, Component, TemplateRef, ContentChild, Input, Directive, EventEmitter, ContentChildren, Output, HostListener, forwardRef, ViewChild, PLATFORM_ID, Inject, DestroyRef, output, input, effect, computed, ViewChildren, Optional, Host, InjectionToken } from '@angular/core';
3
- import { getCookie, setCookie } from 'typescript-cookie';
3
+ import { getCookie, setCookie, Cookies } from 'typescript-cookie';
4
4
  import * as i1$4 from '@angular/common/http';
5
5
  import { HttpClient, HttpHeaders, HttpResponse } from '@angular/common/http';
6
6
  import { BehaviorSubject, catchError, throwError, Subject, Subscription, tap as tap$1, of, map, fromEvent, startWith, distinctUntilChanged, firstValueFrom, shareReplay } from 'rxjs';
@@ -462,6 +462,32 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.23", ngImpo
462
462
  args: [{ providedIn: "root" }]
463
463
  }] });
464
464
 
465
+ class CloseSessionService {
466
+ configService = inject(ConfigService);
467
+ httpClient = inject(HttpClient);
468
+ closeSession() {
469
+ sessionStorage.clear();
470
+ this.httpClient.put(`${this.configService.environment?.authenticationPath}/imrp/ignore/close-session`, null).subscribe();
471
+ setTimeout(() => {
472
+ //Obtiene los atributos de las cookies según el entorno
473
+ const cookieAttributes = GetCookieAttributes(this.configService.environment?.environment ?? "");
474
+ //Elimina las cookies de la sesion
475
+ Object.keys(Cookies.get() ?? {}).forEach(cookieName => {
476
+ Cookies.remove(cookieName, cookieAttributes);
477
+ });
478
+ //Construye la ruta de redirección según el entorno y el callback
479
+ const path = this.configService.environment?.authenticationWeb ?? "";
480
+ window.location.href = path;
481
+ }, 1000);
482
+ }
483
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.23", ngImport: i0, type: CloseSessionService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
484
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.23", ngImport: i0, type: CloseSessionService, providedIn: "root" });
485
+ }
486
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.23", ngImport: i0, type: CloseSessionService, decorators: [{
487
+ type: Injectable,
488
+ args: [{ providedIn: "root" }]
489
+ }] });
490
+
465
491
  const ErrorInterceptor = (req, next) => {
466
492
  const skip = req.headers.has("Skip-Interceptor");
467
493
  if (skip) {
@@ -473,6 +499,7 @@ const ErrorInterceptor = (req, next) => {
473
499
  const commonFeatureFlagService = inject(GlobalFeatureFlagService);
474
500
  const spinnerService = inject(SpinnerService);
475
501
  const sweetAlertService = inject(SweetAlertService);
502
+ const closeSessionService = inject(CloseSessionService);
476
503
  const configService = inject(ConfigService);
477
504
  const HeaderSettings = {};
478
505
  const authenticationClientID = configService.environment?.clientID ?? "";
@@ -500,11 +527,11 @@ const ErrorInterceptor = (req, next) => {
500
527
  else if (error.status == 404)
501
528
  sweetAlertService.messageBox("Recurso no encontrado.");
502
529
  else if (error.status == 401) {
503
- sweetAlertService.messageBox(error.error.Error);
504
- window.location.href = authenticationLocation;
530
+ //Codigo reservado para vencimiento de refreshtoken
531
+ closeSessionService.closeSession();
505
532
  }
506
533
  else if (error.status == 403) {
507
- sweetAlertService.messageBox(error.error.Error);
534
+ //Codigo reservado para acceso denegado
508
535
  window.location.href = window.location.origin;
509
536
  }
510
537
  else
@@ -515,6 +542,7 @@ const ErrorInterceptor = (req, next) => {
515
542
  }
516
543
  };
517
544
 
545
+ //Recupera el token de la respuesta y lo guarda en una cookie si no es localhost
518
546
  const ResponseHeadersInterceptor = (req, next) => {
519
547
  return next(req).pipe(tap(event => {
520
548
  if (event instanceof HttpResponse) {
@@ -563,6 +591,7 @@ var AlertButtonMode;
563
591
  AlertButtonMode["CONFIRM_ONLY"] = "confirm_only";
564
592
  })(AlertButtonMode || (AlertButtonMode = {}));
565
593
 
594
+ //Este guard propaga `pageRoot` del padre al hijo en la jerarquía de rutas
566
595
  class PageRootChildGuard {
567
596
  canActivateChild(child, parent) {
568
597
  const parentData = child.parent?.data;
@@ -9244,5 +9273,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.23", ngImpo
9244
9273
  * Generated bundle index. Do not edit.
9245
9274
  */
9246
9275
 
9247
- export { ALERT_DEFAULTS, ALERT_ICON_OVERRIDES, ALERT_ICON_PATHS, ALERT_TYPE_CONFIG, ActionDirective, ActionsMenuComponent, AddFavoritesComponent, AlertButtonMode, AlertService, AlertType, BreadCrumbComponent, ButtonSplitComponent, CheckboxFilterDirective, ClientContextSelector, Color, ColumnComponent, ColumnGroupComponent, CompareByField, ConfigService, CookieAttributesGeneral, DATEPICKER_BUTTON_TYPES, DashboardQsComponent, DashboardQsInteractiveComponent, DataDirective, DateFilterDirective, DateModeOptions, DatepickerComponent, DynamicInputValidation, EchartComponent, EchartService, ElementService, EmailInputValidation, ErrorInterceptor, FeatureFlagService, FilterChipsComponent, FiltersComponent, FormatAmountPipe, GetCookieAttributes, GlobalFavoriteService, GlobalFeatureFlagService, GlobalMenuService, GlobalTermService, GoogleTaskManagerService, HtmlToExcelService, InitializeConfigService, InputValidation, IntelicaAlertComponent, IntelicaCellCheckboxDirective, IntelicaSessionService, ItemSplitDirective, LanguageService, MatrixColumnComponent, MatrixColumnGroupComponent, MatrixTableComponent, ModalDialogComponent, MultiSelectComponent, NotificationJobService, NotificationOrchestratorService, NotificationService, NotificationSignalRService, OrderConstants, PageInformation, PageRootChildGuard, PaginatorComponent, Patterns, PopoverComponent, ProfileService, RecordPerPageComponent, RequestCacheService, ResponseHeadersInterceptor, RowResumenComponent, RowResumenTreeComponent, SearchComponent, SelectDetailFilterDirective, SelectFilterDirective, SetsesioninformationComponent, Shared, SharedService, SkeletonChartComponent, SkeletonComponent, SkeletonService, SkeletonTableComponent, SortingComponent, SpinnerComponent, SpinnerService, SweetAlertService, TableComponent, TableFetchComponent, TableSortOrder, TemplateDirective, TemplateMenuComponent, TermPipe, TermService, TextAreaFilterDirective, TextFilterDirective, TextRangeFilterDirective, TitleComponent, TreeColumnComponent, TreeColumnGroupComponent, TreeTableComponent, TruncatePipe, decryptData, encryptData, getColor };
9276
+ export { ALERT_DEFAULTS, ALERT_ICON_OVERRIDES, ALERT_ICON_PATHS, ALERT_TYPE_CONFIG, ActionDirective, ActionsMenuComponent, AddFavoritesComponent, AlertButtonMode, AlertService, AlertType, BreadCrumbComponent, ButtonSplitComponent, CheckboxFilterDirective, ClientContextSelector, CloseSessionService, Color, ColumnComponent, ColumnGroupComponent, CompareByField, ConfigService, CookieAttributesGeneral, DATEPICKER_BUTTON_TYPES, DashboardQsComponent, DashboardQsInteractiveComponent, DataDirective, DateFilterDirective, DateModeOptions, DatepickerComponent, DynamicInputValidation, EchartComponent, EchartService, ElementService, EmailInputValidation, ErrorInterceptor, FeatureFlagService, FilterChipsComponent, FiltersComponent, FormatAmountPipe, GetCookieAttributes, GlobalFavoriteService, GlobalFeatureFlagService, GlobalMenuService, GlobalTermService, GoogleTaskManagerService, HtmlToExcelService, InitializeConfigService, InputValidation, IntelicaAlertComponent, IntelicaCellCheckboxDirective, IntelicaSessionService, ItemSplitDirective, LanguageService, MatrixColumnComponent, MatrixColumnGroupComponent, MatrixTableComponent, ModalDialogComponent, MultiSelectComponent, NotificationJobService, NotificationOrchestratorService, NotificationService, NotificationSignalRService, OrderConstants, PageInformation, PageRootChildGuard, PaginatorComponent, Patterns, PopoverComponent, ProfileService, RecordPerPageComponent, RequestCacheService, ResponseHeadersInterceptor, RowResumenComponent, RowResumenTreeComponent, SearchComponent, SelectDetailFilterDirective, SelectFilterDirective, SetsesioninformationComponent, Shared, SharedService, SkeletonChartComponent, SkeletonComponent, SkeletonService, SkeletonTableComponent, SortingComponent, SpinnerComponent, SpinnerService, SweetAlertService, TableComponent, TableFetchComponent, TableSortOrder, TemplateDirective, TemplateMenuComponent, TermPipe, TermService, TextAreaFilterDirective, TextFilterDirective, TextRangeFilterDirective, TitleComponent, TreeColumnComponent, TreeColumnGroupComponent, TreeTableComponent, TruncatePipe, decryptData, encryptData, getColor };
9248
9277
  //# sourceMappingURL=intelica-library-components.mjs.map