@dynamic-labs/sdk-react-core
Version:
A React SDK for implementing wallet web3 authentication and authorization to your website.
360 lines (355 loc) • 27.4 kB
JavaScript
'use client'
'use strict';
Object.defineProperty(exports, '__esModule', { value: true });
var jsxRuntime = require('react/jsx-runtime');
var React = require('react');
var reactI18next = require('react-i18next');
var walletBook = require('@dynamic-labs/wallet-book');
var classNames = require('../../../../utils/functions/classNames/classNames.cjs');
require('../../../../components/Accordion/components/AccordionItem/AccordionItem.cjs');
var arrowLeft = require('../../../../shared/assets/arrow-left.cjs');
var chevronDown = require('../../../../shared/assets/chevron-down.cjs');
var footerInfoIcon = require('../../../../shared/assets/footer-info-icon.cjs');
var switchToggle = require('../../../../shared/assets/switch-toggle.cjs');
require('@dynamic-labs/iconic');
require('../../../../context/ViewContext/ViewContext.cjs');
require('../../../../../../_virtual/_tslib.cjs');
require('@dynamic-labs/sdk-api-core');
require('../../../../shared/logger.cjs');
require('@dynamic-labs/wallet-connector-core');
var shortenWalletAddress = require('../../../../shared/utils/functions/shortenWalletAddress/shortenWalletAddress.cjs');
require('@dynamic-labs/utils');
require('../../../../utils/constants/colors.cjs');
require('../../../../utils/constants/values.cjs');
require('../../../../shared/consts/index.cjs');
require('../../../../components/Alert/Alert.cjs');
require('../../../../events/dynamicEvents.cjs');
require('../../../../context/DynamicContext/DynamicContext.cjs');
require('../../../../store/state/loadingAndLifecycle/loadingAndLifecycle.cjs');
require('../../../../store/state/authMode/authMode.cjs');
require('../../../../context/CaptchaContext/CaptchaContext.cjs');
require('../../../../context/ErrorContext/ErrorContext.cjs');
require('@dynamic-labs/multi-wallet');
require('react-international-phone');
require('../../../../store/state/nonce/nonce.cjs');
require('../../../../store/state/projectSettings/projectSettings.cjs');
require('../../../../config/ApiEndpoint.cjs');
require('../../../../store/state/user/user.cjs');
require('../../../../locale/locale.cjs');
require('../../../../store/state/dynamicContextProps/dynamicContextProps.cjs');
require('../../../../store/state/primaryWalletId/primaryWalletId.cjs');
require('../../../../store/state/connectedWalletsInfo/connectedWalletsInfo.cjs');
require('../../../../context/AccessDeniedContext/AccessDeniedContext.cjs');
require('../../../../context/AccountExistsContext/AccountExistsContext.cjs');
require('../../../../context/UserWalletsContext/UserWalletsContext.cjs');
require('../../../../context/VerificationContext/VerificationContext.cjs');
require('react-dom');
require('../../../../utils/functions/compareChains/compareChains.cjs');
require('../../../../views/Passkey/utils/findPrimaryEmbeddedChain/findPrimaryEmbeddedChain.cjs');
require('../../../../context/ThemeContext/ThemeContext.cjs');
require('../../../../utils/hooks/useUserUpdateRequest/useUpdateUser/userFieldsSchema.cjs');
require('bs58');
require('@dynamic-labs/types');
require('../../../../context/SocialRedirectContext/SocialRedirectContext.cjs');
require('../../../../context/LoadingContext/LoadingContext.cjs');
require('../../../../context/WalletContext/WalletContext.cjs');
require('../../../../utils/hooks/useEmbeddedWallet/useSecureEnclaveEmbeddedWallet/constants.cjs');
require('yup');
require('../../../../context/MockContext/MockContext.cjs');
require('../../../../views/CollectUserDataView/useFields.cjs');
require('../../../../context/FieldsStateContext/FieldsStateContext.cjs');
require('../../../../context/UserFieldEditorContext/UserFieldEditorContext.cjs');
require('@dynamic-labs/rpc-providers');
require('../../../../store/state/walletOptions/walletOptions.cjs');
var Typography = require('../../../../components/Typography/Typography.cjs');
require('../../../../context/FooterAnimationContext/index.cjs');
require('../../../../components/ShadowDOM/ShadowDOM.cjs');
require('../../../../components/Transition/ZoomTransition/ZoomTransition.cjs');
require('../../../../components/Transition/SlideInUpTransition/SlideInUpTransition.cjs');
require('../../../../components/Transition/OpacityTransition/OpacityTransition.cjs');
require('../../../../components/OverlayCardBase/OverlayCardTarget/OverlayCardTarget.cjs');
var Skeleton = require('../../../../components/Skeleton/Skeleton.cjs');
var Tooltip = require('../../../../components/Tooltip/Tooltip.cjs');
require('../../../../context/WalletGroupContext/WalletGroupContext.cjs');
require('../../components/DynamicWidgetHeader/DynamicWidgetHeader.cjs');
require('react-focus-lock');
var Icon = require('../../../../components/Icon/Icon.cjs');
var DynamicWidgetContext = require('../../context/DynamicWidgetContext.cjs');
var IconButton = require('../../../../components/IconButton/IconButton.cjs');
require('../../../../components/MenuList/Dropdown/Dropdown.cjs');
var Image = require('../../../../components/Image/Image.cjs');
var TypographyButton = require('../../../../components/TypographyButton/TypographyButton.cjs');
require('formik');
require('../../../../utils/hooks/useSubdomainCheck/useSubdomainCheck.cjs');
var ModalHeader = require('../../../../components/ModalHeader/ModalHeader.cjs');
require('../../../../store/state/sendBalances.cjs');
require('../../../../components/Input/Input.cjs');
require('../../../../components/OverlayCard/OverlayCard.cjs');
require('../../../../views/TransactionConfirmationView/TransactionConfirmationView.cjs');
require('../../../../context/PasskeyContext/PasskeyContext.cjs');
require('../ManagePasskeysWidgetView/PasskeyCard/PasskeyCard.cjs');
require('../../../../context/OnrampContext/OnrampContext.cjs');
require('qrcode');
require('../../../../../index.cjs');
require('../../../../context/IpConfigurationContext/IpConfigurationContext.cjs');
require('../../../../context/ConnectWithOtpContext/ConnectWithOtpContext.cjs');
require('../../../DynamicBridgeWidget/views/WalletsView/components/SecondaryWallets/SecondaryWallets.cjs');
require('@hcaptcha/react-hcaptcha');
require('../../../../context/ErrorContext/hooks/useErrorText/useErrorText.cjs');
require('../../../../components/PasskeyCreatedSuccessBanner/PasskeyCreatedSuccessBanner.cjs');
require('../../helpers/convertExchangeKeyAndProviderEnum.cjs');
require('../../../../store/state/connectorsInitializing/connectorsInitializing.cjs');
require('../../../../store/state/tokenBalances.cjs');
require('../../../../shared/utils/functions/getInitialUrl/getInitialUrl.cjs');
require('../../../../components/InlineWidget/InlineWidget.cjs');
require('../../../../components/IsBrowser/IsBrowser.cjs');
require('../../../../components/Popper/Popper/Popper.cjs');
require('../../../../components/Popper/PopperContext/PopperContext.cjs');
var FormattedInput = require('./FormattedInput/FormattedInput.cjs');
var formattedInputEmitter = require('./FormattedInput/formattedInputEmitter.cjs');
var TokenSelectScreen = require('./TokenSelectScreen/TokenSelectScreen.cjs');
var consts = require('./consts.cjs');
var convert = require('./utils/convert/convert.cjs');
var formatValue = require('./utils/formatValue/formatValue.cjs');
var isFiatToken = require('./utils/isFiatToken/isFiatToken.cjs');
var isNonZero = require('./utils/isNonZero/isNonZero.cjs');
var respectsMinimum = require('./utils/respectsMinimum/respectsMinimum.cjs');
var useExchangeRatesForFunding = require('./utils/useExchangeRatesForFunding/useExchangeRatesForFunding.cjs');
var useSubmitWalletFunding = require('./utils/useSubmitWalletFunding/useSubmitWalletFunding.cjs');
var useTokensForFunding = require('./utils/useTokensForFunding/useTokensForFunding.cjs');
var calculateFiatBalance = require('./utils/calculateFiatBalance/calculateFiatBalance.cjs');
const defaultQuickSuggestions = {
token: 'USD',
values: [25, 100, 500],
};
const rulesThatHideQuickSuggestions = ['exact', 'minimum'];
const rulesThatDisableTokenSelect = ['exact', 'exact-with-amount'];
const inputEmitter = formattedInputEmitter.createFormattedInputEmitter();
const ReceiveWalletFunds = ({ amount: initialAmount, token: initialTokenRaw, wallet, quickSuggestions = defaultQuickSuggestions, }) => {
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
// For now we hardcode the default value, soon we will fetch this from project settings
const initialToken = initialTokenRaw !== null && initialTokenRaw !== void 0 ? initialTokenRaw : {
rule: 'recommended',
value: 'USDC',
};
/** Whether the amount specified in the prop refers to the token amount instead of the fiat amount */
const isInitialAmountValueForToken = (initialToken === null || initialToken === void 0 ? void 0 : initialToken.rule) === 'exact-with-amount';
const minimum = (initialAmount === null || initialAmount === void 0 ? void 0 : initialAmount.rule) === 'minimum'
? {
token: isInitialAmountValueForToken
? initialToken.value
: 'USD',
value: initialAmount.value.toString(),
}
: undefined;
const { t } = reactI18next.useTranslation();
const [hasUserInteracted, setHasUserInteracted] = React.useState(false);
const [conversionErrorIconRef, setConversionErrorIconRef] = React.useState(null);
const { setDynamicWidgetView } = DynamicWidgetContext.useWidgetContext();
const { isLoading: tokenBalancesLoading, tokens: tokenBalances } = useTokensForFunding.useTokensForFunding({
wallet: wallet,
});
const exchangeRates = useExchangeRatesForFunding.useExchangeRatesForFunding({
// Initialize amounts after exchange rates are fetched
onFetch: (exchangeRates) => {
if (tokenAmount === undefined && fiatAmount !== undefined) {
setTokenAmount(convert.convertFromFiat(fiatAmount, tokenSymbol, exchangeRates));
}
if (fiatAmount === undefined && tokenAmount !== undefined) {
setFiatAmount(convert.convertToFiat(tokenAmount, tokenSymbol, exchangeRates));
}
},
tokenBalances,
});
const [tokenAmount, setTokenAmount] = React.useState(isInitialAmountValueForToken
? (_a = initialAmount === null || initialAmount === void 0 ? void 0 : initialAmount.value.toString()) !== null && _a !== void 0 ? _a : ''
: convert.convertFromFiat((_b = initialAmount === null || initialAmount === void 0 ? void 0 : initialAmount.value.toString()) !== null && _b !== void 0 ? _b : '', initialToken.value, exchangeRates));
const [tokenSymbol, _setTokenSymbol] = React.useState(initialToken.value);
const [fiatAmount, setFiatAmount] = React.useState(isInitialAmountValueForToken
? convert.convertToFiat(tokenAmount !== null && tokenAmount !== void 0 ? tokenAmount : '', tokenSymbol, exchangeRates)
: (_c = initialAmount === null || initialAmount === void 0 ? void 0 : initialAmount.value.toString()) !== null && _c !== void 0 ? _c : '');
const setTokenSymbol = React.useCallback((symbol) => {
setHasUserInteracted(true);
_setTokenSymbol(symbol);
if (fiatAmount)
setTokenAmount(convert.convertFromFiat(fiatAmount, symbol, exchangeRates));
}, [fiatAmount, exchangeRates]);
// When we eventually allow changing this, add setter as _setFiatSymbol
// And then create a setFiatSymbol function similar to how we have setTokenSymbol
const [fiatSymbol] = React.useState('USD');
const setAmountsByTokenValue = React.useCallback((amount) => {
setTokenAmount(amount);
setFiatAmount(convert.convertToFiat(amount, tokenSymbol, exchangeRates));
}, [tokenSymbol, exchangeRates]);
const setAmountsByFiatValue = React.useCallback((amount) => {
setFiatAmount(amount);
setTokenAmount(convert.convertFromFiat(amount, tokenSymbol, exchangeRates));
}, [tokenSymbol, exchangeRates]);
const [showTokenAsPrimary, setShowTokenAsPrimary] = React.useState(false);
const switchPrimaryAndSecondary = React.useCallback(() => {
setHasUserInteracted(true);
setShowTokenAsPrimary(!showTokenAsPrimary);
if (tokenAmount && isNaN(parseFloat(tokenAmount))) {
setTokenAmount('');
}
if (fiatAmount && isNaN(parseFloat(fiatAmount))) {
setFiatAmount('');
}
inputEmitter.emit('focus');
}, [fiatAmount, showTokenAsPrimary, tokenAmount]);
const isMinimumRespected = minimum
? respectsMinimum.respectsMinimum({ token: fiatSymbol, value: fiatAmount !== null && fiatAmount !== void 0 ? fiatAmount : '' }, minimum, exchangeRates)
: true;
const [primaryData, secondaryData] = showTokenAsPrimary
? [
{
amount: tokenAmount,
setAmount: setAmountsByTokenValue,
symbol: tokenSymbol,
},
{ amount: fiatAmount, symbol: fiatSymbol },
]
: [
{
amount: fiatAmount,
setAmount: setAmountsByFiatValue,
symbol: fiatSymbol,
},
{ amount: tokenAmount, symbol: tokenSymbol },
];
const secondaryDisplay = formatValue.formatValue({
maxDecimals: isFiatToken.isFiatOrStablecoin(secondaryData.symbol) ? 2 : undefined,
symbol: secondaryData.symbol,
value: secondaryData.amount,
withFixedZeros: isFiatToken.isFiatOrStablecoin(secondaryData.symbol),
});
const quickSuggestionsWithToken = Array.isArray(quickSuggestions)
? { token: 'USD', values: quickSuggestions }
: quickSuggestions;
const quickSuggestionsParsed = quickSuggestionsWithToken.values
.filter((value) => respectsMinimum.respectsMinimum({ token: quickSuggestionsWithToken.token, value: value.toString() }, minimum, exchangeRates))
.map((value) => ({
display: formatValue.formatValue({
symbol: quickSuggestionsWithToken.token,
value: value,
}),
value,
}))
.filter(({ display }) => display !== undefined);
const currentToken = tokenBalances === null || tokenBalances === void 0 ? void 0 : tokenBalances.find(({ symbol }) => symbol === tokenSymbol);
const fiatBalance = calculateFiatBalance.calculateFiatBalance(currentToken, exchangeRates);
const [primaryBalance, secondaryBalance] = showTokenAsPrimary
? [
{
symbol: tokenSymbol,
value: (_d = currentToken === null || currentToken === void 0 ? void 0 : currentToken.balance) !== null && _d !== void 0 ? _d : 0,
},
{
symbol: fiatSymbol,
value: fiatBalance,
},
]
: [
{
symbol: fiatSymbol,
value: fiatBalance,
},
{
symbol: tokenSymbol,
value: (_e = currentToken === null || currentToken === void 0 ? void 0 : currentToken.balance) !== null && _e !== void 0 ? _e : 0,
},
];
const showNotEnoughBalance = Boolean(!tokenBalancesLoading &&
isNonZero.isNonZero(tokenAmount) &&
tokenAmount !== undefined &&
(!currentToken || currentToken.balance < parseFloat(tokenAmount)));
const showMinimumRequired = Boolean(!isMinimumRespected && !showNotEnoughBalance);
const showQuickSuggestions = quickSuggestionsParsed.length > 0 &&
!hasUserInteracted &&
!rulesThatHideQuickSuggestions.includes(initialAmount === null || initialAmount === void 0 ? void 0 : initialAmount.rule) &&
(tokenSymbol === quickSuggestionsWithToken.token ||
isFiatToken.isFiatToken(quickSuggestionsWithToken.token));
const disableTokenSelect = rulesThatDisableTokenSelect.includes(initialToken.rule);
const [showTokenSelect, setShowTokenSelect] = React.useState(false);
const handleSelectToken = React.useCallback((token) => {
setTokenSymbol(token);
setShowTokenSelect(false);
}, [setTokenSymbol]);
const handleQuickSuggestion = React.useCallback((value) => {
setHasUserInteracted(true);
if (isFiatToken.isFiatToken(quickSuggestionsWithToken.token))
setAmountsByFiatValue(value.toString());
else
setAmountsByTokenValue(value.toString());
inputEmitter.emit('focus');
}, [
quickSuggestionsWithToken.token,
setAmountsByFiatValue,
setAmountsByTokenValue,
]);
const handleSubmit = useSubmitWalletFunding.useSubmitWalletFunding();
const disableSubmit = !isMinimumRespected || showNotEnoughBalance || !isNonZero.isNonZero(tokenAmount);
const closeTokenSelect = React.useCallback(() => {
setShowTokenSelect(false);
inputEmitter.emit('focus');
}, []);
const grayOutSecondaryDisplay = !isNonZero.isNonZero(secondaryData.amount) ||
(isFiatToken.isFiatOrStablecoin(secondaryData.symbol) &&
parseFloat((_f = secondaryData.amount) !== null && _f !== void 0 ? _f : '0') < 0.0099);
const inputSymbolProp = primaryData.symbol === 'USD'
? { leading: '$' }
: { trailing: primaryData.symbol };
const backButton = (jsxRuntime.jsx(IconButton.IconButton, { type: 'button', id: 'back-button', "data-testid": 'back-button', onClick: () => setDynamicWidgetView('choose-wallet-funding-method'), children: jsxRuntime.jsx(arrowLeft.ReactComponent, {}) }));
return (jsxRuntime.jsxs("div", { className: 'fund-from-wallet', children: [!disableTokenSelect && (jsxRuntime.jsx(TokenSelectScreen.TokenSelectScreen, { onClose: closeTokenSelect, onSelectToken: handleSelectToken, tokens: tokenBalances !== null && tokenBalances !== void 0 ? tokenBalances : [], currentToken: tokenSymbol, className: classNames.classNames('fund-from-wallet__token-select', {
'fund-from-wallet__token-select--open': showTokenSelect,
}), showTokenAsPrimary: showTokenAsPrimary, exchangeRates: exchangeRates })), jsxRuntime.jsx(ModalHeader.ModalHeader, { leading: backButton, children: jsxRuntime.jsx(Typography.Typography, { variant: 'title', children: t('dyn_wallet_funding.from_wallet.amount_input.title') }) }), jsxRuntime.jsxs("div", { className: 'fund-from-wallet__content', children: [jsxRuntime.jsxs("div", { className: 'fund-from-wallet__content__amount-container', children: [minimum && (jsxRuntime.jsx(Typography.Typography, { color: 'error-1', className: classNames.classNames('fund-from-wallet__content__amount-container__minimum-error', {
'fund-from-wallet__content__amount-container__minimum-error--visible': showMinimumRequired,
}), variant: 'body_normal', weight: 'medium', children: t('dyn_wallet_funding.from_wallet.amount_input.minimum_error', {
minimum: formatValue.formatValue({
symbol: minimum.token,
value: minimum.value,
}),
}) })), primaryData.amount !== undefined && (jsxRuntime.jsx(FormattedInput.FormattedInput, Object.assign({ className: 'fund-from-wallet__content__amount-container__amount', value: (initialAmount === null || initialAmount === void 0 ? void 0 : initialAmount.rule) === 'exact'
? (_g = formatValue.formatValue({
maxDecimals: isFiatToken.isFiatOrStablecoin(primaryData.symbol)
? 2
: 8,
symbol: undefined,
value: primaryData.amount,
withFixedZeros: isFiatToken.isFiatOrStablecoin(primaryData.symbol),
})) !== null && _g !== void 0 ? _g : primaryData.amount
: primaryData.amount, onChange: primaryData.setAmount, emitter: inputEmitter, onInteraction: () => setHasUserInteracted(true), locked: (initialAmount === null || initialAmount === void 0 ? void 0 : initialAmount.rule) === 'exact' }, inputSymbolProp))), primaryData.amount === undefined && (jsxRuntime.jsx(Skeleton.Skeleton, { dataTestId: 'primary-amount-skeleton', container: {
className: 'fund-from-wallet__content__amount-container__skeleton',
} })), showQuickSuggestions && (jsxRuntime.jsx("div", { className: 'fund-from-wallet__content__amount-container__quick-suggestions', children: quickSuggestionsParsed.map(({ display, value }) => (jsxRuntime.jsx(Typography.Typography, { variant: 'body_small', color: 'secondary', onClick: () => handleQuickSuggestion(value), weight: 'medium', children: display }, value))) })), !showQuickSuggestions && secondaryDisplay && (jsxRuntime.jsxs("div", { className: 'fund-from-wallet__content__amount-container__secondary-amount-container', children: [(currentToken === null || currentToken === void 0 ? void 0 : currentToken.logoURI) ? (jsxRuntime.jsx(Image.Image, { dataTestId: 'token-icon', alt: tokenSymbol, src: currentToken.logoURI, className: 'fund-from-wallet__content__token-icon' })) : null, jsxRuntime.jsx(Typography.Typography, { weight: 'medium', className: classNames.classNames('fund-from-wallet__content__amount-container__secondary-amount-container__amount', {
'fund-from-wallet__content__amount-container__secondary-amount-container__amount--grayed-out': grayOutSecondaryDisplay,
}), children: secondaryDisplay }), jsxRuntime.jsx(Icon.Icon, { size: 'small', color: 'text-secondary', className: 'fund-from-wallet__content__amount-container__secondary-amount-container__switch', children: jsxRuntime.jsx(switchToggle.ReactComponent, { "data-testid": 'switch-primary-and-secondary', onClick: switchPrimaryAndSecondary }) })] })), !showQuickSuggestions && !secondaryDisplay && (jsxRuntime.jsxs("div", { className: 'fund-from-wallet__content__amount-container__secondary-missing', children: [jsxRuntime.jsx(Typography.Typography, { weight: 'medium', children: formatValue.formatValue({
symbol: secondaryData.symbol,
value: consts.UNAVAILABLE_VALUE,
}) }), jsxRuntime.jsx("div", { ref: setConversionErrorIconRef, children: jsxRuntime.jsx(Icon.Icon, { size: 'medium', color: 'text-tertiary', children: jsxRuntime.jsx(footerInfoIcon.ReactComponent, {}) }) }), jsxRuntime.jsx(Tooltip.Tooltip, { content: t('dyn_wallet_funding.from_wallet.amount_input.pricing_unavailable'), targetRef: conversionErrorIconRef, className: 'fund-from-wallet__content__amount-container__secondary-missing__tooltip' })] })), jsxRuntime.jsx(Typography.Typography, { color: 'error-1', className: classNames.classNames('fund-from-wallet__content__amount-container__balance-error', {
'fund-from-wallet__content__amount-container__balance-error--visible': showNotEnoughBalance,
}), variant: 'body_normal', weight: 'medium', children: t('dyn_wallet_funding.from_wallet.amount_input.balance_error') })] }), jsxRuntime.jsxs("div", { className: 'fund-from-wallet__content__wallet-card', children: [jsxRuntime.jsxs("div", { className: 'fund-from-wallet__content__wallet-card__wallet-details', children: [jsxRuntime.jsx(walletBook.WalletIcon, { icon: wallet.connector.metadata.icon, walletKey: wallet.connector.key, className: 'fund-from-wallet__content__wallet-card__wallet-details__icon' }), jsxRuntime.jsxs("div", { className: 'fund-from-wallet__content__wallet-card__wallet-details__rows', children: [jsxRuntime.jsx(Typography.Typography, { variant: 'body_small', weight: 'medium', children: t('dyn_wallet_funding.from_wallet.amount_input.wallet_detail_from') }), jsxRuntime.jsx(Typography.Typography, { variant: 'body_small', color: 'secondary', weight: 'medium', children: shortenWalletAddress.shortenWalletAddress(wallet.address) })] })] }), tokenBalancesLoading && (jsxRuntime.jsx(Skeleton.Skeleton, { dataTestId: 'balance-skeleton', container: {
className: 'fund-from-wallet__content__wallet-card__balance-skeleton',
} })), !tokenBalancesLoading && (jsxRuntime.jsxs("div", { className: classNames.classNames('fund-from-wallet__content__wallet-card__balance', {
'fund-from-wallet__content__wallet-card__balance--disable-select': disableTokenSelect,
}), onClick: () => !disableTokenSelect && setShowTokenSelect(true), children: [jsxRuntime.jsxs("div", { className: 'fund-from-wallet__content__wallet-card__balance__rows', children: [jsxRuntime.jsx(Typography.Typography, { variant: 'body_small', "data-testid": `primary-balance-amount-${primaryBalance.symbol}`, weight: 'medium', children: formatValue.formatValue({
maxDecimals: isFiatToken.isFiatOrStablecoin(primaryBalance.symbol)
? 2
: 6,
symbol: primaryBalance.symbol,
value: (_h = primaryBalance.value) !== null && _h !== void 0 ? _h : consts.UNAVAILABLE_VALUE,
withFixedZeros: isFiatToken.isFiatOrStablecoin(primaryBalance.symbol),
}) }), jsxRuntime.jsx(Typography.Typography, { variant: 'body_small', "data-testid": `secondary-balance-amount-${secondaryBalance.symbol}`, color: 'secondary', weight: 'medium', children: formatValue.formatValue({
maxDecimals: isFiatToken.isFiatOrStablecoin(secondaryBalance.symbol)
? 2
: 6,
symbol: secondaryBalance.symbol,
value: (_j = secondaryBalance.value) !== null && _j !== void 0 ? _j : consts.UNAVAILABLE_VALUE,
withFixedZeros: isFiatToken.isFiatOrStablecoin(secondaryBalance.symbol),
}) })] }), !disableTokenSelect && (jsxRuntime.jsx(Icon.Icon, { color: 'text-tertiary', size: 'small', className: 'fund-from-wallet__content__wallet-card__balance__icon', children: jsxRuntime.jsx(chevronDown.ReactComponent, { "data-testid": 'token-select-dropdown' }) }))] }))] })] }), jsxRuntime.jsx(TypographyButton.TypographyButton, { dataTestId: 'confirm-button', buttonVariant: 'brand-primary', buttonPadding: 'large', typographyProps: { color: 'white' }, className: 'fund-from-wallet__confirm-button', disabled: disableSubmit, onClick: () => handleSubmit({
tokenAmount,
tokenBalances,
tokenSymbol,
wallet,
}), children: t('dyn_wallet_funding.from_wallet.amount_input.confirm_button') })] }));
};
exports.ReceiveWalletFunds = ReceiveWalletFunds;