monkey-front-core 0.0.518 → 0.0.520

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.
@@ -701,6 +701,11 @@ class MonkeyEcxService {
701
701
  ...params,
702
702
  }));
703
703
  }
704
+ patch(url, params) {
705
+ return this.http.patch(url, this.handlelize({
706
+ ...params,
707
+ }));
708
+ }
704
709
  delete(url, params) {
705
710
  return this.http.delete(url, params);
706
711
  }
@@ -3679,6 +3684,21 @@ class MonkeyEcxi18nConfigService extends MonkeyEcxCommonsService {
3679
3684
  this.translateService = translateService;
3680
3685
  this.monkeyecxErrorConfigService = monkeyecxErrorConfigService;
3681
3686
  }
3687
+ async loadInternalDefaultFromError(environment) {
3688
+ const lang = 'pt-BR';
3689
+ const url = `${environment.localAssets}/i18n/${lang}.json`;
3690
+ const resp = await this.monkeyecxService?.get(url).pipe(take(1)).toPromise();
3691
+ this.translateService.setTranslation(lang, resp.data, true);
3692
+ }
3693
+ async loadDefaultFromError(environment, name) {
3694
+ const lang = 'pt-BR';
3695
+ const url = MonkeyEcxUtils.replaceVariables(environment.urli18nAssets, {
3696
+ name,
3697
+ lang
3698
+ });
3699
+ const resp = await this.monkeyecxService?.get(url).pipe(take(1)).toPromise();
3700
+ this.translateService.setTranslation(lang, resp.data, true);
3701
+ }
3682
3702
  async loadAuth(environment, lang) {
3683
3703
  try {
3684
3704
  const url = MonkeyEcxUtils.replaceVariables(environment.urli18nAssets, {
@@ -3690,7 +3710,7 @@ class MonkeyEcxi18nConfigService extends MonkeyEcxCommonsService {
3690
3710
  }
3691
3711
  catch (e) {
3692
3712
  console.error(`loadAuth i18n ${lang} not found!`);
3693
- this.monkeyecxErrorConfigService.apply('i18n');
3713
+ this.loadDefaultFromError(environment, 'auth');
3694
3714
  }
3695
3715
  }
3696
3716
  async loadAlerts(environment, lang) {
@@ -3704,7 +3724,7 @@ class MonkeyEcxi18nConfigService extends MonkeyEcxCommonsService {
3704
3724
  }
3705
3725
  catch (e) {
3706
3726
  console.error(`loadAlerts i18n ${lang} not found!`);
3707
- this.monkeyecxErrorConfigService.apply('i18n');
3727
+ this.loadDefaultFromError(environment, 'alerts');
3708
3728
  }
3709
3729
  }
3710
3730
  async loadShared(environment, lang) {
@@ -3718,7 +3738,7 @@ class MonkeyEcxi18nConfigService extends MonkeyEcxCommonsService {
3718
3738
  }
3719
3739
  catch (e) {
3720
3740
  console.error(`loadShared i18n ${lang} not found!`);
3721
- this.monkeyecxErrorConfigService.apply('i18n');
3741
+ this.loadDefaultFromError(environment, 'shared');
3722
3742
  }
3723
3743
  }
3724
3744
  async loadRegister(environment, lang) {
@@ -3732,7 +3752,7 @@ class MonkeyEcxi18nConfigService extends MonkeyEcxCommonsService {
3732
3752
  }
3733
3753
  catch (e) {
3734
3754
  console.error(`loadRegister i18n ${lang} not found!`);
3735
- this.monkeyecxErrorConfigService.apply('i18n');
3755
+ this.loadDefaultFromError(environment, 'register');
3736
3756
  }
3737
3757
  }
3738
3758
  async loadInternal(environment, lang) {
@@ -3743,7 +3763,7 @@ class MonkeyEcxi18nConfigService extends MonkeyEcxCommonsService {
3743
3763
  }
3744
3764
  catch (e) {
3745
3765
  console.error(`loadInternal i18n ${lang} not found!`);
3746
- this.monkeyecxErrorConfigService.apply('i18n');
3766
+ this.loadInternalDefaultFromError(environment);
3747
3767
  }
3748
3768
  }
3749
3769
  async apply(environment) {