@b3dotfun/sdk 0.1.69-alpha.2 → 0.1.69-alpha.20

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 (342) 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/AnySpendStakeB3.js +1 -1
  5. package/dist/cjs/anyspend/react/components/AnySpendStakeB3ExactIn.js +1 -1
  6. package/dist/cjs/anyspend/react/components/checkout/AnySpendCheckout.d.ts +3 -1
  7. package/dist/cjs/anyspend/react/components/checkout/AnySpendCheckout.js +10 -2
  8. package/dist/cjs/anyspend/react/components/checkout/CheckoutPaymentPanel.js +2 -4
  9. package/dist/cjs/anyspend/react/components/checkout/CheckoutSuccess.d.ts +2 -1
  10. package/dist/cjs/anyspend/react/components/checkout/CheckoutSuccess.js +5 -3
  11. package/dist/cjs/anyspend/react/components/checkout/CryptoPayPanel.js +43 -23
  12. package/dist/cjs/anyspend/react/components/checkout/FiatCheckoutPanel.js +1 -2
  13. package/dist/cjs/anyspend/react/components/checkout/KycGate.js +1 -2
  14. package/dist/cjs/anyspend/react/components/common/CryptoPaymentMethod.d.ts +8 -0
  15. package/dist/cjs/anyspend/react/components/common/CryptoPaymentMethod.js +10 -9
  16. package/dist/cjs/anyspend/react/components/common/InsufficientDepositPayment.js +2 -2
  17. package/dist/cjs/anyspend/react/components/common/OrderDetails.js +7 -2
  18. package/dist/cjs/anyspend/react/components/common/OrderDetailsCollapsible.js +2 -2
  19. package/dist/cjs/anyspend/react/components/common/OrderStatus.js +37 -6
  20. package/dist/cjs/anyspend/react/components/common/StepProgress.d.ts +2 -0
  21. package/dist/cjs/anyspend/react/components/common/StepProgress.js +7 -2
  22. package/dist/cjs/anyspend/react/components/common/TransferCryptoDetails.js +2 -2
  23. package/dist/cjs/anyspend/react/hooks/useAnyspendCreateOnrampOrder.js +4 -6
  24. package/dist/cjs/anyspend/react/hooks/useKycStatus.d.ts +3 -1
  25. package/dist/cjs/anyspend/react/hooks/useKycStatus.js +11 -7
  26. package/dist/cjs/anyspend/utils/chain.js +8 -7
  27. package/dist/cjs/app.shared.js +9 -7
  28. package/dist/cjs/global-account/better-auth-client.d.ts +1883 -0
  29. package/dist/cjs/global-account/better-auth-client.js +17 -0
  30. package/dist/cjs/global-account/bsmnt.d.ts +0 -1
  31. package/dist/cjs/global-account/bsmnt.js +0 -6
  32. package/dist/cjs/global-account/react/components/B3DynamicModal.js +5 -2
  33. package/dist/cjs/global-account/react/components/B3Provider/B3ConfigProvider.d.ts +4 -1
  34. package/dist/cjs/global-account/react/components/B3Provider/B3ConfigProvider.js +2 -1
  35. package/dist/cjs/global-account/react/components/B3Provider/B3Provider.d.ts +8 -1
  36. package/dist/cjs/global-account/react/components/B3Provider/B3Provider.js +9 -12
  37. package/dist/cjs/global-account/react/components/B3Provider/B3Provider.native.js +6 -8
  38. package/dist/cjs/global-account/react/components/B3Provider/BetterAuthProvider.d.ts +16 -0
  39. package/dist/cjs/global-account/react/components/B3Provider/BetterAuthProvider.js +120 -0
  40. package/dist/cjs/global-account/react/components/B3Provider/LocalSDKProvider.d.ts +3 -1
  41. package/dist/cjs/global-account/react/components/B3Provider/LocalSDKProvider.js +3 -1
  42. package/dist/cjs/global-account/react/components/IPFSMediaRenderer/IPFSMediaRenderer.d.ts +3 -1
  43. package/dist/cjs/global-account/react/components/IPFSMediaRenderer/IPFSMediaRenderer.js +4 -2
  44. package/dist/cjs/global-account/react/components/LinkAccount/LinkedAccountItem.js +2 -1
  45. package/dist/cjs/global-account/react/components/ManageAccount/ProfileSection.js +15 -6
  46. package/dist/cjs/global-account/react/components/ManageAccount/SessionDurationContent.d.ts +5 -0
  47. package/dist/cjs/global-account/react/components/ManageAccount/SessionDurationContent.js +57 -0
  48. package/dist/cjs/global-account/react/components/ManageAccount/SettingsContent.js +12 -29
  49. package/dist/cjs/global-account/react/components/ManageAccount/SettingsProfileCard.js +2 -2
  50. package/dist/cjs/global-account/react/components/Send/Send.js +5 -2
  51. package/dist/cjs/global-account/react/components/SignInWithB3/BetterAuthResetPassword.d.ts +21 -0
  52. package/dist/cjs/global-account/react/components/SignInWithB3/BetterAuthResetPassword.js +67 -0
  53. package/dist/cjs/global-account/react/components/SignInWithB3/BetterAuthSignIn.d.ts +34 -0
  54. package/dist/cjs/global-account/react/components/SignInWithB3/BetterAuthSignIn.js +163 -0
  55. package/dist/cjs/global-account/react/components/SignInWithB3/SignInWithB3Flow.js +13 -4
  56. package/dist/cjs/global-account/react/components/SignInWithB3/components/AuthButton.js +10 -1
  57. package/dist/cjs/global-account/react/components/SignInWithB3/steps/LoginStepBetterAuth.d.ts +6 -0
  58. package/dist/cjs/global-account/react/components/SignInWithB3/steps/LoginStepBetterAuth.js +138 -0
  59. package/dist/cjs/global-account/react/components/SignInWithB3/steps/LoginStepCustom.js +96 -15
  60. package/dist/cjs/global-account/react/components/SignInWithB3/utils/signInUtils.d.ts +5 -3
  61. package/dist/cjs/global-account/react/components/SignInWithB3/utils/signInUtils.js +20 -3
  62. package/dist/cjs/global-account/react/components/SingleUserSearchSelector/SingleUserSearchSelector.js +2 -1
  63. package/dist/cjs/global-account/react/components/Toast/ToastContext.d.ts +3 -0
  64. package/dist/cjs/global-account/react/components/Toast/ToastContext.js +30 -7
  65. package/dist/cjs/global-account/react/components/custom/Button.d.ts +1 -1
  66. package/dist/cjs/global-account/react/components/index.d.ts +3 -0
  67. package/dist/cjs/global-account/react/components/index.js +7 -3
  68. package/dist/cjs/global-account/react/components/ui/button.d.ts +1 -1
  69. package/dist/cjs/global-account/react/hooks/index.d.ts +1 -0
  70. package/dist/cjs/global-account/react/hooks/index.js +5 -2
  71. package/dist/cjs/global-account/react/hooks/useAuth.js +26 -15
  72. package/dist/cjs/global-account/react/hooks/useAuthentication.js +23 -12
  73. package/dist/cjs/global-account/react/hooks/useBetterAuth.d.ts +973 -0
  74. package/dist/cjs/global-account/react/hooks/useBetterAuth.js +157 -0
  75. package/dist/cjs/global-account/react/hooks/useConnect.d.ts +2 -2
  76. package/dist/cjs/global-account/react/hooks/useFirstEOA.d.ts +8 -8
  77. package/dist/cjs/global-account/react/stores/useModalStore.d.ts +10 -1
  78. package/dist/cjs/global-account/react/utils/createWagmiConfig.d.ts +4 -31
  79. package/dist/cjs/global-account/react/utils/createWagmiConfig.js +5 -24
  80. package/dist/cjs/global-account/react/utils/index.d.ts +0 -1
  81. package/dist/cjs/global-account/react/utils/index.js +0 -1
  82. package/dist/cjs/global-account/react/utils/profileDisplay.js +17 -18
  83. package/dist/cjs/shared/constants/chains/b3Chain.d.ts +7 -7
  84. package/dist/cjs/shared/constants/chains/b3Chain.js +4 -4
  85. package/dist/cjs/shared/constants/chains/b3Viem.d.ts +6 -0
  86. package/dist/cjs/shared/constants/chains/b3Viem.js +19 -0
  87. package/dist/cjs/shared/constants/chains/supported.d.ts +1 -1
  88. package/dist/cjs/shared/generated/chain-networks.json +2 -2
  89. package/dist/cjs/shared/utils/chains.d.ts +1 -1
  90. package/dist/cjs/shared/utils/chains.js +2 -2
  91. package/dist/cjs/shared/utils/session-duration.d.ts +15 -0
  92. package/dist/cjs/shared/utils/session-duration.js +69 -0
  93. package/dist/cjs/wallet/react/components/ConnectWallet.d.ts +11 -0
  94. package/dist/cjs/wallet/react/components/ConnectWallet.js +467 -0
  95. package/dist/cjs/wallet/react/components/WalletProvider.d.ts +35 -0
  96. package/dist/cjs/wallet/react/components/WalletProvider.js +20 -0
  97. package/dist/cjs/wallet/react/hooks/useWalletDisconnect.d.ts +13 -0
  98. package/dist/cjs/wallet/react/hooks/useWalletDisconnect.js +22 -0
  99. package/dist/cjs/wallet/react/hooks/useWalletState.d.ts +31 -0
  100. package/dist/cjs/wallet/react/hooks/useWalletState.js +63 -0
  101. package/dist/cjs/wallet/react/index.d.ts +5 -0
  102. package/dist/cjs/wallet/react/index.js +16 -0
  103. package/dist/cjs/wallet/utils/createWalletConfig.d.ts +21 -0
  104. package/dist/cjs/wallet/utils/createWalletConfig.js +24 -0
  105. package/dist/esm/anyspend/constants/rpc.d.ts +1 -1
  106. package/dist/esm/anyspend/constants/rpc.js +1 -1
  107. package/dist/esm/anyspend/react/components/AnySpendNFT.js +2 -2
  108. package/dist/esm/anyspend/react/components/AnySpendStakeB3.js +2 -2
  109. package/dist/esm/anyspend/react/components/AnySpendStakeB3ExactIn.js +2 -2
  110. package/dist/esm/anyspend/react/components/checkout/AnySpendCheckout.d.ts +3 -1
  111. package/dist/esm/anyspend/react/components/checkout/AnySpendCheckout.js +10 -2
  112. package/dist/esm/anyspend/react/components/checkout/CheckoutPaymentPanel.js +2 -4
  113. package/dist/esm/anyspend/react/components/checkout/CheckoutSuccess.d.ts +2 -1
  114. package/dist/esm/anyspend/react/components/checkout/CheckoutSuccess.js +5 -3
  115. package/dist/esm/anyspend/react/components/checkout/CryptoPayPanel.js +44 -24
  116. package/dist/esm/anyspend/react/components/checkout/FiatCheckoutPanel.js +2 -3
  117. package/dist/esm/anyspend/react/components/checkout/KycGate.js +2 -3
  118. package/dist/esm/anyspend/react/components/common/CryptoPaymentMethod.d.ts +8 -0
  119. package/dist/esm/anyspend/react/components/common/CryptoPaymentMethod.js +9 -8
  120. package/dist/esm/anyspend/react/components/common/InsufficientDepositPayment.js +2 -2
  121. package/dist/esm/anyspend/react/components/common/OrderDetails.js +8 -3
  122. package/dist/esm/anyspend/react/components/common/OrderDetailsCollapsible.js +2 -2
  123. package/dist/esm/anyspend/react/components/common/OrderStatus.js +34 -3
  124. package/dist/esm/anyspend/react/components/common/StepProgress.d.ts +2 -0
  125. package/dist/esm/anyspend/react/components/common/StepProgress.js +4 -2
  126. package/dist/esm/anyspend/react/components/common/TransferCryptoDetails.js +2 -2
  127. package/dist/esm/anyspend/react/hooks/useAnyspendCreateOnrampOrder.js +5 -7
  128. package/dist/esm/anyspend/react/hooks/useKycStatus.d.ts +3 -1
  129. package/dist/esm/anyspend/react/hooks/useKycStatus.js +9 -5
  130. package/dist/esm/anyspend/utils/chain.js +10 -9
  131. package/dist/esm/app.shared.js +9 -7
  132. package/dist/esm/global-account/better-auth-client.d.ts +1883 -0
  133. package/dist/esm/global-account/better-auth-client.js +13 -0
  134. package/dist/esm/global-account/bsmnt.d.ts +0 -1
  135. package/dist/esm/global-account/bsmnt.js +0 -5
  136. package/dist/esm/global-account/react/components/B3DynamicModal.js +5 -2
  137. package/dist/esm/global-account/react/components/B3Provider/B3ConfigProvider.d.ts +4 -1
  138. package/dist/esm/global-account/react/components/B3Provider/B3ConfigProvider.js +2 -1
  139. package/dist/esm/global-account/react/components/B3Provider/B3Provider.d.ts +8 -1
  140. package/dist/esm/global-account/react/components/B3Provider/B3Provider.js +4 -7
  141. package/dist/esm/global-account/react/components/B3Provider/B3Provider.native.js +4 -6
  142. package/dist/esm/global-account/react/components/B3Provider/BetterAuthProvider.d.ts +16 -0
  143. package/dist/esm/global-account/react/components/B3Provider/BetterAuthProvider.js +115 -0
  144. package/dist/esm/global-account/react/components/B3Provider/LocalSDKProvider.d.ts +3 -1
  145. package/dist/esm/global-account/react/components/B3Provider/LocalSDKProvider.js +3 -1
  146. package/dist/esm/global-account/react/components/IPFSMediaRenderer/IPFSMediaRenderer.d.ts +3 -1
  147. package/dist/esm/global-account/react/components/IPFSMediaRenderer/IPFSMediaRenderer.js +4 -2
  148. package/dist/esm/global-account/react/components/LinkAccount/LinkedAccountItem.js +2 -1
  149. package/dist/esm/global-account/react/components/ManageAccount/ProfileSection.js +13 -7
  150. package/dist/esm/global-account/react/components/ManageAccount/SessionDurationContent.d.ts +5 -0
  151. package/dist/esm/global-account/react/components/ManageAccount/SessionDurationContent.js +52 -0
  152. package/dist/esm/global-account/react/components/ManageAccount/SettingsContent.js +12 -29
  153. package/dist/esm/global-account/react/components/ManageAccount/SettingsProfileCard.js +2 -2
  154. package/dist/esm/global-account/react/components/Send/Send.js +5 -2
  155. package/dist/esm/global-account/react/components/SignInWithB3/BetterAuthResetPassword.d.ts +21 -0
  156. package/dist/esm/global-account/react/components/SignInWithB3/BetterAuthResetPassword.js +64 -0
  157. package/dist/esm/global-account/react/components/SignInWithB3/BetterAuthSignIn.d.ts +34 -0
  158. package/dist/esm/global-account/react/components/SignInWithB3/BetterAuthSignIn.js +160 -0
  159. package/dist/esm/global-account/react/components/SignInWithB3/SignInWithB3Flow.js +13 -4
  160. package/dist/esm/global-account/react/components/SignInWithB3/components/AuthButton.js +11 -2
  161. package/dist/esm/global-account/react/components/SignInWithB3/steps/LoginStepBetterAuth.d.ts +6 -0
  162. package/dist/esm/global-account/react/components/SignInWithB3/steps/LoginStepBetterAuth.js +135 -0
  163. package/dist/esm/global-account/react/components/SignInWithB3/steps/LoginStepCustom.js +100 -19
  164. package/dist/esm/global-account/react/components/SignInWithB3/utils/signInUtils.d.ts +5 -3
  165. package/dist/esm/global-account/react/components/SignInWithB3/utils/signInUtils.js +19 -2
  166. package/dist/esm/global-account/react/components/SingleUserSearchSelector/SingleUserSearchSelector.js +2 -1
  167. package/dist/esm/global-account/react/components/Toast/ToastContext.d.ts +3 -0
  168. package/dist/esm/global-account/react/components/Toast/ToastContext.js +30 -7
  169. package/dist/esm/global-account/react/components/custom/Button.d.ts +1 -1
  170. package/dist/esm/global-account/react/components/index.d.ts +3 -0
  171. package/dist/esm/global-account/react/components/index.js +2 -0
  172. package/dist/esm/global-account/react/components/ui/button.d.ts +1 -1
  173. package/dist/esm/global-account/react/hooks/index.d.ts +1 -0
  174. package/dist/esm/global-account/react/hooks/index.js +1 -0
  175. package/dist/esm/global-account/react/hooks/useAuth.js +28 -17
  176. package/dist/esm/global-account/react/hooks/useAuthentication.js +24 -13
  177. package/dist/esm/global-account/react/hooks/useBetterAuth.d.ts +973 -0
  178. package/dist/esm/global-account/react/hooks/useBetterAuth.js +149 -0
  179. package/dist/esm/global-account/react/hooks/useConnect.d.ts +2 -2
  180. package/dist/esm/global-account/react/hooks/useFirstEOA.d.ts +8 -8
  181. package/dist/esm/global-account/react/stores/useModalStore.d.ts +10 -1
  182. package/dist/esm/global-account/react/utils/createWagmiConfig.d.ts +4 -31
  183. package/dist/esm/global-account/react/utils/createWagmiConfig.js +5 -23
  184. package/dist/esm/global-account/react/utils/index.d.ts +0 -1
  185. package/dist/esm/global-account/react/utils/index.js +0 -1
  186. package/dist/esm/global-account/react/utils/profileDisplay.js +17 -18
  187. package/dist/esm/shared/constants/chains/b3Chain.d.ts +7 -7
  188. package/dist/esm/shared/constants/chains/b3Chain.js +4 -4
  189. package/dist/esm/shared/constants/chains/b3Viem.d.ts +6 -0
  190. package/dist/esm/shared/constants/chains/b3Viem.js +16 -0
  191. package/dist/esm/shared/constants/chains/supported.d.ts +1 -1
  192. package/dist/esm/shared/generated/chain-networks.json +2 -2
  193. package/dist/esm/shared/utils/chains.d.ts +1 -1
  194. package/dist/esm/shared/utils/chains.js +2 -2
  195. package/dist/esm/shared/utils/session-duration.d.ts +15 -0
  196. package/dist/esm/shared/utils/session-duration.js +64 -0
  197. package/dist/esm/wallet/react/components/ConnectWallet.d.ts +11 -0
  198. package/dist/esm/wallet/react/components/ConnectWallet.js +431 -0
  199. package/dist/esm/wallet/react/components/WalletProvider.d.ts +35 -0
  200. package/dist/esm/wallet/react/components/WalletProvider.js +17 -0
  201. package/dist/esm/wallet/react/hooks/useWalletDisconnect.d.ts +13 -0
  202. package/dist/esm/wallet/react/hooks/useWalletDisconnect.js +19 -0
  203. package/dist/esm/wallet/react/hooks/useWalletState.d.ts +31 -0
  204. package/dist/esm/wallet/react/hooks/useWalletState.js +60 -0
  205. package/dist/esm/wallet/react/index.d.ts +5 -0
  206. package/dist/esm/wallet/react/index.js +8 -0
  207. package/dist/esm/wallet/utils/createWalletConfig.d.ts +21 -0
  208. package/dist/esm/wallet/utils/createWalletConfig.js +21 -0
  209. package/dist/styles/index.css +1 -1
  210. package/dist/types/anyspend/constants/rpc.d.ts +1 -1
  211. package/dist/types/anyspend/react/components/checkout/AnySpendCheckout.d.ts +3 -1
  212. package/dist/types/anyspend/react/components/checkout/CheckoutSuccess.d.ts +2 -1
  213. package/dist/types/anyspend/react/components/common/CryptoPaymentMethod.d.ts +8 -0
  214. package/dist/types/anyspend/react/components/common/StepProgress.d.ts +2 -0
  215. package/dist/types/anyspend/react/hooks/useKycStatus.d.ts +3 -1
  216. package/dist/types/global-account/better-auth-client.d.ts +1883 -0
  217. package/dist/types/global-account/bsmnt.d.ts +0 -1
  218. package/dist/types/global-account/react/components/B3Provider/B3ConfigProvider.d.ts +4 -1
  219. package/dist/types/global-account/react/components/B3Provider/B3Provider.d.ts +8 -1
  220. package/dist/types/global-account/react/components/B3Provider/BetterAuthProvider.d.ts +16 -0
  221. package/dist/types/global-account/react/components/B3Provider/LocalSDKProvider.d.ts +3 -1
  222. package/dist/types/global-account/react/components/IPFSMediaRenderer/IPFSMediaRenderer.d.ts +3 -1
  223. package/dist/types/global-account/react/components/ManageAccount/SessionDurationContent.d.ts +5 -0
  224. package/dist/types/global-account/react/components/SignInWithB3/BetterAuthResetPassword.d.ts +21 -0
  225. package/dist/types/global-account/react/components/SignInWithB3/BetterAuthSignIn.d.ts +34 -0
  226. package/dist/types/global-account/react/components/SignInWithB3/steps/LoginStepBetterAuth.d.ts +6 -0
  227. package/dist/types/global-account/react/components/SignInWithB3/utils/signInUtils.d.ts +5 -3
  228. package/dist/types/global-account/react/components/Toast/ToastContext.d.ts +3 -0
  229. package/dist/types/global-account/react/components/custom/Button.d.ts +1 -1
  230. package/dist/types/global-account/react/components/index.d.ts +3 -0
  231. package/dist/types/global-account/react/components/ui/button.d.ts +1 -1
  232. package/dist/types/global-account/react/hooks/index.d.ts +1 -0
  233. package/dist/types/global-account/react/hooks/useBetterAuth.d.ts +973 -0
  234. package/dist/types/global-account/react/hooks/useConnect.d.ts +2 -2
  235. package/dist/types/global-account/react/hooks/useFirstEOA.d.ts +8 -8
  236. package/dist/types/global-account/react/stores/useModalStore.d.ts +10 -1
  237. package/dist/types/global-account/react/utils/createWagmiConfig.d.ts +4 -31
  238. package/dist/types/global-account/react/utils/index.d.ts +0 -1
  239. package/dist/types/shared/constants/chains/b3Chain.d.ts +7 -7
  240. package/dist/types/shared/constants/chains/b3Viem.d.ts +6 -0
  241. package/dist/types/shared/constants/chains/supported.d.ts +1 -1
  242. package/dist/types/shared/utils/chains.d.ts +1 -1
  243. package/dist/types/shared/utils/session-duration.d.ts +15 -0
  244. package/dist/types/wallet/react/components/ConnectWallet.d.ts +11 -0
  245. package/dist/types/wallet/react/components/WalletProvider.d.ts +35 -0
  246. package/dist/types/wallet/react/hooks/useWalletDisconnect.d.ts +13 -0
  247. package/dist/types/wallet/react/hooks/useWalletState.d.ts +31 -0
  248. package/dist/types/wallet/react/index.d.ts +5 -0
  249. package/dist/types/wallet/utils/createWalletConfig.d.ts +21 -0
  250. package/package.json +15 -6
  251. package/src/anyspend/constants/rpc.ts +2 -1
  252. package/src/anyspend/react/components/AnySpendNFT.tsx +2 -2
  253. package/src/anyspend/react/components/AnySpendStakeB3.tsx +2 -2
  254. package/src/anyspend/react/components/AnySpendStakeB3ExactIn.tsx +2 -2
  255. package/src/anyspend/react/components/checkout/AnySpendCheckout.tsx +15 -1
  256. package/src/anyspend/react/components/checkout/CheckoutPaymentPanel.tsx +2 -4
  257. package/src/anyspend/react/components/checkout/CheckoutSuccess.tsx +13 -3
  258. package/src/anyspend/react/components/checkout/CryptoPayPanel.tsx +45 -27
  259. package/src/anyspend/react/components/checkout/FiatCheckoutPanel.tsx +9 -3
  260. package/src/anyspend/react/components/checkout/KycGate.tsx +8 -3
  261. package/src/anyspend/react/components/common/CryptoPaymentMethod.tsx +10 -8
  262. package/src/anyspend/react/components/common/InsufficientDepositPayment.tsx +2 -2
  263. package/src/anyspend/react/components/common/OrderDetails.tsx +10 -2
  264. package/src/anyspend/react/components/common/OrderDetailsCollapsible.tsx +4 -4
  265. package/src/anyspend/react/components/common/OrderStatus.tsx +38 -3
  266. package/src/anyspend/react/components/common/StepProgress.tsx +15 -5
  267. package/src/anyspend/react/components/common/TransferCryptoDetails.tsx +2 -2
  268. package/src/anyspend/react/hooks/useAnyspendCreateOnrampOrder.ts +5 -7
  269. package/src/anyspend/react/hooks/useKycStatus.ts +8 -5
  270. package/src/anyspend/utils/chain.ts +9 -9
  271. package/src/app.shared.ts +9 -8
  272. package/src/global-account/better-auth-client.ts +17 -0
  273. package/src/global-account/bsmnt.ts +0 -6
  274. package/src/global-account/react/components/B3DynamicModal.tsx +5 -2
  275. package/src/global-account/react/components/B3Provider/B3ConfigProvider.tsx +6 -0
  276. package/src/global-account/react/components/B3Provider/B3Provider.native.tsx +16 -21
  277. package/src/global-account/react/components/B3Provider/B3Provider.tsx +52 -40
  278. package/src/global-account/react/components/B3Provider/BetterAuthProvider.tsx +127 -0
  279. package/src/global-account/react/components/B3Provider/LocalSDKProvider.tsx +5 -0
  280. package/src/global-account/react/components/IPFSMediaRenderer/IPFSMediaRenderer.tsx +17 -10
  281. package/src/global-account/react/components/LinkAccount/LinkedAccountItem.tsx +2 -1
  282. package/src/global-account/react/components/ManageAccount/ProfileSection.tsx +29 -11
  283. package/src/global-account/react/components/ManageAccount/SessionDurationContent.tsx +107 -0
  284. package/src/global-account/react/components/ManageAccount/SettingsContent.tsx +28 -30
  285. package/src/global-account/react/components/ManageAccount/SettingsProfileCard.tsx +2 -2
  286. package/src/global-account/react/components/Send/Send.tsx +8 -5
  287. package/src/global-account/react/components/SignInWithB3/BetterAuthResetPassword.tsx +146 -0
  288. package/src/global-account/react/components/SignInWithB3/BetterAuthSignIn.tsx +426 -0
  289. package/src/global-account/react/components/SignInWithB3/SignInWithB3Flow.tsx +13 -4
  290. package/src/global-account/react/components/SignInWithB3/components/AuthButton.tsx +21 -2
  291. package/src/global-account/react/components/SignInWithB3/steps/LoginStepBetterAuth.tsx +308 -0
  292. package/src/global-account/react/components/SignInWithB3/steps/LoginStepCustom.tsx +207 -54
  293. package/src/global-account/react/components/SignInWithB3/utils/signInUtils.ts +24 -4
  294. package/src/global-account/react/components/SingleUserSearchSelector/SingleUserSearchSelector.tsx +2 -1
  295. package/src/global-account/react/components/Toast/ToastContext.tsx +39 -7
  296. package/src/global-account/react/components/index.ts +3 -0
  297. package/src/global-account/react/hooks/index.ts +1 -0
  298. package/src/global-account/react/hooks/useAuth.ts +28 -17
  299. package/src/global-account/react/hooks/useAuthentication.ts +24 -13
  300. package/src/global-account/react/hooks/useBetterAuth.ts +191 -0
  301. package/src/global-account/react/hooks/useConnect.tsx +2 -2
  302. package/src/global-account/react/stores/useModalStore.ts +11 -0
  303. package/src/global-account/react/utils/createWagmiConfig.tsx +6 -25
  304. package/src/global-account/react/utils/index.ts +0 -1
  305. package/src/global-account/react/utils/profileDisplay.ts +21 -19
  306. package/src/shared/constants/chains/b3Chain.ts +5 -5
  307. package/src/shared/constants/chains/b3Viem.ts +18 -0
  308. package/src/shared/generated/chain-networks.json +2 -2
  309. package/src/shared/utils/chains.ts +3 -2
  310. package/src/shared/utils/session-duration.ts +64 -0
  311. package/src/types/torph.d.ts +4 -0
  312. package/src/wallet/__tests__/createWalletConfig.test.ts +39 -0
  313. package/src/wallet/react/components/ConnectWallet.tsx +665 -0
  314. package/src/wallet/react/components/WalletProvider.tsx +64 -0
  315. package/src/wallet/react/hooks/useWalletDisconnect.ts +22 -0
  316. package/src/wallet/react/hooks/useWalletState.ts +93 -0
  317. package/src/wallet/react/index.ts +10 -0
  318. package/src/wallet/utils/createWalletConfig.ts +39 -0
  319. package/dist/cjs/global-account/react/components/AvatarCreator/AvatarCreator.d.ts +0 -6
  320. package/dist/cjs/global-account/react/components/AvatarCreator/AvatarCreator.js +0 -54
  321. package/dist/cjs/global-account/react/components/ProfileAvatar.d.ts +0 -0
  322. package/dist/cjs/global-account/react/components/ProfileAvatar.js +0 -127
  323. package/dist/cjs/global-account/react/hooks/useRPMToken.d.ts +0 -7
  324. package/dist/cjs/global-account/react/hooks/useRPMToken.js +0 -11
  325. package/dist/cjs/global-account/react/utils/updateAvatar.d.ts +0 -4
  326. package/dist/cjs/global-account/react/utils/updateAvatar.js +0 -54
  327. package/dist/esm/global-account/react/components/AvatarCreator/AvatarCreator.d.ts +0 -6
  328. package/dist/esm/global-account/react/components/AvatarCreator/AvatarCreator.js +0 -51
  329. package/dist/esm/global-account/react/components/ProfileAvatar.d.ts +0 -0
  330. package/dist/esm/global-account/react/components/ProfileAvatar.js +0 -127
  331. package/dist/esm/global-account/react/hooks/useRPMToken.d.ts +0 -7
  332. package/dist/esm/global-account/react/hooks/useRPMToken.js +0 -8
  333. package/dist/esm/global-account/react/utils/updateAvatar.d.ts +0 -4
  334. package/dist/esm/global-account/react/utils/updateAvatar.js +0 -18
  335. package/dist/types/global-account/react/components/AvatarCreator/AvatarCreator.d.ts +0 -6
  336. package/dist/types/global-account/react/components/ProfileAvatar.d.ts +0 -0
  337. package/dist/types/global-account/react/hooks/useRPMToken.d.ts +0 -7
  338. package/dist/types/global-account/react/utils/updateAvatar.d.ts +0 -4
  339. package/src/global-account/react/components/AvatarCreator/AvatarCreator.tsx +0 -90
  340. package/src/global-account/react/components/ProfileAvatar.tsx +0 -138
  341. package/src/global-account/react/hooks/useRPMToken.ts +0 -17
  342. package/src/global-account/react/utils/updateAvatar.ts +0 -21
@@ -5,7 +5,8 @@ type WalletType = Wallet["id"];
5
5
  type StrategyType = SingleStepAuthArgsType["strategy"];
6
6
  type CustomStrategyType = "basement" | "privy";
7
7
 
8
- type AllowedStrategies = StrategyType | WalletType | CustomStrategyType;
8
+ type AllowedStrategies = StrategyType | WalletType | CustomStrategyType | "email";
9
+ type NonWalletStrategyType = Exclude<AllowedStrategies, WalletType>;
9
10
  const customStrategies = ["basement", "privy"] as const;
10
11
  // type CustomStrategy = (typeof customStrategies)[number];
11
12
 
@@ -13,9 +14,10 @@ export const allowedStrategies = [
13
14
  // Auth strategies
14
15
  "apple",
15
16
  "google",
17
+ "github",
16
18
  "x",
17
19
  "discord",
18
- // "github",
20
+ "email",
19
21
  "guest",
20
22
 
21
23
  // Wallet IDs
@@ -36,7 +38,7 @@ export function isWalletType(strategy: AllowedStrategies): strategy is WalletTyp
36
38
  return strategy === "walletConnect" || walletIdPattern.test(strategy);
37
39
  }
38
40
 
39
- export function isStrategyType(strategy: AllowedStrategies): strategy is StrategyType {
41
+ export function isStrategyType(strategy: AllowedStrategies): strategy is NonWalletStrategyType {
40
42
  return !isWalletType(strategy);
41
43
  }
42
44
 
@@ -49,6 +51,10 @@ export function getConnectOptionsFromStrategy(strategy: AllowedStrategy): {
49
51
  throw new Error(`Invalid strategy: ${strategy}`);
50
52
  }
51
53
 
54
+ if (strategy === "email") {
55
+ throw new Error("Email strategy requires OTP flow and cannot be connected in a single step");
56
+ }
57
+
52
58
  if (isWalletType(strategy)) {
53
59
  return { strategy: "wallet" as const, wallet: createWallet(strategy) };
54
60
  } else {
@@ -59,11 +65,25 @@ export function getConnectOptionsFromStrategy(strategy: AllowedStrategy): {
59
65
 
60
66
  export const strategyIcons: Record<string, string> = {
61
67
  google: "https://cdn.b3.fun/google.svg",
68
+ github: "https://cdn.jsdelivr.net/gh/devicons/devicon/icons/github/github-original.svg",
62
69
  x: "https://cdn.b3.fun/x.svg?1",
63
70
  discord: "https://cdn.b3.fun/discord.svg",
64
71
  apple: "https://cdn.b3.fun/apple.svg",
65
72
  guest: "https://cdn.b3.fun/incognito.svg",
66
- // Add more strategies as needed
73
+ microsoft: "https://upload.wikimedia.org/wikipedia/commons/4/44/Microsoft_logo.svg",
74
+ slack: "https://upload.wikimedia.org/wikipedia/commons/d/d5/Slack_icon_2019.svg",
75
+ };
76
+
77
+ export const strategyLabels: Record<string, string> = {
78
+ google: "Google",
79
+ x: "X",
80
+ discord: "Discord",
81
+ apple: "Apple",
82
+ guest: "Guest",
83
+ github: "GitHub",
84
+ email: "Email",
85
+ microsoft: "Microsoft",
86
+ slack: "Slack",
67
87
  };
68
88
  // Test it
69
89
  // console.log(getConnectOptionsFromStrategy("io.metamask"));
@@ -5,6 +5,7 @@ import { Search, X } from "lucide-react";
5
5
  import { useCallback, useEffect, useRef, useState } from "react";
6
6
  import type { CombinedProfile, Profile } from "../../hooks/useProfile";
7
7
  import { fetchProfile as fetchProfileApi } from "../../utils/profileApi";
8
+ import { validateImageUrl } from "../../utils/profileDisplay";
8
9
  import { IPFSMediaRenderer } from "../IPFSMediaRenderer/IPFSMediaRenderer";
9
10
  import { Input } from "../ui/input";
10
11
 
@@ -283,7 +284,7 @@ export function SingleUserSearchSelector({
283
284
  {/* Avatar */}
284
285
  <div className="single-user-search-result-avatar h-11 w-11 shrink-0">
285
286
  <IPFSMediaRenderer
286
- src={searchResult.avatar}
287
+ src={validateImageUrl(searchResult.avatar) ?? undefined}
287
288
  alt={getDisplayName(searchResult)}
288
289
  className="h-full w-full rounded-full object-cover"
289
290
  />
@@ -15,6 +15,9 @@ interface ToastContextType {
15
15
  addToast: (type: ToastType, message: string, duration?: number) => string;
16
16
  removeToast: (id: string) => void;
17
17
  clearAll: () => void;
18
+ headerMode: boolean;
19
+ setHeaderMode: (enabled: boolean) => void;
20
+ latestToast: ToastItem | null;
18
21
  }
19
22
 
20
23
  const ToastContext = createContext<ToastContextType | undefined>(undefined);
@@ -23,6 +26,9 @@ let globalToastCounter = 0;
23
26
 
24
27
  export function ToastProvider({ children }: { children: React.ReactNode }) {
25
28
  const [toasts, setToasts] = useState<ToastItem[]>([]);
29
+ const [headerMode, setHeaderMode] = useState(false);
30
+ const headerModeRef = useRef(false);
31
+ const [latestToast, setLatestToast] = useState<ToastItem | null>(null);
26
32
  const timeoutsRef = useRef<Map<string, NodeJS.Timeout>>(new Map());
27
33
 
28
34
  const removeToast = useCallback((id: string) => {
@@ -45,13 +51,23 @@ export function ToastProvider({ children }: { children: React.ReactNode }) {
45
51
  createdAt: Date.now(),
46
52
  };
47
53
 
48
- setToasts(prev => [...prev, newToast]);
54
+ if (headerModeRef.current) {
55
+ setLatestToast(newToast);
56
+ if (duration > 0) {
57
+ const timeout = setTimeout(() => {
58
+ setLatestToast(null);
59
+ }, duration);
60
+ timeoutsRef.current.set(id, timeout);
61
+ }
62
+ } else {
63
+ setToasts(prev => [...prev, newToast]);
49
64
 
50
- if (duration > 0) {
51
- const timeout = setTimeout(() => {
52
- removeToast(id);
53
- }, duration);
54
- timeoutsRef.current.set(id, timeout);
65
+ if (duration > 0) {
66
+ const timeout = setTimeout(() => {
67
+ removeToast(id);
68
+ }, duration);
69
+ timeoutsRef.current.set(id, timeout);
70
+ }
55
71
  }
56
72
 
57
73
  return id;
@@ -65,6 +81,16 @@ export function ToastProvider({ children }: { children: React.ReactNode }) {
65
81
  setToasts([]);
66
82
  }, []);
67
83
 
84
+ const setHeaderModeCallback = useCallback((enabled: boolean) => {
85
+ setHeaderMode(enabled);
86
+ headerModeRef.current = enabled;
87
+ if (!enabled) {
88
+ setLatestToast(null);
89
+ timeoutsRef.current.forEach(timeout => clearTimeout(timeout));
90
+ timeoutsRef.current.clear();
91
+ }
92
+ }, []);
93
+
68
94
  // Cleanup on unmount
69
95
  useEffect(() => {
70
96
  const timeouts = timeoutsRef.current;
@@ -74,7 +100,13 @@ export function ToastProvider({ children }: { children: React.ReactNode }) {
74
100
  };
75
101
  }, []);
76
102
 
77
- return <ToastContext.Provider value={{ toasts, addToast, removeToast, clearAll }}>{children}</ToastContext.Provider>;
103
+ return (
104
+ <ToastContext.Provider
105
+ value={{ toasts, addToast, removeToast, clearAll, headerMode, setHeaderMode: setHeaderModeCallback, latestToast }}
106
+ >
107
+ {children}
108
+ </ToastContext.Provider>
109
+ );
78
110
  }
79
111
 
80
112
  export function useToastContext() {
@@ -2,6 +2,7 @@
2
2
  // Core Components
3
3
  export { B3DynamicModal } from "./B3DynamicModal";
4
4
  export { B3Provider } from "./B3Provider/B3Provider";
5
+ export type { AuthStrategy } from "./B3Provider/B3ConfigProvider";
5
6
  export { RelayKitProviderWrapper } from "./B3Provider/RelayKitProviderWrapper";
6
7
  export { useB3 } from "./B3Provider/useB3";
7
8
  export { useB3Account } from "./B3Provider/useB3Account";
@@ -9,6 +10,8 @@ export { useB3Config } from "./B3Provider/useB3Config";
9
10
  export { StyleRoot } from "./StyleRoot";
10
11
 
11
12
  // SignInWithB3 Components
13
+ export { BetterAuthResetPassword, type BetterAuthResetPasswordProps } from "./SignInWithB3/BetterAuthResetPassword";
14
+ export { BetterAuthSignIn, type BetterAuthSignInProps } from "./SignInWithB3/BetterAuthSignIn";
12
15
  export { AuthButton } from "./SignInWithB3/components/AuthButton";
13
16
  export { PermissionItem } from "./SignInWithB3/components/PermissionItem";
14
17
  export { WalletRow } from "./SignInWithB3/components/WalletRow";
@@ -5,6 +5,7 @@ export { useAddTWSessionKey } from "./useAddTWSessionKey";
5
5
  export { useAnalytics } from "./useAnalytics";
6
6
  export { useAuth } from "./useAuth";
7
7
  export { useAuthentication } from "./useAuthentication";
8
+ export { useBetterAuth, EmailVerificationRequiredError } from "./useBetterAuth";
8
9
  export { useB3BalanceFromAddresses } from "./useB3BalanceFromAddresses";
9
10
  export { useB3EnsName } from "./useB3EnsName";
10
11
  export { useChainSwitchWithAction } from "./useChainSwitchWithAction";
@@ -6,7 +6,7 @@ import { debugB3React } from "@b3dotfun/sdk/shared/utils/debug";
6
6
  import { client } from "@b3dotfun/sdk/shared/utils/thirdweb";
7
7
  import { ConnectionOptions } from "@thirdweb-dev/wagmi-adapter";
8
8
  import { getConnectors } from "@wagmi/core";
9
- import { useCallback, useContext, useEffect, useRef } from "react";
9
+ import { useCallback, useContext, useEffect, useMemo, useRef } from "react";
10
10
  import {
11
11
  useActiveWallet,
12
12
  useAutoConnect,
@@ -18,7 +18,7 @@ import { Wallet, ecosystemWallet } from "thirdweb/wallets";
18
18
  import { preAuthenticate } from "thirdweb/wallets/in-app";
19
19
  import { useAccount, useConnect, useSwitchAccount } from "wagmi";
20
20
  import { LocalSDKContext } from "../components/B3Provider/LocalSDKProvider";
21
- import { getCachedWagmiConfig } from "../utils/createWagmiConfig";
21
+ import { createWagmiConfig } from "../utils/createWagmiConfig";
22
22
  import { useSearchParam } from "./useSearchParamsSSR";
23
23
  import { useUserQuery } from "./useUserQuery";
24
24
 
@@ -30,7 +30,7 @@ const debug = debugB3React("useAuth");
30
30
  * This hook provides 1:1 feature parity with useAuthentication.ts
31
31
  */
32
32
  export function useAuth() {
33
- const { onConnectCallback } = useContext(LocalSDKContext);
33
+ const { onConnectCallback, disableBSMNTAuthentication } = useContext(LocalSDKContext);
34
34
  const { disconnect } = useDisconnect();
35
35
  const wallets = useConnectedWallets();
36
36
  const activeWallet = useActiveWallet();
@@ -47,7 +47,7 @@ export function useAuth() {
47
47
  const useAutoConnectLoadingPrevious = useRef(false);
48
48
  const referralCode = useSearchParam("referralCode");
49
49
  const { partnerId } = useB3Config();
50
- const wagmiConfig = getCachedWagmiConfig({ partnerId });
50
+ const wagmiConfig = useMemo(() => createWagmiConfig({ partnerId }), [partnerId]);
51
51
  const { connect } = useConnect();
52
52
  const activeWagmiAccount = useAccount();
53
53
  const { switchAccount } = useSwitchAccount();
@@ -76,8 +76,10 @@ export function useAuth() {
76
76
 
77
77
  // Authenticate with BSMNT
78
78
  try {
79
- const b3Jwt = await authenticateWithB3JWT(response.accessToken);
80
- debug("BSMNT re-authentication successful", b3Jwt);
79
+ if (!disableBSMNTAuthentication) {
80
+ const b3Jwt = await authenticateWithB3JWT(response.accessToken);
81
+ debug("BSMNT re-authentication successful", b3Jwt);
82
+ }
81
83
  } catch (bsmntError) {
82
84
  // BSMNT authentication failure shouldn't block the main auth flow
83
85
  debug("BSMNT re-authentication failed (non-critical)", bsmntError);
@@ -88,7 +90,7 @@ export function useAuth() {
88
90
  debug("Re-authentication failed", err);
89
91
  throw err;
90
92
  }
91
- }, [setUser]);
93
+ }, [setUser, disableBSMNTAuthentication]);
92
94
 
93
95
  const syncWagmi = useCallback(async () => {
94
96
  function syncWagmiFunc() {
@@ -136,9 +138,7 @@ export function useAuth() {
136
138
  });
137
139
  }
138
140
  syncWagmiFunc();
139
- // wagmi config shouldn't change
140
- // eslint-disable-next-line react-hooks/exhaustive-deps
141
- }, [partnerId, wallets]);
141
+ }, [wagmiConfig, wallets, connect, switchAccount]);
142
142
 
143
143
  useEffect(() => {
144
144
  syncWagmi();
@@ -159,9 +159,11 @@ export function useAuth() {
159
159
  setIsAuthenticating(false);
160
160
  debug("Re-authenticated successfully", { userAuth });
161
161
 
162
- // Authenticate on BSMNT with B3 JWT
163
- const b3Jwt = await authenticateWithB3JWT(userAuth.accessToken);
164
- debug("@@b3Jwt", b3Jwt);
162
+ if (!disableBSMNTAuthentication) {
163
+ // Authenticate on BSMNT with B3 JWT
164
+ const b3Jwt = await authenticateWithB3JWT(userAuth.accessToken);
165
+ debug("@@b3Jwt", b3Jwt);
166
+ }
165
167
 
166
168
  return userAuth;
167
169
  } catch (error) {
@@ -171,7 +173,14 @@ export function useAuth() {
171
173
  setIsAuthenticating(false);
172
174
  throw new Error("Authentication required. Please authenticate.");
173
175
  }
174
- }, [reAuthenticate, setIsAuthenticated, setIsAuthenticating, setUser, setHasStartedConnecting]);
176
+ }, [
177
+ reAuthenticate,
178
+ setIsAuthenticated,
179
+ setIsAuthenticating,
180
+ setUser,
181
+ setHasStartedConnecting,
182
+ disableBSMNTAuthentication,
183
+ ]);
175
184
 
176
185
  /**
177
186
  * Authenticate with B3
@@ -208,8 +217,10 @@ export function useAuth() {
208
217
 
209
218
  // Step 3: Authenticate with BSMNT for basement integration
210
219
  try {
211
- const b3Jwt = await authenticateWithB3JWT(response.accessToken);
212
- debug("BSMNT authentication successful", b3Jwt);
220
+ if (!disableBSMNTAuthentication) {
221
+ const b3Jwt = await authenticateWithB3JWT(response.accessToken);
222
+ debug("BSMNT authentication successful", b3Jwt);
223
+ }
213
224
  } catch (bsmntError) {
214
225
  // BSMNT authentication failure shouldn't block the main auth flow
215
226
  debug("BSMNT authentication failed (non-critical)", bsmntError);
@@ -221,7 +232,7 @@ export function useAuth() {
221
232
  throw err;
222
233
  }
223
234
  },
224
- [referralCode, setUser],
235
+ [referralCode, setUser, disableBSMNTAuthentication],
225
236
  );
226
237
 
227
238
  /**
@@ -6,7 +6,7 @@ import { debugB3React } from "@b3dotfun/sdk/shared/utils/debug";
6
6
  import { client } from "@b3dotfun/sdk/shared/utils/thirdweb";
7
7
  import { ConnectionOptions } from "@thirdweb-dev/wagmi-adapter";
8
8
  import { getConnectors } from "@wagmi/core";
9
- import { useCallback, useContext, useEffect, useRef } from "react";
9
+ import { useCallback, useContext, useEffect, useMemo, useRef } from "react";
10
10
  import {
11
11
  useActiveWallet,
12
12
  useAutoConnect,
@@ -25,7 +25,7 @@ import { useUserQuery } from "./useUserQuery";
25
25
  const debug = debugB3React("useAuthentication");
26
26
 
27
27
  export function useAuthentication(partnerId: string, { skipAutoConnect = false }: { skipAutoConnect?: boolean } = {}) {
28
- const { onConnectCallback, onLogoutCallback } = useContext(LocalSDKContext);
28
+ const { onConnectCallback, onLogoutCallback, disableBSMNTAuthentication } = useContext(LocalSDKContext);
29
29
  const { disconnect } = useDisconnect();
30
30
  const wallets = useConnectedWallets();
31
31
  // Keep refs so logout() always disconnects current wallets, not stale closure values.
@@ -57,7 +57,7 @@ export function useAuthentication(partnerId: string, { skipAutoConnect = false }
57
57
  const { authenticate } = useTWAuth();
58
58
  const { user, setUser } = useUserQuery();
59
59
  const useAutoConnectLoadingPrevious = useRef(false);
60
- const wagmiConfig = createWagmiConfig({ partnerId });
60
+ const wagmiConfig = useMemo(() => createWagmiConfig({ partnerId }), [partnerId]);
61
61
  const { connect } = useConnect();
62
62
  const activeWagmiAccount = useAccount();
63
63
  const { switchAccount } = useSwitchAccount();
@@ -113,9 +113,7 @@ export function useAuthentication(partnerId: string, { skipAutoConnect = false }
113
113
  });
114
114
  }
115
115
  syncWagmiFunc();
116
- // wagmi config shouldn't change
117
- // eslint-disable-next-line react-hooks/exhaustive-deps
118
- }, [partnerId, wallets]);
116
+ }, [wagmiConfig, wallets, connect, switchAccount]);
119
117
 
120
118
  useEffect(() => {
121
119
  syncWagmi();
@@ -142,9 +140,11 @@ export function useAuthentication(partnerId: string, { skipAutoConnect = false }
142
140
  setIsAuthenticating(false);
143
141
  debug("Re-authenticated successfully", { userAuth });
144
142
 
145
- // Authenticate on BSMNT with B3 JWT
146
- const b3Jwt = await authenticateWithB3JWT(userAuth.accessToken);
147
- debug("@@b3Jwt", b3Jwt);
143
+ if (!disableBSMNTAuthentication) {
144
+ // Authenticate on BSMNT with B3 JWT
145
+ const b3Jwt = await authenticateWithB3JWT(userAuth.accessToken);
146
+ debug("@@b3Jwt", b3Jwt);
147
+ }
148
148
 
149
149
  return userAuth;
150
150
  } catch (error) {
@@ -156,14 +156,25 @@ export function useAuthentication(partnerId: string, { skipAutoConnect = false }
156
156
  setIsAuthenticating(false);
157
157
  debug("Fresh authentication successful", { userAuth });
158
158
 
159
- // Authenticate on BSMNT with B3 JWT
160
- const b3Jwt = await authenticateWithB3JWT(userAuth.accessToken);
161
- debug("@@b3Jwt", b3Jwt);
159
+ if (!disableBSMNTAuthentication) {
160
+ // Authenticate on BSMNT with B3 JWT
161
+ const b3Jwt = await authenticateWithB3JWT(userAuth.accessToken);
162
+ debug("@@b3Jwt", b3Jwt);
163
+ }
162
164
 
163
165
  return userAuth;
164
166
  }
165
167
  },
166
- [activeWallet, partnerId, authenticate, setIsAuthenticated, setIsAuthenticating, setUser, setHasStartedConnecting],
168
+ [
169
+ activeWallet,
170
+ partnerId,
171
+ authenticate,
172
+ setIsAuthenticated,
173
+ setIsAuthenticating,
174
+ setUser,
175
+ setHasStartedConnecting,
176
+ disableBSMNTAuthentication,
177
+ ],
167
178
  );
168
179
 
169
180
  const logout = useCallback(
@@ -0,0 +1,191 @@
1
+ import app from "@b3dotfun/sdk/global-account/app";
2
+ import { useAuthStore, useB3Config } from "@b3dotfun/sdk/global-account/react";
3
+ import { debugB3React } from "@b3dotfun/sdk/shared/utils/debug";
4
+ import { useCallback } from "react";
5
+ import { betterAuthClient } from "../../better-auth-client";
6
+ import { useUserQuery } from "./useUserQuery";
7
+
8
+ const debug = debugB3React("useBetterAuth");
9
+
10
+ export type BetterAuthSocialProvider = "google" | "discord" | "apple" | "github" | "slack" | "microsoft";
11
+
12
+ /** Thrown when email verification is required before the user can sign in. */
13
+ export class EmailVerificationRequiredError extends Error {
14
+ constructor(message = "Check your email to verify your account before signing in.") {
15
+ super(message);
16
+ this.name = "EmailVerificationRequiredError";
17
+ }
18
+ }
19
+
20
+ /**
21
+ * Hook for authentication via Better Auth (email/password + social providers).
22
+ *
23
+ * Follows the same pattern as Thirdweb auth:
24
+ * 1. Better Auth sign-in returns a session token
25
+ * 2. Token is passed as accessToken to app.authenticate({ strategy: "better-auth" })
26
+ * 3. BetterAuthStrategy verifies the token and issues a Feathers JWT
27
+ */
28
+ export function useBetterAuth() {
29
+ const { partnerId } = useB3Config();
30
+ const { setUser } = useUserQuery();
31
+ const setIsAuthenticated = useAuthStore(state => state.setIsAuthenticated);
32
+ const setIsAuthenticating = useAuthStore(state => state.setIsAuthenticating);
33
+ const setIsConnected = useAuthStore(state => state.setIsConnected);
34
+ const setHasStartedConnecting = useAuthStore(state => state.setHasStartedConnecting);
35
+
36
+ const exchangeForFeathersJWT = useCallback(
37
+ async (sessionToken: string) => {
38
+ debug("Exchanging Better Auth token for Feathers JWT");
39
+
40
+ const response = await app.authenticate({
41
+ strategy: "better-auth",
42
+ accessToken: sessionToken,
43
+ partnerId,
44
+ } as any);
45
+
46
+ if (!response.user) {
47
+ throw new Error("No user returned from authentication");
48
+ }
49
+
50
+ setUser(response.user);
51
+ setIsAuthenticated(true);
52
+ setIsConnected(true);
53
+ setIsAuthenticating(false);
54
+
55
+ debug("Feathers JWT exchange successful", { userId: response.user?.userId });
56
+ return response;
57
+ },
58
+ [partnerId, setUser, setIsAuthenticated, setIsConnected, setIsAuthenticating],
59
+ );
60
+
61
+ const signInWithEmail = useCallback(
62
+ async (email: string, password: string) => {
63
+ debug("Signing in with email", { email });
64
+ setHasStartedConnecting(true);
65
+ setIsAuthenticating(true);
66
+
67
+ try {
68
+ const result = await betterAuthClient.signIn.email({ email, password });
69
+
70
+ if (result.error) {
71
+ throw new Error(result.error.message || "Sign in failed");
72
+ }
73
+
74
+ const token = result.data?.token;
75
+ if (!token) {
76
+ throw new Error("No session token returned from sign in");
77
+ }
78
+
79
+ return await exchangeForFeathersJWT(token);
80
+ } catch (error) {
81
+ setIsAuthenticating(false);
82
+ debug("Sign in failed", error);
83
+ throw error;
84
+ }
85
+ },
86
+ [exchangeForFeathersJWT, setIsAuthenticating, setHasStartedConnecting],
87
+ );
88
+
89
+ const signUpWithEmail = useCallback(
90
+ async (email: string, password: string, name: string) => {
91
+ debug("Signing up with email", { email, name });
92
+ setHasStartedConnecting(true);
93
+ setIsAuthenticating(true);
94
+
95
+ try {
96
+ const result = await betterAuthClient.signUp.email({ email, password, name });
97
+
98
+ if (result.error) {
99
+ throw new Error(result.error.message || "Sign up failed");
100
+ }
101
+
102
+ const token = result.data?.token;
103
+ if (!token) {
104
+ // requireEmailVerification is enabled — send verification email
105
+ // with the client's origin as callbackURL so the user returns here
106
+ await betterAuthClient.sendVerificationEmail({
107
+ email,
108
+ callbackURL: `${window.location.origin}?authStrategy=better-auth`,
109
+ });
110
+ throw new EmailVerificationRequiredError();
111
+ }
112
+
113
+ return await exchangeForFeathersJWT(token);
114
+ } catch (error) {
115
+ setIsAuthenticating(false);
116
+ debug("Sign up failed", error);
117
+ throw error;
118
+ }
119
+ },
120
+ [exchangeForFeathersJWT, setIsAuthenticating, setHasStartedConnecting],
121
+ );
122
+
123
+ const signInWithSocial = useCallback(
124
+ async (provider: BetterAuthSocialProvider) => {
125
+ debug("Signing in with social provider", { provider });
126
+ setHasStartedConnecting(true);
127
+ setIsAuthenticating(true);
128
+
129
+ try {
130
+ const result = await betterAuthClient.signIn.social({
131
+ provider,
132
+ callbackURL: window.location.href,
133
+ });
134
+
135
+ if (result.error) {
136
+ throw new Error(result.error.message || `${provider} sign in failed`);
137
+ }
138
+
139
+ // Social auth redirects to provider — JWT exchange happens on callback
140
+ // via BetterAuthProvider session restore
141
+ } catch (error) {
142
+ setIsAuthenticating(false);
143
+ debug("Social sign in failed", error);
144
+ throw error;
145
+ }
146
+ },
147
+ [setIsAuthenticating, setHasStartedConnecting],
148
+ );
149
+
150
+ const requestPasswordReset = useCallback(async (email: string, redirectTo?: string) => {
151
+ debug("Requesting password reset", { email });
152
+
153
+ const result = await betterAuthClient.requestPasswordReset({
154
+ email,
155
+ redirectTo,
156
+ });
157
+
158
+ if (result.error) {
159
+ throw new Error(result.error.message || "Password reset request failed");
160
+ }
161
+
162
+ debug("Password reset email sent");
163
+ return result;
164
+ }, []);
165
+
166
+ const resetPassword = useCallback(async (newPassword: string, token: string) => {
167
+ debug("Resetting password");
168
+
169
+ const result = await betterAuthClient.resetPassword({
170
+ newPassword,
171
+ token,
172
+ });
173
+
174
+ if (result.error) {
175
+ throw new Error(result.error.message || "Password reset failed");
176
+ }
177
+
178
+ debug("Password reset successful");
179
+ return result;
180
+ }, []);
181
+
182
+ return {
183
+ signInWithEmail,
184
+ signUpWithEmail,
185
+ signInWithSocial,
186
+ requestPasswordReset,
187
+ resetPassword,
188
+ exchangeForFeathersJWT,
189
+ betterAuthClient,
190
+ };
191
+ }
@@ -4,7 +4,7 @@ import { client } from "@b3dotfun/sdk/shared/utils/thirdweb";
4
4
  import { useCallback, useState } from "react";
5
5
  import { Chain } from "thirdweb";
6
6
  import { useConnect as useConnectTW } from "thirdweb/react";
7
- import { ecosystemWallet, SingleStepAuthArgsType } from "thirdweb/wallets";
7
+ import { ecosystemWallet, MultiStepAuthArgsType, SingleStepAuthArgsType } from "thirdweb/wallets";
8
8
  const debug = debugB3React("useConnect");
9
9
 
10
10
  /**
@@ -23,7 +23,7 @@ export function useConnect(partnerId: string, chain?: Chain) {
23
23
  * It is used to connect to a wallet using the thirdweb client.
24
24
  */
25
25
  const connectTw = useCallback(
26
- async (strategyOptions?: SingleStepAuthArgsType) => {
26
+ async (strategyOptions?: MultiStepAuthArgsType | SingleStepAuthArgsType) => {
27
27
  setIsLoading(true);
28
28
  return await connect(async () => {
29
29
  if (!strategyOptions) throw new Error("Strategy options are required");
@@ -451,6 +451,16 @@ export interface SendModalProps extends BaseModalProps {
451
451
  onSuccess?: (txHash?: string) => void;
452
452
  }
453
453
 
454
+ /**
455
+ * Props for the Session Duration modal
456
+ * Allows users to configure how long they stay signed in
457
+ */
458
+ export interface SessionDurationModalProps extends BaseModalProps {
459
+ type: "sessionDuration";
460
+ partnerId: string;
461
+ chain: Chain;
462
+ }
463
+
454
464
  /**
455
465
  * Props for the Notifications modal
456
466
  * Allows users to manage notification settings and channels
@@ -677,6 +687,7 @@ export type ModalContentType =
677
687
  | DepositModalProps
678
688
  | SendModalProps
679
689
  | NotificationsModalProps
690
+ | SessionDurationModalProps
680
691
  | AnySpendCollectorClubPurchaseProps
681
692
  | AnySpendDepositModalProps
682
693
  | AnySpendWorkflowTriggerModalProps