Skip to content

Commit

Permalink
Merge pull request #1824 from Web3Auth/feat/nomodal-events
Browse files Browse the repository at this point in the history
Feat/nomodal-events
  • Loading branch information
chaitanyapotti authored May 9, 2024
2 parents 6bbab2a + 1049fe3 commit aa2a206
Show file tree
Hide file tree
Showing 9 changed files with 23 additions and 37 deletions.
22 changes: 6 additions & 16 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 2 additions & 4 deletions packages/hooks/modal-react-hooks/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,16 +31,14 @@
"dist"
],
"devDependencies": {
"@web3auth/modal": "^8.4.1",
"@web3auth/openlogin-adapter": "^8.4.1"
},
"dependencies": {
"@web3auth/base": "^8.4.1"
"@web3auth/base": "^8.4.1",
"@web3auth/modal": "^8.4.1"
},
"peerDependencies": {
"@babel/runtime": "^7.x",
"@web3auth/modal": "^8.x",
"@web3auth/openlogin-adapter": "^8.x",
"react": "^18.x"
},
"lint-staged": {
Expand Down
6 changes: 2 additions & 4 deletions packages/hooks/no-modal-react-hooks/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,16 +31,14 @@
"dist"
],
"devDependencies": {
"@web3auth/no-modal": "^8.4.1",
"@web3auth/openlogin-adapter": "^8.4.1"
},
"dependencies": {
"@web3auth/base": "^8.4.1"
"@web3auth/base": "^8.4.1",
"@web3auth/no-modal": "^8.4.1"
},
"peerDependencies": {
"@babel/runtime": "^7.x",
"@web3auth/no-modal": "^8.x",
"@web3auth/openlogin-adapter": "^8.x",
"react": "^18.x"
},
"lint-staged": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,17 +30,12 @@
"files": [
"dist"
],
"devDependencies": {
"@web3auth/wallet-services-plugin": "^8.4.1",
"@web3auth/openlogin-adapter": "^8.4.1"
},
"dependencies": {
"@web3auth/base": "^8.4.1"
"@web3auth/base": "^8.4.1",
"@web3auth/wallet-services-plugin": "^8.4.1"
},
"peerDependencies": {
"@babel/runtime": "^7.x",
"@web3auth/openlogin-adapter": "^8.x",
"@web3auth/wallet-services-plugin": "^8.x",
"react": "^18.x"
},
"lint-staged": {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { IBaseWeb3AuthHookContext, PLUGIN_EVENTS, WalletServicesPluginError } from "@web3auth/base";
import { WalletServicesPlugin } from "@web3auth/wallet-services-plugin";
import { type WalletServicesPlugin } from "@web3auth/wallet-services-plugin";
import { Context, createContext, createElement, PropsWithChildren, useCallback, useContext, useEffect, useMemo, useState } from "react";

import { IWalletServicesContext } from "../interfaces";
Expand Down
5 changes: 4 additions & 1 deletion packages/modal/src/modalManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -299,8 +299,11 @@ export class Web3Auth extends Web3AuthNoModal implements IWeb3AuthModal {
});

this.commonJRPCProvider = await CommonJRPCProvider.getProviderInstance({ chainConfig: this.coreOptions.chainConfig as CustomChainConfig });
this.status = ADAPTER_STATUS.READY;
await Promise.all(initPromises);
if (this.status === ADAPTER_STATUS.NOT_READY) {
this.status = ADAPTER_STATUS.READY;
this.emit(ADAPTER_EVENTS.READY);
}

const hasExternalWallets = allAdapters.some((adapterName) => {
return this.walletAdapters[adapterName]?.type === ADAPTER_CATEGORY.EXTERNAL && this.modalConfig.adapters?.[adapterName].showOnModal;
Expand Down
5 changes: 4 additions & 1 deletion packages/no-modal/src/noModal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,10 @@ export class Web3AuthNoModal extends SafeEventEmitter implements IWeb3Auth {
return this.walletAdapters[adapterName].init({ autoConnect: this.cachedAdapter === adapterName }).catch((e) => log.error(e));
});
await Promise.all(initPromises);
if (this.status === ADAPTER_STATUS.NOT_READY) this.status = ADAPTER_STATUS.READY;
if (this.status === ADAPTER_STATUS.NOT_READY) {
this.status = ADAPTER_STATUS.READY;
this.emit(ADAPTER_EVENTS.READY);
}
}

public getAdapter(adapterName: WALLET_ADAPTER_TYPE): IAdapter<unknown> | null {
Expand Down
3 changes: 1 addition & 2 deletions packages/plugins/wallet-services-plugin/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,7 @@
"loglevel": "^1.9.1"
},
"peerDependencies": {
"@babel/runtime": "^7.x",
"@web3auth/openlogin-adapter": "^8.x"
"@babel/runtime": "^7.x"
},
"lint-staged": {
"!(*d).ts": [
Expand Down
2 changes: 1 addition & 1 deletion packages/ui/src/loginModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ class LoginModal extends SafeEventEmitter {

if (!uiConfig.logoDark) this.uiConfig.logoDark = DEFAULT_LOGO_DARK;
if (!uiConfig.logoLight) this.uiConfig.logoLight = DEFAULT_LOGO_LIGHT;
if (!uiConfig.mode) this.uiConfig.mode = "auto";
if (!uiConfig.mode) this.uiConfig.mode = "light";
if (!uiConfig.modalZIndex) this.uiConfig.modalZIndex = "99998";
if (typeof uiConfig.displayErrorsOnModal === "undefined") this.uiConfig.displayErrorsOnModal = true;
if (!uiConfig.appName) this.uiConfig.appName = "Web3Auth";
Expand Down

0 comments on commit aa2a206

Please sign in to comment.