monkey-front-core 0.0.334 → 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) {
@@ -2889,9 +2835,6 @@ class MonkeyEcxCommonsService {
2889
2835
  this.__handledError = null;
2890
2836
  this.flagValidator = false;
2891
2837
  }
2892
- /**
2893
- * @param {otherArgs.security} otherArgs.security is deprecated
2894
- */
2895
2838
  resolve(route, state, otherArgs) {
2896
2839
  if (JSON.stringify(route?.queryParams) === '{}') {
2897
2840
  this.__data = null;
@@ -2955,7 +2898,7 @@ class MonkeyEcxCommonsService {
2955
2898
  this.navigateToErrorPage(404, otherArgs?.router);
2956
2899
  }
2957
2900
  else if (pend.hasPendencies) {
2958
- this.navigateToPendencyPage(pend, otherArgs?.router);
2901
+ this.navigateToPendencyPage(pend, otherArgs?.companyType, otherArgs?.router);
2959
2902
  }
2960
2903
  else {
2961
2904
  this.navigateToErrorPage(403, otherArgs?.router);
@@ -3044,6 +2987,20 @@ class MonkeyEcxCommonsService {
3044
2987
  ...state
3045
2988
  };
3046
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
+ }
3047
3004
  }
3048
3005
  __decorate([
3049
3006
  MonkeyEcxCoreService({