@dynamic-labs/sdk-react-core 4.32.1-alpha.0 → 4.32.1
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 +9 -2
- package/package.cjs +2 -2
- package/package.js +2 -2
- package/package.json +12 -12
- package/src/index.cjs +10 -2
- package/src/index.d.ts +2 -2
- package/src/index.js +4 -2
- package/src/lib/client/extension/hooks/useClientState/useClientState.cjs +1 -3
- package/src/lib/client/extension/hooks/useClientState/useClientState.js +1 -3
- package/src/lib/context/DynamicContext/useDynamicContext/useOverrides/useOverrides.cjs +3 -0
- package/src/lib/context/DynamicContext/useDynamicContext/useOverrides/useOverrides.js +3 -0
- package/src/lib/context/SocialRedirectContext/hooks/useRedirectSocialHandler/useRedirectSocialHandler.cjs +3 -1
- package/src/lib/context/SocialRedirectContext/hooks/useRedirectSocialHandler/useRedirectSocialHandler.js +3 -1
- package/src/lib/utils/functions/socialStorage/socialStorage.d.ts +5 -0
- package/src/lib/utils/functions/walletListBuilder/utils/applyMultiWalletFilters/applyMultiWalletFilters.cjs +1 -4
- package/src/lib/utils/functions/walletListBuilder/utils/applyMultiWalletFilters/applyMultiWalletFilters.js +1 -4
- package/src/lib/utils/hooks/index.d.ts +2 -0
- package/src/lib/utils/hooks/useGetMfaToken/useGetMfaToken.cjs +2 -18
- package/src/lib/utils/hooks/useGetMfaToken/useGetMfaToken.js +3 -19
- package/src/lib/utils/hooks/useIsMfaRequiredForAction/index.d.ts +1 -0
- package/src/lib/utils/hooks/useIsMfaRequiredForAction/useIsMfaRequiredForAction.cjs +34 -0
- package/src/lib/utils/hooks/useIsMfaRequiredForAction/useIsMfaRequiredForAction.d.ts +25 -0
- package/src/lib/utils/hooks/useIsMfaRequiredForAction/useIsMfaRequiredForAction.js +30 -0
- package/src/lib/utils/hooks/usePromptMfaAuth/usePromptMfaAuth.cjs +36 -5
- package/src/lib/utils/hooks/usePromptMfaAuth/usePromptMfaAuth.d.ts +1 -1
- package/src/lib/utils/hooks/usePromptMfaAuth/usePromptMfaAuth.js +36 -5
- package/src/lib/utils/hooks/useSocialAccounts/useSocialAccounts.cjs +1 -0
- package/src/lib/utils/hooks/useSocialAccounts/useSocialAccounts.js +1 -0
- package/src/lib/utils/hooks/useSocialAuth/useSocialAuth.cjs +2 -1
- package/src/lib/utils/hooks/useSocialAuth/useSocialAuth.d.ts +2 -0
- package/src/lib/utils/hooks/useSocialAuth/useSocialAuth.js +2 -1
- package/src/lib/utils/hooks/useSyncDynamicWaas/useSyncDynamicWaas.cjs +122 -50
- package/src/lib/utils/hooks/useSyncDynamicWaas/useSyncDynamicWaas.d.ts +11 -0
- package/src/lib/utils/hooks/useSyncDynamicWaas/useSyncDynamicWaas.js +124 -52
- package/src/lib/widgets/DynamicWidget/components/PasskeyCard/PasskeyCard.cjs +8 -1
- package/src/lib/widgets/DynamicWidget/components/PasskeyCard/PasskeyCard.js +8 -1
- package/src/lib/utils/functions/walletListBuilder/utils/createWalletConnectWalletsFilter/createWalletConnectWalletsFilter.cjs +0 -20
- package/src/lib/utils/functions/walletListBuilder/utils/createWalletConnectWalletsFilter/createWalletConnectWalletsFilter.d.ts +0 -6
- package/src/lib/utils/functions/walletListBuilder/utils/createWalletConnectWalletsFilter/createWalletConnectWalletsFilter.js +0 -16
- package/src/lib/utils/functions/walletListBuilder/utils/createWalletConnectWalletsFilter/index.d.ts +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,11 +1,18 @@
|
|
|
1
1
|
|
|
2
|
-
### [4.32.1
|
|
2
|
+
### [4.32.1](https://github.com/dynamic-labs/dynamic-auth/compare/v4.32.0...v4.32.1) (2025-09-25)
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
### Features
|
|
6
|
+
|
|
7
|
+
* allow connecting multiple WC wallets ([#9493](https://github.com/dynamic-labs/dynamic-auth/issues/9493)) ([350c53c](https://github.com/dynamic-labs/dynamic-auth/commit/350c53cfc2198a565e9a324d9d65c3e57883d772))
|
|
8
|
+
* always use redirect inside MM IAB ([#9535](https://github.com/dynamic-labs/dynamic-auth/issues/9535)) ([8aca796](https://github.com/dynamic-labs/dynamic-auth/commit/8aca7968dfa0ef0f3caee043b415f9f76187112e))
|
|
3
9
|
|
|
4
10
|
|
|
5
11
|
### Bug Fixes
|
|
6
12
|
|
|
7
13
|
* correct naming ([#9513](https://github.com/dynamic-labs/dynamic-auth/issues/9513)) ([5b4e31b](https://github.com/dynamic-labs/dynamic-auth/commit/5b4e31b9bbf2401d377201a4cd12edf79eaef75f))
|
|
8
|
-
*
|
|
14
|
+
* correct Safe Wallet App Store ID to prevent misdirect ([#9531](https://github.com/dynamic-labs/dynamic-auth/issues/9531)) ([b58adc5](https://github.com/dynamic-labs/dynamic-auth/commit/b58adc54de8018bf25011b205b94977da9676c2d))
|
|
15
|
+
* prevent social login popup in headless scenarios ([#9541](https://github.com/dynamic-labs/dynamic-auth/issues/9541)) ([a91c0b0](https://github.com/dynamic-labs/dynamic-auth/commit/a91c0b0d1d09210fa149cae80abab6978f4ae998))
|
|
9
16
|
|
|
10
17
|
## [4.32.0](https://github.com/dynamic-labs/dynamic-auth/compare/v4.31.4...v4.32.0) (2025-09-17)
|
|
11
18
|
|
package/package.cjs
CHANGED
|
@@ -3,10 +3,10 @@
|
|
|
3
3
|
|
|
4
4
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
5
|
|
|
6
|
-
var version = "4.32.1
|
|
6
|
+
var version = "4.32.1";
|
|
7
7
|
var dependencies = {
|
|
8
8
|
"@dynamic-labs/sdk-api-core": "0.0.762",
|
|
9
|
-
"@dynamic-labs-sdk/client": "0.1.0-alpha.
|
|
9
|
+
"@dynamic-labs-sdk/client": "0.1.0-alpha.8",
|
|
10
10
|
"@hcaptcha/react-hcaptcha": "1.4.4",
|
|
11
11
|
"@thumbmarkjs/thumbmarkjs": "0.16.0",
|
|
12
12
|
"country-list": "2.3.0",
|
package/package.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
'use client'
|
|
2
|
-
var version = "4.32.1
|
|
2
|
+
var version = "4.32.1";
|
|
3
3
|
var dependencies = {
|
|
4
4
|
"@dynamic-labs/sdk-api-core": "0.0.762",
|
|
5
|
-
"@dynamic-labs-sdk/client": "0.1.0-alpha.
|
|
5
|
+
"@dynamic-labs-sdk/client": "0.1.0-alpha.8",
|
|
6
6
|
"@hcaptcha/react-hcaptcha": "1.4.4",
|
|
7
7
|
"@thumbmarkjs/thumbmarkjs": "0.16.0",
|
|
8
8
|
"country-list": "2.3.0",
|
package/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dynamic-labs/sdk-react-core",
|
|
3
|
-
"version": "4.32.1
|
|
3
|
+
"version": "4.32.1",
|
|
4
4
|
"dependencies": {
|
|
5
5
|
"@dynamic-labs/sdk-api-core": "0.0.762",
|
|
6
|
-
"@dynamic-labs-sdk/client": "0.1.0-alpha.
|
|
6
|
+
"@dynamic-labs-sdk/client": "0.1.0-alpha.8",
|
|
7
7
|
"@hcaptcha/react-hcaptcha": "1.4.4",
|
|
8
8
|
"@thumbmarkjs/thumbmarkjs": "0.16.0",
|
|
9
9
|
"country-list": "2.3.0",
|
|
@@ -15,16 +15,16 @@
|
|
|
15
15
|
"yup": "0.32.11",
|
|
16
16
|
"react-international-phone": "4.5.0",
|
|
17
17
|
"bs58": "5.0.0",
|
|
18
|
-
"@dynamic-labs/assert-package-version": "4.32.1
|
|
19
|
-
"@dynamic-labs/iconic": "4.32.1
|
|
20
|
-
"@dynamic-labs/logger": "4.32.1
|
|
21
|
-
"@dynamic-labs/multi-wallet": "4.32.1
|
|
22
|
-
"@dynamic-labs/rpc-providers": "4.32.1
|
|
23
|
-
"@dynamic-labs/store": "4.32.1
|
|
24
|
-
"@dynamic-labs/types": "4.32.1
|
|
25
|
-
"@dynamic-labs/utils": "4.32.1
|
|
26
|
-
"@dynamic-labs/wallet-book": "4.32.1
|
|
27
|
-
"@dynamic-labs/wallet-connector-core": "4.32.1
|
|
18
|
+
"@dynamic-labs/assert-package-version": "4.32.1",
|
|
19
|
+
"@dynamic-labs/iconic": "4.32.1",
|
|
20
|
+
"@dynamic-labs/logger": "4.32.1",
|
|
21
|
+
"@dynamic-labs/multi-wallet": "4.32.1",
|
|
22
|
+
"@dynamic-labs/rpc-providers": "4.32.1",
|
|
23
|
+
"@dynamic-labs/store": "4.32.1",
|
|
24
|
+
"@dynamic-labs/types": "4.32.1",
|
|
25
|
+
"@dynamic-labs/utils": "4.32.1",
|
|
26
|
+
"@dynamic-labs/wallet-book": "4.32.1",
|
|
27
|
+
"@dynamic-labs/wallet-connector-core": "4.32.1",
|
|
28
28
|
"eventemitter3": "5.0.1"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
package/src/index.cjs
CHANGED
|
@@ -152,7 +152,7 @@ var NetworkNotSupportedSwitchManual = require('./lib/views/NetworkNotSupportedSw
|
|
|
152
152
|
var viewToComponentMap = require('./lib/views/viewToComponentMap.cjs');
|
|
153
153
|
require('./lib/store/state/connectorsInitializing/connectorsInitializing.cjs');
|
|
154
154
|
var useDynamicWaas = require('./lib/utils/hooks/useDynamicWaas/useDynamicWaas.cjs');
|
|
155
|
-
var
|
|
155
|
+
var useGetMfaToken = require('./lib/utils/hooks/useGetMfaToken/useGetMfaToken.cjs');
|
|
156
156
|
var useDynamicModals = require('./lib/utils/hooks/useDynamicModals/useDynamicModals.cjs');
|
|
157
157
|
var useMfa = require('./lib/utils/hooks/useMfa/useMfa.cjs');
|
|
158
158
|
var useTokenBalances = require('./lib/utils/hooks/useTokenBalances/useTokenBalances.cjs');
|
|
@@ -172,8 +172,10 @@ var useDeletePasskey = require('./lib/utils/hooks/useDeletePasskey/useDeletePass
|
|
|
172
172
|
var useRegisterPasskey = require('./lib/utils/hooks/useRegisterPasskey/useRegisterPasskey.cjs');
|
|
173
173
|
var useAuthenticatePasskeyMFA = require('./lib/utils/hooks/useAuthenticatePasskeyMFA/useAuthenticatePasskeyMFA.cjs');
|
|
174
174
|
var useSignInWithPasskey = require('./lib/utils/hooks/useSignInWithPasskey/useSignInWithPasskey.cjs');
|
|
175
|
+
var useGetUserMfaMethods = require('./lib/utils/hooks/useGetUserMfaMethods/useGetUserMfaMethods.cjs');
|
|
175
176
|
var usePromptMfaAuth = require('./lib/utils/hooks/usePromptMfaAuth/usePromptMfaAuth.cjs');
|
|
176
177
|
var useUpgradeToDynamicWaasFlow = require('./lib/utils/hooks/useUpgradeToDynamicWaasFlow/useUpgradeToDynamicWaasFlow.cjs');
|
|
178
|
+
var useIsMfaRequiredForAction = require('./lib/utils/hooks/useIsMfaRequiredForAction/useIsMfaRequiredForAction.cjs');
|
|
177
179
|
var DynamicConnectButton = require('./lib/components/DynamicConnectButton/DynamicConnectButton.cjs');
|
|
178
180
|
require('./lib/components/InlineWidget/InlineWidget.cjs');
|
|
179
181
|
var IsBrowser = require('./lib/components/IsBrowser/IsBrowser.cjs');
|
|
@@ -242,6 +244,10 @@ Object.defineProperty(exports, 'DynamicJwtFromJSON', {
|
|
|
242
244
|
enumerable: true,
|
|
243
245
|
get: function () { return sdkApiCore.DynamicJwtFromJSON; }
|
|
244
246
|
});
|
|
247
|
+
Object.defineProperty(exports, 'MFAAction', {
|
|
248
|
+
enumerable: true,
|
|
249
|
+
get: function () { return sdkApiCore.MFAAction; }
|
|
250
|
+
});
|
|
245
251
|
exports.getChainIcon = getChainIcon.getChainIcon;
|
|
246
252
|
exports.getChainDisplayName = getChainDisplayName.getChainDisplayName;
|
|
247
253
|
exports.createWallet = createWallet.createWallet;
|
|
@@ -295,7 +301,7 @@ exports.FarcasterConnectView = FarcasterConnectView.FarcasterConnectView;
|
|
|
295
301
|
exports.NetworkNotSupportedSwitchManual = NetworkNotSupportedSwitchManual.NetworkNotSupportedSwitchManual;
|
|
296
302
|
exports.viewToComponentMap = viewToComponentMap.viewToComponentMap;
|
|
297
303
|
exports.useDynamicWaas = useDynamicWaas.useDynamicWaas;
|
|
298
|
-
exports.
|
|
304
|
+
exports.useGetMfaToken = useGetMfaToken.useGetMfaToken;
|
|
299
305
|
exports.useDynamicModals = useDynamicModals.useDynamicModals;
|
|
300
306
|
exports.useMfa = useMfa.useMfa;
|
|
301
307
|
exports.useTokenBalances = useTokenBalances.useTokenBalances;
|
|
@@ -318,8 +324,10 @@ exports.useDeletePasskey = useDeletePasskey.useDeletePasskey;
|
|
|
318
324
|
exports.useRegisterPasskey = useRegisterPasskey.useRegisterPasskey;
|
|
319
325
|
exports.useAuthenticatePasskeyMFA = useAuthenticatePasskeyMFA.useAuthenticatePasskeyMFA;
|
|
320
326
|
exports.useSignInWithPasskey = useSignInWithPasskey.useSignInWithPasskey;
|
|
327
|
+
exports.useGetUserMfaMethods = useGetUserMfaMethods.useGetUserMfaMethods;
|
|
321
328
|
exports.usePromptMfaAuth = usePromptMfaAuth.usePromptMfaAuth;
|
|
322
329
|
exports.useUpgradeToDynamicWaasFlow = useUpgradeToDynamicWaasFlow.useUpgradeToDynamicWaasFlow;
|
|
330
|
+
exports.useIsMfaRequiredForAction = useIsMfaRequiredForAction.useIsMfaRequiredForAction;
|
|
323
331
|
exports.DynamicConnectButton = DynamicConnectButton.DynamicConnectButton;
|
|
324
332
|
exports.IsBrowser = IsBrowser.IsBrowser;
|
|
325
333
|
exports.DynamicBridgeWidget = DynamicBridgeWidget.DynamicBridgeWidget;
|
package/src/index.d.ts
CHANGED
|
@@ -116,7 +116,7 @@ export { useProjectSettings } from './lib/store/state/projectSettings';
|
|
|
116
116
|
export {
|
|
117
117
|
/** @deprecated */
|
|
118
118
|
DynamicWidgetContextProvider, } from './lib/widgets/DynamicWidget/context';
|
|
119
|
-
export { useWalletItemActions, useAuthenticateConnectedUser, useSocialAccounts, useEmbeddedWallet, useEmbeddedWalletAuthenticator, usePasskeyRecovery, useEmbeddedReveal, useIsLoggedIn, useDynamicModals, useMfa, useTokenBalances, useMultichainTokenBalances, useSwitchWallet, useRpcProviders, useRefreshUser, useWalletOptions, useSmartWallets, EmbeddedWalletVersion, useTelegramLogin, useUpgradeEmbeddedWallet, useEVMTransactionSimulation, useSVMTransactionSimulation, useDeleteUserAccount, useDynamicWaas, useGetPasskeys, useDeletePasskey, useRegisterPasskey, useAuthenticatePasskeyMFA, useGetUserMfaMethods, usePromptMfaAuth, useUpgradeToDynamicWaasFlow, } from './lib/utils/hooks';
|
|
119
|
+
export { useWalletItemActions, useAuthenticateConnectedUser, useSocialAccounts, useEmbeddedWallet, useEmbeddedWalletAuthenticator, usePasskeyRecovery, useEmbeddedReveal, useIsLoggedIn, useDynamicModals, useMfa, useTokenBalances, useMultichainTokenBalances, useSwitchWallet, useRpcProviders, useRefreshUser, useWalletOptions, useSmartWallets, EmbeddedWalletVersion, useTelegramLogin, useUpgradeEmbeddedWallet, useEVMTransactionSimulation, useSVMTransactionSimulation, useDeleteUserAccount, useDynamicWaas, useGetPasskeys, useDeletePasskey, useRegisterPasskey, useAuthenticatePasskeyMFA, useGetUserMfaMethods, usePromptMfaAuth, useUpgradeToDynamicWaasFlow, useGetMfaToken, useIsMfaRequiredForAction, } from './lib/utils/hooks';
|
|
120
120
|
export {
|
|
121
121
|
/** @deprecated use useOnramp instead */
|
|
122
122
|
useFunding, } from './lib/utils/hooks/useFunding';
|
|
@@ -127,7 +127,7 @@ export { usePayWithDynamic, type PayWithDynamicProps, } from './lib/utils/hooks/
|
|
|
127
127
|
export { useUserUpdateRequest, useWalletConnectorEvent, } from './lib/utils/hooks';
|
|
128
128
|
export { type VerifyOtp, useOtpVerificationRequest, } from './lib/utils/hooks/authenticationHooks/';
|
|
129
129
|
export type { UpdateUserFieldsArg } from './lib/utils/hooks/';
|
|
130
|
-
export { type DynamicJwt, DynamicJwtFromJSON, ChainEnum, } from '@dynamic-labs/sdk-api-core';
|
|
130
|
+
export { type DynamicJwt, DynamicJwtFromJSON, ChainEnum, MFAAction, } from '@dynamic-labs/sdk-api-core';
|
|
131
131
|
export { useSendBalance } from './lib/context/SendBalanceContext';
|
|
132
132
|
export type { LocaleResource } from './lib/locale';
|
|
133
133
|
export { useConnectWithOtp } from './lib/context/ConnectWithOtpContext';
|
package/src/index.js
CHANGED
|
@@ -40,7 +40,7 @@ export { ReactComponent as ArrowIcon } from './lib/shared/assets/stroke.js';
|
|
|
40
40
|
import '@dynamic-labs/iconic';
|
|
41
41
|
import './lib/context/ViewContext/ViewContext.js';
|
|
42
42
|
import '../_virtual/_tslib.js';
|
|
43
|
-
export { ChainEnum, DynamicJwtFromJSON } from '@dynamic-labs/sdk-api-core';
|
|
43
|
+
export { ChainEnum, DynamicJwtFromJSON, MFAAction } from '@dynamic-labs/sdk-api-core';
|
|
44
44
|
import './lib/shared/logger.js';
|
|
45
45
|
export { getChainIcon } from './lib/shared/utils/functions/chain/getChainIcon.js';
|
|
46
46
|
export { getChainDisplayName } from './lib/shared/utils/functions/chain/getChainDisplayName.js';
|
|
@@ -148,7 +148,7 @@ export { NetworkNotSupportedSwitchManual } from './lib/views/NetworkNotSupported
|
|
|
148
148
|
export { viewToComponentMap } from './lib/views/viewToComponentMap.js';
|
|
149
149
|
import './lib/store/state/connectorsInitializing/connectorsInitializing.js';
|
|
150
150
|
export { useDynamicWaas } from './lib/utils/hooks/useDynamicWaas/useDynamicWaas.js';
|
|
151
|
-
export {
|
|
151
|
+
export { useGetMfaToken } from './lib/utils/hooks/useGetMfaToken/useGetMfaToken.js';
|
|
152
152
|
export { useDynamicModals } from './lib/utils/hooks/useDynamicModals/useDynamicModals.js';
|
|
153
153
|
export { useMfa } from './lib/utils/hooks/useMfa/useMfa.js';
|
|
154
154
|
export { useTokenBalances } from './lib/utils/hooks/useTokenBalances/useTokenBalances.js';
|
|
@@ -168,8 +168,10 @@ export { useDeletePasskey } from './lib/utils/hooks/useDeletePasskey/useDeletePa
|
|
|
168
168
|
export { useRegisterPasskey } from './lib/utils/hooks/useRegisterPasskey/useRegisterPasskey.js';
|
|
169
169
|
export { useAuthenticatePasskeyMFA } from './lib/utils/hooks/useAuthenticatePasskeyMFA/useAuthenticatePasskeyMFA.js';
|
|
170
170
|
export { useSignInWithPasskey } from './lib/utils/hooks/useSignInWithPasskey/useSignInWithPasskey.js';
|
|
171
|
+
export { useGetUserMfaMethods } from './lib/utils/hooks/useGetUserMfaMethods/useGetUserMfaMethods.js';
|
|
171
172
|
export { usePromptMfaAuth } from './lib/utils/hooks/usePromptMfaAuth/usePromptMfaAuth.js';
|
|
172
173
|
export { useUpgradeToDynamicWaasFlow } from './lib/utils/hooks/useUpgradeToDynamicWaasFlow/useUpgradeToDynamicWaasFlow.js';
|
|
174
|
+
export { useIsMfaRequiredForAction } from './lib/utils/hooks/useIsMfaRequiredForAction/useIsMfaRequiredForAction.js';
|
|
173
175
|
export { DynamicConnectButton } from './lib/components/DynamicConnectButton/DynamicConnectButton.js';
|
|
174
176
|
import './lib/components/InlineWidget/InlineWidget.js';
|
|
175
177
|
export { IsBrowser } from './lib/components/IsBrowser/IsBrowser.js';
|
|
@@ -14,9 +14,7 @@ const useClientState = (variable) => {
|
|
|
14
14
|
setCurrent(client$2[variable]);
|
|
15
15
|
client$1.onEvent({
|
|
16
16
|
event: `${variable}Changed`,
|
|
17
|
-
listener: (
|
|
18
|
-
setCurrent(args[variable]);
|
|
19
|
-
},
|
|
17
|
+
listener: () => setCurrent(client$2[variable]),
|
|
20
18
|
}, client$2);
|
|
21
19
|
}, [client$2, variable]);
|
|
22
20
|
return current !== null && current !== void 0 ? current : undefined;
|
|
@@ -10,9 +10,7 @@ const useClientState = (variable) => {
|
|
|
10
10
|
setCurrent(client[variable]);
|
|
11
11
|
onEvent({
|
|
12
12
|
event: `${variable}Changed`,
|
|
13
|
-
listener: (
|
|
14
|
-
setCurrent(args[variable]);
|
|
15
|
-
},
|
|
13
|
+
listener: () => setCurrent(client[variable]),
|
|
16
14
|
}, client);
|
|
17
15
|
}, [client, variable]);
|
|
18
16
|
return current !== null && current !== void 0 ? current : undefined;
|
|
@@ -110,6 +110,9 @@ const useOverrides = (dynamicContext) => {
|
|
|
110
110
|
return React.useMemo(() => ({
|
|
111
111
|
authMode: authMode$1,
|
|
112
112
|
setAuthMode: (value) => {
|
|
113
|
+
if (value === authMode$1) {
|
|
114
|
+
return;
|
|
115
|
+
}
|
|
113
116
|
// If there's a connected wallet, log an error and ignore
|
|
114
117
|
if (isLoggedIn) {
|
|
115
118
|
logger.logger.error("Calling DynamicContext's setAuthMode method when the user already has a wallet is a noop");
|
|
@@ -106,6 +106,9 @@ const useOverrides = (dynamicContext) => {
|
|
|
106
106
|
return useMemo(() => ({
|
|
107
107
|
authMode,
|
|
108
108
|
setAuthMode: (value) => {
|
|
109
|
+
if (value === authMode) {
|
|
110
|
+
return;
|
|
111
|
+
}
|
|
109
112
|
// If there's a connected wallet, log an error and ignore
|
|
110
113
|
if (isLoggedIn) {
|
|
111
114
|
logger.error("Calling DynamicContext's setAuthMode method when the user already has a wallet is a noop");
|
|
@@ -122,7 +122,9 @@ const useRedirectSocialHandler = ({ setSocialProvider, }) => {
|
|
|
122
122
|
setSocialProvider(socialSignInProvider);
|
|
123
123
|
clearStackAndPush('social-redirect-view');
|
|
124
124
|
// Only open the auth flow when the embedded widget is not rendered
|
|
125
|
-
|
|
125
|
+
// and when this is NOT a headless sign-in flow
|
|
126
|
+
const isHeadless = Boolean(socialStorageItem.isHeadlessSocialSignIn);
|
|
127
|
+
if (!isRenderingEmbeddedAuthFlow && !isHeadless) {
|
|
126
128
|
setShowAuthFlow(true);
|
|
127
129
|
}
|
|
128
130
|
}, [
|
|
@@ -118,7 +118,9 @@ const useRedirectSocialHandler = ({ setSocialProvider, }) => {
|
|
|
118
118
|
setSocialProvider(socialSignInProvider);
|
|
119
119
|
clearStackAndPush('social-redirect-view');
|
|
120
120
|
// Only open the auth flow when the embedded widget is not rendered
|
|
121
|
-
|
|
121
|
+
// and when this is NOT a headless sign-in flow
|
|
122
|
+
const isHeadless = Boolean(socialStorageItem.isHeadlessSocialSignIn);
|
|
123
|
+
if (!isRenderingEmbeddedAuthFlow && !isHeadless) {
|
|
122
124
|
setShowAuthFlow(true);
|
|
123
125
|
}
|
|
124
126
|
}, [
|
|
@@ -22,6 +22,11 @@ export type SocialStorageItem = {
|
|
|
22
22
|
* If this is true, then we will pass in additional props and hide back button
|
|
23
23
|
*/
|
|
24
24
|
payingWithDynamic?: PayWithDynamicProps;
|
|
25
|
+
/**
|
|
26
|
+
* Whether the sign-in was initiated via the headless hook `signInWithSocialAccount`.
|
|
27
|
+
* Used by the redirect handler to avoid opening the standard widget UI.
|
|
28
|
+
*/
|
|
29
|
+
isHeadlessSocialSignIn?: boolean;
|
|
25
30
|
};
|
|
26
31
|
export type SocialStorage = Partial<Record<ProviderEnum, SocialStorageItem>>;
|
|
27
32
|
export declare const searchSocialStorageByState: (targetState: string) => SocialStorageItem | undefined;
|
|
@@ -5,14 +5,11 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
|
|
6
6
|
var filterConnectedWallets = require('../filterConnectedWallets/filterConnectedWallets.cjs');
|
|
7
7
|
var staticLinkedWalletFilter = require('../staticLinkedWalletFilter/staticLinkedWalletFilter.cjs');
|
|
8
|
-
var createWalletConnectWalletsFilter = require('../createWalletConnectWalletsFilter/createWalletConnectWalletsFilter.cjs');
|
|
9
8
|
var createMetaMaskMobileFilter = require('../createMetaMaskMobileFilter/createMetaMaskMobileFilter.cjs');
|
|
10
9
|
var authMode = require('../../../../../store/state/authMode/authMode.cjs');
|
|
11
10
|
|
|
12
11
|
const applyMultiWalletFilters = ({ userWallets, walletOptions, }) => {
|
|
13
|
-
const walletList = walletOptions
|
|
14
|
-
.filter(createWalletConnectWalletsFilter.createWalletConnectWalletsFilter(userWallets))
|
|
15
|
-
.filter(createMetaMaskMobileFilter.createMetaMaskMobileFilter(userWallets));
|
|
12
|
+
const walletList = walletOptions.filter(createMetaMaskMobileFilter.createMetaMaskMobileFilter(userWallets));
|
|
16
13
|
const authMode$1 = authMode.getAuthMode();
|
|
17
14
|
if (authMode$1 === 'connect-only') {
|
|
18
15
|
return filterConnectedWallets.filterConnectedWallets({
|
|
@@ -1,14 +1,11 @@
|
|
|
1
1
|
'use client'
|
|
2
2
|
import { filterConnectedWallets } from '../filterConnectedWallets/filterConnectedWallets.js';
|
|
3
3
|
import { staticWalletFilter } from '../staticLinkedWalletFilter/staticLinkedWalletFilter.js';
|
|
4
|
-
import { createWalletConnectWalletsFilter } from '../createWalletConnectWalletsFilter/createWalletConnectWalletsFilter.js';
|
|
5
4
|
import { createMetaMaskMobileFilter } from '../createMetaMaskMobileFilter/createMetaMaskMobileFilter.js';
|
|
6
5
|
import { getAuthMode } from '../../../../../store/state/authMode/authMode.js';
|
|
7
6
|
|
|
8
7
|
const applyMultiWalletFilters = ({ userWallets, walletOptions, }) => {
|
|
9
|
-
const walletList = walletOptions
|
|
10
|
-
.filter(createWalletConnectWalletsFilter(userWallets))
|
|
11
|
-
.filter(createMetaMaskMobileFilter(userWallets));
|
|
8
|
+
const walletList = walletOptions.filter(createMetaMaskMobileFilter(userWallets));
|
|
12
9
|
const authMode = getAuthMode();
|
|
13
10
|
if (authMode === 'connect-only') {
|
|
14
11
|
return filterConnectedWallets({
|
|
@@ -94,3 +94,5 @@ export { useSignInWithPasskey } from './useSignInWithPasskey';
|
|
|
94
94
|
export { useGetUserMfaMethods } from './useGetUserMfaMethods';
|
|
95
95
|
export { usePromptMfaAuth } from './usePromptMfaAuth';
|
|
96
96
|
export { useUpgradeToDynamicWaasFlow } from './useUpgradeToDynamicWaasFlow';
|
|
97
|
+
export { useGetMfaToken } from './useGetMfaToken';
|
|
98
|
+
export { useIsMfaRequiredForAction } from './useIsMfaRequiredForAction';
|
|
@@ -17,8 +17,6 @@ require('@dynamic-labs/wallet-book');
|
|
|
17
17
|
require('../../constants/colors.cjs');
|
|
18
18
|
require('../../constants/values.cjs');
|
|
19
19
|
require('../../../shared/consts/index.cjs');
|
|
20
|
-
var projectSettings = require('../../../store/state/projectSettings/projectSettings.cjs');
|
|
21
|
-
var useGetUserMfaMethods = require('../useGetUserMfaMethods/useGetUserMfaMethods.cjs');
|
|
22
20
|
|
|
23
21
|
/**
|
|
24
22
|
* Get MFA token
|
|
@@ -40,26 +38,12 @@ var useGetUserMfaMethods = require('../useGetUserMfaMethods/useGetUserMfaMethods
|
|
|
40
38
|
* }
|
|
41
39
|
*/
|
|
42
40
|
const useGetMfaToken = () => {
|
|
43
|
-
const getUserMfaMethods = useGetUserMfaMethods.useGetUserMfaMethods();
|
|
44
41
|
const shouldConsumeMfaToken = React.useCallback((...args_1) => _tslib.__awaiter(void 0, [...args_1], void 0, function* ({ mfaAction } = {}) {
|
|
45
|
-
var _a, _b, _c, _d, _e;
|
|
46
42
|
if (!mfaAction) {
|
|
47
43
|
return true;
|
|
48
44
|
}
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
// if mfa token is not required for this action, no need to consume it
|
|
52
|
-
if (!isMfaRequiredForAction) {
|
|
53
|
-
return false;
|
|
54
|
-
}
|
|
55
|
-
const isMfaMethodRequired = (_e = (_d = projectSettings$1 === null || projectSettings$1 === void 0 ? void 0 : projectSettings$1.security) === null || _d === void 0 ? void 0 : _d.mfa) === null || _e === void 0 ? void 0 : _e.required;
|
|
56
|
-
if (isMfaMethodRequired) {
|
|
57
|
-
return true;
|
|
58
|
-
}
|
|
59
|
-
const methods = yield getUserMfaMethods();
|
|
60
|
-
// if mfa is not required and user has no methods registered, no need to consume the token
|
|
61
|
-
return methods.userHasVerifiedMfaMethods;
|
|
62
|
-
}), [getUserMfaMethods]);
|
|
45
|
+
return client.isMfaRequiredForAction({ mfaAction });
|
|
46
|
+
}), []);
|
|
63
47
|
return React.useCallback((...args_2) => _tslib.__awaiter(void 0, [...args_2], void 0, function* ({ mfaAction } = {}) {
|
|
64
48
|
const shouldConsume = yield shouldConsumeMfaToken({ mfaAction });
|
|
65
49
|
if (!shouldConsume) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use client'
|
|
2
2
|
import { __awaiter } from '../../../../../_virtual/_tslib.js';
|
|
3
3
|
import { useCallback } from 'react';
|
|
4
|
-
import { consumeMfaToken } from '@dynamic-labs-sdk/client';
|
|
4
|
+
import { isMfaRequiredForAction, consumeMfaToken } from '@dynamic-labs-sdk/client';
|
|
5
5
|
import { DynamicError } from '@dynamic-labs/utils';
|
|
6
6
|
import '@dynamic-labs/sdk-api-core';
|
|
7
7
|
import { logger } from '../../../shared/logger.js';
|
|
@@ -13,8 +13,6 @@ import '@dynamic-labs/wallet-book';
|
|
|
13
13
|
import '../../constants/colors.js';
|
|
14
14
|
import '../../constants/values.js';
|
|
15
15
|
import '../../../shared/consts/index.js';
|
|
16
|
-
import { getProjectSettings } from '../../../store/state/projectSettings/projectSettings.js';
|
|
17
|
-
import { useGetUserMfaMethods } from '../useGetUserMfaMethods/useGetUserMfaMethods.js';
|
|
18
16
|
|
|
19
17
|
/**
|
|
20
18
|
* Get MFA token
|
|
@@ -36,26 +34,12 @@ import { useGetUserMfaMethods } from '../useGetUserMfaMethods/useGetUserMfaMetho
|
|
|
36
34
|
* }
|
|
37
35
|
*/
|
|
38
36
|
const useGetMfaToken = () => {
|
|
39
|
-
const getUserMfaMethods = useGetUserMfaMethods();
|
|
40
37
|
const shouldConsumeMfaToken = useCallback((...args_1) => __awaiter(void 0, [...args_1], void 0, function* ({ mfaAction } = {}) {
|
|
41
|
-
var _a, _b, _c, _d, _e;
|
|
42
38
|
if (!mfaAction) {
|
|
43
39
|
return true;
|
|
44
40
|
}
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
// if mfa token is not required for this action, no need to consume it
|
|
48
|
-
if (!isMfaRequiredForAction) {
|
|
49
|
-
return false;
|
|
50
|
-
}
|
|
51
|
-
const isMfaMethodRequired = (_e = (_d = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.security) === null || _d === void 0 ? void 0 : _d.mfa) === null || _e === void 0 ? void 0 : _e.required;
|
|
52
|
-
if (isMfaMethodRequired) {
|
|
53
|
-
return true;
|
|
54
|
-
}
|
|
55
|
-
const methods = yield getUserMfaMethods();
|
|
56
|
-
// if mfa is not required and user has no methods registered, no need to consume the token
|
|
57
|
-
return methods.userHasVerifiedMfaMethods;
|
|
58
|
-
}), [getUserMfaMethods]);
|
|
41
|
+
return isMfaRequiredForAction({ mfaAction });
|
|
42
|
+
}), []);
|
|
59
43
|
return useCallback((...args_2) => __awaiter(void 0, [...args_2], void 0, function* ({ mfaAction } = {}) {
|
|
60
44
|
const shouldConsume = yield shouldConsumeMfaToken({ mfaAction });
|
|
61
45
|
if (!shouldConsume) {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { useIsMfaRequiredForAction } from './useIsMfaRequiredForAction';
|
|
@@ -0,0 +1,34 @@
|
|
|
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 client = require('@dynamic-labs-sdk/client');
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Check if MFA is required for an action
|
|
12
|
+
*
|
|
13
|
+
* @returns Function to check if MFA is required for an action
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* ```tsx
|
|
17
|
+
* const App = () => {
|
|
18
|
+
* const isMfaRequiredForAction = useIsMfaRequiredForAction();
|
|
19
|
+
*
|
|
20
|
+
* return (
|
|
21
|
+
* <button
|
|
22
|
+
* onClick={() => isMfaRequiredForAction({ mfaAction: MFAAction.UpdateUser })}
|
|
23
|
+
* >
|
|
24
|
+
* Check if MFA is required for an action
|
|
25
|
+
* </button>
|
|
26
|
+
* );
|
|
27
|
+
* }
|
|
28
|
+
*/
|
|
29
|
+
const useIsMfaRequiredForAction = () => React.useCallback((_a) => _tslib.__awaiter(void 0, [_a], void 0, function* ({ mfaAction }) {
|
|
30
|
+
const response = yield client.isMfaRequiredForAction({ mfaAction });
|
|
31
|
+
return response !== null && response !== void 0 ? response : false;
|
|
32
|
+
}), []);
|
|
33
|
+
|
|
34
|
+
exports.useIsMfaRequiredForAction = useIsMfaRequiredForAction;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { MFAAction } from '@dynamic-labs/sdk-api-core';
|
|
2
|
+
type UseIsMfaRequiredForActionProps = {
|
|
3
|
+
mfaAction: MFAAction;
|
|
4
|
+
};
|
|
5
|
+
/**
|
|
6
|
+
* Check if MFA is required for an action
|
|
7
|
+
*
|
|
8
|
+
* @returns Function to check if MFA is required for an action
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* ```tsx
|
|
12
|
+
* const App = () => {
|
|
13
|
+
* const isMfaRequiredForAction = useIsMfaRequiredForAction();
|
|
14
|
+
*
|
|
15
|
+
* return (
|
|
16
|
+
* <button
|
|
17
|
+
* onClick={() => isMfaRequiredForAction({ mfaAction: MFAAction.UpdateUser })}
|
|
18
|
+
* >
|
|
19
|
+
* Check if MFA is required for an action
|
|
20
|
+
* </button>
|
|
21
|
+
* );
|
|
22
|
+
* }
|
|
23
|
+
*/
|
|
24
|
+
export declare const useIsMfaRequiredForAction: () => (({ mfaAction, }: UseIsMfaRequiredForActionProps) => Promise<boolean>);
|
|
25
|
+
export {};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
import { __awaiter } from '../../../../../_virtual/_tslib.js';
|
|
3
|
+
import { useCallback } from 'react';
|
|
4
|
+
import { isMfaRequiredForAction } from '@dynamic-labs-sdk/client';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Check if MFA is required for an action
|
|
8
|
+
*
|
|
9
|
+
* @returns Function to check if MFA is required for an action
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```tsx
|
|
13
|
+
* const App = () => {
|
|
14
|
+
* const isMfaRequiredForAction = useIsMfaRequiredForAction();
|
|
15
|
+
*
|
|
16
|
+
* return (
|
|
17
|
+
* <button
|
|
18
|
+
* onClick={() => isMfaRequiredForAction({ mfaAction: MFAAction.UpdateUser })}
|
|
19
|
+
* >
|
|
20
|
+
* Check if MFA is required for an action
|
|
21
|
+
* </button>
|
|
22
|
+
* );
|
|
23
|
+
* }
|
|
24
|
+
*/
|
|
25
|
+
const useIsMfaRequiredForAction = () => useCallback((_a) => __awaiter(void 0, [_a], void 0, function* ({ mfaAction }) {
|
|
26
|
+
const response = yield isMfaRequiredForAction({ mfaAction });
|
|
27
|
+
return response !== null && response !== void 0 ? response : false;
|
|
28
|
+
}), []);
|
|
29
|
+
|
|
30
|
+
export { useIsMfaRequiredForAction };
|
|
@@ -26,7 +26,7 @@ require('@dynamic-labs/multi-wallet');
|
|
|
26
26
|
require('react-international-phone');
|
|
27
27
|
require('../../../store/state/nonce/nonce.cjs');
|
|
28
28
|
require('@dynamic-labs-sdk/client/core');
|
|
29
|
-
require('../../../client/client.cjs');
|
|
29
|
+
var client = require('../../../client/client.cjs');
|
|
30
30
|
require('@dynamic-labs-sdk/client');
|
|
31
31
|
require('../../../config/ApiEndpoint.cjs');
|
|
32
32
|
require('../../../store/state/projectSettings/projectSettings.cjs');
|
|
@@ -109,6 +109,7 @@ const usePromptMfaAuth = () => {
|
|
|
109
109
|
const { pushView } = ViewContext.useViewContext();
|
|
110
110
|
const getUserMfaMethods = useGetUserMfaMethods.useGetUserMfaMethods();
|
|
111
111
|
const authenticatePasskeyMFA = useAuthenticatePasskeyMFA.useAuthenticatePasskeyMFA();
|
|
112
|
+
const dynamicClient = client.useDynamicClient();
|
|
112
113
|
const promptMfaAuth = React.useCallback((props) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
113
114
|
const methods = yield getUserMfaMethods();
|
|
114
115
|
const allMethods = [
|
|
@@ -145,17 +146,47 @@ const usePromptMfaAuth = () => {
|
|
|
145
146
|
authenticatePasskeyPromise,
|
|
146
147
|
createMfaToken: props === null || props === void 0 ? void 0 : props.createMfaToken,
|
|
147
148
|
});
|
|
148
|
-
|
|
149
|
+
// Return the promise so callers can await MFA completion
|
|
150
|
+
return authenticatePasskeyPromise;
|
|
149
151
|
}
|
|
150
|
-
case sdkApiCore.MFADeviceType.Totp:
|
|
152
|
+
case sdkApiCore.MFADeviceType.Totp: {
|
|
151
153
|
pushView('mfa-verification', {
|
|
152
154
|
createMfaToken: props === null || props === void 0 ? void 0 : props.createMfaToken,
|
|
153
155
|
});
|
|
154
|
-
|
|
156
|
+
// Return a promise that resolves when mfaToken becomes available
|
|
157
|
+
return new Promise((resolve, reject) => {
|
|
158
|
+
const maxAttempts = 50; // Maximum number of retry attempts
|
|
159
|
+
const initialDelay = 100; // Initial delay in milliseconds
|
|
160
|
+
const maxDelay = 5000; // Maximum delay between retries
|
|
161
|
+
let attempts = 0;
|
|
162
|
+
const checkForToken = () => {
|
|
163
|
+
attempts++;
|
|
164
|
+
const mfaToken = dynamicClient === null || dynamicClient === void 0 ? void 0 : dynamicClient.mfaToken;
|
|
165
|
+
if (mfaToken) {
|
|
166
|
+
resolve(mfaToken);
|
|
167
|
+
}
|
|
168
|
+
else if (attempts >= maxAttempts) {
|
|
169
|
+
reject(new Error('MFA token not available after maximum retry attempts'));
|
|
170
|
+
}
|
|
171
|
+
else {
|
|
172
|
+
// Exponential backoff with a maximum delay
|
|
173
|
+
const delay = Math.min(initialDelay * Math.pow(1.5, attempts - 1), maxDelay);
|
|
174
|
+
setTimeout(checkForToken, delay);
|
|
175
|
+
}
|
|
176
|
+
};
|
|
177
|
+
checkForToken();
|
|
178
|
+
});
|
|
179
|
+
}
|
|
155
180
|
default:
|
|
156
181
|
throw new Error('Error determining MFA method to use');
|
|
157
182
|
}
|
|
158
|
-
}), [
|
|
183
|
+
}), [
|
|
184
|
+
authenticatePasskeyMFA,
|
|
185
|
+
dynamicClient === null || dynamicClient === void 0 ? void 0 : dynamicClient.mfaToken,
|
|
186
|
+
getUserMfaMethods,
|
|
187
|
+
pushView,
|
|
188
|
+
setShowAuthFlow,
|
|
189
|
+
]);
|
|
159
190
|
return promptMfaAuth;
|
|
160
191
|
};
|
|
161
192
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
type PromptMfaAuthProps = {
|
|
2
2
|
createMfaToken?: boolean;
|
|
3
3
|
};
|
|
4
|
-
export declare const usePromptMfaAuth: () => (props?: PromptMfaAuthProps) => Promise<
|
|
4
|
+
export declare const usePromptMfaAuth: () => (props?: PromptMfaAuthProps) => Promise<string | undefined>;
|
|
5
5
|
export {};
|