@dynamic-labs/sdk-react-core 4.7.2 → 4.8.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +21 -0
- package/package.cjs +1 -1
- package/package.js +1 -1
- package/package.json +11 -11
- package/src/lib/components/NetworkPicker/components/NetworkSwitchControl/NetworkSwitchControl.cjs +2 -2
- package/src/lib/components/NetworkPicker/components/NetworkSwitchControl/NetworkSwitchControl.js +2 -2
- package/src/lib/components/QrCodeWrapper/QrCodeContainer/QrCodeContainer.cjs +2 -2
- package/src/lib/components/QrCodeWrapper/QrCodeContainer/QrCodeContainer.js +2 -2
- package/src/lib/components/SendBalancePageLayout/SendBalancePageLayout.cjs +6 -1
- package/src/lib/components/SendBalancePageLayout/SendBalancePageLayout.js +6 -1
- package/src/lib/components/TransactionCard/SendBalanceTransactionCard.cjs +7 -2
- package/src/lib/components/TransactionCard/SendBalanceTransactionCard.d.ts +1 -2
- package/src/lib/components/TransactionCard/SendBalanceTransactionCard.js +7 -2
- package/src/lib/components/TransactionCard/TransactionCard.cjs +16 -12
- package/src/lib/components/TransactionCard/TransactionCard.js +16 -12
- package/src/lib/components/TransactionConfirmationPageLayout/TransactionConfirmationPageLayout.cjs +1 -1
- package/src/lib/components/TransactionConfirmationPageLayout/TransactionConfirmationPageLayout.js +1 -1
- package/src/lib/components/TransactionStatusLayout/TransactionStatusLayout.cjs +14 -4
- package/src/lib/components/TransactionStatusLayout/TransactionStatusLayout.d.ts +1 -0
- package/src/lib/components/TransactionStatusLayout/TransactionStatusLayout.js +14 -4
- package/src/lib/context/DynamicContext/DynamicContext.cjs +12 -11
- package/src/lib/context/DynamicContext/DynamicContext.js +12 -11
- package/src/lib/context/DynamicContext/types/SettingsOverrides.d.ts +10 -0
- package/src/lib/styles/index.shadow.cjs +1 -1
- package/src/lib/styles/index.shadow.js +1 -1
- package/src/lib/utils/functions/getTransactionLink/getTransactionLink.cjs +22 -0
- package/src/lib/utils/functions/getTransactionLink/getTransactionLink.d.ts +5 -0
- package/src/lib/utils/functions/getTransactionLink/getTransactionLink.js +18 -0
- package/src/lib/utils/functions/isMultiAssetSupportedNetwork/isMultiAssetSupportedNetwork.cjs +9 -4
- package/src/lib/utils/functions/isMultiAssetSupportedNetwork/isMultiAssetSupportedNetwork.js +9 -4
- package/src/lib/utils/functions/isSupportedNetwork/isSupportedNetwork.cjs +3 -3
- package/src/lib/utils/functions/isSupportedNetwork/isSupportedNetwork.js +3 -3
- package/src/lib/utils/functions/networksAndChains/networksAndChains.cjs +31 -11
- package/src/lib/utils/functions/networksAndChains/networksAndChains.d.ts +6 -2
- package/src/lib/utils/functions/networksAndChains/networksAndChains.js +31 -11
- package/src/lib/utils/hooks/useNetworkConfigurationsFromProjectSettings/useNetworkConfigurationsFromProjectSettings.cjs +11 -3
- package/src/lib/utils/hooks/useNetworkConfigurationsFromProjectSettings/useNetworkConfigurationsFromProjectSettings.d.ts +2 -1
- package/src/lib/utils/hooks/useNetworkConfigurationsFromProjectSettings/useNetworkConfigurationsFromProjectSettings.js +11 -3
- package/src/lib/utils/hooks/useTokenBalances/useTokenBalances.cjs +5 -8
- package/src/lib/utils/hooks/useTokenBalances/useTokenBalances.js +5 -8
- package/src/lib/utils/hooks/useWalletConnectors/useWalletConnectors.cjs +0 -1
- package/src/lib/utils/hooks/useWalletConnectors/useWalletConnectors.js +0 -1
- package/src/lib/views/MobileWalletRedirectView/MobileWalletRedirectView.cjs +2 -1
- package/src/lib/views/MobileWalletRedirectView/MobileWalletRedirectView.js +3 -2
- package/src/lib/views/SendBalanceView/SendBalanceView.cjs +3 -1
- package/src/lib/views/SendBalanceView/SendBalanceView.js +3 -1
- package/src/lib/views/UserDeleteAccountView/UserDeleteAccountView.cjs +1 -1
- package/src/lib/views/UserDeleteAccountView/UserDeleteAccountView.js +1 -1
- package/src/lib/widgets/DynamicWidget/helpers/helpers.cjs +1 -1
- package/src/lib/widgets/DynamicWidget/helpers/helpers.js +2 -2
- package/src/lib/widgets/DynamicWidget/hooks/useFetchChain/useFetchChain.cjs +3 -2
- package/src/lib/widgets/DynamicWidget/hooks/useFetchChain/useFetchChain.js +3 -2
- package/src/lib/widgets/DynamicWidget/prompts/QrCodeModalView/QrCodeModalView.cjs +2 -2
- package/src/lib/widgets/DynamicWidget/prompts/QrCodeModalView/QrCodeModalView.js +2 -2
- package/src/lib/widgets/DynamicWidget/views/ConnectedAppsView/ConnectedAppsView.cjs +12 -12
- package/src/lib/widgets/DynamicWidget/views/ConnectedAppsView/ConnectedAppsView.js +12 -12
- package/src/lib/widgets/DynamicWidget/views/ReceiveWalletFunds/utils/useSubmitWalletFunding/useSubmitWalletFunding.cjs +9 -2
- package/src/lib/widgets/DynamicWidget/views/ReceiveWalletFunds/utils/useSubmitWalletFunding/useSubmitWalletFunding.js +9 -2
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
|
|
4
4
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
5
|
|
|
6
|
+
var _tslib = require('../../../../_virtual/_tslib.cjs');
|
|
6
7
|
var jsxRuntime = require('react/jsx-runtime');
|
|
7
8
|
var reactI18next = require('react-i18next');
|
|
8
9
|
require('@dynamic-labs/utils');
|
|
@@ -11,7 +12,6 @@ var Alert = require('../Alert/Alert.cjs');
|
|
|
11
12
|
var AnimatePresence = require('../AnimatePresence/AnimatePresence.cjs');
|
|
12
13
|
require('react');
|
|
13
14
|
var Typography = require('../Typography/Typography.cjs');
|
|
14
|
-
require('../../../../_virtual/_tslib.cjs');
|
|
15
15
|
require('@dynamic-labs/sdk-api-core');
|
|
16
16
|
require('../../shared/logger.cjs');
|
|
17
17
|
require('@dynamic-labs/iconic');
|
|
@@ -50,6 +50,7 @@ require('../../utils/functions/compareChains/compareChains.cjs');
|
|
|
50
50
|
require('../../context/ThemeContext/ThemeContext.cjs');
|
|
51
51
|
require('../../utils/hooks/useUserUpdateRequest/useUpdateUser/userFieldsSchema.cjs');
|
|
52
52
|
require('bs58');
|
|
53
|
+
var usePromise = require('../../utils/hooks/usePromise/usePromise.cjs');
|
|
53
54
|
require('@dynamic-labs/types');
|
|
54
55
|
require('../../context/SocialRedirectContext/SocialRedirectContext.cjs');
|
|
55
56
|
require('../../context/LoadingContext/LoadingContext.cjs');
|
|
@@ -85,6 +86,7 @@ var sendBalances = require('../../store/state/sendBalances.cjs');
|
|
|
85
86
|
require('../Input/Input.cjs');
|
|
86
87
|
require('../OverlayCard/OverlayCard.cjs');
|
|
87
88
|
var utils = require('../TransactionConfirmationPageLayout/utils.cjs');
|
|
89
|
+
var getTransactionLink = require('../../utils/functions/getTransactionLink/getTransactionLink.cjs');
|
|
88
90
|
require('../../views/TransactionConfirmationView/TransactionConfirmationView.cjs');
|
|
89
91
|
require('../../context/PasskeyContext/PasskeyContext.cjs');
|
|
90
92
|
require('../../widgets/DynamicWidget/views/ManagePasskeysWidgetView/PasskeyCard/PasskeyCard.cjs');
|
|
@@ -105,15 +107,23 @@ require('../IsBrowser/IsBrowser.cjs');
|
|
|
105
107
|
require('../Popper/Popper/Popper.cjs');
|
|
106
108
|
require('../Popper/PopperContext/PopperContext.cjs');
|
|
107
109
|
|
|
108
|
-
const TransactionStatusLayout = ({ destinationAddress, transactionValue, networkCurrency, onDone, displayPoweredByDynamicFooter = true, onClickClose, transaction, currentToken, isNativeToken, }) => {
|
|
110
|
+
const TransactionStatusLayout = ({ destinationAddress, transactionValue, networkCurrency, onDone, displayPoweredByDynamicFooter = true, onClickClose, transaction, currentToken, isNativeToken, transactionHash, }) => {
|
|
109
111
|
const { t } = reactI18next.useTranslation();
|
|
110
|
-
const { showFiat } = useInternalDynamicContext.useInternalDynamicContext();
|
|
112
|
+
const { showFiat, primaryWallet } = useInternalDynamicContext.useInternalDynamicContext();
|
|
111
113
|
const { nativePrice } = sendBalances.useSendBalanceState();
|
|
114
|
+
const { data: txLink } = usePromise.usePromise(() => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
115
|
+
if (!(primaryWallet === null || primaryWallet === void 0 ? void 0 : primaryWallet.connector) || !transactionHash)
|
|
116
|
+
return;
|
|
117
|
+
return getTransactionLink.getTransactionLink({
|
|
118
|
+
transactionHash,
|
|
119
|
+
walletConnector: primaryWallet.connector,
|
|
120
|
+
});
|
|
121
|
+
}));
|
|
112
122
|
const closeButton = onClickClose && (jsxRuntime.jsx(IconButton.IconButton, { type: 'button', onClick: onClickClose, "data-testid": 'close', children: jsxRuntime.jsx(close.ReactComponent, {}) }));
|
|
113
123
|
const totalFiatCost = fiatUtils.getTotalFiatCost(currentToken, transaction, nativePrice, transactionValue);
|
|
114
124
|
return (jsxRuntime.jsxs("div", { className: 'transaction-status-layout', children: [jsxRuntime.jsx(ModalHeader.ModalHeader, { trailing: closeButton, alignContent: 'bottom', children: jsxRuntime.jsx(Icon.Icon, { size: 'large', className: 'transaction-status-layout__status-icon', children: jsxRuntime.jsx(checkBlue.ReactComponent, {}) }) }), jsxRuntime.jsxs("div", { className: 'transaction-status-layout__body', children: [jsxRuntime.jsxs("div", { className: 'transaction-status-layout__sent_to', children: [jsxRuntime.jsxs(Typography.Typography, { variant: 'body_small', color: 'secondary', className: 'transaction-status-layout__title', copykey: 'dyn_send_transaction.succeeded.title', children: [t('dyn_send_transaction.succeeded.title'), ' '] }), jsxRuntime.jsx(Typography.Typography, { variant: 'body_small', color: 'primary', className: 'transaction-status-layout__title', copykey: 'dyn_send_transaction.succeeded.title', children: shortenWalletAddress.shortenWalletAddress(destinationAddress, 3, 3) })] }), jsxRuntime.jsx("div", { className: 'transaction-status-layout__content', children: jsxRuntime.jsx("div", { className: 'transaction-status-layout__rows', children: jsxRuntime.jsxs(Typography.Typography, { variant: 'title', color: 'primary', className: 'transaction-status-layout__title', copykey: 'dyn_send_transaction.succeeded.title', children: [`${utils.getValueRounded(isNativeToken, transaction)} ${networkCurrency} `, showFiat &&
|
|
115
125
|
(currentToken === null || currentToken === void 0 ? void 0 : currentToken.price) &&
|
|
116
|
-
`($${Number(totalFiatCost) <= 0.01 ? '<0.01' : totalFiatCost})`] }) }) }), jsxRuntime.jsx(AnimatePresence.AnimatePresence, { animationComponent: jsxRuntime.jsx(VerticalDrawerTransition.VerticalDrawerTransition, {}), children: jsxRuntime.jsx("div", { className: 'transaction-confirmation__warning', children: jsxRuntime.jsx(Alert.Alert, { variant: 'info', copykey: 'dyn_send_transaction.info_message.refresh_balance_time', children: t('dyn_send_transaction.info_message.refresh_balance_time') }) }) }), jsxRuntime.jsx("div", { className: 'transaction-status-layout__actions', children: jsxRuntime.jsx(TypographyButton.TypographyButton, { buttonVariant: 'brand-primary', buttonPadding: 'small', expanded: true, onClick: onDone, loading: false, copykey: 'dyn_send_transaction.succeeded.continue_button', dataTestId: 'transaction-done-continue', children: t('dyn_send_transaction.succeeded.continue_button') }) }), displayPoweredByDynamicFooter && (jsxRuntime.jsx(PoweredByDynamic.PoweredByDynamic, { classNameRoot: 'transaction-status-layout__footer' }))] })] }));
|
|
126
|
+
`($${Number(totalFiatCost) <= 0.01 ? '<0.01' : totalFiatCost})`] }) }) }), jsxRuntime.jsx(AnimatePresence.AnimatePresence, { animationComponent: jsxRuntime.jsx(VerticalDrawerTransition.VerticalDrawerTransition, {}), children: jsxRuntime.jsx("div", { className: 'transaction-confirmation__warning', children: jsxRuntime.jsx(Alert.Alert, { variant: 'info', copykey: 'dyn_send_transaction.info_message.refresh_balance_time', children: t('dyn_send_transaction.info_message.refresh_balance_time') }) }) }), jsxRuntime.jsx("div", { className: 'transaction-status-layout__transaction-link-container', children: txLink && (jsxRuntime.jsx(Typography.Typography, { as: 'a', href: txLink, target: '_blank', rel: 'noreferrer', className: 'transaction-status-layout__transaction-link-container__transaction-link', variant: 'body_small', children: t('dyn_wallet_funding.success_txn_link') })) }), jsxRuntime.jsx("div", { className: 'transaction-status-layout__actions', children: jsxRuntime.jsx(TypographyButton.TypographyButton, { buttonVariant: 'brand-primary', buttonPadding: 'small', expanded: true, onClick: onDone, loading: false, copykey: 'dyn_send_transaction.succeeded.continue_button', dataTestId: 'transaction-done-continue', children: t('dyn_send_transaction.succeeded.continue_button') }) }), displayPoweredByDynamicFooter && (jsxRuntime.jsx(PoweredByDynamic.PoweredByDynamic, { classNameRoot: 'transaction-status-layout__footer' }))] })] }));
|
|
117
127
|
};
|
|
118
128
|
|
|
119
129
|
exports.TransactionStatusLayout = TransactionStatusLayout;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
'use client'
|
|
2
|
+
import { __awaiter } from '../../../../_virtual/_tslib.js';
|
|
2
3
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
3
4
|
import { useTranslation } from 'react-i18next';
|
|
4
5
|
import '@dynamic-labs/utils';
|
|
@@ -7,7 +8,6 @@ import { Alert } from '../Alert/Alert.js';
|
|
|
7
8
|
import { AnimatePresence } from '../AnimatePresence/AnimatePresence.js';
|
|
8
9
|
import 'react';
|
|
9
10
|
import { Typography } from '../Typography/Typography.js';
|
|
10
|
-
import '../../../../_virtual/_tslib.js';
|
|
11
11
|
import '@dynamic-labs/sdk-api-core';
|
|
12
12
|
import '../../shared/logger.js';
|
|
13
13
|
import '@dynamic-labs/iconic';
|
|
@@ -46,6 +46,7 @@ import '../../utils/functions/compareChains/compareChains.js';
|
|
|
46
46
|
import '../../context/ThemeContext/ThemeContext.js';
|
|
47
47
|
import '../../utils/hooks/useUserUpdateRequest/useUpdateUser/userFieldsSchema.js';
|
|
48
48
|
import 'bs58';
|
|
49
|
+
import { usePromise } from '../../utils/hooks/usePromise/usePromise.js';
|
|
49
50
|
import '@dynamic-labs/types';
|
|
50
51
|
import '../../context/SocialRedirectContext/SocialRedirectContext.js';
|
|
51
52
|
import '../../context/LoadingContext/LoadingContext.js';
|
|
@@ -81,6 +82,7 @@ import { useSendBalanceState } from '../../store/state/sendBalances.js';
|
|
|
81
82
|
import '../Input/Input.js';
|
|
82
83
|
import '../OverlayCard/OverlayCard.js';
|
|
83
84
|
import { getValueRounded } from '../TransactionConfirmationPageLayout/utils.js';
|
|
85
|
+
import { getTransactionLink } from '../../utils/functions/getTransactionLink/getTransactionLink.js';
|
|
84
86
|
import '../../views/TransactionConfirmationView/TransactionConfirmationView.js';
|
|
85
87
|
import '../../context/PasskeyContext/PasskeyContext.js';
|
|
86
88
|
import '../../widgets/DynamicWidget/views/ManagePasskeysWidgetView/PasskeyCard/PasskeyCard.js';
|
|
@@ -101,15 +103,23 @@ import '../IsBrowser/IsBrowser.js';
|
|
|
101
103
|
import '../Popper/Popper/Popper.js';
|
|
102
104
|
import '../Popper/PopperContext/PopperContext.js';
|
|
103
105
|
|
|
104
|
-
const TransactionStatusLayout = ({ destinationAddress, transactionValue, networkCurrency, onDone, displayPoweredByDynamicFooter = true, onClickClose, transaction, currentToken, isNativeToken, }) => {
|
|
106
|
+
const TransactionStatusLayout = ({ destinationAddress, transactionValue, networkCurrency, onDone, displayPoweredByDynamicFooter = true, onClickClose, transaction, currentToken, isNativeToken, transactionHash, }) => {
|
|
105
107
|
const { t } = useTranslation();
|
|
106
|
-
const { showFiat } = useInternalDynamicContext();
|
|
108
|
+
const { showFiat, primaryWallet } = useInternalDynamicContext();
|
|
107
109
|
const { nativePrice } = useSendBalanceState();
|
|
110
|
+
const { data: txLink } = usePromise(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
111
|
+
if (!(primaryWallet === null || primaryWallet === void 0 ? void 0 : primaryWallet.connector) || !transactionHash)
|
|
112
|
+
return;
|
|
113
|
+
return getTransactionLink({
|
|
114
|
+
transactionHash,
|
|
115
|
+
walletConnector: primaryWallet.connector,
|
|
116
|
+
});
|
|
117
|
+
}));
|
|
108
118
|
const closeButton = onClickClose && (jsx(IconButton, { type: 'button', onClick: onClickClose, "data-testid": 'close', children: jsx(SvgClose, {}) }));
|
|
109
119
|
const totalFiatCost = getTotalFiatCost(currentToken, transaction, nativePrice, transactionValue);
|
|
110
120
|
return (jsxs("div", { className: 'transaction-status-layout', children: [jsx(ModalHeader, { trailing: closeButton, alignContent: 'bottom', children: jsx(Icon, { size: 'large', className: 'transaction-status-layout__status-icon', children: jsx(SvgCheckBlue, {}) }) }), jsxs("div", { className: 'transaction-status-layout__body', children: [jsxs("div", { className: 'transaction-status-layout__sent_to', children: [jsxs(Typography, { variant: 'body_small', color: 'secondary', className: 'transaction-status-layout__title', copykey: 'dyn_send_transaction.succeeded.title', children: [t('dyn_send_transaction.succeeded.title'), ' '] }), jsx(Typography, { variant: 'body_small', color: 'primary', className: 'transaction-status-layout__title', copykey: 'dyn_send_transaction.succeeded.title', children: shortenWalletAddress(destinationAddress, 3, 3) })] }), jsx("div", { className: 'transaction-status-layout__content', children: jsx("div", { className: 'transaction-status-layout__rows', children: jsxs(Typography, { variant: 'title', color: 'primary', className: 'transaction-status-layout__title', copykey: 'dyn_send_transaction.succeeded.title', children: [`${getValueRounded(isNativeToken, transaction)} ${networkCurrency} `, showFiat &&
|
|
111
121
|
(currentToken === null || currentToken === void 0 ? void 0 : currentToken.price) &&
|
|
112
|
-
`($${Number(totalFiatCost) <= 0.01 ? '<0.01' : totalFiatCost})`] }) }) }), jsx(AnimatePresence, { animationComponent: jsx(VerticalDrawerTransition, {}), children: jsx("div", { className: 'transaction-confirmation__warning', children: jsx(Alert, { variant: 'info', copykey: 'dyn_send_transaction.info_message.refresh_balance_time', children: t('dyn_send_transaction.info_message.refresh_balance_time') }) }) }), jsx("div", { className: 'transaction-status-layout__actions', children: jsx(TypographyButton, { buttonVariant: 'brand-primary', buttonPadding: 'small', expanded: true, onClick: onDone, loading: false, copykey: 'dyn_send_transaction.succeeded.continue_button', dataTestId: 'transaction-done-continue', children: t('dyn_send_transaction.succeeded.continue_button') }) }), displayPoweredByDynamicFooter && (jsx(PoweredByDynamic, { classNameRoot: 'transaction-status-layout__footer' }))] })] }));
|
|
122
|
+
`($${Number(totalFiatCost) <= 0.01 ? '<0.01' : totalFiatCost})`] }) }) }), jsx(AnimatePresence, { animationComponent: jsx(VerticalDrawerTransition, {}), children: jsx("div", { className: 'transaction-confirmation__warning', children: jsx(Alert, { variant: 'info', copykey: 'dyn_send_transaction.info_message.refresh_balance_time', children: t('dyn_send_transaction.info_message.refresh_balance_time') }) }) }), jsx("div", { className: 'transaction-status-layout__transaction-link-container', children: txLink && (jsx(Typography, { as: 'a', href: txLink, target: '_blank', rel: 'noreferrer', className: 'transaction-status-layout__transaction-link-container__transaction-link', variant: 'body_small', children: t('dyn_wallet_funding.success_txn_link') })) }), jsx("div", { className: 'transaction-status-layout__actions', children: jsx(TypographyButton, { buttonVariant: 'brand-primary', buttonPadding: 'small', expanded: true, onClick: onDone, loading: false, copykey: 'dyn_send_transaction.succeeded.continue_button', dataTestId: 'transaction-done-continue', children: t('dyn_send_transaction.succeeded.continue_button') }) }), displayPoweredByDynamicFooter && (jsx(PoweredByDynamic, { classNameRoot: 'transaction-status-layout__footer' }))] })] }));
|
|
113
123
|
};
|
|
114
124
|
|
|
115
125
|
export { TransactionStatusLayout };
|
|
@@ -159,7 +159,7 @@ const PUBLIC_PROJECT_LIVE_ENVIRONMENT_ID = '2762a57b-faa4-41ce-9f16-abff9300e2c9
|
|
|
159
159
|
const DynamicContext = React.createContext(undefined);
|
|
160
160
|
/** The context provider itself we only use internally */
|
|
161
161
|
const InnerDynamicContextProvider = (props) => {
|
|
162
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
|
|
162
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
|
|
163
163
|
const { children, theme, settings: settings$1, locale: locale$1, enableInstrumentation = false, } = props;
|
|
164
164
|
const { accessDeniedMessagePrimary, accessDeniedMessageSecondary, accessDeniedButton, defaultPhoneInputIso2, apiBaseUrl, coinbaseWalletPreference, detectNewWalletsForLinking = defaultDynamicSettings.defaultDynamicSettings.detectNewWalletsForLinking, enableConnectOnlyFallback = defaultDynamicSettings.defaultDynamicSettings.enableConnectOnlyFallback, deepLinkPreference: deepLinkPreferenceProp = defaultDynamicSettings.defaultDynamicSettings.deepLinkPreference, bridgeChains, cssOverrides, defaultNumberOfWalletsToShow = values.DEFAULT_NUMBER_OF_WALLETS_TO_SHOW, flowNetwork, initialAuthenticationMode = defaultDynamicSettings.defaultDynamicSettings.initialAuthenticationMode, debugError = defaultDynamicSettings.defaultDynamicSettings.debugError, displaySiweStatement = defaultDynamicSettings.defaultDynamicSettings.displaySiweStatement, newToWeb3WalletChainMap, enableVisitTrackingOnConnectOnly = defaultDynamicSettings.defaultDynamicSettings.enableVisitTrackingOnConnectOnly, environmentId, walletsFilter, logLevel = defaultDynamicSettings.defaultDynamicSettings.logLevel, mobileExperience, notInTheListImageUrl, onboardingImageUrl, policiesConsentInnerComponent, customPrivacyPolicy, privacyPolicyUrl, socialMediaLinkText, socialMediaIconUrl, socialMediaUrl, customTermsOfServices, termsOfServiceUrl, toolkitEnabled, siweStatement, shadowDOMEnabled = defaultDynamicSettings.defaultDynamicSettings.shadowDOMEnabled, walletConnectors: walletConnectorsProp, socialProvidersFilter, showLockedWalletView = defaultDynamicSettings.defaultDynamicSettings.showLockedWalletView, walletConnectPreferredChains, walletConnectorExtensions, recommendedWallets, handlers, suppressEndUserConsoleWarning, transactionConfirmation: transactionConfirmationSettings, } = settings$1;
|
|
165
165
|
let { appLogoUrl = defaultDynamicSettings.defaultDynamicSettings.appLogoUrl, appName = defaultDynamicSettings.defaultDynamicSettings.appName, } = settings$1;
|
|
@@ -215,6 +215,7 @@ const InnerDynamicContextProvider = (props) => {
|
|
|
215
215
|
cosmosNetworkOverrides: (_b = settings$1.overrides) === null || _b === void 0 ? void 0 : _b.cosmosNetworks,
|
|
216
216
|
evmNetworksOverrides: (_c = settings$1.overrides) === null || _c === void 0 ? void 0 : _c.evmNetworks,
|
|
217
217
|
projectSettings: projectSettings$1,
|
|
218
|
+
solanaNetworksOverrides: (_d = settings$1.overrides) === null || _d === void 0 ? void 0 : _d.solNetworks,
|
|
218
219
|
});
|
|
219
220
|
useSendDynamicProps.useSendDynamicProps({ environmentId, settings: settings$1 });
|
|
220
221
|
// Console warning for end user safety
|
|
@@ -224,16 +225,16 @@ const InnerDynamicContextProvider = (props) => {
|
|
|
224
225
|
});
|
|
225
226
|
const multiWallet = useMultiWallet.useMultiWallet({
|
|
226
227
|
isBridgeFlow,
|
|
227
|
-
multiWalletOverride: (
|
|
228
|
-
multiWalletSettings: (
|
|
228
|
+
multiWalletOverride: (_e = settings$1.overrides) === null || _e === void 0 ? void 0 : _e.multiWallet,
|
|
229
|
+
multiWalletSettings: (_f = projectSettings$1 === null || projectSettings$1 === void 0 ? void 0 : projectSettings$1.sdk) === null || _f === void 0 ? void 0 : _f.multiWallet,
|
|
229
230
|
});
|
|
230
231
|
const multiAsset = useMultiAsset.useMultiAsset({
|
|
231
|
-
multiAssetOverride: (
|
|
232
|
-
multiAssetSettings: (
|
|
232
|
+
multiAssetOverride: (_g = settings$1.overrides) === null || _g === void 0 ? void 0 : _g.multiAsset,
|
|
233
|
+
multiAssetSettings: (_h = projectSettings$1 === null || projectSettings$1 === void 0 ? void 0 : projectSettings$1.sdk) === null || _h === void 0 ? void 0 : _h.enableMultiAsset,
|
|
233
234
|
});
|
|
234
235
|
const showFiat = useShowFiat.useShowFiat({
|
|
235
|
-
showFiatOverride: (
|
|
236
|
-
showFiatSettings: (
|
|
236
|
+
showFiatOverride: (_j = settings$1.overrides) === null || _j === void 0 ? void 0 : _j.showFiat,
|
|
237
|
+
showFiatSettings: (_k = projectSettings$1 === null || projectSettings$1 === void 0 ? void 0 : projectSettings$1.sdk) === null || _k === void 0 ? void 0 : _k.showFiat,
|
|
237
238
|
});
|
|
238
239
|
// Used inside useVerifyOnAwaitingSignature. Is legacy and should be removed asap
|
|
239
240
|
const [legacyIsVerifying, setLegacyIsVerifying] = React.useState(false);
|
|
@@ -317,7 +318,7 @@ const InnerDynamicContextProvider = (props) => {
|
|
|
317
318
|
canHaveMultipleWalletsConnected: multiWallet,
|
|
318
319
|
connectedWallets,
|
|
319
320
|
primaryWalletId: primaryWalletId$1,
|
|
320
|
-
separateSmartWalletAndSigner: (
|
|
321
|
+
separateSmartWalletAndSigner: (_m = (_l = projectSettings$1 === null || projectSettings$1 === void 0 ? void 0 : projectSettings$1.sdk) === null || _l === void 0 ? void 0 : _l.accountAbstraction) === null || _m === void 0 ? void 0 : _m.separateSmartWalletAndSigner,
|
|
321
322
|
setMultiWalletWidgetState,
|
|
322
323
|
user: user$1 || userWithMissingInfo,
|
|
323
324
|
walletConnectorOptions,
|
|
@@ -433,8 +434,8 @@ const InnerDynamicContextProvider = (props) => {
|
|
|
433
434
|
}, [handleLogOut, isAuthenticated]);
|
|
434
435
|
const { setCallback } = useCustomerCallbacks.useCustomerCallbacks({
|
|
435
436
|
callbacks: {
|
|
436
|
-
onAuthSuccess: (
|
|
437
|
-
onUserProfileUpdate: (
|
|
437
|
+
onAuthSuccess: (_o = settings$1.events) === null || _o === void 0 ? void 0 : _o.onAuthSuccess,
|
|
438
|
+
onUserProfileUpdate: (_p = settings$1.events) === null || _p === void 0 ? void 0 : _p.onUserProfileUpdate,
|
|
438
439
|
},
|
|
439
440
|
handleLogOut,
|
|
440
441
|
isAuthenticated,
|
|
@@ -720,7 +721,7 @@ const InnerDynamicContextProvider = (props) => {
|
|
|
720
721
|
id: `project-settings-${environmentId}`,
|
|
721
722
|
type: 'application/json',
|
|
722
723
|
});
|
|
723
|
-
return (jsxRuntime.jsx(reactI18next.I18nextProvider, { i18n: i18nSDKInstance, children: jsxRuntime.jsx(DynamicContext.Provider, { value: value, children: jsxRuntime.jsx(walletBook.WalletBookContextProvider, { walletBook: walletBook$1, children: jsxRuntime.jsx(ThemeContext.ThemeContextProvider, { customerTheme: parseTheme.parseTheme(theme, ((
|
|
724
|
+
return (jsxRuntime.jsx(reactI18next.I18nextProvider, { i18n: i18nSDKInstance, children: jsxRuntime.jsx(DynamicContext.Provider, { value: value, children: jsxRuntime.jsx(walletBook.WalletBookContextProvider, { walletBook: walletBook$1, children: jsxRuntime.jsx(ThemeContext.ThemeContextProvider, { customerTheme: parseTheme.parseTheme(theme, ((_q = projectSettings$1 === null || projectSettings$1 === void 0 ? void 0 : projectSettings$1.design) === null || _q === void 0 ? void 0 : _q.modal) || undefined), designSettings: projectSettings$1 === null || projectSettings$1 === void 0 ? void 0 : projectSettings$1.design, children: jsxRuntime.jsx(LoadingContext.LoadingContextProvider, { children: jsxRuntime.jsxs(ViewContext.ViewContextProvider, { initialViewType: helpers.getInitialViewType({
|
|
724
725
|
bridgeOnboardingCompleted,
|
|
725
726
|
connectedWallets,
|
|
726
727
|
isAuthenticated: isAuthenticated || Boolean(primaryWallet),
|
|
@@ -155,7 +155,7 @@ const PUBLIC_PROJECT_LIVE_ENVIRONMENT_ID = '2762a57b-faa4-41ce-9f16-abff9300e2c9
|
|
|
155
155
|
const DynamicContext = createContext(undefined);
|
|
156
156
|
/** The context provider itself we only use internally */
|
|
157
157
|
const InnerDynamicContextProvider = (props) => {
|
|
158
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
|
|
158
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
|
|
159
159
|
const { children, theme, settings, locale, enableInstrumentation = false, } = props;
|
|
160
160
|
const { accessDeniedMessagePrimary, accessDeniedMessageSecondary, accessDeniedButton, defaultPhoneInputIso2, apiBaseUrl, coinbaseWalletPreference, detectNewWalletsForLinking = defaultDynamicSettings.detectNewWalletsForLinking, enableConnectOnlyFallback = defaultDynamicSettings.enableConnectOnlyFallback, deepLinkPreference: deepLinkPreferenceProp = defaultDynamicSettings.deepLinkPreference, bridgeChains, cssOverrides, defaultNumberOfWalletsToShow = DEFAULT_NUMBER_OF_WALLETS_TO_SHOW, flowNetwork, initialAuthenticationMode = defaultDynamicSettings.initialAuthenticationMode, debugError = defaultDynamicSettings.debugError, displaySiweStatement = defaultDynamicSettings.displaySiweStatement, newToWeb3WalletChainMap, enableVisitTrackingOnConnectOnly = defaultDynamicSettings.enableVisitTrackingOnConnectOnly, environmentId, walletsFilter, logLevel = defaultDynamicSettings.logLevel, mobileExperience, notInTheListImageUrl, onboardingImageUrl, policiesConsentInnerComponent, customPrivacyPolicy, privacyPolicyUrl, socialMediaLinkText, socialMediaIconUrl, socialMediaUrl, customTermsOfServices, termsOfServiceUrl, toolkitEnabled, siweStatement, shadowDOMEnabled = defaultDynamicSettings.shadowDOMEnabled, walletConnectors: walletConnectorsProp, socialProvidersFilter, showLockedWalletView = defaultDynamicSettings.showLockedWalletView, walletConnectPreferredChains, walletConnectorExtensions, recommendedWallets, handlers, suppressEndUserConsoleWarning, transactionConfirmation: transactionConfirmationSettings, } = settings;
|
|
161
161
|
let { appLogoUrl = defaultDynamicSettings.appLogoUrl, appName = defaultDynamicSettings.appName, } = settings;
|
|
@@ -211,6 +211,7 @@ const InnerDynamicContextProvider = (props) => {
|
|
|
211
211
|
cosmosNetworkOverrides: (_b = settings.overrides) === null || _b === void 0 ? void 0 : _b.cosmosNetworks,
|
|
212
212
|
evmNetworksOverrides: (_c = settings.overrides) === null || _c === void 0 ? void 0 : _c.evmNetworks,
|
|
213
213
|
projectSettings,
|
|
214
|
+
solanaNetworksOverrides: (_d = settings.overrides) === null || _d === void 0 ? void 0 : _d.solNetworks,
|
|
214
215
|
});
|
|
215
216
|
useSendDynamicProps({ environmentId, settings });
|
|
216
217
|
// Console warning for end user safety
|
|
@@ -220,16 +221,16 @@ const InnerDynamicContextProvider = (props) => {
|
|
|
220
221
|
});
|
|
221
222
|
const multiWallet = useMultiWallet({
|
|
222
223
|
isBridgeFlow,
|
|
223
|
-
multiWalletOverride: (
|
|
224
|
-
multiWalletSettings: (
|
|
224
|
+
multiWalletOverride: (_e = settings.overrides) === null || _e === void 0 ? void 0 : _e.multiWallet,
|
|
225
|
+
multiWalletSettings: (_f = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.sdk) === null || _f === void 0 ? void 0 : _f.multiWallet,
|
|
225
226
|
});
|
|
226
227
|
const multiAsset = useMultiAsset({
|
|
227
|
-
multiAssetOverride: (
|
|
228
|
-
multiAssetSettings: (
|
|
228
|
+
multiAssetOverride: (_g = settings.overrides) === null || _g === void 0 ? void 0 : _g.multiAsset,
|
|
229
|
+
multiAssetSettings: (_h = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.sdk) === null || _h === void 0 ? void 0 : _h.enableMultiAsset,
|
|
229
230
|
});
|
|
230
231
|
const showFiat = useShowFiat({
|
|
231
|
-
showFiatOverride: (
|
|
232
|
-
showFiatSettings: (
|
|
232
|
+
showFiatOverride: (_j = settings.overrides) === null || _j === void 0 ? void 0 : _j.showFiat,
|
|
233
|
+
showFiatSettings: (_k = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.sdk) === null || _k === void 0 ? void 0 : _k.showFiat,
|
|
233
234
|
});
|
|
234
235
|
// Used inside useVerifyOnAwaitingSignature. Is legacy and should be removed asap
|
|
235
236
|
const [legacyIsVerifying, setLegacyIsVerifying] = useState(false);
|
|
@@ -313,7 +314,7 @@ const InnerDynamicContextProvider = (props) => {
|
|
|
313
314
|
canHaveMultipleWalletsConnected: multiWallet,
|
|
314
315
|
connectedWallets,
|
|
315
316
|
primaryWalletId,
|
|
316
|
-
separateSmartWalletAndSigner: (
|
|
317
|
+
separateSmartWalletAndSigner: (_m = (_l = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.sdk) === null || _l === void 0 ? void 0 : _l.accountAbstraction) === null || _m === void 0 ? void 0 : _m.separateSmartWalletAndSigner,
|
|
317
318
|
setMultiWalletWidgetState,
|
|
318
319
|
user: user || userWithMissingInfo,
|
|
319
320
|
walletConnectorOptions,
|
|
@@ -429,8 +430,8 @@ const InnerDynamicContextProvider = (props) => {
|
|
|
429
430
|
}, [handleLogOut, isAuthenticated]);
|
|
430
431
|
const { setCallback } = useCustomerCallbacks({
|
|
431
432
|
callbacks: {
|
|
432
|
-
onAuthSuccess: (
|
|
433
|
-
onUserProfileUpdate: (
|
|
433
|
+
onAuthSuccess: (_o = settings.events) === null || _o === void 0 ? void 0 : _o.onAuthSuccess,
|
|
434
|
+
onUserProfileUpdate: (_p = settings.events) === null || _p === void 0 ? void 0 : _p.onUserProfileUpdate,
|
|
434
435
|
},
|
|
435
436
|
handleLogOut,
|
|
436
437
|
isAuthenticated,
|
|
@@ -716,7 +717,7 @@ const InnerDynamicContextProvider = (props) => {
|
|
|
716
717
|
id: `project-settings-${environmentId}`,
|
|
717
718
|
type: 'application/json',
|
|
718
719
|
});
|
|
719
|
-
return (jsx(I18nextProvider, { i18n: i18nSDKInstance, children: jsx(DynamicContext.Provider, { value: value, children: jsx(WalletBookContextProvider, { walletBook: walletBook, children: jsx(ThemeContextProvider, { customerTheme: parseTheme(theme, ((
|
|
720
|
+
return (jsx(I18nextProvider, { i18n: i18nSDKInstance, children: jsx(DynamicContext.Provider, { value: value, children: jsx(WalletBookContextProvider, { walletBook: walletBook, children: jsx(ThemeContextProvider, { customerTheme: parseTheme(theme, ((_q = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.design) === null || _q === void 0 ? void 0 : _q.modal) || undefined), designSettings: projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.design, children: jsx(LoadingContextProvider, { children: jsxs(ViewContextProvider, { initialViewType: getInitialViewType({
|
|
720
721
|
bridgeOnboardingCompleted,
|
|
721
722
|
connectedWallets,
|
|
722
723
|
isAuthenticated: isAuthenticated || Boolean(primaryWallet),
|
|
@@ -66,6 +66,16 @@ export type SettingsOverrides = {
|
|
|
66
66
|
* the SDK can react to this value changing (for ex, toggling a chain off).
|
|
67
67
|
*/
|
|
68
68
|
evmNetworks?: NetworksOverrides;
|
|
69
|
+
/**
|
|
70
|
+
* Allows overriding which sol networks the SDK has access to.
|
|
71
|
+
* If an array is provided, it is used instead of whatever is obtained from dashboard configs.
|
|
72
|
+
* If a callback is passed, the callback will be called with the values obtained from dashboard, and
|
|
73
|
+
* it must return the network values that will be used.
|
|
74
|
+
*
|
|
75
|
+
* WARNING: this callback must be memoized as it will be used in a dependency array to ensure
|
|
76
|
+
* the SDK can react to this value changing (for ex, toggling a chain off).
|
|
77
|
+
*/
|
|
78
|
+
solNetworks?: NetworksOverrides;
|
|
69
79
|
cosmosNetworks?: NetworksOverrides;
|
|
70
80
|
/**
|
|
71
81
|
* Allows overriding the multi-wallet feature from the dashboard.
|