@osovitny/anatoly 3.17.71 → 3.17.73
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/core/core.module.mjs +3 -3
- package/esm2022/lib/core/interceptors/httpInterceptor.mjs +4 -23
- package/esm2022/lib/core/logging/globalErrorHandler.mjs +6 -6
- package/esm2022/lib/core/logging/logging.service.mjs +9 -5
- package/esm2022/lib/core/services/appcontext.service.mjs +4 -4
- package/esm2022/lib/core/services/google-analytics.service.mjs +16 -10
- package/esm2022/lib/core/services/starter.service.mjs +14 -9
- package/fesm2022/osovitny-anatoly.mjs +47 -51
- package/fesm2022/osovitny-anatoly.mjs.map +1 -1
- package/lib/core/interceptors/httpInterceptor.d.ts +2 -2
- package/lib/core/logging/logging.service.d.ts +3 -2
- package/lib/core/services/google-analytics.service.d.ts +1 -1
- package/lib/core/services/starter.service.d.ts +3 -1
- package/package.json +1 -1
|
@@ -1108,12 +1108,12 @@ class AppContextService extends ApiServiceBase {
|
|
|
1108
1108
|
if (this.subscription != null) {
|
|
1109
1109
|
return;
|
|
1110
1110
|
}
|
|
1111
|
-
//
|
|
1112
|
-
let stopwatch = new Stopwatch("Requesting a new AppContext");
|
|
1111
|
+
//Logging
|
|
1112
|
+
let stopwatch = new Stopwatch("AppContextService: Requesting a new AppContext");
|
|
1113
1113
|
stopwatch.start();
|
|
1114
1114
|
this.subscription = this.get('getCurrentContext', null).subscribe({
|
|
1115
1115
|
next: (data) => {
|
|
1116
|
-
//
|
|
1116
|
+
//Logging
|
|
1117
1117
|
stopwatch.stop();
|
|
1118
1118
|
stopwatch.printElapsedAsMilliseconds();
|
|
1119
1119
|
this.dataReceived(data);
|
|
@@ -1785,13 +1785,17 @@ class LoadingService extends BehaviorSubject {
|
|
|
1785
1785
|
*/
|
|
1786
1786
|
//Node
|
|
1787
1787
|
class LoggingService {
|
|
1788
|
-
constructor() {
|
|
1789
|
-
logError(error) {
|
|
1790
|
-
console.error(error);
|
|
1788
|
+
constructor() {
|
|
1791
1789
|
}
|
|
1792
|
-
|
|
1790
|
+
info(info) {
|
|
1793
1791
|
console.info(info);
|
|
1794
1792
|
}
|
|
1793
|
+
warn(info) {
|
|
1794
|
+
console.warn(info);
|
|
1795
|
+
}
|
|
1796
|
+
error(error) {
|
|
1797
|
+
console.error(error);
|
|
1798
|
+
}
|
|
1795
1799
|
static { this.ɵfac = function LoggingService_Factory(t) { return new (t || LoggingService)(); }; }
|
|
1796
1800
|
static { this.ɵprov = /*@__PURE__*/ i0.ɵɵdefineInjectable({ token: LoggingService, factory: LoggingService.ɵfac, providedIn: "root" }); }
|
|
1797
1801
|
}
|
|
@@ -1819,10 +1823,10 @@ class LoggingService {
|
|
|
1819
1823
|
*/
|
|
1820
1824
|
//Node
|
|
1821
1825
|
class AnatolyHttpInterceptor {
|
|
1822
|
-
constructor(authService, loadingService,
|
|
1826
|
+
constructor(authService, loadingService, logger) {
|
|
1823
1827
|
this.authService = authService;
|
|
1824
1828
|
this.loadingService = loadingService;
|
|
1825
|
-
this.
|
|
1829
|
+
this.logger = logger;
|
|
1826
1830
|
this.longRunningExceptions = [
|
|
1827
1831
|
'chunkupload',
|
|
1828
1832
|
];
|
|
@@ -1838,7 +1842,6 @@ class AnatolyHttpInterceptor {
|
|
|
1838
1842
|
];
|
|
1839
1843
|
}
|
|
1840
1844
|
handleHttpRequest(request, next, loadingRequired) {
|
|
1841
|
-
//#1. old approach
|
|
1842
1845
|
return next.handle(request).pipe(tap({
|
|
1843
1846
|
next: (event) => {
|
|
1844
1847
|
if (event instanceof HttpResponse) {
|
|
@@ -1847,27 +1850,9 @@ class AnatolyHttpInterceptor {
|
|
|
1847
1850
|
},
|
|
1848
1851
|
error: (err) => {
|
|
1849
1852
|
this.onRequestEnd(loadingRequired);
|
|
1850
|
-
this.
|
|
1853
|
+
this.logger.error(err);
|
|
1851
1854
|
}
|
|
1852
1855
|
}));
|
|
1853
|
-
//#2. new approach
|
|
1854
|
-
/*
|
|
1855
|
-
return next.handle(request).pipe(
|
|
1856
|
-
map(event => {
|
|
1857
|
-
if (event instanceof HttpResponse) {
|
|
1858
|
-
this.onRequestEnd(loadingRequired);
|
|
1859
|
-
}
|
|
1860
|
-
|
|
1861
|
-
return event;
|
|
1862
|
-
}),
|
|
1863
|
-
catchError((error) => {
|
|
1864
|
-
this.onRequestEnd(loadingRequired);
|
|
1865
|
-
|
|
1866
|
-
let errorMsg = "Something went wrong!";
|
|
1867
|
-
return throwError(() => new Error(errorMsg))
|
|
1868
|
-
})
|
|
1869
|
-
)
|
|
1870
|
-
*/
|
|
1871
1856
|
}
|
|
1872
1857
|
intercept(req, next) {
|
|
1873
1858
|
let isCDNEnabled = AppCoreSettings.IsCDNEnabled;
|
|
@@ -2503,13 +2488,13 @@ class L10nUtils {
|
|
|
2503
2488
|
Created:
|
|
2504
2489
|
26 Jun 2020
|
|
2505
2490
|
|
|
2491
|
+
Details:
|
|
2492
|
+
https://medium.com/@amcdnl/global-error-handling-with-angular2-6b992bdfb59c
|
|
2493
|
+
https://medium.com/angular-in-depth/expecting-the-unexpected-best-practices-for-error-handling-in-angular-21c3662ef9e4
|
|
2494
|
+
|
|
2506
2495
|
Copyright (c) 2016-2022 Osovitny Inc. All rights reserved.
|
|
2507
2496
|
</file>
|
|
2508
2497
|
*/
|
|
2509
|
-
/*
|
|
2510
|
-
https://medium.com/@amcdnl/global-error-handling-with-angular2-6b992bdfb59c
|
|
2511
|
-
https://medium.com/angular-in-depth/expecting-the-unexpected-best-practices-for-error-handling-in-angular-21c3662ef9e4
|
|
2512
|
-
*/
|
|
2513
2498
|
//Node
|
|
2514
2499
|
class GlobalErrorHandler {
|
|
2515
2500
|
constructor(injector) {
|
|
@@ -2517,7 +2502,7 @@ class GlobalErrorHandler {
|
|
|
2517
2502
|
}
|
|
2518
2503
|
handleError(error) {
|
|
2519
2504
|
const loggingService = this.injector.get(LoggingService);
|
|
2520
|
-
loggingService.
|
|
2505
|
+
loggingService.error(error);
|
|
2521
2506
|
// IMPORTANT: Rethrow the error otherwise it gets swallowed
|
|
2522
2507
|
throw error;
|
|
2523
2508
|
}
|
|
@@ -2813,11 +2798,12 @@ class DigitalMarketingService {
|
|
|
2813
2798
|
29 Nov 2020
|
|
2814
2799
|
|
|
2815
2800
|
Details:
|
|
2816
|
-
https://yashints.dev/blog/2019/02/12/angular-ga-tagmanager
|
|
2817
|
-
https://developers.google.com/analytics/devguides/collection/gtagjs/pages
|
|
2818
|
-
https://developers.google.com/analytics/devguides/collection/upgrade/analyticsjs
|
|
2819
2801
|
https://medium.com/@danielfilipkowskiblogs/adding-google-analytics-to-angular-v15-1766c4bdaed5
|
|
2820
2802
|
|
|
2803
|
+
API:
|
|
2804
|
+
https://developers.google.com/tag-platform/gtagjs/reference
|
|
2805
|
+
https://developers.google.com/analytics/devguides/collection/ga4/events?client_type=gtag
|
|
2806
|
+
|
|
2821
2807
|
Copyright (c) 2016-2022 Osovitny Inc. All rights reserved.
|
|
2822
2808
|
</file>
|
|
2823
2809
|
*/
|
|
@@ -2843,19 +2829,24 @@ class GoogleAnalyticsService {
|
|
|
2843
2829
|
this.subscription.unsubscribe();
|
|
2844
2830
|
}
|
|
2845
2831
|
}
|
|
2846
|
-
|
|
2832
|
+
event(name, params = null) {
|
|
2847
2833
|
if (!this.ga) {
|
|
2848
2834
|
return;
|
|
2849
2835
|
}
|
|
2850
|
-
|
|
2851
|
-
|
|
2836
|
+
try {
|
|
2837
|
+
if (params) {
|
|
2838
|
+
this.ga('event', name, params);
|
|
2839
|
+
}
|
|
2840
|
+
else {
|
|
2841
|
+
this.ga('event', name);
|
|
2842
|
+
}
|
|
2852
2843
|
}
|
|
2853
|
-
|
|
2854
|
-
|
|
2844
|
+
catch (err) {
|
|
2845
|
+
console.error('Google Analytics event error', err);
|
|
2855
2846
|
}
|
|
2856
2847
|
}
|
|
2857
2848
|
get ga() {
|
|
2858
|
-
let ga = window.
|
|
2849
|
+
let ga = window.gtag;
|
|
2859
2850
|
return ga;
|
|
2860
2851
|
}
|
|
2861
2852
|
static { this.ɵfac = function GoogleAnalyticsService_Factory(t) { return new (t || GoogleAnalyticsService)(i0.ɵɵinject(i1.Router)); }; }
|
|
@@ -2954,23 +2945,28 @@ class IdleService {
|
|
|
2954
2945
|
</file>
|
|
2955
2946
|
*/
|
|
2956
2947
|
class StarterServiceBase extends ApiServiceBase {
|
|
2957
|
-
constructor(http, appContext) {
|
|
2948
|
+
constructor(http, appContext, logger) {
|
|
2958
2949
|
super(http);
|
|
2959
2950
|
this.http = http;
|
|
2960
2951
|
this.appContext = appContext;
|
|
2952
|
+
this.logger = logger;
|
|
2961
2953
|
}
|
|
2962
2954
|
applicationStarting() {
|
|
2963
2955
|
let context = this.appContext.current;
|
|
2964
2956
|
if (!is.objectNullOrEmpty(context)) {
|
|
2965
|
-
//
|
|
2957
|
+
//Logging
|
|
2958
|
+
this.logger.info('StarterService.applicationStarting: got AppContext from Session Storage');
|
|
2959
|
+
this.appContext.init(context);
|
|
2966
2960
|
return of(context);
|
|
2967
2961
|
}
|
|
2968
|
-
//
|
|
2969
|
-
|
|
2962
|
+
//Logging
|
|
2963
|
+
this.logger.info('StarterService.applicationStarting: there is no AppContext in Session Storage');
|
|
2964
|
+
//Logging
|
|
2965
|
+
let stopwatch = new Stopwatch("StarterService.applicationStarting: getting AppContext");
|
|
2970
2966
|
stopwatch.start();
|
|
2971
2967
|
this.baseUrl = `${ApiUrl}/appContext`;
|
|
2972
2968
|
return this.get('applicationStarting').pipe(map(data => {
|
|
2973
|
-
//
|
|
2969
|
+
//Logging
|
|
2974
2970
|
stopwatch.stop();
|
|
2975
2971
|
stopwatch.printElapsedAsMilliseconds();
|
|
2976
2972
|
this.appContext.init(data.context);
|
|
@@ -3005,11 +3001,11 @@ class StarterServiceBase extends ApiServiceBase {
|
|
|
3005
3001
|
else {
|
|
3006
3002
|
tasks$ = applicationStarting$;
|
|
3007
3003
|
}
|
|
3008
|
-
//
|
|
3009
|
-
let stopwatch = new Stopwatch("ensureApplicationStarted");
|
|
3004
|
+
//Logging
|
|
3005
|
+
let stopwatch = new Stopwatch("StarterService.ensureApplicationStarted");
|
|
3010
3006
|
stopwatch.start();
|
|
3011
3007
|
return tasks$.pipe(map(() => {
|
|
3012
|
-
//
|
|
3008
|
+
//Logging
|
|
3013
3009
|
stopwatch.stop();
|
|
3014
3010
|
stopwatch.printElapsedAsMilliseconds();
|
|
3015
3011
|
}));
|