monkey-front-core 0.0.333 → 0.0.335

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.
@@ -2695,7 +2695,6 @@ class MonkeyEcxCommonsService {
2695
2695
  this.__onZipCodeDataChanged$ = new BehaviorSubject(null);
2696
2696
  this.__oni18nDataChanged$ = new BehaviorSubject(null);
2697
2697
  this.__onDoSearch$ = new BehaviorSubject({});
2698
- this.__tokenCredentials = null;
2699
2698
  this.__schedule = null;
2700
2699
  this.__callbackPagination = () => {
2701
2700
  // eslint-disable-next-line no-console
@@ -2704,10 +2703,7 @@ class MonkeyEcxCommonsService {
2704
2703
  this.__isAbleToDoPagination = {};
2705
2704
  this.handleInit();
2706
2705
  }
2707
- async handleInit() {
2708
- if (this.tokenStorage) {
2709
- this.__tokenCredentials = await this.tokenStorage.getToken();
2710
- }
2706
+ handleInit() {
2711
2707
  if (this.otherArgs?.router) {
2712
2708
  const { clearOnChangeRoute } = this.otherArgs?.schedule?.options || {
2713
2709
  clearOnChangeRoute: false
@@ -2724,10 +2720,7 @@ class MonkeyEcxCommonsService {
2724
2720
  });
2725
2721
  }
2726
2722
  }
2727
- navigateToPendencyPage(arg, router) {
2728
- const { companyType } = this.__tokenCredentials || {
2729
- companyType: ''
2730
- };
2723
+ navigateToPendencyPage(arg, companyType, router) {
2731
2724
  let route = '/app';
2732
2725
  if (companyType) {
2733
2726
  route = `${route}/${companyType}/pages`;
@@ -2747,15 +2740,6 @@ class MonkeyEcxCommonsService {
2747
2740
  });
2748
2741
  }
2749
2742
  }
2750
- getRole() {
2751
- const { __tokenCredentials } = this;
2752
- if (!__tokenCredentials)
2753
- return '';
2754
- if (__tokenCredentials?.programAdmin === 'true') {
2755
- return 'PROGRAM_ADMIN';
2756
- }
2757
- return __tokenCredentials?.role || '';
2758
- }
2759
2743
  allowedSecurityAccessByPendency(args) {
2760
2744
  if (!args) {
2761
2745
  return {
@@ -2787,44 +2771,6 @@ class MonkeyEcxCommonsService {
2787
2771
  return true;
2788
2772
  return arg.country === arg.envCountry;
2789
2773
  }
2790
- allowedSecurityAccess(args) {
2791
- if (!args)
2792
- return true;
2793
- const roles = args?.roles;
2794
- const byExclusion = args?.byExclusion;
2795
- const found = roles?.indexOf(this.getRole());
2796
- let ret = false;
2797
- if (byExclusion) {
2798
- ret = true;
2799
- if (found > -1) {
2800
- ret = false;
2801
- }
2802
- }
2803
- else {
2804
- ret = false;
2805
- if (found > -1) {
2806
- ret = true;
2807
- }
2808
- }
2809
- if (!roles || roles.length === 0 || this.getRole() === 'PROGRAM_ADMIN') {
2810
- ret = true;
2811
- }
2812
- return ret;
2813
- }
2814
- navigateToErrorPage(statusCode, router) {
2815
- const routes = {
2816
- 403: 'forbidden',
2817
- 404: 'not-found',
2818
- 500: 'service-problems',
2819
- 503: 'service-problems'
2820
- };
2821
- if (!router) {
2822
- console.error('Router must be declared');
2823
- }
2824
- else {
2825
- router?.navigate([`/app/pages/${routes[statusCode]}`.toLowerCase()]);
2826
- }
2827
- }
2828
2774
  handlePaginationOptions() {
2829
2775
  const { __paginationOptions } = this;
2830
2776
  if (__paginationOptions) {
@@ -2896,13 +2842,9 @@ class MonkeyEcxCommonsService {
2896
2842
  }
2897
2843
  this.__requestPaged = null;
2898
2844
  this.flagValidator = true;
2899
- if (this.tokenStorage) {
2900
- // this.__tokenCredentials = await this.tokenStorage.getToken();
2901
- }
2902
2845
  const pend = this.allowedSecurityAccessByPendency(otherArgs?.pendency);
2903
2846
  const allowedByProgram = this.allowedSecurityAccessByFeature(otherArgs?.featureByProgram);
2904
- if (this.allowedSecurityAccess(otherArgs?.security) &&
2905
- this.allowedSecurityAccessByCountry(otherArgs?.countrySecurity) &&
2847
+ if (this.allowedSecurityAccessByCountry(otherArgs?.countrySecurity) &&
2906
2848
  !pend.hasPendencies &&
2907
2849
  allowedByProgram) {
2908
2850
  if (this.__schedule) {
@@ -2956,7 +2898,7 @@ class MonkeyEcxCommonsService {
2956
2898
  this.navigateToErrorPage(404, otherArgs?.router);
2957
2899
  }
2958
2900
  else if (pend.hasPendencies) {
2959
- this.navigateToPendencyPage(pend, otherArgs?.router);
2901
+ this.navigateToPendencyPage(pend, otherArgs?.companyType, otherArgs?.router);
2960
2902
  }
2961
2903
  else {
2962
2904
  this.navigateToErrorPage(403, otherArgs?.router);
@@ -3045,6 +2987,20 @@ class MonkeyEcxCommonsService {
3045
2987
  ...state
3046
2988
  };
3047
2989
  }
2990
+ navigateToErrorPage(statusCode, router) {
2991
+ const routes = {
2992
+ 403: 'forbidden',
2993
+ 404: 'not-found',
2994
+ 500: 'service-problems',
2995
+ 503: 'service-problems'
2996
+ };
2997
+ if (!router) {
2998
+ console.error('Router must be declared');
2999
+ }
3000
+ else {
3001
+ router?.navigate([`/app/pages/${routes[statusCode]}`.toLowerCase()]);
3002
+ }
3003
+ }
3048
3004
  }
3049
3005
  __decorate([
3050
3006
  MonkeyEcxCoreService({