@dynamic-labs/sdk-react-core 4.77.3 → 4.77.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +16 -0
- package/package.cjs +1 -1
- package/package.js +1 -1
- package/package.json +12 -12
- package/src/lib/context/CaptchaContext/CaptchaContext.cjs +13 -0
- package/src/lib/context/CaptchaContext/CaptchaContext.js +13 -0
- package/src/lib/context/DynamicContext/DynamicContext.cjs +2 -2
- package/src/lib/context/DynamicContext/DynamicContext.js +2 -2
- package/src/lib/context/ErrorContext/ErrorContext.cjs +16 -4
- package/src/lib/context/ErrorContext/ErrorContext.d.ts +2 -2
- package/src/lib/context/ErrorContext/ErrorContext.js +16 -4
- package/src/lib/context/ViewContext/ViewContext.cjs +12 -12
- package/src/lib/context/ViewContext/ViewContext.d.ts +1 -0
- package/src/lib/context/ViewContext/ViewContext.js +12 -12
- package/src/lib/context/ViewContext/types/index.d.ts +1 -1
- package/src/lib/layout/DynamicAuthLayout/Header/header.cjs +1 -1
- package/src/lib/layout/DynamicAuthLayout/Header/header.js +1 -1
- package/src/lib/utils/hooks/authenticationHooks/useConnectAndSign/useConnectAndSign.cjs +2 -2
- package/src/lib/utils/hooks/authenticationHooks/useConnectAndSign/useConnectAndSign.js +2 -2
- package/src/lib/utils/hooks/useEmbeddedWallet/useSecureEnclaveEmbeddedWallet/useTurnkey/useTurnkey.cjs +5 -3
- package/src/lib/utils/hooks/useEmbeddedWallet/useSecureEnclaveEmbeddedWallet/useTurnkey/useTurnkey.js +5 -3
- package/src/lib/views/AuthLoadingView/AuthLoadingView.cjs +8 -0
- package/src/lib/views/AuthLoadingView/AuthLoadingView.d.ts +2 -0
- package/src/lib/views/AuthLoadingView/AuthLoadingView.js +4 -0
- package/src/lib/views/AuthLoadingView/index.d.ts +1 -0
- package/src/lib/views/viewToComponentMap.cjs +2 -0
- package/src/lib/views/viewToComponentMap.d.ts +1 -0
- package/src/lib/views/viewToComponentMap.js +2 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,4 +1,20 @@
|
|
|
1
1
|
|
|
2
|
+
### [4.77.4](https://github.com/dynamic-labs/dynamic-auth/compare/v4.77.3...v4.77.4) (2026-04-21)
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
### Features
|
|
6
|
+
|
|
7
|
+
* **sdk-react-core:** log ui.fallback_error_shown when generic error surfaces ([#10972](https://github.com/dynamic-labs/dynamic-auth/issues/10972)) ([7aee5d1](https://github.com/dynamic-labs/dynamic-auth/commit/7aee5d1a518121742a6ffcc3d3e1101d70b1cc29))
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
### Bug Fixes
|
|
11
|
+
|
|
12
|
+
* Add SSR-safe defaults to CaptchaContext ([#10977](https://github.com/dynamic-labs/dynamic-auth/issues/10977)) ([bdf4e80](https://github.com/dynamic-labs/dynamic-auth/commit/bdf4e809c0fd6382961d7b079dbdde25678ecbb1))
|
|
13
|
+
* **DYNT-400:** update Trust Wallet flag from isTrustWallet to isTrust ([#10917](https://github.com/dynamic-labs/dynamic-auth/issues/10917)) ([1ca616a](https://github.com/dynamic-labs/dynamic-auth/commit/1ca616a926ce35d5a75e4611049ef0a05b96865d))
|
|
14
|
+
* lower retry count for viem calls ([#10984](https://github.com/dynamic-labs/dynamic-auth/issues/10984)) ([37843df](https://github.com/dynamic-labs/dynamic-auth/commit/37843dffb2bf31bdc0d7f3e91b65656e3af745f9))
|
|
15
|
+
* show correct loading view when new view is selected ([#10981](https://github.com/dynamic-labs/dynamic-auth/issues/10981)) ([eb650a4](https://github.com/dynamic-labs/dynamic-auth/commit/eb650a4ba62cf12c03f03bfa0866fdc3d30503a1))
|
|
16
|
+
* **wagmi-connector:** promote onAccountsChanged log to instrument for backend visibility DYNT-549 ([#10982](https://github.com/dynamic-labs/dynamic-auth/issues/10982)) ([5087227](https://github.com/dynamic-labs/dynamic-auth/commit/508722724a049737da49fd0320e97d19f6249fce))
|
|
17
|
+
|
|
2
18
|
### [4.77.3](https://github.com/dynamic-labs/dynamic-auth/compare/v4.77.2...v4.77.3) (2026-04-18)
|
|
3
19
|
|
|
4
20
|
|
package/package.cjs
CHANGED
package/package.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dynamic-labs/sdk-react-core",
|
|
3
|
-
"version": "4.77.
|
|
3
|
+
"version": "4.77.4",
|
|
4
4
|
"dependencies": {
|
|
5
5
|
"@dynamic-labs/sdk-api-core": "0.0.927",
|
|
6
6
|
"@dynamic-labs-sdk/client": "0.24.0",
|
|
@@ -16,17 +16,17 @@
|
|
|
16
16
|
"yup": "0.32.11",
|
|
17
17
|
"react-international-phone": "4.5.0",
|
|
18
18
|
"bs58": "5.0.0",
|
|
19
|
-
"@dynamic-labs/assert-package-version": "4.77.
|
|
20
|
-
"@dynamic-labs/iconic": "4.77.
|
|
21
|
-
"@dynamic-labs/locale": "4.77.
|
|
22
|
-
"@dynamic-labs/logger": "4.77.
|
|
23
|
-
"@dynamic-labs/multi-wallet": "4.77.
|
|
24
|
-
"@dynamic-labs/rpc-providers": "4.77.
|
|
25
|
-
"@dynamic-labs/store": "4.77.
|
|
26
|
-
"@dynamic-labs/types": "4.77.
|
|
27
|
-
"@dynamic-labs/utils": "4.77.
|
|
28
|
-
"@dynamic-labs/wallet-book": "4.77.
|
|
29
|
-
"@dynamic-labs/wallet-connector-core": "4.77.
|
|
19
|
+
"@dynamic-labs/assert-package-version": "4.77.4",
|
|
20
|
+
"@dynamic-labs/iconic": "4.77.4",
|
|
21
|
+
"@dynamic-labs/locale": "4.77.4",
|
|
22
|
+
"@dynamic-labs/logger": "4.77.4",
|
|
23
|
+
"@dynamic-labs/multi-wallet": "4.77.4",
|
|
24
|
+
"@dynamic-labs/rpc-providers": "4.77.4",
|
|
25
|
+
"@dynamic-labs/store": "4.77.4",
|
|
26
|
+
"@dynamic-labs/types": "4.77.4",
|
|
27
|
+
"@dynamic-labs/utils": "4.77.4",
|
|
28
|
+
"@dynamic-labs/wallet-book": "4.77.4",
|
|
29
|
+
"@dynamic-labs/wallet-connector-core": "4.77.4",
|
|
30
30
|
"eventemitter3": "5.0.1"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
|
@@ -110,6 +110,13 @@ require('../../store/state/multichainBalances.cjs');
|
|
|
110
110
|
require('../../shared/utils/functions/getInitialUrl/getInitialUrl.cjs');
|
|
111
111
|
var useInternalDynamicContext = require('../DynamicContext/useDynamicContext/useInternalDynamicContext/useInternalDynamicContext.cjs');
|
|
112
112
|
|
|
113
|
+
const SSR_SAFE_DEFAULT = {
|
|
114
|
+
captchaAuthState: undefined,
|
|
115
|
+
engageCaptcha: () => { },
|
|
116
|
+
getCaptchaToken: () => undefined,
|
|
117
|
+
setCaptchaAuthState: () => { },
|
|
118
|
+
setCaptchaToken: () => { },
|
|
119
|
+
};
|
|
113
120
|
const CaptchaContext = React.createContext(undefined);
|
|
114
121
|
const CaptchaContextProvider = ({ children, }) => {
|
|
115
122
|
const { pushView } = ViewContext.useViewContext();
|
|
@@ -146,6 +153,12 @@ const CaptchaContextProvider = ({ children, }) => {
|
|
|
146
153
|
const useCaptchaContext = () => {
|
|
147
154
|
const context = React.useContext(CaptchaContext);
|
|
148
155
|
if (context === undefined) {
|
|
156
|
+
// Next.js 16.2+ prerenders client components during static generation of
|
|
157
|
+
// /_not-found outside of their provider tree. Return safe defaults during
|
|
158
|
+
// SSR so the build can complete; the real provider is available at runtime.
|
|
159
|
+
if (typeof window === 'undefined') {
|
|
160
|
+
return SSR_SAFE_DEFAULT;
|
|
161
|
+
}
|
|
149
162
|
throw new Error('usage of useCaptchaContext not wrapped in `CaptchaContextProvider`.');
|
|
150
163
|
}
|
|
151
164
|
return context;
|
|
@@ -106,6 +106,13 @@ import '../../store/state/multichainBalances.js';
|
|
|
106
106
|
import '../../shared/utils/functions/getInitialUrl/getInitialUrl.js';
|
|
107
107
|
import { useInternalDynamicContext } from '../DynamicContext/useDynamicContext/useInternalDynamicContext/useInternalDynamicContext.js';
|
|
108
108
|
|
|
109
|
+
const SSR_SAFE_DEFAULT = {
|
|
110
|
+
captchaAuthState: undefined,
|
|
111
|
+
engageCaptcha: () => { },
|
|
112
|
+
getCaptchaToken: () => undefined,
|
|
113
|
+
setCaptchaAuthState: () => { },
|
|
114
|
+
setCaptchaToken: () => { },
|
|
115
|
+
};
|
|
109
116
|
const CaptchaContext = createContext(undefined);
|
|
110
117
|
const CaptchaContextProvider = ({ children, }) => {
|
|
111
118
|
const { pushView } = useViewContext();
|
|
@@ -142,6 +149,12 @@ const CaptchaContextProvider = ({ children, }) => {
|
|
|
142
149
|
const useCaptchaContext = () => {
|
|
143
150
|
const context = useContext(CaptchaContext);
|
|
144
151
|
if (context === undefined) {
|
|
152
|
+
// Next.js 16.2+ prerenders client components during static generation of
|
|
153
|
+
// /_not-found outside of their provider tree. Return safe defaults during
|
|
154
|
+
// SSR so the build can complete; the real provider is available at runtime.
|
|
155
|
+
if (typeof window === 'undefined') {
|
|
156
|
+
return SSR_SAFE_DEFAULT;
|
|
157
|
+
}
|
|
145
158
|
throw new Error('usage of useCaptchaContext not wrapped in `CaptchaContextProvider`.');
|
|
146
159
|
}
|
|
147
160
|
return context;
|
|
@@ -737,7 +737,7 @@ const InnerDynamicContextProvider = (props) => {
|
|
|
737
737
|
id: 'wallet-book',
|
|
738
738
|
type: 'application/json',
|
|
739
739
|
});
|
|
740
|
-
const
|
|
740
|
+
const loginViewType = useInitialViewType.useInitialViewType({
|
|
741
741
|
bridgeOnboardingCompleted,
|
|
742
742
|
connectedWallets,
|
|
743
743
|
isAuthenticated: isAuthenticated || Boolean(primaryWallet),
|
|
@@ -745,7 +745,7 @@ const InnerDynamicContextProvider = (props) => {
|
|
|
745
745
|
isMultiWalletEnabled: multiWallet,
|
|
746
746
|
user: user !== null && user !== void 0 ? user : userWithMissingInfo,
|
|
747
747
|
});
|
|
748
|
-
return (jsxRuntime.jsx(reactI18next.I18nextProvider, { i18n: i18nSDKInstance, children: jsxRuntime.jsxs(DynamicContext.Provider, { value: value, children: [(jsxRuntime.jsx("style", { nonce: cspNonce, children: main_global })), jsxRuntime.jsx(walletBook.WalletBookContextProvider, { walletBook: walletBook$1, children: jsxRuntime.jsx(ThemeContext.ThemeContextProvider, { cspNonce: cspNonce, customerTheme: parseTheme.parseTheme(theme, ((_w = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.design) === null || _w === void 0 ? void 0 : _w.modal) || undefined), designSettings: projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.design, children: jsxRuntime.jsx(LoadingContext.LoadingContextProvider, { children: jsxRuntime.jsxs(ViewContext.ViewContextProvider, { initialViewType:
|
|
748
|
+
return (jsxRuntime.jsx(reactI18next.I18nextProvider, { i18n: i18nSDKInstance, children: jsxRuntime.jsxs(DynamicContext.Provider, { value: value, children: [(jsxRuntime.jsx("style", { nonce: cspNonce, children: main_global })), jsxRuntime.jsx(walletBook.WalletBookContextProvider, { walletBook: walletBook$1, children: jsxRuntime.jsx(ThemeContext.ThemeContextProvider, { cspNonce: cspNonce, customerTheme: parseTheme.parseTheme(theme, ((_w = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.design) === null || _w === void 0 ? void 0 : _w.modal) || undefined), designSettings: projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.design, children: jsxRuntime.jsx(LoadingContext.LoadingContextProvider, { children: jsxRuntime.jsxs(ViewContext.ViewContextProvider, { initialViewType: 'auth-loading', loginViewType: loginViewType, children: [networkValidationMode === 'always' && jsxRuntime.jsx(UseNetworkValidation.UseNetworkValidation, {}), jsxRuntime.jsx(CaptchaContext.CaptchaContextProvider, { children: jsxRuntime.jsx(AccountExistsContext.AccountExistsContextProvider, { children: jsxRuntime.jsx(WalletContext.WalletContextProvider, { children: jsxRuntime.jsx(VerificationContext.VerificationProvider, { children: jsxRuntime.jsx(PasskeyContext.PasskeyContextProvider, { children: jsxRuntime.jsx(DynamicWidgetContext.DynamicWidgetContextProvider, { children: jsxRuntime.jsx(DynamicBridgeWidgetContext.DynamicBridgeWidgetContextProvider, { children: jsxRuntime.jsx(OnrampContext.OnrampContextProvider, { children: jsxRuntime.jsx(AccessDeniedContext.AccessDeniedContextProvider, { children: jsxRuntime.jsx(SendBalanceContext.SendBalanceContextProvider, { children: jsxRuntime.jsx(WalletGroupContext.WalletGroupContextProvider, { children: jsxRuntime.jsx(UserFieldEditorContext.UserFieldEditorContextProvider, { children: jsxRuntime.jsx(ConnectWithOtpProvider.ConnectWithOtpProvider, { children: jsxRuntime.jsx(PhantomRedirectContext.PhantomRedirectContextProvider, { children: jsxRuntime.jsxs(SocialRedirectContext.SocialRedirectContextProvider, { children: [jsxRuntime.jsx(app.DynamicAuthFlow, {}), jsxRuntime.jsx(OnrampWidget.OnrampWidget, {}), jsxRuntime.jsx(SyncAuthFlow.SyncAuthFlow, {}), jsxRuntime.jsx(WalletConnectorEvents.WalletConnectorEvents, { connectorProps: connectorProps }), confirmationModal, jsxRuntime.jsx(ErrorBoundaryExclude.ErrorBoundaryExclude, { children: children })] }) }) }) }) }) }) }) }) }) }) }) }) }) }) })] }) }) }) })] }) }));
|
|
749
749
|
};
|
|
750
750
|
/** The context provider you need to have access too all of Dynamic's hooks */
|
|
751
751
|
const DynamicContextProvider = (props) => {
|
|
@@ -733,7 +733,7 @@ const InnerDynamicContextProvider = (props) => {
|
|
|
733
733
|
id: 'wallet-book',
|
|
734
734
|
type: 'application/json',
|
|
735
735
|
});
|
|
736
|
-
const
|
|
736
|
+
const loginViewType = useInitialViewType({
|
|
737
737
|
bridgeOnboardingCompleted,
|
|
738
738
|
connectedWallets,
|
|
739
739
|
isAuthenticated: isAuthenticated || Boolean(primaryWallet),
|
|
@@ -741,7 +741,7 @@ const InnerDynamicContextProvider = (props) => {
|
|
|
741
741
|
isMultiWalletEnabled: multiWallet,
|
|
742
742
|
user: user !== null && user !== void 0 ? user : userWithMissingInfo,
|
|
743
743
|
});
|
|
744
|
-
return (jsx(I18nextProvider, { i18n: i18nSDKInstance, children: jsxs(DynamicContext.Provider, { value: value, children: [(jsx("style", { nonce: cspNonce, children: css_248z })), jsx(WalletBookContextProvider, { walletBook: walletBook, children: jsx(ThemeContextProvider, { cspNonce: cspNonce, customerTheme: parseTheme(theme, ((_w = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.design) === null || _w === void 0 ? void 0 : _w.modal) || undefined), designSettings: projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.design, children: jsx(LoadingContextProvider, { children: jsxs(ViewContextProvider, { initialViewType:
|
|
744
|
+
return (jsx(I18nextProvider, { i18n: i18nSDKInstance, children: jsxs(DynamicContext.Provider, { value: value, children: [(jsx("style", { nonce: cspNonce, children: css_248z })), jsx(WalletBookContextProvider, { walletBook: walletBook, children: jsx(ThemeContextProvider, { cspNonce: cspNonce, customerTheme: parseTheme(theme, ((_w = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.design) === null || _w === void 0 ? void 0 : _w.modal) || undefined), designSettings: projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.design, children: jsx(LoadingContextProvider, { children: jsxs(ViewContextProvider, { initialViewType: 'auth-loading', loginViewType: loginViewType, children: [networkValidationMode === 'always' && jsx(UseNetworkValidation, {}), jsx(CaptchaContextProvider, { children: jsx(AccountExistsContextProvider, { children: jsx(WalletContextProvider, { children: jsx(VerificationProvider, { children: jsx(PasskeyContextProvider, { children: jsx(DynamicWidgetContextProvider, { children: jsx(DynamicBridgeWidgetContextProvider, { children: jsx(OnrampContextProvider, { children: jsx(AccessDeniedContextProvider, { children: jsx(SendBalanceContextProvider, { children: jsx(WalletGroupContextProvider, { children: jsx(UserFieldEditorContextProvider, { children: jsx(ConnectWithOtpProvider, { children: jsx(PhantomRedirectContextProvider, { children: jsxs(SocialRedirectContextProvider, { children: [jsx(DynamicAuthFlow, {}), jsx(OnrampWidget, {}), jsx(SyncAuthFlow, {}), jsx(WalletConnectorEvents, { connectorProps: connectorProps }), confirmationModal, jsx(ErrorBoundaryExclude, { children: children })] }) }) }) }) }) }) }) }) }) }) }) }) }) }) })] }) }) }) })] }) }));
|
|
745
745
|
};
|
|
746
746
|
/** The context provider you need to have access too all of Dynamic's hooks */
|
|
747
747
|
const DynamicContextProvider = (props) => {
|
|
@@ -6,7 +6,9 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
6
6
|
var jsxRuntime = require('react/jsx-runtime');
|
|
7
7
|
var React = require('react');
|
|
8
8
|
var utils = require('@dynamic-labs/utils');
|
|
9
|
+
var logger = require('../../shared/logger.cjs');
|
|
9
10
|
|
|
11
|
+
const FALLBACK_ERROR_LOG_EVENT = 'ui.fallback_error_shown';
|
|
10
12
|
/** @deprecated Prefer setError with a translation key instead */
|
|
11
13
|
const errorMessageMap = {
|
|
12
14
|
'-32000': 'Message signature denied',
|
|
@@ -43,13 +45,23 @@ const ErrorContextProvider = ({ children }) => {
|
|
|
43
45
|
_setErrorCode(errorCode);
|
|
44
46
|
}, []);
|
|
45
47
|
/** Uses the default error message for fallbacks */
|
|
46
|
-
const setDefaultError = React.useCallback(() => {
|
|
48
|
+
const setDefaultError = React.useCallback((error) => {
|
|
49
|
+
logger.logger.error(FALLBACK_ERROR_LOG_EVENT, {
|
|
50
|
+
errorCode: utils.ErrorCode.DEFAULT,
|
|
51
|
+
source: 'setDefaultError',
|
|
52
|
+
}, error);
|
|
47
53
|
setError('Something went wrong. Please try again.', utils.ErrorCode.DEFAULT);
|
|
48
54
|
}, [setError]);
|
|
49
55
|
/** @deprecated Prefer setError with a translation key instead */
|
|
50
|
-
const setErrorMessage = React.useCallback((status) => {
|
|
51
|
-
|
|
52
|
-
|
|
56
|
+
const setErrorMessage = React.useCallback((status, error) => {
|
|
57
|
+
const mappedMessage = errorMessageMap[status];
|
|
58
|
+
if (!mappedMessage) {
|
|
59
|
+
logger.logger.error(FALLBACK_ERROR_LOG_EVENT, {
|
|
60
|
+
errorCode: status,
|
|
61
|
+
source: 'setErrorMessage',
|
|
62
|
+
}, error);
|
|
63
|
+
}
|
|
64
|
+
setError(mappedMessage !== null && mappedMessage !== void 0 ? mappedMessage : 'Something went wrong. Please try again.');
|
|
53
65
|
}, [setError]);
|
|
54
66
|
const clearError = React.useCallback(() => {
|
|
55
67
|
_setError(undefined);
|
|
@@ -4,8 +4,8 @@ interface ErrorContextProps {
|
|
|
4
4
|
error: string | undefined;
|
|
5
5
|
errorCode: ErrorCode | string | undefined;
|
|
6
6
|
setError(error: string | undefined, errorCode?: ErrorCode | string): void;
|
|
7
|
-
setErrorMessage: (status: string) => void;
|
|
8
|
-
setDefaultError: () => void;
|
|
7
|
+
setErrorMessage: (status: string, error?: unknown) => void;
|
|
8
|
+
setDefaultError: (error?: unknown) => void;
|
|
9
9
|
clearError(): void;
|
|
10
10
|
}
|
|
11
11
|
export declare const ErrorContext: import("react").Context<ErrorContextProps | undefined>;
|
|
@@ -2,7 +2,9 @@
|
|
|
2
2
|
import { jsx } from 'react/jsx-runtime';
|
|
3
3
|
import { createContext, useState, useCallback, useMemo, useContext } from 'react';
|
|
4
4
|
import { ErrorCode } from '@dynamic-labs/utils';
|
|
5
|
+
import { logger } from '../../shared/logger.js';
|
|
5
6
|
|
|
7
|
+
const FALLBACK_ERROR_LOG_EVENT = 'ui.fallback_error_shown';
|
|
6
8
|
/** @deprecated Prefer setError with a translation key instead */
|
|
7
9
|
const errorMessageMap = {
|
|
8
10
|
'-32000': 'Message signature denied',
|
|
@@ -39,13 +41,23 @@ const ErrorContextProvider = ({ children }) => {
|
|
|
39
41
|
_setErrorCode(errorCode);
|
|
40
42
|
}, []);
|
|
41
43
|
/** Uses the default error message for fallbacks */
|
|
42
|
-
const setDefaultError = useCallback(() => {
|
|
44
|
+
const setDefaultError = useCallback((error) => {
|
|
45
|
+
logger.error(FALLBACK_ERROR_LOG_EVENT, {
|
|
46
|
+
errorCode: ErrorCode.DEFAULT,
|
|
47
|
+
source: 'setDefaultError',
|
|
48
|
+
}, error);
|
|
43
49
|
setError('Something went wrong. Please try again.', ErrorCode.DEFAULT);
|
|
44
50
|
}, [setError]);
|
|
45
51
|
/** @deprecated Prefer setError with a translation key instead */
|
|
46
|
-
const setErrorMessage = useCallback((status) => {
|
|
47
|
-
|
|
48
|
-
|
|
52
|
+
const setErrorMessage = useCallback((status, error) => {
|
|
53
|
+
const mappedMessage = errorMessageMap[status];
|
|
54
|
+
if (!mappedMessage) {
|
|
55
|
+
logger.error(FALLBACK_ERROR_LOG_EVENT, {
|
|
56
|
+
errorCode: status,
|
|
57
|
+
source: 'setErrorMessage',
|
|
58
|
+
}, error);
|
|
59
|
+
}
|
|
60
|
+
setError(mappedMessage !== null && mappedMessage !== void 0 ? mappedMessage : 'Something went wrong. Please try again.');
|
|
49
61
|
}, [setError]);
|
|
50
62
|
const clearError = useCallback(() => {
|
|
51
63
|
_setError(undefined);
|
|
@@ -10,8 +10,11 @@ var ErrorContext = require('../ErrorContext/ErrorContext.cjs');
|
|
|
10
10
|
var dynamicEvents = require('../../events/dynamicEvents.cjs');
|
|
11
11
|
|
|
12
12
|
const ViewContext = React.createContext(undefined);
|
|
13
|
-
const ViewContextProvider = ({ children, initialViewType }) => {
|
|
13
|
+
const ViewContextProvider = ({ children, initialViewType, loginViewType }) => {
|
|
14
14
|
var _a;
|
|
15
|
+
// effectiveLoginViewType drives back-navigation, empty-stack fallback, and clearStackAndPushInitialView.
|
|
16
|
+
// It is reactive: when loginViewType changes (e.g. after logout) the fallback view updates automatically.
|
|
17
|
+
const effectiveLoginViewType = loginViewType !== null && loginViewType !== void 0 ? loginViewType : initialViewType;
|
|
15
18
|
const [stack, setStack] = React.useState([]);
|
|
16
19
|
const authFlowCloseTimeoutRef = React.useRef(null);
|
|
17
20
|
const cancelAuthFlowCloseTimeout = React.useCallback(() => {
|
|
@@ -20,8 +23,9 @@ const ViewContextProvider = ({ children, initialViewType }) => {
|
|
|
20
23
|
authFlowCloseTimeoutRef.current = null;
|
|
21
24
|
}
|
|
22
25
|
}, []);
|
|
23
|
-
const
|
|
24
|
-
|
|
26
|
+
const view = (_a = stack[stack.length - 1]) !== null && _a !== void 0 ? _a : {
|
|
27
|
+
type: effectiveLoginViewType,
|
|
28
|
+
};
|
|
25
29
|
const { clearError } = ErrorContext.useErrorContext();
|
|
26
30
|
const pushView = React.useCallback((type, props, events) => {
|
|
27
31
|
if (view.type === type) {
|
|
@@ -38,11 +42,11 @@ const ViewContextProvider = ({ children, initialViewType }) => {
|
|
|
38
42
|
// reflects this by having this default view as the first item in the stack
|
|
39
43
|
setStack((stack) => {
|
|
40
44
|
if (stack.length === 0)
|
|
41
|
-
return [{ type:
|
|
45
|
+
return [{ type: effectiveLoginViewType }, { events, props, type }];
|
|
42
46
|
else
|
|
43
47
|
return [...stack, { events, props, type }];
|
|
44
48
|
});
|
|
45
|
-
}, [cancelAuthFlowCloseTimeout, clearError, view.type,
|
|
49
|
+
}, [cancelAuthFlowCloseTimeout, clearError, view.type, effectiveLoginViewType]);
|
|
46
50
|
const replaceView = React.useCallback((type, props, events) => {
|
|
47
51
|
if (view.type === type)
|
|
48
52
|
return;
|
|
@@ -50,11 +54,11 @@ const ViewContextProvider = ({ children, initialViewType }) => {
|
|
|
50
54
|
clearError();
|
|
51
55
|
setStack((prev) => {
|
|
52
56
|
if (prev.length <= 1) {
|
|
53
|
-
return [{ type:
|
|
57
|
+
return [{ type: effectiveLoginViewType }, { events, props, type }];
|
|
54
58
|
}
|
|
55
59
|
return [...prev.slice(0, -1), { events, props, type }];
|
|
56
60
|
});
|
|
57
|
-
}, [cancelAuthFlowCloseTimeout, clearError,
|
|
61
|
+
}, [cancelAuthFlowCloseTimeout, clearError, effectiveLoginViewType, view.type]);
|
|
58
62
|
const canGoBack = stack.length > 1;
|
|
59
63
|
const goBack = React.useCallback(() => {
|
|
60
64
|
if (!canGoBack)
|
|
@@ -70,11 +74,7 @@ const ViewContextProvider = ({ children, initialViewType }) => {
|
|
|
70
74
|
}, [cancelAuthFlowCloseTimeout, clearError]);
|
|
71
75
|
const clearStackAndPushInitialView = React.useCallback(() => {
|
|
72
76
|
clearError();
|
|
73
|
-
setStack((
|
|
74
|
-
if (stack.length > 0)
|
|
75
|
-
return [];
|
|
76
|
-
return stack;
|
|
77
|
-
});
|
|
77
|
+
setStack((prev) => (prev.length > 0 ? [] : prev));
|
|
78
78
|
}, [clearError]);
|
|
79
79
|
useDynamicEvents.useInternalDynamicEvents('logout', clearStackAndPushInitialView);
|
|
80
80
|
// Wait for the auth flow animation transition to finish before clearing the stack
|
|
@@ -38,6 +38,7 @@ export type ViewContextProps = {
|
|
|
38
38
|
};
|
|
39
39
|
type ViewContextProviderProps = {
|
|
40
40
|
initialViewType: ViewType;
|
|
41
|
+
loginViewType?: ViewType;
|
|
41
42
|
};
|
|
42
43
|
export declare const ViewContext: import("react").Context<ViewContextProps | undefined>;
|
|
43
44
|
export declare const ViewContextProvider: FC<PropsWithChildren<ViewContextProviderProps>>;
|
|
@@ -6,8 +6,11 @@ import { useErrorContext } from '../ErrorContext/ErrorContext.js';
|
|
|
6
6
|
import { dynamicEvents } from '../../events/dynamicEvents.js';
|
|
7
7
|
|
|
8
8
|
const ViewContext = createContext(undefined);
|
|
9
|
-
const ViewContextProvider = ({ children, initialViewType }) => {
|
|
9
|
+
const ViewContextProvider = ({ children, initialViewType, loginViewType }) => {
|
|
10
10
|
var _a;
|
|
11
|
+
// effectiveLoginViewType drives back-navigation, empty-stack fallback, and clearStackAndPushInitialView.
|
|
12
|
+
// It is reactive: when loginViewType changes (e.g. after logout) the fallback view updates automatically.
|
|
13
|
+
const effectiveLoginViewType = loginViewType !== null && loginViewType !== void 0 ? loginViewType : initialViewType;
|
|
11
14
|
const [stack, setStack] = useState([]);
|
|
12
15
|
const authFlowCloseTimeoutRef = useRef(null);
|
|
13
16
|
const cancelAuthFlowCloseTimeout = useCallback(() => {
|
|
@@ -16,8 +19,9 @@ const ViewContextProvider = ({ children, initialViewType }) => {
|
|
|
16
19
|
authFlowCloseTimeoutRef.current = null;
|
|
17
20
|
}
|
|
18
21
|
}, []);
|
|
19
|
-
const
|
|
20
|
-
|
|
22
|
+
const view = (_a = stack[stack.length - 1]) !== null && _a !== void 0 ? _a : {
|
|
23
|
+
type: effectiveLoginViewType,
|
|
24
|
+
};
|
|
21
25
|
const { clearError } = useErrorContext();
|
|
22
26
|
const pushView = useCallback((type, props, events) => {
|
|
23
27
|
if (view.type === type) {
|
|
@@ -34,11 +38,11 @@ const ViewContextProvider = ({ children, initialViewType }) => {
|
|
|
34
38
|
// reflects this by having this default view as the first item in the stack
|
|
35
39
|
setStack((stack) => {
|
|
36
40
|
if (stack.length === 0)
|
|
37
|
-
return [{ type:
|
|
41
|
+
return [{ type: effectiveLoginViewType }, { events, props, type }];
|
|
38
42
|
else
|
|
39
43
|
return [...stack, { events, props, type }];
|
|
40
44
|
});
|
|
41
|
-
}, [cancelAuthFlowCloseTimeout, clearError, view.type,
|
|
45
|
+
}, [cancelAuthFlowCloseTimeout, clearError, view.type, effectiveLoginViewType]);
|
|
42
46
|
const replaceView = useCallback((type, props, events) => {
|
|
43
47
|
if (view.type === type)
|
|
44
48
|
return;
|
|
@@ -46,11 +50,11 @@ const ViewContextProvider = ({ children, initialViewType }) => {
|
|
|
46
50
|
clearError();
|
|
47
51
|
setStack((prev) => {
|
|
48
52
|
if (prev.length <= 1) {
|
|
49
|
-
return [{ type:
|
|
53
|
+
return [{ type: effectiveLoginViewType }, { events, props, type }];
|
|
50
54
|
}
|
|
51
55
|
return [...prev.slice(0, -1), { events, props, type }];
|
|
52
56
|
});
|
|
53
|
-
}, [cancelAuthFlowCloseTimeout, clearError,
|
|
57
|
+
}, [cancelAuthFlowCloseTimeout, clearError, effectiveLoginViewType, view.type]);
|
|
54
58
|
const canGoBack = stack.length > 1;
|
|
55
59
|
const goBack = useCallback(() => {
|
|
56
60
|
if (!canGoBack)
|
|
@@ -66,11 +70,7 @@ const ViewContextProvider = ({ children, initialViewType }) => {
|
|
|
66
70
|
}, [cancelAuthFlowCloseTimeout, clearError]);
|
|
67
71
|
const clearStackAndPushInitialView = useCallback(() => {
|
|
68
72
|
clearError();
|
|
69
|
-
setStack((
|
|
70
|
-
if (stack.length > 0)
|
|
71
|
-
return [];
|
|
72
|
-
return stack;
|
|
73
|
-
});
|
|
73
|
+
setStack((prev) => (prev.length > 0 ? [] : prev));
|
|
74
74
|
}, [clearError]);
|
|
75
75
|
useInternalDynamicEvents('logout', clearStackAndPushInitialView);
|
|
76
76
|
// Wait for the auth flow animation transition to finish before clearing the stack
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ComponentProps, FC } from 'react';
|
|
2
2
|
import type { viewToComponentMap } from '../../../views/viewToComponentMap';
|
|
3
|
-
export type ViewType = 'access-blocked' | 'account-upgraded' | 'backup-unsuccessful' | 'select-hardware-wallet' | 'captcha' | 'chainalysis-blocked-wallet' | 'collect-user-data' | 'collect-user-data-login-no-wallet' | 'device-registration' | 'login-with-email-or-wallet-full-wallet-list' | 'login-with-email-or-wallet' | 'login-with-wallet-only' | 'login-with-email-verification' | 'login-with-sms-verification' | 'network-not-supported' | 'network-not-supported-manual' | 'no-access' | 'no-qr-not-installed' | 'pending-connect' | 'pending-signature-without-back-button' | 'pending-signature' | 'qr-code' | 'verify-email' | 'verify-sms' | 'wallet-connect-mobile-wallets-list' | 'wallet-list' | 'unified-wallet-exchange-list' | 'external-funding-exchange-list' | 'external-funding-wallet-list' | 'mfa-exchange-view' | 'exchange-whitelist-warning' | 'sandbox-maximum-threshold-reached' | 'multi-wallet-wallet-list' | 'duplicate-wallet' | 'wallet-sign' | 'wallet-used' | 'wallet-group' | 'select-wallet-in-wallet-group' | 'wait-for-email-confirmation-view' | 'email-wallet-otp-verification-view' | 'social-redirect-view' | 'wallet-locked-view' | 'social-wrong-account' | 'gate-blocked-wallet' | 'bridge-welcome' | 'bridge-summary' | 'bridge-next-wallet-connection' | 'account-exists' | 'merge-user-accounts' | 'merge-user-accounts-conflicts' | 'merge-user-accounts-with-same-email' | 'mfa-choose-device' | 'mfa-recovery' | 'mfa-secure-device' | 'mfa-secure-device-help' | 'mfa-verification' | 'mfa-display-backup-codes' | 'wallet-cannot-be-transferred' | 'passkey-intro' | 'passkey-recovery-add-email' | 'global-wallet-confirm' | 'global-wallet-malicious' | 'global-wallet-info' | 'passkey-recovery-start' | 'passkey-recovery-bundle' | 'passkey-recovery-complete' | 'passkey-new-domain-detected' | 'passkey-setup' | 'passkey-confirm' | 'embedded-delete-view' | 'embedded-reveal-view' | 'export-shares-view' | 'embedded-reveal-account-view' | 'embedded-wallet-auth-choice' | 'rename-passkey' | 'wallet-redirect-view' | 'wallet-upgrade-flow-view' | 'mobile-wallet-redirect-view' | 'farcaster-connect-view' | 'embedded-wallet-exists' | 'user-delete-account' | 'waas-upgrade-view' | 'wallet-delegation-view' | 'waas-backup-view' | 'waas-backup-info-view' | 'waas-backup-cloud-provider-view' | 'waas-backup-download-view' | 'waas-backup-progress-view' | 'waas-backup-success-view' | 'setup-password-terms' | 'setup-password-for-wallet-creation' | 'reset-password-flow' | 'unlock-wallet' | 'step-up-reauth-choose' | 'step-up-reauth-otp' | 'step-up-reauth-social' | 'step-up-reauth-wallet';
|
|
3
|
+
export type ViewType = 'auth-loading' | 'access-blocked' | 'account-upgraded' | 'backup-unsuccessful' | 'select-hardware-wallet' | 'captcha' | 'chainalysis-blocked-wallet' | 'collect-user-data' | 'collect-user-data-login-no-wallet' | 'device-registration' | 'login-with-email-or-wallet-full-wallet-list' | 'login-with-email-or-wallet' | 'login-with-wallet-only' | 'login-with-email-verification' | 'login-with-sms-verification' | 'network-not-supported' | 'network-not-supported-manual' | 'no-access' | 'no-qr-not-installed' | 'pending-connect' | 'pending-signature-without-back-button' | 'pending-signature' | 'qr-code' | 'verify-email' | 'verify-sms' | 'wallet-connect-mobile-wallets-list' | 'wallet-list' | 'unified-wallet-exchange-list' | 'external-funding-exchange-list' | 'external-funding-wallet-list' | 'mfa-exchange-view' | 'exchange-whitelist-warning' | 'sandbox-maximum-threshold-reached' | 'multi-wallet-wallet-list' | 'duplicate-wallet' | 'wallet-sign' | 'wallet-used' | 'wallet-group' | 'select-wallet-in-wallet-group' | 'wait-for-email-confirmation-view' | 'email-wallet-otp-verification-view' | 'social-redirect-view' | 'wallet-locked-view' | 'social-wrong-account' | 'gate-blocked-wallet' | 'bridge-welcome' | 'bridge-summary' | 'bridge-next-wallet-connection' | 'account-exists' | 'merge-user-accounts' | 'merge-user-accounts-conflicts' | 'merge-user-accounts-with-same-email' | 'mfa-choose-device' | 'mfa-recovery' | 'mfa-secure-device' | 'mfa-secure-device-help' | 'mfa-verification' | 'mfa-display-backup-codes' | 'wallet-cannot-be-transferred' | 'passkey-intro' | 'passkey-recovery-add-email' | 'global-wallet-confirm' | 'global-wallet-malicious' | 'global-wallet-info' | 'passkey-recovery-start' | 'passkey-recovery-bundle' | 'passkey-recovery-complete' | 'passkey-new-domain-detected' | 'passkey-setup' | 'passkey-confirm' | 'embedded-delete-view' | 'embedded-reveal-view' | 'export-shares-view' | 'embedded-reveal-account-view' | 'embedded-wallet-auth-choice' | 'rename-passkey' | 'wallet-redirect-view' | 'wallet-upgrade-flow-view' | 'mobile-wallet-redirect-view' | 'farcaster-connect-view' | 'embedded-wallet-exists' | 'user-delete-account' | 'waas-upgrade-view' | 'wallet-delegation-view' | 'waas-backup-view' | 'waas-backup-info-view' | 'waas-backup-cloud-provider-view' | 'waas-backup-download-view' | 'waas-backup-progress-view' | 'waas-backup-success-view' | 'setup-password-terms' | 'setup-password-for-wallet-creation' | 'reset-password-flow' | 'unlock-wallet' | 'step-up-reauth-choose' | 'step-up-reauth-otp' | 'step-up-reauth-social' | 'step-up-reauth-wallet';
|
|
4
4
|
export type ViewMapConstraint = Record<ViewType, FC<any>>;
|
|
5
5
|
export type ViewMap = typeof viewToComponentMap;
|
|
6
6
|
export type ViewState<T extends ViewType> = {
|
|
@@ -133,7 +133,7 @@ const Header = ({ onClose: handleClose, heading, projectSettings, copykey, descr
|
|
|
133
133
|
const closeButton = showCloseButton && handleClose && (jsxRuntime.jsx(IconButton.IconButton, { onClick: handleClose, type: 'button', id: 'close-button', "data-testid": 'close-button', className: 'layout-header__icon', children: jsxRuntime.jsx(close.ReactComponent, {}) }));
|
|
134
134
|
const infoButton = showHelpContent && (jsxRuntime.jsx(Tooltip.Tooltip, { content: 'Need some help?', className: 'layout-header__tooltip', children: jsxRuntime.jsx(IconButton.IconButton, { type: 'button', onClick: () => setIsFooterExpanded(!isFooterExpanded), "data-testid": 'info-button', className: 'layout-header__icon', children: isWalletListTypeView ? jsxRuntime.jsx(questionMark.ReactComponent, {}) : jsxRuntime.jsx(footerInfoIcon.ReactComponent, {}) }) }, 'info-button'));
|
|
135
135
|
const leadingButtons = [];
|
|
136
|
-
const showBackButton = canGoBack && view.type !== 'unlock-wallet';
|
|
136
|
+
const showBackButton = canGoBack && view.type !== 'unlock-wallet' && view.type !== 'auth-loading';
|
|
137
137
|
if (showBackButton) {
|
|
138
138
|
leadingButtons.push(jsxRuntime.jsx(IconButton.IconButton, { type: 'button', onClick: handleBackClick, "data-testid": 'back-button', className: 'layout-header__icon', children: jsxRuntime.jsx(arrowLeft.ReactComponent, {}) }, 'back-button'));
|
|
139
139
|
}
|
|
@@ -129,7 +129,7 @@ const Header = ({ onClose: handleClose, heading, projectSettings, copykey, descr
|
|
|
129
129
|
const closeButton = showCloseButton && handleClose && (jsx(IconButton, { onClick: handleClose, type: 'button', id: 'close-button', "data-testid": 'close-button', className: 'layout-header__icon', children: jsx(SvgClose, {}) }));
|
|
130
130
|
const infoButton = showHelpContent && (jsx(Tooltip, { content: 'Need some help?', className: 'layout-header__tooltip', children: jsx(IconButton, { type: 'button', onClick: () => setIsFooterExpanded(!isFooterExpanded), "data-testid": 'info-button', className: 'layout-header__icon', children: isWalletListTypeView ? jsx(SvgQuestionMark, {}) : jsx(SvgFooterInfoIcon, {}) }) }, 'info-button'));
|
|
131
131
|
const leadingButtons = [];
|
|
132
|
-
const showBackButton = canGoBack && view.type !== 'unlock-wallet';
|
|
132
|
+
const showBackButton = canGoBack && view.type !== 'unlock-wallet' && view.type !== 'auth-loading';
|
|
133
133
|
if (showBackButton) {
|
|
134
134
|
leadingButtons.push(jsx(IconButton, { type: 'button', onClick: handleBackClick, "data-testid": 'back-button', className: 'layout-header__icon', children: jsx(SvgArrowLeft, {}) }, 'back-button'));
|
|
135
135
|
}
|
|
@@ -156,7 +156,7 @@ const useConnectAndSign = ({ shouldUpdateWallets = true, shouldCallCallback = tr
|
|
|
156
156
|
setError(err.message, err.code);
|
|
157
157
|
}
|
|
158
158
|
else {
|
|
159
|
-
setErrorMessage((_a = err === null || err === void 0 ? void 0 : err.code) === null || _a === void 0 ? void 0 : _a.toString());
|
|
159
|
+
setErrorMessage((_a = err === null || err === void 0 ? void 0 : err.code) === null || _a === void 0 ? void 0 : _a.toString(), err);
|
|
160
160
|
}
|
|
161
161
|
};
|
|
162
162
|
const handleWalletConnectionError = (error) => {
|
|
@@ -168,7 +168,7 @@ const useConnectAndSign = ({ shouldUpdateWallets = true, shouldCallCallback = tr
|
|
|
168
168
|
setError(error.message, error.code);
|
|
169
169
|
}
|
|
170
170
|
else {
|
|
171
|
-
setDefaultError();
|
|
171
|
+
setDefaultError(error);
|
|
172
172
|
}
|
|
173
173
|
};
|
|
174
174
|
return (_a) => _tslib.__awaiter(void 0, [_a], void 0, function* ({ walletConnector, getAddressOpts = undefined, requestedScopes, }) {
|
|
@@ -152,7 +152,7 @@ const useConnectAndSign = ({ shouldUpdateWallets = true, shouldCallCallback = tr
|
|
|
152
152
|
setError(err.message, err.code);
|
|
153
153
|
}
|
|
154
154
|
else {
|
|
155
|
-
setErrorMessage((_a = err === null || err === void 0 ? void 0 : err.code) === null || _a === void 0 ? void 0 : _a.toString());
|
|
155
|
+
setErrorMessage((_a = err === null || err === void 0 ? void 0 : err.code) === null || _a === void 0 ? void 0 : _a.toString(), err);
|
|
156
156
|
}
|
|
157
157
|
};
|
|
158
158
|
const handleWalletConnectionError = (error) => {
|
|
@@ -164,7 +164,7 @@ const useConnectAndSign = ({ shouldUpdateWallets = true, shouldCallCallback = tr
|
|
|
164
164
|
setError(error.message, error.code);
|
|
165
165
|
}
|
|
166
166
|
else {
|
|
167
|
-
setDefaultError();
|
|
167
|
+
setDefaultError(error);
|
|
168
168
|
}
|
|
169
169
|
};
|
|
170
170
|
return (_a) => __awaiter(void 0, [_a], void 0, function* ({ walletConnector, getAddressOpts = undefined, requestedScopes, }) {
|
|
@@ -122,7 +122,7 @@ var useInternalDynamicContext = require('../../../../../context/DynamicContext/u
|
|
|
122
122
|
// Hook exposed to customers and used internally to trigger embedded wallet creation
|
|
123
123
|
const useTurnkey = () => {
|
|
124
124
|
const { projectSettings, walletConnectorOptions, setShowAuthFlow, environmentId, user, primaryWallet, } = useInternalDynamicContext.useInternalDynamicContext();
|
|
125
|
-
const {
|
|
125
|
+
const { clearStackAndPush } = ViewContext.useViewContext();
|
|
126
126
|
const { createDynamicEmbeddedWalletMutation } = useCreateDynamicEmbeddedWalletMutation.useCreateDynamicEmbeddedWalletMutation();
|
|
127
127
|
const { getEOAWallet } = useSmartWallets.useSmartWallets();
|
|
128
128
|
const startHeadlessEmbeddedWalletCreationFlow = React.useCallback((chains, options) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
@@ -154,11 +154,13 @@ const useTurnkey = () => {
|
|
|
154
154
|
setShowAuthFlow,
|
|
155
155
|
]);
|
|
156
156
|
const startPasskeyEmbeddedWalletCreationFlow = React.useCallback((chains) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
157
|
+
// Set the view before opening the modal so the modal never renders the
|
|
158
|
+
// default login view — avoids a flash of wallet selection for passkey users.
|
|
159
|
+
clearStackAndPush('passkey-intro', { chains });
|
|
157
160
|
setShowAuthFlow(true, {
|
|
158
161
|
ignoreIfIsEmbeddedWidget: false,
|
|
159
162
|
performMultiWalletChecks: false,
|
|
160
163
|
});
|
|
161
|
-
pushView('passkey-intro', { chains });
|
|
162
164
|
return new Promise((resolve, reject) => {
|
|
163
165
|
dynamicEvents.dynamicEvents.once('embeddedWalletCreated', (wallet) => resolve(wallet));
|
|
164
166
|
dynamicEvents.dynamicEvents.once('embeddedWalletFailed', (error) => {
|
|
@@ -173,7 +175,7 @@ const useTurnkey = () => {
|
|
|
173
175
|
reject(error);
|
|
174
176
|
});
|
|
175
177
|
});
|
|
176
|
-
}), [setShowAuthFlow,
|
|
178
|
+
}), [setShowAuthFlow, clearStackAndPush]);
|
|
177
179
|
const returnEmbeddedWallet = React.useCallback((embeddedWalletVerifiedCredential) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
178
180
|
var _a, _b;
|
|
179
181
|
const { chain } = embeddedWalletVerifiedCredential;
|
|
@@ -118,7 +118,7 @@ import { useInternalDynamicContext } from '../../../../../context/DynamicContext
|
|
|
118
118
|
// Hook exposed to customers and used internally to trigger embedded wallet creation
|
|
119
119
|
const useTurnkey = () => {
|
|
120
120
|
const { projectSettings, walletConnectorOptions, setShowAuthFlow, environmentId, user, primaryWallet, } = useInternalDynamicContext();
|
|
121
|
-
const {
|
|
121
|
+
const { clearStackAndPush } = useViewContext();
|
|
122
122
|
const { createDynamicEmbeddedWalletMutation } = useCreateDynamicEmbeddedWalletMutation();
|
|
123
123
|
const { getEOAWallet } = useSmartWallets();
|
|
124
124
|
const startHeadlessEmbeddedWalletCreationFlow = useCallback((chains, options) => __awaiter(void 0, void 0, void 0, function* () {
|
|
@@ -150,11 +150,13 @@ const useTurnkey = () => {
|
|
|
150
150
|
setShowAuthFlow,
|
|
151
151
|
]);
|
|
152
152
|
const startPasskeyEmbeddedWalletCreationFlow = useCallback((chains) => __awaiter(void 0, void 0, void 0, function* () {
|
|
153
|
+
// Set the view before opening the modal so the modal never renders the
|
|
154
|
+
// default login view — avoids a flash of wallet selection for passkey users.
|
|
155
|
+
clearStackAndPush('passkey-intro', { chains });
|
|
153
156
|
setShowAuthFlow(true, {
|
|
154
157
|
ignoreIfIsEmbeddedWidget: false,
|
|
155
158
|
performMultiWalletChecks: false,
|
|
156
159
|
});
|
|
157
|
-
pushView('passkey-intro', { chains });
|
|
158
160
|
return new Promise((resolve, reject) => {
|
|
159
161
|
dynamicEvents.once('embeddedWalletCreated', (wallet) => resolve(wallet));
|
|
160
162
|
dynamicEvents.once('embeddedWalletFailed', (error) => {
|
|
@@ -169,7 +171,7 @@ const useTurnkey = () => {
|
|
|
169
171
|
reject(error);
|
|
170
172
|
});
|
|
171
173
|
});
|
|
172
|
-
}), [setShowAuthFlow,
|
|
174
|
+
}), [setShowAuthFlow, clearStackAndPush]);
|
|
173
175
|
const returnEmbeddedWallet = useCallback((embeddedWalletVerifiedCredential) => __awaiter(void 0, void 0, void 0, function* () {
|
|
174
176
|
var _a, _b;
|
|
175
177
|
const { chain } = embeddedWalletVerifiedCredential;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { AuthLoadingView } from './AuthLoadingView';
|
|
@@ -19,6 +19,7 @@ var StepUpReauthOtpView = require('./StepUpReauthOtpView/StepUpReauthOtpView.cjs
|
|
|
19
19
|
var StepUpReauthSocialView = require('./StepUpReauthSocialView/StepUpReauthSocialView.cjs');
|
|
20
20
|
var StepUpReauthWalletView = require('./StepUpReauthWalletView/StepUpReauthWalletView.cjs');
|
|
21
21
|
var AccessBlockedView = require('./AccessBlockedView/AccessBlockedView.cjs');
|
|
22
|
+
var AuthLoadingView = require('./AuthLoadingView/AuthLoadingView.cjs');
|
|
22
23
|
var AccountExistsView = require('./AccountExistsView/AccountExistsView.cjs');
|
|
23
24
|
var AccountUpgradedView = require('./AccountUpgradedView/AccountUpgradedView.cjs');
|
|
24
25
|
var BackupUnsuccessfulView = require('./BackupUnsuccessfulView/BackupUnsuccessfulView.cjs');
|
|
@@ -191,6 +192,7 @@ const viewToComponentMap = {
|
|
|
191
192
|
'access-blocked': AccessBlockedView.AccessBlockedView,
|
|
192
193
|
'account-exists': AccountExistsView.AccountExistsView,
|
|
193
194
|
'account-upgraded': AccountUpgradedView.AccountUpgradedView,
|
|
195
|
+
'auth-loading': AuthLoadingView.AuthLoadingView,
|
|
194
196
|
'backup-unsuccessful': BackupUnsuccessfulView.BackupUnsuccessfulView,
|
|
195
197
|
'bridge-next-wallet-connection': BridgeNextWalletConnectionView.BridgeNextWalletConnectionView,
|
|
196
198
|
'bridge-summary': BridgeSummaryView.BridgeSummaryView,
|
|
@@ -3,6 +3,7 @@ export declare const viewToComponentMap: {
|
|
|
3
3
|
'access-blocked': import("react").FC;
|
|
4
4
|
'account-exists': () => JSX.Element;
|
|
5
5
|
'account-upgraded': import("react").FC;
|
|
6
|
+
'auth-loading': import("react").FC;
|
|
6
7
|
'backup-unsuccessful': import("react").FC<{}>;
|
|
7
8
|
'bridge-next-wallet-connection': import("react").FC;
|
|
8
9
|
'bridge-summary': () => JSX.Element;
|
|
@@ -15,6 +15,7 @@ import { StepUpReauthOtpView } from './StepUpReauthOtpView/StepUpReauthOtpView.j
|
|
|
15
15
|
import { StepUpReauthSocialView } from './StepUpReauthSocialView/StepUpReauthSocialView.js';
|
|
16
16
|
import { StepUpReauthWalletView } from './StepUpReauthWalletView/StepUpReauthWalletView.js';
|
|
17
17
|
import { AccessBlockedView } from './AccessBlockedView/AccessBlockedView.js';
|
|
18
|
+
import { AuthLoadingView } from './AuthLoadingView/AuthLoadingView.js';
|
|
18
19
|
import { AccountExistsView } from './AccountExistsView/AccountExistsView.js';
|
|
19
20
|
import { AccountUpgradedView } from './AccountUpgradedView/AccountUpgradedView.js';
|
|
20
21
|
import { BackupUnsuccessfulView } from './BackupUnsuccessfulView/BackupUnsuccessfulView.js';
|
|
@@ -187,6 +188,7 @@ const viewToComponentMap = {
|
|
|
187
188
|
'access-blocked': AccessBlockedView,
|
|
188
189
|
'account-exists': AccountExistsView,
|
|
189
190
|
'account-upgraded': AccountUpgradedView,
|
|
191
|
+
'auth-loading': AuthLoadingView,
|
|
190
192
|
'backup-unsuccessful': BackupUnsuccessfulView,
|
|
191
193
|
'bridge-next-wallet-connection': BridgeNextWalletConnectionView,
|
|
192
194
|
'bridge-summary': BridgeSummaryView,
|