@dynamic-labs/sdk-react-core 4.91.2 → 4.91.4

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 (151) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/package.cjs +1 -1
  3. package/package.js +1 -1
  4. package/package.json +12 -12
  5. package/src/lib/client/client.cjs +1 -1
  6. package/src/lib/client/client.js +1 -1
  7. package/src/lib/components/TransactionConfirmationPageLayout/TransactionConfirmationPageLayout.cjs +4 -1
  8. package/src/lib/components/TransactionConfirmationPageLayout/TransactionConfirmationPageLayout.js +4 -1
  9. package/src/lib/components/TransactionStatusLayout/TransactionStatusLayout.cjs +3 -0
  10. package/src/lib/components/TransactionStatusLayout/TransactionStatusLayout.js +3 -0
  11. package/src/lib/context/DynamicContext/hooks/useRemoveWallet/useRemoveWallet.cjs +1 -1
  12. package/src/lib/context/DynamicContext/hooks/useRemoveWallet/useRemoveWallet.js +1 -1
  13. package/src/lib/context/DynamicContext/types/SettingsOverrides.d.ts +13 -1
  14. package/src/lib/context/ErrorContext/ErrorContext.cjs +48 -28
  15. package/src/lib/context/ErrorContext/ErrorContext.js +49 -29
  16. package/src/lib/context/OnrampContext/OnrampContext.cjs +21 -16
  17. package/src/lib/context/OnrampContext/OnrampContext.js +21 -16
  18. package/src/lib/context/SendBalanceContext/SendBalanceContext.errors.cjs +2 -2
  19. package/src/lib/context/SendBalanceContext/SendBalanceContext.errors.js +2 -2
  20. package/src/lib/context/SocialRedirectContext/hooks/useRedirectSocialHandler/useRedirectSocialHandler.cjs +3 -3
  21. package/src/lib/context/SocialRedirectContext/hooks/useRedirectSocialHandler/useRedirectSocialHandler.js +3 -3
  22. package/src/lib/data/api/email/email.cjs +6 -3
  23. package/src/lib/data/api/email/email.js +6 -3
  24. package/src/lib/data/api/embeddedWallets/embeddedWallets.cjs +15 -14
  25. package/src/lib/data/api/embeddedWallets/embeddedWallets.js +8 -7
  26. package/src/lib/data/api/exchangeAccounts/exchangeAccounts.cjs +3 -3
  27. package/src/lib/data/api/exchangeAccounts/exchangeAccounts.js +3 -3
  28. package/src/lib/data/api/oauth/oauth.cjs +3 -2
  29. package/src/lib/data/api/oauth/oauth.js +3 -2
  30. package/src/lib/data/api/session/session.cjs +3 -3
  31. package/src/lib/data/api/session/session.js +3 -3
  32. package/src/lib/data/api/sms/sms.cjs +4 -1
  33. package/src/lib/data/api/sms/sms.js +4 -1
  34. package/src/lib/data/api/user/user.cjs +5 -5
  35. package/src/lib/data/api/user/user.js +6 -6
  36. package/src/lib/data/api/utils.cjs +6 -1
  37. package/src/lib/data/api/utils.d.ts +1 -0
  38. package/src/lib/data/api/utils.js +6 -2
  39. package/src/lib/data/api/wallets/wallets.cjs +17 -15
  40. package/src/lib/data/api/wallets/wallets.js +18 -16
  41. package/src/lib/events/auth.d.ts +3 -2
  42. package/src/lib/shared/types/dynamicEventsCallbacks.d.ts +2 -1
  43. package/src/lib/store/state/nonce/nonce.cjs +1 -1
  44. package/src/lib/store/state/nonce/nonce.js +1 -1
  45. package/src/lib/utils/functions/generateMessages/index.cjs +3 -3
  46. package/src/lib/utils/functions/generateMessages/index.js +3 -3
  47. package/src/lib/utils/functions/getEmbeddedWalletAuthHandler/getEmbeddedWalletAuthHandler.cjs +1 -1
  48. package/src/lib/utils/functions/getEmbeddedWalletAuthHandler/getEmbeddedWalletAuthHandler.js +1 -1
  49. package/src/lib/utils/functions/getTransactionLink/blockExplorerPatterns.cjs +30 -0
  50. package/src/lib/utils/functions/getTransactionLink/blockExplorerPatterns.d.ts +17 -0
  51. package/src/lib/utils/functions/getTransactionLink/blockExplorerPatterns.js +29 -1
  52. package/src/lib/utils/functions/getTransactionLink/getTransactionLink.cjs +13 -1
  53. package/src/lib/utils/functions/getTransactionLink/getTransactionLink.d.ts +2 -1
  54. package/src/lib/utils/functions/getTransactionLink/getTransactionLink.js +14 -2
  55. package/src/lib/utils/functions/getVerifyArgs/getVerifyArgs.cjs +4 -0
  56. package/src/lib/utils/functions/getVerifyArgs/getVerifyArgs.js +5 -1
  57. package/src/lib/utils/hooks/authenticationHooks/useConnectAndSign/useConnectAndSign.cjs +1 -1
  58. package/src/lib/utils/hooks/authenticationHooks/useConnectAndSign/useConnectAndSign.js +2 -2
  59. package/src/lib/utils/hooks/authenticationHooks/useOtpVerificationRequest/useOtpVerificationRequest.cjs +2 -2
  60. package/src/lib/utils/hooks/authenticationHooks/useOtpVerificationRequest/useOtpVerificationRequest.js +2 -2
  61. package/src/lib/utils/hooks/useAuthenticateConnectedUser/useAuthenticateConnectedUser.cjs +2 -2
  62. package/src/lib/utils/hooks/useAuthenticateConnectedUser/useAuthenticateConnectedUser.js +2 -2
  63. package/src/lib/utils/hooks/useConfirmationPortal/useConfirmationPortal.cjs +1 -1
  64. package/src/lib/utils/hooks/useConfirmationPortal/useConfirmationPortal.js +1 -1
  65. package/src/lib/utils/hooks/useConnectExchangeForFunding/useConnectExchangeForFunding.cjs +1 -1
  66. package/src/lib/utils/hooks/useConnectExchangeForFunding/useConnectExchangeForFunding.js +1 -1
  67. package/src/lib/utils/hooks/useConnectUnifiedForFunding/useConnectUnifiedForFunding.cjs +2 -2
  68. package/src/lib/utils/hooks/useConnectUnifiedForFunding/useConnectUnifiedForFunding.js +2 -2
  69. package/src/lib/utils/hooks/useConnectWallet/HandleConnectWalletRejectionError.cjs +1 -1
  70. package/src/lib/utils/hooks/useConnectWallet/HandleConnectWalletRejectionError.js +1 -1
  71. package/src/lib/utils/hooks/useCreateDynamicEmbeddedWalletMutation/useCreateDynamicEmbeddedWalletMutation.cjs +1 -1
  72. package/src/lib/utils/hooks/useCreateDynamicEmbeddedWalletMutation/useCreateDynamicEmbeddedWalletMutation.js +1 -1
  73. package/src/lib/utils/hooks/useCreateWalletConnectorOptions/utils/errors/ConnectorSetupError.cjs +1 -1
  74. package/src/lib/utils/hooks/useCreateWalletConnectorOptions/utils/errors/ConnectorSetupError.js +1 -1
  75. package/src/lib/utils/hooks/useDynamicWaas/useDynamicWaas.cjs +8 -8
  76. package/src/lib/utils/hooks/useDynamicWaas/useDynamicWaas.js +8 -8
  77. package/src/lib/utils/hooks/useEmbeddedWallet/useEmbeddedWallet.cjs +4 -4
  78. package/src/lib/utils/hooks/useEmbeddedWallet/useEmbeddedWallet.js +4 -4
  79. package/src/lib/utils/hooks/useEmbeddedWallet/useSecureEnclaveEmbeddedWallet/useSecureEnclaveEmbeddedWallet.cjs +9 -9
  80. package/src/lib/utils/hooks/useEmbeddedWallet/useSecureEnclaveEmbeddedWallet/useSecureEnclaveEmbeddedWallet.js +9 -9
  81. package/src/lib/utils/hooks/useFundWithWallet/useConnectWalletForFunding/useConnectWalletForFunding.cjs +2 -2
  82. package/src/lib/utils/hooks/useFundWithWallet/useConnectWalletForFunding/useConnectWalletForFunding.js +2 -2
  83. package/src/lib/utils/hooks/useFundingHelpers/useFundingHelpers.cjs +2 -2
  84. package/src/lib/utils/hooks/useFundingHelpers/useFundingHelpers.js +2 -2
  85. package/src/lib/utils/hooks/useGetMfaToken/useGetMfaToken.cjs +1 -1
  86. package/src/lib/utils/hooks/useGetMfaToken/useGetMfaToken.js +1 -1
  87. package/src/lib/utils/hooks/useSignEip7702Authorization/useSignEip7702Authorization.cjs +2 -2
  88. package/src/lib/utils/hooks/useSignEip7702Authorization/useSignEip7702Authorization.js +2 -2
  89. package/src/lib/utils/hooks/useSocialAccounts/useSocialAccounts.cjs +2 -2
  90. package/src/lib/utils/hooks/useSocialAccounts/useSocialAccounts.js +2 -2
  91. package/src/lib/utils/hooks/useSocialAuth/useSocialAuth.cjs +2 -2
  92. package/src/lib/utils/hooks/useSocialAuth/useSocialAuth.js +2 -2
  93. package/src/lib/utils/hooks/useTransferWallet/useTransferWallet.cjs +2 -2
  94. package/src/lib/utils/hooks/useTransferWallet/useTransferWallet.js +2 -2
  95. package/src/lib/utils/hooks/useUpgradeEmbeddedWallet/useUpgradeEmbeddedWallet.cjs +3 -3
  96. package/src/lib/utils/hooks/useUpgradeEmbeddedWallet/useUpgradeEmbeddedWallet.js +3 -3
  97. package/src/lib/utils/hooks/useUserAuth/useUserAuth.cjs +1 -1
  98. package/src/lib/utils/hooks/useUserAuth/useUserAuth.js +1 -1
  99. package/src/lib/utils/hooks/useUserDataForm/useUserDataForm.cjs +1 -1
  100. package/src/lib/utils/hooks/useUserDataForm/useUserDataForm.js +1 -1
  101. package/src/lib/utils/hooks/useUserUpdateRequest/unlinkUserEmail/unlinkUserEmail.cjs +3 -3
  102. package/src/lib/utils/hooks/useUserUpdateRequest/unlinkUserEmail/unlinkUserEmail.js +3 -3
  103. package/src/lib/utils/hooks/useUserUpdateRequest/useUpdateUserWithModal/useUpdateUserWithModal.cjs +1 -1
  104. package/src/lib/utils/hooks/useUserUpdateRequest/useUpdateUserWithModal/useUpdateUserWithModal.js +1 -1
  105. package/src/lib/utils/hooks/useVerifyWallet/useVerifyWallet.cjs +2 -2
  106. package/src/lib/utils/hooks/useVerifyWallet/useVerifyWallet.js +2 -2
  107. package/src/lib/utils/hooks/useViewSettings/useViewSettings.d.ts +5 -1
  108. package/src/lib/utils/hooks/useWalletConnectors/useWalletConnectors.cjs +1 -1
  109. package/src/lib/utils/hooks/useWalletConnectors/useWalletConnectors.js +1 -1
  110. package/src/lib/utils/hooks/useWalletOptions/useWalletOptions.cjs +1 -1
  111. package/src/lib/utils/hooks/useWalletOptions/useWalletOptions.js +1 -1
  112. package/src/lib/views/BridgeNextWalletConnectionView/BridgeNextWalletConnectionView.cjs +1 -1
  113. package/src/lib/views/BridgeNextWalletConnectionView/BridgeNextWalletConnectionView.js +1 -1
  114. package/src/lib/views/EmailVerification/EmailVerification.cjs +4 -4
  115. package/src/lib/views/EmailVerification/EmailVerification.js +4 -4
  116. package/src/lib/views/EmailWalletOTPVerificationView/EmailWalletOTPVerificationView.cjs +2 -2
  117. package/src/lib/views/EmailWalletOTPVerificationView/EmailWalletOTPVerificationView.js +2 -2
  118. package/src/lib/views/EmbeddedReveal/utils/turnkeyExport/turnkeyExport.cjs +2 -2
  119. package/src/lib/views/EmbeddedReveal/utils/turnkeyExport/turnkeyExport.js +2 -2
  120. package/src/lib/views/EmbeddedReveal/utils/waasExport/waasExport.cjs +2 -2
  121. package/src/lib/views/EmbeddedReveal/utils/waasExport/waasExport.js +2 -2
  122. package/src/lib/views/ExportSharesView/ExportSharesView.cjs +2 -2
  123. package/src/lib/views/ExportSharesView/ExportSharesView.js +2 -2
  124. package/src/lib/views/LoginView/sections/SocialSignInSection/DynamicSocialSignIn/DynamicSocialSignIn.cjs +2 -2
  125. package/src/lib/views/LoginView/sections/SocialSignInSection/DynamicSocialSignIn/DynamicSocialSignIn.js +2 -2
  126. package/src/lib/views/LoginView/useLoginView/useLoginView.cjs +1 -1
  127. package/src/lib/views/LoginView/useLoginView/useLoginView.js +1 -1
  128. package/src/lib/views/MergeUserAccountsWithSameEmailView/MergeUserAccountsWithSameEmailView.cjs +1 -1
  129. package/src/lib/views/MergeUserAccountsWithSameEmailView/MergeUserAccountsWithSameEmailView.js +1 -1
  130. package/src/lib/views/MfaVerificationView/MfaVerificationView.cjs +2 -2
  131. package/src/lib/views/MfaVerificationView/MfaVerificationView.js +2 -2
  132. package/src/lib/views/Passkey/PasskeyRecovery/BundleValidation/PasskeyBundleRecovery.cjs +1 -1
  133. package/src/lib/views/Passkey/PasskeyRecovery/BundleValidation/PasskeyBundleRecovery.js +1 -1
  134. package/src/lib/views/Passkey/PasskeyRecovery/CompleteRecovery/PasskeyCompleteRecovery.cjs +1 -1
  135. package/src/lib/views/Passkey/PasskeyRecovery/CompleteRecovery/PasskeyCompleteRecovery.js +1 -1
  136. package/src/lib/views/Passkey/utils/createEmbeddedWalletRequest/createEmbeddedWalletRequest.cjs +3 -3
  137. package/src/lib/views/Passkey/utils/createEmbeddedWalletRequest/createEmbeddedWalletRequest.js +3 -3
  138. package/src/lib/views/Passkey/utils/passkeyRecovery/passkeyRecovery.cjs +14 -14
  139. package/src/lib/views/Passkey/utils/passkeyRecovery/passkeyRecovery.js +14 -14
  140. package/src/lib/views/SendBalanceView/SendBalanceView.cjs +2 -2
  141. package/src/lib/views/SendBalanceView/SendBalanceView.js +2 -2
  142. package/src/lib/views/SmsVerification/useSmsVerification/useSmsVerification.cjs +2 -2
  143. package/src/lib/views/SmsVerification/useSmsVerification/useSmsVerification.js +2 -2
  144. package/src/lib/views/WalletDelegation/WalletDelegationView/WalletDelegationView.cjs +1 -1
  145. package/src/lib/views/WalletDelegation/WalletDelegationView/WalletDelegationView.js +1 -1
  146. package/src/lib/views/WalletUpgradeFlowView/WalletUpgradeFlowView.cjs +1 -1
  147. package/src/lib/views/WalletUpgradeFlowView/WalletUpgradeFlowView.js +1 -1
  148. package/src/lib/widgets/DynamicWidget/views/ChooseWalletFundingMethod/useFundingMethods/getPromptAmountParams/getPromptAmountParams.cjs +1 -1
  149. package/src/lib/widgets/DynamicWidget/views/ChooseWalletFundingMethod/useFundingMethods/getPromptAmountParams/getPromptAmountParams.js +1 -1
  150. package/src/lib/widgets/DynamicWidget/views/ReceiveWalletFunds/utils/useSubmitWalletFunding/useSubmitWalletFunding.cjs +10 -1
  151. package/src/lib/widgets/DynamicWidget/views/ReceiveWalletFunds/utils/useSubmitWalletFunding/useSubmitWalletFunding.js +10 -1
@@ -5,9 +5,9 @@ import { useState, useRef, useCallback, useMemo } from 'react';
5
5
  import { useTranslation } from 'react-i18next';
6
6
  import { EmbeddedWalletVersionEnum } from '@dynamic-labs/sdk-api-core';
7
7
  import { isSessionKeyCompatibleWallet } from '@dynamic-labs/wallet-connector-core';
8
+ import { SdkErrorCode } from '@dynamic-labs/utils';
8
9
  import '@dynamic-labs-sdk/client/core';
9
10
  import 'eventemitter3';
10
- import '@dynamic-labs/utils';
11
11
  import '@dynamic-labs-sdk/client';
12
12
  import '../../config/ApiEndpoint.js';
13
13
  import '@dynamic-labs/iconic';
@@ -175,7 +175,7 @@ const EmailVerification = ({ isEmailRecoveryFlow = false, showRetryButton: _show
175
175
  const emailString = email !== null && email !== void 0 ? email : '';
176
176
  dynamicEvents.emit('emailVerificationResult', isValidatedRef.current, emailString);
177
177
  if (!isValidatedRef.current)
178
- dynamicEvents.emit('authFailure', { email: emailString, option: emailString, type: 'email' }, 'user-cancelled');
178
+ dynamicEvents.emit('authFailure', { email: emailString, option: emailString, type: 'email' }, SdkErrorCode.USER_CANCELLED);
179
179
  if (!email)
180
180
  logger.warn("WARNING: emitted emailVerificationResult with incomplete params because useVerification's displayedDestination was undefined");
181
181
  });
@@ -354,10 +354,10 @@ const EmailVerification = ({ isEmailRecoveryFlow = false, showRetryButton: _show
354
354
  logger.debug(error);
355
355
  instrumentAuthLoginFailed(error, { authOrigin: 'email-verification' });
356
356
  setErrorMessage(error.code, error, 'email-verification');
357
- if (error.code === 'too_many_email_verification_attempts') {
357
+ if (error.code === SdkErrorCode.TOO_MANY_EMAIL_VERIFICATION_ATTEMPTS) {
358
358
  setShowRetryButton(false);
359
359
  }
360
- if (error.code === 'invalid_email_verification') {
360
+ if (error.code === SdkErrorCode.INVALID_EMAIL_VERIFICATION) {
361
361
  clearStackAndPushInitialView();
362
362
  }
363
363
  }
@@ -6,12 +6,12 @@ Object.defineProperty(exports, '__esModule', { value: true });
6
6
  var jsxRuntime = require('react/jsx-runtime');
7
7
  var React = require('react');
8
8
  var walletConnectorCore = require('@dynamic-labs/wallet-connector-core');
9
+ var utils = require('@dynamic-labs/utils');
9
10
  require('../../components/Accordion/components/AccordionItem/AccordionItem.cjs');
10
11
  require('react-i18next');
11
12
  require('@dynamic-labs/iconic');
12
13
  var ViewContext = require('../../context/ViewContext/ViewContext.cjs');
13
14
  require('../../../../_virtual/_tslib.cjs');
14
- require('@dynamic-labs/utils');
15
15
  require('../../shared/logger.cjs');
16
16
  require('@dynamic-labs/wallet-book');
17
17
  require('../../utils/constants/colors.cjs');
@@ -137,7 +137,7 @@ const EmailWalletOTPVerificationView = () => {
137
137
  email,
138
138
  option: email,
139
139
  type: 'email',
140
- }, 'user-cancelled');
140
+ }, utils.SdkErrorCode.USER_CANCELLED);
141
141
  };
142
142
  const { data: isValid, isLoading, mutate: onSubmit, } = useMutation.useMutation((otp) => emailWalletConnector.verifyOneTimePassword(otp), {
143
143
  onFailure: (error) => {
@@ -2,12 +2,12 @@
2
2
  import { jsx } from 'react/jsx-runtime';
3
3
  import { useState } from 'react';
4
4
  import { isEmailOTPWalletConnector } from '@dynamic-labs/wallet-connector-core';
5
+ import { SdkErrorCode } from '@dynamic-labs/utils';
5
6
  import '../../components/Accordion/components/AccordionItem/AccordionItem.js';
6
7
  import 'react-i18next';
7
8
  import '@dynamic-labs/iconic';
8
9
  import { useViewContext } from '../../context/ViewContext/ViewContext.js';
9
10
  import '../../../../_virtual/_tslib.js';
10
- import '@dynamic-labs/utils';
11
11
  import '../../shared/logger.js';
12
12
  import '@dynamic-labs/wallet-book';
13
13
  import '../../utils/constants/colors.js';
@@ -133,7 +133,7 @@ const EmailWalletOTPVerificationView = () => {
133
133
  email,
134
134
  option: email,
135
135
  type: 'email',
136
- }, 'user-cancelled');
136
+ }, SdkErrorCode.USER_CANCELLED);
137
137
  };
138
138
  const { data: isValid, isLoading, mutate: onSubmit, } = useMutation((otp) => emailWalletConnector.verifyOneTimePassword(otp), {
139
139
  onFailure: (error) => {
@@ -59,7 +59,7 @@ const initExport = (_a) => _tslib.__awaiter(void 0, [_a], void 0, function* ({ i
59
59
  const handleExportInitCheck = ({ user, wallet, }) => {
60
60
  var _a, _b, _c, _d, _e;
61
61
  if (!user) {
62
- throw new utils.DynamicError(errors.USER_NOT_LOGGED_IN);
62
+ throw new utils.DynamicError(errors.USER_NOT_LOGGED_IN, 'user_not_logged_in');
63
63
  }
64
64
  if (!(wallet === null || wallet === void 0 ? void 0 : wallet.connector) ||
65
65
  !(wallet === null || wallet === void 0 ? void 0 : wallet.id) ||
@@ -74,7 +74,7 @@ const handleExportInitCheck = ({ user, wallet, }) => {
74
74
  const organizationId = (_e = walletProperties === null || walletProperties === void 0 ? void 0 : walletProperties.turnkeySubOrganizationId) !== null && _e !== void 0 ? _e : undefined;
75
75
  if (!organizationId ||
76
76
  (turnkeyHDWalletId === undefined && privateKeyId === undefined)) {
77
- throw new utils.DynamicError('Invalid token!');
77
+ throw new utils.DynamicError('Invalid token!', 'invalid_token');
78
78
  }
79
79
  return {
80
80
  connector,
@@ -55,7 +55,7 @@ const initExport = (_a) => __awaiter(void 0, [_a], void 0, function* ({ iframeCo
55
55
  const handleExportInitCheck = ({ user, wallet, }) => {
56
56
  var _a, _b, _c, _d, _e;
57
57
  if (!user) {
58
- throw new DynamicError(USER_NOT_LOGGED_IN);
58
+ throw new DynamicError(USER_NOT_LOGGED_IN, 'user_not_logged_in');
59
59
  }
60
60
  if (!(wallet === null || wallet === void 0 ? void 0 : wallet.connector) ||
61
61
  !(wallet === null || wallet === void 0 ? void 0 : wallet.id) ||
@@ -70,7 +70,7 @@ const handleExportInitCheck = ({ user, wallet, }) => {
70
70
  const organizationId = (_e = walletProperties === null || walletProperties === void 0 ? void 0 : walletProperties.turnkeySubOrganizationId) !== null && _e !== void 0 ? _e : undefined;
71
71
  if (!organizationId ||
72
72
  (turnkeyHDWalletId === undefined && privateKeyId === undefined)) {
73
- throw new DynamicError('Invalid token!');
73
+ throw new DynamicError('Invalid token!', 'invalid_token');
74
74
  }
75
75
  return {
76
76
  connector,
@@ -11,7 +11,7 @@ var errors = require('../../../../utils/constants/errors.cjs');
11
11
  const handleExportInitCheck = ({ user, wallet, }) => {
12
12
  var _a, _b, _c;
13
13
  if (!user) {
14
- throw new utils.DynamicError(errors.USER_NOT_LOGGED_IN);
14
+ throw new utils.DynamicError(errors.USER_NOT_LOGGED_IN, 'user_not_logged_in');
15
15
  }
16
16
  if (!(wallet === null || wallet === void 0 ? void 0 : wallet.connector) || !(wallet === null || wallet === void 0 ? void 0 : wallet.id)) {
17
17
  logger.logger.error('Cannot initialize embedded wallet export', {
@@ -28,7 +28,7 @@ const handleExportInitCheck = ({ user, wallet, }) => {
28
28
  walletProperties = Object.assign(Object.assign({}, walletProperties), { accountAddress: wallet.address });
29
29
  }
30
30
  if (!walletProperties) {
31
- throw new utils.DynamicError('Invalid token!');
31
+ throw new utils.DynamicError('Invalid token!', 'invalid_token');
32
32
  }
33
33
  return {
34
34
  connector,
@@ -7,7 +7,7 @@ import { USER_NOT_LOGGED_IN } from '../../../../utils/constants/errors.js';
7
7
  const handleExportInitCheck = ({ user, wallet, }) => {
8
8
  var _a, _b, _c;
9
9
  if (!user) {
10
- throw new DynamicError(USER_NOT_LOGGED_IN);
10
+ throw new DynamicError(USER_NOT_LOGGED_IN, 'user_not_logged_in');
11
11
  }
12
12
  if (!(wallet === null || wallet === void 0 ? void 0 : wallet.connector) || !(wallet === null || wallet === void 0 ? void 0 : wallet.id)) {
13
13
  logger.error('Cannot initialize embedded wallet export', {
@@ -24,7 +24,7 @@ const handleExportInitCheck = ({ user, wallet, }) => {
24
24
  walletProperties = Object.assign(Object.assign({}, walletProperties), { accountAddress: wallet.address });
25
25
  }
26
26
  if (!walletProperties) {
27
- throw new DynamicError('Invalid token!');
27
+ throw new DynamicError('Invalid token!', 'invalid_token');
28
28
  }
29
29
  return {
30
30
  connector,
@@ -86,7 +86,7 @@ const ExportSharesView = ({ passcode }) => {
86
86
  setIsLoading(true);
87
87
  try {
88
88
  if (!wallet) {
89
- throw new utils.DynamicError('No wallet found');
89
+ throw new utils.DynamicError('No wallet found', 'no_wallet_found');
90
90
  }
91
91
  if (walletConnectorCore.isDynamicWaasConnector(wallet.connector)) {
92
92
  yield wallet.connector.exportClientKeyshares({
@@ -107,7 +107,7 @@ const ExportSharesView = ({ passcode }) => {
107
107
  return;
108
108
  }
109
109
  }
110
- throw new utils.DynamicError('Not a supported connector type for export shares');
110
+ throw new utils.DynamicError('Not a supported connector type for export shares', 'unsupported_connector_for_export');
111
111
  }
112
112
  catch (err) {
113
113
  logger.logger.error('Error exporting shares', { error: err });
@@ -82,7 +82,7 @@ const ExportSharesView = ({ passcode }) => {
82
82
  setIsLoading(true);
83
83
  try {
84
84
  if (!wallet) {
85
- throw new DynamicError('No wallet found');
85
+ throw new DynamicError('No wallet found', 'no_wallet_found');
86
86
  }
87
87
  if (isDynamicWaasConnector(wallet.connector)) {
88
88
  yield wallet.connector.exportClientKeyshares({
@@ -103,7 +103,7 @@ const ExportSharesView = ({ passcode }) => {
103
103
  return;
104
104
  }
105
105
  }
106
- throw new DynamicError('Not a supported connector type for export shares');
106
+ throw new DynamicError('Not a supported connector type for export shares', 'unsupported_connector_for_export');
107
107
  }
108
108
  catch (err) {
109
109
  logger.error('Error exporting shares', { error: err });
@@ -6,12 +6,12 @@ Object.defineProperty(exports, '__esModule', { value: true });
6
6
  var jsxRuntime = require('react/jsx-runtime');
7
7
  var React = require('react');
8
8
  var sdkApiCore = require('@dynamic-labs/sdk-api-core');
9
+ var utils = require('@dynamic-labs/utils');
9
10
  require('../../../../../components/Accordion/components/AccordionItem/AccordionItem.cjs');
10
11
  require('react-i18next');
11
12
  require('@dynamic-labs/iconic');
12
13
  var ViewContext = require('../../../../../context/ViewContext/ViewContext.cjs');
13
14
  require('../../../../../../../_virtual/_tslib.cjs');
14
- require('@dynamic-labs/utils');
15
15
  require('@dynamic-labs/wallet-connector-core');
16
16
  require('../../../../../shared/logger.cjs');
17
17
  require('@dynamic-labs/wallet-book');
@@ -131,7 +131,7 @@ const DynamicSocialSignIn = ({ defaultProvider, numOfItemsToDisplay, collapsedLa
131
131
  option: sdkApiCore.ProviderEnum.Farcaster,
132
132
  provider: sdkApiCore.ProviderEnum.Farcaster,
133
133
  type: 'social',
134
- }, 'user-cancelled');
134
+ }, utils.SdkErrorCode.USER_CANCELLED);
135
135
  // Navigate back to the initial login view.
136
136
  clearStackAndPushInitialView();
137
137
  },
@@ -2,12 +2,12 @@
2
2
  import { jsx } from 'react/jsx-runtime';
3
3
  import { useCallback } from 'react';
4
4
  import { ProviderEnum } from '@dynamic-labs/sdk-api-core';
5
+ import { SdkErrorCode } from '@dynamic-labs/utils';
5
6
  import '../../../../../components/Accordion/components/AccordionItem/AccordionItem.js';
6
7
  import 'react-i18next';
7
8
  import '@dynamic-labs/iconic';
8
9
  import { useViewContext } from '../../../../../context/ViewContext/ViewContext.js';
9
10
  import '../../../../../../../_virtual/_tslib.js';
10
- import '@dynamic-labs/utils';
11
11
  import '@dynamic-labs/wallet-connector-core';
12
12
  import '../../../../../shared/logger.js';
13
13
  import '@dynamic-labs/wallet-book';
@@ -127,7 +127,7 @@ const DynamicSocialSignIn = ({ defaultProvider, numOfItemsToDisplay, collapsedLa
127
127
  option: ProviderEnum.Farcaster,
128
128
  provider: ProviderEnum.Farcaster,
129
129
  type: 'social',
130
- }, 'user-cancelled');
130
+ }, SdkErrorCode.USER_CANCELLED);
131
131
  // Navigate back to the initial login view.
132
132
  clearStackAndPushInitialView();
133
133
  },
@@ -104,6 +104,7 @@ require('../../../context/PasskeyContext/PasskeyContext.cjs');
104
104
  require('../../../context/OnrampContext/OnrampContext.cjs');
105
105
  require('../../../utils/hooks/useWalletDelegation/DelegationError.cjs');
106
106
  require('../../../store/state/sendBalances.cjs');
107
+ var useViewSettings = require('../../../utils/hooks/useViewSettings/useViewSettings.cjs');
107
108
  require('../../../store/state/connectorsInitializing/connectorsInitializing.cjs');
108
109
  require('../../../components/OverlayCardBase/OverlayCardTarget/OverlayCardTarget.cjs');
109
110
  require('../../../widgets/DynamicWidget/components/DynamicWidgetHeader/DynamicWidgetHeader.cjs');
@@ -114,7 +115,6 @@ require('../../../../index.cjs');
114
115
  require('../../../widgets/DynamicWidget/views/ManagePasskeysMfaWidgetView/ManagePasskeysMfaWidgetView.cjs');
115
116
  require('../../../widgets/DynamicWidget/views/ManageTotpMfaWidgetView/ManageTotpMfaWidgetView.cjs');
116
117
  require('../../../widgets/DynamicWidget/views/ReceiveWalletFunds/ReceiveWalletFunds.cjs');
117
- var useViewSettings = require('../../../utils/hooks/useViewSettings/useViewSettings.cjs');
118
118
  require('../../../store/state/tokenBalances.cjs');
119
119
  require('../../../store/state/multichainBalances.cjs');
120
120
  require('@dynamic-labs/store');
@@ -100,6 +100,7 @@ import '../../../context/PasskeyContext/PasskeyContext.js';
100
100
  import '../../../context/OnrampContext/OnrampContext.js';
101
101
  import '../../../utils/hooks/useWalletDelegation/DelegationError.js';
102
102
  import '../../../store/state/sendBalances.js';
103
+ import { useViewSettings } from '../../../utils/hooks/useViewSettings/useViewSettings.js';
103
104
  import '../../../store/state/connectorsInitializing/connectorsInitializing.js';
104
105
  import '../../../components/OverlayCardBase/OverlayCardTarget/OverlayCardTarget.js';
105
106
  import '../../../widgets/DynamicWidget/components/DynamicWidgetHeader/DynamicWidgetHeader.js';
@@ -110,7 +111,6 @@ import '../../../../index.js';
110
111
  import '../../../widgets/DynamicWidget/views/ManagePasskeysMfaWidgetView/ManagePasskeysMfaWidgetView.js';
111
112
  import '../../../widgets/DynamicWidget/views/ManageTotpMfaWidgetView/ManageTotpMfaWidgetView.js';
112
113
  import '../../../widgets/DynamicWidget/views/ReceiveWalletFunds/ReceiveWalletFunds.js';
113
- import { useViewSettings } from '../../../utils/hooks/useViewSettings/useViewSettings.js';
114
114
  import '../../../store/state/tokenBalances.js';
115
115
  import '../../../store/state/multichainBalances.js';
116
116
  import '@dynamic-labs/store';
@@ -132,7 +132,7 @@ const MergeUserAccountsWithSameEmailView = ({ returnToView }) => {
132
132
  try {
133
133
  const userProfile = yield user.mergeUserAccounts(environmentId);
134
134
  if (!userProfile) {
135
- throw new utils.DynamicError('Something went wrong, please try again.');
135
+ throw new utils.DynamicError('Something went wrong, please try again.', 'merge_accounts_error');
136
136
  }
137
137
  yield handleAuthenticatedUser(userProfile);
138
138
  setShowAuthFlow(false);
@@ -128,7 +128,7 @@ const MergeUserAccountsWithSameEmailView = ({ returnToView }) => {
128
128
  try {
129
129
  const userProfile = yield mergeUserAccounts(environmentId);
130
130
  if (!userProfile) {
131
- throw new DynamicError('Something went wrong, please try again.');
131
+ throw new DynamicError('Something went wrong, please try again.', 'merge_accounts_error');
132
132
  }
133
133
  yield handleAuthenticatedUser(userProfile);
134
134
  setShowAuthFlow(false);
@@ -147,10 +147,10 @@ const MfaVerificationView = ({ type, isInitialSetup = false, showBackButton = fa
147
147
  onReject: (err) => {
148
148
  if (err instanceof client.MfaRateLimitedError) {
149
149
  setIsRateLimited(true);
150
- setError(new utils.DynamicError(t('dyn_mfa.otp_verification_view.rate_limit_error')));
150
+ setError(new utils.DynamicError(t('dyn_mfa.otp_verification_view.rate_limit_error'), 'mfa_rate_limited'));
151
151
  }
152
152
  else {
153
- setError(new utils.DynamicError(t('dyn_mfa.otp_verification_view.error')));
153
+ setError(new utils.DynamicError(t('dyn_mfa.otp_verification_view.error'), 'tdynmfaotpverificationviewerror'));
154
154
  }
155
155
  },
156
156
  onResolve: () => _tslib.__awaiter(void 0, void 0, void 0, function* () {
@@ -143,10 +143,10 @@ const MfaVerificationView = ({ type, isInitialSetup = false, showBackButton = fa
143
143
  onReject: (err) => {
144
144
  if (err instanceof MfaRateLimitedError) {
145
145
  setIsRateLimited(true);
146
- setError(new DynamicError(t('dyn_mfa.otp_verification_view.rate_limit_error')));
146
+ setError(new DynamicError(t('dyn_mfa.otp_verification_view.rate_limit_error'), 'mfa_rate_limited'));
147
147
  }
148
148
  else {
149
- setError(new DynamicError(t('dyn_mfa.otp_verification_view.error')));
149
+ setError(new DynamicError(t('dyn_mfa.otp_verification_view.error'), 'tdynmfaotpverificationviewerror'));
150
150
  }
151
151
  },
152
152
  onResolve: () => __awaiter(void 0, void 0, void 0, function* () {
@@ -128,7 +128,7 @@ const PasskeyBundleRecovery = ({ authenticatorType, currentAction, }) => {
128
128
  : 'dyn_passkey_recovery';
129
129
  const closeButton = (jsxRuntime.jsx(IconButton.IconButton, { type: 'button', onClick: () => {
130
130
  setShowAuthFlow(false, { emitCancelAuth: true });
131
- dynamicEvents.dynamicEvents.emit('passkeyRecoveryFailed', new utils.DynamicError('Validation request cancelled'));
131
+ dynamicEvents.dynamicEvents.emit('passkeyRecoveryFailed', new utils.DynamicError('Validation request cancelled', 'validation_request_cancelled'));
132
132
  }, "data-testid": 'close-button', children: jsxRuntime.jsx(close.ReactComponent, {}) }));
133
133
  return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(ModalHeader.ModalHeader, { trailing: closeButton, children: jsxRuntime.jsx(Typography.Typography, { as: 'h1', variant: 'title', color: 'primary', "data-testid": 'dynamic-auth-modal-heading', className: 'header__typography', copykey: `${translationKey}.code.title`, children: t(`${translationKey}.code.title`) }) }), jsxRuntime.jsxs("div", { className: 'passkey-recovery-view', children: [!error$1 && !isValid ? (jsxRuntime.jsx(IconWithSpinner.IconWithSpinner, { Icon: emailIcon, isSpinning: !error$1 && !isValid, iconSize: 96 })) : (jsxRuntime.jsx(IconWithStatus.IconWithStatus, { Icon: iconic.SignInWithEmailIcon, iconSize: 64, variant: error$1 ? 'red' : 'green', InnerIcon: error$1 ? error.ReactComponent : check.ReactComponent })), jsxRuntime.jsx(Typography.Typography, { variant: 'body_normal', weight: 'regular', color: 'secondary', className: 'passkey-recovery-view__subtitle', copykey: `${translationKey}.code.description`, children: t(`${translationKey}.code.description`, { email: user === null || user === void 0 ? void 0 : user.email }) }), jsxRuntime.jsx("div", { className: 'passkey-recovery-view__actions', children: jsxRuntime.jsx(Input.Input, { id: 'passkey-recovery-bundle', "data-testid": 'passkey-recovery-bundle-input', value: bundleInput, onChange: handleBundleChanged, label: t(`${translationKey}.code.input_label`), disabled: isLoading || resendingCode, error: Boolean(error$1), className: isValid ? 'passkey-recovery-view__input-valid' : '', autoFocus: true, message: errorText }) }), jsxRuntime.jsxs("div", { className: 'passkey-recovery-view__resend-code', children: [jsxRuntime.jsx(Typography.Typography, { color: 'secondary', variant: 'body_small', copykey: `${translationKey}.code.resend.text`, children: t(`${translationKey}.code.resend.text`) }), jsxRuntime.jsx(Typography.Typography, { variant: 'body_small', color: 'link', copykey: `${translationKey}.code.resend.button`, children: jsxRuntime.jsx(TextButton.TextButton, { "data-testid": 'resend-email-button', onClick: handleResentEmail, disabled: resendingCode || isLoading || (bundleInput.length > 0 && !error$1), children: t(`${translationKey}.code.resend.button`) }) })] })] })] }));
134
134
  };
@@ -124,7 +124,7 @@ const PasskeyBundleRecovery = ({ authenticatorType, currentAction, }) => {
124
124
  : 'dyn_passkey_recovery';
125
125
  const closeButton = (jsx(IconButton, { type: 'button', onClick: () => {
126
126
  setShowAuthFlow(false, { emitCancelAuth: true });
127
- dynamicEvents.emit('passkeyRecoveryFailed', new DynamicError('Validation request cancelled'));
127
+ dynamicEvents.emit('passkeyRecoveryFailed', new DynamicError('Validation request cancelled', 'validation_request_cancelled'));
128
128
  }, "data-testid": 'close-button', children: jsx(SvgClose, {}) }));
129
129
  return (jsxs(Fragment, { children: [jsx(ModalHeader, { trailing: closeButton, children: jsx(Typography, { as: 'h1', variant: 'title', color: 'primary', "data-testid": 'dynamic-auth-modal-heading', className: 'header__typography', copykey: `${translationKey}.code.title`, children: t(`${translationKey}.code.title`) }) }), jsxs("div", { className: 'passkey-recovery-view', children: [!error && !isValid ? (jsx(IconWithSpinner, { Icon: emailIcon, isSpinning: !error && !isValid, iconSize: 96 })) : (jsx(IconWithStatus, { Icon: SignInWithEmailIcon, iconSize: 64, variant: error ? 'red' : 'green', InnerIcon: error ? SvgError : SvgCheck })), jsx(Typography, { variant: 'body_normal', weight: 'regular', color: 'secondary', className: 'passkey-recovery-view__subtitle', copykey: `${translationKey}.code.description`, children: t(`${translationKey}.code.description`, { email: user === null || user === void 0 ? void 0 : user.email }) }), jsx("div", { className: 'passkey-recovery-view__actions', children: jsx(Input, { id: 'passkey-recovery-bundle', "data-testid": 'passkey-recovery-bundle-input', value: bundleInput, onChange: handleBundleChanged, label: t(`${translationKey}.code.input_label`), disabled: isLoading || resendingCode, error: Boolean(error), className: isValid ? 'passkey-recovery-view__input-valid' : '', autoFocus: true, message: errorText }) }), jsxs("div", { className: 'passkey-recovery-view__resend-code', children: [jsx(Typography, { color: 'secondary', variant: 'body_small', copykey: `${translationKey}.code.resend.text`, children: t(`${translationKey}.code.resend.text`) }), jsx(Typography, { variant: 'body_small', color: 'link', copykey: `${translationKey}.code.resend.button`, children: jsx(TextButton, { "data-testid": 'resend-email-button', onClick: handleResentEmail, disabled: resendingCode || isLoading || (bundleInput.length > 0 && !error), children: t(`${translationKey}.code.resend.button`) }) })] })] })] }));
130
130
  };
@@ -41,7 +41,7 @@ const PasskeyCompleteRecovery = ({ goBack, }) => {
41
41
  wallet,
42
42
  });
43
43
  if (!updatedUser) {
44
- throw new utils.DynamicError('Error completing passkey recovery');
44
+ throw new utils.DynamicError('Error completing passkey recovery', 'completing_passkey_recovery');
45
45
  }
46
46
  dynamicEvents.dynamicEvents.emit('passkeyRecoveryCompleted', primaryWallet);
47
47
  goBack();
@@ -37,7 +37,7 @@ const PasskeyCompleteRecovery = ({ goBack, }) => {
37
37
  wallet,
38
38
  });
39
39
  if (!updatedUser) {
40
- throw new DynamicError('Error completing passkey recovery');
40
+ throw new DynamicError('Error completing passkey recovery', 'completing_passkey_recovery');
41
41
  }
42
42
  dynamicEvents.emit('passkeyRecoveryCompleted', primaryWallet);
43
43
  goBack();
@@ -39,7 +39,7 @@ const createEmbeddedWalletRequest = (_a) => _tslib.__awaiter(void 0, [_a], void
39
39
  throw new utils.InvalidPrimaryWalletOrConnectorError();
40
40
  }
41
41
  if (!user) {
42
- throw new utils.DynamicError('User is not defined');
42
+ throw new utils.DynamicError('User is not defined', 'user_is_not_defined');
43
43
  }
44
44
  walletConnector.setEmail(user.email);
45
45
  let authenticatorBody;
@@ -58,12 +58,12 @@ const createEmbeddedWalletRequest = (_a) => _tslib.__awaiter(void 0, [_a], void
58
58
  environmentId,
59
59
  sessionPublicKey }, authenticatorBody));
60
60
  if (!updatedUser) {
61
- throw new utils.DynamicError('Failed to create embedded wallet');
61
+ throw new utils.DynamicError('Failed to create embedded wallet', 'create_embedded_wallet');
62
62
  }
63
63
  const primaryChain = walletConnector.connectedChain;
64
64
  const embeddedWalletVerifiedCredential = findEmbeddedWalletFromVerifiedCredentials.findEmbeddedWalletFromVerifiedCredentials(updatedUser, [primaryChain]);
65
65
  if (!embeddedWalletVerifiedCredential) {
66
- throw new utils.DynamicError('EmbeddedWalletVerifiedCredential not found');
66
+ throw new utils.DynamicError('EmbeddedWalletVerifiedCredential not found', 'embeddedwalletverifiedcredential_not_found');
67
67
  }
68
68
  walletConnector.setVerifiedCredentials(updatedUser.verifiedCredentials);
69
69
  return {
@@ -35,7 +35,7 @@ const createEmbeddedWalletRequest = (_a) => __awaiter(void 0, [_a], void 0, func
35
35
  throw new InvalidPrimaryWalletOrConnectorError();
36
36
  }
37
37
  if (!user) {
38
- throw new DynamicError('User is not defined');
38
+ throw new DynamicError('User is not defined', 'user_is_not_defined');
39
39
  }
40
40
  walletConnector.setEmail(user.email);
41
41
  let authenticatorBody;
@@ -54,12 +54,12 @@ const createEmbeddedWalletRequest = (_a) => __awaiter(void 0, [_a], void 0, func
54
54
  environmentId,
55
55
  sessionPublicKey }, authenticatorBody));
56
56
  if (!updatedUser) {
57
- throw new DynamicError('Failed to create embedded wallet');
57
+ throw new DynamicError('Failed to create embedded wallet', 'create_embedded_wallet');
58
58
  }
59
59
  const primaryChain = walletConnector.connectedChain;
60
60
  const embeddedWalletVerifiedCredential = findEmbeddedWalletFromVerifiedCredentials(updatedUser, [primaryChain]);
61
61
  if (!embeddedWalletVerifiedCredential) {
62
- throw new DynamicError('EmbeddedWalletVerifiedCredential not found');
62
+ throw new DynamicError('EmbeddedWalletVerifiedCredential not found', 'embeddedwalletverifiedcredential_not_found');
63
63
  }
64
64
  walletConnector.setVerifiedCredentials(updatedUser.verifiedCredentials);
65
65
  return {
@@ -41,7 +41,7 @@ var constants = require('../../PasskeyRecovery/constants.cjs');
41
41
  const initEmbeddedWalletSession = (_a) => _tslib.__awaiter(void 0, [_a], void 0, function* ({ authenticatorType, iframeContainer, iframeElementId, environmentId, user, wallet, sessionExpiration, }) {
42
42
  var _b;
43
43
  if (!user) {
44
- throw new utils.DynamicError(errors.USER_NOT_LOGGED_IN);
44
+ throw new utils.DynamicError(errors.USER_NOT_LOGGED_IN, 'user_not_logged_in');
45
45
  }
46
46
  if (!(wallet === null || wallet === void 0 ? void 0 : wallet.connector) ||
47
47
  !(wallet === null || wallet === void 0 ? void 0 : wallet.id) ||
@@ -59,7 +59,7 @@ const initEmbeddedWalletSession = (_a) => _tslib.__awaiter(void 0, [_a], void 0,
59
59
  }
60
60
  const publicKey = yield turnkeyRecoveryHandler.initRecovery(authenticatorType, iframeContainer, iframeElementId, sessionExpiration);
61
61
  if (!publicKey) {
62
- throw new utils.DynamicError('Something went wrong');
62
+ throw new utils.DynamicError('Something went wrong', 'recovery_init_failed');
63
63
  }
64
64
  const response = yield embeddedWallets.initEmbeddedWalletSession({
65
65
  authenticatorType,
@@ -76,7 +76,7 @@ const initEmbeddedWalletSession = (_a) => _tslib.__awaiter(void 0, [_a], void 0,
76
76
  const passkeyRecoveryBundleValidation = (_c) => _tslib.__awaiter(void 0, [_c], void 0, function* ({ user, bundleInput, wallet, }) {
77
77
  var _d, _e, _f, _g, _h;
78
78
  if (!bundleInput) {
79
- throw new utils.DynamicError('Code must be informed');
79
+ throw new utils.DynamicError('Code must be informed', 'code_must_be_informed');
80
80
  }
81
81
  if (!(wallet === null || wallet === void 0 ? void 0 : wallet.connector) ||
82
82
  !(wallet === null || wallet === void 0 ? void 0 : wallet.id) ||
@@ -84,7 +84,7 @@ const passkeyRecoveryBundleValidation = (_c) => _tslib.__awaiter(void 0, [_c], v
84
84
  throw new utils.InvalidPrimaryWalletOrConnectorError();
85
85
  }
86
86
  if (!user) {
87
- throw new utils.DynamicError(errors.USER_NOT_LOGGED_IN);
87
+ throw new utils.DynamicError(errors.USER_NOT_LOGGED_IN, 'user_not_logged_in');
88
88
  }
89
89
  const organizationId = (_g = (_f = (_e = (_d = user.verifiedCredentials) === null || _d === void 0 ? void 0 : _d.find(({ walletName, id }) => (walletName === null || walletName === void 0 ? void 0 : walletName.startsWith('turnkey')) && id === wallet.id)) === null || _e === void 0 ? void 0 : _e.walletProperties) === null || _f === void 0 ? void 0 : _f.turnkeySubOrganizationId) !== null && _g !== void 0 ? _g : undefined;
90
90
  const turnkeyRecoveryHandler = (_h = wallet.connector) === null || _h === void 0 ? void 0 : _h.getAuthenticatorHandler();
@@ -99,7 +99,7 @@ const passkeyRecoveryBundleValidation = (_c) => _tslib.__awaiter(void 0, [_c], v
99
99
  const resentRecoveryEmail = (_j) => _tslib.__awaiter(void 0, [_j], void 0, function* ({ authenticatorType, user, environmentId, wallet, }) {
100
100
  var _k;
101
101
  if (!user) {
102
- throw new utils.DynamicError(errors.USER_NOT_LOGGED_IN);
102
+ throw new utils.DynamicError(errors.USER_NOT_LOGGED_IN, 'user_not_logged_in');
103
103
  }
104
104
  if (!(wallet === null || wallet === void 0 ? void 0 : wallet.connector) ||
105
105
  !(wallet === null || wallet === void 0 ? void 0 : wallet.id) ||
@@ -108,7 +108,7 @@ const resentRecoveryEmail = (_j) => _tslib.__awaiter(void 0, [_j], void 0, funct
108
108
  }
109
109
  const publicKey = (_k = wallet.connector) === null || _k === void 0 ? void 0 : _k.getAuthenticatorHandler().publicKey;
110
110
  if (!publicKey) {
111
- throw new utils.DynamicError('Could not proceed with your request. Please restart the process.');
111
+ throw new utils.DynamicError('Could not proceed with your request. Please restart the process.', 'missing_public_key');
112
112
  }
113
113
  return embeddedWallets.initEmbeddedWalletSession({
114
114
  authenticatorType,
@@ -142,7 +142,7 @@ const addNewPasskeyAuthenticator = (_m) => _tslib.__awaiter(void 0, [_m], void 0
142
142
  const recoverTurnkeyWallet = (_o) => _tslib.__awaiter(void 0, [_o], void 0, function* ({ wallet, user, environmentId, addPasskeyAuthenticator, }) {
143
143
  var _p, _q, _r;
144
144
  if (!user) {
145
- throw new utils.DynamicError(errors.USER_NOT_LOGGED_IN);
145
+ throw new utils.DynamicError(errors.USER_NOT_LOGGED_IN, 'user_not_logged_in');
146
146
  }
147
147
  if (!wallet ||
148
148
  !wallet.connector ||
@@ -154,7 +154,7 @@ const recoverTurnkeyWallet = (_o) => _tslib.__awaiter(void 0, [_o], void 0, func
154
154
  connector.setEmail(user.email);
155
155
  const turnkeySubOrganizationId = (_r = (_q = (_p = user.verifiedCredentials) === null || _p === void 0 ? void 0 : _p.find(({ walletName, id }) => (walletName === null || walletName === void 0 ? void 0 : walletName.startsWith('turnkey')) && id === wallet.id)) === null || _q === void 0 ? void 0 : _q.walletProperties) === null || _r === void 0 ? void 0 : _r.turnkeySubOrganizationId;
156
156
  if (!turnkeySubOrganizationId) {
157
- throw new utils.DynamicError('The authentication token is invalid - turnkeySubOrganizationId is missing');
157
+ throw new utils.DynamicError('The authentication token is invalid - turnkeySubOrganizationId is missing', 'missing_turnkey_sub_organization_id');
158
158
  }
159
159
  const turnkeyRecoveryHandler = wallet.connector.getAuthenticatorHandler();
160
160
  const { attestation, challenge } = yield connector.getWebAuthnAttestation();
@@ -179,12 +179,12 @@ const recoverTurnkeyWallet = (_o) => _tslib.__awaiter(void 0, [_o], void 0, func
179
179
  walletId: wallet.id,
180
180
  });
181
181
  if (!updatedUser) {
182
- throw new utils.DynamicError('No user returned from passkey recovery');
182
+ throw new utils.DynamicError('No user returned from passkey recovery', 'no_user_returned_from_passkey_recovery');
183
183
  }
184
184
  const chain = connector.connectedChain;
185
185
  const embeddedWalletVerifiedCredential = findEmbeddedWalletFromVerifiedCredentials.findEmbeddedWalletFromVerifiedCredentials(updatedUser, [chain]);
186
186
  if (!embeddedWalletVerifiedCredential) {
187
- throw new utils.DynamicError('EmbeddedWalletVerifiedCredential not found');
187
+ throw new utils.DynamicError('EmbeddedWalletVerifiedCredential not found', 'embeddedwalletverifiedcredential_not_found');
188
188
  }
189
189
  connector.setVerifiedCredentials(updatedUser.verifiedCredentials);
190
190
  return {
@@ -213,7 +213,7 @@ const canRestoreEmbeddedWalletSession = (sessionExpirationTime) => {
213
213
  const restoreEmbeddedWalletSession = (_s) => _tslib.__awaiter(void 0, [_s], void 0, function* ({ user, iframeContainer, iframeElementId, wallet, sessionExpiration, }) {
214
214
  var _t, _u, _v, _w, _x;
215
215
  if (!user) {
216
- throw new utils.DynamicError(errors.USER_NOT_LOGGED_IN);
216
+ throw new utils.DynamicError(errors.USER_NOT_LOGGED_IN, 'user_not_logged_in');
217
217
  }
218
218
  if (!(wallet === null || wallet === void 0 ? void 0 : wallet.connector) ||
219
219
  !(wallet === null || wallet === void 0 ? void 0 : wallet.id) ||
@@ -227,7 +227,7 @@ const restoreEmbeddedWalletSession = (_s) => _tslib.__awaiter(void 0, [_s], void
227
227
  }
228
228
  const publicKey = yield turnkeyRecoveryHandler.initRecovery('email', iframeContainer, iframeElementId, sessionExpiration);
229
229
  if (!publicKey) {
230
- throw new utils.DynamicError('Could not open embedded wallet connection communication');
230
+ throw new utils.DynamicError('Could not open embedded wallet connection communication', 'embedded_wallet_connection_failed');
231
231
  }
232
232
  turnkeyRecoveryHandler.recoveryUserId = sessionSettings.userId;
233
233
  const organizationId = (_x = (_w = (_v = (_u = user.verifiedCredentials) === null || _u === void 0 ? void 0 : _u.find(({ walletName, id }) => (walletName === null || walletName === void 0 ? void 0 : walletName.startsWith('turnkey')) && id === wallet.id)) === null || _v === void 0 ? void 0 : _v.walletProperties) === null || _w === void 0 ? void 0 : _w.turnkeySubOrganizationId) !== null && _x !== void 0 ? _x : undefined;
@@ -237,7 +237,7 @@ const restoreEmbeddedWalletSession = (_s) => _tslib.__awaiter(void 0, [_s], void
237
237
  const addEmailRecovery = (_y) => _tslib.__awaiter(void 0, [_y], void 0, function* ({ user: user$1, environmentId, wallet, }) {
238
238
  var _z, _0;
239
239
  if (!(user$1 === null || user$1 === void 0 ? void 0 : user$1.email)) {
240
- throw new utils.DynamicError(errors.USER_NOT_LOGGED_IN);
240
+ throw new utils.DynamicError(errors.USER_NOT_LOGGED_IN, 'user_not_logged_in');
241
241
  }
242
242
  if (!(wallet === null || wallet === void 0 ? void 0 : wallet.connector) ||
243
243
  !(wallet === null || wallet === void 0 ? void 0 : wallet.id) ||
@@ -247,7 +247,7 @@ const addEmailRecovery = (_y) => _tslib.__awaiter(void 0, [_y], void 0, function
247
247
  }
248
248
  const { turnkeySubOrganizationId, turnkeyUserId } = (_0 = (_z = user$1.verifiedCredentials) === null || _z === void 0 ? void 0 : _z.find(({ walletName, id }) => (walletName === null || walletName === void 0 ? void 0 : walletName.startsWith('turnkey')) && id === wallet.id)) === null || _0 === void 0 ? void 0 : _0.walletProperties;
249
249
  if (!turnkeySubOrganizationId || !turnkeyUserId) {
250
- throw new utils.DynamicError('The authentication token is invalid - turnkeySubOrganizationId or turnkeyUserID is missing');
250
+ throw new utils.DynamicError('The authentication token is invalid - turnkeySubOrganizationId or turnkeyUserID is missing', 'missing_turnkey_credentials');
251
251
  }
252
252
  const turnkeyRecoveryHandler = wallet.connector.getAuthenticatorHandler();
253
253
  const { signedRequest } = (yield turnkeyRecoveryHandler.addEmailRecovery({