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

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 (263) hide show
  1. package/dist/cjs/anyspend/constants/index.d.ts +0 -2
  2. package/dist/cjs/anyspend/constants/index.js +1 -3
  3. package/dist/cjs/anyspend/index.d.ts +0 -2
  4. package/dist/cjs/anyspend/index.js +0 -3
  5. package/dist/cjs/anyspend/react/components/AnySpend.d.ts +0 -6
  6. package/dist/cjs/anyspend/react/components/AnySpend.js +6 -9
  7. package/dist/cjs/anyspend/react/components/AnySpendCollectorClubPurchase.d.ts +1 -5
  8. package/dist/cjs/anyspend/react/components/AnySpendCollectorClubPurchase.js +2 -2
  9. package/dist/cjs/anyspend/react/components/AnySpendCustom.d.ts +0 -1
  10. package/dist/cjs/anyspend/react/components/AnySpendCustom.js +3 -3
  11. package/dist/cjs/anyspend/react/components/AnySpendCustomExactIn.d.ts +0 -6
  12. package/dist/cjs/anyspend/react/components/AnySpendCustomExactIn.js +20 -24
  13. package/dist/cjs/anyspend/react/components/AnySpendDeposit.d.ts +1 -7
  14. package/dist/cjs/anyspend/react/components/AnySpendDeposit.js +3 -3
  15. package/dist/cjs/anyspend/react/components/AnyspendDepositHype.d.ts +0 -4
  16. package/dist/cjs/anyspend/react/components/common/CryptoPaymentMethod.js +1 -14
  17. package/dist/cjs/anyspend/react/components/common/CryptoReceiveSection.d.ts +1 -3
  18. package/dist/cjs/anyspend/react/components/common/CryptoReceiveSection.js +2 -3
  19. package/dist/cjs/anyspend/react/components/common/OrderDetails.d.ts +0 -4
  20. package/dist/cjs/anyspend/react/components/common/OrderDetails.js +6 -34
  21. package/dist/cjs/anyspend/react/components/common/PanelOnramp.d.ts +1 -3
  22. package/dist/cjs/anyspend/react/components/common/PanelOnramp.js +2 -3
  23. package/dist/cjs/anyspend/react/components/common/PaymentStripeWeb2.js +4 -3
  24. package/dist/cjs/anyspend/react/hooks/index.d.ts +0 -1
  25. package/dist/cjs/anyspend/react/hooks/index.js +0 -1
  26. package/dist/cjs/anyspend/react/hooks/useAnyspendCreateOnrampOrder.js +1 -1
  27. package/dist/cjs/anyspend/react/hooks/useAnyspendCreateOrder.js +1 -1
  28. package/dist/cjs/anyspend/react/hooks/useCreateDepositFirstOrder.js +1 -1
  29. package/dist/cjs/anyspend/react/hooks/useValidatedClientReferenceId.js +1 -1
  30. package/dist/cjs/global-account/react/components/B3DynamicModal.js +3 -2
  31. package/dist/cjs/global-account/react/components/B3Provider/B3Provider.d.ts +18 -2
  32. package/dist/cjs/global-account/react/components/B3Provider/B3Provider.js +57 -35
  33. package/dist/cjs/global-account/react/components/B3Provider/B3Provider.native.d.ts +5 -5
  34. package/dist/cjs/global-account/react/components/B3Provider/B3Provider.native.js +35 -38
  35. package/dist/cjs/global-account/react/components/B3Provider/types.d.ts +27 -0
  36. package/dist/cjs/global-account/react/components/B3Provider/types.js +24 -0
  37. package/dist/cjs/global-account/react/components/B3Provider/useB3.d.ts +4 -14
  38. package/dist/cjs/global-account/react/components/B3Provider/useB3.js +11 -4
  39. package/dist/cjs/global-account/react/components/B3Provider/useB3Account.js +2 -5
  40. package/dist/cjs/global-account/react/components/B3Provider/useB3Config.d.ts +2 -10
  41. package/dist/cjs/global-account/react/components/B3Provider/useB3Config.js +17 -18
  42. package/dist/cjs/global-account/react/components/ManageAccount/ProfileSection.js +2 -1
  43. package/dist/cjs/global-account/react/components/ManageAccount/channels/DiscordChannel.js +6 -6
  44. package/dist/cjs/global-account/react/components/ManageAccount/channels/EmailChannel.js +7 -7
  45. package/dist/cjs/global-account/react/components/ManageAccount/channels/PhoneChannel.js +7 -7
  46. package/dist/cjs/global-account/react/components/ManageAccount/channels/TelegramChannel.js +5 -5
  47. package/dist/cjs/global-account/react/components/RequestPermissions/RequestPermissions.js +9 -8
  48. package/dist/cjs/global-account/react/components/SignInWithB3/SignIn.js +1 -1
  49. package/dist/cjs/global-account/react/components/SignInWithB3/SignInWithB3Flow.js +15 -11
  50. package/dist/cjs/global-account/react/components/SignInWithB3/SignInWithB3Privy.js +1 -1
  51. package/dist/cjs/global-account/react/components/SignInWithB3/steps/LoginStep.js +1 -1
  52. package/dist/cjs/global-account/react/components/SignInWithB3/steps/LoginStepCustom.js +1 -1
  53. package/dist/cjs/global-account/react/components/StyleRoot.js +3 -3
  54. package/dist/cjs/global-account/react/components/custom/ManageAccountButton.js +2 -1
  55. package/dist/cjs/global-account/react/components/index.d.ts +2 -1
  56. package/dist/cjs/global-account/react/components/index.js +6 -3
  57. package/dist/cjs/global-account/react/hooks/index.d.ts +0 -1
  58. package/dist/cjs/global-account/react/hooks/index.js +1 -3
  59. package/dist/cjs/global-account/react/hooks/useAuth.js +2 -1
  60. package/dist/cjs/global-account/react/hooks/useClient.js +1 -1
  61. package/dist/cjs/global-account/react/hooks/useHandleConnectWithPrivy.js +1 -1
  62. package/dist/cjs/global-account/react/hooks/useNotifications.js +14 -14
  63. package/dist/cjs/global-account/react/hooks/useTokenBalance.js +5 -5
  64. package/dist/cjs/global-account/react/hooks/useTokenBalancesByChain.js +2 -4
  65. package/dist/cjs/global-account/react/hooks/useUserQuery.js +35 -9
  66. package/dist/cjs/global-account/react/index.native.d.ts +2 -0
  67. package/dist/cjs/global-account/react/index.native.js +5 -1
  68. package/dist/cjs/global-account/react/stores/index.d.ts +0 -1
  69. package/dist/cjs/global-account/react/stores/index.js +1 -3
  70. package/dist/cjs/global-account/react/stores/useModalStore.d.ts +0 -10
  71. package/dist/esm/anyspend/constants/index.d.ts +0 -2
  72. package/dist/esm/anyspend/constants/index.js +0 -2
  73. package/dist/esm/anyspend/index.d.ts +0 -2
  74. package/dist/esm/anyspend/index.js +0 -3
  75. package/dist/esm/anyspend/react/components/AnySpend.d.ts +0 -6
  76. package/dist/esm/anyspend/react/components/AnySpend.js +8 -11
  77. package/dist/esm/anyspend/react/components/AnySpendCollectorClubPurchase.d.ts +1 -5
  78. package/dist/esm/anyspend/react/components/AnySpendCollectorClubPurchase.js +2 -2
  79. package/dist/esm/anyspend/react/components/AnySpendCustom.d.ts +0 -1
  80. package/dist/esm/anyspend/react/components/AnySpendCustom.js +3 -3
  81. package/dist/esm/anyspend/react/components/AnySpendCustomExactIn.d.ts +0 -6
  82. package/dist/esm/anyspend/react/components/AnySpendCustomExactIn.js +4 -8
  83. package/dist/esm/anyspend/react/components/AnySpendDeposit.d.ts +1 -7
  84. package/dist/esm/anyspend/react/components/AnySpendDeposit.js +3 -3
  85. package/dist/esm/anyspend/react/components/AnyspendDepositHype.d.ts +0 -4
  86. package/dist/esm/anyspend/react/components/common/CryptoPaymentMethod.js +1 -14
  87. package/dist/esm/anyspend/react/components/common/CryptoReceiveSection.d.ts +1 -3
  88. package/dist/esm/anyspend/react/components/common/CryptoReceiveSection.js +2 -3
  89. package/dist/esm/anyspend/react/components/common/OrderDetails.d.ts +0 -4
  90. package/dist/esm/anyspend/react/components/common/OrderDetails.js +8 -36
  91. package/dist/esm/anyspend/react/components/common/PanelOnramp.d.ts +1 -3
  92. package/dist/esm/anyspend/react/components/common/PanelOnramp.js +2 -3
  93. package/dist/esm/anyspend/react/components/common/PaymentStripeWeb2.js +4 -3
  94. package/dist/esm/anyspend/react/hooks/index.d.ts +0 -1
  95. package/dist/esm/anyspend/react/hooks/index.js +0 -1
  96. package/dist/esm/anyspend/react/hooks/useAnyspendCreateOnrampOrder.js +2 -2
  97. package/dist/esm/anyspend/react/hooks/useAnyspendCreateOrder.js +2 -2
  98. package/dist/esm/anyspend/react/hooks/useCreateDepositFirstOrder.js +2 -2
  99. package/dist/esm/anyspend/react/hooks/useValidatedClientReferenceId.js +2 -2
  100. package/dist/esm/global-account/react/components/B3DynamicModal.js +4 -3
  101. package/dist/esm/global-account/react/components/B3Provider/B3Provider.d.ts +18 -2
  102. package/dist/esm/global-account/react/components/B3Provider/B3Provider.js +58 -34
  103. package/dist/esm/global-account/react/components/B3Provider/B3Provider.native.d.ts +5 -5
  104. package/dist/esm/global-account/react/components/B3Provider/B3Provider.native.js +36 -36
  105. package/dist/esm/global-account/react/components/B3Provider/types.d.ts +27 -0
  106. package/dist/esm/global-account/react/components/B3Provider/types.js +21 -0
  107. package/dist/esm/global-account/react/components/B3Provider/useB3.d.ts +4 -14
  108. package/dist/esm/global-account/react/components/B3Provider/useB3.js +11 -4
  109. package/dist/esm/global-account/react/components/B3Provider/useB3Account.js +2 -5
  110. package/dist/esm/global-account/react/components/B3Provider/useB3Config.d.ts +2 -10
  111. package/dist/esm/global-account/react/components/B3Provider/useB3Config.js +17 -18
  112. package/dist/esm/global-account/react/components/ManageAccount/ProfileSection.js +3 -2
  113. package/dist/esm/global-account/react/components/ManageAccount/channels/DiscordChannel.js +2 -2
  114. package/dist/esm/global-account/react/components/ManageAccount/channels/EmailChannel.js +2 -2
  115. package/dist/esm/global-account/react/components/ManageAccount/channels/PhoneChannel.js +2 -2
  116. package/dist/esm/global-account/react/components/ManageAccount/channels/TelegramChannel.js +2 -2
  117. package/dist/esm/global-account/react/components/RequestPermissions/RequestPermissions.js +3 -2
  118. package/dist/esm/global-account/react/components/SignInWithB3/SignIn.js +2 -2
  119. package/dist/esm/global-account/react/components/SignInWithB3/SignInWithB3Flow.js +16 -12
  120. package/dist/esm/global-account/react/components/SignInWithB3/SignInWithB3Privy.js +2 -2
  121. package/dist/esm/global-account/react/components/SignInWithB3/steps/LoginStep.js +2 -2
  122. package/dist/esm/global-account/react/components/SignInWithB3/steps/LoginStepCustom.js +2 -2
  123. package/dist/esm/global-account/react/components/StyleRoot.js +3 -3
  124. package/dist/esm/global-account/react/components/custom/ManageAccountButton.js +3 -2
  125. package/dist/esm/global-account/react/components/index.d.ts +2 -1
  126. package/dist/esm/global-account/react/components/index.js +2 -1
  127. package/dist/esm/global-account/react/hooks/index.d.ts +0 -1
  128. package/dist/esm/global-account/react/hooks/index.js +0 -1
  129. package/dist/esm/global-account/react/hooks/useAuth.js +3 -2
  130. package/dist/esm/global-account/react/hooks/useClient.js +2 -2
  131. package/dist/esm/global-account/react/hooks/useHandleConnectWithPrivy.js +2 -2
  132. package/dist/esm/global-account/react/hooks/useNotifications.js +2 -2
  133. package/dist/esm/global-account/react/hooks/useTokenBalance.js +6 -6
  134. package/dist/esm/global-account/react/hooks/useTokenBalancesByChain.js +2 -4
  135. package/dist/esm/global-account/react/hooks/useUserQuery.js +27 -1
  136. package/dist/esm/global-account/react/index.native.d.ts +2 -0
  137. package/dist/esm/global-account/react/index.native.js +2 -0
  138. package/dist/esm/global-account/react/stores/index.d.ts +0 -1
  139. package/dist/esm/global-account/react/stores/index.js +0 -1
  140. package/dist/esm/global-account/react/stores/useModalStore.d.ts +0 -10
  141. package/dist/styles/index.css +1 -1
  142. package/dist/types/anyspend/constants/index.d.ts +0 -2
  143. package/dist/types/anyspend/index.d.ts +0 -2
  144. package/dist/types/anyspend/react/components/AnySpend.d.ts +0 -6
  145. package/dist/types/anyspend/react/components/AnySpendCollectorClubPurchase.d.ts +1 -5
  146. package/dist/types/anyspend/react/components/AnySpendCustom.d.ts +0 -1
  147. package/dist/types/anyspend/react/components/AnySpendCustomExactIn.d.ts +0 -6
  148. package/dist/types/anyspend/react/components/AnySpendDeposit.d.ts +1 -7
  149. package/dist/types/anyspend/react/components/AnyspendDepositHype.d.ts +0 -4
  150. package/dist/types/anyspend/react/components/common/CryptoReceiveSection.d.ts +1 -3
  151. package/dist/types/anyspend/react/components/common/OrderDetails.d.ts +0 -4
  152. package/dist/types/anyspend/react/components/common/PanelOnramp.d.ts +1 -3
  153. package/dist/types/anyspend/react/hooks/index.d.ts +0 -1
  154. package/dist/types/global-account/react/components/B3Provider/B3Provider.d.ts +18 -2
  155. package/dist/types/global-account/react/components/B3Provider/B3Provider.native.d.ts +5 -5
  156. package/dist/types/global-account/react/components/B3Provider/types.d.ts +27 -0
  157. package/dist/types/global-account/react/components/B3Provider/useB3.d.ts +4 -14
  158. package/dist/types/global-account/react/components/B3Provider/useB3Config.d.ts +2 -10
  159. package/dist/types/global-account/react/components/index.d.ts +2 -1
  160. package/dist/types/global-account/react/hooks/index.d.ts +0 -1
  161. package/dist/types/global-account/react/index.native.d.ts +2 -0
  162. package/dist/types/global-account/react/stores/index.d.ts +0 -1
  163. package/dist/types/global-account/react/stores/useModalStore.d.ts +0 -10
  164. package/package.json +1 -1
  165. package/src/anyspend/constants/index.ts +0 -3
  166. package/src/anyspend/index.ts +0 -4
  167. package/src/anyspend/react/components/AnySpend.tsx +2 -28
  168. package/src/anyspend/react/components/AnySpendCollectorClubPurchase.tsx +0 -6
  169. package/src/anyspend/react/components/AnySpendCustom.tsx +47 -52
  170. package/src/anyspend/react/components/AnySpendCustomExactIn.tsx +0 -23
  171. package/src/anyspend/react/components/AnySpendDeposit.tsx +1 -18
  172. package/src/anyspend/react/components/AnyspendDepositHype.tsx +0 -4
  173. package/src/anyspend/react/components/common/CryptoPaymentMethod.tsx +1 -15
  174. package/src/anyspend/react/components/common/CryptoReceiveSection.tsx +1 -5
  175. package/src/anyspend/react/components/common/OrderDetails.tsx +42 -60
  176. package/src/anyspend/react/components/common/PanelOnramp.tsx +1 -5
  177. package/src/anyspend/react/components/common/PaymentStripeWeb2.tsx +4 -3
  178. package/src/anyspend/react/hooks/index.ts +0 -1
  179. package/src/anyspend/react/hooks/useAnyspendCreateOnrampOrder.ts +2 -2
  180. package/src/anyspend/react/hooks/useAnyspendCreateOrder.ts +2 -2
  181. package/src/anyspend/react/hooks/useCreateDepositFirstOrder.ts +2 -2
  182. package/src/anyspend/react/hooks/useValidatedClientReferenceId.ts +2 -2
  183. package/src/global-account/react/components/B3DynamicModal.tsx +4 -3
  184. package/src/global-account/react/components/B3Provider/B3Provider.native.tsx +54 -43
  185. package/src/global-account/react/components/B3Provider/B3Provider.tsx +117 -44
  186. package/src/global-account/react/components/B3Provider/types.ts +50 -0
  187. package/src/global-account/react/components/B3Provider/useB3.ts +13 -4
  188. package/src/global-account/react/components/B3Provider/useB3Account.ts +2 -6
  189. package/src/global-account/react/components/B3Provider/useB3Config.ts +31 -18
  190. package/src/global-account/react/components/ManageAccount/ProfileSection.tsx +4 -2
  191. package/src/global-account/react/components/ManageAccount/channels/DiscordChannel.tsx +2 -2
  192. package/src/global-account/react/components/ManageAccount/channels/EmailChannel.tsx +2 -2
  193. package/src/global-account/react/components/ManageAccount/channels/PhoneChannel.tsx +2 -2
  194. package/src/global-account/react/components/ManageAccount/channels/TelegramChannel.tsx +2 -2
  195. package/src/global-account/react/components/RequestPermissions/RequestPermissions.tsx +4 -4
  196. package/src/global-account/react/components/SignInWithB3/SignIn.tsx +2 -2
  197. package/src/global-account/react/components/SignInWithB3/SignInWithB3Flow.tsx +14 -11
  198. package/src/global-account/react/components/SignInWithB3/SignInWithB3Privy.tsx +2 -2
  199. package/src/global-account/react/components/SignInWithB3/steps/LoginStep.tsx +2 -2
  200. package/src/global-account/react/components/SignInWithB3/steps/LoginStepCustom.tsx +2 -2
  201. package/src/global-account/react/components/StyleRoot.tsx +3 -3
  202. package/src/global-account/react/components/custom/ManageAccountButton.tsx +3 -2
  203. package/src/global-account/react/components/index.ts +2 -1
  204. package/src/global-account/react/hooks/index.ts +0 -1
  205. package/src/global-account/react/hooks/useAuth.ts +3 -2
  206. package/src/global-account/react/hooks/useClient.ts +2 -2
  207. package/src/global-account/react/hooks/useHandleConnectWithPrivy.tsx +2 -2
  208. package/src/global-account/react/hooks/useNotifications.ts +2 -2
  209. package/src/global-account/react/hooks/useTokenBalance.tsx +7 -8
  210. package/src/global-account/react/hooks/useTokenBalancesByChain.tsx +2 -4
  211. package/src/global-account/react/hooks/useUserQuery.ts +40 -1
  212. package/src/global-account/react/index.native.ts +2 -0
  213. package/src/global-account/react/stores/index.ts +0 -1
  214. package/src/global-account/react/stores/useModalStore.ts +0 -10
  215. package/dist/cjs/anyspend/react/components/common/GasIndicator.d.ts +0 -6
  216. package/dist/cjs/anyspend/react/components/common/GasIndicator.js +0 -34
  217. package/dist/cjs/anyspend/react/hooks/useGasPrice.d.ts +0 -37
  218. package/dist/cjs/anyspend/react/hooks/useGasPrice.js +0 -43
  219. package/dist/cjs/anyspend/services/gas.d.ts +0 -21
  220. package/dist/cjs/anyspend/services/gas.js +0 -65
  221. package/dist/cjs/anyspend/types/gas.d.ts +0 -61
  222. package/dist/cjs/anyspend/types/gas.js +0 -2
  223. package/dist/cjs/global-account/react/components/B3Provider/AuthenticationProvider.d.ts +0 -5
  224. package/dist/cjs/global-account/react/components/B3Provider/AuthenticationProvider.js +0 -12
  225. package/dist/cjs/global-account/react/hooks/useUser.d.ts +0 -60
  226. package/dist/cjs/global-account/react/hooks/useUser.js +0 -20
  227. package/dist/cjs/global-account/react/stores/configStore.d.ts +0 -24
  228. package/dist/cjs/global-account/react/stores/configStore.js +0 -30
  229. package/dist/cjs/global-account/react/stores/userStore.d.ts +0 -22
  230. package/dist/cjs/global-account/react/stores/userStore.js +0 -30
  231. package/dist/esm/anyspend/react/components/common/GasIndicator.d.ts +0 -6
  232. package/dist/esm/anyspend/react/components/common/GasIndicator.js +0 -31
  233. package/dist/esm/anyspend/react/hooks/useGasPrice.d.ts +0 -37
  234. package/dist/esm/anyspend/react/hooks/useGasPrice.js +0 -40
  235. package/dist/esm/anyspend/services/gas.d.ts +0 -21
  236. package/dist/esm/anyspend/services/gas.js +0 -59
  237. package/dist/esm/anyspend/types/gas.d.ts +0 -61
  238. package/dist/esm/anyspend/types/gas.js +0 -1
  239. package/dist/esm/global-account/react/components/B3Provider/AuthenticationProvider.d.ts +0 -5
  240. package/dist/esm/global-account/react/components/B3Provider/AuthenticationProvider.js +0 -10
  241. package/dist/esm/global-account/react/hooks/useUser.d.ts +0 -60
  242. package/dist/esm/global-account/react/hooks/useUser.js +0 -17
  243. package/dist/esm/global-account/react/stores/configStore.d.ts +0 -24
  244. package/dist/esm/global-account/react/stores/configStore.js +0 -27
  245. package/dist/esm/global-account/react/stores/userStore.d.ts +0 -22
  246. package/dist/esm/global-account/react/stores/userStore.js +0 -27
  247. package/dist/types/anyspend/react/components/common/GasIndicator.d.ts +0 -6
  248. package/dist/types/anyspend/react/hooks/useGasPrice.d.ts +0 -37
  249. package/dist/types/anyspend/services/gas.d.ts +0 -21
  250. package/dist/types/anyspend/types/gas.d.ts +0 -61
  251. package/dist/types/global-account/react/components/B3Provider/AuthenticationProvider.d.ts +0 -5
  252. package/dist/types/global-account/react/hooks/useUser.d.ts +0 -60
  253. package/dist/types/global-account/react/stores/configStore.d.ts +0 -24
  254. package/dist/types/global-account/react/stores/userStore.d.ts +0 -22
  255. package/src/anyspend/react/components/common/GasIndicator.tsx +0 -59
  256. package/src/anyspend/react/hooks/useGasPrice.ts +0 -70
  257. package/src/anyspend/services/gas.test.ts +0 -31
  258. package/src/anyspend/services/gas.ts +0 -73
  259. package/src/anyspend/types/gas.ts +0 -66
  260. package/src/global-account/react/components/B3Provider/AuthenticationProvider.tsx +0 -19
  261. package/src/global-account/react/hooks/useUser.ts +0 -20
  262. package/src/global-account/react/stores/configStore.ts +0 -51
  263. package/src/global-account/react/stores/userStore.ts +0 -41
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.B3Context = void 0;
4
+ const react_1 = require("react");
5
+ /**
6
+ * Context for B3 provider
7
+ */
8
+ exports.B3Context = (0, react_1.createContext)({
9
+ account: undefined,
10
+ automaticallySetFirstEoa: false,
11
+ //user: undefined,
12
+ //setWallet: () => {},
13
+ wallet: undefined,
14
+ //setUser: () => {},
15
+ //refetchUser: async () => {},
16
+ initialized: false,
17
+ ready: false,
18
+ environment: "development",
19
+ theme: "light",
20
+ clientType: "rest",
21
+ partnerId: "",
22
+ createClientReferenceId: undefined,
23
+ enableTurnkey: false,
24
+ });
@@ -1,16 +1,6 @@
1
1
  /**
2
- * Hook to access the B3 configuration
3
- * @deprecated This is just an alias for useB3Config. Use useB3Config directly instead.
2
+ * Hook to access the B3 context
3
+ * @throws Error if used outside a B3Provider
4
+ * @deprecated Use useB3Config or useB3Account instead
4
5
  */
5
- export declare function useB3(): {
6
- automaticallySetFirstEoa: boolean;
7
- environment: "development" | "production";
8
- theme: "light" | "dark";
9
- clientType: import("../../../client-manager").ClientType;
10
- partnerId: string;
11
- createClientReferenceId: ((params: import("../../../../anyspend/react").CreateOrderParams | import("../../../../anyspend/react").CreateOnrampOrderParams) => Promise<string>) | undefined;
12
- enableTurnkey: boolean;
13
- stripePublishableKey: string | undefined;
14
- defaultPermissions: import("../../../types/permissions").PermissionsConfig;
15
- accountOverride: import("thirdweb/wallets").Account | undefined;
16
- };
6
+ export declare function useB3(): import("./types").B3ContextType;
@@ -1,11 +1,18 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.useB3 = useB3;
4
- const useB3Config_1 = require("./useB3Config");
4
+ const react_1 = require("react");
5
+ const types_1 = require("./types");
5
6
  /**
6
- * Hook to access the B3 configuration
7
- * @deprecated This is just an alias for useB3Config. Use useB3Config directly instead.
7
+ * Hook to access the B3 context
8
+ * @throws Error if used outside a B3Provider
9
+ * @deprecated Use useB3Config or useB3Account instead
8
10
  */
9
11
  function useB3() {
10
- return (0, useB3Config_1.useB3Config)();
12
+ const context = (0, react_1.useContext)(types_1.B3Context);
13
+ if (!context.initialized) {
14
+ throw new Error("useB3 must be used within a B3Provider");
15
+ }
16
+ // Return a stable reference
17
+ return (0, react_1.useMemo)(() => context, [context]);
11
18
  }
@@ -2,12 +2,9 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.useB3Account = void 0;
4
4
  const react_1 = require("thirdweb/react");
5
- const useAuthStore_1 = require("../../stores/useAuthStore");
6
5
  // Wrapper around useActiveAccount
7
6
  const useB3Account = () => {
8
- const isAuthenticated = (0, useAuthStore_1.useAuthStore)(state => state.isAuthenticated);
9
- const activeAccount = (0, react_1.useActiveAccount)();
10
- const effectiveAccount = isAuthenticated ? activeAccount : undefined;
11
- return effectiveAccount;
7
+ const account = (0, react_1.useActiveAccount)();
8
+ return account;
12
9
  };
13
10
  exports.useB3Account = useB3Account;
@@ -1,17 +1,9 @@
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
- */
6
1
  export declare const useB3Config: () => {
7
2
  automaticallySetFirstEoa: boolean;
8
- environment: "development" | "production";
3
+ environment: "development" | "production" | undefined;
9
4
  theme: "light" | "dark";
10
5
  clientType: import("../../../client-manager").ClientType;
11
6
  partnerId: string;
12
7
  createClientReferenceId: ((params: import("../../../../anyspend/react").CreateOrderParams | import("../../../../anyspend/react").CreateOnrampOrderParams) => Promise<string>) | undefined;
13
- enableTurnkey: boolean;
14
- stripePublishableKey: string | undefined;
15
- defaultPermissions: import("../../../types/permissions").PermissionsConfig;
16
- accountOverride: import("thirdweb/wallets").Account | undefined;
8
+ enableTurnkey: boolean | undefined;
17
9
  };
@@ -1,24 +1,23 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.useB3Config = void 0;
4
- const configStore_1 = require("../../stores/configStore");
5
- /**
6
- * Hook to access B3 configuration
7
- * Returns all config values from the Zustand store
8
- * Since config is static (set once at initialization), destructuring is fine here
9
- */
4
+ const react_1 = require("react");
5
+ const types_1 = require("./types");
10
6
  const useB3Config = () => {
11
- return (0, configStore_1.useB3ConfigStore)(state => ({
12
- automaticallySetFirstEoa: state.automaticallySetFirstEoa,
13
- environment: state.environment,
14
- theme: state.theme,
15
- clientType: state.clientType,
16
- partnerId: state.partnerId,
17
- createClientReferenceId: state.createClientReferenceId,
18
- enableTurnkey: state.enableTurnkey,
19
- stripePublishableKey: state.stripePublishableKey,
20
- defaultPermissions: state.defaultPermissions,
21
- accountOverride: state.accountOverride,
22
- }));
7
+ const context = (0, react_1.useContext)(types_1.B3Context);
8
+ if (!context) {
9
+ throw new Error("useB3 must be used within a B3Provider");
10
+ }
11
+ const { automaticallySetFirstEoa, environment, theme, clientType, partnerId, createClientReferenceId, enableTurnkey, } = context;
12
+ // Return a stable reference
13
+ return (0, react_1.useMemo)(() => ({
14
+ automaticallySetFirstEoa,
15
+ environment,
16
+ theme,
17
+ clientType,
18
+ partnerId,
19
+ createClientReferenceId,
20
+ enableTurnkey,
21
+ }), [automaticallySetFirstEoa, environment, theme, clientType, partnerId, createClientReferenceId, enableTurnkey]);
23
22
  };
24
23
  exports.useB3Config = useB3Config;
@@ -17,7 +17,8 @@ const ProfileSection = () => {
17
17
  address: eoaAddress || account?.address,
18
18
  fresh: true,
19
19
  });
20
- const { user } = (0, react_1.useUser)();
20
+ const { partnerId } = (0, react_1.useB3Config)();
21
+ const { user } = (0, react_1.useAuthentication)(partnerId);
21
22
  const setB3ModalOpen = (0, react_1.useModalStore)(state => state.setB3ModalOpen);
22
23
  const setB3ModalContentType = (0, react_1.useModalStore)(state => state.setB3ModalContentType);
23
24
  const navigateBack = (0, react_1.useModalStore)(state => state.navigateBack);
@@ -2,18 +2,18 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.DiscordChannel = void 0;
4
4
  const jsx_runtime_1 = require("react/jsx-runtime");
5
- const react_1 = require("../../../../../global-account/react");
6
5
  const debug_1 = require("../../../../../shared/utils/debug");
7
- const react_2 = require("react");
6
+ const react_1 = require("react");
8
7
  const notificationsAPI_1 = require("../../../utils/notificationsAPI");
8
+ const useB3_1 = require("../../B3Provider/useB3");
9
9
  const toastApi_1 = require("../../Toast/toastApi");
10
10
  const NotificationChannel_1 = require("../NotificationChannel");
11
11
  const debug = (0, debug_1.debugB3React)("DiscordChannel");
12
12
  const DiscordChannel = ({ userId, jwtToken, discordChannel, isConnected, isOptimisticallyConnected, onConnectionChange, onToggle, }) => {
13
- const { partnerId } = (0, react_1.useB3Config)();
14
- const [discordId, setDiscordId] = (0, react_2.useState)("");
15
- const [isConnecting, setIsConnecting] = (0, react_2.useState)(false);
16
- const [showInput, setShowInput] = (0, react_2.useState)(false);
13
+ const { partnerId } = (0, useB3_1.useB3)();
14
+ const [discordId, setDiscordId] = (0, react_1.useState)("");
15
+ const [isConnecting, setIsConnecting] = (0, react_1.useState)(false);
16
+ const [showInput, setShowInput] = (0, react_1.useState)(false);
17
17
  // Detect if we're disconnecting
18
18
  const isDisconnecting = isConnected && !isOptimisticallyConnected;
19
19
  const handleConnect = async () => {
@@ -2,10 +2,10 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.EmailChannel = void 0;
4
4
  const jsx_runtime_1 = require("react/jsx-runtime");
5
- const react_1 = require("../../../../../global-account/react");
6
5
  const debug_1 = require("../../../../../shared/utils/debug");
7
- const react_2 = require("react");
6
+ const react_1 = require("react");
8
7
  const notificationsAPI_1 = require("../../../utils/notificationsAPI");
8
+ const useB3_1 = require("../../B3Provider/useB3");
9
9
  const toastApi_1 = require("../../Toast/toastApi");
10
10
  const NotificationChannel_1 = require("../NotificationChannel");
11
11
  const debug = (0, debug_1.debugB3React)("EmailChannel");
@@ -14,11 +14,11 @@ const validateEmail = (email) => {
14
14
  return emailRegex.test(email);
15
15
  };
16
16
  const EmailChannel = ({ userId, jwtToken, emailChannel, isConnected, isOptimisticallyConnected, onConnectionChange, onToggle, }) => {
17
- const { partnerId } = (0, react_1.useB3Config)();
18
- const [email, setEmail] = (0, react_2.useState)("");
19
- const [emailError, setEmailError] = (0, react_2.useState)(null);
20
- const [isConnecting, setIsConnecting] = (0, react_2.useState)(false);
21
- const [showInput, setShowInput] = (0, react_2.useState)(false);
17
+ const { partnerId } = (0, useB3_1.useB3)();
18
+ const [email, setEmail] = (0, react_1.useState)("");
19
+ const [emailError, setEmailError] = (0, react_1.useState)(null);
20
+ const [isConnecting, setIsConnecting] = (0, react_1.useState)(false);
21
+ const [showInput, setShowInput] = (0, react_1.useState)(false);
22
22
  // Detect if we're disconnecting by comparing real vs optimistic state
23
23
  const isDisconnecting = isConnected && !isOptimisticallyConnected;
24
24
  const handleConnect = async () => {
@@ -2,19 +2,19 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.PhoneChannel = void 0;
4
4
  const jsx_runtime_1 = require("react/jsx-runtime");
5
- const react_1 = require("../../../../../global-account/react");
6
5
  const debug_1 = require("../../../../../shared/utils/debug");
7
- const react_2 = require("react");
6
+ const react_1 = require("react");
8
7
  const notificationsAPI_1 = require("../../../utils/notificationsAPI");
8
+ const useB3_1 = require("../../B3Provider/useB3");
9
9
  const toastApi_1 = require("../../Toast/toastApi");
10
10
  const NotificationChannel_1 = require("../NotificationChannel");
11
11
  const debug = (0, debug_1.debugB3React)("PhoneChannel");
12
12
  const PhoneChannel = ({ userId, jwtToken, smsChannel, whatsappChannel, isSMSConnected, isWhatsAppConnected, isOptimisticallySMSConnected, isOptimisticallyWhatsAppConnected, onConnectionChange, onToggle, }) => {
13
- const { partnerId } = (0, react_1.useB3Config)();
14
- const [phoneNumber, setPhoneNumber] = (0, react_2.useState)("");
15
- const [isConnectingSMS, setIsConnectingSMS] = (0, react_2.useState)(false);
16
- const [isConnectingWhatsApp, setIsConnectingWhatsApp] = (0, react_2.useState)(false);
17
- const [showInput, setShowInput] = (0, react_2.useState)(false);
13
+ const { partnerId } = (0, useB3_1.useB3)();
14
+ const [phoneNumber, setPhoneNumber] = (0, react_1.useState)("");
15
+ const [isConnectingSMS, setIsConnectingSMS] = (0, react_1.useState)(false);
16
+ const [isConnectingWhatsApp, setIsConnectingWhatsApp] = (0, react_1.useState)(false);
17
+ const [showInput, setShowInput] = (0, react_1.useState)(false);
18
18
  // Detect if we're disconnecting
19
19
  const isDisconnecting = (isSMSConnected && !isOptimisticallySMSConnected) || (isWhatsAppConnected && !isOptimisticallyWhatsAppConnected);
20
20
  const handleConnectSMS = async () => {
@@ -2,17 +2,17 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.TelegramChannel = void 0;
4
4
  const jsx_runtime_1 = require("react/jsx-runtime");
5
- const react_1 = require("../../../../../global-account/react");
6
5
  const debug_1 = require("../../../../../shared/utils/debug");
7
- const react_2 = require("react");
6
+ const react_1 = require("react");
8
7
  const notificationsAPI_1 = require("../../../utils/notificationsAPI");
8
+ const useB3_1 = require("../../B3Provider/useB3");
9
9
  const toastApi_1 = require("../../Toast/toastApi");
10
10
  const NotificationChannel_1 = require("../NotificationChannel");
11
11
  const debug = (0, debug_1.debugB3React)("TelegramChannel");
12
12
  const TelegramChannel = ({ userId, jwtToken, telegramChannel, isConnected, isOptimisticallyConnected, onConnectionChange, onToggle, }) => {
13
- const { partnerId } = (0, react_1.useB3Config)();
14
- const [isConnecting, setIsConnecting] = (0, react_2.useState)(false);
15
- const [status, setStatus] = (0, react_2.useState)("idle");
13
+ const { partnerId } = (0, useB3_1.useB3)();
14
+ const [isConnecting, setIsConnecting] = (0, react_1.useState)(false);
15
+ const [status, setStatus] = (0, react_1.useState)("idle");
16
16
  // Detect if we're disconnecting
17
17
  const isDisconnecting = isConnected && !isOptimisticallyConnected;
18
18
  const handleConnect = async () => {
@@ -6,22 +6,23 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.RequestPermissions = RequestPermissions;
7
7
  const jsx_runtime_1 = require("react/jsx-runtime");
8
8
  const react_1 = require("../../../../global-account/react");
9
+ const react_2 = require("../../../../global-account/react");
9
10
  const debug_1 = require("../../../../shared/utils/debug");
10
11
  const formatAddress_1 = require("../../../../shared/utils/formatAddress");
11
12
  const lucide_react_1 = require("lucide-react");
12
- const react_2 = require("react");
13
+ const react_3 = require("react");
13
14
  const react_timeago_1 = __importDefault(require("react-timeago"));
14
- const react_3 = require("thirdweb/react");
15
+ const react_4 = require("thirdweb/react");
15
16
  const debug = (0, debug_1.debugB3React)("RequestPermissions");
16
17
  /**
17
18
  * Component for requesting permissions to access user accounts and contracts
18
19
  * Allows users to approve session keys with specific permission settings
19
20
  */
20
21
  function RequestPermissions({ onSuccess, onError, chain, sessionKeyAddress, permissions, }) {
21
- const [isApproving, setIsApproving] = (0, react_2.useState)(false);
22
- const account = (0, react_3.useActiveAccount)();
23
- const { defaultPermissions } = (0, react_1.useB3Config)();
24
- const DEFAULT_PERMISSIONS = (0, react_2.useMemo)(() => permissions ?? defaultPermissions, [defaultPermissions, permissions]);
22
+ const [isApproving, setIsApproving] = (0, react_3.useState)(false);
23
+ const account = (0, react_4.useActiveAccount)();
24
+ const { defaultPermissions } = (0, react_1.useB3)();
25
+ const DEFAULT_PERMISSIONS = (0, react_3.useMemo)(() => permissions ?? defaultPermissions, [defaultPermissions, permissions]);
25
26
  const { refetch: refetchSigners } = (0, react_1.useGetAllTWSigners)({
26
27
  chain,
27
28
  accountAddress: account?.address,
@@ -40,7 +41,7 @@ function RequestPermissions({ onSuccess, onError, chain, sessionKeyAddress, perm
40
41
  },
41
42
  chain,
42
43
  });
43
- const handleApprove = (0, react_2.useCallback)(async () => {
44
+ const handleApprove = (0, react_3.useCallback)(async () => {
44
45
  debug("@@handleApprove");
45
46
  try {
46
47
  setIsApproving(true);
@@ -70,7 +71,7 @@ function RequestPermissions({ onSuccess, onError, chain, sessionKeyAddress, perm
70
71
  timeStyle: "short",
71
72
  }).format(date);
72
73
  };
73
- return ((0, jsx_runtime_1.jsxs)("div", { className: "flex flex-col gap-4", children: [(0, jsx_runtime_1.jsxs)("div", { className: "text-center", children: [(0, jsx_runtime_1.jsx)("h2", { className: "mb-2 text-2xl font-bold", children: "Allow Access" }), (0, jsx_runtime_1.jsx)("p", { className: "text-b3-react-muted-foreground opacity-70", children: "This app would like permission to:" })] }), (0, jsx_runtime_1.jsx)(react_1.PermissionItem, { title: "Make transactions on your behalf", description: (0, jsx_runtime_1.jsxs)("span", { children: ["Up to", " ", (0, jsx_runtime_1.jsxs)("span", { className: "text-b3-react-primary font-medium", children: [DEFAULT_PERMISSIONS.nativeTokenLimitPerTransaction, " ETH"] }), " ", "per transaction"] }), icon: (0, jsx_runtime_1.jsx)(lucide_react_1.CreditCard, { className: "h-5 w-5" }) }), (0, jsx_runtime_1.jsx)(react_1.PermissionItem, { title: "View your account", description: "See your wallet address and balance", icon: (0, jsx_runtime_1.jsx)(lucide_react_1.Eye, { className: "h-5 w-5" }) }), (0, jsx_runtime_1.jsxs)("div", { className: "bg-b3-react-card rounded-lg border p-5 py-4", children: [(0, jsx_runtime_1.jsx)("h3", { className: "mb-2 text-base font-medium", children: "Approved Contracts" }), (0, jsx_runtime_1.jsx)("div", { className: "space-y-2", children: DEFAULT_PERMISSIONS.approvedTargets.map((target) => ((0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-2", children: [(0, jsx_runtime_1.jsx)("div", { className: "bg-b3-react-background text-b3-react-muted-foreground rounded-md border px-3 py-2 font-mono text-sm", children: (0, formatAddress_1.formatAddress)(target) }), (0, jsx_runtime_1.jsx)("span", { className: "text-b3-react-muted-foreground text-sm", children: "\u2022 Game Contract" })] }, target))) })] }), (0, jsx_runtime_1.jsxs)("div", { className: "bg-b3-react-card rounded-lg border p-5 py-4", children: [(0, jsx_runtime_1.jsx)("h3", { className: "mb-2 text-base font-medium", children: "Permission" }), (0, jsx_runtime_1.jsxs)("div", { className: "space-y-1 text-sm", children: [(0, jsx_runtime_1.jsxs)("div", { className: "text-b3-react-muted-foreground", children: [(0, jsx_runtime_1.jsx)("span", { children: `Valid for ` }), (0, jsx_runtime_1.jsx)("span", { children: (0, jsx_runtime_1.jsx)(react_timeago_1.default, { date: DEFAULT_PERMISSIONS.endDate, live: false, formatter: (value, unit) => {
74
+ return ((0, jsx_runtime_1.jsxs)("div", { className: "flex flex-col gap-4", children: [(0, jsx_runtime_1.jsxs)("div", { className: "text-center", children: [(0, jsx_runtime_1.jsx)("h2", { className: "mb-2 text-2xl font-bold", children: "Allow Access" }), (0, jsx_runtime_1.jsx)("p", { className: "text-b3-react-muted-foreground opacity-70", children: "This app would like permission to:" })] }), (0, jsx_runtime_1.jsx)(react_2.PermissionItem, { title: "Make transactions on your behalf", description: (0, jsx_runtime_1.jsxs)("span", { children: ["Up to", " ", (0, jsx_runtime_1.jsxs)("span", { className: "text-b3-react-primary font-medium", children: [DEFAULT_PERMISSIONS.nativeTokenLimitPerTransaction, " ETH"] }), " ", "per transaction"] }), icon: (0, jsx_runtime_1.jsx)(lucide_react_1.CreditCard, { className: "h-5 w-5" }) }), (0, jsx_runtime_1.jsx)(react_2.PermissionItem, { title: "View your account", description: "See your wallet address and balance", icon: (0, jsx_runtime_1.jsx)(lucide_react_1.Eye, { className: "h-5 w-5" }) }), (0, jsx_runtime_1.jsxs)("div", { className: "bg-b3-react-card rounded-lg border p-5 py-4", children: [(0, jsx_runtime_1.jsx)("h3", { className: "mb-2 text-base font-medium", children: "Approved Contracts" }), (0, jsx_runtime_1.jsx)("div", { className: "space-y-2", children: DEFAULT_PERMISSIONS.approvedTargets.map((target) => ((0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-2", children: [(0, jsx_runtime_1.jsx)("div", { className: "bg-b3-react-background text-b3-react-muted-foreground rounded-md border px-3 py-2 font-mono text-sm", children: (0, formatAddress_1.formatAddress)(target) }), (0, jsx_runtime_1.jsx)("span", { className: "text-b3-react-muted-foreground text-sm", children: "\u2022 Game Contract" })] }, target))) })] }), (0, jsx_runtime_1.jsxs)("div", { className: "bg-b3-react-card rounded-lg border p-5 py-4", children: [(0, jsx_runtime_1.jsx)("h3", { className: "mb-2 text-base font-medium", children: "Permission" }), (0, jsx_runtime_1.jsxs)("div", { className: "space-y-1 text-sm", children: [(0, jsx_runtime_1.jsxs)("div", { className: "text-b3-react-muted-foreground", children: [(0, jsx_runtime_1.jsx)("span", { children: `Valid for ` }), (0, jsx_runtime_1.jsx)("span", { children: (0, jsx_runtime_1.jsx)(react_timeago_1.default, { date: DEFAULT_PERMISSIONS.endDate, live: false, formatter: (value, unit) => {
74
75
  if (unit === "year") {
75
76
  return "1 year";
76
77
  }
@@ -15,7 +15,7 @@ const react_4 = require("thirdweb/react");
15
15
  const ManageAccountButton_1 = require("../custom/ManageAccountButton");
16
16
  function SignIn(props) {
17
17
  const { className } = props;
18
- const { automaticallySetFirstEoa, partnerId } = (0, react_1.useB3Config)();
18
+ const { automaticallySetFirstEoa, partnerId } = (0, react_1.useB3)();
19
19
  const { address: globalAddress, ensName, connectedSmartWallet, connectedEOAWallet, isActiveSmartWallet, isActiveEOAWallet, smartWalletIcon, } = (0, react_1.useAccountWallet)();
20
20
  const { data: walletImage } = (0, react_4.useWalletImage)(connectedEOAWallet?.id);
21
21
  const isMobile = (0, react_1.useIsMobile)();
@@ -32,6 +32,7 @@ function SignInWithB3Flow({ strategies, onLoginSuccess, onSessionKeySuccess, onE
32
32
  const [refetchCount, setRefetchCount] = (0, react_2.useState)(0);
33
33
  const [refetchError, setRefetchError] = (0, react_2.useState)(null);
34
34
  const [turnkeyAuthCompleted, setTurnkeyAuthCompleted] = (0, react_2.useState)(false);
35
+ const justCompletedLoginRef = (0, react_2.useRef)(false);
35
36
  const { data: signers, refetch: refetchSigners, isFetching: isFetchingSigners, } = (0, react_1.useGetAllTWSigners)({
36
37
  chain,
37
38
  accountAddress: account?.address,
@@ -151,8 +152,12 @@ function SignInWithB3Flow({ strategies, onLoginSuccess, onSessionKeySuccess, onE
151
152
  signersEnabled,
152
153
  });
153
154
  // The useEffect will re-run with updated user data to complete the sign-in process
154
- }, [
155
+ },
156
+ // Zustand setters are stable and don't need to be in dependencies:
157
+ // eslint-disable-next-line react-hooks/exhaustive-deps
158
+ [
155
159
  refetchUser,
160
+ setB3ModalContentType,
156
161
  strategies,
157
162
  onLoginSuccess,
158
163
  onSessionKeySuccess,
@@ -163,10 +168,8 @@ function SignInWithB3Flow({ strategies, onLoginSuccess, onSessionKeySuccess, onE
163
168
  closeAfterLogin,
164
169
  source,
165
170
  signersEnabled,
166
- setB3ModalContentType,
167
- setIsAuthenticated,
168
- setIsConnected,
169
- setJustCompletedLogin,
171
+ // Zustand setters are stable and don't need to be in dependencies:
172
+ // setIsAuthenticated, setIsConnected, setJustCompletedLogin
170
173
  ]);
171
174
  // Handle post-login flow after signers are loaded
172
175
  (0, react_2.useEffect)(() => {
@@ -181,7 +184,9 @@ function SignInWithB3Flow({ strategies, onLoginSuccess, onSessionKeySuccess, onE
181
184
  if (isConnected && isAuthenticated && user) {
182
185
  // Mark that login just completed BEFORE opening manage account or closing modal
183
186
  // This allows Turnkey modal to show (if enableTurnkey is true)
184
- if (closeAfterLogin) {
187
+ // Use ref to prevent setting this multiple times and causing infinite loops
188
+ if (closeAfterLogin && !justCompletedLoginRef.current) {
189
+ justCompletedLoginRef.current = true;
185
190
  setJustCompletedLogin(true);
186
191
  }
187
192
  // Check if we should show Turnkey login form as SECONDARY option (after wallet connection)
@@ -225,6 +230,7 @@ function SignInWithB3Flow({ strategies, onLoginSuccess, onSessionKeySuccess, onE
225
230
  handlePostTurnkeyFlow();
226
231
  }
227
232
  },
233
+ // handlePostTurnkeyFlow changes when its dependencies change, causing infinite loops
228
234
  // eslint-disable-next-line react-hooks/exhaustive-deps
229
235
  [
230
236
  signers,
@@ -245,9 +251,9 @@ function SignInWithB3Flow({ strategies, onLoginSuccess, onSessionKeySuccess, onE
245
251
  user,
246
252
  enableTurnkey,
247
253
  turnkeyAuthCompleted,
248
- // handleTurnkeySuccess, // This is causing infinite loops
254
+ handleTurnkeySuccess,
249
255
  contentType,
250
- handlePostTurnkeyFlow,
256
+ // handlePostTurnkeyFlow - removed because it changes when signers/partnerId/etc change, triggering infinite loops
251
257
  ]);
252
258
  debug("render", {
253
259
  step,
@@ -262,9 +268,7 @@ function SignInWithB3Flow({ strategies, onLoginSuccess, onSessionKeySuccess, onE
262
268
  if (closeAfterLogin && sessionKeyAdded) {
263
269
  setB3ModalOpen(false);
264
270
  }
265
- // setB3ModalOpen is stable
266
- // eslint-disable-next-line react-hooks/exhaustive-deps
267
- }, [closeAfterLogin, sessionKeyAdded]);
271
+ }, [closeAfterLogin, sessionKeyAdded, setB3ModalOpen]);
268
272
  const onSessionKeySuccessEnhanced = (0, react_2.useCallback)(() => {
269
273
  onSessionKeySuccess?.();
270
274
  setB3ModalContentType({
@@ -7,7 +7,7 @@ const debug_1 = require("../../../../shared/utils/debug");
7
7
  const react_2 = require("react");
8
8
  const debug = (0, debug_1.debugB3React)("SignInWithB3Privy");
9
9
  function SignInWithB3Privy({ onSuccess, onError, chain }) {
10
- const { partnerId } = (0, react_1.useB3Config)();
10
+ const { partnerId } = (0, react_1.useB3)();
11
11
  const { isLoading, connectTw, fullToken } = (0, react_1.useHandleConnectWithPrivy)(chain, onSuccess);
12
12
  const setIsAuthenticating = (0, react_1.useAuthStore)(state => state.setIsAuthenticating);
13
13
  const setIsAuthenticated = (0, react_1.useAuthStore)(state => state.setIsAuthenticated);
@@ -19,7 +19,7 @@ function LoginStepContainer({ children, partnerId }) {
19
19
  return ((0, jsx_runtime_1.jsxs)("div", { className: "bg-b3-react-background flex flex-col items-center justify-center pt-6", children: [partnerLogo && ((0, jsx_runtime_1.jsx)("img", { src: partnerLogo, alt: "Partner Logo", className: "partner-logo mb-6 h-12 w-auto object-contain" })), children] }));
20
20
  }
21
21
  function LoginStep({ onSuccess, chain }) {
22
- const { partnerId, theme } = (0, react_1.useB3Config)();
22
+ const { partnerId, theme } = (0, react_1.useB3)();
23
23
  const wallet = (0, wallets_1.ecosystemWallet)(constants_1.ecosystemWalletId, {
24
24
  partnerId: partnerId,
25
25
  });
@@ -10,7 +10,7 @@ const react_3 = require("thirdweb/react");
10
10
  const wallets_1 = require("thirdweb/wallets");
11
11
  const debug = (0, debug_1.debugB3React)("LoginStepCustom");
12
12
  function LoginStepCustom({ onSuccess, onError, chain, strategies, maxInitialWallets = 2, automaticallySetFirstEoa, }) {
13
- const { partnerId } = (0, react_1.useB3Config)();
13
+ const { partnerId } = (0, react_1.useB3)();
14
14
  const [isLoading, setIsLoading] = (0, react_2.useState)(false);
15
15
  const [showAllWallets, setShowAllWallets] = (0, react_2.useState)(false);
16
16
  const { connect } = (0, react_1.useConnect)(partnerId, chain);
@@ -2,8 +2,8 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.StyleRoot = StyleRoot;
4
4
  const jsx_runtime_1 = require("react/jsx-runtime");
5
- const useB3Config_1 = require("./B3Provider/useB3Config");
5
+ const useB3_1 = require("./B3Provider/useB3");
6
6
  function StyleRoot({ children, id }) {
7
- const { theme } = (0, useB3Config_1.useB3Config)();
8
- return ((0, jsx_runtime_1.jsx)("div", { className: "b3-root", id: id, "data-theme": theme, children: children }));
7
+ const { theme: b3Theme } = (0, useB3_1.useB3)();
8
+ return ((0, jsx_runtime_1.jsx)("div", { className: "b3-root", id: id, "data-theme": b3Theme, children: children }));
9
9
  }
@@ -5,8 +5,9 @@ const jsx_runtime_1 = require("react/jsx-runtime");
5
5
  const react_1 = require("../../../../global-account/react");
6
6
  const utils_1 = require("../../../../shared/utils");
7
7
  function ManageAccountButton(props) {
8
+ const { partnerId } = (0, react_1.useB3)();
8
9
  const { setB3ModalOpen, setB3ModalContentType } = (0, react_1.useModalStore)();
9
- const { isConnected } = (0, react_1.useUser)();
10
+ const { isConnected } = (0, react_1.useAuthentication)(partnerId);
10
11
  const handleClickManageAccount = () => {
11
12
  setB3ModalContentType({
12
13
  ...props,
@@ -1,6 +1,7 @@
1
1
  export { B3DynamicModal } from "./B3DynamicModal";
2
- export { B3Provider } from "./B3Provider/B3Provider";
2
+ export { B3Provider, InnerProvider } from "./B3Provider/B3Provider";
3
3
  export { RelayKitProviderWrapper } from "./B3Provider/RelayKitProviderWrapper";
4
+ export { B3Context, type B3ContextType } from "./B3Provider/types";
4
5
  export { useB3 } from "./B3Provider/useB3";
5
6
  export { useB3Account } from "./B3Provider/useB3Account";
6
7
  export { useB3Config } from "./B3Provider/useB3Config";
@@ -3,17 +3,20 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.DialogDescription = exports.DialogContent = exports.DialogClose = exports.Dialog = exports.CommandShortcut = exports.CommandSeparator = exports.CommandList = exports.CommandItem = exports.CommandInput = exports.CommandGroup = exports.CommandEmpty = exports.CommandDialog = exports.Command = exports.buttonVariants = exports.Button = exports.badgeVariants = exports.Badge = exports.WalletConnectorIcon = exports.StaggeredFadeLoader = exports.CopyToClipboard = exports.ClientOnly = exports.customButtonVariants = exports.CustomButton = exports.SendERC20Button = exports.SendETHButton = exports.MintButton = exports.AccountAssets = exports.RequestPermissionsButton = exports.RequestPermissions = exports.IPFSMediaRenderer = exports.Send = exports.Deposit = exports.ManageAccount = exports.TurnkeyAuthModal = exports.isWalletType = exports.getConnectOptionsFromStrategy = exports.LoginStepContainer = exports.SignInWithB3Privy = exports.SignInWithB3Flow = exports.SignInWithB3 = exports.WalletRow = exports.PermissionItem = exports.AuthButton = exports.StyleRoot = exports.useB3Config = exports.useB3Account = exports.useB3 = exports.RelayKitProviderWrapper = exports.B3Provider = exports.B3DynamicModal = void 0;
7
- exports.toast = exports.AnimatedLottie = exports.TransitionPanel = exports.TooltipTrigger = exports.TooltipProvider = exports.TooltipContent = exports.Tooltip = exports.TextShimmer = exports.TextLoop = exports.TabTrigger = exports.TabsTransitionWrapper = exports.TabsList = exports.TabsContent = exports.Tabs = exports.TabTriggerPrimitive = exports.TabsPrimitive = exports.TabsListPrimitive = exports.TabsContentPrimitive = exports.Skeleton = exports.ShinyButton = exports.ScrollBar = exports.ScrollArea = exports.PopoverTrigger = exports.PopoverContent = exports.Popover = exports.Loading = exports.Input = exports.GlareCardRounded = exports.GlareCard = exports.DropdownMenuTrigger = exports.DropdownMenuSeparator = exports.DropdownMenuItem = exports.DropdownMenuContent = exports.DropdownMenu = exports.DrawerTrigger = exports.DrawerTitle = exports.DrawerPortal = exports.DrawerOverlay = exports.DrawerHeader = exports.DrawerFooter = exports.DrawerDescription = exports.DrawerContent = exports.DrawerClose = exports.Drawer = exports.DialogTrigger = exports.DialogTitle = exports.DialogPortal = exports.DialogOverlay = exports.DialogHeader = exports.DialogFooter = void 0;
8
- exports.WalletImage = exports.useToastContext = exports.ToastProvider = exports.ToastContainer = exports.Toast = void 0;
6
+ exports.DialogClose = exports.Dialog = exports.CommandShortcut = exports.CommandSeparator = exports.CommandList = exports.CommandItem = exports.CommandInput = exports.CommandGroup = exports.CommandEmpty = exports.CommandDialog = exports.Command = exports.buttonVariants = exports.Button = exports.badgeVariants = exports.Badge = exports.WalletConnectorIcon = exports.StaggeredFadeLoader = exports.CopyToClipboard = exports.ClientOnly = exports.customButtonVariants = exports.CustomButton = exports.SendERC20Button = exports.SendETHButton = exports.MintButton = exports.AccountAssets = exports.RequestPermissionsButton = exports.RequestPermissions = exports.IPFSMediaRenderer = exports.Send = exports.Deposit = exports.ManageAccount = exports.TurnkeyAuthModal = exports.isWalletType = exports.getConnectOptionsFromStrategy = exports.LoginStepContainer = exports.SignInWithB3Privy = exports.SignInWithB3Flow = exports.SignInWithB3 = exports.WalletRow = exports.PermissionItem = exports.AuthButton = exports.StyleRoot = exports.useB3Config = exports.useB3Account = exports.useB3 = exports.B3Context = exports.RelayKitProviderWrapper = exports.InnerProvider = exports.B3Provider = exports.B3DynamicModal = void 0;
7
+ exports.TransitionPanel = exports.TooltipTrigger = exports.TooltipProvider = exports.TooltipContent = exports.Tooltip = exports.TextShimmer = exports.TextLoop = exports.TabTrigger = exports.TabsTransitionWrapper = exports.TabsList = exports.TabsContent = exports.Tabs = exports.TabTriggerPrimitive = exports.TabsPrimitive = exports.TabsListPrimitive = exports.TabsContentPrimitive = exports.Skeleton = exports.ShinyButton = exports.ScrollBar = exports.ScrollArea = exports.PopoverTrigger = exports.PopoverContent = exports.Popover = exports.Loading = exports.Input = exports.GlareCardRounded = exports.GlareCard = exports.DropdownMenuTrigger = exports.DropdownMenuSeparator = exports.DropdownMenuItem = exports.DropdownMenuContent = exports.DropdownMenu = exports.DrawerTrigger = exports.DrawerTitle = exports.DrawerPortal = exports.DrawerOverlay = exports.DrawerHeader = exports.DrawerFooter = exports.DrawerDescription = exports.DrawerContent = exports.DrawerClose = exports.Drawer = exports.DialogTrigger = exports.DialogTitle = exports.DialogPortal = exports.DialogOverlay = exports.DialogHeader = exports.DialogFooter = exports.DialogDescription = exports.DialogContent = void 0;
8
+ exports.WalletImage = exports.useToastContext = exports.ToastProvider = exports.ToastContainer = exports.Toast = exports.toast = exports.AnimatedLottie = void 0;
9
9
  // TODO woj: Barrel file for all components, this might be reason of bundle size issues
10
10
  // Core Components
11
11
  var B3DynamicModal_1 = require("./B3DynamicModal");
12
12
  Object.defineProperty(exports, "B3DynamicModal", { enumerable: true, get: function () { return B3DynamicModal_1.B3DynamicModal; } });
13
13
  var B3Provider_1 = require("./B3Provider/B3Provider");
14
14
  Object.defineProperty(exports, "B3Provider", { enumerable: true, get: function () { return B3Provider_1.B3Provider; } });
15
+ Object.defineProperty(exports, "InnerProvider", { enumerable: true, get: function () { return B3Provider_1.InnerProvider; } });
15
16
  var RelayKitProviderWrapper_1 = require("./B3Provider/RelayKitProviderWrapper");
16
17
  Object.defineProperty(exports, "RelayKitProviderWrapper", { enumerable: true, get: function () { return RelayKitProviderWrapper_1.RelayKitProviderWrapper; } });
18
+ var types_1 = require("./B3Provider/types");
19
+ Object.defineProperty(exports, "B3Context", { enumerable: true, get: function () { return types_1.B3Context; } });
17
20
  var useB3_1 = require("./B3Provider/useB3");
18
21
  Object.defineProperty(exports, "useB3", { enumerable: true, get: function () { return useB3_1.useB3; } });
19
22
  var useB3Account_1 = require("./B3Provider/useB3Account");
@@ -43,4 +43,3 @@ export { useTokensFromAddress } from "./useTokensFromAddress";
43
43
  export { useTurnkeyAuth } from "./useTurnkeyAuth";
44
44
  export { useUnifiedChainSwitchAndExecute } from "./useUnifiedChainSwitchAndExecute";
45
45
  export { useURLParams } from "./useURLParams";
46
- export { useUser } from "./useUser";
@@ -14,7 +14,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
- exports.useUser = exports.useURLParams = exports.useUnifiedChainSwitchAndExecute = exports.useTurnkeyAuth = exports.useTokensFromAddress = exports.useTokenPriceWithFallback = exports.useTokenPrice = exports.useTokenFromUrl = exports.useTokenData = exports.useTokenBalancesByChain = exports.useTokenBalanceDirect = exports.useTokenBalance = exports.useSiwe = exports.useSimSvmBalance = exports.useSimBalance = exports.useSearchParamsSSR = exports.useRouter = exports.useRemoveSessionKey = exports.useQueryBSMNT = exports.useQueryB3 = exports.useProfileSettings = exports.useProfilePreference = exports.useProfile = exports.useDisplayName = exports.useOneBalance = exports.useNotifications = exports.useNativeBalanceFromRPC = exports.useNativeBalance = exports.useMediaQuery = exports.useIsomorphicLayoutEffect = exports.useIsMobile = exports.useHasMounted = exports.useHandleConnectWithPrivy = exports.useGlobalAccount = exports.useGetGeo = exports.useGetAllTWSigners = exports.useFirstEOA = exports.useExchangeRate = exports.useConnect = exports.useClient = exports.useChainSwitchWithAction = exports.useB3EnsName = exports.useB3BalanceFromAddresses = exports.useAuthentication = exports.useAuth = exports.useAnalytics = exports.useAddTWSessionKey = exports.useAccountWallet = exports.useAccountAssets = exports.createWagmiConfig = void 0;
17
+ exports.useURLParams = exports.useUnifiedChainSwitchAndExecute = exports.useTurnkeyAuth = exports.useTokensFromAddress = exports.useTokenPriceWithFallback = exports.useTokenPrice = exports.useTokenFromUrl = exports.useTokenData = exports.useTokenBalancesByChain = exports.useTokenBalanceDirect = exports.useTokenBalance = exports.useSiwe = exports.useSimSvmBalance = exports.useSimBalance = exports.useSearchParamsSSR = exports.useRouter = exports.useRemoveSessionKey = exports.useQueryBSMNT = exports.useQueryB3 = exports.useProfileSettings = exports.useProfilePreference = exports.useProfile = exports.useDisplayName = exports.useOneBalance = exports.useNotifications = exports.useNativeBalanceFromRPC = exports.useNativeBalance = exports.useMediaQuery = exports.useIsomorphicLayoutEffect = exports.useIsMobile = exports.useHasMounted = exports.useHandleConnectWithPrivy = exports.useGlobalAccount = exports.useGetGeo = exports.useGetAllTWSigners = exports.useFirstEOA = exports.useExchangeRate = exports.useConnect = exports.useClient = exports.useChainSwitchWithAction = exports.useB3EnsName = exports.useB3BalanceFromAddresses = exports.useAuthentication = exports.useAuth = exports.useAnalytics = exports.useAddTWSessionKey = exports.useAccountWallet = exports.useAccountAssets = exports.createWagmiConfig = void 0;
18
18
  var createWagmiConfig_1 = require("../utils/createWagmiConfig");
19
19
  Object.defineProperty(exports, "createWagmiConfig", { enumerable: true, get: function () { return createWagmiConfig_1.createWagmiConfig; } });
20
20
  var useAccountAssets_1 = require("./useAccountAssets");
@@ -109,5 +109,3 @@ var useUnifiedChainSwitchAndExecute_1 = require("./useUnifiedChainSwitchAndExecu
109
109
  Object.defineProperty(exports, "useUnifiedChainSwitchAndExecute", { enumerable: true, get: function () { return useUnifiedChainSwitchAndExecute_1.useUnifiedChainSwitchAndExecute; } });
110
110
  var useURLParams_1 = require("./useURLParams");
111
111
  Object.defineProperty(exports, "useURLParams", { enumerable: true, get: function () { return useURLParams_1.useURLParams; } });
112
- var useUser_1 = require("./useUser");
113
- Object.defineProperty(exports, "useUser", { enumerable: true, get: function () { return useUser_1.useUser; } });
@@ -17,6 +17,7 @@ const wallets_1 = require("thirdweb/wallets");
17
17
  const in_app_1 = require("thirdweb/wallets/in-app");
18
18
  const wagmi_1 = require("wagmi");
19
19
  const LocalSDKProvider_1 = require("../components/B3Provider/LocalSDKProvider");
20
+ const useB3_1 = require("../components/B3Provider/useB3");
20
21
  const createWagmiConfig_1 = require("../utils/createWagmiConfig");
21
22
  const useSearchParamsSSR_1 = require("./useSearchParamsSSR");
22
23
  const useUserQuery_1 = require("./useUserQuery");
@@ -44,7 +45,7 @@ function useAuth() {
44
45
  const hasStartedConnecting = (0, react_1.useAuthStore)(state => state.hasStartedConnecting);
45
46
  const useAutoConnectLoadingPrevious = (0, react_2.useRef)(false);
46
47
  const referralCode = (0, useSearchParamsSSR_1.useSearchParam)("referralCode");
47
- const { partnerId } = (0, react_1.useB3Config)();
48
+ const { partnerId } = (0, useB3_1.useB3)();
48
49
  const wagmiConfig = (0, createWagmiConfig_1.createWagmiConfig)({ partnerId });
49
50
  const { connect } = (0, wagmi_1.useConnect)();
50
51
  const activeWagmiAccount = (0, wagmi_1.useAccount)();
@@ -8,7 +8,7 @@ const client_manager_1 = require("../../client-manager");
8
8
  * Hook to access the current FeathersJS client and client management utilities
9
9
  */
10
10
  function useClient() {
11
- const { clientType } = (0, react_1.useB3Config)();
11
+ const { clientType } = (0, react_1.useB3)();
12
12
  const getCurrentClient = (0, react_2.useCallback)(() => {
13
13
  return (0, client_manager_1.getClient)();
14
14
  }, []);
@@ -11,7 +11,7 @@ const debug = (0, debug_1.debugB3React)("@@b3:useHandleConnectWithPrivy");
11
11
  * Currently, this is for the basement-privy strategy
12
12
  */
13
13
  function useHandleConnectWithPrivy(chain, onSuccess) {
14
- const { partnerId } = (0, react_1.useB3Config)();
14
+ const { partnerId } = (0, react_1.useB3)();
15
15
  if (!chain) {
16
16
  throw new Error("Chain is required");
17
17
  }