@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.
Files changed (190) hide show
  1. package/dist/cjs/anyspend/react/components/AnySpend.d.ts +2 -0
  2. package/dist/cjs/anyspend/react/components/AnySpend.js +12 -4
  3. package/dist/cjs/anyspend/react/components/AnySpendCollectorClubPurchase.d.ts +5 -1
  4. package/dist/cjs/anyspend/react/components/AnySpendCollectorClubPurchase.js +2 -2
  5. package/dist/cjs/anyspend/react/components/AnySpendCustom.d.ts +2 -0
  6. package/dist/cjs/anyspend/react/components/AnySpendCustom.js +7 -3
  7. package/dist/cjs/anyspend/react/components/AnySpendDeposit.d.ts +3 -1
  8. package/dist/cjs/anyspend/react/components/AnySpendDeposit.js +3 -3
  9. package/dist/cjs/anyspend/react/components/AnySpendNFT.d.ts +3 -1
  10. package/dist/cjs/anyspend/react/components/AnySpendNFT.js +2 -2
  11. package/dist/cjs/anyspend/react/components/AnySpendStakeUpside.d.ts +3 -1
  12. package/dist/cjs/anyspend/react/components/AnySpendStakeUpside.js +2 -2
  13. package/dist/cjs/anyspend/react/components/checkout/AnySpendCheckout.js +6 -5
  14. package/dist/cjs/anyspend/react/components/checkout/CartItemRow.d.ts +2 -1
  15. package/dist/cjs/anyspend/react/components/checkout/CartSummary.d.ts +6 -4
  16. package/dist/cjs/anyspend/react/components/checkout/CartSummary.js +13 -11
  17. package/dist/cjs/anyspend/react/components/checkout/CheckoutCartPanel.d.ts +3 -1
  18. package/dist/cjs/anyspend/react/components/checkout/CheckoutCartPanel.js +5 -4
  19. package/dist/cjs/anyspend/react/components/checkout/CheckoutFormPanel.d.ts +3 -1
  20. package/dist/cjs/anyspend/react/components/checkout/CheckoutFormPanel.js +2 -2
  21. package/dist/cjs/anyspend/react/components/checkout/DiscountCodeInput.d.ts +3 -1
  22. package/dist/cjs/anyspend/react/components/checkout/DiscountCodeInput.js +3 -6
  23. package/dist/cjs/anyspend/react/components/checkout/PriceSkeleton.d.ts +5 -0
  24. package/dist/cjs/anyspend/react/components/checkout/PriceSkeleton.js +9 -0
  25. package/dist/cjs/anyspend/react/components/checkout/ShippingSelector.d.ts +3 -1
  26. package/dist/cjs/anyspend/react/components/checkout/ShippingSelector.js +3 -2
  27. package/dist/cjs/global-account/react/components/AvatarEditor/AvatarEditor.js +3 -1
  28. package/dist/cjs/global-account/react/components/B3Provider/B3ConfigProvider.d.ts +5 -1
  29. package/dist/cjs/global-account/react/components/B3Provider/B3ConfigProvider.js +2 -1
  30. package/dist/cjs/global-account/react/components/B3Provider/B3Provider.d.ts +17 -1
  31. package/dist/cjs/global-account/react/components/B3Provider/B3Provider.js +3 -2
  32. package/dist/cjs/global-account/react/components/B3Provider/BetterAuthClientProvider.d.ts +17 -0
  33. package/dist/cjs/global-account/react/components/B3Provider/BetterAuthClientProvider.js +31 -0
  34. package/dist/cjs/global-account/react/components/B3Provider/BetterAuthProvider.js +6 -5
  35. package/dist/cjs/global-account/react/components/ManageAccount/BottomNavigation.js +4 -2
  36. package/dist/cjs/global-account/react/components/ManageAccount/Header.js +36 -4
  37. package/dist/cjs/global-account/react/components/ManageAccount/HomeContent.js +4 -1
  38. package/dist/cjs/global-account/react/components/ManageAccount/ManageAccount.js +6 -0
  39. package/dist/cjs/global-account/react/components/ManageAccount/ProfileSection.js +5 -3
  40. package/dist/cjs/global-account/react/components/ManageAccount/SettingsContent.js +3 -1
  41. package/dist/cjs/global-account/react/components/ManageAccount/SettingsProfileCard.js +25 -14
  42. package/dist/cjs/global-account/react/components/SignInWithB3/BetterAuthResetPassword.js +3 -2
  43. package/dist/cjs/global-account/react/components/SignInWithB3/BetterAuthSignIn.d.ts +6 -1
  44. package/dist/cjs/global-account/react/components/SignInWithB3/BetterAuthSignIn.js +15 -5
  45. package/dist/cjs/global-account/react/components/SignInWithB3/BetterAuthVerifyEmail.d.ts +37 -0
  46. package/dist/cjs/global-account/react/components/SignInWithB3/BetterAuthVerifyEmail.js +85 -0
  47. package/dist/cjs/global-account/react/components/SignInWithB3/SignIn.js +14 -4
  48. package/dist/cjs/global-account/react/components/SignInWithB3/SignInWithB3Flow.d.ts +1 -1
  49. package/dist/cjs/global-account/react/components/SignInWithB3/SignInWithB3Flow.js +2 -2
  50. package/dist/cjs/global-account/react/components/SignInWithB3/components/PasswordInput.d.ts +10 -0
  51. package/dist/cjs/global-account/react/components/SignInWithB3/components/PasswordInput.js +10 -0
  52. package/dist/cjs/global-account/react/components/SignInWithB3/steps/LoginStepBetterAuth.d.ts +3 -1
  53. package/dist/cjs/global-account/react/components/SignInWithB3/steps/LoginStepBetterAuth.js +8 -5
  54. package/dist/cjs/global-account/react/components/UserAvatar/UserAvatar.d.ts +18 -0
  55. package/dist/cjs/global-account/react/components/UserAvatar/UserAvatar.js +27 -0
  56. package/dist/cjs/global-account/react/components/index.d.ts +3 -0
  57. package/dist/cjs/global-account/react/components/index.js +10 -3
  58. package/dist/cjs/global-account/react/hooks/useBetterAuth.d.ts +1 -1
  59. package/dist/cjs/global-account/react/hooks/useBetterAuth.js +19 -17
  60. package/dist/cjs/global-account/react/stores/useModalStore.d.ts +4 -0
  61. package/dist/cjs/shared/constants/index.d.ts +1 -0
  62. package/dist/cjs/shared/constants/index.js +2 -1
  63. package/dist/esm/anyspend/react/components/AnySpend.d.ts +2 -0
  64. package/dist/esm/anyspend/react/components/AnySpend.js +12 -4
  65. package/dist/esm/anyspend/react/components/AnySpendCollectorClubPurchase.d.ts +5 -1
  66. package/dist/esm/anyspend/react/components/AnySpendCollectorClubPurchase.js +2 -2
  67. package/dist/esm/anyspend/react/components/AnySpendCustom.d.ts +2 -0
  68. package/dist/esm/anyspend/react/components/AnySpendCustom.js +7 -3
  69. package/dist/esm/anyspend/react/components/AnySpendDeposit.d.ts +3 -1
  70. package/dist/esm/anyspend/react/components/AnySpendDeposit.js +3 -3
  71. package/dist/esm/anyspend/react/components/AnySpendNFT.d.ts +3 -1
  72. package/dist/esm/anyspend/react/components/AnySpendNFT.js +2 -2
  73. package/dist/esm/anyspend/react/components/AnySpendStakeUpside.d.ts +3 -1
  74. package/dist/esm/anyspend/react/components/AnySpendStakeUpside.js +2 -2
  75. package/dist/esm/anyspend/react/components/checkout/AnySpendCheckout.js +6 -5
  76. package/dist/esm/anyspend/react/components/checkout/CartItemRow.d.ts +2 -1
  77. package/dist/esm/anyspend/react/components/checkout/CartSummary.d.ts +6 -4
  78. package/dist/esm/anyspend/react/components/checkout/CartSummary.js +13 -11
  79. package/dist/esm/anyspend/react/components/checkout/CheckoutCartPanel.d.ts +3 -1
  80. package/dist/esm/anyspend/react/components/checkout/CheckoutCartPanel.js +5 -4
  81. package/dist/esm/anyspend/react/components/checkout/CheckoutFormPanel.d.ts +3 -1
  82. package/dist/esm/anyspend/react/components/checkout/CheckoutFormPanel.js +2 -2
  83. package/dist/esm/anyspend/react/components/checkout/DiscountCodeInput.d.ts +3 -1
  84. package/dist/esm/anyspend/react/components/checkout/DiscountCodeInput.js +3 -6
  85. package/dist/esm/anyspend/react/components/checkout/PriceSkeleton.d.ts +5 -0
  86. package/dist/esm/anyspend/react/components/checkout/PriceSkeleton.js +6 -0
  87. package/dist/esm/anyspend/react/components/checkout/ShippingSelector.d.ts +3 -1
  88. package/dist/esm/anyspend/react/components/checkout/ShippingSelector.js +3 -2
  89. package/dist/esm/global-account/react/components/AvatarEditor/AvatarEditor.js +3 -1
  90. package/dist/esm/global-account/react/components/B3Provider/B3ConfigProvider.d.ts +5 -1
  91. package/dist/esm/global-account/react/components/B3Provider/B3ConfigProvider.js +2 -1
  92. package/dist/esm/global-account/react/components/B3Provider/B3Provider.d.ts +17 -1
  93. package/dist/esm/global-account/react/components/B3Provider/B3Provider.js +3 -2
  94. package/dist/esm/global-account/react/components/B3Provider/BetterAuthClientProvider.d.ts +17 -0
  95. package/dist/esm/global-account/react/components/B3Provider/BetterAuthClientProvider.js +27 -0
  96. package/dist/esm/global-account/react/components/B3Provider/BetterAuthProvider.js +4 -3
  97. package/dist/esm/global-account/react/components/ManageAccount/BottomNavigation.js +5 -3
  98. package/dist/esm/global-account/react/components/ManageAccount/Header.js +37 -5
  99. package/dist/esm/global-account/react/components/ManageAccount/HomeContent.js +4 -1
  100. package/dist/esm/global-account/react/components/ManageAccount/ManageAccount.js +7 -1
  101. package/dist/esm/global-account/react/components/ManageAccount/ProfileSection.js +6 -4
  102. package/dist/esm/global-account/react/components/ManageAccount/SettingsContent.js +5 -3
  103. package/dist/esm/global-account/react/components/ManageAccount/SettingsProfileCard.js +25 -14
  104. package/dist/esm/global-account/react/components/SignInWithB3/BetterAuthResetPassword.js +4 -3
  105. package/dist/esm/global-account/react/components/SignInWithB3/BetterAuthSignIn.d.ts +6 -1
  106. package/dist/esm/global-account/react/components/SignInWithB3/BetterAuthSignIn.js +16 -6
  107. package/dist/esm/global-account/react/components/SignInWithB3/BetterAuthVerifyEmail.d.ts +37 -0
  108. package/dist/esm/global-account/react/components/SignInWithB3/BetterAuthVerifyEmail.js +82 -0
  109. package/dist/esm/global-account/react/components/SignInWithB3/SignIn.js +15 -5
  110. package/dist/esm/global-account/react/components/SignInWithB3/SignInWithB3Flow.d.ts +1 -1
  111. package/dist/esm/global-account/react/components/SignInWithB3/SignInWithB3Flow.js +2 -2
  112. package/dist/esm/global-account/react/components/SignInWithB3/components/PasswordInput.d.ts +10 -0
  113. package/dist/esm/global-account/react/components/SignInWithB3/components/PasswordInput.js +7 -0
  114. package/dist/esm/global-account/react/components/SignInWithB3/steps/LoginStepBetterAuth.d.ts +3 -1
  115. package/dist/esm/global-account/react/components/SignInWithB3/steps/LoginStepBetterAuth.js +8 -5
  116. package/dist/esm/global-account/react/components/UserAvatar/UserAvatar.d.ts +18 -0
  117. package/dist/esm/global-account/react/components/UserAvatar/UserAvatar.js +21 -0
  118. package/dist/esm/global-account/react/components/index.d.ts +3 -0
  119. package/dist/esm/global-account/react/components/index.js +4 -0
  120. package/dist/esm/global-account/react/hooks/useBetterAuth.d.ts +1 -1
  121. package/dist/esm/global-account/react/hooks/useBetterAuth.js +12 -10
  122. package/dist/esm/global-account/react/stores/useModalStore.d.ts +4 -0
  123. package/dist/esm/shared/constants/index.d.ts +1 -0
  124. package/dist/esm/shared/constants/index.js +1 -0
  125. package/dist/styles/index.css +1 -1
  126. package/dist/types/anyspend/react/components/AnySpend.d.ts +2 -0
  127. package/dist/types/anyspend/react/components/AnySpendCollectorClubPurchase.d.ts +5 -1
  128. package/dist/types/anyspend/react/components/AnySpendCustom.d.ts +2 -0
  129. package/dist/types/anyspend/react/components/AnySpendDeposit.d.ts +3 -1
  130. package/dist/types/anyspend/react/components/AnySpendNFT.d.ts +3 -1
  131. package/dist/types/anyspend/react/components/AnySpendStakeUpside.d.ts +3 -1
  132. package/dist/types/anyspend/react/components/checkout/CartItemRow.d.ts +2 -1
  133. package/dist/types/anyspend/react/components/checkout/CartSummary.d.ts +6 -4
  134. package/dist/types/anyspend/react/components/checkout/CheckoutCartPanel.d.ts +3 -1
  135. package/dist/types/anyspend/react/components/checkout/CheckoutFormPanel.d.ts +3 -1
  136. package/dist/types/anyspend/react/components/checkout/DiscountCodeInput.d.ts +3 -1
  137. package/dist/types/anyspend/react/components/checkout/PriceSkeleton.d.ts +5 -0
  138. package/dist/types/anyspend/react/components/checkout/ShippingSelector.d.ts +3 -1
  139. package/dist/types/global-account/react/components/B3Provider/B3ConfigProvider.d.ts +5 -1
  140. package/dist/types/global-account/react/components/B3Provider/B3Provider.d.ts +17 -1
  141. package/dist/types/global-account/react/components/B3Provider/BetterAuthClientProvider.d.ts +17 -0
  142. package/dist/types/global-account/react/components/SignInWithB3/BetterAuthSignIn.d.ts +6 -1
  143. package/dist/types/global-account/react/components/SignInWithB3/BetterAuthVerifyEmail.d.ts +37 -0
  144. package/dist/types/global-account/react/components/SignInWithB3/SignInWithB3Flow.d.ts +1 -1
  145. package/dist/types/global-account/react/components/SignInWithB3/components/PasswordInput.d.ts +10 -0
  146. package/dist/types/global-account/react/components/SignInWithB3/steps/LoginStepBetterAuth.d.ts +3 -1
  147. package/dist/types/global-account/react/components/UserAvatar/UserAvatar.d.ts +18 -0
  148. package/dist/types/global-account/react/components/index.d.ts +3 -0
  149. package/dist/types/global-account/react/hooks/useBetterAuth.d.ts +1 -1
  150. package/dist/types/global-account/react/stores/useModalStore.d.ts +4 -0
  151. package/dist/types/shared/constants/index.d.ts +1 -0
  152. package/package.json +1 -1
  153. package/src/anyspend/react/components/AnySpend.tsx +24 -12
  154. package/src/anyspend/react/components/AnySpendCollectorClubPurchase.tsx +6 -0
  155. package/src/anyspend/react/components/AnySpendCustom.tsx +12 -2
  156. package/src/anyspend/react/components/AnySpendDeposit.tsx +38 -31
  157. package/src/anyspend/react/components/AnySpendNFT.tsx +4 -0
  158. package/src/anyspend/react/components/AnySpendStakeUpside.tsx +4 -0
  159. package/src/anyspend/react/components/checkout/AnySpendCheckout.tsx +10 -4
  160. package/src/anyspend/react/components/checkout/CartItemRow.tsx +2 -1
  161. package/src/anyspend/react/components/checkout/CartSummary.tsx +24 -20
  162. package/src/anyspend/react/components/checkout/CheckoutCartPanel.tsx +12 -3
  163. package/src/anyspend/react/components/checkout/CheckoutFormPanel.tsx +5 -0
  164. package/src/anyspend/react/components/checkout/DiscountCodeInput.tsx +15 -5
  165. package/src/anyspend/react/components/checkout/PriceSkeleton.tsx +19 -0
  166. package/src/anyspend/react/components/checkout/ShippingSelector.tsx +5 -1
  167. package/src/global-account/react/components/AvatarEditor/AvatarEditor.tsx +3 -1
  168. package/src/global-account/react/components/B3Provider/B3ConfigProvider.tsx +6 -0
  169. package/src/global-account/react/components/B3Provider/B3Provider.tsx +36 -15
  170. package/src/global-account/react/components/B3Provider/BetterAuthClientProvider.tsx +40 -0
  171. package/src/global-account/react/components/B3Provider/BetterAuthProvider.tsx +4 -3
  172. package/src/global-account/react/components/ManageAccount/BottomNavigation.tsx +18 -14
  173. package/src/global-account/react/components/ManageAccount/Header.tsx +71 -4
  174. package/src/global-account/react/components/ManageAccount/HomeContent.tsx +25 -19
  175. package/src/global-account/react/components/ManageAccount/ManageAccount.tsx +13 -0
  176. package/src/global-account/react/components/ManageAccount/ProfileSection.tsx +14 -7
  177. package/src/global-account/react/components/ManageAccount/SettingsContent.tsx +15 -32
  178. package/src/global-account/react/components/ManageAccount/SettingsProfileCard.tsx +29 -20
  179. package/src/global-account/react/components/SignInWithB3/BetterAuthResetPassword.tsx +6 -7
  180. package/src/global-account/react/components/SignInWithB3/BetterAuthSignIn.tsx +27 -7
  181. package/src/global-account/react/components/SignInWithB3/BetterAuthVerifyEmail.tsx +155 -0
  182. package/src/global-account/react/components/SignInWithB3/SignIn.tsx +42 -13
  183. package/src/global-account/react/components/SignInWithB3/SignInWithB3Flow.tsx +8 -1
  184. package/src/global-account/react/components/SignInWithB3/components/PasswordInput.tsx +62 -0
  185. package/src/global-account/react/components/SignInWithB3/steps/LoginStepBetterAuth.tsx +13 -6
  186. package/src/global-account/react/components/UserAvatar/UserAvatar.tsx +45 -0
  187. package/src/global-account/react/components/index.ts +9 -0
  188. package/src/global-account/react/hooks/useBetterAuth.ts +12 -10
  189. package/src/global-account/react/stores/useModalStore.ts +4 -0
  190. package/src/shared/constants/index.ts +2 -0
@@ -2,6 +2,7 @@ import {
2
2
  CopyToClipboard,
3
3
  ManageAccountModalProps,
4
4
  useAuthentication,
5
+ useB3Config,
5
6
  useModalStore,
6
7
  } from "@b3dotfun/sdk/global-account/react";
7
8
  import * as AccordionPrimitive from "@radix-ui/react-accordion";
@@ -10,6 +11,7 @@ import { Loader2 } from "lucide-react";
10
11
  import { useState } from "react";
11
12
  import { useActiveWallet, useConnectedWallets, useSetActiveWallet, useWalletImage } from "thirdweb/react";
12
13
  import { Wallet } from "thirdweb/wallets";
14
+ import { UserAvatar } from "../UserAvatar/UserAvatar";
13
15
  import { ChevronDownIcon } from "../icons/ChevronDownIcon";
14
16
  import LinkIcon from "../icons/LinkIcon";
15
17
  import SignOutIcon from "../icons/SignOutIcon";
@@ -89,7 +91,69 @@ function WalletItem({ wallet, isActive, onClick }: { wallet: Wallet; isActive: b
89
91
  );
90
92
  }
91
93
 
94
+ function BetterAuthHeader({ onLogout }: { onLogout?: () => void }) {
95
+ const contentType = useModalStore(state => state.contentType) as ManageAccountModalProps;
96
+ const setB3ModalOpen = useModalStore(state => state.setB3ModalOpen);
97
+ const partnerId = contentType?.partnerId;
98
+ const { logout, user } = useAuthentication(partnerId);
99
+ const [logoutLoading, setLogoutLoading] = useState(false);
100
+
101
+ const displayName = user?.username || user?.email || "Account";
102
+
103
+ const onLogoutEnhanced = async () => {
104
+ setLogoutLoading(true);
105
+ try {
106
+ await logout();
107
+ onLogout?.();
108
+ } finally {
109
+ setB3ModalOpen(false);
110
+ setLogoutLoading(false);
111
+ }
112
+ };
113
+
114
+ return (
115
+ <div className="bg-b3-background border-b3-line flex items-center justify-between border-b px-5 py-3">
116
+ <div className="flex items-center gap-2">
117
+ <UserAvatar avatarUrl={user?.avatar} name={displayName} size={40} className="shrink-0" />
118
+ <div className="flex flex-col gap-0.5">
119
+ {user?.username && (
120
+ <p className="text-b3-grey font-neue-montreal-semibold text-left text-sm">{user.username}</p>
121
+ )}
122
+ {user?.email && (
123
+ <div className="flex items-center gap-1">
124
+ <p className="text-b3-foreground-muted font-neue-montreal-medium text-sm">{user.email}</p>
125
+ <CopyToClipboard text={user.email} />
126
+ </div>
127
+ )}
128
+ </div>
129
+ </div>
130
+ <button
131
+ className="border-b3-line hover:bg-b3-line flex items-center justify-center gap-1.5 rounded-xl border border-solid px-3 py-2 transition-colors"
132
+ onClick={onLogoutEnhanced}
133
+ disabled={logoutLoading}
134
+ >
135
+ {logoutLoading ? (
136
+ <Loader2 className="animate-spin" size={16} />
137
+ ) : (
138
+ <SignOutIcon size={16} className="text-b3-grey" />
139
+ )}
140
+ <p className="text-b3-grey font-neue-montreal-semibold text-sm">Sign out</p>
141
+ </button>
142
+ </div>
143
+ );
144
+ }
145
+
92
146
  export function Header({ onLogout }: { onLogout?: () => void }) {
147
+ const { authStrategy } = useB3Config();
148
+
149
+ if (authStrategy === "better-auth") {
150
+ return <BetterAuthHeader onLogout={onLogout} />;
151
+ }
152
+
153
+ return <WalletHeader onLogout={onLogout} />;
154
+ }
155
+
156
+ function WalletHeader({ onLogout }: { onLogout?: () => void }) {
93
157
  const activeWallet = useActiveWallet();
94
158
 
95
159
  const connectedWallets = useConnectedWallets();
@@ -110,10 +174,13 @@ export function Header({ onLogout }: { onLogout?: () => void }) {
110
174
 
111
175
  const onLogoutEnhanced = async () => {
112
176
  setLogoutLoading(true);
113
- await logout();
114
- onLogout?.();
115
- setB3ModalOpen(false);
116
- setLogoutLoading(false);
177
+ try {
178
+ await logout();
179
+ onLogout?.();
180
+ } finally {
181
+ setB3ModalOpen(false);
182
+ setLogoutLoading(false);
183
+ }
117
184
  };
118
185
 
119
186
  const handleWalletSwitch = (wallet: Wallet) => {
@@ -1,3 +1,4 @@
1
+ import { useB3Config } from "@b3dotfun/sdk/global-account/react";
1
2
  import { Tabs, TabsContent, TabsList, TabTrigger } from "../ui/Tabs";
2
3
  import { Header } from "./Header";
3
4
  import HomeActions from "./HomeActions";
@@ -11,31 +12,36 @@ interface HomeContentProps {
11
12
  }
12
13
 
13
14
  export function HomeContent({ showDeposit = false, showSwap = true }: HomeContentProps) {
15
+ const { authStrategy } = useB3Config();
16
+ const isBetterAuth = authStrategy === "better-auth";
17
+
14
18
  return (
15
19
  <div className="flex flex-col">
16
20
  <Header />
17
21
  <div className="flex flex-col">
18
22
  <ProfileSection />
19
23
 
20
- <HomeActions showDeposit={showDeposit} showSwap={showSwap} />
21
- <div className="b3-modal-balance-content space-y-2 p-5">
22
- <Tabs defaultValue={"balance"}>
23
- <TabsList className="b3-modal-balance-tabs-list">
24
- <TabTrigger value="balance" className="font-neue-montreal-semibold p-0 pr-3">
25
- Balance
26
- </TabTrigger>
27
- <TabTrigger value="nfts" className="font-neue-montreal-semibold p-0 pr-3">
28
- NFTs
29
- </TabTrigger>
30
- </TabsList>
31
- <TabsContent value="balance" className="px-0 pb-4 pt-2">
32
- <TokenContent />
33
- </TabsContent>
34
- <TabsContent value="nfts" className="px-0 pb-4 pt-2">
35
- <NFTContent />
36
- </TabsContent>
37
- </Tabs>
38
- </div>
24
+ {!isBetterAuth && <HomeActions showDeposit={showDeposit} showSwap={showSwap} />}
25
+ {!isBetterAuth && (
26
+ <div className="b3-modal-balance-content space-y-2 p-5">
27
+ <Tabs defaultValue={"balance"}>
28
+ <TabsList className="b3-modal-balance-tabs-list">
29
+ <TabTrigger value="balance" className="font-neue-montreal-semibold p-0 pr-3">
30
+ Balance
31
+ </TabTrigger>
32
+ <TabTrigger value="nfts" className="font-neue-montreal-semibold p-0 pr-3">
33
+ NFTs
34
+ </TabTrigger>
35
+ </TabsList>
36
+ <TabsContent value="balance" className="px-0 pb-4 pt-2">
37
+ <TokenContent />
38
+ </TabsContent>
39
+ <TabsContent value="nfts" className="px-0 pb-4 pt-2">
40
+ <NFTContent />
41
+ </TabsContent>
42
+ </Tabs>
43
+ </div>
44
+ )}
39
45
  </div>
40
46
  </div>
41
47
  );
@@ -2,6 +2,7 @@ import {
2
2
  ManageAccountModalProps,
3
3
  TabsContentPrimitive,
4
4
  TabsPrimitive,
5
+ useB3Config,
5
6
  useModalStore,
6
7
  } from "@b3dotfun/sdk/global-account/react";
7
8
  import { Chain } from "thirdweb";
@@ -74,9 +75,21 @@ export function ManageAccount({
74
75
  showSwap,
75
76
  showDeposit,
76
77
  }: ManageAccountProps) {
78
+ const { authStrategy } = useB3Config();
79
+ const isBetterAuth = authStrategy === "better-auth";
77
80
  const contentType = useModalStore(state => state.contentType);
78
81
  const { activeTab = "home", setActiveTab } = contentType as ManageAccountModalProps;
79
82
  const setB3ModalContentType = useModalStore(state => state.setB3ModalContentType);
83
+
84
+ // Better Auth: single-view layout — no Home/Swap tabs, just settings content
85
+ if (isBetterAuth) {
86
+ return (
87
+ <div className="b3-manage-account flex-1">
88
+ <SettingsContent partnerId={partnerId} onLogout={onLogout} chain={chain} />
89
+ </div>
90
+ );
91
+ }
92
+
80
93
  return (
81
94
  <div className="b3-manage-account flex-1">
82
95
  <TabsPrimitive
@@ -1,11 +1,13 @@
1
1
  import {
2
2
  useAccountWallet,
3
+ useB3Config,
3
4
  useModalStore,
4
5
  useProfile,
5
6
  useSimBalance,
6
7
  useUser,
7
8
  } from "@b3dotfun/sdk/global-account/react";
8
9
  import { validateImageUrl } from "@b3dotfun/sdk/global-account/react/utils/profileDisplay";
10
+ import { AVATAR_COLORS } from "@b3dotfun/sdk/shared/constants";
9
11
  import { formatUsername } from "@b3dotfun/sdk/shared/utils";
10
12
  import { formatDisplayNumber } from "@b3dotfun/sdk/shared/utils/number";
11
13
  import Avatar from "boring-avatars";
@@ -15,9 +17,9 @@ import { useActiveAccount } from "thirdweb/react";
15
17
  import { useFirstEOA } from "../../hooks/useFirstEOA";
16
18
  import { IPFSMediaRenderer } from "../IPFSMediaRenderer/IPFSMediaRenderer";
17
19
 
18
- const AVATAR_COLORS = ["#3368ef", "#272727", "#6366f1", "#06b6d4", "#eeb0d9", "#ba3fbf", "#ff777b", "#dfbb53"];
19
-
20
20
  const ProfileSection = () => {
21
+ const { authStrategy } = useB3Config();
22
+ const isBetterAuth = authStrategy === "better-auth";
21
23
  const account = useActiveAccount();
22
24
  const { address: eoaAddress } = useFirstEOA();
23
25
  const { address: smartWalletAddress } = useAccountWallet();
@@ -60,7 +62,7 @@ const ProfileSection = () => {
60
62
  }, [avatarSrc]);
61
63
 
62
64
  const currentUsername = user?.username || profile?.displayName || formatUsername(profile?.name || "");
63
- const avatarSeed = eoaAddress || account?.address || smartWalletAddress || currentUsername || "user";
65
+ const avatarSeed = eoaAddress || account?.address || smartWalletAddress || currentUsername || user?.email || "user";
64
66
 
65
67
  return (
66
68
  <div className="flex items-center justify-between px-5 py-6">
@@ -87,13 +89,18 @@ const ProfileSection = () => {
87
89
  </button>
88
90
  </div>
89
91
  <div className="global-account-profile-info flex flex-col gap-1">
90
- <h2 className="text-b3-grey font-neue-montreal-semibold flex h-[38px] items-center gap-1 text-xl">
91
- <div className="text-b3-foreground-muted"> $</div>
92
- <div className="text-[30px]">{formatDisplayNumber(totalBalanceUsd, { fractionDigits: 2 })}</div>
93
- </h2>
92
+ {!isBetterAuth && (
93
+ <h2 className="text-b3-grey font-neue-montreal-semibold flex h-[38px] items-center gap-1 text-xl">
94
+ <div className="text-b3-foreground-muted"> $</div>
95
+ <div className="text-[30px]">{formatDisplayNumber(totalBalanceUsd, { fractionDigits: 2 })}</div>
96
+ </h2>
97
+ )}
94
98
  <div className="b3-modal-username font-neue-montreal-semibold text-base leading-none text-[#0B57C2]">
95
99
  {currentUsername}
96
100
  </div>
101
+ {isBetterAuth && user?.email && (
102
+ <div className="text-b3-foreground-muted font-neue-montreal-medium text-sm">{user.email}</div>
103
+ )}
97
104
  </div>
98
105
  </div>
99
106
  </div>
@@ -1,7 +1,7 @@
1
- import { useAuthentication, useModalStore } from "@b3dotfun/sdk/global-account/react";
1
+ import { useAuthentication, useB3Config, useModalStore } from "@b3dotfun/sdk/global-account/react";
2
2
  import { client } from "@b3dotfun/sdk/shared/utils/thirdweb";
3
3
  import { getSessionDurationDays, SESSION_DURATION_LABELS } from "@b3dotfun/sdk/shared/utils/session-duration";
4
- import { Loader2 } from "lucide-react";
4
+ import { Bell, Clock, Link, Loader2 } from "lucide-react";
5
5
  import { useState } from "react";
6
6
  import { Chain } from "thirdweb";
7
7
  import { useProfiles } from "thirdweb/react";
@@ -19,6 +19,8 @@ const SettingsContent = ({
19
19
  onLogout?: () => void;
20
20
  chain: Chain;
21
21
  }) => {
22
+ const { authStrategy } = useB3Config();
23
+ const isBetterAuth = authStrategy === "better-auth";
22
24
  const setB3ModalContentType = useModalStore(state => state.setB3ModalContentType);
23
25
  const setB3ModalOpen = useModalStore(state => state.setB3ModalOpen);
24
26
  const { logout, user } = useAuthentication(partnerId);
@@ -58,7 +60,7 @@ const SettingsContent = ({
58
60
 
59
61
  return (
60
62
  <div className="flex h-[470px] flex-col">
61
- <ModalHeader showBackButton={false} showCloseButton={false} title="Settings" />
63
+ {!isBetterAuth && <ModalHeader showBackButton={false} showCloseButton={false} title="Settings" />}
62
64
 
63
65
  {/* Profile Section */}
64
66
  <div className="p-5">
@@ -69,41 +71,22 @@ const SettingsContent = ({
69
71
 
70
72
  {/* Menu Items */}
71
73
  <div className="space-y-3 px-5">
74
+ {!isBetterAuth && (
75
+ <SettingsMenuItem
76
+ icon={<Link size={18} className="text-[#51525c]" />}
77
+ title="Linked Accounts"
78
+ subtitle={`${profiles.length} connected account${profiles.length > 1 ? "s" : ""}`}
79
+ onClick={() => handleNavigate("linkAccount")}
80
+ />
81
+ )}
72
82
  <SettingsMenuItem
73
- icon={
74
- <svg width="40" height="40" viewBox="0 0 40 40" fill="none" xmlns="http://www.w3.org/2000/svg">
75
- <path
76
- d="M0 12C0 5.37258 5.37258 0 12 0H28C34.6274 0 40 5.37258 40 12V28C40 34.6274 34.6274 40 28 40H12C5.37258 40 0 34.6274 0 28V12Z"
77
- fill="#F4F4F5"
78
- />
79
- </svg>
80
- }
81
- title="Linked Accounts"
82
- subtitle={`${profiles.length} connected account${profiles.length > 1 ? "s" : ""}`}
83
- onClick={() => handleNavigate("linkAccount")}
84
- />
85
- <SettingsMenuItem
86
- icon={
87
- <svg width="40" height="40" viewBox="0 0 40 40" fill="none" xmlns="http://www.w3.org/2000/svg">
88
- <path
89
- d="M0 12C0 5.37258 5.37258 0 12 0H28C34.6274 0 40 5.37258 40 12V28C40 34.6274 34.6274 40 28 40H12C5.37258 40 0 34.6274 0 28V12Z"
90
- fill="#F4F4F5"
91
- />
92
- </svg>
93
- }
83
+ icon={<Bell size={18} className="text-[#51525c]" />}
94
84
  title="Notifications"
95
85
  subtitle="Manage your notifications"
96
86
  onClick={() => handleNavigate("notifications")}
97
87
  />
98
88
  <SettingsMenuItem
99
- icon={
100
- <svg width="40" height="40" viewBox="0 0 40 40" fill="none" xmlns="http://www.w3.org/2000/svg">
101
- <path
102
- d="M0 12C0 5.37258 5.37258 0 12 0H28C34.6274 0 40 5.37258 40 12V28C40 34.6274 34.6274 40 28 40H12C5.37258 40 0 34.6274 0 28V12Z"
103
- fill="#F4F4F5"
104
- />
105
- </svg>
106
- }
89
+ icon={<Clock size={18} className="text-[#51525c]" />}
107
90
  title="Stay signed in"
108
91
  subtitle={SESSION_DURATION_LABELS[sessionDays] ?? `${sessionDays} days`}
109
92
  onClick={() => handleNavigate("sessionDuration")}
@@ -18,7 +18,8 @@ const SettingsProfileCard = () => {
18
18
  address: eoaAddress || account?.address,
19
19
  fresh: true,
20
20
  });
21
- const { partnerId } = useB3Config();
21
+ const { partnerId, authStrategy } = useB3Config();
22
+ const isBetterAuth = authStrategy === "better-auth";
22
23
  const { user, setUser } = useAuthentication(partnerId);
23
24
  const setB3ModalOpen = useModalStore(state => state.setB3ModalOpen);
24
25
  const setB3ModalContentType = useModalStore(state => state.setB3ModalContentType);
@@ -78,25 +79,33 @@ const SettingsProfileCard = () => {
78
79
 
79
80
  setIsSaving(true);
80
81
  try {
81
- const sanitizedUsername = ens_normalize(editedUsername.trim());
82
- const b3Username = `${sanitizedUsername}.b3.fun`;
83
- const usernameSignMessage = `Register "${b3Username}"`;
84
- const usernameSignature = await account?.signMessage({ message: usernameSignMessage });
85
-
86
- if (!usernameSignature) {
87
- throw new Error("Failed to sign username registration message");
82
+ let updatedUser: Users;
83
+ if (isBetterAuth) {
84
+ // Better Auth: register username without wallet signing (DB-only, no ENS)
85
+ // Skip ens_normalize it rejects underscores/mixed-case that are valid non-ENS usernames
86
+ const sanitizedUsername = editedUsername.trim().toLowerCase();
87
+ // Type assertion needed: b3-mono now accepts message/hash as optional for Better Auth users
88
+ updatedUser = (await app
89
+ .service("users")
90
+ .registerUsername({ username: sanitizedUsername } as any, {} as any)) as unknown as Users;
91
+ } else {
92
+ // Thirdweb: register username with wallet signature + on-chain ENS
93
+ const sanitizedUsername = ens_normalize(editedUsername.trim());
94
+ const b3Username = `${sanitizedUsername}.b3.fun`;
95
+ const usernameSignMessage = `Register "${b3Username}"`;
96
+ const usernameSignature = await account?.signMessage({ message: usernameSignMessage });
97
+
98
+ if (!usernameSignature) {
99
+ throw new Error("Failed to sign username registration message");
100
+ }
101
+
102
+ updatedUser = (await app
103
+ .service("users")
104
+ .registerUsername(
105
+ { username: sanitizedUsername, message: usernameSignMessage, hash: usernameSignature },
106
+ {} as any,
107
+ )) as unknown as Users;
88
108
  }
89
-
90
- console.log("@@usernameSignature", usernameSignature);
91
-
92
- // Register username with ENS
93
- // Note: Type assertion needed until @b3dotfun/b3-api package is updated with RegisterUsername type
94
- const updatedUser = (await app
95
- .service("users")
96
- .registerUsername(
97
- { username: sanitizedUsername, message: usernameSignMessage, hash: usernameSignature },
98
- {} as any,
99
- )) as unknown as Users;
100
109
  // Update user state - registerUsername returns an array with single user
101
110
  setUser(Array.isArray(updatedUser) ? updatedUser[0] : updatedUser);
102
111
 
@@ -179,7 +188,7 @@ const SettingsProfileCard = () => {
179
188
  <>
180
189
  <div className="flex items-center gap-1">
181
190
  <p className="b3-modal-username font-neue-montreal-semibold text-lg leading-none text-[#0B57C2]">
182
- {currentUsername}
191
+ {currentUsername || user?.email}
183
192
  </p>
184
193
  </div>
185
194
  <button
@@ -1,7 +1,8 @@
1
- import { Button, Input } from "@b3dotfun/sdk/global-account/react";
1
+ import { Button } from "@b3dotfun/sdk/global-account/react";
2
2
  import { debugB3React } from "@b3dotfun/sdk/shared/utils/debug";
3
3
  import { useState } from "react";
4
4
  import { useBetterAuth } from "../../hooks/useBetterAuth";
5
+ import { PasswordInput } from "./components/PasswordInput";
5
6
 
6
7
  const debug = debugB3React("BetterAuthResetPassword");
7
8
 
@@ -103,13 +104,12 @@ export function BetterAuthResetPassword({ token, onSuccess, onError, className }
103
104
  <label className="mb-2 block text-xs font-medium uppercase tracking-wide text-gray-700 dark:text-gray-300">
104
105
  New password
105
106
  </label>
106
- <Input
107
- type="password"
107
+ <PasswordInput
108
108
  placeholder="At least 8 characters"
109
109
  value={password}
110
110
  onChange={e => setPassword(e.target.value)}
111
111
  disabled={isLoading}
112
- className="h-11 px-4 text-[15px]"
112
+ className="h-11 px-4 pr-11 text-[15px]"
113
113
  />
114
114
  </div>
115
115
 
@@ -117,8 +117,7 @@ export function BetterAuthResetPassword({ token, onSuccess, onError, className }
117
117
  <label className="mb-2 block text-xs font-medium uppercase tracking-wide text-gray-700 dark:text-gray-300">
118
118
  Confirm password
119
119
  </label>
120
- <Input
121
- type="password"
120
+ <PasswordInput
122
121
  placeholder="Repeat your password"
123
122
  value={confirmPassword}
124
123
  onChange={e => setConfirmPassword(e.target.value)}
@@ -126,7 +125,7 @@ export function BetterAuthResetPassword({ token, onSuccess, onError, className }
126
125
  onKeyDown={e => {
127
126
  if (e.key === "Enter") handleSubmit();
128
127
  }}
129
- className="h-11 px-4 text-[15px]"
128
+ className="h-11 px-4 pr-11 text-[15px]"
130
129
  />
131
130
  </div>
132
131
 
@@ -1,4 +1,4 @@
1
- import { Button, Input, useAuthStore } from "@b3dotfun/sdk/global-account/react";
1
+ import { Button, Input, Loading, useAuthStore } from "@b3dotfun/sdk/global-account/react";
2
2
  import { debugB3React } from "@b3dotfun/sdk/shared/utils/debug";
3
3
  import { useState } from "react";
4
4
  import {
@@ -6,6 +6,7 @@ import {
6
6
  type BetterAuthSocialProvider,
7
7
  useBetterAuth,
8
8
  } from "../../hooks/useBetterAuth";
9
+ import { PasswordInput } from "./components/PasswordInput";
9
10
  import { strategyIcons, strategyLabels } from "./utils/signInUtils";
10
11
 
11
12
  const debug = debugB3React("BetterAuthSignIn");
@@ -32,6 +33,11 @@ export interface BetterAuthSignInProps {
32
33
  showEmail?: boolean;
33
34
  /** URL to redirect to after password reset link is clicked. Token is appended as ?token=... */
34
35
  passwordResetRedirectTo?: string;
36
+ /**
37
+ * URL Better Auth redirects to after server-side email verification. Render
38
+ * `BetterAuthVerifyEmail` at this route so the user gets a confirmation page.
39
+ */
40
+ verifyEmailRedirectTo?: string;
35
41
  /** Called after successful authentication */
36
42
  onSuccess?: () => void;
37
43
  /** Called on authentication error */
@@ -60,12 +66,15 @@ export function BetterAuthSignIn({
60
66
  socialProviders = DEFAULT_SOCIAL_PROVIDERS.map(p => p.id),
61
67
  showEmail = true,
62
68
  passwordResetRedirectTo,
69
+ verifyEmailRedirectTo,
63
70
  onSuccess,
64
71
  onError,
65
72
  className,
66
73
  }: BetterAuthSignInProps) {
67
74
  const { signInWithEmail, signUpWithEmail, signInWithSocial, requestPasswordReset } = useBetterAuth();
68
75
  const isAuthenticated = useAuthStore(state => state.isAuthenticated);
76
+ const isAuthenticating = useAuthStore(state => state.isAuthenticating);
77
+ const hasStartedConnecting = useAuthStore(state => state.hasStartedConnecting);
69
78
 
70
79
  const [mode, setMode] = useState<"sign-in" | "sign-up" | "forgot-password">("sign-in");
71
80
  const [email, setEmail] = useState("");
@@ -83,7 +92,9 @@ export function BetterAuthSignIn({
83
92
 
84
93
  const resolvedSubtitle =
85
94
  mode === "forgot-password"
86
- ? "Enter your email and we'll send you a reset link"
95
+ ? resetEmailSent
96
+ ? "We've sent a password reset link to your email"
97
+ : "Enter your email and we'll send you a reset link"
87
98
  : subtitle || "Enter your credentials to access your account";
88
99
 
89
100
  const handleForgotPassword = async () => {
@@ -111,6 +122,16 @@ export function BetterAuthSignIn({
111
122
  .map(id => DEFAULT_SOCIAL_PROVIDERS.find(p => p.id === id))
112
123
  .filter((p): p is SocialProviderConfig => !!p);
113
124
 
125
+ // Show loading during session restore (before any user interaction) to prevent
126
+ // the login form from flashing briefly after OAuth redirect.
127
+ if (isAuthenticating && !hasStartedConnecting) {
128
+ return (
129
+ <div className={`flex w-full max-w-[400px] items-center justify-center px-6 py-20 ${className || ""}`}>
130
+ <Loading variant="primary" size="lg" />
131
+ </div>
132
+ );
133
+ }
134
+
114
135
  if (isAuthenticated) {
115
136
  return null;
116
137
  }
@@ -138,7 +159,7 @@ export function BetterAuthSignIn({
138
159
  setError(null);
139
160
 
140
161
  if (mode === "sign-up") {
141
- await signUpWithEmail(normalizedEmail, password, name.trim());
162
+ await signUpWithEmail(normalizedEmail, password, name.trim(), verifyEmailRedirectTo);
142
163
  } else {
143
164
  await signInWithEmail(normalizedEmail, password);
144
165
  }
@@ -334,16 +355,15 @@ export function BetterAuthSignIn({
334
355
  </button>
335
356
  )}
336
357
  </div>
337
- <Input
338
- type="password"
339
- placeholder="Password"
358
+ <PasswordInput
359
+ key={mode}
340
360
  value={password}
341
361
  onChange={e => setPassword(e.target.value)}
342
362
  disabled={isLoading}
343
363
  onKeyDown={e => {
344
364
  if (e.key === "Enter") handleEmailSubmit();
345
365
  }}
346
- className="h-11 px-4 text-[15px]"
366
+ className="h-11 px-4 pr-11 text-[15px]"
347
367
  />
348
368
  </div>
349
369