@dynamic-labs/sdk-react-core 4.35.0 → 4.36.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 +20 -0
- package/package.cjs +2 -2
- package/package.js +2 -2
- package/package.json +12 -12
- package/src/lib/client/extension/deprecated/mfa/verifyTotpMfaDevice/verifyTotpMfaDevice.d.ts +1 -1
- package/src/lib/client/extension/projectSettings/getProjectSettings/getProjectSettings.d.ts +2 -1
- package/src/lib/client/extension/projectSettings/useProjectSettings/useProjectSettings.d.ts +2 -1
- package/src/lib/client/extension/projectSettings/useRefetchProjectSettings/useRefetchProjectSettings.d.ts +2 -1
- package/src/lib/context/SocialRedirectContext/hooks/useRedirectSocialHandler/useRedirectSocialHandler.cjs +3 -1
- package/src/lib/context/SocialRedirectContext/hooks/useRedirectSocialHandler/useRedirectSocialHandler.js +3 -1
- package/src/lib/context/SocialRedirectContext/utils/getDynamicRedirectData/getDynamicRedirectData.d.ts +1 -0
- package/src/lib/context/SocialRedirectContext/utils/getDynamicRedirectDataFromUrl/getDynamicRedirectDataFromUrl.cjs +2 -1
- package/src/lib/context/SocialRedirectContext/utils/getDynamicRedirectDataFromUrl/getDynamicRedirectDataFromUrl.d.ts +1 -0
- package/src/lib/context/SocialRedirectContext/utils/getDynamicRedirectDataFromUrl/getDynamicRedirectDataFromUrl.js +2 -1
- package/src/lib/data/api/oauth/oauth.cjs +4 -3
- package/src/lib/data/api/oauth/oauth.d.ts +3 -3
- package/src/lib/data/api/oauth/oauth.js +4 -3
- package/src/lib/locale/en/translation.cjs +2 -0
- package/src/lib/locale/en/translation.d.ts +2 -0
- package/src/lib/locale/en/translation.js +2 -0
- package/src/lib/styles/index.shadow.cjs +1 -1
- package/src/lib/styles/index.shadow.js +1 -1
- package/src/lib/utils/constants/authViewLayoutChecks.cjs +1 -0
- package/src/lib/utils/constants/authViewLayoutChecks.js +1 -0
- package/src/lib/utils/constants/index.d.ts +1 -1
- package/src/lib/utils/constants/localStorage.cjs +3 -0
- package/src/lib/utils/constants/localStorage.d.ts +4 -0
- package/src/lib/utils/constants/localStorage.js +3 -1
- package/src/lib/utils/constants/sessionStorage.cjs +1 -1
- package/src/lib/utils/constants/sessionStorage.js +1 -1
- package/src/lib/utils/functions/getTransactionLink/blockExplorerPatterns.cjs +47 -0
- package/src/lib/utils/functions/getTransactionLink/blockExplorerPatterns.d.ts +26 -0
- package/src/lib/utils/functions/getTransactionLink/blockExplorerPatterns.js +41 -0
- package/src/lib/utils/functions/getTransactionLink/getTransactionLink.cjs +5 -3
- package/src/lib/utils/functions/getTransactionLink/getTransactionLink.js +5 -3
- package/src/lib/utils/functions/socialStorage/socialStorage.d.ts +2 -0
- package/src/lib/utils/hooks/useDynamicWaas/useDynamicWaas.cjs +55 -1
- package/src/lib/utils/hooks/useDynamicWaas/useDynamicWaas.d.ts +2 -0
- package/src/lib/utils/hooks/useDynamicWaas/useDynamicWaas.js +55 -1
- package/src/lib/utils/hooks/useSocialAccounts/useSocialAccounts.cjs +1 -1
- package/src/lib/utils/hooks/useSocialAccounts/useSocialAccounts.js +1 -1
- package/src/lib/utils/hooks/useSocialAuth/useSocialAuth.cjs +5 -2
- package/src/lib/utils/hooks/useSocialAuth/useSocialAuth.d.ts +4 -1
- package/src/lib/utils/hooks/useSocialAuth/useSocialAuth.js +5 -2
- package/src/lib/utils/hooks/useSyncDynamicWaas/useSyncDynamicWaas.cjs +43 -6
- package/src/lib/utils/hooks/useSyncDynamicWaas/useSyncDynamicWaas.js +43 -6
- package/src/lib/utils/hooks/useWalletDelegation/useWalletDelegation.cjs +37 -5
- package/src/lib/utils/hooks/useWalletDelegation/useWalletDelegation.d.ts +6 -1
- package/src/lib/utils/hooks/useWalletDelegation/useWalletDelegation.js +37 -5
- package/src/lib/views/WalletDelegation/WalletDelegationView/WalletDelegationView.cjs +68 -101
- package/src/lib/views/WalletDelegation/WalletDelegationView/WalletDelegationView.d.ts +7 -1
- package/src/lib/views/WalletDelegation/WalletDelegationView/WalletDelegationView.js +69 -102
- package/src/lib/views/viewToComponentMap.d.ts +3 -1
- package/src/lib/widgets/DynamicWidget/components/DynamicWidgetViews/mapViewToComponent.d.ts +3 -1
|
@@ -1,2 +1,8 @@
|
|
|
1
1
|
import { FC } from 'react';
|
|
2
|
-
|
|
2
|
+
import { Wallet } from '../../../shared';
|
|
3
|
+
type WalletDelegationViewProps = {
|
|
4
|
+
/** Optional list of wallets to display instead of default WAAS wallets */
|
|
5
|
+
wallets?: Wallet[];
|
|
6
|
+
};
|
|
7
|
+
export declare const WalletDelegationView: FC<WalletDelegationViewProps>;
|
|
8
|
+
export {};
|
|
@@ -3,121 +3,52 @@ import { __awaiter } from '../../../../../_virtual/_tslib.js';
|
|
|
3
3
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
4
4
|
import { useState, useMemo } from 'react';
|
|
5
5
|
import { useTranslation } from 'react-i18next';
|
|
6
|
-
import { DynamicError } from '@dynamic-labs/utils';
|
|
6
|
+
import { StorageService, DynamicError } from '@dynamic-labs/utils';
|
|
7
7
|
import { Checkbox } from '../../../components/Checkbox/Checkbox.js';
|
|
8
8
|
import { ErrorContainer } from '../../../components/ErrorContainer/ErrorContainer.js';
|
|
9
9
|
import { IconButton } from '../../../components/IconButton/IconButton.js';
|
|
10
10
|
import { ModalHeader } from '../../../components/ModalHeader/ModalHeader.js';
|
|
11
11
|
import { Typography } from '../../../components/Typography/Typography.js';
|
|
12
12
|
import { TypographyButton } from '../../../components/TypographyButton/TypographyButton.js';
|
|
13
|
-
import '../../../context/DynamicContext/
|
|
14
|
-
import '../../../
|
|
15
|
-
import '
|
|
16
|
-
import '
|
|
13
|
+
import { useDynamicContext } from '../../../context/DynamicContext/useDynamicContext/useDynamicContext.js';
|
|
14
|
+
import { useInternalDynamicContext } from '../../../context/DynamicContext/useDynamicContext/useInternalDynamicContext/useInternalDynamicContext.js';
|
|
15
|
+
import { dynamicEvents } from '../../../events/dynamicEvents.js';
|
|
16
|
+
import { getProperErrorMessage } from '../../../modals/SignMessageConfirmationModal/getProperErrorMessage.js';
|
|
17
17
|
import { ReactComponent as SvgCheck } from '../../../shared/assets/check.js';
|
|
18
18
|
import { ReactComponent as SvgClose } from '../../../shared/assets/close.js';
|
|
19
19
|
import { ReactComponent as SvgSwitchHorizontal } from '../../../shared/assets/switch-horizontal.js';
|
|
20
|
+
import '@dynamic-labs/iconic';
|
|
20
21
|
import '../../../context/ViewContext/ViewContext.js';
|
|
21
22
|
import { logger } from '../../../shared/logger.js';
|
|
22
|
-
import '@dynamic-labs/wallet-book';
|
|
23
|
-
import '../../../utils/constants/colors.js';
|
|
24
|
-
import '../../../utils/constants/values.js';
|
|
25
|
-
import '@dynamic-labs/sdk-api-core';
|
|
26
|
-
import '../../../shared/consts/index.js';
|
|
27
|
-
import { dynamicEvents } from '../../../events/dynamicEvents.js';
|
|
28
|
-
import '../../../context/CaptchaContext/CaptchaContext.js';
|
|
29
|
-
import '../../../context/ErrorContext/ErrorContext.js';
|
|
30
|
-
import '@dynamic-labs/multi-wallet';
|
|
31
|
-
import 'react-international-phone';
|
|
32
|
-
import '../../../store/state/nonce/nonce.js';
|
|
33
|
-
import '@dynamic-labs-sdk/client/core';
|
|
34
|
-
import '../../../client/client.js';
|
|
35
|
-
import '@dynamic-labs-sdk/client';
|
|
36
|
-
import '../../../config/ApiEndpoint.js';
|
|
37
|
-
import '../../../locale/locale.js';
|
|
38
|
-
import '../../../store/state/dynamicContextProps/dynamicContextProps.js';
|
|
39
|
-
import '../../../store/state/primaryWalletId/primaryWalletId.js';
|
|
40
|
-
import '../../../store/state/connectedWalletsInfo/connectedWalletsInfo.js';
|
|
41
|
-
import '../../../context/AccessDeniedContext/AccessDeniedContext.js';
|
|
42
|
-
import '../../../context/AccountExistsContext/AccountExistsContext.js';
|
|
43
|
-
import { useInternalUserWallets } from '../../../context/UserWalletsContext/UserWalletsContext.js';
|
|
44
|
-
import '../../../store/state/authMode/authMode.js';
|
|
45
|
-
import '../../../context/VerificationContext/VerificationContext.js';
|
|
46
|
-
import 'react-dom';
|
|
47
|
-
import '../../../utils/functions/compareChains/compareChains.js';
|
|
48
|
-
import '../../Passkey/utils/findPrimaryEmbeddedChain/findPrimaryEmbeddedChain.js';
|
|
49
|
-
import '../../../context/ThemeContext/ThemeContext.js';
|
|
50
|
-
import '../../../utils/hooks/useUserUpdateRequest/useUpdateUser/userFieldsSchema.js';
|
|
51
23
|
import { useMutation } from '../../../utils/hooks/useMutation/useMutation.js';
|
|
52
|
-
import 'bs58';
|
|
53
|
-
import '@dynamic-labs/types';
|
|
54
|
-
import '../../../context/SocialRedirectContext/SocialRedirectContext.js';
|
|
55
|
-
import '../../../context/LoadingContext/LoadingContext.js';
|
|
56
|
-
import '../../../context/WalletContext/WalletContext.js';
|
|
57
|
-
import '../../../utils/hooks/useEmbeddedWallet/useSecureEnclaveEmbeddedWallet/constants.js';
|
|
58
|
-
import 'yup';
|
|
59
|
-
import '../../../context/MockContext/MockContext.js';
|
|
60
|
-
import '../../CollectUserDataView/useFields.js';
|
|
61
|
-
import '../../../context/FieldsStateContext/FieldsStateContext.js';
|
|
62
|
-
import '../../../context/UserFieldEditorContext/UserFieldEditorContext.js';
|
|
63
|
-
import '@dynamic-labs/rpc-providers';
|
|
64
|
-
import '../../../store/state/walletOptions/walletOptions.js';
|
|
65
|
-
import '../../../components/Accordion/components/AccordionItem/AccordionItem.js';
|
|
66
|
-
import '../../../components/Alert/Alert.js';
|
|
67
|
-
import { WalletIconWithNetwork } from '../../../widgets/DynamicWidget/components/WalletIconWithNetwork/WalletIconWithNetwork.js';
|
|
68
|
-
import '../../../components/ShadowDOM/ShadowDOM.js';
|
|
69
|
-
import '../../../components/InlineWidget/InlineWidget.js';
|
|
70
|
-
import '../../../components/Input/Input.js';
|
|
71
|
-
import '../../../components/IsBrowser/IsBrowser.js';
|
|
72
|
-
import '../../../components/MenuList/Dropdown/Dropdown.js';
|
|
73
|
-
import '../../../components/OverlayCard/OverlayCard.js';
|
|
74
|
-
import '../../../components/Transition/ZoomTransition/ZoomTransition.js';
|
|
75
|
-
import '../../../components/Transition/SlideInUpTransition/SlideInUpTransition.js';
|
|
76
|
-
import '../../../components/Transition/OpacityTransition/OpacityTransition.js';
|
|
77
|
-
import '../../../components/PasskeyCreatedSuccessBanner/PasskeyCreatedSuccessBanner.js';
|
|
78
|
-
import '../../../components/Popper/Popper/Popper.js';
|
|
79
|
-
import '../../../components/Popper/PopperContext/PopperContext.js';
|
|
80
|
-
import 'react-focus-lock';
|
|
81
|
-
import 'qrcode';
|
|
82
|
-
import 'formik';
|
|
83
|
-
import '../../../utils/hooks/useSubdomainCheck/useSubdomainCheck.js';
|
|
84
|
-
import '../../../context/WalletGroupContext/WalletGroupContext.js';
|
|
85
|
-
import '../../../context/IpConfigurationContext/IpConfigurationContext.js';
|
|
86
|
-
import '../../../context/ConnectWithOtpContext/ConnectWithOtpContext.js';
|
|
87
|
-
import '../../../widgets/DynamicBridgeWidget/views/WalletsView/components/SecondaryWallets/SecondaryWallets.js';
|
|
88
|
-
import '@hcaptcha/react-hcaptcha';
|
|
89
|
-
import { getProperErrorMessage } from '../../../modals/SignMessageConfirmationModal/getProperErrorMessage.js';
|
|
90
|
-
import '../../../widgets/DynamicWidget/context/DynamicWidgetContext.js';
|
|
91
|
-
import '../../../widgets/DynamicWidget/helpers/convertExchangeKeyAndProviderEnum.js';
|
|
92
|
-
import '../../ExchangeWhitelistWarning/ExchangeWhitelistWarning.js';
|
|
93
|
-
import '../../../context/ErrorContext/hooks/useErrorText/useErrorText.js';
|
|
94
|
-
import '../../../context/FooterAnimationContext/index.js';
|
|
95
|
-
import '../../MfaChooseDeviceView/useGetMfaOptions/useGetMfaOptions.js';
|
|
96
|
-
import '../../../context/PasskeyContext/PasskeyContext.js';
|
|
97
|
-
import '../../../context/OnrampContext/OnrampContext.js';
|
|
98
|
-
import { useDynamicWaas } from '../../../utils/hooks/useDynamicWaas/useDynamicWaas.js';
|
|
99
24
|
import { useAppName } from '../../../store/utils/settingsUtils/settingsUtils.js';
|
|
100
|
-
import '../../../
|
|
101
|
-
import '../../../
|
|
102
|
-
import '../../../components/
|
|
103
|
-
import '../../../
|
|
104
|
-
import '
|
|
105
|
-
import '../../../
|
|
106
|
-
import '
|
|
107
|
-
import '../../../widgets/DynamicWidget/views/ReceiveWalletFunds/ReceiveWalletFunds.js';
|
|
108
|
-
import '../../../store/state/tokenBalances.js';
|
|
109
|
-
import '../../../store/state/multichainBalances.js';
|
|
110
|
-
import '../../../shared/utils/functions/getInitialUrl/getInitialUrl.js';
|
|
111
|
-
import { useInternalDynamicContext } from '../../../context/DynamicContext/useDynamicContext/useInternalDynamicContext/useInternalDynamicContext.js';
|
|
25
|
+
import { useInternalUserWallets } from '../../../context/UserWalletsContext/UserWalletsContext.js';
|
|
26
|
+
import { useDynamicWaas } from '../../../utils/hooks/useDynamicWaas/useDynamicWaas.js';
|
|
27
|
+
import { WalletIconWithNetwork } from '../../../widgets/DynamicWidget/components/WalletIconWithNetwork/WalletIconWithNetwork.js';
|
|
28
|
+
import { useWalletDelegation } from '../../../utils/hooks/useWalletDelegation/useWalletDelegation.js';
|
|
29
|
+
import { DELEGATION_STATE } from '../../../utils/constants/localStorage.js';
|
|
30
|
+
import '../../../utils/constants/colors.js';
|
|
31
|
+
import '../../../utils/constants/values.js';
|
|
112
32
|
|
|
113
|
-
const WalletDelegationView = () => {
|
|
114
|
-
const {
|
|
33
|
+
const WalletDelegationView = ({ wallets, }) => {
|
|
34
|
+
const { setShowAuthFlow, handleLogOut } = useInternalDynamicContext();
|
|
35
|
+
const { user } = useDynamicContext();
|
|
115
36
|
const appName = useAppName();
|
|
116
37
|
const { userWallets } = useInternalUserWallets();
|
|
117
38
|
const { delegateKeyShares } = useDynamicWaas();
|
|
39
|
+
const { requiresDelegation } = useWalletDelegation();
|
|
118
40
|
const [selectedWallets, setSelectedWallets] = useState(new Set());
|
|
119
|
-
// Get waas wallets that are not yet delegated
|
|
120
|
-
const waasWallets =
|
|
41
|
+
// Get waas wallets that are not yet delegated or use provided wallets override
|
|
42
|
+
const waasWallets = useMemo(() => {
|
|
43
|
+
const items = wallets && wallets.length > 0
|
|
44
|
+
? wallets
|
|
45
|
+
: userWallets.filter((wallet) => wallet.connector.key.startsWith('dynamicwaas'));
|
|
46
|
+
const state = StorageService.getItem(DELEGATION_STATE) || { completed: {}, denied: {}, dismissed: false };
|
|
47
|
+
const userId = (user === null || user === void 0 ? void 0 : user.userId) || 'anonymous';
|
|
48
|
+
const deniedForUser = new Set(state.denied[userId] || []);
|
|
49
|
+
const completedForUser = new Set(state.completed[userId] || []);
|
|
50
|
+
return items.filter((wallet) => !deniedForUser.has(wallet.id) && !completedForUser.has(wallet.id));
|
|
51
|
+
}, [userWallets, wallets, user === null || user === void 0 ? void 0 : user.userId]);
|
|
121
52
|
const handleWalletToggle = (walletId, event) => {
|
|
122
53
|
// Prevent event propagation if called from checkbox
|
|
123
54
|
if (event) {
|
|
@@ -140,6 +71,15 @@ const WalletDelegationView = () => {
|
|
|
140
71
|
const handleDeselectAll = () => {
|
|
141
72
|
setSelectedWallets(new Set());
|
|
142
73
|
};
|
|
74
|
+
const persistDeniedWallets = () => {
|
|
75
|
+
const state = StorageService.getItem(DELEGATION_STATE) || { completed: {}, denied: {}, dismissed: false };
|
|
76
|
+
const userId = (user === null || user === void 0 ? void 0 : user.userId) || 'anonymous';
|
|
77
|
+
const existingForUser = new Set(state.denied[userId] || []);
|
|
78
|
+
selectedWallets.forEach((walletId) => existingForUser.add(walletId));
|
|
79
|
+
state.denied[userId] = Array.from(existingForUser);
|
|
80
|
+
StorageService.setItem(DELEGATION_STATE, state);
|
|
81
|
+
// No legacy mirrors; unified state only
|
|
82
|
+
};
|
|
143
83
|
const { mutate: handleDelegateWallets, isLoading, error, data: isSuccess, } = useMutation(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
144
84
|
if (selectedWallets.size === 0) {
|
|
145
85
|
throw new DynamicError('No wallets selected for delegation');
|
|
@@ -162,6 +102,14 @@ const WalletDelegationView = () => {
|
|
|
162
102
|
}));
|
|
163
103
|
// Wait for all delegations to complete
|
|
164
104
|
yield Promise.all(delegationPromises);
|
|
105
|
+
// Persist completed delegations (unified state + legacy)
|
|
106
|
+
const state = StorageService.getItem(DELEGATION_STATE) || { completed: {}, denied: {}, dismissed: false };
|
|
107
|
+
const userId = (user === null || user === void 0 ? void 0 : user.userId) || 'anonymous';
|
|
108
|
+
const existingForUser = new Set(state.completed[userId] || []);
|
|
109
|
+
selectedWalletObjects.forEach((wallet) => existingForUser.add(wallet.id));
|
|
110
|
+
state.completed[userId] = Array.from(existingForUser);
|
|
111
|
+
StorageService.setItem(DELEGATION_STATE, state);
|
|
112
|
+
// No legacy mirrors; unified state only
|
|
165
113
|
// Emit overall success event
|
|
166
114
|
dynamicEvents.emit('embeddedWalletDelegationCompleted', selectedWalletObjects[0]);
|
|
167
115
|
return true;
|
|
@@ -203,13 +151,20 @@ const WalletDelegationView = () => {
|
|
|
203
151
|
// Error state content
|
|
204
152
|
const errorContent = (jsx("div", { className: 'embedded-delegated-view__body__description', children: jsxs("div", { className: 'embedded-delegated-view__approval-section', children: [jsx("div", { className: 'embedded-delegated-view__error-icon', children: jsx(SvgClose, {}) }), jsx(Typography, { variant: 'body_small', weight: 'bold', color: 'primary', className: 'embedded-delegated-view__approval-title', children: t('dyn_wallet_delegation.something_went_wrong') }), jsx(Typography, { variant: 'body_small', color: 'secondary', className: 'embedded-delegated-view__approval-description', children: t('dyn_wallet_delegation.delegation_timeout_message') })] }) }));
|
|
205
153
|
// Initial state content
|
|
206
|
-
const initialContent = (jsx("div", { className: 'embedded-delegated-view__body__description', children: jsxs("div", { className: 'embedded-delegated-view__approval-section', children: [jsx("div", { className: 'embedded-delegated-view__approval-icon', children: jsx(SvgSwitchHorizontal, {}) }), jsx(Typography, { variant: 'body_small', weight: 'bold', color: 'primary', className: 'embedded-delegated-view__approval-title', copykey: 'dyn_wallet_delegation.approval_required', children:
|
|
154
|
+
const initialContent = (jsx("div", { className: 'embedded-delegated-view__body__description', children: jsxs("div", { className: 'embedded-delegated-view__approval-section', children: [jsx("div", { className: 'embedded-delegated-view__approval-icon', children: jsx(SvgSwitchHorizontal, {}) }), jsx(Typography, { variant: 'body_small', weight: 'bold', color: 'primary', className: 'embedded-delegated-view__approval-title', copykey: 'dyn_wallet_delegation.approval_required', children: requiresDelegation
|
|
155
|
+
? t('dyn_wallet_delegation.approval_required')
|
|
156
|
+
: t('dyn_wallet_delegation.approval_requested') }), jsx(Typography, { variant: 'body_small', color: 'secondary', className: 'embedded-delegated-view__approval-description', copykey: 'dyn_wallet_delegation.approval_description', children: t('dyn_wallet_delegation.approval_description', {
|
|
207
157
|
appName,
|
|
208
158
|
}) })] }) }));
|
|
209
159
|
const displayWaasWallets = () => (jsxs("div", { className: 'embedded-delegated-view__wallet-selection', children: [jsxs("div", { className: 'embedded-delegated-view__wallet-selection__header', children: [jsx(Typography, { variant: 'body_normal', weight: 'bold', children: t('dyn_wallet_delegation.select_wallets') }), jsx("button", { onClick: selectedWallets.size === waasWallets.length
|
|
210
160
|
? handleDeselectAll
|
|
211
161
|
: handleSelectAll, className: 'embedded-delegated-view__wallet-selection__deselect-all', children: jsx(Typography, { variant: 'body_small', color: 'secondary', children: getSelectButtonText() }) })] }), jsx("div", { className: 'embedded-delegated-view__wallet-list', children: waasWallets === null || waasWallets === void 0 ? void 0 : waasWallets.map((wallet) => (jsx("div", { className: 'embedded-delegated-view__wallet-item', children: jsxs("div", { className: 'embedded-delegated-view__wallet-item__content', onClick: () => handleWalletToggle(wallet.id), style: { cursor: 'pointer' }, children: [jsx("div", { className: 'embedded-delegated-view__wallet-item__icon', children: jsx(WalletIconWithNetwork, { walletKey: wallet.key, Icon: null, iconUrl: wallet.connector.metadata.icon, chainName: wallet.chain, iconSize: 24, showNetwork: true }) }), jsx("div", { className: 'embedded-delegated-view__wallet-item__info', children: jsxs(Typography, { variant: 'body_small', weight: 'medium', children: [wallet.address.slice(0, 6), "...", wallet.address.slice(-4)] }) }), jsx("div", { className: 'embedded-delegated-view__wallet-item__checkbox', children: jsx(Checkbox, { checked: selectedWallets.has(wallet.id), onChange: () => { }, value: wallet.id }) })] }) }, wallet.id))) })] }));
|
|
212
162
|
const closeButton = (jsx(IconButton, { onClick: () => {
|
|
163
|
+
// Mark prompt as dismissed until logout (unified state + legacy)
|
|
164
|
+
const state = StorageService.getItem(DELEGATION_STATE) || { completed: {}, denied: {}, dismissed: false };
|
|
165
|
+
state.dismissed = true;
|
|
166
|
+
StorageService.setItem(DELEGATION_STATE, state);
|
|
167
|
+
// No legacy mirror; unified state only
|
|
213
168
|
setShowAuthFlow(false);
|
|
214
169
|
}, type: 'button', children: jsx(SvgClose, {}) }));
|
|
215
170
|
// Determine which content to show based on state
|
|
@@ -246,16 +201,28 @@ const WalletDelegationView = () => {
|
|
|
246
201
|
}
|
|
247
202
|
return (jsxs(Fragment, { children: [jsx(TypographyButton, { buttonPadding: 'medium', buttonVariant: 'brand-primary', typographyProps: {
|
|
248
203
|
color: 'inherit',
|
|
249
|
-
}, onClick: () => handleDelegateWallets(), loading: isLoading, disabled: selectedWallets.size === 0, dataTestId: 'embedded-delegation-button', copykey: 'dyn_wallet_delegation.approve_button', style: { width: '100%' }, className: 'embedded-delegated-view__body__button', expanded: true, children: t('dyn_wallet_delegation.approve_button') }), !isLoading && (jsx(TypographyButton, { buttonPadding: 'medium', buttonVariant: 'brand-primary', typographyProps: {
|
|
204
|
+
}, onClick: () => handleDelegateWallets(), loading: isLoading, disabled: selectedWallets.size === 0, dataTestId: 'embedded-delegation-button', copykey: 'dyn_wallet_delegation.approve_button', style: { width: '100%' }, className: 'embedded-delegated-view__body__button', expanded: true, children: t('dyn_wallet_delegation.approve_button') }), !isLoading && !requiresDelegation && (jsx(TypographyButton, { buttonPadding: 'medium', buttonVariant: 'brand-primary', typographyProps: {
|
|
205
|
+
color: 'primary',
|
|
206
|
+
weight: 'bold',
|
|
207
|
+
}, onClick: () => {
|
|
208
|
+
persistDeniedWallets();
|
|
209
|
+
setShowAuthFlow(false);
|
|
210
|
+
}, dataTestId: 'embedded-delegation-deny-button', copykey: 'dyn_wallet_delegation.deny_button', style: {
|
|
211
|
+
backgroundColor: 'white',
|
|
212
|
+
border: '1px solid var(--dynamic-base-4)',
|
|
213
|
+
width: '100%',
|
|
214
|
+
}, className: 'embedded-delegated-view__body__button embedded-delegated-view__body__deny-button', expanded: true, children: t('dyn_wallet_delegation.deny_button') })), !isLoading && requiresDelegation && (jsx(TypographyButton, { buttonPadding: 'medium', buttonVariant: 'brand-primary', typographyProps: {
|
|
250
215
|
color: 'primary',
|
|
251
216
|
weight: 'bold',
|
|
252
|
-
}, onClick: () =>
|
|
217
|
+
}, onClick: () => {
|
|
218
|
+
handleLogOut();
|
|
219
|
+
}, dataTestId: 'embedded-delegation-logout-button', copykey: 'dyn_wallet_delegation.logout_button', style: {
|
|
253
220
|
backgroundColor: 'white',
|
|
254
221
|
border: '1px solid var(--dynamic-base-4)',
|
|
255
222
|
width: '100%',
|
|
256
|
-
}, className: 'embedded-delegated-view__body__button embedded-delegated-
|
|
223
|
+
}, className: 'embedded-delegated-view__body__button embedded-delegated-view__body__logout-button', expanded: true, children: t('dyn_wallet_delegation.logout_button') }))] }));
|
|
257
224
|
};
|
|
258
|
-
return (jsxs(Fragment, { children: [jsx(ModalHeader, { leading: closeButton }), jsx("div", { className: 'embedded-delegated-view', children: jsxs("div", { className: 'embedded-delegated-view__body', children: [getContentHeader(), errorText && jsx(ErrorContainer, { children: errorText }), !isLoading && !isSuccess && !error && (jsx("div", { className: 'embedded-delegated-view__body__card', children: displayWaasWallets() })), jsx("div", { className: 'embedded-delegated-view__body__button_section', children: getButtons() })] }) })] }));
|
|
225
|
+
return (jsxs(Fragment, { children: [jsx(ModalHeader, { leading: !requiresDelegation ? closeButton : undefined }), jsx("div", { className: 'embedded-delegated-view', children: jsxs("div", { className: 'embedded-delegated-view__body', children: [getContentHeader(), errorText && jsx(ErrorContainer, { children: errorText }), !isLoading && !isSuccess && !error && (jsx("div", { className: 'embedded-delegated-view__body__card', children: displayWaasWallets() })), jsx("div", { className: 'embedded-delegated-view__body__button_section', children: getButtons() })] }) })] }));
|
|
259
226
|
};
|
|
260
227
|
|
|
261
228
|
export { WalletDelegationView };
|
|
@@ -109,7 +109,9 @@ export declare const viewToComponentMap: {
|
|
|
109
109
|
'wait-for-email-confirmation-view': () => JSX.Element;
|
|
110
110
|
'wallet-cannot-be-transferred': () => JSX.Element;
|
|
111
111
|
'wallet-connect-mobile-wallets-list': () => JSX.Element;
|
|
112
|
-
'wallet-delegation-view': import("react").FC
|
|
112
|
+
'wallet-delegation-view': import("react").FC<{
|
|
113
|
+
wallets?: import("dist/packages/wallet-connector-core/src").Wallet<import("dist/packages/wallet-connector-core/src").WalletConnectorCore.WalletConnector>[] | undefined;
|
|
114
|
+
}>;
|
|
113
115
|
'wallet-group': import("react").FC<{
|
|
114
116
|
onSelectWallet: (wallet: import("../shared").WalletOption) => void;
|
|
115
117
|
}>;
|
|
@@ -32,6 +32,8 @@ export declare const mapViewToComponent: {
|
|
|
32
32
|
'session-management-info': import("react").FC;
|
|
33
33
|
'session-management-revoke-access': import("react").FC<import("../../views/SessionManagementView/RevokeAccessView").RevokeAccessViewProps>;
|
|
34
34
|
settings: import("react").FC;
|
|
35
|
-
'wallet-delegation': import("react").FC
|
|
35
|
+
'wallet-delegation': import("react").FC<{
|
|
36
|
+
wallets?: import("dist/packages/wallet-connector-core/src").Wallet<import("dist/packages/wallet-connector-core/src").WalletConnectorCore.WalletConnector>[] | undefined;
|
|
37
|
+
}>;
|
|
36
38
|
wallets: import("react").FC;
|
|
37
39
|
};
|