@dynamic-labs/sdk-react-core 4.25.4 → 4.25.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +14 -0
- package/package.cjs +1 -1
- package/package.js +1 -1
- package/package.json +11 -11
- package/src/lib/context/DynamicContext/hooks/useRemoveWallet/useRemoveWallet.cjs +5 -8
- package/src/lib/context/DynamicContext/hooks/useRemoveWallet/useRemoveWallet.js +6 -9
- package/src/lib/locale/en/translation.cjs +12 -0
- package/src/lib/locale/en/translation.d.ts +12 -0
- package/src/lib/locale/en/translation.js +12 -0
- package/src/lib/utils/hooks/useDynamicWaas/constants.cjs +2 -0
- package/src/lib/utils/hooks/useDynamicWaas/constants.d.ts +1 -0
- package/src/lib/utils/hooks/useDynamicWaas/constants.js +2 -1
- package/src/lib/utils/hooks/useDynamicWaas/useDynamicWaas.cjs +9 -1
- package/src/lib/utils/hooks/useDynamicWaas/useDynamicWaas.js +10 -2
- package/src/lib/utils/hooks/useEmbeddedWallet/useSecureEnclaveEmbeddedWallet/useSecureEnclaveEmbeddedWallet.cjs +11 -6
- package/src/lib/utils/hooks/useEmbeddedWallet/useSecureEnclaveEmbeddedWallet/useSecureEnclaveEmbeddedWallet.js +11 -6
- package/src/lib/utils/hooks/useEmbeddedWallet/useSecureEnclaveEmbeddedWallet/useTurnkey/useTurnkey.cjs +1 -1
- package/src/lib/utils/hooks/useEmbeddedWallet/useSecureEnclaveEmbeddedWallet/useTurnkey/useTurnkey.js +1 -1
- package/src/lib/utils/hooks/useEmbeddedWalletSessionKeys/useEmbeddedWalletSessionKeys.cjs +80 -60
- package/src/lib/utils/hooks/useEmbeddedWalletSessionKeys/useEmbeddedWalletSessionKeys.d.ts +1 -5
- package/src/lib/utils/hooks/useEmbeddedWalletSessionKeys/useEmbeddedWalletSessionKeys.js +81 -61
- package/src/lib/utils/hooks/useGetMfaToken/index.d.ts +1 -0
- package/src/lib/utils/hooks/useGetMfaToken/useGetMfaToken.d.ts +26 -0
- package/src/lib/utils/hooks/usePromptMfaAuth/index.d.ts +1 -0
- package/src/lib/utils/hooks/usePromptMfaAuth/usePromptMfaAuth.cjs +144 -0
- package/src/lib/utils/hooks/usePromptMfaAuth/usePromptMfaAuth.d.ts +1 -0
- package/src/lib/utils/hooks/usePromptMfaAuth/usePromptMfaAuth.js +140 -0
- package/src/lib/utils/hooks/useSyncMfaFlow/useSyncMfaFlow.cjs +5 -13
- package/src/lib/utils/hooks/useSyncMfaFlow/useSyncMfaFlow.js +5 -13
- package/src/lib/utils/hooks/useVerifyWallet/useVerifyWallet.cjs +1 -1
- package/src/lib/utils/hooks/useVerifyWallet/useVerifyWallet.js +1 -1
- package/src/lib/views/EmbeddedReveal/EmbeddedRevealView/EmbeddedRevealView.cjs +6 -1
- package/src/lib/views/EmbeddedReveal/EmbeddedRevealView/EmbeddedRevealView.js +6 -1
- package/src/lib/views/Passkey/SetupPasskeyView/SetupPasskeyView.cjs +16 -4
- package/src/lib/views/Passkey/SetupPasskeyView/SetupPasskeyView.js +16 -4
- package/src/lib/widgets/DynamicWidget/prompts/PendingAccountSwitchToLinkModal/PendingAccountSwitchToLinkModal.cjs +7 -2
- package/src/lib/widgets/DynamicWidget/prompts/PendingAccountSwitchToLinkModal/PendingAccountSwitchToLinkModal.js +8 -3
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
import { __awaiter } from '../../../../../_virtual/_tslib.js';
|
|
3
|
+
import { useCallback } from 'react';
|
|
4
|
+
import { MFADeviceType } from '@dynamic-labs/sdk-api-core';
|
|
5
|
+
import { useGetUserMfaMethods } from '../useGetUserMfaMethods/useGetUserMfaMethods.js';
|
|
6
|
+
import { useViewContext } from '../../../context/ViewContext/ViewContext.js';
|
|
7
|
+
import '../../../context/DynamicContext/DynamicContext.js';
|
|
8
|
+
import '../../../store/state/loadingAndLifecycle/loadingAndLifecycle.js';
|
|
9
|
+
import '../../../shared/logger.js';
|
|
10
|
+
import '@dynamic-labs/iconic';
|
|
11
|
+
import '@dynamic-labs/wallet-connector-core';
|
|
12
|
+
import 'react/jsx-runtime';
|
|
13
|
+
import '@dynamic-labs/wallet-book';
|
|
14
|
+
import '@dynamic-labs/utils';
|
|
15
|
+
import '../../constants/colors.js';
|
|
16
|
+
import '../../constants/values.js';
|
|
17
|
+
import '../../../shared/consts/index.js';
|
|
18
|
+
import '../../../events/dynamicEvents.js';
|
|
19
|
+
import '../../../context/CaptchaContext/CaptchaContext.js';
|
|
20
|
+
import '../../../context/ErrorContext/ErrorContext.js';
|
|
21
|
+
import '@dynamic-labs/multi-wallet';
|
|
22
|
+
import 'react-international-phone';
|
|
23
|
+
import '../../../store/state/nonce/nonce.js';
|
|
24
|
+
import '@dynamic-labs-sdk/client/core';
|
|
25
|
+
import '@dynamic-labs-sdk/client';
|
|
26
|
+
import '../../../client/client.js';
|
|
27
|
+
import '../../../store/state/projectSettings/projectSettings.js';
|
|
28
|
+
import '../../../config/ApiEndpoint.js';
|
|
29
|
+
import '../../../locale/locale.js';
|
|
30
|
+
import '../../../store/state/dynamicContextProps/dynamicContextProps.js';
|
|
31
|
+
import '../../../store/state/primaryWalletId/primaryWalletId.js';
|
|
32
|
+
import '../../../store/state/connectedWalletsInfo/connectedWalletsInfo.js';
|
|
33
|
+
import '../../../context/AccessDeniedContext/AccessDeniedContext.js';
|
|
34
|
+
import '../../../context/AccountExistsContext/AccountExistsContext.js';
|
|
35
|
+
import '../../../context/UserWalletsContext/UserWalletsContext.js';
|
|
36
|
+
import '../../../store/state/authMode/authMode.js';
|
|
37
|
+
import '../../../context/VerificationContext/VerificationContext.js';
|
|
38
|
+
import 'react-dom';
|
|
39
|
+
import '../../functions/compareChains/compareChains.js';
|
|
40
|
+
import '../../../views/Passkey/utils/findPrimaryEmbeddedChain/findPrimaryEmbeddedChain.js';
|
|
41
|
+
import '../../../context/ThemeContext/ThemeContext.js';
|
|
42
|
+
import '../useUserUpdateRequest/useUpdateUser/userFieldsSchema.js';
|
|
43
|
+
import 'bs58';
|
|
44
|
+
import '@dynamic-labs/types';
|
|
45
|
+
import '../../../context/SocialRedirectContext/SocialRedirectContext.js';
|
|
46
|
+
import '../../../context/LoadingContext/LoadingContext.js';
|
|
47
|
+
import '../../../context/WalletContext/WalletContext.js';
|
|
48
|
+
import '../useEmbeddedWallet/useSecureEnclaveEmbeddedWallet/constants.js';
|
|
49
|
+
import 'yup';
|
|
50
|
+
import '../../../context/MockContext/MockContext.js';
|
|
51
|
+
import '../../../views/CollectUserDataView/useFields.js';
|
|
52
|
+
import '../../../context/FieldsStateContext/FieldsStateContext.js';
|
|
53
|
+
import '../../../context/UserFieldEditorContext/UserFieldEditorContext.js';
|
|
54
|
+
import '@dynamic-labs/rpc-providers';
|
|
55
|
+
import '../../../store/state/walletOptions/walletOptions.js';
|
|
56
|
+
import 'react-i18next';
|
|
57
|
+
import '../../../components/Accordion/components/AccordionItem/AccordionItem.js';
|
|
58
|
+
import '../../../components/Alert/Alert.js';
|
|
59
|
+
import '../../../components/ShadowDOM/ShadowDOM.js';
|
|
60
|
+
import '../../../components/IconButton/IconButton.js';
|
|
61
|
+
import '../../../components/InlineWidget/InlineWidget.js';
|
|
62
|
+
import '../../../components/Input/Input.js';
|
|
63
|
+
import '../../../components/IsBrowser/IsBrowser.js';
|
|
64
|
+
import '../../../components/MenuList/Dropdown/Dropdown.js';
|
|
65
|
+
import '../../../components/OverlayCard/OverlayCard.js';
|
|
66
|
+
import '../../../components/Transition/ZoomTransition/ZoomTransition.js';
|
|
67
|
+
import '../../../components/Transition/SlideInUpTransition/SlideInUpTransition.js';
|
|
68
|
+
import '../../../components/Transition/OpacityTransition/OpacityTransition.js';
|
|
69
|
+
import '../../../components/PasskeyCreatedSuccessBanner/PasskeyCreatedSuccessBanner.js';
|
|
70
|
+
import '../../../components/Popper/Popper/Popper.js';
|
|
71
|
+
import '../../../components/Popper/PopperContext/PopperContext.js';
|
|
72
|
+
import 'react-focus-lock';
|
|
73
|
+
import 'qrcode';
|
|
74
|
+
import 'formik';
|
|
75
|
+
import '../useSubdomainCheck/useSubdomainCheck.js';
|
|
76
|
+
import '../../../context/WalletGroupContext/WalletGroupContext.js';
|
|
77
|
+
import '../../../context/IpConfigurationContext/IpConfigurationContext.js';
|
|
78
|
+
import '../../../context/ConnectWithOtpContext/ConnectWithOtpContext.js';
|
|
79
|
+
import '../../../widgets/DynamicBridgeWidget/views/WalletsView/components/SecondaryWallets/SecondaryWallets.js';
|
|
80
|
+
import '@hcaptcha/react-hcaptcha';
|
|
81
|
+
import '../../../widgets/DynamicWidget/context/DynamicWidgetContext.js';
|
|
82
|
+
import '../../../widgets/DynamicWidget/helpers/convertExchangeKeyAndProviderEnum.js';
|
|
83
|
+
import '../../../views/ExchangeWhitelistWarning/ExchangeWhitelistWarning.js';
|
|
84
|
+
import '../../../context/ErrorContext/hooks/useErrorText/useErrorText.js';
|
|
85
|
+
import '../../../context/FooterAnimationContext/index.js';
|
|
86
|
+
import '../../../views/MfaChooseDeviceView/getMfaOptions/getMfaOptions.js';
|
|
87
|
+
import '../../../context/PasskeyContext/PasskeyContext.js';
|
|
88
|
+
import '../../../store/state/sendBalances.js';
|
|
89
|
+
import '../../../store/state/connectorsInitializing/connectorsInitializing.js';
|
|
90
|
+
import '../../../components/OverlayCardBase/OverlayCardTarget/OverlayCardTarget.js';
|
|
91
|
+
import '../../../widgets/DynamicWidget/components/DynamicWidgetHeader/DynamicWidgetHeader.js';
|
|
92
|
+
import '../../../views/TransactionConfirmationView/TransactionConfirmationView.js';
|
|
93
|
+
import '../../../widgets/DynamicWidget/components/PasskeyCard/PasskeyCard.js';
|
|
94
|
+
import '../../../context/OnrampContext/OnrampContext.js';
|
|
95
|
+
import '../../../widgets/DynamicWidget/views/ReceiveWalletFunds/ReceiveWalletFunds.js';
|
|
96
|
+
import '../../../../index.js';
|
|
97
|
+
import '../../../store/state/tokenBalances.js';
|
|
98
|
+
import '../../../store/state/multichainBalances.js';
|
|
99
|
+
import '../../../shared/utils/functions/getInitialUrl/getInitialUrl.js';
|
|
100
|
+
import { useInternalDynamicContext } from '../../../context/DynamicContext/useDynamicContext/useInternalDynamicContext/useInternalDynamicContext.js';
|
|
101
|
+
|
|
102
|
+
const usePromptMfaAuth = () => {
|
|
103
|
+
const { setShowAuthFlow } = useInternalDynamicContext();
|
|
104
|
+
const { pushView } = useViewContext();
|
|
105
|
+
const getUserMfaMethods = useGetUserMfaMethods();
|
|
106
|
+
const promptMfaAuth = useCallback(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
107
|
+
const methods = yield getUserMfaMethods();
|
|
108
|
+
const allMethods = [
|
|
109
|
+
...methods.passkeys.map((passkey) => (Object.assign(Object.assign({}, passkey), { type: MFADeviceType.Passkey }))),
|
|
110
|
+
...methods.devices.map((device) => (Object.assign(Object.assign({}, device), { type: MFADeviceType.Totp }))),
|
|
111
|
+
];
|
|
112
|
+
setShowAuthFlow(true);
|
|
113
|
+
if (!methods.userHasVerifiedMfaMethods || allMethods.length === 0) {
|
|
114
|
+
pushView('mfa-choose-device');
|
|
115
|
+
return;
|
|
116
|
+
}
|
|
117
|
+
const lastCreatedMethod = allMethods.reduce((a, b) => {
|
|
118
|
+
if (a.createdAt && b.createdAt) {
|
|
119
|
+
return a.createdAt >= b.createdAt ? a : b;
|
|
120
|
+
}
|
|
121
|
+
if (b.createdAt) {
|
|
122
|
+
return b;
|
|
123
|
+
}
|
|
124
|
+
return a;
|
|
125
|
+
});
|
|
126
|
+
switch (lastCreatedMethod.type) {
|
|
127
|
+
case MFADeviceType.Passkey:
|
|
128
|
+
pushView('passkey-confirm');
|
|
129
|
+
break;
|
|
130
|
+
case MFADeviceType.Totp:
|
|
131
|
+
pushView('mfa-verification');
|
|
132
|
+
break;
|
|
133
|
+
default:
|
|
134
|
+
throw new Error('Error determining MFA method to use');
|
|
135
|
+
}
|
|
136
|
+
}), [getUserMfaMethods, pushView, setShowAuthFlow]);
|
|
137
|
+
return promptMfaAuth;
|
|
138
|
+
};
|
|
139
|
+
|
|
140
|
+
export { usePromptMfaAuth };
|
|
@@ -89,7 +89,6 @@ require('../../../views/ExchangeWhitelistWarning/ExchangeWhitelistWarning.cjs');
|
|
|
89
89
|
require('../../../context/ErrorContext/hooks/useErrorText/useErrorText.cjs');
|
|
90
90
|
require('../../../context/FooterAnimationContext/index.cjs');
|
|
91
91
|
require('../../../views/MfaChooseDeviceView/getMfaOptions/getMfaOptions.cjs');
|
|
92
|
-
var useMfa = require('../useMfa/useMfa.cjs');
|
|
93
92
|
require('../../../context/PasskeyContext/PasskeyContext.cjs');
|
|
94
93
|
require('../../../store/state/sendBalances.cjs');
|
|
95
94
|
require('../../../store/state/connectorsInitializing/connectorsInitializing.cjs');
|
|
@@ -102,6 +101,7 @@ require('../../../widgets/DynamicWidget/views/ReceiveWalletFunds/ReceiveWalletFu
|
|
|
102
101
|
require('../../../../index.cjs');
|
|
103
102
|
require('../../../store/state/tokenBalances.cjs');
|
|
104
103
|
require('../../../store/state/multichainBalances.cjs');
|
|
104
|
+
var usePromptMfaAuth = require('../usePromptMfaAuth/usePromptMfaAuth.cjs');
|
|
105
105
|
require('../../../shared/utils/functions/getInitialUrl/getInitialUrl.cjs');
|
|
106
106
|
var useInternalDynamicContext = require('../../../context/DynamicContext/useDynamicContext/useInternalDynamicContext/useInternalDynamicContext.cjs');
|
|
107
107
|
|
|
@@ -110,8 +110,8 @@ var useInternalDynamicContext = require('../../../context/DynamicContext/useDyna
|
|
|
110
110
|
*/
|
|
111
111
|
const useSyncMfaFlow = ({ handler: headlessHandler, } = {}) => {
|
|
112
112
|
const { setShowAuthFlow, userWithMissingInfo, sdkHasLoaded } = useInternalDynamicContext.useInternalDynamicContext();
|
|
113
|
-
const
|
|
114
|
-
const {
|
|
113
|
+
const promptMfaAuth = usePromptMfaAuth.usePromptMfaAuth();
|
|
114
|
+
const { clearStackAndPush } = ViewContext.useViewContext();
|
|
115
115
|
// this is used to make sure we only trigger the effect once
|
|
116
116
|
const triggered = React.useRef(false);
|
|
117
117
|
useDynamicEvents.useInternalDynamicEvents('logout', () => {
|
|
@@ -150,23 +150,15 @@ const useSyncMfaFlow = ({ handler: headlessHandler, } = {}) => {
|
|
|
150
150
|
*/
|
|
151
151
|
setShowAuthFlow(true);
|
|
152
152
|
if ((_a = userWithMissingInfo.scope) === null || _a === void 0 ? void 0 : _a.includes('requiresAdditionalAuth')) {
|
|
153
|
-
|
|
154
|
-
if (devices.length === 0) {
|
|
155
|
-
pushView('mfa-choose-device');
|
|
156
|
-
}
|
|
157
|
-
else {
|
|
158
|
-
pushView('mfa-verification');
|
|
159
|
-
}
|
|
160
|
-
});
|
|
153
|
+
promptMfaAuth();
|
|
161
154
|
}
|
|
162
155
|
else {
|
|
163
156
|
clearStackAndPush('mfa-display-backup-codes');
|
|
164
157
|
}
|
|
165
158
|
}, [
|
|
166
|
-
|
|
159
|
+
promptMfaAuth,
|
|
167
160
|
sdkHasLoaded,
|
|
168
161
|
setShowAuthFlow,
|
|
169
|
-
pushView,
|
|
170
162
|
userWithMissingInfo,
|
|
171
163
|
headlessHandler,
|
|
172
164
|
clearStackAndPush,
|
|
@@ -85,7 +85,6 @@ import '../../../views/ExchangeWhitelistWarning/ExchangeWhitelistWarning.js';
|
|
|
85
85
|
import '../../../context/ErrorContext/hooks/useErrorText/useErrorText.js';
|
|
86
86
|
import '../../../context/FooterAnimationContext/index.js';
|
|
87
87
|
import '../../../views/MfaChooseDeviceView/getMfaOptions/getMfaOptions.js';
|
|
88
|
-
import { useMfa } from '../useMfa/useMfa.js';
|
|
89
88
|
import '../../../context/PasskeyContext/PasskeyContext.js';
|
|
90
89
|
import '../../../store/state/sendBalances.js';
|
|
91
90
|
import '../../../store/state/connectorsInitializing/connectorsInitializing.js';
|
|
@@ -98,6 +97,7 @@ import '../../../widgets/DynamicWidget/views/ReceiveWalletFunds/ReceiveWalletFun
|
|
|
98
97
|
import '../../../../index.js';
|
|
99
98
|
import '../../../store/state/tokenBalances.js';
|
|
100
99
|
import '../../../store/state/multichainBalances.js';
|
|
100
|
+
import { usePromptMfaAuth } from '../usePromptMfaAuth/usePromptMfaAuth.js';
|
|
101
101
|
import '../../../shared/utils/functions/getInitialUrl/getInitialUrl.js';
|
|
102
102
|
import { useInternalDynamicContext } from '../../../context/DynamicContext/useDynamicContext/useInternalDynamicContext/useInternalDynamicContext.js';
|
|
103
103
|
|
|
@@ -106,8 +106,8 @@ import { useInternalDynamicContext } from '../../../context/DynamicContext/useDy
|
|
|
106
106
|
*/
|
|
107
107
|
const useSyncMfaFlow = ({ handler: headlessHandler, } = {}) => {
|
|
108
108
|
const { setShowAuthFlow, userWithMissingInfo, sdkHasLoaded } = useInternalDynamicContext();
|
|
109
|
-
const
|
|
110
|
-
const {
|
|
109
|
+
const promptMfaAuth = usePromptMfaAuth();
|
|
110
|
+
const { clearStackAndPush } = useViewContext();
|
|
111
111
|
// this is used to make sure we only trigger the effect once
|
|
112
112
|
const triggered = useRef(false);
|
|
113
113
|
useInternalDynamicEvents('logout', () => {
|
|
@@ -146,23 +146,15 @@ const useSyncMfaFlow = ({ handler: headlessHandler, } = {}) => {
|
|
|
146
146
|
*/
|
|
147
147
|
setShowAuthFlow(true);
|
|
148
148
|
if ((_a = userWithMissingInfo.scope) === null || _a === void 0 ? void 0 : _a.includes('requiresAdditionalAuth')) {
|
|
149
|
-
|
|
150
|
-
if (devices.length === 0) {
|
|
151
|
-
pushView('mfa-choose-device');
|
|
152
|
-
}
|
|
153
|
-
else {
|
|
154
|
-
pushView('mfa-verification');
|
|
155
|
-
}
|
|
156
|
-
});
|
|
149
|
+
promptMfaAuth();
|
|
157
150
|
}
|
|
158
151
|
else {
|
|
159
152
|
clearStackAndPush('mfa-display-backup-codes');
|
|
160
153
|
}
|
|
161
154
|
}, [
|
|
162
|
-
|
|
155
|
+
promptMfaAuth,
|
|
163
156
|
sdkHasLoaded,
|
|
164
157
|
setShowAuthFlow,
|
|
165
|
-
pushView,
|
|
166
158
|
userWithMissingInfo,
|
|
167
159
|
headlessHandler,
|
|
168
160
|
clearStackAndPush,
|
|
@@ -141,7 +141,7 @@ const useVerifyWallet = ({ displaySiweStatement, environmentId, projectSettings,
|
|
|
141
141
|
walletConnector,
|
|
142
142
|
walletProvider,
|
|
143
143
|
});
|
|
144
|
-
if (shouldRegisterSessionKeysOnSignin()) {
|
|
144
|
+
if (shouldRegisterSessionKeysOnSignin() && verifyOnly) {
|
|
145
145
|
const keypair = yield generateSessionKey();
|
|
146
146
|
verifyArgs.sessionPublicKey = keypair.publicKey;
|
|
147
147
|
}
|
|
@@ -137,7 +137,7 @@ const useVerifyWallet = ({ displaySiweStatement, environmentId, projectSettings,
|
|
|
137
137
|
walletConnector,
|
|
138
138
|
walletProvider,
|
|
139
139
|
});
|
|
140
|
-
if (shouldRegisterSessionKeysOnSignin()) {
|
|
140
|
+
if (shouldRegisterSessionKeysOnSignin() && verifyOnly) {
|
|
141
141
|
const keypair = yield generateSessionKey();
|
|
142
142
|
verifyArgs.sessionPublicKey = keypair.publicKey;
|
|
143
143
|
}
|
|
@@ -199,13 +199,18 @@ const EmbeddedRevealView = ({ exportPrivateKey, isPromptForExport = false, }) =>
|
|
|
199
199
|
wallet: wallet,
|
|
200
200
|
});
|
|
201
201
|
}
|
|
202
|
-
catch (
|
|
202
|
+
catch (err) {
|
|
203
203
|
if (walletConnectorCore.isSessionKeyCompatibleWalletConnector(wallet === null || wallet === void 0 ? void 0 : wallet.connector) &&
|
|
204
204
|
((_f = wallet === null || wallet === void 0 ? void 0 : wallet.connector) === null || _f === void 0 ? void 0 : _f.removeSessionKeys)) {
|
|
205
205
|
yield ((_g = wallet === null || wallet === void 0 ? void 0 : wallet.connector) === null || _g === void 0 ? void 0 : _g.removeSessionKeys());
|
|
206
206
|
yield ((_h = wallet === null || wallet === void 0 ? void 0 : wallet.connector) === null || _h === void 0 ? void 0 : _h.createOrRestoreSession({
|
|
207
207
|
ignoreRestore: true,
|
|
208
208
|
}));
|
|
209
|
+
logger.logger.error('[TK - removeSessionKeys] failed to perform revealEmbeddedWalletKey activity', {
|
|
210
|
+
address: wallet === null || wallet === void 0 ? void 0 : wallet.address,
|
|
211
|
+
err,
|
|
212
|
+
userId: user === null || user === void 0 ? void 0 : user.userId,
|
|
213
|
+
});
|
|
209
214
|
}
|
|
210
215
|
return turnkeyExport.exportCredential({
|
|
211
216
|
address: exportPrivateKey ? wallet === null || wallet === void 0 ? void 0 : wallet.address : undefined,
|
|
@@ -195,13 +195,18 @@ const EmbeddedRevealView = ({ exportPrivateKey, isPromptForExport = false, }) =>
|
|
|
195
195
|
wallet: wallet,
|
|
196
196
|
});
|
|
197
197
|
}
|
|
198
|
-
catch (
|
|
198
|
+
catch (err) {
|
|
199
199
|
if (isSessionKeyCompatibleWalletConnector(wallet === null || wallet === void 0 ? void 0 : wallet.connector) &&
|
|
200
200
|
((_f = wallet === null || wallet === void 0 ? void 0 : wallet.connector) === null || _f === void 0 ? void 0 : _f.removeSessionKeys)) {
|
|
201
201
|
yield ((_g = wallet === null || wallet === void 0 ? void 0 : wallet.connector) === null || _g === void 0 ? void 0 : _g.removeSessionKeys());
|
|
202
202
|
yield ((_h = wallet === null || wallet === void 0 ? void 0 : wallet.connector) === null || _h === void 0 ? void 0 : _h.createOrRestoreSession({
|
|
203
203
|
ignoreRestore: true,
|
|
204
204
|
}));
|
|
205
|
+
logger.error('[TK - removeSessionKeys] failed to perform revealEmbeddedWalletKey activity', {
|
|
206
|
+
address: wallet === null || wallet === void 0 ? void 0 : wallet.address,
|
|
207
|
+
err,
|
|
208
|
+
userId: user === null || user === void 0 ? void 0 : user.userId,
|
|
209
|
+
});
|
|
205
210
|
}
|
|
206
211
|
return exportCredential({
|
|
207
212
|
address: exportPrivateKey ? wallet === null || wallet === void 0 ? void 0 : wallet.address : undefined,
|
|
@@ -3,8 +3,10 @@
|
|
|
3
3
|
|
|
4
4
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
5
|
|
|
6
|
+
var _tslib = require('../../../../../_virtual/_tslib.cjs');
|
|
6
7
|
var jsxRuntime = require('react/jsx-runtime');
|
|
7
8
|
var reactI18next = require('react-i18next');
|
|
9
|
+
var sdkApiCore = require('@dynamic-labs/sdk-api-core');
|
|
8
10
|
var classNames = require('../../../utils/functions/classNames/classNames.cjs');
|
|
9
11
|
require('../../../components/Accordion/components/AccordionItem/AccordionItem.cjs');
|
|
10
12
|
require('react');
|
|
@@ -12,8 +14,6 @@ var arrowLeft = require('../../../shared/assets/arrow-left.cjs');
|
|
|
12
14
|
var fingerprint = require('../../../shared/assets/fingerprint.cjs');
|
|
13
15
|
require('@dynamic-labs/iconic');
|
|
14
16
|
var ViewContext = require('../../../context/ViewContext/ViewContext.cjs');
|
|
15
|
-
require('../../../../../_virtual/_tslib.cjs');
|
|
16
|
-
require('@dynamic-labs/sdk-api-core');
|
|
17
17
|
require('../../../shared/logger.cjs');
|
|
18
18
|
require('@dynamic-labs/wallet-connector-core');
|
|
19
19
|
require('@dynamic-labs/wallet-book');
|
|
@@ -26,6 +26,7 @@ require('../../../events/dynamicEvents.cjs');
|
|
|
26
26
|
require('../../../context/DynamicContext/DynamicContext.cjs');
|
|
27
27
|
require('../../../store/state/loadingAndLifecycle/loadingAndLifecycle.cjs');
|
|
28
28
|
require('../../../store/state/authMode/authMode.cjs');
|
|
29
|
+
var useInternalDynamicContext = require('../../../context/DynamicContext/useDynamicContext/useInternalDynamicContext/useInternalDynamicContext.cjs');
|
|
29
30
|
require('../../../context/CaptchaContext/CaptchaContext.cjs');
|
|
30
31
|
require('../../../context/ErrorContext/ErrorContext.cjs');
|
|
31
32
|
require('@dynamic-labs/multi-wallet');
|
|
@@ -114,9 +115,20 @@ require('../../../components/Popper/PopperContext/PopperContext.cjs');
|
|
|
114
115
|
|
|
115
116
|
const SetupPasskeyView = () => {
|
|
116
117
|
const { t } = reactI18next.useTranslation();
|
|
117
|
-
const { pushView, goBack, canGoBack } = ViewContext.useViewContext();
|
|
118
|
+
const { clearStackAndPush, pushView, goBack, canGoBack } = ViewContext.useViewContext();
|
|
119
|
+
const { setShowAuthFlow } = useInternalDynamicContext.useInternalDynamicContext();
|
|
118
120
|
const registerPasskey = useRegisterPasskey.useRegisterPasskey();
|
|
119
|
-
const { error, isLoading } = usePromise.usePromise(registerPasskey
|
|
121
|
+
const { error, isLoading } = usePromise.usePromise(registerPasskey, {
|
|
122
|
+
initialData: undefined,
|
|
123
|
+
onResolve: (verifyResponse) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
124
|
+
if ((verifyResponse === null || verifyResponse === void 0 ? void 0 : verifyResponse.user.mfaBackupCodeAcknowledgement) ===
|
|
125
|
+
sdkApiCore.MfaBackupCodeAcknowledgement.Pending) {
|
|
126
|
+
clearStackAndPush('mfa-display-backup-codes');
|
|
127
|
+
return;
|
|
128
|
+
}
|
|
129
|
+
setShowAuthFlow(false);
|
|
130
|
+
}),
|
|
131
|
+
});
|
|
120
132
|
const errorMessage = useGetPasskeyErrorMessage.useGetPasskeyErrorMessage(error);
|
|
121
133
|
const backButton = canGoBack && (jsxRuntime.jsx(IconButton.IconButton, { type: 'button', onClick: goBack, "data-testid": 'back-button', children: jsxRuntime.jsx(arrowLeft.ReactComponent, {}) }));
|
|
122
134
|
return (jsxRuntime.jsxs("div", { className: classNames.classNames('setup-passkey-view'), children: [jsxRuntime.jsx(ModalHeader.ModalHeader, { alignContent: 'bottom', leading: backButton, children: jsxRuntime.jsx("div", { className: 'setup-passkey-view__header', children: jsxRuntime.jsx(Typography.Typography, { weight: 'medium', variant: 'title', color: 'primary', className: 'setup-passkey-view__title', copykey: 'dyn_mfa.setup_passkey_view.title', children: t('dyn_mfa.setup_passkey_view.title') }) }) }), jsxRuntime.jsx(ModalHeaderBanner.ModalHeaderBanner, { type: 'error', messageKey: errorMessage, className: 'setup-passkey-view__header-banner' }), jsxRuntime.jsxs("div", { className: classNames.classNames('setup-passkey-view__content'), children: [jsxRuntime.jsx(IconWithSpinner.IconWithSpinner, { Icon: fingerprint.ReactComponent, iconSize: 96, isSpinning: isLoading, treatAsFunctionComponent: true }), jsxRuntime.jsx(Typography.Typography, { variant: 'body_normal', weight: 'regular', color: 'secondary', className: classNames.classNames('setup-passkey-view__description'), copykey: 'dyn_mfa.setup_passkey_view.description', children: t('dyn_mfa.setup_passkey_view.description') })] }), jsxRuntime.jsx("div", { className: 'setup-passkey-view__choose-another-method', children: jsxRuntime.jsx(TextButton.TextButton, { className: 'setup-passkey-view__choose-another-method-button', onClick: () => pushView('mfa-choose-device', { isInitialSetup: true }), copykey: 'dyn_mfa.otp_verification_view.choose_another_method', children: t('dyn_mfa.otp_verification_view.choose_another_method') }) })] }));
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
'use client'
|
|
2
|
+
import { __awaiter } from '../../../../../_virtual/_tslib.js';
|
|
2
3
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
3
4
|
import { useTranslation } from 'react-i18next';
|
|
5
|
+
import { MfaBackupCodeAcknowledgement } from '@dynamic-labs/sdk-api-core';
|
|
4
6
|
import { classNames } from '../../../utils/functions/classNames/classNames.js';
|
|
5
7
|
import '../../../components/Accordion/components/AccordionItem/AccordionItem.js';
|
|
6
8
|
import 'react';
|
|
@@ -8,8 +10,6 @@ import { ReactComponent as SvgArrowLeft } from '../../../shared/assets/arrow-lef
|
|
|
8
10
|
import { ReactComponent as SvgFingerprint } from '../../../shared/assets/fingerprint.js';
|
|
9
11
|
import '@dynamic-labs/iconic';
|
|
10
12
|
import { useViewContext } from '../../../context/ViewContext/ViewContext.js';
|
|
11
|
-
import '../../../../../_virtual/_tslib.js';
|
|
12
|
-
import '@dynamic-labs/sdk-api-core';
|
|
13
13
|
import '../../../shared/logger.js';
|
|
14
14
|
import '@dynamic-labs/wallet-connector-core';
|
|
15
15
|
import '@dynamic-labs/wallet-book';
|
|
@@ -22,6 +22,7 @@ import '../../../events/dynamicEvents.js';
|
|
|
22
22
|
import '../../../context/DynamicContext/DynamicContext.js';
|
|
23
23
|
import '../../../store/state/loadingAndLifecycle/loadingAndLifecycle.js';
|
|
24
24
|
import '../../../store/state/authMode/authMode.js';
|
|
25
|
+
import { useInternalDynamicContext } from '../../../context/DynamicContext/useDynamicContext/useInternalDynamicContext/useInternalDynamicContext.js';
|
|
25
26
|
import '../../../context/CaptchaContext/CaptchaContext.js';
|
|
26
27
|
import '../../../context/ErrorContext/ErrorContext.js';
|
|
27
28
|
import '@dynamic-labs/multi-wallet';
|
|
@@ -110,9 +111,20 @@ import '../../../components/Popper/PopperContext/PopperContext.js';
|
|
|
110
111
|
|
|
111
112
|
const SetupPasskeyView = () => {
|
|
112
113
|
const { t } = useTranslation();
|
|
113
|
-
const { pushView, goBack, canGoBack } = useViewContext();
|
|
114
|
+
const { clearStackAndPush, pushView, goBack, canGoBack } = useViewContext();
|
|
115
|
+
const { setShowAuthFlow } = useInternalDynamicContext();
|
|
114
116
|
const registerPasskey = useRegisterPasskey();
|
|
115
|
-
const { error, isLoading } = usePromise(registerPasskey
|
|
117
|
+
const { error, isLoading } = usePromise(registerPasskey, {
|
|
118
|
+
initialData: undefined,
|
|
119
|
+
onResolve: (verifyResponse) => __awaiter(void 0, void 0, void 0, function* () {
|
|
120
|
+
if ((verifyResponse === null || verifyResponse === void 0 ? void 0 : verifyResponse.user.mfaBackupCodeAcknowledgement) ===
|
|
121
|
+
MfaBackupCodeAcknowledgement.Pending) {
|
|
122
|
+
clearStackAndPush('mfa-display-backup-codes');
|
|
123
|
+
return;
|
|
124
|
+
}
|
|
125
|
+
setShowAuthFlow(false);
|
|
126
|
+
}),
|
|
127
|
+
});
|
|
116
128
|
const errorMessage = useGetPasskeyErrorMessage(error);
|
|
117
129
|
const backButton = canGoBack && (jsx(IconButton, { type: 'button', onClick: goBack, "data-testid": 'back-button', children: jsx(SvgArrowLeft, {}) }));
|
|
118
130
|
return (jsxs("div", { className: classNames('setup-passkey-view'), children: [jsx(ModalHeader, { alignContent: 'bottom', leading: backButton, children: jsx("div", { className: 'setup-passkey-view__header', children: jsx(Typography, { weight: 'medium', variant: 'title', color: 'primary', className: 'setup-passkey-view__title', copykey: 'dyn_mfa.setup_passkey_view.title', children: t('dyn_mfa.setup_passkey_view.title') }) }) }), jsx(ModalHeaderBanner, { type: 'error', messageKey: errorMessage, className: 'setup-passkey-view__header-banner' }), jsxs("div", { className: classNames('setup-passkey-view__content'), children: [jsx(IconWithSpinner, { Icon: SvgFingerprint, iconSize: 96, isSpinning: isLoading, treatAsFunctionComponent: true }), jsx(Typography, { variant: 'body_normal', weight: 'regular', color: 'secondary', className: classNames('setup-passkey-view__description'), copykey: 'dyn_mfa.setup_passkey_view.description', children: t('dyn_mfa.setup_passkey_view.description') })] }), jsx("div", { className: 'setup-passkey-view__choose-another-method', children: jsx(TextButton, { className: 'setup-passkey-view__choose-another-method-button', onClick: () => pushView('mfa-choose-device', { isInitialSetup: true }), copykey: 'dyn_mfa.otp_verification_view.choose_another_method', children: t('dyn_mfa.otp_verification_view.choose_another_method') }) })] }));
|
|
@@ -4,10 +4,10 @@
|
|
|
4
4
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
5
|
|
|
6
6
|
var jsxRuntime = require('react/jsx-runtime');
|
|
7
|
+
var reactI18next = require('react-i18next');
|
|
7
8
|
var walletBook = require('@dynamic-labs/wallet-book');
|
|
8
9
|
require('@dynamic-labs/utils');
|
|
9
10
|
require('../../../../components/Accordion/components/AccordionItem/AccordionItem.cjs');
|
|
10
|
-
require('react-i18next');
|
|
11
11
|
require('react');
|
|
12
12
|
require('@dynamic-labs/iconic');
|
|
13
13
|
require('../../../../context/ViewContext/ViewContext.cjs');
|
|
@@ -109,7 +109,12 @@ require('react-focus-lock');
|
|
|
109
109
|
|
|
110
110
|
const PendingAccountSwitchToLinkContent = () => {
|
|
111
111
|
const { selectedWalletConnector } = useInternalDynamicContext.useInternalDynamicContext();
|
|
112
|
-
|
|
112
|
+
const { t } = reactI18next.useTranslation();
|
|
113
|
+
return (jsxRuntime.jsx(DefaultPromptModal.DefaultPromptLayout, { dataTestId: 'pending-account-switch', icon: jsxRuntime.jsx(walletBook.WalletIcon, { icon: selectedWalletConnector === null || selectedWalletConnector === void 0 ? void 0 : selectedWalletConnector.metadata.icon, walletKey: selectedWalletConnector === null || selectedWalletConnector === void 0 ? void 0 : selectedWalletConnector.key }), title: t('dyn_pending_account_switch_to_link.title', {
|
|
114
|
+
walletName: selectedWalletConnector === null || selectedWalletConnector === void 0 ? void 0 : selectedWalletConnector.name,
|
|
115
|
+
}), children: jsxRuntime.jsx(Typography.Typography, { variant: 'body_normal', color: 'secondary', weight: 'regular', "data-testid": 'content', copykey: 'dyn_pending_account_switch_to_link.description', children: t('dyn_pending_account_switch_to_link.description', {
|
|
116
|
+
walletName: selectedWalletConnector === null || selectedWalletConnector === void 0 ? void 0 : selectedWalletConnector.name,
|
|
117
|
+
}) }) }));
|
|
113
118
|
};
|
|
114
119
|
const PendingAccountSwitchToLinkWidgetPortal = () => (jsxRuntime.jsx(WidgetPortal.WidgetPortal, { onClose: useCloseMultiWalletPrompt.useCloseMultiWalletPrompt(), children: jsxRuntime.jsx(PendingAccountSwitchToLinkContent, {}) }));
|
|
115
120
|
const PendingAccountSwitchToLinkModal = () => (jsxRuntime.jsx(PromptModal.PromptModal, { onClose: useCloseMultiWalletPrompt.useCloseMultiWalletPrompt(), children: jsxRuntime.jsx(PendingAccountSwitchToLinkContent, {}) }));
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
'use client'
|
|
2
|
-
import { jsx
|
|
2
|
+
import { jsx } from 'react/jsx-runtime';
|
|
3
|
+
import { useTranslation } from 'react-i18next';
|
|
3
4
|
import { WalletIcon } from '@dynamic-labs/wallet-book';
|
|
4
5
|
import '@dynamic-labs/utils';
|
|
5
6
|
import '../../../../components/Accordion/components/AccordionItem/AccordionItem.js';
|
|
6
|
-
import 'react-i18next';
|
|
7
7
|
import 'react';
|
|
8
8
|
import '@dynamic-labs/iconic';
|
|
9
9
|
import '../../../../context/ViewContext/ViewContext.js';
|
|
@@ -105,7 +105,12 @@ import 'react-focus-lock';
|
|
|
105
105
|
|
|
106
106
|
const PendingAccountSwitchToLinkContent = () => {
|
|
107
107
|
const { selectedWalletConnector } = useInternalDynamicContext();
|
|
108
|
-
|
|
108
|
+
const { t } = useTranslation();
|
|
109
|
+
return (jsx(DefaultPromptLayout, { dataTestId: 'pending-account-switch', icon: jsx(WalletIcon, { icon: selectedWalletConnector === null || selectedWalletConnector === void 0 ? void 0 : selectedWalletConnector.metadata.icon, walletKey: selectedWalletConnector === null || selectedWalletConnector === void 0 ? void 0 : selectedWalletConnector.key }), title: t('dyn_pending_account_switch_to_link.title', {
|
|
110
|
+
walletName: selectedWalletConnector === null || selectedWalletConnector === void 0 ? void 0 : selectedWalletConnector.name,
|
|
111
|
+
}), children: jsx(Typography, { variant: 'body_normal', color: 'secondary', weight: 'regular', "data-testid": 'content', copykey: 'dyn_pending_account_switch_to_link.description', children: t('dyn_pending_account_switch_to_link.description', {
|
|
112
|
+
walletName: selectedWalletConnector === null || selectedWalletConnector === void 0 ? void 0 : selectedWalletConnector.name,
|
|
113
|
+
}) }) }));
|
|
109
114
|
};
|
|
110
115
|
const PendingAccountSwitchToLinkWidgetPortal = () => (jsx(WidgetPortal, { onClose: useCloseMultiWalletPrompt(), children: jsx(PendingAccountSwitchToLinkContent, {}) }));
|
|
111
116
|
const PendingAccountSwitchToLinkModal = () => (jsx(PromptModal, { onClose: useCloseMultiWalletPrompt(), children: jsx(PendingAccountSwitchToLinkContent, {}) }));
|