@dynamic-labs/sdk-react-core 1.0.0-alpha.4 → 1.0.0-alpha.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (27) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/package.cjs +2 -2
  3. package/package.js +2 -2
  4. package/package.json +10 -10
  5. package/src/lib/components/SendBalancePageLayout/SendBalancePageLayout.cjs +1 -1
  6. package/src/lib/components/SendBalancePageLayout/SendBalancePageLayout.js +1 -1
  7. package/src/lib/components/SendBalancePageLayout/components/TokenBalanceCard/TokenBalanceCard.cjs +2 -17
  8. package/src/lib/components/SendBalancePageLayout/components/TokenBalanceCard/TokenBalanceCard.d.ts +2 -2
  9. package/src/lib/components/SendBalancePageLayout/components/TokenBalanceCard/TokenBalanceCard.js +2 -17
  10. package/src/lib/styles/index.shadow.cjs +1 -1
  11. package/src/lib/styles/index.shadow.js +1 -1
  12. package/src/lib/utils/hooks/useTransactionEstimatedGas/useTransactionEstimatedGas.cjs +3 -1
  13. package/src/lib/utils/hooks/useTransactionEstimatedGas/useTransactionEstimatedGas.js +3 -1
  14. package/src/lib/views/SendBalanceView/SendBalanceView.cjs +7 -6
  15. package/src/lib/views/SendBalanceView/SendBalanceView.js +7 -6
  16. package/src/lib/views/TransactionConfirmationView/TransactionConfirmationView.cjs +16 -13
  17. package/src/lib/views/TransactionConfirmationView/TransactionConfirmationView.js +17 -14
  18. package/src/lib/views/TransactionConfirmationView/helpers/transactionErrorMessage.cjs +1 -1
  19. package/src/lib/views/TransactionConfirmationView/helpers/transactionErrorMessage.js +1 -1
  20. package/src/lib/widgets/DynamicWidget/components/DynamicWidgetHeader/DynamicWidgetWalletHeader/DynamicWidgetWalletHeader.cjs +14 -1
  21. package/src/lib/widgets/DynamicWidget/components/DynamicWidgetHeader/DynamicWidgetWalletHeader/DynamicWidgetWalletHeader.js +14 -1
  22. package/src/lib/widgets/DynamicWidget/components/SingleWalletButtons/SingleWalletButtons.cjs +5 -1
  23. package/src/lib/widgets/DynamicWidget/components/SingleWalletButtons/SingleWalletButtons.js +5 -1
  24. package/src/lib/widgets/DynamicWidget/components/UnknownWalletInformation/UnknownWalletInformation.cjs +81 -0
  25. package/src/lib/widgets/DynamicWidget/components/UnknownWalletInformation/UnknownWalletInformation.d.ts +4 -0
  26. package/src/lib/widgets/DynamicWidget/components/UnknownWalletInformation/UnknownWalletInformation.js +77 -0
  27. package/src/lib/widgets/DynamicWidget/components/UnknownWalletInformation/index.d.ts +1 -0
@@ -64,6 +64,7 @@ require('../../components/UserProfile/parts/UserProfileField/components/Verified
64
64
  require('@dynamic-labs/types');
65
65
  require('../../utils/hooks/useUserUpdateRequest/useUpdateUser/useUpdateUser.cjs');
66
66
  require('../../context/UserFieldEditorContext/UserFieldEditorContext.cjs');
67
+ var useFetchChain = require('../../widgets/DynamicWidget/hooks/useFetchChain/useFetchChain.cjs');
67
68
  var useFetchCurrency = require('../../widgets/DynamicWidget/hooks/useFetchCurrency/useFetchCurrency.cjs');
68
69
  var useTransactionGas = require('./hooks/useTransactionGas/useTransactionGas.cjs');
69
70
  var useTransactionTotal = require('./hooks/useTransactionTotal/useTransactionTotal.cjs');
@@ -99,7 +100,7 @@ const TransactionConfirmationView = ({ transaction, mutation, onError, onSuccess
99
100
  },
100
101
  });
101
102
  const { mutate: send, isLoading, error: transactionError, } = useMutation.useMutation(() => {
102
- if (transactionError instanceof utils.TransactionGasCannotBeSponsoredError) {
103
+ if (utils.TransactionGasCannotBeSponsoredError.isInstance(transactionError)) {
103
104
  const { connector } = primaryWallet;
104
105
  if (walletConnectorCore.isAccountAbstractionConnector(connector)) {
105
106
  connector.disableGasSponsorshipOnce();
@@ -108,7 +109,7 @@ const TransactionConfirmationView = ({ transaction, mutation, onError, onSuccess
108
109
  return mutation();
109
110
  }, {
110
111
  onFailure: (error) => {
111
- if (error instanceof utils.TransactionGasCannotBeSponsoredError) {
112
+ if (utils.TransactionGasCannotBeSponsoredError.isInstance(error)) {
112
113
  setIsGasSponsored(false);
113
114
  }
114
115
  onError === null || onError === void 0 ? void 0 : onError(error);
@@ -138,8 +139,10 @@ const TransactionConfirmationView = ({ transaction, mutation, onError, onSuccess
138
139
  isTransactionToAddressLoading ||
139
140
  isTransactionFromAddressLoading ||
140
141
  isGasSponsoredLoading;
141
- const ChainIconComponent = getChainIcon.getChainIcon(primaryWallet.chain);
142
- const chainIcon = (jsxRuntime.jsx(Icon.Icon, { size: 'small', children: jsxRuntime.jsx(ChainIconComponent, {}) }));
142
+ const [chain] = useFetchChain.useFetchChain(primaryWallet.connector);
143
+ const chainName = (chain === null || chain === void 0 ? void 0 : chain.name) || primaryWallet.chain;
144
+ const ChainIconComponent = getChainIcon.getChainIcon(chainName);
145
+ const chainIcon = (jsxRuntime.jsx(Icon.Icon, { size: 'small', children: (chain === null || chain === void 0 ? void 0 : chain.icon) ? (jsxRuntime.jsx("img", { src: chain.icon, alt: `${chain.name} icon` })) : (jsxRuntime.jsx(ChainIconComponent, {})) }));
143
146
  const errorMessage = transactionError && transactionErrorMessage.transactionErrorMessage(transactionError);
144
147
  const missingFunds = React.useMemo(() => {
145
148
  if (balance === undefined || total === undefined)
@@ -152,7 +155,7 @@ const TransactionConfirmationView = ({ transaction, mutation, onError, onSuccess
152
155
  return total > balance;
153
156
  }, [balance, total]);
154
157
  const alert = React.useMemo(() => {
155
- if (transactionError instanceof utils.TransactionGasCannotBeSponsoredError) {
158
+ if (utils.TransactionGasCannotBeSponsoredError.isInstance(transactionError)) {
156
159
  return (jsxRuntime.jsx(Alert.Alert, { icon: 'error', variant: 'error', children: t('dyn_send_transaction.error_message.gas_not_sponsored') }));
157
160
  }
158
161
  const showInsufficientFundsWarningMessage = hasInsufficientFunds && missingFunds;
@@ -163,15 +166,15 @@ const TransactionConfirmationView = ({ transaction, mutation, onError, onSuccess
163
166
  amountLeft,
164
167
  currencySymbol,
165
168
  }) }));
166
- }, [currencySymbol, hasInsufficientFunds, missingFunds, transactionError]);
169
+ }, [currencySymbol, hasInsufficientFunds, missingFunds, t, transactionError]);
167
170
  return (jsxRuntime.jsxs(TransactionConfirmationPageLayout.TransactionConfirmationPageLayout, { onClickBack: onClickBack, onClickClose: onClickClose, title: title, appOrigin: appOrigin, appName: appName, appLogoUrl: appLogoUrl, isLoading: isLoading, onClickSend: () => send(), displayPoweredByDynamicFooter: displayPoweredByDynamicFooter, disableSendButton: isTransactionLoading || hasInsufficientFunds, error: errorMessage, alert: alert, children: [jsxRuntime.jsx(TransactionRow.TransactionRow, { label: t('dyn_send_transaction.confirmation.data.from'), isLoading: isTransactionFromAddressLoading, title: transactionFromAddress, children: shortenWalletAddress.shortenWalletAddress(transactionFromAddress, 4, 4) }), jsxRuntime.jsx(TransactionRow.TransactionRow, { label: t('dyn_send_transaction.confirmation.data.to'), isLoading: isTransactionToAddressLoading, title: transactionToAddress, children: transactionToAddress &&
168
- shortenWalletAddress.shortenWalletAddress(transactionToAddress, 4, 4) }), jsxRuntime.jsx(TransactionRow.TransactionRow, { label: t('dyn_send_transaction.confirmation.data.amount'), isLoading: isTransactionValueLoading, isEmpty: !transactionValue, title: transactionValue ? formatBigNumber.formatBigNumber(transactionValue) : undefined, suffix: currencySymbol, icon: chainIcon, dataTestId: 'transaction-amount', children: transactionValue ? formatBigNumber.formatBigNumber(transactionValue, 10) : 0 }), !isGasSponsored && (jsxRuntime.jsx(TransactionRow.TransactionRow, { label: isGasEstimated
169
- ? t('dyn_send_transaction.confirmation.data.gas_estimate')
170
- : t('dyn_send_transaction.confirmation.data.gas'), isEmpty: !gasTotalPrice, isLoading: isGasPriceLoading || isGasSponsoredLoading, title: gasTotalPrice ? formatBigNumber.formatBigNumber(gasTotalPrice) : undefined, suffix: gasTotalPrice ? currencySymbol : undefined, icon: gasTotalPrice ? chainIcon : undefined, dataTestId: isGasEstimated
171
- ? 'transaction-estimated-gas-fee'
172
- : 'transaction-gas-fee', children: gasTotalPrice ? formatBigNumber.formatBigNumber(gasTotalPrice, 10) : '--' })), jsxRuntime.jsx(TransactionRow.TransactionRow, { label: t('dyn_send_transaction.confirmation.data.total'), isEmpty: !total, title: total ? formatBigNumber.formatBigNumber(total) : undefined, suffix: total ? currencySymbol : undefined, icon: total ? chainIcon : undefined, dataTestId: 'transaction-total', children: total
173
- ? formatBigNumber.formatBigNumber(total, 10)
174
- : t('dyn_send_transaction.confirmation.not_applied') })] }));
171
+ shortenWalletAddress.shortenWalletAddress(transactionToAddress, 4, 4) }), jsxRuntime.jsx(TransactionRow.TransactionRow, { label: t('dyn_send_transaction.confirmation.data.amount'), isLoading: isTransactionValueLoading, isEmpty: !transactionValue, title: transactionValue ? formatBigNumber.formatBigNumber(transactionValue) : undefined, suffix: currencySymbol, icon: chainIcon, dataTestId: 'transaction-amount', children: transactionValue ? formatBigNumber.formatBigNumber(transactionValue, 10) : 0 }), !isGasSponsored && (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(TransactionRow.TransactionRow, { label: isGasEstimated
172
+ ? t('dyn_send_transaction.confirmation.data.gas_estimate')
173
+ : t('dyn_send_transaction.confirmation.data.gas'), isEmpty: !gasTotalPrice, isLoading: isGasPriceLoading || isGasSponsoredLoading, title: gasTotalPrice ? formatBigNumber.formatBigNumber(gasTotalPrice) : undefined, suffix: gasTotalPrice ? currencySymbol : undefined, icon: gasTotalPrice ? chainIcon : undefined, dataTestId: isGasEstimated
174
+ ? 'transaction-estimated-gas-fee'
175
+ : 'transaction-gas-fee', children: gasTotalPrice ? formatBigNumber.formatBigNumber(gasTotalPrice, 10) : '--' }), jsxRuntime.jsx(TransactionRow.TransactionRow, { label: t('dyn_send_transaction.confirmation.data.total'), isEmpty: !total, title: total ? formatBigNumber.formatBigNumber(total) : undefined, suffix: total ? currencySymbol : undefined, icon: total ? chainIcon : undefined, dataTestId: 'transaction-total', children: total
176
+ ? formatBigNumber.formatBigNumber(total, 10)
177
+ : t('dyn_send_transaction.confirmation.not_applied') })] }))] }));
175
178
  };
176
179
 
177
180
  exports.TransactionConfirmationView = TransactionConfirmationView;
@@ -1,5 +1,5 @@
1
1
  import { __awaiter } from '../../../../_virtual/_tslib.js';
2
- import { jsx, jsxs } from 'react/jsx-runtime';
2
+ import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
3
3
  import { useState, useMemo } from 'react';
4
4
  import { useTranslation } from 'react-i18next';
5
5
  import { parseEther, isHex, hexToBigInt } from 'viem';
@@ -60,6 +60,7 @@ import '../../components/UserProfile/parts/UserProfileField/components/VerifiedE
60
60
  import '@dynamic-labs/types';
61
61
  import '../../utils/hooks/useUserUpdateRequest/useUpdateUser/useUpdateUser.js';
62
62
  import '../../context/UserFieldEditorContext/UserFieldEditorContext.js';
63
+ import { useFetchChain } from '../../widgets/DynamicWidget/hooks/useFetchChain/useFetchChain.js';
63
64
  import { useFetchCurrency } from '../../widgets/DynamicWidget/hooks/useFetchCurrency/useFetchCurrency.js';
64
65
  import { useTransactionGas } from './hooks/useTransactionGas/useTransactionGas.js';
65
66
  import { useTransactionTotal } from './hooks/useTransactionTotal/useTransactionTotal.js';
@@ -95,7 +96,7 @@ const TransactionConfirmationView = ({ transaction, mutation, onError, onSuccess
95
96
  },
96
97
  });
97
98
  const { mutate: send, isLoading, error: transactionError, } = useMutation(() => {
98
- if (transactionError instanceof TransactionGasCannotBeSponsoredError) {
99
+ if (TransactionGasCannotBeSponsoredError.isInstance(transactionError)) {
99
100
  const { connector } = primaryWallet;
100
101
  if (isAccountAbstractionConnector(connector)) {
101
102
  connector.disableGasSponsorshipOnce();
@@ -104,7 +105,7 @@ const TransactionConfirmationView = ({ transaction, mutation, onError, onSuccess
104
105
  return mutation();
105
106
  }, {
106
107
  onFailure: (error) => {
107
- if (error instanceof TransactionGasCannotBeSponsoredError) {
108
+ if (TransactionGasCannotBeSponsoredError.isInstance(error)) {
108
109
  setIsGasSponsored(false);
109
110
  }
110
111
  onError === null || onError === void 0 ? void 0 : onError(error);
@@ -134,8 +135,10 @@ const TransactionConfirmationView = ({ transaction, mutation, onError, onSuccess
134
135
  isTransactionToAddressLoading ||
135
136
  isTransactionFromAddressLoading ||
136
137
  isGasSponsoredLoading;
137
- const ChainIconComponent = getChainIcon(primaryWallet.chain);
138
- const chainIcon = (jsx(Icon, { size: 'small', children: jsx(ChainIconComponent, {}) }));
138
+ const [chain] = useFetchChain(primaryWallet.connector);
139
+ const chainName = (chain === null || chain === void 0 ? void 0 : chain.name) || primaryWallet.chain;
140
+ const ChainIconComponent = getChainIcon(chainName);
141
+ const chainIcon = (jsx(Icon, { size: 'small', children: (chain === null || chain === void 0 ? void 0 : chain.icon) ? (jsx("img", { src: chain.icon, alt: `${chain.name} icon` })) : (jsx(ChainIconComponent, {})) }));
139
142
  const errorMessage = transactionError && transactionErrorMessage(transactionError);
140
143
  const missingFunds = useMemo(() => {
141
144
  if (balance === undefined || total === undefined)
@@ -148,7 +151,7 @@ const TransactionConfirmationView = ({ transaction, mutation, onError, onSuccess
148
151
  return total > balance;
149
152
  }, [balance, total]);
150
153
  const alert = useMemo(() => {
151
- if (transactionError instanceof TransactionGasCannotBeSponsoredError) {
154
+ if (TransactionGasCannotBeSponsoredError.isInstance(transactionError)) {
152
155
  return (jsx(Alert, { icon: 'error', variant: 'error', children: t('dyn_send_transaction.error_message.gas_not_sponsored') }));
153
156
  }
154
157
  const showInsufficientFundsWarningMessage = hasInsufficientFunds && missingFunds;
@@ -159,15 +162,15 @@ const TransactionConfirmationView = ({ transaction, mutation, onError, onSuccess
159
162
  amountLeft,
160
163
  currencySymbol,
161
164
  }) }));
162
- }, [currencySymbol, hasInsufficientFunds, missingFunds, transactionError]);
165
+ }, [currencySymbol, hasInsufficientFunds, missingFunds, t, transactionError]);
163
166
  return (jsxs(TransactionConfirmationPageLayout, { onClickBack: onClickBack, onClickClose: onClickClose, title: title, appOrigin: appOrigin, appName: appName, appLogoUrl: appLogoUrl, isLoading: isLoading, onClickSend: () => send(), displayPoweredByDynamicFooter: displayPoweredByDynamicFooter, disableSendButton: isTransactionLoading || hasInsufficientFunds, error: errorMessage, alert: alert, children: [jsx(TransactionRow, { label: t('dyn_send_transaction.confirmation.data.from'), isLoading: isTransactionFromAddressLoading, title: transactionFromAddress, children: shortenWalletAddress(transactionFromAddress, 4, 4) }), jsx(TransactionRow, { label: t('dyn_send_transaction.confirmation.data.to'), isLoading: isTransactionToAddressLoading, title: transactionToAddress, children: transactionToAddress &&
164
- shortenWalletAddress(transactionToAddress, 4, 4) }), jsx(TransactionRow, { label: t('dyn_send_transaction.confirmation.data.amount'), isLoading: isTransactionValueLoading, isEmpty: !transactionValue, title: transactionValue ? formatBigNumber(transactionValue) : undefined, suffix: currencySymbol, icon: chainIcon, dataTestId: 'transaction-amount', children: transactionValue ? formatBigNumber(transactionValue, 10) : 0 }), !isGasSponsored && (jsx(TransactionRow, { label: isGasEstimated
165
- ? t('dyn_send_transaction.confirmation.data.gas_estimate')
166
- : t('dyn_send_transaction.confirmation.data.gas'), isEmpty: !gasTotalPrice, isLoading: isGasPriceLoading || isGasSponsoredLoading, title: gasTotalPrice ? formatBigNumber(gasTotalPrice) : undefined, suffix: gasTotalPrice ? currencySymbol : undefined, icon: gasTotalPrice ? chainIcon : undefined, dataTestId: isGasEstimated
167
- ? 'transaction-estimated-gas-fee'
168
- : 'transaction-gas-fee', children: gasTotalPrice ? formatBigNumber(gasTotalPrice, 10) : '--' })), jsx(TransactionRow, { label: t('dyn_send_transaction.confirmation.data.total'), isEmpty: !total, title: total ? formatBigNumber(total) : undefined, suffix: total ? currencySymbol : undefined, icon: total ? chainIcon : undefined, dataTestId: 'transaction-total', children: total
169
- ? formatBigNumber(total, 10)
170
- : t('dyn_send_transaction.confirmation.not_applied') })] }));
167
+ shortenWalletAddress(transactionToAddress, 4, 4) }), jsx(TransactionRow, { label: t('dyn_send_transaction.confirmation.data.amount'), isLoading: isTransactionValueLoading, isEmpty: !transactionValue, title: transactionValue ? formatBigNumber(transactionValue) : undefined, suffix: currencySymbol, icon: chainIcon, dataTestId: 'transaction-amount', children: transactionValue ? formatBigNumber(transactionValue, 10) : 0 }), !isGasSponsored && (jsxs(Fragment, { children: [jsx(TransactionRow, { label: isGasEstimated
168
+ ? t('dyn_send_transaction.confirmation.data.gas_estimate')
169
+ : t('dyn_send_transaction.confirmation.data.gas'), isEmpty: !gasTotalPrice, isLoading: isGasPriceLoading || isGasSponsoredLoading, title: gasTotalPrice ? formatBigNumber(gasTotalPrice) : undefined, suffix: gasTotalPrice ? currencySymbol : undefined, icon: gasTotalPrice ? chainIcon : undefined, dataTestId: isGasEstimated
170
+ ? 'transaction-estimated-gas-fee'
171
+ : 'transaction-gas-fee', children: gasTotalPrice ? formatBigNumber(gasTotalPrice, 10) : '--' }), jsx(TransactionRow, { label: t('dyn_send_transaction.confirmation.data.total'), isEmpty: !total, title: total ? formatBigNumber(total) : undefined, suffix: total ? currencySymbol : undefined, icon: total ? chainIcon : undefined, dataTestId: 'transaction-total', children: total
172
+ ? formatBigNumber(total, 10)
173
+ : t('dyn_send_transaction.confirmation.not_applied') })] }))] }));
171
174
  };
172
175
 
173
176
  export { TransactionConfirmationView };
@@ -28,7 +28,7 @@ const errorReasonsMapping = {
28
28
  const transactionErrorMessage = (error) => {
29
29
  var _a;
30
30
  logger.logger.debug('transaction error]:', error);
31
- if (error instanceof utils.TransactionGasCannotBeSponsoredError) {
31
+ if (utils.TransactionGasCannotBeSponsoredError.isInstance(error)) {
32
32
  return;
33
33
  }
34
34
  const { code } = error;
@@ -24,7 +24,7 @@ const errorReasonsMapping = {
24
24
  const transactionErrorMessage = (error) => {
25
25
  var _a;
26
26
  logger.debug('transaction error]:', error);
27
- if (error instanceof TransactionGasCannotBeSponsoredError) {
27
+ if (TransactionGasCannotBeSponsoredError.isInstance(error)) {
28
28
  return;
29
29
  }
30
30
  const { code } = error;
@@ -66,6 +66,7 @@ require('react-focus-lock');
66
66
  var FundingContext = require('../../../../../context/FundingContext/FundingContext.cjs');
67
67
  var SendBalanceContext = require('../../../../../context/SendBalanceContext/SendBalanceContext.cjs');
68
68
  var ActiveWalletInformation = require('../../ActiveWalletInformation/ActiveWalletInformation.cjs');
69
+ var UnknownWalletInformation = require('../../UnknownWalletInformation/UnknownWalletInformation.cjs');
69
70
  var UserAvatar = require('../../../../../components/UserAvatar/UserAvatar.cjs');
70
71
 
71
72
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
@@ -99,8 +100,20 @@ const DynamicWidgetWalletHeader = ({ variant, }) => {
99
100
  }
100
101
  return shortenEmail.shortenEmail(user === null || user === void 0 ? void 0 : user.email);
101
102
  };
103
+ const renderWalletHeader = () => {
104
+ const unknownWallet = user === null || user === void 0 ? void 0 : user.verifiedCredentials.find((credential) => credential.walletName === 'unknown');
105
+ if (primaryWallet) {
106
+ return jsxRuntime.jsx(ActiveWalletInformation.ActiveWalletInformation, {});
107
+ }
108
+ else if (unknownWallet) {
109
+ return jsxRuntime.jsx(UnknownWalletInformation.UnknownWalletInformation, { address: unknownWallet.address });
110
+ }
111
+ else {
112
+ return (jsxRuntime.jsx("div", { className: 'dynamic-widget-wallet-header__icon-container', children: jsxRuntime.jsx(UserAvatar.UserAvatar, { user: user }) }));
113
+ }
114
+ };
102
115
  const isActionsVisible = isSendBalanceEnabled || fundingEnabled;
103
- return (jsxRuntime.jsxs("div", { className: 'dynamic-widget-wallet-header', "data-testid": 'dynamic-widget-wallet-header', children: [primaryWallet ? (jsxRuntime.jsx(ActiveWalletInformation.ActiveWalletInformation, {})) : (jsxRuntime.jsx("div", { className: 'dynamic-widget-wallet-header__icon-container', children: jsxRuntime.jsx(UserAvatar.UserAvatar, { user: user }) })), primaryWallet ? (jsxRuntime.jsx("div", { "data-testid": 'primaryWalletStatus', className: 'dynamic-widget-wallet-header__wallet-info', children: isActionsVisible && (jsxRuntime.jsxs("div", { className: 'dynamic-widget-wallet-header__wallet-actions', children: [fundingEnabled && (jsxRuntime.jsx(Button.Button, { expanded: true, dataTestId: 'buy-crypto-button', buttonPadding: 'small', buttonVariant: 'primary', onClick: () => setShowFunding(true), disabled: !supportsFunding, startSlot:
116
+ return (jsxRuntime.jsxs("div", { className: 'dynamic-widget-wallet-header', "data-testid": 'dynamic-widget-wallet-header', children: [renderWalletHeader(), primaryWallet ? (jsxRuntime.jsx("div", { "data-testid": 'primaryWalletStatus', className: 'dynamic-widget-wallet-header__wallet-info', children: isActionsVisible && (jsxRuntime.jsxs("div", { className: 'dynamic-widget-wallet-header__wallet-actions', children: [fundingEnabled && (jsxRuntime.jsx(Button.Button, { expanded: true, dataTestId: 'buy-crypto-button', buttonPadding: 'small', buttonVariant: 'primary', onClick: () => setShowFunding(true), disabled: !supportsFunding, startSlot:
104
117
  // eslint-disable-next-line react/jsx-wrap-multilines
105
118
  jsxRuntime.jsx(Icon.Icon, { size: 'small', color: 'text-secondary', children: jsxRuntime.jsx(add.ReactComponent, {}) }), children: "Buy" })), isSendBalanceEnabled && (jsxRuntime.jsx(Button.Button, { expanded: true, dataTestId: 'send-balance-button', buttonPadding: 'small', buttonVariant: 'primary', onClick: handleOnClickSend, startSlot:
106
119
  // eslint-disable-next-line react/jsx-wrap-multilines
@@ -62,6 +62,7 @@ import 'react-focus-lock';
62
62
  import { useFundingContext } from '../../../../../context/FundingContext/FundingContext.js';
63
63
  import { useSendBalance } from '../../../../../context/SendBalanceContext/SendBalanceContext.js';
64
64
  import { ActiveWalletInformation } from '../../ActiveWalletInformation/ActiveWalletInformation.js';
65
+ import { UnknownWalletInformation } from '../../UnknownWalletInformation/UnknownWalletInformation.js';
65
66
  import { UserAvatar } from '../../../../../components/UserAvatar/UserAvatar.js';
66
67
 
67
68
  const DynamicWidgetWalletHeader = ({ variant, }) => {
@@ -91,8 +92,20 @@ const DynamicWidgetWalletHeader = ({ variant, }) => {
91
92
  }
92
93
  return shortenEmail(user === null || user === void 0 ? void 0 : user.email);
93
94
  };
95
+ const renderWalletHeader = () => {
96
+ const unknownWallet = user === null || user === void 0 ? void 0 : user.verifiedCredentials.find((credential) => credential.walletName === 'unknown');
97
+ if (primaryWallet) {
98
+ return jsx(ActiveWalletInformation, {});
99
+ }
100
+ else if (unknownWallet) {
101
+ return jsx(UnknownWalletInformation, { address: unknownWallet.address });
102
+ }
103
+ else {
104
+ return (jsx("div", { className: 'dynamic-widget-wallet-header__icon-container', children: jsx(UserAvatar, { user: user }) }));
105
+ }
106
+ };
94
107
  const isActionsVisible = isSendBalanceEnabled || fundingEnabled;
95
- return (jsxs("div", { className: 'dynamic-widget-wallet-header', "data-testid": 'dynamic-widget-wallet-header', children: [primaryWallet ? (jsx(ActiveWalletInformation, {})) : (jsx("div", { className: 'dynamic-widget-wallet-header__icon-container', children: jsx(UserAvatar, { user: user }) })), primaryWallet ? (jsx("div", { "data-testid": 'primaryWalletStatus', className: 'dynamic-widget-wallet-header__wallet-info', children: isActionsVisible && (jsxs("div", { className: 'dynamic-widget-wallet-header__wallet-actions', children: [fundingEnabled && (jsx(Button, { expanded: true, dataTestId: 'buy-crypto-button', buttonPadding: 'small', buttonVariant: 'primary', onClick: () => setShowFunding(true), disabled: !supportsFunding, startSlot:
108
+ return (jsxs("div", { className: 'dynamic-widget-wallet-header', "data-testid": 'dynamic-widget-wallet-header', children: [renderWalletHeader(), primaryWallet ? (jsx("div", { "data-testid": 'primaryWalletStatus', className: 'dynamic-widget-wallet-header__wallet-info', children: isActionsVisible && (jsxs("div", { className: 'dynamic-widget-wallet-header__wallet-actions', children: [fundingEnabled && (jsx(Button, { expanded: true, dataTestId: 'buy-crypto-button', buttonPadding: 'small', buttonVariant: 'primary', onClick: () => setShowFunding(true), disabled: !supportsFunding, startSlot:
96
109
  // eslint-disable-next-line react/jsx-wrap-multilines
97
110
  jsx(Icon, { size: 'small', color: 'text-secondary', children: jsx(SvgAdd, {}) }), children: "Buy" })), isSendBalanceEnabled && (jsx(Button, { expanded: true, dataTestId: 'send-balance-button', buttonPadding: 'small', buttonVariant: 'primary', onClick: handleOnClickSend, startSlot:
98
111
  // eslint-disable-next-line react/jsx-wrap-multilines
@@ -61,10 +61,14 @@ require('react-focus-lock');
61
61
 
62
62
  const SingleWalletButtons = () => {
63
63
  const { primaryWallet, handleLogOut, user } = useInternalDynamicContext.useInternalDynamicContext();
64
+ const unknownWallet = user === null || user === void 0 ? void 0 : user.verifiedCredentials.find((credential) => credential.walletName === 'unknown');
64
65
  return (jsxRuntime.jsxs("div", { className: 'single-wallet-buttons', children: [jsxRuntime.jsx(Button.Button, { dataTestId: 'Copy address', expanded: true, buttonPadding: 'medium', typographyProps: {
65
66
  className: 'single-wallet-buttons--center',
66
67
  variant: 'button_primary',
67
- }, onClick: () => helpers.copyToClipboard((primaryWallet === null || primaryWallet === void 0 ? void 0 : primaryWallet.address) || (user === null || user === void 0 ? void 0 : user.email) || ''), feedback:
68
+ }, onClick: () => helpers.copyToClipboard((primaryWallet === null || primaryWallet === void 0 ? void 0 : primaryWallet.address) ||
69
+ (unknownWallet === null || unknownWallet === void 0 ? void 0 : unknownWallet.address) ||
70
+ (user === null || user === void 0 ? void 0 : user.email) ||
71
+ ''), feedback:
68
72
  // eslint-disable-next-line react/jsx-wrap-multilines
69
73
  jsxRuntime.jsxs("div", { className: 'single-wallet-buttons__copied', children: [jsxRuntime.jsx(checkCircle.ReactComponent, {}), " Copied!"] }), children: "Copy address" }), jsxRuntime.jsx(Button.Button, { dataTestId: 'Disconnect', expanded: true, buttonPadding: 'medium', typographyProps: {
70
74
  className: 'single-wallet-buttons--center',
@@ -57,10 +57,14 @@ import 'react-focus-lock';
57
57
 
58
58
  const SingleWalletButtons = () => {
59
59
  const { primaryWallet, handleLogOut, user } = useInternalDynamicContext();
60
+ const unknownWallet = user === null || user === void 0 ? void 0 : user.verifiedCredentials.find((credential) => credential.walletName === 'unknown');
60
61
  return (jsxs("div", { className: 'single-wallet-buttons', children: [jsx(Button, { dataTestId: 'Copy address', expanded: true, buttonPadding: 'medium', typographyProps: {
61
62
  className: 'single-wallet-buttons--center',
62
63
  variant: 'button_primary',
63
- }, onClick: () => copyToClipboard((primaryWallet === null || primaryWallet === void 0 ? void 0 : primaryWallet.address) || (user === null || user === void 0 ? void 0 : user.email) || ''), feedback:
64
+ }, onClick: () => copyToClipboard((primaryWallet === null || primaryWallet === void 0 ? void 0 : primaryWallet.address) ||
65
+ (unknownWallet === null || unknownWallet === void 0 ? void 0 : unknownWallet.address) ||
66
+ (user === null || user === void 0 ? void 0 : user.email) ||
67
+ ''), feedback:
64
68
  // eslint-disable-next-line react/jsx-wrap-multilines
65
69
  jsxs("div", { className: 'single-wallet-buttons__copied', children: [jsx(SvgCheckCircle, {}), " Copied!"] }), children: "Copy address" }), jsx(Button, { dataTestId: 'Disconnect', expanded: true, buttonPadding: 'medium', typographyProps: {
66
70
  className: 'single-wallet-buttons--center',
@@ -0,0 +1,81 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var jsxRuntime = require('react/jsx-runtime');
6
+ require('react');
7
+ require('@dynamic-labs/utils');
8
+ require('@dynamic-labs/sdk-api');
9
+ require('../../../../config/ApiEndpoint.cjs');
10
+ require('../../../../shared/logger.cjs');
11
+ require('@dynamic-labs/iconic');
12
+ require('@dynamic-labs/wallet-connector-core');
13
+ require('../../../../context/ViewContext/ViewContext.cjs');
14
+ require('@dynamic-labs/wallet-book');
15
+ var shortenWalletAddress = require('../../../../shared/utils/functions/shortenWalletAddress/shortenWalletAddress.cjs');
16
+ require('../../../../utils/constants/colors.cjs');
17
+ require('../../../../shared/utils/classes/storage/localStorage.cjs');
18
+ require('viem');
19
+ require('../../../../shared/consts/index.cjs');
20
+ require('@dynamic-labs/multi-wallet');
21
+ require('@dynamic-labs/rpc-providers');
22
+ require('../../../../utils/hooks/useWallets/utils/verifyMagicIsSetup/verifyMagicIsSetup.cjs');
23
+ require('../../../../context/AccessDeniedContext/AccessDeniedContext.cjs');
24
+ require('../../../../context/AccountExistsContext/AccountExistsContext.cjs');
25
+ var useInternalDynamicContext = require('../../../../context/DynamicContext/useInternalDynamicContext.cjs');
26
+ require('../../../../context/ErrorContext/ErrorContext.cjs');
27
+ require('react-dom');
28
+ require('react-i18next');
29
+ require('../../../../components/Transition/ZoomTransition/ZoomTransition.cjs');
30
+ require('../../../../components/Transition/SlideInUpTransition/SlideInUpTransition.cjs');
31
+ require('../../../../components/Transition/OpacityTransition/OpacityTransition.cjs');
32
+ require('../../../../components/ShadowDOM/ShadowDOM.cjs');
33
+ require('../../../../components/OverlayCard/OverlayCard.context.cjs');
34
+ require('../../../../context/FooterAnimationContext/index.cjs');
35
+ require('../../../../context/MockContext/MockContext.cjs');
36
+ require('../../../../context/QrCodeContext/QrCodeContext.cjs');
37
+ var Typography = require('../../../../components/Typography/Typography.cjs');
38
+ require('../../../../context/WalletGroupContext/WalletGroupContext.cjs');
39
+ require('../DynamicWidgetHeader/DynamicWidgetHeader.cjs');
40
+ require('../../../../context/ThemeContext/ThemeContext.cjs');
41
+ require('../../../../context/CaptchaContext/CaptchaContext.cjs');
42
+ require('../../../../context/EmailVerificationContext/EmailVerificationContext.cjs');
43
+ require('qrcode');
44
+ require('../../../../context/LoadingContext/LoadingContext.cjs');
45
+ require('i18next');
46
+ require('../../context/DynamicWidgetContext.cjs');
47
+ var DotsMenu = require('../DotsMenu/DotsMenu.cjs');
48
+ require('yup');
49
+ require('../../../../components/UserProfile/parts/UserProfileField/components/VerifiedEmailIcon/VerifiedEmailIcon.cjs');
50
+ require('@dynamic-labs/types');
51
+ require('../../../../utils/hooks/useUserUpdateRequest/useUpdateUser/useUpdateUser.cjs');
52
+ require('../../../../context/UserFieldEditorContext/UserFieldEditorContext.cjs');
53
+ require('formik');
54
+ require('../../../../components/IconButton/IconButton.cjs');
55
+ require('../../../../components/Alert/Alert.cjs');
56
+ require('../../views/ManagePasskeysWidgetView/PasskeyCard/PasskeyCard.cjs');
57
+ require('../../../../components/InlineWidget/InlineWidget.cjs');
58
+ require('../../../../components/MenuList/Dropdown/Dropdown.cjs');
59
+ require('../../../../components/Popper/Popper/Popper.cjs');
60
+ require('../../../../components/Popper/PopperContext/PopperContext.cjs');
61
+ require('react-focus-lock');
62
+
63
+ const UnknownWalletInformation = ({ address, }) => {
64
+ const { handleLogOut } = useInternalDynamicContext.useInternalDynamicContext();
65
+ const options = [
66
+ {
67
+ Icon: null,
68
+ callback: () => address && navigator.clipboard.writeText(address),
69
+ hide: !address,
70
+ text: 'Copy wallet address',
71
+ },
72
+ {
73
+ Icon: null,
74
+ callback: handleLogOut,
75
+ text: 'Disconnect',
76
+ },
77
+ ];
78
+ return (jsxRuntime.jsx("div", { className: 'unknown-wallet-information-container', children: jsxRuntime.jsx("div", { className: 'unknown-wallet-information', children: jsxRuntime.jsx("div", { className: 'unknown-wallet-information__header', children: jsxRuntime.jsx("div", { className: 'unknown-wallet-information__details', children: jsxRuntime.jsxs("div", { className: 'unknown-wallet-information__actions-container', children: [jsxRuntime.jsx("div", { children: jsxRuntime.jsx(Typography.Typography, { className: 'unknown-wallet-information__address', weight: 'medium', variant: 'body_normal', color: 'primary', children: shortenWalletAddress.shortenWalletAddress(address, 4, 4) }) }), jsxRuntime.jsx(DotsMenu.DotsMenu, { options: options, buttonClassName: 'unknown-wallet-information__dots-menu', buttonClassNameWithOpenMenu: 'unknown-wallet-information__dots-menu' })] }) }) }) }) }));
79
+ };
80
+
81
+ exports.UnknownWalletInformation = UnknownWalletInformation;
@@ -0,0 +1,4 @@
1
+ /// <reference types="react" />
2
+ export declare const UnknownWalletInformation: ({ address, }: {
3
+ address: string | undefined;
4
+ }) => JSX.Element;
@@ -0,0 +1,77 @@
1
+ import { jsx, jsxs } from 'react/jsx-runtime';
2
+ import 'react';
3
+ import '@dynamic-labs/utils';
4
+ import '@dynamic-labs/sdk-api';
5
+ import '../../../../config/ApiEndpoint.js';
6
+ import '../../../../shared/logger.js';
7
+ import '@dynamic-labs/iconic';
8
+ import '@dynamic-labs/wallet-connector-core';
9
+ import '../../../../context/ViewContext/ViewContext.js';
10
+ import '@dynamic-labs/wallet-book';
11
+ import { shortenWalletAddress } from '../../../../shared/utils/functions/shortenWalletAddress/shortenWalletAddress.js';
12
+ import '../../../../utils/constants/colors.js';
13
+ import '../../../../shared/utils/classes/storage/localStorage.js';
14
+ import 'viem';
15
+ import '../../../../shared/consts/index.js';
16
+ import '@dynamic-labs/multi-wallet';
17
+ import '@dynamic-labs/rpc-providers';
18
+ import '../../../../utils/hooks/useWallets/utils/verifyMagicIsSetup/verifyMagicIsSetup.js';
19
+ import '../../../../context/AccessDeniedContext/AccessDeniedContext.js';
20
+ import '../../../../context/AccountExistsContext/AccountExistsContext.js';
21
+ import { useInternalDynamicContext } from '../../../../context/DynamicContext/useInternalDynamicContext.js';
22
+ import '../../../../context/ErrorContext/ErrorContext.js';
23
+ import 'react-dom';
24
+ import 'react-i18next';
25
+ import '../../../../components/Transition/ZoomTransition/ZoomTransition.js';
26
+ import '../../../../components/Transition/SlideInUpTransition/SlideInUpTransition.js';
27
+ import '../../../../components/Transition/OpacityTransition/OpacityTransition.js';
28
+ import '../../../../components/ShadowDOM/ShadowDOM.js';
29
+ import '../../../../components/OverlayCard/OverlayCard.context.js';
30
+ import '../../../../context/FooterAnimationContext/index.js';
31
+ import '../../../../context/MockContext/MockContext.js';
32
+ import '../../../../context/QrCodeContext/QrCodeContext.js';
33
+ import { Typography } from '../../../../components/Typography/Typography.js';
34
+ import '../../../../context/WalletGroupContext/WalletGroupContext.js';
35
+ import '../DynamicWidgetHeader/DynamicWidgetHeader.js';
36
+ import '../../../../context/ThemeContext/ThemeContext.js';
37
+ import '../../../../context/CaptchaContext/CaptchaContext.js';
38
+ import '../../../../context/EmailVerificationContext/EmailVerificationContext.js';
39
+ import 'qrcode';
40
+ import '../../../../context/LoadingContext/LoadingContext.js';
41
+ import 'i18next';
42
+ import '../../context/DynamicWidgetContext.js';
43
+ import { DotsMenu } from '../DotsMenu/DotsMenu.js';
44
+ import 'yup';
45
+ import '../../../../components/UserProfile/parts/UserProfileField/components/VerifiedEmailIcon/VerifiedEmailIcon.js';
46
+ import '@dynamic-labs/types';
47
+ import '../../../../utils/hooks/useUserUpdateRequest/useUpdateUser/useUpdateUser.js';
48
+ import '../../../../context/UserFieldEditorContext/UserFieldEditorContext.js';
49
+ import 'formik';
50
+ import '../../../../components/IconButton/IconButton.js';
51
+ import '../../../../components/Alert/Alert.js';
52
+ import '../../views/ManagePasskeysWidgetView/PasskeyCard/PasskeyCard.js';
53
+ import '../../../../components/InlineWidget/InlineWidget.js';
54
+ import '../../../../components/MenuList/Dropdown/Dropdown.js';
55
+ import '../../../../components/Popper/Popper/Popper.js';
56
+ import '../../../../components/Popper/PopperContext/PopperContext.js';
57
+ import 'react-focus-lock';
58
+
59
+ const UnknownWalletInformation = ({ address, }) => {
60
+ const { handleLogOut } = useInternalDynamicContext();
61
+ const options = [
62
+ {
63
+ Icon: null,
64
+ callback: () => address && navigator.clipboard.writeText(address),
65
+ hide: !address,
66
+ text: 'Copy wallet address',
67
+ },
68
+ {
69
+ Icon: null,
70
+ callback: handleLogOut,
71
+ text: 'Disconnect',
72
+ },
73
+ ];
74
+ return (jsx("div", { className: 'unknown-wallet-information-container', children: jsx("div", { className: 'unknown-wallet-information', children: jsx("div", { className: 'unknown-wallet-information__header', children: jsx("div", { className: 'unknown-wallet-information__details', children: jsxs("div", { className: 'unknown-wallet-information__actions-container', children: [jsx("div", { children: jsx(Typography, { className: 'unknown-wallet-information__address', weight: 'medium', variant: 'body_normal', color: 'primary', children: shortenWalletAddress(address, 4, 4) }) }), jsx(DotsMenu, { options: options, buttonClassName: 'unknown-wallet-information__dots-menu', buttonClassNameWithOpenMenu: 'unknown-wallet-information__dots-menu' })] }) }) }) }) }));
75
+ };
76
+
77
+ export { UnknownWalletInformation };
@@ -0,0 +1 @@
1
+ export { UnknownWalletInformation } from './UnknownWalletInformation';