@web3auth/modal 10.0.0-alpha.1 → 10.0.0-beta.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 +3 -57
- package/dist/lib.cjs/packages/modal/src/index.js +1 -5
- package/dist/lib.cjs/packages/modal/src/modalManager.js +142 -106
- package/dist/lib.cjs/packages/modal/src/react/context/Web3AuthInnerContext.js +1 -12
- package/dist/lib.cjs/packages/modal/src/ui/components/AdapterLoader.js +24 -24
- package/dist/lib.cjs/packages/modal/src/ui/components/Button/Button.js +3 -4
- package/dist/lib.cjs/packages/modal/src/ui/components/ExternalWallet/ExternalWalletButton.js +6 -6
- package/dist/lib.cjs/packages/modal/src/ui/components/ExternalWallet/ExternalWalletChainNamespace.js +91 -0
- package/dist/lib.cjs/packages/modal/src/ui/components/ExternalWallet/ExternalWalletConnect.js +12 -12
- package/dist/lib.cjs/packages/modal/src/ui/components/ExternalWallet/ExternalWalletDetails.js +14 -5
- package/dist/lib.cjs/packages/modal/src/ui/components/ExternalWallet/ExternalWalletHeader.js +9 -9
- package/dist/lib.cjs/packages/modal/src/ui/components/ExternalWallet/ExternalWalletInstall.js +16 -16
- package/dist/lib.cjs/packages/modal/src/ui/components/ExternalWallets.js +48 -42
- package/dist/lib.cjs/packages/modal/src/ui/components/Footer.js +6 -6
- package/dist/lib.cjs/packages/modal/src/ui/components/Header.js +17 -17
- package/dist/lib.cjs/packages/modal/src/ui/components/Icon.js +4 -4
- package/dist/lib.cjs/packages/modal/src/ui/components/Image.js +4 -4
- package/dist/lib.cjs/packages/modal/src/ui/components/Loader.js +11 -11
- package/dist/lib.cjs/packages/modal/src/ui/components/Modal.js +62 -28
- package/dist/lib.cjs/packages/modal/src/ui/components/SelfCustodyViaWeb3Auth.js +5 -5
- package/dist/lib.cjs/packages/modal/src/ui/components/SocialLoginPasswordless.js +31 -22
- package/dist/lib.cjs/packages/modal/src/ui/components/SocialLogins.js +31 -26
- package/dist/lib.cjs/packages/modal/src/ui/components/WalletConnect.js +9 -9
- package/dist/lib.cjs/packages/modal/src/ui/config.js +3 -4
- package/dist/lib.cjs/packages/modal/src/ui/css/web3auth.css.js +1 -1
- package/dist/lib.cjs/packages/modal/src/ui/i18n/dutch.json.js +3 -0
- 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 +2 -4
- package/dist/lib.cjs/packages/modal/src/ui/loginModal.js +18 -15
- package/dist/lib.cjs/packages/modal/src/ui/utils.js +0 -21
- package/dist/lib.cjs/packages/modal/src/vue/Web3AuthProvider.js +1 -13
- package/dist/lib.cjs/types/config.d.ts +3 -0
- package/dist/{types → lib.cjs/types}/interface.d.ts +2 -6
- package/dist/{types → lib.cjs/types}/modalManager.d.ts +7 -3
- package/dist/{types → lib.cjs/types}/react/interfaces.d.ts +1 -6
- package/dist/lib.cjs/types/ui/components/ExternalWallet/ExternalWalletChainNamespace.d.ts +9 -0
- package/dist/{types → lib.cjs/types}/ui/components/ExternalWallet/ExternalWalletDetails.d.ts +2 -1
- package/dist/{types → lib.cjs/types}/ui/components/ExternalWallets.d.ts +4 -6
- package/dist/{types → lib.cjs/types}/ui/components/Modal.d.ts +1 -1
- package/dist/{types → lib.cjs/types}/ui/components/SocialLoginPasswordless.d.ts +3 -5
- package/dist/{types → lib.cjs/types}/ui/components/SocialLogins.d.ts +2 -6
- package/dist/lib.cjs/types/ui/config.d.ts +4 -0
- package/dist/{types → lib.cjs/types}/ui/interfaces.d.ts +10 -8
- package/dist/{types → lib.cjs/types}/ui/loginModal.d.ts +1 -1
- package/dist/{types → lib.cjs/types}/ui/utils.d.ts +1 -3
- package/dist/{types → lib.cjs/types}/vue/interfaces.d.ts +1 -6
- package/dist/lib.esm/packages/modal/src/config.js +4 -54
- package/dist/lib.esm/packages/modal/src/index.js +1 -1
- package/dist/lib.esm/packages/modal/src/modalManager.js +154 -95
- package/dist/lib.esm/packages/modal/src/react/context/Web3AuthInnerContext.js +1 -12
- package/dist/lib.esm/packages/modal/src/ui/components/ExternalWallet/ExternalWalletChainNamespace.js +90 -0
- package/dist/lib.esm/packages/modal/src/ui/components/ExternalWallet/ExternalWalletDetails.js +13 -1
- package/dist/lib.esm/packages/modal/src/ui/components/ExternalWallets.js +29 -19
- package/dist/lib.esm/packages/modal/src/ui/components/Modal.js +47 -12
- package/dist/lib.esm/packages/modal/src/ui/components/SocialLoginPasswordless.js +18 -9
- package/dist/lib.esm/packages/modal/src/ui/components/SocialLogins.js +18 -12
- package/dist/lib.esm/packages/modal/src/ui/config.js +5 -5
- package/dist/lib.esm/packages/modal/src/ui/css/web3auth.css.js +1 -1
- package/dist/lib.esm/packages/modal/src/ui/i18n/dutch.json.js +3 -0
- 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 +2 -1
- package/dist/lib.esm/packages/modal/src/ui/loginModal.js +15 -9
- package/dist/lib.esm/packages/modal/src/ui/utils.js +2 -22
- package/dist/lib.esm/packages/modal/src/vue/Web3AuthProvider.js +1 -12
- package/dist/modal.umd.min.js +1 -1
- package/package.json +18 -18
- package/dist/modal.cjs.js +0 -5884
- package/dist/types/config.d.ts +0 -7
- package/dist/types/ui/config.d.ts +0 -4
- /package/dist/{types → lib.cjs/types}/index.d.ts +0 -0
- /package/dist/{types → lib.cjs/types}/react/Web3AuthProvider.d.ts +0 -0
- /package/dist/{types → lib.cjs/types}/react/context/Web3AuthInnerContext.d.ts +0 -0
- /package/dist/{types → lib.cjs/types}/react/context/index.d.ts +0 -0
- /package/dist/{types → lib.cjs/types}/react/hooks/index.d.ts +0 -0
- /package/dist/{types → lib.cjs/types}/react/hooks/useWeb3Auth.d.ts +0 -0
- /package/dist/{types → lib.cjs/types}/react/index.d.ts +0 -0
- /package/dist/{types → lib.cjs/types}/ui/components/AdapterLoader.d.ts +0 -0
- /package/dist/{types → lib.cjs/types}/ui/components/Button/Button.d.ts +0 -0
- /package/dist/{types → lib.cjs/types}/ui/components/Button/index.d.ts +0 -0
- /package/dist/{types → lib.cjs/types}/ui/components/ExternalWallet/ExternalWalletButton.d.ts +0 -0
- /package/dist/{types → lib.cjs/types}/ui/components/ExternalWallet/ExternalWalletConnect.d.ts +0 -0
- /package/dist/{types → lib.cjs/types}/ui/components/ExternalWallet/ExternalWalletHeader.d.ts +0 -0
- /package/dist/{types → lib.cjs/types}/ui/components/ExternalWallet/ExternalWalletInstall.d.ts +0 -0
- /package/dist/{types → lib.cjs/types}/ui/components/Footer.d.ts +0 -0
- /package/dist/{types → lib.cjs/types}/ui/components/Header.d.ts +0 -0
- /package/dist/{types → lib.cjs/types}/ui/components/Icon.d.ts +0 -0
- /package/dist/{types → lib.cjs/types}/ui/components/Image.d.ts +0 -0
- /package/dist/{types → lib.cjs/types}/ui/components/Loader.d.ts +0 -0
- /package/dist/{types → lib.cjs/types}/ui/components/SelfCustodyViaWeb3Auth.d.ts +0 -0
- /package/dist/{types → lib.cjs/types}/ui/components/WalletConnect.d.ts +0 -0
- /package/dist/{types → lib.cjs/types}/ui/context/ThemeContext.d.ts +0 -0
- /package/dist/{types → lib.cjs/types}/ui/helper/countryData.d.ts +0 -0
- /package/dist/{types → lib.cjs/types}/ui/i18n/index.d.ts +0 -0
- /package/dist/{types → lib.cjs/types}/ui/index.d.ts +0 -0
- /package/dist/{types → lib.cjs/types}/ui/localeImport.d.ts +0 -0
- /package/dist/{types → lib.cjs/types}/vue/Web3AuthProvider.d.ts +0 -0
- /package/dist/{types → lib.cjs/types}/vue/composables/index.d.ts +0 -0
- /package/dist/{types → lib.cjs/types}/vue/composables/useWeb3Auth.d.ts +0 -0
- /package/dist/{types → lib.cjs/types}/vue/index.d.ts +0 -0
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
// capture whitelabel only once
|
|
4
|
-
|
|
5
3
|
const LOGIN_MODAL_EVENTS = {
|
|
6
4
|
INIT_EXTERNAL_WALLETS: "INIT_EXTERNAL_WALLETS",
|
|
7
|
-
|
|
5
|
+
EXTERNAL_WALLET_LOGIN: "EXTERNAL_WALLET_LOGIN",
|
|
6
|
+
SOCIAL_LOGIN: "SOCIAL_LOGIN",
|
|
8
7
|
DISCONNECT: "DISCONNECT",
|
|
9
8
|
MODAL_VISIBILITY: "MODAL_VISIBILITY"
|
|
10
9
|
};
|
|
@@ -16,7 +15,6 @@ const MODAL_STATUS = {
|
|
|
16
15
|
};
|
|
17
16
|
const DEFAULT_LOGO_LIGHT = "https://images.web3auth.io/web3auth-logo-w.svg"; // logo used on light mode
|
|
18
17
|
const DEFAULT_LOGO_DARK = "https://images.web3auth.io/web3auth-logo-w-light.svg"; // logo used on dark mode
|
|
19
|
-
|
|
20
18
|
const WALLET_CONNECT_LOGO = "https://images.web3auth.io/login-wallet-connect.svg";
|
|
21
19
|
|
|
22
20
|
exports.DEFAULT_LOGO_DARK = DEFAULT_LOGO_DARK;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var _defineProperty = require('@babel/runtime/helpers/defineProperty');
|
|
4
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
4
5
|
require('./css/web3auth.css.js');
|
|
5
6
|
var auth = require('@web3auth/auth');
|
|
6
7
|
var noModal = require('@web3auth/no-modal');
|
|
@@ -10,7 +11,6 @@ var ThemeContext = require('./context/ThemeContext.js');
|
|
|
10
11
|
var interfaces = require('./interfaces.js');
|
|
11
12
|
var localeImport = require('./localeImport.js');
|
|
12
13
|
var utils = require('./utils.js');
|
|
13
|
-
var jsxRuntime = require('react/jsx-runtime');
|
|
14
14
|
|
|
15
15
|
function createWrapper(parentZIndex) {
|
|
16
16
|
const existingWrapper = document.getElementById("w3a-parent-container");
|
|
@@ -31,16 +31,14 @@ class LoginModal extends auth.SafeEventEmitter {
|
|
|
31
31
|
super();
|
|
32
32
|
_defineProperty(this, "uiConfig", void 0);
|
|
33
33
|
_defineProperty(this, "stateEmitter", void 0);
|
|
34
|
-
_defineProperty(this, "
|
|
34
|
+
_defineProperty(this, "chainNamespaces", void 0);
|
|
35
35
|
_defineProperty(this, "walletRegistry", void 0);
|
|
36
36
|
_defineProperty(this, "initModal", async () => {
|
|
37
37
|
const darkState = {
|
|
38
38
|
isDark: this.isDark
|
|
39
39
|
};
|
|
40
40
|
const useLang = this.uiConfig.defaultLanguage || auth.LANGUAGES.en;
|
|
41
|
-
|
|
42
41
|
// Load new language resource
|
|
43
|
-
|
|
44
42
|
if (useLang === auth.LANGUAGES.de) {
|
|
45
43
|
Promise.resolve().then(function () { return require('./i18n/german.json.js'); }).then(messages => {
|
|
46
44
|
localeImport.addResourceBundle(useLang, "translation", messages.default);
|
|
@@ -128,9 +126,9 @@ class LoginModal extends auth.SafeEventEmitter {
|
|
|
128
126
|
container.classList.remove("w3a--dark");
|
|
129
127
|
}
|
|
130
128
|
const root = client.createRoot(container);
|
|
131
|
-
root.render(
|
|
129
|
+
root.render(jsxRuntime.jsx(ThemeContext.ThemedContext.Provider, {
|
|
132
130
|
value: darkState,
|
|
133
|
-
children:
|
|
131
|
+
children: jsxRuntime.jsx(Modal, {
|
|
134
132
|
closeModal: this.closeModal,
|
|
135
133
|
stateListener: this.stateEmitter,
|
|
136
134
|
handleShowExternalWallets: this.handleShowExternalWallets,
|
|
@@ -138,7 +136,7 @@ class LoginModal extends auth.SafeEventEmitter {
|
|
|
138
136
|
handleSocialLoginClick: this.handleSocialLoginClick,
|
|
139
137
|
appLogo: darkState.isDark ? this.uiConfig.logoDark : this.uiConfig.logoLight,
|
|
140
138
|
appName: this.uiConfig.appName,
|
|
141
|
-
|
|
139
|
+
chainNamespaces: this.chainNamespaces,
|
|
142
140
|
walletRegistry: this.walletRegistry
|
|
143
141
|
})
|
|
144
142
|
}));
|
|
@@ -193,10 +191,14 @@ class LoginModal extends auth.SafeEventEmitter {
|
|
|
193
191
|
_defineProperty(this, "handleExternalWalletClick", params => {
|
|
194
192
|
noModal.log.info("external wallet clicked", params);
|
|
195
193
|
const {
|
|
196
|
-
connector
|
|
194
|
+
connector,
|
|
195
|
+
chainNamespace
|
|
197
196
|
} = params;
|
|
198
|
-
this.emit(interfaces.LOGIN_MODAL_EVENTS.
|
|
199
|
-
connector
|
|
197
|
+
this.emit(interfaces.LOGIN_MODAL_EVENTS.EXTERNAL_WALLET_LOGIN, {
|
|
198
|
+
connector,
|
|
199
|
+
loginParams: {
|
|
200
|
+
chainNamespace
|
|
201
|
+
}
|
|
200
202
|
});
|
|
201
203
|
});
|
|
202
204
|
_defineProperty(this, "handleSocialLoginClick", params => {
|
|
@@ -205,12 +207,14 @@ class LoginModal extends auth.SafeEventEmitter {
|
|
|
205
207
|
connector,
|
|
206
208
|
loginParams
|
|
207
209
|
} = params;
|
|
208
|
-
this.emit(interfaces.LOGIN_MODAL_EVENTS.
|
|
210
|
+
this.emit(interfaces.LOGIN_MODAL_EVENTS.SOCIAL_LOGIN, {
|
|
209
211
|
connector,
|
|
210
212
|
loginParams: {
|
|
211
|
-
|
|
213
|
+
authConnection: loginParams.authConnection,
|
|
214
|
+
authConnectionId: loginParams.authConnectionId,
|
|
215
|
+
groupedAuthConnectionId: loginParams.groupedAuthConnectionId,
|
|
212
216
|
login_hint: loginParams.login_hint,
|
|
213
|
-
|
|
217
|
+
extraLoginOptions: loginParams.extraLoginOptions
|
|
214
218
|
}
|
|
215
219
|
});
|
|
216
220
|
});
|
|
@@ -236,7 +240,6 @@ class LoginModal extends auth.SafeEventEmitter {
|
|
|
236
240
|
// connections without any user interaction.
|
|
237
241
|
if ((data === null || data === void 0 ? void 0 : data.connector) !== noModal.WALLET_CONNECTORS.WALLET_CONNECT_V2) {
|
|
238
242
|
// const provider = data?.loginProvider || "";
|
|
239
|
-
|
|
240
243
|
this.setState({
|
|
241
244
|
status: interfaces.MODAL_STATUS.CONNECTING
|
|
242
245
|
});
|
|
@@ -297,7 +300,7 @@ class LoginModal extends auth.SafeEventEmitter {
|
|
|
297
300
|
if (!_uiConfig.primaryButton) this.uiConfig.primaryButton = "socialLogin";
|
|
298
301
|
if (!_uiConfig.defaultLanguage) this.uiConfig.defaultLanguage = utils.getUserLanguage(_uiConfig.defaultLanguage);
|
|
299
302
|
this.stateEmitter = new auth.SafeEventEmitter();
|
|
300
|
-
this.
|
|
303
|
+
this.chainNamespaces = _uiConfig.chainNamespaces;
|
|
301
304
|
this.walletRegistry = _uiConfig.walletRegistry;
|
|
302
305
|
this.subscribeCoreEvents(this.uiConfig.connectorListener);
|
|
303
306
|
}
|
|
@@ -1,29 +1,9 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var _objectSpread = require('@babel/runtime/helpers/objectSpread2');
|
|
4
3
|
var httpHelpers = require('@toruslabs/http-helpers');
|
|
5
4
|
var auth = require('@web3auth/auth');
|
|
6
5
|
var noModal = require('@web3auth/no-modal');
|
|
7
|
-
var config = require('./config.js');
|
|
8
6
|
|
|
9
|
-
const getConnectorSocialLogins = (connectorName, loginMethodsConfig = {}) => {
|
|
10
|
-
const finalLoginMethodsConfig = {};
|
|
11
|
-
if (connectorName === noModal.WALLET_CONNECTORS.AUTH) {
|
|
12
|
-
config.AUTH_PROVIDERS.forEach(loginMethod => {
|
|
13
|
-
const currentLoginMethodConfig = loginMethodsConfig[loginMethod] || {
|
|
14
|
-
name: config.AUTH_PROVIDERS_NAMES[loginMethod],
|
|
15
|
-
showOnMobile: true,
|
|
16
|
-
showOnModal: true,
|
|
17
|
-
showOnDesktop: true
|
|
18
|
-
};
|
|
19
|
-
finalLoginMethodsConfig[loginMethod] = _objectSpread({}, currentLoginMethodConfig);
|
|
20
|
-
});
|
|
21
|
-
noModal.log.debug("auth login method ui config", finalLoginMethodsConfig);
|
|
22
|
-
} else {
|
|
23
|
-
throw noModal.WalletInitializationError.invalidParams(`${connectorName} is not a valid connector`);
|
|
24
|
-
}
|
|
25
|
-
return finalLoginMethodsConfig;
|
|
26
|
-
};
|
|
27
7
|
const passwordlessBackendUrl = "https://api-passwordless.web3auth.io";
|
|
28
8
|
const getUserCountry = async () => {
|
|
29
9
|
try {
|
|
@@ -64,7 +44,6 @@ const getUserLanguage = defaultLanguage => {
|
|
|
64
44
|
return Object.prototype.hasOwnProperty.call(auth.LANGUAGE_MAP, userLanguage) ? userLanguage : auth.LANGUAGES.en;
|
|
65
45
|
};
|
|
66
46
|
|
|
67
|
-
exports.getConnectorSocialLogins = getConnectorSocialLogins;
|
|
68
47
|
exports.getUserCountry = getUserCountry;
|
|
69
48
|
exports.getUserLanguage = getUserLanguage;
|
|
70
49
|
exports.passwordlessBackendUrl = passwordlessBackendUrl;
|
|
@@ -92,18 +92,7 @@ const Web3AuthProvider = vue.defineComponent({
|
|
|
92
92
|
try {
|
|
93
93
|
initError.value = null;
|
|
94
94
|
isInitializing.value = true;
|
|
95
|
-
|
|
96
|
-
modalConfig,
|
|
97
|
-
hideWalletDiscovery
|
|
98
|
-
} = props.config;
|
|
99
|
-
if (modalConfig) {
|
|
100
|
-
await newWeb3Auth.initModal({
|
|
101
|
-
modalConfig,
|
|
102
|
-
hideWalletDiscovery
|
|
103
|
-
});
|
|
104
|
-
} else {
|
|
105
|
-
await newWeb3Auth.initModal();
|
|
106
|
-
}
|
|
95
|
+
await newWeb3Auth.initModal();
|
|
107
96
|
} catch (error) {
|
|
108
97
|
initError.value = error;
|
|
109
98
|
} finally {
|
|
@@ -155,7 +144,6 @@ const Web3AuthProvider = vue.defineComponent({
|
|
|
155
144
|
const errorListener = () => {
|
|
156
145
|
status.value = noModal.CONNECTOR_EVENTS.ERRORED;
|
|
157
146
|
};
|
|
158
|
-
|
|
159
147
|
// unregister previous listeners
|
|
160
148
|
if (prevWeb3Auth && newWeb3Auth !== prevWeb3Auth) {
|
|
161
149
|
prevWeb3Auth.off(noModal.CONNECTOR_EVENTS.NOT_READY, notReadyListener);
|
|
@@ -1,16 +1,12 @@
|
|
|
1
|
-
import type { BaseConnectorConfig,
|
|
1
|
+
import type { BaseConnectorConfig, IProvider, IWeb3Auth, LoginMethodConfig, WALLET_CONNECTOR_TYPE } from "@web3auth/no-modal";
|
|
2
2
|
export interface ModalConfig extends Omit<BaseConnectorConfig, "isInjected"> {
|
|
3
3
|
loginMethods?: LoginMethodConfig;
|
|
4
4
|
}
|
|
5
5
|
export interface ConnectorsModalConfig {
|
|
6
|
-
chainNamespace: ChainNamespaceType;
|
|
7
6
|
connectors?: Record<WALLET_CONNECTOR_TYPE, ModalConfig>;
|
|
8
|
-
}
|
|
9
|
-
export interface ModalConfigParams {
|
|
10
|
-
modalConfig?: Record<WALLET_CONNECTOR_TYPE, ModalConfig>;
|
|
11
7
|
hideWalletDiscovery?: boolean;
|
|
12
8
|
}
|
|
13
9
|
export interface IWeb3AuthModal extends IWeb3Auth {
|
|
14
|
-
initModal(
|
|
10
|
+
initModal(): Promise<void>;
|
|
15
11
|
connect(): Promise<IProvider | null>;
|
|
16
12
|
}
|
|
@@ -1,20 +1,24 @@
|
|
|
1
1
|
import { type IProvider, type IWeb3AuthCoreOptions, Web3AuthNoModal } from "@web3auth/no-modal";
|
|
2
|
-
import { type ConnectorsModalConfig, type IWeb3AuthModal
|
|
2
|
+
import { type ConnectorsModalConfig, type IWeb3AuthModal } from "./interface";
|
|
3
3
|
import { LoginModal, type UIConfig } from "./ui";
|
|
4
4
|
export interface Web3AuthOptions extends IWeb3AuthCoreOptions {
|
|
5
5
|
/**
|
|
6
6
|
* Config for configuring modal ui display properties
|
|
7
7
|
*/
|
|
8
8
|
uiConfig?: Omit<UIConfig, "connectorListener">;
|
|
9
|
+
/**
|
|
10
|
+
* Config for configuring modal ui display properties
|
|
11
|
+
*/
|
|
12
|
+
modalConfig?: ConnectorsModalConfig;
|
|
9
13
|
}
|
|
10
14
|
export declare class Web3Auth extends Web3AuthNoModal implements IWeb3AuthModal {
|
|
11
15
|
loginModal: LoginModal;
|
|
12
16
|
readonly options: Web3AuthOptions;
|
|
13
17
|
private modalConfig;
|
|
14
18
|
constructor(options: Web3AuthOptions);
|
|
15
|
-
|
|
16
|
-
initModal(params?: ModalConfigParams): Promise<void>;
|
|
19
|
+
initModal(): Promise<void>;
|
|
17
20
|
connect(): Promise<IProvider | null>;
|
|
21
|
+
private filterWalletRegistry;
|
|
18
22
|
private getProjectAndWalletConfig;
|
|
19
23
|
private initConnectors;
|
|
20
24
|
private filterConnectors;
|
|
@@ -1,12 +1,7 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import { type ModalConfig } from "../interface";
|
|
1
|
+
import type { IBaseWeb3AuthHookContext, IProvider } from "@web3auth/no-modal";
|
|
3
2
|
import type { Web3Auth, Web3AuthOptions } from "../modalManager";
|
|
4
3
|
export type Web3AuthContextConfig = {
|
|
5
4
|
web3AuthOptions: Web3AuthOptions;
|
|
6
|
-
modalConfig?: Record<WALLET_CONNECTOR_TYPE, ModalConfig>;
|
|
7
|
-
hideWalletDiscovery?: boolean;
|
|
8
|
-
connectors?: ConnectorFn[];
|
|
9
|
-
plugins?: PluginFn[];
|
|
10
5
|
};
|
|
11
6
|
export interface Web3AuthProviderProps {
|
|
12
7
|
config: Web3AuthContextConfig;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ExternalButton, ExternalWalletEventType } from "../../interfaces";
|
|
2
|
+
interface ExternalWalletChainNamespaceProps {
|
|
3
|
+
button: ExternalButton;
|
|
4
|
+
handleExternalWalletClick: (params: ExternalWalletEventType) => void;
|
|
5
|
+
goBack: () => void;
|
|
6
|
+
closeModal: () => void;
|
|
7
|
+
}
|
|
8
|
+
export default function ExternalWalletChainNamespace(props: ExternalWalletChainNamespaceProps): import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
export {};
|
package/dist/{types → lib.cjs/types}/ui/components/ExternalWallet/ExternalWalletDetails.d.ts
RENAMED
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import { ExternalButton } from "../../interfaces";
|
|
1
|
+
import { ExternalButton, ExternalWalletEventType } from "../../interfaces";
|
|
2
2
|
interface ExternalWalletDetailProps {
|
|
3
3
|
connectButton: ExternalButton;
|
|
4
4
|
walletConnectUri: string;
|
|
5
5
|
goBack: () => void;
|
|
6
6
|
closeModal: () => void;
|
|
7
|
+
handleExternalWalletClick: (params: ExternalWalletEventType) => void;
|
|
7
8
|
}
|
|
8
9
|
export default function ExternalWalletDetail(props: ExternalWalletDetailProps): import("react/jsx-runtime").JSX.Element;
|
|
9
10
|
export {};
|
|
@@ -1,17 +1,15 @@
|
|
|
1
1
|
import { BaseConnectorConfig, ChainNamespaceType, WalletRegistry } from "@web3auth/no-modal";
|
|
2
|
-
import { ModalStatusType } from "../interfaces";
|
|
2
|
+
import { ExternalWalletEventType, ModalStatusType } from "../interfaces";
|
|
3
3
|
interface ExternalWalletsProps {
|
|
4
4
|
hideExternalWallets: () => void;
|
|
5
|
-
handleExternalWalletClick: (params:
|
|
6
|
-
connector: string;
|
|
7
|
-
}) => void;
|
|
5
|
+
handleExternalWalletClick: (params: ExternalWalletEventType) => void;
|
|
8
6
|
closeModal: () => void;
|
|
9
7
|
config: Record<string, BaseConnectorConfig>;
|
|
10
8
|
walletConnectUri: string | undefined;
|
|
11
9
|
showBackButton: boolean;
|
|
12
10
|
modalStatus: ModalStatusType;
|
|
13
|
-
|
|
11
|
+
chainNamespaces: ChainNamespaceType[];
|
|
14
12
|
walletRegistry?: WalletRegistry;
|
|
15
13
|
}
|
|
16
|
-
export default function
|
|
14
|
+
export default function ExternalWallets(props: ExternalWalletsProps): import("react/jsx-runtime").JSX.Element;
|
|
17
15
|
export {};
|
|
@@ -5,7 +5,7 @@ interface ModalProps {
|
|
|
5
5
|
stateListener: SafeEventEmitter<StateEmitterEvents>;
|
|
6
6
|
appLogo?: string;
|
|
7
7
|
appName?: string;
|
|
8
|
-
|
|
8
|
+
chainNamespaces: ChainNamespaceType[];
|
|
9
9
|
walletRegistry?: WalletRegistry;
|
|
10
10
|
handleSocialLoginClick: (params: SocialLoginEventType) => void;
|
|
11
11
|
handleExternalWalletClick: (params: ExternalWalletEventType) => void;
|
|
@@ -1,15 +1,13 @@
|
|
|
1
|
+
import { ModalLoginParams, SocialLoginsConfig } from "../interfaces";
|
|
1
2
|
interface SocialLoginPasswordlessProps {
|
|
2
3
|
isPrimaryBtn: boolean;
|
|
3
4
|
isEmailVisible: boolean;
|
|
4
5
|
isSmsVisible: boolean;
|
|
5
6
|
connector: string;
|
|
7
|
+
socialLoginsConfig: SocialLoginsConfig;
|
|
6
8
|
handleSocialLoginClick: (params: {
|
|
7
9
|
connector: string;
|
|
8
|
-
loginParams:
|
|
9
|
-
loginProvider: string;
|
|
10
|
-
login_hint?: string;
|
|
11
|
-
name: string;
|
|
12
|
-
};
|
|
10
|
+
loginParams: ModalLoginParams;
|
|
13
11
|
}) => void;
|
|
14
12
|
}
|
|
15
13
|
export default function SocialLoginPasswordless(props: SocialLoginPasswordlessProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,13 +1,9 @@
|
|
|
1
|
-
import { SocialLoginsConfig } from "../interfaces";
|
|
1
|
+
import { ModalLoginParams, SocialLoginsConfig } from "../interfaces";
|
|
2
2
|
interface SocialLoginProps {
|
|
3
3
|
socialLoginsConfig: SocialLoginsConfig;
|
|
4
4
|
handleSocialLoginClick: (params: {
|
|
5
5
|
connector: string;
|
|
6
|
-
loginParams:
|
|
7
|
-
loginProvider: string;
|
|
8
|
-
login_hint?: string;
|
|
9
|
-
name: string;
|
|
10
|
-
};
|
|
6
|
+
loginParams: ModalLoginParams;
|
|
11
7
|
}) => void;
|
|
12
8
|
}
|
|
13
9
|
export default function SocialLogins(props: SocialLoginProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { AUTH_CONNECTION_TYPE } from "@web3auth/auth";
|
|
2
|
+
export declare function capitalizeFirstLetter(string: string): string;
|
|
3
|
+
export declare const AUTH_PROVIDERS: ("google" | "telegram" | "facebook" | "reddit" | "discord" | "twitch" | "apple" | "github" | "linkedin" | "twitter" | "weibo" | "line" | "email_passwordless" | "sms_passwordless" | "kakao" | "wechat" | "farcaster" | "custom" | "passkeys" | "authenticator")[];
|
|
4
|
+
export declare const AUTH_PROVIDERS_NAMES: Record<AUTH_CONNECTION_TYPE, string>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { SafeEventEmitter } from "@web3auth/auth";
|
|
2
|
-
import { BaseConnectorConfig, ChainNamespaceType, LoginMethodConfig, UIConfig as CoreUIConfig, WALLET_CONNECTOR_TYPE, WalletRegistry, WalletRegistryItem, Web3AuthNoModalEvents } from "@web3auth/no-modal";
|
|
2
|
+
import { type AuthLoginParams, type BaseConnectorConfig, type ChainNamespaceType, type LoginMethodConfig, type UIConfig as CoreUIConfig, type WALLET_CONNECTOR_TYPE, type WalletRegistry, type WalletRegistryItem, type Web3AuthNoModalEvents } from "@web3auth/no-modal";
|
|
3
3
|
export interface UIConfig extends CoreUIConfig {
|
|
4
4
|
/**
|
|
5
5
|
* order of how login methods are shown
|
|
@@ -34,13 +34,17 @@ export interface UIConfig extends CoreUIConfig {
|
|
|
34
34
|
primaryButton?: "externalLogin" | "socialLogin" | "emailLogin";
|
|
35
35
|
connectorListener: SafeEventEmitter<Web3AuthNoModalEvents>;
|
|
36
36
|
}
|
|
37
|
+
export type ModalLoginParams = Pick<AuthLoginParams, "authConnection" | "authConnectionId" | "groupedAuthConnectionId" | "login_hint" | "extraLoginOptions"> & {
|
|
38
|
+
name: string;
|
|
39
|
+
};
|
|
37
40
|
export interface LoginModalProps extends UIConfig {
|
|
38
|
-
|
|
41
|
+
chainNamespaces: ChainNamespaceType[];
|
|
39
42
|
walletRegistry: WalletRegistry;
|
|
40
43
|
}
|
|
41
44
|
export declare const LOGIN_MODAL_EVENTS: {
|
|
42
45
|
readonly INIT_EXTERNAL_WALLETS: "INIT_EXTERNAL_WALLETS";
|
|
43
|
-
readonly
|
|
46
|
+
readonly EXTERNAL_WALLET_LOGIN: "EXTERNAL_WALLET_LOGIN";
|
|
47
|
+
readonly SOCIAL_LOGIN: "SOCIAL_LOGIN";
|
|
44
48
|
readonly DISCONNECT: "DISCONNECT";
|
|
45
49
|
readonly MODAL_VISIBILITY: "MODAL_VISIBILITY";
|
|
46
50
|
};
|
|
@@ -74,14 +78,11 @@ export interface ModalState {
|
|
|
74
78
|
}
|
|
75
79
|
export type SocialLoginEventType = {
|
|
76
80
|
connector: string;
|
|
77
|
-
loginParams:
|
|
78
|
-
loginProvider: string;
|
|
79
|
-
login_hint?: string;
|
|
80
|
-
name: string;
|
|
81
|
-
};
|
|
81
|
+
loginParams: ModalLoginParams;
|
|
82
82
|
};
|
|
83
83
|
export type ExternalWalletEventType = {
|
|
84
84
|
connector: string;
|
|
85
|
+
chainNamespace?: ChainNamespaceType;
|
|
85
86
|
};
|
|
86
87
|
export declare const DEFAULT_LOGO_LIGHT = "https://images.web3auth.io/web3auth-logo-w.svg";
|
|
87
88
|
export declare const DEFAULT_LOGO_DARK = "https://images.web3auth.io/web3auth-logo-w-light.svg";
|
|
@@ -99,4 +100,5 @@ export type ExternalButton = {
|
|
|
99
100
|
hasInstallLinks: boolean;
|
|
100
101
|
walletRegistryItem?: WalletRegistryItem;
|
|
101
102
|
imgExtension?: string;
|
|
103
|
+
chainNamespaces?: ChainNamespaceType[];
|
|
102
104
|
};
|
|
@@ -5,7 +5,7 @@ import { LoginModalProps, UIConfig } from "./interfaces";
|
|
|
5
5
|
export declare class LoginModal extends SafeEventEmitter {
|
|
6
6
|
private uiConfig;
|
|
7
7
|
private stateEmitter;
|
|
8
|
-
private
|
|
8
|
+
private chainNamespaces;
|
|
9
9
|
private walletRegistry;
|
|
10
10
|
constructor(uiConfig: LoginModalProps);
|
|
11
11
|
get isDark(): boolean;
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
import { LANGUAGE_TYPE } from "@web3auth/auth";
|
|
2
|
-
import { LoginMethodConfig } from "@web3auth/no-modal";
|
|
3
|
-
export declare const getConnectorSocialLogins: (connectorName: string, loginMethodsConfig?: LoginMethodConfig) => LoginMethodConfig;
|
|
1
|
+
import { type LANGUAGE_TYPE } from "@web3auth/auth";
|
|
4
2
|
export declare function validateImageUrl(url: string): Promise<boolean>;
|
|
5
3
|
export declare function getNetworkIconId(ticker: string): Promise<string>;
|
|
6
4
|
export declare const passwordlessBackendUrl = "https://api-passwordless.web3auth.io";
|
|
@@ -1,14 +1,9 @@
|
|
|
1
1
|
import type { AuthUserInfo, LoginParams } from "@web3auth/auth";
|
|
2
|
-
import type { CONNECTOR_STATUS_TYPE,
|
|
2
|
+
import type { CONNECTOR_STATUS_TYPE, IPlugin, IProvider, UserAuthInfo } from "@web3auth/no-modal";
|
|
3
3
|
import { Ref, ShallowRef } from "vue";
|
|
4
|
-
import type { ModalConfig } from "../interface";
|
|
5
4
|
import type { Web3Auth, Web3AuthOptions } from "../modalManager";
|
|
6
5
|
export type Web3AuthContextConfig = {
|
|
7
6
|
web3AuthOptions: Web3AuthOptions;
|
|
8
|
-
modalConfig?: Record<WALLET_CONNECTOR_TYPE, ModalConfig>;
|
|
9
|
-
hideWalletDiscovery?: boolean;
|
|
10
|
-
connectors?: ConnectorFn[];
|
|
11
|
-
plugins?: PluginFn[];
|
|
12
7
|
};
|
|
13
8
|
export interface Web3AuthProviderProps {
|
|
14
9
|
config: Web3AuthContextConfig;
|
|
@@ -1,57 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { EVM_CONNECTORS } from '@web3auth/no-modal';
|
|
2
2
|
|
|
3
|
-
const
|
|
4
|
-
|
|
5
|
-
connectors: {
|
|
6
|
-
[SOLANA_CONNECTORS.AUTH]: {
|
|
7
|
-
label: "Auth",
|
|
8
|
-
showOnModal: true,
|
|
9
|
-
showOnMobile: true,
|
|
10
|
-
showOnDesktop: true
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
};
|
|
14
|
-
const defaultEvmDappModalConfig = {
|
|
15
|
-
chainNamespace: CHAIN_NAMESPACES.EIP155,
|
|
16
|
-
connectors: {
|
|
17
|
-
[EVM_CONNECTORS.AUTH]: {
|
|
18
|
-
label: "Auth",
|
|
19
|
-
showOnModal: true,
|
|
20
|
-
showOnMobile: true,
|
|
21
|
-
showOnDesktop: true
|
|
22
|
-
},
|
|
23
|
-
[EVM_CONNECTORS.WALLET_CONNECT_V2]: {
|
|
24
|
-
label: "Wallet Connect",
|
|
25
|
-
showOnModal: true,
|
|
26
|
-
showOnMobile: true,
|
|
27
|
-
showOnDesktop: true
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
};
|
|
31
|
-
const defaultSolanaWalletModalConfig = {
|
|
32
|
-
chainNamespace: CHAIN_NAMESPACES.SOLANA,
|
|
33
|
-
connectors: {
|
|
34
|
-
[SOLANA_CONNECTORS.AUTH]: {
|
|
35
|
-
label: "Auth",
|
|
36
|
-
showOnModal: true,
|
|
37
|
-
showOnMobile: true,
|
|
38
|
-
showOnDesktop: true
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
};
|
|
42
|
-
const defaultEvmWalletModalConfig = {
|
|
43
|
-
chainNamespace: CHAIN_NAMESPACES.EIP155,
|
|
44
|
-
connectors: {
|
|
45
|
-
[EVM_CONNECTORS.AUTH]: {
|
|
46
|
-
label: "Auth",
|
|
47
|
-
showOnModal: true,
|
|
48
|
-
showOnMobile: true,
|
|
49
|
-
showOnDesktop: true
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
};
|
|
53
|
-
const defaultOtherModalConfig = {
|
|
54
|
-
chainNamespace: CHAIN_NAMESPACES.OTHER,
|
|
3
|
+
const defaultConnectorsModalConfig = {
|
|
4
|
+
hideWalletDiscovery: false,
|
|
55
5
|
connectors: {
|
|
56
6
|
[EVM_CONNECTORS.AUTH]: {
|
|
57
7
|
label: "Auth",
|
|
@@ -63,4 +13,4 @@ const defaultOtherModalConfig = {
|
|
|
63
13
|
};
|
|
64
14
|
const walletRegistryUrl = "https://assets.web3auth.io/v1/wallet-registry.json";
|
|
65
15
|
|
|
66
|
-
export {
|
|
16
|
+
export { defaultConnectorsModalConfig, walletRegistryUrl };
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { defaultConnectorsModalConfig, walletRegistryUrl } from './config.js';
|
|
2
2
|
export { Web3Auth } from './modalManager.js';
|
|
3
3
|
export * from '@web3auth/no-modal';
|