@web3auth/modal 10.9.0 → 10.10.0
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.
- package/dist/lib.cjs/packages/modal/src/config.js +1 -1
- package/dist/lib.cjs/packages/modal/src/modalManager.js +26 -8
- package/dist/lib.cjs/packages/modal/src/react/context/WalletServicesInnerContext.js +1 -1
- package/dist/lib.cjs/packages/modal/src/react/context/Web3AuthInnerContext.js +17 -2
- package/dist/lib.cjs/packages/modal/src/react/hooks/useIdentityToken.js +7 -3
- package/dist/lib.cjs/packages/modal/src/react/hooks/useWeb3Auth.js +2 -0
- package/dist/lib.cjs/packages/modal/src/ui/components/BottomSheet/BottomSheet.js +5 -3
- package/dist/lib.cjs/packages/modal/src/ui/components/CircularLoader/CircularLoader.js +88 -0
- package/dist/lib.cjs/packages/modal/src/ui/components/ConnectWallet/ConnectWallet.js +5 -5
- package/dist/lib.cjs/packages/modal/src/ui/components/ConnectWallet/ConnectWalletChainNamespaceSelect/ConnectWalletChainNamespaceSelect.js +2 -2
- package/dist/lib.cjs/packages/modal/src/ui/components/Loader/Loader.js +67 -5
- package/dist/lib.cjs/packages/modal/src/ui/components/Login/Login.js +4 -3
- package/dist/lib.cjs/packages/modal/src/ui/components/Root/Root.js +25 -13
- package/dist/lib.cjs/packages/modal/src/ui/components/Widget/Widget.js +18 -5
- package/dist/lib.cjs/packages/modal/src/ui/css/index.css.js +1 -1
- package/dist/lib.cjs/packages/modal/src/ui/i18n/english.json.js +3 -0
- package/dist/lib.cjs/packages/modal/src/ui/i18n/french.json.js +3 -0
- package/dist/lib.cjs/packages/modal/src/ui/i18n/german.json.js +3 -0
- package/dist/lib.cjs/packages/modal/src/ui/i18n/japanese.json.js +3 -0
- package/dist/lib.cjs/packages/modal/src/ui/i18n/korean.json.js +3 -0
- package/dist/lib.cjs/packages/modal/src/ui/i18n/mandarin.json.js +3 -0
- package/dist/lib.cjs/packages/modal/src/ui/i18n/portuguese.json.js +3 -0
- package/dist/lib.cjs/packages/modal/src/ui/i18n/spanish.json.js +3 -0
- package/dist/lib.cjs/packages/modal/src/ui/i18n/turkish.json.js +3 -0
- package/dist/lib.cjs/packages/modal/src/ui/interfaces.js +3 -1
- package/dist/lib.cjs/packages/modal/src/ui/loginModal.js +26 -2
- package/dist/lib.cjs/packages/modal/src/vue/WalletServicesInnerProvider.js +1 -1
- package/dist/lib.cjs/packages/modal/src/vue/Web3AuthProvider.js +13 -3
- package/dist/lib.cjs/packages/modal/src/vue/composables/useCheckout.js +1 -0
- package/dist/lib.cjs/packages/modal/src/vue/composables/useEnableMFA.js +1 -0
- package/dist/lib.cjs/packages/modal/src/vue/composables/useFunding.js +1 -0
- package/dist/lib.cjs/packages/modal/src/vue/composables/useIdentityToken.js +10 -3
- package/dist/lib.cjs/packages/modal/src/vue/composables/useManageMFA.js +1 -0
- package/dist/lib.cjs/packages/modal/src/vue/composables/useReceive.js +1 -0
- package/dist/lib.cjs/packages/modal/src/vue/composables/useSwap.js +1 -0
- package/dist/lib.cjs/packages/modal/src/vue/composables/useSwitchChain.js +1 -0
- package/dist/lib.cjs/packages/modal/src/vue/composables/useWalletConnectScanner.js +1 -0
- package/dist/lib.cjs/packages/modal/src/vue/composables/useWalletUI.js +1 -0
- package/dist/lib.cjs/packages/modal/src/vue/composables/useWeb3AuthConnect.js +2 -0
- package/dist/lib.cjs/packages/modal/src/vue/composables/useWeb3AuthDisconnect.js +1 -0
- package/dist/lib.cjs/packages/modal/src/vue/composables/useWeb3AuthUser.js +1 -0
- package/dist/lib.cjs/packages/modal/src/vue/solana/composables/useSignAndSendTransaction.js +1 -0
- package/dist/lib.cjs/packages/modal/src/vue/solana/composables/useSignMessage.js +1 -0
- package/dist/lib.cjs/packages/modal/src/vue/solana/composables/useSignTransaction.js +1 -0
- package/dist/lib.cjs/types/modalManager.d.ts +1 -0
- package/dist/lib.cjs/types/ui/components/BottomSheet/BottomSheet.d.ts +1 -1
- package/dist/lib.cjs/types/ui/components/BottomSheet/BottomSheet.type.d.ts +2 -0
- package/dist/lib.cjs/types/ui/components/CircularLoader/CircularLoader.d.ts +3 -0
- package/dist/lib.cjs/types/ui/components/CircularLoader/CircularLoader.type.d.ts +19 -0
- package/dist/lib.cjs/types/ui/components/CircularLoader/index.d.ts +2 -0
- package/dist/lib.cjs/types/ui/components/ConnectWallet/ConnectWallet.type.d.ts +1 -1
- package/dist/lib.cjs/types/ui/components/Loader/Loader.type.d.ts +8 -0
- package/dist/lib.cjs/types/ui/components/Login/Login.type.d.ts +1 -0
- package/dist/lib.cjs/types/ui/components/Root/Root.type.d.ts +5 -1
- package/dist/lib.cjs/types/ui/components/Widget/Widget.type.d.ts +5 -1
- package/dist/lib.cjs/types/ui/interfaces.d.ts +7 -1
- package/dist/lib.cjs/types/ui/loginModal.d.ts +1 -0
- package/dist/lib.cjs/types/vue/interfaces.d.ts +1 -0
- package/dist/lib.esm/packages/modal/src/config.js +1 -1
- package/dist/lib.esm/packages/modal/src/modalManager.js +27 -9
- package/dist/lib.esm/packages/modal/src/react/context/WalletServicesInnerContext.js +2 -2
- package/dist/lib.esm/packages/modal/src/react/context/Web3AuthInnerContext.js +17 -2
- package/dist/lib.esm/packages/modal/src/react/hooks/useIdentityToken.js +7 -3
- package/dist/lib.esm/packages/modal/src/react/hooks/useWeb3Auth.js +2 -0
- package/dist/lib.esm/packages/modal/src/ui/components/BottomSheet/BottomSheet.js +5 -3
- package/dist/lib.esm/packages/modal/src/ui/components/CircularLoader/CircularLoader.js +86 -0
- package/dist/lib.esm/packages/modal/src/ui/components/ConnectWallet/ConnectWallet.js +5 -5
- package/dist/lib.esm/packages/modal/src/ui/components/ConnectWallet/ConnectWalletChainNamespaceSelect/ConnectWalletChainNamespaceSelect.js +2 -2
- package/dist/lib.esm/packages/modal/src/ui/components/Loader/Loader.js +68 -6
- package/dist/lib.esm/packages/modal/src/ui/components/Login/Login.js +4 -3
- package/dist/lib.esm/packages/modal/src/ui/components/Root/Root.js +25 -13
- package/dist/lib.esm/packages/modal/src/ui/components/Widget/Widget.js +19 -6
- package/dist/lib.esm/packages/modal/src/ui/css/index.css.js +1 -1
- package/dist/lib.esm/packages/modal/src/ui/i18n/english.json.js +3 -0
- package/dist/lib.esm/packages/modal/src/ui/i18n/french.json.js +3 -0
- package/dist/lib.esm/packages/modal/src/ui/i18n/german.json.js +3 -0
- package/dist/lib.esm/packages/modal/src/ui/i18n/japanese.json.js +3 -0
- package/dist/lib.esm/packages/modal/src/ui/i18n/korean.json.js +3 -0
- package/dist/lib.esm/packages/modal/src/ui/i18n/mandarin.json.js +3 -0
- package/dist/lib.esm/packages/modal/src/ui/i18n/portuguese.json.js +3 -0
- package/dist/lib.esm/packages/modal/src/ui/i18n/spanish.json.js +3 -0
- package/dist/lib.esm/packages/modal/src/ui/i18n/turkish.json.js +3 -0
- package/dist/lib.esm/packages/modal/src/ui/interfaces.js +3 -1
- package/dist/lib.esm/packages/modal/src/ui/loginModal.js +28 -4
- package/dist/lib.esm/packages/modal/src/vue/WalletServicesInnerProvider.js +1 -1
- package/dist/lib.esm/packages/modal/src/vue/Web3AuthProvider.js +14 -4
- package/dist/lib.esm/packages/modal/src/vue/composables/useCheckout.js +2 -1
- package/dist/lib.esm/packages/modal/src/vue/composables/useEnableMFA.js +2 -1
- package/dist/lib.esm/packages/modal/src/vue/composables/useFunding.js +2 -1
- package/dist/lib.esm/packages/modal/src/vue/composables/useIdentityToken.js +11 -4
- package/dist/lib.esm/packages/modal/src/vue/composables/useManageMFA.js +2 -1
- package/dist/lib.esm/packages/modal/src/vue/composables/useReceive.js +2 -1
- package/dist/lib.esm/packages/modal/src/vue/composables/useSwap.js +2 -1
- package/dist/lib.esm/packages/modal/src/vue/composables/useSwitchChain.js +2 -1
- package/dist/lib.esm/packages/modal/src/vue/composables/useWalletConnectScanner.js +2 -1
- package/dist/lib.esm/packages/modal/src/vue/composables/useWalletUI.js +2 -1
- package/dist/lib.esm/packages/modal/src/vue/composables/useWeb3AuthConnect.js +3 -1
- package/dist/lib.esm/packages/modal/src/vue/composables/useWeb3AuthDisconnect.js +2 -1
- package/dist/lib.esm/packages/modal/src/vue/composables/useWeb3AuthUser.js +2 -1
- package/dist/lib.esm/packages/modal/src/vue/solana/composables/useSignAndSendTransaction.js +2 -1
- package/dist/lib.esm/packages/modal/src/vue/solana/composables/useSignMessage.js +2 -1
- package/dist/lib.esm/packages/modal/src/vue/solana/composables/useSignTransaction.js +2 -1
- package/dist/modal.umd.min.js +1 -1
- package/package.json +3 -3
|
@@ -70,12 +70,20 @@ class Web3Auth extends noModal.Web3AuthNoModal {
|
|
|
70
70
|
noModal.log.error(`Error while disconnecting to wallet connect in core`, error);
|
|
71
71
|
}
|
|
72
72
|
}
|
|
73
|
-
if (!visibility && this.status
|
|
73
|
+
if (!visibility && noModal.CONNECTED_STATUSES.includes(this.status) && (walletConnectStatus === noModal.CONNECTOR_STATUS.READY || walletConnectStatus === noModal.CONNECTOR_STATUS.CONNECTING)) {
|
|
74
74
|
noModal.log.debug("this stops wc connector from trying to reconnect once proposal expires");
|
|
75
75
|
wcConnector.status = noModal.CONNECTOR_STATUS.READY;
|
|
76
76
|
}
|
|
77
77
|
}
|
|
78
78
|
});
|
|
79
|
+
_defineProperty(this, "onMobileVerifyConnect", async params => {
|
|
80
|
+
try {
|
|
81
|
+
const connector = this.getConnector(params.connector);
|
|
82
|
+
await connector.getIdentityToken();
|
|
83
|
+
} catch (error) {
|
|
84
|
+
noModal.log.error(`Error while connecting to connector: ${params.connector}`, error);
|
|
85
|
+
}
|
|
86
|
+
});
|
|
79
87
|
_defineProperty(this, "getChainNamespaces", () => {
|
|
80
88
|
var _this$coreOptions$cha;
|
|
81
89
|
return [...new Set(((_this$coreOptions$cha = this.coreOptions.chains) === null || _this$coreOptions$cha === void 0 ? void 0 : _this$coreOptions$cha.map(x => x.chainNamespace)) || [])];
|
|
@@ -136,12 +144,14 @@ class Web3Auth extends noModal.Web3AuthNoModal {
|
|
|
136
144
|
authBuildEnv: this.options.authBuildEnv,
|
|
137
145
|
chainNamespaces: this.getChainNamespaces(),
|
|
138
146
|
walletRegistry: filteredWalletRegistry,
|
|
139
|
-
analytics: this.analytics
|
|
147
|
+
analytics: this.analytics,
|
|
148
|
+
initialAuthenticationMode: this.options.initialAuthenticationMode
|
|
140
149
|
}), {
|
|
141
150
|
onInitExternalWallets: this.onInitExternalWallets,
|
|
142
151
|
onSocialLogin: this.onSocialLogin,
|
|
143
152
|
onExternalWalletLogin: this.onExternalWalletLogin,
|
|
144
|
-
onModalVisibility: this.onModalVisibility
|
|
153
|
+
onModalVisibility: this.onModalVisibility,
|
|
154
|
+
onMobileVerifyConnect: this.onMobileVerifyConnect
|
|
145
155
|
});
|
|
146
156
|
await noModal.withAbort(() => this.loginModal.initModal(), signal);
|
|
147
157
|
// setup common JRPC provider
|
|
@@ -192,7 +202,7 @@ class Web3Auth extends noModal.Web3AuthNoModal {
|
|
|
192
202
|
async connect() {
|
|
193
203
|
if (!this.loginModal) throw noModal.WalletInitializationError.notReady("Login modal is not initialized");
|
|
194
204
|
// if already connected return provider
|
|
195
|
-
if (this.connectedConnectorName && this.status
|
|
205
|
+
if (this.connectedConnectorName && noModal.CONNECTED_STATUSES.includes(this.status) && this.provider) return this.provider;
|
|
196
206
|
this.loginModal.open();
|
|
197
207
|
return new Promise((resolve, reject) => {
|
|
198
208
|
// remove all listeners when promise is resolved or rejected.
|
|
@@ -204,18 +214,24 @@ class Web3Auth extends noModal.Web3AuthNoModal {
|
|
|
204
214
|
};
|
|
205
215
|
const handleError = err => {
|
|
206
216
|
this.removeListener(noModal.CONNECTOR_EVENTS.CONNECTED, handleConnected);
|
|
217
|
+
this.removeListener(noModal.CONNECTOR_EVENTS.AUTHORIZED, handleConnected);
|
|
207
218
|
this.removeListener(interfaces.LOGIN_MODAL_EVENTS.MODAL_VISIBILITY, handleVisibility);
|
|
208
219
|
return reject(err);
|
|
209
220
|
};
|
|
210
221
|
const handleVisibility = visibility => {
|
|
211
222
|
// modal is closed but user is not connected to any wallet.
|
|
212
|
-
if (!visibility && this.status
|
|
223
|
+
if (!visibility && !noModal.CONNECTED_STATUSES.includes(this.status)) {
|
|
213
224
|
this.removeListener(noModal.CONNECTOR_EVENTS.CONNECTED, handleConnected);
|
|
214
225
|
this.removeListener(noModal.CONNECTOR_EVENTS.ERRORED, handleError);
|
|
226
|
+
this.removeListener(noModal.CONNECTOR_EVENTS.AUTHORIZED, handleConnected);
|
|
215
227
|
return reject(new Error("User closed the modal"));
|
|
216
228
|
}
|
|
217
229
|
};
|
|
218
|
-
this.
|
|
230
|
+
if (this.coreOptions.initialAuthenticationMode === noModal.CONNECTOR_INITIAL_AUTHENTICATION_MODE.CONNECT_AND_SIGN) {
|
|
231
|
+
this.once(noModal.CONNECTOR_EVENTS.AUTHORIZED, handleConnected);
|
|
232
|
+
} else {
|
|
233
|
+
this.once(noModal.CONNECTOR_EVENTS.CONNECTED, handleConnected);
|
|
234
|
+
}
|
|
219
235
|
this.once(noModal.CONNECTOR_EVENTS.ERRORED, handleError);
|
|
220
236
|
this.once(interfaces.LOGIN_MODAL_EVENTS.MODAL_VISIBILITY, handleVisibility);
|
|
221
237
|
});
|
|
@@ -508,7 +524,8 @@ class Web3Auth extends noModal.Web3AuthNoModal {
|
|
|
508
524
|
const autoConnect = super.checkIfAutoConnect(connector);
|
|
509
525
|
await connector.init({
|
|
510
526
|
autoConnect,
|
|
511
|
-
chainId: initialChain.chainId
|
|
527
|
+
chainId: initialChain.chainId,
|
|
528
|
+
getIdentityToken: this.options.initialAuthenticationMode === noModal.CONNECTOR_INITIAL_AUTHENTICATION_MODE.CONNECT_AND_SIGN
|
|
512
529
|
});
|
|
513
530
|
// note: not adding cachedWallet to modal if it is external wallet.
|
|
514
531
|
// adding it later if no in-app wallets are available.
|
|
@@ -548,7 +565,8 @@ class Web3Auth extends noModal.Web3AuthNoModal {
|
|
|
548
565
|
const initialChain = this.getInitialChainIdForConnector(connector);
|
|
549
566
|
await connector.init({
|
|
550
567
|
autoConnect: this.cachedConnector === connectorName,
|
|
551
|
-
chainId: initialChain.chainId
|
|
568
|
+
chainId: initialChain.chainId,
|
|
569
|
+
getIdentityToken: this.options.initialAuthenticationMode === noModal.CONNECTOR_INITIAL_AUTHENTICATION_MODE.CONNECT_AND_SIGN
|
|
552
570
|
});
|
|
553
571
|
} catch (error) {
|
|
554
572
|
noModal.log.error(error, "error while initializing connector", connectorName);
|
|
@@ -28,7 +28,7 @@ function WalletServicesContextProvider({
|
|
|
28
28
|
const plugin = getPlugin(noModal.EVM_PLUGINS.WALLET_SERVICES);
|
|
29
29
|
setWalletServicesPlugin(plugin);
|
|
30
30
|
// when rehydrating, the connectedListener may be registered after the connected event is emitted, we need to check the status here
|
|
31
|
-
if ((plugin === null || plugin === void 0 ? void 0 : plugin.status)
|
|
31
|
+
if (noModal.CONNECTED_STATUSES.includes(plugin === null || plugin === void 0 ? void 0 : plugin.status)) setReady(true);
|
|
32
32
|
}
|
|
33
33
|
}, [isConnected, getPlugin, walletServicesPlugin]);
|
|
34
34
|
react.useEffect(() => {
|
|
@@ -26,6 +26,7 @@ function Web3AuthInnerProvider(params) {
|
|
|
26
26
|
return new modalManager.Web3Auth(web3AuthOptions, initialState);
|
|
27
27
|
}, [web3AuthOptions, initialState]);
|
|
28
28
|
const [isConnected, setIsConnected] = react.useState(web3Auth.status === noModal.CONNECTOR_STATUS.CONNECTED);
|
|
29
|
+
const [isAuthorized, setIsAuthorized] = react.useState(web3Auth.status === noModal.CONNECTOR_STATUS.AUTHORIZED);
|
|
29
30
|
const [status, setStatus] = react.useState(web3Auth.status);
|
|
30
31
|
const getPlugin = react.useCallback(name => {
|
|
31
32
|
if (!web3Auth) throw noModal.WalletInitializationError.notReady();
|
|
@@ -66,7 +67,9 @@ function Web3AuthInnerProvider(params) {
|
|
|
66
67
|
if (provider) {
|
|
67
68
|
provider.on("chainChanged", handleChainChange);
|
|
68
69
|
return () => {
|
|
69
|
-
provider
|
|
70
|
+
if (provider) {
|
|
71
|
+
provider.off("chainChanged", handleChainChange);
|
|
72
|
+
}
|
|
70
73
|
};
|
|
71
74
|
}
|
|
72
75
|
}, [web3Auth, provider]);
|
|
@@ -85,9 +88,17 @@ function Web3AuthInnerProvider(params) {
|
|
|
85
88
|
setProvider(data.provider);
|
|
86
89
|
}
|
|
87
90
|
};
|
|
91
|
+
const authorizedListener = _data => {
|
|
92
|
+
setStatus(web3Auth.status);
|
|
93
|
+
if (web3Auth.status === noModal.CONNECTOR_STATUS.AUTHORIZED) {
|
|
94
|
+
setIsConnected(true);
|
|
95
|
+
setIsAuthorized(true);
|
|
96
|
+
}
|
|
97
|
+
};
|
|
88
98
|
const disconnectedListener = () => {
|
|
89
99
|
setStatus(web3Auth.status);
|
|
90
100
|
setIsConnected(false);
|
|
101
|
+
setIsAuthorized(false);
|
|
91
102
|
setProvider(null);
|
|
92
103
|
};
|
|
93
104
|
const connectingListener = () => {
|
|
@@ -99,6 +110,7 @@ function Web3AuthInnerProvider(params) {
|
|
|
99
110
|
const rehydrationErrorListener = () => {
|
|
100
111
|
setStatus(web3Auth.status);
|
|
101
112
|
setIsConnected(false);
|
|
113
|
+
setIsAuthorized(false);
|
|
102
114
|
setProvider(null);
|
|
103
115
|
};
|
|
104
116
|
const mfaEnabledListener = isMFAEnabled => {
|
|
@@ -110,6 +122,7 @@ function Web3AuthInnerProvider(params) {
|
|
|
110
122
|
web3Auth.on(noModal.CONNECTOR_EVENTS.NOT_READY, notReadyListener);
|
|
111
123
|
web3Auth.on(noModal.CONNECTOR_EVENTS.READY, readyListener);
|
|
112
124
|
web3Auth.on(noModal.CONNECTOR_EVENTS.CONNECTED, connectedListener);
|
|
125
|
+
web3Auth.on(noModal.CONNECTOR_EVENTS.AUTHORIZED, authorizedListener);
|
|
113
126
|
web3Auth.on(noModal.CONNECTOR_EVENTS.DISCONNECTED, disconnectedListener);
|
|
114
127
|
web3Auth.on(noModal.CONNECTOR_EVENTS.CONNECTING, connectingListener);
|
|
115
128
|
web3Auth.on(noModal.CONNECTOR_EVENTS.ERRORED, errorListener);
|
|
@@ -121,6 +134,7 @@ function Web3AuthInnerProvider(params) {
|
|
|
121
134
|
web3Auth.off(noModal.CONNECTOR_EVENTS.NOT_READY, notReadyListener);
|
|
122
135
|
web3Auth.off(noModal.CONNECTOR_EVENTS.READY, readyListener);
|
|
123
136
|
web3Auth.off(noModal.CONNECTOR_EVENTS.CONNECTED, connectedListener);
|
|
137
|
+
web3Auth.off(noModal.CONNECTOR_EVENTS.AUTHORIZED, authorizedListener);
|
|
124
138
|
web3Auth.off(noModal.CONNECTOR_EVENTS.DISCONNECTED, disconnectedListener);
|
|
125
139
|
web3Auth.off(noModal.CONNECTOR_EVENTS.CONNECTING, connectingListener);
|
|
126
140
|
web3Auth.off(noModal.CONNECTOR_EVENTS.ERRORED, errorListener);
|
|
@@ -134,6 +148,7 @@ function Web3AuthInnerProvider(params) {
|
|
|
134
148
|
return {
|
|
135
149
|
web3Auth,
|
|
136
150
|
isConnected,
|
|
151
|
+
isAuthorized,
|
|
137
152
|
isInitialized,
|
|
138
153
|
provider,
|
|
139
154
|
status,
|
|
@@ -145,7 +160,7 @@ function Web3AuthInnerProvider(params) {
|
|
|
145
160
|
getPlugin,
|
|
146
161
|
setIsMFAEnabled
|
|
147
162
|
};
|
|
148
|
-
}, [web3Auth, isConnected, isMFAEnabled, setIsMFAEnabled, isInitialized, provider, status, getPlugin, isInitializing, initError, chainId, chainNamespace]);
|
|
163
|
+
}, [web3Auth, isConnected, isAuthorized, isMFAEnabled, setIsMFAEnabled, isInitialized, provider, status, getPlugin, isInitializing, initError, chainId, chainNamespace]);
|
|
149
164
|
return /*#__PURE__*/react.createElement(Web3AuthInnerContext.Provider, {
|
|
150
165
|
value
|
|
151
166
|
}, children);
|
|
@@ -6,7 +6,7 @@ var useWeb3AuthInner = require('./useWeb3AuthInner.js');
|
|
|
6
6
|
const useIdentityToken = () => {
|
|
7
7
|
const {
|
|
8
8
|
web3Auth,
|
|
9
|
-
|
|
9
|
+
isAuthorized
|
|
10
10
|
} = useWeb3AuthInner.useWeb3AuthInner();
|
|
11
11
|
const [loading, setLoading] = react.useState(false);
|
|
12
12
|
const [error, setError] = react.useState(null);
|
|
@@ -27,10 +27,14 @@ const useIdentityToken = () => {
|
|
|
27
27
|
}
|
|
28
28
|
}, [web3Auth]);
|
|
29
29
|
react.useEffect(() => {
|
|
30
|
-
if (!
|
|
30
|
+
if (!web3Auth) return;
|
|
31
|
+
if (!isAuthorized && token) {
|
|
31
32
|
setToken(null);
|
|
32
33
|
}
|
|
33
|
-
|
|
34
|
+
if (isAuthorized && !token) {
|
|
35
|
+
setToken(web3Auth.idToken);
|
|
36
|
+
}
|
|
37
|
+
}, [isAuthorized, token, web3Auth]);
|
|
34
38
|
return {
|
|
35
39
|
loading,
|
|
36
40
|
error,
|
|
@@ -6,6 +6,7 @@ const useWeb3Auth = () => {
|
|
|
6
6
|
const {
|
|
7
7
|
initError,
|
|
8
8
|
isConnected,
|
|
9
|
+
isAuthorized,
|
|
9
10
|
isInitialized,
|
|
10
11
|
isInitializing,
|
|
11
12
|
provider,
|
|
@@ -16,6 +17,7 @@ const useWeb3Auth = () => {
|
|
|
16
17
|
return {
|
|
17
18
|
initError,
|
|
18
19
|
isConnected,
|
|
20
|
+
isAuthorized,
|
|
19
21
|
isInitialized,
|
|
20
22
|
isInitializing,
|
|
21
23
|
provider,
|
|
@@ -11,7 +11,9 @@ function BottomSheet({
|
|
|
11
11
|
isShown,
|
|
12
12
|
onClose,
|
|
13
13
|
children,
|
|
14
|
-
uiConfig
|
|
14
|
+
uiConfig,
|
|
15
|
+
sheetClassName,
|
|
16
|
+
showCloseButton = true
|
|
15
17
|
}) {
|
|
16
18
|
const {
|
|
17
19
|
borderRadiusType = "large"
|
|
@@ -34,8 +36,8 @@ function BottomSheet({
|
|
|
34
36
|
"w3a--rounded-[30px]": borderRadiusType === "large",
|
|
35
37
|
"w3a--rounded-2xl": borderRadiusType === "medium",
|
|
36
38
|
"w3a--rounded-none": borderRadiusType === "small"
|
|
37
|
-
}),
|
|
38
|
-
children: [jsxRuntime.jsx("div", {
|
|
39
|
+
}, sheetClassName),
|
|
40
|
+
children: [showCloseButton && jsxRuntime.jsx("div", {
|
|
39
41
|
className: "w3a--absolute w3a--right-4 w3a--top-[16px] w3a--z-10 w3a--cursor-pointer",
|
|
40
42
|
children: jsxRuntime.jsx("svg", {
|
|
41
43
|
width: "13",
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
4
|
+
var utils = require('../../utils.js');
|
|
5
|
+
|
|
6
|
+
function toSize(value, fallback = 160) {
|
|
7
|
+
return value !== null && value !== void 0 ? value : fallback;
|
|
8
|
+
}
|
|
9
|
+
const CircularLoader = props => {
|
|
10
|
+
const {
|
|
11
|
+
width,
|
|
12
|
+
height,
|
|
13
|
+
thickness = 12,
|
|
14
|
+
className = "",
|
|
15
|
+
children,
|
|
16
|
+
showChildren = true,
|
|
17
|
+
trackColor = "rgba(226, 232, 240, 1)",
|
|
18
|
+
// Tailwind slate-200 equivalent
|
|
19
|
+
gradient,
|
|
20
|
+
arcSizeDeg = 36,
|
|
21
|
+
arcColors
|
|
22
|
+
} = props;
|
|
23
|
+
const w = toSize(width, 160);
|
|
24
|
+
const h = toSize(height, 160);
|
|
25
|
+
const ringMask = `radial-gradient(farthest-side, transparent calc(100% - ${thickness}px), #000 calc(100% - ${thickness}px))`;
|
|
26
|
+
function hexToRgba(hex, alpha) {
|
|
27
|
+
const normalized = hex.replace("#", "");
|
|
28
|
+
const full = normalized.length === 3 ? normalized.split("").map(c => c + c).join("") : normalized;
|
|
29
|
+
const r = parseInt(full.substring(0, 2), 16);
|
|
30
|
+
const g = parseInt(full.substring(2, 4), 16);
|
|
31
|
+
const b = parseInt(full.substring(4, 6), 16);
|
|
32
|
+
return `rgba(${r}, ${g}, ${b}, ${alpha})`;
|
|
33
|
+
}
|
|
34
|
+
function withAlpha(color, alpha) {
|
|
35
|
+
if (!color) return color;
|
|
36
|
+
const c = color.trim().toLowerCase();
|
|
37
|
+
if (c.startsWith("#")) return hexToRgba(c, alpha);
|
|
38
|
+
if (c.startsWith("rgba(")) return color;
|
|
39
|
+
if (c.startsWith("rgb(")) {
|
|
40
|
+
const nums = c.slice(4, -1);
|
|
41
|
+
return `rgba(${nums}, ${alpha})`;
|
|
42
|
+
}
|
|
43
|
+
// Fallback: return the same color (alpha may be ignored by browser)
|
|
44
|
+
return color;
|
|
45
|
+
}
|
|
46
|
+
const arcColorGradient = gradient || (arcColors ? `radial-gradient(210.91% 85.29% at 14.56% 18.67%, ${withAlpha(arcColors[0], 0)} 9.5%, ${arcColors[1]} 41.82%, ${arcColors[1]} 64.83%, ${withAlpha(arcColors[0], 0.44)} 100%)` : "radial-gradient(210.91% 85.29% at 14.56% 18.67%, rgba(255, 98, 58, 0.00) 9.5%, #FF623A 41.82%, #FF623A 64.83%, rgba(255, 98, 58, 0.44) 100%)");
|
|
47
|
+
const wedgeMask = `conic-gradient(#000 0deg ${arcSizeDeg}deg, transparent ${arcSizeDeg}deg 360deg)`;
|
|
48
|
+
return jsxRuntime.jsxs("div", {
|
|
49
|
+
className: utils.cn("w3a--relative w3a--inline-flex w3a--items-center w3a--justify-center", className),
|
|
50
|
+
style: {
|
|
51
|
+
width: w,
|
|
52
|
+
height: h
|
|
53
|
+
},
|
|
54
|
+
children: [jsxRuntime.jsx("div", {
|
|
55
|
+
className: "w3a--absolute w3a--inset-0 w3a--rounded-full",
|
|
56
|
+
style: {
|
|
57
|
+
background: trackColor,
|
|
58
|
+
WebkitMaskImage: ringMask,
|
|
59
|
+
maskImage: ringMask,
|
|
60
|
+
WebkitMaskRepeat: "no-repeat",
|
|
61
|
+
maskRepeat: "no-repeat"
|
|
62
|
+
}
|
|
63
|
+
}), jsxRuntime.jsx("div", {
|
|
64
|
+
className: "w3a--absolute w3a--inset-0 w3a--animate-spin",
|
|
65
|
+
style: {
|
|
66
|
+
WebkitMaskImage: wedgeMask,
|
|
67
|
+
maskImage: wedgeMask,
|
|
68
|
+
WebkitMaskRepeat: "no-repeat",
|
|
69
|
+
maskRepeat: "no-repeat"
|
|
70
|
+
},
|
|
71
|
+
children: jsxRuntime.jsx("div", {
|
|
72
|
+
className: "w3a--absolute w3a--inset-0 w3a--rounded-full",
|
|
73
|
+
style: {
|
|
74
|
+
background: arcColorGradient,
|
|
75
|
+
WebkitMaskImage: ringMask,
|
|
76
|
+
maskImage: ringMask,
|
|
77
|
+
WebkitMaskRepeat: "no-repeat",
|
|
78
|
+
maskRepeat: "no-repeat"
|
|
79
|
+
}
|
|
80
|
+
})
|
|
81
|
+
}), showChildren && children ? jsxRuntime.jsx("div", {
|
|
82
|
+
className: "w3a--relative",
|
|
83
|
+
children: children
|
|
84
|
+
}) : null]
|
|
85
|
+
});
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
module.exports = CircularLoader;
|
|
@@ -21,7 +21,7 @@ function ConnectWallet(props) {
|
|
|
21
21
|
walletConnectUri,
|
|
22
22
|
metamaskConnectUri,
|
|
23
23
|
walletRegistry,
|
|
24
|
-
|
|
24
|
+
allRegistryButtons,
|
|
25
25
|
customConnectorButtons,
|
|
26
26
|
connectorVisibilityMap,
|
|
27
27
|
deviceDetails,
|
|
@@ -63,16 +63,16 @@ function ConnectWallet(props) {
|
|
|
63
63
|
}, [walletRegistry]);
|
|
64
64
|
const allUniqueButtons = react.useMemo(() => {
|
|
65
65
|
const uniqueButtonSet = new Set();
|
|
66
|
-
return customConnectorButtons.concat(
|
|
66
|
+
return customConnectorButtons.concat(allRegistryButtons).filter(button => {
|
|
67
67
|
if (uniqueButtonSet.has(button.name)) return false;
|
|
68
68
|
uniqueButtonSet.add(button.name);
|
|
69
69
|
return true;
|
|
70
70
|
});
|
|
71
|
-
}, [
|
|
71
|
+
}, [allRegistryButtons, customConnectorButtons]);
|
|
72
72
|
const defaultButtonKeys = react.useMemo(() => new Set(Object.keys(walletRegistry.default)), [walletRegistry]);
|
|
73
73
|
const defaultButtons = react.useMemo(() => {
|
|
74
74
|
// display order: default injected buttons > custom adapter buttons > default non-injected buttons
|
|
75
|
-
const buttons = [...
|
|
75
|
+
const buttons = [...allRegistryButtons.filter(button => button.hasInjectedWallet && defaultButtonKeys.has(button.name)), ...customConnectorButtons, ...allRegistryButtons.filter(button => !button.hasInjectedWallet && defaultButtonKeys.has(button.name))].sort((a, b) => {
|
|
76
76
|
// favor MetaMask over other wallets
|
|
77
77
|
if (a.name === noModal.WALLET_CONNECTORS.METAMASK && b.name === noModal.WALLET_CONNECTORS.METAMASK) {
|
|
78
78
|
// favor installed MetaMask over non-installed MetaMask
|
|
@@ -96,7 +96,7 @@ function ConnectWallet(props) {
|
|
|
96
96
|
var _button$chainNamespac;
|
|
97
97
|
return selectedChain === "all" || ((_button$chainNamespac = button.chainNamespaces) === null || _button$chainNamespac === void 0 ? void 0 : _button$chainNamespac.includes(selectedChain));
|
|
98
98
|
});
|
|
99
|
-
}, [
|
|
99
|
+
}, [allRegistryButtons, customConnectorButtons, defaultButtonKeys, selectedChain]);
|
|
100
100
|
const installedWalletButtons = react.useMemo(() => {
|
|
101
101
|
const visibilityMap = connectorVisibilityMap;
|
|
102
102
|
return Object.keys(config).reduce((acc, localConnector) => {
|
|
@@ -43,7 +43,7 @@ const ConnectWalletChainNamespaceSelect = props => {
|
|
|
43
43
|
extension: wallet.imgExtension
|
|
44
44
|
})
|
|
45
45
|
}), jsxRuntime.jsx("p", {
|
|
46
|
-
className: "w3a--my-6 w3a--text-center w3a--text-sm w3a--text-app-gray-500",
|
|
46
|
+
className: "w3a--my-6 w3a--text-center w3a--text-sm w3a--text-app-gray-500 dark:w3a--text-app-gray-400",
|
|
47
47
|
children: t("modal.external.select-chain-description", {
|
|
48
48
|
wallet: wallet.displayName
|
|
49
49
|
})
|
|
@@ -72,7 +72,7 @@ const ConnectWalletChainNamespaceSelect = props => {
|
|
|
72
72
|
isButton: true,
|
|
73
73
|
extension: "svg"
|
|
74
74
|
}), jsxRuntime.jsx("p", {
|
|
75
|
-
className: "w3a--ml-2 w3a--text-left w3a--text-sm first-letter:w3a--capitalize",
|
|
75
|
+
className: "w3a--ml-2 w3a--text-left w3a--text-sm w3a--text-app-gray-900 first-letter:w3a--capitalize dark:w3a--text-app-gray-200",
|
|
76
76
|
children: displayName
|
|
77
77
|
})]
|
|
78
78
|
}), jsxRuntime.jsx("img", {
|
|
@@ -5,6 +5,7 @@ var react = require('react');
|
|
|
5
5
|
var reactI18next = require('react-i18next');
|
|
6
6
|
var interfaces = require('../../interfaces.js');
|
|
7
7
|
var localeImport = require('../../localeImport.js');
|
|
8
|
+
var CircularLoader = require('../CircularLoader/CircularLoader.js');
|
|
8
9
|
var Image = require('../Image/Image.js');
|
|
9
10
|
var PulseLoader = require('../PulseLoader/PulseLoader.js');
|
|
10
11
|
|
|
@@ -113,6 +114,56 @@ function ErroredStatus(props) {
|
|
|
113
114
|
})]
|
|
114
115
|
});
|
|
115
116
|
}
|
|
117
|
+
function AuthorizingStatus(props) {
|
|
118
|
+
var _walletRegistry$defau, _walletRegistry$other;
|
|
119
|
+
const [t] = reactI18next.useTranslation(undefined, {
|
|
120
|
+
i18n: localeImport
|
|
121
|
+
});
|
|
122
|
+
const {
|
|
123
|
+
connector,
|
|
124
|
+
externalWalletsConfig,
|
|
125
|
+
walletRegistry,
|
|
126
|
+
handleMobileVerifyConnect
|
|
127
|
+
} = props;
|
|
128
|
+
const registryItem = (walletRegistry === null || walletRegistry === void 0 || (_walletRegistry$defau = walletRegistry.default) === null || _walletRegistry$defau === void 0 ? void 0 : _walletRegistry$defau[connector]) || (walletRegistry === null || walletRegistry === void 0 || (_walletRegistry$other = walletRegistry.others) === null || _walletRegistry$other === void 0 ? void 0 : _walletRegistry$other[connector]);
|
|
129
|
+
const primaryColor = (registryItem === null || registryItem === void 0 ? void 0 : registryItem.primaryColor) || "";
|
|
130
|
+
const handleMobileVerifyConnectClick = () => {
|
|
131
|
+
handleMobileVerifyConnect({
|
|
132
|
+
connector: connector
|
|
133
|
+
});
|
|
134
|
+
};
|
|
135
|
+
return jsxRuntime.jsxs("div", {
|
|
136
|
+
className: "w3a--flex w3a--size-full w3a--flex-col w3a--items-center w3a--justify-between w3a--gap-y-6",
|
|
137
|
+
children: [jsxRuntime.jsx("p", {
|
|
138
|
+
className: "w3a--p-2 w3a--text-center w3a--text-base w3a--font-semibold w3a--text-app-gray-900 dark:w3a--text-app-white",
|
|
139
|
+
children: t("modal.loader.authorizing-header", {
|
|
140
|
+
connector: externalWalletsConfig[connector].label
|
|
141
|
+
})
|
|
142
|
+
}), jsxRuntime.jsx("div", {
|
|
143
|
+
className: "w3a--flex w3a--justify-center",
|
|
144
|
+
children: jsxRuntime.jsx(CircularLoader, {
|
|
145
|
+
width: 95,
|
|
146
|
+
height: 95,
|
|
147
|
+
thickness: 6,
|
|
148
|
+
arcSizeDeg: 100,
|
|
149
|
+
arcColors: primaryColor ? [primaryColor, primaryColor] : undefined,
|
|
150
|
+
children: jsxRuntime.jsx(Image, {
|
|
151
|
+
imageId: `login-${connector}`,
|
|
152
|
+
hoverImageId: `login-${connector}`,
|
|
153
|
+
height: "45",
|
|
154
|
+
width: "45"
|
|
155
|
+
})
|
|
156
|
+
})
|
|
157
|
+
}), jsxRuntime.jsx("p", {
|
|
158
|
+
className: "w3a--text-center w3a--text-sm w3a--text-app-gray-500 dark:w3a--text-app-gray-400",
|
|
159
|
+
children: t("modal.loader.authorizing-message")
|
|
160
|
+
}), jsxRuntime.jsx("button", {
|
|
161
|
+
onClick: handleMobileVerifyConnectClick,
|
|
162
|
+
className: "w3a--w-full w3a--rounded-xl w3a--bg-app-gray-100 w3a--p-2 w3a--py-3 w3a--text-center w3a--text-sm w3a--text-app-gray-900 dark:w3a--bg-app-gray-800 dark:w3a--text-app-white md:w3a--hidden",
|
|
163
|
+
children: t("modal.loader.authorizing-verify-btn")
|
|
164
|
+
})]
|
|
165
|
+
});
|
|
166
|
+
}
|
|
116
167
|
/**
|
|
117
168
|
* Loader component
|
|
118
169
|
* @param props - LoaderProps
|
|
@@ -125,25 +176,36 @@ function Loader(props) {
|
|
|
125
176
|
modalStatus,
|
|
126
177
|
onClose,
|
|
127
178
|
appLogo,
|
|
128
|
-
message
|
|
179
|
+
message,
|
|
180
|
+
isConnectAndSignAuthenticationMode,
|
|
181
|
+
externalWalletsConfig,
|
|
182
|
+
walletRegistry,
|
|
183
|
+
handleMobileVerifyConnect
|
|
129
184
|
} = props;
|
|
185
|
+
const isConnectedAccordingToAuthenticationMode = react.useMemo(() => !isConnectAndSignAuthenticationMode && modalStatus === interfaces.MODAL_STATUS.CONNECTED || isConnectAndSignAuthenticationMode && modalStatus === interfaces.MODAL_STATUS.AUTHORIZED, [modalStatus, isConnectAndSignAuthenticationMode]);
|
|
130
186
|
react.useEffect(() => {
|
|
131
|
-
if (
|
|
132
|
-
setTimeout(() => {
|
|
187
|
+
if (isConnectedAccordingToAuthenticationMode) {
|
|
188
|
+
const timeout = setTimeout(() => {
|
|
133
189
|
onClose();
|
|
134
190
|
}, 1000);
|
|
191
|
+
return () => clearTimeout(timeout);
|
|
135
192
|
}
|
|
136
|
-
}, [
|
|
193
|
+
}, [isConnectedAccordingToAuthenticationMode, onClose]);
|
|
137
194
|
return jsxRuntime.jsxs("div", {
|
|
138
195
|
className: "w3a--flex w3a--h-full w3a--flex-1 w3a--flex-col w3a--items-center w3a--justify-center w3a--gap-y-4",
|
|
139
196
|
children: [modalStatus === interfaces.MODAL_STATUS.CONNECTING && jsxRuntime.jsx(ConnectingStatus, {
|
|
140
197
|
connector: connector,
|
|
141
198
|
connectorName: connectorName,
|
|
142
199
|
appLogo: appLogo
|
|
143
|
-
}),
|
|
200
|
+
}), isConnectedAccordingToAuthenticationMode && jsxRuntime.jsx(ConnectedStatus, {
|
|
144
201
|
message: message
|
|
145
202
|
}), modalStatus === interfaces.MODAL_STATUS.ERRORED && jsxRuntime.jsx(ErroredStatus, {
|
|
146
203
|
message: message
|
|
204
|
+
}), modalStatus === interfaces.MODAL_STATUS.AUTHORIZING && jsxRuntime.jsx(AuthorizingStatus, {
|
|
205
|
+
connector: connector,
|
|
206
|
+
externalWalletsConfig: externalWalletsConfig,
|
|
207
|
+
walletRegistry: walletRegistry,
|
|
208
|
+
handleMobileVerifyConnect: handleMobileVerifyConnect
|
|
147
209
|
})]
|
|
148
210
|
});
|
|
149
211
|
}
|
|
@@ -35,6 +35,7 @@ function Login(props) {
|
|
|
35
35
|
isDark,
|
|
36
36
|
handleSocialLoginClick,
|
|
37
37
|
totalExternalWallets,
|
|
38
|
+
remainingUndisplayedWallets,
|
|
38
39
|
isEmailPasswordLessLoginVisible,
|
|
39
40
|
isSmsPasswordLessLoginVisible,
|
|
40
41
|
handleExternalWalletBtnClick,
|
|
@@ -448,7 +449,7 @@ function Login(props) {
|
|
|
448
449
|
src: utils.getIcons(isDark ? "chevron-right-dark" : "chevron-right-light"),
|
|
449
450
|
alt: "arrow"
|
|
450
451
|
})]
|
|
451
|
-
}, wallet.name)),
|
|
452
|
+
}, wallet.name)), remainingUndisplayedWallets > 0 && jsxRuntime.jsxs("button", {
|
|
452
453
|
type: "button",
|
|
453
454
|
className: utils.cn("w3a--btn !w3a--justify-between w3a--group w3a--relative w3a--overflow-hidden", {
|
|
454
455
|
"w3a--rounded-full": buttonRadius === "pill",
|
|
@@ -459,10 +460,10 @@ function Login(props) {
|
|
|
459
460
|
children: [jsxRuntime.jsx("p", {
|
|
460
461
|
className: "w3a--text-base w3a--font-normal w3a--text-app-gray-900 dark:w3a--text-app-white",
|
|
461
462
|
children: t("modal.external.all-wallets")
|
|
462
|
-
}), showExternalWalletCount &&
|
|
463
|
+
}), showExternalWalletCount && jsxRuntime.jsx("div", {
|
|
463
464
|
id: "external-wallet-count",
|
|
464
465
|
className: "w3a--absolute w3a--right-4 w3a--top-1/2 w3a--w-auto -w3a--translate-y-1/2 w3a--rounded-full w3a--bg-app-primary-100 w3a--px-2.5 w3a--py-0.5 w3a--text-xs w3a--font-medium w3a--text-app-primary-800 w3a--transition-all w3a--delay-300 w3a--duration-300 group-hover:w3a--translate-x-6 group-hover:w3a--opacity-0 group-hover:w3a--delay-0 dark:w3a--border dark:w3a--border-app-primary-500 dark:w3a--bg-transparent dark:w3a--text-app-primary-500",
|
|
465
|
-
children:
|
|
466
|
+
children: remainingUndisplayedWallets
|
|
466
467
|
}), jsxRuntime.jsx("img", {
|
|
467
468
|
id: "external-wallet-arrow",
|
|
468
469
|
className: "w3a--absolute w3a--right-4 w3a--top-1/2 -w3a--translate-x-10 -w3a--translate-y-1/2 w3a--opacity-0 w3a--transition-all w3a--duration-300\n group-hover:w3a--translate-x-0 group-hover:w3a--opacity-100",
|
|
@@ -28,6 +28,7 @@ function Root(props) {
|
|
|
28
28
|
setModalState,
|
|
29
29
|
modalState,
|
|
30
30
|
handleExternalWalletBtnClick,
|
|
31
|
+
handleMobileVerifyConnect,
|
|
31
32
|
chainNamespaces,
|
|
32
33
|
walletRegistry,
|
|
33
34
|
appLogo,
|
|
@@ -44,7 +45,8 @@ function Root(props) {
|
|
|
44
45
|
isSmsPasswordLessLoginVisible,
|
|
45
46
|
preHandleExternalWalletClick,
|
|
46
47
|
uiConfig,
|
|
47
|
-
deviceDetails
|
|
48
|
+
deviceDetails,
|
|
49
|
+
isConnectAndSignAuthenticationMode
|
|
48
50
|
} = props;
|
|
49
51
|
const {
|
|
50
52
|
logoAlignment = "center",
|
|
@@ -242,7 +244,7 @@ function Root(props) {
|
|
|
242
244
|
return acc;
|
|
243
245
|
}, []);
|
|
244
246
|
}, [connectorVisibilityMap, chainNamespaces, config, deviceDetails.platform, isWalletConnectConnectorIncluded]);
|
|
245
|
-
const
|
|
247
|
+
const allRegistryButtons = react.useMemo(() => {
|
|
246
248
|
return [...generateWalletButtons(walletRegistry.default), ...generateWalletButtons(walletRegistry.others)];
|
|
247
249
|
}, [generateWalletButtons, walletRegistry.default, walletRegistry.others]);
|
|
248
250
|
const installedConnectorButtons = react.useMemo(() => {
|
|
@@ -265,7 +267,7 @@ function Root(props) {
|
|
|
265
267
|
const metamaskConnectorIdx = installedConnectors.findIndex(x => x.name === noModal.WALLET_CONNECTORS.METAMASK && !x.hasInjectedWallet);
|
|
266
268
|
if (metamaskConnectorIdx !== -1) {
|
|
267
269
|
const metamaskConnector = installedConnectors[metamaskConnectorIdx];
|
|
268
|
-
let metamaskRegistryButton =
|
|
270
|
+
let metamaskRegistryButton = allRegistryButtons.find(button => button.name === noModal.WALLET_CONNECTORS.METAMASK);
|
|
269
271
|
if (!metamaskRegistryButton) {
|
|
270
272
|
// use the default metamask registry item if it's not in the registry
|
|
271
273
|
metamaskRegistryButton = generateWalletButtons({
|
|
@@ -282,7 +284,7 @@ function Root(props) {
|
|
|
282
284
|
}
|
|
283
285
|
// make metamask the first button and limit the number of buttons
|
|
284
286
|
return installedConnectors;
|
|
285
|
-
}, [
|
|
287
|
+
}, [allRegistryButtons, config, connectorVisibilityMap, generateWalletButtons]);
|
|
286
288
|
const customConnectorButtons = react.useMemo(() => {
|
|
287
289
|
return installedConnectorButtons.filter(button => !button.hasInjectedWallet);
|
|
288
290
|
}, [installedConnectorButtons]);
|
|
@@ -291,14 +293,19 @@ function Root(props) {
|
|
|
291
293
|
// make metamask the first button and limit the number of buttons
|
|
292
294
|
return installedConnectorButtons.sort((a, _) => a.name === noModal.WALLET_CONNECTORS.METAMASK ? -1 : 1).slice(0, displayInstalledExternalWallets ? MAX_TOP_INSTALLED_CONNECTORS : 1);
|
|
293
295
|
}, [installedConnectorButtons, displayInstalledExternalWallets]);
|
|
294
|
-
const
|
|
295
|
-
const
|
|
296
|
-
return
|
|
297
|
-
if (
|
|
298
|
-
|
|
296
|
+
const allExternalWallets = react.useMemo(() => {
|
|
297
|
+
const uniqueButtonSet = new Set();
|
|
298
|
+
return installedConnectorButtons.concat(allRegistryButtons).filter(button => {
|
|
299
|
+
if (uniqueButtonSet.has(button.name)) return false;
|
|
300
|
+
uniqueButtonSet.add(button.name);
|
|
299
301
|
return true;
|
|
302
|
+
});
|
|
303
|
+
}, [allRegistryButtons, installedConnectorButtons]);
|
|
304
|
+
const remainingUndisplayedWallets = react.useMemo(() => {
|
|
305
|
+
return allExternalWallets.filter(button => {
|
|
306
|
+
return !topInstalledConnectorButtons.includes(button);
|
|
300
307
|
}).length;
|
|
301
|
-
}, [
|
|
308
|
+
}, [allExternalWallets, topInstalledConnectorButtons]);
|
|
302
309
|
const handleSocialLoginHeight = () => {
|
|
303
310
|
setIsSocialLoginsExpanded(prev => !prev);
|
|
304
311
|
};
|
|
@@ -370,7 +377,11 @@ function Root(props) {
|
|
|
370
377
|
connectorName: modalState.detailedLoaderConnectorName,
|
|
371
378
|
modalStatus: modalState.status,
|
|
372
379
|
onClose: onCloseLoader,
|
|
373
|
-
appLogo: appLogo
|
|
380
|
+
appLogo: appLogo,
|
|
381
|
+
isConnectAndSignAuthenticationMode: isConnectAndSignAuthenticationMode,
|
|
382
|
+
externalWalletsConfig: modalState.externalWalletsConfig,
|
|
383
|
+
walletRegistry: walletRegistry,
|
|
384
|
+
handleMobileVerifyConnect: handleMobileVerifyConnect
|
|
374
385
|
}) : jsxRuntime.jsx(jsxRuntime.Fragment, {
|
|
375
386
|
children: (_bodyState$metamaskQr3 = bodyState.metamaskQrCode) !== null && _bodyState$metamaskQr3 !== void 0 && _bodyState$metamaskQr3.show ? jsxRuntime.jsxs("div", {
|
|
376
387
|
className: "w3a--relative w3a--flex w3a--flex-1 w3a--flex-col w3a--gap-y-4",
|
|
@@ -409,7 +420,8 @@ function Root(props) {
|
|
|
409
420
|
installedExternalWalletConfig: topInstalledConnectorButtons,
|
|
410
421
|
isEmailPasswordLessLoginVisible: isEmailPasswordLessLoginVisible,
|
|
411
422
|
isSmsPasswordLessLoginVisible: isSmsPasswordLessLoginVisible,
|
|
412
|
-
totalExternalWallets:
|
|
423
|
+
totalExternalWallets: allExternalWallets.length,
|
|
424
|
+
remainingUndisplayedWallets: remainingUndisplayedWallets,
|
|
413
425
|
logoAlignment: logoAlignment,
|
|
414
426
|
buttonRadius: buttonRadiusType,
|
|
415
427
|
deviceDetails: deviceDetails,
|
|
@@ -423,7 +435,7 @@ function Root(props) {
|
|
|
423
435
|
metamaskConnectUri: modalState.metamaskConnectUri,
|
|
424
436
|
config: modalState.externalWalletsConfig,
|
|
425
437
|
walletRegistry: walletRegistry,
|
|
426
|
-
|
|
438
|
+
allRegistryButtons: allRegistryButtons,
|
|
427
439
|
connectorVisibilityMap: connectorVisibilityMap,
|
|
428
440
|
customConnectorButtons: customConnectorButtons,
|
|
429
441
|
deviceDetails: deviceDetails,
|