@b3dotfun/sdk 0.0.88-alpha.0 → 0.0.88-alpha.10

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 (281) hide show
  1. package/dist/cjs/anyspend/constants/index.d.ts +2 -0
  2. package/dist/cjs/anyspend/constants/index.js +3 -1
  3. package/dist/cjs/anyspend/index.d.ts +2 -0
  4. package/dist/cjs/anyspend/index.js +3 -0
  5. package/dist/cjs/anyspend/react/components/AnySpend.d.ts +6 -0
  6. package/dist/cjs/anyspend/react/components/AnySpend.js +9 -6
  7. package/dist/cjs/anyspend/react/components/AnySpendCollectorClubPurchase.d.ts +5 -1
  8. package/dist/cjs/anyspend/react/components/AnySpendCollectorClubPurchase.js +2 -2
  9. package/dist/cjs/anyspend/react/components/AnySpendCustom.d.ts +1 -0
  10. package/dist/cjs/anyspend/react/components/AnySpendCustom.js +3 -3
  11. package/dist/cjs/anyspend/react/components/AnySpendCustomExactIn.d.ts +6 -0
  12. package/dist/cjs/anyspend/react/components/AnySpendCustomExactIn.js +24 -20
  13. package/dist/cjs/anyspend/react/components/AnySpendDeposit.d.ts +7 -1
  14. package/dist/cjs/anyspend/react/components/AnySpendDeposit.js +3 -3
  15. package/dist/cjs/anyspend/react/components/AnyspendDepositHype.d.ts +4 -0
  16. package/dist/cjs/anyspend/react/components/common/CryptoPaymentMethod.js +14 -1
  17. package/dist/cjs/anyspend/react/components/common/CryptoReceiveSection.d.ts +3 -1
  18. package/dist/cjs/anyspend/react/components/common/CryptoReceiveSection.js +3 -2
  19. package/dist/cjs/anyspend/react/components/common/GasIndicator.d.ts +6 -0
  20. package/dist/cjs/anyspend/react/components/common/GasIndicator.js +34 -0
  21. package/dist/cjs/anyspend/react/components/common/OrderDetails.d.ts +4 -0
  22. package/dist/cjs/anyspend/react/components/common/OrderDetails.js +34 -6
  23. package/dist/cjs/anyspend/react/components/common/PanelOnramp.d.ts +3 -1
  24. package/dist/cjs/anyspend/react/components/common/PanelOnramp.js +3 -2
  25. package/dist/cjs/anyspend/react/components/common/PaymentStripeWeb2.js +3 -4
  26. package/dist/cjs/anyspend/react/hooks/index.d.ts +1 -0
  27. package/dist/cjs/anyspend/react/hooks/index.js +1 -0
  28. package/dist/cjs/anyspend/react/hooks/useAnyspendCreateOnrampOrder.js +1 -1
  29. package/dist/cjs/anyspend/react/hooks/useAnyspendCreateOrder.js +1 -1
  30. package/dist/cjs/anyspend/react/hooks/useCreateDepositFirstOrder.js +1 -1
  31. package/dist/cjs/anyspend/react/hooks/useGasPrice.d.ts +37 -0
  32. package/dist/cjs/anyspend/react/hooks/useGasPrice.js +43 -0
  33. package/dist/cjs/anyspend/react/hooks/useValidatedClientReferenceId.js +1 -1
  34. package/dist/cjs/anyspend/services/gas.d.ts +21 -0
  35. package/dist/cjs/anyspend/services/gas.js +65 -0
  36. package/dist/cjs/anyspend/types/gas.d.ts +61 -0
  37. package/dist/cjs/anyspend/types/gas.js +2 -0
  38. package/dist/cjs/global-account/react/components/B3DynamicModal.js +2 -3
  39. package/dist/cjs/global-account/react/components/B3Provider/AuthenticationProvider.d.ts +5 -0
  40. package/dist/cjs/global-account/react/components/B3Provider/AuthenticationProvider.js +12 -0
  41. package/dist/cjs/global-account/react/components/B3Provider/B3Provider.d.ts +2 -18
  42. package/dist/cjs/global-account/react/components/B3Provider/B3Provider.js +35 -52
  43. package/dist/cjs/global-account/react/components/B3Provider/B3Provider.native.d.ts +5 -5
  44. package/dist/cjs/global-account/react/components/B3Provider/B3Provider.native.js +38 -35
  45. package/dist/cjs/global-account/react/components/B3Provider/RelayKitProviderWrapper.js +3 -1
  46. package/dist/cjs/global-account/react/components/B3Provider/useB3.d.ts +14 -4
  47. package/dist/cjs/global-account/react/components/B3Provider/useB3.js +4 -11
  48. package/dist/cjs/global-account/react/components/B3Provider/useB3Account.js +5 -2
  49. package/dist/cjs/global-account/react/components/B3Provider/useB3Config.d.ts +10 -2
  50. package/dist/cjs/global-account/react/components/B3Provider/useB3Config.js +18 -17
  51. package/dist/cjs/global-account/react/components/ManageAccount/ProfileSection.js +1 -2
  52. package/dist/cjs/global-account/react/components/ManageAccount/channels/DiscordChannel.js +6 -6
  53. package/dist/cjs/global-account/react/components/ManageAccount/channels/EmailChannel.js +7 -7
  54. package/dist/cjs/global-account/react/components/ManageAccount/channels/PhoneChannel.js +7 -7
  55. package/dist/cjs/global-account/react/components/ManageAccount/channels/TelegramChannel.js +5 -5
  56. package/dist/cjs/global-account/react/components/RequestPermissions/RequestPermissions.js +8 -9
  57. package/dist/cjs/global-account/react/components/SignInWithB3/SignIn.js +1 -1
  58. package/dist/cjs/global-account/react/components/SignInWithB3/SignInWithB3Flow.js +76 -20
  59. package/dist/cjs/global-account/react/components/SignInWithB3/SignInWithB3Privy.js +1 -1
  60. package/dist/cjs/global-account/react/components/SignInWithB3/steps/LoginStep.js +1 -1
  61. package/dist/cjs/global-account/react/components/SignInWithB3/steps/LoginStepCustom.js +1 -1
  62. package/dist/cjs/global-account/react/components/StyleRoot.js +3 -3
  63. package/dist/cjs/global-account/react/components/TurnkeyAuthModal.js +3 -1
  64. package/dist/cjs/global-account/react/components/custom/ManageAccountButton.js +1 -2
  65. package/dist/cjs/global-account/react/components/index.d.ts +1 -2
  66. package/dist/cjs/global-account/react/components/index.js +3 -6
  67. package/dist/cjs/global-account/react/hooks/index.d.ts +2 -0
  68. package/dist/cjs/global-account/react/hooks/index.js +5 -1
  69. package/dist/cjs/global-account/react/hooks/useAuth.d.ts +76 -0
  70. package/dist/cjs/global-account/react/hooks/useAuth.js +337 -0
  71. package/dist/cjs/global-account/react/hooks/useClient.js +1 -1
  72. package/dist/cjs/global-account/react/hooks/useHandleConnectWithPrivy.js +1 -1
  73. package/dist/cjs/global-account/react/hooks/useNotifications.js +14 -14
  74. package/dist/cjs/global-account/react/hooks/useTWAuth.d.ts +3 -0
  75. package/dist/cjs/global-account/react/hooks/useTWAuth.js +8 -0
  76. package/dist/cjs/global-account/react/hooks/useTokenBalance.js +5 -5
  77. package/dist/cjs/global-account/react/hooks/useTokenBalancesByChain.js +4 -2
  78. package/dist/cjs/global-account/react/hooks/useTurnkeyAuth.js +50 -22
  79. package/dist/cjs/global-account/react/hooks/useUser.d.ts +60 -0
  80. package/dist/cjs/global-account/react/hooks/useUser.js +20 -0
  81. package/dist/cjs/global-account/react/hooks/useUserQuery.js +9 -35
  82. package/dist/cjs/global-account/react/index.native.d.ts +0 -2
  83. package/dist/cjs/global-account/react/index.native.js +1 -5
  84. package/dist/cjs/global-account/react/stores/configStore.d.ts +24 -0
  85. package/dist/cjs/global-account/react/stores/configStore.js +30 -0
  86. package/dist/cjs/global-account/react/stores/index.d.ts +1 -0
  87. package/dist/cjs/global-account/react/stores/index.js +3 -1
  88. package/dist/cjs/global-account/react/stores/useModalStore.d.ts +10 -0
  89. package/dist/cjs/global-account/react/stores/userStore.d.ts +22 -0
  90. package/dist/cjs/global-account/react/stores/userStore.js +30 -0
  91. package/dist/esm/anyspend/constants/index.d.ts +2 -0
  92. package/dist/esm/anyspend/constants/index.js +2 -0
  93. package/dist/esm/anyspend/index.d.ts +2 -0
  94. package/dist/esm/anyspend/index.js +3 -0
  95. package/dist/esm/anyspend/react/components/AnySpend.d.ts +6 -0
  96. package/dist/esm/anyspend/react/components/AnySpend.js +11 -8
  97. package/dist/esm/anyspend/react/components/AnySpendCollectorClubPurchase.d.ts +5 -1
  98. package/dist/esm/anyspend/react/components/AnySpendCollectorClubPurchase.js +2 -2
  99. package/dist/esm/anyspend/react/components/AnySpendCustom.d.ts +1 -0
  100. package/dist/esm/anyspend/react/components/AnySpendCustom.js +3 -3
  101. package/dist/esm/anyspend/react/components/AnySpendCustomExactIn.d.ts +6 -0
  102. package/dist/esm/anyspend/react/components/AnySpendCustomExactIn.js +8 -4
  103. package/dist/esm/anyspend/react/components/AnySpendDeposit.d.ts +7 -1
  104. package/dist/esm/anyspend/react/components/AnySpendDeposit.js +3 -3
  105. package/dist/esm/anyspend/react/components/AnyspendDepositHype.d.ts +4 -0
  106. package/dist/esm/anyspend/react/components/common/CryptoPaymentMethod.js +14 -1
  107. package/dist/esm/anyspend/react/components/common/CryptoReceiveSection.d.ts +3 -1
  108. package/dist/esm/anyspend/react/components/common/CryptoReceiveSection.js +3 -2
  109. package/dist/esm/anyspend/react/components/common/GasIndicator.d.ts +6 -0
  110. package/dist/esm/anyspend/react/components/common/GasIndicator.js +31 -0
  111. package/dist/esm/anyspend/react/components/common/OrderDetails.d.ts +4 -0
  112. package/dist/esm/anyspend/react/components/common/OrderDetails.js +36 -8
  113. package/dist/esm/anyspend/react/components/common/PanelOnramp.d.ts +3 -1
  114. package/dist/esm/anyspend/react/components/common/PanelOnramp.js +3 -2
  115. package/dist/esm/anyspend/react/components/common/PaymentStripeWeb2.js +3 -4
  116. package/dist/esm/anyspend/react/hooks/index.d.ts +1 -0
  117. package/dist/esm/anyspend/react/hooks/index.js +1 -0
  118. package/dist/esm/anyspend/react/hooks/useAnyspendCreateOnrampOrder.js +2 -2
  119. package/dist/esm/anyspend/react/hooks/useAnyspendCreateOrder.js +2 -2
  120. package/dist/esm/anyspend/react/hooks/useCreateDepositFirstOrder.js +2 -2
  121. package/dist/esm/anyspend/react/hooks/useGasPrice.d.ts +37 -0
  122. package/dist/esm/anyspend/react/hooks/useGasPrice.js +40 -0
  123. package/dist/esm/anyspend/react/hooks/useValidatedClientReferenceId.js +2 -2
  124. package/dist/esm/anyspend/services/gas.d.ts +21 -0
  125. package/dist/esm/anyspend/services/gas.js +59 -0
  126. package/dist/esm/anyspend/types/gas.d.ts +61 -0
  127. package/dist/esm/anyspend/types/gas.js +1 -0
  128. package/dist/esm/global-account/react/components/B3DynamicModal.js +3 -4
  129. package/dist/esm/global-account/react/components/B3Provider/AuthenticationProvider.d.ts +5 -0
  130. package/dist/esm/global-account/react/components/B3Provider/AuthenticationProvider.js +10 -0
  131. package/dist/esm/global-account/react/components/B3Provider/B3Provider.d.ts +2 -18
  132. package/dist/esm/global-account/react/components/B3Provider/B3Provider.js +34 -53
  133. package/dist/esm/global-account/react/components/B3Provider/B3Provider.native.d.ts +5 -5
  134. package/dist/esm/global-account/react/components/B3Provider/B3Provider.native.js +36 -36
  135. package/dist/esm/global-account/react/components/B3Provider/RelayKitProviderWrapper.js +3 -1
  136. package/dist/esm/global-account/react/components/B3Provider/useB3.d.ts +14 -4
  137. package/dist/esm/global-account/react/components/B3Provider/useB3.js +4 -11
  138. package/dist/esm/global-account/react/components/B3Provider/useB3Account.js +5 -2
  139. package/dist/esm/global-account/react/components/B3Provider/useB3Config.d.ts +10 -2
  140. package/dist/esm/global-account/react/components/B3Provider/useB3Config.js +18 -17
  141. package/dist/esm/global-account/react/components/ManageAccount/ProfileSection.js +2 -3
  142. package/dist/esm/global-account/react/components/ManageAccount/channels/DiscordChannel.js +2 -2
  143. package/dist/esm/global-account/react/components/ManageAccount/channels/EmailChannel.js +2 -2
  144. package/dist/esm/global-account/react/components/ManageAccount/channels/PhoneChannel.js +2 -2
  145. package/dist/esm/global-account/react/components/ManageAccount/channels/TelegramChannel.js +2 -2
  146. package/dist/esm/global-account/react/components/RequestPermissions/RequestPermissions.js +2 -3
  147. package/dist/esm/global-account/react/components/SignInWithB3/SignIn.js +2 -2
  148. package/dist/esm/global-account/react/components/SignInWithB3/SignInWithB3Flow.js +76 -20
  149. package/dist/esm/global-account/react/components/SignInWithB3/SignInWithB3Privy.js +2 -2
  150. package/dist/esm/global-account/react/components/SignInWithB3/steps/LoginStep.js +2 -2
  151. package/dist/esm/global-account/react/components/SignInWithB3/steps/LoginStepCustom.js +2 -2
  152. package/dist/esm/global-account/react/components/StyleRoot.js +3 -3
  153. package/dist/esm/global-account/react/components/TurnkeyAuthModal.js +5 -3
  154. package/dist/esm/global-account/react/components/custom/ManageAccountButton.js +2 -3
  155. package/dist/esm/global-account/react/components/index.d.ts +1 -2
  156. package/dist/esm/global-account/react/components/index.js +1 -2
  157. package/dist/esm/global-account/react/hooks/index.d.ts +2 -0
  158. package/dist/esm/global-account/react/hooks/index.js +2 -0
  159. package/dist/esm/global-account/react/hooks/useAuth.d.ts +76 -0
  160. package/dist/esm/global-account/react/hooks/useAuth.js +331 -0
  161. package/dist/esm/global-account/react/hooks/useClient.js +2 -2
  162. package/dist/esm/global-account/react/hooks/useHandleConnectWithPrivy.js +2 -2
  163. package/dist/esm/global-account/react/hooks/useNotifications.js +2 -2
  164. package/dist/esm/global-account/react/hooks/useTWAuth.d.ts +3 -0
  165. package/dist/esm/global-account/react/hooks/useTWAuth.js +8 -0
  166. package/dist/esm/global-account/react/hooks/useTokenBalance.js +6 -6
  167. package/dist/esm/global-account/react/hooks/useTokenBalancesByChain.js +4 -2
  168. package/dist/esm/global-account/react/hooks/useTurnkeyAuth.js +50 -22
  169. package/dist/esm/global-account/react/hooks/useUser.d.ts +60 -0
  170. package/dist/esm/global-account/react/hooks/useUser.js +17 -0
  171. package/dist/esm/global-account/react/hooks/useUserQuery.js +1 -27
  172. package/dist/esm/global-account/react/index.native.d.ts +0 -2
  173. package/dist/esm/global-account/react/index.native.js +0 -2
  174. package/dist/esm/global-account/react/stores/configStore.d.ts +24 -0
  175. package/dist/esm/global-account/react/stores/configStore.js +27 -0
  176. package/dist/esm/global-account/react/stores/index.d.ts +1 -0
  177. package/dist/esm/global-account/react/stores/index.js +1 -0
  178. package/dist/esm/global-account/react/stores/useModalStore.d.ts +10 -0
  179. package/dist/esm/global-account/react/stores/userStore.d.ts +22 -0
  180. package/dist/esm/global-account/react/stores/userStore.js +27 -0
  181. package/dist/styles/index.css +1 -1
  182. package/dist/types/anyspend/constants/index.d.ts +2 -0
  183. package/dist/types/anyspend/index.d.ts +2 -0
  184. package/dist/types/anyspend/react/components/AnySpend.d.ts +6 -0
  185. package/dist/types/anyspend/react/components/AnySpendCollectorClubPurchase.d.ts +5 -1
  186. package/dist/types/anyspend/react/components/AnySpendCustom.d.ts +1 -0
  187. package/dist/types/anyspend/react/components/AnySpendCustomExactIn.d.ts +6 -0
  188. package/dist/types/anyspend/react/components/AnySpendDeposit.d.ts +7 -1
  189. package/dist/types/anyspend/react/components/AnyspendDepositHype.d.ts +4 -0
  190. package/dist/types/anyspend/react/components/common/CryptoReceiveSection.d.ts +3 -1
  191. package/dist/types/anyspend/react/components/common/GasIndicator.d.ts +6 -0
  192. package/dist/types/anyspend/react/components/common/OrderDetails.d.ts +4 -0
  193. package/dist/types/anyspend/react/components/common/PanelOnramp.d.ts +3 -1
  194. package/dist/types/anyspend/react/hooks/index.d.ts +1 -0
  195. package/dist/types/anyspend/react/hooks/useGasPrice.d.ts +37 -0
  196. package/dist/types/anyspend/services/gas.d.ts +21 -0
  197. package/dist/types/anyspend/types/gas.d.ts +61 -0
  198. package/dist/types/global-account/react/components/B3Provider/AuthenticationProvider.d.ts +5 -0
  199. package/dist/types/global-account/react/components/B3Provider/B3Provider.d.ts +2 -18
  200. package/dist/types/global-account/react/components/B3Provider/B3Provider.native.d.ts +5 -5
  201. package/dist/types/global-account/react/components/B3Provider/useB3.d.ts +14 -4
  202. package/dist/types/global-account/react/components/B3Provider/useB3Config.d.ts +10 -2
  203. package/dist/types/global-account/react/components/index.d.ts +1 -2
  204. package/dist/types/global-account/react/hooks/index.d.ts +2 -0
  205. package/dist/types/global-account/react/hooks/useAuth.d.ts +76 -0
  206. package/dist/types/global-account/react/hooks/useTWAuth.d.ts +3 -0
  207. package/dist/types/global-account/react/hooks/useUser.d.ts +60 -0
  208. package/dist/types/global-account/react/index.native.d.ts +0 -2
  209. package/dist/types/global-account/react/stores/configStore.d.ts +24 -0
  210. package/dist/types/global-account/react/stores/index.d.ts +1 -0
  211. package/dist/types/global-account/react/stores/useModalStore.d.ts +10 -0
  212. package/dist/types/global-account/react/stores/userStore.d.ts +22 -0
  213. package/package.json +1 -1
  214. package/src/anyspend/constants/index.ts +3 -0
  215. package/src/anyspend/index.ts +4 -0
  216. package/src/anyspend/react/components/AnySpend.tsx +28 -2
  217. package/src/anyspend/react/components/AnySpendCollectorClubPurchase.tsx +6 -0
  218. package/src/anyspend/react/components/AnySpendCustom.tsx +52 -47
  219. package/src/anyspend/react/components/AnySpendCustomExactIn.tsx +23 -0
  220. package/src/anyspend/react/components/AnySpendDeposit.tsx +27 -18
  221. package/src/anyspend/react/components/AnyspendDepositHype.tsx +4 -0
  222. package/src/anyspend/react/components/common/CryptoPaymentMethod.tsx +15 -1
  223. package/src/anyspend/react/components/common/CryptoReceiveSection.tsx +5 -1
  224. package/src/anyspend/react/components/common/GasIndicator.tsx +59 -0
  225. package/src/anyspend/react/components/common/OrderDetails.tsx +60 -42
  226. package/src/anyspend/react/components/common/PanelOnramp.tsx +5 -1
  227. package/src/anyspend/react/components/common/PaymentStripeWeb2.tsx +3 -4
  228. package/src/anyspend/react/hooks/index.ts +1 -0
  229. package/src/anyspend/react/hooks/useAnyspendCreateOnrampOrder.ts +2 -2
  230. package/src/anyspend/react/hooks/useAnyspendCreateOrder.ts +2 -2
  231. package/src/anyspend/react/hooks/useCreateDepositFirstOrder.ts +2 -2
  232. package/src/anyspend/react/hooks/useGasPrice.ts +70 -0
  233. package/src/anyspend/react/hooks/useValidatedClientReferenceId.ts +2 -2
  234. package/src/anyspend/services/gas.test.ts +31 -0
  235. package/src/anyspend/services/gas.ts +73 -0
  236. package/src/anyspend/types/gas.ts +66 -0
  237. package/src/global-account/react/components/B3DynamicModal.tsx +3 -4
  238. package/src/global-account/react/components/B3Provider/AuthenticationProvider.tsx +19 -0
  239. package/src/global-account/react/components/B3Provider/B3Provider.native.tsx +43 -54
  240. package/src/global-account/react/components/B3Provider/B3Provider.tsx +44 -106
  241. package/src/global-account/react/components/B3Provider/RelayKitProviderWrapper.tsx +4 -1
  242. package/src/global-account/react/components/B3Provider/useB3.ts +4 -13
  243. package/src/global-account/react/components/B3Provider/useB3Account.ts +6 -2
  244. package/src/global-account/react/components/B3Provider/useB3Config.ts +18 -31
  245. package/src/global-account/react/components/ManageAccount/ProfileSection.tsx +2 -4
  246. package/src/global-account/react/components/ManageAccount/channels/DiscordChannel.tsx +2 -2
  247. package/src/global-account/react/components/ManageAccount/channels/EmailChannel.tsx +2 -2
  248. package/src/global-account/react/components/ManageAccount/channels/PhoneChannel.tsx +2 -2
  249. package/src/global-account/react/components/ManageAccount/channels/TelegramChannel.tsx +2 -2
  250. package/src/global-account/react/components/RequestPermissions/RequestPermissions.tsx +4 -4
  251. package/src/global-account/react/components/SignInWithB3/SignIn.tsx +2 -2
  252. package/src/global-account/react/components/SignInWithB3/SignInWithB3Flow.tsx +168 -100
  253. package/src/global-account/react/components/SignInWithB3/SignInWithB3Privy.tsx +2 -2
  254. package/src/global-account/react/components/SignInWithB3/steps/LoginStep.tsx +2 -2
  255. package/src/global-account/react/components/SignInWithB3/steps/LoginStepCustom.tsx +2 -2
  256. package/src/global-account/react/components/StyleRoot.tsx +3 -3
  257. package/src/global-account/react/components/TurnkeyAuthModal.tsx +7 -4
  258. package/src/global-account/react/components/custom/ManageAccountButton.tsx +2 -3
  259. package/src/global-account/react/components/index.ts +1 -2
  260. package/src/global-account/react/hooks/index.ts +2 -0
  261. package/src/global-account/react/hooks/useAuth.ts +379 -0
  262. package/src/global-account/react/hooks/useClient.ts +2 -2
  263. package/src/global-account/react/hooks/useHandleConnectWithPrivy.tsx +2 -2
  264. package/src/global-account/react/hooks/useNotifications.ts +2 -2
  265. package/src/global-account/react/hooks/useTWAuth.tsx +10 -0
  266. package/src/global-account/react/hooks/useTokenBalance.tsx +8 -7
  267. package/src/global-account/react/hooks/useTokenBalancesByChain.tsx +4 -2
  268. package/src/global-account/react/hooks/useTurnkeyAuth.ts +54 -23
  269. package/src/global-account/react/hooks/useUser.ts +20 -0
  270. package/src/global-account/react/hooks/useUserQuery.ts +1 -40
  271. package/src/global-account/react/index.native.ts +0 -2
  272. package/src/global-account/react/stores/configStore.ts +51 -0
  273. package/src/global-account/react/stores/index.ts +1 -0
  274. package/src/global-account/react/stores/useModalStore.ts +10 -0
  275. package/src/global-account/react/stores/userStore.ts +41 -0
  276. package/dist/cjs/global-account/react/components/B3Provider/types.d.ts +0 -27
  277. package/dist/cjs/global-account/react/components/B3Provider/types.js +0 -24
  278. package/dist/esm/global-account/react/components/B3Provider/types.d.ts +0 -27
  279. package/dist/esm/global-account/react/components/B3Provider/types.js +0 -21
  280. package/dist/types/global-account/react/components/B3Provider/types.d.ts +0 -27
  281. package/src/global-account/react/components/B3Provider/types.ts +0 -50
@@ -1,9 +1,17 @@
1
+ /**
2
+ * Hook to access B3 configuration
3
+ * Returns all config values from the Zustand store
4
+ * Since config is static (set once at initialization), destructuring is fine here
5
+ */
1
6
  export declare const useB3Config: () => {
2
7
  automaticallySetFirstEoa: boolean;
3
- environment: "development" | "production" | undefined;
8
+ environment: "development" | "production";
4
9
  theme: "light" | "dark";
5
10
  clientType: import("../../../client-manager").ClientType;
6
11
  partnerId: string;
7
12
  createClientReferenceId: ((params: import("../../../../anyspend/react").CreateOrderParams | import("../../../../anyspend/react").CreateOnrampOrderParams) => Promise<string>) | undefined;
8
- enableTurnkey: boolean | undefined;
13
+ enableTurnkey: boolean;
14
+ stripePublishableKey: string | undefined;
15
+ defaultPermissions: import("../../../types/permissions").PermissionsConfig;
16
+ accountOverride: import("thirdweb/wallets").Account | undefined;
9
17
  };
@@ -1,19 +1,20 @@
1
- import { useContext, useMemo } from "react";
2
- import { B3Context } from "./types.js";
1
+ import { useB3ConfigStore } from "../../stores/configStore.js";
2
+ /**
3
+ * Hook to access B3 configuration
4
+ * Returns all config values from the Zustand store
5
+ * Since config is static (set once at initialization), destructuring is fine here
6
+ */
3
7
  export const useB3Config = () => {
4
- const context = useContext(B3Context);
5
- if (!context) {
6
- throw new Error("useB3 must be used within a B3Provider");
7
- }
8
- const { automaticallySetFirstEoa, environment, theme, clientType, partnerId, createClientReferenceId, enableTurnkey, } = context;
9
- // Return a stable reference
10
- return useMemo(() => ({
11
- automaticallySetFirstEoa,
12
- environment,
13
- theme,
14
- clientType,
15
- partnerId,
16
- createClientReferenceId,
17
- enableTurnkey,
18
- }), [automaticallySetFirstEoa, environment, theme, clientType, partnerId, createClientReferenceId, enableTurnkey]);
8
+ return useB3ConfigStore(state => ({
9
+ automaticallySetFirstEoa: state.automaticallySetFirstEoa,
10
+ environment: state.environment,
11
+ theme: state.theme,
12
+ clientType: state.clientType,
13
+ partnerId: state.partnerId,
14
+ createClientReferenceId: state.createClientReferenceId,
15
+ enableTurnkey: state.enableTurnkey,
16
+ stripePublishableKey: state.stripePublishableKey,
17
+ defaultPermissions: state.defaultPermissions,
18
+ accountOverride: state.accountOverride,
19
+ }));
19
20
  };
@@ -1,5 +1,5 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { useAccountWallet, useAuthentication, useB3Config, useModalStore, useProfile, useSimBalance, } from "../../../../global-account/react/index.js";
2
+ import { useAccountWallet, useModalStore, useProfile, useSimBalance, useUser, } from "../../../../global-account/react/index.js";
3
3
  import { formatUsername } from "../../../../shared/utils/index.js";
4
4
  import { formatDisplayNumber } from "../../../../shared/utils/number.js";
5
5
  import { Pencil } from "lucide-react";
@@ -15,8 +15,7 @@ const ProfileSection = () => {
15
15
  address: eoaAddress || account?.address,
16
16
  fresh: true,
17
17
  });
18
- const { partnerId } = useB3Config();
19
- const { user } = useAuthentication(partnerId);
18
+ const { user } = useUser();
20
19
  const setB3ModalOpen = useModalStore(state => state.setB3ModalOpen);
21
20
  const setB3ModalContentType = useModalStore(state => state.setB3ModalContentType);
22
21
  const navigateBack = useModalStore(state => state.navigateBack);
@@ -1,13 +1,13 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useB3Config } from "../../../../../global-account/react/index.js";
2
3
  import { debugB3React } from "../../../../../shared/utils/debug.js";
3
4
  import { useState } from "react";
4
5
  import { notificationsAPI } from "../../../utils/notificationsAPI.js";
5
- import { useB3 } from "../../B3Provider/useB3.js";
6
6
  import { toast } from "../../Toast/toastApi.js";
7
7
  import { NotificationChannel } from "../NotificationChannel.js";
8
8
  const debug = debugB3React("DiscordChannel");
9
9
  export const DiscordChannel = ({ userId, jwtToken, discordChannel, isConnected, isOptimisticallyConnected, onConnectionChange, onToggle, }) => {
10
- const { partnerId } = useB3();
10
+ const { partnerId } = useB3Config();
11
11
  const [discordId, setDiscordId] = useState("");
12
12
  const [isConnecting, setIsConnecting] = useState(false);
13
13
  const [showInput, setShowInput] = useState(false);
@@ -1,8 +1,8 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useB3Config } from "../../../../../global-account/react/index.js";
2
3
  import { debugB3React } from "../../../../../shared/utils/debug.js";
3
4
  import { useState } from "react";
4
5
  import { notificationsAPI } from "../../../utils/notificationsAPI.js";
5
- import { useB3 } from "../../B3Provider/useB3.js";
6
6
  import { toast } from "../../Toast/toastApi.js";
7
7
  import { NotificationChannel } from "../NotificationChannel.js";
8
8
  const debug = debugB3React("EmailChannel");
@@ -11,7 +11,7 @@ const validateEmail = (email) => {
11
11
  return emailRegex.test(email);
12
12
  };
13
13
  export const EmailChannel = ({ userId, jwtToken, emailChannel, isConnected, isOptimisticallyConnected, onConnectionChange, onToggle, }) => {
14
- const { partnerId } = useB3();
14
+ const { partnerId } = useB3Config();
15
15
  const [email, setEmail] = useState("");
16
16
  const [emailError, setEmailError] = useState(null);
17
17
  const [isConnecting, setIsConnecting] = useState(false);
@@ -1,13 +1,13 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
+ import { useB3Config } from "../../../../../global-account/react/index.js";
2
3
  import { debugB3React } from "../../../../../shared/utils/debug.js";
3
4
  import { useState } from "react";
4
5
  import { notificationsAPI } from "../../../utils/notificationsAPI.js";
5
- import { useB3 } from "../../B3Provider/useB3.js";
6
6
  import { toast } from "../../Toast/toastApi.js";
7
7
  import { NotificationChannel } from "../NotificationChannel.js";
8
8
  const debug = debugB3React("PhoneChannel");
9
9
  export const PhoneChannel = ({ userId, jwtToken, smsChannel, whatsappChannel, isSMSConnected, isWhatsAppConnected, isOptimisticallySMSConnected, isOptimisticallyWhatsAppConnected, onConnectionChange, onToggle, }) => {
10
- const { partnerId } = useB3();
10
+ const { partnerId } = useB3Config();
11
11
  const [phoneNumber, setPhoneNumber] = useState("");
12
12
  const [isConnectingSMS, setIsConnectingSMS] = useState(false);
13
13
  const [isConnectingWhatsApp, setIsConnectingWhatsApp] = useState(false);
@@ -1,13 +1,13 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useB3Config } from "../../../../../global-account/react/index.js";
2
3
  import { debugB3React } from "../../../../../shared/utils/debug.js";
3
4
  import { useState } from "react";
4
5
  import { notificationsAPI } from "../../../utils/notificationsAPI.js";
5
- import { useB3 } from "../../B3Provider/useB3.js";
6
6
  import { toast } from "../../Toast/toastApi.js";
7
7
  import { NotificationChannel } from "../NotificationChannel.js";
8
8
  const debug = debugB3React("TelegramChannel");
9
9
  export const TelegramChannel = ({ userId, jwtToken, telegramChannel, isConnected, isOptimisticallyConnected, onConnectionChange, onToggle, }) => {
10
- const { partnerId } = useB3();
10
+ const { partnerId } = useB3Config();
11
11
  const [isConnecting, setIsConnecting] = useState(false);
12
12
  const [status, setStatus] = useState("idle");
13
13
  // Detect if we're disconnecting
@@ -1,6 +1,5 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { Button, useB3, useAddTWSessionKey, useGetAllTWSigners, } from "../../../../global-account/react/index.js";
3
- import { PermissionItem } from "../../../../global-account/react/index.js";
2
+ import { Button, PermissionItem, useAddTWSessionKey, useB3Config, useGetAllTWSigners, } from "../../../../global-account/react/index.js";
4
3
  import { debugB3React } from "../../../../shared/utils/debug.js";
5
4
  import { formatAddress } from "../../../../shared/utils/formatAddress.js";
6
5
  import { CreditCard, Eye } from "lucide-react";
@@ -15,7 +14,7 @@ const debug = debugB3React("RequestPermissions");
15
14
  export function RequestPermissions({ onSuccess, onError, chain, sessionKeyAddress, permissions, }) {
16
15
  const [isApproving, setIsApproving] = useState(false);
17
16
  const account = useActiveAccount();
18
- const { defaultPermissions } = useB3();
17
+ const { defaultPermissions } = useB3Config();
19
18
  const DEFAULT_PERMISSIONS = useMemo(() => permissions ?? defaultPermissions, [defaultPermissions, permissions]);
20
19
  const { refetch: refetchSigners } = useGetAllTWSigners({
21
20
  chain,
@@ -1,5 +1,5 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
- import { IPFSMediaRenderer, SignInWithB3, StyleRoot, useAccountWallet, useAuthentication, useB3, useIsMobile, } from "../../../../global-account/react/index.js";
2
+ import { IPFSMediaRenderer, SignInWithB3, StyleRoot, useAccountWallet, useAuthentication, useB3Config, useIsMobile, } from "../../../../global-account/react/index.js";
3
3
  import Icon from "../../../../global-account/react/components/custom/Icon.js";
4
4
  import { ecosystemWalletId } from "../../../../shared/constants/index.js";
5
5
  import { cn, truncateAddress } from "../../../../shared/utils/index.js";
@@ -9,7 +9,7 @@ import { useConnectedWallets, useSetActiveWallet, useWalletImage } from "thirdwe
9
9
  import { ManageAccountButton } from "../custom/ManageAccountButton.js";
10
10
  export function SignIn(props) {
11
11
  const { className } = props;
12
- const { automaticallySetFirstEoa, partnerId } = useB3();
12
+ const { automaticallySetFirstEoa, partnerId } = useB3Config();
13
13
  const { address: globalAddress, ensName, connectedSmartWallet, connectedEOAWallet, isActiveSmartWallet, isActiveEOAWallet, smartWalletIcon, } = useAccountWallet();
14
14
  const { data: walletImage } = useWalletImage(connectedEOAWallet?.id);
15
15
  const isMobile = useIsMobile();
@@ -3,6 +3,7 @@ import { Loading, useAuthentication, useAuthStore, useB3Config, useGetAllTWSigne
3
3
  import { debugB3React } from "../../../../shared/utils/debug.js";
4
4
  import { useCallback, useEffect, useState } from "react";
5
5
  import { useActiveAccount } from "thirdweb/react";
6
+ import { TurnkeyAuthModal } from "../TurnkeyAuthModal.js";
6
7
  import { SignInWithB3Privy } from "./SignInWithB3Privy.js";
7
8
  import { LoginStep, LoginStepContainer } from "./steps/LoginStep.js";
8
9
  import { LoginStepCustom } from "./steps/LoginStepCustom.js";
@@ -21,7 +22,9 @@ export function SignInWithB3Flow({ strategies, onLoginSuccess, onSessionKeySucce
21
22
  const account = useActiveAccount();
22
23
  const isAuthenticating = useAuthStore(state => state.isAuthenticating);
23
24
  const isAuthenticated = useAuthStore(state => state.isAuthenticated);
25
+ const setIsAuthenticated = useAuthStore(state => state.setIsAuthenticated);
24
26
  const isConnected = useAuthStore(state => state.isConnected);
27
+ const setIsConnected = useAuthStore(state => state.setIsConnected);
25
28
  const setJustCompletedLogin = useAuthStore(state => state.setJustCompletedLogin);
26
29
  const [refetchCount, setRefetchCount] = useState(0);
27
30
  const [refetchError, setRefetchError] = useState(null);
@@ -54,7 +57,9 @@ export function SignInWithB3Flow({ strategies, onLoginSuccess, onSessionKeySucce
54
57
  refetchSigners();
55
58
  setRefetchQueued(false);
56
59
  }, backoffDelay);
57
- }, [refetchCount, refetchSigners, onError, setRefetchQueued, refetchQueued]);
60
+ // State setters are stable and don't need to be in dependencies
61
+ // eslint-disable-next-line react-hooks/exhaustive-deps
62
+ }, [refetchCount, refetchSigners, onError, refetchQueued]);
58
63
  // Extract the completion flow logic to be reused
59
64
  const handlePostTurnkeyFlow = useCallback(() => {
60
65
  debug("Running post-Turnkey flow logic");
@@ -123,6 +128,10 @@ export function SignInWithB3Flow({ strategies, onLoginSuccess, onSessionKeySucce
123
128
  debug("Refetching user after Turnkey success...");
124
129
  await refetchUser();
125
130
  debug("User refetched successfully");
131
+ // Set authentication and connection state so UI updates properly
132
+ setIsAuthenticated(true);
133
+ setIsConnected(true);
134
+ setJustCompletedLogin(true);
126
135
  // After user data is refreshed, close Turnkey modal and go back to sign-in flow
127
136
  debug("Switching back to signInWithB3 modal");
128
137
  setB3ModalContentType({
@@ -141,7 +150,6 @@ export function SignInWithB3Flow({ strategies, onLoginSuccess, onSessionKeySucce
141
150
  // The useEffect will re-run with updated user data to complete the sign-in process
142
151
  }, [
143
152
  refetchUser,
144
- setB3ModalContentType,
145
153
  strategies,
146
154
  onLoginSuccess,
147
155
  onSessionKeySuccess,
@@ -152,6 +160,10 @@ export function SignInWithB3Flow({ strategies, onLoginSuccess, onSessionKeySucce
152
160
  closeAfterLogin,
153
161
  source,
154
162
  signersEnabled,
163
+ setB3ModalContentType,
164
+ setIsAuthenticated,
165
+ setIsConnected,
166
+ setJustCompletedLogin,
155
167
  ]);
156
168
  // Handle post-login flow after signers are loaded
157
169
  useEffect(() => {
@@ -169,15 +181,20 @@ export function SignInWithB3Flow({ strategies, onLoginSuccess, onSessionKeySucce
169
181
  if (closeAfterLogin) {
170
182
  setJustCompletedLogin(true);
171
183
  }
172
- // Check if we should show Turnkey login form
173
- // Show if enableTurnkey is true AND user just logged in AND hasn't completed Turnkey auth in this session
184
+ // Check if we should show Turnkey login form as SECONDARY option (after wallet connection)
185
+ // This only applies when:
186
+ // - enableTurnkey={true} is set on B3Provider
187
+ // - NEXT_PUBLIC_TURNKEY_PRIMARY is NOT set to true (otherwise Turnkey shows as primary)
188
+ // - User just logged in AND hasn't completed Turnkey auth in this session
174
189
  // For new users (!turnkeyId): Show email form
175
190
  // For returning users (turnkeyId && turnkeyEmail): Auto-skip to OTP
176
191
  // Also check that we're not already showing the Turnkey modal
177
192
  const hasTurnkeyId = user?.partnerIds?.turnkeyId;
178
193
  const hasTurnkeyEmail = !!user?.email;
179
194
  const isTurnkeyModalCurrentlyOpen = contentType?.type === "turnkeyAuth";
195
+ const isTurnkeyPrimary = process.env.NEXT_PUBLIC_TURNKEY_PRIMARY === "true";
180
196
  const shouldShowTurnkeyModal = enableTurnkey &&
197
+ !isTurnkeyPrimary &&
181
198
  user &&
182
199
  !turnkeyAuthCompleted &&
183
200
  !isTurnkeyModalCurrentlyOpen &&
@@ -204,7 +221,9 @@ export function SignInWithB3Flow({ strategies, onLoginSuccess, onSessionKeySucce
204
221
  // Normal flow continues after Turnkey auth is complete (or if not needed)
205
222
  handlePostTurnkeyFlow();
206
223
  }
207
- }, [
224
+ },
225
+ // eslint-disable-next-line react-hooks/exhaustive-deps
226
+ [
208
227
  signers,
209
228
  isFetchingSigners,
210
229
  partnerId,
@@ -220,11 +239,10 @@ export function SignInWithB3Flow({ strategies, onLoginSuccess, onSessionKeySucce
220
239
  isAuthenticating,
221
240
  isAuthenticated,
222
241
  isOpen,
223
- setJustCompletedLogin,
224
242
  user,
225
243
  enableTurnkey,
226
244
  turnkeyAuthCompleted,
227
- handleTurnkeySuccess,
245
+ // handleTurnkeySuccess, // This is causing infinite loops
228
246
  contentType,
229
247
  handlePostTurnkeyFlow,
230
248
  ]);
@@ -241,7 +259,9 @@ export function SignInWithB3Flow({ strategies, onLoginSuccess, onSessionKeySucce
241
259
  if (closeAfterLogin && sessionKeyAdded) {
242
260
  setB3ModalOpen(false);
243
261
  }
244
- }, [closeAfterLogin, sessionKeyAdded, setB3ModalOpen]);
262
+ // setB3ModalOpen is stable
263
+ // eslint-disable-next-line react-hooks/exhaustive-deps
264
+ }, [closeAfterLogin, sessionKeyAdded]);
245
265
  const onSessionKeySuccessEnhanced = useCallback(() => {
246
266
  onSessionKeySuccess?.();
247
267
  setB3ModalContentType({
@@ -287,21 +307,57 @@ export function SignInWithB3Flow({ strategies, onLoginSuccess, onSessionKeySucce
287
307
  if (refetchError) {
288
308
  content = (_jsx(LoginStepContainer, { partnerId: partnerId, children: _jsx("div", { className: "p-4 text-center text-red-500", children: refetchError }) }));
289
309
  }
290
- else if (isAuthenticating || (isFetchingSigners && step === "login") || source === "requestPermissions") {
291
- content = (_jsx(LoginStepContainer, { partnerId: partnerId, children: _jsx("div", { className: "my-8 flex min-h-[350px] items-center justify-center", children: _jsx(Loading, { variant: "white", size: "lg" }) }) }));
292
- }
293
310
  else if (step === "login") {
294
- // Custom strategy
295
- if (strategies?.[0] === "privy") {
296
- content = _jsx(SignInWithB3Privy, { onSuccess: handleLoginSuccess, chain: chain });
297
- }
298
- else if (strategies) {
299
- // Strategies are explicitly provided
300
- content = (_jsx(LoginStepCustom, { strategies: strategies, chain: chain, onSuccess: handleLoginSuccess, onError: onError, automaticallySetFirstEoa: !!automaticallySetFirstEoa }));
311
+ // PRIORITY: If NEXT_PUBLIC_TURNKEY_PRIMARY is true, show Turnkey modal FIRST as the primary authentication option
312
+ // Setting NEXT_PUBLIC_TURNKEY_PRIMARY="true" implicitly enables Turnkey
313
+ const isTurnkeyPrimary = process.env.NEXT_PUBLIC_TURNKEY_PRIMARY === "true";
314
+ const shouldShowTurnkeyFirst = isTurnkeyPrimary && !turnkeyAuthCompleted;
315
+ if (shouldShowTurnkeyFirst) {
316
+ // Don't show loading spinner for Turnkey - let the modal handle its own loading state
317
+ // This prevents the infinite loop where isAuthenticating causes the modal to be replaced
318
+ debug("Showing Turnkey as primary authentication option", {
319
+ isTurnkeyPrimary,
320
+ turnkeyAuthCompleted,
321
+ isAuthenticated,
322
+ });
323
+ // Show Turnkey authentication as primary option
324
+ content = (_jsx(LoginStepContainer, { partnerId: partnerId, children: _jsx(TurnkeyAuthModal, { onSuccess: async (authenticatedUser) => {
325
+ debug("Turnkey authentication successful in primary flow", { authenticatedUser });
326
+ setTurnkeyAuthCompleted(true);
327
+ // After Turnkey auth, refetch user to get the full user object
328
+ await refetchUser();
329
+ // User is now authenticated via Turnkey
330
+ // Set both isAuthenticated and isConnected to true so UI updates properly
331
+ // Wallet connection is optional and can happen later for signing transactions
332
+ setIsAuthenticated(true);
333
+ setIsConnected(true);
334
+ setJustCompletedLogin(true);
335
+ // Call the login success callback
336
+ onLoginSuccess?.({});
337
+ }, onClose: () => {
338
+ // If user closes Turnkey modal, they can still use wallet connection as fallback
339
+ setTurnkeyAuthCompleted(true);
340
+ }, initialEmail: "", skipToOtp: false }) }));
301
341
  }
302
342
  else {
303
- // Default to handle all strategies we support
304
- content = _jsx(LoginStep, { chain: chain, onSuccess: handleLoginSuccess, onError: onError });
343
+ // Show loading spinner only if not in Turnkey flow
344
+ if (isAuthenticating || (isFetchingSigners && step === "login") || source === "requestPermissions") {
345
+ content = (_jsx(LoginStepContainer, { partnerId: partnerId, children: _jsx("div", { className: "my-8 flex min-h-[350px] items-center justify-center", children: _jsx(Loading, { variant: "white", size: "lg" }) }) }));
346
+ }
347
+ else {
348
+ // Custom strategy
349
+ if (strategies?.[0] === "privy") {
350
+ content = _jsx(SignInWithB3Privy, { onSuccess: handleLoginSuccess, chain: chain });
351
+ }
352
+ else if (strategies) {
353
+ // Strategies are explicitly provided
354
+ content = (_jsx(LoginStepCustom, { strategies: strategies, chain: chain, onSuccess: handleLoginSuccess, onError: onError, automaticallySetFirstEoa: !!automaticallySetFirstEoa }));
355
+ }
356
+ else {
357
+ // Default to handle all strategies we support
358
+ content = _jsx(LoginStep, { chain: chain, onSuccess: handleLoginSuccess, onError: onError });
359
+ }
360
+ }
305
361
  }
306
362
  }
307
363
  return content;
@@ -1,10 +1,10 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
- import { Loading, useAuthentication, useAuthStore, useB3, useHandleConnectWithPrivy, } from "../../../../global-account/react/index.js";
2
+ import { Loading, useAuthentication, useAuthStore, useB3Config, useHandleConnectWithPrivy, } from "../../../../global-account/react/index.js";
3
3
  import { debugB3React } from "../../../../shared/utils/debug.js";
4
4
  import { useEffect } from "react";
5
5
  const debug = debugB3React("SignInWithB3Privy");
6
6
  export function SignInWithB3Privy({ onSuccess, onError, chain }) {
7
- const { partnerId } = useB3();
7
+ const { partnerId } = useB3Config();
8
8
  const { isLoading, connectTw, fullToken } = useHandleConnectWithPrivy(chain, onSuccess);
9
9
  const setIsAuthenticating = useAuthStore(state => state.setIsAuthenticating);
10
10
  const setIsAuthenticated = useAuthStore(state => state.setIsAuthenticated);
@@ -1,5 +1,5 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { useAuthentication, useB3, useQueryB3 } from "../../../../../global-account/react/index.js";
2
+ import { useAuthentication, useB3Config, useQueryB3 } from "../../../../../global-account/react/index.js";
3
3
  import { ecosystemWalletId } from "../../../../../shared/constants/index.js";
4
4
  import { client } from "../../../../../shared/utils/thirdweb.js";
5
5
  import { ConnectEmbed, darkTheme, lightTheme } from "thirdweb/react";
@@ -15,7 +15,7 @@ export function LoginStepContainer({ children, partnerId }) {
15
15
  return (_jsxs("div", { className: "bg-b3-react-background flex flex-col items-center justify-center pt-6", children: [partnerLogo && (_jsx("img", { src: partnerLogo, alt: "Partner Logo", className: "partner-logo mb-6 h-12 w-auto object-contain" })), children] }));
16
16
  }
17
17
  export function LoginStep({ onSuccess, chain }) {
18
- const { partnerId, theme } = useB3();
18
+ const { partnerId, theme } = useB3Config();
19
19
  const wallet = ecosystemWallet(ecosystemWalletId, {
20
20
  partnerId: partnerId,
21
21
  });
@@ -1,5 +1,5 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { AuthButton, Button, getConnectOptionsFromStrategy, isWalletType, LoginStepContainer, useAuthentication, useAuthStore, useB3, useConnect, WalletRow, } from "../../../../../global-account/react/index.js";
2
+ import { AuthButton, Button, getConnectOptionsFromStrategy, isWalletType, LoginStepContainer, useAuthentication, useAuthStore, useB3Config, useConnect, WalletRow, } from "../../../../../global-account/react/index.js";
3
3
  import { debugB3React } from "../../../../../shared/utils/debug.js";
4
4
  import { client } from "../../../../../shared/utils/thirdweb.js";
5
5
  import { useState } from "react";
@@ -7,7 +7,7 @@ import { useConnect as useConnectTW } from "thirdweb/react";
7
7
  import { createWallet } from "thirdweb/wallets";
8
8
  const debug = debugB3React("LoginStepCustom");
9
9
  export function LoginStepCustom({ onSuccess, onError, chain, strategies, maxInitialWallets = 2, automaticallySetFirstEoa, }) {
10
- const { partnerId } = useB3();
10
+ const { partnerId } = useB3Config();
11
11
  const [isLoading, setIsLoading] = useState(false);
12
12
  const [showAllWallets, setShowAllWallets] = useState(false);
13
13
  const { connect } = useConnect(partnerId, chain);
@@ -1,6 +1,6 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
- import { useB3 } from "./B3Provider/useB3.js";
2
+ import { useB3Config } from "./B3Provider/useB3Config.js";
3
3
  export function StyleRoot({ children, id }) {
4
- const { theme: b3Theme } = useB3();
5
- return (_jsx("div", { className: "b3-root", id: id, "data-theme": b3Theme, children: children }));
4
+ const { theme } = useB3Config();
5
+ return (_jsx("div", { className: "b3-root", id: id, "data-theme": theme, children: children }));
6
6
  }
@@ -1,5 +1,5 @@
1
- import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
- import { useState, useEffect, useRef } from "react";
1
+ import { jsxs as _jsxs, jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
2
+ import { useEffect, useRef, useState } from "react";
3
3
  import { useTurnkeyAuth } from "../hooks/useTurnkeyAuth.js";
4
4
  export function TurnkeyAuthModal({ onClose, onSuccess, initialEmail = "", skipToOtp = false }) {
5
5
  const [step, setStep] = useState(skipToOtp ? "otp" : "email");
@@ -77,5 +77,7 @@ export function TurnkeyAuthModal({ onClose, onSuccess, initialEmail = "", skipTo
77
77
  console.error("Failed to resend OTP:", err);
78
78
  }
79
79
  };
80
- return (_jsxs("div", { className: "font-neue-montreal p-8", children: [step === "email" && (_jsxs(_Fragment, { children: [_jsx("h2", { className: "mb-6 text-center text-2xl font-bold text-gray-900 dark:text-white", children: "Setup your AnySpend Wallet" }), _jsxs("div", { className: "mb-6 space-y-3 text-center text-sm text-gray-600 dark:text-gray-400", children: [_jsxs("p", { children: ["AnySpend uses a secure,", _jsx("br", {}), "embedded wallet to fund your workflows."] }), _jsxs("p", { children: ["Please provide an email address to secure", _jsx("br", {}), "your wallet."] })] }), _jsxs("form", { onSubmit: handleEmailSubmit, className: "space-y-4", children: [_jsx("div", { children: _jsx("input", { type: "email", placeholder: "email", value: email, onChange: e => setEmail(e.target.value), required: true, disabled: isLoading, className: "w-full rounded-lg border border-gray-300 px-4 py-3 text-center text-gray-900 placeholder-gray-400 focus:border-blue-500 focus:outline-none focus:ring-2 focus:ring-blue-500/20 disabled:cursor-not-allowed disabled:bg-gray-50 dark:border-gray-700 dark:bg-gray-800 dark:text-white dark:placeholder-gray-500" }) }), error && (_jsx("div", { className: "rounded-md bg-red-50 p-3 text-sm text-red-800 dark:bg-red-900/20 dark:text-red-400", children: error })), _jsx("button", { type: "submit", disabled: isLoading || !email, className: "w-full rounded-lg bg-blue-600 px-6 py-3 font-semibold text-white transition-all duration-200 hover:bg-blue-700 disabled:cursor-not-allowed disabled:bg-gray-300 dark:disabled:bg-gray-700", children: isLoading ? (_jsxs("span", { className: "flex items-center justify-center gap-2", children: [_jsx("div", { className: "h-4 w-4 animate-spin rounded-full border-2 border-white border-t-transparent" }), "Sending..."] })) : ("Continue") })] })] })), step === "otp" && (_jsxs(_Fragment, { children: [_jsx("h2", { className: "mb-4 text-center text-2xl font-bold text-gray-900 dark:text-white", children: "2FA Security" }), _jsx("div", { className: "mb-6 space-y-3 text-center text-sm text-gray-600 dark:text-gray-400", children: _jsxs("p", { children: ["AnySpend uses a secure,", _jsx("br", {}), "embedded wallet to fund your workflows.", _jsx("br", {}), "Please provide 2FA code sent to your email."] }) }), _jsxs("form", { onSubmit: handleOtpSubmit, className: "space-y-4", children: [_jsx("div", { children: _jsx("input", { type: "text", placeholder: "Enter code", value: otpCode, onChange: e => setOtpCode(e.target.value.toUpperCase()), required: true, disabled: isLoading, autoFocus: true, className: "w-full rounded-lg border border-gray-300 px-4 py-3 text-center font-mono text-lg uppercase tracking-wider text-gray-900 placeholder-gray-400 focus:border-blue-500 focus:outline-none focus:ring-2 focus:ring-blue-500/20 disabled:cursor-not-allowed disabled:bg-gray-50 dark:border-gray-700 dark:bg-gray-800 dark:text-white dark:placeholder-gray-500", maxLength: 20 }) }), error && (_jsx("div", { className: "rounded-md bg-red-50 p-3 text-sm text-red-800 dark:bg-red-900/20 dark:text-red-400", children: error })), _jsxs("div", { className: "flex flex-col gap-2", children: [_jsx("button", { type: "submit", disabled: isLoading || !otpCode, className: "w-full rounded-lg bg-blue-600 px-6 py-3 font-semibold text-white transition-all duration-200 hover:bg-blue-700 disabled:cursor-not-allowed disabled:bg-gray-300 dark:disabled:bg-gray-700", children: isLoading ? (_jsxs("span", { className: "flex items-center justify-center gap-2", children: [_jsx("div", { className: "h-4 w-4 animate-spin rounded-full border-2 border-white border-t-transparent" }), "Verifying..."] })) : ("Confirm") }), _jsx("button", { type: "button", onClick: handleResendOtp, disabled: isLoading, className: "text-sm text-blue-600 hover:text-blue-700 hover:underline disabled:cursor-not-allowed disabled:text-gray-400 dark:text-blue-400 dark:hover:text-blue-300", children: "Resend code" })] })] })] })), step === "success" && (_jsxs("div", { className: "text-center", children: [_jsx("div", { className: "mb-6 flex items-center justify-center", children: _jsx("div", { className: "flex h-16 w-16 items-center justify-center rounded-full bg-green-100 dark:bg-green-900/20", children: _jsx("svg", { className: "h-8 w-8 text-green-600 dark:text-green-400", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: _jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M5 13l4 4L19 7" }) }) }) }), _jsx("h2", { className: "mb-2 text-2xl font-bold text-gray-900 dark:text-white", children: "Successfully Authenticated!" }), _jsx("p", { className: "text-sm text-gray-600 dark:text-gray-400", children: "Redirecting..." })] }))] }));
80
+ const isTurnkeyPrimary = process.env.NEXT_PUBLIC_TURNKEY_PRIMARY === "true";
81
+ const walletBrand = isTurnkeyPrimary ? "Smart Wallet" : "AnySpend Wallet";
82
+ return (_jsxs("div", { className: "font-neue-montreal p-8", children: [step === "email" && (_jsxs(_Fragment, { children: [_jsxs("h2", { className: "mb-6 text-center text-2xl font-bold text-gray-900 dark:text-white", children: ["Setup your ", walletBrand] }), _jsxs("div", { className: "mb-6 space-y-3 text-center text-sm text-gray-600 dark:text-gray-400", children: [_jsxs("p", { children: [isTurnkeyPrimary ? "We use a secure," : "AnySpend uses a secure,", _jsx("br", {}), "embedded wallet to fund your workflows."] }), _jsxs("p", { children: ["Please provide an email address to secure", _jsx("br", {}), "your wallet."] })] }), _jsxs("form", { onSubmit: handleEmailSubmit, className: "space-y-4", children: [_jsx("div", { children: _jsx("input", { type: "email", placeholder: "email", value: email, onChange: e => setEmail(e.target.value), required: true, disabled: isLoading, className: "w-full rounded-lg border border-gray-300 px-4 py-3 text-center text-gray-900 placeholder-gray-400 focus:border-blue-500 focus:outline-none focus:ring-2 focus:ring-blue-500/20 disabled:cursor-not-allowed disabled:bg-gray-50 dark:border-gray-700 dark:bg-gray-800 dark:text-white dark:placeholder-gray-500" }) }), error && (_jsx("div", { className: "rounded-md bg-red-50 p-3 text-sm text-red-800 dark:bg-red-900/20 dark:text-red-400", children: error })), _jsx("button", { type: "submit", disabled: isLoading || !email, className: "w-full rounded-lg bg-blue-600 px-6 py-3 font-semibold text-white transition-all duration-200 hover:bg-blue-700 disabled:cursor-not-allowed disabled:bg-gray-300 dark:disabled:bg-gray-700", children: isLoading ? (_jsxs("span", { className: "flex items-center justify-center gap-2", children: [_jsx("div", { className: "h-4 w-4 animate-spin rounded-full border-2 border-white border-t-transparent" }), "Sending..."] })) : ("Continue") })] })] })), step === "otp" && (_jsxs(_Fragment, { children: [_jsx("h2", { className: "mb-4 text-center text-2xl font-bold text-gray-900 dark:text-white", children: "2FA Security" }), _jsx("div", { className: "mb-6 space-y-3 text-center text-sm text-gray-600 dark:text-gray-400", children: _jsxs("p", { children: [isTurnkeyPrimary ? "We use a secure," : "AnySpend uses a secure,", _jsx("br", {}), "embedded wallet to fund your workflows.", _jsx("br", {}), "Please provide 2FA code sent to your email."] }) }), _jsxs("form", { onSubmit: handleOtpSubmit, className: "space-y-4", children: [_jsx("div", { children: _jsx("input", { type: "text", placeholder: "Enter code", value: otpCode, onChange: e => setOtpCode(e.target.value.toUpperCase()), required: true, disabled: isLoading, autoFocus: true, className: "w-full rounded-lg border border-gray-300 px-4 py-3 text-center font-mono text-lg uppercase tracking-wider text-gray-900 placeholder-gray-400 focus:border-blue-500 focus:outline-none focus:ring-2 focus:ring-blue-500/20 disabled:cursor-not-allowed disabled:bg-gray-50 dark:border-gray-700 dark:bg-gray-800 dark:text-white dark:placeholder-gray-500", maxLength: 20 }) }), error && (_jsx("div", { className: "rounded-md bg-red-50 p-3 text-sm text-red-800 dark:bg-red-900/20 dark:text-red-400", children: error })), _jsxs("div", { className: "flex flex-col gap-2", children: [_jsx("button", { type: "submit", disabled: isLoading || !otpCode, className: "w-full rounded-lg bg-blue-600 px-6 py-3 font-semibold text-white transition-all duration-200 hover:bg-blue-700 disabled:cursor-not-allowed disabled:bg-gray-300 dark:disabled:bg-gray-700", children: isLoading ? (_jsxs("span", { className: "flex items-center justify-center gap-2", children: [_jsx("div", { className: "h-4 w-4 animate-spin rounded-full border-2 border-white border-t-transparent" }), "Verifying..."] })) : ("Confirm") }), _jsx("button", { type: "button", onClick: handleResendOtp, disabled: isLoading, className: "text-sm text-blue-600 hover:text-blue-700 hover:underline disabled:cursor-not-allowed disabled:text-gray-400 dark:text-blue-400 dark:hover:text-blue-300", children: "Resend code" })] })] })] })), step === "success" && (_jsxs("div", { className: "text-center", children: [_jsx("div", { className: "mb-6 flex items-center justify-center", children: _jsx("div", { className: "flex h-16 w-16 items-center justify-center rounded-full bg-green-100 dark:bg-green-900/20", children: _jsx("svg", { className: "h-8 w-8 text-green-600 dark:text-green-400", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: _jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M5 13l4 4L19 7" }) }) }) }), _jsx("h2", { className: "mb-2 text-2xl font-bold text-gray-900 dark:text-white", children: "Successfully Authenticated!" }), _jsx("p", { className: "text-sm text-gray-600 dark:text-gray-400", children: "Redirecting..." })] }))] }));
81
83
  }
@@ -1,10 +1,9 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { Button, StyleRoot, useAuthentication, useB3, useModalStore } from "../../../../global-account/react/index.js";
2
+ import { Button, StyleRoot, useModalStore, useUser } from "../../../../global-account/react/index.js";
3
3
  import { cn } from "../../../../shared/utils/index.js";
4
4
  export function ManageAccountButton(props) {
5
- const { partnerId } = useB3();
6
5
  const { setB3ModalOpen, setB3ModalContentType } = useModalStore();
7
- const { isConnected } = useAuthentication(partnerId);
6
+ const { isConnected } = useUser();
8
7
  const handleClickManageAccount = () => {
9
8
  setB3ModalContentType({
10
9
  ...props,
@@ -1,7 +1,6 @@
1
1
  export { B3DynamicModal } from "./B3DynamicModal";
2
- export { B3Provider, InnerProvider } from "./B3Provider/B3Provider";
2
+ export { B3Provider } from "./B3Provider/B3Provider";
3
3
  export { RelayKitProviderWrapper } from "./B3Provider/RelayKitProviderWrapper";
4
- export { B3Context, type B3ContextType } from "./B3Provider/types";
5
4
  export { useB3 } from "./B3Provider/useB3";
6
5
  export { useB3Account } from "./B3Provider/useB3Account";
7
6
  export { useB3Config } from "./B3Provider/useB3Config";
@@ -1,9 +1,8 @@
1
1
  // TODO woj: Barrel file for all components, this might be reason of bundle size issues
2
2
  // Core Components
3
3
  export { B3DynamicModal } from "./B3DynamicModal.js";
4
- export { B3Provider, InnerProvider } from "./B3Provider/B3Provider.js";
4
+ export { B3Provider } from "./B3Provider/B3Provider.js";
5
5
  export { RelayKitProviderWrapper } from "./B3Provider/RelayKitProviderWrapper.js";
6
- export { B3Context } from "./B3Provider/types.js";
7
6
  export { useB3 } from "./B3Provider/useB3.js";
8
7
  export { useB3Account } from "./B3Provider/useB3Account.js";
9
8
  export { useB3Config } from "./B3Provider/useB3Config.js";
@@ -3,6 +3,7 @@ export { useAccountAssets } from "./useAccountAssets";
3
3
  export { useAccountWallet } from "./useAccountWallet";
4
4
  export { useAddTWSessionKey } from "./useAddTWSessionKey";
5
5
  export { useAnalytics } from "./useAnalytics";
6
+ export { useAuth } from "./useAuth";
6
7
  export { useAuthentication } from "./useAuthentication";
7
8
  export { useB3BalanceFromAddresses } from "./useB3BalanceFromAddresses";
8
9
  export { useB3EnsName } from "./useB3EnsName";
@@ -42,3 +43,4 @@ export { useTokensFromAddress } from "./useTokensFromAddress";
42
43
  export { useTurnkeyAuth } from "./useTurnkeyAuth";
43
44
  export { useUnifiedChainSwitchAndExecute } from "./useUnifiedChainSwitchAndExecute";
44
45
  export { useURLParams } from "./useURLParams";
46
+ export { useUser } from "./useUser";
@@ -3,6 +3,7 @@ export { useAccountAssets } from "./useAccountAssets.js";
3
3
  export { useAccountWallet } from "./useAccountWallet.js";
4
4
  export { useAddTWSessionKey } from "./useAddTWSessionKey.js";
5
5
  export { useAnalytics } from "./useAnalytics.js";
6
+ export { useAuth } from "./useAuth.js";
6
7
  export { useAuthentication } from "./useAuthentication.js";
7
8
  export { useB3BalanceFromAddresses } from "./useB3BalanceFromAddresses.js";
8
9
  export { useB3EnsName } from "./useB3EnsName.js";
@@ -42,3 +43,4 @@ export { useTokensFromAddress } from "./useTokensFromAddress.js";
42
43
  export { useTurnkeyAuth } from "./useTurnkeyAuth.js";
43
44
  export { useUnifiedChainSwitchAndExecute } from "./useUnifiedChainSwitchAndExecute.js";
44
45
  export { useURLParams } from "./useURLParams.js";
46
+ export { useUser } from "./useUser.js";
@@ -0,0 +1,76 @@
1
+ import { Wallet } from "thirdweb/wallets";
2
+ import { preAuthenticate } from "thirdweb/wallets/in-app";
3
+ /**
4
+ * Unified authentication hook that uses Turnkey for authentication
5
+ * This replaces the previous Thirdweb-based authentication
6
+ *
7
+ * This hook provides 1:1 feature parity with useAuthentication.ts
8
+ */
9
+ export declare function useAuth(): {
10
+ authenticate: (turnkeySessionJwt: string, partnerId: string) => Promise<import("@feathersjs/authentication").AuthenticationResult>;
11
+ reAuthenticate: () => Promise<import("@feathersjs/authentication").AuthenticationResult>;
12
+ logout: (callback?: () => void) => Promise<void>;
13
+ isAuthenticated: boolean;
14
+ isReady: boolean;
15
+ isConnecting: boolean;
16
+ isConnected: boolean;
17
+ wallet: import("thirdweb/dist/types/wallets/in-app/core/wallet/types").EcosystemWallet;
18
+ preAuthenticate: typeof preAuthenticate;
19
+ connect: (_walleAutoConnectedWith: Wallet, allConnectedWallets: Wallet[]) => Promise<void>;
20
+ isAuthenticating: boolean;
21
+ onConnect: (_walleAutoConnectedWith: Wallet, allConnectedWallets: Wallet[]) => Promise<void>;
22
+ user: {
23
+ email?: string | undefined;
24
+ username?: string | undefined;
25
+ telNumber?: string | undefined;
26
+ ens?: string | undefined;
27
+ avatar?: string | undefined;
28
+ preferences?: {} | undefined;
29
+ referredBy?: string | {} | undefined;
30
+ sourceApp?: string | undefined;
31
+ referralCode?: string | undefined;
32
+ userGroups?: number[] | undefined;
33
+ isMigratedFromBSMNT?: boolean | undefined;
34
+ privyLinkedAccounts?: {
35
+ name?: string | undefined;
36
+ address?: string | undefined;
37
+ email?: string | undefined;
38
+ chain_type?: string | undefined;
39
+ lv?: number | undefined;
40
+ wallet_client_type?: string | undefined;
41
+ smart_wallet_type?: string | undefined;
42
+ subject?: string | undefined;
43
+ type: string;
44
+ }[] | undefined;
45
+ twProfiles?: {
46
+ type: string;
47
+ details: {
48
+ id?: string | undefined;
49
+ name?: string | undefined;
50
+ address?: string | undefined;
51
+ email?: string | undefined;
52
+ username?: string | undefined;
53
+ phone?: string | undefined;
54
+ fid?: string | undefined;
55
+ };
56
+ }[] | undefined;
57
+ turnkeySubOrgs?: {
58
+ hasDelegatedUser?: boolean | undefined;
59
+ subOrgId: string;
60
+ accounts: Record<string, any>[];
61
+ }[] | undefined;
62
+ _id: string | {};
63
+ userId: string;
64
+ smartAccountAddress: string;
65
+ createdAt: number;
66
+ updatedAt: number;
67
+ partnerIds: {
68
+ privyId?: string | undefined;
69
+ thirdwebId?: string | undefined;
70
+ turnkeyId?: string | undefined;
71
+ turnkeyOtpId?: string | undefined;
72
+ };
73
+ } | undefined;
74
+ refetchUser: () => Promise<import("@feathersjs/authentication").AuthenticationResult>;
75
+ setUser: (newUser?: import("@b3dotfun/b3-api").Users) => void;
76
+ };