@dynamic-labs/sdk-react-core 4.9.2-preview.0 → 4.9.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +14 -1
- package/package.cjs +2 -2
- package/package.js +2 -2
- package/package.json +12 -12
- package/src/index.cjs +1 -1
- package/src/index.js +1 -1
- package/src/lib/components/Portal/ModalComponent/ModalComponent.cjs +32 -0
- package/src/lib/components/Portal/ModalComponent/ModalComponent.d.ts +9 -0
- package/src/lib/components/Portal/ModalComponent/ModalComponent.js +24 -0
- package/src/lib/components/Portal/ModalComponent/index.d.ts +1 -0
- package/src/lib/components/Portal/Portal.cjs +3 -119
- package/src/lib/components/Portal/Portal.d.ts +3 -8
- package/src/lib/components/Portal/Portal.js +3 -115
- package/src/lib/components/TransactionCard/SendBalanceTransactionCard.cjs +1 -1
- package/src/lib/components/TransactionCard/SendBalanceTransactionCard.js +1 -1
- package/src/lib/components/TransactionCard/TransactionCard.cjs +1 -1
- package/src/lib/components/TransactionCard/TransactionCard.js +1 -1
- package/src/lib/components/Typography/Typography.cjs +1 -0
- package/src/lib/components/Typography/Typography.js +1 -0
- package/src/lib/components/Typography/Typography.types.d.ts +1 -1
- package/src/lib/components/WalletConnectorEvents/WalletConnectorEvents.cjs +10 -2
- package/src/lib/components/WalletConnectorEvents/WalletConnectorEvents.js +10 -2
- package/src/lib/context/DynamicContext/DynamicContext.cjs +13 -9
- package/src/lib/context/DynamicContext/DynamicContext.js +15 -11
- package/src/lib/context/DynamicContext/helpers/helpers.cjs +0 -12
- package/src/lib/context/DynamicContext/helpers/helpers.d.ts +1 -9
- package/src/lib/context/DynamicContext/helpers/helpers.js +1 -12
- package/src/lib/context/DynamicContext/hooks/useInitialViewType/index.d.ts +1 -0
- package/src/lib/context/DynamicContext/hooks/useInitialViewType/useInitialViewType.cjs +18 -0
- package/src/lib/context/DynamicContext/hooks/useInitialViewType/useInitialViewType.d.ts +10 -0
- package/src/lib/context/DynamicContext/hooks/useInitialViewType/useInitialViewType.js +14 -0
- package/src/lib/context/DynamicContext/hooks/useShowAuthFlow/useShowAuthFlow.cjs +1 -1
- package/src/lib/context/DynamicContext/hooks/useShowAuthFlow/useShowAuthFlow.js +1 -1
- package/src/lib/context/DynamicContext/types/IDynamicContext.d.ts +6 -2
- package/src/lib/context/SocialRedirectContext/hooks/useRedirectSocialHandler/useRedirectSocialHandler.cjs +1 -1
- package/src/lib/context/SocialRedirectContext/hooks/useRedirectSocialHandler/useRedirectSocialHandler.js +1 -1
- package/src/lib/context/ViewContext/ViewContext.cjs +1 -1
- package/src/lib/context/ViewContext/ViewContext.js +1 -1
- package/src/lib/locale/en/translation.cjs +2 -2
- package/src/lib/locale/en/translation.d.ts +1 -1
- package/src/lib/locale/en/translation.js +2 -2
- package/src/lib/main.global.cjs +1 -1
- package/src/lib/main.global.js +1 -1
- package/src/lib/styles/index.shadow.cjs +1 -1
- package/src/lib/styles/index.shadow.js +1 -1
- package/src/lib/utils/constants/authViewLayoutChecks.cjs +135 -0
- package/src/lib/utils/constants/authViewLayoutChecks.d.ts +21 -0
- package/src/lib/utils/constants/authViewLayoutChecks.js +123 -0
- package/src/lib/utils/hooks/useAuthLayoutChecks/useAllowClose/index.d.ts +1 -0
- package/src/lib/utils/hooks/useAuthLayoutChecks/useAllowClose/useAllowClose.cjs +36 -0
- package/src/lib/utils/hooks/useAuthLayoutChecks/useAllowClose/useAllowClose.d.ts +11 -0
- package/src/lib/utils/hooks/useAuthLayoutChecks/useAllowClose/useAllowClose.js +32 -0
- package/src/lib/utils/hooks/useAuthLayoutChecks/useAuthLayoutChecks.cjs +20 -93
- package/src/lib/utils/hooks/useAuthLayoutChecks/useAuthLayoutChecks.d.ts +1 -0
- package/src/lib/utils/hooks/useAuthLayoutChecks/useAuthLayoutChecks.js +19 -92
- package/src/lib/utils/hooks/useDynamicWaas/useDynamicWaas.cjs +7 -4
- package/src/lib/utils/hooks/useDynamicWaas/useDynamicWaas.d.ts +5 -2
- package/src/lib/utils/hooks/useDynamicWaas/useDynamicWaas.js +7 -4
- package/src/lib/utils/hooks/useSetWalletConnectorFetchers/useSetWalletConnectorFetchers.cjs +2 -1
- package/src/lib/utils/hooks/useSetWalletConnectorFetchers/useSetWalletConnectorFetchers.js +2 -1
- package/src/lib/utils/hooks/useSyncMfaFlow/useSyncMfaFlow.cjs +3 -2
- package/src/lib/utils/hooks/useSyncMfaFlow/useSyncMfaFlow.js +3 -2
- package/src/lib/views/EmailVerification/EmailVerification.cjs +1 -1
- package/src/lib/views/EmailVerification/EmailVerification.js +1 -1
- package/src/lib/views/MfaChooseDeviceView/MfaChooseDeviceView.cjs +4 -1
- package/src/lib/views/MfaChooseDeviceView/MfaChooseDeviceView.js +4 -1
- package/src/lib/views/MfaSecureDeviceView/MfaSecureDeviceView.cjs +1 -4
- package/src/lib/views/MfaSecureDeviceView/MfaSecureDeviceView.js +1 -4
- package/src/lib/views/MfaVerificationView/MfaVerificationView.cjs +4 -10
- package/src/lib/views/MfaVerificationView/MfaVerificationView.js +4 -10
- package/src/lib/widgets/DynamicEmbeddedWidget/DynamicEmbeddedAuthFlow/DynamicEmbeddedAuthFlow.cjs +7 -5
- package/src/lib/widgets/DynamicEmbeddedWidget/DynamicEmbeddedAuthFlow/DynamicEmbeddedAuthFlow.js +7 -5
- package/src/lib/widgets/DynamicWidget/components/ActiveWalletBalance/ActiveWalletBalance.cjs +164 -0
- package/src/lib/widgets/DynamicWidget/components/ActiveWalletBalance/ActiveWalletBalance.d.ts +3 -0
- package/src/lib/widgets/DynamicWidget/components/ActiveWalletBalance/ActiveWalletBalance.js +160 -0
- package/src/lib/widgets/DynamicWidget/components/ActiveWalletBalance/index.d.ts +1 -0
- package/src/lib/widgets/DynamicWidget/components/ActiveWalletInformation/ActiveWalletInformation.cjs +11 -50
- package/src/lib/widgets/DynamicWidget/components/ActiveWalletInformation/ActiveWalletInformation.js +11 -50
- package/src/lib/widgets/DynamicWidget/components/Balance/Balance.cjs +2 -2
- package/src/lib/widgets/DynamicWidget/components/Balance/Balance.d.ts +2 -1
- package/src/lib/widgets/DynamicWidget/components/Balance/Balance.js +2 -2
- package/src/lib/widgets/DynamicWidget/components/DynamicWidgetWallets/DynamicWidgetWallets.cjs +4 -4
- package/src/lib/widgets/DynamicWidget/components/DynamicWidgetWallets/DynamicWidgetWallets.js +4 -4
- package/src/lib/widgets/DynamicWidget/views/DepositView/DepositView.cjs +1 -1
- package/src/lib/widgets/DynamicWidget/views/DepositView/DepositView.js +1 -1
- /package/src/lib/widgets/DynamicWidget/components/{ActiveWalletInformation → ActiveWalletBalance}/TokenBalanceItem/TokenBalanceItem.cjs +0 -0
- /package/src/lib/widgets/DynamicWidget/components/{ActiveWalletInformation → ActiveWalletBalance}/TokenBalanceItem/TokenBalanceItem.d.ts +0 -0
- /package/src/lib/widgets/DynamicWidget/components/{ActiveWalletInformation → ActiveWalletBalance}/TokenBalanceItem/TokenBalanceItem.js +0 -0
- /package/src/lib/widgets/DynamicWidget/components/{ActiveWalletInformation → ActiveWalletBalance}/TokenBalanceItem/index.d.ts +0 -0
- /package/src/lib/widgets/DynamicWidget/components/{ActiveWalletInformation → ActiveWalletBalance}/TokenBalanceList/TokenBalanceList.cjs +0 -0
- /package/src/lib/widgets/DynamicWidget/components/{ActiveWalletInformation → ActiveWalletBalance}/TokenBalanceList/TokenBalanceList.d.ts +0 -0
- /package/src/lib/widgets/DynamicWidget/components/{ActiveWalletInformation → ActiveWalletBalance}/TokenBalanceList/TokenBalanceList.js +0 -0
- /package/src/lib/widgets/DynamicWidget/components/{ActiveWalletInformation → ActiveWalletBalance}/TokenBalanceList/index.d.ts +0 -0
package/src/lib/widgets/DynamicWidget/components/ActiveWalletInformation/ActiveWalletInformation.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
'use client'
|
|
2
2
|
import { __awaiter } from '../../../../../../_virtual/_tslib.js';
|
|
3
|
-
import { jsx, jsxs
|
|
4
|
-
import { useState,
|
|
3
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
4
|
+
import { useState, useCallback } from 'react';
|
|
5
5
|
import { useTranslation } from 'react-i18next';
|
|
6
6
|
import { isBitcoinConnector } from '@dynamic-labs/wallet-connector-core';
|
|
7
7
|
import { classNames } from '../../../../utils/functions/classNames/classNames.js';
|
|
8
|
-
import
|
|
8
|
+
import '../../../../components/Accordion/components/AccordionItem/AccordionItem.js';
|
|
9
9
|
import { Alert } from '../../../../components/Alert/Alert.js';
|
|
10
10
|
import '../../../../events/dynamicEvents.js';
|
|
11
11
|
import '@dynamic-labs/utils';
|
|
@@ -13,7 +13,6 @@ import '../../../../context/DynamicContext/DynamicContext.js';
|
|
|
13
13
|
import '@dynamic-labs/sdk-api-core';
|
|
14
14
|
import { logger } from '../../../../shared/logger.js';
|
|
15
15
|
import '@dynamic-labs/iconic';
|
|
16
|
-
import { ReactComponent as SvgChevronDown } from '../../../../shared/assets/chevron-down.js';
|
|
17
16
|
import { ReactComponent as SvgCopy } from '../../../../shared/assets/copy.js';
|
|
18
17
|
import { ReactComponent as SvgEyeOutline } from '../../../../shared/assets/eye-outline.js';
|
|
19
18
|
import { ReactComponent as SvgKey } from '../../../../shared/assets/key.js';
|
|
@@ -30,7 +29,7 @@ import '../../../../context/ErrorContext/ErrorContext.js';
|
|
|
30
29
|
import '@dynamic-labs/multi-wallet';
|
|
31
30
|
import 'react-international-phone';
|
|
32
31
|
import '../../../../store/state/nonce/nonce.js';
|
|
33
|
-
import '../../../../store/state/projectSettings/projectSettings.js';
|
|
32
|
+
import { useProjectSettings } from '../../../../store/state/projectSettings/projectSettings.js';
|
|
34
33
|
import '../../../../config/ApiEndpoint.js';
|
|
35
34
|
import '../../../../store/state/user/user.js';
|
|
36
35
|
import '../../../../locale/locale.js';
|
|
@@ -62,7 +61,6 @@ import '../../../../context/UserFieldEditorContext/UserFieldEditorContext.js';
|
|
|
62
61
|
import '@dynamic-labs/rpc-providers';
|
|
63
62
|
import '../../../../store/state/loadingAndLifecycle.js';
|
|
64
63
|
import '../../../../store/state/walletOptions/walletOptions.js';
|
|
65
|
-
import { Typography } from '../../../../components/Typography/Typography.js';
|
|
66
64
|
import '../../../../context/FooterAnimationContext/index.js';
|
|
67
65
|
import '../../../../components/ShadowDOM/ShadowDOM.js';
|
|
68
66
|
import '../../../../components/Transition/ZoomTransition/ZoomTransition.js';
|
|
@@ -97,42 +95,32 @@ import '../../../../context/IpConfigurationContext/IpConfigurationContext.js';
|
|
|
97
95
|
import '../../../../context/ConnectWithOtpContext/ConnectWithOtpContext.js';
|
|
98
96
|
import '../../../../context/ConnectWithOtpContext/constants.js';
|
|
99
97
|
import '../../../DynamicBridgeWidget/views/WalletsView/components/SecondaryWallets/SecondaryWallets.js';
|
|
100
|
-
import { Balance } from '../Balance/Balance.js';
|
|
101
98
|
import '@hcaptcha/react-hcaptcha';
|
|
102
99
|
import '../../../../context/ErrorContext/hooks/useErrorText/useErrorText.js';
|
|
103
100
|
import '../../../../components/PasskeyCreatedSuccessBanner/PasskeyCreatedSuccessBanner.js';
|
|
104
101
|
import '../../../../store/state/connectorsInitializing/connectorsInitializing.js';
|
|
105
|
-
import
|
|
102
|
+
import '../../../../store/state/tokenBalances.js';
|
|
106
103
|
import '../../../../shared/utils/functions/getInitialUrl/getInitialUrl.js';
|
|
107
104
|
import '../../../../components/InlineWidget/InlineWidget.js';
|
|
108
105
|
import '../../../../components/IsBrowser/IsBrowser.js';
|
|
109
106
|
import '../../../../components/Popper/Popper/Popper.js';
|
|
110
107
|
import '../../../../components/Popper/PopperContext/PopperContext.js';
|
|
111
|
-
import { isMultiAssetSupportedNetwork } from '../../../../utils/functions/isMultiAssetSupportedNetwork/isMultiAssetSupportedNetwork.js';
|
|
112
108
|
import { WalletDetailsCard } from '../WalletDetailsCard/WalletDetailsCard.js';
|
|
109
|
+
import { ActiveWalletBalance } from '../ActiveWalletBalance/ActiveWalletBalance.js';
|
|
113
110
|
import { ActiveBitcoinWalletAddresses } from './ActiveBitcoinWalletAddresses/ActiveBitcoinWalletAddresses.js';
|
|
114
111
|
import { ActiveWalletAddress } from './ActiveWalletAddress/ActiveWalletAddress.js';
|
|
115
|
-
import { TokenBalanceList } from './TokenBalanceList/TokenBalanceList.js';
|
|
116
112
|
|
|
117
113
|
const ICON_SIZE = 32;
|
|
118
114
|
const DROPDOWN_ICON_SIZE = 16;
|
|
119
115
|
const ActiveWalletInformation = ({ isLoading = false, }) => {
|
|
120
|
-
var _a, _b, _c
|
|
116
|
+
var _a, _b, _c;
|
|
121
117
|
const { t } = useTranslation();
|
|
122
|
-
|
|
123
|
-
const [hasShadow, setHasShadow] = useState(false);
|
|
118
|
+
/** Controls the [WalletDetailsCard] open state */
|
|
124
119
|
const [detailsCardOpen, setDetailsCardOpen] = useState(false);
|
|
125
|
-
const
|
|
126
|
-
const
|
|
120
|
+
const { primaryWallet, network, user, authMode, removeWallet } = useInternalDynamicContext();
|
|
121
|
+
const projectSettings = useProjectSettings();
|
|
127
122
|
const { setDynamicWidgetView, headerAlert } = useWidgetContext();
|
|
128
123
|
const { isTurnkeyWalletWithoutAuthenticator } = useIsTurnkeyWallet();
|
|
129
|
-
const { isLoading: isLoadingTokenBalances, tokenBalances, error: errorTokenBalances, } = useTokenBalances({
|
|
130
|
-
chainName: primaryWallet === null || primaryWallet === void 0 ? void 0 : primaryWallet.connector.connectedChain,
|
|
131
|
-
includeFiat: showFiat,
|
|
132
|
-
includeNativeBalance: true,
|
|
133
|
-
});
|
|
134
|
-
const primaryConnector = primaryWallet === null || primaryWallet === void 0 ? void 0 : primaryWallet.connector;
|
|
135
|
-
const filteredTokenBalances = (tokenBalances === null || tokenBalances === void 0 ? void 0 : tokenBalances.filter((token) => token.name)) || [];
|
|
136
124
|
const address = primaryWallet === null || primaryWallet === void 0 ? void 0 : primaryWallet.address;
|
|
137
125
|
const nameService = useFetchNameService(primaryWallet !== null && primaryWallet !== void 0 ? primaryWallet : undefined);
|
|
138
126
|
const { getEOAWallet } = useSmartWallets();
|
|
@@ -195,39 +183,12 @@ const ActiveWalletInformation = ({ isLoading = false, }) => {
|
|
|
195
183
|
return (jsx(ActiveWalletAddress, { wallet: primaryWallet, nameServiceName: (nameService === null || nameService === void 0 ? void 0 : nameService.name) || (user === null || user === void 0 ? void 0 : user.email), menuOption: options, isLoading: isLoading, fullWidth: shouldHideNetwork }));
|
|
196
184
|
}
|
|
197
185
|
};
|
|
198
|
-
const enableMultiAsset = (authMode === 'connect-and-sign' ||
|
|
199
|
-
(authMode === 'connect-only' &&
|
|
200
|
-
((_d = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.sdk.featureFlags) === null || _d === void 0 ? void 0 : _d.connectOnlyMultiAsset))) &&
|
|
201
|
-
multiAsset;
|
|
202
|
-
const isNetworkMultiAssetSupported = isMultiAssetSupportedNetwork(filteredTokenBalances, primaryConnector, network);
|
|
203
|
-
const isTooManyRequests = errorTokenBalances === 'Too many requests fetching balances';
|
|
204
|
-
const showMultiAsset = !isTooManyRequests && isNetworkMultiAssetSupported && enableMultiAsset;
|
|
205
|
-
filteredTokenBalances.sort((a, b) => ((b === null || b === void 0 ? void 0 : b.marketValue) || 0) - ((a === null || a === void 0 ? void 0 : a.marketValue) || 0));
|
|
206
|
-
const totalValue = filteredTokenBalances.reduce((acc, token) => acc + ((token === null || token === void 0 ? void 0 : token.marketValue) || 0), 0);
|
|
207
|
-
const currencyFormatter = new Intl.NumberFormat('en-US', {
|
|
208
|
-
currency: 'USD',
|
|
209
|
-
style: 'currency',
|
|
210
|
-
});
|
|
211
|
-
const primaryWalletNativeBalance = () => primaryWallet ? (jsx(Balance, { className: 'balance-header__balance', wallet: primaryWallet, network: network })) : (jsx(Skeleton, { className: 'balance-header__skeleton' }));
|
|
212
|
-
const handleScroll = () => {
|
|
213
|
-
if (contentRef.current) {
|
|
214
|
-
setHasShadow(contentRef.current.scrollTop > 0);
|
|
215
|
-
}
|
|
216
|
-
};
|
|
217
|
-
const multiAssetHeader = () => (jsxs(Fragment, { children: [jsx("div", { className: `${hasShadow ? 'shadow' : ''}`, children: jsxs("button", { onClick: () => {
|
|
218
|
-
if (!isLoadingTokenBalances) {
|
|
219
|
-
setBalanceIsExpanded(!balanceIsExpanded);
|
|
220
|
-
}
|
|
221
|
-
}, className: 'balance-header', children: [jsxs("div", { className: 'balance-header__title', children: [jsxs(Typography, { color: 'secondary', variant: 'body_small', style: { marginRight: '8px' }, children: [t('dyn_active_wallet_info.balance'), ":"] }), showFiat ? (jsx(Typography, { variant: 'body_normal', color: 'primary', children: totalValue === 0 || totalValue >= 0.01
|
|
222
|
-
? currencyFormatter.format(parseFloat(totalValue.toFixed(2)))
|
|
223
|
-
: '<$0.01' })) : (primaryWalletNativeBalance())] }), jsx("div", { className: balanceIsExpanded ? 'balance-header__chevron' : '', children: jsx(SvgChevronDown, {}) })] }) }), jsx(AccordionItem, { isOpen: balanceIsExpanded, className: `multi-asset-balance-container__accordion ${'multi-asset-balance-container__accordion' +
|
|
224
|
-
(balanceIsExpanded ? '--expanded' : '--collapsed')}`, handleScroll: handleScroll, ref: contentRef, children: jsx(TokenBalanceList, { tokenBalances: filteredTokenBalances }) })] }));
|
|
225
186
|
if (isLoading) {
|
|
226
187
|
return jsx(Skeleton, {});
|
|
227
188
|
}
|
|
228
189
|
return (jsxs("div", { className: 'active-wallet-information-container', "data-testid": 'active-wallet-information', children: [jsxs("div", { className: 'active-wallet-information', children: [jsxs("div", { className: 'active-wallet-information__header', children: [jsx("div", { className: 'active-wallet-information__avatar', children: (nameService === null || nameService === void 0 ? void 0 : nameService.avatar) ? (jsx("div", { className: 'active-wallet-information__avatar__name-service', children: jsx("img", { src: nameService === null || nameService === void 0 ? void 0 : nameService.avatar, alt: '' }) })) : (jsx("div", { className: 'active-wallet-information__wallet-img', children: jsx(AuthProviderIcon, { iconSize: ICON_SIZE }) })) }), jsxs("div", { className: 'active-wallet-information__details', children: [jsx("div", { className: classNames('active-wallet-information__addresses-container', {
|
|
229
190
|
'active-wallet-information__addresses-container--centered': !(nameService === null || nameService === void 0 ? void 0 : nameService.name),
|
|
230
|
-
}), children: activeWalletAddress() }), address && (jsx(WalletDetailsCard, { open: detailsCardOpen, address: address, onClose: () => setDetailsCardOpen(false) })), !shouldHideNetwork && (jsx(NetworkPicker, { currentNetwork: network, connector: primaryWallet === null || primaryWallet === void 0 ? void 0 : primaryWallet.connector, mainClassName: 'active-wallet-information__network-picker', buttonClassName: 'active-wallet-information__network-picker-button', showNetworkName: true, isLoading: isLoading }))] })] }), headerAlert && (jsx(Alert, { variant: headerAlert.variant, children: headerAlert.content })), showTestnetAlert && (jsx(Alert, { variant: 'warning', copykey: 'dyn_active_wallet_info.testnet_warning', children: t('dyn_active_wallet_info.testnet_warning') }))] }),
|
|
191
|
+
}), children: activeWalletAddress() }), address && (jsx(WalletDetailsCard, { open: detailsCardOpen, address: address, onClose: () => setDetailsCardOpen(false) })), !shouldHideNetwork && (jsx(NetworkPicker, { currentNetwork: network, connector: primaryWallet === null || primaryWallet === void 0 ? void 0 : primaryWallet.connector, mainClassName: 'active-wallet-information__network-picker', buttonClassName: 'active-wallet-information__network-picker-button', showNetworkName: true, isLoading: isLoading }))] })] }), headerAlert && (jsx(Alert, { variant: headerAlert.variant, children: headerAlert.content })), showTestnetAlert && (jsx(Alert, { variant: 'warning', copykey: 'dyn_active_wallet_info.testnet_warning', children: t('dyn_active_wallet_info.testnet_warning') }))] }), jsx(ActiveWalletBalance, {})] }));
|
|
231
192
|
};
|
|
232
193
|
|
|
233
194
|
export { ActiveWalletInformation };
|
|
@@ -99,7 +99,7 @@ require('../../../../components/IsBrowser/IsBrowser.cjs');
|
|
|
99
99
|
require('../../../../components/Popper/Popper/Popper.cjs');
|
|
100
100
|
require('../../../../components/Popper/PopperContext/PopperContext.cjs');
|
|
101
101
|
|
|
102
|
-
const Balance = ({ wallet, network, className }) => {
|
|
102
|
+
const Balance = ({ wallet, network, className, variant = 'body_normal', }) => {
|
|
103
103
|
const { currency, isLoading: isLoadingCurrency } = useFetchCurrency.useFetchCurrency(wallet.connector, network);
|
|
104
104
|
const { balance, isLoading: isLoadingBalance } = useFetchBalance.useFetchBalance({
|
|
105
105
|
chain: currency === null || currency === void 0 ? void 0 : currency.symbol,
|
|
@@ -108,7 +108,7 @@ const Balance = ({ wallet, network, className }) => {
|
|
|
108
108
|
});
|
|
109
109
|
if (!balance)
|
|
110
110
|
return null;
|
|
111
|
-
return (jsxRuntime.jsxs(Typography.Typography, { className: className, variant:
|
|
111
|
+
return (jsxRuntime.jsxs(Typography.Typography, { className: className, variant: variant, color: 'primary', children: [isLoadingBalance ? (jsxRuntime.jsx(Skeleton.Skeleton, { className: 'balance-skeleton' })) : (helpers.roundBalance(balance)), ' ', !isLoadingCurrency && (jsxRuntime.jsx(Typography.Typography, { as: 'span', variant: 'body_normal', color: 'secondary', children: currency === null || currency === void 0 ? void 0 : currency.symbol }))] }));
|
|
112
112
|
};
|
|
113
113
|
|
|
114
114
|
exports.Balance = Balance;
|
|
@@ -4,6 +4,7 @@ type Props = {
|
|
|
4
4
|
wallet: Wallet;
|
|
5
5
|
className?: string;
|
|
6
6
|
network: number | string | undefined;
|
|
7
|
+
variant?: 'body_normal' | 'numbers_display';
|
|
7
8
|
};
|
|
8
|
-
export declare const Balance: ({ wallet, network, className }: Props) => JSX.Element | null;
|
|
9
|
+
export declare const Balance: ({ wallet, network, className, variant, }: Props) => JSX.Element | null;
|
|
9
10
|
export {};
|
|
@@ -95,7 +95,7 @@ import '../../../../components/IsBrowser/IsBrowser.js';
|
|
|
95
95
|
import '../../../../components/Popper/Popper/Popper.js';
|
|
96
96
|
import '../../../../components/Popper/PopperContext/PopperContext.js';
|
|
97
97
|
|
|
98
|
-
const Balance = ({ wallet, network, className }) => {
|
|
98
|
+
const Balance = ({ wallet, network, className, variant = 'body_normal', }) => {
|
|
99
99
|
const { currency, isLoading: isLoadingCurrency } = useFetchCurrency(wallet.connector, network);
|
|
100
100
|
const { balance, isLoading: isLoadingBalance } = useFetchBalance({
|
|
101
101
|
chain: currency === null || currency === void 0 ? void 0 : currency.symbol,
|
|
@@ -104,7 +104,7 @@ const Balance = ({ wallet, network, className }) => {
|
|
|
104
104
|
});
|
|
105
105
|
if (!balance)
|
|
106
106
|
return null;
|
|
107
|
-
return (jsxs(Typography, { className: className, variant:
|
|
107
|
+
return (jsxs(Typography, { className: className, variant: variant, color: 'primary', children: [isLoadingBalance ? (jsx(Skeleton, { className: 'balance-skeleton' })) : (roundBalance(balance)), ' ', !isLoadingCurrency && (jsx(Typography, { as: 'span', variant: 'body_normal', color: 'secondary', children: currency === null || currency === void 0 ? void 0 : currency.symbol }))] }));
|
|
108
108
|
};
|
|
109
109
|
|
|
110
110
|
export { Balance };
|
package/src/lib/widgets/DynamicWidget/components/DynamicWidgetWallets/DynamicWidgetWallets.cjs
CHANGED
|
@@ -113,10 +113,10 @@ const DynamicWidgetWallets = () => {
|
|
|
113
113
|
setShowLinkNewWalletModal(true);
|
|
114
114
|
setSelectedWalletConnectorKey(null);
|
|
115
115
|
};
|
|
116
|
-
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsxs("div", { className: 'dynamic-widget-wallets-header', children: [jsxRuntime.jsx(Typography.Typography, { weight: 'regular', variant: 'body_normal', color: 'secondary', className: 'dynamic-widget-wallets-header__title', copykey: 'dyn_widget.other_wallets', children: t('dyn_widget.other_wallets') }), jsxRuntime.jsxs(TypographyButton.TypographyButton, { buttonClassName: 'dynamic-widget-wallets-header__add_wallet', buttonVariant: '
|
|
117
|
-
color: '
|
|
118
|
-
variant: '
|
|
119
|
-
}, startSlot: jsxRuntime.jsx(add.ReactComponent, {}), children: [authMode === 'connect-only' ? 'Connect' : 'Link', "
|
|
116
|
+
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsxs("div", { className: 'dynamic-widget-wallets-header', children: [jsxRuntime.jsx(Typography.Typography, { weight: 'regular', variant: 'body_normal', color: 'secondary', className: 'dynamic-widget-wallets-header__title', copykey: 'dyn_widget.other_wallets', children: t('dyn_widget.other_wallets') }), jsxRuntime.jsxs(TypographyButton.TypographyButton, { buttonClassName: 'dynamic-widget-wallets-header__add_wallet', buttonVariant: 'primary', buttonPadding: 'small', onClick: addNewWallet, typographyProps: {
|
|
117
|
+
color: 'primary',
|
|
118
|
+
variant: 'button_secondary',
|
|
119
|
+
}, startSlot: jsxRuntime.jsx(add.ReactComponent, {}), children: [authMode === 'connect-only' ? 'Connect' : 'Link', " new"] })] }), jsxRuntime.jsx("div", { ref: availableWalletsContainerRef, className: 'dynamic-widget-wallets', "data-testid": 'dynamicWidgetWallets', children: jsxRuntime.jsx("div", { className: classNames.classNames('dynamic-widget-wallets__body', {
|
|
120
120
|
'dynamic-widget-wallets__body--apply-height': !isEmpty,
|
|
121
121
|
}), children: isEmpty ? (jsxRuntime.jsx(EmptyWallets.EmptyWallets, { copykey: 'dyn_widget.empty_wallets', text: t('dyn_widget.empty_wallets', {
|
|
122
122
|
action: authMode === 'connect-and-sign'
|
package/src/lib/widgets/DynamicWidget/components/DynamicWidgetWallets/DynamicWidgetWallets.js
CHANGED
|
@@ -109,10 +109,10 @@ const DynamicWidgetWallets = () => {
|
|
|
109
109
|
setShowLinkNewWalletModal(true);
|
|
110
110
|
setSelectedWalletConnectorKey(null);
|
|
111
111
|
};
|
|
112
|
-
return (jsxs(Fragment, { children: [jsxs("div", { className: 'dynamic-widget-wallets-header', children: [jsx(Typography, { weight: 'regular', variant: 'body_normal', color: 'secondary', className: 'dynamic-widget-wallets-header__title', copykey: 'dyn_widget.other_wallets', children: t('dyn_widget.other_wallets') }), jsxs(TypographyButton, { buttonClassName: 'dynamic-widget-wallets-header__add_wallet', buttonVariant: '
|
|
113
|
-
color: '
|
|
114
|
-
variant: '
|
|
115
|
-
}, startSlot: jsx(SvgAdd, {}), children: [authMode === 'connect-only' ? 'Connect' : 'Link', "
|
|
112
|
+
return (jsxs(Fragment, { children: [jsxs("div", { className: 'dynamic-widget-wallets-header', children: [jsx(Typography, { weight: 'regular', variant: 'body_normal', color: 'secondary', className: 'dynamic-widget-wallets-header__title', copykey: 'dyn_widget.other_wallets', children: t('dyn_widget.other_wallets') }), jsxs(TypographyButton, { buttonClassName: 'dynamic-widget-wallets-header__add_wallet', buttonVariant: 'primary', buttonPadding: 'small', onClick: addNewWallet, typographyProps: {
|
|
113
|
+
color: 'primary',
|
|
114
|
+
variant: 'button_secondary',
|
|
115
|
+
}, startSlot: jsx(SvgAdd, {}), children: [authMode === 'connect-only' ? 'Connect' : 'Link', " new"] })] }), jsx("div", { ref: availableWalletsContainerRef, className: 'dynamic-widget-wallets', "data-testid": 'dynamicWidgetWallets', children: jsx("div", { className: classNames('dynamic-widget-wallets__body', {
|
|
116
116
|
'dynamic-widget-wallets__body--apply-height': !isEmpty,
|
|
117
117
|
}), children: isEmpty ? (jsx(EmptyWallets, { copykey: 'dyn_widget.empty_wallets', text: t('dyn_widget.empty_wallets', {
|
|
118
118
|
action: authMode === 'connect-and-sign'
|
|
@@ -76,8 +76,8 @@ require('../../../../components/Transition/OpacityTransition/OpacityTransition.c
|
|
|
76
76
|
require('../../../../components/PasskeyCreatedSuccessBanner/PasskeyCreatedSuccessBanner.cjs');
|
|
77
77
|
require('../../../../components/Popper/Popper/Popper.cjs');
|
|
78
78
|
require('../../../../components/Popper/PopperContext/PopperContext.cjs');
|
|
79
|
-
require('react-focus-lock');
|
|
80
79
|
require('../../../../components/ShadowDOM/ShadowDOM.cjs');
|
|
80
|
+
require('react-focus-lock');
|
|
81
81
|
var useFetchChain = require('../../hooks/useFetchChain/useFetchChain.cjs');
|
|
82
82
|
require('formik');
|
|
83
83
|
require('../../../../utils/hooks/useSubdomainCheck/useSubdomainCheck.cjs');
|
|
@@ -72,8 +72,8 @@ import '../../../../components/Transition/OpacityTransition/OpacityTransition.js
|
|
|
72
72
|
import '../../../../components/PasskeyCreatedSuccessBanner/PasskeyCreatedSuccessBanner.js';
|
|
73
73
|
import '../../../../components/Popper/Popper/Popper.js';
|
|
74
74
|
import '../../../../components/Popper/PopperContext/PopperContext.js';
|
|
75
|
-
import 'react-focus-lock';
|
|
76
75
|
import '../../../../components/ShadowDOM/ShadowDOM.js';
|
|
76
|
+
import 'react-focus-lock';
|
|
77
77
|
import { useFetchChain } from '../../hooks/useFetchChain/useFetchChain.js';
|
|
78
78
|
import 'formik';
|
|
79
79
|
import '../../../../utils/hooks/useSubdomainCheck/useSubdomainCheck.js';
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|