@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,33 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
3
|
+
import 'react';
|
|
4
|
+
import { ReactComponent as SvgCheck } from '../../../../shared/assets/check.js';
|
|
5
|
+
import '@dynamic-labs/iconic';
|
|
6
|
+
import '../../../../context/ViewContext/ViewContext.js';
|
|
7
|
+
|
|
8
|
+
const STEPS = ['Cloud Backup', 'Download'];
|
|
9
|
+
const BackupStepper = ({ currentStep, completedSteps, }) => {
|
|
10
|
+
const getStepClassName = (index) => {
|
|
11
|
+
const classes = ['waas-backup-view__step'];
|
|
12
|
+
if (index < completedSteps) {
|
|
13
|
+
classes.push('waas-backup-view__step--completed');
|
|
14
|
+
}
|
|
15
|
+
else if (index === currentStep) {
|
|
16
|
+
classes.push('waas-backup-view__step--current');
|
|
17
|
+
}
|
|
18
|
+
else {
|
|
19
|
+
classes.push('waas-backup-view__step--upcoming');
|
|
20
|
+
}
|
|
21
|
+
return classes.join(' ');
|
|
22
|
+
};
|
|
23
|
+
const getSeparatorClassName = () => {
|
|
24
|
+
const classes = ['waas-backup-view__step-separator'];
|
|
25
|
+
if (completedSteps >= 1) {
|
|
26
|
+
classes.push('waas-backup-view__step-separator--solid');
|
|
27
|
+
}
|
|
28
|
+
return classes.join(' ');
|
|
29
|
+
};
|
|
30
|
+
return (jsx("div", { className: 'waas-backup-view__stepper', children: STEPS.map((step, index) => (jsxs("div", { className: 'waas-backup-view__step-container', children: [jsx("div", { className: getStepClassName(index), children: jsx("div", { className: 'waas-backup-view__step-indicator', children: index < completedSteps ? (jsx(SvgCheck, { className: 'waas-backup-view__step-check' })) : (jsx("div", { className: 'waas-backup-view__step-number', children: index + 1 })) }) }), index < STEPS.length - 1 && (jsx("div", { className: getSeparatorClassName() }))] }, step))) }));
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
export { BackupStepper };
|
|
@@ -0,0 +1,49 @@
|
|
|
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 sdkApiCore = require('@dynamic-labs/sdk-api-core');
|
|
11
|
+
var ErrorContainer = require('../../../../components/ErrorContainer/ErrorContainer.cjs');
|
|
12
|
+
var IconButton = require('../../../../components/IconButton/IconButton.cjs');
|
|
13
|
+
var ModalHeader = require('../../../../components/ModalHeader/ModalHeader.cjs');
|
|
14
|
+
var Typography = require('../../../../components/Typography/Typography.cjs');
|
|
15
|
+
var ViewContext = require('../../../../context/ViewContext/ViewContext.cjs');
|
|
16
|
+
var chevronLeft = require('../../../../shared/assets/chevron-left.cjs');
|
|
17
|
+
var questionMark = require('../../../../shared/assets/question-mark.cjs');
|
|
18
|
+
require('@dynamic-labs/iconic');
|
|
19
|
+
var googleDrive = require('../../../../shared/assets/google-drive.cjs');
|
|
20
|
+
var useSocialAccounts = require('../../../../utils/hooks/useSocialAccounts/useSocialAccounts.cjs');
|
|
21
|
+
var useWalletBackup = require('../../../../utils/hooks/useWalletBackup/useWalletBackup.cjs');
|
|
22
|
+
var BackupStepper = require('./BackupStepper.cjs');
|
|
23
|
+
|
|
24
|
+
const WaasBackupCloudProviderView = () => {
|
|
25
|
+
var _a;
|
|
26
|
+
const { pushView, goBack } = ViewContext.useViewContext();
|
|
27
|
+
const { t } = reactI18next.useTranslation();
|
|
28
|
+
const { isProcessingForProvider, error: socialError } = useSocialAccounts.useSocialAccounts();
|
|
29
|
+
const { ensureGoogleLinked } = useWalletBackup.useWalletBackup();
|
|
30
|
+
const [errorMessage, setErrorMessage] = React.useState(null);
|
|
31
|
+
const handleBackClick = React.useCallback(() => goBack(), [goBack]);
|
|
32
|
+
const handleInfoClick = React.useCallback(() => {
|
|
33
|
+
pushView('waas-backup-info-view');
|
|
34
|
+
}, [pushView]);
|
|
35
|
+
const handleGoogleDriveClick = React.useCallback(() => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
36
|
+
setErrorMessage(null);
|
|
37
|
+
const isLinked = yield ensureGoogleLinked();
|
|
38
|
+
if (!isLinked) {
|
|
39
|
+
setErrorMessage(t('dyn_waas.backup.error'));
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
pushView('waas-backup-progress-view');
|
|
43
|
+
}), [ensureGoogleLinked, pushView, t]);
|
|
44
|
+
const backButton = (jsxRuntime.jsx(IconButton.IconButton, { type: 'button', onClick: handleBackClick, "data-testid": 'back-button', children: jsxRuntime.jsx(chevronLeft.ReactComponent, {}) }));
|
|
45
|
+
const infoButton = (jsxRuntime.jsx(IconButton.IconButton, { type: 'button', onClick: handleInfoClick, "data-testid": 'info-button', children: jsxRuntime.jsx(questionMark.ReactComponent, {}) }));
|
|
46
|
+
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(BackupStepper.BackupStepper, { currentStep: 0, completedSteps: 0 }), (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.jsx(Typography.Typography, { variant: 'title', color: 'primary', copykey: 'dyn_waas.backup.cloud_backup_title', className: 'waas-backup-view__cloud-title', children: t('dyn_waas.backup.cloud_backup_title', '1. Cloud Backup') }), jsxRuntime.jsx(Typography.Typography, { variant: 'body_normal', color: 'secondary', copykey: 'dyn_waas.backup.cloud_backup_subtitle', className: 'waas-backup-view__cloud-subtitle', children: t('dyn_waas.backup.cloud_backup_subtitle', 'Back up your first key share to a cloud provider') }), jsxRuntime.jsxs("button", { type: 'button', className: 'waas-backup-view__provider-button', onClick: handleGoogleDriveClick, disabled: isProcessingForProvider(sdkApiCore.ProviderEnum.Google), "data-testid": 'google-drive-button', children: [jsxRuntime.jsx(googleDrive.ReactComponent, { className: 'waas-backup-view__provider-icon' }), jsxRuntime.jsx(Typography.Typography, { variant: 'body_normal', color: 'primary', copykey: 'dyn_waas.backup.backup_to_google_drive', children: t('dyn_waas.backup.backup_to_google_drive', 'Backup to Google Drive') })] })] }) })] }));
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
exports.WaasBackupCloudProviderView = WaasBackupCloudProviderView;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
import { __awaiter } from '../../../../../../_virtual/_tslib.js';
|
|
3
|
+
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
4
|
+
import { useState, useCallback } from 'react';
|
|
5
|
+
import { useTranslation } from 'react-i18next';
|
|
6
|
+
import { ProviderEnum } from '@dynamic-labs/sdk-api-core';
|
|
7
|
+
import { ErrorContainer } from '../../../../components/ErrorContainer/ErrorContainer.js';
|
|
8
|
+
import { IconButton } from '../../../../components/IconButton/IconButton.js';
|
|
9
|
+
import { ModalHeader } from '../../../../components/ModalHeader/ModalHeader.js';
|
|
10
|
+
import { Typography } from '../../../../components/Typography/Typography.js';
|
|
11
|
+
import { useViewContext } from '../../../../context/ViewContext/ViewContext.js';
|
|
12
|
+
import { ReactComponent as SvgChevronLeft } from '../../../../shared/assets/chevron-left.js';
|
|
13
|
+
import { ReactComponent as SvgQuestionMark } from '../../../../shared/assets/question-mark.js';
|
|
14
|
+
import '@dynamic-labs/iconic';
|
|
15
|
+
import { ReactComponent as SvgGoogleDrive } from '../../../../shared/assets/google-drive.js';
|
|
16
|
+
import { useSocialAccounts } from '../../../../utils/hooks/useSocialAccounts/useSocialAccounts.js';
|
|
17
|
+
import { useWalletBackup } from '../../../../utils/hooks/useWalletBackup/useWalletBackup.js';
|
|
18
|
+
import { BackupStepper } from './BackupStepper.js';
|
|
19
|
+
|
|
20
|
+
const WaasBackupCloudProviderView = () => {
|
|
21
|
+
var _a;
|
|
22
|
+
const { pushView, goBack } = useViewContext();
|
|
23
|
+
const { t } = useTranslation();
|
|
24
|
+
const { isProcessingForProvider, error: socialError } = useSocialAccounts();
|
|
25
|
+
const { ensureGoogleLinked } = useWalletBackup();
|
|
26
|
+
const [errorMessage, setErrorMessage] = useState(null);
|
|
27
|
+
const handleBackClick = useCallback(() => goBack(), [goBack]);
|
|
28
|
+
const handleInfoClick = useCallback(() => {
|
|
29
|
+
pushView('waas-backup-info-view');
|
|
30
|
+
}, [pushView]);
|
|
31
|
+
const handleGoogleDriveClick = useCallback(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
32
|
+
setErrorMessage(null);
|
|
33
|
+
const isLinked = yield ensureGoogleLinked();
|
|
34
|
+
if (!isLinked) {
|
|
35
|
+
setErrorMessage(t('dyn_waas.backup.error'));
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
pushView('waas-backup-progress-view');
|
|
39
|
+
}), [ensureGoogleLinked, pushView, t]);
|
|
40
|
+
const backButton = (jsx(IconButton, { type: 'button', onClick: handleBackClick, "data-testid": 'back-button', children: jsx(SvgChevronLeft, {}) }));
|
|
41
|
+
const infoButton = (jsx(IconButton, { type: 'button', onClick: handleInfoClick, "data-testid": 'info-button', children: jsx(SvgQuestionMark, {}) }));
|
|
42
|
+
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(BackupStepper, { currentStep: 0, completedSteps: 0 }), (errorMessage || socialError) && (jsx(ErrorContainer, { variant: 'error', withIcon: false, children: (_a = socialError === null || socialError === void 0 ? void 0 : socialError.message) !== null && _a !== void 0 ? _a : errorMessage })), jsx(Typography, { variant: 'title', color: 'primary', copykey: 'dyn_waas.backup.cloud_backup_title', className: 'waas-backup-view__cloud-title', children: t('dyn_waas.backup.cloud_backup_title', '1. Cloud Backup') }), jsx(Typography, { variant: 'body_normal', color: 'secondary', copykey: 'dyn_waas.backup.cloud_backup_subtitle', className: 'waas-backup-view__cloud-subtitle', children: t('dyn_waas.backup.cloud_backup_subtitle', 'Back up your first key share to a cloud provider') }), jsxs("button", { type: 'button', className: 'waas-backup-view__provider-button', onClick: handleGoogleDriveClick, disabled: isProcessingForProvider(ProviderEnum.Google), "data-testid": 'google-drive-button', children: [jsx(SvgGoogleDrive, { className: 'waas-backup-view__provider-icon' }), jsx(Typography, { variant: 'body_normal', color: 'primary', copykey: 'dyn_waas.backup.backup_to_google_drive', children: t('dyn_waas.backup.backup_to_google_drive', 'Backup to Google Drive') })] })] }) })] }));
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
export { WaasBackupCloudProviderView };
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
|
+
|
|
6
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
7
|
+
var React = require('react');
|
|
8
|
+
var reactI18next = require('react-i18next');
|
|
9
|
+
var ErrorContainer = require('../../../../components/ErrorContainer/ErrorContainer.cjs');
|
|
10
|
+
var IconButton = require('../../../../components/IconButton/IconButton.cjs');
|
|
11
|
+
var ModalHeader = require('../../../../components/ModalHeader/ModalHeader.cjs');
|
|
12
|
+
var Typography = require('../../../../components/Typography/Typography.cjs');
|
|
13
|
+
var TypographyButton = require('../../../../components/TypographyButton/TypographyButton.cjs');
|
|
14
|
+
var ViewContext = require('../../../../context/ViewContext/ViewContext.cjs');
|
|
15
|
+
var check = require('../../../../shared/assets/check.cjs');
|
|
16
|
+
var download = require('../../../../shared/assets/download.cjs');
|
|
17
|
+
var questionMark = require('../../../../shared/assets/question-mark.cjs');
|
|
18
|
+
require('@dynamic-labs/iconic');
|
|
19
|
+
var useWalletBackup = require('../../../../utils/hooks/useWalletBackup/useWalletBackup.cjs');
|
|
20
|
+
var BackupStepper = require('./BackupStepper.cjs');
|
|
21
|
+
|
|
22
|
+
const WaasBackupDownloadView = () => {
|
|
23
|
+
const { pushView } = ViewContext.useViewContext();
|
|
24
|
+
const { t } = reactI18next.useTranslation();
|
|
25
|
+
const handleComplete = React.useCallback((walletCount) => {
|
|
26
|
+
pushView('waas-backup-success-view', { walletCount });
|
|
27
|
+
}, [pushView]);
|
|
28
|
+
const { currentIndex, hasError, isComplete, isProcessing, retry, startDownload, totalWallets, } = useWalletBackup.useDownloadKeyShares(handleComplete);
|
|
29
|
+
const handleInfoClick = React.useCallback(() => {
|
|
30
|
+
pushView('waas-backup-info-view');
|
|
31
|
+
}, [pushView]);
|
|
32
|
+
const infoButton = (jsxRuntime.jsx(IconButton.IconButton, { type: 'button', onClick: handleInfoClick, "data-testid": 'info-button', children: jsxRuntime.jsx(questionMark.ReactComponent, {}) }));
|
|
33
|
+
const getButtonContent = () => {
|
|
34
|
+
if (isComplete) {
|
|
35
|
+
return (jsxRuntime.jsxs("span", { className: 'waas-backup-view__download-button-content', children: [jsxRuntime.jsx(check.ReactComponent, { className: 'waas-backup-view__download-icon' }), t('dyn_waas.backup.download_complete')] }));
|
|
36
|
+
}
|
|
37
|
+
if (isProcessing) {
|
|
38
|
+
return (jsxRuntime.jsxs("span", { className: 'waas-backup-view__download-button-content', children: [jsxRuntime.jsx(download.ReactComponent, { className: 'waas-backup-view__download-icon' }), t('dyn_waas.backup.downloading', {
|
|
39
|
+
current: currentIndex,
|
|
40
|
+
total: totalWallets,
|
|
41
|
+
})] }));
|
|
42
|
+
}
|
|
43
|
+
if (hasError) {
|
|
44
|
+
return t('dyn_waas.backup.error_try_again');
|
|
45
|
+
}
|
|
46
|
+
return t('dyn_waas.backup.download_key_share');
|
|
47
|
+
};
|
|
48
|
+
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(ModalHeader.ModalHeader, { 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(BackupStepper.BackupStepper, { currentStep: 1, completedSteps: 1 }), hasError && (jsxRuntime.jsx(ErrorContainer.ErrorContainer, { variant: 'error', withIcon: false, children: t('dyn_waas.backup.download_error') })), jsxRuntime.jsx(Typography.Typography, { variant: 'title', color: 'primary', copykey: 'dyn_waas.backup.download_title', className: 'waas-backup-view__cloud-title', children: t('dyn_waas.backup.download_title') }), jsxRuntime.jsx(Typography.Typography, { variant: 'body_normal', color: 'secondary', copykey: 'dyn_waas.backup.download_subtitle', className: 'waas-backup-view__cloud-subtitle', children: t('dyn_waas.backup.download_subtitle') }), jsxRuntime.jsx(TypographyButton.TypographyButton, { dataTestId: 'download-key-share-button', onClick: hasError ? retry : startDownload, disabled: isProcessing || isComplete, buttonVariant: isProcessing || isComplete ? 'secondary' : 'brand-primary', typographyProps: {
|
|
49
|
+
color: 'inherit',
|
|
50
|
+
}, expanded: true, children: getButtonContent() })] }) })] }));
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
exports.WaasBackupDownloadView = WaasBackupDownloadView;
|
|
@@ -0,0 +1,49 @@
|
|
|
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 { ErrorContainer } from '../../../../components/ErrorContainer/ErrorContainer.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 { useViewContext } from '../../../../context/ViewContext/ViewContext.js';
|
|
11
|
+
import { ReactComponent as SvgCheck } from '../../../../shared/assets/check.js';
|
|
12
|
+
import { ReactComponent as SvgDownload } from '../../../../shared/assets/download.js';
|
|
13
|
+
import { ReactComponent as SvgQuestionMark } from '../../../../shared/assets/question-mark.js';
|
|
14
|
+
import '@dynamic-labs/iconic';
|
|
15
|
+
import { useDownloadKeyShares } from '../../../../utils/hooks/useWalletBackup/useWalletBackup.js';
|
|
16
|
+
import { BackupStepper } from './BackupStepper.js';
|
|
17
|
+
|
|
18
|
+
const WaasBackupDownloadView = () => {
|
|
19
|
+
const { pushView } = useViewContext();
|
|
20
|
+
const { t } = useTranslation();
|
|
21
|
+
const handleComplete = useCallback((walletCount) => {
|
|
22
|
+
pushView('waas-backup-success-view', { walletCount });
|
|
23
|
+
}, [pushView]);
|
|
24
|
+
const { currentIndex, hasError, isComplete, isProcessing, retry, startDownload, totalWallets, } = useDownloadKeyShares(handleComplete);
|
|
25
|
+
const handleInfoClick = useCallback(() => {
|
|
26
|
+
pushView('waas-backup-info-view');
|
|
27
|
+
}, [pushView]);
|
|
28
|
+
const infoButton = (jsx(IconButton, { type: 'button', onClick: handleInfoClick, "data-testid": 'info-button', children: jsx(SvgQuestionMark, {}) }));
|
|
29
|
+
const getButtonContent = () => {
|
|
30
|
+
if (isComplete) {
|
|
31
|
+
return (jsxs("span", { className: 'waas-backup-view__download-button-content', children: [jsx(SvgCheck, { className: 'waas-backup-view__download-icon' }), t('dyn_waas.backup.download_complete')] }));
|
|
32
|
+
}
|
|
33
|
+
if (isProcessing) {
|
|
34
|
+
return (jsxs("span", { className: 'waas-backup-view__download-button-content', children: [jsx(SvgDownload, { className: 'waas-backup-view__download-icon' }), t('dyn_waas.backup.downloading', {
|
|
35
|
+
current: currentIndex,
|
|
36
|
+
total: totalWallets,
|
|
37
|
+
})] }));
|
|
38
|
+
}
|
|
39
|
+
if (hasError) {
|
|
40
|
+
return t('dyn_waas.backup.error_try_again');
|
|
41
|
+
}
|
|
42
|
+
return t('dyn_waas.backup.download_key_share');
|
|
43
|
+
};
|
|
44
|
+
return (jsxs(Fragment, { children: [jsx(ModalHeader, { 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(BackupStepper, { currentStep: 1, completedSteps: 1 }), hasError && (jsx(ErrorContainer, { variant: 'error', withIcon: false, children: t('dyn_waas.backup.download_error') })), jsx(Typography, { variant: 'title', color: 'primary', copykey: 'dyn_waas.backup.download_title', className: 'waas-backup-view__cloud-title', children: t('dyn_waas.backup.download_title') }), jsx(Typography, { variant: 'body_normal', color: 'secondary', copykey: 'dyn_waas.backup.download_subtitle', className: 'waas-backup-view__cloud-subtitle', children: t('dyn_waas.backup.download_subtitle') }), jsx(TypographyButton, { dataTestId: 'download-key-share-button', onClick: hasError ? retry : startDownload, disabled: isProcessing || isComplete, buttonVariant: isProcessing || isComplete ? 'secondary' : 'brand-primary', typographyProps: {
|
|
45
|
+
color: 'inherit',
|
|
46
|
+
}, expanded: true, children: getButtonContent() })] }) })] }));
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
export { WaasBackupDownloadView };
|
|
@@ -6,31 +6,22 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
6
6
|
var jsxRuntime = require('react/jsx-runtime');
|
|
7
7
|
var React = require('react');
|
|
8
8
|
var reactI18next = require('react-i18next');
|
|
9
|
-
var
|
|
10
|
-
var TypographyButton = require('../../../../components/TypographyButton/TypographyButton.cjs');
|
|
9
|
+
var Icon = require('../../../../components/Icon/Icon.cjs');
|
|
11
10
|
var IconButton = require('../../../../components/IconButton/IconButton.cjs');
|
|
12
11
|
var ModalHeader = require('../../../../components/ModalHeader/ModalHeader.cjs');
|
|
13
|
-
var
|
|
14
|
-
var
|
|
15
|
-
var
|
|
16
|
-
var
|
|
12
|
+
var Typography = require('../../../../components/Typography/Typography.cjs');
|
|
13
|
+
var ViewContext = require('../../../../context/ViewContext/ViewContext.cjs');
|
|
14
|
+
var cautionTriangle = require('../../../../shared/assets/caution-triangle.cjs');
|
|
15
|
+
var chevronLeft = require('../../../../shared/assets/chevron-left.cjs');
|
|
17
16
|
require('@dynamic-labs/iconic');
|
|
18
|
-
require('../../../../context/ViewContext/ViewContext.cjs');
|
|
19
17
|
var filledQuestionMark = require('../../../../shared/assets/filled-question-mark.cjs');
|
|
20
|
-
var DynamicWidgetContext = require('../../context/DynamicWidgetContext.cjs');
|
|
21
18
|
|
|
22
19
|
const WaasBackupInfoView = () => {
|
|
23
|
-
const {
|
|
20
|
+
const { goBack } = ViewContext.useViewContext();
|
|
24
21
|
const { t } = reactI18next.useTranslation();
|
|
25
|
-
const handleBackClick = React.useCallback(() =>
|
|
26
|
-
const
|
|
27
|
-
|
|
28
|
-
return (jsxRuntime.jsxs("div", { className: 'waas-backup-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_waas.backup_info.title', children: t('dyn_waas.backup_info.title', 'Why backup a share') }) }) }), jsxRuntime.jsx("div", { className: 'account-wrap', children: jsxRuntime.jsx("div", { className: 'settings-view__body', children: 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(filledQuestionMark.ReactComponent, { width: 64, height: 64 }) }) }), jsxRuntime.jsx(Typography.Typography, { variant: 'body_normal', color: 'primary', copykey: 'dyn_waas.backup_info.description', children: t('dyn_waas.backup_info.description', 'Your account uses strong security behind the scenes. Backing up a share adds additional security to your account by requiring the share to be retrieved if your account is used on another device.') }), jsxRuntime.jsx(Typography.Typography, { variant: 'body_normal', color: 'primary', copykey: 'dyn_waas.backup_info.storage', children: t('dyn_waas.backup_info.storage', 'You can store this backup share in a secure cloud.') }), jsxRuntime.jsx(Alert.Alert, { icon:
|
|
29
|
-
// eslint-disable-next-line react/jsx-wrap-multilines
|
|
30
|
-
jsxRuntime.jsx(Icon.Icon, { size: 'medium', children: jsxRuntime.jsx(footerInfoIcon.ReactComponent, { width: 24, height: 24 }) }), variant: 'warning', copykey: 'dyn_waas.backup_info.warning_alert', children: jsxRuntime.jsxs(Typography.Typography, { variant: 'body_small', color: 'current-color', children: [jsxRuntime.jsx(Typography.Typography, { variant: 'body_normal', copykey: 'dyn_waas.backup_info.important', style: { color: 'var(--default-alert-1, #DD8500)' }, children: t('dyn_waas.backup_info.important', 'Important') }), jsxRuntime.jsx(Typography.Typography, { variant: 'body_normal', color: 'secondary', copykey: 'dyn_waas.backup_info.warning', children: t('dyn_waas.backup_info.warning', "Make sure you don't lose access to the backup share or you will not be able to restore this account!") })] }) }), jsxRuntime.jsx("div", { className: 'backup-actions', children: jsxRuntime.jsx(TypographyButton.TypographyButton, { dataTestId: 'back-button', onClick: handleBackClick, buttonClassName: 'backup-button', typographyProps: {
|
|
31
|
-
color: 'primary',
|
|
32
|
-
weight: 'bold',
|
|
33
|
-
}, copykey: 'dyn_waas.backup_info.back', buttonPadding: 'small', children: t('dyn_waas.backup_info.back', 'Back') }) })] }) }) })] }));
|
|
22
|
+
const handleBackClick = React.useCallback(() => goBack(), [goBack]);
|
|
23
|
+
const backButton = (jsxRuntime.jsx(IconButton.IconButton, { type: 'button', onClick: handleBackClick, "data-testid": 'back-button', children: jsxRuntime.jsx(chevronLeft.ReactComponent, {}) }));
|
|
24
|
+
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(ModalHeader.ModalHeader, { leading: backButton, children: jsxRuntime.jsx(Typography.Typography, { variant: 'title', color: 'primary', copykey: 'dyn_waas.backup_info.title', children: t('dyn_waas.backup_info.title') }) }), jsxRuntime.jsx("div", { className: 'waas-backup-view', children: jsxRuntime.jsxs("div", { className: 'waas-backup-view__info', children: [jsxRuntime.jsx("div", { className: 'waas-backup-view__info-icon', children: jsxRuntime.jsx(Icon.Icon, { color: 'brand-primary', children: jsxRuntime.jsx(filledQuestionMark.ReactComponent, { width: 64, height: 64 }) }) }), jsxRuntime.jsx(Typography.Typography, { variant: 'body_normal', weight: 'medium', color: 'primary', copykey: 'dyn_waas.backup_info.subtitle', className: 'waas-backup-view__info-subtitle', children: t('dyn_waas.backup_info.subtitle') }), jsxRuntime.jsx(Typography.Typography, { variant: 'body_normal', color: 'secondary', copykey: 'dyn_waas.backup_info.description', className: 'waas-backup-view__info-description', children: t('dyn_waas.backup_info.description') }), jsxRuntime.jsxs("div", { className: 'waas-backup-view__info-alert', children: [jsxRuntime.jsx(cautionTriangle.ReactComponent, { className: 'waas-backup-view__info-alert-icon' }), jsxRuntime.jsx(Typography.Typography, { variant: 'body_small', color: 'secondary', children: t('dyn_waas.backup_info.warning') })] })] }) })] }));
|
|
34
25
|
};
|
|
35
26
|
|
|
36
27
|
exports.WaasBackupInfoView = WaasBackupInfoView;
|
|
@@ -1,32 +1,23 @@
|
|
|
1
1
|
'use client'
|
|
2
|
-
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
2
|
+
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
3
3
|
import { useCallback } from 'react';
|
|
4
4
|
import { useTranslation } from 'react-i18next';
|
|
5
|
-
import {
|
|
6
|
-
import { TypographyButton } from '../../../../components/TypographyButton/TypographyButton.js';
|
|
5
|
+
import { Icon } from '../../../../components/Icon/Icon.js';
|
|
7
6
|
import { IconButton } from '../../../../components/IconButton/IconButton.js';
|
|
8
7
|
import { ModalHeader } from '../../../../components/ModalHeader/ModalHeader.js';
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import { ReactComponent as
|
|
12
|
-
import { ReactComponent as
|
|
8
|
+
import { Typography } from '../../../../components/Typography/Typography.js';
|
|
9
|
+
import { useViewContext } from '../../../../context/ViewContext/ViewContext.js';
|
|
10
|
+
import { ReactComponent as SvgCautionTriangle } from '../../../../shared/assets/caution-triangle.js';
|
|
11
|
+
import { ReactComponent as SvgChevronLeft } from '../../../../shared/assets/chevron-left.js';
|
|
13
12
|
import '@dynamic-labs/iconic';
|
|
14
|
-
import '../../../../context/ViewContext/ViewContext.js';
|
|
15
13
|
import { ReactComponent as SvgFilledQuestionMark } from '../../../../shared/assets/filled-question-mark.js';
|
|
16
|
-
import { useWidgetContext } from '../../context/DynamicWidgetContext.js';
|
|
17
14
|
|
|
18
15
|
const WaasBackupInfoView = () => {
|
|
19
|
-
const {
|
|
16
|
+
const { goBack } = useViewContext();
|
|
20
17
|
const { t } = useTranslation();
|
|
21
|
-
const handleBackClick = useCallback(() =>
|
|
22
|
-
const
|
|
23
|
-
|
|
24
|
-
return (jsxs("div", { className: 'waas-backup-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_waas.backup_info.title', children: t('dyn_waas.backup_info.title', 'Why backup a share') }) }) }), jsx("div", { className: 'account-wrap', children: jsx("div", { className: 'settings-view__body', children: jsxs("div", { className: 'backup-content', children: [jsx("div", { className: 'backup-icon-container', children: jsx(Icon, { color: 'brand-primary', children: jsx(SvgFilledQuestionMark, { width: 64, height: 64 }) }) }), jsx(Typography, { variant: 'body_normal', color: 'primary', copykey: 'dyn_waas.backup_info.description', children: t('dyn_waas.backup_info.description', 'Your account uses strong security behind the scenes. Backing up a share adds additional security to your account by requiring the share to be retrieved if your account is used on another device.') }), jsx(Typography, { variant: 'body_normal', color: 'primary', copykey: 'dyn_waas.backup_info.storage', children: t('dyn_waas.backup_info.storage', 'You can store this backup share in a secure cloud.') }), jsx(Alert, { icon:
|
|
25
|
-
// eslint-disable-next-line react/jsx-wrap-multilines
|
|
26
|
-
jsx(Icon, { size: 'medium', children: jsx(SvgFooterInfoIcon, { width: 24, height: 24 }) }), variant: 'warning', copykey: 'dyn_waas.backup_info.warning_alert', children: jsxs(Typography, { variant: 'body_small', color: 'current-color', children: [jsx(Typography, { variant: 'body_normal', copykey: 'dyn_waas.backup_info.important', style: { color: 'var(--default-alert-1, #DD8500)' }, children: t('dyn_waas.backup_info.important', 'Important') }), jsx(Typography, { variant: 'body_normal', color: 'secondary', copykey: 'dyn_waas.backup_info.warning', children: t('dyn_waas.backup_info.warning', "Make sure you don't lose access to the backup share or you will not be able to restore this account!") })] }) }), jsx("div", { className: 'backup-actions', children: jsx(TypographyButton, { dataTestId: 'back-button', onClick: handleBackClick, buttonClassName: 'backup-button', typographyProps: {
|
|
27
|
-
color: 'primary',
|
|
28
|
-
weight: 'bold',
|
|
29
|
-
}, copykey: 'dyn_waas.backup_info.back', buttonPadding: 'small', children: t('dyn_waas.backup_info.back', 'Back') }) })] }) }) })] }));
|
|
18
|
+
const handleBackClick = useCallback(() => goBack(), [goBack]);
|
|
19
|
+
const backButton = (jsx(IconButton, { type: 'button', onClick: handleBackClick, "data-testid": 'back-button', children: jsx(SvgChevronLeft, {}) }));
|
|
20
|
+
return (jsxs(Fragment, { children: [jsx(ModalHeader, { leading: backButton, children: jsx(Typography, { variant: 'title', color: 'primary', copykey: 'dyn_waas.backup_info.title', children: t('dyn_waas.backup_info.title') }) }), jsx("div", { className: 'waas-backup-view', children: jsxs("div", { className: 'waas-backup-view__info', children: [jsx("div", { className: 'waas-backup-view__info-icon', children: jsx(Icon, { color: 'brand-primary', children: jsx(SvgFilledQuestionMark, { width: 64, height: 64 }) }) }), jsx(Typography, { variant: 'body_normal', weight: 'medium', color: 'primary', copykey: 'dyn_waas.backup_info.subtitle', className: 'waas-backup-view__info-subtitle', children: t('dyn_waas.backup_info.subtitle') }), jsx(Typography, { variant: 'body_normal', color: 'secondary', copykey: 'dyn_waas.backup_info.description', className: 'waas-backup-view__info-description', children: t('dyn_waas.backup_info.description') }), jsxs("div", { className: 'waas-backup-view__info-alert', children: [jsx(SvgCautionTriangle, { className: 'waas-backup-view__info-alert-icon' }), jsx(Typography, { variant: 'body_small', color: 'secondary', children: t('dyn_waas.backup_info.warning') })] })] }) })] }));
|
|
30
21
|
};
|
|
31
22
|
|
|
32
23
|
export { WaasBackupInfoView };
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
|
+
|
|
6
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
7
|
+
var React = require('react');
|
|
8
|
+
var reactI18next = require('react-i18next');
|
|
9
|
+
var IconButton = require('../../../../components/IconButton/IconButton.cjs');
|
|
10
|
+
var ModalHeader = require('../../../../components/ModalHeader/ModalHeader.cjs');
|
|
11
|
+
var Typography = require('../../../../components/Typography/Typography.cjs');
|
|
12
|
+
var TypographyButton = require('../../../../components/TypographyButton/TypographyButton.cjs');
|
|
13
|
+
var ViewContext = require('../../../../context/ViewContext/ViewContext.cjs');
|
|
14
|
+
var chevronLeft = require('../../../../shared/assets/chevron-left.cjs');
|
|
15
|
+
var exclamation = require('../../../../shared/assets/exclamation.cjs');
|
|
16
|
+
require('@dynamic-labs/iconic');
|
|
17
|
+
var googleDrive = require('../../../../shared/assets/google-drive.cjs');
|
|
18
|
+
var useWalletBackup = require('../../../../utils/hooks/useWalletBackup/useWalletBackup.cjs');
|
|
19
|
+
|
|
20
|
+
const WaasBackupProgressView = () => {
|
|
21
|
+
const { goBack, pushView } = ViewContext.useViewContext();
|
|
22
|
+
const { t } = reactI18next.useTranslation();
|
|
23
|
+
const handleComplete = React.useCallback(() => {
|
|
24
|
+
pushView('waas-backup-download-view');
|
|
25
|
+
}, [pushView]);
|
|
26
|
+
const handleBackClick = React.useCallback(() => goBack(), [goBack]);
|
|
27
|
+
const { currentIndex, hasError, isComplete, retry, totalWallets } = useWalletBackup.useBackupWallets(handleComplete);
|
|
28
|
+
const getProgressText = () => {
|
|
29
|
+
if (isComplete) {
|
|
30
|
+
return t('dyn_waas.backup.progress_complete');
|
|
31
|
+
}
|
|
32
|
+
if (totalWallets === 0) {
|
|
33
|
+
return t('dyn_waas.backup.progress_initializing');
|
|
34
|
+
}
|
|
35
|
+
return t('dyn_waas.backup.progress_title', {
|
|
36
|
+
current: currentIndex,
|
|
37
|
+
total: totalWallets,
|
|
38
|
+
});
|
|
39
|
+
};
|
|
40
|
+
const renderProgressContent = () => {
|
|
41
|
+
if (hasError) {
|
|
42
|
+
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(Typography.Typography, { variant: 'body_normal', color: 'primary', copykey: 'dyn_waas.backup.error_title', className: 'waas-backup-view__progress-title', children: t('dyn_waas.backup.error_title') }), jsxRuntime.jsx("div", { className: 'waas-backup-view__progress-actions', children: jsxRuntime.jsx(TypographyButton.TypographyButton, { dataTestId: 'retry-backup-button', onClick: retry, copykey: 'dyn_waas.backup.error_try_again', buttonVariant: 'brand-primary', typographyProps: {
|
|
43
|
+
color: 'inherit',
|
|
44
|
+
}, expanded: true, children: t('dyn_waas.backup.error_try_again') }) })] }));
|
|
45
|
+
}
|
|
46
|
+
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(Typography.Typography, { variant: 'title', color: 'primary', copykey: 'dyn_waas.backup.progress_title', className: 'waas-backup-view__progress-title', children: getProgressText() }), jsxRuntime.jsx(Typography.Typography, { variant: 'body_normal', color: 'secondary', copykey: 'dyn_waas.backup.progress_subtitle', className: 'waas-backup-view__progress-subtitle', children: t('dyn_waas.backup.progress_subtitle') })] }));
|
|
47
|
+
};
|
|
48
|
+
const backButton = hasError ? (jsxRuntime.jsx(IconButton.IconButton, { type: 'button', onClick: handleBackClick, "data-testid": 'back-button', children: jsxRuntime.jsx(chevronLeft.ReactComponent, {}) })) : undefined;
|
|
49
|
+
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(ModalHeader.ModalHeader, { leading: backButton, children: jsxRuntime.jsx(Typography.Typography, { variant: 'title', color: 'primary', copykey: 'dyn_waas.backup.cloud_backup_header', children: t('dyn_waas.backup.cloud_backup_header') }) }), jsxRuntime.jsx("div", { className: 'waas-backup-view', children: jsxRuntime.jsxs("div", { className: 'waas-backup-view__progress', children: [jsxRuntime.jsxs("div", { className: `waas-backup-view__progress-icon ${hasError ? 'waas-backup-view__progress-icon--error' : ''}`, children: [jsxRuntime.jsx(googleDrive.ReactComponent, {}), hasError && (jsxRuntime.jsx("div", { className: 'waas-backup-view__progress-error-badge', children: jsxRuntime.jsx(exclamation.ReactComponent, {}) }))] }), renderProgressContent()] }) })] }));
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
exports.WaasBackupProgressView = WaasBackupProgressView;
|
|
@@ -0,0 +1,48 @@
|
|
|
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 { IconButton } from '../../../../components/IconButton/IconButton.js';
|
|
6
|
+
import { ModalHeader } from '../../../../components/ModalHeader/ModalHeader.js';
|
|
7
|
+
import { Typography } from '../../../../components/Typography/Typography.js';
|
|
8
|
+
import { TypographyButton } from '../../../../components/TypographyButton/TypographyButton.js';
|
|
9
|
+
import { useViewContext } from '../../../../context/ViewContext/ViewContext.js';
|
|
10
|
+
import { ReactComponent as SvgChevronLeft } from '../../../../shared/assets/chevron-left.js';
|
|
11
|
+
import { ReactComponent as SvgExclamation } from '../../../../shared/assets/exclamation.js';
|
|
12
|
+
import '@dynamic-labs/iconic';
|
|
13
|
+
import { ReactComponent as SvgGoogleDrive } from '../../../../shared/assets/google-drive.js';
|
|
14
|
+
import { useBackupWallets } from '../../../../utils/hooks/useWalletBackup/useWalletBackup.js';
|
|
15
|
+
|
|
16
|
+
const WaasBackupProgressView = () => {
|
|
17
|
+
const { goBack, pushView } = useViewContext();
|
|
18
|
+
const { t } = useTranslation();
|
|
19
|
+
const handleComplete = useCallback(() => {
|
|
20
|
+
pushView('waas-backup-download-view');
|
|
21
|
+
}, [pushView]);
|
|
22
|
+
const handleBackClick = useCallback(() => goBack(), [goBack]);
|
|
23
|
+
const { currentIndex, hasError, isComplete, retry, totalWallets } = useBackupWallets(handleComplete);
|
|
24
|
+
const getProgressText = () => {
|
|
25
|
+
if (isComplete) {
|
|
26
|
+
return t('dyn_waas.backup.progress_complete');
|
|
27
|
+
}
|
|
28
|
+
if (totalWallets === 0) {
|
|
29
|
+
return t('dyn_waas.backup.progress_initializing');
|
|
30
|
+
}
|
|
31
|
+
return t('dyn_waas.backup.progress_title', {
|
|
32
|
+
current: currentIndex,
|
|
33
|
+
total: totalWallets,
|
|
34
|
+
});
|
|
35
|
+
};
|
|
36
|
+
const renderProgressContent = () => {
|
|
37
|
+
if (hasError) {
|
|
38
|
+
return (jsxs(Fragment, { children: [jsx(Typography, { variant: 'body_normal', color: 'primary', copykey: 'dyn_waas.backup.error_title', className: 'waas-backup-view__progress-title', children: t('dyn_waas.backup.error_title') }), jsx("div", { className: 'waas-backup-view__progress-actions', children: jsx(TypographyButton, { dataTestId: 'retry-backup-button', onClick: retry, copykey: 'dyn_waas.backup.error_try_again', buttonVariant: 'brand-primary', typographyProps: {
|
|
39
|
+
color: 'inherit',
|
|
40
|
+
}, expanded: true, children: t('dyn_waas.backup.error_try_again') }) })] }));
|
|
41
|
+
}
|
|
42
|
+
return (jsxs(Fragment, { children: [jsx(Typography, { variant: 'title', color: 'primary', copykey: 'dyn_waas.backup.progress_title', className: 'waas-backup-view__progress-title', children: getProgressText() }), jsx(Typography, { variant: 'body_normal', color: 'secondary', copykey: 'dyn_waas.backup.progress_subtitle', className: 'waas-backup-view__progress-subtitle', children: t('dyn_waas.backup.progress_subtitle') })] }));
|
|
43
|
+
};
|
|
44
|
+
const backButton = hasError ? (jsx(IconButton, { type: 'button', onClick: handleBackClick, "data-testid": 'back-button', children: jsx(SvgChevronLeft, {}) })) : undefined;
|
|
45
|
+
return (jsxs(Fragment, { children: [jsx(ModalHeader, { leading: backButton, children: jsx(Typography, { variant: 'title', color: 'primary', copykey: 'dyn_waas.backup.cloud_backup_header', children: t('dyn_waas.backup.cloud_backup_header') }) }), jsx("div", { className: 'waas-backup-view', children: jsxs("div", { className: 'waas-backup-view__progress', children: [jsxs("div", { className: `waas-backup-view__progress-icon ${hasError ? 'waas-backup-view__progress-icon--error' : ''}`, children: [jsx(SvgGoogleDrive, {}), hasError && (jsx("div", { className: 'waas-backup-view__progress-error-badge', children: jsx(SvgExclamation, {}) }))] }), renderProgressContent()] }) })] }));
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
export { WaasBackupProgressView };
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
|
+
|
|
6
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
7
|
+
var React = require('react');
|
|
8
|
+
var reactI18next = require('react-i18next');
|
|
9
|
+
var Icon = require('../../../../components/Icon/Icon.cjs');
|
|
10
|
+
var IconButton = require('../../../../components/IconButton/IconButton.cjs');
|
|
11
|
+
var ModalHeader = require('../../../../components/ModalHeader/ModalHeader.cjs');
|
|
12
|
+
var Typography = require('../../../../components/Typography/Typography.cjs');
|
|
13
|
+
var TypographyButton = require('../../../../components/TypographyButton/TypographyButton.cjs');
|
|
14
|
+
require('../../../../context/DynamicContext/DynamicContext.cjs');
|
|
15
|
+
require('../../../../store/state/loadingAndLifecycle/loadingAndLifecycle.cjs');
|
|
16
|
+
require('@dynamic-labs/iconic');
|
|
17
|
+
require('@dynamic-labs/wallet-connector-core');
|
|
18
|
+
var chevronLeft = require('../../../../shared/assets/chevron-left.cjs');
|
|
19
|
+
var questionMark = require('../../../../shared/assets/question-mark.cjs');
|
|
20
|
+
var ViewContext = require('../../../../context/ViewContext/ViewContext.cjs');
|
|
21
|
+
var backupWaas = require('../../../../shared/assets/backup-waas.cjs');
|
|
22
|
+
require('../../../../shared/logger.cjs');
|
|
23
|
+
require('@dynamic-labs/wallet-book');
|
|
24
|
+
require('@dynamic-labs/utils');
|
|
25
|
+
require('../../../../utils/constants/colors.cjs');
|
|
26
|
+
require('../../../../utils/constants/values.cjs');
|
|
27
|
+
require('@dynamic-labs/sdk-api-core');
|
|
28
|
+
require('../../../../shared/consts/index.cjs');
|
|
29
|
+
require('../../../../events/dynamicEvents.cjs');
|
|
30
|
+
require('../../../../../../_virtual/_tslib.cjs');
|
|
31
|
+
require('../../../../context/CaptchaContext/CaptchaContext.cjs');
|
|
32
|
+
require('../../../../context/ErrorContext/ErrorContext.cjs');
|
|
33
|
+
require('@dynamic-labs/multi-wallet');
|
|
34
|
+
require('react-international-phone');
|
|
35
|
+
require('../../../../store/state/nonce/nonce.cjs');
|
|
36
|
+
require('@dynamic-labs-sdk/client/core');
|
|
37
|
+
require('../../../../client/client.cjs');
|
|
38
|
+
require('@dynamic-labs-sdk/client');
|
|
39
|
+
require('../../../../config/ApiEndpoint.cjs');
|
|
40
|
+
require('@dynamic-labs/locale');
|
|
41
|
+
require('../../../../store/state/dynamicContextProps/dynamicContextProps.cjs');
|
|
42
|
+
require('../../../../store/state/primaryWalletId/primaryWalletId.cjs');
|
|
43
|
+
require('../../../../store/state/connectedWalletsInfo/connectedWalletsInfo.cjs');
|
|
44
|
+
require('../../../../context/AccessDeniedContext/AccessDeniedContext.cjs');
|
|
45
|
+
require('../../../../context/AccountExistsContext/AccountExistsContext.cjs');
|
|
46
|
+
require('../../../../context/UserWalletsContext/UserWalletsContext.cjs');
|
|
47
|
+
require('../../../../store/state/authMode/authMode.cjs');
|
|
48
|
+
require('../../../../context/VerificationContext/VerificationContext.cjs');
|
|
49
|
+
require('react-dom');
|
|
50
|
+
require('../../../../utils/functions/compareChains/compareChains.cjs');
|
|
51
|
+
require('../../../../views/Passkey/utils/findPrimaryEmbeddedChain/findPrimaryEmbeddedChain.cjs');
|
|
52
|
+
require('../../../../context/ThemeContext/ThemeContext.cjs');
|
|
53
|
+
require('../../../../utils/hooks/useUserUpdateRequest/useUpdateUser/userFieldsSchema.cjs');
|
|
54
|
+
require('bs58');
|
|
55
|
+
require('@dynamic-labs/types');
|
|
56
|
+
require('../../../../context/SocialRedirectContext/SocialRedirectContext.cjs');
|
|
57
|
+
require('../../../../context/LoadingContext/LoadingContext.cjs');
|
|
58
|
+
require('../../../../context/WalletContext/WalletContext.cjs');
|
|
59
|
+
require('../../../../utils/hooks/useEmbeddedWallet/useSecureEnclaveEmbeddedWallet/constants.cjs');
|
|
60
|
+
require('yup');
|
|
61
|
+
require('../../../../context/MockContext/MockContext.cjs');
|
|
62
|
+
require('../../../../views/CollectUserDataView/useFields.cjs');
|
|
63
|
+
require('../../../../context/FieldsStateContext/FieldsStateContext.cjs');
|
|
64
|
+
require('../../../../context/UserFieldEditorContext/UserFieldEditorContext.cjs');
|
|
65
|
+
require('@dynamic-labs/rpc-providers');
|
|
66
|
+
require('../../../../store/state/walletOptions/walletOptions.cjs');
|
|
67
|
+
require('../../../../components/Accordion/components/AccordionItem/AccordionItem.cjs');
|
|
68
|
+
require('../../../../components/Alert/Alert.cjs');
|
|
69
|
+
require('../../../../components/ShadowDOM/ShadowDOM.cjs');
|
|
70
|
+
require('../../../../components/InlineWidget/InlineWidget.cjs');
|
|
71
|
+
require('../../../../components/Input/Input.cjs');
|
|
72
|
+
require('../../../../components/IsBrowser/IsBrowser.cjs');
|
|
73
|
+
require('../../../../components/MenuList/Dropdown/Dropdown.cjs');
|
|
74
|
+
require('../../../../components/OverlayCard/OverlayCard.cjs');
|
|
75
|
+
require('../../../../components/Transition/ZoomTransition/ZoomTransition.cjs');
|
|
76
|
+
require('../../../../components/Transition/SlideInUpTransition/SlideInUpTransition.cjs');
|
|
77
|
+
require('../../../../components/Transition/OpacityTransition/OpacityTransition.cjs');
|
|
78
|
+
require('../../../../components/PasskeyCreatedSuccessBanner/PasskeyCreatedSuccessBanner.cjs');
|
|
79
|
+
require('../../../../components/Popper/Popper/Popper.cjs');
|
|
80
|
+
require('../../../../components/Popper/PopperContext/PopperContext.cjs');
|
|
81
|
+
require('react-focus-lock');
|
|
82
|
+
require('qrcode');
|
|
83
|
+
require('formik');
|
|
84
|
+
require('../../../../utils/hooks/useSubdomainCheck/useSubdomainCheck.cjs');
|
|
85
|
+
require('../../../../context/WalletGroupContext/WalletGroupContext.cjs');
|
|
86
|
+
var BackupStepper = require('./BackupStepper.cjs');
|
|
87
|
+
require('../../../../context/IpConfigurationContext/IpConfigurationContext.cjs');
|
|
88
|
+
require('../../../../context/ConnectWithOtpContext/ConnectWithOtpContext.cjs');
|
|
89
|
+
require('../../../DynamicBridgeWidget/views/WalletsView/components/SecondaryWallets/SecondaryWallets.cjs');
|
|
90
|
+
require('@hcaptcha/react-hcaptcha');
|
|
91
|
+
require('../../context/DynamicWidgetContext.cjs');
|
|
92
|
+
require('../../helpers/convertExchangeKeyAndProviderEnum.cjs');
|
|
93
|
+
require('../../../../views/ExchangeWhitelistWarning/ExchangeWhitelistWarning.cjs');
|
|
94
|
+
require('../../../../context/ErrorContext/hooks/useErrorText/useErrorText.cjs');
|
|
95
|
+
require('../../../../context/FooterAnimationContext/index.cjs');
|
|
96
|
+
require('../../../../views/MfaChooseDeviceView/useGetMfaOptions/useGetMfaOptions.cjs');
|
|
97
|
+
require('../../../../context/PasskeyContext/PasskeyContext.cjs');
|
|
98
|
+
require('../../../../context/OnrampContext/OnrampContext.cjs');
|
|
99
|
+
require('../../../../store/state/sendBalances.cjs');
|
|
100
|
+
require('../../../../store/state/connectorsInitializing/connectorsInitializing.cjs');
|
|
101
|
+
require('../../../../components/OverlayCardBase/OverlayCardTarget/OverlayCardTarget.cjs');
|
|
102
|
+
require('../../components/DynamicWidgetHeader/DynamicWidgetHeader.cjs');
|
|
103
|
+
require('../../../../views/TransactionConfirmationView/TransactionConfirmationView.cjs');
|
|
104
|
+
require('../../components/PasskeyCard/PasskeyCard.cjs');
|
|
105
|
+
require('../CryptoComOnramp/CryptoComOnramp.cjs');
|
|
106
|
+
require('../../../../../index.cjs');
|
|
107
|
+
require('../ReceiveWalletFunds/ReceiveWalletFunds.cjs');
|
|
108
|
+
require('../../../../store/state/tokenBalances.cjs');
|
|
109
|
+
require('../../../../store/state/multichainBalances.cjs');
|
|
110
|
+
require('../../../../shared/utils/functions/getInitialUrl/getInitialUrl.cjs');
|
|
111
|
+
var useInternalDynamicContext = require('../../../../context/DynamicContext/useDynamicContext/useInternalDynamicContext/useInternalDynamicContext.cjs');
|
|
112
|
+
|
|
113
|
+
const WaasBackupSuccessView = ({ walletCount = 1, }) => {
|
|
114
|
+
const { goBack, pushView } = ViewContext.useViewContext();
|
|
115
|
+
const { setShowAuthFlow } = useInternalDynamicContext.useInternalDynamicContext();
|
|
116
|
+
const { t } = reactI18next.useTranslation();
|
|
117
|
+
const handleBackClick = React.useCallback(() => goBack(), [goBack]);
|
|
118
|
+
const handleInfoClick = React.useCallback(() => {
|
|
119
|
+
pushView('waas-backup-info-view');
|
|
120
|
+
}, [pushView]);
|
|
121
|
+
const handleDoneClick = React.useCallback(() => {
|
|
122
|
+
setShowAuthFlow(false);
|
|
123
|
+
}, [setShowAuthFlow]);
|
|
124
|
+
const backButton = (jsxRuntime.jsx(IconButton.IconButton, { type: 'button', onClick: handleBackClick, "data-testid": 'back-button', children: jsxRuntime.jsx(chevronLeft.ReactComponent, {}) }));
|
|
125
|
+
const infoButton = (jsxRuntime.jsx(IconButton.IconButton, { type: 'button', onClick: handleInfoClick, "data-testid": 'info-button', children: jsxRuntime.jsx(questionMark.ReactComponent, {}) }));
|
|
126
|
+
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.success_title', children: t('dyn_waas.backup.success_title') }) }), jsxRuntime.jsx("div", { className: 'waas-backup-view', children: jsxRuntime.jsxs("div", { className: 'waas-backup-view__body waas-backup-view__body--centered', children: [jsxRuntime.jsx("div", { className: 'waas-backup-view__success-icon', children: jsxRuntime.jsx(Icon.Icon, { color: 'brand-primary', children: jsxRuntime.jsx(backupWaas.ReactComponent, { width: 64, height: 64 }) }) }), jsxRuntime.jsx(BackupStepper.BackupStepper, { currentStep: 1, completedSteps: 2 }), jsxRuntime.jsx(Typography.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 }) }), jsxRuntime.jsx(TypographyButton.TypographyButton, { dataTestId: 'done-button', onClick: handleDoneClick, buttonVariant: 'brand-primary', typographyProps: {
|
|
127
|
+
color: 'inherit',
|
|
128
|
+
}, expanded: true, children: t('dyn_waas.backup.done') })] }) })] }));
|
|
129
|
+
};
|
|
130
|
+
|
|
131
|
+
exports.WaasBackupSuccessView = WaasBackupSuccessView;
|