@dynamic-labs/sdk-react-core 4.79.0 → 4.79.2
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 +18 -0
- package/package.cjs +3 -3
- package/package.js +3 -3
- package/package.json +14 -14
- package/src/index.cjs +2 -2
- package/src/index.js +1 -1
- package/src/lib/context/ViewContext/types/index.d.ts +1 -1
- package/src/lib/styles/index.shadow.cjs +1 -1
- package/src/lib/styles/index.shadow.js +1 -1
- package/src/lib/utils/constants/authViewLayoutChecks.cjs +2 -0
- package/src/lib/utils/constants/authViewLayoutChecks.js +2 -0
- package/src/lib/utils/functions/animationFrameTimeout/animationFrameTimeout.cjs +8 -14
- package/src/lib/utils/functions/animationFrameTimeout/animationFrameTimeout.js +8 -14
- package/src/lib/utils/hooks/useNetworkConfigurationsFromProjectSettings/useNetworkConfigurationsFromProjectSettings.cjs +7 -2
- package/src/lib/utils/hooks/useNetworkConfigurationsFromProjectSettings/useNetworkConfigurationsFromProjectSettings.d.ts +2 -1
- package/src/lib/utils/hooks/useNetworkConfigurationsFromProjectSettings/useNetworkConfigurationsFromProjectSettings.js +7 -2
- package/src/lib/utils/hooks/useWalletBackup/useWalletBackup.cjs +1 -1
- package/src/lib/utils/hooks/useWalletBackup/useWalletBackup.js +1 -1
- package/src/lib/utils/hooks/useWalletDelegation/useWalletDelegation.cjs +1 -1
- package/src/lib/utils/hooks/useWalletDelegation/useWalletDelegation.js +1 -1
- package/src/lib/views/viewToComponentMap.cjs +2 -0
- package/src/lib/views/viewToComponentMap.d.ts +1 -0
- package/src/lib/views/viewToComponentMap.js +2 -0
- package/src/lib/widgets/DynamicWidget/views/WaasBackupView/WaasBackupCloudProviderView.cjs +19 -4
- package/src/lib/widgets/DynamicWidget/views/WaasBackupView/WaasBackupCloudProviderView.js +19 -4
- package/src/lib/widgets/DynamicWidget/views/WaasBackupView/WaasBackupGrantAccessView.cjs +50 -0
- package/src/lib/widgets/DynamicWidget/views/WaasBackupView/WaasBackupGrantAccessView.d.ts +2 -0
- package/src/lib/widgets/DynamicWidget/views/WaasBackupView/WaasBackupGrantAccessView.js +46 -0
- package/src/lib/widgets/DynamicWidget/views/WaasBackupView/WaasBackupProgressView.cjs +23 -3
- package/src/lib/widgets/DynamicWidget/views/WaasBackupView/WaasBackupProgressView.js +23 -3
- package/src/lib/widgets/DynamicWidget/views/WaasBackupView/index.d.ts +1 -0
|
@@ -11,15 +11,18 @@ import { useViewContext } from '../../../../context/ViewContext/ViewContext.js';
|
|
|
11
11
|
import { ReactComponent as SvgChevronLeft } from '../../../../shared/assets/chevron-left.js';
|
|
12
12
|
import { ReactComponent as SvgExclamation } from '../../../../shared/assets/exclamation.js';
|
|
13
13
|
import '@dynamic-labs/iconic';
|
|
14
|
+
import { useGoogleDriveBackupReadiness } from '../../../../utils/hooks/useGoogleDriveBackupReadiness/useGoogleDriveBackupReadiness.js';
|
|
14
15
|
import { useWalletBackup, useBackupWallets } from '../../../../utils/hooks/useWalletBackup/useWalletBackup.js';
|
|
15
16
|
import { CloudBackupProvider } from '../../../../utils/hooks/useWalletBackup/types.js';
|
|
17
|
+
import { isInsufficientGoogleDriveScopesError } from '../../../../utils/hooks/useWalletBackup/googleDriveBackupErrors.js';
|
|
16
18
|
import { CLOUD_PROVIDER_CONFIGS } from '../../../../utils/hooks/useWalletBackup/cloudProviders.js';
|
|
17
19
|
|
|
18
20
|
const WaasBackupProgressView = ({ provider = CloudBackupProvider.GoogleDrive, }) => {
|
|
19
21
|
const { goBack, pushView } = useViewContext();
|
|
20
22
|
const { t } = useTranslation();
|
|
21
23
|
const providerConfig = CLOUD_PROVIDER_CONFIGS[provider];
|
|
22
|
-
const { getWalletsToBackup, showICloudAuth, checkICloudAuth, hideICloudAuth, } = useWalletBackup();
|
|
24
|
+
const { getWalletsToBackup, showICloudAuth, checkICloudAuth, hideICloudAuth, lastBackupError, clearBackupError, } = useWalletBackup();
|
|
25
|
+
const { requestAccess: requestDriveAccess, isChecking: isRequestingDriveAccess, } = useGoogleDriveBackupReadiness();
|
|
23
26
|
const [displayContainer, setDisplayContainer] = useState(null);
|
|
24
27
|
const [authState, setAuthState] = useState('pending');
|
|
25
28
|
const [authError, setAuthError] = useState(null);
|
|
@@ -126,6 +129,15 @@ const WaasBackupProgressView = ({ provider = CloudBackupProvider.GoogleDrive, })
|
|
|
126
129
|
retry();
|
|
127
130
|
}
|
|
128
131
|
}, [providerConfig.requiresIframe, retry]);
|
|
132
|
+
const handleGrantDriveAccessAndRetry = useCallback(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
133
|
+
clearBackupError();
|
|
134
|
+
const result = yield requestDriveAccess();
|
|
135
|
+
if (result.status === 'ready') {
|
|
136
|
+
retry();
|
|
137
|
+
}
|
|
138
|
+
}), [clearBackupError, requestDriveAccess, retry]);
|
|
139
|
+
const isDriveScopesError = provider === CloudBackupProvider.GoogleDrive &&
|
|
140
|
+
isInsufficientGoogleDriveScopesError(lastBackupError);
|
|
129
141
|
const getProgressText = () => {
|
|
130
142
|
if (isComplete) {
|
|
131
143
|
return t('dyn_waas.backup.progress_complete');
|
|
@@ -140,9 +152,17 @@ const WaasBackupProgressView = ({ provider = CloudBackupProvider.GoogleDrive, })
|
|
|
140
152
|
};
|
|
141
153
|
const renderProgressContent = () => {
|
|
142
154
|
if (hasError || authState === 'failed') {
|
|
143
|
-
|
|
155
|
+
const titleCopykey = isDriveScopesError
|
|
156
|
+
? 'dyn_waas.backup.gdrive_post_flight_title'
|
|
157
|
+
: 'dyn_waas.backup.error_title';
|
|
158
|
+
const titleText = isDriveScopesError
|
|
159
|
+
? t('dyn_waas.backup.gdrive_post_flight_title')
|
|
160
|
+
: authError || t('dyn_waas.backup.error_title');
|
|
161
|
+
return (jsxs(Fragment, { children: [jsx(Typography, { variant: 'body_normal', color: 'primary', copykey: titleCopykey, className: 'waas-backup-view__progress-title', children: titleText }), jsx("div", { className: 'waas-backup-view__progress-actions', children: isDriveScopesError ? (jsx(TypographyButton, { dataTestId: 'grant-drive-access-button', onClick: handleGrantDriveAccessAndRetry, disabled: isRequestingDriveAccess, copykey: 'dyn_waas.backup.gdrive_grant_access_cta', buttonVariant: 'brand-primary', typographyProps: {
|
|
162
|
+
color: 'inherit',
|
|
163
|
+
}, expanded: true, children: t('dyn_waas.backup.gdrive_grant_access_cta') })) : (jsx(TypographyButton, { dataTestId: 'retry-backup-button', onClick: handleRetry, copykey: 'dyn_waas.backup.error_try_again', buttonVariant: 'brand-primary', typographyProps: {
|
|
144
164
|
color: 'inherit',
|
|
145
|
-
}, expanded: true, children: t('dyn_waas.backup.error_try_again') }) })] }));
|
|
165
|
+
}, expanded: true, children: t('dyn_waas.backup.error_try_again') })) })] }));
|
|
146
166
|
}
|
|
147
167
|
if (providerConfig.requiresIframe &&
|
|
148
168
|
authState === 'shown' &&
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export { BackupStepper } from './BackupStepper';
|
|
2
2
|
export { WaasBackupCloudProviderView } from './WaasBackupCloudProviderView';
|
|
3
3
|
export { WaasBackupDownloadView } from './WaasBackupDownloadView';
|
|
4
|
+
export { WaasBackupGrantAccessView } from './WaasBackupGrantAccessView';
|
|
4
5
|
export { WaasBackupInfoView } from './WaasBackupInfoView';
|
|
5
6
|
export { WaasBackupProgressView } from './WaasBackupProgressView';
|
|
6
7
|
export { WaasBackupSuccessView } from './WaasBackupSuccessView';
|