codefoxcore 0.0.17 → 0.0.19
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/esm2022/lib/helpers.mjs +5 -1
- package/esm2022/lib/interceptors/token.interceptor.mjs +4 -4
- package/esm2022/lib/interfaces.mjs +1 -1
- package/esm2022/lib/pipes/imagesize.pipe.mjs +25 -0
- package/esm2022/lib/pipes/index.mjs +3 -1
- package/esm2022/lib/pipes/microdata.pipe.mjs +21 -0
- package/esm2022/lib/providers.mjs +8 -2
- package/esm2022/lib/services/api.service.mjs +3 -2
- package/esm2022/lib/services/index.mjs +2 -1
- package/esm2022/lib/services/message.service.mjs +16 -3
- package/esm2022/lib/services/microdata.service.mjs +19 -0
- package/esm2022/lib/services/token.service.mjs +33 -22
- package/esm2022/lib/tokens/api.token.mjs +7 -0
- package/esm2022/lib/tokens/index.mjs +2 -1
- package/esm2022/lib/tokens/message.token.mjs +6 -1
- package/fesm2022/codefoxcore.mjs +149 -49
- package/fesm2022/codefoxcore.mjs.map +1 -1
- package/lib/helpers.d.ts +2 -0
- package/lib/interfaces.d.ts +6 -0
- package/lib/pipes/imagesize.pipe.d.ts +7 -0
- package/lib/pipes/index.d.ts +2 -0
- package/lib/pipes/microdata.pipe.d.ts +9 -0
- package/lib/providers.d.ts +1 -0
- package/lib/services/index.d.ts +1 -0
- package/lib/services/message.service.d.ts +6 -0
- package/lib/services/microdata.service.d.ts +9 -0
- package/lib/services/token.service.d.ts +9 -5
- package/lib/tokens/api.token.d.ts +2 -0
- package/lib/tokens/index.d.ts +1 -0
- package/lib/tokens/message.token.d.ts +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { InjectionToken } from "@angular/core";
|
|
2
|
+
export const API_BASE_URL = new InjectionToken('Api base url', {
|
|
3
|
+
factory: () => {
|
|
4
|
+
return null;
|
|
5
|
+
}
|
|
6
|
+
});
|
|
7
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYXBpLnRva2VuLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vLi4vcHJvamVjdHMvY29kZWZveGNvcmUvc3JjL2xpYi90b2tlbnMvYXBpLnRva2VuLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sRUFBRSxjQUFjLEVBQUUsTUFBTSxlQUFlLENBQUM7QUFFL0MsTUFBTSxDQUFDLE1BQU0sWUFBWSxHQUFrQyxJQUFJLGNBQWMsQ0FBQyxjQUFjLEVBQUU7SUFDMUYsT0FBTyxFQUFFLEdBQWtCLEVBQUU7UUFDekIsT0FBTyxJQUFJLENBQUM7SUFDaEIsQ0FBQztDQUNKLENBQUMsQ0FBQyIsInNvdXJjZXNDb250ZW50IjpbImltcG9ydCB7IEluamVjdGlvblRva2VuIH0gZnJvbSBcIkBhbmd1bGFyL2NvcmVcIjtcclxuXHJcbmV4cG9ydCBjb25zdCBBUElfQkFTRV9VUkw6IEluamVjdGlvblRva2VuPHN0cmluZyB8IG51bGw+ID0gbmV3IEluamVjdGlvblRva2VuKCdBcGkgYmFzZSB1cmwnLCB7XHJcbiAgICBmYWN0b3J5OiAoKTogc3RyaW5nIHwgbnVsbCA9PiB7XHJcbiAgICAgICAgcmV0dXJuIG51bGw7XHJcbiAgICB9XHJcbn0pO1xyXG4iXX0=
|
|
@@ -4,4 +4,5 @@ export * from './confirm.token';
|
|
|
4
4
|
export * from './message.token';
|
|
5
5
|
export * from './loglevel.token';
|
|
6
6
|
export * from './google.maps.token';
|
|
7
|
-
|
|
7
|
+
export * from './api.token';
|
|
8
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi9wcm9qZWN0cy9jb2RlZm94Y29yZS9zcmMvbGliL3Rva2Vucy9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxjQUFjLGVBQWUsQ0FBQztBQUM5QixjQUFjLGdCQUFnQixDQUFDO0FBQy9CLGNBQWMsaUJBQWlCLENBQUM7QUFDaEMsY0FBYyxpQkFBaUIsQ0FBQztBQUNoQyxjQUFjLGtCQUFrQixDQUFDO0FBQ2pDLGNBQWMscUJBQXFCLENBQUM7QUFDcEMsY0FBYyxhQUFhLENBQUMiLCJzb3VyY2VzQ29udGVudCI6WyJleHBvcnQgKiBmcm9tICcuL2FsZXJ0LnRva2VuJztcclxuZXhwb3J0ICogZnJvbSAnLi9kaWFsb2cudG9rZW4nO1xyXG5leHBvcnQgKiBmcm9tICcuL2NvbmZpcm0udG9rZW4nO1xyXG5leHBvcnQgKiBmcm9tICcuL21lc3NhZ2UudG9rZW4nO1xyXG5leHBvcnQgKiBmcm9tICcuL2xvZ2xldmVsLnRva2VuJztcclxuZXhwb3J0ICogZnJvbSAnLi9nb29nbGUubWFwcy50b2tlbic7XHJcbmV4cG9ydCAqIGZyb20gJy4vYXBpLnRva2VuJztcclxuIl19
|
|
@@ -11,4 +11,9 @@ export const MESSAGE_DEFAULT_CONFIGURATION = new InjectionToken('Message default
|
|
|
11
11
|
};
|
|
12
12
|
}
|
|
13
13
|
});
|
|
14
|
-
|
|
14
|
+
export const MESSAGE_DEFAULT_ERROR_TITLE = new InjectionToken('Message default error title', {
|
|
15
|
+
factory: () => {
|
|
16
|
+
return 'Hiba';
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibWVzc2FnZS50b2tlbi5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uLy4uL3Byb2plY3RzL2NvZGVmb3hjb3JlL3NyYy9saWIvdG9rZW5zL21lc3NhZ2UudG9rZW4udHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxFQUFFLGNBQWMsRUFBRSxNQUFNLGVBQWUsQ0FBQztBQUMvQyxPQUFPLEVBQXdCLGVBQWUsRUFBRSxlQUFlLEVBQUUsTUFBTSxlQUFlLENBQUM7QUFFdkYsTUFBTSxDQUFDLE1BQU0sNkJBQTZCLEdBQXlDLElBQUksY0FBYyxDQUFDLCtCQUErQixFQUFFO0lBQ3RJLE9BQU8sRUFBRSxHQUF5QixFQUFFO1FBQ25DLE9BQU87WUFDTixTQUFTLEVBQUUsSUFBSTtZQUNmLFFBQVEsRUFBRSxJQUFJO1lBQ2QsUUFBUSxFQUFFLGVBQWUsQ0FBQyxHQUFHO1lBQzdCLFFBQVEsRUFBRSxlQUFlLENBQUMsT0FBTztZQUNqQyxXQUFXLEVBQUUsS0FBSztTQUNsQixDQUFDO0lBQ0gsQ0FBQztDQUNELENBQUMsQ0FBQztBQUVILE1BQU0sQ0FBQyxNQUFNLDJCQUEyQixHQUEyQixJQUFJLGNBQWMsQ0FBQyw2QkFBNkIsRUFBRTtJQUNwSCxPQUFPLEVBQUUsR0FBVyxFQUFFO1FBQ3JCLE9BQU8sTUFBTSxDQUFDO0lBQ2YsQ0FBQztDQUNELENBQUMsQ0FBQyIsInNvdXJjZXNDb250ZW50IjpbImltcG9ydCB7IEluamVjdGlvblRva2VuIH0gZnJvbSBcIkBhbmd1bGFyL2NvcmVcIjtcclxuaW1wb3J0IHsgTWVzc2FnZUNvbmZpZ3VyYXRpb24sIE1lc3NhZ2VQb3NpdGlvbiwgTWVzc2FnZVNldmVyaXR5IH0gZnJvbSBcIi4uL2ludGVyZmFjZXNcIjtcclxuXHJcbmV4cG9ydCBjb25zdCBNRVNTQUdFX0RFRkFVTFRfQ09ORklHVVJBVElPTjogSW5qZWN0aW9uVG9rZW48TWVzc2FnZUNvbmZpZ3VyYXRpb24+ID0gbmV3IEluamVjdGlvblRva2VuKCdNZXNzYWdlIGRlZmF1bHQgY29uZmlndXJhdGlvbicsIHtcclxuXHRmYWN0b3J5OiAoKTogTWVzc2FnZUNvbmZpZ3VyYXRpb24gPT4ge1xyXG5cdFx0cmV0dXJuIHtcclxuXHRcdFx0Y2xvc2VhYmxlOiB0cnVlLFxyXG5cdFx0XHRsaWZldGltZTogMzAwMCxcclxuXHRcdFx0cG9zaXRpb246IE1lc3NhZ2VQb3NpdGlvbi5UT1AsXHJcblx0XHRcdHNldmVyaXR5OiBNZXNzYWdlU2V2ZXJpdHkuU1VDQ0VTUyxcclxuXHRcdFx0a2VlcE9uSG92ZXI6IGZhbHNlXHJcblx0XHR9O1xyXG5cdH1cclxufSk7XHJcblxyXG5leHBvcnQgY29uc3QgTUVTU0FHRV9ERUZBVUxUX0VSUk9SX1RJVExFOiBJbmplY3Rpb25Ub2tlbjxzdHJpbmc+ID0gbmV3IEluamVjdGlvblRva2VuKCdNZXNzYWdlIGRlZmF1bHQgZXJyb3IgdGl0bGUnLCB7XHJcblx0ZmFjdG9yeTogKCk6IHN0cmluZyA9PiB7XHJcblx0XHRyZXR1cm4gJ0hpYmEnO1xyXG5cdH1cclxufSk7XHJcbiJdfQ==
|
package/fesm2022/codefoxcore.mjs
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { Subject, filter, Observable, takeUntil, timer,
|
|
1
|
+
import { Subject, filter, Observable, takeUntil, timer, catchError, EMPTY, tap, of, 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: () => {
|
|
@@ -233,6 +238,12 @@ const GOOGLE_MAPS_API_KEY = new InjectionToken('Google Maps Api Key', {
|
|
|
233
238
|
}
|
|
234
239
|
});
|
|
235
240
|
|
|
241
|
+
const API_BASE_URL = new InjectionToken('Api base url', {
|
|
242
|
+
factory: () => {
|
|
243
|
+
return null;
|
|
244
|
+
}
|
|
245
|
+
});
|
|
246
|
+
|
|
236
247
|
class DialogService {
|
|
237
248
|
constructor() {
|
|
238
249
|
this.injector = inject(Injector);
|
|
@@ -588,6 +599,28 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
|
|
|
588
599
|
}]
|
|
589
600
|
}], ctorParameters: function () { return []; } });
|
|
590
601
|
|
|
602
|
+
function isBrowser() {
|
|
603
|
+
const platformId = inject(PLATFORM_ID);
|
|
604
|
+
return isPlatformBrowser(platformId);
|
|
605
|
+
}
|
|
606
|
+
function localStorage() {
|
|
607
|
+
const document = inject(DOCUMENT);
|
|
608
|
+
if (document.defaultView !== null) {
|
|
609
|
+
return document.defaultView.window.localStorage;
|
|
610
|
+
}
|
|
611
|
+
return null;
|
|
612
|
+
}
|
|
613
|
+
function sessionStorage() {
|
|
614
|
+
const document = inject(DOCUMENT);
|
|
615
|
+
if (document.defaultView !== null) {
|
|
616
|
+
return document.defaultView.window.sessionStorage;
|
|
617
|
+
}
|
|
618
|
+
return null;
|
|
619
|
+
}
|
|
620
|
+
function isServerError(error) {
|
|
621
|
+
return error instanceof HttpErrorResponse && typeof error.error === 'object' && error.error['message'] !== undefined && typeof error.error['message'] === 'string';
|
|
622
|
+
}
|
|
623
|
+
|
|
591
624
|
class MessageService {
|
|
592
625
|
/**
|
|
593
626
|
* Show
|
|
@@ -732,6 +765,14 @@ class MessageService {
|
|
|
732
765
|
messageElement.remove();
|
|
733
766
|
});
|
|
734
767
|
}
|
|
768
|
+
handleApiError(title = undefined) {
|
|
769
|
+
return source$ => source$.pipe(catchError((error) => {
|
|
770
|
+
if (isServerError(error)) {
|
|
771
|
+
this.showDangerMessage(title || this.defaultErrorTitle, error.error.message);
|
|
772
|
+
}
|
|
773
|
+
return EMPTY;
|
|
774
|
+
}));
|
|
775
|
+
}
|
|
735
776
|
constructor() {
|
|
736
777
|
/**
|
|
737
778
|
* Default configuration
|
|
@@ -739,6 +780,10 @@ class MessageService {
|
|
|
739
780
|
* Can be changed if you overwrite it or use the `MESSAGE_DEFAULT_CONFIGURATION` InjectionToken
|
|
740
781
|
*/
|
|
741
782
|
this.defaultConfiguration = inject(MESSAGE_DEFAULT_CONFIGURATION);
|
|
783
|
+
/**
|
|
784
|
+
* Default error title
|
|
785
|
+
*/
|
|
786
|
+
this.defaultErrorTitle = inject(MESSAGE_DEFAULT_ERROR_TITLE);
|
|
742
787
|
/**
|
|
743
788
|
* Message subject
|
|
744
789
|
*/
|
|
@@ -819,7 +864,7 @@ class ApiService {
|
|
|
819
864
|
constructor() {
|
|
820
865
|
this.httpClient = inject(HttpClient);
|
|
821
866
|
this.loggerService = inject(LoggerService);
|
|
822
|
-
this._apiBaseUrl =
|
|
867
|
+
this._apiBaseUrl = inject(API_BASE_URL);
|
|
823
868
|
}
|
|
824
869
|
post(endPoint, body) {
|
|
825
870
|
return this.httpClient.post(this.generateUrl(endPoint), body);
|
|
@@ -895,25 +940,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
|
|
|
895
940
|
}]
|
|
896
941
|
}] });
|
|
897
942
|
|
|
898
|
-
function isBrowser() {
|
|
899
|
-
const platformId = inject(PLATFORM_ID);
|
|
900
|
-
return isPlatformBrowser(platformId);
|
|
901
|
-
}
|
|
902
|
-
function localStorage() {
|
|
903
|
-
const document = inject(DOCUMENT);
|
|
904
|
-
if (document.defaultView !== null) {
|
|
905
|
-
return document.defaultView.window.localStorage;
|
|
906
|
-
}
|
|
907
|
-
return null;
|
|
908
|
-
}
|
|
909
|
-
function sessionStorage() {
|
|
910
|
-
const document = inject(DOCUMENT);
|
|
911
|
-
if (document.defaultView !== null) {
|
|
912
|
-
return document.defaultView.window.sessionStorage;
|
|
913
|
-
}
|
|
914
|
-
return null;
|
|
915
|
-
}
|
|
916
|
-
|
|
917
943
|
class CookieService {
|
|
918
944
|
constructor() {
|
|
919
945
|
this.browser = isBrowser();
|
|
@@ -1009,30 +1035,40 @@ class TokenService {
|
|
|
1009
1035
|
this.sessionStorage = sessionStorage();
|
|
1010
1036
|
this.isBrowser = isBrowser();
|
|
1011
1037
|
this.cookiePath = null;
|
|
1012
|
-
this.
|
|
1013
|
-
this.
|
|
1014
|
-
this.
|
|
1038
|
+
this.sessionToken = null;
|
|
1039
|
+
this.sessionTokenKey = 'acccessToken';
|
|
1040
|
+
this.sessionTokenCookieExpireDays = 30;
|
|
1015
1041
|
this.mode = TokenServiceMode.LOCALSTORAGE;
|
|
1016
1042
|
}
|
|
1017
|
-
init(
|
|
1018
|
-
this.
|
|
1043
|
+
init(sessionTokenKey, mode = null, readAndStore = true) {
|
|
1044
|
+
this.sessionTokenKey = sessionTokenKey;
|
|
1019
1045
|
if (mode !== null) {
|
|
1020
1046
|
this.mode = mode;
|
|
1021
1047
|
}
|
|
1022
1048
|
if (readAndStore) {
|
|
1023
|
-
this.
|
|
1049
|
+
this.sessionToken = this.read();
|
|
1024
1050
|
}
|
|
1025
1051
|
}
|
|
1026
|
-
|
|
1027
|
-
this.
|
|
1052
|
+
initWithCall(sessionTokenKey, mode, initCall) {
|
|
1053
|
+
this.sessionTokenKey = sessionTokenKey;
|
|
1054
|
+
this.mode = mode;
|
|
1055
|
+
this.sessionToken = this.read(this.mode);
|
|
1056
|
+
return initCall.pipe(tap(({ sessionToken }) => {
|
|
1057
|
+
if (this.sessionToken !== sessionToken) {
|
|
1058
|
+
this.write(sessionToken, this.mode);
|
|
1059
|
+
}
|
|
1060
|
+
}));
|
|
1061
|
+
}
|
|
1062
|
+
write(sessionToken, mode = null) {
|
|
1063
|
+
this.sessionToken = sessionToken;
|
|
1028
1064
|
if (mode === null) {
|
|
1029
1065
|
mode = this.mode;
|
|
1030
1066
|
}
|
|
1031
1067
|
switch (mode) {
|
|
1032
1068
|
case TokenServiceMode.LOCALSTORAGE:
|
|
1033
1069
|
if (this.isBrowser && this.localStorage !== null) {
|
|
1034
|
-
this.localStorage.setItem(this.
|
|
1035
|
-
this.loggerService.debug('Token set to local storage: ' + this.
|
|
1070
|
+
this.localStorage.setItem(this.sessionTokenKey, this.sessionToken);
|
|
1071
|
+
this.loggerService.debug('Token set to local storage: ' + this.sessionToken);
|
|
1036
1072
|
}
|
|
1037
1073
|
else {
|
|
1038
1074
|
this.loggerService.error('Trying to set localStorage on not a browser platform!');
|
|
@@ -1040,16 +1076,16 @@ class TokenService {
|
|
|
1040
1076
|
break;
|
|
1041
1077
|
case TokenServiceMode.SESSIONSTORAGE:
|
|
1042
1078
|
if (this.isBrowser && this.sessionStorage !== null) {
|
|
1043
|
-
this.sessionStorage.setItem(this.
|
|
1044
|
-
this.loggerService.debug('Token set to session storage: ' + this.
|
|
1079
|
+
this.sessionStorage.setItem(this.sessionTokenKey, this.sessionToken);
|
|
1080
|
+
this.loggerService.debug('Token set to session storage: ' + this.sessionToken);
|
|
1045
1081
|
}
|
|
1046
1082
|
else {
|
|
1047
1083
|
this.loggerService.error('Trying to set sessionStorage on not a browser platform!');
|
|
1048
1084
|
}
|
|
1049
1085
|
break;
|
|
1050
1086
|
case TokenServiceMode.COOKIE:
|
|
1051
|
-
this.cookieService.set(this.
|
|
1052
|
-
this.loggerService.debug('Token set to cookie: ' + this.
|
|
1087
|
+
this.cookieService.set(this.sessionTokenKey, this.sessionToken, this.sessionTokenCookieExpireDays * 24 * 60 * 60, this.cookiePath);
|
|
1088
|
+
this.loggerService.debug('Token set to cookie: ' + this.sessionToken);
|
|
1053
1089
|
break;
|
|
1054
1090
|
}
|
|
1055
1091
|
}
|
|
@@ -1061,7 +1097,7 @@ class TokenService {
|
|
|
1061
1097
|
case TokenServiceMode.LOCALSTORAGE:
|
|
1062
1098
|
this.loggerService.debug('Trying to read token from local storage');
|
|
1063
1099
|
if (this.isBrowser && this.localStorage !== null) {
|
|
1064
|
-
const tokenLocalStorage = this.localStorage.getItem(this.
|
|
1100
|
+
const tokenLocalStorage = this.localStorage.getItem(this.sessionTokenKey);
|
|
1065
1101
|
if (tokenLocalStorage !== null) {
|
|
1066
1102
|
this.loggerService.debug('Token read from local storage: ' + tokenLocalStorage);
|
|
1067
1103
|
}
|
|
@@ -1074,7 +1110,7 @@ class TokenService {
|
|
|
1074
1110
|
case TokenServiceMode.SESSIONSTORAGE:
|
|
1075
1111
|
if (this.isBrowser && this.sessionStorage !== null) {
|
|
1076
1112
|
this.loggerService.debug('Trying to read token from session storage');
|
|
1077
|
-
const tokenSessionStorage = this.sessionStorage.getItem(this.
|
|
1113
|
+
const tokenSessionStorage = this.sessionStorage.getItem(this.sessionTokenKey);
|
|
1078
1114
|
if (tokenSessionStorage !== null) {
|
|
1079
1115
|
this.loggerService.debug('Token read from session storage: ' + tokenSessionStorage);
|
|
1080
1116
|
}
|
|
@@ -1086,7 +1122,7 @@ class TokenService {
|
|
|
1086
1122
|
}
|
|
1087
1123
|
case TokenServiceMode.COOKIE: {
|
|
1088
1124
|
this.loggerService.debug('Trying to read token from session cookie');
|
|
1089
|
-
const cookieAccessToken = this.cookieService.get(this.
|
|
1125
|
+
const cookieAccessToken = this.cookieService.get(this.sessionTokenKey);
|
|
1090
1126
|
if (cookieAccessToken !== null) {
|
|
1091
1127
|
this.loggerService.debug('Token read from cookie: ' + cookieAccessToken);
|
|
1092
1128
|
}
|
|
@@ -1104,22 +1140,22 @@ class TokenService {
|
|
|
1104
1140
|
case TokenServiceMode.LOCALSTORAGE:
|
|
1105
1141
|
if (this.localStorage !== null) {
|
|
1106
1142
|
this.loggerService.debug('Token deleted from local storage');
|
|
1107
|
-
this.localStorage.removeItem(this.
|
|
1143
|
+
this.localStorage.removeItem(this.sessionTokenKey);
|
|
1108
1144
|
}
|
|
1109
1145
|
break;
|
|
1110
1146
|
case TokenServiceMode.SESSIONSTORAGE:
|
|
1111
1147
|
if (this.sessionStorage !== null) {
|
|
1112
1148
|
this.loggerService.debug('Token deleted from session storage');
|
|
1113
|
-
this.sessionStorage.removeItem(this.
|
|
1149
|
+
this.sessionStorage.removeItem(this.sessionTokenKey);
|
|
1114
1150
|
}
|
|
1115
1151
|
break;
|
|
1116
1152
|
case TokenServiceMode.COOKIE: {
|
|
1117
1153
|
this.loggerService.debug('Token deleted from cookie');
|
|
1118
|
-
this.cookieService.delete(this.
|
|
1154
|
+
this.cookieService.delete(this.sessionTokenKey);
|
|
1119
1155
|
break;
|
|
1120
1156
|
}
|
|
1121
1157
|
}
|
|
1122
|
-
this.
|
|
1158
|
+
this.sessionToken = null;
|
|
1123
1159
|
}
|
|
1124
1160
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: TokenService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
1125
1161
|
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: TokenService, providedIn: 'root' }); }
|
|
@@ -1320,6 +1356,23 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
|
|
|
1320
1356
|
}]
|
|
1321
1357
|
}] });
|
|
1322
1358
|
|
|
1359
|
+
class MicroDataService {
|
|
1360
|
+
constructor() {
|
|
1361
|
+
this.microData = {};
|
|
1362
|
+
}
|
|
1363
|
+
getMicroData(key, defaultOnUndefined = '') {
|
|
1364
|
+
return this.microData[key] || defaultOnUndefined;
|
|
1365
|
+
}
|
|
1366
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: MicroDataService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
1367
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: MicroDataService, providedIn: 'root' }); }
|
|
1368
|
+
}
|
|
1369
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: MicroDataService, decorators: [{
|
|
1370
|
+
type: Injectable,
|
|
1371
|
+
args: [{
|
|
1372
|
+
providedIn: 'root'
|
|
1373
|
+
}]
|
|
1374
|
+
}] });
|
|
1375
|
+
|
|
1323
1376
|
class Dialog {
|
|
1324
1377
|
constructor() {
|
|
1325
1378
|
this.ref = inject(DialogRef);
|
|
@@ -1371,11 +1424,11 @@ class TokenInterceptor extends BaseInterceptor {
|
|
|
1371
1424
|
if (this.skipInterceptor()) {
|
|
1372
1425
|
return next.handle(request);
|
|
1373
1426
|
}
|
|
1374
|
-
const
|
|
1375
|
-
if (
|
|
1427
|
+
const sessionToken = this.tokenService.sessionToken;
|
|
1428
|
+
if (sessionToken !== null) {
|
|
1376
1429
|
request = request.clone({
|
|
1377
1430
|
setHeaders: {
|
|
1378
|
-
Token:
|
|
1431
|
+
Token: sessionToken
|
|
1379
1432
|
}
|
|
1380
1433
|
});
|
|
1381
1434
|
}
|
|
@@ -1430,7 +1483,7 @@ class ErrorInterceptor extends BaseInterceptor {
|
|
|
1430
1483
|
if (this.skipInterceptor()) {
|
|
1431
1484
|
return next.handle(request);
|
|
1432
1485
|
}
|
|
1433
|
-
return next.handle(request).pipe(catchError((httpErrorResponse) => {
|
|
1486
|
+
return next.handle(request).pipe(catchError$1((httpErrorResponse) => {
|
|
1434
1487
|
if (this.interceptorsService.errorCallbackfunction !== null && !this.interceptorsService.errorSkipStatusCodes.includes(httpErrorResponse.status)) {
|
|
1435
1488
|
this.loggerService.info('Error Interceptor Callback Function Called');
|
|
1436
1489
|
this.interceptorsService.errorCallbackfunction(httpErrorResponse);
|
|
@@ -1494,6 +1547,12 @@ function provideDialogAlertComponent(component) {
|
|
|
1494
1547
|
useValue: component
|
|
1495
1548
|
}]);
|
|
1496
1549
|
}
|
|
1550
|
+
function provideApiBaseUrl(apiBaseUrl) {
|
|
1551
|
+
return makeEnvironmentProviders([{
|
|
1552
|
+
provide: API_BASE_URL,
|
|
1553
|
+
useValue: apiBaseUrl
|
|
1554
|
+
}]);
|
|
1555
|
+
}
|
|
1497
1556
|
|
|
1498
1557
|
class TranslatePipe {
|
|
1499
1558
|
constructor() {
|
|
@@ -1513,9 +1572,50 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
|
|
|
1513
1572
|
}]
|
|
1514
1573
|
}] });
|
|
1515
1574
|
|
|
1575
|
+
class MicroDataPipe {
|
|
1576
|
+
constructor() {
|
|
1577
|
+
this.microDataService = inject(MicroDataService);
|
|
1578
|
+
}
|
|
1579
|
+
transform(key, defaultOnUndefined = '') {
|
|
1580
|
+
return this.microDataService.getMicroData(key, defaultOnUndefined);
|
|
1581
|
+
}
|
|
1582
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: MicroDataPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
|
|
1583
|
+
static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "16.2.12", ngImport: i0, type: MicroDataPipe, isStandalone: true, name: "microdata" }); }
|
|
1584
|
+
}
|
|
1585
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: MicroDataPipe, decorators: [{
|
|
1586
|
+
type: Pipe,
|
|
1587
|
+
args: [{
|
|
1588
|
+
standalone: true,
|
|
1589
|
+
name: 'microdata'
|
|
1590
|
+
}]
|
|
1591
|
+
}] });
|
|
1592
|
+
|
|
1593
|
+
class ImageSizePipe {
|
|
1594
|
+
transform(originalUrl, size = null) {
|
|
1595
|
+
try {
|
|
1596
|
+
const url = new URL(originalUrl);
|
|
1597
|
+
if (size !== null) {
|
|
1598
|
+
url.searchParams.append('size', size.toString());
|
|
1599
|
+
}
|
|
1600
|
+
return url.toString();
|
|
1601
|
+
}
|
|
1602
|
+
catch (e) { }
|
|
1603
|
+
return originalUrl;
|
|
1604
|
+
}
|
|
1605
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ImageSizePipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
|
|
1606
|
+
static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "16.2.12", ngImport: i0, type: ImageSizePipe, isStandalone: true, name: "imagesize" }); }
|
|
1607
|
+
}
|
|
1608
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ImageSizePipe, decorators: [{
|
|
1609
|
+
type: Pipe,
|
|
1610
|
+
args: [{
|
|
1611
|
+
standalone: true,
|
|
1612
|
+
name: 'imagesize'
|
|
1613
|
+
}]
|
|
1614
|
+
}] });
|
|
1615
|
+
|
|
1516
1616
|
/**
|
|
1517
1617
|
* Generated bundle index. Do not edit.
|
|
1518
1618
|
*/
|
|
1519
1619
|
|
|
1520
|
-
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 };
|
|
1620
|
+
export { ALERT_CONFIGURATIONS, ALERT_DEFAULT_BUTTON_CONFIGURATION, API_BASE_URL, AcceptValidationMode, ApiService, CONFIRM_CONFIGURATIONS, ConfirmDialog, CookieService, DIALOG_ALERT_COMPONENT, DIALOG_CONFIRM_COMPONENT, Dialog, DialogConfig, DialogInjector, DialogRef, DialogService, ErrorInterceptor, GOOGLE_MAPS_API_KEY, GoogleMapsService, ImageSizePipe, 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, provideApiBaseUrl, provideConfirmConfigurations, provideDialogAlertComponent, provideDialogConfirmComponent, provideGoogleMapsApiKey, provideOpenedDialogBodyClass, providePredefinedDialogs, provideTokenInterceptor, sessionStorage };
|
|
1521
1621
|
//# sourceMappingURL=codefoxcore.mjs.map
|