Skip to content

Commit

Permalink
fix uiConfig set default values after fetching configs from dashboard
Browse files Browse the repository at this point in the history
otherwise the default configs set by modalManager would always override any dashboard configs
  • Loading branch information
BboyStatix committed Mar 21, 2024
1 parent 13ccb76 commit a997bb8
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions packages/modal/src/modalManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,6 @@ export class Web3Auth extends Web3AuthNoModal implements IWeb3AuthModal {
this.options = { ...options };

if (!this.options.uiConfig) this.options.uiConfig = {};
if (!this.options.uiConfig.defaultLanguage) this.options.uiConfig.defaultLanguage = getUserLanguage(this.options.uiConfig.defaultLanguage);
if (!this.options.uiConfig.mode) this.options.uiConfig.mode = "auto";
if (!this.coreOptions.privateKeyProvider) throw WalletInitializationError.invalidParams("privateKeyProvider is required");
}

Expand All @@ -74,6 +72,9 @@ export class Web3Auth extends Web3AuthNoModal implements IWeb3AuthModal {
const { whitelabel, sms_otp_enabled: smsOtpEnabled } = projectConfig;

this.options.uiConfig = merge(clonedeep(whitelabel), this.options.uiConfig);
if (!this.options.uiConfig.defaultLanguage) this.options.uiConfig.defaultLanguage = getUserLanguage(this.options.uiConfig.defaultLanguage);
if (!this.options.uiConfig.mode) this.options.uiConfig.mode = "auto";

this.loginModal = new LoginModal({
...this.options.uiConfig,
adapterListener: this,
Expand Down

0 comments on commit a997bb8

Please sign in to comment.