@dynamic-labs/sdk-react-core 1.2.0-alpha.0 → 1.2.0-alpha.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.
Files changed (67) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/package.cjs +1 -1
  3. package/package.js +1 -1
  4. package/package.json +10 -10
  5. package/src/index.cjs +1 -0
  6. package/src/index.js +1 -1
  7. package/src/lib/components/Badge/Badge.cjs +1 -1
  8. package/src/lib/components/Badge/Badge.d.ts +1 -1
  9. package/src/lib/components/Badge/Badge.js +1 -1
  10. package/src/lib/components/Badge/Badge.types.d.ts +1 -0
  11. package/src/lib/components/IconWithSpinner/IconWithSpinner.cjs +2 -13
  12. package/src/lib/components/IconWithSpinner/IconWithSpinner.js +2 -13
  13. package/src/lib/context/DynamicContext/DynamicContext.cjs +4 -2
  14. package/src/lib/context/DynamicContext/DynamicContext.d.ts +2 -1
  15. package/src/lib/context/DynamicContext/DynamicContext.js +5 -3
  16. package/src/lib/context/DynamicContext/types/index.d.ts +3 -2
  17. package/src/lib/locale/en/translation.cjs +8 -0
  18. package/src/lib/locale/en/translation.d.ts +8 -0
  19. package/src/lib/locale/en/translation.js +8 -0
  20. package/src/lib/main.global.cjs +1 -1
  21. package/src/lib/main.global.js +1 -1
  22. package/src/lib/shared/types/index.d.ts +5 -1
  23. package/src/lib/shared/utils/functions/getWalletListItemLabel/getWalletListItemLabel.cjs +23 -10
  24. package/src/lib/shared/utils/functions/getWalletListItemLabel/getWalletListItemLabel.d.ts +7 -3
  25. package/src/lib/shared/utils/functions/getWalletListItemLabel/getWalletListItemLabel.js +23 -10
  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/functions/walletFilters/index.cjs +6 -0
  29. package/src/lib/utils/functions/walletFilters/index.d.ts +5 -0
  30. package/src/lib/utils/functions/walletFilters/index.js +6 -1
  31. package/src/lib/utils/functions/walletListBuilder/walletListBuilder.cjs +30 -8
  32. package/src/lib/utils/functions/walletListBuilder/walletListBuilder.d.ts +3 -2
  33. package/src/lib/utils/functions/walletListBuilder/walletListBuilder.js +30 -8
  34. package/src/lib/utils/hooks/useEmbeddedReveal/useEmbeddedReveal.cjs +1 -6
  35. package/src/lib/utils/hooks/useEmbeddedReveal/useEmbeddedReveal.js +1 -6
  36. package/src/lib/utils/hooks/usePasskeyRecovery/usePasskeyRecovery.cjs +9 -15
  37. package/src/lib/utils/hooks/usePasskeyRecovery/usePasskeyRecovery.js +10 -16
  38. package/src/lib/views/EmbeddedReveal/EmbeddedRevealView/EmbeddedRevealView.cjs +21 -19
  39. package/src/lib/views/EmbeddedReveal/EmbeddedRevealView/EmbeddedRevealView.d.ts +5 -1
  40. package/src/lib/views/EmbeddedReveal/EmbeddedRevealView/EmbeddedRevealView.js +22 -20
  41. package/src/lib/views/LoginView/sections/WalletSignInSection/ListItemButton/ListItemButton.cjs +1 -1
  42. package/src/lib/views/LoginView/sections/WalletSignInSection/ListItemButton/ListItemButton.js +1 -1
  43. package/src/lib/views/LoginView/sections/WalletSignInSection/WalletSimpleSignIn/WalletSimpleSignIn.cjs +2 -1
  44. package/src/lib/views/LoginView/sections/WalletSignInSection/WalletSimpleSignIn/WalletSimpleSignIn.js +2 -1
  45. package/src/lib/views/Passkey/EmbeddedAuthChoice/EmbeddedAuthChoice.cjs +21 -8
  46. package/src/lib/views/Passkey/EmbeddedAuthChoice/EmbeddedAuthChoice.js +21 -8
  47. package/src/lib/views/Passkey/EmbeddedAuthChoiceCards/ActionCard/ActionCard.cjs +1 -1
  48. package/src/lib/views/Passkey/EmbeddedAuthChoiceCards/ActionCard/ActionCard.js +1 -1
  49. package/src/lib/views/Passkey/EmbeddedAuthChoiceCards/EmbeddedAuthChoiceCards.cjs +3 -1
  50. package/src/lib/views/Passkey/EmbeddedAuthChoiceCards/EmbeddedAuthChoiceCards.js +3 -1
  51. package/src/lib/views/Passkey/PasskeyRecovery/BundleValidation/PasskeyBundleRecovery.cjs +3 -0
  52. package/src/lib/views/Passkey/PasskeyRecovery/BundleValidation/PasskeyBundleRecovery.js +3 -0
  53. package/src/lib/views/Passkey/utils/passkeyRecovery/passkeyRecovery.cjs +20 -1
  54. package/src/lib/views/Passkey/utils/passkeyRecovery/passkeyRecovery.d.ts +2 -1
  55. package/src/lib/views/Passkey/utils/passkeyRecovery/passkeyRecovery.js +20 -2
  56. package/src/lib/views/SelectWalletInWalletGroupView/components/WalletGroupItem/WalletGroupItem.cjs +6 -3
  57. package/src/lib/views/SelectWalletInWalletGroupView/components/WalletGroupItem/WalletGroupItem.js +6 -3
  58. package/src/lib/views/WalletGroupView/components/WalletGroupItem/WalletGroupItem.cjs +4 -4
  59. package/src/lib/views/WalletGroupView/components/WalletGroupItem/WalletGroupItem.js +4 -4
  60. package/src/lib/views/WalletList/WalletList.cjs +2 -2
  61. package/src/lib/views/WalletList/WalletList.js +2 -2
  62. package/src/lib/views/WalletList/WalletListItem/WalletListItem.cjs +6 -3
  63. package/src/lib/views/WalletList/WalletListItem/WalletListItem.js +6 -3
  64. package/src/lib/widgets/DynamicWidget/components/DotsMenuDropdown/DotsMenuDropdown.cjs +1 -1
  65. package/src/lib/widgets/DynamicWidget/components/DotsMenuDropdown/DotsMenuDropdown.js +1 -1
  66. package/src/lib/widgets/DynamicWidget/views/WalletSettingsView/WalletSettingsView.cjs +10 -5
  67. package/src/lib/widgets/DynamicWidget/views/WalletSettingsView/WalletSettingsView.js +10 -5
@@ -15,6 +15,7 @@ import { getWalletListItemLabel } from '../../../shared/utils/functions/getWalle
15
15
  import 'viem';
16
16
  import '../../../shared/utils/classes/storage/localStorage.js';
17
17
  import '../../../shared/consts/index.js';
18
+ import { useInternalDynamicContext } from '../../../context/DynamicContext/useDynamicContext/useInternalDynamicContext.js';
18
19
  import '../../../context/CaptchaContext/CaptchaContext.js';
19
20
  import '../../../context/ErrorContext/ErrorContext.js';
20
21
  import '../../../utils/constants/colors.js';
@@ -44,7 +45,6 @@ import '../../../components/ShadowDOM/ShadowDOM.js';
44
45
  import '../../../components/OverlayCard/OverlayCard.context.js';
45
46
  import '../../../context/FooterAnimationContext/index.js';
46
47
  import { Typography } from '../../../components/Typography/Typography.js';
47
- import { Badge } from '../../../components/Badge/Badge.js';
48
48
  import { isWalletGroup } from '../../../utils/functions/walletListBuilder/utils/isWalletGroup/isWalletGroup.js';
49
49
  import { useWalletGroupContext } from '../../../context/WalletGroupContext/WalletGroupContext.js';
50
50
  import { ListTileAnimatedTrailing } from '../../../components/ListTileAnimatedTrailing/ListTileAnimatedTrailing.js';
@@ -63,6 +63,7 @@ import '../../../components/PasskeyCreatedSuccessBanner/PasskeyCreatedSuccessBan
63
63
  import '../../../context/PasskeyContext/PasskeyContext.js';
64
64
  import '@dynamic-labs/viem-utils';
65
65
  import '../../../widgets/DynamicWidget/views/ManagePasskeysWidgetView/PasskeyCard/PasskeyCard.js';
66
+ import { Badge } from '../../../components/Badge/Badge.js';
66
67
  import { ListTile } from '../../../components/ListTile/ListTile.js';
67
68
  import '../../../components/InlineWidget/InlineWidget.js';
68
69
  import '../../../components/IsBrowser/IsBrowser.js';
@@ -75,12 +76,14 @@ import '../../../context/SocialRedirectContext/SocialRedirectContext.js';
75
76
  import '../../../widgets/DynamicBridgeWidget/views/WalletsView/components/SecondaryWallets/SecondaryWallets.js';
76
77
 
77
78
  const WalletListItem = ({ disabled = false, wallet, onResetSearchValue, tile = ({ leading, name, onClick, trailing }) => (jsx(ListTile, { leading: leading, trailing: trailing, onClick: onClick, className: 'wallet-list-item__tile', dataTestId: 'ListTile', children: name })), }) => {
79
+ const { recommendedWallets } = useInternalDynamicContext();
78
80
  const { navigateToWalletGroup } = useWalletGroupContext();
79
81
  const { setView } = useViewContext();
80
82
  const _isWalletGroup = isWalletGroup(wallet);
81
83
  const { walletBook } = useWalletBookContext();
82
84
  const { handleWalletItemClick } = useWalletItemActions();
83
- const label = getWalletListItemLabel({
85
+ const labelSettings = getWalletListItemLabel({
86
+ recommendedWallets,
84
87
  wallet,
85
88
  });
86
89
  const Tile = tile;
@@ -108,7 +111,7 @@ const WalletListItem = ({ disabled = false, wallet, onResetSearchValue, tile = (
108
111
  const leading = (jsx(WalletIcon, { className: 'wallet-list-item__leading', walletKey: wallet.key, style: { height: pixelToRem(28), width: pixelToRem(28) } }));
109
112
  const trailing = (jsx(ListTileAnimatedTrailing, { hoverElement:
110
113
  // eslint-disable-next-line react/jsx-wrap-multilines
111
- jsx(Icon, { color: 'text-tertiary', size: 'mini', children: jsx(SvgStroke, {}) }), children: label && (jsx(Badge, { dot: true, text: jsx(Typography, { variant: 'body_small', children: label }) })) }));
114
+ jsx(Icon, { color: 'text-tertiary', size: 'mini', children: jsx(SvgStroke, {}) }), children: labelSettings && (jsx(Badge, { dot: !labelSettings.isRecommended, variant: labelSettings.isRecommended ? 'primary' : 'secondary', text: jsx(Typography, { variant: 'body_small', children: labelSettings.label }) })) }));
112
115
  return (jsx(Tile, { leading: leading, trailing: trailing, name: name, onClick: handleClick }));
113
116
  };
114
117
 
@@ -44,7 +44,6 @@ require('../../../../components/ShadowDOM/ShadowDOM.cjs');
44
44
  require('../../../../components/OverlayCard/OverlayCard.context.cjs');
45
45
  require('../../../../context/FooterAnimationContext/index.cjs');
46
46
  var Typography = require('../../../../components/Typography/Typography.cjs');
47
- var Badge = require('../../../../components/Badge/Badge.cjs');
48
47
  require('../../../../context/WalletGroupContext/WalletGroupContext.cjs');
49
48
  require('../DynamicWidgetHeader/DynamicWidgetHeader.cjs');
50
49
  require('react-focus-lock');
@@ -61,6 +60,7 @@ require('../../../../components/PasskeyCreatedSuccessBanner/PasskeyCreatedSucces
61
60
  require('../../../../context/PasskeyContext/PasskeyContext.cjs');
62
61
  require('@dynamic-labs/viem-utils');
63
62
  require('../../views/ManagePasskeysWidgetView/PasskeyCard/PasskeyCard.cjs');
63
+ var Badge = require('../../../../components/Badge/Badge.cjs');
64
64
  require('../../../../components/InlineWidget/InlineWidget.cjs');
65
65
  require('../../../../components/IsBrowser/IsBrowser.cjs');
66
66
  require('../../../../components/MenuList/Dropdown/Dropdown.cjs');
@@ -40,7 +40,6 @@ import '../../../../components/ShadowDOM/ShadowDOM.js';
40
40
  import '../../../../components/OverlayCard/OverlayCard.context.js';
41
41
  import '../../../../context/FooterAnimationContext/index.js';
42
42
  import { Typography } from '../../../../components/Typography/Typography.js';
43
- import { Badge } from '../../../../components/Badge/Badge.js';
44
43
  import '../../../../context/WalletGroupContext/WalletGroupContext.js';
45
44
  import '../DynamicWidgetHeader/DynamicWidgetHeader.js';
46
45
  import 'react-focus-lock';
@@ -57,6 +56,7 @@ import '../../../../components/PasskeyCreatedSuccessBanner/PasskeyCreatedSuccess
57
56
  import '../../../../context/PasskeyContext/PasskeyContext.js';
58
57
  import '@dynamic-labs/viem-utils';
59
58
  import '../../views/ManagePasskeysWidgetView/PasskeyCard/PasskeyCard.js';
59
+ import { Badge } from '../../../../components/Badge/Badge.js';
60
60
  import '../../../../components/InlineWidget/InlineWidget.js';
61
61
  import '../../../../components/IsBrowser/IsBrowser.js';
62
62
  import '../../../../components/MenuList/Dropdown/Dropdown.js';
@@ -16,7 +16,6 @@ require('../../../../context/ViewContext/ViewContext.cjs');
16
16
  var androidTouchId = require('../../../../shared/assets/android-touch-id.cjs');
17
17
  var checkCircle = require('../../../../shared/assets/check-circle.cjs');
18
18
  var chevronLeft = require('../../../../shared/assets/chevron-left.cjs');
19
- var lock = require('../../../../shared/assets/lock.cjs');
20
19
  var exportPrivateKey = require('../../../../shared/assets/export-private-key.cjs');
21
20
  var exportRecoveryPhrase = require('../../../../shared/assets/export-recovery-phrase.cjs');
22
21
  require('../../../../shared/logger.cjs');
@@ -92,7 +91,7 @@ const WalletSettingsView = () => {
92
91
  const { isTurnkeyWallet, isTurnkeyWalletWithoutAuthenticator } = useIsTurnkeyWallet.useIsTurnkeyWallet();
93
92
  const { theme } = ThemeContext.useThemeContext();
94
93
  const { t } = reactI18next.useTranslation();
95
- const { initPasskeyRecoveryProcess } = usePasskeyRecovery.usePasskeyRecovery();
94
+ const { initPasskeyRecoveryProcess, shouldInitRecovery } = usePasskeyRecovery.usePasskeyRecovery();
96
95
  const [isLoading, setIsLoading] = React.useState(false);
97
96
  const decodedJwt = decodeJwt.decodeJwt(authToken);
98
97
  const walletProperties = (_b = (_a = decodedJwt === null || decodedJwt === void 0 ? void 0 : decodedJwt.verifiedCredentials) === null || _a === void 0 ? void 0 : _a.find(({ walletName }) => walletName === null || walletName === void 0 ? void 0 : walletName.startsWith('turnkey'))) === null || _b === void 0 ? void 0 : _b.walletProperties;
@@ -111,6 +110,12 @@ const WalletSettingsView = () => {
111
110
  setIsLoading(false);
112
111
  }
113
112
  });
113
+ const handleExportClick = (recoveryPhrase) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
114
+ if (yield shouldInitRecovery()) {
115
+ yield initPasskeyRecoveryProcess(undefined, 'reveal');
116
+ }
117
+ return initExportProcess(recoveryPhrase);
118
+ });
114
119
  const renderPasskeysButtonEndSlot = () => {
115
120
  if (isTurnkeyWalletWithAuthenticator)
116
121
  return (jsxRuntime.jsx(checkCircle.ReactComponent, { className: 'wallet-settings-view__body__section__button__icon-secondary--success' }));
@@ -121,11 +126,11 @@ const WalletSettingsView = () => {
121
126
  const backButton = (jsxRuntime.jsx(IconButton.IconButton, { type: 'button', onClick: goToInitialDynamicWidgetView, "data-testid": 'back-button', children: jsxRuntime.jsx(chevronLeft.ReactComponent, {}) }));
122
127
  return (jsxRuntime.jsxs("div", { className: 'wallet-settings-view', children: [jsxRuntime.jsx(ModalHeader.ModalHeader, { leading: backButton, children: jsxRuntime.jsx("div", { className: 'wallet-settings-view__header', children: jsxRuntime.jsx(Typography.Typography, { variant: 'title', color: 'primary', copykey: 'dyn_wallet_settings.title', children: t('dyn_wallet_settings.title') }) }) }), jsxRuntime.jsxs("div", { className: 'wallet-settings-view__body', children: [isPasskeyEnabled && (jsxRuntime.jsxs("div", { className: 'wallet-settings-view__body__section', children: [jsxRuntime.jsx("div", { className: 'wallet-settings-view__body__section__title', children: t('dyn_wallet_settings.signing_section.title') }), jsxRuntime.jsx(Button.Button, { dataTestId: 'manage-passkeys-button', onClick: () => handlePasskeyClick(), buttonClassName: 'wallet-settings-view__body__section__button', startSlot:
123
128
  // eslint-disable-next-line react/jsx-wrap-multilines
124
- jsxRuntime.jsxs("div", { className: 'wallet-settings-view__body__section__button__start-slot', children: [jsxRuntime.jsx(PasskeyDeviceIcon.PasskeyDeviceIcon, { className: 'wallet-settings-view__body__section__button__icon', defaultIcon: jsxRuntime.jsx(androidTouchId.ReactComponent, { "data-testid": 'default-icon' }) }), jsxRuntime.jsx(Typography.Typography, { color: 'primary', weight: 'medium', copykey: 'dyn_wallet_settings.signing_section.passkey_button', children: t('dyn_wallet_settings.signing_section.passkey_button') })] }), endSlot: renderPasskeysButtonEndSlot(), disabled: isLoading, showInternalLoading: false })] })), jsxRuntime.jsxs("div", { className: 'wallet-settings-view__body__section', children: [jsxRuntime.jsx("div", { className: 'wallet-settings-view__body__section__title', children: t('dyn_wallet_settings.export_section.title') }), jsxRuntime.jsx(Button.Button, { dataTestId: 'embedded-reveal-account-button', onClick: () => initExportProcess(), buttonClassName: 'wallet-settings-view__body__section__button', disabled: !isTurnkeyWallet || isTurnkeyWalletWithoutAuthenticator, startSlot:
129
+ jsxRuntime.jsxs("div", { className: 'wallet-settings-view__body__section__button__start-slot', children: [jsxRuntime.jsx(PasskeyDeviceIcon.PasskeyDeviceIcon, { className: 'wallet-settings-view__body__section__button__icon', defaultIcon: jsxRuntime.jsx(androidTouchId.ReactComponent, { "data-testid": 'default-icon' }) }), jsxRuntime.jsx(Typography.Typography, { color: 'primary', weight: 'medium', copykey: 'dyn_wallet_settings.signing_section.passkey_button', children: t('dyn_wallet_settings.signing_section.passkey_button') })] }), endSlot: renderPasskeysButtonEndSlot(), disabled: isLoading, showInternalLoading: false })] })), jsxRuntime.jsxs("div", { className: 'wallet-settings-view__body__section', children: [jsxRuntime.jsx("div", { className: 'wallet-settings-view__body__section__title', children: t('dyn_wallet_settings.export_section.title') }), jsxRuntime.jsx(Button.Button, { dataTestId: 'embedded-reveal-account-button', onClick: () => handleExportClick(), buttonClassName: 'wallet-settings-view__body__section__button', startSlot:
125
130
  // eslint-disable-next-line react/jsx-wrap-multilines
126
- jsxRuntime.jsxs("div", { className: 'wallet-settings-view__body__section__button__start-slot', children: [jsxRuntime.jsx(exportPrivateKey.ReactComponent, { className: `wallet-settings-view__body__section__button__icon${theme.theme.name === 'dark' ? '__stroke' : ''}` }), jsxRuntime.jsx(Typography.Typography, { color: 'primary', weight: 'medium', copykey: 'dyn_wallet_settings.export_section.private_key_button', children: t('dyn_wallet_settings.export_section.private_key_button') })] }), endSlot: isTurnkeyWallet && !isTurnkeyWalletWithoutAuthenticator ? (jsxRuntime.jsx(chevronLeft.ReactComponent, { className: 'wallet-settings-view__body__section__button__icon-secondary--rotate' })) : (jsxRuntime.jsx(lock.ReactComponent, { className: 'wallet-settings-view__body__section__button__icon-secondary' })), showInternalLoading: false }), isTurnkeyHDWallet && (jsxRuntime.jsx(Button.Button, { dataTestId: 'embedded-reveal-button', onClick: () => initExportProcess(true), buttonClassName: 'wallet-settings-view__body__section__button', disabled: !isTurnkeyWallet || isTurnkeyWalletWithoutAuthenticator, startSlot:
131
+ jsxRuntime.jsxs("div", { className: 'wallet-settings-view__body__section__button__start-slot', children: [jsxRuntime.jsx(exportPrivateKey.ReactComponent, { className: `wallet-settings-view__body__section__button__icon${theme.theme.name === 'dark' ? '__stroke' : ''}` }), jsxRuntime.jsx(Typography.Typography, { color: 'primary', weight: 'medium', copykey: 'dyn_wallet_settings.export_section.private_key_button', children: t('dyn_wallet_settings.export_section.private_key_button') })] }), endSlot: jsxRuntime.jsx(chevronLeft.ReactComponent, { className: 'wallet-settings-view__body__section__button__icon-secondary--rotate' }), showInternalLoading: false }), isTurnkeyHDWallet && (jsxRuntime.jsx(Button.Button, { dataTestId: 'embedded-reveal-button', onClick: () => handleExportClick(true), buttonClassName: 'wallet-settings-view__body__section__button', startSlot:
127
132
  // eslint-disable-next-line react/jsx-wrap-multilines
128
- jsxRuntime.jsxs("div", { className: 'wallet-settings-view__body__section__button__start-slot', children: [jsxRuntime.jsx(exportRecoveryPhrase.ReactComponent, { className: `wallet-settings-view__body__section__button__icon${theme.theme.name === 'dark' ? '__stroke' : ''}` }), jsxRuntime.jsx(Typography.Typography, { color: 'primary', weight: 'medium', copykey: 'dyn_wallet_settings.export_section.srp_button', children: t('dyn_wallet_settings.export_section.srp_button') })] }), endSlot: !isTurnkeyWalletWithoutAuthenticator ? (jsxRuntime.jsx(chevronLeft.ReactComponent, { className: 'wallet-settings-view__body__section__button__icon-secondary--rotate' })) : (jsxRuntime.jsx(lock.ReactComponent, { className: 'wallet-settings-view__body__section__button__icon-secondary' })), showInternalLoading: false }))] })] })] }));
133
+ jsxRuntime.jsxs("div", { className: 'wallet-settings-view__body__section__button__start-slot', children: [jsxRuntime.jsx(exportRecoveryPhrase.ReactComponent, { className: `wallet-settings-view__body__section__button__icon${theme.theme.name === 'dark' ? '__stroke' : ''}` }), jsxRuntime.jsx(Typography.Typography, { color: 'primary', weight: 'medium', copykey: 'dyn_wallet_settings.export_section.srp_button', children: t('dyn_wallet_settings.export_section.srp_button') })] }), endSlot: jsxRuntime.jsx(chevronLeft.ReactComponent, { className: 'wallet-settings-view__body__section__button__icon-secondary--rotate' }), showInternalLoading: false }))] })] })] }));
129
134
  };
130
135
 
131
136
  exports.WalletSettingsView = WalletSettingsView;
@@ -12,7 +12,6 @@ import '../../../../context/ViewContext/ViewContext.js';
12
12
  import { ReactComponent as SvgAndroidTouchId } from '../../../../shared/assets/android-touch-id.js';
13
13
  import { ReactComponent as SvgCheckCircle } from '../../../../shared/assets/check-circle.js';
14
14
  import { ReactComponent as SvgChevronLeft } from '../../../../shared/assets/chevron-left.js';
15
- import { ReactComponent as SvgLock } from '../../../../shared/assets/lock.js';
16
15
  import { ReactComponent as SvgExportPrivateKey } from '../../../../shared/assets/export-private-key.js';
17
16
  import { ReactComponent as SvgExportRecoveryPhrase } from '../../../../shared/assets/export-recovery-phrase.js';
18
17
  import '../../../../shared/logger.js';
@@ -88,7 +87,7 @@ const WalletSettingsView = () => {
88
87
  const { isTurnkeyWallet, isTurnkeyWalletWithoutAuthenticator } = useIsTurnkeyWallet();
89
88
  const { theme } = useThemeContext();
90
89
  const { t } = useTranslation();
91
- const { initPasskeyRecoveryProcess } = usePasskeyRecovery();
90
+ const { initPasskeyRecoveryProcess, shouldInitRecovery } = usePasskeyRecovery();
92
91
  const [isLoading, setIsLoading] = useState(false);
93
92
  const decodedJwt = decodeJwt(authToken);
94
93
  const walletProperties = (_b = (_a = decodedJwt === null || decodedJwt === void 0 ? void 0 : decodedJwt.verifiedCredentials) === null || _a === void 0 ? void 0 : _a.find(({ walletName }) => walletName === null || walletName === void 0 ? void 0 : walletName.startsWith('turnkey'))) === null || _b === void 0 ? void 0 : _b.walletProperties;
@@ -107,6 +106,12 @@ const WalletSettingsView = () => {
107
106
  setIsLoading(false);
108
107
  }
109
108
  });
109
+ const handleExportClick = (recoveryPhrase) => __awaiter(void 0, void 0, void 0, function* () {
110
+ if (yield shouldInitRecovery()) {
111
+ yield initPasskeyRecoveryProcess(undefined, 'reveal');
112
+ }
113
+ return initExportProcess(recoveryPhrase);
114
+ });
110
115
  const renderPasskeysButtonEndSlot = () => {
111
116
  if (isTurnkeyWalletWithAuthenticator)
112
117
  return (jsx(SvgCheckCircle, { className: 'wallet-settings-view__body__section__button__icon-secondary--success' }));
@@ -117,11 +122,11 @@ const WalletSettingsView = () => {
117
122
  const backButton = (jsx(IconButton, { type: 'button', onClick: goToInitialDynamicWidgetView, "data-testid": 'back-button', children: jsx(SvgChevronLeft, {}) }));
118
123
  return (jsxs("div", { className: 'wallet-settings-view', children: [jsx(ModalHeader, { leading: backButton, children: jsx("div", { className: 'wallet-settings-view__header', children: jsx(Typography, { variant: 'title', color: 'primary', copykey: 'dyn_wallet_settings.title', children: t('dyn_wallet_settings.title') }) }) }), jsxs("div", { className: 'wallet-settings-view__body', children: [isPasskeyEnabled && (jsxs("div", { className: 'wallet-settings-view__body__section', children: [jsx("div", { className: 'wallet-settings-view__body__section__title', children: t('dyn_wallet_settings.signing_section.title') }), jsx(Button, { dataTestId: 'manage-passkeys-button', onClick: () => handlePasskeyClick(), buttonClassName: 'wallet-settings-view__body__section__button', startSlot:
119
124
  // eslint-disable-next-line react/jsx-wrap-multilines
120
- jsxs("div", { className: 'wallet-settings-view__body__section__button__start-slot', children: [jsx(PasskeyDeviceIcon, { className: 'wallet-settings-view__body__section__button__icon', defaultIcon: jsx(SvgAndroidTouchId, { "data-testid": 'default-icon' }) }), jsx(Typography, { color: 'primary', weight: 'medium', copykey: 'dyn_wallet_settings.signing_section.passkey_button', children: t('dyn_wallet_settings.signing_section.passkey_button') })] }), endSlot: renderPasskeysButtonEndSlot(), disabled: isLoading, showInternalLoading: false })] })), jsxs("div", { className: 'wallet-settings-view__body__section', children: [jsx("div", { className: 'wallet-settings-view__body__section__title', children: t('dyn_wallet_settings.export_section.title') }), jsx(Button, { dataTestId: 'embedded-reveal-account-button', onClick: () => initExportProcess(), buttonClassName: 'wallet-settings-view__body__section__button', disabled: !isTurnkeyWallet || isTurnkeyWalletWithoutAuthenticator, startSlot:
125
+ jsxs("div", { className: 'wallet-settings-view__body__section__button__start-slot', children: [jsx(PasskeyDeviceIcon, { className: 'wallet-settings-view__body__section__button__icon', defaultIcon: jsx(SvgAndroidTouchId, { "data-testid": 'default-icon' }) }), jsx(Typography, { color: 'primary', weight: 'medium', copykey: 'dyn_wallet_settings.signing_section.passkey_button', children: t('dyn_wallet_settings.signing_section.passkey_button') })] }), endSlot: renderPasskeysButtonEndSlot(), disabled: isLoading, showInternalLoading: false })] })), jsxs("div", { className: 'wallet-settings-view__body__section', children: [jsx("div", { className: 'wallet-settings-view__body__section__title', children: t('dyn_wallet_settings.export_section.title') }), jsx(Button, { dataTestId: 'embedded-reveal-account-button', onClick: () => handleExportClick(), buttonClassName: 'wallet-settings-view__body__section__button', startSlot:
121
126
  // eslint-disable-next-line react/jsx-wrap-multilines
122
- jsxs("div", { className: 'wallet-settings-view__body__section__button__start-slot', children: [jsx(SvgExportPrivateKey, { className: `wallet-settings-view__body__section__button__icon${theme.theme.name === 'dark' ? '__stroke' : ''}` }), jsx(Typography, { color: 'primary', weight: 'medium', copykey: 'dyn_wallet_settings.export_section.private_key_button', children: t('dyn_wallet_settings.export_section.private_key_button') })] }), endSlot: isTurnkeyWallet && !isTurnkeyWalletWithoutAuthenticator ? (jsx(SvgChevronLeft, { className: 'wallet-settings-view__body__section__button__icon-secondary--rotate' })) : (jsx(SvgLock, { className: 'wallet-settings-view__body__section__button__icon-secondary' })), showInternalLoading: false }), isTurnkeyHDWallet && (jsx(Button, { dataTestId: 'embedded-reveal-button', onClick: () => initExportProcess(true), buttonClassName: 'wallet-settings-view__body__section__button', disabled: !isTurnkeyWallet || isTurnkeyWalletWithoutAuthenticator, startSlot:
127
+ jsxs("div", { className: 'wallet-settings-view__body__section__button__start-slot', children: [jsx(SvgExportPrivateKey, { className: `wallet-settings-view__body__section__button__icon${theme.theme.name === 'dark' ? '__stroke' : ''}` }), jsx(Typography, { color: 'primary', weight: 'medium', copykey: 'dyn_wallet_settings.export_section.private_key_button', children: t('dyn_wallet_settings.export_section.private_key_button') })] }), endSlot: jsx(SvgChevronLeft, { className: 'wallet-settings-view__body__section__button__icon-secondary--rotate' }), showInternalLoading: false }), isTurnkeyHDWallet && (jsx(Button, { dataTestId: 'embedded-reveal-button', onClick: () => handleExportClick(true), buttonClassName: 'wallet-settings-view__body__section__button', startSlot:
123
128
  // eslint-disable-next-line react/jsx-wrap-multilines
124
- jsxs("div", { className: 'wallet-settings-view__body__section__button__start-slot', children: [jsx(SvgExportRecoveryPhrase, { className: `wallet-settings-view__body__section__button__icon${theme.theme.name === 'dark' ? '__stroke' : ''}` }), jsx(Typography, { color: 'primary', weight: 'medium', copykey: 'dyn_wallet_settings.export_section.srp_button', children: t('dyn_wallet_settings.export_section.srp_button') })] }), endSlot: !isTurnkeyWalletWithoutAuthenticator ? (jsx(SvgChevronLeft, { className: 'wallet-settings-view__body__section__button__icon-secondary--rotate' })) : (jsx(SvgLock, { className: 'wallet-settings-view__body__section__button__icon-secondary' })), showInternalLoading: false }))] })] })] }));
129
+ jsxs("div", { className: 'wallet-settings-view__body__section__button__start-slot', children: [jsx(SvgExportRecoveryPhrase, { className: `wallet-settings-view__body__section__button__icon${theme.theme.name === 'dark' ? '__stroke' : ''}` }), jsx(Typography, { color: 'primary', weight: 'medium', copykey: 'dyn_wallet_settings.export_section.srp_button', children: t('dyn_wallet_settings.export_section.srp_button') })] }), endSlot: jsx(SvgChevronLeft, { className: 'wallet-settings-view__body__section__button__icon-secondary--rotate' }), showInternalLoading: false }))] })] })] }));
125
130
  };
126
131
 
127
132
  export { WalletSettingsView };