@osovitny/anatoly 2.0.13 → 2.0.15
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/bundles/osovitny-anatoly.umd.js +193 -32
- package/bundles/osovitny-anatoly.umd.js.map +1 -1
- package/bundles/osovitny-anatoly.umd.min.js +2 -2
- package/bundles/osovitny-anatoly.umd.min.js.map +1 -1
- package/esm2015/lib/core/consts/index.js +2 -2
- package/esm2015/lib/core/consts/settings.js +3 -3
- package/esm2015/lib/core/core.module.js +7 -7
- package/esm2015/lib/core/guid.js +2 -2
- package/esm2015/lib/core/index.js +19 -17
- package/esm2015/lib/core/interceptors/httpInterceptor.js +108 -0
- package/esm2015/lib/core/services/loading.service.js +64 -0
- package/fesm2015/osovitny-anatoly.js +190 -32
- package/fesm2015/osovitny-anatoly.js.map +1 -1
- package/lib/core/consts/index.d.ts +1 -1
- package/lib/core/core.module.d.ts +1 -1
- package/lib/core/index.d.ts +12 -11
- package/lib/core/interceptors/httpInterceptor.d.ts +15 -0
- package/lib/core/services/loading.service.d.ts +9 -0
- package/osovitny-anatoly.metadata.json +1 -1
- package/package.json +1 -1
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
(function (global, factory) {
|
|
2
|
-
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('sweetalert2'), require('uuid'), require('@angular/core'), require('@angular/router'), require('@angular/common/http'), require('rxjs/operators'), require('
|
|
3
|
-
typeof define === 'function' && define.amd ? define('@osovitny/anatoly', ['exports', 'sweetalert2', 'uuid', '@angular/core', '@angular/router', '@angular/common/http', 'rxjs/operators', '@angular/common', '
|
|
4
|
-
(global = global || self, factory((global.osovitny = global.osovitny || {}, global.osovitny.anatoly = {}), global.Swal, global.uuid, global.ng.core, global.ng.router, global.ng.common.http, global.rxjs.operators, global.
|
|
5
|
-
}(this, (function (exports, Swal, uuid, i0, router, http, operators,
|
|
2
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('sweetalert2'), require('uuid'), require('@angular/core'), require('@angular/router'), require('@angular/common/http'), require('rxjs/operators'), require('rxjs'), require('@angular/common'), require('@angular/forms'), require('angular-froala-wysiwyg')) :
|
|
3
|
+
typeof define === 'function' && define.amd ? define('@osovitny/anatoly', ['exports', 'sweetalert2', 'uuid', '@angular/core', '@angular/router', '@angular/common/http', 'rxjs/operators', 'rxjs', '@angular/common', '@angular/forms', 'angular-froala-wysiwyg'], factory) :
|
|
4
|
+
(global = global || self, factory((global.osovitny = global.osovitny || {}, global.osovitny.anatoly = {}), global.Swal, global.uuid, global.ng.core, global.ng.router, global.ng.common.http, global.rxjs.operators, global.rxjs, global.ng.common, global.ng.forms, global.angularFroalaWysiwyg));
|
|
5
|
+
}(this, (function (exports, Swal, uuid, i0, router, http, operators, rxjs, common, forms, angularFroalaWysiwyg) { 'use strict';
|
|
6
6
|
|
|
7
7
|
Swal = Swal && Object.prototype.hasOwnProperty.call(Swal, 'default') ? Swal['default'] : Swal;
|
|
8
8
|
|
|
@@ -24,8 +24,8 @@
|
|
|
24
24
|
Copyright (c) 2016-2020 Osovitny Inc. All rights reserved.
|
|
25
25
|
</file>
|
|
26
26
|
*/
|
|
27
|
-
var ContextInitState = JSON.parse((document.getElementById(
|
|
28
|
-
var AppCoreSettings = JSON.parse((document.getElementById(
|
|
27
|
+
var ContextInitState = JSON.parse((document.getElementById('contextInitState')).getAttribute('data-contextinitstate'));
|
|
28
|
+
var AppCoreSettings = JSON.parse((document.getElementById('appCoreSettings')).getAttribute('data-appcoresettings'));
|
|
29
29
|
|
|
30
30
|
/*
|
|
31
31
|
<file>
|
|
@@ -46,6 +46,30 @@
|
|
|
46
46
|
</file>
|
|
47
47
|
*/
|
|
48
48
|
|
|
49
|
+
/*
|
|
50
|
+
<file>
|
|
51
|
+
Project:
|
|
52
|
+
@osovitny/anatoly
|
|
53
|
+
|
|
54
|
+
Authors:
|
|
55
|
+
Vadim Osovitny
|
|
56
|
+
Anatoly Osovitny
|
|
57
|
+
|
|
58
|
+
Created:
|
|
59
|
+
26 Jun 2020
|
|
60
|
+
|
|
61
|
+
Version:
|
|
62
|
+
1.0
|
|
63
|
+
|
|
64
|
+
Copyright (c) 2016-2020 Osovitny Inc. All rights reserved.
|
|
65
|
+
</file>
|
|
66
|
+
*/
|
|
67
|
+
function throwIfAlreadyLoaded(parentModule, moduleName) {
|
|
68
|
+
if (parentModule) {
|
|
69
|
+
throw new Error(moduleName + " has already been loaded. Import " + moduleName + " modules in the AppModule only.");
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
49
73
|
/*
|
|
50
74
|
<file>
|
|
51
75
|
Project:
|
|
@@ -317,30 +341,6 @@
|
|
|
317
341
|
return Guid;
|
|
318
342
|
}());
|
|
319
343
|
|
|
320
|
-
/*
|
|
321
|
-
<file>
|
|
322
|
-
Project:
|
|
323
|
-
@osovitny/anatoly
|
|
324
|
-
|
|
325
|
-
Authors:
|
|
326
|
-
Vadim Osovitny
|
|
327
|
-
Anatoly Osovitny
|
|
328
|
-
|
|
329
|
-
Created:
|
|
330
|
-
26 Jun 2020
|
|
331
|
-
|
|
332
|
-
Version:
|
|
333
|
-
1.0
|
|
334
|
-
|
|
335
|
-
Copyright (c) 2016-2020 Osovitny Inc. All rights reserved.
|
|
336
|
-
</file>
|
|
337
|
-
*/
|
|
338
|
-
function throwIfAlreadyLoaded(parentModule, moduleName) {
|
|
339
|
-
if (parentModule) {
|
|
340
|
-
throw new Error(moduleName + " has already been loaded. Import " + moduleName + " modules in the AppModule only.");
|
|
341
|
-
}
|
|
342
|
-
}
|
|
343
|
-
|
|
344
344
|
/*
|
|
345
345
|
<file>
|
|
346
346
|
Project:
|
|
@@ -894,6 +894,166 @@
|
|
|
894
894
|
{ type: http.HttpClient }
|
|
895
895
|
]; };
|
|
896
896
|
|
|
897
|
+
var LoadingService = /** @class */ (function (_super) {
|
|
898
|
+
__extends(LoadingService, _super);
|
|
899
|
+
function LoadingService() {
|
|
900
|
+
var _this = _super.call(this, false) || this;
|
|
901
|
+
_this.counter = 0;
|
|
902
|
+
//Public
|
|
903
|
+
_this.isFreezed = false;
|
|
904
|
+
return _this;
|
|
905
|
+
}
|
|
906
|
+
LoadingService.prototype.show = function () {
|
|
907
|
+
this.counter++;
|
|
908
|
+
var that = this;
|
|
909
|
+
setTimeout(function () {
|
|
910
|
+
if (that.counter > 0) {
|
|
911
|
+
that.next(true);
|
|
912
|
+
}
|
|
913
|
+
}, 1000);
|
|
914
|
+
};
|
|
915
|
+
LoadingService.prototype.hide = function () {
|
|
916
|
+
if (this.counter <= 0) {
|
|
917
|
+
return;
|
|
918
|
+
}
|
|
919
|
+
this.counter--;
|
|
920
|
+
if (this.counter == 0) {
|
|
921
|
+
this.next(false);
|
|
922
|
+
}
|
|
923
|
+
};
|
|
924
|
+
LoadingService.prototype.freeze = function (timeout) {
|
|
925
|
+
var _this = this;
|
|
926
|
+
if (timeout === void 0) { timeout = 1000; }
|
|
927
|
+
this.isFreezed = true;
|
|
928
|
+
var that = this;
|
|
929
|
+
setTimeout(function () {
|
|
930
|
+
_this.isFreezed = false;
|
|
931
|
+
}, timeout);
|
|
932
|
+
};
|
|
933
|
+
return LoadingService;
|
|
934
|
+
}(rxjs.BehaviorSubject));
|
|
935
|
+
LoadingService.ɵprov = i0.ɵɵdefineInjectable({ factory: function LoadingService_Factory() { return new LoadingService(); }, token: LoadingService, providedIn: "root" });
|
|
936
|
+
LoadingService.decorators = [
|
|
937
|
+
{ type: i0.Injectable, args: [{
|
|
938
|
+
providedIn: "root",
|
|
939
|
+
},] }
|
|
940
|
+
];
|
|
941
|
+
LoadingService.ctorParameters = function () { return []; };
|
|
942
|
+
|
|
943
|
+
var AnatolyHttpInterceptor = /** @class */ (function () {
|
|
944
|
+
function AnatolyHttpInterceptor(loadingService, loggingService) {
|
|
945
|
+
this.loadingService = loadingService;
|
|
946
|
+
this.loggingService = loggingService;
|
|
947
|
+
this.longRunningExceptionsList = [];
|
|
948
|
+
this.autoCDNSASTokenUrls = ['chunks', 'resources'];
|
|
949
|
+
this.externalSiteUrls = ['azurewebsites.net'];
|
|
950
|
+
}
|
|
951
|
+
AnatolyHttpInterceptor.prototype.intercept = function (req, next) {
|
|
952
|
+
var e_1, _a, e_2, _b, e_3, _c;
|
|
953
|
+
var _this = this;
|
|
954
|
+
var isCDNEnabled = AppCoreSettings.IsCDNEnabled;
|
|
955
|
+
var cdnSasToken = AppCoreSettings.CDNSASToken;
|
|
956
|
+
var isLoadingFreezed = this.loadingService.isFreezed;
|
|
957
|
+
var loadingRequired = !isLoadingFreezed;
|
|
958
|
+
var authorizationTokenRequired = true;
|
|
959
|
+
var url = req.url.toLowerCase();
|
|
960
|
+
var originalUrl = req.url;
|
|
961
|
+
var isExternalSite = false;
|
|
962
|
+
if (!isLoadingFreezed) {
|
|
963
|
+
try {
|
|
964
|
+
for (var _d = __values(this.longRunningExceptionsList), _e = _d.next(); !_e.done; _e = _d.next()) {
|
|
965
|
+
var i = _e.value;
|
|
966
|
+
if (url.indexOf(this.longRunningExceptionsList[i]) >= 0) {
|
|
967
|
+
loadingRequired = false;
|
|
968
|
+
break;
|
|
969
|
+
}
|
|
970
|
+
}
|
|
971
|
+
}
|
|
972
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
973
|
+
finally {
|
|
974
|
+
try {
|
|
975
|
+
if (_e && !_e.done && (_a = _d.return)) _a.call(_d);
|
|
976
|
+
}
|
|
977
|
+
finally { if (e_1) throw e_1.error; }
|
|
978
|
+
}
|
|
979
|
+
}
|
|
980
|
+
if (isCDNEnabled) {
|
|
981
|
+
try {
|
|
982
|
+
for (var _f = __values(this.autoCDNSASTokenUrls), _g = _f.next(); !_g.done; _g = _f.next()) {
|
|
983
|
+
var i = _g.value;
|
|
984
|
+
if (url.indexOf(this.autoCDNSASTokenUrls[i]) >= 0) {
|
|
985
|
+
req = req.clone({ url: originalUrl + cdnSasToken });
|
|
986
|
+
break;
|
|
987
|
+
}
|
|
988
|
+
}
|
|
989
|
+
}
|
|
990
|
+
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
991
|
+
finally {
|
|
992
|
+
try {
|
|
993
|
+
if (_g && !_g.done && (_b = _f.return)) _b.call(_f);
|
|
994
|
+
}
|
|
995
|
+
finally { if (e_2) throw e_2.error; }
|
|
996
|
+
}
|
|
997
|
+
}
|
|
998
|
+
try {
|
|
999
|
+
for (var _h = __values(this.externalSiteUrls), _j = _h.next(); !_j.done; _j = _h.next()) {
|
|
1000
|
+
var i = _j.value;
|
|
1001
|
+
if (url.indexOf(this.externalSiteUrls[i]) >= 0) {
|
|
1002
|
+
isExternalSite = true;
|
|
1003
|
+
break;
|
|
1004
|
+
}
|
|
1005
|
+
}
|
|
1006
|
+
}
|
|
1007
|
+
catch (e_3_1) { e_3 = { error: e_3_1 }; }
|
|
1008
|
+
finally {
|
|
1009
|
+
try {
|
|
1010
|
+
if (_j && !_j.done && (_c = _h.return)) _c.call(_h);
|
|
1011
|
+
}
|
|
1012
|
+
finally { if (e_3) throw e_3.error; }
|
|
1013
|
+
}
|
|
1014
|
+
// VadimOS: IE11-fix
|
|
1015
|
+
if (url.indexOf('/api/') > -1) {
|
|
1016
|
+
var newUrl = '';
|
|
1017
|
+
var t = new Date().getTime().toString();
|
|
1018
|
+
if (url.indexOf('?') > -1) {
|
|
1019
|
+
newUrl = originalUrl + '&t=' + t;
|
|
1020
|
+
}
|
|
1021
|
+
else {
|
|
1022
|
+
newUrl = originalUrl + '?t=' + t;
|
|
1023
|
+
}
|
|
1024
|
+
req = req.clone({ url: newUrl });
|
|
1025
|
+
}
|
|
1026
|
+
req = req.clone({ headers: req.headers.set('Accept', 'application/json') });
|
|
1027
|
+
this.onRequestStart(loadingRequired);
|
|
1028
|
+
return next.handle(req).pipe(operators.tap(function (event) {
|
|
1029
|
+
if (event instanceof http.HttpResponse) {
|
|
1030
|
+
_this.onRequestEnd(loadingRequired);
|
|
1031
|
+
}
|
|
1032
|
+
}, function (err) {
|
|
1033
|
+
_this.onRequestEnd(loadingRequired);
|
|
1034
|
+
_this.loggingService.logError(err);
|
|
1035
|
+
}));
|
|
1036
|
+
};
|
|
1037
|
+
AnatolyHttpInterceptor.prototype.onRequestStart = function (loadingRequired) {
|
|
1038
|
+
if (loadingRequired) {
|
|
1039
|
+
this.loadingService.show();
|
|
1040
|
+
}
|
|
1041
|
+
};
|
|
1042
|
+
AnatolyHttpInterceptor.prototype.onRequestEnd = function (loadingRequired) {
|
|
1043
|
+
if (loadingRequired) {
|
|
1044
|
+
this.loadingService.hide();
|
|
1045
|
+
}
|
|
1046
|
+
};
|
|
1047
|
+
return AnatolyHttpInterceptor;
|
|
1048
|
+
}());
|
|
1049
|
+
AnatolyHttpInterceptor.decorators = [
|
|
1050
|
+
{ type: i0.Injectable }
|
|
1051
|
+
];
|
|
1052
|
+
AnatolyHttpInterceptor.ctorParameters = function () { return [
|
|
1053
|
+
{ type: LoadingService },
|
|
1054
|
+
{ type: LoggingService }
|
|
1055
|
+
]; };
|
|
1056
|
+
|
|
897
1057
|
var providers = [
|
|
898
1058
|
LoggingService,
|
|
899
1059
|
AppContextService,
|
|
@@ -902,7 +1062,7 @@
|
|
|
902
1062
|
var AnatolyCoreModule = /** @class */ (function () {
|
|
903
1063
|
function AnatolyCoreModule(injector, parentModule) {
|
|
904
1064
|
this.injector = injector;
|
|
905
|
-
throwIfAlreadyLoaded(parentModule,
|
|
1065
|
+
throwIfAlreadyLoaded(parentModule, 'AnatolyCoreModule');
|
|
906
1066
|
InjectorInstance = this.injector;
|
|
907
1067
|
}
|
|
908
1068
|
return AnatolyCoreModule;
|
|
@@ -922,7 +1082,7 @@
|
|
|
922
1082
|
<file>
|
|
923
1083
|
Project:
|
|
924
1084
|
@osovitny/anatoly
|
|
925
|
-
|
|
1085
|
+
|
|
926
1086
|
Authors:
|
|
927
1087
|
Vadim Osovitny
|
|
928
1088
|
Anatoly Osovitny
|
|
@@ -1955,6 +2115,7 @@
|
|
|
1955
2115
|
exports.Alerts = Alerts;
|
|
1956
2116
|
exports.AnatolyCoreModule = AnatolyCoreModule;
|
|
1957
2117
|
exports.AnatolyDataModule = AnatolyDataModule;
|
|
2118
|
+
exports.AnatolyHttpInterceptor = AnatolyHttpInterceptor;
|
|
1958
2119
|
exports.AnatolyUIModule = AnatolyUIModule;
|
|
1959
2120
|
exports.AppContextService = AppContextService;
|
|
1960
2121
|
exports.AppCoreSettings = AppCoreSettings;
|