@yomotech/view-toolkit 0.0.27 → 0.0.29

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.
@@ -2635,6 +2635,7 @@ class Couchdb {
2635
2635
  async buildTenantHeaders() {
2636
2636
  const tenantKey = await this.utilityService.getStorage('tenantKey');
2637
2637
  const tenantName = await this.utilityService.getStorage('tenantName');
2638
+ const selectedTenant = await this.utilityService.getLocalStorage('selectedTenant');
2638
2639
  if (tenantKey) {
2639
2640
  if (typeof tenantKey !== 'string' || !tenantKey.trim()) {
2640
2641
  throw new Error('Missing tenantKey');
@@ -2644,11 +2645,11 @@ class Couchdb {
2644
2645
  };
2645
2646
  }
2646
2647
  else {
2647
- if (typeof tenantName !== 'string' || !tenantName.trim()) {
2648
+ if (typeof tenantName !== 'string' || !tenantName.trim() || !tenantName.trim()) {
2648
2649
  throw new Error('Missing tenantName');
2649
2650
  }
2650
2651
  return {
2651
- 'X-Tenant': tenantName.trim(),
2652
+ 'X-Tenant': tenantName ? tenantName.trim() : selectedTenant.trim(),
2652
2653
  };
2653
2654
  }
2654
2655
  }
@@ -2696,19 +2697,22 @@ class ConfigService {
2696
2697
  }
2697
2698
  async loadOktaConfig(projectName) {
2698
2699
  try {
2700
+ let tenantKey = "";
2699
2701
  let tenantName = "";
2700
- let selectedTenant = "";
2701
2702
  if (this.platform.ANDROID || this.platform.IOS) {
2703
+ tenantKey = await this.utilityService.getLocalStorage('tenantKey');
2702
2704
  tenantName = await this.utilityService.getLocalStorage('tenantName');
2703
- selectedTenant = await this.utilityService.getLocalStorage('selectedTenant');
2704
2705
  }
2705
2706
  else {
2707
+ tenantKey = await this.utilityService.getStorage('tenantKey');
2706
2708
  tenantName = await this.utilityService.getStorage('tenantName');
2707
- selectedTenant = await this.utilityService.getLocalStorage('selectedTenant');
2708
2709
  }
2709
- let tenant = tenantName ? tenantName : selectedTenant;
2710
- console.log('tenant2: ', tenant);
2711
- this.config = await this.couchdbService.getFileContentFromCouchDb(`${tenant}_${projectName}`, 'environments/environment.json');
2710
+ if (tenantName) {
2711
+ this.config = await this.couchdbService.getFileContentFromCouchDb(`${tenantName}_${projectName}`, 'environments/environment.json');
2712
+ }
2713
+ else {
2714
+ this.config = await this.couchdbService.getFileContentFromCouchDb(`${projectName}`, 'environments/environment.json');
2715
+ }
2712
2716
  if (this.platform.ANDROID || this.platform.IOS) {
2713
2717
  if (this.config.environment.login.mobile) {
2714
2718
  this.setConfiguration(this.config.environment.login.mobile);
@@ -2753,19 +2757,23 @@ class ConfigService {
2753
2757
  return this.config;
2754
2758
  }
2755
2759
  async loadKeycloakConfig(projectName) {
2760
+ let tenantKey = "";
2756
2761
  let tenantName = "";
2757
- let selectedTenant = "";
2758
2762
  if (this.platform.ANDROID || this.platform.IOS) {
2763
+ tenantKey = await this.utilityService.getLocalStorage('tenantKey');
2759
2764
  tenantName = await this.utilityService.getLocalStorage('tenantName');
2760
- selectedTenant = await this.utilityService.getLocalStorage('selectedTenant');
2761
2765
  }
2762
2766
  else {
2767
+ tenantKey = await this.utilityService.getStorage('tenantKey');
2763
2768
  tenantName = await this.utilityService.getStorage('tenantName');
2764
- selectedTenant = await this.utilityService.getLocalStorage('selectedTenant');
2765
2769
  }
2766
- let tenant = tenantName ? tenantName : selectedTenant;
2767
- console.log('tenant1: ', tenant);
2768
- const env = await this.couchdbService.getFileContentFromCouchDb(`${tenant}_${projectName}`, 'environments/environment.json');
2770
+ let env = {};
2771
+ if (tenantName) {
2772
+ env = await this.couchdbService.getFileContentFromCouchDb(`${tenantName}_${projectName}`, 'environments/environment.json');
2773
+ }
2774
+ else {
2775
+ env = await this.couchdbService.getFileContentFromCouchDb(`${projectName}`, 'environments/environment.json');
2776
+ }
2769
2777
  if (env?.environment?.login.type === "keycloak") {
2770
2778
  if (this.platform.ANDROID || this.platform.IOS) {
2771
2779
  this.keycloakConfig = {