@dynamic-labs/sdk-react-core 4.40.1 → 4.40.2

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.
Files changed (24) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/package.cjs +1 -1
  3. package/package.js +1 -1
  4. package/package.json +12 -12
  5. package/src/lib/context/DynamicContext/hooks/useHandleLogout/types.d.ts +2 -1
  6. package/src/lib/context/DynamicContext/hooks/useSelectedWalletConnector/SetSelectedWalletConnectorKey.type.d.ts +5 -0
  7. package/src/lib/context/DynamicContext/hooks/useSelectedWalletConnector/useSelectedWalletConnector.cjs +19 -5
  8. package/src/lib/context/DynamicContext/hooks/useSelectedWalletConnector/useSelectedWalletConnector.d.ts +3 -3
  9. package/src/lib/context/DynamicContext/hooks/useSelectedWalletConnector/useSelectedWalletConnector.js +19 -5
  10. package/src/lib/context/DynamicContext/types/IDynamicContext.d.ts +2 -1
  11. package/src/lib/styles/index.shadow.cjs +1 -1
  12. package/src/lib/styles/index.shadow.js +1 -1
  13. package/src/lib/utils/hooks/authenticationHooks/useSignConnectOnlyUser/useSignConnectOnlyUser.cjs +4 -1
  14. package/src/lib/utils/hooks/authenticationHooks/useSignConnectOnlyUser/useSignConnectOnlyUser.js +4 -1
  15. package/src/lib/utils/hooks/useConnectedWalletsNetworkValidation/useConnectedWalletsNetworkValidation.cjs +4 -1
  16. package/src/lib/utils/hooks/useConnectedWalletsNetworkValidation/useConnectedWalletsNetworkValidation.js +4 -1
  17. package/src/lib/utils/hooks/useSyncOnboardingFlow/useSyncOnboardingFlow.cjs +7 -2
  18. package/src/lib/utils/hooks/useSyncOnboardingFlow/useSyncOnboardingFlow.js +7 -2
  19. package/src/lib/utils/hooks/useWalletEventListeners/useWalletEventListeners.cjs +8 -2
  20. package/src/lib/utils/hooks/useWalletEventListeners/useWalletEventListeners.js +8 -2
  21. package/src/lib/utils/hooks/useWalletItemActions/useHandleWalletItem/useHandleWalletItem.cjs +24 -6
  22. package/src/lib/utils/hooks/useWalletItemActions/useHandleWalletItem/useHandleWalletItem.js +24 -6
  23. package/src/lib/widgets/DynamicWidget/prompts/PendingAccountSwitchModal/SwitchOrUseActiveAccountView/SwitchOrUseActiveAccountView.cjs +4 -1
  24. package/src/lib/widgets/DynamicWidget/prompts/PendingAccountSwitchModal/SwitchOrUseActiveAccountView/SwitchOrUseActiveAccountView.js +4 -1
package/CHANGELOG.md CHANGED
@@ -1,4 +1,11 @@
1
1
 
2
+ ### [4.40.2](https://github.com/dynamic-labs/dynamic-auth/compare/v4.40.1...v4.40.2) (2025-10-28)
3
+
4
+
5
+ ### Bug Fixes
6
+
7
+ * upgrade node to 20.20 in sanity-yarn-add-sdk job for compatibility ([#9743](https://github.com/dynamic-labs/dynamic-auth/issues/9743)) ([58d7e32](https://github.com/dynamic-labs/dynamic-auth/commit/58d7e32cd3965fba983c91c6345eae3bfe8dd1d5))
8
+
2
9
  ### [4.40.1](https://github.com/dynamic-labs/dynamic-auth/compare/v4.40.0...v4.40.1) (2025-10-24)
3
10
 
4
11
  ### Bug Fixes
package/package.cjs CHANGED
@@ -3,7 +3,7 @@
3
3
 
4
4
  Object.defineProperty(exports, '__esModule', { value: true });
5
5
 
6
- var version = "4.40.1";
6
+ var version = "4.40.2";
7
7
  var dependencies = {
8
8
  "@dynamic-labs/sdk-api-core": "0.0.813",
9
9
  "@dynamic-labs-sdk/client": "0.1.0-alpha.23",
package/package.js CHANGED
@@ -1,5 +1,5 @@
1
1
  'use client'
2
- var version = "4.40.1";
2
+ var version = "4.40.2";
3
3
  var dependencies = {
4
4
  "@dynamic-labs/sdk-api-core": "0.0.813",
5
5
  "@dynamic-labs-sdk/client": "0.1.0-alpha.23",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dynamic-labs/sdk-react-core",
3
- "version": "4.40.1",
3
+ "version": "4.40.2",
4
4
  "dependencies": {
5
5
  "@dynamic-labs/sdk-api-core": "0.0.813",
6
6
  "@dynamic-labs-sdk/client": "0.1.0-alpha.23",
@@ -15,17 +15,17 @@
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.40.1",
19
- "@dynamic-labs/iconic": "4.40.1",
20
- "@dynamic-labs/locale": "4.40.1",
21
- "@dynamic-labs/logger": "4.40.1",
22
- "@dynamic-labs/multi-wallet": "4.40.1",
23
- "@dynamic-labs/rpc-providers": "4.40.1",
24
- "@dynamic-labs/store": "4.40.1",
25
- "@dynamic-labs/types": "4.40.1",
26
- "@dynamic-labs/utils": "4.40.1",
27
- "@dynamic-labs/wallet-book": "4.40.1",
28
- "@dynamic-labs/wallet-connector-core": "4.40.1",
18
+ "@dynamic-labs/assert-package-version": "4.40.2",
19
+ "@dynamic-labs/iconic": "4.40.2",
20
+ "@dynamic-labs/locale": "4.40.2",
21
+ "@dynamic-labs/logger": "4.40.2",
22
+ "@dynamic-labs/multi-wallet": "4.40.2",
23
+ "@dynamic-labs/rpc-providers": "4.40.2",
24
+ "@dynamic-labs/store": "4.40.2",
25
+ "@dynamic-labs/types": "4.40.2",
26
+ "@dynamic-labs/utils": "4.40.2",
27
+ "@dynamic-labs/wallet-book": "4.40.2",
28
+ "@dynamic-labs/wallet-connector-core": "4.40.2",
29
29
  "eventemitter3": "5.0.1"
30
30
  },
31
31
  "devDependencies": {
@@ -5,10 +5,11 @@ import { DynamicEventsCallbacks, Wallet } from '../../../../shared';
5
5
  import { MultiWalletWidgetStateSetter } from '../../../../utils/hooks/multiWallet';
6
6
  import { ChainsToConnect } from '../../types';
7
7
  import { SetShowAuthFlow } from '../useShowAuthFlow';
8
+ import { SetSelectedWalletConnectorKey } from '../useSelectedWalletConnector/SetSelectedWalletConnectorKey.type';
8
9
  export type UseHandleLogoutParams = {
9
10
  clearAllWalletConnectSessions: () => void;
10
11
  bridgeChains: ChainsToConnect[] | undefined;
11
- setSelectedWalletConnectorKey: Dispatch<SetStateAction<string | null>>;
12
+ setSelectedWalletConnectorKey: SetSelectedWalletConnectorKey;
12
13
  setShowDynamicUserProfile: Dispatch<SetStateAction<boolean>>;
13
14
  setShowBridgeWidget: Dispatch<SetStateAction<boolean>>;
14
15
  user: UserProfile | undefined;
@@ -0,0 +1,5 @@
1
+ import { WalletConnectorBase } from '@dynamic-labs/wallet-connector-core';
2
+ export type SetSelectedWalletConnectorKey = (data: {
3
+ key: string;
4
+ chain?: WalletConnectorBase['connectedChain'];
5
+ } | string | null) => void;
@@ -6,15 +6,29 @@ Object.defineProperty(exports, '__esModule', { value: true });
6
6
  var React = require('react');
7
7
 
8
8
  const useSelectedWalletConnector = ({ walletConnectorOptions, }) => {
9
- const [selectedWalletConnectorKey, setSelectedWalletConnectorKey] = React.useState(null);
9
+ const [selectedWalletConnectorData, setSelectedWalletConnectorData] = React.useState(null);
10
+ /**
11
+ * To keep backwards compatibility, this also accepts a single string param which will be just the key
12
+ */
13
+ const setSelectedWalletConnectorKey = (data) => {
14
+ if (typeof data === 'string') {
15
+ setSelectedWalletConnectorData({ key: data });
16
+ }
17
+ else {
18
+ setSelectedWalletConnectorData(data);
19
+ }
20
+ };
10
21
  // Instead of storing the selected connector directly, we derive it from the wallets
11
22
  // This way if wallets change, the selected connector will be updated too
12
23
  const selectedWalletConnector = React.useMemo(() => {
13
- var _a, _b;
14
- if (!selectedWalletConnectorKey)
24
+ var _a;
25
+ if (!selectedWalletConnectorData)
15
26
  return null;
16
- return ((_b = (_a = walletConnectorOptions.find(({ walletConnector }) => walletConnector.key === selectedWalletConnectorKey)) === null || _a === void 0 ? void 0 : _a.walletConnector) !== null && _b !== void 0 ? _b : null);
17
- }, [selectedWalletConnectorKey, walletConnectorOptions]);
27
+ const option = walletConnectorOptions.find(({ walletConnector }) => walletConnector.key === selectedWalletConnectorData.key &&
28
+ (!selectedWalletConnectorData.chain ||
29
+ walletConnector.connectedChain === selectedWalletConnectorData.chain));
30
+ return (_a = option === null || option === void 0 ? void 0 : option.walletConnector) !== null && _a !== void 0 ? _a : null;
31
+ }, [selectedWalletConnectorData, walletConnectorOptions]);
18
32
  return { selectedWalletConnector, setSelectedWalletConnectorKey };
19
33
  };
20
34
 
@@ -1,10 +1,10 @@
1
- /// <reference types="react" />
2
1
  import { WalletOption } from '../../../../shared';
2
+ import { SetSelectedWalletConnectorKey } from './SetSelectedWalletConnectorKey.type';
3
3
  type useSelectedWalletConnectorProps = {
4
4
  walletConnectorOptions: WalletOption[];
5
5
  };
6
6
  export declare const useSelectedWalletConnector: ({ walletConnectorOptions, }: useSelectedWalletConnectorProps) => {
7
- selectedWalletConnector: import("dist/packages/wallet-connector-core/src").WalletConnectorCore.WalletConnector | null;
8
- setSelectedWalletConnectorKey: import("react").Dispatch<import("react").SetStateAction<string | null>>;
7
+ selectedWalletConnector: import("@dynamic-labs/wallet-connector-core").WalletConnectorCore.WalletConnector | null;
8
+ setSelectedWalletConnectorKey: SetSelectedWalletConnectorKey;
9
9
  };
10
10
  export {};
@@ -2,15 +2,29 @@
2
2
  import { useState, useMemo } from 'react';
3
3
 
4
4
  const useSelectedWalletConnector = ({ walletConnectorOptions, }) => {
5
- const [selectedWalletConnectorKey, setSelectedWalletConnectorKey] = useState(null);
5
+ const [selectedWalletConnectorData, setSelectedWalletConnectorData] = useState(null);
6
+ /**
7
+ * To keep backwards compatibility, this also accepts a single string param which will be just the key
8
+ */
9
+ const setSelectedWalletConnectorKey = (data) => {
10
+ if (typeof data === 'string') {
11
+ setSelectedWalletConnectorData({ key: data });
12
+ }
13
+ else {
14
+ setSelectedWalletConnectorData(data);
15
+ }
16
+ };
6
17
  // Instead of storing the selected connector directly, we derive it from the wallets
7
18
  // This way if wallets change, the selected connector will be updated too
8
19
  const selectedWalletConnector = useMemo(() => {
9
- var _a, _b;
10
- if (!selectedWalletConnectorKey)
20
+ var _a;
21
+ if (!selectedWalletConnectorData)
11
22
  return null;
12
- return ((_b = (_a = walletConnectorOptions.find(({ walletConnector }) => walletConnector.key === selectedWalletConnectorKey)) === null || _a === void 0 ? void 0 : _a.walletConnector) !== null && _b !== void 0 ? _b : null);
13
- }, [selectedWalletConnectorKey, walletConnectorOptions]);
23
+ const option = walletConnectorOptions.find(({ walletConnector }) => walletConnector.key === selectedWalletConnectorData.key &&
24
+ (!selectedWalletConnectorData.chain ||
25
+ walletConnector.connectedChain === selectedWalletConnectorData.chain));
26
+ return (_a = option === null || option === void 0 ? void 0 : option.walletConnector) !== null && _a !== void 0 ? _a : null;
27
+ }, [selectedWalletConnectorData, walletConnectorOptions]);
14
28
  return { selectedWalletConnector, setSelectedWalletConnectorKey };
15
29
  };
16
30
 
@@ -13,6 +13,7 @@ import { ConnectWalletOptions } from '../../../utils/hooks/useConnectWallet/useC
13
13
  import { ThemeData, ThemeSetting } from '../../ThemeContext';
14
14
  import { DisplayOrder, SetDisplayOrderPriority, SetShowAuthFlow } from '../hooks';
15
15
  import { SetCallbackType } from '../useCustomerCallbacks';
16
+ import { SetSelectedWalletConnectorKey } from '../hooks/useSelectedWalletConnector/SetSelectedWalletConnectorKey.type';
16
17
  import { SettingsOverrides } from './SettingsOverrides';
17
18
  import { SocialSettings } from './SocialSettings';
18
19
  export type ChainsToConnect = {
@@ -134,7 +135,7 @@ export interface IDynamicContext {
134
135
  setPasskeySuccessPopup: (key: PasskeySuccessEnum) => void;
135
136
  setPrimaryWallet: (walletId: string) => Promise<void>;
136
137
  setQrcodeUri: Dispatch<SetStateAction<string>>;
137
- setSelectedWalletConnectorKey: (key: string | null) => void;
138
+ setSelectedWalletConnectorKey: SetSelectedWalletConnectorKey;
138
139
  setSelectedWalletWithAction: (walletWithAction: WalletWithAction | null) => void;
139
140
  setShowAuthFlow: SetShowAuthFlow;
140
141
  /**