@bnsights/bbsf-utilities 1.0.1 → 1.0.5
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/bnsights-bbsf-utilities-1.0.5.tgz +0 -0
- package/bnsights-bbsf-utilities.metadata.json +1 -1
- package/bundles/bnsights-bbsf-utilities.umd.js +314 -240
- package/bundles/bnsights-bbsf-utilities.umd.js.map +1 -1
- package/esm2015/lib/shared/authentication/auth.service.js +20 -20
- package/esm2015/lib/shared/models/ErrorModel.js +1 -1
- package/esm2015/lib/shared/services/controlvalidation.service.js +50 -33
- package/esm2015/lib/shared/services/environment.service.js +5 -1
- package/esm2015/lib/shared/services/requesthandler.service.js +56 -18
- package/esm2015/lib/shared/services/stylesbundle.service.js +8 -4
- package/esm2015/lib/shared/services/translationresolver.service.js +20 -0
- package/esm2015/lib/shared/services/utility.service.js +20 -20
- package/esm2015/public-api.js +2 -1
- package/fesm2015/bnsights-bbsf-utilities.js +273 -192
- package/fesm2015/bnsights-bbsf-utilities.js.map +1 -1
- package/lib/shared/authentication/auth.service.d.ts +4 -2
- package/lib/shared/models/ErrorModel.d.ts +1 -1
- package/lib/shared/services/controlvalidation.service.d.ts +2 -2
- package/lib/shared/services/environment.service.d.ts +1 -0
- package/lib/shared/services/requesthandler.service.d.ts +11 -7
- package/lib/shared/services/stylesbundle.service.d.ts +3 -1
- package/lib/shared/services/translationresolver.service.d.ts +8 -0
- package/lib/shared/services/utility.service.d.ts +7 -5
- package/package.json +2 -2
- package/public-api.d.ts +1 -0
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
(function (global, factory) {
|
|
2
|
-
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/common'), require('@angular/core'), require('@angular/router'), require('@ngx-translate/core'), require('ng-block-ui'), require('ngx-toastr'), require('@angular/http'), require('@angular/common/http'), require('oidc-client'), require('rxjs'), require('rxjs/operators')) :
|
|
3
|
-
typeof define === 'function' && define.amd ? define('@bnsights/bbsf-utilities', ['exports', '@angular/common', '@angular/core', '@angular/router', '@ngx-translate/core', 'ng-block-ui', 'ngx-toastr', '@angular/http', '@angular/common/http', 'oidc-client', 'rxjs', 'rxjs/operators'], factory) :
|
|
4
|
-
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.bnsights = global.bnsights || {}, global.bnsights["bbsf-utilities"] = {}), global.ng.common, global.ng.core, global.ng.router, global.i1
|
|
5
|
-
})(this, (function (exports, i1$2, i0, i1$3, i1
|
|
2
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/common'), require('@angular/core'), require('@angular/router'), require('@ngx-translate/core'), require('ng-block-ui'), require('ngx-toastr'), require('@angular/http'), require('@angular/common/http'), require('oidc-client'), require('rxjs'), require('rxjs/internal/Observable'), require('rxjs/operators')) :
|
|
3
|
+
typeof define === 'function' && define.amd ? define('@bnsights/bbsf-utilities', ['exports', '@angular/common', '@angular/core', '@angular/router', '@ngx-translate/core', 'ng-block-ui', 'ngx-toastr', '@angular/http', '@angular/common/http', 'oidc-client', 'rxjs', 'rxjs/internal/Observable', 'rxjs/operators'], factory) :
|
|
4
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.bnsights = global.bnsights || {}, global.bnsights["bbsf-utilities"] = {}), global.ng.common, global.ng.core, global.ng.router, global.i1, global.ngBlockUi, global.ngxToastr, global.ng.http, global.ng.common.http, global.oidcClient, global.rxjs, global.rxjs["internal/Observable"], global.rxjs.operators));
|
|
5
|
+
})(this, (function (exports, i1$2, i0, i1$3, i1, ngBlockUi, ngxToastr, http, i1$1, oidcClient, rxjs, Observable, operators) { 'use strict';
|
|
6
6
|
|
|
7
7
|
function _interopNamespace(e) {
|
|
8
8
|
if (e && e.__esModule) return e;
|
|
@@ -25,8 +25,8 @@
|
|
|
25
25
|
var i1__namespace$2 = /*#__PURE__*/_interopNamespace(i1$2);
|
|
26
26
|
var i0__namespace = /*#__PURE__*/_interopNamespace(i0);
|
|
27
27
|
var i1__namespace$3 = /*#__PURE__*/_interopNamespace(i1$3);
|
|
28
|
-
var i1__namespace$1 = /*#__PURE__*/_interopNamespace(i1$1);
|
|
29
28
|
var i1__namespace = /*#__PURE__*/_interopNamespace(i1);
|
|
29
|
+
var i1__namespace$1 = /*#__PURE__*/_interopNamespace(i1$1);
|
|
30
30
|
|
|
31
31
|
/*! *****************************************************************************
|
|
32
32
|
Copyright (c) Microsoft Corporation.
|
|
@@ -376,6 +376,10 @@
|
|
|
376
376
|
var Mode = environment["BBSF_IsProduction"];
|
|
377
377
|
return Mode;
|
|
378
378
|
};
|
|
379
|
+
EnvironmentService.prototype.getDefaultLanguage = function () {
|
|
380
|
+
var Mode = environment["BBSF_DefaultLanguage"];
|
|
381
|
+
return Mode;
|
|
382
|
+
};
|
|
379
383
|
EnvironmentService.prototype.getIdentityServerUrl = function () {
|
|
380
384
|
var Url = environment["BBSF_IdentityServerUrl"];
|
|
381
385
|
return Url;
|
|
@@ -389,11 +393,26 @@
|
|
|
389
393
|
},] }
|
|
390
394
|
];
|
|
391
395
|
|
|
396
|
+
var BBSFTranslateService = /** @class */ (function (_super) {
|
|
397
|
+
__extends(BBSFTranslateService, _super);
|
|
398
|
+
function BBSFTranslateService() {
|
|
399
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
400
|
+
}
|
|
401
|
+
return BBSFTranslateService;
|
|
402
|
+
}(i1.TranslateService));
|
|
403
|
+
BBSFTranslateService.ɵprov = i0__namespace.ɵɵdefineInjectable({ factory: function BBSFTranslateService_Factory() { return new BBSFTranslateService(i0__namespace.ɵɵinject(i1__namespace.TranslateStore), i0__namespace.ɵɵinject(i1__namespace.TranslateLoader), i0__namespace.ɵɵinject(i1__namespace.TranslateCompiler), i0__namespace.ɵɵinject(i1__namespace.TranslateParser), i0__namespace.ɵɵinject(i1__namespace.MissingTranslationHandler), i0__namespace.ɵɵinject(i1__namespace.USE_DEFAULT_LANG), i0__namespace.ɵɵinject(i1__namespace.USE_STORE), i0__namespace.ɵɵinject(i1__namespace.USE_EXTEND), i0__namespace.ɵɵinject(i1__namespace.DEFAULT_LANGUAGE)); }, token: BBSFTranslateService, providedIn: "root" });
|
|
404
|
+
BBSFTranslateService.decorators = [
|
|
405
|
+
{ type: i0.Injectable, args: [{
|
|
406
|
+
providedIn: 'root'
|
|
407
|
+
},] }
|
|
408
|
+
];
|
|
409
|
+
|
|
392
410
|
var AuthService = /** @class */ (function () {
|
|
393
|
-
function AuthService(http, environmentService) {
|
|
411
|
+
function AuthService(http, environmentService, translateService) {
|
|
394
412
|
var _this = this;
|
|
395
413
|
this.http = http;
|
|
396
414
|
this.environmentService = environmentService;
|
|
415
|
+
this.translateService = translateService;
|
|
397
416
|
// Observable navItem source
|
|
398
417
|
this._authNavStatusSource = new rxjs.BehaviorSubject(false);
|
|
399
418
|
// Observable navItem stream
|
|
@@ -480,10 +499,20 @@
|
|
|
480
499
|
case 1:
|
|
481
500
|
_a.user = _d.sent();
|
|
482
501
|
AuthService.user = this.user;
|
|
502
|
+
localStorage.setItem("language", this.user.profile.locale);
|
|
503
|
+
if (!(this.translateService.currentLang != this.user.profile.locale)) return [3 /*break*/, 3];
|
|
504
|
+
this.translateService.resetLang(this.translateService.currentLang);
|
|
505
|
+
return [4 /*yield*/, this.translateService.reloadLang(this.user.profile.locale).subscribe(function (res) {
|
|
506
|
+
console.log(res);
|
|
507
|
+
})];
|
|
508
|
+
case 2:
|
|
509
|
+
_d.sent();
|
|
510
|
+
_d.label = 3;
|
|
511
|
+
case 3:
|
|
483
512
|
this._userSource.next(AuthService.user);
|
|
484
513
|
_c = (_b = this._authNavStatusSource).next;
|
|
485
514
|
return [4 /*yield*/, this.isAuthenticated()];
|
|
486
|
-
case
|
|
515
|
+
case 4:
|
|
487
516
|
_c.apply(_b, [_d.sent()]);
|
|
488
517
|
return [2 /*return*/];
|
|
489
518
|
}
|
|
@@ -498,7 +527,7 @@
|
|
|
498
527
|
switch (_a.label) {
|
|
499
528
|
case 0:
|
|
500
529
|
httpOptions = {
|
|
501
|
-
headers: new i1.HttpHeaders({
|
|
530
|
+
headers: new i1$1.HttpHeaders({
|
|
502
531
|
'Content-Type': 'application/json',
|
|
503
532
|
'Authorization': token
|
|
504
533
|
})
|
|
@@ -517,9 +546,9 @@
|
|
|
517
546
|
AuthService.prototype.getCurrentUser = function () {
|
|
518
547
|
return this.manager.getUser();
|
|
519
548
|
};
|
|
520
|
-
AuthService.prototype.isAuthenticated = function (
|
|
549
|
+
AuthService.prototype.isAuthenticated = function () {
|
|
521
550
|
return __awaiter(this, void 0, void 0, function () {
|
|
522
|
-
var user
|
|
551
|
+
var user;
|
|
523
552
|
return __generator(this, function (_a) {
|
|
524
553
|
switch (_a.label) {
|
|
525
554
|
case 0: return [4 /*yield*/, this.manager.getUser().then(function (user) {
|
|
@@ -527,29 +556,17 @@
|
|
|
527
556
|
})];
|
|
528
557
|
case 1:
|
|
529
558
|
user = _a.sent();
|
|
530
|
-
|
|
531
|
-
if (allowedPermission.length == 0) {
|
|
532
|
-
return [2 /*return*/, this.user != null && !this.user.expired];
|
|
533
|
-
}
|
|
534
|
-
else {
|
|
535
|
-
isUserInRole = this.isUserInRole(allowedPermission);
|
|
536
|
-
return [2 /*return*/, this.user != null && !this.user.expired && isUserInRole];
|
|
537
|
-
}
|
|
538
|
-
}
|
|
539
|
-
else
|
|
540
|
-
return [2 /*return*/, this.user != null && !this.user.expired];
|
|
541
|
-
return [2 /*return*/];
|
|
559
|
+
return [2 /*return*/, this.user != null && !this.user.expired];
|
|
542
560
|
}
|
|
543
561
|
});
|
|
544
562
|
});
|
|
545
563
|
};
|
|
546
564
|
AuthService.prototype.isUserInRole = function (allowedPermission) {
|
|
547
|
-
;
|
|
548
|
-
|
|
549
|
-
return allowedPermission.every(function (i) { return permissionSetSID.includes(i); });
|
|
565
|
+
var selectedPermissionSetID = this.user.profile["selectedPermissionSetID"];
|
|
566
|
+
return allowedPermission.includes(selectedPermissionSetID);
|
|
550
567
|
};
|
|
551
568
|
AuthService.prototype.authorizationHeaderValue = function () {
|
|
552
|
-
return AuthService.user.token_type + " " + AuthService.user.access_token;
|
|
569
|
+
return AuthService.user ? AuthService.user.token_type + " " + AuthService.user.access_token : "";
|
|
553
570
|
};
|
|
554
571
|
AuthService.prototype.name = function () {
|
|
555
572
|
return AuthService.user != null ? AuthService.user.profile.given_name : '';
|
|
@@ -594,81 +611,43 @@
|
|
|
594
611
|
return AuthService;
|
|
595
612
|
}());
|
|
596
613
|
AuthService.user = null;
|
|
597
|
-
AuthService.ɵprov = i0__namespace.ɵɵdefineInjectable({ factory: function AuthService_Factory() { return new AuthService(i0__namespace.ɵɵinject(i1__namespace.HttpClient), i0__namespace.ɵɵinject(EnvironmentService)); }, token: AuthService, providedIn: "root" });
|
|
614
|
+
AuthService.ɵprov = i0__namespace.ɵɵdefineInjectable({ factory: function AuthService_Factory() { return new AuthService(i0__namespace.ɵɵinject(i1__namespace$1.HttpClient), i0__namespace.ɵɵinject(EnvironmentService), i0__namespace.ɵɵinject(BBSFTranslateService)); }, token: AuthService, providedIn: "root" });
|
|
598
615
|
AuthService.decorators = [
|
|
599
616
|
{ type: i0.Injectable, args: [{
|
|
600
617
|
providedIn: 'root'
|
|
601
618
|
},] }
|
|
602
619
|
];
|
|
603
620
|
AuthService.ctorParameters = function () { return [
|
|
604
|
-
{ type: i1.HttpClient },
|
|
605
|
-
{ type: EnvironmentService }
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
var BBSFTranslateService = /** @class */ (function (_super) {
|
|
610
|
-
__extends(BBSFTranslateService, _super);
|
|
611
|
-
function BBSFTranslateService() {
|
|
612
|
-
return _super !== null && _super.apply(this, arguments) || this;
|
|
613
|
-
}
|
|
614
|
-
return BBSFTranslateService;
|
|
615
|
-
}(i1$1.TranslateService));
|
|
616
|
-
BBSFTranslateService.ɵprov = i0__namespace.ɵɵdefineInjectable({ factory: function BBSFTranslateService_Factory() { return new BBSFTranslateService(i0__namespace.ɵɵinject(i1__namespace$1.TranslateStore), i0__namespace.ɵɵinject(i1__namespace$1.TranslateLoader), i0__namespace.ɵɵinject(i1__namespace$1.TranslateCompiler), i0__namespace.ɵɵinject(i1__namespace$1.TranslateParser), i0__namespace.ɵɵinject(i1__namespace$1.MissingTranslationHandler), i0__namespace.ɵɵinject(i1__namespace$1.USE_DEFAULT_LANG), i0__namespace.ɵɵinject(i1__namespace$1.USE_STORE), i0__namespace.ɵɵinject(i1__namespace$1.USE_EXTEND), i0__namespace.ɵɵinject(i1__namespace$1.DEFAULT_LANGUAGE)); }, token: BBSFTranslateService, providedIn: "root" });
|
|
617
|
-
BBSFTranslateService.decorators = [
|
|
618
|
-
{ type: i0.Injectable, args: [{
|
|
619
|
-
providedIn: 'root'
|
|
620
|
-
},] }
|
|
621
|
-
];
|
|
621
|
+
{ type: i1$1.HttpClient },
|
|
622
|
+
{ type: EnvironmentService },
|
|
623
|
+
{ type: BBSFTranslateService }
|
|
624
|
+
]; };
|
|
622
625
|
|
|
623
626
|
var UtilityService = /** @class */ (function () {
|
|
624
|
-
function UtilityService(
|
|
625
|
-
this.
|
|
627
|
+
function UtilityService(translator, authService, environmentService) {
|
|
628
|
+
this.translator = translator;
|
|
626
629
|
this.authService = authService;
|
|
630
|
+
this.environmentService = environmentService;
|
|
627
631
|
this.isCreatedBefore = false;
|
|
628
632
|
}
|
|
629
633
|
UtilityService.prototype.getResourceValue = function (Key) {
|
|
630
|
-
var ResourceValue =
|
|
631
|
-
this.Translator.get(Key).subscribe(function (data) { ResourceValue = data; return ResourceValue; });
|
|
634
|
+
var ResourceValue = this.translator.instant(Key);
|
|
632
635
|
return ResourceValue;
|
|
633
636
|
};
|
|
634
637
|
UtilityService.prototype.getCurrentLanguage = function () {
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
case 1:
|
|
643
|
-
user = _a.sent();
|
|
644
|
-
return [2 /*return*/, user.profile.locale];
|
|
645
|
-
}
|
|
646
|
-
});
|
|
647
|
-
});
|
|
638
|
+
var currentLanguage = this.environmentService.getDefaultLanguage();
|
|
639
|
+
var lang = localStorage.getItem('language');
|
|
640
|
+
if (lang)
|
|
641
|
+
currentLanguage = lang;
|
|
642
|
+
else
|
|
643
|
+
localStorage.setItem('language', currentLanguage);
|
|
644
|
+
return currentLanguage;
|
|
648
645
|
};
|
|
649
646
|
UtilityService.prototype.isCurrentLanguageEnglish = function () {
|
|
650
|
-
|
|
651
|
-
return __generator(this, function (_a) {
|
|
652
|
-
switch (_a.label) {
|
|
653
|
-
case 0: return [4 /*yield*/, this.getCurrentLanguage()];
|
|
654
|
-
case 1:
|
|
655
|
-
(_a.sent()) == "en" ? true : false;
|
|
656
|
-
return [2 /*return*/];
|
|
657
|
-
}
|
|
658
|
-
});
|
|
659
|
-
});
|
|
647
|
+
this.getCurrentLanguage() == "en";
|
|
660
648
|
};
|
|
661
649
|
UtilityService.prototype.isCurrentLanguageArabic = function () {
|
|
662
|
-
|
|
663
|
-
return __generator(this, function (_a) {
|
|
664
|
-
switch (_a.label) {
|
|
665
|
-
case 0: return [4 /*yield*/, this.getCurrentLanguage()];
|
|
666
|
-
case 1:
|
|
667
|
-
(_a.sent()) == "ar" ? true : false;
|
|
668
|
-
return [2 /*return*/];
|
|
669
|
-
}
|
|
670
|
-
});
|
|
671
|
-
});
|
|
650
|
+
this.getCurrentLanguage() == "ar";
|
|
672
651
|
};
|
|
673
652
|
UtilityService.prototype.notifySuccessMessage = function (Message, title, time) {
|
|
674
653
|
var MessageTemplate = this.getResourceValue("SuccessMessage");
|
|
@@ -714,7 +693,7 @@
|
|
|
714
693
|
};
|
|
715
694
|
return UtilityService;
|
|
716
695
|
}());
|
|
717
|
-
UtilityService.ɵprov = i0__namespace.ɵɵdefineInjectable({ factory: function UtilityService_Factory() { return new UtilityService(i0__namespace.ɵɵinject(BBSFTranslateService), i0__namespace.ɵɵinject(AuthService)); }, token: UtilityService, providedIn: "root" });
|
|
696
|
+
UtilityService.ɵprov = i0__namespace.ɵɵdefineInjectable({ factory: function UtilityService_Factory() { return new UtilityService(i0__namespace.ɵɵinject(BBSFTranslateService), i0__namespace.ɵɵinject(AuthService), i0__namespace.ɵɵinject(EnvironmentService)); }, token: UtilityService, providedIn: "root" });
|
|
718
697
|
UtilityService.decorators = [
|
|
719
698
|
{ type: i0.Injectable, args: [{
|
|
720
699
|
providedIn: 'root'
|
|
@@ -722,7 +701,8 @@
|
|
|
722
701
|
];
|
|
723
702
|
UtilityService.ctorParameters = function () { return [
|
|
724
703
|
{ type: BBSFTranslateService },
|
|
725
|
-
{ type: AuthService }
|
|
704
|
+
{ type: AuthService },
|
|
705
|
+
{ type: EnvironmentService }
|
|
726
706
|
]; };
|
|
727
707
|
__decorate([
|
|
728
708
|
ngBlockUi.BlockUI()
|
|
@@ -738,13 +718,178 @@
|
|
|
738
718
|
return RequestOptionsModel;
|
|
739
719
|
}());
|
|
740
720
|
|
|
721
|
+
var RequestHandlerService = /** @class */ (function () {
|
|
722
|
+
function RequestHandlerService(http, authService, environmentService, utilityService, bbsfTranslateService) {
|
|
723
|
+
var _this = this;
|
|
724
|
+
//using localStorage to avoid call getCurrentLanguage() because it is not all to use async in constructor
|
|
725
|
+
this.http = http;
|
|
726
|
+
this.authService = authService;
|
|
727
|
+
this.environmentService = environmentService;
|
|
728
|
+
this.utilityService = utilityService;
|
|
729
|
+
this.bbsfTranslateService = bbsfTranslateService;
|
|
730
|
+
this.requestOptions = new RequestOptionsModel();
|
|
731
|
+
this.currentLanguage = "";
|
|
732
|
+
this.onDestroy$ = new rxjs.Subject();
|
|
733
|
+
this.bbsfTranslateService.onLangChange.subscribe(function (event) {
|
|
734
|
+
if (_this.currentLanguage != event.lang) {
|
|
735
|
+
_this.currentLanguage = event.lang;
|
|
736
|
+
}
|
|
737
|
+
});
|
|
738
|
+
}
|
|
739
|
+
RequestHandlerService.prototype.getLuckyNumber = function () {
|
|
740
|
+
return Observable.Observable.create(function (subject) {
|
|
741
|
+
setInterval(function () {
|
|
742
|
+
var number = Math.floor(Math.random() * 10);
|
|
743
|
+
console.log(number);
|
|
744
|
+
subject.next(number);
|
|
745
|
+
}, 1000);
|
|
746
|
+
}).pipe(operators.takeUntil(this.onDestroy$));
|
|
747
|
+
};
|
|
748
|
+
RequestHandlerService.prototype.get = function (Url, params, requestOptions) {
|
|
749
|
+
var _this = this;
|
|
750
|
+
if (requestOptions)
|
|
751
|
+
this.requestOptions = requestOptions;
|
|
752
|
+
var headers = new i1$1.HttpHeaders({
|
|
753
|
+
'Content-Type': 'application/json',
|
|
754
|
+
'Authorization': this.authService.authorizationHeaderValue(),
|
|
755
|
+
});
|
|
756
|
+
this.currentLanguage = localStorage.getItem('language');
|
|
757
|
+
headers = headers.set('Accept-Language', this.currentLanguage.toString());
|
|
758
|
+
headers = headers.set('ignore-cookies', 'true');
|
|
759
|
+
if (!this.requestOptions.disableBlockUI)
|
|
760
|
+
this.utilityService.startBlockUI();
|
|
761
|
+
return this.http.get(this.environmentService.getApiUrl() + Url, { headers: headers, params: params }).pipe(operators.takeUntil(this.onDestroy$), operators.tap(function (result) {
|
|
762
|
+
if (!_this.requestOptions.disableBlockUI)
|
|
763
|
+
_this.utilityService.stopBlockUI();
|
|
764
|
+
}));
|
|
765
|
+
};
|
|
766
|
+
RequestHandlerService.prototype.post = function (Url, model, params, requestOptions) {
|
|
767
|
+
var _this = this;
|
|
768
|
+
if (requestOptions)
|
|
769
|
+
this.requestOptions = requestOptions;
|
|
770
|
+
var headers = new i1$1.HttpHeaders({
|
|
771
|
+
'Content-Type': 'application/json',
|
|
772
|
+
'Authorization': this.authService.authorizationHeaderValue(),
|
|
773
|
+
});
|
|
774
|
+
this.currentLanguage = localStorage.getItem('language');
|
|
775
|
+
headers = headers.set('Accept-Language', this.currentLanguage.toString());
|
|
776
|
+
headers = headers.set('ignore-cookies', 'true');
|
|
777
|
+
if (!this.requestOptions.disableBlockUI)
|
|
778
|
+
this.utilityService.startBlockUI();
|
|
779
|
+
return this.http.post(this.environmentService.getApiUrl() + Url, model, { headers: headers, params: params, responseType: this.requestOptions.responseType }).pipe(operators.takeUntil(this.onDestroy$), operators.tap(function (result) {
|
|
780
|
+
if (!_this.requestOptions.disableBlockUI)
|
|
781
|
+
_this.utilityService.stopBlockUI();
|
|
782
|
+
}));
|
|
783
|
+
};
|
|
784
|
+
RequestHandlerService.prototype.delete = function (Url, deletedId, params, requestOptions) {
|
|
785
|
+
var _this = this;
|
|
786
|
+
if (requestOptions)
|
|
787
|
+
this.requestOptions = requestOptions;
|
|
788
|
+
var headers = new i1$1.HttpHeaders({
|
|
789
|
+
'Content-Type': 'application/json',
|
|
790
|
+
'Authorization': this.authService.authorizationHeaderValue(),
|
|
791
|
+
});
|
|
792
|
+
this.currentLanguage = localStorage.getItem('language');
|
|
793
|
+
headers = headers.set('Accept-Language', this.currentLanguage.toString());
|
|
794
|
+
headers = headers.set('ignore-cookies', 'true');
|
|
795
|
+
if (!this.requestOptions.disableBlockUI)
|
|
796
|
+
this.utilityService.startBlockUI();
|
|
797
|
+
return this.http.delete(this.environmentService.getApiUrl() + Url + ("/" + deletedId), { headers: headers, params: params }).pipe(operators.takeUntil(this.onDestroy$), operators.tap(function (result) {
|
|
798
|
+
if (!_this.requestOptions.disableBlockUI)
|
|
799
|
+
_this.utilityService.stopBlockUI();
|
|
800
|
+
}));
|
|
801
|
+
};
|
|
802
|
+
RequestHandlerService.prototype.put = function (Url, model, params, requestOptions) {
|
|
803
|
+
var _this = this;
|
|
804
|
+
if (requestOptions)
|
|
805
|
+
this.requestOptions = requestOptions;
|
|
806
|
+
var headers = new i1$1.HttpHeaders({
|
|
807
|
+
'Content-Type': 'application/json',
|
|
808
|
+
'Authorization': this.authService.authorizationHeaderValue(),
|
|
809
|
+
});
|
|
810
|
+
this.currentLanguage = localStorage.getItem('language');
|
|
811
|
+
headers = headers.set('Accept-Language', this.currentLanguage.toString());
|
|
812
|
+
headers = headers.set('ignore-cookies', 'true');
|
|
813
|
+
if (!this.requestOptions.disableBlockUI)
|
|
814
|
+
this.utilityService.startBlockUI();
|
|
815
|
+
return this.http.put(this.environmentService.getApiUrl() + Url, model, { headers: headers, params: params, responseType: this.requestOptions.responseType }).pipe(operators.takeUntil(this.onDestroy$), operators.tap(function (result) {
|
|
816
|
+
if (!_this.requestOptions.disableBlockUI)
|
|
817
|
+
_this.utilityService.stopBlockUI();
|
|
818
|
+
}));
|
|
819
|
+
};
|
|
820
|
+
RequestHandlerService.prototype.destroyHandler = function () {
|
|
821
|
+
this.onDestroy$.next();
|
|
822
|
+
};
|
|
823
|
+
RequestHandlerService.prototype.ngOnDestroy = function () {
|
|
824
|
+
console.log("clearInterval");
|
|
825
|
+
this.destroyHandler();
|
|
826
|
+
};
|
|
827
|
+
return RequestHandlerService;
|
|
828
|
+
}());
|
|
829
|
+
RequestHandlerService.decorators = [
|
|
830
|
+
{ type: i0.Injectable }
|
|
831
|
+
];
|
|
832
|
+
RequestHandlerService.ctorParameters = function () { return [
|
|
833
|
+
{ type: i1$1.HttpClient },
|
|
834
|
+
{ type: AuthService },
|
|
835
|
+
{ type: EnvironmentService },
|
|
836
|
+
{ type: UtilityService },
|
|
837
|
+
{ type: BBSFTranslateService }
|
|
838
|
+
]; };
|
|
839
|
+
|
|
840
|
+
var StylesBundleService = /** @class */ (function () {
|
|
841
|
+
function StylesBundleService(document, translateService) {
|
|
842
|
+
this.document = document;
|
|
843
|
+
this.translateService = translateService;
|
|
844
|
+
}
|
|
845
|
+
StylesBundleService.prototype.loadThemes = function (lang, bundleEnglishName, bundleArabicName) {
|
|
846
|
+
if (lang == "ar") {
|
|
847
|
+
this.loadStyleBundle(bundleArabicName.toString());
|
|
848
|
+
document.querySelector('html').setAttribute("lang", "ar");
|
|
849
|
+
document.querySelector('html').setAttribute("dir", "rtl");
|
|
850
|
+
}
|
|
851
|
+
else {
|
|
852
|
+
this.loadStyleBundle(bundleEnglishName.toString());
|
|
853
|
+
document.querySelector('html').setAttribute("lang", "en");
|
|
854
|
+
document.querySelector('html').setAttribute("dir", "ltr");
|
|
855
|
+
}
|
|
856
|
+
};
|
|
857
|
+
StylesBundleService.prototype.loadStyleBundle = function (styleName) {
|
|
858
|
+
var head = this.document.getElementsByTagName('head')[0];
|
|
859
|
+
var themeLink = this.document.getElementById('client-theme');
|
|
860
|
+
if (themeLink && themeLink.href.includes(styleName)) {
|
|
861
|
+
return;
|
|
862
|
+
}
|
|
863
|
+
else if (themeLink && !themeLink.href.includes(styleName)) {
|
|
864
|
+
themeLink.remove();
|
|
865
|
+
}
|
|
866
|
+
var style = this.document.createElement('link');
|
|
867
|
+
style.id = 'client-theme';
|
|
868
|
+
style.rel = 'stylesheet';
|
|
869
|
+
style.href = "" + styleName;
|
|
870
|
+
head.appendChild(style);
|
|
871
|
+
};
|
|
872
|
+
return StylesBundleService;
|
|
873
|
+
}());
|
|
874
|
+
StylesBundleService.ɵprov = i0__namespace.ɵɵdefineInjectable({ factory: function StylesBundleService_Factory() { return new StylesBundleService(i0__namespace.ɵɵinject(i1__namespace$2.DOCUMENT), i0__namespace.ɵɵinject(BBSFTranslateService)); }, token: StylesBundleService, providedIn: "root" });
|
|
875
|
+
StylesBundleService.decorators = [
|
|
876
|
+
{ type: i0.Injectable, args: [{
|
|
877
|
+
providedIn: 'root'
|
|
878
|
+
},] }
|
|
879
|
+
];
|
|
880
|
+
StylesBundleService.ctorParameters = function () { return [
|
|
881
|
+
{ type: Document, decorators: [{ type: i0.Inject, args: [i1$2.DOCUMENT,] }] },
|
|
882
|
+
{ type: BBSFTranslateService }
|
|
883
|
+
]; };
|
|
884
|
+
|
|
741
885
|
var ControlValidationService = /** @class */ (function () {
|
|
742
886
|
function ControlValidationService(utilityService) {
|
|
743
887
|
this.utilityService = utilityService;
|
|
744
888
|
this.requestOptions = new RequestOptionsModel();
|
|
745
889
|
this.isCreatedBefor = false;
|
|
746
890
|
}
|
|
747
|
-
ControlValidationService.prototype.showGlobalError = function (errorMessage) {
|
|
891
|
+
ControlValidationService.prototype.showGlobalError = function (errorMessage, formId, deleteOld) {
|
|
892
|
+
var e_1, _a;
|
|
748
893
|
var globalErorrElement = document.getElementsByClassName('alert alert-danger alert-InvalidValidation');
|
|
749
894
|
if (globalErorrElement.length > 0) {
|
|
750
895
|
this.removeElementsByClass('alert alert-danger alert-InvalidValidation');
|
|
@@ -753,28 +898,50 @@
|
|
|
753
898
|
this.removeElementsByClass('alert alert-danger alert-InvalidValidation');
|
|
754
899
|
}
|
|
755
900
|
// tslint:disable-next-line: prefer-const
|
|
756
|
-
|
|
901
|
+
if (!formId)
|
|
902
|
+
formId = "currentForm";
|
|
903
|
+
var object = document.getElementById(formId);
|
|
757
904
|
var tagName = 'div';
|
|
758
905
|
// tslint:disable-next-line: prefer-const
|
|
759
906
|
var elementToAppend = document.createElement(tagName); // Your tag name here
|
|
760
907
|
var message = "";
|
|
761
|
-
if (
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
//
|
|
908
|
+
if (!errorMessage || (typeof errorMessage == "string")) {
|
|
909
|
+
if (localStorage.getItem('language') == "ar")
|
|
910
|
+
message = errorMessage ? errorMessage : "لديك بعص الأخطاء . من فضلك قم بالمراجعه ";
|
|
911
|
+
else
|
|
912
|
+
message = errorMessage ? errorMessage : "You have some validation errors. Please check below";
|
|
913
|
+
elementToAppend.innerHTML = "<ul><li>" + message + "</li></ul>";
|
|
914
|
+
elementToAppend.className += 'alert alert-danger alert-InvalidValidation';
|
|
915
|
+
elementToAppend.id += 'errorId';
|
|
916
|
+
// tslint:disable-next-line: prefer-for-of
|
|
917
|
+
var elementToAppen = elementToAppend.cloneNode(true);
|
|
918
|
+
// let targetElement = object.getElementsByClassName("b-control")[0];
|
|
919
|
+
object.insertBefore(elementToAppen, object.firstChild);
|
|
920
|
+
}
|
|
921
|
+
else {
|
|
922
|
+
elementToAppend.innerHTML = "<ul>";
|
|
923
|
+
try {
|
|
924
|
+
for (var errorMessage_1 = __values(errorMessage), errorMessage_1_1 = errorMessage_1.next(); !errorMessage_1_1.done; errorMessage_1_1 = errorMessage_1.next()) {
|
|
925
|
+
var iterator = errorMessage_1_1.value;
|
|
926
|
+
elementToAppend.innerHTML = "<li>" + iterator + "</li>";
|
|
927
|
+
}
|
|
928
|
+
}
|
|
929
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
930
|
+
finally {
|
|
931
|
+
try {
|
|
932
|
+
if (errorMessage_1_1 && !errorMessage_1_1.done && (_a = errorMessage_1.return)) _a.call(errorMessage_1);
|
|
933
|
+
}
|
|
934
|
+
finally { if (e_1) throw e_1.error; }
|
|
935
|
+
}
|
|
936
|
+
elementToAppend.innerHTML = "</ul>";
|
|
937
|
+
elementToAppend.className += 'alert alert-danger alert-InvalidValidation';
|
|
938
|
+
elementToAppend.id += 'errorId';
|
|
939
|
+
// tslint:disable-next-line: prefer-for-of
|
|
772
940
|
var elementToAppen = elementToAppend.cloneNode(true);
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
this.isCreatedBefor = true;
|
|
776
|
-
break;
|
|
941
|
+
// let targetElement = object.getElementsByClassName("b-control")[0];
|
|
942
|
+
object.insertBefore(elementToAppen, object.firstChild);
|
|
777
943
|
}
|
|
944
|
+
this.isCreatedBefor = true;
|
|
778
945
|
};
|
|
779
946
|
ControlValidationService.prototype.RemoveGlobalError = function () {
|
|
780
947
|
var removedList = document.getElementsByClassName('alert alert-danger alert-InvalidValidation');
|
|
@@ -786,7 +953,7 @@
|
|
|
786
953
|
this.isCreatedBefor = false;
|
|
787
954
|
};
|
|
788
955
|
ControlValidationService.prototype.showInputErro = function (errors) {
|
|
789
|
-
var
|
|
956
|
+
var e_2, _a;
|
|
790
957
|
// show error on top of form
|
|
791
958
|
this.showGlobalError();
|
|
792
959
|
// remove old error from server
|
|
@@ -795,7 +962,7 @@
|
|
|
795
962
|
for (var key in errors) {
|
|
796
963
|
if (errors.hasOwnProperty(key)) {
|
|
797
964
|
try {
|
|
798
|
-
for (var _b = (
|
|
965
|
+
for (var _b = (e_2 = void 0, __values(errors[key])), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
799
966
|
var iterator = _c.value;
|
|
800
967
|
var input = document.querySelectorAll('[ng-reflect-name=' + key + ']')[0];
|
|
801
968
|
if (input.attributes['ng-reflect-name'].value === key) {
|
|
@@ -811,12 +978,12 @@
|
|
|
811
978
|
}
|
|
812
979
|
}
|
|
813
980
|
}
|
|
814
|
-
catch (
|
|
981
|
+
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
815
982
|
finally {
|
|
816
983
|
try {
|
|
817
984
|
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
818
985
|
}
|
|
819
|
-
finally { if (
|
|
986
|
+
finally { if (e_2) throw e_2.error; }
|
|
820
987
|
}
|
|
821
988
|
}
|
|
822
989
|
}
|
|
@@ -827,56 +994,60 @@
|
|
|
827
994
|
elements[0].parentNode.removeChild(elements[0]);
|
|
828
995
|
}
|
|
829
996
|
};
|
|
830
|
-
ControlValidationService.prototype.renderServerErrors = function (form, err, requestOptions) {
|
|
997
|
+
ControlValidationService.prototype.renderServerErrors = function (form, err, requestOptions, formId) {
|
|
831
998
|
var _this = this;
|
|
832
999
|
if (err.error == null) {
|
|
833
1000
|
return;
|
|
834
1001
|
}
|
|
1002
|
+
var errorsArray = [];
|
|
835
1003
|
this.requestOptions = requestOptions;
|
|
836
1004
|
err.error.validation_errors.forEach(function (element) {
|
|
837
1005
|
var fieldName = element.field;
|
|
838
|
-
var controlName = element.
|
|
1006
|
+
var controlName = element.controlName;
|
|
839
1007
|
var message = element.message;
|
|
840
1008
|
if (form == null) {
|
|
841
1009
|
_this.requestOptions.customErrorMessage ? _this.utilityService.notifyErrorMessage(_this.requestOptions.customErrorMessage) : _this.utilityService.notifyErrorMessage(fieldName + ": " + message);
|
|
842
1010
|
}
|
|
843
|
-
else if (!_this.hasControlName(form, controlName)) {
|
|
844
|
-
|
|
1011
|
+
else if (controlName && !_this.hasControlName(form, controlName)) {
|
|
1012
|
+
errorsArray.push(fieldName + ": " + message);
|
|
1013
|
+
// this.showGlobalError(`${fieldName}: ${message}`,formId )
|
|
845
1014
|
}
|
|
846
1015
|
else {
|
|
847
1016
|
_this.setFieldError(form, controlName, fieldName, message);
|
|
848
1017
|
}
|
|
849
1018
|
});
|
|
1019
|
+
if (errorsArray.length > 0)
|
|
1020
|
+
this.showGlobalError(errorsArray, formId);
|
|
850
1021
|
};
|
|
851
1022
|
ControlValidationService.prototype.hasControlName = function (form, controlName) {
|
|
852
1023
|
var control = form.get(controlName);
|
|
853
1024
|
return control != null;
|
|
854
1025
|
};
|
|
855
1026
|
ControlValidationService.prototype.setFieldError = function (form, controlName, fieldName, message) {
|
|
856
|
-
var
|
|
857
|
-
|
|
858
|
-
|
|
1027
|
+
var control = null;
|
|
1028
|
+
if (controlName)
|
|
1029
|
+
control = form.get(controlName);
|
|
1030
|
+
else
|
|
1031
|
+
control = form.get(fieldName.split('.')[0]);
|
|
1032
|
+
var errors = { "errorMassage": message };
|
|
859
1033
|
var fieldNameArray = fieldName.split('.');
|
|
860
1034
|
if (fieldNameArray.length >= 1) {
|
|
861
|
-
switch (fieldNameArray[length - 1].toLocaleLowerCase()) {
|
|
1035
|
+
switch (fieldNameArray[fieldNameArray.length - 1].toLocaleLowerCase()) {
|
|
862
1036
|
case "english":
|
|
863
|
-
var englishControl = control.get("
|
|
1037
|
+
var englishControl = control.get("English");
|
|
864
1038
|
englishControl.setErrors(errors);
|
|
865
|
-
englishControl.markAsTouched();
|
|
866
|
-
englishControl.updateValueAndValidity();
|
|
867
1039
|
break;
|
|
868
1040
|
case "arabic":
|
|
869
|
-
var arabicControl = control.get("
|
|
1041
|
+
var arabicControl = control.get("Arabic");
|
|
870
1042
|
arabicControl.setErrors(errors);
|
|
871
|
-
arabicControl.markAsTouched();
|
|
872
|
-
arabicControl.updateValueAndValidity();
|
|
873
1043
|
break;
|
|
874
1044
|
default:
|
|
875
1045
|
control.setErrors(errors);
|
|
876
|
-
control.markAsTouched();
|
|
877
|
-
control.updateValueAndValidity();
|
|
878
1046
|
}
|
|
879
1047
|
}
|
|
1048
|
+
else if (fieldNameArray.length == 1) {
|
|
1049
|
+
control.setErrors(errors);
|
|
1050
|
+
}
|
|
880
1051
|
else {
|
|
881
1052
|
this.requestOptions.customErrorMessage ? this.utilityService.notifyErrorMessage(this.requestOptions.customErrorMessage) : this.utilityService.notifyErrorMessage(fieldName + ": " + message);
|
|
882
1053
|
}
|
|
@@ -896,121 +1067,6 @@
|
|
|
896
1067
|
ngBlockUi.BlockUI()
|
|
897
1068
|
], ControlValidationService.prototype, "blockUI", void 0);
|
|
898
1069
|
|
|
899
|
-
var RequestHandlerService = /** @class */ (function () {
|
|
900
|
-
function RequestHandlerService(http, authService, environmentService, utilityService, controlValidationService, bbsfTranslateService) {
|
|
901
|
-
var _this = this;
|
|
902
|
-
this.http = http;
|
|
903
|
-
this.authService = authService;
|
|
904
|
-
this.environmentService = environmentService;
|
|
905
|
-
this.utilityService = utilityService;
|
|
906
|
-
this.controlValidationService = controlValidationService;
|
|
907
|
-
this.bbsfTranslateService = bbsfTranslateService;
|
|
908
|
-
this.requestOptions = new RequestOptionsModel();
|
|
909
|
-
this.currentLanguage = "";
|
|
910
|
-
this.onDestroy$ = new rxjs.Subject();
|
|
911
|
-
//using localStorage to avoid call getCurrentLanguage() because it is not all to use async in constructor
|
|
912
|
-
this.currentLanguage = localStorage.getItem('language');
|
|
913
|
-
this.bbsfTranslateService.onLangChange.subscribe(function (event) {
|
|
914
|
-
if (_this.currentLanguage != event.lang) {
|
|
915
|
-
_this.currentLanguage = event.lang;
|
|
916
|
-
}
|
|
917
|
-
});
|
|
918
|
-
}
|
|
919
|
-
RequestHandlerService.prototype.get = function (Url, params, requestOptions) {
|
|
920
|
-
var _this = this;
|
|
921
|
-
if (requestOptions)
|
|
922
|
-
this.requestOptions = requestOptions;
|
|
923
|
-
var headers = new i1.HttpHeaders({
|
|
924
|
-
'Content-Type': 'application/json',
|
|
925
|
-
'Authorization': this.authService.authorizationHeaderValue(),
|
|
926
|
-
});
|
|
927
|
-
headers = headers.set('Accept-Language', this.currentLanguage.toString());
|
|
928
|
-
if (!this.requestOptions.disableBlockUI)
|
|
929
|
-
this.utilityService.startBlockUI();
|
|
930
|
-
return this.http.get(this.environmentService.getApiUrl() + Url, { headers: headers, params: params }).pipe(operators.takeUntil(this.onDestroy$), operators.tap(function (result) {
|
|
931
|
-
if (!_this.requestOptions.disableBlockUI)
|
|
932
|
-
_this.utilityService.stopBlockUI();
|
|
933
|
-
}));
|
|
934
|
-
};
|
|
935
|
-
RequestHandlerService.prototype.post = function (Url, model, params, requestOptions) {
|
|
936
|
-
var _this = this;
|
|
937
|
-
if (requestOptions)
|
|
938
|
-
this.requestOptions = requestOptions;
|
|
939
|
-
var headers = new i1.HttpHeaders({
|
|
940
|
-
'Content-Type': 'application/json',
|
|
941
|
-
'Authorization': this.authService.authorizationHeaderValue(),
|
|
942
|
-
});
|
|
943
|
-
headers = headers.set('Accept-Language', this.currentLanguage.toString());
|
|
944
|
-
if (!this.requestOptions.disableBlockUI)
|
|
945
|
-
this.utilityService.startBlockUI();
|
|
946
|
-
return this.http.post(this.environmentService.getApiUrl() + Url, model, { headers: headers, params: params, responseType: this.requestOptions.responseType }).pipe(operators.takeUntil(this.onDestroy$), operators.tap(function (result) {
|
|
947
|
-
if (!_this.requestOptions.disableBlockUI)
|
|
948
|
-
_this.utilityService.stopBlockUI();
|
|
949
|
-
}));
|
|
950
|
-
};
|
|
951
|
-
RequestHandlerService.prototype.destroyHandler = function () {
|
|
952
|
-
this.onDestroy$.next();
|
|
953
|
-
};
|
|
954
|
-
return RequestHandlerService;
|
|
955
|
-
}());
|
|
956
|
-
RequestHandlerService.ɵprov = i0__namespace.ɵɵdefineInjectable({ factory: function RequestHandlerService_Factory() { return new RequestHandlerService(i0__namespace.ɵɵinject(i1__namespace.HttpClient), i0__namespace.ɵɵinject(AuthService), i0__namespace.ɵɵinject(EnvironmentService), i0__namespace.ɵɵinject(UtilityService), i0__namespace.ɵɵinject(ControlValidationService), i0__namespace.ɵɵinject(BBSFTranslateService)); }, token: RequestHandlerService, providedIn: "root" });
|
|
957
|
-
RequestHandlerService.decorators = [
|
|
958
|
-
{ type: i0.Injectable, args: [{
|
|
959
|
-
providedIn: 'root'
|
|
960
|
-
},] }
|
|
961
|
-
];
|
|
962
|
-
RequestHandlerService.ctorParameters = function () { return [
|
|
963
|
-
{ type: i1.HttpClient },
|
|
964
|
-
{ type: AuthService },
|
|
965
|
-
{ type: EnvironmentService },
|
|
966
|
-
{ type: UtilityService },
|
|
967
|
-
{ type: ControlValidationService },
|
|
968
|
-
{ type: BBSFTranslateService }
|
|
969
|
-
]; };
|
|
970
|
-
|
|
971
|
-
var StylesBundleService = /** @class */ (function () {
|
|
972
|
-
function StylesBundleService(document) {
|
|
973
|
-
this.document = document;
|
|
974
|
-
}
|
|
975
|
-
StylesBundleService.prototype.loadThemes = function (lang, bundleEnglishName, bundleArabicName) {
|
|
976
|
-
if (lang == "ar") {
|
|
977
|
-
this.loadStyleBundle(bundleArabicName.toString());
|
|
978
|
-
document.querySelector('html').setAttribute("lang", "ar");
|
|
979
|
-
document.querySelector('html').setAttribute("dir", "rtl");
|
|
980
|
-
}
|
|
981
|
-
else {
|
|
982
|
-
this.loadStyleBundle(bundleEnglishName.toString());
|
|
983
|
-
document.querySelector('html').setAttribute("lang", "en");
|
|
984
|
-
document.querySelector('html').setAttribute("dir", "ltr");
|
|
985
|
-
}
|
|
986
|
-
};
|
|
987
|
-
StylesBundleService.prototype.loadStyleBundle = function (styleName) {
|
|
988
|
-
var head = this.document.getElementsByTagName('head')[0];
|
|
989
|
-
var themeLink = this.document.getElementById('client-theme');
|
|
990
|
-
if (themeLink && themeLink.href.includes(styleName)) {
|
|
991
|
-
return;
|
|
992
|
-
}
|
|
993
|
-
else if (themeLink && !themeLink.href.includes(styleName)) {
|
|
994
|
-
themeLink.remove();
|
|
995
|
-
}
|
|
996
|
-
var style = this.document.createElement('link');
|
|
997
|
-
style.id = 'client-theme';
|
|
998
|
-
style.rel = 'stylesheet';
|
|
999
|
-
style.href = "" + styleName;
|
|
1000
|
-
head.appendChild(style);
|
|
1001
|
-
};
|
|
1002
|
-
return StylesBundleService;
|
|
1003
|
-
}());
|
|
1004
|
-
StylesBundleService.ɵprov = i0__namespace.ɵɵdefineInjectable({ factory: function StylesBundleService_Factory() { return new StylesBundleService(i0__namespace.ɵɵinject(i1__namespace$2.DOCUMENT)); }, token: StylesBundleService, providedIn: "root" });
|
|
1005
|
-
StylesBundleService.decorators = [
|
|
1006
|
-
{ type: i0.Injectable, args: [{
|
|
1007
|
-
providedIn: 'root'
|
|
1008
|
-
},] }
|
|
1009
|
-
];
|
|
1010
|
-
StylesBundleService.ctorParameters = function () { return [
|
|
1011
|
-
{ type: Document, decorators: [{ type: i0.Inject, args: [i1$2.DOCUMENT,] }] }
|
|
1012
|
-
]; };
|
|
1013
|
-
|
|
1014
1070
|
var MasterLayoutService = /** @class */ (function () {
|
|
1015
1071
|
function MasterLayoutService(router, http, authService, stylesBundleService, translate) {
|
|
1016
1072
|
this.router = router;
|
|
@@ -1041,7 +1097,7 @@
|
|
|
1041
1097
|
this.router.navigate([currentUrl]);
|
|
1042
1098
|
};
|
|
1043
1099
|
MasterLayoutService.prototype.changeLanguage = function (key) {
|
|
1044
|
-
var params = new i1.HttpParams();
|
|
1100
|
+
var params = new i1$1.HttpParams();
|
|
1045
1101
|
params = params.append("UserId", this.authService.user.profile.id);
|
|
1046
1102
|
params = params.append("LanguageKey", key);
|
|
1047
1103
|
return this.http.post(this.ApiUrl + 'updateLaguage', null, params);
|
|
@@ -1051,7 +1107,7 @@
|
|
|
1051
1107
|
};
|
|
1052
1108
|
return MasterLayoutService;
|
|
1053
1109
|
}());
|
|
1054
|
-
MasterLayoutService.ɵprov = i0__namespace.ɵɵdefineInjectable({ factory: function MasterLayoutService_Factory() { return new MasterLayoutService(i0__namespace.ɵɵinject(i1__namespace$3.Router), i0__namespace.ɵɵinject(RequestHandlerService), i0__namespace.ɵɵinject(AuthService), i0__namespace.ɵɵinject(StylesBundleService), i0__namespace.ɵɵinject(i1__namespace
|
|
1110
|
+
MasterLayoutService.ɵprov = i0__namespace.ɵɵdefineInjectable({ factory: function MasterLayoutService_Factory() { return new MasterLayoutService(i0__namespace.ɵɵinject(i1__namespace$3.Router), i0__namespace.ɵɵinject(RequestHandlerService), i0__namespace.ɵɵinject(AuthService), i0__namespace.ɵɵinject(StylesBundleService), i0__namespace.ɵɵinject(i1__namespace.TranslateService)); }, token: MasterLayoutService, providedIn: "root" });
|
|
1055
1111
|
MasterLayoutService.decorators = [
|
|
1056
1112
|
{ type: i0.Injectable, args: [{
|
|
1057
1113
|
providedIn: 'root'
|
|
@@ -1062,7 +1118,7 @@
|
|
|
1062
1118
|
{ type: RequestHandlerService },
|
|
1063
1119
|
{ type: AuthService },
|
|
1064
1120
|
{ type: StylesBundleService },
|
|
1065
|
-
{ type: i1
|
|
1121
|
+
{ type: i1.TranslateService }
|
|
1066
1122
|
]; };
|
|
1067
1123
|
|
|
1068
1124
|
exports.AppInjector = void 0;
|
|
@@ -1090,7 +1146,7 @@
|
|
|
1090
1146
|
AuthService,
|
|
1091
1147
|
RequestHandlerService,
|
|
1092
1148
|
StylesBundleService,
|
|
1093
|
-
i1
|
|
1149
|
+
i1.TranslateService,
|
|
1094
1150
|
BBSFTranslateService,
|
|
1095
1151
|
ControlValidationService,
|
|
1096
1152
|
MasterLayoutService
|
|
@@ -1101,6 +1157,23 @@
|
|
|
1101
1157
|
{ type: i0.Injector }
|
|
1102
1158
|
]; };
|
|
1103
1159
|
|
|
1160
|
+
var TranslationResolverService = /** @class */ (function () {
|
|
1161
|
+
function TranslationResolverService(translateService) {
|
|
1162
|
+
this.translateService = translateService;
|
|
1163
|
+
}
|
|
1164
|
+
TranslationResolverService.prototype.resolve = function () {
|
|
1165
|
+
return this.translateService.getTranslation(this.translateService.currentLang);
|
|
1166
|
+
};
|
|
1167
|
+
return TranslationResolverService;
|
|
1168
|
+
}());
|
|
1169
|
+
TranslationResolverService.ɵprov = i0__namespace.ɵɵdefineInjectable({ factory: function TranslationResolverService_Factory() { return new TranslationResolverService(i0__namespace.ɵɵinject(BBSFTranslateService)); }, token: TranslationResolverService, providedIn: "root" });
|
|
1170
|
+
TranslationResolverService.decorators = [
|
|
1171
|
+
{ type: i0.Injectable, args: [{ providedIn: 'root' },] }
|
|
1172
|
+
];
|
|
1173
|
+
TranslationResolverService.ctorParameters = function () { return [
|
|
1174
|
+
{ type: BBSFTranslateService }
|
|
1175
|
+
]; };
|
|
1176
|
+
|
|
1104
1177
|
/*
|
|
1105
1178
|
* Public API Surface of @bnsights/bbsf-utilities
|
|
1106
1179
|
*/
|
|
@@ -1118,6 +1191,7 @@
|
|
|
1118
1191
|
exports.RequestHandlerService = RequestHandlerService;
|
|
1119
1192
|
exports.RequestOptionsModel = RequestOptionsModel;
|
|
1120
1193
|
exports.StylesBundleService = StylesBundleService;
|
|
1194
|
+
exports.TranslationResolverService = TranslationResolverService;
|
|
1121
1195
|
exports.UtilityService = UtilityService;
|
|
1122
1196
|
exports.environment = environment;
|
|
1123
1197
|
|