tnx-shared 5.3.364 → 5.3.365
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/tnx-shared.umd.js +291 -254
- package/bundles/tnx-shared.umd.js.map +1 -1
- package/bundles/tnx-shared.umd.min.js +1 -1
- package/bundles/tnx-shared.umd.min.js.map +1 -1
- package/components/common-lib/common-lib.component.d.ts +14 -1
- package/components/common-lib/common-lib.component.d.ts.map +1 -1
- package/esm2015/components/common-lib/common-lib.component.js +45 -3
- package/fesm2015/tnx-shared.js +265 -229
- package/fesm2015/tnx-shared.js.map +1 -1
- package/package.json +2 -2
- package/tnx-shared.metadata.json +1 -1
|
@@ -39325,16 +39325,287 @@
|
|
|
39325
39325
|
control: [{ type: i0.Input }]
|
|
39326
39326
|
};
|
|
39327
39327
|
|
|
39328
|
+
var GenericGuardChildService = /** @class */ (function () {
|
|
39329
|
+
function GenericGuardChildService(_userService, _permissionService, _router, _injector, _notifierService) {
|
|
39330
|
+
this._userService = _userService;
|
|
39331
|
+
this._permissionService = _permissionService;
|
|
39332
|
+
this._router = _router;
|
|
39333
|
+
this._injector = _injector;
|
|
39334
|
+
this._notifierService = _notifierService;
|
|
39335
|
+
this.storage = sessionStorage;
|
|
39336
|
+
}
|
|
39337
|
+
GenericGuardChildService.prototype.canActivateChild = function (route, state) {
|
|
39338
|
+
var _this = this;
|
|
39339
|
+
return new Promise(function (resolve) { return __awaiter(_this, void 0, void 0, function () {
|
|
39340
|
+
var _applicationContext, root, service, permission, isAuthorized, firstTimeLogin;
|
|
39341
|
+
return __generator(this, function (_a) {
|
|
39342
|
+
switch (_a.label) {
|
|
39343
|
+
case 0:
|
|
39344
|
+
_applicationContext = this._injector.get(ApplicationContextService);
|
|
39345
|
+
root = _applicationContext.getRootContext();
|
|
39346
|
+
if (state.url == '/') {
|
|
39347
|
+
resolve(true);
|
|
39348
|
+
return [2 /*return*/];
|
|
39349
|
+
}
|
|
39350
|
+
if ((top.location.href.indexOf('/dashboard') > -1)
|
|
39351
|
+
|| (top.location.href.indexOf('/access-denied') > -1)) {
|
|
39352
|
+
resolve(true);
|
|
39353
|
+
return [2 /*return*/];
|
|
39354
|
+
}
|
|
39355
|
+
service = root.data.currentAppMetadata.code;
|
|
39356
|
+
permission = ("" + root.data.currentAppMetadata.code + state.url.split('#')[0].split('?')[0]).toUpperCase();
|
|
39357
|
+
return [4 /*yield*/, this._permissionService.isAuthorized(service, permission)];
|
|
39358
|
+
case 1:
|
|
39359
|
+
isAuthorized = _a.sent();
|
|
39360
|
+
if (isAuthorized) {
|
|
39361
|
+
resolve(true);
|
|
39362
|
+
}
|
|
39363
|
+
else {
|
|
39364
|
+
firstTimeLogin = localStorage.getItem('firstTimeLogin');
|
|
39365
|
+
if (firstTimeLogin && firstTimeLogin !== '' && firstTimeLogin == 'true') {
|
|
39366
|
+
localStorage.removeItem('firstTimeLogin');
|
|
39367
|
+
top.location.href = '/';
|
|
39368
|
+
}
|
|
39369
|
+
else {
|
|
39370
|
+
top.location.href = window['baseHref'] + '/access-denied';
|
|
39371
|
+
}
|
|
39372
|
+
resolve(false);
|
|
39373
|
+
}
|
|
39374
|
+
resolve(true);
|
|
39375
|
+
return [2 /*return*/];
|
|
39376
|
+
}
|
|
39377
|
+
});
|
|
39378
|
+
}); });
|
|
39379
|
+
};
|
|
39380
|
+
return GenericGuardChildService;
|
|
39381
|
+
}());
|
|
39382
|
+
GenericGuardChildService.ɵprov = i0__namespace.ɵɵdefineInjectable({ factory: function GenericGuardChildService_Factory() { return new GenericGuardChildService(i0__namespace.ɵɵinject(UserService), i0__namespace.ɵɵinject(PermissionService), i0__namespace.ɵɵinject(i3__namespace$1.Router), i0__namespace.ɵɵinject(i0__namespace.INJECTOR), i0__namespace.ɵɵinject(NotifierService)); }, token: GenericGuardChildService, providedIn: "root" });
|
|
39383
|
+
GenericGuardChildService.decorators = [
|
|
39384
|
+
{ type: i0.Injectable, args: [{
|
|
39385
|
+
providedIn: 'root'
|
|
39386
|
+
},] }
|
|
39387
|
+
];
|
|
39388
|
+
GenericGuardChildService.ctorParameters = function () { return [
|
|
39389
|
+
{ type: UserService },
|
|
39390
|
+
{ type: PermissionService },
|
|
39391
|
+
{ type: i3$1.Router },
|
|
39392
|
+
{ type: i0.Injector },
|
|
39393
|
+
{ type: NotifierService }
|
|
39394
|
+
]; };
|
|
39395
|
+
|
|
39396
|
+
var GenericGuardService = /** @class */ (function () {
|
|
39397
|
+
function GenericGuardService(_permissionService, _injector) {
|
|
39398
|
+
this._permissionService = _permissionService;
|
|
39399
|
+
this._injector = _injector;
|
|
39400
|
+
this.storage = sessionStorage;
|
|
39401
|
+
}
|
|
39402
|
+
GenericGuardService.prototype.canActivate = function (route, state) {
|
|
39403
|
+
var _this = this;
|
|
39404
|
+
return new Promise(function (resolve) { return __awaiter(_this, void 0, void 0, function () {
|
|
39405
|
+
var _applicationContext, root, service, permission, isAuthorized, firstTimeLogin;
|
|
39406
|
+
return __generator(this, function (_a) {
|
|
39407
|
+
switch (_a.label) {
|
|
39408
|
+
case 0:
|
|
39409
|
+
_applicationContext = this._injector.get(ApplicationContextService);
|
|
39410
|
+
root = _applicationContext.getRootContext();
|
|
39411
|
+
if (state.url == '/') {
|
|
39412
|
+
resolve(true);
|
|
39413
|
+
return [2 /*return*/];
|
|
39414
|
+
}
|
|
39415
|
+
if ((top.location.href.indexOf('/dashboard') > -1)
|
|
39416
|
+
|| (top.location.href.indexOf('/access-denied') > -1)) {
|
|
39417
|
+
resolve(true);
|
|
39418
|
+
return [2 /*return*/];
|
|
39419
|
+
}
|
|
39420
|
+
service = root.data.currentAppMetadata.code;
|
|
39421
|
+
permission = ("" + root.data.currentAppMetadata.code + state.url.split('#')[0].split('?')[0]).toUpperCase();
|
|
39422
|
+
return [4 /*yield*/, this._permissionService.isAuthorized(service, permission)];
|
|
39423
|
+
case 1:
|
|
39424
|
+
isAuthorized = _a.sent();
|
|
39425
|
+
if (isAuthorized) {
|
|
39426
|
+
resolve(true);
|
|
39427
|
+
}
|
|
39428
|
+
else {
|
|
39429
|
+
firstTimeLogin = localStorage.getItem('firstTimeLogin');
|
|
39430
|
+
if (firstTimeLogin && firstTimeLogin !== '' && firstTimeLogin == 'true') {
|
|
39431
|
+
localStorage.removeItem('firstTimeLogin');
|
|
39432
|
+
top.location.href = '/';
|
|
39433
|
+
}
|
|
39434
|
+
else {
|
|
39435
|
+
top.location.href = '/access-denied';
|
|
39436
|
+
}
|
|
39437
|
+
resolve(false);
|
|
39438
|
+
}
|
|
39439
|
+
resolve(true);
|
|
39440
|
+
return [2 /*return*/];
|
|
39441
|
+
}
|
|
39442
|
+
});
|
|
39443
|
+
}); });
|
|
39444
|
+
};
|
|
39445
|
+
return GenericGuardService;
|
|
39446
|
+
}());
|
|
39447
|
+
GenericGuardService.ɵprov = i0__namespace.ɵɵdefineInjectable({ factory: function GenericGuardService_Factory() { return new GenericGuardService(i0__namespace.ɵɵinject(PermissionService), i0__namespace.ɵɵinject(i0__namespace.INJECTOR)); }, token: GenericGuardService, providedIn: "root" });
|
|
39448
|
+
GenericGuardService.decorators = [
|
|
39449
|
+
{ type: i0.Injectable, args: [{
|
|
39450
|
+
providedIn: 'root'
|
|
39451
|
+
},] }
|
|
39452
|
+
];
|
|
39453
|
+
GenericGuardService.ctorParameters = function () { return [
|
|
39454
|
+
{ type: PermissionService },
|
|
39455
|
+
{ type: i0.Injector }
|
|
39456
|
+
]; };
|
|
39457
|
+
|
|
39458
|
+
var StorageService = /** @class */ (function () {
|
|
39459
|
+
function StorageService(_moduleConfigService) {
|
|
39460
|
+
this._moduleConfigService = _moduleConfigService;
|
|
39461
|
+
this.ignoreBuildInCacheKey = /(expires_at|id_token_expires_at|nonce|access_token_stored_at|id_token_stored_at|id_token|access_token|id_token_claims_obj|session_state|granted_scopes)/i;
|
|
39462
|
+
var st = this._moduleConfigService.getConfig().environment.storage;
|
|
39463
|
+
if (st === 'sessionStorage') {
|
|
39464
|
+
this.storage = sessionStorage;
|
|
39465
|
+
}
|
|
39466
|
+
else {
|
|
39467
|
+
this.storage = localStorage;
|
|
39468
|
+
}
|
|
39469
|
+
}
|
|
39470
|
+
StorageService.prototype.setStorage = function (storage) {
|
|
39471
|
+
this.storage = storage;
|
|
39472
|
+
};
|
|
39473
|
+
StorageService.prototype.getStorage = function () {
|
|
39474
|
+
return this.storage;
|
|
39475
|
+
};
|
|
39476
|
+
StorageService.prototype.setItem = function (key, value) {
|
|
39477
|
+
if (!value) {
|
|
39478
|
+
this.storage.setItem(key, null);
|
|
39479
|
+
}
|
|
39480
|
+
if (value instanceof Object) {
|
|
39481
|
+
this.storage.setItem(key, JSON.stringify(value));
|
|
39482
|
+
}
|
|
39483
|
+
else {
|
|
39484
|
+
this.storage.setItem(key, value ? value.toString() : null);
|
|
39485
|
+
}
|
|
39486
|
+
};
|
|
39487
|
+
StorageService.prototype.removeItem = function (key) {
|
|
39488
|
+
this.storage.removeItem(key);
|
|
39489
|
+
if (key.startsWith('v4_')) {
|
|
39490
|
+
this.storage.removeItem(key.replace('v4_', ''));
|
|
39491
|
+
}
|
|
39492
|
+
else {
|
|
39493
|
+
this.storage.removeItem('v4_' + key);
|
|
39494
|
+
}
|
|
39495
|
+
};
|
|
39496
|
+
StorageService.prototype.removeByPattern = function (pattern) {
|
|
39497
|
+
var _this = this;
|
|
39498
|
+
this.getCacheKeysByPattern(pattern).forEach(function (item) {
|
|
39499
|
+
_this.removeItem(item);
|
|
39500
|
+
if (item.startsWith('v4_')) {
|
|
39501
|
+
_this.storage.removeItem(item.replace('v4_', ''));
|
|
39502
|
+
}
|
|
39503
|
+
else {
|
|
39504
|
+
_this.storage.removeItem('v4_' + item);
|
|
39505
|
+
}
|
|
39506
|
+
});
|
|
39507
|
+
};
|
|
39508
|
+
StorageService.prototype.getItem = function (key) {
|
|
39509
|
+
return this.storage.getItem(key);
|
|
39510
|
+
};
|
|
39511
|
+
StorageService.prototype.getNumber = function (key, defaultValueIfNull) {
|
|
39512
|
+
if (defaultValueIfNull === void 0) { defaultValueIfNull = 0; }
|
|
39513
|
+
var rs = this.getItem(key);
|
|
39514
|
+
if (rs) {
|
|
39515
|
+
return +rs;
|
|
39516
|
+
}
|
|
39517
|
+
return defaultValueIfNull;
|
|
39518
|
+
};
|
|
39519
|
+
StorageService.prototype.getBoolean = function (key, defaultValueIfNull) {
|
|
39520
|
+
if (defaultValueIfNull === void 0) { defaultValueIfNull = false; }
|
|
39521
|
+
var rs = this.getItem(key);
|
|
39522
|
+
if (rs) {
|
|
39523
|
+
return rs.toLowerCase() === 'true';
|
|
39524
|
+
}
|
|
39525
|
+
return defaultValueIfNull;
|
|
39526
|
+
};
|
|
39527
|
+
StorageService.prototype.getObject = function (key) {
|
|
39528
|
+
var rs = this.getItem(key);
|
|
39529
|
+
if (rs) {
|
|
39530
|
+
return JSON.parse(rs);
|
|
39531
|
+
}
|
|
39532
|
+
return null;
|
|
39533
|
+
};
|
|
39534
|
+
StorageService.prototype.getObjectAny = function (key) {
|
|
39535
|
+
var rs = this.getItem(key);
|
|
39536
|
+
if (rs) {
|
|
39537
|
+
return JSON.parse(rs);
|
|
39538
|
+
}
|
|
39539
|
+
return null;
|
|
39540
|
+
};
|
|
39541
|
+
StorageService.prototype.getAllCachekeys = function () {
|
|
39542
|
+
var _this = this;
|
|
39543
|
+
return Object.keys(this.storage).filter(function (x) { return !x.match(_this.ignoreBuildInCacheKey); });
|
|
39544
|
+
};
|
|
39545
|
+
StorageService.prototype.getCacheKeysByPattern = function (pattern) {
|
|
39546
|
+
var _this = this;
|
|
39547
|
+
return Object.keys(this.storage).filter(function (x) { return !x.match(_this.ignoreBuildInCacheKey) && _this.matchRuleShort(pattern, x); });
|
|
39548
|
+
};
|
|
39549
|
+
StorageService.prototype.matchRuleShort = function (str, rule) {
|
|
39550
|
+
var escapeRegex = function (str) { return str.replace(/([.*+?^=!:${}()|\[\]\/\\])/g, '\\$1'); };
|
|
39551
|
+
return new RegExp('^' + rule.split('*').map(escapeRegex).join('.*') + '$').test(str);
|
|
39552
|
+
};
|
|
39553
|
+
// Explanation code
|
|
39554
|
+
StorageService.prototype.matchRuleExpl = function (str, rule) {
|
|
39555
|
+
// for this solution to work on any string, no matter what characters it has
|
|
39556
|
+
var escapeRegex = function (str) { return str.replace(/([.*+?^=!:${}()|\[\]\/\\])/g, '\\$1'); };
|
|
39557
|
+
// "." => Find a single character, except newline or line terminator
|
|
39558
|
+
// ".*" => Matches any string that contains zero or more characters
|
|
39559
|
+
rule = rule.split('*').map(escapeRegex).join('.*');
|
|
39560
|
+
// "^" => Matches any string with the following at the beginning of it
|
|
39561
|
+
// "$" => Matches any string with that in front at the end of it
|
|
39562
|
+
rule = '^' + rule + '$';
|
|
39563
|
+
// Create a regular expression object for matching string
|
|
39564
|
+
var regex = new RegExp(rule);
|
|
39565
|
+
// Returns true if it finds a match, otherwise it returns false
|
|
39566
|
+
return regex.test(str);
|
|
39567
|
+
};
|
|
39568
|
+
return StorageService;
|
|
39569
|
+
}());
|
|
39570
|
+
StorageService.ɵprov = i0__namespace.ɵɵdefineInjectable({ factory: function StorageService_Factory() { return new StorageService(i0__namespace.ɵɵinject(ModuleConfigService)); }, token: StorageService, providedIn: "root" });
|
|
39571
|
+
StorageService.decorators = [
|
|
39572
|
+
{ type: i0.Injectable, args: [{
|
|
39573
|
+
providedIn: 'root'
|
|
39574
|
+
},] }
|
|
39575
|
+
];
|
|
39576
|
+
StorageService.ctorParameters = function () { return [
|
|
39577
|
+
{ type: ModuleConfigService }
|
|
39578
|
+
]; };
|
|
39579
|
+
|
|
39328
39580
|
var CommonLibComponent = /** @class */ (function () {
|
|
39329
|
-
function CommonLibComponent(_componentContextService) {
|
|
39581
|
+
function CommonLibComponent(_componentContextService, _router, _activatedRoute, _applicationContext, _storageService, _moduleConfigService) {
|
|
39330
39582
|
var _this = this;
|
|
39331
39583
|
this._componentContextService = _componentContextService;
|
|
39584
|
+
this._router = _router;
|
|
39585
|
+
this._activatedRoute = _activatedRoute;
|
|
39586
|
+
this._applicationContext = _applicationContext;
|
|
39587
|
+
this._storageService = _storageService;
|
|
39588
|
+
this._moduleConfigService = _moduleConfigService;
|
|
39332
39589
|
this.showRejectConfirm = true;
|
|
39590
|
+
this.appCode = '';
|
|
39591
|
+
this.environment = this._moduleConfigService.getConfig().environment;
|
|
39592
|
+
this.appCode = this._moduleConfigService.getConfig().appCode;
|
|
39333
39593
|
this._componentContextService.subscribe(ComCtxConstants.ROOT.SHOW_REJECT_CONFIRM, function (data) {
|
|
39334
39594
|
_this.showRejectConfirm = data;
|
|
39335
39595
|
});
|
|
39596
|
+
this._applicationContext.addRootContext(this._componentContextService, _activatedRoute);
|
|
39597
|
+
this._componentContextService.data.personalize = this._storageService.getObjectAny('personalize');
|
|
39598
|
+
if (!this._componentContextService.data.personalize) {
|
|
39599
|
+
this._componentContextService.data.personalize = {};
|
|
39600
|
+
}
|
|
39336
39601
|
}
|
|
39337
39602
|
CommonLibComponent.prototype.ngOnInit = function () {
|
|
39603
|
+
var _this = this;
|
|
39604
|
+
var root = this._applicationContext.getRootContext();
|
|
39605
|
+
this.rootData = root.data;
|
|
39606
|
+
root.data.currentAppMetadata = this.environment.appMetadata.appSwitcher.find(function (x) { return x.code.toLowerCase() == _this.appCode.toLowerCase(); });
|
|
39607
|
+
root.data.appOrigin = this.environment.enableBaseHref ? "/" + root.data.currentAppMetadata.code.toLowerCase() + "/" : '/';
|
|
39608
|
+
this._router.config.forEach(function (route) { return _this.addGuard(route); });
|
|
39338
39609
|
};
|
|
39339
39610
|
CommonLibComponent.prototype.focusTrap = function (event, direct) {
|
|
39340
39611
|
event.preventDefault();
|
|
@@ -39345,6 +39616,19 @@
|
|
|
39345
39616
|
this.cancelButton.nativeElement.focus();
|
|
39346
39617
|
}
|
|
39347
39618
|
};
|
|
39619
|
+
CommonLibComponent.prototype.addGuard = function (route) {
|
|
39620
|
+
if (route.path === '' || route.path === '/') {
|
|
39621
|
+
return;
|
|
39622
|
+
}
|
|
39623
|
+
else {
|
|
39624
|
+
if (route.loadChildren) {
|
|
39625
|
+
route.canActivateChild = route.canActivateChild ? route.canActivateChild : [GenericGuardChildService];
|
|
39626
|
+
}
|
|
39627
|
+
else {
|
|
39628
|
+
route.canActivate = route.canActivate ? route.canActivate : [GenericGuardService];
|
|
39629
|
+
}
|
|
39630
|
+
}
|
|
39631
|
+
};
|
|
39348
39632
|
return CommonLibComponent;
|
|
39349
39633
|
}());
|
|
39350
39634
|
CommonLibComponent.decorators = [
|
|
@@ -39356,7 +39640,12 @@
|
|
|
39356
39640
|
},] }
|
|
39357
39641
|
];
|
|
39358
39642
|
CommonLibComponent.ctorParameters = function () { return [
|
|
39359
|
-
{ type: ComponentContextService }
|
|
39643
|
+
{ type: ComponentContextService },
|
|
39644
|
+
{ type: i3$1.Router },
|
|
39645
|
+
{ type: i3$1.ActivatedRoute },
|
|
39646
|
+
{ type: ApplicationContextService },
|
|
39647
|
+
{ type: StorageService },
|
|
39648
|
+
{ type: ModuleConfigService }
|
|
39360
39649
|
]; };
|
|
39361
39650
|
CommonLibComponent.propDecorators = {
|
|
39362
39651
|
okButton: [{ type: i0.ViewChild, args: ['okButton',] }],
|
|
@@ -41533,68 +41822,6 @@
|
|
|
41533
41822
|
{ type: ModuleConfigService }
|
|
41534
41823
|
]; };
|
|
41535
41824
|
|
|
41536
|
-
var GenericGuardService = /** @class */ (function () {
|
|
41537
|
-
function GenericGuardService(_permissionService, _injector) {
|
|
41538
|
-
this._permissionService = _permissionService;
|
|
41539
|
-
this._injector = _injector;
|
|
41540
|
-
this.storage = sessionStorage;
|
|
41541
|
-
}
|
|
41542
|
-
GenericGuardService.prototype.canActivate = function (route, state) {
|
|
41543
|
-
var _this = this;
|
|
41544
|
-
return new Promise(function (resolve) { return __awaiter(_this, void 0, void 0, function () {
|
|
41545
|
-
var _applicationContext, root, service, permission, isAuthorized, firstTimeLogin;
|
|
41546
|
-
return __generator(this, function (_a) {
|
|
41547
|
-
switch (_a.label) {
|
|
41548
|
-
case 0:
|
|
41549
|
-
_applicationContext = this._injector.get(ApplicationContextService);
|
|
41550
|
-
root = _applicationContext.getRootContext();
|
|
41551
|
-
if (state.url == '/') {
|
|
41552
|
-
resolve(true);
|
|
41553
|
-
return [2 /*return*/];
|
|
41554
|
-
}
|
|
41555
|
-
if ((top.location.href.indexOf('/dashboard') > -1)
|
|
41556
|
-
|| (top.location.href.indexOf('/access-denied') > -1)) {
|
|
41557
|
-
resolve(true);
|
|
41558
|
-
return [2 /*return*/];
|
|
41559
|
-
}
|
|
41560
|
-
service = root.data.currentAppMetadata.code;
|
|
41561
|
-
permission = ("" + root.data.currentAppMetadata.code + state.url.split('#')[0].split('?')[0]).toUpperCase();
|
|
41562
|
-
return [4 /*yield*/, this._permissionService.isAuthorized(service, permission)];
|
|
41563
|
-
case 1:
|
|
41564
|
-
isAuthorized = _a.sent();
|
|
41565
|
-
if (isAuthorized) {
|
|
41566
|
-
resolve(true);
|
|
41567
|
-
}
|
|
41568
|
-
else {
|
|
41569
|
-
firstTimeLogin = localStorage.getItem('firstTimeLogin');
|
|
41570
|
-
if (firstTimeLogin && firstTimeLogin !== '' && firstTimeLogin == 'true') {
|
|
41571
|
-
localStorage.removeItem('firstTimeLogin');
|
|
41572
|
-
top.location.href = '/';
|
|
41573
|
-
}
|
|
41574
|
-
else {
|
|
41575
|
-
top.location.href = '/access-denied';
|
|
41576
|
-
}
|
|
41577
|
-
resolve(false);
|
|
41578
|
-
}
|
|
41579
|
-
resolve(true);
|
|
41580
|
-
return [2 /*return*/];
|
|
41581
|
-
}
|
|
41582
|
-
});
|
|
41583
|
-
}); });
|
|
41584
|
-
};
|
|
41585
|
-
return GenericGuardService;
|
|
41586
|
-
}());
|
|
41587
|
-
GenericGuardService.ɵprov = i0__namespace.ɵɵdefineInjectable({ factory: function GenericGuardService_Factory() { return new GenericGuardService(i0__namespace.ɵɵinject(PermissionService), i0__namespace.ɵɵinject(i0__namespace.INJECTOR)); }, token: GenericGuardService, providedIn: "root" });
|
|
41588
|
-
GenericGuardService.decorators = [
|
|
41589
|
-
{ type: i0.Injectable, args: [{
|
|
41590
|
-
providedIn: 'root'
|
|
41591
|
-
},] }
|
|
41592
|
-
];
|
|
41593
|
-
GenericGuardService.ctorParameters = function () { return [
|
|
41594
|
-
{ type: PermissionService },
|
|
41595
|
-
{ type: i0.Injector }
|
|
41596
|
-
]; };
|
|
41597
|
-
|
|
41598
41825
|
var GlobalService = /** @class */ (function () {
|
|
41599
41826
|
function GlobalService() {
|
|
41600
41827
|
this._state = true;
|
|
@@ -42360,128 +42587,6 @@
|
|
|
42360
42587
|
];
|
|
42361
42588
|
RandomDataService.ctorParameters = function () { return []; };
|
|
42362
42589
|
|
|
42363
|
-
var StorageService = /** @class */ (function () {
|
|
42364
|
-
function StorageService(_moduleConfigService) {
|
|
42365
|
-
this._moduleConfigService = _moduleConfigService;
|
|
42366
|
-
this.ignoreBuildInCacheKey = /(expires_at|id_token_expires_at|nonce|access_token_stored_at|id_token_stored_at|id_token|access_token|id_token_claims_obj|session_state|granted_scopes)/i;
|
|
42367
|
-
var st = this._moduleConfigService.getConfig().environment.storage;
|
|
42368
|
-
if (st === 'sessionStorage') {
|
|
42369
|
-
this.storage = sessionStorage;
|
|
42370
|
-
}
|
|
42371
|
-
else {
|
|
42372
|
-
this.storage = localStorage;
|
|
42373
|
-
}
|
|
42374
|
-
}
|
|
42375
|
-
StorageService.prototype.setStorage = function (storage) {
|
|
42376
|
-
this.storage = storage;
|
|
42377
|
-
};
|
|
42378
|
-
StorageService.prototype.getStorage = function () {
|
|
42379
|
-
return this.storage;
|
|
42380
|
-
};
|
|
42381
|
-
StorageService.prototype.setItem = function (key, value) {
|
|
42382
|
-
if (!value) {
|
|
42383
|
-
this.storage.setItem(key, null);
|
|
42384
|
-
}
|
|
42385
|
-
if (value instanceof Object) {
|
|
42386
|
-
this.storage.setItem(key, JSON.stringify(value));
|
|
42387
|
-
}
|
|
42388
|
-
else {
|
|
42389
|
-
this.storage.setItem(key, value ? value.toString() : null);
|
|
42390
|
-
}
|
|
42391
|
-
};
|
|
42392
|
-
StorageService.prototype.removeItem = function (key) {
|
|
42393
|
-
this.storage.removeItem(key);
|
|
42394
|
-
if (key.startsWith('v4_')) {
|
|
42395
|
-
this.storage.removeItem(key.replace('v4_', ''));
|
|
42396
|
-
}
|
|
42397
|
-
else {
|
|
42398
|
-
this.storage.removeItem('v4_' + key);
|
|
42399
|
-
}
|
|
42400
|
-
};
|
|
42401
|
-
StorageService.prototype.removeByPattern = function (pattern) {
|
|
42402
|
-
var _this = this;
|
|
42403
|
-
this.getCacheKeysByPattern(pattern).forEach(function (item) {
|
|
42404
|
-
_this.removeItem(item);
|
|
42405
|
-
if (item.startsWith('v4_')) {
|
|
42406
|
-
_this.storage.removeItem(item.replace('v4_', ''));
|
|
42407
|
-
}
|
|
42408
|
-
else {
|
|
42409
|
-
_this.storage.removeItem('v4_' + item);
|
|
42410
|
-
}
|
|
42411
|
-
});
|
|
42412
|
-
};
|
|
42413
|
-
StorageService.prototype.getItem = function (key) {
|
|
42414
|
-
return this.storage.getItem(key);
|
|
42415
|
-
};
|
|
42416
|
-
StorageService.prototype.getNumber = function (key, defaultValueIfNull) {
|
|
42417
|
-
if (defaultValueIfNull === void 0) { defaultValueIfNull = 0; }
|
|
42418
|
-
var rs = this.getItem(key);
|
|
42419
|
-
if (rs) {
|
|
42420
|
-
return +rs;
|
|
42421
|
-
}
|
|
42422
|
-
return defaultValueIfNull;
|
|
42423
|
-
};
|
|
42424
|
-
StorageService.prototype.getBoolean = function (key, defaultValueIfNull) {
|
|
42425
|
-
if (defaultValueIfNull === void 0) { defaultValueIfNull = false; }
|
|
42426
|
-
var rs = this.getItem(key);
|
|
42427
|
-
if (rs) {
|
|
42428
|
-
return rs.toLowerCase() === 'true';
|
|
42429
|
-
}
|
|
42430
|
-
return defaultValueIfNull;
|
|
42431
|
-
};
|
|
42432
|
-
StorageService.prototype.getObject = function (key) {
|
|
42433
|
-
var rs = this.getItem(key);
|
|
42434
|
-
if (rs) {
|
|
42435
|
-
return JSON.parse(rs);
|
|
42436
|
-
}
|
|
42437
|
-
return null;
|
|
42438
|
-
};
|
|
42439
|
-
StorageService.prototype.getObjectAny = function (key) {
|
|
42440
|
-
var rs = this.getItem(key);
|
|
42441
|
-
if (rs) {
|
|
42442
|
-
return JSON.parse(rs);
|
|
42443
|
-
}
|
|
42444
|
-
return null;
|
|
42445
|
-
};
|
|
42446
|
-
StorageService.prototype.getAllCachekeys = function () {
|
|
42447
|
-
var _this = this;
|
|
42448
|
-
return Object.keys(this.storage).filter(function (x) { return !x.match(_this.ignoreBuildInCacheKey); });
|
|
42449
|
-
};
|
|
42450
|
-
StorageService.prototype.getCacheKeysByPattern = function (pattern) {
|
|
42451
|
-
var _this = this;
|
|
42452
|
-
return Object.keys(this.storage).filter(function (x) { return !x.match(_this.ignoreBuildInCacheKey) && _this.matchRuleShort(pattern, x); });
|
|
42453
|
-
};
|
|
42454
|
-
StorageService.prototype.matchRuleShort = function (str, rule) {
|
|
42455
|
-
var escapeRegex = function (str) { return str.replace(/([.*+?^=!:${}()|\[\]\/\\])/g, '\\$1'); };
|
|
42456
|
-
return new RegExp('^' + rule.split('*').map(escapeRegex).join('.*') + '$').test(str);
|
|
42457
|
-
};
|
|
42458
|
-
// Explanation code
|
|
42459
|
-
StorageService.prototype.matchRuleExpl = function (str, rule) {
|
|
42460
|
-
// for this solution to work on any string, no matter what characters it has
|
|
42461
|
-
var escapeRegex = function (str) { return str.replace(/([.*+?^=!:${}()|\[\]\/\\])/g, '\\$1'); };
|
|
42462
|
-
// "." => Find a single character, except newline or line terminator
|
|
42463
|
-
// ".*" => Matches any string that contains zero or more characters
|
|
42464
|
-
rule = rule.split('*').map(escapeRegex).join('.*');
|
|
42465
|
-
// "^" => Matches any string with the following at the beginning of it
|
|
42466
|
-
// "$" => Matches any string with that in front at the end of it
|
|
42467
|
-
rule = '^' + rule + '$';
|
|
42468
|
-
// Create a regular expression object for matching string
|
|
42469
|
-
var regex = new RegExp(rule);
|
|
42470
|
-
// Returns true if it finds a match, otherwise it returns false
|
|
42471
|
-
return regex.test(str);
|
|
42472
|
-
};
|
|
42473
|
-
return StorageService;
|
|
42474
|
-
}());
|
|
42475
|
-
StorageService.ɵprov = i0__namespace.ɵɵdefineInjectable({ factory: function StorageService_Factory() { return new StorageService(i0__namespace.ɵɵinject(ModuleConfigService)); }, token: StorageService, providedIn: "root" });
|
|
42476
|
-
StorageService.decorators = [
|
|
42477
|
-
{ type: i0.Injectable, args: [{
|
|
42478
|
-
providedIn: 'root'
|
|
42479
|
-
},] }
|
|
42480
|
-
];
|
|
42481
|
-
StorageService.ctorParameters = function () { return [
|
|
42482
|
-
{ type: ModuleConfigService }
|
|
42483
|
-
]; };
|
|
42484
|
-
|
|
42485
42590
|
var TemplateTextV4Service = /** @class */ (function (_super) {
|
|
42486
42591
|
__extends(TemplateTextV4Service, _super);
|
|
42487
42592
|
function TemplateTextV4Service(_moduleConfigService, _httpClient, _printService, _fileV4Service, _notifierService, _crudService, _commonService, injector) {
|
|
@@ -43571,74 +43676,6 @@
|
|
|
43571
43676
|
{ type: ModuleConfigService }
|
|
43572
43677
|
]; };
|
|
43573
43678
|
|
|
43574
|
-
var GenericGuardChildService = /** @class */ (function () {
|
|
43575
|
-
function GenericGuardChildService(_userService, _permissionService, _router, _injector, _notifierService) {
|
|
43576
|
-
this._userService = _userService;
|
|
43577
|
-
this._permissionService = _permissionService;
|
|
43578
|
-
this._router = _router;
|
|
43579
|
-
this._injector = _injector;
|
|
43580
|
-
this._notifierService = _notifierService;
|
|
43581
|
-
this.storage = sessionStorage;
|
|
43582
|
-
}
|
|
43583
|
-
GenericGuardChildService.prototype.canActivateChild = function (route, state) {
|
|
43584
|
-
var _this = this;
|
|
43585
|
-
return new Promise(function (resolve) { return __awaiter(_this, void 0, void 0, function () {
|
|
43586
|
-
var _applicationContext, root, service, permission, isAuthorized, firstTimeLogin;
|
|
43587
|
-
return __generator(this, function (_a) {
|
|
43588
|
-
switch (_a.label) {
|
|
43589
|
-
case 0:
|
|
43590
|
-
_applicationContext = this._injector.get(ApplicationContextService);
|
|
43591
|
-
root = _applicationContext.getRootContext();
|
|
43592
|
-
if (state.url == '/') {
|
|
43593
|
-
resolve(true);
|
|
43594
|
-
return [2 /*return*/];
|
|
43595
|
-
}
|
|
43596
|
-
if ((top.location.href.indexOf('/dashboard') > -1)
|
|
43597
|
-
|| (top.location.href.indexOf('/access-denied') > -1)) {
|
|
43598
|
-
resolve(true);
|
|
43599
|
-
return [2 /*return*/];
|
|
43600
|
-
}
|
|
43601
|
-
service = root.data.currentAppMetadata.code;
|
|
43602
|
-
permission = ("" + root.data.currentAppMetadata.code + state.url.split('#')[0].split('?')[0]).toUpperCase();
|
|
43603
|
-
return [4 /*yield*/, this._permissionService.isAuthorized(service, permission)];
|
|
43604
|
-
case 1:
|
|
43605
|
-
isAuthorized = _a.sent();
|
|
43606
|
-
if (isAuthorized) {
|
|
43607
|
-
resolve(true);
|
|
43608
|
-
}
|
|
43609
|
-
else {
|
|
43610
|
-
firstTimeLogin = localStorage.getItem('firstTimeLogin');
|
|
43611
|
-
if (firstTimeLogin && firstTimeLogin !== '' && firstTimeLogin == 'true') {
|
|
43612
|
-
localStorage.removeItem('firstTimeLogin');
|
|
43613
|
-
top.location.href = '/';
|
|
43614
|
-
}
|
|
43615
|
-
else {
|
|
43616
|
-
top.location.href = window['baseHref'] + '/access-denied';
|
|
43617
|
-
}
|
|
43618
|
-
resolve(false);
|
|
43619
|
-
}
|
|
43620
|
-
resolve(true);
|
|
43621
|
-
return [2 /*return*/];
|
|
43622
|
-
}
|
|
43623
|
-
});
|
|
43624
|
-
}); });
|
|
43625
|
-
};
|
|
43626
|
-
return GenericGuardChildService;
|
|
43627
|
-
}());
|
|
43628
|
-
GenericGuardChildService.ɵprov = i0__namespace.ɵɵdefineInjectable({ factory: function GenericGuardChildService_Factory() { return new GenericGuardChildService(i0__namespace.ɵɵinject(UserService), i0__namespace.ɵɵinject(PermissionService), i0__namespace.ɵɵinject(i3__namespace$1.Router), i0__namespace.ɵɵinject(i0__namespace.INJECTOR), i0__namespace.ɵɵinject(NotifierService)); }, token: GenericGuardChildService, providedIn: "root" });
|
|
43629
|
-
GenericGuardChildService.decorators = [
|
|
43630
|
-
{ type: i0.Injectable, args: [{
|
|
43631
|
-
providedIn: 'root'
|
|
43632
|
-
},] }
|
|
43633
|
-
];
|
|
43634
|
-
GenericGuardChildService.ctorParameters = function () { return [
|
|
43635
|
-
{ type: UserService },
|
|
43636
|
-
{ type: PermissionService },
|
|
43637
|
-
{ type: i3$1.Router },
|
|
43638
|
-
{ type: i0.Injector },
|
|
43639
|
-
{ type: NotifierService }
|
|
43640
|
-
]; };
|
|
43641
|
-
|
|
43642
43679
|
var LatexService = /** @class */ (function () {
|
|
43643
43680
|
function LatexService(_commonService, _templateInstanceService, _fileObjectService) {
|
|
43644
43681
|
this._commonService = _commonService;
|