@dynamic-labs/sdk-react-core 4.47.2 → 4.48.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 +17 -0
- package/package.cjs +2 -2
- package/package.js +2 -2
- package/package.json +13 -13
- package/src/lib/client/extension/deprecated/mfa/verifyTotpMfaDevice/verifyTotpMfaDevice.d.ts +1 -1
- package/src/lib/client/extension/hooks/useInitializeSdkClient/useInitializeSdkClient.cjs +6 -5
- package/src/lib/client/extension/hooks/useInitializeSdkClient/useInitializeSdkClient.js +6 -5
- package/src/lib/components/EmbeddedWalletExport/EmbeddedWalletExport.js +1 -1
- package/src/lib/components/index.d.ts +1 -1
- package/src/lib/context/ViewContext/types/index.d.ts +1 -1
- package/src/lib/styles/index.shadow.cjs +1 -1
- package/src/lib/styles/index.shadow.js +1 -1
- package/src/lib/utils/constants/authViewLayoutChecks.cjs +1 -0
- package/src/lib/utils/constants/authViewLayoutChecks.js +1 -0
- package/src/lib/utils/hooks/useDynamicWaas/useDynamicWaas.cjs +13 -9
- package/src/lib/utils/hooks/useDynamicWaas/useDynamicWaas.d.ts +2 -1
- package/src/lib/utils/hooks/useDynamicWaas/useDynamicWaas.js +13 -9
- package/src/lib/utils/hooks/useEmbeddedWallet/useSecureEnclaveEmbeddedWallet/useSecureEnclaveEmbeddedWallet.cjs +1 -1
- package/src/lib/utils/hooks/useEmbeddedWallet/useSecureEnclaveEmbeddedWallet/useSecureEnclaveEmbeddedWallet.js +1 -1
- package/src/lib/utils/hooks/useSyncDynamicWaas/useSyncDynamicWaas.cjs +1 -1
- package/src/lib/utils/hooks/useSyncDynamicWaas/useSyncDynamicWaas.js +1 -1
- package/src/lib/utils/hooks/useSyncMfaFlow/useSyncMfaFlow.cjs +9 -1
- package/src/lib/utils/hooks/useSyncMfaFlow/useSyncMfaFlow.js +9 -1
- package/src/lib/utils/hooks/useWalletDelegation/useWalletDelegation.cjs +1 -1
- package/src/lib/utils/hooks/useWalletDelegation/useWalletDelegation.js +1 -1
- package/src/lib/views/EmailVerification/EmailVerification.cjs +1 -1
- package/src/lib/views/EmailVerification/EmailVerification.js +1 -1
- package/src/lib/views/EmbeddedReveal/EmbeddedRevealView/EmbeddedRevealView.cjs +59 -58
- package/src/lib/views/EmbeddedReveal/EmbeddedRevealView/EmbeddedRevealView.js +60 -59
- package/src/lib/views/EmbeddedReveal/utils/turnkeyExport/turnkeyExport.cjs +1 -1
- package/src/lib/views/EmbeddedReveal/utils/turnkeyExport/turnkeyExport.js +1 -1
- package/src/lib/views/ExportSharesView/ExportSharesView.cjs +206 -0
- package/src/lib/views/ExportSharesView/ExportSharesView.d.ts +5 -0
- package/src/lib/views/ExportSharesView/ExportSharesView.js +202 -0
- package/src/lib/views/ExportSharesView/index.d.ts +2 -0
- package/src/lib/views/MfaVerificationView/MfaVerificationView.cjs +8 -6
- package/src/lib/views/MfaVerificationView/MfaVerificationView.js +8 -6
- package/src/lib/views/Passkey/utils/passkeyRecovery/passkeyRecovery.cjs +2 -2
- package/src/lib/views/Passkey/utils/passkeyRecovery/passkeyRecovery.js +2 -2
- package/src/lib/views/WalletUpgradeFlowView/WalletUpgradeFlowView.cjs +1 -1
- package/src/lib/views/WalletUpgradeFlowView/WalletUpgradeFlowView.js +1 -1
- package/src/lib/views/viewToComponentMap.cjs +5 -3
- package/src/lib/views/viewToComponentMap.d.ts +1 -0
- package/src/lib/views/viewToComponentMap.js +5 -3
- package/src/lib/widgets/DynamicWidget/components/DynamicWidgetViews/mapViewToComponent.cjs +4 -0
- package/src/lib/widgets/DynamicWidget/components/DynamicWidgetViews/mapViewToComponent.d.ts +2 -0
- package/src/lib/widgets/DynamicWidget/components/DynamicWidgetViews/mapViewToComponent.js +4 -0
- package/src/lib/widgets/DynamicWidget/context/DynamicWidgetContext.types.d.ts +1 -1
- package/src/lib/widgets/DynamicWidget/views/AccountAndSecuritySettingsView/EmbeddedWalletExportSection/EmbeddedWalletExportSection.cjs +16 -7
- package/src/lib/widgets/DynamicWidget/views/AccountAndSecuritySettingsView/EmbeddedWalletExportSection/EmbeddedWalletExportSection.js +16 -7
- package/src/lib/widgets/DynamicWidget/views/ExportAndRecoveryView/ExportAndRecoveryView.cjs +183 -0
- package/src/lib/widgets/DynamicWidget/views/ExportAndRecoveryView/ExportAndRecoveryView.d.ts +2 -0
- package/src/lib/widgets/DynamicWidget/views/ExportAndRecoveryView/ExportAndRecoveryView.js +179 -0
- package/src/lib/widgets/DynamicWidget/views/ExportAndRecoveryView/index.d.ts +1 -0
- package/src/lib/widgets/DynamicWidget/views/ExportSharesPasscodeView/ExportSharesPasscodeView.cjs +146 -0
- package/src/lib/widgets/DynamicWidget/views/ExportSharesPasscodeView/ExportSharesPasscodeView.d.ts +2 -0
- package/src/lib/widgets/DynamicWidget/views/ExportSharesPasscodeView/ExportSharesPasscodeView.js +142 -0
- package/src/lib/widgets/DynamicWidget/views/ExportSharesPasscodeView/index.d.ts +1 -0
- package/src/lib/widgets/DynamicWidget/views/WaasBackupView/WaasBackupView.cjs +10 -5
- package/src/lib/widgets/DynamicWidget/views/WaasBackupView/WaasBackupView.js +10 -5
|
@@ -0,0 +1,206 @@
|
|
|
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 React = require('react');
|
|
9
|
+
var reactI18next = require('react-i18next');
|
|
10
|
+
var utils = require('@dynamic-labs/utils');
|
|
11
|
+
var walletConnectorCore = require('@dynamic-labs/wallet-connector-core');
|
|
12
|
+
var Badge = require('../../components/Badge/Badge.cjs');
|
|
13
|
+
var Checkbox = require('../../components/Checkbox/Checkbox.cjs');
|
|
14
|
+
var ErrorContainer = require('../../components/ErrorContainer/ErrorContainer.cjs');
|
|
15
|
+
var IconButton = require('../../components/IconButton/IconButton.cjs');
|
|
16
|
+
var ModalHeader = require('../../components/ModalHeader/ModalHeader.cjs');
|
|
17
|
+
var NeedHelpSection = require('../../components/NeedHelpSection/NeedHelpSection.cjs');
|
|
18
|
+
var Typography = require('../../components/Typography/Typography.cjs');
|
|
19
|
+
var TypographyButton = require('../../components/TypographyButton/TypographyButton.cjs');
|
|
20
|
+
require('../../context/DynamicContext/DynamicContext.cjs');
|
|
21
|
+
require('../../store/state/loadingAndLifecycle/loadingAndLifecycle.cjs');
|
|
22
|
+
require('@dynamic-labs/iconic');
|
|
23
|
+
var arrowLeft = require('../../shared/assets/arrow-left.cjs');
|
|
24
|
+
var close = require('../../shared/assets/close.cjs');
|
|
25
|
+
var exportEmbeddedHero = require('../../shared/assets/export-embedded-hero.cjs');
|
|
26
|
+
var ViewContext = require('../../context/ViewContext/ViewContext.cjs');
|
|
27
|
+
var filledQuestionMark = require('../../shared/assets/filled-question-mark.cjs');
|
|
28
|
+
var logger = require('../../shared/logger.cjs');
|
|
29
|
+
require('@dynamic-labs/wallet-book');
|
|
30
|
+
require('../../utils/constants/colors.cjs');
|
|
31
|
+
require('../../utils/constants/values.cjs');
|
|
32
|
+
require('@dynamic-labs/sdk-api-core');
|
|
33
|
+
require('../../shared/consts/index.cjs');
|
|
34
|
+
require('../../events/dynamicEvents.cjs');
|
|
35
|
+
require('../../context/CaptchaContext/CaptchaContext.cjs');
|
|
36
|
+
require('../../context/ErrorContext/ErrorContext.cjs');
|
|
37
|
+
require('@dynamic-labs/multi-wallet');
|
|
38
|
+
require('react-international-phone');
|
|
39
|
+
require('../../store/state/nonce/nonce.cjs');
|
|
40
|
+
require('@dynamic-labs-sdk/client/core');
|
|
41
|
+
require('../../client/client.cjs');
|
|
42
|
+
require('@dynamic-labs-sdk/client');
|
|
43
|
+
require('../../config/ApiEndpoint.cjs');
|
|
44
|
+
require('@dynamic-labs/locale');
|
|
45
|
+
require('../../store/state/dynamicContextProps/dynamicContextProps.cjs');
|
|
46
|
+
require('../../store/state/primaryWalletId/primaryWalletId.cjs');
|
|
47
|
+
require('../../store/state/connectedWalletsInfo/connectedWalletsInfo.cjs');
|
|
48
|
+
require('../../context/AccessDeniedContext/AccessDeniedContext.cjs');
|
|
49
|
+
require('../../context/AccountExistsContext/AccountExistsContext.cjs');
|
|
50
|
+
require('../../context/UserWalletsContext/UserWalletsContext.cjs');
|
|
51
|
+
require('../../store/state/authMode/authMode.cjs');
|
|
52
|
+
require('../../context/VerificationContext/VerificationContext.cjs');
|
|
53
|
+
require('react-dom');
|
|
54
|
+
require('../../utils/functions/compareChains/compareChains.cjs');
|
|
55
|
+
require('../Passkey/utils/findPrimaryEmbeddedChain/findPrimaryEmbeddedChain.cjs');
|
|
56
|
+
require('../../context/ThemeContext/ThemeContext.cjs');
|
|
57
|
+
var useSmartWallets = require('../../utils/hooks/useSmartWallets/useSmartWallets.cjs');
|
|
58
|
+
require('../../utils/hooks/useUserUpdateRequest/useUpdateUser/userFieldsSchema.cjs');
|
|
59
|
+
var utils$1 = require('../../utils/hooks/useTransactionSimulation/utils/utils.cjs');
|
|
60
|
+
require('bs58');
|
|
61
|
+
require('@dynamic-labs/types');
|
|
62
|
+
require('../../context/SocialRedirectContext/SocialRedirectContext.cjs');
|
|
63
|
+
require('../../context/LoadingContext/LoadingContext.cjs');
|
|
64
|
+
require('../../context/WalletContext/WalletContext.cjs');
|
|
65
|
+
require('../../utils/hooks/useEmbeddedWallet/useSecureEnclaveEmbeddedWallet/constants.cjs');
|
|
66
|
+
require('yup');
|
|
67
|
+
require('../../context/MockContext/MockContext.cjs');
|
|
68
|
+
require('../CollectUserDataView/useFields.cjs');
|
|
69
|
+
require('../../context/FieldsStateContext/FieldsStateContext.cjs');
|
|
70
|
+
require('../../context/UserFieldEditorContext/UserFieldEditorContext.cjs');
|
|
71
|
+
require('@dynamic-labs/rpc-providers');
|
|
72
|
+
require('../../store/state/walletOptions/walletOptions.cjs');
|
|
73
|
+
require('../../components/Accordion/components/AccordionItem/AccordionItem.cjs');
|
|
74
|
+
require('../../components/Alert/Alert.cjs');
|
|
75
|
+
require('../../components/ShadowDOM/ShadowDOM.cjs');
|
|
76
|
+
require('../../components/InlineWidget/InlineWidget.cjs');
|
|
77
|
+
require('../../components/Input/Input.cjs');
|
|
78
|
+
require('../../components/IsBrowser/IsBrowser.cjs');
|
|
79
|
+
require('../../components/MenuList/Dropdown/Dropdown.cjs');
|
|
80
|
+
require('../../components/OverlayCard/OverlayCard.cjs');
|
|
81
|
+
require('../../components/Transition/ZoomTransition/ZoomTransition.cjs');
|
|
82
|
+
require('../../components/Transition/SlideInUpTransition/SlideInUpTransition.cjs');
|
|
83
|
+
require('../../components/Transition/OpacityTransition/OpacityTransition.cjs');
|
|
84
|
+
require('../../components/PasskeyCreatedSuccessBanner/PasskeyCreatedSuccessBanner.cjs');
|
|
85
|
+
require('../../components/Popper/Popper/Popper.cjs');
|
|
86
|
+
require('../../components/Popper/PopperContext/PopperContext.cjs');
|
|
87
|
+
require('react-focus-lock');
|
|
88
|
+
require('qrcode');
|
|
89
|
+
require('formik');
|
|
90
|
+
require('../../utils/hooks/useSubdomainCheck/useSubdomainCheck.cjs');
|
|
91
|
+
require('../../context/WalletGroupContext/WalletGroupContext.cjs');
|
|
92
|
+
require('../../context/IpConfigurationContext/IpConfigurationContext.cjs');
|
|
93
|
+
require('../../context/ConnectWithOtpContext/ConnectWithOtpContext.cjs');
|
|
94
|
+
require('../../widgets/DynamicBridgeWidget/views/WalletsView/components/SecondaryWallets/SecondaryWallets.cjs');
|
|
95
|
+
require('@hcaptcha/react-hcaptcha');
|
|
96
|
+
require('../../widgets/DynamicWidget/context/DynamicWidgetContext.cjs');
|
|
97
|
+
require('../../widgets/DynamicWidget/helpers/convertExchangeKeyAndProviderEnum.cjs');
|
|
98
|
+
require('../ExchangeWhitelistWarning/ExchangeWhitelistWarning.cjs');
|
|
99
|
+
require('../../context/ErrorContext/hooks/useErrorText/useErrorText.cjs');
|
|
100
|
+
require('../../context/FooterAnimationContext/index.cjs');
|
|
101
|
+
require('../MfaChooseDeviceView/useGetMfaOptions/useGetMfaOptions.cjs');
|
|
102
|
+
require('../../context/PasskeyContext/PasskeyContext.cjs');
|
|
103
|
+
require('../../context/OnrampContext/OnrampContext.cjs');
|
|
104
|
+
require('../../store/state/sendBalances.cjs');
|
|
105
|
+
require('../../store/state/connectorsInitializing/connectorsInitializing.cjs');
|
|
106
|
+
require('../../components/OverlayCardBase/OverlayCardTarget/OverlayCardTarget.cjs');
|
|
107
|
+
require('../../widgets/DynamicWidget/components/DynamicWidgetHeader/DynamicWidgetHeader.cjs');
|
|
108
|
+
require('../TransactionConfirmationView/TransactionConfirmationView.cjs');
|
|
109
|
+
require('../../widgets/DynamicWidget/components/PasskeyCard/PasskeyCard.cjs');
|
|
110
|
+
require('../../widgets/DynamicWidget/views/CryptoComOnramp/CryptoComOnramp.cjs');
|
|
111
|
+
require('../../../index.cjs');
|
|
112
|
+
require('../../widgets/DynamicWidget/views/ReceiveWalletFunds/ReceiveWalletFunds.cjs');
|
|
113
|
+
require('../../store/state/tokenBalances.cjs');
|
|
114
|
+
require('../../store/state/multichainBalances.cjs');
|
|
115
|
+
require('../../shared/utils/functions/getInitialUrl/getInitialUrl.cjs');
|
|
116
|
+
var useInternalDynamicContext = require('../../context/DynamicContext/useDynamicContext/useInternalDynamicContext/useInternalDynamicContext.cjs');
|
|
117
|
+
|
|
118
|
+
const parseThresholdScheme = (scheme) => {
|
|
119
|
+
if (!scheme)
|
|
120
|
+
return { required: 2, total: 3 };
|
|
121
|
+
const schemeMap = {
|
|
122
|
+
THREE_OF_THREE: { required: 3, total: 3 },
|
|
123
|
+
TWO_OF_THREE: { required: 2, total: 3 },
|
|
124
|
+
TWO_OF_TWO: { required: 2, total: 2 },
|
|
125
|
+
};
|
|
126
|
+
return schemeMap[scheme] || { required: 2, total: 3 };
|
|
127
|
+
};
|
|
128
|
+
const ExportSharesView = ({ passcode }) => {
|
|
129
|
+
const { t } = reactI18next.useTranslation();
|
|
130
|
+
const { primaryWallet, setShowAuthFlow, user } = useInternalDynamicContext.useInternalDynamicContext();
|
|
131
|
+
const { getEOAWallet } = useSmartWallets.useSmartWallets();
|
|
132
|
+
const { goBack, canGoBack } = ViewContext.useViewContext();
|
|
133
|
+
const [isLoading, setIsLoading] = React.useState(false);
|
|
134
|
+
const [error, setError] = React.useState();
|
|
135
|
+
const [isAcknowledged, setIsAcknowledged] = React.useState(false);
|
|
136
|
+
const eoaWallet = primaryWallet && getEOAWallet(primaryWallet);
|
|
137
|
+
const wallet = eoaWallet !== null && eoaWallet !== void 0 ? eoaWallet : primaryWallet;
|
|
138
|
+
const walletCredential = React.useMemo(() => {
|
|
139
|
+
var _a;
|
|
140
|
+
if (!user || !primaryWallet)
|
|
141
|
+
return undefined;
|
|
142
|
+
return (_a = user.verifiedCredentials) === null || _a === void 0 ? void 0 : _a.find((cred) => cred.walletName === 'dynamicwaas' &&
|
|
143
|
+
cred.address === primaryWallet.address);
|
|
144
|
+
}, [user, primaryWallet]);
|
|
145
|
+
const thresholdInfo = React.useMemo(() => {
|
|
146
|
+
var _a;
|
|
147
|
+
const scheme = (_a = walletCredential === null || walletCredential === void 0 ? void 0 : walletCredential.walletProperties) === null || _a === void 0 ? void 0 : _a.thresholdSignatureScheme;
|
|
148
|
+
return parseThresholdScheme(scheme);
|
|
149
|
+
}, [walletCredential]);
|
|
150
|
+
const handleExportShares = React.useCallback(() => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
151
|
+
setError(undefined);
|
|
152
|
+
setIsLoading(true);
|
|
153
|
+
try {
|
|
154
|
+
if (!wallet) {
|
|
155
|
+
throw new utils.DynamicError('No wallet found');
|
|
156
|
+
}
|
|
157
|
+
if (walletConnectorCore.isDynamicWaasConnector(wallet.connector)) {
|
|
158
|
+
yield wallet.connector.exportClientKeyshares({
|
|
159
|
+
accountAddress: wallet.address,
|
|
160
|
+
password: passcode,
|
|
161
|
+
});
|
|
162
|
+
setShowAuthFlow(false);
|
|
163
|
+
return;
|
|
164
|
+
}
|
|
165
|
+
if (utils$1.isZeroDevConnector(wallet.connector)) {
|
|
166
|
+
const { eoaConnector } = wallet.connector;
|
|
167
|
+
if (eoaConnector && walletConnectorCore.isDynamicWaasConnector(eoaConnector)) {
|
|
168
|
+
yield eoaConnector.exportClientKeyshares({
|
|
169
|
+
accountAddress: wallet.address,
|
|
170
|
+
password: passcode,
|
|
171
|
+
});
|
|
172
|
+
setShowAuthFlow(false);
|
|
173
|
+
return;
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
throw new utils.DynamicError('Not a supported connector type for export shares');
|
|
177
|
+
}
|
|
178
|
+
catch (err) {
|
|
179
|
+
logger.logger.error('Error exporting shares', { error: err });
|
|
180
|
+
setError(t('dyn_export_shares.error'));
|
|
181
|
+
}
|
|
182
|
+
finally {
|
|
183
|
+
setIsLoading(false);
|
|
184
|
+
}
|
|
185
|
+
}), [wallet, passcode, setShowAuthFlow, t]);
|
|
186
|
+
const bulletPoints = [
|
|
187
|
+
{ key: 'dyn_export_shares.bullet_1' },
|
|
188
|
+
{
|
|
189
|
+
key: 'dyn_export_shares.bullet_2',
|
|
190
|
+
values: { required: thresholdInfo.required },
|
|
191
|
+
},
|
|
192
|
+
{ key: 'dyn_export_shares.bullet_3' },
|
|
193
|
+
];
|
|
194
|
+
const backButton = canGoBack && (jsxRuntime.jsx(IconButton.IconButton, { onClick: goBack, type: 'button', children: jsxRuntime.jsx(arrowLeft.ReactComponent, {}) }));
|
|
195
|
+
const closeButton = (jsxRuntime.jsx(IconButton.IconButton, { onClick: () => {
|
|
196
|
+
setShowAuthFlow(false);
|
|
197
|
+
}, type: 'button', children: jsxRuntime.jsx(close.ReactComponent, {}) }));
|
|
198
|
+
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(ModalHeader.ModalHeader, { leading: backButton, trailing: closeButton, children: jsxRuntime.jsx(Typography.Typography, { as: 'h1', variant: 'title', color: 'primary', "data-testid": 'dynamic-auth-modal-heading', className: 'header__typography', children: t('dyn_export_shares.title') }) }), jsxRuntime.jsx("div", { className: 'embedded-reveal-view', children: jsxRuntime.jsxs("div", { className: 'embedded-reveal-view__body', children: [jsxRuntime.jsx("div", { className: 'embedded-reveal-view__body__description', children: jsxRuntime.jsx("div", { className: 'embedded-reveal-view__header', children: jsxRuntime.jsx("div", { className: 'embedded-reveal-view__header__hero', children: jsxRuntime.jsx(exportEmbeddedHero.ReactComponent, {}) }) }) }), jsxRuntime.jsxs("div", { className: 'embedded-reveal-view__body__description', children: [jsxRuntime.jsx("div", { className: 'embedded-reveal-view__body__badge-container', children: jsxRuntime.jsx(Badge.Badge, { text: t('dyn_export_shares.sensitive_info'), className: 'embedded-reveal-view__body__badge' }) }), jsxRuntime.jsx(Typography.Typography, { variant: 'body_normal', color: 'primary', weight: 'regular', copykey: 'dyn_export_shares.threshold_description', children: t('dyn_export_shares.threshold_description', {
|
|
199
|
+
required: thresholdInfo.required,
|
|
200
|
+
total: thresholdInfo.total,
|
|
201
|
+
}) })] }), error && jsxRuntime.jsx(ErrorContainer.ErrorContainer, { children: error }), jsxRuntime.jsxs("div", { className: 'embedded-reveal-view__body__card', children: [jsxRuntime.jsxs("div", { className: 'embedded-reveal-view__body__card__statement', children: [jsxRuntime.jsx("div", { className: 'embedded-reveal-view__body__card__icon', children: jsxRuntime.jsx(filledQuestionMark.ReactComponent, { height: 16, width: 16 }) }), jsxRuntime.jsx("div", { className: 'embedded-reveal-view__body__card__statement__text', children: jsxRuntime.jsx(Typography.Typography, { variant: 'body_small', color: 'primary', weight: 'medium', copykey: 'dyn_export_shares.how_to_use_title', children: t('dyn_export_shares.how_to_use_title') }) })] }), jsxRuntime.jsx("ul", { className: 'embedded-reveal-view__body__bullet-list', children: bulletPoints.map((bullet) => (jsxRuntime.jsx("li", { children: jsxRuntime.jsx(Typography.Typography, { variant: 'body_small', color: 'primary', copykey: bullet.key, children: t(bullet.key, bullet.values) }) }, bullet.key))) })] }), jsxRuntime.jsx("div", { className: 'embedded-reveal-view__body__confirm_card', children: jsxRuntime.jsxs("button", { className: 'embedded-reveal-view__body__card__acknowledgement', onClick: () => setIsAcknowledged(!isAcknowledged), children: [jsxRuntime.jsx("div", { children: jsxRuntime.jsx(Checkbox.Checkbox, { checked: isAcknowledged, onChange: () => setIsAcknowledged(!isAcknowledged), className: 'embedded-reveal-view__body__card__statement__checkbox', id: 'export-shares-checkbox' }) }), jsxRuntime.jsx("div", { children: jsxRuntime.jsx(Typography.Typography, { variant: 'body_small', color: 'primary', style: { letterSpacing: '-0.15px' }, copykey: 'dyn_export_shares.acknowledge', children: t('dyn_export_shares.acknowledge') }) })] }) }), jsxRuntime.jsx(NeedHelpSection.NeedHelpSection, { isExport: true }), jsxRuntime.jsx("div", { className: 'embedded-reveal-view__body__button_section', children: jsxRuntime.jsx(TypographyButton.TypographyButton, { buttonPadding: 'medium', buttonVariant: 'brand-primary', typographyProps: {
|
|
202
|
+
color: 'inherit',
|
|
203
|
+
}, onClick: handleExportShares, disabled: !isAcknowledged, loading: isLoading, dataTestId: 'export-shares-submit-button', copykey: 'dyn_export_shares.download_button', style: { width: '100%' }, className: 'embedded-reveal-view__body__button', expanded: true, children: t('dyn_export_shares.download_button') }) })] }) })] }));
|
|
204
|
+
};
|
|
205
|
+
|
|
206
|
+
exports.ExportSharesView = ExportSharesView;
|
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
import { __awaiter } from '../../../../_virtual/_tslib.js';
|
|
3
|
+
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
4
|
+
import { useState, useMemo, useCallback } from 'react';
|
|
5
|
+
import { useTranslation } from 'react-i18next';
|
|
6
|
+
import { DynamicError } from '@dynamic-labs/utils';
|
|
7
|
+
import { isDynamicWaasConnector } from '@dynamic-labs/wallet-connector-core';
|
|
8
|
+
import { Badge } from '../../components/Badge/Badge.js';
|
|
9
|
+
import { Checkbox } from '../../components/Checkbox/Checkbox.js';
|
|
10
|
+
import { ErrorContainer } from '../../components/ErrorContainer/ErrorContainer.js';
|
|
11
|
+
import { IconButton } from '../../components/IconButton/IconButton.js';
|
|
12
|
+
import { ModalHeader } from '../../components/ModalHeader/ModalHeader.js';
|
|
13
|
+
import { NeedHelpSection } from '../../components/NeedHelpSection/NeedHelpSection.js';
|
|
14
|
+
import { Typography } from '../../components/Typography/Typography.js';
|
|
15
|
+
import { TypographyButton } from '../../components/TypographyButton/TypographyButton.js';
|
|
16
|
+
import '../../context/DynamicContext/DynamicContext.js';
|
|
17
|
+
import '../../store/state/loadingAndLifecycle/loadingAndLifecycle.js';
|
|
18
|
+
import '@dynamic-labs/iconic';
|
|
19
|
+
import { ReactComponent as SvgArrowLeft } from '../../shared/assets/arrow-left.js';
|
|
20
|
+
import { ReactComponent as SvgClose } from '../../shared/assets/close.js';
|
|
21
|
+
import { ReactComponent as SvgExportEmbeddedHero } from '../../shared/assets/export-embedded-hero.js';
|
|
22
|
+
import { useViewContext } from '../../context/ViewContext/ViewContext.js';
|
|
23
|
+
import { ReactComponent as SvgFilledQuestionMark } from '../../shared/assets/filled-question-mark.js';
|
|
24
|
+
import { logger } from '../../shared/logger.js';
|
|
25
|
+
import '@dynamic-labs/wallet-book';
|
|
26
|
+
import '../../utils/constants/colors.js';
|
|
27
|
+
import '../../utils/constants/values.js';
|
|
28
|
+
import '@dynamic-labs/sdk-api-core';
|
|
29
|
+
import '../../shared/consts/index.js';
|
|
30
|
+
import '../../events/dynamicEvents.js';
|
|
31
|
+
import '../../context/CaptchaContext/CaptchaContext.js';
|
|
32
|
+
import '../../context/ErrorContext/ErrorContext.js';
|
|
33
|
+
import '@dynamic-labs/multi-wallet';
|
|
34
|
+
import 'react-international-phone';
|
|
35
|
+
import '../../store/state/nonce/nonce.js';
|
|
36
|
+
import '@dynamic-labs-sdk/client/core';
|
|
37
|
+
import '../../client/client.js';
|
|
38
|
+
import '@dynamic-labs-sdk/client';
|
|
39
|
+
import '../../config/ApiEndpoint.js';
|
|
40
|
+
import '@dynamic-labs/locale';
|
|
41
|
+
import '../../store/state/dynamicContextProps/dynamicContextProps.js';
|
|
42
|
+
import '../../store/state/primaryWalletId/primaryWalletId.js';
|
|
43
|
+
import '../../store/state/connectedWalletsInfo/connectedWalletsInfo.js';
|
|
44
|
+
import '../../context/AccessDeniedContext/AccessDeniedContext.js';
|
|
45
|
+
import '../../context/AccountExistsContext/AccountExistsContext.js';
|
|
46
|
+
import '../../context/UserWalletsContext/UserWalletsContext.js';
|
|
47
|
+
import '../../store/state/authMode/authMode.js';
|
|
48
|
+
import '../../context/VerificationContext/VerificationContext.js';
|
|
49
|
+
import 'react-dom';
|
|
50
|
+
import '../../utils/functions/compareChains/compareChains.js';
|
|
51
|
+
import '../Passkey/utils/findPrimaryEmbeddedChain/findPrimaryEmbeddedChain.js';
|
|
52
|
+
import '../../context/ThemeContext/ThemeContext.js';
|
|
53
|
+
import { useSmartWallets } from '../../utils/hooks/useSmartWallets/useSmartWallets.js';
|
|
54
|
+
import '../../utils/hooks/useUserUpdateRequest/useUpdateUser/userFieldsSchema.js';
|
|
55
|
+
import { isZeroDevConnector } from '../../utils/hooks/useTransactionSimulation/utils/utils.js';
|
|
56
|
+
import 'bs58';
|
|
57
|
+
import '@dynamic-labs/types';
|
|
58
|
+
import '../../context/SocialRedirectContext/SocialRedirectContext.js';
|
|
59
|
+
import '../../context/LoadingContext/LoadingContext.js';
|
|
60
|
+
import '../../context/WalletContext/WalletContext.js';
|
|
61
|
+
import '../../utils/hooks/useEmbeddedWallet/useSecureEnclaveEmbeddedWallet/constants.js';
|
|
62
|
+
import 'yup';
|
|
63
|
+
import '../../context/MockContext/MockContext.js';
|
|
64
|
+
import '../CollectUserDataView/useFields.js';
|
|
65
|
+
import '../../context/FieldsStateContext/FieldsStateContext.js';
|
|
66
|
+
import '../../context/UserFieldEditorContext/UserFieldEditorContext.js';
|
|
67
|
+
import '@dynamic-labs/rpc-providers';
|
|
68
|
+
import '../../store/state/walletOptions/walletOptions.js';
|
|
69
|
+
import '../../components/Accordion/components/AccordionItem/AccordionItem.js';
|
|
70
|
+
import '../../components/Alert/Alert.js';
|
|
71
|
+
import '../../components/ShadowDOM/ShadowDOM.js';
|
|
72
|
+
import '../../components/InlineWidget/InlineWidget.js';
|
|
73
|
+
import '../../components/Input/Input.js';
|
|
74
|
+
import '../../components/IsBrowser/IsBrowser.js';
|
|
75
|
+
import '../../components/MenuList/Dropdown/Dropdown.js';
|
|
76
|
+
import '../../components/OverlayCard/OverlayCard.js';
|
|
77
|
+
import '../../components/Transition/ZoomTransition/ZoomTransition.js';
|
|
78
|
+
import '../../components/Transition/SlideInUpTransition/SlideInUpTransition.js';
|
|
79
|
+
import '../../components/Transition/OpacityTransition/OpacityTransition.js';
|
|
80
|
+
import '../../components/PasskeyCreatedSuccessBanner/PasskeyCreatedSuccessBanner.js';
|
|
81
|
+
import '../../components/Popper/Popper/Popper.js';
|
|
82
|
+
import '../../components/Popper/PopperContext/PopperContext.js';
|
|
83
|
+
import 'react-focus-lock';
|
|
84
|
+
import 'qrcode';
|
|
85
|
+
import 'formik';
|
|
86
|
+
import '../../utils/hooks/useSubdomainCheck/useSubdomainCheck.js';
|
|
87
|
+
import '../../context/WalletGroupContext/WalletGroupContext.js';
|
|
88
|
+
import '../../context/IpConfigurationContext/IpConfigurationContext.js';
|
|
89
|
+
import '../../context/ConnectWithOtpContext/ConnectWithOtpContext.js';
|
|
90
|
+
import '../../widgets/DynamicBridgeWidget/views/WalletsView/components/SecondaryWallets/SecondaryWallets.js';
|
|
91
|
+
import '@hcaptcha/react-hcaptcha';
|
|
92
|
+
import '../../widgets/DynamicWidget/context/DynamicWidgetContext.js';
|
|
93
|
+
import '../../widgets/DynamicWidget/helpers/convertExchangeKeyAndProviderEnum.js';
|
|
94
|
+
import '../ExchangeWhitelistWarning/ExchangeWhitelistWarning.js';
|
|
95
|
+
import '../../context/ErrorContext/hooks/useErrorText/useErrorText.js';
|
|
96
|
+
import '../../context/FooterAnimationContext/index.js';
|
|
97
|
+
import '../MfaChooseDeviceView/useGetMfaOptions/useGetMfaOptions.js';
|
|
98
|
+
import '../../context/PasskeyContext/PasskeyContext.js';
|
|
99
|
+
import '../../context/OnrampContext/OnrampContext.js';
|
|
100
|
+
import '../../store/state/sendBalances.js';
|
|
101
|
+
import '../../store/state/connectorsInitializing/connectorsInitializing.js';
|
|
102
|
+
import '../../components/OverlayCardBase/OverlayCardTarget/OverlayCardTarget.js';
|
|
103
|
+
import '../../widgets/DynamicWidget/components/DynamicWidgetHeader/DynamicWidgetHeader.js';
|
|
104
|
+
import '../TransactionConfirmationView/TransactionConfirmationView.js';
|
|
105
|
+
import '../../widgets/DynamicWidget/components/PasskeyCard/PasskeyCard.js';
|
|
106
|
+
import '../../widgets/DynamicWidget/views/CryptoComOnramp/CryptoComOnramp.js';
|
|
107
|
+
import '../../../index.js';
|
|
108
|
+
import '../../widgets/DynamicWidget/views/ReceiveWalletFunds/ReceiveWalletFunds.js';
|
|
109
|
+
import '../../store/state/tokenBalances.js';
|
|
110
|
+
import '../../store/state/multichainBalances.js';
|
|
111
|
+
import '../../shared/utils/functions/getInitialUrl/getInitialUrl.js';
|
|
112
|
+
import { useInternalDynamicContext } from '../../context/DynamicContext/useDynamicContext/useInternalDynamicContext/useInternalDynamicContext.js';
|
|
113
|
+
|
|
114
|
+
const parseThresholdScheme = (scheme) => {
|
|
115
|
+
if (!scheme)
|
|
116
|
+
return { required: 2, total: 3 };
|
|
117
|
+
const schemeMap = {
|
|
118
|
+
THREE_OF_THREE: { required: 3, total: 3 },
|
|
119
|
+
TWO_OF_THREE: { required: 2, total: 3 },
|
|
120
|
+
TWO_OF_TWO: { required: 2, total: 2 },
|
|
121
|
+
};
|
|
122
|
+
return schemeMap[scheme] || { required: 2, total: 3 };
|
|
123
|
+
};
|
|
124
|
+
const ExportSharesView = ({ passcode }) => {
|
|
125
|
+
const { t } = useTranslation();
|
|
126
|
+
const { primaryWallet, setShowAuthFlow, user } = useInternalDynamicContext();
|
|
127
|
+
const { getEOAWallet } = useSmartWallets();
|
|
128
|
+
const { goBack, canGoBack } = useViewContext();
|
|
129
|
+
const [isLoading, setIsLoading] = useState(false);
|
|
130
|
+
const [error, setError] = useState();
|
|
131
|
+
const [isAcknowledged, setIsAcknowledged] = useState(false);
|
|
132
|
+
const eoaWallet = primaryWallet && getEOAWallet(primaryWallet);
|
|
133
|
+
const wallet = eoaWallet !== null && eoaWallet !== void 0 ? eoaWallet : primaryWallet;
|
|
134
|
+
const walletCredential = useMemo(() => {
|
|
135
|
+
var _a;
|
|
136
|
+
if (!user || !primaryWallet)
|
|
137
|
+
return undefined;
|
|
138
|
+
return (_a = user.verifiedCredentials) === null || _a === void 0 ? void 0 : _a.find((cred) => cred.walletName === 'dynamicwaas' &&
|
|
139
|
+
cred.address === primaryWallet.address);
|
|
140
|
+
}, [user, primaryWallet]);
|
|
141
|
+
const thresholdInfo = useMemo(() => {
|
|
142
|
+
var _a;
|
|
143
|
+
const scheme = (_a = walletCredential === null || walletCredential === void 0 ? void 0 : walletCredential.walletProperties) === null || _a === void 0 ? void 0 : _a.thresholdSignatureScheme;
|
|
144
|
+
return parseThresholdScheme(scheme);
|
|
145
|
+
}, [walletCredential]);
|
|
146
|
+
const handleExportShares = useCallback(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
147
|
+
setError(undefined);
|
|
148
|
+
setIsLoading(true);
|
|
149
|
+
try {
|
|
150
|
+
if (!wallet) {
|
|
151
|
+
throw new DynamicError('No wallet found');
|
|
152
|
+
}
|
|
153
|
+
if (isDynamicWaasConnector(wallet.connector)) {
|
|
154
|
+
yield wallet.connector.exportClientKeyshares({
|
|
155
|
+
accountAddress: wallet.address,
|
|
156
|
+
password: passcode,
|
|
157
|
+
});
|
|
158
|
+
setShowAuthFlow(false);
|
|
159
|
+
return;
|
|
160
|
+
}
|
|
161
|
+
if (isZeroDevConnector(wallet.connector)) {
|
|
162
|
+
const { eoaConnector } = wallet.connector;
|
|
163
|
+
if (eoaConnector && isDynamicWaasConnector(eoaConnector)) {
|
|
164
|
+
yield eoaConnector.exportClientKeyshares({
|
|
165
|
+
accountAddress: wallet.address,
|
|
166
|
+
password: passcode,
|
|
167
|
+
});
|
|
168
|
+
setShowAuthFlow(false);
|
|
169
|
+
return;
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
throw new DynamicError('Not a supported connector type for export shares');
|
|
173
|
+
}
|
|
174
|
+
catch (err) {
|
|
175
|
+
logger.error('Error exporting shares', { error: err });
|
|
176
|
+
setError(t('dyn_export_shares.error'));
|
|
177
|
+
}
|
|
178
|
+
finally {
|
|
179
|
+
setIsLoading(false);
|
|
180
|
+
}
|
|
181
|
+
}), [wallet, passcode, setShowAuthFlow, t]);
|
|
182
|
+
const bulletPoints = [
|
|
183
|
+
{ key: 'dyn_export_shares.bullet_1' },
|
|
184
|
+
{
|
|
185
|
+
key: 'dyn_export_shares.bullet_2',
|
|
186
|
+
values: { required: thresholdInfo.required },
|
|
187
|
+
},
|
|
188
|
+
{ key: 'dyn_export_shares.bullet_3' },
|
|
189
|
+
];
|
|
190
|
+
const backButton = canGoBack && (jsx(IconButton, { onClick: goBack, type: 'button', children: jsx(SvgArrowLeft, {}) }));
|
|
191
|
+
const closeButton = (jsx(IconButton, { onClick: () => {
|
|
192
|
+
setShowAuthFlow(false);
|
|
193
|
+
}, type: 'button', children: jsx(SvgClose, {}) }));
|
|
194
|
+
return (jsxs(Fragment, { children: [jsx(ModalHeader, { leading: backButton, trailing: closeButton, children: jsx(Typography, { as: 'h1', variant: 'title', color: 'primary', "data-testid": 'dynamic-auth-modal-heading', className: 'header__typography', children: t('dyn_export_shares.title') }) }), jsx("div", { className: 'embedded-reveal-view', children: jsxs("div", { className: 'embedded-reveal-view__body', children: [jsx("div", { className: 'embedded-reveal-view__body__description', children: jsx("div", { className: 'embedded-reveal-view__header', children: jsx("div", { className: 'embedded-reveal-view__header__hero', children: jsx(SvgExportEmbeddedHero, {}) }) }) }), jsxs("div", { className: 'embedded-reveal-view__body__description', children: [jsx("div", { className: 'embedded-reveal-view__body__badge-container', children: jsx(Badge, { text: t('dyn_export_shares.sensitive_info'), className: 'embedded-reveal-view__body__badge' }) }), jsx(Typography, { variant: 'body_normal', color: 'primary', weight: 'regular', copykey: 'dyn_export_shares.threshold_description', children: t('dyn_export_shares.threshold_description', {
|
|
195
|
+
required: thresholdInfo.required,
|
|
196
|
+
total: thresholdInfo.total,
|
|
197
|
+
}) })] }), error && jsx(ErrorContainer, { children: error }), jsxs("div", { className: 'embedded-reveal-view__body__card', children: [jsxs("div", { className: 'embedded-reveal-view__body__card__statement', children: [jsx("div", { className: 'embedded-reveal-view__body__card__icon', children: jsx(SvgFilledQuestionMark, { height: 16, width: 16 }) }), jsx("div", { className: 'embedded-reveal-view__body__card__statement__text', children: jsx(Typography, { variant: 'body_small', color: 'primary', weight: 'medium', copykey: 'dyn_export_shares.how_to_use_title', children: t('dyn_export_shares.how_to_use_title') }) })] }), jsx("ul", { className: 'embedded-reveal-view__body__bullet-list', children: bulletPoints.map((bullet) => (jsx("li", { children: jsx(Typography, { variant: 'body_small', color: 'primary', copykey: bullet.key, children: t(bullet.key, bullet.values) }) }, bullet.key))) })] }), jsx("div", { className: 'embedded-reveal-view__body__confirm_card', children: jsxs("button", { className: 'embedded-reveal-view__body__card__acknowledgement', onClick: () => setIsAcknowledged(!isAcknowledged), children: [jsx("div", { children: jsx(Checkbox, { checked: isAcknowledged, onChange: () => setIsAcknowledged(!isAcknowledged), className: 'embedded-reveal-view__body__card__statement__checkbox', id: 'export-shares-checkbox' }) }), jsx("div", { children: jsx(Typography, { variant: 'body_small', color: 'primary', style: { letterSpacing: '-0.15px' }, copykey: 'dyn_export_shares.acknowledge', children: t('dyn_export_shares.acknowledge') }) })] }) }), jsx(NeedHelpSection, { isExport: true }), jsx("div", { className: 'embedded-reveal-view__body__button_section', children: jsx(TypographyButton, { buttonPadding: 'medium', buttonVariant: 'brand-primary', typographyProps: {
|
|
198
|
+
color: 'inherit',
|
|
199
|
+
}, onClick: handleExportShares, disabled: !isAcknowledged, loading: isLoading, dataTestId: 'export-shares-submit-button', copykey: 'dyn_export_shares.download_button', style: { width: '100%' }, className: 'embedded-reveal-view__body__button', expanded: true, children: t('dyn_export_shares.download_button') }) })] }) })] }));
|
|
200
|
+
};
|
|
201
|
+
|
|
202
|
+
export { ExportSharesView };
|
|
@@ -33,14 +33,15 @@ require('../../events/dynamicEvents.cjs');
|
|
|
33
33
|
var getUserProfile = require('../../client/extension/user/getUserProfile/getUserProfile.cjs');
|
|
34
34
|
require('../../components/Accordion/components/AccordionItem/AccordionItem.cjs');
|
|
35
35
|
require('../../components/Alert/Alert.cjs');
|
|
36
|
+
var useDynamicContext = require('../../context/DynamicContext/useDynamicContext/useDynamicContext.cjs');
|
|
36
37
|
require('../../context/DynamicContext/DynamicContext.cjs');
|
|
37
|
-
require('../../store/state/loadingAndLifecycle/loadingAndLifecycle.cjs');
|
|
38
|
-
require('../../store/state/authMode/authMode.cjs');
|
|
39
38
|
require('../../context/CaptchaContext/CaptchaContext.cjs');
|
|
40
39
|
require('../../context/ErrorContext/ErrorContext.cjs');
|
|
41
40
|
require('../../context/AccessDeniedContext/AccessDeniedContext.cjs');
|
|
42
41
|
require('../../context/AccountExistsContext/AccountExistsContext.cjs');
|
|
43
42
|
require('../../context/UserWalletsContext/UserWalletsContext.cjs');
|
|
43
|
+
require('../../store/state/authMode/authMode.cjs');
|
|
44
|
+
require('../../store/state/loadingAndLifecycle/loadingAndLifecycle.cjs');
|
|
44
45
|
require('../../context/VerificationContext/VerificationContext.cjs');
|
|
45
46
|
require('react-dom');
|
|
46
47
|
require('../../utils/functions/compareChains/compareChains.cjs');
|
|
@@ -109,6 +110,7 @@ require('../../components/Popper/PopperContext/PopperContext.cjs');
|
|
|
109
110
|
|
|
110
111
|
const MfaVerificationView = ({ type, isInitialSetup = false, showBackButton = false, createMfaToken = false, deviceId, }) => {
|
|
111
112
|
const { t } = reactI18next.useTranslation();
|
|
113
|
+
const { handleLogOut } = useDynamicContext.useDynamicContext();
|
|
112
114
|
const { clearStackAndPush, pushView, goBack, canGoBack } = ViewContext.useViewContext();
|
|
113
115
|
const { authenticateDevice } = useMfa.useMfa();
|
|
114
116
|
const [code, setCode] = React.useState('');
|
|
@@ -155,10 +157,10 @@ const MfaVerificationView = ({ type, isInitialSetup = false, showBackButton = fa
|
|
|
155
157
|
setCode(code);
|
|
156
158
|
};
|
|
157
159
|
const onClickBack = canGoBack && showBackButton ? goBack : undefined;
|
|
158
|
-
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(OTPVerificationView.OTPVerificationView, { MainIcon: passwordHero.ReactComponent, error: error, isLoading: isLoading, onPinComplete: onSubmit, isValid: Boolean(mfaToken), onPinChange: onCodeChange, description: t('dyn_mfa.otp_verification_view.body'), onClickBack: onClickBack, disabled: isRateLimited }), !isInitialSetup && (jsxRuntime.
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
160
|
+
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(OTPVerificationView.OTPVerificationView, { MainIcon: passwordHero.ReactComponent, error: error, isLoading: isLoading, onPinComplete: onSubmit, isValid: Boolean(mfaToken), onPinChange: onCodeChange, description: t('dyn_mfa.otp_verification_view.body'), onClickBack: onClickBack, disabled: isRateLimited }), !isInitialSetup && (jsxRuntime.jsxs("div", { className: 'mfa-verification-view__choose-another-method', children: [jsxRuntime.jsx(TextButton.TextButton, { className: 'mfa-verification-view__choose-another-method-button', onClick: () => pushView('mfa-choose-device', {
|
|
161
|
+
createMfaToken,
|
|
162
|
+
isInitialSetup,
|
|
163
|
+
}), copykey: 'dyn_mfa.otp_verification_view.choose_another_method', children: t('dyn_mfa.otp_verification_view.choose_another_method') }), jsxRuntime.jsx(TextButton.TextButton, { onClick: handleLogOut, copykey: 'dyn_mfa.otp_verification_view.logout', children: t('dyn_mfa.otp_verification_view.logout') })] }))] }));
|
|
162
164
|
};
|
|
163
165
|
|
|
164
166
|
exports.MfaVerificationView = MfaVerificationView;
|
|
@@ -29,14 +29,15 @@ import '../../events/dynamicEvents.js';
|
|
|
29
29
|
import { getUserProfile } from '../../client/extension/user/getUserProfile/getUserProfile.js';
|
|
30
30
|
import '../../components/Accordion/components/AccordionItem/AccordionItem.js';
|
|
31
31
|
import '../../components/Alert/Alert.js';
|
|
32
|
+
import { useDynamicContext } from '../../context/DynamicContext/useDynamicContext/useDynamicContext.js';
|
|
32
33
|
import '../../context/DynamicContext/DynamicContext.js';
|
|
33
|
-
import '../../store/state/loadingAndLifecycle/loadingAndLifecycle.js';
|
|
34
|
-
import '../../store/state/authMode/authMode.js';
|
|
35
34
|
import '../../context/CaptchaContext/CaptchaContext.js';
|
|
36
35
|
import '../../context/ErrorContext/ErrorContext.js';
|
|
37
36
|
import '../../context/AccessDeniedContext/AccessDeniedContext.js';
|
|
38
37
|
import '../../context/AccountExistsContext/AccountExistsContext.js';
|
|
39
38
|
import '../../context/UserWalletsContext/UserWalletsContext.js';
|
|
39
|
+
import '../../store/state/authMode/authMode.js';
|
|
40
|
+
import '../../store/state/loadingAndLifecycle/loadingAndLifecycle.js';
|
|
40
41
|
import '../../context/VerificationContext/VerificationContext.js';
|
|
41
42
|
import 'react-dom';
|
|
42
43
|
import '../../utils/functions/compareChains/compareChains.js';
|
|
@@ -105,6 +106,7 @@ import '../../components/Popper/PopperContext/PopperContext.js';
|
|
|
105
106
|
|
|
106
107
|
const MfaVerificationView = ({ type, isInitialSetup = false, showBackButton = false, createMfaToken = false, deviceId, }) => {
|
|
107
108
|
const { t } = useTranslation();
|
|
109
|
+
const { handleLogOut } = useDynamicContext();
|
|
108
110
|
const { clearStackAndPush, pushView, goBack, canGoBack } = useViewContext();
|
|
109
111
|
const { authenticateDevice } = useMfa();
|
|
110
112
|
const [code, setCode] = useState('');
|
|
@@ -151,10 +153,10 @@ const MfaVerificationView = ({ type, isInitialSetup = false, showBackButton = fa
|
|
|
151
153
|
setCode(code);
|
|
152
154
|
};
|
|
153
155
|
const onClickBack = canGoBack && showBackButton ? goBack : undefined;
|
|
154
|
-
return (jsxs(Fragment, { children: [jsx(OTPVerificationView, { MainIcon: SvgPasswordHero, error: error, isLoading: isLoading, onPinComplete: onSubmit, isValid: Boolean(mfaToken), onPinChange: onCodeChange, description: t('dyn_mfa.otp_verification_view.body'), onClickBack: onClickBack, disabled: isRateLimited }), !isInitialSetup && (
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
156
|
+
return (jsxs(Fragment, { children: [jsx(OTPVerificationView, { MainIcon: SvgPasswordHero, error: error, isLoading: isLoading, onPinComplete: onSubmit, isValid: Boolean(mfaToken), onPinChange: onCodeChange, description: t('dyn_mfa.otp_verification_view.body'), onClickBack: onClickBack, disabled: isRateLimited }), !isInitialSetup && (jsxs("div", { className: 'mfa-verification-view__choose-another-method', children: [jsx(TextButton, { className: 'mfa-verification-view__choose-another-method-button', onClick: () => pushView('mfa-choose-device', {
|
|
157
|
+
createMfaToken,
|
|
158
|
+
isInitialSetup,
|
|
159
|
+
}), copykey: 'dyn_mfa.otp_verification_view.choose_another_method', children: t('dyn_mfa.otp_verification_view.choose_another_method') }), jsx(TextButton, { onClick: handleLogOut, copykey: 'dyn_mfa.otp_verification_view.logout', children: t('dyn_mfa.otp_verification_view.logout') })] }))] }));
|
|
158
160
|
};
|
|
159
161
|
|
|
160
162
|
export { MfaVerificationView };
|
|
@@ -86,7 +86,7 @@ const passkeyRecoveryBundleValidation = (_c) => _tslib.__awaiter(void 0, [_c], v
|
|
|
86
86
|
}
|
|
87
87
|
const organizationId = (_g = (_f = (_e = (_d = user.verifiedCredentials) === null || _d === void 0 ? void 0 : _d.find(({ walletName, id }) => (walletName === null || walletName === void 0 ? void 0 : walletName.startsWith('turnkey')) && id === wallet.id)) === null || _e === void 0 ? void 0 : _e.walletProperties) === null || _f === void 0 ? void 0 : _f.turnkeySubOrganizationId) !== null && _g !== void 0 ? _g : undefined;
|
|
88
88
|
const turnkeyRecoveryHandler = (_h = wallet.connector) === null || _h === void 0 ? void 0 : _h.getAuthenticatorHandler();
|
|
89
|
-
yield turnkeyRecoveryHandler.verifyRecoveryCode(bundleInput, organizationId);
|
|
89
|
+
yield turnkeyRecoveryHandler.verifyRecoveryCode(bundleInput, organizationId !== null && organizationId !== void 0 ? organizationId : undefined);
|
|
90
90
|
const sessionSettings = {
|
|
91
91
|
createdAt: new Date().getTime(),
|
|
92
92
|
emailCode: bundleInput,
|
|
@@ -229,7 +229,7 @@ const restoreEmbeddedWalletSession = (_s) => _tslib.__awaiter(void 0, [_s], void
|
|
|
229
229
|
}
|
|
230
230
|
turnkeyRecoveryHandler.recoveryUserId = sessionSettings.userId;
|
|
231
231
|
const organizationId = (_x = (_w = (_v = (_u = user.verifiedCredentials) === null || _u === void 0 ? void 0 : _u.find(({ walletName, id }) => (walletName === null || walletName === void 0 ? void 0 : walletName.startsWith('turnkey')) && id === wallet.id)) === null || _v === void 0 ? void 0 : _v.walletProperties) === null || _w === void 0 ? void 0 : _w.turnkeySubOrganizationId) !== null && _x !== void 0 ? _x : undefined;
|
|
232
|
-
yield turnkeyRecoveryHandler.verifyRecoveryCode(sessionSettings.emailCode, organizationId);
|
|
232
|
+
yield turnkeyRecoveryHandler.verifyRecoveryCode(sessionSettings.emailCode, organizationId !== null && organizationId !== void 0 ? organizationId : undefined);
|
|
233
233
|
return true;
|
|
234
234
|
});
|
|
235
235
|
const addEmailRecovery = (_y) => _tslib.__awaiter(void 0, [_y], void 0, function* ({ user: user$1, environmentId, wallet, }) {
|
|
@@ -82,7 +82,7 @@ const passkeyRecoveryBundleValidation = (_c) => __awaiter(void 0, [_c], void 0,
|
|
|
82
82
|
}
|
|
83
83
|
const organizationId = (_g = (_f = (_e = (_d = user.verifiedCredentials) === null || _d === void 0 ? void 0 : _d.find(({ walletName, id }) => (walletName === null || walletName === void 0 ? void 0 : walletName.startsWith('turnkey')) && id === wallet.id)) === null || _e === void 0 ? void 0 : _e.walletProperties) === null || _f === void 0 ? void 0 : _f.turnkeySubOrganizationId) !== null && _g !== void 0 ? _g : undefined;
|
|
84
84
|
const turnkeyRecoveryHandler = (_h = wallet.connector) === null || _h === void 0 ? void 0 : _h.getAuthenticatorHandler();
|
|
85
|
-
yield turnkeyRecoveryHandler.verifyRecoveryCode(bundleInput, organizationId);
|
|
85
|
+
yield turnkeyRecoveryHandler.verifyRecoveryCode(bundleInput, organizationId !== null && organizationId !== void 0 ? organizationId : undefined);
|
|
86
86
|
const sessionSettings = {
|
|
87
87
|
createdAt: new Date().getTime(),
|
|
88
88
|
emailCode: bundleInput,
|
|
@@ -225,7 +225,7 @@ const restoreEmbeddedWalletSession = (_s) => __awaiter(void 0, [_s], void 0, fun
|
|
|
225
225
|
}
|
|
226
226
|
turnkeyRecoveryHandler.recoveryUserId = sessionSettings.userId;
|
|
227
227
|
const organizationId = (_x = (_w = (_v = (_u = user.verifiedCredentials) === null || _u === void 0 ? void 0 : _u.find(({ walletName, id }) => (walletName === null || walletName === void 0 ? void 0 : walletName.startsWith('turnkey')) && id === wallet.id)) === null || _v === void 0 ? void 0 : _v.walletProperties) === null || _w === void 0 ? void 0 : _w.turnkeySubOrganizationId) !== null && _x !== void 0 ? _x : undefined;
|
|
228
|
-
yield turnkeyRecoveryHandler.verifyRecoveryCode(sessionSettings.emailCode, organizationId);
|
|
228
|
+
yield turnkeyRecoveryHandler.verifyRecoveryCode(sessionSettings.emailCode, organizationId !== null && organizationId !== void 0 ? organizationId : undefined);
|
|
229
229
|
return true;
|
|
230
230
|
});
|
|
231
231
|
const addEmailRecovery = (_y) => __awaiter(void 0, [_y], void 0, function* ({ user, environmentId, wallet, }) {
|
|
@@ -99,6 +99,7 @@ require('../../context/IpConfigurationContext/IpConfigurationContext.cjs');
|
|
|
99
99
|
require('../../context/ConnectWithOtpContext/ConnectWithOtpContext.cjs');
|
|
100
100
|
require('../../widgets/DynamicBridgeWidget/views/WalletsView/components/SecondaryWallets/SecondaryWallets.cjs');
|
|
101
101
|
require('@hcaptcha/react-hcaptcha');
|
|
102
|
+
var EmbeddedWalletExport = require('../../components/EmbeddedWalletExport/EmbeddedWalletExport.cjs');
|
|
102
103
|
require('../ExchangeWhitelistWarning/ExchangeWhitelistWarning.cjs');
|
|
103
104
|
require('../../context/ErrorContext/hooks/useErrorText/useErrorText.cjs');
|
|
104
105
|
require('../MfaChooseDeviceView/useGetMfaOptions/useGetMfaOptions.cjs');
|
|
@@ -106,7 +107,6 @@ require('../../store/state/connectorsInitializing/connectorsInitializing.cjs');
|
|
|
106
107
|
require('../../store/state/tokenBalances.cjs');
|
|
107
108
|
require('../../store/state/multichainBalances.cjs');
|
|
108
109
|
require('../../shared/utils/functions/getInitialUrl/getInitialUrl.cjs');
|
|
109
|
-
var EmbeddedWalletExport = require('../../components/EmbeddedWalletExport/EmbeddedWalletExport.cjs');
|
|
110
110
|
require('../../components/InlineWidget/InlineWidget.cjs');
|
|
111
111
|
require('../../components/IsBrowser/IsBrowser.cjs');
|
|
112
112
|
require('../../components/Popper/Popper/Popper.cjs');
|
|
@@ -95,6 +95,7 @@ import '../../context/IpConfigurationContext/IpConfigurationContext.js';
|
|
|
95
95
|
import '../../context/ConnectWithOtpContext/ConnectWithOtpContext.js';
|
|
96
96
|
import '../../widgets/DynamicBridgeWidget/views/WalletsView/components/SecondaryWallets/SecondaryWallets.js';
|
|
97
97
|
import '@hcaptcha/react-hcaptcha';
|
|
98
|
+
import { EmbeddedWalletExport } from '../../components/EmbeddedWalletExport/EmbeddedWalletExport.js';
|
|
98
99
|
import '../ExchangeWhitelistWarning/ExchangeWhitelistWarning.js';
|
|
99
100
|
import '../../context/ErrorContext/hooks/useErrorText/useErrorText.js';
|
|
100
101
|
import '../MfaChooseDeviceView/useGetMfaOptions/useGetMfaOptions.js';
|
|
@@ -102,7 +103,6 @@ import '../../store/state/connectorsInitializing/connectorsInitializing.js';
|
|
|
102
103
|
import '../../store/state/tokenBalances.js';
|
|
103
104
|
import '../../store/state/multichainBalances.js';
|
|
104
105
|
import '../../shared/utils/functions/getInitialUrl/getInitialUrl.js';
|
|
105
|
-
import { EmbeddedWalletExport } from '../../components/EmbeddedWalletExport/EmbeddedWalletExport.js';
|
|
106
106
|
import '../../components/InlineWidget/InlineWidget.js';
|
|
107
107
|
import '../../components/IsBrowser/IsBrowser.js';
|
|
108
108
|
import '../../components/Popper/Popper/Popper.js';
|