@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
@@ -12,6 +12,7 @@ import { ReactComponent as SvgAccountAndSecurity } from '../../../../shared/asse
12
12
  import { ReactComponent as SvgChevronLeft } from '../../../../shared/assets/chevron-left.js';
13
13
  import { ReactComponent as SvgConnectedApps } from '../../../../shared/assets/connected-apps.js';
14
14
  import { useViewContext } from '../../../../context/ViewContext/ViewContext.js';
15
+ import { ReactComponent as SvgConnect } from '../../../../shared/assets/connect.js';
15
16
  import '../../../../shared/logger.js';
16
17
  import '@dynamic-labs/wallet-book';
17
18
  import '@dynamic-labs/utils';
@@ -92,6 +93,7 @@ import '../../../../context/FooterAnimationContext/index.js';
92
93
  import '../../../../views/MfaChooseDeviceView/useGetMfaOptions/useGetMfaOptions.js';
93
94
  import '../../../../context/PasskeyContext/PasskeyContext.js';
94
95
  import '../../../../context/OnrampContext/OnrampContext.js';
96
+ import { useWalletDelegation } from '../../../../utils/hooks/useWalletDelegation/useWalletDelegation.js';
95
97
  import '../../../../store/state/sendBalances.js';
96
98
  import '../../../../store/state/connectorsInitializing/connectorsInitializing.js';
97
99
  import '../../../../components/OverlayCardBase/OverlayCardTarget/OverlayCardTarget.js';
@@ -115,11 +117,25 @@ const SettingsView = () => {
115
117
  const { globalWallet } =
116
118
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
117
119
  (_a = primaryWallet === null || primaryWallet === void 0 ? void 0 : primaryWallet.connector) !== null && _a !== void 0 ? _a : {};
120
+ const { delegatedAccessEnabled, shouldPromptWalletDelegation, initDelegationProcess, } = useWalletDelegation();
118
121
  const { setDynamicWidgetView } = useWidgetContext();
119
122
  const { t } = useTranslation();
120
123
  const handleConnectedAppsClick = useCallback(() => {
121
124
  setDynamicWidgetView('connected-apps');
122
125
  }, [setDynamicWidgetView]);
126
+ const handleWalletsDelegatedClick = useCallback(() => {
127
+ const shouldPrompt = shouldPromptWalletDelegation();
128
+ if (shouldPrompt) {
129
+ initDelegationProcess();
130
+ }
131
+ else {
132
+ setDynamicWidgetView('wallets-delegated-settings');
133
+ }
134
+ }, [
135
+ setDynamicWidgetView,
136
+ shouldPromptWalletDelegation,
137
+ initDelegationProcess,
138
+ ]);
123
139
  const handleAccountSecurityClick = useCallback(() => {
124
140
  setDynamicWidgetView('account-and-security-settings');
125
141
  }, [setDynamicWidgetView]);
@@ -141,7 +157,7 @@ const SettingsView = () => {
141
157
  isEmbeddedWallet ||
142
158
  isV3WaasWallet ||
143
159
  isZKSyncEnabled(projectSettings);
144
- return (jsxs("div", { className: 'settings-view', children: [jsx("div", { className: 'settings-view__body', children: shouldShowAccountAndSecuritySettings || globalWallet ? (jsxs(Fragment, { children: [jsxs("div", { className: 'settings-view__body__section', children: [(shouldShowAccountAndSecuritySettings || globalWallet) && (jsx("div", { className: 'settings-view__body__section__title', children: jsx(Typography, { copykey: 'dyn_settings.general_section.title', color: 'secondary', weight: 'medium', children: t('dyn_settings.general_section.title', 'General') }) })), shouldShowAccountAndSecuritySettings && (jsx(TypographyButton, { dataTestId: 'account-and-security-button', buttonClassName: 'settings-view__body__section__button', onClick: handleAccountSecurityClick, startSlot: jsxs("div", { className: 'settings-view__body__section__button__start-slot', children: [jsx(SvgAccountAndSecurity, { className: 'settings-view__body__section__button__icon' }), jsx(Typography, { color: 'primary', weight: 'medium', copykey: 'dyn_settings.account_security.title', children: t('dyn_settings.account_security.title') })] }), endSlot: jsx(SvgChevronLeft, { className: 'settings-view__body__section__button__icon-secondary--rotate' }), showInternalLoading: false }))] }), globalWallet && (jsxs("div", { className: 'settings-view__body__section', children: [jsx("div", { className: 'settings-view__body__section__title', children: jsx(Typography, { copykey: 'dyn_settings.global_connectivity_section.title', color: 'secondary', weight: 'medium', children: t('dyn_settings.global_connectivity_section.title') }) }), jsx(TypographyButton, { onClick: handleConnectedAppsClick, dataTestId: 'connected-apps-button', buttonClassName: 'settings-view__body__section__button', startSlot: jsxs("div", { className: 'settings-view__body__section__button__start-slot', children: [jsx(SvgConnectedApps, { className: 'settings-view__body__section__button__icon' }), jsx(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: jsx(SvgChevronLeft, { className: 'settings-view__body__section__button__icon-secondary--rotate' }), showInternalLoading: false })] }))] })) : (jsx(EmptyScreen, {})) }), jsx("div", { className: 'settings-view__logout-button-container', children: jsx(TypographyButton, { buttonClassName: 'settings-view__logout-button-container__button', onClick: handleLogOut, dataTestId: 'logout-button', copykey: 'dyn_settings.buttonLogout', children: t('dyn_settings.button_logout') }) }), !shouldShowAccountAndSecuritySettings && (jsx("div", { className: 'settings-view__delete-account-container', children: jsx(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') }) }))] }));
160
+ return (jsxs("div", { className: 'settings-view', children: [jsx("div", { className: 'settings-view__body', children: shouldShowAccountAndSecuritySettings || globalWallet ? (jsxs(Fragment, { children: [jsxs("div", { className: 'settings-view__body__section', children: [(shouldShowAccountAndSecuritySettings || globalWallet) && (jsx("div", { className: 'settings-view__body__section__title', children: jsx(Typography, { copykey: 'dyn_settings.general_section.title', color: 'secondary', weight: 'medium', children: t('dyn_settings.general_section.title', 'General') }) })), shouldShowAccountAndSecuritySettings && (jsx(TypographyButton, { dataTestId: 'account-and-security-button', buttonClassName: 'settings-view__body__section__button', onClick: handleAccountSecurityClick, startSlot: jsxs("div", { className: 'settings-view__body__section__button__start-slot', children: [jsx(SvgAccountAndSecurity, { className: 'settings-view__body__section__button__icon' }), jsx(Typography, { color: 'primary', weight: 'medium', copykey: 'dyn_settings.account_security.title', children: t('dyn_settings.account_security.title') })] }), endSlot: jsx(SvgChevronLeft, { className: 'settings-view__body__section__button__icon-secondary--rotate' }), showInternalLoading: false }))] }), globalWallet && (jsxs("div", { className: 'settings-view__body__section', children: [jsx("div", { className: 'settings-view__body__section__title', children: jsx(Typography, { copykey: 'dyn_settings.global_connectivity_section.title', color: 'secondary', weight: 'medium', children: t('dyn_settings.global_connectivity_section.title') }) }), jsx(TypographyButton, { onClick: handleConnectedAppsClick, dataTestId: 'connected-apps-button', buttonClassName: 'settings-view__body__section__button', startSlot: jsxs("div", { className: 'settings-view__body__section__button__start-slot', children: [jsx(SvgConnectedApps, { className: 'settings-view__body__section__button__icon' }), jsx(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: jsx(SvgChevronLeft, { className: 'settings-view__body__section__button__icon-secondary--rotate' }), showInternalLoading: false })] })), delegatedAccessEnabled && (jsxs("div", { className: 'settings-view__body__section', children: [jsx("div", { className: 'settings-view__body__section__title', children: jsx(Typography, { copykey: 'dyn_settings.account_permissions_section.title', color: 'secondary', weight: 'medium', children: t('dyn_settings.account_permissions_section.title') }) }), jsx(TypographyButton, { onClick: handleWalletsDelegatedClick, dataTestId: 'wallets-delegated-settings-button', buttonClassName: 'settings-view__body__section__button', startSlot: jsxs("div", { className: 'settings-view__body__section__button__start-slot', children: [jsx(SvgConnect, { className: 'settings-view__body__section__button__icon' }), jsx(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: jsx(SvgChevronLeft, { className: 'settings-view__body__section__button__icon-secondary--rotate' }), showInternalLoading: false })] }))] })) : (jsx(EmptyScreen, {})) }), jsx("div", { className: 'settings-view__logout-button-container', children: jsx(TypographyButton, { buttonClassName: 'settings-view__logout-button-container__button', onClick: handleLogOut, dataTestId: 'logout-button', copykey: 'dyn_settings.buttonLogout', children: t('dyn_settings.button_logout') }) }), !shouldShowAccountAndSecuritySettings && (jsx("div", { className: 'settings-view__delete-account-container', children: jsx(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') }) }))] }));
145
161
  };
146
162
 
147
163
  export { SettingsView };
@@ -0,0 +1,149 @@
1
+ 'use client'
2
+ 'use strict';
3
+
4
+ Object.defineProperty(exports, '__esModule', { value: true });
5
+
6
+ var _tslib = require('../../../../../../_virtual/_tslib.cjs');
7
+ var jsxRuntime = require('react/jsx-runtime');
8
+ var React = require('react');
9
+ var reactI18next = require('react-i18next');
10
+ require('@dynamic-labs/utils');
11
+ require('../../../../components/Accordion/components/AccordionItem/AccordionItem.cjs');
12
+ var arrowLeft = require('../../../../shared/assets/arrow-left.cjs');
13
+ var check = require('../../../../shared/assets/check.cjs');
14
+ require('@dynamic-labs/iconic');
15
+ require('../../../../context/ViewContext/ViewContext.cjs');
16
+ require('@dynamic-labs/wallet-connector-core');
17
+ require('../../../../shared/logger.cjs');
18
+ require('@dynamic-labs/wallet-book');
19
+ require('../../../../utils/constants/colors.cjs');
20
+ require('../../../../utils/constants/values.cjs');
21
+ require('@dynamic-labs/sdk-api-core');
22
+ require('../../../../shared/consts/index.cjs');
23
+ require('../../../../components/Alert/Alert.cjs');
24
+ require('../../../../events/dynamicEvents.cjs');
25
+ require('../../../../context/DynamicContext/DynamicContext.cjs');
26
+ require('../../../../store/state/loadingAndLifecycle/loadingAndLifecycle.cjs');
27
+ require('../../../../store/state/authMode/authMode.cjs');
28
+ require('../../../../context/CaptchaContext/CaptchaContext.cjs');
29
+ require('../../../../context/ErrorContext/ErrorContext.cjs');
30
+ require('@dynamic-labs/multi-wallet');
31
+ require('react-international-phone');
32
+ require('../../../../store/state/nonce/nonce.cjs');
33
+ require('@dynamic-labs-sdk/client/core');
34
+ require('../../../../client/client.cjs');
35
+ require('@dynamic-labs-sdk/client');
36
+ require('../../../../config/ApiEndpoint.cjs');
37
+ require('../../../../locale/locale.cjs');
38
+ require('../../../../store/state/dynamicContextProps/dynamicContextProps.cjs');
39
+ require('../../../../store/state/primaryWalletId/primaryWalletId.cjs');
40
+ require('../../../../store/state/connectedWalletsInfo/connectedWalletsInfo.cjs');
41
+ require('../../../../context/AccessDeniedContext/AccessDeniedContext.cjs');
42
+ require('../../../../context/AccountExistsContext/AccountExistsContext.cjs');
43
+ require('../../../../context/UserWalletsContext/UserWalletsContext.cjs');
44
+ require('../../../../context/VerificationContext/VerificationContext.cjs');
45
+ require('react-dom');
46
+ require('../../../../utils/functions/compareChains/compareChains.cjs');
47
+ require('../../../../views/Passkey/utils/findPrimaryEmbeddedChain/findPrimaryEmbeddedChain.cjs');
48
+ require('../../../../context/ThemeContext/ThemeContext.cjs');
49
+ require('../../../../utils/hooks/useUserUpdateRequest/useUpdateUser/userFieldsSchema.cjs');
50
+ require('bs58');
51
+ require('@dynamic-labs/types');
52
+ require('../../../../context/SocialRedirectContext/SocialRedirectContext.cjs');
53
+ require('../../../../context/LoadingContext/LoadingContext.cjs');
54
+ require('../../../../context/WalletContext/WalletContext.cjs');
55
+ require('../../../../utils/hooks/useEmbeddedWallet/useSecureEnclaveEmbeddedWallet/constants.cjs');
56
+ require('yup');
57
+ require('../../../../context/MockContext/MockContext.cjs');
58
+ require('../../../../views/CollectUserDataView/useFields.cjs');
59
+ require('../../../../context/FieldsStateContext/FieldsStateContext.cjs');
60
+ require('../../../../context/UserFieldEditorContext/UserFieldEditorContext.cjs');
61
+ require('@dynamic-labs/rpc-providers');
62
+ require('../../../../store/state/walletOptions/walletOptions.cjs');
63
+ var Typography = require('../../../../components/Typography/Typography.cjs');
64
+ require('../../../../context/FooterAnimationContext/index.cjs');
65
+ require('../../../../components/ShadowDOM/ShadowDOM.cjs');
66
+ require('../../../../components/Transition/ZoomTransition/ZoomTransition.cjs');
67
+ require('../../../../components/Transition/SlideInUpTransition/SlideInUpTransition.cjs');
68
+ require('../../../../components/Transition/OpacityTransition/OpacityTransition.cjs');
69
+ require('../../../../components/OverlayCardBase/OverlayCardTarget/OverlayCardTarget.cjs');
70
+ require('../../../../context/WalletGroupContext/WalletGroupContext.cjs');
71
+ require('../../components/DynamicWidgetHeader/DynamicWidgetHeader.cjs');
72
+ require('react-focus-lock');
73
+ var shortenWalletAddress = require('../../../../shared/utils/functions/shortenWalletAddress/shortenWalletAddress.cjs');
74
+ var WalletIconWithNetwork = require('../../components/WalletIconWithNetwork/WalletIconWithNetwork.cjs');
75
+ var DynamicWidgetContext = require('../../context/DynamicWidgetContext.cjs');
76
+ var IconButton = require('../../../../components/IconButton/IconButton.cjs');
77
+ var TypographyButton = require('../../../../components/TypographyButton/TypographyButton.cjs');
78
+ var useWalletDelegation = require('../../../../utils/hooks/useWalletDelegation/useWalletDelegation.cjs');
79
+ require('../../../../components/MenuList/Dropdown/Dropdown.cjs');
80
+ require('formik');
81
+ require('../../../../utils/hooks/useSubdomainCheck/useSubdomainCheck.cjs');
82
+ require('../../../../store/state/sendBalances.cjs');
83
+ require('../../../../components/Input/Input.cjs');
84
+ require('../../../../components/OverlayCard/OverlayCard.cjs');
85
+ require('../../../../views/TransactionConfirmationView/TransactionConfirmationView.cjs');
86
+ require('../../../../components/PasskeyCreatedSuccessBanner/PasskeyCreatedSuccessBanner.cjs');
87
+ require('../../../../context/PasskeyContext/PasskeyContext.cjs');
88
+ require('../../components/PasskeyCard/PasskeyCard.cjs');
89
+ require('../../../../context/OnrampContext/OnrampContext.cjs');
90
+ require('../../../../../index.cjs');
91
+ require('../../helpers/convertExchangeKeyAndProviderEnum.cjs');
92
+ require('qrcode');
93
+ require('../ReceiveWalletFunds/ReceiveWalletFunds.cjs');
94
+ require('../../../../context/IpConfigurationContext/IpConfigurationContext.cjs');
95
+ require('../../../../context/ConnectWithOtpContext/ConnectWithOtpContext.cjs');
96
+ require('../../../DynamicBridgeWidget/views/WalletsView/components/SecondaryWallets/SecondaryWallets.cjs');
97
+ require('@hcaptcha/react-hcaptcha');
98
+ require('../../../../views/ExchangeWhitelistWarning/ExchangeWhitelistWarning.cjs');
99
+ require('../../../../context/ErrorContext/hooks/useErrorText/useErrorText.cjs');
100
+ require('../../../../views/MfaChooseDeviceView/useGetMfaOptions/useGetMfaOptions.cjs');
101
+ require('../../../../store/state/connectorsInitializing/connectorsInitializing.cjs');
102
+ require('../../../../store/state/tokenBalances.cjs');
103
+ require('../../../../store/state/multichainBalances.cjs');
104
+ require('../../../../shared/utils/functions/getInitialUrl/getInitialUrl.cjs');
105
+ require('../../../../components/InlineWidget/InlineWidget.cjs');
106
+ require('../../../../components/IsBrowser/IsBrowser.cjs');
107
+ require('../../../../components/Popper/Popper/Popper.cjs');
108
+ require('../../../../components/Popper/PopperContext/PopperContext.cjs');
109
+
110
+ const WalletsDelegatedSettingsView = ({ name }) => {
111
+ const { t } = reactI18next.useTranslation();
112
+ const { setDynamicWidgetView } = DynamicWidgetContext.useWidgetContext();
113
+ const [showSuccessMessage, setShowSuccessMessage] = React.useState(false);
114
+ const { getWalletsDelegatedStatus } = useWalletDelegation.useWalletDelegation();
115
+ const walletsWithStatus = getWalletsDelegatedStatus();
116
+ React.useEffect(() => {
117
+ if (!name)
118
+ return;
119
+ setShowSuccessMessage(true);
120
+ const timer = setTimeout(() => {
121
+ setShowSuccessMessage(false);
122
+ }, 3000);
123
+ return () => clearTimeout(timer);
124
+ }, [name]);
125
+ const handleRevoke = (walletId) => _tslib.__awaiter(void 0, void 0, void 0, function* () { });
126
+ return (jsxRuntime.jsxs("div", { className: 'wallets-delegated-settings-view', children: [jsxRuntime.jsxs("div", { className: 'header', children: [jsxRuntime.jsx(IconButton.IconButton, { onClick: () => setDynamicWidgetView('settings'), "data-testid": 'back-button', className: 'back-button', type: 'button', children: jsxRuntime.jsx(arrowLeft.ReactComponent, {}) }), jsxRuntime.jsx(Typography.Typography, { variant: 'title', color: 'primary', className: 'title', copykey: 'wallets_delegated.title', children: t('wallets_delegated.title') })] }), walletsWithStatus.length > 0 && (jsxRuntime.jsx("ul", { className: 'delegated-wallets-list', children: walletsWithStatus.map((wallet) => {
127
+ var _a, _b;
128
+ return (jsxRuntime.jsxs("li", { className: 'delegated-wallets-item', children: [jsxRuntime.jsx("div", { className: 'wallet-icon', children: jsxRuntime.jsx(WalletIconWithNetwork.WalletIconWithNetwork, { walletKey: wallet.key, Icon: null, iconUrl: (_b = (_a = wallet.connector) === null || _a === void 0 ? void 0 : _a.metadata) === null || _b === void 0 ? void 0 : _b.icon, chainName: wallet.chain, iconSize: 24, showNetwork: true }) }), jsxRuntime.jsxs("div", { className: 'wallet-info', children: [jsxRuntime.jsx(Typography.Typography, { variant: 'body_normal', color: 'primary', weight: 'medium', children: shortenWalletAddress.shortenWalletAddress(wallet.address) }), jsxRuntime.jsx("div", { className: wallet.status === 'delegated'
129
+ ? 'status-badge'
130
+ : 'status-badge status-badge--disconnected', children: jsxRuntime.jsx(Typography.Typography, { variant: 'body_small', color: wallet.status === 'delegated' ? 'primary' : 'secondary', children: wallet.status === 'delegated'
131
+ ? t('connected', 'Connected')
132
+ : t('disconnected', 'Disconnected') }) })] }), jsxRuntime.jsx(TypographyButton.TypographyButton, { onClick: () => handleRevoke(wallet.id), buttonPadding: 'small', className: 'revoke-button', typographyProps: {
133
+ color: 'primary',
134
+ variant: 'body_small',
135
+ weight: 'medium',
136
+ }, children: wallet.status === 'delegated'
137
+ ? t('revoke', 'Revoke')
138
+ : t('delegate', 'Delegate') })] }, wallet.id));
139
+ }) })), walletsWithStatus.filter((w) => w.status === 'delegated').length > 0 && (jsxRuntime.jsx("div", { className: 'revoke-all-section', children: jsxRuntime.jsx(TypographyButton.TypographyButton, { onClick: () => {
140
+ // Handle revoke all functionality
141
+ handleRevoke();
142
+ }, buttonVariant: 'tertiary', buttonPadding: 'none', className: 'revoke-all-button', typographyProps: {
143
+ variant: 'body_normal',
144
+ weight: 'medium',
145
+ }, children: t('revoke_all_wallet_access', 'Revoke all wallet access') }) })), showSuccessMessage && (jsxRuntime.jsxs("div", { className: 'success-message', children: [jsxRuntime.jsx(check.ReactComponent, {}), jsxRuntime.jsx(Typography.Typography, { variant: 'body_small', color: 'primary', copykey: 'global_wallet.wallets_delegated.success', children: t('global_wallet.wallets_delegated.success', { name }) })] }))] }));
146
+ };
147
+
148
+ exports.WalletsDelegatedSettingsView = WalletsDelegatedSettingsView;
149
+ exports["default"] = WalletsDelegatedSettingsView;
@@ -0,0 +1,12 @@
1
+ import { FC } from 'react';
2
+ export interface WalletsDelegatedSettings {
3
+ name: string;
4
+ url: string;
5
+ icon: string;
6
+ topic: string;
7
+ }
8
+ export type WalletsDelegatedSettingsViewProps = {
9
+ name?: string;
10
+ };
11
+ export declare const WalletsDelegatedSettingsView: FC<WalletsDelegatedSettingsViewProps>;
12
+ export default WalletsDelegatedSettingsView;
@@ -0,0 +1,144 @@
1
+ 'use client'
2
+ import { __awaiter } from '../../../../../../_virtual/_tslib.js';
3
+ import { jsxs, jsx } from 'react/jsx-runtime';
4
+ import { useState, useEffect } from 'react';
5
+ import { useTranslation } from 'react-i18next';
6
+ import '@dynamic-labs/utils';
7
+ import '../../../../components/Accordion/components/AccordionItem/AccordionItem.js';
8
+ import { ReactComponent as SvgArrowLeft } from '../../../../shared/assets/arrow-left.js';
9
+ import { ReactComponent as SvgCheck } from '../../../../shared/assets/check.js';
10
+ import '@dynamic-labs/iconic';
11
+ import '../../../../context/ViewContext/ViewContext.js';
12
+ import '@dynamic-labs/wallet-connector-core';
13
+ import '../../../../shared/logger.js';
14
+ import '@dynamic-labs/wallet-book';
15
+ import '../../../../utils/constants/colors.js';
16
+ import '../../../../utils/constants/values.js';
17
+ import '@dynamic-labs/sdk-api-core';
18
+ import '../../../../shared/consts/index.js';
19
+ import '../../../../components/Alert/Alert.js';
20
+ import '../../../../events/dynamicEvents.js';
21
+ import '../../../../context/DynamicContext/DynamicContext.js';
22
+ import '../../../../store/state/loadingAndLifecycle/loadingAndLifecycle.js';
23
+ import '../../../../store/state/authMode/authMode.js';
24
+ import '../../../../context/CaptchaContext/CaptchaContext.js';
25
+ import '../../../../context/ErrorContext/ErrorContext.js';
26
+ import '@dynamic-labs/multi-wallet';
27
+ import 'react-international-phone';
28
+ import '../../../../store/state/nonce/nonce.js';
29
+ import '@dynamic-labs-sdk/client/core';
30
+ import '../../../../client/client.js';
31
+ import '@dynamic-labs-sdk/client';
32
+ import '../../../../config/ApiEndpoint.js';
33
+ import '../../../../locale/locale.js';
34
+ import '../../../../store/state/dynamicContextProps/dynamicContextProps.js';
35
+ import '../../../../store/state/primaryWalletId/primaryWalletId.js';
36
+ import '../../../../store/state/connectedWalletsInfo/connectedWalletsInfo.js';
37
+ import '../../../../context/AccessDeniedContext/AccessDeniedContext.js';
38
+ import '../../../../context/AccountExistsContext/AccountExistsContext.js';
39
+ import '../../../../context/UserWalletsContext/UserWalletsContext.js';
40
+ import '../../../../context/VerificationContext/VerificationContext.js';
41
+ import 'react-dom';
42
+ import '../../../../utils/functions/compareChains/compareChains.js';
43
+ import '../../../../views/Passkey/utils/findPrimaryEmbeddedChain/findPrimaryEmbeddedChain.js';
44
+ import '../../../../context/ThemeContext/ThemeContext.js';
45
+ import '../../../../utils/hooks/useUserUpdateRequest/useUpdateUser/userFieldsSchema.js';
46
+ import 'bs58';
47
+ import '@dynamic-labs/types';
48
+ import '../../../../context/SocialRedirectContext/SocialRedirectContext.js';
49
+ import '../../../../context/LoadingContext/LoadingContext.js';
50
+ import '../../../../context/WalletContext/WalletContext.js';
51
+ import '../../../../utils/hooks/useEmbeddedWallet/useSecureEnclaveEmbeddedWallet/constants.js';
52
+ import 'yup';
53
+ import '../../../../context/MockContext/MockContext.js';
54
+ import '../../../../views/CollectUserDataView/useFields.js';
55
+ import '../../../../context/FieldsStateContext/FieldsStateContext.js';
56
+ import '../../../../context/UserFieldEditorContext/UserFieldEditorContext.js';
57
+ import '@dynamic-labs/rpc-providers';
58
+ import '../../../../store/state/walletOptions/walletOptions.js';
59
+ import { Typography } from '../../../../components/Typography/Typography.js';
60
+ import '../../../../context/FooterAnimationContext/index.js';
61
+ import '../../../../components/ShadowDOM/ShadowDOM.js';
62
+ import '../../../../components/Transition/ZoomTransition/ZoomTransition.js';
63
+ import '../../../../components/Transition/SlideInUpTransition/SlideInUpTransition.js';
64
+ import '../../../../components/Transition/OpacityTransition/OpacityTransition.js';
65
+ import '../../../../components/OverlayCardBase/OverlayCardTarget/OverlayCardTarget.js';
66
+ import '../../../../context/WalletGroupContext/WalletGroupContext.js';
67
+ import '../../components/DynamicWidgetHeader/DynamicWidgetHeader.js';
68
+ import 'react-focus-lock';
69
+ import { shortenWalletAddress } from '../../../../shared/utils/functions/shortenWalletAddress/shortenWalletAddress.js';
70
+ import { WalletIconWithNetwork } from '../../components/WalletIconWithNetwork/WalletIconWithNetwork.js';
71
+ import { useWidgetContext } from '../../context/DynamicWidgetContext.js';
72
+ import { IconButton } from '../../../../components/IconButton/IconButton.js';
73
+ import { TypographyButton } from '../../../../components/TypographyButton/TypographyButton.js';
74
+ import { useWalletDelegation } from '../../../../utils/hooks/useWalletDelegation/useWalletDelegation.js';
75
+ import '../../../../components/MenuList/Dropdown/Dropdown.js';
76
+ import 'formik';
77
+ import '../../../../utils/hooks/useSubdomainCheck/useSubdomainCheck.js';
78
+ import '../../../../store/state/sendBalances.js';
79
+ import '../../../../components/Input/Input.js';
80
+ import '../../../../components/OverlayCard/OverlayCard.js';
81
+ import '../../../../views/TransactionConfirmationView/TransactionConfirmationView.js';
82
+ import '../../../../components/PasskeyCreatedSuccessBanner/PasskeyCreatedSuccessBanner.js';
83
+ import '../../../../context/PasskeyContext/PasskeyContext.js';
84
+ import '../../components/PasskeyCard/PasskeyCard.js';
85
+ import '../../../../context/OnrampContext/OnrampContext.js';
86
+ import '../../../../../index.js';
87
+ import '../../helpers/convertExchangeKeyAndProviderEnum.js';
88
+ import 'qrcode';
89
+ import '../ReceiveWalletFunds/ReceiveWalletFunds.js';
90
+ import '../../../../context/IpConfigurationContext/IpConfigurationContext.js';
91
+ import '../../../../context/ConnectWithOtpContext/ConnectWithOtpContext.js';
92
+ import '../../../DynamicBridgeWidget/views/WalletsView/components/SecondaryWallets/SecondaryWallets.js';
93
+ import '@hcaptcha/react-hcaptcha';
94
+ import '../../../../views/ExchangeWhitelistWarning/ExchangeWhitelistWarning.js';
95
+ import '../../../../context/ErrorContext/hooks/useErrorText/useErrorText.js';
96
+ import '../../../../views/MfaChooseDeviceView/useGetMfaOptions/useGetMfaOptions.js';
97
+ import '../../../../store/state/connectorsInitializing/connectorsInitializing.js';
98
+ import '../../../../store/state/tokenBalances.js';
99
+ import '../../../../store/state/multichainBalances.js';
100
+ import '../../../../shared/utils/functions/getInitialUrl/getInitialUrl.js';
101
+ import '../../../../components/InlineWidget/InlineWidget.js';
102
+ import '../../../../components/IsBrowser/IsBrowser.js';
103
+ import '../../../../components/Popper/Popper/Popper.js';
104
+ import '../../../../components/Popper/PopperContext/PopperContext.js';
105
+
106
+ const WalletsDelegatedSettingsView = ({ name }) => {
107
+ const { t } = useTranslation();
108
+ const { setDynamicWidgetView } = useWidgetContext();
109
+ const [showSuccessMessage, setShowSuccessMessage] = useState(false);
110
+ const { getWalletsDelegatedStatus } = useWalletDelegation();
111
+ const walletsWithStatus = getWalletsDelegatedStatus();
112
+ useEffect(() => {
113
+ if (!name)
114
+ return;
115
+ setShowSuccessMessage(true);
116
+ const timer = setTimeout(() => {
117
+ setShowSuccessMessage(false);
118
+ }, 3000);
119
+ return () => clearTimeout(timer);
120
+ }, [name]);
121
+ const handleRevoke = (walletId) => __awaiter(void 0, void 0, void 0, function* () { });
122
+ return (jsxs("div", { className: 'wallets-delegated-settings-view', children: [jsxs("div", { className: 'header', children: [jsx(IconButton, { onClick: () => setDynamicWidgetView('settings'), "data-testid": 'back-button', className: 'back-button', type: 'button', children: jsx(SvgArrowLeft, {}) }), jsx(Typography, { variant: 'title', color: 'primary', className: 'title', copykey: 'wallets_delegated.title', children: t('wallets_delegated.title') })] }), walletsWithStatus.length > 0 && (jsx("ul", { className: 'delegated-wallets-list', children: walletsWithStatus.map((wallet) => {
123
+ var _a, _b;
124
+ return (jsxs("li", { className: 'delegated-wallets-item', children: [jsx("div", { className: 'wallet-icon', children: jsx(WalletIconWithNetwork, { walletKey: wallet.key, Icon: null, iconUrl: (_b = (_a = wallet.connector) === null || _a === void 0 ? void 0 : _a.metadata) === null || _b === void 0 ? void 0 : _b.icon, chainName: wallet.chain, iconSize: 24, showNetwork: true }) }), jsxs("div", { className: 'wallet-info', children: [jsx(Typography, { variant: 'body_normal', color: 'primary', weight: 'medium', children: shortenWalletAddress(wallet.address) }), jsx("div", { className: wallet.status === 'delegated'
125
+ ? 'status-badge'
126
+ : 'status-badge status-badge--disconnected', children: jsx(Typography, { variant: 'body_small', color: wallet.status === 'delegated' ? 'primary' : 'secondary', children: wallet.status === 'delegated'
127
+ ? t('connected', 'Connected')
128
+ : t('disconnected', 'Disconnected') }) })] }), jsx(TypographyButton, { onClick: () => handleRevoke(wallet.id), buttonPadding: 'small', className: 'revoke-button', typographyProps: {
129
+ color: 'primary',
130
+ variant: 'body_small',
131
+ weight: 'medium',
132
+ }, children: wallet.status === 'delegated'
133
+ ? t('revoke', 'Revoke')
134
+ : t('delegate', 'Delegate') })] }, wallet.id));
135
+ }) })), walletsWithStatus.filter((w) => w.status === 'delegated').length > 0 && (jsx("div", { className: 'revoke-all-section', children: jsx(TypographyButton, { onClick: () => {
136
+ // Handle revoke all functionality
137
+ handleRevoke();
138
+ }, buttonVariant: 'tertiary', buttonPadding: 'none', className: 'revoke-all-button', typographyProps: {
139
+ variant: 'body_normal',
140
+ weight: 'medium',
141
+ }, children: t('revoke_all_wallet_access', 'Revoke all wallet access') }) })), showSuccessMessage && (jsxs("div", { className: 'success-message', children: [jsx(SvgCheck, {}), jsx(Typography, { variant: 'body_small', color: 'primary', copykey: 'global_wallet.wallets_delegated.success', children: t('global_wallet.wallets_delegated.success', { name }) })] }))] }));
142
+ };
143
+
144
+ export { WalletsDelegatedSettingsView, WalletsDelegatedSettingsView as default };
@@ -0,0 +1 @@
1
+ export * from './WalletsDelegatedSettingsView';
@@ -6,3 +6,4 @@ export { ManagePasskeysWidgetView } from './ManagePasskeysWidgetView';
6
6
  export { SettingsView } from './SettingsView';
7
7
  export { AccountAndSecuritySettingsView } from './AccountAndSecuritySettingsView';
8
8
  export { SessionManagementView } from './SessionManagementView';
9
+ export { WalletsDelegatedSettingsView } from './WalletsDelegatedSettingsView';
@@ -1,34 +0,0 @@
1
- 'use client'
2
- 'use strict';
3
-
4
- Object.defineProperty(exports, '__esModule', { value: true });
5
-
6
- var _tslib = require('../../../../../../../_virtual/_tslib.cjs');
7
- var jsxRuntime = require('react/jsx-runtime');
8
- var React = require('react');
9
- var reactI18next = require('react-i18next');
10
- var Typography = require('../../../../../components/Typography/Typography.cjs');
11
- var TypographyButton = require('../../../../../components/TypographyButton/TypographyButton.cjs');
12
- var chevronLeft = require('../../../../../shared/assets/chevron-left.cjs');
13
- require('@dynamic-labs/iconic');
14
- require('../../../../../context/ViewContext/ViewContext.cjs');
15
- var useWalletDelegation = require('../../../../../utils/hooks/useWalletDelegation/useWalletDelegation.cjs');
16
- var logger = require('../../../../../shared/logger.cjs');
17
-
18
- const EmbeddedDelegatedSection = () => {
19
- const { t } = reactI18next.useTranslation();
20
- const { initDelegationProcess } = useWalletDelegation.useWalletDelegation();
21
- const handleDelegateWalletsClick = React.useCallback(() => _tslib.__awaiter(void 0, void 0, void 0, function* () {
22
- try {
23
- yield initDelegationProcess();
24
- }
25
- catch (error) {
26
- logger.logger.error('Failed to open wallet delegation modal:', error);
27
- }
28
- }), [initDelegationProcess]);
29
- return (jsxRuntime.jsx("div", { className: 'settings-view__body__section', children: jsxRuntime.jsx(TypographyButton.TypographyButton, { dataTestId: 'delegate-wallets-button', onClick: handleDelegateWalletsClick, buttonClassName: 'settings-view__body__section__button', startSlot:
30
- // eslint-disable-next-line react/jsx-wrap-multilines
31
- jsxRuntime.jsx("div", { className: 'settings-view__body__section__button__start-slot', children: jsxRuntime.jsx(Typography.Typography, { color: 'primary', weight: 'medium', copykey: 'dyn_settings.delegate_wallets_section.button', children: t('dyn_settings.delegate_wallets_section.button', 'Manage Delegate Wallets') }) }), endSlot: jsxRuntime.jsx(chevronLeft.ReactComponent, { className: 'settings-view__body__section__button__icon-secondary--rotate' }), showInternalLoading: false }) }));
32
- };
33
-
34
- exports.EmbeddedDelegatedSection = EmbeddedDelegatedSection;
@@ -1,2 +0,0 @@
1
- import { FC } from 'react';
2
- export declare const EmbeddedDelegatedSection: FC;
@@ -1,30 +0,0 @@
1
- 'use client'
2
- import { __awaiter } from '../../../../../../../_virtual/_tslib.js';
3
- import { jsx } from 'react/jsx-runtime';
4
- import { useCallback } from 'react';
5
- import { useTranslation } from 'react-i18next';
6
- import { Typography } from '../../../../../components/Typography/Typography.js';
7
- import { TypographyButton } from '../../../../../components/TypographyButton/TypographyButton.js';
8
- import { ReactComponent as SvgChevronLeft } from '../../../../../shared/assets/chevron-left.js';
9
- import '@dynamic-labs/iconic';
10
- import '../../../../../context/ViewContext/ViewContext.js';
11
- import { useWalletDelegation } from '../../../../../utils/hooks/useWalletDelegation/useWalletDelegation.js';
12
- import { logger } from '../../../../../shared/logger.js';
13
-
14
- const EmbeddedDelegatedSection = () => {
15
- const { t } = useTranslation();
16
- const { initDelegationProcess } = useWalletDelegation();
17
- const handleDelegateWalletsClick = useCallback(() => __awaiter(void 0, void 0, void 0, function* () {
18
- try {
19
- yield initDelegationProcess();
20
- }
21
- catch (error) {
22
- logger.error('Failed to open wallet delegation modal:', error);
23
- }
24
- }), [initDelegationProcess]);
25
- return (jsx("div", { className: 'settings-view__body__section', children: jsx(TypographyButton, { dataTestId: 'delegate-wallets-button', onClick: handleDelegateWalletsClick, buttonClassName: 'settings-view__body__section__button', startSlot:
26
- // eslint-disable-next-line react/jsx-wrap-multilines
27
- jsx("div", { className: 'settings-view__body__section__button__start-slot', children: jsx(Typography, { color: 'primary', weight: 'medium', copykey: 'dyn_settings.delegate_wallets_section.button', children: t('dyn_settings.delegate_wallets_section.button', 'Manage Delegate Wallets') }) }), endSlot: jsx(SvgChevronLeft, { className: 'settings-view__body__section__button__icon-secondary--rotate' }), showInternalLoading: false }) }));
28
- };
29
-
30
- export { EmbeddedDelegatedSection };
@@ -1 +0,0 @@
1
- export * from './EmbeddedDelegatedSection';