@dynamic-labs/sdk-react-core 4.91.2 → 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 (33) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/package.cjs +1 -1
  3. package/package.js +1 -1
  4. package/package.json +12 -12
  5. package/src/lib/context/ErrorContext/ErrorContext.cjs +48 -28
  6. package/src/lib/context/ErrorContext/ErrorContext.js +49 -29
  7. package/src/lib/context/OnrampContext/OnrampContext.cjs +20 -15
  8. package/src/lib/context/OnrampContext/OnrampContext.js +20 -15
  9. package/src/lib/data/api/embeddedWallets/embeddedWallets.cjs +15 -14
  10. package/src/lib/data/api/embeddedWallets/embeddedWallets.js +3 -2
  11. package/src/lib/data/api/user/user.cjs +1 -1
  12. package/src/lib/data/api/user/user.js +2 -2
  13. package/src/lib/data/api/utils.cjs +6 -1
  14. package/src/lib/data/api/utils.d.ts +1 -0
  15. package/src/lib/data/api/utils.js +6 -2
  16. package/src/lib/data/api/wallets/wallets.cjs +2 -2
  17. package/src/lib/data/api/wallets/wallets.js +3 -3
  18. package/src/lib/events/auth.d.ts +3 -2
  19. package/src/lib/shared/types/dynamicEventsCallbacks.d.ts +2 -1
  20. package/src/lib/utils/functions/getVerifyArgs/getVerifyArgs.cjs +4 -0
  21. package/src/lib/utils/functions/getVerifyArgs/getVerifyArgs.js +5 -1
  22. package/src/lib/utils/hooks/authenticationHooks/useConnectAndSign/useConnectAndSign.cjs +1 -1
  23. package/src/lib/utils/hooks/authenticationHooks/useConnectAndSign/useConnectAndSign.js +2 -2
  24. package/src/lib/utils/hooks/useSocialAccounts/useSocialAccounts.cjs +2 -2
  25. package/src/lib/utils/hooks/useSocialAccounts/useSocialAccounts.js +2 -2
  26. package/src/lib/views/EmailVerification/EmailVerification.cjs +4 -4
  27. package/src/lib/views/EmailVerification/EmailVerification.js +4 -4
  28. package/src/lib/views/EmailWalletOTPVerificationView/EmailWalletOTPVerificationView.cjs +2 -2
  29. package/src/lib/views/EmailWalletOTPVerificationView/EmailWalletOTPVerificationView.js +2 -2
  30. package/src/lib/views/LoginView/sections/SocialSignInSection/DynamicSocialSignIn/DynamicSocialSignIn.cjs +2 -2
  31. package/src/lib/views/LoginView/sections/SocialSignInSection/DynamicSocialSignIn/DynamicSocialSignIn.js +2 -2
  32. package/src/lib/views/SmsVerification/useSmsVerification/useSmsVerification.cjs +2 -2
  33. package/src/lib/views/SmsVerification/useSmsVerification/useSmsVerification.js +2 -2
package/CHANGELOG.md CHANGED
@@ -1,4 +1,16 @@
1
1
 
2
+ ### [4.91.3](https://github.com/dynamic-labs/dynamic-auth/compare/v4.91.2...v4.91.3) (2026-06-30)
3
+
4
+
5
+ ### Bug Fixes
6
+
7
+ * **bitcoin:** detect late-registering wallet-standard wallets (DYNT-1210) ([#11747](https://github.com/dynamic-labs/dynamic-auth/issues/11747)) ([17809f6](https://github.com/dynamic-labs/dynamic-auth/commit/17809f6e811fe101367cc31a2d899a8d0b0d107e))
8
+ * fetch onramp providers lazily instead of eagerly on mount ([#11767](https://github.com/dynamic-labs/dynamic-auth/issues/11767)) ([3ee6708](https://github.com/dynamic-labs/dynamic-auth/commit/3ee67087142ae1942f865e0ab37b7108700b3327))
9
+ * **iframe-setup:** sync parent URL to iframe on pushState/replaceState ([#11751](https://github.com/dynamic-labs/dynamic-auth/issues/11751)) ([c8be3af](https://github.com/dynamic-labs/dynamic-auth/commit/c8be3afc301f77b349f23398bed940ce40f93b73))
10
+ * **nonce:** fetch nonce on demand when missing before wallet verification ([#11753](https://github.com/dynamic-labs/dynamic-auth/issues/11753)) ([4f01a21](https://github.com/dynamic-labs/dynamic-auth/commit/4f01a21b6081c852f32868c8a5e04d70aaf280a2)), closes [#1](https://github.com/dynamic-labs/dynamic-auth/issues/1)
11
+ * **react-native-extension:** arm loading timer before setUrl to cover pre-onLoadStart gap ([#11764](https://github.com/dynamic-labs/dynamic-auth/issues/11764)) ([31f2015](https://github.com/dynamic-labs/dynamic-auth/commit/31f20151a4b59279f9c133b723e50de771b06436))
12
+ * **webview-controller:** unwrap ZeroDev smart wallet for native gasless ([#11758](https://github.com/dynamic-labs/dynamic-auth/issues/11758)) ([989714e](https://github.com/dynamic-labs/dynamic-auth/commit/989714e414556868c8e0c54401aac1ed7354331b))
13
+
2
14
  ### [4.91.2](https://github.com/dynamic-labs/dynamic-auth/compare/v4.91.1...v4.91.2) (2026-06-26)
3
15
 
4
16
 
package/package.cjs CHANGED
@@ -3,7 +3,7 @@
3
3
 
4
4
  Object.defineProperty(exports, '__esModule', { value: true });
5
5
 
6
- var version = "4.91.2";
6
+ var version = "4.91.3";
7
7
  var dependencies = {
8
8
  "@dynamic-labs/sdk-api-core": "0.0.1046",
9
9
  "@dynamic-labs-sdk/client": "1.12.1",
package/package.js CHANGED
@@ -1,5 +1,5 @@
1
1
  'use client'
2
- var version = "4.91.2";
2
+ var version = "4.91.3";
3
3
  var dependencies = {
4
4
  "@dynamic-labs/sdk-api-core": "0.0.1046",
5
5
  "@dynamic-labs-sdk/client": "1.12.1",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dynamic-labs/sdk-react-core",
3
- "version": "4.91.2",
3
+ "version": "4.91.3",
4
4
  "dependencies": {
5
5
  "@dynamic-labs/sdk-api-core": "0.0.1046",
6
6
  "@dynamic-labs-sdk/client": "1.12.1",
@@ -17,17 +17,17 @@
17
17
  "yup": "0.32.11",
18
18
  "react-international-phone": "4.5.0",
19
19
  "bs58": "5.0.0",
20
- "@dynamic-labs/assert-package-version": "4.91.2",
21
- "@dynamic-labs/iconic": "4.91.2",
22
- "@dynamic-labs/locale": "4.91.2",
23
- "@dynamic-labs/logger": "4.91.2",
24
- "@dynamic-labs/multi-wallet": "4.91.2",
25
- "@dynamic-labs/rpc-providers": "4.91.2",
26
- "@dynamic-labs/store": "4.91.2",
27
- "@dynamic-labs/types": "4.91.2",
28
- "@dynamic-labs/utils": "4.91.2",
29
- "@dynamic-labs/wallet-book": "4.91.2",
30
- "@dynamic-labs/wallet-connector-core": "4.91.2",
20
+ "@dynamic-labs/assert-package-version": "4.91.3",
21
+ "@dynamic-labs/iconic": "4.91.3",
22
+ "@dynamic-labs/locale": "4.91.3",
23
+ "@dynamic-labs/logger": "4.91.3",
24
+ "@dynamic-labs/multi-wallet": "4.91.3",
25
+ "@dynamic-labs/rpc-providers": "4.91.3",
26
+ "@dynamic-labs/store": "4.91.3",
27
+ "@dynamic-labs/types": "4.91.3",
28
+ "@dynamic-labs/utils": "4.91.3",
29
+ "@dynamic-labs/wallet-book": "4.91.3",
30
+ "@dynamic-labs/wallet-connector-core": "4.91.3",
31
31
  "eventemitter3": "5.0.1"
32
32
  },
33
33
  "devDependencies": {
@@ -10,30 +10,50 @@ var logger = require('../../shared/logger.cjs');
10
10
  var createProviderHook = require('../../shared/utils/functions/createProviderHook/createProviderHook.cjs');
11
11
 
12
12
  const FALLBACK_ERROR_LOG_EVENT = 'ui.fallback_error_shown';
13
- /** @deprecated Prefer setError with a translation key instead */
14
- const errorMessageMap = {
15
- '-32000': 'Message signature denied',
16
- '-32002': 'Please unlock your wallet extension and try again.',
17
- '-32003': 'Message signature denied.',
18
- '-32602': 'Invalid parameters. Please try again.',
19
- '-32603': 'There was an internal error. Please try again.',
20
- 0: 'Message signature denied.',
21
- 4001: 'Message signature denied.',
22
- 4100: 'Please unlock your wallet extension and try again.',
23
- 4900: 'There was an internal error. Please try again.',
24
- 5001: 'Message signature denied.',
25
- 5002: 'Message signature denied.',
26
- account_already_linked_to_different_profile: 'This social account is already linked to a different profile.',
27
- connection_rejected: 'Connection rejected. Please try again.',
28
- metamask_timeout: 'Whoops. Looks like something went wrong. Please try again.',
29
- 'missing-nonce': 'Something went wrong. Please try again.',
30
- 'missing-public-address': 'Connection cancelled. Please try again',
31
- oauth_window_blocked: 'To connect to your social account, enable popups in your browser and then try again.',
32
- oauth_window_timeout: 'Session time out. Please try again.',
33
- too_many_email_verification_attempts: 'Too many email verification attempts, please try again later',
34
- 'user-cancelled': '',
35
- wallet_not_deployed: 'Your smart wallet has not been deployed.',
36
- wrong_email_verification_token: 'The code you entered is incorrect. Please try again.',
13
+ const DEFAULT_ERROR_MESSAGE = 'Something went wrong. Please try again.';
14
+ const MESSAGE_SIGNATURE_DENIED = 'Message signature denied.';
15
+ const UNLOCK_WALLET_MESSAGE = 'Please unlock your wallet extension and try again.';
16
+ const INTERNAL_ERROR_MESSAGE = 'There was an internal error. Please try again.';
17
+ let _errorMessageMap;
18
+ const getErrorMessageMap = () => {
19
+ if (!_errorMessageMap) {
20
+ _errorMessageMap = {
21
+ '-1': DEFAULT_ERROR_MESSAGE,
22
+ '-32000': MESSAGE_SIGNATURE_DENIED,
23
+ '-32002': UNLOCK_WALLET_MESSAGE,
24
+ '-32003': MESSAGE_SIGNATURE_DENIED,
25
+ '-32602': 'Invalid parameters. Please try again.',
26
+ '-32603': INTERNAL_ERROR_MESSAGE,
27
+ 0: MESSAGE_SIGNATURE_DENIED,
28
+ 4001: MESSAGE_SIGNATURE_DENIED,
29
+ 4100: UNLOCK_WALLET_MESSAGE,
30
+ 4900: INTERNAL_ERROR_MESSAGE,
31
+ 5001: MESSAGE_SIGNATURE_DENIED,
32
+ 5002: MESSAGE_SIGNATURE_DENIED,
33
+ account_already_linked_to_different_profile: 'This social account is already linked to a different profile.',
34
+ [utils.SdkErrorCode.CONNECTION_REJECTED]: 'Connection rejected. Please try again.',
35
+ general_error: DEFAULT_ERROR_MESSAGE,
36
+ [utils.SdkErrorCode.INVALID_EMAIL_VERIFICATION]: 'The verification link is no longer valid. Please start again.',
37
+ metamask_timeout: 'Whoops. Looks like something went wrong. Please try again.',
38
+ [utils.SdkErrorCode.MISSING_NONCE]: DEFAULT_ERROR_MESSAGE,
39
+ 'missing-public-address': 'Connection cancelled. Please try again',
40
+ no_webauthn_support_error: 'Your browser does not support passkeys. Please try a different browser.',
41
+ oauth_error: 'Authentication failed. Please try again.',
42
+ oauth_window_blocked: 'To connect to your social account, enable popups in your browser and then try again.',
43
+ oauth_window_timeout: 'Session time out. Please try again.',
44
+ provider_not_enabled: 'This sign-in provider is not enabled. Please contact the app administrator.',
45
+ signin_error: 'Sign-in failed. Please try again.',
46
+ social_linking_not_enabled: 'Social account linking is not enabled for this application.',
47
+ [utils.SdkErrorCode.TOO_MANY_EMAIL_VERIFICATION_ATTEMPTS]: 'Too many email verification attempts, please try again later',
48
+ [utils.SdkErrorCode.UNKNOWN_ERROR]: 'An unexpected error occurred. Please try again.',
49
+ [utils.SdkErrorCode.USER_CANCELLED]: '',
50
+ [utils.SdkErrorCode.USER_CANCELLED_OAUTH]: '',
51
+ verification_error: 'Verification failed. Please try again.',
52
+ [utils.SdkErrorCode.WALLET_NOT_DEPLOYED]: 'Your smart wallet has not been deployed.',
53
+ wrong_email_verification_token: 'The code you entered is incorrect. Please try again.',
54
+ };
55
+ }
56
+ return _errorMessageMap;
37
57
  };
38
58
  const ErrorContext = React.createContext(undefined);
39
59
  const ErrorContextProvider = ({ children }) => {
@@ -54,12 +74,12 @@ const ErrorContextProvider = ({ children }) => {
54
74
  source: 'setDefaultError',
55
75
  time: 0,
56
76
  });
57
- setError('Something went wrong. Please try again.', utils.ErrorCode.DEFAULT);
77
+ setError(DEFAULT_ERROR_MESSAGE, utils.ErrorCode.DEFAULT);
58
78
  }, [setError]);
59
79
  /** @deprecated Prefer setError with a translation key instead */
60
80
  const setErrorMessage = React.useCallback((status, error, source) => {
61
- const mappedMessage = errorMessageMap[status];
62
- if (!mappedMessage) {
81
+ const mappedMessage = getErrorMessageMap()[status];
82
+ if (mappedMessage === undefined) {
63
83
  logger.logger.instrument(FALLBACK_ERROR_LOG_EVENT, {
64
84
  error: error instanceof Error ? error.message : undefined,
65
85
  errorCode: status,
@@ -68,7 +88,7 @@ const ErrorContextProvider = ({ children }) => {
68
88
  time: 0,
69
89
  });
70
90
  }
71
- setError(mappedMessage !== null && mappedMessage !== void 0 ? mappedMessage : 'Something went wrong. Please try again.');
91
+ setError(mappedMessage !== null && mappedMessage !== void 0 ? mappedMessage : DEFAULT_ERROR_MESSAGE);
72
92
  }, [setError]);
73
93
  const clearError = React.useCallback(() => {
74
94
  _setError(undefined);
@@ -1,35 +1,55 @@
1
1
  'use client'
2
2
  import { jsx } from 'react/jsx-runtime';
3
3
  import { createContext, useState, useCallback, useMemo } from 'react';
4
- import { ErrorCode } from '@dynamic-labs/utils';
4
+ import { ErrorCode, SdkErrorCode } from '@dynamic-labs/utils';
5
5
  import { logger } from '../../shared/logger.js';
6
6
  import { createProviderHook } from '../../shared/utils/functions/createProviderHook/createProviderHook.js';
7
7
 
8
8
  const FALLBACK_ERROR_LOG_EVENT = 'ui.fallback_error_shown';
9
- /** @deprecated Prefer setError with a translation key instead */
10
- const errorMessageMap = {
11
- '-32000': 'Message signature denied',
12
- '-32002': 'Please unlock your wallet extension and try again.',
13
- '-32003': 'Message signature denied.',
14
- '-32602': 'Invalid parameters. Please try again.',
15
- '-32603': 'There was an internal error. Please try again.',
16
- 0: 'Message signature denied.',
17
- 4001: 'Message signature denied.',
18
- 4100: 'Please unlock your wallet extension and try again.',
19
- 4900: 'There was an internal error. Please try again.',
20
- 5001: 'Message signature denied.',
21
- 5002: 'Message signature denied.',
22
- account_already_linked_to_different_profile: 'This social account is already linked to a different profile.',
23
- connection_rejected: 'Connection rejected. Please try again.',
24
- metamask_timeout: 'Whoops. Looks like something went wrong. Please try again.',
25
- 'missing-nonce': 'Something went wrong. Please try again.',
26
- 'missing-public-address': 'Connection cancelled. Please try again',
27
- oauth_window_blocked: 'To connect to your social account, enable popups in your browser and then try again.',
28
- oauth_window_timeout: 'Session time out. Please try again.',
29
- too_many_email_verification_attempts: 'Too many email verification attempts, please try again later',
30
- 'user-cancelled': '',
31
- wallet_not_deployed: 'Your smart wallet has not been deployed.',
32
- wrong_email_verification_token: 'The code you entered is incorrect. Please try again.',
9
+ const DEFAULT_ERROR_MESSAGE = 'Something went wrong. Please try again.';
10
+ const MESSAGE_SIGNATURE_DENIED = 'Message signature denied.';
11
+ const UNLOCK_WALLET_MESSAGE = 'Please unlock your wallet extension and try again.';
12
+ const INTERNAL_ERROR_MESSAGE = 'There was an internal error. Please try again.';
13
+ let _errorMessageMap;
14
+ const getErrorMessageMap = () => {
15
+ if (!_errorMessageMap) {
16
+ _errorMessageMap = {
17
+ '-1': DEFAULT_ERROR_MESSAGE,
18
+ '-32000': MESSAGE_SIGNATURE_DENIED,
19
+ '-32002': UNLOCK_WALLET_MESSAGE,
20
+ '-32003': MESSAGE_SIGNATURE_DENIED,
21
+ '-32602': 'Invalid parameters. Please try again.',
22
+ '-32603': INTERNAL_ERROR_MESSAGE,
23
+ 0: MESSAGE_SIGNATURE_DENIED,
24
+ 4001: MESSAGE_SIGNATURE_DENIED,
25
+ 4100: UNLOCK_WALLET_MESSAGE,
26
+ 4900: INTERNAL_ERROR_MESSAGE,
27
+ 5001: MESSAGE_SIGNATURE_DENIED,
28
+ 5002: MESSAGE_SIGNATURE_DENIED,
29
+ account_already_linked_to_different_profile: 'This social account is already linked to a different profile.',
30
+ [SdkErrorCode.CONNECTION_REJECTED]: 'Connection rejected. Please try again.',
31
+ general_error: DEFAULT_ERROR_MESSAGE,
32
+ [SdkErrorCode.INVALID_EMAIL_VERIFICATION]: 'The verification link is no longer valid. Please start again.',
33
+ metamask_timeout: 'Whoops. Looks like something went wrong. Please try again.',
34
+ [SdkErrorCode.MISSING_NONCE]: DEFAULT_ERROR_MESSAGE,
35
+ 'missing-public-address': 'Connection cancelled. Please try again',
36
+ no_webauthn_support_error: 'Your browser does not support passkeys. Please try a different browser.',
37
+ oauth_error: 'Authentication failed. Please try again.',
38
+ oauth_window_blocked: 'To connect to your social account, enable popups in your browser and then try again.',
39
+ oauth_window_timeout: 'Session time out. Please try again.',
40
+ provider_not_enabled: 'This sign-in provider is not enabled. Please contact the app administrator.',
41
+ signin_error: 'Sign-in failed. Please try again.',
42
+ social_linking_not_enabled: 'Social account linking is not enabled for this application.',
43
+ [SdkErrorCode.TOO_MANY_EMAIL_VERIFICATION_ATTEMPTS]: 'Too many email verification attempts, please try again later',
44
+ [SdkErrorCode.UNKNOWN_ERROR]: 'An unexpected error occurred. Please try again.',
45
+ [SdkErrorCode.USER_CANCELLED]: '',
46
+ [SdkErrorCode.USER_CANCELLED_OAUTH]: '',
47
+ verification_error: 'Verification failed. Please try again.',
48
+ [SdkErrorCode.WALLET_NOT_DEPLOYED]: 'Your smart wallet has not been deployed.',
49
+ wrong_email_verification_token: 'The code you entered is incorrect. Please try again.',
50
+ };
51
+ }
52
+ return _errorMessageMap;
33
53
  };
34
54
  const ErrorContext = createContext(undefined);
35
55
  const ErrorContextProvider = ({ children }) => {
@@ -50,12 +70,12 @@ const ErrorContextProvider = ({ children }) => {
50
70
  source: 'setDefaultError',
51
71
  time: 0,
52
72
  });
53
- setError('Something went wrong. Please try again.', ErrorCode.DEFAULT);
73
+ setError(DEFAULT_ERROR_MESSAGE, ErrorCode.DEFAULT);
54
74
  }, [setError]);
55
75
  /** @deprecated Prefer setError with a translation key instead */
56
76
  const setErrorMessage = useCallback((status, error, source) => {
57
- const mappedMessage = errorMessageMap[status];
58
- if (!mappedMessage) {
77
+ const mappedMessage = getErrorMessageMap()[status];
78
+ if (mappedMessage === undefined) {
59
79
  logger.instrument(FALLBACK_ERROR_LOG_EVENT, {
60
80
  error: error instanceof Error ? error.message : undefined,
61
81
  errorCode: status,
@@ -64,7 +84,7 @@ const ErrorContextProvider = ({ children }) => {
64
84
  time: 0,
65
85
  });
66
86
  }
67
- setError(mappedMessage !== null && mappedMessage !== void 0 ? mappedMessage : 'Something went wrong. Please try again.');
87
+ setError(mappedMessage !== null && mappedMessage !== void 0 ? mappedMessage : DEFAULT_ERROR_MESSAGE);
68
88
  }, [setError]);
69
89
  const clearError = useCallback(() => {
70
90
  _setError(undefined);
@@ -20,7 +20,7 @@ var getOnrampProviders = require('./utils/getOnrampProviders.cjs');
20
20
 
21
21
  const OnrampContext = React.createContext(undefined);
22
22
  const OnrampContextProvider = ({ children, }) => {
23
- var _a, _b, _c, _d, _e;
23
+ var _a, _b, _c, _d, _e, _f, _g, _h;
24
24
  const promiseRef = React.useRef(null);
25
25
  const [selectedOnrampProvider, setSelectedOnrampProvider] = React.useState();
26
26
  const [showOnramp, _setShowOnramp] = React.useState(false);
@@ -29,8 +29,13 @@ const OnrampContextProvider = ({ children, }) => {
29
29
  const { environmentId, network, primaryWallet, projectSettings, overrides } = useInternalDynamicContext.useInternalDynamicContext();
30
30
  const { setDynamicWidgetView } = DynamicWidgetContext.useWidgetContext();
31
31
  const [enabledOnrampProvidersTarget, setEnabledOnrampProvidersTarget] = React.useState({});
32
- // Fetch onramp providers by default so Buy button is available in funding methods
33
- const [shouldFetchOnramps, setShouldFetchOnramps] = React.useState(true);
32
+ // Manual trigger for programmatic flows (openOnramp, setEnabledOnrampProvidersTargetValue)
33
+ const [manualFetchTriggered, setManualFetchTriggered] = React.useState(false);
34
+ // Auto-fetch when onramps are configured in the dashboard so the Buy button
35
+ // is available in the funding-methods view. When unconfigured, skip the fetch
36
+ // to avoid wasting bandwidth on SDK mount (esp. on slow mobile connections).
37
+ const hasOnrampsConfigured = Boolean((_c = (_b = (_a = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.sdk) === null || _a === void 0 ? void 0 : _a.funding) === null || _b === void 0 ? void 0 : _b.onramps) === null || _c === void 0 ? void 0 : _c.length);
38
+ const shouldFetchOnramps = manualFetchTriggered || hasOnrampsConfigured;
34
39
  const setShowOnramp = React.useCallback((value) => {
35
40
  _setShowOnramp(value);
36
41
  if (!value && promiseRef.current) {
@@ -48,7 +53,7 @@ const OnrampContextProvider = ({ children, }) => {
48
53
  });
49
54
  // Trigger fetch when target is set with specific parameters
50
55
  if (address || token || network || tokenAmount || chainName || currency) {
51
- setShouldFetchOnramps(true);
56
+ setManualFetchTriggered(true);
52
57
  }
53
58
  }, []);
54
59
  const resetOverrides = React.useCallback(() => {
@@ -60,7 +65,7 @@ const OnrampContextProvider = ({ children, }) => {
60
65
  includeDisabled: true,
61
66
  network,
62
67
  primaryWallet,
63
- projectSettingsOnramps: (_b = (_a = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.sdk) === null || _a === void 0 ? void 0 : _a.funding) === null || _b === void 0 ? void 0 : _b.onramps,
68
+ projectSettingsOnramps: (_e = (_d = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.sdk) === null || _d === void 0 ? void 0 : _d.funding) === null || _e === void 0 ? void 0 : _e.onramps,
64
69
  shouldFetch: shouldFetchOnramps,
65
70
  target: enabledOnrampProvidersTarget,
66
71
  });
@@ -101,7 +106,7 @@ const OnrampContextProvider = ({ children, }) => {
101
106
  return Boolean(((_c = (_b = (_a = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.sdk) === null || _a === void 0 ? void 0 : _a.funding) === null || _b === void 0 ? void 0 : _b.onramps) === null || _c === void 0 ? void 0 : _c.length) &&
102
107
  enabledOnrampProvidersInDashboard.length);
103
108
  }, [
104
- (_e = (_d = (_c = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.sdk) === null || _c === void 0 ? void 0 : _c.funding) === null || _d === void 0 ? void 0 : _d.onramps) === null || _e === void 0 ? void 0 : _e.length,
109
+ (_h = (_g = (_f = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.sdk) === null || _f === void 0 ? void 0 : _f.funding) === null || _g === void 0 ? void 0 : _g.onramps) === null || _h === void 0 ? void 0 : _h.length,
105
110
  enabledOnrampProvidersInDashboard.length,
106
111
  onrampOverrides.length,
107
112
  overrides === null || overrides === void 0 ? void 0 : overrides.onrampOptions,
@@ -131,8 +136,8 @@ const OnrampContextProvider = ({ children, }) => {
131
136
  onrampOverrides,
132
137
  overrides === null || overrides === void 0 ? void 0 : overrides.onrampOptions,
133
138
  ]);
134
- const openOnramp = React.useCallback((_f) => _tslib.__awaiter(void 0, [_f], void 0, function* ({ onrampProvider, address, token, tokenAmount, network: networkOverride, chainName, currency, overrideOnRamp, payingWithDynamic, merchantName, }) {
135
- var _g, _h, _j, _k;
139
+ const openOnramp = React.useCallback((_j) => _tslib.__awaiter(void 0, [_j], void 0, function* ({ onrampProvider, address, token, tokenAmount, network: networkOverride, chainName, currency, overrideOnRamp, payingWithDynamic, merchantName, }) {
140
+ var _k, _l, _m, _o;
136
141
  if (!onrampEnabled && !overrideOnRamp && !payingWithDynamic) {
137
142
  throw new Error('Onramp is not enabled');
138
143
  }
@@ -142,8 +147,8 @@ const OnrampContextProvider = ({ children, }) => {
142
147
  }
143
148
  promiseRef.current = new utils.DeferredPromise();
144
149
  // Trigger onramp providers fetch if not already done
145
- if (!shouldFetchOnramps) {
146
- setShouldFetchOnramps(true);
150
+ if (!manualFetchTriggered) {
151
+ setManualFetchTriggered(true);
147
152
  }
148
153
  let localOnrampProviders = enabledOnrampProvidersInDashboardOptions;
149
154
  const networkToUse = networkOverride || network;
@@ -162,7 +167,7 @@ const OnrampContextProvider = ({ children, }) => {
162
167
  Boolean(address);
163
168
  if (payingWithDynamic && !allPayingParameters) {
164
169
  rejectPromiseRef.rejectPromiseRef(promiseRef, new Error('PayingWithDynamic: Missing parameters'));
165
- return (_g = promiseRef.current) === null || _g === void 0 ? void 0 : _g.promise;
170
+ return (_k = promiseRef.current) === null || _k === void 0 ? void 0 : _k.promise;
166
171
  }
167
172
  if (shouldOverrideOnrampProviders)
168
173
  setOverride(true);
@@ -184,15 +189,15 @@ const OnrampContextProvider = ({ children, }) => {
184
189
  const onrampOption = localOnrampProviders.find((p) => p.id === onrampProvider);
185
190
  if (payingWithDynamic && !onrampOption) {
186
191
  rejectPromiseRef.rejectPromiseRef(promiseRef, new Error('PayingWithDynamic: Onramp provider not found'));
187
- return (_h = promiseRef.current) === null || _h === void 0 ? void 0 : _h.promise;
192
+ return (_l = promiseRef.current) === null || _l === void 0 ? void 0 : _l.promise;
188
193
  }
189
194
  if (!onrampOption) {
190
195
  rejectPromiseRef.rejectPromiseRef(promiseRef, new Error('Onramp provider not found'));
191
- return (_j = promiseRef.current) === null || _j === void 0 ? void 0 : _j.promise;
196
+ return (_m = promiseRef.current) === null || _m === void 0 ? void 0 : _m.promise;
192
197
  }
193
198
  setOverrideOnrampProvider(onrampOption);
194
199
  setSelectedAndShowOnramp({ payingWithDynamic, provider: onrampOption });
195
- return (_k = promiseRef.current) === null || _k === void 0 ? void 0 : _k.promise;
200
+ return (_o = promiseRef.current) === null || _o === void 0 ? void 0 : _o.promise;
196
201
  }), [
197
202
  enabledOnrampProvidersInDashboardOptions,
198
203
  environmentId,
@@ -200,7 +205,7 @@ const OnrampContextProvider = ({ children, }) => {
200
205
  primaryWallet,
201
206
  network,
202
207
  setSelectedAndShowOnramp,
203
- shouldFetchOnramps,
208
+ manualFetchTriggered,
204
209
  ]);
205
210
  const selectedOnramp = React.useMemo(() => {
206
211
  let selected;
@@ -16,7 +16,7 @@ import { getOnrampProviders } from './utils/getOnrampProviders.js';
16
16
 
17
17
  const OnrampContext = createContext(undefined);
18
18
  const OnrampContextProvider = ({ children, }) => {
19
- var _a, _b, _c, _d, _e;
19
+ var _a, _b, _c, _d, _e, _f, _g, _h;
20
20
  const promiseRef = useRef(null);
21
21
  const [selectedOnrampProvider, setSelectedOnrampProvider] = useState();
22
22
  const [showOnramp, _setShowOnramp] = useState(false);
@@ -25,8 +25,13 @@ const OnrampContextProvider = ({ children, }) => {
25
25
  const { environmentId, network, primaryWallet, projectSettings, overrides } = useInternalDynamicContext();
26
26
  const { setDynamicWidgetView } = useWidgetContext();
27
27
  const [enabledOnrampProvidersTarget, setEnabledOnrampProvidersTarget] = useState({});
28
- // Fetch onramp providers by default so Buy button is available in funding methods
29
- const [shouldFetchOnramps, setShouldFetchOnramps] = useState(true);
28
+ // Manual trigger for programmatic flows (openOnramp, setEnabledOnrampProvidersTargetValue)
29
+ const [manualFetchTriggered, setManualFetchTriggered] = useState(false);
30
+ // Auto-fetch when onramps are configured in the dashboard so the Buy button
31
+ // is available in the funding-methods view. When unconfigured, skip the fetch
32
+ // to avoid wasting bandwidth on SDK mount (esp. on slow mobile connections).
33
+ const hasOnrampsConfigured = Boolean((_c = (_b = (_a = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.sdk) === null || _a === void 0 ? void 0 : _a.funding) === null || _b === void 0 ? void 0 : _b.onramps) === null || _c === void 0 ? void 0 : _c.length);
34
+ const shouldFetchOnramps = manualFetchTriggered || hasOnrampsConfigured;
30
35
  const setShowOnramp = useCallback((value) => {
31
36
  _setShowOnramp(value);
32
37
  if (!value && promiseRef.current) {
@@ -44,7 +49,7 @@ const OnrampContextProvider = ({ children, }) => {
44
49
  });
45
50
  // Trigger fetch when target is set with specific parameters
46
51
  if (address || token || network || tokenAmount || chainName || currency) {
47
- setShouldFetchOnramps(true);
52
+ setManualFetchTriggered(true);
48
53
  }
49
54
  }, []);
50
55
  const resetOverrides = useCallback(() => {
@@ -56,7 +61,7 @@ const OnrampContextProvider = ({ children, }) => {
56
61
  includeDisabled: true,
57
62
  network,
58
63
  primaryWallet,
59
- projectSettingsOnramps: (_b = (_a = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.sdk) === null || _a === void 0 ? void 0 : _a.funding) === null || _b === void 0 ? void 0 : _b.onramps,
64
+ projectSettingsOnramps: (_e = (_d = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.sdk) === null || _d === void 0 ? void 0 : _d.funding) === null || _e === void 0 ? void 0 : _e.onramps,
60
65
  shouldFetch: shouldFetchOnramps,
61
66
  target: enabledOnrampProvidersTarget,
62
67
  });
@@ -97,7 +102,7 @@ const OnrampContextProvider = ({ children, }) => {
97
102
  return Boolean(((_c = (_b = (_a = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.sdk) === null || _a === void 0 ? void 0 : _a.funding) === null || _b === void 0 ? void 0 : _b.onramps) === null || _c === void 0 ? void 0 : _c.length) &&
98
103
  enabledOnrampProvidersInDashboard.length);
99
104
  }, [
100
- (_e = (_d = (_c = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.sdk) === null || _c === void 0 ? void 0 : _c.funding) === null || _d === void 0 ? void 0 : _d.onramps) === null || _e === void 0 ? void 0 : _e.length,
105
+ (_h = (_g = (_f = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.sdk) === null || _f === void 0 ? void 0 : _f.funding) === null || _g === void 0 ? void 0 : _g.onramps) === null || _h === void 0 ? void 0 : _h.length,
101
106
  enabledOnrampProvidersInDashboard.length,
102
107
  onrampOverrides.length,
103
108
  overrides === null || overrides === void 0 ? void 0 : overrides.onrampOptions,
@@ -127,8 +132,8 @@ const OnrampContextProvider = ({ children, }) => {
127
132
  onrampOverrides,
128
133
  overrides === null || overrides === void 0 ? void 0 : overrides.onrampOptions,
129
134
  ]);
130
- const openOnramp = useCallback((_f) => __awaiter(void 0, [_f], void 0, function* ({ onrampProvider, address, token, tokenAmount, network: networkOverride, chainName, currency, overrideOnRamp, payingWithDynamic, merchantName, }) {
131
- var _g, _h, _j, _k;
135
+ const openOnramp = useCallback((_j) => __awaiter(void 0, [_j], void 0, function* ({ onrampProvider, address, token, tokenAmount, network: networkOverride, chainName, currency, overrideOnRamp, payingWithDynamic, merchantName, }) {
136
+ var _k, _l, _m, _o;
132
137
  if (!onrampEnabled && !overrideOnRamp && !payingWithDynamic) {
133
138
  throw new Error('Onramp is not enabled');
134
139
  }
@@ -138,8 +143,8 @@ const OnrampContextProvider = ({ children, }) => {
138
143
  }
139
144
  promiseRef.current = new DeferredPromise();
140
145
  // Trigger onramp providers fetch if not already done
141
- if (!shouldFetchOnramps) {
142
- setShouldFetchOnramps(true);
146
+ if (!manualFetchTriggered) {
147
+ setManualFetchTriggered(true);
143
148
  }
144
149
  let localOnrampProviders = enabledOnrampProvidersInDashboardOptions;
145
150
  const networkToUse = networkOverride || network;
@@ -158,7 +163,7 @@ const OnrampContextProvider = ({ children, }) => {
158
163
  Boolean(address);
159
164
  if (payingWithDynamic && !allPayingParameters) {
160
165
  rejectPromiseRef(promiseRef, new Error('PayingWithDynamic: Missing parameters'));
161
- return (_g = promiseRef.current) === null || _g === void 0 ? void 0 : _g.promise;
166
+ return (_k = promiseRef.current) === null || _k === void 0 ? void 0 : _k.promise;
162
167
  }
163
168
  if (shouldOverrideOnrampProviders)
164
169
  setOverride(true);
@@ -180,15 +185,15 @@ const OnrampContextProvider = ({ children, }) => {
180
185
  const onrampOption = localOnrampProviders.find((p) => p.id === onrampProvider);
181
186
  if (payingWithDynamic && !onrampOption) {
182
187
  rejectPromiseRef(promiseRef, new Error('PayingWithDynamic: Onramp provider not found'));
183
- return (_h = promiseRef.current) === null || _h === void 0 ? void 0 : _h.promise;
188
+ return (_l = promiseRef.current) === null || _l === void 0 ? void 0 : _l.promise;
184
189
  }
185
190
  if (!onrampOption) {
186
191
  rejectPromiseRef(promiseRef, new Error('Onramp provider not found'));
187
- return (_j = promiseRef.current) === null || _j === void 0 ? void 0 : _j.promise;
192
+ return (_m = promiseRef.current) === null || _m === void 0 ? void 0 : _m.promise;
188
193
  }
189
194
  setOverrideOnrampProvider(onrampOption);
190
195
  setSelectedAndShowOnramp({ payingWithDynamic, provider: onrampOption });
191
- return (_k = promiseRef.current) === null || _k === void 0 ? void 0 : _k.promise;
196
+ return (_o = promiseRef.current) === null || _o === void 0 ? void 0 : _o.promise;
192
197
  }), [
193
198
  enabledOnrampProvidersInDashboardOptions,
194
199
  environmentId,
@@ -196,7 +201,7 @@ const OnrampContextProvider = ({ children, }) => {
196
201
  primaryWallet,
197
202
  network,
198
203
  setSelectedAndShowOnramp,
199
- shouldFetchOnramps,
204
+ manualFetchTriggered,
200
205
  ]);
201
206
  const selectedOnramp = useMemo(() => {
202
207
  let selected;
@@ -5,7 +5,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
5
5
 
6
6
  var _tslib = require('../../../../../_virtual/_tslib.cjs');
7
7
  var sdkApiCore = require('@dynamic-labs/sdk-api-core');
8
- var utils = require('@dynamic-labs/utils');
8
+ var utils$1 = require('@dynamic-labs/utils');
9
9
  require('@dynamic-labs/iconic');
10
10
  require('@dynamic-labs/wallet-connector-core');
11
11
  require('react');
@@ -17,6 +17,7 @@ require('../../../utils/constants/colors.cjs');
17
17
  require('../../../utils/constants/values.cjs');
18
18
  require('../../../shared/consts/index.cjs');
19
19
  var api = require('../api.cjs');
20
+ var utils = require('../utils.cjs');
20
21
  require('@dynamic-labs-sdk/client/core');
21
22
  require('eventemitter3');
22
23
  require('@dynamic-labs-sdk/client');
@@ -109,7 +110,7 @@ const updatePasskeyRecoveryEmail = (_d) => _tslib.__awaiter(void 0, [_d], void 0
109
110
  }
110
111
  catch (e) {
111
112
  yield logResponse(e, 'Error while trying to update recovery email');
112
- throw new utils.DynamicError('Error updating recovery email');
113
+ throw new utils$1.DynamicError('Error updating recovery email');
113
114
  }
114
115
  });
115
116
  const getUserPasskeys = (_e) => _tslib.__awaiter(void 0, [_e], void 0, function* ({ environmentId, }) {
@@ -177,24 +178,24 @@ const registerSessionKey = (_h) => _tslib.__awaiter(void 0, [_h], void 0, functi
177
178
  });
178
179
  }
179
180
  catch (error) {
180
- if (error instanceof Response) {
181
- const responseError = yield utils.ResponseError.fromResponse({
181
+ if (utils.isResponseLike(error)) {
182
+ const responseError = yield utils$1.ResponseError.fromResponse({
182
183
  cause: error,
183
184
  message: 'Error register session key',
184
185
  });
185
186
  logger.logger.error(responseError, { prevSessionKeySignature, publicKey });
186
- utils.tracing.logEvent('session-key', 'Error registering session key', utils.tracing.formatObject({
187
+ utils$1.tracing.logEvent('session-key', 'Error registering session key', utils$1.tracing.formatObject({
187
188
  prevSessionKeySignature,
188
189
  publicKey,
189
190
  walletId,
190
191
  }));
191
- if (utils.PlatformService.isNativeMobile) {
192
- logger.logger.instrument(utils.tracing.packScopes());
192
+ if (utils$1.PlatformService.isNativeMobile) {
193
+ logger.logger.instrument(utils$1.tracing.packScopes());
193
194
  }
194
195
  if (responseError.response.status === 422) {
195
196
  if (responseError.json.code ===
196
197
  sdkApiCore.UnprocessableEntityErrorCode.InvalidSessionPublicKey) {
197
- throw new utils.InvalidEmbeddedWalletSessionKeyError(responseError.json.error);
198
+ throw new utils$1.InvalidEmbeddedWalletSessionKeyError(responseError.json.error);
198
199
  }
199
200
  }
200
201
  throw responseError;
@@ -216,7 +217,7 @@ const getCreateEmbeddedWalletAccountRequest = (_j) => _tslib.__awaiter(void 0, [
216
217
  }
217
218
  catch (e) {
218
219
  yield logResponse(e, 'Error fetching create embedded wallet account request', { chain });
219
- throw new utils.DynamicError('Error fetching create embedded wallet account request');
220
+ throw new utils$1.DynamicError('Error fetching create embedded wallet account request');
220
221
  }
221
222
  });
222
223
  const createEmbeddedWalletAccount = (_k) => _tslib.__awaiter(void 0, [_k], void 0, function* ({ environmentId, createEmbeddedWalletAccountRequest, }) {
@@ -233,7 +234,7 @@ const createEmbeddedWalletAccount = (_k) => _tslib.__awaiter(void 0, [_k], void
233
234
  yield logResponse(e, '[createEmbeddedWalletAccount] Error creating embedded wallet account', {
234
235
  createEmbeddedWalletAccountRequest,
235
236
  });
236
- throw new utils.DynamicError('[createEmbeddedWalletAccount] Error creating embedded wallet account');
237
+ throw new utils$1.DynamicError('[createEmbeddedWalletAccount] Error creating embedded wallet account');
237
238
  }
238
239
  });
239
240
  const getDeleteEmbeddedWalletsRequest = (_l) => _tslib.__awaiter(void 0, [_l], void 0, function* ({ environmentId, walletId, }) {
@@ -246,7 +247,7 @@ const getDeleteEmbeddedWalletsRequest = (_l) => _tslib.__awaiter(void 0, [_l], v
246
247
  }
247
248
  catch (e) {
248
249
  yield logResponse(e, 'Error fetching delete embedded wallet request');
249
- throw new utils.DynamicError('Error fetching delete embedded wallets request');
250
+ throw new utils$1.DynamicError('Error fetching delete embedded wallets request');
250
251
  }
251
252
  });
252
253
  const deleteEmbeddedWallets = (_m) => _tslib.__awaiter(void 0, [_m], void 0, function* ({ environmentId, deleteEmbeddedWalletsRequest, }) {
@@ -263,12 +264,12 @@ const deleteEmbeddedWallets = (_m) => _tslib.__awaiter(void 0, [_m], void 0, fun
263
264
  yield logResponse(e, 'Error deleting embedded wallets', {
264
265
  deleteEmbeddedWalletsRequest,
265
266
  });
266
- throw new utils.DynamicError('Error deleting embedded wallets');
267
+ throw new utils$1.DynamicError('Error deleting embedded wallets');
267
268
  }
268
269
  });
269
270
  const logResponse = (error, message, data) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
270
- if (error instanceof Response) {
271
- const responseError = yield utils.ResponseError.fromResponse({
271
+ if (utils.isResponseLike(error)) {
272
+ const responseError = yield utils$1.ResponseError.fromResponse({
272
273
  cause: error,
273
274
  message,
274
275
  });
@@ -13,6 +13,7 @@ import '../../../utils/constants/colors.js';
13
13
  import '../../../utils/constants/values.js';
14
14
  import '../../../shared/consts/index.js';
15
15
  import { sdkApi } from '../api.js';
16
+ import { isResponseLike } from '../utils.js';
16
17
  import '@dynamic-labs-sdk/client/core';
17
18
  import 'eventemitter3';
18
19
  import '@dynamic-labs-sdk/client';
@@ -173,7 +174,7 @@ const registerSessionKey = (_h) => __awaiter(void 0, [_h], void 0, function* ({
173
174
  });
174
175
  }
175
176
  catch (error) {
176
- if (error instanceof Response) {
177
+ if (isResponseLike(error)) {
177
178
  const responseError = yield ResponseError.fromResponse({
178
179
  cause: error,
179
180
  message: 'Error register session key',
@@ -263,7 +264,7 @@ const deleteEmbeddedWallets = (_m) => __awaiter(void 0, [_m], void 0, function*
263
264
  }
264
265
  });
265
266
  const logResponse = (error, message, data) => __awaiter(void 0, void 0, void 0, function* () {
266
- if (error instanceof Response) {
267
+ if (isResponseLike(error)) {
267
268
  const responseError = yield ResponseError.fromResponse({
268
269
  cause: error,
269
270
  message,
@@ -46,7 +46,7 @@ const updateUserProfileFields = (environmentId, fields) => _tslib.__awaiter(void
46
46
  }
47
47
  catch (e) {
48
48
  const error = yield utils.logResponseError(e, 'Error updateUserProfileFields');
49
- if (e instanceof Response) {
49
+ if (utils.isResponseLike(e)) {
50
50
  if (error.code === 'email_already_exists') {
51
51
  throw new utils$1.EmailAlreadyExistsError();
52
52
  }
@@ -22,7 +22,7 @@ import '../../../store/state/nonce/nonce.js';
22
22
  import '@dynamic-labs-wallet/browser-wallet-client';
23
23
  import { sdkApi } from '../api.js';
24
24
  import { ELEVATED_ACCESS_TOKEN_HEADER } from '../constants.js';
25
- import { logResponseError } from '../utils.js';
25
+ import { logResponseError, isResponseLike } from '../utils.js';
26
26
  import '@dynamic-labs/locale';
27
27
  import '../../../store/state/dynamicContextProps/dynamicContextProps.js';
28
28
  import '../../../store/state/primaryWalletId/primaryWalletId.js';
@@ -42,7 +42,7 @@ const updateUserProfileFields = (environmentId, fields) => __awaiter(void 0, voi
42
42
  }
43
43
  catch (e) {
44
44
  const error = yield logResponseError(e, 'Error updateUserProfileFields');
45
- if (e instanceof Response) {
45
+ if (isResponseLike(e)) {
46
46
  if (error.code === 'email_already_exists') {
47
47
  throw new EmailAlreadyExistsError();
48
48
  }
@@ -20,9 +20,13 @@ var api = require('./api.cjs');
20
20
 
21
21
  const RATE_LIMIT_MESSAGE = 'Too many requests. Please try again later.';
22
22
  const NETWORK_ERROR_MESSAGE = 'Request failed. You may be sending too many requests — please wait a moment and try again.';
23
+ // expo/fetch returns response objects that aren't the same class as global Response,
24
+ // so instanceof checks fail on React Native / Expo SDK 56+. Duck-type instead.
25
+ const isResponseLike = (e) => typeof (e === null || e === void 0 ? void 0 : e.json) === 'function' &&
26
+ typeof (e === null || e === void 0 ? void 0 : e.status) === 'number';
23
27
  const logResponseError = (e_1, message_1, ...args_1) => _tslib.__awaiter(void 0, [e_1, message_1, ...args_1], void 0, function* (e, message, logLevel = 'error') {
24
28
  var _a, _b, _c, _d, _e, _f, _g;
25
- if (e instanceof Response) {
29
+ if (isResponseLike(e)) {
26
30
  const requestId = (_b = (_a = e.headers) === null || _a === void 0 ? void 0 : _a.get('x-dyn-request-id')) !== null && _b !== void 0 ? _b : undefined;
27
31
  const cfRay = (_d = (_c = e.headers) === null || _c === void 0 ? void 0 : _c.get('cf-ray')) !== null && _d !== void 0 ? _d : undefined;
28
32
  let data;
@@ -68,4 +72,5 @@ const getNonce = (environmentId) => _tslib.__awaiter(void 0, void 0, void 0, fun
68
72
  });
69
73
 
70
74
  exports.getNonce = getNonce;
75
+ exports.isResponseLike = isResponseLike;
71
76
  exports.logResponseError = logResponseError;
@@ -1,2 +1,3 @@
1
+ export declare const isResponseLike: (e: unknown) => e is Response;
1
2
  export declare const logResponseError: (e: any, message: string, logLevel?: 'error' | 'warn') => Promise<any>;
2
3
  export declare const getNonce: (environmentId: string) => Promise<string | undefined>;
@@ -16,9 +16,13 @@ import { sdkApi } from './api.js';
16
16
 
17
17
  const RATE_LIMIT_MESSAGE = 'Too many requests. Please try again later.';
18
18
  const NETWORK_ERROR_MESSAGE = 'Request failed. You may be sending too many requests — please wait a moment and try again.';
19
+ // expo/fetch returns response objects that aren't the same class as global Response,
20
+ // so instanceof checks fail on React Native / Expo SDK 56+. Duck-type instead.
21
+ const isResponseLike = (e) => typeof (e === null || e === void 0 ? void 0 : e.json) === 'function' &&
22
+ typeof (e === null || e === void 0 ? void 0 : e.status) === 'number';
19
23
  const logResponseError = (e_1, message_1, ...args_1) => __awaiter(void 0, [e_1, message_1, ...args_1], void 0, function* (e, message, logLevel = 'error') {
20
24
  var _a, _b, _c, _d, _e, _f, _g;
21
- if (e instanceof Response) {
25
+ if (isResponseLike(e)) {
22
26
  const requestId = (_b = (_a = e.headers) === null || _a === void 0 ? void 0 : _a.get('x-dyn-request-id')) !== null && _b !== void 0 ? _b : undefined;
23
27
  const cfRay = (_d = (_c = e.headers) === null || _c === void 0 ? void 0 : _c.get('cf-ray')) !== null && _d !== void 0 ? _d : undefined;
24
28
  let data;
@@ -63,4 +67,4 @@ const getNonce = (environmentId) => __awaiter(void 0, void 0, void 0, function*
63
67
  }
64
68
  });
65
69
 
66
- export { getNonce, logResponseError };
70
+ export { getNonce, isResponseLike, logResponseError };
@@ -176,7 +176,7 @@ const verifyWallet = (environmentId_3, _f) => _tslib.__awaiter(void 0, [environm
176
176
  }
177
177
  catch (e) {
178
178
  const data = yield utils.logResponseError(e, 'Error verifyWallet');
179
- if (data.code === 'wallet_not_deployed') {
179
+ if (data.code === utils$1.SdkErrorCode.WALLET_NOT_DEPLOYED) {
180
180
  throw new utils$1.WalletNotDeployedError();
181
181
  }
182
182
  if (((_g = data.error) === null || _g === void 0 ? void 0 : _g.code) === 'chainalysis_blocked_wallet') {
@@ -227,7 +227,7 @@ const walletsVerify = (environmentId_4, _l) => _tslib.__awaiter(void 0, [environ
227
227
  }
228
228
  catch (e) {
229
229
  const data = yield utils.logResponseError(e, 'Error walletsVerify');
230
- if (data.code === 'wallet_not_deployed') {
230
+ if (data.code === utils$1.SdkErrorCode.WALLET_NOT_DEPLOYED) {
231
231
  throw new utils$1.WalletNotDeployedError();
232
232
  }
233
233
  if (((_m = data.error) === null || _m === void 0 ? void 0 : _m.code) === 'chainalysis_blocked_wallet') {
@@ -2,7 +2,7 @@
2
2
  import { __awaiter } from '../../../../../_virtual/_tslib.js';
3
3
  import { getElevatedAccessToken } from '@dynamic-labs-sdk/client';
4
4
  import { TokenScope, VerifyRequestFromJSON } from '@dynamic-labs/sdk-api-core';
5
- import { DynamicError, EmbeddedWalletExistsError, WalletUsedError, MergeAccountsConfirmationError, SandboxMaximumThresholdReachedError, WalletNotDeployedError, ChainalysisError, GateBlockedError, NoAccessError, ErrorCode, AccountExistsError } from '@dynamic-labs/utils';
5
+ import { DynamicError, EmbeddedWalletExistsError, WalletUsedError, MergeAccountsConfirmationError, SandboxMaximumThresholdReachedError, SdkErrorCode, WalletNotDeployedError, ChainalysisError, GateBlockedError, NoAccessError, ErrorCode, AccountExistsError } from '@dynamic-labs/utils';
6
6
  import '@dynamic-labs-sdk/client/core';
7
7
  import 'react';
8
8
  import 'eventemitter3';
@@ -172,7 +172,7 @@ const verifyWallet = (environmentId_3, _f) => __awaiter(void 0, [environmentId_3
172
172
  }
173
173
  catch (e) {
174
174
  const data = yield logResponseError(e, 'Error verifyWallet');
175
- if (data.code === 'wallet_not_deployed') {
175
+ if (data.code === SdkErrorCode.WALLET_NOT_DEPLOYED) {
176
176
  throw new WalletNotDeployedError();
177
177
  }
178
178
  if (((_g = data.error) === null || _g === void 0 ? void 0 : _g.code) === 'chainalysis_blocked_wallet') {
@@ -223,7 +223,7 @@ const walletsVerify = (environmentId_4, _l) => __awaiter(void 0, [environmentId_
223
223
  }
224
224
  catch (e) {
225
225
  const data = yield logResponseError(e, 'Error walletsVerify');
226
- if (data.code === 'wallet_not_deployed') {
226
+ if (data.code === SdkErrorCode.WALLET_NOT_DEPLOYED) {
227
227
  throw new WalletNotDeployedError();
228
228
  }
229
229
  if (((_m = data.error) === null || _m === void 0 ? void 0 : _m.code) === 'chainalysis_blocked_wallet') {
@@ -1,5 +1,6 @@
1
1
  import type { LogoutEventMetadata } from '@dynamic-labs-sdk/client';
2
2
  import { AuthEventPayload } from '@dynamic-labs/types';
3
+ import { SdkErrorCode } from '@dynamic-labs/utils';
3
4
  import { SdkLogoutReason } from '../context/DynamicContext/hooks/useHandleLogout';
4
5
  export type AuthEvents = {
5
6
  /**
@@ -8,8 +9,8 @@ export type AuthEvents = {
8
9
  * For email/sms, specifically happens when users cancels the OTP verification.
9
10
  */
10
11
  authFailure: (method: AuthEventPayload,
11
- /** Will be 'user-cancelled' when cancelled, or the error when there is an error */
12
- reason: 'user-cancelled' | {
12
+ /** Will be SdkErrorCode.USER_CANCELLED when cancelled, or the error when there is an error */
13
+ reason: SdkErrorCode.USER_CANCELLED | {
13
14
  error: unknown;
14
15
  }) => void;
15
16
  /** Informs an auth attempt initialized, and provides insight into which auth option it is */
@@ -1,6 +1,7 @@
1
1
  import { JwtVerifiedCredential } from '@dynamic-labs/sdk-api-core';
2
2
  import { AuthEventPayload, OtpDestination, PhoneData, UserProfile } from '@dynamic-labs/types';
3
3
  import { WalletConnector } from '@dynamic-labs/wallet-connector-core';
4
+ import { SdkErrorCode } from '@dynamic-labs/utils';
4
5
  import { Wallet, WalletListViewTabItem } from './wallets';
5
6
  export type DynamicEventsCallbacks = {
6
7
  onSignedMessage?: (params: {
@@ -29,7 +30,7 @@ export type DynamicEventsCallbacks = {
29
30
  * In general triggered when an error occurs or when user cancels out.
30
31
  * For email/sms, specifically happens when users cancels the OTP verification.
31
32
  */
32
- onAuthFailure?: (data: AuthEventPayload, reason: 'user-cancelled' | {
33
+ onAuthFailure?: (data: AuthEventPayload, reason: SdkErrorCode.USER_CANCELLED | {
33
34
  error: unknown;
34
35
  }) => void;
35
36
  /** Informs an auth attempt initialized, and provides insight into which auth option it is */
@@ -59,6 +59,10 @@ const getVerifyArgs = (_a) => _tslib.__awaiter(void 0, [_a], void 0, function* (
59
59
  });
60
60
  return result;
61
61
  }
62
+ if (!nonce.getNonce()) {
63
+ logger.logger.debug('[getVerifyArgs] Nonce missing, attempting to fetch');
64
+ yield nonce.fetchAndStoreNonce();
65
+ }
62
66
  const nonce$1 = nonce.consumeNonce();
63
67
  // generate message to sign and then initiate signing step to prove ownership
64
68
  const { messageToSign, signedMessage } = yield index.generateMessages(publicWalletAddress, walletConnector, nonce$1, environmentId, displaySiweStatement, siweStatement);
@@ -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, {
@@ -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({
@@ -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) => {
@@ -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
  },
@@ -6,11 +6,11 @@ Object.defineProperty(exports, '__esModule', { value: true });
6
6
  var _tslib = require('../../../../../_virtual/_tslib.cjs');
7
7
  var React = require('react');
8
8
  var reactInternationalPhone = require('react-international-phone');
9
+ var utils = require('@dynamic-labs/utils');
9
10
  require('../../../context/DynamicContext/useDynamicContext/useDynamicContext.cjs');
10
11
  var useInternalDynamicContext = require('../../../context/DynamicContext/useDynamicContext/useInternalDynamicContext/useInternalDynamicContext.cjs');
11
12
  var VerificationContext = require('../../../context/VerificationContext/VerificationContext.cjs');
12
13
  require('@dynamic-labs-sdk/client');
13
- require('@dynamic-labs/utils');
14
14
  require('@dynamic-labs/sdk-api-core');
15
15
  require('@dynamic-labs-sdk/client/core');
16
16
  require('eventemitter3');
@@ -144,7 +144,7 @@ const useSmsVerification = (type) => {
144
144
  logger.logger.warn('WARNING: emitted smsVerificationResult with incomplete params because retryData was undefined');
145
145
  dynamicEvents.dynamicEvents.emit('smsVerificationResult', isValidatedRef.current, phone);
146
146
  if (!isValidatedRef.current)
147
- dynamicEvents.dynamicEvents.emit('authFailure', { option: phone, phone, type: 'sms' }, 'user-cancelled');
147
+ dynamicEvents.dynamicEvents.emit('authFailure', { option: phone, phone, type: 'sms' }, utils.SdkErrorCode.USER_CANCELLED);
148
148
  });
149
149
  const retryOneTimePassword = () => _tslib.__awaiter(void 0, void 0, void 0, function* () {
150
150
  setError(undefined);
@@ -2,11 +2,11 @@
2
2
  import { __awaiter } from '../../../../../_virtual/_tslib.js';
3
3
  import { useState, useRef, useCallback } from 'react';
4
4
  import { removeDialCode } from 'react-international-phone';
5
+ import { SdkErrorCode } from '@dynamic-labs/utils';
5
6
  import '../../../context/DynamicContext/useDynamicContext/useDynamicContext.js';
6
7
  import { useInternalDynamicContext } from '../../../context/DynamicContext/useDynamicContext/useInternalDynamicContext/useInternalDynamicContext.js';
7
8
  import { useVerification } from '../../../context/VerificationContext/VerificationContext.js';
8
9
  import '@dynamic-labs-sdk/client';
9
- import '@dynamic-labs/utils';
10
10
  import '@dynamic-labs/sdk-api-core';
11
11
  import '@dynamic-labs-sdk/client/core';
12
12
  import 'eventemitter3';
@@ -140,7 +140,7 @@ const useSmsVerification = (type) => {
140
140
  logger.warn('WARNING: emitted smsVerificationResult with incomplete params because retryData was undefined');
141
141
  dynamicEvents.emit('smsVerificationResult', isValidatedRef.current, phone);
142
142
  if (!isValidatedRef.current)
143
- dynamicEvents.emit('authFailure', { option: phone, phone, type: 'sms' }, 'user-cancelled');
143
+ dynamicEvents.emit('authFailure', { option: phone, phone, type: 'sms' }, SdkErrorCode.USER_CANCELLED);
144
144
  });
145
145
  const retryOneTimePassword = () => __awaiter(void 0, void 0, void 0, function* () {
146
146
  setError(undefined);