@dynamic-labs/sdk-react-core 1.2.0-alpha.0 → 2.0.0-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +21 -0
- package/package.cjs +1 -1
- package/package.js +1 -1
- package/package.json +10 -10
- package/src/index.cjs +1 -0
- package/src/index.js +1 -1
- package/src/lib/components/Badge/Badge.cjs +1 -1
- package/src/lib/components/Badge/Badge.d.ts +1 -1
- package/src/lib/components/Badge/Badge.js +1 -1
- package/src/lib/components/Badge/Badge.types.d.ts +1 -0
- package/src/lib/components/IconWithSpinner/IconWithSpinner.cjs +2 -13
- package/src/lib/components/IconWithSpinner/IconWithSpinner.js +2 -13
- package/src/lib/context/DynamicContext/DynamicContext.cjs +4 -2
- package/src/lib/context/DynamicContext/DynamicContext.d.ts +2 -1
- package/src/lib/context/DynamicContext/DynamicContext.js +5 -3
- package/src/lib/context/DynamicContext/types/index.d.ts +4 -2
- package/src/lib/locale/en/translation.cjs +8 -0
- package/src/lib/locale/en/translation.d.ts +8 -0
- package/src/lib/locale/en/translation.js +8 -0
- package/src/lib/main.global.cjs +1 -1
- package/src/lib/main.global.js +1 -1
- package/src/lib/shared/types/index.d.ts +5 -1
- package/src/lib/shared/utils/functions/getWalletListItemLabel/getWalletListItemLabel.cjs +23 -10
- package/src/lib/shared/utils/functions/getWalletListItemLabel/getWalletListItemLabel.d.ts +7 -3
- package/src/lib/shared/utils/functions/getWalletListItemLabel/getWalletListItemLabel.js +23 -10
- package/src/lib/styles/index.shadow.cjs +1 -1
- package/src/lib/styles/index.shadow.js +1 -1
- package/src/lib/utils/functions/walletFilters/index.cjs +6 -0
- package/src/lib/utils/functions/walletFilters/index.d.ts +5 -0
- package/src/lib/utils/functions/walletFilters/index.js +6 -1
- package/src/lib/utils/functions/walletListBuilder/walletListBuilder.cjs +30 -8
- package/src/lib/utils/functions/walletListBuilder/walletListBuilder.d.ts +3 -2
- package/src/lib/utils/functions/walletListBuilder/walletListBuilder.js +30 -8
- package/src/lib/utils/hooks/useEmbeddedReveal/useEmbeddedReveal.cjs +1 -6
- package/src/lib/utils/hooks/useEmbeddedReveal/useEmbeddedReveal.js +1 -6
- package/src/lib/utils/hooks/usePasskeyRecovery/usePasskeyRecovery.cjs +9 -15
- package/src/lib/utils/hooks/usePasskeyRecovery/usePasskeyRecovery.js +10 -16
- package/src/lib/views/EmbeddedReveal/EmbeddedRevealView/EmbeddedRevealView.cjs +21 -19
- package/src/lib/views/EmbeddedReveal/EmbeddedRevealView/EmbeddedRevealView.d.ts +5 -1
- package/src/lib/views/EmbeddedReveal/EmbeddedRevealView/EmbeddedRevealView.js +22 -20
- package/src/lib/views/LoginView/sections/WalletSignInSection/ListItemButton/ListItemButton.cjs +1 -1
- package/src/lib/views/LoginView/sections/WalletSignInSection/ListItemButton/ListItemButton.js +1 -1
- package/src/lib/views/LoginView/sections/WalletSignInSection/WalletSimpleSignIn/WalletSimpleSignIn.cjs +2 -1
- package/src/lib/views/LoginView/sections/WalletSignInSection/WalletSimpleSignIn/WalletSimpleSignIn.js +2 -1
- package/src/lib/views/Passkey/EmbeddedAuthChoice/EmbeddedAuthChoice.cjs +21 -8
- package/src/lib/views/Passkey/EmbeddedAuthChoice/EmbeddedAuthChoice.js +21 -8
- package/src/lib/views/Passkey/EmbeddedAuthChoiceCards/ActionCard/ActionCard.cjs +1 -1
- package/src/lib/views/Passkey/EmbeddedAuthChoiceCards/ActionCard/ActionCard.js +1 -1
- package/src/lib/views/Passkey/EmbeddedAuthChoiceCards/EmbeddedAuthChoiceCards.cjs +3 -1
- package/src/lib/views/Passkey/EmbeddedAuthChoiceCards/EmbeddedAuthChoiceCards.js +3 -1
- package/src/lib/views/Passkey/PasskeyRecovery/BundleValidation/PasskeyBundleRecovery.cjs +3 -0
- package/src/lib/views/Passkey/PasskeyRecovery/BundleValidation/PasskeyBundleRecovery.js +3 -0
- package/src/lib/views/Passkey/utils/passkeyRecovery/passkeyRecovery.cjs +20 -1
- package/src/lib/views/Passkey/utils/passkeyRecovery/passkeyRecovery.d.ts +2 -1
- package/src/lib/views/Passkey/utils/passkeyRecovery/passkeyRecovery.js +20 -2
- package/src/lib/views/SelectWalletInWalletGroupView/components/WalletGroupItem/WalletGroupItem.cjs +6 -3
- package/src/lib/views/SelectWalletInWalletGroupView/components/WalletGroupItem/WalletGroupItem.js +6 -3
- package/src/lib/views/WalletGroupView/components/WalletGroupItem/WalletGroupItem.cjs +4 -4
- package/src/lib/views/WalletGroupView/components/WalletGroupItem/WalletGroupItem.js +4 -4
- package/src/lib/views/WalletList/WalletList.cjs +12 -19
- package/src/lib/views/WalletList/WalletList.js +13 -20
- package/src/lib/views/WalletList/WalletListItem/WalletListItem.cjs +5 -4
- package/src/lib/views/WalletList/WalletListItem/WalletListItem.js +5 -4
- package/src/lib/views/WalletList/WalletListItem/WalletListItem.types.d.ts +2 -1
- package/src/lib/views/WalletList/hooks/useTabState.cjs +87 -0
- package/src/lib/views/WalletList/hooks/useTabState.d.ts +7 -0
- package/src/lib/views/WalletList/hooks/useTabState.js +83 -0
- package/src/lib/views/WalletList/utils/getEffectiveRecommendedWallets.cjs +12 -0
- package/src/lib/views/WalletList/utils/getEffectiveRecommendedWallets.d.ts +3 -0
- package/src/lib/views/WalletList/utils/getEffectiveRecommendedWallets.js +8 -0
- package/src/lib/views/WalletList/utils/getEffectiveWalletFilter.cjs +12 -0
- package/src/lib/views/WalletList/utils/getEffectiveWalletFilter.d.ts +2 -0
- package/src/lib/views/WalletList/utils/getEffectiveWalletFilter.js +8 -0
- package/src/lib/widgets/DynamicWidget/components/DotsMenuDropdown/DotsMenuDropdown.cjs +1 -1
- package/src/lib/widgets/DynamicWidget/components/DotsMenuDropdown/DotsMenuDropdown.js +1 -1
- package/src/lib/widgets/DynamicWidget/views/WalletSettingsView/WalletSettingsView.cjs +10 -5
- package/src/lib/widgets/DynamicWidget/views/WalletSettingsView/WalletSettingsView.js +10 -5
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
2
|
-
import { useState,
|
|
2
|
+
import { useState, useRef } from 'react';
|
|
3
3
|
import { useTranslation } from 'react-i18next';
|
|
4
4
|
import { useWalletBookContext } from '@dynamic-labs/wallet-book';
|
|
5
5
|
import { ErrorContainer } from '../../components/ErrorContainer/ErrorContainer.js';
|
|
@@ -72,39 +72,32 @@ import '../../widgets/DynamicWidget/context/DynamicWidgetContext.js';
|
|
|
72
72
|
import '../../components/UserProfile/parts/UserProfileField/components/VerifiedEmailIcon/VerifiedEmailIcon.js';
|
|
73
73
|
import '@dynamic-labs/viem-utils';
|
|
74
74
|
import '../../widgets/DynamicWidget/views/ManagePasskeysWidgetView/PasskeyCard/PasskeyCard.js';
|
|
75
|
-
import { useViewSettings } from '../../utils/hooks/useViewSettings/useViewSettings.js';
|
|
76
75
|
import { useInternalDynamicContext } from '../../context/DynamicContext/useDynamicContext/useInternalDynamicContext.js';
|
|
77
76
|
import { FilterBridgeChainsName } from '../../utils/functions/walletFilters/index.js';
|
|
78
77
|
import { isUserLinkingWallet } from '../../shared/utils/functions/isUserLinkingWallet/isUserLinkingWallet.js';
|
|
79
78
|
import { SearchNotFoundMessage } from './SearchNotFoundMessage/SearchNotFoundMessage.js';
|
|
80
79
|
import { WalletListGridTabs } from './WalletListGridTabs/WalletListGridTabs.js';
|
|
80
|
+
import { useTabState } from './hooks/useTabState.js';
|
|
81
|
+
import { getEffectiveWalletFilter } from './utils/getEffectiveWalletFilter.js';
|
|
82
|
+
import { getEffectiveRecommendedWallets } from './utils/getEffectiveRecommendedWallets.js';
|
|
81
83
|
|
|
82
84
|
LocalStorage.setToLS(WALLET_PICKER_SEARCH_KEY, '');
|
|
83
85
|
const WalletList = ({ isWalletConnectList = false, }) => {
|
|
84
|
-
var _a
|
|
85
|
-
const { walletsFilter, signWithEmailWalletName, walletConnectorOptions, projectSettings, defaultNumberOfWalletsToShow, bridgeChainsToConnect, connectedWallets, authMode, multiWallet, user, } = useInternalDynamicContext();
|
|
86
|
+
var _a;
|
|
87
|
+
const { walletsFilter, signWithEmailWalletName, walletConnectorOptions, projectSettings, defaultNumberOfWalletsToShow, bridgeChainsToConnect, connectedWallets, authMode, multiWallet, user, recommendedWallets, } = useInternalDynamicContext();
|
|
86
88
|
const { view } = useViewContext();
|
|
87
|
-
const
|
|
89
|
+
const { selectedTabIndex, setSelectedTabIndex, selectedTabSettings, tabsItems, } = useTabState();
|
|
88
90
|
const isLinkingWallet = isUserLinkingWallet(user, view.type, false);
|
|
89
|
-
const walletListViewSettings = useViewSettings('wallet-list');
|
|
90
|
-
const selectedTabSettings = selectedTabIndex === null
|
|
91
|
-
? undefined
|
|
92
|
-
: (_a = walletListViewSettings === null || walletListViewSettings === void 0 ? void 0 : walletListViewSettings.tabs) === null || _a === void 0 ? void 0 : _a.items[selectedTabIndex];
|
|
93
91
|
const { walletBook } = useWalletBookContext();
|
|
94
92
|
const { error } = useErrorContext();
|
|
95
93
|
const { showDefaultFooter } = useAuthLayoutChecks();
|
|
96
94
|
const [footerBorderIsVisible, setFooterBorderIsVisible] = useState(true);
|
|
97
95
|
const { t } = useTranslation();
|
|
98
|
-
const [filterValue, setFilterValue] = useState((
|
|
96
|
+
const [filterValue, setFilterValue] = useState((_a = LocalStorage.getFromLS(WALLET_PICKER_SEARCH_KEY)) !== null && _a !== void 0 ? _a : '');
|
|
99
97
|
const getFilteredBridgeChains = (bridgeChainsToConnect === null || bridgeChainsToConnect === void 0 ? void 0 : bridgeChainsToConnect.length) &&
|
|
100
98
|
FilterBridgeChainsName(bridgeChainsToConnect[0].chain);
|
|
101
99
|
const filteredBridgeChains = getFilteredBridgeChains && getFilteredBridgeChains(walletConnectorOptions);
|
|
102
|
-
const
|
|
103
|
-
if (selectedTabSettings) {
|
|
104
|
-
return selectedTabSettings === null || selectedTabSettings === void 0 ? void 0 : selectedTabSettings.walletsFilter;
|
|
105
|
-
}
|
|
106
|
-
return walletsFilter;
|
|
107
|
-
}, [selectedTabSettings, walletsFilter]);
|
|
100
|
+
const effectiveRecommendedWallets = getEffectiveRecommendedWallets(selectedTabSettings, recommendedWallets);
|
|
108
101
|
const { numberOfWallets, walletsList } = walletListBuilder({
|
|
109
102
|
authMode,
|
|
110
103
|
connectedWallets,
|
|
@@ -114,11 +107,12 @@ const WalletList = ({ isWalletConnectList = false, }) => {
|
|
|
114
107
|
lastUsedWalletKey: LocalStorage.getFromLS(LAST_USED_WALLET),
|
|
115
108
|
multiWallet,
|
|
116
109
|
numberOfWalletsToShow: defaultNumberOfWalletsToShow,
|
|
110
|
+
recommendedWallets: effectiveRecommendedWallets,
|
|
117
111
|
searchFilter: filterValue,
|
|
118
112
|
showMoreWalletsWithFilter: true,
|
|
119
113
|
signWithEmailWalletName,
|
|
120
114
|
walletBook,
|
|
121
|
-
walletsFilter:
|
|
115
|
+
walletsFilter: getEffectiveWalletFilter(selectedTabSettings, walletsFilter),
|
|
122
116
|
});
|
|
123
117
|
const isSearchEnabled = numberOfWallets > defaultNumberOfWalletsToShow &&
|
|
124
118
|
walletsList.length !== numberOfWallets;
|
|
@@ -143,10 +137,9 @@ const WalletList = ({ isWalletConnectList = false, }) => {
|
|
|
143
137
|
const searchContainer = !projectSettings ? (jsx(Skeleton, { className: 'wallet-list__search-skeleton' })) : (isSearchEnabled && (jsx("div", { className: classNames('wallet-list__search-container', {
|
|
144
138
|
'wallet-list__search-container--scroll': !error,
|
|
145
139
|
}), children: jsx(Search, { copykey: 'dyn_wallet_list.search.label', label: t('dyn_wallet_list.search.label', { numberOfWallets }), value: filterValue, onChange: ({ target: { value } }) => handleFilterValueChange(value), onClickClear: () => handleFilterValueChange('') }) })));
|
|
146
|
-
return (jsxs(Fragment, { children: [(
|
|
140
|
+
return (jsxs(Fragment, { children: [(tabsItems === null || tabsItems === void 0 ? void 0 : tabsItems.length) && !isLinkingWallet && (jsx("div", { className: 'wallet-list__tabs-container', children: jsx(WalletListGridTabs, { items: tabsItems, value: selectedTabIndex || 0, onSelect: setSelectedTabIndex }) })), searchContainer, Boolean(error) && (jsx(ErrorContainer, { className: 'wallet-list__error-container', withIcon: false, children: error })), jsx("div", { className: 'wallet-list__container', children: jsxs("div", { className: classNames('wallet-list__scroll-container', {
|
|
147
141
|
'wallet-list__scroll-container--error': Boolean(error),
|
|
148
|
-
|
|
149
|
-
}), "data-testid": 'wallet-list-scroll-container', ref: walletListScrollRef, onScroll: handleScroll, children: [!projectSettings ? (jsx(Skeleton, { count: 10, className: 'wallet-list__tile-skeleton' })) : (jsxs(Fragment, { children: [walletConnectorOptions.length === 0 && (jsx(ErrorContainer, { copykey: 'dyn_wallet_list.configuration_mismatch', children: t('dyn_wallet_list.configuration_mismatch') })), walletConnectorOptions.length && walletsList.length === 0 ? (jsx(SearchNotFoundMessage, { title: t('dyn_wallet_list.search.not_found.title'), subtitle: t('dyn_wallet_list.search.not_found.description'), image: jsx(SvgNoWalletFound, {}) })) : (walletsList.map((wallet, index) => (jsx(WalletListItem, { wallet: wallet, onResetSearchValue: () => handleFilterValueChange('') }, `${wallet.key}_${index}`))))] })), isSearchEnabled && !filterValue && projectSettings && (jsx(SearchNotFoundMessage, {}))] }) }), showDefaultFooter && (jsx(DefaultFooter, { hideBorder: !footerBorderIsVisible }))] }));
|
|
142
|
+
}), "data-testid": 'wallet-list-scroll-container', ref: walletListScrollRef, onScroll: handleScroll, children: [!projectSettings ? (jsx(Skeleton, { count: 10, className: 'wallet-list__tile-skeleton' })) : (jsxs(Fragment, { children: [walletConnectorOptions.length === 0 && (jsx(ErrorContainer, { copykey: 'dyn_wallet_list.configuration_mismatch', children: t('dyn_wallet_list.configuration_mismatch') })), walletConnectorOptions.length && walletsList.length === 0 ? (jsx(SearchNotFoundMessage, { title: t('dyn_wallet_list.search.not_found.title'), subtitle: t('dyn_wallet_list.search.not_found.description'), image: jsx(SvgNoWalletFound, {}) })) : (walletsList.map((wallet, index) => (jsx(WalletListItem, { wallet: wallet, onResetSearchValue: () => handleFilterValueChange(''), recommendedWallets: effectiveRecommendedWallets }, `${wallet.key}_${index}`))))] })), isSearchEnabled && !filterValue && projectSettings && (jsx(SearchNotFoundMessage, {}))] }) }), showDefaultFooter && (jsx(DefaultFooter, { hideBorder: !footerBorderIsVisible }))] }));
|
|
150
143
|
};
|
|
151
144
|
|
|
152
145
|
export { WalletList };
|
|
@@ -48,7 +48,6 @@ require('../../../components/ShadowDOM/ShadowDOM.cjs');
|
|
|
48
48
|
require('../../../components/OverlayCard/OverlayCard.context.cjs');
|
|
49
49
|
require('../../../context/FooterAnimationContext/index.cjs');
|
|
50
50
|
var Typography = require('../../../components/Typography/Typography.cjs');
|
|
51
|
-
var Badge = require('../../../components/Badge/Badge.cjs');
|
|
52
51
|
var isWalletGroup = require('../../../utils/functions/walletListBuilder/utils/isWalletGroup/isWalletGroup.cjs');
|
|
53
52
|
var WalletGroupContext = require('../../../context/WalletGroupContext/WalletGroupContext.cjs');
|
|
54
53
|
var ListTileAnimatedTrailing = require('../../../components/ListTileAnimatedTrailing/ListTileAnimatedTrailing.cjs');
|
|
@@ -67,6 +66,7 @@ require('../../../components/PasskeyCreatedSuccessBanner/PasskeyCreatedSuccessBa
|
|
|
67
66
|
require('../../../context/PasskeyContext/PasskeyContext.cjs');
|
|
68
67
|
require('@dynamic-labs/viem-utils');
|
|
69
68
|
require('../../../widgets/DynamicWidget/views/ManagePasskeysWidgetView/PasskeyCard/PasskeyCard.cjs');
|
|
69
|
+
var Badge = require('../../../components/Badge/Badge.cjs');
|
|
70
70
|
var ListTile = require('../../../components/ListTile/ListTile.cjs');
|
|
71
71
|
require('../../../components/InlineWidget/InlineWidget.cjs');
|
|
72
72
|
require('../../../components/IsBrowser/IsBrowser.cjs');
|
|
@@ -78,13 +78,14 @@ require('@hcaptcha/react-hcaptcha');
|
|
|
78
78
|
require('../../../context/SocialRedirectContext/SocialRedirectContext.cjs');
|
|
79
79
|
require('../../../widgets/DynamicBridgeWidget/views/WalletsView/components/SecondaryWallets/SecondaryWallets.cjs');
|
|
80
80
|
|
|
81
|
-
const WalletListItem = ({ disabled = false, wallet, onResetSearchValue, tile = ({ leading, name, onClick, trailing }) => (jsxRuntime.jsx(ListTile.ListTile, { leading: leading, trailing: trailing, onClick: onClick, className: 'wallet-list-item__tile', dataTestId: 'ListTile', children: name })), }) => {
|
|
81
|
+
const WalletListItem = ({ disabled = false, wallet, onResetSearchValue, recommendedWallets, tile = ({ leading, name, onClick, trailing }) => (jsxRuntime.jsx(ListTile.ListTile, { leading: leading, trailing: trailing, onClick: onClick, className: 'wallet-list-item__tile', dataTestId: 'ListTile', children: name })), }) => {
|
|
82
82
|
const { navigateToWalletGroup } = WalletGroupContext.useWalletGroupContext();
|
|
83
83
|
const { setView } = ViewContext.useViewContext();
|
|
84
84
|
const _isWalletGroup = isWalletGroup.isWalletGroup(wallet);
|
|
85
85
|
const { walletBook: walletBook$1 } = walletBook.useWalletBookContext();
|
|
86
86
|
const { handleWalletItemClick } = useWalletItemActions.useWalletItemActions();
|
|
87
|
-
const
|
|
87
|
+
const labelSettings = getWalletListItemLabel.getWalletListItemLabel({
|
|
88
|
+
recommendedWallets,
|
|
88
89
|
wallet,
|
|
89
90
|
});
|
|
90
91
|
const Tile = tile;
|
|
@@ -112,7 +113,7 @@ const WalletListItem = ({ disabled = false, wallet, onResetSearchValue, tile = (
|
|
|
112
113
|
const leading = (jsxRuntime.jsx(walletBook.WalletIcon, { className: 'wallet-list-item__leading', walletKey: wallet.key, style: { height: pixelToRem.pixelToRem(28), width: pixelToRem.pixelToRem(28) } }));
|
|
113
114
|
const trailing = (jsxRuntime.jsx(ListTileAnimatedTrailing.ListTileAnimatedTrailing, { hoverElement:
|
|
114
115
|
// eslint-disable-next-line react/jsx-wrap-multilines
|
|
115
|
-
jsxRuntime.jsx(Icon.Icon, { color: 'text-tertiary', size: 'mini', children: jsxRuntime.jsx(stroke.ReactComponent, {}) }), children:
|
|
116
|
+
jsxRuntime.jsx(Icon.Icon, { color: 'text-tertiary', size: 'mini', children: jsxRuntime.jsx(stroke.ReactComponent, {}) }), children: labelSettings && (jsxRuntime.jsx(Badge.Badge, { dot: !labelSettings.isRecommended, variant: labelSettings.isRecommended ? 'primary' : 'secondary', text: jsxRuntime.jsx(Typography.Typography, { variant: 'body_small', children: labelSettings.label }) })) }));
|
|
116
117
|
return (jsxRuntime.jsx(Tile, { leading: leading, trailing: trailing, name: name, onClick: handleClick }));
|
|
117
118
|
};
|
|
118
119
|
|
|
@@ -44,7 +44,6 @@ import '../../../components/ShadowDOM/ShadowDOM.js';
|
|
|
44
44
|
import '../../../components/OverlayCard/OverlayCard.context.js';
|
|
45
45
|
import '../../../context/FooterAnimationContext/index.js';
|
|
46
46
|
import { Typography } from '../../../components/Typography/Typography.js';
|
|
47
|
-
import { Badge } from '../../../components/Badge/Badge.js';
|
|
48
47
|
import { isWalletGroup } from '../../../utils/functions/walletListBuilder/utils/isWalletGroup/isWalletGroup.js';
|
|
49
48
|
import { useWalletGroupContext } from '../../../context/WalletGroupContext/WalletGroupContext.js';
|
|
50
49
|
import { ListTileAnimatedTrailing } from '../../../components/ListTileAnimatedTrailing/ListTileAnimatedTrailing.js';
|
|
@@ -63,6 +62,7 @@ import '../../../components/PasskeyCreatedSuccessBanner/PasskeyCreatedSuccessBan
|
|
|
63
62
|
import '../../../context/PasskeyContext/PasskeyContext.js';
|
|
64
63
|
import '@dynamic-labs/viem-utils';
|
|
65
64
|
import '../../../widgets/DynamicWidget/views/ManagePasskeysWidgetView/PasskeyCard/PasskeyCard.js';
|
|
65
|
+
import { Badge } from '../../../components/Badge/Badge.js';
|
|
66
66
|
import { ListTile } from '../../../components/ListTile/ListTile.js';
|
|
67
67
|
import '../../../components/InlineWidget/InlineWidget.js';
|
|
68
68
|
import '../../../components/IsBrowser/IsBrowser.js';
|
|
@@ -74,13 +74,14 @@ import '@hcaptcha/react-hcaptcha';
|
|
|
74
74
|
import '../../../context/SocialRedirectContext/SocialRedirectContext.js';
|
|
75
75
|
import '../../../widgets/DynamicBridgeWidget/views/WalletsView/components/SecondaryWallets/SecondaryWallets.js';
|
|
76
76
|
|
|
77
|
-
const WalletListItem = ({ disabled = false, wallet, onResetSearchValue, tile = ({ leading, name, onClick, trailing }) => (jsx(ListTile, { leading: leading, trailing: trailing, onClick: onClick, className: 'wallet-list-item__tile', dataTestId: 'ListTile', children: name })), }) => {
|
|
77
|
+
const WalletListItem = ({ disabled = false, wallet, onResetSearchValue, recommendedWallets, tile = ({ leading, name, onClick, trailing }) => (jsx(ListTile, { leading: leading, trailing: trailing, onClick: onClick, className: 'wallet-list-item__tile', dataTestId: 'ListTile', children: name })), }) => {
|
|
78
78
|
const { navigateToWalletGroup } = useWalletGroupContext();
|
|
79
79
|
const { setView } = useViewContext();
|
|
80
80
|
const _isWalletGroup = isWalletGroup(wallet);
|
|
81
81
|
const { walletBook } = useWalletBookContext();
|
|
82
82
|
const { handleWalletItemClick } = useWalletItemActions();
|
|
83
|
-
const
|
|
83
|
+
const labelSettings = getWalletListItemLabel({
|
|
84
|
+
recommendedWallets,
|
|
84
85
|
wallet,
|
|
85
86
|
});
|
|
86
87
|
const Tile = tile;
|
|
@@ -108,7 +109,7 @@ const WalletListItem = ({ disabled = false, wallet, onResetSearchValue, tile = (
|
|
|
108
109
|
const leading = (jsx(WalletIcon, { className: 'wallet-list-item__leading', walletKey: wallet.key, style: { height: pixelToRem(28), width: pixelToRem(28) } }));
|
|
109
110
|
const trailing = (jsx(ListTileAnimatedTrailing, { hoverElement:
|
|
110
111
|
// eslint-disable-next-line react/jsx-wrap-multilines
|
|
111
|
-
jsx(Icon, { color: 'text-tertiary', size: 'mini', children: jsx(SvgStroke, {}) }), children:
|
|
112
|
+
jsx(Icon, { color: 'text-tertiary', size: 'mini', children: jsx(SvgStroke, {}) }), children: labelSettings && (jsx(Badge, { dot: !labelSettings.isRecommended, variant: labelSettings.isRecommended ? 'primary' : 'secondary', text: jsx(Typography, { variant: 'body_small', children: labelSettings.label }) })) }));
|
|
112
113
|
return (jsx(Tile, { leading: leading, trailing: trailing, name: name, onClick: handleClick }));
|
|
113
114
|
};
|
|
114
115
|
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { ReactElement, ReactNode } from 'react';
|
|
2
|
-
import { WalletOption } from '../../../shared';
|
|
2
|
+
import { RecommendedWallet, WalletOption } from '../../../shared';
|
|
3
3
|
export type WalletListItemProps = {
|
|
4
4
|
onResetSearchValue?: (newSearchValue: string) => void;
|
|
5
5
|
tile?: WalletListItemTile;
|
|
6
6
|
wallet: WalletOption;
|
|
7
7
|
disabled?: boolean;
|
|
8
|
+
recommendedWallets?: RecommendedWallet[];
|
|
8
9
|
};
|
|
9
10
|
export type WalletListItemComponent = (props: WalletListItemProps) => ReactElement;
|
|
10
11
|
export type WalletListItemTileProps = {
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var React = require('react');
|
|
6
|
+
require('../../../events/dynamicEvents.cjs');
|
|
7
|
+
require('../../../../../_virtual/_tslib.cjs');
|
|
8
|
+
require('@dynamic-labs/utils');
|
|
9
|
+
require('../../../context/DynamicContext/DynamicContext.cjs');
|
|
10
|
+
require('@dynamic-labs/sdk-api');
|
|
11
|
+
require('../../../shared/logger.cjs');
|
|
12
|
+
require('@dynamic-labs/iconic');
|
|
13
|
+
require('@dynamic-labs/wallet-connector-core');
|
|
14
|
+
require('react/jsx-runtime');
|
|
15
|
+
require('../../../context/ViewContext/ViewContext.cjs');
|
|
16
|
+
require('@dynamic-labs/wallet-book');
|
|
17
|
+
require('../../../utils/constants/colors.cjs');
|
|
18
|
+
require('../../../utils/constants/values.cjs');
|
|
19
|
+
require('../../../shared/utils/classes/storage/localStorage.cjs');
|
|
20
|
+
require('viem');
|
|
21
|
+
require('../../../shared/consts/index.cjs');
|
|
22
|
+
require('../../../context/CaptchaContext/CaptchaContext.cjs');
|
|
23
|
+
require('../../../context/ErrorContext/ErrorContext.cjs');
|
|
24
|
+
require('@dynamic-labs/multi-wallet');
|
|
25
|
+
require('viem/chains');
|
|
26
|
+
require('../../../context/AccessDeniedContext/AccessDeniedContext.cjs');
|
|
27
|
+
require('../../../context/AccountExistsContext/AccountExistsContext.cjs');
|
|
28
|
+
require('../../../config/ApiEndpoint.cjs');
|
|
29
|
+
require('../../../context/EmailVerificationContext/EmailVerificationContext.cjs');
|
|
30
|
+
require('react-dom');
|
|
31
|
+
require('../../../context/ThemeContext/ThemeContext.cjs');
|
|
32
|
+
require('@dynamic-labs/types');
|
|
33
|
+
require('yup');
|
|
34
|
+
require('react-i18next');
|
|
35
|
+
require('../../../context/MockContext/MockContext.cjs');
|
|
36
|
+
require('../../../utils/hooks/useUserUpdateRequest/useUpdateUser/useUpdateUser.cjs');
|
|
37
|
+
require('../../../context/UserFieldEditorContext/UserFieldEditorContext.cjs');
|
|
38
|
+
require('@dynamic-labs/rpc-providers');
|
|
39
|
+
require('../../../context/UserWalletsContext/UserWalletsContext.cjs');
|
|
40
|
+
require('../../../components/Alert/Alert.cjs');
|
|
41
|
+
require('../../../components/ShadowDOM/ShadowDOM.cjs');
|
|
42
|
+
require('../../../components/IconButton/IconButton.cjs');
|
|
43
|
+
require('../../../components/InlineWidget/InlineWidget.cjs');
|
|
44
|
+
require('../../../components/IsBrowser/IsBrowser.cjs');
|
|
45
|
+
require('../../../components/MenuList/Dropdown/Dropdown.cjs');
|
|
46
|
+
require('../../../components/Transition/ZoomTransition/ZoomTransition.cjs');
|
|
47
|
+
require('../../../components/Transition/SlideInUpTransition/SlideInUpTransition.cjs');
|
|
48
|
+
require('../../../components/Transition/OpacityTransition/OpacityTransition.cjs');
|
|
49
|
+
require('../../../components/Popper/Popper/Popper.cjs');
|
|
50
|
+
require('../../../components/Popper/PopperContext/PopperContext.cjs');
|
|
51
|
+
require('react-focus-lock');
|
|
52
|
+
require('formik');
|
|
53
|
+
require('i18next');
|
|
54
|
+
require('../../../components/OverlayCard/OverlayCard.context.cjs');
|
|
55
|
+
require('../../../components/PasskeyCreatedSuccessBanner/PasskeyCreatedSuccessBanner.cjs');
|
|
56
|
+
require('../../../context/PasskeyContext/PasskeyContext.cjs');
|
|
57
|
+
require('../WalletList.cjs');
|
|
58
|
+
require('qrcode');
|
|
59
|
+
require('@hcaptcha/react-hcaptcha');
|
|
60
|
+
require('../../../context/LoadingContext/LoadingContext.cjs');
|
|
61
|
+
require('../../../context/SocialRedirectContext/SocialRedirectContext.cjs');
|
|
62
|
+
require('../../../context/WalletGroupContext/WalletGroupContext.cjs');
|
|
63
|
+
require('../../../widgets/DynamicBridgeWidget/views/WalletsView/components/SecondaryWallets/SecondaryWallets.cjs');
|
|
64
|
+
require('../../../context/FooterAnimationContext/index.cjs');
|
|
65
|
+
require('../../../widgets/DynamicWidget/components/DynamicWidgetHeader/DynamicWidgetHeader.cjs');
|
|
66
|
+
require('../../../widgets/DynamicWidget/context/DynamicWidgetContext.cjs');
|
|
67
|
+
require('../../../components/UserProfile/parts/UserProfileField/components/VerifiedEmailIcon/VerifiedEmailIcon.cjs');
|
|
68
|
+
require('@dynamic-labs/viem-utils');
|
|
69
|
+
require('../../../widgets/DynamicWidget/views/ManagePasskeysWidgetView/PasskeyCard/PasskeyCard.cjs');
|
|
70
|
+
var useViewSettings = require('../../../utils/hooks/useViewSettings/useViewSettings.cjs');
|
|
71
|
+
|
|
72
|
+
const useTabState = () => {
|
|
73
|
+
var _a, _b;
|
|
74
|
+
const walletListViewSettings = useViewSettings.useViewSettings('wallet-list');
|
|
75
|
+
const [selectedTabIndex, setSelectedTabIndex] = React.useState(() => { var _a; return ((_a = walletListViewSettings === null || walletListViewSettings === void 0 ? void 0 : walletListViewSettings.tabs) === null || _a === void 0 ? void 0 : _a.items.length) ? 0 : null; });
|
|
76
|
+
const selectedTabSettings = selectedTabIndex === null
|
|
77
|
+
? undefined
|
|
78
|
+
: (_a = walletListViewSettings === null || walletListViewSettings === void 0 ? void 0 : walletListViewSettings.tabs) === null || _a === void 0 ? void 0 : _a.items[selectedTabIndex];
|
|
79
|
+
return {
|
|
80
|
+
selectedTabIndex,
|
|
81
|
+
selectedTabSettings,
|
|
82
|
+
setSelectedTabIndex,
|
|
83
|
+
tabsItems: (_b = walletListViewSettings === null || walletListViewSettings === void 0 ? void 0 : walletListViewSettings.tabs) === null || _b === void 0 ? void 0 : _b.items,
|
|
84
|
+
};
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
exports.useTabState = useTabState;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export declare const useTabState: () => {
|
|
3
|
+
selectedTabIndex: number | null;
|
|
4
|
+
selectedTabSettings: import("../../../context/DynamicContext/types").WalletListViewTabItem | undefined;
|
|
5
|
+
setSelectedTabIndex: import("react").Dispatch<import("react").SetStateAction<number | null>>;
|
|
6
|
+
tabsItems: import("../../../context/DynamicContext/types").WalletListViewTabItem[] | undefined;
|
|
7
|
+
};
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { useState } from 'react';
|
|
2
|
+
import '../../../events/dynamicEvents.js';
|
|
3
|
+
import '../../../../../_virtual/_tslib.js';
|
|
4
|
+
import '@dynamic-labs/utils';
|
|
5
|
+
import '../../../context/DynamicContext/DynamicContext.js';
|
|
6
|
+
import '@dynamic-labs/sdk-api';
|
|
7
|
+
import '../../../shared/logger.js';
|
|
8
|
+
import '@dynamic-labs/iconic';
|
|
9
|
+
import '@dynamic-labs/wallet-connector-core';
|
|
10
|
+
import 'react/jsx-runtime';
|
|
11
|
+
import '../../../context/ViewContext/ViewContext.js';
|
|
12
|
+
import '@dynamic-labs/wallet-book';
|
|
13
|
+
import '../../../utils/constants/colors.js';
|
|
14
|
+
import '../../../utils/constants/values.js';
|
|
15
|
+
import '../../../shared/utils/classes/storage/localStorage.js';
|
|
16
|
+
import 'viem';
|
|
17
|
+
import '../../../shared/consts/index.js';
|
|
18
|
+
import '../../../context/CaptchaContext/CaptchaContext.js';
|
|
19
|
+
import '../../../context/ErrorContext/ErrorContext.js';
|
|
20
|
+
import '@dynamic-labs/multi-wallet';
|
|
21
|
+
import 'viem/chains';
|
|
22
|
+
import '../../../context/AccessDeniedContext/AccessDeniedContext.js';
|
|
23
|
+
import '../../../context/AccountExistsContext/AccountExistsContext.js';
|
|
24
|
+
import '../../../config/ApiEndpoint.js';
|
|
25
|
+
import '../../../context/EmailVerificationContext/EmailVerificationContext.js';
|
|
26
|
+
import 'react-dom';
|
|
27
|
+
import '../../../context/ThemeContext/ThemeContext.js';
|
|
28
|
+
import '@dynamic-labs/types';
|
|
29
|
+
import 'yup';
|
|
30
|
+
import 'react-i18next';
|
|
31
|
+
import '../../../context/MockContext/MockContext.js';
|
|
32
|
+
import '../../../utils/hooks/useUserUpdateRequest/useUpdateUser/useUpdateUser.js';
|
|
33
|
+
import '../../../context/UserFieldEditorContext/UserFieldEditorContext.js';
|
|
34
|
+
import '@dynamic-labs/rpc-providers';
|
|
35
|
+
import '../../../context/UserWalletsContext/UserWalletsContext.js';
|
|
36
|
+
import '../../../components/Alert/Alert.js';
|
|
37
|
+
import '../../../components/ShadowDOM/ShadowDOM.js';
|
|
38
|
+
import '../../../components/IconButton/IconButton.js';
|
|
39
|
+
import '../../../components/InlineWidget/InlineWidget.js';
|
|
40
|
+
import '../../../components/IsBrowser/IsBrowser.js';
|
|
41
|
+
import '../../../components/MenuList/Dropdown/Dropdown.js';
|
|
42
|
+
import '../../../components/Transition/ZoomTransition/ZoomTransition.js';
|
|
43
|
+
import '../../../components/Transition/SlideInUpTransition/SlideInUpTransition.js';
|
|
44
|
+
import '../../../components/Transition/OpacityTransition/OpacityTransition.js';
|
|
45
|
+
import '../../../components/Popper/Popper/Popper.js';
|
|
46
|
+
import '../../../components/Popper/PopperContext/PopperContext.js';
|
|
47
|
+
import 'react-focus-lock';
|
|
48
|
+
import 'formik';
|
|
49
|
+
import 'i18next';
|
|
50
|
+
import '../../../components/OverlayCard/OverlayCard.context.js';
|
|
51
|
+
import '../../../components/PasskeyCreatedSuccessBanner/PasskeyCreatedSuccessBanner.js';
|
|
52
|
+
import '../../../context/PasskeyContext/PasskeyContext.js';
|
|
53
|
+
import '../WalletList.js';
|
|
54
|
+
import 'qrcode';
|
|
55
|
+
import '@hcaptcha/react-hcaptcha';
|
|
56
|
+
import '../../../context/LoadingContext/LoadingContext.js';
|
|
57
|
+
import '../../../context/SocialRedirectContext/SocialRedirectContext.js';
|
|
58
|
+
import '../../../context/WalletGroupContext/WalletGroupContext.js';
|
|
59
|
+
import '../../../widgets/DynamicBridgeWidget/views/WalletsView/components/SecondaryWallets/SecondaryWallets.js';
|
|
60
|
+
import '../../../context/FooterAnimationContext/index.js';
|
|
61
|
+
import '../../../widgets/DynamicWidget/components/DynamicWidgetHeader/DynamicWidgetHeader.js';
|
|
62
|
+
import '../../../widgets/DynamicWidget/context/DynamicWidgetContext.js';
|
|
63
|
+
import '../../../components/UserProfile/parts/UserProfileField/components/VerifiedEmailIcon/VerifiedEmailIcon.js';
|
|
64
|
+
import '@dynamic-labs/viem-utils';
|
|
65
|
+
import '../../../widgets/DynamicWidget/views/ManagePasskeysWidgetView/PasskeyCard/PasskeyCard.js';
|
|
66
|
+
import { useViewSettings } from '../../../utils/hooks/useViewSettings/useViewSettings.js';
|
|
67
|
+
|
|
68
|
+
const useTabState = () => {
|
|
69
|
+
var _a, _b;
|
|
70
|
+
const walletListViewSettings = useViewSettings('wallet-list');
|
|
71
|
+
const [selectedTabIndex, setSelectedTabIndex] = useState(() => { var _a; return ((_a = walletListViewSettings === null || walletListViewSettings === void 0 ? void 0 : walletListViewSettings.tabs) === null || _a === void 0 ? void 0 : _a.items.length) ? 0 : null; });
|
|
72
|
+
const selectedTabSettings = selectedTabIndex === null
|
|
73
|
+
? undefined
|
|
74
|
+
: (_a = walletListViewSettings === null || walletListViewSettings === void 0 ? void 0 : walletListViewSettings.tabs) === null || _a === void 0 ? void 0 : _a.items[selectedTabIndex];
|
|
75
|
+
return {
|
|
76
|
+
selectedTabIndex,
|
|
77
|
+
selectedTabSettings,
|
|
78
|
+
setSelectedTabIndex,
|
|
79
|
+
tabsItems: (_b = walletListViewSettings === null || walletListViewSettings === void 0 ? void 0 : walletListViewSettings.tabs) === null || _b === void 0 ? void 0 : _b.items,
|
|
80
|
+
};
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
export { useTabState };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
const getEffectiveRecommendedWallets = (selectedTabSettings, recommendedWallets) => {
|
|
6
|
+
if (selectedTabSettings && (selectedTabSettings === null || selectedTabSettings === void 0 ? void 0 : selectedTabSettings.recommendedWallets)) {
|
|
7
|
+
return selectedTabSettings.recommendedWallets;
|
|
8
|
+
}
|
|
9
|
+
return recommendedWallets;
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
exports.getEffectiveRecommendedWallets = getEffectiveRecommendedWallets;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { WalletListViewTabItem } from '../../../context/DynamicContext/types';
|
|
2
|
+
import { RecommendedWallet } from '../../../shared';
|
|
3
|
+
export declare const getEffectiveRecommendedWallets: (selectedTabSettings: WalletListViewTabItem | undefined, recommendedWallets: RecommendedWallet[] | undefined) => RecommendedWallet[] | undefined;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
const getEffectiveRecommendedWallets = (selectedTabSettings, recommendedWallets) => {
|
|
2
|
+
if (selectedTabSettings && (selectedTabSettings === null || selectedTabSettings === void 0 ? void 0 : selectedTabSettings.recommendedWallets)) {
|
|
3
|
+
return selectedTabSettings.recommendedWallets;
|
|
4
|
+
}
|
|
5
|
+
return recommendedWallets;
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
export { getEffectiveRecommendedWallets };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
const getEffectiveWalletFilter = (selectedTabSettings, walletsFilter) => {
|
|
6
|
+
if (selectedTabSettings && (selectedTabSettings === null || selectedTabSettings === void 0 ? void 0 : selectedTabSettings.walletsFilter)) {
|
|
7
|
+
return selectedTabSettings.walletsFilter;
|
|
8
|
+
}
|
|
9
|
+
return walletsFilter;
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
exports.getEffectiveWalletFilter = getEffectiveWalletFilter;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
const getEffectiveWalletFilter = (selectedTabSettings, walletsFilter) => {
|
|
2
|
+
if (selectedTabSettings && (selectedTabSettings === null || selectedTabSettings === void 0 ? void 0 : selectedTabSettings.walletsFilter)) {
|
|
3
|
+
return selectedTabSettings.walletsFilter;
|
|
4
|
+
}
|
|
5
|
+
return walletsFilter;
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
export { getEffectiveWalletFilter };
|
|
@@ -44,7 +44,6 @@ require('../../../../components/ShadowDOM/ShadowDOM.cjs');
|
|
|
44
44
|
require('../../../../components/OverlayCard/OverlayCard.context.cjs');
|
|
45
45
|
require('../../../../context/FooterAnimationContext/index.cjs');
|
|
46
46
|
var Typography = require('../../../../components/Typography/Typography.cjs');
|
|
47
|
-
var Badge = require('../../../../components/Badge/Badge.cjs');
|
|
48
47
|
require('../../../../context/WalletGroupContext/WalletGroupContext.cjs');
|
|
49
48
|
require('../DynamicWidgetHeader/DynamicWidgetHeader.cjs');
|
|
50
49
|
require('react-focus-lock');
|
|
@@ -61,6 +60,7 @@ require('../../../../components/PasskeyCreatedSuccessBanner/PasskeyCreatedSucces
|
|
|
61
60
|
require('../../../../context/PasskeyContext/PasskeyContext.cjs');
|
|
62
61
|
require('@dynamic-labs/viem-utils');
|
|
63
62
|
require('../../views/ManagePasskeysWidgetView/PasskeyCard/PasskeyCard.cjs');
|
|
63
|
+
var Badge = require('../../../../components/Badge/Badge.cjs');
|
|
64
64
|
require('../../../../components/InlineWidget/InlineWidget.cjs');
|
|
65
65
|
require('../../../../components/IsBrowser/IsBrowser.cjs');
|
|
66
66
|
require('../../../../components/MenuList/Dropdown/Dropdown.cjs');
|
|
@@ -40,7 +40,6 @@ import '../../../../components/ShadowDOM/ShadowDOM.js';
|
|
|
40
40
|
import '../../../../components/OverlayCard/OverlayCard.context.js';
|
|
41
41
|
import '../../../../context/FooterAnimationContext/index.js';
|
|
42
42
|
import { Typography } from '../../../../components/Typography/Typography.js';
|
|
43
|
-
import { Badge } from '../../../../components/Badge/Badge.js';
|
|
44
43
|
import '../../../../context/WalletGroupContext/WalletGroupContext.js';
|
|
45
44
|
import '../DynamicWidgetHeader/DynamicWidgetHeader.js';
|
|
46
45
|
import 'react-focus-lock';
|
|
@@ -57,6 +56,7 @@ import '../../../../components/PasskeyCreatedSuccessBanner/PasskeyCreatedSuccess
|
|
|
57
56
|
import '../../../../context/PasskeyContext/PasskeyContext.js';
|
|
58
57
|
import '@dynamic-labs/viem-utils';
|
|
59
58
|
import '../../views/ManagePasskeysWidgetView/PasskeyCard/PasskeyCard.js';
|
|
59
|
+
import { Badge } from '../../../../components/Badge/Badge.js';
|
|
60
60
|
import '../../../../components/InlineWidget/InlineWidget.js';
|
|
61
61
|
import '../../../../components/IsBrowser/IsBrowser.js';
|
|
62
62
|
import '../../../../components/MenuList/Dropdown/Dropdown.js';
|
|
@@ -16,7 +16,6 @@ require('../../../../context/ViewContext/ViewContext.cjs');
|
|
|
16
16
|
var androidTouchId = require('../../../../shared/assets/android-touch-id.cjs');
|
|
17
17
|
var checkCircle = require('../../../../shared/assets/check-circle.cjs');
|
|
18
18
|
var chevronLeft = require('../../../../shared/assets/chevron-left.cjs');
|
|
19
|
-
var lock = require('../../../../shared/assets/lock.cjs');
|
|
20
19
|
var exportPrivateKey = require('../../../../shared/assets/export-private-key.cjs');
|
|
21
20
|
var exportRecoveryPhrase = require('../../../../shared/assets/export-recovery-phrase.cjs');
|
|
22
21
|
require('../../../../shared/logger.cjs');
|
|
@@ -92,7 +91,7 @@ const WalletSettingsView = () => {
|
|
|
92
91
|
const { isTurnkeyWallet, isTurnkeyWalletWithoutAuthenticator } = useIsTurnkeyWallet.useIsTurnkeyWallet();
|
|
93
92
|
const { theme } = ThemeContext.useThemeContext();
|
|
94
93
|
const { t } = reactI18next.useTranslation();
|
|
95
|
-
const { initPasskeyRecoveryProcess } = usePasskeyRecovery.usePasskeyRecovery();
|
|
94
|
+
const { initPasskeyRecoveryProcess, shouldInitRecovery } = usePasskeyRecovery.usePasskeyRecovery();
|
|
96
95
|
const [isLoading, setIsLoading] = React.useState(false);
|
|
97
96
|
const decodedJwt = decodeJwt.decodeJwt(authToken);
|
|
98
97
|
const walletProperties = (_b = (_a = decodedJwt === null || decodedJwt === void 0 ? void 0 : decodedJwt.verifiedCredentials) === null || _a === void 0 ? void 0 : _a.find(({ walletName }) => walletName === null || walletName === void 0 ? void 0 : walletName.startsWith('turnkey'))) === null || _b === void 0 ? void 0 : _b.walletProperties;
|
|
@@ -111,6 +110,12 @@ const WalletSettingsView = () => {
|
|
|
111
110
|
setIsLoading(false);
|
|
112
111
|
}
|
|
113
112
|
});
|
|
113
|
+
const handleExportClick = (recoveryPhrase) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
114
|
+
if (yield shouldInitRecovery()) {
|
|
115
|
+
yield initPasskeyRecoveryProcess(undefined, 'reveal');
|
|
116
|
+
}
|
|
117
|
+
return initExportProcess(recoveryPhrase);
|
|
118
|
+
});
|
|
114
119
|
const renderPasskeysButtonEndSlot = () => {
|
|
115
120
|
if (isTurnkeyWalletWithAuthenticator)
|
|
116
121
|
return (jsxRuntime.jsx(checkCircle.ReactComponent, { className: 'wallet-settings-view__body__section__button__icon-secondary--success' }));
|
|
@@ -121,11 +126,11 @@ const WalletSettingsView = () => {
|
|
|
121
126
|
const backButton = (jsxRuntime.jsx(IconButton.IconButton, { type: 'button', onClick: goToInitialDynamicWidgetView, "data-testid": 'back-button', children: jsxRuntime.jsx(chevronLeft.ReactComponent, {}) }));
|
|
122
127
|
return (jsxRuntime.jsxs("div", { className: 'wallet-settings-view', children: [jsxRuntime.jsx(ModalHeader.ModalHeader, { leading: backButton, children: jsxRuntime.jsx("div", { className: 'wallet-settings-view__header', children: jsxRuntime.jsx(Typography.Typography, { variant: 'title', color: 'primary', copykey: 'dyn_wallet_settings.title', children: t('dyn_wallet_settings.title') }) }) }), jsxRuntime.jsxs("div", { className: 'wallet-settings-view__body', children: [isPasskeyEnabled && (jsxRuntime.jsxs("div", { className: 'wallet-settings-view__body__section', children: [jsxRuntime.jsx("div", { className: 'wallet-settings-view__body__section__title', children: t('dyn_wallet_settings.signing_section.title') }), jsxRuntime.jsx(Button.Button, { dataTestId: 'manage-passkeys-button', onClick: () => handlePasskeyClick(), buttonClassName: 'wallet-settings-view__body__section__button', startSlot:
|
|
123
128
|
// eslint-disable-next-line react/jsx-wrap-multilines
|
|
124
|
-
jsxRuntime.jsxs("div", { className: 'wallet-settings-view__body__section__button__start-slot', children: [jsxRuntime.jsx(PasskeyDeviceIcon.PasskeyDeviceIcon, { className: 'wallet-settings-view__body__section__button__icon', defaultIcon: jsxRuntime.jsx(androidTouchId.ReactComponent, { "data-testid": 'default-icon' }) }), jsxRuntime.jsx(Typography.Typography, { color: 'primary', weight: 'medium', copykey: 'dyn_wallet_settings.signing_section.passkey_button', children: t('dyn_wallet_settings.signing_section.passkey_button') })] }), endSlot: renderPasskeysButtonEndSlot(), disabled: isLoading, showInternalLoading: false })] })), jsxRuntime.jsxs("div", { className: 'wallet-settings-view__body__section', children: [jsxRuntime.jsx("div", { className: 'wallet-settings-view__body__section__title', children: t('dyn_wallet_settings.export_section.title') }), jsxRuntime.jsx(Button.Button, { dataTestId: 'embedded-reveal-account-button', onClick: () =>
|
|
129
|
+
jsxRuntime.jsxs("div", { className: 'wallet-settings-view__body__section__button__start-slot', children: [jsxRuntime.jsx(PasskeyDeviceIcon.PasskeyDeviceIcon, { className: 'wallet-settings-view__body__section__button__icon', defaultIcon: jsxRuntime.jsx(androidTouchId.ReactComponent, { "data-testid": 'default-icon' }) }), jsxRuntime.jsx(Typography.Typography, { color: 'primary', weight: 'medium', copykey: 'dyn_wallet_settings.signing_section.passkey_button', children: t('dyn_wallet_settings.signing_section.passkey_button') })] }), endSlot: renderPasskeysButtonEndSlot(), disabled: isLoading, showInternalLoading: false })] })), jsxRuntime.jsxs("div", { className: 'wallet-settings-view__body__section', children: [jsxRuntime.jsx("div", { className: 'wallet-settings-view__body__section__title', children: t('dyn_wallet_settings.export_section.title') }), jsxRuntime.jsx(Button.Button, { dataTestId: 'embedded-reveal-account-button', onClick: () => handleExportClick(), buttonClassName: 'wallet-settings-view__body__section__button', startSlot:
|
|
125
130
|
// eslint-disable-next-line react/jsx-wrap-multilines
|
|
126
|
-
jsxRuntime.jsxs("div", { className: 'wallet-settings-view__body__section__button__start-slot', children: [jsxRuntime.jsx(exportPrivateKey.ReactComponent, { className: `wallet-settings-view__body__section__button__icon${theme.theme.name === 'dark' ? '__stroke' : ''}` }), jsxRuntime.jsx(Typography.Typography, { color: 'primary', weight: 'medium', copykey: 'dyn_wallet_settings.export_section.private_key_button', children: t('dyn_wallet_settings.export_section.private_key_button') })] }), endSlot:
|
|
131
|
+
jsxRuntime.jsxs("div", { className: 'wallet-settings-view__body__section__button__start-slot', children: [jsxRuntime.jsx(exportPrivateKey.ReactComponent, { className: `wallet-settings-view__body__section__button__icon${theme.theme.name === 'dark' ? '__stroke' : ''}` }), jsxRuntime.jsx(Typography.Typography, { color: 'primary', weight: 'medium', copykey: 'dyn_wallet_settings.export_section.private_key_button', children: t('dyn_wallet_settings.export_section.private_key_button') })] }), endSlot: jsxRuntime.jsx(chevronLeft.ReactComponent, { className: 'wallet-settings-view__body__section__button__icon-secondary--rotate' }), showInternalLoading: false }), isTurnkeyHDWallet && (jsxRuntime.jsx(Button.Button, { dataTestId: 'embedded-reveal-button', onClick: () => handleExportClick(true), buttonClassName: 'wallet-settings-view__body__section__button', startSlot:
|
|
127
132
|
// eslint-disable-next-line react/jsx-wrap-multilines
|
|
128
|
-
jsxRuntime.jsxs("div", { className: 'wallet-settings-view__body__section__button__start-slot', children: [jsxRuntime.jsx(exportRecoveryPhrase.ReactComponent, { className: `wallet-settings-view__body__section__button__icon${theme.theme.name === 'dark' ? '__stroke' : ''}` }), jsxRuntime.jsx(Typography.Typography, { color: 'primary', weight: 'medium', copykey: 'dyn_wallet_settings.export_section.srp_button', children: t('dyn_wallet_settings.export_section.srp_button') })] }), endSlot:
|
|
133
|
+
jsxRuntime.jsxs("div", { className: 'wallet-settings-view__body__section__button__start-slot', children: [jsxRuntime.jsx(exportRecoveryPhrase.ReactComponent, { className: `wallet-settings-view__body__section__button__icon${theme.theme.name === 'dark' ? '__stroke' : ''}` }), jsxRuntime.jsx(Typography.Typography, { color: 'primary', weight: 'medium', copykey: 'dyn_wallet_settings.export_section.srp_button', children: t('dyn_wallet_settings.export_section.srp_button') })] }), endSlot: jsxRuntime.jsx(chevronLeft.ReactComponent, { className: 'wallet-settings-view__body__section__button__icon-secondary--rotate' }), showInternalLoading: false }))] })] })] }));
|
|
129
134
|
};
|
|
130
135
|
|
|
131
136
|
exports.WalletSettingsView = WalletSettingsView;
|
|
@@ -12,7 +12,6 @@ import '../../../../context/ViewContext/ViewContext.js';
|
|
|
12
12
|
import { ReactComponent as SvgAndroidTouchId } from '../../../../shared/assets/android-touch-id.js';
|
|
13
13
|
import { ReactComponent as SvgCheckCircle } from '../../../../shared/assets/check-circle.js';
|
|
14
14
|
import { ReactComponent as SvgChevronLeft } from '../../../../shared/assets/chevron-left.js';
|
|
15
|
-
import { ReactComponent as SvgLock } from '../../../../shared/assets/lock.js';
|
|
16
15
|
import { ReactComponent as SvgExportPrivateKey } from '../../../../shared/assets/export-private-key.js';
|
|
17
16
|
import { ReactComponent as SvgExportRecoveryPhrase } from '../../../../shared/assets/export-recovery-phrase.js';
|
|
18
17
|
import '../../../../shared/logger.js';
|
|
@@ -88,7 +87,7 @@ const WalletSettingsView = () => {
|
|
|
88
87
|
const { isTurnkeyWallet, isTurnkeyWalletWithoutAuthenticator } = useIsTurnkeyWallet();
|
|
89
88
|
const { theme } = useThemeContext();
|
|
90
89
|
const { t } = useTranslation();
|
|
91
|
-
const { initPasskeyRecoveryProcess } = usePasskeyRecovery();
|
|
90
|
+
const { initPasskeyRecoveryProcess, shouldInitRecovery } = usePasskeyRecovery();
|
|
92
91
|
const [isLoading, setIsLoading] = useState(false);
|
|
93
92
|
const decodedJwt = decodeJwt(authToken);
|
|
94
93
|
const walletProperties = (_b = (_a = decodedJwt === null || decodedJwt === void 0 ? void 0 : decodedJwt.verifiedCredentials) === null || _a === void 0 ? void 0 : _a.find(({ walletName }) => walletName === null || walletName === void 0 ? void 0 : walletName.startsWith('turnkey'))) === null || _b === void 0 ? void 0 : _b.walletProperties;
|
|
@@ -107,6 +106,12 @@ const WalletSettingsView = () => {
|
|
|
107
106
|
setIsLoading(false);
|
|
108
107
|
}
|
|
109
108
|
});
|
|
109
|
+
const handleExportClick = (recoveryPhrase) => __awaiter(void 0, void 0, void 0, function* () {
|
|
110
|
+
if (yield shouldInitRecovery()) {
|
|
111
|
+
yield initPasskeyRecoveryProcess(undefined, 'reveal');
|
|
112
|
+
}
|
|
113
|
+
return initExportProcess(recoveryPhrase);
|
|
114
|
+
});
|
|
110
115
|
const renderPasskeysButtonEndSlot = () => {
|
|
111
116
|
if (isTurnkeyWalletWithAuthenticator)
|
|
112
117
|
return (jsx(SvgCheckCircle, { className: 'wallet-settings-view__body__section__button__icon-secondary--success' }));
|
|
@@ -117,11 +122,11 @@ const WalletSettingsView = () => {
|
|
|
117
122
|
const backButton = (jsx(IconButton, { type: 'button', onClick: goToInitialDynamicWidgetView, "data-testid": 'back-button', children: jsx(SvgChevronLeft, {}) }));
|
|
118
123
|
return (jsxs("div", { className: 'wallet-settings-view', children: [jsx(ModalHeader, { leading: backButton, children: jsx("div", { className: 'wallet-settings-view__header', children: jsx(Typography, { variant: 'title', color: 'primary', copykey: 'dyn_wallet_settings.title', children: t('dyn_wallet_settings.title') }) }) }), jsxs("div", { className: 'wallet-settings-view__body', children: [isPasskeyEnabled && (jsxs("div", { className: 'wallet-settings-view__body__section', children: [jsx("div", { className: 'wallet-settings-view__body__section__title', children: t('dyn_wallet_settings.signing_section.title') }), jsx(Button, { dataTestId: 'manage-passkeys-button', onClick: () => handlePasskeyClick(), buttonClassName: 'wallet-settings-view__body__section__button', startSlot:
|
|
119
124
|
// eslint-disable-next-line react/jsx-wrap-multilines
|
|
120
|
-
jsxs("div", { className: 'wallet-settings-view__body__section__button__start-slot', children: [jsx(PasskeyDeviceIcon, { className: 'wallet-settings-view__body__section__button__icon', defaultIcon: jsx(SvgAndroidTouchId, { "data-testid": 'default-icon' }) }), jsx(Typography, { color: 'primary', weight: 'medium', copykey: 'dyn_wallet_settings.signing_section.passkey_button', children: t('dyn_wallet_settings.signing_section.passkey_button') })] }), endSlot: renderPasskeysButtonEndSlot(), disabled: isLoading, showInternalLoading: false })] })), jsxs("div", { className: 'wallet-settings-view__body__section', children: [jsx("div", { className: 'wallet-settings-view__body__section__title', children: t('dyn_wallet_settings.export_section.title') }), jsx(Button, { dataTestId: 'embedded-reveal-account-button', onClick: () =>
|
|
125
|
+
jsxs("div", { className: 'wallet-settings-view__body__section__button__start-slot', children: [jsx(PasskeyDeviceIcon, { className: 'wallet-settings-view__body__section__button__icon', defaultIcon: jsx(SvgAndroidTouchId, { "data-testid": 'default-icon' }) }), jsx(Typography, { color: 'primary', weight: 'medium', copykey: 'dyn_wallet_settings.signing_section.passkey_button', children: t('dyn_wallet_settings.signing_section.passkey_button') })] }), endSlot: renderPasskeysButtonEndSlot(), disabled: isLoading, showInternalLoading: false })] })), jsxs("div", { className: 'wallet-settings-view__body__section', children: [jsx("div", { className: 'wallet-settings-view__body__section__title', children: t('dyn_wallet_settings.export_section.title') }), jsx(Button, { dataTestId: 'embedded-reveal-account-button', onClick: () => handleExportClick(), buttonClassName: 'wallet-settings-view__body__section__button', startSlot:
|
|
121
126
|
// eslint-disable-next-line react/jsx-wrap-multilines
|
|
122
|
-
jsxs("div", { className: 'wallet-settings-view__body__section__button__start-slot', children: [jsx(SvgExportPrivateKey, { className: `wallet-settings-view__body__section__button__icon${theme.theme.name === 'dark' ? '__stroke' : ''}` }), jsx(Typography, { color: 'primary', weight: 'medium', copykey: 'dyn_wallet_settings.export_section.private_key_button', children: t('dyn_wallet_settings.export_section.private_key_button') })] }), endSlot:
|
|
127
|
+
jsxs("div", { className: 'wallet-settings-view__body__section__button__start-slot', children: [jsx(SvgExportPrivateKey, { className: `wallet-settings-view__body__section__button__icon${theme.theme.name === 'dark' ? '__stroke' : ''}` }), jsx(Typography, { color: 'primary', weight: 'medium', copykey: 'dyn_wallet_settings.export_section.private_key_button', children: t('dyn_wallet_settings.export_section.private_key_button') })] }), endSlot: jsx(SvgChevronLeft, { className: 'wallet-settings-view__body__section__button__icon-secondary--rotate' }), showInternalLoading: false }), isTurnkeyHDWallet && (jsx(Button, { dataTestId: 'embedded-reveal-button', onClick: () => handleExportClick(true), buttonClassName: 'wallet-settings-view__body__section__button', startSlot:
|
|
123
128
|
// eslint-disable-next-line react/jsx-wrap-multilines
|
|
124
|
-
jsxs("div", { className: 'wallet-settings-view__body__section__button__start-slot', children: [jsx(SvgExportRecoveryPhrase, { className: `wallet-settings-view__body__section__button__icon${theme.theme.name === 'dark' ? '__stroke' : ''}` }), jsx(Typography, { color: 'primary', weight: 'medium', copykey: 'dyn_wallet_settings.export_section.srp_button', children: t('dyn_wallet_settings.export_section.srp_button') })] }), endSlot:
|
|
129
|
+
jsxs("div", { className: 'wallet-settings-view__body__section__button__start-slot', children: [jsx(SvgExportRecoveryPhrase, { className: `wallet-settings-view__body__section__button__icon${theme.theme.name === 'dark' ? '__stroke' : ''}` }), jsx(Typography, { color: 'primary', weight: 'medium', copykey: 'dyn_wallet_settings.export_section.srp_button', children: t('dyn_wallet_settings.export_section.srp_button') })] }), endSlot: jsx(SvgChevronLeft, { className: 'wallet-settings-view__body__section__button__icon-secondary--rotate' }), showInternalLoading: false }))] })] })] }));
|
|
125
130
|
};
|
|
126
131
|
|
|
127
132
|
export { WalletSettingsView };
|