@dynamic-labs/sdk-react-core 1.1.0-alpha.7 → 1.1.0-alpha.9
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 +31 -0
- package/package.cjs +2 -2
- package/package.js +2 -2
- package/package.json +12 -11
- package/src/index.cjs +4 -2
- package/src/index.js +2 -1
- package/src/lib/Main.cjs +4 -5
- package/src/lib/Main.js +4 -5
- package/src/lib/components/ChainCard/ChainCard.d.ts +2 -2
- package/src/lib/components/SelectWalletChainLayout/SelectWalletChainLayout.cjs +5 -1
- package/src/lib/components/SelectWalletChainLayout/SelectWalletChainLayout.js +5 -1
- package/src/lib/components/Toggle/Toggle.cjs +14 -0
- package/src/lib/components/Toggle/Toggle.d.ts +7 -0
- package/src/lib/components/Toggle/Toggle.js +10 -0
- package/src/lib/components/Toggle/index.d.ts +1 -0
- package/src/lib/context/DynamicContext/DynamicContext.cjs +42 -34
- package/src/lib/context/DynamicContext/DynamicContext.js +43 -35
- package/src/lib/context/DynamicContext/hooks/index.d.ts +1 -1
- package/src/lib/context/DynamicContext/hooks/useSetShowLinkNewWalletModal/index.d.ts +1 -0
- package/src/lib/context/DynamicContext/hooks/useSetShowLinkNewWalletModal/useSetShowLinkNewWalletModal.cjs +48 -0
- package/src/lib/context/DynamicContext/hooks/{useSetShowAuthFlowWithInit/useSetShowAuthFlowWithInit.d.ts → useSetShowLinkNewWalletModal/useSetShowLinkNewWalletModal.d.ts} +4 -7
- package/src/lib/context/DynamicContext/hooks/useSetShowLinkNewWalletModal/useSetShowLinkNewWalletModal.js +44 -0
- package/src/lib/context/DynamicContext/hooks/useShowAuthFlow/index.d.ts +1 -0
- package/src/lib/context/DynamicContext/hooks/useShowAuthFlow/useShowAuthFlow.cjs +59 -0
- package/src/lib/context/DynamicContext/hooks/useShowAuthFlow/useShowAuthFlow.d.ts +37 -0
- package/src/lib/context/DynamicContext/hooks/useShowAuthFlow/useShowAuthFlow.js +55 -0
- package/src/lib/context/DynamicContext/hooks/useTieCallbacksToEvents/useTieCallbacksToEvents.cjs +1 -0
- package/src/lib/context/DynamicContext/hooks/useTieCallbacksToEvents/useTieCallbacksToEvents.js +1 -0
- package/src/lib/context/DynamicContext/types/index.d.ts +11 -7
- package/src/lib/context/DynamicContext/useDynamicContext.cjs +8 -2
- package/src/lib/context/DynamicContext/useDynamicContext.d.ts +4 -1
- package/src/lib/context/DynamicContext/useDynamicContext.js +8 -2
- package/src/lib/context/FundingContext/FundingContext.cjs +4 -1
- package/src/lib/context/FundingContext/FundingContext.js +4 -1
- package/src/lib/context/SocialRedirectContext/SocialRedirectContext.cjs +1 -1
- package/src/lib/context/SocialRedirectContext/SocialRedirectContext.js +1 -1
- package/src/lib/context/ViewContext/ViewContext.d.ts +1 -1
- package/src/lib/events/dynamicEvents.d.ts +3 -0
- package/src/lib/layout/DynamicAuthLayout/HelpContent/WalletListHelpContent/WalletExtensionOrAppContinueButton/WalletExtensionOrAppContinueButton.cjs +2 -2
- package/src/lib/layout/DynamicAuthLayout/HelpContent/WalletListHelpContent/WalletExtensionOrAppContinueButton/WalletExtensionOrAppContinueButton.js +2 -2
- package/src/lib/layout/DynamicAuthLayout/HelpContent/WalletListHelpContent/WalletListHelpContent.cjs +5 -5
- package/src/lib/layout/DynamicAuthLayout/HelpContent/WalletListHelpContent/WalletListHelpContent.js +5 -5
- package/src/lib/locale/en/translation.cjs +18 -2
- package/src/lib/locale/en/translation.d.ts +17 -1
- package/src/lib/locale/en/translation.js +18 -2
- package/src/lib/shared/assets/alt-key.cjs +54 -0
- package/src/lib/shared/assets/alt-key.js +30 -0
- package/src/lib/shared/assets/index.d.ts +1 -0
- package/src/lib/shared/types/index.d.ts +3 -0
- package/src/lib/styles/index.shadow.cjs +1 -1
- package/src/lib/styles/index.shadow.js +1 -1
- package/src/lib/utils/functions/isSelectedWalletAlreadyConnected/isSelectedWalletAlreadyConnected.cjs +2 -4
- package/src/lib/utils/functions/isSelectedWalletAlreadyConnected/isSelectedWalletAlreadyConnected.js +2 -4
- package/src/lib/utils/functions/walletListBuilder/utils/filterConnectedWallets/filterConnectedWallets.cjs +13 -2
- package/src/lib/utils/functions/walletListBuilder/utils/filterConnectedWallets/filterConnectedWallets.js +13 -2
- package/src/lib/utils/functions/walletListBuilder/walletListBuilder.cjs +3 -3
- package/src/lib/utils/functions/walletListBuilder/walletListBuilder.js +4 -4
- package/src/lib/utils/hooks/authenticationHooks/useSignConnectOnlyUser/useSignConnectOnlyUser.cjs +1 -1
- package/src/lib/utils/hooks/authenticationHooks/useSignConnectOnlyUser/useSignConnectOnlyUser.js +1 -1
- package/src/lib/utils/hooks/index.d.ts +1 -0
- package/src/lib/utils/hooks/multiWallet/useMultiWallet/useMultiWallet.cjs +3 -2
- package/src/lib/utils/hooks/multiWallet/useMultiWallet/useMultiWallet.d.ts +6 -1
- package/src/lib/utils/hooks/multiWallet/useMultiWallet/useMultiWallet.js +3 -2
- package/src/lib/utils/hooks/useAuthLayoutChecks/useAuthLayoutChecks.cjs +2 -1
- package/src/lib/utils/hooks/useAuthLayoutChecks/useAuthLayoutChecks.js +2 -1
- package/src/lib/utils/hooks/useClearWalletConnectSessions/useClearWalletConnectSessions.cjs +3 -3
- package/src/lib/utils/hooks/useClearWalletConnectSessions/useClearWalletConnectSessions.js +3 -3
- package/src/lib/utils/hooks/useConnectWallet/useConnectWallet.cjs +1 -1
- package/src/lib/utils/hooks/useConnectWallet/useConnectWallet.d.ts +2 -2
- package/src/lib/utils/hooks/useConnectWallet/useConnectWallet.js +1 -1
- package/src/lib/utils/hooks/useCreateDynamicEmbeddedWalletMutation/useCreateDynamicEmbeddedWalletMutation.cjs +2 -2
- package/src/lib/utils/hooks/useCreateDynamicEmbeddedWalletMutation/useCreateDynamicEmbeddedWalletMutation.js +2 -2
- package/src/lib/utils/hooks/useEmbeddedReveal/useEmbeddedReveal.cjs +23 -13
- package/src/lib/utils/hooks/useEmbeddedReveal/useEmbeddedReveal.d.ts +1 -1
- package/src/lib/utils/hooks/useEmbeddedReveal/useEmbeddedReveal.js +23 -13
- package/src/lib/utils/hooks/useEmbeddedWallet/useEmbeddedWallet.cjs +9 -6
- package/src/lib/utils/hooks/useEmbeddedWallet/useEmbeddedWallet.js +9 -6
- package/src/lib/utils/hooks/useHandleUnlinkWallet/useHandleUnlinkWallet.cjs +5 -3
- package/src/lib/utils/hooks/useHandleUnlinkWallet/useHandleUnlinkWallet.js +5 -3
- package/src/lib/utils/hooks/usePasskeyRecovery/usePasskeyRecovery.cjs +6 -8
- package/src/lib/utils/hooks/usePasskeyRecovery/usePasskeyRecovery.js +6 -8
- package/src/lib/utils/hooks/useSocialAuth/useSocialAuth.cjs +1 -1
- package/src/lib/utils/hooks/useSocialAuth/useSocialAuth.js +1 -1
- package/src/lib/utils/hooks/useUserUpdateRequest/useUpdateUserWithModal/useUpdateUserWithModal.cjs +8 -5
- package/src/lib/utils/hooks/useUserUpdateRequest/useUpdateUserWithModal/useUpdateUserWithModal.js +8 -5
- package/src/lib/utils/hooks/useVerifyWallet/useVerifyWallet.cjs +2 -2
- package/src/lib/utils/hooks/useVerifyWallet/useVerifyWallet.js +2 -2
- package/src/lib/utils/hooks/useWalletConnectorNetwork/index.d.ts +1 -0
- package/src/lib/utils/hooks/useWalletConnectorNetwork/useWalletConnectorNetwork.cjs +42 -0
- package/src/lib/utils/hooks/useWalletConnectorNetwork/useWalletConnectorNetwork.d.ts +18 -0
- package/src/lib/utils/hooks/useWalletConnectorNetwork/useWalletConnectorNetwork.js +38 -0
- package/src/lib/utils/hooks/useWalletConnectors/useWalletConnectors.cjs +2 -2
- package/src/lib/utils/hooks/useWalletConnectors/useWalletConnectors.js +2 -2
- package/src/lib/utils/hooks/useWalletConnectors/utils/findWallet/findWallet.cjs +5 -2
- package/src/lib/utils/hooks/useWalletConnectors/utils/findWallet/findWallet.js +5 -2
- package/src/lib/views/BridgeNextWalletConnectionView/BridgeNextWalletConnectionView.cjs +1 -1
- package/src/lib/views/BridgeNextWalletConnectionView/BridgeNextWalletConnectionView.js +1 -1
- package/src/lib/views/BridgeSummaryView/BridgeSummaryView.cjs +1 -1
- package/src/lib/views/BridgeSummaryView/BridgeSummaryView.js +1 -1
- package/src/lib/views/BridgeWelcomeView/BridgeWelcomeView.cjs +1 -1
- package/src/lib/views/BridgeWelcomeView/BridgeWelcomeView.js +1 -1
- package/src/lib/views/EmailVerification/EmailVerification.cjs +1 -1
- package/src/lib/views/EmailVerification/EmailVerification.js +1 -1
- package/src/lib/views/EmbeddedReveal/EmbeddedRevealView/EmbeddedRevealView.cjs +20 -18
- package/src/lib/views/EmbeddedReveal/EmbeddedRevealView/EmbeddedRevealView.js +20 -18
- package/src/lib/views/EmbeddedReveal/utils/turnkeyExport/turnkeyExport.cjs +55 -30
- package/src/lib/views/EmbeddedReveal/utils/turnkeyExport/turnkeyExport.d.ts +7 -1
- package/src/lib/views/EmbeddedReveal/utils/turnkeyExport/turnkeyExport.js +55 -31
- package/src/lib/views/LoginView/LoginView.cjs +60 -7
- package/src/lib/views/LoginView/LoginView.js +60 -7
- package/src/lib/views/MergeUserAccountsView/MergeUserAccountsView.cjs +1 -1
- package/src/lib/views/MergeUserAccountsView/MergeUserAccountsView.js +1 -1
- package/src/lib/views/NetworkNotSupported/NetworkNotSupported.cjs +3 -4
- package/src/lib/views/NetworkNotSupported/NetworkNotSupported.js +3 -4
- package/src/lib/views/NetworkNotSupportedSwitchManual/NetworkNotSupportedSwitchManual.cjs +3 -6
- package/src/lib/views/NetworkNotSupportedSwitchManual/NetworkNotSupportedSwitchManual.js +3 -6
- package/src/lib/views/Passkey/PasskeyRecovery/InitRecovery/PasskeyInitRecovery.cjs +1 -1
- package/src/lib/views/Passkey/PasskeyRecovery/InitRecovery/PasskeyInitRecovery.js +1 -1
- package/src/lib/views/QrCodeView/QRCode.cjs +2 -3
- package/src/lib/views/QrCodeView/QRCode.js +2 -3
- package/src/lib/views/WalletGroupView/WalletGroupView.cjs +72 -1
- package/src/lib/views/WalletGroupView/WalletGroupView.js +73 -2
- package/src/lib/views/WalletGroupView/components/HardwareWalletToggle/HardwareWalletToggle.cjs +74 -0
- package/src/lib/views/WalletGroupView/components/HardwareWalletToggle/HardwareWalletToggle.d.ts +7 -0
- package/src/lib/views/WalletGroupView/components/HardwareWalletToggle/HardwareWalletToggle.js +70 -0
- package/src/lib/views/WalletGroupView/components/HardwareWalletToggle/index.d.ts +1 -0
- package/src/lib/views/WalletGroupView/components/WalletGroupItem/WalletGroupItem.cjs +2 -4
- package/src/lib/views/WalletGroupView/components/WalletGroupItem/WalletGroupItem.d.ts +2 -1
- package/src/lib/views/WalletGroupView/components/WalletGroupItem/WalletGroupItem.js +2 -4
- package/src/lib/views/WalletUsedView/WalletUsedView.cjs +5 -5
- package/src/lib/views/WalletUsedView/WalletUsedView.js +5 -5
- package/src/lib/views/viewToComponentMap.cjs +1 -0
- package/src/lib/views/viewToComponentMap.js +1 -0
- package/src/lib/widgets/DynamicBridgeWidget/views/EditProfileView/EditProfileView.cjs +6 -3
- package/src/lib/widgets/DynamicBridgeWidget/views/EditProfileView/EditProfileView.js +6 -3
- package/src/lib/widgets/DynamicWidget/components/ActiveWalletInformation/ActiveBitcoinWalletAddresses/ActiveBitcoinWalletAddresses.cjs +76 -0
- package/src/lib/widgets/DynamicWidget/components/ActiveWalletInformation/ActiveBitcoinWalletAddresses/ActiveBitcoinWalletAddresses.d.ts +9 -0
- package/src/lib/widgets/DynamicWidget/components/ActiveWalletInformation/ActiveBitcoinWalletAddresses/ActiveBitcoinWalletAddresses.js +72 -0
- package/src/lib/widgets/DynamicWidget/components/ActiveWalletInformation/ActiveBitcoinWalletAddresses/index.d.ts +1 -0
- package/src/lib/widgets/DynamicWidget/components/ActiveWalletInformation/ActiveWalletAddress/ActiveWalletAddress.cjs +67 -0
- package/src/lib/widgets/DynamicWidget/components/ActiveWalletInformation/ActiveWalletAddress/ActiveWalletAddress.d.ts +9 -0
- package/src/lib/widgets/DynamicWidget/components/ActiveWalletInformation/ActiveWalletAddress/ActiveWalletAddress.js +63 -0
- package/src/lib/widgets/DynamicWidget/components/ActiveWalletInformation/ActiveWalletAddress/index.d.ts +1 -0
- package/src/lib/widgets/DynamicWidget/components/ActiveWalletInformation/ActiveWalletInformation.cjs +9 -8
- package/src/lib/widgets/DynamicWidget/components/ActiveWalletInformation/ActiveWalletInformation.js +9 -8
- package/src/lib/widgets/DynamicWidget/hooks/useFetchBalance/useFetchBalance.cjs +66 -21
- package/src/lib/widgets/DynamicWidget/hooks/useFetchBalance/useFetchBalance.d.ts +1 -1
- package/src/lib/widgets/DynamicWidget/hooks/useFetchBalance/useFetchBalance.js +67 -22
- package/src/lib/widgets/DynamicWidget/prompts/QrCodeModalView/QrCodeModalView.cjs +2 -2
- package/src/lib/widgets/DynamicWidget/prompts/QrCodeModalView/QrCodeModalView.js +2 -2
- package/src/lib/widgets/DynamicWidget/views/EditProfileView/EditProfileView.cjs +7 -3
- package/src/lib/widgets/DynamicWidget/views/EditProfileView/EditProfileView.js +7 -3
- package/src/lib/widgets/DynamicWidget/views/WalletSettingsView/WalletSettingsView.cjs +8 -6
- package/src/lib/widgets/DynamicWidget/views/WalletSettingsView/WalletSettingsView.js +8 -6
- package/src/lib/widgets/DynamicWidget/views/WalletsView/WalletsView.cjs +2 -2
- package/src/lib/widgets/DynamicWidget/views/WalletsView/WalletsView.js +2 -2
- package/src/lib/context/DynamicContext/hooks/useSetShowAuthFlowWithInit/index.d.ts +0 -1
- package/src/lib/context/DynamicContext/hooks/useSetShowAuthFlowWithInit/useSetShowAuthFlowWithInit.cjs +0 -33
- package/src/lib/context/DynamicContext/hooks/useSetShowAuthFlowWithInit/useSetShowAuthFlowWithInit.js +0 -29
|
@@ -4,42 +4,87 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
var _tslib = require('../../../../../../_virtual/_tslib.cjs');
|
|
6
6
|
var React = require('react');
|
|
7
|
+
require('../../../../events/dynamicEvents.cjs');
|
|
8
|
+
var useWalletConnectorEvent = require('../../../../utils/hooks/events/useWalletConnectorEvent/useWalletConnectorEvent.cjs');
|
|
9
|
+
require('@dynamic-labs/utils');
|
|
10
|
+
require('../../../../context/DynamicContext/DynamicContext.cjs');
|
|
11
|
+
require('@dynamic-labs/wallet-connector-core');
|
|
12
|
+
require('../../../../context/CaptchaContext/CaptchaContext.cjs');
|
|
13
|
+
require('../../../../context/ErrorContext/ErrorContext.cjs');
|
|
14
|
+
require('../../../../context/ViewContext/ViewContext.cjs');
|
|
7
15
|
require('@dynamic-labs/sdk-api');
|
|
8
16
|
require('../../../../shared/logger.cjs');
|
|
9
17
|
require('@dynamic-labs/iconic');
|
|
10
|
-
require('@dynamic-labs/wallet-connector-core');
|
|
11
18
|
require('react/jsx-runtime');
|
|
12
|
-
require('../../../../context/ViewContext/ViewContext.cjs');
|
|
13
19
|
require('@dynamic-labs/wallet-book');
|
|
14
20
|
require('../../../../utils/constants/colors.cjs');
|
|
15
21
|
require('../../../../shared/utils/classes/storage/localStorage.cjs');
|
|
16
22
|
require('viem');
|
|
17
|
-
require('@dynamic-labs/utils');
|
|
18
23
|
require('../../../../shared/consts/index.cjs');
|
|
19
24
|
require('@dynamic-labs/multi-wallet');
|
|
20
25
|
var isWalletConnected = require('../../../../utils/functions/isWalletConnected/isWalletConnected.cjs');
|
|
26
|
+
require('../../../../context/AccessDeniedContext/AccessDeniedContext.cjs');
|
|
27
|
+
require('../../../../context/AccountExistsContext/AccountExistsContext.cjs');
|
|
28
|
+
require('../../../../config/ApiEndpoint.cjs');
|
|
29
|
+
require('../../../../context/EmailVerificationContext/EmailVerificationContext.cjs');
|
|
30
|
+
require('react-dom');
|
|
31
|
+
require('../../../../context/ThemeContext/ThemeContext.cjs');
|
|
32
|
+
var usePromise = require('../../../../utils/hooks/usePromise/usePromise.cjs');
|
|
33
|
+
require('@dynamic-labs/types');
|
|
34
|
+
require('yup');
|
|
35
|
+
require('react-i18next');
|
|
36
|
+
require('../../../../context/MockContext/MockContext.cjs');
|
|
37
|
+
require('../../../../utils/hooks/useUserUpdateRequest/useUpdateUser/useUpdateUser.cjs');
|
|
38
|
+
require('../../../../context/UserFieldEditorContext/UserFieldEditorContext.cjs');
|
|
39
|
+
require('@dynamic-labs/rpc-providers');
|
|
40
|
+
require('../../../../context/UserWalletsContext/UserWalletsContext.cjs');
|
|
41
|
+
require('../../../../components/Alert/Alert.cjs');
|
|
42
|
+
require('../../../../components/ShadowDOM/ShadowDOM.cjs');
|
|
43
|
+
require('../../../../components/IconButton/IconButton.cjs');
|
|
44
|
+
require('../../../../components/InlineWidget/InlineWidget.cjs');
|
|
45
|
+
require('../../../../components/MenuList/Dropdown/Dropdown.cjs');
|
|
46
|
+
require('../../../../components/Transition/ZoomTransition/ZoomTransition.cjs');
|
|
47
|
+
require('../../../../components/Transition/SlideInUpTransition/SlideInUpTransition.cjs');
|
|
48
|
+
require('../../../../components/Transition/OpacityTransition/OpacityTransition.cjs');
|
|
49
|
+
require('../../../../components/Popper/Popper/Popper.cjs');
|
|
50
|
+
require('../../../../components/Popper/PopperContext/PopperContext.cjs');
|
|
51
|
+
require('react-focus-lock');
|
|
52
|
+
require('formik');
|
|
53
|
+
require('i18next');
|
|
54
|
+
require('../../../../components/OverlayCard/OverlayCard.context.cjs');
|
|
55
|
+
require('../../../../context/FooterAnimationContext/index.cjs');
|
|
56
|
+
require('../../../../context/QrCodeContext/QrCodeContext.cjs');
|
|
57
|
+
require('../../../../context/WalletGroupContext/WalletGroupContext.cjs');
|
|
58
|
+
require('../../components/DynamicWidgetHeader/DynamicWidgetHeader.cjs');
|
|
59
|
+
require('../../../../context/LoadingContext/LoadingContext.cjs');
|
|
60
|
+
require('qrcode');
|
|
61
|
+
require('../../context/DynamicWidgetContext.cjs');
|
|
62
|
+
require('../../../../components/UserProfile/parts/UserProfileField/components/VerifiedEmailIcon/VerifiedEmailIcon.cjs');
|
|
63
|
+
require('@dynamic-labs/viem-utils');
|
|
64
|
+
require('../../views/ManagePasskeysWidgetView/PasskeyCard/PasskeyCard.cjs');
|
|
21
65
|
|
|
22
66
|
const useFetchBalance = ({ connector, chain, address, network, }) => {
|
|
23
67
|
const [balance, setBalance] = React.useState('0.0');
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
chain,
|
|
33
|
-
connector,
|
|
34
|
-
});
|
|
35
|
-
/* istanbul ignore else */
|
|
36
|
-
if (isConnected) {
|
|
37
|
-
const value = yield connector.getBalance();
|
|
38
|
-
setBalance(value);
|
|
39
|
-
}
|
|
68
|
+
const isFetchBalanceDisabled = !chain || !address || (connector.supportsNetworkSwitching() && !network);
|
|
69
|
+
const fetchBalance = () => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
70
|
+
if (isFetchBalanceDisabled)
|
|
71
|
+
return;
|
|
72
|
+
const isConnected = yield isWalletConnected.isWalletConnected({
|
|
73
|
+
address,
|
|
74
|
+
chain,
|
|
75
|
+
connector,
|
|
40
76
|
});
|
|
41
|
-
|
|
42
|
-
|
|
77
|
+
/* istanbul ignore else */
|
|
78
|
+
if (isConnected) {
|
|
79
|
+
const value = yield connector.getBalance();
|
|
80
|
+
setBalance(value);
|
|
81
|
+
}
|
|
82
|
+
});
|
|
83
|
+
usePromise.usePromise(fetchBalance, {
|
|
84
|
+
deps: [address, network === null || network === void 0 ? void 0 : network.toString(), chain],
|
|
85
|
+
enabled: !isFetchBalanceDisabled,
|
|
86
|
+
});
|
|
87
|
+
useWalletConnectorEvent.useWalletConnectorEvent(connector, 'accountChange', fetchBalance);
|
|
43
88
|
return [balance];
|
|
44
89
|
};
|
|
45
90
|
|
|
@@ -1,41 +1,86 @@
|
|
|
1
1
|
import { __awaiter } from '../../../../../../_virtual/_tslib.js';
|
|
2
|
-
import { useState
|
|
2
|
+
import { useState } from 'react';
|
|
3
|
+
import '../../../../events/dynamicEvents.js';
|
|
4
|
+
import { useWalletConnectorEvent } from '../../../../utils/hooks/events/useWalletConnectorEvent/useWalletConnectorEvent.js';
|
|
5
|
+
import '@dynamic-labs/utils';
|
|
6
|
+
import '../../../../context/DynamicContext/DynamicContext.js';
|
|
7
|
+
import '@dynamic-labs/wallet-connector-core';
|
|
8
|
+
import '../../../../context/CaptchaContext/CaptchaContext.js';
|
|
9
|
+
import '../../../../context/ErrorContext/ErrorContext.js';
|
|
10
|
+
import '../../../../context/ViewContext/ViewContext.js';
|
|
3
11
|
import '@dynamic-labs/sdk-api';
|
|
4
12
|
import '../../../../shared/logger.js';
|
|
5
13
|
import '@dynamic-labs/iconic';
|
|
6
|
-
import '@dynamic-labs/wallet-connector-core';
|
|
7
14
|
import 'react/jsx-runtime';
|
|
8
|
-
import '../../../../context/ViewContext/ViewContext.js';
|
|
9
15
|
import '@dynamic-labs/wallet-book';
|
|
10
16
|
import '../../../../utils/constants/colors.js';
|
|
11
17
|
import '../../../../shared/utils/classes/storage/localStorage.js';
|
|
12
18
|
import 'viem';
|
|
13
|
-
import '@dynamic-labs/utils';
|
|
14
19
|
import '../../../../shared/consts/index.js';
|
|
15
20
|
import '@dynamic-labs/multi-wallet';
|
|
16
21
|
import { isWalletConnected } from '../../../../utils/functions/isWalletConnected/isWalletConnected.js';
|
|
22
|
+
import '../../../../context/AccessDeniedContext/AccessDeniedContext.js';
|
|
23
|
+
import '../../../../context/AccountExistsContext/AccountExistsContext.js';
|
|
24
|
+
import '../../../../config/ApiEndpoint.js';
|
|
25
|
+
import '../../../../context/EmailVerificationContext/EmailVerificationContext.js';
|
|
26
|
+
import 'react-dom';
|
|
27
|
+
import '../../../../context/ThemeContext/ThemeContext.js';
|
|
28
|
+
import { usePromise } from '../../../../utils/hooks/usePromise/usePromise.js';
|
|
29
|
+
import '@dynamic-labs/types';
|
|
30
|
+
import 'yup';
|
|
31
|
+
import 'react-i18next';
|
|
32
|
+
import '../../../../context/MockContext/MockContext.js';
|
|
33
|
+
import '../../../../utils/hooks/useUserUpdateRequest/useUpdateUser/useUpdateUser.js';
|
|
34
|
+
import '../../../../context/UserFieldEditorContext/UserFieldEditorContext.js';
|
|
35
|
+
import '@dynamic-labs/rpc-providers';
|
|
36
|
+
import '../../../../context/UserWalletsContext/UserWalletsContext.js';
|
|
37
|
+
import '../../../../components/Alert/Alert.js';
|
|
38
|
+
import '../../../../components/ShadowDOM/ShadowDOM.js';
|
|
39
|
+
import '../../../../components/IconButton/IconButton.js';
|
|
40
|
+
import '../../../../components/InlineWidget/InlineWidget.js';
|
|
41
|
+
import '../../../../components/MenuList/Dropdown/Dropdown.js';
|
|
42
|
+
import '../../../../components/Transition/ZoomTransition/ZoomTransition.js';
|
|
43
|
+
import '../../../../components/Transition/SlideInUpTransition/SlideInUpTransition.js';
|
|
44
|
+
import '../../../../components/Transition/OpacityTransition/OpacityTransition.js';
|
|
45
|
+
import '../../../../components/Popper/Popper/Popper.js';
|
|
46
|
+
import '../../../../components/Popper/PopperContext/PopperContext.js';
|
|
47
|
+
import 'react-focus-lock';
|
|
48
|
+
import 'formik';
|
|
49
|
+
import 'i18next';
|
|
50
|
+
import '../../../../components/OverlayCard/OverlayCard.context.js';
|
|
51
|
+
import '../../../../context/FooterAnimationContext/index.js';
|
|
52
|
+
import '../../../../context/QrCodeContext/QrCodeContext.js';
|
|
53
|
+
import '../../../../context/WalletGroupContext/WalletGroupContext.js';
|
|
54
|
+
import '../../components/DynamicWidgetHeader/DynamicWidgetHeader.js';
|
|
55
|
+
import '../../../../context/LoadingContext/LoadingContext.js';
|
|
56
|
+
import 'qrcode';
|
|
57
|
+
import '../../context/DynamicWidgetContext.js';
|
|
58
|
+
import '../../../../components/UserProfile/parts/UserProfileField/components/VerifiedEmailIcon/VerifiedEmailIcon.js';
|
|
59
|
+
import '@dynamic-labs/viem-utils';
|
|
60
|
+
import '../../views/ManagePasskeysWidgetView/PasskeyCard/PasskeyCard.js';
|
|
17
61
|
|
|
18
62
|
const useFetchBalance = ({ connector, chain, address, network, }) => {
|
|
19
63
|
const [balance, setBalance] = useState('0.0');
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
chain,
|
|
29
|
-
connector,
|
|
30
|
-
});
|
|
31
|
-
/* istanbul ignore else */
|
|
32
|
-
if (isConnected) {
|
|
33
|
-
const value = yield connector.getBalance();
|
|
34
|
-
setBalance(value);
|
|
35
|
-
}
|
|
64
|
+
const isFetchBalanceDisabled = !chain || !address || (connector.supportsNetworkSwitching() && !network);
|
|
65
|
+
const fetchBalance = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
66
|
+
if (isFetchBalanceDisabled)
|
|
67
|
+
return;
|
|
68
|
+
const isConnected = yield isWalletConnected({
|
|
69
|
+
address,
|
|
70
|
+
chain,
|
|
71
|
+
connector,
|
|
36
72
|
});
|
|
37
|
-
|
|
38
|
-
|
|
73
|
+
/* istanbul ignore else */
|
|
74
|
+
if (isConnected) {
|
|
75
|
+
const value = yield connector.getBalance();
|
|
76
|
+
setBalance(value);
|
|
77
|
+
}
|
|
78
|
+
});
|
|
79
|
+
usePromise(fetchBalance, {
|
|
80
|
+
deps: [address, network === null || network === void 0 ? void 0 : network.toString(), chain],
|
|
81
|
+
enabled: !isFetchBalanceDisabled,
|
|
82
|
+
});
|
|
83
|
+
useWalletConnectorEvent(connector, 'accountChange', fetchBalance);
|
|
39
84
|
return [balance];
|
|
40
85
|
};
|
|
41
86
|
|
|
@@ -4,12 +4,12 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
var jsxRuntime = require('react/jsx-runtime');
|
|
6
6
|
var walletBook = require('@dynamic-labs/wallet-book');
|
|
7
|
-
var walletConnectorCore = require('@dynamic-labs/wallet-connector-core');
|
|
8
7
|
var QRCode = require('../../../../views/QrCodeView/QRCode.cjs');
|
|
9
8
|
require('react');
|
|
10
9
|
require('../../../../events/dynamicEvents.cjs');
|
|
11
10
|
require('@dynamic-labs/utils');
|
|
12
11
|
var useInternalDynamicContext = require('../../../../context/DynamicContext/useInternalDynamicContext.cjs');
|
|
12
|
+
require('@dynamic-labs/wallet-connector-core');
|
|
13
13
|
require('../../../../context/CaptchaContext/CaptchaContext.cjs');
|
|
14
14
|
require('../../../../context/ErrorContext/ErrorContext.cjs');
|
|
15
15
|
require('../../../../context/ViewContext/ViewContext.cjs');
|
|
@@ -87,7 +87,7 @@ const QrCodeModalView = ({ walletId }) => {
|
|
|
87
87
|
// can't use theme because it's string instead of 'light' | 'dark'
|
|
88
88
|
const typedTheme = theme.theme.name === 'light' ? 'light' : 'dark';
|
|
89
89
|
const icon = (jsxRuntime.jsx(walletBook.WalletIcon, { walletKey: walletKey, style: { height: pixelToRem.pixelToRem(24), width: pixelToRem.pixelToRem(24) } }));
|
|
90
|
-
return (jsxRuntime.jsxs("div", { className: 'qr-code-modal-view', children: [jsxRuntime.jsxs(Typography.Typography, { variant: 'button_primary', color: 'primary', className: 'qr-code-modal-view__title', children: ["Connect with ", newPrimaryWallet === null || newPrimaryWallet === void 0 ? void 0 : newPrimaryWallet.connector.name] }), jsxRuntime.jsxs(Typography.Typography, { variant: 'body_small', color: 'secondary', className: 'qr-code-modal-view__title', children: ["Connect wallet", ' ', jsxRuntime.jsx(Typography.Typography, { as: 'span', weight: 'medium', color: 'primary', children: shortenWalletAddress.shortenWalletAddress(newPrimaryWallet === null || newPrimaryWallet === void 0 ? void 0 : newPrimaryWallet.address, 4, 4) }), ' ', "to switch active account."] }), jsxRuntime.jsx("div", { className: 'qr-code-modal-view__container', children: jsxRuntime.jsx("div", { className: 'qr-code-modal-view__wrapper', children: qrcodeUri ? (jsxRuntime.jsx(QRCode.QRCode, { Icon: icon, accentColor: qrCodeColorsByTheme[typedTheme].accentColor, value: qrcodeUri, size: 175, logoSize: 40, walletKey:
|
|
90
|
+
return (jsxRuntime.jsxs("div", { className: 'qr-code-modal-view', children: [jsxRuntime.jsxs(Typography.Typography, { variant: 'button_primary', color: 'primary', className: 'qr-code-modal-view__title', children: ["Connect with ", newPrimaryWallet === null || newPrimaryWallet === void 0 ? void 0 : newPrimaryWallet.connector.name] }), jsxRuntime.jsxs(Typography.Typography, { variant: 'body_small', color: 'secondary', className: 'qr-code-modal-view__title', children: ["Connect wallet", ' ', jsxRuntime.jsx(Typography.Typography, { as: 'span', weight: 'medium', color: 'primary', children: shortenWalletAddress.shortenWalletAddress(newPrimaryWallet === null || newPrimaryWallet === void 0 ? void 0 : newPrimaryWallet.address, 4, 4) }), ' ', "to switch active account."] }), jsxRuntime.jsx("div", { className: 'qr-code-modal-view__container', children: jsxRuntime.jsx("div", { className: 'qr-code-modal-view__wrapper', children: qrcodeUri ? (jsxRuntime.jsx(QRCode.QRCode, { Icon: icon, accentColor: qrCodeColorsByTheme[typedTheme].accentColor, value: qrcodeUri, size: 175, logoSize: 40, walletKey: walletKey })) : (
|
|
91
91
|
// this div exists to give the parent a child, so that the parent
|
|
92
92
|
// takes on its given width and height. the result is stable
|
|
93
93
|
// rendering of this component, without this there is a brief flash
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
2
2
|
import { useWalletBookContext, getWalletPrimaryColor, WalletIcon } from '@dynamic-labs/wallet-book';
|
|
3
|
-
import { normalizeWalletName } from '@dynamic-labs/wallet-connector-core';
|
|
4
3
|
import { QRCode } from '../../../../views/QrCodeView/QRCode.js';
|
|
5
4
|
import 'react';
|
|
6
5
|
import '../../../../events/dynamicEvents.js';
|
|
7
6
|
import '@dynamic-labs/utils';
|
|
8
7
|
import { useInternalDynamicContext } from '../../../../context/DynamicContext/useInternalDynamicContext.js';
|
|
8
|
+
import '@dynamic-labs/wallet-connector-core';
|
|
9
9
|
import '../../../../context/CaptchaContext/CaptchaContext.js';
|
|
10
10
|
import '../../../../context/ErrorContext/ErrorContext.js';
|
|
11
11
|
import '../../../../context/ViewContext/ViewContext.js';
|
|
@@ -83,7 +83,7 @@ const QrCodeModalView = ({ walletId }) => {
|
|
|
83
83
|
// can't use theme because it's string instead of 'light' | 'dark'
|
|
84
84
|
const typedTheme = theme.theme.name === 'light' ? 'light' : 'dark';
|
|
85
85
|
const icon = (jsx(WalletIcon, { walletKey: walletKey, style: { height: pixelToRem(24), width: pixelToRem(24) } }));
|
|
86
|
-
return (jsxs("div", { className: 'qr-code-modal-view', children: [jsxs(Typography, { variant: 'button_primary', color: 'primary', className: 'qr-code-modal-view__title', children: ["Connect with ", newPrimaryWallet === null || newPrimaryWallet === void 0 ? void 0 : newPrimaryWallet.connector.name] }), jsxs(Typography, { variant: 'body_small', color: 'secondary', className: 'qr-code-modal-view__title', children: ["Connect wallet", ' ', jsx(Typography, { as: 'span', weight: 'medium', color: 'primary', children: shortenWalletAddress(newPrimaryWallet === null || newPrimaryWallet === void 0 ? void 0 : newPrimaryWallet.address, 4, 4) }), ' ', "to switch active account."] }), jsx("div", { className: 'qr-code-modal-view__container', children: jsx("div", { className: 'qr-code-modal-view__wrapper', children: qrcodeUri ? (jsx(QRCode, { Icon: icon, accentColor: qrCodeColorsByTheme[typedTheme].accentColor, value: qrcodeUri, size: 175, logoSize: 40, walletKey:
|
|
86
|
+
return (jsxs("div", { className: 'qr-code-modal-view', children: [jsxs(Typography, { variant: 'button_primary', color: 'primary', className: 'qr-code-modal-view__title', children: ["Connect with ", newPrimaryWallet === null || newPrimaryWallet === void 0 ? void 0 : newPrimaryWallet.connector.name] }), jsxs(Typography, { variant: 'body_small', color: 'secondary', className: 'qr-code-modal-view__title', children: ["Connect wallet", ' ', jsx(Typography, { as: 'span', weight: 'medium', color: 'primary', children: shortenWalletAddress(newPrimaryWallet === null || newPrimaryWallet === void 0 ? void 0 : newPrimaryWallet.address, 4, 4) }), ' ', "to switch active account."] }), jsx("div", { className: 'qr-code-modal-view__container', children: jsx("div", { className: 'qr-code-modal-view__wrapper', children: qrcodeUri ? (jsx(QRCode, { Icon: icon, accentColor: qrCodeColorsByTheme[typedTheme].accentColor, value: qrcodeUri, size: 175, logoSize: 40, walletKey: walletKey })) : (
|
|
87
87
|
// this div exists to give the parent a child, so that the parent
|
|
88
88
|
// takes on its given width and height. the result is stable
|
|
89
89
|
// rendering of this component, without this there is a brief flash
|
|
@@ -66,7 +66,7 @@ require('formik');
|
|
|
66
66
|
|
|
67
67
|
const EditProfileView = ({ rootClassName, }) => {
|
|
68
68
|
const { setView } = ViewContext.useViewContext();
|
|
69
|
-
const {
|
|
69
|
+
const { setShowAuthFlow, multiWallet } = useInternalDynamicContext.useInternalDynamicContext();
|
|
70
70
|
const { goToProfileView } = DynamicWidgetContext.useWidgetContext();
|
|
71
71
|
const { updateUser } = useUserUpdateRequest.useUserUpdateRequestInternal({
|
|
72
72
|
validationSchemaStripUnknown: true,
|
|
@@ -75,10 +75,14 @@ const EditProfileView = ({ rootClassName, }) => {
|
|
|
75
75
|
const { isEmailVerificationRequired } = yield updateUser(formValues);
|
|
76
76
|
goToProfileView();
|
|
77
77
|
if (isEmailVerificationRequired) {
|
|
78
|
-
|
|
78
|
+
setShowAuthFlow(true, {
|
|
79
|
+
ignoreIfIsEmbeddedWidget: false,
|
|
80
|
+
initializeWalletConnect: false,
|
|
81
|
+
performMultiWalletChecks: false,
|
|
82
|
+
});
|
|
79
83
|
setView('verify-email');
|
|
80
84
|
}
|
|
81
|
-
}), [goToProfileView,
|
|
85
|
+
}), [goToProfileView, setShowAuthFlow, setView, updateUser]);
|
|
82
86
|
const isKYCEnabled = useKYCFlag.useKYCFlag();
|
|
83
87
|
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [!multiWallet && isKYCEnabled && (jsxRuntime.jsx(Typography.Typography, { weight: 'regular', color: 'secondary', variant: 'body_normal', className: 'dynamic-widget-edit-profile-view__profile-title', children: "My information" })), jsxRuntime.jsx(UserProfileForm.UserProfileForm, { formClassName: rootClassName, onEditProfileSubmit: onEditProfileFormSubmit, onEditProfileCancel: goToProfileView })] }));
|
|
84
88
|
};
|
|
@@ -62,7 +62,7 @@ import 'formik';
|
|
|
62
62
|
|
|
63
63
|
const EditProfileView = ({ rootClassName, }) => {
|
|
64
64
|
const { setView } = useViewContext();
|
|
65
|
-
const {
|
|
65
|
+
const { setShowAuthFlow, multiWallet } = useInternalDynamicContext();
|
|
66
66
|
const { goToProfileView } = useWidgetContext();
|
|
67
67
|
const { updateUser } = useUserUpdateRequestInternal({
|
|
68
68
|
validationSchemaStripUnknown: true,
|
|
@@ -71,10 +71,14 @@ const EditProfileView = ({ rootClassName, }) => {
|
|
|
71
71
|
const { isEmailVerificationRequired } = yield updateUser(formValues);
|
|
72
72
|
goToProfileView();
|
|
73
73
|
if (isEmailVerificationRequired) {
|
|
74
|
-
|
|
74
|
+
setShowAuthFlow(true, {
|
|
75
|
+
ignoreIfIsEmbeddedWidget: false,
|
|
76
|
+
initializeWalletConnect: false,
|
|
77
|
+
performMultiWalletChecks: false,
|
|
78
|
+
});
|
|
75
79
|
setView('verify-email');
|
|
76
80
|
}
|
|
77
|
-
}), [goToProfileView,
|
|
81
|
+
}), [goToProfileView, setShowAuthFlow, setView, updateUser]);
|
|
78
82
|
const isKYCEnabled = useKYCFlag();
|
|
79
83
|
return (jsxs(Fragment, { children: [!multiWallet && isKYCEnabled && (jsx(Typography, { weight: 'regular', color: 'secondary', variant: 'body_normal', className: 'dynamic-widget-edit-profile-view__profile-title', children: "My information" })), jsx(UserProfileForm, { formClassName: rootClassName, onEditProfileSubmit: onEditProfileFormSubmit, onEditProfileCancel: goToProfileView })] }));
|
|
80
84
|
};
|
|
@@ -19,6 +19,7 @@ var chevronLeft = require('../../../../shared/assets/chevron-left.cjs');
|
|
|
19
19
|
var lock = require('../../../../shared/assets/lock.cjs');
|
|
20
20
|
var altEmbeddedWallet = require('../../../../shared/assets/alt-embedded-wallet.cjs');
|
|
21
21
|
var faceId = require('../../../../shared/assets/face-id.cjs');
|
|
22
|
+
var altKey = require('../../../../shared/assets/alt-key.cjs');
|
|
22
23
|
require('../../../../shared/logger.cjs');
|
|
23
24
|
require('@dynamic-labs/wallet-book');
|
|
24
25
|
require('../../../../utils/constants/colors.cjs');
|
|
@@ -32,7 +33,7 @@ require('../../../../context/AccountExistsContext/AccountExistsContext.cjs');
|
|
|
32
33
|
require('../../../../config/ApiEndpoint.cjs');
|
|
33
34
|
require('../../../../context/EmailVerificationContext/EmailVerificationContext.cjs');
|
|
34
35
|
require('react-dom');
|
|
35
|
-
require('../../../../context/ThemeContext/ThemeContext.cjs');
|
|
36
|
+
var ThemeContext = require('../../../../context/ThemeContext/ThemeContext.cjs');
|
|
36
37
|
require('@dynamic-labs/types');
|
|
37
38
|
require('yup');
|
|
38
39
|
require('../../../../context/MockContext/MockContext.cjs');
|
|
@@ -76,18 +77,19 @@ const WalletSettingsView = () => {
|
|
|
76
77
|
const { authToken } = useInternalDynamicContext.useInternalDynamicContext();
|
|
77
78
|
const { initExportProcess } = useEmbeddedReveal.useEmbeddedReveal();
|
|
78
79
|
const { isTurnkeyWallet, isTurnkeyWalletWithoutAuthenticator } = useIsTurnkeyWallet.useIsTurnkeyWallet();
|
|
80
|
+
const { theme } = ThemeContext.useThemeContext();
|
|
79
81
|
const { t } = reactI18next.useTranslation();
|
|
80
82
|
const decodedJwt = decodeJwt.decodeJwt(authToken);
|
|
81
83
|
const walletProperties = (_b = (_a = decodedJwt === null || decodedJwt === void 0 ? void 0 : decodedJwt.verifiedCredentials) === null || _a === void 0 ? void 0 : _a.find(({ walletName }) => walletName === null || walletName === void 0 ? void 0 : walletName.startsWith('turnkey'))) === null || _b === void 0 ? void 0 : _b.walletProperties;
|
|
82
84
|
const isTurnkeyHDWallet = walletProperties === null || walletProperties === void 0 ? void 0 : walletProperties.turnkeyHDWalletId;
|
|
83
85
|
const backButton = (jsxRuntime.jsx(IconButton.IconButton, { type: 'button', onClick: goToInitialDynamicWidgetView, "data-testid": 'back-button', children: jsxRuntime.jsx(chevronLeft.ReactComponent, {}) }));
|
|
84
|
-
return (jsxRuntime.jsxs("div", { className: 'wallet-settings-view', children: [jsxRuntime.jsx(ModalHeader.ModalHeader, { leading: backButton, children: jsxRuntime.jsx("div", { className: 'wallet-settings-view__header', children: jsxRuntime.jsx(Typography.Typography, { variant: 'title', color: 'primary', children: t('dyn_wallet_settings.title') }) }) }), jsxRuntime.jsxs("div", { className: 'wallet-settings-view__body', children: [jsxRuntime.jsxs("div", { className: 'wallet-settings-view__body__section', children: [jsxRuntime.jsx("div", { className: 'wallet-settings-view__body__section__title', children: t('dyn_wallet_settings.signing_section.title') }), jsxRuntime.jsx(Button.Button, { dataTestId: 'manage-passkeys-button', onClick: () => setDynamicWidgetView('manage-passkeys'), buttonClassName: 'wallet-settings-view__body__section__button', startSlot:
|
|
86
|
+
return (jsxRuntime.jsxs("div", { className: 'wallet-settings-view', children: [jsxRuntime.jsx(ModalHeader.ModalHeader, { leading: backButton, children: jsxRuntime.jsx("div", { className: 'wallet-settings-view__header', children: jsxRuntime.jsx(Typography.Typography, { variant: 'title', color: 'primary', copykey: 'dyn_wallet_settings.title', children: t('dyn_wallet_settings.title') }) }) }), jsxRuntime.jsxs("div", { className: 'wallet-settings-view__body', children: [jsxRuntime.jsxs("div", { className: 'wallet-settings-view__body__section', children: [jsxRuntime.jsx("div", { className: 'wallet-settings-view__body__section__title', children: t('dyn_wallet_settings.signing_section.title') }), jsxRuntime.jsx(Button.Button, { dataTestId: 'manage-passkeys-button', onClick: () => setDynamicWidgetView('manage-passkeys'), buttonClassName: 'wallet-settings-view__body__section__button', startSlot:
|
|
85
87
|
// eslint-disable-next-line react/jsx-wrap-multilines
|
|
86
|
-
jsxRuntime.jsxs("div", { className: 'wallet-settings-view__body__section__button__start-slot', children: [jsxRuntime.jsx(faceId.ReactComponent, { className: 'wallet-settings-view__body__section__button__icon' }), jsxRuntime.jsx(Typography.Typography, { weight: 'medium', children: t('dyn_wallet_settings.signing_section.passkey_button') })] }), endSlot: isTurnkeyWallet && !isTurnkeyWalletWithoutAuthenticator ? (jsxRuntime.jsx(checkCircle.ReactComponent, { className: 'wallet-settings-view__body__section__button__icon-secondary--success' })) : undefined, showInternalLoading: false })] }), jsxRuntime.jsxs("div", { className: 'wallet-settings-view__body__section', children: [jsxRuntime.jsx("div", { className: 'wallet-settings-view__body__section__title', children: t('dyn_wallet_settings.export_section.title') }), jsxRuntime.jsx(Button.Button, { dataTestId: 'embedded-reveal-button', onClick: initExportProcess, buttonClassName: 'wallet-settings-view__body__section__button', disabled: !isTurnkeyWallet || isTurnkeyWalletWithoutAuthenticator, startSlot:
|
|
88
|
+
jsxRuntime.jsxs("div", { className: 'wallet-settings-view__body__section__button__start-slot', children: [jsxRuntime.jsx(faceId.ReactComponent, { className: 'wallet-settings-view__body__section__button__icon' }), jsxRuntime.jsx(Typography.Typography, { color: 'primary', weight: 'medium', copykey: 'dyn_wallet_settings.signing_section.passkey_button', children: t('dyn_wallet_settings.signing_section.passkey_button') })] }), endSlot: isTurnkeyWallet && !isTurnkeyWalletWithoutAuthenticator ? (jsxRuntime.jsx(checkCircle.ReactComponent, { className: 'wallet-settings-view__body__section__button__icon-secondary--success' })) : undefined, showInternalLoading: false })] }), jsxRuntime.jsxs("div", { className: 'wallet-settings-view__body__section', children: [jsxRuntime.jsx("div", { className: 'wallet-settings-view__body__section__title', children: t('dyn_wallet_settings.export_section.title') }), jsxRuntime.jsx(Button.Button, { dataTestId: 'embedded-reveal-account-button', onClick: () => initExportProcess(), buttonClassName: 'wallet-settings-view__body__section__button', disabled: !isTurnkeyWallet || isTurnkeyWalletWithoutAuthenticator, startSlot:
|
|
87
89
|
// eslint-disable-next-line react/jsx-wrap-multilines
|
|
88
|
-
jsxRuntime.jsxs("div", { className: 'wallet-settings-view__body__section__button__start-slot', children: [jsxRuntime.jsx(
|
|
89
|
-
|
|
90
|
-
|
|
90
|
+
jsxRuntime.jsxs("div", { className: 'wallet-settings-view__body__section__button__start-slot', children: [jsxRuntime.jsx(altKey.ReactComponent, { className: `wallet-settings-view__body__section__button__icon${theme.theme.name === 'dark' ? '__stroke' : ''}` }), jsxRuntime.jsx(Typography.Typography, { color: 'primary', weight: 'medium', copykey: 'dyn_wallet_settings.export_section.private_key_button', children: t('dyn_wallet_settings.export_section.private_key_button') })] }), endSlot: isTurnkeyWallet && !isTurnkeyWalletWithoutAuthenticator ? (jsxRuntime.jsx(chevronLeft.ReactComponent, { className: 'wallet-settings-view__body__section__button__icon-secondary--rotate' })) : (jsxRuntime.jsx(lock.ReactComponent, { className: 'wallet-settings-view__body__section__button__icon-secondary' })), showInternalLoading: false }), isTurnkeyHDWallet && (jsxRuntime.jsx(Button.Button, { dataTestId: 'embedded-reveal-button', onClick: () => initExportProcess(true), buttonClassName: 'wallet-settings-view__body__section__button', disabled: !isTurnkeyWallet || isTurnkeyWalletWithoutAuthenticator, startSlot:
|
|
91
|
+
// eslint-disable-next-line react/jsx-wrap-multilines
|
|
92
|
+
jsxRuntime.jsxs("div", { className: 'wallet-settings-view__body__section__button__start-slot', children: [jsxRuntime.jsx(altEmbeddedWallet.ReactComponent, { className: `wallet-settings-view__body__section__button__icon${theme.theme.name === 'dark' ? '__stroke' : ''}` }), jsxRuntime.jsx(Typography.Typography, { color: 'primary', weight: 'medium', copykey: 'dyn_wallet_settings.export_section.srp_button', children: t('dyn_wallet_settings.export_section.srp_button') })] }), endSlot: !isTurnkeyWalletWithoutAuthenticator ? (jsxRuntime.jsx(chevronLeft.ReactComponent, { className: 'wallet-settings-view__body__section__button__icon-secondary--rotate' })) : (jsxRuntime.jsx(lock.ReactComponent, { className: 'wallet-settings-view__body__section__button__icon-secondary' })), showInternalLoading: false }))] })] })] }));
|
|
91
93
|
};
|
|
92
94
|
|
|
93
95
|
exports.WalletSettingsView = WalletSettingsView;
|
|
@@ -15,6 +15,7 @@ import { ReactComponent as SvgChevronLeft } from '../../../../shared/assets/chev
|
|
|
15
15
|
import { ReactComponent as SvgLock } from '../../../../shared/assets/lock.js';
|
|
16
16
|
import { ReactComponent as SvgAltEmbeddedWallet } from '../../../../shared/assets/alt-embedded-wallet.js';
|
|
17
17
|
import { ReactComponent as SvgFaceId } from '../../../../shared/assets/face-id.js';
|
|
18
|
+
import { ReactComponent as SvgAltKey } from '../../../../shared/assets/alt-key.js';
|
|
18
19
|
import '../../../../shared/logger.js';
|
|
19
20
|
import '@dynamic-labs/wallet-book';
|
|
20
21
|
import '../../../../utils/constants/colors.js';
|
|
@@ -28,7 +29,7 @@ import '../../../../context/AccountExistsContext/AccountExistsContext.js';
|
|
|
28
29
|
import '../../../../config/ApiEndpoint.js';
|
|
29
30
|
import '../../../../context/EmailVerificationContext/EmailVerificationContext.js';
|
|
30
31
|
import 'react-dom';
|
|
31
|
-
import '../../../../context/ThemeContext/ThemeContext.js';
|
|
32
|
+
import { useThemeContext } from '../../../../context/ThemeContext/ThemeContext.js';
|
|
32
33
|
import '@dynamic-labs/types';
|
|
33
34
|
import 'yup';
|
|
34
35
|
import '../../../../context/MockContext/MockContext.js';
|
|
@@ -72,18 +73,19 @@ const WalletSettingsView = () => {
|
|
|
72
73
|
const { authToken } = useInternalDynamicContext();
|
|
73
74
|
const { initExportProcess } = useEmbeddedReveal();
|
|
74
75
|
const { isTurnkeyWallet, isTurnkeyWalletWithoutAuthenticator } = useIsTurnkeyWallet();
|
|
76
|
+
const { theme } = useThemeContext();
|
|
75
77
|
const { t } = useTranslation();
|
|
76
78
|
const decodedJwt = decodeJwt(authToken);
|
|
77
79
|
const walletProperties = (_b = (_a = decodedJwt === null || decodedJwt === void 0 ? void 0 : decodedJwt.verifiedCredentials) === null || _a === void 0 ? void 0 : _a.find(({ walletName }) => walletName === null || walletName === void 0 ? void 0 : walletName.startsWith('turnkey'))) === null || _b === void 0 ? void 0 : _b.walletProperties;
|
|
78
80
|
const isTurnkeyHDWallet = walletProperties === null || walletProperties === void 0 ? void 0 : walletProperties.turnkeyHDWalletId;
|
|
79
81
|
const backButton = (jsx(IconButton, { type: 'button', onClick: goToInitialDynamicWidgetView, "data-testid": 'back-button', children: jsx(SvgChevronLeft, {}) }));
|
|
80
|
-
return (jsxs("div", { className: 'wallet-settings-view', children: [jsx(ModalHeader, { leading: backButton, children: jsx("div", { className: 'wallet-settings-view__header', children: jsx(Typography, { variant: 'title', color: 'primary', children: t('dyn_wallet_settings.title') }) }) }), jsxs("div", { className: 'wallet-settings-view__body', children: [jsxs("div", { className: 'wallet-settings-view__body__section', children: [jsx("div", { className: 'wallet-settings-view__body__section__title', children: t('dyn_wallet_settings.signing_section.title') }), jsx(Button, { dataTestId: 'manage-passkeys-button', onClick: () => setDynamicWidgetView('manage-passkeys'), buttonClassName: 'wallet-settings-view__body__section__button', startSlot:
|
|
82
|
+
return (jsxs("div", { className: 'wallet-settings-view', children: [jsx(ModalHeader, { leading: backButton, children: jsx("div", { className: 'wallet-settings-view__header', children: jsx(Typography, { variant: 'title', color: 'primary', copykey: 'dyn_wallet_settings.title', children: t('dyn_wallet_settings.title') }) }) }), jsxs("div", { className: 'wallet-settings-view__body', children: [jsxs("div", { className: 'wallet-settings-view__body__section', children: [jsx("div", { className: 'wallet-settings-view__body__section__title', children: t('dyn_wallet_settings.signing_section.title') }), jsx(Button, { dataTestId: 'manage-passkeys-button', onClick: () => setDynamicWidgetView('manage-passkeys'), buttonClassName: 'wallet-settings-view__body__section__button', startSlot:
|
|
81
83
|
// eslint-disable-next-line react/jsx-wrap-multilines
|
|
82
|
-
jsxs("div", { className: 'wallet-settings-view__body__section__button__start-slot', children: [jsx(SvgFaceId, { className: 'wallet-settings-view__body__section__button__icon' }), jsx(Typography, { weight: 'medium', children: t('dyn_wallet_settings.signing_section.passkey_button') })] }), endSlot: isTurnkeyWallet && !isTurnkeyWalletWithoutAuthenticator ? (jsx(SvgCheckCircle, { className: 'wallet-settings-view__body__section__button__icon-secondary--success' })) : undefined, showInternalLoading: false })] }), jsxs("div", { className: 'wallet-settings-view__body__section', children: [jsx("div", { className: 'wallet-settings-view__body__section__title', children: t('dyn_wallet_settings.export_section.title') }), jsx(Button, { dataTestId: 'embedded-reveal-button', onClick: initExportProcess, buttonClassName: 'wallet-settings-view__body__section__button', disabled: !isTurnkeyWallet || isTurnkeyWalletWithoutAuthenticator, startSlot:
|
|
84
|
+
jsxs("div", { className: 'wallet-settings-view__body__section__button__start-slot', children: [jsx(SvgFaceId, { className: 'wallet-settings-view__body__section__button__icon' }), jsx(Typography, { color: 'primary', weight: 'medium', copykey: 'dyn_wallet_settings.signing_section.passkey_button', children: t('dyn_wallet_settings.signing_section.passkey_button') })] }), endSlot: isTurnkeyWallet && !isTurnkeyWalletWithoutAuthenticator ? (jsx(SvgCheckCircle, { className: 'wallet-settings-view__body__section__button__icon-secondary--success' })) : undefined, showInternalLoading: false })] }), jsxs("div", { className: 'wallet-settings-view__body__section', children: [jsx("div", { className: 'wallet-settings-view__body__section__title', children: t('dyn_wallet_settings.export_section.title') }), jsx(Button, { dataTestId: 'embedded-reveal-account-button', onClick: () => initExportProcess(), buttonClassName: 'wallet-settings-view__body__section__button', disabled: !isTurnkeyWallet || isTurnkeyWalletWithoutAuthenticator, startSlot:
|
|
83
85
|
// eslint-disable-next-line react/jsx-wrap-multilines
|
|
84
|
-
jsxs("div", { className: 'wallet-settings-view__body__section__button__start-slot', children: [jsx(
|
|
85
|
-
|
|
86
|
-
|
|
86
|
+
jsxs("div", { className: 'wallet-settings-view__body__section__button__start-slot', children: [jsx(SvgAltKey, { className: `wallet-settings-view__body__section__button__icon${theme.theme.name === 'dark' ? '__stroke' : ''}` }), jsx(Typography, { color: 'primary', weight: 'medium', copykey: 'dyn_wallet_settings.export_section.private_key_button', children: t('dyn_wallet_settings.export_section.private_key_button') })] }), endSlot: isTurnkeyWallet && !isTurnkeyWalletWithoutAuthenticator ? (jsx(SvgChevronLeft, { className: 'wallet-settings-view__body__section__button__icon-secondary--rotate' })) : (jsx(SvgLock, { className: 'wallet-settings-view__body__section__button__icon-secondary' })), showInternalLoading: false }), isTurnkeyHDWallet && (jsx(Button, { dataTestId: 'embedded-reveal-button', onClick: () => initExportProcess(true), buttonClassName: 'wallet-settings-view__body__section__button', disabled: !isTurnkeyWallet || isTurnkeyWalletWithoutAuthenticator, startSlot:
|
|
87
|
+
// eslint-disable-next-line react/jsx-wrap-multilines
|
|
88
|
+
jsxs("div", { className: 'wallet-settings-view__body__section__button__start-slot', children: [jsx(SvgAltEmbeddedWallet, { className: `wallet-settings-view__body__section__button__icon${theme.theme.name === 'dark' ? '__stroke' : ''}` }), jsx(Typography, { color: 'primary', weight: 'medium', copykey: 'dyn_wallet_settings.export_section.srp_button', children: t('dyn_wallet_settings.export_section.srp_button') })] }), endSlot: !isTurnkeyWalletWithoutAuthenticator ? (jsx(SvgChevronLeft, { className: 'wallet-settings-view__body__section__button__icon-secondary--rotate' })) : (jsx(SvgLock, { className: 'wallet-settings-view__body__section__button__icon-secondary' })), showInternalLoading: false }))] })] })] }));
|
|
87
89
|
};
|
|
88
90
|
|
|
89
91
|
export { WalletSettingsView };
|
|
@@ -68,12 +68,12 @@ require('../../../../components/Popper/Popper/Popper.cjs');
|
|
|
68
68
|
require('../../../../components/Popper/PopperContext/PopperContext.cjs');
|
|
69
69
|
|
|
70
70
|
const WalletsView = () => {
|
|
71
|
-
const {
|
|
71
|
+
const { setShowLinkNewWalletModal, setSelectedWalletConnectorKey, user, authMode, multiWallet, } = useInternalDynamicContext.useInternalDynamicContext();
|
|
72
72
|
const isKYCEnabled = useKYCFlag.useKYCFlag();
|
|
73
73
|
const { setView } = ViewContext.useViewContext();
|
|
74
74
|
const addNewWallet = () => {
|
|
75
75
|
setView('multi-wallet-wallet-list');
|
|
76
|
-
|
|
76
|
+
setShowLinkNewWalletModal(true);
|
|
77
77
|
setSelectedWalletConnectorKey(null);
|
|
78
78
|
};
|
|
79
79
|
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [!multiWallet && !isKYCEnabled && (jsxRuntime.jsxs("div", { className: 'dynamic-widget-index-view__email-container', children: [jsxRuntime.jsx(Typography.Typography, { children: user === null || user === void 0 ? void 0 : user.email }), jsxRuntime.jsx(SingleWalletButtons.SingleWalletButtons, {})] })), multiWallet && (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(DynamicWidgetWallets.DynamicWidgetWallets, {}), jsxRuntime.jsx(DynamicWidgetFooter.DynamicWidgetFooter, { children: jsxRuntime.jsxs("div", { className: 'dynamic-widget-index-view__footer', children: [jsxRuntime.jsxs(Button.Button, { buttonClassName: 'dynamic-widget-footer__button', buttonVariant: 'tertiary', buttonPadding: 'none', onClick: addNewWallet, typographyProps: {
|
|
@@ -64,12 +64,12 @@ import '../../../../components/Popper/Popper/Popper.js';
|
|
|
64
64
|
import '../../../../components/Popper/PopperContext/PopperContext.js';
|
|
65
65
|
|
|
66
66
|
const WalletsView = () => {
|
|
67
|
-
const {
|
|
67
|
+
const { setShowLinkNewWalletModal, setSelectedWalletConnectorKey, user, authMode, multiWallet, } = useInternalDynamicContext();
|
|
68
68
|
const isKYCEnabled = useKYCFlag();
|
|
69
69
|
const { setView } = useViewContext();
|
|
70
70
|
const addNewWallet = () => {
|
|
71
71
|
setView('multi-wallet-wallet-list');
|
|
72
|
-
|
|
72
|
+
setShowLinkNewWalletModal(true);
|
|
73
73
|
setSelectedWalletConnectorKey(null);
|
|
74
74
|
};
|
|
75
75
|
return (jsxs(Fragment, { children: [!multiWallet && !isKYCEnabled && (jsxs("div", { className: 'dynamic-widget-index-view__email-container', children: [jsx(Typography, { children: user === null || user === void 0 ? void 0 : user.email }), jsx(SingleWalletButtons, {})] })), multiWallet && (jsxs(Fragment, { children: [jsx(DynamicWidgetWallets, {}), jsx(DynamicWidgetFooter, { children: jsxs("div", { className: 'dynamic-widget-index-view__footer', children: [jsxs(Button, { buttonClassName: 'dynamic-widget-footer__button', buttonVariant: 'tertiary', buttonPadding: 'none', onClick: addNewWallet, typographyProps: {
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './useSetShowAuthFlowWithInit';
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
|
-
var React = require('react');
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* this hook wraps `setShowAuthFlow`. WalletConnect requires initialization
|
|
9
|
-
* before we can connect a wallet. The goal here is that when a user clicks
|
|
10
|
-
* on the "Connect your wallet" button, the SDK starts initializing WalletConnect
|
|
11
|
-
* and will prime it for connection. This way, when the user clicks on the
|
|
12
|
-
* "Connect" button in the WalletConnect modal, there is a uri ready to go
|
|
13
|
-
* to immediately trigger the deep link on mobile
|
|
14
|
-
*/
|
|
15
|
-
const useSetShowAuthFlowWithInit = ({ setShowAuthFlow, walletConnectorOptions, user, isMultiWalletEnabled, isRenderingEmbeddedAuthFlow, }) => {
|
|
16
|
-
const setShowAuthFlowWithInit = React.useCallback((value) => {
|
|
17
|
-
var _a;
|
|
18
|
-
if (value) {
|
|
19
|
-
// Do not change state if:
|
|
20
|
-
// 1. The user is already signed in and multi-wallet is not enabled
|
|
21
|
-
// 2. An embedded auth flow is already being rendered
|
|
22
|
-
if ((user && !isMultiWalletEnabled) ||
|
|
23
|
-
isRenderingEmbeddedAuthFlow.current)
|
|
24
|
-
return;
|
|
25
|
-
(_a = walletConnectorOptions
|
|
26
|
-
.find((wallet) => wallet.walletConnector.key === 'walletconnect')) === null || _a === void 0 ? void 0 : _a.walletConnector.init();
|
|
27
|
-
}
|
|
28
|
-
setShowAuthFlow(value);
|
|
29
|
-
}, [setShowAuthFlow, walletConnectorOptions, user, isMultiWalletEnabled]);
|
|
30
|
-
return setShowAuthFlowWithInit;
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
exports.useSetShowAuthFlowWithInit = useSetShowAuthFlowWithInit;
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { useCallback } from 'react';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* this hook wraps `setShowAuthFlow`. WalletConnect requires initialization
|
|
5
|
-
* before we can connect a wallet. The goal here is that when a user clicks
|
|
6
|
-
* on the "Connect your wallet" button, the SDK starts initializing WalletConnect
|
|
7
|
-
* and will prime it for connection. This way, when the user clicks on the
|
|
8
|
-
* "Connect" button in the WalletConnect modal, there is a uri ready to go
|
|
9
|
-
* to immediately trigger the deep link on mobile
|
|
10
|
-
*/
|
|
11
|
-
const useSetShowAuthFlowWithInit = ({ setShowAuthFlow, walletConnectorOptions, user, isMultiWalletEnabled, isRenderingEmbeddedAuthFlow, }) => {
|
|
12
|
-
const setShowAuthFlowWithInit = useCallback((value) => {
|
|
13
|
-
var _a;
|
|
14
|
-
if (value) {
|
|
15
|
-
// Do not change state if:
|
|
16
|
-
// 1. The user is already signed in and multi-wallet is not enabled
|
|
17
|
-
// 2. An embedded auth flow is already being rendered
|
|
18
|
-
if ((user && !isMultiWalletEnabled) ||
|
|
19
|
-
isRenderingEmbeddedAuthFlow.current)
|
|
20
|
-
return;
|
|
21
|
-
(_a = walletConnectorOptions
|
|
22
|
-
.find((wallet) => wallet.walletConnector.key === 'walletconnect')) === null || _a === void 0 ? void 0 : _a.walletConnector.init();
|
|
23
|
-
}
|
|
24
|
-
setShowAuthFlow(value);
|
|
25
|
-
}, [setShowAuthFlow, walletConnectorOptions, user, isMultiWalletEnabled]);
|
|
26
|
-
return setShowAuthFlowWithInit;
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
export { useSetShowAuthFlowWithInit };
|