@dynamic-labs/sdk-react-core 4.47.3 → 4.48.1
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 +22 -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/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/utils/hooks/useWalletItemActions/useHandleWalletItem/useHandleWalletItem.cjs +3 -2
- package/src/lib/utils/hooks/useWalletItemActions/useHandleWalletItem/useHandleWalletItem.js +4 -3
- 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,179 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
import { __awaiter } from '../../../../../../_virtual/_tslib.js';
|
|
3
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
4
|
+
import { useMemo, useCallback } from 'react';
|
|
5
|
+
import { useTranslation } from 'react-i18next';
|
|
6
|
+
import { isSessionKeyCompatibleWallet } from '@dynamic-labs/wallet-connector-core';
|
|
7
|
+
import '@dynamic-labs-sdk/client/core';
|
|
8
|
+
import '@dynamic-labs/sdk-api-core';
|
|
9
|
+
import '../../../../client/client.js';
|
|
10
|
+
import '@dynamic-labs-sdk/client';
|
|
11
|
+
import '../../../../config/ApiEndpoint.js';
|
|
12
|
+
import '@dynamic-labs/iconic';
|
|
13
|
+
import { ReactComponent as SvgChevronLeft } from '../../../../shared/assets/chevron-left.js';
|
|
14
|
+
import { ReactComponent as SvgExportPrivateKey } from '../../../../shared/assets/export-private-key.js';
|
|
15
|
+
import { ReactComponent as SvgExportRecoveryPhrase } from '../../../../shared/assets/export-recovery-phrase.js';
|
|
16
|
+
import { useViewContext } from '../../../../context/ViewContext/ViewContext.js';
|
|
17
|
+
import '../../../../shared/logger.js';
|
|
18
|
+
import '@dynamic-labs/wallet-book';
|
|
19
|
+
import '@dynamic-labs/utils';
|
|
20
|
+
import '../../../../utils/constants/colors.js';
|
|
21
|
+
import '../../../../utils/constants/values.js';
|
|
22
|
+
import '../../../../shared/consts/index.js';
|
|
23
|
+
import '@dynamic-labs/multi-wallet';
|
|
24
|
+
import 'react-international-phone';
|
|
25
|
+
import '../../../../store/state/nonce/nonce.js';
|
|
26
|
+
import '@dynamic-labs/locale';
|
|
27
|
+
import '../../../../store/state/dynamicContextProps/dynamicContextProps.js';
|
|
28
|
+
import '../../../../store/state/primaryWalletId/primaryWalletId.js';
|
|
29
|
+
import '../../../../store/state/connectedWalletsInfo/connectedWalletsInfo.js';
|
|
30
|
+
import '../../../../events/dynamicEvents.js';
|
|
31
|
+
import { useUser } from '../../../../client/extension/user/useUser/useUser.js';
|
|
32
|
+
import { IconButton } from '../../../../components/IconButton/IconButton.js';
|
|
33
|
+
import { ModalHeader } from '../../../../components/ModalHeader/ModalHeader.js';
|
|
34
|
+
import { Typography } from '../../../../components/Typography/Typography.js';
|
|
35
|
+
import { TypographyButton } from '../../../../components/TypographyButton/TypographyButton.js';
|
|
36
|
+
import '../../../../context/DynamicContext/DynamicContext.js';
|
|
37
|
+
import '../../../../store/state/loadingAndLifecycle/loadingAndLifecycle.js';
|
|
38
|
+
import '../../../../context/CaptchaContext/CaptchaContext.js';
|
|
39
|
+
import '../../../../context/ErrorContext/ErrorContext.js';
|
|
40
|
+
import '../../../../context/AccessDeniedContext/AccessDeniedContext.js';
|
|
41
|
+
import '../../../../context/AccountExistsContext/AccountExistsContext.js';
|
|
42
|
+
import '../../../../context/UserWalletsContext/UserWalletsContext.js';
|
|
43
|
+
import '../../../../store/state/authMode/authMode.js';
|
|
44
|
+
import '../../../../context/VerificationContext/VerificationContext.js';
|
|
45
|
+
import 'react-dom';
|
|
46
|
+
import '../../../../utils/functions/compareChains/compareChains.js';
|
|
47
|
+
import '../../../../views/Passkey/utils/findPrimaryEmbeddedChain/findPrimaryEmbeddedChain.js';
|
|
48
|
+
import { useThemeContext } from '../../../../context/ThemeContext/ThemeContext.js';
|
|
49
|
+
import { useSmartWallets } from '../../../../utils/hooks/useSmartWallets/useSmartWallets.js';
|
|
50
|
+
import '../../../../utils/hooks/useUserUpdateRequest/useUpdateUser/userFieldsSchema.js';
|
|
51
|
+
import { usePasskeyRecovery } from '../../../../utils/hooks/usePasskeyRecovery/usePasskeyRecovery.js';
|
|
52
|
+
import 'bs58';
|
|
53
|
+
import '@dynamic-labs/types';
|
|
54
|
+
import '../../../../context/SocialRedirectContext/SocialRedirectContext.js';
|
|
55
|
+
import '../../../../context/LoadingContext/LoadingContext.js';
|
|
56
|
+
import '../../../../context/WalletContext/WalletContext.js';
|
|
57
|
+
import '../../../../utils/hooks/useEmbeddedWallet/useSecureEnclaveEmbeddedWallet/constants.js';
|
|
58
|
+
import 'yup';
|
|
59
|
+
import '../../../../context/MockContext/MockContext.js';
|
|
60
|
+
import '../../../../views/CollectUserDataView/useFields.js';
|
|
61
|
+
import '../../../../context/FieldsStateContext/FieldsStateContext.js';
|
|
62
|
+
import '../../../../context/UserFieldEditorContext/UserFieldEditorContext.js';
|
|
63
|
+
import '@dynamic-labs/rpc-providers';
|
|
64
|
+
import '../../../../store/state/walletOptions/walletOptions.js';
|
|
65
|
+
import '../../../../components/Accordion/components/AccordionItem/AccordionItem.js';
|
|
66
|
+
import '../../../../components/Alert/Alert.js';
|
|
67
|
+
import '../../../../components/ShadowDOM/ShadowDOM.js';
|
|
68
|
+
import '../../../../components/InlineWidget/InlineWidget.js';
|
|
69
|
+
import '../../../../components/Input/Input.js';
|
|
70
|
+
import '../../../../components/IsBrowser/IsBrowser.js';
|
|
71
|
+
import '../../../../components/MenuList/Dropdown/Dropdown.js';
|
|
72
|
+
import '../../../../components/OverlayCard/OverlayCard.js';
|
|
73
|
+
import '../../../../components/Transition/ZoomTransition/ZoomTransition.js';
|
|
74
|
+
import '../../../../components/Transition/SlideInUpTransition/SlideInUpTransition.js';
|
|
75
|
+
import '../../../../components/Transition/OpacityTransition/OpacityTransition.js';
|
|
76
|
+
import '../../../../components/PasskeyCreatedSuccessBanner/PasskeyCreatedSuccessBanner.js';
|
|
77
|
+
import '../../../../components/Popper/Popper/Popper.js';
|
|
78
|
+
import '../../../../components/Popper/PopperContext/PopperContext.js';
|
|
79
|
+
import 'react-focus-lock';
|
|
80
|
+
import 'qrcode';
|
|
81
|
+
import 'formik';
|
|
82
|
+
import '../../../../utils/hooks/useSubdomainCheck/useSubdomainCheck.js';
|
|
83
|
+
import '../../../../context/WalletGroupContext/WalletGroupContext.js';
|
|
84
|
+
import '../../../../context/IpConfigurationContext/IpConfigurationContext.js';
|
|
85
|
+
import '../../../../context/ConnectWithOtpContext/ConnectWithOtpContext.js';
|
|
86
|
+
import '../../../DynamicBridgeWidget/views/WalletsView/components/SecondaryWallets/SecondaryWallets.js';
|
|
87
|
+
import '@hcaptcha/react-hcaptcha';
|
|
88
|
+
import { useWidgetContext } from '../../context/DynamicWidgetContext.js';
|
|
89
|
+
import '../../helpers/convertExchangeKeyAndProviderEnum.js';
|
|
90
|
+
import '../../../../views/ExchangeWhitelistWarning/ExchangeWhitelistWarning.js';
|
|
91
|
+
import '../../../../context/ErrorContext/hooks/useErrorText/useErrorText.js';
|
|
92
|
+
import '../../../../context/FooterAnimationContext/index.js';
|
|
93
|
+
import '../../../../views/MfaChooseDeviceView/useGetMfaOptions/useGetMfaOptions.js';
|
|
94
|
+
import '../../../../context/PasskeyContext/PasskeyContext.js';
|
|
95
|
+
import '../../../../context/OnrampContext/OnrampContext.js';
|
|
96
|
+
import '../../../../store/state/sendBalances.js';
|
|
97
|
+
import '../../../../store/state/connectorsInitializing/connectorsInitializing.js';
|
|
98
|
+
import '../../../../components/OverlayCardBase/OverlayCardTarget/OverlayCardTarget.js';
|
|
99
|
+
import '../../components/DynamicWidgetHeader/DynamicWidgetHeader.js';
|
|
100
|
+
import '../../../../views/TransactionConfirmationView/TransactionConfirmationView.js';
|
|
101
|
+
import '../../components/PasskeyCard/PasskeyCard.js';
|
|
102
|
+
import { useEmbeddedReveal } from '../../../../utils/hooks/useEmbeddedReveal/useEmbeddedReveal.js';
|
|
103
|
+
import '../CryptoComOnramp/CryptoComOnramp.js';
|
|
104
|
+
import '../../../../../index.js';
|
|
105
|
+
import '../ReceiveWalletFunds/ReceiveWalletFunds.js';
|
|
106
|
+
import '../../../../store/state/tokenBalances.js';
|
|
107
|
+
import '../../../../store/state/multichainBalances.js';
|
|
108
|
+
import '../../../../shared/utils/functions/getInitialUrl/getInitialUrl.js';
|
|
109
|
+
import { useInternalDynamicContext } from '../../../../context/DynamicContext/useDynamicContext/useInternalDynamicContext/useInternalDynamicContext.js';
|
|
110
|
+
|
|
111
|
+
const ExportAndRecoveryView = () => {
|
|
112
|
+
var _a, _b;
|
|
113
|
+
const { t } = useTranslation();
|
|
114
|
+
const { theme } = useThemeContext();
|
|
115
|
+
const { setDynamicWidgetView } = useWidgetContext();
|
|
116
|
+
const { primaryWallet, setShowAuthFlow } = useInternalDynamicContext();
|
|
117
|
+
const { pushView } = useViewContext();
|
|
118
|
+
const user = useUser();
|
|
119
|
+
const { getEOAWallet } = useSmartWallets();
|
|
120
|
+
const { initPasskeyRecoveryProcess, shouldInitRecovery } = usePasskeyRecovery();
|
|
121
|
+
const { initExportProcess } = useEmbeddedReveal();
|
|
122
|
+
const eoaWallet = primaryWallet && getEOAWallet(primaryWallet);
|
|
123
|
+
const wallet = eoaWallet !== null && eoaWallet !== void 0 ? eoaWallet : primaryWallet;
|
|
124
|
+
const isSessionKeyCompatible = (primaryWallet && isSessionKeyCompatibleWallet(primaryWallet)) ||
|
|
125
|
+
(eoaWallet && isSessionKeyCompatibleWallet(eoaWallet));
|
|
126
|
+
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')));
|
|
127
|
+
const walletCredential = useMemo(() => {
|
|
128
|
+
var _a;
|
|
129
|
+
if (!user || !primaryWallet)
|
|
130
|
+
return undefined;
|
|
131
|
+
return (_a = user.verifiedCredentials) === null || _a === void 0 ? void 0 : _a.find((cred) => cred.walletName === 'dynamicwaas' &&
|
|
132
|
+
cred.address === primaryWallet.address);
|
|
133
|
+
}, [user, primaryWallet]);
|
|
134
|
+
const isPasswordEncrypted = useMemo(() => {
|
|
135
|
+
var _a;
|
|
136
|
+
const keyShares = (_a = walletCredential === null || walletCredential === void 0 ? void 0 : walletCredential.walletProperties) === null || _a === void 0 ? void 0 : _a.keyShares;
|
|
137
|
+
if (!keyShares || !Array.isArray(keyShares))
|
|
138
|
+
return false;
|
|
139
|
+
return keyShares.some((keyShare) => keyShare &&
|
|
140
|
+
typeof keyShare === 'object' &&
|
|
141
|
+
'passwordEncrypted' in keyShare &&
|
|
142
|
+
keyShare.passwordEncrypted === true);
|
|
143
|
+
}, [walletCredential]);
|
|
144
|
+
const handleBackClick = useCallback(() => setDynamicWidgetView('account-and-security-settings'), [setDynamicWidgetView]);
|
|
145
|
+
const handlePrivateKeyClick = useCallback(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
146
|
+
if (!isSessionKeyCompatible) {
|
|
147
|
+
if (yield shouldInitRecovery()) {
|
|
148
|
+
yield initPasskeyRecoveryProcess(undefined, {
|
|
149
|
+
type: 'reveal',
|
|
150
|
+
});
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
return initExportProcess();
|
|
154
|
+
}), [
|
|
155
|
+
isSessionKeyCompatible,
|
|
156
|
+
shouldInitRecovery,
|
|
157
|
+
initPasskeyRecoveryProcess,
|
|
158
|
+
initExportProcess,
|
|
159
|
+
]);
|
|
160
|
+
const handleExportSharesClick = useCallback(() => {
|
|
161
|
+
setShowAuthFlow(true, {
|
|
162
|
+
ignoreIfIsEmbeddedWidget: false,
|
|
163
|
+
performMultiWalletChecks: false,
|
|
164
|
+
});
|
|
165
|
+
if (isPasswordEncrypted) {
|
|
166
|
+
setDynamicWidgetView('export-shares-passcode');
|
|
167
|
+
}
|
|
168
|
+
else {
|
|
169
|
+
pushView('export-shares-view');
|
|
170
|
+
}
|
|
171
|
+
}, [isPasswordEncrypted, setDynamicWidgetView, setShowAuthFlow, pushView]);
|
|
172
|
+
const exportIconClasses = useMemo(() => `settings-view__body__section__button__icon${theme.theme.name === 'dark' ? '__stroke' : ''}`, [theme.theme.name]);
|
|
173
|
+
const privateKeyButtonStartSlot = useMemo(() => (jsxs("div", { className: 'settings-view__body__section__button__start-slot', children: [jsx(SvgExportPrivateKey, { className: exportIconClasses }), jsx(Typography, { color: 'primary', weight: 'medium', copykey: 'dyn_export_and_recovery.private_key', children: t('dyn_export_and_recovery.private_key') })] })), [exportIconClasses, t]);
|
|
174
|
+
const exportSharesButtonStartSlot = useMemo(() => (jsxs("div", { className: 'settings-view__body__section__button__start-slot', children: [jsx(SvgExportRecoveryPhrase, { className: exportIconClasses }), jsxs("div", { className: 'export-and-recovery-view__export-shares-label', children: [jsx(Typography, { color: 'primary', weight: 'medium', copykey: 'dyn_export_and_recovery.export_shares', children: t('dyn_export_and_recovery.export_shares') }), jsx("span", { className: 'export-and-recovery-view__advanced-badge', children: jsx(Typography, { variant: 'body_small', color: 'inherit', weight: 'medium', copykey: 'dyn_export_and_recovery.advanced', children: t('dyn_export_and_recovery.advanced') }) })] })] })), [exportIconClasses, t]);
|
|
175
|
+
const backButton = (jsx(IconButton, { type: 'button', onClick: handleBackClick, "data-testid": 'back-button', children: jsx(SvgChevronLeft, {}) }));
|
|
176
|
+
return (jsxs("div", { className: 'export-and-recovery-view', children: [jsx(ModalHeader, { leading: backButton, children: jsx("div", { className: 'send-balance-page-layout__header-content', children: jsx(Typography, { variant: 'title', color: 'primary', copykey: 'dyn_export_and_recovery.title', children: t('dyn_export_and_recovery.title') }) }) }), jsx("div", { className: 'account-wrap', children: jsxs("div", { className: 'settings-view__body', children: [jsx(TypographyButton, { dataTestId: 'private-key-button', onClick: handlePrivateKeyClick, buttonClassName: 'settings-view__body__section__button', startSlot: privateKeyButtonStartSlot, endSlot: jsx(SvgChevronLeft, { className: 'settings-view__body__section__button__icon-secondary--rotate' }), showInternalLoading: false }), isV3WaasWallet && (jsx(TypographyButton, { dataTestId: 'export-shares-button', onClick: handleExportSharesClick, buttonClassName: 'settings-view__body__section__button', startSlot: exportSharesButtonStartSlot, endSlot: jsx(SvgChevronLeft, { className: 'settings-view__body__section__button__icon-secondary--rotate' }), showInternalLoading: false }))] }) })] }));
|
|
177
|
+
};
|
|
178
|
+
|
|
179
|
+
export { ExportAndRecoveryView };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { ExportAndRecoveryView } from './ExportAndRecoveryView';
|
package/src/lib/widgets/DynamicWidget/views/ExportSharesPasscodeView/ExportSharesPasscodeView.cjs
ADDED
|
@@ -0,0 +1,146 @@
|
|
|
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 ErrorContainer = require('../../../../components/ErrorContainer/ErrorContainer.cjs');
|
|
11
|
+
var IconButton = require('../../../../components/IconButton/IconButton.cjs');
|
|
12
|
+
var ModalHeader = require('../../../../components/ModalHeader/ModalHeader.cjs');
|
|
13
|
+
var PinField = require('../../../../components/PinField/PinField.cjs');
|
|
14
|
+
var Typography = require('../../../../components/Typography/Typography.cjs');
|
|
15
|
+
require('../../../../context/DynamicContext/DynamicContext.cjs');
|
|
16
|
+
require('../../../../store/state/loadingAndLifecycle/loadingAndLifecycle.cjs');
|
|
17
|
+
require('@dynamic-labs/iconic');
|
|
18
|
+
require('@dynamic-labs/wallet-connector-core');
|
|
19
|
+
var close = require('../../../../shared/assets/close.cjs');
|
|
20
|
+
var ViewContext = require('../../../../context/ViewContext/ViewContext.cjs');
|
|
21
|
+
require('../../../../shared/logger.cjs');
|
|
22
|
+
require('@dynamic-labs/wallet-book');
|
|
23
|
+
require('@dynamic-labs/utils');
|
|
24
|
+
require('../../../../utils/constants/colors.cjs');
|
|
25
|
+
require('../../../../utils/constants/values.cjs');
|
|
26
|
+
require('@dynamic-labs/sdk-api-core');
|
|
27
|
+
require('../../../../shared/consts/index.cjs');
|
|
28
|
+
require('../../../../events/dynamicEvents.cjs');
|
|
29
|
+
require('../../../../context/CaptchaContext/CaptchaContext.cjs');
|
|
30
|
+
require('../../../../context/ErrorContext/ErrorContext.cjs');
|
|
31
|
+
require('@dynamic-labs/multi-wallet');
|
|
32
|
+
require('react-international-phone');
|
|
33
|
+
require('../../../../store/state/nonce/nonce.cjs');
|
|
34
|
+
require('@dynamic-labs-sdk/client/core');
|
|
35
|
+
require('../../../../client/client.cjs');
|
|
36
|
+
require('@dynamic-labs-sdk/client');
|
|
37
|
+
require('../../../../config/ApiEndpoint.cjs');
|
|
38
|
+
require('@dynamic-labs/locale');
|
|
39
|
+
require('../../../../store/state/dynamicContextProps/dynamicContextProps.cjs');
|
|
40
|
+
require('../../../../store/state/primaryWalletId/primaryWalletId.cjs');
|
|
41
|
+
require('../../../../store/state/connectedWalletsInfo/connectedWalletsInfo.cjs');
|
|
42
|
+
require('../../../../context/AccessDeniedContext/AccessDeniedContext.cjs');
|
|
43
|
+
require('../../../../context/AccountExistsContext/AccountExistsContext.cjs');
|
|
44
|
+
require('../../../../context/UserWalletsContext/UserWalletsContext.cjs');
|
|
45
|
+
require('../../../../store/state/authMode/authMode.cjs');
|
|
46
|
+
require('../../../../context/VerificationContext/VerificationContext.cjs');
|
|
47
|
+
require('react-dom');
|
|
48
|
+
require('../../../../utils/functions/compareChains/compareChains.cjs');
|
|
49
|
+
require('../../../../views/Passkey/utils/findPrimaryEmbeddedChain/findPrimaryEmbeddedChain.cjs');
|
|
50
|
+
require('../../../../context/ThemeContext/ThemeContext.cjs');
|
|
51
|
+
require('../../../../utils/hooks/useUserUpdateRequest/useUpdateUser/userFieldsSchema.cjs');
|
|
52
|
+
require('bs58');
|
|
53
|
+
require('@dynamic-labs/types');
|
|
54
|
+
require('../../../../context/SocialRedirectContext/SocialRedirectContext.cjs');
|
|
55
|
+
require('../../../../context/LoadingContext/LoadingContext.cjs');
|
|
56
|
+
require('../../../../context/WalletContext/WalletContext.cjs');
|
|
57
|
+
require('../../../../utils/hooks/useEmbeddedWallet/useSecureEnclaveEmbeddedWallet/constants.cjs');
|
|
58
|
+
require('yup');
|
|
59
|
+
require('../../../../context/MockContext/MockContext.cjs');
|
|
60
|
+
require('../../../../views/CollectUserDataView/useFields.cjs');
|
|
61
|
+
require('../../../../context/FieldsStateContext/FieldsStateContext.cjs');
|
|
62
|
+
require('../../../../context/UserFieldEditorContext/UserFieldEditorContext.cjs');
|
|
63
|
+
require('@dynamic-labs/rpc-providers');
|
|
64
|
+
require('../../../../store/state/walletOptions/walletOptions.cjs');
|
|
65
|
+
require('../../../../components/Accordion/components/AccordionItem/AccordionItem.cjs');
|
|
66
|
+
require('../../../../components/Alert/Alert.cjs');
|
|
67
|
+
require('../../../../components/ShadowDOM/ShadowDOM.cjs');
|
|
68
|
+
require('../../../../components/InlineWidget/InlineWidget.cjs');
|
|
69
|
+
require('../../../../components/Input/Input.cjs');
|
|
70
|
+
require('../../../../components/IsBrowser/IsBrowser.cjs');
|
|
71
|
+
require('../../../../components/MenuList/Dropdown/Dropdown.cjs');
|
|
72
|
+
require('../../../../components/OverlayCard/OverlayCard.cjs');
|
|
73
|
+
require('../../../../components/Transition/ZoomTransition/ZoomTransition.cjs');
|
|
74
|
+
require('../../../../components/Transition/SlideInUpTransition/SlideInUpTransition.cjs');
|
|
75
|
+
require('../../../../components/Transition/OpacityTransition/OpacityTransition.cjs');
|
|
76
|
+
require('../../../../components/PasskeyCreatedSuccessBanner/PasskeyCreatedSuccessBanner.cjs');
|
|
77
|
+
require('../../../../components/Popper/Popper/Popper.cjs');
|
|
78
|
+
require('../../../../components/Popper/PopperContext/PopperContext.cjs');
|
|
79
|
+
require('react-focus-lock');
|
|
80
|
+
require('qrcode');
|
|
81
|
+
require('formik');
|
|
82
|
+
require('../../../../utils/hooks/useSubdomainCheck/useSubdomainCheck.cjs');
|
|
83
|
+
require('../../../../context/WalletGroupContext/WalletGroupContext.cjs');
|
|
84
|
+
require('../../../../context/IpConfigurationContext/IpConfigurationContext.cjs');
|
|
85
|
+
require('../../../../context/ConnectWithOtpContext/ConnectWithOtpContext.cjs');
|
|
86
|
+
require('../../../DynamicBridgeWidget/views/WalletsView/components/SecondaryWallets/SecondaryWallets.cjs');
|
|
87
|
+
require('@hcaptcha/react-hcaptcha');
|
|
88
|
+
var DynamicWidgetContext = require('../../context/DynamicWidgetContext.cjs');
|
|
89
|
+
require('../../helpers/convertExchangeKeyAndProviderEnum.cjs');
|
|
90
|
+
require('../../../../views/ExchangeWhitelistWarning/ExchangeWhitelistWarning.cjs');
|
|
91
|
+
require('../../../../context/ErrorContext/hooks/useErrorText/useErrorText.cjs');
|
|
92
|
+
require('../../../../context/FooterAnimationContext/index.cjs');
|
|
93
|
+
require('../../../../views/MfaChooseDeviceView/useGetMfaOptions/useGetMfaOptions.cjs');
|
|
94
|
+
require('../../../../context/PasskeyContext/PasskeyContext.cjs');
|
|
95
|
+
require('../../../../context/OnrampContext/OnrampContext.cjs');
|
|
96
|
+
require('../../../../store/state/sendBalances.cjs');
|
|
97
|
+
require('../../../../store/state/connectorsInitializing/connectorsInitializing.cjs');
|
|
98
|
+
require('../../../../components/OverlayCardBase/OverlayCardTarget/OverlayCardTarget.cjs');
|
|
99
|
+
require('../../components/DynamicWidgetHeader/DynamicWidgetHeader.cjs');
|
|
100
|
+
require('../../../../views/TransactionConfirmationView/TransactionConfirmationView.cjs');
|
|
101
|
+
require('../../components/PasskeyCard/PasskeyCard.cjs');
|
|
102
|
+
require('../CryptoComOnramp/CryptoComOnramp.cjs');
|
|
103
|
+
require('../../../../../index.cjs');
|
|
104
|
+
require('../ReceiveWalletFunds/ReceiveWalletFunds.cjs');
|
|
105
|
+
require('../../../../store/state/tokenBalances.cjs');
|
|
106
|
+
require('../../../../store/state/multichainBalances.cjs');
|
|
107
|
+
require('../../../../shared/utils/functions/getInitialUrl/getInitialUrl.cjs');
|
|
108
|
+
var useInternalDynamicContext = require('../../../../context/DynamicContext/useDynamicContext/useInternalDynamicContext/useInternalDynamicContext.cjs');
|
|
109
|
+
|
|
110
|
+
const PIN_LENGTH = 6;
|
|
111
|
+
const ExportSharesPasscodeView = () => {
|
|
112
|
+
const { t } = reactI18next.useTranslation();
|
|
113
|
+
const { setDynamicWidgetView } = DynamicWidgetContext.useWidgetContext();
|
|
114
|
+
const { setShowAuthFlow } = useInternalDynamicContext.useInternalDynamicContext();
|
|
115
|
+
const { pushView } = ViewContext.useViewContext();
|
|
116
|
+
const [error, setError] = React.useState(null);
|
|
117
|
+
const [isLoading, setIsLoading] = React.useState(false);
|
|
118
|
+
const [isValidated, setIsValidated] = React.useState(false);
|
|
119
|
+
const handleCloseClick = React.useCallback(() => setDynamicWidgetView('account-and-security-settings'), [setDynamicWidgetView]);
|
|
120
|
+
const handlePinComplete = React.useCallback((passcode) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
121
|
+
setError(null);
|
|
122
|
+
setIsLoading(true);
|
|
123
|
+
try {
|
|
124
|
+
setIsValidated(true);
|
|
125
|
+
setShowAuthFlow(true, {
|
|
126
|
+
ignoreIfIsEmbeddedWidget: false,
|
|
127
|
+
performMultiWalletChecks: false,
|
|
128
|
+
});
|
|
129
|
+
pushView('export-shares-view', { passcode });
|
|
130
|
+
}
|
|
131
|
+
catch (_a) {
|
|
132
|
+
setError(t('dyn_export_shares_passcode.error'));
|
|
133
|
+
setIsValidated(false);
|
|
134
|
+
}
|
|
135
|
+
finally {
|
|
136
|
+
setIsLoading(false);
|
|
137
|
+
}
|
|
138
|
+
}), [pushView, setShowAuthFlow, t]);
|
|
139
|
+
const handlePinChange = React.useCallback(() => {
|
|
140
|
+
setError(null);
|
|
141
|
+
}, []);
|
|
142
|
+
const closeButton = (jsxRuntime.jsx(IconButton.IconButton, { type: 'button', onClick: handleCloseClick, "data-testid": 'close-button', children: jsxRuntime.jsx(close.ReactComponent, {}) }));
|
|
143
|
+
return (jsxRuntime.jsxs("div", { className: 'export-shares-passcode-view', children: [jsxRuntime.jsx(ModalHeader.ModalHeader, { trailing: closeButton, children: jsxRuntime.jsx("div", { className: 'send-balance-page-layout__header-content', children: jsxRuntime.jsx(Typography.Typography, { variant: 'title', color: 'primary', copykey: 'dyn_export_shares_passcode.title', children: t('dyn_export_shares_passcode.title') }) }) }), jsxRuntime.jsx("div", { className: 'account-wrap', children: jsxRuntime.jsxs("div", { className: 'export-shares-passcode-view__content', children: [error && (jsxRuntime.jsx(ErrorContainer.ErrorContainer, { variant: 'error', withIcon: false, children: error })), jsxRuntime.jsx("div", { className: 'export-shares-passcode-view__description', children: jsxRuntime.jsx(Typography.Typography, { variant: 'body_normal', color: 'secondary', copykey: 'dyn_export_shares_passcode.description', children: t('dyn_export_shares_passcode.description') }) }), jsxRuntime.jsx("div", { className: 'export-shares-passcode-view__label', children: jsxRuntime.jsx(Typography.Typography, { variant: 'body_small', color: 'secondary', copykey: 'dyn_export_shares_passcode.enter_passcode', children: t('dyn_export_shares_passcode.enter_passcode') }) }), jsxRuntime.jsx("div", { className: 'export-shares-passcode-view__pin-container', children: jsxRuntime.jsx(PinField.PinField, { initialValue: Array(PIN_LENGTH).fill(''), isLoading: isLoading, handleComplete: handlePinComplete, isValidated: isValidated, inputMode: 'numeric', pattern: '[0-9]*', hasError: Boolean(error), onChange: handlePinChange }) })] }) })] }));
|
|
144
|
+
};
|
|
145
|
+
|
|
146
|
+
exports.ExportSharesPasscodeView = ExportSharesPasscodeView;
|
package/src/lib/widgets/DynamicWidget/views/ExportSharesPasscodeView/ExportSharesPasscodeView.js
ADDED
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
import { __awaiter } from '../../../../../../_virtual/_tslib.js';
|
|
3
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
4
|
+
import { useState, useCallback } from 'react';
|
|
5
|
+
import { useTranslation } from 'react-i18next';
|
|
6
|
+
import { ErrorContainer } from '../../../../components/ErrorContainer/ErrorContainer.js';
|
|
7
|
+
import { IconButton } from '../../../../components/IconButton/IconButton.js';
|
|
8
|
+
import { ModalHeader } from '../../../../components/ModalHeader/ModalHeader.js';
|
|
9
|
+
import { PinField } from '../../../../components/PinField/PinField.js';
|
|
10
|
+
import { Typography } from '../../../../components/Typography/Typography.js';
|
|
11
|
+
import '../../../../context/DynamicContext/DynamicContext.js';
|
|
12
|
+
import '../../../../store/state/loadingAndLifecycle/loadingAndLifecycle.js';
|
|
13
|
+
import '@dynamic-labs/iconic';
|
|
14
|
+
import '@dynamic-labs/wallet-connector-core';
|
|
15
|
+
import { ReactComponent as SvgClose } from '../../../../shared/assets/close.js';
|
|
16
|
+
import { useViewContext } from '../../../../context/ViewContext/ViewContext.js';
|
|
17
|
+
import '../../../../shared/logger.js';
|
|
18
|
+
import '@dynamic-labs/wallet-book';
|
|
19
|
+
import '@dynamic-labs/utils';
|
|
20
|
+
import '../../../../utils/constants/colors.js';
|
|
21
|
+
import '../../../../utils/constants/values.js';
|
|
22
|
+
import '@dynamic-labs/sdk-api-core';
|
|
23
|
+
import '../../../../shared/consts/index.js';
|
|
24
|
+
import '../../../../events/dynamicEvents.js';
|
|
25
|
+
import '../../../../context/CaptchaContext/CaptchaContext.js';
|
|
26
|
+
import '../../../../context/ErrorContext/ErrorContext.js';
|
|
27
|
+
import '@dynamic-labs/multi-wallet';
|
|
28
|
+
import 'react-international-phone';
|
|
29
|
+
import '../../../../store/state/nonce/nonce.js';
|
|
30
|
+
import '@dynamic-labs-sdk/client/core';
|
|
31
|
+
import '../../../../client/client.js';
|
|
32
|
+
import '@dynamic-labs-sdk/client';
|
|
33
|
+
import '../../../../config/ApiEndpoint.js';
|
|
34
|
+
import '@dynamic-labs/locale';
|
|
35
|
+
import '../../../../store/state/dynamicContextProps/dynamicContextProps.js';
|
|
36
|
+
import '../../../../store/state/primaryWalletId/primaryWalletId.js';
|
|
37
|
+
import '../../../../store/state/connectedWalletsInfo/connectedWalletsInfo.js';
|
|
38
|
+
import '../../../../context/AccessDeniedContext/AccessDeniedContext.js';
|
|
39
|
+
import '../../../../context/AccountExistsContext/AccountExistsContext.js';
|
|
40
|
+
import '../../../../context/UserWalletsContext/UserWalletsContext.js';
|
|
41
|
+
import '../../../../store/state/authMode/authMode.js';
|
|
42
|
+
import '../../../../context/VerificationContext/VerificationContext.js';
|
|
43
|
+
import 'react-dom';
|
|
44
|
+
import '../../../../utils/functions/compareChains/compareChains.js';
|
|
45
|
+
import '../../../../views/Passkey/utils/findPrimaryEmbeddedChain/findPrimaryEmbeddedChain.js';
|
|
46
|
+
import '../../../../context/ThemeContext/ThemeContext.js';
|
|
47
|
+
import '../../../../utils/hooks/useUserUpdateRequest/useUpdateUser/userFieldsSchema.js';
|
|
48
|
+
import 'bs58';
|
|
49
|
+
import '@dynamic-labs/types';
|
|
50
|
+
import '../../../../context/SocialRedirectContext/SocialRedirectContext.js';
|
|
51
|
+
import '../../../../context/LoadingContext/LoadingContext.js';
|
|
52
|
+
import '../../../../context/WalletContext/WalletContext.js';
|
|
53
|
+
import '../../../../utils/hooks/useEmbeddedWallet/useSecureEnclaveEmbeddedWallet/constants.js';
|
|
54
|
+
import 'yup';
|
|
55
|
+
import '../../../../context/MockContext/MockContext.js';
|
|
56
|
+
import '../../../../views/CollectUserDataView/useFields.js';
|
|
57
|
+
import '../../../../context/FieldsStateContext/FieldsStateContext.js';
|
|
58
|
+
import '../../../../context/UserFieldEditorContext/UserFieldEditorContext.js';
|
|
59
|
+
import '@dynamic-labs/rpc-providers';
|
|
60
|
+
import '../../../../store/state/walletOptions/walletOptions.js';
|
|
61
|
+
import '../../../../components/Accordion/components/AccordionItem/AccordionItem.js';
|
|
62
|
+
import '../../../../components/Alert/Alert.js';
|
|
63
|
+
import '../../../../components/ShadowDOM/ShadowDOM.js';
|
|
64
|
+
import '../../../../components/InlineWidget/InlineWidget.js';
|
|
65
|
+
import '../../../../components/Input/Input.js';
|
|
66
|
+
import '../../../../components/IsBrowser/IsBrowser.js';
|
|
67
|
+
import '../../../../components/MenuList/Dropdown/Dropdown.js';
|
|
68
|
+
import '../../../../components/OverlayCard/OverlayCard.js';
|
|
69
|
+
import '../../../../components/Transition/ZoomTransition/ZoomTransition.js';
|
|
70
|
+
import '../../../../components/Transition/SlideInUpTransition/SlideInUpTransition.js';
|
|
71
|
+
import '../../../../components/Transition/OpacityTransition/OpacityTransition.js';
|
|
72
|
+
import '../../../../components/PasskeyCreatedSuccessBanner/PasskeyCreatedSuccessBanner.js';
|
|
73
|
+
import '../../../../components/Popper/Popper/Popper.js';
|
|
74
|
+
import '../../../../components/Popper/PopperContext/PopperContext.js';
|
|
75
|
+
import 'react-focus-lock';
|
|
76
|
+
import 'qrcode';
|
|
77
|
+
import 'formik';
|
|
78
|
+
import '../../../../utils/hooks/useSubdomainCheck/useSubdomainCheck.js';
|
|
79
|
+
import '../../../../context/WalletGroupContext/WalletGroupContext.js';
|
|
80
|
+
import '../../../../context/IpConfigurationContext/IpConfigurationContext.js';
|
|
81
|
+
import '../../../../context/ConnectWithOtpContext/ConnectWithOtpContext.js';
|
|
82
|
+
import '../../../DynamicBridgeWidget/views/WalletsView/components/SecondaryWallets/SecondaryWallets.js';
|
|
83
|
+
import '@hcaptcha/react-hcaptcha';
|
|
84
|
+
import { useWidgetContext } from '../../context/DynamicWidgetContext.js';
|
|
85
|
+
import '../../helpers/convertExchangeKeyAndProviderEnum.js';
|
|
86
|
+
import '../../../../views/ExchangeWhitelistWarning/ExchangeWhitelistWarning.js';
|
|
87
|
+
import '../../../../context/ErrorContext/hooks/useErrorText/useErrorText.js';
|
|
88
|
+
import '../../../../context/FooterAnimationContext/index.js';
|
|
89
|
+
import '../../../../views/MfaChooseDeviceView/useGetMfaOptions/useGetMfaOptions.js';
|
|
90
|
+
import '../../../../context/PasskeyContext/PasskeyContext.js';
|
|
91
|
+
import '../../../../context/OnrampContext/OnrampContext.js';
|
|
92
|
+
import '../../../../store/state/sendBalances.js';
|
|
93
|
+
import '../../../../store/state/connectorsInitializing/connectorsInitializing.js';
|
|
94
|
+
import '../../../../components/OverlayCardBase/OverlayCardTarget/OverlayCardTarget.js';
|
|
95
|
+
import '../../components/DynamicWidgetHeader/DynamicWidgetHeader.js';
|
|
96
|
+
import '../../../../views/TransactionConfirmationView/TransactionConfirmationView.js';
|
|
97
|
+
import '../../components/PasskeyCard/PasskeyCard.js';
|
|
98
|
+
import '../CryptoComOnramp/CryptoComOnramp.js';
|
|
99
|
+
import '../../../../../index.js';
|
|
100
|
+
import '../ReceiveWalletFunds/ReceiveWalletFunds.js';
|
|
101
|
+
import '../../../../store/state/tokenBalances.js';
|
|
102
|
+
import '../../../../store/state/multichainBalances.js';
|
|
103
|
+
import '../../../../shared/utils/functions/getInitialUrl/getInitialUrl.js';
|
|
104
|
+
import { useInternalDynamicContext } from '../../../../context/DynamicContext/useDynamicContext/useInternalDynamicContext/useInternalDynamicContext.js';
|
|
105
|
+
|
|
106
|
+
const PIN_LENGTH = 6;
|
|
107
|
+
const ExportSharesPasscodeView = () => {
|
|
108
|
+
const { t } = useTranslation();
|
|
109
|
+
const { setDynamicWidgetView } = useWidgetContext();
|
|
110
|
+
const { setShowAuthFlow } = useInternalDynamicContext();
|
|
111
|
+
const { pushView } = useViewContext();
|
|
112
|
+
const [error, setError] = useState(null);
|
|
113
|
+
const [isLoading, setIsLoading] = useState(false);
|
|
114
|
+
const [isValidated, setIsValidated] = useState(false);
|
|
115
|
+
const handleCloseClick = useCallback(() => setDynamicWidgetView('account-and-security-settings'), [setDynamicWidgetView]);
|
|
116
|
+
const handlePinComplete = useCallback((passcode) => __awaiter(void 0, void 0, void 0, function* () {
|
|
117
|
+
setError(null);
|
|
118
|
+
setIsLoading(true);
|
|
119
|
+
try {
|
|
120
|
+
setIsValidated(true);
|
|
121
|
+
setShowAuthFlow(true, {
|
|
122
|
+
ignoreIfIsEmbeddedWidget: false,
|
|
123
|
+
performMultiWalletChecks: false,
|
|
124
|
+
});
|
|
125
|
+
pushView('export-shares-view', { passcode });
|
|
126
|
+
}
|
|
127
|
+
catch (_a) {
|
|
128
|
+
setError(t('dyn_export_shares_passcode.error'));
|
|
129
|
+
setIsValidated(false);
|
|
130
|
+
}
|
|
131
|
+
finally {
|
|
132
|
+
setIsLoading(false);
|
|
133
|
+
}
|
|
134
|
+
}), [pushView, setShowAuthFlow, t]);
|
|
135
|
+
const handlePinChange = useCallback(() => {
|
|
136
|
+
setError(null);
|
|
137
|
+
}, []);
|
|
138
|
+
const closeButton = (jsx(IconButton, { type: 'button', onClick: handleCloseClick, "data-testid": 'close-button', children: jsx(SvgClose, {}) }));
|
|
139
|
+
return (jsxs("div", { className: 'export-shares-passcode-view', children: [jsx(ModalHeader, { trailing: closeButton, children: jsx("div", { className: 'send-balance-page-layout__header-content', children: jsx(Typography, { variant: 'title', color: 'primary', copykey: 'dyn_export_shares_passcode.title', children: t('dyn_export_shares_passcode.title') }) }) }), jsx("div", { className: 'account-wrap', children: jsxs("div", { className: 'export-shares-passcode-view__content', children: [error && (jsx(ErrorContainer, { variant: 'error', withIcon: false, children: error })), jsx("div", { className: 'export-shares-passcode-view__description', children: jsx(Typography, { variant: 'body_normal', color: 'secondary', copykey: 'dyn_export_shares_passcode.description', children: t('dyn_export_shares_passcode.description') }) }), jsx("div", { className: 'export-shares-passcode-view__label', children: jsx(Typography, { variant: 'body_small', color: 'secondary', copykey: 'dyn_export_shares_passcode.enter_passcode', children: t('dyn_export_shares_passcode.enter_passcode') }) }), jsx("div", { className: 'export-shares-passcode-view__pin-container', children: jsx(PinField, { initialValue: Array(PIN_LENGTH).fill(''), isLoading: isLoading, handleComplete: handlePinComplete, isValidated: isValidated, inputMode: 'numeric', pattern: '[0-9]*', hasError: Boolean(error), onChange: handlePinChange }) })] }) })] }));
|
|
140
|
+
};
|
|
141
|
+
|
|
142
|
+
export { ExportSharesPasscodeView };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { ExportSharesPasscodeView } from './ExportSharesPasscodeView';
|
|
@@ -20,7 +20,7 @@ var questionMark = require('../../../../shared/assets/question-mark.cjs');
|
|
|
20
20
|
require('../../../../context/ViewContext/ViewContext.cjs');
|
|
21
21
|
var backupWaas = require('../../../../shared/assets/backup-waas.cjs');
|
|
22
22
|
var googleDrive = require('../../../../shared/assets/google-drive.cjs');
|
|
23
|
-
require('../../../../shared/logger.cjs');
|
|
23
|
+
var logger = require('../../../../shared/logger.cjs');
|
|
24
24
|
require('@dynamic-labs/wallet-book');
|
|
25
25
|
require('@dynamic-labs/utils');
|
|
26
26
|
require('../../../../utils/constants/colors.cjs');
|
|
@@ -117,14 +117,14 @@ require('../../../../shared/utils/functions/getInitialUrl/getInitialUrl.cjs');
|
|
|
117
117
|
var useInternalDynamicContext = require('../../../../context/DynamicContext/useDynamicContext/useInternalDynamicContext/useInternalDynamicContext.cjs');
|
|
118
118
|
|
|
119
119
|
const WaasBackupView = () => {
|
|
120
|
+
var _a;
|
|
120
121
|
const { setDynamicWidgetView } = DynamicWidgetContext.useWidgetContext();
|
|
121
122
|
const user = useUser.useUser();
|
|
122
123
|
const { primaryWallet } = useInternalDynamicContext.useInternalDynamicContext();
|
|
123
124
|
const refresh = useRefreshUser.useRefreshUser();
|
|
124
|
-
const { linkSocialAccount, isLinked, isProcessingForProvider } = useSocialAccounts.useSocialAccounts();
|
|
125
|
+
const { linkSocialAccount, isLinked, isProcessingForProvider, error: socialError, } = useSocialAccounts.useSocialAccounts();
|
|
125
126
|
const { t } = reactI18next.useTranslation();
|
|
126
127
|
const [errorMessage, setErrorMessage] = React.useState(null);
|
|
127
|
-
const isGoogleLinked = isLinked(sdkApiCore.ProviderEnum.Google);
|
|
128
128
|
const checkGoogleDriveBackup = React.useCallback(() => {
|
|
129
129
|
var _a, _b;
|
|
130
130
|
if (!user || !primaryWallet)
|
|
@@ -144,6 +144,7 @@ const WaasBackupView = () => {
|
|
|
144
144
|
const handleInfoClick = React.useCallback(() => {
|
|
145
145
|
setDynamicWidgetView('waas-backup-info');
|
|
146
146
|
}, [setDynamicWidgetView]);
|
|
147
|
+
const isGoogleLinked = React.useMemo(() => isLinked(sdkApiCore.ProviderEnum.Google), [isLinked]);
|
|
147
148
|
const handleBackupWalletClick = React.useCallback(() => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
148
149
|
setErrorMessage(null);
|
|
149
150
|
try {
|
|
@@ -156,6 +157,9 @@ const WaasBackupView = () => {
|
|
|
156
157
|
showWidgetAfterConnection: false,
|
|
157
158
|
});
|
|
158
159
|
yield refresh();
|
|
160
|
+
if (!isLinked(sdkApiCore.ProviderEnum.Google)) {
|
|
161
|
+
return;
|
|
162
|
+
}
|
|
159
163
|
}
|
|
160
164
|
let waasConnector;
|
|
161
165
|
if (walletConnectorCore.isDynamicWaasConnector(primaryWallet.connector)) {
|
|
@@ -177,12 +181,13 @@ const WaasBackupView = () => {
|
|
|
177
181
|
yield refresh();
|
|
178
182
|
}
|
|
179
183
|
catch (error) {
|
|
184
|
+
logger.logger.warn('Error backing up wallet', { error });
|
|
180
185
|
setErrorMessage(t('dyn_waas.backup.error'));
|
|
181
186
|
}
|
|
182
|
-
}), [primaryWallet, refresh, isGoogleLinked, linkSocialAccount, t]);
|
|
187
|
+
}), [primaryWallet, refresh, isGoogleLinked, linkSocialAccount, t, isLinked]);
|
|
183
188
|
const infoButton = (jsxRuntime.jsx(IconButton.IconButton, { type: 'button', onClick: handleInfoClick, "data-testid": 'info-button', children: jsxRuntime.jsx(questionMark.ReactComponent, {}) }));
|
|
184
189
|
const closeButton = (jsxRuntime.jsx(IconButton.IconButton, { type: 'button', onClick: handleBackClick, "data-testid": 'close-button', children: jsxRuntime.jsx(close.ReactComponent, {}) }));
|
|
185
|
-
return (jsxRuntime.jsxs("div", { className: 'waas-backup-view', children: [jsxRuntime.jsx(ModalHeader.ModalHeader, { leading: infoButton, trailing: closeButton, children: jsxRuntime.jsx("div", { className: 'send-balance-page-layout__header-content', children: jsxRuntime.jsx(Typography.Typography, { variant: 'title', color: 'primary', copykey: 'dyn_waas.backup.title', children: t('dyn_waas.backup.title') }) }) }), jsxRuntime.jsx("div", { className: 'account-wrap', children: jsxRuntime.jsxs("div", { className: 'settings-view__body', children: [errorMessage && (jsxRuntime.jsx(ErrorContainer.ErrorContainer, { variant: 'error', withIcon: false, children: errorMessage })), jsxRuntime.jsxs("div", { className: 'backup-content', children: [jsxRuntime.jsx("div", { className: 'backup-icon-container', children: jsxRuntime.jsx(Icon.Icon, { color: 'brand-primary', children: jsxRuntime.jsx(backupWaas.ReactComponent, { width: 64, height: 64 }) }) }), jsxRuntime.jsx("div", { className: 'backup-subtitle', children: jsxRuntime.jsx(Typography.Typography, { variant: 'body_normal', color: 'primary', copykey: 'dyn_waas.backup.subtitle', children: t('dyn_waas.backup.subtitle') }) }), jsxRuntime.jsx("div", { className: 'google-drive-section', children: jsxRuntime.jsxs("div", { className: 'google-drive-container', children: [jsxRuntime.jsxs("div", { className: 'google-drive-header', children: [jsxRuntime.jsx(googleDrive.ReactComponent, { className: 'google-drive-icon' }), jsxRuntime.jsxs("div", { className: 'google-drive-text', children: [jsxRuntime.jsxs("div", { className: 'google-drive-title-row', children: [jsxRuntime.jsx(Typography.Typography, { variant: 'body_normal', color: 'primary', weight: 'bold', copykey: 'dyn_waas.backup.google_drive', children: t('dyn_waas.backup.google_drive') }), isBackedUp && (jsxRuntime.jsx("div", { className: 'backed-up-pill', children: jsxRuntime.jsx(Typography.Typography, { color: 'inherit', weight: 'bold', copykey: 'dyn_waas.backup.backed_up', children: t('dyn_waas.backup.backed_up') }) }))] }), jsxRuntime.jsx(Typography.Typography, { variant: 'body_small', color: 'secondary', copykey: 'dyn_waas.backup.google_drive_subtitle', children: t('dyn_waas.backup.google_drive_subtitle') })] }), isBackedUp && (jsxRuntime.jsx(check.ReactComponent, { className: 'google-drive-check-icon' }))] }), !isBackedUp && (jsxRuntime.jsx(TypographyButton.TypographyButton, { dataTestId: 'backup-wallet-button', onClick: handleBackupWalletClick, buttonClassName: 'backup-button', disabled: isProcessingForProvider(sdkApiCore.ProviderEnum.Google), typographyProps: {
|
|
190
|
+
return (jsxRuntime.jsxs("div", { className: 'waas-backup-view', children: [jsxRuntime.jsx(ModalHeader.ModalHeader, { leading: infoButton, trailing: closeButton, children: jsxRuntime.jsx("div", { className: 'send-balance-page-layout__header-content', children: jsxRuntime.jsx(Typography.Typography, { variant: 'title', color: 'primary', copykey: 'dyn_waas.backup.title', children: t('dyn_waas.backup.title') }) }) }), jsxRuntime.jsx("div", { className: 'account-wrap', children: jsxRuntime.jsxs("div", { className: 'settings-view__body', children: [(errorMessage || socialError) && (jsxRuntime.jsx(ErrorContainer.ErrorContainer, { variant: 'error', withIcon: false, children: (_a = socialError === null || socialError === void 0 ? void 0 : socialError.message) !== null && _a !== void 0 ? _a : errorMessage })), jsxRuntime.jsxs("div", { className: 'backup-content', children: [jsxRuntime.jsx("div", { className: 'backup-icon-container', children: jsxRuntime.jsx(Icon.Icon, { color: 'brand-primary', children: jsxRuntime.jsx(backupWaas.ReactComponent, { width: 64, height: 64 }) }) }), jsxRuntime.jsx("div", { className: 'backup-subtitle', children: jsxRuntime.jsx(Typography.Typography, { variant: 'body_normal', color: 'primary', copykey: 'dyn_waas.backup.subtitle', children: t('dyn_waas.backup.subtitle') }) }), jsxRuntime.jsx("div", { className: 'google-drive-section', children: jsxRuntime.jsxs("div", { className: 'google-drive-container', children: [jsxRuntime.jsxs("div", { className: 'google-drive-header', children: [jsxRuntime.jsx(googleDrive.ReactComponent, { className: 'google-drive-icon' }), jsxRuntime.jsxs("div", { className: 'google-drive-text', children: [jsxRuntime.jsxs("div", { className: 'google-drive-title-row', children: [jsxRuntime.jsx(Typography.Typography, { variant: 'body_normal', color: 'primary', weight: 'bold', copykey: 'dyn_waas.backup.google_drive', children: t('dyn_waas.backup.google_drive') }), isBackedUp && (jsxRuntime.jsx("div", { className: 'backed-up-pill', children: jsxRuntime.jsx(Typography.Typography, { color: 'inherit', weight: 'bold', copykey: 'dyn_waas.backup.backed_up', children: t('dyn_waas.backup.backed_up') }) }))] }), jsxRuntime.jsx(Typography.Typography, { variant: 'body_small', color: 'secondary', copykey: 'dyn_waas.backup.google_drive_subtitle', children: t('dyn_waas.backup.google_drive_subtitle') })] }), isBackedUp && (jsxRuntime.jsx(check.ReactComponent, { className: 'google-drive-check-icon' }))] }), !isBackedUp && (jsxRuntime.jsx(TypographyButton.TypographyButton, { dataTestId: 'backup-wallet-button', onClick: handleBackupWalletClick, buttonClassName: 'backup-button', disabled: isProcessingForProvider(sdkApiCore.ProviderEnum.Google), typographyProps: {
|
|
186
191
|
color: 'primary',
|
|
187
192
|
weight: 'bold',
|
|
188
193
|
}, copykey: 'dyn_waas.backup.back_up', buttonPadding: 'small', children: t('dyn_waas.backup.back_up') }))] }) })] })] }) })] }));
|