@b3dotfun/sdk 0.1.69-alpha.17 → 0.1.69-alpha.19
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/dist/cjs/anyspend/utils/chain.js +1 -1
- package/dist/cjs/global-account/better-auth-client.d.ts +1883 -0
- package/dist/cjs/global-account/better-auth-client.js +17 -0
- package/dist/cjs/global-account/react/components/B3Provider/B3ConfigProvider.d.ts +4 -1
- package/dist/cjs/global-account/react/components/B3Provider/B3ConfigProvider.js +2 -1
- package/dist/cjs/global-account/react/components/B3Provider/B3Provider.d.ts +4 -1
- package/dist/cjs/global-account/react/components/B3Provider/B3Provider.js +3 -2
- package/dist/cjs/global-account/react/components/B3Provider/BetterAuthProvider.d.ts +16 -0
- package/dist/cjs/global-account/react/components/B3Provider/BetterAuthProvider.js +120 -0
- package/dist/cjs/global-account/react/components/SignInWithB3/BetterAuthResetPassword.d.ts +21 -0
- package/dist/cjs/global-account/react/components/SignInWithB3/BetterAuthResetPassword.js +67 -0
- package/dist/cjs/global-account/react/components/SignInWithB3/BetterAuthSignIn.d.ts +34 -0
- package/dist/cjs/global-account/react/components/SignInWithB3/BetterAuthSignIn.js +163 -0
- package/dist/cjs/global-account/react/components/SignInWithB3/SignInWithB3Flow.js +9 -3
- package/dist/cjs/global-account/react/components/SignInWithB3/steps/LoginStepBetterAuth.d.ts +6 -0
- package/dist/cjs/global-account/react/components/SignInWithB3/steps/LoginStepBetterAuth.js +138 -0
- package/dist/cjs/global-account/react/components/SignInWithB3/utils/signInUtils.js +5 -1
- package/dist/cjs/global-account/react/components/index.d.ts +3 -0
- package/dist/cjs/global-account/react/components/index.js +7 -3
- package/dist/cjs/global-account/react/hooks/index.d.ts +1 -0
- package/dist/cjs/global-account/react/hooks/index.js +5 -2
- package/dist/cjs/global-account/react/hooks/useBetterAuth.d.ts +973 -0
- package/dist/cjs/global-account/react/hooks/useBetterAuth.js +157 -0
- package/dist/esm/anyspend/utils/chain.js +1 -1
- package/dist/esm/global-account/better-auth-client.d.ts +1883 -0
- package/dist/esm/global-account/better-auth-client.js +13 -0
- package/dist/esm/global-account/react/components/B3Provider/B3ConfigProvider.d.ts +4 -1
- package/dist/esm/global-account/react/components/B3Provider/B3ConfigProvider.js +2 -1
- package/dist/esm/global-account/react/components/B3Provider/B3Provider.d.ts +4 -1
- package/dist/esm/global-account/react/components/B3Provider/B3Provider.js +3 -2
- package/dist/esm/global-account/react/components/B3Provider/BetterAuthProvider.d.ts +16 -0
- package/dist/esm/global-account/react/components/B3Provider/BetterAuthProvider.js +115 -0
- package/dist/esm/global-account/react/components/SignInWithB3/BetterAuthResetPassword.d.ts +21 -0
- package/dist/esm/global-account/react/components/SignInWithB3/BetterAuthResetPassword.js +64 -0
- package/dist/esm/global-account/react/components/SignInWithB3/BetterAuthSignIn.d.ts +34 -0
- package/dist/esm/global-account/react/components/SignInWithB3/BetterAuthSignIn.js +160 -0
- package/dist/esm/global-account/react/components/SignInWithB3/SignInWithB3Flow.js +9 -3
- package/dist/esm/global-account/react/components/SignInWithB3/steps/LoginStepBetterAuth.d.ts +6 -0
- package/dist/esm/global-account/react/components/SignInWithB3/steps/LoginStepBetterAuth.js +135 -0
- package/dist/esm/global-account/react/components/SignInWithB3/utils/signInUtils.js +5 -1
- package/dist/esm/global-account/react/components/index.d.ts +3 -0
- package/dist/esm/global-account/react/components/index.js +2 -0
- package/dist/esm/global-account/react/hooks/index.d.ts +1 -0
- package/dist/esm/global-account/react/hooks/index.js +1 -0
- package/dist/esm/global-account/react/hooks/useBetterAuth.d.ts +973 -0
- package/dist/esm/global-account/react/hooks/useBetterAuth.js +149 -0
- package/dist/styles/index.css +1 -1
- package/dist/types/global-account/better-auth-client.d.ts +1883 -0
- package/dist/types/global-account/react/components/B3Provider/B3ConfigProvider.d.ts +4 -1
- package/dist/types/global-account/react/components/B3Provider/B3Provider.d.ts +4 -1
- package/dist/types/global-account/react/components/B3Provider/BetterAuthProvider.d.ts +16 -0
- package/dist/types/global-account/react/components/SignInWithB3/BetterAuthResetPassword.d.ts +21 -0
- package/dist/types/global-account/react/components/SignInWithB3/BetterAuthSignIn.d.ts +34 -0
- package/dist/types/global-account/react/components/SignInWithB3/steps/LoginStepBetterAuth.d.ts +6 -0
- package/dist/types/global-account/react/components/index.d.ts +3 -0
- package/dist/types/global-account/react/hooks/index.d.ts +1 -0
- package/dist/types/global-account/react/hooks/useBetterAuth.d.ts +973 -0
- package/package.json +2 -1
- package/src/anyspend/utils/chain.ts +1 -2
- package/src/global-account/better-auth-client.ts +17 -0
- package/src/global-account/react/components/B3Provider/B3ConfigProvider.tsx +6 -0
- package/src/global-account/react/components/B3Provider/B3Provider.tsx +15 -5
- package/src/global-account/react/components/B3Provider/BetterAuthProvider.tsx +127 -0
- package/src/global-account/react/components/SignInWithB3/BetterAuthResetPassword.tsx +146 -0
- package/src/global-account/react/components/SignInWithB3/BetterAuthSignIn.tsx +426 -0
- package/src/global-account/react/components/SignInWithB3/SignInWithB3Flow.tsx +9 -3
- package/src/global-account/react/components/SignInWithB3/steps/LoginStepBetterAuth.tsx +308 -0
- package/src/global-account/react/components/SignInWithB3/utils/signInUtils.ts +5 -1
- package/src/global-account/react/components/index.ts +3 -0
- package/src/global-account/react/hooks/index.ts +1 -0
- package/src/global-account/react/hooks/useBetterAuth.ts +191 -0
|
@@ -3,6 +3,7 @@ import { CreateOrderParams } from "@b3dotfun/sdk/anyspend/react/hooks/useAnyspen
|
|
|
3
3
|
import { PermissionsConfig } from "@b3dotfun/sdk/global-account/types/permissions";
|
|
4
4
|
import { Account } from "thirdweb/wallets";
|
|
5
5
|
import { ClientType } from "../../../client-manager";
|
|
6
|
+
export type AuthStrategy = "thirdweb" | "better-auth";
|
|
6
7
|
export interface B3ConfigContextType {
|
|
7
8
|
accountOverride?: Account;
|
|
8
9
|
automaticallySetFirstEoa: boolean;
|
|
@@ -13,8 +14,9 @@ export interface B3ConfigContextType {
|
|
|
13
14
|
partnerId: string;
|
|
14
15
|
stripePublishableKey?: string;
|
|
15
16
|
createClientReferenceId?: (params: CreateOrderParams | CreateOnrampOrderParams) => Promise<string>;
|
|
17
|
+
authStrategy: AuthStrategy;
|
|
16
18
|
}
|
|
17
|
-
export declare function B3ConfigProvider({ children, accountOverride, environment, defaultPermissions, automaticallySetFirstEoa, theme, clientType, partnerId, stripePublishableKey, createClientReferenceId, }: {
|
|
19
|
+
export declare function B3ConfigProvider({ children, accountOverride, environment, defaultPermissions, automaticallySetFirstEoa, theme, clientType, partnerId, stripePublishableKey, createClientReferenceId, authStrategy, }: {
|
|
18
20
|
children: React.ReactNode;
|
|
19
21
|
accountOverride?: Account;
|
|
20
22
|
environment?: "development" | "production";
|
|
@@ -25,5 +27,6 @@ export declare function B3ConfigProvider({ children, accountOverride, environmen
|
|
|
25
27
|
partnerId: string;
|
|
26
28
|
stripePublishableKey?: string;
|
|
27
29
|
createClientReferenceId?: (params: CreateOrderParams | CreateOnrampOrderParams) => Promise<string>;
|
|
30
|
+
authStrategy?: AuthStrategy;
|
|
28
31
|
}): import("react/jsx-runtime").JSX.Element;
|
|
29
32
|
export declare function useB3Config(): B3ConfigContextType;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { CreateOnrampOrderParams } from "@b3dotfun/sdk/anyspend/react/hooks/useAnyspendCreateOnrampOrder";
|
|
2
2
|
import { CreateOrderParams } from "@b3dotfun/sdk/anyspend/react/hooks/useAnyspendCreateOrder";
|
|
3
3
|
import { PermissionsConfig } from "@b3dotfun/sdk/global-account/types/permissions";
|
|
4
|
+
import type { AuthStrategy } from "./B3ConfigProvider";
|
|
4
5
|
import "@relayprotocol/relay-kit-ui/styles.css";
|
|
5
6
|
import { QueryClient } from "@tanstack/react-query";
|
|
6
7
|
import { Account, EIP1193, Wallet } from "thirdweb/wallets";
|
|
@@ -9,7 +10,7 @@ import { ClientType } from "../../../client-manager";
|
|
|
9
10
|
/**
|
|
10
11
|
* Main B3Provider component
|
|
11
12
|
*/
|
|
12
|
-
export declare function B3Provider({ theme, children, accountOverride, environment, automaticallySetFirstEoa, defaultEoaProvider, simDuneApiKey, toaster: _toaster, clientType, rpcUrls, partnerId, stripePublishableKey, onConnect, onLogout, connectors, overrideDefaultConnectors, createClientReferenceId, defaultPermissions, disableBSMNTAuthentication, queryClient, }: {
|
|
13
|
+
export declare function B3Provider({ theme, children, accountOverride, environment, automaticallySetFirstEoa, defaultEoaProvider, simDuneApiKey, toaster: _toaster, clientType, rpcUrls, partnerId, stripePublishableKey, onConnect, onLogout, connectors, overrideDefaultConnectors, createClientReferenceId, defaultPermissions, disableBSMNTAuthentication, queryClient, authStrategy, }: {
|
|
13
14
|
theme: "light" | "dark";
|
|
14
15
|
children: React.ReactNode;
|
|
15
16
|
accountOverride?: Account;
|
|
@@ -36,4 +37,6 @@ export declare function B3Provider({ theme, children, accountOverride, environme
|
|
|
36
37
|
disableBSMNTAuthentication?: boolean;
|
|
37
38
|
/** Provide your own QueryClient for React Query. If omitted, WalletProvider creates one internally. */
|
|
38
39
|
queryClient?: QueryClient;
|
|
40
|
+
/** Auth strategy: "thirdweb" (default, ecosystem wallet) or "better-auth" (email/password via Better Auth) */
|
|
41
|
+
authStrategy?: AuthStrategy;
|
|
39
42
|
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Parallel to AuthenticationProvider for Better Auth strategy.
|
|
3
|
+
*
|
|
4
|
+
* Manages the isAuthenticating lifecycle for Better Auth:
|
|
5
|
+
* 1. On mount, try to restore an existing Feathers JWT (from a previous login)
|
|
6
|
+
* 2. If no Feathers JWT, check for a Better Auth session (e.g. after OAuth redirect)
|
|
7
|
+
* and exchange it for a Feathers JWT
|
|
8
|
+
* 3. If neither exists, set isAuthenticating: false so the login UI renders
|
|
9
|
+
*
|
|
10
|
+
* Also patches app.logout() so any code path that calls it (useAuthentication,
|
|
11
|
+
* useAuth, SignIn component, etc.) automatically clears the Better Auth session.
|
|
12
|
+
*/
|
|
13
|
+
declare const BetterAuthProvider: ({ partnerId }: {
|
|
14
|
+
partnerId: string;
|
|
15
|
+
}) => null;
|
|
16
|
+
export default BetterAuthProvider;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export interface BetterAuthResetPasswordProps {
|
|
2
|
+
/** The reset token from the URL query param */
|
|
3
|
+
token: string;
|
|
4
|
+
/** Called after password is successfully reset */
|
|
5
|
+
onSuccess?: () => void;
|
|
6
|
+
/** Called on error */
|
|
7
|
+
onError?: (error: Error) => void;
|
|
8
|
+
/** Optional class name */
|
|
9
|
+
className?: string;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Standalone reset password form. Render this on your reset password page.
|
|
13
|
+
* Reads the token from props (extract it from the URL query string).
|
|
14
|
+
*
|
|
15
|
+
* Usage:
|
|
16
|
+
* ```tsx
|
|
17
|
+
* const token = new URLSearchParams(window.location.search).get("token");
|
|
18
|
+
* <BetterAuthResetPassword token={token} onSuccess={() => navigate("/login")} />
|
|
19
|
+
* ```
|
|
20
|
+
*/
|
|
21
|
+
export declare function BetterAuthResetPassword({ token, onSuccess, onError, className }: BetterAuthResetPasswordProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { type BetterAuthSocialProvider } from "../../hooks/useBetterAuth";
|
|
2
|
+
export interface BetterAuthSignInProps {
|
|
3
|
+
/** Title displayed above the form. Default: "Welcome back" for sign-in, "Create an account" for sign-up */
|
|
4
|
+
title?: string;
|
|
5
|
+
/** Subtitle displayed below the title */
|
|
6
|
+
subtitle?: string;
|
|
7
|
+
/** Which social providers to show. Defaults to all. Pass empty array to hide. */
|
|
8
|
+
socialProviders?: BetterAuthSocialProvider[];
|
|
9
|
+
/** Show email/password form. Default: true */
|
|
10
|
+
showEmail?: boolean;
|
|
11
|
+
/** URL to redirect to after password reset link is clicked. Token is appended as ?token=... */
|
|
12
|
+
passwordResetRedirectTo?: string;
|
|
13
|
+
/** Called after successful authentication */
|
|
14
|
+
onSuccess?: () => void;
|
|
15
|
+
/** Called on authentication error */
|
|
16
|
+
onError?: (error: Error) => void;
|
|
17
|
+
/** Optional class name for the root container */
|
|
18
|
+
className?: string;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Standalone inline sign-in component for Better Auth.
|
|
22
|
+
*
|
|
23
|
+
* Renders directly — no modal, no button wrapper. Designed for full-page
|
|
24
|
+
* sign-in layouts (e.g., B3OS web with branding on the left, form on the right).
|
|
25
|
+
*
|
|
26
|
+
* Usage:
|
|
27
|
+
* ```tsx
|
|
28
|
+
* <BetterAuthSignIn
|
|
29
|
+
* socialProviders={["google", "github"]}
|
|
30
|
+
* onSuccess={() => router.push("/dashboard")}
|
|
31
|
+
* />
|
|
32
|
+
* ```
|
|
33
|
+
*/
|
|
34
|
+
export declare function BetterAuthSignIn({ title, subtitle, socialProviders, showEmail, passwordResetRedirectTo, onSuccess, onError, className, }: BetterAuthSignInProps): import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
export { B3DynamicModal } from "./B3DynamicModal";
|
|
2
2
|
export { B3Provider } from "./B3Provider/B3Provider";
|
|
3
|
+
export type { AuthStrategy } from "./B3Provider/B3ConfigProvider";
|
|
3
4
|
export { RelayKitProviderWrapper } from "./B3Provider/RelayKitProviderWrapper";
|
|
4
5
|
export { useB3 } from "./B3Provider/useB3";
|
|
5
6
|
export { useB3Account } from "./B3Provider/useB3Account";
|
|
6
7
|
export { useB3Config } from "./B3Provider/useB3Config";
|
|
7
8
|
export { StyleRoot } from "./StyleRoot";
|
|
9
|
+
export { BetterAuthResetPassword, type BetterAuthResetPasswordProps } from "./SignInWithB3/BetterAuthResetPassword";
|
|
10
|
+
export { BetterAuthSignIn, type BetterAuthSignInProps } from "./SignInWithB3/BetterAuthSignIn";
|
|
8
11
|
export { AuthButton } from "./SignInWithB3/components/AuthButton";
|
|
9
12
|
export { PermissionItem } from "./SignInWithB3/components/PermissionItem";
|
|
10
13
|
export { WalletRow } from "./SignInWithB3/components/WalletRow";
|
|
@@ -5,6 +5,7 @@ export { useAddTWSessionKey } from "./useAddTWSessionKey";
|
|
|
5
5
|
export { useAnalytics } from "./useAnalytics";
|
|
6
6
|
export { useAuth } from "./useAuth";
|
|
7
7
|
export { useAuthentication } from "./useAuthentication";
|
|
8
|
+
export { useBetterAuth, EmailVerificationRequiredError } from "./useBetterAuth";
|
|
8
9
|
export { useB3BalanceFromAddresses } from "./useB3BalanceFromAddresses";
|
|
9
10
|
export { useB3EnsName } from "./useB3EnsName";
|
|
10
11
|
export { useChainSwitchWithAction } from "./useChainSwitchWithAction";
|