@dynamic-labs/sdk-react-core 0.19.0-alpha.4 → 0.19.0-alpha.6
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/CHANGELOG.md +23 -0
- package/package.cjs +2 -2
- package/package.js +2 -2
- package/package.json +9 -9
- package/src/lib/components/DynamicConnectButton/DynamicConnectButton.cjs +2 -14
- package/src/lib/components/DynamicConnectButton/DynamicConnectButton.js +2 -14
- package/src/lib/components/UserProfile/UserProfile.cjs +1 -1
- package/src/lib/components/UserProfile/UserProfile.js +1 -1
- package/src/lib/components/UserProfile/parts/UserProfileSocialAccount/UserProfileSocialAccount.cjs +1 -1
- package/src/lib/components/UserProfile/parts/UserProfileSocialAccount/UserProfileSocialAccount.js +1 -1
- package/src/lib/context/DynamicContext/DynamicContext.cjs +1 -1
- package/src/lib/context/DynamicContext/DynamicContext.js +1 -1
- package/src/lib/context/DynamicContext/helpers.cjs +5 -6
- package/src/lib/context/DynamicContext/helpers.d.ts +2 -2
- package/src/lib/context/DynamicContext/helpers.js +5 -6
- package/src/lib/context/ViewContext/ViewContext.d.ts +1 -1
- package/src/lib/layout/DynamicAuthLayout/HelpContent/HelpContent.cjs +2 -1
- package/src/lib/layout/DynamicAuthLayout/HelpContent/HelpContent.js +2 -1
- package/src/lib/utils/functions/createUserProfile/createUserProfile.cjs +1 -1
- package/src/lib/utils/functions/createUserProfile/createUserProfile.js +1 -1
- package/src/lib/utils/functions/getDynamicLayoutData/getDynamicLayoutData.cjs +6 -0
- package/src/lib/utils/functions/getDynamicLayoutData/getDynamicLayoutData.js +6 -0
- package/src/lib/utils/hooks/multiWallet/useSyncPrimaryWallet/useSyncPrimaryWallet.cjs +4 -4
- package/src/lib/utils/hooks/multiWallet/useSyncPrimaryWallet/useSyncPrimaryWallet.js +4 -4
- package/src/lib/utils/hooks/useAuthLayoutChecks/useAuthLayoutChecks.cjs +7 -5
- package/src/lib/utils/hooks/useAuthLayoutChecks/useAuthLayoutChecks.js +7 -5
- package/src/lib/utils/hooks/useConnectWallet/useConnectWallet.cjs +14 -16
- package/src/lib/utils/hooks/useConnectWallet/useConnectWallet.js +15 -17
- package/src/lib/utils/hooks/useSocialAccounts/useSocialAccounts.cjs +1 -6
- package/src/lib/utils/hooks/useSocialAccounts/useSocialAccounts.js +1 -6
- package/src/lib/utils/hooks/useVerifyWallet/useVerifyWallet.cjs +15 -10
- package/src/lib/utils/hooks/useVerifyWallet/useVerifyWallet.js +15 -10
- package/src/lib/views/AccountExistsView/AccountExistsView.cjs +2 -2
- package/src/lib/views/AccountExistsView/AccountExistsView.js +2 -2
- package/src/lib/views/LoginView/LoginView.cjs +70 -0
- package/src/lib/views/LoginView/LoginView.d.ts +2 -0
- package/src/lib/views/LoginView/LoginView.js +66 -0
- package/src/lib/views/{LoginWithEmailView/components/LoginWithEmailForm/LoginWithEmailForm.cjs → LoginView/components/EmailSignIn/LoginEmailForm.cjs} +6 -11
- package/src/lib/views/LoginView/components/EmailSignIn/LoginEmailForm.d.ts +8 -0
- package/src/lib/views/{LoginWithEmailView/components/LoginWithEmailForm/LoginWithEmailForm.js → LoginView/components/EmailSignIn/LoginEmailForm.js} +6 -11
- package/src/lib/views/LoginView/components/EmailSignIn/index.d.ts +1 -0
- package/src/lib/views/LoginView/components/LoginWidget.d.ts +5 -0
- package/src/lib/views/LoginView/components/WalletSignIn/ListItemButton/ListItemButton.cjs +65 -0
- package/src/lib/views/{LoginWithEmailView/components → LoginView/components/WalletSignIn}/ListItemButton/ListItemButton.d.ts +2 -1
- package/src/lib/views/LoginView/components/WalletSignIn/ListItemButton/ListItemButton.js +61 -0
- package/src/lib/views/{LoginWithEmailView/components/ListItemButton/ListItemButton.cjs → LoginView/components/WalletSignIn/WalletSignIn.cjs} +7 -19
- package/src/lib/views/LoginView/components/WalletSignIn/WalletSignIn.d.ts +7 -0
- package/src/lib/views/{LoginWithEmailView/components/ListItemButton/ListItemButton.js → LoginView/components/WalletSignIn/WalletSignIn.js} +8 -20
- package/src/lib/views/LoginView/components/WalletSignIn/WalletSimpleSignIn/WalletSimpleSignIn.cjs +47 -0
- package/src/lib/views/LoginView/components/WalletSignIn/WalletSimpleSignIn/WalletSimpleSignIn.d.ts +8 -0
- package/src/lib/views/LoginView/components/WalletSignIn/WalletSimpleSignIn/WalletSimpleSignIn.js +43 -0
- package/src/lib/views/LoginView/components/WalletSignIn/WalletSimpleSignIn/index.d.ts +1 -0
- package/src/lib/views/LoginView/components/WalletSignIn/index.d.ts +1 -0
- package/src/lib/views/LoginView/components/index.d.ts +3 -0
- package/src/lib/views/LoginView/index.d.ts +1 -0
- package/src/lib/views/LoginView/useLoginView.cjs +146 -0
- package/src/lib/views/LoginView/useLoginView.d.ts +6 -0
- package/src/lib/views/LoginView/useLoginView.js +141 -0
- package/src/lib/views/WalletList/WalletListItem/WalletListItem.cjs +2 -2
- package/src/lib/views/WalletList/WalletListItem/WalletListItem.js +2 -2
- package/src/lib/views/WalletList/WalletListItem/WalletListItem.types.d.ts +1 -0
- package/src/lib/views/viewToComponentMap.cjs +4 -3
- package/src/lib/views/viewToComponentMap.js +4 -3
- package/src/lib/views/LoginWithEmailView/LoginWithEmailView.cjs +0 -63
- package/src/lib/views/LoginWithEmailView/LoginWithEmailView.d.ts +0 -2
- package/src/lib/views/LoginWithEmailView/LoginWithEmailView.js +0 -59
- package/src/lib/views/LoginWithEmailView/components/LoginWithEmailForm/LoginWithEmailForm.d.ts +0 -7
- package/src/lib/views/LoginWithEmailView/components/LoginWithEmailForm/index.d.ts +0 -1
- package/src/lib/views/LoginWithEmailView/components/LoginWithEmailWalletList/LoginWithEmailWalletList.cjs +0 -36
- package/src/lib/views/LoginWithEmailView/components/LoginWithEmailWalletList/LoginWithEmailWalletList.d.ts +0 -9
- package/src/lib/views/LoginWithEmailView/components/LoginWithEmailWalletList/LoginWithEmailWalletList.js +0 -31
- package/src/lib/views/LoginWithEmailView/components/LoginWithEmailWalletList/index.d.ts +0 -1
- package/src/lib/views/LoginWithEmailView/index.d.ts +0 -1
- /package/src/lib/views/{LoginWithEmailView → LoginView}/components/SocialSignIn/SocialSignIn.cjs +0 -0
- /package/src/lib/views/{LoginWithEmailView → LoginView}/components/SocialSignIn/SocialSignIn.d.ts +0 -0
- /package/src/lib/views/{LoginWithEmailView → LoginView}/components/SocialSignIn/SocialSignIn.js +0 -0
- /package/src/lib/views/{LoginWithEmailView → LoginView}/components/SocialSignIn/index.d.ts +0 -0
- /package/src/lib/views/{LoginWithEmailView/components → LoginView/components/WalletSignIn}/ListItemButton/index.d.ts +0 -0
|
@@ -3,14 +3,12 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
var jsxRuntime = require('react/jsx-runtime');
|
|
6
|
-
|
|
7
|
-
require('@dynamic-labs/iconic');
|
|
8
|
-
require('../../../../context/ViewContext/ViewContext.cjs');
|
|
9
|
-
var stroke = require('../../../../shared/assets/stroke.cjs');
|
|
10
|
-
var classNames = require('../../../../utils/functions/classNames/classNames.cjs');
|
|
6
|
+
require('react');
|
|
11
7
|
require('@dynamic-labs/sdk-api');
|
|
12
8
|
require('../../../../shared/logger.cjs');
|
|
9
|
+
require('@dynamic-labs/iconic');
|
|
13
10
|
require('@dynamic-labs/wallet-connector-core');
|
|
11
|
+
require('../../../../context/ViewContext/ViewContext.cjs');
|
|
14
12
|
require('@dynamic-labs/wallet-book');
|
|
15
13
|
require('@dynamic-labs/utils');
|
|
16
14
|
require('../../../../utils/constants/colors.cjs');
|
|
@@ -21,7 +19,6 @@ require('../../../../context/DynamicContext/DynamicContext.cjs');
|
|
|
21
19
|
require('@dynamic-labs/multi-wallet');
|
|
22
20
|
require('../../../../components/ShadowDOM/ShadowDOM.cjs');
|
|
23
21
|
require('../../../../context/ThemeContext/ThemeContext.cjs');
|
|
24
|
-
var Icon = require('../../../../components/Icon/Icon.cjs');
|
|
25
22
|
require('react-dom');
|
|
26
23
|
require('react-focus-lock');
|
|
27
24
|
require('../../../../components/Transition/ZoomTransition/ZoomTransition.cjs');
|
|
@@ -34,6 +31,7 @@ require('../../../../context/ErrorContext/ErrorContext.cjs');
|
|
|
34
31
|
require('../../../../context/AccessDeniedContext/AccessDeniedContext.cjs');
|
|
35
32
|
require('../../../../context/AccountExistsContext/AccountExistsContext.cjs');
|
|
36
33
|
require('../../../../components/IconButton/IconButton.cjs');
|
|
34
|
+
var Button = require('../../../../components/Button/Button.cjs');
|
|
37
35
|
require('../../../../components/Alert/Alert.cjs');
|
|
38
36
|
require('formik');
|
|
39
37
|
require('yup');
|
|
@@ -44,22 +42,12 @@ require('../../../../context/EmailVerificationContext/EmailVerificationContext.c
|
|
|
44
42
|
require('@dynamic-labs/types');
|
|
45
43
|
require('../../../../utils/hooks/useUserUpdateRequest/useUpdateUser/useUpdateUser.cjs');
|
|
46
44
|
require('../../../../context/UserFieldEditorContext/UserFieldEditorContext.cjs');
|
|
47
|
-
var ListTile = require('../../../../components/ListTile/ListTile.cjs');
|
|
48
45
|
require('../../../../components/Popper/Popper/Popper.cjs');
|
|
49
46
|
require('../../../../components/Popper/PopperContext/PopperContext.cjs');
|
|
50
47
|
require('../../../../components/InlineWidget/InlineWidget.cjs');
|
|
51
48
|
require('../../../../components/MenuList/Dropdown/Dropdown.cjs');
|
|
52
|
-
var
|
|
49
|
+
var WalletSimpleSignIn = require('./WalletSimpleSignIn/WalletSimpleSignIn.cjs');
|
|
53
50
|
|
|
54
|
-
const
|
|
55
|
-
const numberOfWalletsText = React.useMemo(() => {
|
|
56
|
-
if (numberOfWallets <= 10) {
|
|
57
|
-
return numberOfWallets;
|
|
58
|
-
}
|
|
59
|
-
return `+${Math.floor(numberOfWallets / 10) * 10}`;
|
|
60
|
-
}, [numberOfWallets]);
|
|
61
|
-
const trailing = (jsxRuntime.jsxs("div", Object.assign({ className: 'list-item-button__trailing' }, { children: [jsxRuntime.jsx("div", Object.assign({ className: classNames.classNames('list-item-button__trailing-child', 'list-item-button__trailing-label') }, { children: jsxRuntime.jsx(Badge.Badge, { text: `${numberOfWalletsText} available` }) })), jsxRuntime.jsx("div", Object.assign({ className: classNames.classNames('list-item-button__trailing-child', 'list-item-button__trailing-icon') }, { children: jsxRuntime.jsx(Icon.Icon, Object.assign({ color: 'text-primary', size: 'small' }, { children: jsxRuntime.jsx(stroke.ReactComponent, {}) })) }))] })));
|
|
62
|
-
return (jsxRuntime.jsx(ListTile.ListTile, Object.assign({ trailing: trailing, onClick: onClick, className: 'list-item-button' }, { children: text })));
|
|
63
|
-
};
|
|
51
|
+
const WalletSignIn = ({ numberOfItensToShow, isLoading, onSubmit, }) => numberOfItensToShow > 0 ? (jsxRuntime.jsx(WalletSimpleSignIn.WalletSimpleSignIn, { previewWalletsNumber: numberOfItensToShow, onshowAllWallets: () => onSubmit === null || onSubmit === void 0 ? void 0 : onSubmit(), disabled: isLoading })) : (jsxRuntime.jsx(Button.Button, Object.assign({ disabled: isLoading, onClick: () => onSubmit === null || onSubmit === void 0 ? void 0 : onSubmit(), buttonVariant: 'primary', buttonPadding: 'large' }, { children: "Connect with Wallet" })));
|
|
64
52
|
|
|
65
|
-
exports.
|
|
53
|
+
exports.WalletSignIn = WalletSignIn;
|
|
@@ -1,12 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
import '@dynamic-labs/iconic';
|
|
4
|
-
import '../../../../context/ViewContext/ViewContext.js';
|
|
5
|
-
import { ReactComponent as SvgStroke } from '../../../../shared/assets/stroke.js';
|
|
6
|
-
import { classNames } from '../../../../utils/functions/classNames/classNames.js';
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
|
+
import 'react';
|
|
7
3
|
import '@dynamic-labs/sdk-api';
|
|
8
4
|
import '../../../../shared/logger.js';
|
|
5
|
+
import '@dynamic-labs/iconic';
|
|
9
6
|
import '@dynamic-labs/wallet-connector-core';
|
|
7
|
+
import '../../../../context/ViewContext/ViewContext.js';
|
|
10
8
|
import '@dynamic-labs/wallet-book';
|
|
11
9
|
import '@dynamic-labs/utils';
|
|
12
10
|
import '../../../../utils/constants/colors.js';
|
|
@@ -17,7 +15,6 @@ import '../../../../context/DynamicContext/DynamicContext.js';
|
|
|
17
15
|
import '@dynamic-labs/multi-wallet';
|
|
18
16
|
import '../../../../components/ShadowDOM/ShadowDOM.js';
|
|
19
17
|
import '../../../../context/ThemeContext/ThemeContext.js';
|
|
20
|
-
import { Icon } from '../../../../components/Icon/Icon.js';
|
|
21
18
|
import 'react-dom';
|
|
22
19
|
import 'react-focus-lock';
|
|
23
20
|
import '../../../../components/Transition/ZoomTransition/ZoomTransition.js';
|
|
@@ -30,6 +27,7 @@ import '../../../../context/ErrorContext/ErrorContext.js';
|
|
|
30
27
|
import '../../../../context/AccessDeniedContext/AccessDeniedContext.js';
|
|
31
28
|
import '../../../../context/AccountExistsContext/AccountExistsContext.js';
|
|
32
29
|
import '../../../../components/IconButton/IconButton.js';
|
|
30
|
+
import { Button } from '../../../../components/Button/Button.js';
|
|
33
31
|
import '../../../../components/Alert/Alert.js';
|
|
34
32
|
import 'formik';
|
|
35
33
|
import 'yup';
|
|
@@ -40,22 +38,12 @@ import '../../../../context/EmailVerificationContext/EmailVerificationContext.js
|
|
|
40
38
|
import '@dynamic-labs/types';
|
|
41
39
|
import '../../../../utils/hooks/useUserUpdateRequest/useUpdateUser/useUpdateUser.js';
|
|
42
40
|
import '../../../../context/UserFieldEditorContext/UserFieldEditorContext.js';
|
|
43
|
-
import { ListTile } from '../../../../components/ListTile/ListTile.js';
|
|
44
41
|
import '../../../../components/Popper/Popper/Popper.js';
|
|
45
42
|
import '../../../../components/Popper/PopperContext/PopperContext.js';
|
|
46
43
|
import '../../../../components/InlineWidget/InlineWidget.js';
|
|
47
44
|
import '../../../../components/MenuList/Dropdown/Dropdown.js';
|
|
48
|
-
import {
|
|
45
|
+
import { WalletSimpleSignIn } from './WalletSimpleSignIn/WalletSimpleSignIn.js';
|
|
49
46
|
|
|
50
|
-
const
|
|
51
|
-
const numberOfWalletsText = useMemo(() => {
|
|
52
|
-
if (numberOfWallets <= 10) {
|
|
53
|
-
return numberOfWallets;
|
|
54
|
-
}
|
|
55
|
-
return `+${Math.floor(numberOfWallets / 10) * 10}`;
|
|
56
|
-
}, [numberOfWallets]);
|
|
57
|
-
const trailing = (jsxs("div", Object.assign({ className: 'list-item-button__trailing' }, { children: [jsx("div", Object.assign({ className: classNames('list-item-button__trailing-child', 'list-item-button__trailing-label') }, { children: jsx(Badge, { text: `${numberOfWalletsText} available` }) })), jsx("div", Object.assign({ className: classNames('list-item-button__trailing-child', 'list-item-button__trailing-icon') }, { children: jsx(Icon, Object.assign({ color: 'text-primary', size: 'small' }, { children: jsx(SvgStroke, {}) })) }))] })));
|
|
58
|
-
return (jsx(ListTile, Object.assign({ trailing: trailing, onClick: onClick, className: 'list-item-button' }, { children: text })));
|
|
59
|
-
};
|
|
47
|
+
const WalletSignIn = ({ numberOfItensToShow, isLoading, onSubmit, }) => numberOfItensToShow > 0 ? (jsx(WalletSimpleSignIn, { previewWalletsNumber: numberOfItensToShow, onshowAllWallets: () => onSubmit === null || onSubmit === void 0 ? void 0 : onSubmit(), disabled: isLoading })) : (jsx(Button, Object.assign({ disabled: isLoading, onClick: () => onSubmit === null || onSubmit === void 0 ? void 0 : onSubmit(), buttonVariant: 'primary', buttonPadding: 'large' }, { children: "Connect with Wallet" })));
|
|
60
48
|
|
|
61
|
-
export {
|
|
49
|
+
export { WalletSignIn };
|
package/src/lib/views/LoginView/components/WalletSignIn/WalletSimpleSignIn/WalletSimpleSignIn.cjs
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
6
|
+
var walletBook = require('@dynamic-labs/wallet-book');
|
|
7
|
+
var Skeleton = require('../../../../../components/Skeleton/Skeleton.cjs');
|
|
8
|
+
var useInternalDynamicContext = require('../../../../../context/DynamicContext/useInternalDynamicContext.cjs');
|
|
9
|
+
require('@dynamic-labs/sdk-api');
|
|
10
|
+
require('../../../../../shared/logger.cjs');
|
|
11
|
+
require('@dynamic-labs/iconic');
|
|
12
|
+
require('@dynamic-labs/wallet-connector-core');
|
|
13
|
+
require('../../../../../context/ViewContext/ViewContext.cjs');
|
|
14
|
+
require('react');
|
|
15
|
+
require('@dynamic-labs/utils');
|
|
16
|
+
var localStorage$1 = require('../../../../../utils/constants/localStorage.cjs');
|
|
17
|
+
require('../../../../../utils/constants/colors.cjs');
|
|
18
|
+
var localStorage = require('../../../../../shared/utils/classes/storage/localStorage.cjs');
|
|
19
|
+
require('ethers');
|
|
20
|
+
require('../../../../../shared/consts/index.cjs');
|
|
21
|
+
var WalletListItem = require('../../../../WalletList/WalletListItem/WalletListItem.cjs');
|
|
22
|
+
var ListItemButton = require('../ListItemButton/ListItemButton.cjs');
|
|
23
|
+
var walletListBuilder = require('../../../../../utils/functions/walletListBuilder/walletListBuilder.cjs');
|
|
24
|
+
|
|
25
|
+
const WalletSimpleSignIn = ({ previewWalletsNumber, disabled = false, onshowAllWallets, }) => {
|
|
26
|
+
const { wallets, projectSettings, walletsFilter, signWithEmailWalletName } = useInternalDynamicContext.useInternalDynamicContext();
|
|
27
|
+
const { walletBook: walletBook$1 } = walletBook.useWalletBookContext();
|
|
28
|
+
const { numberOfWallets, walletsList } = walletListBuilder.walletListBuilder({
|
|
29
|
+
groupWallets: true,
|
|
30
|
+
inputList: wallets,
|
|
31
|
+
isWalletConnectList: false,
|
|
32
|
+
lastUsedWalletName: localStorage.LocalStorage.getFromLS(localStorage$1.LAST_USED_WALLET),
|
|
33
|
+
loginWithEmail: true,
|
|
34
|
+
numberOfWalletsToShow: previewWalletsNumber,
|
|
35
|
+
searchFilter: undefined,
|
|
36
|
+
signWithEmailWalletName,
|
|
37
|
+
walletBook: walletBook$1,
|
|
38
|
+
walletsFilter,
|
|
39
|
+
});
|
|
40
|
+
const isUsingMultiWallet = Boolean(localStorage.LocalStorage.getFromLS(localStorage$1.AUTH_USER));
|
|
41
|
+
return !projectSettings ? (jsxRuntime.jsx(Skeleton.Skeleton, { count: previewWalletsNumber + 1, className: 'login-with-email-wallet-list__skeleton' })) : (jsxRuntime.jsxs("div", Object.assign({ className: 'login-with-email-wallet-list__container', "data-testid": 'top-wallets-list' }, { children: [walletsList.map((wallet) => {
|
|
42
|
+
var _a;
|
|
43
|
+
return (jsxRuntime.jsx(WalletListItem.WalletListItem, { wallet: wallet, usingMultiWallet: isUsingMultiWallet, disabled: disabled }, wallet.key + ((_a = wallet.groupedWallets) === null || _a === void 0 ? void 0 : _a.length)));
|
|
44
|
+
}), jsxRuntime.jsx(ListItemButton.ListItemButton, { text: 'View all wallets', onClick: onshowAllWallets, numberOfWallets: numberOfWallets, disabled: disabled })] })));
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
exports.WalletSimpleSignIn = WalletSimpleSignIn;
|
package/src/lib/views/LoginView/components/WalletSignIn/WalletSimpleSignIn/WalletSimpleSignIn.js
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
2
|
+
import { useWalletBookContext } from '@dynamic-labs/wallet-book';
|
|
3
|
+
import { Skeleton } from '../../../../../components/Skeleton/Skeleton.js';
|
|
4
|
+
import { useInternalDynamicContext } from '../../../../../context/DynamicContext/useInternalDynamicContext.js';
|
|
5
|
+
import '@dynamic-labs/sdk-api';
|
|
6
|
+
import '../../../../../shared/logger.js';
|
|
7
|
+
import '@dynamic-labs/iconic';
|
|
8
|
+
import '@dynamic-labs/wallet-connector-core';
|
|
9
|
+
import '../../../../../context/ViewContext/ViewContext.js';
|
|
10
|
+
import 'react';
|
|
11
|
+
import '@dynamic-labs/utils';
|
|
12
|
+
import { LAST_USED_WALLET, AUTH_USER } from '../../../../../utils/constants/localStorage.js';
|
|
13
|
+
import '../../../../../utils/constants/colors.js';
|
|
14
|
+
import { LocalStorage } from '../../../../../shared/utils/classes/storage/localStorage.js';
|
|
15
|
+
import 'ethers';
|
|
16
|
+
import '../../../../../shared/consts/index.js';
|
|
17
|
+
import { WalletListItem } from '../../../../WalletList/WalletListItem/WalletListItem.js';
|
|
18
|
+
import { ListItemButton } from '../ListItemButton/ListItemButton.js';
|
|
19
|
+
import { walletListBuilder } from '../../../../../utils/functions/walletListBuilder/walletListBuilder.js';
|
|
20
|
+
|
|
21
|
+
const WalletSimpleSignIn = ({ previewWalletsNumber, disabled = false, onshowAllWallets, }) => {
|
|
22
|
+
const { wallets, projectSettings, walletsFilter, signWithEmailWalletName } = useInternalDynamicContext();
|
|
23
|
+
const { walletBook } = useWalletBookContext();
|
|
24
|
+
const { numberOfWallets, walletsList } = walletListBuilder({
|
|
25
|
+
groupWallets: true,
|
|
26
|
+
inputList: wallets,
|
|
27
|
+
isWalletConnectList: false,
|
|
28
|
+
lastUsedWalletName: LocalStorage.getFromLS(LAST_USED_WALLET),
|
|
29
|
+
loginWithEmail: true,
|
|
30
|
+
numberOfWalletsToShow: previewWalletsNumber,
|
|
31
|
+
searchFilter: undefined,
|
|
32
|
+
signWithEmailWalletName,
|
|
33
|
+
walletBook,
|
|
34
|
+
walletsFilter,
|
|
35
|
+
});
|
|
36
|
+
const isUsingMultiWallet = Boolean(LocalStorage.getFromLS(AUTH_USER));
|
|
37
|
+
return !projectSettings ? (jsx(Skeleton, { count: previewWalletsNumber + 1, className: 'login-with-email-wallet-list__skeleton' })) : (jsxs("div", Object.assign({ className: 'login-with-email-wallet-list__container', "data-testid": 'top-wallets-list' }, { children: [walletsList.map((wallet) => {
|
|
38
|
+
var _a;
|
|
39
|
+
return (jsx(WalletListItem, { wallet: wallet, usingMultiWallet: isUsingMultiWallet, disabled: disabled }, wallet.key + ((_a = wallet.groupedWallets) === null || _a === void 0 ? void 0 : _a.length)));
|
|
40
|
+
}), jsx(ListItemButton, { text: 'View all wallets', onClick: onshowAllWallets, numberOfWallets: numberOfWallets, disabled: disabled })] })));
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
export { WalletSimpleSignIn };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { WalletSimpleSignIn } from './WalletSimpleSignIn';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { WalletSignIn } from './WalletSignIn';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { LoginView } from './LoginView';
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var React = require('react');
|
|
6
|
+
var sdkApi = require('@dynamic-labs/sdk-api');
|
|
7
|
+
var useInternalDynamicContext = require('../../context/DynamicContext/useInternalDynamicContext.cjs');
|
|
8
|
+
|
|
9
|
+
const NUMBER_OF_WALLETS = 3;
|
|
10
|
+
const useLoginView = () => {
|
|
11
|
+
const { projectSettings, authorizationViewDisplayOrder, loginWithEmail, wallets, } = useInternalDynamicContext.useInternalDynamicContext();
|
|
12
|
+
const isWalletOnly = React.useMemo(() => {
|
|
13
|
+
var _a, _b, _c, _d, _e, _f;
|
|
14
|
+
if (!projectSettings) {
|
|
15
|
+
return false;
|
|
16
|
+
}
|
|
17
|
+
// toolkit functionality overrides whatever is defined
|
|
18
|
+
if (!loginWithEmail) {
|
|
19
|
+
return true;
|
|
20
|
+
}
|
|
21
|
+
const loginView = (_b = (_a = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.sdk) === null || _a === void 0 ? void 0 : _a.views) === null || _b === void 0 ? void 0 : _b.find((view) => view.type === sdkApi.SdkViewType.Login);
|
|
22
|
+
// backwards compatibility for those that didn't set up login view sessions
|
|
23
|
+
if (!((_c = loginView === null || loginView === void 0 ? void 0 : loginView.sections) === null || _c === void 0 ? void 0 : _c.length)) {
|
|
24
|
+
return (!((_e = (_d = projectSettings.design) === null || _d === void 0 ? void 0 : _d.modal) === null || _e === void 0 ? void 0 : _e.emailOnly) &&
|
|
25
|
+
!((_f = projectSettings.providers) === null || _f === void 0 ? void 0 : _f.length));
|
|
26
|
+
}
|
|
27
|
+
return (loginView.sections.length === 1 && loginView.sections[0].type === 'wallet');
|
|
28
|
+
}, [projectSettings, loginWithEmail]);
|
|
29
|
+
/**
|
|
30
|
+
* build email and social view sections from project settings design.modal props - backwards compatibility
|
|
31
|
+
* @returns SdkViewSection[]
|
|
32
|
+
*/
|
|
33
|
+
const getEmailViewSectionDefinition = () => {
|
|
34
|
+
var _a, _b, _c, _d;
|
|
35
|
+
const loginViewSections = [
|
|
36
|
+
{
|
|
37
|
+
type: sdkApi.SdkViewSectionType.Email,
|
|
38
|
+
},
|
|
39
|
+
];
|
|
40
|
+
const numOfProvidersToDisplay = (_b = (_a = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.sdk.socialSignIn) === null || _a === void 0 ? void 0 : _a.providers) === null || _b === void 0 ? void 0 : _b.filter((provider) => provider.enabled).length;
|
|
41
|
+
if (numOfProvidersToDisplay) {
|
|
42
|
+
loginViewSections.push({
|
|
43
|
+
numOfItemsToDisplay: numOfProvidersToDisplay,
|
|
44
|
+
type: sdkApi.SdkViewSectionType.Social,
|
|
45
|
+
});
|
|
46
|
+
if ((_c = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.design.modal) === null || _c === void 0 ? void 0 : _c.splitEmailAndSocial) {
|
|
47
|
+
loginViewSections.splice(1, 0, {
|
|
48
|
+
label: 'Or',
|
|
49
|
+
type: sdkApi.SdkViewSectionType.Separator,
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
if ((_d = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.design.modal) === null || _d === void 0 ? void 0 : _d.socialAboveEmail) {
|
|
54
|
+
loginViewSections.reverse();
|
|
55
|
+
}
|
|
56
|
+
return loginViewSections;
|
|
57
|
+
};
|
|
58
|
+
// TODO: https://linear.app/dynamic-labs/issue/GVTY-212/rethink-or-implement-toolkit-template-for-email-wallet-order
|
|
59
|
+
/**
|
|
60
|
+
* remove wallet view section from projectSettings?.sdk?.views if no wallet defined
|
|
61
|
+
* @param sections
|
|
62
|
+
* @returns
|
|
63
|
+
*/
|
|
64
|
+
const filterLoginViewSections = (sections) => {
|
|
65
|
+
if (wallets === null || wallets === void 0 ? void 0 : wallets.length) {
|
|
66
|
+
return sections;
|
|
67
|
+
}
|
|
68
|
+
return sections.filter((section) => section.type !== 'wallet');
|
|
69
|
+
};
|
|
70
|
+
const addSeparator = (index, loginItem) => {
|
|
71
|
+
var _a;
|
|
72
|
+
// if not the first index, no separator is needed
|
|
73
|
+
// if the first index but does not have wallets or providers,
|
|
74
|
+
// it'll show only one view section - no separator is needed
|
|
75
|
+
if (index !== 0 ||
|
|
76
|
+
!(wallets === null || wallets === void 0 ? void 0 : wallets.length) ||
|
|
77
|
+
!((_a = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.providers) === null || _a === void 0 ? void 0 : _a.length)) {
|
|
78
|
+
return [];
|
|
79
|
+
}
|
|
80
|
+
const label = loginItem === 'email' ? 'Or continue with a wallet' : 'Or continue with';
|
|
81
|
+
return [
|
|
82
|
+
{
|
|
83
|
+
label,
|
|
84
|
+
type: sdkApi.SdkViewSectionType.Separator,
|
|
85
|
+
},
|
|
86
|
+
];
|
|
87
|
+
};
|
|
88
|
+
/**
|
|
89
|
+
* build login view sections array from project settings design.modal props - backwards compatibility
|
|
90
|
+
* @returns SdkViewSection[]
|
|
91
|
+
*/
|
|
92
|
+
const buildLoginSections = () => {
|
|
93
|
+
let loginViewSections = [];
|
|
94
|
+
authorizationViewDisplayOrder === null || authorizationViewDisplayOrder === void 0 ? void 0 : authorizationViewDisplayOrder.forEach((loginItem, index) => {
|
|
95
|
+
var _a, _b, _c;
|
|
96
|
+
if (loginItem === 'email' && ((_a = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.providers) === null || _a === void 0 ? void 0 : _a.length)) {
|
|
97
|
+
loginViewSections = loginViewSections.concat(getEmailViewSectionDefinition(),
|
|
98
|
+
// add separator if wallets defined
|
|
99
|
+
addSeparator(index, loginItem));
|
|
100
|
+
}
|
|
101
|
+
if (loginItem === 'wallet' && (wallets === null || wallets === void 0 ? void 0 : wallets.length)) {
|
|
102
|
+
// if showWalletsButton is true, it should show "Connec with Wallet" button
|
|
103
|
+
const numOfItemsToDisplay = ((_c = (_b = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.design) === null || _b === void 0 ? void 0 : _b.modal) === null || _c === void 0 ? void 0 : _c.showWalletsButton)
|
|
104
|
+
? 0
|
|
105
|
+
: NUMBER_OF_WALLETS;
|
|
106
|
+
loginViewSections = loginViewSections.concat([
|
|
107
|
+
{
|
|
108
|
+
numOfItemsToDisplay,
|
|
109
|
+
type: sdkApi.SdkViewSectionType.Wallet,
|
|
110
|
+
},
|
|
111
|
+
],
|
|
112
|
+
// add separator if email providers defined
|
|
113
|
+
addSeparator(index, loginItem));
|
|
114
|
+
}
|
|
115
|
+
});
|
|
116
|
+
return loginViewSections;
|
|
117
|
+
};
|
|
118
|
+
/**
|
|
119
|
+
* returns the login view sections to be displayed in order from projectSettings?.sdk?.views
|
|
120
|
+
* and has backwards compatibility with project settings design.modal props
|
|
121
|
+
*/
|
|
122
|
+
const logingViewSections = React.useMemo(() => {
|
|
123
|
+
var _a, _b, _c, _d, _e;
|
|
124
|
+
const loginView = (_b = (_a = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.sdk) === null || _a === void 0 ? void 0 : _a.views) === null || _b === void 0 ? void 0 : _b.find((view) => view.type === sdkApi.SdkViewType.Login);
|
|
125
|
+
if ((_c = loginView === null || loginView === void 0 ? void 0 : loginView.sections) === null || _c === void 0 ? void 0 : _c.length) {
|
|
126
|
+
return filterLoginViewSections(loginView === null || loginView === void 0 ? void 0 : loginView.sections);
|
|
127
|
+
}
|
|
128
|
+
if ((_e = (_d = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.design) === null || _d === void 0 ? void 0 : _d.modal) === null || _e === void 0 ? void 0 : _e.emailOnly) {
|
|
129
|
+
return getEmailViewSectionDefinition();
|
|
130
|
+
}
|
|
131
|
+
return buildLoginSections();
|
|
132
|
+
}, [
|
|
133
|
+
projectSettings,
|
|
134
|
+
authorizationViewDisplayOrder,
|
|
135
|
+
getEmailViewSectionDefinition,
|
|
136
|
+
filterLoginViewSections,
|
|
137
|
+
buildLoginSections,
|
|
138
|
+
]);
|
|
139
|
+
return {
|
|
140
|
+
isWalletOnly,
|
|
141
|
+
logingViewSections,
|
|
142
|
+
};
|
|
143
|
+
};
|
|
144
|
+
|
|
145
|
+
exports.NUMBER_OF_WALLETS = NUMBER_OF_WALLETS;
|
|
146
|
+
exports.useLoginView = useLoginView;
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
import { useMemo } from 'react';
|
|
2
|
+
import { SdkViewType, SdkViewSectionType } from '@dynamic-labs/sdk-api';
|
|
3
|
+
import { useInternalDynamicContext } from '../../context/DynamicContext/useInternalDynamicContext.js';
|
|
4
|
+
|
|
5
|
+
const NUMBER_OF_WALLETS = 3;
|
|
6
|
+
const useLoginView = () => {
|
|
7
|
+
const { projectSettings, authorizationViewDisplayOrder, loginWithEmail, wallets, } = useInternalDynamicContext();
|
|
8
|
+
const isWalletOnly = useMemo(() => {
|
|
9
|
+
var _a, _b, _c, _d, _e, _f;
|
|
10
|
+
if (!projectSettings) {
|
|
11
|
+
return false;
|
|
12
|
+
}
|
|
13
|
+
// toolkit functionality overrides whatever is defined
|
|
14
|
+
if (!loginWithEmail) {
|
|
15
|
+
return true;
|
|
16
|
+
}
|
|
17
|
+
const loginView = (_b = (_a = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.sdk) === null || _a === void 0 ? void 0 : _a.views) === null || _b === void 0 ? void 0 : _b.find((view) => view.type === SdkViewType.Login);
|
|
18
|
+
// backwards compatibility for those that didn't set up login view sessions
|
|
19
|
+
if (!((_c = loginView === null || loginView === void 0 ? void 0 : loginView.sections) === null || _c === void 0 ? void 0 : _c.length)) {
|
|
20
|
+
return (!((_e = (_d = projectSettings.design) === null || _d === void 0 ? void 0 : _d.modal) === null || _e === void 0 ? void 0 : _e.emailOnly) &&
|
|
21
|
+
!((_f = projectSettings.providers) === null || _f === void 0 ? void 0 : _f.length));
|
|
22
|
+
}
|
|
23
|
+
return (loginView.sections.length === 1 && loginView.sections[0].type === 'wallet');
|
|
24
|
+
}, [projectSettings, loginWithEmail]);
|
|
25
|
+
/**
|
|
26
|
+
* build email and social view sections from project settings design.modal props - backwards compatibility
|
|
27
|
+
* @returns SdkViewSection[]
|
|
28
|
+
*/
|
|
29
|
+
const getEmailViewSectionDefinition = () => {
|
|
30
|
+
var _a, _b, _c, _d;
|
|
31
|
+
const loginViewSections = [
|
|
32
|
+
{
|
|
33
|
+
type: SdkViewSectionType.Email,
|
|
34
|
+
},
|
|
35
|
+
];
|
|
36
|
+
const numOfProvidersToDisplay = (_b = (_a = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.sdk.socialSignIn) === null || _a === void 0 ? void 0 : _a.providers) === null || _b === void 0 ? void 0 : _b.filter((provider) => provider.enabled).length;
|
|
37
|
+
if (numOfProvidersToDisplay) {
|
|
38
|
+
loginViewSections.push({
|
|
39
|
+
numOfItemsToDisplay: numOfProvidersToDisplay,
|
|
40
|
+
type: SdkViewSectionType.Social,
|
|
41
|
+
});
|
|
42
|
+
if ((_c = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.design.modal) === null || _c === void 0 ? void 0 : _c.splitEmailAndSocial) {
|
|
43
|
+
loginViewSections.splice(1, 0, {
|
|
44
|
+
label: 'Or',
|
|
45
|
+
type: SdkViewSectionType.Separator,
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
if ((_d = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.design.modal) === null || _d === void 0 ? void 0 : _d.socialAboveEmail) {
|
|
50
|
+
loginViewSections.reverse();
|
|
51
|
+
}
|
|
52
|
+
return loginViewSections;
|
|
53
|
+
};
|
|
54
|
+
// TODO: https://linear.app/dynamic-labs/issue/GVTY-212/rethink-or-implement-toolkit-template-for-email-wallet-order
|
|
55
|
+
/**
|
|
56
|
+
* remove wallet view section from projectSettings?.sdk?.views if no wallet defined
|
|
57
|
+
* @param sections
|
|
58
|
+
* @returns
|
|
59
|
+
*/
|
|
60
|
+
const filterLoginViewSections = (sections) => {
|
|
61
|
+
if (wallets === null || wallets === void 0 ? void 0 : wallets.length) {
|
|
62
|
+
return sections;
|
|
63
|
+
}
|
|
64
|
+
return sections.filter((section) => section.type !== 'wallet');
|
|
65
|
+
};
|
|
66
|
+
const addSeparator = (index, loginItem) => {
|
|
67
|
+
var _a;
|
|
68
|
+
// if not the first index, no separator is needed
|
|
69
|
+
// if the first index but does not have wallets or providers,
|
|
70
|
+
// it'll show only one view section - no separator is needed
|
|
71
|
+
if (index !== 0 ||
|
|
72
|
+
!(wallets === null || wallets === void 0 ? void 0 : wallets.length) ||
|
|
73
|
+
!((_a = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.providers) === null || _a === void 0 ? void 0 : _a.length)) {
|
|
74
|
+
return [];
|
|
75
|
+
}
|
|
76
|
+
const label = loginItem === 'email' ? 'Or continue with a wallet' : 'Or continue with';
|
|
77
|
+
return [
|
|
78
|
+
{
|
|
79
|
+
label,
|
|
80
|
+
type: SdkViewSectionType.Separator,
|
|
81
|
+
},
|
|
82
|
+
];
|
|
83
|
+
};
|
|
84
|
+
/**
|
|
85
|
+
* build login view sections array from project settings design.modal props - backwards compatibility
|
|
86
|
+
* @returns SdkViewSection[]
|
|
87
|
+
*/
|
|
88
|
+
const buildLoginSections = () => {
|
|
89
|
+
let loginViewSections = [];
|
|
90
|
+
authorizationViewDisplayOrder === null || authorizationViewDisplayOrder === void 0 ? void 0 : authorizationViewDisplayOrder.forEach((loginItem, index) => {
|
|
91
|
+
var _a, _b, _c;
|
|
92
|
+
if (loginItem === 'email' && ((_a = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.providers) === null || _a === void 0 ? void 0 : _a.length)) {
|
|
93
|
+
loginViewSections = loginViewSections.concat(getEmailViewSectionDefinition(),
|
|
94
|
+
// add separator if wallets defined
|
|
95
|
+
addSeparator(index, loginItem));
|
|
96
|
+
}
|
|
97
|
+
if (loginItem === 'wallet' && (wallets === null || wallets === void 0 ? void 0 : wallets.length)) {
|
|
98
|
+
// if showWalletsButton is true, it should show "Connec with Wallet" button
|
|
99
|
+
const numOfItemsToDisplay = ((_c = (_b = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.design) === null || _b === void 0 ? void 0 : _b.modal) === null || _c === void 0 ? void 0 : _c.showWalletsButton)
|
|
100
|
+
? 0
|
|
101
|
+
: NUMBER_OF_WALLETS;
|
|
102
|
+
loginViewSections = loginViewSections.concat([
|
|
103
|
+
{
|
|
104
|
+
numOfItemsToDisplay,
|
|
105
|
+
type: SdkViewSectionType.Wallet,
|
|
106
|
+
},
|
|
107
|
+
],
|
|
108
|
+
// add separator if email providers defined
|
|
109
|
+
addSeparator(index, loginItem));
|
|
110
|
+
}
|
|
111
|
+
});
|
|
112
|
+
return loginViewSections;
|
|
113
|
+
};
|
|
114
|
+
/**
|
|
115
|
+
* returns the login view sections to be displayed in order from projectSettings?.sdk?.views
|
|
116
|
+
* and has backwards compatibility with project settings design.modal props
|
|
117
|
+
*/
|
|
118
|
+
const logingViewSections = useMemo(() => {
|
|
119
|
+
var _a, _b, _c, _d, _e;
|
|
120
|
+
const loginView = (_b = (_a = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.sdk) === null || _a === void 0 ? void 0 : _a.views) === null || _b === void 0 ? void 0 : _b.find((view) => view.type === SdkViewType.Login);
|
|
121
|
+
if ((_c = loginView === null || loginView === void 0 ? void 0 : loginView.sections) === null || _c === void 0 ? void 0 : _c.length) {
|
|
122
|
+
return filterLoginViewSections(loginView === null || loginView === void 0 ? void 0 : loginView.sections);
|
|
123
|
+
}
|
|
124
|
+
if ((_e = (_d = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.design) === null || _d === void 0 ? void 0 : _d.modal) === null || _e === void 0 ? void 0 : _e.emailOnly) {
|
|
125
|
+
return getEmailViewSectionDefinition();
|
|
126
|
+
}
|
|
127
|
+
return buildLoginSections();
|
|
128
|
+
}, [
|
|
129
|
+
projectSettings,
|
|
130
|
+
authorizationViewDisplayOrder,
|
|
131
|
+
getEmailViewSectionDefinition,
|
|
132
|
+
filterLoginViewSections,
|
|
133
|
+
buildLoginSections,
|
|
134
|
+
]);
|
|
135
|
+
return {
|
|
136
|
+
isWalletOnly,
|
|
137
|
+
logingViewSections,
|
|
138
|
+
};
|
|
139
|
+
};
|
|
140
|
+
|
|
141
|
+
export { NUMBER_OF_WALLETS, useLoginView };
|
|
@@ -57,7 +57,7 @@ var Badge = require('../../../components/Badge/Badge.cjs');
|
|
|
57
57
|
var isWalletGroup = require('../../../utils/functions/walletListBuilder/utils/isWalletGroup/isWalletGroup.cjs');
|
|
58
58
|
var WalletGroupContext = require('../../../context/WalletGroupContext/WalletGroupContext.cjs');
|
|
59
59
|
|
|
60
|
-
const WalletListItem = ({ usingMultiWallet, wallet, onResetSearchValue, tile = ({ leading, name, onClick, trailing }) => (jsxRuntime.jsx(ListTile.ListTile, Object.assign({ leading: leading, trailing: trailing, onClick: onClick, className: 'wallet-list-item__tile', dataTestId: 'ListTile' }, { children: name }))), }) => {
|
|
60
|
+
const WalletListItem = ({ disabled = false, usingMultiWallet, wallet, onResetSearchValue, tile = ({ leading, name, onClick, trailing }) => (jsxRuntime.jsx(ListTile.ListTile, Object.assign({ leading: leading, trailing: trailing, onClick: onClick, className: 'wallet-list-item__tile', dataTestId: 'ListTile' }, { children: name }))), }) => {
|
|
61
61
|
const { navigateToWalletGroup } = WalletGroupContext.useWalletGroupContext();
|
|
62
62
|
const _isWalletGroup = isWalletGroup.isWalletGroup(wallet);
|
|
63
63
|
const { walletBook: walletBook$1 } = walletBook.useWalletBookContext();
|
|
@@ -69,7 +69,7 @@ const WalletListItem = ({ usingMultiWallet, wallet, onResetSearchValue, tile = (
|
|
|
69
69
|
const Tile = tile;
|
|
70
70
|
const isComingSoon = label === 'Coming soon';
|
|
71
71
|
const handleClick = () => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
72
|
-
if (isComingSoon) {
|
|
72
|
+
if (isComingSoon || disabled) {
|
|
73
73
|
return;
|
|
74
74
|
}
|
|
75
75
|
onResetSearchValue === null || onResetSearchValue === void 0 ? void 0 : onResetSearchValue('');
|
|
@@ -53,7 +53,7 @@ import { Badge } from '../../../components/Badge/Badge.js';
|
|
|
53
53
|
import { isWalletGroup } from '../../../utils/functions/walletListBuilder/utils/isWalletGroup/isWalletGroup.js';
|
|
54
54
|
import { useWalletGroupContext } from '../../../context/WalletGroupContext/WalletGroupContext.js';
|
|
55
55
|
|
|
56
|
-
const WalletListItem = ({ usingMultiWallet, wallet, onResetSearchValue, tile = ({ leading, name, onClick, trailing }) => (jsx(ListTile, Object.assign({ leading: leading, trailing: trailing, onClick: onClick, className: 'wallet-list-item__tile', dataTestId: 'ListTile' }, { children: name }))), }) => {
|
|
56
|
+
const WalletListItem = ({ disabled = false, usingMultiWallet, wallet, onResetSearchValue, tile = ({ leading, name, onClick, trailing }) => (jsx(ListTile, Object.assign({ leading: leading, trailing: trailing, onClick: onClick, className: 'wallet-list-item__tile', dataTestId: 'ListTile' }, { children: name }))), }) => {
|
|
57
57
|
const { navigateToWalletGroup } = useWalletGroupContext();
|
|
58
58
|
const _isWalletGroup = isWalletGroup(wallet);
|
|
59
59
|
const { walletBook } = useWalletBookContext();
|
|
@@ -65,7 +65,7 @@ const WalletListItem = ({ usingMultiWallet, wallet, onResetSearchValue, tile = (
|
|
|
65
65
|
const Tile = tile;
|
|
66
66
|
const isComingSoon = label === 'Coming soon';
|
|
67
67
|
const handleClick = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
68
|
-
if (isComingSoon) {
|
|
68
|
+
if (isComingSoon || disabled) {
|
|
69
69
|
return;
|
|
70
70
|
}
|
|
71
71
|
onResetSearchValue === null || onResetSearchValue === void 0 ? void 0 : onResetSearchValue('');
|
|
@@ -5,6 +5,7 @@ export type WalletListItemProps = {
|
|
|
5
5
|
tile?: WalletListItemTile;
|
|
6
6
|
usingMultiWallet: boolean;
|
|
7
7
|
wallet: WalletOption;
|
|
8
|
+
disabled?: boolean;
|
|
8
9
|
};
|
|
9
10
|
export type WalletListItemComponent = (props: WalletListItemProps) => ReactElement;
|
|
10
11
|
export type WalletListItemTileProps = {
|
|
@@ -10,7 +10,6 @@ var EmailConfirmationWaitingView = require('./EmailConfirmationWaitingView/Email
|
|
|
10
10
|
var EmailUpdate = require('./EmailUpdate/EmailUpdate.cjs');
|
|
11
11
|
var EmailVerification = require('./EmailVerification/EmailVerification.cjs');
|
|
12
12
|
var EmailWalletOTPVerificationView = require('./EmailWalletOTPVerificationView/EmailWalletOTPVerificationView.cjs');
|
|
13
|
-
var LoginWithEmailView = require('./LoginWithEmailView/LoginWithEmailView.cjs');
|
|
14
13
|
var NetworkNotSupported = require('./NetworkNotSupported/NetworkNotSupported.cjs');
|
|
15
14
|
var NetworkNotSupportedSwitchManual = require('./NetworkNotSupportedSwitchManual/NetworkNotSupportedSwitchManual.cjs');
|
|
16
15
|
var NoQrNotInstalledView = require('./NoQrNotInstalledView/NoQrNotInstalledView.cjs');
|
|
@@ -31,6 +30,7 @@ var BridgeNextWalletConnectionView = require('./BridgeNextWalletConnectionView/B
|
|
|
31
30
|
var AccountExistsView = require('./AccountExistsView/AccountExistsView.cjs');
|
|
32
31
|
var MergeUserAccountsView = require('./MergeUserAccountsView/MergeUserAccountsView.cjs');
|
|
33
32
|
var WalletCannotBeTransferredView = require('./WalletCannotBeTransferredView/WalletCannotBeTransferredView.cjs');
|
|
33
|
+
var LoginView = require('./LoginView/LoginView.cjs');
|
|
34
34
|
|
|
35
35
|
const viewToComponentMap = {
|
|
36
36
|
'account-exists': jsxRuntime.jsx(AccountExistsView.AccountExistsView, {}),
|
|
@@ -43,9 +43,10 @@ const viewToComponentMap = {
|
|
|
43
43
|
'collect-user-data-login-with-email': jsxRuntime.jsx(CollectUserDataViewLoginWithEmail.CollectUserDataViewLoginWithEmail, {}),
|
|
44
44
|
'email-wallet-otp-verification-view': jsxRuntime.jsx(EmailWalletOTPVerificationView.EmailWalletOTPVerificationView, {}),
|
|
45
45
|
'gate-blocked-wallet': jsxRuntime.jsx(NoAccess.NoAccess, {}),
|
|
46
|
-
'login-with-email-or-wallet': jsxRuntime.jsx(
|
|
47
|
-
'login-with-email-or-wallet-full-wallet-list': jsxRuntime.jsx(
|
|
46
|
+
'login-with-email-or-wallet': jsxRuntime.jsx(LoginView.LoginView, {}),
|
|
47
|
+
'login-with-email-or-wallet-full-wallet-list': jsxRuntime.jsx(LoginView.LoginView, {}),
|
|
48
48
|
'login-with-email-verification': jsxRuntime.jsx(EmailVerification.EmailVerification, {}),
|
|
49
|
+
'login-with-wallet-only': jsxRuntime.jsx(LoginView.LoginView, {}),
|
|
49
50
|
'merge-user-accounts': jsxRuntime.jsx(MergeUserAccountsView.MergeUserAccountsView, {}),
|
|
50
51
|
'network-not-supported': jsxRuntime.jsx(NetworkNotSupported.NetworkNotSupported, {}),
|
|
51
52
|
'network-not-supported-manual': jsxRuntime.jsx(NetworkNotSupportedSwitchManual.NetworkNotSupportedSwitchManual, {}),
|