@0xsequence/marketplace-sdk 0.4.8 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (116) hide show
  1. package/dist/{chunk-2OJB35FS.js → chunk-5NORRVPM.js} +5 -5
  2. package/dist/{chunk-2OJB35FS.js.map → chunk-5NORRVPM.js.map} +1 -1
  3. package/dist/{chunk-ATDCYXXV.js → chunk-6YHHCGGY.js} +2 -2
  4. package/dist/{chunk-WRMJ5FZM.js → chunk-HV2X2VZN.js} +874 -194
  5. package/dist/chunk-HV2X2VZN.js.map +1 -0
  6. package/dist/{chunk-AQT3BQ67.js → chunk-J2XJZ6SJ.js} +12 -5
  7. package/dist/chunk-J2XJZ6SJ.js.map +1 -0
  8. package/dist/{chunk-JEOUQFT3.js → chunk-LJAB3S6U.js} +4 -3
  9. package/dist/chunk-LJAB3S6U.js.map +1 -0
  10. package/dist/{chunk-7WCZP6FN.js → chunk-OUVFTA63.js} +649 -386
  11. package/dist/chunk-OUVFTA63.js.map +1 -0
  12. package/dist/{chunk-XXML5K3X.js → chunk-QTJF5GDQ.js} +2 -2
  13. package/dist/{chunk-LF44FCG5.js → chunk-TQWM4ER6.js} +2 -2
  14. package/dist/{chunk-LF44FCG5.js.map → chunk-TQWM4ER6.js.map} +1 -1
  15. package/dist/{chunk-6R4G7J6Q.js → chunk-WSCUPAGR.js} +33 -5
  16. package/dist/chunk-WSCUPAGR.js.map +1 -0
  17. package/dist/{create-config-D5WqfUft.d.ts → create-config-BXvwUh55.d.ts} +2 -2
  18. package/dist/index.css +31 -17
  19. package/dist/index.d.ts +3 -3
  20. package/dist/index.js +1 -1
  21. package/dist/{marketplace-config-C_fDWzz0.d.ts → marketplace-config-znEu4L0K.d.ts} +1 -1
  22. package/dist/{marketplace.gen-B8S8fflj.d.ts → marketplace.gen-CCJ-URn2.d.ts} +16 -4
  23. package/dist/react/_internal/api/index.d.ts +3 -2
  24. package/dist/react/_internal/api/index.js +3 -1
  25. package/dist/react/_internal/index.d.ts +5 -5
  26. package/dist/react/_internal/index.js +3 -1
  27. package/dist/react/_internal/wagmi/index.d.ts +3 -3
  28. package/dist/react/hooks/index.d.ts +249 -74
  29. package/dist/react/hooks/index.js +18 -5
  30. package/dist/react/index.css +37 -17
  31. package/dist/react/index.css.map +1 -1
  32. package/dist/react/index.d.ts +6 -6
  33. package/dist/react/index.js +22 -9
  34. package/dist/react/ssr/index.js +4 -0
  35. package/dist/react/ssr/index.js.map +1 -1
  36. package/dist/react/ui/components/collectible-card/index.css +37 -17
  37. package/dist/react/ui/components/collectible-card/index.css.map +1 -1
  38. package/dist/react/ui/components/collectible-card/index.d.ts +27 -4
  39. package/dist/react/ui/components/collectible-card/index.js +8 -9
  40. package/dist/react/ui/icons/index.js +3 -3
  41. package/dist/react/ui/index.css +37 -17
  42. package/dist/react/ui/index.css.map +1 -1
  43. package/dist/react/ui/index.d.ts +3 -3
  44. package/dist/react/ui/index.js +8 -9
  45. package/dist/react/ui/modals/_internal/components/actionModal/index.d.ts +3 -3
  46. package/dist/react/ui/modals/_internal/components/actionModal/index.js +5 -5
  47. package/dist/{sdk-config-BXVH8PS2.d.ts → sdk-config-B32_2bG3.d.ts} +29 -7
  48. package/dist/{services-CdXAIjt1.d.ts → services-BRBVE0mm.d.ts} +1 -1
  49. package/dist/styles/index.css +31 -17
  50. package/dist/styles/index.css.map +1 -1
  51. package/dist/styles/index.d.ts +2 -2
  52. package/dist/styles/index.js +2 -2
  53. package/dist/types/index.d.ts +3 -3
  54. package/dist/types/index.js +1 -1
  55. package/dist/{types-eX4P9xju.d.ts → types-Yto6KrTN.d.ts} +2 -2
  56. package/dist/utils/index.d.ts +3 -3
  57. package/dist/utils/index.js +1 -1
  58. package/package.json +16 -16
  59. package/src/react/_internal/api/__mocks__/marketplace.msw.ts +4 -0
  60. package/src/react/_internal/api/marketplace.gen.ts +45 -7
  61. package/src/react/_internal/api/query-keys.ts +4 -0
  62. package/src/react/_internal/wallet/useWallet.ts +30 -46
  63. package/src/react/_internal/wallet/wallet.ts +52 -6
  64. package/src/react/hooks/index.ts +4 -0
  65. package/src/react/hooks/options/__mocks__/marketplaceConfig.msw.ts +10 -1
  66. package/src/react/hooks/useAutoSelectFeeOption.tsx +104 -0
  67. package/src/react/hooks/useCancelOrder.tsx +57 -1
  68. package/src/react/hooks/useCollectionBalanceDetails.tsx +87 -0
  69. package/src/react/hooks/useCollectionDetails.tsx +35 -0
  70. package/src/react/hooks/useCollectionDetailsPolling.tsx +60 -0
  71. package/src/react/ui/components/_internals/action-button/ActionButton.tsx +36 -118
  72. package/src/react/ui/components/_internals/action-button/components/ActionButtonBody.tsx +52 -0
  73. package/src/react/ui/components/_internals/action-button/components/NonOwnerActions.tsx +72 -0
  74. package/src/react/ui/components/_internals/action-button/components/OwnerActions.tsx +81 -0
  75. package/src/react/ui/components/_internals/action-button/hooks/useActionButtonLogic.ts +93 -0
  76. package/src/react/ui/components/_internals/action-button/store.ts +47 -0
  77. package/src/react/ui/components/_internals/action-button/styles.css.ts +8 -0
  78. package/src/react/ui/components/collectible-card/CollectibleCard.tsx +35 -18
  79. package/src/react/ui/components/collectible-card/Footer.tsx +5 -8
  80. package/src/react/ui/components/collectible-card/styles.css.ts +44 -31
  81. package/src/react/ui/icons/CartIcon.tsx +46 -0
  82. package/src/react/ui/modals/BuyModal/Modal.tsx +0 -2
  83. package/src/react/ui/modals/BuyModal/__tests__/Modal.test.tsx +253 -0
  84. package/src/react/ui/modals/BuyModal/__tests__/store.test.ts +100 -0
  85. package/src/react/ui/modals/BuyModal/hooks/__tests__/useBuyCollectable.test.tsx +402 -0
  86. package/src/react/ui/modals/BuyModal/hooks/__tests__/useCheckoutOptions.test.tsx +267 -0
  87. package/src/react/ui/modals/BuyModal/hooks/__tests__/useFees.test.tsx +166 -0
  88. package/src/react/ui/modals/BuyModal/hooks/__tests__/useLoadData.test.tsx +209 -0
  89. package/src/react/ui/modals/BuyModal/hooks/useBuyCollectable.ts +7 -4
  90. package/src/react/ui/modals/BuyModal/hooks/useCheckoutOptions.ts +19 -17
  91. package/src/react/ui/modals/BuyModal/hooks/useLoadData.ts +9 -7
  92. package/src/react/ui/modals/BuyModal/modals/Modal1155.tsx +36 -18
  93. package/src/react/ui/modals/BuyModal/modals/__tests__/CheckoutModal.test.tsx +162 -0
  94. package/src/react/ui/modals/BuyModal/modals/__tests__/Modal1155.test.tsx +243 -0
  95. package/src/react/ui/modals/BuyModal/store.ts +11 -10
  96. package/src/react/ui/modals/CreateListingModal/Modal.tsx +26 -3
  97. package/src/react/ui/modals/CreateListingModal/__tests__/Modal.test.tsx +141 -29
  98. package/src/react/ui/modals/TransferModal/_views/enterWalletAddress/useHandleTransfer.tsx +5 -1
  99. package/src/react/ui/modals/_internal/components/actionModal/ActionModal.tsx +20 -11
  100. package/src/react/ui/modals/_internal/components/currencyOptionsSelect/__tests__/index.test.tsx +13 -58
  101. package/src/react/ui/modals/_internal/components/priceInput/__tests__/index.test.tsx +2 -0
  102. package/src/react/ui/modals/_internal/components/transactionStatusModal/__tests__/TransactionStatusModal.test.tsx +18 -19
  103. package/src/react/ui/modals/_internal/components/transactionStatusModal/__tests__/utils.test.ts +2 -0
  104. package/src/react/ui/modals/_internal/components/transactionStatusModal/hooks/useTransactionStatus.ts +62 -0
  105. package/src/react/ui/modals/_internal/components/transactionStatusModal/index.tsx +53 -100
  106. package/src/react/ui/modals/_internal/components/transactionStatusModal/store.ts +2 -10
  107. package/tsconfig.tsbuildinfo +1 -1
  108. package/dist/chunk-6R4G7J6Q.js.map +0 -1
  109. package/dist/chunk-7WCZP6FN.js.map +0 -1
  110. package/dist/chunk-AQT3BQ67.js.map +0 -1
  111. package/dist/chunk-FWN2MCLI.js +0 -425
  112. package/dist/chunk-FWN2MCLI.js.map +0 -1
  113. package/dist/chunk-JEOUQFT3.js.map +0 -1
  114. package/dist/chunk-WRMJ5FZM.js.map +0 -1
  115. /package/dist/{chunk-ATDCYXXV.js.map → chunk-6YHHCGGY.js.map} +0 -0
  116. /package/dist/{chunk-XXML5K3X.js.map → chunk-QTJF5GDQ.js.map} +0 -0
@@ -3,13 +3,13 @@ import {
3
3
  ActionModal,
4
4
  CustomSelect,
5
5
  useCurrencyBalance
6
- } from "./chunk-AQT3BQ67.js";
6
+ } from "./chunk-J2XJZ6SJ.js";
7
7
  import {
8
8
  CalendarIcon_default,
9
9
  MinusIcon_default,
10
10
  PlusIcon_default,
11
11
  PositiveCircleIcon_default
12
- } from "./chunk-ATDCYXXV.js";
12
+ } from "./chunk-6YHHCGGY.js";
13
13
  import {
14
14
  actionWrapper,
15
15
  closeButton,
@@ -33,9 +33,11 @@ import {
33
33
  quantityInputWrapper,
34
34
  tokenPreview,
35
35
  transferModalContent
36
- } from "./chunk-2OJB35FS.js";
36
+ } from "./chunk-5NORRVPM.js";
37
37
  import {
38
+ AlertMessage,
38
39
  dateToUnixTime,
40
+ switchChainModal_default,
39
41
  useBalanceOfCollectible,
40
42
  useCollectible,
41
43
  useCollection,
@@ -46,25 +48,19 @@ import {
46
48
  useGenerateListingTransaction,
47
49
  useGenerateOfferTransaction,
48
50
  useGenerateSellTransaction,
49
- useHighestOffer,
50
51
  useListBalances,
51
52
  useLowestListing,
52
53
  useMarketplaceConfig,
53
54
  useRoyaltyPercentage,
54
- useTransferTokens
55
- } from "./chunk-WRMJ5FZM.js";
56
- import {
57
- AlertMessage,
58
- switchChainModal_default,
59
55
  useSwitchChainModal,
56
+ useTransferTokens,
60
57
  useWallet
61
- } from "./chunk-FWN2MCLI.js";
58
+ } from "./chunk-HV2X2VZN.js";
62
59
  import {
63
60
  iconVariants
64
- } from "./chunk-LF44FCG5.js";
61
+ } from "./chunk-TQWM4ER6.js";
65
62
  import {
66
63
  calculatePriceDifferencePercentage,
67
- getPublicRpcClient,
68
64
  truncateMiddle
69
65
  } from "./chunk-XP3WY5AX.js";
70
66
  import {
@@ -75,17 +71,17 @@ import {
75
71
  collectableKeys,
76
72
  getMarketplaceClient,
77
73
  getQueryClient
78
- } from "./chunk-6R4G7J6Q.js";
74
+ } from "./chunk-WSCUPAGR.js";
79
75
  import {
80
76
  InvalidContractTypeError,
81
77
  InvalidStepError
82
78
  } from "./chunk-WM4RGBFQ.js";
83
79
 
84
80
  // src/react/ui/modals/modal-provider.tsx
85
- import { observer as observer12 } from "@legendapp/state/react";
81
+ import { observer as observer11 } from "@legendapp/state/react";
86
82
 
87
83
  // src/react/ui/modals/MakeOfferModal/Modal.tsx
88
- import { Show, observer as observer5 } from "@legendapp/state/react";
84
+ import { Show, observer as observer4 } from "@legendapp/state/react";
89
85
  import { useState as useState6 } from "react";
90
86
  import { parseUnits as parseUnits2 } from "viem";
91
87
 
@@ -147,11 +143,15 @@ import {
147
143
  Skeleton as Skeleton2,
148
144
  Text as Text4
149
145
  } from "@0xsequence/design-system";
150
- import { TRANSACTION_CONFIRMATIONS_DEFAULT } from "@0xsequence/kit";
151
- import { observer as observer2 } from "@legendapp/state/react";
152
- import { Close, Content, Overlay, Portal, Root } from "@radix-ui/react-dialog";
153
- import { useEffect as useEffect2, useState as useState2 } from "react";
154
- import { WaitForTransactionReceiptTimeoutError } from "viem";
146
+ import { use$ } from "@legendapp/state/react";
147
+ import {
148
+ Close,
149
+ Content,
150
+ Overlay,
151
+ Portal,
152
+ Root,
153
+ Title
154
+ } from "@radix-ui/react-dialog";
155
155
 
156
156
  // src/react/ui/modals/_internal/components/transaction-footer/index.tsx
157
157
  import { networks } from "@0xsequence/network";
@@ -263,9 +263,7 @@ var initialState = {
263
263
  collectibleId,
264
264
  type,
265
265
  callbacks,
266
- queriesToInvalidate,
267
- confirmations,
268
- blocked
266
+ queriesToInvalidate
269
267
  }) => {
270
268
  transactionStatusModal$.state.set({
271
269
  ...transactionStatusModal$.state.get(),
@@ -277,9 +275,7 @@ var initialState = {
277
275
  collectibleId,
278
276
  type,
279
277
  callbacks,
280
- queriesToInvalidate,
281
- confirmations,
282
- blocked
278
+ queriesToInvalidate
283
279
  });
284
280
  transactionStatusModal$.isOpen.set(true);
285
281
  },
@@ -299,9 +295,7 @@ var initialState = {
299
295
  collectibleId: "",
300
296
  type: void 0,
301
297
  callbacks: void 0,
302
- queriesToInvalidate: [],
303
- confirmations: -1,
304
- blocked: false
298
+ queriesToInvalidate: []
305
299
  }
306
300
  };
307
301
  var transactionStatusModal$ = observable(initialState);
@@ -574,24 +568,73 @@ function getTransactionStatusModalTitle({
574
568
  }
575
569
  }
576
570
 
571
+ // src/react/ui/modals/_internal/components/transactionStatusModal/hooks/useTransactionStatus.ts
572
+ import { skipToken as skipToken2, useQuery as useQuery2 } from "@tanstack/react-query";
573
+ import { TransactionStatus as IndexerTransactionStatus } from "@0xsequence/indexer";
574
+ import { WaitForTransactionReceiptTimeoutError } from "viem";
575
+ import { useState as useState2, useEffect as useEffect2 } from "react";
576
+ var useTransactionStatus = (hash, chainId, callbacks) => {
577
+ const { wallet } = useWallet();
578
+ const [status, setStatus] = useState2(
579
+ hash ? "PENDING" : "SUCCESS"
580
+ );
581
+ const { data: confirmationResult } = useQuery2({
582
+ queryKey: ["transaction-confirmation", hash, chainId, !!wallet],
583
+ queryFn: !!wallet && hash ? async () => await wallet.handleConfirmTransactionStep(hash, Number(chainId)) : skipToken2
584
+ });
585
+ useEffect2(() => {
586
+ if (!hash) {
587
+ setStatus("SUCCESS");
588
+ return;
589
+ }
590
+ if (!confirmationResult) {
591
+ setStatus("PENDING");
592
+ return;
593
+ }
594
+ try {
595
+ if (confirmationResult.txnStatus === IndexerTransactionStatus.SUCCESSFUL) {
596
+ setStatus("SUCCESS");
597
+ callbacks?.onSuccess?.({ hash: hash || "0x0" });
598
+ return;
599
+ }
600
+ setStatus("FAILED");
601
+ callbacks?.onError?.(new Error("Transaction failed"));
602
+ } catch (error) {
603
+ setStatus(
604
+ error instanceof WaitForTransactionReceiptTimeoutError ? "TIMEOUT" : "FAILED"
605
+ );
606
+ callbacks?.onError?.(error);
607
+ }
608
+ }, [confirmationResult, hash]);
609
+ return status;
610
+ };
611
+ var useTransactionStatus_default = useTransactionStatus;
612
+
577
613
  // src/react/ui/modals/_internal/components/transactionStatusModal/index.tsx
578
614
  import { jsx as jsx4, jsxs as jsxs3 } from "react/jsx-runtime";
615
+ var invalidateQueries = async (queriesToInvalidate) => {
616
+ const queryClient = getQueryClient();
617
+ if (!queriesToInvalidate) {
618
+ queryClient.invalidateQueries();
619
+ return;
620
+ }
621
+ for (const queryKey of queriesToInvalidate) {
622
+ await queryClient.invalidateQueries({ queryKey });
623
+ }
624
+ };
579
625
  var useTransactionStatusModal = () => {
580
626
  return {
581
627
  show: (args) => {
582
- if (args.blocked) return;
583
628
  transactionStatusModal$.open(args);
584
629
  },
585
630
  close: () => transactionStatusModal$.close()
586
631
  };
587
632
  };
588
- var invalidateQueries = async (queriesToInvalidate) => {
589
- const queryClient = getQueryClient();
590
- for (const queryKey of queriesToInvalidate) {
591
- await queryClient.invalidateQueries({ queryKey });
592
- }
633
+ var TransactionStatusModal = () => {
634
+ const isOpen = use$(transactionStatusModal$.isOpen);
635
+ return isOpen ? /* @__PURE__ */ jsx4(Modal, {}) : null;
593
636
  };
594
- var TransactionStatusModal = observer2(() => {
637
+ function Modal() {
595
638
  const {
596
639
  type,
597
640
  hash,
@@ -601,64 +644,14 @@ var TransactionStatusModal = observer2(() => {
601
644
  chainId,
602
645
  collectibleId,
603
646
  callbacks,
604
- queriesToInvalidate,
605
- confirmations
606
- } = transactionStatusModal$.state.get();
647
+ queriesToInvalidate
648
+ } = use$(transactionStatusModal$.state);
607
649
  const { data: collectible, isLoading: collectibleLoading } = useCollectible({
608
650
  collectionAddress,
609
651
  chainId,
610
652
  collectibleId
611
653
  });
612
- const [transactionStatus, setTransactionStatus] = useState2(
613
- orderId ? "SUCCESS" : "PENDING"
614
- );
615
- const queryClient = getQueryClient();
616
- const publicClient = chainId ? getPublicRpcClient(chainId) : null;
617
- const waitForTransactionReceiptPromise = publicClient?.waitForTransactionReceipt({
618
- confirmations: confirmations || TRANSACTION_CONFIRMATIONS_DEFAULT,
619
- hash: hash || "0x"
620
- });
621
- useEffect2(() => {
622
- if (!transactionStatusModal$.isOpen.get() || orderId) return;
623
- console.log("Waiting for transaction receipt ...");
624
- waitForTransactionReceiptPromise?.then((receipt) => {
625
- if (receipt.status === "success") {
626
- console.log("receipt", receipt);
627
- setTransactionStatus("SUCCESS");
628
- if (callbacks?.onSuccess) {
629
- callbacks.onSuccess({ hash: hash || "0x0" });
630
- } else {
631
- console.debug("onSuccess callback not provided:", hash);
632
- }
633
- if (queriesToInvalidate) {
634
- invalidateQueries(queriesToInvalidate);
635
- } else {
636
- queryClient.invalidateQueries();
637
- }
638
- }
639
- }).catch((error) => {
640
- if (callbacks?.onError) {
641
- callbacks.onError(error);
642
- } else {
643
- console.debug("onError callback not provided:", error);
644
- }
645
- if (error instanceof WaitForTransactionReceiptTimeoutError) {
646
- setTransactionStatus("TIMEOUT");
647
- return;
648
- }
649
- setTransactionStatus("FAILED");
650
- });
651
- return () => {
652
- setTransactionStatus("PENDING");
653
- };
654
- }, [
655
- callbacks?.onSuccess,
656
- callbacks?.onError,
657
- transactionStatusModal$.isOpen.get()
658
- ]);
659
- if (!type) {
660
- return null;
661
- }
654
+ const transactionStatus = useTransactionStatus_default(hash, chainId, callbacks);
662
655
  const title = getTransactionStatusModalTitle({
663
656
  transactionStatus,
664
657
  transactionType: type,
@@ -671,7 +664,7 @@ var TransactionStatusModal = observer2(() => {
671
664
  orderId,
672
665
  price
673
666
  });
674
- return /* @__PURE__ */ jsx4(Root, { open: transactionStatusModal$.isOpen.get(), children: /* @__PURE__ */ jsxs3(Portal, { container: getProviderEl(), children: [
667
+ return /* @__PURE__ */ jsx4(Root, { open: true, children: /* @__PURE__ */ jsxs3(Portal, { container: getProviderEl(), children: [
675
668
  /* @__PURE__ */ jsx4(Overlay, { className: dialogOverlay3 }),
676
669
  /* @__PURE__ */ jsxs3(
677
670
  Content,
@@ -679,7 +672,7 @@ var TransactionStatusModal = observer2(() => {
679
672
  className: transactionStatusModalContent,
680
673
  "data-testid": "transaction-status-modal",
681
674
  children: [
682
- title ? /* @__PURE__ */ jsx4(
675
+ /* @__PURE__ */ jsx4(Title, { asChild: true, children: title ? /* @__PURE__ */ jsx4(
683
676
  Text4,
684
677
  {
685
678
  fontSize: "large",
@@ -696,7 +689,7 @@ var TransactionStatusModal = observer2(() => {
696
689
  height: "6",
697
690
  "data-testid": "transaction-modal-title-skeleton"
698
691
  }
699
- ),
692
+ ) }),
700
693
  message ? /* @__PURE__ */ jsx4(
701
694
  Text4,
702
695
  {
@@ -746,6 +739,7 @@ var TransactionStatusModal = observer2(() => {
746
739
  Close,
747
740
  {
748
741
  onClick: () => {
742
+ invalidateQueries(queriesToInvalidate);
749
743
  transactionStatusModal$.close();
750
744
  },
751
745
  className: closeButton3,
@@ -757,7 +751,7 @@ var TransactionStatusModal = observer2(() => {
757
751
  }
758
752
  )
759
753
  ] }) });
760
- });
754
+ }
761
755
  var transactionStatusModal_default = TransactionStatusModal;
762
756
 
763
757
  // src/react/ui/modals/MakeOfferModal/hooks/useTransactionSteps.tsx
@@ -1031,7 +1025,7 @@ var LoadingModal = ({
1031
1025
 
1032
1026
  // src/react/ui/modals/_internal/components/expirationDateSelect/index.tsx
1033
1027
  import { Box as Box6, Skeleton as Skeleton3, Text as Text5 } from "@0xsequence/design-system";
1034
- import { observer as observer3 } from "@legendapp/state/react";
1028
+ import { observer as observer2 } from "@legendapp/state/react";
1035
1029
  import { addDays } from "date-fns";
1036
1030
 
1037
1031
  // src/react/ui/modals/_internal/components/calendarPopover/index.tsx
@@ -1155,7 +1149,7 @@ var PRESET_RANGES = {
1155
1149
  offset: 30
1156
1150
  }
1157
1151
  };
1158
- var ExpirationDateSelect = observer3(function ExpirationDateSelect2({
1152
+ var ExpirationDateSelect = observer2(function ExpirationDateSelect2({
1159
1153
  className,
1160
1154
  $date
1161
1155
  }) {
@@ -1333,10 +1327,10 @@ var currencyImage_default = CurrencyImage;
1333
1327
 
1334
1328
  // src/react/ui/modals/_internal/components/currencyOptionsSelect/index.tsx
1335
1329
  import { Skeleton as Skeleton4 } from "@0xsequence/design-system";
1336
- import { observer as observer4 } from "@legendapp/state/react";
1330
+ import { observer as observer3 } from "@legendapp/state/react";
1337
1331
  import { useEffect as useEffect4 } from "react";
1338
1332
  import { jsx as jsx12 } from "react/jsx-runtime";
1339
- var CurrencyOptionsSelect = observer4(function CurrencyOptionsSelect2({
1333
+ var CurrencyOptionsSelect = observer3(function CurrencyOptionsSelect2({
1340
1334
  chainId,
1341
1335
  collectionAddress,
1342
1336
  secondCurrencyAsDefault,
@@ -1390,7 +1384,7 @@ var CurrencyOptionsSelect = observer4(function CurrencyOptionsSelect2({
1390
1384
  var currencyOptionsSelect_default = CurrencyOptionsSelect;
1391
1385
 
1392
1386
  // src/react/ui/modals/_internal/components/priceInput/index.tsx
1393
- import { use$ } from "@legendapp/state/react";
1387
+ import { use$ as use$2 } from "@legendapp/state/react";
1394
1388
  import { useState as useState5 } from "react";
1395
1389
  import { jsx as jsx13, jsxs as jsxs6 } from "react/jsx-runtime";
1396
1390
  function PriceInput({
@@ -1403,9 +1397,9 @@ function PriceInput({
1403
1397
  includeNativeCurrency
1404
1398
  }) {
1405
1399
  const { address: accountAddress } = useAccount();
1406
- const currencyDecimals = use$($price.currency.decimals);
1407
- const currencyAddress = use$($price.currency.contractAddress);
1408
- const priceAmountRaw = use$($price.amountRaw);
1400
+ const currencyDecimals = use$2($price.currency.decimals);
1401
+ const currencyAddress = use$2($price.currency.contractAddress);
1402
+ const priceAmountRaw = use$2($price.amountRaw);
1409
1403
  const { data: balance, isSuccess: isBalanceSuccess } = useCurrencyBalance({
1410
1404
  currencyAddress,
1411
1405
  chainId: Number(chainId),
@@ -1712,9 +1706,9 @@ var makeOfferModal$ = observable2({
1712
1706
  // src/react/ui/modals/MakeOfferModal/Modal.tsx
1713
1707
  import { Fragment, jsx as jsx16, jsxs as jsxs9 } from "react/jsx-runtime";
1714
1708
  var MakeOfferModal = () => {
1715
- return /* @__PURE__ */ jsx16(Show, { if: makeOfferModal$.isOpen, children: () => /* @__PURE__ */ jsx16(Modal, {}) });
1709
+ return /* @__PURE__ */ jsx16(Show, { if: makeOfferModal$.isOpen, children: () => /* @__PURE__ */ jsx16(Modal2, {}) });
1716
1710
  };
1717
- var Modal = observer5(() => {
1711
+ var Modal2 = observer4(() => {
1718
1712
  const state = makeOfferModal$.get();
1719
1713
  const {
1720
1714
  collectionAddress,
@@ -1883,7 +1877,7 @@ var Modal = observer5(() => {
1883
1877
  });
1884
1878
 
1885
1879
  // src/react/ui/modals/SellModal/Modal.tsx
1886
- import { Show as Show2, observer as observer6 } from "@legendapp/state/react";
1880
+ import { Show as Show2, observer as observer5 } from "@legendapp/state/react";
1887
1881
  import { parseUnits as parseUnits3 } from "viem";
1888
1882
 
1889
1883
  // src/react/ui/modals/_internal/components/transactionDetails/index.tsx
@@ -2014,7 +2008,7 @@ var initialState3 = {
2014
2008
  var sellModal$ = observable3(initialState3);
2015
2009
 
2016
2010
  // src/react/ui/modals/SellModal/hooks/useGetTokenApproval.tsx
2017
- import { useQuery as useQuery2 } from "@tanstack/react-query";
2011
+ import { useQuery as useQuery3 } from "@tanstack/react-query";
2018
2012
 
2019
2013
  // src/react/ui/modals/BuyModal/hooks/useFees.ts
2020
2014
  import { avalanche, optimism } from "viem/chains";
@@ -2049,7 +2043,7 @@ var useGetTokenApprovalData2 = (params) => {
2049
2043
  chainId: Number(params.chainId),
2050
2044
  collectionAddress: params.collectionAddress
2051
2045
  });
2052
- const { data, isLoading, isSuccess } = useQuery2({
2046
+ const { data, isLoading, isSuccess } = useQuery3({
2053
2047
  queryKey: ["token-approval-data", params.ordersData],
2054
2048
  queryFn: async () => {
2055
2049
  const address = await wallet.address();
@@ -2282,9 +2276,9 @@ var useSell = ({
2282
2276
  // src/react/ui/modals/SellModal/Modal.tsx
2283
2277
  import { jsx as jsx19, jsxs as jsxs12 } from "react/jsx-runtime";
2284
2278
  var SellModal = () => {
2285
- return /* @__PURE__ */ jsx19(Show2, { if: sellModal$.isOpen, children: () => /* @__PURE__ */ jsx19(Modal2, {}) });
2279
+ return /* @__PURE__ */ jsx19(Show2, { if: sellModal$.isOpen, children: () => /* @__PURE__ */ jsx19(Modal3, {}) });
2286
2280
  };
2287
- var Modal2 = observer6(() => {
2281
+ var Modal3 = observer5(() => {
2288
2282
  const { tokenId, collectionAddress, chainId, order, callbacks } = sellModal$.get();
2289
2283
  const steps$ = sellModal$.steps;
2290
2284
  const { data: collectible } = useCollection({
@@ -2417,7 +2411,7 @@ import {
2417
2411
  Image as Image5,
2418
2412
  Text as Text11
2419
2413
  } from "@0xsequence/design-system";
2420
- import { observer as observer7 } from "@legendapp/state/react";
2414
+ import { observer as observer6 } from "@legendapp/state/react";
2421
2415
  import { Close as Close2, Content as Content3, Overlay as Overlay2, Portal as Portal3, Root as Root3 } from "@radix-ui/react-dialog";
2422
2416
 
2423
2417
  // src/react/ui/modals/SuccessfulPurchaseModal/_store.ts
@@ -2470,7 +2464,7 @@ var useSuccessfulPurchaseModal = (callbacks) => {
2470
2464
  close: () => successfulPurchaseModal$.close()
2471
2465
  };
2472
2466
  };
2473
- var SuccessfulPurchaseModal = observer7(() => {
2467
+ var SuccessfulPurchaseModal = observer6(() => {
2474
2468
  return /* @__PURE__ */ jsx20(Root3, { open: successfulPurchaseModal$.isOpen.get(), children: /* @__PURE__ */ jsxs13(Portal3, { children: [
2475
2469
  /* @__PURE__ */ jsx20(Overlay2, { className: dialogOverlay }),
2476
2470
  /* @__PURE__ */ jsxs13(Content3, { className: dialogContent.narrow, children: [
@@ -2604,7 +2598,7 @@ var SuccessfulPurchaseModal_default = SuccessfulPurchaseModal;
2604
2598
 
2605
2599
  // src/react/ui/modals/TransferModal/index.tsx
2606
2600
  import { CloseIcon as CloseIcon3, IconButton as IconButton4 } from "@0xsequence/design-system";
2607
- import { Show as Show3, observer as observer9 } from "@legendapp/state/react";
2601
+ import { Show as Show3, observer as observer8 } from "@legendapp/state/react";
2608
2602
  import { Close as Close3, Content as Content4, Overlay as Overlay3, Portal as Portal4, Root as Root4 } from "@radix-ui/react-dialog";
2609
2603
  import { useAccount as useAccount3 } from "wagmi";
2610
2604
 
@@ -2708,7 +2702,11 @@ var useHandleTransfer = () => {
2708
2702
  collectibleId,
2709
2703
  price: void 0,
2710
2704
  type: "TRANSFER" /* TRANSFER */,
2711
- queriesToInvalidate: [balanceQueries.all, collectableKeys.userBalances]
2705
+ queriesToInvalidate: [
2706
+ balanceQueries.all,
2707
+ balanceQueries.collectionBalanceDetails,
2708
+ collectableKeys.userBalances
2709
+ ]
2712
2710
  });
2713
2711
  } catch (error) {
2714
2712
  transferModal$.view.set("enterReceiverAddress");
@@ -2816,9 +2814,9 @@ var enterWalletAddress_default = EnterWalletAddressView;
2816
2814
 
2817
2815
  // src/react/ui/modals/TransferModal/_views/followWalletInstructions/index.tsx
2818
2816
  import { Box as Box15, Button as Button4, Text as Text13 } from "@0xsequence/design-system";
2819
- import { observer as observer8 } from "@legendapp/state/react";
2817
+ import { observer as observer7 } from "@legendapp/state/react";
2820
2818
  import { jsx as jsx22, jsxs as jsxs15 } from "react/jsx-runtime";
2821
- var FollowWalletInstructionsView = observer8(() => {
2819
+ var FollowWalletInstructionsView = observer7(() => {
2822
2820
  return /* @__PURE__ */ jsxs15(Box15, { display: "grid", gap: "6", flexGrow: "1", children: [
2823
2821
  /* @__PURE__ */ jsx22(Text13, { color: "white", fontSize: "large", fontWeight: "bold", fontFamily: "body", children: "Transfer your item" }),
2824
2822
  /* @__PURE__ */ jsx22(Box15, { display: "flex", flexDirection: "column", gap: "3", children: /* @__PURE__ */ jsx22(
@@ -2882,12 +2880,12 @@ var useTransferModal = () => {
2882
2880
  };
2883
2881
  };
2884
2882
  var TransferModal = () => {
2885
- return /* @__PURE__ */ jsx23(Show3, { if: transferModal$.isOpen, children: /* @__PURE__ */ jsx23(Modal3, {}) });
2883
+ return /* @__PURE__ */ jsx23(Show3, { if: transferModal$.isOpen, children: /* @__PURE__ */ jsx23(Modal4, {}) });
2886
2884
  };
2887
- var Modal3 = () => {
2885
+ var Modal4 = () => {
2888
2886
  return /* @__PURE__ */ jsx23(ModalContent, {});
2889
2887
  };
2890
- var ModalContent = observer9(() => {
2888
+ var ModalContent = observer8(() => {
2891
2889
  return /* @__PURE__ */ jsx23(Root4, { open: true, children: /* @__PURE__ */ jsxs16(Portal4, { children: [
2892
2890
  /* @__PURE__ */ jsx23(Overlay3, { className: dialogOverlay2 }),
2893
2891
  /* @__PURE__ */ jsxs16(Content4, { className: transferModalContent, children: [
@@ -2896,7 +2894,7 @@ var ModalContent = observer9(() => {
2896
2894
  ] })
2897
2895
  ] }) });
2898
2896
  });
2899
- var TransactionModalView = observer9(() => {
2897
+ var TransactionModalView = observer8(() => {
2900
2898
  const { view } = transferModal$.get();
2901
2899
  switch (view) {
2902
2900
  case "enterReceiverAddress":
@@ -2910,7 +2908,7 @@ var TransactionModalView = observer9(() => {
2910
2908
 
2911
2909
  // src/react/ui/modals/CreateListingModal/Modal.tsx
2912
2910
  import { Box as Box16 } from "@0xsequence/design-system";
2913
- import { Show as Show4, observer as observer10 } from "@legendapp/state/react";
2911
+ import { Show as Show4, observer as observer9 } from "@legendapp/state/react";
2914
2912
  import { parseUnits as parseUnits4 } from "viem";
2915
2913
  import { useAccount as useAccount4 } from "wagmi";
2916
2914
 
@@ -2975,7 +2973,7 @@ var createListingModal$ = observable7({
2975
2973
  import { useEffect as useEffect6 } from "react";
2976
2974
 
2977
2975
  // src/react/ui/modals/CreateListingModal/hooks/useGetTokenApproval.ts
2978
- import { skipToken as skipToken2, useQuery as useQuery3 } from "@tanstack/react-query";
2976
+ import { skipToken as skipToken3, useQuery as useQuery4 } from "@tanstack/react-query";
2979
2977
  var ONE_DAY_IN_SECONDS2 = 60 * 60 * 24;
2980
2978
  var useGetTokenApprovalData3 = (params) => {
2981
2979
  const config = useConfig();
@@ -2989,7 +2987,7 @@ var useGetTokenApprovalData3 = (params) => {
2989
2987
  expiry: String(Number(dateToUnixTime(/* @__PURE__ */ new Date())) + ONE_DAY_IN_SECONDS2)
2990
2988
  };
2991
2989
  const isEnabled = wallet && params.query?.enabled !== false;
2992
- const { data, isLoading, isSuccess } = useQuery3({
2990
+ const { data, isLoading, isSuccess } = useQuery4({
2993
2991
  queryKey: ["token-approval-data", params.currencyAddress],
2994
2992
  queryFn: isEnabled ? async () => {
2995
2993
  const args = {
@@ -3012,7 +3010,7 @@ var useGetTokenApprovalData3 = (params) => {
3012
3010
  return {
3013
3011
  step: tokenApprovalStep
3014
3012
  };
3015
- } : skipToken2
3013
+ } : skipToken3
3016
3014
  });
3017
3015
  return {
3018
3016
  data,
@@ -3224,9 +3222,9 @@ var useCreateListing = ({
3224
3222
  // src/react/ui/modals/CreateListingModal/Modal.tsx
3225
3223
  import { jsx as jsx24, jsxs as jsxs17 } from "react/jsx-runtime";
3226
3224
  var CreateListingModal = () => {
3227
- return /* @__PURE__ */ jsx24(Show4, { if: createListingModal$.isOpen, children: () => /* @__PURE__ */ jsx24(Modal4, {}) });
3225
+ return /* @__PURE__ */ jsx24(Show4, { if: createListingModal$.isOpen, children: () => /* @__PURE__ */ jsx24(Modal5, {}) });
3228
3226
  };
3229
- var Modal4 = observer10(() => {
3227
+ var Modal5 = observer9(() => {
3230
3228
  const state = createListingModal$.get();
3231
3229
  const {
3232
3230
  collectionAddress,
@@ -3246,6 +3244,16 @@ var Modal4 = observer10(() => {
3246
3244
  collectionAddress,
3247
3245
  collectibleId
3248
3246
  });
3247
+ const currencyOptions = useCurrencyOptions({ collectionAddress });
3248
+ const {
3249
+ data: currencies,
3250
+ isLoading: currenciesLoading,
3251
+ isError: currenciesIsError
3252
+ } = useCurrencies({
3253
+ chainId,
3254
+ currencyOptions,
3255
+ includeNativeCurrency: true
3256
+ });
3249
3257
  const {
3250
3258
  data: collection,
3251
3259
  isLoading: collectionIsLoading,
@@ -3282,7 +3290,7 @@ var Modal4 = observer10(() => {
3282
3290
  closeMainModal: () => createListingModal$.close(),
3283
3291
  steps$
3284
3292
  });
3285
- if (collectableIsLoading || collectionIsLoading) {
3293
+ if (collectableIsLoading || collectionIsLoading || currenciesLoading) {
3286
3294
  return /* @__PURE__ */ jsx24(
3287
3295
  LoadingModal,
3288
3296
  {
@@ -3293,7 +3301,7 @@ var Modal4 = observer10(() => {
3293
3301
  }
3294
3302
  );
3295
3303
  }
3296
- if (collectableIsError || collectionIsError) {
3304
+ if (collectableIsError || collectionIsError || currenciesIsError) {
3297
3305
  return /* @__PURE__ */ jsx24(
3298
3306
  ErrorModal,
3299
3307
  {
@@ -3304,6 +3312,18 @@ var Modal4 = observer10(() => {
3304
3312
  }
3305
3313
  );
3306
3314
  }
3315
+ if (!currencies || currencies.length === 0) {
3316
+ return /* @__PURE__ */ jsx24(
3317
+ ErrorModal,
3318
+ {
3319
+ isOpen: createListingModal$.isOpen.get(),
3320
+ chainId: Number(chainId),
3321
+ onClose: createListingModal$.close,
3322
+ title: "List item for sale",
3323
+ message: "No currencies are configured for the marketplace, contact the marketplace owners"
3324
+ }
3325
+ );
3326
+ }
3307
3327
  const ctas = [
3308
3328
  {
3309
3329
  label: "Approve TOKEN",
@@ -3384,10 +3404,17 @@ var Modal4 = observer10(() => {
3384
3404
  });
3385
3405
 
3386
3406
  // src/react/ui/modals/BuyModal/Modal.tsx
3387
- import { use$ as use$2 } from "@legendapp/state/react";
3407
+ import { use$ as use$3 } from "@legendapp/state/react";
3388
3408
 
3389
3409
  // src/react/ui/modals/BuyModal/store.ts
3390
3410
  import { observable as observable8 } from "@legendapp/state";
3411
+ var buyState = {
3412
+ order: void 0,
3413
+ quantity: "1",
3414
+ invalidQuantity: false,
3415
+ checkoutModalIsLoading: false,
3416
+ checkoutModalLoaded: false
3417
+ };
3391
3418
  var initialState7 = {
3392
3419
  isOpen: false,
3393
3420
  open: ({
@@ -3398,7 +3425,6 @@ var initialState7 = {
3398
3425
  buyModal$.state.set({
3399
3426
  quantity: args.order.quantityAvailableFormatted,
3400
3427
  order: args.order,
3401
- modalId: buyModal$.state.modalId.get() + 1,
3402
3428
  invalidQuantity: false,
3403
3429
  checkoutModalIsLoading: false,
3404
3430
  checkoutModalLoaded: false
@@ -3408,15 +3434,10 @@ var initialState7 = {
3408
3434
  },
3409
3435
  close: () => {
3410
3436
  buyModal$.isOpen.set(false);
3437
+ buyModal$.callbacks.set(void 0);
3438
+ buyModal$.state.set(buyState);
3411
3439
  },
3412
- state: {
3413
- order: void 0,
3414
- quantity: "1",
3415
- modalId: 0,
3416
- invalidQuantity: false,
3417
- checkoutModalIsLoading: false,
3418
- checkoutModalLoaded: false
3419
- },
3440
+ state: buyState,
3420
3441
  setCheckoutModalIsLoading: (isLoading) => {
3421
3442
  buyModal$.state.checkoutModalIsLoading.set(isLoading);
3422
3443
  },
@@ -3449,25 +3470,19 @@ function CheckoutModal({ buy, collectable, order }) {
3449
3470
 
3450
3471
  // src/react/ui/modals/BuyModal/modals/Modal1155.tsx
3451
3472
  import { Box as Box17, Text as Text14, TokenImage as TokenImage2 } from "@0xsequence/design-system";
3452
- import { observer as observer11 } from "@legendapp/state/react";
3473
+ import { observer as observer10 } from "@legendapp/state/react";
3453
3474
  import { formatUnits as formatUnits4, parseUnits as parseUnits6 } from "viem";
3454
- import { jsx as jsx25, jsxs as jsxs18 } from "react/jsx-runtime";
3455
- var ERC1155QuantityModal = observer11(
3475
+ import { Fragment as Fragment3, jsx as jsx25, jsxs as jsxs18 } from "react/jsx-runtime";
3476
+ var ERC1155QuantityModal = observer10(
3456
3477
  ({ buy, collectable, order }) => {
3457
- const currencyOptions = useCurrencyOptions({
3458
- collectionAddress: order.collectionContractAddress
3459
- });
3460
- const { data: currencies } = useCurrencies({
3478
+ const { data: currency, isLoading: isCurrencyLoading } = useCurrency({
3461
3479
  chainId: order.chainId,
3462
- currencyOptions
3480
+ currencyAddress: order.priceCurrencyAddress
3463
3481
  });
3464
- const currency = currencies?.find(
3465
- (currency2) => currency2.contractAddress === order.priceCurrencyAddress
3466
- );
3467
3482
  const quantity = Number(buyModal$.state.quantity.get());
3468
3483
  const pricePerToken = order.priceAmount;
3469
3484
  const totalPrice = (BigInt(quantity) * BigInt(pricePerToken)).toString();
3470
- if (buyModal$.state.checkoutModalLoaded.get()) {
3485
+ if (buyModal$.state.checkoutModalLoaded.get() && buyModal$.isOpen.get() && buyModal$.state.checkoutModalIsLoading.get()) {
3471
3486
  return null;
3472
3487
  }
3473
3488
  return /* @__PURE__ */ jsx25(
@@ -3507,11 +3522,21 @@ var ERC1155QuantityModal = observer11(
3507
3522
  }
3508
3523
  ),
3509
3524
  /* @__PURE__ */ jsxs18(Box17, { display: "flex", justifyContent: "space-between", children: [
3510
- /* @__PURE__ */ jsx25(Text14, { color: "text50", fontSize: "small", children: "Total Price" }),
3511
- /* @__PURE__ */ jsxs18(Box17, { display: "flex", alignItems: "center", gap: "2", children: [
3512
- /* @__PURE__ */ jsx25(TokenImage2, { src: currency?.imageUrl, size: "xs" }),
3513
- /* @__PURE__ */ jsx25(Text14, { color: "text100", fontSize: "small", fontWeight: "bold", children: formatUnits4(BigInt(totalPrice), currency?.decimals || 0) })
3514
- ] })
3525
+ /* @__PURE__ */ jsx25(Text14, { color: "text50", fontSize: "small", fontFamily: "body", children: "Total Price" }),
3526
+ /* @__PURE__ */ jsx25(Box17, { display: "flex", alignItems: "center", gap: "2", children: isCurrencyLoading || !currency ? /* @__PURE__ */ jsx25(Box17, { display: "flex", alignItems: "center", gap: "2", children: /* @__PURE__ */ jsx25(Text14, { color: "text50", fontSize: "small", fontFamily: "body", children: "Loading..." }) }) : /* @__PURE__ */ jsxs18(Fragment3, { children: [
3527
+ currency.imageUrl && /* @__PURE__ */ jsx25(TokenImage2, { src: currency.imageUrl, size: "xs" }),
3528
+ /* @__PURE__ */ jsx25(
3529
+ Text14,
3530
+ {
3531
+ color: "text100",
3532
+ fontSize: "small",
3533
+ fontWeight: "bold",
3534
+ fontFamily: "body",
3535
+ children: formatUnits4(BigInt(totalPrice), currency.decimals || 0)
3536
+ }
3537
+ ),
3538
+ /* @__PURE__ */ jsx25(Text14, { color: "text80", fontSize: "small", fontFamily: "body", children: currency?.symbol })
3539
+ ] }) })
3515
3540
  ] })
3516
3541
  ] })
3517
3542
  }
@@ -3520,7 +3545,7 @@ var ERC1155QuantityModal = observer11(
3520
3545
  );
3521
3546
 
3522
3547
  // src/react/ui/modals/BuyModal/hooks/useCheckoutOptions.ts
3523
- import { useQuery as useQuery4 } from "@tanstack/react-query";
3548
+ import { skipToken as skipToken4, useQuery as useQuery5 } from "@tanstack/react-query";
3524
3549
  var useCheckoutOptions = (input) => {
3525
3550
  const config = useConfig();
3526
3551
  const { wallet } = useWallet();
@@ -3528,7 +3553,7 @@ var useCheckoutOptions = (input) => {
3528
3553
  chainId: input.chainId,
3529
3554
  collectionAddress: input.collectionAddress
3530
3555
  });
3531
- return useQuery4({
3556
+ return useQuery5({
3532
3557
  queryKey: [
3533
3558
  "checkoutOptions",
3534
3559
  input.chainId,
@@ -3536,7 +3561,7 @@ var useCheckoutOptions = (input) => {
3536
3561
  input.orderId,
3537
3562
  input.marketplace
3538
3563
  ],
3539
- queryFn: async () => {
3564
+ queryFn: wallet ? async () => {
3540
3565
  const marketplaceClient = getMarketplaceClient(input.chainId, config);
3541
3566
  return marketplaceClient.checkoutOptionsMarketplace({
3542
3567
  wallet: await wallet.address(),
@@ -3549,7 +3574,7 @@ var useCheckoutOptions = (input) => {
3549
3574
  ],
3550
3575
  additionalFee: Number(fees.amount)
3551
3576
  }).then((res) => res.options);
3552
- },
3577
+ } : skipToken4,
3553
3578
  enabled: !!wallet
3554
3579
  });
3555
3580
  };
@@ -3667,17 +3692,19 @@ var useBuyCollectable = ({
3667
3692
  enableSwapPayments: !!input.checkoutOptions.swap,
3668
3693
  creditCardProviders: input.checkoutOptions.nftCheckout || [],
3669
3694
  onSuccess: (hash) => {
3695
+ callbacks?.onSuccess?.({ hash });
3696
+ },
3697
+ onError: callbacks?.onError,
3698
+ onClose: () => {
3670
3699
  invalidateQueries2([
3671
3700
  collectableKeys.listings,
3701
+ collectableKeys.lowestListings,
3672
3702
  collectableKeys.listingsCount,
3673
3703
  collectableKeys.lists,
3674
3704
  collectableKeys.userBalances,
3675
- balanceQueries.all
3705
+ balanceQueries.all,
3706
+ balanceQueries.collectionBalanceDetails
3676
3707
  ]);
3677
- callbacks?.onSuccess?.({ hash });
3678
- },
3679
- onError: callbacks?.onError,
3680
- onClose: () => {
3681
3708
  buyModal$.close();
3682
3709
  }
3683
3710
  });
@@ -3688,23 +3715,22 @@ var useBuyCollectable = ({
3688
3715
  // src/react/ui/modals/BuyModal/Modal.tsx
3689
3716
  import { jsx as jsx26 } from "react/jsx-runtime";
3690
3717
  var BuyModal = () => {
3691
- const isOpen = use$2(buyModal$.isOpen);
3718
+ const isOpen = use$3(buyModal$.isOpen);
3692
3719
  if (!isOpen) return null;
3693
3720
  return /* @__PURE__ */ jsx26(BuyModalContent, {});
3694
3721
  };
3695
3722
  var BuyModalContent = () => {
3696
- const chainId = String(use$2(buyModal$.state.order.chainId));
3697
- const collectionAddress = use$2(
3723
+ const chainId = String(use$3(buyModal$.state.order.chainId));
3724
+ const collectionAddress = use$3(
3698
3725
  buyModal$.state.order.collectionContractAddress
3699
3726
  );
3700
- const collectibleId = use$2(buyModal$.state.order.tokenId);
3701
- const modalId = use$2(buyModal$.state.modalId);
3702
- const callbacks = use$2(buyModal$.callbacks);
3703
- const order = use$2(buyModal$.state.order);
3704
- const isOpen = use$2(buyModal$.isOpen);
3705
- const checkoutModalIsLoading = use$2(buyModal$.state.checkoutModalIsLoading);
3706
- const setCheckoutModalIsLoading = use$2(buyModal$.setCheckoutModalIsLoading);
3707
- const setCheckoutModalLoaded = use$2(buyModal$.setCheckoutModalLoaded);
3727
+ const collectibleId = use$3(buyModal$.state.order.tokenId);
3728
+ const callbacks = use$3(buyModal$.callbacks);
3729
+ const order = use$3(buyModal$.state.order);
3730
+ const isOpen = use$3(buyModal$.isOpen);
3731
+ const checkoutModalIsLoading = use$3(buyModal$.state.checkoutModalIsLoading);
3732
+ const setCheckoutModalIsLoading = use$3(buyModal$.setCheckoutModalIsLoading);
3733
+ const setCheckoutModalLoaded = use$3(buyModal$.setCheckoutModalLoaded);
3708
3734
  const { collection, collectable, checkoutOptions, isLoading, isError } = useLoadData({
3709
3735
  chainId: Number(chainId),
3710
3736
  collectionAddress,
@@ -3760,8 +3786,7 @@ var BuyModalContent = () => {
3760
3786
  buy: buyAction,
3761
3787
  collectable,
3762
3788
  order
3763
- },
3764
- modalId
3789
+ }
3765
3790
  ) : /* @__PURE__ */ jsx26(
3766
3791
  ERC1155QuantityModal,
3767
3792
  {
@@ -3776,9 +3801,9 @@ var BuyModalContent = () => {
3776
3801
  };
3777
3802
 
3778
3803
  // src/react/ui/modals/modal-provider.tsx
3779
- import { Fragment as Fragment3, jsx as jsx27, jsxs as jsxs19 } from "react/jsx-runtime";
3780
- var ModalProvider = observer12(() => {
3781
- return /* @__PURE__ */ jsxs19(Fragment3, { children: [
3804
+ import { Fragment as Fragment4, jsx as jsx27, jsxs as jsxs19 } from "react/jsx-runtime";
3805
+ var ModalProvider = observer11(() => {
3806
+ return /* @__PURE__ */ jsxs19(Fragment4, { children: [
3782
3807
  /* @__PURE__ */ jsx27(CreateListingModal, {}),
3783
3808
  /* @__PURE__ */ jsx27(MakeOfferModal, {}),
3784
3809
  /* @__PURE__ */ jsx27(TransferModal, {}),
@@ -3822,8 +3847,7 @@ var useBuyModal = (callbacks) => {
3822
3847
 
3823
3848
  // src/react/ui/components/collectible-card/CollectibleCard.tsx
3824
3849
  import { useState as useState7 } from "react";
3825
- import { Box as Box21, IconButton as IconButton6, Skeleton as Skeleton8 } from "@0xsequence/design-system";
3826
- import { useAccount as useAccount6 } from "wagmi";
3850
+ import { Box as Box22, IconButton as IconButton6, Skeleton as Skeleton8 } from "@0xsequence/design-system";
3827
3851
 
3828
3852
  // src/react/ui/icons/DiamondEye.tsx
3829
3853
  import { Box as Box18 } from "@0xsequence/design-system";
@@ -3865,127 +3889,361 @@ var SvgDiamondEyeIcon = ({ size = "sm", ...props }) => /* @__PURE__ */ jsx28(
3865
3889
  var DiamondEye_default = SvgDiamondEyeIcon;
3866
3890
 
3867
3891
  // src/react/ui/components/_internals/action-button/ActionButton.tsx
3892
+ import { observer as observer12 } from "@legendapp/state/react";
3893
+
3894
+ // src/react/ui/components/_internals/action-button/hooks/useActionButtonLogic.ts
3895
+ import { useEffect as useEffect8 } from "react";
3896
+ import { useAccount as useAccount5 } from "wagmi";
3897
+
3898
+ // src/react/ui/components/_internals/action-button/store.ts
3899
+ import { observable as observable9 } from "@legendapp/state";
3900
+ var actionButtonStore = observable9({
3901
+ pendingAction: null
3902
+ });
3903
+ var setPendingAction = (type, callback, collectibleId) => {
3904
+ actionButtonStore.pendingAction.set({
3905
+ type,
3906
+ callback,
3907
+ timestamp: Date.now(),
3908
+ collectibleId
3909
+ });
3910
+ };
3911
+ var clearPendingAction = () => {
3912
+ actionButtonStore.pendingAction.set(null);
3913
+ };
3914
+ var executePendingActionIfExists = () => {
3915
+ const timestamp = actionButtonStore.pendingAction.get()?.timestamp;
3916
+ const callback = actionButtonStore.pendingAction.get()?.callback;
3917
+ if (timestamp && callback) {
3918
+ if (Date.now() - timestamp < 5 * 60 * 1e3 && typeof callback === "function") {
3919
+ callback();
3920
+ }
3921
+ }
3922
+ };
3923
+
3924
+ // src/react/ui/components/_internals/action-button/hooks/useActionButtonLogic.ts
3925
+ var useActionButtonLogic = ({
3926
+ tokenId,
3927
+ owned,
3928
+ action,
3929
+ onCannotPerformAction
3930
+ }) => {
3931
+ const { address } = useAccount5();
3932
+ const actionsThatOwnersCannotPerform = [
3933
+ "Buy" /* BUY */,
3934
+ "Make an offer" /* OFFER */
3935
+ ];
3936
+ const pendingActionType = actionButtonStore.pendingAction.type.get();
3937
+ useEffect8(() => {
3938
+ if (owned && actionButtonStore.pendingAction.get() && address && !actionsThatOwnersCannotPerform.includes(action) && actionButtonStore.pendingAction.get()?.collectibleId === tokenId) {
3939
+ onCannotPerformAction?.(
3940
+ pendingActionType
3941
+ );
3942
+ clearPendingAction();
3943
+ }
3944
+ }, [
3945
+ owned,
3946
+ actionButtonStore.pendingAction.get(),
3947
+ address,
3948
+ action,
3949
+ tokenId,
3950
+ onCannotPerformAction,
3951
+ pendingActionType
3952
+ ]);
3953
+ useEffect8(() => {
3954
+ if (address && !owned && actionButtonStore.pendingAction.get() && actionButtonStore.pendingAction.get()?.collectibleId === tokenId) {
3955
+ setTimeout(() => {
3956
+ executePendingActionIfExists();
3957
+ clearPendingAction();
3958
+ }, 1e3);
3959
+ }
3960
+ }, [address, owned, tokenId]);
3961
+ const shouldShowAction = !address ? ["Buy" /* BUY */, "Make an offer" /* OFFER */].includes(action) : true;
3962
+ const isOwnerAction = address && owned && [
3963
+ "Create listing" /* LIST */,
3964
+ "Transfer" /* TRANSFER */,
3965
+ "Sell" /* SELL */
3966
+ ].includes(action);
3967
+ return {
3968
+ address,
3969
+ shouldShowAction,
3970
+ isOwnerAction
3971
+ };
3972
+ };
3973
+
3974
+ // src/react/ui/components/_internals/action-button/components/ActionButtonBody.tsx
3868
3975
  import { Button as Button5 } from "@0xsequence/design-system";
3869
- import { observer as observer13 } from "@legendapp/state/react";
3976
+ import { useAccount as useAccount6 } from "wagmi";
3977
+ import { useOpenConnectModal } from "@0xsequence/kit";
3978
+
3979
+ // src/react/ui/components/_internals/action-button/styles.css.ts
3980
+ var actionButton = "styles_actionButton__m8ll4q0";
3981
+
3982
+ // src/react/ui/components/_internals/action-button/components/ActionButtonBody.tsx
3870
3983
  import { jsx as jsx29 } from "react/jsx-runtime";
3871
- var ActionButton = observer13(
3872
- ({
3873
- collectionAddress,
3874
- chainId,
3875
- tokenId,
3876
- orderbookKind,
3877
- action,
3878
- highestOffer,
3879
- lowestListing
3880
- }) => {
3881
- const { show: showCreateListingModal } = useCreateListingModal();
3882
- const { show: showMakeOfferModal } = useMakeOfferModal();
3883
- const { show: showSellModal } = useSellModal();
3884
- const { show: showTransferModal } = useTransferModal();
3885
- const { show: showBuyModal } = useBuyModal();
3886
- if (action === "Buy" /* BUY */) {
3887
- if (!lowestListing)
3888
- throw new InvalidStepError("BUY", "lowestListing is required");
3889
- return /* @__PURE__ */ jsx29(
3890
- ActionButtonBody,
3984
+ function ActionButtonBody({
3985
+ tokenId,
3986
+ label,
3987
+ onClick,
3988
+ icon,
3989
+ action
3990
+ }) {
3991
+ const { address } = useAccount6();
3992
+ const { setOpenConnectModal } = useOpenConnectModal();
3993
+ const handleClick = (e) => {
3994
+ e.preventDefault();
3995
+ e.stopPropagation();
3996
+ if (!address && action) {
3997
+ setPendingAction(action, onClick, tokenId);
3998
+ setOpenConnectModal(true);
3999
+ } else {
4000
+ onClick();
4001
+ }
4002
+ };
4003
+ return /* @__PURE__ */ jsx29(
4004
+ Button5,
4005
+ {
4006
+ className: actionButton,
4007
+ variant: "primary",
4008
+ label,
4009
+ onClick: handleClick,
4010
+ leftIcon: icon,
4011
+ size: "xs",
4012
+ shape: "square",
4013
+ width: "full"
4014
+ }
4015
+ );
4016
+ }
4017
+
4018
+ // src/react/ui/components/_internals/action-button/components/OwnerActions.tsx
4019
+ import { jsx as jsx30 } from "react/jsx-runtime";
4020
+ function OwnerActions({
4021
+ action,
4022
+ tokenId,
4023
+ collectionAddress,
4024
+ chainId,
4025
+ orderbookKind,
4026
+ highestOffer
4027
+ }) {
4028
+ const { show: showCreateListingModal } = useCreateListingModal();
4029
+ const { show: showSellModal } = useSellModal();
4030
+ const { show: showTransferModal } = useTransferModal();
4031
+ if (action === "Create listing" /* LIST */) {
4032
+ return /* @__PURE__ */ jsx30(
4033
+ ActionButtonBody,
4034
+ {
4035
+ label: "Create listing",
4036
+ tokenId,
4037
+ onClick: () => showCreateListingModal({
4038
+ collectionAddress,
4039
+ chainId,
4040
+ collectibleId: tokenId,
4041
+ orderbookKind
4042
+ })
4043
+ }
4044
+ );
4045
+ }
4046
+ if (action === "Sell" /* SELL */ && highestOffer) {
4047
+ return /* @__PURE__ */ jsx30(
4048
+ ActionButtonBody,
4049
+ {
4050
+ tokenId,
4051
+ label: "Sell",
4052
+ onClick: () => showSellModal({
4053
+ collectionAddress,
4054
+ chainId,
4055
+ tokenId,
4056
+ order: highestOffer
4057
+ })
4058
+ }
4059
+ );
4060
+ }
4061
+ if (action === "Transfer" /* TRANSFER */) {
4062
+ return /* @__PURE__ */ jsx30(
4063
+ ActionButtonBody,
4064
+ {
4065
+ label: "Transfer",
4066
+ tokenId,
4067
+ onClick: () => showTransferModal({
4068
+ collectionAddress,
4069
+ chainId,
4070
+ collectibleId: tokenId
4071
+ })
4072
+ }
4073
+ );
4074
+ }
4075
+ return null;
4076
+ }
4077
+
4078
+ // src/react/ui/icons/CartIcon.tsx
4079
+ import { Box as Box19 } from "@0xsequence/design-system";
4080
+ import { jsx as jsx31, jsxs as jsxs21 } from "react/jsx-runtime";
4081
+ var Svg2 = () => /* @__PURE__ */ jsxs21(
4082
+ "svg",
4083
+ {
4084
+ width: "20",
4085
+ height: "20",
4086
+ viewBox: "0 0 20 20",
4087
+ fill: "none",
4088
+ xmlns: "http://www.w3.org/2000/svg",
4089
+ role: "img",
4090
+ "aria-labelledby": "cart-title",
4091
+ children: [
4092
+ /* @__PURE__ */ jsx31("title", { id: "cart-title", children: "Cart Icon" }),
4093
+ /* @__PURE__ */ jsx31(
4094
+ "path",
3891
4095
  {
3892
- label: "Buy",
3893
- onClick: () => showBuyModal({
3894
- collectionAddress,
3895
- chainId,
3896
- tokenId,
3897
- order: lowestListing
3898
- })
4096
+ fillRule: "evenodd",
4097
+ clipRule: "evenodd",
4098
+ d: "M2.5 3.46836C2.5 3.20969 2.72366 3 2.99955 3H5.16925C5.88938 3 6.5077 3.48022 6.64172 4.14359L8.33188 12.5093C8.37655 12.7304 8.58266 12.8905 8.8227 12.8905H16.987C17.2629 12.8905 17.4866 13.1002 17.4866 13.3589C17.4866 13.6175 17.2629 13.8272 16.987 13.8272H8.8227C8.10257 13.8272 7.48425 13.347 7.35023 12.6836L5.66007 4.31793C5.6154 4.0968 5.40929 3.93673 5.16925 3.93673H2.99955C2.72366 3.93673 2.5 3.72704 2.5 3.46836Z",
4099
+ fill: "white"
3899
4100
  }
3900
- );
3901
- }
3902
- if (action === "Sell" /* SELL */) {
3903
- if (!highestOffer)
3904
- throw new InvalidStepError("SELL", "highestOffer is required");
3905
- return /* @__PURE__ */ jsx29(
3906
- ActionButtonBody,
4101
+ ),
4102
+ /* @__PURE__ */ jsx31(
4103
+ "path",
3907
4104
  {
3908
- label: "Sell",
3909
- onClick: () => showSellModal({
3910
- collectionAddress,
3911
- chainId,
3912
- tokenId,
3913
- order: highestOffer
3914
- })
4105
+ d: "M18.0003 5.34182H6.40946L7.49564 10.8234H17.0736C17.3133 10.8234 17.5193 10.6637 17.5643 10.443L18.491 5.89813C18.5498 5.60942 18.3138 5.34182 18.0003 5.34182Z",
4106
+ fill: "white"
3915
4107
  }
3916
- );
3917
- }
3918
- if (action === "Create listing" /* LIST */) {
3919
- return /* @__PURE__ */ jsx29(
3920
- ActionButtonBody,
4108
+ ),
4109
+ /* @__PURE__ */ jsx31(
4110
+ "path",
3921
4111
  {
3922
- label: "Create listing",
3923
- onClick: () => showCreateListingModal({
3924
- collectionAddress,
3925
- chainId,
3926
- collectibleId: tokenId,
3927
- orderbookKind
3928
- })
4112
+ d: "M10.0889 15.8559C10.0889 16.4878 9.54259 17 8.86866 17C8.19473 17 7.64841 16.4878 7.64841 15.8559C7.64841 15.2241 8.19473 14.7119 8.86866 14.7119C9.54259 14.7119 10.0889 15.2241 10.0889 15.8559Z",
4113
+ fill: "white"
3929
4114
  }
3930
- );
3931
- }
3932
- if (action === "Make an offer" /* OFFER */) {
3933
- return /* @__PURE__ */ jsx29(
3934
- ActionButtonBody,
4115
+ ),
4116
+ /* @__PURE__ */ jsx31(
4117
+ "path",
3935
4118
  {
3936
- label: "Make an offer",
3937
- onClick: () => showMakeOfferModal({
3938
- collectionAddress,
3939
- chainId,
3940
- collectibleId: tokenId,
3941
- orderbookKind
3942
- })
4119
+ d: "M16.6268 15.8559C16.6268 16.4878 16.0804 17 15.4065 17C14.7326 17 14.1863 16.4878 14.1863 15.8559C14.1863 15.2241 14.7326 14.7119 15.4065 14.7119C16.0804 14.7119 16.6268 15.2241 16.6268 15.8559Z",
4120
+ fill: "white"
3943
4121
  }
3944
- );
4122
+ )
4123
+ ]
4124
+ }
4125
+ );
4126
+ var SvgCartIcon = ({ size = "sm", ...props }) => /* @__PURE__ */ jsx31(
4127
+ Box19,
4128
+ {
4129
+ as: Svg2,
4130
+ className: iconVariants({
4131
+ size
4132
+ }),
4133
+ ...props
4134
+ }
4135
+ );
4136
+ var CartIcon_default = SvgCartIcon;
4137
+
4138
+ // src/react/ui/components/_internals/action-button/components/NonOwnerActions.tsx
4139
+ import { jsx as jsx32 } from "react/jsx-runtime";
4140
+ function NonOwnerActions({
4141
+ action,
4142
+ tokenId,
4143
+ collectionAddress,
4144
+ chainId,
4145
+ orderbookKind,
4146
+ lowestListing
4147
+ }) {
4148
+ const { show: showBuyModal } = useBuyModal();
4149
+ const { show: showMakeOfferModal } = useMakeOfferModal();
4150
+ if (action === "Buy" /* BUY */) {
4151
+ if (!lowestListing) {
4152
+ throw new InvalidStepError("BUY", "lowestListing is required");
3945
4153
  }
3946
- if (action === "Transfer" /* TRANSFER */) {
3947
- return /* @__PURE__ */ jsx29(
3948
- ActionButtonBody,
4154
+ return /* @__PURE__ */ jsx32(
4155
+ ActionButtonBody,
4156
+ {
4157
+ action: "Buy" /* BUY */,
4158
+ tokenId,
4159
+ label: "Buy now",
4160
+ onClick: () => showBuyModal({
4161
+ collectionAddress,
4162
+ chainId,
4163
+ tokenId,
4164
+ order: lowestListing
4165
+ }),
4166
+ icon: CartIcon_default
4167
+ }
4168
+ );
4169
+ }
4170
+ if (action === "Make an offer" /* OFFER */) {
4171
+ return /* @__PURE__ */ jsx32(
4172
+ ActionButtonBody,
4173
+ {
4174
+ action: "Make an offer" /* OFFER */,
4175
+ tokenId,
4176
+ label: "Make an offer",
4177
+ onClick: () => showMakeOfferModal({
4178
+ collectionAddress,
4179
+ chainId,
4180
+ collectibleId: tokenId,
4181
+ orderbookKind
4182
+ })
4183
+ }
4184
+ );
4185
+ }
4186
+ return null;
4187
+ }
4188
+
4189
+ // src/react/ui/components/_internals/action-button/ActionButton.tsx
4190
+ import { jsx as jsx33 } from "react/jsx-runtime";
4191
+ var ActionButton = observer12(
4192
+ ({
4193
+ collectionAddress,
4194
+ chainId,
4195
+ tokenId,
4196
+ orderbookKind,
4197
+ action,
4198
+ owned,
4199
+ highestOffer,
4200
+ lowestListing,
4201
+ onCannotPerformAction
4202
+ }) => {
4203
+ const { shouldShowAction, isOwnerAction } = useActionButtonLogic({
4204
+ tokenId,
4205
+ owned,
4206
+ action,
4207
+ onCannotPerformAction
4208
+ });
4209
+ if (!shouldShowAction) {
4210
+ return null;
4211
+ }
4212
+ if (isOwnerAction) {
4213
+ return /* @__PURE__ */ jsx33(
4214
+ OwnerActions,
3949
4215
  {
3950
- label: "Transfer",
3951
- onClick: () => showTransferModal({
3952
- collectionAddress,
3953
- chainId,
3954
- collectibleId: tokenId
3955
- })
4216
+ action,
4217
+ tokenId,
4218
+ collectionAddress,
4219
+ chainId,
4220
+ orderbookKind,
4221
+ highestOffer
3956
4222
  }
3957
4223
  );
3958
4224
  }
3959
- return null;
4225
+ return /* @__PURE__ */ jsx33(
4226
+ NonOwnerActions,
4227
+ {
4228
+ action,
4229
+ tokenId,
4230
+ collectionAddress,
4231
+ chainId,
4232
+ orderbookKind,
4233
+ lowestListing
4234
+ }
4235
+ );
3960
4236
  }
3961
4237
  );
3962
- function ActionButtonBody({ label, onClick }) {
3963
- return /* @__PURE__ */ jsx29(
3964
- Button5,
3965
- {
3966
- variant: "primary",
3967
- label,
3968
- onClick: (e) => {
3969
- e.preventDefault();
3970
- e.stopPropagation();
3971
- onClick();
3972
- },
3973
- size: "xs",
3974
- shape: "square",
3975
- width: "full"
3976
- }
3977
- );
3978
- }
3979
4238
 
3980
4239
  // src/react/ui/components/collectible-card/Footer.tsx
3981
- import { Box as Box20, IconButton as IconButton5, Image as Image6, Text as Text15 } from "@0xsequence/design-system";
4240
+ import { Box as Box21, IconButton as IconButton5, Image as Image6, Text as Text15 } from "@0xsequence/design-system";
3982
4241
  import { formatUnits as formatUnits5 } from "viem";
3983
- import { useAccount as useAccount5 } from "wagmi";
3984
4242
 
3985
4243
  // src/react/ui/icons/Bell.tsx
3986
- import { Box as Box19 } from "@0xsequence/design-system";
3987
- import { jsx as jsx30, jsxs as jsxs21 } from "react/jsx-runtime";
3988
- var Svg2 = () => /* @__PURE__ */ jsxs21(
4244
+ import { Box as Box20 } from "@0xsequence/design-system";
4245
+ import { jsx as jsx34, jsxs as jsxs22 } from "react/jsx-runtime";
4246
+ var Svg3 = () => /* @__PURE__ */ jsxs22(
3989
4247
  "svg",
3990
4248
  {
3991
4249
  width: "17",
@@ -3996,8 +4254,8 @@ var Svg2 = () => /* @__PURE__ */ jsxs21(
3996
4254
  role: "img",
3997
4255
  "aria-labelledby": "bell-title",
3998
4256
  children: [
3999
- /* @__PURE__ */ jsx30("title", { id: "bell-title", children: "Notification Bell" }),
4000
- /* @__PURE__ */ jsx30(
4257
+ /* @__PURE__ */ jsx34("title", { id: "bell-title", children: "Notification Bell" }),
4258
+ /* @__PURE__ */ jsx34(
4001
4259
  "path",
4002
4260
  {
4003
4261
  fillRule: "evenodd",
@@ -4009,10 +4267,10 @@ var Svg2 = () => /* @__PURE__ */ jsxs21(
4009
4267
  ]
4010
4268
  }
4011
4269
  );
4012
- var SvgBellIcon = ({ size = "sm", ...props }) => /* @__PURE__ */ jsx30(
4013
- Box19,
4270
+ var SvgBellIcon = ({ size = "sm", ...props }) => /* @__PURE__ */ jsx34(
4271
+ Box20,
4014
4272
  {
4015
- as: Svg2,
4273
+ as: Svg3,
4016
4274
  className: iconVariants({
4017
4275
  size
4018
4276
  }),
@@ -4022,7 +4280,7 @@ var SvgBellIcon = ({ size = "sm", ...props }) => /* @__PURE__ */ jsx30(
4022
4280
  var Bell_default = SvgBellIcon;
4023
4281
 
4024
4282
  // src/react/ui/components/collectible-card/Footer.tsx
4025
- import { jsx as jsx31, jsxs as jsxs22 } from "react/jsx-runtime";
4283
+ import { jsx as jsx35, jsxs as jsxs23 } from "react/jsx-runtime";
4026
4284
  var Footer = ({
4027
4285
  name,
4028
4286
  type,
@@ -4030,10 +4288,8 @@ var Footer = ({
4030
4288
  highestOffer,
4031
4289
  lowestListingPriceAmount,
4032
4290
  lowestListingCurrency,
4033
- balance,
4034
- isAnimated
4291
+ balance
4035
4292
  }) => {
4036
- const { address } = useAccount5();
4037
4293
  const listed = !!lowestListingPriceAmount && !!lowestListingCurrency;
4038
4294
  if (name.length > 15 && highestOffer) {
4039
4295
  name = `${name.substring(0, 13)}...`;
@@ -4041,8 +4297,8 @@ var Footer = ({
4041
4297
  if (name.length > 17 && !highestOffer) {
4042
4298
  name = `${name.substring(0, 17)}...`;
4043
4299
  }
4044
- return /* @__PURE__ */ jsxs22(
4045
- Box20,
4300
+ return /* @__PURE__ */ jsxs23(
4301
+ Box21,
4046
4302
  {
4047
4303
  display: "flex",
4048
4304
  flexDirection: "column",
@@ -4051,10 +4307,10 @@ var Footer = ({
4051
4307
  padding: "4",
4052
4308
  whiteSpace: "nowrap",
4053
4309
  position: "relative",
4054
- className: !!address && isAnimated ? footer.animated : footer.static,
4310
+ className: footer,
4055
4311
  children: [
4056
- /* @__PURE__ */ jsxs22(
4057
- Box20,
4312
+ /* @__PURE__ */ jsxs23(
4313
+ Box21,
4058
4314
  {
4059
4315
  display: "flex",
4060
4316
  alignItems: "center",
@@ -4062,7 +4318,7 @@ var Footer = ({
4062
4318
  position: "relative",
4063
4319
  width: "full",
4064
4320
  children: [
4065
- /* @__PURE__ */ jsx31(
4321
+ /* @__PURE__ */ jsx35(
4066
4322
  Text15,
4067
4323
  {
4068
4324
  color: "text100",
@@ -4070,10 +4326,11 @@ var Footer = ({
4070
4326
  fontWeight: "bold",
4071
4327
  textAlign: "left",
4072
4328
  fontFamily: "body",
4073
- children: name
4329
+ visibility: name ? "visible" : "hidden",
4330
+ children: name || "Untitled"
4074
4331
  }
4075
4332
  ),
4076
- highestOffer && onOfferClick && /* @__PURE__ */ jsx31(
4333
+ highestOffer && onOfferClick && /* @__PURE__ */ jsx35(
4077
4334
  IconButton5,
4078
4335
  {
4079
4336
  size: "xs",
@@ -4086,15 +4343,15 @@ var Footer = ({
4086
4343
  e.stopPropagation();
4087
4344
  onOfferClick?.();
4088
4345
  },
4089
- icon: (props) => /* @__PURE__ */ jsx31(Bell_default, { ...props, size: "xs" })
4346
+ icon: (props) => /* @__PURE__ */ jsx35(Bell_default, { ...props, size: "xs" })
4090
4347
  }
4091
4348
  )
4092
4349
  ]
4093
4350
  }
4094
4351
  ),
4095
- /* @__PURE__ */ jsxs22(Box20, { display: "flex", alignItems: "center", gap: "1", children: [
4096
- listed && /* @__PURE__ */ jsx31(Image6, { src: lowestListingCurrency?.imageUrl, width: "3", height: "3" }),
4097
- /* @__PURE__ */ jsxs22(
4352
+ /* @__PURE__ */ jsxs23(Box21, { display: "flex", alignItems: "center", gap: "1", children: [
4353
+ listed && lowestListingCurrency.imageUrl && /* @__PURE__ */ jsx35(Image6, { src: lowestListingCurrency.imageUrl, width: "3", height: "3" }),
4354
+ /* @__PURE__ */ jsxs23(
4098
4355
  Text15,
4099
4356
  {
4100
4357
  color: listed ? "text100" : "text50",
@@ -4112,7 +4369,7 @@ var Footer = ({
4112
4369
  }
4113
4370
  )
4114
4371
  ] }),
4115
- /* @__PURE__ */ jsx31(TokenTypeBalancePill, { balance, type })
4372
+ /* @__PURE__ */ jsx35(TokenTypeBalancePill, { balance, type })
4116
4373
  ]
4117
4374
  }
4118
4375
  );
@@ -4122,7 +4379,7 @@ var TokenTypeBalancePill = ({
4122
4379
  type
4123
4380
  }) => {
4124
4381
  const displayText = type === "ERC1155" /* ERC1155 */ ? balance ? `Owned: ${balance}` : "ERC-1155" : "ERC-721";
4125
- return /* @__PURE__ */ jsx31(
4382
+ return /* @__PURE__ */ jsx35(
4126
4383
  Text15,
4127
4384
  {
4128
4385
  background: "backgroundSecondary",
@@ -4139,25 +4396,25 @@ var TokenTypeBalancePill = ({
4139
4396
  };
4140
4397
 
4141
4398
  // src/react/ui/components/collectible-card/CollectibleCard.tsx
4142
- import { jsx as jsx32, jsxs as jsxs23 } from "react/jsx-runtime";
4399
+ import { jsx as jsx36, jsxs as jsxs24 } from "react/jsx-runtime";
4143
4400
  function CollectibleSkeleton() {
4144
- return /* @__PURE__ */ jsxs23(
4145
- Box21,
4401
+ return /* @__PURE__ */ jsxs24(
4402
+ Box22,
4146
4403
  {
4147
4404
  className: collectibleCard,
4148
4405
  borderRadius: "md",
4149
4406
  overflow: "hidden",
4150
4407
  background: "backgroundPrimary",
4151
4408
  children: [
4152
- /* @__PURE__ */ jsx32(
4409
+ /* @__PURE__ */ jsx36(
4153
4410
  Skeleton8,
4154
4411
  {
4155
4412
  size: "lg",
4156
4413
  style: { width: "100%", height: 164, borderRadius: 0, paddingTop: 16 }
4157
4414
  }
4158
4415
  ),
4159
- /* @__PURE__ */ jsxs23(
4160
- Box21,
4416
+ /* @__PURE__ */ jsxs24(
4417
+ Box22,
4161
4418
  {
4162
4419
  display: "flex",
4163
4420
  flexDirection: "column",
@@ -4166,8 +4423,8 @@ function CollectibleSkeleton() {
4166
4423
  paddingBottom: "4",
4167
4424
  marginTop: "2",
4168
4425
  children: [
4169
- /* @__PURE__ */ jsx32(Skeleton8, { size: "lg" }),
4170
- /* @__PURE__ */ jsx32(Skeleton8, { size: "sm" })
4426
+ /* @__PURE__ */ jsx36(Skeleton8, { size: "lg" }),
4427
+ /* @__PURE__ */ jsx36(Skeleton8, { size: "sm" })
4171
4428
  ]
4172
4429
  }
4173
4430
  )
@@ -4185,16 +4442,12 @@ function CollectibleCard({
4185
4442
  onCollectibleClick,
4186
4443
  onOfferClick,
4187
4444
  balance,
4188
- cardLoading
4445
+ cardLoading,
4446
+ onCannotPerformAction
4189
4447
  }) {
4190
- const { address: accountAddress } = useAccount6();
4191
4448
  const collectibleMetadata = lowestListing?.metadata;
4449
+ const highestOffer = lowestListing?.offer;
4192
4450
  const [imageLoadingError, setImageLoadingError] = useState7(false);
4193
- const { data: highestOffer, isLoading: highestOfferLoading } = useHighestOffer({
4194
- chainId: String(chainId),
4195
- collectionAddress,
4196
- tokenId: collectibleId
4197
- });
4198
4451
  const { data: lowestListingCurrency } = useCurrency({
4199
4452
  chainId,
4200
4453
  // biome-ignore lint/style/noNonNullAssertion: <explanation>
@@ -4203,22 +4456,23 @@ function CollectibleCard({
4203
4456
  enabled: !!lowestListing?.order?.priceCurrencyAddress
4204
4457
  }
4205
4458
  });
4206
- if (highestOfferLoading || cardLoading) {
4207
- return /* @__PURE__ */ jsx32(CollectibleSkeleton, {});
4459
+ if (cardLoading) {
4460
+ return /* @__PURE__ */ jsx36(CollectibleSkeleton, {});
4208
4461
  }
4209
- const action = balance ? highestOffer?.order && "Sell" /* SELL */ || !lowestListing?.order && "Create listing" /* LIST */ || "Transfer" /* TRANSFER */ : lowestListing?.order && "Buy" /* BUY */ || "Make an offer" /* OFFER */;
4462
+ const action = balance ? highestOffer && "Sell" /* SELL */ || !lowestListing?.order && "Create listing" /* LIST */ || "Transfer" /* TRANSFER */ : lowestListing?.order && "Buy" /* BUY */ || "Make an offer" /* OFFER */;
4210
4463
  const name = collectibleMetadata?.name;
4211
4464
  const image = collectibleMetadata?.image;
4212
4465
  const externalUrl = collectibleMetadata?.external_url;
4213
- return /* @__PURE__ */ jsx32(
4214
- Box21,
4466
+ return /* @__PURE__ */ jsx36(
4467
+ Box22,
4215
4468
  {
4216
4469
  className: collectibleCard,
4217
4470
  borderRadius: "md",
4218
4471
  overflow: "hidden",
4219
4472
  background: "backgroundPrimary",
4220
- children: /* @__PURE__ */ jsx32(
4221
- Box21,
4473
+ tabIndex: 0,
4474
+ children: /* @__PURE__ */ jsx36(
4475
+ Box22,
4222
4476
  {
4223
4477
  display: "flex",
4224
4478
  flexDirection: "column",
@@ -4233,70 +4487,79 @@ function CollectibleCard({
4233
4487
  cursor: "pointer",
4234
4488
  padding: "0",
4235
4489
  className: collectibleTileWrapper,
4236
- children: /* @__PURE__ */ jsxs23("article", { style: { width: "100%" }, children: [
4237
- externalUrl && /* @__PURE__ */ jsx32(
4238
- IconButton6,
4239
- {
4240
- as: "a",
4241
- href: externalUrl,
4242
- size: "sm",
4243
- backdropFilter: "blur",
4244
- variant: "glass",
4245
- onClick: (e) => {
4246
- e.stopPropagation();
4247
- },
4248
- position: "absolute",
4249
- top: "2",
4250
- left: "2",
4251
- icon: DiamondEye_default
4252
- }
4253
- ),
4254
- /* @__PURE__ */ jsx32(
4255
- "img",
4256
- {
4257
- src: imageLoadingError ? chess_tile_default : image || chess_tile_default,
4258
- alt: name,
4259
- className: collectibleImage,
4260
- onError: () => setImageLoadingError(true)
4261
- }
4262
- ),
4263
- /* @__PURE__ */ jsx32(
4264
- Footer,
4265
- {
4266
- name: name || "",
4267
- type: collectionType,
4268
- onOfferClick: () => onOfferClick?.({ order: highestOffer?.order }),
4269
- highestOffer: highestOffer?.order,
4270
- lowestListingPriceAmount: lowestListing?.order?.priceAmount,
4271
- lowestListingCurrency,
4272
- balance,
4273
- isAnimated: !!action
4274
- }
4275
- ),
4276
- accountAddress && (highestOffer || lowestListing) && /* @__PURE__ */ jsx32(
4277
- Box21,
4278
- {
4279
- display: "flex",
4280
- alignItems: "center",
4281
- justifyContent: "center",
4282
- padding: "2",
4283
- className: actionWrapper,
4284
- children: /* @__PURE__ */ jsx32(
4285
- ActionButton,
4490
+ children: /* @__PURE__ */ jsxs24(
4491
+ "article",
4492
+ {
4493
+ style: { width: "100%", display: "flex", flexDirection: "column" },
4494
+ children: [
4495
+ externalUrl && /* @__PURE__ */ jsx36(
4496
+ IconButton6,
4497
+ {
4498
+ as: "a",
4499
+ href: externalUrl,
4500
+ target: "_blank",
4501
+ rel: "noopener noreferrer",
4502
+ size: "sm",
4503
+ backdropFilter: "blur",
4504
+ variant: "glass",
4505
+ onClick: (e) => {
4506
+ e.stopPropagation();
4507
+ },
4508
+ position: "absolute",
4509
+ zIndex: "20",
4510
+ top: "2",
4511
+ left: "2",
4512
+ icon: DiamondEye_default
4513
+ }
4514
+ ),
4515
+ /* @__PURE__ */ jsx36(
4516
+ "img",
4517
+ {
4518
+ src: imageLoadingError ? chess_tile_default : image || chess_tile_default,
4519
+ alt: name,
4520
+ className: collectibleImage,
4521
+ onError: () => setImageLoadingError(true)
4522
+ }
4523
+ ),
4524
+ /* @__PURE__ */ jsx36(
4525
+ Footer,
4286
4526
  {
4287
- chainId: String(chainId),
4288
- collectionAddress,
4289
- tokenId: collectibleId,
4290
- orderbookKind,
4291
- action,
4292
- highestOffer: highestOffer?.order,
4293
- lowestListing: lowestListing?.order,
4294
- isOwned: !!balance
4527
+ name: name || "",
4528
+ type: collectionType,
4529
+ onOfferClick: () => onOfferClick?.({ order: highestOffer }),
4530
+ highestOffer,
4531
+ lowestListingPriceAmount: lowestListing?.order?.priceAmount,
4532
+ lowestListingCurrency,
4533
+ balance
4534
+ }
4535
+ ),
4536
+ (highestOffer || lowestListing) && /* @__PURE__ */ jsx36(
4537
+ Box22,
4538
+ {
4539
+ display: "flex",
4540
+ alignItems: "center",
4541
+ justifyContent: "center",
4542
+ padding: "2",
4543
+ className: actionWrapper,
4544
+ children: /* @__PURE__ */ jsx36(
4545
+ ActionButton,
4546
+ {
4547
+ chainId: String(chainId),
4548
+ collectionAddress,
4549
+ tokenId: collectibleId,
4550
+ orderbookKind,
4551
+ action,
4552
+ highestOffer,
4553
+ lowestListing: lowestListing?.order,
4554
+ owned: !!balance,
4555
+ onCannotPerformAction
4556
+ }
4557
+ )
4295
4558
  }
4296
4559
  )
4297
- }
4298
- )
4299
- ] })
4560
+ ]
4561
+ }
4562
+ )
4300
4563
  }
4301
4564
  )
4302
4565
  }
@@ -4313,4 +4576,4 @@ export {
4313
4576
  useBuyModal,
4314
4577
  CollectibleCard
4315
4578
  };
4316
- //# sourceMappingURL=chunk-7WCZP6FN.js.map
4579
+ //# sourceMappingURL=chunk-OUVFTA63.js.map