monkey-front-core 0.0.111 → 0.0.115

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.
@@ -1826,6 +1826,30 @@ class MonkeyEcxCommonsService {
1826
1826
  });
1827
1827
  }
1828
1828
  }
1829
+ navigateToPendencyPage(arg, router) {
1830
+ const { companyType } = this.__tokenCredentials || {
1831
+ companyType: '',
1832
+ };
1833
+ let route = '/app';
1834
+ if (companyType) {
1835
+ route = `${route}/${companyType}/pages`;
1836
+ }
1837
+ else {
1838
+ route = `${route}/user/profile/pages`;
1839
+ }
1840
+ if (!router) {
1841
+ // eslint-disable-next-line no-console
1842
+ console.error('Router must be declared');
1843
+ }
1844
+ else {
1845
+ router.navigate([`${route}/company-pendency`.toLowerCase()], {
1846
+ state: {
1847
+ pendencyData: arg,
1848
+ },
1849
+ skipLocationChange: true,
1850
+ });
1851
+ }
1852
+ }
1829
1853
  getRole() {
1830
1854
  const { __tokenCredentials } = this;
1831
1855
  if (!__tokenCredentials)
@@ -1835,6 +1859,20 @@ class MonkeyEcxCommonsService {
1835
1859
  }
1836
1860
  return __tokenCredentials?.role || '';
1837
1861
  }
1862
+ allowedSecurityAccessByPendency(args) {
1863
+ if (!args) {
1864
+ return {
1865
+ hasPendencies: false,
1866
+ };
1867
+ }
1868
+ const { service, type } = args;
1869
+ return service.hasPendencies(type);
1870
+ }
1871
+ allowedSecurityAccessByCountry(arg) {
1872
+ if (!arg)
1873
+ return true;
1874
+ return arg.country === arg.envCountry;
1875
+ }
1838
1876
  allowedSecurityAccess(args) {
1839
1877
  if (!args)
1840
1878
  return true;
@@ -1940,7 +1978,10 @@ class MonkeyEcxCommonsService {
1940
1978
  if (this.tokenStorage) {
1941
1979
  this.__tokenCredentials = this.tokenStorage.getToken();
1942
1980
  }
1943
- if (this.allowedSecurityAccess(otherArgs?.security)) {
1981
+ const pend = this.allowedSecurityAccessByPendency(otherArgs?.pendency);
1982
+ if (this.allowedSecurityAccess(otherArgs?.security) &&
1983
+ this.allowedSecurityAccessByCountry(otherArgs?.countrySecurity) &&
1984
+ !pend.hasPendencies) {
1944
1985
  if (this.__schedule) {
1945
1986
  this.otherArgs?.schedule?.service?.removeSchedule(this.__schedule);
1946
1987
  this.__schedule = null;
@@ -1984,6 +2025,9 @@ class MonkeyEcxCommonsService {
1984
2025
  otherArgs?.callbackMain();
1985
2026
  }
1986
2027
  }
2028
+ else if (pend.hasPendencies) {
2029
+ this.navigateToPendencyPage(pend, otherArgs?.router);
2030
+ }
1987
2031
  else {
1988
2032
  this.navigateToErrorPage(403, otherArgs?.router);
1989
2033
  }
@@ -3320,8 +3364,6 @@ class MonkeyEcxErrorHandlingService {
3320
3364
  const handlingService = injector.get(MonkeyEcxHandlingService);
3321
3365
  const httpErrorHandlingService = injector.get(MonkeyEcxHttpErrorHandlingService);
3322
3366
  const othersErrorsHandlingService = injector.get(MonkeyEcxOthersErrorsHandlingService);
3323
- console.log('======error');
3324
- console.log(error);
3325
3367
  if (error instanceof HttpErrorResponse) {
3326
3368
  const sCredentials = handlingService?.getMonkeyEcxServiceCredentials() || {};
3327
3369
  if (MonkeyEcxUtils.persistNullEmptyUndefined(type) && type === 'refresh_token') {