@dynamic-labs/sdk-react-core 4.12.0 → 4.12.2-preview.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +19 -0
- package/package.cjs +1 -1
- package/package.js +1 -1
- package/package.json +11 -11
- package/src/lib/components/SignMessagePreview/SignMessagePreview.cjs +5 -1
- package/src/lib/components/SignMessagePreview/SignMessagePreview.js +5 -1
- package/src/lib/styles/index.shadow.cjs +1 -1
- package/src/lib/styles/index.shadow.js +1 -1
- package/src/lib/utils/functions/usingV3Wallets/usingV3Wallets.cjs +14 -0
- package/src/lib/utils/functions/usingV3Wallets/usingV3Wallets.d.ts +2 -0
- package/src/lib/utils/functions/usingV3Wallets/usingV3Wallets.js +10 -0
- package/src/lib/utils/hooks/useIsLoadingEmbeddedWallet/useIsLoadingEmbeddedWallet.cjs +110 -0
- package/src/lib/utils/hooks/useIsLoadingEmbeddedWallet/useIsLoadingEmbeddedWallet.d.ts +3 -0
- package/src/lib/utils/hooks/useIsLoadingEmbeddedWallet/useIsLoadingEmbeddedWallet.js +106 -0
- package/src/lib/views/EmailVerification/EmailVerification.cjs +8 -5
- package/src/lib/views/EmailVerification/EmailVerification.js +8 -5
- package/src/lib/widgets/DynamicBridgeWidget/DynamicBridgeWidget.cjs +35 -2
- package/src/lib/widgets/DynamicBridgeWidget/DynamicBridgeWidget.js +36 -3
- package/src/lib/widgets/DynamicBridgeWidget/components/DynamicBridgeWidgetEmptyCard/DynamicBridgeWidgetEmptyCard.cjs +1 -1
- package/src/lib/widgets/DynamicBridgeWidget/components/DynamicBridgeWidgetEmptyCard/DynamicBridgeWidgetEmptyCard.js +1 -1
- package/src/lib/widgets/DynamicBridgeWidget/views/WalletsView/components/SecondaryWallets/SecondaryWallets.cjs +3 -2
- package/src/lib/widgets/DynamicBridgeWidget/views/WalletsView/components/SecondaryWallets/SecondaryWallets.js +4 -3
- package/src/lib/widgets/DynamicWidget/components/ActiveWalletBalance/ActiveWalletBalance.cjs +3 -3
- package/src/lib/widgets/DynamicWidget/components/ActiveWalletBalance/ActiveWalletBalance.d.ts +5 -1
- package/src/lib/widgets/DynamicWidget/components/ActiveWalletBalance/ActiveWalletBalance.js +3 -3
- package/src/lib/widgets/DynamicWidget/components/ActiveWalletInformation/ActiveWalletInformation.cjs +1 -1
- package/src/lib/widgets/DynamicWidget/components/ActiveWalletInformation/ActiveWalletInformation.js +1 -1
- package/src/lib/widgets/DynamicWidget/components/DynamicWidgetHeader/DynamicWidgetWalletHeader/DynamicWidgetWalletHeader.cjs +5 -5
- package/src/lib/widgets/DynamicWidget/components/DynamicWidgetHeader/DynamicWidgetWalletHeader/DynamicWidgetWalletHeader.js +5 -5
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
|
+
|
|
6
|
+
var sdkApiCore = require('@dynamic-labs/sdk-api-core');
|
|
7
|
+
|
|
8
|
+
const usingV3Wallets = (projectSettings) => {
|
|
9
|
+
var _a, _b;
|
|
10
|
+
return Boolean(((_b = (_a = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.sdk) === null || _a === void 0 ? void 0 : _a.embeddedWallets) === null || _b === void 0 ? void 0 : _b.defaultWalletVersion) ===
|
|
11
|
+
sdkApiCore.EmbeddedWalletVersionEnum.V3);
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
exports.usingV3Wallets = usingV3Wallets;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
import { EmbeddedWalletVersionEnum } from '@dynamic-labs/sdk-api-core';
|
|
3
|
+
|
|
4
|
+
const usingV3Wallets = (projectSettings) => {
|
|
5
|
+
var _a, _b;
|
|
6
|
+
return Boolean(((_b = (_a = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.sdk) === null || _a === void 0 ? void 0 : _a.embeddedWallets) === null || _b === void 0 ? void 0 : _b.defaultWalletVersion) ===
|
|
7
|
+
EmbeddedWalletVersionEnum.V3);
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
export { usingV3Wallets };
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
|
+
|
|
6
|
+
var React = require('react');
|
|
7
|
+
var usingV3Wallets = require('../../functions/usingV3Wallets/usingV3Wallets.cjs');
|
|
8
|
+
require('../../../context/DynamicContext/DynamicContext.cjs');
|
|
9
|
+
require('../../../store/state/loadingAndLifecycle/loadingAndLifecycle.cjs');
|
|
10
|
+
require('@dynamic-labs/sdk-api-core');
|
|
11
|
+
require('../../../shared/logger.cjs');
|
|
12
|
+
require('@dynamic-labs/iconic');
|
|
13
|
+
require('@dynamic-labs/wallet-connector-core');
|
|
14
|
+
require('react/jsx-runtime');
|
|
15
|
+
require('../../../context/ViewContext/ViewContext.cjs');
|
|
16
|
+
require('@dynamic-labs/wallet-book');
|
|
17
|
+
require('@dynamic-labs/utils');
|
|
18
|
+
require('../../constants/colors.cjs');
|
|
19
|
+
require('../../constants/values.cjs');
|
|
20
|
+
require('../../../shared/consts/index.cjs');
|
|
21
|
+
require('../../../events/dynamicEvents.cjs');
|
|
22
|
+
require('../../../../../_virtual/_tslib.cjs');
|
|
23
|
+
require('../../../context/CaptchaContext/CaptchaContext.cjs');
|
|
24
|
+
require('../../../context/ErrorContext/ErrorContext.cjs');
|
|
25
|
+
require('@dynamic-labs/multi-wallet');
|
|
26
|
+
require('react-international-phone');
|
|
27
|
+
require('../../../store/state/nonce/nonce.cjs');
|
|
28
|
+
var projectSettings = require('../../../store/state/projectSettings/projectSettings.cjs');
|
|
29
|
+
require('../../../config/ApiEndpoint.cjs');
|
|
30
|
+
require('../../../store/state/user/user.cjs');
|
|
31
|
+
require('../../../locale/locale.cjs');
|
|
32
|
+
require('../../../store/state/dynamicContextProps/dynamicContextProps.cjs');
|
|
33
|
+
require('../../../store/state/primaryWalletId/primaryWalletId.cjs');
|
|
34
|
+
require('../../../context/AccessDeniedContext/AccessDeniedContext.cjs');
|
|
35
|
+
require('../../../context/AccountExistsContext/AccountExistsContext.cjs');
|
|
36
|
+
require('../../../context/UserWalletsContext/UserWalletsContext.cjs');
|
|
37
|
+
require('../../../store/state/connectedWalletsInfo/connectedWalletsInfo.cjs');
|
|
38
|
+
require('../../../context/VerificationContext/VerificationContext.cjs');
|
|
39
|
+
require('react-dom');
|
|
40
|
+
require('../../functions/compareChains/compareChains.cjs');
|
|
41
|
+
require('../../../context/ThemeContext/ThemeContext.cjs');
|
|
42
|
+
require('../useUserUpdateRequest/useUpdateUser/userFieldsSchema.cjs');
|
|
43
|
+
require('bs58');
|
|
44
|
+
require('@dynamic-labs/types');
|
|
45
|
+
require('../../../context/SocialRedirectContext/SocialRedirectContext.cjs');
|
|
46
|
+
require('../../../context/LoadingContext/LoadingContext.cjs');
|
|
47
|
+
require('../../../context/WalletContext/WalletContext.cjs');
|
|
48
|
+
require('../useEmbeddedWallet/useSecureEnclaveEmbeddedWallet/constants.cjs');
|
|
49
|
+
require('yup');
|
|
50
|
+
require('../../../context/MockContext/MockContext.cjs');
|
|
51
|
+
require('../../../views/CollectUserDataView/useFields.cjs');
|
|
52
|
+
require('../../../context/FieldsStateContext/FieldsStateContext.cjs');
|
|
53
|
+
require('../../../context/UserFieldEditorContext/UserFieldEditorContext.cjs');
|
|
54
|
+
require('@dynamic-labs/rpc-providers');
|
|
55
|
+
require('../../../store/state/walletOptions/walletOptions.cjs');
|
|
56
|
+
require('react-i18next');
|
|
57
|
+
require('../../../components/Accordion/components/AccordionItem/AccordionItem.cjs');
|
|
58
|
+
require('../../../components/Alert/Alert.cjs');
|
|
59
|
+
require('../../../components/ShadowDOM/ShadowDOM.cjs');
|
|
60
|
+
require('../../../components/IconButton/IconButton.cjs');
|
|
61
|
+
require('../../../components/InlineWidget/InlineWidget.cjs');
|
|
62
|
+
require('../../../components/Input/Input.cjs');
|
|
63
|
+
require('../../../components/IsBrowser/IsBrowser.cjs');
|
|
64
|
+
require('../../../components/MenuList/Dropdown/Dropdown.cjs');
|
|
65
|
+
require('../../../components/OverlayCard/OverlayCard.cjs');
|
|
66
|
+
require('../../../components/Transition/ZoomTransition/ZoomTransition.cjs');
|
|
67
|
+
require('../../../components/Transition/SlideInUpTransition/SlideInUpTransition.cjs');
|
|
68
|
+
require('../../../components/Transition/OpacityTransition/OpacityTransition.cjs');
|
|
69
|
+
require('../../../components/PasskeyCreatedSuccessBanner/PasskeyCreatedSuccessBanner.cjs');
|
|
70
|
+
require('../../../components/Popper/Popper/Popper.cjs');
|
|
71
|
+
require('../../../components/Popper/PopperContext/PopperContext.cjs');
|
|
72
|
+
require('react-focus-lock');
|
|
73
|
+
require('qrcode');
|
|
74
|
+
require('formik');
|
|
75
|
+
require('../useSubdomainCheck/useSubdomainCheck.cjs');
|
|
76
|
+
require('../../../context/WalletGroupContext/WalletGroupContext.cjs');
|
|
77
|
+
require('../../../context/IpConfigurationContext/IpConfigurationContext.cjs');
|
|
78
|
+
require('../../../context/ConnectWithOtpContext/ConnectWithOtpContext.cjs');
|
|
79
|
+
require('../../../context/ConnectWithOtpContext/constants.cjs');
|
|
80
|
+
require('../../../widgets/DynamicBridgeWidget/views/WalletsView/components/SecondaryWallets/SecondaryWallets.cjs');
|
|
81
|
+
require('@hcaptcha/react-hcaptcha');
|
|
82
|
+
require('../../../widgets/DynamicWidget/context/DynamicWidgetContext.cjs');
|
|
83
|
+
require('../../../context/FooterAnimationContext/index.cjs');
|
|
84
|
+
require('../../../context/ErrorContext/hooks/useErrorText/useErrorText.cjs');
|
|
85
|
+
require('../../../context/PasskeyContext/PasskeyContext.cjs');
|
|
86
|
+
require('../../../store/state/sendBalances.cjs');
|
|
87
|
+
require('../../../store/state/connectorsInitializing/connectorsInitializing.cjs');
|
|
88
|
+
require('../../../components/OverlayCardBase/OverlayCardTarget/OverlayCardTarget.cjs');
|
|
89
|
+
require('../../../widgets/DynamicWidget/components/DynamicWidgetHeader/DynamicWidgetHeader.cjs');
|
|
90
|
+
require('../../../views/TransactionConfirmationView/TransactionConfirmationView.cjs');
|
|
91
|
+
require('../../../widgets/DynamicWidget/views/ManagePasskeysWidgetView/PasskeyCard/PasskeyCard.cjs');
|
|
92
|
+
require('../../../context/OnrampContext/OnrampContext.cjs');
|
|
93
|
+
require('../../../widgets/DynamicWidget/views/ReceiveWalletFunds/ReceiveWalletFunds.cjs');
|
|
94
|
+
require('../../../../index.cjs');
|
|
95
|
+
require('../../../store/state/tokenBalances.cjs');
|
|
96
|
+
require('../../../shared/utils/functions/getInitialUrl/getInitialUrl.cjs');
|
|
97
|
+
var useInternalDynamicContext = require('../../../context/DynamicContext/useDynamicContext/useInternalDynamicContext/useInternalDynamicContext.cjs');
|
|
98
|
+
|
|
99
|
+
const useIsLoadingEmbeddedWallet = () => {
|
|
100
|
+
const { user } = useInternalDynamicContext.useInternalDynamicContext();
|
|
101
|
+
const projectSettings$1 = projectSettings.getProjectSettings();
|
|
102
|
+
const isLoadingEmbeddedWallet = React.useMemo(() => {
|
|
103
|
+
var _a;
|
|
104
|
+
return usingV3Wallets.usingV3Wallets(projectSettings$1) &&
|
|
105
|
+
!((_a = user === null || user === void 0 ? void 0 : user.verifiedCredentials) === null || _a === void 0 ? void 0 : _a.find(({ walletProvider }) => walletProvider === 'embeddedWallet'));
|
|
106
|
+
}, [projectSettings$1, user]);
|
|
107
|
+
return { isLoadingEmbeddedWallet };
|
|
108
|
+
};
|
|
109
|
+
|
|
110
|
+
exports.useIsLoadingEmbeddedWallet = useIsLoadingEmbeddedWallet;
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
import { useMemo } from 'react';
|
|
3
|
+
import { usingV3Wallets } from '../../functions/usingV3Wallets/usingV3Wallets.js';
|
|
4
|
+
import '../../../context/DynamicContext/DynamicContext.js';
|
|
5
|
+
import '../../../store/state/loadingAndLifecycle/loadingAndLifecycle.js';
|
|
6
|
+
import '@dynamic-labs/sdk-api-core';
|
|
7
|
+
import '../../../shared/logger.js';
|
|
8
|
+
import '@dynamic-labs/iconic';
|
|
9
|
+
import '@dynamic-labs/wallet-connector-core';
|
|
10
|
+
import 'react/jsx-runtime';
|
|
11
|
+
import '../../../context/ViewContext/ViewContext.js';
|
|
12
|
+
import '@dynamic-labs/wallet-book';
|
|
13
|
+
import '@dynamic-labs/utils';
|
|
14
|
+
import '../../constants/colors.js';
|
|
15
|
+
import '../../constants/values.js';
|
|
16
|
+
import '../../../shared/consts/index.js';
|
|
17
|
+
import '../../../events/dynamicEvents.js';
|
|
18
|
+
import '../../../../../_virtual/_tslib.js';
|
|
19
|
+
import '../../../context/CaptchaContext/CaptchaContext.js';
|
|
20
|
+
import '../../../context/ErrorContext/ErrorContext.js';
|
|
21
|
+
import '@dynamic-labs/multi-wallet';
|
|
22
|
+
import 'react-international-phone';
|
|
23
|
+
import '../../../store/state/nonce/nonce.js';
|
|
24
|
+
import { getProjectSettings } from '../../../store/state/projectSettings/projectSettings.js';
|
|
25
|
+
import '../../../config/ApiEndpoint.js';
|
|
26
|
+
import '../../../store/state/user/user.js';
|
|
27
|
+
import '../../../locale/locale.js';
|
|
28
|
+
import '../../../store/state/dynamicContextProps/dynamicContextProps.js';
|
|
29
|
+
import '../../../store/state/primaryWalletId/primaryWalletId.js';
|
|
30
|
+
import '../../../context/AccessDeniedContext/AccessDeniedContext.js';
|
|
31
|
+
import '../../../context/AccountExistsContext/AccountExistsContext.js';
|
|
32
|
+
import '../../../context/UserWalletsContext/UserWalletsContext.js';
|
|
33
|
+
import '../../../store/state/connectedWalletsInfo/connectedWalletsInfo.js';
|
|
34
|
+
import '../../../context/VerificationContext/VerificationContext.js';
|
|
35
|
+
import 'react-dom';
|
|
36
|
+
import '../../functions/compareChains/compareChains.js';
|
|
37
|
+
import '../../../context/ThemeContext/ThemeContext.js';
|
|
38
|
+
import '../useUserUpdateRequest/useUpdateUser/userFieldsSchema.js';
|
|
39
|
+
import 'bs58';
|
|
40
|
+
import '@dynamic-labs/types';
|
|
41
|
+
import '../../../context/SocialRedirectContext/SocialRedirectContext.js';
|
|
42
|
+
import '../../../context/LoadingContext/LoadingContext.js';
|
|
43
|
+
import '../../../context/WalletContext/WalletContext.js';
|
|
44
|
+
import '../useEmbeddedWallet/useSecureEnclaveEmbeddedWallet/constants.js';
|
|
45
|
+
import 'yup';
|
|
46
|
+
import '../../../context/MockContext/MockContext.js';
|
|
47
|
+
import '../../../views/CollectUserDataView/useFields.js';
|
|
48
|
+
import '../../../context/FieldsStateContext/FieldsStateContext.js';
|
|
49
|
+
import '../../../context/UserFieldEditorContext/UserFieldEditorContext.js';
|
|
50
|
+
import '@dynamic-labs/rpc-providers';
|
|
51
|
+
import '../../../store/state/walletOptions/walletOptions.js';
|
|
52
|
+
import 'react-i18next';
|
|
53
|
+
import '../../../components/Accordion/components/AccordionItem/AccordionItem.js';
|
|
54
|
+
import '../../../components/Alert/Alert.js';
|
|
55
|
+
import '../../../components/ShadowDOM/ShadowDOM.js';
|
|
56
|
+
import '../../../components/IconButton/IconButton.js';
|
|
57
|
+
import '../../../components/InlineWidget/InlineWidget.js';
|
|
58
|
+
import '../../../components/Input/Input.js';
|
|
59
|
+
import '../../../components/IsBrowser/IsBrowser.js';
|
|
60
|
+
import '../../../components/MenuList/Dropdown/Dropdown.js';
|
|
61
|
+
import '../../../components/OverlayCard/OverlayCard.js';
|
|
62
|
+
import '../../../components/Transition/ZoomTransition/ZoomTransition.js';
|
|
63
|
+
import '../../../components/Transition/SlideInUpTransition/SlideInUpTransition.js';
|
|
64
|
+
import '../../../components/Transition/OpacityTransition/OpacityTransition.js';
|
|
65
|
+
import '../../../components/PasskeyCreatedSuccessBanner/PasskeyCreatedSuccessBanner.js';
|
|
66
|
+
import '../../../components/Popper/Popper/Popper.js';
|
|
67
|
+
import '../../../components/Popper/PopperContext/PopperContext.js';
|
|
68
|
+
import 'react-focus-lock';
|
|
69
|
+
import 'qrcode';
|
|
70
|
+
import 'formik';
|
|
71
|
+
import '../useSubdomainCheck/useSubdomainCheck.js';
|
|
72
|
+
import '../../../context/WalletGroupContext/WalletGroupContext.js';
|
|
73
|
+
import '../../../context/IpConfigurationContext/IpConfigurationContext.js';
|
|
74
|
+
import '../../../context/ConnectWithOtpContext/ConnectWithOtpContext.js';
|
|
75
|
+
import '../../../context/ConnectWithOtpContext/constants.js';
|
|
76
|
+
import '../../../widgets/DynamicBridgeWidget/views/WalletsView/components/SecondaryWallets/SecondaryWallets.js';
|
|
77
|
+
import '@hcaptcha/react-hcaptcha';
|
|
78
|
+
import '../../../widgets/DynamicWidget/context/DynamicWidgetContext.js';
|
|
79
|
+
import '../../../context/FooterAnimationContext/index.js';
|
|
80
|
+
import '../../../context/ErrorContext/hooks/useErrorText/useErrorText.js';
|
|
81
|
+
import '../../../context/PasskeyContext/PasskeyContext.js';
|
|
82
|
+
import '../../../store/state/sendBalances.js';
|
|
83
|
+
import '../../../store/state/connectorsInitializing/connectorsInitializing.js';
|
|
84
|
+
import '../../../components/OverlayCardBase/OverlayCardTarget/OverlayCardTarget.js';
|
|
85
|
+
import '../../../widgets/DynamicWidget/components/DynamicWidgetHeader/DynamicWidgetHeader.js';
|
|
86
|
+
import '../../../views/TransactionConfirmationView/TransactionConfirmationView.js';
|
|
87
|
+
import '../../../widgets/DynamicWidget/views/ManagePasskeysWidgetView/PasskeyCard/PasskeyCard.js';
|
|
88
|
+
import '../../../context/OnrampContext/OnrampContext.js';
|
|
89
|
+
import '../../../widgets/DynamicWidget/views/ReceiveWalletFunds/ReceiveWalletFunds.js';
|
|
90
|
+
import '../../../../index.js';
|
|
91
|
+
import '../../../store/state/tokenBalances.js';
|
|
92
|
+
import '../../../shared/utils/functions/getInitialUrl/getInitialUrl.js';
|
|
93
|
+
import { useInternalDynamicContext } from '../../../context/DynamicContext/useDynamicContext/useInternalDynamicContext/useInternalDynamicContext.js';
|
|
94
|
+
|
|
95
|
+
const useIsLoadingEmbeddedWallet = () => {
|
|
96
|
+
const { user } = useInternalDynamicContext();
|
|
97
|
+
const projectSettings = getProjectSettings();
|
|
98
|
+
const isLoadingEmbeddedWallet = useMemo(() => {
|
|
99
|
+
var _a;
|
|
100
|
+
return usingV3Wallets(projectSettings) &&
|
|
101
|
+
!((_a = user === null || user === void 0 ? void 0 : user.verifiedCredentials) === null || _a === void 0 ? void 0 : _a.find(({ walletProvider }) => walletProvider === 'embeddedWallet'));
|
|
102
|
+
}, [projectSettings, user]);
|
|
103
|
+
return { isLoadingEmbeddedWallet };
|
|
104
|
+
};
|
|
105
|
+
|
|
106
|
+
export { useIsLoadingEmbeddedWallet };
|
|
@@ -7,6 +7,7 @@ var _tslib = require('../../../../_virtual/_tslib.cjs');
|
|
|
7
7
|
var jsxRuntime = require('react/jsx-runtime');
|
|
8
8
|
var React = require('react');
|
|
9
9
|
var reactI18next = require('react-i18next');
|
|
10
|
+
var sdkApiCore = require('@dynamic-labs/sdk-api-core');
|
|
10
11
|
var walletConnectorCore = require('@dynamic-labs/wallet-connector-core');
|
|
11
12
|
var classNames = require('../../utils/functions/classNames/classNames.cjs');
|
|
12
13
|
require('../../components/Accordion/components/AccordionItem/AccordionItem.cjs');
|
|
@@ -15,7 +16,6 @@ var dynamicEvents = require('../../events/dynamicEvents.cjs');
|
|
|
15
16
|
require('@dynamic-labs/utils');
|
|
16
17
|
require('../../context/DynamicContext/DynamicContext.cjs');
|
|
17
18
|
require('../../store/state/loadingAndLifecycle/loadingAndLifecycle.cjs');
|
|
18
|
-
require('@dynamic-labs/sdk-api-core');
|
|
19
19
|
var logger = require('../../shared/logger.cjs');
|
|
20
20
|
require('@dynamic-labs/iconic');
|
|
21
21
|
var check = require('../../shared/assets/check.cjs');
|
|
@@ -166,7 +166,7 @@ const EmailVerification = ({ isEmailRecoveryFlow = false, showRetryButton: _show
|
|
|
166
166
|
});
|
|
167
167
|
const { verifyOtp } = useOtpVerificationRequest.useOtpVerificationRequest();
|
|
168
168
|
const completeSignInFlow = React.useCallback((updateUserProfileResponse) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
169
|
-
var _e, _f, _g, _h, _j, _k;
|
|
169
|
+
var _e, _f, _g, _h, _j, _k, _l, _m;
|
|
170
170
|
if (updateUserProfileResponse.nextView === 'verified-and-transferred') {
|
|
171
171
|
setShowTransferMessage === null || setShowTransferMessage === void 0 ? void 0 : setShowTransferMessage(true);
|
|
172
172
|
}
|
|
@@ -198,8 +198,11 @@ const EmailVerification = ({ isEmailRecoveryFlow = false, showRetryButton: _show
|
|
|
198
198
|
const eoaWallet = primaryWallet && getEOAWallet(primaryWallet);
|
|
199
199
|
const isSessionKeyCompatible = (primaryWallet && walletConnectorCore.isSessionKeyCompatibleWallet(primaryWallet)) ||
|
|
200
200
|
(eoaWallet && walletConnectorCore.isSessionKeyCompatibleWallet(eoaWallet));
|
|
201
|
-
const
|
|
202
|
-
|
|
201
|
+
const usingV3Wallets = Boolean(((_j = (_h = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.sdk) === null || _h === void 0 ? void 0 : _h.embeddedWallets) === null || _j === void 0 ? void 0 : _j.defaultWalletVersion) ===
|
|
202
|
+
sdkApiCore.EmbeddedWalletVersionEnum.V3);
|
|
203
|
+
const isUsingPregeneratedWallets = Boolean(!usingV3Wallets &&
|
|
204
|
+
isAutomaticWalletCreation &&
|
|
205
|
+
(!((_l = (_k = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.sdk) === null || _k === void 0 ? void 0 : _k.embeddedWallets) === null || _l === void 0 ? void 0 : _l.forceAuthenticatorAtSignup) ||
|
|
203
206
|
isSessionKeyCompatible));
|
|
204
207
|
if (isUsingPregeneratedWallets) {
|
|
205
208
|
const primaryChain = findPrimaryEmbeddedChain.findPrimaryEmbeddedChain(projectSettings);
|
|
@@ -221,7 +224,7 @@ const EmailVerification = ({ isEmailRecoveryFlow = false, showRetryButton: _show
|
|
|
221
224
|
connector: walletOption.walletConnector,
|
|
222
225
|
id: embeddedWalletVerifiedCredential.id,
|
|
223
226
|
isAuthenticated: false,
|
|
224
|
-
key: (
|
|
227
|
+
key: (_m = embeddedWalletVerifiedCredential.walletName) !== null && _m !== void 0 ? _m : '',
|
|
225
228
|
});
|
|
226
229
|
updatePrimaryWalletId.updatePrimaryWalletId(embeddedWalletVerifiedCredential.id);
|
|
227
230
|
dynamicEvents.dynamicEvents.emit('embeddedWalletCreated', wallet, embeddedWalletVerifiedCredential, user);
|
|
@@ -3,6 +3,7 @@ import { __awaiter } from '../../../../_virtual/_tslib.js';
|
|
|
3
3
|
import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
|
|
4
4
|
import { useState, useRef, useCallback, useMemo } from 'react';
|
|
5
5
|
import { useTranslation } from 'react-i18next';
|
|
6
|
+
import { EmbeddedWalletVersionEnum } from '@dynamic-labs/sdk-api-core';
|
|
6
7
|
import { isSessionKeyCompatibleWallet } from '@dynamic-labs/wallet-connector-core';
|
|
7
8
|
import { classNames } from '../../utils/functions/classNames/classNames.js';
|
|
8
9
|
import '../../components/Accordion/components/AccordionItem/AccordionItem.js';
|
|
@@ -11,7 +12,6 @@ import { dynamicEvents } from '../../events/dynamicEvents.js';
|
|
|
11
12
|
import '@dynamic-labs/utils';
|
|
12
13
|
import '../../context/DynamicContext/DynamicContext.js';
|
|
13
14
|
import '../../store/state/loadingAndLifecycle/loadingAndLifecycle.js';
|
|
14
|
-
import '@dynamic-labs/sdk-api-core';
|
|
15
15
|
import { logger } from '../../shared/logger.js';
|
|
16
16
|
import '@dynamic-labs/iconic';
|
|
17
17
|
import { ReactComponent as SvgCheck } from '../../shared/assets/check.js';
|
|
@@ -162,7 +162,7 @@ const EmailVerification = ({ isEmailRecoveryFlow = false, showRetryButton: _show
|
|
|
162
162
|
});
|
|
163
163
|
const { verifyOtp } = useOtpVerificationRequest();
|
|
164
164
|
const completeSignInFlow = useCallback((updateUserProfileResponse) => __awaiter(void 0, void 0, void 0, function* () {
|
|
165
|
-
var _e, _f, _g, _h, _j, _k;
|
|
165
|
+
var _e, _f, _g, _h, _j, _k, _l, _m;
|
|
166
166
|
if (updateUserProfileResponse.nextView === 'verified-and-transferred') {
|
|
167
167
|
setShowTransferMessage === null || setShowTransferMessage === void 0 ? void 0 : setShowTransferMessage(true);
|
|
168
168
|
}
|
|
@@ -194,8 +194,11 @@ const EmailVerification = ({ isEmailRecoveryFlow = false, showRetryButton: _show
|
|
|
194
194
|
const eoaWallet = primaryWallet && getEOAWallet(primaryWallet);
|
|
195
195
|
const isSessionKeyCompatible = (primaryWallet && isSessionKeyCompatibleWallet(primaryWallet)) ||
|
|
196
196
|
(eoaWallet && isSessionKeyCompatibleWallet(eoaWallet));
|
|
197
|
-
const
|
|
198
|
-
|
|
197
|
+
const usingV3Wallets = Boolean(((_j = (_h = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.sdk) === null || _h === void 0 ? void 0 : _h.embeddedWallets) === null || _j === void 0 ? void 0 : _j.defaultWalletVersion) ===
|
|
198
|
+
EmbeddedWalletVersionEnum.V3);
|
|
199
|
+
const isUsingPregeneratedWallets = Boolean(!usingV3Wallets &&
|
|
200
|
+
isAutomaticWalletCreation &&
|
|
201
|
+
(!((_l = (_k = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.sdk) === null || _k === void 0 ? void 0 : _k.embeddedWallets) === null || _l === void 0 ? void 0 : _l.forceAuthenticatorAtSignup) ||
|
|
199
202
|
isSessionKeyCompatible));
|
|
200
203
|
if (isUsingPregeneratedWallets) {
|
|
201
204
|
const primaryChain = findPrimaryEmbeddedChain(projectSettings);
|
|
@@ -217,7 +220,7 @@ const EmailVerification = ({ isEmailRecoveryFlow = false, showRetryButton: _show
|
|
|
217
220
|
connector: walletOption.walletConnector,
|
|
218
221
|
id: embeddedWalletVerifiedCredential.id,
|
|
219
222
|
isAuthenticated: false,
|
|
220
|
-
key: (
|
|
223
|
+
key: (_m = embeddedWalletVerifiedCredential.walletName) !== null && _m !== void 0 ? _m : '',
|
|
221
224
|
});
|
|
222
225
|
updatePrimaryWalletId(embeddedWalletVerifiedCredential.id);
|
|
223
226
|
dynamicEvents.emit('embeddedWalletCreated', wallet, embeddedWalletVerifiedCredential, user);
|
|
@@ -15,7 +15,7 @@ require('../../../../_virtual/_tslib.cjs');
|
|
|
15
15
|
require('../../context/DynamicContext/DynamicContext.cjs');
|
|
16
16
|
require('../../store/state/loadingAndLifecycle/loadingAndLifecycle.cjs');
|
|
17
17
|
require('@dynamic-labs/sdk-api-core');
|
|
18
|
-
require('../../shared/logger.cjs');
|
|
18
|
+
var logger = require('../../shared/logger.cjs');
|
|
19
19
|
var getChainIcon = require('../../shared/utils/functions/chain/getChainIcon.cjs');
|
|
20
20
|
require('@dynamic-labs/wallet-connector-core');
|
|
21
21
|
var shortenWalletAddress = require('../../shared/utils/functions/shortenWalletAddress/shortenWalletAddress.cjs');
|
|
@@ -103,7 +103,7 @@ var DynamicBridgeUserProfile = require('./components/DynamicBridgeUserProfile/Dy
|
|
|
103
103
|
var DynamicBridgeWidgetContext = require('./context/DynamicBridgeWidgetContext/DynamicBridgeWidgetContext.cjs');
|
|
104
104
|
|
|
105
105
|
const DynamicBridgeWidget = ({ className, variant = 'modal', iconVariant = 'chain', }) => {
|
|
106
|
-
const { showAuthFlow, setShowBridgeWidget, bridgeChains, setShowAuthFlow, connectedWallets, sdkHasLoaded, } = useInternalDynamicContext.useInternalDynamicContext();
|
|
106
|
+
const { showAuthFlow, setShowBridgeWidget, bridgeChains, setShowAuthFlow, connectedWallets, sdkHasLoaded, primaryWallet, setPrimaryWallet, } = useInternalDynamicContext.useInternalDynamicContext();
|
|
107
107
|
const { widgetRef, inlineControlsRef } = DynamicBridgeWidgetContext.useDynamicBridgeWidgetContext();
|
|
108
108
|
const { t } = reactI18next.useTranslation();
|
|
109
109
|
const closeOnOutsideClick = React.useCallback((e) => {
|
|
@@ -116,6 +116,39 @@ const DynamicBridgeWidget = ({ className, variant = 'modal', iconVariant = 'chai
|
|
|
116
116
|
}
|
|
117
117
|
}, [inlineControlsRef, variant, showAuthFlow, setShowBridgeWidget]);
|
|
118
118
|
index.useOnClickOutside(widgetRef, closeOnOutsideClick);
|
|
119
|
+
React.useEffect(() => {
|
|
120
|
+
// no need to update primary wallet if it's already set to the correct chain
|
|
121
|
+
if (!primaryWallet ||
|
|
122
|
+
!bridgeChains ||
|
|
123
|
+
connectedWallets.length <= 1 ||
|
|
124
|
+
primaryWallet.chain === bridgeChains[0].chain) {
|
|
125
|
+
return;
|
|
126
|
+
}
|
|
127
|
+
// find a connected wallet that matches the primary bridge chain
|
|
128
|
+
const newPrimaryWallet = connectedWallets.find((wallet) => wallet.chain === bridgeChains[0].chain);
|
|
129
|
+
// if a new primary wallet is found, update the primary wallet
|
|
130
|
+
if (newPrimaryWallet) {
|
|
131
|
+
logger.logger.debug('[DynamicBridgeWidget] bridgeChains changed - updating primary wallet', {
|
|
132
|
+
bridgeChains,
|
|
133
|
+
connectedWallets: connectedWallets.map((wallet) => ({
|
|
134
|
+
address: wallet.address,
|
|
135
|
+
chain: wallet.chain,
|
|
136
|
+
id: wallet.id,
|
|
137
|
+
})),
|
|
138
|
+
newPrimaryWallet: {
|
|
139
|
+
address: newPrimaryWallet.address,
|
|
140
|
+
chain: newPrimaryWallet.chain,
|
|
141
|
+
id: newPrimaryWallet.id,
|
|
142
|
+
},
|
|
143
|
+
oldPrimaryWallet: {
|
|
144
|
+
address: primaryWallet.address,
|
|
145
|
+
chain: primaryWallet.chain,
|
|
146
|
+
id: primaryWallet.id,
|
|
147
|
+
},
|
|
148
|
+
});
|
|
149
|
+
setPrimaryWallet(newPrimaryWallet.id);
|
|
150
|
+
}
|
|
151
|
+
}, [bridgeChains, primaryWallet, connectedWallets, setPrimaryWallet]);
|
|
119
152
|
return (jsxRuntime.jsxs(ShadowDOM.ShadowDOM, { id: 'dynamic-bridge-widget', className: 'dynamic-widget__container', children: [jsxRuntime.jsx(InlineWidget.InlineWidget, { ref: inlineControlsRef, className: className, dataTestId: 'BridgeWidgetNav', children: bridgeChains === null || bridgeChains === void 0 ? void 0 : bridgeChains.map(({ chain }) => {
|
|
120
153
|
const ChainIcon = getChainIcon.getChainIcon(chain);
|
|
121
154
|
if (!sdkHasLoaded) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use client'
|
|
2
2
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
3
|
-
import { useCallback } from 'react';
|
|
3
|
+
import { useCallback, useEffect } from 'react';
|
|
4
4
|
import { useTranslation } from 'react-i18next';
|
|
5
5
|
import { WalletIcon } from '@dynamic-labs/wallet-book';
|
|
6
6
|
import '@dynamic-labs/utils';
|
|
@@ -11,7 +11,7 @@ import '../../../../_virtual/_tslib.js';
|
|
|
11
11
|
import '../../context/DynamicContext/DynamicContext.js';
|
|
12
12
|
import '../../store/state/loadingAndLifecycle/loadingAndLifecycle.js';
|
|
13
13
|
import '@dynamic-labs/sdk-api-core';
|
|
14
|
-
import '../../shared/logger.js';
|
|
14
|
+
import { logger } from '../../shared/logger.js';
|
|
15
15
|
import { getChainIcon } from '../../shared/utils/functions/chain/getChainIcon.js';
|
|
16
16
|
import '@dynamic-labs/wallet-connector-core';
|
|
17
17
|
import { shortenWalletAddress } from '../../shared/utils/functions/shortenWalletAddress/shortenWalletAddress.js';
|
|
@@ -99,7 +99,7 @@ import { DynamicBridgeUserProfile } from './components/DynamicBridgeUserProfile/
|
|
|
99
99
|
import { useDynamicBridgeWidgetContext } from './context/DynamicBridgeWidgetContext/DynamicBridgeWidgetContext.js';
|
|
100
100
|
|
|
101
101
|
const DynamicBridgeWidget = ({ className, variant = 'modal', iconVariant = 'chain', }) => {
|
|
102
|
-
const { showAuthFlow, setShowBridgeWidget, bridgeChains, setShowAuthFlow, connectedWallets, sdkHasLoaded, } = useInternalDynamicContext();
|
|
102
|
+
const { showAuthFlow, setShowBridgeWidget, bridgeChains, setShowAuthFlow, connectedWallets, sdkHasLoaded, primaryWallet, setPrimaryWallet, } = useInternalDynamicContext();
|
|
103
103
|
const { widgetRef, inlineControlsRef } = useDynamicBridgeWidgetContext();
|
|
104
104
|
const { t } = useTranslation();
|
|
105
105
|
const closeOnOutsideClick = useCallback((e) => {
|
|
@@ -112,6 +112,39 @@ const DynamicBridgeWidget = ({ className, variant = 'modal', iconVariant = 'chai
|
|
|
112
112
|
}
|
|
113
113
|
}, [inlineControlsRef, variant, showAuthFlow, setShowBridgeWidget]);
|
|
114
114
|
useOnClickOutside(widgetRef, closeOnOutsideClick);
|
|
115
|
+
useEffect(() => {
|
|
116
|
+
// no need to update primary wallet if it's already set to the correct chain
|
|
117
|
+
if (!primaryWallet ||
|
|
118
|
+
!bridgeChains ||
|
|
119
|
+
connectedWallets.length <= 1 ||
|
|
120
|
+
primaryWallet.chain === bridgeChains[0].chain) {
|
|
121
|
+
return;
|
|
122
|
+
}
|
|
123
|
+
// find a connected wallet that matches the primary bridge chain
|
|
124
|
+
const newPrimaryWallet = connectedWallets.find((wallet) => wallet.chain === bridgeChains[0].chain);
|
|
125
|
+
// if a new primary wallet is found, update the primary wallet
|
|
126
|
+
if (newPrimaryWallet) {
|
|
127
|
+
logger.debug('[DynamicBridgeWidget] bridgeChains changed - updating primary wallet', {
|
|
128
|
+
bridgeChains,
|
|
129
|
+
connectedWallets: connectedWallets.map((wallet) => ({
|
|
130
|
+
address: wallet.address,
|
|
131
|
+
chain: wallet.chain,
|
|
132
|
+
id: wallet.id,
|
|
133
|
+
})),
|
|
134
|
+
newPrimaryWallet: {
|
|
135
|
+
address: newPrimaryWallet.address,
|
|
136
|
+
chain: newPrimaryWallet.chain,
|
|
137
|
+
id: newPrimaryWallet.id,
|
|
138
|
+
},
|
|
139
|
+
oldPrimaryWallet: {
|
|
140
|
+
address: primaryWallet.address,
|
|
141
|
+
chain: primaryWallet.chain,
|
|
142
|
+
id: primaryWallet.id,
|
|
143
|
+
},
|
|
144
|
+
});
|
|
145
|
+
setPrimaryWallet(newPrimaryWallet.id);
|
|
146
|
+
}
|
|
147
|
+
}, [bridgeChains, primaryWallet, connectedWallets, setPrimaryWallet]);
|
|
115
148
|
return (jsxs(ShadowDOM, { id: 'dynamic-bridge-widget', className: 'dynamic-widget__container', children: [jsx(InlineWidget, { ref: inlineControlsRef, className: className, dataTestId: 'BridgeWidgetNav', children: bridgeChains === null || bridgeChains === void 0 ? void 0 : bridgeChains.map(({ chain }) => {
|
|
116
149
|
const ChainIcon = getChainIcon(chain);
|
|
117
150
|
if (!sdkHasLoaded) {
|
|
@@ -105,7 +105,7 @@ const DynamicBridgeWidgetEmptyCard = ({ chain }) => {
|
|
|
105
105
|
}
|
|
106
106
|
const chainInfo = walletConnectorCore.getChainInfoWithOverrides(chain);
|
|
107
107
|
const ChainIcon = getChainIcon.getChainIcon(chain);
|
|
108
|
-
return (jsxRuntime.jsxs("div", { role: 'button', className: 'dynamic-bridge-widget-empty-card', onClick: () => {
|
|
108
|
+
return (jsxRuntime.jsxs("div", { role: 'button', className: 'dynamic-bridge-widget-empty-card', "data-testid": 'dynamic-bridge-widget-empty-card', onClick: () => {
|
|
109
109
|
setShowBridgeWidget(false);
|
|
110
110
|
setShowAuthFlow(true);
|
|
111
111
|
}, children: [jsxRuntime.jsx(ChainIcon, { className: 'dynamic-bridge-widget-empty-card__icon' }), jsxRuntime.jsx(Typography.Typography, { variant: 'body_normal', weight: 'medium', as: 'span', color: 'primary', className: 'dynamic-bridge-widget-empty-card__text', copykey: 'dyn_bridge.widget.connect_with_network', children: t('dyn_bridge.widget.connect_with_network', {
|
|
@@ -101,7 +101,7 @@ const DynamicBridgeWidgetEmptyCard = ({ chain }) => {
|
|
|
101
101
|
}
|
|
102
102
|
const chainInfo = getChainInfoWithOverrides(chain);
|
|
103
103
|
const ChainIcon = getChainIcon(chain);
|
|
104
|
-
return (jsxs("div", { role: 'button', className: 'dynamic-bridge-widget-empty-card', onClick: () => {
|
|
104
|
+
return (jsxs("div", { role: 'button', className: 'dynamic-bridge-widget-empty-card', "data-testid": 'dynamic-bridge-widget-empty-card', onClick: () => {
|
|
105
105
|
setShowBridgeWidget(false);
|
|
106
106
|
setShowAuthFlow(true);
|
|
107
107
|
}, children: [jsx(ChainIcon, { className: 'dynamic-bridge-widget-empty-card__icon' }), jsx(Typography, { variant: 'body_normal', weight: 'medium', as: 'span', color: 'primary', className: 'dynamic-bridge-widget-empty-card__text', copykey: 'dyn_bridge.widget.connect_with_network', children: t('dyn_bridge.widget.connect_with_network', {
|
|
@@ -105,10 +105,11 @@ var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
|
105
105
|
|
|
106
106
|
const SecondaryWallets = ({ hideUnlinkAction = false }) => {
|
|
107
107
|
const { disconnectWallet, bridgeChains, connectedWallets, primaryWalletId } = useInternalDynamicContext.useInternalDynamicContext();
|
|
108
|
-
const
|
|
108
|
+
const secondaryChain = React.useMemo(() => { var _a; return (_a = bridgeChains === null || bridgeChains === void 0 ? void 0 : bridgeChains[1]) === null || _a === void 0 ? void 0 : _a.chain; }, [bridgeChains]);
|
|
109
|
+
const secondaryWallet = React.useMemo(() => connectedWallets.find((wallet) => wallet.id !== primaryWalletId && wallet.chain === secondaryChain), [connectedWallets, primaryWalletId, secondaryChain]);
|
|
109
110
|
const NetworkIcon = secondaryWallet && getChainIcon.getChainIcon(secondaryWallet === null || secondaryWallet === void 0 ? void 0 : secondaryWallet.chain);
|
|
110
111
|
const networkInfo = secondaryWallet && walletConnectorCore.getChainInfoWithOverrides(secondaryWallet === null || secondaryWallet === void 0 ? void 0 : secondaryWallet.chain);
|
|
111
|
-
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [!secondaryWallet && (jsxRuntime.jsx(DynamicBridgeWidgetEmptyCard.DynamicBridgeWidgetEmptyCard, { chain:
|
|
112
|
+
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [!secondaryWallet && (jsxRuntime.jsx(DynamicBridgeWidgetEmptyCard.DynamicBridgeWidgetEmptyCard, { chain: secondaryChain })), secondaryWallet && NetworkIcon && (jsxRuntime.jsx(DynamicBridgeWalletCard.DynamicBridgeWalletCard, { networkIcon: jsxRuntime.jsx(NetworkIcon, {}), networkName: networkInfo === null || networkInfo === void 0 ? void 0 : networkInfo.displayName, children: jsxRuntime.jsx(DynamicBridgeWalletCardBody.DynamicBridgeWalletCardBody, { walletKey: secondaryWallet.connector.key, walletAddress: secondaryWallet.address, walletBalance:
|
|
112
113
|
// eslint-disable-next-line react/jsx-wrap-multilines
|
|
113
114
|
jsxRuntime.jsx(Balance.Balance, { wallet: secondaryWallet, network: secondaryWallet.chain }), onDisconnectClick: !hideUnlinkAction
|
|
114
115
|
? () => disconnectWallet(secondaryWallet.id)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use client'
|
|
2
2
|
import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
|
|
3
|
-
import React__default from 'react';
|
|
3
|
+
import React__default, { useMemo } from 'react';
|
|
4
4
|
import { getChainInfoWithOverrides } from '@dynamic-labs/wallet-connector-core';
|
|
5
5
|
import '@dynamic-labs/sdk-api-core';
|
|
6
6
|
import '../../../../../../shared/logger.js';
|
|
@@ -97,10 +97,11 @@ import { DynamicBridgeWidgetEmptyCard } from '../../../../components/DynamicBrid
|
|
|
97
97
|
|
|
98
98
|
const SecondaryWallets = ({ hideUnlinkAction = false }) => {
|
|
99
99
|
const { disconnectWallet, bridgeChains, connectedWallets, primaryWalletId } = useInternalDynamicContext();
|
|
100
|
-
const
|
|
100
|
+
const secondaryChain = useMemo(() => { var _a; return (_a = bridgeChains === null || bridgeChains === void 0 ? void 0 : bridgeChains[1]) === null || _a === void 0 ? void 0 : _a.chain; }, [bridgeChains]);
|
|
101
|
+
const secondaryWallet = useMemo(() => connectedWallets.find((wallet) => wallet.id !== primaryWalletId && wallet.chain === secondaryChain), [connectedWallets, primaryWalletId, secondaryChain]);
|
|
101
102
|
const NetworkIcon = secondaryWallet && getChainIcon(secondaryWallet === null || secondaryWallet === void 0 ? void 0 : secondaryWallet.chain);
|
|
102
103
|
const networkInfo = secondaryWallet && getChainInfoWithOverrides(secondaryWallet === null || secondaryWallet === void 0 ? void 0 : secondaryWallet.chain);
|
|
103
|
-
return (jsxs(Fragment, { children: [!secondaryWallet && (jsx(DynamicBridgeWidgetEmptyCard, { chain:
|
|
104
|
+
return (jsxs(Fragment, { children: [!secondaryWallet && (jsx(DynamicBridgeWidgetEmptyCard, { chain: secondaryChain })), secondaryWallet && NetworkIcon && (jsx(DynamicBridgeWalletCard, { networkIcon: jsx(NetworkIcon, {}), networkName: networkInfo === null || networkInfo === void 0 ? void 0 : networkInfo.displayName, children: jsx(DynamicBridgeWalletCardBody, { walletKey: secondaryWallet.connector.key, walletAddress: secondaryWallet.address, walletBalance:
|
|
104
105
|
// eslint-disable-next-line react/jsx-wrap-multilines
|
|
105
106
|
jsx(Balance, { wallet: secondaryWallet, network: secondaryWallet.chain }), onDisconnectClick: !hideUnlinkAction
|
|
106
107
|
? () => disconnectWallet(secondaryWallet.id)
|
package/src/lib/widgets/DynamicWidget/components/ActiveWalletBalance/ActiveWalletBalance.cjs
CHANGED
|
@@ -101,7 +101,7 @@ var useInternalDynamicContext = require('../../../../context/DynamicContext/useD
|
|
|
101
101
|
var TokenBalanceList = require('./TokenBalanceList/TokenBalanceList.cjs');
|
|
102
102
|
|
|
103
103
|
/** Component to display token balances for the primary wallet */
|
|
104
|
-
const ActiveWalletBalance = () => {
|
|
104
|
+
const ActiveWalletBalance = ({ isLoading = false, }) => {
|
|
105
105
|
var _a;
|
|
106
106
|
const { t } = reactI18next.useTranslation();
|
|
107
107
|
/** Controls for the multi asset balance accordion */
|
|
@@ -142,14 +142,14 @@ const ActiveWalletBalance = () => {
|
|
|
142
142
|
}
|
|
143
143
|
};
|
|
144
144
|
const primaryWalletNativeBalance = () => {
|
|
145
|
-
if (!primaryWallet || isLoadingTokenBalances) {
|
|
145
|
+
if (!primaryWallet || isLoadingTokenBalances || isLoading) {
|
|
146
146
|
return jsxRuntime.jsx(Skeleton.Skeleton, { className: 'balance-container__skeleton' });
|
|
147
147
|
}
|
|
148
148
|
return canShowFiat ? (jsxRuntime.jsx(Typography.Typography, { variant: 'numbers_display', color: 'primary', children: totalValue === 0 || totalValue >= 0.01
|
|
149
149
|
? currencyFormatter.format(parseFloat(totalValue.toFixed(2)))
|
|
150
150
|
: '<$0.01' })) : (jsxRuntime.jsx(Balance.Balance, { className: 'balance-header__balance', wallet: primaryWallet, network: network, variant: 'numbers_display' }));
|
|
151
151
|
};
|
|
152
|
-
const balanceHeaderTitle = () => (jsxRuntime.jsxs("div", { className: 'balance-header__title', children: [jsxRuntime.jsx(Typography.Typography, { color: 'secondary', variant: 'body_normal', children: t('dyn_active_wallet_info.balance') }), jsxRuntime.jsx("div", { className: 'balance-header__balance', children: primaryWalletNativeBalance() })] }));
|
|
152
|
+
const balanceHeaderTitle = () => (jsxRuntime.jsxs("div", { className: 'balance-header__title', children: [isLoadingTokenBalances || isLoading ? (jsxRuntime.jsx(Skeleton.Skeleton, { className: 'balance-header__title-skeleton' })) : (jsxRuntime.jsx(Typography.Typography, { color: 'secondary', variant: 'body_normal', children: t('dyn_active_wallet_info.balance') })), jsxRuntime.jsx("div", { className: 'balance-header__balance', children: primaryWalletNativeBalance() })] }));
|
|
153
153
|
const toggleBalanceAccordion = React.useCallback(() => {
|
|
154
154
|
if (!isLoadingTokenBalances) {
|
|
155
155
|
setBalanceIsExpanded(!balanceIsExpanded);
|
package/src/lib/widgets/DynamicWidget/components/ActiveWalletBalance/ActiveWalletBalance.d.ts
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
+
type ActiveWalletBalanceProps = {
|
|
3
|
+
isLoading?: boolean;
|
|
4
|
+
};
|
|
2
5
|
/** Component to display token balances for the primary wallet */
|
|
3
|
-
export declare const ActiveWalletBalance: () => JSX.Element;
|
|
6
|
+
export declare const ActiveWalletBalance: ({ isLoading, }: ActiveWalletBalanceProps) => JSX.Element;
|
|
7
|
+
export {};
|
|
@@ -97,7 +97,7 @@ import { useInternalDynamicContext } from '../../../../context/DynamicContext/us
|
|
|
97
97
|
import { TokenBalanceList } from './TokenBalanceList/TokenBalanceList.js';
|
|
98
98
|
|
|
99
99
|
/** Component to display token balances for the primary wallet */
|
|
100
|
-
const ActiveWalletBalance = () => {
|
|
100
|
+
const ActiveWalletBalance = ({ isLoading = false, }) => {
|
|
101
101
|
var _a;
|
|
102
102
|
const { t } = useTranslation();
|
|
103
103
|
/** Controls for the multi asset balance accordion */
|
|
@@ -138,14 +138,14 @@ const ActiveWalletBalance = () => {
|
|
|
138
138
|
}
|
|
139
139
|
};
|
|
140
140
|
const primaryWalletNativeBalance = () => {
|
|
141
|
-
if (!primaryWallet || isLoadingTokenBalances) {
|
|
141
|
+
if (!primaryWallet || isLoadingTokenBalances || isLoading) {
|
|
142
142
|
return jsx(Skeleton, { className: 'balance-container__skeleton' });
|
|
143
143
|
}
|
|
144
144
|
return canShowFiat ? (jsx(Typography, { variant: 'numbers_display', color: 'primary', children: totalValue === 0 || totalValue >= 0.01
|
|
145
145
|
? currencyFormatter.format(parseFloat(totalValue.toFixed(2)))
|
|
146
146
|
: '<$0.01' })) : (jsx(Balance, { className: 'balance-header__balance', wallet: primaryWallet, network: network, variant: 'numbers_display' }));
|
|
147
147
|
};
|
|
148
|
-
const balanceHeaderTitle = () => (jsxs("div", { className: 'balance-header__title', children: [jsx(Typography, { color: 'secondary', variant: 'body_normal', children: t('dyn_active_wallet_info.balance') }), jsx("div", { className: 'balance-header__balance', children: primaryWalletNativeBalance() })] }));
|
|
148
|
+
const balanceHeaderTitle = () => (jsxs("div", { className: 'balance-header__title', children: [isLoadingTokenBalances || isLoading ? (jsx(Skeleton, { className: 'balance-header__title-skeleton' })) : (jsx(Typography, { color: 'secondary', variant: 'body_normal', children: t('dyn_active_wallet_info.balance') })), jsx("div", { className: 'balance-header__balance', children: primaryWalletNativeBalance() })] }));
|
|
149
149
|
const toggleBalanceAccordion = useCallback(() => {
|
|
150
150
|
if (!isLoadingTokenBalances) {
|
|
151
151
|
setBalanceIsExpanded(!balanceIsExpanded);
|