@dynamic-labs/sdk-react-core 4.36.0 → 4.37.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (73) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/package.cjs +2 -2
  3. package/package.js +2 -2
  4. package/package.json +12 -12
  5. package/src/index.cjs +2 -0
  6. package/src/index.d.ts +1 -1
  7. package/src/index.js +1 -0
  8. package/src/lib/client/extension/deprecated/mfa/verifyTotpMfaDevice/verifyTotpMfaDevice.d.ts +1 -1
  9. package/src/lib/client/extension/projectSettings/getProjectSettings/getProjectSettings.d.ts +2 -1
  10. package/src/lib/client/extension/projectSettings/useProjectSettings/useProjectSettings.d.ts +2 -1
  11. package/src/lib/client/extension/projectSettings/useRefetchProjectSettings/useRefetchProjectSettings.d.ts +2 -1
  12. package/src/lib/context/SocialRedirectContext/hooks/useRedirectSocialHandler/useRedirectSocialHandler.cjs +3 -1
  13. package/src/lib/context/SocialRedirectContext/hooks/useRedirectSocialHandler/useRedirectSocialHandler.js +3 -1
  14. package/src/lib/context/SocialRedirectContext/utils/getDynamicRedirectData/getDynamicRedirectData.d.ts +1 -0
  15. package/src/lib/context/SocialRedirectContext/utils/getDynamicRedirectDataFromUrl/getDynamicRedirectDataFromUrl.cjs +2 -1
  16. package/src/lib/context/SocialRedirectContext/utils/getDynamicRedirectDataFromUrl/getDynamicRedirectDataFromUrl.d.ts +1 -0
  17. package/src/lib/context/SocialRedirectContext/utils/getDynamicRedirectDataFromUrl/getDynamicRedirectDataFromUrl.js +2 -1
  18. package/src/lib/data/api/oauth/oauth.cjs +2 -1
  19. package/src/lib/data/api/oauth/oauth.d.ts +1 -1
  20. package/src/lib/data/api/oauth/oauth.js +2 -1
  21. package/src/lib/locale/en/translation.cjs +26 -3
  22. package/src/lib/locale/en/translation.d.ts +25 -2
  23. package/src/lib/locale/en/translation.js +26 -3
  24. package/src/lib/shared/assets/connect.cjs +57 -0
  25. package/src/lib/shared/assets/connect.js +33 -0
  26. package/src/lib/shared/assets/index.d.ts +1 -0
  27. package/src/lib/styles/index.shadow.cjs +1 -1
  28. package/src/lib/styles/index.shadow.js +1 -1
  29. package/src/lib/utils/constants/authViewLayoutChecks.cjs +1 -0
  30. package/src/lib/utils/constants/authViewLayoutChecks.js +1 -0
  31. package/src/lib/utils/constants/index.d.ts +1 -1
  32. package/src/lib/utils/constants/localStorage.cjs +3 -0
  33. package/src/lib/utils/constants/localStorage.d.ts +4 -0
  34. package/src/lib/utils/constants/localStorage.js +3 -1
  35. package/src/lib/utils/functions/getTransactionLink/blockExplorerPatterns.cjs +47 -0
  36. package/src/lib/utils/functions/getTransactionLink/blockExplorerPatterns.d.ts +26 -0
  37. package/src/lib/utils/functions/getTransactionLink/blockExplorerPatterns.js +41 -0
  38. package/src/lib/utils/functions/getTransactionLink/getTransactionLink.cjs +5 -3
  39. package/src/lib/utils/functions/getTransactionLink/getTransactionLink.js +5 -3
  40. package/src/lib/utils/functions/socialStorage/socialStorage.d.ts +2 -0
  41. package/src/lib/utils/hooks/index.d.ts +1 -0
  42. package/src/lib/utils/hooks/useSocialAuth/useSocialAuth.cjs +5 -2
  43. package/src/lib/utils/hooks/useSocialAuth/useSocialAuth.d.ts +4 -1
  44. package/src/lib/utils/hooks/useSocialAuth/useSocialAuth.js +5 -2
  45. package/src/lib/utils/hooks/useSyncDynamicWaas/useSyncDynamicWaas.cjs +7 -0
  46. package/src/lib/utils/hooks/useSyncDynamicWaas/useSyncDynamicWaas.js +7 -0
  47. package/src/lib/utils/hooks/useWalletDelegation/useWalletDelegation.cjs +59 -5
  48. package/src/lib/utils/hooks/useWalletDelegation/useWalletDelegation.d.ts +12 -1
  49. package/src/lib/utils/hooks/useWalletDelegation/useWalletDelegation.js +59 -5
  50. package/src/lib/views/WalletDelegation/WalletDelegationView/AgreementSection.cjs +28 -0
  51. package/src/lib/views/WalletDelegation/WalletDelegationView/AgreementSection.d.ts +9 -0
  52. package/src/lib/views/WalletDelegation/WalletDelegationView/AgreementSection.js +24 -0
  53. package/src/lib/views/WalletDelegation/WalletDelegationView/WalletDelegationView.cjs +144 -104
  54. package/src/lib/views/WalletDelegation/WalletDelegationView/WalletDelegationView.d.ts +7 -1
  55. package/src/lib/views/WalletDelegation/WalletDelegationView/WalletDelegationView.js +146 -106
  56. package/src/lib/views/viewToComponentMap.d.ts +3 -1
  57. package/src/lib/widgets/DynamicWidget/components/DynamicWidgetViews/mapViewToComponent.cjs +2 -0
  58. package/src/lib/widgets/DynamicWidget/components/DynamicWidgetViews/mapViewToComponent.d.ts +4 -1
  59. package/src/lib/widgets/DynamicWidget/components/DynamicWidgetViews/mapViewToComponent.js +2 -0
  60. package/src/lib/widgets/DynamicWidget/context/DynamicWidgetContext.types.d.ts +1 -1
  61. package/src/lib/widgets/DynamicWidget/views/ConnectedAppsView/ConnectedAppsView.cjs +2 -6
  62. package/src/lib/widgets/DynamicWidget/views/ConnectedAppsView/ConnectedAppsView.js +2 -6
  63. package/src/lib/widgets/DynamicWidget/views/SettingsView/SettingsView.cjs +17 -1
  64. package/src/lib/widgets/DynamicWidget/views/SettingsView/SettingsView.js +17 -1
  65. package/src/lib/widgets/DynamicWidget/views/WalletsDelegatedSettingsView/WalletsDelegatedSettingsView.cjs +149 -0
  66. package/src/lib/widgets/DynamicWidget/views/WalletsDelegatedSettingsView/WalletsDelegatedSettingsView.d.ts +12 -0
  67. package/src/lib/widgets/DynamicWidget/views/WalletsDelegatedSettingsView/WalletsDelegatedSettingsView.js +144 -0
  68. package/src/lib/widgets/DynamicWidget/views/WalletsDelegatedSettingsView/index.d.ts +1 -0
  69. package/src/lib/widgets/DynamicWidget/views/index.d.ts +1 -0
  70. package/src/lib/widgets/DynamicWidget/views/ConnectedAppsView/EmbeddedDelegatedSection/EmbeddedDelegatedSection.cjs +0 -34
  71. package/src/lib/widgets/DynamicWidget/views/ConnectedAppsView/EmbeddedDelegatedSection/EmbeddedDelegatedSection.d.ts +0 -2
  72. package/src/lib/widgets/DynamicWidget/views/ConnectedAppsView/EmbeddedDelegatedSection/EmbeddedDelegatedSection.js +0 -30
  73. package/src/lib/widgets/DynamicWidget/views/ConnectedAppsView/EmbeddedDelegatedSection/index.d.ts +0 -1
@@ -1,128 +1,78 @@
1
1
  'use client'
2
2
  import { __awaiter } from '../../../../../_virtual/_tslib.js';
3
3
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
4
- import { useState, useMemo } from 'react';
4
+ import { useState, useMemo, useEffect } 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/DynamicContext.js';
14
- import '../../../store/state/loadingAndLifecycle/loadingAndLifecycle.js';
15
- import '@dynamic-labs/iconic';
16
- import '@dynamic-labs/wallet-connector-core';
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
+ import { ReactComponent as SvgArrowLeft } from '../../../shared/assets/arrow-left.js';
17
18
  import { ReactComponent as SvgCheck } from '../../../shared/assets/check.js';
18
19
  import { ReactComponent as SvgClose } from '../../../shared/assets/close.js';
19
20
  import { ReactComponent as SvgSwitchHorizontal } from '../../../shared/assets/switch-horizontal.js';
21
+ import '@dynamic-labs/iconic';
20
22
  import '../../../context/ViewContext/ViewContext.js';
21
23
  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
24
  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
25
  import { useAppName } from '../../../store/utils/settingsUtils/settingsUtils.js';
100
- import '../../../store/state/sendBalances.js';
101
- import '../../../store/state/connectorsInitializing/connectorsInitializing.js';
102
- import '../../../components/OverlayCardBase/OverlayCardTarget/OverlayCardTarget.js';
103
- import '../../../widgets/DynamicWidget/components/DynamicWidgetHeader/DynamicWidgetHeader.js';
104
- import '../../TransactionConfirmationView/TransactionConfirmationView.js';
105
- import '../../../widgets/DynamicWidget/components/PasskeyCard/PasskeyCard.js';
106
- import '../../../../index.js';
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';
26
+ import { useInternalUserWallets } from '../../../context/UserWalletsContext/UserWalletsContext.js';
27
+ import { useDynamicWaas } from '../../../utils/hooks/useDynamicWaas/useDynamicWaas.js';
28
+ import { WalletIconWithNetwork } from '../../../widgets/DynamicWidget/components/WalletIconWithNetwork/WalletIconWithNetwork.js';
29
+ import { useWalletDelegation } from '../../../utils/hooks/useWalletDelegation/useWalletDelegation.js';
30
+ import { DELEGATION_STATE } from '../../../utils/constants/localStorage.js';
31
+ import '../../../utils/constants/colors.js';
32
+ import '../../../utils/constants/values.js';
33
+ import { AgreementSection } from './AgreementSection.js';
112
34
 
113
- const WalletDelegationView = () => {
114
- const { user, setShowAuthFlow } = useInternalDynamicContext();
35
+ const WalletDelegationView = ({ wallets, }) => {
36
+ const { setShowAuthFlow, handleLogOut } = useInternalDynamicContext();
37
+ const { user } = useDynamicContext();
115
38
  const appName = useAppName();
116
39
  const { userWallets } = useInternalUserWallets();
117
40
  const { delegateKeyShares } = useDynamicWaas();
41
+ const { requiresDelegation } = useWalletDelegation();
118
42
  const [selectedWallets, setSelectedWallets] = useState(new Set());
119
- // Get waas wallets that are not yet delegated
120
- const waasWallets = userWallets.filter((wallet) => wallet.connector.key.startsWith('dynamicwaas'));
43
+ const [showEditView, setShowEditView] = useState(false);
44
+ const [agreementChecked, setAgreementChecked] = useState(false);
45
+ const [selectionInitialized, setSelectionInitialized] = useState(false);
46
+ // Get waas wallets that are not yet delegated or use provided wallets override
47
+ const waasWallets = useMemo(() => {
48
+ const items = wallets && wallets.length > 0
49
+ ? wallets
50
+ : userWallets.filter((wallet) => wallet.connector.key.startsWith('dynamicwaas'));
51
+ const state = StorageService.getItem(DELEGATION_STATE) || { completed: {}, denied: {}, dismissed: false };
52
+ const userId = (user === null || user === void 0 ? void 0 : user.userId) || 'anonymous';
53
+ const deniedForUser = new Set(state.denied[userId] || []);
54
+ const completedForUser = new Set(state.completed[userId] || []);
55
+ return items.filter((wallet) => !deniedForUser.has(wallet.id) && !completedForUser.has(wallet.id));
56
+ }, [userWallets, wallets, user === null || user === void 0 ? void 0 : user.userId]);
57
+ // Auto-select wallets only on initial load
58
+ useEffect(() => {
59
+ if (selectionInitialized)
60
+ return;
61
+ if (waasWallets.length === 1) {
62
+ setSelectedWallets(new Set([waasWallets[0].id]));
63
+ setSelectionInitialized(true);
64
+ }
65
+ else if (waasWallets.length > 1) {
66
+ setSelectedWallets(new Set(waasWallets.map((w) => w.id)));
67
+ setSelectionInitialized(true);
68
+ }
69
+ }, [waasWallets, selectionInitialized]);
121
70
  const handleWalletToggle = (walletId, event) => {
122
71
  // Prevent event propagation if called from checkbox
123
72
  if (event) {
124
73
  event.stopPropagation();
125
74
  }
75
+ setSelectionInitialized(true);
126
76
  setSelectedWallets((prev) => {
127
77
  const newSet = new Set(prev);
128
78
  if (newSet.has(walletId)) {
@@ -135,11 +85,22 @@ const WalletDelegationView = () => {
135
85
  });
136
86
  };
137
87
  const handleSelectAll = () => {
88
+ setSelectionInitialized(true);
138
89
  setSelectedWallets(new Set(waasWallets.map((wallet) => wallet.id)));
139
90
  };
140
91
  const handleDeselectAll = () => {
92
+ setSelectionInitialized(true);
141
93
  setSelectedWallets(new Set());
142
94
  };
95
+ const persistDeniedWallets = () => {
96
+ const state = StorageService.getItem(DELEGATION_STATE) || { completed: {}, denied: {}, dismissed: false };
97
+ const userId = (user === null || user === void 0 ? void 0 : user.userId) || 'anonymous';
98
+ const existingForUser = new Set(state.denied[userId] || []);
99
+ selectedWallets.forEach((walletId) => existingForUser.add(walletId));
100
+ state.denied[userId] = Array.from(existingForUser);
101
+ StorageService.setItem(DELEGATION_STATE, state);
102
+ // No legacy mirrors; unified state only
103
+ };
143
104
  const { mutate: handleDelegateWallets, isLoading, error, data: isSuccess, } = useMutation(() => __awaiter(void 0, void 0, void 0, function* () {
144
105
  if (selectedWallets.size === 0) {
145
106
  throw new DynamicError('No wallets selected for delegation');
@@ -162,6 +123,14 @@ const WalletDelegationView = () => {
162
123
  }));
163
124
  // Wait for all delegations to complete
164
125
  yield Promise.all(delegationPromises);
126
+ // Persist completed delegations (unified state + legacy)
127
+ const state = StorageService.getItem(DELEGATION_STATE) || { completed: {}, denied: {}, dismissed: false };
128
+ const userId = (user === null || user === void 0 ? void 0 : user.userId) || 'anonymous';
129
+ const existingForUser = new Set(state.completed[userId] || []);
130
+ selectedWalletObjects.forEach((wallet) => existingForUser.add(wallet.id));
131
+ state.completed[userId] = Array.from(existingForUser);
132
+ StorageService.setItem(DELEGATION_STATE, state);
133
+ // No legacy mirrors; unified state only
165
134
  // Emit overall success event
166
135
  dynamicEvents.emit('embeddedWalletDelegationCompleted', selectedWalletObjects[0]);
167
136
  return true;
@@ -203,13 +172,38 @@ const WalletDelegationView = () => {
203
172
  // Error state content
204
173
  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
174
  // 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: t('dyn_wallet_delegation.approval_required') }), 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', {
175
+ 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
176
+ ? t('dyn_wallet_delegation.approval_required')
177
+ : 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
178
  appName,
208
179
  }) })] }) }));
209
- 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
180
+ // Single wallet view
181
+ const displaySingleWallet = () => {
182
+ const [wallet] = waasWallets;
183
+ if (!wallet)
184
+ return null;
185
+ return (jsxs("div", { className: 'embedded-delegated-view__wallet-card-container', children: [jsxs("div", { className: 'embedded-delegated-view__wallet-card', children: [jsx(Typography, { variant: 'body_normal', weight: 'medium', color: 'primary', children: t('dyn_wallet_delegation.my_wallet') }), jsxs("div", { className: 'embedded-delegated-view__wallet-address', children: [jsx("div", { className: 'embedded-delegated-view__wallet-address-dot' }), jsxs(Typography, { variant: 'body_small', color: 'secondary', children: [wallet.address.slice(0, 6), "...", wallet.address.slice(-4)] })] })] }), jsx(AgreementSection, { checked: agreementChecked, onToggle: () => setAgreementChecked(!agreementChecked), text: t('dyn_wallet_delegation.agreement_text') })] }));
186
+ };
187
+ // Multi-wallet initial view
188
+ const displayMultiWalletSummary = () => (jsxs("div", { className: 'embedded-delegated-view__wallet-card-container', children: [jsxs("div", { className: 'embedded-delegated-view__wallet-card', children: [jsxs("div", { style: { alignItems: 'baseline', display: 'flex', gap: '4px' }, children: [jsx(Typography, { variant: 'body_normal', weight: 'medium', color: 'primary', children: t(selectedWallets.size === waasWallets.length
189
+ ? 'dyn_wallet_delegation.all_wallets'
190
+ : 'dyn_wallet_delegation.selected_wallets') }), selectedWallets.size !== waasWallets.length && (jsx(Typography, { variant: 'body_normal', color: 'tertiary', children: selectedWallets.size.toString().padStart(2, '0') }))] }), jsx("button", { onClick: () => setShowEditView(true), className: 'embedded-delegated-view__edit-selections-button', children: jsx(Typography, { variant: 'body_small', color: 'secondary', children: t('dyn_wallet_delegation.edit_selections') }) })] }), jsx(AgreementSection, { checked: agreementChecked, onToggle: () => setAgreementChecked(!agreementChecked), text: t('dyn_wallet_delegation.agreement_text') })] }));
191
+ // Edit view (full wallet selection)
192
+ const displayWaasWallets = () => (jsxs("div", { className: 'embedded-delegated-view__wallet-selection', children: [jsxs("div", { className: 'embedded-delegated-view__wallet-selection__header', children: [jsxs("div", { style: { display: 'flex', gap: '4px' }, children: [jsx(Typography, { variant: 'body_small', color: 'secondary', children: t('dyn_wallet_delegation.selected_wallets') }), jsx(Typography, { variant: 'body_small', color: 'tertiary', children: selectedWallets.size.toString().padStart(2, '0') })] }), jsx("button", { onClick: selectedWallets.size === waasWallets.length
210
193
  ? handleDeselectAll
211
- : 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
- const closeButton = (jsx(IconButton, { onClick: () => {
194
+ : handleSelectAll, className: 'embedded-delegated-view__wallet-selection__deselect-all', children: jsx(Typography, { variant: 'body_small', color: 'tertiary', 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${selectedWallets.has(wallet.id)
195
+ ? ' embedded-delegated-view__wallet-item--selected'
196
+ : ''}`, onClick: () => handleWalletToggle(wallet.id), children: jsxs("div", { className: 'embedded-delegated-view__wallet-item__content', 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: (e) => e.stopPropagation(), value: wallet.id }) })] }) }, wallet.id))) })] }));
197
+ const navigationButton = showEditView ? (jsx(IconButton, { onClick: () => {
198
+ setShowEditView(false);
199
+ // Reset agreement when coming back from edit view
200
+ setAgreementChecked(false);
201
+ }, type: 'button', children: jsx(SvgArrowLeft, {}) })) : (jsx(IconButton, { onClick: () => {
202
+ // Mark prompt as dismissed until logout (unified state + legacy)
203
+ const state = StorageService.getItem(DELEGATION_STATE) || { completed: {}, denied: {}, dismissed: false };
204
+ state.dismissed = true;
205
+ StorageService.setItem(DELEGATION_STATE, state);
206
+ // No legacy mirror; unified state only
213
207
  setShowAuthFlow(false);
214
208
  }, type: 'button', children: jsx(SvgClose, {}) }));
215
209
  // Determine which content to show based on state
@@ -244,18 +238,64 @@ const WalletDelegationView = () => {
244
238
  width: '100%',
245
239
  }, className: 'embedded-delegated-view__body__button', expanded: true, children: t('dyn_wallet_delegation.try_again_button') }));
246
240
  }
241
+ // If in edit view, show Done button
242
+ if (showEditView) {
243
+ return (jsx(TypographyButton, { buttonPadding: 'medium', buttonVariant: 'secondary', typographyProps: {
244
+ color: 'primary',
245
+ weight: 'medium',
246
+ }, onClick: () => {
247
+ setShowEditView(false);
248
+ setAgreementChecked(false);
249
+ }, dataTestId: 'embedded-delegation-done-button', copykey: 'dyn_wallet_delegation.done_button', style: {
250
+ backgroundColor: 'white',
251
+ border: '1px solid var(--dynamic-base-4)',
252
+ width: '100%',
253
+ }, className: 'embedded-delegated-view__body__button', expanded: true, children: t('dyn_wallet_delegation.done_button') }));
254
+ }
247
255
  return (jsxs(Fragment, { children: [jsx(TypographyButton, { buttonPadding: 'medium', buttonVariant: 'brand-primary', typographyProps: {
248
256
  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: {
257
+ }, onClick: () => handleDelegateWallets(), loading: isLoading, disabled: selectedWallets.size === 0 || !agreementChecked, 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: {
258
+ color: 'primary',
259
+ weight: 'bold',
260
+ }, onClick: () => {
261
+ persistDeniedWallets();
262
+ setShowAuthFlow(false);
263
+ }, dataTestId: 'embedded-delegation-deny-button', copykey: 'dyn_wallet_delegation.deny_button', style: {
264
+ backgroundColor: 'white',
265
+ border: '1px solid var(--dynamic-base-4)',
266
+ width: '100%',
267
+ }, 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
268
  color: 'primary',
251
269
  weight: 'bold',
252
- }, onClick: () => setShowAuthFlow(false), dataTestId: 'embedded-delegation-deny-button', copykey: 'dyn_wallet_delegation.deny_button', style: {
270
+ }, onClick: () => {
271
+ handleLogOut();
272
+ }, dataTestId: 'embedded-delegation-logout-button', copykey: 'dyn_wallet_delegation.logout_button', style: {
253
273
  backgroundColor: 'white',
254
274
  border: '1px solid var(--dynamic-base-4)',
255
275
  width: '100%',
256
- }, className: 'embedded-delegated-view__body__button embedded-delegated-view__body__deny-button', expanded: true, children: t('dyn_wallet_delegation.deny_button') }))] }));
276
+ }, className: 'embedded-delegated-view__body__button embedded-delegated-view__body__logout-button', expanded: true, children: t('dyn_wallet_delegation.logout_button') }))] }));
257
277
  };
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() })] }) })] }));
278
+ // Header configuration
279
+ let headerLeading;
280
+ if (showEditView) {
281
+ headerLeading = navigationButton;
282
+ }
283
+ else if (!requiresDelegation) {
284
+ headerLeading = navigationButton;
285
+ }
286
+ else {
287
+ headerLeading = undefined;
288
+ }
289
+ const headerChildren = showEditView ? (jsx(Typography, { variant: 'body_normal', weight: 'bold', color: 'primary', children: t('dyn_wallet_delegation.edit_wallets_to_delegate') })) : undefined;
290
+ return (jsxs(Fragment, { children: [jsx(ModalHeader, { leading: headerLeading, children: headerChildren }), jsx("div", { className: 'embedded-delegated-view', children: jsxs("div", { className: 'embedded-delegated-view__body', children: [!showEditView && getContentHeader(), errorText && jsx(ErrorContainer, { children: errorText }), !isLoading && !isSuccess && !error && (jsx("div", { className: 'embedded-delegated-view__body__card', children: (() => {
291
+ if (showEditView)
292
+ return displayWaasWallets();
293
+ if (waasWallets.length === 1)
294
+ return displaySingleWallet();
295
+ if (waasWallets.length > 1)
296
+ return displayMultiWalletSummary();
297
+ return null;
298
+ })() })), jsx("div", { className: 'embedded-delegated-view__body__button_section', children: getButtons() })] }) })] }));
259
299
  };
260
300
 
261
301
  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
  }>;
@@ -12,6 +12,7 @@ var ManagePasskeysWidgetView = require('../../views/ManagePasskeysWidgetView/Man
12
12
  var SettingsView = require('../../views/SettingsView/SettingsView.cjs');
13
13
  var AccountAndSecuritySettingsView = require('../../views/AccountAndSecuritySettingsView/AccountAndSecuritySettingsView.cjs');
14
14
  var SessionManagementView = require('../../views/SessionManagementView/SessionManagementView.cjs');
15
+ var WalletsDelegatedSettingsView = require('../../views/WalletsDelegatedSettingsView/WalletsDelegatedSettingsView.cjs');
15
16
  var ChooseLinkedWalletView = require('../../views/ChooseLinkedWalletView/ChooseLinkedWalletView.cjs');
16
17
  var ChooseOnrampProviderView = require('../../views/ChooseOnrampProviderView/ChooseOnrampProviderView.cjs');
17
18
  var ChooseWalletFundingMethod = require('../../views/ChooseWalletFundingMethod/ChooseWalletFundingMethod.cjs');
@@ -51,6 +52,7 @@ const mapViewToComponent = {
51
52
  settings: SettingsView.SettingsView,
52
53
  'wallet-delegation': WalletDelegationView.WalletDelegationView,
53
54
  wallets: WalletsView.WalletsView,
55
+ 'wallets-delegated-settings': WalletsDelegatedSettingsView.WalletsDelegatedSettingsView,
54
56
  };
55
57
 
56
58
  exports.mapViewToComponent = mapViewToComponent;
@@ -32,6 +32,9 @@ 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;
39
+ 'wallets-delegated-settings': import("react").FC<import("../../views/WalletsDelegatedSettingsView/WalletsDelegatedSettingsView").WalletsDelegatedSettingsViewProps>;
37
40
  };
@@ -8,6 +8,7 @@ import { ManagePasskeysWidgetView } from '../../views/ManagePasskeysWidgetView/M
8
8
  import { SettingsView } from '../../views/SettingsView/SettingsView.js';
9
9
  import { AccountAndSecuritySettingsView } from '../../views/AccountAndSecuritySettingsView/AccountAndSecuritySettingsView.js';
10
10
  import { SessionManagementView } from '../../views/SessionManagementView/SessionManagementView.js';
11
+ import { WalletsDelegatedSettingsView } from '../../views/WalletsDelegatedSettingsView/WalletsDelegatedSettingsView.js';
11
12
  import { ChooseLinkedWalletView } from '../../views/ChooseLinkedWalletView/ChooseLinkedWalletView.js';
12
13
  import { ChooseOnrampProviderView } from '../../views/ChooseOnrampProviderView/ChooseOnrampProviderView.js';
13
14
  import { ChooseWalletFundingMethod } from '../../views/ChooseWalletFundingMethod/ChooseWalletFundingMethod.js';
@@ -47,6 +48,7 @@ const mapViewToComponent = {
47
48
  settings: SettingsView,
48
49
  'wallet-delegation': WalletDelegationView,
49
50
  wallets: WalletsView,
51
+ 'wallets-delegated-settings': WalletsDelegatedSettingsView,
50
52
  };
51
53
 
52
54
  export { mapViewToComponent };
@@ -13,7 +13,7 @@ export declare const DynamicSessionManagementViews: readonly ["session-managemen
13
13
  export type DynamicSessionManagementViewsType = typeof DynamicSessionManagementViews[number];
14
14
  export declare const DynamicTransactionsWidgetViews: readonly ["send-balance"];
15
15
  export type DynamicTransactionsWidgetViewsType = typeof DynamicTransactionsWidgetViews[number];
16
- export type DynamicWidgetViews = 'wallets' | 'profile' | 'edit-profile' | 'choose-wallet-funding-method' | 'receive-wallet-funds' | 'deposited-exchange' | 'receive-exchange-funds' | DynamicTransactionsWidgetViewsType | DynamicPasskeyWidgetViewsType | DynamicMfaWidgetViewsType | DynamicSettingsType | DynamicGlobalWalletType | DynamicSessionManagementViewsType | 'connected-apps' | 'deposit-view' | 'confirm-exchange-transfer' | 'choose-onramp-provider' | 'choose-linked-wallet' | 'wallet-delegation';
16
+ export type DynamicWidgetViews = 'wallets' | 'profile' | 'edit-profile' | 'choose-wallet-funding-method' | 'receive-wallet-funds' | 'deposited-exchange' | 'receive-exchange-funds' | DynamicTransactionsWidgetViewsType | DynamicPasskeyWidgetViewsType | DynamicMfaWidgetViewsType | DynamicSettingsType | DynamicGlobalWalletType | DynamicSessionManagementViewsType | 'connected-apps' | 'deposit-view' | 'confirm-exchange-transfer' | 'choose-onramp-provider' | 'choose-linked-wallet' | 'wallet-delegation' | 'wallets-delegated-settings';
17
17
  export type DynamicWidgetViewMapConstraint = Record<DynamicWidgetViews, FC<any>>;
18
18
  export type DynamicWidgetViewMap = typeof mapViewToComponent;
19
19
  export type SetDynamicWidgetView = <T extends DynamicWidgetViews>(view: T, props?: ComponentProps<DynamicWidgetViewMap[T]>) => void;
@@ -35,7 +35,6 @@ require('@dynamic-labs-sdk/client/core');
35
35
  require('../../../../client/client.cjs');
36
36
  require('@dynamic-labs-sdk/client');
37
37
  require('../../../../config/ApiEndpoint.cjs');
38
- var useProjectSettings = require('../../../../client/extension/projectSettings/useProjectSettings/useProjectSettings.cjs');
39
38
  require('../../../../locale/locale.cjs');
40
39
  require('../../../../store/state/dynamicContextProps/dynamicContextProps.cjs');
41
40
  require('../../../../store/state/primaryWalletId/primaryWalletId.cjs');
@@ -90,7 +89,6 @@ require('../../components/PasskeyCard/PasskeyCard.cjs');
90
89
  require('../../../../context/OnrampContext/OnrampContext.cjs');
91
90
  require('../../../../../index.cjs');
92
91
  require('../../helpers/convertExchangeKeyAndProviderEnum.cjs');
93
- var EmbeddedDelegatedSection = require('./EmbeddedDelegatedSection/EmbeddedDelegatedSection.cjs');
94
92
  require('qrcode');
95
93
  require('../ReceiveWalletFunds/ReceiveWalletFunds.cjs');
96
94
  require('../../../../context/IpConfigurationContext/IpConfigurationContext.cjs');
@@ -110,16 +108,14 @@ require('../../../../components/Popper/Popper/Popper.cjs');
110
108
  require('../../../../components/Popper/PopperContext/PopperContext.cjs');
111
109
 
112
110
  const ConnectedAppsView = ({ name }) => {
113
- var _a, _b, _c, _d;
111
+ var _a;
114
112
  const { t } = reactI18next.useTranslation();
115
113
  const { setDynamicWidgetView } = DynamicWidgetContext.useWidgetContext();
116
114
  const { primaryWallet } = useDynamicContext.useDynamicContext();
117
115
  const [connectedApps, setConnectedApps] = React.useState([]);
118
116
  const [refreshing, setRefreshing] = React.useState(false);
119
117
  const [showSuccessMessage, setShowSuccessMessage] = React.useState(false);
120
- const projectSettings = useProjectSettings.useProjectSettings();
121
118
  const { globalWallet } = (_a = primaryWallet === null || primaryWallet === void 0 ? void 0 : primaryWallet.connector) !== null && _a !== void 0 ? _a : {};
122
- const isWalletDelegationEnabled = (_d = (_c = (_b = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.sdk) === null || _b === void 0 ? void 0 : _b.waas) === null || _c === void 0 ? void 0 : _c.delegatedAccess) === null || _d === void 0 ? void 0 : _d.enabled;
123
119
  React.useEffect(() => {
124
120
  const fetchConnectedApps = () => _tslib.__awaiter(void 0, void 0, void 0, function* () {
125
121
  try {
@@ -187,7 +183,7 @@ const ConnectedAppsView = ({ name }) => {
187
183
  }, dataTestId: 'open-app-button' }), jsxRuntime.jsx(TypographyButton.TypographyButton, { onClick: () => handleDisconnect(app.topic), buttonVariant: 'tertiary', buttonPadding: 'none', startSlot: jsxRuntime.jsx(unlink.ReactComponent, {}), typographyProps: {
188
184
  color: 'secondary',
189
185
  variant: 'button_secondary',
190
- } })] })] }, app.url))) })), showSuccessMessage && (jsxRuntime.jsxs("div", { className: 'success-message', children: [jsxRuntime.jsx(check.ReactComponent, {}), jsxRuntime.jsx(Typography.Typography, { variant: 'body_small', color: 'primary', copykey: 'global_wallet.connected_apps.success', children: t('global_wallet.connected_apps.success', { name }) })] })), isWalletDelegationEnabled && jsxRuntime.jsx(EmbeddedDelegatedSection.EmbeddedDelegatedSection, {})] }));
186
+ } })] })] }, app.url))) })), showSuccessMessage && (jsxRuntime.jsxs("div", { className: 'success-message', children: [jsxRuntime.jsx(check.ReactComponent, {}), jsxRuntime.jsx(Typography.Typography, { variant: 'body_small', color: 'primary', copykey: 'global_wallet.connected_apps.success', children: t('global_wallet.connected_apps.success', { name }) })] }))] }));
191
187
  };
192
188
 
193
189
  exports.ConnectedAppsView = ConnectedAppsView;
@@ -31,7 +31,6 @@ import '@dynamic-labs-sdk/client/core';
31
31
  import '../../../../client/client.js';
32
32
  import '@dynamic-labs-sdk/client';
33
33
  import '../../../../config/ApiEndpoint.js';
34
- import { useProjectSettings } from '../../../../client/extension/projectSettings/useProjectSettings/useProjectSettings.js';
35
34
  import '../../../../locale/locale.js';
36
35
  import '../../../../store/state/dynamicContextProps/dynamicContextProps.js';
37
36
  import '../../../../store/state/primaryWalletId/primaryWalletId.js';
@@ -86,7 +85,6 @@ import '../../components/PasskeyCard/PasskeyCard.js';
86
85
  import '../../../../context/OnrampContext/OnrampContext.js';
87
86
  import '../../../../../index.js';
88
87
  import '../../helpers/convertExchangeKeyAndProviderEnum.js';
89
- import { EmbeddedDelegatedSection } from './EmbeddedDelegatedSection/EmbeddedDelegatedSection.js';
90
88
  import 'qrcode';
91
89
  import '../ReceiveWalletFunds/ReceiveWalletFunds.js';
92
90
  import '../../../../context/IpConfigurationContext/IpConfigurationContext.js';
@@ -106,16 +104,14 @@ import '../../../../components/Popper/Popper/Popper.js';
106
104
  import '../../../../components/Popper/PopperContext/PopperContext.js';
107
105
 
108
106
  const ConnectedAppsView = ({ name }) => {
109
- var _a, _b, _c, _d;
107
+ var _a;
110
108
  const { t } = useTranslation();
111
109
  const { setDynamicWidgetView } = useWidgetContext();
112
110
  const { primaryWallet } = useDynamicContext();
113
111
  const [connectedApps, setConnectedApps] = useState([]);
114
112
  const [refreshing, setRefreshing] = useState(false);
115
113
  const [showSuccessMessage, setShowSuccessMessage] = useState(false);
116
- const projectSettings = useProjectSettings();
117
114
  const { globalWallet } = (_a = primaryWallet === null || primaryWallet === void 0 ? void 0 : primaryWallet.connector) !== null && _a !== void 0 ? _a : {};
118
- const isWalletDelegationEnabled = (_d = (_c = (_b = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.sdk) === null || _b === void 0 ? void 0 : _b.waas) === null || _c === void 0 ? void 0 : _c.delegatedAccess) === null || _d === void 0 ? void 0 : _d.enabled;
119
115
  useEffect(() => {
120
116
  const fetchConnectedApps = () => __awaiter(void 0, void 0, void 0, function* () {
121
117
  try {
@@ -183,7 +179,7 @@ const ConnectedAppsView = ({ name }) => {
183
179
  }, dataTestId: 'open-app-button' }), jsx(TypographyButton, { onClick: () => handleDisconnect(app.topic), buttonVariant: 'tertiary', buttonPadding: 'none', startSlot: jsx(SvgUnlink, {}), typographyProps: {
184
180
  color: 'secondary',
185
181
  variant: 'button_secondary',
186
- } })] })] }, app.url))) })), showSuccessMessage && (jsxs("div", { className: 'success-message', children: [jsx(SvgCheck, {}), jsx(Typography, { variant: 'body_small', color: 'primary', copykey: 'global_wallet.connected_apps.success', children: t('global_wallet.connected_apps.success', { name }) })] })), isWalletDelegationEnabled && jsx(EmbeddedDelegatedSection, {})] }));
182
+ } })] })] }, app.url))) })), showSuccessMessage && (jsxs("div", { className: 'success-message', children: [jsx(SvgCheck, {}), jsx(Typography, { variant: 'body_small', color: 'primary', copykey: 'global_wallet.connected_apps.success', children: t('global_wallet.connected_apps.success', { name }) })] }))] }));
187
183
  };
188
184
 
189
185
  export { ConnectedAppsView, ConnectedAppsView as default };
@@ -16,6 +16,7 @@ var accountAndSecurity = require('../../../../shared/assets/account-and-security
16
16
  var chevronLeft = require('../../../../shared/assets/chevron-left.cjs');
17
17
  var connectedApps = require('../../../../shared/assets/connected-apps.cjs');
18
18
  var ViewContext = require('../../../../context/ViewContext/ViewContext.cjs');
19
+ var connect = require('../../../../shared/assets/connect.cjs');
19
20
  require('../../../../shared/logger.cjs');
20
21
  require('@dynamic-labs/wallet-book');
21
22
  require('@dynamic-labs/utils');
@@ -96,6 +97,7 @@ require('../../../../context/FooterAnimationContext/index.cjs');
96
97
  require('../../../../views/MfaChooseDeviceView/useGetMfaOptions/useGetMfaOptions.cjs');
97
98
  require('../../../../context/PasskeyContext/PasskeyContext.cjs');
98
99
  require('../../../../context/OnrampContext/OnrampContext.cjs');
100
+ var useWalletDelegation = require('../../../../utils/hooks/useWalletDelegation/useWalletDelegation.cjs');
99
101
  require('../../../../store/state/sendBalances.cjs');
100
102
  require('../../../../store/state/connectorsInitializing/connectorsInitializing.cjs');
101
103
  require('../../../../components/OverlayCardBase/OverlayCardTarget/OverlayCardTarget.cjs');
@@ -119,11 +121,25 @@ const SettingsView = () => {
119
121
  const { globalWallet } =
120
122
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
121
123
  (_a = primaryWallet === null || primaryWallet === void 0 ? void 0 : primaryWallet.connector) !== null && _a !== void 0 ? _a : {};
124
+ const { delegatedAccessEnabled, shouldPromptWalletDelegation, initDelegationProcess, } = useWalletDelegation.useWalletDelegation();
122
125
  const { setDynamicWidgetView } = DynamicWidgetContext.useWidgetContext();
123
126
  const { t } = reactI18next.useTranslation();
124
127
  const handleConnectedAppsClick = React.useCallback(() => {
125
128
  setDynamicWidgetView('connected-apps');
126
129
  }, [setDynamicWidgetView]);
130
+ const handleWalletsDelegatedClick = React.useCallback(() => {
131
+ const shouldPrompt = shouldPromptWalletDelegation();
132
+ if (shouldPrompt) {
133
+ initDelegationProcess();
134
+ }
135
+ else {
136
+ setDynamicWidgetView('wallets-delegated-settings');
137
+ }
138
+ }, [
139
+ setDynamicWidgetView,
140
+ shouldPromptWalletDelegation,
141
+ initDelegationProcess,
142
+ ]);
127
143
  const handleAccountSecurityClick = React.useCallback(() => {
128
144
  setDynamicWidgetView('account-and-security-settings');
129
145
  }, [setDynamicWidgetView]);
@@ -145,7 +161,7 @@ const SettingsView = () => {
145
161
  isEmbeddedWallet ||
146
162
  isV3WaasWallet ||
147
163
  isZKSyncEnabled.isZKSyncEnabled(projectSettings);
148
- return (jsxRuntime.jsxs("div", { className: 'settings-view', children: [jsxRuntime.jsx("div", { className: 'settings-view__body', children: shouldShowAccountAndSecuritySettings || globalWallet ? (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsxs("div", { className: 'settings-view__body__section', children: [(shouldShowAccountAndSecuritySettings || globalWallet) && (jsxRuntime.jsx("div", { className: 'settings-view__body__section__title', children: jsxRuntime.jsx(Typography.Typography, { copykey: 'dyn_settings.general_section.title', color: 'secondary', weight: 'medium', children: t('dyn_settings.general_section.title', 'General') }) })), shouldShowAccountAndSecuritySettings && (jsxRuntime.jsx(TypographyButton.TypographyButton, { dataTestId: 'account-and-security-button', buttonClassName: 'settings-view__body__section__button', onClick: handleAccountSecurityClick, startSlot: jsxRuntime.jsxs("div", { className: 'settings-view__body__section__button__start-slot', children: [jsxRuntime.jsx(accountAndSecurity.ReactComponent, { className: 'settings-view__body__section__button__icon' }), jsxRuntime.jsx(Typography.Typography, { color: 'primary', weight: 'medium', copykey: 'dyn_settings.account_security.title', children: t('dyn_settings.account_security.title') })] }), endSlot: jsxRuntime.jsx(chevronLeft.ReactComponent, { className: 'settings-view__body__section__button__icon-secondary--rotate' }), showInternalLoading: false }))] }), globalWallet && (jsxRuntime.jsxs("div", { className: 'settings-view__body__section', children: [jsxRuntime.jsx("div", { className: 'settings-view__body__section__title', children: jsxRuntime.jsx(Typography.Typography, { copykey: 'dyn_settings.global_connectivity_section.title', color: 'secondary', weight: 'medium', children: t('dyn_settings.global_connectivity_section.title') }) }), jsxRuntime.jsx(TypographyButton.TypographyButton, { onClick: handleConnectedAppsClick, dataTestId: 'connected-apps-button', buttonClassName: 'settings-view__body__section__button', startSlot: jsxRuntime.jsxs("div", { className: 'settings-view__body__section__button__start-slot', children: [jsxRuntime.jsx(connectedApps.ReactComponent, { className: 'settings-view__body__section__button__icon' }), jsxRuntime.jsx(Typography.Typography, { color: 'primary', weight: 'medium', copykey: 'dyn_settings.global_connectivity_section.connected_apps_button', children: t('dyn_settings.global_connectivity_section.connected_apps_button') })] }), endSlot: jsxRuntime.jsx(chevronLeft.ReactComponent, { className: 'settings-view__body__section__button__icon-secondary--rotate' }), showInternalLoading: false })] }))] })) : (jsxRuntime.jsx(EmptyScreen.EmptyScreen, {})) }), jsxRuntime.jsx("div", { className: 'settings-view__logout-button-container', children: jsxRuntime.jsx(TypographyButton.TypographyButton, { buttonClassName: 'settings-view__logout-button-container__button', onClick: handleLogOut, dataTestId: 'logout-button', copykey: 'dyn_settings.buttonLogout', children: t('dyn_settings.button_logout') }) }), !shouldShowAccountAndSecuritySettings && (jsxRuntime.jsx("div", { className: 'settings-view__delete-account-container', children: jsxRuntime.jsx(Typography.Typography, { onClick: handleDeleteAccountClick, "data-testid": 'delete-account-button', copykey: 'dyn_settings.delete_account.title', color: 'error-1', variant: 'body_small', className: 'settings-view__delete-account-container__delete-button', weight: 'medium', children: t('dyn_settings.delete_account.title') }) }))] }));
164
+ return (jsxRuntime.jsxs("div", { className: 'settings-view', children: [jsxRuntime.jsx("div", { className: 'settings-view__body', children: shouldShowAccountAndSecuritySettings || globalWallet ? (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsxs("div", { className: 'settings-view__body__section', children: [(shouldShowAccountAndSecuritySettings || globalWallet) && (jsxRuntime.jsx("div", { className: 'settings-view__body__section__title', children: jsxRuntime.jsx(Typography.Typography, { copykey: 'dyn_settings.general_section.title', color: 'secondary', weight: 'medium', children: t('dyn_settings.general_section.title', 'General') }) })), shouldShowAccountAndSecuritySettings && (jsxRuntime.jsx(TypographyButton.TypographyButton, { dataTestId: 'account-and-security-button', buttonClassName: 'settings-view__body__section__button', onClick: handleAccountSecurityClick, startSlot: jsxRuntime.jsxs("div", { className: 'settings-view__body__section__button__start-slot', children: [jsxRuntime.jsx(accountAndSecurity.ReactComponent, { className: 'settings-view__body__section__button__icon' }), jsxRuntime.jsx(Typography.Typography, { color: 'primary', weight: 'medium', copykey: 'dyn_settings.account_security.title', children: t('dyn_settings.account_security.title') })] }), endSlot: jsxRuntime.jsx(chevronLeft.ReactComponent, { className: 'settings-view__body__section__button__icon-secondary--rotate' }), showInternalLoading: false }))] }), globalWallet && (jsxRuntime.jsxs("div", { className: 'settings-view__body__section', children: [jsxRuntime.jsx("div", { className: 'settings-view__body__section__title', children: jsxRuntime.jsx(Typography.Typography, { copykey: 'dyn_settings.global_connectivity_section.title', color: 'secondary', weight: 'medium', children: t('dyn_settings.global_connectivity_section.title') }) }), jsxRuntime.jsx(TypographyButton.TypographyButton, { onClick: handleConnectedAppsClick, dataTestId: 'connected-apps-button', buttonClassName: 'settings-view__body__section__button', startSlot: jsxRuntime.jsxs("div", { className: 'settings-view__body__section__button__start-slot', children: [jsxRuntime.jsx(connectedApps.ReactComponent, { className: 'settings-view__body__section__button__icon' }), jsxRuntime.jsx(Typography.Typography, { color: 'primary', weight: 'medium', copykey: 'dyn_settings.global_connectivity_section.connected_apps_button', children: t('dyn_settings.global_connectivity_section.connected_apps_button') })] }), endSlot: jsxRuntime.jsx(chevronLeft.ReactComponent, { className: 'settings-view__body__section__button__icon-secondary--rotate' }), showInternalLoading: false })] })), delegatedAccessEnabled && (jsxRuntime.jsxs("div", { className: 'settings-view__body__section', children: [jsxRuntime.jsx("div", { className: 'settings-view__body__section__title', children: jsxRuntime.jsx(Typography.Typography, { copykey: 'dyn_settings.account_permissions_section.title', color: 'secondary', weight: 'medium', children: t('dyn_settings.account_permissions_section.title') }) }), jsxRuntime.jsx(TypographyButton.TypographyButton, { onClick: handleWalletsDelegatedClick, dataTestId: 'wallets-delegated-settings-button', buttonClassName: 'settings-view__body__section__button', startSlot: jsxRuntime.jsxs("div", { className: 'settings-view__body__section__button__start-slot', children: [jsxRuntime.jsx(connect.ReactComponent, { className: 'settings-view__body__section__button__icon' }), jsxRuntime.jsx(Typography.Typography, { color: 'primary', weight: 'medium', copykey: 'dyn_settings.account_permissions_section.delegated_wallets_button', children: t('dyn_settings.account_permissions_section.delegated_wallets_button') })] }), endSlot: jsxRuntime.jsx(chevronLeft.ReactComponent, { className: 'settings-view__body__section__button__icon-secondary--rotate' }), showInternalLoading: false })] }))] })) : (jsxRuntime.jsx(EmptyScreen.EmptyScreen, {})) }), jsxRuntime.jsx("div", { className: 'settings-view__logout-button-container', children: jsxRuntime.jsx(TypographyButton.TypographyButton, { buttonClassName: 'settings-view__logout-button-container__button', onClick: handleLogOut, dataTestId: 'logout-button', copykey: 'dyn_settings.buttonLogout', children: t('dyn_settings.button_logout') }) }), !shouldShowAccountAndSecuritySettings && (jsxRuntime.jsx("div", { className: 'settings-view__delete-account-container', children: jsxRuntime.jsx(Typography.Typography, { onClick: handleDeleteAccountClick, "data-testid": 'delete-account-button', copykey: 'dyn_settings.delete_account.title', color: 'error-1', variant: 'body_small', className: 'settings-view__delete-account-container__delete-button', weight: 'medium', children: t('dyn_settings.delete_account.title') }) }))] }));
149
165
  };
150
166
 
151
167
  exports.SettingsView = SettingsView;