@dynamic-labs/sdk-react-core 4.29.4 → 4.29.6

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 (125) hide show
  1. package/CHANGELOG.md +23 -0
  2. package/package.cjs +3 -3
  3. package/package.js +3 -3
  4. package/package.json +13 -13
  5. package/src/functions.d.ts +1 -0
  6. package/src/index.cjs +10 -2
  7. package/src/index.d.ts +2 -2
  8. package/src/index.js +4 -2
  9. package/src/lib/client/extension/deprecated/mfa/verifyTotpMfaDevice/verifyTotpMfaDevice.d.ts +1 -1
  10. package/src/lib/client/extension/setVerifyResponseToStorage/setVerifyResponseToStorage.cjs +1 -1
  11. package/src/lib/client/extension/setVerifyResponseToStorage/setVerifyResponseToStorage.js +1 -1
  12. package/src/lib/components/EmbeddedWalletExport/EmbeddedWalletExport.cjs +83 -0
  13. package/src/lib/components/EmbeddedWalletExport/EmbeddedWalletExport.d.ts +12 -0
  14. package/src/lib/components/EmbeddedWalletExport/EmbeddedWalletExport.js +79 -0
  15. package/src/lib/components/EmbeddedWalletExport/index.d.ts +2 -0
  16. package/src/lib/components/Input/Input.cjs +1 -1
  17. package/src/lib/components/Input/Input.js +1 -1
  18. package/src/lib/components/Textarea/Textarea.cjs +1 -1
  19. package/src/lib/components/Textarea/Textarea.js +1 -1
  20. package/src/lib/components/TransactionConfirmationPageLayout/TransactionConfirmationPageLayout.cjs +3 -2
  21. package/src/lib/components/TransactionConfirmationPageLayout/TransactionConfirmationPageLayout.js +3 -2
  22. package/src/lib/components/index.d.ts +1 -0
  23. package/src/lib/context/DynamicContext/hooks/useAutoselectPrimaryWallet/useAutoselectPrimaryWallet.cjs +7 -7
  24. package/src/lib/context/DynamicContext/hooks/useAutoselectPrimaryWallet/useAutoselectPrimaryWallet.js +7 -7
  25. package/src/lib/context/SocialRedirectContext/SocialRedirectContext.cjs +7 -7
  26. package/src/lib/context/SocialRedirectContext/SocialRedirectContext.js +7 -7
  27. package/src/lib/context/ViewContext/types/index.d.ts +1 -1
  28. package/src/lib/data/api/api.cjs +1 -1
  29. package/src/lib/data/api/api.js +1 -1
  30. package/src/lib/locale/en/translation.cjs +76 -0
  31. package/src/lib/locale/en/translation.d.ts +76 -0
  32. package/src/lib/locale/en/translation.js +76 -0
  33. package/src/lib/shared/assets/index.d.ts +1 -0
  34. package/src/lib/shared/assets/sparkles.cjs +54 -0
  35. package/src/lib/shared/assets/sparkles.js +30 -0
  36. package/src/lib/shared/assets/upgrade.cjs +93 -0
  37. package/src/lib/shared/assets/upgrade.js +69 -0
  38. package/src/lib/styles/index.shadow.cjs +1 -1
  39. package/src/lib/styles/index.shadow.js +1 -1
  40. package/src/lib/utils/constants/authViewLayoutChecks.cjs +4 -0
  41. package/src/lib/utils/constants/authViewLayoutChecks.js +4 -0
  42. package/src/lib/utils/functions/exportWalletCredential/exportWalletCredential.cjs +57 -0
  43. package/src/lib/utils/functions/exportWalletCredential/exportWalletCredential.d.ts +13 -0
  44. package/src/lib/utils/functions/exportWalletCredential/exportWalletCredential.js +53 -0
  45. package/src/lib/utils/functions/exportWalletCredential/index.d.ts +2 -0
  46. package/src/lib/utils/functions/findPrimaryWalletVCForUser/findPrimaryWalletVCForUser.cjs +57 -0
  47. package/src/lib/utils/functions/findPrimaryWalletVCForUser/findPrimaryWalletVCForUser.d.ts +11 -0
  48. package/src/lib/utils/functions/findPrimaryWalletVCForUser/findPrimaryWalletVCForUser.js +53 -0
  49. package/src/lib/utils/functions/findPrimaryWalletVCForUser/index.d.ts +1 -0
  50. package/src/lib/utils/functions/index.d.ts +1 -0
  51. package/src/lib/utils/hooks/index.d.ts +2 -0
  52. package/src/lib/utils/hooks/useCreateDynamicEmbeddedWalletMutation/useCreateDynamicEmbeddedWalletMutation.cjs +3 -3
  53. package/src/lib/utils/hooks/useCreateDynamicEmbeddedWalletMutation/useCreateDynamicEmbeddedWalletMutation.js +3 -3
  54. package/src/lib/utils/hooks/useDeletePasskey/index.d.ts +1 -0
  55. package/src/lib/utils/hooks/useDeletePasskey/useDeletePasskey.cjs +33 -0
  56. package/src/lib/utils/hooks/useDeletePasskey/useDeletePasskey.d.ts +22 -0
  57. package/src/lib/utils/hooks/useDeletePasskey/useDeletePasskey.js +29 -0
  58. package/src/lib/utils/hooks/useDynamicWaas/useDynamicWaas.cjs +23 -23
  59. package/src/lib/utils/hooks/useDynamicWaas/useDynamicWaas.d.ts +5 -4
  60. package/src/lib/utils/hooks/useDynamicWaas/useDynamicWaas.js +24 -24
  61. package/src/lib/utils/hooks/useEmbeddedWallet/useEmbeddedWallet.cjs +25 -36
  62. package/src/lib/utils/hooks/useEmbeddedWallet/useEmbeddedWallet.js +26 -37
  63. package/src/lib/utils/hooks/useEmbeddedWallet/useSecureEnclaveEmbeddedWallet/useSecureEnclaveEmbeddedWallet.cjs +2 -2
  64. package/src/lib/utils/hooks/useEmbeddedWallet/useSecureEnclaveEmbeddedWallet/useSecureEnclaveEmbeddedWallet.js +2 -2
  65. package/src/lib/utils/hooks/useEmbeddedWallet/useSecureEnclaveEmbeddedWallet/useTurnkey/useTurnkey.cjs +4 -4
  66. package/src/lib/utils/hooks/useEmbeddedWallet/useSecureEnclaveEmbeddedWallet/useTurnkey/useTurnkey.js +4 -4
  67. package/src/lib/utils/hooks/useGetMfaToken/useGetMfaToken.cjs +39 -19
  68. package/src/lib/utils/hooks/useGetMfaToken/useGetMfaToken.js +39 -19
  69. package/src/lib/utils/hooks/useRefreshUser/useRefreshUser.cjs +11 -5
  70. package/src/lib/utils/hooks/useRefreshUser/useRefreshUser.js +11 -5
  71. package/src/lib/utils/hooks/useRefreshUserState/useRefreshUserState.cjs +2 -2
  72. package/src/lib/utils/hooks/useRefreshUserState/useRefreshUserState.js +2 -2
  73. package/src/lib/utils/hooks/useSetWalletConnectorFetchers/useSetWalletConnectorFetchers.cjs +1 -1
  74. package/src/lib/utils/hooks/useSetWalletConnectorFetchers/useSetWalletConnectorFetchers.js +1 -1
  75. package/src/lib/utils/hooks/useSmartWallets/useSmartWallets.cjs +1 -1
  76. package/src/lib/utils/hooks/useSmartWallets/useSmartWallets.js +1 -1
  77. package/src/lib/utils/hooks/useSyncDynamicWaas/useSyncDynamicWaas.cjs +1 -1
  78. package/src/lib/utils/hooks/useSyncDynamicWaas/useSyncDynamicWaas.js +1 -1
  79. package/src/lib/utils/hooks/useTokenBalances/useTokenBalances.cjs +5 -4
  80. package/src/lib/utils/hooks/useTokenBalances/useTokenBalances.js +5 -4
  81. package/src/lib/utils/hooks/useTransferWallet/useTransferWallet.cjs +3 -3
  82. package/src/lib/utils/hooks/useTransferWallet/useTransferWallet.js +3 -3
  83. package/src/lib/utils/hooks/useUpgradeEmbeddedWallet/useUpgradeEmbeddedWallet.cjs +3 -3
  84. package/src/lib/utils/hooks/useUpgradeEmbeddedWallet/useUpgradeEmbeddedWallet.js +3 -3
  85. package/src/lib/utils/hooks/useUpgradeToDynamicWaasFlow/index.d.ts +1 -0
  86. package/src/lib/utils/hooks/useUpgradeToDynamicWaasFlow/useUpgradeToDynamicWaasFlow.cjs +124 -0
  87. package/src/lib/utils/hooks/useUpgradeToDynamicWaasFlow/useUpgradeToDynamicWaasFlow.d.ts +7 -0
  88. package/src/lib/utils/hooks/useUpgradeToDynamicWaasFlow/useUpgradeToDynamicWaasFlow.js +120 -0
  89. package/src/lib/utils/hooks/useVerifyWallet/useVerifyWallet.cjs +3 -3
  90. package/src/lib/utils/hooks/useVerifyWallet/useVerifyWallet.js +3 -3
  91. package/src/lib/utils/hooks/useWalletConnectors/useWalletConnectors.cjs +6 -0
  92. package/src/lib/utils/hooks/useWalletConnectors/useWalletConnectors.js +6 -0
  93. package/src/lib/utils/hooks/useWalletEventListeners/useWalletEventListeners.cjs +6 -0
  94. package/src/lib/utils/hooks/useWalletEventListeners/useWalletEventListeners.js +6 -0
  95. package/src/lib/utils/hooks/useWalletOptions/useWalletOptions.cjs +44 -31
  96. package/src/lib/utils/hooks/useWalletOptions/useWalletOptions.d.ts +1 -1
  97. package/src/lib/utils/hooks/useWalletOptions/useWalletOptions.js +44 -31
  98. package/src/lib/views/AccountUpgradedView/AccountUpgradedView.cjs +124 -0
  99. package/src/lib/views/AccountUpgradedView/AccountUpgradedView.d.ts +2 -0
  100. package/src/lib/views/AccountUpgradedView/AccountUpgradedView.js +120 -0
  101. package/src/lib/views/AccountUpgradedView/index.d.ts +1 -0
  102. package/src/lib/views/EmailVerification/EmailVerification.cjs +3 -3
  103. package/src/lib/views/EmailVerification/EmailVerification.js +3 -3
  104. package/src/lib/views/EmbeddedReveal/EmbeddedRevealView/EmbeddedRevealView.cjs +17 -139
  105. package/src/lib/views/EmbeddedReveal/EmbeddedRevealView/EmbeddedRevealView.js +20 -142
  106. package/src/lib/views/TransactionConfirmationView/helpers/transactionErrorMessage.cjs +15 -0
  107. package/src/lib/views/TransactionConfirmationView/helpers/transactionErrorMessage.d.ts +2 -0
  108. package/src/lib/views/TransactionConfirmationView/helpers/transactionErrorMessage.js +14 -1
  109. package/src/lib/views/WaasUpgradeView/WaasUpgradeView.cjs +159 -0
  110. package/src/lib/views/WaasUpgradeView/WaasUpgradeView.d.ts +5 -0
  111. package/src/lib/views/WaasUpgradeView/WaasUpgradeView.js +155 -0
  112. package/src/lib/views/WaasUpgradeView/index.d.ts +2 -0
  113. package/src/lib/views/WalletUpgradeFlowView/WalletUpgradeFlowView.cjs +203 -0
  114. package/src/lib/views/WalletUpgradeFlowView/WalletUpgradeFlowView.d.ts +9 -0
  115. package/src/lib/views/WalletUpgradeFlowView/WalletUpgradeFlowView.js +199 -0
  116. package/src/lib/views/WalletUpgradeFlowView/index.d.ts +1 -0
  117. package/src/lib/views/viewToComponentMap.cjs +6 -0
  118. package/src/lib/views/viewToComponentMap.d.ts +3 -0
  119. package/src/lib/views/viewToComponentMap.js +6 -0
  120. package/src/lib/widgets/DynamicWidget/components/EmailOTPConnectorPendingSignModalContent/EmailOTPConnectorPendingSignModalContent.cjs +3 -3
  121. package/src/lib/widgets/DynamicWidget/components/EmailOTPConnectorPendingSignModalContent/EmailOTPConnectorPendingSignModalContent.js +3 -3
  122. package/src/lib/widgets/DynamicWidget/components/PasskeyCard/PasskeyCard.cjs +12 -1
  123. package/src/lib/widgets/DynamicWidget/components/PasskeyCard/PasskeyCard.js +12 -1
  124. package/src/lib/widgets/DynamicWidget/views/ManagePasskeysMfaWidgetView/ManagePasskeysMfaWidgetView.cjs +10 -1
  125. package/src/lib/widgets/DynamicWidget/views/ManagePasskeysMfaWidgetView/ManagePasskeysMfaWidgetView.js +10 -1
@@ -0,0 +1,120 @@
1
+ 'use client'
2
+ import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
3
+ import { useTranslation } from 'react-i18next';
4
+ import { Typography } from '../../components/Typography/Typography.js';
5
+ import { TypographyButton } from '../../components/TypographyButton/TypographyButton.js';
6
+ import 'react';
7
+ import '../../context/DynamicContext/DynamicContext.js';
8
+ import '../../store/state/loadingAndLifecycle/loadingAndLifecycle.js';
9
+ import '@dynamic-labs/sdk-api-core';
10
+ import '../../shared/logger.js';
11
+ import '@dynamic-labs/iconic';
12
+ import '@dynamic-labs/wallet-connector-core';
13
+ import { ReactComponent as SvgClose } from '../../shared/assets/close.js';
14
+ import { ReactComponent as SvgSparkles } from '../../shared/assets/sparkles.js';
15
+ import '../../context/ViewContext/ViewContext.js';
16
+ import '@dynamic-labs/wallet-book';
17
+ import '@dynamic-labs/utils';
18
+ import '../../utils/constants/colors.js';
19
+ import '../../utils/constants/values.js';
20
+ import '../../shared/consts/index.js';
21
+ import '../../events/dynamicEvents.js';
22
+ import '../../../../_virtual/_tslib.js';
23
+ import '../../context/CaptchaContext/CaptchaContext.js';
24
+ import '../../context/ErrorContext/ErrorContext.js';
25
+ import '@dynamic-labs/multi-wallet';
26
+ import 'react-international-phone';
27
+ import '../../store/state/nonce/nonce.js';
28
+ import '@dynamic-labs-sdk/client/core';
29
+ import '../../client/client.js';
30
+ import '@dynamic-labs-sdk/client';
31
+ import '../../config/ApiEndpoint.js';
32
+ import '../../store/state/projectSettings/projectSettings.js';
33
+ import '../../locale/locale.js';
34
+ import '../../store/state/dynamicContextProps/dynamicContextProps.js';
35
+ import '../../store/state/primaryWalletId/primaryWalletId.js';
36
+ import '../../store/state/connectedWalletsInfo/connectedWalletsInfo.js';
37
+ import '../../context/AccessDeniedContext/AccessDeniedContext.js';
38
+ import '../../context/AccountExistsContext/AccountExistsContext.js';
39
+ import '../../context/UserWalletsContext/UserWalletsContext.js';
40
+ import '../../store/state/authMode/authMode.js';
41
+ import '../../context/VerificationContext/VerificationContext.js';
42
+ import 'react-dom';
43
+ import '../../utils/functions/compareChains/compareChains.js';
44
+ import '../Passkey/utils/findPrimaryEmbeddedChain/findPrimaryEmbeddedChain.js';
45
+ import '../../context/ThemeContext/ThemeContext.js';
46
+ import '../../utils/hooks/useUserUpdateRequest/useUpdateUser/userFieldsSchema.js';
47
+ import 'bs58';
48
+ import '@dynamic-labs/types';
49
+ import '../../context/SocialRedirectContext/SocialRedirectContext.js';
50
+ import '../../context/LoadingContext/LoadingContext.js';
51
+ import '../../context/WalletContext/WalletContext.js';
52
+ import '../../utils/hooks/useEmbeddedWallet/useSecureEnclaveEmbeddedWallet/constants.js';
53
+ import 'yup';
54
+ import '../../context/MockContext/MockContext.js';
55
+ import '../CollectUserDataView/useFields.js';
56
+ import '../../context/FieldsStateContext/FieldsStateContext.js';
57
+ import '../../context/UserFieldEditorContext/UserFieldEditorContext.js';
58
+ import '@dynamic-labs/rpc-providers';
59
+ import '../../store/state/walletOptions/walletOptions.js';
60
+ import '../../components/Accordion/components/AccordionItem/AccordionItem.js';
61
+ import '../../components/Alert/Alert.js';
62
+ import '../../components/ShadowDOM/ShadowDOM.js';
63
+ import { IconButton } from '../../components/IconButton/IconButton.js';
64
+ import '../../components/InlineWidget/InlineWidget.js';
65
+ import '../../components/Input/Input.js';
66
+ import '../../components/IsBrowser/IsBrowser.js';
67
+ import '../../components/MenuList/Dropdown/Dropdown.js';
68
+ import '../../components/OverlayCard/OverlayCard.js';
69
+ import '../../components/Transition/ZoomTransition/ZoomTransition.js';
70
+ import '../../components/Transition/SlideInUpTransition/SlideInUpTransition.js';
71
+ import '../../components/Transition/OpacityTransition/OpacityTransition.js';
72
+ import { ModalHeader } from '../../components/ModalHeader/ModalHeader.js';
73
+ import '../../components/PasskeyCreatedSuccessBanner/PasskeyCreatedSuccessBanner.js';
74
+ import '../../components/Popper/Popper/Popper.js';
75
+ import '../../components/Popper/PopperContext/PopperContext.js';
76
+ import 'react-focus-lock';
77
+ import 'qrcode';
78
+ import 'formik';
79
+ import '../../utils/hooks/useSubdomainCheck/useSubdomainCheck.js';
80
+ import '../../context/WalletGroupContext/WalletGroupContext.js';
81
+ import '../../context/IpConfigurationContext/IpConfigurationContext.js';
82
+ import '../../context/ConnectWithOtpContext/ConnectWithOtpContext.js';
83
+ import '../../widgets/DynamicBridgeWidget/views/WalletsView/components/SecondaryWallets/SecondaryWallets.js';
84
+ import '@hcaptcha/react-hcaptcha';
85
+ import '../../widgets/DynamicWidget/context/DynamicWidgetContext.js';
86
+ import '../../widgets/DynamicWidget/helpers/convertExchangeKeyAndProviderEnum.js';
87
+ import '../ExchangeWhitelistWarning/ExchangeWhitelistWarning.js';
88
+ import '../../context/ErrorContext/hooks/useErrorText/useErrorText.js';
89
+ import '../../context/FooterAnimationContext/index.js';
90
+ import '../MfaChooseDeviceView/getMfaOptions/getMfaOptions.js';
91
+ import '../../context/PasskeyContext/PasskeyContext.js';
92
+ import '../../context/OnrampContext/OnrampContext.js';
93
+ import '../../store/state/sendBalances.js';
94
+ import '../../store/state/connectorsInitializing/connectorsInitializing.js';
95
+ import '../../components/OverlayCardBase/OverlayCardTarget/OverlayCardTarget.js';
96
+ import '../../widgets/DynamicWidget/components/DynamicWidgetHeader/DynamicWidgetHeader.js';
97
+ import '../TransactionConfirmationView/TransactionConfirmationView.js';
98
+ import '../../widgets/DynamicWidget/components/PasskeyCard/PasskeyCard.js';
99
+ import '../../../index.js';
100
+ import '../../widgets/DynamicWidget/views/ReceiveWalletFunds/ReceiveWalletFunds.js';
101
+ import '../../store/state/tokenBalances.js';
102
+ import '../../store/state/multichainBalances.js';
103
+ import '../../shared/utils/functions/getInitialUrl/getInitialUrl.js';
104
+ import { useInternalDynamicContext } from '../../context/DynamicContext/useDynamicContext/useInternalDynamicContext/useInternalDynamicContext.js';
105
+
106
+ const AccountUpgradedView = () => {
107
+ const { setShowAuthFlow } = useInternalDynamicContext();
108
+ const { t } = useTranslation();
109
+ const handleContinue = () => {
110
+ setShowAuthFlow(false);
111
+ };
112
+ const closeButton = (jsx(IconButton, { onClick: () => {
113
+ setShowAuthFlow(false);
114
+ }, type: 'button', children: jsx(SvgClose, {}) }));
115
+ return (jsxs(Fragment, { children: [jsx(ModalHeader, { trailing: closeButton, displayBorder: true, children: jsx(Typography, { variant: 'title', color: 'primary', children: t('dyn_account_upgraded.title') }) }), jsxs("div", { className: 'account-upgraded-view', children: [jsxs("div", { className: 'account-upgraded-view__content', children: [jsx("div", { className: 'account-upgraded-view__icon-container', children: jsx("div", { className: 'account-upgraded-view__icon-background', children: jsx(SvgSparkles, { className: 'account-upgraded-view__icon' }) }) }), jsx("div", { className: 'account-upgraded-view__message', children: jsx(Typography, { variant: 'body_normal', color: 'primary', style: { textAlign: 'center' }, children: t('dyn_account_upgraded.message') }) })] }), jsx("div", { className: 'account-upgraded-view__actions', children: jsx(TypographyButton, { onClick: handleContinue, buttonVariant: 'brand-primary', expanded: true, buttonPadding: 'large', typographyProps: {
116
+ color: 'white',
117
+ }, dataTestId: 'account-upgraded-continue-button', children: t('dyn_account_upgraded.continue_button') }) })] })] }));
118
+ };
119
+
120
+ export { AccountUpgradedView };
@@ -0,0 +1 @@
1
+ export { AccountUpgradedView } from './AccountUpgradedView';
@@ -33,8 +33,10 @@ var updatePrimaryWalletId = require('../../utils/functions/updatePrimaryWalletId
33
33
  require('../../store/state/connectedWalletsInfo/connectedWalletsInfo.cjs');
34
34
  require('../../store/state/dynamicContextProps/dynamicContextProps.cjs');
35
35
  require('../../store/state/primaryWalletId/primaryWalletId.cjs');
36
- var dynamicEvents = require('../../events/dynamicEvents.cjs');
36
+ var email = require('../../data/api/email/email.cjs');
37
37
  require('../../store/state/projectSettings/projectSettings.cjs');
38
+ require('../../locale/locale.cjs');
39
+ var dynamicEvents = require('../../events/dynamicEvents.cjs');
38
40
  var storeTokenAndUser = require('../../client/extension/storeTokenAndUser/storeTokenAndUser.cjs');
39
41
  var convertSdkUserToUserProfile = require('../../client/extension/user/convertSdkUserToUserProfile/convertSdkUserToUserProfile.cjs');
40
42
  var classNames = require('../../utils/functions/classNames/classNames.cjs');
@@ -49,8 +51,6 @@ var ErrorContext = require('../../context/ErrorContext/ErrorContext.cjs');
49
51
  require('../../context/AccessDeniedContext/AccessDeniedContext.cjs');
50
52
  require('../../context/AccountExistsContext/AccountExistsContext.cjs');
51
53
  require('../../context/UserWalletsContext/UserWalletsContext.cjs');
52
- var email = require('../../data/api/email/email.cjs');
53
- require('../../locale/locale.cjs');
54
54
  var useOtpVerificationRequest = require('../../utils/hooks/authenticationHooks/useOtpVerificationRequest/useOtpVerificationRequest.cjs');
55
55
  require('react-dom');
56
56
  require('../../utils/functions/compareChains/compareChains.cjs');
@@ -29,8 +29,10 @@ import { updatePrimaryWalletId } from '../../utils/functions/updatePrimaryWallet
29
29
  import '../../store/state/connectedWalletsInfo/connectedWalletsInfo.js';
30
30
  import '../../store/state/dynamicContextProps/dynamicContextProps.js';
31
31
  import '../../store/state/primaryWalletId/primaryWalletId.js';
32
- import { dynamicEvents } from '../../events/dynamicEvents.js';
32
+ import { signInWithEmailVerification, retryEmailVerification } from '../../data/api/email/email.js';
33
33
  import '../../store/state/projectSettings/projectSettings.js';
34
+ import '../../locale/locale.js';
35
+ import { dynamicEvents } from '../../events/dynamicEvents.js';
34
36
  import { storeTokenAndUser } from '../../client/extension/storeTokenAndUser/storeTokenAndUser.js';
35
37
  import { convertSdkUserToUserProfile } from '../../client/extension/user/convertSdkUserToUserProfile/convertSdkUserToUserProfile.js';
36
38
  import { classNames } from '../../utils/functions/classNames/classNames.js';
@@ -45,8 +47,6 @@ import { useErrorContext } from '../../context/ErrorContext/ErrorContext.js';
45
47
  import '../../context/AccessDeniedContext/AccessDeniedContext.js';
46
48
  import '../../context/AccountExistsContext/AccountExistsContext.js';
47
49
  import '../../context/UserWalletsContext/UserWalletsContext.js';
48
- import { signInWithEmailVerification, retryEmailVerification } from '../../data/api/email/email.js';
49
- import '../../locale/locale.js';
50
50
  import { useOtpVerificationRequest } from '../../utils/hooks/authenticationHooks/useOtpVerificationRequest/useOtpVerificationRequest.js';
51
51
  import 'react-dom';
52
52
  import '../../utils/functions/compareChains/compareChains.js';
@@ -3,12 +3,10 @@
3
3
 
4
4
  Object.defineProperty(exports, '__esModule', { value: true });
5
5
 
6
- var _tslib = require('../../../../../_virtual/_tslib.cjs');
7
6
  var jsxRuntime = require('react/jsx-runtime');
8
7
  var React = require('react');
9
8
  var reactI18next = require('react-i18next');
10
9
  var utils = require('@dynamic-labs/utils');
11
- var walletConnectorCore = require('@dynamic-labs/wallet-connector-core');
12
10
  require('../../../components/Accordion/components/AccordionItem/AccordionItem.cjs');
13
11
  var close = require('../../../shared/assets/close.cjs');
14
12
  var exportEmbeddedHero = require('../../../shared/assets/export-embedded-hero.cjs');
@@ -17,8 +15,10 @@ var info = require('../../../shared/assets/info.cjs');
17
15
  var walletV2 = require('../../../shared/assets/wallet-v2.cjs');
18
16
  require('@dynamic-labs/iconic');
19
17
  var ViewContext = require('../../../context/ViewContext/ViewContext.cjs');
18
+ require('../../../../../_virtual/_tslib.cjs');
20
19
  require('@dynamic-labs/sdk-api-core');
21
20
  var logger = require('../../../shared/logger.cjs');
21
+ require('@dynamic-labs/wallet-connector-core');
22
22
  require('@dynamic-labs/wallet-book');
23
23
  require('../../../utils/constants/colors.cjs');
24
24
  require('../../../utils/constants/values.cjs');
@@ -44,6 +44,7 @@ require('../../../locale/locale.cjs');
44
44
  require('../../../store/state/dynamicContextProps/dynamicContextProps.cjs');
45
45
  require('../../../store/state/primaryWalletId/primaryWalletId.cjs');
46
46
  require('../../../store/state/connectedWalletsInfo/connectedWalletsInfo.cjs');
47
+ var exportWalletCredential = require('../../../utils/functions/exportWalletCredential/exportWalletCredential.cjs');
47
48
  require('../../../context/AccessDeniedContext/AccessDeniedContext.cjs');
48
49
  require('../../../context/AccountExistsContext/AccountExistsContext.cjs');
49
50
  require('../../../context/UserWalletsContext/UserWalletsContext.cjs');
@@ -58,7 +59,6 @@ require('../../../utils/hooks/useUserUpdateRequest/useUpdateUser/userFieldsSchem
58
59
  var useMutation = require('../../../utils/hooks/useMutation/useMutation.cjs');
59
60
  var useIsTurnkeyWallet = require('../../../utils/hooks/useIsTurnkeyWallet/useIsTurnkeyWallet.cjs');
60
61
  require('bs58');
61
- var usePromise = require('../../../utils/hooks/usePromise/usePromise.cjs');
62
62
  require('@dynamic-labs/types');
63
63
  require('../../../context/SocialRedirectContext/SocialRedirectContext.cjs');
64
64
  require('../../../context/LoadingContext/LoadingContext.cjs');
@@ -110,7 +110,6 @@ require('../../../context/ConnectWithOtpContext/ConnectWithOtpContext.cjs');
110
110
  require('../../../widgets/DynamicBridgeWidget/views/WalletsView/components/SecondaryWallets/SecondaryWallets.cjs');
111
111
  require('@hcaptcha/react-hcaptcha');
112
112
  var Checkbox = require('../../../components/Checkbox/Checkbox.cjs');
113
- var constants = require('../constants.cjs');
114
113
  var waasExport = require('../utils/waasExport/waasExport.cjs');
115
114
  require('../../ExchangeWhitelistWarning/ExchangeWhitelistWarning.cjs');
116
115
  require('../../../context/ErrorContext/hooks/useErrorText/useErrorText.cjs');
@@ -120,6 +119,7 @@ require('../../../store/state/tokenBalances.cjs');
120
119
  require('../../../store/state/multichainBalances.cjs');
121
120
  var useSyncEmbeddedWalletFlow = require('../../../utils/hooks/useSyncEmbeddedWalletFlow/useSyncEmbeddedWalletFlow.cjs');
122
121
  require('../../../shared/utils/functions/getInitialUrl/getInitialUrl.cjs');
122
+ var EmbeddedWalletExport = require('../../../components/EmbeddedWalletExport/EmbeddedWalletExport.cjs');
123
123
  require('../../../components/InlineWidget/InlineWidget.cjs');
124
124
  require('../../../components/IsBrowser/IsBrowser.cjs');
125
125
  require('../../../components/Popper/Popper/Popper.cjs');
@@ -130,14 +130,12 @@ const EmbeddedRevealView = ({ exportPrivateKey, isPromptForExport = false, }) =>
130
130
  const { primaryWallet, user, setShowAuthFlow, environmentId } = useInternalDynamicContext.useInternalDynamicContext();
131
131
  const { handleAcknowledgeExportPrompt } = useSyncEmbeddedWalletFlow.useSyncEmbeddedWalletFlow();
132
132
  const { isTurnkeyWallet } = useIsTurnkeyWallet.useIsTurnkeyWallet();
133
- const isWaasWallet = user === null || user === void 0 ? void 0 : user.verifiedCredentials.find((vc) => { var _a; return (_a = vc.walletName) === null || _a === void 0 ? void 0 : _a.startsWith('dynamicwaas'); });
133
+ const isWaasWallet = Boolean(user === null || user === void 0 ? void 0 : user.verifiedCredentials.find((vc) => { var _a; return (_a = vc.walletName) === null || _a === void 0 ? void 0 : _a.startsWith('dynamicwaas'); }));
134
134
  const { setDynamicWidgetView } = DynamicWidgetContext.useWidgetContext();
135
135
  const { pushView } = ViewContext.useViewContext();
136
136
  const { getEOAWallet, isSmartWallet } = useSmartWallets.useSmartWallets();
137
137
  const [acknowledgement1, setAcknowledgement1] = React.useState(false);
138
- const iframeContainerRef = React.useRef(null);
139
- const [showSkeleton, setShowSkeleton] = React.useState(false);
140
- const [waasExportComplete, setWaasExportComplete] = React.useState(false);
138
+ const [iframeContainerRef, setIframeContainerRef] = React.useState(null);
141
139
  if (!primaryWallet) {
142
140
  throw new utils.DynamicError('No primary wallet found', errors.INVALID_WALLET_DATA);
143
141
  }
@@ -168,89 +166,21 @@ const EmbeddedRevealView = ({ exportPrivateKey, isPromptForExport = false, }) =>
168
166
  // only run once on unmount
169
167
  // eslint-disable-next-line react-hooks/exhaustive-deps
170
168
  }, []);
171
- const { isLoading: exportLoading } = usePromise.usePromise(() => _tslib.__awaiter(void 0, void 0, void 0, function* () {
172
- var _d, _e;
173
- const iframeContainerElement = iframeContainerRef.current;
174
- if (!iframeContainerElement ||
175
- ((_d = iframeContainerElement === null || iframeContainerElement === void 0 ? void 0 : iframeContainerElement.children) === null || _d === void 0 ? void 0 : _d.length) > 0) {
176
- return;
177
- }
178
- if (walletConnectorCore.isSessionKeyCompatibleWalletConnector(wallet === null || wallet === void 0 ? void 0 : wallet.connector)) {
179
- yield ((_e = wallet === null || wallet === void 0 ? void 0 : wallet.connector) === null || _e === void 0 ? void 0 : _e.createOrRestoreSession());
180
- }
181
- if (isTurnkeyWallet) {
182
- return turnkeyExport.initExport({
183
- iframeContainer: iframeContainerElement,
184
- iframeElementId: constants.iframeElementId,
185
- wallet: wallet,
186
- });
187
- }
188
- return;
189
- }));
190
- const { mutate: handleExportWallet, isLoading, error, data, } = useMutation.useMutation(() => _tslib.__awaiter(void 0, void 0, void 0, function* () {
191
- var _f, _g, _h;
192
- handleAcknowledgeExportPrompt();
193
- if (isTurnkeyWallet) {
194
- try {
195
- return yield turnkeyExport.exportCredential({
196
- address: exportPrivateKey ? wallet === null || wallet === void 0 ? void 0 : wallet.address : undefined,
197
- environmentId,
198
- user,
199
- wallet: wallet,
200
- });
201
- }
202
- catch (err) {
203
- if (walletConnectorCore.isSessionKeyCompatibleWalletConnector(wallet === null || wallet === void 0 ? void 0 : wallet.connector) &&
204
- ((_f = wallet === null || wallet === void 0 ? void 0 : wallet.connector) === null || _f === void 0 ? void 0 : _f.removeSessionKeys)) {
205
- yield ((_g = wallet === null || wallet === void 0 ? void 0 : wallet.connector) === null || _g === void 0 ? void 0 : _g.removeSessionKeys());
206
- yield ((_h = wallet === null || wallet === void 0 ? void 0 : wallet.connector) === null || _h === void 0 ? void 0 : _h.createOrRestoreSession({
207
- ignoreRestore: true,
208
- }));
209
- logger.logger.error('[TK - removeSessionKeys] failed to perform revealEmbeddedWalletKey activity', {
210
- address: wallet === null || wallet === void 0 ? void 0 : wallet.address,
211
- err,
212
- userId: user === null || user === void 0 ? void 0 : user.userId,
213
- });
214
- }
215
- return turnkeyExport.exportCredential({
216
- address: exportPrivateKey ? wallet === null || wallet === void 0 ? void 0 : wallet.address : undefined,
217
- environmentId,
218
- user,
219
- wallet: wallet,
220
- });
221
- }
222
- }
223
- if (isWaasWallet) {
224
- // Start the export in the background
225
- waasExport.exportWaasCredential({
226
- address: exportPrivateKey ? wallet === null || wallet === void 0 ? void 0 : wallet.address : undefined,
227
- iframeContainer: iframeContainerRef.current,
228
- user,
229
- wallet: wallet,
230
- })
231
- .then(() => {
232
- setWaasExportComplete(true);
233
- })
234
- .catch((error) => {
235
- logger.logger.error(`Failed in exporting waas wallet ${wallet === null || wallet === void 0 ? void 0 : wallet.id}`, error);
236
- dynamicEvents.dynamicEvents.emit('embeddedWalletRevealFailed', error);
237
- });
238
- // Return true immediately to show skeleton
239
- return true;
240
- }
241
- return undefined;
169
+ const { mutate: handleExportWallet, isLoading, error, data, } = useMutation.useMutation(() => exportWalletCredential.exportWalletCredential({
170
+ environmentId,
171
+ exportPrivateKey,
172
+ handleAcknowledgeExportPrompt,
173
+ iframeContainerRef: iframeContainerRef,
174
+ isTurnkeyWallet,
175
+ isWaasWallet,
176
+ user,
177
+ wallet,
242
178
  }), {
243
179
  onFailure: (err) => {
244
180
  logger.logger.error('Failed to export', err);
245
181
  dynamicEvents.dynamicEvents.emit('embeddedWalletRevealFailed', err);
246
182
  },
247
183
  });
248
- // Reset waasExportComplete when data changes to false (new export starting)
249
- React.useEffect(() => {
250
- if (!data) {
251
- setWaasExportComplete(false);
252
- }
253
- }, [data]);
254
184
  const errorText = React.useMemo(() => {
255
185
  if (!error) {
256
186
  return undefined;
@@ -277,26 +207,6 @@ const EmbeddedRevealView = ({ exportPrivateKey, isPromptForExport = false, }) =>
277
207
  setShowAuthFlow(false);
278
208
  setDynamicWidgetView('send-balance');
279
209
  }, className: 'embedded-reveal-view__zerodev-warning__link-button', children: jsxRuntime.jsx(Typography.Typography, { variant: 'body_normal', weight: 'regular', color: 'primary', className: 'underline', copykey: 'dyn_embedded_reveal.aa_warning.button', children: t('dyn_embedded_reveal.aa_warning.button') }) })] })] })), jsxRuntime.jsx("div", { className: 'embedded-reveal-view__body__description', children: !(!isLoading && data && !error) && (jsxRuntime.jsx("div", { className: 'embedded-reveal-view__header', children: jsxRuntime.jsx("div", { className: 'embedded-reveal-view__header__hero', children: jsxRuntime.jsx(exportEmbeddedHero.ReactComponent, {}) }) })) })] }));
280
- React.useEffect(() => {
281
- if (data) {
282
- // Show skeleton first
283
- setShowSkeleton(true);
284
- if (isWaasWallet) {
285
- // For WAAS wallets, hide skeleton when export is actually complete
286
- if (waasExportComplete) {
287
- setShowSkeleton(false);
288
- }
289
- }
290
- else {
291
- // For other wallets, use the fixed 2-second delay
292
- const timer = setTimeout(() => {
293
- setShowSkeleton(false);
294
- }, 2000);
295
- return () => clearTimeout(timer);
296
- }
297
- }
298
- return;
299
- }, [data, isWaasWallet, waasExportComplete]);
300
210
  const closeButton = (jsxRuntime.jsx(IconButton.IconButton, { onClick: () => {
301
211
  setShowAuthFlow(false);
302
212
  }, type: 'button', children: jsxRuntime.jsx(close.ReactComponent, {}) }));
@@ -325,42 +235,10 @@ const EmbeddedRevealView = ({ exportPrivateKey, isPromptForExport = false, }) =>
325
235
  }
326
236
  return baseClass;
327
237
  };
328
- const getCredentialContainerClassName = () => {
329
- const baseClass = 'embedded-reveal-view__body__credential-container';
330
- if (title !== credentialTitle) {
331
- return `${baseClass} ${baseClass}--hidden`;
332
- }
333
- if (isWaasWallet) {
334
- return `${baseClass} ${baseClass}--waas`;
335
- }
336
- return baseClass;
337
- };
338
- const getIframeContainerClassName = () => {
339
- const baseClass = 'embedded-reveal-view__body__iframe-container';
340
- if (!data) {
341
- return `${baseClass} ${baseClass}--hidden`;
342
- }
343
- if (showSkeleton) {
344
- return `${baseClass} ${baseClass}--invisible`;
345
- }
346
- return baseClass;
347
- };
348
- const getSkeletonLines = () => {
349
- const lineCount = 5; // Updated for 110px height
350
- const lines = [];
351
- for (let i = 0; i < lineCount; i++) {
352
- const isLastLine = i === lineCount - 1;
353
- const className = isLastLine
354
- ? 'embedded-reveal-view__body__skeleton-line embedded-reveal-view__body__skeleton-line--short'
355
- : 'embedded-reveal-view__body__skeleton-line';
356
- lines.push(jsxRuntime.jsx("div", { className: className, "data-testid": i === 0 ? 'private-key-skeleton' : undefined }, i));
357
- }
358
- return lines;
359
- };
360
238
  return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(ModalHeader.ModalHeader, { trailing: isPromptForExport ? null : closeButton, children: jsxRuntime.jsx(Typography.Typography, { as: 'h1', variant: 'title', color: 'primary', "data-testid": 'dynamic-auth-modal-heading', className: 'header__typography', children: title }) }), jsxRuntime.jsx("div", { className: 'embedded-reveal-view', children: jsxRuntime.jsxs("div", { className: getBodyClassName(), children: [(!isWaasWallet ||
361
239
  !hasInjectedCredential ||
362
240
  title !== credentialTitle) &&
363
- contentHeader, isTurnkeyWallet || isWaasWallet ? (jsxRuntime.jsxs("div", { className: getCredentialContainerClassName(), children: [jsxRuntime.jsx("div", { id: constants.iframeContainerId, className: getIframeContainerClassName(), ref: iframeContainerRef }), showSkeleton && data && (jsxRuntime.jsx("div", { className: 'embedded-reveal-view__body__skeleton-container', children: getSkeletonLines() }))] })) : null, hasInjectedCredential ? (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(TypographyButton.TypographyButton, { buttonPadding: 'medium', buttonVariant: 'brand-primary', onClick: () => {
241
+ contentHeader, (isTurnkeyWallet || isWaasWallet) && (jsxRuntime.jsx(EmbeddedWalletExport.EmbeddedWalletExport, { wallet: wallet, isTurnkeyWallet: isTurnkeyWallet, isWaasWallet: isWaasWallet, data: data, onIframeContainerRef: setIframeContainerRef, isVisible: !title.includes('Agree') })), hasInjectedCredential ? (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(TypographyButton.TypographyButton, { buttonPadding: 'medium', buttonVariant: 'brand-primary', onClick: () => {
364
242
  setShowAuthFlow(false);
365
243
  }, loading: isLoading, copykey: 'dyn_embedded_reveal.done_button_label', typographyProps: {
366
244
  color: 'inherit',
@@ -372,7 +250,7 @@ const EmbeddedRevealView = ({ exportPrivateKey, isPromptForExport = false, }) =>
372
250
  setShowAuthFlow(false);
373
251
  }, dataTestId: 'embedded-reveal-button', copykey: 'dyn_embedded_reveal.skip_button_label', expanded: true, buttonClassName: 'embedded-reveal-view__body__button', children: t('dyn_embedded_reveal.skip_button_label') })), jsxRuntime.jsx(TypographyButton.TypographyButton, { buttonPadding: 'medium', buttonVariant: 'brand-primary', typographyProps: {
374
252
  color: 'inherit',
375
- }, onClick: () => handleExportWallet(), disabled: !acknowledgement1 || exportLoading, loading: isLoading, dataTestId: 'embedded-reveal-button', copykey: 'dyn_embedded_reveal.reveal_button_label', style: { width: '100%' }, className: 'embedded-reveal-view__body__button', expanded: true, children: isPromptForExport
253
+ }, onClick: () => handleExportWallet(), disabled: !acknowledgement1, loading: isLoading, dataTestId: 'embedded-reveal-button', copykey: 'dyn_embedded_reveal.reveal_button_label', style: { width: '100%' }, className: 'embedded-reveal-view__body__button', expanded: true, children: isPromptForExport
376
254
  ? t('dyn_embedded_reveal.backup_button_label')
377
255
  : t('dyn_embedded_reveal.reveal_button_label') })] })] }))] }) })] }));
378
256
  };