@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
@@ -0,0 +1,135 @@
1
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
+ import { Button, Input, LoginStepContainer, useB3Config } from "../../../../../global-account/react/index.js";
3
+ import { debugB3React } from "../../../../../shared/utils/debug.js";
4
+ import { useState } from "react";
5
+ import { EmailVerificationRequiredError, useBetterAuth, } from "../../../hooks/useBetterAuth.js";
6
+ import { AuthButton } from "../components/AuthButton.js";
7
+ const debug = debugB3React("LoginStepBetterAuth");
8
+ const EMAIL_REGEX = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
9
+ const SOCIAL_PROVIDERS = [
10
+ { id: "google", label: "Google" },
11
+ { id: "github", label: "GitHub" },
12
+ { id: "discord", label: "Discord" },
13
+ { id: "microsoft", label: "Microsoft" },
14
+ { id: "slack", label: "Slack" },
15
+ ];
16
+ export function LoginStepBetterAuth({ onSuccess, onError }) {
17
+ const { partnerId } = useB3Config();
18
+ const { signInWithEmail, signUpWithEmail, signInWithSocial, requestPasswordReset } = useBetterAuth();
19
+ const [mode, setMode] = useState("sign-in");
20
+ const [showEmailForm, setShowEmailForm] = useState(false);
21
+ const [email, setEmail] = useState("");
22
+ const [password, setPassword] = useState("");
23
+ const [name, setName] = useState("");
24
+ const [isLoading, setIsLoading] = useState(false);
25
+ const [error, setError] = useState(null);
26
+ const [resetEmailSent, setResetEmailSent] = useState(false);
27
+ const [verificationSent, setVerificationSent] = useState(false);
28
+ const handleEmailSubmit = async () => {
29
+ const normalizedEmail = email.trim().toLowerCase();
30
+ if (!EMAIL_REGEX.test(normalizedEmail)) {
31
+ setError("Please enter a valid email address");
32
+ return;
33
+ }
34
+ if (!password) {
35
+ setError("Please enter a password");
36
+ return;
37
+ }
38
+ if (mode === "sign-up" && !name.trim()) {
39
+ setError("Please enter your name");
40
+ return;
41
+ }
42
+ try {
43
+ setIsLoading(true);
44
+ setError(null);
45
+ if (mode === "sign-up") {
46
+ debug("Signing up", { email: normalizedEmail, name: name.trim() });
47
+ await signUpWithEmail(normalizedEmail, password, name.trim());
48
+ }
49
+ else {
50
+ debug("Signing in", { email: normalizedEmail });
51
+ await signInWithEmail(normalizedEmail, password);
52
+ }
53
+ debug("Auth successful");
54
+ onSuccess?.();
55
+ }
56
+ catch (err) {
57
+ if (err instanceof EmailVerificationRequiredError) {
58
+ setVerificationSent(true);
59
+ setError(null);
60
+ }
61
+ else {
62
+ const message = err instanceof Error ? err.message : "Authentication failed";
63
+ setError(message);
64
+ await onError?.(err);
65
+ }
66
+ debug("Auth failed", err);
67
+ }
68
+ finally {
69
+ setPassword("");
70
+ setIsLoading(false);
71
+ }
72
+ };
73
+ const handleForgotPassword = async () => {
74
+ const normalizedEmail = email.trim().toLowerCase();
75
+ if (!EMAIL_REGEX.test(normalizedEmail)) {
76
+ setError("Please enter a valid email address");
77
+ return;
78
+ }
79
+ try {
80
+ setIsLoading(true);
81
+ setError(null);
82
+ await requestPasswordReset(normalizedEmail);
83
+ setResetEmailSent(true);
84
+ }
85
+ catch (err) {
86
+ const message = err instanceof Error ? err.message : "Failed to send reset email";
87
+ setError(message);
88
+ }
89
+ finally {
90
+ setIsLoading(false);
91
+ }
92
+ };
93
+ const handleSocialSignIn = async (provider) => {
94
+ try {
95
+ setIsLoading(true);
96
+ setError(null);
97
+ await signInWithSocial(provider);
98
+ }
99
+ catch (err) {
100
+ const message = err instanceof Error ? err.message : `${provider} sign in failed`;
101
+ setError(message);
102
+ await onError?.(err);
103
+ setIsLoading(false);
104
+ }
105
+ };
106
+ if (verificationSent) {
107
+ return (_jsx(LoginStepContainer, { partnerId: partnerId, children: _jsxs("div", { className: "mb-6 w-full space-y-4 px-3 text-center", children: [_jsx("div", { className: "mx-auto flex h-12 w-12 items-center justify-center rounded-full bg-green-100", children: _jsx("svg", { className: "h-6 w-6 text-green-600", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: _jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, 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" }) }) }), _jsx("p", { className: "text-sm font-medium text-gray-900 dark:text-gray-100", children: "Check your email" }), _jsxs("p", { className: "text-xs text-gray-500 dark:text-gray-400", children: ["We sent a verification link to ", _jsx("span", { className: "font-medium text-gray-700 dark:text-gray-200", children: email }), ". Verify your account, then come back and sign in."] }), _jsx("button", { onClick: () => {
108
+ setVerificationSent(false);
109
+ setMode("sign-in");
110
+ setShowEmailForm(true);
111
+ setPassword("");
112
+ }, className: "text-sm text-gray-500 hover:text-gray-700 dark:text-gray-400 dark:hover:text-gray-300", children: "Back to sign in" })] }) }));
113
+ }
114
+ return (_jsx(LoginStepContainer, { partnerId: partnerId, children: mode === "forgot-password" ? (_jsxs("div", { className: "mb-6 w-full space-y-3 px-3", children: [_jsx("p", { className: "text-center text-sm font-medium text-gray-900 dark:text-gray-100", children: "Reset password" }), _jsx("p", { className: "text-center text-xs text-gray-500", children: "Enter your email and we'll send you a reset link" }), resetEmailSent ? (_jsx("div", { className: "space-y-3 py-4 text-center", children: _jsx("p", { className: "text-sm text-green-600", children: "Check your email for a reset link." }) })) : (_jsxs(_Fragment, { children: [_jsx(Input, { type: "email", placeholder: "you@example.com", value: email, onChange: event => setEmail(event.target.value), disabled: isLoading, onKeyDown: event => {
115
+ if (event.key === "Enter")
116
+ handleForgotPassword();
117
+ } }), error && _jsx("p", { className: "text-sm text-red-500", children: error }), _jsx(Button, { onClick: handleForgotPassword, disabled: isLoading, className: "w-full", children: isLoading ? "Sending..." : "Send reset link" })] })), _jsx("button", { onClick: () => {
118
+ setMode("sign-in");
119
+ setShowEmailForm(true);
120
+ setError(null);
121
+ setResetEmailSent(false);
122
+ }, className: "w-full text-center text-sm text-gray-500 hover:text-gray-700", children: "Back to sign in" })] })) : showEmailForm ? (_jsxs("div", { className: "mb-6 w-full space-y-3 px-3", children: [_jsx("p", { className: "text-center text-sm font-medium text-gray-900 dark:text-gray-100", children: mode === "sign-in" ? "Sign in with email" : "Create an account" }), mode === "sign-up" && (_jsx(Input, { type: "text", placeholder: "Your name", value: name, onChange: event => setName(event.target.value), disabled: isLoading })), _jsx(Input, { type: "email", placeholder: "you@example.com", value: email, onChange: event => setEmail(event.target.value), disabled: isLoading }), _jsx(Input, { type: "password", placeholder: "Password", value: password, onChange: event => setPassword(event.target.value), disabled: isLoading, onKeyDown: event => {
123
+ if (event.key === "Enter")
124
+ handleEmailSubmit();
125
+ } }), error && _jsx("p", { className: "text-sm text-red-500", children: error }), _jsx(Button, { onClick: handleEmailSubmit, disabled: isLoading, className: "w-full", children: isLoading ? "Loading..." : mode === "sign-in" ? "Sign in" : "Sign up" }), mode === "sign-in" && (_jsx("button", { onClick: () => {
126
+ setMode("forgot-password");
127
+ setError(null);
128
+ }, disabled: isLoading, className: "w-full text-center text-xs text-gray-500 hover:text-gray-700", children: "Forgot password?" })), _jsx("button", { onClick: () => {
129
+ setMode(mode === "sign-in" ? "sign-up" : "sign-in");
130
+ setError(null);
131
+ }, disabled: isLoading, className: "w-full text-center text-sm text-gray-500 hover:text-gray-700", children: mode === "sign-in" ? "Don't have an account? Sign up" : "Already have an account? Sign in" }), _jsx(Button, { variant: "outline", onClick: () => {
132
+ setShowEmailForm(false);
133
+ setError(null);
134
+ }, disabled: isLoading, className: "w-full", children: "Back" })] })) : (_jsxs("div", { className: "mb-6 w-full space-y-4 px-3", children: [_jsx("div", { className: "grid w-full grid-cols-3 gap-4", children: SOCIAL_PROVIDERS.map(provider => (_jsx(AuthButton, { strategy: provider.id, onClick: () => handleSocialSignIn(provider.id), isLoading: isLoading }, provider.id))) }), _jsxs("div", { className: "flex items-center gap-3", children: [_jsx("div", { className: "h-px flex-1 bg-gray-200" }), _jsx("span", { className: "text-xs text-gray-400", children: "or" }), _jsx("div", { className: "h-px flex-1 bg-gray-200" })] }), _jsx(AuthButton, { strategy: "email", onClick: () => setShowEmailForm(true), isLoading: isLoading }), error && _jsx("p", { className: "text-center text-sm text-red-500", children: error })] })) }));
135
+ }
@@ -1,38 +1,52 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { AuthButton, Button, getConnectOptionsFromStrategy, isWalletType, LoginStepContainer, useAuthentication, useAuthStore, useB3Config, useConnect, WalletRow, } from "../../../../../global-account/react/index.js";
1
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
+ import { AuthButton, Button, getConnectOptionsFromStrategy, Input, isWalletType, LoginStepContainer, useAuthentication, useAuthStore, useB3Config, useConnect, WalletRow, } from "../../../../../global-account/react/index.js";
3
+ import { ecosystemWalletId } from "../../../../../shared/constants/index.js";
3
4
  import { debugB3React } from "../../../../../shared/utils/debug.js";
4
5
  import { client } from "../../../../../shared/utils/thirdweb.js";
5
6
  import { useState } from "react";
6
- import { useConnect as useConnectTW } from "thirdweb/react";
7
- import { createWallet } from "thirdweb/wallets";
7
+ import { useConnectedWallets, useConnect as useConnectTW } from "thirdweb/react";
8
+ import { createWallet, preAuthenticate, } from "thirdweb/wallets";
8
9
  const debug = debugB3React("LoginStepCustom");
10
+ const EMAIL_REGEX = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
9
11
  export function LoginStepCustom({ onSuccess, onError, chain, strategies, maxInitialWallets = 2, automaticallySetFirstEoa, }) {
10
12
  const { partnerId } = useB3Config();
11
13
  const [isLoading, setIsLoading] = useState(false);
12
14
  const [showAllWallets, setShowAllWallets] = useState(false);
15
+ const [showEmailFlow, setShowEmailFlow] = useState(false);
16
+ const [email, setEmail] = useState("");
17
+ const [verificationCode, setVerificationCode] = useState("");
18
+ const [emailCodeSent, setEmailCodeSent] = useState(false);
19
+ const [emailError, setEmailError] = useState(null);
13
20
  const { connect } = useConnect(partnerId, chain);
14
21
  const setIsAuthenticating = useAuthStore(state => state.setIsAuthenticating);
15
- const setIsAuthenticated = useAuthStore(state => state.setIsAuthenticated);
16
- const { logout } = useAuthentication(partnerId, { skipAutoConnect: true });
22
+ const { connect: onAuthConnect, logout } = useAuthentication(partnerId, { skipAutoConnect: true });
17
23
  const { connect: connectTW } = useConnectTW();
24
+ const connectedWallets = useConnectedWallets();
18
25
  // Split strategies into auth and wallet types
19
26
  const authStrategies = strategies.filter(s => !isWalletType(s));
20
27
  const walletStrategies = strategies.filter(isWalletType);
21
28
  const initialWallets = walletStrategies.slice(0, maxInitialWallets);
22
29
  const additionalWallets = walletStrategies.slice(maxInitialWallets);
23
- const handleConnect = async (strategy) => {
30
+ const authGridColumns = Math.max(1, Math.min(authStrategies.length, 4));
31
+ const resetEmailFlow = () => {
32
+ setShowEmailFlow(false);
33
+ setEmailCodeSent(false);
34
+ setVerificationCode("");
35
+ setEmailError(null);
36
+ };
37
+ const connectWithOptions = async (strategy, options) => {
24
38
  try {
25
39
  setIsLoading(true);
26
40
  debug("setIsAuthenticating:true:3");
27
41
  setIsAuthenticating(true);
28
- const options = getConnectOptionsFromStrategy(strategy);
29
42
  let connectResult;
30
- if (automaticallySetFirstEoa) {
31
- if (!options.wallet?.id) {
43
+ if (automaticallySetFirstEoa && isWalletType(strategy) && options.strategy === "wallet") {
44
+ const walletId = options.wallet?.id;
45
+ if (!walletId) {
32
46
  throw new Error("Wallet ID is required");
33
47
  }
34
48
  connectResult = await connectTW(async () => {
35
- const wallet = createWallet(options.wallet?.id);
49
+ const wallet = createWallet(walletId);
36
50
  await wallet.connect({
37
51
  client,
38
52
  });
@@ -40,20 +54,27 @@ export function LoginStepCustom({ onSuccess, onError, chain, strategies, maxInit
40
54
  });
41
55
  }
42
56
  else {
43
- // @ts-expect-error we have custom strategies too and we also get things like "apple" isn't assignable to "wallet"
44
57
  connectResult = await connect(options);
45
58
  }
46
59
  const account = connectResult?.getAccount();
47
60
  debug("@@connectResult", { connectResult, account, options });
48
- if (!account)
61
+ if (!account || !connectResult)
49
62
  throw new Error("Failed to connect");
63
+ const allConnectedWallets = connectedWallets.length > 0 && connectedWallets.some(wallet => wallet.id === connectResult.id)
64
+ ? connectedWallets
65
+ : [connectResult, ...connectedWallets.filter(wallet => wallet.id !== connectResult.id)];
66
+ await onAuthConnect(connectResult, allConnectedWallets);
50
67
  await onSuccess(account);
51
- setIsAuthenticated(true);
68
+ if (strategy === "email") {
69
+ resetEmailFlow();
70
+ }
52
71
  }
53
72
  catch (error) {
73
+ if (strategy === "email") {
74
+ setEmailError(error instanceof Error ? error.message : "Failed to sign in with email");
75
+ }
54
76
  await onError?.(error);
55
77
  await logout();
56
- setIsAuthenticated(false);
57
78
  }
58
79
  finally {
59
80
  setIsLoading(false);
@@ -61,8 +82,68 @@ export function LoginStepCustom({ onSuccess, onError, chain, strategies, maxInit
61
82
  setIsAuthenticating(false);
62
83
  }
63
84
  };
64
- return (_jsxs(LoginStepContainer, { partnerId: partnerId, children: [authStrategies.length > 0 && (_jsx("div", { className: `mb-6 w-full ${authStrategies.length <= 3 ? "space-y-3 px-3" : "grid grid-cols-4 gap-4"}`, children: authStrategies.map(strategy => {
65
- console.log("strategy", strategy);
66
- return (_jsx(AuthButton, { strategy: strategy, onClick: () => handleConnect(strategy), isLoading: isLoading }, strategy));
67
- }) })), _jsx("div", { className: "mb-4 w-full space-y-2", children: initialWallets.map(walletId => (_jsx(WalletRow, { walletId: walletId, onClick: () => handleConnect(walletId), isLoading: isLoading }, walletId))) }), additionalWallets.length > 0 && (_jsxs("div", { className: "w-full", children: [_jsx(Button, { onClick: () => setShowAllWallets(!showAllWallets), className: "mb-2 w-full bg-transparent text-gray-600 hover:bg-gray-100", children: showAllWallets ? "Show less" : "More options" }), showAllWallets && (_jsx("div", { className: "max-h-60 space-y-2 overflow-y-auto", children: additionalWallets.map(walletId => (_jsx(WalletRow, { walletId: walletId, onClick: () => handleConnect(walletId), isLoading: isLoading }, walletId))) }))] }))] }));
85
+ const handleConnect = async (strategy) => {
86
+ if (strategy === "email") {
87
+ setShowEmailFlow(true);
88
+ setEmailCodeSent(false);
89
+ setVerificationCode("");
90
+ setEmailError(null);
91
+ return;
92
+ }
93
+ const options = getConnectOptionsFromStrategy(strategy);
94
+ await connectWithOptions(strategy, options);
95
+ };
96
+ const handleSendEmailCode = async () => {
97
+ const normalizedEmail = email.trim().toLowerCase();
98
+ if (!normalizedEmail) {
99
+ setEmailError("Please enter your email address");
100
+ return;
101
+ }
102
+ if (!EMAIL_REGEX.test(normalizedEmail)) {
103
+ setEmailError("Please enter a valid email address");
104
+ return;
105
+ }
106
+ try {
107
+ setIsLoading(true);
108
+ setEmailError(null);
109
+ await preAuthenticate({
110
+ client,
111
+ strategy: "email",
112
+ email: normalizedEmail,
113
+ ecosystem: {
114
+ id: ecosystemWalletId,
115
+ partnerId,
116
+ },
117
+ });
118
+ setEmail(normalizedEmail);
119
+ setEmailCodeSent(true);
120
+ }
121
+ catch (error) {
122
+ setEmailError(error instanceof Error ? error.message : "Failed to send verification code");
123
+ await onError?.(error);
124
+ }
125
+ finally {
126
+ setIsLoading(false);
127
+ }
128
+ };
129
+ const handleEmailLogin = async () => {
130
+ const normalizedEmail = email.trim().toLowerCase();
131
+ const normalizedCode = verificationCode.trim();
132
+ if (!EMAIL_REGEX.test(normalizedEmail)) {
133
+ setEmailError("Please enter a valid email address");
134
+ return;
135
+ }
136
+ if (!normalizedCode) {
137
+ setEmailError("Please enter your verification code");
138
+ return;
139
+ }
140
+ await connectWithOptions("email", {
141
+ strategy: "email",
142
+ email: normalizedEmail,
143
+ verificationCode: normalizedCode,
144
+ });
145
+ };
146
+ return (_jsx(LoginStepContainer, { partnerId: partnerId, children: showEmailFlow ? (_jsxs("div", { className: "mb-6 w-full space-y-3 px-3", children: [_jsx("p", { className: "text-center text-sm font-medium text-gray-900 dark:text-gray-100", children: "Sign in with email" }), _jsx(Input, { type: "email", placeholder: "you@example.com", value: email, onChange: event => setEmail(event.target.value), disabled: isLoading || emailCodeSent }), emailCodeSent && (_jsx(Input, { type: "text", placeholder: "Enter verification code", value: verificationCode, onChange: event => setVerificationCode(event.target.value), disabled: isLoading })), emailError && _jsx("p", { className: "text-sm text-red-500", children: emailError }), _jsx(Button, { onClick: emailCodeSent ? handleEmailLogin : handleSendEmailCode, disabled: isLoading, className: "w-full", children: isLoading ? "Loading..." : emailCodeSent ? "Verify code" : "Send code" }), emailCodeSent && (_jsx(Button, { variant: "outline", onClick: handleSendEmailCode, disabled: isLoading, className: "w-full", children: "Resend code" })), _jsx(Button, { variant: "outline", onClick: resetEmailFlow, disabled: isLoading, className: "w-full", children: "Back" })] })) : (_jsxs(_Fragment, { children: [authStrategies.length > 0 && (_jsx("div", { className: `mb-6 grid w-full gap-4 px-3 ${authStrategies.length > 4 ? "grid-cols-4" : ""}`, style: authStrategies.length <= 4
147
+ ? { gridTemplateColumns: `repeat(${authGridColumns}, minmax(0, 1fr))` }
148
+ : undefined, children: authStrategies.map(strategy => (_jsx(AuthButton, { strategy: strategy, onClick: () => handleConnect(strategy), isLoading: isLoading }, strategy))) })), _jsx("div", { className: "mb-4 w-full space-y-2", children: initialWallets.map(walletId => (_jsx(WalletRow, { walletId: walletId, onClick: () => handleConnect(walletId), isLoading: isLoading }, walletId))) }), additionalWallets.length > 0 && (_jsxs("div", { className: "w-full", children: [_jsx(Button, { onClick: () => setShowAllWallets(!showAllWallets), className: "mb-2 w-full bg-transparent text-gray-600 hover:bg-gray-100", children: showAllWallets ? "Show less" : "More options" }), showAllWallets && (_jsx("div", { className: "max-h-60 space-y-2 overflow-y-auto", children: additionalWallets.map(walletId => (_jsx(WalletRow, { walletId: walletId, onClick: () => handleConnect(walletId), isLoading: isLoading }, walletId))) }))] }))] })) }));
68
149
  }
@@ -3,15 +3,17 @@ import { SingleStepAuthArgsType, Wallet } from "thirdweb/wallets";
3
3
  type WalletType = Wallet["id"];
4
4
  type StrategyType = SingleStepAuthArgsType["strategy"];
5
5
  type CustomStrategyType = "basement" | "privy";
6
- type AllowedStrategies = StrategyType | WalletType | CustomStrategyType;
7
- export declare const allowedStrategies: readonly ["apple", "google", "x", "discord", "guest", "walletConnect", "io.metamask", "com.coinbase.wallet", "basement", "privy"];
6
+ type AllowedStrategies = StrategyType | WalletType | CustomStrategyType | "email";
7
+ type NonWalletStrategyType = Exclude<AllowedStrategies, WalletType>;
8
+ export declare const allowedStrategies: readonly ["apple", "google", "github", "x", "discord", "email", "guest", "walletConnect", "io.metamask", "com.coinbase.wallet", "basement", "privy"];
8
9
  export type AllowedStrategy = (typeof allowedStrategies)[number];
9
10
  export declare function isWalletType(strategy: AllowedStrategies): strategy is WalletType;
10
- export declare function isStrategyType(strategy: AllowedStrategies): strategy is StrategyType;
11
+ export declare function isStrategyType(strategy: AllowedStrategies): strategy is NonWalletStrategyType;
11
12
  export declare function getConnectOptionsFromStrategy(strategy: AllowedStrategy): {
12
13
  strategy: StrategyType;
13
14
  wallet?: Wallet;
14
15
  chain?: Chain;
15
16
  };
16
17
  export declare const strategyIcons: Record<string, string>;
18
+ export declare const strategyLabels: Record<string, string>;
17
19
  export {};
@@ -5,9 +5,10 @@ export const allowedStrategies = [
5
5
  // Auth strategies
6
6
  "apple",
7
7
  "google",
8
+ "github",
8
9
  "x",
9
10
  "discord",
10
- // "github",
11
+ "email",
11
12
  "guest",
12
13
  // Wallet IDs
13
14
  "walletConnect",
@@ -29,6 +30,9 @@ export function getConnectOptionsFromStrategy(strategy) {
29
30
  if (!allowedStrategies.includes(strategy)) {
30
31
  throw new Error(`Invalid strategy: ${strategy}`);
31
32
  }
33
+ if (strategy === "email") {
34
+ throw new Error("Email strategy requires OTP flow and cannot be connected in a single step");
35
+ }
32
36
  if (isWalletType(strategy)) {
33
37
  return { strategy: "wallet", wallet: createWallet(strategy) };
34
38
  }
@@ -39,11 +43,24 @@ export function getConnectOptionsFromStrategy(strategy) {
39
43
  }
40
44
  export const strategyIcons = {
41
45
  google: "https://cdn.b3.fun/google.svg",
46
+ github: "https://cdn.jsdelivr.net/gh/devicons/devicon/icons/github/github-original.svg",
42
47
  x: "https://cdn.b3.fun/x.svg?1",
43
48
  discord: "https://cdn.b3.fun/discord.svg",
44
49
  apple: "https://cdn.b3.fun/apple.svg",
45
50
  guest: "https://cdn.b3.fun/incognito.svg",
46
- // Add more strategies as needed
51
+ microsoft: "https://upload.wikimedia.org/wikipedia/commons/4/44/Microsoft_logo.svg",
52
+ slack: "https://upload.wikimedia.org/wikipedia/commons/d/d5/Slack_icon_2019.svg",
53
+ };
54
+ export const strategyLabels = {
55
+ google: "Google",
56
+ x: "X",
57
+ discord: "Discord",
58
+ apple: "Apple",
59
+ guest: "Guest",
60
+ github: "GitHub",
61
+ email: "Email",
62
+ microsoft: "Microsoft",
63
+ slack: "Slack",
47
64
  };
48
65
  // Test it
49
66
  // console.log(getConnectOptionsFromStrategy("io.metamask"));
@@ -4,6 +4,7 @@ import { cn } from "../../../../shared/utils/index.js";
4
4
  import { Search, X } from "lucide-react";
5
5
  import { useCallback, useEffect, useRef, useState } from "react";
6
6
  import { fetchProfile as fetchProfileApi } from "../../utils/profileApi.js";
7
+ import { validateImageUrl } from "../../utils/profileDisplay.js";
7
8
  import { IPFSMediaRenderer } from "../IPFSMediaRenderer/IPFSMediaRenderer.js";
8
9
  import { Input } from "../ui/input.js";
9
10
  /**
@@ -156,5 +157,5 @@ export function SingleUserSearchSelector({ onSelectUser, profileTypeFilter, plac
156
157
  const getProfileTypeBadges = (profiles) => {
157
158
  return profiles.map(p => p.type);
158
159
  };
159
- return (_jsxs("div", { className: cn("single-user-search-selector b3-root relative w-full", className), ref: dropdownRef, children: [_jsxs("div", { className: "single-user-search-input-wrapper relative flex items-center", children: [_jsx(Search, { className: "single-user-search-icon pointer-events-none absolute text-gray-400", style: { left: "12px", width: "16px", height: "16px" } }), _jsx(Input, { ref: inputRef, type: "text", value: searchQuery, onChange: e => setSearchQuery(e.target.value), placeholder: placeholder, className: cn("single-user-search-input w-full border-gray-300 focus:border-blue-500 focus:ring-blue-500"), style: { paddingLeft: "44px", paddingRight: "44px" } }), showClearButton && searchQuery && (_jsx("button", { onClick: handleClear, className: "single-user-search-clear-button absolute text-gray-400 transition-colors hover:text-gray-600", style: { right: "12px" }, type: "button", children: _jsx(X, { style: { width: "16px", height: "16px" } }) }))] }), isSearching && _jsx("div", { className: "single-user-search-loading mt-2 text-sm text-gray-500", children: "Searching..." }), error && !isSearching && _jsx("div", { className: "single-user-search-error mt-2 text-sm text-red-500", children: error }), showDropdown && searchResult && !isSearching && (_jsx("div", { className: "single-user-search-dropdown absolute z-50 mt-2 w-full rounded-lg border border-gray-200 bg-white shadow-lg", children: _jsx("button", { onClick: () => handleSelectUser(searchResult), className: "single-user-search-result-button w-full px-4 py-3 text-left transition-colors hover:bg-gray-50", type: "button", children: _jsxs("div", { className: "flex items-start gap-3", children: [_jsx("div", { className: "single-user-search-result-avatar h-11 w-11 shrink-0", children: _jsx(IPFSMediaRenderer, { src: searchResult.avatar, alt: getDisplayName(searchResult), className: "h-full w-full rounded-full object-cover" }) }), _jsxs("div", { className: "single-user-search-result-info min-w-0 flex-1 pt-0.5", children: [_jsx("div", { className: "single-user-search-result-name text-base font-semibold text-gray-900", children: getDisplayName(searchResult) }), searchResult.address && (_jsxs("div", { className: "single-user-search-result-address mt-1 font-mono text-xs text-gray-500", children: [searchResult.address.slice(0, 6), "...", searchResult.address.slice(-4)] })), searchResult.bio && (_jsx("div", { className: "single-user-search-result-bio mt-1.5 line-clamp-2 text-sm text-gray-600", children: searchResult.bio })), showBadges && (_jsx("div", { className: "single-user-search-result-badges mt-2 flex flex-wrap gap-1.5", children: getProfileTypeBadges(searchResult.profiles).map((type, index) => (_jsx("span", { className: "single-user-search-result-badge inline-flex items-center rounded-full bg-blue-100 px-2.5 py-0.5 text-xs font-medium text-blue-800", children: type }, `${type}-${index}`))) }))] })] }) }) }))] }));
160
+ return (_jsxs("div", { className: cn("single-user-search-selector b3-root relative w-full", className), ref: dropdownRef, children: [_jsxs("div", { className: "single-user-search-input-wrapper relative flex items-center", children: [_jsx(Search, { className: "single-user-search-icon pointer-events-none absolute text-gray-400", style: { left: "12px", width: "16px", height: "16px" } }), _jsx(Input, { ref: inputRef, type: "text", value: searchQuery, onChange: e => setSearchQuery(e.target.value), placeholder: placeholder, className: cn("single-user-search-input w-full border-gray-300 focus:border-blue-500 focus:ring-blue-500"), style: { paddingLeft: "44px", paddingRight: "44px" } }), showClearButton && searchQuery && (_jsx("button", { onClick: handleClear, className: "single-user-search-clear-button absolute text-gray-400 transition-colors hover:text-gray-600", style: { right: "12px" }, type: "button", children: _jsx(X, { style: { width: "16px", height: "16px" } }) }))] }), isSearching && _jsx("div", { className: "single-user-search-loading mt-2 text-sm text-gray-500", children: "Searching..." }), error && !isSearching && _jsx("div", { className: "single-user-search-error mt-2 text-sm text-red-500", children: error }), showDropdown && searchResult && !isSearching && (_jsx("div", { className: "single-user-search-dropdown absolute z-50 mt-2 w-full rounded-lg border border-gray-200 bg-white shadow-lg", children: _jsx("button", { onClick: () => handleSelectUser(searchResult), className: "single-user-search-result-button w-full px-4 py-3 text-left transition-colors hover:bg-gray-50", type: "button", children: _jsxs("div", { className: "flex items-start gap-3", children: [_jsx("div", { className: "single-user-search-result-avatar h-11 w-11 shrink-0", children: _jsx(IPFSMediaRenderer, { src: validateImageUrl(searchResult.avatar) ?? undefined, alt: getDisplayName(searchResult), className: "h-full w-full rounded-full object-cover" }) }), _jsxs("div", { className: "single-user-search-result-info min-w-0 flex-1 pt-0.5", children: [_jsx("div", { className: "single-user-search-result-name text-base font-semibold text-gray-900", children: getDisplayName(searchResult) }), searchResult.address && (_jsxs("div", { className: "single-user-search-result-address mt-1 font-mono text-xs text-gray-500", children: [searchResult.address.slice(0, 6), "...", searchResult.address.slice(-4)] })), searchResult.bio && (_jsx("div", { className: "single-user-search-result-bio mt-1.5 line-clamp-2 text-sm text-gray-600", children: searchResult.bio })), showBadges && (_jsx("div", { className: "single-user-search-result-badges mt-2 flex flex-wrap gap-1.5", children: getProfileTypeBadges(searchResult.profiles).map((type, index) => (_jsx("span", { className: "single-user-search-result-badge inline-flex items-center rounded-full bg-blue-100 px-2.5 py-0.5 text-xs font-medium text-blue-800", children: type }, `${type}-${index}`))) }))] })] }) }) }))] }));
160
161
  }
@@ -11,6 +11,9 @@ interface ToastContextType {
11
11
  addToast: (type: ToastType, message: string, duration?: number) => string;
12
12
  removeToast: (id: string) => void;
13
13
  clearAll: () => void;
14
+ headerMode: boolean;
15
+ setHeaderMode: (enabled: boolean) => void;
16
+ latestToast: ToastItem | null;
14
17
  }
15
18
  export declare function ToastProvider({ children }: {
16
19
  children: React.ReactNode;
@@ -4,6 +4,9 @@ const ToastContext = createContext(undefined);
4
4
  let globalToastCounter = 0;
5
5
  export function ToastProvider({ children }) {
6
6
  const [toasts, setToasts] = useState([]);
7
+ const [headerMode, setHeaderMode] = useState(false);
8
+ const headerModeRef = useRef(false);
9
+ const [latestToast, setLatestToast] = useState(null);
7
10
  const timeoutsRef = useRef(new Map());
8
11
  const removeToast = useCallback((id) => {
9
12
  setToasts(prev => prev.filter(toast => toast.id !== id));
@@ -22,12 +25,23 @@ export function ToastProvider({ children }) {
22
25
  duration,
23
26
  createdAt: Date.now(),
24
27
  };
25
- setToasts(prev => [...prev, newToast]);
26
- if (duration > 0) {
27
- const timeout = setTimeout(() => {
28
- removeToast(id);
29
- }, duration);
30
- timeoutsRef.current.set(id, timeout);
28
+ if (headerModeRef.current) {
29
+ setLatestToast(newToast);
30
+ if (duration > 0) {
31
+ const timeout = setTimeout(() => {
32
+ setLatestToast(null);
33
+ }, duration);
34
+ timeoutsRef.current.set(id, timeout);
35
+ }
36
+ }
37
+ else {
38
+ setToasts(prev => [...prev, newToast]);
39
+ if (duration > 0) {
40
+ const timeout = setTimeout(() => {
41
+ removeToast(id);
42
+ }, duration);
43
+ timeoutsRef.current.set(id, timeout);
44
+ }
31
45
  }
32
46
  return id;
33
47
  }, [removeToast]);
@@ -36,6 +50,15 @@ export function ToastProvider({ children }) {
36
50
  timeoutsRef.current.clear();
37
51
  setToasts([]);
38
52
  }, []);
53
+ const setHeaderModeCallback = useCallback((enabled) => {
54
+ setHeaderMode(enabled);
55
+ headerModeRef.current = enabled;
56
+ if (!enabled) {
57
+ setLatestToast(null);
58
+ timeoutsRef.current.forEach(timeout => clearTimeout(timeout));
59
+ timeoutsRef.current.clear();
60
+ }
61
+ }, []);
39
62
  // Cleanup on unmount
40
63
  useEffect(() => {
41
64
  const timeouts = timeoutsRef.current;
@@ -44,7 +67,7 @@ export function ToastProvider({ children }) {
44
67
  timeouts.clear();
45
68
  };
46
69
  }, []);
47
- return _jsx(ToastContext.Provider, { value: { toasts, addToast, removeToast, clearAll }, children: children });
70
+ return (_jsx(ToastContext.Provider, { value: { toasts, addToast, removeToast, clearAll, headerMode, setHeaderMode: setHeaderModeCallback, latestToast }, children: children }));
48
71
  }
49
72
  export function useToastContext() {
50
73
  const context = useContext(ToastContext);
@@ -1,6 +1,6 @@
1
1
  import * as React from "react";
2
2
  declare const buttonVariants: (props?: ({
3
- variant?: "link" | "default" | "b3" | "destructive" | "outline" | "secondary" | "ghost" | null | undefined;
3
+ variant?: "default" | "link" | "b3" | "destructive" | "outline" | "secondary" | "ghost" | null | undefined;
4
4
  size?: "default" | "icon" | "sm" | "lg" | null | undefined;
5
5
  } & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
6
6
  interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
@@ -1,10 +1,13 @@
1
1
  export { B3DynamicModal } from "./B3DynamicModal";
2
2
  export { B3Provider } from "./B3Provider/B3Provider";
3
+ export type { AuthStrategy } from "./B3Provider/B3ConfigProvider";
3
4
  export { RelayKitProviderWrapper } from "./B3Provider/RelayKitProviderWrapper";
4
5
  export { useB3 } from "./B3Provider/useB3";
5
6
  export { useB3Account } from "./B3Provider/useB3Account";
6
7
  export { useB3Config } from "./B3Provider/useB3Config";
7
8
  export { StyleRoot } from "./StyleRoot";
9
+ export { BetterAuthResetPassword, type BetterAuthResetPasswordProps } from "./SignInWithB3/BetterAuthResetPassword";
10
+ export { BetterAuthSignIn, type BetterAuthSignInProps } from "./SignInWithB3/BetterAuthSignIn";
8
11
  export { AuthButton } from "./SignInWithB3/components/AuthButton";
9
12
  export { PermissionItem } from "./SignInWithB3/components/PermissionItem";
10
13
  export { WalletRow } from "./SignInWithB3/components/WalletRow";
@@ -8,6 +8,8 @@ export { useB3Account } from "./B3Provider/useB3Account.js";
8
8
  export { useB3Config } from "./B3Provider/useB3Config.js";
9
9
  export { StyleRoot } from "./StyleRoot.js";
10
10
  // SignInWithB3 Components
11
+ export { BetterAuthResetPassword } from "./SignInWithB3/BetterAuthResetPassword.js";
12
+ export { BetterAuthSignIn } from "./SignInWithB3/BetterAuthSignIn.js";
11
13
  export { AuthButton } from "./SignInWithB3/components/AuthButton.js";
12
14
  export { PermissionItem } from "./SignInWithB3/components/PermissionItem.js";
13
15
  export { WalletRow } from "./SignInWithB3/components/WalletRow.js";
@@ -1,7 +1,7 @@
1
1
  import { type VariantProps } from "class-variance-authority";
2
2
  import * as React from "react";
3
3
  declare const buttonVariants: (props?: ({
4
- variant?: "link" | "default" | "destructive" | "outline" | "secondary" | "ghost" | null | undefined;
4
+ variant?: "default" | "link" | "destructive" | "outline" | "secondary" | "ghost" | null | undefined;
5
5
  size?: "default" | "icon" | "sm" | "lg" | null | undefined;
6
6
  } & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
7
7
  export interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement>, VariantProps<typeof buttonVariants> {
@@ -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";
@@ -5,6 +5,7 @@ export { useAddTWSessionKey } from "./useAddTWSessionKey.js";
5
5
  export { useAnalytics } from "./useAnalytics.js";
6
6
  export { useAuth } from "./useAuth.js";
7
7
  export { useAuthentication } from "./useAuthentication.js";
8
+ export { useBetterAuth, EmailVerificationRequiredError } from "./useBetterAuth.js";
8
9
  export { useB3BalanceFromAddresses } from "./useB3BalanceFromAddresses.js";
9
10
  export { useB3EnsName } from "./useB3EnsName.js";
10
11
  export { useChainSwitchWithAction } from "./useChainSwitchWithAction.js";