@b3dotfun/sdk 0.1.69-alpha.8 → 0.1.69-test.0

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 (286) hide show
  1. package/dist/cjs/anyspend/constants/rpc.d.ts +1 -1
  2. package/dist/cjs/anyspend/constants/rpc.js +1 -1
  3. package/dist/cjs/anyspend/react/components/AnySpendNFT.js +2 -2
  4. package/dist/cjs/anyspend/react/components/checkout/AnySpendCheckout.d.ts +3 -1
  5. package/dist/cjs/anyspend/react/components/checkout/AnySpendCheckout.js +10 -2
  6. package/dist/cjs/anyspend/react/components/checkout/CheckoutSuccess.js +3 -3
  7. package/dist/cjs/anyspend/react/components/checkout/CryptoPayPanel.js +43 -23
  8. package/dist/cjs/anyspend/react/components/common/CryptoPaymentMethod.d.ts +8 -0
  9. package/dist/cjs/anyspend/react/components/common/CryptoPaymentMethod.js +10 -9
  10. package/dist/cjs/anyspend/react/components/common/InsufficientDepositPayment.js +2 -2
  11. package/dist/cjs/anyspend/react/components/common/OrderDetails.js +2 -2
  12. package/dist/cjs/anyspend/react/components/common/OrderDetailsCollapsible.js +2 -2
  13. package/dist/cjs/anyspend/react/components/common/TransferCryptoDetails.js +2 -2
  14. package/dist/cjs/anyspend/utils/chain.js +8 -7
  15. package/dist/cjs/app.shared.js +9 -7
  16. package/dist/cjs/global-account/better-auth-client.d.ts +1883 -0
  17. package/dist/cjs/global-account/better-auth-client.js +17 -0
  18. package/dist/cjs/global-account/bsmnt.d.ts +0 -1
  19. package/dist/cjs/global-account/bsmnt.js +0 -6
  20. package/dist/cjs/global-account/react/components/B3DynamicModal.js +3 -0
  21. package/dist/cjs/global-account/react/components/B3Provider/B3ConfigProvider.d.ts +4 -1
  22. package/dist/cjs/global-account/react/components/B3Provider/B3ConfigProvider.js +2 -1
  23. package/dist/cjs/global-account/react/components/B3Provider/B3Provider.d.ts +8 -1
  24. package/dist/cjs/global-account/react/components/B3Provider/B3Provider.js +9 -12
  25. package/dist/cjs/global-account/react/components/B3Provider/B3Provider.native.js +6 -9
  26. package/dist/cjs/global-account/react/components/B3Provider/BetterAuthProvider.d.ts +16 -0
  27. package/dist/cjs/global-account/react/components/B3Provider/BetterAuthProvider.js +120 -0
  28. package/dist/cjs/global-account/react/components/B3Provider/LocalSDKProvider.d.ts +3 -1
  29. package/dist/cjs/global-account/react/components/B3Provider/LocalSDKProvider.js +3 -1
  30. package/dist/cjs/global-account/react/components/IPFSMediaRenderer/IPFSMediaRenderer.d.ts +3 -1
  31. package/dist/cjs/global-account/react/components/IPFSMediaRenderer/IPFSMediaRenderer.js +4 -2
  32. package/dist/cjs/global-account/react/components/LinkAccount/LinkedAccountItem.js +2 -1
  33. package/dist/cjs/global-account/react/components/ManageAccount/ProfileSection.js +15 -6
  34. package/dist/cjs/global-account/react/components/ManageAccount/SessionDurationContent.d.ts +5 -0
  35. package/dist/cjs/global-account/react/components/ManageAccount/SessionDurationContent.js +57 -0
  36. package/dist/cjs/global-account/react/components/ManageAccount/SettingsContent.js +12 -29
  37. package/dist/cjs/global-account/react/components/ManageAccount/SettingsProfileCard.js +2 -2
  38. package/dist/cjs/global-account/react/components/Send/Send.js +5 -2
  39. package/dist/cjs/global-account/react/components/SignInWithB3/BetterAuthResetPassword.d.ts +21 -0
  40. package/dist/cjs/global-account/react/components/SignInWithB3/BetterAuthResetPassword.js +67 -0
  41. package/dist/cjs/global-account/react/components/SignInWithB3/BetterAuthSignIn.d.ts +34 -0
  42. package/dist/cjs/global-account/react/components/SignInWithB3/BetterAuthSignIn.js +163 -0
  43. package/dist/cjs/global-account/react/components/SignInWithB3/SignInWithB3Flow.js +13 -4
  44. package/dist/cjs/global-account/react/components/SignInWithB3/steps/LoginStepBetterAuth.d.ts +6 -0
  45. package/dist/cjs/global-account/react/components/SignInWithB3/steps/LoginStepBetterAuth.js +138 -0
  46. package/dist/cjs/global-account/react/components/SignInWithB3/utils/signInUtils.js +5 -1
  47. package/dist/cjs/global-account/react/components/SingleUserSearchSelector/SingleUserSearchSelector.js +2 -1
  48. package/dist/cjs/global-account/react/components/custom/Button.d.ts +1 -1
  49. package/dist/cjs/global-account/react/components/index.d.ts +3 -0
  50. package/dist/cjs/global-account/react/components/index.js +7 -3
  51. package/dist/cjs/global-account/react/components/ui/button.d.ts +1 -1
  52. package/dist/cjs/global-account/react/hooks/index.d.ts +1 -0
  53. package/dist/cjs/global-account/react/hooks/index.js +5 -2
  54. package/dist/cjs/global-account/react/hooks/useAuth.js +24 -11
  55. package/dist/cjs/global-account/react/hooks/useAuthentication.js +21 -8
  56. package/dist/cjs/global-account/react/hooks/useBetterAuth.d.ts +973 -0
  57. package/dist/cjs/global-account/react/hooks/useBetterAuth.js +157 -0
  58. package/dist/cjs/global-account/react/hooks/useFirstEOA.d.ts +8 -8
  59. package/dist/cjs/global-account/react/stores/useModalStore.d.ts +10 -1
  60. package/dist/cjs/global-account/react/utils/createWagmiConfig.d.ts +4 -13
  61. package/dist/cjs/global-account/react/utils/createWagmiConfig.js +5 -7
  62. package/dist/cjs/global-account/react/utils/index.d.ts +0 -1
  63. package/dist/cjs/global-account/react/utils/index.js +0 -1
  64. package/dist/cjs/global-account/react/utils/profileDisplay.js +17 -18
  65. package/dist/cjs/shared/constants/chains/b3Chain.d.ts +7 -7
  66. package/dist/cjs/shared/constants/chains/b3Chain.js +4 -4
  67. package/dist/cjs/shared/constants/chains/b3Viem.d.ts +6 -0
  68. package/dist/cjs/shared/constants/chains/b3Viem.js +19 -0
  69. package/dist/cjs/shared/constants/chains/supported.d.ts +1 -1
  70. package/dist/cjs/shared/generated/chain-networks.json +2 -2
  71. package/dist/cjs/shared/utils/chains.d.ts +1 -1
  72. package/dist/cjs/shared/utils/chains.js +2 -2
  73. package/dist/cjs/shared/utils/session-duration.d.ts +15 -0
  74. package/dist/cjs/shared/utils/session-duration.js +69 -0
  75. package/dist/cjs/wallet/react/components/ConnectWallet.d.ts +11 -0
  76. package/dist/cjs/wallet/react/components/ConnectWallet.js +467 -0
  77. package/dist/cjs/wallet/react/components/WalletProvider.d.ts +35 -0
  78. package/dist/cjs/wallet/react/components/WalletProvider.js +20 -0
  79. package/dist/cjs/wallet/react/hooks/useWalletDisconnect.d.ts +13 -0
  80. package/dist/cjs/wallet/react/hooks/useWalletDisconnect.js +22 -0
  81. package/dist/cjs/wallet/react/hooks/useWalletState.d.ts +31 -0
  82. package/dist/cjs/wallet/react/hooks/useWalletState.js +63 -0
  83. package/dist/cjs/wallet/react/index.d.ts +5 -0
  84. package/dist/cjs/wallet/react/index.js +16 -0
  85. package/dist/cjs/wallet/utils/createWalletConfig.d.ts +21 -0
  86. package/dist/cjs/wallet/utils/createWalletConfig.js +24 -0
  87. package/dist/esm/anyspend/constants/rpc.d.ts +1 -1
  88. package/dist/esm/anyspend/constants/rpc.js +1 -1
  89. package/dist/esm/anyspend/react/components/AnySpendNFT.js +2 -2
  90. package/dist/esm/anyspend/react/components/checkout/AnySpendCheckout.d.ts +3 -1
  91. package/dist/esm/anyspend/react/components/checkout/AnySpendCheckout.js +10 -2
  92. package/dist/esm/anyspend/react/components/checkout/CheckoutSuccess.js +3 -3
  93. package/dist/esm/anyspend/react/components/checkout/CryptoPayPanel.js +44 -24
  94. package/dist/esm/anyspend/react/components/common/CryptoPaymentMethod.d.ts +8 -0
  95. package/dist/esm/anyspend/react/components/common/CryptoPaymentMethod.js +9 -8
  96. package/dist/esm/anyspend/react/components/common/InsufficientDepositPayment.js +2 -2
  97. package/dist/esm/anyspend/react/components/common/OrderDetails.js +2 -2
  98. package/dist/esm/anyspend/react/components/common/OrderDetailsCollapsible.js +2 -2
  99. package/dist/esm/anyspend/react/components/common/TransferCryptoDetails.js +2 -2
  100. package/dist/esm/anyspend/utils/chain.js +10 -9
  101. package/dist/esm/app.shared.js +9 -7
  102. package/dist/esm/global-account/better-auth-client.d.ts +1883 -0
  103. package/dist/esm/global-account/better-auth-client.js +13 -0
  104. package/dist/esm/global-account/bsmnt.d.ts +0 -1
  105. package/dist/esm/global-account/bsmnt.js +0 -5
  106. package/dist/esm/global-account/react/components/B3DynamicModal.js +3 -0
  107. package/dist/esm/global-account/react/components/B3Provider/B3ConfigProvider.d.ts +4 -1
  108. package/dist/esm/global-account/react/components/B3Provider/B3ConfigProvider.js +2 -1
  109. package/dist/esm/global-account/react/components/B3Provider/B3Provider.d.ts +8 -1
  110. package/dist/esm/global-account/react/components/B3Provider/B3Provider.js +4 -7
  111. package/dist/esm/global-account/react/components/B3Provider/B3Provider.native.js +2 -5
  112. package/dist/esm/global-account/react/components/B3Provider/BetterAuthProvider.d.ts +16 -0
  113. package/dist/esm/global-account/react/components/B3Provider/BetterAuthProvider.js +115 -0
  114. package/dist/esm/global-account/react/components/B3Provider/LocalSDKProvider.d.ts +3 -1
  115. package/dist/esm/global-account/react/components/B3Provider/LocalSDKProvider.js +3 -1
  116. package/dist/esm/global-account/react/components/IPFSMediaRenderer/IPFSMediaRenderer.d.ts +3 -1
  117. package/dist/esm/global-account/react/components/IPFSMediaRenderer/IPFSMediaRenderer.js +4 -2
  118. package/dist/esm/global-account/react/components/LinkAccount/LinkedAccountItem.js +2 -1
  119. package/dist/esm/global-account/react/components/ManageAccount/ProfileSection.js +13 -7
  120. package/dist/esm/global-account/react/components/ManageAccount/SessionDurationContent.d.ts +5 -0
  121. package/dist/esm/global-account/react/components/ManageAccount/SessionDurationContent.js +52 -0
  122. package/dist/esm/global-account/react/components/ManageAccount/SettingsContent.js +12 -29
  123. package/dist/esm/global-account/react/components/ManageAccount/SettingsProfileCard.js +2 -2
  124. package/dist/esm/global-account/react/components/Send/Send.js +5 -2
  125. package/dist/esm/global-account/react/components/SignInWithB3/BetterAuthResetPassword.d.ts +21 -0
  126. package/dist/esm/global-account/react/components/SignInWithB3/BetterAuthResetPassword.js +64 -0
  127. package/dist/esm/global-account/react/components/SignInWithB3/BetterAuthSignIn.d.ts +34 -0
  128. package/dist/esm/global-account/react/components/SignInWithB3/BetterAuthSignIn.js +160 -0
  129. package/dist/esm/global-account/react/components/SignInWithB3/SignInWithB3Flow.js +13 -4
  130. package/dist/esm/global-account/react/components/SignInWithB3/steps/LoginStepBetterAuth.d.ts +6 -0
  131. package/dist/esm/global-account/react/components/SignInWithB3/steps/LoginStepBetterAuth.js +135 -0
  132. package/dist/esm/global-account/react/components/SignInWithB3/utils/signInUtils.js +5 -1
  133. package/dist/esm/global-account/react/components/SingleUserSearchSelector/SingleUserSearchSelector.js +2 -1
  134. package/dist/esm/global-account/react/components/custom/Button.d.ts +1 -1
  135. package/dist/esm/global-account/react/components/index.d.ts +3 -0
  136. package/dist/esm/global-account/react/components/index.js +2 -0
  137. package/dist/esm/global-account/react/components/ui/button.d.ts +1 -1
  138. package/dist/esm/global-account/react/hooks/index.d.ts +1 -0
  139. package/dist/esm/global-account/react/hooks/index.js +1 -0
  140. package/dist/esm/global-account/react/hooks/useAuth.js +24 -11
  141. package/dist/esm/global-account/react/hooks/useAuthentication.js +21 -8
  142. package/dist/esm/global-account/react/hooks/useBetterAuth.d.ts +973 -0
  143. package/dist/esm/global-account/react/hooks/useBetterAuth.js +149 -0
  144. package/dist/esm/global-account/react/hooks/useFirstEOA.d.ts +8 -8
  145. package/dist/esm/global-account/react/stores/useModalStore.d.ts +10 -1
  146. package/dist/esm/global-account/react/utils/createWagmiConfig.d.ts +4 -13
  147. package/dist/esm/global-account/react/utils/createWagmiConfig.js +5 -7
  148. package/dist/esm/global-account/react/utils/index.d.ts +0 -1
  149. package/dist/esm/global-account/react/utils/index.js +0 -1
  150. package/dist/esm/global-account/react/utils/profileDisplay.js +17 -18
  151. package/dist/esm/shared/constants/chains/b3Chain.d.ts +7 -7
  152. package/dist/esm/shared/constants/chains/b3Chain.js +4 -4
  153. package/dist/esm/shared/constants/chains/b3Viem.d.ts +6 -0
  154. package/dist/esm/shared/constants/chains/b3Viem.js +16 -0
  155. package/dist/esm/shared/constants/chains/supported.d.ts +1 -1
  156. package/dist/esm/shared/generated/chain-networks.json +2 -2
  157. package/dist/esm/shared/utils/chains.d.ts +1 -1
  158. package/dist/esm/shared/utils/chains.js +2 -2
  159. package/dist/esm/shared/utils/session-duration.d.ts +15 -0
  160. package/dist/esm/shared/utils/session-duration.js +64 -0
  161. package/dist/esm/wallet/react/components/ConnectWallet.d.ts +11 -0
  162. package/dist/esm/wallet/react/components/ConnectWallet.js +431 -0
  163. package/dist/esm/wallet/react/components/WalletProvider.d.ts +35 -0
  164. package/dist/esm/wallet/react/components/WalletProvider.js +17 -0
  165. package/dist/esm/wallet/react/hooks/useWalletDisconnect.d.ts +13 -0
  166. package/dist/esm/wallet/react/hooks/useWalletDisconnect.js +19 -0
  167. package/dist/esm/wallet/react/hooks/useWalletState.d.ts +31 -0
  168. package/dist/esm/wallet/react/hooks/useWalletState.js +60 -0
  169. package/dist/esm/wallet/react/index.d.ts +5 -0
  170. package/dist/esm/wallet/react/index.js +8 -0
  171. package/dist/esm/wallet/utils/createWalletConfig.d.ts +21 -0
  172. package/dist/esm/wallet/utils/createWalletConfig.js +21 -0
  173. package/dist/styles/index.css +1 -1
  174. package/dist/types/anyspend/constants/rpc.d.ts +1 -1
  175. package/dist/types/anyspend/react/components/checkout/AnySpendCheckout.d.ts +3 -1
  176. package/dist/types/anyspend/react/components/common/CryptoPaymentMethod.d.ts +8 -0
  177. package/dist/types/global-account/better-auth-client.d.ts +1883 -0
  178. package/dist/types/global-account/bsmnt.d.ts +0 -1
  179. package/dist/types/global-account/react/components/B3Provider/B3ConfigProvider.d.ts +4 -1
  180. package/dist/types/global-account/react/components/B3Provider/B3Provider.d.ts +8 -1
  181. package/dist/types/global-account/react/components/B3Provider/BetterAuthProvider.d.ts +16 -0
  182. package/dist/types/global-account/react/components/B3Provider/LocalSDKProvider.d.ts +3 -1
  183. package/dist/types/global-account/react/components/IPFSMediaRenderer/IPFSMediaRenderer.d.ts +3 -1
  184. package/dist/types/global-account/react/components/ManageAccount/SessionDurationContent.d.ts +5 -0
  185. package/dist/types/global-account/react/components/SignInWithB3/BetterAuthResetPassword.d.ts +21 -0
  186. package/dist/types/global-account/react/components/SignInWithB3/BetterAuthSignIn.d.ts +34 -0
  187. package/dist/types/global-account/react/components/SignInWithB3/steps/LoginStepBetterAuth.d.ts +6 -0
  188. package/dist/types/global-account/react/components/custom/Button.d.ts +1 -1
  189. package/dist/types/global-account/react/components/index.d.ts +3 -0
  190. package/dist/types/global-account/react/components/ui/button.d.ts +1 -1
  191. package/dist/types/global-account/react/hooks/index.d.ts +1 -0
  192. package/dist/types/global-account/react/hooks/useBetterAuth.d.ts +973 -0
  193. package/dist/types/global-account/react/hooks/useFirstEOA.d.ts +8 -8
  194. package/dist/types/global-account/react/stores/useModalStore.d.ts +10 -1
  195. package/dist/types/global-account/react/utils/createWagmiConfig.d.ts +4 -13
  196. package/dist/types/global-account/react/utils/index.d.ts +0 -1
  197. package/dist/types/shared/constants/chains/b3Chain.d.ts +7 -7
  198. package/dist/types/shared/constants/chains/b3Viem.d.ts +6 -0
  199. package/dist/types/shared/constants/chains/supported.d.ts +1 -1
  200. package/dist/types/shared/utils/chains.d.ts +1 -1
  201. package/dist/types/shared/utils/session-duration.d.ts +15 -0
  202. package/dist/types/wallet/react/components/ConnectWallet.d.ts +11 -0
  203. package/dist/types/wallet/react/components/WalletProvider.d.ts +35 -0
  204. package/dist/types/wallet/react/hooks/useWalletDisconnect.d.ts +13 -0
  205. package/dist/types/wallet/react/hooks/useWalletState.d.ts +31 -0
  206. package/dist/types/wallet/react/index.d.ts +5 -0
  207. package/dist/types/wallet/utils/createWalletConfig.d.ts +21 -0
  208. package/package.json +14 -6
  209. package/src/anyspend/constants/rpc.ts +2 -1
  210. package/src/anyspend/react/components/AnySpendNFT.tsx +2 -2
  211. package/src/anyspend/react/components/checkout/AnySpendCheckout.tsx +15 -1
  212. package/src/anyspend/react/components/checkout/CheckoutSuccess.tsx +3 -3
  213. package/src/anyspend/react/components/checkout/CryptoPayPanel.tsx +45 -27
  214. package/src/anyspend/react/components/common/CryptoPaymentMethod.tsx +10 -8
  215. package/src/anyspend/react/components/common/InsufficientDepositPayment.tsx +2 -2
  216. package/src/anyspend/react/components/common/OrderDetails.tsx +2 -2
  217. package/src/anyspend/react/components/common/OrderDetailsCollapsible.tsx +4 -4
  218. package/src/anyspend/react/components/common/TransferCryptoDetails.tsx +2 -2
  219. package/src/anyspend/utils/chain.ts +9 -9
  220. package/src/app.shared.ts +9 -8
  221. package/src/global-account/better-auth-client.ts +17 -0
  222. package/src/global-account/bsmnt.ts +0 -6
  223. package/src/global-account/react/components/B3DynamicModal.tsx +3 -0
  224. package/src/global-account/react/components/B3Provider/B3ConfigProvider.tsx +6 -0
  225. package/src/global-account/react/components/B3Provider/B3Provider.native.tsx +14 -20
  226. package/src/global-account/react/components/B3Provider/B3Provider.tsx +52 -40
  227. package/src/global-account/react/components/B3Provider/BetterAuthProvider.tsx +127 -0
  228. package/src/global-account/react/components/B3Provider/LocalSDKProvider.tsx +5 -0
  229. package/src/global-account/react/components/IPFSMediaRenderer/IPFSMediaRenderer.tsx +17 -10
  230. package/src/global-account/react/components/LinkAccount/LinkedAccountItem.tsx +2 -1
  231. package/src/global-account/react/components/ManageAccount/ProfileSection.tsx +29 -11
  232. package/src/global-account/react/components/ManageAccount/SessionDurationContent.tsx +107 -0
  233. package/src/global-account/react/components/ManageAccount/SettingsContent.tsx +28 -30
  234. package/src/global-account/react/components/ManageAccount/SettingsProfileCard.tsx +2 -2
  235. package/src/global-account/react/components/Send/Send.tsx +8 -5
  236. package/src/global-account/react/components/SignInWithB3/BetterAuthResetPassword.tsx +146 -0
  237. package/src/global-account/react/components/SignInWithB3/BetterAuthSignIn.tsx +426 -0
  238. package/src/global-account/react/components/SignInWithB3/SignInWithB3Flow.tsx +13 -4
  239. package/src/global-account/react/components/SignInWithB3/steps/LoginStepBetterAuth.tsx +308 -0
  240. package/src/global-account/react/components/SignInWithB3/utils/signInUtils.ts +5 -1
  241. package/src/global-account/react/components/SingleUserSearchSelector/SingleUserSearchSelector.tsx +2 -1
  242. package/src/global-account/react/components/index.ts +3 -0
  243. package/src/global-account/react/hooks/index.ts +1 -0
  244. package/src/global-account/react/hooks/useAuth.ts +24 -11
  245. package/src/global-account/react/hooks/useAuthentication.ts +21 -8
  246. package/src/global-account/react/hooks/useBetterAuth.ts +191 -0
  247. package/src/global-account/react/stores/useModalStore.ts +11 -0
  248. package/src/global-account/react/utils/createWagmiConfig.tsx +6 -7
  249. package/src/global-account/react/utils/index.ts +0 -1
  250. package/src/global-account/react/utils/profileDisplay.ts +21 -19
  251. package/src/shared/constants/chains/b3Chain.ts +5 -5
  252. package/src/shared/constants/chains/b3Viem.ts +18 -0
  253. package/src/shared/generated/chain-networks.json +2 -2
  254. package/src/shared/utils/chains.ts +3 -2
  255. package/src/shared/utils/session-duration.ts +64 -0
  256. package/src/wallet/__tests__/createWalletConfig.test.ts +39 -0
  257. package/src/wallet/react/components/ConnectWallet.tsx +665 -0
  258. package/src/wallet/react/components/WalletProvider.tsx +64 -0
  259. package/src/wallet/react/hooks/useWalletDisconnect.ts +22 -0
  260. package/src/wallet/react/hooks/useWalletState.ts +93 -0
  261. package/src/wallet/react/index.ts +10 -0
  262. package/src/wallet/utils/createWalletConfig.ts +39 -0
  263. package/dist/cjs/global-account/react/components/AvatarCreator/AvatarCreator.d.ts +0 -6
  264. package/dist/cjs/global-account/react/components/AvatarCreator/AvatarCreator.js +0 -54
  265. package/dist/cjs/global-account/react/components/ProfileAvatar.d.ts +0 -0
  266. package/dist/cjs/global-account/react/components/ProfileAvatar.js +0 -127
  267. package/dist/cjs/global-account/react/hooks/useRPMToken.d.ts +0 -7
  268. package/dist/cjs/global-account/react/hooks/useRPMToken.js +0 -11
  269. package/dist/cjs/global-account/react/utils/updateAvatar.d.ts +0 -4
  270. package/dist/cjs/global-account/react/utils/updateAvatar.js +0 -54
  271. package/dist/esm/global-account/react/components/AvatarCreator/AvatarCreator.d.ts +0 -6
  272. package/dist/esm/global-account/react/components/AvatarCreator/AvatarCreator.js +0 -51
  273. package/dist/esm/global-account/react/components/ProfileAvatar.d.ts +0 -0
  274. package/dist/esm/global-account/react/components/ProfileAvatar.js +0 -127
  275. package/dist/esm/global-account/react/hooks/useRPMToken.d.ts +0 -7
  276. package/dist/esm/global-account/react/hooks/useRPMToken.js +0 -8
  277. package/dist/esm/global-account/react/utils/updateAvatar.d.ts +0 -4
  278. package/dist/esm/global-account/react/utils/updateAvatar.js +0 -18
  279. package/dist/types/global-account/react/components/AvatarCreator/AvatarCreator.d.ts +0 -6
  280. package/dist/types/global-account/react/components/ProfileAvatar.d.ts +0 -0
  281. package/dist/types/global-account/react/hooks/useRPMToken.d.ts +0 -7
  282. package/dist/types/global-account/react/utils/updateAvatar.d.ts +0 -4
  283. package/src/global-account/react/components/AvatarCreator/AvatarCreator.tsx +0 -90
  284. package/src/global-account/react/components/ProfileAvatar.tsx +0 -138
  285. package/src/global-account/react/hooks/useRPMToken.ts +0 -17
  286. package/src/global-account/react/utils/updateAvatar.ts +0 -21
@@ -9,6 +9,7 @@ import {
9
9
  useSimBalance,
10
10
  useUnifiedChainSwitchAndExecute,
11
11
  } from "@b3dotfun/sdk/global-account/react";
12
+ import { validateImageUrl } from "@b3dotfun/sdk/global-account/react/utils/profileDisplay";
12
13
  import { formatDisplayNumber, formatTokenAmount } from "@b3dotfun/sdk/shared/utils/number";
13
14
  import invariant from "invariant";
14
15
  import { CircleHelp, Clock, Loader2, Send as SendIcon, Wallet } from "lucide-react";
@@ -32,6 +33,7 @@ type SendStep = "recipient" | "token" | "amount" | "confirm" | "success";
32
33
  // Component for displaying a recent address with profile data
33
34
  function RecentAddressItem({ address, onClick }: { address: string; onClick: () => void }) {
34
35
  const { data: profileData } = useProfile({ address });
36
+ const validatedAvatar = validateImageUrl(profileData?.avatar);
35
37
 
36
38
  return (
37
39
  <button
@@ -39,8 +41,8 @@ function RecentAddressItem({ address, onClick }: { address: string; onClick: ()
39
41
  className="flex items-center gap-2 rounded-xl px-3 py-2 transition-colors hover:bg-[#fafafa]"
40
42
  >
41
43
  {/* Avatar */}
42
- {profileData?.avatar ? (
43
- <img src={profileData.avatar} alt={profileData.name || address} className="h-10 w-10 rounded-full" />
44
+ {validatedAvatar ? (
45
+ <img src={validatedAvatar} alt={profileData?.name || address} className="h-10 w-10 rounded-full" />
44
46
  ) : (
45
47
  <div className="flex h-10 w-10 items-center justify-center rounded-full border border-[#e4e4e7] bg-[#f4f4f5]">
46
48
  <Wallet className="h-5 w-5 text-[#a0a0ab]" />
@@ -84,6 +86,7 @@ export function Send({ recipientAddress: initialRecipient, onSuccess }: SendModa
84
86
  const { data: validatedProfileData } = useProfile({
85
87
  address: showValidatedResult && recipientAddress && isAddress(recipientAddress) ? recipientAddress : undefined,
86
88
  });
89
+ const validatedRecipientAvatar = validateImageUrl(validatedProfileData?.avatar);
87
90
 
88
91
  // Address validation
89
92
  const handleRecipientAddressChange = (value: string) => {
@@ -290,10 +293,10 @@ export function Send({ recipientAddress: initialRecipient, onSuccess }: SendModa
290
293
  className="dark:bg-b3-background dark:border-b3-line flex items-center gap-2 rounded-xl bg-[#f4f4f5] px-3 py-2 transition-colors hover:bg-[#e4e4e7]"
291
294
  >
292
295
  {/* Avatar */}
293
- {validatedProfileData?.avatar ? (
296
+ {validatedRecipientAvatar ? (
294
297
  <img
295
- src={validatedProfileData.avatar}
296
- alt={validatedProfileData.name || recipientAddress}
298
+ src={validatedRecipientAvatar}
299
+ alt={validatedProfileData?.name || recipientAddress}
297
300
  className="h-10 w-10 rounded-full"
298
301
  />
299
302
  ) : (
@@ -0,0 +1,146 @@
1
+ import { Button, Input } from "@b3dotfun/sdk/global-account/react";
2
+ import { debugB3React } from "@b3dotfun/sdk/shared/utils/debug";
3
+ import { useState } from "react";
4
+ import { useBetterAuth } from "../../hooks/useBetterAuth";
5
+
6
+ const debug = debugB3React("BetterAuthResetPassword");
7
+
8
+ export interface BetterAuthResetPasswordProps {
9
+ /** The reset token from the URL query param */
10
+ token: string;
11
+ /** Called after password is successfully reset */
12
+ onSuccess?: () => void;
13
+ /** Called on error */
14
+ onError?: (error: Error) => void;
15
+ /** Optional class name */
16
+ className?: string;
17
+ }
18
+
19
+ /**
20
+ * Standalone reset password form. Render this on your reset password page.
21
+ * Reads the token from props (extract it from the URL query string).
22
+ *
23
+ * Usage:
24
+ * ```tsx
25
+ * const token = new URLSearchParams(window.location.search).get("token");
26
+ * <BetterAuthResetPassword token={token} onSuccess={() => navigate("/login")} />
27
+ * ```
28
+ */
29
+ export function BetterAuthResetPassword({ token, onSuccess, onError, className }: BetterAuthResetPasswordProps) {
30
+ const { resetPassword } = useBetterAuth();
31
+
32
+ const [password, setPassword] = useState("");
33
+ const [confirmPassword, setConfirmPassword] = useState("");
34
+ const [isLoading, setIsLoading] = useState(false);
35
+ const [error, setError] = useState<string | null>(null);
36
+ const [success, setSuccess] = useState(false);
37
+
38
+ const handleSubmit = async () => {
39
+ if (!password) {
40
+ setError("Please enter a new password");
41
+ return;
42
+ }
43
+
44
+ if (password.length < 8) {
45
+ setError("Password must be at least 8 characters");
46
+ return;
47
+ }
48
+
49
+ if (password !== confirmPassword) {
50
+ setError("Passwords do not match");
51
+ return;
52
+ }
53
+
54
+ try {
55
+ setIsLoading(true);
56
+ setError(null);
57
+ await resetPassword(password, token);
58
+ setSuccess(true);
59
+ debug("Password reset successful");
60
+ onSuccess?.();
61
+ } catch (err) {
62
+ const message = err instanceof Error ? err.message : "Password reset failed";
63
+ setError(message);
64
+ debug("Password reset failed", err);
65
+ onError?.(err as Error);
66
+ } finally {
67
+ setPassword("");
68
+ setConfirmPassword("");
69
+ setIsLoading(false);
70
+ }
71
+ };
72
+
73
+ if (!token) {
74
+ return (
75
+ <div className={`w-full max-w-[400px] px-6 text-center ${className || ""}`}>
76
+ <p className="text-sm text-red-500">Invalid or missing reset token.</p>
77
+ </div>
78
+ );
79
+ }
80
+
81
+ return (
82
+ <div className={`w-full max-w-[400px] px-6 ${className || ""}`}>
83
+ <div className="mb-10 text-center">
84
+ <h1 className="text-[28px] font-semibold tracking-tight text-gray-900 dark:text-gray-100">
85
+ {success ? "Password reset" : "Set new password"}
86
+ </h1>
87
+ <p className="mt-3 text-[15px] text-gray-500 dark:text-gray-400">
88
+ {success ? "Your password has been updated." : "Enter your new password below."}
89
+ </p>
90
+ </div>
91
+
92
+ {success ? (
93
+ <div className="space-y-4 text-center">
94
+ <div className="mx-auto flex h-12 w-12 items-center justify-center rounded-full bg-green-100">
95
+ <svg className="h-6 w-6 text-green-600" fill="none" viewBox="0 0 24 24" stroke="currentColor">
96
+ <path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M5 13l4 4L19 7" />
97
+ </svg>
98
+ </div>
99
+ </div>
100
+ ) : (
101
+ <div className="space-y-5">
102
+ <div>
103
+ <label className="mb-2 block text-xs font-medium uppercase tracking-wide text-gray-700 dark:text-gray-300">
104
+ New password
105
+ </label>
106
+ <Input
107
+ type="password"
108
+ placeholder="At least 8 characters"
109
+ value={password}
110
+ onChange={e => setPassword(e.target.value)}
111
+ disabled={isLoading}
112
+ className="h-11 px-4 text-[15px]"
113
+ />
114
+ </div>
115
+
116
+ <div>
117
+ <label className="mb-2 block text-xs font-medium uppercase tracking-wide text-gray-700 dark:text-gray-300">
118
+ Confirm password
119
+ </label>
120
+ <Input
121
+ type="password"
122
+ placeholder="Repeat your password"
123
+ value={confirmPassword}
124
+ onChange={e => setConfirmPassword(e.target.value)}
125
+ disabled={isLoading}
126
+ onKeyDown={e => {
127
+ if (e.key === "Enter") handleSubmit();
128
+ }}
129
+ className="h-11 px-4 text-[15px]"
130
+ />
131
+ </div>
132
+
133
+ {error && <p className="text-sm text-red-500">{error}</p>}
134
+
135
+ <Button
136
+ onClick={handleSubmit}
137
+ disabled={isLoading}
138
+ 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"
139
+ >
140
+ {isLoading ? "Resetting..." : "Reset password"}
141
+ </Button>
142
+ </div>
143
+ )}
144
+ </div>
145
+ );
146
+ }
@@ -0,0 +1,426 @@
1
+ import { Button, Input, useAuthStore } from "@b3dotfun/sdk/global-account/react";
2
+ import { debugB3React } from "@b3dotfun/sdk/shared/utils/debug";
3
+ import { useState } from "react";
4
+ import {
5
+ EmailVerificationRequiredError,
6
+ type BetterAuthSocialProvider,
7
+ useBetterAuth,
8
+ } from "../../hooks/useBetterAuth";
9
+ import { strategyIcons, strategyLabels } from "./utils/signInUtils";
10
+
11
+ const debug = debugB3React("BetterAuthSignIn");
12
+ const EMAIL_REGEX = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
13
+
14
+ type SocialProviderConfig = { id: BetterAuthSocialProvider; label: string };
15
+
16
+ const DEFAULT_SOCIAL_PROVIDERS: SocialProviderConfig[] = [
17
+ { id: "google", label: "Google" },
18
+ { id: "github", label: "GitHub" },
19
+ { id: "discord", label: "Discord" },
20
+ { id: "microsoft", label: "Microsoft" },
21
+ { id: "slack", label: "Slack" },
22
+ ];
23
+
24
+ export interface BetterAuthSignInProps {
25
+ /** Title displayed above the form. Default: "Welcome back" for sign-in, "Create an account" for sign-up */
26
+ title?: string;
27
+ /** Subtitle displayed below the title */
28
+ subtitle?: string;
29
+ /** Which social providers to show. Defaults to all. Pass empty array to hide. */
30
+ socialProviders?: BetterAuthSocialProvider[];
31
+ /** Show email/password form. Default: true */
32
+ showEmail?: boolean;
33
+ /** URL to redirect to after password reset link is clicked. Token is appended as ?token=... */
34
+ passwordResetRedirectTo?: string;
35
+ /** Called after successful authentication */
36
+ onSuccess?: () => void;
37
+ /** Called on authentication error */
38
+ onError?: (error: Error) => void;
39
+ /** Optional class name for the root container */
40
+ className?: string;
41
+ }
42
+
43
+ /**
44
+ * Standalone inline sign-in component for Better Auth.
45
+ *
46
+ * Renders directly — no modal, no button wrapper. Designed for full-page
47
+ * sign-in layouts (e.g., B3OS web with branding on the left, form on the right).
48
+ *
49
+ * Usage:
50
+ * ```tsx
51
+ * <BetterAuthSignIn
52
+ * socialProviders={["google", "github"]}
53
+ * onSuccess={() => router.push("/dashboard")}
54
+ * />
55
+ * ```
56
+ */
57
+ export function BetterAuthSignIn({
58
+ title,
59
+ subtitle = "Enter your credentials to access your account",
60
+ socialProviders = DEFAULT_SOCIAL_PROVIDERS.map(p => p.id),
61
+ showEmail = true,
62
+ passwordResetRedirectTo,
63
+ onSuccess,
64
+ onError,
65
+ className,
66
+ }: BetterAuthSignInProps) {
67
+ const { signInWithEmail, signUpWithEmail, signInWithSocial, requestPasswordReset } = useBetterAuth();
68
+ const isAuthenticated = useAuthStore(state => state.isAuthenticated);
69
+
70
+ const [mode, setMode] = useState<"sign-in" | "sign-up" | "forgot-password">("sign-in");
71
+ const [email, setEmail] = useState("");
72
+ const [password, setPassword] = useState("");
73
+ const [name, setName] = useState("");
74
+ const [isLoading, setIsLoading] = useState(false);
75
+ const [loadingProvider, setLoadingProvider] = useState<string | null>(null);
76
+ const [error, setError] = useState<string | null>(null);
77
+ const [resetEmailSent, setResetEmailSent] = useState(false);
78
+ const [verificationSent, setVerificationSent] = useState(false);
79
+
80
+ const resolvedTitle =
81
+ title ||
82
+ (mode === "forgot-password" ? "Reset password" : mode === "sign-in" ? "Welcome back" : "Create an account");
83
+
84
+ const resolvedSubtitle =
85
+ mode === "forgot-password"
86
+ ? "Enter your email and we'll send you a reset link"
87
+ : subtitle || "Enter your credentials to access your account";
88
+
89
+ const handleForgotPassword = async () => {
90
+ const normalizedEmail = email.trim().toLowerCase();
91
+
92
+ if (!EMAIL_REGEX.test(normalizedEmail)) {
93
+ setError("Please enter a valid email address");
94
+ return;
95
+ }
96
+
97
+ try {
98
+ setIsLoading(true);
99
+ setError(null);
100
+ await requestPasswordReset(normalizedEmail, passwordResetRedirectTo);
101
+ setResetEmailSent(true);
102
+ } catch (err) {
103
+ const message = err instanceof Error ? err.message : "Failed to send reset email";
104
+ setError(message);
105
+ } finally {
106
+ setIsLoading(false);
107
+ }
108
+ };
109
+
110
+ const providers: SocialProviderConfig[] = socialProviders
111
+ .map(id => DEFAULT_SOCIAL_PROVIDERS.find(p => p.id === id))
112
+ .filter((p): p is SocialProviderConfig => !!p);
113
+
114
+ if (isAuthenticated) {
115
+ return null;
116
+ }
117
+
118
+ const handleEmailSubmit = async () => {
119
+ const normalizedEmail = email.trim().toLowerCase();
120
+
121
+ if (!EMAIL_REGEX.test(normalizedEmail)) {
122
+ setError("Please enter a valid email address");
123
+ return;
124
+ }
125
+
126
+ if (!password) {
127
+ setError("Please enter a password");
128
+ return;
129
+ }
130
+
131
+ if (mode === "sign-up" && !name.trim()) {
132
+ setError("Please enter your name");
133
+ return;
134
+ }
135
+
136
+ try {
137
+ setIsLoading(true);
138
+ setError(null);
139
+
140
+ if (mode === "sign-up") {
141
+ await signUpWithEmail(normalizedEmail, password, name.trim());
142
+ } else {
143
+ await signInWithEmail(normalizedEmail, password);
144
+ }
145
+
146
+ debug("Auth successful");
147
+ onSuccess?.();
148
+ } catch (err) {
149
+ if (err instanceof EmailVerificationRequiredError) {
150
+ setVerificationSent(true);
151
+ setError(null);
152
+ } else {
153
+ const message = err instanceof Error ? err.message : "Authentication failed";
154
+ setError(message);
155
+ onError?.(err as Error);
156
+ }
157
+ debug("Auth failed", err);
158
+ } finally {
159
+ setPassword("");
160
+ setIsLoading(false);
161
+ }
162
+ };
163
+
164
+ const handleSocialSignIn = async (provider: BetterAuthSocialProvider) => {
165
+ try {
166
+ setIsLoading(true);
167
+ setLoadingProvider(provider);
168
+ setError(null);
169
+ await signInWithSocial(provider);
170
+ } catch (err) {
171
+ const message = err instanceof Error ? err.message : `Sign in failed`;
172
+ setError(message);
173
+ onError?.(err as Error);
174
+ setIsLoading(false);
175
+ setLoadingProvider(null);
176
+ }
177
+ };
178
+
179
+ if (verificationSent) {
180
+ return (
181
+ <div className={`w-full max-w-[400px] px-6 ${className || ""}`}>
182
+ <div className="flex flex-col items-center gap-6 text-center">
183
+ <div className="flex h-14 w-14 shrink-0 items-center justify-center rounded-full bg-green-100">
184
+ <svg
185
+ className="h-7 w-7 shrink-0 text-green-600"
186
+ fill="none"
187
+ viewBox="0 0 24 24"
188
+ stroke="currentColor"
189
+ width={28}
190
+ height={28}
191
+ >
192
+ <path
193
+ strokeLinecap="round"
194
+ strokeLinejoin="round"
195
+ strokeWidth={2}
196
+ d="M3 8l7.89 5.26a2 2 0 002.22 0L21 8M5 19h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v10a2 2 0 002 2z"
197
+ />
198
+ </svg>
199
+ </div>
200
+ <h2 className="text-[22px] font-semibold text-gray-900 dark:text-gray-100">Check your email</h2>
201
+ <p className="text-[15px] text-gray-500 dark:text-gray-400">
202
+ We sent a verification link to <span className="font-medium text-gray-700 dark:text-gray-200">{email}</span>
203
+ . Click the link to verify your account, then come back and sign in.
204
+ </p>
205
+ <button
206
+ onClick={() => {
207
+ setVerificationSent(false);
208
+ setMode("sign-in");
209
+ setPassword("");
210
+ }}
211
+ className="text-[14px] font-medium text-blue-600 hover:text-blue-500 dark:text-blue-400"
212
+ >
213
+ Back to sign in
214
+ </button>
215
+ </div>
216
+ </div>
217
+ );
218
+ }
219
+
220
+ return (
221
+ <div className={`w-full max-w-[400px] px-6 ${className || ""}`}>
222
+ {/* Header */}
223
+ <div className="mb-10 text-center">
224
+ <h1 className="text-[28px] font-semibold tracking-tight text-gray-900 dark:text-gray-100">{resolvedTitle}</h1>
225
+ <p className="mt-3 text-[15px] text-gray-500 dark:text-gray-400">{resolvedSubtitle}</p>
226
+ </div>
227
+
228
+ {/* Forgot password view */}
229
+ {mode === "forgot-password" && (
230
+ <div className="space-y-5">
231
+ {resetEmailSent ? (
232
+ <div className="space-y-4 text-center">
233
+ <div className="mx-auto flex h-12 w-12 items-center justify-center rounded-full bg-green-100">
234
+ <svg className="h-6 w-6 text-green-600" fill="none" viewBox="0 0 24 24" stroke="currentColor">
235
+ <path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M5 13l4 4L19 7" />
236
+ </svg>
237
+ </div>
238
+ <p className="text-[15px] text-gray-600 dark:text-gray-300">Check your email for a reset link.</p>
239
+ </div>
240
+ ) : (
241
+ <>
242
+ <div>
243
+ <label className="mb-2 block text-xs font-medium uppercase tracking-wide text-gray-700 dark:text-gray-300">
244
+ Email
245
+ </label>
246
+ <Input
247
+ type="email"
248
+ placeholder="name@company.com"
249
+ value={email}
250
+ onChange={e => setEmail(e.target.value)}
251
+ disabled={isLoading}
252
+ onKeyDown={e => {
253
+ if (e.key === "Enter") handleForgotPassword();
254
+ }}
255
+ className="h-11 px-4 text-[15px]"
256
+ />
257
+ </div>
258
+
259
+ {error && <p className="text-sm text-red-500">{error}</p>}
260
+
261
+ <Button
262
+ onClick={handleForgotPassword}
263
+ disabled={isLoading}
264
+ 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"
265
+ >
266
+ {isLoading ? "Sending..." : "Send reset link"}
267
+ </Button>
268
+ </>
269
+ )}
270
+
271
+ <p className="mt-8 text-center text-[14px] text-gray-500 dark:text-gray-400">
272
+ <button
273
+ onClick={() => {
274
+ setMode("sign-in");
275
+ setError(null);
276
+ setResetEmailSent(false);
277
+ }}
278
+ className="font-medium text-blue-600 hover:text-blue-500 dark:text-blue-400"
279
+ >
280
+ Back to sign in
281
+ </button>
282
+ </p>
283
+ </div>
284
+ )}
285
+
286
+ {/* Email/Password form */}
287
+ {showEmail && mode !== "forgot-password" && (
288
+ <div className="space-y-5">
289
+ {mode === "sign-up" && (
290
+ <div>
291
+ <label className="mb-2 block text-xs font-medium uppercase tracking-wide text-gray-700 dark:text-gray-300">
292
+ Name
293
+ </label>
294
+ <Input
295
+ type="text"
296
+ placeholder="Your name"
297
+ value={name}
298
+ onChange={e => setName(e.target.value)}
299
+ disabled={isLoading}
300
+ className="h-11 px-4 text-[15px]"
301
+ />
302
+ </div>
303
+ )}
304
+
305
+ <div>
306
+ <label className="mb-2 block text-xs font-medium uppercase tracking-wide text-gray-700 dark:text-gray-300">
307
+ Email
308
+ </label>
309
+ <Input
310
+ type="email"
311
+ placeholder="name@company.com"
312
+ value={email}
313
+ onChange={e => setEmail(e.target.value)}
314
+ disabled={isLoading}
315
+ className="h-11 px-4 text-[15px]"
316
+ />
317
+ </div>
318
+
319
+ <div>
320
+ <div className="mb-2 flex items-center justify-between">
321
+ <label className="block text-xs font-medium uppercase tracking-wide text-gray-700 dark:text-gray-300">
322
+ Password
323
+ </label>
324
+ {mode === "sign-in" && (
325
+ <button
326
+ type="button"
327
+ onClick={() => {
328
+ setMode("forgot-password");
329
+ setError(null);
330
+ }}
331
+ className="text-xs font-medium text-blue-600 hover:text-blue-500 dark:text-blue-400"
332
+ >
333
+ Forgot password?
334
+ </button>
335
+ )}
336
+ </div>
337
+ <Input
338
+ type="password"
339
+ placeholder="Password"
340
+ value={password}
341
+ onChange={e => setPassword(e.target.value)}
342
+ disabled={isLoading}
343
+ onKeyDown={e => {
344
+ if (e.key === "Enter") handleEmailSubmit();
345
+ }}
346
+ className="h-11 px-4 text-[15px]"
347
+ />
348
+ </div>
349
+
350
+ {error && <p className="text-sm text-red-500">{error}</p>}
351
+
352
+ <Button
353
+ onClick={handleEmailSubmit}
354
+ disabled={isLoading}
355
+ 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"
356
+ >
357
+ {isLoading ? "Loading..." : mode === "sign-in" ? "Sign in" : "Sign up"}
358
+ </Button>
359
+ </div>
360
+ )}
361
+
362
+ {/* Social providers */}
363
+ {providers.length > 0 && mode !== "forgot-password" && (
364
+ <>
365
+ {showEmail && (
366
+ <div className="my-8 flex items-center gap-4">
367
+ <div className="h-px flex-1 bg-gray-200 dark:bg-gray-700" />
368
+ <span className="text-xs text-gray-400">Or continue with</span>
369
+ <div className="h-px flex-1 bg-gray-200 dark:bg-gray-700" />
370
+ </div>
371
+ )}
372
+
373
+ <div className="space-y-4">
374
+ {providers.map(provider => {
375
+ const icon = strategyIcons[provider.id];
376
+ const label = strategyLabels[provider.id] || provider.label;
377
+
378
+ const isProviderLoading = loadingProvider === provider.id;
379
+
380
+ return (
381
+ <button
382
+ key={provider.id}
383
+ onClick={() => handleSocialSignIn(provider.id)}
384
+ disabled={isLoading}
385
+ style={{ paddingTop: "12px", paddingBottom: "12px" }}
386
+ className="flex w-full items-center justify-center gap-3 rounded-lg border border-gray-200 bg-white px-4 text-[14px] font-medium text-gray-700 transition-colors hover:bg-gray-50 disabled:opacity-50 dark:border-gray-700 dark:bg-gray-800 dark:text-gray-200 dark:hover:bg-gray-700"
387
+ >
388
+ {isProviderLoading ? (
389
+ <svg className="h-5 w-5 animate-spin text-gray-400" viewBox="0 0 24 24" fill="none">
390
+ <circle className="opacity-25" cx="12" cy="12" r="10" stroke="currentColor" strokeWidth="4" />
391
+ <path
392
+ className="opacity-75"
393
+ fill="currentColor"
394
+ d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"
395
+ />
396
+ </svg>
397
+ ) : (
398
+ icon && <img src={icon} alt="" className="h-5 w-5" />
399
+ )}
400
+ <span>{isProviderLoading ? "Redirecting..." : label}</span>
401
+ </button>
402
+ );
403
+ })}
404
+ </div>
405
+ </>
406
+ )}
407
+
408
+ {/* Toggle sign-in / sign-up */}
409
+ {showEmail && mode !== "forgot-password" && (
410
+ <p className="mt-8 text-center text-[14px] text-gray-500 dark:text-gray-400">
411
+ {mode === "sign-in" ? "Don't have an account? " : "Already have an account? "}
412
+ <button
413
+ onClick={() => {
414
+ setMode(mode === "sign-in" ? "sign-up" : "sign-in");
415
+ setError(null);
416
+ }}
417
+ disabled={isLoading}
418
+ className="font-medium text-blue-600 hover:text-blue-500 dark:text-blue-400"
419
+ >
420
+ {mode === "sign-in" ? "Sign up" : "Sign in"}
421
+ </button>
422
+ </p>
423
+ )}
424
+ </div>
425
+ );
426
+ }
@@ -7,6 +7,7 @@ import {
7
7
  useGetAllTWSigners,
8
8
  useModalStore,
9
9
  } from "@b3dotfun/sdk/global-account/react";
10
+ import { LoginStepBetterAuth } from "./steps/LoginStepBetterAuth";
10
11
  import { debugB3React } from "@b3dotfun/sdk/shared/utils/debug";
11
12
  import { useCallback, useEffect, useRef, useState } from "react";
12
13
  import { useActiveAccount } from "thirdweb/react";
@@ -34,7 +35,7 @@ export function SignInWithB3Flow({
34
35
  source = "signInWithB3Button",
35
36
  signersEnabled = false,
36
37
  }: SignInWithB3ModalProps) {
37
- const { automaticallySetFirstEoa } = useB3Config();
38
+ const { automaticallySetFirstEoa, authStrategy } = useB3Config();
38
39
  // skipAutoConnect: this component intentionally logs out on mount to show a fresh login screen.
39
40
  // AuthenticationProvider is the sole owner of useAutoConnect to avoid competing auth cycles.
40
41
  const { user, logout } = useAuthentication(partnerId, { skipAutoConnect: true });
@@ -42,10 +43,13 @@ export function SignInWithB3Flow({
42
43
  // Tracks whether the pre-login logout has finished.
43
44
  // We must not render ConnectEmbed until logout (wallet disconnect) completes,
44
45
  // otherwise the wallet state disrupts ConnectEmbed causing a blank modal.
45
- const [readyToShowLogin, setReadyToShowLogin] = useState(source === "requestPermissions");
46
+ const [readyToShowLogin, setReadyToShowLogin] = useState(
47
+ source === "requestPermissions" || authStrategy === "better-auth",
48
+ );
46
49
  const hasLoggedOutRef = useRef(false);
47
50
  useEffect(() => {
48
51
  if (hasLoggedOutRef.current) return;
52
+ if (authStrategy === "better-auth") return;
49
53
  if (source !== "requestPermissions") {
50
54
  debug("Logging out before login");
51
55
  hasLoggedOutRef.current = true;
@@ -53,7 +57,7 @@ export function SignInWithB3Flow({
53
57
  setReadyToShowLogin(true);
54
58
  });
55
59
  }
56
- }, [source, logout]);
60
+ }, [source, logout, authStrategy]);
57
61
 
58
62
  const [step, setStep] = useState<"login" | "permissions" | null>(source === "requestPermissions" ? null : "login");
59
63
  const [sessionKeyAdded, setSessionKeyAdded] = useState(source === "requestPermissions" ? true : false);
@@ -284,7 +288,12 @@ export function SignInWithB3Flow({
284
288
  } else if (step === "login") {
285
289
  // Show loading spinner while: authenticating, waiting for pre-login logout to finish,
286
290
  // or fetching signers.
287
- if (!readyToShowLogin || isAuthenticating || isFetchingSigners) {
291
+ if (authStrategy === "better-auth") {
292
+ // Better Auth manages its own loading/verification states internally.
293
+ // Don't gate on isAuthenticating — it would unmount the component
294
+ // and lose verification state when setIsAuthenticating(false) fires.
295
+ content = <LoginStepBetterAuth onSuccess={() => handleLoginSuccess({} as Account)} onError={onError} />;
296
+ } else if (!readyToShowLogin || isAuthenticating || isFetchingSigners) {
288
297
  content = (
289
298
  <LoginStepContainer partnerId={partnerId}>
290
299
  <div className="my-8 flex min-h-[350px] items-center justify-center">