intelica-library-ui 0.1.218 → 0.1.220
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,9 +1,10 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
2
|
import { inject, Injectable, signal, Pipe, Component, HostListener, Directive, EventEmitter, Output, Input, forwardRef, TemplateRef, ContentChild, ContentChildren, ViewChild, PLATFORM_ID, Inject, ChangeDetectorRef, Optional, Host } from '@angular/core';
|
|
3
3
|
import { getCookie, Cookies, setCookie } from 'typescript-cookie';
|
|
4
|
-
import { HttpClient, HttpHeaders } from '@angular/common/http';
|
|
5
|
-
import { BehaviorSubject, catchError, throwError, from, switchMap, Subject, Subscription, of, tap, map } from 'rxjs';
|
|
4
|
+
import { HttpClient, HttpHeaders, HttpResponse } from '@angular/common/http';
|
|
5
|
+
import { BehaviorSubject, catchError, throwError, from, switchMap, Subject, Subscription, of, tap as tap$1, map } from 'rxjs';
|
|
6
6
|
import Swal from 'sweetalert2';
|
|
7
|
+
import { tap } from 'rxjs/operators';
|
|
7
8
|
import * as i1 from '@angular/common';
|
|
8
9
|
import { CommonModule, DatePipe, isPlatformBrowser, NgIf } from '@angular/common';
|
|
9
10
|
import * as i1$1 from '@angular/forms';
|
|
@@ -89,7 +90,7 @@ class TermService {
|
|
|
89
90
|
_http = inject(HttpClient);
|
|
90
91
|
_config = inject(ConfigService);
|
|
91
92
|
GetTerms(languageCode, pageRoot) {
|
|
92
|
-
return this._http.get(`${this._config.environment?.
|
|
93
|
+
return this._http.get(`${this._config.environment?.securityPath}/Term/ignore/page/${pageRoot}/language/${languageCode}`);
|
|
93
94
|
}
|
|
94
95
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.1", ngImport: i0, type: TermService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
95
96
|
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.1", ngImport: i0, type: TermService, providedIn: "root" });
|
|
@@ -408,29 +409,32 @@ const ErrorInterceptor = (req, next) => {
|
|
|
408
409
|
HeaderSettings["PageRoot"] = commonFeatureFlagService.GetPageRoot();
|
|
409
410
|
HeaderSettings["LanguageCode"] = getCookie("language") ?? "";
|
|
410
411
|
HeaderSettings["Environment"] = configService.environment?.environment ?? "";
|
|
411
|
-
HeaderSettings["Access"] = authenticationClientID == "" ? "" : getCookie(authenticationClientID) ?? "";
|
|
412
|
+
HeaderSettings["Access"] = authenticationClientID == "" ? "" : (getCookie(authenticationClientID) ?? "");
|
|
412
413
|
}
|
|
413
414
|
let _request = req.clone({ headers: new HttpHeaders(HeaderSettings) });
|
|
414
415
|
return next(_request).pipe(catchError(handleErrorResponse));
|
|
415
416
|
function handleErrorResponse(error) {
|
|
416
|
-
console.log(error, "error");
|
|
417
|
+
console.log(error, "error", error.status);
|
|
417
418
|
spinnerService.hide();
|
|
418
|
-
|
|
419
|
-
sweetAlertService.messageBox(error.error.message);
|
|
420
|
-
if (error.status == 400)
|
|
421
|
-
sweetAlertService.messageBox(error.error.message);
|
|
422
|
-
if (error.status == 409)
|
|
423
|
-
sweetAlertService.messageBox(error.error.message);
|
|
424
|
-
if (error.status == 401)
|
|
425
|
-
sweetAlertService.messageBox(error.error.message);
|
|
419
|
+
const authenticationLocation = `${configService.environment?.authenticationWeb}?callback=${window.location.href}&clientID=${configService.environment?.clientID}`;
|
|
426
420
|
if (error.status == 503 || error.status == 0)
|
|
427
421
|
sweetAlertService.messageBox("El servicio que se necesita consumir no esta activo o no responde.");
|
|
428
|
-
if (error.status == 405)
|
|
422
|
+
else if (error.status == 405)
|
|
429
423
|
sweetAlertService.messageBox("Los parametros enviados al servicio no coinciden.");
|
|
430
|
-
if (error.status == 404)
|
|
424
|
+
else if (error.status == 404)
|
|
431
425
|
sweetAlertService.messageBox("Recurso no encontrado.");
|
|
426
|
+
else if (error.status == 401) {
|
|
427
|
+
sweetAlertService.messageBox(error.error.Error);
|
|
428
|
+
window.location.href = authenticationLocation;
|
|
429
|
+
}
|
|
430
|
+
else if (error.status == 403) {
|
|
431
|
+
sweetAlertService.messageBox(error.error.Error);
|
|
432
|
+
window.location.href = window.location.origin;
|
|
433
|
+
}
|
|
434
|
+
else
|
|
435
|
+
sweetAlertService.messageBox(error.error.Message);
|
|
432
436
|
return throwError(() => {
|
|
433
|
-
error.error, error.message;
|
|
437
|
+
(error.error, error.message);
|
|
434
438
|
});
|
|
435
439
|
}
|
|
436
440
|
};
|
|
@@ -458,7 +462,7 @@ const RefreshTokenInterceptor = (req, next) => {
|
|
|
458
462
|
const cookieAttributesGeneral = GetCookieAttributes(configService.environment?.environment ?? "");
|
|
459
463
|
let _request = req.clone();
|
|
460
464
|
let authenticationLocation = `${configService.environment?.authenticationWeb}?callback=${window.location.href}&clientID=${configService.environment?.clientID}`;
|
|
461
|
-
let path = `${configService.environment?.authenticationPath ?? ""}/Authenticate/ValidateToken`;
|
|
465
|
+
let path = `${configService.environment?.authenticationPath ?? ""}/Authenticate/ignore/ValidateToken`;
|
|
462
466
|
var authenticationClientID = configService.environment?.clientID ?? "";
|
|
463
467
|
let validateTokenQuery = {
|
|
464
468
|
token: getCookie("token") ?? "",
|
|
@@ -499,6 +503,21 @@ const RefreshTokenInterceptor = (req, next) => {
|
|
|
499
503
|
return next(_request);
|
|
500
504
|
};
|
|
501
505
|
|
|
506
|
+
const ResponseHeadersInterceptor = (req, next) => {
|
|
507
|
+
return next(req).pipe(tap(event => {
|
|
508
|
+
if (event instanceof HttpResponse) {
|
|
509
|
+
const Domain = window.location.hostname.split(".").slice(-2).join(".");
|
|
510
|
+
const Secure = !Domain.includes("localhost");
|
|
511
|
+
if (!Secure) {
|
|
512
|
+
const headers = event.headers;
|
|
513
|
+
const newToken = headers.get("TokenNew");
|
|
514
|
+
if (newToken != null && newToken != "")
|
|
515
|
+
setCookie("token", newToken, CookieAttributesGeneral);
|
|
516
|
+
}
|
|
517
|
+
}
|
|
518
|
+
}));
|
|
519
|
+
};
|
|
520
|
+
|
|
502
521
|
var TableSortOrder;
|
|
503
522
|
(function (TableSortOrder) {
|
|
504
523
|
TableSortOrder[TableSortOrder["Asc"] = 1] = "Asc";
|
|
@@ -546,18 +565,57 @@ const TermGuard = (next, state) => {
|
|
|
546
565
|
class RouteGuardService {
|
|
547
566
|
HttpClient = inject(HttpClient);
|
|
548
567
|
ConfigService = inject(ConfigService);
|
|
568
|
+
SpinnerService = inject(SpinnerService);
|
|
549
569
|
constructor() { }
|
|
550
570
|
async canActivate(next, state) {
|
|
551
571
|
this.ChangeRoute(next.data["pageRoot"]);
|
|
572
|
+
this.ValidateToken(next.data["pageRoot"]);
|
|
552
573
|
}
|
|
553
574
|
ChangeRoute(pageRoot) {
|
|
554
|
-
this.HttpClient.get(`${this.ConfigService.environment?.securityPath}/Menu/GetBreadcrumbs/${pageRoot}`).subscribe(response => {
|
|
575
|
+
this.HttpClient.get(`${this.ConfigService.environment?.securityPath}/Menu/ignore/GetBreadcrumbs/${pageRoot}`).subscribe(response => {
|
|
555
576
|
let eventChangeRoute = new CustomEvent("ChangeRoute", {
|
|
556
577
|
detail: { Breadcrumbs: response },
|
|
557
578
|
});
|
|
558
579
|
window.dispatchEvent(eventChangeRoute);
|
|
559
580
|
});
|
|
560
581
|
}
|
|
582
|
+
ValidateToken(pageRoot) {
|
|
583
|
+
const cookieAttributesGeneral = GetCookieAttributes(this.ConfigService.environment?.environment ?? "");
|
|
584
|
+
const authenticationLocation = `${this.ConfigService.environment?.authenticationWeb}?callback=${window.location.href}&clientID=${this.ConfigService.environment?.clientID}`;
|
|
585
|
+
const path = `${this.ConfigService.environment?.authenticationPath ?? ""}/Authenticate/ignore/auth/token/validate`;
|
|
586
|
+
const authenticationClientID = this.ConfigService.environment?.clientID ?? "";
|
|
587
|
+
const validateTokenQuery = {
|
|
588
|
+
token: getCookie("token") ?? "",
|
|
589
|
+
refreshToken: getCookie("refreshToken") ?? "",
|
|
590
|
+
ip: "",
|
|
591
|
+
clientID: this.ConfigService.environment?.clientID ?? "",
|
|
592
|
+
pageRoot,
|
|
593
|
+
controller: "",
|
|
594
|
+
httpVerb: "GET",
|
|
595
|
+
businessUserClientGroupID: getCookie("businessUserClientGroupID") ?? "",
|
|
596
|
+
access: authenticationClientID == "" ? "" : getCookie(authenticationClientID) ?? "",
|
|
597
|
+
};
|
|
598
|
+
this.SpinnerService.show();
|
|
599
|
+
this.HttpClient.post(path, validateTokenQuery).subscribe(response => {
|
|
600
|
+
if (response.expired) {
|
|
601
|
+
Object.keys(Cookies.get() ?? {}).forEach(cookieName => {
|
|
602
|
+
Cookies.remove(cookieName, GetCookieAttributes(this.ConfigService.environment?.environment ?? ""));
|
|
603
|
+
});
|
|
604
|
+
window.location.href = authenticationLocation;
|
|
605
|
+
this.SpinnerService.hide();
|
|
606
|
+
return false;
|
|
607
|
+
}
|
|
608
|
+
else if (response.unauthorized) {
|
|
609
|
+
window.location.href = window.location.origin;
|
|
610
|
+
this.SpinnerService.hide();
|
|
611
|
+
return false;
|
|
612
|
+
}
|
|
613
|
+
else if (response.newToken != "")
|
|
614
|
+
setCookie("token", response.newToken, cookieAttributesGeneral);
|
|
615
|
+
this.SpinnerService.hide();
|
|
616
|
+
return true;
|
|
617
|
+
});
|
|
618
|
+
}
|
|
561
619
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.1", ngImport: i0, type: RouteGuardService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
562
620
|
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.1", ngImport: i0, type: RouteGuardService, providedIn: "root" });
|
|
563
621
|
}
|
|
@@ -8073,7 +8131,7 @@ class ElementService {
|
|
|
8073
8131
|
if (!pageRootValue)
|
|
8074
8132
|
return of();
|
|
8075
8133
|
this.PageRoot = pageRootValue;
|
|
8076
|
-
return this.pageElementService.GetElements(this.PageRoot).pipe(tap(elements => (this.Elements = elements)), map(() => void 0));
|
|
8134
|
+
return this.pageElementService.GetElements(this.PageRoot).pipe(tap$1(elements => (this.Elements = elements)), map(() => void 0));
|
|
8077
8135
|
}
|
|
8078
8136
|
/**
|
|
8079
8137
|
* Verify if page has available element by description
|
|
@@ -10501,5 +10559,5 @@ const IntelicaTheme = definePreset(Aura, {
|
|
|
10501
10559
|
* Generated bundle index. Do not edit.
|
|
10502
10560
|
*/
|
|
10503
10561
|
|
|
10504
|
-
export { ActionDirective, ActionsMenuComponent, ButtonSplitComponent, CheckboxFilterDirective, Color, ColumnComponent, ColumnGroupComponent, CompareByField, CompressService, ConfigService, CookieAttributesGeneral, DataDirective, DateFilterDirective, DateModeOptions, DynamicInputValidation, EchartComponent, EchartService, ElementService, EmailInputValidation, ErrorInterceptor, FeatureFlagService, FilterChipsComponent, FiltersComponent, FormatAmountPipe, GetCookieAttributes, GlobalFeatureFlagService, GlobalTermService, HtmlToExcelService, InitializeConfigService, InputValidation, IntelicaCellCheckboxDirective, IntelicaTheme, ItemSplitDirective, LanguageService, MatrixColumnComponent, MatrixColumnGroupComponent, MatrixTableComponent, ModalDialogComponent, MultiSelectComponent, OrderConstants, PaginatorComponent, Patterns, PopoverComponent, RecordPerPageComponent, RefreshTokenInterceptor, RouteGuard, RowResumenComponent, RowResumenTreeComponent, SearchComponent, SelectDetailFilterDirective, SelectFilterDirective, SharedService, SkeletonChartComponent, SkeletonComponent, SkeletonService, SkeletonTableComponent, SortingComponent, SpinnerComponent, SpinnerService, SweetAlertService, TableComponent, TableFetchComponent, TableSortOrder, TemplateDirective, TemplateMenuComponent, TermGuard, TermPipe, TermService, TextAreaFilterDirective, TextFilterDirective, TextRangeFilterDirective, TitlesComponent, TreeColumnComponent, TreeColumnGroupComponent, TreeTableComponent, TreeTableFetchComponent, TruncatePipe, decryptData, encryptData, getColor };
|
|
10562
|
+
export { ActionDirective, ActionsMenuComponent, ButtonSplitComponent, CheckboxFilterDirective, Color, ColumnComponent, ColumnGroupComponent, CompareByField, CompressService, ConfigService, CookieAttributesGeneral, DataDirective, DateFilterDirective, DateModeOptions, DynamicInputValidation, EchartComponent, EchartService, ElementService, EmailInputValidation, ErrorInterceptor, FeatureFlagService, FilterChipsComponent, FiltersComponent, FormatAmountPipe, GetCookieAttributes, GlobalFeatureFlagService, GlobalTermService, HtmlToExcelService, InitializeConfigService, InputValidation, IntelicaCellCheckboxDirective, IntelicaTheme, ItemSplitDirective, LanguageService, MatrixColumnComponent, MatrixColumnGroupComponent, MatrixTableComponent, ModalDialogComponent, MultiSelectComponent, OrderConstants, PaginatorComponent, Patterns, PopoverComponent, RecordPerPageComponent, RefreshTokenInterceptor, ResponseHeadersInterceptor, RouteGuard, RowResumenComponent, RowResumenTreeComponent, SearchComponent, SelectDetailFilterDirective, SelectFilterDirective, SharedService, SkeletonChartComponent, SkeletonComponent, SkeletonService, SkeletonTableComponent, SortingComponent, SpinnerComponent, SpinnerService, SweetAlertService, TableComponent, TableFetchComponent, TableSortOrder, TemplateDirective, TemplateMenuComponent, TermGuard, TermPipe, TermService, TextAreaFilterDirective, TextFilterDirective, TextRangeFilterDirective, TitlesComponent, TreeColumnComponent, TreeColumnGroupComponent, TreeTableComponent, TreeTableFetchComponent, TruncatePipe, decryptData, encryptData, getColor };
|
|
10505
10563
|
//# sourceMappingURL=intelica-library-ui.mjs.map
|