@dynamic-labs/sdk-react-core 4.20.14 → 4.20.16

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 CHANGED
@@ -1,4 +1,18 @@
1
1
 
2
+ ### [4.20.16](https://github.com/dynamic-labs/dynamic-auth/compare/v4.20.15...v4.20.16) (2025-07-03)
3
+
4
+
5
+ ### Bug Fixes
6
+
7
+ * remove metamask in-app-browser default ([#9086](https://github.com/dynamic-labs/dynamic-auth/issues/9086)) ([f3170d6](https://github.com/dynamic-labs/dynamic-auth/commit/f3170d6a6de251f8d9f6585fbc1bac916aa892a2))
8
+
9
+ ### [4.20.15](https://github.com/dynamic-labs/dynamic-auth/compare/v4.20.14...v4.20.15) (2025-07-03)
10
+
11
+
12
+ ### Bug Fixes
13
+
14
+ * triggering waas wallet creation attempt on logout ([#9083](https://github.com/dynamic-labs/dynamic-auth/issues/9083)) ([19a66f7](https://github.com/dynamic-labs/dynamic-auth/commit/19a66f7e49d4bd95725131f81eab9eeed2dc1b27))
15
+
2
16
  ### [4.20.14](https://github.com/dynamic-labs/dynamic-auth/compare/v4.20.13...v4.20.14) (2025-07-03)
3
17
 
4
18
 
package/package.cjs CHANGED
@@ -3,7 +3,7 @@
3
3
 
4
4
  Object.defineProperty(exports, '__esModule', { value: true });
5
5
 
6
- var version = "4.20.14";
6
+ var version = "4.20.16";
7
7
  var dependencies = {
8
8
  "@dynamic-labs/sdk-api-core": "0.0.704",
9
9
  "@dynamic-labs-sdk/client": "0.0.1-alpha.7",
package/package.js CHANGED
@@ -1,5 +1,5 @@
1
1
  'use client'
2
- var version = "4.20.14";
2
+ var version = "4.20.16";
3
3
  var dependencies = {
4
4
  "@dynamic-labs/sdk-api-core": "0.0.704",
5
5
  "@dynamic-labs-sdk/client": "0.0.1-alpha.7",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dynamic-labs/sdk-react-core",
3
- "version": "4.20.14",
3
+ "version": "4.20.16",
4
4
  "dependencies": {
5
5
  "@dynamic-labs/sdk-api-core": "0.0.704",
6
6
  "@dynamic-labs-sdk/client": "0.0.1-alpha.7",
@@ -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.20.14",
19
- "@dynamic-labs/iconic": "4.20.14",
20
- "@dynamic-labs/logger": "4.20.14",
21
- "@dynamic-labs/multi-wallet": "4.20.14",
22
- "@dynamic-labs/rpc-providers": "4.20.14",
23
- "@dynamic-labs/store": "4.20.14",
24
- "@dynamic-labs/types": "4.20.14",
25
- "@dynamic-labs/utils": "4.20.14",
26
- "@dynamic-labs/wallet-book": "4.20.14",
27
- "@dynamic-labs/wallet-connector-core": "4.20.14",
18
+ "@dynamic-labs/assert-package-version": "4.20.16",
19
+ "@dynamic-labs/iconic": "4.20.16",
20
+ "@dynamic-labs/logger": "4.20.16",
21
+ "@dynamic-labs/multi-wallet": "4.20.16",
22
+ "@dynamic-labs/rpc-providers": "4.20.16",
23
+ "@dynamic-labs/store": "4.20.16",
24
+ "@dynamic-labs/types": "4.20.16",
25
+ "@dynamic-labs/utils": "4.20.16",
26
+ "@dynamic-labs/wallet-book": "4.20.16",
27
+ "@dynamic-labs/wallet-connector-core": "4.20.16",
28
28
  "eventemitter3": "5.0.1"
29
29
  },
30
30
  "devDependencies": {
package/src/index.cjs CHANGED
@@ -162,6 +162,9 @@ var useSyncMfaFlow = require('./lib/utils/hooks/useSyncMfaFlow/useSyncMfaFlow.cj
162
162
  var useTelegramLogin = require('./lib/utils/hooks/useTelegramLogin/useTelegramLogin.cjs');
163
163
  var useUpgradeEmbeddedWallet = require('./lib/utils/hooks/useUpgradeEmbeddedWallet/useUpgradeEmbeddedWallet.cjs');
164
164
  var useDeleteUserAccount = require('./lib/utils/hooks/useDeleteUserAccount/useDeleteUserAccount.cjs');
165
+ var useGetPasskeys = require('./lib/utils/hooks/useGetPasskeys/useGetPasskeys.cjs');
166
+ var useRegisterPasskey = require('./lib/utils/hooks/useRegisterPasskey/useRegisterPasskey.cjs');
167
+ var useAuthenticatePasskeyMFA = require('./lib/utils/hooks/useAuthenticatePasskeyMFA/useAuthenticatePasskeyMFA.cjs');
165
168
  var DynamicConnectButton = require('./lib/components/DynamicConnectButton/DynamicConnectButton.cjs');
166
169
  require('./lib/components/InlineWidget/InlineWidget.cjs');
167
170
  var IsBrowser = require('./lib/components/IsBrowser/IsBrowser.cjs');
@@ -294,6 +297,9 @@ exports.useSyncMfaFlow = useSyncMfaFlow.useSyncMfaFlow;
294
297
  exports.useTelegramLogin = useTelegramLogin.useTelegramLogin;
295
298
  exports.useUpgradeEmbeddedWallet = useUpgradeEmbeddedWallet.useUpgradeEmbeddedWallet;
296
299
  exports.useDeleteUserAccount = useDeleteUserAccount.useDeleteUserAccount;
300
+ exports.useGetPasskeys = useGetPasskeys.useGetPasskeys;
301
+ exports.useRegisterPasskey = useRegisterPasskey.useRegisterPasskey;
302
+ exports.useAuthenticatePasskeyMFA = useAuthenticatePasskeyMFA.useAuthenticatePasskeyMFA;
297
303
  exports.DynamicConnectButton = DynamicConnectButton.DynamicConnectButton;
298
304
  exports.IsBrowser = IsBrowser.IsBrowser;
299
305
  exports.DynamicBridgeWidget = DynamicBridgeWidget.DynamicBridgeWidget;
package/src/index.d.ts CHANGED
@@ -115,7 +115,7 @@ export { useProjectSettings } from './lib/store/state/projectSettings';
115
115
  export {
116
116
  /** @deprecated */
117
117
  DynamicWidgetContextProvider, } from './lib/widgets/DynamicWidget/context';
118
- export { useWalletItemActions, useAuthenticateConnectedUser, useSocialAccounts, useEmbeddedWallet, useEmbeddedWalletAuthenticator, usePasskeyRecovery, useEmbeddedReveal, useIsLoggedIn, useDynamicModals, useMfa, useTokenBalances, useSwitchWallet, useRpcProviders, useRefreshUser, useWalletOptions, useSmartWallets, EmbeddedWalletVersion, useTelegramLogin, useUpgradeEmbeddedWallet, useEVMTransactionSimulation, useSVMTransactionSimulation, useDeleteUserAccount, useDynamicWaas, } from './lib/utils/hooks';
118
+ export { useWalletItemActions, useAuthenticateConnectedUser, useSocialAccounts, useEmbeddedWallet, useEmbeddedWalletAuthenticator, usePasskeyRecovery, useEmbeddedReveal, useIsLoggedIn, useDynamicModals, useMfa, useTokenBalances, useSwitchWallet, useRpcProviders, useRefreshUser, useWalletOptions, useSmartWallets, EmbeddedWalletVersion, useTelegramLogin, useUpgradeEmbeddedWallet, useEVMTransactionSimulation, useSVMTransactionSimulation, useDeleteUserAccount, useDynamicWaas, useGetPasskeys, useRegisterPasskey, useAuthenticatePasskeyMFA, } from './lib/utils/hooks';
119
119
  export {
120
120
  /** @deprecated use useOnramp instead */
121
121
  useFunding, } from './lib/utils/hooks/useFunding';
package/src/index.js CHANGED
@@ -158,6 +158,9 @@ export { useSyncMfaFlow } from './lib/utils/hooks/useSyncMfaFlow/useSyncMfaFlow.
158
158
  export { useTelegramLogin } from './lib/utils/hooks/useTelegramLogin/useTelegramLogin.js';
159
159
  export { useUpgradeEmbeddedWallet } from './lib/utils/hooks/useUpgradeEmbeddedWallet/useUpgradeEmbeddedWallet.js';
160
160
  export { useDeleteUserAccount } from './lib/utils/hooks/useDeleteUserAccount/useDeleteUserAccount.js';
161
+ export { useGetPasskeys } from './lib/utils/hooks/useGetPasskeys/useGetPasskeys.js';
162
+ export { useRegisterPasskey } from './lib/utils/hooks/useRegisterPasskey/useRegisterPasskey.js';
163
+ export { useAuthenticatePasskeyMFA } from './lib/utils/hooks/useAuthenticatePasskeyMFA/useAuthenticatePasskeyMFA.js';
161
164
  export { DynamicConnectButton } from './lib/components/DynamicConnectButton/DynamicConnectButton.js';
162
165
  import './lib/components/InlineWidget/InlineWidget.js';
163
166
  export { IsBrowser } from './lib/components/IsBrowser/IsBrowser.js';
@@ -81,3 +81,6 @@ export { useConnectExchangeForFunding } from './useConnectExchangeForFunding';
81
81
  export { useClientSessionKeys } from './useClientSessionKeys';
82
82
  export { usePromptAmountAndFundWithExchange } from './usePromptAndFundWithExchange';
83
83
  export { useSubmitExchangeFunding } from './useSubmitExchangeFunding';
84
+ export { useGetPasskeys } from './useGetPasskeys';
85
+ export { useRegisterPasskey } from './useRegisterPasskey';
86
+ export { useAuthenticatePasskeyMFA } from './useAuthenticatePasskeyMFA';
@@ -0,0 +1 @@
1
+ export { useAuthenticatePasskeyMFA } from './useAuthenticatePasskeyMFA';
@@ -0,0 +1,41 @@
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$1 = require('@dynamic-labs-sdk/client');
9
+ var client = require('../../../client/client.cjs');
10
+
11
+ /**
12
+ * Authenticate passkey for MFA
13
+ *
14
+ * @returns Function to authenticate with a passkey for MFA
15
+ *
16
+ * @example
17
+ * ```tsx
18
+ * const App = () => {
19
+ * const authenticatePasskeyMFA = useAuthenticatePasskeyMFA();
20
+ *
21
+ * // Optional: creates a single-use MFA token
22
+ * const createMfaToken = { singleUse: true };
23
+ *
24
+ * return (
25
+ * <button
26
+ * onClick={() => authenticatePasskeyMFA({ createMfaToken })}
27
+ * >
28
+ * Authenticate passkey
29
+ * </button>
30
+ * );
31
+ * }
32
+ */
33
+ const useAuthenticatePasskeyMFA = () => {
34
+ const client$2 = client.useDynamicClient();
35
+ return React.useCallback((props) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
36
+ const result = yield client$1.authenticatePasskeyMFA(client$2, props);
37
+ return result.mfaToken;
38
+ }), [client$2]);
39
+ };
40
+
41
+ exports.useAuthenticatePasskeyMFA = useAuthenticatePasskeyMFA;
@@ -0,0 +1,28 @@
1
+ import { CreateMfaToken } from '@dynamic-labs/sdk-api-core';
2
+ type UseAuthenticatePasskeyMFAProps = {
3
+ createMfaToken?: CreateMfaToken;
4
+ };
5
+ /**
6
+ * Authenticate passkey for MFA
7
+ *
8
+ * @returns Function to authenticate with a passkey for MFA
9
+ *
10
+ * @example
11
+ * ```tsx
12
+ * const App = () => {
13
+ * const authenticatePasskeyMFA = useAuthenticatePasskeyMFA();
14
+ *
15
+ * // Optional: creates a single-use MFA token
16
+ * const createMfaToken = { singleUse: true };
17
+ *
18
+ * return (
19
+ * <button
20
+ * onClick={() => authenticatePasskeyMFA({ createMfaToken })}
21
+ * >
22
+ * Authenticate passkey
23
+ * </button>
24
+ * );
25
+ * }
26
+ */
27
+ export declare const useAuthenticatePasskeyMFA: () => ((props?: UseAuthenticatePasskeyMFAProps) => Promise<string | undefined>);
28
+ export {};
@@ -0,0 +1,37 @@
1
+ 'use client'
2
+ import { __awaiter } from '../../../../../_virtual/_tslib.js';
3
+ import { useCallback } from 'react';
4
+ import { authenticatePasskeyMFA } from '@dynamic-labs-sdk/client';
5
+ import { useDynamicClient } from '../../../client/client.js';
6
+
7
+ /**
8
+ * Authenticate passkey for MFA
9
+ *
10
+ * @returns Function to authenticate with a passkey for MFA
11
+ *
12
+ * @example
13
+ * ```tsx
14
+ * const App = () => {
15
+ * const authenticatePasskeyMFA = useAuthenticatePasskeyMFA();
16
+ *
17
+ * // Optional: creates a single-use MFA token
18
+ * const createMfaToken = { singleUse: true };
19
+ *
20
+ * return (
21
+ * <button
22
+ * onClick={() => authenticatePasskeyMFA({ createMfaToken })}
23
+ * >
24
+ * Authenticate passkey
25
+ * </button>
26
+ * );
27
+ * }
28
+ */
29
+ const useAuthenticatePasskeyMFA = () => {
30
+ const client = useDynamicClient();
31
+ return useCallback((props) => __awaiter(void 0, void 0, void 0, function* () {
32
+ const result = yield authenticatePasskeyMFA(client, props);
33
+ return result.mfaToken;
34
+ }), [client]);
35
+ };
36
+
37
+ export { useAuthenticatePasskeyMFA };
@@ -0,0 +1 @@
1
+ export { useGetPasskeys } from './useGetPasskeys';
@@ -0,0 +1,39 @@
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$1 = require('@dynamic-labs-sdk/client');
9
+ var client = require('../../../client/client.cjs');
10
+
11
+ /**
12
+ * Get passkeys
13
+ *
14
+ * @returns Function to get passkeys for the current user
15
+ *
16
+ * @example
17
+ * ```tsx
18
+ * const App = () => {
19
+ * const getPasskeys = useGetPasskeys();
20
+ * const [passkeys, setPasskeys] = useState<UserPasskey[]>([]);
21
+ *
22
+ * return (
23
+ * <button
24
+ * onClick={async () => {
25
+ * const passkeys = await getPasskeys();
26
+ * setPasskeys(passkeys);
27
+ * }}
28
+ * >
29
+ * Get passkeys
30
+ * </button>
31
+ * );
32
+ * }
33
+ */
34
+ const useGetPasskeys = () => {
35
+ const client$2 = client.useDynamicClient();
36
+ return React.useCallback(() => _tslib.__awaiter(void 0, void 0, void 0, function* () { return client$1.getPasskeys(client$2); }), [client$2]);
37
+ };
38
+
39
+ exports.useGetPasskeys = useGetPasskeys;
@@ -0,0 +1,25 @@
1
+ import { UserPasskey } from '@dynamic-labs/sdk-api-core';
2
+ /**
3
+ * Get passkeys
4
+ *
5
+ * @returns Function to get passkeys for the current user
6
+ *
7
+ * @example
8
+ * ```tsx
9
+ * const App = () => {
10
+ * const getPasskeys = useGetPasskeys();
11
+ * const [passkeys, setPasskeys] = useState<UserPasskey[]>([]);
12
+ *
13
+ * return (
14
+ * <button
15
+ * onClick={async () => {
16
+ * const passkeys = await getPasskeys();
17
+ * setPasskeys(passkeys);
18
+ * }}
19
+ * >
20
+ * Get passkeys
21
+ * </button>
22
+ * );
23
+ * }
24
+ */
25
+ export declare const useGetPasskeys: () => (() => Promise<UserPasskey[]>);
@@ -0,0 +1,35 @@
1
+ 'use client'
2
+ import { __awaiter } from '../../../../../_virtual/_tslib.js';
3
+ import { useCallback } from 'react';
4
+ import { getPasskeys } from '@dynamic-labs-sdk/client';
5
+ import { useDynamicClient } from '../../../client/client.js';
6
+
7
+ /**
8
+ * Get passkeys
9
+ *
10
+ * @returns Function to get passkeys for the current user
11
+ *
12
+ * @example
13
+ * ```tsx
14
+ * const App = () => {
15
+ * const getPasskeys = useGetPasskeys();
16
+ * const [passkeys, setPasskeys] = useState<UserPasskey[]>([]);
17
+ *
18
+ * return (
19
+ * <button
20
+ * onClick={async () => {
21
+ * const passkeys = await getPasskeys();
22
+ * setPasskeys(passkeys);
23
+ * }}
24
+ * >
25
+ * Get passkeys
26
+ * </button>
27
+ * );
28
+ * }
29
+ */
30
+ const useGetPasskeys = () => {
31
+ const client = useDynamicClient();
32
+ return useCallback(() => __awaiter(void 0, void 0, void 0, function* () { return getPasskeys(client); }), [client]);
33
+ };
34
+
35
+ export { useGetPasskeys };
@@ -0,0 +1 @@
1
+ export { useRegisterPasskey } from './useRegisterPasskey';
@@ -0,0 +1,35 @@
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$1 = require('@dynamic-labs-sdk/client');
9
+ var client = require('../../../client/client.cjs');
10
+
11
+ /**
12
+ * Register passkey
13
+ *
14
+ * @returns Function to register passkey
15
+ *
16
+ * @example
17
+ * ```tsx
18
+ * const App = () => {
19
+ * const registerPasskey = useRegisterPasskey();
20
+ *
21
+ * return (
22
+ * <button
23
+ * onClick={() => registerPasskey()}
24
+ * >
25
+ * Register passkey
26
+ * </button>
27
+ * );
28
+ * }
29
+ */
30
+ const useRegisterPasskey = () => {
31
+ const client$2 = client.useDynamicClient();
32
+ return React.useCallback(() => _tslib.__awaiter(void 0, void 0, void 0, function* () { return client$1.registerPasskey(client$2); }), [client$2]);
33
+ };
34
+
35
+ exports.useRegisterPasskey = useRegisterPasskey;
@@ -0,0 +1,21 @@
1
+ import { UserPasskey } from '@dynamic-labs/sdk-api-core';
2
+ /**
3
+ * Register passkey
4
+ *
5
+ * @returns Function to register passkey
6
+ *
7
+ * @example
8
+ * ```tsx
9
+ * const App = () => {
10
+ * const registerPasskey = useRegisterPasskey();
11
+ *
12
+ * return (
13
+ * <button
14
+ * onClick={() => registerPasskey()}
15
+ * >
16
+ * Register passkey
17
+ * </button>
18
+ * );
19
+ * }
20
+ */
21
+ export declare const useRegisterPasskey: () => (() => Promise<UserPasskey>);
@@ -0,0 +1,31 @@
1
+ 'use client'
2
+ import { __awaiter } from '../../../../../_virtual/_tslib.js';
3
+ import { useCallback } from 'react';
4
+ import { registerPasskey } from '@dynamic-labs-sdk/client';
5
+ import { useDynamicClient } from '../../../client/client.js';
6
+
7
+ /**
8
+ * Register passkey
9
+ *
10
+ * @returns Function to register passkey
11
+ *
12
+ * @example
13
+ * ```tsx
14
+ * const App = () => {
15
+ * const registerPasskey = useRegisterPasskey();
16
+ *
17
+ * return (
18
+ * <button
19
+ * onClick={() => registerPasskey()}
20
+ * >
21
+ * Register passkey
22
+ * </button>
23
+ * );
24
+ * }
25
+ */
26
+ const useRegisterPasskey = () => {
27
+ const client = useDynamicClient();
28
+ return useCallback(() => __awaiter(void 0, void 0, void 0, function* () { return registerPasskey(client); }), [client]);
29
+ };
30
+
31
+ export { useRegisterPasskey };
@@ -5,8 +5,8 @@ Object.defineProperty(exports, '__esModule', { value: true });
5
5
 
6
6
  var _tslib = require('../../../../../_virtual/_tslib.cjs');
7
7
  var React = require('react');
8
+ var client = require('../../../client/client.cjs');
8
9
  require('@dynamic-labs-sdk/client');
9
- require('../../../client/client.cjs');
10
10
  require('@dynamic-labs-sdk/client/core');
11
11
  require('@dynamic-labs/utils');
12
12
  var projectSettings = require('../../../store/state/projectSettings/projectSettings.cjs');
@@ -117,6 +117,11 @@ const useSyncDynamicWaas = () => {
117
117
  // this is used to trigger createWalletAccount
118
118
  // ** It must be an useEffect because some of the dependencies are async
119
119
  React.useEffect(() => {
120
+ // Explanation: if the user just logged out, the user from the hook might still be set
121
+ // but the client will be null.
122
+ // And if the user is not onboarding complete yet, the hook won't be set even though the client.user is set.
123
+ // This is why we check for the user AND the client.user.
124
+ const hasUser = Boolean(user && client.getDynamicClient().user);
120
125
  const syncDynamicWaas = () => _tslib.__awaiter(void 0, void 0, void 0, function* () {
121
126
  try {
122
127
  triggeredCreate.current = true;
@@ -135,7 +140,7 @@ const useSyncDynamicWaas = () => {
135
140
  needsAutoCreateWalletChains.length > 0 &&
136
141
  !triggeredCreate.current;
137
142
  if (!shouldSyncCreateWallet ||
138
- !user ||
143
+ !hasUser ||
139
144
  !projectSettings$1 ||
140
145
  !walletConnectorOptions.length || // no connectors to use for the embedded wallet
141
146
  globalLoading // this will be true if auth is in progress
@@ -1,8 +1,8 @@
1
1
  'use client'
2
2
  import { __awaiter } from '../../../../../_virtual/_tslib.js';
3
3
  import { useRef, useEffect } from 'react';
4
+ import { getDynamicClient } from '../../../client/client.js';
4
5
  import '@dynamic-labs-sdk/client';
5
- import '../../../client/client.js';
6
6
  import '@dynamic-labs-sdk/client/core';
7
7
  import '@dynamic-labs/utils';
8
8
  import { useProjectSettings } from '../../../store/state/projectSettings/projectSettings.js';
@@ -113,6 +113,11 @@ const useSyncDynamicWaas = () => {
113
113
  // this is used to trigger createWalletAccount
114
114
  // ** It must be an useEffect because some of the dependencies are async
115
115
  useEffect(() => {
116
+ // Explanation: if the user just logged out, the user from the hook might still be set
117
+ // but the client will be null.
118
+ // And if the user is not onboarding complete yet, the hook won't be set even though the client.user is set.
119
+ // This is why we check for the user AND the client.user.
120
+ const hasUser = Boolean(user && getDynamicClient().user);
116
121
  const syncDynamicWaas = () => __awaiter(void 0, void 0, void 0, function* () {
117
122
  try {
118
123
  triggeredCreate.current = true;
@@ -131,7 +136,7 @@ const useSyncDynamicWaas = () => {
131
136
  needsAutoCreateWalletChains.length > 0 &&
132
137
  !triggeredCreate.current;
133
138
  if (!shouldSyncCreateWallet ||
134
- !user ||
139
+ !hasUser ||
135
140
  !projectSettings ||
136
141
  !walletConnectorOptions.length || // no connectors to use for the embedded wallet
137
142
  globalLoading // this will be true if auth is in progress