@dynamic-labs/sdk-react-core 4.79.1 → 4.80.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (97) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/package.cjs +3 -3
  3. package/package.js +3 -3
  4. package/package.json +14 -14
  5. package/src/index.cjs +2 -2
  6. package/src/index.js +1 -1
  7. package/src/lib/Main.cjs +2 -2
  8. package/src/lib/Main.js +2 -2
  9. package/src/lib/client/extension/deprecated/mfa/verifyTotpMfaDevice/verifyTotpMfaDevice.d.ts +1 -1
  10. package/src/lib/components/LogoutButton/LogoutButton.cjs +2 -2
  11. package/src/lib/components/LogoutButton/LogoutButton.js +2 -2
  12. package/src/lib/context/DynamicContext/DynamicContext.cjs +6 -4
  13. package/src/lib/context/DynamicContext/DynamicContext.js +6 -4
  14. package/src/lib/context/DynamicContext/hooks/useHandleLogout/index.d.ts +1 -0
  15. package/src/lib/context/DynamicContext/hooks/useHandleLogout/types.d.ts +9 -0
  16. package/src/lib/context/DynamicContext/hooks/useHandleLogout/useHandleLogout.cjs +25 -12
  17. package/src/lib/context/DynamicContext/hooks/useHandleLogout/useHandleLogout.d.ts +5 -3
  18. package/src/lib/context/DynamicContext/hooks/useHandleLogout/useHandleLogout.js +24 -11
  19. package/src/lib/context/DynamicContext/hooks/useRemoveWallet/useRemoveWallet.cjs +3 -3
  20. package/src/lib/context/DynamicContext/hooks/useRemoveWallet/useRemoveWallet.d.ts +3 -2
  21. package/src/lib/context/DynamicContext/hooks/useRemoveWallet/useRemoveWallet.js +3 -3
  22. package/src/lib/context/DynamicContext/types/IDynamicContext.d.ts +2 -0
  23. package/src/lib/context/DynamicContext/types/IInternalDynamicContext.d.ts +8 -1
  24. package/src/lib/context/ViewContext/types/index.d.ts +1 -1
  25. package/src/lib/events/auth.d.ts +2 -1
  26. package/src/lib/styles/index.shadow.cjs +1 -1
  27. package/src/lib/styles/index.shadow.js +1 -1
  28. package/src/lib/utils/constants/authViewLayoutChecks.cjs +2 -0
  29. package/src/lib/utils/constants/authViewLayoutChecks.js +2 -0
  30. package/src/lib/utils/hooks/useDeleteUserAccount/useDeleteUserAccount.cjs +2 -2
  31. package/src/lib/utils/hooks/useDeleteUserAccount/useDeleteUserAccount.js +2 -2
  32. package/src/lib/utils/hooks/useEmbeddedWalletSessionKeys/useEmbeddedWalletSessionKeys.cjs +1 -1
  33. package/src/lib/utils/hooks/useEmbeddedWalletSessionKeys/useEmbeddedWalletSessionKeys.js +1 -1
  34. package/src/lib/utils/hooks/useNetworkConfigurationsFromProjectSettings/useNetworkConfigurationsFromProjectSettings.cjs +7 -2
  35. package/src/lib/utils/hooks/useNetworkConfigurationsFromProjectSettings/useNetworkConfigurationsFromProjectSettings.d.ts +2 -1
  36. package/src/lib/utils/hooks/useNetworkConfigurationsFromProjectSettings/useNetworkConfigurationsFromProjectSettings.js +7 -2
  37. package/src/lib/utils/hooks/useUserAuth/useUserAuth.cjs +3 -3
  38. package/src/lib/utils/hooks/useUserAuth/useUserAuth.js +3 -3
  39. package/src/lib/utils/hooks/useValidateSession/handleStoreAndEnvironmentMismatch/handleStoreAndEnvironmentMismatch.cjs +1 -1
  40. package/src/lib/utils/hooks/useValidateSession/handleStoreAndEnvironmentMismatch/handleStoreAndEnvironmentMismatch.d.ts +2 -1
  41. package/src/lib/utils/hooks/useValidateSession/handleStoreAndEnvironmentMismatch/handleStoreAndEnvironmentMismatch.js +1 -1
  42. package/src/lib/utils/hooks/useValidateSession/handleWalletInfoOutOfSync/handleWalletInfoOutOfSync.cjs +3 -1
  43. package/src/lib/utils/hooks/useValidateSession/handleWalletInfoOutOfSync/handleWalletInfoOutOfSync.d.ts +2 -2
  44. package/src/lib/utils/hooks/useValidateSession/handleWalletInfoOutOfSync/handleWalletInfoOutOfSync.js +3 -1
  45. package/src/lib/utils/hooks/useValidateSession/useValidateSession.cjs +3 -3
  46. package/src/lib/utils/hooks/useValidateSession/useValidateSession.d.ts +3 -3
  47. package/src/lib/utils/hooks/useValidateSession/useValidateSession.js +3 -3
  48. package/src/lib/utils/hooks/useWalletBackup/useWalletBackup.cjs +1 -1
  49. package/src/lib/utils/hooks/useWalletBackup/useWalletBackup.js +1 -1
  50. package/src/lib/utils/hooks/useWalletDelegation/useWalletDelegation.cjs +1 -1
  51. package/src/lib/utils/hooks/useWalletDelegation/useWalletDelegation.js +1 -1
  52. package/src/lib/utils/hooks/useWalletEventListeners/useWalletEventListeners.cjs +2 -2
  53. package/src/lib/utils/hooks/useWalletEventListeners/useWalletEventListeners.d.ts +3 -2
  54. package/src/lib/utils/hooks/useWalletEventListeners/useWalletEventListeners.js +2 -2
  55. package/src/lib/views/BackupUnsuccessfulView/BackupUnsuccessfulView.cjs +5 -5
  56. package/src/lib/views/BackupUnsuccessfulView/BackupUnsuccessfulView.js +5 -5
  57. package/src/lib/views/CollectUserDataView/CollectUserDataView.cjs +2 -2
  58. package/src/lib/views/CollectUserDataView/CollectUserDataView.js +2 -2
  59. package/src/lib/views/CollectUserDataViewNoWallet/CollectUserDataViewNoWallet.cjs +2 -2
  60. package/src/lib/views/CollectUserDataViewNoWallet/CollectUserDataViewNoWallet.js +2 -2
  61. package/src/lib/views/DeviceRegistrationView/DeviceRegistrationView.cjs +2 -2
  62. package/src/lib/views/DeviceRegistrationView/DeviceRegistrationView.js +2 -2
  63. package/src/lib/views/EmailVerification/EmailVerification.cjs +2 -2
  64. package/src/lib/views/EmailVerification/EmailVerification.js +2 -2
  65. package/src/lib/views/EmbeddedDeleteView/EmbeddedDeleteView.cjs +2 -2
  66. package/src/lib/views/EmbeddedDeleteView/EmbeddedDeleteView.js +2 -2
  67. package/src/lib/views/MfaChooseDeviceView/MfaChooseDeviceView.cjs +7 -7
  68. package/src/lib/views/MfaChooseDeviceView/MfaChooseDeviceView.js +7 -7
  69. package/src/lib/views/MfaSecureDeviceView/MfaSecureDeviceView.cjs +7 -7
  70. package/src/lib/views/MfaSecureDeviceView/MfaSecureDeviceView.js +7 -7
  71. package/src/lib/views/MfaVerificationView/MfaVerificationView.cjs +5 -5
  72. package/src/lib/views/MfaVerificationView/MfaVerificationView.js +5 -5
  73. package/src/lib/views/Passkey/PasskeyIntroView/PasskeyIntroView.cjs +2 -2
  74. package/src/lib/views/Passkey/PasskeyIntroView/PasskeyIntroView.js +2 -2
  75. package/src/lib/views/SmsVerification/SmsVerification.cjs +2 -2
  76. package/src/lib/views/SmsVerification/SmsVerification.js +2 -2
  77. package/src/lib/views/WalletDelegation/WalletDelegationView/WalletDelegationView.cjs +2 -2
  78. package/src/lib/views/WalletDelegation/WalletDelegationView/WalletDelegationView.js +2 -2
  79. package/src/lib/views/WalletLockedView/WalletLockedView.cjs +2 -2
  80. package/src/lib/views/WalletLockedView/WalletLockedView.js +2 -2
  81. package/src/lib/views/WalletUsedView/WalletUsedView.cjs +2 -2
  82. package/src/lib/views/WalletUsedView/WalletUsedView.js +2 -2
  83. package/src/lib/views/viewToComponentMap.cjs +2 -0
  84. package/src/lib/views/viewToComponentMap.d.ts +1 -0
  85. package/src/lib/views/viewToComponentMap.js +2 -0
  86. package/src/lib/widgets/DynamicWidget/components/SingleWalletButtons/SingleWalletButtons.cjs +2 -2
  87. package/src/lib/widgets/DynamicWidget/components/SingleWalletButtons/SingleWalletButtons.js +2 -2
  88. package/src/lib/widgets/DynamicWidget/views/SettingsView/SettingsView.cjs +2 -2
  89. package/src/lib/widgets/DynamicWidget/views/SettingsView/SettingsView.js +2 -2
  90. package/src/lib/widgets/DynamicWidget/views/WaasBackupView/WaasBackupCloudProviderView.cjs +19 -4
  91. package/src/lib/widgets/DynamicWidget/views/WaasBackupView/WaasBackupCloudProviderView.js +19 -4
  92. package/src/lib/widgets/DynamicWidget/views/WaasBackupView/WaasBackupGrantAccessView.cjs +50 -0
  93. package/src/lib/widgets/DynamicWidget/views/WaasBackupView/WaasBackupGrantAccessView.d.ts +2 -0
  94. package/src/lib/widgets/DynamicWidget/views/WaasBackupView/WaasBackupGrantAccessView.js +46 -0
  95. package/src/lib/widgets/DynamicWidget/views/WaasBackupView/WaasBackupProgressView.cjs +23 -3
  96. package/src/lib/widgets/DynamicWidget/views/WaasBackupView/WaasBackupProgressView.js +23 -3
  97. package/src/lib/widgets/DynamicWidget/views/WaasBackupView/index.d.ts +1 -0
@@ -119,7 +119,7 @@ require('../../components/Popper/PopperContext/PopperContext.cjs');
119
119
 
120
120
  const iconSize = 64;
121
121
  const WalletLockedView = () => {
122
- const { handleLogOut, primaryWallet, setShowAuthFlow, appName } = useInternalDynamicContext.useInternalDynamicContext();
122
+ const { handleLogOutWithReason, primaryWallet, setShowAuthFlow, appName } = useInternalDynamicContext.useInternalDynamicContext();
123
123
  const { t } = reactI18next.useTranslation();
124
124
  if (!primaryWallet) {
125
125
  return null;
@@ -137,7 +137,7 @@ const WalletLockedView = () => {
137
137
  height: pixelToRem.pixelToRem(iconSize * IconWithSpinner.iconRatio),
138
138
  width: pixelToRem.pixelToRem(iconSize * IconWithSpinner.iconRatio),
139
139
  } }));
140
- return (jsxRuntime.jsxs("div", { "data-testid": 'wallet-locked-view', children: [jsxRuntime.jsx(ErrorContainer.ErrorContainer, { withIcon: false, variant: 'success', className: 'wallet-locked-view__error-container', copykey: 'dyn_wallet_locked.connect_continue', children: t('dyn_wallet_locked.connect_continue') }), jsxRuntime.jsxs("div", { className: 'wallet-locked-view__content', children: [jsxRuntime.jsx(IconWithSpinner.IconWithSpinner, { Icon: icon, iconSize: iconSize, className: 'wallet-locked-view__icon', isSpinning: true }), jsxRuntime.jsx(Typography.Typography, { variant: 'title', color: 'primary', weight: 'medium', className: 'wallet-locked-view__title', copykey: 'dyn_wallet_locked.title', children: t('dyn_wallet_locked.title') }), jsxRuntime.jsxs(Typography.Typography, { variant: 'body_normal', color: 'secondary', weight: 'regular', copykey: 'dyn_wallet_locked.subtitle', children: [t('dyn_wallet_locked.subtitle'), appName, "."] }), jsxRuntime.jsx(TypographyButton.TypographyButton, { onClick: () => handleConnectWallet(), buttonClassName: 'wallet-locked-view__button', copykey: 'dyn_wallet_locked.connect', children: t('dyn_wallet_locked.connect') }), jsxRuntime.jsx(Divider.Divider, { text: 'Or' }), jsxRuntime.jsx(TextButton.TextButton, { className: 'wallet-locked-view__log-out', onClick: handleLogOut, copykey: 'dyn_wallet_locked.logout', children: t('dyn_wallet_locked.logout') })] })] }));
140
+ return (jsxRuntime.jsxs("div", { "data-testid": 'wallet-locked-view', children: [jsxRuntime.jsx(ErrorContainer.ErrorContainer, { withIcon: false, variant: 'success', className: 'wallet-locked-view__error-container', copykey: 'dyn_wallet_locked.connect_continue', children: t('dyn_wallet_locked.connect_continue') }), jsxRuntime.jsxs("div", { className: 'wallet-locked-view__content', children: [jsxRuntime.jsx(IconWithSpinner.IconWithSpinner, { Icon: icon, iconSize: iconSize, className: 'wallet-locked-view__icon', isSpinning: true }), jsxRuntime.jsx(Typography.Typography, { variant: 'title', color: 'primary', weight: 'medium', className: 'wallet-locked-view__title', copykey: 'dyn_wallet_locked.title', children: t('dyn_wallet_locked.title') }), jsxRuntime.jsxs(Typography.Typography, { variant: 'body_normal', color: 'secondary', weight: 'regular', copykey: 'dyn_wallet_locked.subtitle', children: [t('dyn_wallet_locked.subtitle'), appName, "."] }), jsxRuntime.jsx(TypographyButton.TypographyButton, { onClick: () => handleConnectWallet(), buttonClassName: 'wallet-locked-view__button', copykey: 'dyn_wallet_locked.connect', children: t('dyn_wallet_locked.connect') }), jsxRuntime.jsx(Divider.Divider, { text: 'Or' }), jsxRuntime.jsx(TextButton.TextButton, { className: 'wallet-locked-view__log-out', onClick: () => handleLogOutWithReason('user-intent'), copykey: 'dyn_wallet_locked.logout', children: t('dyn_wallet_locked.logout') })] })] }));
141
141
  };
142
142
 
143
143
  exports.WalletLockedView = WalletLockedView;
@@ -115,7 +115,7 @@ import '../../components/Popper/PopperContext/PopperContext.js';
115
115
 
116
116
  const iconSize = 64;
117
117
  const WalletLockedView = () => {
118
- const { handleLogOut, primaryWallet, setShowAuthFlow, appName } = useInternalDynamicContext();
118
+ const { handleLogOutWithReason, primaryWallet, setShowAuthFlow, appName } = useInternalDynamicContext();
119
119
  const { t } = useTranslation();
120
120
  if (!primaryWallet) {
121
121
  return null;
@@ -133,7 +133,7 @@ const WalletLockedView = () => {
133
133
  height: pixelToRem(iconSize * iconRatio),
134
134
  width: pixelToRem(iconSize * iconRatio),
135
135
  } }));
136
- return (jsxs("div", { "data-testid": 'wallet-locked-view', children: [jsx(ErrorContainer, { withIcon: false, variant: 'success', className: 'wallet-locked-view__error-container', copykey: 'dyn_wallet_locked.connect_continue', children: t('dyn_wallet_locked.connect_continue') }), jsxs("div", { className: 'wallet-locked-view__content', children: [jsx(IconWithSpinner, { Icon: icon, iconSize: iconSize, className: 'wallet-locked-view__icon', isSpinning: true }), jsx(Typography, { variant: 'title', color: 'primary', weight: 'medium', className: 'wallet-locked-view__title', copykey: 'dyn_wallet_locked.title', children: t('dyn_wallet_locked.title') }), jsxs(Typography, { variant: 'body_normal', color: 'secondary', weight: 'regular', copykey: 'dyn_wallet_locked.subtitle', children: [t('dyn_wallet_locked.subtitle'), appName, "."] }), jsx(TypographyButton, { onClick: () => handleConnectWallet(), buttonClassName: 'wallet-locked-view__button', copykey: 'dyn_wallet_locked.connect', children: t('dyn_wallet_locked.connect') }), jsx(Divider, { text: 'Or' }), jsx(TextButton, { className: 'wallet-locked-view__log-out', onClick: handleLogOut, copykey: 'dyn_wallet_locked.logout', children: t('dyn_wallet_locked.logout') })] })] }));
136
+ return (jsxs("div", { "data-testid": 'wallet-locked-view', children: [jsx(ErrorContainer, { withIcon: false, variant: 'success', className: 'wallet-locked-view__error-container', copykey: 'dyn_wallet_locked.connect_continue', children: t('dyn_wallet_locked.connect_continue') }), jsxs("div", { className: 'wallet-locked-view__content', children: [jsx(IconWithSpinner, { Icon: icon, iconSize: iconSize, className: 'wallet-locked-view__icon', isSpinning: true }), jsx(Typography, { variant: 'title', color: 'primary', weight: 'medium', className: 'wallet-locked-view__title', copykey: 'dyn_wallet_locked.title', children: t('dyn_wallet_locked.title') }), jsxs(Typography, { variant: 'body_normal', color: 'secondary', weight: 'regular', copykey: 'dyn_wallet_locked.subtitle', children: [t('dyn_wallet_locked.subtitle'), appName, "."] }), jsx(TypographyButton, { onClick: () => handleConnectWallet(), buttonClassName: 'wallet-locked-view__button', copykey: 'dyn_wallet_locked.connect', children: t('dyn_wallet_locked.connect') }), jsx(Divider, { text: 'Or' }), jsx(TextButton, { className: 'wallet-locked-view__log-out', onClick: () => handleLogOutWithReason('user-intent'), copykey: 'dyn_wallet_locked.logout', children: t('dyn_wallet_locked.logout') })] })] }));
137
137
  };
138
138
 
139
139
  export { WalletLockedView };
@@ -123,7 +123,7 @@ const WalletUsedView = () => {
123
123
  const { t } = reactI18next.useTranslation();
124
124
  const { loading, setLoading } = LoadingContext.useLoadingContext();
125
125
  const { pushView } = ViewContext.useViewContext();
126
- const { setShowAuthFlow, appName, siweStatement, setMultiWalletWidgetState, connectWallet, selectedWalletConnector: walletConnector, isSingleWalletAccount, handleLogOut, } = useInternalDynamicContext.useInternalDynamicContext();
126
+ const { setShowAuthFlow, appName, siweStatement, setMultiWalletWidgetState, connectWallet, selectedWalletConnector: walletConnector, isSingleWalletAccount, handleLogOutWithReason, } = useInternalDynamicContext.useInternalDynamicContext();
127
127
  const { data: walletAddress } = usePromise.usePromise(() => _tslib.__awaiter(void 0, void 0, void 0, function* () {
128
128
  const accounts = yield (walletConnector === null || walletConnector === void 0 ? void 0 : walletConnector.getConnectedAccounts());
129
129
  return accounts === null || accounts === void 0 ? void 0 : accounts[0];
@@ -177,7 +177,7 @@ const WalletUsedView = () => {
177
177
  setMultiWalletWidgetState('idle');
178
178
  }
179
179
  });
180
- return (jsxRuntime.jsxs("div", { className: 'wallet-used-view__container', children: [jsxRuntime.jsx("div", { className: 'wallet-used-view__icon', children: jsxRuntime.jsx(walletBook.WalletIcon, { icon: walletConnector === null || walletConnector === void 0 ? void 0 : walletConnector.metadata.icon, walletKey: walletConnector === null || walletConnector === void 0 ? void 0 : walletConnector.key, width: 64, height: 64 }) }), jsxRuntime.jsx(Typography.Typography, { className: 'wallet-used-view__shorten-wallet-address', variant: 'body_normal', weight: 'medium', color: 'primary', children: shortenedWalletAddress }), jsxRuntime.jsx(Typography.Typography, { className: 'wallet-used-view__copy', variant: 'body_normal', color: 'secondary', weight: 'regular', copykey: 'dyn_wallet_link.existent_account.warning', children: t('dyn_wallet_link.existent_account.warning') }), isSingleWalletAccount && (jsxRuntime.jsxs("label", { htmlFor: 'skipEmptyAccountCheck', className: 'wallet-used-view__checkbox-label', children: [jsxRuntime.jsx(Checkbox.Checkbox, { id: 'skipEmptyAccountCheck', className: 'wallet-used-view__checkbox-container', defaultChecked: isChecked, onChange: () => setIsChecked(!isChecked), ariaLabel: 'skip empty account check' }), jsxRuntime.jsx(Typography.Typography, { variant: 'body_small', color: 'secondary', copykey: 'dyn_wallet_link.existent_account.acceptance', children: t('dyn_wallet_link.existent_account.acceptance') })] })), jsxRuntime.jsx(TypographyButton.TypographyButton, { buttonClassName: 'wallet-used-view__accept-button', buttonVariant: 'primary', expanded: true, buttonPadding: 'large', onClick: () => handleWalletTransfer(), disabled: (!isChecked && isSingleWalletAccount) || loading, dataTestId: 'wallet-used-view-transfer-wallet', copykey: 'dyn_wallet_link.confirm_button', children: t('dyn_wallet_link.confirm_button') }), jsxRuntime.jsx(TypographyButton.TypographyButton, { dataTestId: 'wallet-used-view-log-out', buttonPadding: 'small', buttonClassName: 'wallet-used-view__logout', onClick: handleLogOut, copykey: 'dyn_wallet_link.log_out_button', children: t('dyn_wallet_link.log_out_button') })] }));
180
+ return (jsxRuntime.jsxs("div", { className: 'wallet-used-view__container', children: [jsxRuntime.jsx("div", { className: 'wallet-used-view__icon', children: jsxRuntime.jsx(walletBook.WalletIcon, { icon: walletConnector === null || walletConnector === void 0 ? void 0 : walletConnector.metadata.icon, walletKey: walletConnector === null || walletConnector === void 0 ? void 0 : walletConnector.key, width: 64, height: 64 }) }), jsxRuntime.jsx(Typography.Typography, { className: 'wallet-used-view__shorten-wallet-address', variant: 'body_normal', weight: 'medium', color: 'primary', children: shortenedWalletAddress }), jsxRuntime.jsx(Typography.Typography, { className: 'wallet-used-view__copy', variant: 'body_normal', color: 'secondary', weight: 'regular', copykey: 'dyn_wallet_link.existent_account.warning', children: t('dyn_wallet_link.existent_account.warning') }), isSingleWalletAccount && (jsxRuntime.jsxs("label", { htmlFor: 'skipEmptyAccountCheck', className: 'wallet-used-view__checkbox-label', children: [jsxRuntime.jsx(Checkbox.Checkbox, { id: 'skipEmptyAccountCheck', className: 'wallet-used-view__checkbox-container', defaultChecked: isChecked, onChange: () => setIsChecked(!isChecked), ariaLabel: 'skip empty account check' }), jsxRuntime.jsx(Typography.Typography, { variant: 'body_small', color: 'secondary', copykey: 'dyn_wallet_link.existent_account.acceptance', children: t('dyn_wallet_link.existent_account.acceptance') })] })), jsxRuntime.jsx(TypographyButton.TypographyButton, { buttonClassName: 'wallet-used-view__accept-button', buttonVariant: 'primary', expanded: true, buttonPadding: 'large', onClick: () => handleWalletTransfer(), disabled: (!isChecked && isSingleWalletAccount) || loading, dataTestId: 'wallet-used-view-transfer-wallet', copykey: 'dyn_wallet_link.confirm_button', children: t('dyn_wallet_link.confirm_button') }), jsxRuntime.jsx(TypographyButton.TypographyButton, { dataTestId: 'wallet-used-view-log-out', buttonPadding: 'small', buttonClassName: 'wallet-used-view__logout', onClick: () => handleLogOutWithReason('user-intent'), copykey: 'dyn_wallet_link.log_out_button', children: t('dyn_wallet_link.log_out_button') })] }));
181
181
  };
182
182
 
183
183
  exports.WalletUsedView = WalletUsedView;
@@ -119,7 +119,7 @@ const WalletUsedView = () => {
119
119
  const { t } = useTranslation();
120
120
  const { loading, setLoading } = useLoadingContext();
121
121
  const { pushView } = useViewContext();
122
- const { setShowAuthFlow, appName, siweStatement, setMultiWalletWidgetState, connectWallet, selectedWalletConnector: walletConnector, isSingleWalletAccount, handleLogOut, } = useInternalDynamicContext();
122
+ const { setShowAuthFlow, appName, siweStatement, setMultiWalletWidgetState, connectWallet, selectedWalletConnector: walletConnector, isSingleWalletAccount, handleLogOutWithReason, } = useInternalDynamicContext();
123
123
  const { data: walletAddress } = usePromise(() => __awaiter(void 0, void 0, void 0, function* () {
124
124
  const accounts = yield (walletConnector === null || walletConnector === void 0 ? void 0 : walletConnector.getConnectedAccounts());
125
125
  return accounts === null || accounts === void 0 ? void 0 : accounts[0];
@@ -173,7 +173,7 @@ const WalletUsedView = () => {
173
173
  setMultiWalletWidgetState('idle');
174
174
  }
175
175
  });
176
- return (jsxs("div", { className: 'wallet-used-view__container', children: [jsx("div", { className: 'wallet-used-view__icon', children: jsx(WalletIcon, { icon: walletConnector === null || walletConnector === void 0 ? void 0 : walletConnector.metadata.icon, walletKey: walletConnector === null || walletConnector === void 0 ? void 0 : walletConnector.key, width: 64, height: 64 }) }), jsx(Typography, { className: 'wallet-used-view__shorten-wallet-address', variant: 'body_normal', weight: 'medium', color: 'primary', children: shortenedWalletAddress }), jsx(Typography, { className: 'wallet-used-view__copy', variant: 'body_normal', color: 'secondary', weight: 'regular', copykey: 'dyn_wallet_link.existent_account.warning', children: t('dyn_wallet_link.existent_account.warning') }), isSingleWalletAccount && (jsxs("label", { htmlFor: 'skipEmptyAccountCheck', className: 'wallet-used-view__checkbox-label', children: [jsx(Checkbox, { id: 'skipEmptyAccountCheck', className: 'wallet-used-view__checkbox-container', defaultChecked: isChecked, onChange: () => setIsChecked(!isChecked), ariaLabel: 'skip empty account check' }), jsx(Typography, { variant: 'body_small', color: 'secondary', copykey: 'dyn_wallet_link.existent_account.acceptance', children: t('dyn_wallet_link.existent_account.acceptance') })] })), jsx(TypographyButton, { buttonClassName: 'wallet-used-view__accept-button', buttonVariant: 'primary', expanded: true, buttonPadding: 'large', onClick: () => handleWalletTransfer(), disabled: (!isChecked && isSingleWalletAccount) || loading, dataTestId: 'wallet-used-view-transfer-wallet', copykey: 'dyn_wallet_link.confirm_button', children: t('dyn_wallet_link.confirm_button') }), jsx(TypographyButton, { dataTestId: 'wallet-used-view-log-out', buttonPadding: 'small', buttonClassName: 'wallet-used-view__logout', onClick: handleLogOut, copykey: 'dyn_wallet_link.log_out_button', children: t('dyn_wallet_link.log_out_button') })] }));
176
+ return (jsxs("div", { className: 'wallet-used-view__container', children: [jsx("div", { className: 'wallet-used-view__icon', children: jsx(WalletIcon, { icon: walletConnector === null || walletConnector === void 0 ? void 0 : walletConnector.metadata.icon, walletKey: walletConnector === null || walletConnector === void 0 ? void 0 : walletConnector.key, width: 64, height: 64 }) }), jsx(Typography, { className: 'wallet-used-view__shorten-wallet-address', variant: 'body_normal', weight: 'medium', color: 'primary', children: shortenedWalletAddress }), jsx(Typography, { className: 'wallet-used-view__copy', variant: 'body_normal', color: 'secondary', weight: 'regular', copykey: 'dyn_wallet_link.existent_account.warning', children: t('dyn_wallet_link.existent_account.warning') }), isSingleWalletAccount && (jsxs("label", { htmlFor: 'skipEmptyAccountCheck', className: 'wallet-used-view__checkbox-label', children: [jsx(Checkbox, { id: 'skipEmptyAccountCheck', className: 'wallet-used-view__checkbox-container', defaultChecked: isChecked, onChange: () => setIsChecked(!isChecked), ariaLabel: 'skip empty account check' }), jsx(Typography, { variant: 'body_small', color: 'secondary', copykey: 'dyn_wallet_link.existent_account.acceptance', children: t('dyn_wallet_link.existent_account.acceptance') })] })), jsx(TypographyButton, { buttonClassName: 'wallet-used-view__accept-button', buttonVariant: 'primary', expanded: true, buttonPadding: 'large', onClick: () => handleWalletTransfer(), disabled: (!isChecked && isSingleWalletAccount) || loading, dataTestId: 'wallet-used-view-transfer-wallet', copykey: 'dyn_wallet_link.confirm_button', children: t('dyn_wallet_link.confirm_button') }), jsx(TypographyButton, { dataTestId: 'wallet-used-view-log-out', buttonPadding: 'small', buttonClassName: 'wallet-used-view__logout', onClick: () => handleLogOutWithReason('user-intent'), copykey: 'dyn_wallet_link.log_out_button', children: t('dyn_wallet_link.log_out_button') })] }));
177
177
  };
178
178
 
179
179
  export { WalletUsedView };
@@ -10,6 +10,7 @@ require('@dynamic-labs/iconic');
10
10
  require('../context/ViewContext/ViewContext.cjs');
11
11
  var WaasBackupCloudProviderView = require('../widgets/DynamicWidget/views/WaasBackupView/WaasBackupCloudProviderView.cjs');
12
12
  var WaasBackupDownloadView = require('../widgets/DynamicWidget/views/WaasBackupView/WaasBackupDownloadView.cjs');
13
+ var WaasBackupGrantAccessView = require('../widgets/DynamicWidget/views/WaasBackupView/WaasBackupGrantAccessView.cjs');
13
14
  var WaasBackupInfoView = require('../widgets/DynamicWidget/views/WaasBackupView/WaasBackupInfoView.cjs');
14
15
  var WaasBackupProgressView = require('../widgets/DynamicWidget/views/WaasBackupView/WaasBackupProgressView.cjs');
15
16
  var WaasBackupSuccessView = require('../widgets/DynamicWidget/views/WaasBackupView/WaasBackupSuccessView.cjs');
@@ -272,6 +273,7 @@ const viewToComponentMap = {
272
273
  'verify-sms': SmsVerification.SmsVerification,
273
274
  'waas-backup-cloud-provider-view': WaasBackupCloudProviderView.WaasBackupCloudProviderView,
274
275
  'waas-backup-download-view': WaasBackupDownloadView.WaasBackupDownloadView,
276
+ 'waas-backup-grant-access-view': WaasBackupGrantAccessView.WaasBackupGrantAccessView,
275
277
  'waas-backup-info-view': WaasBackupInfoView.WaasBackupInfoView,
276
278
  'waas-backup-progress-view': WaasBackupProgressView.WaasBackupProgressView,
277
279
  'waas-backup-success-view': WaasBackupSuccessView.WaasBackupSuccessView,
@@ -119,6 +119,7 @@ export declare const viewToComponentMap: {
119
119
  'verify-sms': import("react").FC;
120
120
  'waas-backup-cloud-provider-view': import("react").FC;
121
121
  'waas-backup-download-view': import("react").FC;
122
+ 'waas-backup-grant-access-view': import("react").FC;
122
123
  'waas-backup-info-view': import("react").FC;
123
124
  'waas-backup-progress-view': import("react").FC<import("../widgets/DynamicWidget/views/WaasBackupView/WaasBackupProgressView").WaasBackupProgressViewProps>;
124
125
  'waas-backup-success-view': import("react").FC<import("../widgets/DynamicWidget/views/WaasBackupView/WaasBackupSuccessView").WaasBackupSuccessViewProps>;
@@ -6,6 +6,7 @@ import '@dynamic-labs/iconic';
6
6
  import '../context/ViewContext/ViewContext.js';
7
7
  import { WaasBackupCloudProviderView } from '../widgets/DynamicWidget/views/WaasBackupView/WaasBackupCloudProviderView.js';
8
8
  import { WaasBackupDownloadView } from '../widgets/DynamicWidget/views/WaasBackupView/WaasBackupDownloadView.js';
9
+ import { WaasBackupGrantAccessView } from '../widgets/DynamicWidget/views/WaasBackupView/WaasBackupGrantAccessView.js';
9
10
  import { WaasBackupInfoView } from '../widgets/DynamicWidget/views/WaasBackupView/WaasBackupInfoView.js';
10
11
  import { WaasBackupProgressView } from '../widgets/DynamicWidget/views/WaasBackupView/WaasBackupProgressView.js';
11
12
  import { WaasBackupSuccessView } from '../widgets/DynamicWidget/views/WaasBackupView/WaasBackupSuccessView.js';
@@ -268,6 +269,7 @@ const viewToComponentMap = {
268
269
  'verify-sms': SmsVerification,
269
270
  'waas-backup-cloud-provider-view': WaasBackupCloudProviderView,
270
271
  'waas-backup-download-view': WaasBackupDownloadView,
272
+ 'waas-backup-grant-access-view': WaasBackupGrantAccessView,
271
273
  'waas-backup-info-view': WaasBackupInfoView,
272
274
  'waas-backup-progress-view': WaasBackupProgressView,
273
275
  'waas-backup-success-view': WaasBackupSuccessView,
@@ -115,7 +115,7 @@ require('../../../../components/Popper/PopperContext/PopperContext.cjs');
115
115
 
116
116
  const SingleWalletButtons = () => {
117
117
  var _a;
118
- const { primaryWallet, handleLogOut, user } = useInternalDynamicContext.useInternalDynamicContext();
118
+ const { primaryWallet, handleLogOutWithReason, user } = useInternalDynamicContext.useInternalDynamicContext();
119
119
  const unknownWallet = user === null || user === void 0 ? void 0 : user.verifiedCredentials.find((credential) => credential.walletName === 'unknown');
120
120
  const address = (_a = primaryWallet === null || primaryWallet === void 0 ? void 0 : primaryWallet.address) !== null && _a !== void 0 ? _a : unknownWallet === null || unknownWallet === void 0 ? void 0 : unknownWallet.address;
121
121
  return (jsxRuntime.jsxs("div", { className: 'single-wallet-buttons', children: [address && (jsxRuntime.jsx(TypographyButton.TypographyButton, { dataTestId: 'Copy address', expanded: true, buttonPadding: 'medium', typographyProps: {
@@ -126,7 +126,7 @@ const SingleWalletButtons = () => {
126
126
  jsxRuntime.jsxs("div", { className: 'single-wallet-buttons__copied', children: [jsxRuntime.jsx(checkCircle.ReactComponent, {}), " Copied!"] }), children: "Copy address" })), jsxRuntime.jsx(TypographyButton.TypographyButton, { dataTestId: 'Disconnect', expanded: true, buttonPadding: 'medium', typographyProps: {
127
127
  className: 'single-wallet-buttons--center',
128
128
  variant: 'button_primary',
129
- }, onClick: handleLogOut, children: "Disconnect" })] }));
129
+ }, onClick: () => handleLogOutWithReason('user-intent'), children: "Disconnect" })] }));
130
130
  };
131
131
 
132
132
  exports.SingleWalletButtons = SingleWalletButtons;
@@ -111,7 +111,7 @@ import '../../../../components/Popper/PopperContext/PopperContext.js';
111
111
 
112
112
  const SingleWalletButtons = () => {
113
113
  var _a;
114
- const { primaryWallet, handleLogOut, user } = useInternalDynamicContext();
114
+ const { primaryWallet, handleLogOutWithReason, user } = useInternalDynamicContext();
115
115
  const unknownWallet = user === null || user === void 0 ? void 0 : user.verifiedCredentials.find((credential) => credential.walletName === 'unknown');
116
116
  const address = (_a = primaryWallet === null || primaryWallet === void 0 ? void 0 : primaryWallet.address) !== null && _a !== void 0 ? _a : unknownWallet === null || unknownWallet === void 0 ? void 0 : unknownWallet.address;
117
117
  return (jsxs("div", { className: 'single-wallet-buttons', children: [address && (jsx(TypographyButton, { dataTestId: 'Copy address', expanded: true, buttonPadding: 'medium', typographyProps: {
@@ -122,7 +122,7 @@ const SingleWalletButtons = () => {
122
122
  jsxs("div", { className: 'single-wallet-buttons__copied', children: [jsx(SvgCheckCircle, {}), " Copied!"] }), children: "Copy address" })), jsx(TypographyButton, { dataTestId: 'Disconnect', expanded: true, buttonPadding: 'medium', typographyProps: {
123
123
  className: 'single-wallet-buttons--center',
124
124
  variant: 'button_primary',
125
- }, onClick: handleLogOut, children: "Disconnect" })] }));
125
+ }, onClick: () => handleLogOutWithReason('user-intent'), children: "Disconnect" })] }));
126
126
  };
127
127
 
128
128
  export { SingleWalletButtons };
@@ -125,7 +125,7 @@ var useInternalDynamicContext = require('../../../../context/DynamicContext/useD
125
125
  const SettingsView = () => {
126
126
  var _a, _b, _c, _d, _e;
127
127
  const { clearStackAndPush } = ViewContext.useViewContext();
128
- const { primaryWallet, handleLogOut, setShowAuthFlow } = useInternalDynamicContext.useInternalDynamicContext();
128
+ const { primaryWallet, handleLogOutWithReason, setShowAuthFlow } = useInternalDynamicContext.useInternalDynamicContext();
129
129
  const projectSettings = useProjectSettings.useProjectSettings();
130
130
  const { globalWallet } =
131
131
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
@@ -170,7 +170,7 @@ const SettingsView = () => {
170
170
  isEmbeddedWallet ||
171
171
  isV3WaasWallet ||
172
172
  isZKSyncEnabled.isZKSyncEnabled(projectSettings);
173
- return (jsxRuntime.jsxs("div", { className: 'settings-view', children: [jsxRuntime.jsx("div", { className: 'settings-view__body', children: shouldShowAccountAndSecuritySettings || globalWallet ? (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsxs("div", { className: 'settings-view__body__section', children: [(shouldShowAccountAndSecuritySettings || globalWallet) && (jsxRuntime.jsx("div", { className: 'settings-view__body__section__title', children: jsxRuntime.jsx(Typography.Typography, { copykey: 'dyn_settings.general_section.title', color: 'secondary', weight: 'medium', children: t('dyn_settings.general_section.title', 'General') }) })), shouldShowAccountAndSecuritySettings && (jsxRuntime.jsx(TypographyButton.TypographyButton, { dataTestId: 'account-and-security-button', buttonClassName: 'settings-view__body__section__button', onClick: handleAccountSecurityClick, startSlot: jsxRuntime.jsxs("div", { className: 'settings-view__body__section__button__start-slot', children: [jsxRuntime.jsx(accountAndSecurity.ReactComponent, { className: 'settings-view__body__section__button__icon' }), jsxRuntime.jsx(Typography.Typography, { color: 'primary', weight: 'medium', copykey: 'dyn_settings.account_security.title', children: t('dyn_settings.account_security.title') })] }), endSlot: jsxRuntime.jsx(chevronLeft.ReactComponent, { className: 'settings-view__body__section__button__icon-secondary--rotate' }), showInternalLoading: false }))] }), globalWallet && (jsxRuntime.jsxs("div", { className: 'settings-view__body__section', children: [jsxRuntime.jsx("div", { className: 'settings-view__body__section__title', children: jsxRuntime.jsx(Typography.Typography, { copykey: 'dyn_settings.global_connectivity_section.title', color: 'secondary', weight: 'medium', children: t('dyn_settings.global_connectivity_section.title') }) }), jsxRuntime.jsx(TypographyButton.TypographyButton, { onClick: handleConnectedAppsClick, dataTestId: 'connected-apps-button', buttonClassName: 'settings-view__body__section__button', startSlot: jsxRuntime.jsxs("div", { className: 'settings-view__body__section__button__start-slot', children: [jsxRuntime.jsx(connectedApps.ReactComponent, { className: 'settings-view__body__section__button__icon' }), jsxRuntime.jsx(Typography.Typography, { color: 'primary', weight: 'medium', copykey: 'dyn_settings.global_connectivity_section.connected_apps_button', children: t('dyn_settings.global_connectivity_section.connected_apps_button') })] }), endSlot: jsxRuntime.jsx(chevronLeft.ReactComponent, { className: 'settings-view__body__section__button__icon-secondary--rotate' }), showInternalLoading: false })] })), delegatedAccessEnabled && (jsxRuntime.jsxs("div", { className: 'settings-view__body__section', children: [jsxRuntime.jsx("div", { className: 'settings-view__body__section__title', children: jsxRuntime.jsx(Typography.Typography, { copykey: 'dyn_settings.account_permissions_section.title', color: 'secondary', weight: 'medium', children: t('dyn_settings.account_permissions_section.title') }) }), jsxRuntime.jsx(TypographyButton.TypographyButton, { onClick: handleWalletsDelegatedClick, dataTestId: 'wallets-delegated-settings-button', buttonClassName: 'settings-view__body__section__button', startSlot: jsxRuntime.jsxs("div", { className: 'settings-view__body__section__button__start-slot', children: [jsxRuntime.jsx(connect.ReactComponent, { className: 'settings-view__body__section__button__icon' }), jsxRuntime.jsx(Typography.Typography, { color: 'primary', weight: 'medium', copykey: 'dyn_settings.account_permissions_section.delegated_wallets_button', children: t('dyn_settings.account_permissions_section.delegated_wallets_button') })] }), endSlot: jsxRuntime.jsx(chevronLeft.ReactComponent, { className: 'settings-view__body__section__button__icon-secondary--rotate' }), showInternalLoading: false })] }))] })) : (jsxRuntime.jsx(EmptyScreen.EmptyScreen, {})) }), jsxRuntime.jsx("div", { className: 'settings-view__logout-button-container', children: jsxRuntime.jsx(TypographyButton.TypographyButton, { buttonClassName: 'settings-view__logout-button-container__button', onClick: handleLogOut, dataTestId: 'logout-button', copykey: 'dyn_settings.buttonLogout', children: t('dyn_settings.button_logout') }) }), !shouldShowAccountAndSecuritySettings && (jsxRuntime.jsx("div", { className: 'settings-view__delete-account-container', children: jsxRuntime.jsx(Typography.Typography, { onClick: handleDeleteAccountClick, "data-testid": 'delete-account-button', copykey: 'dyn_settings.delete_account.title', color: 'error-1', variant: 'body_small', className: 'settings-view__delete-account-container__delete-button', weight: 'medium', children: t('dyn_settings.delete_account.title') }) }))] }));
173
+ return (jsxRuntime.jsxs("div", { className: 'settings-view', children: [jsxRuntime.jsx("div", { className: 'settings-view__body', children: shouldShowAccountAndSecuritySettings || globalWallet ? (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsxs("div", { className: 'settings-view__body__section', children: [(shouldShowAccountAndSecuritySettings || globalWallet) && (jsxRuntime.jsx("div", { className: 'settings-view__body__section__title', children: jsxRuntime.jsx(Typography.Typography, { copykey: 'dyn_settings.general_section.title', color: 'secondary', weight: 'medium', children: t('dyn_settings.general_section.title', 'General') }) })), shouldShowAccountAndSecuritySettings && (jsxRuntime.jsx(TypographyButton.TypographyButton, { dataTestId: 'account-and-security-button', buttonClassName: 'settings-view__body__section__button', onClick: handleAccountSecurityClick, startSlot: jsxRuntime.jsxs("div", { className: 'settings-view__body__section__button__start-slot', children: [jsxRuntime.jsx(accountAndSecurity.ReactComponent, { className: 'settings-view__body__section__button__icon' }), jsxRuntime.jsx(Typography.Typography, { color: 'primary', weight: 'medium', copykey: 'dyn_settings.account_security.title', children: t('dyn_settings.account_security.title') })] }), endSlot: jsxRuntime.jsx(chevronLeft.ReactComponent, { className: 'settings-view__body__section__button__icon-secondary--rotate' }), showInternalLoading: false }))] }), globalWallet && (jsxRuntime.jsxs("div", { className: 'settings-view__body__section', children: [jsxRuntime.jsx("div", { className: 'settings-view__body__section__title', children: jsxRuntime.jsx(Typography.Typography, { copykey: 'dyn_settings.global_connectivity_section.title', color: 'secondary', weight: 'medium', children: t('dyn_settings.global_connectivity_section.title') }) }), jsxRuntime.jsx(TypographyButton.TypographyButton, { onClick: handleConnectedAppsClick, dataTestId: 'connected-apps-button', buttonClassName: 'settings-view__body__section__button', startSlot: jsxRuntime.jsxs("div", { className: 'settings-view__body__section__button__start-slot', children: [jsxRuntime.jsx(connectedApps.ReactComponent, { className: 'settings-view__body__section__button__icon' }), jsxRuntime.jsx(Typography.Typography, { color: 'primary', weight: 'medium', copykey: 'dyn_settings.global_connectivity_section.connected_apps_button', children: t('dyn_settings.global_connectivity_section.connected_apps_button') })] }), endSlot: jsxRuntime.jsx(chevronLeft.ReactComponent, { className: 'settings-view__body__section__button__icon-secondary--rotate' }), showInternalLoading: false })] })), delegatedAccessEnabled && (jsxRuntime.jsxs("div", { className: 'settings-view__body__section', children: [jsxRuntime.jsx("div", { className: 'settings-view__body__section__title', children: jsxRuntime.jsx(Typography.Typography, { copykey: 'dyn_settings.account_permissions_section.title', color: 'secondary', weight: 'medium', children: t('dyn_settings.account_permissions_section.title') }) }), jsxRuntime.jsx(TypographyButton.TypographyButton, { onClick: handleWalletsDelegatedClick, dataTestId: 'wallets-delegated-settings-button', buttonClassName: 'settings-view__body__section__button', startSlot: jsxRuntime.jsxs("div", { className: 'settings-view__body__section__button__start-slot', children: [jsxRuntime.jsx(connect.ReactComponent, { className: 'settings-view__body__section__button__icon' }), jsxRuntime.jsx(Typography.Typography, { color: 'primary', weight: 'medium', copykey: 'dyn_settings.account_permissions_section.delegated_wallets_button', children: t('dyn_settings.account_permissions_section.delegated_wallets_button') })] }), endSlot: jsxRuntime.jsx(chevronLeft.ReactComponent, { className: 'settings-view__body__section__button__icon-secondary--rotate' }), showInternalLoading: false })] }))] })) : (jsxRuntime.jsx(EmptyScreen.EmptyScreen, {})) }), jsxRuntime.jsx("div", { className: 'settings-view__logout-button-container', children: jsxRuntime.jsx(TypographyButton.TypographyButton, { buttonClassName: 'settings-view__logout-button-container__button', onClick: () => handleLogOutWithReason('user-intent'), dataTestId: 'logout-button', copykey: 'dyn_settings.buttonLogout', children: t('dyn_settings.button_logout') }) }), !shouldShowAccountAndSecuritySettings && (jsxRuntime.jsx("div", { className: 'settings-view__delete-account-container', children: jsxRuntime.jsx(Typography.Typography, { onClick: handleDeleteAccountClick, "data-testid": 'delete-account-button', copykey: 'dyn_settings.delete_account.title', color: 'error-1', variant: 'body_small', className: 'settings-view__delete-account-container__delete-button', weight: 'medium', children: t('dyn_settings.delete_account.title') }) }))] }));
174
174
  };
175
175
 
176
176
  exports.SettingsView = SettingsView;
@@ -121,7 +121,7 @@ import { useInternalDynamicContext } from '../../../../context/DynamicContext/us
121
121
  const SettingsView = () => {
122
122
  var _a, _b, _c, _d, _e;
123
123
  const { clearStackAndPush } = useViewContext();
124
- const { primaryWallet, handleLogOut, setShowAuthFlow } = useInternalDynamicContext();
124
+ const { primaryWallet, handleLogOutWithReason, setShowAuthFlow } = useInternalDynamicContext();
125
125
  const projectSettings = useProjectSettings();
126
126
  const { globalWallet } =
127
127
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
@@ -166,7 +166,7 @@ const SettingsView = () => {
166
166
  isEmbeddedWallet ||
167
167
  isV3WaasWallet ||
168
168
  isZKSyncEnabled(projectSettings);
169
- return (jsxs("div", { className: 'settings-view', children: [jsx("div", { className: 'settings-view__body', children: shouldShowAccountAndSecuritySettings || globalWallet ? (jsxs(Fragment, { children: [jsxs("div", { className: 'settings-view__body__section', children: [(shouldShowAccountAndSecuritySettings || globalWallet) && (jsx("div", { className: 'settings-view__body__section__title', children: jsx(Typography, { copykey: 'dyn_settings.general_section.title', color: 'secondary', weight: 'medium', children: t('dyn_settings.general_section.title', 'General') }) })), shouldShowAccountAndSecuritySettings && (jsx(TypographyButton, { dataTestId: 'account-and-security-button', buttonClassName: 'settings-view__body__section__button', onClick: handleAccountSecurityClick, startSlot: jsxs("div", { className: 'settings-view__body__section__button__start-slot', children: [jsx(SvgAccountAndSecurity, { className: 'settings-view__body__section__button__icon' }), jsx(Typography, { color: 'primary', weight: 'medium', copykey: 'dyn_settings.account_security.title', children: t('dyn_settings.account_security.title') })] }), endSlot: jsx(SvgChevronLeft, { className: 'settings-view__body__section__button__icon-secondary--rotate' }), showInternalLoading: false }))] }), globalWallet && (jsxs("div", { className: 'settings-view__body__section', children: [jsx("div", { className: 'settings-view__body__section__title', children: jsx(Typography, { copykey: 'dyn_settings.global_connectivity_section.title', color: 'secondary', weight: 'medium', children: t('dyn_settings.global_connectivity_section.title') }) }), jsx(TypographyButton, { onClick: handleConnectedAppsClick, dataTestId: 'connected-apps-button', buttonClassName: 'settings-view__body__section__button', startSlot: jsxs("div", { className: 'settings-view__body__section__button__start-slot', children: [jsx(SvgConnectedApps, { className: 'settings-view__body__section__button__icon' }), jsx(Typography, { color: 'primary', weight: 'medium', copykey: 'dyn_settings.global_connectivity_section.connected_apps_button', children: t('dyn_settings.global_connectivity_section.connected_apps_button') })] }), endSlot: jsx(SvgChevronLeft, { className: 'settings-view__body__section__button__icon-secondary--rotate' }), showInternalLoading: false })] })), delegatedAccessEnabled && (jsxs("div", { className: 'settings-view__body__section', children: [jsx("div", { className: 'settings-view__body__section__title', children: jsx(Typography, { copykey: 'dyn_settings.account_permissions_section.title', color: 'secondary', weight: 'medium', children: t('dyn_settings.account_permissions_section.title') }) }), jsx(TypographyButton, { onClick: handleWalletsDelegatedClick, dataTestId: 'wallets-delegated-settings-button', buttonClassName: 'settings-view__body__section__button', startSlot: jsxs("div", { className: 'settings-view__body__section__button__start-slot', children: [jsx(SvgConnect, { className: 'settings-view__body__section__button__icon' }), jsx(Typography, { color: 'primary', weight: 'medium', copykey: 'dyn_settings.account_permissions_section.delegated_wallets_button', children: t('dyn_settings.account_permissions_section.delegated_wallets_button') })] }), endSlot: jsx(SvgChevronLeft, { className: 'settings-view__body__section__button__icon-secondary--rotate' }), showInternalLoading: false })] }))] })) : (jsx(EmptyScreen, {})) }), jsx("div", { className: 'settings-view__logout-button-container', children: jsx(TypographyButton, { buttonClassName: 'settings-view__logout-button-container__button', onClick: handleLogOut, dataTestId: 'logout-button', copykey: 'dyn_settings.buttonLogout', children: t('dyn_settings.button_logout') }) }), !shouldShowAccountAndSecuritySettings && (jsx("div", { className: 'settings-view__delete-account-container', children: jsx(Typography, { onClick: handleDeleteAccountClick, "data-testid": 'delete-account-button', copykey: 'dyn_settings.delete_account.title', color: 'error-1', variant: 'body_small', className: 'settings-view__delete-account-container__delete-button', weight: 'medium', children: t('dyn_settings.delete_account.title') }) }))] }));
169
+ return (jsxs("div", { className: 'settings-view', children: [jsx("div", { className: 'settings-view__body', children: shouldShowAccountAndSecuritySettings || globalWallet ? (jsxs(Fragment, { children: [jsxs("div", { className: 'settings-view__body__section', children: [(shouldShowAccountAndSecuritySettings || globalWallet) && (jsx("div", { className: 'settings-view__body__section__title', children: jsx(Typography, { copykey: 'dyn_settings.general_section.title', color: 'secondary', weight: 'medium', children: t('dyn_settings.general_section.title', 'General') }) })), shouldShowAccountAndSecuritySettings && (jsx(TypographyButton, { dataTestId: 'account-and-security-button', buttonClassName: 'settings-view__body__section__button', onClick: handleAccountSecurityClick, startSlot: jsxs("div", { className: 'settings-view__body__section__button__start-slot', children: [jsx(SvgAccountAndSecurity, { className: 'settings-view__body__section__button__icon' }), jsx(Typography, { color: 'primary', weight: 'medium', copykey: 'dyn_settings.account_security.title', children: t('dyn_settings.account_security.title') })] }), endSlot: jsx(SvgChevronLeft, { className: 'settings-view__body__section__button__icon-secondary--rotate' }), showInternalLoading: false }))] }), globalWallet && (jsxs("div", { className: 'settings-view__body__section', children: [jsx("div", { className: 'settings-view__body__section__title', children: jsx(Typography, { copykey: 'dyn_settings.global_connectivity_section.title', color: 'secondary', weight: 'medium', children: t('dyn_settings.global_connectivity_section.title') }) }), jsx(TypographyButton, { onClick: handleConnectedAppsClick, dataTestId: 'connected-apps-button', buttonClassName: 'settings-view__body__section__button', startSlot: jsxs("div", { className: 'settings-view__body__section__button__start-slot', children: [jsx(SvgConnectedApps, { className: 'settings-view__body__section__button__icon' }), jsx(Typography, { color: 'primary', weight: 'medium', copykey: 'dyn_settings.global_connectivity_section.connected_apps_button', children: t('dyn_settings.global_connectivity_section.connected_apps_button') })] }), endSlot: jsx(SvgChevronLeft, { className: 'settings-view__body__section__button__icon-secondary--rotate' }), showInternalLoading: false })] })), delegatedAccessEnabled && (jsxs("div", { className: 'settings-view__body__section', children: [jsx("div", { className: 'settings-view__body__section__title', children: jsx(Typography, { copykey: 'dyn_settings.account_permissions_section.title', color: 'secondary', weight: 'medium', children: t('dyn_settings.account_permissions_section.title') }) }), jsx(TypographyButton, { onClick: handleWalletsDelegatedClick, dataTestId: 'wallets-delegated-settings-button', buttonClassName: 'settings-view__body__section__button', startSlot: jsxs("div", { className: 'settings-view__body__section__button__start-slot', children: [jsx(SvgConnect, { className: 'settings-view__body__section__button__icon' }), jsx(Typography, { color: 'primary', weight: 'medium', copykey: 'dyn_settings.account_permissions_section.delegated_wallets_button', children: t('dyn_settings.account_permissions_section.delegated_wallets_button') })] }), endSlot: jsx(SvgChevronLeft, { className: 'settings-view__body__section__button__icon-secondary--rotate' }), showInternalLoading: false })] }))] })) : (jsx(EmptyScreen, {})) }), jsx("div", { className: 'settings-view__logout-button-container', children: jsx(TypographyButton, { buttonClassName: 'settings-view__logout-button-container__button', onClick: () => handleLogOutWithReason('user-intent'), dataTestId: 'logout-button', copykey: 'dyn_settings.buttonLogout', children: t('dyn_settings.button_logout') }) }), !shouldShowAccountAndSecuritySettings && (jsx("div", { className: 'settings-view__delete-account-container', children: jsx(Typography, { onClick: handleDeleteAccountClick, "data-testid": 'delete-account-button', copykey: 'dyn_settings.delete_account.title', color: 'error-1', variant: 'body_small', className: 'settings-view__delete-account-container__delete-button', weight: 'medium', children: t('dyn_settings.delete_account.title') }) }))] }));
170
170
  };
171
171
 
172
172
  export { SettingsView };
@@ -15,9 +15,10 @@ var ViewContext = require('../../../../context/ViewContext/ViewContext.cjs');
15
15
  var chevronLeft = require('../../../../shared/assets/chevron-left.cjs');
16
16
  var questionMark = require('../../../../shared/assets/question-mark.cjs');
17
17
  require('@dynamic-labs/iconic');
18
+ var useGoogleDriveBackupReadiness = require('../../../../utils/hooks/useGoogleDriveBackupReadiness/useGoogleDriveBackupReadiness.cjs');
18
19
  var useSocialAccounts = require('../../../../utils/hooks/useSocialAccounts/useSocialAccounts.cjs');
19
20
  var useWalletBackup = require('../../../../utils/hooks/useWalletBackup/useWalletBackup.cjs');
20
- require('../../../../utils/hooks/useWalletBackup/types.cjs');
21
+ var types = require('../../../../utils/hooks/useWalletBackup/types.cjs');
21
22
  var BackupStepper = require('./BackupStepper.cjs');
22
23
 
23
24
  const WaasBackupCloudProviderView = () => {
@@ -26,6 +27,7 @@ const WaasBackupCloudProviderView = () => {
26
27
  const { t } = reactI18next.useTranslation();
27
28
  const { isProcessingForProvider, error: socialError } = useSocialAccounts.useSocialAccounts();
28
29
  const { ensureProviderLinked, getSupportedProviders } = useWalletBackup.useWalletBackup();
30
+ const { check: checkDriveReadiness, isChecking: isCheckingDriveReadiness } = useGoogleDriveBackupReadiness.useGoogleDriveBackupReadiness();
29
31
  const [errorMessage, setErrorMessage] = React.useState(null);
30
32
  const providers = getSupportedProviders();
31
33
  const handleBackClick = React.useCallback(() => goBack(), [goBack]);
@@ -44,13 +46,26 @@ const WaasBackupCloudProviderView = () => {
44
46
  return;
45
47
  }
46
48
  }
49
+ if (provider === types.CloudBackupProvider.GoogleDrive) {
50
+ const readiness = yield checkDriveReadiness();
51
+ if (readiness.status === 'needs-access') {
52
+ pushView('waas-backup-grant-access-view');
53
+ return;
54
+ }
55
+ if (readiness.status === 'error') {
56
+ setErrorMessage(t('dyn_waas.backup.error'));
57
+ return;
58
+ }
59
+ }
47
60
  pushView('waas-backup-progress-view', { provider });
48
- }), [ensureProviderLinked, pushView, providers, t]);
61
+ }), [checkDriveReadiness, ensureProviderLinked, pushView, providers, t]);
49
62
  const backButton = (jsxRuntime.jsx(IconButton.IconButton, { type: 'button', onClick: handleBackClick, "data-testid": 'back-button', children: jsxRuntime.jsx(chevronLeft.ReactComponent, {}) }));
50
63
  const infoButton = (jsxRuntime.jsx(IconButton.IconButton, { type: 'button', onClick: handleInfoClick, "data-testid": 'info-button', children: jsxRuntime.jsx(questionMark.ReactComponent, {}) }));
51
- 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') }), providers.map((providerConfig) => (jsxRuntime.jsxs("button", { type: 'button', className: 'waas-backup-view__provider-button', onClick: () => handleProviderClick(providerConfig.id), disabled: providerConfig.requiresOAuth &&
64
+ 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') }), providers.map((providerConfig) => (jsxRuntime.jsxs("button", { type: 'button', className: 'waas-backup-view__provider-button', onClick: () => handleProviderClick(providerConfig.id), disabled: (providerConfig.requiresOAuth &&
52
65
  providerConfig.oauthProvider &&
53
- isProcessingForProvider(providerConfig.oauthProvider), "data-testid": `${providerConfig.id}-button`, children: [providerConfig.icon, jsxRuntime.jsx(Typography.Typography, { variant: 'body_normal', color: 'primary', children: t(`dyn_waas.backup.backup_to_${providerConfig.id}`, `Backup to ${providerConfig.name}`) })] }, providerConfig.id)))] }) })] }));
66
+ isProcessingForProvider(providerConfig.oauthProvider)) ||
67
+ (providerConfig.id === types.CloudBackupProvider.GoogleDrive &&
68
+ isCheckingDriveReadiness), "data-testid": `${providerConfig.id}-button`, children: [providerConfig.icon, jsxRuntime.jsx(Typography.Typography, { variant: 'body_normal', color: 'primary', children: t(`dyn_waas.backup.backup_to_${providerConfig.id}`, `Backup to ${providerConfig.name}`) })] }, providerConfig.id)))] }) })] }));
54
69
  };
55
70
 
56
71
  exports.WaasBackupCloudProviderView = WaasBackupCloudProviderView;
@@ -11,9 +11,10 @@ import { useViewContext } from '../../../../context/ViewContext/ViewContext.js';
11
11
  import { ReactComponent as SvgChevronLeft } from '../../../../shared/assets/chevron-left.js';
12
12
  import { ReactComponent as SvgQuestionMark } from '../../../../shared/assets/question-mark.js';
13
13
  import '@dynamic-labs/iconic';
14
+ import { useGoogleDriveBackupReadiness } from '../../../../utils/hooks/useGoogleDriveBackupReadiness/useGoogleDriveBackupReadiness.js';
14
15
  import { useSocialAccounts } from '../../../../utils/hooks/useSocialAccounts/useSocialAccounts.js';
15
16
  import { useWalletBackup } from '../../../../utils/hooks/useWalletBackup/useWalletBackup.js';
16
- import '../../../../utils/hooks/useWalletBackup/types.js';
17
+ import { CloudBackupProvider } from '../../../../utils/hooks/useWalletBackup/types.js';
17
18
  import { BackupStepper } from './BackupStepper.js';
18
19
 
19
20
  const WaasBackupCloudProviderView = () => {
@@ -22,6 +23,7 @@ const WaasBackupCloudProviderView = () => {
22
23
  const { t } = useTranslation();
23
24
  const { isProcessingForProvider, error: socialError } = useSocialAccounts();
24
25
  const { ensureProviderLinked, getSupportedProviders } = useWalletBackup();
26
+ const { check: checkDriveReadiness, isChecking: isCheckingDriveReadiness } = useGoogleDriveBackupReadiness();
25
27
  const [errorMessage, setErrorMessage] = useState(null);
26
28
  const providers = getSupportedProviders();
27
29
  const handleBackClick = useCallback(() => goBack(), [goBack]);
@@ -40,13 +42,26 @@ const WaasBackupCloudProviderView = () => {
40
42
  return;
41
43
  }
42
44
  }
45
+ if (provider === CloudBackupProvider.GoogleDrive) {
46
+ const readiness = yield checkDriveReadiness();
47
+ if (readiness.status === 'needs-access') {
48
+ pushView('waas-backup-grant-access-view');
49
+ return;
50
+ }
51
+ if (readiness.status === 'error') {
52
+ setErrorMessage(t('dyn_waas.backup.error'));
53
+ return;
54
+ }
55
+ }
43
56
  pushView('waas-backup-progress-view', { provider });
44
- }), [ensureProviderLinked, pushView, providers, t]);
57
+ }), [checkDriveReadiness, ensureProviderLinked, pushView, providers, t]);
45
58
  const backButton = (jsx(IconButton, { type: 'button', onClick: handleBackClick, "data-testid": 'back-button', children: jsx(SvgChevronLeft, {}) }));
46
59
  const infoButton = (jsx(IconButton, { type: 'button', onClick: handleInfoClick, "data-testid": 'info-button', children: jsx(SvgQuestionMark, {}) }));
47
- 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') }), providers.map((providerConfig) => (jsxs("button", { type: 'button', className: 'waas-backup-view__provider-button', onClick: () => handleProviderClick(providerConfig.id), disabled: providerConfig.requiresOAuth &&
60
+ 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') }), providers.map((providerConfig) => (jsxs("button", { type: 'button', className: 'waas-backup-view__provider-button', onClick: () => handleProviderClick(providerConfig.id), disabled: (providerConfig.requiresOAuth &&
48
61
  providerConfig.oauthProvider &&
49
- isProcessingForProvider(providerConfig.oauthProvider), "data-testid": `${providerConfig.id}-button`, children: [providerConfig.icon, jsx(Typography, { variant: 'body_normal', color: 'primary', children: t(`dyn_waas.backup.backup_to_${providerConfig.id}`, `Backup to ${providerConfig.name}`) })] }, providerConfig.id)))] }) })] }));
62
+ isProcessingForProvider(providerConfig.oauthProvider)) ||
63
+ (providerConfig.id === CloudBackupProvider.GoogleDrive &&
64
+ isCheckingDriveReadiness), "data-testid": `${providerConfig.id}-button`, children: [providerConfig.icon, jsx(Typography, { variant: 'body_normal', color: 'primary', children: t(`dyn_waas.backup.backup_to_${providerConfig.id}`, `Backup to ${providerConfig.name}`) })] }, providerConfig.id)))] }) })] }));
50
65
  };
51
66
 
52
67
  export { WaasBackupCloudProviderView };
@@ -0,0 +1,50 @@
1
+ 'use client'
2
+ 'use strict';
3
+
4
+ Object.defineProperty(exports, '__esModule', { value: true });
5
+
6
+ var _tslib = require('../../../../../../_virtual/_tslib.cjs');
7
+ var jsxRuntime = require('react/jsx-runtime');
8
+ var React = require('react');
9
+ var reactI18next = require('react-i18next');
10
+ var ErrorContainer = require('../../../../components/ErrorContainer/ErrorContainer.cjs');
11
+ var IconButton = require('../../../../components/IconButton/IconButton.cjs');
12
+ var ModalHeader = require('../../../../components/ModalHeader/ModalHeader.cjs');
13
+ var Typography = require('../../../../components/Typography/Typography.cjs');
14
+ var TypographyButton = require('../../../../components/TypographyButton/TypographyButton.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 dynamicContextProps = require('../../../../store/state/dynamicContextProps/dynamicContextProps.cjs');
20
+ var useGoogleDriveBackupReadiness = require('../../../../utils/hooks/useGoogleDriveBackupReadiness/useGoogleDriveBackupReadiness.cjs');
21
+ var types = require('../../../../utils/hooks/useWalletBackup/types.cjs');
22
+ var BackupStepper = require('./BackupStepper.cjs');
23
+
24
+ const WaasBackupGrantAccessView = () => {
25
+ const { pushView, goBack } = ViewContext.useViewContext();
26
+ const { t } = reactI18next.useTranslation();
27
+ const { appName } = dynamicContextProps.useDynamicSettings();
28
+ const { requestAccess, isChecking } = useGoogleDriveBackupReadiness.useGoogleDriveBackupReadiness();
29
+ const [showError, setShowError] = React.useState(false);
30
+ const handleBackClick = React.useCallback(() => goBack(), [goBack]);
31
+ const handleInfoClick = React.useCallback(() => {
32
+ pushView('waas-backup-info-view');
33
+ }, [pushView]);
34
+ const handleGrantClick = React.useCallback(() => _tslib.__awaiter(void 0, void 0, void 0, function* () {
35
+ setShowError(false);
36
+ const result = yield requestAccess();
37
+ if (result.status === 'ready') {
38
+ pushView('waas-backup-progress-view', {
39
+ provider: types.CloudBackupProvider.GoogleDrive,
40
+ });
41
+ return;
42
+ }
43
+ setShowError(true);
44
+ }), [pushView, requestAccess]);
45
+ const backButton = (jsxRuntime.jsx(IconButton.IconButton, { type: 'button', onClick: handleBackClick, "data-testid": 'back-button', children: jsxRuntime.jsx(chevronLeft.ReactComponent, {}) }));
46
+ const infoButton = (jsxRuntime.jsx(IconButton.IconButton, { type: 'button', onClick: handleInfoClick, "data-testid": 'info-button', children: jsxRuntime.jsx(questionMark.ReactComponent, {}) }));
47
+ 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 }), showError && (jsxRuntime.jsx(ErrorContainer.ErrorContainer, { variant: 'error', withIcon: false, children: t('dyn_waas.backup.gdrive_grant_access_error') })), jsxRuntime.jsx(Typography.Typography, { variant: 'title', color: 'primary', copykey: 'dyn_waas.backup.gdrive_grant_access_title', className: 'waas-backup-view__cloud-title', children: t('dyn_waas.backup.gdrive_grant_access_title') }), jsxRuntime.jsx(Typography.Typography, { variant: 'body_normal', color: 'secondary', copykey: 'dyn_waas.backup.gdrive_grant_access_subtitle', className: 'waas-backup-view__cloud-subtitle', children: t('dyn_waas.backup.gdrive_grant_access_subtitle', { appName }) }), jsxRuntime.jsxs("div", { className: 'waas-backup-view__grant-access-actions', children: [jsxRuntime.jsx(TypographyButton.TypographyButton, { dataTestId: 'grant-access-cancel-button', onClick: handleBackClick, disabled: isChecking, copykey: 'dyn_waas.backup.gdrive_grant_access_cancel', buttonVariant: 'primary', typographyProps: { color: 'inherit' }, children: t('dyn_waas.backup.gdrive_grant_access_cancel') }), jsxRuntime.jsx(TypographyButton.TypographyButton, { dataTestId: 'grant-access-button', onClick: handleGrantClick, disabled: isChecking, copykey: 'dyn_waas.backup.gdrive_grant_access_cta', buttonVariant: 'brand-primary', typographyProps: { color: 'inherit' }, children: t('dyn_waas.backup.gdrive_grant_access_cta') })] })] }) })] }));
48
+ };
49
+
50
+ exports.WaasBackupGrantAccessView = WaasBackupGrantAccessView;
@@ -0,0 +1,2 @@
1
+ import { FC } from 'react';
2
+ export declare const WaasBackupGrantAccessView: FC;
@@ -0,0 +1,46 @@
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 { ErrorContainer } from '../../../../components/ErrorContainer/ErrorContainer.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 { 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 { useDynamicSettings } from '../../../../store/state/dynamicContextProps/dynamicContextProps.js';
16
+ import { useGoogleDriveBackupReadiness } from '../../../../utils/hooks/useGoogleDriveBackupReadiness/useGoogleDriveBackupReadiness.js';
17
+ import { CloudBackupProvider } from '../../../../utils/hooks/useWalletBackup/types.js';
18
+ import { BackupStepper } from './BackupStepper.js';
19
+
20
+ const WaasBackupGrantAccessView = () => {
21
+ const { pushView, goBack } = useViewContext();
22
+ const { t } = useTranslation();
23
+ const { appName } = useDynamicSettings();
24
+ const { requestAccess, isChecking } = useGoogleDriveBackupReadiness();
25
+ const [showError, setShowError] = useState(false);
26
+ const handleBackClick = useCallback(() => goBack(), [goBack]);
27
+ const handleInfoClick = useCallback(() => {
28
+ pushView('waas-backup-info-view');
29
+ }, [pushView]);
30
+ const handleGrantClick = useCallback(() => __awaiter(void 0, void 0, void 0, function* () {
31
+ setShowError(false);
32
+ const result = yield requestAccess();
33
+ if (result.status === 'ready') {
34
+ pushView('waas-backup-progress-view', {
35
+ provider: CloudBackupProvider.GoogleDrive,
36
+ });
37
+ return;
38
+ }
39
+ setShowError(true);
40
+ }), [pushView, requestAccess]);
41
+ const backButton = (jsx(IconButton, { type: 'button', onClick: handleBackClick, "data-testid": 'back-button', children: jsx(SvgChevronLeft, {}) }));
42
+ const infoButton = (jsx(IconButton, { type: 'button', onClick: handleInfoClick, "data-testid": 'info-button', children: jsx(SvgQuestionMark, {}) }));
43
+ 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 }), showError && (jsx(ErrorContainer, { variant: 'error', withIcon: false, children: t('dyn_waas.backup.gdrive_grant_access_error') })), jsx(Typography, { variant: 'title', color: 'primary', copykey: 'dyn_waas.backup.gdrive_grant_access_title', className: 'waas-backup-view__cloud-title', children: t('dyn_waas.backup.gdrive_grant_access_title') }), jsx(Typography, { variant: 'body_normal', color: 'secondary', copykey: 'dyn_waas.backup.gdrive_grant_access_subtitle', className: 'waas-backup-view__cloud-subtitle', children: t('dyn_waas.backup.gdrive_grant_access_subtitle', { appName }) }), jsxs("div", { className: 'waas-backup-view__grant-access-actions', children: [jsx(TypographyButton, { dataTestId: 'grant-access-cancel-button', onClick: handleBackClick, disabled: isChecking, copykey: 'dyn_waas.backup.gdrive_grant_access_cancel', buttonVariant: 'primary', typographyProps: { color: 'inherit' }, children: t('dyn_waas.backup.gdrive_grant_access_cancel') }), jsx(TypographyButton, { dataTestId: 'grant-access-button', onClick: handleGrantClick, disabled: isChecking, copykey: 'dyn_waas.backup.gdrive_grant_access_cta', buttonVariant: 'brand-primary', typographyProps: { color: 'inherit' }, children: t('dyn_waas.backup.gdrive_grant_access_cta') })] })] }) })] }));
44
+ };
45
+
46
+ export { WaasBackupGrantAccessView };
@@ -15,15 +15,18 @@ var ViewContext = require('../../../../context/ViewContext/ViewContext.cjs');
15
15
  var chevronLeft = require('../../../../shared/assets/chevron-left.cjs');
16
16
  var exclamation = require('../../../../shared/assets/exclamation.cjs');
17
17
  require('@dynamic-labs/iconic');
18
+ var useGoogleDriveBackupReadiness = require('../../../../utils/hooks/useGoogleDriveBackupReadiness/useGoogleDriveBackupReadiness.cjs');
18
19
  var useWalletBackup = require('../../../../utils/hooks/useWalletBackup/useWalletBackup.cjs');
19
20
  var types = require('../../../../utils/hooks/useWalletBackup/types.cjs');
21
+ var googleDriveBackupErrors = require('../../../../utils/hooks/useWalletBackup/googleDriveBackupErrors.cjs');
20
22
  var cloudProviders = require('../../../../utils/hooks/useWalletBackup/cloudProviders.cjs');
21
23
 
22
24
  const WaasBackupProgressView = ({ provider = types.CloudBackupProvider.GoogleDrive, }) => {
23
25
  const { goBack, pushView } = ViewContext.useViewContext();
24
26
  const { t } = reactI18next.useTranslation();
25
27
  const providerConfig = cloudProviders.CLOUD_PROVIDER_CONFIGS[provider];
26
- const { getWalletsToBackup, showICloudAuth, checkICloudAuth, hideICloudAuth, } = useWalletBackup.useWalletBackup();
28
+ const { getWalletsToBackup, showICloudAuth, checkICloudAuth, hideICloudAuth, lastBackupError, clearBackupError, } = useWalletBackup.useWalletBackup();
29
+ const { requestAccess: requestDriveAccess, isChecking: isRequestingDriveAccess, } = useGoogleDriveBackupReadiness.useGoogleDriveBackupReadiness();
27
30
  const [displayContainer, setDisplayContainer] = React.useState(null);
28
31
  const [authState, setAuthState] = React.useState('pending');
29
32
  const [authError, setAuthError] = React.useState(null);
@@ -130,6 +133,15 @@ const WaasBackupProgressView = ({ provider = types.CloudBackupProvider.GoogleDri
130
133
  retry();
131
134
  }
132
135
  }, [providerConfig.requiresIframe, retry]);
136
+ const handleGrantDriveAccessAndRetry = React.useCallback(() => _tslib.__awaiter(void 0, void 0, void 0, function* () {
137
+ clearBackupError();
138
+ const result = yield requestDriveAccess();
139
+ if (result.status === 'ready') {
140
+ retry();
141
+ }
142
+ }), [clearBackupError, requestDriveAccess, retry]);
143
+ const isDriveScopesError = provider === types.CloudBackupProvider.GoogleDrive &&
144
+ googleDriveBackupErrors.isInsufficientGoogleDriveScopesError(lastBackupError);
133
145
  const getProgressText = () => {
134
146
  if (isComplete) {
135
147
  return t('dyn_waas.backup.progress_complete');
@@ -144,9 +156,17 @@ const WaasBackupProgressView = ({ provider = types.CloudBackupProvider.GoogleDri
144
156
  };
145
157
  const renderProgressContent = () => {
146
158
  if (hasError || authState === 'failed') {
147
- 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: authError || 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: handleRetry, copykey: 'dyn_waas.backup.error_try_again', buttonVariant: 'brand-primary', typographyProps: {
159
+ const titleCopykey = isDriveScopesError
160
+ ? 'dyn_waas.backup.gdrive_post_flight_title'
161
+ : 'dyn_waas.backup.error_title';
162
+ const titleText = isDriveScopesError
163
+ ? t('dyn_waas.backup.gdrive_post_flight_title')
164
+ : authError || t('dyn_waas.backup.error_title');
165
+ return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(Typography.Typography, { variant: 'body_normal', color: 'primary', copykey: titleCopykey, className: 'waas-backup-view__progress-title', children: titleText }), jsxRuntime.jsx("div", { className: 'waas-backup-view__progress-actions', children: isDriveScopesError ? (jsxRuntime.jsx(TypographyButton.TypographyButton, { dataTestId: 'grant-drive-access-button', onClick: handleGrantDriveAccessAndRetry, disabled: isRequestingDriveAccess, copykey: 'dyn_waas.backup.gdrive_grant_access_cta', buttonVariant: 'brand-primary', typographyProps: {
166
+ color: 'inherit',
167
+ }, expanded: true, children: t('dyn_waas.backup.gdrive_grant_access_cta') })) : (jsxRuntime.jsx(TypographyButton.TypographyButton, { dataTestId: 'retry-backup-button', onClick: handleRetry, copykey: 'dyn_waas.backup.error_try_again', buttonVariant: 'brand-primary', typographyProps: {
148
168
  color: 'inherit',
149
- }, expanded: true, children: t('dyn_waas.backup.error_try_again') }) })] }));
169
+ }, expanded: true, children: t('dyn_waas.backup.error_try_again') })) })] }));
150
170
  }
151
171
  if (providerConfig.requiresIframe &&
152
172
  authState === 'shown' &&