codefoxcore 0.0.16 → 0.0.18

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,10 +1,10 @@
1
- import { Subject, filter, Observable, takeUntil, timer, of, tap, map, throwError } from 'rxjs';
1
+ import { Subject, filter, Observable, takeUntil, timer, catchError, EMPTY, of, tap, map, throwError } from 'rxjs';
2
2
  import * as i0 from '@angular/core';
3
3
  import { InjectionToken, inject, Injector, PLATFORM_ID, ApplicationRef, createComponent, Injectable, ChangeDetectorRef, DestroyRef, makeEnvironmentProviders, Pipe } from '@angular/core';
4
4
  import { isPlatformBrowser, DOCUMENT } from '@angular/common';
5
5
  import { Title } from '@angular/platform-browser';
6
- import { HttpClient, HTTP_INTERCEPTORS } from '@angular/common/http';
7
- import { catchError } from 'rxjs/operators';
6
+ import { HttpErrorResponse, HttpClient, HTTP_INTERCEPTORS } from '@angular/common/http';
7
+ import { catchError as catchError$1 } from 'rxjs/operators';
8
8
 
9
9
  class DialogRef {
10
10
  constructor() {
@@ -220,6 +220,11 @@ const MESSAGE_DEFAULT_CONFIGURATION = new InjectionToken('Message default config
220
220
  };
221
221
  }
222
222
  });
223
+ const MESSAGE_DEFAULT_ERROR_TITLE = new InjectionToken('Message default error title', {
224
+ factory: () => {
225
+ return 'Hiba';
226
+ }
227
+ });
223
228
 
224
229
  const LOG_LEVEL = new InjectionToken('Log level', {
225
230
  factory: () => {
@@ -474,6 +479,7 @@ class DialogService {
474
479
  confirm(configuration, dialogConfiguration = {}, component) {
475
480
  if (typeof configuration === 'string') {
476
481
  if (configuration.startsWith('translate:')) {
482
+ configuration = configuration.substr(10);
477
483
  configuration = {
478
484
  title: configuration + '.title',
479
485
  text: configuration + '.text',
@@ -587,6 +593,28 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
587
593
  }]
588
594
  }], ctorParameters: function () { return []; } });
589
595
 
596
+ function isBrowser() {
597
+ const platformId = inject(PLATFORM_ID);
598
+ return isPlatformBrowser(platformId);
599
+ }
600
+ function localStorage() {
601
+ const document = inject(DOCUMENT);
602
+ if (document.defaultView !== null) {
603
+ return document.defaultView.window.localStorage;
604
+ }
605
+ return null;
606
+ }
607
+ function sessionStorage() {
608
+ const document = inject(DOCUMENT);
609
+ if (document.defaultView !== null) {
610
+ return document.defaultView.window.sessionStorage;
611
+ }
612
+ return null;
613
+ }
614
+ function isServerError(error) {
615
+ return error instanceof HttpErrorResponse && typeof error.error === 'object' && error.error['message'] !== undefined && typeof error.error['message'] === 'string';
616
+ }
617
+
590
618
  class MessageService {
591
619
  /**
592
620
  * Show
@@ -731,6 +759,14 @@ class MessageService {
731
759
  messageElement.remove();
732
760
  });
733
761
  }
762
+ handleApiError(title = undefined) {
763
+ return source$ => source$.pipe(catchError((error) => {
764
+ if (isServerError(error)) {
765
+ this.showDangerMessage(title || this.defaultErrorTitle, error.error.message);
766
+ }
767
+ return EMPTY;
768
+ }));
769
+ }
734
770
  constructor() {
735
771
  /**
736
772
  * Default configuration
@@ -738,6 +774,10 @@ class MessageService {
738
774
  * Can be changed if you overwrite it or use the `MESSAGE_DEFAULT_CONFIGURATION` InjectionToken
739
775
  */
740
776
  this.defaultConfiguration = inject(MESSAGE_DEFAULT_CONFIGURATION);
777
+ /**
778
+ * Default error title
779
+ */
780
+ this.defaultErrorTitle = inject(MESSAGE_DEFAULT_ERROR_TITLE);
741
781
  /**
742
782
  * Message subject
743
783
  */
@@ -894,25 +934,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
894
934
  }]
895
935
  }] });
896
936
 
897
- function isBrowser() {
898
- const platformId = inject(PLATFORM_ID);
899
- return isPlatformBrowser(platformId);
900
- }
901
- function localStorage() {
902
- const document = inject(DOCUMENT);
903
- if (document.defaultView !== null) {
904
- return document.defaultView.window.localStorage;
905
- }
906
- return null;
907
- }
908
- function sessionStorage() {
909
- const document = inject(DOCUMENT);
910
- if (document.defaultView !== null) {
911
- return document.defaultView.window.sessionStorage;
912
- }
913
- return null;
914
- }
915
-
916
937
  class CookieService {
917
938
  constructor() {
918
939
  this.browser = isBrowser();
@@ -1319,6 +1340,23 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
1319
1340
  }]
1320
1341
  }] });
1321
1342
 
1343
+ class MicroDataService {
1344
+ constructor() {
1345
+ this.microData = {};
1346
+ }
1347
+ getMicroData(key, defaultOnUndefined = '') {
1348
+ return this.microData[key] || defaultOnUndefined;
1349
+ }
1350
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: MicroDataService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
1351
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: MicroDataService, providedIn: 'root' }); }
1352
+ }
1353
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: MicroDataService, decorators: [{
1354
+ type: Injectable,
1355
+ args: [{
1356
+ providedIn: 'root'
1357
+ }]
1358
+ }] });
1359
+
1322
1360
  class Dialog {
1323
1361
  constructor() {
1324
1362
  this.ref = inject(DialogRef);
@@ -1429,7 +1467,7 @@ class ErrorInterceptor extends BaseInterceptor {
1429
1467
  if (this.skipInterceptor()) {
1430
1468
  return next.handle(request);
1431
1469
  }
1432
- return next.handle(request).pipe(catchError((httpErrorResponse) => {
1470
+ return next.handle(request).pipe(catchError$1((httpErrorResponse) => {
1433
1471
  if (this.interceptorsService.errorCallbackfunction !== null && !this.interceptorsService.errorSkipStatusCodes.includes(httpErrorResponse.status)) {
1434
1472
  this.loggerService.info('Error Interceptor Callback Function Called');
1435
1473
  this.interceptorsService.errorCallbackfunction(httpErrorResponse);
@@ -1512,9 +1550,27 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
1512
1550
  }]
1513
1551
  }] });
1514
1552
 
1553
+ class MicroDataPipe {
1554
+ constructor() {
1555
+ this.microDataService = inject(MicroDataService);
1556
+ }
1557
+ transform(key, defaultOnUndefined = '') {
1558
+ return this.microDataService.getMicroData(key, defaultOnUndefined);
1559
+ }
1560
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: MicroDataPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
1561
+ static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "16.2.12", ngImport: i0, type: MicroDataPipe, isStandalone: true, name: "microdata" }); }
1562
+ }
1563
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: MicroDataPipe, decorators: [{
1564
+ type: Pipe,
1565
+ args: [{
1566
+ standalone: true,
1567
+ name: 'microdata'
1568
+ }]
1569
+ }] });
1570
+
1515
1571
  /**
1516
1572
  * Generated bundle index. Do not edit.
1517
1573
  */
1518
1574
 
1519
- export { ALERT_CONFIGURATIONS, ALERT_DEFAULT_BUTTON_CONFIGURATION, AcceptValidationMode, ApiService, CONFIRM_CONFIGURATIONS, ConfirmDialog, CookieService, DIALOG_ALERT_COMPONENT, DIALOG_CONFIRM_COMPONENT, Dialog, DialogConfig, DialogInjector, DialogRef, DialogService, ErrorInterceptor, GOOGLE_MAPS_API_KEY, GoogleMapsService, InterceptorType, LOG_LEVEL, LogLevel, LoggerService, MESSAGE_DEFAULT_CONFIGURATION, MessagePosition, MessageService, MessageSeverity, OPENED_DIALOG_BODY_CLASS, PREDEFINED_DIALOGS, Precheck, PrecheckInterceptor, TokenInterceptor, TokenService, TokenServiceMode, TranslatePipe, TranslateService, isBrowser, localStorage, provideConfirmConfigurations, provideDialogAlertComponent, provideDialogConfirmComponent, provideGoogleMapsApiKey, provideOpenedDialogBodyClass, providePredefinedDialogs, provideTokenInterceptor, sessionStorage };
1575
+ export { ALERT_CONFIGURATIONS, ALERT_DEFAULT_BUTTON_CONFIGURATION, AcceptValidationMode, ApiService, CONFIRM_CONFIGURATIONS, ConfirmDialog, CookieService, DIALOG_ALERT_COMPONENT, DIALOG_CONFIRM_COMPONENT, Dialog, DialogConfig, DialogInjector, DialogRef, DialogService, ErrorInterceptor, GOOGLE_MAPS_API_KEY, GoogleMapsService, InterceptorType, LOG_LEVEL, LogLevel, LoggerService, MESSAGE_DEFAULT_CONFIGURATION, MESSAGE_DEFAULT_ERROR_TITLE, MessagePosition, MessageService, MessageSeverity, MicroDataPipe, MicroDataService, OPENED_DIALOG_BODY_CLASS, PREDEFINED_DIALOGS, Precheck, PrecheckInterceptor, TokenInterceptor, TokenService, TokenServiceMode, TranslatePipe, TranslateService, isBrowser, isServerError, localStorage, provideConfirmConfigurations, provideDialogAlertComponent, provideDialogConfirmComponent, provideGoogleMapsApiKey, provideOpenedDialogBodyClass, providePredefinedDialogs, provideTokenInterceptor, sessionStorage };
1520
1576
  //# sourceMappingURL=codefoxcore.mjs.map