@dynamic-labs/sdk-react-core 4.78.0 → 4.79.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (50) hide show
  1. package/CHANGELOG.md +22 -0
  2. package/package.cjs +4 -4
  3. package/package.js +4 -4
  4. package/package.json +15 -15
  5. package/src/index.cjs +9 -1
  6. package/src/index.d.ts +2 -1
  7. package/src/index.js +4 -1
  8. package/src/lib/context/ErrorContext/ErrorContext.cjs +2 -2
  9. package/src/lib/context/ErrorContext/ErrorContext.d.ts +1 -1
  10. package/src/lib/context/ErrorContext/ErrorContext.js +2 -2
  11. package/src/lib/context/PhantomRedirectContext/useResponseHandlers.cjs +3 -1
  12. package/src/lib/context/PhantomRedirectContext/useResponseHandlers.js +3 -1
  13. package/src/lib/context/SocialRedirectContext/SocialRedirectContext.cjs +7 -6
  14. package/src/lib/context/SocialRedirectContext/SocialRedirectContext.js +7 -6
  15. package/src/lib/shared/utils/functions/index.d.ts +1 -0
  16. package/src/lib/shared/utils/functions/instrumentAuthLoginFailed/index.d.ts +2 -0
  17. package/src/lib/shared/utils/functions/instrumentAuthLoginFailed/instrumentAuthLoginFailed.cjs +17 -0
  18. package/src/lib/shared/utils/functions/instrumentAuthLoginFailed/instrumentAuthLoginFailed.d.ts +7 -0
  19. package/src/lib/shared/utils/functions/instrumentAuthLoginFailed/instrumentAuthLoginFailed.js +13 -0
  20. package/src/lib/utils/hooks/authenticationHooks/useConnectAndSign/useConnectAndSign.cjs +10 -1
  21. package/src/lib/utils/hooks/authenticationHooks/useConnectAndSign/useConnectAndSign.js +10 -1
  22. package/src/lib/utils/hooks/authenticationHooks/useConnectAndSignSplitSteps/useConnectAndSignSplitSteps.cjs +5 -1
  23. package/src/lib/utils/hooks/authenticationHooks/useConnectAndSignSplitSteps/useConnectAndSignSplitSteps.js +5 -1
  24. package/src/lib/utils/hooks/authenticationHooks/useSignConnectOnlyUser/useSignConnectOnlyUser.cjs +5 -1
  25. package/src/lib/utils/hooks/authenticationHooks/useSignConnectOnlyUser/useSignConnectOnlyUser.js +5 -1
  26. package/src/lib/utils/hooks/index.d.ts +3 -2
  27. package/src/lib/utils/hooks/useGoogleDriveBackupReadiness/index.d.ts +1 -0
  28. package/src/lib/utils/hooks/useGoogleDriveBackupReadiness/useGoogleDriveBackupReadiness.cjs +222 -0
  29. package/src/lib/utils/hooks/useGoogleDriveBackupReadiness/useGoogleDriveBackupReadiness.d.ts +85 -0
  30. package/src/lib/utils/hooks/useGoogleDriveBackupReadiness/useGoogleDriveBackupReadiness.js +218 -0
  31. package/src/lib/utils/hooks/useSocialAuth/useSocialAuth.cjs +6 -2
  32. package/src/lib/utils/hooks/useSocialAuth/useSocialAuth.js +6 -2
  33. package/src/lib/utils/hooks/useUserAuth/useUserAuth.cjs +7 -1
  34. package/src/lib/utils/hooks/useUserAuth/useUserAuth.js +7 -1
  35. package/src/lib/utils/hooks/useVerifyWallet/useVerifyWallet.cjs +6 -2
  36. package/src/lib/utils/hooks/useVerifyWallet/useVerifyWallet.js +6 -2
  37. package/src/lib/utils/hooks/useWalletBackup/googleDriveBackupErrors.cjs +33 -0
  38. package/src/lib/utils/hooks/useWalletBackup/googleDriveBackupErrors.d.ts +8 -0
  39. package/src/lib/utils/hooks/useWalletBackup/googleDriveBackupErrors.js +29 -0
  40. package/src/lib/utils/hooks/useWalletBackup/googleDriveScopes.cjs +22 -0
  41. package/src/lib/utils/hooks/useWalletBackup/googleDriveScopes.d.ts +10 -0
  42. package/src/lib/utils/hooks/useWalletBackup/googleDriveScopes.js +16 -0
  43. package/src/lib/utils/hooks/useWalletBackup/index.d.ts +2 -0
  44. package/src/lib/utils/hooks/useWalletBackup/useWalletBackup.cjs +8 -0
  45. package/src/lib/utils/hooks/useWalletBackup/useWalletBackup.d.ts +2 -0
  46. package/src/lib/utils/hooks/useWalletBackup/useWalletBackup.js +9 -1
  47. package/src/lib/utils/hooks/useWalletItemActions/useHandleWalletItem/useHandleWalletItem.cjs +1 -1
  48. package/src/lib/utils/hooks/useWalletItemActions/useHandleWalletItem/useHandleWalletItem.js +1 -1
  49. package/src/lib/views/EmailVerification/EmailVerification.cjs +3 -1
  50. package/src/lib/views/EmailVerification/EmailVerification.js +3 -1
@@ -15,6 +15,7 @@ import { LAST_USED_WALLET } from '../../constants/localStorage.js';
15
15
  import '../../constants/colors.js';
16
16
  import '../../constants/values.js';
17
17
  import '@dynamic-labs/sdk-api-core';
18
+ import { instrumentAuthLoginFailed } from '../../../shared/utils/functions/instrumentAuthLoginFailed/instrumentAuthLoginFailed.js';
18
19
  import '../../../shared/consts/index.js';
19
20
  import { setAuthMode, getAuthMode } from '../../../store/state/authMode/authMode.js';
20
21
  import { useInternalDynamicContext } from '../../../context/DynamicContext/useDynamicContext/useInternalDynamicContext/useInternalDynamicContext.js';
@@ -286,12 +287,15 @@ const useVerifyWallet = ({ displaySiweStatement, environmentId, projectSettings,
286
287
  handleDisconnectWallet({ walletConnector });
287
288
  clearStackAndPushInitialView();
288
289
  }
289
- logger.error(e);
290
+ instrumentAuthLoginFailed(e, {
291
+ authOrigin: 'wallet-verify',
292
+ provider: walletConnector === null || walletConnector === void 0 ? void 0 : walletConnector.key,
293
+ });
290
294
  if (debugError) {
291
295
  setError(`${e.message}\n ${e.stack}`);
292
296
  }
293
297
  else {
294
- setErrorMessage(e.code);
298
+ setErrorMessage(e.code, e, 'wallet-verify');
295
299
  }
296
300
  };
297
301
  return (_a) => __awaiter(void 0, [_a], void 0, function* ({ walletConnector, getAddressOpts, publicWalletAddress, captchaToken, oauth, signedMessageOverride, messageToSignOverride, requestedScopes, }) {
@@ -0,0 +1,33 @@
1
+ 'use client'
2
+ 'use strict';
3
+
4
+ Object.defineProperty(exports, '__esModule', { value: true });
5
+
6
+ /**
7
+ * Stable phrase the waas-sdk includes in Google Drive 401 / scope-insufficient
8
+ * upload failure messages (see dynamic-waas-sdk
9
+ * packages/browser/src/backup/providers/googleDrive.ts mapGoogleDriveUploadError).
10
+ *
11
+ * We match by `.includes(...)` rather than `.startsWith(...)` because the
12
+ * iframe message-handler fallback path
13
+ * (browser-wallet-client/src/services/iframeMessageHandler.ts:
14
+ * handleIframeMessageResponseError) rewraps the original error as
15
+ * `new Error(String(response.error))`, which prefixes the message with
16
+ * "Error: " and drops the original `isRetryable` field. The phrase remains
17
+ * unique to the auth/scope case across all reasons mapGoogleDriveUploadError
18
+ * produces (rate-limit, storage-full, 5xx, and network all use distinct
19
+ * prefixes), so message-only matching is sufficient to discriminate.
20
+ *
21
+ * TODO: switch to a stable `error.code` once dynamic-waas-sdk attaches one
22
+ * (see DYNT-754 follow-up).
23
+ */
24
+ const ACCESS_DENIED_PHRASE = 'Google Drive access denied';
25
+ /**
26
+ * Type-guard for Google Drive backup failures caused by missing/insufficient
27
+ * OAuth scopes (or otherwise denied access). Recover by re-prompting consent
28
+ * via `linkSocialAccount(ProviderEnum.Google, { forcePopup: true })` and
29
+ * retrying the backup.
30
+ */
31
+ const isInsufficientGoogleDriveScopesError = (err) => err instanceof Error && err.message.includes(ACCESS_DENIED_PHRASE);
32
+
33
+ exports.isInsufficientGoogleDriveScopesError = isInsufficientGoogleDriveScopesError;
@@ -0,0 +1,8 @@
1
+ export type GoogleDriveBackupAccessError = Error;
2
+ /**
3
+ * Type-guard for Google Drive backup failures caused by missing/insufficient
4
+ * OAuth scopes (or otherwise denied access). Recover by re-prompting consent
5
+ * via `linkSocialAccount(ProviderEnum.Google, { forcePopup: true })` and
6
+ * retrying the backup.
7
+ */
8
+ export declare const isInsufficientGoogleDriveScopesError: (err: unknown) => err is Error;
@@ -0,0 +1,29 @@
1
+ 'use client'
2
+ /**
3
+ * Stable phrase the waas-sdk includes in Google Drive 401 / scope-insufficient
4
+ * upload failure messages (see dynamic-waas-sdk
5
+ * packages/browser/src/backup/providers/googleDrive.ts mapGoogleDriveUploadError).
6
+ *
7
+ * We match by `.includes(...)` rather than `.startsWith(...)` because the
8
+ * iframe message-handler fallback path
9
+ * (browser-wallet-client/src/services/iframeMessageHandler.ts:
10
+ * handleIframeMessageResponseError) rewraps the original error as
11
+ * `new Error(String(response.error))`, which prefixes the message with
12
+ * "Error: " and drops the original `isRetryable` field. The phrase remains
13
+ * unique to the auth/scope case across all reasons mapGoogleDriveUploadError
14
+ * produces (rate-limit, storage-full, 5xx, and network all use distinct
15
+ * prefixes), so message-only matching is sufficient to discriminate.
16
+ *
17
+ * TODO: switch to a stable `error.code` once dynamic-waas-sdk attaches one
18
+ * (see DYNT-754 follow-up).
19
+ */
20
+ const ACCESS_DENIED_PHRASE = 'Google Drive access denied';
21
+ /**
22
+ * Type-guard for Google Drive backup failures caused by missing/insufficient
23
+ * OAuth scopes (or otherwise denied access). Recover by re-prompting consent
24
+ * via `linkSocialAccount(ProviderEnum.Google, { forcePopup: true })` and
25
+ * retrying the backup.
26
+ */
27
+ const isInsufficientGoogleDriveScopesError = (err) => err instanceof Error && err.message.includes(ACCESS_DENIED_PHRASE);
28
+
29
+ export { isInsufficientGoogleDriveScopesError };
@@ -0,0 +1,22 @@
1
+ 'use client'
2
+ 'use strict';
3
+
4
+ Object.defineProperty(exports, '__esModule', { value: true });
5
+
6
+ /**
7
+ * OAuth scopes that must be granted on the user's Google account in order
8
+ * for the keyshare backup upload to Google Drive to succeed.
9
+ *
10
+ * Exported so host apps can pre-flight check / display these in their own
11
+ * UX if they want to. Kept as a `readonly` tuple to discourage mutation.
12
+ */
13
+ const GOOGLE_DRIVE_BACKUP_REQUIRED_SCOPES = [
14
+ 'https://www.googleapis.com/auth/drive.appdata',
15
+ 'https://www.googleapis.com/auth/drive.file',
16
+ ];
17
+ const findMissingGoogleDriveBackupScopes = (grantedScopes) => GOOGLE_DRIVE_BACKUP_REQUIRED_SCOPES.filter((required) => !grantedScopes.includes(required));
18
+ const hasAllGoogleDriveBackupScopes = (grantedScopes) => findMissingGoogleDriveBackupScopes(grantedScopes).length === 0;
19
+
20
+ exports.GOOGLE_DRIVE_BACKUP_REQUIRED_SCOPES = GOOGLE_DRIVE_BACKUP_REQUIRED_SCOPES;
21
+ exports.findMissingGoogleDriveBackupScopes = findMissingGoogleDriveBackupScopes;
22
+ exports.hasAllGoogleDriveBackupScopes = hasAllGoogleDriveBackupScopes;
@@ -0,0 +1,10 @@
1
+ /**
2
+ * OAuth scopes that must be granted on the user's Google account in order
3
+ * for the keyshare backup upload to Google Drive to succeed.
4
+ *
5
+ * Exported so host apps can pre-flight check / display these in their own
6
+ * UX if they want to. Kept as a `readonly` tuple to discourage mutation.
7
+ */
8
+ export declare const GOOGLE_DRIVE_BACKUP_REQUIRED_SCOPES: readonly ["https://www.googleapis.com/auth/drive.appdata", "https://www.googleapis.com/auth/drive.file"];
9
+ export declare const findMissingGoogleDriveBackupScopes: (grantedScopes: readonly string[]) => string[];
10
+ export declare const hasAllGoogleDriveBackupScopes: (grantedScopes: readonly string[]) => boolean;
@@ -0,0 +1,16 @@
1
+ 'use client'
2
+ /**
3
+ * OAuth scopes that must be granted on the user's Google account in order
4
+ * for the keyshare backup upload to Google Drive to succeed.
5
+ *
6
+ * Exported so host apps can pre-flight check / display these in their own
7
+ * UX if they want to. Kept as a `readonly` tuple to discourage mutation.
8
+ */
9
+ const GOOGLE_DRIVE_BACKUP_REQUIRED_SCOPES = [
10
+ 'https://www.googleapis.com/auth/drive.appdata',
11
+ 'https://www.googleapis.com/auth/drive.file',
12
+ ];
13
+ const findMissingGoogleDriveBackupScopes = (grantedScopes) => GOOGLE_DRIVE_BACKUP_REQUIRED_SCOPES.filter((required) => !grantedScopes.includes(required));
14
+ const hasAllGoogleDriveBackupScopes = (grantedScopes) => findMissingGoogleDriveBackupScopes(grantedScopes).length === 0;
15
+
16
+ export { GOOGLE_DRIVE_BACKUP_REQUIRED_SCOPES, findMissingGoogleDriveBackupScopes, hasAllGoogleDriveBackupScopes };
@@ -1,2 +1,4 @@
1
1
  export { useWalletBackup, useBackupWallets, useDownloadKeyShares, isWalletBackedUp, type WalletToBackup, type WalletWithBackupStatus, type WalletBackupStatus, type WalletOperationState, } from './useWalletBackup';
2
2
  export { CloudBackupProvider } from './types';
3
+ export { GOOGLE_DRIVE_BACKUP_REQUIRED_SCOPES, findMissingGoogleDriveBackupScopes, hasAllGoogleDriveBackupScopes, } from './googleDriveScopes';
4
+ export { isInsufficientGoogleDriveScopesError, type GoogleDriveBackupAccessError, } from './googleDriveBackupErrors';
@@ -148,6 +148,8 @@ const useWalletBackup = () => {
148
148
  isProcessing: false,
149
149
  totalWallets: 0,
150
150
  });
151
+ const [lastBackupError, setLastBackupError] = React.useState(undefined);
152
+ const clearBackupError = React.useCallback(() => setLastBackupError(undefined), []);
151
153
  const timeoutRef = React.useRef(null);
152
154
  React.useEffect(() => () => {
153
155
  if (timeoutRef.current) {
@@ -234,6 +236,7 @@ const useWalletBackup = () => {
234
236
  }
235
237
  }), [getWaasWalletConnector]);
236
238
  const backupWallet = React.useCallback((walletToBackup_1, ...args_1) => _tslib.__awaiter(void 0, [walletToBackup_1, ...args_1], void 0, function* (walletToBackup, provider = types.CloudBackupProvider.GoogleDrive, displayContainer) {
239
+ setLastBackupError(undefined);
237
240
  try {
238
241
  const waasConnector = getWaasWalletConnector(walletToBackup.chain);
239
242
  if (!waasConnector) {
@@ -259,6 +262,7 @@ const useWalletBackup = () => {
259
262
  address: walletToBackup.address,
260
263
  error,
261
264
  });
265
+ setLastBackupError(error);
262
266
  return false;
263
267
  }
264
268
  }), [getWaasWalletConnector]);
@@ -319,6 +323,7 @@ const useWalletBackup = () => {
319
323
  return true;
320
324
  }, [isGoogleLinked]);
321
325
  const backupToCloudProvider = React.useCallback((options, walletToBackup) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
326
+ setLastBackupError(undefined);
322
327
  try {
323
328
  const { provider, password } = options;
324
329
  const waasConnector = getWaasWalletConnector(walletToBackup.chain);
@@ -344,6 +349,7 @@ const useWalletBackup = () => {
344
349
  }
345
350
  catch (error) {
346
351
  logger.logger.warn('Error backing up to cloud provider', { error, options });
352
+ setLastBackupError(error);
347
353
  return false;
348
354
  }
349
355
  }), [getWaasWalletConnector]);
@@ -355,6 +361,7 @@ const useWalletBackup = () => {
355
361
  backupToCloudProvider,
356
362
  backupWallet,
357
363
  checkICloudAuth,
364
+ clearBackupError,
358
365
  ensureGoogleLinked,
359
366
  ensureProviderLinked,
360
367
  getSupportedProviders,
@@ -364,6 +371,7 @@ const useWalletBackup = () => {
364
371
  initBackupProcess,
365
372
  isGoogleLinked,
366
373
  isProviderLinked,
374
+ lastBackupError,
367
375
  showICloudAuth,
368
376
  startBackup,
369
377
  };
@@ -24,6 +24,7 @@ export declare const useWalletBackup: () => {
24
24
  readonly backupToCloudProvider: (options: CloudProviderBackupOptions, walletToBackup: WalletToBackup) => Promise<boolean>;
25
25
  readonly backupWallet: (walletToBackup: WalletToBackup, provider?: CloudBackupProvider, displayContainer?: HTMLElement) => Promise<boolean>;
26
26
  readonly checkICloudAuth: (walletChain: ChainEnum) => Promise<boolean>;
27
+ readonly clearBackupError: () => void;
27
28
  readonly ensureGoogleLinked: () => Promise<boolean>;
28
29
  readonly ensureProviderLinked: (provider: CloudBackupProvider) => Promise<boolean>;
29
30
  readonly getSupportedProviders: () => import("./cloudProviders").CloudProviderConfigWithIcon[];
@@ -33,6 +34,7 @@ export declare const useWalletBackup: () => {
33
34
  readonly initBackupProcess: () => void;
34
35
  readonly isGoogleLinked: boolean;
35
36
  readonly isProviderLinked: (provider: CloudBackupProvider) => boolean;
37
+ readonly lastBackupError: unknown;
36
38
  readonly showICloudAuth: (displayContainer: HTMLElement, walletChain: ChainEnum) => Promise<boolean>;
37
39
  readonly startBackup: (onComplete?: () => void, fromIndex?: number, provider?: CloudBackupProvider, displayContainer?: HTMLElement) => Promise<void>;
38
40
  };
@@ -1,6 +1,6 @@
1
1
  'use client'
2
2
  import { __awaiter } from '../../../../../_virtual/_tslib.js';
3
- import { useMemo, useState, useRef, useEffect, useCallback } from 'react';
3
+ import { useMemo, useState, useCallback, useRef, useEffect } from 'react';
4
4
  import { WaasBackupOptionsEnum, ProviderEnum } from '@dynamic-labs/sdk-api-core';
5
5
  import '@dynamic-labs-sdk/client/core';
6
6
  import 'eventemitter3';
@@ -144,6 +144,8 @@ const useWalletBackup = () => {
144
144
  isProcessing: false,
145
145
  totalWallets: 0,
146
146
  });
147
+ const [lastBackupError, setLastBackupError] = useState(undefined);
148
+ const clearBackupError = useCallback(() => setLastBackupError(undefined), []);
147
149
  const timeoutRef = useRef(null);
148
150
  useEffect(() => () => {
149
151
  if (timeoutRef.current) {
@@ -230,6 +232,7 @@ const useWalletBackup = () => {
230
232
  }
231
233
  }), [getWaasWalletConnector]);
232
234
  const backupWallet = useCallback((walletToBackup_1, ...args_1) => __awaiter(void 0, [walletToBackup_1, ...args_1], void 0, function* (walletToBackup, provider = CloudBackupProvider.GoogleDrive, displayContainer) {
235
+ setLastBackupError(undefined);
233
236
  try {
234
237
  const waasConnector = getWaasWalletConnector(walletToBackup.chain);
235
238
  if (!waasConnector) {
@@ -255,6 +258,7 @@ const useWalletBackup = () => {
255
258
  address: walletToBackup.address,
256
259
  error,
257
260
  });
261
+ setLastBackupError(error);
258
262
  return false;
259
263
  }
260
264
  }), [getWaasWalletConnector]);
@@ -315,6 +319,7 @@ const useWalletBackup = () => {
315
319
  return true;
316
320
  }, [isGoogleLinked]);
317
321
  const backupToCloudProvider = useCallback((options, walletToBackup) => __awaiter(void 0, void 0, void 0, function* () {
322
+ setLastBackupError(undefined);
318
323
  try {
319
324
  const { provider, password } = options;
320
325
  const waasConnector = getWaasWalletConnector(walletToBackup.chain);
@@ -340,6 +345,7 @@ const useWalletBackup = () => {
340
345
  }
341
346
  catch (error) {
342
347
  logger.warn('Error backing up to cloud provider', { error, options });
348
+ setLastBackupError(error);
343
349
  return false;
344
350
  }
345
351
  }), [getWaasWalletConnector]);
@@ -351,6 +357,7 @@ const useWalletBackup = () => {
351
357
  backupToCloudProvider,
352
358
  backupWallet,
353
359
  checkICloudAuth,
360
+ clearBackupError,
354
361
  ensureGoogleLinked,
355
362
  ensureProviderLinked,
356
363
  getSupportedProviders: getSupportedProviders$1,
@@ -360,6 +367,7 @@ const useWalletBackup = () => {
360
367
  initBackupProcess,
361
368
  isGoogleLinked,
362
369
  isProviderLinked,
370
+ lastBackupError,
363
371
  showICloudAuth,
364
372
  startBackup,
365
373
  };
@@ -283,7 +283,7 @@ const useHandleWalletItem = ({ allowAlreadyConnectedWallet, onQrCodeConnect, onC
283
283
  }
284
284
  catch (error) {
285
285
  if (error instanceof utils.UserRejectedRequestError) {
286
- setErrorMessage('connection_rejected');
286
+ setErrorMessage('connection_rejected', undefined, 'wallet-account-select');
287
287
  clearStackAndPushInitialView();
288
288
  return;
289
289
  }
@@ -279,7 +279,7 @@ const useHandleWalletItem = ({ allowAlreadyConnectedWallet, onQrCodeConnect, onC
279
279
  }
280
280
  catch (error) {
281
281
  if (error instanceof UserRejectedRequestError) {
282
- setErrorMessage('connection_rejected');
282
+ setErrorMessage('connection_rejected', undefined, 'wallet-account-select');
283
283
  clearStackAndPushInitialView();
284
284
  return;
285
285
  }
@@ -22,6 +22,7 @@ var logger = require('../../shared/logger.cjs');
22
22
  require('@dynamic-labs/wallet-book');
23
23
  require('../../utils/constants/colors.cjs');
24
24
  require('../../utils/constants/values.cjs');
25
+ var instrumentAuthLoginFailed = require('../../shared/utils/functions/instrumentAuthLoginFailed/instrumentAuthLoginFailed.cjs');
25
26
  require('../../shared/consts/index.cjs');
26
27
  var findEmbeddedWalletFromVerifiedCredentials = require('../../utils/functions/findEmbeddedWalletFromVerifiedCredentials/findEmbeddedWalletFromVerifiedCredentials.cjs');
27
28
  require('@dynamic-labs/multi-wallet');
@@ -352,7 +353,8 @@ const EmailVerification = ({ isEmailRecoveryFlow = false, showRetryButton: _show
352
353
  }
353
354
  catch (error) {
354
355
  logger.logger.debug(error);
355
- setErrorMessage(error.code);
356
+ instrumentAuthLoginFailed.instrumentAuthLoginFailed(error, { authOrigin: 'email-verification' });
357
+ setErrorMessage(error.code, error, 'email-verification');
356
358
  if (error.code === 'too_many_email_verification_attempts') {
357
359
  setShowRetryButton(false);
358
360
  }
@@ -18,6 +18,7 @@ import { logger } from '../../shared/logger.js';
18
18
  import '@dynamic-labs/wallet-book';
19
19
  import '../../utils/constants/colors.js';
20
20
  import '../../utils/constants/values.js';
21
+ import { instrumentAuthLoginFailed } from '../../shared/utils/functions/instrumentAuthLoginFailed/instrumentAuthLoginFailed.js';
21
22
  import '../../shared/consts/index.js';
22
23
  import { findEmbeddedWalletFromVerifiedCredentials } from '../../utils/functions/findEmbeddedWalletFromVerifiedCredentials/findEmbeddedWalletFromVerifiedCredentials.js';
23
24
  import '@dynamic-labs/multi-wallet';
@@ -348,7 +349,8 @@ const EmailVerification = ({ isEmailRecoveryFlow = false, showRetryButton: _show
348
349
  }
349
350
  catch (error) {
350
351
  logger.debug(error);
351
- setErrorMessage(error.code);
352
+ instrumentAuthLoginFailed(error, { authOrigin: 'email-verification' });
353
+ setErrorMessage(error.code, error, 'email-verification');
352
354
  if (error.code === 'too_many_email_verification_attempts') {
353
355
  setShowRetryButton(false);
354
356
  }