@dynamic-labs/sdk-react-core 4.25.4 → 4.25.6
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 +22 -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 +14 -2
- package/src/lib/utils/hooks/useDynamicWaas/useDynamicWaas.d.ts +5 -2
- package/src/lib/utils/hooks/useDynamicWaas/useDynamicWaas.js +15 -3
- 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.cjs +68 -0
- package/src/lib/utils/hooks/useGetMfaToken/useGetMfaToken.d.ts +26 -0
- package/src/lib/utils/hooks/useGetMfaToken/useGetMfaToken.js +64 -0
- package/src/lib/utils/hooks/useMfa/useMfa.cjs +23 -12
- package/src/lib/utils/hooks/useMfa/useMfa.d.ts +3 -2
- package/src/lib/utils/hooks/useMfa/useMfa.js +23 -12
- package/src/lib/utils/hooks/useMfaModals/useMfaModals.cjs +7 -1
- package/src/lib/utils/hooks/useMfaModals/useMfaModals.js +7 -1
- package/src/lib/utils/hooks/usePromptMfaAuth/index.d.ts +1 -0
- package/src/lib/utils/hooks/usePromptMfaAuth/usePromptMfaAuth.cjs +150 -0
- package/src/lib/utils/hooks/usePromptMfaAuth/usePromptMfaAuth.d.ts +5 -0
- package/src/lib/utils/hooks/usePromptMfaAuth/usePromptMfaAuth.js +146 -0
- package/src/lib/utils/hooks/useSetWalletConnectorFetchers/useSetWalletConnectorFetchers.cjs +3 -0
- package/src/lib/utils/hooks/useSetWalletConnectorFetchers/useSetWalletConnectorFetchers.js +3 -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 +2 -2
- package/src/lib/utils/hooks/useVerifyWallet/useVerifyWallet.js +2 -2
- package/src/lib/views/EmbeddedReveal/EmbeddedRevealView/EmbeddedRevealView.cjs +6 -1
- package/src/lib/views/EmbeddedReveal/EmbeddedRevealView/EmbeddedRevealView.js +6 -1
- package/src/lib/views/MfaChooseDeviceView/MfaChooseDeviceView.cjs +5 -2
- package/src/lib/views/MfaChooseDeviceView/MfaChooseDeviceView.d.ts +1 -0
- package/src/lib/views/MfaChooseDeviceView/MfaChooseDeviceView.js +5 -2
- package/src/lib/views/MfaVerificationView/MfaVerificationView.cjs +18 -3
- package/src/lib/views/MfaVerificationView/MfaVerificationView.d.ts +2 -1
- package/src/lib/views/MfaVerificationView/MfaVerificationView.js +18 -3
- package/src/lib/views/Passkey/ConfirmPasskeyView/ConfirmPasskeyView.cjs +15 -3
- package/src/lib/views/Passkey/ConfirmPasskeyView/ConfirmPasskeyView.d.ts +5 -1
- package/src/lib/views/Passkey/ConfirmPasskeyView/ConfirmPasskeyView.js +15 -3
- package/src/lib/views/Passkey/SetupPasskeyView/SetupPasskeyView.cjs +16 -4
- package/src/lib/views/Passkey/SetupPasskeyView/SetupPasskeyView.js +16 -4
- package/src/lib/views/viewToComponentMap.d.ts +4 -2
- package/src/lib/widgets/DynamicWidget/prompts/PendingAccountSwitchToLinkModal/PendingAccountSwitchToLinkModal.cjs +7 -2
- package/src/lib/widgets/DynamicWidget/prompts/PendingAccountSwitchToLinkModal/PendingAccountSwitchToLinkModal.js +8 -3
|
@@ -36,7 +36,7 @@ var useUserAuth = require('../useUserAuth/useUserAuth.cjs');
|
|
|
36
36
|
const useMfa = () => {
|
|
37
37
|
const client$2 = client.useDynamicClient();
|
|
38
38
|
const { completeAuth } = useUserAuth.useUserAuth({});
|
|
39
|
-
const handleMfaAuth = React.useCallback((
|
|
39
|
+
const handleMfaAuth = React.useCallback((_a) => _tslib.__awaiter(void 0, [_a], void 0, function* ({ code, type, deviceId, createMfaToken, resultHandler, }) {
|
|
40
40
|
let result;
|
|
41
41
|
yield completeAuth({
|
|
42
42
|
onValidUpdatedJwt: () => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
@@ -48,9 +48,7 @@ const useMfa = () => {
|
|
|
48
48
|
}
|
|
49
49
|
const response = yield client$1.authTotpMfaDevice(client$2, {
|
|
50
50
|
code,
|
|
51
|
-
createMfaTokenOptions:
|
|
52
|
-
singleUse: true,
|
|
53
|
-
},
|
|
51
|
+
createMfaTokenOptions: createMfaToken,
|
|
54
52
|
deviceId,
|
|
55
53
|
});
|
|
56
54
|
result = resultHandler(response);
|
|
@@ -89,21 +87,34 @@ const useMfa = () => {
|
|
|
89
87
|
// since if it is completed we won't show the QR code again
|
|
90
88
|
yield user.refreshUserJwt({ environmentId: dynamicContextProps.getEnvironmentId() });
|
|
91
89
|
}), [client$2]);
|
|
92
|
-
const addDevice = React.useCallback((...
|
|
90
|
+
const addDevice = React.useCallback((...args_1) => _tslib.__awaiter(void 0, [...args_1], void 0, function* (type = sdkApiCore.MFADeviceType.Totp) {
|
|
93
91
|
if (type === sdkApiCore.MFADeviceType.Totp) {
|
|
94
92
|
return client$1.registerTotpMfaDevice(client$2);
|
|
95
93
|
}
|
|
96
94
|
throw new Error('Unsupported MFA device type');
|
|
97
95
|
}), [client$2]);
|
|
98
|
-
const authDevice = React.useCallback((
|
|
96
|
+
const authDevice = React.useCallback((code_1, ...args_2) => _tslib.__awaiter(void 0, [code_1, ...args_2], void 0, function* (code, type = sdkApiCore.MFADeviceType.Totp, deviceId) {
|
|
99
97
|
let isValid = false;
|
|
100
|
-
yield handleMfaAuth(
|
|
101
|
-
|
|
102
|
-
|
|
98
|
+
yield handleMfaAuth({
|
|
99
|
+
code,
|
|
100
|
+
deviceId,
|
|
101
|
+
resultHandler: () => {
|
|
102
|
+
isValid = true;
|
|
103
|
+
return true;
|
|
104
|
+
},
|
|
105
|
+
type,
|
|
103
106
|
});
|
|
104
107
|
return isValid;
|
|
105
108
|
}), [handleMfaAuth]);
|
|
106
|
-
const authenticateDevice = React.useCallback((
|
|
109
|
+
const authenticateDevice = React.useCallback((_b) => _tslib.__awaiter(void 0, [_b], void 0, function* ({ code, type = sdkApiCore.MFADeviceType.Totp, deviceId, createMfaToken, }) {
|
|
110
|
+
return handleMfaAuth({
|
|
111
|
+
code,
|
|
112
|
+
createMfaToken,
|
|
113
|
+
deviceId,
|
|
114
|
+
resultHandler: (response) => response.mfaToken,
|
|
115
|
+
type,
|
|
116
|
+
});
|
|
117
|
+
}), [handleMfaAuth]);
|
|
107
118
|
const authRecoveryCode = React.useCallback((code) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
108
119
|
let isValid = false;
|
|
109
120
|
yield completeAuth({
|
|
@@ -131,7 +142,7 @@ const useMfa = () => {
|
|
|
131
142
|
});
|
|
132
143
|
return isValid;
|
|
133
144
|
}), [client$2, completeAuth]);
|
|
134
|
-
const verifyDevice = React.useCallback((
|
|
145
|
+
const verifyDevice = React.useCallback((code_2, ...args_3) => _tslib.__awaiter(void 0, [code_2, ...args_3], void 0, function* (code, type = sdkApiCore.MFADeviceType.Totp) {
|
|
135
146
|
if (type === sdkApiCore.MFADeviceType.Totp) {
|
|
136
147
|
const device = yield verifyTotpMfaDevice.verifyTotpMfaDevice(client$2, {
|
|
137
148
|
code,
|
|
@@ -143,7 +154,7 @@ const useMfa = () => {
|
|
|
143
154
|
}
|
|
144
155
|
throw new Error('Unsupported MFA device type');
|
|
145
156
|
}), [client$2]);
|
|
146
|
-
const getRecoveryCodes = React.useCallback((...
|
|
157
|
+
const getRecoveryCodes = React.useCallback((...args_4) => _tslib.__awaiter(void 0, [...args_4], void 0, function* (generateNewCodes = false) {
|
|
147
158
|
if (generateNewCodes) {
|
|
148
159
|
const { recoveryCodes } = yield client$1.createNewMfaRecoveryCodes(client$2);
|
|
149
160
|
return recoveryCodes;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { MFADevice, MFADeviceType } from '@dynamic-labs/sdk-api-core';
|
|
1
|
+
import { CreateMfaToken, MFADevice, MFADeviceType } from '@dynamic-labs/sdk-api-core';
|
|
2
2
|
type UseMfaHookResult = {
|
|
3
3
|
/**
|
|
4
4
|
* Add a new device to the user's account.
|
|
@@ -19,10 +19,11 @@ type UseMfaHookResult = {
|
|
|
19
19
|
* Authenticates a device and returns a single use MFA token
|
|
20
20
|
* if the authentication is successful.
|
|
21
21
|
*/
|
|
22
|
-
authenticateDevice: ({ code, type, deviceId, }: {
|
|
22
|
+
authenticateDevice: ({ code, type, deviceId, createMfaToken, }: {
|
|
23
23
|
code: string;
|
|
24
24
|
type?: MFADeviceType;
|
|
25
25
|
deviceId?: string;
|
|
26
|
+
createMfaToken?: CreateMfaToken;
|
|
26
27
|
}) => Promise<string | undefined>;
|
|
27
28
|
completeAcknowledgement: () => Promise<void>;
|
|
28
29
|
/**
|
|
@@ -32,7 +32,7 @@ import { useUserAuth } from '../useUserAuth/useUserAuth.js';
|
|
|
32
32
|
const useMfa = () => {
|
|
33
33
|
const client = useDynamicClient();
|
|
34
34
|
const { completeAuth } = useUserAuth({});
|
|
35
|
-
const handleMfaAuth = useCallback((
|
|
35
|
+
const handleMfaAuth = useCallback((_a) => __awaiter(void 0, [_a], void 0, function* ({ code, type, deviceId, createMfaToken, resultHandler, }) {
|
|
36
36
|
let result;
|
|
37
37
|
yield completeAuth({
|
|
38
38
|
onValidUpdatedJwt: () => __awaiter(void 0, void 0, void 0, function* () {
|
|
@@ -44,9 +44,7 @@ const useMfa = () => {
|
|
|
44
44
|
}
|
|
45
45
|
const response = yield authTotpMfaDevice(client, {
|
|
46
46
|
code,
|
|
47
|
-
createMfaTokenOptions:
|
|
48
|
-
singleUse: true,
|
|
49
|
-
},
|
|
47
|
+
createMfaTokenOptions: createMfaToken,
|
|
50
48
|
deviceId,
|
|
51
49
|
});
|
|
52
50
|
result = resultHandler(response);
|
|
@@ -85,21 +83,34 @@ const useMfa = () => {
|
|
|
85
83
|
// since if it is completed we won't show the QR code again
|
|
86
84
|
yield refreshUserJwt({ environmentId: getEnvironmentId() });
|
|
87
85
|
}), [client]);
|
|
88
|
-
const addDevice = useCallback((...
|
|
86
|
+
const addDevice = useCallback((...args_1) => __awaiter(void 0, [...args_1], void 0, function* (type = MFADeviceType.Totp) {
|
|
89
87
|
if (type === MFADeviceType.Totp) {
|
|
90
88
|
return registerTotpMfaDevice(client);
|
|
91
89
|
}
|
|
92
90
|
throw new Error('Unsupported MFA device type');
|
|
93
91
|
}), [client]);
|
|
94
|
-
const authDevice = useCallback((
|
|
92
|
+
const authDevice = useCallback((code_1, ...args_2) => __awaiter(void 0, [code_1, ...args_2], void 0, function* (code, type = MFADeviceType.Totp, deviceId) {
|
|
95
93
|
let isValid = false;
|
|
96
|
-
yield handleMfaAuth(
|
|
97
|
-
|
|
98
|
-
|
|
94
|
+
yield handleMfaAuth({
|
|
95
|
+
code,
|
|
96
|
+
deviceId,
|
|
97
|
+
resultHandler: () => {
|
|
98
|
+
isValid = true;
|
|
99
|
+
return true;
|
|
100
|
+
},
|
|
101
|
+
type,
|
|
99
102
|
});
|
|
100
103
|
return isValid;
|
|
101
104
|
}), [handleMfaAuth]);
|
|
102
|
-
const authenticateDevice = useCallback((
|
|
105
|
+
const authenticateDevice = useCallback((_b) => __awaiter(void 0, [_b], void 0, function* ({ code, type = MFADeviceType.Totp, deviceId, createMfaToken, }) {
|
|
106
|
+
return handleMfaAuth({
|
|
107
|
+
code,
|
|
108
|
+
createMfaToken,
|
|
109
|
+
deviceId,
|
|
110
|
+
resultHandler: (response) => response.mfaToken,
|
|
111
|
+
type,
|
|
112
|
+
});
|
|
113
|
+
}), [handleMfaAuth]);
|
|
103
114
|
const authRecoveryCode = useCallback((code) => __awaiter(void 0, void 0, void 0, function* () {
|
|
104
115
|
let isValid = false;
|
|
105
116
|
yield completeAuth({
|
|
@@ -127,7 +138,7 @@ const useMfa = () => {
|
|
|
127
138
|
});
|
|
128
139
|
return isValid;
|
|
129
140
|
}), [client, completeAuth]);
|
|
130
|
-
const verifyDevice = useCallback((
|
|
141
|
+
const verifyDevice = useCallback((code_2, ...args_3) => __awaiter(void 0, [code_2, ...args_3], void 0, function* (code, type = MFADeviceType.Totp) {
|
|
131
142
|
if (type === MFADeviceType.Totp) {
|
|
132
143
|
const device = yield verifyTotpMfaDevice(client, {
|
|
133
144
|
code,
|
|
@@ -139,7 +150,7 @@ const useMfa = () => {
|
|
|
139
150
|
}
|
|
140
151
|
throw new Error('Unsupported MFA device type');
|
|
141
152
|
}), [client]);
|
|
142
|
-
const getRecoveryCodes = useCallback((...
|
|
153
|
+
const getRecoveryCodes = useCallback((...args_4) => __awaiter(void 0, [...args_4], void 0, function* (generateNewCodes = false) {
|
|
143
154
|
if (generateNewCodes) {
|
|
144
155
|
const { recoveryCodes } = yield createNewMfaRecoveryCodes(client);
|
|
145
156
|
return recoveryCodes;
|
|
@@ -154,7 +154,13 @@ const useMfaModals = () => {
|
|
|
154
154
|
if (!isTotpMfaEnabled) {
|
|
155
155
|
return;
|
|
156
156
|
}
|
|
157
|
-
|
|
157
|
+
// creating the mfa token in case the customer is using
|
|
158
|
+
// otp verification to delete the device
|
|
159
|
+
// this is mainly for backwards compatibility with the
|
|
160
|
+
// suggested flow before passkeys were introduced
|
|
161
|
+
clearStackAndPush('mfa-verification', {
|
|
162
|
+
createMfaToken: true,
|
|
163
|
+
});
|
|
158
164
|
}
|
|
159
165
|
setShowAuthFlow(value, { emitCancelAuth: true });
|
|
160
166
|
}, [isTotpMfaEnabled, setShowAuthFlow, clearStackAndPush]);
|
|
@@ -150,7 +150,13 @@ const useMfaModals = () => {
|
|
|
150
150
|
if (!isTotpMfaEnabled) {
|
|
151
151
|
return;
|
|
152
152
|
}
|
|
153
|
-
|
|
153
|
+
// creating the mfa token in case the customer is using
|
|
154
|
+
// otp verification to delete the device
|
|
155
|
+
// this is mainly for backwards compatibility with the
|
|
156
|
+
// suggested flow before passkeys were introduced
|
|
157
|
+
clearStackAndPush('mfa-verification', {
|
|
158
|
+
createMfaToken: true,
|
|
159
|
+
});
|
|
154
160
|
}
|
|
155
161
|
setShowAuthFlow(value, { emitCancelAuth: true });
|
|
156
162
|
}, [isTotpMfaEnabled, setShowAuthFlow, clearStackAndPush]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { usePromptMfaAuth } from './usePromptMfaAuth';
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
|
+
|
|
6
|
+
var _tslib = require('../../../../../_virtual/_tslib.cjs');
|
|
7
|
+
var React = require('react');
|
|
8
|
+
var sdkApiCore = require('@dynamic-labs/sdk-api-core');
|
|
9
|
+
var useGetUserMfaMethods = require('../useGetUserMfaMethods/useGetUserMfaMethods.cjs');
|
|
10
|
+
var ViewContext = require('../../../context/ViewContext/ViewContext.cjs');
|
|
11
|
+
require('../../../context/DynamicContext/DynamicContext.cjs');
|
|
12
|
+
require('../../../store/state/loadingAndLifecycle/loadingAndLifecycle.cjs');
|
|
13
|
+
require('../../../shared/logger.cjs');
|
|
14
|
+
require('@dynamic-labs/iconic');
|
|
15
|
+
require('@dynamic-labs/wallet-connector-core');
|
|
16
|
+
require('react/jsx-runtime');
|
|
17
|
+
require('@dynamic-labs/wallet-book');
|
|
18
|
+
require('@dynamic-labs/utils');
|
|
19
|
+
require('../../constants/colors.cjs');
|
|
20
|
+
require('../../constants/values.cjs');
|
|
21
|
+
require('../../../shared/consts/index.cjs');
|
|
22
|
+
require('../../../events/dynamicEvents.cjs');
|
|
23
|
+
require('../../../context/CaptchaContext/CaptchaContext.cjs');
|
|
24
|
+
require('../../../context/ErrorContext/ErrorContext.cjs');
|
|
25
|
+
require('@dynamic-labs/multi-wallet');
|
|
26
|
+
require('react-international-phone');
|
|
27
|
+
require('../../../store/state/nonce/nonce.cjs');
|
|
28
|
+
require('@dynamic-labs-sdk/client/core');
|
|
29
|
+
require('@dynamic-labs-sdk/client');
|
|
30
|
+
require('../../../client/client.cjs');
|
|
31
|
+
require('../../../store/state/projectSettings/projectSettings.cjs');
|
|
32
|
+
require('../../../config/ApiEndpoint.cjs');
|
|
33
|
+
require('../../../locale/locale.cjs');
|
|
34
|
+
require('../../../store/state/dynamicContextProps/dynamicContextProps.cjs');
|
|
35
|
+
require('../../../store/state/primaryWalletId/primaryWalletId.cjs');
|
|
36
|
+
require('../../../store/state/connectedWalletsInfo/connectedWalletsInfo.cjs');
|
|
37
|
+
require('../../../context/AccessDeniedContext/AccessDeniedContext.cjs');
|
|
38
|
+
require('../../../context/AccountExistsContext/AccountExistsContext.cjs');
|
|
39
|
+
require('../../../context/UserWalletsContext/UserWalletsContext.cjs');
|
|
40
|
+
require('../../../store/state/authMode/authMode.cjs');
|
|
41
|
+
require('../../../context/VerificationContext/VerificationContext.cjs');
|
|
42
|
+
require('react-dom');
|
|
43
|
+
require('../../functions/compareChains/compareChains.cjs');
|
|
44
|
+
require('../../../views/Passkey/utils/findPrimaryEmbeddedChain/findPrimaryEmbeddedChain.cjs');
|
|
45
|
+
require('../../../context/ThemeContext/ThemeContext.cjs');
|
|
46
|
+
require('../useUserUpdateRequest/useUpdateUser/userFieldsSchema.cjs');
|
|
47
|
+
require('bs58');
|
|
48
|
+
require('@dynamic-labs/types');
|
|
49
|
+
require('../../../context/SocialRedirectContext/SocialRedirectContext.cjs');
|
|
50
|
+
require('../../../context/LoadingContext/LoadingContext.cjs');
|
|
51
|
+
require('../../../context/WalletContext/WalletContext.cjs');
|
|
52
|
+
require('../useEmbeddedWallet/useSecureEnclaveEmbeddedWallet/constants.cjs');
|
|
53
|
+
require('yup');
|
|
54
|
+
require('../../../context/MockContext/MockContext.cjs');
|
|
55
|
+
require('../../../views/CollectUserDataView/useFields.cjs');
|
|
56
|
+
require('../../../context/FieldsStateContext/FieldsStateContext.cjs');
|
|
57
|
+
require('../../../context/UserFieldEditorContext/UserFieldEditorContext.cjs');
|
|
58
|
+
require('@dynamic-labs/rpc-providers');
|
|
59
|
+
require('../../../store/state/walletOptions/walletOptions.cjs');
|
|
60
|
+
require('react-i18next');
|
|
61
|
+
require('../../../components/Accordion/components/AccordionItem/AccordionItem.cjs');
|
|
62
|
+
require('../../../components/Alert/Alert.cjs');
|
|
63
|
+
require('../../../components/ShadowDOM/ShadowDOM.cjs');
|
|
64
|
+
require('../../../components/IconButton/IconButton.cjs');
|
|
65
|
+
require('../../../components/InlineWidget/InlineWidget.cjs');
|
|
66
|
+
require('../../../components/Input/Input.cjs');
|
|
67
|
+
require('../../../components/IsBrowser/IsBrowser.cjs');
|
|
68
|
+
require('../../../components/MenuList/Dropdown/Dropdown.cjs');
|
|
69
|
+
require('../../../components/OverlayCard/OverlayCard.cjs');
|
|
70
|
+
require('../../../components/Transition/ZoomTransition/ZoomTransition.cjs');
|
|
71
|
+
require('../../../components/Transition/SlideInUpTransition/SlideInUpTransition.cjs');
|
|
72
|
+
require('../../../components/Transition/OpacityTransition/OpacityTransition.cjs');
|
|
73
|
+
require('../../../components/PasskeyCreatedSuccessBanner/PasskeyCreatedSuccessBanner.cjs');
|
|
74
|
+
require('../../../components/Popper/Popper/Popper.cjs');
|
|
75
|
+
require('../../../components/Popper/PopperContext/PopperContext.cjs');
|
|
76
|
+
require('react-focus-lock');
|
|
77
|
+
require('qrcode');
|
|
78
|
+
require('formik');
|
|
79
|
+
require('../useSubdomainCheck/useSubdomainCheck.cjs');
|
|
80
|
+
require('../../../context/WalletGroupContext/WalletGroupContext.cjs');
|
|
81
|
+
require('../../../context/IpConfigurationContext/IpConfigurationContext.cjs');
|
|
82
|
+
require('../../../context/ConnectWithOtpContext/ConnectWithOtpContext.cjs');
|
|
83
|
+
require('../../../widgets/DynamicBridgeWidget/views/WalletsView/components/SecondaryWallets/SecondaryWallets.cjs');
|
|
84
|
+
require('@hcaptcha/react-hcaptcha');
|
|
85
|
+
require('../../../widgets/DynamicWidget/context/DynamicWidgetContext.cjs');
|
|
86
|
+
require('../../../widgets/DynamicWidget/helpers/convertExchangeKeyAndProviderEnum.cjs');
|
|
87
|
+
require('../../../views/ExchangeWhitelistWarning/ExchangeWhitelistWarning.cjs');
|
|
88
|
+
require('../../../context/ErrorContext/hooks/useErrorText/useErrorText.cjs');
|
|
89
|
+
require('../../../context/FooterAnimationContext/index.cjs');
|
|
90
|
+
require('../../../views/MfaChooseDeviceView/getMfaOptions/getMfaOptions.cjs');
|
|
91
|
+
require('../../../context/PasskeyContext/PasskeyContext.cjs');
|
|
92
|
+
require('../../../store/state/sendBalances.cjs');
|
|
93
|
+
require('../../../store/state/connectorsInitializing/connectorsInitializing.cjs');
|
|
94
|
+
require('../../../components/OverlayCardBase/OverlayCardTarget/OverlayCardTarget.cjs');
|
|
95
|
+
require('../../../widgets/DynamicWidget/components/DynamicWidgetHeader/DynamicWidgetHeader.cjs');
|
|
96
|
+
require('../../../views/TransactionConfirmationView/TransactionConfirmationView.cjs');
|
|
97
|
+
require('../../../widgets/DynamicWidget/components/PasskeyCard/PasskeyCard.cjs');
|
|
98
|
+
require('../../../context/OnrampContext/OnrampContext.cjs');
|
|
99
|
+
require('../../../widgets/DynamicWidget/views/ReceiveWalletFunds/ReceiveWalletFunds.cjs');
|
|
100
|
+
require('../../../../index.cjs');
|
|
101
|
+
require('../../../store/state/tokenBalances.cjs');
|
|
102
|
+
require('../../../store/state/multichainBalances.cjs');
|
|
103
|
+
require('../../../shared/utils/functions/getInitialUrl/getInitialUrl.cjs');
|
|
104
|
+
var useInternalDynamicContext = require('../../../context/DynamicContext/useDynamicContext/useInternalDynamicContext/useInternalDynamicContext.cjs');
|
|
105
|
+
|
|
106
|
+
const usePromptMfaAuth = () => {
|
|
107
|
+
const { setShowAuthFlow } = useInternalDynamicContext.useInternalDynamicContext();
|
|
108
|
+
const { pushView } = ViewContext.useViewContext();
|
|
109
|
+
const getUserMfaMethods = useGetUserMfaMethods.useGetUserMfaMethods();
|
|
110
|
+
const promptMfaAuth = React.useCallback((props) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
111
|
+
const methods = yield getUserMfaMethods();
|
|
112
|
+
const allMethods = [
|
|
113
|
+
...methods.passkeys.map((passkey) => (Object.assign(Object.assign({}, passkey), { type: sdkApiCore.MFADeviceType.Passkey }))),
|
|
114
|
+
...methods.devices.map((device) => (Object.assign(Object.assign({}, device), { type: sdkApiCore.MFADeviceType.Totp }))),
|
|
115
|
+
];
|
|
116
|
+
setShowAuthFlow(true);
|
|
117
|
+
if (!methods.userHasVerifiedMfaMethods || allMethods.length === 0) {
|
|
118
|
+
pushView('mfa-choose-device', {
|
|
119
|
+
createMfaToken: props === null || props === void 0 ? void 0 : props.createMfaToken,
|
|
120
|
+
});
|
|
121
|
+
return;
|
|
122
|
+
}
|
|
123
|
+
const lastCreatedMethod = allMethods.reduce((a, b) => {
|
|
124
|
+
if (a.createdAt && b.createdAt) {
|
|
125
|
+
return a.createdAt >= b.createdAt ? a : b;
|
|
126
|
+
}
|
|
127
|
+
if (b.createdAt) {
|
|
128
|
+
return b;
|
|
129
|
+
}
|
|
130
|
+
return a;
|
|
131
|
+
});
|
|
132
|
+
switch (lastCreatedMethod.type) {
|
|
133
|
+
case sdkApiCore.MFADeviceType.Passkey:
|
|
134
|
+
pushView('passkey-confirm', {
|
|
135
|
+
createMfaToken: props === null || props === void 0 ? void 0 : props.createMfaToken,
|
|
136
|
+
});
|
|
137
|
+
break;
|
|
138
|
+
case sdkApiCore.MFADeviceType.Totp:
|
|
139
|
+
pushView('mfa-verification', {
|
|
140
|
+
createMfaToken: props === null || props === void 0 ? void 0 : props.createMfaToken,
|
|
141
|
+
});
|
|
142
|
+
break;
|
|
143
|
+
default:
|
|
144
|
+
throw new Error('Error determining MFA method to use');
|
|
145
|
+
}
|
|
146
|
+
}), [getUserMfaMethods, pushView, setShowAuthFlow]);
|
|
147
|
+
return promptMfaAuth;
|
|
148
|
+
};
|
|
149
|
+
|
|
150
|
+
exports.usePromptMfaAuth = usePromptMfaAuth;
|
|
@@ -0,0 +1,146 @@
|
|
|
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((props) => __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
|
+
createMfaToken: props === null || props === void 0 ? void 0 : props.createMfaToken,
|
|
116
|
+
});
|
|
117
|
+
return;
|
|
118
|
+
}
|
|
119
|
+
const lastCreatedMethod = allMethods.reduce((a, b) => {
|
|
120
|
+
if (a.createdAt && b.createdAt) {
|
|
121
|
+
return a.createdAt >= b.createdAt ? a : b;
|
|
122
|
+
}
|
|
123
|
+
if (b.createdAt) {
|
|
124
|
+
return b;
|
|
125
|
+
}
|
|
126
|
+
return a;
|
|
127
|
+
});
|
|
128
|
+
switch (lastCreatedMethod.type) {
|
|
129
|
+
case MFADeviceType.Passkey:
|
|
130
|
+
pushView('passkey-confirm', {
|
|
131
|
+
createMfaToken: props === null || props === void 0 ? void 0 : props.createMfaToken,
|
|
132
|
+
});
|
|
133
|
+
break;
|
|
134
|
+
case MFADeviceType.Totp:
|
|
135
|
+
pushView('mfa-verification', {
|
|
136
|
+
createMfaToken: props === null || props === void 0 ? void 0 : props.createMfaToken,
|
|
137
|
+
});
|
|
138
|
+
break;
|
|
139
|
+
default:
|
|
140
|
+
throw new Error('Error determining MFA method to use');
|
|
141
|
+
}
|
|
142
|
+
}), [getUserMfaMethods, pushView, setShowAuthFlow]);
|
|
143
|
+
return promptMfaAuth;
|
|
144
|
+
};
|
|
145
|
+
|
|
146
|
+
export { usePromptMfaAuth };
|
|
@@ -101,6 +101,7 @@ require('../../../widgets/DynamicWidget/views/ReceiveWalletFunds/ReceiveWalletFu
|
|
|
101
101
|
require('../../../../index.cjs');
|
|
102
102
|
var useDynamicWaas = require('../useDynamicWaas/useDynamicWaas.cjs');
|
|
103
103
|
var apiUrl = require('../../constants/waas/apiUrl.cjs');
|
|
104
|
+
var useGetMfaToken = require('../useGetMfaToken/useGetMfaToken.cjs');
|
|
104
105
|
require('../../../store/state/tokenBalances.cjs');
|
|
105
106
|
require('../../../store/state/multichainBalances.cjs');
|
|
106
107
|
require('../../../shared/utils/functions/getInitialUrl/getInitialUrl.cjs');
|
|
@@ -111,6 +112,7 @@ const useSetWalletConnectorFetchers = (walletOptions, environmentId, projectSett
|
|
|
111
112
|
const authToken = getMinAuthToken.getMinAuthToken();
|
|
112
113
|
const { registerEmbeddedWalletSessionKey, removeSessionKey } = useEmbeddedWalletSessionKeys.useEmbeddedWalletSessionKeys({ environmentId, projectSettings });
|
|
113
114
|
const { getSignedSessionId } = useClientSessionKeys.useClientSessionKeys();
|
|
115
|
+
const getMfaToken = useGetMfaToken.useGetMfaToken();
|
|
114
116
|
if (!(walletOptions === null || walletOptions === void 0 ? void 0 : walletOptions.length))
|
|
115
117
|
return;
|
|
116
118
|
walletOptions.forEach((walletOption) => {
|
|
@@ -124,6 +126,7 @@ const useSetWalletConnectorFetchers = (walletOptions, environmentId, projectSett
|
|
|
124
126
|
apiBaseUrl: apiBaseUrl !== null && apiBaseUrl !== void 0 ? apiBaseUrl : apiUrl.DEFAULT_WAAS_API_URL,
|
|
125
127
|
authToken,
|
|
126
128
|
environmentId,
|
|
129
|
+
getMfaToken,
|
|
127
130
|
getSignedSessionId,
|
|
128
131
|
relayUrl: (_e = (_d = (_c = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.sdk) === null || _c === void 0 ? void 0 : _c.waas) === null || _d === void 0 ? void 0 : _d.relayUrl) !== null && _e !== void 0 ? _e : '',
|
|
129
132
|
walletConnector: walletOption.walletConnector,
|
|
@@ -97,6 +97,7 @@ import '../../../widgets/DynamicWidget/views/ReceiveWalletFunds/ReceiveWalletFun
|
|
|
97
97
|
import '../../../../index.js';
|
|
98
98
|
import { configWaasWalletConnector } from '../useDynamicWaas/useDynamicWaas.js';
|
|
99
99
|
import { DEFAULT_WAAS_API_URL } from '../../constants/waas/apiUrl.js';
|
|
100
|
+
import { useGetMfaToken } from '../useGetMfaToken/useGetMfaToken.js';
|
|
100
101
|
import '../../../store/state/tokenBalances.js';
|
|
101
102
|
import '../../../store/state/multichainBalances.js';
|
|
102
103
|
import '../../../shared/utils/functions/getInitialUrl/getInitialUrl.js';
|
|
@@ -107,6 +108,7 @@ const useSetWalletConnectorFetchers = (walletOptions, environmentId, projectSett
|
|
|
107
108
|
const authToken = getMinAuthToken();
|
|
108
109
|
const { registerEmbeddedWalletSessionKey, removeSessionKey } = useEmbeddedWalletSessionKeys({ environmentId, projectSettings });
|
|
109
110
|
const { getSignedSessionId } = useClientSessionKeys();
|
|
111
|
+
const getMfaToken = useGetMfaToken();
|
|
110
112
|
if (!(walletOptions === null || walletOptions === void 0 ? void 0 : walletOptions.length))
|
|
111
113
|
return;
|
|
112
114
|
walletOptions.forEach((walletOption) => {
|
|
@@ -120,6 +122,7 @@ const useSetWalletConnectorFetchers = (walletOptions, environmentId, projectSett
|
|
|
120
122
|
apiBaseUrl: apiBaseUrl !== null && apiBaseUrl !== void 0 ? apiBaseUrl : DEFAULT_WAAS_API_URL,
|
|
121
123
|
authToken,
|
|
122
124
|
environmentId,
|
|
125
|
+
getMfaToken,
|
|
123
126
|
getSignedSessionId,
|
|
124
127
|
relayUrl: (_e = (_d = (_c = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.sdk) === null || _c === void 0 ? void 0 : _c.waas) === null || _d === void 0 ? void 0 : _d.relayUrl) !== null && _e !== void 0 ? _e : '',
|
|
125
128
|
walletConnector: walletOption.walletConnector,
|
|
@@ -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,
|