From aa2a158ffcc8fd598843532a09344eeec6fdcc3f Mon Sep 17 00:00:00 2001 From: Naveed Elahi Date: Mon, 23 Oct 2023 14:12:51 +0800 Subject: [PATCH] fix uiConfig override bugs should be specified config > whitelabel > unspecified config default values makes unspecified config > whitelabel --- packages/modal/src/modalManager.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/modal/src/modalManager.ts b/packages/modal/src/modalManager.ts index 7f46f7f24..6e434536a 100644 --- a/packages/modal/src/modalManager.ts +++ b/packages/modal/src/modalManager.ts @@ -92,8 +92,6 @@ export class Web3Auth extends Web3AuthNoModal implements IWeb3AuthModal { } 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"; } public async initModal(params?: { modalConfig?: Record }): Promise { @@ -101,6 +99,9 @@ export class Web3Auth extends Web3AuthNoModal implements IWeb3AuthModal { const whitelabel = await fetchWhitelabel(this.options.clientId); this.options.uiConfig = cloneDeep(deepmerge(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,