@dynamic-labs/sdk-react-core 4.48.2 → 4.50.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 +27 -0
- package/package.cjs +1 -1
- package/package.js +1 -1
- package/package.json +12 -12
- package/src/index.cjs +6 -4
- package/src/index.d.ts +1 -0
- package/src/index.js +3 -2
- package/src/lib/context/DynamicContext/DynamicContext.cjs +1 -1
- package/src/lib/context/DynamicContext/DynamicContext.js +1 -1
- package/src/lib/context/DynamicContext/hooks/useTieCallbacksToEvents/useTieCallbacksToEvents.cjs +10 -0
- package/src/lib/context/DynamicContext/hooks/useTieCallbacksToEvents/useTieCallbacksToEvents.js +10 -0
- package/src/lib/context/OnrampContext/OnrampContext.cjs +4 -2
- package/src/lib/context/OnrampContext/OnrampContext.d.ts +1 -0
- package/src/lib/context/OnrampContext/OnrampContext.js +4 -2
- package/src/lib/context/OnrampContext/types.d.ts +1 -0
- package/src/lib/context/OnrampContext/utils/getOnrampProviders.cjs +2 -1
- package/src/lib/context/OnrampContext/utils/getOnrampProviders.d.ts +1 -1
- package/src/lib/context/OnrampContext/utils/getOnrampProviders.js +2 -1
- package/src/lib/context/PhantomRedirectContext/PhantomRedirectContext.cjs +38 -6
- package/src/lib/context/PhantomRedirectContext/PhantomRedirectContext.d.ts +2 -2
- package/src/lib/context/PhantomRedirectContext/PhantomRedirectContext.js +39 -8
- package/src/lib/context/PhantomRedirectContext/useResponseHandlers.cjs +108 -16
- package/src/lib/context/PhantomRedirectContext/useResponseHandlers.js +108 -16
- package/src/lib/context/ViewContext/types/index.d.ts +1 -1
- package/src/lib/data/api/onramp/onramp.cjs +2 -1
- package/src/lib/data/api/onramp/onramp.d.ts +2 -1
- package/src/lib/data/api/onramp/onramp.js +2 -1
- package/src/lib/events/dynamicEvents.cjs +2 -0
- package/src/lib/events/dynamicEvents.d.ts +1 -1
- package/src/lib/events/dynamicEvents.js +2 -0
- package/src/lib/shared/assets/backup-waas.cjs +4 -4
- package/src/lib/shared/assets/backup-waas.js +4 -4
- package/src/lib/shared/types/dynamicEventsCallbacks.d.ts +4 -0
- 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 +13 -0
- package/src/lib/utils/constants/authViewLayoutChecks.js +13 -0
- package/src/lib/utils/functions/generateMessages/index.cjs +11 -2
- package/src/lib/utils/functions/generateMessages/index.js +11 -2
- package/src/lib/utils/functions/getVerifyArgs/getVerifyArgs.cjs +27 -1
- package/src/lib/utils/functions/getVerifyArgs/getVerifyArgs.js +27 -1
- package/src/lib/utils/functions/index.d.ts +0 -1
- package/src/lib/utils/hooks/events/useDynamicEvents/useDynamicEvents.d.ts +1 -1
- package/src/lib/utils/hooks/index.d.ts +2 -0
- package/src/lib/utils/hooks/useAuthenticatePasskeyMFA/useAuthenticatePasskeyMFA.cjs +5 -1
- package/src/lib/utils/hooks/useAuthenticatePasskeyMFA/useAuthenticatePasskeyMFA.js +5 -1
- package/src/lib/utils/hooks/useDynamicWaas/useDynamicWaas.cjs +35 -5
- package/src/lib/utils/hooks/useDynamicWaas/useDynamicWaas.d.ts +1 -0
- package/src/lib/utils/hooks/useDynamicWaas/useDynamicWaas.js +35 -5
- package/src/lib/utils/hooks/useFunding/useFunding.d.ts +1 -0
- package/src/lib/utils/hooks/useOnramp/useOnramp.cjs +14 -29
- package/src/lib/utils/hooks/useOnramp/useOnramp.d.ts +14 -18
- package/src/lib/utils/hooks/useOnramp/useOnramp.js +14 -29
- package/src/lib/utils/hooks/usePhantomRedirectEvents/index.d.ts +1 -0
- package/src/lib/utils/hooks/usePhantomRedirectEvents/usePhantomRedirectEvents.cjs +65 -0
- package/src/lib/utils/hooks/usePhantomRedirectEvents/usePhantomRedirectEvents.d.ts +36 -0
- package/src/lib/utils/hooks/usePhantomRedirectEvents/usePhantomRedirectEvents.js +61 -0
- package/src/lib/utils/hooks/useSetWalletConnectorFetchers/useSetWalletConnectorFetchers.cjs +17 -14
- package/src/lib/utils/hooks/useSetWalletConnectorFetchers/useSetWalletConnectorFetchers.js +17 -14
- package/src/lib/utils/hooks/useSignInWithPasskey/useSignInWithPasskey.cjs +106 -1
- package/src/lib/utils/hooks/useSignInWithPasskey/useSignInWithPasskey.js +106 -1
- package/src/lib/utils/hooks/useSmartWallets/useSmartWallets.cjs +1 -1
- package/src/lib/utils/hooks/useSmartWallets/useSmartWallets.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/useWalletBackup/index.d.ts +1 -0
- package/src/lib/utils/hooks/useWalletBackup/useWalletBackup.cjs +339 -0
- package/src/lib/utils/hooks/useWalletBackup/useWalletBackup.d.ts +49 -0
- package/src/lib/utils/hooks/useWalletBackup/useWalletBackup.js +332 -0
- package/src/lib/utils/hooks/useWalletDelegation/useWalletDelegation.cjs +2 -2
- package/src/lib/utils/hooks/useWalletDelegation/useWalletDelegation.js +2 -2
- package/src/lib/utils/hooks/useWalletItemActions/useHandleWalletItem/useHandleWalletItem.cjs +1 -0
- package/src/lib/utils/hooks/useWalletItemActions/useHandleWalletItem/useHandleWalletItem.js +1 -0
- package/src/lib/views/EmbeddedReveal/EmbeddedRevealView/EmbeddedRevealView.cjs +13 -0
- package/src/lib/views/EmbeddedReveal/EmbeddedRevealView/EmbeddedRevealView.js +14 -1
- package/src/lib/views/MfaDisplayBackupCodesView/MfaDisplayBackupCodesView.cjs +9 -6
- package/src/lib/views/MfaDisplayBackupCodesView/MfaDisplayBackupCodesView.js +9 -6
- package/src/lib/views/WalletUpgradeFlowView/WalletUpgradeFlowView.cjs +13 -0
- package/src/lib/views/WalletUpgradeFlowView/WalletUpgradeFlowView.js +14 -1
- package/src/lib/views/WalletUsedView/WalletUsedView.cjs +1 -0
- package/src/lib/views/WalletUsedView/WalletUsedView.js +1 -0
- package/src/lib/views/viewToComponentMap.cjs +15 -3
- package/src/lib/views/viewToComponentMap.d.ts +6 -0
- package/src/lib/views/viewToComponentMap.js +15 -3
- package/src/lib/widgets/DynamicWidget/components/ActiveWalletBalance/TokenBalanceItem/TokenBalanceItem.cjs +1 -1
- package/src/lib/widgets/DynamicWidget/components/ActiveWalletBalance/TokenBalanceItem/TokenBalanceItem.js +1 -1
- package/src/lib/widgets/DynamicWidget/components/DynamicWidgetViews/mapViewToComponent.cjs +97 -3
- package/src/lib/widgets/DynamicWidget/components/DynamicWidgetViews/mapViewToComponent.js +97 -3
- package/src/lib/widgets/DynamicWidget/views/AccountAndSecuritySettingsView/EmbeddedWalletExportSection/EmbeddedWalletExportSection.cjs +16 -14
- package/src/lib/widgets/DynamicWidget/views/AccountAndSecuritySettingsView/EmbeddedWalletExportSection/EmbeddedWalletExportSection.js +16 -14
- package/src/lib/widgets/DynamicWidget/views/CryptoComOnramp/CryptoComOnramp.cjs +3 -1
- package/src/lib/widgets/DynamicWidget/views/CryptoComOnramp/CryptoComOnramp.d.ts +1 -0
- package/src/lib/widgets/DynamicWidget/views/CryptoComOnramp/CryptoComOnramp.js +3 -1
- package/src/lib/widgets/DynamicWidget/views/WaasBackupView/BackupStepper.cjs +37 -0
- package/src/lib/widgets/DynamicWidget/views/WaasBackupView/BackupStepper.d.ts +7 -0
- package/src/lib/widgets/DynamicWidget/views/WaasBackupView/BackupStepper.js +33 -0
- package/src/lib/widgets/DynamicWidget/views/WaasBackupView/WaasBackupCloudProviderView.cjs +49 -0
- package/src/lib/widgets/DynamicWidget/views/WaasBackupView/WaasBackupCloudProviderView.d.ts +2 -0
- package/src/lib/widgets/DynamicWidget/views/WaasBackupView/WaasBackupCloudProviderView.js +45 -0
- package/src/lib/widgets/DynamicWidget/views/WaasBackupView/WaasBackupDownloadView.cjs +53 -0
- package/src/lib/widgets/DynamicWidget/views/WaasBackupView/WaasBackupDownloadView.d.ts +2 -0
- package/src/lib/widgets/DynamicWidget/views/WaasBackupView/WaasBackupDownloadView.js +49 -0
- package/src/lib/widgets/DynamicWidget/views/WaasBackupView/WaasBackupInfoView.cjs +9 -18
- package/src/lib/widgets/DynamicWidget/views/WaasBackupView/WaasBackupInfoView.js +10 -19
- package/src/lib/widgets/DynamicWidget/views/WaasBackupView/WaasBackupProgressView.cjs +52 -0
- package/src/lib/widgets/DynamicWidget/views/WaasBackupView/WaasBackupProgressView.d.ts +2 -0
- package/src/lib/widgets/DynamicWidget/views/WaasBackupView/WaasBackupProgressView.js +48 -0
- package/src/lib/widgets/DynamicWidget/views/WaasBackupView/WaasBackupSuccessView.cjs +131 -0
- package/src/lib/widgets/DynamicWidget/views/WaasBackupView/WaasBackupSuccessView.d.ts +5 -0
- package/src/lib/widgets/DynamicWidget/views/WaasBackupView/WaasBackupSuccessView.js +127 -0
- package/src/lib/widgets/DynamicWidget/views/WaasBackupView/WaasBackupView.cjs +45 -104
- package/src/lib/widgets/DynamicWidget/views/WaasBackupView/WaasBackupView.js +47 -106
- package/src/lib/widgets/DynamicWidget/views/WaasBackupView/index.d.ts +6 -1
- package/src/lib/utils/functions/downloadFile/downloadFile.cjs +0 -15
- package/src/lib/utils/functions/downloadFile/downloadFile.d.ts +0 -1
- package/src/lib/utils/functions/downloadFile/downloadFile.js +0 -11
- package/src/lib/utils/functions/downloadFile/index.d.ts +0 -1
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
3
|
+
import { useCallback } from 'react';
|
|
4
|
+
import { useTranslation } from 'react-i18next';
|
|
5
|
+
import { Icon } from '../../../../components/Icon/Icon.js';
|
|
6
|
+
import { IconButton } from '../../../../components/IconButton/IconButton.js';
|
|
7
|
+
import { ModalHeader } from '../../../../components/ModalHeader/ModalHeader.js';
|
|
8
|
+
import { Typography } from '../../../../components/Typography/Typography.js';
|
|
9
|
+
import { TypographyButton } from '../../../../components/TypographyButton/TypographyButton.js';
|
|
10
|
+
import '../../../../context/DynamicContext/DynamicContext.js';
|
|
11
|
+
import '../../../../store/state/loadingAndLifecycle/loadingAndLifecycle.js';
|
|
12
|
+
import '@dynamic-labs/iconic';
|
|
13
|
+
import '@dynamic-labs/wallet-connector-core';
|
|
14
|
+
import { ReactComponent as SvgChevronLeft } from '../../../../shared/assets/chevron-left.js';
|
|
15
|
+
import { ReactComponent as SvgQuestionMark } from '../../../../shared/assets/question-mark.js';
|
|
16
|
+
import { useViewContext } from '../../../../context/ViewContext/ViewContext.js';
|
|
17
|
+
import { ReactComponent as SvgBackupWaas } from '../../../../shared/assets/backup-waas.js';
|
|
18
|
+
import '../../../../shared/logger.js';
|
|
19
|
+
import '@dynamic-labs/wallet-book';
|
|
20
|
+
import '@dynamic-labs/utils';
|
|
21
|
+
import '../../../../utils/constants/colors.js';
|
|
22
|
+
import '../../../../utils/constants/values.js';
|
|
23
|
+
import '@dynamic-labs/sdk-api-core';
|
|
24
|
+
import '../../../../shared/consts/index.js';
|
|
25
|
+
import '../../../../events/dynamicEvents.js';
|
|
26
|
+
import '../../../../../../_virtual/_tslib.js';
|
|
27
|
+
import '../../../../context/CaptchaContext/CaptchaContext.js';
|
|
28
|
+
import '../../../../context/ErrorContext/ErrorContext.js';
|
|
29
|
+
import '@dynamic-labs/multi-wallet';
|
|
30
|
+
import 'react-international-phone';
|
|
31
|
+
import '../../../../store/state/nonce/nonce.js';
|
|
32
|
+
import '@dynamic-labs-sdk/client/core';
|
|
33
|
+
import '../../../../client/client.js';
|
|
34
|
+
import '@dynamic-labs-sdk/client';
|
|
35
|
+
import '../../../../config/ApiEndpoint.js';
|
|
36
|
+
import '@dynamic-labs/locale';
|
|
37
|
+
import '../../../../store/state/dynamicContextProps/dynamicContextProps.js';
|
|
38
|
+
import '../../../../store/state/primaryWalletId/primaryWalletId.js';
|
|
39
|
+
import '../../../../store/state/connectedWalletsInfo/connectedWalletsInfo.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 '../../../../context/ThemeContext/ThemeContext.js';
|
|
49
|
+
import '../../../../utils/hooks/useUserUpdateRequest/useUpdateUser/userFieldsSchema.js';
|
|
50
|
+
import 'bs58';
|
|
51
|
+
import '@dynamic-labs/types';
|
|
52
|
+
import '../../../../context/SocialRedirectContext/SocialRedirectContext.js';
|
|
53
|
+
import '../../../../context/LoadingContext/LoadingContext.js';
|
|
54
|
+
import '../../../../context/WalletContext/WalletContext.js';
|
|
55
|
+
import '../../../../utils/hooks/useEmbeddedWallet/useSecureEnclaveEmbeddedWallet/constants.js';
|
|
56
|
+
import 'yup';
|
|
57
|
+
import '../../../../context/MockContext/MockContext.js';
|
|
58
|
+
import '../../../../views/CollectUserDataView/useFields.js';
|
|
59
|
+
import '../../../../context/FieldsStateContext/FieldsStateContext.js';
|
|
60
|
+
import '../../../../context/UserFieldEditorContext/UserFieldEditorContext.js';
|
|
61
|
+
import '@dynamic-labs/rpc-providers';
|
|
62
|
+
import '../../../../store/state/walletOptions/walletOptions.js';
|
|
63
|
+
import '../../../../components/Accordion/components/AccordionItem/AccordionItem.js';
|
|
64
|
+
import '../../../../components/Alert/Alert.js';
|
|
65
|
+
import '../../../../components/ShadowDOM/ShadowDOM.js';
|
|
66
|
+
import '../../../../components/InlineWidget/InlineWidget.js';
|
|
67
|
+
import '../../../../components/Input/Input.js';
|
|
68
|
+
import '../../../../components/IsBrowser/IsBrowser.js';
|
|
69
|
+
import '../../../../components/MenuList/Dropdown/Dropdown.js';
|
|
70
|
+
import '../../../../components/OverlayCard/OverlayCard.js';
|
|
71
|
+
import '../../../../components/Transition/ZoomTransition/ZoomTransition.js';
|
|
72
|
+
import '../../../../components/Transition/SlideInUpTransition/SlideInUpTransition.js';
|
|
73
|
+
import '../../../../components/Transition/OpacityTransition/OpacityTransition.js';
|
|
74
|
+
import '../../../../components/PasskeyCreatedSuccessBanner/PasskeyCreatedSuccessBanner.js';
|
|
75
|
+
import '../../../../components/Popper/Popper/Popper.js';
|
|
76
|
+
import '../../../../components/Popper/PopperContext/PopperContext.js';
|
|
77
|
+
import 'react-focus-lock';
|
|
78
|
+
import 'qrcode';
|
|
79
|
+
import 'formik';
|
|
80
|
+
import '../../../../utils/hooks/useSubdomainCheck/useSubdomainCheck.js';
|
|
81
|
+
import '../../../../context/WalletGroupContext/WalletGroupContext.js';
|
|
82
|
+
import { BackupStepper } from './BackupStepper.js';
|
|
83
|
+
import '../../../../context/IpConfigurationContext/IpConfigurationContext.js';
|
|
84
|
+
import '../../../../context/ConnectWithOtpContext/ConnectWithOtpContext.js';
|
|
85
|
+
import '../../../DynamicBridgeWidget/views/WalletsView/components/SecondaryWallets/SecondaryWallets.js';
|
|
86
|
+
import '@hcaptcha/react-hcaptcha';
|
|
87
|
+
import '../../context/DynamicWidgetContext.js';
|
|
88
|
+
import '../../helpers/convertExchangeKeyAndProviderEnum.js';
|
|
89
|
+
import '../../../../views/ExchangeWhitelistWarning/ExchangeWhitelistWarning.js';
|
|
90
|
+
import '../../../../context/ErrorContext/hooks/useErrorText/useErrorText.js';
|
|
91
|
+
import '../../../../context/FooterAnimationContext/index.js';
|
|
92
|
+
import '../../../../views/MfaChooseDeviceView/useGetMfaOptions/useGetMfaOptions.js';
|
|
93
|
+
import '../../../../context/PasskeyContext/PasskeyContext.js';
|
|
94
|
+
import '../../../../context/OnrampContext/OnrampContext.js';
|
|
95
|
+
import '../../../../store/state/sendBalances.js';
|
|
96
|
+
import '../../../../store/state/connectorsInitializing/connectorsInitializing.js';
|
|
97
|
+
import '../../../../components/OverlayCardBase/OverlayCardTarget/OverlayCardTarget.js';
|
|
98
|
+
import '../../components/DynamicWidgetHeader/DynamicWidgetHeader.js';
|
|
99
|
+
import '../../../../views/TransactionConfirmationView/TransactionConfirmationView.js';
|
|
100
|
+
import '../../components/PasskeyCard/PasskeyCard.js';
|
|
101
|
+
import '../CryptoComOnramp/CryptoComOnramp.js';
|
|
102
|
+
import '../../../../../index.js';
|
|
103
|
+
import '../ReceiveWalletFunds/ReceiveWalletFunds.js';
|
|
104
|
+
import '../../../../store/state/tokenBalances.js';
|
|
105
|
+
import '../../../../store/state/multichainBalances.js';
|
|
106
|
+
import '../../../../shared/utils/functions/getInitialUrl/getInitialUrl.js';
|
|
107
|
+
import { useInternalDynamicContext } from '../../../../context/DynamicContext/useDynamicContext/useInternalDynamicContext/useInternalDynamicContext.js';
|
|
108
|
+
|
|
109
|
+
const WaasBackupSuccessView = ({ walletCount = 1, }) => {
|
|
110
|
+
const { goBack, pushView } = useViewContext();
|
|
111
|
+
const { setShowAuthFlow } = useInternalDynamicContext();
|
|
112
|
+
const { t } = useTranslation();
|
|
113
|
+
const handleBackClick = useCallback(() => goBack(), [goBack]);
|
|
114
|
+
const handleInfoClick = useCallback(() => {
|
|
115
|
+
pushView('waas-backup-info-view');
|
|
116
|
+
}, [pushView]);
|
|
117
|
+
const handleDoneClick = useCallback(() => {
|
|
118
|
+
setShowAuthFlow(false);
|
|
119
|
+
}, [setShowAuthFlow]);
|
|
120
|
+
const backButton = (jsx(IconButton, { type: 'button', onClick: handleBackClick, "data-testid": 'back-button', children: jsx(SvgChevronLeft, {}) }));
|
|
121
|
+
const infoButton = (jsx(IconButton, { type: 'button', onClick: handleInfoClick, "data-testid": 'info-button', children: jsx(SvgQuestionMark, {}) }));
|
|
122
|
+
return (jsxs(Fragment, { children: [jsx(ModalHeader, { leading: backButton, trailing: infoButton, children: jsx(Typography, { variant: 'title', color: 'primary', copykey: 'dyn_waas.backup.success_title', children: t('dyn_waas.backup.success_title') }) }), jsx("div", { className: 'waas-backup-view', children: jsxs("div", { className: 'waas-backup-view__body waas-backup-view__body--centered', children: [jsx("div", { className: 'waas-backup-view__success-icon', children: jsx(Icon, { color: 'brand-primary', children: jsx(SvgBackupWaas, { width: 64, height: 64 }) }) }), jsx(BackupStepper, { currentStep: 1, completedSteps: 2 }), jsx(Typography, { variant: 'body_normal', color: 'secondary', copykey: 'dyn_waas.backup.success_description', className: 'waas-backup-view__success-description', children: t('dyn_waas.backup.success_description', { count: walletCount }) }), jsx(TypographyButton, { dataTestId: 'done-button', onClick: handleDoneClick, buttonVariant: 'brand-primary', typographyProps: {
|
|
123
|
+
color: 'inherit',
|
|
124
|
+
}, expanded: true, children: t('dyn_waas.backup.done') })] }) })] }));
|
|
125
|
+
};
|
|
126
|
+
|
|
127
|
+
export { WaasBackupSuccessView };
|
|
@@ -3,48 +3,45 @@
|
|
|
3
3
|
|
|
4
4
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
5
|
|
|
6
|
-
var _tslib = require('../../../../../../_virtual/_tslib.cjs');
|
|
7
6
|
var jsxRuntime = require('react/jsx-runtime');
|
|
8
7
|
var React = require('react');
|
|
9
8
|
var reactI18next = require('react-i18next');
|
|
10
|
-
var
|
|
11
|
-
var
|
|
12
|
-
require('
|
|
13
|
-
require('../../../../
|
|
14
|
-
require('
|
|
15
|
-
require('../../../../
|
|
9
|
+
var Checkbox = require('../../../../components/Checkbox/Checkbox.cjs');
|
|
10
|
+
var Icon = require('../../../../components/Icon/Icon.cjs');
|
|
11
|
+
var IconButton = require('../../../../components/IconButton/IconButton.cjs');
|
|
12
|
+
var ModalHeader = require('../../../../components/ModalHeader/ModalHeader.cjs');
|
|
13
|
+
var Typography = require('../../../../components/Typography/Typography.cjs');
|
|
14
|
+
var TypographyButton = require('../../../../components/TypographyButton/TypographyButton.cjs');
|
|
15
|
+
require('../../../../context/DynamicContext/DynamicContext.cjs');
|
|
16
|
+
require('../../../../store/state/loadingAndLifecycle/loadingAndLifecycle.cjs');
|
|
16
17
|
require('@dynamic-labs/iconic');
|
|
17
|
-
|
|
18
|
-
var
|
|
18
|
+
require('@dynamic-labs/wallet-connector-core');
|
|
19
|
+
var chevronLeft = require('../../../../shared/assets/chevron-left.cjs');
|
|
19
20
|
var questionMark = require('../../../../shared/assets/question-mark.cjs');
|
|
20
|
-
require('../../../../context/ViewContext/ViewContext.cjs');
|
|
21
|
+
var ViewContext = require('../../../../context/ViewContext/ViewContext.cjs');
|
|
21
22
|
var backupWaas = require('../../../../shared/assets/backup-waas.cjs');
|
|
22
|
-
|
|
23
|
-
var logger = require('../../../../shared/logger.cjs');
|
|
23
|
+
require('../../../../shared/logger.cjs');
|
|
24
24
|
require('@dynamic-labs/wallet-book');
|
|
25
25
|
require('@dynamic-labs/utils');
|
|
26
26
|
require('../../../../utils/constants/colors.cjs');
|
|
27
27
|
require('../../../../utils/constants/values.cjs');
|
|
28
|
+
require('@dynamic-labs/sdk-api-core');
|
|
28
29
|
require('../../../../shared/consts/index.cjs');
|
|
30
|
+
require('../../../../events/dynamicEvents.cjs');
|
|
31
|
+
require('../../../../../../_virtual/_tslib.cjs');
|
|
32
|
+
require('../../../../context/CaptchaContext/CaptchaContext.cjs');
|
|
33
|
+
require('../../../../context/ErrorContext/ErrorContext.cjs');
|
|
29
34
|
require('@dynamic-labs/multi-wallet');
|
|
30
35
|
require('react-international-phone');
|
|
31
36
|
require('../../../../store/state/nonce/nonce.cjs');
|
|
37
|
+
require('@dynamic-labs-sdk/client/core');
|
|
38
|
+
require('../../../../client/client.cjs');
|
|
39
|
+
require('@dynamic-labs-sdk/client');
|
|
40
|
+
require('../../../../config/ApiEndpoint.cjs');
|
|
32
41
|
require('@dynamic-labs/locale');
|
|
33
42
|
require('../../../../store/state/dynamicContextProps/dynamicContextProps.cjs');
|
|
34
43
|
require('../../../../store/state/primaryWalletId/primaryWalletId.cjs');
|
|
35
44
|
require('../../../../store/state/connectedWalletsInfo/connectedWalletsInfo.cjs');
|
|
36
|
-
require('../../../../events/dynamicEvents.cjs');
|
|
37
|
-
var useUser = require('../../../../client/extension/user/useUser/useUser.cjs');
|
|
38
|
-
var ErrorContainer = require('../../../../components/ErrorContainer/ErrorContainer.cjs');
|
|
39
|
-
var Icon = require('../../../../components/Icon/Icon.cjs');
|
|
40
|
-
var IconButton = require('../../../../components/IconButton/IconButton.cjs');
|
|
41
|
-
var ModalHeader = require('../../../../components/ModalHeader/ModalHeader.cjs');
|
|
42
|
-
var Typography = require('../../../../components/Typography/Typography.cjs');
|
|
43
|
-
var TypographyButton = require('../../../../components/TypographyButton/TypographyButton.cjs');
|
|
44
|
-
require('../../../../context/DynamicContext/DynamicContext.cjs');
|
|
45
|
-
require('../../../../store/state/loadingAndLifecycle/loadingAndLifecycle.cjs');
|
|
46
|
-
require('../../../../context/CaptchaContext/CaptchaContext.cjs');
|
|
47
|
-
require('../../../../context/ErrorContext/ErrorContext.cjs');
|
|
48
45
|
require('../../../../context/AccessDeniedContext/AccessDeniedContext.cjs');
|
|
49
46
|
require('../../../../context/AccountExistsContext/AccountExistsContext.cjs');
|
|
50
47
|
require('../../../../context/UserWalletsContext/UserWalletsContext.cjs');
|
|
@@ -55,9 +52,12 @@ require('../../../../utils/functions/compareChains/compareChains.cjs');
|
|
|
55
52
|
require('../../../../views/Passkey/utils/findPrimaryEmbeddedChain/findPrimaryEmbeddedChain.cjs');
|
|
56
53
|
require('../../../../context/ThemeContext/ThemeContext.cjs');
|
|
57
54
|
require('../../../../utils/hooks/useUserUpdateRequest/useUpdateUser/userFieldsSchema.cjs');
|
|
58
|
-
var utils = require('../../../../utils/hooks/useTransactionSimulation/utils/utils.cjs');
|
|
59
55
|
require('bs58');
|
|
60
|
-
|
|
56
|
+
require('@dynamic-labs/types');
|
|
57
|
+
require('../../../../context/SocialRedirectContext/SocialRedirectContext.cjs');
|
|
58
|
+
require('../../../../context/LoadingContext/LoadingContext.cjs');
|
|
59
|
+
require('../../../../context/WalletContext/WalletContext.cjs');
|
|
60
|
+
require('../../../../utils/hooks/useEmbeddedWallet/useSecureEnclaveEmbeddedWallet/constants.cjs');
|
|
61
61
|
require('yup');
|
|
62
62
|
require('../../../../context/MockContext/MockContext.cjs');
|
|
63
63
|
require('../../../../views/CollectUserDataView/useFields.cjs');
|
|
@@ -67,7 +67,6 @@ require('@dynamic-labs/rpc-providers');
|
|
|
67
67
|
require('../../../../store/state/walletOptions/walletOptions.cjs');
|
|
68
68
|
require('../../../../components/Accordion/components/AccordionItem/AccordionItem.cjs');
|
|
69
69
|
require('../../../../components/Alert/Alert.cjs');
|
|
70
|
-
require('../../../../context/WalletContext/WalletContext.cjs');
|
|
71
70
|
require('../../../../components/ShadowDOM/ShadowDOM.cjs');
|
|
72
71
|
require('../../../../components/InlineWidget/InlineWidget.cjs');
|
|
73
72
|
require('../../../../components/Input/Input.cjs');
|
|
@@ -86,22 +85,17 @@ require('formik');
|
|
|
86
85
|
require('../../../../utils/hooks/useSubdomainCheck/useSubdomainCheck.cjs');
|
|
87
86
|
require('../../../../context/WalletGroupContext/WalletGroupContext.cjs');
|
|
88
87
|
require('../../../../context/IpConfigurationContext/IpConfigurationContext.cjs');
|
|
89
|
-
require('../../../../context/SocialRedirectContext/SocialRedirectContext.cjs');
|
|
90
88
|
require('../../../../context/ConnectWithOtpContext/ConnectWithOtpContext.cjs');
|
|
91
89
|
require('../../../DynamicBridgeWidget/views/WalletsView/components/SecondaryWallets/SecondaryWallets.cjs');
|
|
92
90
|
require('@hcaptcha/react-hcaptcha');
|
|
93
|
-
require('
|
|
94
|
-
var DynamicWidgetContext = require('../../context/DynamicWidgetContext.cjs');
|
|
91
|
+
require('../../context/DynamicWidgetContext.cjs');
|
|
95
92
|
require('../../helpers/convertExchangeKeyAndProviderEnum.cjs');
|
|
96
93
|
require('../../../../views/ExchangeWhitelistWarning/ExchangeWhitelistWarning.cjs');
|
|
97
94
|
require('../../../../context/ErrorContext/hooks/useErrorText/useErrorText.cjs');
|
|
98
95
|
require('../../../../context/FooterAnimationContext/index.cjs');
|
|
99
|
-
require('@dynamic-labs/types');
|
|
100
|
-
require('../../../../utils/hooks/useEmbeddedWallet/useSecureEnclaveEmbeddedWallet/constants.cjs');
|
|
101
96
|
require('../../../../views/MfaChooseDeviceView/useGetMfaOptions/useGetMfaOptions.cjs');
|
|
102
97
|
require('../../../../context/PasskeyContext/PasskeyContext.cjs');
|
|
103
98
|
require('../../../../context/OnrampContext/OnrampContext.cjs');
|
|
104
|
-
var useRefreshUser = require('../../../../utils/hooks/useRefreshUser/useRefreshUser.cjs');
|
|
105
99
|
require('../../../../store/state/sendBalances.cjs');
|
|
106
100
|
require('../../../../store/state/connectorsInitializing/connectorsInitializing.cjs');
|
|
107
101
|
require('../../../../components/OverlayCardBase/OverlayCardTarget/OverlayCardTarget.cjs');
|
|
@@ -117,80 +111,27 @@ require('../../../../shared/utils/functions/getInitialUrl/getInitialUrl.cjs');
|
|
|
117
111
|
var useInternalDynamicContext = require('../../../../context/DynamicContext/useDynamicContext/useInternalDynamicContext/useInternalDynamicContext.cjs');
|
|
118
112
|
|
|
119
113
|
const WaasBackupView = () => {
|
|
120
|
-
|
|
121
|
-
const {
|
|
122
|
-
const user = useUser.useUser();
|
|
123
|
-
const { primaryWallet } = useInternalDynamicContext.useInternalDynamicContext();
|
|
124
|
-
const refresh = useRefreshUser.useRefreshUser();
|
|
125
|
-
const { linkSocialAccount, isLinked, isProcessingForProvider, error: socialError, } = useSocialAccounts.useSocialAccounts();
|
|
114
|
+
const { setShowAuthFlow } = useInternalDynamicContext.useInternalDynamicContext();
|
|
115
|
+
const { pushView } = ViewContext.useViewContext();
|
|
126
116
|
const { t } = reactI18next.useTranslation();
|
|
127
|
-
const [
|
|
128
|
-
const
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
return false;
|
|
132
|
-
const walletCredential = (_a = user.verifiedCredentials) === null || _a === void 0 ? void 0 : _a.find((cred) => cred.walletName === 'dynamicwaas' &&
|
|
133
|
-
cred.address === primaryWallet.address);
|
|
134
|
-
const keyShares = (_b = walletCredential === null || walletCredential === void 0 ? void 0 : walletCredential.walletProperties) === null || _b === void 0 ? void 0 : _b.keyShares;
|
|
135
|
-
if (!keyShares || !Array.isArray(keyShares))
|
|
136
|
-
return false;
|
|
137
|
-
return keyShares.some((keyShare) => keyShare &&
|
|
138
|
-
typeof keyShare === 'object' &&
|
|
139
|
-
'backupLocation' in keyShare &&
|
|
140
|
-
keyShare.backupLocation === 'googleDrive');
|
|
141
|
-
}, [user, primaryWallet]);
|
|
142
|
-
const isBackedUp = React.useMemo(() => checkGoogleDriveBackup(), [checkGoogleDriveBackup]);
|
|
143
|
-
const handleBackClick = React.useCallback(() => setDynamicWidgetView('account-and-security-settings'), [setDynamicWidgetView]);
|
|
117
|
+
const [isAcknowledged, setIsAcknowledged] = React.useState(false);
|
|
118
|
+
const handleBackClick = React.useCallback(() => {
|
|
119
|
+
setShowAuthFlow(false);
|
|
120
|
+
}, [setShowAuthFlow]);
|
|
144
121
|
const handleInfoClick = React.useCallback(() => {
|
|
145
|
-
|
|
146
|
-
}, [
|
|
147
|
-
const
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
if (!isGoogleLinked) {
|
|
155
|
-
yield linkSocialAccount(sdkApiCore.ProviderEnum.Google, {
|
|
156
|
-
forcePopup: true,
|
|
157
|
-
showWidgetAfterConnection: false,
|
|
158
|
-
});
|
|
159
|
-
yield refresh();
|
|
160
|
-
if (!isLinked(sdkApiCore.ProviderEnum.Google)) {
|
|
161
|
-
return;
|
|
162
|
-
}
|
|
163
|
-
}
|
|
164
|
-
let waasConnector;
|
|
165
|
-
if (walletConnectorCore.isDynamicWaasConnector(primaryWallet.connector)) {
|
|
166
|
-
waasConnector = primaryWallet.connector;
|
|
167
|
-
}
|
|
168
|
-
else if (utils.isZeroDevConnector(primaryWallet.connector)) {
|
|
169
|
-
const { eoaConnector } = primaryWallet.connector;
|
|
170
|
-
if (!eoaConnector || !walletConnectorCore.isDynamicWaasConnector(eoaConnector)) {
|
|
171
|
-
throw new Error('ZeroDev connector must have a WaaS EOA connector');
|
|
172
|
-
}
|
|
173
|
-
waasConnector = eoaConnector;
|
|
174
|
-
}
|
|
175
|
-
else {
|
|
176
|
-
throw new Error('Not a supported connector type');
|
|
177
|
-
}
|
|
178
|
-
yield waasConnector.backupKeySharesToGoogleDrive({
|
|
179
|
-
accountAddress: primaryWallet.address,
|
|
180
|
-
});
|
|
181
|
-
yield refresh();
|
|
182
|
-
}
|
|
183
|
-
catch (error) {
|
|
184
|
-
logger.logger.warn('Error backing up wallet', { error });
|
|
185
|
-
setErrorMessage(t('dyn_waas.backup.error'));
|
|
186
|
-
}
|
|
187
|
-
}), [primaryWallet, refresh, isGoogleLinked, linkSocialAccount, t, isLinked]);
|
|
122
|
+
pushView('waas-backup-info-view');
|
|
123
|
+
}, [pushView]);
|
|
124
|
+
const handleContinueClick = React.useCallback(() => {
|
|
125
|
+
pushView('waas-backup-cloud-provider-view');
|
|
126
|
+
}, [pushView]);
|
|
127
|
+
const handleCheckboxChange = React.useCallback(() => {
|
|
128
|
+
setIsAcknowledged((prev) => !prev);
|
|
129
|
+
}, []);
|
|
130
|
+
const backButton = (jsxRuntime.jsx(IconButton.IconButton, { type: 'button', onClick: handleBackClick, "data-testid": 'back-button', children: jsxRuntime.jsx(chevronLeft.ReactComponent, {}) }));
|
|
188
131
|
const infoButton = (jsxRuntime.jsx(IconButton.IconButton, { type: 'button', onClick: handleInfoClick, "data-testid": 'info-button', children: jsxRuntime.jsx(questionMark.ReactComponent, {}) }));
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
weight: 'bold',
|
|
193
|
-
}, copykey: 'dyn_waas.backup.back_up', buttonPadding: 'small', children: t('dyn_waas.backup.back_up') }))] }) })] })] }) })] }));
|
|
132
|
+
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(ModalHeader.ModalHeader, { leading: backButton, trailing: infoButton, children: jsxRuntime.jsx(Typography.Typography, { variant: 'title', color: 'primary', copykey: 'dyn_waas.backup.title', children: t('dyn_waas.backup.title') }) }), jsxRuntime.jsx("div", { className: 'waas-backup-view', children: jsxRuntime.jsxs("div", { className: 'waas-backup-view__body', children: [jsxRuntime.jsx("div", { className: 'waas-backup-view__icon-container', children: jsxRuntime.jsx(Icon.Icon, { color: 'brand-primary', children: jsxRuntime.jsx(backupWaas.ReactComponent, { width: 64, height: 64 }) }) }), jsxRuntime.jsx(Typography.Typography, { variant: 'body_normal', color: 'primary', copykey: 'dyn_waas.backup.subtitle', className: 'waas-backup-view__subtitle', children: t('dyn_waas.backup.subtitle') }), jsxRuntime.jsx("div", { className: 'waas-backup-view__checkbox-container', children: jsxRuntime.jsxs("label", { className: 'waas-backup-view__checkbox-label', children: [jsxRuntime.jsx(Checkbox.Checkbox, { checked: isAcknowledged, onChange: handleCheckboxChange, ariaLabel: t('dyn_waas.backup.checkbox_label') }), jsxRuntime.jsx(Typography.Typography, { variant: 'body_normal', color: 'secondary', copykey: 'dyn_waas.backup.checkbox_label', children: t('dyn_waas.backup.checkbox_label') })] }) }), jsxRuntime.jsx("div", { className: 'waas-backup-view__actions', children: jsxRuntime.jsx(TypographyButton.TypographyButton, { dataTestId: 'continue-backup-button', onClick: handleContinueClick, disabled: !isAcknowledged, copykey: 'dyn_waas.backup.continue_button', buttonVariant: 'brand-primary', typographyProps: {
|
|
133
|
+
color: 'inherit',
|
|
134
|
+
}, expanded: true, children: t('dyn_waas.backup.continue_button') }) })] }) })] }));
|
|
194
135
|
};
|
|
195
136
|
|
|
196
137
|
exports.WaasBackupView = WaasBackupView;
|
|
@@ -1,46 +1,43 @@
|
|
|
1
1
|
'use client'
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { useState, useCallback, useMemo } from 'react';
|
|
2
|
+
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
3
|
+
import { useState, useCallback } from 'react';
|
|
5
4
|
import { useTranslation } from 'react-i18next';
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import '
|
|
9
|
-
import '../../../../
|
|
10
|
-
import '
|
|
11
|
-
import '../../../../
|
|
5
|
+
import { Checkbox } from '../../../../components/Checkbox/Checkbox.js';
|
|
6
|
+
import { Icon } from '../../../../components/Icon/Icon.js';
|
|
7
|
+
import { IconButton } from '../../../../components/IconButton/IconButton.js';
|
|
8
|
+
import { ModalHeader } from '../../../../components/ModalHeader/ModalHeader.js';
|
|
9
|
+
import { Typography } from '../../../../components/Typography/Typography.js';
|
|
10
|
+
import { TypographyButton } from '../../../../components/TypographyButton/TypographyButton.js';
|
|
11
|
+
import '../../../../context/DynamicContext/DynamicContext.js';
|
|
12
|
+
import '../../../../store/state/loadingAndLifecycle/loadingAndLifecycle.js';
|
|
12
13
|
import '@dynamic-labs/iconic';
|
|
13
|
-
import
|
|
14
|
-
import { ReactComponent as
|
|
14
|
+
import '@dynamic-labs/wallet-connector-core';
|
|
15
|
+
import { ReactComponent as SvgChevronLeft } from '../../../../shared/assets/chevron-left.js';
|
|
15
16
|
import { ReactComponent as SvgQuestionMark } from '../../../../shared/assets/question-mark.js';
|
|
16
|
-
import '../../../../context/ViewContext/ViewContext.js';
|
|
17
|
+
import { useViewContext } from '../../../../context/ViewContext/ViewContext.js';
|
|
17
18
|
import { ReactComponent as SvgBackupWaas } from '../../../../shared/assets/backup-waas.js';
|
|
18
|
-
import
|
|
19
|
-
import { logger } from '../../../../shared/logger.js';
|
|
19
|
+
import '../../../../shared/logger.js';
|
|
20
20
|
import '@dynamic-labs/wallet-book';
|
|
21
21
|
import '@dynamic-labs/utils';
|
|
22
22
|
import '../../../../utils/constants/colors.js';
|
|
23
23
|
import '../../../../utils/constants/values.js';
|
|
24
|
+
import '@dynamic-labs/sdk-api-core';
|
|
24
25
|
import '../../../../shared/consts/index.js';
|
|
26
|
+
import '../../../../events/dynamicEvents.js';
|
|
27
|
+
import '../../../../../../_virtual/_tslib.js';
|
|
28
|
+
import '../../../../context/CaptchaContext/CaptchaContext.js';
|
|
29
|
+
import '../../../../context/ErrorContext/ErrorContext.js';
|
|
25
30
|
import '@dynamic-labs/multi-wallet';
|
|
26
31
|
import 'react-international-phone';
|
|
27
32
|
import '../../../../store/state/nonce/nonce.js';
|
|
33
|
+
import '@dynamic-labs-sdk/client/core';
|
|
34
|
+
import '../../../../client/client.js';
|
|
35
|
+
import '@dynamic-labs-sdk/client';
|
|
36
|
+
import '../../../../config/ApiEndpoint.js';
|
|
28
37
|
import '@dynamic-labs/locale';
|
|
29
38
|
import '../../../../store/state/dynamicContextProps/dynamicContextProps.js';
|
|
30
39
|
import '../../../../store/state/primaryWalletId/primaryWalletId.js';
|
|
31
40
|
import '../../../../store/state/connectedWalletsInfo/connectedWalletsInfo.js';
|
|
32
|
-
import '../../../../events/dynamicEvents.js';
|
|
33
|
-
import { useUser } from '../../../../client/extension/user/useUser/useUser.js';
|
|
34
|
-
import { ErrorContainer } from '../../../../components/ErrorContainer/ErrorContainer.js';
|
|
35
|
-
import { Icon } from '../../../../components/Icon/Icon.js';
|
|
36
|
-
import { IconButton } from '../../../../components/IconButton/IconButton.js';
|
|
37
|
-
import { ModalHeader } from '../../../../components/ModalHeader/ModalHeader.js';
|
|
38
|
-
import { Typography } from '../../../../components/Typography/Typography.js';
|
|
39
|
-
import { TypographyButton } from '../../../../components/TypographyButton/TypographyButton.js';
|
|
40
|
-
import '../../../../context/DynamicContext/DynamicContext.js';
|
|
41
|
-
import '../../../../store/state/loadingAndLifecycle/loadingAndLifecycle.js';
|
|
42
|
-
import '../../../../context/CaptchaContext/CaptchaContext.js';
|
|
43
|
-
import '../../../../context/ErrorContext/ErrorContext.js';
|
|
44
41
|
import '../../../../context/AccessDeniedContext/AccessDeniedContext.js';
|
|
45
42
|
import '../../../../context/AccountExistsContext/AccountExistsContext.js';
|
|
46
43
|
import '../../../../context/UserWalletsContext/UserWalletsContext.js';
|
|
@@ -51,9 +48,12 @@ import '../../../../utils/functions/compareChains/compareChains.js';
|
|
|
51
48
|
import '../../../../views/Passkey/utils/findPrimaryEmbeddedChain/findPrimaryEmbeddedChain.js';
|
|
52
49
|
import '../../../../context/ThemeContext/ThemeContext.js';
|
|
53
50
|
import '../../../../utils/hooks/useUserUpdateRequest/useUpdateUser/userFieldsSchema.js';
|
|
54
|
-
import { isZeroDevConnector } from '../../../../utils/hooks/useTransactionSimulation/utils/utils.js';
|
|
55
51
|
import 'bs58';
|
|
56
|
-
import
|
|
52
|
+
import '@dynamic-labs/types';
|
|
53
|
+
import '../../../../context/SocialRedirectContext/SocialRedirectContext.js';
|
|
54
|
+
import '../../../../context/LoadingContext/LoadingContext.js';
|
|
55
|
+
import '../../../../context/WalletContext/WalletContext.js';
|
|
56
|
+
import '../../../../utils/hooks/useEmbeddedWallet/useSecureEnclaveEmbeddedWallet/constants.js';
|
|
57
57
|
import 'yup';
|
|
58
58
|
import '../../../../context/MockContext/MockContext.js';
|
|
59
59
|
import '../../../../views/CollectUserDataView/useFields.js';
|
|
@@ -63,7 +63,6 @@ import '@dynamic-labs/rpc-providers';
|
|
|
63
63
|
import '../../../../store/state/walletOptions/walletOptions.js';
|
|
64
64
|
import '../../../../components/Accordion/components/AccordionItem/AccordionItem.js';
|
|
65
65
|
import '../../../../components/Alert/Alert.js';
|
|
66
|
-
import '../../../../context/WalletContext/WalletContext.js';
|
|
67
66
|
import '../../../../components/ShadowDOM/ShadowDOM.js';
|
|
68
67
|
import '../../../../components/InlineWidget/InlineWidget.js';
|
|
69
68
|
import '../../../../components/Input/Input.js';
|
|
@@ -82,22 +81,17 @@ import 'formik';
|
|
|
82
81
|
import '../../../../utils/hooks/useSubdomainCheck/useSubdomainCheck.js';
|
|
83
82
|
import '../../../../context/WalletGroupContext/WalletGroupContext.js';
|
|
84
83
|
import '../../../../context/IpConfigurationContext/IpConfigurationContext.js';
|
|
85
|
-
import '../../../../context/SocialRedirectContext/SocialRedirectContext.js';
|
|
86
84
|
import '../../../../context/ConnectWithOtpContext/ConnectWithOtpContext.js';
|
|
87
85
|
import '../../../DynamicBridgeWidget/views/WalletsView/components/SecondaryWallets/SecondaryWallets.js';
|
|
88
86
|
import '@hcaptcha/react-hcaptcha';
|
|
89
|
-
import '
|
|
90
|
-
import { useWidgetContext } from '../../context/DynamicWidgetContext.js';
|
|
87
|
+
import '../../context/DynamicWidgetContext.js';
|
|
91
88
|
import '../../helpers/convertExchangeKeyAndProviderEnum.js';
|
|
92
89
|
import '../../../../views/ExchangeWhitelistWarning/ExchangeWhitelistWarning.js';
|
|
93
90
|
import '../../../../context/ErrorContext/hooks/useErrorText/useErrorText.js';
|
|
94
91
|
import '../../../../context/FooterAnimationContext/index.js';
|
|
95
|
-
import '@dynamic-labs/types';
|
|
96
|
-
import '../../../../utils/hooks/useEmbeddedWallet/useSecureEnclaveEmbeddedWallet/constants.js';
|
|
97
92
|
import '../../../../views/MfaChooseDeviceView/useGetMfaOptions/useGetMfaOptions.js';
|
|
98
93
|
import '../../../../context/PasskeyContext/PasskeyContext.js';
|
|
99
94
|
import '../../../../context/OnrampContext/OnrampContext.js';
|
|
100
|
-
import { useRefreshUser } from '../../../../utils/hooks/useRefreshUser/useRefreshUser.js';
|
|
101
95
|
import '../../../../store/state/sendBalances.js';
|
|
102
96
|
import '../../../../store/state/connectorsInitializing/connectorsInitializing.js';
|
|
103
97
|
import '../../../../components/OverlayCardBase/OverlayCardTarget/OverlayCardTarget.js';
|
|
@@ -113,80 +107,27 @@ import '../../../../shared/utils/functions/getInitialUrl/getInitialUrl.js';
|
|
|
113
107
|
import { useInternalDynamicContext } from '../../../../context/DynamicContext/useDynamicContext/useInternalDynamicContext/useInternalDynamicContext.js';
|
|
114
108
|
|
|
115
109
|
const WaasBackupView = () => {
|
|
116
|
-
|
|
117
|
-
const {
|
|
118
|
-
const user = useUser();
|
|
119
|
-
const { primaryWallet } = useInternalDynamicContext();
|
|
120
|
-
const refresh = useRefreshUser();
|
|
121
|
-
const { linkSocialAccount, isLinked, isProcessingForProvider, error: socialError, } = useSocialAccounts();
|
|
110
|
+
const { setShowAuthFlow } = useInternalDynamicContext();
|
|
111
|
+
const { pushView } = useViewContext();
|
|
122
112
|
const { t } = useTranslation();
|
|
123
|
-
const [
|
|
124
|
-
const
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
return false;
|
|
128
|
-
const walletCredential = (_a = user.verifiedCredentials) === null || _a === void 0 ? void 0 : _a.find((cred) => cred.walletName === 'dynamicwaas' &&
|
|
129
|
-
cred.address === primaryWallet.address);
|
|
130
|
-
const keyShares = (_b = walletCredential === null || walletCredential === void 0 ? void 0 : walletCredential.walletProperties) === null || _b === void 0 ? void 0 : _b.keyShares;
|
|
131
|
-
if (!keyShares || !Array.isArray(keyShares))
|
|
132
|
-
return false;
|
|
133
|
-
return keyShares.some((keyShare) => keyShare &&
|
|
134
|
-
typeof keyShare === 'object' &&
|
|
135
|
-
'backupLocation' in keyShare &&
|
|
136
|
-
keyShare.backupLocation === 'googleDrive');
|
|
137
|
-
}, [user, primaryWallet]);
|
|
138
|
-
const isBackedUp = useMemo(() => checkGoogleDriveBackup(), [checkGoogleDriveBackup]);
|
|
139
|
-
const handleBackClick = useCallback(() => setDynamicWidgetView('account-and-security-settings'), [setDynamicWidgetView]);
|
|
113
|
+
const [isAcknowledged, setIsAcknowledged] = useState(false);
|
|
114
|
+
const handleBackClick = useCallback(() => {
|
|
115
|
+
setShowAuthFlow(false);
|
|
116
|
+
}, [setShowAuthFlow]);
|
|
140
117
|
const handleInfoClick = useCallback(() => {
|
|
141
|
-
|
|
142
|
-
}, [
|
|
143
|
-
const
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
if (!isGoogleLinked) {
|
|
151
|
-
yield linkSocialAccount(ProviderEnum.Google, {
|
|
152
|
-
forcePopup: true,
|
|
153
|
-
showWidgetAfterConnection: false,
|
|
154
|
-
});
|
|
155
|
-
yield refresh();
|
|
156
|
-
if (!isLinked(ProviderEnum.Google)) {
|
|
157
|
-
return;
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
let waasConnector;
|
|
161
|
-
if (isDynamicWaasConnector(primaryWallet.connector)) {
|
|
162
|
-
waasConnector = primaryWallet.connector;
|
|
163
|
-
}
|
|
164
|
-
else if (isZeroDevConnector(primaryWallet.connector)) {
|
|
165
|
-
const { eoaConnector } = primaryWallet.connector;
|
|
166
|
-
if (!eoaConnector || !isDynamicWaasConnector(eoaConnector)) {
|
|
167
|
-
throw new Error('ZeroDev connector must have a WaaS EOA connector');
|
|
168
|
-
}
|
|
169
|
-
waasConnector = eoaConnector;
|
|
170
|
-
}
|
|
171
|
-
else {
|
|
172
|
-
throw new Error('Not a supported connector type');
|
|
173
|
-
}
|
|
174
|
-
yield waasConnector.backupKeySharesToGoogleDrive({
|
|
175
|
-
accountAddress: primaryWallet.address,
|
|
176
|
-
});
|
|
177
|
-
yield refresh();
|
|
178
|
-
}
|
|
179
|
-
catch (error) {
|
|
180
|
-
logger.warn('Error backing up wallet', { error });
|
|
181
|
-
setErrorMessage(t('dyn_waas.backup.error'));
|
|
182
|
-
}
|
|
183
|
-
}), [primaryWallet, refresh, isGoogleLinked, linkSocialAccount, t, isLinked]);
|
|
118
|
+
pushView('waas-backup-info-view');
|
|
119
|
+
}, [pushView]);
|
|
120
|
+
const handleContinueClick = useCallback(() => {
|
|
121
|
+
pushView('waas-backup-cloud-provider-view');
|
|
122
|
+
}, [pushView]);
|
|
123
|
+
const handleCheckboxChange = useCallback(() => {
|
|
124
|
+
setIsAcknowledged((prev) => !prev);
|
|
125
|
+
}, []);
|
|
126
|
+
const backButton = (jsx(IconButton, { type: 'button', onClick: handleBackClick, "data-testid": 'back-button', children: jsx(SvgChevronLeft, {}) }));
|
|
184
127
|
const infoButton = (jsx(IconButton, { type: 'button', onClick: handleInfoClick, "data-testid": 'info-button', children: jsx(SvgQuestionMark, {}) }));
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
weight: 'bold',
|
|
189
|
-
}, copykey: 'dyn_waas.backup.back_up', buttonPadding: 'small', children: t('dyn_waas.backup.back_up') }))] }) })] })] }) })] }));
|
|
128
|
+
return (jsxs(Fragment, { children: [jsx(ModalHeader, { leading: backButton, trailing: infoButton, children: jsx(Typography, { variant: 'title', color: 'primary', copykey: 'dyn_waas.backup.title', children: t('dyn_waas.backup.title') }) }), jsx("div", { className: 'waas-backup-view', children: jsxs("div", { className: 'waas-backup-view__body', children: [jsx("div", { className: 'waas-backup-view__icon-container', children: jsx(Icon, { color: 'brand-primary', children: jsx(SvgBackupWaas, { width: 64, height: 64 }) }) }), jsx(Typography, { variant: 'body_normal', color: 'primary', copykey: 'dyn_waas.backup.subtitle', className: 'waas-backup-view__subtitle', children: t('dyn_waas.backup.subtitle') }), jsx("div", { className: 'waas-backup-view__checkbox-container', children: jsxs("label", { className: 'waas-backup-view__checkbox-label', children: [jsx(Checkbox, { checked: isAcknowledged, onChange: handleCheckboxChange, ariaLabel: t('dyn_waas.backup.checkbox_label') }), jsx(Typography, { variant: 'body_normal', color: 'secondary', copykey: 'dyn_waas.backup.checkbox_label', children: t('dyn_waas.backup.checkbox_label') })] }) }), jsx("div", { className: 'waas-backup-view__actions', children: jsx(TypographyButton, { dataTestId: 'continue-backup-button', onClick: handleContinueClick, disabled: !isAcknowledged, copykey: 'dyn_waas.backup.continue_button', buttonVariant: 'brand-primary', typographyProps: {
|
|
129
|
+
color: 'inherit',
|
|
130
|
+
}, expanded: true, children: t('dyn_waas.backup.continue_button') }) })] }) })] }));
|
|
190
131
|
};
|
|
191
132
|
|
|
192
133
|
export { WaasBackupView };
|
|
@@ -1,2 +1,7 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { BackupStepper } from './BackupStepper';
|
|
2
|
+
export { WaasBackupCloudProviderView } from './WaasBackupCloudProviderView';
|
|
3
|
+
export { WaasBackupDownloadView } from './WaasBackupDownloadView';
|
|
2
4
|
export { WaasBackupInfoView } from './WaasBackupInfoView';
|
|
5
|
+
export { WaasBackupProgressView } from './WaasBackupProgressView';
|
|
6
|
+
export { WaasBackupSuccessView } from './WaasBackupSuccessView';
|
|
7
|
+
export { WaasBackupView } from './WaasBackupView';
|