monkey-front-core 0.0.304 → 0.0.305
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/esm2020/lib/core/directives/monkeyecx-security-directive.mjs +9 -7
- package/esm2020/lib/core/services/commons/monkeyecx-commons.service.mjs +11 -8
- package/esm2020/lib/core/services/error/monkeyecx-http-error-handling.service.mjs +4 -4
- package/esm2020/lib/core/services/storage/monkeyecx-token-storage.service.mjs +32 -15
- package/esm2020/lib/store/selectors/monkeyecx-storage.selector.mjs +2 -2
- package/fesm2015/monkey-front-core.mjs +184 -149
- package/fesm2015/monkey-front-core.mjs.map +1 -1
- package/fesm2020/monkey-front-core.mjs +73 -52
- package/fesm2020/monkey-front-core.mjs.map +1 -1
- package/lib/core/directives/monkeyecx-security-directive.d.ts +1 -0
- package/lib/core/services/commons/monkeyecx-commons.service.d.ts +6 -6
- package/lib/core/services/error/monkeyecx-http-error-handling.service.d.ts +4 -4
- package/lib/core/services/storage/monkeyecx-token-storage.service.d.ts +23 -3
- package/lib/store/selectors/monkeyecx-storage.selector.d.ts +1 -1
- package/monkey-front-core-0.0.305.tgz +0 -0
- package/package.json +1 -1
- package/monkey-front-core-0.0.304.tgz +0 -0
|
@@ -19,10 +19,10 @@ import { NG_VALUE_ACCESSOR } from '@angular/forms';
|
|
|
19
19
|
import { TemplatePortal } from '@angular/cdk/portal';
|
|
20
20
|
import * as i1$4 from '@angular/cdk/overlay';
|
|
21
21
|
import { OverlayModule } from '@angular/cdk/overlay';
|
|
22
|
+
import { __awaiter, __decorate } from 'tslib';
|
|
22
23
|
import * as i2$3 from '@ngrx/store';
|
|
23
24
|
import { createAction, props, INIT, UPDATE, createReducer, on, createFeatureSelector, createSelector, StoreModule } from '@ngrx/store';
|
|
24
25
|
import { createEntityAdapter } from '@ngrx/entity';
|
|
25
|
-
import { __awaiter, __decorate } from 'tslib';
|
|
26
26
|
import { datadogRum } from '@datadog/browser-rum';
|
|
27
27
|
import * as i1$5 from '@angular/service-worker';
|
|
28
28
|
import { ServiceWorkerModule } from '@angular/service-worker';
|
|
@@ -2558,7 +2558,7 @@ const selectState = createFeatureSelector(featureKey);
|
|
|
2558
2558
|
const selectAll = createSelector(selectState, selectAll$1);
|
|
2559
2559
|
const select = (props) => {
|
|
2560
2560
|
return createSelector(selectAll, (entities) => {
|
|
2561
|
-
return entities.
|
|
2561
|
+
return entities.find((_) => {
|
|
2562
2562
|
return _.username === props.username;
|
|
2563
2563
|
});
|
|
2564
2564
|
});
|
|
@@ -2589,6 +2589,28 @@ var index = /*#__PURE__*/Object.freeze({
|
|
|
2589
2589
|
selectors: index$1
|
|
2590
2590
|
});
|
|
2591
2591
|
|
|
2592
|
+
class Link {
|
|
2593
|
+
constructor(data) {
|
|
2594
|
+
this.href = data === null || data === void 0 ? void 0 : data.href;
|
|
2595
|
+
this.type = data === null || data === void 0 ? void 0 : data.type;
|
|
2596
|
+
this.templated = data === null || data === void 0 ? void 0 : data.templated;
|
|
2597
|
+
}
|
|
2598
|
+
}
|
|
2599
|
+
class MonkeyEcxModel {
|
|
2600
|
+
getAction(type, replaceOptions) {
|
|
2601
|
+
const { _links } = this;
|
|
2602
|
+
if (!_links)
|
|
2603
|
+
return null;
|
|
2604
|
+
let link = _links[type.toLowerCase()];
|
|
2605
|
+
link = new Link(link);
|
|
2606
|
+
if (link && replaceOptions && (link === null || link === void 0 ? void 0 : link.templated)) {
|
|
2607
|
+
const { from, to } = replaceOptions;
|
|
2608
|
+
link = new Link(Object.assign(Object.assign({}, link), { href: `${link.href}`.replace(from, to) }));
|
|
2609
|
+
}
|
|
2610
|
+
return link;
|
|
2611
|
+
}
|
|
2612
|
+
}
|
|
2613
|
+
|
|
2592
2614
|
class MonkeyEcxRequestPagedHandling {
|
|
2593
2615
|
constructor(url, pagedParams, links, samePage = false) {
|
|
2594
2616
|
this.samePage = false;
|
|
@@ -2630,28 +2652,6 @@ class MonkeyEcxRequestPagedHandling {
|
|
|
2630
2652
|
}
|
|
2631
2653
|
}
|
|
2632
2654
|
|
|
2633
|
-
class Link {
|
|
2634
|
-
constructor(data) {
|
|
2635
|
-
this.href = data === null || data === void 0 ? void 0 : data.href;
|
|
2636
|
-
this.type = data === null || data === void 0 ? void 0 : data.type;
|
|
2637
|
-
this.templated = data === null || data === void 0 ? void 0 : data.templated;
|
|
2638
|
-
}
|
|
2639
|
-
}
|
|
2640
|
-
class MonkeyEcxModel {
|
|
2641
|
-
getAction(type, replaceOptions) {
|
|
2642
|
-
const { _links } = this;
|
|
2643
|
-
if (!_links)
|
|
2644
|
-
return null;
|
|
2645
|
-
let link = _links[type.toLowerCase()];
|
|
2646
|
-
link = new Link(link);
|
|
2647
|
-
if (link && replaceOptions && (link === null || link === void 0 ? void 0 : link.templated)) {
|
|
2648
|
-
const { from, to } = replaceOptions;
|
|
2649
|
-
link = new Link(Object.assign(Object.assign({}, link), { href: `${link.href}`.replace(from, to) }));
|
|
2650
|
-
}
|
|
2651
|
-
return link;
|
|
2652
|
-
}
|
|
2653
|
-
}
|
|
2654
|
-
|
|
2655
2655
|
class LinksModel extends MonkeyEcxModel {
|
|
2656
2656
|
constructor(data) {
|
|
2657
2657
|
super();
|
|
@@ -2683,7 +2683,7 @@ class MonkeyEcxCommonsService {
|
|
|
2683
2683
|
this.__onZipCodeDataChanged$ = new BehaviorSubject(null);
|
|
2684
2684
|
this.__oni18nDataChanged$ = new BehaviorSubject(null);
|
|
2685
2685
|
this.__onDoSearch$ = new BehaviorSubject({});
|
|
2686
|
-
this.__tokenCredentials =
|
|
2686
|
+
this.__tokenCredentials = undefined;
|
|
2687
2687
|
this.__schedule = null;
|
|
2688
2688
|
this.__callbackPagination = () => {
|
|
2689
2689
|
// eslint-disable-next-line no-console
|
|
@@ -2694,25 +2694,27 @@ class MonkeyEcxCommonsService {
|
|
|
2694
2694
|
}
|
|
2695
2695
|
handleInit() {
|
|
2696
2696
|
var _a, _b, _c;
|
|
2697
|
-
|
|
2698
|
-
|
|
2699
|
-
|
|
2700
|
-
|
|
2701
|
-
|
|
2702
|
-
clearOnChangeRoute:
|
|
2703
|
-
|
|
2704
|
-
|
|
2705
|
-
.
|
|
2706
|
-
|
|
2707
|
-
|
|
2708
|
-
|
|
2709
|
-
|
|
2710
|
-
|
|
2711
|
-
|
|
2712
|
-
|
|
2713
|
-
|
|
2714
|
-
|
|
2715
|
-
|
|
2697
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
2698
|
+
if (this.tokenStorage) {
|
|
2699
|
+
this.__tokenCredentials = yield this.tokenStorage.getToken();
|
|
2700
|
+
}
|
|
2701
|
+
if ((_a = this.otherArgs) === null || _a === void 0 ? void 0 : _a.router) {
|
|
2702
|
+
const { clearOnChangeRoute } = ((_c = (_b = this.otherArgs) === null || _b === void 0 ? void 0 : _b.schedule) === null || _c === void 0 ? void 0 : _c.options) || {
|
|
2703
|
+
clearOnChangeRoute: false
|
|
2704
|
+
};
|
|
2705
|
+
this.otherArgs.router.events
|
|
2706
|
+
.pipe(filter((event) => {
|
|
2707
|
+
return event instanceof NavigationStart;
|
|
2708
|
+
}), take(1))
|
|
2709
|
+
.subscribe(() => {
|
|
2710
|
+
var _a, _b, _c;
|
|
2711
|
+
if (this.__schedule && clearOnChangeRoute) {
|
|
2712
|
+
(_c = (_b = (_a = this.otherArgs) === null || _a === void 0 ? void 0 : _a.schedule) === null || _b === void 0 ? void 0 : _b.service) === null || _c === void 0 ? void 0 : _c.removeSchedule(this.__schedule);
|
|
2713
|
+
this.__schedule = null;
|
|
2714
|
+
}
|
|
2715
|
+
});
|
|
2716
|
+
}
|
|
2717
|
+
});
|
|
2716
2718
|
}
|
|
2717
2719
|
navigateToPendencyPage(arg, router) {
|
|
2718
2720
|
const { companyType } = this.__tokenCredentials || {
|
|
@@ -2875,77 +2877,82 @@ class MonkeyEcxCommonsService {
|
|
|
2875
2877
|
}
|
|
2876
2878
|
resolve(route, state, otherArgs) {
|
|
2877
2879
|
var _a, _b, _c;
|
|
2878
|
-
|
|
2879
|
-
|
|
2880
|
-
|
|
2881
|
-
|
|
2882
|
-
this.__requestPaged = null;
|
|
2883
|
-
this.flagValidator = true;
|
|
2884
|
-
if (this.tokenStorage) {
|
|
2885
|
-
this.__tokenCredentials = this.tokenStorage.getToken();
|
|
2886
|
-
}
|
|
2887
|
-
const pend = this.allowedSecurityAccessByPendency(otherArgs === null || otherArgs === void 0 ? void 0 : otherArgs.pendency);
|
|
2888
|
-
const allowedByProgram = this.allowedSecurityAccessByFeature(otherArgs === null || otherArgs === void 0 ? void 0 : otherArgs.featureByProgram);
|
|
2889
|
-
if (this.allowedSecurityAccess(otherArgs === null || otherArgs === void 0 ? void 0 : otherArgs.security) &&
|
|
2890
|
-
this.allowedSecurityAccessByCountry(otherArgs === null || otherArgs === void 0 ? void 0 : otherArgs.countrySecurity) &&
|
|
2891
|
-
!pend.hasPendencies &&
|
|
2892
|
-
allowedByProgram) {
|
|
2893
|
-
if (this.__schedule) {
|
|
2894
|
-
(_c = (_b = (_a = this.otherArgs) === null || _a === void 0 ? void 0 : _a.schedule) === null || _b === void 0 ? void 0 : _b.service) === null || _c === void 0 ? void 0 : _c.removeSchedule(this.__schedule);
|
|
2895
|
-
this.__schedule = null;
|
|
2896
|
-
}
|
|
2897
|
-
const { __requestPaged } = this;
|
|
2898
|
-
if (!__requestPaged) {
|
|
2899
|
-
this.setPage({
|
|
2900
|
-
page: {
|
|
2901
|
-
number: 0,
|
|
2902
|
-
size: 10
|
|
2903
|
-
}
|
|
2904
|
-
});
|
|
2905
|
-
}
|
|
2906
|
-
if (otherArgs === null || otherArgs === void 0 ? void 0 : otherArgs.translateOptions) {
|
|
2907
|
-
const { service, keys } = otherArgs === null || otherArgs === void 0 ? void 0 : otherArgs.translateOptions;
|
|
2908
|
-
this.geti18n(service, keys || '');
|
|
2909
|
-
}
|
|
2910
|
-
if (otherArgs === null || otherArgs === void 0 ? void 0 : otherArgs.callbackPagination) {
|
|
2911
|
-
this.__callbackPagination = otherArgs.callbackPagination;
|
|
2880
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
2881
|
+
if (JSON.stringify(route === null || route === void 0 ? void 0 : route.queryParams) === '{}') {
|
|
2882
|
+
this.__data = null;
|
|
2883
|
+
this.__page = null;
|
|
2912
2884
|
}
|
|
2913
|
-
|
|
2914
|
-
|
|
2915
|
-
|
|
2885
|
+
this.__requestPaged = null;
|
|
2886
|
+
this.flagValidator = true;
|
|
2887
|
+
if (this.tokenStorage) {
|
|
2888
|
+
console.log('resolve commmons');
|
|
2889
|
+
this.__tokenCredentials = yield this.tokenStorage.getToken();
|
|
2890
|
+
console.log('this.__tokenCredentials');
|
|
2891
|
+
console.log(this.__tokenCredentials);
|
|
2916
2892
|
}
|
|
2917
|
-
|
|
2918
|
-
|
|
2919
|
-
|
|
2920
|
-
|
|
2921
|
-
|
|
2922
|
-
|
|
2923
|
-
|
|
2924
|
-
|
|
2925
|
-
|
|
2926
|
-
|
|
2927
|
-
|
|
2928
|
-
|
|
2929
|
-
|
|
2893
|
+
const pend = this.allowedSecurityAccessByPendency(otherArgs === null || otherArgs === void 0 ? void 0 : otherArgs.pendency);
|
|
2894
|
+
const allowedByProgram = this.allowedSecurityAccessByFeature(otherArgs === null || otherArgs === void 0 ? void 0 : otherArgs.featureByProgram);
|
|
2895
|
+
if (this.allowedSecurityAccess(otherArgs === null || otherArgs === void 0 ? void 0 : otherArgs.security) &&
|
|
2896
|
+
this.allowedSecurityAccessByCountry(otherArgs === null || otherArgs === void 0 ? void 0 : otherArgs.countrySecurity) &&
|
|
2897
|
+
!pend.hasPendencies &&
|
|
2898
|
+
allowedByProgram) {
|
|
2899
|
+
if (this.__schedule) {
|
|
2900
|
+
(_c = (_b = (_a = this.otherArgs) === null || _a === void 0 ? void 0 : _a.schedule) === null || _b === void 0 ? void 0 : _b.service) === null || _c === void 0 ? void 0 : _c.removeSchedule(this.__schedule);
|
|
2901
|
+
this.__schedule = null;
|
|
2902
|
+
}
|
|
2903
|
+
const { __requestPaged } = this;
|
|
2904
|
+
if (!__requestPaged) {
|
|
2905
|
+
this.setPage({
|
|
2906
|
+
page: {
|
|
2907
|
+
number: 0,
|
|
2908
|
+
size: 10
|
|
2909
|
+
}
|
|
2910
|
+
});
|
|
2911
|
+
}
|
|
2912
|
+
if (otherArgs === null || otherArgs === void 0 ? void 0 : otherArgs.translateOptions) {
|
|
2913
|
+
const { service, keys } = otherArgs === null || otherArgs === void 0 ? void 0 : otherArgs.translateOptions;
|
|
2914
|
+
this.geti18n(service, keys || '');
|
|
2915
|
+
}
|
|
2916
|
+
if (otherArgs === null || otherArgs === void 0 ? void 0 : otherArgs.callbackPagination) {
|
|
2917
|
+
this.__callbackPagination = otherArgs.callbackPagination;
|
|
2918
|
+
}
|
|
2919
|
+
if (otherArgs === null || otherArgs === void 0 ? void 0 : otherArgs.paginationOptions) {
|
|
2920
|
+
this.__paginationOptions = otherArgs === null || otherArgs === void 0 ? void 0 : otherArgs.paginationOptions;
|
|
2921
|
+
this.handlePaginationOptions();
|
|
2922
|
+
}
|
|
2923
|
+
if (otherArgs === null || otherArgs === void 0 ? void 0 : otherArgs.feature) {
|
|
2924
|
+
const { flag, service } = otherArgs.feature;
|
|
2925
|
+
service.onFlags
|
|
2926
|
+
.pipe(takeWhile(() => {
|
|
2927
|
+
return this.flagValidator;
|
|
2928
|
+
}))
|
|
2929
|
+
.subscribe((val) => {
|
|
2930
|
+
if (val) {
|
|
2931
|
+
const hasFlag = service.getFlag(flag);
|
|
2932
|
+
if (MonkeyEcxUtils.persistNullEmptyUndefined(hasFlag)) {
|
|
2933
|
+
if (!hasFlag) {
|
|
2934
|
+
this.navigateToErrorPage(404, otherArgs === null || otherArgs === void 0 ? void 0 : otherArgs.router);
|
|
2935
|
+
return;
|
|
2936
|
+
}
|
|
2930
2937
|
}
|
|
2938
|
+
otherArgs === null || otherArgs === void 0 ? void 0 : otherArgs.callbackMain();
|
|
2931
2939
|
}
|
|
2932
|
-
|
|
2933
|
-
|
|
2934
|
-
|
|
2940
|
+
});
|
|
2941
|
+
}
|
|
2942
|
+
else {
|
|
2943
|
+
otherArgs === null || otherArgs === void 0 ? void 0 : otherArgs.callbackMain();
|
|
2944
|
+
}
|
|
2945
|
+
}
|
|
2946
|
+
else if (!allowedByProgram) {
|
|
2947
|
+
this.navigateToErrorPage(404, otherArgs === null || otherArgs === void 0 ? void 0 : otherArgs.router);
|
|
2948
|
+
}
|
|
2949
|
+
else if (pend.hasPendencies) {
|
|
2950
|
+
this.navigateToPendencyPage(pend, otherArgs === null || otherArgs === void 0 ? void 0 : otherArgs.router);
|
|
2935
2951
|
}
|
|
2936
2952
|
else {
|
|
2937
|
-
otherArgs === null || otherArgs === void 0 ? void 0 : otherArgs.
|
|
2953
|
+
this.navigateToErrorPage(403, otherArgs === null || otherArgs === void 0 ? void 0 : otherArgs.router);
|
|
2938
2954
|
}
|
|
2939
|
-
}
|
|
2940
|
-
else if (!allowedByProgram) {
|
|
2941
|
-
this.navigateToErrorPage(404, otherArgs === null || otherArgs === void 0 ? void 0 : otherArgs.router);
|
|
2942
|
-
}
|
|
2943
|
-
else if (pend.hasPendencies) {
|
|
2944
|
-
this.navigateToPendencyPage(pend, otherArgs === null || otherArgs === void 0 ? void 0 : otherArgs.router);
|
|
2945
|
-
}
|
|
2946
|
-
else {
|
|
2947
|
-
this.navigateToErrorPage(403, otherArgs === null || otherArgs === void 0 ? void 0 : otherArgs.router);
|
|
2948
|
-
}
|
|
2955
|
+
});
|
|
2949
2956
|
}
|
|
2950
2957
|
getHTTPHeaderApplicationPDF() {
|
|
2951
2958
|
return {
|
|
@@ -3645,15 +3652,27 @@ class MonkeyEcxTokenStorageService {
|
|
|
3645
3652
|
}
|
|
3646
3653
|
getAllTokens() {
|
|
3647
3654
|
var _a;
|
|
3648
|
-
|
|
3649
|
-
|
|
3650
|
-
|
|
3651
|
-
|
|
3655
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
3656
|
+
const { store, monkeyecxConfigService } = this;
|
|
3657
|
+
const username = localStorage.getItem('username');
|
|
3658
|
+
let data = {
|
|
3659
|
+
username: username || '',
|
|
3660
|
+
program: ''
|
|
3661
|
+
};
|
|
3662
|
+
if (username) {
|
|
3663
|
+
data = yield store.select(select({ username })).pipe(take(1)).toPromise();
|
|
3664
|
+
data === null || data === void 0 ? true : delete data.me;
|
|
3665
|
+
}
|
|
3666
|
+
const config = yield monkeyecxConfigService.config()
|
|
3667
|
+
.pipe(first((val) => {
|
|
3668
|
+
return !!val && JSON.stringify(val) !== '{}';
|
|
3669
|
+
}))
|
|
3670
|
+
.toPromise();
|
|
3671
|
+
if (data && !(data === null || data === void 0 ? void 0 : data.program) && (config === null || config === void 0 ? void 0 : config.program)) {
|
|
3672
|
+
data.program = (_a = config === null || config === void 0 ? void 0 : config.program) === null || _a === void 0 ? void 0 : _a.token;
|
|
3673
|
+
}
|
|
3674
|
+
return data;
|
|
3652
3675
|
});
|
|
3653
|
-
if (!(handledToken === null || handledToken === void 0 ? void 0 : handledToken.program) && (config === null || config === void 0 ? void 0 : config.program)) {
|
|
3654
|
-
handledToken.program = (_a = config === null || config === void 0 ? void 0 : config.program) === null || _a === void 0 ? void 0 : _a.token;
|
|
3655
|
-
}
|
|
3656
|
-
return handledToken;
|
|
3657
3676
|
}
|
|
3658
3677
|
setAllMe(me) {
|
|
3659
3678
|
const { me$, store } = this;
|
|
@@ -3678,8 +3697,18 @@ class MonkeyEcxTokenStorageService {
|
|
|
3678
3697
|
me$.next(previousMe);
|
|
3679
3698
|
}
|
|
3680
3699
|
getAllMe() {
|
|
3681
|
-
|
|
3682
|
-
|
|
3700
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
3701
|
+
const { store } = this;
|
|
3702
|
+
const username = localStorage.getItem('username');
|
|
3703
|
+
let data = {
|
|
3704
|
+
username: username || '',
|
|
3705
|
+
program: ''
|
|
3706
|
+
};
|
|
3707
|
+
if (username) {
|
|
3708
|
+
data = yield store.select(select({ username })).pipe(take(1)).toPromise();
|
|
3709
|
+
}
|
|
3710
|
+
return data === null || data === void 0 ? void 0 : data.me;
|
|
3711
|
+
});
|
|
3683
3712
|
}
|
|
3684
3713
|
tokenHasChanged() {
|
|
3685
3714
|
return this.token$.asObservable();
|
|
@@ -3758,7 +3787,7 @@ class MonkeyEcxSecurityDirective {
|
|
|
3758
3787
|
this.cdr = cdr;
|
|
3759
3788
|
this.roles = [];
|
|
3760
3789
|
this.byExclusion = false;
|
|
3761
|
-
this.tokenCredentials =
|
|
3790
|
+
this.tokenCredentials = undefined;
|
|
3762
3791
|
// not to do
|
|
3763
3792
|
}
|
|
3764
3793
|
getRole() {
|
|
@@ -3791,15 +3820,19 @@ class MonkeyEcxSecurityDirective {
|
|
|
3791
3820
|
this.elementRef.nativeElement.style.display = display;
|
|
3792
3821
|
this.cdr.detectChanges();
|
|
3793
3822
|
}
|
|
3823
|
+
handleData() {
|
|
3824
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
3825
|
+
this.tokenCredentials = yield this.tokenStorageService.getToken();
|
|
3826
|
+
this.handleAccess();
|
|
3827
|
+
});
|
|
3828
|
+
}
|
|
3794
3829
|
ngOnInit() {
|
|
3795
3830
|
this.elementRef.nativeElement.style.display = 'none';
|
|
3796
3831
|
this.cdr.detectChanges();
|
|
3797
3832
|
this.tokenStorageService.tokenHasChanged().subscribe(() => {
|
|
3798
|
-
this.
|
|
3799
|
-
this.handleAccess();
|
|
3833
|
+
this.handleData();
|
|
3800
3834
|
});
|
|
3801
|
-
this.
|
|
3802
|
-
this.handleAccess();
|
|
3835
|
+
this.handleData();
|
|
3803
3836
|
}
|
|
3804
3837
|
}
|
|
3805
3838
|
MonkeyEcxSecurityDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MonkeyEcxSecurityDirective, deps: [{ token: i0.ElementRef }, { token: MonkeyEcxTokenStorageService }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Directive });
|
|
@@ -3807,7 +3840,7 @@ MonkeyEcxSecurityDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0
|
|
|
3807
3840
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MonkeyEcxSecurityDirective, decorators: [{
|
|
3808
3841
|
type: Directive,
|
|
3809
3842
|
args: [{
|
|
3810
|
-
selector: '[monkeyecxSecurity]'
|
|
3843
|
+
selector: '[monkeyecxSecurity]'
|
|
3811
3844
|
}]
|
|
3812
3845
|
}], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: MonkeyEcxTokenStorageService }, { type: i0.ChangeDetectorRef }]; }, propDecorators: { roles: [{
|
|
3813
3846
|
type: Input,
|
|
@@ -4305,31 +4338,33 @@ class MonkeyEcxHttpErrorHandlingService extends MonkeyEcxCommonsService {
|
|
|
4305
4338
|
}
|
|
4306
4339
|
}
|
|
4307
4340
|
handleError(error, mkc) {
|
|
4308
|
-
|
|
4309
|
-
|
|
4310
|
-
|
|
4311
|
-
|
|
4312
|
-
|
|
4313
|
-
|
|
4314
|
-
|
|
4315
|
-
|
|
4316
|
-
|
|
4317
|
-
|
|
4318
|
-
|
|
4319
|
-
|
|
4320
|
-
|
|
4321
|
-
|
|
4322
|
-
|
|
4323
|
-
|
|
4324
|
-
|
|
4325
|
-
|
|
4326
|
-
|
|
4327
|
-
|
|
4328
|
-
|
|
4329
|
-
|
|
4330
|
-
|
|
4331
|
-
|
|
4332
|
-
|
|
4341
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
4342
|
+
const { router, tokenStorage } = this;
|
|
4343
|
+
const { status } = error;
|
|
4344
|
+
const { companyType } = (yield (tokenStorage === null || tokenStorage === void 0 ? void 0 : tokenStorage.getToken())) || { companyType: '' };
|
|
4345
|
+
const routes = {
|
|
4346
|
+
403: 'forbidden',
|
|
4347
|
+
500: 'service-problems',
|
|
4348
|
+
503: 'service-problems'
|
|
4349
|
+
};
|
|
4350
|
+
let route = '/app';
|
|
4351
|
+
if (companyType) {
|
|
4352
|
+
route = `${route}/${companyType}/pages`;
|
|
4353
|
+
}
|
|
4354
|
+
else {
|
|
4355
|
+
route = `${route}/pages`;
|
|
4356
|
+
}
|
|
4357
|
+
const found = routes[status];
|
|
4358
|
+
let timeout = 0;
|
|
4359
|
+
if (found && !this.isHttpCodeIgnoreRedirect(mkc, error === null || error === void 0 ? void 0 : error.status)) {
|
|
4360
|
+
route = `${route}/${found}`.toLowerCase();
|
|
4361
|
+
timeout = 800;
|
|
4362
|
+
router.navigate([route]);
|
|
4363
|
+
}
|
|
4364
|
+
setTimeout(() => {
|
|
4365
|
+
this.handleMessage(error, mkc);
|
|
4366
|
+
}, timeout);
|
|
4367
|
+
});
|
|
4333
4368
|
}
|
|
4334
4369
|
handleErrorRefreshToken(error, mkc) {
|
|
4335
4370
|
if (error.status === 401 || error.status === 400) {
|