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

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 (58) hide show
  1. package/CHANGELOG.md +36 -0
  2. package/package.cjs +2 -2
  3. package/package.js +2 -2
  4. package/package.json +13 -13
  5. package/src/lib/components/SendBalanceForm/SendBalanceForm.cjs +34 -6
  6. package/src/lib/components/SendBalanceForm/SendBalanceForm.d.ts +2 -1
  7. package/src/lib/components/SendBalanceForm/SendBalanceForm.js +35 -7
  8. package/src/lib/components/SendBalancePageLayout/SendBalancePageLayout.cjs +2 -2
  9. package/src/lib/components/SendBalancePageLayout/SendBalancePageLayout.js +2 -2
  10. package/src/lib/components/SendBalancePageLayout/components/TokensBalanceDropdown/TokensBalanceDropdown.cjs +8 -7
  11. package/src/lib/components/SendBalancePageLayout/components/TokensBalanceDropdown/TokensBalanceDropdown.d.ts +3 -1
  12. package/src/lib/components/SendBalancePageLayout/components/TokensBalanceDropdown/TokensBalanceDropdown.js +8 -7
  13. package/src/lib/context/ErrorContext/ErrorContext.cjs +48 -28
  14. package/src/lib/context/ErrorContext/ErrorContext.js +49 -29
  15. package/src/lib/context/OnrampContext/OnrampContext.cjs +20 -15
  16. package/src/lib/context/OnrampContext/OnrampContext.js +20 -15
  17. package/src/lib/data/api/embeddedWallets/embeddedWallets.cjs +15 -14
  18. package/src/lib/data/api/embeddedWallets/embeddedWallets.js +3 -2
  19. package/src/lib/data/api/user/user.cjs +1 -1
  20. package/src/lib/data/api/user/user.js +2 -2
  21. package/src/lib/data/api/utils.cjs +6 -1
  22. package/src/lib/data/api/utils.d.ts +1 -0
  23. package/src/lib/data/api/utils.js +6 -2
  24. package/src/lib/data/api/wallets/wallets.cjs +2 -2
  25. package/src/lib/data/api/wallets/wallets.js +3 -3
  26. package/src/lib/events/auth.d.ts +3 -2
  27. package/src/lib/shared/types/dynamicEventsCallbacks.d.ts +2 -1
  28. package/src/lib/utils/functions/getVerifyArgs/getVerifyArgs.cjs +4 -0
  29. package/src/lib/utils/functions/getVerifyArgs/getVerifyArgs.js +5 -1
  30. package/src/lib/utils/hooks/authenticationHooks/useConnectAndSign/useConnectAndSign.cjs +1 -1
  31. package/src/lib/utils/hooks/authenticationHooks/useConnectAndSign/useConnectAndSign.js +2 -2
  32. package/src/lib/utils/hooks/useDynamicWaas/useDynamicWaas.cjs +21 -3
  33. package/src/lib/utils/hooks/useDynamicWaas/useDynamicWaas.d.ts +7 -0
  34. package/src/lib/utils/hooks/useDynamicWaas/useDynamicWaas.js +21 -3
  35. package/src/lib/utils/hooks/useEmbeddedReveal/useEmbeddedReveal.cjs +5 -3
  36. package/src/lib/utils/hooks/useEmbeddedReveal/useEmbeddedReveal.d.ts +1 -1
  37. package/src/lib/utils/hooks/useEmbeddedReveal/useEmbeddedReveal.js +5 -3
  38. package/src/lib/utils/hooks/useSocialAccounts/useSocialAccounts.cjs +2 -2
  39. package/src/lib/utils/hooks/useSocialAccounts/useSocialAccounts.js +2 -2
  40. package/src/lib/utils/hooks/useSyncEmbeddedWalletFlow/useSyncEmbeddedWalletFlow.cjs +1 -1
  41. package/src/lib/utils/hooks/useSyncEmbeddedWalletFlow/useSyncEmbeddedWalletFlow.js +1 -1
  42. package/src/lib/views/EmailVerification/EmailVerification.cjs +4 -4
  43. package/src/lib/views/EmailVerification/EmailVerification.js +4 -4
  44. package/src/lib/views/EmailWalletOTPVerificationView/EmailWalletOTPVerificationView.cjs +2 -2
  45. package/src/lib/views/EmailWalletOTPVerificationView/EmailWalletOTPVerificationView.js +2 -2
  46. package/src/lib/views/EmbeddedReveal/EmbeddedRevealView/EmbeddedRevealView.cjs +18 -11
  47. package/src/lib/views/EmbeddedReveal/EmbeddedRevealView/EmbeddedRevealView.d.ts +1 -0
  48. package/src/lib/views/EmbeddedReveal/EmbeddedRevealView/EmbeddedRevealView.js +18 -11
  49. package/src/lib/views/LoginView/sections/SocialSignInSection/DynamicSocialSignIn/DynamicSocialSignIn.cjs +2 -2
  50. package/src/lib/views/LoginView/sections/SocialSignInSection/DynamicSocialSignIn/DynamicSocialSignIn.js +2 -2
  51. package/src/lib/views/SmsVerification/useSmsVerification/useSmsVerification.cjs +2 -2
  52. package/src/lib/views/SmsVerification/useSmsVerification/useSmsVerification.js +2 -2
  53. package/src/lib/widgets/DynamicWidget/components/ActiveMidnightWalletBalance/ActiveMidnightWalletBalance.cjs +33 -9
  54. package/src/lib/widgets/DynamicWidget/components/ActiveMidnightWalletBalance/ActiveMidnightWalletBalance.js +33 -9
  55. package/src/lib/widgets/DynamicWidget/views/AccountAndSecuritySettingsView/EmbeddedWalletExportSection/EmbeddedWalletExportSection.cjs +5 -2
  56. package/src/lib/widgets/DynamicWidget/views/AccountAndSecuritySettingsView/EmbeddedWalletExportSection/EmbeddedWalletExportSection.js +5 -2
  57. package/src/lib/widgets/DynamicWidget/views/ExportAndRecoveryView/ExportAndRecoveryView.cjs +3 -1
  58. package/src/lib/widgets/DynamicWidget/views/ExportAndRecoveryView/ExportAndRecoveryView.js +3 -1
@@ -2,7 +2,7 @@
2
2
  import { __awaiter } from '../../../../../_virtual/_tslib.js';
3
3
  import { logger } from '../../../shared/logger.js';
4
4
  import { generateMessages } from '../generateMessages/index.js';
5
- import { consumeNonce } from '../../../store/state/nonce/nonce.js';
5
+ import { getNonce, fetchAndStoreNonce, consumeNonce } from '../../../store/state/nonce/nonce.js';
6
6
 
7
7
  // TODO - This function is doing too much we should split it up.
8
8
  const getVerifyArgs = (_a) => __awaiter(void 0, [_a], void 0, function* ({ walletConnector, walletProvider, environmentId, displaySiweStatement, skipEmptyAccountCheck, siweStatement, publicWalletAddress, signedMessageOverride, messageToSignOverride, }) {
@@ -55,6 +55,10 @@ const getVerifyArgs = (_a) => __awaiter(void 0, [_a], void 0, function* ({ walle
55
55
  });
56
56
  return result;
57
57
  }
58
+ if (!getNonce()) {
59
+ logger.debug('[getVerifyArgs] Nonce missing, attempting to fetch');
60
+ yield fetchAndStoreNonce();
61
+ }
58
62
  const nonce = consumeNonce();
59
63
  // generate message to sign and then initiate signing step to prove ownership
60
64
  const { messageToSign, signedMessage } = yield generateMessages(publicWalletAddress, walletConnector, nonce, environmentId, displaySiweStatement, siweStatement);
@@ -76,7 +76,7 @@ const useConnectAndSign = ({ shouldUpdateWallets = true, shouldCallCallback = tr
76
76
  });
77
77
  const handleWalletVerifyError = (err) => {
78
78
  var _a;
79
- const userCancelled = (err === null || err === void 0 ? void 0 : err.code) === 'user-cancelled';
79
+ const userCancelled = (err === null || err === void 0 ? void 0 : err.code) === utils.SdkErrorCode.USER_CANCELLED;
80
80
  if (!userCancelled)
81
81
  logger.logger.debug(err);
82
82
  instrumentAuthLoginFailed.instrumentAuthLoginFailed(err, {
@@ -1,6 +1,6 @@
1
1
  'use client'
2
2
  import { __awaiter } from '../../../../../../_virtual/_tslib.js';
3
- import { DeferredPromise, StorageService, CustomError, GetAddressCancelledError } from '@dynamic-labs/utils';
3
+ import { DeferredPromise, StorageService, SdkErrorCode, CustomError, GetAddressCancelledError } from '@dynamic-labs/utils';
4
4
  import { isEmailWalletConnector, isEmailOTPWalletConnector, isBloctoConnector, getWalletProvider, isSameAddress } from '@dynamic-labs/wallet-connector-core';
5
5
  import { useCaptchaContext } from '../../../../context/CaptchaContext/CaptchaContext.js';
6
6
  import '../../../../context/DynamicContext/useDynamicContext/useDynamicContext.js';
@@ -72,7 +72,7 @@ const useConnectAndSign = ({ shouldUpdateWallets = true, shouldCallCallback = tr
72
72
  });
73
73
  const handleWalletVerifyError = (err) => {
74
74
  var _a;
75
- const userCancelled = (err === null || err === void 0 ? void 0 : err.code) === 'user-cancelled';
75
+ const userCancelled = (err === null || err === void 0 ? void 0 : err.code) === SdkErrorCode.USER_CANCELLED;
76
76
  if (!userCancelled)
77
77
  logger.debug(err);
78
78
  instrumentAuthLoginFailed(err, {
@@ -454,7 +454,24 @@ const useDynamicWaas = () => {
454
454
  });
455
455
  yield refresh();
456
456
  });
457
- const upgradeToDynamicWaas = React.useCallback((_h) => _tslib.__awaiter(void 0, [_h], void 0, function* ({ privateKey, wallet, password, }) {
457
+ const migrateFromFireblocks = (_h) => _tslib.__awaiter(void 0, [_h], void 0, function* ({ deviceId, jwt, password, storage, expectedAddresses, }) {
458
+ const [chainName] = enabledChainNames !== null && enabledChainNames !== void 0 ? enabledChainNames : [];
459
+ if (!chainName)
460
+ return undefined;
461
+ const walletConnector = getWaasWalletConnector(chainName);
462
+ if (!walletConnector)
463
+ return undefined;
464
+ const result = yield walletConnector.migrateFromFireblocks({
465
+ deviceId,
466
+ expectedAddresses,
467
+ jwt,
468
+ ncwStorage: storage,
469
+ walletPassword: password,
470
+ });
471
+ yield refresh();
472
+ return result;
473
+ });
474
+ const upgradeToDynamicWaas = React.useCallback((_j) => _tslib.__awaiter(void 0, [_j], void 0, function* ({ privateKey, wallet, password, }) {
458
475
  isUpgrading.current = true;
459
476
  if (!wallet) {
460
477
  throw new utils.DynamicError('Wallet to upgrade was not provided');
@@ -534,14 +551,14 @@ const useDynamicWaas = () => {
534
551
  values.VerifiedCredentialNameToChainEnum[cred.chain]);
535
552
  }, [user === null || user === void 0 ? void 0 : user.verifiedCredentials]);
536
553
  const processSignOnWalletSettings = React.useCallback(() => _tslib.__awaiter(void 0, void 0, void 0, function* () {
537
- var _j;
554
+ var _k;
538
555
  if (!(user === null || user === void 0 ? void 0 : user.verifiedCredentials)) {
539
556
  return;
540
557
  }
541
558
  const waasWallets = user.verifiedCredentials.filter((vc) => { var _a; return vc.walletName === 'dynamicwaas' && ((_a = vc.walletProperties) === null || _a === void 0 ? void 0 : _a.settings); });
542
559
  for (const wallet of waasWallets) {
543
560
  try {
544
- const settings = (_j = wallet.walletProperties) === null || _j === void 0 ? void 0 : _j.settings;
561
+ const settings = (_k = wallet.walletProperties) === null || _k === void 0 ? void 0 : _k.settings;
545
562
  const { address, chain } = wallet;
546
563
  if (!settings || !address || !chain) {
547
564
  continue;
@@ -612,6 +629,7 @@ const useDynamicWaas = () => {
612
629
  getWaasWalletsByCredentials,
613
630
  importPrivateKey,
614
631
  initializeWaas,
632
+ migrateFromFireblocks,
615
633
  needsAutoCreateWalletChains,
616
634
  needsSettingsProcessing,
617
635
  processSignOnWalletSettings,
@@ -54,6 +54,13 @@ export declare const useDynamicWaas: () => {
54
54
  initializeWaas: ({ forceClientRebuild, }?: {
55
55
  forceClientRebuild?: boolean;
56
56
  }) => Promise<void>;
57
+ migrateFromFireblocks: ({ deviceId, jwt, password, storage, expectedAddresses, }: {
58
+ deviceId: string;
59
+ jwt: string;
60
+ password: string;
61
+ storage: Record<string, string>;
62
+ expectedAddresses: Record<string, string>;
63
+ }) => Promise<import("@dynamic-labs-wallet/browser-wallet-client").MigrateFromFireblocksResponse | undefined>;
57
64
  needsAutoCreateWalletChains: WalletCreationRequirement[];
58
65
  needsSettingsProcessing: boolean;
59
66
  processSignOnWalletSettings: () => Promise<void>;
@@ -450,7 +450,24 @@ const useDynamicWaas = () => {
450
450
  });
451
451
  yield refresh();
452
452
  });
453
- const upgradeToDynamicWaas = useCallback((_h) => __awaiter(void 0, [_h], void 0, function* ({ privateKey, wallet, password, }) {
453
+ const migrateFromFireblocks = (_h) => __awaiter(void 0, [_h], void 0, function* ({ deviceId, jwt, password, storage, expectedAddresses, }) {
454
+ const [chainName] = enabledChainNames !== null && enabledChainNames !== void 0 ? enabledChainNames : [];
455
+ if (!chainName)
456
+ return undefined;
457
+ const walletConnector = getWaasWalletConnector(chainName);
458
+ if (!walletConnector)
459
+ return undefined;
460
+ const result = yield walletConnector.migrateFromFireblocks({
461
+ deviceId,
462
+ expectedAddresses,
463
+ jwt,
464
+ ncwStorage: storage,
465
+ walletPassword: password,
466
+ });
467
+ yield refresh();
468
+ return result;
469
+ });
470
+ const upgradeToDynamicWaas = useCallback((_j) => __awaiter(void 0, [_j], void 0, function* ({ privateKey, wallet, password, }) {
454
471
  isUpgrading.current = true;
455
472
  if (!wallet) {
456
473
  throw new DynamicError('Wallet to upgrade was not provided');
@@ -530,14 +547,14 @@ const useDynamicWaas = () => {
530
547
  VerifiedCredentialNameToChainEnum[cred.chain]);
531
548
  }, [user === null || user === void 0 ? void 0 : user.verifiedCredentials]);
532
549
  const processSignOnWalletSettings = useCallback(() => __awaiter(void 0, void 0, void 0, function* () {
533
- var _j;
550
+ var _k;
534
551
  if (!(user === null || user === void 0 ? void 0 : user.verifiedCredentials)) {
535
552
  return;
536
553
  }
537
554
  const waasWallets = user.verifiedCredentials.filter((vc) => { var _a; return vc.walletName === 'dynamicwaas' && ((_a = vc.walletProperties) === null || _a === void 0 ? void 0 : _a.settings); });
538
555
  for (const wallet of waasWallets) {
539
556
  try {
540
- const settings = (_j = wallet.walletProperties) === null || _j === void 0 ? void 0 : _j.settings;
557
+ const settings = (_k = wallet.walletProperties) === null || _k === void 0 ? void 0 : _k.settings;
541
558
  const { address, chain } = wallet;
542
559
  if (!settings || !address || !chain) {
543
560
  continue;
@@ -608,6 +625,7 @@ const useDynamicWaas = () => {
608
625
  getWaasWalletsByCredentials,
609
626
  importPrivateKey,
610
627
  initializeWaas,
628
+ migrateFromFireblocks,
611
629
  needsAutoCreateWalletChains,
612
630
  needsSettingsProcessing,
613
631
  processSignOnWalletSettings,
@@ -63,9 +63,10 @@ const useEmbeddedReveal = () => {
63
63
  throw new Error('Wallet is non-HD and does not have a recovery phrase');
64
64
  }
65
65
  };
66
- const initExportProcess = React.useCallback((...args_1) => _tslib.__awaiter(void 0, [...args_1], void 0, function* (recoveryPhrase = false, isPromptForExport = false) {
67
- if (!primaryWallet) {
68
- throw new Error('No primary wallet');
66
+ const initExportProcess = React.useCallback((...args_1) => _tslib.__awaiter(void 0, [...args_1], void 0, function* (recoveryPhrase = false, isPromptForExport = false, walletId) {
67
+ const targetWalletId = walletId !== null && walletId !== void 0 ? walletId : primaryWallet === null || primaryWallet === void 0 ? void 0 : primaryWallet.id;
68
+ if (!targetWalletId) {
69
+ throw new Error('No wallet available for export');
69
70
  }
70
71
  if (!user) {
71
72
  throw new Error(errors.USER_NOT_LOGGED_IN);
@@ -83,6 +84,7 @@ const useEmbeddedReveal = () => {
83
84
  pushView('embedded-reveal-view', {
84
85
  exportPrivateKey: !recoveryPhrase,
85
86
  isPromptForExport,
87
+ walletId: targetWalletId,
86
88
  });
87
89
  return new Promise((resolve, reject) => {
88
90
  dynamicEvents.dynamicEvents.once('embeddedWalletRevealCompleted', (wallet) => resolve(wallet));
@@ -1,4 +1,4 @@
1
1
  import { Wallet } from '../../../shared';
2
2
  export declare const useEmbeddedReveal: () => {
3
- readonly initExportProcess: (recoveryPhrase?: boolean, isPromptForExport?: boolean) => Promise<Wallet>;
3
+ readonly initExportProcess: (recoveryPhrase?: boolean, isPromptForExport?: boolean, walletId?: string) => Promise<Wallet>;
4
4
  };
@@ -59,9 +59,10 @@ const useEmbeddedReveal = () => {
59
59
  throw new Error('Wallet is non-HD and does not have a recovery phrase');
60
60
  }
61
61
  };
62
- const initExportProcess = useCallback((...args_1) => __awaiter(void 0, [...args_1], void 0, function* (recoveryPhrase = false, isPromptForExport = false) {
63
- if (!primaryWallet) {
64
- throw new Error('No primary wallet');
62
+ const initExportProcess = useCallback((...args_1) => __awaiter(void 0, [...args_1], void 0, function* (recoveryPhrase = false, isPromptForExport = false, walletId) {
63
+ const targetWalletId = walletId !== null && walletId !== void 0 ? walletId : primaryWallet === null || primaryWallet === void 0 ? void 0 : primaryWallet.id;
64
+ if (!targetWalletId) {
65
+ throw new Error('No wallet available for export');
65
66
  }
66
67
  if (!user) {
67
68
  throw new Error(USER_NOT_LOGGED_IN);
@@ -79,6 +80,7 @@ const useEmbeddedReveal = () => {
79
80
  pushView('embedded-reveal-view', {
80
81
  exportPrivateKey: !recoveryPhrase,
81
82
  isPromptForExport,
83
+ walletId: targetWalletId,
82
84
  });
83
85
  return new Promise((resolve, reject) => {
84
86
  dynamicEvents.once('embeddedWalletRevealCompleted', (wallet) => resolve(wallet));
@@ -7,12 +7,12 @@ var _tslib = require('../../../../../_virtual/_tslib.cjs');
7
7
  var React = require('react');
8
8
  var sdkApiCore = require('@dynamic-labs/sdk-api-core');
9
9
  var types = require('@dynamic-labs/types');
10
+ var utils = require('@dynamic-labs/utils');
10
11
  require('../../../context/DynamicContext/useDynamicContext/useDynamicContext.cjs');
11
12
  var useInternalDynamicContext = require('../../../context/DynamicContext/useDynamicContext/useInternalDynamicContext/useInternalDynamicContext.cjs');
12
13
  var SocialRedirectContext = require('../../../context/SocialRedirectContext/SocialRedirectContext.cjs');
13
14
  var ViewContext = require('../../../context/ViewContext/ViewContext.cjs');
14
15
  require('@dynamic-labs-sdk/client');
15
- require('@dynamic-labs/utils');
16
16
  require('@dynamic-labs-sdk/client/core');
17
17
  require('eventemitter3');
18
18
  require('../../../config/ApiEndpoint.cjs');
@@ -61,7 +61,7 @@ const useSocialAccounts = ({ onError } = {}) => {
61
61
  option: sdkApiCore.ProviderEnum.Farcaster,
62
62
  provider: sdkApiCore.ProviderEnum.Farcaster,
63
63
  type: 'social',
64
- }, 'user-cancelled');
64
+ }, utils.SdkErrorCode.USER_CANCELLED);
65
65
  },
66
66
  }), [pushView, setSocialProvider]);
67
67
  const { handleError, setError, checkValidProvider, error, connectSocialAccount, } = useSocialAuth.useSocialAuth({
@@ -3,12 +3,12 @@ import { __awaiter } from '../../../../../_virtual/_tslib.js';
3
3
  import { useState, useCallback, useMemo } from 'react';
4
4
  import { ProviderEnum } from '@dynamic-labs/sdk-api-core';
5
5
  import { SocialOAuthErrorCode } from '@dynamic-labs/types';
6
+ import { SdkErrorCode } from '@dynamic-labs/utils';
6
7
  import '../../../context/DynamicContext/useDynamicContext/useDynamicContext.js';
7
8
  import { useInternalDynamicContext } from '../../../context/DynamicContext/useDynamicContext/useInternalDynamicContext/useInternalDynamicContext.js';
8
9
  import { useSocialRedirectContext } from '../../../context/SocialRedirectContext/SocialRedirectContext.js';
9
10
  import { useViewContext } from '../../../context/ViewContext/ViewContext.js';
10
11
  import '@dynamic-labs-sdk/client';
11
- import '@dynamic-labs/utils';
12
12
  import '@dynamic-labs-sdk/client/core';
13
13
  import 'eventemitter3';
14
14
  import '../../../config/ApiEndpoint.js';
@@ -57,7 +57,7 @@ const useSocialAccounts = ({ onError } = {}) => {
57
57
  option: ProviderEnum.Farcaster,
58
58
  provider: ProviderEnum.Farcaster,
59
59
  type: 'social',
60
- }, 'user-cancelled');
60
+ }, SdkErrorCode.USER_CANCELLED);
61
61
  },
62
62
  }), [pushView, setSocialProvider]);
63
63
  const { handleError, setError, checkValidProvider, error, connectSocialAccount, } = useSocialAuth({
@@ -95,7 +95,7 @@ const useSyncEmbeddedWalletFlow = () => {
95
95
  primaryWallet) {
96
96
  try {
97
97
  setShowAuthFlow(true);
98
- yield initExportProcess(true, true);
98
+ yield initExportProcess(true, true, primaryWallet.id);
99
99
  }
100
100
  catch (error) {
101
101
  logger.logger.error('Error initializing embedded wallet export', error);
@@ -91,7 +91,7 @@ const useSyncEmbeddedWalletFlow = () => {
91
91
  primaryWallet) {
92
92
  try {
93
93
  setShowAuthFlow(true);
94
- yield initExportProcess(true, true);
94
+ yield initExportProcess(true, true, primaryWallet.id);
95
95
  }
96
96
  catch (error) {
97
97
  logger.error('Error initializing embedded wallet export', error);
@@ -9,9 +9,9 @@ var React = require('react');
9
9
  var reactI18next = require('react-i18next');
10
10
  var sdkApiCore = require('@dynamic-labs/sdk-api-core');
11
11
  var walletConnectorCore = require('@dynamic-labs/wallet-connector-core');
12
+ var utils = require('@dynamic-labs/utils');
12
13
  require('@dynamic-labs-sdk/client/core');
13
14
  require('eventemitter3');
14
- require('@dynamic-labs/utils');
15
15
  require('@dynamic-labs-sdk/client');
16
16
  require('../../config/ApiEndpoint.cjs');
17
17
  require('@dynamic-labs/iconic');
@@ -179,7 +179,7 @@ const EmailVerification = ({ isEmailRecoveryFlow = false, showRetryButton: _show
179
179
  const emailString = email$1 !== null && email$1 !== void 0 ? email$1 : '';
180
180
  dynamicEvents.dynamicEvents.emit('emailVerificationResult', isValidatedRef.current, emailString);
181
181
  if (!isValidatedRef.current)
182
- dynamicEvents.dynamicEvents.emit('authFailure', { email: emailString, option: emailString, type: 'email' }, 'user-cancelled');
182
+ dynamicEvents.dynamicEvents.emit('authFailure', { email: emailString, option: emailString, type: 'email' }, utils.SdkErrorCode.USER_CANCELLED);
183
183
  if (!email$1)
184
184
  logger.logger.warn("WARNING: emitted emailVerificationResult with incomplete params because useVerification's displayedDestination was undefined");
185
185
  });
@@ -358,10 +358,10 @@ const EmailVerification = ({ isEmailRecoveryFlow = false, showRetryButton: _show
358
358
  logger.logger.debug(error);
359
359
  instrumentAuthLoginFailed.instrumentAuthLoginFailed(error, { authOrigin: 'email-verification' });
360
360
  setErrorMessage(error.code, error, 'email-verification');
361
- if (error.code === 'too_many_email_verification_attempts') {
361
+ if (error.code === utils.SdkErrorCode.TOO_MANY_EMAIL_VERIFICATION_ATTEMPTS) {
362
362
  setShowRetryButton(false);
363
363
  }
364
- if (error.code === 'invalid_email_verification') {
364
+ if (error.code === utils.SdkErrorCode.INVALID_EMAIL_VERIFICATION) {
365
365
  clearStackAndPushInitialView();
366
366
  }
367
367
  }
@@ -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) => {
@@ -55,7 +55,7 @@ require('../../../store/state/connectedWalletsInfo/connectedWalletsInfo.cjs');
55
55
  require('../../../utils/functions/getWaasAddressTypeLabel/getWaasAddressTypeLabel.cjs');
56
56
  require('../../../context/AccessDeniedContext/AccessDeniedContext.cjs');
57
57
  require('../../../context/AccountExistsContext/AccountExistsContext.cjs');
58
- require('../../../context/UserWalletsContext/UserWalletsContext.cjs');
58
+ var UserWalletsContext = require('../../../context/UserWalletsContext/UserWalletsContext.cjs');
59
59
  require('../../../store/state/authMode/authMode.cjs');
60
60
  require('../../../store/state/loadingAndLifecycle/loadingAndLifecycle.cjs');
61
61
  require('../../../context/VerificationContext/VerificationContext.cjs');
@@ -66,7 +66,6 @@ require('../../../context/ThemeContext/ThemeContext.cjs');
66
66
  var useSmartWallets = require('../../../utils/hooks/useSmartWallets/useSmartWallets.cjs');
67
67
  require('../../../utils/hooks/useUserUpdateRequest/useUpdateUser/userFieldsSchema.cjs');
68
68
  var useMutation = require('../../../utils/hooks/useMutation/useMutation.cjs');
69
- var useIsTurnkeyWallet = require('../../../utils/hooks/useIsTurnkeyWallet/useIsTurnkeyWallet.cjs');
70
69
  require('bs58');
71
70
  require('@dynamic-labs/types');
72
71
  require('../../../context/SocialRedirectContext/SocialRedirectContext.cjs');
@@ -136,32 +135,40 @@ var useSyncEmbeddedWalletFlow = require('../../../utils/hooks/useSyncEmbeddedWal
136
135
  require('@dynamic-labs/store');
137
136
  require('../../../shared/utils/functions/getInitialUrl/getInitialUrl.cjs');
138
137
 
139
- const EmbeddedRevealView = ({ exportPrivateKey, isPromptForExport = false, }) => {
140
- var _a, _b, _c;
138
+ const EmbeddedRevealView = ({ exportPrivateKey, isPromptForExport = false, walletId, }) => {
139
+ var _a, _b, _c, _d, _e;
141
140
  const { primaryWallet, user, setShowAuthFlow, environmentId } = useInternalDynamicContext.useInternalDynamicContext();
141
+ const { userWallets } = UserWalletsContext.useInternalUserWallets();
142
142
  const { handleAcknowledgeExportPrompt } = useSyncEmbeddedWalletFlow.useSyncEmbeddedWalletFlow();
143
- const { isTurnkeyWallet } = useIsTurnkeyWallet.useIsTurnkeyWallet();
144
143
  const isWaasWallet = Boolean(user === null || user === void 0 ? void 0 : user.verifiedCredentials.find((vc) => { var _a; return (_a = vc.walletName) === null || _a === void 0 ? void 0 : _a.startsWith('dynamicwaas'); }));
145
144
  const { setDynamicWidgetView } = DynamicWidgetContext.useWidgetContext();
146
145
  const { pushView } = ViewContext.useViewContext();
147
146
  const { getEOAWallet, isSmartWallet } = useSmartWallets.useSmartWallets();
148
147
  const [isAcknowledged, setIsAcknowledged] = React.useState(false);
149
148
  const [iframeContainerRef, setIframeContainerRef] = React.useState(null);
150
- if (!primaryWallet) {
149
+ const walletFromId = walletId
150
+ ? userWallets.find((w) => w.id === walletId)
151
+ : undefined;
152
+ if (walletId && !walletFromId) {
153
+ throw new utils.DynamicError('Wallet not found. Please try again.', errors.INVALID_WALLET_DATA);
154
+ }
155
+ const targetWallet = walletFromId !== null && walletFromId !== void 0 ? walletFromId : primaryWallet;
156
+ if (!targetWallet) {
151
157
  throw new utils.DynamicError('No primary wallet found', errors.INVALID_WALLET_DATA);
152
158
  }
153
159
  let primaryTurnkeyWalletId;
154
160
  try {
155
- primaryTurnkeyWalletId = getTurnkeyWalletId.getTurnkeyWalletId(primaryWallet.id, (user === null || user === void 0 ? void 0 : user.verifiedCredentials) || []);
161
+ primaryTurnkeyWalletId = getTurnkeyWalletId.getTurnkeyWalletId(targetWallet.id, (user === null || user === void 0 ? void 0 : user.verifiedCredentials) || []);
156
162
  }
157
163
  catch (error) {
158
164
  // waas wallet
159
165
  }
160
166
  const turnkeyCredential = (_a = user === null || user === void 0 ? void 0 : user.verifiedCredentials) === null || _a === void 0 ? void 0 : _a.find(({ walletName, id }) => (walletName === null || walletName === void 0 ? void 0 : walletName.startsWith('turnkey')) && id === primaryTurnkeyWalletId);
161
167
  const walletProperties = turnkeyCredential === null || turnkeyCredential === void 0 ? void 0 : turnkeyCredential.walletProperties;
162
- const walletCredential = (_b = user === null || user === void 0 ? void 0 : user.verifiedCredentials) === null || _b === void 0 ? void 0 : _b.find((cred) => cred.address === primaryWallet.address);
168
+ const walletCredential = (_b = user === null || user === void 0 ? void 0 : user.verifiedCredentials) === null || _b === void 0 ? void 0 : _b.find((cred) => cred.address === targetWallet.address);
163
169
  const isTurnkeyHDWallet = walletProperties === null || walletProperties === void 0 ? void 0 : walletProperties.turnkeyHDWalletId;
164
- const wallet = (_c = (primaryWallet && getEOAWallet(primaryWallet))) !== null && _c !== void 0 ? _c : primaryWallet;
170
+ const wallet = (_c = (targetWallet && getEOAWallet(targetWallet))) !== null && _c !== void 0 ? _c : targetWallet;
171
+ const isTurnkeyWallet = Boolean((_e = (_d = wallet === null || wallet === void 0 ? void 0 : wallet.connector) === null || _d === void 0 ? void 0 : _d.key) === null || _e === void 0 ? void 0 : _e.startsWith('turnkey'));
165
172
  // eslint-disable-next-line arrow-body-style
166
173
  React.useEffect(() => {
167
174
  return () => {
@@ -252,8 +259,8 @@ const EmbeddedRevealView = ({ exportPrivateKey, isPromptForExport = false, }) =>
252
259
  }
253
260
  return baseClass;
254
261
  };
255
- const isEip7702SmartWallet = Boolean(primaryWallet === null || primaryWallet === void 0 ? void 0 : primaryWallet.id.endsWith('-zerodev'));
256
- const isErc4337SmartWallet = Boolean(primaryWallet && isSmartWallet(primaryWallet)) &&
262
+ const isEip7702SmartWallet = Boolean(targetWallet === null || targetWallet === void 0 ? void 0 : targetWallet.id.endsWith('-zerodev'));
263
+ const isErc4337SmartWallet = Boolean(targetWallet && isSmartWallet(targetWallet)) &&
257
264
  !isEip7702SmartWallet;
258
265
  const shouldShowAaWarning = isErc4337SmartWallet && !isLoading && Boolean(data) && !error;
259
266
  const aaWarning = shouldShowAaWarning && (jsxRuntime.jsxs("div", { className: 'embedded-reveal-view__zerodev-warning', children: [jsxRuntime.jsxs("div", { className: 'embedded-reveal-view__zerodev-warning__title-row', children: [jsxRuntime.jsx(info.ReactComponent, { className: 'embedded-reveal-view__zerodev-warning__icon' }), jsxRuntime.jsx(Typography.Typography, { variant: 'body_normal', weight: 'bold', copykey: 'dyn_embedded_reveal.aa_warning.title', children: t('dyn_embedded_reveal.aa_warning.title') })] }), jsxRuntime.jsxs(Typography.Typography, { variant: 'body_normal', weight: 'regular', copykey: 'dyn_embedded_reveal.aa_warning.subtitle', children: [t('dyn_embedded_reveal.aa_warning.subtitle'), jsxRuntime.jsx("button", { onClick: () => {
@@ -2,5 +2,6 @@ import { FC } from 'react';
2
2
  export type EmbeddedRevealViewProps = {
3
3
  exportPrivateKey?: boolean;
4
4
  isPromptForExport?: boolean;
5
+ walletId?: string;
5
6
  };
6
7
  export declare const EmbeddedRevealView: FC<EmbeddedRevealViewProps>;
@@ -51,7 +51,7 @@ import '../../../store/state/connectedWalletsInfo/connectedWalletsInfo.js';
51
51
  import '../../../utils/functions/getWaasAddressTypeLabel/getWaasAddressTypeLabel.js';
52
52
  import '../../../context/AccessDeniedContext/AccessDeniedContext.js';
53
53
  import '../../../context/AccountExistsContext/AccountExistsContext.js';
54
- import '../../../context/UserWalletsContext/UserWalletsContext.js';
54
+ import { useInternalUserWallets } from '../../../context/UserWalletsContext/UserWalletsContext.js';
55
55
  import '../../../store/state/authMode/authMode.js';
56
56
  import '../../../store/state/loadingAndLifecycle/loadingAndLifecycle.js';
57
57
  import '../../../context/VerificationContext/VerificationContext.js';
@@ -62,7 +62,6 @@ import '../../../context/ThemeContext/ThemeContext.js';
62
62
  import { useSmartWallets } from '../../../utils/hooks/useSmartWallets/useSmartWallets.js';
63
63
  import '../../../utils/hooks/useUserUpdateRequest/useUpdateUser/userFieldsSchema.js';
64
64
  import { useMutation } from '../../../utils/hooks/useMutation/useMutation.js';
65
- import { useIsTurnkeyWallet } from '../../../utils/hooks/useIsTurnkeyWallet/useIsTurnkeyWallet.js';
66
65
  import 'bs58';
67
66
  import '@dynamic-labs/types';
68
67
  import '../../../context/SocialRedirectContext/SocialRedirectContext.js';
@@ -132,32 +131,40 @@ import { useSyncEmbeddedWalletFlow } from '../../../utils/hooks/useSyncEmbeddedW
132
131
  import '@dynamic-labs/store';
133
132
  import '../../../shared/utils/functions/getInitialUrl/getInitialUrl.js';
134
133
 
135
- const EmbeddedRevealView = ({ exportPrivateKey, isPromptForExport = false, }) => {
136
- var _a, _b, _c;
134
+ const EmbeddedRevealView = ({ exportPrivateKey, isPromptForExport = false, walletId, }) => {
135
+ var _a, _b, _c, _d, _e;
137
136
  const { primaryWallet, user, setShowAuthFlow, environmentId } = useInternalDynamicContext();
137
+ const { userWallets } = useInternalUserWallets();
138
138
  const { handleAcknowledgeExportPrompt } = useSyncEmbeddedWalletFlow();
139
- const { isTurnkeyWallet } = useIsTurnkeyWallet();
140
139
  const isWaasWallet = Boolean(user === null || user === void 0 ? void 0 : user.verifiedCredentials.find((vc) => { var _a; return (_a = vc.walletName) === null || _a === void 0 ? void 0 : _a.startsWith('dynamicwaas'); }));
141
140
  const { setDynamicWidgetView } = useWidgetContext();
142
141
  const { pushView } = useViewContext();
143
142
  const { getEOAWallet, isSmartWallet } = useSmartWallets();
144
143
  const [isAcknowledged, setIsAcknowledged] = useState(false);
145
144
  const [iframeContainerRef, setIframeContainerRef] = useState(null);
146
- if (!primaryWallet) {
145
+ const walletFromId = walletId
146
+ ? userWallets.find((w) => w.id === walletId)
147
+ : undefined;
148
+ if (walletId && !walletFromId) {
149
+ throw new DynamicError('Wallet not found. Please try again.', INVALID_WALLET_DATA);
150
+ }
151
+ const targetWallet = walletFromId !== null && walletFromId !== void 0 ? walletFromId : primaryWallet;
152
+ if (!targetWallet) {
147
153
  throw new DynamicError('No primary wallet found', INVALID_WALLET_DATA);
148
154
  }
149
155
  let primaryTurnkeyWalletId;
150
156
  try {
151
- primaryTurnkeyWalletId = getTurnkeyWalletId(primaryWallet.id, (user === null || user === void 0 ? void 0 : user.verifiedCredentials) || []);
157
+ primaryTurnkeyWalletId = getTurnkeyWalletId(targetWallet.id, (user === null || user === void 0 ? void 0 : user.verifiedCredentials) || []);
152
158
  }
153
159
  catch (error) {
154
160
  // waas wallet
155
161
  }
156
162
  const turnkeyCredential = (_a = user === null || user === void 0 ? void 0 : user.verifiedCredentials) === null || _a === void 0 ? void 0 : _a.find(({ walletName, id }) => (walletName === null || walletName === void 0 ? void 0 : walletName.startsWith('turnkey')) && id === primaryTurnkeyWalletId);
157
163
  const walletProperties = turnkeyCredential === null || turnkeyCredential === void 0 ? void 0 : turnkeyCredential.walletProperties;
158
- const walletCredential = (_b = user === null || user === void 0 ? void 0 : user.verifiedCredentials) === null || _b === void 0 ? void 0 : _b.find((cred) => cred.address === primaryWallet.address);
164
+ const walletCredential = (_b = user === null || user === void 0 ? void 0 : user.verifiedCredentials) === null || _b === void 0 ? void 0 : _b.find((cred) => cred.address === targetWallet.address);
159
165
  const isTurnkeyHDWallet = walletProperties === null || walletProperties === void 0 ? void 0 : walletProperties.turnkeyHDWalletId;
160
- const wallet = (_c = (primaryWallet && getEOAWallet(primaryWallet))) !== null && _c !== void 0 ? _c : primaryWallet;
166
+ const wallet = (_c = (targetWallet && getEOAWallet(targetWallet))) !== null && _c !== void 0 ? _c : targetWallet;
167
+ const isTurnkeyWallet = Boolean((_e = (_d = wallet === null || wallet === void 0 ? void 0 : wallet.connector) === null || _d === void 0 ? void 0 : _d.key) === null || _e === void 0 ? void 0 : _e.startsWith('turnkey'));
161
168
  // eslint-disable-next-line arrow-body-style
162
169
  useEffect(() => {
163
170
  return () => {
@@ -248,8 +255,8 @@ const EmbeddedRevealView = ({ exportPrivateKey, isPromptForExport = false, }) =>
248
255
  }
249
256
  return baseClass;
250
257
  };
251
- const isEip7702SmartWallet = Boolean(primaryWallet === null || primaryWallet === void 0 ? void 0 : primaryWallet.id.endsWith('-zerodev'));
252
- const isErc4337SmartWallet = Boolean(primaryWallet && isSmartWallet(primaryWallet)) &&
258
+ const isEip7702SmartWallet = Boolean(targetWallet === null || targetWallet === void 0 ? void 0 : targetWallet.id.endsWith('-zerodev'));
259
+ const isErc4337SmartWallet = Boolean(targetWallet && isSmartWallet(targetWallet)) &&
253
260
  !isEip7702SmartWallet;
254
261
  const shouldShowAaWarning = isErc4337SmartWallet && !isLoading && Boolean(data) && !error;
255
262
  const aaWarning = shouldShowAaWarning && (jsxs("div", { className: 'embedded-reveal-view__zerodev-warning', children: [jsxs("div", { className: 'embedded-reveal-view__zerodev-warning__title-row', children: [jsx(SvgInfo, { className: 'embedded-reveal-view__zerodev-warning__icon' }), jsx(Typography, { variant: 'body_normal', weight: 'bold', copykey: 'dyn_embedded_reveal.aa_warning.title', children: t('dyn_embedded_reveal.aa_warning.title') })] }), jsxs(Typography, { variant: 'body_normal', weight: 'regular', copykey: 'dyn_embedded_reveal.aa_warning.subtitle', children: [t('dyn_embedded_reveal.aa_warning.subtitle'), jsx("button", { onClick: () => {
@@ -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
  },