@b3dotfun/sdk 0.0.65-test.1 → 0.0.65

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 (229) hide show
  1. package/dist/cjs/anyspend/react/components/AnySpend.js +33 -73
  2. package/dist/cjs/anyspend/react/components/AnySpendCustom.js +1 -1
  3. package/dist/cjs/anyspend/react/components/common/CryptoPaymentMethod.js +1 -1
  4. package/dist/cjs/anyspend/react/components/common/FeeDetailPanel.js +1 -1
  5. package/dist/cjs/anyspend/react/components/common/FiatPaymentMethod.js +2 -2
  6. package/dist/cjs/anyspend/react/components/common/OrderHistory.d.ts +1 -1
  7. package/dist/cjs/anyspend/react/components/common/OrderHistory.js +3 -7
  8. package/dist/cjs/anyspend/react/components/common/PanelOnrampPayment.js +1 -1
  9. package/dist/cjs/anyspend/react/components/common/PointsDetailPanel.js +1 -1
  10. package/dist/cjs/anyspend/react/components/common/RecipientSelection.js +1 -1
  11. package/dist/cjs/global-account/react/components/AccountAssets/AccountAssets.js +2 -38
  12. package/dist/cjs/global-account/react/components/AvatarEditor/AvatarEditor.js +33 -139
  13. package/dist/cjs/global-account/react/components/B3DynamicModal.js +6 -25
  14. package/dist/cjs/global-account/react/components/LinkAccount/LinkAccount.d.ts +4 -6
  15. package/dist/cjs/global-account/react/components/LinkAccount/LinkAccount.js +279 -113
  16. package/dist/cjs/global-account/react/components/ManageAccount/BalanceContent.js +2 -2
  17. package/dist/cjs/global-account/react/components/ManageAccount/ManageAccount.js +193 -24
  18. package/dist/cjs/global-account/react/components/index.d.ts +2 -4
  19. package/dist/cjs/global-account/react/components/index.js +4 -11
  20. package/dist/cjs/global-account/react/components/ui/Tabs.js +2 -2
  21. package/dist/cjs/global-account/react/components/ui/dialog.js +2 -2
  22. package/dist/cjs/global-account/react/hooks/index.d.ts +1 -1
  23. package/dist/cjs/global-account/react/hooks/index.js +1 -3
  24. package/dist/cjs/global-account/react/hooks/useB3BalanceFromAddresses.js +0 -1
  25. package/dist/cjs/global-account/react/stores/index.d.ts +0 -1
  26. package/dist/cjs/global-account/react/stores/index.js +1 -3
  27. package/dist/cjs/global-account/react/stores/useModalStore.d.ts +3 -34
  28. package/dist/cjs/global-account/react/utils/profileDisplay.d.ts +0 -2
  29. package/dist/cjs/global-account/react/utils/profileDisplay.js +2 -2
  30. package/dist/cjs/shared/constants/chains/supported.d.ts +2 -2
  31. package/dist/cjs/shared/utils/ipfs.js +1 -1
  32. package/dist/esm/anyspend/react/components/AnySpend.js +34 -74
  33. package/dist/esm/anyspend/react/components/AnySpendCustom.js +1 -1
  34. package/dist/esm/anyspend/react/components/common/CryptoPaymentMethod.js +1 -1
  35. package/dist/esm/anyspend/react/components/common/FeeDetailPanel.js +1 -1
  36. package/dist/esm/anyspend/react/components/common/FiatPaymentMethod.js +2 -2
  37. package/dist/esm/anyspend/react/components/common/OrderHistory.d.ts +1 -1
  38. package/dist/esm/anyspend/react/components/common/OrderHistory.js +5 -6
  39. package/dist/esm/anyspend/react/components/common/PanelOnrampPayment.js +1 -1
  40. package/dist/esm/anyspend/react/components/common/PointsDetailPanel.js +1 -1
  41. package/dist/esm/anyspend/react/components/common/RecipientSelection.js +1 -1
  42. package/dist/esm/global-account/react/components/AccountAssets/AccountAssets.js +2 -38
  43. package/dist/esm/global-account/react/components/AvatarEditor/AvatarEditor.js +34 -140
  44. package/dist/esm/global-account/react/components/B3DynamicModal.js +6 -25
  45. package/dist/esm/global-account/react/components/LinkAccount/LinkAccount.d.ts +4 -6
  46. package/dist/esm/global-account/react/components/LinkAccount/LinkAccount.js +280 -113
  47. package/dist/esm/global-account/react/components/ManageAccount/BalanceContent.js +2 -2
  48. package/dist/esm/global-account/react/components/ManageAccount/ManageAccount.js +195 -26
  49. package/dist/esm/global-account/react/components/index.d.ts +2 -4
  50. package/dist/esm/global-account/react/components/index.js +2 -7
  51. package/dist/esm/global-account/react/components/ui/Tabs.js +2 -2
  52. package/dist/esm/global-account/react/components/ui/dialog.js +2 -2
  53. package/dist/esm/global-account/react/hooks/index.d.ts +1 -1
  54. package/dist/esm/global-account/react/hooks/index.js +1 -1
  55. package/dist/esm/global-account/react/hooks/useB3BalanceFromAddresses.js +0 -1
  56. package/dist/esm/global-account/react/stores/index.d.ts +0 -1
  57. package/dist/esm/global-account/react/stores/index.js +0 -1
  58. package/dist/esm/global-account/react/stores/useModalStore.d.ts +3 -34
  59. package/dist/esm/global-account/react/utils/profileDisplay.d.ts +0 -2
  60. package/dist/esm/global-account/react/utils/profileDisplay.js +2 -2
  61. package/dist/esm/shared/constants/chains/supported.d.ts +2 -2
  62. package/dist/esm/shared/utils/ipfs.js +1 -1
  63. package/dist/styles/index.css +1 -1
  64. package/dist/types/anyspend/react/components/common/OrderHistory.d.ts +1 -1
  65. package/dist/types/global-account/react/components/LinkAccount/LinkAccount.d.ts +4 -6
  66. package/dist/types/global-account/react/components/index.d.ts +2 -4
  67. package/dist/types/global-account/react/hooks/index.d.ts +1 -1
  68. package/dist/types/global-account/react/stores/index.d.ts +0 -1
  69. package/dist/types/global-account/react/stores/useModalStore.d.ts +3 -34
  70. package/dist/types/global-account/react/utils/profileDisplay.d.ts +0 -2
  71. package/dist/types/shared/constants/chains/supported.d.ts +2 -2
  72. package/package.json +1 -1
  73. package/src/anyspend/react/components/AnySpend.tsx +167 -225
  74. package/src/anyspend/react/components/AnySpendCustom.tsx +1 -1
  75. package/src/anyspend/react/components/common/CryptoPaymentMethod.tsx +1 -1
  76. package/src/anyspend/react/components/common/FeeDetailPanel.tsx +1 -1
  77. package/src/anyspend/react/components/common/FiatPaymentMethod.tsx +2 -2
  78. package/src/anyspend/react/components/common/OrderHistory.tsx +13 -8
  79. package/src/anyspend/react/components/common/PanelOnrampPayment.tsx +1 -1
  80. package/src/anyspend/react/components/common/PointsDetailPanel.tsx +1 -1
  81. package/src/anyspend/react/components/common/RecipientSelection.tsx +1 -1
  82. package/src/global-account/react/components/AccountAssets/AccountAssets.tsx +25 -115
  83. package/src/global-account/react/components/AvatarEditor/AvatarEditor.tsx +126 -303
  84. package/src/global-account/react/components/B3DynamicModal.tsx +6 -28
  85. package/src/global-account/react/components/LinkAccount/LinkAccount.tsx +433 -332
  86. package/src/global-account/react/components/ManageAccount/BalanceContent.tsx +3 -2
  87. package/src/global-account/react/components/ManageAccount/ManageAccount.tsx +589 -73
  88. package/src/global-account/react/components/index.ts +2 -9
  89. package/src/global-account/react/components/ui/Tabs.tsx +13 -5
  90. package/src/global-account/react/components/ui/dialog.tsx +14 -32
  91. package/src/global-account/react/hooks/index.ts +0 -3
  92. package/src/global-account/react/hooks/useB3BalanceFromAddresses.ts +0 -1
  93. package/src/global-account/react/stores/index.ts +0 -1
  94. package/src/global-account/react/stores/useModalStore.ts +2 -39
  95. package/src/global-account/react/utils/profileDisplay.ts +2 -4
  96. package/src/shared/utils/ipfs.ts +1 -1
  97. package/src/styles/index.css +1 -6
  98. package/dist/cjs/global-account/react/components/Deposit/Deposit.d.ts +0 -1
  99. package/dist/cjs/global-account/react/components/Deposit/Deposit.js +0 -65
  100. package/dist/cjs/global-account/react/components/LinkAccount/LinkNewAccount.d.ts +0 -4
  101. package/dist/cjs/global-account/react/components/LinkAccount/LinkNewAccount.js +0 -331
  102. package/dist/cjs/global-account/react/components/ManageAccount/AppsContent.d.ts +0 -6
  103. package/dist/cjs/global-account/react/components/ManageAccount/AppsContent.js +0 -34
  104. package/dist/cjs/global-account/react/components/ManageAccount/BottomNavigation.d.ts +0 -2
  105. package/dist/cjs/global-account/react/components/ManageAccount/BottomNavigation.js +0 -23
  106. package/dist/cjs/global-account/react/components/ManageAccount/Header.d.ts +0 -3
  107. package/dist/cjs/global-account/react/components/ManageAccount/Header.js +0 -120
  108. package/dist/cjs/global-account/react/components/ManageAccount/HomeActions.d.ts +0 -5
  109. package/dist/cjs/global-account/react/components/ManageAccount/HomeActions.js +0 -43
  110. package/dist/cjs/global-account/react/components/ManageAccount/HomeContent.d.ts +0 -6
  111. package/dist/cjs/global-account/react/components/ManageAccount/HomeContent.js +0 -16
  112. package/dist/cjs/global-account/react/components/ManageAccount/NFTContent.d.ts +0 -2
  113. package/dist/cjs/global-account/react/components/ManageAccount/NFTContent.js +0 -15
  114. package/dist/cjs/global-account/react/components/ManageAccount/ProfileSection.d.ts +0 -2
  115. package/dist/cjs/global-account/react/components/ManageAccount/ProfileSection.js +0 -44
  116. package/dist/cjs/global-account/react/components/ManageAccount/SettingsContent.d.ts +0 -7
  117. package/dist/cjs/global-account/react/components/ManageAccount/SettingsContent.js +0 -50
  118. package/dist/cjs/global-account/react/components/ManageAccount/SettingsMenuItem.d.ts +0 -9
  119. package/dist/cjs/global-account/react/components/ManageAccount/SettingsMenuItem.js +0 -8
  120. package/dist/cjs/global-account/react/components/ManageAccount/SettingsProfileCard.d.ts +0 -2
  121. package/dist/cjs/global-account/react/components/ManageAccount/SettingsProfileCard.js +0 -38
  122. package/dist/cjs/global-account/react/components/ManageAccount/TokenContent.d.ts +0 -2
  123. package/dist/cjs/global-account/react/components/ManageAccount/TokenContent.js +0 -22
  124. package/dist/cjs/global-account/react/components/ModalHeader/ModalHeader.d.ts +0 -10
  125. package/dist/cjs/global-account/react/components/ModalHeader/ModalHeader.js +0 -12
  126. package/dist/cjs/global-account/react/components/Send/Send.d.ts +0 -5
  127. package/dist/cjs/global-account/react/components/Send/Send.js +0 -187
  128. package/dist/cjs/global-account/react/components/icons/BellIcon.d.ts +0 -3
  129. package/dist/cjs/global-account/react/components/icons/BellIcon.js +0 -5
  130. package/dist/cjs/global-account/react/components/icons/ChevronDownIcon.d.ts +0 -2
  131. package/dist/cjs/global-account/react/components/icons/ChevronDownIcon.js +0 -7
  132. package/dist/cjs/global-account/react/components/icons/CopyIcon.d.ts +0 -2
  133. package/dist/cjs/global-account/react/components/icons/CopyIcon.js +0 -7
  134. package/dist/cjs/global-account/react/components/icons/LinkIcon.d.ts +0 -3
  135. package/dist/cjs/global-account/react/components/icons/LinkIcon.js +0 -5
  136. package/dist/cjs/global-account/react/components/icons/LockIcon.d.ts +0 -3
  137. package/dist/cjs/global-account/react/components/icons/LockIcon.js +0 -5
  138. package/dist/cjs/global-account/react/components/icons/WalletIcon.d.ts +0 -2
  139. package/dist/cjs/global-account/react/components/icons/WalletIcon.js +0 -7
  140. package/dist/cjs/global-account/react/stores/useRecentAddressesStore.d.ts +0 -25
  141. package/dist/cjs/global-account/react/stores/useRecentAddressesStore.js +0 -36
  142. package/dist/esm/global-account/react/components/Deposit/Deposit.d.ts +0 -1
  143. package/dist/esm/global-account/react/components/Deposit/Deposit.js +0 -59
  144. package/dist/esm/global-account/react/components/LinkAccount/LinkNewAccount.d.ts +0 -4
  145. package/dist/esm/global-account/react/components/LinkAccount/LinkNewAccount.js +0 -325
  146. package/dist/esm/global-account/react/components/ManageAccount/AppsContent.d.ts +0 -6
  147. package/dist/esm/global-account/react/components/ManageAccount/AppsContent.js +0 -32
  148. package/dist/esm/global-account/react/components/ManageAccount/BottomNavigation.d.ts +0 -2
  149. package/dist/esm/global-account/react/components/ManageAccount/BottomNavigation.js +0 -21
  150. package/dist/esm/global-account/react/components/ManageAccount/Header.d.ts +0 -3
  151. package/dist/esm/global-account/react/components/ManageAccount/Header.js +0 -81
  152. package/dist/esm/global-account/react/components/ManageAccount/HomeActions.d.ts +0 -5
  153. package/dist/esm/global-account/react/components/ManageAccount/HomeActions.js +0 -41
  154. package/dist/esm/global-account/react/components/ManageAccount/HomeContent.d.ts +0 -6
  155. package/dist/esm/global-account/react/components/ManageAccount/HomeContent.js +0 -10
  156. package/dist/esm/global-account/react/components/ManageAccount/NFTContent.d.ts +0 -2
  157. package/dist/esm/global-account/react/components/ManageAccount/NFTContent.js +0 -13
  158. package/dist/esm/global-account/react/components/ManageAccount/ProfileSection.d.ts +0 -2
  159. package/dist/esm/global-account/react/components/ManageAccount/ProfileSection.js +0 -42
  160. package/dist/esm/global-account/react/components/ManageAccount/SettingsContent.d.ts +0 -7
  161. package/dist/esm/global-account/react/components/ManageAccount/SettingsContent.js +0 -45
  162. package/dist/esm/global-account/react/components/ManageAccount/SettingsMenuItem.d.ts +0 -9
  163. package/dist/esm/global-account/react/components/ManageAccount/SettingsMenuItem.js +0 -6
  164. package/dist/esm/global-account/react/components/ManageAccount/SettingsProfileCard.d.ts +0 -2
  165. package/dist/esm/global-account/react/components/ManageAccount/SettingsProfileCard.js +0 -36
  166. package/dist/esm/global-account/react/components/ManageAccount/TokenContent.d.ts +0 -2
  167. package/dist/esm/global-account/react/components/ManageAccount/TokenContent.js +0 -20
  168. package/dist/esm/global-account/react/components/ModalHeader/ModalHeader.d.ts +0 -10
  169. package/dist/esm/global-account/react/components/ModalHeader/ModalHeader.js +0 -10
  170. package/dist/esm/global-account/react/components/Send/Send.d.ts +0 -5
  171. package/dist/esm/global-account/react/components/Send/Send.js +0 -181
  172. package/dist/esm/global-account/react/components/icons/BellIcon.d.ts +0 -3
  173. package/dist/esm/global-account/react/components/icons/BellIcon.js +0 -3
  174. package/dist/esm/global-account/react/components/icons/ChevronDownIcon.d.ts +0 -2
  175. package/dist/esm/global-account/react/components/icons/ChevronDownIcon.js +0 -4
  176. package/dist/esm/global-account/react/components/icons/CopyIcon.d.ts +0 -2
  177. package/dist/esm/global-account/react/components/icons/CopyIcon.js +0 -4
  178. package/dist/esm/global-account/react/components/icons/LinkIcon.d.ts +0 -3
  179. package/dist/esm/global-account/react/components/icons/LinkIcon.js +0 -3
  180. package/dist/esm/global-account/react/components/icons/LockIcon.d.ts +0 -3
  181. package/dist/esm/global-account/react/components/icons/LockIcon.js +0 -3
  182. package/dist/esm/global-account/react/components/icons/WalletIcon.d.ts +0 -2
  183. package/dist/esm/global-account/react/components/icons/WalletIcon.js +0 -4
  184. package/dist/esm/global-account/react/stores/useRecentAddressesStore.d.ts +0 -25
  185. package/dist/esm/global-account/react/stores/useRecentAddressesStore.js +0 -33
  186. package/dist/types/global-account/react/components/Deposit/Deposit.d.ts +0 -1
  187. package/dist/types/global-account/react/components/LinkAccount/LinkNewAccount.d.ts +0 -4
  188. package/dist/types/global-account/react/components/ManageAccount/AppsContent.d.ts +0 -6
  189. package/dist/types/global-account/react/components/ManageAccount/BottomNavigation.d.ts +0 -2
  190. package/dist/types/global-account/react/components/ManageAccount/Header.d.ts +0 -3
  191. package/dist/types/global-account/react/components/ManageAccount/HomeActions.d.ts +0 -5
  192. package/dist/types/global-account/react/components/ManageAccount/HomeContent.d.ts +0 -6
  193. package/dist/types/global-account/react/components/ManageAccount/NFTContent.d.ts +0 -2
  194. package/dist/types/global-account/react/components/ManageAccount/ProfileSection.d.ts +0 -2
  195. package/dist/types/global-account/react/components/ManageAccount/SettingsContent.d.ts +0 -7
  196. package/dist/types/global-account/react/components/ManageAccount/SettingsMenuItem.d.ts +0 -9
  197. package/dist/types/global-account/react/components/ManageAccount/SettingsProfileCard.d.ts +0 -2
  198. package/dist/types/global-account/react/components/ManageAccount/TokenContent.d.ts +0 -2
  199. package/dist/types/global-account/react/components/ModalHeader/ModalHeader.d.ts +0 -10
  200. package/dist/types/global-account/react/components/Send/Send.d.ts +0 -5
  201. package/dist/types/global-account/react/components/icons/BellIcon.d.ts +0 -3
  202. package/dist/types/global-account/react/components/icons/ChevronDownIcon.d.ts +0 -2
  203. package/dist/types/global-account/react/components/icons/CopyIcon.d.ts +0 -2
  204. package/dist/types/global-account/react/components/icons/LinkIcon.d.ts +0 -3
  205. package/dist/types/global-account/react/components/icons/LockIcon.d.ts +0 -3
  206. package/dist/types/global-account/react/components/icons/WalletIcon.d.ts +0 -2
  207. package/dist/types/global-account/react/stores/useRecentAddressesStore.d.ts +0 -25
  208. package/src/global-account/react/components/Deposit/Deposit.tsx +0 -211
  209. package/src/global-account/react/components/LinkAccount/LinkNewAccount.tsx +0 -490
  210. package/src/global-account/react/components/ManageAccount/AppsContent.tsx +0 -79
  211. package/src/global-account/react/components/ManageAccount/BottomNavigation.tsx +0 -83
  212. package/src/global-account/react/components/ManageAccount/Header.tsx +0 -230
  213. package/src/global-account/react/components/ManageAccount/HomeActions.tsx +0 -118
  214. package/src/global-account/react/components/ManageAccount/HomeContent.tsx +0 -42
  215. package/src/global-account/react/components/ManageAccount/NFTContent.tsx +0 -24
  216. package/src/global-account/react/components/ManageAccount/ProfileSection.tsx +0 -74
  217. package/src/global-account/react/components/ManageAccount/SettingsContent.tsx +0 -87
  218. package/src/global-account/react/components/ManageAccount/SettingsMenuItem.tsx +0 -31
  219. package/src/global-account/react/components/ManageAccount/SettingsProfileCard.tsx +0 -74
  220. package/src/global-account/react/components/ManageAccount/TokenContent.tsx +0 -41
  221. package/src/global-account/react/components/ModalHeader/ModalHeader.tsx +0 -50
  222. package/src/global-account/react/components/Send/Send.tsx +0 -585
  223. package/src/global-account/react/components/icons/BellIcon.tsx +0 -15
  224. package/src/global-account/react/components/icons/ChevronDownIcon.tsx +0 -17
  225. package/src/global-account/react/components/icons/CopyIcon.tsx +0 -22
  226. package/src/global-account/react/components/icons/LinkIcon.tsx +0 -15
  227. package/src/global-account/react/components/icons/LockIcon.tsx +0 -15
  228. package/src/global-account/react/components/icons/WalletIcon.tsx +0 -21
  229. package/src/global-account/react/stores/useRecentAddressesStore.ts +0 -55
@@ -2,8 +2,7 @@
2
2
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
3
  import { getDefaultToken, USDC_BASE } from "../../../anyspend/index.js";
4
4
  import { useAnyspendCreateOnrampOrder, useAnyspendCreateOrder, useAnyspendOrderAndTransactions, useAnyspendQuote, useGeoOnrampOptions, } from "../../../anyspend/react/index.js";
5
- import { Button, ShinyButton, StyleRoot, TabsPrimitive, TransitionPanel, useAccountWallet, useB3, useModalStore, useProfile, useRouter, useSearchParamsSSR, useTokenBalanceDirect, useTokenData, useTokenFromUrl, } from "../../../global-account/react/index.js";
6
- import BottomNavigation from "../../../global-account/react/components/ManageAccount/BottomNavigation.js";
5
+ import { Button, ShinyButton, StyleRoot, TransitionPanel, useAccountWallet, useProfile, useRouter, useSearchParamsSSR, useTokenBalanceDirect, useTokenData, useTokenFromUrl, } from "../../../global-account/react/index.js";
7
6
  import { cn } from "../../../shared/utils/cn.js";
8
7
  import { formatTokenAmount } from "../../../shared/utils/number.js";
9
8
  import invariant from "invariant";
@@ -11,7 +10,6 @@ import { ArrowDown, HistoryIcon, Loader2 } from "lucide-react";
11
10
  import { motion } from "motion/react";
12
11
  import { useCallback, useEffect, useMemo, useRef, useState } from "react";
13
12
  import { toast } from "sonner";
14
- import { defineChain } from "thirdweb";
15
13
  import { parseUnits } from "viem";
16
14
  import { base, mainnet } from "viem/chains";
17
15
  import { useAutoSelectCryptoPaymentMethod } from "../hooks/useAutoSelectCryptoPaymentMethod.js";
@@ -50,25 +48,6 @@ export function AnySpend(props) {
50
48
  function AnySpendInner({ destinationTokenAddress, destinationTokenChainId, mode = "modal", defaultActiveTab = "crypto", loadOrder, hideTransactionHistoryButton, recipientAddress: recipientAddressFromProps, onTokenSelect, onSuccess, customUsdInputValues, }) {
51
49
  const searchParams = useSearchParamsSSR();
52
50
  const router = useRouter();
53
- const { partnerId } = useB3();
54
- const setB3ModalContentType = useModalStore(state => state.setB3ModalContentType);
55
- // Define base chain with RPC for modal props
56
- const baseChain = useMemo(() => defineChain({
57
- id: 8453,
58
- name: "Base",
59
- nativeCurrency: {
60
- name: "Ether",
61
- symbol: "ETH",
62
- decimals: 18,
63
- },
64
- rpc: "https://mainnet.base.org",
65
- blockExplorers: [
66
- {
67
- name: "Basescan",
68
- url: "https://basescan.org",
69
- },
70
- ],
71
- }), []);
72
51
  // Determine if we're in "buy mode" based on whether destination token props are provided
73
52
  const isBuyMode = !!(destinationTokenAddress && destinationTokenChainId);
74
53
  // Add refs to track URL state
@@ -620,10 +599,6 @@ function AnySpendInner({ destinationTokenAddress, destinationTokenChainId, mode
620
599
  const onClickHistory = () => {
621
600
  setOrderId(undefined);
622
601
  navigateToPanel(PanelView.HISTORY, "forward");
623
- setB3ModalContentType({
624
- type: "anySpendOrderHistory",
625
- showBackButton: false,
626
- });
627
602
  // Remove orderId and paymentMethod from URL when going back to history
628
603
  const params = new URLSearchParams(searchParams.toString());
629
604
  params.delete("orderId");
@@ -785,58 +760,43 @@ function AnySpendInner({ destinationTokenAddress, destinationTokenChainId, mode
785
760
  };
786
761
  }, [activePanel, navigateBack]);
787
762
  const historyView = (_jsx("div", { className: "mx-auto flex w-[560px] max-w-full flex-col items-center", children: _jsx(OrderHistory, { mode: mode, onBack: navigateBack, onSelectOrder: onSelectOrder }) }));
788
- const orderDetailsView = (_jsx("div", { className: "mx-auto w-[460px] max-w-full px-5", children: _jsx("div", { className: "relative flex flex-col gap-4", children: oat && (_jsx(OrderDetails, { mode: mode, order: oat.data.order, depositTxs: oat.data.depositTxs, relayTxs: oat.data.relayTxs, executeTx: oat.data.executeTx, refundTxs: oat.data.refundTxs, selectedCryptoPaymentMethod: selectedCryptoPaymentMethod, onPaymentMethodChange: setSelectedCryptoPaymentMethod, points: oat.data.points || undefined, onBack: () => {
763
+ const orderDetailsView = (_jsx("div", { className: "mx-auto w-[460px] max-w-full", children: _jsx("div", { className: "relative flex flex-col gap-4", children: oat && (_jsx(OrderDetails, { mode: mode, order: oat.data.order, depositTxs: oat.data.depositTxs, relayTxs: oat.data.relayTxs, executeTx: oat.data.executeTx, refundTxs: oat.data.refundTxs, selectedCryptoPaymentMethod: selectedCryptoPaymentMethod, onPaymentMethodChange: setSelectedCryptoPaymentMethod, points: oat.data.points || undefined, onBack: () => {
789
764
  setOrderId(undefined);
790
765
  navigateBack();
791
766
  setSelectedCryptoPaymentMethod(CryptoPaymentMethodType.NONE); // Reset payment method when going back
792
767
  } })) }) }));
793
- const mainView = (_jsxs("div", { className: "mx-auto flex w-[460px] max-w-full flex-col items-center gap-2", children: [_jsxs("div", { className: "flex w-full max-w-full flex-col items-center gap-2 px-5", children: [isBuyMode && (_jsxs("div", { className: "mb-4 flex flex-col items-center gap-3 text-center", children: [selectedDstToken.metadata?.logoURI && (_jsx("div", { className: "relative", children: _jsx("img", { src: selectedDstToken.metadata.logoURI, alt: selectedDstToken.symbol, className: "border-as-stroke h-12 w-12 rounded-full border-2 shadow-md" }) })), _jsx("div", { children: _jsxs("h1", { className: "text-as-primary text-xl font-bold", children: ["Buy ", selectedDstToken.symbol] }) })] })), _jsx(TabSection, { activeTab: activeTab, setActiveTab: setActiveTab, setSelectedCryptoPaymentMethod: setSelectedCryptoPaymentMethod, setSelectedFiatPaymentMethod: setSelectedFiatPaymentMethod }), _jsxs("div", { className: "relative flex w-full max-w-[calc(100vw-32px)] flex-col gap-2", children: [activeTab === "crypto" ? (_jsx(CryptoPaySection, { selectedSrcChainId: selectedSrcChainId, setSelectedSrcChainId: setSelectedSrcChainId, selectedSrcToken: selectedSrcToken, setSelectedSrcToken: setSelectedSrcToken, srcAmount: srcAmount, setSrcAmount: setSrcAmount, isSrcInputDirty: isSrcInputDirty, setIsSrcInputDirty: setIsSrcInputDirty, selectedCryptoPaymentMethod: selectedCryptoPaymentMethod, onSelectCryptoPaymentMethod: () => navigateToPanel(PanelView.CRYPTO_PAYMENT_METHOD, "forward"), anyspendQuote: anyspendQuote, onTokenSelect: onTokenSelect, onShowFeeDetail: () => navigateToPanel(PanelView.FEE_DETAIL, "forward") })) : (_jsx(motion.div, { initial: { opacity: 0, y: 20, filter: "blur(10px)" }, animate: { opacity: 1, y: 0, filter: "blur(0px)" }, transition: { duration: 0.3, delay: 0, ease: "easeInOut" }, children: _jsx(PanelOnramp, { srcAmountOnRamp: srcAmountOnRamp, setSrcAmountOnRamp: setSrcAmountOnRamp, selectedPaymentMethod: selectedFiatPaymentMethod, setActivePanel: (panelIndex) => {
794
- // Map panel index to navigation with direction
795
- const panelsWithForwardNav = [PanelView.FIAT_PAYMENT_METHOD, PanelView.RECIPIENT_SELECTION];
796
- if (panelsWithForwardNav.includes(panelIndex)) {
797
- navigateToPanel(panelIndex, "forward");
798
- }
799
- else {
800
- setActivePanel(panelIndex);
801
- }
802
- }, _recipientAddress: recipientAddress, destinationToken: selectedDstToken, destinationChainId: selectedDstChainId, destinationAmount: dstAmount, onDestinationTokenChange: setSelectedDstToken, onDestinationChainChange: setSelectedDstChainId, fiatPaymentMethodIndex: PanelView.FIAT_PAYMENT_METHOD, recipientSelectionPanelIndex: PanelView.RECIPIENT_SELECTION, hideDstToken: isBuyMode, anyspendQuote: anyspendQuote, onShowPointsDetail: () => navigateToPanel(PanelView.POINTS_DETAIL, "forward"), onShowFeeDetail: () => navigateToPanel(PanelView.FEE_DETAIL, "forward"), customUsdInputValues: customUsdInputValues }) })), _jsx(Button, { variant: "ghost", className: cn("border-as-stroke bg-as-surface-primary absolute left-1/2 top-1/2 z-10 h-10 w-10 -translate-x-1/2 -translate-y-1/2 rounded-xl border-2 sm:h-8 sm:w-8 sm:rounded-xl", isBuyMode && "top-[calc(50%+56px)] cursor-default", activeTab === "fiat" && "hidden"), onClick: () => {
803
- if (activeTab === "fiat" || isBuyMode) {
804
- return;
805
- }
806
- // Swap chain selections
807
- const tempSrcChainId = selectedSrcChainId;
808
- const tempDstChainId = selectedDstChainId;
809
- setSelectedSrcChainId(tempDstChainId);
810
- setSelectedDstChainId(tempSrcChainId);
811
- // Swap token selections
812
- const tempSrcToken = selectedSrcToken;
813
- const tempDstToken = selectedDstToken;
814
- setSelectedSrcToken(tempDstToken);
815
- setSelectedDstToken(tempSrcToken);
816
- // Swap amounts
817
- const tempSrcAmount = srcAmount;
818
- const tempDstAmount = dstAmount;
819
- setSrcAmount(tempDstAmount);
820
- setDstAmount(tempSrcAmount);
821
- }, children: _jsx("div", { className: "relative flex items-center justify-center transition-opacity", children: _jsx(ArrowDown, { className: "text-as-primary/50 h-5 w-5" }) }) }), activeTab === "crypto" && (_jsx(CryptoReceiveSection, { isDepositMode: false, isBuyMode: isBuyMode, selectedRecipientAddress: recipientAddress, recipientName: recipientName || undefined, onSelectRecipient: () => navigateToPanel(PanelView.RECIPIENT_SELECTION, "forward"), setRecipientAddress: setRecipientAddress, recipientAddressFromProps: recipientAddressFromProps, globalAddress: globalAddress, dstAmount: dstAmount, dstToken: selectedDstToken, selectedDstChainId: selectedDstChainId, setSelectedDstChainId: setSelectedDstChainId, setSelectedDstToken: setSelectedDstToken, isSrcInputDirty: isSrcInputDirty, onChangeDstAmount: value => {
822
- setIsSrcInputDirty(false);
823
- setDstAmount(value);
824
- }, anyspendQuote: anyspendQuote, onShowPointsDetail: () => navigateToPanel(PanelView.POINTS_DETAIL, "forward"), onShowFeeDetail: () => navigateToPanel(PanelView.FEE_DETAIL, "forward"), selectedCryptoPaymentMethod: selectedCryptoPaymentMethod }))] }), _jsxs(motion.div, { initial: { opacity: 0, y: 20, filter: "blur(10px)" }, animate: { opacity: 1, y: 0, filter: "blur(0px)" }, transition: { duration: 0.3, delay: 0.2, ease: "easeInOut" }, className: cn("mt-4 flex w-full max-w-[460px] flex-col gap-2"), children: [_jsx(ShinyButton, { accentColor: "hsl(var(--as-brand))", disabled: btnInfo.disable, onClick: onMainButtonClick, className: cn("as-main-button relative w-full", btnInfo.error ? "!bg-as-red" : btnInfo.disable ? "!bg-as-on-surface-2" : "!bg-as-brand"), textClassName: cn(btnInfo.error ? "text-white" : btnInfo.disable ? "text-as-secondary" : "text-white"), children: _jsxs("div", { className: "flex items-center justify-center gap-2", children: [btnInfo.loading && _jsx(Loader2, { className: "h-4 w-4 animate-spin" }), btnInfo.text] }) }), !hideTransactionHistoryButton && (globalAddress || recipientAddress) ? (_jsxs(Button, { variant: "link", onClick: onClickHistory, className: "text-as-primary/50 hover:text-as-primary flex items-center gap-1 transition-colors", children: [_jsx(HistoryIcon, { className: "h-4 w-4" }), " ", _jsx("span", { className: "pr-4", children: "Transaction History" })] })) : null] })] }), _jsx("div", { className: "w-full", children: _jsx(TabsPrimitive, { defaultValue: "swap", onValueChange: value => {
825
- if (value === "settings" || value === "home") {
826
- setB3ModalContentType({
827
- type: "manageAccount",
828
- activeTab: value,
829
- setActiveTab: () => { },
830
- chain: baseChain,
831
- partnerId,
832
- });
833
- }
834
- else if (value === "swap") {
835
- setB3ModalContentType({
836
- type: "anySpend",
837
- });
838
- }
839
- }, children: _jsx(BottomNavigation, {}) }) })] }));
768
+ const mainView = (_jsxs("div", { className: "mx-auto flex w-[460px] max-w-full flex-col items-center gap-2", children: [isBuyMode && (_jsxs("div", { className: "mb-4 flex flex-col items-center gap-3 text-center", children: [selectedDstToken.metadata?.logoURI && (_jsx("div", { className: "relative", children: _jsx("img", { src: selectedDstToken.metadata.logoURI, alt: selectedDstToken.symbol, className: "border-as-stroke h-12 w-12 rounded-full border-2 shadow-md" }) })), _jsx("div", { children: _jsxs("h1", { className: "text-as-primary text-xl font-bold", children: ["Buy ", selectedDstToken.symbol] }) })] })), _jsx(TabSection, { activeTab: activeTab, setActiveTab: setActiveTab, setSelectedCryptoPaymentMethod: setSelectedCryptoPaymentMethod, setSelectedFiatPaymentMethod: setSelectedFiatPaymentMethod }), _jsxs("div", { className: "relative flex w-full max-w-[calc(100vw-32px)] flex-col gap-2", children: [activeTab === "crypto" ? (_jsx(CryptoPaySection, { selectedSrcChainId: selectedSrcChainId, setSelectedSrcChainId: setSelectedSrcChainId, selectedSrcToken: selectedSrcToken, setSelectedSrcToken: setSelectedSrcToken, srcAmount: srcAmount, setSrcAmount: setSrcAmount, isSrcInputDirty: isSrcInputDirty, setIsSrcInputDirty: setIsSrcInputDirty, selectedCryptoPaymentMethod: selectedCryptoPaymentMethod, onSelectCryptoPaymentMethod: () => navigateToPanel(PanelView.CRYPTO_PAYMENT_METHOD, "forward"), anyspendQuote: anyspendQuote, onTokenSelect: onTokenSelect, onShowFeeDetail: () => navigateToPanel(PanelView.FEE_DETAIL, "forward") })) : (_jsx(motion.div, { initial: { opacity: 0, y: 20, filter: "blur(10px)" }, animate: { opacity: 1, y: 0, filter: "blur(0px)" }, transition: { duration: 0.3, delay: 0, ease: "easeInOut" }, children: _jsx(PanelOnramp, { srcAmountOnRamp: srcAmountOnRamp, setSrcAmountOnRamp: setSrcAmountOnRamp, selectedPaymentMethod: selectedFiatPaymentMethod, setActivePanel: (panelIndex) => {
769
+ // Map panel index to navigation with direction
770
+ const panelsWithForwardNav = [PanelView.FIAT_PAYMENT_METHOD, PanelView.RECIPIENT_SELECTION];
771
+ if (panelsWithForwardNav.includes(panelIndex)) {
772
+ navigateToPanel(panelIndex, "forward");
773
+ }
774
+ else {
775
+ setActivePanel(panelIndex);
776
+ }
777
+ }, _recipientAddress: recipientAddress, destinationToken: selectedDstToken, destinationChainId: selectedDstChainId, destinationAmount: dstAmount, onDestinationTokenChange: setSelectedDstToken, onDestinationChainChange: setSelectedDstChainId, fiatPaymentMethodIndex: PanelView.FIAT_PAYMENT_METHOD, recipientSelectionPanelIndex: PanelView.RECIPIENT_SELECTION, hideDstToken: isBuyMode, anyspendQuote: anyspendQuote, onShowPointsDetail: () => navigateToPanel(PanelView.POINTS_DETAIL, "forward"), onShowFeeDetail: () => navigateToPanel(PanelView.FEE_DETAIL, "forward"), customUsdInputValues: customUsdInputValues }) })), _jsx(Button, { variant: "ghost", className: cn("border-as-stroke bg-as-surface-primary absolute left-1/2 top-1/2 z-10 h-10 w-10 -translate-x-1/2 -translate-y-1/2 rounded-xl border-2 sm:h-8 sm:w-8 sm:rounded-xl", isBuyMode && "top-[calc(50%+56px)] cursor-default", activeTab === "fiat" && "hidden"), onClick: () => {
778
+ if (activeTab === "fiat" || isBuyMode) {
779
+ return;
780
+ }
781
+ // Swap chain selections
782
+ const tempSrcChainId = selectedSrcChainId;
783
+ const tempDstChainId = selectedDstChainId;
784
+ setSelectedSrcChainId(tempDstChainId);
785
+ setSelectedDstChainId(tempSrcChainId);
786
+ // Swap token selections
787
+ const tempSrcToken = selectedSrcToken;
788
+ const tempDstToken = selectedDstToken;
789
+ setSelectedSrcToken(tempDstToken);
790
+ setSelectedDstToken(tempSrcToken);
791
+ // Swap amounts
792
+ const tempSrcAmount = srcAmount;
793
+ const tempDstAmount = dstAmount;
794
+ setSrcAmount(tempDstAmount);
795
+ setDstAmount(tempSrcAmount);
796
+ }, children: _jsx("div", { className: "relative flex items-center justify-center transition-opacity", children: _jsx(ArrowDown, { className: "text-as-primary/50 h-5 w-5" }) }) }), activeTab === "crypto" && (_jsx(CryptoReceiveSection, { isDepositMode: false, isBuyMode: isBuyMode, selectedRecipientAddress: recipientAddress, recipientName: recipientName || undefined, onSelectRecipient: () => navigateToPanel(PanelView.RECIPIENT_SELECTION, "forward"), setRecipientAddress: setRecipientAddress, recipientAddressFromProps: recipientAddressFromProps, globalAddress: globalAddress, dstAmount: dstAmount, dstToken: selectedDstToken, selectedDstChainId: selectedDstChainId, setSelectedDstChainId: setSelectedDstChainId, setSelectedDstToken: setSelectedDstToken, isSrcInputDirty: isSrcInputDirty, onChangeDstAmount: value => {
797
+ setIsSrcInputDirty(false);
798
+ setDstAmount(value);
799
+ }, anyspendQuote: anyspendQuote, onShowPointsDetail: () => navigateToPanel(PanelView.POINTS_DETAIL, "forward"), onShowFeeDetail: () => navigateToPanel(PanelView.FEE_DETAIL, "forward"), selectedCryptoPaymentMethod: selectedCryptoPaymentMethod }))] }), _jsxs(motion.div, { initial: { opacity: 0, y: 20, filter: "blur(10px)" }, animate: { opacity: 1, y: 0, filter: "blur(0px)" }, transition: { duration: 0.3, delay: 0.2, ease: "easeInOut" }, className: cn("mt-4 flex w-full max-w-[460px] flex-col gap-2"), children: [_jsx(ShinyButton, { accentColor: "hsl(var(--as-brand))", disabled: btnInfo.disable, onClick: onMainButtonClick, className: cn("as-main-button relative w-full", btnInfo.error ? "!bg-as-red" : btnInfo.disable ? "!bg-as-on-surface-2" : "!bg-as-brand"), textClassName: cn(btnInfo.error ? "text-white" : btnInfo.disable ? "text-as-secondary" : "text-white"), children: _jsxs("div", { className: "flex items-center justify-center gap-2", children: [btnInfo.loading && _jsx(Loader2, { className: "h-4 w-4 animate-spin" }), btnInfo.text] }) }), !hideTransactionHistoryButton && (globalAddress || recipientAddress) ? (_jsxs(Button, { variant: "link", onClick: onClickHistory, className: "text-as-primary/50 hover:text-as-primary flex items-center gap-1 transition-colors", children: [_jsx(HistoryIcon, { className: "h-4 w-4" }), " ", _jsx("span", { className: "pr-4", children: "Transaction History" })] })) : null] })] }));
840
800
  const onrampPaymentView = (_jsx(PanelOnrampPayment, { srcAmountOnRamp: srcAmountOnRamp, recipientName: recipientName || undefined, recipientAddress: recipientAddress, isBuyMode: isBuyMode, destinationTokenChainId: destinationTokenChainId, destinationTokenAddress: destinationTokenAddress, selectedDstChainId: selectedDstChainId, selectedDstToken: selectedDstToken, orderType: "swap", anyspendQuote: anyspendQuote, globalAddress: globalAddress, onOrderCreated: orderId => {
841
801
  setOrderId(orderId);
842
802
  navigateToPanel(PanelView.ORDER_DETAILS, "forward");
@@ -437,7 +437,7 @@ function AnySpendCustomInner({ loadOrder, mode = "modal", activeTab: activeTabPr
437
437
  : orderType === "join_tournament"
438
438
  ? "Join for"
439
439
  : "Recipient" }), _jsxs("div", { className: "flex items-center gap-2", children: [recipientAddress ? (_jsx("button", { className: cn("text-as-tertiarry flex h-7 items-center gap-2 rounded-lg"), onClick: () => setActivePanel(PanelView.RECIPIENT_SELECTION), children: _jsx(_Fragment, { children: _jsx("div", { className: "text-as-tertiarry flex items-center gap-1 text-sm", children: _jsx("span", { children: recipientName ? formatUsername(recipientName) : shortenAddress(recipientAddress) }) }) }) })) : (_jsx("button", { className: "text-as-primary/70 flex items-center gap-1 rounded-lg", onClick: () => setActivePanel(PanelView.RECIPIENT_SELECTION), children: _jsx("div", { className: "text-sm font-medium", children: "Select recipient" }) })), _jsx(ChevronRight, { className: "h-4 w-4" })] })] }, recipientAddress)) : null;
440
- const historyView = (_jsx("div", { className: cn("mx-auto flex w-full max-w-2xl flex-col items-center", mode === "modal" && "bg-b3-react-background"), children: _jsx(OrderHistory, { mode: mode, onBack: () => {
440
+ const historyView = (_jsx("div", { className: cn("mx-auto flex w-full max-w-2xl flex-col items-center p-5", mode === "modal" && "bg-b3-react-background"), children: _jsx(OrderHistory, { mode: mode, onBack: () => {
441
441
  setActivePanel(PanelView.HISTORY);
442
442
  }, onSelectOrder: onSelectOrder }) }));
443
443
  const orderDetailsView = (_jsxs("div", { className: cn("mx-auto flex w-full flex-col items-center gap-4 p-5", mode === "modal" && "bg-b3-react-background rounded-xl"), children: [oat && (_jsx(OrderDetails, { mode: mode, order: oat.data.order, depositTxs: oat.data.depositTxs, relayTxs: oat.data.relayTxs, executeTx: oat.data.executeTx, refundTxs: oat.data.refundTxs, cryptoPaymentMethod: activeTab === "fiat" ? CryptoPaymentMethodType.NONE : selectedCryptoPaymentMethod, selectedCryptoPaymentMethod: selectedCryptoPaymentMethod, onPaymentMethodChange: setSelectedCryptoPaymentMethod, onBack: () => {
@@ -156,7 +156,7 @@ export function CryptoPaymentMethod({ selectedPaymentMethod, setSelectedPaymentM
156
156
  }
157
157
  }
158
158
  };
159
- return (_jsxs("div", { className: "crypto-payment-method mx-auto h-fit w-[460px] max-w-full px-5 pb-5", children: [_jsxs("div", { className: cn("relative flex flex-col gap-10"), children: [_jsx("button", { onClick: onBack, className: "text-as-quaternary hover:text-as-primary absolute flex h-8 w-8 items-center justify-center rounded-lg transition-colors", children: _jsx(ChevronLeft, { className: "h-6 w-6" }) }), _jsx("div", { className: "flex items-center justify-around gap-4", children: _jsx("div", { className: "flex-1 text-center", children: _jsx("h2", { className: "text-as-primary text-lg font-semibold", children: "Select a payment method" }) }) }), _jsxs("div", { className: "crypto-payment-methods flex flex-col gap-4", children: [(shouldShowConnectedEOA || shouldShowWagmiWallet || globalAddress) && (_jsxs("div", { className: "installed-wallets", children: [_jsx("h3", { className: "text-as-primary/80 mb-3 text-sm font-medium", children: "Connected wallets" }), _jsxs("div", { className: "space-y-2", children: [shouldShowConnectedEOA && (_jsx("button", { onClick: () => {
159
+ return (_jsxs("div", { className: "crypto-payment-method mx-auto h-fit w-[460px] max-w-full", children: [_jsxs("div", { className: cn("relative flex flex-col gap-10"), children: [_jsx("button", { onClick: onBack, className: "text-as-quaternary hover:text-as-primary absolute flex h-8 w-8 items-center justify-center rounded-lg transition-colors", children: _jsx(ChevronLeft, { className: "h-6 w-6" }) }), _jsx("div", { className: "flex items-center justify-around gap-4", children: _jsx("div", { className: "flex-1 text-center", children: _jsx("h2", { className: "text-as-primary text-lg font-semibold", children: "Select a payment method" }) }) }), _jsxs("div", { className: "crypto-payment-methods flex flex-col gap-4", children: [(shouldShowConnectedEOA || shouldShowWagmiWallet || globalAddress) && (_jsxs("div", { className: "installed-wallets", children: [_jsx("h3", { className: "text-as-primary/80 mb-3 text-sm font-medium", children: "Connected wallets" }), _jsxs("div", { className: "space-y-2", children: [shouldShowConnectedEOA && (_jsx("button", { onClick: () => {
160
160
  setSelectedPaymentMethod(CryptoPaymentMethodType.CONNECT_WALLET);
161
161
  onSelectPaymentMethod(CryptoPaymentMethodType.CONNECT_WALLET);
162
162
  if (connectedEOAWallet) {
@@ -59,7 +59,7 @@ export function FeeDetailPanel({ fee, transactionAmountUsd, onBack }) {
59
59
  // State for expanding tier lists
60
60
  const [showAllFeeTiers, setShowAllFeeTiers] = useState(false);
61
61
  const [showAllDiscountTiers, setShowAllDiscountTiers] = useState(false);
62
- return (_jsx("div", { className: "mx-auto flex w-[460px] max-w-full flex-col items-center gap-3 px-5", children: _jsxs("div", { className: "flex w-full flex-col gap-3", children: [_jsx("div", { className: "text-center", children: _jsx("h3", { className: "text-as-primary text-lg font-bold", children: "Fee Breakdown" }) }), _jsxs("div", { className: "bg-as-surface-secondary border-as-border-secondary rounded-2xl border p-4", children: [_jsx("h4", { className: "text-as-primary mb-3 text-sm font-semibold", children: isStripeFee ? "Fiat Fee Schedule" : "Base Fee Schedule" }), _jsx("div", { className: "space-y-1.5", children: isStripeFee
62
+ return (_jsx("div", { className: "mx-auto flex w-[460px] max-w-full flex-col items-center gap-3", children: _jsxs("div", { className: "flex w-full flex-col gap-3", children: [_jsx("div", { className: "text-center", children: _jsx("h3", { className: "text-as-primary text-lg font-bold", children: "Fee Breakdown" }) }), _jsxs("div", { className: "bg-as-surface-secondary border-as-border-secondary rounded-2xl border p-4", children: [_jsx("h4", { className: "text-as-primary mb-3 text-sm font-semibold", children: isStripeFee ? "Fiat Fee Schedule" : "Base Fee Schedule" }), _jsx("div", { className: "space-y-1.5", children: isStripeFee
63
63
  ? FIAT_FEE_TIERS.map((tier, idx) => {
64
64
  const isCurrentTier = currentFiatTier?.label === tier.label;
65
65
  const currentTierIndex = FIAT_FEE_TIERS.findIndex(t => t.label === currentFiatTier?.label);
@@ -56,9 +56,9 @@ export function FiatPaymentMethodComponent({ selectedPaymentMethod, setSelectedP
56
56
  }
57
57
  // Show loading state while checking geo availability
58
58
  if (isLoadingGeoOnramp) {
59
- return (_jsx("div", { className: "fiat-payment-method mx-auto w-[460px] max-w-full px-5", children: _jsxs("div", { className: "flex flex-col gap-6", children: [_jsxs("div", { className: "flex items-center gap-4", children: [_jsx("button", { onClick: onBack, className: "text-as-quaternary hover:text-as-primary flex h-8 w-8 items-center justify-center rounded-lg transition-colors", children: _jsx(ChevronLeft, { className: "h-6 w-6" }) }), _jsx("div", { className: "flex-1", children: _jsx("h2", { className: "text-as-primary text-lg font-semibold", children: "Choose payment method" }) })] }), _jsxs("div", { className: "flex items-center justify-center py-8", children: [_jsx(Loader2, { className: "h-6 w-6 animate-spin" }), _jsx("span", { className: "text-as-secondary ml-2 text-sm", children: "Loading payment methods..." })] })] }) }));
59
+ return (_jsx("div", { className: "fiat-payment-method mx-auto w-[460px] max-w-full", children: _jsxs("div", { className: "flex flex-col gap-6", children: [_jsxs("div", { className: "flex items-center gap-4", children: [_jsx("button", { onClick: onBack, className: "text-as-quaternary hover:text-as-primary flex h-8 w-8 items-center justify-center rounded-lg transition-colors", children: _jsx(ChevronLeft, { className: "h-6 w-6" }) }), _jsx("div", { className: "flex-1", children: _jsx("h2", { className: "text-as-primary text-lg font-semibold", children: "Choose payment method" }) })] }), _jsxs("div", { className: "flex items-center justify-center py-8", children: [_jsx(Loader2, { className: "h-6 w-6 animate-spin" }), _jsx("span", { className: "text-as-secondary ml-2 text-sm", children: "Loading payment methods..." })] })] }) }));
60
60
  }
61
- return (_jsx("div", { className: "fiat-payment-method mx-auto w-[460px] max-w-full px-5", children: _jsxs("div", { className: "flex flex-col gap-6", children: [_jsxs("div", { className: "flex items-center gap-4", children: [_jsx("button", { onClick: onBack, className: "text-as-quaternary hover:text-as-primary flex h-8 w-8 items-center justify-center rounded-lg transition-colors", children: _jsx(ChevronLeft, { className: "h-6 w-6" }) }), _jsx("div", { className: "flex-1", children: _jsx("h2", { className: "text-as-primary text-lg font-semibold", children: "Choose payment method" }) })] }), _jsx("div", { className: "flex flex-col gap-3", children: availablePaymentMethods.length === 0 ? (_jsx("div", { className: "fiat-payment-method-no-methods bg-as-surface-secondary border-as-border-secondary rounded-2xl border p-6 text-center", children: _jsx("p", { className: "text-as-secondary text-sm", children: "No payment methods available in your region for the selected amount." }) })) : (availablePaymentMethods.map(method => (_jsxs("button", { onClick: () => {
61
+ return (_jsx("div", { className: "fiat-payment-method mx-auto w-[460px] max-w-full", children: _jsxs("div", { className: "flex flex-col gap-6", children: [_jsxs("div", { className: "flex items-center gap-4", children: [_jsx("button", { onClick: onBack, className: "text-as-quaternary hover:text-as-primary flex h-8 w-8 items-center justify-center rounded-lg transition-colors", children: _jsx(ChevronLeft, { className: "h-6 w-6" }) }), _jsx("div", { className: "flex-1", children: _jsx("h2", { className: "text-as-primary text-lg font-semibold", children: "Choose payment method" }) })] }), _jsx("div", { className: "flex flex-col gap-3", children: availablePaymentMethods.length === 0 ? (_jsx("div", { className: "fiat-payment-method-no-methods bg-as-surface-secondary border-as-border-secondary rounded-2xl border p-6 text-center", children: _jsx("p", { className: "text-as-secondary text-sm", children: "No payment methods available in your region for the selected amount." }) })) : (availablePaymentMethods.map(method => (_jsxs("button", { onClick: () => {
62
62
  setSelectedPaymentMethod(method.id);
63
63
  onSelectPaymentMethod(method.id);
64
64
  }, className: cn("fiat-payment-method-item bg-as-surface-secondary border-as-border-secondary flex w-full items-center gap-4 rounded-2xl border p-4 transition-all duration-200", selectedPaymentMethod === method.id
@@ -1,6 +1,6 @@
1
1
  interface OrderHistoryProps {
2
2
  mode: "modal" | "page";
3
- onBack?: () => void;
3
+ onBack: () => void;
4
4
  onSelectOrder?: (orderId: string) => void;
5
5
  }
6
6
  export declare function OrderHistory({ mode, onBack, onSelectOrder }: OrderHistoryProps): import("react/jsx-runtime").JSX.Element;
@@ -1,16 +1,15 @@
1
1
  "use client";
2
- import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
3
3
  import { useAnyspendOrderHistory } from "../../../../anyspend/react/index.js";
4
4
  import { Button, Skeleton, useAccountWallet } from "../../../../global-account/react/index.js";
5
- import ModalHeader from "../../../../global-account/react/components/ModalHeader/ModalHeader.js";
6
- import { RefreshCcw } from "lucide-react";
5
+ import { ArrowLeft, RefreshCcw } from "lucide-react";
7
6
  import { OrderHistoryItem } from "./OrderHistoryItem.js";
8
7
  export function OrderHistory({ mode, onBack, onSelectOrder }) {
9
8
  const { address } = useAccountWallet();
10
9
  const { orderHistory, isLoadingOrderHistory, refetchOrderHistory } = useAnyspendOrderHistory(address);
11
- return (_jsxs(_Fragment, { children: [_jsx(ModalHeader, { title: "Order History", showCloseButton: false, handleBack: onBack, className: "w-full", children: _jsx(Button, { variant: "ghost", size: "icon", className: "hover:bg-as-surface-secondary", onClick: () => {
12
- refetchOrderHistory();
13
- }, children: _jsx(RefreshCcw, { className: "text-as-secondary hover:text-as-primary h-5 w-5 cursor-pointer transition-all hover:rotate-180" }) }) }), isLoadingOrderHistory ? (_jsx("div", { className: "w-full space-y-3 px-5", children: [1, 2, 3].map(i => (_jsx(Skeleton, { className: "h-[180px] w-full rounded-2xl" }, i))) })) : !orderHistory?.length ? (_jsx("div", { className: "bg-as-surface-secondary w-full rounded-2xl p-12 px-5 text-center", children: _jsx("p", { className: "text-as-secondary text-sm", children: "No order history found" }) })) : (_jsx("div", { className: "mb-12 w-full space-y-3 px-5 pt-5", children: [...orderHistory]
10
+ return (_jsxs(_Fragment, { children: [_jsxs("div", { className: "mb-8 flex w-full items-center gap-3", children: [_jsx(Button, { onClick: onBack, variant: "ghost", size: "icon", className: "hover:bg-as-surface-secondary", children: _jsx(ArrowLeft, { className: "h-5 w-5" }) }), _jsx("div", { className: "flex-1", children: _jsx("h3", { className: "text-as-primary text-2xl font-bold", children: "Order History" }) }), _jsx(Button, { variant: "ghost", size: "icon", className: "hover:bg-as-surface-secondary", onClick: () => {
11
+ refetchOrderHistory();
12
+ }, children: _jsx(RefreshCcw, { className: "text-as-secondary hover:text-as-primary h-5 w-5 cursor-pointer transition-all hover:rotate-180" }) })] }), isLoadingOrderHistory ? (_jsx("div", { className: "w-full space-y-3", children: [1, 2, 3].map(i => (_jsx(Skeleton, { className: "h-[180px] w-full rounded-2xl" }, i))) })) : !orderHistory?.length ? (_jsx("div", { className: "bg-as-surface-secondary w-full rounded-2xl p-12 text-center", children: _jsx("p", { className: "text-as-secondary text-sm", children: "No order history found" }) })) : (_jsx("div", { className: "mb-12 w-full space-y-3", children: [...orderHistory]
14
13
  .sort((a, b) => b.createdAt - a.createdAt)
15
14
  .map(order => (_jsx(OrderHistoryItem, { order: order, onSelectOrder: onSelectOrder, mode: mode }, order.id))) }))] }));
16
15
  }
@@ -82,7 +82,7 @@ function PanelOnrampPaymentInner(props) {
82
82
  toast.error("Failed to create order: " + err.message);
83
83
  }
84
84
  };
85
- return (_jsxs("div", { className: "mx-auto flex w-full max-w-[460px] flex-col gap-6 px-5", children: [_jsxs(_Fragment, { children: [_jsx("h2", { className: "-mb-3 text-lg font-semibold", children: "Order summary" }), _jsxs("div", { className: "bg-b3-react-background border-b3-react-border flex flex-col gap-3 rounded-lg border p-4", children: [recipientAddress && (_jsxs(motion.div, { initial: false, animate: {
85
+ return (_jsxs("div", { className: "mx-auto flex w-full max-w-[460px] flex-col gap-6", children: [_jsxs(_Fragment, { children: [_jsx("h2", { className: "-mb-3 text-lg font-semibold", children: "Order summary" }), _jsxs("div", { className: "bg-b3-react-background border-b3-react-border flex flex-col gap-3 rounded-lg border p-4", children: [recipientAddress && (_jsxs(motion.div, { initial: false, animate: {
86
86
  opacity: 1,
87
87
  y: 0,
88
88
  filter: "blur(0px)",
@@ -3,5 +3,5 @@ import { ShinyButton } from "../../../../global-account/react/index.js";
3
3
  import { cn } from "../../../../shared/utils/cn.js";
4
4
  import Link from "next/link";
5
5
  export function PointsDetailPanel({ pointsAmount = 0, onBack }) {
6
- return (_jsx("div", { className: "mx-auto flex w-[460px] max-w-full flex-col items-center gap-4 px-5", children: _jsxs("div", { className: "flex flex-col items-center gap-4 text-center", children: [_jsx("h3", { className: "text-as-primary text-xl font-bold", children: "Earn Points with Every Swap" }), _jsxs("p", { className: "text-as-primary/70 text-balance text-sm leading-relaxed", children: ["You'll earn ", _jsxs("span", { className: "text-as-brand font-semibold", children: ["+", pointsAmount.toLocaleString(), " points"] }), " ", "towards the", " ", _jsx(Link, { href: "https://anyspend.com/points", target: "_blank", className: "text-as-brand underline", children: "next AnySpend airdrop" }), " ", "when you complete this transaction."] }), _jsxs("div", { className: "bg-as-surface-primary border-as-border-secondary mt-2 w-full rounded-lg border p-4 text-left", children: [_jsx("h4", { className: "text-as-primary mb-2 font-semibold", children: "How it works:" }), _jsxs("ul", { className: "text-as-primary/70 space-y-1 text-sm", children: [_jsx("li", { children: "\u2022 Points are earned based on transaction volume" }), _jsx("li", { children: "\u2022 Higher volume = more points" }), _jsx("li", { children: "\u2022 Points contribute to future airdrops" }), _jsx("li", { children: "\u2022 Keep swapping to maximize your rewards" })] })] }), _jsx(ShinyButton, { accentColor: "hsl(var(--as-brand))", onClick: onBack, className: cn("as-main-button !bg-as-brand relative w-full"), textClassName: cn("text-white"), children: "Back to Swap" })] }) }));
6
+ return (_jsx("div", { className: "mx-auto flex w-[460px] max-w-full flex-col items-center gap-4", children: _jsxs("div", { className: "flex flex-col items-center gap-4 text-center", children: [_jsx("h3", { className: "text-as-primary text-xl font-bold", children: "Earn Points with Every Swap" }), _jsxs("p", { className: "text-as-primary/70 text-balance text-sm leading-relaxed", children: ["You'll earn ", _jsxs("span", { className: "text-as-brand font-semibold", children: ["+", pointsAmount.toLocaleString(), " points"] }), " ", "towards the", " ", _jsx(Link, { href: "https://anyspend.com/points", target: "_blank", className: "text-as-brand underline", children: "next AnySpend airdrop" }), " ", "when you complete this transaction."] }), _jsxs("div", { className: "bg-as-surface-primary border-as-border-secondary mt-2 w-full rounded-lg border p-4 text-left", children: [_jsx("h4", { className: "text-as-primary mb-2 font-semibold", children: "How it works:" }), _jsxs("ul", { className: "text-as-primary/70 space-y-1 text-sm", children: [_jsx("li", { children: "\u2022 Points are earned based on transaction volume" }), _jsx("li", { children: "\u2022 Higher volume = more points" }), _jsx("li", { children: "\u2022 Points contribute to future airdrops" }), _jsx("li", { children: "\u2022 Keep swapping to maximize your rewards" })] })] }), _jsx(ShinyButton, { accentColor: "hsl(var(--as-brand))", onClick: onBack, className: cn("as-main-button !bg-as-brand relative w-full"), textClassName: cn("text-white"), children: "Back to Swap" })] }) }));
7
7
  }
@@ -29,5 +29,5 @@ export function RecipientSelection({ initialValue = "", placeholder = "Enter rec
29
29
  };
30
30
  const isAddressValid = !validateAddress || !recipientAddress || validateAddress(recipientAddress);
31
31
  const canConfirm = recipientAddress && isAddressValid;
32
- return (_jsx("div", { className: "recipient-selection mx-auto w-[460px] max-w-full px-5", children: _jsxs("div", { className: "flex flex-col gap-6", children: [_jsxs("div", { className: "flex justify-around", children: [_jsx("button", { onClick: onBack, className: "text-as-quaternary hover:text-as-primary flex h-8 w-8 items-center justify-center rounded-lg transition-colors", children: _jsx(ChevronLeft, { className: "h-6 w-6" }) }), _jsxs("div", { className: "flex-1 text-center", children: [_jsx("h2", { className: "text-as-primary text-lg font-semibold", children: title }), _jsx("p", { className: "text-as-primary/60 text-sm", children: description })] })] }), _jsxs("div", { className: "flex flex-col gap-4", children: [_jsxs("div", { className: "bg-as-surface-secondary border-as-border-secondary flex h-12 w-full overflow-hidden rounded-xl border", children: [_jsx("input", { type: "text", placeholder: placeholder, value: recipientAddress, onChange: e => setRecipientAddress(e.target.value), onKeyDown: handleKeyDown, className: "text-as-primary placeholder:text-as-primary/50 flex-1 bg-transparent px-4 text-base focus:outline-none", autoFocus: autoFocus }), _jsx("div", { className: "border-as-border-secondary border-l", children: _jsx("button", { onClick: handlePaste, className: "text-as-primary/70 hover:text-as-primary hover:bg-as-surface-primary h-full px-4 font-semibold transition-colors", children: "Paste" }) })] }), recipientAddress && !isAddressValid && (_jsx("div", { className: "text-as-red text-sm", children: "Please enter a valid address" })), _jsx("button", { onClick: handleConfirm, disabled: !canConfirm, className: "bg-as-brand hover:bg-as-brand/90 disabled:bg-as-on-surface-2 disabled:text-as-secondary h-12 w-full rounded-xl font-medium text-white transition-colors disabled:cursor-not-allowed", children: confirmText })] })] }) }));
32
+ return (_jsx("div", { className: "recipient-selection mx-auto w-[460px] max-w-full", children: _jsxs("div", { className: "flex flex-col gap-6", children: [_jsxs("div", { className: "flex justify-around", children: [_jsx("button", { onClick: onBack, className: "text-as-quaternary hover:text-as-primary flex h-8 w-8 items-center justify-center rounded-lg transition-colors", children: _jsx(ChevronLeft, { className: "h-6 w-6" }) }), _jsxs("div", { className: "flex-1 text-center", children: [_jsx("h2", { className: "text-as-primary text-lg font-semibold", children: title }), _jsx("p", { className: "text-as-primary/60 text-sm", children: description })] })] }), _jsxs("div", { className: "flex flex-col gap-4", children: [_jsxs("div", { className: "bg-as-surface-secondary border-as-border-secondary flex h-12 w-full overflow-hidden rounded-xl border", children: [_jsx("input", { type: "text", placeholder: placeholder, value: recipientAddress, onChange: e => setRecipientAddress(e.target.value), onKeyDown: handleKeyDown, className: "text-as-primary placeholder:text-as-primary/50 flex-1 bg-transparent px-4 text-base focus:outline-none", autoFocus: autoFocus }), _jsx("div", { className: "border-as-border-secondary border-l", children: _jsx("button", { onClick: handlePaste, className: "text-as-primary/70 hover:text-as-primary hover:bg-as-surface-primary h-full px-4 font-semibold transition-colors", children: "Paste" }) })] }), recipientAddress && !isAddressValid && (_jsx("div", { className: "text-as-red text-sm", children: "Please enter a valid address" })), _jsx("button", { onClick: handleConfirm, disabled: !canConfirm, className: "bg-as-brand hover:bg-as-brand/90 disabled:bg-as-on-surface-2 disabled:text-as-secondary h-12 w-full rounded-xl font-medium text-white transition-colors disabled:cursor-not-allowed", children: confirmText })] })] }) }));
33
33
  }
@@ -1,46 +1,10 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { useState } from "react";
3
2
  export function AccountAssets({ nfts, isLoading }) {
4
- // Initialize with all collections expanded
5
- const [expandedCollections, setExpandedCollections] = useState(() => new Set(collections.map(c => c.collection_id)));
6
3
  if (isLoading) {
7
- return (_jsx("div", { className: "flex flex-col gap-3", children: [...Array(2)].map((_, i) => (_jsxs("div", { className: "animate-pulse", children: [_jsx("div", { className: "bg-b3-react-muted mb-3 h-6 w-48 rounded" }), _jsxs("div", { className: "flex gap-3", children: [_jsx("div", { className: "bg-b3-react-muted h-[98px] w-[98px] shrink-0 rounded-lg" }), _jsx("div", { className: "bg-b3-react-muted h-[98px] w-[98px] shrink-0 rounded-lg" })] })] }, i))) }));
4
+ return (_jsx("div", { className: "grid animate-pulse grid-cols-2 gap-4", children: [...Array(4)].map((_, i) => (_jsx("div", { className: "bg-b3-react-muted aspect-square rounded-lg" }, i))) }));
8
5
  }
9
6
  if (!nfts?.nfts?.length) {
10
7
  return _jsx("div", { className: "text-b3-react-muted-foreground py-8 text-center", children: "No NFTs found" });
11
8
  }
12
- // Group NFTs by collection
13
- const groupedNFTs = nfts.nfts.reduce((acc, nft) => {
14
- const collectionId = nft.collection?.collection_id || "unknown";
15
- if (!acc[collectionId]) {
16
- acc[collectionId] = {
17
- collection_id: collectionId,
18
- collection_name: nft.collection?.name || "Unknown Collection",
19
- collection_image: nft.collection?.image_url || nft.previews?.image_small_url || "",
20
- nfts: [],
21
- };
22
- }
23
- acc[collectionId].nfts.push(nft);
24
- return acc;
25
- }, {});
26
- const collections = Object.values(groupedNFTs);
27
- const toggleCollection = (collectionId) => {
28
- setExpandedCollections(prev => {
29
- const next = new Set(prev);
30
- if (next.has(collectionId)) {
31
- next.delete(collectionId);
32
- }
33
- else {
34
- next.add(collectionId);
35
- }
36
- return next;
37
- });
38
- };
39
- return (_jsx("div", { className: "flex flex-col gap-3 px-4", children: collections.map(collection => {
40
- const isExpanded = expandedCollections.has(collection.collection_id);
41
- return (_jsxs("div", { className: "flex flex-col gap-3", children: [_jsxs("button", { onClick: () => toggleCollection(collection.collection_id), className: "flex w-full items-center justify-between", children: [_jsxs("div", { className: "flex items-center gap-1", children: [collection.collection_image && (_jsx("img", { src: collection.collection_image, alt: collection.collection_name, className: "h-5 w-5 shrink-0 rounded object-cover" })), _jsxs("p", { className: "font-neue-montreal-medium text-[14px] text-[#3f3f46]", children: [collection.collection_name, " (", collection.nfts.length, ")"] })] }), _jsx("svg", { className: `h-[18px] w-[18px] shrink-0 transition-transform ${isExpanded ? "rotate-180" : ""}`, viewBox: "0 0 18 18", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: _jsx("path", { d: "M4.5 6.75L9 11.25L13.5 6.75", stroke: "#51525C", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }) })] }), isExpanded && (_jsx("div", { className: "flex gap-3 overflow-x-auto", children: collection.nfts.map(nft => (_jsx("div", { className: "relative h-[98px] w-[98px] shrink-0 overflow-hidden rounded-lg", children: _jsx("img", { src: nft.previews?.image_medium_url ||
42
- nft.extra_metadata?.image_original_url ||
43
- nft.collection?.image_url ||
44
- "", alt: nft.name || "NFT", className: "h-full w-full object-cover" }) }, nft.nft_id))) }))] }, collection.collection_id));
45
- }) }));
9
+ return (_jsx("div", { className: "grid grid-cols-2 gap-4", children: nfts.nfts.map(nft => (_jsx("div", { className: "group relative aspect-square overflow-hidden", children: _jsxs("div", { className: "relative h-full w-full overflow-hidden rounded-xl", children: [_jsx("img", { src: nft.previews?.image_medium_url || nft.extra_metadata?.image_original_url || nft.collection?.image_url, alt: nft.name || "NFT", className: "h-full w-full rounded-xl object-cover" }), _jsxs("div", { className: "absolute inset-0 flex flex-col justify-end bg-gradient-to-t from-black from-35% via-black/70 to-transparent p-3 opacity-0 transition-all duration-200 ease-in-out group-hover:opacity-100", children: [_jsx("p", { className: "font-neue-montreal-bold text-[16px] text-white drop-shadow-[0_1px_2px_rgba(0,0,0,1)]", children: nft.name || `#${nft.token_id}` }), _jsx("p", { className: "font-neue-montreal-bold text-sm text-white/95 drop-shadow-[0_1px_2px_rgba(0,0,0,1)]", children: nft.collection?.name })] })] }) }, nft.nft_id))) }));
46
10
  }
@@ -4,42 +4,27 @@ import app from "../../../../global-account/app.js";
4
4
  import { Button, useB3, useProfile } from "../../../../global-account/react/index.js";
5
5
  import { cn } from "../../../../shared/utils/cn.js";
6
6
  import { debugB3React } from "../../../../shared/utils/debug.js";
7
- import { getIpfsUrl } from "../../../../shared/utils/ipfs.js";
8
7
  import { client } from "../../../../shared/utils/thirdweb.js";
9
- import { Loader2, Upload, X } from "lucide-react";
8
+ import { Check, Loader2, Upload, X } from "lucide-react";
10
9
  import { useRef, useState } from "react";
11
10
  import { toast } from "sonner";
12
11
  import { useActiveAccount } from "thirdweb/react";
13
12
  import { upload } from "thirdweb/storage";
14
- import { useProfileSettings } from "../../hooks/useProfile.js";
15
- import { useModalStore } from "../../stores/index.js";
16
- import ModalHeader from "../ModalHeader/ModalHeader.js";
17
13
  const debug = debugB3React("AvatarEditor");
18
14
  export function AvatarEditor({ onSetAvatar, className }) {
19
- const [viewStep, setViewStep] = useState("select");
20
- const [selectedAvatar, setSelectedAvatar] = useState(null);
21
- const [hoveredProfile, setHoveredProfile] = useState(null);
22
15
  const [selectedFile, setSelectedFile] = useState(null);
23
16
  const [previewUrl, setPreviewUrl] = useState(null);
24
17
  const [isUploading, setIsUploading] = useState(false);
25
18
  const [isSaving, setIsSaving] = useState(false);
26
- const [isDragging, setIsDragging] = useState(false);
27
19
  const fileInputRef = useRef(null);
28
- const { setUser, user, partnerId } = useB3();
29
- const setB3ModalContentType = useModalStore(state => state.setB3ModalContentType);
30
- const setB3ModalOpen = useModalStore(state => state.setB3ModalOpen);
31
- const contentType = useModalStore(state => state.contentType);
32
- const { setPreference } = useProfileSettings();
20
+ const { setUser } = useB3();
33
21
  const account = useActiveAccount();
34
22
  const { data: profile, refetch: refreshProfile } = useProfile({
35
23
  address: account?.address,
36
24
  fresh: true,
37
25
  });
38
- const currentAvatar = user?.avatar
39
- ? getIpfsUrl(user?.avatar)
40
- : profile?.avatar
41
- ? getIpfsUrl(profile.avatar)
42
- : undefined;
26
+ // Thirdweb upload function
27
+ const hasAvatar = profile?.avatar;
43
28
  const handleFileSelect = (event) => {
44
29
  const file = event.target.files?.[0];
45
30
  if (file) {
@@ -57,11 +42,9 @@ export function AvatarEditor({ onSetAvatar, className }) {
57
42
  // Create preview URL
58
43
  const url = URL.createObjectURL(file);
59
44
  setPreviewUrl(url);
60
- setSelectedAvatar(url);
61
45
  }
62
46
  };
63
- const handleRemovePreview = () => {
64
- setSelectedAvatar(currentAvatar || null);
47
+ const handleRemoveFile = () => {
65
48
  setSelectedFile(null);
66
49
  if (previewUrl) {
67
50
  URL.revokeObjectURL(previewUrl);
@@ -71,138 +54,49 @@ export function AvatarEditor({ onSetAvatar, className }) {
71
54
  fileInputRef.current.value = "";
72
55
  }
73
56
  };
74
- const handleSaveChanges = async () => {
75
- if (!account?.address) {
76
- toast.error("No account connected");
57
+ const handleUpload = async () => {
58
+ if (!selectedFile) {
59
+ toast.error("Please select an image first");
77
60
  return;
78
61
  }
79
- setIsSaving(true);
62
+ setIsUploading(true);
80
63
  try {
81
- // If user uploaded a new file
82
- if (selectedFile) {
83
- debug("Starting upload to IPFS", selectedFile);
84
- // Upload to IPFS using Thirdweb
85
- const ipfsUrl = await upload({
86
- client,
87
- files: [selectedFile],
88
- });
89
- debug("Upload successful", ipfsUrl);
90
- // Save avatar URL using profiles service
91
- const user = await app.service("users").setAvatar({
92
- avatar: ipfsUrl,
93
- },
94
- // @ts-expect-error - our typed client is expecting context even though it's set elsewhere
95
- {});
96
- // update user
97
- // @ts-expect-error this resolved fine, look into why expect-error needed
98
- setUser(user);
99
- toast.success("Looks great! Your avatar has been saved!");
100
- }
101
- else if (selectedAvatar && selectedAvatar !== currentAvatar) {
102
- // User selected from existing profile avatars
103
- // Find the profile that matches the selected avatar
104
- const selectedProfile = profile?.profiles?.find(p => p.avatar === selectedAvatar);
105
- if (selectedProfile && selectedProfile.type) {
106
- debug("Setting profile preference to:", selectedProfile.type);
107
- // Set preference for this profile type
108
- await setPreference(account.address, selectedProfile.type, account.address, async (message) => {
109
- // Sign the message using the active account
110
- const signature = await account.signMessage({ message });
111
- return signature;
112
- });
113
- toast.success("Avatar updated successfully!");
114
- }
115
- }
64
+ debug("Starting upload to IPFS", selectedFile);
65
+ // Upload to IPFS using Thirdweb
66
+ const ipfsUrl = await upload({
67
+ client,
68
+ files: [selectedFile],
69
+ });
70
+ debug("Upload successful", ipfsUrl);
71
+ // Save avatar URL using profiles service
72
+ setIsSaving(true);
73
+ const user = await app.service("users").setAvatar({
74
+ avatar: ipfsUrl,
75
+ },
76
+ // @ts-expect-error - our typed client is expecting context even though it's set elsewhere
77
+ {});
78
+ // update user
79
+ // @ts-expect-error this resolved fine, look into why expect-error needed
80
+ setUser(user);
116
81
  // Refresh profile to get updated avatar
117
82
  await refreshProfile();
83
+ toast.success(hasAvatar ? "Nice look! Your avatar has been updated!" : "Looks great! Your avatar has been saved!");
118
84
  onSetAvatar?.();
85
+ // Clean up
86
+ handleRemoveFile();
119
87
  }
120
88
  catch (error) {
121
- debug("Error saving avatar:", error);
122
- toast.error("Failed to save avatar. Please try again.");
89
+ debug("Error uploading avatar:", error);
90
+ toast.error("Failed to upload avatar. Please try again.");
123
91
  }
124
92
  finally {
93
+ setIsUploading(false);
125
94
  setIsSaving(false);
126
95
  }
127
96
  };
128
- const handleCancel = () => {
129
- if (viewStep === "upload") {
130
- setViewStep("select");
131
- handleRemovePreview();
132
- }
133
- else {
134
- setB3ModalContentType({
135
- type: "manageAccount",
136
- chain: contentType?.chain,
137
- partnerId: partnerId,
138
- });
139
- }
140
- };
141
- const handleProfileAvatarSelect = (avatarUrl) => {
142
- setSelectedAvatar(avatarUrl);
143
- };
144
- const handleUploadImageClick = () => {
145
- setViewStep("upload");
146
- };
147
- const handleOpenFilePicker = () => {
97
+ const handleFileInputClick = () => {
148
98
  fileInputRef.current?.click();
149
99
  };
150
- const handleDragEnter = (e) => {
151
- e.preventDefault();
152
- e.stopPropagation();
153
- setIsDragging(true);
154
- };
155
- const handleDragLeave = (e) => {
156
- e.preventDefault();
157
- e.stopPropagation();
158
- setIsDragging(false);
159
- };
160
- const handleDragOver = (e) => {
161
- e.preventDefault();
162
- e.stopPropagation();
163
- };
164
- const handleDrop = (e) => {
165
- e.preventDefault();
166
- e.stopPropagation();
167
- setIsDragging(false);
168
- const file = e.dataTransfer.files?.[0];
169
- if (file) {
170
- // Validate file type
171
- if (!file.type.startsWith("image/")) {
172
- toast.error("Please select an image file");
173
- return;
174
- }
175
- // Validate file size (max 5MB)
176
- if (file.size > 5 * 1024 * 1024) {
177
- toast.error("File size must be less than 5MB");
178
- return;
179
- }
180
- setSelectedFile(file);
181
- // Create preview URL
182
- const url = URL.createObjectURL(file);
183
- setPreviewUrl(url);
184
- setSelectedAvatar(url);
185
- }
186
- };
187
- const handleLinkMoreAccount = () => {
188
- setB3ModalContentType({
189
- type: "linkAccount",
190
- chain: contentType?.chain,
191
- partnerId: partnerId,
192
- });
193
- };
194
100
  const isLoading = isUploading || isSaving;
195
- // Get profile avatars
196
- const profileAvatars = profile?.profiles
197
- ?.filter(p => p.avatar)
198
- .map(p => ({
199
- type: p.type,
200
- avatar: getIpfsUrl(p?.avatar || ""),
201
- name: p.name || p.type,
202
- })) || [];
203
- return (_jsxs("div", { className: cn("flex w-full max-w-md flex-col bg-white", className), children: [viewStep === "upload" && _jsx(ModalHeader, { title: "Upload Image" }), _jsxs("div", { className: "flex flex-col items-center p-6", children: [viewStep === "select" ? (_jsxs(_Fragment, { children: [_jsxs("div", { className: "relative mb-6", children: [_jsx("div", { className: "h-32 w-32 overflow-hidden rounded-full", children: _jsx("img", { src: selectedAvatar || currentAvatar || "https://via.placeholder.com/128", alt: "Avatar preview", className: "h-full w-full object-cover" }) }), selectedAvatar && (_jsx("button", { onClick: handleRemovePreview, className: "absolute -right-1 -top-1 flex h-8 w-8 items-center justify-center rounded-full bg-[#51525c] text-white transition-colors hover:bg-[#71717a]", children: _jsx(X, { className: "h-4 w-4" }) }))] }), _jsxs("button", { onClick: handleUploadImageClick, className: "font-inter shadow-xs mb-6 flex w-full items-center justify-center gap-2 rounded-xl border border-[#e4e4e7] bg-white px-4 py-3 text-sm font-semibold text-[#18181b] transition-colors hover:bg-[#f4f4f5]", children: [_jsx(Upload, { className: "h-4 w-4" }), "Upload image"] }), _jsxs("div", { className: "w-full", children: [_jsx("h3", { className: "mb-2 text-base font-semibold text-[#18181b]", children: "Select your profile image" }), _jsx("p", { className: "mb-4 text-sm font-semibold text-[#475467]", children: "Pick an avatar from your linked profiles, ENS or upload a new one." }), _jsx("div", { className: "mb-4 flex gap-3", children: profileAvatars.map((profileAvatar, index) => (_jsxs("div", { className: "relative", onMouseEnter: () => setHoveredProfile(profileAvatar.type), onMouseLeave: () => setHoveredProfile(null), children: [_jsx("button", { onClick: () => handleProfileAvatarSelect(profileAvatar.avatar), className: cn("h-16 w-16 overflow-hidden rounded-full border-2 transition-all", selectedAvatar === profileAvatar.avatar
204
- ? "border-[#3368ef] ring-2 ring-[#3368ef]/20"
205
- : "border-transparent hover:border-[#e4e4e7]"), children: _jsx("img", { src: profileAvatar.avatar, alt: `${profileAvatar.type} avatar`, className: "h-full w-full object-cover" }) }), hoveredProfile === profileAvatar.type && (_jsx("div", { className: "absolute -top-10 left-1/2 -translate-x-1/2 whitespace-nowrap rounded-md bg-[#18181b] px-3 py-1.5 text-xs text-white", children: profileAvatar.name }))] }, index))) }), _jsxs("button", { onClick: handleLinkMoreAccount, className: "font-inter flex items-center gap-2 text-sm font-semibold text-[#3368ef] hover:underline", children: [_jsx("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg", className: "h-4 w-4", children: _jsx("path", { d: "M8.75 2.75C8.75 2.33579 8.41421 2 8 2C7.58579 2 7.25 2.33579 7.25 2.75V7.25H2.75C2.33579 7.25 2 7.58579 2 8C2 8.41421 2.33579 8.75 2.75 8.75H7.25V13.25C7.25 13.6642 7.58579 14 8 14C8.41421 14 8.75 13.6642 8.75 13.25V8.75H13.25C13.6642 8.75 14 8.41421 14 8C14 7.58579 13.6642 7.25 13.25 7.25H8.75V2.75Z", fill: "currentColor" }) }), "Link more account"] })] })] })) : (_jsx(_Fragment, { children: !selectedFile ? (_jsxs("div", { onClick: handleOpenFilePicker, onDragEnter: handleDragEnter, onDragLeave: handleDragLeave, onDragOver: handleDragOver, onDrop: handleDrop, className: cn("mb-6 flex w-full cursor-pointer flex-col items-center justify-center rounded-xl border-2 border-dashed p-16 transition-colors", isDragging
206
- ? "border-[#3368ef] bg-[#f0f5ff]"
207
- : "border-[#e4e4e7] hover:border-[#3368ef] hover:bg-[#f0f5ff]"), children: [_jsxs("p", { className: "font-inter mb-1 text-sm", children: [_jsx("span", { className: "font-semibold text-[#3368ef]", children: "Click to upload" }), _jsx("span", { className: "text-[#71717a]", children: " or drag and drop" })] }), _jsx("p", { className: "text-xs text-[#71717a]", children: "PNG, JPG or GIF (up to 5MB)" })] })) : (_jsx("div", { className: "mb-6 w-full", children: _jsx("div", { className: "aspect-square w-full overflow-hidden rounded-xl bg-[#f4f4f5]", children: _jsx("img", { src: previewUrl || "", alt: "Preview", className: "h-full w-full object-cover" }) }) })) })), _jsx("input", { ref: fileInputRef, type: "file", accept: "image/*", onChange: handleFileSelect, className: "hidden" })] }), _jsxs("div", { className: "font-inter flex gap-3 border-t border-[#e4e4e7] p-6 font-semibold", children: [_jsx(Button, { onClick: handleCancel, variant: "outline", disabled: isLoading, className: "flex-1 rounded-xl border-[#e4e4e7] text-[#18181b] hover:bg-[#f4f4f5]", children: "Cancel" }), _jsx(Button, { onClick: handleSaveChanges, disabled: isLoading || !selectedAvatar, className: "flex-1 rounded-xl bg-[#3368ef] text-white hover:bg-[#2952cc]", children: isLoading ? (_jsxs(_Fragment, { children: [_jsx(Loader2, { className: "mr-2 h-4 w-4 animate-spin" }), "Saving..."] })) : ("Save changes") })] })] }));
101
+ return (_jsxs("div", { className: cn("flex flex-col items-center justify-center space-y-6 p-8", className), children: [_jsxs("div", { className: "space-y-2 text-center", children: [_jsx("h2", { className: "font-neue-montreal-semibold text-b3-grey text-2xl", children: hasAvatar ? "Update Your Avatar" : "Set Your Avatar" }), _jsx("p", { className: "text-b3-foreground-muted font-neue-montreal-medium", children: "Upload an image to personalize your profile" })] }), hasAvatar && !previewUrl && (_jsx("div", { className: "relative", children: _jsx("div", { className: "border-b3-primary-blue h-32 w-32 overflow-hidden rounded-full border-4", children: _jsx("img", { src: profile.avatar, alt: "Current avatar", className: "h-full w-full object-cover" }) }) })), _jsxs("div", { className: "w-full max-w-md", children: [!selectedFile ? (_jsxs("div", { onClick: handleFileInputClick, className: "border-b3-line hover:border-b3-primary-blue hover:bg-b3-primary-wash/20 cursor-pointer rounded-xl border-2 border-dashed p-8 text-center transition-colors", children: [_jsx(Upload, { className: "text-b3-grey mx-auto mb-4 h-12 w-12" }), _jsx("p", { className: "text-b3-grey font-neue-montreal-semibold mb-2", children: "Click to select an image" }), _jsx("p", { className: "text-b3-foreground-muted font-neue-montreal-medium text-sm", children: "PNG, JPG, or GIF up to 5MB" })] })) : (_jsxs("div", { className: "space-y-4", children: [_jsxs("div", { className: "relative", children: [_jsx("div", { className: "border-b3-primary-blue mx-auto h-32 w-32 overflow-hidden rounded-full border-4", children: previewUrl ? (_jsx("img", { src: previewUrl, alt: "Preview", className: "h-full w-full object-cover" })) : (_jsx("div", { className: "bg-b3-primary-wash flex h-full w-full items-center justify-center rounded-full", children: _jsx("p", { className: "text-b3-grey font-neue-montreal-semibold text-sm", children: "No file selected" }) })) }), _jsx("button", { onClick: handleRemoveFile, className: "bg-b3-negative absolute -right-2 -top-2 flex h-8 w-8 items-center justify-center rounded-full text-white transition-colors hover:bg-red-600", disabled: isLoading, children: _jsx(X, { size: 16 }) })] }), _jsxs("div", { className: "space-y-1 text-center", children: [_jsx("p", { className: "text-b3-grey font-neue-montreal-semibold text-sm", children: selectedFile.name }), _jsxs("p", { className: "text-b3-foreground-muted font-neue-montreal-medium text-xs", children: [(selectedFile.size / 1024 / 1024).toFixed(2), " MB"] })] })] })), _jsx("input", { ref: fileInputRef, type: "file", accept: "image/*", onChange: handleFileSelect, className: "hidden" })] }), _jsxs("div", { className: "flex w-full max-w-md gap-3", children: [selectedFile && (_jsx(Button, { onClick: handleUpload, disabled: isLoading, className: "bg-b3-primary-blue hover:bg-b3-primary-blue/90 flex-1 text-white", children: isLoading ? (_jsxs(_Fragment, { children: [_jsx(Loader2, { className: "mr-2 h-4 w-4 animate-spin" }), isUploading ? "Uploading..." : "Saving..."] })) : (_jsxs(_Fragment, { children: [_jsx(Check, { className: "mr-2 h-4 w-4" }), hasAvatar ? "Update Avatar" : "Set Avatar"] })) })), _jsxs(Button, { variant: "outline", onClick: handleFileInputClick, disabled: isLoading, className: "flex-1", children: [_jsx(Upload, { className: "mr-2 h-4 w-4" }), selectedFile ? "Change Image" : "Select Image"] })] }), _jsx("div", { className: "text-b3-foreground-muted font-neue-montreal-medium max-w-md text-center text-xs", children: _jsx("p", { children: "Your avatar will be uploaded to IPFS and stored securely. Make sure you have the rights to use this image." }) })] }));
208
102
  }