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

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 +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/RelayKitProviderWrapper.js +1 -3
  36. package/dist/cjs/global-account/react/components/B3Provider/types.d.ts +27 -0
  37. package/dist/cjs/global-account/react/components/B3Provider/types.js +24 -0
  38. package/dist/cjs/global-account/react/components/B3Provider/useB3.d.ts +4 -14
  39. package/dist/cjs/global-account/react/components/B3Provider/useB3.js +11 -4
  40. package/dist/cjs/global-account/react/components/B3Provider/useB3Account.js +2 -5
  41. package/dist/cjs/global-account/react/components/B3Provider/useB3Config.d.ts +2 -10
  42. package/dist/cjs/global-account/react/components/B3Provider/useB3Config.js +17 -18
  43. package/dist/cjs/global-account/react/components/ManageAccount/ProfileSection.js +2 -1
  44. package/dist/cjs/global-account/react/components/ManageAccount/channels/DiscordChannel.js +6 -6
  45. package/dist/cjs/global-account/react/components/ManageAccount/channels/EmailChannel.js +7 -7
  46. package/dist/cjs/global-account/react/components/ManageAccount/channels/PhoneChannel.js +7 -7
  47. package/dist/cjs/global-account/react/components/ManageAccount/channels/TelegramChannel.js +5 -5
  48. package/dist/cjs/global-account/react/components/RequestPermissions/RequestPermissions.js +9 -8
  49. package/dist/cjs/global-account/react/components/SignInWithB3/SignIn.js +1 -1
  50. package/dist/cjs/global-account/react/components/SignInWithB3/SignInWithB3Flow.js +20 -76
  51. package/dist/cjs/global-account/react/components/SignInWithB3/SignInWithB3Privy.js +1 -1
  52. package/dist/cjs/global-account/react/components/SignInWithB3/steps/LoginStep.js +1 -1
  53. package/dist/cjs/global-account/react/components/SignInWithB3/steps/LoginStepCustom.js +1 -1
  54. package/dist/cjs/global-account/react/components/StyleRoot.js +3 -3
  55. package/dist/cjs/global-account/react/components/TurnkeyAuthModal.js +1 -3
  56. package/dist/cjs/global-account/react/components/custom/ManageAccountButton.js +2 -1
  57. package/dist/cjs/global-account/react/components/index.d.ts +2 -1
  58. package/dist/cjs/global-account/react/components/index.js +6 -3
  59. package/dist/cjs/global-account/react/hooks/index.d.ts +0 -2
  60. package/dist/cjs/global-account/react/hooks/index.js +1 -5
  61. package/dist/cjs/global-account/react/hooks/useClient.js +1 -1
  62. package/dist/cjs/global-account/react/hooks/useHandleConnectWithPrivy.js +1 -1
  63. package/dist/cjs/global-account/react/hooks/useNotifications.js +14 -14
  64. package/dist/cjs/global-account/react/hooks/useTWAuth.d.ts +0 -3
  65. package/dist/cjs/global-account/react/hooks/useTWAuth.js +0 -8
  66. package/dist/cjs/global-account/react/hooks/useTokenBalance.js +5 -5
  67. package/dist/cjs/global-account/react/hooks/useTokenBalancesByChain.js +2 -4
  68. package/dist/cjs/global-account/react/hooks/useTurnkeyAuth.js +22 -50
  69. package/dist/cjs/global-account/react/hooks/useUserQuery.js +35 -9
  70. package/dist/cjs/global-account/react/index.native.d.ts +2 -0
  71. package/dist/cjs/global-account/react/index.native.js +5 -1
  72. package/dist/cjs/global-account/react/stores/index.d.ts +0 -1
  73. package/dist/cjs/global-account/react/stores/index.js +1 -3
  74. package/dist/cjs/global-account/react/stores/useModalStore.d.ts +0 -10
  75. package/dist/esm/anyspend/constants/index.d.ts +0 -2
  76. package/dist/esm/anyspend/constants/index.js +0 -2
  77. package/dist/esm/anyspend/index.d.ts +0 -2
  78. package/dist/esm/anyspend/index.js +0 -3
  79. package/dist/esm/anyspend/react/components/AnySpend.d.ts +0 -6
  80. package/dist/esm/anyspend/react/components/AnySpend.js +8 -11
  81. package/dist/esm/anyspend/react/components/AnySpendCollectorClubPurchase.d.ts +1 -5
  82. package/dist/esm/anyspend/react/components/AnySpendCollectorClubPurchase.js +2 -2
  83. package/dist/esm/anyspend/react/components/AnySpendCustom.d.ts +0 -1
  84. package/dist/esm/anyspend/react/components/AnySpendCustom.js +3 -3
  85. package/dist/esm/anyspend/react/components/AnySpendCustomExactIn.d.ts +0 -6
  86. package/dist/esm/anyspend/react/components/AnySpendCustomExactIn.js +4 -8
  87. package/dist/esm/anyspend/react/components/AnySpendDeposit.d.ts +1 -7
  88. package/dist/esm/anyspend/react/components/AnySpendDeposit.js +3 -3
  89. package/dist/esm/anyspend/react/components/AnyspendDepositHype.d.ts +0 -4
  90. package/dist/esm/anyspend/react/components/common/CryptoPaymentMethod.js +1 -14
  91. package/dist/esm/anyspend/react/components/common/CryptoReceiveSection.d.ts +1 -3
  92. package/dist/esm/anyspend/react/components/common/CryptoReceiveSection.js +2 -3
  93. package/dist/esm/anyspend/react/components/common/OrderDetails.d.ts +0 -4
  94. package/dist/esm/anyspend/react/components/common/OrderDetails.js +8 -36
  95. package/dist/esm/anyspend/react/components/common/PanelOnramp.d.ts +1 -3
  96. package/dist/esm/anyspend/react/components/common/PanelOnramp.js +2 -3
  97. package/dist/esm/anyspend/react/components/common/PaymentStripeWeb2.js +4 -3
  98. package/dist/esm/anyspend/react/hooks/index.d.ts +0 -1
  99. package/dist/esm/anyspend/react/hooks/index.js +0 -1
  100. package/dist/esm/anyspend/react/hooks/useAnyspendCreateOnrampOrder.js +2 -2
  101. package/dist/esm/anyspend/react/hooks/useAnyspendCreateOrder.js +2 -2
  102. package/dist/esm/anyspend/react/hooks/useCreateDepositFirstOrder.js +2 -2
  103. package/dist/esm/anyspend/react/hooks/useValidatedClientReferenceId.js +2 -2
  104. package/dist/esm/global-account/react/components/B3DynamicModal.js +4 -3
  105. package/dist/esm/global-account/react/components/B3Provider/B3Provider.d.ts +18 -2
  106. package/dist/esm/global-account/react/components/B3Provider/B3Provider.js +58 -34
  107. package/dist/esm/global-account/react/components/B3Provider/B3Provider.native.d.ts +5 -5
  108. package/dist/esm/global-account/react/components/B3Provider/B3Provider.native.js +36 -36
  109. package/dist/esm/global-account/react/components/B3Provider/RelayKitProviderWrapper.js +1 -3
  110. package/dist/esm/global-account/react/components/B3Provider/types.d.ts +27 -0
  111. package/dist/esm/global-account/react/components/B3Provider/types.js +21 -0
  112. package/dist/esm/global-account/react/components/B3Provider/useB3.d.ts +4 -14
  113. package/dist/esm/global-account/react/components/B3Provider/useB3.js +11 -4
  114. package/dist/esm/global-account/react/components/B3Provider/useB3Account.js +2 -5
  115. package/dist/esm/global-account/react/components/B3Provider/useB3Config.d.ts +2 -10
  116. package/dist/esm/global-account/react/components/B3Provider/useB3Config.js +17 -18
  117. package/dist/esm/global-account/react/components/ManageAccount/ProfileSection.js +3 -2
  118. package/dist/esm/global-account/react/components/ManageAccount/channels/DiscordChannel.js +2 -2
  119. package/dist/esm/global-account/react/components/ManageAccount/channels/EmailChannel.js +2 -2
  120. package/dist/esm/global-account/react/components/ManageAccount/channels/PhoneChannel.js +2 -2
  121. package/dist/esm/global-account/react/components/ManageAccount/channels/TelegramChannel.js +2 -2
  122. package/dist/esm/global-account/react/components/RequestPermissions/RequestPermissions.js +3 -2
  123. package/dist/esm/global-account/react/components/SignInWithB3/SignIn.js +2 -2
  124. package/dist/esm/global-account/react/components/SignInWithB3/SignInWithB3Flow.js +20 -76
  125. package/dist/esm/global-account/react/components/SignInWithB3/SignInWithB3Privy.js +2 -2
  126. package/dist/esm/global-account/react/components/SignInWithB3/steps/LoginStep.js +2 -2
  127. package/dist/esm/global-account/react/components/SignInWithB3/steps/LoginStepCustom.js +2 -2
  128. package/dist/esm/global-account/react/components/StyleRoot.js +3 -3
  129. package/dist/esm/global-account/react/components/TurnkeyAuthModal.js +3 -5
  130. package/dist/esm/global-account/react/components/custom/ManageAccountButton.js +3 -2
  131. package/dist/esm/global-account/react/components/index.d.ts +2 -1
  132. package/dist/esm/global-account/react/components/index.js +2 -1
  133. package/dist/esm/global-account/react/hooks/index.d.ts +0 -2
  134. package/dist/esm/global-account/react/hooks/index.js +0 -2
  135. package/dist/esm/global-account/react/hooks/useClient.js +2 -2
  136. package/dist/esm/global-account/react/hooks/useHandleConnectWithPrivy.js +2 -2
  137. package/dist/esm/global-account/react/hooks/useNotifications.js +2 -2
  138. package/dist/esm/global-account/react/hooks/useTWAuth.d.ts +0 -3
  139. package/dist/esm/global-account/react/hooks/useTWAuth.js +0 -8
  140. package/dist/esm/global-account/react/hooks/useTokenBalance.js +6 -6
  141. package/dist/esm/global-account/react/hooks/useTokenBalancesByChain.js +2 -4
  142. package/dist/esm/global-account/react/hooks/useTurnkeyAuth.js +22 -50
  143. package/dist/esm/global-account/react/hooks/useUserQuery.js +27 -1
  144. package/dist/esm/global-account/react/index.native.d.ts +2 -0
  145. package/dist/esm/global-account/react/index.native.js +2 -0
  146. package/dist/esm/global-account/react/stores/index.d.ts +0 -1
  147. package/dist/esm/global-account/react/stores/index.js +0 -1
  148. package/dist/esm/global-account/react/stores/useModalStore.d.ts +0 -10
  149. package/dist/styles/index.css +1 -1
  150. package/dist/types/anyspend/constants/index.d.ts +0 -2
  151. package/dist/types/anyspend/index.d.ts +0 -2
  152. package/dist/types/anyspend/react/components/AnySpend.d.ts +0 -6
  153. package/dist/types/anyspend/react/components/AnySpendCollectorClubPurchase.d.ts +1 -5
  154. package/dist/types/anyspend/react/components/AnySpendCustom.d.ts +0 -1
  155. package/dist/types/anyspend/react/components/AnySpendCustomExactIn.d.ts +0 -6
  156. package/dist/types/anyspend/react/components/AnySpendDeposit.d.ts +1 -7
  157. package/dist/types/anyspend/react/components/AnyspendDepositHype.d.ts +0 -4
  158. package/dist/types/anyspend/react/components/common/CryptoReceiveSection.d.ts +1 -3
  159. package/dist/types/anyspend/react/components/common/OrderDetails.d.ts +0 -4
  160. package/dist/types/anyspend/react/components/common/PanelOnramp.d.ts +1 -3
  161. package/dist/types/anyspend/react/hooks/index.d.ts +0 -1
  162. package/dist/types/global-account/react/components/B3Provider/B3Provider.d.ts +18 -2
  163. package/dist/types/global-account/react/components/B3Provider/B3Provider.native.d.ts +5 -5
  164. package/dist/types/global-account/react/components/B3Provider/types.d.ts +27 -0
  165. package/dist/types/global-account/react/components/B3Provider/useB3.d.ts +4 -14
  166. package/dist/types/global-account/react/components/B3Provider/useB3Config.d.ts +2 -10
  167. package/dist/types/global-account/react/components/index.d.ts +2 -1
  168. package/dist/types/global-account/react/hooks/index.d.ts +0 -2
  169. package/dist/types/global-account/react/hooks/useTWAuth.d.ts +0 -3
  170. package/dist/types/global-account/react/index.native.d.ts +2 -0
  171. package/dist/types/global-account/react/stores/index.d.ts +0 -1
  172. package/dist/types/global-account/react/stores/useModalStore.d.ts +0 -10
  173. package/package.json +1 -1
  174. package/src/anyspend/constants/index.ts +0 -3
  175. package/src/anyspend/index.ts +0 -4
  176. package/src/anyspend/react/components/AnySpend.tsx +2 -28
  177. package/src/anyspend/react/components/AnySpendCollectorClubPurchase.tsx +0 -6
  178. package/src/anyspend/react/components/AnySpendCustom.tsx +47 -52
  179. package/src/anyspend/react/components/AnySpendCustomExactIn.tsx +0 -23
  180. package/src/anyspend/react/components/AnySpendDeposit.tsx +1 -18
  181. package/src/anyspend/react/components/AnyspendDepositHype.tsx +0 -4
  182. package/src/anyspend/react/components/common/CryptoPaymentMethod.tsx +1 -15
  183. package/src/anyspend/react/components/common/CryptoReceiveSection.tsx +1 -5
  184. package/src/anyspend/react/components/common/OrderDetails.tsx +42 -60
  185. package/src/anyspend/react/components/common/PanelOnramp.tsx +1 -5
  186. package/src/anyspend/react/components/common/PaymentStripeWeb2.tsx +4 -3
  187. package/src/anyspend/react/hooks/index.ts +0 -1
  188. package/src/anyspend/react/hooks/useAnyspendCreateOnrampOrder.ts +2 -2
  189. package/src/anyspend/react/hooks/useAnyspendCreateOrder.ts +2 -2
  190. package/src/anyspend/react/hooks/useCreateDepositFirstOrder.ts +2 -2
  191. package/src/anyspend/react/hooks/useValidatedClientReferenceId.ts +2 -2
  192. package/src/global-account/react/components/B3DynamicModal.tsx +4 -3
  193. package/src/global-account/react/components/B3Provider/B3Provider.native.tsx +54 -43
  194. package/src/global-account/react/components/B3Provider/B3Provider.tsx +117 -44
  195. package/src/global-account/react/components/B3Provider/RelayKitProviderWrapper.tsx +1 -4
  196. package/src/global-account/react/components/B3Provider/types.ts +50 -0
  197. package/src/global-account/react/components/B3Provider/useB3.ts +13 -4
  198. package/src/global-account/react/components/B3Provider/useB3Account.ts +2 -6
  199. package/src/global-account/react/components/B3Provider/useB3Config.ts +31 -18
  200. package/src/global-account/react/components/ManageAccount/ProfileSection.tsx +4 -2
  201. package/src/global-account/react/components/ManageAccount/channels/DiscordChannel.tsx +2 -2
  202. package/src/global-account/react/components/ManageAccount/channels/EmailChannel.tsx +2 -2
  203. package/src/global-account/react/components/ManageAccount/channels/PhoneChannel.tsx +2 -2
  204. package/src/global-account/react/components/ManageAccount/channels/TelegramChannel.tsx +2 -2
  205. package/src/global-account/react/components/RequestPermissions/RequestPermissions.tsx +4 -4
  206. package/src/global-account/react/components/SignInWithB3/SignIn.tsx +2 -2
  207. package/src/global-account/react/components/SignInWithB3/SignInWithB3Flow.tsx +100 -168
  208. package/src/global-account/react/components/SignInWithB3/SignInWithB3Privy.tsx +2 -2
  209. package/src/global-account/react/components/SignInWithB3/steps/LoginStep.tsx +2 -2
  210. package/src/global-account/react/components/SignInWithB3/steps/LoginStepCustom.tsx +2 -2
  211. package/src/global-account/react/components/StyleRoot.tsx +3 -3
  212. package/src/global-account/react/components/TurnkeyAuthModal.tsx +4 -7
  213. package/src/global-account/react/components/custom/ManageAccountButton.tsx +3 -2
  214. package/src/global-account/react/components/index.ts +2 -1
  215. package/src/global-account/react/hooks/index.ts +0 -2
  216. package/src/global-account/react/hooks/useClient.ts +2 -2
  217. package/src/global-account/react/hooks/useHandleConnectWithPrivy.tsx +2 -2
  218. package/src/global-account/react/hooks/useNotifications.ts +2 -2
  219. package/src/global-account/react/hooks/useTWAuth.tsx +0 -10
  220. package/src/global-account/react/hooks/useTokenBalance.tsx +7 -8
  221. package/src/global-account/react/hooks/useTokenBalancesByChain.tsx +2 -4
  222. package/src/global-account/react/hooks/useTurnkeyAuth.ts +23 -54
  223. package/src/global-account/react/hooks/useUserQuery.ts +40 -1
  224. package/src/global-account/react/index.native.ts +2 -0
  225. package/src/global-account/react/stores/index.ts +0 -1
  226. package/src/global-account/react/stores/useModalStore.ts +0 -10
  227. package/dist/cjs/anyspend/react/components/common/GasIndicator.d.ts +0 -6
  228. package/dist/cjs/anyspend/react/components/common/GasIndicator.js +0 -34
  229. package/dist/cjs/anyspend/react/hooks/useGasPrice.d.ts +0 -37
  230. package/dist/cjs/anyspend/react/hooks/useGasPrice.js +0 -43
  231. package/dist/cjs/anyspend/services/gas.d.ts +0 -21
  232. package/dist/cjs/anyspend/services/gas.js +0 -65
  233. package/dist/cjs/anyspend/types/gas.d.ts +0 -61
  234. package/dist/cjs/anyspend/types/gas.js +0 -2
  235. package/dist/cjs/global-account/react/components/B3Provider/AuthenticationProvider.d.ts +0 -5
  236. package/dist/cjs/global-account/react/components/B3Provider/AuthenticationProvider.js +0 -12
  237. package/dist/cjs/global-account/react/hooks/useAuth.d.ts +0 -76
  238. package/dist/cjs/global-account/react/hooks/useAuth.js +0 -337
  239. package/dist/cjs/global-account/react/hooks/useUser.d.ts +0 -60
  240. package/dist/cjs/global-account/react/hooks/useUser.js +0 -20
  241. package/dist/cjs/global-account/react/stores/configStore.d.ts +0 -24
  242. package/dist/cjs/global-account/react/stores/configStore.js +0 -30
  243. package/dist/cjs/global-account/react/stores/userStore.d.ts +0 -22
  244. package/dist/cjs/global-account/react/stores/userStore.js +0 -30
  245. package/dist/esm/anyspend/react/components/common/GasIndicator.d.ts +0 -6
  246. package/dist/esm/anyspend/react/components/common/GasIndicator.js +0 -31
  247. package/dist/esm/anyspend/react/hooks/useGasPrice.d.ts +0 -37
  248. package/dist/esm/anyspend/react/hooks/useGasPrice.js +0 -40
  249. package/dist/esm/anyspend/services/gas.d.ts +0 -21
  250. package/dist/esm/anyspend/services/gas.js +0 -59
  251. package/dist/esm/anyspend/types/gas.d.ts +0 -61
  252. package/dist/esm/anyspend/types/gas.js +0 -1
  253. package/dist/esm/global-account/react/components/B3Provider/AuthenticationProvider.d.ts +0 -5
  254. package/dist/esm/global-account/react/components/B3Provider/AuthenticationProvider.js +0 -10
  255. package/dist/esm/global-account/react/hooks/useAuth.d.ts +0 -76
  256. package/dist/esm/global-account/react/hooks/useAuth.js +0 -331
  257. package/dist/esm/global-account/react/hooks/useUser.d.ts +0 -60
  258. package/dist/esm/global-account/react/hooks/useUser.js +0 -17
  259. package/dist/esm/global-account/react/stores/configStore.d.ts +0 -24
  260. package/dist/esm/global-account/react/stores/configStore.js +0 -27
  261. package/dist/esm/global-account/react/stores/userStore.d.ts +0 -22
  262. package/dist/esm/global-account/react/stores/userStore.js +0 -27
  263. package/dist/types/anyspend/react/components/common/GasIndicator.d.ts +0 -6
  264. package/dist/types/anyspend/react/hooks/useGasPrice.d.ts +0 -37
  265. package/dist/types/anyspend/services/gas.d.ts +0 -21
  266. package/dist/types/anyspend/types/gas.d.ts +0 -61
  267. package/dist/types/global-account/react/components/B3Provider/AuthenticationProvider.d.ts +0 -5
  268. package/dist/types/global-account/react/hooks/useAuth.d.ts +0 -76
  269. package/dist/types/global-account/react/hooks/useUser.d.ts +0 -60
  270. package/dist/types/global-account/react/stores/configStore.d.ts +0 -24
  271. package/dist/types/global-account/react/stores/userStore.d.ts +0 -22
  272. package/src/anyspend/react/components/common/GasIndicator.tsx +0 -59
  273. package/src/anyspend/react/hooks/useGasPrice.ts +0 -70
  274. package/src/anyspend/services/gas.test.ts +0 -31
  275. package/src/anyspend/services/gas.ts +0 -73
  276. package/src/anyspend/types/gas.ts +0 -66
  277. package/src/global-account/react/components/B3Provider/AuthenticationProvider.tsx +0 -19
  278. package/src/global-account/react/hooks/useAuth.ts +0 -379
  279. package/src/global-account/react/hooks/useUser.ts +0 -20
  280. package/src/global-account/react/stores/configStore.ts +0 -51
  281. 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)();
@@ -6,7 +6,6 @@ const react_1 = require("../../../../global-account/react");
6
6
  const debug_1 = require("../../../../shared/utils/debug");
7
7
  const react_2 = require("react");
8
8
  const react_3 = require("thirdweb/react");
9
- const TurnkeyAuthModal_1 = require("../TurnkeyAuthModal");
10
9
  const SignInWithB3Privy_1 = require("./SignInWithB3Privy");
11
10
  const LoginStep_1 = require("./steps/LoginStep");
12
11
  const LoginStepCustom_1 = require("./steps/LoginStepCustom");
@@ -25,9 +24,7 @@ function SignInWithB3Flow({ strategies, onLoginSuccess, onSessionKeySuccess, onE
25
24
  const account = (0, react_3.useActiveAccount)();
26
25
  const isAuthenticating = (0, react_1.useAuthStore)(state => state.isAuthenticating);
27
26
  const isAuthenticated = (0, react_1.useAuthStore)(state => state.isAuthenticated);
28
- const setIsAuthenticated = (0, react_1.useAuthStore)(state => state.setIsAuthenticated);
29
27
  const isConnected = (0, react_1.useAuthStore)(state => state.isConnected);
30
- const setIsConnected = (0, react_1.useAuthStore)(state => state.setIsConnected);
31
28
  const setJustCompletedLogin = (0, react_1.useAuthStore)(state => state.setJustCompletedLogin);
32
29
  const [refetchCount, setRefetchCount] = (0, react_2.useState)(0);
33
30
  const [refetchError, setRefetchError] = (0, react_2.useState)(null);
@@ -60,9 +57,7 @@ function SignInWithB3Flow({ strategies, onLoginSuccess, onSessionKeySuccess, onE
60
57
  refetchSigners();
61
58
  setRefetchQueued(false);
62
59
  }, backoffDelay);
63
- // State setters are stable and don't need to be in dependencies
64
- // eslint-disable-next-line react-hooks/exhaustive-deps
65
- }, [refetchCount, refetchSigners, onError, refetchQueued]);
60
+ }, [refetchCount, refetchSigners, onError, setRefetchQueued, refetchQueued]);
66
61
  // Extract the completion flow logic to be reused
67
62
  const handlePostTurnkeyFlow = (0, react_2.useCallback)(() => {
68
63
  debug("Running post-Turnkey flow logic");
@@ -131,10 +126,6 @@ function SignInWithB3Flow({ strategies, onLoginSuccess, onSessionKeySuccess, onE
131
126
  debug("Refetching user after Turnkey success...");
132
127
  await refetchUser();
133
128
  debug("User refetched successfully");
134
- // Set authentication and connection state so UI updates properly
135
- setIsAuthenticated(true);
136
- setIsConnected(true);
137
- setJustCompletedLogin(true);
138
129
  // After user data is refreshed, close Turnkey modal and go back to sign-in flow
139
130
  debug("Switching back to signInWithB3 modal");
140
131
  setB3ModalContentType({
@@ -153,6 +144,7 @@ function SignInWithB3Flow({ strategies, onLoginSuccess, onSessionKeySuccess, onE
153
144
  // The useEffect will re-run with updated user data to complete the sign-in process
154
145
  }, [
155
146
  refetchUser,
147
+ setB3ModalContentType,
156
148
  strategies,
157
149
  onLoginSuccess,
158
150
  onSessionKeySuccess,
@@ -163,10 +155,6 @@ function SignInWithB3Flow({ strategies, onLoginSuccess, onSessionKeySuccess, onE
163
155
  closeAfterLogin,
164
156
  source,
165
157
  signersEnabled,
166
- setB3ModalContentType,
167
- setIsAuthenticated,
168
- setIsConnected,
169
- setJustCompletedLogin,
170
158
  ]);
171
159
  // Handle post-login flow after signers are loaded
172
160
  (0, react_2.useEffect)(() => {
@@ -184,20 +172,15 @@ function SignInWithB3Flow({ strategies, onLoginSuccess, onSessionKeySuccess, onE
184
172
  if (closeAfterLogin) {
185
173
  setJustCompletedLogin(true);
186
174
  }
187
- // Check if we should show Turnkey login form as SECONDARY option (after wallet connection)
188
- // This only applies when:
189
- // - enableTurnkey={true} is set on B3Provider
190
- // - NEXT_PUBLIC_TURNKEY_PRIMARY is NOT set to true (otherwise Turnkey shows as primary)
191
- // - User just logged in AND hasn't completed Turnkey auth in this session
175
+ // Check if we should show Turnkey login form
176
+ // Show if enableTurnkey is true AND user just logged in AND hasn't completed Turnkey auth in this session
192
177
  // For new users (!turnkeyId): Show email form
193
178
  // For returning users (turnkeyId && turnkeyEmail): Auto-skip to OTP
194
179
  // Also check that we're not already showing the Turnkey modal
195
180
  const hasTurnkeyId = user?.partnerIds?.turnkeyId;
196
181
  const hasTurnkeyEmail = !!user?.email;
197
182
  const isTurnkeyModalCurrentlyOpen = contentType?.type === "turnkeyAuth";
198
- const isTurnkeyPrimary = process.env.NEXT_PUBLIC_TURNKEY_PRIMARY === "true";
199
183
  const shouldShowTurnkeyModal = enableTurnkey &&
200
- !isTurnkeyPrimary &&
201
184
  user &&
202
185
  !turnkeyAuthCompleted &&
203
186
  !isTurnkeyModalCurrentlyOpen &&
@@ -224,9 +207,7 @@ function SignInWithB3Flow({ strategies, onLoginSuccess, onSessionKeySuccess, onE
224
207
  // Normal flow continues after Turnkey auth is complete (or if not needed)
225
208
  handlePostTurnkeyFlow();
226
209
  }
227
- },
228
- // eslint-disable-next-line react-hooks/exhaustive-deps
229
- [
210
+ }, [
230
211
  signers,
231
212
  isFetchingSigners,
232
213
  partnerId,
@@ -242,10 +223,11 @@ function SignInWithB3Flow({ strategies, onLoginSuccess, onSessionKeySuccess, onE
242
223
  isAuthenticating,
243
224
  isAuthenticated,
244
225
  isOpen,
226
+ setJustCompletedLogin,
245
227
  user,
246
228
  enableTurnkey,
247
229
  turnkeyAuthCompleted,
248
- // handleTurnkeySuccess, // This is causing infinite loops
230
+ handleTurnkeySuccess,
249
231
  contentType,
250
232
  handlePostTurnkeyFlow,
251
233
  ]);
@@ -262,9 +244,7 @@ function SignInWithB3Flow({ strategies, onLoginSuccess, onSessionKeySuccess, onE
262
244
  if (closeAfterLogin && sessionKeyAdded) {
263
245
  setB3ModalOpen(false);
264
246
  }
265
- // setB3ModalOpen is stable
266
- // eslint-disable-next-line react-hooks/exhaustive-deps
267
- }, [closeAfterLogin, sessionKeyAdded]);
247
+ }, [closeAfterLogin, sessionKeyAdded, setB3ModalOpen]);
268
248
  const onSessionKeySuccessEnhanced = (0, react_2.useCallback)(() => {
269
249
  onSessionKeySuccess?.();
270
250
  setB3ModalContentType({
@@ -310,57 +290,21 @@ function SignInWithB3Flow({ strategies, onLoginSuccess, onSessionKeySuccess, onE
310
290
  if (refetchError) {
311
291
  content = ((0, jsx_runtime_1.jsx)(LoginStep_1.LoginStepContainer, { partnerId: partnerId, children: (0, jsx_runtime_1.jsx)("div", { className: "p-4 text-center text-red-500", children: refetchError }) }));
312
292
  }
293
+ else if (isAuthenticating || (isFetchingSigners && step === "login") || source === "requestPermissions") {
294
+ content = ((0, jsx_runtime_1.jsx)(LoginStep_1.LoginStepContainer, { partnerId: partnerId, children: (0, jsx_runtime_1.jsx)("div", { className: "my-8 flex min-h-[350px] items-center justify-center", children: (0, jsx_runtime_1.jsx)(react_1.Loading, { variant: "white", size: "lg" }) }) }));
295
+ }
313
296
  else if (step === "login") {
314
- // PRIORITY: If NEXT_PUBLIC_TURNKEY_PRIMARY is true, show Turnkey modal FIRST as the primary authentication option
315
- // Setting NEXT_PUBLIC_TURNKEY_PRIMARY="true" implicitly enables Turnkey
316
- const isTurnkeyPrimary = process.env.NEXT_PUBLIC_TURNKEY_PRIMARY === "true";
317
- const shouldShowTurnkeyFirst = isTurnkeyPrimary && !turnkeyAuthCompleted;
318
- if (shouldShowTurnkeyFirst) {
319
- // Don't show loading spinner for Turnkey - let the modal handle its own loading state
320
- // This prevents the infinite loop where isAuthenticating causes the modal to be replaced
321
- debug("Showing Turnkey as primary authentication option", {
322
- isTurnkeyPrimary,
323
- turnkeyAuthCompleted,
324
- isAuthenticated,
325
- });
326
- // Show Turnkey authentication as primary option
327
- content = ((0, jsx_runtime_1.jsx)(LoginStep_1.LoginStepContainer, { partnerId: partnerId, children: (0, jsx_runtime_1.jsx)(TurnkeyAuthModal_1.TurnkeyAuthModal, { onSuccess: async (authenticatedUser) => {
328
- debug("Turnkey authentication successful in primary flow", { authenticatedUser });
329
- setTurnkeyAuthCompleted(true);
330
- // After Turnkey auth, refetch user to get the full user object
331
- await refetchUser();
332
- // User is now authenticated via Turnkey
333
- // Set both isAuthenticated and isConnected to true so UI updates properly
334
- // Wallet connection is optional and can happen later for signing transactions
335
- setIsAuthenticated(true);
336
- setIsConnected(true);
337
- setJustCompletedLogin(true);
338
- // Call the login success callback
339
- onLoginSuccess?.({});
340
- }, onClose: () => {
341
- // If user closes Turnkey modal, they can still use wallet connection as fallback
342
- setTurnkeyAuthCompleted(true);
343
- }, initialEmail: "", skipToOtp: false }) }));
297
+ // Custom strategy
298
+ if (strategies?.[0] === "privy") {
299
+ content = (0, jsx_runtime_1.jsx)(SignInWithB3Privy_1.SignInWithB3Privy, { onSuccess: handleLoginSuccess, chain: chain });
300
+ }
301
+ else if (strategies) {
302
+ // Strategies are explicitly provided
303
+ content = ((0, jsx_runtime_1.jsx)(LoginStepCustom_1.LoginStepCustom, { strategies: strategies, chain: chain, onSuccess: handleLoginSuccess, onError: onError, automaticallySetFirstEoa: !!automaticallySetFirstEoa }));
344
304
  }
345
305
  else {
346
- // Show loading spinner only if not in Turnkey flow
347
- if (isAuthenticating || (isFetchingSigners && step === "login") || source === "requestPermissions") {
348
- content = ((0, jsx_runtime_1.jsx)(LoginStep_1.LoginStepContainer, { partnerId: partnerId, children: (0, jsx_runtime_1.jsx)("div", { className: "my-8 flex min-h-[350px] items-center justify-center", children: (0, jsx_runtime_1.jsx)(react_1.Loading, { variant: "white", size: "lg" }) }) }));
349
- }
350
- else {
351
- // Custom strategy
352
- if (strategies?.[0] === "privy") {
353
- content = (0, jsx_runtime_1.jsx)(SignInWithB3Privy_1.SignInWithB3Privy, { onSuccess: handleLoginSuccess, chain: chain });
354
- }
355
- else if (strategies) {
356
- // Strategies are explicitly provided
357
- content = ((0, jsx_runtime_1.jsx)(LoginStepCustom_1.LoginStepCustom, { strategies: strategies, chain: chain, onSuccess: handleLoginSuccess, onError: onError, automaticallySetFirstEoa: !!automaticallySetFirstEoa }));
358
- }
359
- else {
360
- // Default to handle all strategies we support
361
- content = (0, jsx_runtime_1.jsx)(LoginStep_1.LoginStep, { chain: chain, onSuccess: handleLoginSuccess, onError: onError });
362
- }
363
- }
306
+ // Default to handle all strategies we support
307
+ content = (0, jsx_runtime_1.jsx)(LoginStep_1.LoginStep, { chain: chain, onSuccess: handleLoginSuccess, onError: onError });
364
308
  }
365
309
  }
366
310
  return content;
@@ -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
  }
@@ -80,7 +80,5 @@ function TurnkeyAuthModal({ onClose, onSuccess, initialEmail = "", skipToOtp = f
80
80
  console.error("Failed to resend OTP:", err);
81
81
  }
82
82
  };
83
- const isTurnkeyPrimary = process.env.NEXT_PUBLIC_TURNKEY_PRIMARY === "true";
84
- const walletBrand = isTurnkeyPrimary ? "Smart Wallet" : "AnySpend Wallet";
85
- return ((0, jsx_runtime_1.jsxs)("div", { className: "font-neue-montreal p-8", children: [step === "email" && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsxs)("h2", { className: "mb-6 text-center text-2xl font-bold text-gray-900 dark:text-white", children: ["Setup your ", walletBrand] }), (0, jsx_runtime_1.jsxs)("div", { className: "mb-6 space-y-3 text-center text-sm text-gray-600 dark:text-gray-400", children: [(0, jsx_runtime_1.jsxs)("p", { children: [isTurnkeyPrimary ? "We use a secure," : "AnySpend uses a secure,", (0, jsx_runtime_1.jsx)("br", {}), "embedded wallet to fund your workflows."] }), (0, jsx_runtime_1.jsxs)("p", { children: ["Please provide an email address to secure", (0, jsx_runtime_1.jsx)("br", {}), "your wallet."] })] }), (0, jsx_runtime_1.jsxs)("form", { onSubmit: handleEmailSubmit, className: "space-y-4", children: [(0, jsx_runtime_1.jsx)("div", { children: (0, jsx_runtime_1.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 && ((0, jsx_runtime_1.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 })), (0, jsx_runtime_1.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 ? ((0, jsx_runtime_1.jsxs)("span", { className: "flex items-center justify-center gap-2", children: [(0, jsx_runtime_1.jsx)("div", { className: "h-4 w-4 animate-spin rounded-full border-2 border-white border-t-transparent" }), "Sending..."] })) : ("Continue") })] })] })), step === "otp" && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("h2", { className: "mb-4 text-center text-2xl font-bold text-gray-900 dark:text-white", children: "2FA Security" }), (0, jsx_runtime_1.jsx)("div", { className: "mb-6 space-y-3 text-center text-sm text-gray-600 dark:text-gray-400", children: (0, jsx_runtime_1.jsxs)("p", { children: [isTurnkeyPrimary ? "We use a secure," : "AnySpend uses a secure,", (0, jsx_runtime_1.jsx)("br", {}), "embedded wallet to fund your workflows.", (0, jsx_runtime_1.jsx)("br", {}), "Please provide 2FA code sent to your email."] }) }), (0, jsx_runtime_1.jsxs)("form", { onSubmit: handleOtpSubmit, className: "space-y-4", children: [(0, jsx_runtime_1.jsx)("div", { children: (0, jsx_runtime_1.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 && ((0, jsx_runtime_1.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 })), (0, jsx_runtime_1.jsxs)("div", { className: "flex flex-col gap-2", children: [(0, jsx_runtime_1.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 ? ((0, jsx_runtime_1.jsxs)("span", { className: "flex items-center justify-center gap-2", children: [(0, jsx_runtime_1.jsx)("div", { className: "h-4 w-4 animate-spin rounded-full border-2 border-white border-t-transparent" }), "Verifying..."] })) : ("Confirm") }), (0, jsx_runtime_1.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" && ((0, jsx_runtime_1.jsxs)("div", { className: "text-center", children: [(0, jsx_runtime_1.jsx)("div", { className: "mb-6 flex items-center justify-center", children: (0, jsx_runtime_1.jsx)("div", { className: "flex h-16 w-16 items-center justify-center rounded-full bg-green-100 dark:bg-green-900/20", children: (0, jsx_runtime_1.jsx)("svg", { className: "h-8 w-8 text-green-600 dark:text-green-400", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: (0, jsx_runtime_1.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M5 13l4 4L19 7" }) }) }) }), (0, jsx_runtime_1.jsx)("h2", { className: "mb-2 text-2xl font-bold text-gray-900 dark:text-white", children: "Successfully Authenticated!" }), (0, jsx_runtime_1.jsx)("p", { className: "text-sm text-gray-600 dark:text-gray-400", children: "Redirecting..." })] }))] }));
83
+ return ((0, jsx_runtime_1.jsxs)("div", { className: "font-neue-montreal p-8", children: [step === "email" && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("h2", { className: "mb-6 text-center text-2xl font-bold text-gray-900 dark:text-white", children: "Setup your AnySpend Wallet" }), (0, jsx_runtime_1.jsxs)("div", { className: "mb-6 space-y-3 text-center text-sm text-gray-600 dark:text-gray-400", children: [(0, jsx_runtime_1.jsxs)("p", { children: ["AnySpend uses a secure,", (0, jsx_runtime_1.jsx)("br", {}), "embedded wallet to fund your workflows."] }), (0, jsx_runtime_1.jsxs)("p", { children: ["Please provide an email address to secure", (0, jsx_runtime_1.jsx)("br", {}), "your wallet."] })] }), (0, jsx_runtime_1.jsxs)("form", { onSubmit: handleEmailSubmit, className: "space-y-4", children: [(0, jsx_runtime_1.jsx)("div", { children: (0, jsx_runtime_1.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 && ((0, jsx_runtime_1.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 })), (0, jsx_runtime_1.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 ? ((0, jsx_runtime_1.jsxs)("span", { className: "flex items-center justify-center gap-2", children: [(0, jsx_runtime_1.jsx)("div", { className: "h-4 w-4 animate-spin rounded-full border-2 border-white border-t-transparent" }), "Sending..."] })) : ("Continue") })] })] })), step === "otp" && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("h2", { className: "mb-4 text-center text-2xl font-bold text-gray-900 dark:text-white", children: "2FA Security" }), (0, jsx_runtime_1.jsx)("div", { className: "mb-6 space-y-3 text-center text-sm text-gray-600 dark:text-gray-400", children: (0, jsx_runtime_1.jsxs)("p", { children: ["AnySpend uses a secure,", (0, jsx_runtime_1.jsx)("br", {}), "embedded wallet to fund your workflows.", (0, jsx_runtime_1.jsx)("br", {}), "Please provide 2FA code sent to your email."] }) }), (0, jsx_runtime_1.jsxs)("form", { onSubmit: handleOtpSubmit, className: "space-y-4", children: [(0, jsx_runtime_1.jsx)("div", { children: (0, jsx_runtime_1.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 && ((0, jsx_runtime_1.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 })), (0, jsx_runtime_1.jsxs)("div", { className: "flex flex-col gap-2", children: [(0, jsx_runtime_1.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 ? ((0, jsx_runtime_1.jsxs)("span", { className: "flex items-center justify-center gap-2", children: [(0, jsx_runtime_1.jsx)("div", { className: "h-4 w-4 animate-spin rounded-full border-2 border-white border-t-transparent" }), "Verifying..."] })) : ("Confirm") }), (0, jsx_runtime_1.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" && ((0, jsx_runtime_1.jsxs)("div", { className: "text-center", children: [(0, jsx_runtime_1.jsx)("div", { className: "mb-6 flex items-center justify-center", children: (0, jsx_runtime_1.jsx)("div", { className: "flex h-16 w-16 items-center justify-center rounded-full bg-green-100 dark:bg-green-900/20", children: (0, jsx_runtime_1.jsx)("svg", { className: "h-8 w-8 text-green-600 dark:text-green-400", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: (0, jsx_runtime_1.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M5 13l4 4L19 7" }) }) }) }), (0, jsx_runtime_1.jsx)("h2", { className: "mb-2 text-2xl font-bold text-gray-900 dark:text-white", children: "Successfully Authenticated!" }), (0, jsx_runtime_1.jsx)("p", { className: "text-sm text-gray-600 dark:text-gray-400", children: "Redirecting..." })] }))] }));
86
84
  }
@@ -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,