@b3dotfun/sdk 0.0.40 → 0.0.41-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 (227) hide show
  1. package/dist/cjs/anyspend/react/components/AnySpend.d.ts +11 -1
  2. package/dist/cjs/anyspend/react/components/AnySpend.js +17 -4
  3. package/dist/cjs/anyspend/react/components/AnySpendBondKit.js +0 -1
  4. package/dist/cjs/anyspend/react/components/AnySpendBuySpin.js +0 -1
  5. package/dist/cjs/anyspend/react/components/AnySpendCustom.d.ts +1 -0
  6. package/dist/cjs/anyspend/react/components/AnySpendCustom.js +33 -11
  7. package/dist/cjs/anyspend/react/components/AnySpendNFT.d.ts +2 -1
  8. package/dist/cjs/anyspend/react/components/AnySpendNFT.js +2 -2
  9. package/dist/cjs/anyspend/react/components/AnySpendStakeB3.js +0 -1
  10. package/dist/cjs/anyspend/react/components/AnyspendDepositHype.d.ts +8 -0
  11. package/dist/cjs/anyspend/react/components/AnyspendDepositHype.js +6 -3
  12. package/dist/cjs/anyspend/react/components/AnyspendSignatureMint.js +1 -2
  13. package/dist/cjs/anyspend/react/components/common/ConnectWalletPayment.js +5 -3
  14. package/dist/cjs/anyspend/react/components/common/CryptoPaySection.d.ts +4 -1
  15. package/dist/cjs/anyspend/react/components/common/CryptoPaySection.js +9 -9
  16. package/dist/cjs/anyspend/react/components/common/CryptoPaymentMethod.js +80 -10
  17. package/dist/cjs/anyspend/react/components/common/CryptoReceiveSection.d.ts +2 -1
  18. package/dist/cjs/anyspend/react/components/common/CryptoReceiveSection.js +40 -37
  19. package/dist/cjs/anyspend/react/components/common/OrderDetails.js +8 -11
  20. package/dist/cjs/anyspend/react/components/common/OrderTokenAmount.d.ts +4 -1
  21. package/dist/cjs/anyspend/react/components/common/OrderTokenAmount.js +23 -9
  22. package/dist/cjs/anyspend/react/components/common/PanelOnramp.d.ts +4 -1
  23. package/dist/cjs/anyspend/react/components/common/PanelOnramp.js +10 -6
  24. package/dist/cjs/anyspend/react/components/common/PointsBadge.d.ts +7 -0
  25. package/dist/cjs/anyspend/react/components/common/PointsBadge.js +7 -0
  26. package/dist/cjs/anyspend/react/components/common/PointsDetailPanel.d.ts +6 -0
  27. package/dist/cjs/anyspend/react/components/common/PointsDetailPanel.js +14 -0
  28. package/dist/cjs/anyspend/react/contexts/FeatureFlagsContext.d.ts +11 -0
  29. package/dist/cjs/anyspend/react/contexts/FeatureFlagsContext.js +21 -0
  30. package/dist/cjs/anyspend/react/hooks/useAnyspendFlow.d.ts +4 -1
  31. package/dist/cjs/anyspend/react/hooks/useAnyspendFlow.js +18 -8
  32. package/dist/cjs/anyspend/react/providers/AnyspendProvider.d.ts +5 -2
  33. package/dist/cjs/anyspend/react/providers/AnyspendProvider.js +5 -3
  34. package/dist/cjs/anyspend/react/providers/index.d.ts +1 -0
  35. package/dist/cjs/anyspend/react/providers/index.js +3 -0
  36. package/dist/cjs/anyspend/services/anyspend.d.ts +1 -1
  37. package/dist/cjs/anyspend/services/anyspend.js +2 -0
  38. package/dist/cjs/anyspend/types/api.d.ts +51 -1
  39. package/dist/cjs/anyspend/utils/chain.js +1 -1
  40. package/dist/cjs/anyspend/utils/orderPayload.js +3 -0
  41. package/dist/cjs/bondkit/bondkitToken.d.ts +37 -2
  42. package/dist/cjs/bondkit/bondkitToken.js +268 -2
  43. package/dist/cjs/bondkit/bondkitTokenFactory.d.ts +1 -1
  44. package/dist/cjs/bondkit/bondkitTokenFactory.js +2 -2
  45. package/dist/cjs/bondkit/components/TradingView.js +3 -4
  46. package/dist/cjs/bondkit/config.d.ts +1 -1
  47. package/dist/cjs/bondkit/config.js +5 -2
  48. package/dist/cjs/bondkit/constants.d.ts +4 -0
  49. package/dist/cjs/bondkit/constants.js +6 -1
  50. package/dist/cjs/bondkit/index.d.ts +1 -0
  51. package/dist/cjs/bondkit/index.js +4 -1
  52. package/dist/cjs/bondkit/swapService.d.ts +43 -0
  53. package/dist/cjs/bondkit/swapService.js +376 -0
  54. package/dist/cjs/bondkit/types.d.ts +10 -4
  55. package/dist/cjs/bondkit/types.js +4 -5
  56. package/dist/cjs/global-account/react/components/B3Provider/B3Provider.d.ts +4 -3
  57. package/dist/cjs/global-account/react/components/B3Provider/B3Provider.js +41 -9
  58. package/dist/cjs/global-account/react/components/LinkAccount/LinkAccount.js +63 -3
  59. package/dist/cjs/global-account/react/components/ManageAccount/ManageAccount.js +35 -2
  60. package/dist/cjs/global-account/react/components/SignInWithB3/steps/LoginStepCustom.js +4 -3
  61. package/dist/cjs/global-account/react/hooks/index.d.ts +1 -0
  62. package/dist/cjs/global-account/react/hooks/index.js +3 -1
  63. package/dist/cjs/global-account/react/hooks/useAccountAssets.js +5 -2
  64. package/dist/cjs/global-account/react/hooks/useAuthentication.js +2 -3
  65. package/dist/cjs/global-account/react/hooks/useGlobalAccount.d.ts +6 -0
  66. package/dist/cjs/global-account/react/hooks/useGlobalAccount.js +32 -0
  67. package/dist/cjs/global-account/react/hooks/useQueryB3.js +5 -2
  68. package/dist/cjs/global-account/react/hooks/useQueryBSMNT.js +5 -2
  69. package/dist/cjs/global-account/react/hooks/useSimBalance.js +2 -2
  70. package/dist/cjs/global-account/react/hooks/useTokenBalancesByChain.js +7 -1
  71. package/dist/cjs/global-account/react/hooks/useTokenFromUrl.js +2 -2
  72. package/dist/cjs/global-account/react/hooks/useUnifiedChainSwitchAndExecute.js +28 -24
  73. package/dist/cjs/shared/utils/fetchBalances.d.ts +1 -1
  74. package/dist/esm/anyspend/react/components/AnySpend.d.ts +11 -1
  75. package/dist/esm/anyspend/react/components/AnySpend.js +17 -4
  76. package/dist/esm/anyspend/react/components/AnySpendBondKit.js +0 -1
  77. package/dist/esm/anyspend/react/components/AnySpendBuySpin.js +0 -1
  78. package/dist/esm/anyspend/react/components/AnySpendCustom.d.ts +1 -0
  79. package/dist/esm/anyspend/react/components/AnySpendCustom.js +33 -11
  80. package/dist/esm/anyspend/react/components/AnySpendNFT.d.ts +2 -1
  81. package/dist/esm/anyspend/react/components/AnySpendNFT.js +2 -2
  82. package/dist/esm/anyspend/react/components/AnySpendStakeB3.js +0 -1
  83. package/dist/esm/anyspend/react/components/AnyspendDepositHype.d.ts +8 -0
  84. package/dist/esm/anyspend/react/components/AnyspendDepositHype.js +6 -3
  85. package/dist/esm/anyspend/react/components/AnyspendSignatureMint.js +1 -2
  86. package/dist/esm/anyspend/react/components/common/ConnectWalletPayment.js +6 -4
  87. package/dist/esm/anyspend/react/components/common/CryptoPaySection.d.ts +4 -1
  88. package/dist/esm/anyspend/react/components/common/CryptoPaySection.js +9 -9
  89. package/dist/esm/anyspend/react/components/common/CryptoPaymentMethod.js +80 -10
  90. package/dist/esm/anyspend/react/components/common/CryptoReceiveSection.d.ts +2 -1
  91. package/dist/esm/anyspend/react/components/common/CryptoReceiveSection.js +40 -37
  92. package/dist/esm/anyspend/react/components/common/OrderDetails.js +8 -11
  93. package/dist/esm/anyspend/react/components/common/OrderTokenAmount.d.ts +4 -1
  94. package/dist/esm/anyspend/react/components/common/OrderTokenAmount.js +23 -9
  95. package/dist/esm/anyspend/react/components/common/PanelOnramp.d.ts +4 -1
  96. package/dist/esm/anyspend/react/components/common/PanelOnramp.js +10 -6
  97. package/dist/esm/anyspend/react/components/common/PointsBadge.d.ts +7 -0
  98. package/dist/esm/anyspend/react/components/common/PointsBadge.js +4 -0
  99. package/dist/esm/anyspend/react/components/common/PointsDetailPanel.d.ts +6 -0
  100. package/dist/esm/anyspend/react/components/common/PointsDetailPanel.js +8 -0
  101. package/dist/esm/anyspend/react/contexts/FeatureFlagsContext.d.ts +11 -0
  102. package/dist/esm/anyspend/react/contexts/FeatureFlagsContext.js +17 -0
  103. package/dist/esm/anyspend/react/hooks/useAnyspendFlow.d.ts +4 -1
  104. package/dist/esm/anyspend/react/hooks/useAnyspendFlow.js +18 -8
  105. package/dist/esm/anyspend/react/providers/AnyspendProvider.d.ts +5 -2
  106. package/dist/esm/anyspend/react/providers/AnyspendProvider.js +5 -3
  107. package/dist/esm/anyspend/react/providers/index.d.ts +1 -0
  108. package/dist/esm/anyspend/react/providers/index.js +1 -0
  109. package/dist/esm/anyspend/services/anyspend.d.ts +1 -1
  110. package/dist/esm/anyspend/services/anyspend.js +2 -0
  111. package/dist/esm/anyspend/types/api.d.ts +51 -1
  112. package/dist/esm/anyspend/utils/chain.js +1 -1
  113. package/dist/esm/anyspend/utils/orderPayload.js +3 -0
  114. package/dist/esm/bondkit/bondkitToken.d.ts +37 -2
  115. package/dist/esm/bondkit/bondkitToken.js +268 -2
  116. package/dist/esm/bondkit/bondkitTokenFactory.d.ts +1 -1
  117. package/dist/esm/bondkit/bondkitTokenFactory.js +2 -2
  118. package/dist/esm/bondkit/components/TradingView.js +3 -4
  119. package/dist/esm/bondkit/config.d.ts +1 -1
  120. package/dist/esm/bondkit/config.js +5 -2
  121. package/dist/esm/bondkit/constants.d.ts +4 -0
  122. package/dist/esm/bondkit/constants.js +5 -0
  123. package/dist/esm/bondkit/index.d.ts +1 -0
  124. package/dist/esm/bondkit/index.js +2 -0
  125. package/dist/esm/bondkit/swapService.d.ts +43 -0
  126. package/dist/esm/bondkit/swapService.js +372 -0
  127. package/dist/esm/bondkit/types.d.ts +10 -4
  128. package/dist/esm/bondkit/types.js +4 -5
  129. package/dist/esm/global-account/react/components/B3Provider/B3Provider.d.ts +4 -3
  130. package/dist/esm/global-account/react/components/B3Provider/B3Provider.js +42 -9
  131. package/dist/esm/global-account/react/components/LinkAccount/LinkAccount.js +65 -5
  132. package/dist/esm/global-account/react/components/ManageAccount/ManageAccount.js +35 -2
  133. package/dist/esm/global-account/react/components/SignInWithB3/steps/LoginStepCustom.js +3 -2
  134. package/dist/esm/global-account/react/hooks/index.d.ts +1 -0
  135. package/dist/esm/global-account/react/hooks/index.js +1 -0
  136. package/dist/esm/global-account/react/hooks/useAccountAssets.js +2 -2
  137. package/dist/esm/global-account/react/hooks/useAuthentication.js +2 -3
  138. package/dist/esm/global-account/react/hooks/useGlobalAccount.d.ts +6 -0
  139. package/dist/esm/global-account/react/hooks/useGlobalAccount.js +29 -0
  140. package/dist/esm/global-account/react/hooks/useQueryB3.js +5 -2
  141. package/dist/esm/global-account/react/hooks/useQueryBSMNT.js +5 -2
  142. package/dist/esm/global-account/react/hooks/useSimBalance.js +2 -2
  143. package/dist/esm/global-account/react/hooks/useTokenBalancesByChain.js +4 -1
  144. package/dist/esm/global-account/react/hooks/useTokenFromUrl.js +2 -2
  145. package/dist/esm/global-account/react/hooks/useUnifiedChainSwitchAndExecute.js +29 -25
  146. package/dist/esm/shared/utils/fetchBalances.d.ts +1 -1
  147. package/dist/styles/index.css +1 -1
  148. package/dist/types/anyspend/react/components/AnySpend.d.ts +11 -1
  149. package/dist/types/anyspend/react/components/AnySpendCustom.d.ts +1 -0
  150. package/dist/types/anyspend/react/components/AnySpendNFT.d.ts +2 -1
  151. package/dist/types/anyspend/react/components/AnyspendDepositHype.d.ts +8 -0
  152. package/dist/types/anyspend/react/components/common/CryptoPaySection.d.ts +4 -1
  153. package/dist/types/anyspend/react/components/common/CryptoReceiveSection.d.ts +2 -1
  154. package/dist/types/anyspend/react/components/common/OrderTokenAmount.d.ts +4 -1
  155. package/dist/types/anyspend/react/components/common/PanelOnramp.d.ts +4 -1
  156. package/dist/types/anyspend/react/components/common/PointsBadge.d.ts +7 -0
  157. package/dist/types/anyspend/react/components/common/PointsDetailPanel.d.ts +6 -0
  158. package/dist/types/anyspend/react/contexts/FeatureFlagsContext.d.ts +11 -0
  159. package/dist/types/anyspend/react/hooks/useAnyspendFlow.d.ts +4 -1
  160. package/dist/types/anyspend/react/providers/AnyspendProvider.d.ts +5 -2
  161. package/dist/types/anyspend/react/providers/index.d.ts +1 -0
  162. package/dist/types/anyspend/services/anyspend.d.ts +1 -1
  163. package/dist/types/anyspend/types/api.d.ts +51 -1
  164. package/dist/types/bondkit/bondkitToken.d.ts +37 -2
  165. package/dist/types/bondkit/bondkitTokenFactory.d.ts +1 -1
  166. package/dist/types/bondkit/config.d.ts +1 -1
  167. package/dist/types/bondkit/constants.d.ts +4 -0
  168. package/dist/types/bondkit/index.d.ts +1 -0
  169. package/dist/types/bondkit/swapService.d.ts +43 -0
  170. package/dist/types/bondkit/types.d.ts +10 -4
  171. package/dist/types/global-account/react/components/B3Provider/B3Provider.d.ts +4 -3
  172. package/dist/types/global-account/react/hooks/index.d.ts +1 -0
  173. package/dist/types/global-account/react/hooks/useGlobalAccount.d.ts +6 -0
  174. package/dist/types/shared/utils/fetchBalances.d.ts +1 -1
  175. package/package.json +6 -5
  176. package/src/anyspend/react/components/AnySpend.tsx +37 -1
  177. package/src/anyspend/react/components/AnySpendBondKit.tsx +0 -1
  178. package/src/anyspend/react/components/AnySpendBuySpin.tsx +0 -1
  179. package/src/anyspend/react/components/AnySpendCustom.tsx +63 -13
  180. package/src/anyspend/react/components/AnySpendNFT.tsx +3 -0
  181. package/src/anyspend/react/components/AnySpendStakeB3.tsx +0 -1
  182. package/src/anyspend/react/components/AnyspendDepositHype.tsx +22 -0
  183. package/src/anyspend/react/components/AnyspendSignatureMint.tsx +1 -2
  184. package/src/anyspend/react/components/common/ConnectWalletPayment.tsx +7 -4
  185. package/src/anyspend/react/components/common/CryptoPaySection.tsx +13 -8
  186. package/src/anyspend/react/components/common/CryptoPaymentMethod.tsx +170 -44
  187. package/src/anyspend/react/components/common/CryptoReceiveSection.tsx +61 -45
  188. package/src/anyspend/react/components/common/OrderDetails.tsx +10 -14
  189. package/src/anyspend/react/components/common/OrderTokenAmount.tsx +28 -8
  190. package/src/anyspend/react/components/common/PanelOnramp.tsx +28 -15
  191. package/src/anyspend/react/components/common/PointsBadge.tsx +20 -0
  192. package/src/anyspend/react/components/common/PointsDetailPanel.tsx +55 -0
  193. package/src/anyspend/react/contexts/FeatureFlagsContext.tsx +34 -0
  194. package/src/anyspend/react/hooks/useAnyspendFlow.ts +18 -8
  195. package/src/anyspend/react/hooks/useAnyspendOrderAndTransactions.ts +1 -1
  196. package/src/anyspend/react/hooks/useCoinbaseOnrampOptions.ts +1 -1
  197. package/src/anyspend/react/providers/AnyspendProvider.tsx +11 -6
  198. package/src/anyspend/react/providers/index.ts +1 -0
  199. package/src/anyspend/services/anyspend.ts +3 -1
  200. package/src/anyspend/types/api.ts +51 -1
  201. package/src/anyspend/types/api_req_res.ts +6 -10
  202. package/src/anyspend/utils/chain.ts +1 -1
  203. package/src/anyspend/utils/orderPayload.ts +3 -0
  204. package/src/bondkit/bondkitToken.ts +323 -3
  205. package/src/bondkit/bondkitTokenFactory.ts +2 -2
  206. package/src/bondkit/components/TradingView.tsx +3 -5
  207. package/src/bondkit/config.ts +5 -2
  208. package/src/bondkit/constants.ts +7 -0
  209. package/src/bondkit/index.ts +3 -0
  210. package/src/bondkit/swapService.ts +464 -0
  211. package/src/bondkit/types.ts +12 -5
  212. package/src/global-account/react/components/B3Provider/B3Provider.tsx +55 -15
  213. package/src/global-account/react/components/LinkAccount/LinkAccount.tsx +106 -32
  214. package/src/global-account/react/components/ManageAccount/ManageAccount.tsx +60 -5
  215. package/src/global-account/react/components/SignInWithB3/steps/LoginStepCustom.tsx +4 -2
  216. package/src/global-account/react/hooks/index.ts +1 -0
  217. package/src/global-account/react/hooks/useAccountAssets.ts +4 -3
  218. package/src/global-account/react/hooks/useAuthentication.ts +2 -3
  219. package/src/global-account/react/hooks/useGlobalAccount.tsx +36 -0
  220. package/src/global-account/react/hooks/useOneBalance.tsx +1 -1
  221. package/src/global-account/react/hooks/useQueryB3.ts +22 -15
  222. package/src/global-account/react/hooks/useQueryBSMNT.ts +22 -15
  223. package/src/global-account/react/hooks/useSimBalance.ts +2 -2
  224. package/src/global-account/react/hooks/useTokenBalancesByChain.tsx +4 -1
  225. package/src/global-account/react/hooks/useTokenFromUrl.tsx +2 -2
  226. package/src/global-account/react/hooks/useUnifiedChainSwitchAndExecute.ts +30 -26
  227. package/src/shared/utils/fetchBalances.ts +1 -1
@@ -7,11 +7,14 @@ const jsx_runtime_1 = require("react/jsx-runtime");
7
7
  const react_1 = require("../../../../global-account/react");
8
8
  const cn_1 = require("../../../../shared/utils/cn");
9
9
  const formatAddress_1 = require("../../../../shared/utils/formatAddress");
10
+ const thirdweb_1 = require("../../../../shared/utils/thirdweb");
10
11
  const react_2 = require("@web3icons/react");
11
12
  const lucide_react_1 = require("lucide-react");
12
13
  const react_3 = require("react");
13
14
  const react_dom_1 = require("react-dom");
14
15
  const sonner_1 = require("sonner");
16
+ const react_4 = require("thirdweb/react");
17
+ const wallets_1 = require("thirdweb/wallets");
15
18
  const wagmi_1 = require("wagmi");
16
19
  var CryptoPaymentMethodType;
17
20
  (function (CryptoPaymentMethodType) {
@@ -21,12 +24,58 @@ var CryptoPaymentMethodType;
21
24
  CryptoPaymentMethodType["TRANSFER_CRYPTO"] = "transfer_crypto";
22
25
  })(CryptoPaymentMethodType || (exports.CryptoPaymentMethodType = CryptoPaymentMethodType = {}));
23
26
  function CryptoPaymentMethod({ selectedPaymentMethod, setSelectedPaymentMethod, isCreatingOrder, onBack, onSelectPaymentMethod, }) {
24
- const { wallet: globalWallet, address: globalAddress } = (0, react_1.useAccountWallet)();
25
- const { address, isConnected, connector } = (0, wagmi_1.useAccount)();
27
+ const { wallet: globalWallet, connectedEOAWallet: connectedEOAWallet, connectedSmartWallet: connectedSmartWallet, } = (0, react_1.useAccountWallet)();
28
+ const { connector, address, isConnected: wagmiWalletIsConnected } = (0, wagmi_1.useAccount)();
26
29
  const { connect, connectors, isPending } = (0, wagmi_1.useConnect)();
27
30
  const { disconnect } = (0, wagmi_1.useDisconnect)();
28
31
  const { data: walletClient } = (0, wagmi_1.useWalletClient)();
29
32
  const [showWalletModal, setShowWalletModal] = (0, react_3.useState)(false);
33
+ const setActiveWallet = (0, react_4.useSetActiveWallet)();
34
+ const { data: eoaWalletInfo } = (0, react_4.useWalletInfo)(connectedEOAWallet?.id);
35
+ const isConnected = !!connectedEOAWallet;
36
+ const globalAddress = connectedSmartWallet?.getAccount()?.address;
37
+ // Helper function to check if two addresses are the same
38
+ const isSameAddress = (addr1, addr2) => {
39
+ if (!addr1 || !addr2)
40
+ return false;
41
+ return addr1.toLowerCase() === addr2.toLowerCase();
42
+ };
43
+ // Check if connectedEOAWallet and wagmi wallet represent the same wallet
44
+ const connectedEOAAddress = connectedEOAWallet?.getAccount()?.address;
45
+ const wagmiAddress = address;
46
+ const isWalletDuplicated = isSameAddress(connectedEOAAddress, wagmiAddress);
47
+ // Determine which wallet to show (prefer connectedEOAWallet if both exist and are the same)
48
+ const shouldShowConnectedEOA = !!connectedEOAWallet;
49
+ const shouldShowWagmiWallet = wagmiWalletIsConnected && (!isWalletDuplicated || !connectedEOAWallet);
50
+ // Map wagmi connector names to thirdweb wallet IDs
51
+ const getThirdwebWalletId = (connectorName) => {
52
+ const walletMap = {
53
+ MetaMask: "io.metamask",
54
+ "Coinbase Wallet": "com.coinbase.wallet",
55
+ Rainbow: "me.rainbow",
56
+ WalletConnect: "walletConnect",
57
+ Phantom: "app.phantom",
58
+ };
59
+ return walletMap[connectorName] || null;
60
+ };
61
+ // Create thirdweb wallet from wagmi connector
62
+ const createThirdwebWalletFromConnector = async (connectorName) => {
63
+ const walletId = getThirdwebWalletId(connectorName);
64
+ if (!walletId) {
65
+ console.warn(`No thirdweb wallet ID found for connector: ${connectorName}`);
66
+ return null;
67
+ }
68
+ try {
69
+ const thirdwebWallet = (0, wallets_1.createWallet)(walletId);
70
+ // Connect the wallet to sync with the existing wagmi connection
71
+ await thirdwebWallet.connect({ client: thirdweb_1.client });
72
+ return thirdwebWallet;
73
+ }
74
+ catch (error) {
75
+ console.error(`Failed to create thirdweb wallet for ${connectorName}:`, error);
76
+ return null;
77
+ }
78
+ };
30
79
  // Define available wallet connectors
31
80
  const availableConnectors = connectors.filter(connector => ["MetaMask", "WalletConnect", "Coinbase Wallet", "Rainbow", "Phantom"].includes(connector.name));
32
81
  // Define wallet options with icons and info
@@ -121,15 +170,30 @@ function CryptoPaymentMethod({ selectedPaymentMethod, setSelectedPaymentMethod,
121
170
  }
122
171
  }
123
172
  };
124
- return ((0, jsx_runtime_1.jsxs)("div", { className: "crypto-payment-method mx-auto h-fit w-[460px] max-w-full", children: [(0, jsx_runtime_1.jsxs)("div", { className: (0, cn_1.cn)("relative flex flex-col gap-10"), children: [(0, jsx_runtime_1.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: (0, jsx_runtime_1.jsx)(lucide_react_1.ChevronLeft, { className: "h-6 w-6" }) }), (0, jsx_runtime_1.jsx)("div", { className: "flex items-center justify-around gap-4", children: (0, jsx_runtime_1.jsx)("div", { className: "flex-1 text-center", children: (0, jsx_runtime_1.jsx)("h2", { className: "text-as-primary text-lg font-semibold", children: "Select a payment method" }) }) }), (0, jsx_runtime_1.jsxs)("div", { className: "crypto-payment-methods flex flex-col gap-6", children: [(0, jsx_runtime_1.jsxs)("button", { onClick: () => {
125
- // Always show wallet selection modal first
126
- setShowWalletModal(true);
127
- }, className: "crypto-payment-method-connect-wallet bg-as-surface-primary border-as-border-secondary hover:border-as-secondary/80 group flex w-full items-center justify-between gap-4 rounded-xl border px-4 py-3.5 transition-all duration-200 hover:shadow-md", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-3", children: [(0, jsx_runtime_1.jsx)("div", { className: "wallet-icon flex h-8 w-8 items-center justify-center rounded-full bg-blue-100", children: (0, jsx_runtime_1.jsx)(lucide_react_1.Wallet, { className: "h-4 w-4 text-blue-600" }) }), (0, jsx_runtime_1.jsx)("div", { className: "flex flex-col items-start text-left", children: (0, jsx_runtime_1.jsx)("h4", { className: "text-as-primary font-semibold", children: "Connect wallet" }) })] }), (0, jsx_runtime_1.jsx)(lucide_react_1.ChevronRightCircle, { className: "text-as-primary/40 group-hover:text-as-primary/60 h-5 w-5 transition-colors" })] }), (0, jsx_runtime_1.jsxs)("button", { onClick: () => {
128
- setSelectedPaymentMethod(CryptoPaymentMethodType.TRANSFER_CRYPTO);
129
- onSelectPaymentMethod(CryptoPaymentMethodType.TRANSFER_CRYPTO);
130
- }, disabled: isCreatingOrder, className: "crypto-payment-method-transfer bg-as-surface-primary border-as-border-secondary hover:border-as-secondary/80 group flex w-full items-center justify-between gap-4 rounded-xl border px-4 py-3.5 transition-all duration-200 hover:shadow-md", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-3", children: [(0, jsx_runtime_1.jsx)("div", { className: "wallet-icon flex h-8 w-8 items-center justify-center rounded-full bg-orange-100", children: (0, jsx_runtime_1.jsx)(lucide_react_1.ZapIcon, { className: "h-4 w-4" }) }), (0, jsx_runtime_1.jsx)("div", { className: "flex flex-col items-start text-left", children: (0, jsx_runtime_1.jsx)("h4", { className: "text-as-primary font-semibold", children: "Transfer crypto" }) })] }), (0, jsx_runtime_1.jsx)(lucide_react_1.ChevronRightCircle, { className: "text-as-primary/40 group-hover:text-as-primary/60 h-5 w-5 transition-colors" })] }), (isConnected || globalAddress) && ((0, jsx_runtime_1.jsxs)("div", { className: "installed-wallets", children: [(0, jsx_runtime_1.jsx)("h3", { className: "text-as-primary/80 mb-3 text-sm font-medium", children: "Connected wallets" }), (0, jsx_runtime_1.jsxs)("div", { className: "space-y-2", children: [isConnected && ((0, jsx_runtime_1.jsx)("button", { onClick: () => {
173
+ return ((0, jsx_runtime_1.jsxs)("div", { className: "crypto-payment-method mx-auto h-fit w-[460px] max-w-full", children: [(0, jsx_runtime_1.jsxs)("div", { className: (0, cn_1.cn)("relative flex flex-col gap-10"), children: [(0, jsx_runtime_1.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: (0, jsx_runtime_1.jsx)(lucide_react_1.ChevronLeft, { className: "h-6 w-6" }) }), (0, jsx_runtime_1.jsx)("div", { className: "flex items-center justify-around gap-4", children: (0, jsx_runtime_1.jsx)("div", { className: "flex-1 text-center", children: (0, jsx_runtime_1.jsx)("h2", { className: "text-as-primary text-lg font-semibold", children: "Select a payment method" }) }) }), (0, jsx_runtime_1.jsxs)("div", { className: "crypto-payment-methods flex flex-col gap-4", children: [(shouldShowConnectedEOA || shouldShowWagmiWallet || globalAddress) && ((0, jsx_runtime_1.jsxs)("div", { className: "installed-wallets", children: [(0, jsx_runtime_1.jsx)("h3", { className: "text-as-primary/80 mb-3 text-sm font-medium", children: "Connected wallets" }), (0, jsx_runtime_1.jsxs)("div", { className: "space-y-2", children: [shouldShowConnectedEOA && ((0, jsx_runtime_1.jsx)("button", { onClick: () => {
174
+ setSelectedPaymentMethod(CryptoPaymentMethodType.CONNECT_WALLET);
175
+ onSelectPaymentMethod(CryptoPaymentMethodType.CONNECT_WALLET);
176
+ setActiveWallet(connectedEOAWallet);
177
+ sonner_1.toast.success(`Selected ${eoaWalletInfo?.name || connector?.name || "wallet"}`);
178
+ }, className: (0, cn_1.cn)("crypto-payment-method-connect-wallet w-full rounded-xl border p-4 text-left transition-all hover:shadow-md", selectedPaymentMethod === CryptoPaymentMethodType.CONNECT_WALLET
179
+ ? "connected-wallet border-as-brand bg-as-brand/5"
180
+ : "border-as-border-secondary bg-as-surface-primary hover:border-as-secondary/80"), children: (0, jsx_runtime_1.jsxs)("div", { className: "flex items-center justify-between", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-3", children: [(0, jsx_runtime_1.jsx)("div", { className: "wallet-icon flex h-10 w-10 items-center justify-center rounded-full bg-blue-100", children: (0, jsx_runtime_1.jsx)(lucide_react_1.Wallet, { className: "h-5 w-5 text-blue-600" }) }), (0, jsx_runtime_1.jsxs)("div", { className: "flex flex-col", children: [(0, jsx_runtime_1.jsx)("span", { className: "text-as-primary font-semibold", children: eoaWalletInfo?.name || connector?.name || "Connected Wallet" }), (0, jsx_runtime_1.jsx)("span", { className: "text-as-primary/60 text-sm", children: (0, formatAddress_1.shortenAddress)(connectedEOAWallet?.getAccount()?.address || "") })] })] }), (0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-2", children: [selectedPaymentMethod === CryptoPaymentMethodType.CONNECT_WALLET && ((0, jsx_runtime_1.jsx)("div", { className: "h-2 w-2 rounded-full bg-green-500" })), (0, jsx_runtime_1.jsx)("button", { onClick: e => {
181
+ e.stopPropagation();
182
+ disconnect();
183
+ sonner_1.toast.success("Wallet disconnected");
184
+ if (selectedPaymentMethod === CryptoPaymentMethodType.CONNECT_WALLET) {
185
+ setSelectedPaymentMethod(CryptoPaymentMethodType.NONE);
186
+ }
187
+ }, className: "text-as-primary/60 hover:text-as-primary/80 rounded-lg p-1.5 transition-colors", children: (0, jsx_runtime_1.jsx)(lucide_react_1.X, { className: "h-4 w-4" }) })] })] }) })), shouldShowWagmiWallet && ((0, jsx_runtime_1.jsx)("button", { onClick: async () => {
131
188
  setSelectedPaymentMethod(CryptoPaymentMethodType.CONNECT_WALLET);
132
189
  onSelectPaymentMethod(CryptoPaymentMethodType.CONNECT_WALLET);
190
+ // Create thirdweb wallet from wagmi connector
191
+ if (connector?.name) {
192
+ const thirdwebWallet = await createThirdwebWalletFromConnector(connector.name);
193
+ if (thirdwebWallet) {
194
+ setActiveWallet(thirdwebWallet);
195
+ }
196
+ }
133
197
  sonner_1.toast.success(`Selected ${connector?.name || "wallet"}`);
134
198
  }, className: (0, cn_1.cn)("crypto-payment-method-connect-wallet w-full rounded-xl border p-4 text-left transition-all hover:shadow-md", selectedPaymentMethod === CryptoPaymentMethodType.CONNECT_WALLET
135
199
  ? "connected-wallet border-as-brand bg-as-brand/5"
@@ -146,7 +210,13 @@ function CryptoPaymentMethod({ selectedPaymentMethod, setSelectedPaymentMethod,
146
210
  sonner_1.toast.success("Selected B3 Account");
147
211
  }, className: (0, cn_1.cn)("crypto-payment-method-global-wallet w-full rounded-xl border p-4 text-left transition-all hover:shadow-md", selectedPaymentMethod === CryptoPaymentMethodType.GLOBAL_WALLET
148
212
  ? "connected-wallet border-as-brand bg-as-brand/5"
149
- : "border-as-border-secondary bg-as-surface-primary hover:border-as-secondary/80"), children: (0, jsx_runtime_1.jsxs)("div", { className: "flex items-center justify-between", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-3", children: [globalWallet?.meta?.icon ? ((0, jsx_runtime_1.jsx)("img", { src: globalWallet.meta.icon, alt: "Global Account", className: "h-10 w-10 rounded-full" })) : ((0, jsx_runtime_1.jsx)("div", { className: "wallet-icon flex h-10 w-10 items-center justify-center rounded-full bg-purple-100", children: (0, jsx_runtime_1.jsx)(lucide_react_1.Wallet, { className: "h-5 w-5 text-purple-600" }) })), (0, jsx_runtime_1.jsxs)("div", { className: "flex flex-col", children: [(0, jsx_runtime_1.jsx)("span", { className: "text-as-primary font-semibold", children: "Global Account" }), (0, jsx_runtime_1.jsx)("span", { className: "text-as-primary/60 text-sm", children: (0, formatAddress_1.shortenAddress)(globalAddress || "") })] })] }), (0, jsx_runtime_1.jsx)("div", { className: "flex items-center gap-2", children: selectedPaymentMethod === CryptoPaymentMethodType.GLOBAL_WALLET && ((0, jsx_runtime_1.jsx)("div", { className: "h-2 w-2 rounded-full bg-green-500" })) })] }) }))] })] }))] })] }), showWalletModal &&
213
+ : "border-as-border-secondary bg-as-surface-primary hover:border-as-secondary/80"), children: (0, jsx_runtime_1.jsxs)("div", { className: "flex items-center justify-between", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-3", children: [globalWallet?.meta?.icon ? ((0, jsx_runtime_1.jsx)("img", { src: globalWallet.meta.icon, alt: "Global Account", className: "h-10 w-10 rounded-full" })) : ((0, jsx_runtime_1.jsx)("div", { className: "wallet-icon flex h-10 w-10 items-center justify-center rounded-full bg-purple-100", children: (0, jsx_runtime_1.jsx)(lucide_react_1.Wallet, { className: "h-5 w-5 text-purple-600" }) })), (0, jsx_runtime_1.jsxs)("div", { className: "flex flex-col", children: [(0, jsx_runtime_1.jsx)("span", { className: "text-as-primary font-semibold", children: "Global Account" }), (0, jsx_runtime_1.jsx)("span", { className: "text-as-primary/60 text-sm", children: (0, formatAddress_1.shortenAddress)(globalAddress || "") })] })] }), (0, jsx_runtime_1.jsx)("div", { className: "flex items-center gap-2", children: selectedPaymentMethod === CryptoPaymentMethodType.GLOBAL_WALLET && ((0, jsx_runtime_1.jsx)("div", { className: "h-2 w-2 rounded-full bg-green-500" })) })] }) }))] })] })), (0, jsx_runtime_1.jsxs)("div", { className: "other-payment-methods", children: [(0, jsx_runtime_1.jsx)("h3", { className: "text-as-primary/80 mb-3 text-sm font-medium", children: "Payment methods" }), (0, jsx_runtime_1.jsxs)("div", { className: "space-y-3", children: [(0, jsx_runtime_1.jsxs)("button", { onClick: () => {
214
+ // Always show wallet selection modal first
215
+ setShowWalletModal(true);
216
+ }, className: "crypto-payment-method-connect-wallet bg-as-surface-primary border-as-border-secondary hover:border-as-secondary/80 group flex w-full items-center justify-between gap-4 rounded-xl border px-4 py-3.5 transition-all duration-200 hover:shadow-md", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-3", children: [(0, jsx_runtime_1.jsx)("div", { className: "wallet-icon flex h-8 w-8 items-center justify-center rounded-full bg-blue-100", children: (0, jsx_runtime_1.jsx)(lucide_react_1.Wallet, { className: "h-4 w-4 text-blue-600" }) }), (0, jsx_runtime_1.jsx)("div", { className: "flex flex-col items-start text-left", children: (0, jsx_runtime_1.jsx)("h4", { className: "text-as-primary font-semibold", children: "Connect wallet" }) })] }), (0, jsx_runtime_1.jsx)(lucide_react_1.ChevronRightCircle, { className: "text-as-primary/40 group-hover:text-as-primary/60 h-5 w-5 transition-colors" })] }), (0, jsx_runtime_1.jsxs)("button", { onClick: () => {
217
+ setSelectedPaymentMethod(CryptoPaymentMethodType.TRANSFER_CRYPTO);
218
+ onSelectPaymentMethod(CryptoPaymentMethodType.TRANSFER_CRYPTO);
219
+ }, disabled: isCreatingOrder, className: "crypto-payment-method-transfer bg-as-surface-primary border-as-border-secondary hover:border-as-secondary/80 group flex w-full items-center justify-between gap-4 rounded-xl border px-4 py-3.5 transition-all duration-200 hover:shadow-md", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-3", children: [(0, jsx_runtime_1.jsx)("div", { className: "wallet-icon flex h-8 w-8 items-center justify-center rounded-full bg-orange-100", children: (0, jsx_runtime_1.jsx)(lucide_react_1.ZapIcon, { className: "h-4 w-4" }) }), (0, jsx_runtime_1.jsx)("div", { className: "flex flex-col items-start text-left", children: (0, jsx_runtime_1.jsx)("h4", { className: "text-as-primary font-semibold", children: "Transfer crypto" }) })] }), (0, jsx_runtime_1.jsx)(lucide_react_1.ChevronRightCircle, { className: "text-as-primary/40 group-hover:text-as-primary/60 h-5 w-5 transition-colors" })] })] })] })] })] }), showWalletModal &&
150
220
  (0, react_dom_1.createPortal)((0, jsx_runtime_1.jsx)("div", { className: "wallet-connection-modal pointer-events-auto fixed inset-0 z-[9999] flex items-center justify-center bg-black/50", children: (0, jsx_runtime_1.jsxs)("div", { className: "max-h-[80vh] w-[400px] max-w-[90vw] overflow-auto rounded-xl bg-white p-6 dark:bg-gray-900", children: [(0, jsx_runtime_1.jsxs)("div", { className: "mb-4 flex items-center justify-between", children: [(0, jsx_runtime_1.jsx)("h3", { className: "text-lg font-semibold text-gray-900 dark:text-white", children: isConnected ? "Switch wallet or account" : "Choose wallet to connect" }), (0, jsx_runtime_1.jsx)("button", { onClick: handleCloseModal, className: "text-gray-500 hover:text-gray-700 dark:text-gray-400 dark:hover:text-gray-200", children: (0, jsx_runtime_1.jsx)(lucide_react_1.X, { className: "h-5 w-5" }) })] }), (0, jsx_runtime_1.jsx)("div", { className: "space-y-4", children: (0, jsx_runtime_1.jsx)("div", { className: "space-y-3", children: walletOptions.map(walletOption => {
151
221
  const isCurrentWallet = isConnected && connector?.name === walletOption.connector?.name;
152
222
  return ((0, jsx_runtime_1.jsx)("button", { onClick: async () => {
@@ -14,6 +14,7 @@ interface CryptoReceiveSectionProps {
14
14
  anyspendQuote?: any;
15
15
  dstTokenSymbol?: string;
16
16
  dstTokenLogoURI?: string;
17
+ onShowPointsDetail?: () => void;
17
18
  }
18
- export declare function CryptoReceiveSection({ isDepositMode, isBuyMode, selectedRecipientAddress, recipientName, onSelectRecipient, dstAmount, dstToken, selectedDstChainId, setSelectedDstChainId, setSelectedDstToken, onChangeDstAmount, anyspendQuote, dstTokenSymbol, dstTokenLogoURI, }: CryptoReceiveSectionProps): import("react/jsx-runtime").JSX.Element;
19
+ export declare function CryptoReceiveSection({ isDepositMode, isBuyMode, selectedRecipientAddress, recipientName, onSelectRecipient, dstAmount, dstToken, selectedDstChainId, setSelectedDstChainId, setSelectedDstToken, onChangeDstAmount, anyspendQuote, dstTokenSymbol, dstTokenLogoURI, onShowPointsDetail, }: CryptoReceiveSectionProps): import("react/jsx-runtime").JSX.Element;
19
20
  export {};
@@ -8,46 +8,49 @@ const formatAddress_1 = require("../../../../shared/utils/formatAddress");
8
8
  const number_1 = require("../../../../shared/utils/number");
9
9
  const lucide_react_1 = require("lucide-react");
10
10
  const react_1 = require("motion/react");
11
+ const FeatureFlagsContext_1 = require("../../contexts/FeatureFlagsContext");
11
12
  const OrderTokenAmount_1 = require("./OrderTokenAmount");
12
- function CryptoReceiveSection({ isDepositMode = false, isBuyMode = false, selectedRecipientAddress, recipientName, onSelectRecipient, dstAmount, dstToken, selectedDstChainId, setSelectedDstChainId, setSelectedDstToken, onChangeDstAmount, anyspendQuote, dstTokenSymbol, dstTokenLogoURI, }) {
13
+ const PointsBadge_1 = require("./PointsBadge");
14
+ function CryptoReceiveSection({ isDepositMode = false, isBuyMode = false, selectedRecipientAddress, recipientName, onSelectRecipient, dstAmount, dstToken, selectedDstChainId, setSelectedDstChainId, setSelectedDstToken, onChangeDstAmount, anyspendQuote, dstTokenSymbol, dstTokenLogoURI, onShowPointsDetail, }) {
15
+ const featureFlags = (0, FeatureFlagsContext_1.useFeatureFlags)();
13
16
  return ((0, jsx_runtime_1.jsxs)(react_1.motion.div, { initial: { opacity: 0, y: 20, filter: "blur(10px)" }, animate: { opacity: 1, y: 0, filter: "blur(0px)" }, transition: { duration: 0.3, delay: 0.1, ease: "easeInOut" }, className: "receive-section bg-as-surface-secondary border-as-border-secondary relative flex w-full flex-col gap-2 rounded-2xl border p-4 sm:p-6", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex w-full items-center justify-between", children: [(0, jsx_runtime_1.jsx)("div", { className: "text-as-primary/50 flex h-7 items-center text-sm", children: isDepositMode ? "Deposit" : "Receive" }), selectedRecipientAddress ? ((0, jsx_runtime_1.jsx)("button", { className: (0, cn_1.cn)("text-as-tertiarry flex h-7 items-center gap-2 rounded-lg"), onClick: onSelectRecipient, children: (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("span", { className: "text-as-tertiarry flex items-center gap-1 text-sm", children: recipientName ? (0, utils_1.formatUsername)(recipientName) : (0, formatAddress_1.shortenAddress)(selectedRecipientAddress || "") }), (0, jsx_runtime_1.jsx)(lucide_react_1.ChevronRight, { className: "h-4 w-4" })] }) })) : ((0, jsx_runtime_1.jsx)("button", { className: "text-as-primary/70 flex items-center gap-1 rounded-lg", onClick: onSelectRecipient, children: (0, jsx_runtime_1.jsx)("div", { className: "text-sm font-medium", children: "Select recipient" }) }))] }), isBuyMode || isDepositMode ? (
14
17
  // Fixed destination token display for buy mode and deposit mode
15
18
  (0, jsx_runtime_1.jsxs)("div", { className: "flex items-center justify-between", children: [(0, jsx_runtime_1.jsx)("div", { className: "text-as-primary text-2xl font-bold", children: dstAmount || "0" }), (0, jsx_runtime_1.jsxs)("div", { className: "bg-as-brand/10 border-as-brand/30 flex items-center gap-3 rounded-xl border px-4 py-3", children: [(dstTokenLogoURI || dstToken.metadata?.logoURI) && ((0, jsx_runtime_1.jsx)("img", { src: dstTokenLogoURI || dstToken.metadata?.logoURI, alt: dstTokenSymbol || dstToken.symbol, className: "h-8 w-8 rounded-full" })), (0, jsx_runtime_1.jsx)("span", { className: "text-as-brand text-lg font-bold", children: dstTokenSymbol || dstToken.symbol })] })] })) : (
16
19
  // Token selection for regular swap mode
17
- (0, jsx_runtime_1.jsx)(OrderTokenAmount_1.OrderTokenAmount, { address: selectedRecipientAddress, context: "to", inputValue: dstAmount, onChangeInput: onChangeDstAmount || (() => { }), chainId: selectedDstChainId || dstToken.chainId, setChainId: setSelectedDstChainId || (() => { }), token: dstToken, setToken: setSelectedDstToken || (() => { }) })), (0, jsx_runtime_1.jsxs)("div", { className: "text-as-primary/50 flex h-5 items-center text-sm", children: [(0, number_1.formatDisplayNumber)(anyspendQuote?.data?.currencyOut?.amountUsd, {
18
- style: "currency",
19
- fallback: "",
20
- }), anyspendQuote?.data?.currencyIn?.amountUsd &&
21
- anyspendQuote?.data?.currencyOut?.amountUsd &&
22
- (() => {
23
- const calculatePriceImpact = (inputUsd, outputUsd) => {
24
- if (!inputUsd || !outputUsd) {
25
- return { percentage: "0.00", isNegative: false };
26
- }
27
- const input = Number(inputUsd);
28
- const output = Number(outputUsd);
29
- // Handle edge cases
30
- if (input === 0 || isNaN(input) || isNaN(output) || input <= output) {
31
- return { percentage: "0.00", isNegative: false };
32
- }
33
- const percentageValue = ((output - input) / input) * 100;
34
- // Handle the -0.00% case
35
- if (percentageValue > -0.005 && percentageValue < 0) {
36
- return { percentage: "0.00", isNegative: false };
37
- }
38
- return {
39
- percentage: Math.abs(percentageValue).toFixed(2),
40
- isNegative: percentageValue < 0,
41
- };
42
- };
43
- const { percentage, isNegative } = calculatePriceImpact(anyspendQuote.data.currencyIn.amountUsd, anyspendQuote.data.currencyOut.amountUsd);
44
- // Parse the percentage as a number for comparison
45
- const percentageNum = parseFloat(percentage);
46
- // Don't show if less than 1%
47
- if (percentageNum < 1) {
48
- return null;
49
- }
50
- // Using inline style to ensure color displays
51
- return ((0, jsx_runtime_1.jsxs)("span", { className: "ml-2", style: { color: percentageNum >= 10 ? "red" : "#FFD700" }, children: ["(", isNegative ? "-" : "", percentage, "%)"] }));
52
- })()] })] }));
20
+ (0, jsx_runtime_1.jsx)(OrderTokenAmount_1.OrderTokenAmount, { address: selectedRecipientAddress, context: "to", inputValue: dstAmount, onChangeInput: onChangeDstAmount || (() => { }), chainId: selectedDstChainId || dstToken.chainId, setChainId: setSelectedDstChainId || (() => { }), token: dstToken, setToken: setSelectedDstToken || (() => { }) })), (0, jsx_runtime_1.jsxs)("div", { className: "text-as-primary/50 flex h-5 items-center justify-start gap-2 text-sm", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-2", children: [(0, number_1.formatDisplayNumber)(anyspendQuote?.data?.currencyOut?.amountUsd, {
21
+ style: "currency",
22
+ fallback: "",
23
+ }), anyspendQuote?.data?.currencyIn?.amountUsd &&
24
+ anyspendQuote?.data?.currencyOut?.amountUsd &&
25
+ (() => {
26
+ const calculatePriceImpact = (inputUsd, outputUsd) => {
27
+ if (!inputUsd || !outputUsd) {
28
+ return { percentage: "0.00", isNegative: false };
29
+ }
30
+ const input = Number(inputUsd);
31
+ const output = Number(outputUsd);
32
+ // Handle edge cases
33
+ if (input === 0 || isNaN(input) || isNaN(output) || input <= output) {
34
+ return { percentage: "0.00", isNegative: false };
35
+ }
36
+ const percentageValue = ((output - input) / input) * 100;
37
+ // Handle the -0.00% case
38
+ if (percentageValue > -0.005 && percentageValue < 0) {
39
+ return { percentage: "0.00", isNegative: false };
40
+ }
41
+ return {
42
+ percentage: Math.abs(percentageValue).toFixed(2),
43
+ isNegative: percentageValue < 0,
44
+ };
45
+ };
46
+ const { percentage, isNegative } = calculatePriceImpact(anyspendQuote.data.currencyIn.amountUsd, anyspendQuote.data.currencyOut.amountUsd);
47
+ // Parse the percentage as a number for comparison
48
+ const percentageNum = parseFloat(percentage);
49
+ // Don't show if less than 1%
50
+ if (percentageNum < 1) {
51
+ return null;
52
+ }
53
+ // Using inline style to ensure color displays
54
+ return ((0, jsx_runtime_1.jsxs)("span", { className: "ml-2", style: { color: percentageNum >= 10 ? "red" : "#FFD700" }, children: ["(", isNegative ? "-" : "", percentage, "%)"] }));
55
+ })()] }), featureFlags.showPoints && anyspendQuote?.data?.pointsAmount > 0 && ((0, jsx_runtime_1.jsx)(PointsBadge_1.PointsBadge, { pointsAmount: anyspendQuote.data.pointsAmount, pointsMultiplier: anyspendQuote.data.pointsMultiplier, onClick: () => onShowPointsDetail?.() }))] })] }));
53
56
  }
@@ -55,9 +55,6 @@ function getOrderSuccessText({ order, tournament, formattedActualDstAmount, form
55
55
  case "custom":
56
56
  actionText = order.metadata.action || `executed contract`;
57
57
  return `Successfully ${actionText}`;
58
- case "hype_duel":
59
- actionText = `deposited ${formattedActualDstAmount || "--"} HYPE`;
60
- return `Successfully ${actionText} to ${recipient}`;
61
58
  default:
62
59
  throw new Error("Invalid order type");
63
60
  }
@@ -142,9 +139,9 @@ exports.OrderDetails = (0, react_4.memo)(function OrderDetails({ mode = "modal",
142
139
  const colorMode = theme || "light";
143
140
  // Read crypto payment method from URL parameters
144
141
  const cryptoPaymentMethodFromUrl = searchParams.get("cryptoPaymentMethod");
145
- const effectiveCryptoPaymentMethod = cryptoPaymentMethod || cryptoPaymentMethodFromUrl || CryptoPaymentMethod_1.CryptoPaymentMethodType.NONE;
146
- // Use selectedCryptoPaymentMethod for OrderStatus if provided, otherwise fall back to effective method
147
- const orderStatusPaymentMethod = selectedCryptoPaymentMethod || effectiveCryptoPaymentMethod;
142
+ const effectiveCryptoPaymentMethod = selectedCryptoPaymentMethod !== CryptoPaymentMethod_1.CryptoPaymentMethodType.NONE
143
+ ? selectedCryptoPaymentMethod
144
+ : cryptoPaymentMethod || cryptoPaymentMethodFromUrl || CryptoPaymentMethod_1.CryptoPaymentMethodType.NONE;
148
145
  const setB3ModalOpen = (0, react_1.useModalStore)((state) => state.setB3ModalOpen);
149
146
  const srcToken = order.metadata.srcToken;
150
147
  const dstToken = order.metadata.dstToken;
@@ -425,7 +422,7 @@ exports.OrderDetails = (0, react_4.memo)(function OrderDetails({ mode = "modal",
425
422
  }
426
423
  };
427
424
  if (refundTxs.length > 0) {
428
- return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(OrderStatus_1.OrderStatus, { order: order, selectedCryptoPaymentMethod: orderStatusPaymentMethod }), (0, jsx_runtime_1.jsx)(OrderDetailsCollapsible_1.OrderDetailsCollapsible, { order: order, dstToken: dstToken, tournament: tournament, nft: nft, recipientName: recipientName, formattedExpectedDstAmount: formattedExpectedDstAmount }), (0, jsx_runtime_1.jsx)(Accordion_1.Accordion, { type: "single", collapsible: true, className: "order-details-accordion w-full", children: (0, jsx_runtime_1.jsxs)(Accordion_1.AccordionItem, { value: "refund-details", className: "order-details-refund-item", children: [(0, jsx_runtime_1.jsx)(Accordion_1.AccordionTrigger, { className: "accordion-trigger", children: "Transaction Details" }), (0, jsx_runtime_1.jsx)(Accordion_1.AccordionContent, { className: "accordion-content pl-2", children: (0, jsx_runtime_1.jsxs)("div", { className: "relative flex w-full flex-col gap-4", children: [(0, jsx_runtime_1.jsx)("div", { className: "bg-as-surface-secondary absolute bottom-2 left-4 top-2 z-[5] w-2", children: (0, jsx_runtime_1.jsx)(react_3.motion.div, { className: "bg-as-border-primary absolute left-[2px] top-0 z-10 w-[3px]", initial: { height: "0%" }, animate: { height: "100%" }, transition: { duration: 1.5, ease: "easeInOut" } }) }), depositTxs
425
+ return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(OrderStatus_1.OrderStatus, { order: order, selectedCryptoPaymentMethod: effectiveCryptoPaymentMethod }), (0, jsx_runtime_1.jsx)(OrderDetailsCollapsible_1.OrderDetailsCollapsible, { order: order, dstToken: dstToken, tournament: tournament, nft: nft, recipientName: recipientName, formattedExpectedDstAmount: formattedExpectedDstAmount }), (0, jsx_runtime_1.jsx)(Accordion_1.Accordion, { type: "single", collapsible: true, className: "order-details-accordion w-full", children: (0, jsx_runtime_1.jsxs)(Accordion_1.AccordionItem, { value: "refund-details", className: "order-details-refund-item", children: [(0, jsx_runtime_1.jsx)(Accordion_1.AccordionTrigger, { className: "accordion-trigger", children: "Transaction Details" }), (0, jsx_runtime_1.jsx)(Accordion_1.AccordionContent, { className: "accordion-content pl-2", children: (0, jsx_runtime_1.jsxs)("div", { className: "relative flex w-full flex-col gap-4", children: [(0, jsx_runtime_1.jsx)("div", { className: "bg-as-surface-secondary absolute bottom-2 left-4 top-2 z-[5] w-2", children: (0, jsx_runtime_1.jsx)(react_3.motion.div, { className: "bg-as-border-primary absolute left-[2px] top-0 z-10 w-[3px]", initial: { height: "0%" }, animate: { height: "100%" }, transition: { duration: 1.5, ease: "easeInOut" } }) }), depositTxs
429
426
  ? depositTxs.map(dTx => ((0, jsx_runtime_1.jsx)(TransactionDetails, { title: order.onrampMetadata?.vendor === "stripe-web2"
430
427
  ? `Received payment`
431
428
  : `Received ${(0, number_1.formatTokenAmount)(BigInt(dTx.amount), srcToken.decimals)} ${srcToken.symbol}`, chainId: order.srcChain, tx: dTx, isProcessing: false }, dTx.txHash)))
@@ -434,7 +431,7 @@ exports.OrderDetails = (0, react_4.memo)(function OrderDetails({ mode = "modal",
434
431
  : null] }) })] }) }), order.errorDetails && ((0, jsx_runtime_1.jsx)("div", { className: "flex justify-center", children: (0, jsx_runtime_1.jsx)("span", { className: "text-as-primary/50 text-center text-sm", style: { maxWidth: "40ch" }, children: (0, anyspend_1.getErrorDisplay)(order.errorDetails) }) })), (0, jsx_runtime_1.jsx)("button", { className: "order-close-button order-details-close-btn bg-as-brand flex w-full items-center justify-center gap-2 rounded-lg p-2 font-semibold text-white", onClick: mode === "page" ? handleBack : handleCloseModal, children: mode === "page" ? ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: ["Return to Home ", (0, jsx_runtime_1.jsx)(lucide_react_1.Home, { className: "ml-2 h-4 w-4" })] })) : ("Close") })] }));
435
432
  }
436
433
  if (executeTx) {
437
- return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(OrderStatus_1.OrderStatus, { order: order, selectedCryptoPaymentMethod: orderStatusPaymentMethod }), (0, jsx_runtime_1.jsx)(OrderDetailsCollapsible_1.OrderDetailsCollapsible, { order: order, dstToken: dstToken, tournament: tournament, nft: nft, recipientName: recipientName, formattedExpectedDstAmount: formattedExpectedDstAmount }), (0, jsx_runtime_1.jsx)(Accordion_1.Accordion, { type: "single", collapsible: true, className: "order-details-accordion w-full", children: (0, jsx_runtime_1.jsxs)(Accordion_1.AccordionItem, { value: "execute-details", className: "order-details-execute-item", children: [(0, jsx_runtime_1.jsx)(Accordion_1.AccordionTrigger, { className: "order-details-execute-trigger", children: "Transaction Details" }), (0, jsx_runtime_1.jsx)(Accordion_1.AccordionContent, { className: "order-details-execute-content pl-2", children: (0, jsx_runtime_1.jsxs)("div", { className: "relative flex w-full flex-col gap-4", children: [(0, jsx_runtime_1.jsx)("div", { className: "bg-as-surface-secondary absolute bottom-2 left-4 top-2 z-[5] w-2", children: (0, jsx_runtime_1.jsx)(react_3.motion.div, { className: "bg-as-border-primary absolute left-[2px] top-0 z-10 w-[3px]", initial: { height: "0%" }, animate: { height: "100%" }, transition: { duration: 1.5, ease: "easeInOut" } }) }), depositTxs
434
+ return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(OrderStatus_1.OrderStatus, { order: order, selectedCryptoPaymentMethod: effectiveCryptoPaymentMethod }), (0, jsx_runtime_1.jsx)(OrderDetailsCollapsible_1.OrderDetailsCollapsible, { order: order, dstToken: dstToken, tournament: tournament, nft: nft, recipientName: recipientName, formattedExpectedDstAmount: formattedExpectedDstAmount }), (0, jsx_runtime_1.jsx)(Accordion_1.Accordion, { type: "single", collapsible: true, className: "order-details-accordion w-full", children: (0, jsx_runtime_1.jsxs)(Accordion_1.AccordionItem, { value: "execute-details", className: "order-details-execute-item", children: [(0, jsx_runtime_1.jsx)(Accordion_1.AccordionTrigger, { className: "accordion-trigger", children: "Transaction Details" }), (0, jsx_runtime_1.jsx)(Accordion_1.AccordionContent, { className: "accordion-content pl-2", children: (0, jsx_runtime_1.jsxs)("div", { className: "relative flex w-full flex-col gap-4", children: [(0, jsx_runtime_1.jsx)("div", { className: "bg-as-surface-secondary absolute bottom-2 left-4 top-2 z-[5] w-2", children: (0, jsx_runtime_1.jsx)(react_3.motion.div, { className: "bg-as-border-primary absolute left-[2px] top-0 z-10 w-[3px]", initial: { height: "0%" }, animate: { height: "100%" }, transition: { duration: 1.5, ease: "easeInOut" } }) }), depositTxs
438
435
  ? depositTxs.map(dTxs => ((0, jsx_runtime_1.jsx)(TransactionDetails, { title: order.onrampMetadata?.vendor === "stripe-web2"
439
436
  ? `Received payment`
440
437
  : `Received ${(0, number_1.formatTokenAmount)(BigInt(dTxs.amount), srcToken.decimals)} ${srcToken.symbol}`, chainId: order.srcChain, tx: dTxs, isProcessing: false }, dTxs.txHash)))
@@ -459,7 +456,7 @@ exports.OrderDetails = (0, react_4.memo)(function OrderDetails({ mode = "modal",
459
456
  }), (0, jsx_runtime_1.jsx)(lucide_react_1.ExternalLink, { className: "ml-2 h-4 w-4" })] }) }) }), order.type === "join_tournament" && order.status === "executed" && ((0, jsx_runtime_1.jsxs)(react_1.ShinyButton, { accentColor: "hsl(var(--as-brand))", textColor: "text-white", className: "flex w-full items-center gap-2", disabled: txLoading || isSwitchingOrExecuting, onClick: handleCloseModal, children: [(0, jsx_runtime_1.jsx)("span", { className: "pl-4", children: "Continue to Tournament" }), (0, jsx_runtime_1.jsx)(lucide_react_1.ChevronRight, { className: "h-4 w-4" })] })), order.status === "executed" && ((0, jsx_runtime_1.jsx)("button", { className: "order-close-button order-details-close-btn bg-as-brand flex w-full items-center justify-center gap-2 rounded-lg p-2 font-semibold text-white", onClick: mode === "page" ? handleBack : handleCloseModal, children: mode === "page" ? ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: ["Return to Home ", (0, jsx_runtime_1.jsx)(lucide_react_1.Home, { className: "ml-2 h-4 w-4" })] })) : ("Close") }))] }));
460
457
  }
461
458
  if (relayTxs.length > 0 && relayTxs.every(tx => tx.status === "success")) {
462
- return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(OrderStatus_1.OrderStatus, { order: order, selectedCryptoPaymentMethod: orderStatusPaymentMethod }), (0, jsx_runtime_1.jsx)(OrderDetailsCollapsible_1.OrderDetailsCollapsible, { order: order, dstToken: dstToken, tournament: tournament, nft: nft, recipientName: recipientName, formattedExpectedDstAmount: formattedExpectedDstAmount }), (0, jsx_runtime_1.jsx)(Accordion_1.Accordion, { type: "single", collapsible: true, className: "order-details-accordion w-full", children: (0, jsx_runtime_1.jsxs)(Accordion_1.AccordionItem, { value: "more-details", className: "order-details-more-item", children: [(0, jsx_runtime_1.jsx)(Accordion_1.AccordionTrigger, { className: "accordion-trigger", children: "More Details" }), (0, jsx_runtime_1.jsx)(Accordion_1.AccordionContent, { className: "accordion-content pl-2", children: (0, jsx_runtime_1.jsxs)("div", { className: "relative flex w-full flex-col gap-4", children: [(0, jsx_runtime_1.jsx)("div", { className: "bg-as-surface-secondary absolute bottom-2 left-4 top-2 z-[5] w-2", children: (0, jsx_runtime_1.jsx)(react_3.motion.div, { className: "bg-as-border-primary absolute left-[2px] top-0 z-10 w-[3px]", initial: { height: "0%" }, animate: { height: "100%" }, transition: { duration: 1.5, ease: "easeInOut" } }) }), depositTxs
459
+ return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(OrderStatus_1.OrderStatus, { order: order, selectedCryptoPaymentMethod: effectiveCryptoPaymentMethod }), (0, jsx_runtime_1.jsx)(OrderDetailsCollapsible_1.OrderDetailsCollapsible, { order: order, dstToken: dstToken, tournament: tournament, nft: nft, recipientName: recipientName, formattedExpectedDstAmount: formattedExpectedDstAmount }), (0, jsx_runtime_1.jsx)(Accordion_1.Accordion, { type: "single", collapsible: true, className: "order-details-accordion w-full", children: (0, jsx_runtime_1.jsxs)(Accordion_1.AccordionItem, { value: "more-details", className: "order-details-more-item", children: [(0, jsx_runtime_1.jsx)(Accordion_1.AccordionTrigger, { className: "accordion-trigger", children: "More Details" }), (0, jsx_runtime_1.jsx)(Accordion_1.AccordionContent, { className: "accordion-content pl-2", children: (0, jsx_runtime_1.jsxs)("div", { className: "relative flex w-full flex-col gap-4", children: [(0, jsx_runtime_1.jsx)("div", { className: "bg-as-surface-secondary absolute bottom-2 left-4 top-2 z-[5] w-2", children: (0, jsx_runtime_1.jsx)(react_3.motion.div, { className: "bg-as-border-primary absolute left-[2px] top-0 z-10 w-[3px]", initial: { height: "0%" }, animate: { height: "100%" }, transition: { duration: 1.5, ease: "easeInOut" } }) }), depositTxs
463
460
  ? depositTxs.map(dTxs => ((0, jsx_runtime_1.jsx)(TransactionDetails, { title: order.onrampMetadata?.vendor === "stripe-web2"
464
461
  ? `Received payment`
465
462
  : `Received ${(0, number_1.formatTokenAmount)(BigInt(dTxs.amount), srcToken.decimals)} ${srcToken.symbol}`, chainId: order.srcChain, tx: dTxs, isProcessing: false }, dTxs.txHash)))
@@ -478,7 +475,7 @@ exports.OrderDetails = (0, react_4.memo)(function OrderDetails({ mode = "modal",
478
475
  // This boolean indicates that user finish payment, and waiting for the deposit to be confirmed. We get this from query params (waitingForDeposit=true)
479
476
  const waitingForDeposit = new URLSearchParams(window.location.search).get("waitingForDeposit") === "true";
480
477
  if (depositTxs?.length || waitingForDeposit) {
481
- return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(OrderStatus_1.OrderStatus, { order: order, selectedCryptoPaymentMethod: orderStatusPaymentMethod }), (0, jsx_runtime_1.jsx)(OrderDetailsCollapsible_1.OrderDetailsCollapsible, { order: order, dstToken: dstToken, tournament: tournament, nft: nft, recipientName: recipientName, formattedExpectedDstAmount: formattedExpectedDstAmount }), (0, jsx_runtime_1.jsx)(Accordion_1.Accordion, { type: "single", collapsible: true, className: "order-details-accordion w-full", children: (0, jsx_runtime_1.jsxs)(Accordion_1.AccordionItem, { value: "deposit-details", className: "order-details-deposit-item", children: [(0, jsx_runtime_1.jsx)(Accordion_1.AccordionTrigger, { className: "accordion-trigger", children: "Transaction Details" }), (0, jsx_runtime_1.jsx)(Accordion_1.AccordionContent, { className: "accordion-content pl-2", children: (0, jsx_runtime_1.jsxs)("div", { className: "relative flex w-full flex-col gap-6", children: [(0, jsx_runtime_1.jsx)("div", { className: "bg-as-surface-secondary absolute bottom-2 left-4 top-2 z-[5] w-2", children: (0, jsx_runtime_1.jsx)(react_3.motion.div, { className: "from-as-brand/50 absolute left-[2px] top-0 z-10 w-[3px] bg-gradient-to-b from-20% via-purple-500/50 via-80% to-transparent", initial: { height: "0%" }, animate: { height: "100%" }, transition: { duration: 1, ease: "easeInOut" } }) }), (depositTxs || []).map((dTxs, index) => ((0, jsx_runtime_1.jsx)(TransactionDetails, { title: order.onrampMetadata?.vendor === "stripe-web2"
478
+ return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(OrderStatus_1.OrderStatus, { order: order, selectedCryptoPaymentMethod: effectiveCryptoPaymentMethod }), (0, jsx_runtime_1.jsx)(OrderDetailsCollapsible_1.OrderDetailsCollapsible, { order: order, dstToken: dstToken, tournament: tournament, nft: nft, recipientName: recipientName, formattedExpectedDstAmount: formattedExpectedDstAmount }), (0, jsx_runtime_1.jsx)(Accordion_1.Accordion, { type: "single", collapsible: true, className: "order-details-accordion w-full", children: (0, jsx_runtime_1.jsxs)(Accordion_1.AccordionItem, { value: "deposit-details", className: "order-details-deposit-item", children: [(0, jsx_runtime_1.jsx)(Accordion_1.AccordionTrigger, { className: "accordion-trigger", children: "Transaction Details" }), (0, jsx_runtime_1.jsx)(Accordion_1.AccordionContent, { className: "accordion-content pl-2", children: (0, jsx_runtime_1.jsxs)("div", { className: "relative flex w-full flex-col gap-6", children: [(0, jsx_runtime_1.jsx)("div", { className: "bg-as-surface-secondary absolute bottom-2 left-4 top-2 z-[5] w-2", children: (0, jsx_runtime_1.jsx)(react_3.motion.div, { className: "from-as-brand/50 absolute left-[2px] top-0 z-10 w-[3px] bg-gradient-to-b from-20% via-purple-500/50 via-80% to-transparent", initial: { height: "0%" }, animate: { height: "100%" }, transition: { duration: 1, ease: "easeInOut" } }) }), (depositTxs || []).map((dTxs, index) => ((0, jsx_runtime_1.jsx)(TransactionDetails, { title: order.onrampMetadata?.vendor === "stripe-web2"
482
479
  ? `Received payment`
483
480
  : `Received ${(0, number_1.formatTokenAmount)(BigInt(dTxs.amount), srcToken.decimals)} ${srcToken.symbol}`, chainId: order.srcChain, tx: dTxs, isProcessing: index < (depositTxs || []).length - 1 ? false : !depositEnoughAmount }, dTxs.txHash))), statusDisplay === "failure" ? ((0, jsx_runtime_1.jsx)(TransactionDetails, { title: statusText, chainId: order.srcChain, tx: null, isProcessing: false, delay: 0.5 })) : depositEnoughAmount ? ((0, jsx_runtime_1.jsx)(TransactionDetails, { title: order.type === "swap"
484
481
  ? "Processing Swap"
@@ -492,7 +489,7 @@ exports.OrderDetails = (0, react_4.memo)(function OrderDetails({ mode = "modal",
492
489
  ? `Waiting for payment`
493
490
  : `Waiting for deposit ${formattedDepositDeficit} ${srcToken.symbol}`, chainId: order.srcChain, tx: null, isProcessing: true, delay: 0.5 }))] }) })] }) }), !depositEnoughAmount && order.status !== "expired" && ((0, jsx_runtime_1.jsx)(InsufficientDepositPayment_1.InsufficientDepositPayment, { order: order, srcToken: srcToken, depositDeficit: depositDeficit, phantomWalletAddress: phantomWalletAddress, txLoading: txLoading, isSwitchingOrExecuting: isSwitchingOrExecuting, onPayment: handlePayment }))] }));
494
491
  }
495
- return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(OrderStatus_1.OrderStatus, { order: order, selectedCryptoPaymentMethod: orderStatusPaymentMethod }), statusDisplay === "processing" && ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: order.onrampMetadata ? ((0, jsx_runtime_1.jsx)(PaymentVendorUI_1.default, { order: order, dstTokenSymbol: dstToken.symbol })) : effectiveCryptoPaymentMethod === CryptoPaymentMethod_1.CryptoPaymentMethodType.CONNECT_WALLET ||
492
+ return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(OrderStatus_1.OrderStatus, { order: order, selectedCryptoPaymentMethod: effectiveCryptoPaymentMethod }), statusDisplay === "processing" && ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: order.onrampMetadata ? ((0, jsx_runtime_1.jsx)(PaymentVendorUI_1.default, { order: order, dstTokenSymbol: dstToken.symbol })) : effectiveCryptoPaymentMethod === CryptoPaymentMethod_1.CryptoPaymentMethodType.CONNECT_WALLET ||
496
493
  effectiveCryptoPaymentMethod === CryptoPaymentMethod_1.CryptoPaymentMethodType.GLOBAL_WALLET ? ((0, jsx_runtime_1.jsx)(ConnectWalletPayment_1.default, { order: order, onPayment: handlePayment, onCancel: handleBack, txLoading: txLoading, isSwitchingOrExecuting: isSwitchingOrExecuting, phantomWalletAddress: phantomWalletAddress, tournament: tournament, nft: nft, cryptoPaymentMethod: effectiveCryptoPaymentMethod, onPaymentMethodChange: onPaymentMethodChange })) : effectiveCryptoPaymentMethod === CryptoPaymentMethod_1.CryptoPaymentMethodType.TRANSFER_CRYPTO ? (
497
494
  // Transfer Crypto Payment Method - Show new card-based UI
498
495
  (0, jsx_runtime_1.jsx)(TransferCryptoDetails_1.TransferCryptoDetails, { order: order, recipientName: recipientName, srcToken: srcToken, dstToken: dstToken, tournament: tournament, nft: nft, onBack: handleBack, onPaymentMethodChange: onPaymentMethodChange })) : ((0, jsx_runtime_1.jsxs)("div", { className: "order-details-payment-section relative flex w-full flex-1 flex-col", children: [(0, jsx_runtime_1.jsxs)("div", { className: "order-details-amount-section flex flex-col gap-1", children: [(0, jsx_runtime_1.jsx)("span", { className: "text-as-primary/50 order-details-amount-label", children: "Please send" }), (0, jsx_runtime_1.jsxs)("div", { className: "order-details-amount-container flex w-full flex-wrap items-center gap-6 sm:justify-between sm:gap-0", children: [(0, jsx_runtime_1.jsx)(react_1.CopyToClipboard, { text: roundedUpSrcAmount, onCopy: () => {
@@ -1,5 +1,5 @@
1
1
  import { components } from "../../../../anyspend/types/api";
2
- export declare function OrderTokenAmount({ disabled, inputValue, onChangeInput, context, address, chainId, setChainId, token, setToken, hideTokenSelect, canEditAmount, className, innerClassName, amountClassName, tokenSelectClassName, }: {
2
+ export declare function OrderTokenAmount({ disabled, inputValue, onChangeInput, context, address, chainId, setChainId, token, setToken, hideTokenSelect, canEditAmount, className, innerClassName, amountClassName, tokenSelectClassName, onTokenSelect, }: {
3
3
  disabled?: boolean;
4
4
  inputValue: string;
5
5
  onChangeInput: (value: string) => void;
@@ -15,4 +15,7 @@ export declare function OrderTokenAmount({ disabled, inputValue, onChangeInput,
15
15
  innerClassName?: string;
16
16
  amountClassName?: string;
17
17
  tokenSelectClassName?: string;
18
+ onTokenSelect?: (token: components["schemas"]["Token"], event: {
19
+ preventDefault: () => void;
20
+ }) => void;
18
21
  }): import("react/jsx-runtime").JSX.Element;
@@ -11,7 +11,7 @@ const react_2 = require("../../../../global-account/react");
11
11
  const utils_1 = require("../../../../shared/utils");
12
12
  const relay_kit_ui_1 = require("@reservoir0x/relay-kit-ui");
13
13
  const ChainTokenIcon_1 = require("./ChainTokenIcon");
14
- function OrderTokenAmount({ disabled, inputValue, onChangeInput, context, address, chainId, setChainId, token, setToken, hideTokenSelect = false, canEditAmount = true, className, innerClassName, amountClassName, tokenSelectClassName, }) {
14
+ function OrderTokenAmount({ disabled, inputValue, onChangeInput, context, address, chainId, setChainId, token, setToken, hideTokenSelect = false, canEditAmount = true, className, innerClassName, amountClassName, tokenSelectClassName, onTokenSelect, }) {
15
15
  // Track previous token to detect changes
16
16
  const prevTokenRef = (0, react_1.useRef)(token.address);
17
17
  (0, react_1.useEffect)(() => {
@@ -28,19 +28,33 @@ function OrderTokenAmount({ disabled, inputValue, onChangeInput, context, addres
28
28
  }
29
29
  }, [token.address, chainId, context, onChangeInput]);
30
30
  const handleTokenSelect = (newToken) => {
31
- // Mark that we're about to change tokens
32
- prevTokenRef.current = "changing"; // Temporary value to force effect
33
- // Set the chain ID first
34
- setChainId(newToken.chainId);
35
- // Then set the new token
36
- setToken({
31
+ const token = {
37
32
  address: newToken.address,
38
- chainId: newToken.chainId, // Use the new chain ID
33
+ chainId: newToken.chainId,
39
34
  decimals: newToken.decimals,
40
35
  metadata: { logoURI: newToken.logoURI },
41
36
  name: newToken.name,
42
37
  symbol: newToken.symbol,
43
- });
38
+ };
39
+ // Call the onTokenSelect callback if provided
40
+ if (onTokenSelect) {
41
+ let isDefaultPrevented = false;
42
+ const event = {
43
+ preventDefault: () => {
44
+ isDefaultPrevented = true;
45
+ },
46
+ };
47
+ onTokenSelect(token, event);
48
+ if (isDefaultPrevented) {
49
+ return; // Early return if callback prevented default behavior
50
+ }
51
+ }
52
+ // Mark that we're about to change tokens
53
+ prevTokenRef.current = "changing"; // Temporary value to force effect
54
+ // Set the chain ID first
55
+ setChainId(newToken.chainId);
56
+ // Then set the new token
57
+ setToken(token);
44
58
  // If this is the source token, reset the amount immediately
45
59
  if (context === "from") {
46
60
  onChangeInput("0.01");
@@ -1,6 +1,7 @@
1
1
  import { components } from "../../../../anyspend/types/api";
2
+ import { GetQuoteResponse } from "../../../../anyspend/types/api_req_res";
2
3
  import { FiatPaymentMethod } from "./FiatPaymentMethod";
3
- export declare function PanelOnramp({ srcAmountOnRamp, setSrcAmountOnRamp, selectedPaymentMethod, setActivePanel, _recipientAddress, destinationToken, destinationChainId, destinationAmount, onDestinationTokenChange, onDestinationChainChange, fiatPaymentMethodIndex, recipientSelectionPanelIndex, dstTokenSymbol, hideDstToken, }: {
4
+ export declare function PanelOnramp({ srcAmountOnRamp, setSrcAmountOnRamp, selectedPaymentMethod, setActivePanel, _recipientAddress, destinationToken, destinationChainId, destinationAmount, onDestinationTokenChange, onDestinationChainChange, fiatPaymentMethodIndex, recipientSelectionPanelIndex, dstTokenSymbol, hideDstToken, anyspendQuote, onShowPointsDetail, }: {
4
5
  srcAmountOnRamp: string;
5
6
  setSrcAmountOnRamp: (amount: string) => void;
6
7
  selectedPaymentMethod?: FiatPaymentMethod;
@@ -15,4 +16,6 @@ export declare function PanelOnramp({ srcAmountOnRamp, setSrcAmountOnRamp, selec
15
16
  recipientSelectionPanelIndex: number;
16
17
  dstTokenSymbol?: string;
17
18
  hideDstToken?: boolean;
19
+ anyspendQuote?: GetQuoteResponse;
20
+ onShowPointsDetail?: () => void;
18
21
  }): import("react/jsx-runtime").JSX.Element;
@@ -10,9 +10,12 @@ const formatAddress_1 = require("../../../../shared/utils/formatAddress");
10
10
  const lucide_react_1 = require("lucide-react");
11
11
  const react_3 = require("react");
12
12
  const sonner_1 = require("sonner");
13
+ const FeatureFlagsContext_1 = require("../../contexts/FeatureFlagsContext");
13
14
  const FiatPaymentMethod_1 = require("./FiatPaymentMethod");
14
15
  const OrderTokenAmountFiat_1 = require("./OrderTokenAmountFiat");
15
- function PanelOnramp({ srcAmountOnRamp, setSrcAmountOnRamp, selectedPaymentMethod, setActivePanel, _recipientAddress, destinationToken, destinationChainId, destinationAmount, onDestinationTokenChange, onDestinationChainChange, fiatPaymentMethodIndex, recipientSelectionPanelIndex, dstTokenSymbol, hideDstToken = false, }) {
16
+ const PointsBadge_1 = require("./PointsBadge");
17
+ function PanelOnramp({ srcAmountOnRamp, setSrcAmountOnRamp, selectedPaymentMethod, setActivePanel, _recipientAddress, destinationToken, destinationChainId, destinationAmount, onDestinationTokenChange, onDestinationChainChange, fiatPaymentMethodIndex, recipientSelectionPanelIndex, dstTokenSymbol, hideDstToken = false, anyspendQuote, onShowPointsDetail, }) {
18
+ const featureFlags = (0, FeatureFlagsContext_1.useFeatureFlags)();
16
19
  // Get geo-based onramp options to access fee information
17
20
  const { stripeWeb2Support } = (0, react_1.useGeoOnrampOptions)(srcAmountOnRamp);
18
21
  // Helper function to get fees from API data
@@ -73,9 +76,10 @@ function PanelOnramp({ srcAmountOnRamp, setSrcAmountOnRamp, selectedPaymentMetho
73
76
  width: `${Math.max(50, srcAmountOnRamp.length * 34)}px`,
74
77
  } })] }) }), (0, jsx_runtime_1.jsx)("div", { className: (0, utils_1.cn)("mx-auto mb-6 inline-grid grid-cols-4 gap-2", hideDstToken && "mb-0"), children: ["5", "10", "20", "25"].map(value => ((0, jsx_runtime_1.jsxs)("button", { onClick: () => handleQuickAmount(value), className: `bg-as-surface-secondary border-as-border-secondary hover:border-as-border-secondary h-7 w-14 rounded-lg border text-sm font-medium transition-all duration-200 ${srcAmountOnRamp === value
75
78
  ? "border-as-border-secondary bg-as-surface-secondary"
76
- : "bg-as-surface-secondary hover:bg-as-surface-secondary"}`, children: ["$", value] }, value))) }), destinationToken && destinationChainId && !hideDstToken && ((0, jsx_runtime_1.jsx)(OrderTokenAmountFiat_1.OrderTokenAmountFiat, { address: _recipientAddress, context: "to", inputValue: destinationAmount || "0", onChangeInput: () => { }, chainId: destinationChainId, setChainId: onDestinationChainChange || (() => { }), token: destinationToken, setToken: onDestinationTokenChange || (() => { }) }))] }), (0, jsx_runtime_1.jsxs)("div", { className: "border-as-border-secondary bg-as-surface-secondary mt-4 flex w-full flex-col gap-3 rounded-xl border p-4", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex w-full items-center justify-between gap-2", children: [(0, jsx_runtime_1.jsx)("span", { className: "text-as-tertiarry flex items-center text-sm", children: "Recipient" }), _recipientAddress ? ((0, jsx_runtime_1.jsxs)("button", { className: "text-as-tertiarry flex h-7 items-center gap-1 text-sm transition-colors hover:text-blue-700", onClick: () => setActivePanel(recipientSelectionPanelIndex), children: [(0, jsx_runtime_1.jsx)("span", { className: "text-sm", children: recipientName ? (0, utils_1.formatUsername)(recipientName) : (0, formatAddress_1.formatAddress)(_recipientAddress) }), (0, jsx_runtime_1.jsx)(lucide_react_1.ChevronRight, { size: 16 })] })) : ((0, jsx_runtime_1.jsxs)("button", { className: "text-as-tertiarry flex h-7 items-center gap-1 text-sm transition-colors hover:text-blue-700", onClick: () => setActivePanel(5), children: [(0, jsx_runtime_1.jsx)(lucide_react_1.Wallet, { className: "text-as-brand", size: 16 }), "Select recipient", (0, jsx_runtime_1.jsx)(lucide_react_1.ChevronRight, { size: 16 })] }))] }), (0, jsx_runtime_1.jsx)("div", { className: "divider w-full" }), (0, jsx_runtime_1.jsxs)("div", { className: "flex items-center justify-between", children: [(0, jsx_runtime_1.jsx)("span", { className: "text-as-tertiarry text-sm", children: "Expected to receive" }), (0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-2", children: [(0, jsx_runtime_1.jsxs)("span", { className: "text-as-primary font-semibold", children: [destinationAmount || "0", " ", dstTokenSymbol || destinationToken?.symbol || ""] }), (0, jsx_runtime_1.jsxs)("span", { className: "text-as-tertiarry text-sm", children: ["on ", destinationChainId ? chain_1.ALL_CHAINS[destinationChainId]?.name : ""] }), destinationToken && destinationChainId && destinationToken.metadata?.logoURI && ((0, jsx_runtime_1.jsx)("img", { src: chain_1.ALL_CHAINS[destinationChainId]?.logoUrl, alt: "Chain", className: "h-4 w-4 rounded-full" }))] })] }), (0, jsx_runtime_1.jsx)("div", { className: "divider w-full" }), (0, jsx_runtime_1.jsx)("div", { className: "", children: (0, jsx_runtime_1.jsx)("div", { className: "flex items-center justify-between", children: (() => {
77
- const currentPaymentMethod = selectedPaymentMethod || FiatPaymentMethod_1.FiatPaymentMethod.NONE;
78
- const fee = getFeeFromApi(currentPaymentMethod);
79
- return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("span", { className: "text-as-tertiarry text-sm", children: fee !== null ? `Total (included $${fee.toFixed(2)} fee)` : "Total" }), (0, jsx_runtime_1.jsxs)("span", { className: "text-as-primary font-semibold", children: ["$", getTotalAmount(currentPaymentMethod).toFixed(2)] })] }));
80
- })() }) })] })] }));
79
+ : "bg-as-surface-secondary hover:bg-as-surface-secondary"}`, children: ["$", value] }, value))) }), destinationToken && destinationChainId && !hideDstToken && ((0, jsx_runtime_1.jsx)(OrderTokenAmountFiat_1.OrderTokenAmountFiat, { address: _recipientAddress, context: "to", inputValue: destinationAmount || "0", onChangeInput: () => { }, chainId: destinationChainId, setChainId: onDestinationChainChange || (() => { }), token: destinationToken, setToken: onDestinationTokenChange || (() => { }) }))] }), (0, jsx_runtime_1.jsxs)("div", { className: "border-as-border-secondary bg-as-surface-secondary mt-4 flex w-full flex-col gap-3 rounded-xl border p-4", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex w-full items-center justify-between gap-2", children: [(0, jsx_runtime_1.jsx)("span", { className: "text-as-tertiarry flex items-center text-sm", children: "Recipient" }), _recipientAddress ? ((0, jsx_runtime_1.jsxs)("button", { className: "text-as-tertiarry flex h-7 items-center gap-1 text-sm transition-colors hover:text-blue-700", onClick: () => setActivePanel(recipientSelectionPanelIndex), children: [(0, jsx_runtime_1.jsx)("span", { className: "text-sm", children: recipientName ? (0, utils_1.formatUsername)(recipientName) : (0, formatAddress_1.formatAddress)(_recipientAddress) }), (0, jsx_runtime_1.jsx)(lucide_react_1.ChevronRight, { size: 16 })] })) : ((0, jsx_runtime_1.jsxs)("button", { className: "text-as-tertiarry flex h-7 items-center gap-1 text-sm transition-colors hover:text-blue-700", onClick: () => setActivePanel(5), children: [(0, jsx_runtime_1.jsx)(lucide_react_1.Wallet, { className: "text-as-brand", size: 16 }), "Select recipient", (0, jsx_runtime_1.jsx)(lucide_react_1.ChevronRight, { size: 16 })] }))] }), (0, jsx_runtime_1.jsx)("div", { className: "divider w-full" }), (0, jsx_runtime_1.jsxs)("div", { className: "flex items-center justify-between", children: [(0, jsx_runtime_1.jsx)("span", { className: "text-as-tertiarry text-sm", children: "Expected to receive" }), (0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-2", children: [(0, jsx_runtime_1.jsxs)("span", { className: "text-as-primary font-semibold", children: [destinationAmount || "0", " ", dstTokenSymbol || destinationToken?.symbol || ""] }), (0, jsx_runtime_1.jsxs)("span", { className: "text-as-tertiarry text-sm", children: ["on ", destinationChainId ? chain_1.ALL_CHAINS[destinationChainId]?.name : ""] }), destinationToken && destinationChainId && destinationToken.metadata?.logoURI && ((0, jsx_runtime_1.jsx)("img", { src: chain_1.ALL_CHAINS[destinationChainId]?.logoUrl, alt: "Chain", className: "h-4 w-4 rounded-full" }))] })] }), (0, jsx_runtime_1.jsx)("div", { className: "divider w-full" }), (0, jsx_runtime_1.jsx)("div", { className: "", children: (0, jsx_runtime_1.jsxs)("div", { className: "flex items-center justify-between", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-2", children: [(0, jsx_runtime_1.jsx)("span", { className: "text-as-tertiarry text-sm", children: (() => {
80
+ const fee = getFeeFromApi(selectedPaymentMethod || FiatPaymentMethod_1.FiatPaymentMethod.NONE);
81
+ return fee !== null ? `Total (included $${fee.toFixed(2)} fee)` : "Total";
82
+ })() }), featureFlags.showPoints &&
83
+ anyspendQuote?.data?.pointsAmount &&
84
+ anyspendQuote?.data?.pointsAmount > 0 && ((0, jsx_runtime_1.jsx)(PointsBadge_1.PointsBadge, { pointsAmount: anyspendQuote.data.pointsAmount, pointsMultiplier: anyspendQuote.data.pointsMultiplier, onClick: () => onShowPointsDetail?.() }))] }), (0, jsx_runtime_1.jsxs)("span", { className: "text-as-primary font-semibold", children: ["$", getTotalAmount(selectedPaymentMethod || FiatPaymentMethod_1.FiatPaymentMethod.NONE).toFixed(2)] })] }) })] })] }));
81
85
  }
@@ -0,0 +1,7 @@
1
+ interface PointsBadgeProps {
2
+ pointsAmount: number;
3
+ pointsMultiplier?: number;
4
+ onClick?: () => void;
5
+ }
6
+ export declare function PointsBadge({ pointsAmount, pointsMultiplier, onClick }: PointsBadgeProps): import("react/jsx-runtime").JSX.Element;
7
+ export {};
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PointsBadge = PointsBadge;
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ function PointsBadge({ pointsAmount, pointsMultiplier, onClick }) {
6
+ return ((0, jsx_runtime_1.jsxs)("button", { className: "bg-as-brand hover:scale-102 active:scale-98 relative flex cursor-pointer items-center gap-1 rounded-lg px-2 py-1 transition-all", onClick: onClick, children: [(0, jsx_runtime_1.jsx)("div", { className: "pointer-events-none absolute inset-0 h-full w-full rounded-lg border border-white/10 border-t-white/20 bg-gradient-to-b from-white/10 to-white/0" }), (0, jsx_runtime_1.jsxs)("span", { className: "relative text-xs text-white", children: ["+", pointsAmount.toLocaleString(), " pts", pointsMultiplier && pointsMultiplier > 1 && (0, jsx_runtime_1.jsxs)("span", { className: "ml-1 opacity-80", children: ["(", pointsMultiplier, "x)"] })] })] }));
7
+ }
@@ -0,0 +1,6 @@
1
+ interface PointsDetailPanelProps {
2
+ pointsAmount?: number;
3
+ onBack: () => void;
4
+ }
5
+ export declare function PointsDetailPanel({ pointsAmount, onBack }: PointsDetailPanelProps): import("react/jsx-runtime").JSX.Element;
6
+ export {};
@@ -0,0 +1,14 @@
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.PointsDetailPanel = PointsDetailPanel;
7
+ const jsx_runtime_1 = require("react/jsx-runtime");
8
+ const react_1 = require("../../../../global-account/react");
9
+ const cn_1 = require("../../../../shared/utils/cn");
10
+ const lucide_react_1 = require("lucide-react");
11
+ const link_1 = __importDefault(require("next/link"));
12
+ function PointsDetailPanel({ pointsAmount = 0, onBack }) {
13
+ return ((0, jsx_runtime_1.jsxs)("div", { className: "mx-auto flex w-[460px] max-w-full flex-col items-center gap-4", children: [(0, jsx_runtime_1.jsx)("div", { className: "flex w-full items-center justify-between", children: (0, jsx_runtime_1.jsxs)(react_1.Button, { variant: "ghost", onClick: onBack, className: "text-as-primary/70 hover:text-as-primary flex items-center gap-2", children: [(0, jsx_runtime_1.jsx)(lucide_react_1.ArrowDown, { className: "h-4 w-4 rotate-90" }), "Back"] }) }), (0, jsx_runtime_1.jsxs)("div", { className: "flex flex-col items-center gap-4 text-center", children: [(0, jsx_runtime_1.jsx)("h3", { className: "text-as-primary text-xl font-bold", children: "Earn Points with Every Swap" }), (0, jsx_runtime_1.jsxs)("p", { className: "text-as-primary/70 text-balance text-sm leading-relaxed", children: ["You'll earn ", (0, jsx_runtime_1.jsxs)("span", { className: "text-as-brand font-semibold", children: ["+", pointsAmount.toLocaleString(), " points"] }), " ", "towards the", " ", (0, jsx_runtime_1.jsx)(link_1.default, { href: "https://anyspend.com/points", target: "_blank", className: "text-as-brand underline", children: "next AnySpend airdrop" }), " ", "when you complete this transaction."] }), (0, jsx_runtime_1.jsxs)("div", { className: "bg-as-surface-primary border-as-border-secondary mt-2 w-full rounded-lg border p-4 text-left", children: [(0, jsx_runtime_1.jsx)("h4", { className: "text-as-primary mb-2 font-semibold", children: "How it works:" }), (0, jsx_runtime_1.jsxs)("ul", { className: "text-as-primary/70 space-y-1 text-sm", children: [(0, jsx_runtime_1.jsx)("li", { children: "\u2022 Points are earned based on transaction volume" }), (0, jsx_runtime_1.jsx)("li", { children: "\u2022 Higher volume = more points" }), (0, jsx_runtime_1.jsx)("li", { children: "\u2022 Points contribute to future airdrops" }), (0, jsx_runtime_1.jsx)("li", { children: "\u2022 Keep swapping to maximize your rewards" })] })] }), (0, jsx_runtime_1.jsx)(react_1.ShinyButton, { accentColor: "hsl(var(--as-brand))", onClick: onBack, className: (0, cn_1.cn)("as-main-button !bg-as-brand relative w-full"), textClassName: (0, cn_1.cn)("text-white"), children: "Back to Swap" })] })] }));
14
+ }
@@ -0,0 +1,11 @@
1
+ import { ReactNode } from "react";
2
+ export interface FeatureFlags {
3
+ showPoints?: boolean;
4
+ }
5
+ interface FeatureFlagsProviderProps {
6
+ children: ReactNode;
7
+ featureFlags?: FeatureFlags;
8
+ }
9
+ export declare function FeatureFlagsProvider({ children, featureFlags }: FeatureFlagsProviderProps): import("react/jsx-runtime").JSX.Element;
10
+ export declare function useFeatureFlags(): FeatureFlags;
11
+ export {};
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ "use client";
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.FeatureFlagsProvider = FeatureFlagsProvider;
5
+ exports.useFeatureFlags = useFeatureFlags;
6
+ const jsx_runtime_1 = require("react/jsx-runtime");
7
+ const react_1 = require("react");
8
+ const FeatureFlagsContext = (0, react_1.createContext)(undefined);
9
+ const defaultFeatureFlags = {
10
+ showPoints: false,
11
+ };
12
+ function FeatureFlagsProvider({ children, featureFlags = defaultFeatureFlags }) {
13
+ return (0, jsx_runtime_1.jsx)(FeatureFlagsContext.Provider, { value: { featureFlags }, children: children });
14
+ }
15
+ function useFeatureFlags() {
16
+ const context = (0, react_1.useContext)(FeatureFlagsContext);
17
+ if (!context) {
18
+ return defaultFeatureFlags;
19
+ }
20
+ return context.featureFlags;
21
+ }
@@ -7,7 +7,8 @@ export declare enum PanelView {
7
7
  FIAT_PAYMENT_METHOD = 2,
8
8
  RECIPIENT_SELECTION = 3,
9
9
  ORDER_DETAILS = 4,
10
- LOADING = 5
10
+ LOADING = 5,
11
+ POINTS_DETAIL = 6
11
12
  }
12
13
  interface UseAnyspendFlowProps {
13
14
  paymentType?: "crypto" | "fiat";
@@ -140,6 +141,8 @@ export declare function useAnyspendFlow({ paymentType, recipientAddress, loadOrd
140
141
  };
141
142
  timeEstimate?: number;
142
143
  userBalance?: string;
144
+ pointsAmount?: number;
145
+ pointsMultiplier?: number;
143
146
  };
144
147
  statusCode: number;
145
148
  } | undefined;