@dynamic-labs/sdk-react-core 3.9.10 → 3.9.12
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 +15 -0
- package/package.cjs +1 -1
- package/package.js +1 -1
- package/package.json +11 -11
- package/src/lib/context/UserWalletsContext/UserWalletsContext.cjs +19 -14
- package/src/lib/context/UserWalletsContext/UserWalletsContext.js +20 -15
- package/src/lib/context/ViewContext/types/index.d.ts +1 -1
- package/src/lib/data/api/wallets/wallets.cjs +3 -0
- package/src/lib/data/api/wallets/wallets.js +4 -1
- package/src/lib/locale/en/translation.cjs +4 -0
- package/src/lib/locale/en/translation.d.ts +4 -0
- package/src/lib/locale/en/translation.js +4 -0
- package/src/lib/styles/index.shadow.cjs +1 -1
- package/src/lib/styles/index.shadow.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/useVerifyWallet/useVerifyWallet.cjs +5 -0
- package/src/lib/utils/hooks/useVerifyWallet/useVerifyWallet.js +6 -1
- package/src/lib/views/WalletAlreadyExistsView/WalletAlreadyExistsView.cjs +101 -0
- package/src/lib/views/WalletAlreadyExistsView/WalletAlreadyExistsView.d.ts +2 -0
- package/src/lib/views/WalletAlreadyExistsView/WalletAlreadyExistsView.js +97 -0
- package/src/lib/views/WalletAlreadyExistsView/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/DynamicWidgetWallets/DynamicWidgetWallets.cjs +1 -1
- package/src/lib/widgets/DynamicWidget/components/DynamicWidgetWallets/DynamicWidgetWallets.js +1 -1
- package/src/lib/widgets/DynamicWidget/components/Wallet/Wallet.cjs +10 -4
- package/src/lib/widgets/DynamicWidget/components/Wallet/Wallet.d.ts +3 -1
- package/src/lib/widgets/DynamicWidget/components/Wallet/Wallet.js +10 -4
|
@@ -136,6 +136,10 @@ const useDynamicLayoutData = ({ view, authMode, }) => {
|
|
|
136
136
|
copykey: 'dyn_chainalysis_blocked_wallet.title',
|
|
137
137
|
heading: t('dyn_chainalysis_blocked_wallet.title'),
|
|
138
138
|
},
|
|
139
|
+
'embedded-wallet-exists': {
|
|
140
|
+
copykey: 'dyn_wallet_link.already_exists.title',
|
|
141
|
+
heading: t('dyn_wallet_link.already_exists.title'),
|
|
142
|
+
},
|
|
139
143
|
'farcaster-connect-view': {
|
|
140
144
|
copykey: 'dyn_login.qr_code.title',
|
|
141
145
|
heading: t('dyn_login.qr_code.title'),
|
|
@@ -132,6 +132,10 @@ const useDynamicLayoutData = ({ view, authMode, }) => {
|
|
|
132
132
|
copykey: 'dyn_chainalysis_blocked_wallet.title',
|
|
133
133
|
heading: t('dyn_chainalysis_blocked_wallet.title'),
|
|
134
134
|
},
|
|
135
|
+
'embedded-wallet-exists': {
|
|
136
|
+
copykey: 'dyn_wallet_link.already_exists.title',
|
|
137
|
+
heading: t('dyn_wallet_link.already_exists.title'),
|
|
138
|
+
},
|
|
135
139
|
'farcaster-connect-view': {
|
|
136
140
|
copykey: 'dyn_login.qr_code.title',
|
|
137
141
|
heading: t('dyn_login.qr_code.title'),
|
|
@@ -189,6 +189,11 @@ const useVerifyWallet = ({ consumeNonce, displaySiweStatement, environmentId, pr
|
|
|
189
189
|
option: walletConnector.name,
|
|
190
190
|
type: 'wallet',
|
|
191
191
|
}, { error: e });
|
|
192
|
+
if (e instanceof utils.EmbeddedWalletExistsError) {
|
|
193
|
+
setView('embedded-wallet-exists');
|
|
194
|
+
setShowAuthFlow(true);
|
|
195
|
+
return;
|
|
196
|
+
}
|
|
192
197
|
if (e instanceof utils.WalletUsedError) {
|
|
193
198
|
handleDisconnectWallet({ endSession: false, walletConnector });
|
|
194
199
|
return handleWalletUsedError(e);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use client'
|
|
2
2
|
import { __awaiter } from '../../../../../_virtual/_tslib.js';
|
|
3
|
-
import { DynamicError, StorageService, WalletUsedError, MergeAccountsConfirmationError, ChainalysisError, GateBlockedError, SandboxMaximumThresholdReachedError, NoAccessError, AccountExistsError } from '@dynamic-labs/utils';
|
|
3
|
+
import { DynamicError, StorageService, EmbeddedWalletExistsError, WalletUsedError, MergeAccountsConfirmationError, ChainalysisError, GateBlockedError, SandboxMaximumThresholdReachedError, NoAccessError, AccountExistsError } from '@dynamic-labs/utils';
|
|
4
4
|
import { isSocialWalletConnector } from '@dynamic-labs/wallet-connector-core';
|
|
5
5
|
import 'react';
|
|
6
6
|
import { dynamicEvents } from '../../../events/dynamicEvents.js';
|
|
@@ -185,6 +185,11 @@ const useVerifyWallet = ({ consumeNonce, displaySiweStatement, environmentId, pr
|
|
|
185
185
|
option: walletConnector.name,
|
|
186
186
|
type: 'wallet',
|
|
187
187
|
}, { error: e });
|
|
188
|
+
if (e instanceof EmbeddedWalletExistsError) {
|
|
189
|
+
setView('embedded-wallet-exists');
|
|
190
|
+
setShowAuthFlow(true);
|
|
191
|
+
return;
|
|
192
|
+
}
|
|
188
193
|
if (e instanceof WalletUsedError) {
|
|
189
194
|
handleDisconnectWallet({ endSession: false, walletConnector });
|
|
190
195
|
return handleWalletUsedError(e);
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
|
+
|
|
6
|
+
var _tslib = require('../../../../_virtual/_tslib.cjs');
|
|
7
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
8
|
+
var reactI18next = require('react-i18next');
|
|
9
|
+
var walletBook = require('@dynamic-labs/wallet-book');
|
|
10
|
+
require('../../components/Accordion/components/AccordionItem/AccordionItem.cjs');
|
|
11
|
+
require('../../components/Alert/Alert.cjs');
|
|
12
|
+
require('react');
|
|
13
|
+
require('../../events/dynamicEvents.cjs');
|
|
14
|
+
require('@dynamic-labs/utils');
|
|
15
|
+
require('../../context/DynamicContext/DynamicContext.cjs');
|
|
16
|
+
require('@dynamic-labs/sdk-api-core');
|
|
17
|
+
require('../../shared/logger.cjs');
|
|
18
|
+
require('@dynamic-labs/iconic');
|
|
19
|
+
require('@dynamic-labs/wallet-connector-core');
|
|
20
|
+
require('../../context/ViewContext/ViewContext.cjs');
|
|
21
|
+
var shortenWalletAddress = require('../../shared/utils/functions/shortenWalletAddress/shortenWalletAddress.cjs');
|
|
22
|
+
require('../../utils/constants/colors.cjs');
|
|
23
|
+
require('../../utils/constants/values.cjs');
|
|
24
|
+
require('../../store/state/loadingAndLifecycle.cjs');
|
|
25
|
+
require('../../shared/consts/index.cjs');
|
|
26
|
+
var useInternalDynamicContext = require('../../context/DynamicContext/useDynamicContext/useInternalDynamicContext.cjs');
|
|
27
|
+
require('../../context/CaptchaContext/CaptchaContext.cjs');
|
|
28
|
+
require('../../context/ErrorContext/ErrorContext.cjs');
|
|
29
|
+
require('@dynamic-labs/multi-wallet');
|
|
30
|
+
require('react-international-phone');
|
|
31
|
+
require('../../config/ApiEndpoint.cjs');
|
|
32
|
+
require('../../store/state/user/user.cjs');
|
|
33
|
+
require('../../locale/locale.cjs');
|
|
34
|
+
require('../../store/state/projectSettings/projectSettings.cjs');
|
|
35
|
+
require('../../context/AccessDeniedContext/AccessDeniedContext.cjs');
|
|
36
|
+
require('../../context/AccountExistsContext/AccountExistsContext.cjs');
|
|
37
|
+
require('../../context/UserWalletsContext/UserWalletsContext.cjs');
|
|
38
|
+
require('../../context/VerificationContext/VerificationContext.cjs');
|
|
39
|
+
require('react-dom');
|
|
40
|
+
var usePromise = require('../../utils/hooks/usePromise/usePromise.cjs');
|
|
41
|
+
require('../../context/ThemeContext/ThemeContext.cjs');
|
|
42
|
+
require('../../utils/hooks/useUserUpdateRequest/useUpdateUser/userFieldsSchema.cjs');
|
|
43
|
+
require('@dynamic-labs/types');
|
|
44
|
+
require('../../context/LoadingContext/LoadingContext.cjs');
|
|
45
|
+
require('../../context/WalletContext/WalletContext.cjs');
|
|
46
|
+
require('../../utils/hooks/useEmbeddedWallet/useSecureEnclaveEmbeddedWallet/constants.cjs');
|
|
47
|
+
require('yup');
|
|
48
|
+
require('../../context/MockContext/MockContext.cjs');
|
|
49
|
+
require('../CollectUserDataView/useFields.cjs');
|
|
50
|
+
require('../../context/FieldsStateContext/FieldsStateContext.cjs');
|
|
51
|
+
require('../../context/UserFieldEditorContext/UserFieldEditorContext.cjs');
|
|
52
|
+
require('@dynamic-labs/rpc-providers');
|
|
53
|
+
require('../../store/state/environmentId.cjs');
|
|
54
|
+
require('../../store/state/walletConnectorOptions.cjs');
|
|
55
|
+
var Typography = require('../../components/Typography/Typography.cjs');
|
|
56
|
+
require('../../context/FooterAnimationContext/index.cjs');
|
|
57
|
+
require('../../components/ShadowDOM/ShadowDOM.cjs');
|
|
58
|
+
require('../../components/Transition/ZoomTransition/ZoomTransition.cjs');
|
|
59
|
+
require('../../components/Transition/SlideInUpTransition/SlideInUpTransition.cjs');
|
|
60
|
+
require('../../components/Transition/OpacityTransition/OpacityTransition.cjs');
|
|
61
|
+
require('../../components/OverlayCard/OverlayCardTarget/OverlayCardTarget.cjs');
|
|
62
|
+
require('../../context/SocialRedirectContext/SocialRedirectContext.cjs');
|
|
63
|
+
require('../../context/WalletGroupContext/WalletGroupContext.cjs');
|
|
64
|
+
require('../../widgets/DynamicWidget/components/DynamicWidgetHeader/DynamicWidgetHeader.cjs');
|
|
65
|
+
require('react-focus-lock');
|
|
66
|
+
require('../../widgets/DynamicWidget/context/DynamicWidgetContext.cjs');
|
|
67
|
+
require('../../components/IconButton/IconButton.cjs');
|
|
68
|
+
require('../../components/MenuList/Dropdown/Dropdown.cjs');
|
|
69
|
+
require('formik');
|
|
70
|
+
require('../../store/state/sendBalances.cjs');
|
|
71
|
+
require('../../components/Input/Input.cjs');
|
|
72
|
+
require('../TransactionConfirmationView/TransactionConfirmationView.cjs');
|
|
73
|
+
require('../../context/PasskeyContext/PasskeyContext.cjs');
|
|
74
|
+
require('../../widgets/DynamicWidget/views/ManagePasskeysWidgetView/PasskeyCard/PasskeyCard.cjs');
|
|
75
|
+
require('../../../index.cjs');
|
|
76
|
+
require('../../store/state/tokenBalances.cjs');
|
|
77
|
+
require('../../shared/utils/functions/getInitialUrl/getInitialUrl.cjs');
|
|
78
|
+
require('../../components/InlineWidget/InlineWidget.cjs');
|
|
79
|
+
require('../../components/IsBrowser/IsBrowser.cjs');
|
|
80
|
+
require('../../components/PasskeyCreatedSuccessBanner/PasskeyCreatedSuccessBanner.cjs');
|
|
81
|
+
require('../../components/Popper/Popper/Popper.cjs');
|
|
82
|
+
require('../../components/Popper/PopperContext/PopperContext.cjs');
|
|
83
|
+
require('qrcode');
|
|
84
|
+
require('../../context/IpConfigurationContext/IpConfigurationContext.cjs');
|
|
85
|
+
require('../../widgets/DynamicBridgeWidget/views/WalletsView/components/SecondaryWallets/SecondaryWallets.cjs');
|
|
86
|
+
require('@hcaptcha/react-hcaptcha');
|
|
87
|
+
|
|
88
|
+
const WalletAlreadyExistsView = () => {
|
|
89
|
+
const { selectedWalletConnector: walletConnector } = useInternalDynamicContext.useInternalDynamicContext();
|
|
90
|
+
const { t } = reactI18next.useTranslation();
|
|
91
|
+
const { data: walletAddress } = usePromise.usePromise(() => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
92
|
+
const accounts = yield (walletConnector === null || walletConnector === void 0 ? void 0 : walletConnector.getConnectedAccounts());
|
|
93
|
+
return accounts === null || accounts === void 0 ? void 0 : accounts[0];
|
|
94
|
+
}), {
|
|
95
|
+
deps: [walletConnector],
|
|
96
|
+
});
|
|
97
|
+
const shortenedWalletAddress = shortenWalletAddress.shortenWalletAddress(walletAddress);
|
|
98
|
+
return (jsxRuntime.jsxs("div", { className: 'wallet-already-exists-view__container', children: [jsxRuntime.jsx("div", { className: 'wallet-already-exists-view__icon', children: jsxRuntime.jsx(walletBook.WalletIcon, { walletKey: walletConnector === null || walletConnector === void 0 ? void 0 : walletConnector.key, width: 64, height: 64 }) }), jsxRuntime.jsx(Typography.Typography, { className: 'wallet-already-exists-view__shorten-wallet-address', variant: 'body_normal', weight: 'medium', color: 'primary', children: shortenedWalletAddress }), jsxRuntime.jsx(Typography.Typography, { className: 'wallet-already-exists-view__copy', variant: 'body_normal', color: 'secondary', weight: 'regular', children: t('dyn_wallet_link.already_exists.description') })] }));
|
|
99
|
+
};
|
|
100
|
+
|
|
101
|
+
exports.WalletAlreadyExistsView = WalletAlreadyExistsView;
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
import { __awaiter } from '../../../../_virtual/_tslib.js';
|
|
3
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
4
|
+
import { useTranslation } from 'react-i18next';
|
|
5
|
+
import { WalletIcon } from '@dynamic-labs/wallet-book';
|
|
6
|
+
import '../../components/Accordion/components/AccordionItem/AccordionItem.js';
|
|
7
|
+
import '../../components/Alert/Alert.js';
|
|
8
|
+
import 'react';
|
|
9
|
+
import '../../events/dynamicEvents.js';
|
|
10
|
+
import '@dynamic-labs/utils';
|
|
11
|
+
import '../../context/DynamicContext/DynamicContext.js';
|
|
12
|
+
import '@dynamic-labs/sdk-api-core';
|
|
13
|
+
import '../../shared/logger.js';
|
|
14
|
+
import '@dynamic-labs/iconic';
|
|
15
|
+
import '@dynamic-labs/wallet-connector-core';
|
|
16
|
+
import '../../context/ViewContext/ViewContext.js';
|
|
17
|
+
import { shortenWalletAddress } from '../../shared/utils/functions/shortenWalletAddress/shortenWalletAddress.js';
|
|
18
|
+
import '../../utils/constants/colors.js';
|
|
19
|
+
import '../../utils/constants/values.js';
|
|
20
|
+
import '../../store/state/loadingAndLifecycle.js';
|
|
21
|
+
import '../../shared/consts/index.js';
|
|
22
|
+
import { useInternalDynamicContext } from '../../context/DynamicContext/useDynamicContext/useInternalDynamicContext.js';
|
|
23
|
+
import '../../context/CaptchaContext/CaptchaContext.js';
|
|
24
|
+
import '../../context/ErrorContext/ErrorContext.js';
|
|
25
|
+
import '@dynamic-labs/multi-wallet';
|
|
26
|
+
import 'react-international-phone';
|
|
27
|
+
import '../../config/ApiEndpoint.js';
|
|
28
|
+
import '../../store/state/user/user.js';
|
|
29
|
+
import '../../locale/locale.js';
|
|
30
|
+
import '../../store/state/projectSettings/projectSettings.js';
|
|
31
|
+
import '../../context/AccessDeniedContext/AccessDeniedContext.js';
|
|
32
|
+
import '../../context/AccountExistsContext/AccountExistsContext.js';
|
|
33
|
+
import '../../context/UserWalletsContext/UserWalletsContext.js';
|
|
34
|
+
import '../../context/VerificationContext/VerificationContext.js';
|
|
35
|
+
import 'react-dom';
|
|
36
|
+
import { usePromise } from '../../utils/hooks/usePromise/usePromise.js';
|
|
37
|
+
import '../../context/ThemeContext/ThemeContext.js';
|
|
38
|
+
import '../../utils/hooks/useUserUpdateRequest/useUpdateUser/userFieldsSchema.js';
|
|
39
|
+
import '@dynamic-labs/types';
|
|
40
|
+
import '../../context/LoadingContext/LoadingContext.js';
|
|
41
|
+
import '../../context/WalletContext/WalletContext.js';
|
|
42
|
+
import '../../utils/hooks/useEmbeddedWallet/useSecureEnclaveEmbeddedWallet/constants.js';
|
|
43
|
+
import 'yup';
|
|
44
|
+
import '../../context/MockContext/MockContext.js';
|
|
45
|
+
import '../CollectUserDataView/useFields.js';
|
|
46
|
+
import '../../context/FieldsStateContext/FieldsStateContext.js';
|
|
47
|
+
import '../../context/UserFieldEditorContext/UserFieldEditorContext.js';
|
|
48
|
+
import '@dynamic-labs/rpc-providers';
|
|
49
|
+
import '../../store/state/environmentId.js';
|
|
50
|
+
import '../../store/state/walletConnectorOptions.js';
|
|
51
|
+
import { Typography } from '../../components/Typography/Typography.js';
|
|
52
|
+
import '../../context/FooterAnimationContext/index.js';
|
|
53
|
+
import '../../components/ShadowDOM/ShadowDOM.js';
|
|
54
|
+
import '../../components/Transition/ZoomTransition/ZoomTransition.js';
|
|
55
|
+
import '../../components/Transition/SlideInUpTransition/SlideInUpTransition.js';
|
|
56
|
+
import '../../components/Transition/OpacityTransition/OpacityTransition.js';
|
|
57
|
+
import '../../components/OverlayCard/OverlayCardTarget/OverlayCardTarget.js';
|
|
58
|
+
import '../../context/SocialRedirectContext/SocialRedirectContext.js';
|
|
59
|
+
import '../../context/WalletGroupContext/WalletGroupContext.js';
|
|
60
|
+
import '../../widgets/DynamicWidget/components/DynamicWidgetHeader/DynamicWidgetHeader.js';
|
|
61
|
+
import 'react-focus-lock';
|
|
62
|
+
import '../../widgets/DynamicWidget/context/DynamicWidgetContext.js';
|
|
63
|
+
import '../../components/IconButton/IconButton.js';
|
|
64
|
+
import '../../components/MenuList/Dropdown/Dropdown.js';
|
|
65
|
+
import 'formik';
|
|
66
|
+
import '../../store/state/sendBalances.js';
|
|
67
|
+
import '../../components/Input/Input.js';
|
|
68
|
+
import '../TransactionConfirmationView/TransactionConfirmationView.js';
|
|
69
|
+
import '../../context/PasskeyContext/PasskeyContext.js';
|
|
70
|
+
import '../../widgets/DynamicWidget/views/ManagePasskeysWidgetView/PasskeyCard/PasskeyCard.js';
|
|
71
|
+
import '../../../index.js';
|
|
72
|
+
import '../../store/state/tokenBalances.js';
|
|
73
|
+
import '../../shared/utils/functions/getInitialUrl/getInitialUrl.js';
|
|
74
|
+
import '../../components/InlineWidget/InlineWidget.js';
|
|
75
|
+
import '../../components/IsBrowser/IsBrowser.js';
|
|
76
|
+
import '../../components/PasskeyCreatedSuccessBanner/PasskeyCreatedSuccessBanner.js';
|
|
77
|
+
import '../../components/Popper/Popper/Popper.js';
|
|
78
|
+
import '../../components/Popper/PopperContext/PopperContext.js';
|
|
79
|
+
import 'qrcode';
|
|
80
|
+
import '../../context/IpConfigurationContext/IpConfigurationContext.js';
|
|
81
|
+
import '../../widgets/DynamicBridgeWidget/views/WalletsView/components/SecondaryWallets/SecondaryWallets.js';
|
|
82
|
+
import '@hcaptcha/react-hcaptcha';
|
|
83
|
+
|
|
84
|
+
const WalletAlreadyExistsView = () => {
|
|
85
|
+
const { selectedWalletConnector: walletConnector } = useInternalDynamicContext();
|
|
86
|
+
const { t } = useTranslation();
|
|
87
|
+
const { data: walletAddress } = usePromise(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
88
|
+
const accounts = yield (walletConnector === null || walletConnector === void 0 ? void 0 : walletConnector.getConnectedAccounts());
|
|
89
|
+
return accounts === null || accounts === void 0 ? void 0 : accounts[0];
|
|
90
|
+
}), {
|
|
91
|
+
deps: [walletConnector],
|
|
92
|
+
});
|
|
93
|
+
const shortenedWalletAddress = shortenWalletAddress(walletAddress);
|
|
94
|
+
return (jsxs("div", { className: 'wallet-already-exists-view__container', children: [jsx("div", { className: 'wallet-already-exists-view__icon', children: jsx(WalletIcon, { walletKey: walletConnector === null || walletConnector === void 0 ? void 0 : walletConnector.key, width: 64, height: 64 }) }), jsx(Typography, { className: 'wallet-already-exists-view__shorten-wallet-address', variant: 'body_normal', weight: 'medium', color: 'primary', children: shortenedWalletAddress }), jsx(Typography, { className: 'wallet-already-exists-view__copy', variant: 'body_normal', color: 'secondary', weight: 'regular', children: t('dyn_wallet_link.already_exists.description') })] }));
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
export { WalletAlreadyExistsView };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './WalletAlreadyExistsView';
|
|
@@ -133,6 +133,7 @@ var WalletLockedView = require('./WalletLockedView/WalletLockedView.cjs');
|
|
|
133
133
|
var WalletRedirectView = require('./WalletRedirectView/WalletRedirectView.cjs');
|
|
134
134
|
var WalletSignSpinnerView = require('./WalletSignSpinnerView/WalletSignSpinnerView.cjs');
|
|
135
135
|
var WalletUsedView = require('./WalletUsedView/WalletUsedView.cjs');
|
|
136
|
+
var WalletAlreadyExistsView = require('./WalletAlreadyExistsView/WalletAlreadyExistsView.cjs');
|
|
136
137
|
var PasskeyNewDomainDetectedView = require('./Passkey/PasskeyNewDomainDetectedView/PasskeyNewDomainDetectedView.cjs');
|
|
137
138
|
|
|
138
139
|
const viewToComponentMap = {
|
|
@@ -150,6 +151,7 @@ const viewToComponentMap = {
|
|
|
150
151
|
'embedded-reveal-account-view': EmbeddedRevealView.EmbeddedRevealView,
|
|
151
152
|
'embedded-reveal-view': EmbeddedRevealView.EmbeddedRevealView,
|
|
152
153
|
'embedded-wallet-auth-choice': EmbeddedAuthChoice.EmbeddedAuthChoice,
|
|
154
|
+
'embedded-wallet-exists': WalletAlreadyExistsView.WalletAlreadyExistsView,
|
|
153
155
|
'farcaster-connect-view': FarcasterConnectView.FarcasterConnectView,
|
|
154
156
|
'gate-blocked-wallet': NoAccess.NoAccess,
|
|
155
157
|
'global-wallet-confirm': GlobalWalletConfirmView.GlobalWalletConfirmView,
|
|
@@ -17,6 +17,7 @@ export declare const viewToComponentMap: {
|
|
|
17
17
|
'embedded-reveal-account-view': import("react").FC<import("./EmbeddedReveal/EmbeddedRevealView/EmbeddedRevealView").EmbeddedRevealViewProps>;
|
|
18
18
|
'embedded-reveal-view': import("react").FC<import("./EmbeddedReveal/EmbeddedRevealView/EmbeddedRevealView").EmbeddedRevealViewProps>;
|
|
19
19
|
'embedded-wallet-auth-choice': import("react").FC<import("./Passkey/EmbeddedAuthChoice/EmbeddedAuthChoice").EmbeddedAuthChoiceProps>;
|
|
20
|
+
'embedded-wallet-exists': () => JSX.Element;
|
|
20
21
|
'farcaster-connect-view': ({ url }: import("./FarcasterConnectView/FarcasterConnectView").FarcasterConnectViewProps) => JSX.Element;
|
|
21
22
|
'gate-blocked-wallet': () => JSX.Element;
|
|
22
23
|
'global-wallet-confirm': import("react").FC<import("./GlobalWalletConfirmView").GlobalWalletConfirmViewProps>;
|
|
@@ -129,6 +129,7 @@ import { WalletLockedView } from './WalletLockedView/WalletLockedView.js';
|
|
|
129
129
|
import { WalletRedirectView } from './WalletRedirectView/WalletRedirectView.js';
|
|
130
130
|
import { WalletSignSpinnerView } from './WalletSignSpinnerView/WalletSignSpinnerView.js';
|
|
131
131
|
import { WalletUsedView } from './WalletUsedView/WalletUsedView.js';
|
|
132
|
+
import { WalletAlreadyExistsView } from './WalletAlreadyExistsView/WalletAlreadyExistsView.js';
|
|
132
133
|
import { PasskeyNewDomainDetectedView } from './Passkey/PasskeyNewDomainDetectedView/PasskeyNewDomainDetectedView.js';
|
|
133
134
|
|
|
134
135
|
const viewToComponentMap = {
|
|
@@ -146,6 +147,7 @@ const viewToComponentMap = {
|
|
|
146
147
|
'embedded-reveal-account-view': EmbeddedRevealView,
|
|
147
148
|
'embedded-reveal-view': EmbeddedRevealView,
|
|
148
149
|
'embedded-wallet-auth-choice': EmbeddedAuthChoice,
|
|
150
|
+
'embedded-wallet-exists': WalletAlreadyExistsView,
|
|
149
151
|
'farcaster-connect-view': FarcasterConnectView,
|
|
150
152
|
'gate-blocked-wallet': NoAccess,
|
|
151
153
|
'global-wallet-confirm': GlobalWalletConfirmView,
|
package/src/lib/widgets/DynamicWidget/components/DynamicWidgetWallets/DynamicWidgetWallets.cjs
CHANGED
|
@@ -111,7 +111,7 @@ const DynamicWidgetWallets = () => {
|
|
|
111
111
|
: t('dyn_widget.empty_wallets_action_connect'),
|
|
112
112
|
}) })) : (jsxRuntime.jsx("div", { className: 'dynamic-widget-wallets__body__wallet-list', children: secondaryWallets.map((wallet, index) => {
|
|
113
113
|
var _a;
|
|
114
|
-
return (jsxRuntime.jsx(Wallet.Wallet, { ens: (_a = getWalletVerifiedCredential.getWalletVerifiedCredential(wallet.address, user === null || user === void 0 ? void 0 : user.verifiedCredentials, wallet.chain)) === null || _a === void 0 ? void 0 : _a.nameService, wallet: wallet }, wallet.id));
|
|
114
|
+
return (jsxRuntime.jsx(Wallet.Wallet, { ens: (_a = getWalletVerifiedCredential.getWalletVerifiedCredential(wallet.address, user === null || user === void 0 ? void 0 : user.verifiedCredentials, wallet.chain)) === null || _a === void 0 ? void 0 : _a.nameService, wallet: wallet, clickable: true }, wallet.id));
|
|
115
115
|
}) })) }) })] }));
|
|
116
116
|
};
|
|
117
117
|
|
package/src/lib/widgets/DynamicWidget/components/DynamicWidgetWallets/DynamicWidgetWallets.js
CHANGED
|
@@ -107,7 +107,7 @@ const DynamicWidgetWallets = () => {
|
|
|
107
107
|
: t('dyn_widget.empty_wallets_action_connect'),
|
|
108
108
|
}) })) : (jsx("div", { className: 'dynamic-widget-wallets__body__wallet-list', children: secondaryWallets.map((wallet, index) => {
|
|
109
109
|
var _a;
|
|
110
|
-
return (jsx(Wallet, { ens: (_a = getWalletVerifiedCredential(wallet.address, user === null || user === void 0 ? void 0 : user.verifiedCredentials, wallet.chain)) === null || _a === void 0 ? void 0 : _a.nameService, wallet: wallet }, wallet.id));
|
|
110
|
+
return (jsx(Wallet, { ens: (_a = getWalletVerifiedCredential(wallet.address, user === null || user === void 0 ? void 0 : user.verifiedCredentials, wallet.chain)) === null || _a === void 0 ? void 0 : _a.nameService, wallet: wallet, clickable: true }, wallet.id));
|
|
111
111
|
}) })) }) })] }));
|
|
112
112
|
};
|
|
113
113
|
|
|
@@ -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
|
var walletConnectorCore = require('@dynamic-labs/wallet-connector-core');
|
|
8
9
|
require('@dynamic-labs/iconic');
|
|
9
10
|
require('../../../../context/ViewContext/ViewContext.cjs');
|
|
10
|
-
require('react');
|
|
11
11
|
var copy = require('../../../../shared/assets/copy.cjs');
|
|
12
12
|
var key = require('../../../../shared/assets/key.cjs');
|
|
13
13
|
var switchHorizontal = require('../../../../shared/assets/switch-horizontal.cjs');
|
|
@@ -52,6 +52,7 @@ require('@dynamic-labs/rpc-providers');
|
|
|
52
52
|
require('../../../../store/state/environmentId.cjs');
|
|
53
53
|
require('../../../../store/state/walletConnectorOptions.cjs');
|
|
54
54
|
require('react-i18next');
|
|
55
|
+
var classNames = require('../../../../utils/functions/classNames/classNames.cjs');
|
|
55
56
|
require('../../../../components/Accordion/components/AccordionItem/AccordionItem.cjs');
|
|
56
57
|
require('../../../../components/Alert/Alert.cjs');
|
|
57
58
|
var Typography = require('../../../../components/Typography/Typography.cjs');
|
|
@@ -92,16 +93,19 @@ require('../../../../store/state/tokenBalances.cjs');
|
|
|
92
93
|
require('../../../../shared/utils/functions/getInitialUrl/getInitialUrl.cjs');
|
|
93
94
|
var useInternalDynamicContext = require('../../../../context/DynamicContext/useDynamicContext/useInternalDynamicContext.cjs');
|
|
94
95
|
|
|
95
|
-
const Wallet = ({ wallet, ens }) => {
|
|
96
|
+
const Wallet = ({ wallet, ens, clickable }) => {
|
|
96
97
|
var _a, _b;
|
|
97
98
|
const { connector, address } = wallet;
|
|
98
99
|
const switchWallet = useSwitchWallet.useSwitchWallet();
|
|
99
100
|
const { setSelectedWalletWithAction, projectSettings, authMode } = useInternalDynamicContext.useInternalDynamicContext();
|
|
101
|
+
const handleSwitchWallet = React.useCallback(() => {
|
|
102
|
+
switchWallet(wallet.id);
|
|
103
|
+
}, [switchWallet, wallet.id]);
|
|
100
104
|
const iconSize = 20;
|
|
101
105
|
const options = [
|
|
102
106
|
{
|
|
103
107
|
Icon: jsxRuntime.jsx(switchHorizontal.ReactComponent, {}),
|
|
104
|
-
callback:
|
|
108
|
+
callback: handleSwitchWallet,
|
|
105
109
|
hide: ((_a = wallet.connector) === null || _a === void 0 ? void 0 : _a.key) === 'unknown' || !((_b = wallet.connector) === null || _b === void 0 ? void 0 : _b.isAvailable),
|
|
106
110
|
text: 'Select wallet',
|
|
107
111
|
},
|
|
@@ -134,7 +138,9 @@ const Wallet = ({ wallet, ens }) => {
|
|
|
134
138
|
text: 'Export private keys',
|
|
135
139
|
});
|
|
136
140
|
}
|
|
137
|
-
return (jsxRuntime.jsxs("div", { className: 'wallet__container', "data-testid": 'wallet', children: [jsxRuntime.jsxs("div", { className:
|
|
141
|
+
return (jsxRuntime.jsxs("div", { className: 'wallet__container', "data-testid": 'wallet', children: [jsxRuntime.jsxs("div", { className: classNames.classNames('wallet__row', {
|
|
142
|
+
'wallet__row--clickable': clickable,
|
|
143
|
+
}), onClick: clickable ? handleSwitchWallet : undefined, children: [jsxRuntime.jsx("div", { className: 'wallet__icon-container', children: jsxRuntime.jsx(AuthProviderIcon.AuthProviderIcon, { iconSize: iconSize, wallet: wallet, showNetworkIcon: true }) }), (ens === null || ens === void 0 ? void 0 : ens.name) ? (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(Typography.Typography, { className: 'wallet__ens-name', variant: 'body_small', color: 'primary', truncate: true, children: ens === null || ens === void 0 ? void 0 : ens.name }), jsxRuntime.jsx("div", { className: 'wallet__row__separator' }), jsxRuntime.jsx(Typography.Typography, { variant: 'body_mini', color: 'secondary', children: shortenWalletAddress.shortenWalletAddress(address, 3, 3) })] })) : (jsxRuntime.jsx(Typography.Typography, { variant: 'body_small', color: 'primary', children: shortenWalletAddress.shortenWalletAddress(address, 4, 4) }))] }), jsxRuntime.jsx("div", { className: 'wallet__row__separator wallet__row__menu__separator ' }), jsxRuntime.jsx(DotsMenu.DotsMenu, { "data-testid": 'dots-menu', options: options, buttonClassName: 'wallet__menu', direction: 'left' })] }));
|
|
138
144
|
};
|
|
139
145
|
|
|
140
146
|
exports.Wallet = Wallet;
|
|
@@ -2,11 +2,13 @@
|
|
|
2
2
|
import { NameServiceData } from '@dynamic-labs/sdk-api-core';
|
|
3
3
|
import { Wallet as WalletType } from '../../../../shared/types';
|
|
4
4
|
type Props = {
|
|
5
|
+
/** If true, clicking the wallet will set it as the primary wallet */
|
|
6
|
+
clickable?: boolean;
|
|
5
7
|
ens?: NameServiceData;
|
|
6
8
|
expanded?: boolean;
|
|
7
9
|
expandedWallet?: string;
|
|
8
10
|
setExpandedWallet?: (str?: string) => void;
|
|
9
11
|
wallet: WalletType;
|
|
10
12
|
};
|
|
11
|
-
export declare const Wallet: ({ wallet, ens }: Props) => JSX.Element;
|
|
13
|
+
export declare const Wallet: ({ wallet, ens, clickable }: Props) => JSX.Element;
|
|
12
14
|
export {};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
'use client'
|
|
2
2
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
3
|
+
import { useCallback } from 'react';
|
|
3
4
|
import { isEmbeddedConnector } from '@dynamic-labs/wallet-connector-core';
|
|
4
5
|
import '@dynamic-labs/iconic';
|
|
5
6
|
import '../../../../context/ViewContext/ViewContext.js';
|
|
6
|
-
import 'react';
|
|
7
7
|
import { ReactComponent as SvgCopy } from '../../../../shared/assets/copy.js';
|
|
8
8
|
import { ReactComponent as SvgKey } from '../../../../shared/assets/key.js';
|
|
9
9
|
import { ReactComponent as SvgSwitchHorizontal } from '../../../../shared/assets/switch-horizontal.js';
|
|
@@ -48,6 +48,7 @@ import '@dynamic-labs/rpc-providers';
|
|
|
48
48
|
import '../../../../store/state/environmentId.js';
|
|
49
49
|
import '../../../../store/state/walletConnectorOptions.js';
|
|
50
50
|
import 'react-i18next';
|
|
51
|
+
import { classNames } from '../../../../utils/functions/classNames/classNames.js';
|
|
51
52
|
import '../../../../components/Accordion/components/AccordionItem/AccordionItem.js';
|
|
52
53
|
import '../../../../components/Alert/Alert.js';
|
|
53
54
|
import { Typography } from '../../../../components/Typography/Typography.js';
|
|
@@ -88,16 +89,19 @@ import '../../../../store/state/tokenBalances.js';
|
|
|
88
89
|
import '../../../../shared/utils/functions/getInitialUrl/getInitialUrl.js';
|
|
89
90
|
import { useInternalDynamicContext } from '../../../../context/DynamicContext/useDynamicContext/useInternalDynamicContext.js';
|
|
90
91
|
|
|
91
|
-
const Wallet = ({ wallet, ens }) => {
|
|
92
|
+
const Wallet = ({ wallet, ens, clickable }) => {
|
|
92
93
|
var _a, _b;
|
|
93
94
|
const { connector, address } = wallet;
|
|
94
95
|
const switchWallet = useSwitchWallet();
|
|
95
96
|
const { setSelectedWalletWithAction, projectSettings, authMode } = useInternalDynamicContext();
|
|
97
|
+
const handleSwitchWallet = useCallback(() => {
|
|
98
|
+
switchWallet(wallet.id);
|
|
99
|
+
}, [switchWallet, wallet.id]);
|
|
96
100
|
const iconSize = 20;
|
|
97
101
|
const options = [
|
|
98
102
|
{
|
|
99
103
|
Icon: jsx(SvgSwitchHorizontal, {}),
|
|
100
|
-
callback:
|
|
104
|
+
callback: handleSwitchWallet,
|
|
101
105
|
hide: ((_a = wallet.connector) === null || _a === void 0 ? void 0 : _a.key) === 'unknown' || !((_b = wallet.connector) === null || _b === void 0 ? void 0 : _b.isAvailable),
|
|
102
106
|
text: 'Select wallet',
|
|
103
107
|
},
|
|
@@ -130,7 +134,9 @@ const Wallet = ({ wallet, ens }) => {
|
|
|
130
134
|
text: 'Export private keys',
|
|
131
135
|
});
|
|
132
136
|
}
|
|
133
|
-
return (jsxs("div", { className: 'wallet__container', "data-testid": 'wallet', children: [jsxs("div", { className: 'wallet__row',
|
|
137
|
+
return (jsxs("div", { className: 'wallet__container', "data-testid": 'wallet', children: [jsxs("div", { className: classNames('wallet__row', {
|
|
138
|
+
'wallet__row--clickable': clickable,
|
|
139
|
+
}), onClick: clickable ? handleSwitchWallet : undefined, children: [jsx("div", { className: 'wallet__icon-container', children: jsx(AuthProviderIcon, { iconSize: iconSize, wallet: wallet, showNetworkIcon: true }) }), (ens === null || ens === void 0 ? void 0 : ens.name) ? (jsxs(Fragment, { children: [jsx(Typography, { className: 'wallet__ens-name', variant: 'body_small', color: 'primary', truncate: true, children: ens === null || ens === void 0 ? void 0 : ens.name }), jsx("div", { className: 'wallet__row__separator' }), jsx(Typography, { variant: 'body_mini', color: 'secondary', children: shortenWalletAddress(address, 3, 3) })] })) : (jsx(Typography, { variant: 'body_small', color: 'primary', children: shortenWalletAddress(address, 4, 4) }))] }), jsx("div", { className: 'wallet__row__separator wallet__row__menu__separator ' }), jsx(DotsMenu, { "data-testid": 'dots-menu', options: options, buttonClassName: 'wallet__menu', direction: 'left' })] }));
|
|
134
140
|
};
|
|
135
141
|
|
|
136
142
|
export { Wallet };
|