@web3auth/modal 10.0.0-beta.1 → 10.0.0-beta.3
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 -3
- package/dist/lib.cjs/packages/modal/src/modalManager.js +74 -50
- package/dist/lib.cjs/packages/modal/src/react/context/Web3AuthInnerContext.js +8 -1
- package/dist/lib.cjs/packages/modal/src/ui/components/BottomSheet/BottomSheet.js +3 -3
- package/dist/lib.cjs/packages/modal/src/ui/components/Button/ButtonSocial/ButtonSocial.js +1 -1
- package/dist/lib.cjs/packages/modal/src/ui/components/Button/ButtonWallet/ButtonWallet.js +12 -4
- package/dist/lib.cjs/packages/modal/src/ui/components/ConnectWallet/ConnectWallet.js +2 -2
- package/dist/lib.cjs/packages/modal/src/ui/components/ConnectWallet/ConnectWalletChainFilter/ConnectWalletChainFilter.js +7 -4
- package/dist/lib.cjs/packages/modal/src/ui/components/ConnectWallet/ConnectWalletChainNamespaceSelect/ConnectWalletChainNamespaceSelect.js +3 -2
- package/dist/lib.cjs/packages/modal/src/ui/components/ConnectWallet/ConnectWalletHeader/ConnectWalletHeader.js +1 -1
- package/dist/lib.cjs/packages/modal/src/ui/components/ConnectWallet/ConnectWalletList/ConnectWalletList.js +13 -5
- package/dist/lib.cjs/packages/modal/src/ui/components/ConnectWallet/ConnectWalletQrCode/ConnectWalletQrCode.js +1 -1
- package/dist/lib.cjs/packages/modal/src/ui/components/Image/Image.js +5 -4
- package/dist/lib.cjs/packages/modal/src/ui/components/Loader/Loader.js +1 -1
- package/dist/lib.cjs/packages/modal/src/ui/components/Login/Login.js +45 -19
- package/dist/lib.cjs/packages/modal/src/ui/components/Login/LoginPasswordLess/LoginPasswordLess.js +10 -5
- package/dist/lib.cjs/packages/modal/src/ui/components/Modal/Modal.js +1 -1
- package/dist/lib.cjs/packages/modal/src/ui/components/PulseLoader/PulseLoader.js +3 -3
- package/dist/lib.cjs/packages/modal/src/ui/components/Root/Root.js +30 -48
- package/dist/lib.cjs/packages/modal/src/ui/components/SocialLoginList/SocialLoginList.js +15 -34
- package/dist/lib.cjs/packages/modal/src/ui/components/Widget/Widget.js +5 -2
- package/dist/lib.cjs/packages/modal/src/ui/config.js +2 -1
- package/dist/lib.cjs/packages/modal/src/ui/constants.js +4 -0
- package/dist/lib.cjs/packages/modal/src/ui/css/index.css.js +1 -1
- package/dist/lib.cjs/packages/modal/src/ui/handlers/AbstractHandler.js +3 -1
- package/dist/lib.cjs/packages/modal/src/ui/i18n/dutch.json.js +32 -31
- package/dist/lib.cjs/packages/modal/src/ui/i18n/english.json.js +32 -31
- package/dist/lib.cjs/packages/modal/src/ui/i18n/french.json.js +32 -31
- package/dist/lib.cjs/packages/modal/src/ui/i18n/german.json.js +32 -31
- package/dist/lib.cjs/packages/modal/src/ui/i18n/japanese.json.js +32 -31
- package/dist/lib.cjs/packages/modal/src/ui/i18n/korean.json.js +32 -31
- package/dist/lib.cjs/packages/modal/src/ui/i18n/mandarin.json.js +32 -31
- package/dist/lib.cjs/packages/modal/src/ui/i18n/portuguese.json.js +32 -31
- package/dist/lib.cjs/packages/modal/src/ui/i18n/spanish.json.js +32 -31
- package/dist/lib.cjs/packages/modal/src/ui/i18n/turkish.json.js +32 -31
- package/dist/lib.cjs/packages/modal/src/ui/loginModal.js +5 -3
- package/dist/lib.cjs/packages/modal/src/vue/Web3AuthProvider.js +15 -3
- package/dist/lib.cjs/types/interface.d.ts +4 -2
- package/dist/lib.cjs/types/modalManager.d.ts +5 -1
- package/dist/lib.cjs/types/ui/components/Login/Login.type.d.ts +2 -2
- package/dist/lib.cjs/types/ui/config.d.ts +1 -1
- package/dist/lib.cjs/types/ui/constants.d.ts +2 -0
- package/dist/lib.cjs/types/ui/handlers/AbstractHandler.d.ts +1 -1
- package/dist/lib.cjs/types/ui/interfaces.d.ts +5 -3
- package/dist/lib.esm/packages/modal/src/config.js +1 -3
- package/dist/lib.esm/packages/modal/src/modalManager.js +80 -51
- package/dist/lib.esm/packages/modal/src/react/context/Web3AuthInnerContext.js +8 -1
- package/dist/lib.esm/packages/modal/src/ui/components/BottomSheet/BottomSheet.js +3 -3
- package/dist/lib.esm/packages/modal/src/ui/components/Button/ButtonSocial/ButtonSocial.js +1 -1
- package/dist/lib.esm/packages/modal/src/ui/components/Button/ButtonWallet/ButtonWallet.js +14 -6
- package/dist/lib.esm/packages/modal/src/ui/components/ConnectWallet/ConnectWallet.js +2 -2
- package/dist/lib.esm/packages/modal/src/ui/components/ConnectWallet/ConnectWalletChainFilter/ConnectWalletChainFilter.js +7 -4
- package/dist/lib.esm/packages/modal/src/ui/components/ConnectWallet/ConnectWalletChainNamespaceSelect/ConnectWalletChainNamespaceSelect.js +3 -2
- package/dist/lib.esm/packages/modal/src/ui/components/ConnectWallet/ConnectWalletHeader/ConnectWalletHeader.js +1 -1
- package/dist/lib.esm/packages/modal/src/ui/components/ConnectWallet/ConnectWalletList/ConnectWalletList.js +13 -5
- package/dist/lib.esm/packages/modal/src/ui/components/ConnectWallet/ConnectWalletQrCode/ConnectWalletQrCode.js +1 -1
- package/dist/lib.esm/packages/modal/src/ui/components/Image/Image.js +5 -4
- package/dist/lib.esm/packages/modal/src/ui/components/Loader/Loader.js +1 -1
- package/dist/lib.esm/packages/modal/src/ui/components/Login/Login.js +48 -19
- package/dist/lib.esm/packages/modal/src/ui/components/Login/LoginPasswordLess/LoginPasswordLess.js +11 -6
- package/dist/lib.esm/packages/modal/src/ui/components/Modal/Modal.js +1 -1
- package/dist/lib.esm/packages/modal/src/ui/components/PulseLoader/PulseLoader.js +3 -3
- package/dist/lib.esm/packages/modal/src/ui/components/Root/Root.js +31 -50
- package/dist/lib.esm/packages/modal/src/ui/components/SocialLoginList/SocialLoginList.js +16 -35
- package/dist/lib.esm/packages/modal/src/ui/components/Widget/Widget.js +6 -3
- package/dist/lib.esm/packages/modal/src/ui/config.js +2 -1
- package/dist/lib.esm/packages/modal/src/ui/constants.js +3 -1
- package/dist/lib.esm/packages/modal/src/ui/css/index.css.js +1 -1
- package/dist/lib.esm/packages/modal/src/ui/handlers/AbstractHandler.js +3 -1
- package/dist/lib.esm/packages/modal/src/ui/i18n/dutch.json.js +32 -31
- package/dist/lib.esm/packages/modal/src/ui/i18n/english.json.js +32 -31
- package/dist/lib.esm/packages/modal/src/ui/i18n/french.json.js +32 -31
- package/dist/lib.esm/packages/modal/src/ui/i18n/german.json.js +32 -31
- package/dist/lib.esm/packages/modal/src/ui/i18n/japanese.json.js +32 -31
- package/dist/lib.esm/packages/modal/src/ui/i18n/korean.json.js +32 -31
- package/dist/lib.esm/packages/modal/src/ui/i18n/mandarin.json.js +32 -31
- package/dist/lib.esm/packages/modal/src/ui/i18n/portuguese.json.js +32 -31
- package/dist/lib.esm/packages/modal/src/ui/i18n/spanish.json.js +32 -31
- package/dist/lib.esm/packages/modal/src/ui/i18n/turkish.json.js +32 -31
- package/dist/lib.esm/packages/modal/src/ui/loginModal.js +6 -4
- package/dist/lib.esm/packages/modal/src/vue/Web3AuthProvider.js +16 -3
- package/dist/modal.umd.min.js +1 -1
- package/package.json +13 -11
|
@@ -63,24 +63,27 @@ class Web3Auth extends noModal.Web3AuthNoModal {
|
|
|
63
63
|
}
|
|
64
64
|
}
|
|
65
65
|
});
|
|
66
|
+
_defineProperty(this, "getChainNamespaces", () => {
|
|
67
|
+
var _this$coreOptions$cha;
|
|
68
|
+
return [...new Set(((_this$coreOptions$cha = this.coreOptions.chains) === null || _this$coreOptions$cha === void 0 ? void 0 : _this$coreOptions$cha.map(x => x.chainNamespace)) || [])];
|
|
69
|
+
});
|
|
66
70
|
this.options = _objectSpread({}, options);
|
|
67
71
|
if (!this.options.uiConfig) this.options.uiConfig = {};
|
|
68
72
|
if (this.options.modalConfig) this.modalConfig = this.options.modalConfig;
|
|
69
73
|
noModal.log.info("modalConfig", this.modalConfig);
|
|
70
74
|
}
|
|
71
|
-
async initModal() {
|
|
72
|
-
|
|
75
|
+
async initModal(options) {
|
|
76
|
+
const {
|
|
77
|
+
signal
|
|
78
|
+
} = options || {};
|
|
73
79
|
super.checkInitRequirements();
|
|
74
80
|
// get project config and wallet registry
|
|
75
81
|
const {
|
|
76
82
|
projectConfig,
|
|
77
83
|
walletRegistry
|
|
78
84
|
} = await this.getProjectAndWalletConfig();
|
|
79
|
-
this.options.uiConfig = deepmerge(noModal.cloneDeep(projectConfig.whitelabel || {}), this.options.uiConfig || {});
|
|
80
|
-
if (!this.options.uiConfig.defaultLanguage) this.options.uiConfig.defaultLanguage = utils.getUserLanguage(this.options.uiConfig.defaultLanguage);
|
|
81
|
-
if (!this.options.uiConfig.mode) this.options.uiConfig.mode = "light";
|
|
82
|
-
this.options.uiConfig = deepmerge(projectConfig.loginModal || {}, this.options.uiConfig || {});
|
|
83
85
|
// init config
|
|
86
|
+
this.initUIConfig(projectConfig);
|
|
84
87
|
super.initAccountAbstractionConfig(projectConfig);
|
|
85
88
|
super.initChainsConfig(projectConfig);
|
|
86
89
|
super.initCachedConnectorAndChainId();
|
|
@@ -93,7 +96,8 @@ class Web3Auth extends noModal.Web3AuthNoModal {
|
|
|
93
96
|
connectorListener: this,
|
|
94
97
|
web3authClientId: this.options.clientId,
|
|
95
98
|
web3authNetwork: this.options.web3AuthNetwork,
|
|
96
|
-
|
|
99
|
+
authBuildEnv: this.options.authBuildEnv,
|
|
100
|
+
chainNamespaces: this.getChainNamespaces(),
|
|
97
101
|
walletRegistry: filteredWalletRegistry
|
|
98
102
|
}), {
|
|
99
103
|
onInitExternalWallets: this.onInitExternalWallets,
|
|
@@ -101,22 +105,31 @@ class Web3Auth extends noModal.Web3AuthNoModal {
|
|
|
101
105
|
onExternalWalletLogin: this.onExternalWalletLogin,
|
|
102
106
|
onModalVisibility: this.onModalVisibility
|
|
103
107
|
});
|
|
104
|
-
await this.loginModal.initModal();
|
|
108
|
+
await noModal.withAbort(() => this.loginModal.initModal(), signal);
|
|
105
109
|
// setup common JRPC provider
|
|
106
|
-
await this.setupCommonJRPCProvider();
|
|
110
|
+
await noModal.withAbort(() => this.setupCommonJRPCProvider(), signal);
|
|
107
111
|
// initialize connectors
|
|
108
112
|
this.on(noModal.CONNECTOR_EVENTS.CONNECTORS_UPDATED, ({
|
|
109
113
|
connectors: newConnectors
|
|
110
|
-
}) =>
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
114
|
+
}) => {
|
|
115
|
+
const onAbortHandler = () => {
|
|
116
|
+
var _this$connectors;
|
|
117
|
+
noModal.log.debug("init aborted");
|
|
118
|
+
if (((_this$connectors = this.connectors) === null || _this$connectors === void 0 ? void 0 : _this$connectors.length) > 0) {
|
|
119
|
+
super.cleanup();
|
|
120
|
+
}
|
|
121
|
+
};
|
|
122
|
+
noModal.withAbort(() => this.initConnectors({
|
|
123
|
+
connectors: newConnectors,
|
|
124
|
+
projectConfig,
|
|
125
|
+
disabledExternalWallets
|
|
126
|
+
}), signal, onAbortHandler);
|
|
117
127
|
});
|
|
128
|
+
await noModal.withAbort(() => super.loadConnectors({
|
|
129
|
+
projectConfig
|
|
130
|
+
}), signal);
|
|
118
131
|
// initialize plugins
|
|
119
|
-
await
|
|
132
|
+
await noModal.withAbort(() => super.initPlugins(), signal);
|
|
120
133
|
}
|
|
121
134
|
async connect() {
|
|
122
135
|
if (!this.loginModal) throw noModal.WalletInitializationError.notReady("Login modal is not initialized");
|
|
@@ -210,6 +223,23 @@ class Web3Auth extends noModal.Web3AuthNoModal {
|
|
|
210
223
|
walletRegistry
|
|
211
224
|
};
|
|
212
225
|
}
|
|
226
|
+
initUIConfig(projectConfig) {
|
|
227
|
+
this.options.uiConfig = deepmerge(noModal.cloneDeep(projectConfig.whitelabel || {}), this.options.uiConfig || {});
|
|
228
|
+
if (!this.options.uiConfig.defaultLanguage) this.options.uiConfig.defaultLanguage = utils.getUserLanguage(this.options.uiConfig.defaultLanguage);
|
|
229
|
+
if (!this.options.uiConfig.mode) this.options.uiConfig.mode = "light";
|
|
230
|
+
this.options.uiConfig = deepmerge(projectConfig.loginModal || {}, this.options.uiConfig);
|
|
231
|
+
// merge login methods order from project config and user config, with user config taking precedence
|
|
232
|
+
const defaultAuthConnections = projectConfig.embeddedWalletAuth.filter(x => x.isDefault).map(x => x.authConnection);
|
|
233
|
+
const mergedAuthConnections = [...(this.options.uiConfig.loginMethodsOrder || []), ...defaultAuthConnections];
|
|
234
|
+
const loginMethodsOrder = [];
|
|
235
|
+
const authConnectionSet = new Set();
|
|
236
|
+
for (const authConnection of mergedAuthConnections) {
|
|
237
|
+
if (authConnectionSet.has(authConnection)) continue;
|
|
238
|
+
authConnectionSet.add(authConnection);
|
|
239
|
+
loginMethodsOrder.push(authConnection);
|
|
240
|
+
}
|
|
241
|
+
this.options.uiConfig.loginMethodsOrder = loginMethodsOrder;
|
|
242
|
+
}
|
|
213
243
|
async initConnectors({
|
|
214
244
|
connectors,
|
|
215
245
|
projectConfig,
|
|
@@ -277,9 +307,7 @@ class Web3Auth extends noModal.Web3AuthNoModal {
|
|
|
277
307
|
groupedAuthConnectionId: groupedAuthConnectionId,
|
|
278
308
|
extraLoginOptions: authConnectionConfig.jwtParameters,
|
|
279
309
|
isDefault: true,
|
|
280
|
-
showOnModal: true
|
|
281
|
-
showOnDesktop: true,
|
|
282
|
-
showOnMobile: true
|
|
310
|
+
showOnModal: true
|
|
283
311
|
};
|
|
284
312
|
}
|
|
285
313
|
embedWalletConfigMap.set(groupedAuthConnectionId || authConnectionId, authConnectionConfig);
|
|
@@ -325,9 +353,7 @@ class Web3Auth extends noModal.Web3AuthNoModal {
|
|
|
325
353
|
// start with the default config of connector.
|
|
326
354
|
const defaultConnectorConfig = {
|
|
327
355
|
label: noModal.CONNECTOR_NAMES[connectorName] || connectorName.split("-").map(config$1.capitalizeFirstLetter).join(" "),
|
|
328
|
-
showOnModal: true
|
|
329
|
-
showOnMobile: true,
|
|
330
|
-
showOnDesktop: true
|
|
356
|
+
showOnModal: true
|
|
331
357
|
};
|
|
332
358
|
this.modalConfig.connectors[connectorName] = _objectSpread(_objectSpread({}, defaultConnectorConfig), ((_this$modalConfig3 = this.modalConfig) === null || _this$modalConfig3 === void 0 || (_this$modalConfig3 = _this$modalConfig3.connectors) === null || _this$modalConfig3 === void 0 ? void 0 : _this$modalConfig3[connectorName]) || {});
|
|
333
359
|
// check if connector is configured/added by user and exist in connectors map.
|
|
@@ -417,13 +443,21 @@ class Web3Auth extends noModal.Web3AuthNoModal {
|
|
|
417
443
|
}
|
|
418
444
|
async initExternalConnectors(externalConnectors, options) {
|
|
419
445
|
const connectorsConfig = {};
|
|
446
|
+
const connectorChainNamespaceMap = {};
|
|
420
447
|
// we do it like this because we don't want one slow connector to delay the load of the entire external wallet section.
|
|
421
448
|
externalConnectors.forEach(async connector => {
|
|
422
449
|
const connectorName = connector.name;
|
|
423
450
|
noModal.log.debug("init external wallet", this.cachedConnector, connectorName, connector.status);
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
451
|
+
// a wallet can support multiple chain namespaces e.g. Phantom has EvmInjected connector and WalletStandard connector.
|
|
452
|
+
if (!connectorChainNamespaceMap[connectorName]) connectorChainNamespaceMap[connectorName] = new Set();
|
|
453
|
+
if (connector.connectorNamespace === noModal.CONNECTOR_NAMESPACES.MULTICHAIN) {
|
|
454
|
+
this.getChainNamespaces().forEach(x => connectorChainNamespaceMap[connectorName].add(x));
|
|
455
|
+
} else {
|
|
456
|
+
connectorChainNamespaceMap[connectorName].add(connector.connectorNamespace);
|
|
457
|
+
}
|
|
458
|
+
// initialize connectors
|
|
459
|
+
// skip initializing cached connector here as it is already being initialized in initModal before.
|
|
460
|
+
if (connector.status === noModal.CONNECTOR_STATUS.NOT_READY && this.cachedConnector !== connectorName) {
|
|
427
461
|
try {
|
|
428
462
|
this.subscribeToConnectorEvents(connector);
|
|
429
463
|
const initialChain = this.getInitialChainIdForConnector(connector);
|
|
@@ -431,33 +465,23 @@ class Web3Auth extends noModal.Web3AuthNoModal {
|
|
|
431
465
|
autoConnect: this.cachedConnector === connectorName,
|
|
432
466
|
chainId: initialChain.chainId
|
|
433
467
|
});
|
|
434
|
-
const connectorModalConfig = this.modalConfig.connectors[connectorName];
|
|
435
|
-
connectorsConfig[connectorName] = _objectSpread(_objectSpread({}, connectorModalConfig), {}, {
|
|
436
|
-
isInjected: connector.isInjected,
|
|
437
|
-
icon: connector.icon
|
|
438
|
-
});
|
|
439
|
-
this.loginModal.addWalletLogins(connectorsConfig, {
|
|
440
|
-
showExternalWalletsOnly: !!options.showExternalWalletsOnly,
|
|
441
|
-
externalWalletsVisibility: !!options.externalWalletsVisibility,
|
|
442
|
-
externalWalletsInitialized: !!options.externalWalletsInitialized
|
|
443
|
-
});
|
|
444
468
|
} catch (error) {
|
|
445
469
|
noModal.log.error(error, "error while initializing connector", connectorName);
|
|
446
470
|
}
|
|
447
|
-
}
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
}
|
|
471
|
+
}
|
|
472
|
+
// update connector config
|
|
473
|
+
if ([noModal.CONNECTOR_STATUS.NOT_READY, noModal.CONNECTOR_STATUS.READY, noModal.CONNECTOR_STATUS.CONNECTING].includes(connector.status)) {
|
|
474
|
+
const connectorModalConfig = this.modalConfig.connectors[connectorName];
|
|
475
|
+
connectorsConfig[connectorName] = _objectSpread(_objectSpread({}, connectorModalConfig), {}, {
|
|
476
|
+
isInjected: connector.isInjected,
|
|
477
|
+
icon: connector.icon,
|
|
478
|
+
chainNamespaces: Array.from(connectorChainNamespaceMap[connectorName])
|
|
479
|
+
});
|
|
480
|
+
this.loginModal.addWalletLogins(connectorsConfig, {
|
|
481
|
+
showExternalWalletsOnly: !!options.showExternalWalletsOnly,
|
|
482
|
+
externalWalletsVisibility: !!options.externalWalletsVisibility,
|
|
483
|
+
externalWalletsInitialized: !!options.externalWalletsInitialized
|
|
484
|
+
});
|
|
461
485
|
}
|
|
462
486
|
});
|
|
463
487
|
}
|
|
@@ -83,11 +83,14 @@ function Web3AuthInnerProvider(params) {
|
|
|
83
83
|
setWeb3Auth(web3AuthInstance);
|
|
84
84
|
}, [config]);
|
|
85
85
|
react.useEffect(() => {
|
|
86
|
+
const controller = new AbortController();
|
|
86
87
|
async function init() {
|
|
87
88
|
try {
|
|
88
89
|
setInitError(null);
|
|
89
90
|
setIsInitializing(true);
|
|
90
|
-
await web3Auth.initModal(
|
|
91
|
+
await web3Auth.initModal({
|
|
92
|
+
signal: controller.signal
|
|
93
|
+
});
|
|
91
94
|
} catch (error) {
|
|
92
95
|
setInitError(error);
|
|
93
96
|
} finally {
|
|
@@ -95,6 +98,9 @@ function Web3AuthInnerProvider(params) {
|
|
|
95
98
|
}
|
|
96
99
|
}
|
|
97
100
|
if (web3Auth) init();
|
|
101
|
+
return () => {
|
|
102
|
+
controller.abort();
|
|
103
|
+
};
|
|
98
104
|
}, [web3Auth, config]);
|
|
99
105
|
react.useEffect(() => {
|
|
100
106
|
const addState = async () => {
|
|
@@ -154,6 +160,7 @@ function Web3AuthInnerProvider(params) {
|
|
|
154
160
|
web3Auth.off(noModal.CONNECTOR_EVENTS.DISCONNECTED, disconnectedListener);
|
|
155
161
|
web3Auth.off(noModal.CONNECTOR_EVENTS.CONNECTING, connectingListener);
|
|
156
162
|
web3Auth.off(noModal.CONNECTOR_EVENTS.ERRORED, errorListener);
|
|
163
|
+
web3Auth.cleanup();
|
|
157
164
|
}
|
|
158
165
|
};
|
|
159
166
|
}, [web3Auth]);
|
|
@@ -14,7 +14,7 @@ function BottomSheet({
|
|
|
14
14
|
uiConfig
|
|
15
15
|
}) {
|
|
16
16
|
const {
|
|
17
|
-
borderRadiusType
|
|
17
|
+
borderRadiusType = "large"
|
|
18
18
|
} = uiConfig;
|
|
19
19
|
return jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
20
20
|
children: [jsxRuntime.jsx("div", {
|
|
@@ -28,7 +28,7 @@ function BottomSheet({
|
|
|
28
28
|
role: "button"
|
|
29
29
|
}), jsxRuntime.jsxs("div", {
|
|
30
30
|
className: utils.cn(`w3a--fixed w3a--bottom-2 w3a--left-2 w3a--mx-auto w3a--flex w3a--w-[96%] w3a--flex-col
|
|
31
|
-
w3a--gap-y-2 w3a--
|
|
31
|
+
w3a--gap-y-2 w3a--border w3a--border-app-gray-100 w3a--bg-app-white w3a--p-4 w3a--shadow-lg w3a--transition-transform w3a--duration-500
|
|
32
32
|
w3a--ease-out dark:w3a--border-app-gray-600 dark:w3a--bg-app-dark-surface-main
|
|
33
33
|
${isShown ? "w3a--translate-y-0 w3a--delay-700" : "w3a--translate-y-full"}`, {
|
|
34
34
|
"w3a--rounded-[30px]": borderRadiusType === "large",
|
|
@@ -44,7 +44,7 @@ function BottomSheet({
|
|
|
44
44
|
fill: "none",
|
|
45
45
|
xmlns: "http://www.w3.org/2000/svg",
|
|
46
46
|
onClick: onClose,
|
|
47
|
-
className: "w3a--text-app-gray-500 dark:w3a--text-app-gray-200",
|
|
47
|
+
className: "w3a--text-app-gray-500 hover:w3a--text-app-gray-900 dark:w3a--text-app-gray-200 dark:hover:w3a--text-app-white",
|
|
48
48
|
children: jsxRuntime.jsx("path", {
|
|
49
49
|
fillRule: "evenodd",
|
|
50
50
|
clipRule: "evenodd",
|
|
@@ -6,7 +6,7 @@ var utils = require('../../../utils.js');
|
|
|
6
6
|
var Image = require('../../Image/Image.js');
|
|
7
7
|
|
|
8
8
|
function getProviderIcon(method, isDark, isPrimaryBtn) {
|
|
9
|
-
const imageId = method === auth.AUTH_CONNECTION.TWITTER ? `login-
|
|
9
|
+
const imageId = method === auth.AUTH_CONNECTION.TWITTER ? `login-X${isDark ? "-light" : "-dark"}` : `login-${method}${isDark ? "-light" : "-dark"}`;
|
|
10
10
|
const hoverId = method === auth.AUTH_CONNECTION.APPLE || method === auth.AUTH_CONNECTION.GITHUB || method === auth.AUTH_CONNECTION.TWITTER ? imageId : `login-${method}-active`;
|
|
11
11
|
if (isPrimaryBtn) {
|
|
12
12
|
return jsxRuntime.jsx(Image, {
|
|
@@ -4,6 +4,7 @@ var jsxRuntime = require('react/jsx-runtime');
|
|
|
4
4
|
var cn = require('classnames');
|
|
5
5
|
var react = require('react');
|
|
6
6
|
var reactI18next = require('react-i18next');
|
|
7
|
+
var ThemeContext = require('../../../context/ThemeContext.js');
|
|
7
8
|
var localeImport = require('../../../localeImport.js');
|
|
8
9
|
var utils = require('../../../utils.js');
|
|
9
10
|
var Image = require('../../Image/Image.js');
|
|
@@ -20,6 +21,7 @@ function ButtonWallet(props) {
|
|
|
20
21
|
label,
|
|
21
22
|
buttonRadius
|
|
22
23
|
} = props;
|
|
24
|
+
const isDark = react.useContext(ThemeContext.ThemedContext);
|
|
23
25
|
const isLink = react.useMemo(() => deviceDetails.platform !== "desktop" && button.href && button.hasWalletConnect && !button.hasInjectedWallet, [deviceDetails, button]);
|
|
24
26
|
const href = react.useMemo(() => button.href ? utils.formatIOSMobile({
|
|
25
27
|
uri: walletConnectUri,
|
|
@@ -34,7 +36,8 @@ function ButtonWallet(props) {
|
|
|
34
36
|
};
|
|
35
37
|
return jsxRuntime.jsxs("button", {
|
|
36
38
|
type: "button",
|
|
37
|
-
className: cn(`w3a--flex w3a--w-full w3a--items-center w3a--justify-between w3a--bg-app-gray-50 w3a--p-3 hover:w3a--bg-app-gray-200
|
|
39
|
+
className: cn(`w3a--group w3a--relative w3a--overflow-hidden w3a--flex w3a--w-full w3a--items-center w3a--justify-between w3a--bg-app-gray-50 w3a--p-3 hover:w3a--bg-app-gray-200
|
|
40
|
+
hover:w3a--text-app-gray-900 dark:w3a--bg-app-gray-800 dark:hover:w3a--bg-app-gray-600 active:w3a--scale-95 w3a--transition-all w3a--duration-150`, {
|
|
38
41
|
"w3a--rounded-full": buttonRadius === "pill",
|
|
39
42
|
"w3a--rounded-lg": buttonRadius === "rounded",
|
|
40
43
|
"w3a--rounded-none": buttonRadius === "square"
|
|
@@ -43,7 +46,7 @@ function ButtonWallet(props) {
|
|
|
43
46
|
children: [jsxRuntime.jsxs("div", {
|
|
44
47
|
className: "w3a--flex w3a--items-center w3a--gap-x-2",
|
|
45
48
|
children: [jsxRuntime.jsx("figure", {
|
|
46
|
-
className:
|
|
49
|
+
className: "w3a--size-5",
|
|
47
50
|
children: jsxRuntime.jsx(Image, {
|
|
48
51
|
imageData: button.icon,
|
|
49
52
|
imageId: `login-${button.name}`,
|
|
@@ -55,12 +58,17 @@ function ButtonWallet(props) {
|
|
|
55
58
|
extension: button.imgExtension || "webp"
|
|
56
59
|
})
|
|
57
60
|
}), jsxRuntime.jsx("p", {
|
|
58
|
-
className: "w3a--text-base w3a--font-normal w3a--text-app-gray-700 dark:w3a--text-app-white",
|
|
61
|
+
className: "w3a--max-w-[180px] w3a--truncate w3a--text-base w3a--font-normal w3a--text-app-gray-700 dark:w3a--text-app-white",
|
|
59
62
|
children: label
|
|
60
63
|
})]
|
|
61
64
|
}), button.hasInjectedWallet && jsxRuntime.jsx("span", {
|
|
62
|
-
className: "w3a--
|
|
65
|
+
className: "w3a--absolute w3a--right-4 w3a--top-1/2 w3a--flex w3a--w-auto -w3a--translate-y-1/2 w3a--items-center w3a--rounded-md w3a--bg-app-primary-100 w3a--px-2 w3a--py-1 w3a--text-xs w3a--font-medium w3a--text-app-primary-800 w3a--transition-all w3a--duration-300 group-hover:w3a--translate-x-6 group-hover:w3a--opacity-0 \n dark:w3a--border dark:w3a--border-app-primary-400 dark:w3a--bg-transparent dark:w3a--text-app-primary-400",
|
|
63
66
|
children: t("modal.external.installed")
|
|
67
|
+
}), jsxRuntime.jsx("img", {
|
|
68
|
+
id: "injected-wallet-arrow",
|
|
69
|
+
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",
|
|
70
|
+
src: utils.getIcons(isDark ? "chevron-right-light" : "chevron-right-dark"),
|
|
71
|
+
alt: "arrow"
|
|
64
72
|
})]
|
|
65
73
|
});
|
|
66
74
|
}
|
|
@@ -59,7 +59,7 @@ function ConnectWallet(props) {
|
|
|
59
59
|
}, [walletRegistry]);
|
|
60
60
|
const allUniqueButtons = react.useMemo(() => {
|
|
61
61
|
const uniqueButtonSet = new Set();
|
|
62
|
-
return
|
|
62
|
+
return customConnectorButtons.concat(allExternalButtons).filter(button => {
|
|
63
63
|
if (uniqueButtonSet.has(button.name)) return false;
|
|
64
64
|
uniqueButtonSet.add(button.name);
|
|
65
65
|
return true;
|
|
@@ -104,7 +104,7 @@ function ConnectWallet(props) {
|
|
|
104
104
|
};
|
|
105
105
|
const filteredButtons = react.useMemo(() => {
|
|
106
106
|
if (walletDiscoverySupported) {
|
|
107
|
-
return allUniqueButtons.filter(button => selectedChain === "all" || button.chainNamespaces.includes(selectedChain)).filter(button => button.name.toLowerCase().includes(walletSearch.toLowerCase()));
|
|
107
|
+
return [...allUniqueButtons.filter(button => button.hasInjectedWallet), ...allUniqueButtons.filter(button => !button.hasInjectedWallet)].filter(button => selectedChain === "all" || button.chainNamespaces.includes(selectedChain)).filter(button => button.name.toLowerCase().includes(walletSearch.toLowerCase()));
|
|
108
108
|
}
|
|
109
109
|
return installedWalletButtons;
|
|
110
110
|
}, [walletDiscoverySupported, installedWalletButtons, walletSearch, allUniqueButtons, selectedChain]);
|
|
@@ -43,18 +43,21 @@ function ConnectWalletChainFilter(props) {
|
|
|
43
43
|
});
|
|
44
44
|
}
|
|
45
45
|
return jsxRuntime.jsx("div", {
|
|
46
|
-
className: "w3a--flex w3a--items-center w3a--justify-items-start w3a--gap-x-
|
|
46
|
+
className: "w3a--flex w3a--items-center w3a--justify-items-start w3a--gap-x-4",
|
|
47
47
|
children: chains.map(chain => jsxRuntime.jsxs("button", {
|
|
48
48
|
type: "button",
|
|
49
|
-
className: utils.cn("w3a--flex w3a--items-center w3a--justify-center w3a--gap-x-1 w3a--text-xs w3a--font-medium w3a--px-4 w3a--py-3 w3a--text-app-gray-500 dark:w3a--text-app-gray-300 w3a--h-12", {
|
|
50
|
-
"w3a--bg-app-gray-100 dark:w3a--bg-app-gray-800 w3a--border
|
|
49
|
+
className: utils.cn("w3a--flex w3a--w-[104px] w3a--items-center w3a--justify-center w3a--gap-x-1 w3a--text-xs w3a--font-medium w3a--px-4 w3a--py-3 w3a--text-app-gray-500 dark:w3a--text-app-gray-300 hover:w3a--bg-app-gray-200 dark:hover:w3a--bg-app-gray-700 w3a--h-12 w3a--rounded-2xl w3a--border w3a--border-transparent", {
|
|
50
|
+
"w3a--bg-app-gray-100 dark:w3a--bg-app-gray-800 w3a--border-app-gray-200 dark:w3a--border-app-gray-700 w3a--text-app-gray-900 dark:w3a--text-app-white hover:!w3a--bg-app-gray-100 dark:hover:!w3a--bg-app-gray-800": selectedChain === chain.id
|
|
51
51
|
}),
|
|
52
52
|
onClick: () => setSelectedChain(chain.id),
|
|
53
53
|
children: [chain.icon && jsxRuntime.jsx("img", {
|
|
54
54
|
src: utils.getIcons(isDark ? `${chain.icon}-dark` : `${chain.icon}-light`),
|
|
55
55
|
alt: chain.name,
|
|
56
56
|
className: "w3a--size-5 w3a--object-contain"
|
|
57
|
-
}),
|
|
57
|
+
}), jsxRuntime.jsx("span", {
|
|
58
|
+
className: "first-letter:w3a--capitalize",
|
|
59
|
+
children: t(chain.name)
|
|
60
|
+
})]
|
|
58
61
|
}, chain.id))
|
|
59
62
|
});
|
|
60
63
|
}
|
|
@@ -56,7 +56,7 @@ const ConnectWalletChainNamespaceSelect = props => {
|
|
|
56
56
|
}) => jsxRuntime.jsx("li", {
|
|
57
57
|
children: jsxRuntime.jsxs("button", {
|
|
58
58
|
type: "button",
|
|
59
|
-
className: "w3a--btn w3a--
|
|
59
|
+
className: "w3a--btn w3a--group w3a--relative w3a--h-11 w3a--w-full w3a--items-center !w3a--justify-between w3a--overflow-hidden w3a--rounded-full",
|
|
60
60
|
onClick: () => handleExternalWalletClick({
|
|
61
61
|
connector: wallet.name,
|
|
62
62
|
chainNamespace
|
|
@@ -76,7 +76,8 @@ const ConnectWalletChainNamespaceSelect = props => {
|
|
|
76
76
|
children: displayName
|
|
77
77
|
})]
|
|
78
78
|
}), jsxRuntime.jsx("img", {
|
|
79
|
-
id: "
|
|
79
|
+
id: "chain-namespace-arrow",
|
|
80
|
+
className: "w3a--absolute w3a--right-4 w3a--top-1/2 -w3a--translate-x-6 -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",
|
|
80
81
|
src: utils.getIcons(isDark ? "chevron-right-dark" : "chevron-right-light"),
|
|
81
82
|
alt: "arrow"
|
|
82
83
|
})]
|
|
@@ -29,7 +29,7 @@ function ConnectWalletHeader(props) {
|
|
|
29
29
|
xmlns: "http://www.w3.org/2000/svg",
|
|
30
30
|
fill: "none",
|
|
31
31
|
viewBox: "0 0 20 20",
|
|
32
|
-
className: "w3a--text-app-gray-900 dark:w3a--text-app-white",
|
|
32
|
+
className: "w3a--text-app-gray-500 hover:w3a--text-app-gray-900 dark:w3a--text-app-gray-200 dark:hover:w3a--text-app-white",
|
|
33
33
|
children: jsxRuntime.jsx("path", {
|
|
34
34
|
fill: "currentColor",
|
|
35
35
|
fillRule: "evenodd",
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var jsxRuntime = require('react/jsx-runtime');
|
|
4
|
+
var react = require('react');
|
|
4
5
|
var reactI18next = require('react-i18next');
|
|
5
6
|
var localeImport = require('../../../localeImport.js');
|
|
6
7
|
var utils = require('../../../utils.js');
|
|
@@ -27,7 +28,7 @@ function WalletsFound(props) {
|
|
|
27
28
|
} = props;
|
|
28
29
|
if (isLoading) {
|
|
29
30
|
return jsxRuntime.jsx("div", {
|
|
30
|
-
className: "w3a--flex w3a--flex-col w3a--gap-y-2
|
|
31
|
+
className: "w3a--flex w3a--flex-col w3a--gap-y-2",
|
|
31
32
|
children: Array.from({
|
|
32
33
|
length: 6
|
|
33
34
|
}).map((_, index) => jsxRuntime.jsx("div", {
|
|
@@ -82,7 +83,7 @@ function MoreWalletsButton(props) {
|
|
|
82
83
|
}
|
|
83
84
|
return jsxRuntime.jsxs("button", {
|
|
84
85
|
type: "button",
|
|
85
|
-
className: utils.cn("w3a--flex w3a--items-center w3a--justify-start w3a--gap-x-2 w3a--bg-app-gray-50 w3a--p-3 hover:w3a--bg-app-gray-200 dark:w3a--bg-app-gray-800 dark:hover:w3a--bg-app-gray-600", {
|
|
86
|
+
className: utils.cn("w3a--flex w3a--items-center w3a--justify-start w3a--gap-x-2 w3a--bg-app-gray-50 w3a--p-3 hover:w3a--bg-app-gray-200 dark:w3a--bg-app-gray-800 dark:hover:w3a--bg-app-gray-600 active:w3a--scale-95 w3a--transition-all w3a--duration-150 w3a--mr-2.5", {
|
|
86
87
|
"w3a--rounded-full": buttonRadius === "pill",
|
|
87
88
|
"w3a--rounded-lg": buttonRadius === "rounded",
|
|
88
89
|
"w3a--rounded-none": buttonRadius === "square"
|
|
@@ -115,9 +116,16 @@ function ConnectWalletList(props) {
|
|
|
115
116
|
walletConnectUri,
|
|
116
117
|
buttonRadius
|
|
117
118
|
} = props;
|
|
119
|
+
const [showMoreWallets, setShowMoreWallets] = react.useState(true);
|
|
120
|
+
const onShowMoreWalletsClick = () => {
|
|
121
|
+
setShowMoreWallets(false);
|
|
122
|
+
handleMoreWallets();
|
|
123
|
+
};
|
|
118
124
|
return jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
119
125
|
children: [jsxRuntime.jsx("ul", {
|
|
120
|
-
className: utils.cn("w3a--overflow-y-auto w3a--flex w3a--flex-col w3a--gap-y-2 w3a--h-[280px]"
|
|
126
|
+
className: utils.cn("w3a--overflow-y-auto w3a--flex w3a--flex-col w3a--gap-y-2 w3a--h-[280px] w3a--social-container w3a--pr-2.5", {
|
|
127
|
+
"w3a--h-[328px]": !showMoreWallets
|
|
128
|
+
}),
|
|
121
129
|
children: externalButtons.length === 0 ? jsxRuntime.jsx(NoWalletsFound, {}) : jsxRuntime.jsx(WalletsFound, {
|
|
122
130
|
externalButtons: externalButtons,
|
|
123
131
|
isLoading: isLoading,
|
|
@@ -126,10 +134,10 @@ function ConnectWalletList(props) {
|
|
|
126
134
|
walletConnectUri: walletConnectUri,
|
|
127
135
|
buttonRadius: buttonRadius
|
|
128
136
|
})
|
|
129
|
-
}), totalExternalWalletsCount > 15 && !isLoading && initialWalletCount < totalExternalWalletsCount && jsxRuntime.jsx(MoreWalletsButton, {
|
|
137
|
+
}), showMoreWallets && totalExternalWalletsCount > 15 && !isLoading && initialWalletCount < totalExternalWalletsCount && jsxRuntime.jsx(MoreWalletsButton, {
|
|
130
138
|
totalExternalWalletsCount: totalExternalWalletsCount,
|
|
131
139
|
initialWalletCount: initialWalletCount,
|
|
132
|
-
handleMoreWallets:
|
|
140
|
+
handleMoreWallets: onShowMoreWalletsClick,
|
|
133
141
|
isLoading: isLoading,
|
|
134
142
|
isDark: isDark,
|
|
135
143
|
buttonRadius: buttonRadius
|
|
@@ -77,7 +77,7 @@ function ConnectWalletQrCode(props) {
|
|
|
77
77
|
}), "?"]
|
|
78
78
|
}), jsxRuntime.jsx("button", {
|
|
79
79
|
type: "button",
|
|
80
|
-
className: "w3a--appearance-none w3a--rounded-full w3a--border w3a--border-app-gray-
|
|
80
|
+
className: "w3a--appearance-none w3a--rounded-full w3a--border w3a--border-app-gray-200 w3a--bg-transparent w3a--px-5 w3a--py-2 w3a--text-base w3a--font-normal w3a--text-app-gray-700 w3a--transition-all w3a--duration-150 hover:w3a--border-transparent hover:w3a--shadow-light active:w3a--scale-95 dark:w3a--border-app-gray-700 dark:w3a--text-app-gray-300 dark:hover:w3a--border-transparent dark:hover:w3a--shadow-dark",
|
|
81
81
|
onClick: () => {
|
|
82
82
|
setBodyState(_objectSpread(_objectSpread({}, bodyState), {}, {
|
|
83
83
|
showWalletDetails: true,
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
var jsxRuntime = require('react/jsx-runtime');
|
|
4
4
|
var react = require('react');
|
|
5
5
|
var ThemeContext = require('../../context/ThemeContext.js');
|
|
6
|
+
var utils = require('../../utils.js');
|
|
6
7
|
|
|
7
8
|
/**
|
|
8
9
|
* Image component
|
|
@@ -36,7 +37,7 @@ function Image(props) {
|
|
|
36
37
|
height: height,
|
|
37
38
|
width: width,
|
|
38
39
|
alt: hoverImageId,
|
|
39
|
-
className: "w3a--object-contain"
|
|
40
|
+
className: utils.cn("w3a--object-contain", `w3a--h-${height} w3a--w-${width}`)
|
|
40
41
|
});
|
|
41
42
|
}
|
|
42
43
|
return jsxRuntime.jsx("img", {
|
|
@@ -45,7 +46,7 @@ function Image(props) {
|
|
|
45
46
|
height: height,
|
|
46
47
|
width: width,
|
|
47
48
|
alt: hoverImageId,
|
|
48
|
-
className: "w3a--rounded w3a--object-contain"
|
|
49
|
+
className: utils.cn("w3a--rounded w3a--object-contain", `w3a--h-${height} w3a--w-${width}`)
|
|
49
50
|
});
|
|
50
51
|
}
|
|
51
52
|
if (imageData) {
|
|
@@ -55,7 +56,7 @@ function Image(props) {
|
|
|
55
56
|
height: height,
|
|
56
57
|
width: width,
|
|
57
58
|
alt: imageId,
|
|
58
|
-
className: "w3a--object-contain",
|
|
59
|
+
className: utils.cn("w3a--object-contain", `w3a--h-${height} w3a--w-${width}`),
|
|
59
60
|
onError: ({
|
|
60
61
|
currentTarget
|
|
61
62
|
}) => {
|
|
@@ -73,7 +74,7 @@ function Image(props) {
|
|
|
73
74
|
height: height,
|
|
74
75
|
width: width,
|
|
75
76
|
alt: imageId,
|
|
76
|
-
className: "w3a--rounded w3a--object-contain",
|
|
77
|
+
className: utils.cn("w3a--rounded w3a--object-contain", `w3a--h-${height} w3a--w-${width}`),
|
|
77
78
|
onError: ({
|
|
78
79
|
currentTarget
|
|
79
80
|
}) => {
|
|
@@ -34,7 +34,7 @@ function ConnectingStatus(props) {
|
|
|
34
34
|
children: [jsxRuntime.jsxs("div", {
|
|
35
35
|
className: "w3a--flex w3a--items-center w3a--justify-center w3a--gap-x-6",
|
|
36
36
|
children: [jsxRuntime.jsx("figure", {
|
|
37
|
-
className: "w3a--
|
|
37
|
+
className: "w3a--flex w3a--size-10 w3a--items-center w3a--justify-center w3a--overflow-hidden",
|
|
38
38
|
children: jsxRuntime.jsx("img", {
|
|
39
39
|
src: appLogo,
|
|
40
40
|
alt: "",
|