intelica-library-components 1.1.52 → 1.1.54

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.
@@ -455,32 +455,31 @@ const ErrorInterceptor = (req, next) => {
455
455
  HeaderSettings["ClientID"] = configService.environment?.clientID ?? "";
456
456
  HeaderSettings["PageRoot"] = commonFeatureFlagService.GetPageRoot();
457
457
  HeaderSettings["LanguageCode"] = getCookie("language") ?? "";
458
- HeaderSettings["Environment"] =
459
- configService.environment?.environment ?? "";
460
- HeaderSettings["Access"] =
461
- authenticationClientID == ""
462
- ? ""
463
- : getCookie(authenticationClientID) ?? "";
458
+ HeaderSettings["Environment"] = configService.environment?.environment ?? "";
459
+ HeaderSettings["Access"] = authenticationClientID == "" ? "" : getCookie(authenticationClientID) ?? "";
464
460
  }
465
461
  let _request = req.clone({ headers: new HttpHeaders(HeaderSettings) });
466
462
  return next(_request).pipe(catchError(handleErrorResponse));
467
463
  function handleErrorResponse(error) {
468
- console.log(error, "error");
464
+ console.log(error, "error", error.status);
469
465
  spinnerService.hide();
470
- if (error.status == 500)
471
- sweetAlertService.messageBox(error.error.message);
472
- if (error.status == 400)
473
- sweetAlertService.messageBox(error.error.message);
474
- if (error.status == 409)
475
- sweetAlertService.messageBox(error.error.message);
476
- if (error.status == 401)
477
- sweetAlertService.messageBox("No tiene acceso al recurso solicitado");
466
+ const authenticationLocation = `${configService.environment?.authenticationWeb}?callback=${window.location.href}&clientID=${configService.environment?.clientID}`;
478
467
  if (error.status == 503 || error.status == 0)
479
468
  sweetAlertService.messageBox("El servicio que se necesita consumir no esta activo o no responde.");
480
- if (error.status == 405)
469
+ else if (error.status == 405)
481
470
  sweetAlertService.messageBox("Los parametros enviados al servicio no coinciden.");
482
- if (error.status == 404)
471
+ else if (error.status == 404)
483
472
  sweetAlertService.messageBox("Recurso no encontrado.");
473
+ else if (error.status == 401) {
474
+ sweetAlertService.messageBox(error.error.Error);
475
+ window.location.href = authenticationLocation;
476
+ }
477
+ else if (error.status == 403) {
478
+ sweetAlertService.messageBox(error.error.Error);
479
+ window.location.href = window.location.origin;
480
+ }
481
+ else
482
+ sweetAlertService.messageBox(error.error.message);
484
483
  return throwError(() => {
485
484
  error.error, error.message;
486
485
  });
@@ -688,64 +687,11 @@ const RefreshTokenInterceptor = (req, next) => {
688
687
  return next(_request);
689
688
  };
690
689
 
691
- const ErrorNewInterceptor = (req, next) => {
692
- const skip = req.headers.has("Skip-Interceptor");
693
- if (skip) {
694
- const cleanReq = req.clone({
695
- headers: req.headers.delete("Skip-Interceptor"),
696
- });
697
- return next(cleanReq);
698
- }
699
- const commonFeatureFlagService = inject(GlobalFeatureFlagService);
700
- const spinnerService = inject(SpinnerService);
701
- const sweetAlertService = inject(SweetAlertService);
702
- const configService = inject(ConfigService);
703
- const HeaderSettings = {};
704
- const authenticationClientID = configService.environment?.clientID ?? "";
705
- if (!req.url.includes("environment.json")) {
706
- HeaderSettings["Accept"] = "application/json";
707
- HeaderSettings["Content-Type"] = "application/json";
708
- HeaderSettings["Authorization"] = getCookie("token") ?? "";
709
- HeaderSettings["RefreshToken"] = getCookie("refreshToken") ?? "";
710
- HeaderSettings["ClientID"] = configService.environment?.clientID ?? "";
711
- HeaderSettings["PageRoot"] = commonFeatureFlagService.GetPageRoot();
712
- HeaderSettings["LanguageCode"] = getCookie("language") ?? "";
713
- HeaderSettings["Environment"] = configService.environment?.environment ?? "";
714
- HeaderSettings["Access"] = authenticationClientID == "" ? "" : getCookie(authenticationClientID) ?? "";
715
- }
716
- let _request = req.clone({ headers: new HttpHeaders(HeaderSettings) });
717
- return next(_request).pipe(catchError(handleErrorResponse));
718
- function handleErrorResponse(error) {
719
- console.log(error, "error", error.status);
720
- spinnerService.hide();
721
- const authenticationLocation = `${configService.environment?.authenticationWeb}?callback=${window.location.href}&clientID=${configService.environment?.clientID}`;
722
- if (error.status == 503 || error.status == 0)
723
- sweetAlertService.messageBox("El servicio que se necesita consumir no esta activo o no responde.");
724
- else if (error.status == 405)
725
- sweetAlertService.messageBox("Los parametros enviados al servicio no coinciden.");
726
- else if (error.status == 404)
727
- sweetAlertService.messageBox("Recurso no encontrado.");
728
- else if (error.status == 401) {
729
- sweetAlertService.messageBox(error.error.Error);
730
- window.location.href = authenticationLocation;
731
- }
732
- else if (error.status == 403) {
733
- sweetAlertService.messageBox(error.error.Error);
734
- window.location.href = window.location.origin;
735
- }
736
- else
737
- sweetAlertService.messageBox(error.error.message);
738
- return throwError(() => {
739
- error.error, error.message;
740
- });
741
- }
742
- };
743
-
744
690
  const ResponseHeadersInterceptor = (req, next) => {
745
691
  return next(req).pipe(tap(event => {
746
692
  if (event instanceof HttpResponse) {
747
693
  const headers = event.headers;
748
- const newToken = headers.get("X-Token-New");
694
+ const newToken = headers.get("TokenNew");
749
695
  if (newToken != null && newToken != "")
750
696
  setCookie("token", newToken, CookieAttributesGeneral);
751
697
  }
@@ -824,54 +770,6 @@ const TermGuard = (next, state) => {
824
770
  };
825
771
 
826
772
  class RouteGuardService {
827
- HttpClient = inject(HttpClient);
828
- ConfigService = inject(ConfigService);
829
- constructor() { }
830
- async canActivate(next, state) {
831
- this.ChangeRoute(next.data["pageRoot"]);
832
- }
833
- ChangeRoute(pageRoot) {
834
- this.HttpClient.get(`${this.ConfigService.environment?.securityPath}/Menu/GetBreadcrumbs/${pageRoot}`).subscribe(response => {
835
- let eventChangeRoute = new CustomEvent("ChangeRoute", {
836
- detail: { Breadcrumbs: response },
837
- });
838
- window.dispatchEvent(eventChangeRoute);
839
- });
840
- }
841
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: RouteGuardService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
842
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: RouteGuardService, providedIn: "root" });
843
- }
844
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: RouteGuardService, decorators: [{
845
- type: Injectable,
846
- args: [{
847
- providedIn: "root",
848
- }]
849
- }], ctorParameters: () => [] });
850
- const RouteGuard = (next, state) => {
851
- inject(RouteGuardService).canActivate(next, state);
852
- return true;
853
- };
854
-
855
- class PageRootChildGuard {
856
- canActivateChild(child, parent) {
857
- const parentData = child.parent?.data;
858
- if (parentData?.["pageRoot"]) {
859
- child.data = {
860
- ...child.data,
861
- pageRoot: parentData["pageRoot"],
862
- };
863
- }
864
- return true;
865
- }
866
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: PageRootChildGuard, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
867
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: PageRootChildGuard, providedIn: "root" });
868
- }
869
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: PageRootChildGuard, decorators: [{
870
- type: Injectable,
871
- args: [{ providedIn: "root" }]
872
- }] });
873
-
874
- class RouteGuardNewService {
875
773
  HttpClient = inject(HttpClient);
876
774
  ConfigService = inject(ConfigService);
877
775
  SpinnerService = inject(SpinnerService);
@@ -925,20 +823,39 @@ class RouteGuardNewService {
925
823
  return true;
926
824
  });
927
825
  }
928
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: RouteGuardNewService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
929
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: RouteGuardNewService, providedIn: "root" });
826
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: RouteGuardService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
827
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: RouteGuardService, providedIn: "root" });
930
828
  }
931
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: RouteGuardNewService, decorators: [{
829
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: RouteGuardService, decorators: [{
932
830
  type: Injectable,
933
831
  args: [{
934
832
  providedIn: "root",
935
833
  }]
936
834
  }], ctorParameters: () => [] });
937
- const RouteNewGuard = (next, state) => {
938
- inject(RouteGuardNewService).canActivate(next, state);
835
+ const RouteGuard = (next, state) => {
836
+ inject(RouteGuardService).canActivate(next, state);
939
837
  return true;
940
838
  };
941
839
 
840
+ class PageRootChildGuard {
841
+ canActivateChild(child, parent) {
842
+ const parentData = child.parent?.data;
843
+ if (parentData?.["pageRoot"]) {
844
+ child.data = {
845
+ ...child.data,
846
+ pageRoot: parentData["pageRoot"],
847
+ };
848
+ }
849
+ return true;
850
+ }
851
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: PageRootChildGuard, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
852
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: PageRootChildGuard, providedIn: "root" });
853
+ }
854
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: PageRootChildGuard, decorators: [{
855
+ type: Injectable,
856
+ args: [{ providedIn: "root" }]
857
+ }] });
858
+
942
859
  class SpinnerComponent {
943
860
  spinerService = inject(SpinnerService);
944
861
  isLoading = this.spinerService.isLoading;
@@ -11295,5 +11212,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImpo
11295
11212
  * Generated bundle index. Do not edit.
11296
11213
  */
11297
11214
 
11298
- export { ALERT_DEFAULTS, ALERT_ICON_PATHS, ALERT_TYPE_CONFIG, ActionDirective, ActionsMenuComponent, AddFavoritesComponent, AlertButtonMode, AlertService, AlertType, ButtonSplitComponent, CheckboxFilterDirective, Color, ColumnComponent, ColumnGroupComponent, CompareByField, ConfigService, CookieAttributesGeneral, DATEPICKER_BUTTON_TYPES, DataDirective, DateFilterDirective, DateModeOptions, DatepickerComponent, DynamicInputValidation, EchartComponent, EchartService, ElementService, EmailInputValidation, ErrorInterceptor, ErrorNewInterceptor, FeatureFlagService, FilterChipsComponent, FiltersComponent, FormatAmountPipe, GetCookieAttributes, GlobalFavoriteService, GlobalFeatureFlagService, GlobalMenuService, GlobalTermService, HtmlToExcelService, InitializeConfigService, InputValidation, IntelicaAlertComponent, IntelicaCellCheckboxDirective, IntelicaSessionService, IntelicaTheme, ItemSplitDirective, LanguageService, MatrixColumnComponent, MatrixColumnGroupComponent, MatrixTableComponent, ModalDialogComponent, MultiSelectComponent, NotificationJobService, NotificationOrchestratorService, NotificationService, NotificationSignalRService, OrderConstants, PageInformation, PageRootChildGuard, PaginatorComponent, Patterns, PopoverComponent, ProfileService, RecordPerPageComponent, RefreshTokenInterceptor, RequestCacheService, ResponseHeadersInterceptor, RouteGuard, RouteNewGuard, 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, TreeColumnComponent, TreeColumnGroupComponent, TreeTableComponent, TruncatePipe, decryptData, encryptData, getColor };
11215
+ export { ALERT_DEFAULTS, ALERT_ICON_PATHS, ALERT_TYPE_CONFIG, ActionDirective, ActionsMenuComponent, AddFavoritesComponent, AlertButtonMode, AlertService, AlertType, ButtonSplitComponent, CheckboxFilterDirective, Color, ColumnComponent, ColumnGroupComponent, CompareByField, ConfigService, CookieAttributesGeneral, DATEPICKER_BUTTON_TYPES, DataDirective, DateFilterDirective, DateModeOptions, DatepickerComponent, DynamicInputValidation, EchartComponent, EchartService, ElementService, EmailInputValidation, ErrorInterceptor, FeatureFlagService, FilterChipsComponent, FiltersComponent, FormatAmountPipe, GetCookieAttributes, GlobalFavoriteService, GlobalFeatureFlagService, GlobalMenuService, GlobalTermService, HtmlToExcelService, InitializeConfigService, InputValidation, IntelicaAlertComponent, IntelicaCellCheckboxDirective, IntelicaSessionService, IntelicaTheme, ItemSplitDirective, LanguageService, MatrixColumnComponent, MatrixColumnGroupComponent, MatrixTableComponent, ModalDialogComponent, MultiSelectComponent, NotificationJobService, NotificationOrchestratorService, NotificationService, NotificationSignalRService, OrderConstants, PageInformation, PageRootChildGuard, PaginatorComponent, Patterns, PopoverComponent, ProfileService, RecordPerPageComponent, RefreshTokenInterceptor, RequestCacheService, 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, TreeColumnComponent, TreeColumnGroupComponent, TreeTableComponent, TruncatePipe, decryptData, encryptData, getColor };
11299
11216
  //# sourceMappingURL=intelica-library-components.mjs.map