@dynamic-labs/sdk-react-core 3.0.0-alpha.6 → 3.0.0-alpha.8
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 +44 -0
- package/package.cjs +1 -1
- package/package.js +1 -1
- package/package.json +10 -10
- package/src/index.cjs +9 -1
- package/src/index.d.ts +4 -1
- package/src/index.js +5 -1
- package/src/lib/Main.cjs +2 -0
- package/src/lib/Main.js +2 -0
- package/src/lib/context/DynamicContext/DynamicContext.cjs +15 -8
- package/src/lib/context/DynamicContext/DynamicContext.js +16 -9
- package/src/lib/context/DynamicContext/hooks/useTieCallbacksToEvents/useTieCallbacksToEvents.cjs +15 -6
- package/src/lib/context/DynamicContext/hooks/useTieCallbacksToEvents/useTieCallbacksToEvents.js +15 -6
- package/src/lib/context/DynamicContext/types/index.d.ts +4 -2
- package/src/lib/context/DynamicContext/useDynamicContext/useDynamicContext.cjs +3 -2
- package/src/lib/context/DynamicContext/useDynamicContext/useDynamicContext.d.ts +1 -1
- package/src/lib/context/DynamicContext/useDynamicContext/useDynamicContext.js +3 -2
- package/src/lib/context/ReinitializeContext/ReinitializeContextProvider.cjs +113 -0
- package/src/lib/context/ReinitializeContext/ReinitializeContextProvider.d.ts +22 -0
- package/src/lib/context/ReinitializeContext/ReinitializeContextProvider.js +107 -0
- package/src/lib/context/ReinitializeContext/index.d.ts +1 -0
- package/src/lib/context/WalletContext/WalletContext.cjs +1 -1
- package/src/lib/context/WalletContext/WalletContext.js +1 -1
- package/src/lib/context/WidgetRegistry/WidgetRegistryContextProvider.cjs +128 -0
- package/src/lib/context/WidgetRegistry/WidgetRegistryContextProvider.d.ts +6 -0
- package/src/lib/context/WidgetRegistry/WidgetRegistryContextProvider.js +122 -0
- package/src/lib/context/WidgetRegistry/index.d.ts +1 -0
- package/src/lib/data/api/wallets/wallets.cjs +2 -1
- package/src/lib/data/api/wallets/wallets.d.ts +2 -1
- package/src/lib/data/api/wallets/wallets.js +2 -1
- package/src/lib/events/dynamicEvents.d.ts +2 -1
- package/src/lib/events/multiWallet.d.ts +6 -0
- package/src/lib/store/index.d.ts +1 -1
- package/src/lib/store/store.cjs +6 -0
- package/src/lib/store/store.d.ts +1 -0
- package/src/lib/store/store.js +6 -1
- package/src/lib/styles/index.shadow.cjs +1 -1
- package/src/lib/styles/index.shadow.js +1 -1
- package/src/lib/utils/functions/index.d.ts +1 -0
- package/src/lib/utils/functions/logVerboseTroubleshootingMessage/index.d.ts +1 -0
- package/src/lib/utils/functions/logVerboseTroubleshootingMessage/logVerboseTroubleshootingMessage.cjs +28 -0
- package/src/lib/utils/functions/logVerboseTroubleshootingMessage/logVerboseTroubleshootingMessage.d.ts +1 -0
- package/src/lib/utils/functions/logVerboseTroubleshootingMessage/logVerboseTroubleshootingMessage.js +24 -0
- package/src/lib/utils/hooks/events/useDynamicEvents/useDynamicEvents.cjs +20 -0
- package/src/lib/utils/hooks/events/useDynamicEvents/useDynamicEvents.d.ts +2 -2
- package/src/lib/utils/hooks/events/useDynamicEvents/useDynamicEvents.js +20 -1
- package/src/lib/utils/hooks/index.d.ts +1 -0
- package/src/lib/utils/hooks/multiWallet/useVerifyOnAwaitingSignature/useVerifyOnAwaitingSignature.cjs +39 -13
- package/src/lib/utils/hooks/multiWallet/useVerifyOnAwaitingSignature/useVerifyOnAwaitingSignature.js +40 -14
- package/src/lib/utils/hooks/useHandleUnlinkWallet/useHandleUnlinkWallet.cjs +3 -1
- package/src/lib/utils/hooks/useHandleUnlinkWallet/useHandleUnlinkWallet.js +3 -1
- package/src/lib/utils/hooks/useMergeUserAccounts/useMergeUserAccounts.cjs +6 -2
- package/src/lib/utils/hooks/useMergeUserAccounts/useMergeUserAccounts.js +6 -2
- package/src/lib/utils/hooks/useRefreshUser/index.d.ts +1 -0
- package/src/lib/utils/hooks/useRefreshUser/useRefreshUser.cjs +90 -0
- package/src/lib/utils/hooks/useRefreshUser/useRefreshUser.d.ts +8 -0
- package/src/lib/utils/hooks/useRefreshUser/useRefreshUser.js +86 -0
- package/src/lib/utils/hooks/useSwitchNetwork/index.d.ts +1 -0
- package/src/lib/utils/hooks/useSwitchNetwork/useSwitchNetwork.cjs +26 -0
- package/src/lib/utils/hooks/useSwitchNetwork/useSwitchNetwork.d.ts +5 -0
- package/src/lib/utils/hooks/useSwitchNetwork/useSwitchNetwork.js +22 -0
- package/src/lib/utils/hooks/useWalletConnectors/useWalletConnectors.cjs +7 -6
- package/src/lib/utils/hooks/useWalletConnectors/useWalletConnectors.js +7 -6
- package/src/lib/utils/hooks/useWalletEventListeners/useWalletEventListeners.cjs +118 -25
- package/src/lib/utils/hooks/useWalletEventListeners/useWalletEventListeners.js +119 -26
- package/src/lib/utils/hooks/useWalletItemActions/useWalletItemActions.cjs +20 -1
- package/src/lib/utils/hooks/useWalletItemActions/useWalletItemActions.js +20 -1
- package/src/lib/views/MergeUserAccountsView/MergeUserAccountsView.cjs +4 -14
- package/src/lib/views/MergeUserAccountsView/MergeUserAccountsView.js +5 -15
- package/src/lib/views/TransactionConfirmationView/TransactionConfirmationView.cjs +3 -1
- package/src/lib/views/TransactionConfirmationView/TransactionConfirmationView.js +3 -1
- package/src/lib/views/WalletList/WalletList.cjs +1 -3
- package/src/lib/views/WalletList/WalletList.js +1 -3
- package/src/lib/views/WalletList/hooks/useTabState.cjs +6 -81
- package/src/lib/views/WalletList/hooks/useTabState.d.ts +6 -3
- package/src/lib/views/WalletList/hooks/useTabState.js +6 -81
- package/src/lib/widgets/DynamicMultiWalletPromptsWidget/DynamicMultiWalletPromptsWidget.cjs +5 -5
- package/src/lib/widgets/DynamicMultiWalletPromptsWidget/DynamicMultiWalletPromptsWidget.js +5 -5
- package/src/lib/widgets/DynamicWidget/components/DynamicUserProfile/DynamicUserProfile.cjs +4 -1
- package/src/lib/widgets/DynamicWidget/components/DynamicUserProfile/DynamicUserProfile.js +4 -1
- package/src/lib/widgets/DynamicWidget/prompts/PrimaryNotConnectedModal/PrimaryNotConnectedModal.cjs +1 -1
- package/src/lib/widgets/DynamicWidget/prompts/PrimaryNotConnectedModal/PrimaryNotConnectedModal.js +1 -1
- package/src/lib/views/WalletList/utils/getInitialTabIndex/getInitialTabIndex.cjs +0 -22
- package/src/lib/views/WalletList/utils/getInitialTabIndex/getInitialTabIndex.d.ts +0 -2
- package/src/lib/views/WalletList/utils/getInitialTabIndex/getInitialTabIndex.js +0 -18
- package/src/lib/views/WalletList/utils/getInitialTabIndex/index.d.ts +0 -1
|
@@ -5,7 +5,7 @@ import { isPhantomRedirectConnector } from '@dynamic-labs/wallet-connector-core'
|
|
|
5
5
|
import 'react';
|
|
6
6
|
import '../../../context/DynamicContext/DynamicContext.js';
|
|
7
7
|
import '@dynamic-labs/sdk-api-core';
|
|
8
|
-
import '../../../shared/logger.js';
|
|
8
|
+
import { logger } from '../../../shared/logger.js';
|
|
9
9
|
import '@dynamic-labs/iconic';
|
|
10
10
|
import 'react/jsx-runtime';
|
|
11
11
|
import { useViewContext } from '../../../context/ViewContext/ViewContext.js';
|
|
@@ -27,6 +27,7 @@ import '@dynamic-labs/multi-wallet';
|
|
|
27
27
|
import 'react-international-phone';
|
|
28
28
|
import { requiresTwoStepAuthentication } from '../../functions/requiresTwoStepAuthentication/requiresTwoStepAuthentication.js';
|
|
29
29
|
import '@dynamic-labs/store';
|
|
30
|
+
import { logVerboseTroubleshootingMessage } from '../../functions/logVerboseTroubleshootingMessage/logVerboseTroubleshootingMessage.js';
|
|
30
31
|
import '../../../locale/locale.js';
|
|
31
32
|
import '../../../context/CaptchaContext/CaptchaContext.js';
|
|
32
33
|
import { useConnectAndSignSplitSteps } from '../authenticationHooks/useConnectAndSignSplitSteps/useConnectAndSignSplitSteps.js';
|
|
@@ -86,7 +87,11 @@ const useWalletItemActions = () => {
|
|
|
86
87
|
const { onlyConnectUser } = useConnectAndSignSplitSteps();
|
|
87
88
|
const connectAndSignWallet = useConnectAndSign();
|
|
88
89
|
const handleCustodialWalletClick = (walletConnector) => __awaiter(void 0, void 0, void 0, function* () {
|
|
90
|
+
logger.debug('handleCustodialWalletClick', walletConnector);
|
|
89
91
|
const twoStepAuthentication = requiresTwoStepAuthentication(walletConnector);
|
|
92
|
+
logVerboseTroubleshootingMessage('[handleCustodialWalletClick]', {
|
|
93
|
+
twoStepAuthentication,
|
|
94
|
+
});
|
|
90
95
|
if (twoStepAuthentication) {
|
|
91
96
|
setSelectedWalletConnectorKey(walletConnector.key);
|
|
92
97
|
yield onlyConnectUser({
|
|
@@ -101,6 +106,7 @@ const useWalletItemActions = () => {
|
|
|
101
106
|
});
|
|
102
107
|
const handleMobileWalletClick = (walletConnector) => __awaiter(void 0, void 0, void 0, function* () {
|
|
103
108
|
var _a;
|
|
109
|
+
logger.debug('handleMobileWalletClick', walletConnector);
|
|
104
110
|
setSelectedWalletConnectorKey(walletConnector.key);
|
|
105
111
|
// We need to set to LS when about to verify phantom wallet on mobile
|
|
106
112
|
// because the deeplink interrupts this code execution and then redirects back on a new tab.
|
|
@@ -120,10 +126,12 @@ const useWalletItemActions = () => {
|
|
|
120
126
|
onlyConnectUser({ walletConnector });
|
|
121
127
|
});
|
|
122
128
|
const handleInstalledExtensionClick = (walletConnector) => __awaiter(void 0, void 0, void 0, function* () {
|
|
129
|
+
logger.debug('handleInstalledExtensionClick', walletConnector);
|
|
123
130
|
setSelectedWalletConnectorKey(walletConnector.key);
|
|
124
131
|
setMultiWalletWidgetState('awaiting_signature', undefined, 'linking_new_wallet');
|
|
125
132
|
});
|
|
126
133
|
const handleUninstalledClick = (walletConnector) => __awaiter(void 0, void 0, void 0, function* () {
|
|
134
|
+
logger.debug('handleUninstalledClick', walletConnector);
|
|
127
135
|
setSelectedWalletConnectorKey(walletConnector.key);
|
|
128
136
|
if (!walletConnector.canConnectViaQrCode) {
|
|
129
137
|
setView('no-qr-not-installed');
|
|
@@ -145,8 +153,14 @@ const useWalletItemActions = () => {
|
|
|
145
153
|
setError(undefined);
|
|
146
154
|
});
|
|
147
155
|
const handleAlreadyConnectedWallet = (walletConnector) => __awaiter(void 0, void 0, void 0, function* () {
|
|
156
|
+
logger.debug('handleAlreadyConnectedWallet', walletConnector);
|
|
148
157
|
const connectedAccounts = yield walletConnector.getConnectedAccounts();
|
|
149
158
|
const activeAccountAlreadyLinked = linkedWallets.find((wallet) => { var _a; return wallet.address.toLowerCase() === ((_a = connectedAccounts[0]) === null || _a === void 0 ? void 0 : _a.toLowerCase()); });
|
|
159
|
+
logVerboseTroubleshootingMessage('[handleAlreadyConnectedWallet]', {
|
|
160
|
+
activeAccountAlreadyLinked,
|
|
161
|
+
connectedAccounts,
|
|
162
|
+
linkedWallets,
|
|
163
|
+
});
|
|
150
164
|
if (activeAccountAlreadyLinked) {
|
|
151
165
|
setMultiWalletWidgetState('awaiting_account_switch', 'linking_new_wallet');
|
|
152
166
|
}
|
|
@@ -176,6 +190,11 @@ const useWalletItemActions = () => {
|
|
|
176
190
|
const { walletConnector, isInstalledOnBrowser } = wallet;
|
|
177
191
|
const shouldEndWalletConnectorSession = walletConnector.connectedChain === 'FLOW' ||
|
|
178
192
|
isPhantomRedirectConnector(walletConnector);
|
|
193
|
+
logVerboseTroubleshootingMessage('[handleWalletItemClick]', {
|
|
194
|
+
mockedSDK,
|
|
195
|
+
shouldEndWalletConnectorSession,
|
|
196
|
+
wallet,
|
|
197
|
+
});
|
|
179
198
|
if (mockedSDK)
|
|
180
199
|
return;
|
|
181
200
|
if (shouldEndWalletConnectorSession) {
|
|
@@ -7,23 +7,20 @@ var _tslib = require('../../../../_virtual/_tslib.cjs');
|
|
|
7
7
|
var jsxRuntime = require('react/jsx-runtime');
|
|
8
8
|
var React = require('react');
|
|
9
9
|
var reactI18next = require('react-i18next');
|
|
10
|
-
var walletBook = require('@dynamic-labs/wallet-book');
|
|
11
|
-
var iconic = require('@dynamic-labs/iconic');
|
|
12
10
|
require('../../events/dynamicEvents.cjs');
|
|
13
11
|
require('@dynamic-labs/utils');
|
|
14
12
|
require('../../context/DynamicContext/DynamicContext.cjs');
|
|
15
13
|
require('@dynamic-labs/sdk-api-core');
|
|
16
14
|
var logger = require('../../shared/logger.cjs');
|
|
15
|
+
require('@dynamic-labs/iconic');
|
|
17
16
|
require('@dynamic-labs/wallet-connector-core');
|
|
18
17
|
var ViewContext = require('../../context/ViewContext/ViewContext.cjs');
|
|
19
|
-
|
|
20
|
-
var shortenWalletAddress = require('../../shared/utils/functions/shortenWalletAddress/shortenWalletAddress.cjs');
|
|
18
|
+
require('@dynamic-labs/wallet-book');
|
|
21
19
|
require('../../utils/constants/colors.cjs');
|
|
22
20
|
require('../../utils/constants/values.cjs');
|
|
23
21
|
require('../../shared/utils/classes/storage/localStorage.cjs');
|
|
24
22
|
require('../../shared/utils/classes/storage/sessionStorage.cjs');
|
|
25
23
|
require('../../shared/consts/index.cjs');
|
|
26
|
-
var useInternalDynamicContext = require('../../context/DynamicContext/useDynamicContext/useInternalDynamicContext.cjs');
|
|
27
24
|
require('../../context/CaptchaContext/CaptchaContext.cjs');
|
|
28
25
|
require('../../context/ErrorContext/ErrorContext.cjs');
|
|
29
26
|
require('@dynamic-labs/multi-wallet');
|
|
@@ -83,12 +80,11 @@ require('../../widgets/DynamicWidget/views/ManagePasskeysWidgetView/PasskeyCard/
|
|
|
83
80
|
var useMergeUserAccounts = require('../../utils/hooks/useMergeUserAccounts/useMergeUserAccounts.cjs');
|
|
84
81
|
|
|
85
82
|
const MergeUserAccountsView = (props) => {
|
|
86
|
-
const { selectedWalletConnector } = useInternalDynamicContext.useInternalDynamicContext();
|
|
87
83
|
const { setView } = ViewContext.useViewContext();
|
|
88
84
|
const { mergeUserAccounts } = useMergeUserAccounts.useMergeUserAccounts();
|
|
89
85
|
const { t } = reactI18next.useTranslation();
|
|
90
86
|
const [error, setError] = React.useState('');
|
|
91
|
-
const { mergeConflicts
|
|
87
|
+
const { mergeConflicts } = props;
|
|
92
88
|
const goToConflictsResolutionView = () => {
|
|
93
89
|
// back button on conflicts resolution view should go back to this view
|
|
94
90
|
const onConflictsResolutionBackClick = () => {
|
|
@@ -112,13 +108,7 @@ const MergeUserAccountsView = (props) => {
|
|
|
112
108
|
setError(t('dyn_merge_user_accounts.errors.merge_error'));
|
|
113
109
|
}
|
|
114
110
|
});
|
|
115
|
-
|
|
116
|
-
if (walletAddress) {
|
|
117
|
-
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(walletBook.WalletIcon, { walletKey: selectedWalletConnector === null || selectedWalletConnector === void 0 ? void 0 : selectedWalletConnector.key, className: 'merge-user-accounts__accounts__item__icon' }), jsxRuntime.jsx(Typography.Typography, { variant: 'body_small', weight: 'bold', color: 'secondary', className: 'merge-user-accounts__accounts__item__text', children: shortenWalletAddress.shortenWalletAddress(walletAddress, 3, 3) })] }));
|
|
118
|
-
}
|
|
119
|
-
return (jsxRuntime.jsx(iconic.UserProfileIcon, { className: 'merge-user-accounts__accounts__item__icon' }));
|
|
120
|
-
};
|
|
121
|
-
return (jsxRuntime.jsxs("div", { className: 'merge-user-accounts', children: [error && (jsxRuntime.jsx(Alert.Alert, { icon: 'error', variant: 'error', className: 'merge-user-accounts__error', children: error })), jsxRuntime.jsxs("div", { className: 'merge-user-accounts__container', children: [jsxRuntime.jsx(Typography.Typography, { variant: 'body_normal', weight: 'regular', color: 'secondary', className: 'merge-user-accounts__title', copykey: 'dyn_merge_user_accounts.wallet.content', children: t('dyn_merge_user_accounts.wallet.content') }), jsxRuntime.jsxs("div", { className: 'merge-user-accounts__accounts', children: [jsxRuntime.jsx("div", { className: 'merge-user-accounts__accounts__item', children: renderDuplicatedInfo() }), jsxRuntime.jsxs("div", { className: 'merge-user-accounts__accounts__divider', children: [jsxRuntime.jsx("div", { className: 'merge-user-accounts__accounts__divider__dash' }), jsxRuntime.jsx("div", { className: 'merge-user-accounts__accounts__divider__icon', children: jsxRuntime.jsx(add.ReactComponent, {}) })] }), jsxRuntime.jsx("div", { className: 'merge-user-accounts__accounts__item', children: renderDuplicatedInfo() })] }), jsxRuntime.jsx(TypographyButton.TypographyButton, { onClick: handleMergeConfirm, buttonClassName: 'merge-user-accounts__button', buttonVariant: 'brand-primary', buttonPadding: 'large', typographyProps: {
|
|
111
|
+
return (jsxRuntime.jsxs("div", { className: 'merge-user-accounts', children: [error && (jsxRuntime.jsx(Alert.Alert, { icon: 'error', variant: 'error', className: 'merge-user-accounts__error', children: error })), jsxRuntime.jsxs("div", { className: 'merge-user-accounts__container', children: [jsxRuntime.jsx(Typography.Typography, { variant: 'body_normal', weight: 'regular', color: 'secondary', className: 'merge-user-accounts__title', copykey: 'dyn_merge_user_accounts.wallet.content', children: t('dyn_merge_user_accounts.wallet.content') }), jsxRuntime.jsx(TypographyButton.TypographyButton, { onClick: handleMergeConfirm, buttonClassName: 'merge-user-accounts__button', buttonVariant: 'brand-primary', buttonPadding: 'large', typographyProps: {
|
|
122
112
|
color: 'inherit',
|
|
123
113
|
}, expanded: true, copykey: 'dyn_merge_user_accounts.confirm_button', children: t('dyn_merge_user_accounts.confirm_button') })] })] }));
|
|
124
114
|
};
|
|
@@ -1,25 +1,22 @@
|
|
|
1
1
|
'use client'
|
|
2
2
|
import { __awaiter } from '../../../../_virtual/_tslib.js';
|
|
3
|
-
import { jsxs, jsx
|
|
3
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
4
4
|
import { useState } from 'react';
|
|
5
5
|
import { useTranslation } from 'react-i18next';
|
|
6
|
-
import { WalletIcon } from '@dynamic-labs/wallet-book';
|
|
7
|
-
import { UserProfileIcon } from '@dynamic-labs/iconic';
|
|
8
6
|
import '../../events/dynamicEvents.js';
|
|
9
7
|
import '@dynamic-labs/utils';
|
|
10
8
|
import '../../context/DynamicContext/DynamicContext.js';
|
|
11
9
|
import '@dynamic-labs/sdk-api-core';
|
|
12
10
|
import { logger } from '../../shared/logger.js';
|
|
11
|
+
import '@dynamic-labs/iconic';
|
|
13
12
|
import '@dynamic-labs/wallet-connector-core';
|
|
14
13
|
import { useViewContext } from '../../context/ViewContext/ViewContext.js';
|
|
15
|
-
import
|
|
16
|
-
import { shortenWalletAddress } from '../../shared/utils/functions/shortenWalletAddress/shortenWalletAddress.js';
|
|
14
|
+
import '@dynamic-labs/wallet-book';
|
|
17
15
|
import '../../utils/constants/colors.js';
|
|
18
16
|
import '../../utils/constants/values.js';
|
|
19
17
|
import '../../shared/utils/classes/storage/localStorage.js';
|
|
20
18
|
import '../../shared/utils/classes/storage/sessionStorage.js';
|
|
21
19
|
import '../../shared/consts/index.js';
|
|
22
|
-
import { useInternalDynamicContext } from '../../context/DynamicContext/useDynamicContext/useInternalDynamicContext.js';
|
|
23
20
|
import '../../context/CaptchaContext/CaptchaContext.js';
|
|
24
21
|
import '../../context/ErrorContext/ErrorContext.js';
|
|
25
22
|
import '@dynamic-labs/multi-wallet';
|
|
@@ -79,12 +76,11 @@ import '../../widgets/DynamicWidget/views/ManagePasskeysWidgetView/PasskeyCard/P
|
|
|
79
76
|
import { useMergeUserAccounts } from '../../utils/hooks/useMergeUserAccounts/useMergeUserAccounts.js';
|
|
80
77
|
|
|
81
78
|
const MergeUserAccountsView = (props) => {
|
|
82
|
-
const { selectedWalletConnector } = useInternalDynamicContext();
|
|
83
79
|
const { setView } = useViewContext();
|
|
84
80
|
const { mergeUserAccounts } = useMergeUserAccounts();
|
|
85
81
|
const { t } = useTranslation();
|
|
86
82
|
const [error, setError] = useState('');
|
|
87
|
-
const { mergeConflicts
|
|
83
|
+
const { mergeConflicts } = props;
|
|
88
84
|
const goToConflictsResolutionView = () => {
|
|
89
85
|
// back button on conflicts resolution view should go back to this view
|
|
90
86
|
const onConflictsResolutionBackClick = () => {
|
|
@@ -108,13 +104,7 @@ const MergeUserAccountsView = (props) => {
|
|
|
108
104
|
setError(t('dyn_merge_user_accounts.errors.merge_error'));
|
|
109
105
|
}
|
|
110
106
|
});
|
|
111
|
-
|
|
112
|
-
if (walletAddress) {
|
|
113
|
-
return (jsxs(Fragment, { children: [jsx(WalletIcon, { walletKey: selectedWalletConnector === null || selectedWalletConnector === void 0 ? void 0 : selectedWalletConnector.key, className: 'merge-user-accounts__accounts__item__icon' }), jsx(Typography, { variant: 'body_small', weight: 'bold', color: 'secondary', className: 'merge-user-accounts__accounts__item__text', children: shortenWalletAddress(walletAddress, 3, 3) })] }));
|
|
114
|
-
}
|
|
115
|
-
return (jsx(UserProfileIcon, { className: 'merge-user-accounts__accounts__item__icon' }));
|
|
116
|
-
};
|
|
117
|
-
return (jsxs("div", { className: 'merge-user-accounts', children: [error && (jsx(Alert, { icon: 'error', variant: 'error', className: 'merge-user-accounts__error', children: error })), jsxs("div", { className: 'merge-user-accounts__container', children: [jsx(Typography, { variant: 'body_normal', weight: 'regular', color: 'secondary', className: 'merge-user-accounts__title', copykey: 'dyn_merge_user_accounts.wallet.content', children: t('dyn_merge_user_accounts.wallet.content') }), jsxs("div", { className: 'merge-user-accounts__accounts', children: [jsx("div", { className: 'merge-user-accounts__accounts__item', children: renderDuplicatedInfo() }), jsxs("div", { className: 'merge-user-accounts__accounts__divider', children: [jsx("div", { className: 'merge-user-accounts__accounts__divider__dash' }), jsx("div", { className: 'merge-user-accounts__accounts__divider__icon', children: jsx(SvgAdd, {}) })] }), jsx("div", { className: 'merge-user-accounts__accounts__item', children: renderDuplicatedInfo() })] }), jsx(TypographyButton, { onClick: handleMergeConfirm, buttonClassName: 'merge-user-accounts__button', buttonVariant: 'brand-primary', buttonPadding: 'large', typographyProps: {
|
|
107
|
+
return (jsxs("div", { className: 'merge-user-accounts', children: [error && (jsx(Alert, { icon: 'error', variant: 'error', className: 'merge-user-accounts__error', children: error })), jsxs("div", { className: 'merge-user-accounts__container', children: [jsx(Typography, { variant: 'body_normal', weight: 'regular', color: 'secondary', className: 'merge-user-accounts__title', copykey: 'dyn_merge_user_accounts.wallet.content', children: t('dyn_merge_user_accounts.wallet.content') }), jsx(TypographyButton, { onClick: handleMergeConfirm, buttonClassName: 'merge-user-accounts__button', buttonVariant: 'brand-primary', buttonPadding: 'large', typographyProps: {
|
|
118
108
|
color: 'inherit',
|
|
119
109
|
}, expanded: true, copykey: 'dyn_merge_user_accounts.confirm_button', children: t('dyn_merge_user_accounts.confirm_button') })] })] }));
|
|
120
110
|
};
|
|
@@ -104,6 +104,8 @@ const TransactionConfirmationView = ({ transaction, onError, onSuccess, mutation
|
|
|
104
104
|
* to reflect the new fee on the UI
|
|
105
105
|
*/
|
|
106
106
|
const fetchTransactionFee = () => {
|
|
107
|
+
if (chainName === 'Solana' && transaction.fee)
|
|
108
|
+
return;
|
|
107
109
|
transaction.fetchFee().finally(update);
|
|
108
110
|
};
|
|
109
111
|
const { isLoading: isGasSponsoredLoading } = usePromise.usePromise(() => {
|
|
@@ -135,7 +137,7 @@ const TransactionConfirmationView = ({ transaction, onError, onSuccess, mutation
|
|
|
135
137
|
},
|
|
136
138
|
onSuccess: (tx) => onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess(tx),
|
|
137
139
|
});
|
|
138
|
-
// Refresh transaction fee
|
|
140
|
+
// Refresh transaction fee, Solana fees are static based on transaction data, dont need to refresh them
|
|
139
141
|
useInterval.useInterval(fetchTransactionFee, isLoading ? null : FEE_REFRESH_INTERVAL);
|
|
140
142
|
useEffectOnce.useEffectOnce(fetchTransactionFee);
|
|
141
143
|
const total = useTransactionTotal.useTransactionTotal({
|
|
@@ -100,6 +100,8 @@ const TransactionConfirmationView = ({ transaction, onError, onSuccess, mutation
|
|
|
100
100
|
* to reflect the new fee on the UI
|
|
101
101
|
*/
|
|
102
102
|
const fetchTransactionFee = () => {
|
|
103
|
+
if (chainName === 'Solana' && transaction.fee)
|
|
104
|
+
return;
|
|
103
105
|
transaction.fetchFee().finally(update);
|
|
104
106
|
};
|
|
105
107
|
const { isLoading: isGasSponsoredLoading } = usePromise(() => {
|
|
@@ -131,7 +133,7 @@ const TransactionConfirmationView = ({ transaction, onError, onSuccess, mutation
|
|
|
131
133
|
},
|
|
132
134
|
onSuccess: (tx) => onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess(tx),
|
|
133
135
|
});
|
|
134
|
-
// Refresh transaction fee
|
|
136
|
+
// Refresh transaction fee, Solana fees are static based on transaction data, dont need to refresh them
|
|
135
137
|
useInterval(fetchTransactionFee, isLoading ? null : FEE_REFRESH_INTERVAL);
|
|
136
138
|
useEffectOnce(fetchTransactionFee);
|
|
137
139
|
const total = useTransactionTotal({
|
|
@@ -88,16 +88,14 @@ var useInternalDynamicContext = require('../../context/DynamicContext/useDynamic
|
|
|
88
88
|
var index = require('../../utils/functions/walletFilters/index.cjs');
|
|
89
89
|
var SearchNotFoundMessage = require('./SearchNotFoundMessage/SearchNotFoundMessage.cjs');
|
|
90
90
|
var WalletListGridTabs = require('./WalletListGridTabs/WalletListGridTabs.cjs');
|
|
91
|
-
var useTabState = require('./hooks/useTabState.cjs');
|
|
92
91
|
var getEffectiveWalletFilter = require('./utils/getEffectiveWalletFilter.cjs');
|
|
93
92
|
var getEffectiveRecommendedWallets = require('./utils/getEffectiveRecommendedWallets.cjs');
|
|
94
93
|
|
|
95
94
|
localStorage.LocalStorage.setToLS(localStorage$1.WALLET_PICKER_SEARCH_KEY, '');
|
|
96
95
|
const WalletList = ({ isWalletConnectList = false, }) => {
|
|
97
96
|
var _a;
|
|
98
|
-
const { walletsFilter, signWithEmailWalletName, walletConnectorOptions, projectSettings, defaultNumberOfWalletsToShow, bridgeChainsToConnect, authMode, multiWallet, recommendedWallets, } = useInternalDynamicContext.useInternalDynamicContext();
|
|
97
|
+
const { walletsFilter, signWithEmailWalletName, walletConnectorOptions, projectSettings, defaultNumberOfWalletsToShow, bridgeChainsToConnect, authMode, multiWallet, recommendedWallets, selectedTabIndex, setSelectedTabIndex, selectedTabSettings, tabsItems, } = useInternalDynamicContext.useInternalDynamicContext();
|
|
99
98
|
const userWallets = UserWalletsContext.useUserWallets();
|
|
100
|
-
const { selectedTabIndex, setSelectedTabIndex, selectedTabSettings, tabsItems, } = useTabState.useTabState();
|
|
101
99
|
const { walletBook: walletBook$1 } = walletBook.useWalletBookContext();
|
|
102
100
|
const { error } = ErrorContext.useErrorContext();
|
|
103
101
|
const { showDefaultFooter } = useAuthLayoutChecks.useAuthLayoutChecks();
|
|
@@ -84,16 +84,14 @@ import { useInternalDynamicContext } from '../../context/DynamicContext/useDynam
|
|
|
84
84
|
import { FilterBridgeChainsName } from '../../utils/functions/walletFilters/index.js';
|
|
85
85
|
import { SearchNotFoundMessage } from './SearchNotFoundMessage/SearchNotFoundMessage.js';
|
|
86
86
|
import { WalletListGridTabs } from './WalletListGridTabs/WalletListGridTabs.js';
|
|
87
|
-
import { useTabState } from './hooks/useTabState.js';
|
|
88
87
|
import { getEffectiveWalletFilter } from './utils/getEffectiveWalletFilter.js';
|
|
89
88
|
import { getEffectiveRecommendedWallets } from './utils/getEffectiveRecommendedWallets.js';
|
|
90
89
|
|
|
91
90
|
LocalStorage.setToLS(WALLET_PICKER_SEARCH_KEY, '');
|
|
92
91
|
const WalletList = ({ isWalletConnectList = false, }) => {
|
|
93
92
|
var _a;
|
|
94
|
-
const { walletsFilter, signWithEmailWalletName, walletConnectorOptions, projectSettings, defaultNumberOfWalletsToShow, bridgeChainsToConnect, authMode, multiWallet, recommendedWallets, } = useInternalDynamicContext();
|
|
93
|
+
const { walletsFilter, signWithEmailWalletName, walletConnectorOptions, projectSettings, defaultNumberOfWalletsToShow, bridgeChainsToConnect, authMode, multiWallet, recommendedWallets, selectedTabIndex, setSelectedTabIndex, selectedTabSettings, tabsItems, } = useInternalDynamicContext();
|
|
95
94
|
const userWallets = useUserWallets();
|
|
96
|
-
const { selectedTabIndex, setSelectedTabIndex, selectedTabSettings, tabsItems, } = useTabState();
|
|
97
95
|
const { walletBook } = useWalletBookContext();
|
|
98
96
|
const { error } = useErrorContext();
|
|
99
97
|
const { showDefaultFooter } = useAuthLayoutChecks();
|
|
@@ -4,94 +4,19 @@
|
|
|
4
4
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
5
|
|
|
6
6
|
var React = require('react');
|
|
7
|
-
require('../../../events/dynamicEvents.cjs');
|
|
8
|
-
require('../../../../../_virtual/_tslib.cjs');
|
|
9
|
-
require('@dynamic-labs/utils');
|
|
10
|
-
require('../../../context/DynamicContext/DynamicContext.cjs');
|
|
11
|
-
require('@dynamic-labs/sdk-api-core');
|
|
12
|
-
require('../../../shared/logger.cjs');
|
|
13
|
-
require('@dynamic-labs/iconic');
|
|
14
|
-
require('@dynamic-labs/wallet-connector-core');
|
|
15
|
-
require('react/jsx-runtime');
|
|
16
|
-
require('../../../context/ViewContext/ViewContext.cjs');
|
|
17
|
-
require('@dynamic-labs/wallet-book');
|
|
18
|
-
require('../../../utils/constants/colors.cjs');
|
|
19
|
-
require('../../../utils/constants/values.cjs');
|
|
20
|
-
require('../../../shared/utils/classes/storage/localStorage.cjs');
|
|
21
|
-
require('../../../shared/utils/classes/storage/sessionStorage.cjs');
|
|
22
|
-
require('../../../shared/consts/index.cjs');
|
|
23
|
-
var useInternalDynamicContext = require('../../../context/DynamicContext/useDynamicContext/useInternalDynamicContext.cjs');
|
|
24
|
-
require('../../../context/CaptchaContext/CaptchaContext.cjs');
|
|
25
|
-
require('../../../context/ErrorContext/ErrorContext.cjs');
|
|
26
|
-
require('@dynamic-labs/multi-wallet');
|
|
27
|
-
require('react-international-phone');
|
|
28
|
-
require('../../../config/ApiEndpoint.cjs');
|
|
29
|
-
require('@dynamic-labs/store');
|
|
30
|
-
require('../../../locale/locale.cjs');
|
|
31
|
-
require('../../../context/AccessDeniedContext/AccessDeniedContext.cjs');
|
|
32
|
-
require('../../../context/AccountExistsContext/AccountExistsContext.cjs');
|
|
33
|
-
require('../../../context/UserWalletsContext/UserWalletsContext.cjs');
|
|
34
|
-
require('../../../context/VerificationContext/VerificationContext.cjs');
|
|
35
|
-
require('react-dom');
|
|
36
|
-
require('../../../context/WalletContext/WalletContext.cjs');
|
|
37
|
-
require('../../../context/ThemeContext/ThemeContext.cjs');
|
|
38
|
-
require('../../../utils/hooks/useUserUpdateRequest/useUpdateUser/userFieldsSchema.cjs');
|
|
39
|
-
require('@dynamic-labs/types');
|
|
40
|
-
require('../../../context/LoadingContext/LoadingContext.cjs');
|
|
41
|
-
require('yup');
|
|
42
|
-
require('../../../context/MockContext/MockContext.cjs');
|
|
43
|
-
require('../../CollectUserDataView/useFields.cjs');
|
|
44
|
-
require('../../../context/FieldsStateContext/FieldsStateContext.cjs');
|
|
45
|
-
require('../../../context/UserFieldEditorContext/UserFieldEditorContext.cjs');
|
|
46
|
-
require('@dynamic-labs/rpc-providers');
|
|
47
|
-
require('react-i18next');
|
|
48
|
-
require('../../../components/Accordion/components/AccordionItem/AccordionItem.cjs');
|
|
49
|
-
require('../../../components/Alert/Alert.cjs');
|
|
50
|
-
require('../../../components/ShadowDOM/ShadowDOM.cjs');
|
|
51
|
-
require('../../../components/IconButton/IconButton.cjs');
|
|
52
|
-
require('../../../components/InlineWidget/InlineWidget.cjs');
|
|
53
|
-
require('../../../components/Input/Input.cjs');
|
|
54
|
-
require('../../../components/IsBrowser/IsBrowser.cjs');
|
|
55
|
-
require('../../../components/MenuList/Dropdown/Dropdown.cjs');
|
|
56
|
-
require('../../../components/Transition/ZoomTransition/ZoomTransition.cjs');
|
|
57
|
-
require('../../../components/Transition/SlideInUpTransition/SlideInUpTransition.cjs');
|
|
58
|
-
require('../../../components/Transition/OpacityTransition/OpacityTransition.cjs');
|
|
59
|
-
require('../../../components/OverlayCard/OverlayCardTarget/OverlayCardTarget.cjs');
|
|
60
|
-
require('../../../components/PasskeyCreatedSuccessBanner/PasskeyCreatedSuccessBanner.cjs');
|
|
61
|
-
require('../../../components/Popper/Popper/Popper.cjs');
|
|
62
|
-
require('../../../components/Popper/PopperContext/PopperContext.cjs');
|
|
63
|
-
require('react-focus-lock');
|
|
64
|
-
require('qrcode');
|
|
65
|
-
require('formik');
|
|
66
|
-
require('../WalletList.cjs');
|
|
67
|
-
require('../../../context/SocialRedirectContext/SocialRedirectContext.cjs');
|
|
68
|
-
require('../../../widgets/DynamicBridgeWidget/views/WalletsView/components/SecondaryWallets/SecondaryWallets.cjs');
|
|
69
|
-
require('@hcaptcha/react-hcaptcha');
|
|
70
|
-
require('../../../context/FooterAnimationContext/index.cjs');
|
|
71
|
-
require('../../../context/WalletGroupContext/WalletGroupContext.cjs');
|
|
72
|
-
require('../../../context/MfaSettingsContext/MfaSettingsContext.cjs');
|
|
73
|
-
require('../../../context/IpConfigurationContext/IpConfigurationContext.cjs');
|
|
74
|
-
require('../../../context/PasskeyContext/PasskeyContext.cjs');
|
|
75
|
-
require('../../../widgets/DynamicWidget/components/DynamicWidgetHeader/DynamicWidgetHeader.cjs');
|
|
76
|
-
require('../../../widgets/DynamicWidget/context/DynamicWidgetContext.cjs');
|
|
77
|
-
require('../../TransactionConfirmationView/helpers/transactionErrorMessage.cjs');
|
|
78
|
-
require('../../../widgets/DynamicWidget/views/ManagePasskeysWidgetView/PasskeyCard/PasskeyCard.cjs');
|
|
79
|
-
var useViewSettings = require('../../../utils/hooks/useViewSettings/useViewSettings.cjs');
|
|
80
|
-
var getInitialTabIndex = require('../utils/getInitialTabIndex/getInitialTabIndex.cjs');
|
|
81
7
|
|
|
82
|
-
const useTabState = () => {
|
|
83
|
-
var _a, _b;
|
|
84
|
-
const
|
|
85
|
-
const
|
|
86
|
-
const [selectedTabIndex, setSelectedTabIndex] = React.useState(() => getInitialTabIndex.getInitialTabIndex(walletListViewSettings, defaultTabIndex));
|
|
8
|
+
const useTabState = ({ settingsOverrides, }) => {
|
|
9
|
+
var _a, _b, _c;
|
|
10
|
+
const walletListViewSettings = (_a = settingsOverrides === null || settingsOverrides === void 0 ? void 0 : settingsOverrides.views) === null || _a === void 0 ? void 0 : _a.find((view) => view.type === 'wallet-list');
|
|
11
|
+
const [selectedTabIndex, setSelectedTabIndex] = React.useState(0);
|
|
87
12
|
const selectedTabSettings = selectedTabIndex === null
|
|
88
13
|
? undefined
|
|
89
|
-
: (
|
|
14
|
+
: (_b = walletListViewSettings === null || walletListViewSettings === void 0 ? void 0 : walletListViewSettings.tabs) === null || _b === void 0 ? void 0 : _b.items[selectedTabIndex];
|
|
90
15
|
return {
|
|
91
16
|
selectedTabIndex,
|
|
92
17
|
selectedTabSettings,
|
|
93
18
|
setSelectedTabIndex,
|
|
94
|
-
tabsItems: (
|
|
19
|
+
tabsItems: (_c = walletListViewSettings === null || walletListViewSettings === void 0 ? void 0 : walletListViewSettings.tabs) === null || _c === void 0 ? void 0 : _c.items,
|
|
95
20
|
};
|
|
96
21
|
};
|
|
97
22
|
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
import { SettingsOverrides } from '../../../context/DynamicContext/types';
|
|
3
|
+
export declare const useTabState: ({ settingsOverrides, }: {
|
|
4
|
+
settingsOverrides: SettingsOverrides | undefined;
|
|
5
|
+
}) => {
|
|
6
|
+
selectedTabIndex: number;
|
|
4
7
|
selectedTabSettings: import("../../../context/DynamicContext/types").WalletListViewTabItem | undefined;
|
|
5
|
-
setSelectedTabIndex: import("react").Dispatch<import("react").SetStateAction<number
|
|
8
|
+
setSelectedTabIndex: import("react").Dispatch<import("react").SetStateAction<number>>;
|
|
6
9
|
tabsItems: import("../../../context/DynamicContext/types").WalletListViewTabItem[] | undefined;
|
|
7
10
|
};
|
|
@@ -1,93 +1,18 @@
|
|
|
1
1
|
'use client'
|
|
2
2
|
import { useState } from 'react';
|
|
3
|
-
import '../../../events/dynamicEvents.js';
|
|
4
|
-
import '../../../../../_virtual/_tslib.js';
|
|
5
|
-
import '@dynamic-labs/utils';
|
|
6
|
-
import '../../../context/DynamicContext/DynamicContext.js';
|
|
7
|
-
import '@dynamic-labs/sdk-api-core';
|
|
8
|
-
import '../../../shared/logger.js';
|
|
9
|
-
import '@dynamic-labs/iconic';
|
|
10
|
-
import '@dynamic-labs/wallet-connector-core';
|
|
11
|
-
import 'react/jsx-runtime';
|
|
12
|
-
import '../../../context/ViewContext/ViewContext.js';
|
|
13
|
-
import '@dynamic-labs/wallet-book';
|
|
14
|
-
import '../../../utils/constants/colors.js';
|
|
15
|
-
import '../../../utils/constants/values.js';
|
|
16
|
-
import '../../../shared/utils/classes/storage/localStorage.js';
|
|
17
|
-
import '../../../shared/utils/classes/storage/sessionStorage.js';
|
|
18
|
-
import '../../../shared/consts/index.js';
|
|
19
|
-
import { useInternalDynamicContext } from '../../../context/DynamicContext/useDynamicContext/useInternalDynamicContext.js';
|
|
20
|
-
import '../../../context/CaptchaContext/CaptchaContext.js';
|
|
21
|
-
import '../../../context/ErrorContext/ErrorContext.js';
|
|
22
|
-
import '@dynamic-labs/multi-wallet';
|
|
23
|
-
import 'react-international-phone';
|
|
24
|
-
import '../../../config/ApiEndpoint.js';
|
|
25
|
-
import '@dynamic-labs/store';
|
|
26
|
-
import '../../../locale/locale.js';
|
|
27
|
-
import '../../../context/AccessDeniedContext/AccessDeniedContext.js';
|
|
28
|
-
import '../../../context/AccountExistsContext/AccountExistsContext.js';
|
|
29
|
-
import '../../../context/UserWalletsContext/UserWalletsContext.js';
|
|
30
|
-
import '../../../context/VerificationContext/VerificationContext.js';
|
|
31
|
-
import 'react-dom';
|
|
32
|
-
import '../../../context/WalletContext/WalletContext.js';
|
|
33
|
-
import '../../../context/ThemeContext/ThemeContext.js';
|
|
34
|
-
import '../../../utils/hooks/useUserUpdateRequest/useUpdateUser/userFieldsSchema.js';
|
|
35
|
-
import '@dynamic-labs/types';
|
|
36
|
-
import '../../../context/LoadingContext/LoadingContext.js';
|
|
37
|
-
import 'yup';
|
|
38
|
-
import '../../../context/MockContext/MockContext.js';
|
|
39
|
-
import '../../CollectUserDataView/useFields.js';
|
|
40
|
-
import '../../../context/FieldsStateContext/FieldsStateContext.js';
|
|
41
|
-
import '../../../context/UserFieldEditorContext/UserFieldEditorContext.js';
|
|
42
|
-
import '@dynamic-labs/rpc-providers';
|
|
43
|
-
import 'react-i18next';
|
|
44
|
-
import '../../../components/Accordion/components/AccordionItem/AccordionItem.js';
|
|
45
|
-
import '../../../components/Alert/Alert.js';
|
|
46
|
-
import '../../../components/ShadowDOM/ShadowDOM.js';
|
|
47
|
-
import '../../../components/IconButton/IconButton.js';
|
|
48
|
-
import '../../../components/InlineWidget/InlineWidget.js';
|
|
49
|
-
import '../../../components/Input/Input.js';
|
|
50
|
-
import '../../../components/IsBrowser/IsBrowser.js';
|
|
51
|
-
import '../../../components/MenuList/Dropdown/Dropdown.js';
|
|
52
|
-
import '../../../components/Transition/ZoomTransition/ZoomTransition.js';
|
|
53
|
-
import '../../../components/Transition/SlideInUpTransition/SlideInUpTransition.js';
|
|
54
|
-
import '../../../components/Transition/OpacityTransition/OpacityTransition.js';
|
|
55
|
-
import '../../../components/OverlayCard/OverlayCardTarget/OverlayCardTarget.js';
|
|
56
|
-
import '../../../components/PasskeyCreatedSuccessBanner/PasskeyCreatedSuccessBanner.js';
|
|
57
|
-
import '../../../components/Popper/Popper/Popper.js';
|
|
58
|
-
import '../../../components/Popper/PopperContext/PopperContext.js';
|
|
59
|
-
import 'react-focus-lock';
|
|
60
|
-
import 'qrcode';
|
|
61
|
-
import 'formik';
|
|
62
|
-
import '../WalletList.js';
|
|
63
|
-
import '../../../context/SocialRedirectContext/SocialRedirectContext.js';
|
|
64
|
-
import '../../../widgets/DynamicBridgeWidget/views/WalletsView/components/SecondaryWallets/SecondaryWallets.js';
|
|
65
|
-
import '@hcaptcha/react-hcaptcha';
|
|
66
|
-
import '../../../context/FooterAnimationContext/index.js';
|
|
67
|
-
import '../../../context/WalletGroupContext/WalletGroupContext.js';
|
|
68
|
-
import '../../../context/MfaSettingsContext/MfaSettingsContext.js';
|
|
69
|
-
import '../../../context/IpConfigurationContext/IpConfigurationContext.js';
|
|
70
|
-
import '../../../context/PasskeyContext/PasskeyContext.js';
|
|
71
|
-
import '../../../widgets/DynamicWidget/components/DynamicWidgetHeader/DynamicWidgetHeader.js';
|
|
72
|
-
import '../../../widgets/DynamicWidget/context/DynamicWidgetContext.js';
|
|
73
|
-
import '../../TransactionConfirmationView/helpers/transactionErrorMessage.js';
|
|
74
|
-
import '../../../widgets/DynamicWidget/views/ManagePasskeysWidgetView/PasskeyCard/PasskeyCard.js';
|
|
75
|
-
import { useViewSettings } from '../../../utils/hooks/useViewSettings/useViewSettings.js';
|
|
76
|
-
import { getInitialTabIndex } from '../utils/getInitialTabIndex/getInitialTabIndex.js';
|
|
77
3
|
|
|
78
|
-
const useTabState = () => {
|
|
79
|
-
var _a, _b;
|
|
80
|
-
const
|
|
81
|
-
const
|
|
82
|
-
const [selectedTabIndex, setSelectedTabIndex] = useState(() => getInitialTabIndex(walletListViewSettings, defaultTabIndex));
|
|
4
|
+
const useTabState = ({ settingsOverrides, }) => {
|
|
5
|
+
var _a, _b, _c;
|
|
6
|
+
const walletListViewSettings = (_a = settingsOverrides === null || settingsOverrides === void 0 ? void 0 : settingsOverrides.views) === null || _a === void 0 ? void 0 : _a.find((view) => view.type === 'wallet-list');
|
|
7
|
+
const [selectedTabIndex, setSelectedTabIndex] = useState(0);
|
|
83
8
|
const selectedTabSettings = selectedTabIndex === null
|
|
84
9
|
? undefined
|
|
85
|
-
: (
|
|
10
|
+
: (_b = walletListViewSettings === null || walletListViewSettings === void 0 ? void 0 : walletListViewSettings.tabs) === null || _b === void 0 ? void 0 : _b.items[selectedTabIndex];
|
|
86
11
|
return {
|
|
87
12
|
selectedTabIndex,
|
|
88
13
|
selectedTabSettings,
|
|
89
14
|
setSelectedTabIndex,
|
|
90
|
-
tabsItems: (
|
|
15
|
+
tabsItems: (_c = walletListViewSettings === null || walletListViewSettings === void 0 ? void 0 : walletListViewSettings.tabs) === null || _c === void 0 ? void 0 : _c.items,
|
|
91
16
|
};
|
|
92
17
|
};
|
|
93
18
|
|
|
@@ -22,7 +22,7 @@ require('@dynamic-labs/sdk-api-core');
|
|
|
22
22
|
require('../../shared/logger.cjs');
|
|
23
23
|
require('@dynamic-labs/iconic');
|
|
24
24
|
require('@dynamic-labs/wallet-connector-core');
|
|
25
|
-
|
|
25
|
+
require('../../context/ViewContext/ViewContext.cjs');
|
|
26
26
|
require('@dynamic-labs/wallet-book');
|
|
27
27
|
require('../../utils/constants/colors.cjs');
|
|
28
28
|
require('../../utils/constants/values.cjs');
|
|
@@ -86,13 +86,13 @@ require('../DynamicWidget/components/DynamicWidgetHeader/DynamicWidgetHeader.cjs
|
|
|
86
86
|
require('../DynamicWidget/context/DynamicWidgetContext.cjs');
|
|
87
87
|
require('../../views/TransactionConfirmationView/helpers/transactionErrorMessage.cjs');
|
|
88
88
|
require('../DynamicWidget/views/ManagePasskeysWidgetView/PasskeyCard/PasskeyCard.cjs');
|
|
89
|
+
var WidgetRegistryContextProvider = require('../../context/WidgetRegistry/WidgetRegistryContextProvider.cjs');
|
|
89
90
|
|
|
90
|
-
const pendingSignModalView = ['pending-signature', 'wallet-sign'];
|
|
91
91
|
const DynamicMultiWalletPromptsWidget = () => {
|
|
92
92
|
const isLoggedIn = useIsLoggedIn.useIsLoggedIn();
|
|
93
|
-
const
|
|
94
|
-
const {
|
|
95
|
-
const isRenderingSignMessageInLinkWalletModal = showAuthFlow &&
|
|
93
|
+
const isUserProfilePresent = WidgetRegistryContextProvider.useWidgetRegistryCheck('user-profile');
|
|
94
|
+
const { showAuthFlow, showDynamicUserProfile } = useInternalDynamicContext.useInternalDynamicContext();
|
|
95
|
+
const isRenderingSignMessageInLinkWalletModal = showAuthFlow || (showDynamicUserProfile && isUserProfilePresent);
|
|
96
96
|
const multiWalletPromptState = useMultiWalletPromptState.useMultiWalletPromptState();
|
|
97
97
|
const mapMultiWalletPromptStateToModalComponent = {
|
|
98
98
|
awaiting_connection: AwaitingConnectionModal.AwaitingConnectionModal,
|
|
@@ -18,7 +18,7 @@ import '@dynamic-labs/sdk-api-core';
|
|
|
18
18
|
import '../../shared/logger.js';
|
|
19
19
|
import '@dynamic-labs/iconic';
|
|
20
20
|
import '@dynamic-labs/wallet-connector-core';
|
|
21
|
-
import
|
|
21
|
+
import '../../context/ViewContext/ViewContext.js';
|
|
22
22
|
import '@dynamic-labs/wallet-book';
|
|
23
23
|
import '../../utils/constants/colors.js';
|
|
24
24
|
import '../../utils/constants/values.js';
|
|
@@ -82,13 +82,13 @@ import '../DynamicWidget/components/DynamicWidgetHeader/DynamicWidgetHeader.js';
|
|
|
82
82
|
import '../DynamicWidget/context/DynamicWidgetContext.js';
|
|
83
83
|
import '../../views/TransactionConfirmationView/helpers/transactionErrorMessage.js';
|
|
84
84
|
import '../DynamicWidget/views/ManagePasskeysWidgetView/PasskeyCard/PasskeyCard.js';
|
|
85
|
+
import { useWidgetRegistryCheck } from '../../context/WidgetRegistry/WidgetRegistryContextProvider.js';
|
|
85
86
|
|
|
86
|
-
const pendingSignModalView = ['pending-signature', 'wallet-sign'];
|
|
87
87
|
const DynamicMultiWalletPromptsWidget = () => {
|
|
88
88
|
const isLoggedIn = useIsLoggedIn();
|
|
89
|
-
const
|
|
90
|
-
const {
|
|
91
|
-
const isRenderingSignMessageInLinkWalletModal = showAuthFlow &&
|
|
89
|
+
const isUserProfilePresent = useWidgetRegistryCheck('user-profile');
|
|
90
|
+
const { showAuthFlow, showDynamicUserProfile } = useInternalDynamicContext();
|
|
91
|
+
const isRenderingSignMessageInLinkWalletModal = showAuthFlow || (showDynamicUserProfile && isUserProfilePresent);
|
|
92
92
|
const multiWalletPromptState = useMultiWalletPromptState();
|
|
93
93
|
const mapMultiWalletPromptStateToModalComponent = {
|
|
94
94
|
awaiting_connection: AwaitingConnectionModal,
|
|
@@ -79,6 +79,7 @@ var SandboxIndicatorWrapper = require('../../../../components/SandboxIndicatorWr
|
|
|
79
79
|
var DynamicWidgetContext = require('../../context/DynamicWidgetContext.cjs');
|
|
80
80
|
var DynamicWidgetCard = require('../DynamicWidgetCard/DynamicWidgetCard.cjs');
|
|
81
81
|
var DynamicWidgetVariants = require('../DynamicWidgetVariants/DynamicWidgetVariants.cjs');
|
|
82
|
+
var WidgetRegistryContextProvider = require('../../../../context/WidgetRegistry/WidgetRegistryContextProvider.cjs');
|
|
82
83
|
|
|
83
84
|
const DynamicUserProfile = ({ variant, }) => {
|
|
84
85
|
const { projectSettings, setShowDynamicUserProfile, showAuthFlow } = useInternalDynamicContext.useInternalDynamicContext();
|
|
@@ -100,7 +101,9 @@ const DynamicUserProfile = ({ variant, }) => {
|
|
|
100
101
|
}
|
|
101
102
|
}, [inlineControlsRef, variant, showAuthFlow, setShowDynamicUserProfile]);
|
|
102
103
|
index$1.useOnClickOutside(widgetRef, closeOnOutsideClick);
|
|
103
|
-
|
|
104
|
+
const shouldRenderUserProfile = Boolean(projectSettings);
|
|
105
|
+
WidgetRegistryContextProvider.useRegisterWidget('user-profile', shouldRenderUserProfile);
|
|
106
|
+
if (!shouldRenderUserProfile)
|
|
104
107
|
return null;
|
|
105
108
|
return (jsxRuntime.jsx(IsBrowser.IsBrowser, { children: jsxRuntime.jsx(PopperContext.PopperProvider, { children: jsxRuntime.jsx(DynamicWidgetVariants.DynamicWidgetVariants, { isOpen: isOpen, setIsOpen: setIsOpen, variant: _variant, zIndex: index.widgetModalZIndex, children: jsxRuntime.jsx(SandboxIndicatorWrapper.SandboxIndicatorWrapper, { children: jsxRuntime.jsx(DynamicWidgetCard.DynamicWidgetCard, { ref: widgetRef, children: jsxRuntime.jsx(DynamicUserProfileLayout.DynamicUserProfileLayout, { variant: variant }) }) }) }) }) }));
|
|
106
109
|
};
|
|
@@ -75,6 +75,7 @@ import { SandboxIndicatorWrapper } from '../../../../components/SandboxIndicator
|
|
|
75
75
|
import { useWidgetContext } from '../../context/DynamicWidgetContext.js';
|
|
76
76
|
import { DynamicWidgetCard } from '../DynamicWidgetCard/DynamicWidgetCard.js';
|
|
77
77
|
import { DynamicWidgetVariants } from '../DynamicWidgetVariants/DynamicWidgetVariants.js';
|
|
78
|
+
import { useRegisterWidget } from '../../../../context/WidgetRegistry/WidgetRegistryContextProvider.js';
|
|
78
79
|
|
|
79
80
|
const DynamicUserProfile = ({ variant, }) => {
|
|
80
81
|
const { projectSettings, setShowDynamicUserProfile, showAuthFlow } = useInternalDynamicContext();
|
|
@@ -96,7 +97,9 @@ const DynamicUserProfile = ({ variant, }) => {
|
|
|
96
97
|
}
|
|
97
98
|
}, [inlineControlsRef, variant, showAuthFlow, setShowDynamicUserProfile]);
|
|
98
99
|
useOnClickOutside(widgetRef, closeOnOutsideClick);
|
|
99
|
-
|
|
100
|
+
const shouldRenderUserProfile = Boolean(projectSettings);
|
|
101
|
+
useRegisterWidget('user-profile', shouldRenderUserProfile);
|
|
102
|
+
if (!shouldRenderUserProfile)
|
|
100
103
|
return null;
|
|
101
104
|
return (jsx(IsBrowser, { children: jsx(PopperProvider, { children: jsx(DynamicWidgetVariants, { isOpen: isOpen, setIsOpen: setIsOpen, variant: _variant, zIndex: widgetModalZIndex, children: jsx(SandboxIndicatorWrapper, { children: jsx(DynamicWidgetCard, { ref: widgetRef, children: jsx(DynamicUserProfileLayout, { variant: variant }) }) }) }) }) }));
|
|
102
105
|
};
|
package/src/lib/widgets/DynamicWidget/prompts/PrimaryNotConnectedModal/PrimaryNotConnectedModal.cjs
CHANGED
|
@@ -87,7 +87,7 @@ require('../../../../context/IpConfigurationContext/IpConfigurationContext.cjs')
|
|
|
87
87
|
const PrimaryNotConnectedContent = () => {
|
|
88
88
|
var _a;
|
|
89
89
|
const { primaryWallet } = useInternalDynamicContext.useInternalDynamicContext();
|
|
90
|
-
return (jsxRuntime.jsxs(DefaultPromptModal.DefaultPromptLayout, { dataTestId: 'wallet-not-connected', icon: jsxRuntime.jsx(walletBook.WalletIcon, { walletKey: (_a = primaryWallet === null || primaryWallet === void 0 ? void 0 : primaryWallet.connector) === null || _a === void 0 ? void 0 : _a.key }), title: `Switch wallet in ${primaryWallet === null || primaryWallet === void 0 ? void 0 : primaryWallet.connector.name}`, children: [jsxRuntime.jsxs(Typography.Typography, { variant: 'body_normal', color: 'secondary', weight: 'regular', "data-testid": 'content', children: ["Your active wallet in", ' ', jsxRuntime.jsx(Typography.Typography, { as: 'span', weight: 'medium', color: 'primary', children: primaryWallet === null || primaryWallet === void 0 ? void 0 : primaryWallet.connector.name }), ' ', "is not linked. Please switch to wallet", ' ', jsxRuntime.jsx(Typography.Typography, { as: 'span', weight: 'medium', color: 'primary', children: shortenWalletAddress.shortenWalletAddress(primaryWallet === null || primaryWallet === void 0 ? void 0 : primaryWallet.address, 3, 3) }),
|
|
90
|
+
return (jsxRuntime.jsxs(DefaultPromptModal.DefaultPromptLayout, { dataTestId: 'wallet-not-connected', icon: jsxRuntime.jsx(walletBook.WalletIcon, { walletKey: (_a = primaryWallet === null || primaryWallet === void 0 ? void 0 : primaryWallet.connector) === null || _a === void 0 ? void 0 : _a.key }), title: `Switch wallet in ${primaryWallet === null || primaryWallet === void 0 ? void 0 : primaryWallet.connector.name}`, children: [jsxRuntime.jsxs(Typography.Typography, { variant: 'body_normal', color: 'secondary', weight: 'regular', "data-testid": 'content', children: ["Your active wallet in", ' ', jsxRuntime.jsx(Typography.Typography, { as: 'span', weight: 'medium', color: 'primary', children: primaryWallet === null || primaryWallet === void 0 ? void 0 : primaryWallet.connector.name }), ' ', "is not linked. Please switch to wallet", ' ', jsxRuntime.jsx(Typography.Typography, { as: 'span', weight: 'medium', color: 'primary', children: shortenWalletAddress.shortenWalletAddress(primaryWallet === null || primaryWallet === void 0 ? void 0 : primaryWallet.address, 3, 3) }), "."] }), jsxRuntime.jsx(Divider.Divider, { fullWidth: true, text: 'Or' }), jsxRuntime.jsx(LogoutButton.LogoutButton, { isTextButton: false, buttonClassName: 'primary-not-connected__log-out-button' })] }));
|
|
91
91
|
};
|
|
92
92
|
const PrimaryNotConnectedWidgetPortal = () => (jsxRuntime.jsx(WidgetPortal.WidgetPortal, { children: jsxRuntime.jsx(PrimaryNotConnectedContent, {}) }));
|
|
93
93
|
const PrimaryNotConnectedModal = () => {
|