export function SignIn(props: SignInWithB3Props) {
const { className } = props;
- const { automaticallySetFirstEoa, partnerId } = useB3Config();
+ const { automaticallySetFirstEoa, partnerId } = useB3();
const {
address: globalAddress,
ensName,
diff --git a/packages/sdk/src/global-account/react/components/SignInWithB3/SignInWithB3Flow.tsx b/packages/sdk/src/global-account/react/components/SignInWithB3/SignInWithB3Flow.tsx
index aba471b02..71d695f60 100644
--- a/packages/sdk/src/global-account/react/components/SignInWithB3/SignInWithB3Flow.tsx
+++ b/packages/sdk/src/global-account/react/components/SignInWithB3/SignInWithB3Flow.tsx
@@ -3,7 +3,7 @@ import {
SignInWithB3ModalProps,
useAuthentication,
useAuthStore,
- useB3Config,
+ useB3,
useGetAllTWSigners,
useModalStore,
} from "@b3dotfun/sdk/global-account/react";
@@ -35,7 +35,7 @@ export function SignInWithB3Flow({
source = "signInWithB3Button",
signersEnabled = false,
}: SignInWithB3ModalProps) {
- const { automaticallySetFirstEoa, enableTurnkey } = useB3Config();
+ const { automaticallySetFirstEoa, enableTurnkey } = useB3();
const { user, refetchUser, logout } = useAuthentication(partnerId);
// FIXME Logout before login to ensure a clean state
diff --git a/packages/sdk/src/global-account/react/components/SignInWithB3/SignInWithB3Privy.tsx b/packages/sdk/src/global-account/react/components/SignInWithB3/SignInWithB3Privy.tsx
index 0fa38a8f2..fd5c78606 100644
--- a/packages/sdk/src/global-account/react/components/SignInWithB3/SignInWithB3Privy.tsx
+++ b/packages/sdk/src/global-account/react/components/SignInWithB3/SignInWithB3Privy.tsx
@@ -2,7 +2,7 @@ import {
Loading,
useAuthentication,
useAuthStore,
- useB3Config,
+ useB3,
useHandleConnectWithPrivy,
} from "@b3dotfun/sdk/global-account/react";
import { debugB3React } from "@b3dotfun/sdk/shared/utils/debug";
@@ -19,7 +19,7 @@ interface SignInWithB3PrivyProps {
}
export function SignInWithB3Privy({ onSuccess, onError, chain }: SignInWithB3PrivyProps) {
- const { partnerId } = useB3Config();
+ const { partnerId } = useB3();
const { isLoading, connectTw, fullToken } = useHandleConnectWithPrivy(chain, onSuccess);
const setIsAuthenticating = useAuthStore(state => state.setIsAuthenticating);
const setIsAuthenticated = useAuthStore(state => state.setIsAuthenticated);
diff --git a/packages/sdk/src/global-account/react/components/SignInWithB3/steps/LoginStep.tsx b/packages/sdk/src/global-account/react/components/SignInWithB3/steps/LoginStep.tsx
index 0b290302a..a54f0f260 100644
--- a/packages/sdk/src/global-account/react/components/SignInWithB3/steps/LoginStep.tsx
+++ b/packages/sdk/src/global-account/react/components/SignInWithB3/steps/LoginStep.tsx
@@ -1,4 +1,4 @@
-import { useAuthentication, useB3Config, useQueryB3 } from "@b3dotfun/sdk/global-account/react";
+import { useAuthentication, useB3, useQueryB3 } from "@b3dotfun/sdk/global-account/react";
import { ecosystemWalletId } from "@b3dotfun/sdk/shared/constants";
import { client } from "@b3dotfun/sdk/shared/utils/thirdweb";
import { Chain } from "thirdweb";
@@ -50,7 +50,7 @@ export function LoginStepContainer({ children, partnerId }: LoginStepContainerPr
}
export function LoginStep({ onSuccess, chain }: LoginStepProps) {
- const { partnerId, theme } = useB3Config();
+ const { partnerId, theme } = useB3();
const wallet = ecosystemWallet(ecosystemWalletId, {
partnerId: partnerId,
});
diff --git a/packages/sdk/src/global-account/react/components/SignInWithB3/steps/LoginStepCustom.tsx b/packages/sdk/src/global-account/react/components/SignInWithB3/steps/LoginStepCustom.tsx
index 4db3f1b99..36e670915 100644
--- a/packages/sdk/src/global-account/react/components/SignInWithB3/steps/LoginStepCustom.tsx
+++ b/packages/sdk/src/global-account/react/components/SignInWithB3/steps/LoginStepCustom.tsx
@@ -7,7 +7,7 @@ import {
LoginStepContainer,
useAuthentication,
useAuthStore,
- useB3Config,
+ useB3,
useConnect,
WalletRow,
} from "@b3dotfun/sdk/global-account/react";
@@ -37,7 +37,7 @@ export function LoginStepCustom({
maxInitialWallets = 2,
automaticallySetFirstEoa,
}: LoginStepCustomProps) {
- const { partnerId } = useB3Config();
+ const { partnerId } = useB3();
const [isLoading, setIsLoading] = useState(false);
const [showAllWallets, setShowAllWallets] = useState(false);
const { connect } = useConnect(partnerId, chain);
diff --git a/packages/sdk/src/global-account/react/components/StyleRoot.tsx b/packages/sdk/src/global-account/react/components/StyleRoot.tsx
index f0eb0bd40..0ff5ce20c 100644
--- a/packages/sdk/src/global-account/react/components/StyleRoot.tsx
+++ b/packages/sdk/src/global-account/react/components/StyleRoot.tsx
@@ -1,8 +1,8 @@
import { PropsWithChildren } from "react";
-import { useB3Config } from "./B3Provider/useB3Config";
+import { useB3 } from "./B3Provider/useB3";
export function StyleRoot({ children, id }: PropsWithChildren<{ id?: string }>) {
- const { theme } = useB3Config();
+ const { theme } = useB3();
return (
diff --git a/packages/sdk/src/global-account/react/components/custom/ManageAccountButton.tsx b/packages/sdk/src/global-account/react/components/custom/ManageAccountButton.tsx
index b68c9d301..87b2029d7 100644
--- a/packages/sdk/src/global-account/react/components/custom/ManageAccountButton.tsx
+++ b/packages/sdk/src/global-account/react/components/custom/ManageAccountButton.tsx
@@ -1,10 +1,11 @@
-import { Button, StyleRoot, useModalStore, useUser } from "@b3dotfun/sdk/global-account/react";
+import { Button, StyleRoot, useAuthentication, useB3, useModalStore } from "@b3dotfun/sdk/global-account/react";
import { cn } from "@b3dotfun/sdk/shared/utils";
import { SignInWithB3Props } from "../SignInWithB3/SignInWithB3";
export function ManageAccountButton(props: SignInWithB3Props & { className?: string }) {
+ const { partnerId } = useB3();
const { setB3ModalOpen, setB3ModalContentType } = useModalStore();
- const { isConnected } = useUser();
+ const { isConnected } = useAuthentication(partnerId);
const handleClickManageAccount = () => {
setB3ModalContentType({
diff --git a/packages/sdk/src/global-account/react/components/index.ts b/packages/sdk/src/global-account/react/components/index.ts
index 80b92c7dc..4dc0c2c80 100644
--- a/packages/sdk/src/global-account/react/components/index.ts
+++ b/packages/sdk/src/global-account/react/components/index.ts
@@ -1,8 +1,9 @@
// TODO woj: Barrel file for all components, this might be reason of bundle size issues
// Core Components
export { B3DynamicModal } from "./B3DynamicModal";
-export { B3Provider } from "./B3Provider/B3Provider";
+export { B3Provider, InnerProvider } from "./B3Provider/B3Provider";
export { RelayKitProviderWrapper } from "./B3Provider/RelayKitProviderWrapper";
+export { B3Context, type B3ContextType } from "./B3Provider/types";
export { useB3 } from "./B3Provider/useB3";
export { useB3Account } from "./B3Provider/useB3Account";
export { useB3Config } from "./B3Provider/useB3Config";
diff --git a/packages/sdk/src/global-account/react/hooks/index.ts b/packages/sdk/src/global-account/react/hooks/index.ts
index 25c7b105e..e5d61f061 100644
--- a/packages/sdk/src/global-account/react/hooks/index.ts
+++ b/packages/sdk/src/global-account/react/hooks/index.ts
@@ -53,4 +53,4 @@ export { useTokensFromAddress } from "./useTokensFromAddress";
export { useTurnkeyAuth } from "./useTurnkeyAuth";
export { useUnifiedChainSwitchAndExecute } from "./useUnifiedChainSwitchAndExecute";
export { useURLParams } from "./useURLParams";
-export { useUser } from "./useUser";
+export { useUserQuery } from "./useUserQuery";
diff --git a/packages/sdk/src/global-account/react/hooks/useAuth.ts b/packages/sdk/src/global-account/react/hooks/useAuth.ts
index 49b8c64a9..2cd574a69 100644
--- a/packages/sdk/src/global-account/react/hooks/useAuth.ts
+++ b/packages/sdk/src/global-account/react/hooks/useAuth.ts
@@ -1,6 +1,6 @@
import app from "@b3dotfun/sdk/global-account/app";
import { authenticateWithB3JWT } from "@b3dotfun/sdk/global-account/bsmnt";
-import { useAuthStore, useB3Config } from "@b3dotfun/sdk/global-account/react";
+import { useAuthStore, useB3 } from "@b3dotfun/sdk/global-account/react";
import { ecosystemWalletId } from "@b3dotfun/sdk/shared/constants";
import { debugB3React } from "@b3dotfun/sdk/shared/utils/debug";
import { client } from "@b3dotfun/sdk/shared/utils/thirdweb";
@@ -47,7 +47,7 @@ export function useAuth() {
const hasStartedConnecting = useAuthStore(state => state.hasStartedConnecting);
const useAutoConnectLoadingPrevious = useRef(false);
const referralCode = useSearchParam("referralCode");
- const { partnerId } = useB3Config();
+ const { partnerId } = useB3();
const wagmiConfig = createWagmiConfig({ partnerId });
const { connect } = useConnect();
const activeWagmiAccount = useAccount();
@@ -330,7 +330,7 @@ export function useAuth() {
setIsAuthenticated(false);
setIsConnected(false);
- setUser();
+ setUser(undefined);
callback?.();
},
[activeWallet, disconnect, wallets, setIsAuthenticated, setUser, setIsConnected],
diff --git a/packages/sdk/src/global-account/react/hooks/useAuthentication.ts b/packages/sdk/src/global-account/react/hooks/useAuthentication.ts
index 46cb5ce36..9eda755cd 100644
--- a/packages/sdk/src/global-account/react/hooks/useAuthentication.ts
+++ b/packages/sdk/src/global-account/react/hooks/useAuthentication.ts
@@ -179,7 +179,7 @@ export function useAuthentication(partnerId: string) {
setIsAuthenticated(false);
setIsConnected(false);
- setUser();
+ setUser(undefined);
callback?.();
},
[activeWallet, disconnect, wallets, setIsAuthenticated, setUser, setIsConnected],
diff --git a/packages/sdk/src/global-account/react/hooks/useClient.ts b/packages/sdk/src/global-account/react/hooks/useClient.ts
index 3f3a87f27..02d59617c 100644
--- a/packages/sdk/src/global-account/react/hooks/useClient.ts
+++ b/packages/sdk/src/global-account/react/hooks/useClient.ts
@@ -1,4 +1,4 @@
-import { useB3Config } from "@b3dotfun/sdk/global-account/react";
+import { useB3 } from "@b3dotfun/sdk/global-account/react";
import { useCallback } from "react";
import {
ClientType,
@@ -13,7 +13,7 @@ import {
* Hook to access the current FeathersJS client and client management utilities
*/
export function useClient() {
- const { clientType } = useB3Config();
+ const { clientType } = useB3();
const getCurrentClient = useCallback(() => {
return getClient();
diff --git a/packages/sdk/src/global-account/react/hooks/useHandleConnectWithPrivy.tsx b/packages/sdk/src/global-account/react/hooks/useHandleConnectWithPrivy.tsx
index 39acd1281..a2acfaa1d 100644
--- a/packages/sdk/src/global-account/react/hooks/useHandleConnectWithPrivy.tsx
+++ b/packages/sdk/src/global-account/react/hooks/useHandleConnectWithPrivy.tsx
@@ -1,4 +1,4 @@
-import { useB3Config, useConnect } from "@b3dotfun/sdk/global-account/react";
+import { useB3, useConnect } from "@b3dotfun/sdk/global-account/react";
import { debugB3React } from "@b3dotfun/sdk/shared/utils/debug";
import { useIdentityToken, usePrivy } from "@privy-io/react-auth";
import { useCallback, useRef, useState } from "react";
@@ -11,7 +11,7 @@ const debug = debugB3React("@@b3:useHandleConnectWithPrivy");
* Currently, this is for the basement-privy strategy
*/
export function useHandleConnectWithPrivy(chain?: Chain, onSuccess?: (account: Account) => void) {
- const { partnerId } = useB3Config();
+ const { partnerId } = useB3();
if (!chain) {
throw new Error("Chain is required");
}
diff --git a/packages/sdk/src/global-account/react/hooks/useNotifications.ts b/packages/sdk/src/global-account/react/hooks/useNotifications.ts
index 9ba00024e..bc8bc2ca5 100644
--- a/packages/sdk/src/global-account/react/hooks/useNotifications.ts
+++ b/packages/sdk/src/global-account/react/hooks/useNotifications.ts
@@ -1,4 +1,4 @@
-import { useB3Config } from "@b3dotfun/sdk/global-account/react";
+import { useB3 } from "@b3dotfun/sdk/global-account/react";
import { getAuthToken } from "@b3dotfun/sdk/shared/utils/auth-token";
import { debugB3React } from "@b3dotfun/sdk/shared/utils/debug";
import { useCallback, useEffect, useState } from "react";
@@ -56,7 +56,7 @@ export interface UseNotificationsReturn {
*/
export function useNotifications(): UseNotificationsReturn {
const { user } = useUserQuery();
- const { partnerId } = useB3Config();
+ const { partnerId } = useB3();
const [userData, setUserData] = useState(null);
const [loading, setLoading] = useState(true);
const [error, setError] = useState(null);
diff --git a/packages/sdk/src/global-account/react/hooks/useTokenBalance.tsx b/packages/sdk/src/global-account/react/hooks/useTokenBalance.tsx
index c6bf53583..073a263c1 100644
--- a/packages/sdk/src/global-account/react/hooks/useTokenBalance.tsx
+++ b/packages/sdk/src/global-account/react/hooks/useTokenBalance.tsx
@@ -1,12 +1,12 @@
"use client";
import { isNativeToken } from "@b3dotfun/sdk/anyspend";
-import { components } from "@b3dotfun/sdk/anyspend/types/api";
-import { useAccountWallet, useAuthStore } from "@b3dotfun/sdk/global-account/react";
+import { useB3, useAccountWallet } from "@b3dotfun/sdk/global-account/react";
import { formatTokenAmount } from "@b3dotfun/sdk/shared/utils/number";
import { getERC20Balances, getNativeTokenBalance } from "@b3dotfun/sdk/shared/utils/thirdweb-insights";
import { useQuery } from "@tanstack/react-query";
import { useEffect } from "react";
+import { components } from "@b3dotfun/sdk/anyspend/types/api";
interface UseTokenBalanceProps {
token: components["schemas"]["Token"];
@@ -20,8 +20,7 @@ export interface TokenBalanceResult {
}
export function useTokenBalance({ token, address }: UseTokenBalanceProps): TokenBalanceResult {
- const isAuthenticated = useAuthStore(state => state.isAuthenticated);
-
+ const { ready } = useB3();
const account = useAccountWallet();
const effectiveAddress = address || account?.address;
@@ -61,7 +60,7 @@ export function useTokenBalance({ token, address }: UseTokenBalanceProps): Token
}
return { formatted: "0", raw: null };
},
- enabled: isAuthenticated && !!effectiveAddress,
+ enabled: ready && !!effectiveAddress,
staleTime: 30000,
gcTime: 5 * 60 * 1000,
retry: 2,
@@ -70,13 +69,13 @@ export function useTokenBalance({ token, address }: UseTokenBalanceProps): Token
// Force a refetch when the wallet or token changes
useEffect(() => {
- if (isAuthenticated && effectiveAddress) {
+ if (ready && effectiveAddress) {
refetch();
}
- }, [isAuthenticated, effectiveAddress, token.address, token.chainId, token.symbol, refetch]);
+ }, [ready, effectiveAddress, token.address, token.chainId, token.symbol, refetch]);
// Determine if we're actually loading
- const isActuallyLoading = !isAuthenticated || !effectiveAddress || isLoading || (isFetching && !tokenBalance);
+ const isActuallyLoading = !ready || !effectiveAddress || isLoading || (isFetching && !tokenBalance);
return {
rawBalance: tokenBalance?.raw || BigInt(0),
diff --git a/packages/sdk/src/global-account/react/hooks/useTurnkeyAuth.ts b/packages/sdk/src/global-account/react/hooks/useTurnkeyAuth.ts
index 7981d5156..e778b7a4d 100644
--- a/packages/sdk/src/global-account/react/hooks/useTurnkeyAuth.ts
+++ b/packages/sdk/src/global-account/react/hooks/useTurnkeyAuth.ts
@@ -2,7 +2,7 @@ import { TurnkeyAuthInitResponse } from "@b3dotfun/b3-api";
import { debugB3React } from "@b3dotfun/sdk/shared/utils/debug";
import { useCallback, useState } from "react";
import app from "../../app";
-import { useB3Config } from "../components";
+import { useB3 } from "../components";
import { useAuthStore } from "../stores";
import { useAuth } from "./useAuth";
@@ -33,7 +33,7 @@ export function useTurnkeyAuth(): UseTurnkeyAuthReturn {
const [error, setError] = useState(null);
const setIsAuthenticating = useAuthStore(state => state.setIsAuthenticating);
const setIsAuthenticated = useAuthStore(state => state.setIsAuthenticated);
- const { partnerId } = useB3Config();
+ const { partnerId } = useB3();
const { authenticate } = useAuth();
/**
diff --git a/packages/sdk/src/global-account/react/hooks/useUser.ts b/packages/sdk/src/global-account/react/hooks/useUser.ts
deleted file mode 100644
index 85785e5de..000000000
--- a/packages/sdk/src/global-account/react/hooks/useUser.ts
+++ /dev/null
@@ -1,20 +0,0 @@
-import { useAuthStore } from "@b3dotfun/sdk/global-account/react";
-import { useUserStore } from "../stores/userStore";
-
-/**
- * Preferred Hook to get the user data
- */
-export function useUser() {
- const user = useUserStore(state => state.user);
-
- const isConnecting = useAuthStore(state => state.isConnecting);
- const isConnected = useAuthStore(state => state.isConnected);
- const isAuthenticating = useAuthStore(state => state.isAuthenticating);
-
- return {
- user,
- isConnecting,
- isConnected,
- isAuthenticating,
- };
-}
diff --git a/packages/sdk/src/global-account/react/hooks/useUserQuery.ts b/packages/sdk/src/global-account/react/hooks/useUserQuery.ts
index 0c5fda41e..e0d33efc8 100644
--- a/packages/sdk/src/global-account/react/hooks/useUserQuery.ts
+++ b/packages/sdk/src/global-account/react/hooks/useUserQuery.ts
@@ -1,84 +1,71 @@
import { Users } from "@b3dotfun/b3-api";
+import { debugB3React } from "@b3dotfun/sdk/shared/utils/debug";
import { useEffect } from "react";
-import { useUserStore } from "../stores/userStore";
+import { create } from "zustand";
+import { persist } from "zustand/middleware";
+
+const debug = debugB3React("useUserQuery");
const USER_QUERY_KEY = ["b3-user"];
+interface UserStore {
+ user: Users | null;
+ setUser: (user: Users | undefined) => void;
+ clearUser: () => void;
+}
+
+/**
+ * Zustand store for managing user state
+ * Persists user data to localStorage
+ */
+const useUserStore = create()(
+ persist(
+ set => ({
+ user: null,
+ setUser: (newUser: Users | undefined) => {
+ const userToSave = newUser ?? null;
+ set({ user: userToSave });
+ debug("User updated", userToSave);
+ },
+ clearUser: () => {
+ set({ user: null });
+ debug("User cleared");
+ },
+ }),
+ {
+ name: "b3-user",
+ onRehydrateStorage: () => (_, error) => {
+ if (error) {
+ console.warn("Failed to rehydrate user store:", error);
+ }
+ },
+ },
+ ),
+);
+
/**
* NOTE: THIS IS ONLY MEANT FOR INTERNAL USE, from useOnConnect
*
- * Custom hook to manage user state with Zustand
- * This allows for invalidation and refetching of user data
+ * Hook to query and manage user data
+ * Provides user state and methods to update it
+ * Uses Zustand store with persistence to localStorage
*/
export function useUserQuery() {
const user = useUserStore(state => state.user);
- const setUserStore = useUserStore(state => state.setUser);
- const clearUserStore = useUserStore(state => state.clearUser);
+ const setUser = useUserStore(state => state.setUser);
+ const clearUser = useUserStore(state => state.clearUser);
- // Listen for storage events from other tabs/windows
useEffect(() => {
- const handleStorageChange = (e: StorageEvent) => {
- if (e.key === "b3-user") {
- // Sync with changes from other tabs/windows
- const stored = e.newValue;
- if (stored) {
- try {
- const parsed = JSON.parse(stored);
- // Zustand persist format: { state: { user: ... }, version: ... }
- const userData = parsed?.state?.user ?? parsed?.user ?? null;
- useUserStore.setState({ user: userData });
- } catch (error) {
- console.warn("Failed to parse user from storage event:", error);
- }
- } else {
- useUserStore.setState({ user: null });
- }
- }
- };
-
- window.addEventListener("storage", handleStorageChange);
- return () => {
- window.removeEventListener("storage", handleStorageChange);
- };
- }, []);
-
- // Helper function to set user (maintains backward compatibility)
- const setUser = (newUser?: Users) => {
- setUserStore(newUser);
- };
-
- // Helper function to invalidate and refetch user
- const refetchUser = async () => {
- // Re-read from localStorage and update store
- // Zustand persist stores data as { state: { user: ... }, version: ... }
- const stored = localStorage.getItem("b3-user");
- if (stored) {
- try {
- const parsed = JSON.parse(stored);
- // Zustand persist format: { state: { user: ... }, version: ... }
- const userData = parsed?.state?.user ?? parsed?.user ?? null;
- useUserStore.setState({ user: userData });
- return userData ?? undefined;
- } catch (error) {
- console.warn("Failed to refetch user from localStorage:", error);
- // Fallback to current store state
- return useUserStore.getState().user ?? undefined;
- }
+ if (user) {
+ debug("User loaded from store", user);
}
- useUserStore.setState({ user: null });
- return undefined;
- };
-
- // Helper function to clear user
- const clearUser = () => {
- clearUserStore();
- };
+ }, [user]);
return {
- user: user ?? undefined,
+ user,
setUser,
- refetchUser,
clearUser,
- queryKey: USER_QUERY_KEY,
};
}
+
+export { USER_QUERY_KEY };
diff --git a/packages/sdk/src/global-account/react/index.native.ts b/packages/sdk/src/global-account/react/index.native.ts
index c5f40490c..9957fe3d9 100644
--- a/packages/sdk/src/global-account/react/index.native.ts
+++ b/packages/sdk/src/global-account/react/index.native.ts
@@ -6,6 +6,8 @@
export { B3Provider } from "./components/B3Provider/B3Provider.native";
+export { B3Context, type B3ContextType } from "./components/B3Provider/types";
+export { useB3 } from "./components/B3Provider/useB3";
export { useAccountWallet } from "./hooks/useAccountWallet";
export { useAuthentication } from "./hooks/useAuthentication";
export { useProfile } from "./hooks/useProfile";
diff --git a/packages/sdk/src/global-account/react/stores/userStore.ts b/packages/sdk/src/global-account/react/stores/userStore.ts
deleted file mode 100644
index 9b2384da1..000000000
--- a/packages/sdk/src/global-account/react/stores/userStore.ts
+++ /dev/null
@@ -1,41 +0,0 @@
-import { Users } from "@b3dotfun/b3-api";
-import { debugB3React } from "@b3dotfun/sdk/shared/utils/debug";
-import { create } from "zustand";
-import { persist } from "zustand/middleware";
-
-const debug = debugB3React("useUserQuery");
-
-interface UserStore {
- user: Users | null;
- setUser: (user: Users | undefined) => void;
- clearUser: () => void;
-}
-
-/**
- * Zustand store for managing user state
- * Persists user data to localStorage
- */
-export const useUserStore = create()(
- persist(
- set => ({
- user: null,
- setUser: (newUser: Users | undefined) => {
- const userToSave = newUser ?? null;
- set({ user: userToSave });
- debug("User updated", userToSave);
- },
- clearUser: () => {
- set({ user: null });
- debug("User cleared");
- },
- }),
- {
- name: "b3-user",
- onRehydrateStorage: () => (_, error) => {
- if (error) {
- console.warn("Failed to rehydrate user store:", error);
- }
- },
- },
- ),
-);