@b3dotfun/sdk 0.1.69-test.0 → 0.1.70-alpha.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/dist/cjs/anyspend/react/components/AnySpend.d.ts +2 -0
- package/dist/cjs/anyspend/react/components/AnySpend.js +12 -4
- package/dist/cjs/anyspend/react/components/AnySpendCollectorClubPurchase.d.ts +5 -1
- package/dist/cjs/anyspend/react/components/AnySpendCollectorClubPurchase.js +2 -2
- package/dist/cjs/anyspend/react/components/AnySpendCustom.d.ts +2 -0
- package/dist/cjs/anyspend/react/components/AnySpendCustom.js +7 -3
- package/dist/cjs/anyspend/react/components/AnySpendDeposit.d.ts +3 -1
- package/dist/cjs/anyspend/react/components/AnySpendDeposit.js +3 -3
- package/dist/cjs/anyspend/react/components/AnySpendNFT.d.ts +3 -1
- package/dist/cjs/anyspend/react/components/AnySpendNFT.js +2 -2
- package/dist/cjs/anyspend/react/components/AnySpendStakeUpside.d.ts +3 -1
- package/dist/cjs/anyspend/react/components/AnySpendStakeUpside.js +2 -2
- package/dist/cjs/anyspend/react/components/checkout/AnySpendCheckout.js +6 -5
- package/dist/cjs/anyspend/react/components/checkout/CartItemRow.d.ts +2 -1
- package/dist/cjs/anyspend/react/components/checkout/CartSummary.d.ts +6 -4
- package/dist/cjs/anyspend/react/components/checkout/CartSummary.js +13 -11
- package/dist/cjs/anyspend/react/components/checkout/CheckoutCartPanel.d.ts +3 -1
- package/dist/cjs/anyspend/react/components/checkout/CheckoutCartPanel.js +5 -4
- package/dist/cjs/anyspend/react/components/checkout/CheckoutFormPanel.d.ts +3 -1
- package/dist/cjs/anyspend/react/components/checkout/CheckoutFormPanel.js +2 -2
- package/dist/cjs/anyspend/react/components/checkout/DiscountCodeInput.d.ts +3 -1
- package/dist/cjs/anyspend/react/components/checkout/DiscountCodeInput.js +3 -6
- package/dist/cjs/anyspend/react/components/checkout/PriceSkeleton.d.ts +5 -0
- package/dist/cjs/anyspend/react/components/checkout/PriceSkeleton.js +9 -0
- package/dist/cjs/anyspend/react/components/checkout/ShippingSelector.d.ts +3 -1
- package/dist/cjs/anyspend/react/components/checkout/ShippingSelector.js +3 -2
- package/dist/cjs/global-account/react/components/AvatarEditor/AvatarEditor.js +3 -1
- package/dist/cjs/global-account/react/components/B3Provider/B3ConfigProvider.d.ts +5 -1
- package/dist/cjs/global-account/react/components/B3Provider/B3ConfigProvider.js +2 -1
- package/dist/cjs/global-account/react/components/B3Provider/B3Provider.d.ts +17 -1
- package/dist/cjs/global-account/react/components/B3Provider/B3Provider.js +3 -2
- package/dist/cjs/global-account/react/components/B3Provider/BetterAuthClientProvider.d.ts +17 -0
- package/dist/cjs/global-account/react/components/B3Provider/BetterAuthClientProvider.js +31 -0
- package/dist/cjs/global-account/react/components/B3Provider/BetterAuthProvider.js +6 -5
- package/dist/cjs/global-account/react/components/ManageAccount/BottomNavigation.js +4 -2
- package/dist/cjs/global-account/react/components/ManageAccount/Header.js +36 -4
- package/dist/cjs/global-account/react/components/ManageAccount/HomeContent.js +4 -1
- package/dist/cjs/global-account/react/components/ManageAccount/ManageAccount.js +6 -0
- package/dist/cjs/global-account/react/components/ManageAccount/ProfileSection.js +5 -3
- package/dist/cjs/global-account/react/components/ManageAccount/SettingsContent.js +3 -1
- package/dist/cjs/global-account/react/components/ManageAccount/SettingsProfileCard.js +25 -14
- package/dist/cjs/global-account/react/components/SignInWithB3/BetterAuthResetPassword.js +3 -2
- package/dist/cjs/global-account/react/components/SignInWithB3/BetterAuthSignIn.d.ts +6 -1
- package/dist/cjs/global-account/react/components/SignInWithB3/BetterAuthSignIn.js +15 -5
- package/dist/cjs/global-account/react/components/SignInWithB3/BetterAuthVerifyEmail.d.ts +37 -0
- package/dist/cjs/global-account/react/components/SignInWithB3/BetterAuthVerifyEmail.js +85 -0
- package/dist/cjs/global-account/react/components/SignInWithB3/SignIn.js +14 -4
- package/dist/cjs/global-account/react/components/SignInWithB3/SignInWithB3Flow.d.ts +1 -1
- package/dist/cjs/global-account/react/components/SignInWithB3/SignInWithB3Flow.js +2 -2
- package/dist/cjs/global-account/react/components/SignInWithB3/components/PasswordInput.d.ts +10 -0
- package/dist/cjs/global-account/react/components/SignInWithB3/components/PasswordInput.js +10 -0
- package/dist/cjs/global-account/react/components/SignInWithB3/steps/LoginStepBetterAuth.d.ts +3 -1
- package/dist/cjs/global-account/react/components/SignInWithB3/steps/LoginStepBetterAuth.js +8 -5
- package/dist/cjs/global-account/react/components/UserAvatar/UserAvatar.d.ts +18 -0
- package/dist/cjs/global-account/react/components/UserAvatar/UserAvatar.js +27 -0
- package/dist/cjs/global-account/react/components/index.d.ts +3 -0
- package/dist/cjs/global-account/react/components/index.js +10 -3
- package/dist/cjs/global-account/react/hooks/useBetterAuth.d.ts +1 -1
- package/dist/cjs/global-account/react/hooks/useBetterAuth.js +19 -17
- package/dist/cjs/global-account/react/stores/useModalStore.d.ts +4 -0
- package/dist/cjs/shared/constants/index.d.ts +1 -0
- package/dist/cjs/shared/constants/index.js +2 -1
- package/dist/esm/anyspend/react/components/AnySpend.d.ts +2 -0
- package/dist/esm/anyspend/react/components/AnySpend.js +12 -4
- package/dist/esm/anyspend/react/components/AnySpendCollectorClubPurchase.d.ts +5 -1
- package/dist/esm/anyspend/react/components/AnySpendCollectorClubPurchase.js +2 -2
- package/dist/esm/anyspend/react/components/AnySpendCustom.d.ts +2 -0
- package/dist/esm/anyspend/react/components/AnySpendCustom.js +7 -3
- package/dist/esm/anyspend/react/components/AnySpendDeposit.d.ts +3 -1
- package/dist/esm/anyspend/react/components/AnySpendDeposit.js +3 -3
- package/dist/esm/anyspend/react/components/AnySpendNFT.d.ts +3 -1
- package/dist/esm/anyspend/react/components/AnySpendNFT.js +2 -2
- package/dist/esm/anyspend/react/components/AnySpendStakeUpside.d.ts +3 -1
- package/dist/esm/anyspend/react/components/AnySpendStakeUpside.js +2 -2
- package/dist/esm/anyspend/react/components/checkout/AnySpendCheckout.js +6 -5
- package/dist/esm/anyspend/react/components/checkout/CartItemRow.d.ts +2 -1
- package/dist/esm/anyspend/react/components/checkout/CartSummary.d.ts +6 -4
- package/dist/esm/anyspend/react/components/checkout/CartSummary.js +13 -11
- package/dist/esm/anyspend/react/components/checkout/CheckoutCartPanel.d.ts +3 -1
- package/dist/esm/anyspend/react/components/checkout/CheckoutCartPanel.js +5 -4
- package/dist/esm/anyspend/react/components/checkout/CheckoutFormPanel.d.ts +3 -1
- package/dist/esm/anyspend/react/components/checkout/CheckoutFormPanel.js +2 -2
- package/dist/esm/anyspend/react/components/checkout/DiscountCodeInput.d.ts +3 -1
- package/dist/esm/anyspend/react/components/checkout/DiscountCodeInput.js +3 -6
- package/dist/esm/anyspend/react/components/checkout/PriceSkeleton.d.ts +5 -0
- package/dist/esm/anyspend/react/components/checkout/PriceSkeleton.js +6 -0
- package/dist/esm/anyspend/react/components/checkout/ShippingSelector.d.ts +3 -1
- package/dist/esm/anyspend/react/components/checkout/ShippingSelector.js +3 -2
- package/dist/esm/global-account/react/components/AvatarEditor/AvatarEditor.js +3 -1
- package/dist/esm/global-account/react/components/B3Provider/B3ConfigProvider.d.ts +5 -1
- package/dist/esm/global-account/react/components/B3Provider/B3ConfigProvider.js +2 -1
- package/dist/esm/global-account/react/components/B3Provider/B3Provider.d.ts +17 -1
- package/dist/esm/global-account/react/components/B3Provider/B3Provider.js +3 -2
- package/dist/esm/global-account/react/components/B3Provider/BetterAuthClientProvider.d.ts +17 -0
- package/dist/esm/global-account/react/components/B3Provider/BetterAuthClientProvider.js +27 -0
- package/dist/esm/global-account/react/components/B3Provider/BetterAuthProvider.js +4 -3
- package/dist/esm/global-account/react/components/ManageAccount/BottomNavigation.js +5 -3
- package/dist/esm/global-account/react/components/ManageAccount/Header.js +37 -5
- package/dist/esm/global-account/react/components/ManageAccount/HomeContent.js +4 -1
- package/dist/esm/global-account/react/components/ManageAccount/ManageAccount.js +7 -1
- package/dist/esm/global-account/react/components/ManageAccount/ProfileSection.js +6 -4
- package/dist/esm/global-account/react/components/ManageAccount/SettingsContent.js +5 -3
- package/dist/esm/global-account/react/components/ManageAccount/SettingsProfileCard.js +25 -14
- package/dist/esm/global-account/react/components/SignInWithB3/BetterAuthResetPassword.js +4 -3
- package/dist/esm/global-account/react/components/SignInWithB3/BetterAuthSignIn.d.ts +6 -1
- package/dist/esm/global-account/react/components/SignInWithB3/BetterAuthSignIn.js +16 -6
- package/dist/esm/global-account/react/components/SignInWithB3/BetterAuthVerifyEmail.d.ts +37 -0
- package/dist/esm/global-account/react/components/SignInWithB3/BetterAuthVerifyEmail.js +82 -0
- package/dist/esm/global-account/react/components/SignInWithB3/SignIn.js +15 -5
- package/dist/esm/global-account/react/components/SignInWithB3/SignInWithB3Flow.d.ts +1 -1
- package/dist/esm/global-account/react/components/SignInWithB3/SignInWithB3Flow.js +2 -2
- package/dist/esm/global-account/react/components/SignInWithB3/components/PasswordInput.d.ts +10 -0
- package/dist/esm/global-account/react/components/SignInWithB3/components/PasswordInput.js +7 -0
- package/dist/esm/global-account/react/components/SignInWithB3/steps/LoginStepBetterAuth.d.ts +3 -1
- package/dist/esm/global-account/react/components/SignInWithB3/steps/LoginStepBetterAuth.js +8 -5
- package/dist/esm/global-account/react/components/UserAvatar/UserAvatar.d.ts +18 -0
- package/dist/esm/global-account/react/components/UserAvatar/UserAvatar.js +21 -0
- package/dist/esm/global-account/react/components/index.d.ts +3 -0
- package/dist/esm/global-account/react/components/index.js +4 -0
- package/dist/esm/global-account/react/hooks/useBetterAuth.d.ts +1 -1
- package/dist/esm/global-account/react/hooks/useBetterAuth.js +12 -10
- package/dist/esm/global-account/react/stores/useModalStore.d.ts +4 -0
- package/dist/esm/shared/constants/index.d.ts +1 -0
- package/dist/esm/shared/constants/index.js +1 -0
- package/dist/styles/index.css +1 -1
- package/dist/types/anyspend/react/components/AnySpend.d.ts +2 -0
- package/dist/types/anyspend/react/components/AnySpendCollectorClubPurchase.d.ts +5 -1
- package/dist/types/anyspend/react/components/AnySpendCustom.d.ts +2 -0
- package/dist/types/anyspend/react/components/AnySpendDeposit.d.ts +3 -1
- package/dist/types/anyspend/react/components/AnySpendNFT.d.ts +3 -1
- package/dist/types/anyspend/react/components/AnySpendStakeUpside.d.ts +3 -1
- package/dist/types/anyspend/react/components/checkout/CartItemRow.d.ts +2 -1
- package/dist/types/anyspend/react/components/checkout/CartSummary.d.ts +6 -4
- package/dist/types/anyspend/react/components/checkout/CheckoutCartPanel.d.ts +3 -1
- package/dist/types/anyspend/react/components/checkout/CheckoutFormPanel.d.ts +3 -1
- package/dist/types/anyspend/react/components/checkout/DiscountCodeInput.d.ts +3 -1
- package/dist/types/anyspend/react/components/checkout/PriceSkeleton.d.ts +5 -0
- package/dist/types/anyspend/react/components/checkout/ShippingSelector.d.ts +3 -1
- package/dist/types/global-account/react/components/B3Provider/B3ConfigProvider.d.ts +5 -1
- package/dist/types/global-account/react/components/B3Provider/B3Provider.d.ts +17 -1
- package/dist/types/global-account/react/components/B3Provider/BetterAuthClientProvider.d.ts +17 -0
- package/dist/types/global-account/react/components/SignInWithB3/BetterAuthSignIn.d.ts +6 -1
- package/dist/types/global-account/react/components/SignInWithB3/BetterAuthVerifyEmail.d.ts +37 -0
- package/dist/types/global-account/react/components/SignInWithB3/SignInWithB3Flow.d.ts +1 -1
- package/dist/types/global-account/react/components/SignInWithB3/components/PasswordInput.d.ts +10 -0
- package/dist/types/global-account/react/components/SignInWithB3/steps/LoginStepBetterAuth.d.ts +3 -1
- package/dist/types/global-account/react/components/UserAvatar/UserAvatar.d.ts +18 -0
- package/dist/types/global-account/react/components/index.d.ts +3 -0
- package/dist/types/global-account/react/hooks/useBetterAuth.d.ts +1 -1
- package/dist/types/global-account/react/stores/useModalStore.d.ts +4 -0
- package/dist/types/shared/constants/index.d.ts +1 -0
- package/package.json +1 -1
- package/src/anyspend/react/components/AnySpend.tsx +24 -12
- package/src/anyspend/react/components/AnySpendCollectorClubPurchase.tsx +6 -0
- package/src/anyspend/react/components/AnySpendCustom.tsx +12 -2
- package/src/anyspend/react/components/AnySpendDeposit.tsx +38 -31
- package/src/anyspend/react/components/AnySpendNFT.tsx +4 -0
- package/src/anyspend/react/components/AnySpendStakeUpside.tsx +4 -0
- package/src/anyspend/react/components/checkout/AnySpendCheckout.tsx +10 -4
- package/src/anyspend/react/components/checkout/CartItemRow.tsx +2 -1
- package/src/anyspend/react/components/checkout/CartSummary.tsx +24 -20
- package/src/anyspend/react/components/checkout/CheckoutCartPanel.tsx +12 -3
- package/src/anyspend/react/components/checkout/CheckoutFormPanel.tsx +5 -0
- package/src/anyspend/react/components/checkout/DiscountCodeInput.tsx +15 -5
- package/src/anyspend/react/components/checkout/PriceSkeleton.tsx +19 -0
- package/src/anyspend/react/components/checkout/ShippingSelector.tsx +5 -1
- package/src/global-account/react/components/AvatarEditor/AvatarEditor.tsx +3 -1
- package/src/global-account/react/components/B3Provider/B3ConfigProvider.tsx +6 -0
- package/src/global-account/react/components/B3Provider/B3Provider.tsx +36 -15
- package/src/global-account/react/components/B3Provider/BetterAuthClientProvider.tsx +40 -0
- package/src/global-account/react/components/B3Provider/BetterAuthProvider.tsx +4 -3
- package/src/global-account/react/components/ManageAccount/BottomNavigation.tsx +18 -14
- package/src/global-account/react/components/ManageAccount/Header.tsx +71 -4
- package/src/global-account/react/components/ManageAccount/HomeContent.tsx +25 -19
- package/src/global-account/react/components/ManageAccount/ManageAccount.tsx +13 -0
- package/src/global-account/react/components/ManageAccount/ProfileSection.tsx +14 -7
- package/src/global-account/react/components/ManageAccount/SettingsContent.tsx +15 -32
- package/src/global-account/react/components/ManageAccount/SettingsProfileCard.tsx +29 -20
- package/src/global-account/react/components/SignInWithB3/BetterAuthResetPassword.tsx +6 -7
- package/src/global-account/react/components/SignInWithB3/BetterAuthSignIn.tsx +27 -7
- package/src/global-account/react/components/SignInWithB3/BetterAuthVerifyEmail.tsx +155 -0
- package/src/global-account/react/components/SignInWithB3/SignIn.tsx +42 -13
- package/src/global-account/react/components/SignInWithB3/SignInWithB3Flow.tsx +8 -1
- package/src/global-account/react/components/SignInWithB3/components/PasswordInput.tsx +62 -0
- package/src/global-account/react/components/SignInWithB3/steps/LoginStepBetterAuth.tsx +13 -6
- package/src/global-account/react/components/UserAvatar/UserAvatar.tsx +45 -0
- package/src/global-account/react/components/index.ts +9 -0
- package/src/global-account/react/hooks/useBetterAuth.ts +12 -10
- package/src/global-account/react/stores/useModalStore.ts +4 -0
- package/src/shared/constants/index.ts +2 -0
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
export type BetterAuthVerifyEmailState = "success" | "expired" | "invalid" | "already-verified" | "error";
|
|
2
|
+
export interface BetterAuthVerifyEmailProps {
|
|
3
|
+
/**
|
|
4
|
+
* Error code from the callback URL's `?error=` query param. Pass `null` /
|
|
5
|
+
* `undefined` when the user landed here cleanly (successful verification).
|
|
6
|
+
* Better Auth appends this param when server-side verification fails.
|
|
7
|
+
*/
|
|
8
|
+
errorCode?: string | null;
|
|
9
|
+
/** Called when the user clicks the "Go to sign in" button. */
|
|
10
|
+
onGoToSignIn?: () => void;
|
|
11
|
+
/** Fallback href used when `onGoToSignIn` is not provided. Defaults to "/login". */
|
|
12
|
+
signInHref?: string;
|
|
13
|
+
/** Optional override for the success headline. */
|
|
14
|
+
successTitle?: string;
|
|
15
|
+
/** Optional override for the success body text. */
|
|
16
|
+
successMessage?: string;
|
|
17
|
+
/** Optional class name for the root container. */
|
|
18
|
+
className?: string;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Standalone email-verification confirmation page. Render on the route you
|
|
22
|
+
* set as `callbackURL` when calling `betterAuthClient.sendVerificationEmail`
|
|
23
|
+
* (or the `verifyCallbackURL` arg on `useBetterAuth().signUpWithEmail`).
|
|
24
|
+
*
|
|
25
|
+
* Better Auth verifies the token server-side before redirecting here. This
|
|
26
|
+
* component only displays the outcome based on the `?error=` query param.
|
|
27
|
+
*
|
|
28
|
+
* Usage:
|
|
29
|
+
* ```tsx
|
|
30
|
+
* const error = new URLSearchParams(window.location.search).get("error");
|
|
31
|
+
* <BetterAuthVerifyEmail
|
|
32
|
+
* errorCode={error}
|
|
33
|
+
* onGoToSignIn={() => router.push("/login")}
|
|
34
|
+
* />
|
|
35
|
+
* ```
|
|
36
|
+
*/
|
|
37
|
+
export declare function BetterAuthVerifyEmail({ errorCode, onGoToSignIn, signInHref, successTitle, successMessage, className, }: BetterAuthVerifyEmailProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.BetterAuthVerifyEmail = BetterAuthVerifyEmail;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const react_1 = require("../../../../global-account/react");
|
|
6
|
+
const debug_1 = require("../../../../shared/utils/debug");
|
|
7
|
+
const debug = (0, debug_1.debugB3React)("BetterAuthVerifyEmail");
|
|
8
|
+
function classifyError(code) {
|
|
9
|
+
if (!code)
|
|
10
|
+
return "success";
|
|
11
|
+
const normalized = code.toLowerCase();
|
|
12
|
+
// Exact matches for Better Auth's documented verification error codes.
|
|
13
|
+
if (normalized === "expired_token")
|
|
14
|
+
return "expired";
|
|
15
|
+
if (normalized === "invalid_token")
|
|
16
|
+
return "invalid";
|
|
17
|
+
if (normalized === "already_verified" || normalized === "email_already_verified")
|
|
18
|
+
return "already-verified";
|
|
19
|
+
// Loose fallbacks for close variants. Order matters — check "already" before
|
|
20
|
+
// "verified" so `email_already_verified` maps to already-verified, not invalid.
|
|
21
|
+
if (normalized.includes("expired"))
|
|
22
|
+
return "expired";
|
|
23
|
+
if (normalized.includes("already"))
|
|
24
|
+
return "already-verified";
|
|
25
|
+
if (normalized.includes("invalid"))
|
|
26
|
+
return "invalid";
|
|
27
|
+
return "error";
|
|
28
|
+
}
|
|
29
|
+
const COPY = {
|
|
30
|
+
success: {
|
|
31
|
+
title: "Email verified",
|
|
32
|
+
message: "Your email is confirmed. You can now sign in to your account.",
|
|
33
|
+
},
|
|
34
|
+
expired: {
|
|
35
|
+
title: "Link expired",
|
|
36
|
+
message: "This verification link has expired. Request a new one from the sign-in page.",
|
|
37
|
+
},
|
|
38
|
+
invalid: {
|
|
39
|
+
title: "Invalid link",
|
|
40
|
+
message: "This verification link is invalid or has already been used. Try signing in or request a new link.",
|
|
41
|
+
},
|
|
42
|
+
"already-verified": {
|
|
43
|
+
title: "Already verified",
|
|
44
|
+
message: "Your email was already confirmed. You can sign in now.",
|
|
45
|
+
},
|
|
46
|
+
error: {
|
|
47
|
+
title: "Verification failed",
|
|
48
|
+
message: "We couldn't verify your email. Request a new link from the sign-in page.",
|
|
49
|
+
},
|
|
50
|
+
};
|
|
51
|
+
/**
|
|
52
|
+
* Standalone email-verification confirmation page. Render on the route you
|
|
53
|
+
* set as `callbackURL` when calling `betterAuthClient.sendVerificationEmail`
|
|
54
|
+
* (or the `verifyCallbackURL` arg on `useBetterAuth().signUpWithEmail`).
|
|
55
|
+
*
|
|
56
|
+
* Better Auth verifies the token server-side before redirecting here. This
|
|
57
|
+
* component only displays the outcome based on the `?error=` query param.
|
|
58
|
+
*
|
|
59
|
+
* Usage:
|
|
60
|
+
* ```tsx
|
|
61
|
+
* const error = new URLSearchParams(window.location.search).get("error");
|
|
62
|
+
* <BetterAuthVerifyEmail
|
|
63
|
+
* errorCode={error}
|
|
64
|
+
* onGoToSignIn={() => router.push("/login")}
|
|
65
|
+
* />
|
|
66
|
+
* ```
|
|
67
|
+
*/
|
|
68
|
+
function BetterAuthVerifyEmail({ errorCode, onGoToSignIn, signInHref = "/login", successTitle, successMessage, className, }) {
|
|
69
|
+
const state = classifyError(errorCode);
|
|
70
|
+
const isSuccess = state === "success" || state === "already-verified";
|
|
71
|
+
const copy = COPY[state];
|
|
72
|
+
const title = isSuccess && successTitle ? successTitle : copy.title;
|
|
73
|
+
const message = isSuccess && successMessage ? successMessage : copy.message;
|
|
74
|
+
debug("Rendering verify-email state", { state, errorCode });
|
|
75
|
+
const handleClick = () => {
|
|
76
|
+
if (onGoToSignIn) {
|
|
77
|
+
onGoToSignIn();
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
if (typeof window !== "undefined") {
|
|
81
|
+
window.location.href = signInHref;
|
|
82
|
+
}
|
|
83
|
+
};
|
|
84
|
+
return ((0, jsx_runtime_1.jsx)("div", { className: `w-full max-w-[400px] px-6 ${className || ""}`, children: (0, jsx_runtime_1.jsxs)("div", { className: "space-y-6 text-center", children: [(0, jsx_runtime_1.jsx)("div", { className: `mx-auto flex h-12 w-12 items-center justify-center rounded-full ${isSuccess ? "bg-green-100" : "bg-red-100"}`, children: isSuccess ? ((0, jsx_runtime_1.jsx)("svg", { className: "h-6 w-6 text-green-600", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", "aria-hidden": "true", children: (0, jsx_runtime_1.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M5 13l4 4L19 7" }) })) : ((0, jsx_runtime_1.jsx)("svg", { className: "h-6 w-6 text-red-600", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", "aria-hidden": "true", children: (0, jsx_runtime_1.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M6 18L18 6M6 6l12 12" }) })) }), (0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)("h1", { className: "text-[28px] font-semibold tracking-tight text-gray-900 dark:text-gray-100", children: title }), (0, jsx_runtime_1.jsx)("p", { className: "mt-3 text-[15px] text-gray-500 dark:text-gray-400", children: message })] }), (0, jsx_runtime_1.jsx)(react_1.Button, { onClick: handleClick, className: "h-11 w-full bg-gray-900 text-[15px] font-medium text-white hover:bg-gray-800 dark:bg-white dark:text-gray-900 dark:hover:bg-gray-100", children: isSuccess ? "Go to sign in" : "Back to sign in" })] }) }));
|
|
85
|
+
}
|
|
@@ -12,10 +12,13 @@ const utils_1 = require("../../../../shared/utils");
|
|
|
12
12
|
const react_2 = require("@headlessui/react");
|
|
13
13
|
const react_3 = require("react");
|
|
14
14
|
const react_4 = require("thirdweb/react");
|
|
15
|
+
const useUser_1 = require("../../hooks/useUser");
|
|
16
|
+
const UserAvatar_1 = require("../UserAvatar/UserAvatar");
|
|
15
17
|
const ManageAccountButton_1 = require("../custom/ManageAccountButton");
|
|
16
18
|
function SignIn(props) {
|
|
17
19
|
const { className } = props;
|
|
18
|
-
const { automaticallySetFirstEoa, partnerId } = (0, react_1.useB3Config)();
|
|
20
|
+
const { automaticallySetFirstEoa, partnerId, authStrategy } = (0, react_1.useB3Config)();
|
|
21
|
+
const isBetterAuth = authStrategy === "better-auth";
|
|
19
22
|
const { address: globalAddress, ensName, connectedSmartWallet, connectedEOAWallet, isActiveSmartWallet, isActiveEOAWallet, smartWalletIcon, } = (0, react_1.useAccountWallet)();
|
|
20
23
|
const { data: walletImage } = (0, react_4.useWalletImage)(connectedEOAWallet?.id);
|
|
21
24
|
const isMobile = (0, react_1.useIsMobile)();
|
|
@@ -25,6 +28,10 @@ function SignIn(props) {
|
|
|
25
28
|
};
|
|
26
29
|
const connectedWallets = (0, react_4.useConnectedWallets)();
|
|
27
30
|
const setActiveWallet = (0, react_4.useSetActiveWallet)();
|
|
31
|
+
// Better Auth state
|
|
32
|
+
const isAuthenticated = (0, react_1.useAuthStore)(state => state.isAuthenticated);
|
|
33
|
+
const { user } = (0, useUser_1.useUser)();
|
|
34
|
+
const userDisplayName = user?.username || user?.email || "Account";
|
|
28
35
|
const handleSetActiveAccount = (selectedWalletId) => {
|
|
29
36
|
if (!selectedWalletId ||
|
|
30
37
|
!connectedWallets ||
|
|
@@ -40,12 +47,15 @@ function SignIn(props) {
|
|
|
40
47
|
setActiveWallet(connectedEOAWallet);
|
|
41
48
|
}
|
|
42
49
|
}, [connectedEOAWallet, isActiveEOAWallet, setActiveWallet, automaticallySetFirstEoa]);
|
|
50
|
+
const isLoggedIn = isBetterAuth ? isAuthenticated : !!globalAddress;
|
|
43
51
|
// Desktop version - original dropdown menu
|
|
44
|
-
return ((0, jsx_runtime_1.jsx)(react_1.StyleRoot, { children: (0, jsx_runtime_1.jsx)(react_2.Menu, { className: `relative flex items-center ${className || ""}`, as: "div", children:
|
|
52
|
+
return ((0, jsx_runtime_1.jsx)(react_1.StyleRoot, { children: (0, jsx_runtime_1.jsx)(react_2.Menu, { className: `relative flex items-center ${className || ""}`, as: "div", children: isLoggedIn ? ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsxs)(react_2.MenuButton, { className: "bg-b3-react-background group flex h-10 items-center gap-1 rounded-xl px-3 focus:outline-none", children: [isBetterAuth ? ((0, jsx_runtime_1.jsx)(UserAvatar_1.UserAvatar, { avatarUrl: user?.avatar, name: userDisplayName, size: 24 })) : (!!walletImage && ((0, jsx_runtime_1.jsx)(react_1.IPFSMediaRenderer, { src: walletImage, alt: "Wallet Image", className: "bg-b3-react-primary h-6 w-6 rounded-full object-cover opacity-100" }))), (0, jsx_runtime_1.jsx)("div", { className: "text-as-primary", children: isBetterAuth ? userDisplayName : ensName ? ensName : (0, utils_1.truncateAddress)(globalAddress ?? "") })] }), (0, jsx_runtime_1.jsx)(react_2.Transition, { enter: "duration-200 ease-out", enterFrom: "scale-95 opacity-0", enterTo: "scale-100 opacity-100", leave: "duration-300 ease-out", leaveFrom: "scale-100 opacity-100", leaveTo: "scale-95 opacity-0", children: (0, jsx_runtime_1.jsx)(react_2.MenuItems, { className: "b3-root absolute -right-4 top-full min-w-64 rounded-2xl border focus:outline-none lg:right-0", modal: false,
|
|
45
53
|
// TODO: Figure out why setting anchor on mobile causes z-index issues where it appears under elements
|
|
46
|
-
anchor: isMobile ? "top end" : undefined, children: (0, jsx_runtime_1.jsxs)("div", { className: "bg-b3-react-background", children: [
|
|
54
|
+
anchor: isMobile ? "top end" : undefined, children: (0, jsx_runtime_1.jsxs)("div", { className: "bg-b3-react-background", children: [isBetterAuth ? (
|
|
55
|
+
/* Better Auth: show user info instead of wallet switching */
|
|
56
|
+
(0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-3 rounded-xl p-3", children: [(0, jsx_runtime_1.jsx)(UserAvatar_1.UserAvatar, { avatarUrl: user?.avatar, name: userDisplayName, size: 48 }), (0, jsx_runtime_1.jsxs)("div", { className: "flex flex-col gap-0.5", children: [user?.username && (0, jsx_runtime_1.jsx)("div", { className: "text-b3-react-primary font-semibold", children: user.username }), user?.email && (0, jsx_runtime_1.jsx)("div", { className: "text-b3-react-secondary text-sm", children: user.email })] })] })) : connectedEOAWallet ? ((0, jsx_runtime_1.jsxs)("div", { className: (0, utils_1.cn)("border-b3-react-subtle bg-b3-react-background flex cursor-pointer items-center justify-between rounded-xl p-3"), onClick: () => handleSetActiveAccount(connectedEOAWallet?.id), children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex items-center", children: [(0, jsx_runtime_1.jsx)("img", { className: "bg-b3-react-primary h-16 w-16 rounded-full opacity-100", src: walletImage, alt: connectedEOAWallet?.id }), (0, jsx_runtime_1.jsxs)("div", { className: "ml-4 grow", children: [ensName && (0, jsx_runtime_1.jsx)("div", { children: ensName }), (0, jsx_runtime_1.jsx)("div", { children: (0, utils_1.truncateAddress)(globalAddress ?? "") })] })] }), isActiveEOAWallet && (0, jsx_runtime_1.jsx)(Icon_1.default, { className: "fill-b3-react-primary", name: "check" })] })) : (connectedSmartWallet && ((0, jsx_runtime_1.jsxs)("div", { className: (0, utils_1.cn)("mb-2 flex cursor-pointer items-center justify-between rounded-xl p-3", isActiveSmartWallet
|
|
47
57
|
? "bg-b3-react-background"
|
|
48
|
-
: "bg-b3-react-background hover:bg-b3-react-background"), onClick: () => handleSetActiveAccount(connectedSmartWallet?.id), children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex items-center", children: [(0, jsx_runtime_1.jsx)("img", { className: "bg-b3-react-primary h-16 w-16 rounded-full opacity-100", src: smartWalletIcon, alt: connectedSmartWallet?.id }), (0, jsx_runtime_1.jsxs)("div", { className: "grow pl-4", children: [ensName && (0, jsx_runtime_1.jsx)("div", { children: ensName }), (0, jsx_runtime_1.jsx)("div", { children: (0, utils_1.truncateAddress)(globalAddress) }), (0, jsx_runtime_1.jsx)("div", { children: "Smart wallet" })] })] }), isActiveSmartWallet && (0, jsx_runtime_1.jsx)(Icon_1.default, { className: "fill-b3-react-primary", name: "check" })] }))), (0, jsx_runtime_1.jsx)("div", { className: "ml-3", children: (0, jsx_runtime_1.jsx)(ManageAccountButton_1.ManageAccountButton, { ...props, className: "w-[calc(100%-12px)]" }) }), (0, jsx_runtime_1.jsx)("button", { className: "mb-2 w-full space-y-1", onClick: onDisconnect, children: (0, jsx_runtime_1.jsxs)("div", { className: "hover:bg-b3-react-background group flex h-12 items-center rounded-xl px-4 transition-colors", children: [(0, jsx_runtime_1.jsx)(Icon_1.default, { className: "fill-b3-react-primary mr-4 shrink-0 transition-colors", name: "logout" }), (0, jsx_runtime_1.jsx)("div", { className: "text-b3-react-primary mr-auto transition-colors", children: "Disconnect" })] }) })] }) }) })] })) : ((0, jsx_runtime_1.jsx)(react_1.SignInWithB3, { closeAfterLogin: true, onLoginSuccess: async (globalAccount) => {
|
|
58
|
+
: "bg-b3-react-background hover:bg-b3-react-background"), onClick: () => handleSetActiveAccount(connectedSmartWallet?.id), children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex items-center", children: [(0, jsx_runtime_1.jsx)("img", { className: "bg-b3-react-primary h-16 w-16 rounded-full opacity-100", src: smartWalletIcon, alt: connectedSmartWallet?.id }), (0, jsx_runtime_1.jsxs)("div", { className: "grow pl-4", children: [ensName && (0, jsx_runtime_1.jsx)("div", { children: ensName }), (0, jsx_runtime_1.jsx)("div", { children: (0, utils_1.truncateAddress)(globalAddress ?? "") }), (0, jsx_runtime_1.jsx)("div", { children: "Smart wallet" })] })] }), isActiveSmartWallet && (0, jsx_runtime_1.jsx)(Icon_1.default, { className: "fill-b3-react-primary", name: "check" })] }))), (0, jsx_runtime_1.jsx)("div", { className: "ml-3", children: (0, jsx_runtime_1.jsx)(ManageAccountButton_1.ManageAccountButton, { ...props, className: "w-[calc(100%-12px)]" }) }), (0, jsx_runtime_1.jsx)("button", { className: "mb-2 w-full space-y-1", onClick: onDisconnect, children: (0, jsx_runtime_1.jsxs)("div", { className: "hover:bg-b3-react-background group flex h-12 items-center rounded-xl px-4 transition-colors", children: [(0, jsx_runtime_1.jsx)(Icon_1.default, { className: "fill-b3-react-primary mr-4 shrink-0 transition-colors", name: "logout" }), (0, jsx_runtime_1.jsx)("div", { className: "text-b3-react-primary mr-auto transition-colors", children: isBetterAuth ? "Sign out" : "Disconnect" })] }) })] }) }) })] })) : ((0, jsx_runtime_1.jsx)(react_1.SignInWithB3, { closeAfterLogin: true, onLoginSuccess: async (globalAccount) => {
|
|
49
59
|
console.log("User authenticated with Global Account!", globalAccount);
|
|
50
60
|
}, ...props })) }) }));
|
|
51
61
|
}
|
|
@@ -3,4 +3,4 @@ import { SignInWithB3ModalProps } from "../../../../global-account/react";
|
|
|
3
3
|
* Component that manages the authentication flow for Sign In With B3
|
|
4
4
|
* Handles different login providers, authentication steps, and session key management
|
|
5
5
|
*/
|
|
6
|
-
export declare function SignInWithB3Flow({ strategies, onLoginSuccess, onSessionKeySuccess, onError, chain, sessionKeyAddress, partnerId, closeAfterLogin, source, signersEnabled, }: SignInWithB3ModalProps): import("react/jsx-runtime").JSX.Element | null;
|
|
6
|
+
export declare function SignInWithB3Flow({ strategies, onLoginSuccess, onSessionKeySuccess, onError, chain, sessionKeyAddress, partnerId, closeAfterLogin, source, signersEnabled, verifyEmailRedirectTo, }: SignInWithB3ModalProps): import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -16,7 +16,7 @@ const MAX_REFETCH_ATTEMPTS = 20;
|
|
|
16
16
|
* Component that manages the authentication flow for Sign In With B3
|
|
17
17
|
* Handles different login providers, authentication steps, and session key management
|
|
18
18
|
*/
|
|
19
|
-
function SignInWithB3Flow({ strategies, onLoginSuccess, onSessionKeySuccess, onError, chain, sessionKeyAddress, partnerId, closeAfterLogin = false, source = "signInWithB3Button", signersEnabled = false, }) {
|
|
19
|
+
function SignInWithB3Flow({ strategies, onLoginSuccess, onSessionKeySuccess, onError, chain, sessionKeyAddress, partnerId, closeAfterLogin = false, source = "signInWithB3Button", signersEnabled = false, verifyEmailRedirectTo, }) {
|
|
20
20
|
const { automaticallySetFirstEoa, authStrategy } = (0, react_1.useB3Config)();
|
|
21
21
|
// skipAutoConnect: this component intentionally logs out on mount to show a fresh login screen.
|
|
22
22
|
// AuthenticationProvider is the sole owner of useAutoConnect to avoid competing auth cycles.
|
|
@@ -247,7 +247,7 @@ function SignInWithB3Flow({ strategies, onLoginSuccess, onSessionKeySuccess, onE
|
|
|
247
247
|
// Better Auth manages its own loading/verification states internally.
|
|
248
248
|
// Don't gate on isAuthenticating — it would unmount the component
|
|
249
249
|
// and lose verification state when setIsAuthenticating(false) fires.
|
|
250
|
-
content = (0, jsx_runtime_1.jsx)(LoginStepBetterAuth_1.LoginStepBetterAuth, { onSuccess: () => handleLoginSuccess({}), onError: onError });
|
|
250
|
+
content = ((0, jsx_runtime_1.jsx)(LoginStepBetterAuth_1.LoginStepBetterAuth, { onSuccess: () => handleLoginSuccess({}), onError: onError, verifyEmailRedirectTo: verifyEmailRedirectTo }));
|
|
251
251
|
}
|
|
252
252
|
else if (!readyToShowLogin || isAuthenticating || isFetchingSigners) {
|
|
253
253
|
content = ((0, jsx_runtime_1.jsx)(LoginStep_1.LoginStepContainer, { partnerId: partnerId, children: (0, jsx_runtime_1.jsx)("div", { className: "my-8 flex min-h-[350px] items-center justify-center", children: (0, jsx_runtime_1.jsx)(react_1.Loading, { variant: "white", size: "lg" }) }) }));
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
interface PasswordInputProps {
|
|
2
|
+
value: string;
|
|
3
|
+
onChange: (e: React.ChangeEvent<HTMLInputElement>) => void;
|
|
4
|
+
disabled?: boolean;
|
|
5
|
+
placeholder?: string;
|
|
6
|
+
onKeyDown?: (e: React.KeyboardEvent<HTMLInputElement>) => void;
|
|
7
|
+
className?: string;
|
|
8
|
+
}
|
|
9
|
+
export declare function PasswordInput({ value, onChange, disabled, placeholder, onKeyDown, className, }: PasswordInputProps): import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PasswordInput = PasswordInput;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const react_1 = require("../../../../../global-account/react");
|
|
6
|
+
const react_2 = require("react");
|
|
7
|
+
function PasswordInput({ value, onChange, disabled, placeholder = "Password", onKeyDown, className, }) {
|
|
8
|
+
const [showPassword, setShowPassword] = (0, react_2.useState)(false);
|
|
9
|
+
return ((0, jsx_runtime_1.jsxs)("div", { className: "relative", children: [(0, jsx_runtime_1.jsx)(react_1.Input, { type: showPassword ? "text" : "password", placeholder: placeholder, value: value, onChange: onChange, disabled: disabled, onKeyDown: onKeyDown, className: className }), (0, jsx_runtime_1.jsx)("button", { type: "button", onClick: () => setShowPassword(!showPassword), "aria-label": showPassword ? "Hide password" : "Show password", className: "absolute right-3 top-1/2 -translate-y-1/2 text-gray-400 hover:text-gray-600 dark:text-gray-500 dark:hover:text-gray-300", tabIndex: -1, children: showPassword ? ((0, jsx_runtime_1.jsx)("svg", { className: "h-5 w-5", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", strokeWidth: 1.5, children: (0, jsx_runtime_1.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M3.98 8.223A10.477 10.477 0 001.934 12C3.226 16.338 7.244 19.5 12 19.5c.993 0 1.953-.138 2.863-.395M6.228 6.228A10.45 10.45 0 0112 4.5c4.756 0 8.773 3.162 10.065 7.498a10.523 10.523 0 01-4.293 5.774M6.228 6.228L3 3m3.228 3.228l3.65 3.65m7.894 7.894L21 21m-3.228-3.228l-3.65-3.65m0 0a3 3 0 10-4.243-4.243m4.242 4.242L9.88 9.88" }) })) : ((0, jsx_runtime_1.jsxs)("svg", { className: "h-5 w-5", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", strokeWidth: 1.5, children: [(0, jsx_runtime_1.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M2.036 12.322a1.012 1.012 0 010-.639C3.423 7.51 7.36 4.5 12 4.5c4.638 0 8.573 3.007 9.963 7.178.07.207.07.431 0 .639C20.577 16.49 16.64 19.5 12 19.5c-4.638 0-8.573-3.007-9.963-7.178z" }), (0, jsx_runtime_1.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M15 12a3 3 0 11-6 0 3 3 0 016 0z" })] })) })] }));
|
|
10
|
+
}
|
package/dist/cjs/global-account/react/components/SignInWithB3/steps/LoginStepBetterAuth.d.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
interface LoginStepBetterAuthProps {
|
|
2
2
|
onSuccess?: () => void;
|
|
3
3
|
onError?: (error: Error) => Promise<void>;
|
|
4
|
+
/** URL Better Auth redirects to after server-side email verification. */
|
|
5
|
+
verifyEmailRedirectTo?: string;
|
|
4
6
|
}
|
|
5
|
-
export declare function LoginStepBetterAuth({ onSuccess, onError }: LoginStepBetterAuthProps): import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
export declare function LoginStepBetterAuth({ onSuccess, onError, verifyEmailRedirectTo }: LoginStepBetterAuthProps): import("react/jsx-runtime").JSX.Element;
|
|
6
8
|
export {};
|
|
@@ -7,6 +7,7 @@ const debug_1 = require("../../../../../shared/utils/debug");
|
|
|
7
7
|
const react_2 = require("react");
|
|
8
8
|
const useBetterAuth_1 = require("../../../hooks/useBetterAuth");
|
|
9
9
|
const AuthButton_1 = require("../components/AuthButton");
|
|
10
|
+
const PasswordInput_1 = require("../components/PasswordInput");
|
|
10
11
|
const debug = (0, debug_1.debugB3React)("LoginStepBetterAuth");
|
|
11
12
|
const EMAIL_REGEX = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
|
|
12
13
|
const SOCIAL_PROVIDERS = [
|
|
@@ -16,7 +17,7 @@ const SOCIAL_PROVIDERS = [
|
|
|
16
17
|
{ id: "microsoft", label: "Microsoft" },
|
|
17
18
|
{ id: "slack", label: "Slack" },
|
|
18
19
|
];
|
|
19
|
-
function LoginStepBetterAuth({ onSuccess, onError }) {
|
|
20
|
+
function LoginStepBetterAuth({ onSuccess, onError, verifyEmailRedirectTo }) {
|
|
20
21
|
const { partnerId } = (0, react_1.useB3Config)();
|
|
21
22
|
const { signInWithEmail, signUpWithEmail, signInWithSocial, requestPasswordReset } = (0, useBetterAuth_1.useBetterAuth)();
|
|
22
23
|
const [mode, setMode] = (0, react_2.useState)("sign-in");
|
|
@@ -47,7 +48,7 @@ function LoginStepBetterAuth({ onSuccess, onError }) {
|
|
|
47
48
|
setError(null);
|
|
48
49
|
if (mode === "sign-up") {
|
|
49
50
|
debug("Signing up", { email: normalizedEmail, name: name.trim() });
|
|
50
|
-
await signUpWithEmail(normalizedEmail, password, name.trim());
|
|
51
|
+
await signUpWithEmail(normalizedEmail, password, name.trim(), verifyEmailRedirectTo);
|
|
51
52
|
}
|
|
52
53
|
else {
|
|
53
54
|
debug("Signing in", { email: normalizedEmail });
|
|
@@ -114,7 +115,9 @@ function LoginStepBetterAuth({ onSuccess, onError }) {
|
|
|
114
115
|
setPassword("");
|
|
115
116
|
}, className: "text-sm text-gray-500 hover:text-gray-700 dark:text-gray-400 dark:hover:text-gray-300", children: "Back to sign in" })] }) }));
|
|
116
117
|
}
|
|
117
|
-
return ((0, jsx_runtime_1.jsx)(react_1.LoginStepContainer, { partnerId: partnerId, children: mode === "forgot-password" ? ((0, jsx_runtime_1.jsxs)("div", { className: "mb-6 w-full space-y-3 px-3", children: [(0, jsx_runtime_1.jsx)("p", { className: "text-center text-sm font-medium text-gray-900 dark:text-gray-100", children: "Reset password" }), (0, jsx_runtime_1.jsx)("p", { className: "text-center text-xs text-gray-500", children:
|
|
118
|
+
return ((0, jsx_runtime_1.jsx)(react_1.LoginStepContainer, { partnerId: partnerId, children: mode === "forgot-password" ? ((0, jsx_runtime_1.jsxs)("div", { className: "mb-6 w-full space-y-3 px-3", children: [(0, jsx_runtime_1.jsx)("p", { className: "text-center text-sm font-medium text-gray-900 dark:text-gray-100", children: "Reset password" }), (0, jsx_runtime_1.jsx)("p", { className: "text-center text-xs text-gray-500", children: resetEmailSent
|
|
119
|
+
? "We've sent a password reset link to your email"
|
|
120
|
+
: "Enter your email and we'll send you a reset link" }), resetEmailSent ? ((0, jsx_runtime_1.jsx)("div", { className: "space-y-3 py-4 text-center", children: (0, jsx_runtime_1.jsx)("p", { className: "text-sm text-green-600", children: "Check your email for a reset link." }) })) : ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(react_1.Input, { type: "email", placeholder: "you@example.com", value: email, onChange: event => setEmail(event.target.value), disabled: isLoading, onKeyDown: event => {
|
|
118
121
|
if (event.key === "Enter")
|
|
119
122
|
handleForgotPassword();
|
|
120
123
|
} }), error && (0, jsx_runtime_1.jsx)("p", { className: "text-sm text-red-500", children: error }), (0, jsx_runtime_1.jsx)(react_1.Button, { onClick: handleForgotPassword, disabled: isLoading, className: "w-full", children: isLoading ? "Sending..." : "Send reset link" })] })), (0, jsx_runtime_1.jsx)("button", { onClick: () => {
|
|
@@ -122,10 +125,10 @@ function LoginStepBetterAuth({ onSuccess, onError }) {
|
|
|
122
125
|
setShowEmailForm(true);
|
|
123
126
|
setError(null);
|
|
124
127
|
setResetEmailSent(false);
|
|
125
|
-
}, className: "w-full text-center text-sm text-gray-500 hover:text-gray-700", children: "Back to sign in" })] })) : showEmailForm ? ((0, jsx_runtime_1.jsxs)("div", { className: "mb-6 w-full space-y-3 px-3", children: [(0, jsx_runtime_1.jsx)("p", { className: "text-center text-sm font-medium text-gray-900 dark:text-gray-100", children: mode === "sign-in" ? "Sign in with email" : "Create an account" }), mode === "sign-up" && ((0, jsx_runtime_1.jsx)(react_1.Input, { type: "text", placeholder: "Your name", value: name, onChange: event => setName(event.target.value), disabled: isLoading })), (0, jsx_runtime_1.jsx)(react_1.Input, { type: "email", placeholder: "you@example.com", value: email, onChange: event => setEmail(event.target.value), disabled: isLoading }), (0, jsx_runtime_1.jsx)(
|
|
128
|
+
}, className: "w-full text-center text-sm text-gray-500 hover:text-gray-700", children: "Back to sign in" })] })) : showEmailForm ? ((0, jsx_runtime_1.jsxs)("div", { className: "mb-6 w-full space-y-3 px-3", children: [(0, jsx_runtime_1.jsx)("p", { className: "text-center text-sm font-medium text-gray-900 dark:text-gray-100", children: mode === "sign-in" ? "Sign in with email" : "Create an account" }), mode === "sign-up" && ((0, jsx_runtime_1.jsx)(react_1.Input, { type: "text", placeholder: "Your name", value: name, onChange: event => setName(event.target.value), disabled: isLoading })), (0, jsx_runtime_1.jsx)(react_1.Input, { type: "email", placeholder: "you@example.com", value: email, onChange: event => setEmail(event.target.value), disabled: isLoading }), (0, jsx_runtime_1.jsx)(PasswordInput_1.PasswordInput, { value: password, onChange: event => setPassword(event.target.value), disabled: isLoading, onKeyDown: event => {
|
|
126
129
|
if (event.key === "Enter")
|
|
127
130
|
handleEmailSubmit();
|
|
128
|
-
} }), error && (0, jsx_runtime_1.jsx)("p", { className: "text-sm text-red-500", children: error }), (0, jsx_runtime_1.jsx)(react_1.Button, { onClick: handleEmailSubmit, disabled: isLoading, className: "w-full", children: isLoading ? "Loading..." : mode === "sign-in" ? "Sign in" : "Sign up" }), mode === "sign-in" && ((0, jsx_runtime_1.jsx)("button", { onClick: () => {
|
|
131
|
+
}, className: "pr-11" }, mode), error && (0, jsx_runtime_1.jsx)("p", { className: "text-sm text-red-500", children: error }), (0, jsx_runtime_1.jsx)(react_1.Button, { onClick: handleEmailSubmit, disabled: isLoading, className: "w-full", children: isLoading ? "Loading..." : mode === "sign-in" ? "Sign in" : "Sign up" }), mode === "sign-in" && ((0, jsx_runtime_1.jsx)("button", { onClick: () => {
|
|
129
132
|
setMode("forgot-password");
|
|
130
133
|
setError(null);
|
|
131
134
|
}, disabled: isLoading, className: "w-full text-center text-xs text-gray-500 hover:text-gray-700", children: "Forgot password?" })), (0, jsx_runtime_1.jsx)("button", { onClick: () => {
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
interface UserAvatarProps {
|
|
2
|
+
/** Direct avatar URL (IPFS or HTTP). Resolved and validated internally. */
|
|
3
|
+
avatarUrl?: string | null;
|
|
4
|
+
/** Seed for the generated fallback avatar + alt text. Use email, username, or address. */
|
|
5
|
+
name?: string;
|
|
6
|
+
/** Avatar size in pixels (square). */
|
|
7
|
+
size?: number;
|
|
8
|
+
/** Additional className for the outer container. */
|
|
9
|
+
className?: string;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Renders a user avatar with IPFS support and boring-avatars fallback.
|
|
13
|
+
*
|
|
14
|
+
* - If `avatarUrl` is provided and valid, renders via IPFSMediaRenderer.
|
|
15
|
+
* - On load failure or missing URL, falls back to a deterministic boring-avatars beam.
|
|
16
|
+
*/
|
|
17
|
+
export declare function UserAvatar({ avatarUrl, name, size, className }: UserAvatarProps): import("react/jsx-runtime").JSX.Element;
|
|
18
|
+
export {};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.UserAvatar = UserAvatar;
|
|
7
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
8
|
+
const profileDisplay_1 = require("../../../../global-account/react/utils/profileDisplay");
|
|
9
|
+
const constants_1 = require("../../../../shared/constants");
|
|
10
|
+
const boring_avatars_1 = __importDefault(require("boring-avatars"));
|
|
11
|
+
const react_1 = require("react");
|
|
12
|
+
const IPFSMediaRenderer_1 = require("../IPFSMediaRenderer/IPFSMediaRenderer");
|
|
13
|
+
/**
|
|
14
|
+
* Renders a user avatar with IPFS support and boring-avatars fallback.
|
|
15
|
+
*
|
|
16
|
+
* - If `avatarUrl` is provided and valid, renders via IPFSMediaRenderer.
|
|
17
|
+
* - On load failure or missing URL, falls back to a deterministic boring-avatars beam.
|
|
18
|
+
*/
|
|
19
|
+
function UserAvatar({ avatarUrl, name = "user", size = 40, className }) {
|
|
20
|
+
const resolvedSrc = (0, profileDisplay_1.validateImageUrl)(avatarUrl);
|
|
21
|
+
const [imgError, setImgError] = (0, react_1.useState)(false);
|
|
22
|
+
(0, react_1.useEffect)(() => {
|
|
23
|
+
setImgError(false);
|
|
24
|
+
}, [avatarUrl]);
|
|
25
|
+
const handleImgError = (0, react_1.useCallback)(() => setImgError(true), []);
|
|
26
|
+
return ((0, jsx_runtime_1.jsx)("div", { className: className, style: { width: size, height: size, minWidth: size, minHeight: size }, children: resolvedSrc && !imgError ? ((0, jsx_runtime_1.jsx)("div", { onErrorCapture: handleImgError, className: "h-full w-full overflow-hidden rounded-full", children: (0, jsx_runtime_1.jsx)(IPFSMediaRenderer_1.IPFSMediaRenderer, { src: resolvedSrc, alt: name, className: "h-full w-full object-cover" }) })) : ((0, jsx_runtime_1.jsx)(boring_avatars_1.default, { name: name, variant: "beam", size: size, colors: constants_1.AVATAR_COLORS })) }));
|
|
27
|
+
}
|
|
@@ -5,9 +5,11 @@ export { RelayKitProviderWrapper } from "./B3Provider/RelayKitProviderWrapper";
|
|
|
5
5
|
export { useB3 } from "./B3Provider/useB3";
|
|
6
6
|
export { useB3Account } from "./B3Provider/useB3Account";
|
|
7
7
|
export { useB3Config } from "./B3Provider/useB3Config";
|
|
8
|
+
export { useBetterAuthClient } from "./B3Provider/BetterAuthClientProvider";
|
|
8
9
|
export { StyleRoot } from "./StyleRoot";
|
|
9
10
|
export { BetterAuthResetPassword, type BetterAuthResetPasswordProps } from "./SignInWithB3/BetterAuthResetPassword";
|
|
10
11
|
export { BetterAuthSignIn, type BetterAuthSignInProps } from "./SignInWithB3/BetterAuthSignIn";
|
|
12
|
+
export { BetterAuthVerifyEmail, type BetterAuthVerifyEmailProps, type BetterAuthVerifyEmailState, } from "./SignInWithB3/BetterAuthVerifyEmail";
|
|
11
13
|
export { AuthButton } from "./SignInWithB3/components/AuthButton";
|
|
12
14
|
export { PermissionItem } from "./SignInWithB3/components/PermissionItem";
|
|
13
15
|
export { WalletRow } from "./SignInWithB3/components/WalletRow";
|
|
@@ -17,6 +19,7 @@ export { SignInWithB3Privy } from "./SignInWithB3/SignInWithB3Privy";
|
|
|
17
19
|
export { LoginStepContainer } from "./SignInWithB3/steps/LoginStep";
|
|
18
20
|
export { getConnectOptionsFromStrategy, isWalletType, type AllowedStrategy } from "./SignInWithB3/utils/signInUtils";
|
|
19
21
|
export { ManageAccount } from "./ManageAccount/ManageAccount";
|
|
22
|
+
export { UserAvatar } from "./UserAvatar/UserAvatar";
|
|
20
23
|
export { Deposit } from "./Deposit/Deposit";
|
|
21
24
|
export { Send } from "./Send/Send";
|
|
22
25
|
export { IPFSMediaRenderer } from "./IPFSMediaRenderer/IPFSMediaRenderer";
|
|
@@ -3,9 +3,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.
|
|
7
|
-
exports.
|
|
8
|
-
exports.WalletImage = exports.useToastContext = exports.ToastProvider = exports.ToastContainer = exports.Toast = exports.toast = exports.AnimatedLottie = void 0;
|
|
6
|
+
exports.CommandSeparator = exports.CommandList = exports.CommandItem = exports.CommandInput = exports.CommandGroup = exports.CommandEmpty = exports.CommandDialog = exports.Command = exports.buttonVariants = exports.Button = exports.badgeVariants = exports.Badge = exports.WalletConnectorIcon = exports.StaggeredFadeLoader = exports.CopyToClipboard = exports.ClientOnly = exports.customButtonVariants = exports.CustomButton = exports.SingleUserSearchSelector = exports.SendERC20Button = exports.SendETHButton = exports.MintButton = exports.AccountAssets = exports.RequestPermissionsButton = exports.RequestPermissions = exports.IPFSMediaRenderer = exports.Send = exports.Deposit = exports.UserAvatar = exports.ManageAccount = exports.isWalletType = exports.getConnectOptionsFromStrategy = exports.LoginStepContainer = exports.SignInWithB3Privy = exports.SignInWithB3Flow = exports.SignInWithB3 = exports.WalletRow = exports.PermissionItem = exports.AuthButton = exports.BetterAuthVerifyEmail = exports.BetterAuthSignIn = exports.BetterAuthResetPassword = exports.StyleRoot = exports.useBetterAuthClient = exports.useB3Config = exports.useB3Account = exports.useB3 = exports.RelayKitProviderWrapper = exports.B3Provider = exports.B3DynamicModal = void 0;
|
|
7
|
+
exports.TooltipContent = exports.Tooltip = exports.TextShimmer = exports.TextLoop = exports.TabTrigger = exports.TabsTransitionWrapper = exports.TabsList = exports.TabsContent = exports.Tabs = exports.TabTriggerPrimitive = exports.TabsPrimitive = exports.TabsListPrimitive = exports.TabsContentPrimitive = exports.Skeleton = exports.ShinyButton = exports.ScrollBar = exports.ScrollArea = exports.PopoverTrigger = exports.PopoverContent = exports.Popover = exports.Loading = exports.Input = exports.GlareCardRounded = exports.GlareCard = exports.DropdownMenuTrigger = exports.DropdownMenuSeparator = exports.DropdownMenuItem = exports.DropdownMenuContent = exports.DropdownMenu = exports.DrawerTrigger = exports.DrawerTitle = exports.DrawerPortal = exports.DrawerOverlay = exports.DrawerHeader = exports.DrawerFooter = exports.DrawerDescription = exports.DrawerContent = exports.DrawerClose = exports.Drawer = exports.DialogTrigger = exports.DialogTitle = exports.DialogPortal = exports.DialogOverlay = exports.DialogHeader = exports.DialogFooter = exports.DialogDescription = exports.DialogContent = exports.DialogClose = exports.Dialog = exports.CommandShortcut = void 0;
|
|
8
|
+
exports.WalletImage = exports.useToastContext = exports.ToastProvider = exports.ToastContainer = exports.Toast = exports.toast = exports.AnimatedLottie = exports.TransitionPanel = exports.TooltipTrigger = exports.TooltipProvider = void 0;
|
|
9
9
|
// TODO woj: Barrel file for all components, this might be reason of bundle size issues
|
|
10
10
|
// Core Components
|
|
11
11
|
var B3DynamicModal_1 = require("./B3DynamicModal");
|
|
@@ -20,6 +20,8 @@ var useB3Account_1 = require("./B3Provider/useB3Account");
|
|
|
20
20
|
Object.defineProperty(exports, "useB3Account", { enumerable: true, get: function () { return useB3Account_1.useB3Account; } });
|
|
21
21
|
var useB3Config_1 = require("./B3Provider/useB3Config");
|
|
22
22
|
Object.defineProperty(exports, "useB3Config", { enumerable: true, get: function () { return useB3Config_1.useB3Config; } });
|
|
23
|
+
var BetterAuthClientProvider_1 = require("./B3Provider/BetterAuthClientProvider");
|
|
24
|
+
Object.defineProperty(exports, "useBetterAuthClient", { enumerable: true, get: function () { return BetterAuthClientProvider_1.useBetterAuthClient; } });
|
|
23
25
|
var StyleRoot_1 = require("./StyleRoot");
|
|
24
26
|
Object.defineProperty(exports, "StyleRoot", { enumerable: true, get: function () { return StyleRoot_1.StyleRoot; } });
|
|
25
27
|
// SignInWithB3 Components
|
|
@@ -27,6 +29,8 @@ var BetterAuthResetPassword_1 = require("./SignInWithB3/BetterAuthResetPassword"
|
|
|
27
29
|
Object.defineProperty(exports, "BetterAuthResetPassword", { enumerable: true, get: function () { return BetterAuthResetPassword_1.BetterAuthResetPassword; } });
|
|
28
30
|
var BetterAuthSignIn_1 = require("./SignInWithB3/BetterAuthSignIn");
|
|
29
31
|
Object.defineProperty(exports, "BetterAuthSignIn", { enumerable: true, get: function () { return BetterAuthSignIn_1.BetterAuthSignIn; } });
|
|
32
|
+
var BetterAuthVerifyEmail_1 = require("./SignInWithB3/BetterAuthVerifyEmail");
|
|
33
|
+
Object.defineProperty(exports, "BetterAuthVerifyEmail", { enumerable: true, get: function () { return BetterAuthVerifyEmail_1.BetterAuthVerifyEmail; } });
|
|
30
34
|
var AuthButton_1 = require("./SignInWithB3/components/AuthButton");
|
|
31
35
|
Object.defineProperty(exports, "AuthButton", { enumerable: true, get: function () { return AuthButton_1.AuthButton; } });
|
|
32
36
|
var PermissionItem_1 = require("./SignInWithB3/components/PermissionItem");
|
|
@@ -47,6 +51,9 @@ Object.defineProperty(exports, "isWalletType", { enumerable: true, get: function
|
|
|
47
51
|
// ManageAccount Components
|
|
48
52
|
var ManageAccount_1 = require("./ManageAccount/ManageAccount");
|
|
49
53
|
Object.defineProperty(exports, "ManageAccount", { enumerable: true, get: function () { return ManageAccount_1.ManageAccount; } });
|
|
54
|
+
// UserAvatar
|
|
55
|
+
var UserAvatar_1 = require("./UserAvatar/UserAvatar");
|
|
56
|
+
Object.defineProperty(exports, "UserAvatar", { enumerable: true, get: function () { return UserAvatar_1.UserAvatar; } });
|
|
50
57
|
// Deposit Components
|
|
51
58
|
var Deposit_1 = require("./Deposit/Deposit");
|
|
52
59
|
Object.defineProperty(exports, "Deposit", { enumerable: true, get: function () { return Deposit_1.Deposit; } });
|
|
@@ -13,7 +13,7 @@ export declare class EmailVerificationRequiredError extends Error {
|
|
|
13
13
|
*/
|
|
14
14
|
export declare function useBetterAuth(): {
|
|
15
15
|
signInWithEmail: (email: string, password: string) => Promise<import("@feathersjs/authentication").AuthenticationResult>;
|
|
16
|
-
signUpWithEmail: (email: string, password: string, name: string) => Promise<import("@feathersjs/authentication").AuthenticationResult>;
|
|
16
|
+
signUpWithEmail: (email: string, password: string, name: string, verifyCallbackURL?: string) => Promise<import("@feathersjs/authentication").AuthenticationResult>;
|
|
17
17
|
signInWithSocial: (provider: BetterAuthSocialProvider) => Promise<void>;
|
|
18
18
|
requestPasswordReset: (email: string, redirectTo?: string) => Promise<{
|
|
19
19
|
data: {
|
|
@@ -9,7 +9,7 @@ const app_1 = __importDefault(require("../../../global-account/app"));
|
|
|
9
9
|
const react_1 = require("../../../global-account/react");
|
|
10
10
|
const debug_1 = require("../../../shared/utils/debug");
|
|
11
11
|
const react_2 = require("react");
|
|
12
|
-
const
|
|
12
|
+
const BetterAuthClientProvider_1 = require("../components/B3Provider/BetterAuthClientProvider");
|
|
13
13
|
const useUserQuery_1 = require("./useUserQuery");
|
|
14
14
|
const debug = (0, debug_1.debugB3React)("useBetterAuth");
|
|
15
15
|
/** Thrown when email verification is required before the user can sign in. */
|
|
@@ -30,6 +30,7 @@ exports.EmailVerificationRequiredError = EmailVerificationRequiredError;
|
|
|
30
30
|
*/
|
|
31
31
|
function useBetterAuth() {
|
|
32
32
|
const { partnerId } = (0, react_1.useB3Config)();
|
|
33
|
+
const betterAuthClient = (0, BetterAuthClientProvider_1.useBetterAuthClient)();
|
|
33
34
|
const { setUser } = (0, useUserQuery_1.useUserQuery)();
|
|
34
35
|
const setIsAuthenticated = (0, react_1.useAuthStore)(state => state.setIsAuthenticated);
|
|
35
36
|
const setIsAuthenticating = (0, react_1.useAuthStore)(state => state.setIsAuthenticating);
|
|
@@ -57,7 +58,7 @@ function useBetterAuth() {
|
|
|
57
58
|
setHasStartedConnecting(true);
|
|
58
59
|
setIsAuthenticating(true);
|
|
59
60
|
try {
|
|
60
|
-
const result = await
|
|
61
|
+
const result = await betterAuthClient.signIn.email({ email, password });
|
|
61
62
|
if (result.error) {
|
|
62
63
|
throw new Error(result.error.message || "Sign in failed");
|
|
63
64
|
}
|
|
@@ -72,23 +73,24 @@ function useBetterAuth() {
|
|
|
72
73
|
debug("Sign in failed", error);
|
|
73
74
|
throw error;
|
|
74
75
|
}
|
|
75
|
-
}, [exchangeForFeathersJWT, setIsAuthenticating, setHasStartedConnecting]);
|
|
76
|
-
const signUpWithEmail = (0, react_2.useCallback)(async (email, password, name) => {
|
|
76
|
+
}, [exchangeForFeathersJWT, setIsAuthenticating, setHasStartedConnecting, betterAuthClient]);
|
|
77
|
+
const signUpWithEmail = (0, react_2.useCallback)(async (email, password, name, verifyCallbackURL) => {
|
|
77
78
|
debug("Signing up with email", { email, name });
|
|
78
79
|
setHasStartedConnecting(true);
|
|
79
80
|
setIsAuthenticating(true);
|
|
80
81
|
try {
|
|
81
|
-
const result = await
|
|
82
|
+
const result = await betterAuthClient.signUp.email({ email, password, name });
|
|
82
83
|
if (result.error) {
|
|
83
84
|
throw new Error(result.error.message || "Sign up failed");
|
|
84
85
|
}
|
|
85
86
|
const token = result.data?.token;
|
|
86
87
|
if (!token) {
|
|
87
|
-
// requireEmailVerification is enabled — send verification email
|
|
88
|
-
//
|
|
89
|
-
|
|
88
|
+
// requireEmailVerification is enabled — send verification email with
|
|
89
|
+
// a callbackURL Better Auth redirects to after server-side verify.
|
|
90
|
+
// Pass verifyCallbackURL to land on a dedicated confirmation page.
|
|
91
|
+
await betterAuthClient.sendVerificationEmail({
|
|
90
92
|
email,
|
|
91
|
-
callbackURL: `${window.location.origin}?authStrategy=better-auth`,
|
|
93
|
+
callbackURL: verifyCallbackURL || `${window.location.origin}?authStrategy=better-auth`,
|
|
92
94
|
});
|
|
93
95
|
throw new EmailVerificationRequiredError();
|
|
94
96
|
}
|
|
@@ -99,13 +101,13 @@ function useBetterAuth() {
|
|
|
99
101
|
debug("Sign up failed", error);
|
|
100
102
|
throw error;
|
|
101
103
|
}
|
|
102
|
-
}, [exchangeForFeathersJWT, setIsAuthenticating, setHasStartedConnecting]);
|
|
104
|
+
}, [exchangeForFeathersJWT, setIsAuthenticating, setHasStartedConnecting, betterAuthClient]);
|
|
103
105
|
const signInWithSocial = (0, react_2.useCallback)(async (provider) => {
|
|
104
106
|
debug("Signing in with social provider", { provider });
|
|
105
107
|
setHasStartedConnecting(true);
|
|
106
108
|
setIsAuthenticating(true);
|
|
107
109
|
try {
|
|
108
|
-
const result = await
|
|
110
|
+
const result = await betterAuthClient.signIn.social({
|
|
109
111
|
provider,
|
|
110
112
|
callbackURL: window.location.href,
|
|
111
113
|
});
|
|
@@ -120,10 +122,10 @@ function useBetterAuth() {
|
|
|
120
122
|
debug("Social sign in failed", error);
|
|
121
123
|
throw error;
|
|
122
124
|
}
|
|
123
|
-
}, [setIsAuthenticating, setHasStartedConnecting]);
|
|
125
|
+
}, [setIsAuthenticating, setHasStartedConnecting, betterAuthClient]);
|
|
124
126
|
const requestPasswordReset = (0, react_2.useCallback)(async (email, redirectTo) => {
|
|
125
127
|
debug("Requesting password reset", { email });
|
|
126
|
-
const result = await
|
|
128
|
+
const result = await betterAuthClient.requestPasswordReset({
|
|
127
129
|
email,
|
|
128
130
|
redirectTo,
|
|
129
131
|
});
|
|
@@ -132,10 +134,10 @@ function useBetterAuth() {
|
|
|
132
134
|
}
|
|
133
135
|
debug("Password reset email sent");
|
|
134
136
|
return result;
|
|
135
|
-
}, []);
|
|
137
|
+
}, [betterAuthClient]);
|
|
136
138
|
const resetPassword = (0, react_2.useCallback)(async (newPassword, token) => {
|
|
137
139
|
debug("Resetting password");
|
|
138
|
-
const result = await
|
|
140
|
+
const result = await betterAuthClient.resetPassword({
|
|
139
141
|
newPassword,
|
|
140
142
|
token,
|
|
141
143
|
});
|
|
@@ -144,7 +146,7 @@ function useBetterAuth() {
|
|
|
144
146
|
}
|
|
145
147
|
debug("Password reset successful");
|
|
146
148
|
return result;
|
|
147
|
-
}, []);
|
|
149
|
+
}, [betterAuthClient]);
|
|
148
150
|
return {
|
|
149
151
|
signInWithEmail,
|
|
150
152
|
signUpWithEmail,
|
|
@@ -152,6 +154,6 @@ function useBetterAuth() {
|
|
|
152
154
|
requestPasswordReset,
|
|
153
155
|
resetPassword,
|
|
154
156
|
exchangeForFeathersJWT,
|
|
155
|
-
betterAuthClient
|
|
157
|
+
betterAuthClient,
|
|
156
158
|
};
|
|
157
159
|
}
|
|
@@ -41,6 +41,8 @@ export interface SignInWithB3ModalProps extends BaseModalProps {
|
|
|
41
41
|
source?: "signInWithB3Button" | "requestPermissions";
|
|
42
42
|
/** Whether to show the signers enabled modal */
|
|
43
43
|
signersEnabled?: boolean;
|
|
44
|
+
/** URL Better Auth redirects to after server-side email verification. */
|
|
45
|
+
verifyEmailRedirectTo?: string;
|
|
44
46
|
}
|
|
45
47
|
/**
|
|
46
48
|
* Props for the Request Permissions modal
|
|
@@ -609,6 +611,8 @@ export interface AnySpendDepositModalProps extends BaseModalProps {
|
|
|
609
611
|
actionLabel?: string;
|
|
610
612
|
/** Whether to show chain selection step. Defaults to true if sourceTokenChainId is not provided */
|
|
611
613
|
showChainSelection?: boolean;
|
|
614
|
+
/** Whether to show the "Fund with Fiat" option in the deposit options list. Defaults to true */
|
|
615
|
+
showFiatOption?: boolean;
|
|
612
616
|
/** Minimum pool size for filtering tokens (default: 1,000,000) */
|
|
613
617
|
minPoolSize?: number;
|
|
614
618
|
/** Custom title for chain selection step */
|
|
@@ -16,3 +16,4 @@ export declare const CLIENT_APP_BUNDLE_ID: string;
|
|
|
16
16
|
export declare const B3_AUTH_COOKIE_NAME = "b3-auth";
|
|
17
17
|
export declare const ENS_GATEWAY_URL = "https://ens-gateway.b3.fun/";
|
|
18
18
|
export declare const PUBLIC_BASE_RPC_URL = "https://base-rpc.publicnode.com";
|
|
19
|
+
export declare const AVATAR_COLORS: string[];
|
|
@@ -14,7 +14,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.PUBLIC_BASE_RPC_URL = exports.ENS_GATEWAY_URL = exports.B3_AUTH_COOKIE_NAME = exports.CLIENT_APP_BUNDLE_ID = exports.THIRDWEB_CLIENT_ID = exports.THIRDWEB_SECRET_KEY = exports.tokenIcons = exports.ecosystemWalletId = exports.b3CoinIcon = exports.siteURL = void 0;
|
|
17
|
+
exports.AVATAR_COLORS = exports.PUBLIC_BASE_RPC_URL = exports.ENS_GATEWAY_URL = exports.B3_AUTH_COOKIE_NAME = exports.CLIENT_APP_BUNDLE_ID = exports.THIRDWEB_CLIENT_ID = exports.THIRDWEB_SECRET_KEY = exports.tokenIcons = exports.ecosystemWalletId = exports.b3CoinIcon = exports.siteURL = void 0;
|
|
18
18
|
__exportStar(require("./currency"), exports);
|
|
19
19
|
exports.siteURL = "https://basement.fun";
|
|
20
20
|
exports.b3CoinIcon = "https://cdn.b3.fun/b3-coin-3d.png";
|
|
@@ -38,3 +38,4 @@ exports.CLIENT_APP_BUNDLE_ID = process.env.EXPO_PUBLIC_B3_BUNDLE_ID || "";
|
|
|
38
38
|
exports.B3_AUTH_COOKIE_NAME = "b3-auth";
|
|
39
39
|
exports.ENS_GATEWAY_URL = "https://ens-gateway.b3.fun/";
|
|
40
40
|
exports.PUBLIC_BASE_RPC_URL = "https://base-rpc.publicnode.com";
|
|
41
|
+
exports.AVATAR_COLORS = ["#3368ef", "#272727", "#6366f1", "#06b6d4", "#eeb0d9", "#ba3fbf", "#ff777b", "#dfbb53"];
|
|
@@ -68,4 +68,6 @@ export declare function AnySpend(props: {
|
|
|
68
68
|
theme?: AnySpendTheme;
|
|
69
69
|
/** When true, shows a KYC gate before Stripe Web2 (credit card) payments. Default false. */
|
|
70
70
|
kycEnabled?: boolean;
|
|
71
|
+
/** Whether to show the "Pay with Fiat" tab. Defaults to true. When false, the fiat tab is hidden and activeTab is forced to "crypto". */
|
|
72
|
+
showFiatOption?: boolean;
|
|
71
73
|
}): import("react/jsx-runtime").JSX.Element;
|