@web3auth/modal 9.6.0 → 10.0.0-alpha.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/node_modules/style-inject/dist/style-inject.es.js +28 -0
- package/dist/lib.cjs/{config.js → packages/modal/src/config.js} +14 -14
- package/dist/lib.cjs/{index.js → packages/modal/src/index.js} +7 -0
- package/dist/lib.cjs/{modalManager.js → packages/modal/src/modalManager.js} +92 -92
- package/dist/lib.cjs/packages/modal/src/react/Web3AuthProvider.js +15 -0
- package/dist/lib.cjs/packages/modal/src/react/context/Web3AuthInnerContext.js +225 -0
- package/dist/lib.cjs/packages/modal/src/react/hooks/useWeb3Auth.js +15 -0
- package/dist/lib.cjs/packages/modal/src/react/index.js +12 -0
- package/dist/lib.cjs/packages/modal/src/ui/assets/arrow-left-dark.svg.js +7 -0
- package/dist/lib.cjs/packages/modal/src/ui/assets/arrow-left-light.svg.js +7 -0
- package/dist/lib.cjs/packages/modal/src/ui/assets/x-dark.svg.js +7 -0
- package/dist/lib.cjs/packages/modal/src/ui/assets/x-light.svg.js +7 -0
- package/dist/lib.cjs/packages/modal/src/ui/components/AdapterLoader.js +108 -0
- package/dist/lib.cjs/packages/modal/src/ui/components/Button/Button.js +34 -0
- package/dist/lib.cjs/packages/modal/src/ui/components/Button/styles.css.js +8 -0
- package/dist/lib.cjs/packages/modal/src/ui/components/ExternalWallet/ExternalWalletButton.js +44 -0
- package/dist/lib.cjs/packages/modal/src/ui/components/ExternalWallet/ExternalWalletConnect.js +67 -0
- package/dist/lib.cjs/packages/modal/src/ui/components/ExternalWallet/ExternalWalletDetails.js +34 -0
- package/dist/lib.cjs/packages/modal/src/ui/components/ExternalWallet/ExternalWalletHeader.js +46 -0
- package/dist/lib.cjs/packages/modal/src/ui/components/ExternalWallet/ExternalWalletInstall.js +167 -0
- package/dist/lib.cjs/packages/modal/src/ui/components/ExternalWallets.js +273 -0
- package/dist/lib.cjs/packages/modal/src/ui/components/Footer.js +20 -0
- package/dist/lib.cjs/packages/modal/src/ui/components/Header.js +81 -0
- package/dist/lib.cjs/packages/modal/src/ui/components/Icon.js +73 -0
- package/dist/lib.cjs/packages/modal/src/ui/components/Image.js +51 -0
- package/dist/lib.cjs/packages/modal/src/ui/components/Loader.js +59 -0
- package/dist/lib.cjs/packages/modal/src/ui/components/Modal.js +244 -0
- package/dist/lib.cjs/packages/modal/src/ui/components/SelfCustodyViaWeb3Auth.js +30 -0
- package/dist/lib.cjs/packages/modal/src/ui/components/SocialLoginPasswordless.js +141 -0
- package/dist/lib.cjs/packages/modal/src/ui/components/SocialLogins.js +148 -0
- package/dist/lib.cjs/packages/modal/src/ui/components/WalletConnect.js +84 -0
- package/dist/lib.cjs/packages/modal/src/ui/config.js +17 -0
- package/dist/lib.cjs/packages/modal/src/ui/context/ThemeContext.js +9 -0
- package/dist/lib.cjs/packages/modal/src/ui/css/web3auth.css.js +8 -0
- package/dist/lib.cjs/packages/modal/src/ui/i18n/dutch.json.js +84 -0
- package/dist/lib.cjs/packages/modal/src/ui/i18n/english.json.js +84 -0
- package/dist/lib.cjs/packages/modal/src/ui/i18n/french.json.js +82 -0
- package/dist/lib.cjs/packages/modal/src/ui/i18n/german.json.js +84 -0
- package/dist/lib.cjs/packages/modal/src/ui/i18n/japanese.json.js +84 -0
- package/dist/lib.cjs/packages/modal/src/ui/i18n/korean.json.js +84 -0
- package/dist/lib.cjs/packages/modal/src/ui/i18n/mandarin.json.js +84 -0
- package/dist/lib.cjs/packages/modal/src/ui/i18n/portuguese.json.js +84 -0
- package/dist/lib.cjs/packages/modal/src/ui/i18n/spanish.json.js +84 -0
- package/dist/lib.cjs/packages/modal/src/ui/i18n/turkish.json.js +84 -0
- package/dist/lib.cjs/packages/modal/src/ui/interfaces.js +26 -0
- package/dist/lib.cjs/packages/modal/src/ui/localeImport.js +25 -0
- package/dist/lib.cjs/packages/modal/src/ui/loginModal.js +309 -0
- package/dist/lib.cjs/packages/modal/src/ui/utils.js +71 -0
- package/dist/lib.cjs/packages/modal/src/vue/Web3AuthProvider.js +234 -0
- package/dist/lib.cjs/packages/modal/src/vue/composables/useWeb3Auth.js +12 -0
- package/dist/lib.cjs/packages/modal/src/vue/index.js +9 -0
- package/dist/lib.esm/node_modules/style-inject/dist/style-inject.es.js +26 -0
- package/dist/lib.esm/{config.js → packages/modal/src/config.js} +1 -1
- package/dist/lib.esm/{index.js → packages/modal/src/index.js} +1 -0
- package/dist/lib.esm/{modalManager.js → packages/modal/src/modalManager.js} +5 -5
- package/dist/lib.esm/packages/modal/src/react/Web3AuthProvider.js +13 -0
- package/dist/lib.esm/packages/modal/src/react/context/Web3AuthInnerContext.js +222 -0
- package/dist/lib.esm/packages/modal/src/react/hooks/useWeb3Auth.js +13 -0
- package/dist/lib.esm/packages/modal/src/react/index.js +3 -0
- package/dist/lib.esm/packages/modal/src/ui/assets/arrow-left-dark.svg.js +5 -0
- package/dist/lib.esm/packages/modal/src/ui/assets/arrow-left-light.svg.js +5 -0
- package/dist/lib.esm/packages/modal/src/ui/assets/x-dark.svg.js +5 -0
- package/dist/lib.esm/packages/modal/src/ui/assets/x-light.svg.js +5 -0
- package/dist/lib.esm/packages/modal/src/ui/components/AdapterLoader.js +106 -0
- package/dist/lib.esm/packages/modal/src/ui/components/Button/Button.js +32 -0
- package/dist/lib.esm/packages/modal/src/ui/components/Button/styles.css.js +6 -0
- package/dist/lib.esm/packages/modal/src/ui/components/ExternalWallet/ExternalWalletButton.js +42 -0
- package/dist/lib.esm/packages/modal/src/ui/components/ExternalWallet/ExternalWalletConnect.js +65 -0
- package/dist/lib.esm/packages/modal/src/ui/components/ExternalWallet/ExternalWalletDetails.js +32 -0
- package/dist/lib.esm/packages/modal/src/ui/components/ExternalWallet/ExternalWalletHeader.js +44 -0
- package/dist/lib.esm/packages/modal/src/ui/components/ExternalWallet/ExternalWalletInstall.js +165 -0
- package/dist/lib.esm/packages/modal/src/ui/components/ExternalWallets.js +271 -0
- package/dist/lib.esm/packages/modal/src/ui/components/Footer.js +18 -0
- package/dist/lib.esm/packages/modal/src/ui/components/Header.js +79 -0
- package/dist/lib.esm/packages/modal/src/ui/components/Icon.js +71 -0
- package/dist/lib.esm/packages/modal/src/ui/components/Image.js +49 -0
- package/dist/lib.esm/packages/modal/src/ui/components/Loader.js +57 -0
- package/dist/lib.esm/packages/modal/src/ui/components/Modal.js +242 -0
- package/dist/lib.esm/packages/modal/src/ui/components/SelfCustodyViaWeb3Auth.js +28 -0
- package/dist/lib.esm/packages/modal/src/ui/components/SocialLoginPasswordless.js +139 -0
- package/dist/lib.esm/packages/modal/src/ui/components/SocialLogins.js +146 -0
- package/dist/lib.esm/packages/modal/src/ui/components/WalletConnect.js +82 -0
- package/dist/lib.esm/packages/modal/src/ui/config.js +13 -0
- package/dist/lib.esm/packages/modal/src/ui/context/ThemeContext.js +7 -0
- package/dist/lib.esm/packages/modal/src/ui/css/web3auth.css.js +6 -0
- package/dist/lib.esm/packages/modal/src/ui/i18n/dutch.json.js +79 -0
- package/dist/lib.esm/packages/modal/src/ui/i18n/english.json.js +79 -0
- package/dist/lib.esm/packages/modal/src/ui/i18n/french.json.js +77 -0
- package/dist/lib.esm/packages/modal/src/ui/i18n/german.json.js +79 -0
- package/dist/lib.esm/packages/modal/src/ui/i18n/japanese.json.js +79 -0
- package/dist/lib.esm/packages/modal/src/ui/i18n/korean.json.js +79 -0
- package/dist/lib.esm/packages/modal/src/ui/i18n/mandarin.json.js +79 -0
- package/dist/lib.esm/packages/modal/src/ui/i18n/portuguese.json.js +79 -0
- package/dist/lib.esm/packages/modal/src/ui/i18n/spanish.json.js +79 -0
- package/dist/lib.esm/packages/modal/src/ui/i18n/turkish.json.js +79 -0
- package/dist/lib.esm/packages/modal/src/ui/interfaces.js +20 -0
- package/dist/lib.esm/packages/modal/src/ui/localeImport.js +23 -0
- package/dist/lib.esm/packages/modal/src/ui/loginModal.js +307 -0
- package/dist/lib.esm/packages/modal/src/ui/utils.js +65 -0
- package/dist/lib.esm/packages/modal/src/vue/Web3AuthProvider.js +232 -0
- package/dist/lib.esm/packages/modal/src/vue/composables/useWeb3Auth.js +10 -0
- package/dist/lib.esm/packages/modal/src/vue/index.js +2 -0
- package/dist/modal.cjs.js +5703 -420
- package/dist/modal.umd.min.js +1 -1
- package/dist/modal.umd.min.js.LICENSE.txt +54 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/interface.d.ts +1 -1
- package/dist/types/modalManager.d.ts +2 -3
- package/dist/types/react/Web3AuthProvider.d.ts +3 -0
- package/dist/types/react/context/Web3AuthInnerContext.d.ts +4 -0
- package/dist/types/react/context/index.d.ts +1 -0
- package/dist/types/react/hooks/index.d.ts +1 -0
- package/dist/types/react/hooks/useWeb3Auth.d.ts +2 -0
- package/dist/types/react/index.d.ts +4 -0
- package/dist/types/react/interfaces.d.ts +18 -0
- package/dist/types/ui/components/AdapterLoader.d.ts +11 -0
- package/dist/types/ui/components/Button/Button.d.ts +16 -0
- package/dist/types/ui/components/Button/index.d.ts +1 -0
- package/dist/types/ui/components/ExternalWallet/ExternalWalletButton.d.ts +7 -0
- package/dist/types/ui/components/ExternalWallet/ExternalWalletConnect.d.ts +9 -0
- package/dist/types/ui/components/ExternalWallet/ExternalWalletDetails.d.ts +9 -0
- package/dist/types/ui/components/ExternalWallet/ExternalWalletHeader.d.ts +8 -0
- package/dist/types/ui/components/ExternalWallet/ExternalWalletInstall.d.ts +8 -0
- package/dist/types/ui/components/ExternalWallets.d.ts +17 -0
- package/dist/types/ui/components/Footer.d.ts +1 -0
- package/dist/types/ui/components/Header.d.ts +8 -0
- package/dist/types/ui/components/Icon.d.ts +9 -0
- package/dist/types/ui/components/Image.d.ts +12 -0
- package/dist/types/ui/components/Loader.d.ts +10 -0
- package/dist/types/ui/components/Modal.d.ts +16 -0
- package/dist/types/ui/components/SelfCustodyViaWeb3Auth.d.ts +1 -0
- package/dist/types/ui/components/SocialLoginPasswordless.d.ts +16 -0
- package/dist/types/ui/components/SocialLogins.d.ts +14 -0
- package/dist/types/ui/components/WalletConnect.d.ts +8 -0
- package/dist/types/ui/config.d.ts +4 -0
- package/dist/types/ui/context/ThemeContext.d.ts +3 -0
- package/dist/types/ui/helper/countryData.d.ts +7 -0
- package/dist/types/ui/i18n/index.d.ts +11 -0
- package/dist/types/ui/index.d.ts +4 -0
- package/dist/types/ui/interfaces.d.ts +106 -0
- package/dist/types/ui/localeImport.d.ts +3 -0
- package/dist/types/ui/loginModal.d.ts +27 -0
- package/dist/types/ui/utils.d.ts +12 -0
- package/dist/types/vue/Web3AuthProvider.d.ts +13 -0
- package/dist/types/vue/composables/index.d.ts +1 -0
- package/dist/types/vue/composables/useWeb3Auth.d.ts +2 -0
- package/dist/types/vue/index.d.ts +3 -0
- package/dist/types/vue/interfaces.d.ts +45 -0
- package/package.json +100 -43
- package/dist/modal.esm.js +0 -513
|
@@ -0,0 +1,225 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var noModal = require('@web3auth/no-modal');
|
|
4
|
+
var React = require('react');
|
|
5
|
+
var modalManager = require('../../modalManager.js');
|
|
6
|
+
|
|
7
|
+
const Web3AuthInnerContext = /*#__PURE__*/React.createContext(null);
|
|
8
|
+
function Web3AuthInnerProvider(params) {
|
|
9
|
+
const {
|
|
10
|
+
children,
|
|
11
|
+
config
|
|
12
|
+
} = params;
|
|
13
|
+
const [web3Auth, setWeb3Auth] = React.useState(null);
|
|
14
|
+
const [isConnecting, setIsConnecting] = React.useState(false);
|
|
15
|
+
const [isInitializing, setIsInitializing] = React.useState(false);
|
|
16
|
+
const [initError, setInitError] = React.useState(null);
|
|
17
|
+
const [connectError, setConnectError] = React.useState(null);
|
|
18
|
+
const [isConnected, setIsConnected] = React.useState(false);
|
|
19
|
+
const [provider, setProvider] = React.useState(null);
|
|
20
|
+
const [userInfo, setUserInfo] = React.useState(null);
|
|
21
|
+
const [isMFAEnabled, setIsMFAEnabled] = React.useState(false);
|
|
22
|
+
const [isInitialized, setIsInitialized] = React.useState(false);
|
|
23
|
+
const [status, setStatus] = React.useState(null);
|
|
24
|
+
const addPlugin = React.useCallback(plugin => {
|
|
25
|
+
if (!web3Auth) throw noModal.WalletInitializationError.notReady();
|
|
26
|
+
return web3Auth.addPlugin(plugin);
|
|
27
|
+
}, [web3Auth]);
|
|
28
|
+
const getPlugin = React.useCallback(name => {
|
|
29
|
+
if (!web3Auth) throw noModal.WalletInitializationError.notReady();
|
|
30
|
+
return web3Auth.getPlugin(name);
|
|
31
|
+
}, [web3Auth]);
|
|
32
|
+
const enableMFA = React.useCallback(async loginParams => {
|
|
33
|
+
if (!web3Auth) throw noModal.WalletInitializationError.notReady();
|
|
34
|
+
if (!isConnected) throw noModal.WalletLoginError.notConnectedError();
|
|
35
|
+
await web3Auth.enableMFA(loginParams);
|
|
36
|
+
const localUserInfo = await web3Auth.getUserInfo();
|
|
37
|
+
setUserInfo(localUserInfo);
|
|
38
|
+
setIsMFAEnabled(localUserInfo.isMfaEnabled || false);
|
|
39
|
+
}, [web3Auth, isConnected]);
|
|
40
|
+
const manageMFA = React.useCallback(async loginParams => {
|
|
41
|
+
if (!web3Auth) throw noModal.WalletInitializationError.notReady();
|
|
42
|
+
if (!isConnected) throw noModal.WalletLoginError.notConnectedError();
|
|
43
|
+
await web3Auth.manageMFA(loginParams);
|
|
44
|
+
}, [web3Auth, isConnected]);
|
|
45
|
+
const logout = React.useCallback(async (logoutParams = {
|
|
46
|
+
cleanup: false
|
|
47
|
+
}) => {
|
|
48
|
+
if (!web3Auth) throw noModal.WalletInitializationError.notReady();
|
|
49
|
+
if (!isConnected) throw noModal.WalletLoginError.notConnectedError();
|
|
50
|
+
await web3Auth.logout(logoutParams);
|
|
51
|
+
}, [web3Auth, isConnected]);
|
|
52
|
+
const connect = React.useCallback(async () => {
|
|
53
|
+
if (!web3Auth) throw noModal.WalletInitializationError.notReady();
|
|
54
|
+
try {
|
|
55
|
+
setConnectError(null);
|
|
56
|
+
setIsConnecting(true);
|
|
57
|
+
const localProvider = await web3Auth.connect();
|
|
58
|
+
return localProvider;
|
|
59
|
+
} catch (error) {
|
|
60
|
+
setConnectError(error);
|
|
61
|
+
throw error;
|
|
62
|
+
} finally {
|
|
63
|
+
setIsConnecting(false);
|
|
64
|
+
}
|
|
65
|
+
}, [web3Auth]);
|
|
66
|
+
const addAndSwitchChain = React.useCallback(async chainConfig => {
|
|
67
|
+
if (!web3Auth) throw noModal.WalletInitializationError.notReady();
|
|
68
|
+
await web3Auth.addChain(chainConfig);
|
|
69
|
+
await web3Auth.switchChain({
|
|
70
|
+
chainId: chainConfig.chainId
|
|
71
|
+
});
|
|
72
|
+
}, [web3Auth]);
|
|
73
|
+
const authenticateUser = React.useCallback(async () => {
|
|
74
|
+
if (!web3Auth) throw noModal.WalletInitializationError.notReady();
|
|
75
|
+
return web3Auth.authenticateUser();
|
|
76
|
+
}, [web3Auth]);
|
|
77
|
+
const addChain = React.useCallback(async chainConfig => {
|
|
78
|
+
if (!web3Auth) throw noModal.WalletInitializationError.notReady();
|
|
79
|
+
return web3Auth.addChain(chainConfig);
|
|
80
|
+
}, [web3Auth]);
|
|
81
|
+
const switchChain = React.useCallback(chainParams => {
|
|
82
|
+
if (!web3Auth) throw noModal.WalletInitializationError.notReady();
|
|
83
|
+
return web3Auth.switchChain(chainParams);
|
|
84
|
+
}, [web3Auth]);
|
|
85
|
+
React.useEffect(() => {
|
|
86
|
+
const resetHookState = () => {
|
|
87
|
+
setProvider(null);
|
|
88
|
+
setUserInfo(null);
|
|
89
|
+
setIsMFAEnabled(false);
|
|
90
|
+
setIsConnected(false);
|
|
91
|
+
setStatus(null);
|
|
92
|
+
};
|
|
93
|
+
resetHookState();
|
|
94
|
+
const {
|
|
95
|
+
web3AuthOptions,
|
|
96
|
+
adapters = [],
|
|
97
|
+
plugins = []
|
|
98
|
+
} = config;
|
|
99
|
+
const web3AuthInstance = new modalManager.Web3Auth(web3AuthOptions);
|
|
100
|
+
if (adapters.length) adapters.map(adapter => web3AuthInstance.configureAdapter(adapter));
|
|
101
|
+
if (plugins.length) {
|
|
102
|
+
plugins.forEach(plugin => {
|
|
103
|
+
web3AuthInstance.addPlugin(plugin);
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
setWeb3Auth(web3AuthInstance);
|
|
107
|
+
}, [config]);
|
|
108
|
+
React.useEffect(() => {
|
|
109
|
+
async function init() {
|
|
110
|
+
try {
|
|
111
|
+
setInitError(null);
|
|
112
|
+
setIsInitializing(true);
|
|
113
|
+
const {
|
|
114
|
+
modalConfig,
|
|
115
|
+
hideWalletDiscovery
|
|
116
|
+
} = config;
|
|
117
|
+
if (modalConfig) {
|
|
118
|
+
await web3Auth.initModal({
|
|
119
|
+
modalConfig,
|
|
120
|
+
hideWalletDiscovery
|
|
121
|
+
});
|
|
122
|
+
} else {
|
|
123
|
+
await web3Auth.initModal();
|
|
124
|
+
}
|
|
125
|
+
} catch (error) {
|
|
126
|
+
setInitError(error);
|
|
127
|
+
} finally {
|
|
128
|
+
setIsInitializing(false);
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
if (web3Auth) init();
|
|
132
|
+
}, [web3Auth, config]);
|
|
133
|
+
React.useEffect(() => {
|
|
134
|
+
const addState = async () => {
|
|
135
|
+
setProvider(web3Auth.provider);
|
|
136
|
+
const userState = await web3Auth.getUserInfo();
|
|
137
|
+
setUserInfo(userState);
|
|
138
|
+
setIsMFAEnabled((userState === null || userState === void 0 ? void 0 : userState.isMfaEnabled) || false);
|
|
139
|
+
};
|
|
140
|
+
const resetState = () => {
|
|
141
|
+
setProvider(null);
|
|
142
|
+
setUserInfo(null);
|
|
143
|
+
setIsMFAEnabled(false);
|
|
144
|
+
};
|
|
145
|
+
if (web3Auth) {
|
|
146
|
+
if (isConnected) addState();else resetState();
|
|
147
|
+
}
|
|
148
|
+
}, [web3Auth, isConnected]);
|
|
149
|
+
React.useEffect(() => {
|
|
150
|
+
const notReadyListener = () => setStatus(web3Auth.status);
|
|
151
|
+
const readyListener = () => {
|
|
152
|
+
setStatus(web3Auth.status);
|
|
153
|
+
setIsInitialized(true);
|
|
154
|
+
};
|
|
155
|
+
const connectedListener = () => {
|
|
156
|
+
setStatus(web3Auth.status);
|
|
157
|
+
// we do this because of rehydration issues. status connected is fired first but web3auth sdk is not ready yet.
|
|
158
|
+
if (web3Auth.status === noModal.ADAPTER_STATUS.CONNECTED) {
|
|
159
|
+
setIsInitialized(true);
|
|
160
|
+
setIsConnected(true);
|
|
161
|
+
}
|
|
162
|
+
};
|
|
163
|
+
const disconnectedListener = () => {
|
|
164
|
+
setStatus(web3Auth.status);
|
|
165
|
+
setIsConnected(false);
|
|
166
|
+
};
|
|
167
|
+
const connectingListener = () => {
|
|
168
|
+
setStatus(web3Auth.status);
|
|
169
|
+
};
|
|
170
|
+
const errorListener = () => {
|
|
171
|
+
setStatus(noModal.ADAPTER_STATUS.ERRORED);
|
|
172
|
+
};
|
|
173
|
+
if (web3Auth) {
|
|
174
|
+
// web3Auth is initialized here.
|
|
175
|
+
setStatus(web3Auth.status);
|
|
176
|
+
web3Auth.on(noModal.ADAPTER_EVENTS.NOT_READY, notReadyListener);
|
|
177
|
+
web3Auth.on(noModal.ADAPTER_EVENTS.READY, readyListener);
|
|
178
|
+
web3Auth.on(noModal.ADAPTER_EVENTS.CONNECTED, connectedListener);
|
|
179
|
+
web3Auth.on(noModal.ADAPTER_EVENTS.DISCONNECTED, disconnectedListener);
|
|
180
|
+
web3Auth.on(noModal.ADAPTER_EVENTS.CONNECTING, connectingListener);
|
|
181
|
+
web3Auth.on(noModal.ADAPTER_EVENTS.ERRORED, errorListener);
|
|
182
|
+
}
|
|
183
|
+
return () => {
|
|
184
|
+
if (web3Auth) {
|
|
185
|
+
web3Auth.off(noModal.ADAPTER_EVENTS.NOT_READY, notReadyListener);
|
|
186
|
+
web3Auth.off(noModal.ADAPTER_EVENTS.READY, readyListener);
|
|
187
|
+
web3Auth.off(noModal.ADAPTER_EVENTS.CONNECTED, connectedListener);
|
|
188
|
+
web3Auth.off(noModal.ADAPTER_EVENTS.DISCONNECTED, disconnectedListener);
|
|
189
|
+
web3Auth.off(noModal.ADAPTER_EVENTS.CONNECTING, connectingListener);
|
|
190
|
+
web3Auth.off(noModal.ADAPTER_EVENTS.ERRORED, errorListener);
|
|
191
|
+
}
|
|
192
|
+
};
|
|
193
|
+
}, [web3Auth]);
|
|
194
|
+
const value = React.useMemo(() => {
|
|
195
|
+
return {
|
|
196
|
+
web3Auth,
|
|
197
|
+
isConnected,
|
|
198
|
+
isInitialized,
|
|
199
|
+
provider,
|
|
200
|
+
userInfo,
|
|
201
|
+
isMFAEnabled,
|
|
202
|
+
status,
|
|
203
|
+
connect,
|
|
204
|
+
enableMFA,
|
|
205
|
+
manageMFA,
|
|
206
|
+
logout,
|
|
207
|
+
addAndSwitchChain,
|
|
208
|
+
addChain,
|
|
209
|
+
addPlugin,
|
|
210
|
+
authenticateUser,
|
|
211
|
+
switchChain,
|
|
212
|
+
getPlugin,
|
|
213
|
+
isInitializing,
|
|
214
|
+
isConnecting,
|
|
215
|
+
initError,
|
|
216
|
+
connectError
|
|
217
|
+
};
|
|
218
|
+
}, [web3Auth, isConnected, isInitialized, provider, userInfo, isMFAEnabled, status, getPlugin, connect, enableMFA, manageMFA, logout, addAndSwitchChain, addChain, addPlugin, authenticateUser, switchChain, isInitializing, isConnecting, initError, connectError]);
|
|
219
|
+
return /*#__PURE__*/React.createElement(Web3AuthInnerContext.Provider, {
|
|
220
|
+
value
|
|
221
|
+
}, children);
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
exports.Web3AuthInnerContext = Web3AuthInnerContext;
|
|
225
|
+
exports.Web3AuthInnerProvider = Web3AuthInnerProvider;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var noModal = require('@web3auth/no-modal');
|
|
4
|
+
var React = require('react');
|
|
5
|
+
var Web3AuthInnerContext = require('../context/Web3AuthInnerContext.js');
|
|
6
|
+
|
|
7
|
+
const useWeb3Auth = () => {
|
|
8
|
+
const context = React.useContext(Web3AuthInnerContext.Web3AuthInnerContext);
|
|
9
|
+
if (!context) {
|
|
10
|
+
throw noModal.WalletInitializationError.fromCode(1000, "usage of useWeb3Auth not wrapped in `Web3AuthContextProvider`.");
|
|
11
|
+
}
|
|
12
|
+
return context;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
exports.useWeb3Auth = useWeb3Auth;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var Web3AuthInnerContext = require('./context/Web3AuthInnerContext.js');
|
|
4
|
+
var useWeb3Auth = require('./hooks/useWeb3Auth.js');
|
|
5
|
+
var Web3AuthProvider = require('./Web3AuthProvider.js');
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
exports.Web3AuthInnerContext = Web3AuthInnerContext.Web3AuthInnerContext;
|
|
10
|
+
exports.Web3AuthInnerProvider = Web3AuthInnerContext.Web3AuthInnerProvider;
|
|
11
|
+
exports.useWeb3Auth = useWeb3Auth.useWeb3Auth;
|
|
12
|
+
exports.Web3AuthProvider = Web3AuthProvider.Web3AuthProvider;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
require('react');
|
|
4
|
+
|
|
5
|
+
var ArrowDark = "data:image/svg+xml,%3Csvg%20width%3D%2220%22%20height%3D%2220%22%20viewBox%3D%220%200%2020%2020%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cpath%20d%3D%22M8.33333%2015.8333L2.5%209.99992M2.5%209.99992L8.33333%204.16659M2.5%209.99992L17.5%209.99992%22%20stroke%3D%22%239CA3AF%22%20stroke-width%3D%222%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%2F%3E%3C%2Fsvg%3E";
|
|
6
|
+
|
|
7
|
+
module.exports = ArrowDark;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
require('react');
|
|
4
|
+
|
|
5
|
+
var ArrowLight = "data:image/svg+xml,%3Csvg%20width%3D%2220%22%20height%3D%2220%22%20viewBox%3D%220%200%2020%2020%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cpath%20d%3D%22M8.33333%2015.8333L2.5%209.99995M2.5%209.99995L8.33333%204.16662M2.5%209.99995L17.5%209.99995%22%20stroke%3D%22%236B7280%22%20stroke-width%3D%222%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%2F%3E%3C%2Fsvg%3E";
|
|
6
|
+
|
|
7
|
+
module.exports = ArrowLight;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
require('react');
|
|
4
|
+
|
|
5
|
+
var XDark = "data:image/svg+xml,%3Csvg%20width%3D%2213%22%20height%3D%2213%22%20viewBox%3D%220%200%2013%2013%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cpath%20fill-rule%3D%22evenodd%22%20clip-rule%3D%22evenodd%22%20d%3D%22M0.292787%201.29299C0.480314%201.10552%200.734622%201.0002%200.999786%201.0002C1.26495%201.0002%201.51926%201.10552%201.70679%201.29299L5.99979%205.58599L10.2928%201.29299C10.385%201.19748%2010.4954%201.1213%2010.6174%201.06889C10.7394%201.01648%2010.8706%200.988893%2011.0034%200.987739C11.1362%200.986585%2011.2678%201.01189%2011.3907%201.06217C11.5136%201.11245%2011.6253%201.1867%2011.7192%201.28059C11.8131%201.37449%2011.8873%201.48614%2011.9376%201.60904C11.9879%201.73193%2012.0132%201.86361%2012.012%201.99639C12.0109%202.12917%2011.9833%202.26039%2011.9309%202.38239C11.8785%202.5044%2011.8023%202.61474%2011.7068%202.70699L7.41379%206.99999L11.7068%2011.293C11.8889%2011.4816%2011.9897%2011.7342%2011.9875%2011.9964C11.9852%2012.2586%2011.88%2012.5094%2011.6946%2012.6948C11.5092%2012.8802%2011.2584%2012.9854%2010.9962%2012.9877C10.734%2012.9899%2010.4814%2012.8891%2010.2928%2012.707L5.99979%208.41399L1.70679%2012.707C1.51818%2012.8891%201.26558%2012.9899%201.00339%2012.9877C0.741188%2012.9854%200.490376%2012.8802%200.304968%2012.6948C0.11956%2012.5094%200.0143906%2012.2586%200.0121121%2011.9964C0.00983372%2011.7342%200.110629%2011.4816%200.292787%2011.293L4.58579%206.99999L0.292787%202.70699C0.105316%202.51946%200%202.26515%200%201.99999C0%201.73483%200.105316%201.48052%200.292787%201.29299V1.29299Z%22%20fill%3D%22%239CA3AF%22%2F%3E%3C%2Fsvg%3E";
|
|
6
|
+
|
|
7
|
+
module.exports = XDark;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
require('react');
|
|
4
|
+
|
|
5
|
+
var XLight = "data:image/svg+xml,%3Csvg%20width%3D%2213%22%20height%3D%2213%22%20viewBox%3D%220%200%2013%2013%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cpath%20fill-rule%3D%22evenodd%22%20clip-rule%3D%22evenodd%22%20d%3D%22M0.292787%201.29299C0.480314%201.10552%200.734622%201.0002%200.999786%201.0002C1.26495%201.0002%201.51926%201.10552%201.70679%201.29299L5.99979%205.58599L10.2928%201.29299C10.385%201.19748%2010.4954%201.1213%2010.6174%201.06889C10.7394%201.01648%2010.8706%200.988893%2011.0034%200.987739C11.1362%200.986585%2011.2678%201.01189%2011.3907%201.06217C11.5136%201.11245%2011.6253%201.1867%2011.7192%201.28059C11.8131%201.37449%2011.8873%201.48614%2011.9376%201.60904C11.9879%201.73193%2012.0132%201.86361%2012.012%201.99639C12.0109%202.12917%2011.9833%202.26039%2011.9309%202.38239C11.8785%202.5044%2011.8023%202.61474%2011.7068%202.70699L7.41379%206.99999L11.7068%2011.293C11.8889%2011.4816%2011.9897%2011.7342%2011.9875%2011.9964C11.9852%2012.2586%2011.88%2012.5094%2011.6946%2012.6948C11.5092%2012.8802%2011.2584%2012.9854%2010.9962%2012.9877C10.734%2012.9899%2010.4814%2012.8891%2010.2928%2012.707L5.99979%208.41399L1.70679%2012.707C1.51818%2012.8891%201.26558%2012.9899%201.00339%2012.9877C0.741188%2012.9854%200.490376%2012.8802%200.304968%2012.6948C0.11956%2012.5094%200.0143906%2012.2586%200.0121121%2011.9964C0.00983372%2011.7342%200.110629%2011.4816%200.292787%2011.293L4.58579%206.99999L0.292787%202.70699C0.105316%202.51946%200%202.26515%200%201.99999C0%201.73483%200.105316%201.48052%200.292787%201.29299V1.29299Z%22%20fill%3D%22%236B7280%22%2F%3E%3C%2Fsvg%3E";
|
|
6
|
+
|
|
7
|
+
module.exports = XLight;
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var noModal = require('@web3auth/no-modal');
|
|
4
|
+
var React = require('react');
|
|
5
|
+
var reactI18next = require('react-i18next');
|
|
6
|
+
var interfaces = require('../interfaces.js');
|
|
7
|
+
var localeImport = require('../localeImport.js');
|
|
8
|
+
var Icon = require('./Icon.js');
|
|
9
|
+
var Image = require('./Image.js');
|
|
10
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
11
|
+
|
|
12
|
+
const closeIcon = /*#__PURE__*/jsxRuntime.jsx(Icon, {
|
|
13
|
+
iconName: "x-light",
|
|
14
|
+
darkIconName: "close"
|
|
15
|
+
});
|
|
16
|
+
function DetailedLoader(props) {
|
|
17
|
+
const {
|
|
18
|
+
adapter,
|
|
19
|
+
appLogo,
|
|
20
|
+
message,
|
|
21
|
+
modalStatus,
|
|
22
|
+
adapterName,
|
|
23
|
+
onClose
|
|
24
|
+
} = props;
|
|
25
|
+
const providerIcon = adapter === "twitter" ? /*#__PURE__*/jsxRuntime.jsx(Image, {
|
|
26
|
+
imageId: "login-x-dark"
|
|
27
|
+
}) : /*#__PURE__*/jsxRuntime.jsx(Image, {
|
|
28
|
+
imageId: `login-${adapter}`,
|
|
29
|
+
height: "30",
|
|
30
|
+
width: "30"
|
|
31
|
+
});
|
|
32
|
+
const [t] = reactI18next.useTranslation(undefined, {
|
|
33
|
+
i18n: localeImport
|
|
34
|
+
});
|
|
35
|
+
React.useEffect(() => {
|
|
36
|
+
noModal.log.debug("adapter loader re-rendering");
|
|
37
|
+
if (modalStatus === interfaces.MODAL_STATUS.CONNECTED) {
|
|
38
|
+
setTimeout(() => {
|
|
39
|
+
onClose();
|
|
40
|
+
}, 3000);
|
|
41
|
+
}
|
|
42
|
+
}, [modalStatus, onClose]);
|
|
43
|
+
return modalStatus !== interfaces.MODAL_STATUS.INITIALIZED ? /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
44
|
+
className: "w3ajs-modal-loader w3a-modal__loader w3a--h-full",
|
|
45
|
+
children: [/*#__PURE__*/jsxRuntime.jsx("div", {
|
|
46
|
+
className: "w3a-modal__loader-content",
|
|
47
|
+
children: /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
48
|
+
className: "w3a-modal__loader-info",
|
|
49
|
+
children: [modalStatus === interfaces.MODAL_STATUS.CONNECTING && /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
50
|
+
children: [/*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
51
|
+
className: "w3a-modal__loader-bridge",
|
|
52
|
+
children: [/*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
53
|
+
className: "w3a-modal__loader-app-logo",
|
|
54
|
+
children: [/*#__PURE__*/jsxRuntime.jsx("img", {
|
|
55
|
+
src: appLogo,
|
|
56
|
+
className: "w3a--block dark:w3a--hidden w3a--h-10 w3a--w-10",
|
|
57
|
+
alt: ""
|
|
58
|
+
}), /*#__PURE__*/jsxRuntime.jsx("img", {
|
|
59
|
+
src: appLogo,
|
|
60
|
+
className: "w3a--hidden dark:w3a--block w3a--h-10 w3a--w-10",
|
|
61
|
+
alt: ""
|
|
62
|
+
})]
|
|
63
|
+
}), /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
64
|
+
className: "w3a-modal__connector",
|
|
65
|
+
children: /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
66
|
+
className: "w3a-modal__connector-beat",
|
|
67
|
+
children: [/*#__PURE__*/jsxRuntime.jsx("div", {}), /*#__PURE__*/jsxRuntime.jsx("div", {}), /*#__PURE__*/jsxRuntime.jsx("div", {}), /*#__PURE__*/jsxRuntime.jsx("div", {}), /*#__PURE__*/jsxRuntime.jsx("div", {})]
|
|
68
|
+
})
|
|
69
|
+
}), /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
70
|
+
className: "w3a-modal__loader-social-logo",
|
|
71
|
+
children: providerIcon
|
|
72
|
+
})]
|
|
73
|
+
}), /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
74
|
+
children: [/*#__PURE__*/jsxRuntime.jsx("div", {
|
|
75
|
+
className: "w3a-modal__loader-bridge-message",
|
|
76
|
+
children: t("modal.adapter-loader.message1", {
|
|
77
|
+
adapter: adapterName
|
|
78
|
+
})
|
|
79
|
+
}), /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
80
|
+
className: "w3a-modal__loader-bridge-message",
|
|
81
|
+
children: t("modal.adapter-loader.message2", {
|
|
82
|
+
adapter: adapterName
|
|
83
|
+
})
|
|
84
|
+
})]
|
|
85
|
+
})]
|
|
86
|
+
}), modalStatus === noModal.ADAPTER_STATUS.CONNECTED && /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
87
|
+
className: "w3a--flex w3a--flex-col w3a--items-center",
|
|
88
|
+
children: [/*#__PURE__*/jsxRuntime.jsx(Icon, {
|
|
89
|
+
iconName: "connected"
|
|
90
|
+
}), /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
91
|
+
className: "w3ajs-modal-loader__message w3a-spinner-message w3a--mt-4",
|
|
92
|
+
children: message
|
|
93
|
+
})]
|
|
94
|
+
}), modalStatus === noModal.ADAPTER_STATUS.ERRORED && /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
95
|
+
className: "w3ajs-modal-loader__message w3a-spinner-message w3a-spinner-message--error",
|
|
96
|
+
children: message
|
|
97
|
+
})]
|
|
98
|
+
})
|
|
99
|
+
}), (modalStatus === noModal.ADAPTER_STATUS.CONNECTED || modalStatus === noModal.ADAPTER_STATUS.ERRORED) && /*#__PURE__*/jsxRuntime.jsx("button", {
|
|
100
|
+
type: "button",
|
|
101
|
+
className: "w3a-header__button w3ajs-loader-close-btn",
|
|
102
|
+
onClick: onClose,
|
|
103
|
+
children: closeIcon
|
|
104
|
+
})]
|
|
105
|
+
}) : null;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
module.exports = DetailedLoader;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
require('./styles.css.js');
|
|
4
|
+
var React = require('react');
|
|
5
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
6
|
+
|
|
7
|
+
function Button(props) {
|
|
8
|
+
const {
|
|
9
|
+
variant = "primary",
|
|
10
|
+
onClick,
|
|
11
|
+
children,
|
|
12
|
+
title,
|
|
13
|
+
className,
|
|
14
|
+
style,
|
|
15
|
+
size = "md",
|
|
16
|
+
disabled,
|
|
17
|
+
type = "button"
|
|
18
|
+
} = props;
|
|
19
|
+
const sizeClass = `size-${size}`;
|
|
20
|
+
return /*#__PURE__*/jsxRuntime.jsx("button", {
|
|
21
|
+
disabled: disabled
|
|
22
|
+
// eslint-disable-next-line react/button-has-type
|
|
23
|
+
,
|
|
24
|
+
type: type,
|
|
25
|
+
className: `t-btn t-btn-${variant} w3a--rounded-full ${sizeClass} ${className}`,
|
|
26
|
+
onClick: onClick,
|
|
27
|
+
title: title,
|
|
28
|
+
style: style,
|
|
29
|
+
children: children
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
var Button$1 = /*#__PURE__*/React.memo(Button);
|
|
33
|
+
|
|
34
|
+
module.exports = Button$1;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var styleInject_es = require('../../../../../../node_modules/style-inject/dist/style-inject.es.js');
|
|
4
|
+
|
|
5
|
+
var css_248z = ".w3a-parent-container #w3a-modal button.t-btn,.w3a-parent-container a.t-btn{align-items:center;display:flex;justify-content:center;transition-duration:.15s;transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-timing-function:linear}.w3a-parent-container #w3a-modal button.t-btn:not(.t-btn-text):disabled,.w3a-parent-container a.t-btn:not(.t-btn-text):disabled{background-color:var(--app-gray-300);border-width:0;color:var(--app-gray-400)}.w3a-parent-container #w3a-modal button.t-btn:not(.t-btn-text):hover:disabled,.w3a-parent-container a.t-btn:not(.t-btn-text):hover:disabled{background-color:var(--app-gray-300);border-color:var(--app-gray-300);color:var(--app-gray-400)}.w3a-parent-container #w3a-modal button.t-btn:not(.t-btn-text):active:disabled,.w3a-parent-container a.t-btn:not(.t-btn-text):active:disabled{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(var(--tw-ring-offset-width)) var(--tw-ring-color);--tw-ring-offset-width:0px;background-color:var(--app-gray-300);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow,0 0 #0000);outline-width:0}.w3a-parent-container #w3a-modal button.t-btn:not(.t-btn-text):disabled:is(.w3a--dark *),.w3a-parent-container a.t-btn:not(.t-btn-text):disabled:is(.w3a--dark *){background-color:var(--app-gray-700);color:var(--app-gray-600)}.w3a-parent-container #w3a-modal .size-xs{font-size:.75rem;height:32px;line-height:1rem;padding:.5rem .75rem}.w3a-parent-container #w3a-modal .size-sm{font-size:.875rem;height:36px;line-height:1.25rem;padding:.5rem .75rem}.w3a-parent-container #w3a-modal .size-md{font-size:.875rem;height:42px;line-height:1.25rem;padding:.625rem 1.25rem}.w3a-parent-container #w3a-modal .size-lg{font-size:1rem;height:48px;line-height:1.5rem;padding:.75rem 1.25rem}.w3a-parent-container #w3a-modal .size-xl{font-size:1rem;height:52px;line-height:1.5rem;padding:.875rem 1rem}.w3a-parent-container #w3a-modal .t-btn.t-btn-primary{background-color:var(--app-primary-600);color:var(--app-on-primary);outline:2px solid #0000;outline-offset:2px}.w3a-parent-container #w3a-modal .t-btn.t-btn-primary:hover{background-color:var(--app-primary-700)}.w3a-parent-container #w3a-modal .t-btn.t-btn-primary:focus-visible{outline-color:var(--app-primary-600);outline-offset:1px;outline-style:solid;outline-width:1px}.w3a-parent-container #w3a-modal .t-btn.t-btn-primary:active{background-color:var(--app-primary-600);outline-color:var(--app-primary-600);outline-offset:1px;outline-style:solid;outline-width:1px}.w3a-parent-container #w3a-modal .t-btn.t-btn-primary:is(.w3a--dark *){background-color:var(--app-primary-500)}.w3a-parent-container #w3a-modal .t-btn.t-btn-primary:hover:is(.w3a--dark *){background-color:var(--app-primary-400)}.w3a-parent-container #w3a-modal .t-btn.t-btn-primary:focus-visible:is(.w3a--dark *){outline-color:var(--app-primary-500)}.w3a-parent-container #w3a-modal .t-btn.t-btn-primary:active:is(.w3a--dark *){background-color:var(--app-primary-500);outline-color:var(--app-primary-500)}.w3a-parent-container #w3a-modal .t-btn.t-btn-secondary{background-color:initial;border-color:var(--app-gray-500);border-width:1px;color:var(--app-gray-600);outline:2px solid #0000;outline-offset:2px}.w3a-parent-container #w3a-modal .t-btn.t-btn-secondary:hover{background-color:var(--app-gray-200)}.w3a-parent-container #w3a-modal .t-btn.t-btn-secondary:focus-visible{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);--tw-ring-color:var(--app-primary-600);background-color:initial;border-color:var(--app-primary-600);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow,0 0 #0000)}.w3a-parent-container #w3a-modal .t-btn.t-btn-secondary:active{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);--tw-ring-color:var(--app-primary-600);background-color:initial;border-color:var(--app-primary-600);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow,0 0 #0000)}.w3a-parent-container #w3a-modal .t-btn.t-btn-secondary:is(.w3a--dark *){border-color:var(--app-gray-300);color:var(--app-white)}.w3a-parent-container #w3a-modal .t-btn.t-btn-secondary:hover:is(.w3a--dark *){background-color:var(--app-gray-700)}.w3a-parent-container #w3a-modal .t-btn.t-btn-secondary:focus-visible:is(.w3a--dark *){--tw-ring-color:var(--app-primary-500);background-color:initial;border-color:var(--app-primary-500)}.w3a-parent-container #w3a-modal .t-btn.t-btn-secondary:active:is(.w3a--dark *){--tw-ring-color:var(--app-primary-500);background-color:initial;border-color:var(--app-primary-500)}.w3a-parent-container #w3a-modal .t-btn.t-btn-tertiary{background-color:var(--app-gray-200);color:var(--app-gray-800)}.w3a-parent-container #w3a-modal .t-btn.t-btn-tertiary:hover{background-color:var(--app-gray-300)}.w3a-parent-container #w3a-modal .t-btn.t-btn-tertiary:focus-visible{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);--tw-ring-color:var(--app-primary-600);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow,0 0 #0000)}.w3a-parent-container #w3a-modal .t-btn.t-btn-tertiary:active{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);--tw-ring-color:var(--app-primary-600);background-color:var(--app-gray-200);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow,0 0 #0000)}.w3a-parent-container #w3a-modal .t-btn.t-btn-tertiary:is(.w3a--dark *){background-color:var(--app-gray-500);color:var(--app-white)}.w3a-parent-container #w3a-modal .t-btn.t-btn-tertiary:hover:is(.w3a--dark *){background-color:var(--app-gray-400)}.w3a-parent-container #w3a-modal .t-btn.t-btn-tertiary:focus-visible:is(.w3a--dark *){--tw-ring-color:var(--app-primary-500)}.w3a-parent-container #w3a-modal .t-btn.t-btn-tertiary:active:is(.w3a--dark *){--tw-ring-color:var(--app-primary-500);background-color:var(--app-gray-500)}.w3a-parent-container #w3a-modal .t-btn.t-btn-text{color:var(--app-primary-600)}.w3a-parent-container #w3a-modal .t-btn.t-btn-text:hover{color:var(--app-primary-800);text-decoration-line:underline}.w3a-parent-container #w3a-modal .t-btn.t-btn-text:focus-visible{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);--tw-ring-color:var(--app-primary-600);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow,0 0 #0000)}.w3a-parent-container #w3a-modal .t-btn.t-btn-text:active{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);--tw-ring-color:var(--app-primary-600);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow,0 0 #0000);color:var(--app-primary-600)}.w3a-parent-container #w3a-modal .t-btn.t-btn-text:disabled{color:var(--app-gray-400);text-decoration-line:none}.w3a-parent-container #w3a-modal .t-btn.t-btn-text:is(.w3a--dark *){color:var(--app-primary-500)}.w3a-parent-container #w3a-modal .t-btn.t-btn-text:hover:is(.w3a--dark *){color:var(--app-primary-400)}.w3a-parent-container #w3a-modal .t-btn.t-btn-text:disabled:is(.w3a--dark *){color:var(--app-gray-600)}.w3a-parent-container #w3a-modal .btn-link{text-decoration-line:none}.w3a-parent-container #w3a-modal button.t-btn:hover>.hover-icon{display:block;transition:display .15s;transition-timing-function:cubic-bezier(0,.54,.63,.99)}.w3a-parent-container #w3a-modal button.t-btn:hover>.image-icon{display:none;transition:display .15s;transition-timing-function:cubic-bezier(0,.54,.63,.99)}";
|
|
6
|
+
styleInject_es(css_248z);
|
|
7
|
+
|
|
8
|
+
module.exports = css_248z;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var reactI18next = require('react-i18next');
|
|
4
|
+
var localeImport = require('../../localeImport.js');
|
|
5
|
+
var Button = require('../Button/Button.js');
|
|
6
|
+
var Image = require('../Image.js');
|
|
7
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
8
|
+
|
|
9
|
+
function ExternalWalletButton(props) {
|
|
10
|
+
const {
|
|
11
|
+
button,
|
|
12
|
+
handleWalletClick
|
|
13
|
+
} = props;
|
|
14
|
+
const [t] = reactI18next.useTranslation(undefined, {
|
|
15
|
+
i18n: localeImport
|
|
16
|
+
});
|
|
17
|
+
return /*#__PURE__*/jsxRuntime.jsxs(Button, {
|
|
18
|
+
variant: "tertiary",
|
|
19
|
+
type: "button",
|
|
20
|
+
onClick: () => handleWalletClick(button),
|
|
21
|
+
className: "w3a--w-full w3a--rounded-xl w3a--size-xl !w3a--justify-between w3a--items-center wallet-btn",
|
|
22
|
+
title: button.name,
|
|
23
|
+
children: [/*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
24
|
+
className: "w3a--flex w3a--items-center",
|
|
25
|
+
children: [/*#__PURE__*/jsxRuntime.jsx(Image, {
|
|
26
|
+
imageId: `login-${button.name}`,
|
|
27
|
+
hoverImageId: `login-${button.name}`,
|
|
28
|
+
fallbackImageId: "wallet",
|
|
29
|
+
height: "24",
|
|
30
|
+
width: "24",
|
|
31
|
+
isButton: true,
|
|
32
|
+
extension: button.imgExtension
|
|
33
|
+
}), /*#__PURE__*/jsxRuntime.jsx("p", {
|
|
34
|
+
className: "w3a--ml-2 w3a--text-left w3a--text-sm",
|
|
35
|
+
children: button.displayName
|
|
36
|
+
})]
|
|
37
|
+
}), button.hasInjectedWallet && /*#__PURE__*/jsxRuntime.jsx("span", {
|
|
38
|
+
className: "w3a--inline-flex w3a--items-center w3a--rounded-lg w3a--px-2 w3a--py-1 w3a--text-xs w3a--font-medium w3a--bg-app-primary-100 w3a--text-app-primary-800",
|
|
39
|
+
children: t("modal.external.installed")
|
|
40
|
+
})]
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
module.exports = ExternalWalletButton;
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var React = require('react');
|
|
4
|
+
var reactI18next = require('react-i18next');
|
|
5
|
+
var interfaces = require('../../interfaces.js');
|
|
6
|
+
var localeImport = require('../../localeImport.js');
|
|
7
|
+
var Button = require('../Button/Button.js');
|
|
8
|
+
var Loader = require('../Loader.js');
|
|
9
|
+
var WalletConnect = require('../WalletConnect.js');
|
|
10
|
+
var ExternalWalletHeader = require('./ExternalWalletHeader.js');
|
|
11
|
+
var ExternalWalletInstall = require('./ExternalWalletInstall.js');
|
|
12
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
13
|
+
|
|
14
|
+
function ExternalWalletConnect(props) {
|
|
15
|
+
const {
|
|
16
|
+
connectButton,
|
|
17
|
+
walletConnectUri,
|
|
18
|
+
goBack,
|
|
19
|
+
closeModal
|
|
20
|
+
} = props;
|
|
21
|
+
const [isWalletDownloadShown, setIsWalletDownloadShown] = React.useState(false);
|
|
22
|
+
const [t] = reactI18next.useTranslation(undefined, {
|
|
23
|
+
i18n: localeImport
|
|
24
|
+
});
|
|
25
|
+
const showWalletDownload = () => {
|
|
26
|
+
setIsWalletDownloadShown(true);
|
|
27
|
+
};
|
|
28
|
+
return /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
29
|
+
children: isWalletDownloadShown ? /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
30
|
+
children: /*#__PURE__*/jsxRuntime.jsx(ExternalWalletInstall, {
|
|
31
|
+
connectButton: connectButton,
|
|
32
|
+
goBack: () => setIsWalletDownloadShown(false),
|
|
33
|
+
closeModal: closeModal
|
|
34
|
+
})
|
|
35
|
+
}) : /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
36
|
+
children: [/*#__PURE__*/jsxRuntime.jsx(ExternalWalletHeader, {
|
|
37
|
+
title: connectButton.displayName,
|
|
38
|
+
goBack: goBack,
|
|
39
|
+
closeModal: closeModal
|
|
40
|
+
}), !walletConnectUri ? /*#__PURE__*/jsxRuntime.jsx(Loader, {
|
|
41
|
+
modalStatus: interfaces.MODAL_STATUS.CONNECTING,
|
|
42
|
+
canEmit: false
|
|
43
|
+
}) : /*#__PURE__*/jsxRuntime.jsx(WalletConnect, {
|
|
44
|
+
walletConnectUri: walletConnectUri,
|
|
45
|
+
logoImage: `https://images.web3auth.io/login-${connectButton.name}.${connectButton.imgExtension}`,
|
|
46
|
+
primaryColor: connectButton.walletRegistryItem.primaryColor
|
|
47
|
+
}), connectButton.hasInstallLinks && /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
48
|
+
className: "w3a--flex w3a--flex-row w3a--items-center w3a--justify-between w3a--gap-2 w3a--bg-app-gray-50 dark:w3a--bg-app-gray-700 w3a--text-app-gray-900 dark:w3a--text-app-white w3a--px-3 w3a--py-2 w3a--rounded-xl",
|
|
49
|
+
children: [/*#__PURE__*/jsxRuntime.jsxs("span", {
|
|
50
|
+
className: "w3a--text-sm w3a--truncate w3a--flex-grow-0",
|
|
51
|
+
children: [t("modal.external.dont-have"), " ", /*#__PURE__*/jsxRuntime.jsx("span", {
|
|
52
|
+
children: connectButton.displayName
|
|
53
|
+
}), "?"]
|
|
54
|
+
}), /*#__PURE__*/jsxRuntime.jsx(Button, {
|
|
55
|
+
type: "button",
|
|
56
|
+
variant: "secondary",
|
|
57
|
+
size: "xs",
|
|
58
|
+
className: "w3a--flex-grow-1 w3a--flex-shrink-0",
|
|
59
|
+
onClick: showWalletDownload,
|
|
60
|
+
children: t("modal.external.get-wallet")
|
|
61
|
+
})]
|
|
62
|
+
})]
|
|
63
|
+
})
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
module.exports = ExternalWalletConnect;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var ExternalWalletConnect = require('./ExternalWalletConnect.js');
|
|
4
|
+
var ExternalWalletInstall = require('./ExternalWalletInstall.js');
|
|
5
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
6
|
+
|
|
7
|
+
function ExternalWalletDetail(props) {
|
|
8
|
+
const {
|
|
9
|
+
connectButton,
|
|
10
|
+
walletConnectUri,
|
|
11
|
+
goBack,
|
|
12
|
+
closeModal
|
|
13
|
+
} = props;
|
|
14
|
+
return /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
15
|
+
children: connectButton.hasWalletConnect ?
|
|
16
|
+
/*#__PURE__*/
|
|
17
|
+
// Wallet Connect
|
|
18
|
+
jsxRuntime.jsx(ExternalWalletConnect, {
|
|
19
|
+
connectButton: connectButton,
|
|
20
|
+
walletConnectUri: walletConnectUri,
|
|
21
|
+
goBack: goBack,
|
|
22
|
+
closeModal: closeModal
|
|
23
|
+
}) :
|
|
24
|
+
/*#__PURE__*/
|
|
25
|
+
// Download wallets
|
|
26
|
+
jsxRuntime.jsx(ExternalWalletInstall, {
|
|
27
|
+
connectButton: connectButton,
|
|
28
|
+
goBack: goBack,
|
|
29
|
+
closeModal: closeModal
|
|
30
|
+
})
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
module.exports = ExternalWalletDetail;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var Icon = require('../Icon.js');
|
|
4
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
5
|
+
|
|
6
|
+
function ExternalWalletHeader(props) {
|
|
7
|
+
const {
|
|
8
|
+
title,
|
|
9
|
+
goBack,
|
|
10
|
+
closeModal,
|
|
11
|
+
disableBackButton
|
|
12
|
+
} = props;
|
|
13
|
+
return /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
14
|
+
className: "w3a--flex w3a--flex-row w3a--justify-center w3a--items-center w3a--gap-1",
|
|
15
|
+
children: [/*#__PURE__*/jsxRuntime.jsx("div", {
|
|
16
|
+
className: "w3a--flex-grow-1 w3a--flex-shrink-0 w3a--items-center w3a--justify-start w3a--mr-auto",
|
|
17
|
+
children: !disableBackButton && /*#__PURE__*/jsxRuntime.jsx("button", {
|
|
18
|
+
type: "button",
|
|
19
|
+
className: "w3a-external-back w3ajs-external-back",
|
|
20
|
+
onClick: goBack,
|
|
21
|
+
children: /*#__PURE__*/jsxRuntime.jsx(Icon, {
|
|
22
|
+
iconName: "arrow-left-light",
|
|
23
|
+
darkIconName: "arrow-left-dark",
|
|
24
|
+
width: "16",
|
|
25
|
+
height: "16"
|
|
26
|
+
})
|
|
27
|
+
})
|
|
28
|
+
}), /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
29
|
+
className: "w3a-header__title w3a--flex-grow-0 w3a--flex-shrink w3a--truncate w3a--mr-6",
|
|
30
|
+
children: title
|
|
31
|
+
}), /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
32
|
+
className: "w3a--flex-grow-1 w3a--flex-shrink-0 w3a--items-center w3a--justify-end w3a--ml-auto",
|
|
33
|
+
children: /*#__PURE__*/jsxRuntime.jsx("button", {
|
|
34
|
+
type: "button",
|
|
35
|
+
onClick: closeModal,
|
|
36
|
+
className: "w3a-header__button_wallet w3ajs-close-btn",
|
|
37
|
+
children: /*#__PURE__*/jsxRuntime.jsx(Icon, {
|
|
38
|
+
iconName: "x-light",
|
|
39
|
+
darkIconName: "x-dark"
|
|
40
|
+
})
|
|
41
|
+
})
|
|
42
|
+
})]
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
module.exports = ExternalWalletHeader;
|