@b3dotfun/sdk 0.0.73 → 0.0.74-alpha.0

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 (461) hide show
  1. package/dist/cjs/anyspend/react/components/AnySpend.js +75 -50
  2. package/dist/cjs/anyspend/react/components/AnySpendBuySpin.js +9 -10
  3. package/dist/cjs/anyspend/react/components/AnySpendCustom.js +41 -41
  4. package/dist/cjs/anyspend/react/components/AnySpendCustomExactIn.d.ts +1 -0
  5. package/dist/cjs/anyspend/react/components/AnySpendCustomExactIn.js +17 -9
  6. package/dist/cjs/anyspend/react/components/AnySpendStakeB3.js +7 -8
  7. package/dist/cjs/anyspend/react/components/AnySpendStakeB3ExactIn.js +7 -8
  8. package/dist/cjs/anyspend/react/components/AnyspendDepositHype.d.ts +2 -1
  9. package/dist/cjs/anyspend/react/components/AnyspendDepositHype.js +2 -2
  10. package/dist/cjs/anyspend/react/components/common/CryptoPaymentMethod.d.ts +0 -6
  11. package/dist/cjs/anyspend/react/components/common/CryptoPaymentMethod.js +18 -14
  12. package/dist/cjs/anyspend/react/components/common/FeeDetailPanel.js +1 -1
  13. package/dist/cjs/anyspend/react/components/common/FiatPaymentMethod.js +2 -2
  14. package/dist/cjs/anyspend/react/components/common/InsufficientDepositPayment.js +6 -6
  15. package/dist/cjs/anyspend/react/components/common/OrderDetails.js +35 -35
  16. package/dist/cjs/anyspend/react/components/common/OrderDetailsCollapsible.js +1 -2
  17. package/dist/cjs/anyspend/react/components/common/OrderHistory.d.ts +1 -1
  18. package/dist/cjs/anyspend/react/components/common/OrderHistory.js +7 -3
  19. package/dist/cjs/anyspend/react/components/common/OrderHistoryItem.js +1 -1
  20. package/dist/cjs/anyspend/react/components/common/PanelOnramp.js +4 -4
  21. package/dist/cjs/anyspend/react/components/common/PanelOnrampPayment.js +8 -9
  22. package/dist/cjs/anyspend/react/components/common/PointsDetailPanel.js +1 -1
  23. package/dist/cjs/anyspend/react/components/common/RecipientSelection.js +1 -1
  24. package/dist/cjs/anyspend/react/components/common/TransferCryptoDetails.js +2 -3
  25. package/dist/cjs/anyspend/react/components/webview/WebviewOnrampOrderStatus.js +1 -2
  26. package/dist/cjs/anyspend/react/components/webview/WebviewOnrampPayment.js +12 -12
  27. package/dist/cjs/anyspend/react/hooks/useAnyspendFlow.js +4 -5
  28. package/dist/cjs/anyspend/react/hooks/useConnectedWalletDisplay.js +3 -2
  29. package/dist/cjs/anyspend/react/hooks/usePhantomTransfer.js +17 -17
  30. package/dist/cjs/anyspend/react/utils/toast.d.ts +6 -0
  31. package/dist/cjs/anyspend/react/utils/toast.js +9 -0
  32. package/dist/cjs/global-account/react/components/AccountAssets/AccountAssets.js +38 -2
  33. package/dist/cjs/global-account/react/components/AvatarCreator/AvatarCreator.js +2 -3
  34. package/dist/cjs/global-account/react/components/AvatarEditor/AvatarEditor.d.ts +1 -0
  35. package/dist/cjs/global-account/react/components/AvatarEditor/AvatarEditor.js +275 -39
  36. package/dist/cjs/global-account/react/components/B3DynamicModal.js +40 -13
  37. package/dist/cjs/global-account/react/components/B3Provider/B3Provider.d.ts +1 -1
  38. package/dist/cjs/global-account/react/components/B3Provider/B3Provider.js +19 -3
  39. package/dist/cjs/global-account/react/components/Deposit/Deposit.d.ts +1 -0
  40. package/dist/cjs/global-account/react/components/Deposit/Deposit.js +61 -0
  41. package/dist/cjs/global-account/react/components/IPFSMediaRenderer/IPFSMediaRenderer.d.ts +39 -0
  42. package/dist/cjs/global-account/react/components/IPFSMediaRenderer/IPFSMediaRenderer.js +34 -0
  43. package/dist/cjs/global-account/react/components/LinkAccount/LinkAccount.d.ts +6 -4
  44. package/dist/cjs/global-account/react/components/LinkAccount/LinkAccount.js +104 -283
  45. package/dist/cjs/global-account/react/components/LinkAccount/LinkNewAccount.d.ts +4 -0
  46. package/dist/cjs/global-account/react/components/LinkAccount/LinkNewAccount.js +320 -0
  47. package/dist/cjs/global-account/react/components/LinkAccount/LinkedAccountItem.d.ts +16 -0
  48. package/dist/cjs/global-account/react/components/LinkAccount/LinkedAccountItem.js +44 -0
  49. package/dist/cjs/global-account/react/components/ManageAccount/BottomNavigation.d.ts +2 -0
  50. package/dist/cjs/global-account/react/components/ManageAccount/BottomNavigation.js +23 -0
  51. package/dist/cjs/global-account/react/components/ManageAccount/ContentTokens.js +1 -2
  52. package/dist/cjs/global-account/react/components/ManageAccount/Header.d.ts +3 -0
  53. package/dist/cjs/global-account/react/components/ManageAccount/Header.js +120 -0
  54. package/dist/cjs/global-account/react/components/ManageAccount/HomeActions.d.ts +5 -0
  55. package/dist/cjs/global-account/react/components/ManageAccount/HomeActions.js +43 -0
  56. package/dist/cjs/global-account/react/components/ManageAccount/HomeContent.d.ts +6 -0
  57. package/dist/cjs/global-account/react/components/ManageAccount/HomeContent.js +16 -0
  58. package/dist/cjs/global-account/react/components/ManageAccount/ManageAccount.js +16 -194
  59. package/dist/cjs/global-account/react/components/ManageAccount/NFTContent.d.ts +2 -0
  60. package/dist/cjs/global-account/react/components/ManageAccount/NFTContent.js +15 -0
  61. package/dist/cjs/global-account/react/components/ManageAccount/NotificationChannel.d.ts +16 -0
  62. package/dist/cjs/global-account/react/components/ManageAccount/NotificationChannel.js +13 -0
  63. package/dist/cjs/global-account/react/components/ManageAccount/NotificationsContent.d.ts +8 -0
  64. package/dist/cjs/global-account/react/components/ManageAccount/NotificationsContent.js +152 -0
  65. package/dist/cjs/global-account/react/components/ManageAccount/ProfileSection.d.ts +2 -0
  66. package/dist/cjs/global-account/react/components/ManageAccount/ProfileSection.js +47 -0
  67. package/dist/cjs/global-account/react/components/ManageAccount/SettingsContent.d.ts +7 -0
  68. package/dist/cjs/global-account/react/components/ManageAccount/SettingsContent.js +60 -0
  69. package/dist/cjs/global-account/react/components/ManageAccount/SettingsMenuItem.d.ts +9 -0
  70. package/dist/cjs/global-account/react/components/ManageAccount/SettingsMenuItem.js +8 -0
  71. package/dist/cjs/global-account/react/components/ManageAccount/SettingsProfileCard.d.ts +2 -0
  72. package/dist/cjs/global-account/react/components/ManageAccount/SettingsProfileCard.js +116 -0
  73. package/dist/cjs/global-account/react/components/ManageAccount/TokenBalanceRow.d.ts +3 -3
  74. package/dist/cjs/global-account/react/components/ManageAccount/TokenBalanceRow.js +2 -2
  75. package/dist/cjs/global-account/react/components/ManageAccount/TokenContent.d.ts +2 -0
  76. package/dist/cjs/global-account/react/components/ManageAccount/TokenContent.js +44 -0
  77. package/dist/cjs/global-account/react/components/ManageAccount/channels/DiscordChannel.d.ts +11 -0
  78. package/dist/cjs/global-account/react/components/ManageAccount/channels/DiscordChannel.js +48 -0
  79. package/dist/cjs/global-account/react/components/ManageAccount/channels/EmailChannel.d.ts +11 -0
  80. package/dist/cjs/global-account/react/components/ManageAccount/channels/EmailChannel.js +68 -0
  81. package/dist/cjs/global-account/react/components/ManageAccount/channels/PhoneChannel.d.ts +14 -0
  82. package/dist/cjs/global-account/react/components/ManageAccount/channels/PhoneChannel.js +79 -0
  83. package/dist/cjs/global-account/react/components/ManageAccount/channels/TelegramChannel.d.ts +11 -0
  84. package/dist/cjs/global-account/react/components/ManageAccount/channels/TelegramChannel.js +79 -0
  85. package/dist/cjs/global-account/react/components/ManageAccount/channels/index.d.ts +4 -0
  86. package/dist/cjs/global-account/react/components/ManageAccount/channels/index.js +11 -0
  87. package/dist/cjs/global-account/react/components/ModalHeader/ModalHeader.d.ts +11 -0
  88. package/dist/cjs/global-account/react/components/ModalHeader/ModalHeader.js +12 -0
  89. package/dist/cjs/global-account/react/components/Send/Send.d.ts +5 -0
  90. package/dist/cjs/global-account/react/components/Send/Send.js +195 -0
  91. package/dist/cjs/global-account/react/components/SignInWithB3/SignIn.js +5 -4
  92. package/dist/cjs/global-account/react/components/SignInWithB3/SignInWithB3Flow.js +1 -1
  93. package/dist/cjs/global-account/react/components/Toast/ToastComponents.d.ts +15 -0
  94. package/dist/cjs/global-account/react/components/Toast/ToastComponents.js +54 -0
  95. package/dist/cjs/global-account/react/components/Toast/ToastContext.d.ts +19 -0
  96. package/dist/cjs/global-account/react/components/Toast/ToastContext.js +59 -0
  97. package/dist/cjs/global-account/react/components/Toast/index.d.ts +4 -0
  98. package/dist/cjs/global-account/react/components/Toast/index.js +12 -0
  99. package/dist/cjs/global-account/react/components/Toast/toastApi.d.ts +21 -0
  100. package/dist/cjs/global-account/react/components/Toast/toastApi.js +93 -0
  101. package/dist/cjs/global-account/react/components/WalletImage/WalletImage.d.ts +4 -0
  102. package/dist/cjs/global-account/react/components/WalletImage/WalletImage.js +13 -0
  103. package/dist/cjs/global-account/react/components/icons/BellIcon.d.ts +3 -0
  104. package/dist/cjs/global-account/react/components/icons/BellIcon.js +5 -0
  105. package/dist/cjs/global-account/react/components/icons/ChevronDownIcon.d.ts +2 -0
  106. package/dist/cjs/global-account/react/components/icons/ChevronDownIcon.js +7 -0
  107. package/dist/cjs/global-account/react/components/icons/CopyIcon.d.ts +2 -0
  108. package/dist/cjs/global-account/react/components/icons/CopyIcon.js +7 -0
  109. package/dist/cjs/global-account/react/components/icons/LinkIcon.d.ts +3 -0
  110. package/dist/cjs/global-account/react/components/icons/LinkIcon.js +5 -0
  111. package/dist/cjs/global-account/react/components/icons/LockIcon.d.ts +3 -0
  112. package/dist/cjs/global-account/react/components/icons/LockIcon.js +5 -0
  113. package/dist/cjs/global-account/react/components/icons/WalletIcon.d.ts +2 -0
  114. package/dist/cjs/global-account/react/components/icons/WalletIcon.js +7 -0
  115. package/dist/cjs/global-account/react/components/index.d.ts +10 -4
  116. package/dist/cjs/global-account/react/components/index.js +29 -9
  117. package/dist/cjs/global-account/react/components/ui/Tabs.js +2 -2
  118. package/dist/cjs/global-account/react/components/ui/dialog.js +2 -2
  119. package/dist/cjs/global-account/react/components/ui/drawer.js +1 -1
  120. package/dist/cjs/global-account/react/hooks/index.d.ts +3 -2
  121. package/dist/cjs/global-account/react/hooks/index.js +7 -3
  122. package/dist/cjs/global-account/react/hooks/useAccountWallet.d.ts +1 -0
  123. package/dist/cjs/global-account/react/hooks/useAccountWallet.js +18 -0
  124. package/dist/cjs/global-account/react/hooks/useB3BalanceFromAddresses.js +1 -0
  125. package/dist/cjs/global-account/react/hooks/useChainSwitchWithAction.js +11 -11
  126. package/dist/cjs/global-account/react/hooks/useNativeBalance.js +2 -2
  127. package/dist/cjs/global-account/react/hooks/useNotifications.d.ts +48 -0
  128. package/dist/cjs/global-account/react/hooks/useNotifications.js +189 -0
  129. package/dist/cjs/global-account/react/hooks/useSimBalance.js +3 -3
  130. package/dist/cjs/global-account/react/hooks/useTokenBalanceDirect.d.ts +1 -0
  131. package/dist/cjs/global-account/react/hooks/useTokenBalanceDirect.js +1 -0
  132. package/dist/cjs/global-account/react/hooks/useUnifiedChainSwitchAndExecute.js +17 -17
  133. package/dist/cjs/global-account/react/stores/index.d.ts +1 -0
  134. package/dist/cjs/global-account/react/stores/index.js +3 -1
  135. package/dist/cjs/global-account/react/stores/useModalStore.d.ts +47 -6
  136. package/dist/cjs/global-account/react/stores/useRecentAddressesStore.d.ts +25 -0
  137. package/dist/cjs/global-account/react/stores/useRecentAddressesStore.js +36 -0
  138. package/dist/cjs/global-account/react/utils/index.d.ts +4 -0
  139. package/dist/cjs/global-account/react/utils/index.js +20 -0
  140. package/dist/cjs/global-account/react/utils/notificationsAPI.d.ts +80 -0
  141. package/dist/cjs/global-account/react/utils/notificationsAPI.js +257 -0
  142. package/dist/cjs/global-account/react/utils/profileDisplay.d.ts +3 -0
  143. package/dist/cjs/global-account/react/utils/profileDisplay.js +8 -4
  144. package/dist/cjs/global-account/react/utils/toast.d.ts +6 -0
  145. package/dist/cjs/global-account/react/utils/toast.js +9 -0
  146. package/dist/cjs/shared/constants/chains/supported.d.ts +3 -2
  147. package/dist/cjs/shared/constants/chains/supported.js +4 -0
  148. package/dist/cjs/shared/utils/ipfs.js +10 -3
  149. package/dist/esm/anyspend/react/components/AnySpend.js +67 -42
  150. package/dist/esm/anyspend/react/components/AnySpendBuySpin.js +1 -2
  151. package/dist/esm/anyspend/react/components/AnySpendCustom.js +10 -10
  152. package/dist/esm/anyspend/react/components/AnySpendCustomExactIn.d.ts +1 -0
  153. package/dist/esm/anyspend/react/components/AnySpendCustomExactIn.js +12 -4
  154. package/dist/esm/anyspend/react/components/AnySpendStakeB3.js +1 -2
  155. package/dist/esm/anyspend/react/components/AnySpendStakeB3ExactIn.js +1 -2
  156. package/dist/esm/anyspend/react/components/AnyspendDepositHype.d.ts +2 -1
  157. package/dist/esm/anyspend/react/components/AnyspendDepositHype.js +2 -2
  158. package/dist/esm/anyspend/react/components/common/CryptoPaymentMethod.d.ts +0 -6
  159. package/dist/esm/anyspend/react/components/common/CryptoPaymentMethod.js +9 -5
  160. package/dist/esm/anyspend/react/components/common/FeeDetailPanel.js +1 -1
  161. package/dist/esm/anyspend/react/components/common/FiatPaymentMethod.js +2 -2
  162. package/dist/esm/anyspend/react/components/common/InsufficientDepositPayment.js +1 -1
  163. package/dist/esm/anyspend/react/components/common/OrderDetails.js +2 -2
  164. package/dist/esm/anyspend/react/components/common/OrderDetailsCollapsible.js +1 -2
  165. package/dist/esm/anyspend/react/components/common/OrderHistory.d.ts +1 -1
  166. package/dist/esm/anyspend/react/components/common/OrderHistory.js +6 -5
  167. package/dist/esm/anyspend/react/components/common/OrderHistoryItem.js +2 -2
  168. package/dist/esm/anyspend/react/components/common/PanelOnramp.js +4 -4
  169. package/dist/esm/anyspend/react/components/common/PanelOnrampPayment.js +2 -3
  170. package/dist/esm/anyspend/react/components/common/PointsDetailPanel.js +1 -1
  171. package/dist/esm/anyspend/react/components/common/RecipientSelection.js +1 -1
  172. package/dist/esm/anyspend/react/components/common/TransferCryptoDetails.js +1 -2
  173. package/dist/esm/anyspend/react/components/webview/WebviewOnrampOrderStatus.js +1 -2
  174. package/dist/esm/anyspend/react/components/webview/WebviewOnrampPayment.js +1 -1
  175. package/dist/esm/anyspend/react/hooks/useAnyspendFlow.js +1 -2
  176. package/dist/esm/anyspend/react/hooks/useConnectedWalletDisplay.js +3 -2
  177. package/dist/esm/anyspend/react/hooks/usePhantomTransfer.js +1 -1
  178. package/dist/esm/anyspend/react/utils/toast.d.ts +6 -0
  179. package/dist/esm/anyspend/react/utils/toast.js +5 -0
  180. package/dist/esm/global-account/react/components/AccountAssets/AccountAssets.js +38 -2
  181. package/dist/esm/global-account/react/components/AvatarCreator/AvatarCreator.js +1 -2
  182. package/dist/esm/global-account/react/components/AvatarEditor/AvatarEditor.d.ts +1 -0
  183. package/dist/esm/global-account/react/components/AvatarEditor/AvatarEditor.js +276 -40
  184. package/dist/esm/global-account/react/components/B3DynamicModal.js +37 -13
  185. package/dist/esm/global-account/react/components/B3Provider/B3Provider.d.ts +1 -1
  186. package/dist/esm/global-account/react/components/B3Provider/B3Provider.js +19 -3
  187. package/dist/esm/global-account/react/components/Deposit/Deposit.d.ts +1 -0
  188. package/dist/esm/global-account/react/components/Deposit/Deposit.js +55 -0
  189. package/dist/esm/global-account/react/components/IPFSMediaRenderer/IPFSMediaRenderer.d.ts +39 -0
  190. package/dist/esm/global-account/react/components/IPFSMediaRenderer/IPFSMediaRenderer.js +31 -0
  191. package/dist/esm/global-account/react/components/LinkAccount/LinkAccount.d.ts +6 -4
  192. package/dist/esm/global-account/react/components/LinkAccount/LinkAccount.js +103 -283
  193. package/dist/esm/global-account/react/components/LinkAccount/LinkNewAccount.d.ts +4 -0
  194. package/dist/esm/global-account/react/components/LinkAccount/LinkNewAccount.js +314 -0
  195. package/dist/esm/global-account/react/components/LinkAccount/LinkedAccountItem.d.ts +16 -0
  196. package/dist/esm/global-account/react/components/LinkAccount/LinkedAccountItem.js +42 -0
  197. package/dist/esm/global-account/react/components/ManageAccount/BottomNavigation.d.ts +2 -0
  198. package/dist/esm/global-account/react/components/ManageAccount/BottomNavigation.js +21 -0
  199. package/dist/esm/global-account/react/components/ManageAccount/ContentTokens.js +1 -2
  200. package/dist/esm/global-account/react/components/ManageAccount/Header.d.ts +3 -0
  201. package/dist/esm/global-account/react/components/ManageAccount/Header.js +81 -0
  202. package/dist/esm/global-account/react/components/ManageAccount/HomeActions.d.ts +5 -0
  203. package/dist/esm/global-account/react/components/ManageAccount/HomeActions.js +41 -0
  204. package/dist/esm/global-account/react/components/ManageAccount/HomeContent.d.ts +6 -0
  205. package/dist/esm/global-account/react/components/ManageAccount/HomeContent.js +10 -0
  206. package/dist/esm/global-account/react/components/ManageAccount/ManageAccount.js +18 -196
  207. package/dist/esm/global-account/react/components/ManageAccount/NFTContent.d.ts +2 -0
  208. package/dist/esm/global-account/react/components/ManageAccount/NFTContent.js +13 -0
  209. package/dist/esm/global-account/react/components/ManageAccount/NotificationChannel.d.ts +16 -0
  210. package/dist/esm/global-account/react/components/ManageAccount/NotificationChannel.js +9 -0
  211. package/dist/esm/global-account/react/components/ManageAccount/NotificationsContent.d.ts +8 -0
  212. package/dist/esm/global-account/react/components/ManageAccount/NotificationsContent.js +147 -0
  213. package/dist/esm/global-account/react/components/ManageAccount/ProfileSection.d.ts +2 -0
  214. package/dist/esm/global-account/react/components/ManageAccount/ProfileSection.js +45 -0
  215. package/dist/esm/global-account/react/components/ManageAccount/SettingsContent.d.ts +7 -0
  216. package/dist/esm/global-account/react/components/ManageAccount/SettingsContent.js +55 -0
  217. package/dist/esm/global-account/react/components/ManageAccount/SettingsMenuItem.d.ts +9 -0
  218. package/dist/esm/global-account/react/components/ManageAccount/SettingsMenuItem.js +6 -0
  219. package/dist/esm/global-account/react/components/ManageAccount/SettingsProfileCard.d.ts +2 -0
  220. package/dist/esm/global-account/react/components/ManageAccount/SettingsProfileCard.js +111 -0
  221. package/dist/esm/global-account/react/components/ManageAccount/TokenBalanceRow.d.ts +3 -3
  222. package/dist/esm/global-account/react/components/ManageAccount/TokenBalanceRow.js +3 -3
  223. package/dist/esm/global-account/react/components/ManageAccount/TokenContent.d.ts +2 -0
  224. package/dist/esm/global-account/react/components/ManageAccount/TokenContent.js +42 -0
  225. package/dist/esm/global-account/react/components/ManageAccount/channels/DiscordChannel.d.ts +11 -0
  226. package/dist/esm/global-account/react/components/ManageAccount/channels/DiscordChannel.js +44 -0
  227. package/dist/esm/global-account/react/components/ManageAccount/channels/EmailChannel.d.ts +11 -0
  228. package/dist/esm/global-account/react/components/ManageAccount/channels/EmailChannel.js +64 -0
  229. package/dist/esm/global-account/react/components/ManageAccount/channels/PhoneChannel.d.ts +14 -0
  230. package/dist/esm/global-account/react/components/ManageAccount/channels/PhoneChannel.js +75 -0
  231. package/dist/esm/global-account/react/components/ManageAccount/channels/TelegramChannel.d.ts +11 -0
  232. package/dist/esm/global-account/react/components/ManageAccount/channels/TelegramChannel.js +75 -0
  233. package/dist/esm/global-account/react/components/ManageAccount/channels/index.d.ts +4 -0
  234. package/dist/esm/global-account/react/components/ManageAccount/channels/index.js +4 -0
  235. package/dist/esm/global-account/react/components/ModalHeader/ModalHeader.d.ts +11 -0
  236. package/dist/esm/global-account/react/components/ModalHeader/ModalHeader.js +10 -0
  237. package/dist/esm/global-account/react/components/Send/Send.d.ts +5 -0
  238. package/dist/esm/global-account/react/components/Send/Send.js +189 -0
  239. package/dist/esm/global-account/react/components/SignInWithB3/SignIn.js +7 -6
  240. package/dist/esm/global-account/react/components/SignInWithB3/SignInWithB3Flow.js +1 -1
  241. package/dist/esm/global-account/react/components/Toast/ToastComponents.d.ts +15 -0
  242. package/dist/esm/global-account/react/components/Toast/ToastComponents.js +50 -0
  243. package/dist/esm/global-account/react/components/Toast/ToastContext.d.ts +19 -0
  244. package/dist/esm/global-account/react/components/Toast/ToastContext.js +55 -0
  245. package/dist/esm/global-account/react/components/Toast/index.d.ts +4 -0
  246. package/dist/esm/global-account/react/components/Toast/index.js +3 -0
  247. package/dist/esm/global-account/react/components/Toast/toastApi.d.ts +21 -0
  248. package/dist/esm/global-account/react/components/Toast/toastApi.js +89 -0
  249. package/dist/esm/global-account/react/components/WalletImage/WalletImage.d.ts +4 -0
  250. package/dist/esm/global-account/react/components/WalletImage/WalletImage.js +11 -0
  251. package/dist/esm/global-account/react/components/icons/BellIcon.d.ts +3 -0
  252. package/dist/esm/global-account/react/components/icons/BellIcon.js +3 -0
  253. package/dist/esm/global-account/react/components/icons/ChevronDownIcon.d.ts +2 -0
  254. package/dist/esm/global-account/react/components/icons/ChevronDownIcon.js +4 -0
  255. package/dist/esm/global-account/react/components/icons/CopyIcon.d.ts +2 -0
  256. package/dist/esm/global-account/react/components/icons/CopyIcon.js +4 -0
  257. package/dist/esm/global-account/react/components/icons/LinkIcon.d.ts +3 -0
  258. package/dist/esm/global-account/react/components/icons/LinkIcon.js +3 -0
  259. package/dist/esm/global-account/react/components/icons/LockIcon.d.ts +3 -0
  260. package/dist/esm/global-account/react/components/icons/LockIcon.js +3 -0
  261. package/dist/esm/global-account/react/components/icons/WalletIcon.d.ts +2 -0
  262. package/dist/esm/global-account/react/components/icons/WalletIcon.js +4 -0
  263. package/dist/esm/global-account/react/components/index.d.ts +10 -4
  264. package/dist/esm/global-account/react/components/index.js +14 -5
  265. package/dist/esm/global-account/react/components/ui/Tabs.js +2 -2
  266. package/dist/esm/global-account/react/components/ui/dialog.js +2 -2
  267. package/dist/esm/global-account/react/components/ui/drawer.js +1 -1
  268. package/dist/esm/global-account/react/hooks/index.d.ts +3 -2
  269. package/dist/esm/global-account/react/hooks/index.js +3 -2
  270. package/dist/esm/global-account/react/hooks/useAccountWallet.d.ts +1 -0
  271. package/dist/esm/global-account/react/hooks/useAccountWallet.js +17 -0
  272. package/dist/esm/global-account/react/hooks/useB3BalanceFromAddresses.js +1 -0
  273. package/dist/esm/global-account/react/hooks/useChainSwitchWithAction.js +2 -2
  274. package/dist/esm/global-account/react/hooks/useNativeBalance.js +1 -1
  275. package/dist/esm/global-account/react/hooks/useNotifications.d.ts +48 -0
  276. package/dist/esm/global-account/react/hooks/useNotifications.js +186 -0
  277. package/dist/esm/global-account/react/hooks/useSimBalance.js +3 -3
  278. package/dist/esm/global-account/react/hooks/useTokenBalanceDirect.d.ts +1 -0
  279. package/dist/esm/global-account/react/hooks/useTokenBalanceDirect.js +1 -0
  280. package/dist/esm/global-account/react/hooks/useUnifiedChainSwitchAndExecute.js +2 -2
  281. package/dist/esm/global-account/react/stores/index.d.ts +1 -0
  282. package/dist/esm/global-account/react/stores/index.js +1 -0
  283. package/dist/esm/global-account/react/stores/useModalStore.d.ts +47 -6
  284. package/dist/esm/global-account/react/stores/useRecentAddressesStore.d.ts +25 -0
  285. package/dist/esm/global-account/react/stores/useRecentAddressesStore.js +33 -0
  286. package/dist/esm/global-account/react/utils/index.d.ts +4 -0
  287. package/dist/esm/global-account/react/utils/index.js +4 -0
  288. package/dist/esm/global-account/react/utils/notificationsAPI.d.ts +80 -0
  289. package/dist/esm/global-account/react/utils/notificationsAPI.js +254 -0
  290. package/dist/esm/global-account/react/utils/profileDisplay.d.ts +3 -0
  291. package/dist/esm/global-account/react/utils/profileDisplay.js +8 -4
  292. package/dist/esm/global-account/react/utils/toast.d.ts +6 -0
  293. package/dist/esm/global-account/react/utils/toast.js +5 -0
  294. package/dist/esm/shared/constants/chains/supported.d.ts +3 -2
  295. package/dist/esm/shared/constants/chains/supported.js +3 -0
  296. package/dist/esm/shared/utils/ipfs.js +10 -3
  297. package/dist/styles/index.css +1 -1
  298. package/dist/types/anyspend/react/components/AnySpendCustomExactIn.d.ts +1 -0
  299. package/dist/types/anyspend/react/components/AnyspendDepositHype.d.ts +2 -1
  300. package/dist/types/anyspend/react/components/common/CryptoPaymentMethod.d.ts +0 -6
  301. package/dist/types/anyspend/react/components/common/OrderHistory.d.ts +1 -1
  302. package/dist/types/anyspend/react/utils/toast.d.ts +6 -0
  303. package/dist/types/global-account/react/components/AvatarEditor/AvatarEditor.d.ts +1 -0
  304. package/dist/types/global-account/react/components/B3Provider/B3Provider.d.ts +1 -1
  305. package/dist/types/global-account/react/components/Deposit/Deposit.d.ts +1 -0
  306. package/dist/types/global-account/react/components/IPFSMediaRenderer/IPFSMediaRenderer.d.ts +39 -0
  307. package/dist/types/global-account/react/components/LinkAccount/LinkAccount.d.ts +6 -4
  308. package/dist/types/global-account/react/components/LinkAccount/LinkNewAccount.d.ts +4 -0
  309. package/dist/types/global-account/react/components/LinkAccount/LinkedAccountItem.d.ts +16 -0
  310. package/dist/types/global-account/react/components/ManageAccount/BottomNavigation.d.ts +2 -0
  311. package/dist/types/global-account/react/components/ManageAccount/Header.d.ts +3 -0
  312. package/dist/types/global-account/react/components/ManageAccount/HomeActions.d.ts +5 -0
  313. package/dist/types/global-account/react/components/ManageAccount/HomeContent.d.ts +6 -0
  314. package/dist/types/global-account/react/components/ManageAccount/NFTContent.d.ts +2 -0
  315. package/dist/types/global-account/react/components/ManageAccount/NotificationChannel.d.ts +16 -0
  316. package/dist/types/global-account/react/components/ManageAccount/NotificationsContent.d.ts +8 -0
  317. package/dist/types/global-account/react/components/ManageAccount/ProfileSection.d.ts +2 -0
  318. package/dist/types/global-account/react/components/ManageAccount/SettingsContent.d.ts +7 -0
  319. package/dist/types/global-account/react/components/ManageAccount/SettingsMenuItem.d.ts +9 -0
  320. package/dist/types/global-account/react/components/ManageAccount/SettingsProfileCard.d.ts +2 -0
  321. package/dist/types/global-account/react/components/ManageAccount/TokenBalanceRow.d.ts +3 -3
  322. package/dist/types/global-account/react/components/ManageAccount/TokenContent.d.ts +2 -0
  323. package/dist/types/global-account/react/components/ManageAccount/channels/DiscordChannel.d.ts +11 -0
  324. package/dist/types/global-account/react/components/ManageAccount/channels/EmailChannel.d.ts +11 -0
  325. package/dist/types/global-account/react/components/ManageAccount/channels/PhoneChannel.d.ts +14 -0
  326. package/dist/types/global-account/react/components/ManageAccount/channels/TelegramChannel.d.ts +11 -0
  327. package/dist/types/global-account/react/components/ManageAccount/channels/index.d.ts +4 -0
  328. package/dist/types/global-account/react/components/ModalHeader/ModalHeader.d.ts +11 -0
  329. package/dist/types/global-account/react/components/Send/Send.d.ts +5 -0
  330. package/dist/types/global-account/react/components/Toast/ToastComponents.d.ts +15 -0
  331. package/dist/types/global-account/react/components/Toast/ToastContext.d.ts +19 -0
  332. package/dist/types/global-account/react/components/Toast/index.d.ts +4 -0
  333. package/dist/types/global-account/react/components/Toast/toastApi.d.ts +21 -0
  334. package/dist/types/global-account/react/components/WalletImage/WalletImage.d.ts +4 -0
  335. package/dist/types/global-account/react/components/icons/BellIcon.d.ts +3 -0
  336. package/dist/types/global-account/react/components/icons/ChevronDownIcon.d.ts +2 -0
  337. package/dist/types/global-account/react/components/icons/CopyIcon.d.ts +2 -0
  338. package/dist/types/global-account/react/components/icons/LinkIcon.d.ts +3 -0
  339. package/dist/types/global-account/react/components/icons/LockIcon.d.ts +3 -0
  340. package/dist/types/global-account/react/components/icons/WalletIcon.d.ts +2 -0
  341. package/dist/types/global-account/react/components/index.d.ts +10 -4
  342. package/dist/types/global-account/react/hooks/index.d.ts +3 -2
  343. package/dist/types/global-account/react/hooks/useAccountWallet.d.ts +1 -0
  344. package/dist/types/global-account/react/hooks/useNotifications.d.ts +48 -0
  345. package/dist/types/global-account/react/hooks/useTokenBalanceDirect.d.ts +1 -0
  346. package/dist/types/global-account/react/stores/index.d.ts +1 -0
  347. package/dist/types/global-account/react/stores/useModalStore.d.ts +47 -6
  348. package/dist/types/global-account/react/stores/useRecentAddressesStore.d.ts +25 -0
  349. package/dist/types/global-account/react/utils/index.d.ts +4 -0
  350. package/dist/types/global-account/react/utils/notificationsAPI.d.ts +80 -0
  351. package/dist/types/global-account/react/utils/profileDisplay.d.ts +3 -0
  352. package/dist/types/global-account/react/utils/toast.d.ts +6 -0
  353. package/dist/types/shared/constants/chains/supported.d.ts +3 -2
  354. package/package.json +2 -1
  355. package/src/anyspend/react/components/AnySpend.tsx +213 -173
  356. package/src/anyspend/react/components/AnySpendBuySpin.tsx +2 -1
  357. package/src/anyspend/react/components/AnySpendCustom.tsx +80 -77
  358. package/src/anyspend/react/components/AnySpendCustomExactIn.tsx +20 -4
  359. package/src/anyspend/react/components/AnySpendStakeB3.tsx +2 -1
  360. package/src/anyspend/react/components/AnySpendStakeB3ExactIn.tsx +2 -1
  361. package/src/anyspend/react/components/AnyspendDepositHype.tsx +3 -0
  362. package/src/anyspend/react/components/common/CryptoPaymentMethod.tsx +56 -22
  363. package/src/anyspend/react/components/common/FeeDetailPanel.tsx +1 -1
  364. package/src/anyspend/react/components/common/FiatPaymentMethod.tsx +2 -2
  365. package/src/anyspend/react/components/common/InsufficientDepositPayment.tsx +1 -1
  366. package/src/anyspend/react/components/common/OrderDetails.tsx +6 -2
  367. package/src/anyspend/react/components/common/OrderDetailsCollapsible.tsx +2 -2
  368. package/src/anyspend/react/components/common/OrderHistory.tsx +8 -13
  369. package/src/anyspend/react/components/common/OrderHistoryItem.tsx +69 -25
  370. package/src/anyspend/react/components/common/PanelOnramp.tsx +6 -4
  371. package/src/anyspend/react/components/common/PanelOnrampPayment.tsx +3 -3
  372. package/src/anyspend/react/components/common/PointsDetailPanel.tsx +1 -1
  373. package/src/anyspend/react/components/common/RecipientSelection.tsx +1 -1
  374. package/src/anyspend/react/components/common/TransferCryptoDetails.tsx +2 -2
  375. package/src/anyspend/react/components/webview/WebviewOnrampOrderStatus.tsx +3 -3
  376. package/src/anyspend/react/components/webview/WebviewOnrampPayment.tsx +2 -1
  377. package/src/anyspend/react/hooks/useAnyspendFlow.ts +2 -1
  378. package/src/anyspend/react/hooks/useConnectedWalletDisplay.ts +3 -2
  379. package/src/anyspend/react/hooks/usePhantomTransfer.ts +1 -1
  380. package/src/anyspend/react/utils/toast.ts +6 -0
  381. package/src/global-account/react/components/AccountAssets/AccountAssets.tsx +115 -25
  382. package/src/global-account/react/components/AvatarCreator/AvatarCreator.tsx +2 -2
  383. package/src/global-account/react/components/AvatarEditor/AvatarEditor.tsx +491 -130
  384. package/src/global-account/react/components/B3DynamicModal.tsx +76 -17
  385. package/src/global-account/react/components/B3Provider/B3Provider.tsx +40 -20
  386. package/src/global-account/react/components/Deposit/Deposit.tsx +208 -0
  387. package/src/global-account/react/components/IPFSMediaRenderer/IPFSMediaRenderer.tsx +84 -0
  388. package/src/global-account/react/components/LinkAccount/LinkAccount.tsx +269 -434
  389. package/src/global-account/react/components/LinkAccount/LinkNewAccount.tsx +480 -0
  390. package/src/global-account/react/components/LinkAccount/LinkedAccountItem.tsx +135 -0
  391. package/src/global-account/react/components/ManageAccount/BottomNavigation.tsx +83 -0
  392. package/src/global-account/react/components/ManageAccount/ContentTokens.tsx +2 -1
  393. package/src/global-account/react/components/ManageAccount/Header.tsx +230 -0
  394. package/src/global-account/react/components/ManageAccount/HomeActions.tsx +118 -0
  395. package/src/global-account/react/components/ManageAccount/HomeContent.tsx +42 -0
  396. package/src/global-account/react/components/ManageAccount/ManageAccount.tsx +74 -597
  397. package/src/global-account/react/components/ManageAccount/NFTContent.tsx +24 -0
  398. package/src/global-account/react/components/ManageAccount/NotificationChannel.tsx +94 -0
  399. package/src/global-account/react/components/ManageAccount/NotificationsContent.tsx +268 -0
  400. package/src/global-account/react/components/ManageAccount/ProfileSection.tsx +79 -0
  401. package/src/global-account/react/components/ManageAccount/SettingsContent.tsx +106 -0
  402. package/src/global-account/react/components/ManageAccount/SettingsMenuItem.tsx +31 -0
  403. package/src/global-account/react/components/ManageAccount/SettingsProfileCard.tsx +197 -0
  404. package/src/global-account/react/components/ManageAccount/TokenBalanceRow.tsx +20 -5
  405. package/src/global-account/react/components/ManageAccount/TokenContent.tsx +66 -0
  406. package/src/global-account/react/components/ManageAccount/channels/DiscordChannel.tsx +119 -0
  407. package/src/global-account/react/components/ManageAccount/channels/EmailChannel.tsx +168 -0
  408. package/src/global-account/react/components/ManageAccount/channels/PhoneChannel.tsx +227 -0
  409. package/src/global-account/react/components/ManageAccount/channels/TelegramChannel.tsx +150 -0
  410. package/src/global-account/react/components/ManageAccount/channels/index.ts +4 -0
  411. package/src/global-account/react/components/ModalHeader/ModalHeader.tsx +61 -0
  412. package/src/global-account/react/components/Send/Send.tsx +621 -0
  413. package/src/global-account/react/components/SignInWithB3/SignIn.tsx +13 -12
  414. package/src/global-account/react/components/SignInWithB3/SignInWithB3Flow.tsx +1 -1
  415. package/src/global-account/react/components/Toast/README.md +350 -0
  416. package/src/global-account/react/components/Toast/ToastComponents.tsx +159 -0
  417. package/src/global-account/react/components/Toast/ToastContext.tsx +86 -0
  418. package/src/global-account/react/components/Toast/index.ts +4 -0
  419. package/src/global-account/react/components/Toast/toastApi.ts +98 -0
  420. package/src/global-account/react/components/WalletImage/WalletImage.tsx +12 -0
  421. package/src/global-account/react/components/icons/BellIcon.tsx +15 -0
  422. package/src/global-account/react/components/icons/ChevronDownIcon.tsx +17 -0
  423. package/src/global-account/react/components/icons/CopyIcon.tsx +22 -0
  424. package/src/global-account/react/components/icons/LinkIcon.tsx +15 -0
  425. package/src/global-account/react/components/icons/LockIcon.tsx +15 -0
  426. package/src/global-account/react/components/icons/WalletIcon.tsx +21 -0
  427. package/src/global-account/react/components/index.ts +19 -5
  428. package/src/global-account/react/components/ui/Tabs.tsx +5 -13
  429. package/src/global-account/react/components/ui/dialog.tsx +23 -14
  430. package/src/global-account/react/components/ui/drawer.tsx +1 -1
  431. package/src/global-account/react/hooks/index.ts +5 -1
  432. package/src/global-account/react/hooks/useAccountWallet.tsx +26 -0
  433. package/src/global-account/react/hooks/useB3BalanceFromAddresses.ts +1 -0
  434. package/src/global-account/react/hooks/useChainSwitchWithAction.ts +3 -2
  435. package/src/global-account/react/hooks/useNativeBalance.tsx +2 -1
  436. package/src/global-account/react/hooks/useNotifications.ts +229 -0
  437. package/src/global-account/react/hooks/useSimBalance.ts +3 -3
  438. package/src/global-account/react/hooks/useTokenBalanceDirect.tsx +2 -0
  439. package/src/global-account/react/hooks/useUnifiedChainSwitchAndExecute.ts +3 -2
  440. package/src/global-account/react/stores/index.ts +1 -0
  441. package/src/global-account/react/stores/useModalStore.ts +53 -6
  442. package/src/global-account/react/stores/useRecentAddressesStore.ts +54 -0
  443. package/src/global-account/react/utils/index.ts +4 -0
  444. package/src/global-account/react/utils/notificationsAPI.ts +305 -0
  445. package/src/global-account/react/utils/profileDisplay.ts +12 -4
  446. package/src/global-account/react/utils/toast.ts +6 -0
  447. package/src/shared/constants/chains/supported.ts +4 -0
  448. package/src/shared/utils/ipfs.ts +10 -3
  449. package/src/styles/index.css +12 -1
  450. package/dist/cjs/global-account/react/components/ManageAccount/BalanceContent.d.ts +0 -7
  451. package/dist/cjs/global-account/react/components/ManageAccount/BalanceContent.js +0 -107
  452. package/dist/cjs/global-account/react/components/ProfileEditor/ProfileEditor.d.ts +0 -6
  453. package/dist/cjs/global-account/react/components/ProfileEditor/ProfileEditor.js +0 -151
  454. package/dist/esm/global-account/react/components/ManageAccount/BalanceContent.d.ts +0 -7
  455. package/dist/esm/global-account/react/components/ManageAccount/BalanceContent.js +0 -104
  456. package/dist/esm/global-account/react/components/ProfileEditor/ProfileEditor.d.ts +0 -6
  457. package/dist/esm/global-account/react/components/ProfileEditor/ProfileEditor.js +0 -145
  458. package/dist/types/global-account/react/components/ManageAccount/BalanceContent.d.ts +0 -7
  459. package/dist/types/global-account/react/components/ProfileEditor/ProfileEditor.d.ts +0 -6
  460. package/src/global-account/react/components/ManageAccount/BalanceContent.tsx +0 -258
  461. package/src/global-account/react/components/ProfileEditor/ProfileEditor.tsx +0 -279
@@ -0,0 +1,79 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.TelegramChannel = void 0;
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const debug_1 = require("../../../../../shared/utils/debug");
6
+ const react_1 = require("react");
7
+ const notificationsAPI_1 = require("../../../utils/notificationsAPI");
8
+ const useB3_1 = require("../../B3Provider/useB3");
9
+ const toastApi_1 = require("../../Toast/toastApi");
10
+ const NotificationChannel_1 = require("../NotificationChannel");
11
+ const debug = (0, debug_1.debugB3React)("TelegramChannel");
12
+ const TelegramChannel = ({ userId, jwtToken, telegramChannel, isConnected, isOptimisticallyConnected, onConnectionChange, onToggle, }) => {
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
+ // Detect if we're disconnecting
17
+ const isDisconnecting = isConnected && !isOptimisticallyConnected;
18
+ const handleConnect = async () => {
19
+ if (!userId || !jwtToken)
20
+ return;
21
+ try {
22
+ setIsConnecting(true);
23
+ const { deepLink } = await notificationsAPI_1.notificationsAPI.getTelegramLink(jwtToken);
24
+ window.open(deepLink, "_blank");
25
+ setStatus("pending");
26
+ // Poll for connection using nested timeouts to avoid overlapping requests
27
+ const startTime = Date.now();
28
+ const maxDuration = 120000; // 2 minutes
29
+ let timeoutId = null;
30
+ const pollStatus = async () => {
31
+ try {
32
+ const { connected } = await notificationsAPI_1.notificationsAPI.checkTelegramStatus(userId, jwtToken);
33
+ if (connected) {
34
+ if (timeoutId)
35
+ clearTimeout(timeoutId);
36
+ setStatus("connected");
37
+ await notificationsAPI_1.notificationsAPI.ensureNotificationSettings(userId, partnerId, "general", jwtToken);
38
+ toastApi_1.toast.success("Telegram connected successfully!");
39
+ onConnectionChange();
40
+ return;
41
+ }
42
+ }
43
+ catch (err) {
44
+ debug("Error checking Telegram status:", err);
45
+ }
46
+ // Check if we've exceeded max duration
47
+ if (Date.now() - startTime < maxDuration) {
48
+ // Schedule next check after previous one completes
49
+ timeoutId = setTimeout(pollStatus, 2000);
50
+ }
51
+ else {
52
+ setStatus("idle");
53
+ }
54
+ };
55
+ // Start polling
56
+ timeoutId = setTimeout(pollStatus, 2000);
57
+ }
58
+ catch (err) {
59
+ debug("Error connecting Telegram:", err);
60
+ toastApi_1.toast.error("Failed to connect Telegram");
61
+ }
62
+ finally {
63
+ setIsConnecting(false);
64
+ }
65
+ };
66
+ const handleToggle = () => {
67
+ if (isConnected) {
68
+ setStatus("idle");
69
+ onToggle(true);
70
+ }
71
+ else {
72
+ handleConnect();
73
+ }
74
+ };
75
+ const icon = ((0, jsx_runtime_1.jsx)("svg", { width: "1000px", height: "1000px", viewBox: "0 0 1000 1000", version: "1.1", xmlns: "http://www.w3.org/2000/svg", children: (0, jsx_runtime_1.jsx)("g", { id: "Telegram", stroke: "none", "stroke-width": "1", fill: "none", "fill-rule": "evenodd", children: (0, jsx_runtime_1.jsx)("path", { d: "M226.328419,494.722069 C372.088573,431.216685 469.284839,389.350049 517.917216,369.122161 C656.772535,311.36743 685.625481,301.334815 704.431427,301.003532 C708.567621,300.93067 717.815839,301.955743 723.806446,306.816707 C728.864797,310.92121 730.256552,316.46581 730.922551,320.357329 C731.588551,324.248848 732.417879,333.113828 731.758626,340.040666 C724.234007,419.102486 691.675104,610.964674 675.110982,699.515267 C668.10208,736.984342 654.301336,749.547532 640.940618,750.777006 C611.904684,753.448938 589.856115,731.588035 561.733393,713.153237 C517.726886,684.306416 492.866009,666.349181 450.150074,638.200013 C400.78442,605.66878 432.786119,587.789048 460.919462,558.568563 C468.282091,550.921423 596.21508,434.556479 598.691227,424.000355 C599.00091,422.680135 599.288312,417.758981 596.36474,415.160431 C593.441168,412.561881 589.126229,413.450484 586.012448,414.157198 C581.598758,415.158943 511.297793,461.625274 375.109553,553.556189 C355.154858,567.258623 337.080515,573.934908 320.886524,573.585046 C303.033948,573.199351 268.692754,563.490928 243.163606,555.192408 C211.851067,545.013936 186.964484,539.632504 189.131547,522.346309 C190.260287,513.342589 202.659244,504.134509 226.328419,494.722069 Z", id: "Path-3", fill: "#FFFFFF" }) }) }));
76
+ const inputSection = status === "pending" ? ((0, jsx_runtime_1.jsxs)("div", { className: "mt-1", children: [(0, jsx_runtime_1.jsx)("p", { className: "font-['PP_Neue_Montreal','PP_Neue_Montreal_Fallback',sans-serif] text-[14px] leading-[20px] text-yellow-700", children: "Waiting for connection..." }), (0, jsx_runtime_1.jsx)("p", { className: "font-['PP_Neue_Montreal','PP_Neue_Montreal_Fallback',sans-serif] text-[12px] text-yellow-600", children: "Send /start to @b3_notifications_bot" })] })) : ((0, jsx_runtime_1.jsxs)("button", { onClick: handleConnect, disabled: isConnecting, className: "mt-1 flex items-center gap-1 disabled:opacity-50", children: [(0, jsx_runtime_1.jsx)("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", children: (0, jsx_runtime_1.jsx)("path", { d: "M8 3.33333V12.6667M3.33333 8H12.6667", stroke: "#0c68e9", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }) }), (0, jsx_runtime_1.jsx)("span", { className: "font-['Inter',sans-serif] text-[11px] font-semibold leading-[16px] text-[#0b57c2]", children: isConnecting ? "Opening..." : "Add Telegram" })] }));
77
+ return ((0, jsx_runtime_1.jsx)(NotificationChannel_1.NotificationChannel, { icon: icon, iconClassName: "bg-[#24A1DE] rounded-xl", title: "Telegram", isConnected: isOptimisticallyConnected || status === "connected", isConnecting: isConnecting, isDisconnecting: isDisconnecting, connectedInfo: telegramChannel?.channel_identifier || "Connected", inputSection: inputSection, onToggle: handleToggle }));
78
+ };
79
+ exports.TelegramChannel = TelegramChannel;
@@ -0,0 +1,4 @@
1
+ export { DiscordChannel } from "./DiscordChannel";
2
+ export { EmailChannel } from "./EmailChannel";
3
+ export { PhoneChannel } from "./PhoneChannel";
4
+ export { TelegramChannel } from "./TelegramChannel";
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.TelegramChannel = exports.PhoneChannel = exports.EmailChannel = exports.DiscordChannel = void 0;
4
+ var DiscordChannel_1 = require("./DiscordChannel");
5
+ Object.defineProperty(exports, "DiscordChannel", { enumerable: true, get: function () { return DiscordChannel_1.DiscordChannel; } });
6
+ var EmailChannel_1 = require("./EmailChannel");
7
+ Object.defineProperty(exports, "EmailChannel", { enumerable: true, get: function () { return EmailChannel_1.EmailChannel; } });
8
+ var PhoneChannel_1 = require("./PhoneChannel");
9
+ Object.defineProperty(exports, "PhoneChannel", { enumerable: true, get: function () { return PhoneChannel_1.PhoneChannel; } });
10
+ var TelegramChannel_1 = require("./TelegramChannel");
11
+ Object.defineProperty(exports, "TelegramChannel", { enumerable: true, get: function () { return TelegramChannel_1.TelegramChannel; } });
@@ -0,0 +1,11 @@
1
+ declare const ModalHeader: ({ showBackButton, handleBack, handleClose, title, children, showCloseButton, className, showBackWord, }: {
2
+ showBackButton?: boolean;
3
+ handleBack?: () => void;
4
+ handleClose?: () => void;
5
+ title: string;
6
+ children?: React.ReactNode;
7
+ showCloseButton?: boolean;
8
+ className?: string;
9
+ showBackWord?: boolean;
10
+ }) => import("react/jsx-runtime").JSX.Element;
11
+ export default ModalHeader;
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const jsx_runtime_1 = require("react/jsx-runtime");
4
+ const utils_1 = require("../../../../shared/utils");
5
+ const lucide_react_1 = require("lucide-react");
6
+ const stores_1 = require("../../stores");
7
+ const ModalHeader = ({ showBackButton = true, handleBack, handleClose, title, children, showCloseButton = true, className, showBackWord = false, }) => {
8
+ const navigateBack = (0, stores_1.useModalStore)(state => state.navigateBack);
9
+ const setB3ModalOpen = (0, stores_1.useModalStore)(state => state.setB3ModalOpen);
10
+ return ((0, jsx_runtime_1.jsxs)("div", { className: (0, utils_1.cn)("b3-modal-header flex h-16 items-center justify-between border-b border-[#e4e4e7] bg-white px-5 py-3", className), children: [showBackButton ? ((0, jsx_runtime_1.jsxs)("button", { onClick: handleBack || navigateBack, className: "flex h-6 w-6 items-center justify-center transition-opacity hover:opacity-70", children: [(0, jsx_runtime_1.jsx)(lucide_react_1.ChevronLeft, { className: "h-6 w-6 text-[#51525c]" }), showBackWord && (0, jsx_runtime_1.jsx)("span", { className: "text-sm font-medium", children: "Back" })] })) : ((0, jsx_runtime_1.jsx)("div", { className: "w-2" })), (0, jsx_runtime_1.jsx)("p", { className: "font-inter text-lg font-semibold leading-7 text-[#18181b]", children: title }), showCloseButton ? ((0, jsx_runtime_1.jsx)("button", { onClick: handleClose || (() => setB3ModalOpen(false)), className: "flex h-6 w-6 items-center justify-center transition-opacity hover:opacity-70", children: (0, jsx_runtime_1.jsx)(lucide_react_1.X, { className: "h-6 w-6 text-[#51525c]" }) })) : !children ? ((0, jsx_runtime_1.jsx)("div", { className: "w-2" })) : undefined, children] }));
11
+ };
12
+ exports.default = ModalHeader;
@@ -0,0 +1,5 @@
1
+ export interface SendModalProps {
2
+ recipientAddress?: string;
3
+ onSuccess?: (txHash?: string) => void;
4
+ }
5
+ export declare function Send({ recipientAddress: initialRecipient, onSuccess }: SendModalProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,195 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.Send = Send;
7
+ const jsx_runtime_1 = require("react/jsx-runtime");
8
+ const anyspend_1 = require("../../../../anyspend");
9
+ const ChainTokenIcon_1 = require("../../../../anyspend/react/components/common/ChainTokenIcon");
10
+ const react_1 = require("../../../../global-account/react");
11
+ const number_1 = require("../../../../shared/utils/number");
12
+ const invariant_1 = __importDefault(require("invariant"));
13
+ const lucide_react_1 = require("lucide-react");
14
+ const react_2 = require("react");
15
+ const react_number_format_1 = require("react-number-format");
16
+ const viem_1 = require("viem");
17
+ const useRecentAddressesStore_1 = require("../../stores/useRecentAddressesStore");
18
+ const ModalHeader_1 = __importDefault(require("../ModalHeader/ModalHeader"));
19
+ const button_1 = require("../ui/button");
20
+ // Component for displaying a recent address with profile data
21
+ function RecentAddressItem({ address, onClick }) {
22
+ const { data: profileData } = (0, react_1.useProfile)({ address });
23
+ return ((0, jsx_runtime_1.jsxs)("button", { onClick: onClick, className: "flex items-center gap-2 rounded-xl px-3 py-2 transition-colors hover:bg-[#fafafa]", children: [profileData?.avatar ? ((0, jsx_runtime_1.jsx)("img", { src: profileData.avatar, alt: profileData.name || address, className: "h-10 w-10 rounded-full" })) : ((0, jsx_runtime_1.jsx)("div", { className: "flex h-10 w-10 items-center justify-center rounded-full border border-[#e4e4e7] bg-[#f4f4f5]", children: (0, jsx_runtime_1.jsx)(lucide_react_1.Wallet, { className: "h-5 w-5 text-[#a0a0ab]" }) })), (0, jsx_runtime_1.jsx)("div", { className: "flex flex-col items-start", children: (0, jsx_runtime_1.jsxs)("span", { className: "font-neue-montreal-medium text-base tracking-[-0.32px] text-[#70707b]", children: [address.slice(0, 6), "...", address.slice(-4), profileData?.name && ` (${profileData.name})`] }) })] }));
24
+ }
25
+ function Send({ recipientAddress: initialRecipient, onSuccess }) {
26
+ const { address } = (0, react_1.useAccountWallet)();
27
+ const navigateBack = (0, react_1.useModalStore)(state => state.navigateBack);
28
+ const setB3ModalOpen = (0, react_1.useModalStore)(state => state.setB3ModalOpen);
29
+ // Wizard state
30
+ const [step, setStep] = (0, react_2.useState)("recipient");
31
+ const [selectedToken, setSelectedToken] = (0, react_2.useState)(null);
32
+ const [recipientAddress, setRecipientAddress] = (0, react_2.useState)(initialRecipient || "");
33
+ const [sendAmount, setSendAmount] = (0, react_2.useState)("");
34
+ const [isSending, setIsSending] = (0, react_2.useState)(false);
35
+ const [addressError, setAddressError] = (0, react_2.useState)("");
36
+ const [showValidatedResult, setShowValidatedResult] = (0, react_2.useState)(false);
37
+ // Hooks
38
+ const { data: simBalance, refetch: refetchSimBalance, isLoading: isLoadingBalance } = (0, react_1.useSimBalance)(address);
39
+ const { switchChainAndExecute } = (0, react_1.useUnifiedChainSwitchAndExecute)();
40
+ const { sendAnalyticsEvent } = (0, react_1.useAnalytics)();
41
+ // Recent addresses store
42
+ const recentAddresses = (0, useRecentAddressesStore_1.useRecentAddressesStore)(state => state.recentAddresses);
43
+ const addRecentAddress = (0, useRecentAddressesStore_1.useRecentAddressesStore)(state => state.addRecentAddress);
44
+ // Fetch profile data for validated address
45
+ const { data: validatedProfileData } = (0, react_1.useProfile)({
46
+ address: showValidatedResult && recipientAddress && (0, viem_1.isAddress)(recipientAddress) ? recipientAddress : undefined,
47
+ });
48
+ // Address validation
49
+ const handleRecipientAddressChange = (value) => {
50
+ setRecipientAddress(value);
51
+ setShowValidatedResult(false);
52
+ if (value && !(0, viem_1.isAddress)(value)) {
53
+ setAddressError("Please enter a valid EVM address (0x...)");
54
+ }
55
+ else {
56
+ setAddressError("");
57
+ if (value && (0, viem_1.isAddress)(value)) {
58
+ setShowValidatedResult(true);
59
+ }
60
+ }
61
+ };
62
+ // Paste from clipboard
63
+ const handlePaste = async () => {
64
+ try {
65
+ const text = await navigator.clipboard.readText();
66
+ const trimmedText = text.trim();
67
+ setRecipientAddress(trimmedText);
68
+ if (trimmedText && (0, viem_1.isAddress)(trimmedText)) {
69
+ setAddressError("");
70
+ setShowValidatedResult(true);
71
+ }
72
+ else if (trimmedText) {
73
+ setAddressError("Please enter a valid EVM address (0x...)");
74
+ setShowValidatedResult(false);
75
+ }
76
+ }
77
+ catch (error) {
78
+ react_1.toast.error("Failed to read clipboard");
79
+ }
80
+ };
81
+ // Handle clicking on the validated result to proceed
82
+ const handleSelectValidatedAddress = () => {
83
+ if (recipientAddress && (0, viem_1.isAddress)(recipientAddress)) {
84
+ addRecentAddress(recipientAddress);
85
+ setStep("token");
86
+ }
87
+ };
88
+ // Go to previous step
89
+ const handleBack = () => {
90
+ if (step === "token")
91
+ setStep("recipient");
92
+ else if (step === "amount")
93
+ setStep("token");
94
+ else if (step === "confirm")
95
+ setStep("amount");
96
+ else
97
+ navigateBack();
98
+ };
99
+ // Get current selected token from fresh balance
100
+ const getCurrentSelectedToken = () => {
101
+ if (!selectedToken || !simBalance?.balances) {
102
+ return null;
103
+ }
104
+ const found = simBalance.balances.find(token => token.chain_id === selectedToken.chain_id && token.address === selectedToken.address);
105
+ return found || null;
106
+ };
107
+ // Percentage button handler
108
+ const handlePercentageClick = (percentage) => {
109
+ const currentToken = getCurrentSelectedToken();
110
+ if (currentToken) {
111
+ const tokenBalance = (BigInt(currentToken.amount) * BigInt(percentage)) / BigInt(100);
112
+ const amount = (0, number_1.formatTokenAmount)(tokenBalance, currentToken.decimals, 30, false);
113
+ setSendAmount(amount);
114
+ }
115
+ };
116
+ // Send transaction
117
+ const handleSend = async () => {
118
+ const sendAmountWithoutCommas = sendAmount.replace(/,/g, "");
119
+ const currentToken = getCurrentSelectedToken();
120
+ if (!currentToken || !recipientAddress || !sendAmount || parseFloat(sendAmountWithoutCommas) <= 0) {
121
+ return;
122
+ }
123
+ setIsSending(true);
124
+ const amountInWei = (0, viem_1.parseUnits)(sendAmountWithoutCommas, currentToken.decimals);
125
+ const analyticsData = {
126
+ amount: sendAmount,
127
+ symbol: currentToken.symbol,
128
+ chain_id: currentToken.chain_id,
129
+ address: currentToken.address,
130
+ };
131
+ try {
132
+ (0, invariant_1.default)((0, viem_1.isAddress)(recipientAddress), "Recipient address is not a valid address");
133
+ const sendTokenData = (0, viem_1.encodeFunctionData)({
134
+ abi: viem_1.erc20Abi,
135
+ functionName: "transfer",
136
+ args: [recipientAddress, amountInWei],
137
+ });
138
+ const tx = await switchChainAndExecute(currentToken.chain_id, {
139
+ to: currentToken.address === "native" ? recipientAddress : currentToken.address,
140
+ data: sendTokenData,
141
+ value: currentToken.address === "native" ? amountInWei : BigInt(0),
142
+ });
143
+ if (tx) {
144
+ sendAnalyticsEvent("send_token_button_click", {
145
+ ...analyticsData,
146
+ success: true,
147
+ tx: (0, anyspend_1.getExplorerTxUrl)(currentToken.chain_id, tx),
148
+ });
149
+ setStep("success");
150
+ react_1.toast.success(`Successfully sent ${sendAmount} ${currentToken.symbol}`);
151
+ if (onSuccess) {
152
+ onSuccess(tx);
153
+ }
154
+ setTimeout(async () => {
155
+ await refetchSimBalance();
156
+ }, 1000);
157
+ }
158
+ }
159
+ catch (error) {
160
+ sendAnalyticsEvent("send_token_button_click", {
161
+ ...analyticsData,
162
+ success: false,
163
+ reason: error.message || "Unknown error",
164
+ });
165
+ react_1.toast.error(`Failed to send ${currentToken.symbol}: ${error.message || "Unknown error"}`);
166
+ }
167
+ finally {
168
+ setIsSending(false);
169
+ }
170
+ };
171
+ // Get step title
172
+ const getStepTitle = () => {
173
+ switch (step) {
174
+ case "recipient":
175
+ return "Select Recipient";
176
+ case "token":
177
+ return "Select Token";
178
+ case "amount":
179
+ return "Enter Amount";
180
+ case "confirm":
181
+ return "Confirm";
182
+ case "success":
183
+ return "Sent!";
184
+ default:
185
+ return "Send";
186
+ }
187
+ };
188
+ return ((0, jsx_runtime_1.jsxs)("div", { className: "flex h-[600px] w-full flex-col bg-white", children: [(0, jsx_runtime_1.jsx)(ModalHeader_1.default, { handleBack: handleBack, title: getStepTitle() }), (0, jsx_runtime_1.jsxs)("div", { className: "flex-1 overflow-y-auto", children: [step === "recipient" && ((0, jsx_runtime_1.jsxs)("div", { className: "flex flex-col gap-6 p-5", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex h-12 w-full items-stretch overflow-hidden rounded-lg border border-[#d1d1d6] bg-white", children: [(0, jsx_runtime_1.jsx)("div", { className: "flex w-12 items-center justify-center bg-transparent px-3 py-2", children: (0, jsx_runtime_1.jsx)("span", { className: "font-neue-montreal-medium text-base text-[#3f3f46]", children: "To" }) }), (0, jsx_runtime_1.jsxs)("div", { className: "flex flex-1 items-center border-l border-[#d1d1d6] px-3 py-2", children: [(0, jsx_runtime_1.jsx)("input", { type: "text", value: recipientAddress, onChange: e => handleRecipientAddressChange(e.target.value), placeholder: "ENS or Address", className: "font-neue-montreal-medium flex-1 text-base text-[#70707b] outline-none placeholder:text-[#70707b]" }), (0, jsx_runtime_1.jsx)("button", { onClick: handlePaste, className: "font-inter ml-2 rounded-md border border-[#e4e4e7] bg-[#fafafa] px-2.5 py-0.5 text-sm font-medium text-[#3f3f46] transition-colors hover:bg-[#f4f4f5]", children: "Paste" })] })] }), addressError && (0, jsx_runtime_1.jsx)("p", { className: "font-neue-montreal-medium -mt-4 text-xs text-red-500", children: addressError }), showValidatedResult && recipientAddress && (0, viem_1.isAddress)(recipientAddress) && ((0, jsx_runtime_1.jsxs)("div", { className: "flex flex-col gap-2", children: [(0, jsx_runtime_1.jsx)("div", { className: "flex items-center gap-1", children: (0, jsx_runtime_1.jsx)("span", { className: "font-sf-pro-text text-sm font-semibold leading-[1.3] tracking-[-0.41px] text-[#0b57c2]", children: "Result" }) }), (0, jsx_runtime_1.jsxs)("button", { onClick: handleSelectValidatedAddress, className: "flex items-center gap-2 rounded-xl bg-[#f4f4f5] px-3 py-2 transition-colors hover:bg-[#e4e4e7]", children: [validatedProfileData?.avatar ? ((0, jsx_runtime_1.jsx)("img", { src: validatedProfileData.avatar, alt: validatedProfileData.name || recipientAddress, className: "h-10 w-10 rounded-full" })) : ((0, jsx_runtime_1.jsx)("div", { className: "flex h-10 w-10 items-center justify-center rounded-full border border-[#e4e4e7] bg-[#f4f4f5]", children: (0, jsx_runtime_1.jsx)(lucide_react_1.Wallet, { className: "h-5 w-5 text-[#a0a0ab]" }) })), (0, jsx_runtime_1.jsxs)("span", { className: "font-neue-montreal-medium text-base tracking-[-0.32px] text-[#70707b]", children: [recipientAddress.slice(0, 6), "...", recipientAddress.slice(-4), validatedProfileData?.name && ` (${validatedProfileData.name})`] })] })] })), recentAddresses.length > 0 && ((0, jsx_runtime_1.jsxs)("div", { className: "flex flex-col gap-2", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-1", children: [(0, jsx_runtime_1.jsx)(lucide_react_1.Clock, { className: "h-3.5 w-3.5 text-[#3f3f46]" }), (0, jsx_runtime_1.jsx)("span", { className: "font-sf-pro-text text-sm font-semibold leading-[1.3] tracking-[-0.41px] text-[#3f3f46]", children: "Recents" })] }), (0, jsx_runtime_1.jsx)("div", { className: "flex flex-col", children: recentAddresses.map((recent, index) => ((0, jsx_runtime_1.jsx)(RecentAddressItem, { address: recent.address, onClick: () => {
189
+ // Just fill the input and show validation - don't auto-proceed
190
+ handleRecipientAddressChange(recent.address);
191
+ } }, index))) })] }))] })), step === "token" && ((0, jsx_runtime_1.jsx)("div", { className: "flex flex-col p-5", children: isLoadingBalance ? ((0, jsx_runtime_1.jsx)("div", { className: "space-y-4", children: (0, jsx_runtime_1.jsx)("div", { className: "space-y-1", children: [...Array(3)].map((_, index) => ((0, jsx_runtime_1.jsxs)("div", { className: "flex items-center justify-between rounded-xl p-3", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-3", children: [(0, jsx_runtime_1.jsx)("div", { className: "bg-b3-line h-10 w-10 animate-pulse rounded-full" }), (0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)("div", { className: "bg-b3-line mb-1 h-4 w-16 animate-pulse rounded" }), (0, jsx_runtime_1.jsx)("div", { className: "bg-b3-line h-3 w-24 animate-pulse rounded" })] })] }), (0, jsx_runtime_1.jsxs)("div", { className: "text-right", children: [(0, jsx_runtime_1.jsx)("div", { className: "bg-b3-line mb-1 h-4 w-20 animate-pulse rounded" }), (0, jsx_runtime_1.jsx)("div", { className: "bg-b3-line h-3 w-16 animate-pulse rounded" })] })] }, index))) }) })) : simBalance?.balances && simBalance.balances.length > 0 ? ((0, jsx_runtime_1.jsx)("div", { className: "space-y-4", children: (0, jsx_runtime_1.jsx)("div", { className: "space-y-1", children: simBalance.balances.map(token => ((0, jsx_runtime_1.jsxs)("div", { className: "hover:bg-b3-line/60 dark:hover:bg-b3-primary-wash/40 group flex cursor-pointer items-center justify-between rounded-xl p-3 transition-all duration-200", onClick: () => {
192
+ setSelectedToken(token);
193
+ setStep("amount");
194
+ }, children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-3", children: [(0, jsx_runtime_1.jsx)("div", { className: "flex h-10 w-10 items-center justify-center rounded-full", children: anyspend_1.ALL_CHAINS[token.chain_id]?.logoUrl ? ((0, jsx_runtime_1.jsx)(ChainTokenIcon_1.ChainTokenIcon, { chainUrl: anyspend_1.ALL_CHAINS[token.chain_id].logoUrl, tokenUrl: token.token_metadata?.logo, className: "size-10" })) : ((0, jsx_runtime_1.jsx)(lucide_react_1.CircleHelp, { className: "text-b3-react-foreground size-10" })) }), (0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)("div", { className: "flex items-center gap-2", children: (0, jsx_runtime_1.jsx)("span", { className: "text-b3-grey font-neue-montreal-semibold transition-colors duration-200 group-hover:font-bold group-hover:text-black", children: token.symbol }) }), (0, jsx_runtime_1.jsx)("div", { className: "text-b3-foreground-muted font-neue-montreal-medium text-sm transition-colors duration-200 group-hover:text-gray-700", children: token.name })] })] }), (0, jsx_runtime_1.jsxs)("div", { className: "text-right", children: [(0, jsx_runtime_1.jsx)("div", { className: "text-b3-grey font-neue-montreal-semibold transition-colors duration-200 group-hover:font-bold group-hover:text-black", children: (0, number_1.formatTokenAmount)(BigInt(token.amount), token.decimals) }), (0, jsx_runtime_1.jsx)("div", { className: "text-b3-foreground-muted font-neue-montreal-medium text-sm transition-colors duration-200 group-hover:text-gray-700", children: (0, number_1.formatDisplayNumber)(token.value_usd, { style: "currency", fractionDigits: 2 }) })] })] }, token.chain_id + "_" + token.address))) }) })) : ((0, jsx_runtime_1.jsxs)("div", { className: "flex flex-col items-center justify-center py-12 text-center", children: [(0, jsx_runtime_1.jsx)(lucide_react_1.CircleHelp, { className: "text-b3-foreground-muted mb-4 h-8 w-8" }), (0, jsx_runtime_1.jsx)("p", { className: "text-b3-foreground-muted font-neue-montreal-medium text-sm", children: "No tokens available" })] })) })), step === "amount" && selectedToken && ((0, jsx_runtime_1.jsxs)("div", { className: "flex flex-col gap-6 p-5", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex items-center justify-between rounded-xl border border-[#d1d1d6] bg-[#fafafa] p-3", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-3", children: [(0, jsx_runtime_1.jsx)("div", { className: "flex h-10 w-10 items-center justify-center", children: anyspend_1.ALL_CHAINS[selectedToken.chain_id]?.logoUrl ? ((0, jsx_runtime_1.jsx)(ChainTokenIcon_1.ChainTokenIcon, { chainUrl: anyspend_1.ALL_CHAINS[selectedToken.chain_id].logoUrl, tokenUrl: selectedToken.token_metadata?.logo, className: "size-10" })) : ((0, jsx_runtime_1.jsx)(lucide_react_1.CircleHelp, { className: "text-b3-react-foreground size-10" })) }), (0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)("div", { className: "font-neue-montreal-semibold text-base text-[#18181b]", children: selectedToken.symbol }), (0, jsx_runtime_1.jsx)("div", { className: "font-neue-montreal-medium text-sm text-[#70707b]", children: (0, number_1.formatTokenAmount)(BigInt(selectedToken.amount), selectedToken.decimals) })] })] }), (0, jsx_runtime_1.jsx)("button", { onClick: () => setStep("token"), className: "text-b3-primary-blue font-neue-montreal-semibold hover:text-b3-primary-blue/80 text-sm transition-colors", children: "Change" })] }), (0, jsx_runtime_1.jsxs)("div", { className: "space-y-3", children: [(0, jsx_runtime_1.jsx)(react_number_format_1.NumericFormat, { decimalSeparator: ".", allowedDecimalSeparators: [","], thousandSeparator: true, inputMode: "decimal", autoComplete: "off", autoCorrect: "off", type: "text", placeholder: "0.00", minLength: 1, maxLength: 30, spellCheck: "false", className: "font-neue-montreal-medium placeholder:text-b3-foreground-muted w-full rounded-lg border border-[#d1d1d6] bg-white px-3 py-2 text-base text-[#18181b] outline-none focus:border-[#0c68e9]", pattern: "^[0-9]*[.,]?[0-9]*$", disabled: isSending, value: sendAmount, allowNegative: false, onValueChange: values => setSendAmount(values.value) }), (0, jsx_runtime_1.jsx)("div", { className: "grid grid-cols-4 gap-2", children: [25, 50, 75, 100].map(percentage => ((0, jsx_runtime_1.jsxs)(button_1.Button, { variant: "outline", onClick: () => handlePercentageClick(percentage), className: "font-neue-montreal-medium border-[#d1d1d6] text-sm text-[#18181b] hover:bg-[#fafafa]", disabled: isSending, children: [percentage, "%"] }, percentage))) }), (0, jsx_runtime_1.jsxs)("div", { className: "font-neue-montreal-medium text-sm text-[#70707b]", children: ["Available: ", (0, number_1.formatTokenAmount)(BigInt(selectedToken.amount), selectedToken.decimals), " ", selectedToken.symbol] })] }), (0, jsx_runtime_1.jsx)(button_1.Button, { onClick: () => setStep("confirm"), disabled: !sendAmount || parseFloat(sendAmount) <= 0, className: "bg-b3-primary-blue hover:bg-b3-primary-blue/90 font-neue-montreal-semibold disabled:bg-b3-line disabled:text-b3-foreground-muted h-12 w-full rounded-xl text-white", children: "Continue" })] })), step === "confirm" && selectedToken && ((0, jsx_runtime_1.jsxs)("div", { className: "flex min-h-full flex-col", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex flex-col items-center gap-4 px-5 pb-0 pt-6", children: [(0, jsx_runtime_1.jsx)("div", { className: "flex h-14 w-14 items-center justify-center rounded-full bg-[#d5e5fd]", children: (0, jsx_runtime_1.jsx)(lucide_react_1.Send, { className: "h-7 w-7 text-[#0c68e9]" }) }), (0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-1", children: [(0, jsx_runtime_1.jsx)("span", { className: "font-neue-montreal-semibold text-[30px] leading-[38px] text-[#18181b]", children: sendAmount }), (0, jsx_runtime_1.jsx)("span", { className: "font-neue-montreal-semibold text-[30px] leading-[38px] text-[#70707b]", children: selectedToken.symbol })] })] }), (0, jsx_runtime_1.jsx)("div", { className: "h-5" }), (0, jsx_runtime_1.jsx)("div", { className: "flex flex-col gap-3 px-5", children: (0, jsx_runtime_1.jsx)("div", { className: "rounded-xl border border-[#e4e4e7] bg-[#fafafa] p-4", children: (0, jsx_runtime_1.jsxs)("div", { className: "flex flex-col gap-3", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex items-center justify-between border-b border-[#e4e4e7] pb-3", children: [(0, jsx_runtime_1.jsx)("span", { className: "font-inter text-sm font-normal leading-5 text-[#51525c]", children: "To" }), (0, jsx_runtime_1.jsxs)("span", { className: "font-inter text-sm font-normal leading-5 text-[#18181b]", children: ["Wallet (", recipientAddress.slice(0, 6), "...", recipientAddress.slice(-4), ")"] })] }), (0, jsx_runtime_1.jsxs)("div", { className: "flex items-center justify-between border-b border-[#e4e4e7] pb-3", children: [(0, jsx_runtime_1.jsx)("span", { className: "font-inter text-sm font-normal leading-5 text-[#51525c]", children: "Network" }), (0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-1.5", children: [(0, jsx_runtime_1.jsx)("span", { className: "font-inter text-sm font-normal leading-5 text-[#51525c]", children: anyspend_1.ALL_CHAINS[selectedToken.chain_id]?.name || "Unknown" }), anyspend_1.ALL_CHAINS[selectedToken.chain_id]?.logoUrl && ((0, jsx_runtime_1.jsx)("img", { src: anyspend_1.ALL_CHAINS[selectedToken.chain_id].logoUrl, alt: anyspend_1.ALL_CHAINS[selectedToken.chain_id]?.name, className: "h-4 w-4 rounded-full" }))] })] }), (0, jsx_runtime_1.jsxs)("div", { className: "flex items-center justify-between", children: [(0, jsx_runtime_1.jsx)("span", { className: "font-inter text-sm font-normal leading-5 text-[#51525c]", children: "Network fee" }), (0, jsx_runtime_1.jsx)("span", { className: "font-inter text-sm font-normal leading-5 text-[#18181b]", children: "$0.1" })] })] }) }) }), (0, jsx_runtime_1.jsx)("div", { className: "flex-1" }), (0, jsx_runtime_1.jsxs)("div", { className: "flex gap-4 border-t border-[#e4e4e7] bg-[#fafafa] p-4", children: [(0, jsx_runtime_1.jsx)(button_1.Button, { onClick: handleBack, disabled: isSending, variant: "outline", className: "font-inter h-12 flex-1 rounded-xl border border-[#e4e4e7] bg-white text-base font-semibold text-[#3f3f46] shadow-[inset_0px_0px_0px_1px_rgba(10,13,18,0.18),inset_0px_-2px_0px_0px_rgba(10,13,18,0.05)] hover:bg-[#fafafa]", children: "Cancel" }), (0, jsx_runtime_1.jsx)(button_1.Button, { onClick: handleSend, disabled: isSending, className: "font-inter border-white/12 h-12 flex-1 rounded-xl border-2 bg-[#0c68e9] text-base font-semibold text-white shadow-[inset_0px_0px_0px_1px_rgba(10,13,18,0.18),inset_0px_-2px_0px_0px_rgba(10,13,18,0.05)] hover:bg-[#0b5fd4]", children: isSending ? ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(lucide_react_1.Loader2, { className: "mr-2 h-4 w-4 animate-spin" }), "Sending..."] })) : ("Send") })] })] })), step === "success" && selectedToken && ((0, jsx_runtime_1.jsxs)("div", { className: "flex h-full flex-col items-center justify-center gap-6 p-5 text-center", children: [(0, jsx_runtime_1.jsx)("div", { className: "flex h-14 w-14 items-center justify-center rounded-full bg-green-100", children: (0, jsx_runtime_1.jsx)(lucide_react_1.Send, { className: "h-7 w-7 text-green-600" }) }), (0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)("h3", { className: "font-neue-montreal-semibold mb-2 text-xl text-[#18181b]", children: "Sent!" }), (0, jsx_runtime_1.jsxs)("p", { className: "font-neue-montreal-medium text-sm text-[#70707b]", children: [sendAmount, " ", selectedToken.symbol, " was sent to ", recipientAddress.slice(0, 6), "...", recipientAddress.slice(-4)] })] }), (0, jsx_runtime_1.jsx)(button_1.Button, { onClick: () => setB3ModalOpen(false), className: "bg-b3-primary-blue hover:bg-b3-primary-blue/90 font-neue-montreal-semibold h-12 w-full rounded-xl text-white", children: "Done" })] }))] })] }));
195
+ }
@@ -12,18 +12,18 @@ const utils_1 = require("../../../../shared/utils");
12
12
  const react_2 = require("@headlessui/react");
13
13
  const react_3 = require("react");
14
14
  const react_4 = require("thirdweb/react");
15
+ const useAccountWallet_1 = require("../../hooks/useAccountWallet");
15
16
  const ManageAccountButton_1 = require("../custom/ManageAccountButton");
16
17
  function SignIn(props) {
17
18
  const { className } = props;
18
19
  const { automaticallySetFirstEoa, partnerId } = (0, react_1.useB3)();
19
- const { wallet, address: globalAddress, ensName, connectedSmartWallet, connectedEOAWallet, isActiveSmartWallet, isActiveEOAWallet, smartWalletIcon, eoaWalletIcon, } = (0, react_1.useAccountWallet)();
20
+ const { address: globalAddress, ensName, connectedSmartWallet, connectedEOAWallet, isActiveSmartWallet, isActiveEOAWallet, smartWalletIcon, eoaWalletIcon, } = (0, react_1.useAccountWallet)();
20
21
  const isMobile = (0, react_1.useIsMobile)();
21
22
  const { logout } = (0, react_1.useAuthentication)(partnerId);
22
23
  const onDisconnect = async () => {
23
24
  await logout();
24
25
  };
25
26
  const connectedWallets = (0, react_4.useConnectedWallets)();
26
- const { data: walletInfo } = (0, react_4.useWalletInfo)(isActiveSmartWallet ? connectedSmartWallet?.id : connectedEOAWallet?.id);
27
27
  const setActiveWallet = (0, react_4.useSetActiveWallet)();
28
28
  const handleSetActiveAccount = (selectedWalletId) => {
29
29
  if (!selectedWalletId ||
@@ -40,10 +40,11 @@ function SignIn(props) {
40
40
  setActiveWallet(connectedEOAWallet);
41
41
  }
42
42
  }, [connectedEOAWallet, isActiveEOAWallet, setActiveWallet, automaticallySetFirstEoa]);
43
+ const walletImage = (0, useAccountWallet_1.useAccountWalletImage)();
43
44
  // Desktop version - original dropdown menu
44
- return ((0, jsx_runtime_1.jsx)(react_1.StyleRoot, { children: (0, jsx_runtime_1.jsx)(react_2.Menu, { className: `relative flex items-center ${className || ""}`, as: "div", children: globalAddress ? ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsxs)(react_2.MenuButton, { className: "bg-b3-react-background group flex h-10 items-center gap-1 rounded-xl px-3", children: [!!wallet.meta?.icon && ((0, jsx_runtime_1.jsx)("img", { src: wallet.meta.icon, alt: wallet.meta.icon, className: "bg-b3-react-primary h-6 w-6 rounded-full object-cover opacity-100" })), (0, jsx_runtime_1.jsx)("div", { className: "text-as-primary", children: ensName ? ensName : (0, utils_1.truncateAddress)(globalAddress) })] }), (0, jsx_runtime_1.jsx)(react_2.Transition, { enter: "duration-200 ease-out", enterFrom: "scale-95 opacity-0", enterTo: "scale-100 opacity-100", leave: "duration-300 ease-out", leaveFrom: "scale-100 opacity-100", leaveTo: "scale-95 opacity-0", children: (0, jsx_runtime_1.jsx)(react_2.MenuItems, { className: "b3-root absolute -right-4 top-full min-w-64 rounded-2xl border lg:right-0", modal: false,
45
+ return ((0, jsx_runtime_1.jsx)(react_1.StyleRoot, { children: (0, jsx_runtime_1.jsx)(react_2.Menu, { className: `relative flex items-center ${className || ""}`, as: "div", children: globalAddress ? ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsxs)(react_2.MenuButton, { className: "bg-b3-react-background group flex h-10 items-center gap-1 rounded-xl px-3 focus:outline-none", children: [!!walletImage && ((0, jsx_runtime_1.jsx)(react_1.IPFSMediaRenderer, { src: walletImage, alt: "Wallet Image", className: "bg-b3-react-primary h-6 w-6 rounded-full object-cover opacity-100" })), (0, jsx_runtime_1.jsx)("div", { className: "text-as-primary", children: ensName ? ensName : (0, utils_1.truncateAddress)(globalAddress) })] }), (0, jsx_runtime_1.jsx)(react_2.Transition, { enter: "duration-200 ease-out", enterFrom: "scale-95 opacity-0", enterTo: "scale-100 opacity-100", leave: "duration-300 ease-out", leaveFrom: "scale-100 opacity-100", leaveTo: "scale-95 opacity-0", children: (0, jsx_runtime_1.jsx)(react_2.MenuItems, { className: "b3-root absolute -right-4 top-full min-w-64 rounded-2xl border focus:outline-none lg:right-0", modal: false,
45
46
  // TODO: Figure out why setting anchor on mobile causes z-index issues where it appears under elements
46
- anchor: isMobile ? "top end" : undefined, children: (0, jsx_runtime_1.jsxs)("div", { className: "bg-b3-react-background", children: [connectedEOAWallet ? ((0, jsx_runtime_1.jsxs)("div", { className: (0, utils_1.cn)("border-b3-react-subtle bg-b3-react-background flex cursor-pointer items-center justify-between rounded-xl p-3"), onClick: () => handleSetActiveAccount(connectedEOAWallet?.id), children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex items-center", children: [(0, jsx_runtime_1.jsx)("img", { className: "bg-b3-react-primary h-16 w-16 rounded-full opacity-100", src: eoaWalletIcon, alt: connectedEOAWallet?.id }), (0, jsx_runtime_1.jsxs)("div", { className: "ml-4 grow", children: [ensName && (0, jsx_runtime_1.jsx)("div", { children: ensName }), (0, jsx_runtime_1.jsx)("div", { children: (0, utils_1.truncateAddress)(globalAddress) }), (0, jsx_runtime_1.jsx)("div", { children: walletInfo?.name })] })] }), isActiveEOAWallet && (0, jsx_runtime_1.jsx)(Icon_1.default, { className: "fill-b3-react-primary", name: "check" })] })) : (connectedSmartWallet && ((0, jsx_runtime_1.jsxs)("div", { className: (0, utils_1.cn)("mb-2 flex cursor-pointer items-center justify-between rounded-xl p-3", isActiveSmartWallet
47
+ anchor: isMobile ? "top end" : undefined, children: (0, jsx_runtime_1.jsxs)("div", { className: "bg-b3-react-background", children: [connectedEOAWallet ? ((0, jsx_runtime_1.jsxs)("div", { className: (0, utils_1.cn)("border-b3-react-subtle bg-b3-react-background flex cursor-pointer items-center justify-between rounded-xl p-3"), onClick: () => handleSetActiveAccount(connectedEOAWallet?.id), children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex items-center", children: [(0, jsx_runtime_1.jsx)("img", { className: "bg-b3-react-primary h-16 w-16 rounded-full opacity-100", src: eoaWalletIcon, alt: connectedEOAWallet?.id }), (0, jsx_runtime_1.jsxs)("div", { className: "ml-4 grow", children: [ensName && (0, jsx_runtime_1.jsx)("div", { children: ensName }), (0, jsx_runtime_1.jsx)("div", { children: (0, utils_1.truncateAddress)(globalAddress) })] })] }), isActiveEOAWallet && (0, jsx_runtime_1.jsx)(Icon_1.default, { className: "fill-b3-react-primary", name: "check" })] })) : (connectedSmartWallet && ((0, jsx_runtime_1.jsxs)("div", { className: (0, utils_1.cn)("mb-2 flex cursor-pointer items-center justify-between rounded-xl p-3", isActiveSmartWallet
47
48
  ? "bg-b3-react-background"
48
49
  : "bg-b3-react-background hover:bg-b3-react-background"), onClick: () => handleSetActiveAccount(connectedSmartWallet?.id), children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex items-center", children: [(0, jsx_runtime_1.jsx)("img", { className: "bg-b3-react-primary h-16 w-16 rounded-full opacity-100", src: smartWalletIcon, alt: connectedSmartWallet?.id }), (0, jsx_runtime_1.jsxs)("div", { className: "grow pl-4", children: [ensName && (0, jsx_runtime_1.jsx)("div", { children: ensName }), (0, jsx_runtime_1.jsx)("div", { children: (0, utils_1.truncateAddress)(globalAddress) }), (0, jsx_runtime_1.jsx)("div", { children: "Smart wallet" })] })] }), isActiveSmartWallet && (0, jsx_runtime_1.jsx)(Icon_1.default, { className: "fill-b3-react-primary", name: "check" })] }))), (0, jsx_runtime_1.jsx)("div", { className: "ml-3", children: (0, jsx_runtime_1.jsx)(ManageAccountButton_1.ManageAccountButton, { ...props, className: "w-[calc(100%-12px)]" }) }), (0, jsx_runtime_1.jsx)("button", { className: "mb-2 w-full space-y-1", onClick: onDisconnect, children: (0, jsx_runtime_1.jsxs)("div", { className: "hover:bg-b3-react-background group flex h-12 items-center rounded-xl px-4 transition-colors", children: [(0, jsx_runtime_1.jsx)(Icon_1.default, { className: "fill-b3-react-primary mr-4 shrink-0 transition-colors", name: "logout" }), (0, jsx_runtime_1.jsx)("div", { className: "text-b3-react-primary mr-auto transition-colors", children: "Disconnect" })] }) })] }) }) })] })) : ((0, jsx_runtime_1.jsx)(react_1.SignInWithB3, { closeAfterLogin: true, onLoginSuccess: async (globalAccount) => {
49
50
  console.log("User authenticated with Global Account!", globalAccount);
@@ -176,7 +176,7 @@ function SignInWithB3Flow({ strategies, onLoginSuccess, onSessionKeySuccess, onE
176
176
  return ((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 }) }));
177
177
  }
178
178
  if (isAuthenticating || (isFetchingSigners && step === "login") || source === "requestPermissions") {
179
- return ((0, jsx_runtime_1.jsx)(LoginStep_1.LoginStepContainer, { partnerId: partnerId, children: (0, jsx_runtime_1.jsx)("div", { className: "mt-8 flex items-center justify-center", children: (0, jsx_runtime_1.jsx)(react_1.Loading, { variant: "white", size: "lg" }) }) }));
179
+ return ((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" }) }) }));
180
180
  }
181
181
  if (step === "login") {
182
182
  // Custom strategy
@@ -0,0 +1,15 @@
1
+ import type { ToastItem } from "./ToastContext";
2
+ interface ToastProps {
3
+ toast: ToastItem;
4
+ onDismiss: (id: string) => void;
5
+ theme?: "light" | "dark";
6
+ }
7
+ export declare function Toast({ toast, onDismiss, theme }: ToastProps): import("react/jsx-runtime").JSX.Element;
8
+ interface ToastContainerProps {
9
+ toasts: ToastItem[];
10
+ onDismiss: (id: string) => void;
11
+ theme?: "light" | "dark";
12
+ className?: string;
13
+ }
14
+ export declare function ToastContainer({ toasts, onDismiss, theme, className }: ToastContainerProps): import("react/jsx-runtime").JSX.Element;
15
+ export {};
@@ -0,0 +1,54 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Toast = Toast;
4
+ exports.ToastContainer = ToastContainer;
5
+ const jsx_runtime_1 = require("react/jsx-runtime");
6
+ const cn_1 = require("../../../../shared/utils/cn");
7
+ const framer_motion_1 = require("framer-motion");
8
+ const getToastIcon = (type) => {
9
+ switch (type) {
10
+ case "success":
11
+ return ((0, jsx_runtime_1.jsx)("svg", { width: "20", height: "20", viewBox: "0 0 20 20", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: (0, jsx_runtime_1.jsx)("path", { d: "M16.6666 5L7.49998 14.1667L3.33331 10", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }) }));
12
+ case "error":
13
+ return ((0, jsx_runtime_1.jsx)("svg", { width: "20", height: "20", viewBox: "0 0 20 20", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: (0, jsx_runtime_1.jsx)("path", { d: "M15 5L5 15M5 5L15 15", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }) }));
14
+ case "info":
15
+ return ((0, jsx_runtime_1.jsx)("svg", { width: "20", height: "20", viewBox: "0 0 20 20", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: (0, jsx_runtime_1.jsx)("path", { d: "M10 13.3333V10M10 6.66667H10.0083M18.3333 10C18.3333 14.6024 14.6024 18.3333 10 18.3333C5.39763 18.3333 1.66667 14.6024 1.66667 10C1.66667 5.39763 5.39763 1.66667 10 1.66667C14.6024 1.66667 18.3333 5.39763 18.3333 10Z", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }) }));
16
+ case "warning":
17
+ return ((0, jsx_runtime_1.jsx)("svg", { width: "20", height: "20", viewBox: "0 0 20 20", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: (0, jsx_runtime_1.jsx)("path", { d: "M10 6.66667V10M10 13.3333H10.0083M18.3333 10C18.3333 14.6024 14.6024 18.3333 10 18.3333C5.39763 18.3333 1.66667 14.6024 1.66667 10C1.66667 5.39763 5.39763 1.66667 10 1.66667C14.6024 1.66667 18.3333 5.39763 18.3333 10Z", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }) }));
18
+ }
19
+ };
20
+ const getToastStyles = (type, theme = "light") => {
21
+ const isDark = theme === "dark";
22
+ const baseStyles = "flex items-start gap-3 p-4 rounded-xl border shadow-sm";
23
+ switch (type) {
24
+ case "success":
25
+ return (0, cn_1.cn)(baseStyles, isDark ? "bg-green-950/50 border-green-800/50 text-green-100" : "bg-green-50 border-green-200 text-green-900");
26
+ case "error":
27
+ return (0, cn_1.cn)(baseStyles, isDark ? "bg-red-950/50 border-red-800/50 text-red-100" : "bg-red-50 border-red-200 text-red-900");
28
+ case "info":
29
+ return (0, cn_1.cn)(baseStyles, isDark ? "bg-blue-950/50 border-blue-800/50 text-blue-100" : "bg-blue-50 border-blue-200 text-blue-900");
30
+ case "warning":
31
+ return (0, cn_1.cn)(baseStyles, isDark
32
+ ? "bg-yellow-950/50 border-yellow-800/50 text-yellow-100"
33
+ : "bg-yellow-50 border-yellow-200 text-yellow-900");
34
+ }
35
+ };
36
+ const getIconColorClass = (type, theme = "light") => {
37
+ const isDark = theme === "dark";
38
+ switch (type) {
39
+ case "success":
40
+ return isDark ? "text-green-400" : "text-green-600";
41
+ case "error":
42
+ return isDark ? "text-red-400" : "text-red-600";
43
+ case "info":
44
+ return isDark ? "text-blue-400" : "text-blue-600";
45
+ case "warning":
46
+ return isDark ? "text-yellow-400" : "text-yellow-600";
47
+ }
48
+ };
49
+ function Toast({ toast, onDismiss, theme = "light" }) {
50
+ return ((0, jsx_runtime_1.jsxs)(framer_motion_1.motion.div, { initial: { opacity: 0, y: -20, scale: 0.95 }, animate: { opacity: 1, y: 0, scale: 1 }, exit: { opacity: 0, y: -10, scale: 0.95 }, transition: { duration: 0.2 }, className: getToastStyles(toast.type, theme), children: [(0, jsx_runtime_1.jsx)("div", { className: (0, cn_1.cn)("mt-0.5 shrink-0", getIconColorClass(toast.type, theme)), children: getToastIcon(toast.type) }), (0, jsx_runtime_1.jsx)("p", { className: "font-inter flex-1 text-sm font-medium", children: toast.message }), (0, jsx_runtime_1.jsx)("button", { onClick: () => onDismiss(toast.id), className: (0, cn_1.cn)("shrink-0 transition-opacity hover:opacity-70", theme === "dark" ? "text-gray-400" : "text-gray-500"), children: (0, jsx_runtime_1.jsx)("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: (0, jsx_runtime_1.jsx)("path", { d: "M12 4L4 12M4 4L12 12", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }) }) })] }));
51
+ }
52
+ function ToastContainer({ toasts, onDismiss, theme = "light", className }) {
53
+ return ((0, jsx_runtime_1.jsx)("div", { className: (0, cn_1.cn)("w-full space-y-2", className), children: (0, jsx_runtime_1.jsx)(framer_motion_1.AnimatePresence, { mode: "popLayout", children: toasts.map(toast => ((0, jsx_runtime_1.jsx)(Toast, { toast: toast, onDismiss: onDismiss, theme: theme }, toast.id))) }) }));
54
+ }
@@ -0,0 +1,19 @@
1
+ export type ToastType = "success" | "error" | "info" | "warning";
2
+ export interface ToastItem {
3
+ id: string;
4
+ type: ToastType;
5
+ message: string;
6
+ duration?: number;
7
+ createdAt: number;
8
+ }
9
+ interface ToastContextType {
10
+ toasts: ToastItem[];
11
+ addToast: (type: ToastType, message: string, duration?: number) => string;
12
+ removeToast: (id: string) => void;
13
+ clearAll: () => void;
14
+ }
15
+ export declare function ToastProvider({ children }: {
16
+ children: React.ReactNode;
17
+ }): import("react/jsx-runtime").JSX.Element;
18
+ export declare function useToastContext(): ToastContextType;
19
+ export {};
@@ -0,0 +1,59 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ToastProvider = ToastProvider;
4
+ exports.useToastContext = useToastContext;
5
+ const jsx_runtime_1 = require("react/jsx-runtime");
6
+ const react_1 = require("react");
7
+ const ToastContext = (0, react_1.createContext)(undefined);
8
+ let globalToastCounter = 0;
9
+ function ToastProvider({ children }) {
10
+ const [toasts, setToasts] = (0, react_1.useState)([]);
11
+ const timeoutsRef = (0, react_1.useRef)(new Map());
12
+ const removeToast = (0, react_1.useCallback)((id) => {
13
+ setToasts(prev => prev.filter(toast => toast.id !== id));
14
+ const timeout = timeoutsRef.current.get(id);
15
+ if (timeout) {
16
+ clearTimeout(timeout);
17
+ timeoutsRef.current.delete(id);
18
+ }
19
+ }, []);
20
+ const addToast = (0, react_1.useCallback)((type, message, duration = 4000) => {
21
+ const id = `toast-${Date.now()}-${globalToastCounter++}`;
22
+ const newToast = {
23
+ id,
24
+ type,
25
+ message,
26
+ duration,
27
+ createdAt: Date.now(),
28
+ };
29
+ setToasts(prev => [...prev, newToast]);
30
+ if (duration > 0) {
31
+ const timeout = setTimeout(() => {
32
+ removeToast(id);
33
+ }, duration);
34
+ timeoutsRef.current.set(id, timeout);
35
+ }
36
+ return id;
37
+ }, [removeToast]);
38
+ const clearAll = (0, react_1.useCallback)(() => {
39
+ timeoutsRef.current.forEach(timeout => clearTimeout(timeout));
40
+ timeoutsRef.current.clear();
41
+ setToasts([]);
42
+ }, []);
43
+ // Cleanup on unmount
44
+ (0, react_1.useEffect)(() => {
45
+ const timeouts = timeoutsRef.current;
46
+ return () => {
47
+ timeouts.forEach(timeout => clearTimeout(timeout));
48
+ timeouts.clear();
49
+ };
50
+ }, []);
51
+ return (0, jsx_runtime_1.jsx)(ToastContext.Provider, { value: { toasts, addToast, removeToast, clearAll }, children: children });
52
+ }
53
+ function useToastContext() {
54
+ const context = (0, react_1.useContext)(ToastContext);
55
+ if (!context) {
56
+ throw new Error("useToastContext must be used within ToastProvider");
57
+ }
58
+ return context;
59
+ }
@@ -0,0 +1,4 @@
1
+ export { setToastContext, toast } from "./toastApi";
2
+ export { Toast, ToastContainer } from "./ToastComponents";
3
+ export { ToastProvider, useToastContext } from "./ToastContext";
4
+ export type { ToastItem, ToastType } from "./ToastContext";
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.useToastContext = exports.ToastProvider = exports.ToastContainer = exports.Toast = exports.toast = exports.setToastContext = void 0;
4
+ var toastApi_1 = require("./toastApi");
5
+ Object.defineProperty(exports, "setToastContext", { enumerable: true, get: function () { return toastApi_1.setToastContext; } });
6
+ Object.defineProperty(exports, "toast", { enumerable: true, get: function () { return toastApi_1.toast; } });
7
+ var ToastComponents_1 = require("./ToastComponents");
8
+ Object.defineProperty(exports, "Toast", { enumerable: true, get: function () { return ToastComponents_1.Toast; } });
9
+ Object.defineProperty(exports, "ToastContainer", { enumerable: true, get: function () { return ToastComponents_1.ToastContainer; } });
10
+ var ToastContext_1 = require("./ToastContext");
11
+ Object.defineProperty(exports, "ToastProvider", { enumerable: true, get: function () { return ToastContext_1.ToastProvider; } });
12
+ Object.defineProperty(exports, "useToastContext", { enumerable: true, get: function () { return ToastContext_1.useToastContext; } });
@@ -0,0 +1,21 @@
1
+ import { ToastType } from "./ToastContext";
2
+ export declare function setToastContext(context: {
3
+ addToast: (type: ToastType, message: string, duration?: number) => string;
4
+ removeToast: (id: string) => void;
5
+ clearAll: () => void;
6
+ }): void;
7
+ export declare const toast: {
8
+ success: (message: string, options?: {
9
+ duration?: number;
10
+ }) => any;
11
+ error: (message: string, options?: {
12
+ duration?: number;
13
+ }) => any;
14
+ info: (message: string, options?: {
15
+ duration?: number;
16
+ }) => any;
17
+ warning: (message: string, options?: {
18
+ duration?: number;
19
+ }) => any;
20
+ dismiss: (toastId?: string) => void;
21
+ };