@b3dotfun/sdk 0.0.7-alpha.25 → 0.0.7-alpha.26

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 (52) hide show
  1. package/dist/cjs/anyspend/index.d.ts +0 -2
  2. package/dist/cjs/anyspend/index.js +0 -4
  3. package/dist/cjs/anyspend/react/components/AnySpend.js +49 -48
  4. package/dist/cjs/anyspend/react/components/AnySpendCustom.js +39 -38
  5. package/dist/cjs/anyspend/react/components/common/OrderHistory.js +6 -6
  6. package/dist/cjs/anyspend/react/components/common/PanelOnramp.js +7 -7
  7. package/dist/cjs/anyspend/react/components/common/PanelOnrampPayment.js +9 -8
  8. package/dist/cjs/anyspend/react/components/common/PaymentStripeWeb2.js +14 -13
  9. package/dist/cjs/anyspend/react/components/webview/WebviewOnrampPayment.js +13 -12
  10. package/dist/cjs/anyspend/react/hooks/useSigMint.d.ts +2 -2
  11. package/dist/cjs/global-account/react/components/custom/Button.d.ts +2 -2
  12. package/dist/cjs/global-account/react/components/ui/button.d.ts +1 -1
  13. package/dist/cjs/global-account/react/components/ui/command.d.ts +7 -7
  14. package/dist/cjs/shared/constants/chains/b3Chain.d.ts +1 -1
  15. package/dist/cjs/shared/constants/chains/supported.d.ts +14 -14
  16. package/dist/cjs/shared/utils/insights.d.ts +1 -1
  17. package/dist/cjs/shared/utils/simplehash.d.ts +2 -2
  18. package/dist/esm/anyspend/index.d.ts +0 -2
  19. package/dist/esm/anyspend/index.js +0 -4
  20. package/dist/esm/anyspend/react/components/AnySpend.js +2 -1
  21. package/dist/esm/anyspend/react/components/AnySpendCustom.js +2 -1
  22. package/dist/esm/anyspend/react/components/common/OrderHistory.js +1 -1
  23. package/dist/esm/anyspend/react/components/common/PanelOnramp.js +1 -1
  24. package/dist/esm/anyspend/react/components/common/PanelOnrampPayment.js +2 -1
  25. package/dist/esm/anyspend/react/components/common/PaymentStripeWeb2.js +2 -1
  26. package/dist/esm/anyspend/react/components/webview/WebviewOnrampPayment.js +2 -1
  27. package/dist/esm/anyspend/react/hooks/useSigMint.d.ts +2 -2
  28. package/dist/esm/global-account/react/components/custom/Button.d.ts +2 -2
  29. package/dist/esm/global-account/react/components/ui/button.d.ts +1 -1
  30. package/dist/esm/global-account/react/components/ui/command.d.ts +7 -7
  31. package/dist/esm/shared/constants/chains/b3Chain.d.ts +1 -1
  32. package/dist/esm/shared/constants/chains/supported.d.ts +14 -14
  33. package/dist/esm/shared/utils/insights.d.ts +1 -1
  34. package/dist/esm/shared/utils/simplehash.d.ts +2 -2
  35. package/dist/types/anyspend/index.d.ts +0 -2
  36. package/dist/types/anyspend/react/hooks/useSigMint.d.ts +2 -2
  37. package/dist/types/global-account/react/components/custom/Button.d.ts +2 -2
  38. package/dist/types/global-account/react/components/ui/button.d.ts +1 -1
  39. package/dist/types/global-account/react/components/ui/command.d.ts +7 -7
  40. package/dist/types/shared/constants/chains/b3Chain.d.ts +1 -1
  41. package/dist/types/shared/constants/chains/supported.d.ts +14 -14
  42. package/dist/types/shared/utils/insights.d.ts +1 -1
  43. package/dist/types/shared/utils/simplehash.d.ts +2 -2
  44. package/package.json +1 -1
  45. package/src/anyspend/index.ts +0 -6
  46. package/src/anyspend/react/components/AnySpend.tsx +2 -6
  47. package/src/anyspend/react/components/AnySpendCustom.tsx +4 -2
  48. package/src/anyspend/react/components/common/OrderHistory.tsx +1 -1
  49. package/src/anyspend/react/components/common/PanelOnramp.tsx +1 -1
  50. package/src/anyspend/react/components/common/PanelOnrampPayment.tsx +2 -10
  51. package/src/anyspend/react/components/common/PaymentStripeWeb2.tsx +2 -1
  52. package/src/anyspend/react/components/webview/WebviewOnrampPayment.tsx +1 -3
@@ -1,5 +1,3 @@
1
- export * from "./react/hooks";
2
- export * from "./react/providers/AnyspendProvider";
3
1
  export * from "./types";
4
2
  export * from "./types/metadata";
5
3
  export * from "./types/relay";
@@ -14,10 +14,6 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
- // Export all hooks
18
- __exportStar(require("./react/hooks"), exports);
19
- // Providers
20
- __exportStar(require("./react/providers/AnyspendProvider"), exports);
21
17
  // Types
22
18
  __exportStar(require("./types"), exports);
23
19
  __exportStar(require("./types/metadata"), exports);
@@ -8,14 +8,15 @@ exports.PanelView = void 0;
8
8
  exports.AnySpend = AnySpend;
9
9
  const jsx_runtime_1 = require("react/jsx-runtime");
10
10
  const anyspend_1 = require("../../../anyspend");
11
- const react_1 = require("../../../global-account/react");
11
+ const react_1 = require("../../../anyspend/react");
12
+ const react_2 = require("../../../global-account/react");
12
13
  const cn_1 = require("../../../shared/utils/cn");
13
14
  const formatAddress_1 = require("../../../shared/utils/formatAddress");
14
15
  const number_1 = require("../../../shared/utils/number");
15
16
  const framer_motion_1 = require("framer-motion");
16
17
  const invariant_1 = __importDefault(require("invariant"));
17
18
  const lucide_react_1 = require("lucide-react");
18
- const react_2 = require("react");
19
+ const react_3 = require("react");
19
20
  const sonner_1 = require("sonner");
20
21
  const viem_1 = require("viem");
21
22
  const chains_1 = require("viem/chains");
@@ -37,19 +38,19 @@ var PanelView;
37
38
  })(PanelView || (exports.PanelView = PanelView = {}));
38
39
  const ANYSPEND_RECIPIENTS_KEY = "anyspend_recipients";
39
40
  function AnySpend({ destinationTokenAddress, destinationTokenChainId, isMainnet = true, mode = "modal", defaultActiveTab = "crypto", loadOrder, hideTransactionHistoryButton, recipientAddress: recipientAddressFromProps, }) {
40
- const searchParams = (0, react_1.useSearchParamsSSR)();
41
- const router = (0, react_1.useRouter)();
41
+ const searchParams = (0, react_2.useSearchParamsSSR)();
42
+ const router = (0, react_2.useRouter)();
42
43
  // Determine if we're in "buy mode" based on whether destination token props are provided
43
44
  const isBuyMode = !!(destinationTokenAddress && destinationTokenChainId);
44
45
  // Add refs to track URL state
45
- const initialUrlProcessed = (0, react_2.useRef)(false);
46
- const lastUrlUpdate = (0, react_2.useRef)(null);
47
- const [activeTab, setActiveTab] = (0, react_2.useState)(defaultActiveTab);
48
- const [orderId, setOrderId] = (0, react_2.useState)(loadOrder);
49
- const { orderAndTransactions: oat, getOrderAndTransactionsError } = (0, anyspend_1.useAnyspendOrderAndTransactions)(isMainnet, orderId);
46
+ const initialUrlProcessed = (0, react_3.useRef)(false);
47
+ const lastUrlUpdate = (0, react_3.useRef)(null);
48
+ const [activeTab, setActiveTab] = (0, react_3.useState)(defaultActiveTab);
49
+ const [orderId, setOrderId] = (0, react_3.useState)(loadOrder);
50
+ const { orderAndTransactions: oat, getOrderAndTransactionsError } = (0, react_1.useAnyspendOrderAndTransactions)(isMainnet, orderId);
50
51
  !!getOrderAndTransactionsError && console.log("getOrderAndTransactionsError", getOrderAndTransactionsError);
51
- const [activePanel, setActivePanel] = (0, react_2.useState)(loadOrder ? PanelView.ORDER_DETAILS : PanelView.MAIN);
52
- const [customRecipients, setCustomRecipients] = (0, react_2.useState)([]);
52
+ const [activePanel, setActivePanel] = (0, react_3.useState)(loadOrder ? PanelView.ORDER_DETAILS : PanelView.MAIN);
53
+ const [customRecipients, setCustomRecipients] = (0, react_3.useState)([]);
53
54
  // const [newRecipientAddress, setNewRecipientAddress] = useState("");
54
55
  // const recipientInputRef = useRef<HTMLInputElement>(null);
55
56
  // Get initial chain IDs from URL or defaults
@@ -57,19 +58,19 @@ function AnySpend({ destinationTokenAddress, destinationTokenChainId, isMainnet
57
58
  const initialDstChainId = parseInt(searchParams.get("toChainId") || "0") ||
58
59
  (isBuyMode ? destinationTokenChainId : isMainnet ? chains_1.base.id : chains_1.b3Sepolia.id);
59
60
  // State for source chain/token selection
60
- const [selectedSrcChainId, setSelectedSrcChainId] = (0, react_2.useState)(initialSrcChainId);
61
+ const [selectedSrcChainId, setSelectedSrcChainId] = (0, react_3.useState)(initialSrcChainId);
61
62
  const defaultSrcToken = (0, anyspend_1.getDefaultToken)(selectedSrcChainId);
62
- const srcTokenFromUrl = (0, react_1.useTokenFromUrl)({
63
+ const srcTokenFromUrl = (0, react_2.useTokenFromUrl)({
63
64
  defaultToken: defaultSrcToken,
64
65
  prefix: "from",
65
66
  });
66
- const [selectedSrcToken, setSelectedSrcToken] = (0, react_2.useState)(srcTokenFromUrl);
67
- const { data: srcTokenMetadata } = (0, react_1.useTokenData)(selectedSrcToken?.chainId, selectedSrcToken?.address);
68
- const [srcAmount, setSrcAmount] = (0, react_2.useState)(searchParams.get("fromAmount") || "0.01");
67
+ const [selectedSrcToken, setSelectedSrcToken] = (0, react_3.useState)(srcTokenFromUrl);
68
+ const { data: srcTokenMetadata } = (0, react_2.useTokenData)(selectedSrcToken?.chainId, selectedSrcToken?.address);
69
+ const [srcAmount, setSrcAmount] = (0, react_3.useState)(searchParams.get("fromAmount") || "0.01");
69
70
  // State for onramp amount
70
- const [srcAmountOnRamp, setSrcAmountOnRamp] = (0, react_2.useState)(searchParams.get("fromAmount") || "5");
71
+ const [srcAmountOnRamp, setSrcAmountOnRamp] = (0, react_3.useState)(searchParams.get("fromAmount") || "5");
71
72
  // State for destination chain/token selection
72
- const [selectedDstChainId, setSelectedDstChainId] = (0, react_2.useState)(initialDstChainId);
73
+ const [selectedDstChainId, setSelectedDstChainId] = (0, react_3.useState)(initialDstChainId);
73
74
  const defaultDstToken = isBuyMode
74
75
  ? {
75
76
  symbol: "",
@@ -80,19 +81,19 @@ function AnySpend({ destinationTokenAddress, destinationTokenChainId, isMainnet
80
81
  metadata: {},
81
82
  }
82
83
  : (0, anyspend_1.getDefaultToken)(selectedDstChainId);
83
- const dstTokenFromUrl = (0, react_1.useTokenFromUrl)({
84
+ const dstTokenFromUrl = (0, react_2.useTokenFromUrl)({
84
85
  defaultToken: defaultDstToken,
85
86
  prefix: "to",
86
87
  });
87
- const [selectedDstToken, setSelectedDstToken] = (0, react_2.useState)(isBuyMode ? defaultDstToken : dstTokenFromUrl);
88
- const { data: dstTokenMetadata } = (0, react_1.useTokenData)(selectedDstToken?.chainId, selectedDstToken?.address);
89
- const [dstAmount, setDstAmount] = (0, react_2.useState)(searchParams.get("toAmount") || "");
90
- const [isSrcInputDirty, setIsSrcInputDirty] = (0, react_2.useState)(true);
88
+ const [selectedDstToken, setSelectedDstToken] = (0, react_3.useState)(isBuyMode ? defaultDstToken : dstTokenFromUrl);
89
+ const { data: dstTokenMetadata } = (0, react_2.useTokenData)(selectedDstToken?.chainId, selectedDstToken?.address);
90
+ const [dstAmount, setDstAmount] = (0, react_3.useState)(searchParams.get("toAmount") || "");
91
+ const [isSrcInputDirty, setIsSrcInputDirty] = (0, react_3.useState)(true);
91
92
  // Add refs to track if we've applied metadata
92
- const appliedSrcMetadataRef = (0, react_2.useRef)(false);
93
- const appliedDstMetadataRef = (0, react_2.useRef)(false);
93
+ const appliedSrcMetadataRef = (0, react_3.useRef)(false);
94
+ const appliedDstMetadataRef = (0, react_3.useRef)(false);
94
95
  // Update source token with metadata
95
- (0, react_2.useEffect)(() => {
96
+ (0, react_3.useEffect)(() => {
96
97
  if (selectedSrcToken && srcTokenMetadata && !appliedSrcMetadataRef.current) {
97
98
  // Mark as applied
98
99
  appliedSrcMetadataRef.current = true;
@@ -110,11 +111,11 @@ function AnySpend({ destinationTokenAddress, destinationTokenChainId, isMainnet
110
111
  }
111
112
  }, [srcTokenMetadata, selectedSrcToken]);
112
113
  // Reset source token ref when address/chain changes
113
- (0, react_2.useEffect)(() => {
114
+ (0, react_3.useEffect)(() => {
114
115
  appliedSrcMetadataRef.current = false;
115
116
  }, [selectedSrcToken.address, selectedSrcToken.chainId]);
116
117
  // Update destination token with metadata
117
- (0, react_2.useEffect)(() => {
118
+ (0, react_3.useEffect)(() => {
118
119
  if (selectedDstToken && dstTokenMetadata && !appliedDstMetadataRef.current) {
119
120
  // Mark as applied
120
121
  appliedDstMetadataRef.current = true;
@@ -132,11 +133,11 @@ function AnySpend({ destinationTokenAddress, destinationTokenChainId, isMainnet
132
133
  }
133
134
  }, [dstTokenMetadata, selectedDstToken]);
134
135
  // Reset destination token ref when address/chain changes
135
- (0, react_2.useEffect)(() => {
136
+ (0, react_3.useEffect)(() => {
136
137
  appliedDstMetadataRef.current = false;
137
138
  }, [selectedDstToken.address, selectedDstToken.chainId]);
138
139
  // Load swap configuration from URL on initial render
139
- (0, react_2.useEffect)(() => {
140
+ (0, react_3.useEffect)(() => {
140
141
  // Skip if we've already processed the URL or if we have an order to load
141
142
  if (initialUrlProcessed.current || loadOrder)
142
143
  return;
@@ -173,7 +174,7 @@ function AnySpend({ destinationTokenAddress, destinationTokenChainId, isMainnet
173
174
  initialUrlProcessed.current = true;
174
175
  }, [searchParams, loadOrder]);
175
176
  // Update URL when swap configuration changes - but not on initial load
176
- const updateSwapParamsInURL = (0, react_2.useCallback)(() => {
177
+ const updateSwapParamsInURL = (0, react_3.useCallback)(() => {
177
178
  // Skip if:
178
179
  // 1. There's an active order or orderId in the URL
179
180
  // 2. We're not on the main panel
@@ -244,7 +245,7 @@ function AnySpend({ destinationTokenAddress, destinationTokenChainId, isMainnet
244
245
  srcAmountOnRamp,
245
246
  ]);
246
247
  // Update URL when relevant state changes - but only after initial render
247
- (0, react_2.useEffect)(() => {
248
+ (0, react_3.useEffect)(() => {
248
249
  // Skip the URL update on first render
249
250
  if (initialUrlProcessed.current) {
250
251
  updateSwapParamsInURL();
@@ -275,10 +276,10 @@ function AnySpend({ destinationTokenAddress, destinationTokenChainId, isMainnet
275
276
  // [selectedDstChainId, newRecipientAddress, resolvedAddress]
276
277
  // );
277
278
  // State for recipient selection
278
- const [recipientAddress, setRecipientAddress] = (0, react_2.useState)();
279
- const { address: globalAddress, wallet: globalWallet } = (0, react_1.useAccountWallet)();
279
+ const [recipientAddress, setRecipientAddress] = (0, react_3.useState)();
280
+ const { address: globalAddress, wallet: globalWallet } = (0, react_2.useAccountWallet)();
280
281
  // Set default recipient address when wallet changes
281
- (0, react_2.useEffect)(() => {
282
+ (0, react_3.useEffect)(() => {
282
283
  setRecipientAddress(recipientAddressFromProps || globalAddress);
283
284
  }, [recipientAddressFromProps, globalAddress]);
284
285
  // Get anyspend price
@@ -286,7 +287,7 @@ function AnySpend({ destinationTokenAddress, destinationTokenChainId, isMainnet
286
287
  ? (0, viem_1.parseUnits)(srcAmount.replaceAll(",", ""), selectedSrcToken.decimals).toString()
287
288
  : (0, viem_1.parseUnits)(dstAmount.replaceAll(",", ""), selectedDstToken.decimals).toString();
288
289
  const srcAmountOnrampInWei = (0, viem_1.parseUnits)(srcAmountOnRamp.replaceAll(",", ""), anyspend_1.USDC_BASE.decimals).toString();
289
- const { anyspendQuote, isLoadingAnyspendQuote, getAnyspendQuoteError } = (0, anyspend_1.useAnyspendQuote)(isMainnet, activeTab === "crypto"
290
+ const { anyspendQuote, isLoadingAnyspendQuote, getAnyspendQuoteError } = (0, react_1.useAnyspendQuote)(isMainnet, activeTab === "crypto"
290
291
  ? {
291
292
  srcChain: selectedSrcChainId,
292
293
  dstChain: isBuyMode ? destinationTokenChainId : selectedDstChainId,
@@ -306,12 +307,12 @@ function AnySpend({ destinationTokenAddress, destinationTokenChainId, isMainnet
306
307
  amount: srcAmountOnrampInWei,
307
308
  });
308
309
  // Replace the old ENS lookup with our new hooks
309
- const { name: recipientName } = (0, react_1.useOnchainName)(recipientAddress);
310
+ const { name: recipientName } = (0, react_2.useOnchainName)(recipientAddress);
310
311
  // const { name: walletName } = useOnchainName(globalAddress);
311
312
  // Batch lookup for custom recipients
312
313
  // const { names: customRecipientNames } = useOnchainNames(customRecipients.map(r => r.address));
313
314
  // Load custom recipients from local storage on mount
314
- (0, react_2.useEffect)(() => {
315
+ (0, react_3.useEffect)(() => {
315
316
  try {
316
317
  const savedRecipients = localStorage.getItem(ANYSPEND_RECIPIENTS_KEY);
317
318
  if (savedRecipients) {
@@ -442,7 +443,7 @@ function AnySpend({ destinationTokenAddress, destinationTokenChainId, isMainnet
442
443
  // }
443
444
  // };
444
445
  // Update dependent amount when relay price changes
445
- (0, react_2.useEffect)(() => {
446
+ (0, react_3.useEffect)(() => {
446
447
  if (anyspendQuote?.data &&
447
448
  anyspendQuote.data.currencyIn?.amount &&
448
449
  anyspendQuote.data.currencyIn?.currency?.decimals &&
@@ -468,7 +469,7 @@ function AnySpend({ destinationTokenAddress, destinationTokenChainId, isMainnet
468
469
  }
469
470
  }
470
471
  }, [anyspendQuote, isSrcInputDirty]);
471
- const { createOrder, isCreatingOrder } = (0, anyspend_1.useAnyspendCreateOrder)({
472
+ const { createOrder, isCreatingOrder } = (0, react_1.useAnyspendCreateOrder)({
472
473
  onSuccess: data => {
473
474
  const orderId = data.data.id;
474
475
  setOrderId(orderId);
@@ -485,7 +486,7 @@ function AnySpend({ destinationTokenAddress, destinationTokenChainId, isMainnet
485
486
  },
486
487
  });
487
488
  // Determine button state and text
488
- const btnInfo = (0, react_2.useMemo)(() => {
489
+ const btnInfo = (0, react_3.useMemo)(() => {
489
490
  if (activeInputAmountInWei === "0")
490
491
  return { text: "Enter an amount", disable: true, error: false };
491
492
  if (isLoadingAnyspendQuote)
@@ -557,7 +558,7 @@ function AnySpend({ destinationTokenAddress, destinationTokenChainId, isMainnet
557
558
  // const setIsDynamicModalOpen = useModalStore(state => state.setB3ModalOpen);
558
559
  // const setDynamicModalContentType = useModalStore(state => state.setB3ModalContentType);
559
560
  // Update useEffect for URL parameter to not override loadOrder
560
- (0, react_2.useEffect)(() => {
561
+ (0, react_3.useEffect)(() => {
561
562
  if (loadOrder)
562
563
  return; // Skip if we have a loadOrder
563
564
  const orderIdParam = searchParams.get("orderId");
@@ -575,7 +576,7 @@ function AnySpend({ destinationTokenAddress, destinationTokenChainId, isMainnet
575
576
  router.push(`${window.location.pathname}?${params.toString()}`);
576
577
  };
577
578
  // Save custom recipients to local storage when they change
578
- (0, react_2.useEffect)(() => {
579
+ (0, react_3.useEffect)(() => {
579
580
  try {
580
581
  localStorage.setItem(ANYSPEND_RECIPIENTS_KEY, JSON.stringify(customRecipients));
581
582
  }
@@ -584,10 +585,10 @@ function AnySpend({ destinationTokenAddress, destinationTokenChainId, isMainnet
584
585
  }
585
586
  }, [customRecipients]);
586
587
  // Scroll to top when panel changes
587
- (0, react_2.useEffect)(() => {
588
+ (0, react_3.useEffect)(() => {
588
589
  window.scrollTo({ top: 0, behavior: "smooth" });
589
590
  }, [activePanel]);
590
- const [isOpenPasteRecipientAddressModal, setIsOpenPasteRecipientAddressModal] = (0, react_2.useState)(false);
591
+ const [isOpenPasteRecipientAddressModal, setIsOpenPasteRecipientAddressModal] = (0, react_3.useState)(false);
591
592
  const calculatePriceImpact = (inputUsd, outputUsd) => {
592
593
  if (!inputUsd || !outputUsd) {
593
594
  return { percentage: "0.00", isNegative: false };
@@ -621,7 +622,7 @@ function AnySpend({ destinationTokenAddress, destinationTokenChainId, isMainnet
621
622
  } })] }), (0, jsx_runtime_1.jsx)(OrderTokenAmount_1.OrderTokenAmount, { address: globalAddress, context: "from", inputValue: srcAmount, onChangeInput: value => {
622
623
  setIsSrcInputDirty(true);
623
624
  setSrcAmount(value);
624
- }, chainId: selectedSrcChainId, setChainId: setSelectedSrcChainId, token: selectedSrcToken, setToken: setSelectedSrcToken }), (0, jsx_runtime_1.jsx)("div", { className: "text-as-primary/50 flex h-5 items-center text-sm", children: (0, number_1.formatDisplayNumber)(anyspendQuote?.data?.currencyIn?.amountUsd, { style: "currency", fallback: "" }) })] })) : ((0, jsx_runtime_1.jsx)(framer_motion_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, ease: "easeInOut" }, children: (0, jsx_runtime_1.jsx)(PanelOnramp_1.PanelOnramp, { srcAmountOnRamp: srcAmountOnRamp, setSrcAmountOnRamp: setSrcAmountOnRamp }) })), (0, jsx_runtime_1.jsx)(react_1.Button, { variant: "ghost", className: (0, cn_1.cn)("bg-as-n-8 border-as-stroke absolute left-1/2 top-1/2 z-10 h-10 w-10 -translate-x-1/2 -translate-y-1/2 rounded-2xl border-2 sm:h-8 sm:w-8 sm:rounded-xl", (activeTab === "fiat" || isBuyMode) && "top-[calc(50%+56px)] cursor-default"), onClick: () => {
625
+ }, chainId: selectedSrcChainId, setChainId: setSelectedSrcChainId, token: selectedSrcToken, setToken: setSelectedSrcToken }), (0, jsx_runtime_1.jsx)("div", { className: "text-as-primary/50 flex h-5 items-center text-sm", children: (0, number_1.formatDisplayNumber)(anyspendQuote?.data?.currencyIn?.amountUsd, { style: "currency", fallback: "" }) })] })) : ((0, jsx_runtime_1.jsx)(framer_motion_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, ease: "easeInOut" }, children: (0, jsx_runtime_1.jsx)(PanelOnramp_1.PanelOnramp, { srcAmountOnRamp: srcAmountOnRamp, setSrcAmountOnRamp: setSrcAmountOnRamp }) })), (0, jsx_runtime_1.jsx)(react_2.Button, { variant: "ghost", className: (0, cn_1.cn)("bg-as-n-8 border-as-stroke absolute left-1/2 top-1/2 z-10 h-10 w-10 -translate-x-1/2 -translate-y-1/2 rounded-2xl border-2 sm:h-8 sm:w-8 sm:rounded-xl", (activeTab === "fiat" || isBuyMode) && "top-[calc(50%+56px)] cursor-default"), onClick: () => {
625
626
  if (activeTab === "fiat" || isBuyMode) {
626
627
  return;
627
628
  }
@@ -659,7 +660,7 @@ function AnySpend({ destinationTokenAddress, destinationTokenChainId, isMainnet
659
660
  }
660
661
  // Using inline style to ensure color displays
661
662
  return ((0, jsx_runtime_1.jsxs)("span", { className: "ml-2", style: { color: percentageNum >= 10 ? "red" : "#FFD700" }, children: ["(", isNegative ? "-" : "", percentage, "%)"] }));
662
- })()] })] })] }), getAnyspendQuoteError && ((0, jsx_runtime_1.jsxs)("div", { className: "bg-as-on-surface-1 flex w-full max-w-[460px] items-center gap-2 rounded-2xl p-4", children: [(0, jsx_runtime_1.jsx)(lucide_react_1.CircleAlert, { className: "bg-as-red h-4 min-h-4 w-4 min-w-4 rounded-full p-0 text-sm font-medium text-white" }), (0, jsx_runtime_1.jsx)("div", { className: "text-as-red text-sm", children: getAnyspendQuoteError.message })] })), (0, jsx_runtime_1.jsxs)(framer_motion_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.2, ease: "easeInOut" }, className: "flex w-full max-w-[460px] flex-col gap-2", children: [(0, jsx_runtime_1.jsxs)(react_1.ShinyButton, { accentColor: "hsl(var(--as-brand))", disabled: btnInfo.disable, onClick: onMainButtonClick, className: (0, cn_1.cn)("relative w-full", btnInfo.error ? "!bg-as-red" : btnInfo.disable ? "!bg-as-on-surface-2" : "!bg-as-brand"), textClassName: (0, cn_1.cn)(btnInfo.error ? "text-white" : btnInfo.disable ? "text-as-secondary" : "text-white"), children: [btnInfo.text, !btnInfo.disable && !btnInfo.error && ((0, jsx_runtime_1.jsx)(lucide_react_1.ChevronRightCircle, { className: "absolute right-0 top-1/2 h-6 w-6 -translate-y-1/2 opacity-70" }))] }), !hideTransactionHistoryButton && (globalAddress || recipientAddress) ? ((0, jsx_runtime_1.jsxs)(react_1.Button, { variant: "link", onClick: onClickHistory, className: "text-as-primary/50 hover:text-as-primary flex items-center gap-1 transition-colors", children: [(0, jsx_runtime_1.jsx)(lucide_react_1.HistoryIcon, { className: "h-4 w-4" }), " ", (0, jsx_runtime_1.jsx)("span", { className: "pr-4", children: "Transaction History" })] })) : ((0, jsx_runtime_1.jsx)("div", { className: "h-2 w-full" }))] })] }));
663
+ })()] })] })] }), getAnyspendQuoteError && ((0, jsx_runtime_1.jsxs)("div", { className: "bg-as-on-surface-1 flex w-full max-w-[460px] items-center gap-2 rounded-2xl p-4", children: [(0, jsx_runtime_1.jsx)(lucide_react_1.CircleAlert, { className: "bg-as-red h-4 min-h-4 w-4 min-w-4 rounded-full p-0 text-sm font-medium text-white" }), (0, jsx_runtime_1.jsx)("div", { className: "text-as-red text-sm", children: getAnyspendQuoteError.message })] })), (0, jsx_runtime_1.jsxs)(framer_motion_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.2, ease: "easeInOut" }, className: "flex w-full max-w-[460px] flex-col gap-2", children: [(0, jsx_runtime_1.jsxs)(react_2.ShinyButton, { accentColor: "hsl(var(--as-brand))", disabled: btnInfo.disable, onClick: onMainButtonClick, className: (0, cn_1.cn)("relative w-full", btnInfo.error ? "!bg-as-red" : btnInfo.disable ? "!bg-as-on-surface-2" : "!bg-as-brand"), textClassName: (0, cn_1.cn)(btnInfo.error ? "text-white" : btnInfo.disable ? "text-as-secondary" : "text-white"), children: [btnInfo.text, !btnInfo.disable && !btnInfo.error && ((0, jsx_runtime_1.jsx)(lucide_react_1.ChevronRightCircle, { className: "absolute right-0 top-1/2 h-6 w-6 -translate-y-1/2 opacity-70" }))] }), !hideTransactionHistoryButton && (globalAddress || recipientAddress) ? ((0, jsx_runtime_1.jsxs)(react_2.Button, { variant: "link", onClick: onClickHistory, className: "text-as-primary/50 hover:text-as-primary flex items-center gap-1 transition-colors", children: [(0, jsx_runtime_1.jsx)(lucide_react_1.HistoryIcon, { className: "h-4 w-4" }), " ", (0, jsx_runtime_1.jsx)("span", { className: "pr-4", children: "Transaction History" })] })) : ((0, jsx_runtime_1.jsx)("div", { className: "h-2 w-full" }))] })] }));
663
664
  const onrampPaymentView = ((0, jsx_runtime_1.jsx)(PanelOnrampPayment_1.PanelOnrampPayment, { srcAmountOnRamp: srcAmountOnRamp, recipientName: recipientName, recipientAddress: recipientAddress, isMainnet: isMainnet, isBuyMode: isBuyMode, destinationTokenChainId: destinationTokenChainId, destinationTokenAddress: destinationTokenAddress, selectedDstChainId: selectedDstChainId, selectedDstToken: selectedDstToken, orderType: anyspend_1.OrderType.Swap, anyspendQuote: anyspendQuote, globalAddress: globalAddress, onOrderCreated: orderId => {
664
665
  setOrderId(orderId);
665
666
  setActivePanel(PanelView.ORDER_DETAILS);
@@ -669,7 +670,7 @@ function AnySpend({ destinationTokenAddress, destinationTokenChainId, isMainnet
669
670
  router.push(`${window.location.pathname}?${params.toString()}`);
670
671
  }, onBack: () => setActivePanel(PanelView.MAIN), recipientEnsName: globalWallet?.ensName, recipientImageUrl: globalWallet?.meta?.icon }));
671
672
  // Add tabs to the main component when no order is loaded
672
- return ((0, jsx_runtime_1.jsx)(react_1.StyleRoot, { children: (0, jsx_runtime_1.jsxs)("div", { className: (0, cn_1.cn)("mx-auto max-w-[calc(100vw-32px)]"), children: [(0, jsx_runtime_1.jsx)(react_1.TransitionPanel, { activeIndex: orderId
673
+ return ((0, jsx_runtime_1.jsx)(react_2.StyleRoot, { children: (0, jsx_runtime_1.jsxs)("div", { className: (0, cn_1.cn)("mx-auto max-w-[calc(100vw-32px)]"), children: [(0, jsx_runtime_1.jsx)(react_2.TransitionPanel, { activeIndex: orderId
673
674
  ? oat
674
675
  ? PanelView.ORDER_DETAILS
675
676
  : PanelView.LOADING
@@ -6,7 +6,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.AnySpendCustom = AnySpendCustom;
7
7
  const jsx_runtime_1 = require("react/jsx-runtime");
8
8
  const anyspend_1 = require("../../../anyspend");
9
- const react_1 = require("../../../global-account/react");
9
+ const react_1 = require("../../../anyspend/react");
10
+ const react_2 = require("../../../global-account/react");
10
11
  const utils_1 = require("../../../shared/utils");
11
12
  const centerTruncate_1 = __importDefault(require("../../../shared/utils/centerTruncate"));
12
13
  const number_1 = require("../../../shared/utils/number");
@@ -14,7 +15,7 @@ const simplehash_1 = require("../../../shared/utils/simplehash");
14
15
  const framer_motion_1 = require("framer-motion");
15
16
  const invariant_1 = __importDefault(require("invariant"));
16
17
  const lucide_react_1 = require("lucide-react");
17
- const react_2 = require("react");
18
+ const react_3 = require("react");
18
19
  const sonner_1 = require("sonner");
19
20
  const chains_1 = require("viem/chains");
20
21
  const OrderDetails_1 = require("./common/OrderDetails");
@@ -87,36 +88,36 @@ function generateGetRelayQuoteRequest({ orderType, srcChainId, srcToken, dstChai
87
88
  }
88
89
  }
89
90
  function AnySpendCustom({ isMainnet = true, loadOrder, mode = "modal", recipientAddress: recipientAddressProps, spenderAddress, orderType, dstChainId, dstToken, dstAmount, contractAddress, encodedData, metadata, header, onSuccess, showRecipient = true, }) {
90
- const { setB3ModalOpen, setB3ModalContentType } = (0, react_1.useModalStore)();
91
- const hasMounted = (0, react_1.useHasMounted)();
92
- const searchParams = (0, react_1.useSearchParamsSSR)();
93
- const router = (0, react_1.useRouter)();
94
- const [activePanel, setActivePanel] = (0, react_2.useState)(loadOrder ? PanelView.ORDER_DETAILS : PanelView.CONFIRM_ORDER);
95
- const [activeTab, setActiveTab] = (0, react_2.useState)("crypto");
91
+ const { setB3ModalOpen, setB3ModalContentType } = (0, react_2.useModalStore)();
92
+ const hasMounted = (0, react_2.useHasMounted)();
93
+ const searchParams = (0, react_2.useSearchParamsSSR)();
94
+ const router = (0, react_2.useRouter)();
95
+ const [activePanel, setActivePanel] = (0, react_3.useState)(loadOrder ? PanelView.ORDER_DETAILS : PanelView.CONFIRM_ORDER);
96
+ const [activeTab, setActiveTab] = (0, react_3.useState)("crypto");
96
97
  // Get current user's wallet
97
- const currentWallet = (0, react_1.useAccountWallet)();
98
+ const currentWallet = (0, react_2.useAccountWallet)();
98
99
  // Add state for recipient modal
99
- const [isRecipientModalOpen, setIsRecipientModalOpen] = (0, react_2.useState)(false);
100
+ const [isRecipientModalOpen, setIsRecipientModalOpen] = (0, react_3.useState)(false);
100
101
  // Add state for custom recipient
101
- const [customRecipientAddress, setCustomRecipientAddress] = (0, react_2.useState)(recipientAddressProps);
102
+ const [customRecipientAddress, setCustomRecipientAddress] = (0, react_3.useState)(recipientAddressProps);
102
103
  // Update recipient logic to use custom recipient
103
104
  const recipientAddress = customRecipientAddress || currentWallet.address;
104
- const recipientPropsProfile = (0, react_1.useBsmntProfile)({ address: recipientAddress });
105
+ const recipientPropsProfile = (0, react_2.useBsmntProfile)({ address: recipientAddress });
105
106
  const recipientEnsName = recipientPropsProfile.data?.username?.replaceAll(".b3.fun", "");
106
107
  const recipientImageUrl = recipientPropsProfile.data?.avatar || currentWallet.wallet.meta?.icon;
107
- const [orderId, setOrderId] = (0, react_2.useState)(loadOrder);
108
- const [srcChainId, setSrcChainId] = (0, react_2.useState)(isMainnet ? chains_1.base.id : chains_1.baseSepolia.id);
108
+ const [orderId, setOrderId] = (0, react_3.useState)(loadOrder);
109
+ const [srcChainId, setSrcChainId] = (0, react_3.useState)(isMainnet ? chains_1.base.id : chains_1.baseSepolia.id);
109
110
  // Get token list for token balance check
110
- const chainName = (0, react_2.useMemo)(() => (0, simplehash_1.simpleHashChainToChainName)(srcChainId), [srcChainId]);
111
- const { data: tokenList } = (0, anyspend_1.useAnyspendTokenList)(isMainnet, srcChainId, "");
111
+ const chainName = (0, react_3.useMemo)(() => (0, simplehash_1.simpleHashChainToChainName)(srcChainId), [srcChainId]);
112
+ const { data: tokenList } = (0, react_1.useAnyspendTokenList)(isMainnet, srcChainId, "");
112
113
  // Get token balances for the selected chain
113
- const { nativeTokens, fungibleTokens } = (0, react_1.useTokenBalancesByChain)({
114
+ const { nativeTokens, fungibleTokens } = (0, react_2.useTokenBalancesByChain)({
114
115
  address: currentWallet?.wallet?.address || "",
115
116
  chainsIds: [srcChainId],
116
117
  enabled: !!currentWallet?.wallet?.address && !!chainName,
117
118
  });
118
119
  // Find a token with a balance, prioritizing tokens the user already owns
119
- const getTokenWithBalance = (0, react_2.useCallback)(() => {
120
+ const getTokenWithBalance = (0, react_3.useCallback)(() => {
120
121
  if (!currentWallet?.wallet?.address || (!nativeTokens && !fungibleTokens) || !tokenList) {
121
122
  return (0, anyspend_1.getDefaultToken)(srcChainId);
122
123
  }
@@ -146,10 +147,10 @@ function AnySpendCustom({ isMainnet = true, loadOrder, mode = "modal", recipient
146
147
  return (0, anyspend_1.getDefaultToken)(srcChainId);
147
148
  }, [currentWallet?.wallet?.address, nativeTokens, fungibleTokens, tokenList, srcChainId]);
148
149
  // Set the selected token with preference for tokens user owns
149
- const [srcToken, setSrcToken] = (0, react_2.useState)((0, anyspend_1.getDefaultToken)(srcChainId));
150
- const [dirtySelectSrcToken, setDirtySelectSrcToken] = (0, react_2.useState)(false);
150
+ const [srcToken, setSrcToken] = (0, react_3.useState)((0, anyspend_1.getDefaultToken)(srcChainId));
151
+ const [dirtySelectSrcToken, setDirtySelectSrcToken] = (0, react_3.useState)(false);
151
152
  // Update token when chain changes or token balances are loaded
152
- (0, react_2.useEffect)(() => {
153
+ (0, react_3.useEffect)(() => {
153
154
  if (tokenList?.length && !dirtySelectSrcToken) {
154
155
  const tokenWithBalance = getTokenWithBalance();
155
156
  if ((0, anyspend_1.eqci)(tokenWithBalance.address, dstToken.address) === false) {
@@ -157,8 +158,8 @@ function AnySpendCustom({ isMainnet = true, loadOrder, mode = "modal", recipient
157
158
  }
158
159
  }
159
160
  }, [srcChainId, tokenList, getTokenWithBalance, nativeTokens, fungibleTokens, dirtySelectSrcToken, dstToken.address]);
160
- const { account: isAuthenticated } = (0, react_1.useB3)();
161
- const getRelayQuoteRequest = (0, react_2.useMemo)(() => {
161
+ const { account: isAuthenticated } = (0, react_2.useB3)();
162
+ const getRelayQuoteRequest = (0, react_3.useMemo)(() => {
162
163
  return generateGetRelayQuoteRequest({
163
164
  orderType: orderType,
164
165
  srcChainId: srcChainId,
@@ -184,10 +185,10 @@ function AnySpendCustom({ isMainnet = true, loadOrder, mode = "modal", recipient
184
185
  srcChainId,
185
186
  srcToken,
186
187
  ]);
187
- const { anyspendQuote, isLoadingAnyspendQuote } = (0, anyspend_1.useAnyspendQuote)(isMainnet, getRelayQuoteRequest);
188
+ const { anyspendQuote, isLoadingAnyspendQuote } = (0, react_1.useAnyspendQuote)(isMainnet, getRelayQuoteRequest);
188
189
  // Get geo data and onramp options (after quote is available)
189
- const { geoData, isOnrampSupported } = (0, anyspend_1.useGeoOnrampOptions)(isMainnet, anyspendQuote?.data?.currencyIn?.amountUsd || "0");
190
- const { orderAndTransactions: oat } = (0, anyspend_1.useAnyspendOrderAndTransactions)(isMainnet, orderId);
190
+ const { geoData, isOnrampSupported } = (0, react_1.useGeoOnrampOptions)(isMainnet, anyspendQuote?.data?.currencyIn?.amountUsd || "0");
191
+ const { orderAndTransactions: oat } = (0, react_1.useAnyspendOrderAndTransactions)(isMainnet, orderId);
191
192
  const onSelectOrder = (selectedOrderId) => {
192
193
  setActivePanel(PanelView.ORDER_DETAILS);
193
194
  setOrderId(selectedOrderId);
@@ -196,11 +197,11 @@ function AnySpendCustom({ isMainnet = true, loadOrder, mode = "modal", recipient
196
197
  params.set("orderId", selectedOrderId);
197
198
  router.push(`${window.location.pathname}?${params.toString()}`);
198
199
  };
199
- const [srcAmount, setSrcAmount] = (0, react_2.useState)(null);
200
+ const [srcAmount, setSrcAmount] = (0, react_3.useState)(null);
200
201
  const formattedSrcAmount = srcAmount ? (0, number_1.formatTokenAmount)(srcAmount, srcToken.decimals, 6, false) : null;
201
202
  // Update the selected src token to USDC and chain to base when the active tab is fiat,
202
203
  // also force not to update srcToken by setting dirtySelectSrcToken to true.
203
- (0, react_2.useEffect)(() => {
204
+ (0, react_3.useEffect)(() => {
204
205
  if (activeTab === "fiat") {
205
206
  setSrcChainId(chains_1.base.id);
206
207
  setSrcToken(anyspend_1.USDC_BASE);
@@ -208,7 +209,7 @@ function AnySpendCustom({ isMainnet = true, loadOrder, mode = "modal", recipient
208
209
  }
209
210
  }, [activeTab]);
210
211
  // Update dependent amount when relay price changes
211
- (0, react_2.useEffect)(() => {
212
+ (0, react_3.useEffect)(() => {
212
213
  if (anyspendQuote?.data &&
213
214
  anyspendQuote.data.currencyIn?.amount &&
214
215
  anyspendQuote.data.currencyIn?.currency?.decimals) {
@@ -220,14 +221,14 @@ function AnySpendCustom({ isMainnet = true, loadOrder, mode = "modal", recipient
220
221
  setSrcAmount(null);
221
222
  }
222
223
  }, [anyspendQuote?.data]);
223
- (0, react_2.useEffect)(() => {
224
+ (0, react_3.useEffect)(() => {
224
225
  if (oat?.data?.order.status === anyspend_1.OrderStatus.Executed) {
225
226
  console.log("Calling onSuccess");
226
227
  const txHash = oat?.data?.executeTx?.txHash;
227
228
  onSuccess?.(txHash);
228
229
  }
229
230
  }, [oat?.data?.executeTx?.txHash, oat?.data?.order.status, onSuccess]);
230
- const { createOrder: createRegularOrder, isCreatingOrder: isCreatingRegularOrder } = (0, anyspend_1.useAnyspendCreateOrder)({
231
+ const { createOrder: createRegularOrder, isCreatingOrder: isCreatingRegularOrder } = (0, react_1.useAnyspendCreateOrder)({
231
232
  onSuccess: data => {
232
233
  setOrderId(data.data.id);
233
234
  },
@@ -236,7 +237,7 @@ function AnySpendCustom({ isMainnet = true, loadOrder, mode = "modal", recipient
236
237
  sonner_1.toast.error("Failed to create order: " + error.message);
237
238
  },
238
239
  });
239
- const { createOrder: createOnrampOrder, isCreatingOrder: isCreatingOnrampOrder } = (0, anyspend_1.useAnyspendCreateOnrampOrder)({
240
+ const { createOrder: createOnrampOrder, isCreatingOrder: isCreatingOnrampOrder } = (0, react_1.useAnyspendCreateOnrampOrder)({
240
241
  onSuccess: data => {
241
242
  setOrderId(data.data.id);
242
243
  },
@@ -364,7 +365,7 @@ function AnySpendCustom({ isMainnet = true, loadOrder, mode = "modal", recipient
364
365
  ? "Receive NFT at"
365
366
  : orderType === anyspend_1.OrderType.JoinTournament
366
367
  ? "Join for"
367
- : "Recipient" }), (0, jsx_runtime_1.jsx)("div", { children: (0, jsx_runtime_1.jsxs)(react_1.Button, { variant: "outline", className: "w-full justify-between border-none p-0", onClick: () => setIsRecipientModalOpen(true), children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-2", children: [recipientImageUrl && ((0, jsx_runtime_1.jsx)("img", { src: recipientImageUrl, alt: recipientImageUrl, className: "bg-b3-react-foreground size-7 rounded-full object-cover opacity-100" })), (0, jsx_runtime_1.jsxs)("div", { className: "flex flex-col items-start gap-1", children: [recipientEnsName && (0, jsx_runtime_1.jsxs)("span", { children: ["@", recipientEnsName] }), (0, jsx_runtime_1.jsx)("span", { children: (0, centerTruncate_1.default)(recipientAddress) })] })] }), (0, jsx_runtime_1.jsx)(lucide_react_1.ChevronRightCircle, { className: "ml-2 size-4 shrink-0 opacity-50" })] }) })] })) : null;
368
+ : "Recipient" }), (0, jsx_runtime_1.jsx)("div", { children: (0, jsx_runtime_1.jsxs)(react_2.Button, { variant: "outline", className: "w-full justify-between border-none p-0", onClick: () => setIsRecipientModalOpen(true), children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-2", children: [recipientImageUrl && ((0, jsx_runtime_1.jsx)("img", { src: recipientImageUrl, alt: recipientImageUrl, className: "bg-b3-react-foreground size-7 rounded-full object-cover opacity-100" })), (0, jsx_runtime_1.jsxs)("div", { className: "flex flex-col items-start gap-1", children: [recipientEnsName && (0, jsx_runtime_1.jsxs)("span", { children: ["@", recipientEnsName] }), (0, jsx_runtime_1.jsx)("span", { children: (0, centerTruncate_1.default)(recipientAddress) })] })] }), (0, jsx_runtime_1.jsx)(lucide_react_1.ChevronRightCircle, { className: "ml-2 size-4 shrink-0 opacity-50" })] }) })] })) : null;
368
369
  const historyView = ((0, jsx_runtime_1.jsx)("div", { className: (0, utils_1.cn)("mx-auto flex w-full max-w-2xl flex-col items-center p-5", mode === "modal" && "bg-b3-react-background"), children: (0, jsx_runtime_1.jsx)(OrderHistory_1.OrderHistory, { mode: mode, onBack: () => {
369
370
  setActivePanel(PanelView.HISTORY);
370
371
  }, onSelectOrder: onSelectOrder }) }));
@@ -376,9 +377,9 @@ function AnySpendCustom({ isMainnet = true, loadOrder, mode = "modal", recipient
376
377
  params.delete("orderId");
377
378
  router.push(`${window.location.pathname}?${params.toString()}`);
378
379
  } })] })), mode === "page" && (0, jsx_runtime_1.jsx)("div", { className: "h-12" })] }));
379
- const loadingView = ((0, jsx_runtime_1.jsxs)("div", { className: (0, utils_1.cn)("mx-auto flex w-full flex-col items-center gap-4 p-5", mode === "modal" && "bg-b3-react-background"), children: [(0, jsx_runtime_1.jsxs)(react_1.Badge, { variant: "default", className: "bg-b3-react-muted/30 border-b3-react-border hover:bg-b3-react-muted/50 flex items-center gap-3 px-4 py-1 text-base transition-all", children: [(0, jsx_runtime_1.jsx)(lucide_react_1.Loader2, { className: "text-b3-react-foreground size-4 animate-spin" }), (0, jsx_runtime_1.jsx)(react_1.TextShimmer, { duration: 1, className: "font-sf-rounded text-base font-semibold", children: "Loading..." })] }), (0, jsx_runtime_1.jsxs)("div", { className: "flex w-full flex-1 flex-col", children: [(0, jsx_runtime_1.jsxs)("div", { className: "mb-4 flex flex-col gap-1", children: [(0, jsx_runtime_1.jsx)(react_1.Skeleton, { className: "h-4 w-24" }), (0, jsx_runtime_1.jsxs)("div", { className: "mt-2 flex items-center gap-2", children: [(0, jsx_runtime_1.jsx)(react_1.Skeleton, { className: "h-8 w-48" }), (0, jsx_runtime_1.jsx)(react_1.Skeleton, { className: "ml-4 h-8 w-32" })] }), (0, jsx_runtime_1.jsx)(react_1.Skeleton, { className: "mt-4 h-8 w-24" })] }), (0, jsx_runtime_1.jsx)(react_1.Skeleton, { className: "mb-4 h-12 w-full" }), (0, jsx_runtime_1.jsxs)("div", { className: "flex w-full items-center justify-between gap-4", children: [(0, jsx_runtime_1.jsxs)(react_1.Skeleton, { className: "rounded-lg bg-white/5 p-6 pb-3", children: [(0, jsx_runtime_1.jsx)("div", { className: "size-[200px]" }), (0, jsx_runtime_1.jsx)("div", { className: "mt-3 flex items-center justify-center gap-2", children: (0, jsx_runtime_1.jsx)("div", { className: "size-5 rounded-full" }) })] }), (0, jsx_runtime_1.jsx)("div", { className: "flex flex-1 flex-col gap-2", children: [1, 2, 3].map(i => ((0, jsx_runtime_1.jsx)(react_1.Skeleton, { className: "h-10 w-full" }, i))) })] })] }), (0, jsx_runtime_1.jsxs)("div", { className: "bg-b3-react-muted/30 mt-8 w-full rounded-lg p-4", children: [(0, jsx_runtime_1.jsx)(react_1.Skeleton, { className: "mb-3 h-4 w-48" }), (0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-4", children: [(0, jsx_runtime_1.jsx)(react_1.Skeleton, { className: "h-10 flex-1" }), (0, jsx_runtime_1.jsx)(react_1.Skeleton, { className: "h-10 flex-1" })] })] }), (0, jsx_runtime_1.jsx)("div", { className: "flex w-full flex-col gap-3", children: [1, 2, 3, 4, 5].map(i => ((0, jsx_runtime_1.jsxs)("div", { className: "flex w-full justify-between", children: [(0, jsx_runtime_1.jsx)(react_1.Skeleton, { className: "h-4 w-24" }), (0, jsx_runtime_1.jsx)(react_1.Skeleton, { className: "h-4 w-32" })] }, i))) }), (0, jsx_runtime_1.jsx)(react_1.Skeleton, { className: "h-10 w-full" }), mode === "page" && (0, jsx_runtime_1.jsx)("div", { className: "h-12" })] }));
380
+ const loadingView = ((0, jsx_runtime_1.jsxs)("div", { className: (0, utils_1.cn)("mx-auto flex w-full flex-col items-center gap-4 p-5", mode === "modal" && "bg-b3-react-background"), children: [(0, jsx_runtime_1.jsxs)(react_2.Badge, { variant: "default", className: "bg-b3-react-muted/30 border-b3-react-border hover:bg-b3-react-muted/50 flex items-center gap-3 px-4 py-1 text-base transition-all", children: [(0, jsx_runtime_1.jsx)(lucide_react_1.Loader2, { className: "text-b3-react-foreground size-4 animate-spin" }), (0, jsx_runtime_1.jsx)(react_2.TextShimmer, { duration: 1, className: "font-sf-rounded text-base font-semibold", children: "Loading..." })] }), (0, jsx_runtime_1.jsxs)("div", { className: "flex w-full flex-1 flex-col", children: [(0, jsx_runtime_1.jsxs)("div", { className: "mb-4 flex flex-col gap-1", children: [(0, jsx_runtime_1.jsx)(react_2.Skeleton, { className: "h-4 w-24" }), (0, jsx_runtime_1.jsxs)("div", { className: "mt-2 flex items-center gap-2", children: [(0, jsx_runtime_1.jsx)(react_2.Skeleton, { className: "h-8 w-48" }), (0, jsx_runtime_1.jsx)(react_2.Skeleton, { className: "ml-4 h-8 w-32" })] }), (0, jsx_runtime_1.jsx)(react_2.Skeleton, { className: "mt-4 h-8 w-24" })] }), (0, jsx_runtime_1.jsx)(react_2.Skeleton, { className: "mb-4 h-12 w-full" }), (0, jsx_runtime_1.jsxs)("div", { className: "flex w-full items-center justify-between gap-4", children: [(0, jsx_runtime_1.jsxs)(react_2.Skeleton, { className: "rounded-lg bg-white/5 p-6 pb-3", children: [(0, jsx_runtime_1.jsx)("div", { className: "size-[200px]" }), (0, jsx_runtime_1.jsx)("div", { className: "mt-3 flex items-center justify-center gap-2", children: (0, jsx_runtime_1.jsx)("div", { className: "size-5 rounded-full" }) })] }), (0, jsx_runtime_1.jsx)("div", { className: "flex flex-1 flex-col gap-2", children: [1, 2, 3].map(i => ((0, jsx_runtime_1.jsx)(react_2.Skeleton, { className: "h-10 w-full" }, i))) })] })] }), (0, jsx_runtime_1.jsxs)("div", { className: "bg-b3-react-muted/30 mt-8 w-full rounded-lg p-4", children: [(0, jsx_runtime_1.jsx)(react_2.Skeleton, { className: "mb-3 h-4 w-48" }), (0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-4", children: [(0, jsx_runtime_1.jsx)(react_2.Skeleton, { className: "h-10 flex-1" }), (0, jsx_runtime_1.jsx)(react_2.Skeleton, { className: "h-10 flex-1" })] })] }), (0, jsx_runtime_1.jsx)("div", { className: "flex w-full flex-col gap-3", children: [1, 2, 3, 4, 5].map(i => ((0, jsx_runtime_1.jsxs)("div", { className: "flex w-full justify-between", children: [(0, jsx_runtime_1.jsx)(react_2.Skeleton, { className: "h-4 w-24" }), (0, jsx_runtime_1.jsx)(react_2.Skeleton, { className: "h-4 w-32" })] }, i))) }), (0, jsx_runtime_1.jsx)(react_2.Skeleton, { className: "h-10 w-full" }), mode === "page" && (0, jsx_runtime_1.jsx)("div", { className: "h-12" })] }));
380
381
  // Confirm order view.
381
- const confirmOrderView = ((0, jsx_runtime_1.jsxs)("div", { className: "relative mx-auto flex w-full flex-col items-center", children: [header({ anyspendPrice: anyspendQuote, isLoadingAnyspendPrice: isLoadingAnyspendQuote }), (0, jsx_runtime_1.jsx)("div", { className: "divider w-full" }), (0, jsx_runtime_1.jsxs)(react_1.Tabs, { value: activeTab, onValueChange: value => setActiveTab(value), className: "bg-b3-react-background max-h-[60dvh] w-full overflow-y-auto p-5", children: [(0, jsx_runtime_1.jsxs)(react_1.TabsList, { hideGradient: true, className: "justify-center", children: [(0, jsx_runtime_1.jsx)(react_1.TabTrigger, { value: "crypto", children: (0, jsx_runtime_1.jsx)("span", { className: "text-as-primary w-[140px]", children: "Pay with crypto" }) }), isOnrampSupported ? ((0, jsx_runtime_1.jsx)(react_1.TabTrigger, { value: "fiat", children: (0, jsx_runtime_1.jsx)("span", { className: "text-as-primary w-[140px]", children: "Pay with fiat" }) })) : ((0, jsx_runtime_1.jsxs)(react_1.Tooltip, { children: [(0, jsx_runtime_1.jsx)(react_1.TooltipTrigger, { asChild: true, children: (0, jsx_runtime_1.jsx)(react_1.TabTrigger, { value: "fiat", disabled: true, children: (0, jsx_runtime_1.jsx)("span", { className: "text-as-primary w-[140px]", children: "Pay with fiat" }) }) }), (0, jsx_runtime_1.jsx)(react_1.TooltipContent, { children: (0, jsx_runtime_1.jsx)("span", { className: "text-as-primary w-[140px]", children: "Fiat payments are not supported for this amount" }) })] }))] }), (0, jsx_runtime_1.jsx)(react_1.TabsContent, { value: "crypto", children: (0, jsx_runtime_1.jsxs)("div", { className: "mt-2 flex flex-col gap-4", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex flex-col gap-4", children: [(0, jsx_runtime_1.jsxs)(framer_motion_1.motion.div, { initial: false, animate: {
382
+ const confirmOrderView = ((0, jsx_runtime_1.jsxs)("div", { className: "relative mx-auto flex w-full flex-col items-center", children: [header({ anyspendPrice: anyspendQuote, isLoadingAnyspendPrice: isLoadingAnyspendQuote }), (0, jsx_runtime_1.jsx)("div", { className: "divider w-full" }), (0, jsx_runtime_1.jsxs)(react_2.Tabs, { value: activeTab, onValueChange: value => setActiveTab(value), className: "bg-b3-react-background max-h-[60dvh] w-full overflow-y-auto p-5", children: [(0, jsx_runtime_1.jsxs)(react_2.TabsList, { hideGradient: true, className: "justify-center", children: [(0, jsx_runtime_1.jsx)(react_2.TabTrigger, { value: "crypto", children: (0, jsx_runtime_1.jsx)("span", { className: "text-as-primary w-[140px]", children: "Pay with crypto" }) }), isOnrampSupported ? ((0, jsx_runtime_1.jsx)(react_2.TabTrigger, { value: "fiat", children: (0, jsx_runtime_1.jsx)("span", { className: "text-as-primary w-[140px]", children: "Pay with fiat" }) })) : ((0, jsx_runtime_1.jsxs)(react_2.Tooltip, { children: [(0, jsx_runtime_1.jsx)(react_2.TooltipTrigger, { asChild: true, children: (0, jsx_runtime_1.jsx)(react_2.TabTrigger, { value: "fiat", disabled: true, children: (0, jsx_runtime_1.jsx)("span", { className: "text-as-primary w-[140px]", children: "Pay with fiat" }) }) }), (0, jsx_runtime_1.jsx)(react_2.TooltipContent, { children: (0, jsx_runtime_1.jsx)("span", { className: "text-as-primary w-[140px]", children: "Fiat payments are not supported for this amount" }) })] }))] }), (0, jsx_runtime_1.jsx)(react_2.TabsContent, { value: "crypto", children: (0, jsx_runtime_1.jsxs)("div", { className: "mt-2 flex flex-col gap-4", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex flex-col gap-4", children: [(0, jsx_runtime_1.jsxs)(framer_motion_1.motion.div, { initial: false, animate: {
382
383
  opacity: hasMounted ? 1 : 0,
383
384
  y: hasMounted ? 0 : 20,
384
385
  filter: hasMounted ? "blur(0px)" : "blur(10px)",
@@ -393,7 +394,7 @@ function AnySpendCustom({ isMainnet = true, loadOrder, mode = "modal", recipient
393
394
  opacity: hasMounted ? 1 : 0,
394
395
  y: hasMounted ? 0 : 20,
395
396
  filter: hasMounted ? "blur(0px)" : "blur(10px)",
396
- }, transition: { duration: 0.3, delay: 0.3, ease: "easeInOut" }, className: "flex w-full flex-col gap-2", children: (0, jsx_runtime_1.jsx)(react_1.ShinyButton, { accentColor: "hsl(var(--as-brand))", textColor: "text-white", disabled: isCreatingOrder || isLoadingAnyspendQuote || !anyspendQuote, onClick: () => handleConfirmOrder(), className: "relative w-full", children: !isAuthenticated ? ("Sign in with B3") : isCreatingOrder ? ((0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-2", children: [(0, jsx_runtime_1.jsx)(lucide_react_1.Loader2, { className: "size-4 animate-spin" }), (0, jsx_runtime_1.jsx)("span", { children: "Creating order..." })] })) : isLoadingAnyspendQuote ? ((0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-2", children: [(0, jsx_runtime_1.jsx)(lucide_react_1.Loader2, { className: "size-4 animate-spin" }), (0, jsx_runtime_1.jsx)("span", { children: "Loading quote..." })] })) : anyspendQuote ? ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("span", { children: "Checkout" }), (0, jsx_runtime_1.jsx)(lucide_react_1.ChevronRightCircle, { className: "absolute right-0 top-1/2 size-6 -translate-y-1/2 opacity-70" })] })) : ("No quote found") }) }) })] }) }), (0, jsx_runtime_1.jsx)(react_1.TabsContent, { value: "fiat", children: (0, jsx_runtime_1.jsx)("div", { className: "mt-6 flex w-full flex-col gap-6", children: (0, jsx_runtime_1.jsx)(PanelOnrampPayment_1.PanelOnrampPayment, { srcAmountOnRamp: anyspendQuote?.data?.currencyIn?.amountUsd || "0", recipientName: recipientEnsName, recipientAddress: recipientAddress, isMainnet: isMainnet, isBuyMode: false, selectedDstChainId: dstChainId, selectedDstToken: dstToken, anyspendQuote: anyspendQuote, globalAddress: currentWallet?.wallet?.address, onOrderCreated: (orderId) => setOrderId(orderId), onBack: () => setActiveTab("crypto"), orderType: orderType, nft: (0, anyspend_1.isNftMetadata)(metadata)
397
+ }, transition: { duration: 0.3, delay: 0.3, ease: "easeInOut" }, className: "flex w-full flex-col gap-2", children: (0, jsx_runtime_1.jsx)(react_2.ShinyButton, { accentColor: "hsl(var(--as-brand))", textColor: "text-white", disabled: isCreatingOrder || isLoadingAnyspendQuote || !anyspendQuote, onClick: () => handleConfirmOrder(), className: "relative w-full", children: !isAuthenticated ? ("Sign in with B3") : isCreatingOrder ? ((0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-2", children: [(0, jsx_runtime_1.jsx)(lucide_react_1.Loader2, { className: "size-4 animate-spin" }), (0, jsx_runtime_1.jsx)("span", { children: "Creating order..." })] })) : isLoadingAnyspendQuote ? ((0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-2", children: [(0, jsx_runtime_1.jsx)(lucide_react_1.Loader2, { className: "size-4 animate-spin" }), (0, jsx_runtime_1.jsx)("span", { children: "Loading quote..." })] })) : anyspendQuote ? ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("span", { children: "Checkout" }), (0, jsx_runtime_1.jsx)(lucide_react_1.ChevronRightCircle, { className: "absolute right-0 top-1/2 size-6 -translate-y-1/2 opacity-70" })] })) : ("No quote found") }) }) })] }) }), (0, jsx_runtime_1.jsx)(react_2.TabsContent, { value: "fiat", children: (0, jsx_runtime_1.jsx)("div", { className: "mt-6 flex w-full flex-col gap-6", children: (0, jsx_runtime_1.jsx)(PanelOnrampPayment_1.PanelOnrampPayment, { srcAmountOnRamp: anyspendQuote?.data?.currencyIn?.amountUsd || "0", recipientName: recipientEnsName, recipientAddress: recipientAddress, isMainnet: isMainnet, isBuyMode: false, selectedDstChainId: dstChainId, selectedDstToken: dstToken, anyspendQuote: anyspendQuote, globalAddress: currentWallet?.wallet?.address, onOrderCreated: (orderId) => setOrderId(orderId), onBack: () => setActiveTab("crypto"), orderType: orderType, nft: (0, anyspend_1.isNftMetadata)(metadata)
397
398
  ? metadata.nftContract.type === anyspend_1.NftType.ERC1155
398
399
  ? {
399
400
  type: anyspend_1.NftType.ERC1155,
@@ -422,7 +423,7 @@ function AnySpendCustom({ isMainnet = true, loadOrder, mode = "modal", recipient
422
423
  }
423
424
  : undefined, recipientEnsName: recipientEnsName, recipientImageUrl: recipientImageUrl }) }) })] })] }));
424
425
  // Return the TransitionPanel with all views
425
- return ((0, jsx_runtime_1.jsxs)(react_1.StyleRoot, { children: [(0, jsx_runtime_1.jsx)(react_1.TransitionPanel, { activeIndex: orderId
426
+ return ((0, jsx_runtime_1.jsxs)(react_2.StyleRoot, { children: [(0, jsx_runtime_1.jsx)(react_2.TransitionPanel, { activeIndex: orderId
426
427
  ? oat
427
428
  ? PanelView.ORDER_DETAILS
428
429
  : PanelView.LOADING
@@ -437,7 +438,7 @@ function AnySpendCustom({ isMainnet = true, loadOrder, mode = "modal", recipient
437
438
  (0, jsx_runtime_1.jsx)("div", { className: "w-full", children: historyView }, "history-view"),
438
439
  (0, jsx_runtime_1.jsx)("div", { className: "w-full", children: orderDetailsView }, "order-details-view"),
439
440
  (0, jsx_runtime_1.jsx)("div", { className: "w-full", children: loadingView }, "loading-view"),
440
- ] }), (0, jsx_runtime_1.jsx)(react_1.Dialog, { open: isRecipientModalOpen, onOpenChange: setIsRecipientModalOpen, children: (0, jsx_runtime_1.jsx)(react_1.DialogContent, { className: "w-[420px] max-w-[calc(100vw-32px)] rounded-2xl p-3.5", children: (0, jsx_runtime_1.jsxs)("div", { className: "flex flex-col gap-3", children: [(0, jsx_runtime_1.jsx)("div", { className: "text-as-primary font-semibold", children: "To address" }), (0, jsx_runtime_1.jsx)(react_1.Input, { value: customRecipientAddress || "", onChange: e => setCustomRecipientAddress(e.target.value), placeholder: "Enter address", className: "h-12 rounded-lg", spellCheck: false }), (0, jsx_runtime_1.jsx)(react_1.ShinyButton, { accentColor: "hsl(var(--as-brand))", textColor: "text-white", className: "w-full rounded-lg", onClick: () => {
441
+ ] }), (0, jsx_runtime_1.jsx)(react_2.Dialog, { open: isRecipientModalOpen, onOpenChange: setIsRecipientModalOpen, children: (0, jsx_runtime_1.jsx)(react_2.DialogContent, { className: "w-[420px] max-w-[calc(100vw-32px)] rounded-2xl p-3.5", children: (0, jsx_runtime_1.jsxs)("div", { className: "flex flex-col gap-3", children: [(0, jsx_runtime_1.jsx)("div", { className: "text-as-primary font-semibold", children: "To address" }), (0, jsx_runtime_1.jsx)(react_2.Input, { value: customRecipientAddress || "", onChange: e => setCustomRecipientAddress(e.target.value), placeholder: "Enter address", className: "h-12 rounded-lg", spellCheck: false }), (0, jsx_runtime_1.jsx)(react_2.ShinyButton, { accentColor: "hsl(var(--as-brand))", textColor: "text-white", className: "w-full rounded-lg", onClick: () => {
441
442
  setIsRecipientModalOpen(false);
442
443
  }, children: "Save" })] }) }) })] }));
443
444
  }
@@ -3,17 +3,17 @@
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
4
  exports.OrderHistory = OrderHistory;
5
5
  const jsx_runtime_1 = require("react/jsx-runtime");
6
- const anyspend_1 = require("../../../../anyspend");
7
- const react_1 = require("../../../../global-account/react");
6
+ const react_1 = require("../../../../anyspend/react");
7
+ const react_2 = require("../../../../global-account/react");
8
8
  const lucide_react_1 = require("lucide-react");
9
9
  const OrderHistoryItem_1 = require("./OrderHistoryItem");
10
10
  const isMainnet = true;
11
11
  function OrderHistory({ mode, onBack, onSelectOrder }) {
12
- const { address } = (0, react_1.useAccountWallet)();
13
- const { orderHistory, isLoadingOrderHistory, refetchOrderHistory } = (0, anyspend_1.useAnyspendOrderHistory)(isMainnet, address);
14
- return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsxs)("div", { className: "mb-6 flex w-full items-center gap-4", children: [(0, jsx_runtime_1.jsx)(react_1.Button, { onClick: onBack, variant: "ghost", size: "icon", children: (0, jsx_runtime_1.jsx)(lucide_react_1.ArrowLeft, { className: "h-4 w-4" }) }), (0, jsx_runtime_1.jsxs)("div", { className: "flex-1", children: [(0, jsx_runtime_1.jsx)("h3", { className: "text-xl font-semibold", children: "Order History" }), (0, jsx_runtime_1.jsx)("p", { className: "text-as-primary/30 text-sm", children: "View your past transactions" })] }), (0, jsx_runtime_1.jsx)(react_1.Button, { variant: "ghost", size: "icon", onClick: () => {
12
+ const { address } = (0, react_2.useAccountWallet)();
13
+ const { orderHistory, isLoadingOrderHistory, refetchOrderHistory } = (0, react_1.useAnyspendOrderHistory)(isMainnet, address);
14
+ return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsxs)("div", { className: "mb-6 flex w-full items-center gap-4", children: [(0, jsx_runtime_1.jsx)(react_2.Button, { onClick: onBack, variant: "ghost", size: "icon", children: (0, jsx_runtime_1.jsx)(lucide_react_1.ArrowLeft, { className: "h-4 w-4" }) }), (0, jsx_runtime_1.jsxs)("div", { className: "flex-1", children: [(0, jsx_runtime_1.jsx)("h3", { className: "text-xl font-semibold", children: "Order History" }), (0, jsx_runtime_1.jsx)("p", { className: "text-as-primary/30 text-sm", children: "View your past transactions" })] }), (0, jsx_runtime_1.jsx)(react_2.Button, { variant: "ghost", size: "icon", onClick: () => {
15
15
  refetchOrderHistory();
16
- }, children: (0, jsx_runtime_1.jsx)(lucide_react_1.RefreshCcw, { className: "text-as-primary/30 hover:text-as-primary h-4 w-4 cursor-pointer transition-all hover:rotate-180" }) })] }), isLoadingOrderHistory ? ((0, jsx_runtime_1.jsx)("div", { className: "w-full space-y-4", children: [1, 2, 3].map(i => ((0, jsx_runtime_1.jsx)(react_1.Skeleton, { className: "h-[160px] w-full rounded-lg" }, i))) })) : !orderHistory?.length ? ((0, jsx_runtime_1.jsx)("div", { className: "bg-as-light-brand w-full rounded-lg border p-8 text-center", children: (0, jsx_runtime_1.jsx)("p", { className: "text-b3-react-muted-foreground", children: "No order history found" }) })) : ((0, jsx_runtime_1.jsx)("div", { className: "mb-12 w-full space-y-4", children: [...orderHistory]
16
+ }, children: (0, jsx_runtime_1.jsx)(lucide_react_1.RefreshCcw, { className: "text-as-primary/30 hover:text-as-primary h-4 w-4 cursor-pointer transition-all hover:rotate-180" }) })] }), isLoadingOrderHistory ? ((0, jsx_runtime_1.jsx)("div", { className: "w-full space-y-4", children: [1, 2, 3].map(i => ((0, jsx_runtime_1.jsx)(react_2.Skeleton, { className: "h-[160px] w-full rounded-lg" }, i))) })) : !orderHistory?.length ? ((0, jsx_runtime_1.jsx)("div", { className: "bg-as-light-brand w-full rounded-lg border p-8 text-center", children: (0, jsx_runtime_1.jsx)("p", { className: "text-b3-react-muted-foreground", children: "No order history found" }) })) : ((0, jsx_runtime_1.jsx)("div", { className: "mb-12 w-full space-y-4", children: [...orderHistory]
17
17
  .sort((a, b) => b.createdAt - a.createdAt)
18
18
  .map(order => ((0, jsx_runtime_1.jsx)(OrderHistoryItem_1.OrderHistoryItem, { order: order, onSelectOrder: onSelectOrder, mode: mode }, order.id))) }))] }));
19
19
  }
@@ -2,17 +2,17 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.PanelOnramp = PanelOnramp;
4
4
  const jsx_runtime_1 = require("react/jsx-runtime");
5
- const anyspend_1 = require("../../../../anyspend");
6
- const react_1 = require("../../../../global-account/react");
5
+ const react_1 = require("../../../../anyspend/react");
6
+ const react_2 = require("../../../../global-account/react");
7
7
  const framer_motion_1 = require("framer-motion");
8
- const react_2 = require("react");
8
+ const react_3 = require("react");
9
9
  const sonner_1 = require("sonner");
10
10
  const PaymentOptions_1 = require("./PaymentOptions");
11
11
  function PanelOnramp({ srcAmountOnRamp, setSrcAmountOnRamp, }) {
12
12
  // Get geo data for onramp availability
13
- const { geoData } = (0, react_1.useGetGeo)();
14
- const { coinbaseOnrampOptions } = (0, anyspend_1.useCoinbaseOnrampOptions)(true, geoData?.country || "US");
15
- const amountInputRef = (0, react_2.useRef)(null);
13
+ const { geoData } = (0, react_2.useGetGeo)();
14
+ const { coinbaseOnrampOptions } = (0, react_1.useCoinbaseOnrampOptions)(true, geoData?.country || "US");
15
+ const amountInputRef = (0, react_3.useRef)(null);
16
16
  const handleAmountChange = (e) => {
17
17
  // Only allow numbers and decimal points
18
18
  const value = e.target.value.replace(/[^0-9.]/g, "");
@@ -33,7 +33,7 @@ function PanelOnramp({ srcAmountOnRamp, setSrcAmountOnRamp, }) {
33
33
  (coinbaseOnrampOptions?.paymentCurrencies?.[0]?.limits?.find(l => l.id === "ACH_BANK_ACCOUNT")?.max
34
34
  ? parseFloat(coinbaseOnrampOptions.paymentCurrencies[0].limits.find(l => l.id === "ACH_BANK_ACCOUNT")?.max || "25000")
35
35
  : 25000) ? ((0, jsx_runtime_1.jsxs)("p", { className: "label-style -mb-3 mt-3 text-xs text-red-400 dark:bg-transparent", children: ["Maximum amount is $", coinbaseOnrampOptions?.paymentCurrencies?.[0]?.limits?.find(l => l.id === "ACH_BANK_ACCOUNT")?.max ||
36
- "25,000"] })) : ((0, jsx_runtime_1.jsx)("p", { className: "label-style text-b3-react-foreground/60 -mb-3 mt-3 text-xs dark:bg-transparent", children: "Buy amount in USD" })), (0, jsx_runtime_1.jsxs)("div", { className: "relative inline-flex items-center dark:bg-transparent", children: [(0, jsx_runtime_1.jsx)("span", { className: "text-b3-react-foreground/60 -ms-3 -mt-2 text-2xl font-semibold dark:bg-transparent", children: "$" }), (0, jsx_runtime_1.jsx)(react_1.Input, { ref: amountInputRef, type: "text", value: srcAmountOnRamp, onChange: handleAmountChange, placeholder: "0.00", className: "placeholder:text-b3-react-foreground/60 h-auto min-w-[70px] border-0 bg-transparent py-6 text-center text-4xl font-semibold focus-visible:ring-0 focus-visible:ring-offset-0 dark:bg-transparent", style: {
36
+ "25,000"] })) : ((0, jsx_runtime_1.jsx)("p", { className: "label-style text-b3-react-foreground/60 -mb-3 mt-3 text-xs dark:bg-transparent", children: "Buy amount in USD" })), (0, jsx_runtime_1.jsxs)("div", { className: "relative inline-flex items-center dark:bg-transparent", children: [(0, jsx_runtime_1.jsx)("span", { className: "text-b3-react-foreground/60 -ms-3 -mt-2 text-2xl font-semibold dark:bg-transparent", children: "$" }), (0, jsx_runtime_1.jsx)(react_2.Input, { ref: amountInputRef, type: "text", value: srcAmountOnRamp, onChange: handleAmountChange, placeholder: "0.00", className: "placeholder:text-b3-react-foreground/60 h-auto min-w-[70px] border-0 bg-transparent py-6 text-center text-4xl font-semibold focus-visible:ring-0 focus-visible:ring-offset-0 dark:bg-transparent", style: {
37
37
  width: `${Math.max(50, srcAmountOnRamp.length * 34)}px`,
38
38
  minWidth: srcAmountOnRamp ? `auto` : "105px",
39
39
  } }), (0, jsx_runtime_1.jsx)(framer_motion_1.AnimatePresence, { mode: "wait", children: (0, jsx_runtime_1.jsx)(framer_motion_1.motion.div, { animate: { opacity: !srcAmountOnRamp || parseFloat(srcAmountOnRamp) <= 0 ? 1 : 0 }, exit: { opacity: 0 }, transition: { duration: 0.5, ease: "easeInOut" }, className: "border-b3-react-foreground/10 absolute bottom-3 left-1 h-1 w-[90%] rounded-full border-t-2 border-dashed bg-transparent" }) })] })] }), (0, jsx_runtime_1.jsx)("div", { className: "grid grid-cols-4 gap-4", children: ["5", "10", "25", "100"].map(value => ((0, jsx_runtime_1.jsxs)("button", { onClick: () => handleQuickAmount(value), className: `rounded-lg border px-4 py-3 ${srcAmountOnRamp === value