@b3dotfun/sdk 0.0.42 → 0.0.43

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 (114) hide show
  1. package/dist/cjs/anyspend/react/components/AnySpend.d.ts +1 -0
  2. package/dist/cjs/anyspend/react/components/AnySpend.js +11 -4
  3. package/dist/cjs/anyspend/react/components/AnySpendCustom.js +43 -3
  4. package/dist/cjs/anyspend/react/components/AnyspendDepositHype.d.ts +1 -0
  5. package/dist/cjs/anyspend/react/components/AnyspendDepositHype.js +2 -2
  6. package/dist/cjs/anyspend/react/components/common/PanelOnramp.d.ts +2 -1
  7. package/dist/cjs/anyspend/react/components/common/PanelOnramp.js +5 -3
  8. package/dist/cjs/global-account/react/components/SignInWithB3/SignIn.js +1 -1
  9. package/dist/cjs/global-account/react/components/index.d.ts +8 -7
  10. package/dist/cjs/global-account/react/components/index.js +29 -23
  11. package/dist/cjs/global-account/react/components/ui/dropdown-menu.d.ts +27 -0
  12. package/dist/cjs/global-account/react/components/ui/dropdown-menu.js +100 -0
  13. package/dist/cjs/global-account/react/stores/useModalStore.d.ts +5 -1
  14. package/dist/cjs/shared/constants/currency.d.ts +1 -0
  15. package/dist/cjs/shared/constants/currency.js +5 -0
  16. package/dist/cjs/shared/constants/index.d.ts +1 -0
  17. package/dist/cjs/shared/constants/index.js +15 -0
  18. package/dist/cjs/shared/react/components/CurrencySelector.d.ts +7 -0
  19. package/dist/cjs/shared/react/components/CurrencySelector.js +14 -0
  20. package/dist/cjs/shared/react/components/FormattedCurrency.d.ts +12 -0
  21. package/dist/cjs/shared/react/components/FormattedCurrency.js +60 -0
  22. package/dist/cjs/shared/react/components/index.d.ts +2 -0
  23. package/dist/cjs/shared/react/components/index.js +18 -0
  24. package/dist/cjs/shared/react/hooks/__tests__/useCurrencyConversion.test.d.ts +1 -0
  25. package/dist/cjs/shared/react/hooks/__tests__/useCurrencyConversion.test.js +245 -0
  26. package/dist/cjs/shared/react/hooks/index.d.ts +1 -0
  27. package/dist/cjs/shared/react/hooks/index.js +1 -0
  28. package/dist/cjs/shared/react/hooks/useCurrencyConversion.d.ts +35 -0
  29. package/dist/cjs/shared/react/hooks/useCurrencyConversion.js +200 -0
  30. package/dist/cjs/shared/react/index.d.ts +2 -0
  31. package/dist/cjs/shared/react/index.js +2 -0
  32. package/dist/cjs/shared/react/stores/currencyModalStore.d.ts +7 -0
  33. package/dist/cjs/shared/react/stores/currencyModalStore.js +9 -0
  34. package/dist/cjs/shared/react/stores/currencyStore.d.ts +51 -0
  35. package/dist/cjs/shared/react/stores/currencyStore.js +57 -0
  36. package/dist/cjs/shared/react/stores/index.d.ts +2 -0
  37. package/dist/cjs/shared/react/stores/index.js +18 -0
  38. package/dist/esm/anyspend/react/components/AnySpend.d.ts +1 -0
  39. package/dist/esm/anyspend/react/components/AnySpend.js +11 -4
  40. package/dist/esm/anyspend/react/components/AnySpendCustom.js +10 -3
  41. package/dist/esm/anyspend/react/components/AnyspendDepositHype.d.ts +1 -0
  42. package/dist/esm/anyspend/react/components/AnyspendDepositHype.js +2 -2
  43. package/dist/esm/anyspend/react/components/common/PanelOnramp.d.ts +2 -1
  44. package/dist/esm/anyspend/react/components/common/PanelOnramp.js +5 -3
  45. package/dist/esm/global-account/react/components/SignInWithB3/SignIn.js +1 -1
  46. package/dist/esm/global-account/react/components/index.d.ts +8 -7
  47. package/dist/esm/global-account/react/components/index.js +8 -7
  48. package/dist/esm/global-account/react/components/ui/dropdown-menu.d.ts +27 -0
  49. package/dist/esm/global-account/react/components/ui/dropdown-menu.js +60 -0
  50. package/dist/esm/global-account/react/stores/useModalStore.d.ts +5 -1
  51. package/dist/esm/shared/constants/currency.d.ts +1 -0
  52. package/dist/esm/shared/constants/currency.js +2 -0
  53. package/dist/esm/shared/constants/index.d.ts +1 -0
  54. package/dist/esm/shared/constants/index.js +1 -0
  55. package/dist/esm/shared/react/components/CurrencySelector.d.ts +7 -0
  56. package/dist/esm/shared/react/components/CurrencySelector.js +11 -0
  57. package/dist/esm/shared/react/components/FormattedCurrency.d.ts +12 -0
  58. package/dist/esm/shared/react/components/FormattedCurrency.js +57 -0
  59. package/dist/esm/shared/react/components/index.d.ts +2 -0
  60. package/dist/esm/shared/react/components/index.js +2 -0
  61. package/dist/esm/shared/react/hooks/__tests__/useCurrencyConversion.test.d.ts +1 -0
  62. package/dist/esm/shared/react/hooks/__tests__/useCurrencyConversion.test.js +243 -0
  63. package/dist/esm/shared/react/hooks/index.d.ts +1 -0
  64. package/dist/esm/shared/react/hooks/index.js +1 -0
  65. package/dist/esm/shared/react/hooks/useCurrencyConversion.d.ts +35 -0
  66. package/dist/esm/shared/react/hooks/useCurrencyConversion.js +197 -0
  67. package/dist/esm/shared/react/index.d.ts +2 -0
  68. package/dist/esm/shared/react/index.js +2 -0
  69. package/dist/esm/shared/react/stores/currencyModalStore.d.ts +7 -0
  70. package/dist/esm/shared/react/stores/currencyModalStore.js +6 -0
  71. package/dist/esm/shared/react/stores/currencyStore.d.ts +51 -0
  72. package/dist/esm/shared/react/stores/currencyStore.js +54 -0
  73. package/dist/esm/shared/react/stores/index.d.ts +2 -0
  74. package/dist/esm/shared/react/stores/index.js +2 -0
  75. package/dist/styles/index.css +1 -1
  76. package/dist/types/anyspend/react/components/AnySpend.d.ts +1 -0
  77. package/dist/types/anyspend/react/components/AnyspendDepositHype.d.ts +1 -0
  78. package/dist/types/anyspend/react/components/common/PanelOnramp.d.ts +2 -1
  79. package/dist/types/global-account/react/components/index.d.ts +8 -7
  80. package/dist/types/global-account/react/components/ui/dropdown-menu.d.ts +27 -0
  81. package/dist/types/global-account/react/stores/useModalStore.d.ts +5 -1
  82. package/dist/types/shared/constants/currency.d.ts +1 -0
  83. package/dist/types/shared/constants/index.d.ts +1 -0
  84. package/dist/types/shared/react/components/CurrencySelector.d.ts +7 -0
  85. package/dist/types/shared/react/components/FormattedCurrency.d.ts +12 -0
  86. package/dist/types/shared/react/components/index.d.ts +2 -0
  87. package/dist/types/shared/react/hooks/__tests__/useCurrencyConversion.test.d.ts +1 -0
  88. package/dist/types/shared/react/hooks/index.d.ts +1 -0
  89. package/dist/types/shared/react/hooks/useCurrencyConversion.d.ts +35 -0
  90. package/dist/types/shared/react/index.d.ts +2 -0
  91. package/dist/types/shared/react/stores/currencyModalStore.d.ts +7 -0
  92. package/dist/types/shared/react/stores/currencyStore.d.ts +51 -0
  93. package/dist/types/shared/react/stores/index.d.ts +2 -0
  94. package/package.json +29 -3
  95. package/src/anyspend/react/components/AnySpend.tsx +15 -2
  96. package/src/anyspend/react/components/AnySpendCustom.tsx +11 -2
  97. package/src/anyspend/react/components/AnyspendDepositHype.tsx +3 -0
  98. package/src/anyspend/react/components/common/PanelOnramp.tsx +19 -15
  99. package/src/global-account/react/components/SignInWithB3/SignIn.tsx +2 -7
  100. package/src/global-account/react/components/index.ts +19 -12
  101. package/src/global-account/react/components/ui/dropdown-menu.tsx +132 -0
  102. package/src/global-account/react/stores/useModalStore.ts +5 -1
  103. package/src/shared/constants/currency.ts +2 -0
  104. package/src/shared/constants/index.ts +2 -0
  105. package/src/shared/react/components/CurrencySelector.tsx +71 -0
  106. package/src/shared/react/components/FormattedCurrency.tsx +106 -0
  107. package/src/shared/react/components/index.ts +2 -0
  108. package/src/shared/react/hooks/__tests__/useCurrencyConversion.test.ts +308 -0
  109. package/src/shared/react/hooks/index.ts +1 -0
  110. package/src/shared/react/hooks/useCurrencyConversion.ts +211 -0
  111. package/src/shared/react/index.ts +2 -0
  112. package/src/shared/react/stores/currencyModalStore.ts +13 -0
  113. package/src/shared/react/stores/currencyStore.ts +82 -0
  114. package/src/shared/react/stores/index.ts +2 -0
@@ -0,0 +1,7 @@
1
+ interface CurrencyModalState {
2
+ isOpen: boolean;
3
+ openModal: () => void;
4
+ closeModal: () => void;
5
+ }
6
+ export declare const useCurrencyModalStore: import("zustand").UseBoundStore<import("zustand").StoreApi<CurrencyModalState>>;
7
+ export {};
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.useCurrencyModalStore = void 0;
4
+ const zustand_1 = require("zustand");
5
+ exports.useCurrencyModalStore = (0, zustand_1.create)(set => ({
6
+ isOpen: false,
7
+ openModal: () => set({ isOpen: true }),
8
+ closeModal: () => set({ isOpen: false }),
9
+ }));
@@ -0,0 +1,51 @@
1
+ /**
2
+ * Supported currencies for display and conversion.
3
+ * Includes fiat currencies (USD, EUR, GBP, JPY, CAD, AUD, KRW) and crypto (ETH, SOL, B3).
4
+ */
5
+ export type SupportedCurrency = "ETH" | "USD" | "EUR" | "GBP" | "JPY" | "CAD" | "AUD" | "B3" | "SOL" | "KRW";
6
+ /**
7
+ * Currency symbols used for display formatting.
8
+ * Prefix currencies (USD, EUR, GBP, CAD, AUD) show symbol before the amount.
9
+ * Suffix currencies (JPY, KRW, ETH, SOL, B3) show symbol after the amount.
10
+ */
11
+ export declare const CURRENCY_SYMBOLS: Record<SupportedCurrency, string>;
12
+ /**
13
+ * Human-readable currency names for display in selectors and labels.
14
+ */
15
+ export declare const CURRENCY_NAMES: Record<SupportedCurrency, string>;
16
+ /**
17
+ * Currency store state interface.
18
+ * @property selectedCurrency - The currency currently selected for display
19
+ * @property baseCurrency - The base currency for conversion (typically B3)
20
+ * @property setSelectedCurrency - Update the selected display currency
21
+ * @property setBaseCurrency - Update the base currency for conversions
22
+ */
23
+ interface CurrencyState {
24
+ selectedCurrency: SupportedCurrency;
25
+ baseCurrency: SupportedCurrency;
26
+ setSelectedCurrency: (currency: SupportedCurrency) => void;
27
+ setBaseCurrency: (currency: SupportedCurrency) => void;
28
+ }
29
+ /**
30
+ * Zustand store for managing currency selection and conversion.
31
+ * Persists user's selected currency preference in localStorage.
32
+ *
33
+ * @example
34
+ * ```tsx
35
+ * const { selectedCurrency, setSelectedCurrency } = useCurrencyStore();
36
+ * // Change display currency to USD
37
+ * setSelectedCurrency('USD');
38
+ * ```
39
+ */
40
+ export declare const useCurrencyStore: import("zustand").UseBoundStore<Omit<import("zustand").StoreApi<CurrencyState>, "persist"> & {
41
+ persist: {
42
+ setOptions: (options: Partial<import("zustand/middleware").PersistOptions<CurrencyState, CurrencyState>>) => void;
43
+ clearStorage: () => void;
44
+ rehydrate: () => Promise<void> | void;
45
+ hasHydrated: () => boolean;
46
+ onHydrate: (fn: (state: CurrencyState) => void) => () => void;
47
+ onFinishHydration: (fn: (state: CurrencyState) => void) => () => void;
48
+ getOptions: () => Partial<import("zustand/middleware").PersistOptions<CurrencyState, CurrencyState>>;
49
+ };
50
+ }>;
51
+ export {};
@@ -0,0 +1,57 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.useCurrencyStore = exports.CURRENCY_NAMES = exports.CURRENCY_SYMBOLS = void 0;
4
+ const zustand_1 = require("zustand");
5
+ const middleware_1 = require("zustand/middleware");
6
+ /**
7
+ * Currency symbols used for display formatting.
8
+ * Prefix currencies (USD, EUR, GBP, CAD, AUD) show symbol before the amount.
9
+ * Suffix currencies (JPY, KRW, ETH, SOL, B3) show symbol after the amount.
10
+ */
11
+ exports.CURRENCY_SYMBOLS = {
12
+ ETH: "ETH",
13
+ USD: "$",
14
+ EUR: "€",
15
+ GBP: "£",
16
+ JPY: "¥",
17
+ CAD: "C$",
18
+ AUD: "A$",
19
+ B3: "B3",
20
+ SOL: "SOL",
21
+ KRW: "₩",
22
+ };
23
+ /**
24
+ * Human-readable currency names for display in selectors and labels.
25
+ */
26
+ exports.CURRENCY_NAMES = {
27
+ ETH: "Ethereum",
28
+ USD: "US Dollar",
29
+ EUR: "Euro",
30
+ GBP: "British Pound",
31
+ JPY: "Japanese Yen",
32
+ CAD: "Canadian Dollar",
33
+ AUD: "Australian Dollar",
34
+ B3: "B3",
35
+ SOL: "Solana",
36
+ KRW: "Korean Won",
37
+ };
38
+ /**
39
+ * Zustand store for managing currency selection and conversion.
40
+ * Persists user's selected currency preference in localStorage.
41
+ *
42
+ * @example
43
+ * ```tsx
44
+ * const { selectedCurrency, setSelectedCurrency } = useCurrencyStore();
45
+ * // Change display currency to USD
46
+ * setSelectedCurrency('USD');
47
+ * ```
48
+ */
49
+ exports.useCurrencyStore = (0, zustand_1.create)()((0, middleware_1.persist)(set => ({
50
+ selectedCurrency: "B3",
51
+ baseCurrency: "B3",
52
+ setSelectedCurrency: currency => set({ selectedCurrency: currency }),
53
+ setBaseCurrency: currency => set({ baseCurrency: currency }),
54
+ }), {
55
+ name: "currency-storage",
56
+ version: 2,
57
+ }));
@@ -0,0 +1,2 @@
1
+ export * from "./currencyModalStore";
2
+ export * from "./currencyStore";
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./currencyModalStore"), exports);
18
+ __exportStar(require("./currencyStore"), exports);
@@ -32,4 +32,5 @@ export declare function AnySpend(props: {
32
32
  preventDefault: () => void;
33
33
  }) => void;
34
34
  onSuccess?: (txHash?: string) => void;
35
+ customUsdInputValues?: string[];
35
36
  }): import("react/jsx-runtime").JSX.Element;
@@ -42,7 +42,7 @@ export function AnySpend(props) {
42
42
  const fingerprintConfig = getFingerprintConfig();
43
43
  return (_jsx(AnySpendFingerprintWrapper, { fingerprint: fingerprintConfig, children: _jsx(AnySpendInner, { ...props }) }));
44
44
  }
45
- function AnySpendInner({ destinationTokenAddress, destinationTokenChainId, mode = "modal", defaultActiveTab = "crypto", loadOrder, hideTransactionHistoryButton, recipientAddress: recipientAddressFromProps, onTokenSelect, onSuccess, }) {
45
+ function AnySpendInner({ destinationTokenAddress, destinationTokenChainId, mode = "modal", defaultActiveTab = "crypto", loadOrder, hideTransactionHistoryButton, recipientAddress: recipientAddressFromProps, onTokenSelect, onSuccess, customUsdInputValues, }) {
46
46
  const searchParams = useSearchParamsSSR();
47
47
  const router = useRouter();
48
48
  // Determine if we're in "buy mode" based on whether destination token props are provided
@@ -50,6 +50,8 @@ function AnySpendInner({ destinationTokenAddress, destinationTokenChainId, mode
50
50
  // Add refs to track URL state
51
51
  const initialUrlProcessed = useRef(false);
52
52
  const lastUrlUpdate = useRef(null);
53
+ // Track if onSuccess has been called for the current order
54
+ const onSuccessCalled = useRef(false);
53
55
  const [activeTab, setActiveTab] = useState(defaultActiveTab);
54
56
  const [orderId, setOrderId] = useState(loadOrder);
55
57
  const { orderAndTransactions: oat, getOrderAndTransactionsError } = useAnyspendOrderAndTransactions(orderId);
@@ -387,12 +389,17 @@ function AnySpendInner({ destinationTokenAddress, destinationTokenChainId, mode
387
389
  }
388
390
  }, [anyspendQuote, isSrcInputDirty]);
389
391
  useEffect(() => {
390
- if (oat?.data?.order.status === "executed") {
392
+ if (oat?.data?.order.status === "executed" && !onSuccessCalled.current) {
391
393
  console.log("Calling onSuccess");
392
394
  const txHash = oat?.data?.executeTx?.txHash;
393
395
  onSuccess?.(txHash);
396
+ onSuccessCalled.current = true;
394
397
  }
395
- }, [oat?.data?.executeTx?.txHash, oat?.data?.order.status, onSuccess]);
398
+ }, [oat?.data?.order.status, oat?.data?.executeTx?.txHash, onSuccess]);
399
+ // Reset flag when orderId changes
400
+ useEffect(() => {
401
+ onSuccessCalled.current = false;
402
+ }, [orderId]);
396
403
  const { createOrder, isCreatingOrder } = useAnyspendCreateOrder({
397
404
  onSuccess: data => {
398
405
  const orderId = data.data.id;
@@ -667,7 +674,7 @@ function AnySpendInner({ destinationTokenAddress, destinationTokenChainId, mode
667
674
  setActivePanel(PanelView.MAIN);
668
675
  setSelectedCryptoPaymentMethod(CryptoPaymentMethodType.NONE); // Reset payment method when going back
669
676
  } })) }) }));
670
- const mainView = (_jsxs("div", { className: "mx-auto flex w-[460px] max-w-full flex-col items-center gap-2", children: [isBuyMode && (_jsxs("div", { className: "mb-4 flex flex-col items-center gap-3 text-center", children: [selectedDstToken.metadata?.logoURI && (_jsx("div", { className: "relative", children: _jsx("img", { src: selectedDstToken.metadata.logoURI, alt: selectedDstToken.symbol, className: "border-as-stroke h-12 w-12 rounded-full border-2 shadow-md" }) })), _jsx("div", { children: _jsxs("h1", { className: "text-as-primary text-xl font-bold", children: ["Buy ", selectedDstToken.symbol] }) })] })), _jsx(TabSection, { activeTab: activeTab, setActiveTab: setActiveTab, setSelectedCryptoPaymentMethod: setSelectedCryptoPaymentMethod, setSelectedFiatPaymentMethod: setSelectedFiatPaymentMethod }), _jsxs("div", { className: "relative flex w-full max-w-[calc(100vw-32px)] flex-col gap-2", children: [activeTab === "crypto" ? (_jsx(CryptoPaySection, { selectedSrcChainId: selectedSrcChainId, setSelectedSrcChainId: setSelectedSrcChainId, selectedSrcToken: selectedSrcToken, setSelectedSrcToken: setSelectedSrcToken, srcAmount: srcAmount, setSrcAmount: setSrcAmount, setIsSrcInputDirty: setIsSrcInputDirty, selectedCryptoPaymentMethod: selectedCryptoPaymentMethod, onSelectCryptoPaymentMethod: () => setActivePanel(PanelView.CRYPTO_PAYMENT_METHOD), anyspendQuote: anyspendQuote, onTokenSelect: onTokenSelect })) : (_jsx(motion.div, { initial: { opacity: 0, y: 20, filter: "blur(10px)" }, animate: { opacity: 1, y: 0, filter: "blur(0px)" }, transition: { duration: 0.3, delay: 0, ease: "easeInOut" }, children: _jsx(PanelOnramp, { srcAmountOnRamp: srcAmountOnRamp, setSrcAmountOnRamp: setSrcAmountOnRamp, selectedPaymentMethod: selectedFiatPaymentMethod, setActivePanel: setActivePanel, _recipientAddress: recipientAddress, destinationToken: selectedDstToken, destinationChainId: selectedDstChainId, destinationAmount: dstAmount, onDestinationTokenChange: setSelectedDstToken, onDestinationChainChange: setSelectedDstChainId, fiatPaymentMethodIndex: PanelView.FIAT_PAYMENT_METHOD, recipientSelectionPanelIndex: PanelView.RECIPIENT_SELECTION, hideDstToken: isBuyMode, anyspendQuote: anyspendQuote, onShowPointsDetail: () => setActivePanel(PanelView.POINTS_DETAIL) }) })), _jsx(Button, { variant: "ghost", className: cn("border-as-stroke bg-as-surface-primary absolute left-1/2 top-1/2 z-10 h-10 w-10 -translate-x-1/2 -translate-y-1/2 rounded-xl border-2 sm:h-8 sm:w-8 sm:rounded-xl", isBuyMode && "top-[calc(50%+56px)] cursor-default", activeTab === "fiat" && "hidden"), onClick: () => {
677
+ const mainView = (_jsxs("div", { className: "mx-auto flex w-[460px] max-w-full flex-col items-center gap-2", children: [isBuyMode && (_jsxs("div", { className: "mb-4 flex flex-col items-center gap-3 text-center", children: [selectedDstToken.metadata?.logoURI && (_jsx("div", { className: "relative", children: _jsx("img", { src: selectedDstToken.metadata.logoURI, alt: selectedDstToken.symbol, className: "border-as-stroke h-12 w-12 rounded-full border-2 shadow-md" }) })), _jsx("div", { children: _jsxs("h1", { className: "text-as-primary text-xl font-bold", children: ["Buy ", selectedDstToken.symbol] }) })] })), _jsx(TabSection, { activeTab: activeTab, setActiveTab: setActiveTab, setSelectedCryptoPaymentMethod: setSelectedCryptoPaymentMethod, setSelectedFiatPaymentMethod: setSelectedFiatPaymentMethod }), _jsxs("div", { className: "relative flex w-full max-w-[calc(100vw-32px)] flex-col gap-2", children: [activeTab === "crypto" ? (_jsx(CryptoPaySection, { selectedSrcChainId: selectedSrcChainId, setSelectedSrcChainId: setSelectedSrcChainId, selectedSrcToken: selectedSrcToken, setSelectedSrcToken: setSelectedSrcToken, srcAmount: srcAmount, setSrcAmount: setSrcAmount, setIsSrcInputDirty: setIsSrcInputDirty, selectedCryptoPaymentMethod: selectedCryptoPaymentMethod, onSelectCryptoPaymentMethod: () => setActivePanel(PanelView.CRYPTO_PAYMENT_METHOD), anyspendQuote: anyspendQuote, onTokenSelect: onTokenSelect })) : (_jsx(motion.div, { initial: { opacity: 0, y: 20, filter: "blur(10px)" }, animate: { opacity: 1, y: 0, filter: "blur(0px)" }, transition: { duration: 0.3, delay: 0, ease: "easeInOut" }, children: _jsx(PanelOnramp, { srcAmountOnRamp: srcAmountOnRamp, setSrcAmountOnRamp: setSrcAmountOnRamp, selectedPaymentMethod: selectedFiatPaymentMethod, setActivePanel: setActivePanel, _recipientAddress: recipientAddress, destinationToken: selectedDstToken, destinationChainId: selectedDstChainId, destinationAmount: dstAmount, onDestinationTokenChange: setSelectedDstToken, onDestinationChainChange: setSelectedDstChainId, fiatPaymentMethodIndex: PanelView.FIAT_PAYMENT_METHOD, recipientSelectionPanelIndex: PanelView.RECIPIENT_SELECTION, hideDstToken: isBuyMode, anyspendQuote: anyspendQuote, onShowPointsDetail: () => setActivePanel(PanelView.POINTS_DETAIL), customUsdInputValues: customUsdInputValues }) })), _jsx(Button, { variant: "ghost", className: cn("border-as-stroke bg-as-surface-primary absolute left-1/2 top-1/2 z-10 h-10 w-10 -translate-x-1/2 -translate-y-1/2 rounded-xl border-2 sm:h-8 sm:w-8 sm:rounded-xl", isBuyMode && "top-[calc(50%+56px)] cursor-default", activeTab === "fiat" && "hidden"), onClick: () => {
671
678
  if (activeTab === "fiat" || isBuyMode) {
672
679
  return;
673
680
  }
@@ -10,7 +10,7 @@ import { simpleHashChainToChainName } from "../../../shared/utils/simplehash.js"
10
10
  import invariant from "invariant";
11
11
  import { ChevronRight, ChevronRightCircle, Loader2 } from "lucide-react";
12
12
  import { motion } from "motion/react";
13
- import { useCallback, useEffect, useMemo, useState } from "react";
13
+ import React, { useCallback, useEffect, useMemo, useState } from "react";
14
14
  import { toast } from "sonner";
15
15
  import { base } from "viem/chains";
16
16
  import { useFeatureFlags } from "../contexts/FeatureFlagsContext.js";
@@ -117,6 +117,8 @@ function AnySpendCustomInner({ loadOrder, mode = "modal", activeTab: activeTabPr
117
117
  // Update recipient logic to use custom recipient
118
118
  const recipientAddress = customRecipientAddress || currentWallet.address;
119
119
  const [orderId, setOrderId] = useState(loadOrder);
120
+ // Track if onSuccess has been called for the current order
121
+ const onSuccessCalled = React.useRef(false);
120
122
  const [srcChainId, setSrcChainId] = useState(base.id);
121
123
  // Get token list for token balance check
122
124
  const chainName = useMemo(() => simpleHashChainToChainName(srcChainId), [srcChainId]);
@@ -230,12 +232,17 @@ function AnySpendCustomInner({ loadOrder, mode = "modal", activeTab: activeTabPr
230
232
  // Get geo data and onramp options (after quote is available)
231
233
  const { geoData, isOnrampSupported, coinbaseAvailablePaymentMethods, stripeWeb2Support } = useGeoOnrampOptions(srcFiatAmount);
232
234
  useEffect(() => {
233
- if (oat?.data?.order.status === "executed") {
235
+ if (oat?.data?.order.status === "executed" && !onSuccessCalled.current) {
234
236
  console.log("Calling onSuccess");
235
237
  const txHash = oat?.data?.executeTx?.txHash;
236
238
  onSuccess?.(txHash);
239
+ onSuccessCalled.current = true;
237
240
  }
238
- }, [oat?.data?.executeTx?.txHash, oat?.data?.order.status, onSuccess]);
241
+ }, [oat?.data?.order.status, oat?.data?.executeTx?.txHash, onSuccess]);
242
+ // Reset flag when orderId changes
243
+ useEffect(() => {
244
+ onSuccessCalled.current = false;
245
+ }, [orderId]);
239
246
  const { createOrder: createRegularOrder, isCreatingOrder: isCreatingRegularOrder } = useAnyspendCreateOrder({
240
247
  onSuccess: data => {
241
248
  setOrderId(data.data.id);
@@ -19,5 +19,6 @@ export interface AnySpendDepositHypeProps {
19
19
  onTokenSelect?: (token: components["schemas"]["Token"], event: {
20
20
  preventDefault: () => void;
21
21
  }) => void;
22
+ customUsdInputValues?: string[];
22
23
  }
23
24
  export declare function AnySpendDepositHype(props: AnySpendDepositHypeProps): import("react/jsx-runtime").JSX.Element;
@@ -28,7 +28,7 @@ export function AnySpendDepositHype(props) {
28
28
  const fingerprintConfig = getFingerprintConfig();
29
29
  return (_jsx(AnySpendFingerprintWrapper, { fingerprint: fingerprintConfig, children: _jsx(AnySpendDepositHypeInner, { ...props }) }));
30
30
  }
31
- function AnySpendDepositHypeInner({ loadOrder, mode = "modal", recipientAddress, paymentType = "crypto", sourceTokenAddress, sourceTokenChainId, onSuccess, mainFooter, onTokenSelect, }) {
31
+ function AnySpendDepositHypeInner({ loadOrder, mode = "modal", recipientAddress, paymentType = "crypto", sourceTokenAddress, sourceTokenChainId, onSuccess, mainFooter, onTokenSelect, customUsdInputValues, }) {
32
32
  // Use shared flow hook
33
33
  const { activePanel, setActivePanel, orderId, setOrderId, oat, selectedSrcChainId, setSelectedSrcChainId, selectedSrcToken, setSelectedSrcToken, srcAmount, setSrcAmount, dstAmount, setIsSrcInputDirty, selectedCryptoPaymentMethod, setSelectedCryptoPaymentMethod, selectedFiatPaymentMethod, setSelectedFiatPaymentMethod, selectedRecipientAddress, setSelectedRecipientAddress, recipientName, globalAddress, anyspendQuote, isLoadingAnyspendQuote, getAnyspendQuoteError, activeInputAmountInWei, geoData, coinbaseAvailablePaymentMethods, stripeWeb2Support, createOrder, isCreatingOrder, createOnrampOrder, isCreatingOnrampOrder, } = useAnyspendFlow({
34
34
  paymentType,
@@ -112,7 +112,7 @@ function AnySpendDepositHypeInner({ loadOrder, mode = "modal", recipientAddress,
112
112
  await handleFiatOrder();
113
113
  }
114
114
  };
115
- const mainView = (_jsxs("div", { className: "mx-auto flex w-[460px] max-w-full flex-col items-center gap-2", children: [_jsx("div", { className: "mb-4 flex flex-col items-center gap-3 text-center", children: _jsx("div", { children: _jsx("h1", { className: "text-as-primary text-xl font-bold", children: paymentType === "crypto" ? "Deposit Crypto" : "Fund with Fiat" }) }) }), _jsx("div", { className: "relative flex w-full max-w-[calc(100vw-32px)] flex-col gap-2", children: _jsxs("div", { className: "relative flex w-full max-w-[calc(100vw-32px)] flex-col gap-2", children: [paymentType === "crypto" ? (_jsx(CryptoPaySection, { selectedSrcChainId: selectedSrcChainId, setSelectedSrcChainId: setSelectedSrcChainId, selectedSrcToken: selectedSrcToken, setSelectedSrcToken: setSelectedSrcToken, srcAmount: srcAmount, setSrcAmount: setSrcAmount, setIsSrcInputDirty: setIsSrcInputDirty, selectedCryptoPaymentMethod: selectedCryptoPaymentMethod, onSelectCryptoPaymentMethod: () => setActivePanel(PanelView.CRYPTO_PAYMENT_METHOD), anyspendQuote: anyspendQuote, onTokenSelect: onTokenSelect })) : (_jsx(motion.div, { initial: { opacity: 0, y: 20, filter: "blur(10px)" }, animate: { opacity: 1, y: 0, filter: "blur(0px)" }, transition: { duration: 0.3, delay: 0, ease: "easeInOut" }, children: _jsx(PanelOnramp, { srcAmountOnRamp: srcAmount, setSrcAmountOnRamp: setSrcAmount, selectedPaymentMethod: selectedFiatPaymentMethod, setActivePanel: setActivePanel, _recipientAddress: recipientAddress, destinationToken: B3_TOKEN, destinationChainId: base.id, dstTokenSymbol: HYPE_TOKEN_DETAILS.SYMBOL, hideDstToken: true, destinationAmount: dstAmount, onDestinationTokenChange: () => { }, onDestinationChainChange: () => { }, fiatPaymentMethodIndex: PanelView.FIAT_PAYMENT_METHOD, recipientSelectionPanelIndex: PanelView.RECIPIENT_SELECTION, anyspendQuote: anyspendQuote, onShowPointsDetail: () => setActivePanel(PanelView.POINTS_DETAIL) }) })), _jsx("div", { className: cn("relative -my-1 flex h-0 items-center justify-center", paymentType === "fiat" && "hidden"), children: _jsx(Button, { variant: "ghost", className: cn("swap-direction-button border-as-stroke bg-as-surface-primary z-10 h-10 w-10 cursor-default rounded-xl border-2 sm:h-8 sm:w-8 sm:rounded-xl"), children: _jsx("div", { className: "relative flex items-center justify-center transition-opacity", children: _jsx(ArrowDown, { className: "text-as-primary/50 h-5 w-5" }) }) }) }), paymentType === "crypto" && (_jsx(CryptoReceiveSection, { isDepositMode: false, isBuyMode: true, selectedRecipientAddress: recipientAddress, recipientName: recipientName || undefined, onSelectRecipient: () => setActivePanel(PanelView.RECIPIENT_SELECTION), dstAmount: dstAmount, dstToken: B3_TOKEN, dstTokenSymbol: HYPE_TOKEN_DETAILS.SYMBOL, dstTokenLogoURI: HYPE_TOKEN_DETAILS.LOGO_URI, selectedDstChainId: base.id, setSelectedDstChainId: () => { }, setSelectedDstToken: () => { }, onChangeDstAmount: value => {
115
+ const mainView = (_jsxs("div", { className: "mx-auto flex w-[460px] max-w-full flex-col items-center gap-2", children: [_jsx("div", { className: "mb-4 flex flex-col items-center gap-3 text-center", children: _jsx("div", { children: _jsx("h1", { className: "text-as-primary text-xl font-bold", children: paymentType === "crypto" ? "Deposit Crypto" : "Fund with Fiat" }) }) }), _jsx("div", { className: "relative flex w-full max-w-[calc(100vw-32px)] flex-col gap-2", children: _jsxs("div", { className: "relative flex w-full max-w-[calc(100vw-32px)] flex-col gap-2", children: [paymentType === "crypto" ? (_jsx(CryptoPaySection, { selectedSrcChainId: selectedSrcChainId, setSelectedSrcChainId: setSelectedSrcChainId, selectedSrcToken: selectedSrcToken, setSelectedSrcToken: setSelectedSrcToken, srcAmount: srcAmount, setSrcAmount: setSrcAmount, setIsSrcInputDirty: setIsSrcInputDirty, selectedCryptoPaymentMethod: selectedCryptoPaymentMethod, onSelectCryptoPaymentMethod: () => setActivePanel(PanelView.CRYPTO_PAYMENT_METHOD), anyspendQuote: anyspendQuote, onTokenSelect: onTokenSelect })) : (_jsx(motion.div, { initial: { opacity: 0, y: 20, filter: "blur(10px)" }, animate: { opacity: 1, y: 0, filter: "blur(0px)" }, transition: { duration: 0.3, delay: 0, ease: "easeInOut" }, children: _jsx(PanelOnramp, { srcAmountOnRamp: srcAmount, setSrcAmountOnRamp: setSrcAmount, selectedPaymentMethod: selectedFiatPaymentMethod, setActivePanel: setActivePanel, _recipientAddress: recipientAddress, destinationToken: B3_TOKEN, destinationChainId: base.id, dstTokenSymbol: HYPE_TOKEN_DETAILS.SYMBOL, hideDstToken: true, destinationAmount: dstAmount, onDestinationTokenChange: () => { }, onDestinationChainChange: () => { }, fiatPaymentMethodIndex: PanelView.FIAT_PAYMENT_METHOD, recipientSelectionPanelIndex: PanelView.RECIPIENT_SELECTION, anyspendQuote: anyspendQuote, onShowPointsDetail: () => setActivePanel(PanelView.POINTS_DETAIL), customUsdInputValues: customUsdInputValues }) })), _jsx("div", { className: cn("relative -my-1 flex h-0 items-center justify-center", paymentType === "fiat" && "hidden"), children: _jsx(Button, { variant: "ghost", className: cn("swap-direction-button border-as-stroke bg-as-surface-primary z-10 h-10 w-10 cursor-default rounded-xl border-2 sm:h-8 sm:w-8 sm:rounded-xl"), children: _jsx("div", { className: "relative flex items-center justify-center transition-opacity", children: _jsx(ArrowDown, { className: "text-as-primary/50 h-5 w-5" }) }) }) }), paymentType === "crypto" && (_jsx(CryptoReceiveSection, { isDepositMode: false, isBuyMode: true, selectedRecipientAddress: recipientAddress, recipientName: recipientName || undefined, onSelectRecipient: () => setActivePanel(PanelView.RECIPIENT_SELECTION), dstAmount: dstAmount, dstToken: B3_TOKEN, dstTokenSymbol: HYPE_TOKEN_DETAILS.SYMBOL, dstTokenLogoURI: HYPE_TOKEN_DETAILS.LOGO_URI, selectedDstChainId: base.id, setSelectedDstChainId: () => { }, setSelectedDstToken: () => { }, onChangeDstAmount: value => {
116
116
  setIsSrcInputDirty(false);
117
117
  setSrcAmount(value);
118
118
  }, anyspendQuote: anyspendQuote, onShowPointsDetail: () => setActivePanel(PanelView.POINTS_DETAIL) }))] }) }), _jsx(ErrorSection, { error: getAnyspendQuoteError }), _jsx(motion.div, { initial: { opacity: 0, y: 20, filter: "blur(10px)" }, animate: { opacity: 1, y: 0, filter: "blur(0px)" }, transition: { duration: 0.3, delay: 0.2, ease: "easeInOut" }, className: cn("mt-4 flex w-full max-w-[460px] flex-col gap-2", getAnyspendQuoteError && "mt-0"), children: _jsx(ShinyButton, { accentColor: "hsl(var(--as-brand))", disabled: btnInfo.disable, onClick: onMainButtonClick, className: cn("as-main-button relative w-full", btnInfo.error ? "!bg-as-red" : btnInfo.disable ? "!bg-as-on-surface-2" : "!bg-as-brand"), textClassName: cn(btnInfo.error ? "text-white" : btnInfo.disable ? "text-as-secondary" : "text-white"), children: btnInfo.text }) }), mainFooter ? mainFooter : null] }));
@@ -1,7 +1,7 @@
1
1
  import { components } from "../../../../anyspend/types/api";
2
2
  import { GetQuoteResponse } from "../../../../anyspend/types/api_req_res";
3
3
  import { FiatPaymentMethod } from "./FiatPaymentMethod";
4
- export declare function PanelOnramp({ srcAmountOnRamp, setSrcAmountOnRamp, selectedPaymentMethod, setActivePanel, _recipientAddress, destinationToken, destinationChainId, destinationAmount, onDestinationTokenChange, onDestinationChainChange, fiatPaymentMethodIndex, recipientSelectionPanelIndex, dstTokenSymbol, hideDstToken, anyspendQuote, onShowPointsDetail, }: {
4
+ export declare function PanelOnramp({ srcAmountOnRamp, setSrcAmountOnRamp, selectedPaymentMethod, setActivePanel, _recipientAddress, destinationToken, destinationChainId, destinationAmount, onDestinationTokenChange, onDestinationChainChange, fiatPaymentMethodIndex, recipientSelectionPanelIndex, dstTokenSymbol, hideDstToken, anyspendQuote, onShowPointsDetail, customUsdInputValues, }: {
5
5
  srcAmountOnRamp: string;
6
6
  setSrcAmountOnRamp: (amount: string) => void;
7
7
  selectedPaymentMethod?: FiatPaymentMethod;
@@ -18,4 +18,5 @@ export declare function PanelOnramp({ srcAmountOnRamp, setSrcAmountOnRamp, selec
18
18
  hideDstToken?: boolean;
19
19
  anyspendQuote?: GetQuoteResponse;
20
20
  onShowPointsDetail?: () => void;
21
+ customUsdInputValues?: string[];
21
22
  }): import("react/jsx-runtime").JSX.Element;
@@ -11,7 +11,7 @@ import { useFeatureFlags } from "../../contexts/FeatureFlagsContext.js";
11
11
  import { FiatPaymentMethod } from "./FiatPaymentMethod.js";
12
12
  import { OrderTokenAmountFiat } from "./OrderTokenAmountFiat.js";
13
13
  import { PointsBadge } from "./PointsBadge.js";
14
- export function PanelOnramp({ srcAmountOnRamp, setSrcAmountOnRamp, selectedPaymentMethod, setActivePanel, _recipientAddress, destinationToken, destinationChainId, destinationAmount, onDestinationTokenChange, onDestinationChainChange, fiatPaymentMethodIndex, recipientSelectionPanelIndex, dstTokenSymbol, hideDstToken = false, anyspendQuote, onShowPointsDetail, }) {
14
+ export function PanelOnramp({ srcAmountOnRamp, setSrcAmountOnRamp, selectedPaymentMethod, setActivePanel, _recipientAddress, destinationToken, destinationChainId, destinationAmount, onDestinationTokenChange, onDestinationChainChange, fiatPaymentMethodIndex, recipientSelectionPanelIndex, dstTokenSymbol, hideDstToken = false, anyspendQuote, onShowPointsDetail, customUsdInputValues = ["5", "10", "20", "25"], }) {
15
15
  const featureFlags = useFeatureFlags();
16
16
  // Get geo-based onramp options to access fee information
17
17
  const { stripeWeb2Support } = useGeoOnrampOptions(srcAmountOnRamp);
@@ -69,9 +69,11 @@ export function PanelOnramp({ srcAmountOnRamp, setSrcAmountOnRamp, selectedPayme
69
69
  const handleQuickAmount = (value) => {
70
70
  setSrcAmountOnRamp(value);
71
71
  };
72
- return (_jsxs("div", { className: "panel-onramp bg-as-surface-primary flex w-full flex-col", children: [_jsxs("div", { className: "border-as-border-secondary bg-as-surface-secondary relative flex w-full flex-col rounded-2xl border p-4", children: [_jsxs("div", { className: "flex h-7 w-full items-center justify-between", children: [_jsx("span", { className: "text-as-tertiarry flex items-center text-sm font-bold", children: "Pay" }), _jsx("button", { className: "text-as-tertiarry flex h-7 items-center gap-1 text-sm", onClick: () => setActivePanel(fiatPaymentMethodIndex), children: selectedPaymentMethod === FiatPaymentMethod.COINBASE_PAY ? (_jsxs(_Fragment, { children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx("div", { className: "flex h-5 w-5 items-center justify-center rounded-full bg-blue-600", children: _jsx("span", { className: "text-xs font-bold text-white", children: "C" }) }), "Coinbase Pay"] }), _jsx(ChevronRight, { className: "h-4 w-4" })] })) : selectedPaymentMethod === FiatPaymentMethod.STRIPE ? (_jsxs(_Fragment, { children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx("div", { className: "flex h-5 w-5 items-center justify-center rounded-full bg-blue-600", children: _jsx("span", { className: "text-xs font-bold text-white", children: "S" }) }), "Stripe"] }), _jsx(ChevronRight, { className: "h-4 w-4" })] })) : (_jsxs(_Fragment, { children: ["Select payment method", _jsx(ChevronRight, { className: "h-4 w-4" })] })) })] }), _jsx("div", { className: "flex items-center justify-center pb-2 pt-8", children: _jsxs("div", { className: "flex gap-1", children: [_jsx("span", { className: "text-as-tertiarry text-2xl font-bold", children: "$" }), _jsx(Input, { ref: amountInputRef, type: "text", value: srcAmountOnRamp, onChange: handleAmountChange, placeholder: "5", className: "text-as-primary placeholder:text-as-primary/50 h-auto min-w-[70px] border-0 bg-transparent p-0 px-3 pt-1 text-4xl font-bold focus-visible:ring-0 focus-visible:ring-offset-0", style: {
72
+ return (_jsxs("div", { className: "panel-onramp bg-as-surface-primary flex w-full flex-col", children: [_jsxs("div", { className: "border-as-border-secondary bg-as-surface-secondary relative flex w-full flex-col rounded-2xl border p-4", children: [_jsxs("div", { className: "flex h-7 w-full items-center justify-between", children: [_jsx("span", { className: "text-as-tertiarry flex items-center text-sm font-bold", children: "Pay" }), _jsx("button", { className: "text-as-tertiarry flex h-7 items-center gap-1 text-sm", onClick: () => setActivePanel(fiatPaymentMethodIndex), children: selectedPaymentMethod === FiatPaymentMethod.COINBASE_PAY ? (_jsxs(_Fragment, { children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx("div", { className: "flex h-5 w-5 items-center justify-center rounded-full bg-blue-600", children: _jsx("span", { className: "text-xs font-bold text-white", children: "C" }) }), "Coinbase Pay"] }), _jsx(ChevronRight, { className: "h-4 w-4" })] })) : selectedPaymentMethod === FiatPaymentMethod.STRIPE ? (_jsxs(_Fragment, { children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx("div", { className: "flex h-5 w-5 items-center justify-center rounded-full bg-blue-600", children: _jsx("span", { className: "text-xs font-bold text-white", children: "S" }) }), "Stripe"] }), _jsx(ChevronRight, { className: "h-4 w-4" })] })) : (_jsxs(_Fragment, { children: ["Select payment method", _jsx(ChevronRight, { className: "h-4 w-4" })] })) })] }), _jsx("div", { className: "flex items-center justify-center pb-2 pt-8", children: _jsxs("div", { className: "flex gap-1", children: [_jsx("span", { className: "text-as-tertiarry text-2xl font-bold", children: "$" }), _jsx(Input, { ref: amountInputRef, type: "text", value: srcAmountOnRamp, onChange: handleAmountChange, placeholder: "5", className: "text-as-primary placeholder:text-as-primary/50 h-auto min-w-[70px] border-0 bg-transparent p-0 px-1 pt-1 text-4xl font-bold focus-visible:ring-0 focus-visible:ring-offset-0", style: {
73
73
  width: `${Math.max(50, srcAmountOnRamp.length * 34)}px`,
74
- } })] }) }), _jsx("div", { className: cn("mx-auto mb-6 inline-grid grid-cols-4 gap-2", hideDstToken && "mb-0"), children: ["5", "10", "20", "25"].map(value => (_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
74
+ } })] }) }), _jsx("div", { className: cn("mx-auto mb-6 flex justify-center gap-2", hideDstToken && "mb-0"), children: customUsdInputValues
75
+ .filter(v => !isNaN(Number(v)))
76
+ .map(value => (_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
77
  ? "border-as-border-secondary bg-as-surface-secondary"
76
78
  : "bg-as-surface-secondary hover:bg-as-surface-secondary"}`, children: ["$", value] }, value))) }), destinationToken && destinationChainId && !hideDstToken && (_jsx(OrderTokenAmountFiat, { address: _recipientAddress, context: "to", inputValue: destinationAmount || "0", onChangeInput: () => { }, chainId: destinationChainId, setChainId: onDestinationChainChange || (() => { }), token: destinationToken, setToken: onDestinationTokenChange || (() => { }) }))] }), _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: [_jsxs("div", { className: "flex w-full items-center justify-between gap-2", children: [_jsx("span", { className: "text-as-tertiarry flex items-center text-sm", children: "Recipient" }), _recipientAddress ? (_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: [_jsx("span", { className: "text-sm", children: recipientName ? formatUsername(recipientName) : formatAddress(_recipientAddress) }), _jsx(ChevronRight, { size: 16 })] })) : (_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: [_jsx(Wallet, { className: "text-as-brand", size: 16 }), "Select recipient", _jsx(ChevronRight, { size: 16 })] }))] }), _jsx("div", { className: "divider w-full" }), _jsxs("div", { className: "flex items-center justify-between", children: [_jsx("span", { className: "text-as-tertiarry text-sm", children: "Expected to receive" }), _jsxs("div", { className: "flex items-center gap-2", children: [_jsxs("span", { className: "text-as-primary font-semibold", children: [destinationAmount || "0", " ", dstTokenSymbol || destinationToken?.symbol || ""] }), _jsxs("span", { className: "text-as-tertiarry text-sm", children: ["on ", destinationChainId ? ALL_CHAINS[destinationChainId]?.name : ""] }), destinationToken && destinationChainId && destinationToken.metadata?.logoURI && (_jsx("img", { src: ALL_CHAINS[destinationChainId]?.logoUrl, alt: "Chain", className: "h-4 w-4 rounded-full" }))] })] }), _jsx("div", { className: "divider w-full" }), _jsx("div", { className: "", children: _jsxs("div", { className: "flex items-center justify-between", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx("span", { className: "text-as-tertiarry text-sm", children: (() => {
77
79
  const fee = getFeeFromApi(selectedPaymentMethod || FiatPaymentMethod.NONE);
@@ -39,7 +39,7 @@ export function SignIn(props) {
39
39
  // TODO: Figure out why setting anchor on mobile causes z-index issues where it appears under elements
40
40
  anchor: isMobile ? "top end" : undefined, children: _jsxs("div", { className: "bg-b3-react-background", children: [connectedEOAWallet ? (_jsxs("div", { className: cn("border-b3-react-subtle bg-b3-react-background flex cursor-pointer items-center justify-between rounded-xl p-3"), onClick: () => handleSetActiveAccount(connectedEOAWallet?.id), children: [_jsxs("div", { className: "flex items-center", children: [_jsx("img", { className: "bg-b3-react-primary h-16 w-16 rounded-full opacity-100", src: eoaWalletIcon, alt: connectedEOAWallet?.id }), _jsxs("div", { className: "ml-4 grow", children: [ensName && _jsx("div", { children: ensName }), _jsx("div", { children: truncateAddress(globalAddress) }), _jsx("div", { children: walletInfo?.name })] })] }), isActiveEOAWallet && _jsx(Icon, { className: "fill-b3-react-primary", name: "check" })] })) : (connectedSmartWallet && (_jsxs("div", { className: cn("mb-2 flex cursor-pointer items-center justify-between rounded-xl p-3", isActiveSmartWallet
41
41
  ? "bg-b3-react-background"
42
- : "bg-b3-react-background hover:bg-b3-react-background"), onClick: () => handleSetActiveAccount(connectedSmartWallet?.id), children: [_jsxs("div", { className: "flex items-center", children: [_jsx("img", { className: "bg-b3-react-primary h-16 w-16 rounded-full opacity-100", src: smartWalletIcon, alt: connectedSmartWallet?.id }), _jsxs("div", { className: "grow pl-4", children: [ensName && _jsx("div", { children: ensName }), _jsx("div", { children: truncateAddress(globalAddress) }), _jsx("div", { children: "Smart wallet" })] })] }), isActiveSmartWallet && _jsx(Icon, { className: "fill-b3-react-primary", name: "check" })] }))), _jsx("div", { className: "ml-3", children: _jsx(ManageAccountButton, { ...props, className: "w-[calc(100%-12px)]" }) }), _jsx("button", { className: "mb-2 w-full space-y-1", onClick: onDisconnect, children: _jsxs("div", { className: "hover:bg-b3-react-background group flex h-12 items-center rounded-xl px-4 transition-colors", children: [_jsx(Icon, { className: "fill-b3-react-background group-hover:fill-b3-react-primary mr-4 shrink-0 transition-colors", name: "logout" }), _jsx("div", { className: "text-b3-react-background group-hover:text-b3-react-primary mr-auto transition-colors", children: "Disconnect" })] }) })] }) }) })] })) : (_jsx(SignInWithB3, { closeAfterLogin: true, onLoginSuccess: async (globalAccount) => {
42
+ : "bg-b3-react-background hover:bg-b3-react-background"), onClick: () => handleSetActiveAccount(connectedSmartWallet?.id), children: [_jsxs("div", { className: "flex items-center", children: [_jsx("img", { className: "bg-b3-react-primary h-16 w-16 rounded-full opacity-100", src: smartWalletIcon, alt: connectedSmartWallet?.id }), _jsxs("div", { className: "grow pl-4", children: [ensName && _jsx("div", { children: ensName }), _jsx("div", { children: truncateAddress(globalAddress) }), _jsx("div", { children: "Smart wallet" })] })] }), isActiveSmartWallet && _jsx(Icon, { className: "fill-b3-react-primary", name: "check" })] }))), _jsx("div", { className: "ml-3", children: _jsx(ManageAccountButton, { ...props, className: "w-[calc(100%-12px)]" }) }), _jsx("button", { className: "mb-2 w-full space-y-1", onClick: onDisconnect, children: _jsxs("div", { className: "hover:bg-b3-react-background group flex h-12 items-center rounded-xl px-4 transition-colors", children: [_jsx(Icon, { className: "fill-b3-react-primary mr-4 shrink-0 transition-colors", name: "logout" }), _jsx("div", { className: "text-b3-react-primary mr-auto transition-colors", children: "Disconnect" })] }) })] }) }) })] })) : (_jsx(SignInWithB3, { closeAfterLogin: true, onLoginSuccess: async (globalAccount) => {
43
43
  console.log("User authenticated with Global Account!", globalAccount);
44
44
  }, ...props })) }) }));
45
45
  }
@@ -4,12 +4,12 @@ export { RelayKitProviderWrapper } from "./B3Provider/RelayKitProviderWrapper";
4
4
  export { B3Context, type B3ContextType } from "./B3Provider/types";
5
5
  export { useB3 } from "./B3Provider/useB3";
6
6
  export { StyleRoot } from "./StyleRoot";
7
- export { SignInWithB3 } from "./SignInWithB3/SignInWithB3";
8
- export { SignInWithB3Flow } from "./SignInWithB3/SignInWithB3Flow";
9
- export { SignInWithB3Privy } from "./SignInWithB3/SignInWithB3Privy";
10
7
  export { AuthButton } from "./SignInWithB3/components/AuthButton";
11
8
  export { PermissionItem } from "./SignInWithB3/components/PermissionItem";
12
9
  export { WalletRow } from "./SignInWithB3/components/WalletRow";
10
+ export { SignInWithB3 } from "./SignInWithB3/SignInWithB3";
11
+ export { SignInWithB3Flow } from "./SignInWithB3/SignInWithB3Flow";
12
+ export { SignInWithB3Privy } from "./SignInWithB3/SignInWithB3Privy";
13
13
  export { LoginStepContainer } from "./SignInWithB3/steps/LoginStep";
14
14
  export { getConnectOptionsFromStrategy, isWalletType, type AllowedStrategy } from "./SignInWithB3/utils/signInUtils";
15
15
  export { ManageAccount } from "./ManageAccount/ManageAccount";
@@ -24,21 +24,22 @@ export { ClientOnly } from "./custom/ClientOnly";
24
24
  export { CopyToClipboard } from "./custom/CopyToClipboard";
25
25
  export { StaggeredFadeLoader } from "./custom/StaggeredFadeLoader";
26
26
  export { WalletConnectorIcon } from "./custom/WalletConnectorIcon";
27
- export { Loading } from "./ui/Loading";
28
- export { ShinyButton } from "./ui/ShinyButton";
29
- export { TabTrigger, Tabs, TabsContent, TabsList, TabsTransitionWrapper } from "./ui/TabSystem";
30
- export { TabTrigger as TabTriggerPrimitive, TabsContent as TabsContentPrimitive, TabsList as TabsListPrimitive, Tabs as TabsPrimitive, } from "./ui/Tabs";
31
27
  export { Badge, badgeVariants } from "./ui/badge";
32
28
  export { Button, buttonVariants } from "./ui/button";
33
29
  export { Command, CommandDialog, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandSeparator, CommandShortcut, } from "./ui/command";
34
30
  export { Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, } from "./ui/dialog";
35
31
  export { Drawer, DrawerClose, DrawerContent, DrawerDescription, DrawerFooter, DrawerHeader, DrawerOverlay, DrawerPortal, DrawerTitle, DrawerTrigger, } from "./ui/drawer";
32
+ export { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuSeparator, DropdownMenuTrigger, } from "./ui/dropdown-menu";
36
33
  export { GlareCard } from "./ui/glare-card";
37
34
  export { GlareCardRounded } from "./ui/glare-card-rounded";
38
35
  export { Input } from "./ui/input";
36
+ export { Loading } from "./ui/Loading";
39
37
  export { Popover, PopoverContent, PopoverTrigger } from "./ui/popover";
40
38
  export { ScrollArea, ScrollBar } from "./ui/scroll-area";
39
+ export { ShinyButton } from "./ui/ShinyButton";
41
40
  export { Skeleton } from "./ui/skeleton";
41
+ export { TabTrigger as TabTriggerPrimitive, TabsContent as TabsContentPrimitive, TabsList as TabsListPrimitive, Tabs as TabsPrimitive, } from "./ui/Tabs";
42
+ export { TabTrigger, Tabs, TabsContent, TabsList, TabsTransitionWrapper } from "./ui/TabSystem";
42
43
  export { TextLoop } from "./ui/text-loop";
43
44
  export { TextShimmer } from "./ui/text-shimmer";
44
45
  export { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "./ui/tooltip";
@@ -6,12 +6,12 @@ export { B3Context } from "./B3Provider/types.js";
6
6
  export { useB3 } from "./B3Provider/useB3.js";
7
7
  export { StyleRoot } from "./StyleRoot.js";
8
8
  // SignInWithB3 Components
9
- export { SignInWithB3 } from "./SignInWithB3/SignInWithB3.js";
10
- export { SignInWithB3Flow } from "./SignInWithB3/SignInWithB3Flow.js";
11
- export { SignInWithB3Privy } from "./SignInWithB3/SignInWithB3Privy.js";
12
9
  export { AuthButton } from "./SignInWithB3/components/AuthButton.js";
13
10
  export { PermissionItem } from "./SignInWithB3/components/PermissionItem.js";
14
11
  export { WalletRow } from "./SignInWithB3/components/WalletRow.js";
12
+ export { SignInWithB3 } from "./SignInWithB3/SignInWithB3.js";
13
+ export { SignInWithB3Flow } from "./SignInWithB3/SignInWithB3Flow.js";
14
+ export { SignInWithB3Privy } from "./SignInWithB3/SignInWithB3Privy.js";
15
15
  export { LoginStepContainer } from "./SignInWithB3/steps/LoginStep.js";
16
16
  export { getConnectOptionsFromStrategy, isWalletType } from "./SignInWithB3/utils/signInUtils.js";
17
17
  // ManageAccount Components
@@ -34,21 +34,22 @@ export { CopyToClipboard } from "./custom/CopyToClipboard.js";
34
34
  export { StaggeredFadeLoader } from "./custom/StaggeredFadeLoader.js";
35
35
  export { WalletConnectorIcon } from "./custom/WalletConnectorIcon.js";
36
36
  // UI Components
37
- export { Loading } from "./ui/Loading.js";
38
- export { ShinyButton } from "./ui/ShinyButton.js";
39
- export { TabTrigger, Tabs, TabsContent, TabsList, TabsTransitionWrapper } from "./ui/TabSystem.js";
40
- export { TabTrigger as TabTriggerPrimitive, TabsContent as TabsContentPrimitive, TabsList as TabsListPrimitive, Tabs as TabsPrimitive, } from "./ui/Tabs.js";
41
37
  export { Badge, badgeVariants } from "./ui/badge.js";
42
38
  export { Button, buttonVariants } from "./ui/button.js";
43
39
  export { Command, CommandDialog, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandSeparator, CommandShortcut, } from "./ui/command.js";
44
40
  export { Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, } from "./ui/dialog.js";
45
41
  export { Drawer, DrawerClose, DrawerContent, DrawerDescription, DrawerFooter, DrawerHeader, DrawerOverlay, DrawerPortal, DrawerTitle, DrawerTrigger, } from "./ui/drawer.js";
42
+ export { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuSeparator, DropdownMenuTrigger, } from "./ui/dropdown-menu.js";
46
43
  export { GlareCard } from "./ui/glare-card.js";
47
44
  export { GlareCardRounded } from "./ui/glare-card-rounded.js";
48
45
  export { Input } from "./ui/input.js";
46
+ export { Loading } from "./ui/Loading.js";
49
47
  export { Popover, PopoverContent, PopoverTrigger } from "./ui/popover.js";
50
48
  export { ScrollArea, ScrollBar } from "./ui/scroll-area.js";
49
+ export { ShinyButton } from "./ui/ShinyButton.js";
51
50
  export { Skeleton } from "./ui/skeleton.js";
51
+ export { TabTrigger as TabTriggerPrimitive, TabsContent as TabsContentPrimitive, TabsList as TabsListPrimitive, Tabs as TabsPrimitive, } from "./ui/Tabs.js";
52
+ export { TabTrigger, Tabs, TabsContent, TabsList, TabsTransitionWrapper } from "./ui/TabSystem.js";
52
53
  export { TextLoop } from "./ui/text-loop.js";
53
54
  export { TextShimmer } from "./ui/text-shimmer.js";
54
55
  export { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "./ui/tooltip.js";
@@ -0,0 +1,27 @@
1
+ import * as React from "react";
2
+ interface DropdownMenuProps {
3
+ children: React.ReactNode;
4
+ }
5
+ interface DropdownMenuContentProps {
6
+ children: React.ReactNode;
7
+ align?: "start" | "center" | "end";
8
+ className?: string;
9
+ }
10
+ interface DropdownMenuItemProps {
11
+ children: React.ReactNode;
12
+ onClick?: () => void;
13
+ className?: string;
14
+ }
15
+ interface DropdownMenuSeparatorProps {
16
+ className?: string;
17
+ }
18
+ interface DropdownMenuTriggerProps {
19
+ children: React.ReactNode;
20
+ asChild?: boolean;
21
+ }
22
+ export declare function DropdownMenu({ children }: DropdownMenuProps): import("react/jsx-runtime").JSX.Element;
23
+ export declare function DropdownMenuTrigger({ children, asChild }: DropdownMenuTriggerProps): import("react/jsx-runtime").JSX.Element;
24
+ export declare function DropdownMenuContent({ children, align, className }: DropdownMenuContentProps): import("react/jsx-runtime").JSX.Element | null;
25
+ export declare function DropdownMenuItem({ children, onClick, className }: DropdownMenuItemProps): import("react/jsx-runtime").JSX.Element;
26
+ export declare function DropdownMenuSeparator({ className }: DropdownMenuSeparatorProps): import("react/jsx-runtime").JSX.Element;
27
+ export {};
@@ -0,0 +1,60 @@
1
+ "use client";
2
+ import { jsx as _jsx } from "react/jsx-runtime";
3
+ import { cn } from "../../../../shared/utils/index.js";
4
+ import * as React from "react";
5
+ const DropdownMenuContext = React.createContext({
6
+ isOpen: false,
7
+ setIsOpen: () => { },
8
+ });
9
+ export function DropdownMenu({ children }) {
10
+ const [isOpen, setIsOpen] = React.useState(false);
11
+ React.useEffect(() => {
12
+ const handleClickOutside = (event) => {
13
+ const target = event.target;
14
+ if (!target.closest("[data-dropdown-menu]")) {
15
+ setIsOpen(false);
16
+ }
17
+ };
18
+ if (isOpen) {
19
+ document.addEventListener("click", handleClickOutside);
20
+ return () => document.removeEventListener("click", handleClickOutside);
21
+ }
22
+ }, [isOpen]);
23
+ return (_jsx(DropdownMenuContext.Provider, { value: { isOpen, setIsOpen }, children: _jsx("div", { className: "relative", "data-dropdown-menu": true, children: children }) }));
24
+ }
25
+ export function DropdownMenuTrigger({ children, asChild }) {
26
+ const { isOpen, setIsOpen } = React.useContext(DropdownMenuContext);
27
+ const handleClick = () => {
28
+ setIsOpen(!isOpen);
29
+ };
30
+ if (asChild) {
31
+ if (React.isValidElement(children)) {
32
+ return React.cloneElement(children, {
33
+ onClick: handleClick,
34
+ });
35
+ }
36
+ }
37
+ return _jsx("button", { onClick: handleClick, children: children });
38
+ }
39
+ export function DropdownMenuContent({ children, align = "start", className }) {
40
+ const { isOpen } = React.useContext(DropdownMenuContext);
41
+ if (!isOpen)
42
+ return null;
43
+ const alignmentClasses = {
44
+ start: "left-0",
45
+ center: "left-1/2 -translate-x-1/2",
46
+ end: "right-0",
47
+ };
48
+ return (_jsx("div", { className: cn("bg-popover text-popover-foreground absolute top-full z-50 mt-1 min-w-32 overflow-hidden rounded-md border p-1 shadow-md", "border-gray-200 bg-white dark:border-gray-700 dark:bg-gray-800", alignmentClasses[align], className), children: children }));
49
+ }
50
+ export function DropdownMenuItem({ children, onClick, className }) {
51
+ const { setIsOpen } = React.useContext(DropdownMenuContext);
52
+ const handleClick = () => {
53
+ onClick?.();
54
+ setIsOpen(false);
55
+ };
56
+ return (_jsx("div", { className: cn("hover:bg-accent hover:text-accent-foreground relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none transition-colors data-[disabled]:pointer-events-none data-[disabled]:opacity-50", "hover:bg-gray-100 dark:hover:bg-gray-700", className), onClick: handleClick, children: children }));
57
+ }
58
+ export function DropdownMenuSeparator({ className }) {
59
+ return _jsx("div", { className: cn("bg-muted -mx-1 my-1 h-px", "bg-gray-200 dark:bg-gray-600", className) });
60
+ }
@@ -117,11 +117,13 @@ export interface AnySpendModalProps extends BaseModalProps {
117
117
  /** Whether to hide the transaction history button */
118
118
  hideTransactionHistoryButton?: boolean;
119
119
  /** Callback function called when the transaction is successful */
120
- onSuccess?: () => void;
120
+ onSuccess?: (txHash?: string) => void;
121
121
  /** Token address of the destination token to buy (enables buy mode) */
122
122
  destinationTokenAddress?: string;
123
123
  /** Chain ID where the destination token exists (enables buy mode) */
124
124
  destinationTokenChainId?: number;
125
+ /** Custom USD input values for quick amount buttons in fiat onramp */
126
+ customUsdInputValues?: string[];
125
127
  }
126
128
  /**
127
129
  * Props for the AnySpend NFT modal
@@ -290,6 +292,8 @@ export interface AnySpendDepositHypeProps extends BaseModalProps {
290
292
  mainFooter?: React.ReactNode;
291
293
  /** Callback function called when the deposit is successful */
292
294
  onSuccess?: (amount?: string) => void;
295
+ /** Custom USD input values for quick amount buttons in fiat onramp */
296
+ customUsdInputValues?: string[];
293
297
  }
294
298
  export interface AvatarEditorModalProps extends BaseModalProps {
295
299
  /** Modal type identifier */
@@ -0,0 +1 @@
1
+ export declare const B3_COIN_IMAGE_URL = "https://cdn.b3.fun/b3-coin-3d.png";
@@ -0,0 +1,2 @@
1
+ // B3 Token image URL
2
+ export const B3_COIN_IMAGE_URL = "https://cdn.b3.fun/b3-coin-3d.png";
@@ -1,3 +1,4 @@
1
+ export * from "./currency";
1
2
  export declare const siteURL = "https://basement.fun";
2
3
  export declare const b3CoinIcon = "https://cdn.b3.fun/b3-coin-3d.png";
3
4
  export declare const ecosystemWalletId: `ecosystem.${string}`;
@@ -1,3 +1,4 @@
1
+ export * from "./currency.js";
1
2
  export const siteURL = "https://basement.fun";
2
3
  export const b3CoinIcon = "https://cdn.b3.fun/b3-coin-3d.png";
3
4
  export const ecosystemWalletId = (process.env.NEXT_PUBLIC_THIRDWEB_ECOSYSTEM_ID ||
@@ -0,0 +1,7 @@
1
+ interface CurrencySelectorProps {
2
+ labelClassName?: string;
3
+ buttonVariant?: "dark" | "primary" | "ghost" | "gold";
4
+ label?: string;
5
+ }
6
+ export declare function CurrencySelector({ labelClassName, buttonVariant, label }: CurrencySelectorProps): import("react/jsx-runtime").JSX.Element;
7
+ export {};