@dynamic-labs/sdk-react-core 4.91.1 → 4.91.3
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 +36 -0
- package/package.cjs +2 -2
- package/package.js +2 -2
- package/package.json +13 -13
- package/src/lib/components/SendBalanceForm/SendBalanceForm.cjs +34 -6
- package/src/lib/components/SendBalanceForm/SendBalanceForm.d.ts +2 -1
- package/src/lib/components/SendBalanceForm/SendBalanceForm.js +35 -7
- package/src/lib/components/SendBalancePageLayout/SendBalancePageLayout.cjs +2 -2
- package/src/lib/components/SendBalancePageLayout/SendBalancePageLayout.js +2 -2
- package/src/lib/components/SendBalancePageLayout/components/TokensBalanceDropdown/TokensBalanceDropdown.cjs +8 -7
- package/src/lib/components/SendBalancePageLayout/components/TokensBalanceDropdown/TokensBalanceDropdown.d.ts +3 -1
- package/src/lib/components/SendBalancePageLayout/components/TokensBalanceDropdown/TokensBalanceDropdown.js +8 -7
- package/src/lib/context/ErrorContext/ErrorContext.cjs +48 -28
- package/src/lib/context/ErrorContext/ErrorContext.js +49 -29
- package/src/lib/context/OnrampContext/OnrampContext.cjs +20 -15
- package/src/lib/context/OnrampContext/OnrampContext.js +20 -15
- package/src/lib/data/api/embeddedWallets/embeddedWallets.cjs +15 -14
- package/src/lib/data/api/embeddedWallets/embeddedWallets.js +3 -2
- package/src/lib/data/api/user/user.cjs +1 -1
- package/src/lib/data/api/user/user.js +2 -2
- package/src/lib/data/api/utils.cjs +6 -1
- package/src/lib/data/api/utils.d.ts +1 -0
- package/src/lib/data/api/utils.js +6 -2
- package/src/lib/data/api/wallets/wallets.cjs +2 -2
- package/src/lib/data/api/wallets/wallets.js +3 -3
- package/src/lib/events/auth.d.ts +3 -2
- package/src/lib/shared/types/dynamicEventsCallbacks.d.ts +2 -1
- package/src/lib/utils/functions/getVerifyArgs/getVerifyArgs.cjs +4 -0
- package/src/lib/utils/functions/getVerifyArgs/getVerifyArgs.js +5 -1
- package/src/lib/utils/hooks/authenticationHooks/useConnectAndSign/useConnectAndSign.cjs +1 -1
- package/src/lib/utils/hooks/authenticationHooks/useConnectAndSign/useConnectAndSign.js +2 -2
- package/src/lib/utils/hooks/useDynamicWaas/useDynamicWaas.cjs +21 -3
- package/src/lib/utils/hooks/useDynamicWaas/useDynamicWaas.d.ts +7 -0
- package/src/lib/utils/hooks/useDynamicWaas/useDynamicWaas.js +21 -3
- package/src/lib/utils/hooks/useEmbeddedReveal/useEmbeddedReveal.cjs +5 -3
- package/src/lib/utils/hooks/useEmbeddedReveal/useEmbeddedReveal.d.ts +1 -1
- package/src/lib/utils/hooks/useEmbeddedReveal/useEmbeddedReveal.js +5 -3
- package/src/lib/utils/hooks/useSocialAccounts/useSocialAccounts.cjs +2 -2
- package/src/lib/utils/hooks/useSocialAccounts/useSocialAccounts.js +2 -2
- package/src/lib/utils/hooks/useSyncEmbeddedWalletFlow/useSyncEmbeddedWalletFlow.cjs +1 -1
- package/src/lib/utils/hooks/useSyncEmbeddedWalletFlow/useSyncEmbeddedWalletFlow.js +1 -1
- package/src/lib/views/EmailVerification/EmailVerification.cjs +4 -4
- package/src/lib/views/EmailVerification/EmailVerification.js +4 -4
- package/src/lib/views/EmailWalletOTPVerificationView/EmailWalletOTPVerificationView.cjs +2 -2
- package/src/lib/views/EmailWalletOTPVerificationView/EmailWalletOTPVerificationView.js +2 -2
- package/src/lib/views/EmbeddedReveal/EmbeddedRevealView/EmbeddedRevealView.cjs +18 -11
- package/src/lib/views/EmbeddedReveal/EmbeddedRevealView/EmbeddedRevealView.d.ts +1 -0
- package/src/lib/views/EmbeddedReveal/EmbeddedRevealView/EmbeddedRevealView.js +18 -11
- package/src/lib/views/LoginView/sections/SocialSignInSection/DynamicSocialSignIn/DynamicSocialSignIn.cjs +2 -2
- package/src/lib/views/LoginView/sections/SocialSignInSection/DynamicSocialSignIn/DynamicSocialSignIn.js +2 -2
- package/src/lib/views/SmsVerification/useSmsVerification/useSmsVerification.cjs +2 -2
- package/src/lib/views/SmsVerification/useSmsVerification/useSmsVerification.js +2 -2
- package/src/lib/widgets/DynamicWidget/components/ActiveMidnightWalletBalance/ActiveMidnightWalletBalance.cjs +33 -9
- package/src/lib/widgets/DynamicWidget/components/ActiveMidnightWalletBalance/ActiveMidnightWalletBalance.js +33 -9
- package/src/lib/widgets/DynamicWidget/views/AccountAndSecuritySettingsView/EmbeddedWalletExportSection/EmbeddedWalletExportSection.cjs +5 -2
- package/src/lib/widgets/DynamicWidget/views/AccountAndSecuritySettingsView/EmbeddedWalletExportSection/EmbeddedWalletExportSection.js +5 -2
- package/src/lib/widgets/DynamicWidget/views/ExportAndRecoveryView/ExportAndRecoveryView.cjs +3 -1
- package/src/lib/widgets/DynamicWidget/views/ExportAndRecoveryView/ExportAndRecoveryView.js +3 -1
|
@@ -6,11 +6,11 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
6
6
|
var _tslib = require('../../../../../_virtual/_tslib.cjs');
|
|
7
7
|
var React = require('react');
|
|
8
8
|
var reactInternationalPhone = require('react-international-phone');
|
|
9
|
+
var utils = require('@dynamic-labs/utils');
|
|
9
10
|
require('../../../context/DynamicContext/useDynamicContext/useDynamicContext.cjs');
|
|
10
11
|
var useInternalDynamicContext = require('../../../context/DynamicContext/useDynamicContext/useInternalDynamicContext/useInternalDynamicContext.cjs');
|
|
11
12
|
var VerificationContext = require('../../../context/VerificationContext/VerificationContext.cjs');
|
|
12
13
|
require('@dynamic-labs-sdk/client');
|
|
13
|
-
require('@dynamic-labs/utils');
|
|
14
14
|
require('@dynamic-labs/sdk-api-core');
|
|
15
15
|
require('@dynamic-labs-sdk/client/core');
|
|
16
16
|
require('eventemitter3');
|
|
@@ -144,7 +144,7 @@ const useSmsVerification = (type) => {
|
|
|
144
144
|
logger.logger.warn('WARNING: emitted smsVerificationResult with incomplete params because retryData was undefined');
|
|
145
145
|
dynamicEvents.dynamicEvents.emit('smsVerificationResult', isValidatedRef.current, phone);
|
|
146
146
|
if (!isValidatedRef.current)
|
|
147
|
-
dynamicEvents.dynamicEvents.emit('authFailure', { option: phone, phone, type: 'sms' },
|
|
147
|
+
dynamicEvents.dynamicEvents.emit('authFailure', { option: phone, phone, type: 'sms' }, utils.SdkErrorCode.USER_CANCELLED);
|
|
148
148
|
});
|
|
149
149
|
const retryOneTimePassword = () => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
150
150
|
setError(undefined);
|
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
import { __awaiter } from '../../../../../_virtual/_tslib.js';
|
|
3
3
|
import { useState, useRef, useCallback } from 'react';
|
|
4
4
|
import { removeDialCode } from 'react-international-phone';
|
|
5
|
+
import { SdkErrorCode } from '@dynamic-labs/utils';
|
|
5
6
|
import '../../../context/DynamicContext/useDynamicContext/useDynamicContext.js';
|
|
6
7
|
import { useInternalDynamicContext } from '../../../context/DynamicContext/useDynamicContext/useInternalDynamicContext/useInternalDynamicContext.js';
|
|
7
8
|
import { useVerification } from '../../../context/VerificationContext/VerificationContext.js';
|
|
8
9
|
import '@dynamic-labs-sdk/client';
|
|
9
|
-
import '@dynamic-labs/utils';
|
|
10
10
|
import '@dynamic-labs/sdk-api-core';
|
|
11
11
|
import '@dynamic-labs-sdk/client/core';
|
|
12
12
|
import 'eventemitter3';
|
|
@@ -140,7 +140,7 @@ const useSmsVerification = (type) => {
|
|
|
140
140
|
logger.warn('WARNING: emitted smsVerificationResult with incomplete params because retryData was undefined');
|
|
141
141
|
dynamicEvents.emit('smsVerificationResult', isValidatedRef.current, phone);
|
|
142
142
|
if (!isValidatedRef.current)
|
|
143
|
-
dynamicEvents.emit('authFailure', { option: phone, phone, type: 'sms' },
|
|
143
|
+
dynamicEvents.emit('authFailure', { option: phone, phone, type: 'sms' }, SdkErrorCode.USER_CANCELLED);
|
|
144
144
|
});
|
|
145
145
|
const retryOneTimePassword = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
146
146
|
setError(undefined);
|
|
@@ -16,7 +16,7 @@ require('@dynamic-labs/iconic');
|
|
|
16
16
|
var midnightShielded = require('../../../../shared/assets/midnight-shielded.cjs');
|
|
17
17
|
var midnightUnshielded = require('../../../../shared/assets/midnight-unshielded.cjs');
|
|
18
18
|
require('../../../../context/ViewContext/ViewContext.cjs');
|
|
19
|
-
require('../../../../shared/logger.cjs');
|
|
19
|
+
var logger = require('../../../../shared/logger.cjs');
|
|
20
20
|
require('@dynamic-labs/wallet-book');
|
|
21
21
|
require('@dynamic-labs/utils');
|
|
22
22
|
require('../../../../utils/constants/colors.cjs');
|
|
@@ -80,7 +80,7 @@ const ActiveMidnightWalletBalance = ({ isLoading = false, }) => {
|
|
|
80
80
|
deps: [walletAddress, primaryWallet, dustPollTick],
|
|
81
81
|
enabled,
|
|
82
82
|
});
|
|
83
|
-
const { dustBalance,
|
|
83
|
+
const { dustBalance, shieldedTokenCount, unshieldedBalance, dustSyncing } = balances !== null && balances !== void 0 ? balances : {};
|
|
84
84
|
React.useEffect(() => {
|
|
85
85
|
if (!dustSyncing)
|
|
86
86
|
return undefined;
|
|
@@ -94,13 +94,29 @@ const ActiveMidnightWalletBalance = ({ isLoading = false, }) => {
|
|
|
94
94
|
// wallets manage dust themselves). When the embedded wallet has no dust
|
|
95
95
|
// registered yet, we surface a "Register DUST" button instead of the gauge.
|
|
96
96
|
const isWaasWallet = Boolean(primaryWallet && walletConnectorCore.isDynamicWaasConnector(primaryWallet.connector));
|
|
97
|
+
// True once registered. balance/cap can't tell us this on load (cap reads 0
|
|
98
|
+
// on current wallet-client builds), so we track it after a register call to
|
|
99
|
+
// flip from the "Register DUST" prompt to the generating state.
|
|
100
|
+
const [dustRegistered, setDustRegistered] = React.useState(false);
|
|
101
|
+
// Returns the promise so <Button> shows its built-in spinner while the heavy
|
|
102
|
+
// registerDust call runs.
|
|
97
103
|
const handleRegisterDust = () => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
98
104
|
const connector = primaryWallet === null || primaryWallet === void 0 ? void 0 : primaryWallet.connector;
|
|
99
105
|
if (!(connector === null || connector === void 0 ? void 0 : connector.registerDust))
|
|
100
106
|
return;
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
107
|
+
try {
|
|
108
|
+
const result = yield connector.registerDust();
|
|
109
|
+
if ((result === null || result === void 0 ? void 0 : result.status) === 'registered' ||
|
|
110
|
+
(result === null || result === void 0 ? void 0 : result.status) === 'already_registered' ||
|
|
111
|
+
(result === null || result === void 0 ? void 0 : result.status) === 'already_has_dust') {
|
|
112
|
+
setDustRegistered(true);
|
|
113
|
+
}
|
|
114
|
+
setDustPollTick((tick) => tick + 1);
|
|
115
|
+
}
|
|
116
|
+
catch (err) {
|
|
117
|
+
// Leave the prompt up so the user can retry rather than failing silently.
|
|
118
|
+
logger.logger.error('Failed to register dust', err);
|
|
119
|
+
}
|
|
104
120
|
});
|
|
105
121
|
// Only show the full skeleton on the very first load; background dust polls
|
|
106
122
|
// keep `balances` populated so the view never flashes back to a skeleton.
|
|
@@ -116,7 +132,10 @@ const ActiveMidnightWalletBalance = ({ isLoading = false, }) => {
|
|
|
116
132
|
cap: truncateToDecimals(dustBalance.cap, 2),
|
|
117
133
|
}
|
|
118
134
|
: undefined;
|
|
119
|
-
|
|
135
|
+
// Unshielded shows the native NIGHT amount; shielded has no NIGHT, so it
|
|
136
|
+
// shows the count of token types held in the pool instead.
|
|
137
|
+
const tokenCount = shieldedTokenCount !== null && shieldedTokenCount !== void 0 ? shieldedTokenCount : 0;
|
|
138
|
+
const shieldedDisplay = `${tokenCount} ${tokenCount === 1 ? 'token' : 'tokens'}`;
|
|
120
139
|
// Dust section has three mutually exclusive states (syncing, generating with
|
|
121
140
|
// a balance, and the WaaS "register dust" prompt). Resolved via a helper to
|
|
122
141
|
// avoid nesting ternaries in the JSX below.
|
|
@@ -124,8 +143,11 @@ const ActiveMidnightWalletBalance = ({ isLoading = false, }) => {
|
|
|
124
143
|
if (dustSyncing) {
|
|
125
144
|
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("div", { className: 'active-midnight-balance__dust', children: jsxRuntime.jsx("div", { className: 'active-midnight-balance__dust-header', children: jsxRuntime.jsxs("div", { className: 'active-midnight-balance__dust-title', children: [jsxRuntime.jsx("svg", { className: 'active-midnight-balance__dust-icon', width: '12', height: '12', viewBox: '0 0 24 24', children: jsxRuntime.jsx("path", { d: 'M13 2L3 14h9l-1 8 10-12h-9l1-8z' }) }), jsxRuntime.jsx("span", { className: 'active-midnight-balance__dust-label', "data-copykey": 'dyn_active_wallet_info.midnight_dust_syncing', children: t('dyn_active_wallet_info.midnight_dust_syncing') })] }) }) }), jsxRuntime.jsx("div", { className: 'active-midnight-balance__divider' })] }));
|
|
126
145
|
}
|
|
127
|
-
|
|
128
|
-
|
|
146
|
+
// Generating gauge: shown with a dust balance, or once registered (balance
|
|
147
|
+
// still 0 during the grace period). Bar renders either way; count only
|
|
148
|
+
// shows with a real balance.
|
|
149
|
+
if (dustBalance || (isWaasWallet && dustRegistered)) {
|
|
150
|
+
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsxs("div", { className: 'active-midnight-balance__dust', children: [jsxRuntime.jsxs("div", { className: 'active-midnight-balance__dust-header', children: [jsxRuntime.jsxs("div", { className: 'active-midnight-balance__dust-title', children: [jsxRuntime.jsx("svg", { className: 'active-midnight-balance__dust-icon', width: '12', height: '12', viewBox: '0 0 24 24', children: jsxRuntime.jsx("path", { d: 'M13 2L3 14h9l-1 8 10-12h-9l1-8z' }) }), jsxRuntime.jsx("span", { className: 'active-midnight-balance__dust-label', "data-copykey": 'dyn_active_wallet_info.midnight_dust_generating', children: t('dyn_active_wallet_info.midnight_dust_generating') })] }), dustBalanceDisplay && (jsxRuntime.jsxs("span", { className: 'active-midnight-balance__dust-count', children: [dustBalanceDisplay.balance, "/", dustBalanceDisplay.cap] }))] }), jsxRuntime.jsx("div", { className: 'active-midnight-balance__dust-bar', children: DUST_SEGMENT_KEYS.map((segmentKey, i) => (jsxRuntime.jsx("div", { className: [
|
|
129
151
|
'active-midnight-balance__dust-segment',
|
|
130
152
|
i === 0 && 'active-midnight-balance__dust-segment--first',
|
|
131
153
|
i === DUST_SEGMENTS - 1 &&
|
|
@@ -143,7 +165,9 @@ const ActiveMidnightWalletBalance = ({ isLoading = false, }) => {
|
|
|
143
165
|
};
|
|
144
166
|
return (jsxRuntime.jsx("div", { className: 'active-midnight-balance', children: jsxRuntime.jsxs("div", { className: 'active-midnight-balance__card', children: [renderDustSection(), jsxRuntime.jsx("div", { className: 'active-midnight-balance__tab-bar', children: TABS.map(({ id, copykey }) => (jsxRuntime.jsx("button", { className: classNames.classNames('active-midnight-balance__tab', {
|
|
145
167
|
'active-midnight-balance__tab--active': activeTab === id,
|
|
146
|
-
}), "data-copykey": copykey, onClick: () => setActiveTab(id), children: t(copykey) }, id))) }), jsxRuntime.jsxs("div", { className: 'active-midnight-balance__pocket', children: [activeTab === 'shielded' ? (jsxRuntime.jsx(midnightShielded.ReactComponent, { className: 'active-midnight-balance__pocket-icon' })) : (jsxRuntime.jsx(midnightUnshielded.ReactComponent, { className: 'active-midnight-balance__pocket-icon' })), jsxRuntime.
|
|
168
|
+
}), "data-copykey": copykey, onClick: () => setActiveTab(id), children: t(copykey) }, id))) }), jsxRuntime.jsxs("div", { className: 'active-midnight-balance__pocket', children: [activeTab === 'shielded' ? (jsxRuntime.jsx(midnightShielded.ReactComponent, { className: 'active-midnight-balance__pocket-icon' })) : (jsxRuntime.jsx(midnightUnshielded.ReactComponent, { className: 'active-midnight-balance__pocket-icon' })), jsxRuntime.jsx("span", { className: 'active-midnight-balance__amount', children: activeTab === 'shielded'
|
|
169
|
+
? shieldedDisplay
|
|
170
|
+
: `${unshieldedBalance !== null && unshieldedBalance !== void 0 ? unshieldedBalance : '—'} NIGHT` })] })] }) }));
|
|
147
171
|
};
|
|
148
172
|
|
|
149
173
|
exports.ActiveMidnightWalletBalance = ActiveMidnightWalletBalance;
|
|
@@ -12,7 +12,7 @@ import '@dynamic-labs/iconic';
|
|
|
12
12
|
import { ReactComponent as SvgMidnightShielded } from '../../../../shared/assets/midnight-shielded.js';
|
|
13
13
|
import { ReactComponent as SvgMidnightUnshielded } from '../../../../shared/assets/midnight-unshielded.js';
|
|
14
14
|
import '../../../../context/ViewContext/ViewContext.js';
|
|
15
|
-
import '../../../../shared/logger.js';
|
|
15
|
+
import { logger } from '../../../../shared/logger.js';
|
|
16
16
|
import '@dynamic-labs/wallet-book';
|
|
17
17
|
import '@dynamic-labs/utils';
|
|
18
18
|
import '../../../../utils/constants/colors.js';
|
|
@@ -76,7 +76,7 @@ const ActiveMidnightWalletBalance = ({ isLoading = false, }) => {
|
|
|
76
76
|
deps: [walletAddress, primaryWallet, dustPollTick],
|
|
77
77
|
enabled,
|
|
78
78
|
});
|
|
79
|
-
const { dustBalance,
|
|
79
|
+
const { dustBalance, shieldedTokenCount, unshieldedBalance, dustSyncing } = balances !== null && balances !== void 0 ? balances : {};
|
|
80
80
|
useEffect(() => {
|
|
81
81
|
if (!dustSyncing)
|
|
82
82
|
return undefined;
|
|
@@ -90,13 +90,29 @@ const ActiveMidnightWalletBalance = ({ isLoading = false, }) => {
|
|
|
90
90
|
// wallets manage dust themselves). When the embedded wallet has no dust
|
|
91
91
|
// registered yet, we surface a "Register DUST" button instead of the gauge.
|
|
92
92
|
const isWaasWallet = Boolean(primaryWallet && isDynamicWaasConnector(primaryWallet.connector));
|
|
93
|
+
// True once registered. balance/cap can't tell us this on load (cap reads 0
|
|
94
|
+
// on current wallet-client builds), so we track it after a register call to
|
|
95
|
+
// flip from the "Register DUST" prompt to the generating state.
|
|
96
|
+
const [dustRegistered, setDustRegistered] = useState(false);
|
|
97
|
+
// Returns the promise so <Button> shows its built-in spinner while the heavy
|
|
98
|
+
// registerDust call runs.
|
|
93
99
|
const handleRegisterDust = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
94
100
|
const connector = primaryWallet === null || primaryWallet === void 0 ? void 0 : primaryWallet.connector;
|
|
95
101
|
if (!(connector === null || connector === void 0 ? void 0 : connector.registerDust))
|
|
96
102
|
return;
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
103
|
+
try {
|
|
104
|
+
const result = yield connector.registerDust();
|
|
105
|
+
if ((result === null || result === void 0 ? void 0 : result.status) === 'registered' ||
|
|
106
|
+
(result === null || result === void 0 ? void 0 : result.status) === 'already_registered' ||
|
|
107
|
+
(result === null || result === void 0 ? void 0 : result.status) === 'already_has_dust') {
|
|
108
|
+
setDustRegistered(true);
|
|
109
|
+
}
|
|
110
|
+
setDustPollTick((tick) => tick + 1);
|
|
111
|
+
}
|
|
112
|
+
catch (err) {
|
|
113
|
+
// Leave the prompt up so the user can retry rather than failing silently.
|
|
114
|
+
logger.error('Failed to register dust', err);
|
|
115
|
+
}
|
|
100
116
|
});
|
|
101
117
|
// Only show the full skeleton on the very first load; background dust polls
|
|
102
118
|
// keep `balances` populated so the view never flashes back to a skeleton.
|
|
@@ -112,7 +128,10 @@ const ActiveMidnightWalletBalance = ({ isLoading = false, }) => {
|
|
|
112
128
|
cap: truncateToDecimals(dustBalance.cap, 2),
|
|
113
129
|
}
|
|
114
130
|
: undefined;
|
|
115
|
-
|
|
131
|
+
// Unshielded shows the native NIGHT amount; shielded has no NIGHT, so it
|
|
132
|
+
// shows the count of token types held in the pool instead.
|
|
133
|
+
const tokenCount = shieldedTokenCount !== null && shieldedTokenCount !== void 0 ? shieldedTokenCount : 0;
|
|
134
|
+
const shieldedDisplay = `${tokenCount} ${tokenCount === 1 ? 'token' : 'tokens'}`;
|
|
116
135
|
// Dust section has three mutually exclusive states (syncing, generating with
|
|
117
136
|
// a balance, and the WaaS "register dust" prompt). Resolved via a helper to
|
|
118
137
|
// avoid nesting ternaries in the JSX below.
|
|
@@ -120,8 +139,11 @@ const ActiveMidnightWalletBalance = ({ isLoading = false, }) => {
|
|
|
120
139
|
if (dustSyncing) {
|
|
121
140
|
return (jsxs(Fragment, { children: [jsx("div", { className: 'active-midnight-balance__dust', children: jsx("div", { className: 'active-midnight-balance__dust-header', children: jsxs("div", { className: 'active-midnight-balance__dust-title', children: [jsx("svg", { className: 'active-midnight-balance__dust-icon', width: '12', height: '12', viewBox: '0 0 24 24', children: jsx("path", { d: 'M13 2L3 14h9l-1 8 10-12h-9l1-8z' }) }), jsx("span", { className: 'active-midnight-balance__dust-label', "data-copykey": 'dyn_active_wallet_info.midnight_dust_syncing', children: t('dyn_active_wallet_info.midnight_dust_syncing') })] }) }) }), jsx("div", { className: 'active-midnight-balance__divider' })] }));
|
|
122
141
|
}
|
|
123
|
-
|
|
124
|
-
|
|
142
|
+
// Generating gauge: shown with a dust balance, or once registered (balance
|
|
143
|
+
// still 0 during the grace period). Bar renders either way; count only
|
|
144
|
+
// shows with a real balance.
|
|
145
|
+
if (dustBalance || (isWaasWallet && dustRegistered)) {
|
|
146
|
+
return (jsxs(Fragment, { children: [jsxs("div", { className: 'active-midnight-balance__dust', children: [jsxs("div", { className: 'active-midnight-balance__dust-header', children: [jsxs("div", { className: 'active-midnight-balance__dust-title', children: [jsx("svg", { className: 'active-midnight-balance__dust-icon', width: '12', height: '12', viewBox: '0 0 24 24', children: jsx("path", { d: 'M13 2L3 14h9l-1 8 10-12h-9l1-8z' }) }), jsx("span", { className: 'active-midnight-balance__dust-label', "data-copykey": 'dyn_active_wallet_info.midnight_dust_generating', children: t('dyn_active_wallet_info.midnight_dust_generating') })] }), dustBalanceDisplay && (jsxs("span", { className: 'active-midnight-balance__dust-count', children: [dustBalanceDisplay.balance, "/", dustBalanceDisplay.cap] }))] }), jsx("div", { className: 'active-midnight-balance__dust-bar', children: DUST_SEGMENT_KEYS.map((segmentKey, i) => (jsx("div", { className: [
|
|
125
147
|
'active-midnight-balance__dust-segment',
|
|
126
148
|
i === 0 && 'active-midnight-balance__dust-segment--first',
|
|
127
149
|
i === DUST_SEGMENTS - 1 &&
|
|
@@ -139,7 +161,9 @@ const ActiveMidnightWalletBalance = ({ isLoading = false, }) => {
|
|
|
139
161
|
};
|
|
140
162
|
return (jsx("div", { className: 'active-midnight-balance', children: jsxs("div", { className: 'active-midnight-balance__card', children: [renderDustSection(), jsx("div", { className: 'active-midnight-balance__tab-bar', children: TABS.map(({ id, copykey }) => (jsx("button", { className: classNames('active-midnight-balance__tab', {
|
|
141
163
|
'active-midnight-balance__tab--active': activeTab === id,
|
|
142
|
-
}), "data-copykey": copykey, onClick: () => setActiveTab(id), children: t(copykey) }, id))) }), jsxs("div", { className: 'active-midnight-balance__pocket', children: [activeTab === 'shielded' ? (jsx(SvgMidnightShielded, { className: 'active-midnight-balance__pocket-icon' })) : (jsx(SvgMidnightUnshielded, { className: 'active-midnight-balance__pocket-icon' })),
|
|
164
|
+
}), "data-copykey": copykey, onClick: () => setActiveTab(id), children: t(copykey) }, id))) }), jsxs("div", { className: 'active-midnight-balance__pocket', children: [activeTab === 'shielded' ? (jsx(SvgMidnightShielded, { className: 'active-midnight-balance__pocket-icon' })) : (jsx(SvgMidnightUnshielded, { className: 'active-midnight-balance__pocket-icon' })), jsx("span", { className: 'active-midnight-balance__amount', children: activeTab === 'shielded'
|
|
165
|
+
? shieldedDisplay
|
|
166
|
+
: `${unshieldedBalance !== null && unshieldedBalance !== void 0 ? unshieldedBalance : '—'} NIGHT` })] })] }) }));
|
|
143
167
|
};
|
|
144
168
|
|
|
145
169
|
export { ActiveMidnightWalletBalance };
|
|
@@ -177,9 +177,10 @@ const EmbeddedWalletExportSection = () => {
|
|
|
177
177
|
}, [setShowAuthFlow, pushView]);
|
|
178
178
|
const handleExportClick = React.useCallback((recoveryPhrase) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
179
179
|
var _l;
|
|
180
|
+
const targetWalletId = wallet === null || wallet === void 0 ? void 0 : wallet.id;
|
|
180
181
|
logger.logger.info('Starting embedded wallet export process', {
|
|
181
182
|
userId: user === null || user === void 0 ? void 0 : user.userId,
|
|
182
|
-
walletId:
|
|
183
|
+
walletId: targetWalletId,
|
|
183
184
|
walletName: (_l = wallet === null || wallet === void 0 ? void 0 : wallet.connector) === null || _l === void 0 ? void 0 : _l.name,
|
|
184
185
|
});
|
|
185
186
|
const stepUpRequired = yield isStepUpRequired({
|
|
@@ -215,8 +216,10 @@ const EmbeddedWalletExportSection = () => {
|
|
|
215
216
|
});
|
|
216
217
|
}
|
|
217
218
|
}
|
|
218
|
-
return initExportProcess(recoveryPhrase);
|
|
219
|
+
return initExportProcess(recoveryPhrase, false, targetWalletId);
|
|
219
220
|
}), [
|
|
221
|
+
wallet,
|
|
222
|
+
user,
|
|
220
223
|
isStepUpRequired,
|
|
221
224
|
promptStepUpAuth,
|
|
222
225
|
isMfaRequiredForAction,
|
|
@@ -173,9 +173,10 @@ const EmbeddedWalletExportSection = () => {
|
|
|
173
173
|
}, [setShowAuthFlow, pushView]);
|
|
174
174
|
const handleExportClick = useCallback((recoveryPhrase) => __awaiter(void 0, void 0, void 0, function* () {
|
|
175
175
|
var _l;
|
|
176
|
+
const targetWalletId = wallet === null || wallet === void 0 ? void 0 : wallet.id;
|
|
176
177
|
logger.info('Starting embedded wallet export process', {
|
|
177
178
|
userId: user === null || user === void 0 ? void 0 : user.userId,
|
|
178
|
-
walletId:
|
|
179
|
+
walletId: targetWalletId,
|
|
179
180
|
walletName: (_l = wallet === null || wallet === void 0 ? void 0 : wallet.connector) === null || _l === void 0 ? void 0 : _l.name,
|
|
180
181
|
});
|
|
181
182
|
const stepUpRequired = yield isStepUpRequired({
|
|
@@ -211,8 +212,10 @@ const EmbeddedWalletExportSection = () => {
|
|
|
211
212
|
});
|
|
212
213
|
}
|
|
213
214
|
}
|
|
214
|
-
return initExportProcess(recoveryPhrase);
|
|
215
|
+
return initExportProcess(recoveryPhrase, false, targetWalletId);
|
|
215
216
|
}), [
|
|
217
|
+
wallet,
|
|
218
|
+
user,
|
|
216
219
|
isStepUpRequired,
|
|
217
220
|
promptStepUpAuth,
|
|
218
221
|
isMfaRequiredForAction,
|
|
@@ -42,6 +42,7 @@ const ExportAndRecoveryView = () => {
|
|
|
42
42
|
const isV3WaasWallet = Boolean(wallet && ((_b = (_a = wallet === null || wallet === void 0 ? void 0 : wallet.connector) === null || _a === void 0 ? void 0 : _a.key) === null || _b === void 0 ? void 0 : _b.startsWith('dynamicwaas')));
|
|
43
43
|
const handleBackClick = React.useCallback(() => setDynamicWidgetView('account-and-security-settings'), [setDynamicWidgetView]);
|
|
44
44
|
const handlePrivateKeyClick = React.useCallback(() => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
45
|
+
const targetWalletId = wallet === null || wallet === void 0 ? void 0 : wallet.id;
|
|
45
46
|
if (!isSessionKeyCompatible) {
|
|
46
47
|
if (yield shouldInitRecovery()) {
|
|
47
48
|
yield initPasskeyRecoveryProcess(undefined, {
|
|
@@ -49,8 +50,9 @@ const ExportAndRecoveryView = () => {
|
|
|
49
50
|
});
|
|
50
51
|
}
|
|
51
52
|
}
|
|
52
|
-
return initExportProcess();
|
|
53
|
+
return initExportProcess(false, false, targetWalletId);
|
|
53
54
|
}), [
|
|
55
|
+
wallet === null || wallet === void 0 ? void 0 : wallet.id,
|
|
54
56
|
isSessionKeyCompatible,
|
|
55
57
|
shouldInitRecovery,
|
|
56
58
|
initPasskeyRecoveryProcess,
|
|
@@ -38,6 +38,7 @@ const ExportAndRecoveryView = () => {
|
|
|
38
38
|
const isV3WaasWallet = Boolean(wallet && ((_b = (_a = wallet === null || wallet === void 0 ? void 0 : wallet.connector) === null || _a === void 0 ? void 0 : _a.key) === null || _b === void 0 ? void 0 : _b.startsWith('dynamicwaas')));
|
|
39
39
|
const handleBackClick = useCallback(() => setDynamicWidgetView('account-and-security-settings'), [setDynamicWidgetView]);
|
|
40
40
|
const handlePrivateKeyClick = useCallback(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
41
|
+
const targetWalletId = wallet === null || wallet === void 0 ? void 0 : wallet.id;
|
|
41
42
|
if (!isSessionKeyCompatible) {
|
|
42
43
|
if (yield shouldInitRecovery()) {
|
|
43
44
|
yield initPasskeyRecoveryProcess(undefined, {
|
|
@@ -45,8 +46,9 @@ const ExportAndRecoveryView = () => {
|
|
|
45
46
|
});
|
|
46
47
|
}
|
|
47
48
|
}
|
|
48
|
-
return initExportProcess();
|
|
49
|
+
return initExportProcess(false, false, targetWalletId);
|
|
49
50
|
}), [
|
|
51
|
+
wallet === null || wallet === void 0 ? void 0 : wallet.id,
|
|
50
52
|
isSessionKeyCompatible,
|
|
51
53
|
shouldInitRecovery,
|
|
52
54
|
initPasskeyRecoveryProcess,
|