@0xsequence/marketplace-sdk 0.8.7 → 0.8.9
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.
- package/CHANGELOG.md +32 -0
- package/dist/chunk-2PSNAIAT.js +1 -0
- package/dist/chunk-2PSNAIAT.js.map +1 -0
- package/dist/{chunk-7FVZD2LL.js → chunk-4XLXOEXQ.js} +2 -2
- package/dist/{chunk-5HEZNTSU.js → chunk-D7RVSZAQ.js} +131 -83
- package/dist/chunk-D7RVSZAQ.js.map +1 -0
- package/dist/chunk-DWTLVJAW.js +42 -0
- package/dist/chunk-DWTLVJAW.js.map +1 -0
- package/dist/{chunk-YAUZLETY.js → chunk-G3447GIP.js} +37 -18
- package/dist/chunk-G3447GIP.js.map +1 -0
- package/dist/{chunk-O6GWM7C3.js → chunk-HHYNOPPI.js} +2 -2
- package/dist/{chunk-Y6AOCO3Q.js → chunk-I2BYHDFE.js} +419 -161
- package/dist/chunk-I2BYHDFE.js.map +1 -0
- package/dist/{chunk-KTT27YUN.js → chunk-KGM2WLSP.js} +12 -156
- package/dist/chunk-KGM2WLSP.js.map +1 -0
- package/dist/chunk-MAD64DLJ.js +81 -0
- package/dist/chunk-MAD64DLJ.js.map +1 -0
- package/dist/chunk-N7BPFK46.js +1 -0
- package/dist/chunk-N7BPFK46.js.map +1 -0
- package/dist/chunk-NX52D7NX.js +135 -0
- package/dist/chunk-NX52D7NX.js.map +1 -0
- package/dist/chunk-O34GCB47.js +32 -0
- package/dist/chunk-O34GCB47.js.map +1 -0
- package/dist/{chunk-Q2DA477S.js → chunk-YALXP2PW.js} +3 -3
- package/dist/{chunk-A6V7XDY4.js → chunk-YBOFRP65.js} +2 -2
- package/dist/{create-config-CdooE7aU.d.ts → create-config-DwrnzwpM.d.ts} +2 -2
- package/dist/{index-ClKHzm0B.d.ts → index-DGsVBflk.d.ts} +3 -12
- package/dist/index.css +83 -35
- package/dist/index.css.map +1 -1
- package/dist/index.d.ts +13 -4
- package/dist/index.js +13 -5
- package/dist/{lowestListing-kFyrUGha.d.ts → lowestListing-BQHIuvNF.d.ts} +2 -2
- package/dist/{marketplace.gen-BU6T6f0m.d.ts → marketplace.gen-DQzWciwC.d.ts} +1 -1
- package/dist/marketplaceConfig-B4Fdsmxu.d.ts +17 -0
- package/dist/react/_internal/api/index.d.ts +3 -3
- package/dist/react/_internal/api/index.js +4 -3
- package/dist/react/_internal/databeat/index.d.ts +2 -1
- package/dist/react/_internal/databeat/index.js +11 -7
- package/dist/react/_internal/index.d.ts +6 -6
- package/dist/react/_internal/index.js +13 -10
- package/dist/react/_internal/wagmi/index.d.ts +6 -5
- package/dist/react/_internal/wagmi/index.js +2 -2
- package/dist/react/hooks/index.d.ts +9 -8
- package/dist/react/hooks/index.js +10 -6
- package/dist/react/hooks/options/index.d.ts +4 -4
- package/dist/react/hooks/options/index.js +7 -4
- package/dist/react/index.css +2696 -0
- package/dist/react/index.css.map +1 -1
- package/dist/react/index.d.ts +9 -9
- package/dist/react/index.js +18 -11
- package/dist/react/queries/index.d.ts +3 -3
- package/dist/react/queries/index.js +6 -3
- package/dist/react/ssr/index.d.ts +3 -3
- package/dist/react/ssr/index.js +6 -3
- package/dist/react/ssr/index.js.map +1 -1
- package/dist/react/ui/components/collectible-card/index.css +2696 -0
- package/dist/react/ui/components/collectible-card/index.css.map +1 -1
- package/dist/react/ui/components/collectible-card/index.d.ts +23 -2
- package/dist/react/ui/components/collectible-card/index.js +16 -9
- package/dist/react/ui/icons/index.js +5 -2
- package/dist/react/ui/index.css +2696 -0
- package/dist/react/ui/index.css.map +1 -1
- package/dist/react/ui/index.d.ts +3 -2
- package/dist/react/ui/index.js +16 -9
- package/dist/react/ui/modals/_internal/components/actionModal/index.js +11 -7
- package/dist/sdk-config-txlivEKe.d.ts +133 -0
- package/dist/{services-9ApY0U-o.d.ts → services-BI_w8Eq4.d.ts} +4 -4
- package/dist/types/index.d.ts +5 -4
- package/dist/types/index.js +9 -6
- package/dist/{types-DsTwmKG-.d.ts → types-isjvwapz.d.ts} +3 -3
- package/dist/utils/index.d.ts +1 -1
- package/dist/utils/index.js +5 -2
- package/package.json +6 -5
- package/src/index.ts +1 -0
- package/src/react/{hooks/options/__mocks__/marketplaceConfig.msw.ts → _internal/api/__mocks__/builder.msw.ts} +70 -63
- package/src/react/_internal/api/__mocks__/metadata.msw.ts +30 -10
- package/src/react/_internal/api/builder-api.ts +32 -0
- package/src/react/_internal/api/builder.gen.ts +215 -0
- package/src/react/_internal/api/services.ts +9 -2
- package/src/react/_internal/databeat/types.ts +1 -0
- package/src/react/_internal/wagmi/__tests__/create-config.test.ts +16 -41
- package/src/react/_internal/wagmi/create-config.ts +3 -16
- package/src/react/_internal/wagmi/get-connectors.ts +31 -21
- package/src/react/_internal/wallet/__tests__/wallet.test.ts +30 -0
- package/src/react/_internal/wallet/wallet.ts +25 -2
- package/src/react/hooks/__tests__/__snapshots__/useMarketplaceConfig.test.tsx.snap +96 -0
- package/src/react/hooks/__tests__/useCollection.test.tsx +4 -5
- package/src/react/hooks/__tests__/useCurrencies.test.tsx +1 -1
- package/src/react/hooks/__tests__/useInventory.test.tsx +15 -16
- package/src/react/hooks/__tests__/useListCollections.test.tsx +18 -163
- package/src/react/hooks/__tests__/useMarketplaceConfig.test.tsx +10 -11
- package/src/react/hooks/options/index.ts +1 -1
- package/src/react/hooks/useAutoSelectFeeOption.tsx +1 -0
- package/src/react/hooks/useMarketplaceConfig.tsx +2 -2
- package/src/react/queries/marketplaceConfig.ts +101 -0
- package/src/react/ssr/__tests__/__snapshots__/create-ssr-client.test.ts.snap +1 -0
- package/src/react/ssr/create-ssr-client.ts +1 -1
- package/src/react/ui/components/ModelViewer.tsx +54 -0
- package/src/react/ui/components/_internals/custom-select/CustomSelect.tsx +0 -1
- package/src/react/ui/components/collectible-card/CollectibleCard.tsx +7 -3
- package/src/react/ui/components/collectible-card/__tests__/CollectibleAsset.test.tsx +76 -46
- package/src/react/ui/components/collectible-card/collectible-asset/CollectibleAsset.tsx +174 -0
- package/src/react/ui/components/collectible-card/collectible-asset/CollectibleAssetSkeleton.tsx +14 -0
- package/src/react/ui/components/collectible-card/collectible-asset/utils.ts +40 -0
- package/src/react/ui/components/collectible-card/index.ts +1 -0
- package/src/react/ui/index.ts +1 -0
- package/src/react/ui/modals/BuyModal/hooks/usePaymentModalParams.ts +6 -1
- package/src/react/ui/modals/BuyModal/store.ts +1 -0
- package/src/react/ui/modals/CreateListingModal/hooks/useTransactionSteps.tsx +20 -2
- package/src/react/ui/modals/MakeOfferModal/hooks/useTransactionSteps.tsx +17 -1
- package/src/react/ui/modals/SellModal/hooks/useTransactionSteps.tsx +4 -0
- package/src/react/ui/modals/SuccessfulPurchaseModal/index.tsx +9 -7
- package/src/react/ui/modals/TransferModal/_views/enterWalletAddress/_components/TokenQuantityInput.tsx +1 -1
- package/src/react/ui/modals/TransferModal/_views/enterWalletAddress/_components/WalletAddressInput.tsx +1 -1
- package/src/react/ui/modals/_internal/components/actionModal/ActionModal.test.tsx +7 -2
- package/src/react/ui/modals/_internal/components/priceInput/index.tsx +1 -1
- package/src/react/ui/modals/_internal/components/quantityInput/index.tsx +1 -2
- package/src/react/ui/modals/_internal/components/waasFeeOptionsSelect/WaasFeeOptionsSelect.tsx +0 -1
- package/src/types/index.ts +7 -1
- package/src/types/sdk-config.ts +4 -9
- package/src/utils/fetchContentType.ts +104 -0
- package/src/utils/getSequenceMarketRequestId.ts +32 -0
- package/test/mocks/wallet.ts +3 -1
- package/test/test-utils.tsx +1 -1
- package/tsconfig.tsbuildinfo +1 -1
- package/dist/builder-types-D5HgAUWR.d.ts +0 -82
- package/dist/chunk-5HEZNTSU.js.map +0 -1
- package/dist/chunk-KTT27YUN.js.map +0 -1
- package/dist/chunk-N7E37ENQ.js +0 -58
- package/dist/chunk-N7E37ENQ.js.map +0 -1
- package/dist/chunk-Y6AOCO3Q.js.map +0 -1
- package/dist/chunk-YAUZLETY.js.map +0 -1
- package/dist/sdk-config-DIzJk_tI.d.ts +0 -26
- package/src/react/hooks/options/__tests__/marketplaceConfigOptions.test.tsx +0 -134
- package/src/react/hooks/options/marketplaceConfigOptions.ts +0 -71
- package/src/react/ui/components/collectible-card/CollectibleAsset.tsx +0 -139
- package/src/types/builder-types.ts +0 -88
- /package/dist/{chunk-7FVZD2LL.js.map → chunk-4XLXOEXQ.js.map} +0 -0
- /package/dist/{chunk-O6GWM7C3.js.map → chunk-HHYNOPPI.js.map} +0 -0
- /package/dist/{chunk-Q2DA477S.js.map → chunk-YALXP2PW.js.map} +0 -0
- /package/dist/{chunk-A6V7XDY4.js.map → chunk-YBOFRP65.js.map} +0 -0
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
import {
|
|
4
4
|
ActionModal
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-YBOFRP65.js";
|
|
6
6
|
import {
|
|
7
7
|
useAnalytics
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-HHYNOPPI.js";
|
|
9
9
|
import {
|
|
10
10
|
BellIcon_default,
|
|
11
11
|
CalendarIcon_default,
|
|
@@ -33,7 +33,7 @@ import {
|
|
|
33
33
|
useSwitchChainModal,
|
|
34
34
|
useTransferTokens,
|
|
35
35
|
useWallet
|
|
36
|
-
} from "./chunk-
|
|
36
|
+
} from "./chunk-G3447GIP.js";
|
|
37
37
|
import {
|
|
38
38
|
DEFAULT_MARKETPLACE_FEE_PERCENTAGE
|
|
39
39
|
} from "./chunk-Y63BOO6M.js";
|
|
@@ -45,13 +45,18 @@ import {
|
|
|
45
45
|
truncateMiddle
|
|
46
46
|
} from "./chunk-YEGD7PWE.js";
|
|
47
47
|
import {
|
|
48
|
-
|
|
49
|
-
|
|
48
|
+
SequenceMarketplaceV1_ABI
|
|
49
|
+
} from "./chunk-XX4EVWBF.js";
|
|
50
|
+
import {
|
|
50
51
|
balanceQueries,
|
|
51
52
|
collectableKeys,
|
|
52
53
|
getMarketplaceClient,
|
|
53
54
|
getQueryClient
|
|
54
|
-
} from "./chunk-
|
|
55
|
+
} from "./chunk-KGM2WLSP.js";
|
|
56
|
+
import {
|
|
57
|
+
InvalidContractTypeError,
|
|
58
|
+
InvalidStepError
|
|
59
|
+
} from "./chunk-NX52D7NX.js";
|
|
55
60
|
|
|
56
61
|
// src/react/ui/modals/modal-provider.tsx
|
|
57
62
|
import { observer as observer17 } from "@legendapp/state/react";
|
|
@@ -226,7 +231,7 @@ var quantityInput_default = observer(function QuantityInput({
|
|
|
226
231
|
"div",
|
|
227
232
|
{
|
|
228
233
|
className: cn(
|
|
229
|
-
"flex w-full flex-col [&>label>div>div:has(:disabled):hover]:opacity-100 [&>label>div>div:has(:disabled)]:opacity-100 [&>label>div>div>input]:text-xs [&>label>div>div]:h-9 [&>label>div>div]:rounded [&>label>div>div]:pr-0 [&>label>div>div]:pl-3 [&>label>div>div]:text-xs [&>label]:gap-[2px]",
|
|
234
|
+
"flex w-full flex-col [&>label>div>div>div:has(:disabled):hover]:opacity-100 [&>label>div>div>div:has(:disabled)]:opacity-100 [&>label>div>div>div>input]:text-xs [&>label>div>div>div]:h-9 [&>label>div>div>div]:rounded [&>label>div>div>div]:pr-0 [&>label>div>div>div]:pl-3 [&>label>div>div>div]:text-xs [&>label]:gap-[2px]",
|
|
230
235
|
className,
|
|
231
236
|
disabled && "pointer-events-none opacity-50"
|
|
232
237
|
),
|
|
@@ -259,7 +264,6 @@ var quantityInput_default = observer(function QuantityInput({
|
|
|
259
264
|
}
|
|
260
265
|
)
|
|
261
266
|
] }),
|
|
262
|
-
numeric: true,
|
|
263
267
|
value: localQuantity,
|
|
264
268
|
onChange: (e) => handleChangeQuantity(e.target.value),
|
|
265
269
|
width: "full"
|
|
@@ -552,7 +556,8 @@ var getBuyCollectableParams = async ({
|
|
|
552
556
|
collectable,
|
|
553
557
|
checkoutOptions,
|
|
554
558
|
fee,
|
|
555
|
-
skipNativeBalanceCheck
|
|
559
|
+
skipNativeBalanceCheck,
|
|
560
|
+
nativeTokenAddress
|
|
556
561
|
}) => {
|
|
557
562
|
const marketplaceClient = getMarketplaceClient(chainId, config);
|
|
558
563
|
const { steps: steps3 } = await marketplaceClient.generateBuyTransaction({
|
|
@@ -598,7 +603,7 @@ var getBuyCollectableParams = async ({
|
|
|
598
603
|
callbacks?.onSuccess?.({ hash });
|
|
599
604
|
},
|
|
600
605
|
supplementaryAnalyticsInfo: {
|
|
601
|
-
orderId,
|
|
606
|
+
requestId: orderId,
|
|
602
607
|
marketplaceKind: marketplace
|
|
603
608
|
},
|
|
604
609
|
onError: callbacks?.onError,
|
|
@@ -608,6 +613,7 @@ var getBuyCollectableParams = async ({
|
|
|
608
613
|
buyModalStore.send({ type: "close" });
|
|
609
614
|
},
|
|
610
615
|
skipNativeBalanceCheck,
|
|
616
|
+
nativeTokenAddress,
|
|
611
617
|
...customCreditCardProviderCallback && {
|
|
612
618
|
customProviderCallback: () => {
|
|
613
619
|
customCreditCardProviderCallback(buyStep);
|
|
@@ -632,7 +638,8 @@ var usePaymentModalParams = (args) => {
|
|
|
632
638
|
collectibleId,
|
|
633
639
|
orderId,
|
|
634
640
|
customCreditCardProviderCallback,
|
|
635
|
-
skipNativeBalanceCheck
|
|
641
|
+
skipNativeBalanceCheck,
|
|
642
|
+
nativeTokenAddress
|
|
636
643
|
} = buyModalProps;
|
|
637
644
|
const config = useConfig();
|
|
638
645
|
const fee = useFees({
|
|
@@ -662,7 +669,8 @@ var usePaymentModalParams = (args) => {
|
|
|
662
669
|
onError
|
|
663
670
|
},
|
|
664
671
|
customCreditCardProviderCallback,
|
|
665
|
-
skipNativeBalanceCheck
|
|
672
|
+
skipNativeBalanceCheck,
|
|
673
|
+
nativeTokenAddress
|
|
666
674
|
}) : skipToken2
|
|
667
675
|
});
|
|
668
676
|
};
|
|
@@ -1199,7 +1207,6 @@ var CustomSelect = ({
|
|
|
1199
1207
|
/* @__PURE__ */ jsx11(ChevronDownIcon, { size: "xs" })
|
|
1200
1208
|
] }),
|
|
1201
1209
|
shape: "circle",
|
|
1202
|
-
opacity: "100",
|
|
1203
1210
|
className: `bg-overlay-light py-1.5 pl-3 ${className || ""}`,
|
|
1204
1211
|
"data-testid": `${testId}-trigger`
|
|
1205
1212
|
}
|
|
@@ -1369,7 +1376,7 @@ function PriceInput({
|
|
|
1369
1376
|
),
|
|
1370
1377
|
children: [
|
|
1371
1378
|
/* @__PURE__ */ jsx13("div", { className: "absolute top-8 left-2 flex items-center", children: /* @__PURE__ */ jsx13(currencyImage_default, { price$: $price }) }),
|
|
1372
|
-
/* @__PURE__ */ jsx13("div", { className: "[&>label>div>.rounded-xl]:h-9 [&>label>div>.rounded-xl]:rounded-sm [&>label>div>.rounded-xl]:px-2 [&>label]:gap-1", children: /* @__PURE__ */ jsx13(
|
|
1379
|
+
/* @__PURE__ */ jsx13("div", { className: "[&>label>div>div>.rounded-xl]:h-9 [&>label>div>div>.rounded-xl]:rounded-sm [&>label>div>div>.rounded-xl]:px-2 [&>label]:gap-1", children: /* @__PURE__ */ jsx13(
|
|
1373
1380
|
NumericInput2,
|
|
1374
1381
|
{
|
|
1375
1382
|
ref: inputRef,
|
|
@@ -1441,7 +1448,6 @@ var WaasFeeOptionsSelect = observer4(
|
|
|
1441
1448
|
return /* @__PURE__ */ jsx14(
|
|
1442
1449
|
Select,
|
|
1443
1450
|
{
|
|
1444
|
-
items: feeOptions,
|
|
1445
1451
|
name: "fee-option",
|
|
1446
1452
|
options: feeOptions.map((option) => ({
|
|
1447
1453
|
label: option.content,
|
|
@@ -1915,6 +1921,29 @@ var useGetTokenApprovalData = (params) => {
|
|
|
1915
1921
|
// src/react/ui/modals/CreateListingModal/hooks/useTransactionSteps.tsx
|
|
1916
1922
|
import { formatUnits as formatUnits5 } from "viem";
|
|
1917
1923
|
|
|
1924
|
+
// src/utils/getSequenceMarketRequestId.ts
|
|
1925
|
+
import {
|
|
1926
|
+
parseEventLogs
|
|
1927
|
+
} from "viem";
|
|
1928
|
+
var getSequenceMarketplaceRequestId = async (hash, publicClient, walletAddress) => {
|
|
1929
|
+
try {
|
|
1930
|
+
const receipt = await publicClient.getTransactionReceipt({
|
|
1931
|
+
hash
|
|
1932
|
+
});
|
|
1933
|
+
const logs = parseEventLogs({
|
|
1934
|
+
abi: SequenceMarketplaceV1_ABI,
|
|
1935
|
+
eventName: "RequestCreated",
|
|
1936
|
+
args: {
|
|
1937
|
+
creator: walletAddress
|
|
1938
|
+
},
|
|
1939
|
+
logs: receipt.logs
|
|
1940
|
+
});
|
|
1941
|
+
return logs[0].args.requestId.toString();
|
|
1942
|
+
} catch (error) {
|
|
1943
|
+
console.error(error);
|
|
1944
|
+
}
|
|
1945
|
+
};
|
|
1946
|
+
|
|
1918
1947
|
// src/react/ui/modals/_internal/components/transactionStatusModal/index.tsx
|
|
1919
1948
|
import { Modal, Skeleton as Skeleton8, Text as Text15 } from "@0xsequence/design-system";
|
|
1920
1949
|
import { use$ as use$3 } from "@legendapp/state/react";
|
|
@@ -2590,12 +2619,22 @@ var useTransactionSteps = ({
|
|
|
2590
2619
|
const currencyValueDecimal = Number(
|
|
2591
2620
|
formatUnits5(BigInt(currencyValueRaw), currencyDecimal)
|
|
2592
2621
|
);
|
|
2622
|
+
let requestId = orderId;
|
|
2623
|
+
if (hash && (orderbookKind === "sequence_marketplace_v1" /* sequence_marketplace_v1 */ || orderbookKind === "sequence_marketplace_v2" /* sequence_marketplace_v2 */)) {
|
|
2624
|
+
requestId = await getSequenceMarketplaceRequestId(
|
|
2625
|
+
hash,
|
|
2626
|
+
wallet.publicClient,
|
|
2627
|
+
await wallet.address()
|
|
2628
|
+
);
|
|
2629
|
+
}
|
|
2593
2630
|
analytics.trackCreateListing({
|
|
2594
2631
|
props: {
|
|
2595
2632
|
orderbookKind,
|
|
2596
2633
|
collectionAddress,
|
|
2597
2634
|
currencyAddress: listingInput.listing.currencyAddress,
|
|
2598
|
-
currencySymbol: "",
|
|
2635
|
+
currencySymbol: currency?.symbol || "",
|
|
2636
|
+
tokenId: listingInput.listing.tokenId,
|
|
2637
|
+
requestId: requestId || "",
|
|
2599
2638
|
chainId: chainId.toString(),
|
|
2600
2639
|
txnHash: hash || ""
|
|
2601
2640
|
},
|
|
@@ -3181,6 +3220,14 @@ var useTransactionSteps2 = ({
|
|
|
3181
3220
|
const currencyValueDecimal = Number(
|
|
3182
3221
|
formatUnits6(BigInt(currencyValueRaw), currencyDecimal)
|
|
3183
3222
|
);
|
|
3223
|
+
let requestId = orderId;
|
|
3224
|
+
if (hash && (orderbookKind === "sequence_marketplace_v1" /* sequence_marketplace_v1 */ || orderbookKind === "sequence_marketplace_v2" /* sequence_marketplace_v2 */)) {
|
|
3225
|
+
requestId = await getSequenceMarketplaceRequestId(
|
|
3226
|
+
hash,
|
|
3227
|
+
wallet.publicClient,
|
|
3228
|
+
await wallet.address()
|
|
3229
|
+
);
|
|
3230
|
+
}
|
|
3184
3231
|
analytics.trackCreateOffer({
|
|
3185
3232
|
props: {
|
|
3186
3233
|
orderbookKind,
|
|
@@ -3188,6 +3235,7 @@ var useTransactionSteps2 = ({
|
|
|
3188
3235
|
currencyAddress: offerInput.offer.currencyAddress,
|
|
3189
3236
|
currencySymbol: currency?.symbol || "",
|
|
3190
3237
|
chainId: chainId.toString(),
|
|
3238
|
+
requestId: requestId || "",
|
|
3191
3239
|
txnHash: hash || ""
|
|
3192
3240
|
},
|
|
3193
3241
|
nums: {
|
|
@@ -3805,9 +3853,12 @@ var useTransactionSteps3 = ({
|
|
|
3805
3853
|
analytics.trackSellItems({
|
|
3806
3854
|
props: {
|
|
3807
3855
|
marketplaceKind: marketplace,
|
|
3856
|
+
userId: await wallet.address(),
|
|
3808
3857
|
collectionAddress,
|
|
3809
3858
|
currencyAddress: ordersData[0].currencyAddress,
|
|
3810
3859
|
currencySymbol,
|
|
3860
|
+
requestId: ordersData[0].orderId,
|
|
3861
|
+
tokenId: collectibleId,
|
|
3811
3862
|
chainId: chainId.toString(),
|
|
3812
3863
|
txnHash: hash || ""
|
|
3813
3864
|
},
|
|
@@ -4218,16 +4269,20 @@ function SuccessfulPurchaseActions() {
|
|
|
4218
4269
|
}
|
|
4219
4270
|
),
|
|
4220
4271
|
/* @__PURE__ */ jsx28(
|
|
4221
|
-
|
|
4272
|
+
"a",
|
|
4222
4273
|
{
|
|
4223
|
-
className: "w-full",
|
|
4224
|
-
as: "a",
|
|
4225
4274
|
href: successfulPurchaseModal$.state.explorerUrl.get(),
|
|
4226
4275
|
target: "_blank",
|
|
4227
4276
|
rel: "noopener noreferrer",
|
|
4228
|
-
|
|
4229
|
-
|
|
4230
|
-
|
|
4277
|
+
className: "w-full",
|
|
4278
|
+
children: /* @__PURE__ */ jsx28(
|
|
4279
|
+
Button5,
|
|
4280
|
+
{
|
|
4281
|
+
shape: "square",
|
|
4282
|
+
leftIcon: ExternalLinkIcon,
|
|
4283
|
+
label: `View on ${successfulPurchaseModal$.state.explorerName.get()}`
|
|
4284
|
+
}
|
|
4285
|
+
)
|
|
4231
4286
|
}
|
|
4232
4287
|
)
|
|
4233
4288
|
] });
|
|
@@ -4370,7 +4425,7 @@ var TokenQuantityInput = observer11(
|
|
|
4370
4425
|
$invalidQuantity,
|
|
4371
4426
|
decimals: collection?.decimals || 0,
|
|
4372
4427
|
maxQuantity: balanceAmount ? String(balanceAmount) : "0",
|
|
4373
|
-
className: "[&>label>div>div]:h-13 [&>label>div>div]:rounded-xl [&>label>div>span]:text-sm [&>label>div>span]:text-text-80 [&>label]:gap-1"
|
|
4428
|
+
className: "[&>label>div>div>div>input]:text-sm [&>label>div>div>div]:h-13 [&>label>div>div>div]:rounded-xl [&>label>div>div>span]:text-sm [&>label>div>div>span]:text-text-80 [&>label]:gap-1"
|
|
4374
4429
|
}
|
|
4375
4430
|
),
|
|
4376
4431
|
/* @__PURE__ */ jsx29(
|
|
@@ -4446,7 +4501,7 @@ var WalletAddressInput = observer13(() => {
|
|
|
4446
4501
|
const handleChangeWalletAddress = (event) => {
|
|
4447
4502
|
transferModal$.state.receiverAddress.set(event.target.value);
|
|
4448
4503
|
};
|
|
4449
|
-
return /* @__PURE__ */ jsxs24("div", { className: "[&>label>div
|
|
4504
|
+
return /* @__PURE__ */ jsxs24("div", { className: "[&>label>div>>span]:text-sm [&>label>div>span]:text-text-80 [&>label]:gap-1", children: [
|
|
4450
4505
|
/* @__PURE__ */ jsx31(
|
|
4451
4506
|
TextInput,
|
|
4452
4507
|
{
|
|
@@ -4793,7 +4848,7 @@ var useSellModal = (callbacks) => {
|
|
|
4793
4848
|
};
|
|
4794
4849
|
|
|
4795
4850
|
// src/react/ui/components/collectible-card/CollectibleCard.tsx
|
|
4796
|
-
import { Skeleton as
|
|
4851
|
+
import { Skeleton as Skeleton12 } from "@0xsequence/design-system";
|
|
4797
4852
|
|
|
4798
4853
|
// src/react/ui/components/_internals/action-button/ActionButton.tsx
|
|
4799
4854
|
import { observer as observer18 } from "@legendapp/state/react";
|
|
@@ -5078,111 +5133,6 @@ var ActionButton = observer18(
|
|
|
5078
5133
|
}
|
|
5079
5134
|
);
|
|
5080
5135
|
|
|
5081
|
-
// src/react/ui/components/collectible-card/CollectibleAsset.tsx
|
|
5082
|
-
import { Skeleton as Skeleton10 } from "@0xsequence/design-system";
|
|
5083
|
-
import { useEffect as useEffect12, useRef as useRef3, useState as useState10 } from "react";
|
|
5084
|
-
import { jsx as jsx40, jsxs as jsxs29 } from "react/jsx-runtime";
|
|
5085
|
-
function CollectibleAssetSkeleton() {
|
|
5086
|
-
return /* @__PURE__ */ jsx40(
|
|
5087
|
-
Skeleton10,
|
|
5088
|
-
{
|
|
5089
|
-
"data-testid": "collectible-asset-skeleton",
|
|
5090
|
-
size: "lg",
|
|
5091
|
-
className: "absolute inset-0 h-full w-full animate-shimmer",
|
|
5092
|
-
style: {
|
|
5093
|
-
borderRadius: 0
|
|
5094
|
-
}
|
|
5095
|
-
}
|
|
5096
|
-
);
|
|
5097
|
-
}
|
|
5098
|
-
var isHtml = (fileName) => {
|
|
5099
|
-
const isHtml2 = /.*\.(html\?.+|html)$/.test(fileName?.toLowerCase() || "");
|
|
5100
|
-
return isHtml2;
|
|
5101
|
-
};
|
|
5102
|
-
var isVideo = (fileName) => {
|
|
5103
|
-
const isVideo2 = /.*\.(mp4|ogg|webm)$/.test(fileName?.toLowerCase() || "");
|
|
5104
|
-
return isVideo2;
|
|
5105
|
-
};
|
|
5106
|
-
function CollectibleAsset({
|
|
5107
|
-
name,
|
|
5108
|
-
collectibleMetadata,
|
|
5109
|
-
assetSrcPrefixUrl
|
|
5110
|
-
}) {
|
|
5111
|
-
const [assetLoadFailed, setAssetLoadFailed] = useState10(false);
|
|
5112
|
-
const [assetLoading, setAssetLoading] = useState10(true);
|
|
5113
|
-
const videoRef = useRef3(null);
|
|
5114
|
-
const isSafari = /^((?!chrome|android).)*safari/i.test(navigator.userAgent);
|
|
5115
|
-
const placeholderImage = chess_tile_default;
|
|
5116
|
-
const assetUrl = collectibleMetadata?.image || collectibleMetadata?.video || collectibleMetadata?.animation_url || collectibleMetadata?.assets?.[0]?.url || placeholderImage;
|
|
5117
|
-
const proxiedAssetUrl = assetSrcPrefixUrl ? `${assetSrcPrefixUrl}${assetUrl}` : assetUrl;
|
|
5118
|
-
useEffect12(() => {
|
|
5119
|
-
if (videoRef.current) {
|
|
5120
|
-
videoRef.current.addEventListener("loadedmetadata", () => {
|
|
5121
|
-
setAssetLoading(false);
|
|
5122
|
-
});
|
|
5123
|
-
}
|
|
5124
|
-
}, []);
|
|
5125
|
-
if (isHtml(assetUrl)) {
|
|
5126
|
-
return /* @__PURE__ */ jsxs29("div", { className: "flex aspect-square w-full items-center justify-center overflow-hidden rounded-lg bg-background-secondary", children: [
|
|
5127
|
-
assetLoading && /* @__PURE__ */ jsx40(CollectibleAssetSkeleton, {}),
|
|
5128
|
-
/* @__PURE__ */ jsx40(
|
|
5129
|
-
"iframe",
|
|
5130
|
-
{
|
|
5131
|
-
title: name || "Collectible",
|
|
5132
|
-
className: "aspect-square w-full",
|
|
5133
|
-
src: proxiedAssetUrl,
|
|
5134
|
-
allow: "accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture",
|
|
5135
|
-
sandbox: "allow-scripts",
|
|
5136
|
-
style: {
|
|
5137
|
-
border: "0px"
|
|
5138
|
-
},
|
|
5139
|
-
onError: () => setAssetLoadFailed(true),
|
|
5140
|
-
onLoad: () => setAssetLoading(false)
|
|
5141
|
-
}
|
|
5142
|
-
)
|
|
5143
|
-
] });
|
|
5144
|
-
}
|
|
5145
|
-
if (isVideo(assetUrl)) {
|
|
5146
|
-
return /* @__PURE__ */ jsxs29("div", { className: "relative flex aspect-square w-full items-center justify-center overflow-hidden rounded-lg bg-background-secondary", children: [
|
|
5147
|
-
assetLoading && /* @__PURE__ */ jsx40(CollectibleAssetSkeleton, {}),
|
|
5148
|
-
/* @__PURE__ */ jsx40(
|
|
5149
|
-
"video",
|
|
5150
|
-
{
|
|
5151
|
-
ref: videoRef,
|
|
5152
|
-
className: cn(
|
|
5153
|
-
`absolute inset-0 h-full w-full object-cover transition-transform duration-200 ease-in-out group-hover:scale-hover ${assetLoading ? "invisible" : "visible"}`,
|
|
5154
|
-
// we can't hide the video controls in safari, when user hovers over the video they show up. `pointer-events-none` is the only way to hide them on hover
|
|
5155
|
-
isSafari && "pointer-events-none"
|
|
5156
|
-
),
|
|
5157
|
-
autoPlay: true,
|
|
5158
|
-
loop: true,
|
|
5159
|
-
controls: true,
|
|
5160
|
-
playsInline: true,
|
|
5161
|
-
muted: true,
|
|
5162
|
-
controlsList: "nodownload noremoteplayback nofullscreen ",
|
|
5163
|
-
onError: () => {
|
|
5164
|
-
setAssetLoadFailed(true);
|
|
5165
|
-
},
|
|
5166
|
-
children: /* @__PURE__ */ jsx40("source", { src: proxiedAssetUrl })
|
|
5167
|
-
}
|
|
5168
|
-
)
|
|
5169
|
-
] });
|
|
5170
|
-
}
|
|
5171
|
-
return /* @__PURE__ */ jsxs29("div", { className: "relative aspect-square overflow-hidden bg-background-secondary", children: [
|
|
5172
|
-
assetLoading && /* @__PURE__ */ jsx40(CollectibleAssetSkeleton, {}),
|
|
5173
|
-
/* @__PURE__ */ jsx40(
|
|
5174
|
-
"img",
|
|
5175
|
-
{
|
|
5176
|
-
src: assetLoadFailed ? placeholderImage : proxiedAssetUrl,
|
|
5177
|
-
alt: name || "Collectible",
|
|
5178
|
-
className: `absolute inset-0 h-full w-full object-cover transition-transform duration-200 ease-in-out group-hover:scale-hover ${assetLoading ? "invisible" : "visible"}`,
|
|
5179
|
-
onError: () => setAssetLoadFailed(true),
|
|
5180
|
-
onLoad: () => setAssetLoading(false)
|
|
5181
|
-
}
|
|
5182
|
-
)
|
|
5183
|
-
] });
|
|
5184
|
-
}
|
|
5185
|
-
|
|
5186
5136
|
// src/react/ui/components/collectible-card/Footer.tsx
|
|
5187
5137
|
import {
|
|
5188
5138
|
ChevronLeftIcon,
|
|
@@ -5192,22 +5142,22 @@ import {
|
|
|
5192
5142
|
Text as Text21
|
|
5193
5143
|
} from "@0xsequence/design-system";
|
|
5194
5144
|
import { formatUnits as formatUnits8 } from "viem";
|
|
5195
|
-
import { jsx as
|
|
5145
|
+
import { jsx as jsx40, jsxs as jsxs29 } from "react/jsx-runtime";
|
|
5196
5146
|
var OVERFLOW_PRICE = 1e8;
|
|
5197
5147
|
var UNDERFLOW_PRICE = 1e-4;
|
|
5198
5148
|
var formatPrice = (amount, currency) => {
|
|
5199
5149
|
const formattedPrice = formatUnits8(BigInt(amount), currency.decimals);
|
|
5200
5150
|
const numericPrice = Number.parseFloat(formattedPrice);
|
|
5201
5151
|
if (numericPrice < UNDERFLOW_PRICE) {
|
|
5202
|
-
return /* @__PURE__ */
|
|
5203
|
-
/* @__PURE__ */
|
|
5204
|
-
/* @__PURE__ */
|
|
5152
|
+
return /* @__PURE__ */ jsxs29("div", { className: "flex items-center", children: [
|
|
5153
|
+
/* @__PURE__ */ jsx40(ChevronLeftIcon, { className: "h-3 w-3 text-text-100" }),
|
|
5154
|
+
/* @__PURE__ */ jsx40(Text21, { children: `${UNDERFLOW_PRICE} ${currency.symbol}` })
|
|
5205
5155
|
] });
|
|
5206
5156
|
}
|
|
5207
5157
|
if (numericPrice > OVERFLOW_PRICE) {
|
|
5208
|
-
return /* @__PURE__ */
|
|
5209
|
-
/* @__PURE__ */
|
|
5210
|
-
/* @__PURE__ */
|
|
5158
|
+
return /* @__PURE__ */ jsxs29("div", { className: "flex items-center", children: [
|
|
5159
|
+
/* @__PURE__ */ jsx40(ChevronRightIcon, { className: "h-3 w-3 text-text-100" }),
|
|
5160
|
+
/* @__PURE__ */ jsx40(Text21, { children: `${OVERFLOW_PRICE.toLocaleString("en-US", {
|
|
5211
5161
|
maximumFractionDigits: 2
|
|
5212
5162
|
})} ${currency.symbol}` })
|
|
5213
5163
|
] });
|
|
@@ -5217,7 +5167,7 @@ var formatPrice = (amount, currency) => {
|
|
|
5217
5167
|
minimumFractionDigits: 0,
|
|
5218
5168
|
maximumFractionDigits: maxDecimals
|
|
5219
5169
|
});
|
|
5220
|
-
return /* @__PURE__ */
|
|
5170
|
+
return /* @__PURE__ */ jsx40("div", { className: "flex items-center gap-1", children: /* @__PURE__ */ jsxs29(Text21, { children: [
|
|
5221
5171
|
formattedNumber,
|
|
5222
5172
|
" ",
|
|
5223
5173
|
currency.symbol
|
|
@@ -5240,10 +5190,10 @@ var Footer = ({
|
|
|
5240
5190
|
if (name.length > 17 && !highestOffer) {
|
|
5241
5191
|
name = `${name.substring(0, 17)}...`;
|
|
5242
5192
|
}
|
|
5243
|
-
return /* @__PURE__ */
|
|
5244
|
-
/* @__PURE__ */
|
|
5245
|
-
/* @__PURE__ */
|
|
5246
|
-
highestOffer && onOfferClick && /* @__PURE__ */
|
|
5193
|
+
return /* @__PURE__ */ jsxs29("div", { className: "relative flex flex-col items-start gap-2 whitespace-nowrap bg-background-primary p-4", children: [
|
|
5194
|
+
/* @__PURE__ */ jsxs29("div", { className: "relative flex w-full items-center justify-between", children: [
|
|
5195
|
+
/* @__PURE__ */ jsx40(Text21, { className: "text-left font-body font-bold text-sm text-text-100", children: name || "Untitled" }),
|
|
5196
|
+
highestOffer && onOfferClick && /* @__PURE__ */ jsx40(
|
|
5247
5197
|
IconButton2,
|
|
5248
5198
|
{
|
|
5249
5199
|
className: "absolute top-0 right-0 h-[22px] w-[22px] hover:animate-bell-ring",
|
|
@@ -5252,12 +5202,12 @@ var Footer = ({
|
|
|
5252
5202
|
onClick: (e) => {
|
|
5253
5203
|
onOfferClick?.(e);
|
|
5254
5204
|
},
|
|
5255
|
-
icon: (props) => /* @__PURE__ */
|
|
5205
|
+
icon: (props) => /* @__PURE__ */ jsx40(BellIcon_default, { ...props, size: "xs" })
|
|
5256
5206
|
}
|
|
5257
5207
|
)
|
|
5258
5208
|
] }),
|
|
5259
|
-
/* @__PURE__ */
|
|
5260
|
-
listed && lowestListingCurrency.imageUrl && /* @__PURE__ */
|
|
5209
|
+
/* @__PURE__ */ jsxs29("div", { className: "flex items-center gap-1", children: [
|
|
5210
|
+
listed && lowestListingCurrency.imageUrl && /* @__PURE__ */ jsx40(
|
|
5261
5211
|
Image7,
|
|
5262
5212
|
{
|
|
5263
5213
|
className: "h-3 w-3",
|
|
@@ -5267,7 +5217,7 @@ var Footer = ({
|
|
|
5267
5217
|
}
|
|
5268
5218
|
}
|
|
5269
5219
|
),
|
|
5270
|
-
/* @__PURE__ */
|
|
5220
|
+
/* @__PURE__ */ jsxs29(
|
|
5271
5221
|
Text21,
|
|
5272
5222
|
{
|
|
5273
5223
|
className: `text-left font-body font-bold text-sm ${listed ? "text-text-100" : "text-text-50"}`,
|
|
@@ -5278,7 +5228,7 @@ var Footer = ({
|
|
|
5278
5228
|
}
|
|
5279
5229
|
)
|
|
5280
5230
|
] }),
|
|
5281
|
-
/* @__PURE__ */
|
|
5231
|
+
/* @__PURE__ */ jsx40(
|
|
5282
5232
|
TokenTypeBalancePill,
|
|
5283
5233
|
{
|
|
5284
5234
|
balance,
|
|
@@ -5294,11 +5244,314 @@ var TokenTypeBalancePill = ({
|
|
|
5294
5244
|
decimals
|
|
5295
5245
|
}) => {
|
|
5296
5246
|
const displayText = type === "ERC1155" /* ERC1155 */ ? balance ? `Owned: ${formatUnits8(BigInt(balance), decimals ?? 0)}` : "ERC-1155" : "ERC-721";
|
|
5297
|
-
return /* @__PURE__ */
|
|
5247
|
+
return /* @__PURE__ */ jsx40(Text21, { className: "rounded-lg bg-background-secondary px-2 py-1 text-left font-medium text-text-80 text-xs", children: displayText });
|
|
5298
5248
|
};
|
|
5299
5249
|
|
|
5250
|
+
// src/react/ui/components/collectible-card/collectible-asset/CollectibleAsset.tsx
|
|
5251
|
+
import { useEffect as useEffect12, useRef as useRef3, useState as useState10 } from "react";
|
|
5252
|
+
|
|
5253
|
+
// src/utils/fetchContentType.ts
|
|
5254
|
+
function fetchContentType(url) {
|
|
5255
|
+
return new Promise((resolve, reject) => {
|
|
5256
|
+
if (typeof XMLHttpRequest === "undefined") {
|
|
5257
|
+
reject(new Error("XMLHttpRequest is not supported in this environment."));
|
|
5258
|
+
return;
|
|
5259
|
+
}
|
|
5260
|
+
const client = new XMLHttpRequest();
|
|
5261
|
+
let settled = false;
|
|
5262
|
+
const settle = (value) => {
|
|
5263
|
+
if (!settled) {
|
|
5264
|
+
settled = true;
|
|
5265
|
+
resolve(value);
|
|
5266
|
+
client.abort();
|
|
5267
|
+
}
|
|
5268
|
+
};
|
|
5269
|
+
const fail = (error) => {
|
|
5270
|
+
if (!settled) {
|
|
5271
|
+
settled = true;
|
|
5272
|
+
reject(error);
|
|
5273
|
+
}
|
|
5274
|
+
};
|
|
5275
|
+
client.open("HEAD", url, true);
|
|
5276
|
+
client.onreadystatechange = () => {
|
|
5277
|
+
if (settled || client.readyState < XMLHttpRequest.HEADERS_RECEIVED) {
|
|
5278
|
+
return;
|
|
5279
|
+
}
|
|
5280
|
+
if (client.readyState === XMLHttpRequest.HEADERS_RECEIVED) {
|
|
5281
|
+
const status = client.status;
|
|
5282
|
+
if (status < 200 || status >= 300) {
|
|
5283
|
+
settle(null);
|
|
5284
|
+
return;
|
|
5285
|
+
}
|
|
5286
|
+
const contentType = client.getResponseHeader("Content-Type");
|
|
5287
|
+
if (!contentType) {
|
|
5288
|
+
settle(null);
|
|
5289
|
+
return;
|
|
5290
|
+
}
|
|
5291
|
+
const primaryType = contentType.split("/")[0].toLowerCase();
|
|
5292
|
+
let result = null;
|
|
5293
|
+
switch (primaryType) {
|
|
5294
|
+
case "image":
|
|
5295
|
+
result = "image";
|
|
5296
|
+
break;
|
|
5297
|
+
case "video":
|
|
5298
|
+
result = "video";
|
|
5299
|
+
break;
|
|
5300
|
+
case "text":
|
|
5301
|
+
if (contentType.toLowerCase().includes("html")) {
|
|
5302
|
+
result = "html";
|
|
5303
|
+
}
|
|
5304
|
+
break;
|
|
5305
|
+
case "model":
|
|
5306
|
+
result = "3d-model";
|
|
5307
|
+
break;
|
|
5308
|
+
}
|
|
5309
|
+
settle(result);
|
|
5310
|
+
return;
|
|
5311
|
+
}
|
|
5312
|
+
};
|
|
5313
|
+
client.onerror = (errorEvent) => {
|
|
5314
|
+
fail(
|
|
5315
|
+
new Error(`XMLHttpRequest network error for URL: ${url}`, {
|
|
5316
|
+
cause: errorEvent
|
|
5317
|
+
})
|
|
5318
|
+
);
|
|
5319
|
+
};
|
|
5320
|
+
client.onabort = () => {
|
|
5321
|
+
if (!settled) {
|
|
5322
|
+
settle(null);
|
|
5323
|
+
}
|
|
5324
|
+
};
|
|
5325
|
+
try {
|
|
5326
|
+
client.send();
|
|
5327
|
+
} catch (error) {
|
|
5328
|
+
fail(
|
|
5329
|
+
new Error(`Error sending XMLHttpRequest for URL: ${url}`, {
|
|
5330
|
+
cause: error
|
|
5331
|
+
})
|
|
5332
|
+
);
|
|
5333
|
+
}
|
|
5334
|
+
});
|
|
5335
|
+
}
|
|
5336
|
+
|
|
5337
|
+
// src/react/ui/components/ModelViewer.tsx
|
|
5338
|
+
import { Skeleton as Skeleton10 } from "@0xsequence/design-system";
|
|
5339
|
+
import { Suspense, lazy } from "react";
|
|
5340
|
+
import { jsx as jsx41 } from "react/jsx-runtime";
|
|
5341
|
+
var ModelViewerComponent = lazy(
|
|
5342
|
+
() => import("@google/model-viewer").then(() => ({
|
|
5343
|
+
default: ({
|
|
5344
|
+
posterSrc,
|
|
5345
|
+
src,
|
|
5346
|
+
onLoad,
|
|
5347
|
+
onError
|
|
5348
|
+
}) => /* @__PURE__ */ jsx41("div", { className: "h-full w-full bg-background-raised", children: /* @__PURE__ */ jsx41(
|
|
5349
|
+
"model-viewer",
|
|
5350
|
+
{
|
|
5351
|
+
alt: "3d model",
|
|
5352
|
+
"auto-rotate": true,
|
|
5353
|
+
autoplay: true,
|
|
5354
|
+
"camera-controls": true,
|
|
5355
|
+
class: "h-full w-full",
|
|
5356
|
+
error: onError,
|
|
5357
|
+
load: onLoad,
|
|
5358
|
+
loading: "eager",
|
|
5359
|
+
poster: posterSrc,
|
|
5360
|
+
reveal: "auto",
|
|
5361
|
+
"shadow-intensity": "1",
|
|
5362
|
+
src,
|
|
5363
|
+
"touch-action": "pan-y"
|
|
5364
|
+
}
|
|
5365
|
+
) })
|
|
5366
|
+
}))
|
|
5367
|
+
);
|
|
5368
|
+
var ModelViewerLoading = () => /* @__PURE__ */ jsx41(Skeleton10, { className: "h-full w-full" });
|
|
5369
|
+
var ModelViewer = (props) => {
|
|
5370
|
+
return /* @__PURE__ */ jsx41(Suspense, { fallback: /* @__PURE__ */ jsx41(ModelViewerLoading, {}), children: /* @__PURE__ */ jsx41(ModelViewerComponent, { ...props }) });
|
|
5371
|
+
};
|
|
5372
|
+
var ModelViewer_default = ModelViewer;
|
|
5373
|
+
|
|
5374
|
+
// src/react/ui/components/collectible-card/collectible-asset/CollectibleAssetSkeleton.tsx
|
|
5375
|
+
import { Skeleton as Skeleton11 } from "@0xsequence/design-system";
|
|
5376
|
+
import { jsx as jsx42 } from "react/jsx-runtime";
|
|
5377
|
+
function CollectibleAssetSkeleton() {
|
|
5378
|
+
return /* @__PURE__ */ jsx42(
|
|
5379
|
+
Skeleton11,
|
|
5380
|
+
{
|
|
5381
|
+
"data-testid": "collectible-asset-skeleton",
|
|
5382
|
+
size: "lg",
|
|
5383
|
+
className: "absolute inset-0 h-full w-full animate-shimmer",
|
|
5384
|
+
style: {
|
|
5385
|
+
borderRadius: 0
|
|
5386
|
+
}
|
|
5387
|
+
}
|
|
5388
|
+
);
|
|
5389
|
+
}
|
|
5390
|
+
|
|
5391
|
+
// src/react/ui/components/collectible-card/collectible-asset/utils.ts
|
|
5392
|
+
var isImage = (fileName) => {
|
|
5393
|
+
const isImage2 = /.*\.(png|jpg|jpeg|gif|svg|webp)$/.test(
|
|
5394
|
+
fileName?.toLowerCase() || ""
|
|
5395
|
+
);
|
|
5396
|
+
return isImage2;
|
|
5397
|
+
};
|
|
5398
|
+
var isHtml = (fileName) => {
|
|
5399
|
+
const isHtml2 = /.*\.(html\?.+|html)$/.test(fileName?.toLowerCase() || "");
|
|
5400
|
+
return isHtml2;
|
|
5401
|
+
};
|
|
5402
|
+
var isVideo = (fileName) => {
|
|
5403
|
+
const isVideo2 = /.*\.(mp4|ogg|webm)$/.test(fileName?.toLowerCase() || "");
|
|
5404
|
+
return isVideo2;
|
|
5405
|
+
};
|
|
5406
|
+
var is3dModel = (fileName) => {
|
|
5407
|
+
const is3dFile = /.*\.(gltf|glb|obj|fbx|stl|usdz)$/.test(
|
|
5408
|
+
fileName?.toLowerCase() || ""
|
|
5409
|
+
);
|
|
5410
|
+
return is3dFile;
|
|
5411
|
+
};
|
|
5412
|
+
var getContentType = (url) => {
|
|
5413
|
+
return new Promise((resolve) => {
|
|
5414
|
+
const type = isHtml(url) ? "html" : isVideo(url) ? "video" : isImage(url) ? "image" : is3dModel(url) ? "3d-model" : null;
|
|
5415
|
+
resolve(type);
|
|
5416
|
+
});
|
|
5417
|
+
};
|
|
5418
|
+
|
|
5419
|
+
// src/react/ui/components/collectible-card/collectible-asset/CollectibleAsset.tsx
|
|
5420
|
+
import { jsx as jsx43, jsxs as jsxs30 } from "react/jsx-runtime";
|
|
5421
|
+
function CollectibleAsset({
|
|
5422
|
+
name,
|
|
5423
|
+
assets,
|
|
5424
|
+
assetSrcPrefixUrl,
|
|
5425
|
+
className
|
|
5426
|
+
}) {
|
|
5427
|
+
const [assetLoadFailed, setAssetLoadFailed] = useState10(false);
|
|
5428
|
+
const [assetLoading, setAssetLoading] = useState10(true);
|
|
5429
|
+
const [contentType, setContentType] = useState10({ type: null, loading: true, failed: false });
|
|
5430
|
+
const videoRef = useRef3(null);
|
|
5431
|
+
const isSafari = /^((?!chrome|android).)*safari/i.test(navigator.userAgent);
|
|
5432
|
+
const placeholderImage = chess_tile_default;
|
|
5433
|
+
const assetUrl = assets?.find((asset) => asset) || placeholderImage;
|
|
5434
|
+
const proxiedAssetUrl = assetSrcPrefixUrl ? `${assetSrcPrefixUrl}${assetUrl}` : assetUrl;
|
|
5435
|
+
useEffect12(() => {
|
|
5436
|
+
getContentType(proxiedAssetUrl).then((contentType2) => {
|
|
5437
|
+
setContentType({ type: contentType2, loading: false, failed: false });
|
|
5438
|
+
}).catch(() => {
|
|
5439
|
+
fetchContentType(proxiedAssetUrl).then((contentType2) => {
|
|
5440
|
+
setContentType({
|
|
5441
|
+
type: contentType2,
|
|
5442
|
+
loading: false,
|
|
5443
|
+
failed: false
|
|
5444
|
+
});
|
|
5445
|
+
}).catch(() => {
|
|
5446
|
+
setContentType({ type: null, loading: false, failed: true });
|
|
5447
|
+
});
|
|
5448
|
+
});
|
|
5449
|
+
}, [proxiedAssetUrl]);
|
|
5450
|
+
if (contentType.type === "html" && !assetLoadFailed) {
|
|
5451
|
+
return /* @__PURE__ */ jsxs30(
|
|
5452
|
+
"div",
|
|
5453
|
+
{
|
|
5454
|
+
className: cn(
|
|
5455
|
+
"flex aspect-square w-full items-center justify-center overflow-hidden rounded-lg bg-background-secondary",
|
|
5456
|
+
className
|
|
5457
|
+
),
|
|
5458
|
+
children: [
|
|
5459
|
+
(assetLoading || contentType.loading) && /* @__PURE__ */ jsx43(CollectibleAssetSkeleton, {}),
|
|
5460
|
+
/* @__PURE__ */ jsx43(
|
|
5461
|
+
"iframe",
|
|
5462
|
+
{
|
|
5463
|
+
title: name || "Collectible",
|
|
5464
|
+
className: "aspect-square w-full",
|
|
5465
|
+
src: proxiedAssetUrl,
|
|
5466
|
+
allow: "accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture",
|
|
5467
|
+
sandbox: "allow-scripts",
|
|
5468
|
+
style: {
|
|
5469
|
+
border: "0px"
|
|
5470
|
+
},
|
|
5471
|
+
onError: () => setAssetLoadFailed(true),
|
|
5472
|
+
onLoad: () => setAssetLoading(false)
|
|
5473
|
+
}
|
|
5474
|
+
)
|
|
5475
|
+
]
|
|
5476
|
+
}
|
|
5477
|
+
);
|
|
5478
|
+
}
|
|
5479
|
+
if (contentType.type === "3d-model" && !assetLoadFailed) {
|
|
5480
|
+
return /* @__PURE__ */ jsx43("div", { className: "h-full w-full", children: /* @__PURE__ */ jsx43(
|
|
5481
|
+
ModelViewer_default,
|
|
5482
|
+
{
|
|
5483
|
+
src: proxiedAssetUrl,
|
|
5484
|
+
posterSrc: placeholderImage,
|
|
5485
|
+
onLoad: () => setAssetLoading(false),
|
|
5486
|
+
onError: () => setAssetLoadFailed(true)
|
|
5487
|
+
}
|
|
5488
|
+
) });
|
|
5489
|
+
}
|
|
5490
|
+
if (contentType.type === "video" && !assetLoadFailed) {
|
|
5491
|
+
return /* @__PURE__ */ jsxs30(
|
|
5492
|
+
"div",
|
|
5493
|
+
{
|
|
5494
|
+
className: cn(
|
|
5495
|
+
"relative flex aspect-square w-full items-center justify-center overflow-hidden rounded-lg bg-background-secondary",
|
|
5496
|
+
className
|
|
5497
|
+
),
|
|
5498
|
+
children: [
|
|
5499
|
+
(assetLoading || contentType.loading) && /* @__PURE__ */ jsx43(CollectibleAssetSkeleton, {}),
|
|
5500
|
+
/* @__PURE__ */ jsx43(
|
|
5501
|
+
"video",
|
|
5502
|
+
{
|
|
5503
|
+
ref: videoRef,
|
|
5504
|
+
className: cn(
|
|
5505
|
+
`absolute inset-0 h-full w-full object-cover transition-transform duration-200 ease-in-out group-hover:scale-hover ${assetLoading ? "invisible" : "visible"}`,
|
|
5506
|
+
// we can't hide the video controls in safari, when user hovers over the video they show up. `pointer-events-none` is the only way to hide them on hover
|
|
5507
|
+
isSafari && "pointer-events-none"
|
|
5508
|
+
),
|
|
5509
|
+
autoPlay: true,
|
|
5510
|
+
loop: true,
|
|
5511
|
+
controls: true,
|
|
5512
|
+
playsInline: true,
|
|
5513
|
+
muted: true,
|
|
5514
|
+
controlsList: "nodownload noremoteplayback nofullscreen ",
|
|
5515
|
+
onError: () => {
|
|
5516
|
+
setAssetLoadFailed(true);
|
|
5517
|
+
},
|
|
5518
|
+
onLoadedMetadata: () => {
|
|
5519
|
+
setAssetLoading(false);
|
|
5520
|
+
},
|
|
5521
|
+
"data-testid": "collectible-asset-video",
|
|
5522
|
+
children: /* @__PURE__ */ jsx43("source", { src: proxiedAssetUrl })
|
|
5523
|
+
}
|
|
5524
|
+
)
|
|
5525
|
+
]
|
|
5526
|
+
}
|
|
5527
|
+
);
|
|
5528
|
+
}
|
|
5529
|
+
return /* @__PURE__ */ jsxs30(
|
|
5530
|
+
"div",
|
|
5531
|
+
{
|
|
5532
|
+
className: cn(
|
|
5533
|
+
"relative aspect-square overflow-hidden bg-background-secondary",
|
|
5534
|
+
className
|
|
5535
|
+
),
|
|
5536
|
+
children: [
|
|
5537
|
+
(assetLoading || contentType.loading) && /* @__PURE__ */ jsx43(CollectibleAssetSkeleton, {}),
|
|
5538
|
+
/* @__PURE__ */ jsx43(
|
|
5539
|
+
"img",
|
|
5540
|
+
{
|
|
5541
|
+
src: assetLoadFailed || contentType.failed ? placeholderImage : proxiedAssetUrl,
|
|
5542
|
+
alt: name || "Collectible",
|
|
5543
|
+
className: `absolute inset-0 h-full w-full object-cover transition-transform duration-200 ease-in-out group-hover:scale-hover ${assetLoading || contentType.loading ? "invisible" : "visible"}`,
|
|
5544
|
+
onError: () => setAssetLoadFailed(true),
|
|
5545
|
+
onLoad: () => setAssetLoading(false)
|
|
5546
|
+
}
|
|
5547
|
+
)
|
|
5548
|
+
]
|
|
5549
|
+
}
|
|
5550
|
+
);
|
|
5551
|
+
}
|
|
5552
|
+
|
|
5300
5553
|
// src/react/ui/components/collectible-card/CollectibleCard.tsx
|
|
5301
|
-
import { jsx as
|
|
5554
|
+
import { jsx as jsx44, jsxs as jsxs31 } from "react/jsx-runtime";
|
|
5302
5555
|
function CollectibleSkeleton() {
|
|
5303
5556
|
return /* @__PURE__ */ jsxs31(
|
|
5304
5557
|
"div",
|
|
@@ -5306,8 +5559,8 @@ function CollectibleSkeleton() {
|
|
|
5306
5559
|
"data-testid": "collectible-card-skeleton",
|
|
5307
5560
|
className: "w-card-width overflow-hidden rounded-xl border border-border-base focus-visible:border-border-focus focus-visible:shadow-none focus-visible:outline-focus active:border-border-focus active:shadow-none",
|
|
5308
5561
|
children: [
|
|
5309
|
-
/* @__PURE__ */
|
|
5310
|
-
|
|
5562
|
+
/* @__PURE__ */ jsx44("div", { className: "relative aspect-square overflow-hidden bg-background-secondary", children: /* @__PURE__ */ jsx44(
|
|
5563
|
+
Skeleton12,
|
|
5311
5564
|
{
|
|
5312
5565
|
size: "lg",
|
|
5313
5566
|
className: "absolute inset-0 h-full w-full animate-shimmer",
|
|
@@ -5317,8 +5570,8 @@ function CollectibleSkeleton() {
|
|
|
5317
5570
|
}
|
|
5318
5571
|
) }),
|
|
5319
5572
|
/* @__PURE__ */ jsxs31("div", { className: "mt-2 flex flex-col gap-2 px-4 pb-4", children: [
|
|
5320
|
-
/* @__PURE__ */
|
|
5321
|
-
/* @__PURE__ */
|
|
5573
|
+
/* @__PURE__ */ jsx44(Skeleton12, { size: "lg", className: "animate-shimmer" }),
|
|
5574
|
+
/* @__PURE__ */ jsx44(Skeleton12, { size: "sm", className: "animate-shimmer" })
|
|
5322
5575
|
] })
|
|
5323
5576
|
]
|
|
5324
5577
|
}
|
|
@@ -5349,10 +5602,10 @@ function CollectibleCard({
|
|
|
5349
5602
|
}
|
|
5350
5603
|
});
|
|
5351
5604
|
if (cardLoading) {
|
|
5352
|
-
return /* @__PURE__ */
|
|
5605
|
+
return /* @__PURE__ */ jsx44(CollectibleSkeleton, {});
|
|
5353
5606
|
}
|
|
5354
5607
|
const action = balance ? highestOffer && "Sell" /* SELL */ || !collectible?.listing && "Create listing" /* LIST */ || "Transfer" /* TRANSFER */ : collectible?.listing && "Buy" /* BUY */ || "Make an offer" /* OFFER */;
|
|
5355
|
-
return /* @__PURE__ */
|
|
5608
|
+
return /* @__PURE__ */ jsx44(
|
|
5356
5609
|
"div",
|
|
5357
5610
|
{
|
|
5358
5611
|
"data-testid": "collectible-card",
|
|
@@ -5363,16 +5616,20 @@ function CollectibleCard({
|
|
|
5363
5616
|
onCollectibleClick?.(collectibleId);
|
|
5364
5617
|
}
|
|
5365
5618
|
},
|
|
5366
|
-
children: /* @__PURE__ */
|
|
5367
|
-
/* @__PURE__ */
|
|
5619
|
+
children: /* @__PURE__ */ jsx44("div", { className: "group relative z-10 flex h-full w-full cursor-pointer flex-col items-start overflow-hidden rounded-xl border-none bg-none p-0 focus:outline-none [&:focus]:rounded-[10px] [&:focus]:outline-[3px] [&:focus]:outline-black [&:focus]:outline-offset-[-3px]", children: /* @__PURE__ */ jsxs31("article", { className: "w-full rounded-xl", children: [
|
|
5620
|
+
/* @__PURE__ */ jsx44(
|
|
5368
5621
|
CollectibleAsset,
|
|
5369
5622
|
{
|
|
5370
5623
|
name: collectibleMetadata?.name || "",
|
|
5371
|
-
|
|
5624
|
+
assets: [
|
|
5625
|
+
collectibleMetadata?.image,
|
|
5626
|
+
collectibleMetadata?.video,
|
|
5627
|
+
collectibleMetadata?.animation_url
|
|
5628
|
+
],
|
|
5372
5629
|
assetSrcPrefixUrl
|
|
5373
5630
|
}
|
|
5374
5631
|
),
|
|
5375
|
-
/* @__PURE__ */
|
|
5632
|
+
/* @__PURE__ */ jsx44(
|
|
5376
5633
|
Footer,
|
|
5377
5634
|
{
|
|
5378
5635
|
name: collectibleMetadata?.name || "",
|
|
@@ -5385,7 +5642,7 @@ function CollectibleCard({
|
|
|
5385
5642
|
decimals: collectibleMetadata?.decimals
|
|
5386
5643
|
}
|
|
5387
5644
|
),
|
|
5388
|
-
(highestOffer || collectible) && !balanceIsLoading && /* @__PURE__ */
|
|
5645
|
+
(highestOffer || collectible) && !balanceIsLoading && /* @__PURE__ */ jsx44("div", { className: "-bottom-16 absolute flex w-full origin-bottom items-center justify-center bg-overlay-light p-2 backdrop-blur transition-transform duration-200 ease-in-out group-hover:translate-y-[-64px]", children: /* @__PURE__ */ jsx44(
|
|
5389
5646
|
ActionButton,
|
|
5390
5647
|
{
|
|
5391
5648
|
chainId,
|
|
@@ -5412,6 +5669,7 @@ export {
|
|
|
5412
5669
|
useCreateListingModal,
|
|
5413
5670
|
useMakeOfferModal,
|
|
5414
5671
|
useSellModal,
|
|
5672
|
+
CollectibleAsset,
|
|
5415
5673
|
CollectibleCard
|
|
5416
5674
|
};
|
|
5417
|
-
//# sourceMappingURL=chunk-
|
|
5675
|
+
//# sourceMappingURL=chunk-I2BYHDFE.js.map
|