@web3auth/modal 11.0.0-beta.0 → 11.0.0-beta.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/README.md +4 -0
- package/dist/lib.cjs/packages/modal/src/account-linking/index.js +12 -0
- package/dist/lib.cjs/packages/modal/src/account-linking/react.js +22 -0
- package/dist/lib.cjs/packages/modal/src/account-linking/vue.js +22 -0
- package/dist/lib.cjs/packages/modal/src/config.js +1 -1
- package/dist/lib.cjs/packages/modal/src/modalManager.js +446 -26
- package/dist/lib.cjs/packages/modal/src/react/index.js +7 -3
- package/dist/lib.cjs/packages/modal/src/react/wagmi/provider.js +27 -12
- package/dist/lib.cjs/packages/modal/src/ui/components/BottomSheet/BottomSheet.js +13 -13
- package/dist/lib.cjs/packages/modal/src/ui/components/Button/ButtonSocial/ButtonSocial.js +4 -4
- package/dist/lib.cjs/packages/modal/src/ui/components/Button/ButtonWallet/ButtonWallet.js +10 -10
- package/dist/lib.cjs/packages/modal/src/ui/components/Footer/Footer.js +7 -7
- package/dist/lib.cjs/packages/modal/src/ui/components/Image/Image.js +4 -4
- package/dist/lib.cjs/packages/modal/src/ui/components/Loader/Loader.js +28 -28
- package/dist/lib.cjs/packages/modal/src/ui/components/LoginHint/LoginHint.js +3 -3
- package/dist/lib.cjs/packages/modal/src/ui/components/Modal/Modal.js +19 -19
- package/dist/lib.cjs/packages/modal/src/ui/components/Otp/Otp.js +10 -10
- package/dist/lib.cjs/packages/modal/src/ui/components/PulseLoader/PulseLoader.js +4 -4
- package/dist/lib.cjs/packages/modal/src/ui/components/SocialLoginList/SocialLoginList.js +21 -21
- package/dist/lib.cjs/packages/modal/src/ui/components/SpinnerLoader/SpinnerLoader.js +1 -1
- package/dist/lib.cjs/packages/modal/src/ui/components/Toast/Toast.js +11 -11
- package/dist/lib.cjs/packages/modal/src/ui/config.js +3 -1
- package/dist/lib.cjs/packages/modal/src/ui/containers/AccountLinking/AccountLinking.js +109 -0
- package/dist/lib.cjs/packages/modal/src/ui/containers/ConnectWallet/ConnectWallet.js +14 -3
- package/dist/lib.cjs/packages/modal/src/ui/containers/ConnectWallet/ConnectWalletChainFilter/ConnectWalletChainFilter.js +7 -7
- package/dist/lib.cjs/packages/modal/src/ui/containers/ConnectWallet/ConnectWalletChainNamespaceSelect/ConnectWalletChainNamespaceSelect.js +9 -9
- package/dist/lib.cjs/packages/modal/src/ui/containers/ConnectWallet/ConnectWalletHeader/ConnectWalletHeader.js +9 -8
- package/dist/lib.cjs/packages/modal/src/ui/containers/ConnectWallet/ConnectWalletList/ConnectWalletList.js +19 -19
- package/dist/lib.cjs/packages/modal/src/ui/containers/ConnectWallet/ConnectWalletQrCode/ConnectWalletQrCode.js +8 -8
- package/dist/lib.cjs/packages/modal/src/ui/containers/ConnectWallet/ConnectWalletSearch/ConnectWalletSearch.js +5 -5
- package/dist/lib.cjs/packages/modal/src/ui/containers/Embed/Embed.js +11 -11
- package/dist/lib.cjs/packages/modal/src/ui/containers/Login/Login.js +48 -42
- package/dist/lib.cjs/packages/modal/src/ui/containers/Login/LoginOtp/LoginOtp.js +11 -11
- package/dist/lib.cjs/packages/modal/src/ui/containers/Login/LoginPasswordLess/LoginPasswordLess.js +13 -13
- package/dist/lib.cjs/packages/modal/src/ui/containers/Root/Root.js +24 -9
- package/dist/lib.cjs/packages/modal/src/ui/containers/Root/RootBodySheets/RootBodySheets.js +16 -16
- package/dist/lib.cjs/packages/modal/src/ui/containers/Widget/Widget.js +6 -2
- package/dist/lib.cjs/packages/modal/src/ui/context/ModalStateContext.js +1 -0
- package/dist/lib.cjs/packages/modal/src/ui/css/index.css.js +1 -1
- package/dist/lib.cjs/packages/modal/src/ui/i18n/dutch.json.js +14 -0
- package/dist/lib.cjs/packages/modal/src/ui/i18n/english.json.js +14 -0
- package/dist/lib.cjs/packages/modal/src/ui/i18n/french.json.js +14 -0
- package/dist/lib.cjs/packages/modal/src/ui/i18n/german.json.js +14 -0
- package/dist/lib.cjs/packages/modal/src/ui/i18n/japanese.json.js +26 -12
- package/dist/lib.cjs/packages/modal/src/ui/i18n/korean.json.js +14 -0
- package/dist/lib.cjs/packages/modal/src/ui/i18n/mandarin.json.js +14 -0
- package/dist/lib.cjs/packages/modal/src/ui/i18n/portuguese.json.js +14 -0
- package/dist/lib.cjs/packages/modal/src/ui/i18n/spanish.json.js +14 -0
- package/dist/lib.cjs/packages/modal/src/ui/i18n/turkish.json.js +14 -0
- package/dist/lib.cjs/packages/modal/src/ui/interfaces.js +26 -0
- package/dist/lib.cjs/packages/modal/src/ui/loginModal.js +113 -4
- package/dist/lib.cjs/packages/modal/src/vue/index.js +7 -3
- package/dist/lib.cjs/packages/modal/src/vue/wagmi/provider.js +27 -14
- package/dist/lib.cjs/types/account-linking/index.d.ts +1 -0
- package/dist/lib.cjs/types/account-linking/react.d.ts +2 -0
- package/dist/lib.cjs/types/account-linking/vue.d.ts +2 -0
- package/dist/lib.cjs/types/modalManager.d.ts +40 -2
- package/dist/lib.cjs/types/react/hooks/index.d.ts +1 -0
- package/dist/lib.cjs/types/react/hooks/useWallets.d.ts +2 -0
- package/dist/lib.cjs/types/ui/containers/AccountLinking/AccountLinking.d.ts +6 -0
- package/dist/lib.cjs/types/ui/containers/AccountLinking/index.d.ts +1 -0
- package/dist/lib.cjs/types/ui/containers/ConnectWallet/ConnectWalletHeader/ConnectWalletHeader.type.d.ts +1 -0
- package/dist/lib.cjs/types/ui/containers/Root/Root.d.ts +1 -1
- package/dist/lib.cjs/types/ui/interfaces.d.ts +43 -8
- package/dist/lib.cjs/types/ui/loginModal.d.ts +27 -2
- package/dist/lib.cjs/types/ui/utils.d.ts +1 -1
- package/dist/lib.cjs/types/vue/composables/index.d.ts +1 -0
- package/dist/lib.cjs/types/vue/composables/useWallets.d.ts +2 -0
- package/dist/lib.esm/packages/modal/src/account-linking/index.js +1 -0
- package/dist/lib.esm/packages/modal/src/account-linking/react.js +1 -0
- package/dist/lib.esm/packages/modal/src/account-linking/vue.js +1 -0
- package/dist/lib.esm/packages/modal/src/config.js +1 -1
- package/dist/lib.esm/packages/modal/src/modalManager.js +451 -28
- package/dist/lib.esm/packages/modal/src/react/index.js +1 -1
- package/dist/lib.esm/packages/modal/src/react/wagmi/provider.js +28 -13
- package/dist/lib.esm/packages/modal/src/ui/components/BottomSheet/BottomSheet.js +13 -13
- package/dist/lib.esm/packages/modal/src/ui/components/Button/ButtonSocial/ButtonSocial.js +4 -4
- package/dist/lib.esm/packages/modal/src/ui/components/Button/ButtonWallet/ButtonWallet.js +10 -10
- package/dist/lib.esm/packages/modal/src/ui/components/Footer/Footer.js +7 -7
- package/dist/lib.esm/packages/modal/src/ui/components/Image/Image.js +4 -4
- package/dist/lib.esm/packages/modal/src/ui/components/Loader/Loader.js +28 -28
- package/dist/lib.esm/packages/modal/src/ui/components/LoginHint/LoginHint.js +3 -3
- package/dist/lib.esm/packages/modal/src/ui/components/Modal/Modal.js +19 -19
- package/dist/lib.esm/packages/modal/src/ui/components/Otp/Otp.js +10 -10
- package/dist/lib.esm/packages/modal/src/ui/components/PulseLoader/PulseLoader.js +4 -4
- package/dist/lib.esm/packages/modal/src/ui/components/SocialLoginList/SocialLoginList.js +21 -21
- package/dist/lib.esm/packages/modal/src/ui/components/SpinnerLoader/SpinnerLoader.js +1 -1
- package/dist/lib.esm/packages/modal/src/ui/components/Toast/Toast.js +11 -11
- package/dist/lib.esm/packages/modal/src/ui/config.js +3 -1
- package/dist/lib.esm/packages/modal/src/ui/containers/AccountLinking/AccountLinking.js +107 -0
- package/dist/lib.esm/packages/modal/src/ui/containers/ConnectWallet/ConnectWallet.js +14 -3
- package/dist/lib.esm/packages/modal/src/ui/containers/ConnectWallet/ConnectWalletChainFilter/ConnectWalletChainFilter.js +7 -7
- package/dist/lib.esm/packages/modal/src/ui/containers/ConnectWallet/ConnectWalletChainNamespaceSelect/ConnectWalletChainNamespaceSelect.js +9 -9
- package/dist/lib.esm/packages/modal/src/ui/containers/ConnectWallet/ConnectWalletHeader/ConnectWalletHeader.js +9 -8
- package/dist/lib.esm/packages/modal/src/ui/containers/ConnectWallet/ConnectWalletList/ConnectWalletList.js +19 -19
- package/dist/lib.esm/packages/modal/src/ui/containers/ConnectWallet/ConnectWalletQrCode/ConnectWalletQrCode.js +8 -8
- package/dist/lib.esm/packages/modal/src/ui/containers/ConnectWallet/ConnectWalletSearch/ConnectWalletSearch.js +5 -5
- package/dist/lib.esm/packages/modal/src/ui/containers/Embed/Embed.js +11 -11
- package/dist/lib.esm/packages/modal/src/ui/containers/Login/Login.js +49 -43
- package/dist/lib.esm/packages/modal/src/ui/containers/Login/LoginOtp/LoginOtp.js +11 -11
- package/dist/lib.esm/packages/modal/src/ui/containers/Login/LoginPasswordLess/LoginPasswordLess.js +13 -13
- package/dist/lib.esm/packages/modal/src/ui/containers/Root/Root.js +24 -9
- package/dist/lib.esm/packages/modal/src/ui/containers/Root/RootBodySheets/RootBodySheets.js +16 -16
- package/dist/lib.esm/packages/modal/src/ui/containers/Widget/Widget.js +6 -2
- package/dist/lib.esm/packages/modal/src/ui/context/ModalStateContext.js +2 -1
- package/dist/lib.esm/packages/modal/src/ui/css/index.css.js +1 -1
- package/dist/lib.esm/packages/modal/src/ui/i18n/dutch.json.js +14 -0
- package/dist/lib.esm/packages/modal/src/ui/i18n/english.json.js +14 -0
- package/dist/lib.esm/packages/modal/src/ui/i18n/french.json.js +14 -0
- package/dist/lib.esm/packages/modal/src/ui/i18n/german.json.js +14 -0
- package/dist/lib.esm/packages/modal/src/ui/i18n/japanese.json.js +26 -12
- package/dist/lib.esm/packages/modal/src/ui/i18n/korean.json.js +14 -0
- package/dist/lib.esm/packages/modal/src/ui/i18n/mandarin.json.js +14 -0
- package/dist/lib.esm/packages/modal/src/ui/i18n/portuguese.json.js +14 -0
- package/dist/lib.esm/packages/modal/src/ui/i18n/spanish.json.js +14 -0
- package/dist/lib.esm/packages/modal/src/ui/i18n/turkish.json.js +14 -0
- package/dist/lib.esm/packages/modal/src/ui/interfaces.js +24 -1
- package/dist/lib.esm/packages/modal/src/ui/loginModal.js +115 -6
- package/dist/lib.esm/packages/modal/src/vue/index.js +1 -1
- package/dist/lib.esm/packages/modal/src/vue/wagmi/provider.js +28 -15
- package/package.json +43 -20
|
@@ -49,12 +49,12 @@ function ConnectWalletQrCode(props) {
|
|
|
49
49
|
const modalColor = ((_getComputedStyle = getComputedStyle(root)) === null || _getComputedStyle === void 0 || (_getComputedStyle = _getComputedStyle.getPropertyValue("--app-gray-800")) === null || _getComputedStyle === void 0 ? void 0 : _getComputedStyle.trim()) || "#1f2a37";
|
|
50
50
|
const qrColor = primaryColor && primaryColor.toLowerCase() === "#ffffff" ? "#000000" : primaryColor;
|
|
51
51
|
return /*#__PURE__*/jsxs("div", {
|
|
52
|
-
className: "
|
|
52
|
+
className: "wta:contents",
|
|
53
53
|
children: [qrCodeValue ? /*#__PURE__*/jsxs("div", {
|
|
54
|
-
className: "
|
|
54
|
+
className: "wta:flex wta:flex-col wta:items-center wta:justify-center wta:gap-y-4 wta:rounded-2xl wta:border wta:border-app-gray-200 wta:p-4 wta:dark:border-app-gray-700",
|
|
55
55
|
children: [/*#__PURE__*/jsx("button", {
|
|
56
56
|
type: "button",
|
|
57
|
-
className: "
|
|
57
|
+
className: "wta:relative wta:flex wta:size-[300px] wta:appearance-none wta:items-center wta:justify-center wta:rounded-2xl",
|
|
58
58
|
onClick: () => {
|
|
59
59
|
navigator.clipboard.writeText(qrCodeValue);
|
|
60
60
|
setToast({
|
|
@@ -77,11 +77,11 @@ function ConnectWalletQrCode(props) {
|
|
|
77
77
|
fgColor: isDark ? whiteColor : blackColor
|
|
78
78
|
})
|
|
79
79
|
}), /*#__PURE__*/jsx("p", {
|
|
80
|
-
className: "
|
|
80
|
+
className: "wta:text-center wta:text-sm wta:font-normal wta:text-app-gray-500 wta:dark:text-app-gray-300",
|
|
81
81
|
children: t("modal.external.walletconnect-copy")
|
|
82
82
|
})]
|
|
83
83
|
}) : /*#__PURE__*/jsx("div", {
|
|
84
|
-
className: "
|
|
84
|
+
className: "wta:mx-auto wta:flex wta:size-[300px] wta:animate-pulse wta:items-center wta:justify-center wta:rounded-lg wta:bg-app-gray-200 wta:p-2 wta:dark:bg-app-gray-700",
|
|
85
85
|
children: /*#__PURE__*/jsx(Image, {
|
|
86
86
|
imageId: `login-${selectedButton.name}`,
|
|
87
87
|
hoverImageId: `login-${selectedButton.name}`,
|
|
@@ -92,15 +92,15 @@ function ConnectWalletQrCode(props) {
|
|
|
92
92
|
extension: selectedButton.imgExtension
|
|
93
93
|
})
|
|
94
94
|
}), showGetWalletComponent && /*#__PURE__*/jsxs("div", {
|
|
95
|
-
className: "
|
|
95
|
+
className: "wta:flex wta:w-full wta:items-center wta:justify-between wta:rounded-2xl wta:bg-app-gray-50 wta:px-4 wta:py-2 wta:text-app-gray-900 wta:dark:bg-app-gray-800 wta:dark:text-app-white",
|
|
96
96
|
children: [/*#__PURE__*/jsxs("p", {
|
|
97
|
-
className: "
|
|
97
|
+
className: "wta:text-sm wta:text-app-gray-900 wta:dark:text-app-white",
|
|
98
98
|
children: [t("modal.external.dont-have"), " ", /*#__PURE__*/jsx("span", {
|
|
99
99
|
children: selectedButton === null || selectedButton === void 0 ? void 0 : selectedButton.displayName
|
|
100
100
|
}), "?"]
|
|
101
101
|
}), /*#__PURE__*/jsx("button", {
|
|
102
102
|
type: "button",
|
|
103
|
-
className: "
|
|
103
|
+
className: "wta:appearance-none wta:rounded-full wta:border wta:border-app-gray-200 wta:bg-transparent wta:px-5 wta:py-2 wta:text-base wta:font-normal wta:text-app-gray-700 wta:transition-all wta:duration-150 wta:hover:border-transparent wta:hover:shadow-light wta:active:scale-95 wta:dark:border-app-gray-700 wta:dark:text-app-gray-300 wta:dark:hover:border-transparent wta:dark:hover:shadow-dark",
|
|
104
104
|
onClick: () => {
|
|
105
105
|
setBodyState(_objectSpread(_objectSpread({}, bodyState), {}, {
|
|
106
106
|
installLinks: {
|
|
@@ -30,7 +30,7 @@ function ConnectWalletSearch(props) {
|
|
|
30
30
|
// const isShowSearch = totalExternalWalletCount > 15 && !isLoading;
|
|
31
31
|
|
|
32
32
|
// if (!isShowSearch) {
|
|
33
|
-
// return <div className="
|
|
33
|
+
// return <div className="wta:h-[50px] wta:w-full wta:animate-pulse wta:rounded-full wta:bg-app-gray-200 wta:dark:bg-app-gray-700" />;
|
|
34
34
|
// }
|
|
35
35
|
|
|
36
36
|
return /*#__PURE__*/jsx("input", {
|
|
@@ -51,10 +51,10 @@ function ConnectWalletSearch(props) {
|
|
|
51
51
|
count: totalExternalWalletCount
|
|
52
52
|
}),
|
|
53
53
|
disabled: isLoading,
|
|
54
|
-
className: cn("w3a--input
|
|
55
|
-
"
|
|
56
|
-
"
|
|
57
|
-
"
|
|
54
|
+
className: cn("w3a--input wta:appearance-none wta:outline-none wta:active:outline-none wta:focus:outline-none wta:bg-transparent wta:placeholder:text-app-gray-400 wta:dark:placeholder:text-app-gray-500 wta:text-app-gray-900 wta:dark:text-app-white", isInputFocused && "wta:border-app-primary-600!", {
|
|
55
|
+
"wta:rounded-full": buttonRadius === "pill",
|
|
56
|
+
"wta:rounded-lg": buttonRadius === "rounded",
|
|
57
|
+
"wta:rounded-none": buttonRadius === "square"
|
|
58
58
|
})
|
|
59
59
|
});
|
|
60
60
|
}
|
|
@@ -35,18 +35,18 @@ function Embed(props) {
|
|
|
35
35
|
};
|
|
36
36
|
if (!isOpen) return null;
|
|
37
37
|
return /*#__PURE__*/jsxs("div", {
|
|
38
|
-
className: cn("
|
|
39
|
-
"
|
|
40
|
-
"
|
|
41
|
-
"
|
|
42
|
-
"
|
|
43
|
-
"
|
|
44
|
-
"
|
|
45
|
-
"
|
|
46
|
-
"
|
|
38
|
+
className: cn("wta:bg-app-light-surface1 wta:dark:bg-app-dark-surface-main wta:rounded-3xl wta:w-[356px] wta:[@media(min-width:375px)]:w-[393px] wta:h-auto wta:flex wta:flex-col wta:duration-500", {
|
|
39
|
+
"wta:translate-y-0 wta:delay-100": isOpen,
|
|
40
|
+
"wta:translate-y-[100vh]": !isOpen,
|
|
41
|
+
"wta:p-4": padding,
|
|
42
|
+
"wta:shadow-xl wta:sm:shadow-lg": shadow,
|
|
43
|
+
"wta:border wta:border-app-gray-100 wta:dark:border-app-gray-800": border,
|
|
44
|
+
"wta:rounded-[30px]": borderRadius === "large",
|
|
45
|
+
"wta:rounded-2xl": borderRadius === "medium",
|
|
46
|
+
"wta:rounded-none": borderRadius === "small"
|
|
47
47
|
}),
|
|
48
48
|
children: [showCloseIcon && /*#__PURE__*/jsx("div", {
|
|
49
|
-
className: "
|
|
49
|
+
className: "wta:absolute wta:right-6 wta:top-[30px] wta:z-10 wta:cursor-pointer",
|
|
50
50
|
children: /*#__PURE__*/jsx("svg", {
|
|
51
51
|
width: "13",
|
|
52
52
|
height: "13",
|
|
@@ -54,7 +54,7 @@ function Embed(props) {
|
|
|
54
54
|
fill: "none",
|
|
55
55
|
xmlns: "http://www.w3.org/2000/svg",
|
|
56
56
|
onClick: onCloseHandler,
|
|
57
|
-
className: "
|
|
57
|
+
className: "wta:text-app-gray-900 wta:dark:text-app-white",
|
|
58
58
|
children: /*#__PURE__*/jsx("path", {
|
|
59
59
|
fillRule: "evenodd",
|
|
60
60
|
clipRule: "evenodd",
|
|
@@ -2,7 +2,7 @@ import _objectSpread from '@babel/runtime/helpers/objectSpread2';
|
|
|
2
2
|
import HCaptcha from '@hcaptcha/react-hcaptcha';
|
|
3
3
|
import { AUTH_CONNECTION } from '@web3auth/auth';
|
|
4
4
|
import { WALLET_CONNECTORS, ANALYTICS_EVENTS, log, WalletLoginError } from '@web3auth/no-modal';
|
|
5
|
-
import { useContext, useState, useRef,
|
|
5
|
+
import { useContext, useState, useRef, useMemo, useEffect, useCallback } from 'react';
|
|
6
6
|
import { useTranslation } from 'react-i18next';
|
|
7
7
|
import Image from '../../components/Image/Image.js';
|
|
8
8
|
import SocialLoginList from '../../components/SocialLoginList/SocialLoginList.js';
|
|
@@ -20,7 +20,9 @@ import LoginOtp from './LoginOtp/LoginOtp.js';
|
|
|
20
20
|
import LoginPasswordLess from './LoginPasswordLess/LoginPasswordLess.js';
|
|
21
21
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
22
22
|
|
|
23
|
-
const restrictedLoginMethods = [AUTH_CONNECTION.SMS_PASSWORDLESS, AUTH_CONNECTION.EMAIL_PASSWORDLESS, AUTH_CONNECTION.AUTHENTICATOR, AUTH_CONNECTION.PASSKEYS, AUTH_CONNECTION.TELEGRAM, AUTH_CONNECTION.CUSTOM
|
|
23
|
+
const restrictedLoginMethods = [AUTH_CONNECTION.SMS_PASSWORDLESS, AUTH_CONNECTION.EMAIL_PASSWORDLESS, AUTH_CONNECTION.AUTHENTICATOR, AUTH_CONNECTION.PASSKEYS, AUTH_CONNECTION.TELEGRAM, AUTH_CONNECTION.CUSTOM,
|
|
24
|
+
// Farcaster login is deprecated and no longer supported by the Web3Auth SDKs.
|
|
25
|
+
AUTH_CONNECTION.FARCASTER];
|
|
24
26
|
function Login(props) {
|
|
25
27
|
const {
|
|
26
28
|
installedExternalWalletConfig,
|
|
@@ -74,10 +76,6 @@ function Login(props) {
|
|
|
74
76
|
const [passwordlessErrorMessage, setPasswordlessErrorMessage] = useState("");
|
|
75
77
|
const [otpErrorMessage, setOtpErrorMessage] = useState("");
|
|
76
78
|
const [expandSocialLogins, setExpandSocialLogins] = useState(false);
|
|
77
|
-
const [canShowMore, setCanShowMore] = useState(false);
|
|
78
|
-
const [visibleRow, setVisibleRow] = useState([]);
|
|
79
|
-
const [otherRow, setOtherRow] = useState([]);
|
|
80
|
-
const [mainOptionsRow, setMainOptionsRow] = useState([]);
|
|
81
79
|
const [isPasswordLessCtaClicked, setIsPasswordLessCtaClicked] = useState(false);
|
|
82
80
|
const [showOtpFlow, setShowOtpFlow] = useState(false);
|
|
83
81
|
const [authConnection, setAuthConnection] = useState(undefined);
|
|
@@ -91,7 +89,12 @@ function Login(props) {
|
|
|
91
89
|
setExpandSocialLogins(prev => !prev);
|
|
92
90
|
setIsPasswordLessCtaClicked(false);
|
|
93
91
|
};
|
|
94
|
-
|
|
92
|
+
const {
|
|
93
|
+
visibleRow,
|
|
94
|
+
otherRow,
|
|
95
|
+
mainOptionsRow,
|
|
96
|
+
canShowMore
|
|
97
|
+
} = useMemo(() => {
|
|
95
98
|
const maxOptions = Object.keys(socialLoginsConfig.loginMethods).filter(loginMethodKey => {
|
|
96
99
|
return socialLoginsConfig.loginMethods[loginMethodKey].showOnModal && !restrictedLoginMethods.includes(loginMethodKey);
|
|
97
100
|
});
|
|
@@ -161,11 +164,13 @@ function Login(props) {
|
|
|
161
164
|
}
|
|
162
165
|
otherRows.push(rows);
|
|
163
166
|
});
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
167
|
+
return {
|
|
168
|
+
visibleRow: visibleRows,
|
|
169
|
+
otherRow: otherRows,
|
|
170
|
+
mainOptionsRow: mainOptionsRows,
|
|
171
|
+
canShowMore: maxOptions.length > 4
|
|
172
|
+
};
|
|
173
|
+
}, [socialLoginsConfig, isDark]);
|
|
169
174
|
const handleCustomLogin = async (authConnection, loginHint) => {
|
|
170
175
|
try {
|
|
171
176
|
const handler = createPasswordlessHandler(authConnection, {
|
|
@@ -248,7 +253,7 @@ function Login(props) {
|
|
|
248
253
|
}
|
|
249
254
|
}
|
|
250
255
|
}
|
|
251
|
-
setPasswordlessErrorMessage(
|
|
256
|
+
setPasswordlessErrorMessage(getInvalidInputErrorMessage());
|
|
252
257
|
setIsPasswordLessLoading(false);
|
|
253
258
|
return undefined;
|
|
254
259
|
};
|
|
@@ -262,11 +267,11 @@ function Login(props) {
|
|
|
262
267
|
if (isEmailPasswordLessLoginVisible) return "name@example.com";
|
|
263
268
|
return "+(00)123456";
|
|
264
269
|
}, [isEmailPasswordLessLoginVisible, isSmsPasswordLessLoginVisible]);
|
|
265
|
-
const
|
|
270
|
+
const getInvalidInputErrorMessage = () => {
|
|
266
271
|
if (isEmailPasswordLessLoginVisible && isSmsPasswordLessLoginVisible) return t("modal.errors-invalid-number-email");
|
|
267
272
|
if (isEmailPasswordLessLoginVisible) return t("modal.errors-invalid-email");
|
|
268
273
|
return t("modal.errors-invalid-number");
|
|
269
|
-
}
|
|
274
|
+
};
|
|
270
275
|
useEffect(() => {
|
|
271
276
|
const getLocation = async () => {
|
|
272
277
|
const result = await getUserCountry();
|
|
@@ -379,6 +384,7 @@ function Login(props) {
|
|
|
379
384
|
}, [analytics, handleExternalWalletBtnClick, installedExternalWallets.length, totalExternalWallets]);
|
|
380
385
|
useEffect(() => {
|
|
381
386
|
if (showExternalWalletButton && !areSocialLoginsVisible && !showPasswordLessInput) {
|
|
387
|
+
// eslint-disable-next-line react-hooks/set-state-in-effect -- intentional
|
|
382
388
|
handleConnectWallet();
|
|
383
389
|
}
|
|
384
390
|
}, [showExternalWalletButton, areSocialLoginsVisible, showPasswordLessInput, handleConnectWallet]);
|
|
@@ -422,25 +428,25 @@ function Login(props) {
|
|
|
422
428
|
};
|
|
423
429
|
const externalWalletSection = () => {
|
|
424
430
|
return /*#__PURE__*/jsxs("div", {
|
|
425
|
-
className: cn("
|
|
431
|
+
className: cn("wta:flex wta:w-full wta:flex-col wta:items-start wta:justify-start wta:gap-y-2"),
|
|
426
432
|
children: [installedExternalWallets.length > 0 && installedExternalWallets.map(wallet => /*#__PURE__*/jsxs("button", {
|
|
427
433
|
type: "button",
|
|
428
|
-
className: cn("w3a--btn
|
|
429
|
-
"
|
|
430
|
-
"
|
|
431
|
-
"
|
|
434
|
+
className: cn("w3a--btn wta:justify-between! wta:group wta:relative wta:overflow-hidden", {
|
|
435
|
+
"wta:rounded-full": buttonRadius === "pill",
|
|
436
|
+
"wta:rounded-lg": buttonRadius === "rounded",
|
|
437
|
+
"wta:rounded-none": buttonRadius === "square"
|
|
432
438
|
}),
|
|
433
439
|
onClick: () => handleInstalledWalletClick(wallet),
|
|
434
440
|
children: [/*#__PURE__*/jsx("p", {
|
|
435
|
-
className: "
|
|
441
|
+
className: "wta:max-w-[180px] wta:truncate wta:text-base wta:font-normal wta:text-app-gray-700 wta:dark:text-app-white",
|
|
436
442
|
children: wallet.displayName
|
|
437
443
|
}), /*#__PURE__*/jsxs("div", {
|
|
438
|
-
className: "
|
|
444
|
+
className: "wta:absolute wta:right-4 wta:top-1/2 wta:flex wta:w-auto wta:-translate-y-1/2 wta:items-center wta:gap-x-2 wta:transition-all wta:duration-300 wta:group-hover:translate-x-6 wta:group-hover:opacity-0",
|
|
439
445
|
children: [wallet.hasInjectedWallet && /*#__PURE__*/jsx("span", {
|
|
440
|
-
className: "
|
|
446
|
+
className: "wta:inline-flex wta:items-center wta:rounded-md wta:bg-app-primary-100 wta:px-2 wta:py-1 wta:text-xs wta:font-medium wta:text-app-primary-800 wta:dark:border wta:dark:border-app-primary-400 wta:dark:bg-transparent wta:dark:text-app-primary-400",
|
|
441
447
|
children: t("modal.external.installed")
|
|
442
448
|
}), /*#__PURE__*/jsx("figure", {
|
|
443
|
-
className: "
|
|
449
|
+
className: "wta:size-5",
|
|
444
450
|
children: /*#__PURE__*/jsx(Image, {
|
|
445
451
|
imageData: wallet.icon,
|
|
446
452
|
imageId: `login-${wallet.name}`,
|
|
@@ -454,28 +460,28 @@ function Login(props) {
|
|
|
454
460
|
})]
|
|
455
461
|
}), /*#__PURE__*/jsx("img", {
|
|
456
462
|
id: "injected-wallet-arrow",
|
|
457
|
-
className: "
|
|
463
|
+
className: "wta:absolute wta:right-4 wta:top-1/2 wta:-translate-x-10 wta:-translate-y-1/2 wta:opacity-0 wta:transition-all wta:duration-300 wta:group-hover:translate-x-0 wta:group-hover:opacity-100",
|
|
458
464
|
src: getIcons(isDark ? "chevron-right-dark" : "chevron-right-light"),
|
|
459
465
|
alt: "arrow"
|
|
460
466
|
})]
|
|
461
467
|
}, wallet.name)), remainingUndisplayedWallets > 0 && /*#__PURE__*/jsxs("button", {
|
|
462
468
|
type: "button",
|
|
463
|
-
className: cn("w3a--btn
|
|
464
|
-
"
|
|
465
|
-
"
|
|
466
|
-
"
|
|
469
|
+
className: cn("w3a--btn wta:justify-between! wta:group wta:relative wta:overflow-hidden", {
|
|
470
|
+
"wta:rounded-full": buttonRadius === "pill",
|
|
471
|
+
"wta:rounded-lg": buttonRadius === "rounded",
|
|
472
|
+
"wta:rounded-none": buttonRadius === "square"
|
|
467
473
|
}),
|
|
468
474
|
onClick: handleConnectWallet,
|
|
469
475
|
children: [/*#__PURE__*/jsx("p", {
|
|
470
|
-
className: "
|
|
476
|
+
className: "wta:text-base wta:font-normal wta:text-app-gray-900 wta:dark:text-app-white",
|
|
471
477
|
children: t("modal.external.all-wallets")
|
|
472
478
|
}), showExternalWalletCount && /*#__PURE__*/jsx("div", {
|
|
473
479
|
id: "external-wallet-count",
|
|
474
|
-
className: "
|
|
480
|
+
className: "wta:absolute wta:right-4 wta:top-1/2 wta:w-auto wta:-translate-y-1/2 wta:rounded-full wta:bg-app-primary-100 wta:px-2.5 wta:py-0.5 wta:text-xs wta:font-medium wta:text-app-primary-800 wta:transition-all wta:delay-300 wta:duration-300 wta:group-hover:translate-x-6 wta:group-hover:opacity-0 wta:group-hover:delay-0 wta:dark:border wta:dark:border-app-primary-500 wta:dark:bg-transparent wta:dark:text-app-primary-500",
|
|
475
481
|
children: remainingUndisplayedWallets
|
|
476
482
|
}), /*#__PURE__*/jsx("img", {
|
|
477
483
|
id: "external-wallet-arrow",
|
|
478
|
-
className: "
|
|
484
|
+
className: "wta:absolute wta:right-4 wta:top-1/2 wta:-translate-x-10 wta:-translate-y-1/2 wta:opacity-0 wta:transition-all wta:duration-300 wta:group-hover:translate-x-0 wta:group-hover:opacity-100",
|
|
479
485
|
src: getIcons(isDark ? "chevron-right-dark" : "chevron-right-light"),
|
|
480
486
|
alt: "arrow"
|
|
481
487
|
})]
|
|
@@ -485,14 +491,14 @@ function Login(props) {
|
|
|
485
491
|
const headerLogo = [DEFAULT_LOGO_DARK, DEFAULT_LOGO_LIGHT].includes(appLogo) ? "" : appLogo;
|
|
486
492
|
const delimiter = index => {
|
|
487
493
|
return /*#__PURE__*/jsxs("div", {
|
|
488
|
-
className: cn("
|
|
494
|
+
className: cn("wta:flex wta:w-full wta:items-center wta:gap-x-2", headerLogo ? "wta:my-2" : "wta:my-4"),
|
|
489
495
|
children: [/*#__PURE__*/jsx("div", {
|
|
490
|
-
className: "
|
|
496
|
+
className: "wta:h-px wta:w-full wta:bg-app-gray-200 wta:dark:bg-app-gray-500"
|
|
491
497
|
}), /*#__PURE__*/jsx("p", {
|
|
492
|
-
className: "
|
|
498
|
+
className: "wta:text-xs wta:font-normal wta:uppercase wta:text-app-gray-400 wta:dark:text-app-gray-400",
|
|
493
499
|
children: "or"
|
|
494
500
|
}), /*#__PURE__*/jsx("div", {
|
|
495
|
-
className: "
|
|
501
|
+
className: "wta:h-px wta:w-full wta:bg-app-gray-200 wta:dark:bg-app-gray-500"
|
|
496
502
|
})]
|
|
497
503
|
}, `section-delimiter-${index}`);
|
|
498
504
|
};
|
|
@@ -542,18 +548,18 @@ function Login(props) {
|
|
|
542
548
|
};
|
|
543
549
|
const socialLoginExpandedView = () => socialLoginSection(otherRow);
|
|
544
550
|
return /*#__PURE__*/jsxs("div", {
|
|
545
|
-
className: "
|
|
551
|
+
className: "wta:flex wta:flex-col wta:items-center wta:gap-y-4 wta:p-2",
|
|
546
552
|
children: [/*#__PURE__*/jsxs("div", {
|
|
547
|
-
className: cn("
|
|
553
|
+
className: cn("wta:flex wta:flex-col wta:items-center wta:justify-center wta:gap-y-2 wta:pt-6", logoAlignment === "center" ? "" : "wta:w-full"),
|
|
548
554
|
children: [headerLogo && /*#__PURE__*/jsx("figure", {
|
|
549
|
-
className: cn("
|
|
555
|
+
className: cn("wta:mx-auto wta:h-12 wta:w-[200px]", logoAlignment === "center" ? "wta:flex wta:justify-center wta:items-center" : "wta:ml-0 wta:w-auto"),
|
|
550
556
|
children: /*#__PURE__*/jsx("img", {
|
|
551
557
|
src: headerLogo,
|
|
552
558
|
alt: "Logo",
|
|
553
|
-
className: "
|
|
559
|
+
className: "wta:size-full wta:object-contain"
|
|
554
560
|
})
|
|
555
561
|
}), /*#__PURE__*/jsx("p", {
|
|
556
|
-
className: cn("
|
|
562
|
+
className: cn("wta:text-app-gray-900 wta:dark:text-app-white", logoAlignment === "center" ? "wta:text-center" : "wta:text-left wta:w-full wta:ml-4", headerLogo ? "wta:text-lg wta:font-semibold" : "wta:text-3xl wta:font-medium"),
|
|
557
563
|
children: t("modal.social.sign-in")
|
|
558
564
|
})]
|
|
559
565
|
}), /*#__PURE__*/jsx(HCaptcha, {
|
|
@@ -567,10 +573,10 @@ function Login(props) {
|
|
|
567
573
|
onError: () => setCaptchaError("passwordless.captcha-default-error"),
|
|
568
574
|
onChalExpired: () => setCaptchaError("passwordless.captcha-default-error")
|
|
569
575
|
}), captchaError && showCaptcha && /*#__PURE__*/jsx("p", {
|
|
570
|
-
className: "
|
|
576
|
+
className: "wta:-mt-2 wta:w-full wta:pl-6 wta:text-start wta:text-xs wta:font-normal wta:text-app-red-500 wta:dark:text-app-red-400",
|
|
571
577
|
children: t(captchaError)
|
|
572
578
|
}), !showCaptcha && /*#__PURE__*/jsxs("div", {
|
|
573
|
-
className: "
|
|
579
|
+
className: "wta:flex wta:w-full wta:flex-col wta:items-center wta:justify-center wta:gap-y-2",
|
|
574
580
|
children: [!expandSocialLogins && defaultView(), expandSocialLogins && socialLoginExpandedView()]
|
|
575
581
|
})]
|
|
576
582
|
});
|
|
@@ -33,16 +33,16 @@ function OtpInput(props) {
|
|
|
33
33
|
}, [loginHint, authConnection, countryFlag]);
|
|
34
34
|
return /*#__PURE__*/jsxs(Fragment, {
|
|
35
35
|
children: [/*#__PURE__*/jsx("div", {
|
|
36
|
-
className: "
|
|
36
|
+
className: "wta:mr-auto wta:flex wta:w-full wta:items-start wta:justify-start",
|
|
37
37
|
children: /*#__PURE__*/jsx("button", {
|
|
38
38
|
type: "button",
|
|
39
|
-
className: "
|
|
39
|
+
className: "wta:z-20 wta:flex wta:size-5 wta:cursor-pointer wta:items-center wta:justify-center wta:rounded-full",
|
|
40
40
|
onClick: () => setShowOtpFlow(false),
|
|
41
41
|
children: /*#__PURE__*/jsx("svg", {
|
|
42
42
|
xmlns: "http://www.w3.org/2000/svg",
|
|
43
43
|
fill: "none",
|
|
44
44
|
viewBox: "0 0 20 20",
|
|
45
|
-
className: "
|
|
45
|
+
className: "wta:text-app-gray-900 wta:dark:text-app-white",
|
|
46
46
|
children: /*#__PURE__*/jsx("path", {
|
|
47
47
|
fill: "currentColor",
|
|
48
48
|
fillRule: "evenodd",
|
|
@@ -52,23 +52,23 @@ function OtpInput(props) {
|
|
|
52
52
|
})
|
|
53
53
|
})
|
|
54
54
|
}), /*#__PURE__*/jsxs("div", {
|
|
55
|
-
className: "
|
|
55
|
+
className: "wta:-mt-10 wta:flex wta:size-full wta:flex-1 wta:flex-col wta:items-center wta:justify-center wta:gap-y-4",
|
|
56
56
|
children: [/*#__PURE__*/jsx("img", {
|
|
57
57
|
src: getIcons(isMobileOtp ? "sms-otp-light" : "email-otp-light"),
|
|
58
58
|
alt: "otp",
|
|
59
|
-
className: "
|
|
59
|
+
className: "wta:size-auto"
|
|
60
60
|
}), /*#__PURE__*/jsxs("div", {
|
|
61
|
-
className: "
|
|
61
|
+
className: "wta:mx-auto wta:-mt-6 wta:flex wta:w-full wta:flex-col wta:items-center wta:justify-center wta:gap-y-2",
|
|
62
62
|
children: [/*#__PURE__*/jsx("p", {
|
|
63
|
-
className: "
|
|
63
|
+
className: "wta:text-lg wta:font-bold wta:text-app-gray-900 wta:dark:text-app-white",
|
|
64
64
|
children: isMobileOtp ? t("modal.otp.mobile-title") : t("modal.otp.email-title")
|
|
65
65
|
}), /*#__PURE__*/jsxs("div", {
|
|
66
|
-
className: "
|
|
66
|
+
className: "wta:mx-auto wta:flex wta:w-full wta:flex-col wta:items-center wta:justify-center wta:gap-y-1",
|
|
67
67
|
children: [/*#__PURE__*/jsx("p", {
|
|
68
|
-
className: "
|
|
68
|
+
className: "wta:text-center wta:text-sm wta:font-normal wta:text-app-gray-500 wta:dark:text-app-gray-300",
|
|
69
69
|
children: isMobileOtp ? t("modal.otp.mobile-subtext") : t("modal.otp.email-subtext")
|
|
70
70
|
}), /*#__PURE__*/jsx("p", {
|
|
71
|
-
className: "
|
|
71
|
+
className: "wta:text-center wta:text-sm wta:font-normal wta:text-app-gray-500 wta:dark:text-app-gray-300",
|
|
72
72
|
children: isMobileOtp ? parsedLoginHint : t("modal.otp.email-subtext-example", {
|
|
73
73
|
email: parsedLoginHint
|
|
74
74
|
})
|
|
@@ -102,7 +102,7 @@ function LoginOtp(props) {
|
|
|
102
102
|
countryFlag
|
|
103
103
|
} = props;
|
|
104
104
|
return /*#__PURE__*/jsx("div", {
|
|
105
|
-
className: "
|
|
105
|
+
className: "wta:flex wta:size-full wta:flex-1 wta:flex-col wta:items-center wta:justify-center wta:gap-y-4",
|
|
106
106
|
children: /*#__PURE__*/jsx(OtpInput, {
|
|
107
107
|
errorMessage: errorMessage,
|
|
108
108
|
setShowOtpFlow: setShowOtpFlow,
|
package/dist/lib.esm/packages/modal/src/ui/containers/Login/LoginPasswordLess/LoginPasswordLess.js
CHANGED
|
@@ -57,22 +57,22 @@ function LoginPasswordLess(props) {
|
|
|
57
57
|
if (!isPasswordLessCtaClicked) {
|
|
58
58
|
return /*#__PURE__*/jsxs("button", {
|
|
59
59
|
type: "button",
|
|
60
|
-
className: cn("w3a--btn
|
|
61
|
-
"
|
|
62
|
-
"
|
|
63
|
-
"
|
|
60
|
+
className: cn("w3a--btn wta:justify-between! wta:relative wta:group wta:overflow-hidden", {
|
|
61
|
+
"wta:rounded-full": buttonRadius === "pill",
|
|
62
|
+
"wta:rounded-lg": buttonRadius === "rounded",
|
|
63
|
+
"wta:rounded-none": buttonRadius === "square"
|
|
64
64
|
}),
|
|
65
65
|
onClick: () => {
|
|
66
66
|
setIsPasswordLessCtaClicked(true);
|
|
67
67
|
},
|
|
68
68
|
children: [/*#__PURE__*/jsx("p", {
|
|
69
|
-
className: "
|
|
69
|
+
className: "wta:text-app-gray-900 wta:dark:text-app-white",
|
|
70
70
|
children: t("modal.passwordless.title", {
|
|
71
71
|
title
|
|
72
72
|
})
|
|
73
73
|
}), /*#__PURE__*/jsx("img", {
|
|
74
74
|
id: "passwordless-arrow",
|
|
75
|
-
className: "
|
|
75
|
+
className: "wta:absolute wta:right-4 wta:top-1/2 wta:-translate-x-6 wta:-translate-y-1/2 wta:opacity-0 wta:transition-all wta:duration-300 wta:group-hover:translate-x-0 wta:group-hover:opacity-100",
|
|
76
76
|
src: getIcons(isDark ? "chevron-right-dark" : "chevron-right-light"),
|
|
77
77
|
alt: "arrow"
|
|
78
78
|
})]
|
|
@@ -80,10 +80,10 @@ function LoginPasswordLess(props) {
|
|
|
80
80
|
}
|
|
81
81
|
return /*#__PURE__*/jsxs(Fragment, {
|
|
82
82
|
children: [/*#__PURE__*/jsxs("div", {
|
|
83
|
-
className: cn("w3a--input", isInputFocused && "
|
|
84
|
-
"
|
|
85
|
-
"
|
|
86
|
-
"
|
|
83
|
+
className: cn("w3a--input", isInputFocused && "wta:border-app-primary-600!", {
|
|
84
|
+
"wta:rounded-full": buttonRadius === "pill",
|
|
85
|
+
"wta:rounded-lg": buttonRadius === "rounded",
|
|
86
|
+
"wta:rounded-none": buttonRadius === "square"
|
|
87
87
|
}),
|
|
88
88
|
children: [/*#__PURE__*/jsx("input", {
|
|
89
89
|
ref: inputRef,
|
|
@@ -98,12 +98,12 @@ function LoginPasswordLess(props) {
|
|
|
98
98
|
setIsInputFocused(false);
|
|
99
99
|
},
|
|
100
100
|
type: "text",
|
|
101
|
-
className: cn("
|
|
101
|
+
className: cn("wta:w-full wta:appearance-none wta:bg-transparent wta:text-app-gray-900 wta:outline-none wta:placeholder:text-xs wta:placeholder:text-app-gray-400 wta:focus:outline-none wta:active:outline-none wta:dark:text-app-white wta:dark:placeholder:text-app-gray-500"),
|
|
102
102
|
onKeyDown: e => handleEnter(e),
|
|
103
103
|
disabled: isPasswordLessLoading
|
|
104
104
|
}), isPasswordLessLoading && /*#__PURE__*/jsx(PulseLoader, {}), inputValue && !isPasswordLessLoading && /*#__PURE__*/jsx("button", {
|
|
105
105
|
type: "button",
|
|
106
|
-
className: "
|
|
106
|
+
className: "wta:appearance-none",
|
|
107
107
|
onClick: onFormSubmit,
|
|
108
108
|
children: /*#__PURE__*/jsx("img", {
|
|
109
109
|
src: getIcons(isDark ? "chevron-right-dark" : "chevron-right-light"),
|
|
@@ -111,7 +111,7 @@ function LoginPasswordLess(props) {
|
|
|
111
111
|
})
|
|
112
112
|
})]
|
|
113
113
|
}), errorMessage && !isInputFocused && isPasswordLessCtaClicked && /*#__PURE__*/jsx("p", {
|
|
114
|
-
className: "
|
|
114
|
+
className: "wta:w-full wta:pl-6 wta:text-start wta:text-xs wta:font-normal wta:text-app-red-500 wta:dark:text-app-red-400",
|
|
115
115
|
children: errorMessage
|
|
116
116
|
})]
|
|
117
117
|
});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import _objectSpread from '@babel/runtime/helpers/objectSpread2';
|
|
2
2
|
import { WALLET_CONNECTORS } from '@web3auth/no-modal';
|
|
3
3
|
import { useRef, useState, useEffect, useMemo, useCallback } from 'react';
|
|
4
|
-
import {
|
|
4
|
+
import { useTranslation } from 'react-i18next';
|
|
5
5
|
import Footer from '../../components/Footer/Footer.js';
|
|
6
6
|
import Loader from '../../components/Loader/Loader.js';
|
|
7
7
|
import Toast from '../../components/Toast/Toast.js';
|
|
@@ -10,6 +10,8 @@ import { useModalState } from '../../context/ModalStateContext.js';
|
|
|
10
10
|
import { RootProvider } from '../../context/RootContext.js';
|
|
11
11
|
import { useWidget } from '../../context/WidgetContext.js';
|
|
12
12
|
import { MODAL_STATUS } from '../../interfaces.js';
|
|
13
|
+
import i18nInstance from '../../localeImport.js';
|
|
14
|
+
import AccountLinking from '../AccountLinking/AccountLinking.js';
|
|
13
15
|
import ConnectWallet from '../ConnectWallet/ConnectWallet.js';
|
|
14
16
|
import Login from '../Login/Login.js';
|
|
15
17
|
import RootBodySheets from './RootBodySheets/RootBodySheets.js';
|
|
@@ -19,6 +21,9 @@ function RootContent(props) {
|
|
|
19
21
|
const {
|
|
20
22
|
onCloseLoader
|
|
21
23
|
} = props;
|
|
24
|
+
const [t] = useTranslation(undefined, {
|
|
25
|
+
i18n: i18nInstance
|
|
26
|
+
});
|
|
22
27
|
const {
|
|
23
28
|
modalState,
|
|
24
29
|
shouldShowLoginPage,
|
|
@@ -181,14 +186,21 @@ function RootContent(props) {
|
|
|
181
186
|
const isExternalWalletModeOnly = useMemo(() => {
|
|
182
187
|
return !showPasswordLessInput && !areSocialLoginsVisible;
|
|
183
188
|
}, [areSocialLoginsVisible, showPasswordLessInput]);
|
|
189
|
+
const isWalletConnectAccountLinkingVisible = useMemo(() => {
|
|
190
|
+
return modalState.accountLinking.active && modalState.accountLinking.transportConnectorName === WALLET_CONNECTORS.WALLET_CONNECT_V2;
|
|
191
|
+
}, [modalState.accountLinking.active, modalState.accountLinking.transportConnectorName]);
|
|
184
192
|
const isShowLoader = useMemo(() => {
|
|
185
|
-
return modalState.status !== MODAL_STATUS.INITIALIZED;
|
|
186
|
-
}, [modalState.status]);
|
|
187
|
-
const
|
|
193
|
+
return !isWalletConnectAccountLinkingVisible && modalState.status !== MODAL_STATUS.INITIALIZED;
|
|
194
|
+
}, [isWalletConnectAccountLinkingVisible, modalState.status]);
|
|
195
|
+
const loaderMessage = useMemo(() => {
|
|
196
|
+
const message = modalState.postLoadingMessage;
|
|
197
|
+
if (!message) return undefined;
|
|
198
|
+
return i18nInstance.exists(message) ? t(message) : message;
|
|
199
|
+
}, [modalState.postLoadingMessage, t]);
|
|
188
200
|
return /*#__PURE__*/jsxs("div", {
|
|
189
|
-
className: "
|
|
201
|
+
className: "wta:relative wta:flex wta:flex-col",
|
|
190
202
|
children: [/*#__PURE__*/jsxs("div", {
|
|
191
|
-
className: "w3a-modal-container
|
|
203
|
+
className: "w3a-modal-container wta:relative wta:flex wta:flex-col wta:overflow-hidden",
|
|
192
204
|
style: {
|
|
193
205
|
height: containerHeight
|
|
194
206
|
},
|
|
@@ -196,11 +208,12 @@ function RootContent(props) {
|
|
|
196
208
|
className: "w3a--modal-curtain"
|
|
197
209
|
}), /*#__PURE__*/jsxs("div", {
|
|
198
210
|
ref: contentRef,
|
|
199
|
-
className:
|
|
211
|
+
className: "wta:relative wta:flex wta:flex-none wta:flex-col wta:p-6",
|
|
200
212
|
children: [isShowLoader ? /*#__PURE__*/jsx(Loader, {
|
|
201
213
|
connector: modalState.detailedLoaderConnector,
|
|
202
214
|
connectorName: modalState.detailedLoaderConnectorName,
|
|
203
215
|
modalStatus: modalState.status,
|
|
216
|
+
message: loaderMessage,
|
|
204
217
|
onClose: onCloseLoader,
|
|
205
218
|
isConnectAndSignAuthenticationMode: isConnectAndSignAuthenticationMode,
|
|
206
219
|
externalWalletsConfig: modalState.externalWalletsConfig,
|
|
@@ -211,11 +224,13 @@ function RootContent(props) {
|
|
|
211
224
|
privacyPolicy: privacyPolicy,
|
|
212
225
|
tncLink: tncLink
|
|
213
226
|
}) : /*#__PURE__*/jsxs(Fragment, {
|
|
214
|
-
children: [
|
|
227
|
+
children: [isWalletConnectAccountLinkingVisible && /*#__PURE__*/jsx(AccountLinking, {
|
|
228
|
+
allExternalWallets: allExternalWallets
|
|
229
|
+
}), !isWalletConnectAccountLinkingVisible && !modalState.accountLinking.pickerActive && modalState.currentPage === PAGES.LOGIN_OPTIONS && shouldShowLoginPage && modalState.status === MODAL_STATUS.INITIALIZED && /*#__PURE__*/jsx(Login, {
|
|
215
230
|
installedExternalWalletConfig: topInstalledConnectorButtons,
|
|
216
231
|
totalExternalWallets: allExternalWallets.length,
|
|
217
232
|
remainingUndisplayedWallets: remainingUndisplayedWallets
|
|
218
|
-
}), modalState.currentPage === PAGES.WALLET_LIST && (!shouldShowLoginPage || isExternalWalletModeOnly) && modalState.status === MODAL_STATUS.INITIALIZED && /*#__PURE__*/jsx(ConnectWallet, {
|
|
233
|
+
}), !isWalletConnectAccountLinkingVisible && modalState.currentPage === PAGES.WALLET_LIST && (!shouldShowLoginPage || isExternalWalletModeOnly || modalState.accountLinking.pickerActive) && modalState.status === MODAL_STATUS.INITIALIZED && /*#__PURE__*/jsx(ConnectWallet, {
|
|
219
234
|
allRegistryButtons: allRegistryButtons,
|
|
220
235
|
connectorVisibilityMap: connectorVisibilityMap,
|
|
221
236
|
customConnectorButtons: customConnectorButtons,
|