@web3auth/modal 10.0.0-alpha.1 → 10.0.0-alpha.2
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/modalManager.js +19 -26
- 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 +38 -37
- 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 +26 -26
- package/dist/lib.cjs/packages/modal/src/ui/components/SelfCustodyViaWeb3Auth.js +5 -5
- package/dist/lib.cjs/packages/modal/src/ui/components/SocialLoginPasswordless.js +24 -17
- package/dist/lib.cjs/packages/modal/src/ui/components/SocialLogins.js +29 -25
- package/dist/lib.cjs/packages/modal/src/ui/components/WalletConnect.js +9 -9
- package/dist/lib.cjs/packages/modal/src/ui/config.js +2 -2
- 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 +2 -0
- package/dist/lib.cjs/packages/modal/src/ui/i18n/english.json.js +2 -0
- package/dist/lib.cjs/packages/modal/src/ui/i18n/french.json.js +2 -0
- package/dist/lib.cjs/packages/modal/src/ui/i18n/german.json.js +2 -0
- package/dist/lib.cjs/packages/modal/src/ui/i18n/japanese.json.js +2 -0
- package/dist/lib.cjs/packages/modal/src/ui/i18n/korean.json.js +2 -0
- package/dist/lib.cjs/packages/modal/src/ui/i18n/mandarin.json.js +2 -0
- package/dist/lib.cjs/packages/modal/src/ui/i18n/portuguese.json.js +2 -0
- package/dist/lib.cjs/packages/modal/src/ui/i18n/spanish.json.js +2 -0
- package/dist/lib.cjs/packages/modal/src/ui/i18n/turkish.json.js +2 -0
- package/dist/lib.cjs/packages/modal/src/ui/interfaces.js +2 -4
- package/dist/lib.cjs/packages/modal/src/ui/loginModal.js +18 -16
- package/dist/lib.cjs/packages/modal/src/vue/Web3AuthProvider.js +1 -2
- 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/lib.esm/packages/modal/src/modalManager.js +14 -6
- 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 +19 -14
- package/dist/lib.esm/packages/modal/src/ui/components/Modal.js +10 -9
- package/dist/lib.esm/packages/modal/src/ui/components/SocialLoginPasswordless.js +11 -4
- package/dist/lib.esm/packages/modal/src/ui/components/SocialLogins.js +16 -11
- package/dist/lib.esm/packages/modal/src/ui/config.js +3 -3
- 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 +2 -0
- package/dist/lib.esm/packages/modal/src/ui/i18n/english.json.js +2 -0
- package/dist/lib.esm/packages/modal/src/ui/i18n/french.json.js +2 -0
- package/dist/lib.esm/packages/modal/src/ui/i18n/german.json.js +2 -0
- package/dist/lib.esm/packages/modal/src/ui/i18n/japanese.json.js +2 -0
- package/dist/lib.esm/packages/modal/src/ui/i18n/korean.json.js +2 -0
- package/dist/lib.esm/packages/modal/src/ui/i18n/mandarin.json.js +2 -0
- package/dist/lib.esm/packages/modal/src/ui/i18n/portuguese.json.js +2 -0
- package/dist/lib.esm/packages/modal/src/ui/i18n/spanish.json.js +2 -0
- package/dist/lib.esm/packages/modal/src/ui/i18n/turkish.json.js +2 -0
- package/dist/lib.esm/packages/modal/src/ui/interfaces.js +2 -1
- package/dist/lib.esm/packages/modal/src/ui/loginModal.js +15 -10
- package/dist/lib.esm/packages/modal/src/vue/Web3AuthProvider.js +1 -1
- package/dist/modal.umd.min.js +1 -1
- package/package.json +18 -18
- package/dist/modal.cjs.js +0 -5884
- package/dist/types/ui/config.d.ts +0 -4
- /package/dist/{types → lib.cjs/types}/config.d.ts +0 -0
- /package/dist/{types → lib.cjs/types}/index.d.ts +0 -0
- /package/dist/{types → lib.cjs/types}/interface.d.ts +0 -0
- /package/dist/{types → lib.cjs/types}/modalManager.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}/react/interfaces.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}/ui/utils.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
- /package/dist/{types → lib.cjs/types}/vue/interfaces.d.ts +0 -0
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var _objectSpread = require('@babel/runtime/helpers/objectSpread2');
|
|
4
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
4
5
|
var auth = require('@web3auth/auth');
|
|
5
6
|
var noModal = require('@web3auth/no-modal');
|
|
6
7
|
var deepmerge = require('deepmerge');
|
|
@@ -15,7 +16,6 @@ var Footer = require('./Footer.js');
|
|
|
15
16
|
var Header = require('./Header.js');
|
|
16
17
|
var SocialLoginPasswordless = require('./SocialLoginPasswordless.js');
|
|
17
18
|
var SocialLogins = require('./SocialLogins.js');
|
|
18
|
-
var jsxRuntime = require('react/jsx-runtime');
|
|
19
19
|
|
|
20
20
|
noModal.log.enableAll();
|
|
21
21
|
function Modal(props) {
|
|
@@ -48,7 +48,7 @@ function Modal(props) {
|
|
|
48
48
|
stateListener,
|
|
49
49
|
appLogo,
|
|
50
50
|
appName,
|
|
51
|
-
|
|
51
|
+
chainNamespaces,
|
|
52
52
|
walletRegistry,
|
|
53
53
|
handleSocialLoginClick,
|
|
54
54
|
handleExternalWalletClick,
|
|
@@ -81,7 +81,6 @@ function Modal(props) {
|
|
|
81
81
|
} else {
|
|
82
82
|
setModalTransitionClasses(["w3a-modal__inner", modalState.modalVisibility ? "w3a-modal__inner--active" : ""]);
|
|
83
83
|
// hide external wallets, if modal is closing, so that it will show social login screen on reopen.
|
|
84
|
-
|
|
85
84
|
timeOutId = window.setTimeout(() => {
|
|
86
85
|
setModalState(prevState => {
|
|
87
86
|
return _objectSpread(_objectSpread({}, prevState), {}, {
|
|
@@ -125,7 +124,7 @@ function Modal(props) {
|
|
|
125
124
|
} = params;
|
|
126
125
|
setModalState(prevState => {
|
|
127
126
|
return _objectSpread(_objectSpread({}, prevState), {}, {
|
|
128
|
-
detailedLoaderConnector: loginParams.
|
|
127
|
+
detailedLoaderConnector: loginParams.authConnection,
|
|
129
128
|
detailedLoaderConnectorName: loginParams.name
|
|
130
129
|
});
|
|
131
130
|
});
|
|
@@ -133,11 +132,11 @@ function Modal(props) {
|
|
|
133
132
|
};
|
|
134
133
|
const isEmailPrimary = ((_modalState$socialLog = modalState.socialLoginsConfig) === null || _modalState$socialLog === void 0 || (_modalState$socialLog = _modalState$socialLog.uiConfig) === null || _modalState$socialLog === void 0 ? void 0 : _modalState$socialLog.primaryButton) === "emailLogin";
|
|
135
134
|
const isExternalPrimary = ((_modalState$socialLog2 = modalState.socialLoginsConfig) === null || _modalState$socialLog2 === void 0 || (_modalState$socialLog2 = _modalState$socialLog2.uiConfig) === null || _modalState$socialLog2 === void 0 ? void 0 : _modalState$socialLog2.primaryButton) === "externalLogin";
|
|
136
|
-
const externalWalletButton =
|
|
135
|
+
const externalWalletButton = jsxRuntime.jsx("div", {
|
|
137
136
|
className: "w3ajs-external-wallet w3a-group w3a--w-full",
|
|
138
|
-
children:
|
|
137
|
+
children: jsxRuntime.jsx("div", {
|
|
139
138
|
className: "w3a-external-toggle w3ajs-external-toggle",
|
|
140
|
-
children:
|
|
139
|
+
children: jsxRuntime.jsx(Button, {
|
|
141
140
|
variant: isExternalPrimary ? "primary" : "tertiary",
|
|
142
141
|
type: "button",
|
|
143
142
|
className: "w3a--w-full w3ajs-external-toggle__button",
|
|
@@ -164,32 +163,32 @@ function Modal(props) {
|
|
|
164
163
|
var _modalState$socialLog3, _modalState$socialLog4;
|
|
165
164
|
if (modalState.showExternalWalletsOnly) return false;
|
|
166
165
|
if (Object.keys(((_modalState$socialLog3 = modalState.socialLoginsConfig) === null || _modalState$socialLog3 === void 0 ? void 0 : _modalState$socialLog3.loginMethods) || {}).length === 0) return false;
|
|
167
|
-
const isAnySocialLoginVisible = Object.entries(((_modalState$socialLog4 = modalState.socialLoginsConfig) === null || _modalState$socialLog4 === void 0 ? void 0 : _modalState$socialLog4.loginMethods) || {}).some(([k, v]) => k !== auth.
|
|
166
|
+
const isAnySocialLoginVisible = Object.entries(((_modalState$socialLog4 = modalState.socialLoginsConfig) === null || _modalState$socialLog4 === void 0 ? void 0 : _modalState$socialLog4.loginMethods) || {}).some(([k, v]) => k !== auth.AUTH_CONNECTION.EMAIL_PASSWORDLESS && v.showOnModal !== false);
|
|
168
167
|
if (isAnySocialLoginVisible) return true;
|
|
169
168
|
return false;
|
|
170
169
|
}, [modalState.showExternalWalletsOnly, (_modalState$socialLog5 = modalState.socialLoginsConfig) === null || _modalState$socialLog5 === void 0 ? void 0 : _modalState$socialLog5.loginMethods]);
|
|
171
170
|
noModal.log.info("modal state", modalState, areSocialLoginsVisible);
|
|
172
171
|
const isEmailPasswordlessLoginVisible = React.useMemo(() => {
|
|
173
172
|
var _modalState$socialLog6;
|
|
174
|
-
return (_modalState$socialLog6 = modalState.socialLoginsConfig) === null || _modalState$socialLog6 === void 0 || (_modalState$socialLog6 = _modalState$socialLog6.loginMethods[auth.
|
|
173
|
+
return (_modalState$socialLog6 = modalState.socialLoginsConfig) === null || _modalState$socialLog6 === void 0 || (_modalState$socialLog6 = _modalState$socialLog6.loginMethods[auth.AUTH_CONNECTION.EMAIL_PASSWORDLESS]) === null || _modalState$socialLog6 === void 0 ? void 0 : _modalState$socialLog6.showOnModal;
|
|
175
174
|
}, [(_modalState$socialLog7 = modalState.socialLoginsConfig) === null || _modalState$socialLog7 === void 0 ? void 0 : _modalState$socialLog7.loginMethods]);
|
|
176
175
|
const isSmsPasswordlessLoginVisible = React.useMemo(() => {
|
|
177
176
|
var _modalState$socialLog8;
|
|
178
|
-
return (_modalState$socialLog8 = modalState.socialLoginsConfig) === null || _modalState$socialLog8 === void 0 || (_modalState$socialLog8 = _modalState$socialLog8.loginMethods[auth.
|
|
177
|
+
return (_modalState$socialLog8 = modalState.socialLoginsConfig) === null || _modalState$socialLog8 === void 0 || (_modalState$socialLog8 = _modalState$socialLog8.loginMethods[auth.AUTH_CONNECTION.SMS_PASSWORDLESS]) === null || _modalState$socialLog8 === void 0 ? void 0 : _modalState$socialLog8.showOnModal;
|
|
179
178
|
}, [(_modalState$socialLog9 = modalState.socialLoginsConfig) === null || _modalState$socialLog9 === void 0 ? void 0 : _modalState$socialLog9.loginMethods]);
|
|
180
|
-
return modalState.modalVisibilityDelayed &&
|
|
179
|
+
return modalState.modalVisibilityDelayed && jsxRuntime.jsx("div", {
|
|
181
180
|
id: "w3a-modal",
|
|
182
181
|
className: "w3a-modal",
|
|
183
|
-
children:
|
|
182
|
+
children: jsxRuntime.jsxs("div", {
|
|
184
183
|
className: `${modalTransitionClasses.join(" ")} ${modalState.status !== interfaces.MODAL_STATUS.INITIALIZED ? "w3a--p-6 w3a--pt-7" : ""} ${(areSocialLoginsVisible || isEmailPasswordlessLoginVisible || isSmsPasswordlessLoginVisible) && !modalState.externalWalletsVisibility ? "" : "wallet-adapter-container"}`,
|
|
185
|
-
children: [modalState.status !== interfaces.MODAL_STATUS.INITIALIZED ?
|
|
186
|
-
children: [
|
|
184
|
+
children: [modalState.status !== interfaces.MODAL_STATUS.INITIALIZED ? jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
185
|
+
children: [jsxRuntime.jsx(Header, {
|
|
187
186
|
onClose: closeModal,
|
|
188
187
|
appLogo: appLogo,
|
|
189
188
|
appName: appName
|
|
190
|
-
}),
|
|
189
|
+
}), jsxRuntime.jsx("div", {
|
|
191
190
|
className: "w3a-modal__content w3ajs-content",
|
|
192
|
-
children:
|
|
191
|
+
children: jsxRuntime.jsx(AdapterLoader, {
|
|
193
192
|
onClose: onCloseLoader,
|
|
194
193
|
appLogo: appLogo,
|
|
195
194
|
modalStatus: modalState.status,
|
|
@@ -198,33 +197,34 @@ function Modal(props) {
|
|
|
198
197
|
connectorName: modalState.detailedLoaderConnectorName
|
|
199
198
|
})
|
|
200
199
|
})]
|
|
201
|
-
}) :
|
|
200
|
+
}) : jsxRuntime.jsx("div", {
|
|
202
201
|
className: `transition-wrapper ${transition}`,
|
|
203
|
-
children: (areSocialLoginsVisible || isEmailPasswordlessLoginVisible || isSmsPasswordlessLoginVisible) && !modalState.externalWalletsVisibility ?
|
|
204
|
-
children: [
|
|
202
|
+
children: (areSocialLoginsVisible || isEmailPasswordlessLoginVisible || isSmsPasswordlessLoginVisible) && !modalState.externalWalletsVisibility ? jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
203
|
+
children: [jsxRuntime.jsx(Header, {
|
|
205
204
|
onClose: closeModal,
|
|
206
205
|
appLogo: appLogo,
|
|
207
206
|
appName: appName
|
|
208
|
-
}),
|
|
207
|
+
}), jsxRuntime.jsxs("div", {
|
|
209
208
|
className: "w3a-modal__content w3ajs-content",
|
|
210
|
-
children: [areSocialLoginsVisible ?
|
|
209
|
+
children: [areSocialLoginsVisible ? jsxRuntime.jsx(SocialLogins, {
|
|
211
210
|
handleSocialLoginClick: params => preHandleSocialWalletClick(params),
|
|
212
211
|
socialLoginsConfig: modalState.socialLoginsConfig
|
|
213
|
-
}) : null, (isEmailPasswordlessLoginVisible || isSmsPasswordlessLoginVisible) &&
|
|
212
|
+
}) : null, (isEmailPasswordlessLoginVisible || isSmsPasswordlessLoginVisible) && jsxRuntime.jsx(SocialLoginPasswordless, {
|
|
214
213
|
isEmailVisible: isEmailPasswordlessLoginVisible,
|
|
215
214
|
isSmsVisible: isSmsPasswordlessLoginVisible,
|
|
216
215
|
connector: (_modalState$socialLog10 = modalState.socialLoginsConfig) === null || _modalState$socialLog10 === void 0 ? void 0 : _modalState$socialLog10.connector,
|
|
217
216
|
handleSocialLoginClick: params => preHandleSocialWalletClick(params),
|
|
217
|
+
socialLoginsConfig: modalState.socialLoginsConfig,
|
|
218
218
|
isPrimaryBtn: isEmailPrimary
|
|
219
219
|
}), modalState.hasExternalWallets && externalWalletButton]
|
|
220
220
|
})]
|
|
221
|
-
}) :
|
|
221
|
+
}) : jsxRuntime.jsx("div", {
|
|
222
222
|
className: "w3a-modal__content_external_wallet w3ajs-content",
|
|
223
|
-
children:
|
|
223
|
+
children: jsxRuntime.jsx(ExternalWallets, {
|
|
224
224
|
modalStatus: modalState.status,
|
|
225
225
|
showBackButton: areSocialLoginsVisible || isEmailPasswordlessLoginVisible || isSmsPasswordlessLoginVisible,
|
|
226
226
|
handleExternalWalletClick: preHandleExternalWalletClick,
|
|
227
|
-
|
|
227
|
+
chainNamespaces: chainNamespaces,
|
|
228
228
|
walletConnectUri: modalState.walletConnectUri,
|
|
229
229
|
config: modalState.externalWalletsConfig,
|
|
230
230
|
hideExternalWallets: () => setModalState(prevState => {
|
|
@@ -236,7 +236,7 @@ function Modal(props) {
|
|
|
236
236
|
closeModal: closeModal
|
|
237
237
|
})
|
|
238
238
|
})
|
|
239
|
-
}),
|
|
239
|
+
}), jsxRuntime.jsx(Footer, {})]
|
|
240
240
|
})
|
|
241
241
|
});
|
|
242
242
|
}
|
|
@@ -1,24 +1,24 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
3
4
|
var reactI18next = require('react-i18next');
|
|
4
5
|
var localeImport = require('../localeImport.js');
|
|
5
|
-
var jsxRuntime = require('react/jsx-runtime');
|
|
6
6
|
|
|
7
7
|
function SelfCustodyViaWeb3Auth() {
|
|
8
8
|
const [t] = reactI18next.useTranslation(undefined, {
|
|
9
9
|
i18n: localeImport
|
|
10
10
|
});
|
|
11
|
-
return
|
|
11
|
+
return jsxRuntime.jsxs("div", {
|
|
12
12
|
className: "w3a--flex w3a--items-center w3a--gap-2 w3a--justify-center",
|
|
13
|
-
children: [
|
|
13
|
+
children: [jsxRuntime.jsx("div", {
|
|
14
14
|
className: "w3a--text-xs w3a--text-app-gray-300 dark:w3a--text-app-gray-500",
|
|
15
15
|
children: t("modal.footer.message-new")
|
|
16
|
-
}),
|
|
16
|
+
}), jsxRuntime.jsx("img", {
|
|
17
17
|
height: "16",
|
|
18
18
|
src: "https://images.web3auth.io/web3auth-footer-logo-light.svg",
|
|
19
19
|
alt: "Web3Auth Logo Light",
|
|
20
20
|
className: "w3a--h-4 w3a--block dark:w3a--hidden"
|
|
21
|
-
}),
|
|
21
|
+
}), jsxRuntime.jsx("img", {
|
|
22
22
|
height: "16",
|
|
23
23
|
src: "https://images.web3auth.io/web3auth-footer-logo-dark.svg",
|
|
24
24
|
alt: "Web3Auth Logo Dark",
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
3
4
|
var auth = require('@web3auth/auth');
|
|
4
5
|
var React = require('react');
|
|
5
6
|
var reactI18next = require('react-i18next');
|
|
@@ -7,7 +8,6 @@ var localeImport = require('../localeImport.js');
|
|
|
7
8
|
var utils = require('../utils.js');
|
|
8
9
|
var Button = require('./Button/Button.js');
|
|
9
10
|
var Icon = require('./Icon.js');
|
|
10
|
-
var jsxRuntime = require('react/jsx-runtime');
|
|
11
11
|
|
|
12
12
|
function SocialLoginPasswordless(props) {
|
|
13
13
|
const {
|
|
@@ -15,7 +15,8 @@ function SocialLoginPasswordless(props) {
|
|
|
15
15
|
connector,
|
|
16
16
|
isPrimaryBtn,
|
|
17
17
|
isEmailVisible,
|
|
18
|
-
isSmsVisible
|
|
18
|
+
isSmsVisible,
|
|
19
|
+
socialLoginsConfig
|
|
19
20
|
} = props;
|
|
20
21
|
const [fieldValue, setFieldValue] = React.useState("");
|
|
21
22
|
const [countryCode, setCountryCode] = React.useState("");
|
|
@@ -27,12 +28,15 @@ function SocialLoginPasswordless(props) {
|
|
|
27
28
|
e.preventDefault();
|
|
28
29
|
const value = fieldValue;
|
|
29
30
|
if (isEmailVisible) {
|
|
31
|
+
const emailConfig = socialLoginsConfig.loginMethods[auth.AUTH_CONNECTION.EMAIL_PASSWORDLESS];
|
|
30
32
|
const isEmailValid = value.match(/^([\w.%+-]+)@([\w-]+\.)+([\w]{2,})$/i);
|
|
31
33
|
if (isEmailValid) {
|
|
32
34
|
return handleSocialLoginClick({
|
|
33
35
|
connector,
|
|
34
36
|
loginParams: {
|
|
35
|
-
|
|
37
|
+
authConnection: auth.AUTH_CONNECTION.EMAIL_PASSWORDLESS,
|
|
38
|
+
authConnectionId: emailConfig.authConnectionId,
|
|
39
|
+
groupedAuthConnectionId: "",
|
|
36
40
|
login_hint: value,
|
|
37
41
|
name: "Email"
|
|
38
42
|
}
|
|
@@ -40,13 +44,16 @@ function SocialLoginPasswordless(props) {
|
|
|
40
44
|
}
|
|
41
45
|
}
|
|
42
46
|
if (isSmsVisible) {
|
|
47
|
+
const smsConfig = socialLoginsConfig.loginMethods[auth.AUTH_CONNECTION.SMS_PASSWORDLESS];
|
|
43
48
|
const number = value.startsWith("+") ? value : `${countryCode}${value}`;
|
|
44
49
|
const result = await utils.validatePhoneNumber(number);
|
|
45
50
|
if (result) {
|
|
46
51
|
return handleSocialLoginClick({
|
|
47
52
|
connector,
|
|
48
53
|
loginParams: {
|
|
49
|
-
|
|
54
|
+
authConnection: auth.AUTH_CONNECTION.SMS_PASSWORDLESS,
|
|
55
|
+
authConnectionId: smsConfig.authConnectionId,
|
|
56
|
+
groupedAuthConnectionId: smsConfig.groupedAuthConnectionId,
|
|
50
57
|
login_hint: typeof result === "string" ? result : number,
|
|
51
58
|
name: "Mobile"
|
|
52
59
|
}
|
|
@@ -84,35 +91,35 @@ function SocialLoginPasswordless(props) {
|
|
|
84
91
|
if (isEmailVisible) return "modal.errors-invalid-email";
|
|
85
92
|
return "modal.errors-invalid-number";
|
|
86
93
|
}, [isEmailVisible, isSmsVisible]);
|
|
87
|
-
return
|
|
94
|
+
return jsxRuntime.jsxs("div", {
|
|
88
95
|
className: "w3ajs-passwordless w3a-group w3a-group--passwordless",
|
|
89
|
-
children: [
|
|
96
|
+
children: [jsxRuntime.jsxs("div", {
|
|
90
97
|
className: "w3a-group__title",
|
|
91
|
-
children: [t(title), isSmsVisible &&
|
|
98
|
+
children: [t(title), isSmsVisible && jsxRuntime.jsxs("div", {
|
|
92
99
|
className: "w3a--relative w3a--flex w3a--flex-col w3a--items-center w3a--cursor-pointer w3a--group",
|
|
93
|
-
children: [
|
|
100
|
+
children: [jsxRuntime.jsx(Icon, {
|
|
94
101
|
iconName: "information-circle-light",
|
|
95
102
|
darkIconName: "information-circle"
|
|
96
|
-
}),
|
|
103
|
+
}), jsxRuntime.jsxs("div", {
|
|
97
104
|
className: "w3a--absolute w3a--z-20 w3a--flex-col w3a--items-center w3a--hidden w3a--mb-5 w3a--top-4 group-hover:w3a--flex",
|
|
98
|
-
children: [
|
|
105
|
+
children: [jsxRuntime.jsx("div", {
|
|
99
106
|
className: "w3a--w-3 w3a--h-3 w3a--ml-[3px] -w3a--mb-2 w3a--rotate-45 w3a--bg-app-gray-50 dark:w3a--bg-app-gray-600"
|
|
100
|
-
}),
|
|
107
|
+
}), jsxRuntime.jsxs("div", {
|
|
101
108
|
className: `w3a--relative w3a--p-4 w3a--w-[300px] w3a--text-xs w3a--leading-none w3a--text-app-white w3a--rounded-md w3a--bg-app-gray-50 dark:w3a--bg-app-gray-600 w3a--shadow-lg ${isSmsVisible && !isEmailVisible ? "w3a--left-20" : "w3a--left-8"}`,
|
|
102
|
-
children: [
|
|
109
|
+
children: [jsxRuntime.jsx("div", {
|
|
103
110
|
className: "w3a--mb-1 w3a--text-xs w3a--font-medium w3a--text-app-gray-900 dark:w3a--text-app-white",
|
|
104
111
|
children: t("modal.popup.phone-header")
|
|
105
|
-
}),
|
|
112
|
+
}), jsxRuntime.jsx("div", {
|
|
106
113
|
className: "w3a--text-xs w3a--text-app-gray-400",
|
|
107
114
|
children: t("modal.popup.phone-body")
|
|
108
115
|
})]
|
|
109
116
|
})]
|
|
110
117
|
})]
|
|
111
118
|
})]
|
|
112
|
-
}),
|
|
119
|
+
}), jsxRuntime.jsxs("form", {
|
|
113
120
|
className: "w3ajs-passwordless-form",
|
|
114
121
|
onSubmit: e => handleFormSubmit(e),
|
|
115
|
-
children: [
|
|
122
|
+
children: [jsxRuntime.jsx("input", {
|
|
116
123
|
className: "w3a--w-full w3a--mb-4 w3a-text-field",
|
|
117
124
|
name: "passwordless-input",
|
|
118
125
|
required: true,
|
|
@@ -124,10 +131,10 @@ function SocialLoginPasswordless(props) {
|
|
|
124
131
|
e.target.placeholder = `${t("modal.social.sms-placeholder-text")} ${placeholder}`;
|
|
125
132
|
},
|
|
126
133
|
onChange: e => handleInputChange(e)
|
|
127
|
-
}), isValidInput === false &&
|
|
134
|
+
}), isValidInput === false && jsxRuntime.jsx("div", {
|
|
128
135
|
className: "w3a-sms-field--error",
|
|
129
136
|
children: t(invalidInputErrorMessage)
|
|
130
|
-
}),
|
|
137
|
+
}), jsxRuntime.jsx(Button, {
|
|
131
138
|
variant: isPrimaryBtn ? "primary" : "tertiary",
|
|
132
139
|
disabled: fieldValue === "",
|
|
133
140
|
className: "w3a--w-full",
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
3
4
|
var auth = require('@web3auth/auth');
|
|
4
5
|
var classNames = require('classnames');
|
|
5
6
|
var React = require('react');
|
|
@@ -9,20 +10,19 @@ var ThemeContext = require('../context/ThemeContext.js');
|
|
|
9
10
|
var localeImport = require('../localeImport.js');
|
|
10
11
|
var Button = require('./Button/Button.js');
|
|
11
12
|
var Image = require('./Image.js');
|
|
12
|
-
var jsxRuntime = require('react/jsx-runtime');
|
|
13
13
|
|
|
14
14
|
function getProviderIcon(method, isDark, isPrimaryBtn) {
|
|
15
|
-
const imageId = method === auth.
|
|
16
|
-
const hoverId = method === auth.
|
|
15
|
+
const imageId = method === auth.AUTH_CONNECTION.TWITTER ? `login-twitter-x${isDark ? "-light" : "-dark"}` : `login-${method}${isDark ? "-light" : "-dark"}`;
|
|
16
|
+
const hoverId = method === auth.AUTH_CONNECTION.APPLE || method === auth.AUTH_CONNECTION.GITHUB || method === auth.AUTH_CONNECTION.TWITTER ? imageId : `login-${method}-active`;
|
|
17
17
|
if (isPrimaryBtn) {
|
|
18
|
-
return
|
|
18
|
+
return jsxRuntime.jsx(Image, {
|
|
19
19
|
width: "20",
|
|
20
20
|
imageId: hoverId,
|
|
21
21
|
hoverImageId: hoverId,
|
|
22
22
|
isButton: true
|
|
23
23
|
});
|
|
24
24
|
}
|
|
25
|
-
return
|
|
25
|
+
return jsxRuntime.jsx(Image, {
|
|
26
26
|
width: "20",
|
|
27
27
|
imageId: imageId,
|
|
28
28
|
hoverImageId: hoverId,
|
|
@@ -47,7 +47,6 @@ function SocialLogins(props) {
|
|
|
47
47
|
const [t] = reactI18next.useTranslation(undefined, {
|
|
48
48
|
i18n: localeImport
|
|
49
49
|
});
|
|
50
|
-
|
|
51
50
|
// Too small a function to use `useCallback`
|
|
52
51
|
const expandClickHandler = () => {
|
|
53
52
|
setIsExpanded(!isExpanded);
|
|
@@ -62,42 +61,45 @@ function SocialLogins(props) {
|
|
|
62
61
|
const adapterButtonClass = classNames("w3a-button-expand", "w3ajs-button-expand", isExpanded ? "w3a-button--rotate" : "");
|
|
63
62
|
const adapterExpandText = isExpanded ? t("modal.social.view-less") : t("modal.social.view-more");
|
|
64
63
|
const loginMethodsCount = Object.keys(socialLoginsConfig.loginMethods).length + 1;
|
|
65
|
-
const restrictedLoginMethods = [auth.
|
|
66
|
-
return
|
|
64
|
+
const restrictedLoginMethods = [auth.AUTH_CONNECTION.CUSTOM, auth.AUTH_CONNECTION.SMS_PASSWORDLESS, auth.AUTH_CONNECTION.EMAIL_PASSWORDLESS, auth.AUTH_CONNECTION.PASSKEYS, auth.AUTH_CONNECTION.TELEGRAM, auth.AUTH_CONNECTION.AUTHENTICATOR];
|
|
65
|
+
return jsxRuntime.jsxs("div", {
|
|
67
66
|
className: "w3ajs-social-logins w3a-group",
|
|
68
|
-
children: [
|
|
67
|
+
children: [jsxRuntime.jsx("ul", {
|
|
69
68
|
className: adapterListClass,
|
|
70
69
|
children: Object.keys(socialLoginsConfig.loginMethods).map(method => {
|
|
71
70
|
var _socialLoginsConfig$u, _socialLoginsConfig$u2;
|
|
72
|
-
const
|
|
71
|
+
const socialLoginConfig = socialLoginsConfig.loginMethods[method];
|
|
72
|
+
const name = config.capitalizeFirstLetter(socialLoginConfig.name || method);
|
|
73
73
|
const orderIndex = socialLoginsConfig.loginMethodsOrder.indexOf(method) + 1;
|
|
74
74
|
const order = orderIndex || Object.keys(socialLoginsConfig.loginMethods).length + 1;
|
|
75
|
-
const isMainOption =
|
|
75
|
+
const isMainOption = socialLoginConfig.mainOption;
|
|
76
76
|
const isPrimaryBtn = (socialLoginsConfig === null || socialLoginsConfig === void 0 || (_socialLoginsConfig$u = socialLoginsConfig.uiConfig) === null || _socialLoginsConfig$u === void 0 ? void 0 : _socialLoginsConfig$u.primaryButton) === "socialLogin" && order === 1;
|
|
77
77
|
const providerIcon = getProviderIcon(method, isDark, isPrimaryBtn);
|
|
78
|
-
if (
|
|
78
|
+
if (socialLoginConfig.showOnModal === false || restrictedLoginMethods.includes(method)) {
|
|
79
79
|
return null;
|
|
80
80
|
}
|
|
81
81
|
const loginMethodSpan = classNames("w3a-adapter-item", (socialLoginsConfig === null || socialLoginsConfig === void 0 || (_socialLoginsConfig$u2 = socialLoginsConfig.uiConfig) === null || _socialLoginsConfig$u2 === void 0 ? void 0 : _socialLoginsConfig$u2.loginGridCol) === 2 ? "w3a--col-span-3" : "w3a--col-span-2");
|
|
82
82
|
if (isMainOption || order === 1) {
|
|
83
|
-
return
|
|
83
|
+
return jsxRuntime.jsx("li", {
|
|
84
84
|
className: "w3a--col-span-6 w3a-adapter-item",
|
|
85
85
|
style: {
|
|
86
86
|
order
|
|
87
87
|
},
|
|
88
|
-
children:
|
|
88
|
+
children: jsxRuntime.jsxs(Button, {
|
|
89
89
|
variant: "secondary",
|
|
90
90
|
onClick: () => handleSocialLoginClick({
|
|
91
91
|
connector: socialLoginsConfig.connector,
|
|
92
92
|
loginParams: {
|
|
93
|
-
|
|
94
|
-
name,
|
|
93
|
+
authConnection: method,
|
|
94
|
+
name: socialLoginConfig.name,
|
|
95
|
+
authConnectionId: socialLoginConfig.authConnectionId,
|
|
96
|
+
groupedAuthConnectionId: socialLoginConfig.groupedAuthConnectionId,
|
|
95
97
|
login_hint: ""
|
|
96
98
|
}
|
|
97
99
|
}),
|
|
98
100
|
className: "w3a--w-full",
|
|
99
101
|
title: name,
|
|
100
|
-
children: [providerIcon,
|
|
102
|
+
children: [providerIcon, jsxRuntime.jsx("p", {
|
|
101
103
|
className: "w3a--ml-2",
|
|
102
104
|
children: t("modal.social.continueCustom", {
|
|
103
105
|
adapter: name
|
|
@@ -106,18 +108,20 @@ function SocialLogins(props) {
|
|
|
106
108
|
})
|
|
107
109
|
}, method);
|
|
108
110
|
}
|
|
109
|
-
return
|
|
111
|
+
return jsxRuntime.jsx("li", {
|
|
110
112
|
className: loginMethodSpan,
|
|
111
113
|
style: {
|
|
112
114
|
order: order + loginMethodsCount
|
|
113
115
|
},
|
|
114
|
-
children:
|
|
116
|
+
children: jsxRuntime.jsx(Button, {
|
|
115
117
|
variant: "secondary",
|
|
116
118
|
onClick: () => handleSocialLoginClick({
|
|
117
119
|
connector: socialLoginsConfig.connector,
|
|
118
120
|
loginParams: {
|
|
119
|
-
|
|
120
|
-
name,
|
|
121
|
+
authConnection: method,
|
|
122
|
+
name: socialLoginConfig.name,
|
|
123
|
+
authConnectionId: socialLoginConfig.authConnectionId,
|
|
124
|
+
groupedAuthConnectionId: socialLoginConfig.groupedAuthConnectionId,
|
|
121
125
|
login_hint: ""
|
|
122
126
|
}
|
|
123
127
|
}),
|
|
@@ -127,16 +131,16 @@ function SocialLogins(props) {
|
|
|
127
131
|
})
|
|
128
132
|
}, method);
|
|
129
133
|
})
|
|
130
|
-
}),
|
|
134
|
+
}), jsxRuntime.jsx("div", {
|
|
131
135
|
className: "w3a-social__policy",
|
|
132
136
|
children: t("modal.social.policy")
|
|
133
|
-
}), canShowMore &&
|
|
137
|
+
}), canShowMore && jsxRuntime.jsx("div", {
|
|
134
138
|
className: "w3a--text-right",
|
|
135
|
-
children:
|
|
139
|
+
children: jsxRuntime.jsx("button", {
|
|
136
140
|
type: "button",
|
|
137
141
|
className: adapterButtonClass,
|
|
138
142
|
onClick: expandClickHandler,
|
|
139
|
-
children:
|
|
143
|
+
children: jsxRuntime.jsx("span", {
|
|
140
144
|
className: "w3ajs-button-expand-text",
|
|
141
145
|
children: adapterExpandText
|
|
142
146
|
})
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
3
4
|
var Bowser = require('bowser');
|
|
4
5
|
var copyToClipboard = require('copy-to-clipboard');
|
|
5
6
|
var React = require('react');
|
|
@@ -8,7 +9,6 @@ var reactQrcodeLogo = require('react-qrcode-logo');
|
|
|
8
9
|
var ThemeContext = require('../context/ThemeContext.js');
|
|
9
10
|
var interfaces = require('../interfaces.js');
|
|
10
11
|
var localeImport = require('../localeImport.js');
|
|
11
|
-
var jsxRuntime = require('react/jsx-runtime');
|
|
12
12
|
|
|
13
13
|
function WalletConnect(props) {
|
|
14
14
|
var _getComputedStyle;
|
|
@@ -40,24 +40,24 @@ function WalletConnect(props) {
|
|
|
40
40
|
const blackColor = "#000000";
|
|
41
41
|
const modalColor = ((_getComputedStyle = getComputedStyle(root)) === null || _getComputedStyle === void 0 || (_getComputedStyle = _getComputedStyle.getPropertyValue("--app-gray-800")) === null || _getComputedStyle === void 0 ? void 0 : _getComputedStyle.trim()) || "#1f2a37";
|
|
42
42
|
const qrColor = primaryColor.toLowerCase() === "#ffffff" ? "#000000" : primaryColor;
|
|
43
|
-
return
|
|
43
|
+
return jsxRuntime.jsx("div", {
|
|
44
44
|
className: "w3ajs-wallet-connect w3a-wallet-connect",
|
|
45
|
-
children:
|
|
45
|
+
children: jsxRuntime.jsx("div", {
|
|
46
46
|
className: "w3ajs-wallet-connect__container w3a-wallet-connect__container",
|
|
47
|
-
children:
|
|
47
|
+
children: jsxRuntime.jsxs("div", {
|
|
48
48
|
className: "w3a-wallet-connect__container-desktop",
|
|
49
|
-
children: [
|
|
49
|
+
children: [jsxRuntime.jsxs("div", {
|
|
50
50
|
className: "w3ajs-wallet-connect-qr w3a-wallet-connect-qr w3a--rounded-md w3a--mb-2",
|
|
51
51
|
tabIndex: 0,
|
|
52
52
|
role: "button",
|
|
53
53
|
onClick: handleCopy,
|
|
54
54
|
onKeyDown: () => copyToClipboard(walletConnectUri),
|
|
55
|
-
children: [isCopied &&
|
|
55
|
+
children: [isCopied && jsxRuntime.jsxs("div", {
|
|
56
56
|
className: "tooltip",
|
|
57
|
-
children: ["Copied",
|
|
57
|
+
children: ["Copied", jsxRuntime.jsx("div", {
|
|
58
58
|
className: "w3a--absolute w3a--border-8 w3a--border-b-0 w3a--border-r-transparent w3a--border-t-app-gray-900 w3a--border-l-transparent w3a--top-[100%] w3a--left-[calc(50%_-_8px)]"
|
|
59
59
|
})]
|
|
60
|
-
}),
|
|
60
|
+
}), jsxRuntime.jsx(reactQrcodeLogo.QRCode, {
|
|
61
61
|
size: isDesktop ? 300 : 260,
|
|
62
62
|
eyeRadius: 5,
|
|
63
63
|
qrStyle: "dots",
|
|
@@ -71,7 +71,7 @@ function WalletConnect(props) {
|
|
|
71
71
|
bgColor: isDark ? modalColor : whiteColor,
|
|
72
72
|
fgColor: isDark ? whiteColor : blackColor
|
|
73
73
|
})]
|
|
74
|
-
}),
|
|
74
|
+
}), jsxRuntime.jsx("div", {
|
|
75
75
|
className: "text-xs",
|
|
76
76
|
children: t("modal.external.walletconnect-copy")
|
|
77
77
|
})]
|
|
@@ -5,8 +5,8 @@ var auth = require('@web3auth/auth');
|
|
|
5
5
|
function capitalizeFirstLetter(string) {
|
|
6
6
|
return string.charAt(0).toUpperCase() + string.slice(1);
|
|
7
7
|
}
|
|
8
|
-
const restrictedLoginMethods = new Set([auth.
|
|
9
|
-
const AUTH_PROVIDERS = Object.values(auth.
|
|
8
|
+
const restrictedLoginMethods = new Set([auth.AUTH_CONNECTION.CUSTOM, auth.AUTH_CONNECTION.PASSKEYS, auth.AUTH_CONNECTION.TELEGRAM, auth.AUTH_CONNECTION.AUTHENTICATOR]);
|
|
9
|
+
const AUTH_PROVIDERS = Object.values(auth.AUTH_CONNECTION).filter(x => !restrictedLoginMethods.has(x));
|
|
10
10
|
const AUTH_PROVIDERS_NAMES = AUTH_PROVIDERS.reduce((acc, x) => {
|
|
11
11
|
if (x === "email_passwordless") acc[x] = "Email";else if (x === "sms_passwordless") acc[x] = "Mobile";else acc[x] = capitalizeFirstLetter(x);
|
|
12
12
|
return acc;
|