@dynamic-labs/sdk-react-core 4.91.3 → 4.91.5

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 (136) hide show
  1. package/CHANGELOG.md +17 -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/OnrampContext/OnrampContext.cjs +1 -1
  15. package/src/lib/context/OnrampContext/OnrampContext.js +1 -1
  16. package/src/lib/context/SendBalanceContext/SendBalanceContext.errors.cjs +2 -2
  17. package/src/lib/context/SendBalanceContext/SendBalanceContext.errors.js +2 -2
  18. package/src/lib/context/SocialRedirectContext/hooks/useRedirectSocialHandler/useRedirectSocialHandler.cjs +3 -3
  19. package/src/lib/context/SocialRedirectContext/hooks/useRedirectSocialHandler/useRedirectSocialHandler.js +3 -3
  20. package/src/lib/data/api/email/email.cjs +6 -3
  21. package/src/lib/data/api/email/email.js +6 -3
  22. package/src/lib/data/api/embeddedWallets/embeddedWallets.cjs +5 -5
  23. package/src/lib/data/api/embeddedWallets/embeddedWallets.js +5 -5
  24. package/src/lib/data/api/exchangeAccounts/exchangeAccounts.cjs +3 -3
  25. package/src/lib/data/api/exchangeAccounts/exchangeAccounts.js +3 -3
  26. package/src/lib/data/api/oauth/oauth.cjs +3 -2
  27. package/src/lib/data/api/oauth/oauth.js +3 -2
  28. package/src/lib/data/api/session/session.cjs +3 -3
  29. package/src/lib/data/api/session/session.js +3 -3
  30. package/src/lib/data/api/sms/sms.cjs +4 -1
  31. package/src/lib/data/api/sms/sms.js +4 -1
  32. package/src/lib/data/api/user/user.cjs +4 -4
  33. package/src/lib/data/api/user/user.js +4 -4
  34. package/src/lib/data/api/wallets/wallets.cjs +15 -13
  35. package/src/lib/data/api/wallets/wallets.js +15 -13
  36. package/src/lib/store/state/nonce/nonce.cjs +1 -1
  37. package/src/lib/store/state/nonce/nonce.js +1 -1
  38. package/src/lib/utils/functions/findTurnkeyWallet/findTurnkeyWallet.cjs +24 -0
  39. package/src/lib/utils/functions/findTurnkeyWallet/findTurnkeyWallet.d.ts +3 -1
  40. package/src/lib/utils/functions/findTurnkeyWallet/findTurnkeyWallet.js +23 -1
  41. package/src/lib/utils/functions/findTurnkeyWallet/index.d.ts +1 -1
  42. package/src/lib/utils/functions/generateMessages/index.cjs +3 -3
  43. package/src/lib/utils/functions/generateMessages/index.js +3 -3
  44. package/src/lib/utils/functions/getEmbeddedWalletAuthHandler/getEmbeddedWalletAuthHandler.cjs +1 -1
  45. package/src/lib/utils/functions/getEmbeddedWalletAuthHandler/getEmbeddedWalletAuthHandler.js +1 -1
  46. package/src/lib/utils/functions/getTransactionLink/blockExplorerPatterns.cjs +30 -0
  47. package/src/lib/utils/functions/getTransactionLink/blockExplorerPatterns.d.ts +17 -0
  48. package/src/lib/utils/functions/getTransactionLink/blockExplorerPatterns.js +29 -1
  49. package/src/lib/utils/functions/getTransactionLink/getTransactionLink.cjs +13 -1
  50. package/src/lib/utils/functions/getTransactionLink/getTransactionLink.d.ts +2 -1
  51. package/src/lib/utils/functions/getTransactionLink/getTransactionLink.js +14 -2
  52. package/src/lib/utils/hooks/authenticationHooks/useOtpVerificationRequest/useOtpVerificationRequest.cjs +2 -2
  53. package/src/lib/utils/hooks/authenticationHooks/useOtpVerificationRequest/useOtpVerificationRequest.js +2 -2
  54. package/src/lib/utils/hooks/useAuthenticateConnectedUser/useAuthenticateConnectedUser.cjs +2 -2
  55. package/src/lib/utils/hooks/useAuthenticateConnectedUser/useAuthenticateConnectedUser.js +2 -2
  56. package/src/lib/utils/hooks/useConfirmationPortal/useConfirmationPortal.cjs +1 -1
  57. package/src/lib/utils/hooks/useConfirmationPortal/useConfirmationPortal.js +1 -1
  58. package/src/lib/utils/hooks/useConnectExchangeForFunding/useConnectExchangeForFunding.cjs +1 -1
  59. package/src/lib/utils/hooks/useConnectExchangeForFunding/useConnectExchangeForFunding.js +1 -1
  60. package/src/lib/utils/hooks/useConnectUnifiedForFunding/useConnectUnifiedForFunding.cjs +2 -2
  61. package/src/lib/utils/hooks/useConnectUnifiedForFunding/useConnectUnifiedForFunding.js +2 -2
  62. package/src/lib/utils/hooks/useConnectWallet/HandleConnectWalletRejectionError.cjs +1 -1
  63. package/src/lib/utils/hooks/useConnectWallet/HandleConnectWalletRejectionError.js +1 -1
  64. package/src/lib/utils/hooks/useCreateDynamicEmbeddedWalletMutation/useCreateDynamicEmbeddedWalletMutation.cjs +1 -1
  65. package/src/lib/utils/hooks/useCreateDynamicEmbeddedWalletMutation/useCreateDynamicEmbeddedWalletMutation.js +1 -1
  66. package/src/lib/utils/hooks/useCreateWalletConnectorOptions/utils/errors/ConnectorSetupError.cjs +1 -1
  67. package/src/lib/utils/hooks/useCreateWalletConnectorOptions/utils/errors/ConnectorSetupError.js +1 -1
  68. package/src/lib/utils/hooks/useDynamicWaas/useDynamicWaas.cjs +8 -8
  69. package/src/lib/utils/hooks/useDynamicWaas/useDynamicWaas.js +8 -8
  70. package/src/lib/utils/hooks/useEmbeddedWallet/useEmbeddedWallet.cjs +4 -4
  71. package/src/lib/utils/hooks/useEmbeddedWallet/useEmbeddedWallet.d.ts +3 -1
  72. package/src/lib/utils/hooks/useEmbeddedWallet/useEmbeddedWallet.js +4 -4
  73. package/src/lib/utils/hooks/useEmbeddedWallet/useSecureEnclaveEmbeddedWallet/useSecureEnclaveEmbeddedWallet.cjs +26 -13
  74. package/src/lib/utils/hooks/useEmbeddedWallet/useSecureEnclaveEmbeddedWallet/useSecureEnclaveEmbeddedWallet.d.ts +4 -2
  75. package/src/lib/utils/hooks/useEmbeddedWallet/useSecureEnclaveEmbeddedWallet/useSecureEnclaveEmbeddedWallet.js +28 -15
  76. package/src/lib/utils/hooks/useFundWithWallet/useConnectWalletForFunding/useConnectWalletForFunding.cjs +2 -2
  77. package/src/lib/utils/hooks/useFundWithWallet/useConnectWalletForFunding/useConnectWalletForFunding.js +2 -2
  78. package/src/lib/utils/hooks/useFundingHelpers/useFundingHelpers.cjs +2 -2
  79. package/src/lib/utils/hooks/useFundingHelpers/useFundingHelpers.js +2 -2
  80. package/src/lib/utils/hooks/useGetMfaToken/useGetMfaToken.cjs +1 -1
  81. package/src/lib/utils/hooks/useGetMfaToken/useGetMfaToken.js +1 -1
  82. package/src/lib/utils/hooks/useSignEip7702Authorization/useSignEip7702Authorization.cjs +2 -2
  83. package/src/lib/utils/hooks/useSignEip7702Authorization/useSignEip7702Authorization.js +2 -2
  84. package/src/lib/utils/hooks/useSocialAuth/useSocialAuth.cjs +2 -2
  85. package/src/lib/utils/hooks/useSocialAuth/useSocialAuth.js +2 -2
  86. package/src/lib/utils/hooks/useTransferWallet/useTransferWallet.cjs +2 -2
  87. package/src/lib/utils/hooks/useTransferWallet/useTransferWallet.js +2 -2
  88. package/src/lib/utils/hooks/useUpgradeEmbeddedWallet/useUpgradeEmbeddedWallet.cjs +3 -3
  89. package/src/lib/utils/hooks/useUpgradeEmbeddedWallet/useUpgradeEmbeddedWallet.js +3 -3
  90. package/src/lib/utils/hooks/useUserAuth/useUserAuth.cjs +1 -1
  91. package/src/lib/utils/hooks/useUserAuth/useUserAuth.js +1 -1
  92. package/src/lib/utils/hooks/useUserDataForm/useUserDataForm.cjs +1 -1
  93. package/src/lib/utils/hooks/useUserDataForm/useUserDataForm.js +1 -1
  94. package/src/lib/utils/hooks/useUserUpdateRequest/unlinkUserEmail/unlinkUserEmail.cjs +3 -3
  95. package/src/lib/utils/hooks/useUserUpdateRequest/unlinkUserEmail/unlinkUserEmail.js +3 -3
  96. package/src/lib/utils/hooks/useUserUpdateRequest/useUpdateUserWithModal/useUpdateUserWithModal.cjs +1 -1
  97. package/src/lib/utils/hooks/useUserUpdateRequest/useUpdateUserWithModal/useUpdateUserWithModal.js +1 -1
  98. package/src/lib/utils/hooks/useVerifyWallet/useVerifyWallet.cjs +2 -2
  99. package/src/lib/utils/hooks/useVerifyWallet/useVerifyWallet.js +2 -2
  100. package/src/lib/utils/hooks/useViewSettings/useViewSettings.d.ts +5 -1
  101. package/src/lib/utils/hooks/useWalletConnectors/useWalletConnectors.cjs +1 -1
  102. package/src/lib/utils/hooks/useWalletConnectors/useWalletConnectors.js +1 -1
  103. package/src/lib/utils/hooks/useWalletOptions/useWalletOptions.cjs +1 -1
  104. package/src/lib/utils/hooks/useWalletOptions/useWalletOptions.js +1 -1
  105. package/src/lib/views/BridgeNextWalletConnectionView/BridgeNextWalletConnectionView.cjs +1 -1
  106. package/src/lib/views/BridgeNextWalletConnectionView/BridgeNextWalletConnectionView.js +1 -1
  107. package/src/lib/views/EmbeddedReveal/utils/turnkeyExport/turnkeyExport.cjs +2 -2
  108. package/src/lib/views/EmbeddedReveal/utils/turnkeyExport/turnkeyExport.js +2 -2
  109. package/src/lib/views/EmbeddedReveal/utils/waasExport/waasExport.cjs +2 -2
  110. package/src/lib/views/EmbeddedReveal/utils/waasExport/waasExport.js +2 -2
  111. package/src/lib/views/ExportSharesView/ExportSharesView.cjs +2 -2
  112. package/src/lib/views/ExportSharesView/ExportSharesView.js +2 -2
  113. package/src/lib/views/LoginView/useLoginView/useLoginView.cjs +1 -1
  114. package/src/lib/views/LoginView/useLoginView/useLoginView.js +1 -1
  115. package/src/lib/views/MergeUserAccountsWithSameEmailView/MergeUserAccountsWithSameEmailView.cjs +1 -1
  116. package/src/lib/views/MergeUserAccountsWithSameEmailView/MergeUserAccountsWithSameEmailView.js +1 -1
  117. package/src/lib/views/MfaVerificationView/MfaVerificationView.cjs +2 -2
  118. package/src/lib/views/MfaVerificationView/MfaVerificationView.js +2 -2
  119. package/src/lib/views/Passkey/PasskeyRecovery/BundleValidation/PasskeyBundleRecovery.cjs +1 -1
  120. package/src/lib/views/Passkey/PasskeyRecovery/BundleValidation/PasskeyBundleRecovery.js +1 -1
  121. package/src/lib/views/Passkey/PasskeyRecovery/CompleteRecovery/PasskeyCompleteRecovery.cjs +1 -1
  122. package/src/lib/views/Passkey/PasskeyRecovery/CompleteRecovery/PasskeyCompleteRecovery.js +1 -1
  123. package/src/lib/views/Passkey/utils/createEmbeddedWalletRequest/createEmbeddedWalletRequest.cjs +3 -3
  124. package/src/lib/views/Passkey/utils/createEmbeddedWalletRequest/createEmbeddedWalletRequest.js +3 -3
  125. package/src/lib/views/Passkey/utils/passkeyRecovery/passkeyRecovery.cjs +14 -14
  126. package/src/lib/views/Passkey/utils/passkeyRecovery/passkeyRecovery.js +14 -14
  127. package/src/lib/views/SendBalanceView/SendBalanceView.cjs +2 -2
  128. package/src/lib/views/SendBalanceView/SendBalanceView.js +2 -2
  129. package/src/lib/views/WalletDelegation/WalletDelegationView/WalletDelegationView.cjs +1 -1
  130. package/src/lib/views/WalletDelegation/WalletDelegationView/WalletDelegationView.js +1 -1
  131. package/src/lib/views/WalletUpgradeFlowView/WalletUpgradeFlowView.cjs +1 -1
  132. package/src/lib/views/WalletUpgradeFlowView/WalletUpgradeFlowView.js +1 -1
  133. package/src/lib/widgets/DynamicWidget/views/ChooseWalletFundingMethod/useFundingMethods/getPromptAmountParams/getPromptAmountParams.cjs +1 -1
  134. package/src/lib/widgets/DynamicWidget/views/ChooseWalletFundingMethod/useFundingMethods/getPromptAmountParams/getPromptAmountParams.js +1 -1
  135. package/src/lib/widgets/DynamicWidget/views/ReceiveWalletFunds/utils/useSubmitWalletFunding/useSubmitWalletFunding.cjs +10 -1
  136. package/src/lib/widgets/DynamicWidget/views/ReceiveWalletFunds/utils/useSubmitWalletFunding/useSubmitWalletFunding.js +10 -1
@@ -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 });
@@ -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({
@@ -37,7 +37,7 @@ import { iframeElementId } from '../../PasskeyRecovery/constants.js';
37
37
  const initEmbeddedWalletSession = (_a) => __awaiter(void 0, [_a], void 0, function* ({ authenticatorType, iframeContainer, iframeElementId, environmentId, user, wallet, sessionExpiration, }) {
38
38
  var _b;
39
39
  if (!user) {
40
- throw new DynamicError(USER_NOT_LOGGED_IN);
40
+ throw new DynamicError(USER_NOT_LOGGED_IN, 'user_not_logged_in');
41
41
  }
42
42
  if (!(wallet === null || wallet === void 0 ? void 0 : wallet.connector) ||
43
43
  !(wallet === null || wallet === void 0 ? void 0 : wallet.id) ||
@@ -55,7 +55,7 @@ const initEmbeddedWalletSession = (_a) => __awaiter(void 0, [_a], void 0, functi
55
55
  }
56
56
  const publicKey = yield turnkeyRecoveryHandler.initRecovery(authenticatorType, iframeContainer, iframeElementId, sessionExpiration);
57
57
  if (!publicKey) {
58
- throw new DynamicError('Something went wrong');
58
+ throw new DynamicError('Something went wrong', 'recovery_init_failed');
59
59
  }
60
60
  const response = yield initEmbeddedWalletSession$1({
61
61
  authenticatorType,
@@ -72,7 +72,7 @@ const initEmbeddedWalletSession = (_a) => __awaiter(void 0, [_a], void 0, functi
72
72
  const passkeyRecoveryBundleValidation = (_c) => __awaiter(void 0, [_c], void 0, function* ({ user, bundleInput, wallet, }) {
73
73
  var _d, _e, _f, _g, _h;
74
74
  if (!bundleInput) {
75
- throw new DynamicError('Code must be informed');
75
+ throw new DynamicError('Code must be informed', 'code_must_be_informed');
76
76
  }
77
77
  if (!(wallet === null || wallet === void 0 ? void 0 : wallet.connector) ||
78
78
  !(wallet === null || wallet === void 0 ? void 0 : wallet.id) ||
@@ -80,7 +80,7 @@ const passkeyRecoveryBundleValidation = (_c) => __awaiter(void 0, [_c], void 0,
80
80
  throw new InvalidPrimaryWalletOrConnectorError();
81
81
  }
82
82
  if (!user) {
83
- throw new DynamicError(USER_NOT_LOGGED_IN);
83
+ throw new DynamicError(USER_NOT_LOGGED_IN, 'user_not_logged_in');
84
84
  }
85
85
  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;
86
86
  const turnkeyRecoveryHandler = (_h = wallet.connector) === null || _h === void 0 ? void 0 : _h.getAuthenticatorHandler();
@@ -95,7 +95,7 @@ const passkeyRecoveryBundleValidation = (_c) => __awaiter(void 0, [_c], void 0,
95
95
  const resentRecoveryEmail = (_j) => __awaiter(void 0, [_j], void 0, function* ({ authenticatorType, user, environmentId, wallet, }) {
96
96
  var _k;
97
97
  if (!user) {
98
- throw new DynamicError(USER_NOT_LOGGED_IN);
98
+ throw new DynamicError(USER_NOT_LOGGED_IN, 'user_not_logged_in');
99
99
  }
100
100
  if (!(wallet === null || wallet === void 0 ? void 0 : wallet.connector) ||
101
101
  !(wallet === null || wallet === void 0 ? void 0 : wallet.id) ||
@@ -104,7 +104,7 @@ const resentRecoveryEmail = (_j) => __awaiter(void 0, [_j], void 0, function* ({
104
104
  }
105
105
  const publicKey = (_k = wallet.connector) === null || _k === void 0 ? void 0 : _k.getAuthenticatorHandler().publicKey;
106
106
  if (!publicKey) {
107
- throw new DynamicError('Could not proceed with your request. Please restart the process.');
107
+ throw new DynamicError('Could not proceed with your request. Please restart the process.', 'missing_public_key');
108
108
  }
109
109
  return initEmbeddedWalletSession$1({
110
110
  authenticatorType,
@@ -138,7 +138,7 @@ const addNewPasskeyAuthenticator = (_m) => __awaiter(void 0, [_m], void 0, funct
138
138
  const recoverTurnkeyWallet = (_o) => __awaiter(void 0, [_o], void 0, function* ({ wallet, user, environmentId, addPasskeyAuthenticator, }) {
139
139
  var _p, _q, _r;
140
140
  if (!user) {
141
- throw new DynamicError(USER_NOT_LOGGED_IN);
141
+ throw new DynamicError(USER_NOT_LOGGED_IN, 'user_not_logged_in');
142
142
  }
143
143
  if (!wallet ||
144
144
  !wallet.connector ||
@@ -150,7 +150,7 @@ const recoverTurnkeyWallet = (_o) => __awaiter(void 0, [_o], void 0, function* (
150
150
  connector.setEmail(user.email);
151
151
  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;
152
152
  if (!turnkeySubOrganizationId) {
153
- throw new DynamicError('The authentication token is invalid - turnkeySubOrganizationId is missing');
153
+ throw new DynamicError('The authentication token is invalid - turnkeySubOrganizationId is missing', 'missing_turnkey_sub_organization_id');
154
154
  }
155
155
  const turnkeyRecoveryHandler = wallet.connector.getAuthenticatorHandler();
156
156
  const { attestation, challenge } = yield connector.getWebAuthnAttestation();
@@ -175,12 +175,12 @@ const recoverTurnkeyWallet = (_o) => __awaiter(void 0, [_o], void 0, function* (
175
175
  walletId: wallet.id,
176
176
  });
177
177
  if (!updatedUser) {
178
- throw new DynamicError('No user returned from passkey recovery');
178
+ throw new DynamicError('No user returned from passkey recovery', 'no_user_returned_from_passkey_recovery');
179
179
  }
180
180
  const chain = connector.connectedChain;
181
181
  const embeddedWalletVerifiedCredential = findEmbeddedWalletFromVerifiedCredentials(updatedUser, [chain]);
182
182
  if (!embeddedWalletVerifiedCredential) {
183
- throw new DynamicError('EmbeddedWalletVerifiedCredential not found');
183
+ throw new DynamicError('EmbeddedWalletVerifiedCredential not found', 'embeddedwalletverifiedcredential_not_found');
184
184
  }
185
185
  connector.setVerifiedCredentials(updatedUser.verifiedCredentials);
186
186
  return {
@@ -209,7 +209,7 @@ const canRestoreEmbeddedWalletSession = (sessionExpirationTime) => {
209
209
  const restoreEmbeddedWalletSession = (_s) => __awaiter(void 0, [_s], void 0, function* ({ user, iframeContainer, iframeElementId, wallet, sessionExpiration, }) {
210
210
  var _t, _u, _v, _w, _x;
211
211
  if (!user) {
212
- throw new DynamicError(USER_NOT_LOGGED_IN);
212
+ throw new DynamicError(USER_NOT_LOGGED_IN, 'user_not_logged_in');
213
213
  }
214
214
  if (!(wallet === null || wallet === void 0 ? void 0 : wallet.connector) ||
215
215
  !(wallet === null || wallet === void 0 ? void 0 : wallet.id) ||
@@ -223,7 +223,7 @@ const restoreEmbeddedWalletSession = (_s) => __awaiter(void 0, [_s], void 0, fun
223
223
  }
224
224
  const publicKey = yield turnkeyRecoveryHandler.initRecovery('email', iframeContainer, iframeElementId, sessionExpiration);
225
225
  if (!publicKey) {
226
- throw new DynamicError('Could not open embedded wallet connection communication');
226
+ throw new DynamicError('Could not open embedded wallet connection communication', 'embedded_wallet_connection_failed');
227
227
  }
228
228
  turnkeyRecoveryHandler.recoveryUserId = sessionSettings.userId;
229
229
  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;
@@ -233,7 +233,7 @@ const restoreEmbeddedWalletSession = (_s) => __awaiter(void 0, [_s], void 0, fun
233
233
  const addEmailRecovery = (_y) => __awaiter(void 0, [_y], void 0, function* ({ user, environmentId, wallet, }) {
234
234
  var _z, _0;
235
235
  if (!(user === null || user === void 0 ? void 0 : user.email)) {
236
- throw new DynamicError(USER_NOT_LOGGED_IN);
236
+ throw new DynamicError(USER_NOT_LOGGED_IN, 'user_not_logged_in');
237
237
  }
238
238
  if (!(wallet === null || wallet === void 0 ? void 0 : wallet.connector) ||
239
239
  !(wallet === null || wallet === void 0 ? void 0 : wallet.id) ||
@@ -243,7 +243,7 @@ const addEmailRecovery = (_y) => __awaiter(void 0, [_y], void 0, function* ({ us
243
243
  }
244
244
  const { turnkeySubOrganizationId, turnkeyUserId } = (_0 = (_z = user.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;
245
245
  if (!turnkeySubOrganizationId || !turnkeyUserId) {
246
- throw new DynamicError('The authentication token is invalid - turnkeySubOrganizationId or turnkeyUserID is missing');
246
+ throw new DynamicError('The authentication token is invalid - turnkeySubOrganizationId or turnkeyUserID is missing', 'missing_turnkey_credentials');
247
247
  }
248
248
  const turnkeyRecoveryHandler = wallet.connector.getAuthenticatorHandler();
249
249
  const { signedRequest } = (yield turnkeyRecoveryHandler.addEmailRecovery({
@@ -167,10 +167,10 @@ const SendBalanceView = ({ initialRecipientAddress = '', initialValue, onClickBa
167
167
  includeNativeBalance: true,
168
168
  });
169
169
  if (!primaryWallet) {
170
- throw new utils.DynamicError('Primary wallet is not available, send balance cannot be displayed');
170
+ throw new utils.DynamicError('Primary wallet is not available, send balance cannot be displayed', 'no_primary_wallet');
171
171
  }
172
172
  if (walletConnector && !walletConnectorCore.isSendBalanceWalletConnector(walletConnector)) {
173
- throw new utils.DynamicError('Primary wallet is not eligible for this operation. It must implement ISendBalanceWalletConnector');
173
+ throw new utils.DynamicError('Primary wallet is not eligible for this operation. It must implement ISendBalanceWalletConnector', 'invalid_wallet_connector');
174
174
  }
175
175
  const [transaction, setTransaction] = React.useState(null);
176
176
  React.useEffect(() => {
@@ -163,10 +163,10 @@ const SendBalanceView = ({ initialRecipientAddress = '', initialValue, onClickBa
163
163
  includeNativeBalance: true,
164
164
  });
165
165
  if (!primaryWallet) {
166
- throw new DynamicError('Primary wallet is not available, send balance cannot be displayed');
166
+ throw new DynamicError('Primary wallet is not available, send balance cannot be displayed', 'no_primary_wallet');
167
167
  }
168
168
  if (walletConnector && !isSendBalanceWalletConnector(walletConnector)) {
169
- throw new DynamicError('Primary wallet is not eligible for this operation. It must implement ISendBalanceWalletConnector');
169
+ throw new DynamicError('Primary wallet is not eligible for this operation. It must implement ISendBalanceWalletConnector', 'invalid_wallet_connector');
170
170
  }
171
171
  const [transaction, setTransaction] = useState(null);
172
172
  useEffect(() => {
@@ -113,7 +113,7 @@ const WalletDelegationView = ({ wallets, }) => {
113
113
  });
114
114
  const { mutate: handleDelegateWallets, isLoading, error, data: isSuccess, } = useMutation.useMutation(() => _tslib.__awaiter(void 0, void 0, void 0, function* () {
115
115
  if (selectedWallets.size === 0) {
116
- throw new utils.DynamicError('No wallets selected for delegation');
116
+ throw new utils.DynamicError('No wallets selected for delegation', 'no_wallets_selected_for_delegation');
117
117
  }
118
118
  const selectedWalletObjects = waasWallets.filter((wallet) => selectedWallets.has(wallet.id));
119
119
  // Prepare delegation array
@@ -109,7 +109,7 @@ const WalletDelegationView = ({ wallets, }) => {
109
109
  });
110
110
  const { mutate: handleDelegateWallets, isLoading, error, data: isSuccess, } = useMutation(() => __awaiter(void 0, void 0, void 0, function* () {
111
111
  if (selectedWallets.size === 0) {
112
- throw new DynamicError('No wallets selected for delegation');
112
+ throw new DynamicError('No wallets selected for delegation', 'no_wallets_selected_for_delegation');
113
113
  }
114
114
  const selectedWalletObjects = waasWallets.filter((wallet) => selectedWallets.has(wallet.id));
115
115
  // Prepare delegation array
@@ -173,7 +173,7 @@ const WalletUpgradeFlowView = ({ wallets, method, onComplete, onCancel, }) => {
173
173
  }, []);
174
174
  const { mutate: handleUpgradeWallet, isLoading: isUpgrading, error: upgradeError, } = useMutation.useMutation(() => _tslib.__awaiter(void 0, void 0, void 0, function* () {
175
175
  if (!privateKeyInput.trim()) {
176
- throw new utils.DynamicError('Private key is required');
176
+ throw new utils.DynamicError('Private key is required', 'private_key_is_required');
177
177
  }
178
178
  yield upgradeToDynamicWaas({
179
179
  privateKey: privateKeyInput.trim(),
@@ -169,7 +169,7 @@ const WalletUpgradeFlowView = ({ wallets, method, onComplete, onCancel, }) => {
169
169
  }, []);
170
170
  const { mutate: handleUpgradeWallet, isLoading: isUpgrading, error: upgradeError, } = useMutation(() => __awaiter(void 0, void 0, void 0, function* () {
171
171
  if (!privateKeyInput.trim()) {
172
- throw new DynamicError('Private key is required');
172
+ throw new DynamicError('Private key is required', 'private_key_is_required');
173
173
  }
174
174
  yield upgradeToDynamicWaas({
175
175
  privateKey: privateKeyInput.trim(),
@@ -38,7 +38,7 @@ const getPromptAmountParams = ({ wallet, }) => {
38
38
  const chainSettings = (_e = (_d = (_c = (_b = (_a = getProjectSettings.getProjectSettings()) === null || _a === void 0 ? void 0 : _a.sdk.funding) === null || _b === void 0 ? void 0 : _b.externalWallets) === null || _c === void 0 ? void 0 : _c.defaultSettings) === null || _d === void 0 ? void 0 : _d.chainSettings) === null || _e === void 0 ? void 0 : _e.find(({ chain }) => chain === walletChain);
39
39
  // This is always supposed to be present, otherwise there's some backend error
40
40
  if (!((_f = chainSettings === null || chainSettings === void 0 ? void 0 : chainSettings.token) === null || _f === void 0 ? void 0 : _f.value) || !((_g = chainSettings === null || chainSettings === void 0 ? void 0 : chainSettings.token) === null || _g === void 0 ? void 0 : _g.rule))
41
- throw new utils.DynamicError(`No wallet funding chain settings found for chain ${walletChain}`);
41
+ throw new utils.DynamicError(`No wallet funding chain settings found for chain ${walletChain}`, 'missing_funding_chain_settings');
42
42
  return {
43
43
  token: {
44
44
  rule: chainSettings.token.rule,
@@ -34,7 +34,7 @@ const getPromptAmountParams = ({ wallet, }) => {
34
34
  const chainSettings = (_e = (_d = (_c = (_b = (_a = getProjectSettings()) === null || _a === void 0 ? void 0 : _a.sdk.funding) === null || _b === void 0 ? void 0 : _b.externalWallets) === null || _c === void 0 ? void 0 : _c.defaultSettings) === null || _d === void 0 ? void 0 : _d.chainSettings) === null || _e === void 0 ? void 0 : _e.find(({ chain }) => chain === walletChain);
35
35
  // This is always supposed to be present, otherwise there's some backend error
36
36
  if (!((_f = chainSettings === null || chainSettings === void 0 ? void 0 : chainSettings.token) === null || _f === void 0 ? void 0 : _f.value) || !((_g = chainSettings === null || chainSettings === void 0 ? void 0 : chainSettings.token) === null || _g === void 0 ? void 0 : _g.rule))
37
- throw new DynamicError(`No wallet funding chain settings found for chain ${walletChain}`);
37
+ throw new DynamicError(`No wallet funding chain settings found for chain ${walletChain}`, 'missing_funding_chain_settings');
38
38
  return {
39
39
  token: {
40
40
  rule: chainSettings.token.rule,