@b3dotfun/sdk 0.0.79 → 0.0.80-alpha.1

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 (53) hide show
  1. package/dist/cjs/anyspend/react/components/AnySpend.js +23 -10
  2. package/dist/cjs/anyspend/react/components/AnySpendCollectorClubPurchase.js +9 -2
  3. package/dist/cjs/anyspend/react/components/AnySpendCustom.d.ts +2 -0
  4. package/dist/cjs/anyspend/react/components/AnySpendCustom.js +75 -19
  5. package/dist/cjs/anyspend/react/components/AnySpendNFT.js +6 -9
  6. package/dist/cjs/anyspend/react/components/common/CryptoReceiveSection.js +1 -3
  7. package/dist/cjs/anyspend/react/components/common/FiatPaymentMethod.d.ts +6 -1
  8. package/dist/cjs/anyspend/react/components/common/FiatPaymentMethod.js +40 -13
  9. package/dist/cjs/anyspend/react/components/common/PanelOnramp.js +13 -7
  10. package/dist/cjs/anyspend/react/components/common/PanelOnrampPayment.js +5 -3
  11. package/dist/cjs/anyspend/react/hooks/useGeoOnrampOptions.d.ts +2 -8
  12. package/dist/cjs/anyspend/react/hooks/useGeoOnrampOptions.js +4 -2
  13. package/dist/cjs/anyspend/react/hooks/useStripeSupport.d.ts +1 -0
  14. package/dist/cjs/anyspend/react/hooks/useStripeSupport.js +1 -0
  15. package/dist/cjs/global-account/react/components/IPFSMediaRenderer/IPFSMediaRenderer.js +5 -3
  16. package/dist/cjs/shared/utils/ipfs.d.ts +3 -3
  17. package/dist/cjs/shared/utils/ipfs.js +8 -8
  18. package/dist/esm/anyspend/react/components/AnySpend.js +23 -10
  19. package/dist/esm/anyspend/react/components/AnySpendCollectorClubPurchase.js +9 -2
  20. package/dist/esm/anyspend/react/components/AnySpendCustom.d.ts +2 -0
  21. package/dist/esm/anyspend/react/components/AnySpendCustom.js +76 -20
  22. package/dist/esm/anyspend/react/components/AnySpendNFT.js +7 -10
  23. package/dist/esm/anyspend/react/components/common/CryptoReceiveSection.js +1 -3
  24. package/dist/esm/anyspend/react/components/common/FiatPaymentMethod.d.ts +6 -1
  25. package/dist/esm/anyspend/react/components/common/FiatPaymentMethod.js +39 -12
  26. package/dist/esm/anyspend/react/components/common/PanelOnramp.js +14 -8
  27. package/dist/esm/anyspend/react/components/common/PanelOnrampPayment.js +5 -3
  28. package/dist/esm/anyspend/react/hooks/useGeoOnrampOptions.d.ts +2 -8
  29. package/dist/esm/anyspend/react/hooks/useGeoOnrampOptions.js +4 -2
  30. package/dist/esm/anyspend/react/hooks/useStripeSupport.d.ts +1 -0
  31. package/dist/esm/anyspend/react/hooks/useStripeSupport.js +1 -0
  32. package/dist/esm/global-account/react/components/IPFSMediaRenderer/IPFSMediaRenderer.js +5 -3
  33. package/dist/esm/shared/utils/ipfs.d.ts +3 -3
  34. package/dist/esm/shared/utils/ipfs.js +8 -8
  35. package/dist/styles/index.css +1 -1
  36. package/dist/types/anyspend/react/components/AnySpendCustom.d.ts +2 -0
  37. package/dist/types/anyspend/react/components/common/FiatPaymentMethod.d.ts +6 -1
  38. package/dist/types/anyspend/react/hooks/useGeoOnrampOptions.d.ts +2 -8
  39. package/dist/types/anyspend/react/hooks/useStripeSupport.d.ts +1 -0
  40. package/dist/types/shared/utils/ipfs.d.ts +3 -3
  41. package/package.json +1 -1
  42. package/src/anyspend/react/components/AnySpend.tsx +24 -10
  43. package/src/anyspend/react/components/AnySpendCollectorClubPurchase.tsx +9 -1
  44. package/src/anyspend/react/components/AnySpendCustom.tsx +113 -59
  45. package/src/anyspend/react/components/AnySpendNFT.tsx +49 -48
  46. package/src/anyspend/react/components/common/CryptoReceiveSection.tsx +1 -4
  47. package/src/anyspend/react/components/common/FiatPaymentMethod.tsx +53 -21
  48. package/src/anyspend/react/components/common/PanelOnramp.tsx +36 -40
  49. package/src/anyspend/react/components/common/PanelOnrampPayment.tsx +53 -16
  50. package/src/anyspend/react/hooks/useGeoOnrampOptions.ts +5 -2
  51. package/src/anyspend/react/hooks/useStripeSupport.ts +1 -0
  52. package/src/global-account/react/components/IPFSMediaRenderer/IPFSMediaRenderer.tsx +5 -7
  53. package/src/shared/utils/ipfs.ts +8 -8
@@ -362,18 +362,18 @@ function AnySpendInner({ destinationTokenAddress, destinationTokenChainId, mode
362
362
  isBalanceLoading,
363
363
  });
364
364
  // Get geo-based onramp options for fiat payments
365
- const { geoData, coinbaseAvailablePaymentMethods, stripeWeb2Support } = (0, react_1.useGeoOnrampOptions)(srcAmountOnRamp);
365
+ const { geoData, coinbaseAvailablePaymentMethods, stripeOnrampSupport, stripeWeb2Support } = (0, react_1.useGeoOnrampOptions)(srcAmountOnRamp);
366
366
  // Helper function to map payment method to onramp vendor
367
367
  const getOnrampVendor = (paymentMethod) => {
368
368
  switch (paymentMethod) {
369
369
  case FiatPaymentMethod_1.FiatPaymentMethod.COINBASE_PAY:
370
370
  return "coinbase";
371
371
  case FiatPaymentMethod_1.FiatPaymentMethod.STRIPE:
372
- // Determine if it's stripe onramp or stripe-web2 based on support
373
- if (stripeWeb2Support?.isSupport) {
374
- return "stripe-web2";
375
- }
376
- return undefined;
372
+ // Stripe redirect flow (one-click URL)
373
+ return stripeOnrampSupport ? "stripe" : undefined;
374
+ case FiatPaymentMethod_1.FiatPaymentMethod.STRIPE_WEB2:
375
+ // Stripe embedded payment form
376
+ return stripeWeb2Support?.isSupport ? "stripe-web2" : undefined;
377
377
  default:
378
378
  return undefined;
379
379
  }
@@ -518,7 +518,9 @@ function AnySpendInner({ destinationTokenAddress, destinationTokenChainId, mode
518
518
  }, [activeTab, selectedSrcChainId, selectedDstChainId, selectedSrcToken.address, selectedDstToken.address]);
519
519
  // Determine button state and text
520
520
  const btnInfo = (0, react_4.useMemo)(() => {
521
- if (activeInputAmountInWei === "0")
521
+ // For fiat tab, check srcAmountOnRamp; for crypto tab, check activeInputAmountInWei
522
+ const hasAmount = activeTab === "fiat" ? srcAmountOnRamp && parseFloat(srcAmountOnRamp) > 0 : activeInputAmountInWei !== "0";
523
+ if (!hasAmount)
522
524
  return { text: "Enter an amount", disable: true, error: false, loading: false };
523
525
  if (isSameChainSameToken)
524
526
  return { text: "Select a different token or chain", disable: true, error: false, loading: false };
@@ -569,6 +571,7 @@ function AnySpendInner({ destinationTokenAddress, destinationTokenChainId, mode
569
571
  activeTab,
570
572
  effectiveCryptoPaymentMethod,
571
573
  selectedFiatPaymentMethod,
574
+ srcAmountOnRamp,
572
575
  ]);
573
576
  // Handle main button click
574
577
  const onMainButtonClick = async () => {
@@ -683,11 +686,21 @@ function AnySpendInner({ destinationTokenAddress, destinationTokenChainId, mode
683
686
  paymentMethodString = coinbaseAvailablePaymentMethods[0]?.id || ""; // Use first available payment method ID
684
687
  }
685
688
  else if (paymentMethod === FiatPaymentMethod_1.FiatPaymentMethod.STRIPE) {
686
- if (!stripeWeb2Support || !stripeWeb2Support.isSupport) {
687
- react_2.toast.error("Stripe not available");
689
+ // Stripe redirect flow (one-click URL)
690
+ if (!stripeOnrampSupport) {
691
+ react_2.toast.error("Credit/Debit Card not available");
692
+ return;
693
+ }
694
+ vendor = "stripe";
695
+ paymentMethodString = "";
696
+ }
697
+ else if (paymentMethod === FiatPaymentMethod_1.FiatPaymentMethod.STRIPE_WEB2) {
698
+ // Stripe embedded payment form
699
+ if (!stripeWeb2Support.isSupport) {
700
+ react_2.toast.error("Pay with Card not available");
688
701
  return;
689
702
  }
690
- vendor = stripeWeb2Support && stripeWeb2Support.isSupport ? "stripe-web2" : "stripe";
703
+ vendor = "stripe-web2";
691
704
  paymentMethodString = "";
692
705
  }
693
706
  else {
@@ -29,11 +29,12 @@ const jsx_runtime_1 = require("react/jsx-runtime");
29
29
  * ```
30
30
  */
31
31
  const constants_1 = require("../../../anyspend/constants");
32
+ const number_1 = require("../../../shared/utils/number");
32
33
  const react_1 = require("react");
33
34
  const viem_1 = require("viem");
34
35
  const AnySpendCustom_1 = require("./AnySpendCustom");
35
36
  // Collector Club Shop contract on Base
36
- const CC_SHOP_ADDRESS = "0x4eE0190e37E8A13740c4777D1c9de65E79D8f751";
37
+ const CC_SHOP_ADDRESS = "0x23887D10c81118A9a2E3Af59C423e2f4ee4Cc7Cf";
37
38
  const BASE_CHAIN_ID = 8453;
38
39
  // ABI for buyPacksFor function only
39
40
  const BUY_PACKS_FOR_ABI = {
@@ -58,6 +59,12 @@ function AnySpendCollectorClubPurchase({ loadOrder, mode = "modal", activeTab =
58
59
  return "0";
59
60
  }
60
61
  }, [pricePerPack, packAmount]);
62
+ // Calculate fiat amount (totalAmount in USD, assuming USDC with 6 decimals)
63
+ const srcFiatAmount = (0, react_1.useMemo)(() => {
64
+ if (!totalAmount || totalAmount === "0")
65
+ return "0";
66
+ return (0, number_1.formatUnits)(totalAmount, constants_1.USDC_BASE.decimals);
67
+ }, [totalAmount]);
61
68
  // Encode the buyPacksFor function call
62
69
  const encodedData = (0, react_1.useMemo)(() => {
63
70
  try {
@@ -80,5 +87,5 @@ function AnySpendCollectorClubPurchase({ loadOrder, mode = "modal", activeTab =
80
87
  pricePerPack,
81
88
  vendingMachineId,
82
89
  packType,
83
- }, header: header || defaultHeader, onSuccess: onSuccess, showRecipient: showRecipient }));
90
+ }, header: header || defaultHeader, onSuccess: onSuccess, showRecipient: showRecipient, srcFiatAmount: srcFiatAmount }));
84
91
  }
@@ -21,4 +21,6 @@ export declare function AnySpendCustom(props: {
21
21
  onSuccess?: (txHash?: string) => void;
22
22
  showRecipient?: boolean;
23
23
  onShowPointsDetail?: () => void;
24
+ /** Fiat amount in USD for fiat payments */
25
+ srcFiatAmount?: string;
24
26
  }): import("react/jsx-runtime").JSX.Element;
@@ -52,7 +52,6 @@ const lucide_react_1 = require("lucide-react");
52
52
  const react_4 = require("motion/react");
53
53
  const react_5 = __importStar(require("react"));
54
54
  const chains_1 = require("viem/chains");
55
- const FeatureFlagsContext_1 = require("../contexts/FeatureFlagsContext");
56
55
  const useAutoSetActiveWalletFromWagmi_1 = require("../hooks/useAutoSetActiveWalletFromWagmi");
57
56
  const useCryptoPaymentMethodState_1 = require("../hooks/useCryptoPaymentMethodState");
58
57
  const useRecipientAddressState_1 = require("../hooks/useRecipientAddressState");
@@ -147,9 +146,8 @@ function AnySpendCustom(props) {
147
146
  const fingerprintConfig = (0, AnySpendFingerprintWrapper_1.getFingerprintConfig)();
148
147
  return ((0, jsx_runtime_1.jsx)(AnySpendFingerprintWrapper_1.AnySpendFingerprintWrapper, { fingerprint: fingerprintConfig, children: (0, jsx_runtime_1.jsx)(AnySpendCustomInner, { ...props }) }));
149
148
  }
150
- function AnySpendCustomInner({ loadOrder, mode = "modal", activeTab: activeTabProps = "crypto", recipientAddress: recipientAddressProps, spenderAddress, orderType, dstChainId, dstToken, dstAmount, contractAddress, encodedData, metadata, header, onSuccess, showRecipient = true, onShowPointsDetail, }) {
149
+ function AnySpendCustomInner({ loadOrder, mode = "modal", activeTab: activeTabProps = "crypto", recipientAddress: recipientAddressProps, spenderAddress, orderType, dstChainId, dstToken, dstAmount, contractAddress, encodedData, metadata, header, onSuccess, showRecipient = true, onShowPointsDetail, srcFiatAmount: srcFiatAmountProps, }) {
151
150
  const hasMounted = (0, react_2.useHasMounted)();
152
- const featureFlags = (0, FeatureFlagsContext_1.useFeatureFlags)();
153
151
  const searchParams = (0, react_2.useSearchParamsSSR)();
154
152
  const router = (0, react_2.useRouter)();
155
153
  // Auto-set active wallet from wagmi
@@ -238,7 +236,11 @@ function AnySpendCustomInner({ loadOrder, mode = "modal", activeTab: activeTabPr
238
236
  contractType: orderType === "mint_nft" ? metadata?.nftContract?.type : undefined,
239
237
  encodedData: encodedData,
240
238
  spenderAddress: spenderAddress,
241
- onrampVendor: selectedFiatPaymentMethod === FiatPaymentMethod_1.FiatPaymentMethod.STRIPE ? "stripe-web2" : undefined,
239
+ onrampVendor: selectedFiatPaymentMethod === FiatPaymentMethod_1.FiatPaymentMethod.STRIPE
240
+ ? "stripe"
241
+ : selectedFiatPaymentMethod === FiatPaymentMethod_1.FiatPaymentMethod.STRIPE_WEB2
242
+ ? "stripe-web2"
243
+ : undefined,
242
244
  });
243
245
  }, [
244
246
  activeTab,
@@ -282,9 +284,29 @@ function AnySpendCustomInner({ loadOrder, mode = "modal", activeTab: activeTabPr
282
284
  }
283
285
  }, [activeTab, anyspendQuote?.data]);
284
286
  const formattedSrcAmount = srcAmount ? (0, number_1.formatTokenAmount)(srcAmount, srcToken.decimals, 6, false) : null;
285
- const srcFiatAmount = (0, react_5.useMemo)(() => (activeTab === "fiat" && srcAmount ? (0, number_1.formatUnits)(srcAmount.toString(), constants_1.USDC_BASE.decimals) : "0"), [activeTab, srcAmount]);
286
- // Get geo data and onramp options (after quote is available)
287
- const { geoData, isOnrampSupported, coinbaseAvailablePaymentMethods, stripeWeb2Support } = (0, react_1.useGeoOnrampOptions)(srcFiatAmount);
287
+ // Calculate fiat amount for geo check (regardless of activeTab) to determine tab availability
288
+ const srcFiatAmountForGeoCheck = (0, react_5.useMemo)(() => {
289
+ // Use prop if provided
290
+ if (srcFiatAmountProps) {
291
+ return srcFiatAmountProps;
292
+ }
293
+ // Fallback to dstAmount if destination token is USDC
294
+ if (dstAmount && dstToken.address.toLowerCase() === constants_1.USDC_BASE.address.toLowerCase()) {
295
+ return (0, number_1.formatUnits)(dstAmount, constants_1.USDC_BASE.decimals);
296
+ }
297
+ // Use srcAmount if available (from quote)
298
+ if (srcAmount) {
299
+ return (0, number_1.formatUnits)(srcAmount.toString(), constants_1.USDC_BASE.decimals);
300
+ }
301
+ return "0";
302
+ }, [srcAmount, srcFiatAmountProps, dstAmount, dstToken.address]);
303
+ const srcFiatAmount = (0, react_5.useMemo)(() => {
304
+ if (activeTab !== "fiat")
305
+ return "0";
306
+ return srcFiatAmountForGeoCheck;
307
+ }, [activeTab, srcFiatAmountForGeoCheck]);
308
+ // Get geo data and onramp options (use srcFiatAmountForGeoCheck to check availability regardless of activeTab)
309
+ const { geoData, isOnrampSupported, coinbaseAvailablePaymentMethods, stripeOnrampSupport, stripeWeb2Support } = (0, react_1.useGeoOnrampOptions)(srcFiatAmountForGeoCheck);
288
310
  (0, react_5.useEffect)(() => {
289
311
  if (oat?.data?.order.status === "executed" && !onSuccessCalled.current) {
290
312
  console.log("Calling onSuccess");
@@ -379,9 +401,13 @@ function AnySpendCustomInner({ loadOrder, mode = "modal", activeTab: activeTabPr
379
401
  (0, invariant_1.default)((activeTab === "fiat" ? chains_1.base.id : srcChainId) === chains_1.base.id, "Selected src chain is not base");
380
402
  // Get the current geo data from the hook
381
403
  const currentGeoData = geoData;
404
+ // Use total amount from quote (includes fees) for onramp, fallback to srcFiatAmount
405
+ const onrampAmount = anyspendQuote?.data?.currencyIn?.amountUsd
406
+ ? anyspendQuote.data.currencyIn.amountUsd.toString()
407
+ : srcFiatAmount;
382
408
  void createOnrampOrder({
383
409
  ...createOrderParams,
384
- srcFiatAmount: srcFiatAmount,
410
+ srcFiatAmount: onrampAmount,
385
411
  onramp: {
386
412
  vendor: onramp.vendor,
387
413
  paymentMethod: onramp.paymentMethod,
@@ -451,12 +477,22 @@ function AnySpendCustomInner({ loadOrder, mode = "modal", activeTab: activeTabPr
451
477
  vendor = "coinbase";
452
478
  paymentMethodString = coinbaseAvailablePaymentMethods[0]?.id || "";
453
479
  }
454
- else if (paymentMethod === FiatPaymentMethod_1.FiatPaymentMethod.STRIPE) {
480
+ else if (paymentMethod === FiatPaymentMethod_1.FiatPaymentMethod.STRIPE_WEB2) {
481
+ // Stripe Web2 embedded payment
455
482
  if (!stripeWeb2Support || !stripeWeb2Support.isSupport) {
456
- react_3.toast.error("Stripe not available");
483
+ react_3.toast.error("Stripe embedded payment not available");
457
484
  return;
458
485
  }
459
- vendor = stripeWeb2Support && stripeWeb2Support.isSupport ? "stripe-web2" : "stripe";
486
+ vendor = "stripe-web2";
487
+ paymentMethodString = "";
488
+ }
489
+ else if (paymentMethod === FiatPaymentMethod_1.FiatPaymentMethod.STRIPE) {
490
+ // Stripe redirect (one-click buy URL)
491
+ if (!stripeOnrampSupport) {
492
+ react_3.toast.error("Stripe redirect payment not available");
493
+ return;
494
+ }
495
+ vendor = "stripe";
460
496
  paymentMethodString = "";
461
497
  }
462
498
  else {
@@ -503,7 +539,7 @@ function AnySpendCustomInner({ loadOrder, mode = "modal", activeTab: activeTabPr
503
539
  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" })] }));
504
540
  // Render points badge if conditions are met
505
541
  const renderPointsBadge = () => {
506
- if (featureFlags.showPoints && anyspendQuote?.data?.pointsAmount && anyspendQuote.data.pointsAmount > 0) {
542
+ if (anyspendQuote?.data?.pointsAmount && anyspendQuote.data.pointsAmount > 0) {
507
543
  return ((0, jsx_runtime_1.jsx)(PointsBadge_1.PointsBadge, { pointsAmount: anyspendQuote.data.pointsAmount, pointsMultiplier: anyspendQuote.data.pointsMultiplier, onClick: () => {
508
544
  onShowPointsDetail?.();
509
545
  setActivePanel(PanelView.POINTS_DETAIL);
@@ -546,12 +582,26 @@ function AnySpendCustomInner({ loadOrder, mode = "modal", activeTab: activeTabPr
546
582
  opacity: hasMounted ? 1 : 0,
547
583
  y: hasMounted ? 0 : 20,
548
584
  filter: hasMounted ? "blur(0px)" : "blur(10px)",
549
- }, transition: { duration: 0.3, delay: 0, ease: "easeInOut" }, className: "relative flex w-full items-center justify-between", children: [(0, jsx_runtime_1.jsx)("div", { className: "text-as-tertiarry flex h-7 items-center text-sm", children: "Pay with" }), (0, jsx_runtime_1.jsx)("button", { className: "text-as-tertiarry flex flex-wrap items-center justify-end gap-2 text-sm transition-colors hover:text-blue-700", onClick: () => setActivePanel(PanelView.FIAT_PAYMENT_METHOD), children: selectedFiatPaymentMethod === FiatPaymentMethod_1.FiatPaymentMethod.COINBASE_PAY ? ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-2 whitespace-nowrap", children: [(0, jsx_runtime_1.jsx)("div", { className: "flex h-5 w-5 shrink-0 items-center justify-center rounded-full bg-blue-600", children: (0, jsx_runtime_1.jsx)("span", { className: "text-xs font-bold text-white", children: "C" }) }), "Coinbase Pay"] }), (0, jsx_runtime_1.jsx)(lucide_react_1.ChevronRight, { className: "h-4 w-4 shrink-0" })] })) : selectedFiatPaymentMethod === FiatPaymentMethod_1.FiatPaymentMethod.STRIPE ? ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-2 whitespace-nowrap", children: [(0, jsx_runtime_1.jsx)("div", { className: "flex h-5 w-5 shrink-0 items-center justify-center rounded-full bg-blue-600", children: (0, jsx_runtime_1.jsx)("span", { className: "text-xs font-bold text-white", children: "S" }) }), "Credit/Debit Card"] }), (0, jsx_runtime_1.jsx)(lucide_react_1.ChevronRight, { className: "h-4 w-4 shrink-0" })] })) : ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("span", { className: "whitespace-nowrap", children: "Select payment method" }), (0, jsx_runtime_1.jsx)(lucide_react_1.ChevronRight, { className: "h-4 w-4 shrink-0" })] })) })] }), (0, jsx_runtime_1.jsx)("div", { className: "divider w-full" }), recipientSection, (0, jsx_runtime_1.jsx)("div", { className: "divider w-full" }), (0, jsx_runtime_1.jsxs)(react_4.motion.div, { initial: false, animate: {
585
+ }, transition: { duration: 0.3, delay: 0, ease: "easeInOut" }, className: "relative flex w-full items-center justify-between", children: [(0, jsx_runtime_1.jsx)("div", { className: "text-as-tertiarry flex h-7 items-center text-sm", children: "Pay with" }), (0, jsx_runtime_1.jsx)("button", { className: "text-as-tertiarry flex flex-wrap items-center justify-end gap-2 text-sm transition-colors hover:text-blue-700", onClick: () => setActivePanel(PanelView.FIAT_PAYMENT_METHOD), children: (() => {
586
+ const config = FiatPaymentMethod_1.FIAT_PAYMENT_METHOD_DISPLAY[selectedFiatPaymentMethod];
587
+ if (config) {
588
+ return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-2 whitespace-nowrap", children: [(0, jsx_runtime_1.jsx)("div", { className: "flex h-5 w-5 shrink-0 items-center justify-center rounded-full bg-blue-600", children: (0, jsx_runtime_1.jsx)("span", { className: "text-xs font-bold text-white", children: config.icon }) }), config.label] }), (0, jsx_runtime_1.jsx)(lucide_react_1.ChevronRight, { className: "h-4 w-4 shrink-0" })] }));
589
+ }
590
+ return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("span", { className: "whitespace-nowrap", children: "Select payment method" }), (0, jsx_runtime_1.jsx)(lucide_react_1.ChevronRight, { className: "h-4 w-4 shrink-0" })] }));
591
+ })() })] }), (0, jsx_runtime_1.jsx)("div", { className: "divider w-full" }), recipientSection, (0, jsx_runtime_1.jsx)("div", { className: "divider w-full" }), (0, jsx_runtime_1.jsxs)(react_4.motion.div, { initial: false, animate: {
550
592
  opacity: hasMounted ? 1 : 0,
551
593
  y: hasMounted ? 0 : 20,
552
594
  filter: hasMounted ? "blur(0px)" : "blur(10px)",
553
- }, transition: { duration: 0.3, delay: 0.1, ease: "easeInOut" }, className: "relative flex w-full items-center justify-between gap-4", children: [(0, jsx_runtime_1.jsxs)("span", { className: "text-as-tertiarry flex flex-wrap items-center gap-1.5 text-sm", children: [(0, jsx_runtime_1.jsxs)("span", { className: "whitespace-nowrap", children: ["Total ", (0, jsx_runtime_1.jsx)("span", { className: "text-as-tertiarry", children: "(USD)" })] }), anyspendQuote?.data?.fee && ((0, jsx_runtime_1.jsx)(react_2.TooltipProvider, { children: (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)("button", { className: "text-as-primary/40 hover:text-as-primary/60 transition-colors", children: (0, jsx_runtime_1.jsx)(lucide_react_1.Info, { className: "h-4 w-4" }) }) }), (0, jsx_runtime_1.jsx)(react_2.TooltipContent, { side: "top", children: (0, jsx_runtime_1.jsx)(FeeBreakDown_1.FeeBreakDown, { fee: anyspendQuote.data.fee }) })] }) }))] }), (0, jsx_runtime_1.jsxs)("div", { className: "flex flex-col items-end gap-0.5", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex flex-wrap items-center justify-end gap-2", children: [renderPointsBadge(), (0, jsx_runtime_1.jsxs)("span", { className: "text-as-primary whitespace-nowrap text-xl font-semibold", children: ["$", srcFiatAmount || "0.00"] })] }), anyspendQuote?.data?.fee?.type === "stripeweb2_fee" && anyspendQuote.data.fee.originalAmount && ((0, jsx_runtime_1.jsxs)("span", { className: "text-as-secondary text-xs", children: ["incl. $", ((Number(anyspendQuote.data.fee.originalAmount) - Number(anyspendQuote.data.fee.finalAmount)) /
554
- 1e6).toFixed(2), " ", "fee"] }))] })] })] }), (0, jsx_runtime_1.jsx)("div", { className: (0, utils_1.cn)("flex w-full flex-col items-center justify-between gap-2"), children: (0, jsx_runtime_1.jsx)(react_4.motion.div, { initial: false, animate: {
595
+ }, transition: { duration: 0.3, delay: 0.1, ease: "easeInOut" }, className: "relative flex w-full items-center justify-between gap-4", children: [(0, jsx_runtime_1.jsxs)("span", { className: "text-as-tertiarry flex flex-wrap items-center gap-1.5 text-sm", children: [(0, jsx_runtime_1.jsxs)("span", { className: "whitespace-nowrap", children: ["Total ", (0, jsx_runtime_1.jsx)("span", { className: "text-as-tertiarry", children: "(USD)" })] }), anyspendQuote?.data?.fee && ((0, jsx_runtime_1.jsx)(react_2.TooltipProvider, { children: (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)("button", { className: "text-as-primary/40 hover:text-as-primary/60 transition-colors", children: (0, jsx_runtime_1.jsx)(lucide_react_1.Info, { className: "h-4 w-4" }) }) }), (0, jsx_runtime_1.jsx)(react_2.TooltipContent, { side: "top", children: (0, jsx_runtime_1.jsx)(FeeBreakDown_1.FeeBreakDown, { fee: anyspendQuote.data.fee }) })] }) }))] }), (0, jsx_runtime_1.jsxs)("div", { className: "flex flex-col items-end gap-0.5", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex flex-wrap items-center justify-end gap-2", children: [renderPointsBadge(), isLoadingAnyspendQuote ? ((0, jsx_runtime_1.jsx)("div", { className: "bg-as-surface-secondary h-7 w-16 animate-pulse rounded" })) : ((0, jsx_runtime_1.jsx)("span", { className: "text-as-primary whitespace-nowrap text-xl font-semibold", children: anyspendQuote?.data?.currencyIn?.amountUsd ? (`$${Number(anyspendQuote.data.currencyIn.amountUsd).toFixed(2)}`) : ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: ["$", parseFloat(srcFiatAmount || "0").toFixed(2), (0, jsx_runtime_1.jsx)("span", { className: "text-as-tertiarry text-base", children: "+" })] })) }))] }), (() => {
596
+ if (anyspendQuote?.data?.fee?.type === "stripeweb2_fee" && anyspendQuote.data.fee.originalAmount) {
597
+ const fee = (Number(anyspendQuote.data.fee.originalAmount) - Number(anyspendQuote.data.fee.finalAmount)) /
598
+ 1e6;
599
+ if (fee > 0) {
600
+ return (0, jsx_runtime_1.jsxs)("span", { className: "text-as-secondary text-xs", children: ["incl. $", fee.toFixed(2), " fee"] });
601
+ }
602
+ }
603
+ return null;
604
+ })()] })] })] }), (0, jsx_runtime_1.jsx)("div", { className: (0, utils_1.cn)("flex w-full flex-col items-center justify-between gap-2"), children: (0, jsx_runtime_1.jsx)(react_4.motion.div, { initial: false, animate: {
555
605
  opacity: hasMounted ? 1 : 0,
556
606
  y: hasMounted ? 0 : 20,
557
607
  filter: hasMounted ? "blur(0px)" : "blur(10px)",
@@ -578,11 +628,17 @@ function AnySpendCustomInner({ loadOrder, mode = "modal", activeTab: activeTabPr
578
628
  setSelectedCryptoPaymentMethod(method);
579
629
  setActivePanel(PanelView.CONFIRM_ORDER);
580
630
  } }) }));
631
+ // Stable callback for fiat payment method selection
632
+ const handleFiatPaymentMethodSelect = (0, react_5.useCallback)((method) => {
633
+ setSelectedFiatPaymentMethod(method);
634
+ setActivePanel(PanelView.CONFIRM_ORDER);
635
+ }, []);
636
+ // Stable callback for navigating back to confirm order
637
+ const handleBackToConfirmOrder = (0, react_5.useCallback)(() => {
638
+ setActivePanel(PanelView.CONFIRM_ORDER);
639
+ }, []);
581
640
  // Fiat payment method view
582
- const fiatPaymentMethodView = ((0, jsx_runtime_1.jsx)("div", { className: (0, utils_1.cn)("bg-as-surface-primary mx-auto w-[460px] max-w-full rounded-xl p-4"), children: (0, jsx_runtime_1.jsx)(FiatPaymentMethod_1.FiatPaymentMethodComponent, { selectedPaymentMethod: selectedFiatPaymentMethod, setSelectedPaymentMethod: setSelectedFiatPaymentMethod, onBack: () => setActivePanel(PanelView.CONFIRM_ORDER), onSelectPaymentMethod: (method) => {
583
- setSelectedFiatPaymentMethod(method);
584
- setActivePanel(PanelView.CONFIRM_ORDER);
585
- }, srcAmountOnRamp: srcFiatAmount }) }));
641
+ const fiatPaymentMethodView = ((0, jsx_runtime_1.jsx)("div", { className: (0, utils_1.cn)("bg-as-surface-primary mx-auto w-[460px] max-w-full rounded-xl p-4"), children: (0, jsx_runtime_1.jsx)(FiatPaymentMethod_1.FiatPaymentMethodComponent, { selectedPaymentMethod: selectedFiatPaymentMethod, setSelectedPaymentMethod: setSelectedFiatPaymentMethod, onBack: handleBackToConfirmOrder, onSelectPaymentMethod: handleFiatPaymentMethodSelect, srcAmountOnRamp: srcFiatAmount }) }));
586
642
  // Points detail view
587
643
  const pointsDetailView = ((0, jsx_runtime_1.jsx)("div", { className: (0, utils_1.cn)("bg-as-surface-primary mx-auto w-[460px] max-w-full rounded-xl p-4"), children: (0, jsx_runtime_1.jsx)(PointsDetailPanel_1.PointsDetailPanel, { pointsAmount: anyspendQuote?.data?.pointsAmount || 0, onBack: () => setActivePanel(PanelView.CONFIRM_ORDER) }) }));
588
644
  // Return the TransitionPanel with all views
@@ -31,16 +31,16 @@ const CONTRACT_URI_ABI = [
31
31
  ];
32
32
  function AnySpendNFT({ loadOrder, mode = "modal", recipientAddress, nftContract, onSuccess, onShowPointsDetail, }) {
33
33
  const [imageUrlWithFallback, setFallbackImageUrl] = (0, react_3.useState)(nftContract.imageUrl);
34
- const [isLoadingFallback, setIsLoadingFallback] = (0, react_3.useState)(false);
34
+ const hasFetchedRef = (0, react_3.useRef)(false);
35
35
  // Fetch contract metadata when imageUrl is empty
36
36
  (0, react_3.useEffect)(() => {
37
37
  async function fetchContractMetadata() {
38
38
  // fetch image Uri if not provided
39
- if (nftContract.imageUrl || isLoadingFallback) {
39
+ if (nftContract.imageUrl || hasFetchedRef.current) {
40
40
  return;
41
41
  }
42
+ hasFetchedRef.current = true;
42
43
  try {
43
- setIsLoadingFallback(true);
44
44
  // Use the chainIdToPublicClient utility function
45
45
  const publicClient = (0, anyspend_1.chainIdToPublicClient)(nftContract.chainId);
46
46
  let metadataURI;
@@ -77,15 +77,12 @@ function AnySpendNFT({ loadOrder, mode = "modal", recipientAddress, nftContract,
77
77
  catch (error) {
78
78
  console.error("Error fetching contract metadata:", error);
79
79
  }
80
- finally {
81
- setIsLoadingFallback(false);
82
- }
83
80
  }
84
81
  fetchContractMetadata();
85
- }, [nftContract.contractAddress, nftContract.chainId, nftContract.imageUrl, nftContract.tokenId, isLoadingFallback]);
86
- const header = ({ anyspendPrice, isLoadingAnyspendPrice, }) => ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsxs)("div", { className: "relative size-[200px]", children: [(0, jsx_runtime_1.jsx)("div", { className: "absolute inset-0 scale-95 bg-black/30 blur-md" }), (0, jsx_runtime_1.jsxs)(react_1.GlareCard, { className: "overflow-hidden", children: [imageUrlWithFallback && ((0, jsx_runtime_1.jsx)("img", { src: imageUrlWithFallback, alt: nftContract.name, className: "size-full object-cover" })), (0, jsx_runtime_1.jsx)("div", { className: "absolute inset-0 rounded-xl border border-white/10" })] }), (0, jsx_runtime_1.jsx)(DropdownMenu, { nftContract: nftContract })] }), (0, jsx_runtime_1.jsxs)("div", { className: "from-b3-react-background to-as-on-surface-1 -mb-5 mt-[-100px] w-full rounded-t-lg bg-gradient-to-t", children: [(0, jsx_runtime_1.jsx)("div", { className: "h-[100px] w-full" }), (0, jsx_runtime_1.jsxs)("div", { className: "mb-1 flex w-full flex-col items-center gap-2 p-5", children: [(0, jsx_runtime_1.jsx)("span", { className: "font-sf-rounded text-2xl font-semibold", children: nftContract.name }), (0, jsx_runtime_1.jsx)("div", { className: "flex w-fit items-center gap-1", children: anyspendPrice ? ((0, jsx_runtime_1.jsx)(react_2.AnimatePresence, { mode: "wait", children: (0, jsx_runtime_1.jsx)("div", { className: (0, utils_1.cn)("text-as-primary group flex items-center text-3xl font-semibold transition-all", {
82
+ }, [nftContract.contractAddress, nftContract.chainId, nftContract.imageUrl, nftContract.tokenId]);
83
+ const header = (0, react_3.useCallback)(({ anyspendPrice, isLoadingAnyspendPrice, }) => ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsxs)("div", { className: "relative size-[200px]", children: [(0, jsx_runtime_1.jsx)("div", { className: "absolute inset-0 scale-95 bg-black/30 blur-md" }), (0, jsx_runtime_1.jsxs)(react_1.GlareCard, { className: "overflow-hidden", children: [imageUrlWithFallback && ((0, jsx_runtime_1.jsx)("img", { src: imageUrlWithFallback, alt: nftContract.name, className: "size-full object-cover" })), (0, jsx_runtime_1.jsx)("div", { className: "absolute inset-0 rounded-xl border border-white/10" })] }), (0, jsx_runtime_1.jsx)(DropdownMenu, { nftContract: nftContract })] }), (0, jsx_runtime_1.jsxs)("div", { className: "from-b3-react-background to-as-on-surface-1 -mb-5 mt-[-100px] w-full rounded-t-lg bg-gradient-to-t", children: [(0, jsx_runtime_1.jsx)("div", { className: "h-[100px] w-full" }), (0, jsx_runtime_1.jsxs)("div", { className: "mb-1 flex w-full flex-col items-center gap-2 p-5", children: [(0, jsx_runtime_1.jsx)("span", { className: "font-sf-rounded text-2xl font-semibold", children: nftContract.name }), (0, jsx_runtime_1.jsx)("div", { className: "flex w-fit items-center gap-1", children: anyspendPrice ? ((0, jsx_runtime_1.jsx)(react_2.AnimatePresence, { mode: "wait", children: (0, jsx_runtime_1.jsx)("div", { className: (0, utils_1.cn)("text-as-primary group flex items-center text-3xl font-semibold transition-all", {
87
84
  "opacity-0": isLoadingAnyspendPrice,
88
- }), children: (0, number_1.formatDisplayNumber)(anyspendPrice?.data?.currencyIn?.amountUsd, { style: "currency" }) }) })) : ((0, jsx_runtime_1.jsx)("div", { className: "h-[36px] w-full" })) })] })] })] }));
85
+ }), children: (0, number_1.formatDisplayNumber)(anyspendPrice?.data?.currencyIn?.amountUsd, { style: "currency" }) }) })) : ((0, jsx_runtime_1.jsx)("div", { className: "h-[36px] w-full" })) })] })] })] })), [imageUrlWithFallback, nftContract]);
89
86
  return ((0, jsx_runtime_1.jsx)(AnySpendCustom_1.AnySpendCustom, { loadOrder: loadOrder, mode: mode, activeTab: "fiat", recipientAddress: recipientAddress, orderType: "mint_nft", dstChainId: nftContract.chainId, dstToken: nftContract.currency, dstAmount: nftContract.price, contractAddress: nftContract.contractAddress, encodedData: "0x", metadata: {
90
87
  type: "mint_nft",
91
88
  nftContract: nftContract,
@@ -8,11 +8,9 @@ const formatAddress_1 = require("../../../../shared/utils/formatAddress");
8
8
  const number_1 = require("../../../../shared/utils/number");
9
9
  const lucide_react_1 = require("lucide-react");
10
10
  const react_1 = require("motion/react");
11
- const FeatureFlagsContext_1 = require("../../contexts/FeatureFlagsContext");
12
11
  const OrderTokenAmount_1 = require("./OrderTokenAmount");
13
12
  const PointsBadge_1 = require("./PointsBadge");
14
13
  function CryptoReceiveSection({ isDepositMode = false, isBuyMode = false, effectiveRecipientAddress, recipientName, onSelectRecipient, dstAmount, dstToken, selectedDstChainId, setSelectedDstChainId, setSelectedDstToken, isSrcInputDirty, onChangeDstAmount, anyspendQuote, dstTokenSymbol, dstTokenLogoURI, onShowPointsDetail, onShowFeeDetail, }) {
15
- const featureFlags = (0, FeatureFlagsContext_1.useFeatureFlags)();
16
14
  return ((0, jsx_runtime_1.jsxs)(react_1.motion.div, { initial: { opacity: 0, y: 20, filter: "blur(10px)" }, animate: { opacity: 1, y: 0, filter: "blur(0px)" }, transition: { duration: 0.3, delay: 0.1, ease: "easeInOut" }, className: "receive-section bg-as-surface-secondary border-as-border-secondary relative flex w-full flex-col gap-2 rounded-2xl border p-4 sm:p-6", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex w-full items-center justify-between", children: [(0, jsx_runtime_1.jsxs)("div", { className: "text-as-primary/50 flex h-7 items-center gap-1.5 text-sm", children: [isDepositMode ? "Deposit" : "Receive", isSrcInputDirty && anyspendQuote?.data?.fee && onShowFeeDetail && ((0, jsx_runtime_1.jsx)("button", { onClick: onShowFeeDetail, className: "text-as-primary/40 hover:text-as-primary/60 transition-colors", children: (0, jsx_runtime_1.jsx)(lucide_react_1.Info, { className: "h-4 w-4" }) }))] }), effectiveRecipientAddress ? ((0, jsx_runtime_1.jsx)("button", { className: (0, cn_1.cn)("text-as-tertiarry flex h-7 items-center gap-2 rounded-lg"), onClick: onSelectRecipient, children: (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("span", { className: "text-as-tertiarry flex items-center gap-1 text-sm", children: recipientName ? (0, utils_1.formatUsername)(recipientName) : (0, formatAddress_1.shortenAddress)(effectiveRecipientAddress || "") }), (0, jsx_runtime_1.jsx)(lucide_react_1.ChevronRight, { className: "h-4 w-4" })] }) })) : ((0, jsx_runtime_1.jsx)("button", { className: "text-as-primary/70 flex items-center gap-1 rounded-lg", onClick: onSelectRecipient, children: (0, jsx_runtime_1.jsx)("div", { className: "text-sm font-medium", children: "Select recipient" }) }))] }), isBuyMode || isDepositMode ? (
17
15
  // Fixed destination token display for buy mode and deposit mode
18
16
  (0, jsx_runtime_1.jsxs)("div", { className: "flex items-center justify-between", children: [(0, jsx_runtime_1.jsx)("div", { className: "text-as-primary text-2xl font-bold", children: dstAmount || "0" }), (0, jsx_runtime_1.jsxs)("div", { className: "bg-as-brand/10 border-as-brand/30 flex items-center gap-3 rounded-xl border px-4 py-3", children: [(dstTokenLogoURI || dstToken.metadata?.logoURI) && ((0, jsx_runtime_1.jsx)("img", { src: dstTokenLogoURI || dstToken.metadata?.logoURI, alt: dstTokenSymbol || dstToken.symbol, className: "h-8 w-8 rounded-full" })), (0, jsx_runtime_1.jsx)("span", { className: "text-as-brand text-lg font-bold", children: dstTokenSymbol || dstToken.symbol })] })] })) : (
@@ -58,5 +56,5 @@ function CryptoReceiveSection({ isDepositMode = false, isBuyMode = false, effect
58
56
  }
59
57
  // Using inline style to ensure color displays
60
58
  return ((0, jsx_runtime_1.jsxs)("span", { className: "ml-2", style: { color: actualSlippage >= redThreshold ? "red" : "#FFD700" }, children: ["(", isNegative ? "-" : "", percentage, "%)"] }));
61
- })()] }), featureFlags.showPoints && anyspendQuote?.data?.pointsAmount > 0 && ((0, jsx_runtime_1.jsx)(PointsBadge_1.PointsBadge, { pointsAmount: anyspendQuote.data.pointsAmount, pointsMultiplier: anyspendQuote.data.pointsMultiplier, onClick: () => onShowPointsDetail?.() }))] })] }));
59
+ })()] }), anyspendQuote?.data?.pointsAmount > 0 && ((0, jsx_runtime_1.jsx)(PointsBadge_1.PointsBadge, { pointsAmount: anyspendQuote.data.pointsAmount, pointsMultiplier: anyspendQuote.data.pointsMultiplier, onClick: () => onShowPointsDetail?.() }))] })] }));
62
60
  }
@@ -1,8 +1,13 @@
1
1
  export declare enum FiatPaymentMethod {
2
2
  NONE = "none",
3
3
  COINBASE_PAY = "coinbase_pay",
4
- STRIPE = "stripe"
4
+ STRIPE = "stripe",// Stripe redirect (one-click buy URL)
5
+ STRIPE_WEB2 = "stripe_web2"
5
6
  }
7
+ export declare const FIAT_PAYMENT_METHOD_DISPLAY: Record<FiatPaymentMethod, {
8
+ icon: string;
9
+ label: string;
10
+ } | null>;
6
11
  interface FiatPaymentMethodProps {
7
12
  selectedPaymentMethod: FiatPaymentMethod;
8
13
  setSelectedPaymentMethod: (method: FiatPaymentMethod) => void;
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  "use client";
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.FiatPaymentMethod = void 0;
4
+ exports.FIAT_PAYMENT_METHOD_DISPLAY = exports.FiatPaymentMethod = void 0;
5
5
  exports.FiatPaymentMethodComponent = FiatPaymentMethodComponent;
6
6
  const jsx_runtime_1 = require("react/jsx-runtime");
7
7
  const react_1 = require("../../../../anyspend/react");
@@ -12,26 +12,37 @@ var FiatPaymentMethod;
12
12
  FiatPaymentMethod["NONE"] = "none";
13
13
  FiatPaymentMethod["COINBASE_PAY"] = "coinbase_pay";
14
14
  FiatPaymentMethod["STRIPE"] = "stripe";
15
+ FiatPaymentMethod["STRIPE_WEB2"] = "stripe_web2";
15
16
  })(FiatPaymentMethod || (exports.FiatPaymentMethod = FiatPaymentMethod = {}));
17
+ // Shared display config for fiat payment methods
18
+ exports.FIAT_PAYMENT_METHOD_DISPLAY = {
19
+ [FiatPaymentMethod.COINBASE_PAY]: { icon: "C", label: "Coinbase Pay" },
20
+ [FiatPaymentMethod.STRIPE]: { icon: "S", label: "Pay via Stripe" },
21
+ [FiatPaymentMethod.STRIPE_WEB2]: { icon: "S", label: "Pay with Card" },
22
+ [FiatPaymentMethod.NONE]: null,
23
+ };
16
24
  function FiatPaymentMethodComponent({ selectedPaymentMethod, setSelectedPaymentMethod, onBack, onSelectPaymentMethod, srcAmountOnRamp, }) {
25
+ // Load geo-based onramp options like in PanelOnramp
26
+ const { coinbaseAvailablePaymentMethods, stripeOnrampSupport, stripeWeb2Support, isLoading: isLoadingGeoOnramp, } = (0, react_1.useGeoOnrampOptions)(srcAmountOnRamp);
17
27
  // Helper function to get fees from API data
18
28
  const getFeeFromApi = (paymentMethod) => {
19
29
  switch (paymentMethod) {
20
30
  case FiatPaymentMethod.COINBASE_PAY:
21
31
  // Coinbase doesn't provide fee info in API, return null
22
32
  return null;
23
- case FiatPaymentMethod.STRIPE:
24
- // Get fee from Stripe API response
33
+ case FiatPaymentMethod.STRIPE_WEB2:
34
+ // Get fee from Stripe Web2 API response
25
35
  if (stripeWeb2Support && "formattedFeeUsd" in stripeWeb2Support) {
26
36
  return stripeWeb2Support.formattedFeeUsd;
27
37
  }
28
38
  return null;
39
+ case FiatPaymentMethod.STRIPE:
40
+ // Stripe redirect doesn't have fee info from API
41
+ return null;
29
42
  default:
30
43
  return null; // No fee when no payment method selected
31
44
  }
32
45
  };
33
- // Load geo-based onramp options like in PanelOnramp
34
- const { coinbaseAvailablePaymentMethods, stripeWeb2Support, isLoading: isLoadingGeoOnramp, } = (0, react_1.useGeoOnrampOptions)(srcAmountOnRamp);
35
46
  // Generate payment methods based on geo availability (like in PanelOnrampPayment)
36
47
  const availablePaymentMethods = [];
37
48
  // Add Coinbase Pay if available
@@ -46,15 +57,27 @@ function FiatPaymentMethodComponent({ selectedPaymentMethod, setSelectedPaymentM
46
57
  available: true,
47
58
  });
48
59
  }
49
- // Add Stripe if available
50
- if (stripeWeb2Support && stripeWeb2Support.isSupport) {
51
- const stripeFee = getFeeFromApi(FiatPaymentMethod.STRIPE);
60
+ // Add Stripe redirect (one-click) if available - redirects to Stripe checkout
61
+ if (stripeOnrampSupport) {
62
+ const stripeFee = getFeeFromApi(FiatPaymentMethod.STRIPE_WEB2); // Use same fee estimate
52
63
  availablePaymentMethods.push({
53
64
  id: FiatPaymentMethod.STRIPE,
54
- name: "Stripe",
55
- description: "Credit or debit card payment",
56
- badge: stripeFee ? `$${Number(stripeFee).toFixed(2)} fee` : "Standard Fee",
57
- badgeColor: "bg-yellow-100 text-yellow-800",
65
+ name: "Pay via Stripe",
66
+ description: "Redirects to Stripe checkout",
67
+ badge: stripeFee ? `$${Number(stripeFee).toFixed(2)} fee` : undefined,
68
+ badgeColor: "bg-gray-100 text-gray-800",
69
+ available: true,
70
+ });
71
+ }
72
+ // Add Stripe Web2 (embedded) if available - embedded card form
73
+ if (stripeWeb2Support && stripeWeb2Support.isSupport) {
74
+ const stripeFee = getFeeFromApi(FiatPaymentMethod.STRIPE_WEB2);
75
+ availablePaymentMethods.push({
76
+ id: FiatPaymentMethod.STRIPE_WEB2,
77
+ name: "Pay with Card",
78
+ description: "Fast checkout",
79
+ badge: stripeFee ? `$${Number(stripeFee).toFixed(2)} fee` : undefined,
80
+ badgeColor: "bg-gray-100 text-gray-800",
58
81
  available: true,
59
82
  });
60
83
  }
@@ -67,5 +90,9 @@ function FiatPaymentMethodComponent({ selectedPaymentMethod, setSelectedPaymentM
67
90
  onSelectPaymentMethod(method.id);
68
91
  }, className: (0, cn_1.cn)("fiat-payment-method-item bg-as-surface-secondary border-as-border-secondary flex w-full items-center gap-4 rounded-2xl border p-4 transition-all duration-200", selectedPaymentMethod === method.id
69
92
  ? "border-as-brand bg-as-brand/10"
70
- : "hover:border-as-brand/50 hover:bg-as-brand/5"), children: [(0, jsx_runtime_1.jsx)("div", { className: "flex h-12 w-12 items-center justify-center rounded-full bg-blue-600 text-2xl text-white", children: method.id === FiatPaymentMethod.COINBASE_PAY ? "C" : "S" }), (0, jsx_runtime_1.jsxs)("div", { className: "flex flex-1 flex-col items-start text-left", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-2", children: [(0, jsx_runtime_1.jsx)("span", { className: "text-as-primary text-base font-semibold", children: method.name }), (0, jsx_runtime_1.jsx)("span", { className: (0, cn_1.cn)("rounded-full px-2 py-1 text-xs font-medium", method.badgeColor), children: method.badge })] }), (0, jsx_runtime_1.jsx)("span", { className: "text-as-primary/60 text-sm", children: method.description })] }), selectedPaymentMethod === method.id && (0, jsx_runtime_1.jsx)(lucide_react_1.ChevronRight, { className: "text-as-brand h-5 w-5" })] }, method.id)))) })] }) }));
93
+ : "hover:border-as-brand/50 hover:bg-as-brand/5"), children: [(0, jsx_runtime_1.jsx)("div", { className: "flex h-12 w-12 items-center justify-center rounded-full bg-blue-600 text-2xl text-white", children: method.id === FiatPaymentMethod.COINBASE_PAY
94
+ ? "C"
95
+ : method.id === FiatPaymentMethod.STRIPE || method.id === FiatPaymentMethod.STRIPE_WEB2
96
+ ? "S"
97
+ : "?" }), (0, jsx_runtime_1.jsxs)("div", { className: "flex flex-1 flex-col items-start text-left", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-2", children: [(0, jsx_runtime_1.jsx)("span", { className: "text-as-primary text-base font-semibold", children: method.name }), method.badge && ((0, jsx_runtime_1.jsx)("span", { className: (0, cn_1.cn)("rounded-full px-2 py-1 text-xs font-medium", method.badgeColor), children: method.badge }))] }), (0, jsx_runtime_1.jsx)("span", { className: "text-as-primary/60 text-sm", children: method.description })] }), selectedPaymentMethod === method.id && (0, jsx_runtime_1.jsx)(lucide_react_1.ChevronRight, { className: "text-as-brand h-5 w-5" })] }, method.id)))) })] }) }));
71
98
  }
@@ -9,13 +9,11 @@ const utils_1 = require("../../../../shared/utils");
9
9
  const formatAddress_1 = require("../../../../shared/utils/formatAddress");
10
10
  const lucide_react_1 = require("lucide-react");
11
11
  const react_3 = require("react");
12
- const FeatureFlagsContext_1 = require("../../contexts/FeatureFlagsContext");
13
12
  const FiatPaymentMethod_1 = require("./FiatPaymentMethod");
14
13
  const OrderTokenAmountFiat_1 = require("./OrderTokenAmountFiat");
15
14
  const PointsBadge_1 = require("./PointsBadge");
16
15
  const ONE_CHAR_WIDTH = 30;
17
16
  function PanelOnramp({ srcAmountOnRamp, setSrcAmountOnRamp, selectedPaymentMethod, setActivePanel, _recipientAddress, destinationToken, destinationChainId, destinationAmount, onDestinationTokenChange, onDestinationChainChange, fiatPaymentMethodIndex, recipientSelectionPanelIndex, dstTokenSymbol, hideDstToken = false, anyspendQuote, onShowPointsDetail, onShowFeeDetail, customUsdInputValues = ["5", "10", "20", "25"], }) {
18
- const featureFlags = (0, FeatureFlagsContext_1.useFeatureFlags)();
19
17
  // Helper function to get fees from anyspend quote
20
18
  const getFeeFromApi = (paymentMethod) => {
21
19
  // Try to get fee from anyspend quote first (most accurate)
@@ -41,10 +39,14 @@ function PanelOnramp({ srcAmountOnRamp, setSrcAmountOnRamp, selectedPaymentMetho
41
39
  // Helper function to get total amount from API (for Stripe) or calculate it (for others)
42
40
  const getTotalAmount = (paymentMethod) => {
43
41
  const baseAmount = parseFloat(srcAmountOnRamp) || 5;
44
- // Try to get from anyspend quote first (most accurate)
42
+ // For stripeweb2_fee, use the originalAmount
45
43
  if (anyspendQuote?.data?.fee?.type === "stripeweb2_fee") {
46
44
  return Number(anyspendQuote.data.fee.originalAmount) / 1e6; // Convert from wei to USD
47
45
  }
46
+ // Use currencyIn.amountUsd from quote when available (includes fees, most accurate for custom orders)
47
+ if (anyspendQuote?.data?.currencyIn?.amountUsd) {
48
+ return Number(anyspendQuote.data.currencyIn.amountUsd);
49
+ }
48
50
  const fee = getFeeFromApi(paymentMethod);
49
51
  // For Coinbase or when fee is available, calculate manually
50
52
  if (fee !== null) {
@@ -76,15 +78,19 @@ function PanelOnramp({ srcAmountOnRamp, setSrcAmountOnRamp, selectedPaymentMetho
76
78
  const handleQuickAmount = (value) => {
77
79
  setSrcAmountOnRamp(value);
78
80
  };
79
- return ((0, jsx_runtime_1.jsxs)("div", { className: "panel-onramp bg-as-surface-primary flex w-full flex-col", children: [(0, jsx_runtime_1.jsxs)("div", { className: "border-as-border-secondary bg-as-surface-secondary relative flex w-full flex-col rounded-2xl border p-4", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex h-7 w-full items-center justify-between", children: [(0, jsx_runtime_1.jsx)("span", { className: "text-as-tertiarry flex items-center text-sm font-bold", children: "Pay" }), (0, jsx_runtime_1.jsx)("button", { className: "text-as-tertiarry flex h-7 items-center gap-1 text-sm", onClick: () => setActivePanel(fiatPaymentMethodIndex), children: selectedPaymentMethod === FiatPaymentMethod_1.FiatPaymentMethod.COINBASE_PAY ? ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-2", children: [(0, jsx_runtime_1.jsx)("div", { className: "flex h-5 w-5 items-center justify-center rounded-full bg-blue-600", children: (0, jsx_runtime_1.jsx)("span", { className: "text-xs font-bold text-white", children: "C" }) }), "Coinbase Pay"] }), (0, jsx_runtime_1.jsx)(lucide_react_1.ChevronRight, { className: "h-4 w-4" })] })) : selectedPaymentMethod === FiatPaymentMethod_1.FiatPaymentMethod.STRIPE ? ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-2", children: [(0, jsx_runtime_1.jsx)("div", { className: "flex h-5 w-5 items-center justify-center rounded-full bg-blue-600", children: (0, jsx_runtime_1.jsx)("span", { className: "text-xs font-bold text-white", children: "S" }) }), "Stripe"] }), (0, jsx_runtime_1.jsx)(lucide_react_1.ChevronRight, { className: "h-4 w-4" })] })) : ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: ["Select payment method", (0, jsx_runtime_1.jsx)(lucide_react_1.ChevronRight, { className: "h-4 w-4" })] })) })] }), (0, jsx_runtime_1.jsx)("div", { className: "flex items-center justify-center pb-2 pt-8", children: (0, jsx_runtime_1.jsxs)("div", { className: "flex gap-1", children: [(0, jsx_runtime_1.jsx)("span", { className: "text-as-tertiarry text-2xl font-bold", children: "$" }), (0, jsx_runtime_1.jsx)(react_2.Input, { ref: amountInputRef, type: "text", value: srcAmountOnRamp, onChange: handleAmountChange, placeholder: "5", className: "text-as-primary placeholder:text-as-primary/50 h-auto border-0 bg-transparent p-0 px-1 pt-1 text-4xl font-bold focus-visible:ring-0 focus-visible:ring-offset-0", style: {
81
+ return ((0, jsx_runtime_1.jsxs)("div", { className: "panel-onramp bg-as-surface-primary flex w-full flex-col", children: [(0, jsx_runtime_1.jsxs)("div", { className: "border-as-border-secondary bg-as-surface-secondary relative flex w-full flex-col rounded-2xl border p-4", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex h-7 w-full items-center justify-between", children: [(0, jsx_runtime_1.jsx)("span", { className: "text-as-tertiarry flex items-center text-sm font-bold", children: "Pay" }), (0, jsx_runtime_1.jsx)("button", { className: "text-as-tertiarry flex h-7 items-center gap-1 text-sm", onClick: () => setActivePanel(fiatPaymentMethodIndex), children: (() => {
82
+ const config = selectedPaymentMethod ? FiatPaymentMethod_1.FIAT_PAYMENT_METHOD_DISPLAY[selectedPaymentMethod] : null;
83
+ if (config) {
84
+ return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-2", children: [(0, jsx_runtime_1.jsx)("div", { className: "flex h-5 w-5 items-center justify-center rounded-full bg-blue-600", children: (0, jsx_runtime_1.jsx)("span", { className: "text-xs font-bold text-white", children: config.icon }) }), config.label] }), (0, jsx_runtime_1.jsx)(lucide_react_1.ChevronRight, { className: "h-4 w-4" })] }));
85
+ }
86
+ return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: ["Select payment method", (0, jsx_runtime_1.jsx)(lucide_react_1.ChevronRight, { className: "h-4 w-4" })] }));
87
+ })() })] }), (0, jsx_runtime_1.jsx)("div", { className: "flex items-center justify-center pb-2 pt-8", children: (0, jsx_runtime_1.jsxs)("div", { className: "flex gap-1", children: [(0, jsx_runtime_1.jsx)("span", { className: "text-as-tertiarry text-2xl font-bold", children: "$" }), (0, jsx_runtime_1.jsx)(react_2.Input, { ref: amountInputRef, type: "text", value: srcAmountOnRamp, onChange: handleAmountChange, placeholder: "5", className: "text-as-primary placeholder:text-as-primary/50 h-auto border-0 bg-transparent p-0 px-1 pt-1 text-4xl font-bold focus-visible:ring-0 focus-visible:ring-offset-0", style: {
80
88
  width: `${Math.max(ONE_CHAR_WIDTH, srcAmountOnRamp.length * ONE_CHAR_WIDTH)}px`,
81
89
  } })] }) }), (0, jsx_runtime_1.jsx)("div", { className: (0, utils_1.cn)("mx-auto mb-6 flex justify-center gap-2", hideDstToken && "mb-0"), children: customUsdInputValues
82
90
  .filter(v => !isNaN(Number(v)))
83
91
  .map(value => ((0, jsx_runtime_1.jsxs)("button", { onClick: () => handleQuickAmount(value), className: `bg-as-surface-secondary border-as-border-secondary hover:border-as-border-secondary h-7 w-14 rounded-lg border text-sm font-medium transition-all duration-200 ${srcAmountOnRamp === value
84
92
  ? "border-as-border-secondary bg-as-surface-secondary"
85
- : "bg-as-surface-secondary hover:bg-as-surface-secondary"}`, children: ["$", value] }, value))) }), destinationToken && destinationChainId && !hideDstToken && ((0, jsx_runtime_1.jsx)(OrderTokenAmountFiat_1.OrderTokenAmountFiat, { address: _recipientAddress, context: "to", inputValue: destinationAmount || "0", onChangeInput: () => { }, chainId: destinationChainId, setChainId: onDestinationChainChange || (() => { }), token: destinationToken, setToken: onDestinationTokenChange || (() => { }) }))] }), (0, jsx_runtime_1.jsxs)("div", { className: "border-as-border-secondary bg-as-surface-secondary mt-4 flex w-full flex-col gap-3 rounded-xl border p-4", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex w-full items-center justify-between gap-2", children: [(0, jsx_runtime_1.jsx)("span", { className: "text-as-tertiarry flex items-center text-sm", children: "Recipient" }), _recipientAddress ? ((0, jsx_runtime_1.jsxs)("button", { className: "text-as-tertiarry flex h-7 items-center gap-1 text-sm transition-colors hover:text-blue-700", onClick: () => setActivePanel(recipientSelectionPanelIndex), children: [(0, jsx_runtime_1.jsx)("span", { className: "text-sm", children: recipientName ? (0, utils_1.formatUsername)(recipientName) : (0, formatAddress_1.formatAddress)(_recipientAddress) }), (0, jsx_runtime_1.jsx)(lucide_react_1.ChevronRight, { size: 16 })] })) : ((0, jsx_runtime_1.jsxs)("button", { className: "text-as-tertiarry flex h-7 items-center gap-1 text-sm transition-colors hover:text-blue-700", onClick: () => setActivePanel(5), children: [(0, jsx_runtime_1.jsx)(lucide_react_1.Wallet, { className: "text-as-brand", size: 16 }), "Select recipient", (0, jsx_runtime_1.jsx)(lucide_react_1.ChevronRight, { size: 16 })] }))] }), (0, jsx_runtime_1.jsx)("div", { className: "divider w-full" }), (0, jsx_runtime_1.jsxs)("div", { className: "flex items-center justify-between gap-4", children: [(0, jsx_runtime_1.jsx)("span", { className: "text-as-tertiarry text-sm", children: "Expected to receive" }), (0, jsx_runtime_1.jsxs)("div", { className: "flex flex-wrap items-center justify-end gap-1", children: [(0, jsx_runtime_1.jsxs)("span", { className: "text-as-primary font-semibold", children: [destinationAmount || "0", " ", dstTokenSymbol || destinationToken?.symbol || ""] }), (0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-1", children: [(0, jsx_runtime_1.jsxs)("span", { className: "text-as-tertiarry text-sm", children: ["on ", destinationChainId ? chain_1.ALL_CHAINS[destinationChainId]?.name : ""] }), destinationToken && destinationChainId && destinationToken.metadata?.logoURI && ((0, jsx_runtime_1.jsx)("img", { src: chain_1.ALL_CHAINS[destinationChainId]?.logoUrl, alt: "Chain", className: "h-4 w-4 rounded-full" }))] })] })] }), (0, jsx_runtime_1.jsx)("div", { className: "divider w-full" }), (0, jsx_runtime_1.jsx)("div", { className: "", children: (0, jsx_runtime_1.jsxs)("div", { className: "flex items-center justify-between", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-1.5", children: [(0, jsx_runtime_1.jsx)("span", { className: "text-as-tertiarry text-sm", children: "Total" }), anyspendQuote?.data?.fee && onShowFeeDetail && ((0, jsx_runtime_1.jsx)("button", { onClick: onShowFeeDetail, className: "text-as-primary/40 hover:text-as-primary/60 transition-colors", children: (0, jsx_runtime_1.jsx)(lucide_react_1.Info, { className: "h-4 w-4" }) })), featureFlags.showPoints &&
86
- anyspendQuote?.data?.pointsAmount &&
87
- anyspendQuote?.data?.pointsAmount > 0 && ((0, jsx_runtime_1.jsx)(PointsBadge_1.PointsBadge, { pointsAmount: anyspendQuote.data.pointsAmount, pointsMultiplier: anyspendQuote.data.pointsMultiplier, onClick: () => onShowPointsDetail?.() }))] }), (0, jsx_runtime_1.jsxs)("div", { className: "flex flex-col items-end gap-0.5", children: [(0, jsx_runtime_1.jsxs)("span", { className: "text-as-primary font-semibold", children: ["$", getTotalAmount(selectedPaymentMethod || FiatPaymentMethod_1.FiatPaymentMethod.NONE).toFixed(2)] }), (() => {
93
+ : "bg-as-surface-secondary hover:bg-as-surface-secondary"}`, children: ["$", value] }, value))) }), destinationToken && destinationChainId && !hideDstToken && ((0, jsx_runtime_1.jsx)(OrderTokenAmountFiat_1.OrderTokenAmountFiat, { address: _recipientAddress, context: "to", inputValue: destinationAmount || "0", onChangeInput: () => { }, chainId: destinationChainId, setChainId: onDestinationChainChange || (() => { }), token: destinationToken, setToken: onDestinationTokenChange || (() => { }) }))] }), (0, jsx_runtime_1.jsxs)("div", { className: "border-as-border-secondary bg-as-surface-secondary mt-4 flex w-full flex-col gap-3 rounded-xl border p-4", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex w-full items-center justify-between gap-2", children: [(0, jsx_runtime_1.jsx)("span", { className: "text-as-tertiarry flex items-center text-sm", children: "Recipient" }), _recipientAddress ? ((0, jsx_runtime_1.jsxs)("button", { className: "text-as-tertiarry flex h-7 items-center gap-1 text-sm transition-colors hover:text-blue-700", onClick: () => setActivePanel(recipientSelectionPanelIndex), children: [(0, jsx_runtime_1.jsx)("span", { className: "text-sm", children: recipientName ? (0, utils_1.formatUsername)(recipientName) : (0, formatAddress_1.formatAddress)(_recipientAddress) }), (0, jsx_runtime_1.jsx)(lucide_react_1.ChevronRight, { size: 16 })] })) : ((0, jsx_runtime_1.jsxs)("button", { className: "text-as-tertiarry flex h-7 items-center gap-1 text-sm transition-colors hover:text-blue-700", onClick: () => setActivePanel(5), children: [(0, jsx_runtime_1.jsx)(lucide_react_1.Wallet, { className: "text-as-brand", size: 16 }), "Select recipient", (0, jsx_runtime_1.jsx)(lucide_react_1.ChevronRight, { size: 16 })] }))] }), (0, jsx_runtime_1.jsx)("div", { className: "divider w-full" }), (0, jsx_runtime_1.jsxs)("div", { className: "flex items-center justify-between gap-4", children: [(0, jsx_runtime_1.jsx)("span", { className: "text-as-tertiarry text-sm", children: "Expected to receive" }), (0, jsx_runtime_1.jsxs)("div", { className: "flex flex-wrap items-center justify-end gap-1", children: [(0, jsx_runtime_1.jsxs)("span", { className: "text-as-primary font-semibold", children: [destinationAmount || "0", " ", dstTokenSymbol || destinationToken?.symbol || ""] }), (0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-1", children: [(0, jsx_runtime_1.jsxs)("span", { className: "text-as-tertiarry text-sm", children: ["on ", destinationChainId ? chain_1.ALL_CHAINS[destinationChainId]?.name : ""] }), destinationToken && destinationChainId && destinationToken.metadata?.logoURI && ((0, jsx_runtime_1.jsx)("img", { src: chain_1.ALL_CHAINS[destinationChainId]?.logoUrl, alt: "Chain", className: "h-4 w-4 rounded-full" }))] })] })] }), (0, jsx_runtime_1.jsx)("div", { className: "divider w-full" }), (0, jsx_runtime_1.jsx)("div", { className: "", children: (0, jsx_runtime_1.jsxs)("div", { className: "flex items-center justify-between", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-1.5", children: [(0, jsx_runtime_1.jsx)("span", { className: "text-as-tertiarry text-sm", children: "Total" }), anyspendQuote?.data?.fee && onShowFeeDetail && ((0, jsx_runtime_1.jsx)("button", { onClick: onShowFeeDetail, className: "text-as-primary/40 hover:text-as-primary/60 transition-colors", children: (0, jsx_runtime_1.jsx)(lucide_react_1.Info, { className: "h-4 w-4" }) })), anyspendQuote?.data?.pointsAmount && anyspendQuote?.data?.pointsAmount > 0 && ((0, jsx_runtime_1.jsx)(PointsBadge_1.PointsBadge, { pointsAmount: anyspendQuote.data.pointsAmount, pointsMultiplier: anyspendQuote.data.pointsMultiplier, onClick: () => onShowPointsDetail?.() }))] }), (0, jsx_runtime_1.jsxs)("div", { className: "flex flex-col items-end gap-0.5", children: [(0, jsx_runtime_1.jsxs)("span", { className: "text-as-primary font-semibold", children: ["$", getTotalAmount(selectedPaymentMethod || FiatPaymentMethod_1.FiatPaymentMethod.NONE).toFixed(2)] }), (() => {
88
94
  // For fiat payments, show the fee from the payment method
89
95
  const fiatFee = getFeeFromApi(selectedPaymentMethod || FiatPaymentMethod_1.FiatPaymentMethod.NONE);
90
96
  if (fiatFee !== null && fiatFee > 0) {