@dynamic-labs/sdk-react-core 4.6.2 → 4.7.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.
- package/CHANGELOG.md +21 -0
- package/package.cjs +2 -2
- package/package.js +2 -2
- package/package.json +12 -12
- package/src/lib/Main.cjs +1 -1
- package/src/lib/Main.js +1 -1
- package/src/lib/components/BaseButton/BaseButton.cjs +20 -0
- package/src/lib/components/BaseButton/BaseButton.d.ts +21 -0
- package/src/lib/components/BaseButton/BaseButton.js +16 -0
- package/src/lib/components/BaseButton/index.d.ts +1 -0
- package/src/lib/components/Button/Button.cjs +5 -1
- package/src/lib/components/Button/Button.d.ts +6 -7
- package/src/lib/components/Button/Button.js +5 -1
- package/src/lib/components/NetworkPicker/components/NetworkSwitchControl/NetworkSwitchControl.cjs +2 -2
- package/src/lib/components/NetworkPicker/components/NetworkSwitchControl/NetworkSwitchControl.js +2 -2
- package/src/lib/context/DynamicContext/hooks/useHandleLogout/useHandleLogout.cjs +1 -0
- package/src/lib/context/DynamicContext/hooks/useHandleLogout/useHandleLogout.js +2 -1
- package/src/lib/context/DynamicContext/hooks/useNameService/useNameService.cjs +2 -2
- package/src/lib/context/DynamicContext/hooks/useNameService/useNameService.js +2 -2
- package/src/lib/context/ViewContext/types/index.d.ts +1 -1
- package/src/lib/layout/DynamicAuthLayout/Header/header.cjs +2 -2
- package/src/lib/layout/DynamicAuthLayout/Header/header.js +2 -2
- package/src/lib/locale/en/translation.cjs +10 -0
- package/src/lib/locale/en/translation.d.ts +10 -0
- package/src/lib/locale/en/translation.js +10 -0
- package/src/lib/styles/index.shadow.cjs +1 -1
- package/src/lib/styles/index.shadow.js +1 -1
- package/src/lib/utils/constants/localStorage.cjs +2 -0
- package/src/lib/utils/constants/localStorage.d.ts +1 -0
- package/src/lib/utils/constants/localStorage.js +2 -1
- package/src/lib/utils/functions/generateMessages/index.cjs +1 -1
- package/src/lib/utils/functions/generateMessages/index.js +1 -1
- package/src/lib/utils/functions/getVerifyArgs/getVerifyArgs.cjs +2 -2
- package/src/lib/utils/functions/getVerifyArgs/getVerifyArgs.js +2 -2
- package/src/lib/utils/functions/index.d.ts +0 -1
- package/src/lib/utils/functions/isSupportedNetwork/isSupportedNetwork.cjs +1 -3
- package/src/lib/utils/functions/isSupportedNetwork/isSupportedNetwork.d.ts +2 -1
- package/src/lib/utils/functions/isSupportedNetwork/isSupportedNetwork.js +1 -3
- package/src/lib/utils/hooks/authenticationHooks/useConnectAndSign/useConnectAndSign.cjs +1 -1
- package/src/lib/utils/hooks/authenticationHooks/useConnectAndSign/useConnectAndSign.js +1 -1
- package/src/lib/utils/hooks/authenticationHooks/useConnectAndSignSplitSteps/useConnectAndSignSplitSteps.cjs +1 -1
- package/src/lib/utils/hooks/authenticationHooks/useConnectAndSignSplitSteps/useConnectAndSignSplitSteps.js +1 -1
- package/src/lib/utils/hooks/useAuthLayoutChecks/useAuthLayoutChecks.cjs +4 -1
- package/src/lib/utils/hooks/useAuthLayoutChecks/useAuthLayoutChecks.d.ts +1 -0
- package/src/lib/utils/hooks/useAuthLayoutChecks/useAuthLayoutChecks.js +4 -1
- package/src/lib/utils/hooks/useConnectedWalletsNetworkValidation/useConnectedWalletsNetworkValidation.cjs +1 -1
- package/src/lib/utils/hooks/useConnectedWalletsNetworkValidation/useConnectedWalletsNetworkValidation.js +1 -1
- package/src/lib/utils/hooks/useDynamicLayoutData/useDynamicLayoutData.cjs +4 -0
- package/src/lib/utils/hooks/useDynamicLayoutData/useDynamicLayoutData.js +4 -0
- package/src/lib/utils/hooks/useNetworkDataFromWallet/useNetworkDataFromWallet.cjs +4 -96
- package/src/lib/utils/hooks/useNetworkDataFromWallet/useNetworkDataFromWallet.js +4 -96
- package/src/lib/utils/hooks/useTokenBalances/useTokenBalances.cjs +32 -19
- package/src/lib/utils/hooks/useTokenBalances/useTokenBalances.d.ts +2 -2
- package/src/lib/utils/hooks/useTokenBalances/useTokenBalances.js +31 -18
- package/src/lib/utils/hooks/useTransactionSimulation/classes/useSVMTransactionSimulation.cjs +1 -1
- package/src/lib/utils/hooks/useTransactionSimulation/classes/useSVMTransactionSimulation.js +1 -1
- package/src/lib/utils/hooks/useWalletConnectorNetwork/useWalletConnectorNetwork.cjs +2 -2
- package/src/lib/utils/hooks/useWalletConnectorNetwork/useWalletConnectorNetwork.js +2 -2
- package/src/lib/utils/hooks/useWalletConnectors/utils/smartWallet/smartWallet.cjs +12 -16
- package/src/lib/utils/hooks/useWalletConnectors/utils/smartWallet/smartWallet.js +13 -17
- package/src/lib/utils/types/ButtonAriaProps.d.ts +5 -0
- package/src/lib/views/CollectUserDataView/CollectUserDataView.cjs +3 -1
- package/src/lib/views/CollectUserDataView/CollectUserDataView.js +3 -1
- package/src/lib/views/NetworkNotSupportedSwitchManual/NetworkNotSupportedSwitchManual.cjs +2 -2
- package/src/lib/views/NetworkNotSupportedSwitchManual/NetworkNotSupportedSwitchManual.js +2 -2
- package/src/lib/views/SendBalanceView/SendBalanceView.cjs +1 -1
- package/src/lib/views/SendBalanceView/SendBalanceView.js +1 -1
- package/src/lib/views/TransactionConfirmationView/TransactionConfirmationView.cjs +1 -1
- package/src/lib/views/TransactionConfirmationView/TransactionConfirmationView.js +1 -1
- package/src/lib/views/UserDeleteAccountView/UserDeleteAccountView.cjs +130 -0
- package/src/lib/views/UserDeleteAccountView/UserDeleteAccountView.d.ts +3 -0
- package/src/lib/views/UserDeleteAccountView/UserDeleteAccountView.js +125 -0
- package/src/lib/views/UserDeleteAccountView/index.d.ts +1 -0
- package/src/lib/views/viewToComponentMap.cjs +2 -0
- package/src/lib/views/viewToComponentMap.d.ts +1 -0
- package/src/lib/views/viewToComponentMap.js +2 -0
- package/src/lib/widgets/DynamicWidget/components/ActiveWalletInformation/ActiveWalletAddress/ActiveWalletAddress.cjs +20 -8
- package/src/lib/widgets/DynamicWidget/components/ActiveWalletInformation/ActiveWalletAddress/ActiveWalletAddress.js +21 -9
- package/src/lib/widgets/DynamicWidget/context/DynamicWidgetContext.types.d.ts +1 -1
- package/src/lib/widgets/DynamicWidget/hooks/useFetchChain/useFetchChain.cjs +1 -1
- package/src/lib/widgets/DynamicWidget/hooks/useFetchChain/useFetchChain.js +1 -1
- package/src/lib/widgets/DynamicWidget/hooks/useFetchCurrency/useFetchCurrency.cjs +6 -16
- package/src/lib/widgets/DynamicWidget/hooks/useFetchCurrency/useFetchCurrency.js +6 -16
- package/src/lib/widgets/DynamicWidget/views/AccountAndSecuritySettingsView/AccountAndSecuritySettingsView.cjs +13 -4
- package/src/lib/widgets/DynamicWidget/views/AccountAndSecuritySettingsView/AccountAndSecuritySettingsView.js +13 -4
- package/src/lib/widgets/DynamicWidget/views/SettingsView/SettingsView.cjs +18 -6
- package/src/lib/widgets/DynamicWidget/views/SettingsView/SettingsView.js +19 -7
- package/src/lib/shared/assets/gear.cjs +0 -54
- package/src/lib/shared/assets/gear.js +0 -30
- package/src/lib/utils/functions/getWalletConnectorNetworks/getWalletConnectorNetworks.cjs +0 -13
- package/src/lib/utils/functions/getWalletConnectorNetworks/getWalletConnectorNetworks.d.ts +0 -3
- package/src/lib/utils/functions/getWalletConnectorNetworks/getWalletConnectorNetworks.js +0 -9
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
import { __awaiter } from '../../../../_virtual/_tslib.js';
|
|
3
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
4
|
+
import { useState, useCallback, useMemo } from 'react';
|
|
5
|
+
import { useTranslation } from 'react-i18next';
|
|
6
|
+
import '../../events/dynamicEvents.js';
|
|
7
|
+
import '@dynamic-labs/utils';
|
|
8
|
+
import '../../context/DynamicContext/DynamicContext.js';
|
|
9
|
+
import '@dynamic-labs/sdk-api-core';
|
|
10
|
+
import '../../shared/logger.js';
|
|
11
|
+
import '@dynamic-labs/iconic';
|
|
12
|
+
import '@dynamic-labs/wallet-connector-core';
|
|
13
|
+
import { ReactComponent as SvgExclamation } from '../../shared/assets/exclamation.js';
|
|
14
|
+
import '../../context/ViewContext/ViewContext.js';
|
|
15
|
+
import { ReactComponent as SvgWarningRed } from '../../shared/assets/warning-red.js';
|
|
16
|
+
import '@dynamic-labs/wallet-book';
|
|
17
|
+
import '../../utils/constants/colors.js';
|
|
18
|
+
import '../../utils/constants/values.js';
|
|
19
|
+
import '../../shared/consts/index.js';
|
|
20
|
+
import { useInternalDynamicContext } from '../../context/DynamicContext/useDynamicContext/useInternalDynamicContext.js';
|
|
21
|
+
import '../../context/CaptchaContext/CaptchaContext.js';
|
|
22
|
+
import '../../context/ErrorContext/ErrorContext.js';
|
|
23
|
+
import '@dynamic-labs/multi-wallet';
|
|
24
|
+
import 'react-international-phone';
|
|
25
|
+
import '../../store/state/nonce/nonce.js';
|
|
26
|
+
import '../../store/state/projectSettings/projectSettings.js';
|
|
27
|
+
import '../../config/ApiEndpoint.js';
|
|
28
|
+
import '../../store/state/user/user.js';
|
|
29
|
+
import '../../locale/locale.js';
|
|
30
|
+
import '../../store/state/dynamicContextProps/dynamicContextProps.js';
|
|
31
|
+
import '../../store/state/primaryWalletId/primaryWalletId.js';
|
|
32
|
+
import '../../context/AccessDeniedContext/AccessDeniedContext.js';
|
|
33
|
+
import '../../context/AccountExistsContext/AccountExistsContext.js';
|
|
34
|
+
import '../../context/UserWalletsContext/UserWalletsContext.js';
|
|
35
|
+
import '../../context/VerificationContext/VerificationContext.js';
|
|
36
|
+
import 'react-dom';
|
|
37
|
+
import '../../utils/functions/compareChains/compareChains.js';
|
|
38
|
+
import '../../context/ThemeContext/ThemeContext.js';
|
|
39
|
+
import '../../utils/hooks/useUserUpdateRequest/useUpdateUser/userFieldsSchema.js';
|
|
40
|
+
import 'bs58';
|
|
41
|
+
import '@dynamic-labs/types';
|
|
42
|
+
import '../../context/SocialRedirectContext/SocialRedirectContext.js';
|
|
43
|
+
import '../../context/LoadingContext/LoadingContext.js';
|
|
44
|
+
import '../../context/WalletContext/WalletContext.js';
|
|
45
|
+
import '../../utils/hooks/useEmbeddedWallet/useSecureEnclaveEmbeddedWallet/constants.js';
|
|
46
|
+
import 'yup';
|
|
47
|
+
import '../../context/MockContext/MockContext.js';
|
|
48
|
+
import '../CollectUserDataView/useFields.js';
|
|
49
|
+
import '../../context/FieldsStateContext/FieldsStateContext.js';
|
|
50
|
+
import '../../context/UserFieldEditorContext/UserFieldEditorContext.js';
|
|
51
|
+
import '@dynamic-labs/rpc-providers';
|
|
52
|
+
import '../../store/state/loadingAndLifecycle.js';
|
|
53
|
+
import '@dynamic-labs/store';
|
|
54
|
+
import '../../store/state/walletOptions/walletOptions.js';
|
|
55
|
+
import '../../components/Accordion/components/AccordionItem/AccordionItem.js';
|
|
56
|
+
import '../../components/Alert/Alert.js';
|
|
57
|
+
import { Typography } from '../../components/Typography/Typography.js';
|
|
58
|
+
import '../../components/ShadowDOM/ShadowDOM.js';
|
|
59
|
+
import { TypographyButton } from '../../components/TypographyButton/TypographyButton.js';
|
|
60
|
+
import '../../components/IconButton/IconButton.js';
|
|
61
|
+
import '../../components/InlineWidget/InlineWidget.js';
|
|
62
|
+
import { Input } from '../../components/Input/Input.js';
|
|
63
|
+
import '../../components/IsBrowser/IsBrowser.js';
|
|
64
|
+
import '../../components/MenuList/Dropdown/Dropdown.js';
|
|
65
|
+
import '../../components/OverlayCard/OverlayCard.js';
|
|
66
|
+
import '../../components/Transition/ZoomTransition/ZoomTransition.js';
|
|
67
|
+
import '../../components/Transition/SlideInUpTransition/SlideInUpTransition.js';
|
|
68
|
+
import '../../components/Transition/OpacityTransition/OpacityTransition.js';
|
|
69
|
+
import '../../components/PasskeyCreatedSuccessBanner/PasskeyCreatedSuccessBanner.js';
|
|
70
|
+
import '../../components/Popper/Popper/Popper.js';
|
|
71
|
+
import '../../components/Popper/PopperContext/PopperContext.js';
|
|
72
|
+
import 'react-focus-lock';
|
|
73
|
+
import 'qrcode';
|
|
74
|
+
import 'formik';
|
|
75
|
+
import '../../utils/hooks/useSubdomainCheck/useSubdomainCheck.js';
|
|
76
|
+
import '../../context/WalletGroupContext/WalletGroupContext.js';
|
|
77
|
+
import '../../context/IpConfigurationContext/IpConfigurationContext.js';
|
|
78
|
+
import '../../context/ConnectWithOtpContext/ConnectWithOtpContext.js';
|
|
79
|
+
import '../../context/ConnectWithOtpContext/constants.js';
|
|
80
|
+
import '../../widgets/DynamicBridgeWidget/views/WalletsView/components/SecondaryWallets/SecondaryWallets.js';
|
|
81
|
+
import '@hcaptcha/react-hcaptcha';
|
|
82
|
+
import '../../widgets/DynamicWidget/context/DynamicWidgetContext.js';
|
|
83
|
+
import '../../context/FooterAnimationContext/index.js';
|
|
84
|
+
import '../../context/PasskeyContext/PasskeyContext.js';
|
|
85
|
+
import '../../store/state/sendBalances.js';
|
|
86
|
+
import '../../components/OverlayCardBase/OverlayCardTarget/OverlayCardTarget.js';
|
|
87
|
+
import '../../widgets/DynamicWidget/components/DynamicWidgetHeader/DynamicWidgetHeader.js';
|
|
88
|
+
import '../TransactionConfirmationView/TransactionConfirmationView.js';
|
|
89
|
+
import '../../widgets/DynamicWidget/views/ManagePasskeysWidgetView/PasskeyCard/PasskeyCard.js';
|
|
90
|
+
import '../../context/OnrampContext/OnrampContext.js';
|
|
91
|
+
import '../../widgets/DynamicWidget/views/ReceiveWalletFunds/ReceiveWalletFunds.js';
|
|
92
|
+
import '../../../index.js';
|
|
93
|
+
import '../../store/state/tokenBalances.js';
|
|
94
|
+
import '../../shared/utils/functions/getInitialUrl/getInitialUrl.js';
|
|
95
|
+
import { useDeleteUserAccount } from '../../utils/hooks/useDeleteUserAccount/useDeleteUserAccount.js';
|
|
96
|
+
|
|
97
|
+
const UserDeleteAccountView = () => {
|
|
98
|
+
const { setShowAuthFlow } = useInternalDynamicContext();
|
|
99
|
+
const { t } = useTranslation();
|
|
100
|
+
const { deleteUser, isLoading, error } = useDeleteUserAccount();
|
|
101
|
+
const [isBackupConfirmed, setIsBackupConfirmed] = useState(false);
|
|
102
|
+
const [confirmText, setConfirmText] = useState('');
|
|
103
|
+
const handleConfirmTextChange = useCallback((e) => {
|
|
104
|
+
setConfirmText(e.target.value);
|
|
105
|
+
}, []);
|
|
106
|
+
const handleBackupConfirmChange = useCallback((e) => {
|
|
107
|
+
setIsBackupConfirmed(e.target.checked);
|
|
108
|
+
}, []);
|
|
109
|
+
const handleCancel = useCallback(() => {
|
|
110
|
+
setShowAuthFlow(false);
|
|
111
|
+
}, [setShowAuthFlow]);
|
|
112
|
+
const handleDelete = useCallback(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
113
|
+
if (!isBackupConfirmed)
|
|
114
|
+
return;
|
|
115
|
+
yield deleteUser();
|
|
116
|
+
}), [deleteUser, isBackupConfirmed]);
|
|
117
|
+
const isDeleteEnabled = useMemo(() => isBackupConfirmed && confirmText === 'DELETE' && !isLoading, [isBackupConfirmed, confirmText, isLoading]);
|
|
118
|
+
return (jsx("div", { className: 'delete-account-view', children: jsxs("div", { className: 'delete-account-view__content', children: [jsx("div", { className: 'warning-section', children: jsxs("div", { className: 'warning-icon-container', children: [jsx(SvgWarningRed, { className: 'warning-icon' }), jsx(SvgExclamation, { className: 'exclamation-icon' })] }) }), jsx("div", { className: 'message-box', children: jsx(Typography, { variant: 'body_normal', children: t('dyn_settings.delete_account.description') }) }), jsxs("div", { className: 'confirmation-section', children: [jsxs("div", { className: 'checkbox-container', children: [jsx("input", { type: 'checkbox', checked: isBackupConfirmed, onChange: handleBackupConfirmChange }), jsx(Typography, { className: 'checkbox-text', variant: 'body_small', children: t('dyn_settings.delete_account.backup_confirmation') })] }), jsxs("div", { className: 'input-section', children: [jsx(Typography, { className: 'input-label', variant: 'body_small', children: t('dyn_settings.delete_account.type_delete') }), jsx(Input, { id: 'delete-confirmation', label: t('dyn_settings.delete_account.type_delete_label'), value: confirmText, onChange: handleConfirmTextChange, placeholder: 'DELETE', variant: 'dense' })] }), error && (jsx(Typography, { variant: 'body_small', color: 'error-1', children: error.message }))] }), jsxs("div", { className: 'button-group', children: [jsx(TypographyButton, { buttonClassName: 'cancel-button', buttonVariant: 'primary', type: 'button', onClick: handleCancel, copykey: 'dyn_settings.delete_account.cancel', children: t('dyn_settings.delete_account.cancel') }), jsx(TypographyButton, { buttonClassName: 'delete-button', buttonVariant: 'primary', type: 'submit', onClick: handleDelete, disabled: !isDeleteEnabled, typographyProps: {
|
|
119
|
+
color: isDeleteEnabled ? 'white' : 'tertiary',
|
|
120
|
+
}, copykey: 'dyn_settings.delete_account.confirm', children: isLoading
|
|
121
|
+
? t('dyn_settings.delete_account.deleting')
|
|
122
|
+
: t('dyn_settings.delete_account.confirm') })] })] }) }));
|
|
123
|
+
};
|
|
124
|
+
|
|
125
|
+
export { UserDeleteAccountView, UserDeleteAccountView as default };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './UserDeleteAccountView';
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
5
|
|
|
6
6
|
var jsxRuntime = require('react/jsx-runtime');
|
|
7
|
+
var UserDeleteAccountView = require('./UserDeleteAccountView/UserDeleteAccountView.cjs');
|
|
7
8
|
var AccessBlockedView = require('./AccessBlockedView/AccessBlockedView.cjs');
|
|
8
9
|
var AccountExistsView = require('./AccountExistsView/AccountExistsView.cjs');
|
|
9
10
|
var BridgeNextWalletConnectionView = require('./BridgeNextWalletConnectionView/BridgeNextWalletConnectionView.cjs');
|
|
@@ -203,6 +204,7 @@ const viewToComponentMap = {
|
|
|
203
204
|
'select-wallet-in-wallet-group': SelectWalletInWalletGroupView.SelectWalletInWalletGroupView,
|
|
204
205
|
'social-redirect-view': SocialRedirectView.SocialRedirectView,
|
|
205
206
|
'social-wrong-account': SocialWrongAccountView.SocialWrongAccountView,
|
|
207
|
+
'user-delete-account': UserDeleteAccountView.UserDeleteAccountView,
|
|
206
208
|
'verify-email': EmailVerification.EmailVerification,
|
|
207
209
|
'verify-sms': SmsVerification.SmsVerification,
|
|
208
210
|
'wait-for-email-confirmation-view': EmailConfirmationWaitingView.EmailConfirmationWaitingView,
|
|
@@ -78,6 +78,7 @@ export declare const viewToComponentMap: {
|
|
|
78
78
|
}>;
|
|
79
79
|
'social-redirect-view': () => JSX.Element;
|
|
80
80
|
'social-wrong-account': () => JSX.Element | null;
|
|
81
|
+
'user-delete-account': import("react").FC<{}>;
|
|
81
82
|
'verify-email': import("react").FC<import("./EmailVerification/EmailVerification").EmailVerificationProps>;
|
|
82
83
|
'verify-sms': import("react").FC;
|
|
83
84
|
'wait-for-email-confirmation-view': () => JSX.Element;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
'use client'
|
|
2
2
|
import { jsx } from 'react/jsx-runtime';
|
|
3
|
+
import { UserDeleteAccountView } from './UserDeleteAccountView/UserDeleteAccountView.js';
|
|
3
4
|
import { AccessBlockedView } from './AccessBlockedView/AccessBlockedView.js';
|
|
4
5
|
import { AccountExistsView } from './AccountExistsView/AccountExistsView.js';
|
|
5
6
|
import { BridgeNextWalletConnectionView } from './BridgeNextWalletConnectionView/BridgeNextWalletConnectionView.js';
|
|
@@ -199,6 +200,7 @@ const viewToComponentMap = {
|
|
|
199
200
|
'select-wallet-in-wallet-group': SelectWalletInWalletGroupView,
|
|
200
201
|
'social-redirect-view': SocialRedirectView,
|
|
201
202
|
'social-wrong-account': SocialWrongAccountView,
|
|
203
|
+
'user-delete-account': UserDeleteAccountView,
|
|
202
204
|
'verify-email': EmailVerification,
|
|
203
205
|
'verify-sms': SmsVerification,
|
|
204
206
|
'wait-for-email-confirmation-view': EmailConfirmationWaitingView,
|
|
@@ -4,10 +4,10 @@
|
|
|
4
4
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
5
|
|
|
6
6
|
var jsxRuntime = require('react/jsx-runtime');
|
|
7
|
+
var React = require('react');
|
|
7
8
|
require('@dynamic-labs/utils');
|
|
8
9
|
require('../../../../../components/Accordion/components/AccordionItem/AccordionItem.cjs');
|
|
9
10
|
require('../../../../../components/Alert/Alert.cjs');
|
|
10
|
-
require('react');
|
|
11
11
|
require('../../../../../events/dynamicEvents.cjs');
|
|
12
12
|
require('../../../../../../../_virtual/_tslib.cjs');
|
|
13
13
|
require('../../../../../context/DynamicContext/DynamicContext.cjs');
|
|
@@ -15,7 +15,7 @@ require('@dynamic-labs/sdk-api-core');
|
|
|
15
15
|
require('../../../../../shared/logger.cjs');
|
|
16
16
|
require('@dynamic-labs/iconic');
|
|
17
17
|
require('@dynamic-labs/wallet-connector-core');
|
|
18
|
-
var
|
|
18
|
+
var arrowDown = require('../../../../../shared/assets/arrow-down.cjs');
|
|
19
19
|
require('../../../../../context/ViewContext/ViewContext.cjs');
|
|
20
20
|
require('@dynamic-labs/wallet-book');
|
|
21
21
|
var shortenWalletAddress = require('../../../../../shared/utils/functions/shortenWalletAddress/shortenWalletAddress.cjs');
|
|
@@ -70,14 +70,15 @@ require('../../../../../context/WalletGroupContext/WalletGroupContext.cjs');
|
|
|
70
70
|
require('../../DynamicWidgetHeader/DynamicWidgetHeader.cjs');
|
|
71
71
|
require('react-focus-lock');
|
|
72
72
|
require('../../../context/DynamicWidgetContext.cjs');
|
|
73
|
-
|
|
73
|
+
require('../../../../../components/IconButton/IconButton.cjs');
|
|
74
|
+
var Dropdown = require('../../../../../components/MenuList/Dropdown/Dropdown.cjs');
|
|
75
|
+
var DotsMenuDropdown = require('../../DotsMenuDropdown/DotsMenuDropdown.cjs');
|
|
76
|
+
var BaseButton = require('../../../../../components/BaseButton/BaseButton.cjs');
|
|
74
77
|
require('formik');
|
|
75
78
|
require('../../../../../utils/hooks/useSubdomainCheck/useSubdomainCheck.cjs');
|
|
76
|
-
require('../../../../../components/IconButton/IconButton.cjs');
|
|
77
79
|
require('../../../../../store/state/sendBalances.cjs');
|
|
78
80
|
require('../../../../../components/Input/Input.cjs');
|
|
79
81
|
require('../../../../../components/OverlayCard/OverlayCard.cjs');
|
|
80
|
-
require('../../../../../components/MenuList/Dropdown/Dropdown.cjs');
|
|
81
82
|
require('../../../../../views/TransactionConfirmationView/TransactionConfirmationView.cjs');
|
|
82
83
|
var PasskeyContext = require('../../../../../context/PasskeyContext/PasskeyContext.cjs');
|
|
83
84
|
require('../../../views/ManagePasskeysWidgetView/PasskeyCard/PasskeyCard.cjs');
|
|
@@ -118,6 +119,16 @@ const ActiveWalletAddress = ({ wallet, nameServiceName, menuOption, fullWidth =
|
|
|
118
119
|
const { showAlert } = PasskeyContext.usePasskeyContext();
|
|
119
120
|
const header = nameServiceName || getNameIfNoIcon(wallet);
|
|
120
121
|
const { network } = useWalletConnectorNetwork.useWalletConnectorNetwork(wallet === null || wallet === void 0 ? void 0 : wallet.connector);
|
|
122
|
+
const [showMenu, setShowMenu] = React.useState(false);
|
|
123
|
+
const handleMenuClose = React.useCallback(() => {
|
|
124
|
+
setShowMenu(false);
|
|
125
|
+
}, [setShowMenu]);
|
|
126
|
+
const handleMenuOpen = React.useCallback(() => {
|
|
127
|
+
// Use setTimeout here to prevent React 17 from triggering a click event
|
|
128
|
+
// when the dropdown is rendered.
|
|
129
|
+
setTimeout(() => setShowMenu(true), 0);
|
|
130
|
+
}, [setShowMenu]);
|
|
131
|
+
const iconRef = React.useRef(null);
|
|
121
132
|
const { data: address } = usePromise.usePromise(() => {
|
|
122
133
|
// COSMOS wallet address changes based on which network is selected
|
|
123
134
|
if ((wallet === null || wallet === void 0 ? void 0 : wallet.connector.connectedChain) === 'COSMOS') {
|
|
@@ -128,9 +139,10 @@ const ActiveWalletAddress = ({ wallet, nameServiceName, menuOption, fullWidth =
|
|
|
128
139
|
deps: [wallet, network],
|
|
129
140
|
enabled: Boolean(wallet),
|
|
130
141
|
});
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
142
|
+
const menuIcon = React.useMemo(() => (jsxRuntime.jsx("div", { ref: iconRef, className: 'active-wallet-information__handle-icon', children: showAlert() ? (jsxRuntime.jsx(IconWithStatus.IconWithStatus, { Icon: () => jsxRuntime.jsx(arrowDown.ReactComponent, { width: 24, height: 24 }), variant: 'yellow' })) : (jsxRuntime.jsx(arrowDown.ReactComponent, { width: 24, height: 24 })) })), [showAlert]);
|
|
143
|
+
return (jsxRuntime.jsxs("div", { className: 'active-wallet-information__address-container', children: [jsxRuntime.jsxs(BaseButton.BaseButton, { onClick: handleMenuOpen, dataTestId: 'active-wallet-information-button', children: [jsxRuntime.jsxs("div", { className: 'active-wallet-information__handle-row', children: [jsxRuntime.jsx(Typography.Typography, { className: fullWidth
|
|
144
|
+
? 'active-wallet-information__handle--full-width'
|
|
145
|
+
: 'active-wallet-information__handle', color: 'primary', variant: 'body_normal', "data-testid": 'header-text', children: header }), header && menuIcon] }), jsxRuntime.jsxs("div", { className: 'active-wallet-information__handle-row', children: [jsxRuntime.jsx(Typography.Typography, { className: 'active-wallet-information__address', weight: header ? 'regular' : 'medium', variant: header ? 'body_small' : 'body_normal', color: header ? 'secondary' : 'primary', children: isLoading ? (jsxRuntime.jsx(Skeleton.Skeleton, { className: 'active-wallet-information__address-skeleton' })) : (shortenWalletAddress.shortenWalletAddress(address, 4, 4)) }), !header && menuIcon] })] }), jsxRuntime.jsx(Dropdown.Dropdown, { isOpen: showMenu, onClickOutside: handleMenuClose, onScroll: handleMenuClose, anchorRef: iconRef, anchorOrigin: 'bottom-right', transformOrigin: 'top-left', children: jsxRuntime.jsx(DotsMenuDropdown.DotsMenuDropdown, { options: menuOption, setShowMenu: setShowMenu }) })] }));
|
|
134
146
|
};
|
|
135
147
|
|
|
136
148
|
exports.ActiveWalletAddress = ActiveWalletAddress;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
'use client'
|
|
2
|
-
import {
|
|
2
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
3
|
+
import { useState, useCallback, useRef, useMemo } from 'react';
|
|
3
4
|
import '@dynamic-labs/utils';
|
|
4
5
|
import '../../../../../components/Accordion/components/AccordionItem/AccordionItem.js';
|
|
5
6
|
import '../../../../../components/Alert/Alert.js';
|
|
6
|
-
import 'react';
|
|
7
7
|
import '../../../../../events/dynamicEvents.js';
|
|
8
8
|
import '../../../../../../../_virtual/_tslib.js';
|
|
9
9
|
import '../../../../../context/DynamicContext/DynamicContext.js';
|
|
@@ -11,7 +11,7 @@ import '@dynamic-labs/sdk-api-core';
|
|
|
11
11
|
import '../../../../../shared/logger.js';
|
|
12
12
|
import '@dynamic-labs/iconic';
|
|
13
13
|
import '@dynamic-labs/wallet-connector-core';
|
|
14
|
-
import { ReactComponent as
|
|
14
|
+
import { ReactComponent as SvgArrowDown } from '../../../../../shared/assets/arrow-down.js';
|
|
15
15
|
import '../../../../../context/ViewContext/ViewContext.js';
|
|
16
16
|
import '@dynamic-labs/wallet-book';
|
|
17
17
|
import { shortenWalletAddress } from '../../../../../shared/utils/functions/shortenWalletAddress/shortenWalletAddress.js';
|
|
@@ -66,14 +66,15 @@ import '../../../../../context/WalletGroupContext/WalletGroupContext.js';
|
|
|
66
66
|
import '../../DynamicWidgetHeader/DynamicWidgetHeader.js';
|
|
67
67
|
import 'react-focus-lock';
|
|
68
68
|
import '../../../context/DynamicWidgetContext.js';
|
|
69
|
-
import
|
|
69
|
+
import '../../../../../components/IconButton/IconButton.js';
|
|
70
|
+
import { Dropdown } from '../../../../../components/MenuList/Dropdown/Dropdown.js';
|
|
71
|
+
import { DotsMenuDropdown } from '../../DotsMenuDropdown/DotsMenuDropdown.js';
|
|
72
|
+
import { BaseButton } from '../../../../../components/BaseButton/BaseButton.js';
|
|
70
73
|
import 'formik';
|
|
71
74
|
import '../../../../../utils/hooks/useSubdomainCheck/useSubdomainCheck.js';
|
|
72
|
-
import '../../../../../components/IconButton/IconButton.js';
|
|
73
75
|
import '../../../../../store/state/sendBalances.js';
|
|
74
76
|
import '../../../../../components/Input/Input.js';
|
|
75
77
|
import '../../../../../components/OverlayCard/OverlayCard.js';
|
|
76
|
-
import '../../../../../components/MenuList/Dropdown/Dropdown.js';
|
|
77
78
|
import '../../../../../views/TransactionConfirmationView/TransactionConfirmationView.js';
|
|
78
79
|
import { usePasskeyContext } from '../../../../../context/PasskeyContext/PasskeyContext.js';
|
|
79
80
|
import '../../../views/ManagePasskeysWidgetView/PasskeyCard/PasskeyCard.js';
|
|
@@ -114,6 +115,16 @@ const ActiveWalletAddress = ({ wallet, nameServiceName, menuOption, fullWidth =
|
|
|
114
115
|
const { showAlert } = usePasskeyContext();
|
|
115
116
|
const header = nameServiceName || getNameIfNoIcon(wallet);
|
|
116
117
|
const { network } = useWalletConnectorNetwork(wallet === null || wallet === void 0 ? void 0 : wallet.connector);
|
|
118
|
+
const [showMenu, setShowMenu] = useState(false);
|
|
119
|
+
const handleMenuClose = useCallback(() => {
|
|
120
|
+
setShowMenu(false);
|
|
121
|
+
}, [setShowMenu]);
|
|
122
|
+
const handleMenuOpen = useCallback(() => {
|
|
123
|
+
// Use setTimeout here to prevent React 17 from triggering a click event
|
|
124
|
+
// when the dropdown is rendered.
|
|
125
|
+
setTimeout(() => setShowMenu(true), 0);
|
|
126
|
+
}, [setShowMenu]);
|
|
127
|
+
const iconRef = useRef(null);
|
|
117
128
|
const { data: address } = usePromise(() => {
|
|
118
129
|
// COSMOS wallet address changes based on which network is selected
|
|
119
130
|
if ((wallet === null || wallet === void 0 ? void 0 : wallet.connector.connectedChain) === 'COSMOS') {
|
|
@@ -124,9 +135,10 @@ const ActiveWalletAddress = ({ wallet, nameServiceName, menuOption, fullWidth =
|
|
|
124
135
|
deps: [wallet, network],
|
|
125
136
|
enabled: Boolean(wallet),
|
|
126
137
|
});
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
138
|
+
const menuIcon = useMemo(() => (jsx("div", { ref: iconRef, className: 'active-wallet-information__handle-icon', children: showAlert() ? (jsx(IconWithStatus, { Icon: () => jsx(SvgArrowDown, { width: 24, height: 24 }), variant: 'yellow' })) : (jsx(SvgArrowDown, { width: 24, height: 24 })) })), [showAlert]);
|
|
139
|
+
return (jsxs("div", { className: 'active-wallet-information__address-container', children: [jsxs(BaseButton, { onClick: handleMenuOpen, dataTestId: 'active-wallet-information-button', children: [jsxs("div", { className: 'active-wallet-information__handle-row', children: [jsx(Typography, { className: fullWidth
|
|
140
|
+
? 'active-wallet-information__handle--full-width'
|
|
141
|
+
: 'active-wallet-information__handle', color: 'primary', variant: 'body_normal', "data-testid": 'header-text', children: header }), header && menuIcon] }), jsxs("div", { className: 'active-wallet-information__handle-row', children: [jsx(Typography, { className: 'active-wallet-information__address', weight: header ? 'regular' : 'medium', variant: header ? 'body_small' : 'body_normal', color: header ? 'secondary' : 'primary', children: isLoading ? (jsx(Skeleton, { className: 'active-wallet-information__address-skeleton' })) : (shortenWalletAddress(address, 4, 4)) }), !header && menuIcon] })] }), jsx(Dropdown, { isOpen: showMenu, onClickOutside: handleMenuClose, onScroll: handleMenuClose, anchorRef: iconRef, anchorOrigin: 'bottom-right', transformOrigin: 'top-left', children: jsx(DotsMenuDropdown, { options: menuOption, setShowMenu: setShowMenu }) })] }));
|
|
130
142
|
};
|
|
131
143
|
|
|
132
144
|
export { ActiveWalletAddress, getNameIfNoIcon };
|
|
@@ -11,7 +11,7 @@ export type DynamicPasskeyWidgetViewsType = typeof DynamicPasskeyWidgetViews[num
|
|
|
11
11
|
export type DynamicMfaWidgetViewsType = typeof DynamicMfaWidgetViews[number];
|
|
12
12
|
export declare const DynamicTransactionsWidgetViews: readonly ["send-balance"];
|
|
13
13
|
export type DynamicTransactionsWidgetViewsType = typeof DynamicTransactionsWidgetViews[number];
|
|
14
|
-
export type DynamicWidgetViews = 'wallets' | 'profile' | 'edit-profile' | 'choose-wallet-funding-method' | 'receive-wallet-funds' | DynamicTransactionsWidgetViewsType | DynamicPasskeyWidgetViewsType | DynamicMfaWidgetViewsType | DynamicSettingsType | DynamicGlobalWalletType | 'connected-apps' | 'deposit-view' | 'choose-onramp-provider' | '
|
|
14
|
+
export type DynamicWidgetViews = 'wallets' | 'profile' | 'edit-profile' | 'choose-wallet-funding-method' | 'receive-wallet-funds' | DynamicTransactionsWidgetViewsType | DynamicPasskeyWidgetViewsType | DynamicMfaWidgetViewsType | DynamicSettingsType | DynamicGlobalWalletType | 'connected-apps' | 'deposit-view' | 'choose-onramp-provider' | 'choose-linked-wallet';
|
|
15
15
|
export type DynamicWidgetViewMapConstraint = Record<DynamicWidgetViews, FC<any>>;
|
|
16
16
|
export type DynamicWidgetViewMap = typeof mapViewToComponent;
|
|
17
17
|
export type SetDynamicWidgetView = <T extends DynamicWidgetViews>(view: T, props?: ComponentProps<DynamicWidgetViewMap[T]>) => void;
|
|
@@ -98,7 +98,7 @@ const useFetchChain = (connector) => {
|
|
|
98
98
|
var _a, _b;
|
|
99
99
|
if (!connector)
|
|
100
100
|
return { chainId: undefined, name: '', symbol: undefined };
|
|
101
|
-
const chainId = yield connector.getNetwork();
|
|
101
|
+
const chainId = yield connector.getNetwork(true);
|
|
102
102
|
const { connectedChain } = connector;
|
|
103
103
|
const chainInfo = walletConnectorCore.getChainInfoWithOverrides(connectedChain || '');
|
|
104
104
|
const chainWithIcon = {
|
|
@@ -94,7 +94,7 @@ const useFetchChain = (connector) => {
|
|
|
94
94
|
var _a, _b;
|
|
95
95
|
if (!connector)
|
|
96
96
|
return { chainId: undefined, name: '', symbol: undefined };
|
|
97
|
-
const chainId = yield connector.getNetwork();
|
|
97
|
+
const chainId = yield connector.getNetwork(true);
|
|
98
98
|
const { connectedChain } = connector;
|
|
99
99
|
const chainInfo = getChainInfoWithOverrides(connectedChain || '');
|
|
100
100
|
const chainWithIcon = {
|
|
@@ -95,10 +95,10 @@ require('../../../../shared/utils/functions/getInitialUrl/getInitialUrl.cjs');
|
|
|
95
95
|
|
|
96
96
|
const useFetchCurrency = (connector, network) => {
|
|
97
97
|
const fetchChainCurrency = () => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
98
|
-
var _a, _b, _c, _d, _e
|
|
98
|
+
var _a, _b, _c, _d, _e;
|
|
99
99
|
if (!connector)
|
|
100
100
|
return null;
|
|
101
|
-
const chainId = yield connector.getNetwork();
|
|
101
|
+
const chainId = yield connector.getNetwork(true);
|
|
102
102
|
const chainInfo = walletConnectorCore.getChainInfoWithOverrides((_a = connector.connectedChain) !== null && _a !== void 0 ? _a : '');
|
|
103
103
|
/* istanbul ignore else */
|
|
104
104
|
if (!chainId) {
|
|
@@ -107,21 +107,11 @@ const useFetchCurrency = (connector, network) => {
|
|
|
107
107
|
symbol: chainInfo === null || chainInfo === void 0 ? void 0 : chainInfo.symbol,
|
|
108
108
|
};
|
|
109
109
|
}
|
|
110
|
-
const
|
|
111
|
-
|
|
112
|
-
return 'starknetNetworks';
|
|
113
|
-
}
|
|
114
|
-
else if (connector.connectedChain === 'ECLIPSE') {
|
|
115
|
-
return 'eclipseNetworks';
|
|
116
|
-
}
|
|
117
|
-
else {
|
|
118
|
-
return 'evmNetworks';
|
|
119
|
-
}
|
|
120
|
-
})();
|
|
121
|
-
const result = (_b = connector[network]) === null || _b === void 0 ? void 0 : _b.find((element) => element.chainId === chainId);
|
|
110
|
+
const enabledNetworks = connector.getEnabledNetworks();
|
|
111
|
+
const result = enabledNetworks === null || enabledNetworks === void 0 ? void 0 : enabledNetworks.find((network) => network.chainId === chainId);
|
|
122
112
|
return {
|
|
123
|
-
name: (
|
|
124
|
-
symbol: (
|
|
113
|
+
name: (_c = (_b = result === null || result === void 0 ? void 0 : result.nativeCurrency) === null || _b === void 0 ? void 0 : _b.name) !== null && _c !== void 0 ? _c : chainInfo === null || chainInfo === void 0 ? void 0 : chainInfo.displayName,
|
|
114
|
+
symbol: (_e = (_d = result === null || result === void 0 ? void 0 : result.nativeCurrency) === null || _d === void 0 ? void 0 : _d.symbol) !== null && _e !== void 0 ? _e : chainInfo === null || chainInfo === void 0 ? void 0 : chainInfo.symbol,
|
|
125
115
|
};
|
|
126
116
|
});
|
|
127
117
|
const { data: currency, isLoading } = usePromise.usePromise(fetchChainCurrency, {
|
|
@@ -91,10 +91,10 @@ import '../../../../shared/utils/functions/getInitialUrl/getInitialUrl.js';
|
|
|
91
91
|
|
|
92
92
|
const useFetchCurrency = (connector, network) => {
|
|
93
93
|
const fetchChainCurrency = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
94
|
-
var _a, _b, _c, _d, _e
|
|
94
|
+
var _a, _b, _c, _d, _e;
|
|
95
95
|
if (!connector)
|
|
96
96
|
return null;
|
|
97
|
-
const chainId = yield connector.getNetwork();
|
|
97
|
+
const chainId = yield connector.getNetwork(true);
|
|
98
98
|
const chainInfo = getChainInfoWithOverrides((_a = connector.connectedChain) !== null && _a !== void 0 ? _a : '');
|
|
99
99
|
/* istanbul ignore else */
|
|
100
100
|
if (!chainId) {
|
|
@@ -103,21 +103,11 @@ const useFetchCurrency = (connector, network) => {
|
|
|
103
103
|
symbol: chainInfo === null || chainInfo === void 0 ? void 0 : chainInfo.symbol,
|
|
104
104
|
};
|
|
105
105
|
}
|
|
106
|
-
const
|
|
107
|
-
|
|
108
|
-
return 'starknetNetworks';
|
|
109
|
-
}
|
|
110
|
-
else if (connector.connectedChain === 'ECLIPSE') {
|
|
111
|
-
return 'eclipseNetworks';
|
|
112
|
-
}
|
|
113
|
-
else {
|
|
114
|
-
return 'evmNetworks';
|
|
115
|
-
}
|
|
116
|
-
})();
|
|
117
|
-
const result = (_b = connector[network]) === null || _b === void 0 ? void 0 : _b.find((element) => element.chainId === chainId);
|
|
106
|
+
const enabledNetworks = connector.getEnabledNetworks();
|
|
107
|
+
const result = enabledNetworks === null || enabledNetworks === void 0 ? void 0 : enabledNetworks.find((network) => network.chainId === chainId);
|
|
118
108
|
return {
|
|
119
|
-
name: (
|
|
120
|
-
symbol: (
|
|
109
|
+
name: (_c = (_b = result === null || result === void 0 ? void 0 : result.nativeCurrency) === null || _b === void 0 ? void 0 : _b.name) !== null && _c !== void 0 ? _c : chainInfo === null || chainInfo === void 0 ? void 0 : chainInfo.displayName,
|
|
110
|
+
symbol: (_e = (_d = result === null || result === void 0 ? void 0 : result.nativeCurrency) === null || _d === void 0 ? void 0 : _d.symbol) !== null && _e !== void 0 ? _e : chainInfo === null || chainInfo === void 0 ? void 0 : chainInfo.symbol,
|
|
121
111
|
};
|
|
122
112
|
});
|
|
123
113
|
const { data: currency, isLoading } = usePromise(fetchChainCurrency, {
|
|
@@ -23,7 +23,7 @@ var exportRecoveryPhrase = require('../../../../shared/assets/export-recovery-ph
|
|
|
23
23
|
var footerInfoIcon = require('../../../../shared/assets/footer-info-icon.cjs');
|
|
24
24
|
var shield = require('../../../../shared/assets/shield.cjs');
|
|
25
25
|
var signInWithEmail = require('../../../../shared/assets/sign-in-with-email.cjs');
|
|
26
|
-
require('../../../../context/ViewContext/ViewContext.cjs');
|
|
26
|
+
var ViewContext = require('../../../../context/ViewContext/ViewContext.cjs');
|
|
27
27
|
require('@dynamic-labs/wallet-book');
|
|
28
28
|
require('@dynamic-labs/utils');
|
|
29
29
|
require('../../../../utils/constants/colors.cjs');
|
|
@@ -117,7 +117,8 @@ var useInternalDynamicContext = require('../../../../context/DynamicContext/useD
|
|
|
117
117
|
|
|
118
118
|
const AccountAndSecuritySettingsView = () => {
|
|
119
119
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
120
|
-
const {
|
|
120
|
+
const { pushView } = ViewContext.useViewContext();
|
|
121
|
+
const { primaryWallet, user, setShowAuthFlow } = useInternalDynamicContext.useInternalDynamicContext();
|
|
121
122
|
const projectSettings$1 = projectSettings.useProjectSettings();
|
|
122
123
|
const { setDynamicWidgetView } = DynamicWidgetContext.useWidgetContext();
|
|
123
124
|
const { addEmbeddedWalletRecoveryEmail } = useEmbeddedWalletAuthenticator.useEmbeddedWalletAuthenticator();
|
|
@@ -181,6 +182,14 @@ const AccountAndSecuritySettingsView = () => {
|
|
|
181
182
|
const handlePasskeyButtonClick = React.useCallback(() => handlePasskeyClick(), [handlePasskeyClick]);
|
|
182
183
|
const handleExportButtonClick = React.useCallback(() => handleExportClick(), [handleExportClick]);
|
|
183
184
|
const handleExportWithPhraseClick = React.useCallback(() => handleExportClick(true), [handleExportClick]);
|
|
185
|
+
const handleDeleteAccountClick = React.useCallback(() => {
|
|
186
|
+
pushView('user-delete-account', {}, {
|
|
187
|
+
onBackClick: () => {
|
|
188
|
+
setShowAuthFlow(false);
|
|
189
|
+
},
|
|
190
|
+
});
|
|
191
|
+
setShowAuthFlow(true);
|
|
192
|
+
}, [pushView, setShowAuthFlow]);
|
|
184
193
|
const renderPasskeysButtonEndSlot = () => {
|
|
185
194
|
if (isTurnkeyWalletWithAuthenticator)
|
|
186
195
|
return (jsxRuntime.jsx(checkCircle.ReactComponent, { className: 'settings-view__body__section__button__icon-secondary--success' }));
|
|
@@ -206,7 +215,7 @@ const AccountAndSecuritySettingsView = () => {
|
|
|
206
215
|
const identitySectionTitleClasses = React.useMemo(() => classNames.classNames('settings-view__body__section__title', 'settings-view__body__section__title__info-icon'), []);
|
|
207
216
|
const emailButtonClasses = React.useMemo(() => classNames.classNames('settings-view__body__section__button', 'settings-view__body__section__button__badge'), []);
|
|
208
217
|
return (jsxRuntime.jsxs("div", { className: 'account-and-security-settings-view', children: [jsxRuntime.jsx(ModalHeader.ModalHeader, { leading: backButton, children: jsxRuntime.jsx("div", { className: 'send-balance-page-layout__header-content', children: jsxRuntime.jsx(Typography.Typography, { variant: 'title', color: 'primary', copykey: 'dyn_settings.account_security.title', children: t('dyn_settings.account_security.title') }) }) }), jsxRuntime.jsx("div", { className: 'account-wrap', children: jsxRuntime.jsxs("div", { className: 'settings-view__body', children: [jsxRuntime.jsxs("div", { className: 'settings-view__body__section', children: [shouldShowPasskeyMFA ||
|
|
209
|
-
(isMfaEnabled && (jsxRuntime.jsx("div", { className: securitySectionTitleClasses, children: t('dyn_settings.security_section.title') }))),
|
|
218
|
+
(isMfaEnabled && (jsxRuntime.jsx("div", { className: securitySectionTitleClasses, children: t('dyn_settings.security_section.title') }))), shouldShowPasskeyMFA && (jsxRuntime.jsx(TypographyButton.TypographyButton, { dataTestId: 'manage-passkeys-button', onClick: handlePasskeyButtonClick, buttonClassName: passkeyButtonClasses, startSlot:
|
|
210
219
|
// eslint-disable-next-line react/jsx-wrap-multilines
|
|
211
220
|
jsxRuntime.jsxs("div", { className: 'settings-view__body__section__button__start-slot', children: [jsxRuntime.jsx(PasskeyDeviceIcon.PasskeyDeviceIcon, { className: 'settings-view__body__section__button__icon', defaultIcon: jsxRuntime.jsx(androidTouchId.ReactComponent, { "data-testid": 'default-icon' }) }), jsxRuntime.jsx(Typography.Typography, { color: 'primary', weight: 'medium', copykey: 'dyn_settings.security_section.passkey_button', children: t('dyn_settings.security_section.passkey_button') }), !isTurnkeyWalletWithAuthenticator && (jsxRuntime.jsx(Badge.Badge, { text: t('dyn_settings.tags.recommended'), copykey: 'dyn_settings.tags.recommended', variant: 'secondary' }))] }), endSlot: renderPasskeysButtonEndSlot(), disabled: isLoading, showInternalLoading: false })), isMfaEnabled && (jsxRuntime.jsx(TypographyButton.TypographyButton, { dataTestId: 'manage-mfa-button', onClick: handleMfaClick, buttonClassName: 'settings-view__body__section__button', startSlot:
|
|
212
221
|
// eslint-disable-next-line react/jsx-wrap-multilines
|
|
@@ -218,7 +227,7 @@ const AccountAndSecuritySettingsView = () => {
|
|
|
218
227
|
// eslint-disable-next-line react/jsx-wrap-multilines
|
|
219
228
|
jsxRuntime.jsxs("div", { className: 'settings-view__body__section__button__start-slot', children: [jsxRuntime.jsx(exportPrivateKey.ReactComponent, { className: exportIconClasses }), jsxRuntime.jsx(Typography.Typography, { color: 'primary', weight: 'medium', copykey: 'dyn_settings.export_section.private_key_button', children: t('dyn_settings.export_section.private_key_button') })] }), endSlot: jsxRuntime.jsx(chevronLeft.ReactComponent, { className: 'settings-view__body__section__button__icon-secondary--rotate' }), showInternalLoading: false }), isTurnkeyHDWallet && (jsxRuntime.jsx(TypographyButton.TypographyButton, { dataTestId: 'embedded-reveal-button', onClick: handleExportWithPhraseClick, buttonClassName: 'settings-view__body__section__button', startSlot:
|
|
220
229
|
// eslint-disable-next-line react/jsx-wrap-multilines
|
|
221
|
-
jsxRuntime.jsxs("div", { className: 'settings-view__body__section__button__start-slot', children: [jsxRuntime.jsx(exportRecoveryPhrase.ReactComponent, { className: exportIconClasses }), jsxRuntime.jsx(Typography.Typography, { color: 'primary', weight: 'medium', copykey: 'dyn_settings.export_section.srp_button', children: t('dyn_settings.export_section.srp_button') })] }), endSlot: jsxRuntime.jsx(chevronLeft.ReactComponent, { className: 'settings-view__body__section__button__icon-secondary--rotate' }), showInternalLoading: false }))] })] }))] }) })] }));
|
|
230
|
+
jsxRuntime.jsxs("div", { className: 'settings-view__body__section__button__start-slot', children: [jsxRuntime.jsx(exportRecoveryPhrase.ReactComponent, { className: exportIconClasses }), jsxRuntime.jsx(Typography.Typography, { color: 'primary', weight: 'medium', copykey: 'dyn_settings.export_section.srp_button', children: t('dyn_settings.export_section.srp_button') })] }), endSlot: jsxRuntime.jsx(chevronLeft.ReactComponent, { className: 'settings-view__body__section__button__icon-secondary--rotate' }), showInternalLoading: false }))] })] }))] }) }), jsxRuntime.jsx("div", { className: 'account-and-security-settings-view__delete-account-container', children: jsxRuntime.jsx(Typography.Typography, { onClick: handleDeleteAccountClick, dataTestId: 'delete-account-button', color: 'error-1', variant: 'body_small', className: 'account-and-security-settings-view__delete-account-container__delete-button', children: t('dyn_settings.delete_account.title') }) })] }));
|
|
222
231
|
};
|
|
223
232
|
|
|
224
233
|
exports.AccountAndSecuritySettingsView = AccountAndSecuritySettingsView;
|
|
@@ -19,7 +19,7 @@ import { ReactComponent as SvgExportRecoveryPhrase } from '../../../../shared/as
|
|
|
19
19
|
import { ReactComponent as SvgFooterInfoIcon } from '../../../../shared/assets/footer-info-icon.js';
|
|
20
20
|
import { ReactComponent as SvgShield } from '../../../../shared/assets/shield.js';
|
|
21
21
|
import { ReactComponent as SvgSignInWithEmail } from '../../../../shared/assets/sign-in-with-email.js';
|
|
22
|
-
import '../../../../context/ViewContext/ViewContext.js';
|
|
22
|
+
import { useViewContext } from '../../../../context/ViewContext/ViewContext.js';
|
|
23
23
|
import '@dynamic-labs/wallet-book';
|
|
24
24
|
import '@dynamic-labs/utils';
|
|
25
25
|
import '../../../../utils/constants/colors.js';
|
|
@@ -113,7 +113,8 @@ import { useInternalDynamicContext } from '../../../../context/DynamicContext/us
|
|
|
113
113
|
|
|
114
114
|
const AccountAndSecuritySettingsView = () => {
|
|
115
115
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
116
|
-
const {
|
|
116
|
+
const { pushView } = useViewContext();
|
|
117
|
+
const { primaryWallet, user, setShowAuthFlow } = useInternalDynamicContext();
|
|
117
118
|
const projectSettings = useProjectSettings();
|
|
118
119
|
const { setDynamicWidgetView } = useWidgetContext();
|
|
119
120
|
const { addEmbeddedWalletRecoveryEmail } = useEmbeddedWalletAuthenticator();
|
|
@@ -177,6 +178,14 @@ const AccountAndSecuritySettingsView = () => {
|
|
|
177
178
|
const handlePasskeyButtonClick = useCallback(() => handlePasskeyClick(), [handlePasskeyClick]);
|
|
178
179
|
const handleExportButtonClick = useCallback(() => handleExportClick(), [handleExportClick]);
|
|
179
180
|
const handleExportWithPhraseClick = useCallback(() => handleExportClick(true), [handleExportClick]);
|
|
181
|
+
const handleDeleteAccountClick = useCallback(() => {
|
|
182
|
+
pushView('user-delete-account', {}, {
|
|
183
|
+
onBackClick: () => {
|
|
184
|
+
setShowAuthFlow(false);
|
|
185
|
+
},
|
|
186
|
+
});
|
|
187
|
+
setShowAuthFlow(true);
|
|
188
|
+
}, [pushView, setShowAuthFlow]);
|
|
180
189
|
const renderPasskeysButtonEndSlot = () => {
|
|
181
190
|
if (isTurnkeyWalletWithAuthenticator)
|
|
182
191
|
return (jsx(SvgCheckCircle, { className: 'settings-view__body__section__button__icon-secondary--success' }));
|
|
@@ -202,7 +211,7 @@ const AccountAndSecuritySettingsView = () => {
|
|
|
202
211
|
const identitySectionTitleClasses = useMemo(() => classNames('settings-view__body__section__title', 'settings-view__body__section__title__info-icon'), []);
|
|
203
212
|
const emailButtonClasses = useMemo(() => classNames('settings-view__body__section__button', 'settings-view__body__section__button__badge'), []);
|
|
204
213
|
return (jsxs("div", { className: 'account-and-security-settings-view', children: [jsx(ModalHeader, { leading: backButton, children: jsx("div", { className: 'send-balance-page-layout__header-content', children: jsx(Typography, { variant: 'title', color: 'primary', copykey: 'dyn_settings.account_security.title', children: t('dyn_settings.account_security.title') }) }) }), jsx("div", { className: 'account-wrap', children: jsxs("div", { className: 'settings-view__body', children: [jsxs("div", { className: 'settings-view__body__section', children: [shouldShowPasskeyMFA ||
|
|
205
|
-
(isMfaEnabled && (jsx("div", { className: securitySectionTitleClasses, children: t('dyn_settings.security_section.title') }))),
|
|
214
|
+
(isMfaEnabled && (jsx("div", { className: securitySectionTitleClasses, children: t('dyn_settings.security_section.title') }))), shouldShowPasskeyMFA && (jsx(TypographyButton, { dataTestId: 'manage-passkeys-button', onClick: handlePasskeyButtonClick, buttonClassName: passkeyButtonClasses, startSlot:
|
|
206
215
|
// eslint-disable-next-line react/jsx-wrap-multilines
|
|
207
216
|
jsxs("div", { className: 'settings-view__body__section__button__start-slot', children: [jsx(PasskeyDeviceIcon, { className: 'settings-view__body__section__button__icon', defaultIcon: jsx(SvgAndroidTouchId, { "data-testid": 'default-icon' }) }), jsx(Typography, { color: 'primary', weight: 'medium', copykey: 'dyn_settings.security_section.passkey_button', children: t('dyn_settings.security_section.passkey_button') }), !isTurnkeyWalletWithAuthenticator && (jsx(Badge, { text: t('dyn_settings.tags.recommended'), copykey: 'dyn_settings.tags.recommended', variant: 'secondary' }))] }), endSlot: renderPasskeysButtonEndSlot(), disabled: isLoading, showInternalLoading: false })), isMfaEnabled && (jsx(TypographyButton, { dataTestId: 'manage-mfa-button', onClick: handleMfaClick, buttonClassName: 'settings-view__body__section__button', startSlot:
|
|
208
217
|
// eslint-disable-next-line react/jsx-wrap-multilines
|
|
@@ -214,7 +223,7 @@ const AccountAndSecuritySettingsView = () => {
|
|
|
214
223
|
// eslint-disable-next-line react/jsx-wrap-multilines
|
|
215
224
|
jsxs("div", { className: 'settings-view__body__section__button__start-slot', children: [jsx(SvgExportPrivateKey, { className: exportIconClasses }), jsx(Typography, { color: 'primary', weight: 'medium', copykey: 'dyn_settings.export_section.private_key_button', children: t('dyn_settings.export_section.private_key_button') })] }), endSlot: jsx(SvgChevronLeft, { className: 'settings-view__body__section__button__icon-secondary--rotate' }), showInternalLoading: false }), isTurnkeyHDWallet && (jsx(TypographyButton, { dataTestId: 'embedded-reveal-button', onClick: handleExportWithPhraseClick, buttonClassName: 'settings-view__body__section__button', startSlot:
|
|
216
225
|
// eslint-disable-next-line react/jsx-wrap-multilines
|
|
217
|
-
jsxs("div", { className: 'settings-view__body__section__button__start-slot', children: [jsx(SvgExportRecoveryPhrase, { className: exportIconClasses }), jsx(Typography, { color: 'primary', weight: 'medium', copykey: 'dyn_settings.export_section.srp_button', children: t('dyn_settings.export_section.srp_button') })] }), endSlot: jsx(SvgChevronLeft, { className: 'settings-view__body__section__button__icon-secondary--rotate' }), showInternalLoading: false }))] })] }))] }) })] }));
|
|
226
|
+
jsxs("div", { className: 'settings-view__body__section__button__start-slot', children: [jsx(SvgExportRecoveryPhrase, { className: exportIconClasses }), jsx(Typography, { color: 'primary', weight: 'medium', copykey: 'dyn_settings.export_section.srp_button', children: t('dyn_settings.export_section.srp_button') })] }), endSlot: jsx(SvgChevronLeft, { className: 'settings-view__body__section__button__icon-secondary--rotate' }), showInternalLoading: false }))] })] }))] }) }), jsx("div", { className: 'account-and-security-settings-view__delete-account-container', children: jsx(Typography, { onClick: handleDeleteAccountClick, dataTestId: 'delete-account-button', color: 'error-1', variant: 'body_small', className: 'account-and-security-settings-view__delete-account-container__delete-button', children: t('dyn_settings.delete_account.title') }) })] }));
|
|
218
227
|
};
|
|
219
228
|
|
|
220
229
|
export { AccountAndSecuritySettingsView };
|