@0xsequence/marketplace-sdk 0.8.9 → 0.8.11

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 (196) hide show
  1. package/.changeset/fluffy-jokes-lay.md +5 -0
  2. package/.changeset/wise-bugs-boil.md +8 -0
  3. package/CHANGELOG.md +43 -0
  4. package/dist/{chunk-FMEEJFAF.js → chunk-5C6ZZ6WX.js} +1 -1
  5. package/dist/{chunk-YEGD7PWE.js → chunk-5O44EPXZ.js} +2 -2
  6. package/dist/chunk-6CTFVBKU.js +1 -0
  7. package/dist/{chunk-DWTLVJAW.js → chunk-6OPMUCGX.js} +1 -1
  8. package/dist/chunk-6OPMUCGX.js.map +1 -0
  9. package/dist/{chunk-O34GCB47.js → chunk-L6KWLCER.js} +4 -4
  10. package/dist/chunk-L6KWLCER.js.map +1 -0
  11. package/dist/{chunk-4XLXOEXQ.js → chunk-LAP2CKLN.js} +78 -4
  12. package/dist/chunk-LAP2CKLN.js.map +1 -0
  13. package/dist/{chunk-Y63BOO6M.js → chunk-LECCEZAO.js} +1 -1
  14. package/dist/{chunk-YALXP2PW.js → chunk-N7SQWS2R.js} +3 -3
  15. package/dist/{chunk-KGM2WLSP.js → chunk-OAOONM4S.js} +695 -440
  16. package/dist/chunk-OAOONM4S.js.map +1 -0
  17. package/dist/chunk-Q3ECVC4F.js +811 -0
  18. package/dist/chunk-Q3ECVC4F.js.map +1 -0
  19. package/dist/chunk-QY52UADF.js +107 -0
  20. package/dist/chunk-QY52UADF.js.map +1 -0
  21. package/dist/{chunk-I2BYHDFE.js → chunk-TNAR3XEF.js} +3898 -844
  22. package/dist/chunk-TNAR3XEF.js.map +1 -0
  23. package/dist/chunk-XABYNWXO.js +549 -0
  24. package/dist/chunk-XABYNWXO.js.map +1 -0
  25. package/dist/chunk-YB5UUF2G.js +11 -0
  26. package/dist/chunk-YB5UUF2G.js.map +1 -0
  27. package/dist/{chunk-35WWD5V6.js → chunk-YWGFI4PN.js} +88 -25
  28. package/dist/chunk-YWGFI4PN.js.map +1 -0
  29. package/dist/{create-config-DwrnzwpM.d.ts → create-config-DLMvMTkZ.d.ts} +2 -2
  30. package/dist/index.css +7 -7
  31. package/dist/index.css.map +1 -1
  32. package/dist/index.d.ts +8 -6
  33. package/dist/index.js +19 -14
  34. package/dist/{lowestListing-BQHIuvNF.d.ts → marketCurrencies-enNVYwBk.d.ts} +95 -3
  35. package/dist/{marketplace.gen-DQzWciwC.d.ts → marketplace.gen-D24veUQs.d.ts} +3 -2
  36. package/dist/marketplaceConfig-BwNAbLPw.d.ts +21 -0
  37. package/dist/new-marketplace-types-BCw19X9S.d.ts +102 -0
  38. package/dist/react/_internal/api/index.d.ts +4 -3
  39. package/dist/react/_internal/api/index.js +5 -1
  40. package/dist/react/_internal/databeat/index.css +2764 -0
  41. package/dist/react/_internal/databeat/index.css.map +1 -0
  42. package/dist/react/_internal/databeat/index.d.ts +1 -1
  43. package/dist/react/_internal/databeat/index.js +15 -14
  44. package/dist/react/_internal/index.d.ts +62 -9
  45. package/dist/react/_internal/index.js +7 -3
  46. package/dist/react/_internal/wagmi/index.d.ts +5 -6
  47. package/dist/react/_internal/wagmi/index.js +1 -1
  48. package/dist/react/hooks/index.css +2764 -0
  49. package/dist/react/hooks/index.css.map +1 -0
  50. package/dist/react/hooks/index.d.ts +74 -222
  51. package/dist/react/hooks/index.js +21 -22
  52. package/dist/react/hooks/options/index.d.ts +5 -4
  53. package/dist/react/hooks/options/index.js +9 -7
  54. package/dist/react/index.css +7 -7
  55. package/dist/react/index.css.map +1 -1
  56. package/dist/react/index.d.ts +12 -11
  57. package/dist/react/index.js +34 -37
  58. package/dist/react/queries/index.d.ts +4 -3
  59. package/dist/react/queries/index.js +19 -6
  60. package/dist/react/ssr/index.d.ts +3 -3
  61. package/dist/react/ssr/index.js +6 -5
  62. package/dist/react/ssr/index.js.map +1 -1
  63. package/dist/react/ui/components/collectible-card/index.css +7 -7
  64. package/dist/react/ui/components/collectible-card/index.css.map +1 -1
  65. package/dist/react/ui/components/collectible-card/index.d.ts +9 -6
  66. package/dist/react/ui/components/collectible-card/index.js +19 -23
  67. package/dist/react/ui/components/marketplace-logos/index.js +1 -1
  68. package/dist/react/ui/icons/index.js +9 -8
  69. package/dist/react/ui/index.css +7 -7
  70. package/dist/react/ui/index.css.map +1 -1
  71. package/dist/react/ui/index.d.ts +2 -2
  72. package/dist/react/ui/index.js +17 -21
  73. package/dist/react/ui/modals/_internal/components/actionModal/index.css +2764 -0
  74. package/dist/react/ui/modals/_internal/components/actionModal/index.css.map +1 -0
  75. package/dist/react/ui/modals/_internal/components/actionModal/index.js +15 -14
  76. package/dist/sdk-config-qorA0TgF.d.ts +165 -0
  77. package/dist/{services-BI_w8Eq4.d.ts → services-WrshxCqc.d.ts} +6 -3
  78. package/dist/types/index.d.ts +5 -4
  79. package/dist/types/index.js +7 -7
  80. package/dist/{index-DGsVBflk.d.ts → useCollection-YAdXfVO7.d.ts} +1 -2
  81. package/dist/utils/abi/index.d.ts +1 -0
  82. package/dist/utils/abi/index.js +7 -1
  83. package/dist/utils/abi/primary-sale/index.d.ts +1054 -0
  84. package/dist/utils/abi/primary-sale/index.js +9 -0
  85. package/dist/utils/index.d.ts +2 -1
  86. package/dist/utils/index.js +13 -6
  87. package/package.json +32 -32
  88. package/src/react/_internal/api/__mocks__/builder.msw.ts +157 -80
  89. package/src/react/_internal/api/builder-api.ts +2 -2
  90. package/src/react/_internal/api/builder.gen.ts +667 -112
  91. package/src/react/_internal/api/marketplace.gen.ts +1981 -1316
  92. package/src/react/_internal/api/services.ts +12 -1
  93. package/src/react/_internal/types.ts +1 -13
  94. package/src/react/_internal/wagmi/__tests__/create-config.test.ts +99 -84
  95. package/src/react/_internal/wagmi/create-config.ts +8 -4
  96. package/src/react/_internal/wagmi/get-connectors.ts +24 -19
  97. package/src/react/hooks/__tests__/__snapshots__/useListCollections.test.tsx.snap +114 -0
  98. package/src/react/hooks/__tests__/__snapshots__/useMarketplaceConfig.test.tsx.snap +85 -83
  99. package/src/react/hooks/__tests__/useFilters.test.tsx +0 -16
  100. package/src/react/hooks/__tests__/useInventory.test.tsx +16 -16
  101. package/src/react/hooks/__tests__/useListCollections.test.tsx +23 -56
  102. package/src/react/hooks/__tests__/{useCurrencies.test.tsx → useMarketCurrencies.test.tsx} +21 -15
  103. package/src/react/hooks/__tests__/useMarketplaceConfig.test.tsx +2 -59
  104. package/src/react/hooks/index.ts +3 -1
  105. package/src/react/hooks/useBalanceOfCollectible.tsx +5 -3
  106. package/src/react/hooks/useConvertPriceToUSD.tsx +1 -1
  107. package/src/react/hooks/useFilters.tsx +14 -22
  108. package/src/react/hooks/useGetTokenSuppliesMap.ts +28 -0
  109. package/src/react/hooks/useInventory.tsx +4 -3
  110. package/src/react/hooks/useList1155SaleSupplies.tsx +62 -0
  111. package/src/react/hooks/useListBalances.tsx +5 -3
  112. package/src/react/hooks/useListCollectibles.tsx +5 -3
  113. package/src/react/hooks/useListCollections.tsx +14 -76
  114. package/src/react/hooks/useListTokenMetadata.ts +19 -0
  115. package/src/react/hooks/useMarketCurrencies.tsx +8 -0
  116. package/src/react/hooks/useMarketplaceConfig.tsx +0 -2
  117. package/src/react/queries/index.ts +2 -0
  118. package/src/react/queries/inventory.ts +1 -1
  119. package/src/react/queries/listCollections.ts +118 -0
  120. package/src/react/queries/listTokenMetadata.ts +38 -0
  121. package/src/react/queries/marketCurrencies.ts +77 -0
  122. package/src/react/queries/marketplaceConfig.ts +83 -55
  123. package/src/react/ssr/__tests__/__snapshots__/create-ssr-client.test.ts.snap +85 -83
  124. package/src/react/ui/components/collectible-card/CollectibleCard.tsx +2 -2
  125. package/src/react/ui/components/collectible-card/__tests__/{CollectibleAsset.test.tsx → Media.test.tsx} +48 -14
  126. package/src/react/ui/components/collectible-card/index.ts +1 -1
  127. package/src/react/ui/components/collectible-card/media/Media.tsx +211 -0
  128. package/src/react/ui/components/collectible-card/{collectible-asset/CollectibleAssetSkeleton.tsx → media/MediaSkeleton.tsx} +2 -2
  129. package/src/react/ui/components/collectible-card/media/types.ts +18 -0
  130. package/src/react/ui/components/collectible-card/{collectible-asset → media}/utils.ts +8 -3
  131. package/src/react/ui/index.ts +1 -1
  132. package/src/react/ui/modals/BuyModal/ERC1155QuantityModal.tsx +9 -3
  133. package/src/react/ui/modals/BuyModal/hooks/__tests__/useFees.test.tsx +31 -21
  134. package/src/react/ui/modals/BuyModal/hooks/useFees.ts +3 -2
  135. package/src/react/ui/modals/BuyModal/hooks/usePaymentModalParams.ts +28 -3
  136. package/src/react/ui/modals/CreateListingModal/Modal.tsx +3 -5
  137. package/src/react/ui/modals/CreateListingModal/hooks/useCreateListing.tsx +5 -3
  138. package/src/react/ui/modals/CreateListingModal/hooks/useTransactionSteps.tsx +2 -2
  139. package/src/react/ui/modals/MakeOfferModal/Modal.tsx +2 -3
  140. package/src/react/ui/modals/MakeOfferModal/hooks/useMakeOffer.tsx +4 -3
  141. package/src/react/ui/modals/SellModal/Modal.tsx +0 -1
  142. package/src/react/ui/modals/SellModal/hooks/useTransactionSteps.tsx +2 -2
  143. package/src/react/ui/modals/TransferModal/_views/enterWalletAddress/_components/WalletAddressInput.tsx +1 -1
  144. package/src/react/ui/modals/TransferModal/_views/enterWalletAddress/index.tsx +0 -1
  145. package/src/react/ui/modals/TransferModal/index.tsx +0 -1
  146. package/src/react/ui/modals/_internal/components/currencyOptionsSelect/__tests__/index.test.tsx +2 -2
  147. package/src/react/ui/modals/_internal/components/currencyOptionsSelect/index.tsx +7 -6
  148. package/src/react/ui/modals/_internal/components/selectWaasFeeOptions/__tests__/SelectWaasFeeOptions.test.tsx +13 -7
  149. package/src/react/ui/modals/_internal/components/selectWaasFeeOptions/index.tsx +3 -5
  150. package/src/react/ui/modals/_internal/components/selectWaasFeeOptions/useWaasFeeOptionManager.tsx +5 -3
  151. package/src/react/ui/modals/_internal/components/transactionDetails/index.tsx +2 -2
  152. package/src/react/ui/modals/_internal/hooks/useSelectWaasFeeOptions.ts +2 -12
  153. package/src/types/index.ts +1 -6
  154. package/src/types/new-marketplace-types.ts +119 -0
  155. package/src/types/sdk-config.ts +19 -2
  156. package/src/types/types.ts +1 -0
  157. package/src/utils/abi/index.ts +1 -0
  158. package/src/utils/abi/primary-sale/index.ts +2 -0
  159. package/src/utils/abi/primary-sale/sequence-1155-sales-contract.ts +450 -0
  160. package/src/utils/abi/primary-sale/sequence-721-sales-contract.ts +352 -0
  161. package/src/utils/abi/token/sequence-erc1155-items.ts +454 -0
  162. package/src/utils/fetchContentType.ts +5 -1
  163. package/tsconfig.tsbuildinfo +1 -1
  164. package/dist/chunk-35WWD5V6.js.map +0 -1
  165. package/dist/chunk-4XLXOEXQ.js.map +0 -1
  166. package/dist/chunk-D7RVSZAQ.js +0 -332
  167. package/dist/chunk-D7RVSZAQ.js.map +0 -1
  168. package/dist/chunk-DWTLVJAW.js.map +0 -1
  169. package/dist/chunk-EODKQL6Y.js +0 -76
  170. package/dist/chunk-EODKQL6Y.js.map +0 -1
  171. package/dist/chunk-G3447GIP.js +0 -2880
  172. package/dist/chunk-G3447GIP.js.map +0 -1
  173. package/dist/chunk-HHYNOPPI.js +0 -53
  174. package/dist/chunk-HHYNOPPI.js.map +0 -1
  175. package/dist/chunk-I2BYHDFE.js.map +0 -1
  176. package/dist/chunk-JKCF7HEA.js +0 -1
  177. package/dist/chunk-KGM2WLSP.js.map +0 -1
  178. package/dist/chunk-MAD64DLJ.js +0 -81
  179. package/dist/chunk-MAD64DLJ.js.map +0 -1
  180. package/dist/chunk-N7BPFK46.js +0 -1
  181. package/dist/chunk-O34GCB47.js.map +0 -1
  182. package/dist/chunk-UISBTKFF.js +0 -1
  183. package/dist/chunk-UISBTKFF.js.map +0 -1
  184. package/dist/chunk-YBOFRP65.js +0 -128
  185. package/dist/chunk-YBOFRP65.js.map +0 -1
  186. package/dist/marketplaceConfig-B4Fdsmxu.d.ts +0 -17
  187. package/dist/sdk-config-txlivEKe.d.ts +0 -133
  188. package/dist/types-isjvwapz.d.ts +0 -68
  189. package/src/react/hooks/useCurrencies.tsx +0 -77
  190. package/src/react/ui/components/collectible-card/collectible-asset/CollectibleAsset.tsx +0 -174
  191. /package/dist/{chunk-FMEEJFAF.js.map → chunk-5C6ZZ6WX.js.map} +0 -0
  192. /package/dist/{chunk-YEGD7PWE.js.map → chunk-5O44EPXZ.js.map} +0 -0
  193. /package/dist/{chunk-JKCF7HEA.js.map → chunk-6CTFVBKU.js.map} +0 -0
  194. /package/dist/{chunk-Y63BOO6M.js.map → chunk-LECCEZAO.js.map} +0 -0
  195. /package/dist/{chunk-YALXP2PW.js.map → chunk-N7SQWS2R.js.map} +0 -0
  196. /package/dist/{chunk-N7BPFK46.js.map → utils/abi/primary-sale/index.js.map} +0 -0
@@ -1,82 +1,109 @@
1
1
  import { queryOptions } from '@tanstack/react-query';
2
- import type { Env, SdkConfig } from '../../types';
3
- import { builderMarketplaceApi, builderRpcApi, configKeys } from '../_internal';
2
+ import type { ContractType, Env, SdkConfig, ShopConfig } from '../../types';
3
+ import {
4
+ type MarketCollection,
5
+ type MarketPage,
6
+ type MarketplaceConfig,
7
+ MarketplaceType,
8
+ type NewMarketplaceSettings,
9
+ type ShopCollection,
10
+ type ShopPage,
11
+ } from '../../types/new-marketplace-types';
12
+ import { builderRpcApi, configKeys } from '../_internal';
4
13
  import { BuilderAPI } from '../_internal/api/builder-api';
5
- import type { MarketplaceSettings } from '../_internal/api/builder.gen';
14
+ import type { LookupMarketplaceReturn } from '../_internal/api/builder.gen';
6
15
 
7
- export type MarketplaceConfig = MarketplaceSettings & {
8
- cssString: string;
9
- manifestUrl: string;
10
- };
11
-
12
- const fetchBuilderConfig = async ({
16
+ export const fetchMarketplaceConfig = async ({
13
17
  projectId,
14
18
  projectAccessKey,
15
19
  env,
16
20
  prefetchedMarketplaceSettings,
21
+ tmpShopConfig,
17
22
  }: {
18
23
  projectId: string;
19
24
  projectAccessKey: string;
20
25
  env: Env;
21
- prefetchedMarketplaceSettings?: MarketplaceSettings;
22
- }) => {
23
- if (prefetchedMarketplaceSettings) {
24
- return prefetchedMarketplaceSettings;
26
+ tmpShopConfig?: ShopConfig;
27
+ prefetchedMarketplaceSettings?: LookupMarketplaceReturn; //TODO: Is this the right approach?
28
+ }): Promise<MarketplaceConfig> => {
29
+ let builderMarketplaceConfig = prefetchedMarketplaceSettings;
30
+ if (!builderMarketplaceConfig) {
31
+ const baseUrl = builderRpcApi(env);
32
+ const builderApi = new BuilderAPI(baseUrl, projectAccessKey);
33
+ const response = await builderApi.lookupMarketplace({
34
+ projectId: Number(projectId),
35
+ });
36
+
37
+ builderMarketplaceConfig = response;
25
38
  }
26
- const baseUrl = builderRpcApi(env);
27
- const builderApi = new BuilderAPI(baseUrl, projectAccessKey);
28
- const response = await builderApi.lookupMarketplaceConfig({
29
- projectId: Number(projectId),
39
+ const settings = {
40
+ publisherId: builderMarketplaceConfig.marketplace.settings.publisherId,
41
+ title: builderMarketplaceConfig.marketplace.settings.title,
42
+ socials: builderMarketplaceConfig.marketplace.settings.socials,
43
+ faviconUrl: builderMarketplaceConfig.marketplace.settings.faviconUrl,
44
+ walletOptions: builderMarketplaceConfig.marketplace.settings.walletOptions,
45
+ logoUrl: builderMarketplaceConfig.marketplace.settings.logoUrl,
46
+ fontUrl: builderMarketplaceConfig.marketplace.settings.fontUrl,
47
+ accessKey: builderMarketplaceConfig.marketplace.settings.accessKey,
48
+ } satisfies NewMarketplaceSettings;
49
+
50
+ const marketCollections = (
51
+ builderMarketplaceConfig.marketCollections ?? []
52
+ ).map((collection) => {
53
+ return {
54
+ chainId: collection.chainId,
55
+ bannerUrl: collection.bannerUrl,
56
+ contractType: collection.contractType as ContractType,
57
+ marketplaceType: MarketplaceType.MARKET,
58
+ itemsAddress: collection.itemsAddress,
59
+ feePercentage: collection.feePercentage,
60
+ currencyOptions: collection.currencyOptions,
61
+ filterSettings: collection.filterSettings,
62
+ destinationMarketplace: collection.destinationMarketplace,
63
+ } satisfies MarketCollection;
30
64
  });
31
- return response.settings;
32
- };
33
65
 
34
- const fetchStyles = async (projectId: string, env: Env) => {
35
- const response = await fetch(
36
- `${builderMarketplaceApi(projectId, env)}/styles.css`,
37
- );
38
- const styles = await response.text();
39
- // React sanitizes this string, so we need to remove all quotes, they are not needed anyway
40
- return styles.replaceAll(/['"]/g, '');
41
- };
66
+ const shopCollections = tmpShopConfig?.collections.map((collection) => {
67
+ return {
68
+ chainId: collection.chainId,
69
+ bannerUrl: collection.bannerUrl,
70
+ contractType: collection.contractType,
71
+ marketplaceType: MarketplaceType.SHOP,
72
+ itemsAddress: collection.address,
73
+ filterSettings: undefined,
74
+ saleAddress: collection.primarySalesContractAddress,
75
+ } satisfies ShopCollection;
76
+ });
42
77
 
43
- const fetchMarketplaceConfig = async ({
44
- env,
45
- projectId,
46
- projectAccessKey,
47
- prefetchedMarketplaceSettings,
48
- }: {
49
- env: Env;
50
- projectId: string;
51
- projectAccessKey: string;
52
- prefetchedMarketplaceSettings?: MarketplaceSettings;
53
- }): Promise<MarketplaceConfig> => {
54
- const [marketplaceConfig, cssString] = await Promise.all([
55
- fetchBuilderConfig({
56
- projectId,
57
- projectAccessKey,
58
- env,
59
- prefetchedMarketplaceSettings,
60
- }),
61
- fetchStyles(projectId, env),
62
- ]);
78
+ const market = {
79
+ enabled: true,
80
+ bannerUrl: builderMarketplaceConfig.marketplace.market.bannerUrl,
81
+ ogImage: builderMarketplaceConfig.marketplace.market.ogImage,
82
+ collections: marketCollections,
83
+ } satisfies MarketPage;
84
+
85
+ const shop = {
86
+ enabled: tmpShopConfig !== undefined,
87
+ bannerUrl: tmpShopConfig?.bannerUrl ?? '',
88
+ ogImage: tmpShopConfig?.ogImage,
89
+ collections: shopCollections ?? [],
90
+ } satisfies ShopPage;
63
91
 
64
92
  return {
65
- ...marketplaceConfig,
66
- cssString,
67
- manifestUrl: `${builderMarketplaceApi(projectId, env)}/manifest.json`,
68
- };
93
+ projectId: Number(projectId),
94
+ settings,
95
+ market,
96
+ shop,
97
+ } satisfies MarketplaceConfig;
69
98
  };
70
99
 
71
- export const marketplaceConfigOptions = (
72
- config: Pick<SdkConfig, 'projectId' | 'projectAccessKey'> | SdkConfig,
73
- ) => {
100
+ export const marketplaceConfigOptions = (config: SdkConfig) => {
74
101
  let env: Env = 'production';
75
102
  if ('_internal' in config && config._internal !== undefined) {
76
103
  env = config._internal.builderEnv ?? env;
77
104
  }
78
105
 
79
- let prefetchedMarketplaceSettings: MarketplaceSettings | undefined;
106
+ let prefetchedMarketplaceSettings: LookupMarketplaceReturn | undefined;
80
107
  if (
81
108
  '_internal' in config &&
82
109
  config._internal?.prefetchedMarketplaceSettings
@@ -96,6 +123,7 @@ export const marketplaceConfigOptions = (
96
123
  projectId,
97
124
  projectAccessKey,
98
125
  prefetchedMarketplaceSettings,
126
+ tmpShopConfig: config.tmpShopConfig,
99
127
  }),
100
128
  });
101
129
  };
@@ -2,95 +2,97 @@
2
2
 
3
3
  exports[`createSSRClient > should fetch marketplace config successfully 1`] = `
4
4
  {
5
- "bannerUrl": "",
6
- "collections": [
7
- {
8
- "address": "0x0000000000000000000000000000000000000000",
9
- "bannerUrl": "",
10
- "chainId": 1,
11
- "currencyOptions": [
12
- "0x0000000000000000000000000000000000000000",
13
- "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
14
- ],
15
- "destinationMarketplace": "sequence_marketplace_v2",
16
- "exchanges": [],
17
- "feePercentage": 3.5,
18
- "filterSettings": {
19
- "exclusions": [
20
- {
21
- "condition": "SPECIFIC_VALUE",
22
- "key": "Type",
23
- "value": "Sample",
24
- },
25
- ],
26
- "filterOrder": [
27
- "Type",
28
- "Rarity",
5
+ "market": {
6
+ "bannerUrl": "https://example.com/market-banner.png",
7
+ "collections": [
8
+ {
9
+ "bannerUrl": "https://example.com/market-banner.png",
10
+ "chainId": 1,
11
+ "contractType": "ERC721",
12
+ "currencyOptions": [
13
+ "0x0000000000000000000000000000000000000000",
14
+ "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
29
15
  ],
16
+ "destinationMarketplace": "sequence_marketplace_v2",
17
+ "feePercentage": 3.5,
18
+ "filterSettings": {
19
+ "exclusions": [
20
+ {
21
+ "condition": "SPECIFIC_VALUE",
22
+ "key": "Type",
23
+ "value": "Sample",
24
+ },
25
+ ],
26
+ "filterOrder": [
27
+ "Type",
28
+ "Rarity",
29
+ ],
30
+ },
31
+ "itemsAddress": "0x0000000000000000000000000000000000000000",
32
+ "marketplaceType": "MARKET",
30
33
  },
31
- "marketplaceType": "ORDERBOOK",
32
- },
33
- {
34
- "address": "0x1234567890123456789012345678901234567890",
35
- "bannerUrl": "https://example.com/collection-banner.png",
36
- "chainId": 137,
37
- "currencyOptions": [
38
- "0x0000000000000000000000000000000000000000",
39
- ],
40
- "destinationMarketplace": "opensea",
41
- "exchanges": [],
42
- "feePercentage": 2.5,
43
- "filterSettings": {
44
- "exclusions": [
45
- {
46
- "condition": "ENTIRE_KEY",
47
- "key": "Category",
48
- },
49
- {
50
- "condition": "SPECIFIC_VALUE",
51
- "key": "Level",
52
- "value": "Legendary",
53
- },
54
- ],
55
- "filterOrder": [
56
- "Category",
57
- "Level",
58
- "Element",
34
+ {
35
+ "bannerUrl": "https://example.com/collection-banner.png",
36
+ "chainId": 137,
37
+ "contractType": "ERC1155",
38
+ "currencyOptions": [
39
+ "0x0000000000000000000000000000000000000000",
59
40
  ],
41
+ "destinationMarketplace": "opensea",
42
+ "feePercentage": 2.5,
43
+ "filterSettings": {
44
+ "exclusions": [
45
+ {
46
+ "condition": "ENTIRE_KEY",
47
+ "key": "Category",
48
+ },
49
+ {
50
+ "condition": "SPECIFIC_VALUE",
51
+ "key": "Level",
52
+ "value": "Legendary",
53
+ },
54
+ ],
55
+ "filterOrder": [
56
+ "Category",
57
+ "Level",
58
+ "Element",
59
+ ],
60
+ },
61
+ "itemsAddress": "0x1234567890123456789012345678901234567890",
62
+ "marketplaceType": "MARKET",
60
63
  },
61
- "marketplaceType": "ORDERBOOK",
64
+ ],
65
+ "enabled": true,
66
+ "ogImage": "https://example.com/og-image.png",
67
+ },
68
+ "projectId": NaN,
69
+ "settings": {
70
+ "accessKey": "mock-access-key",
71
+ "faviconUrl": "https://example.com/favicon.ico",
72
+ "fontUrl": "https://example.com/font.woff2",
73
+ "logoUrl": "https://example.com/logo.png",
74
+ "publisherId": "publisher-1",
75
+ "socials": {
76
+ "discord": "https://discord.gg/mock",
77
+ "instagram": "https://instagram.com/mock",
78
+ "tiktok": "https://tiktok.com/@mock",
79
+ "twitter": "https://twitter.com/mock",
80
+ "website": "https://mock.com",
81
+ "youtube": "https://youtube.com/mock",
82
+ },
83
+ "title": "Mock Marketplace",
84
+ "walletOptions": {
85
+ "connectors": [],
86
+ "includeEIP6963Wallets": true,
87
+ "oidcIssuers": {},
88
+ "walletType": "UNIVERSAL",
62
89
  },
63
- ],
64
- "cssString": "
65
- .marketplace-theme {
66
- --primary-color: #000000;
67
- }
68
- ",
69
- "faviconUrl": "https://example.com/favicon.png",
70
- "landingBannerUrl": "https://example.com/banner.png",
71
- "landingPageLayout": "default",
72
- "logoUrl": "https://example.com/logo.png",
73
- "manifestUrl": "https://api.sequence.build/marketplace/test-project/manifest.json",
74
- "projectId": 1,
75
- "publisherId": "test-publisher",
76
- "shortDescription": "A test marketplace",
77
- "socials": {
78
- "discord": "https://discord.com/test",
79
- "instagram": "https://instagram.com/test",
80
- "tiktok": "",
81
- "twitter": "https://twitter.com/test",
82
- "website": "",
83
- "youtube": "",
84
90
  },
85
- "title": "Test Marketplace",
86
- "walletOptions": {
87
- "connectors": [
88
- "coinbase",
89
- "walletconnect",
90
- ],
91
- "includeEIP6963Wallets": true,
92
- "oidcIssuers": {},
93
- "walletType": "UNIVERSAL",
91
+ "shop": {
92
+ "bannerUrl": "",
93
+ "collections": [],
94
+ "enabled": false,
95
+ "ogImage": undefined,
94
96
  },
95
97
  }
96
98
  `;
@@ -12,7 +12,7 @@ import { useCurrency } from '../../../hooks';
12
12
  import { ActionButton } from '../_internals/action-button/ActionButton';
13
13
  import { CollectibleCardAction } from '../_internals/action-button/types';
14
14
  import { Footer } from './Footer';
15
- import { CollectibleAsset } from './collectible-asset/CollectibleAsset';
15
+ import { Media } from './media/Media';
16
16
 
17
17
  function CollectibleSkeleton() {
18
18
  return (
@@ -127,7 +127,7 @@ export function CollectibleCard({
127
127
  >
128
128
  <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]">
129
129
  <article className="w-full rounded-xl">
130
- <CollectibleAsset
130
+ <Media
131
131
  name={collectibleMetadata?.name || ''}
132
132
  assets={[
133
133
  collectibleMetadata?.image,
@@ -2,10 +2,10 @@ import { render, screen, waitFor } from '@test/test-utils';
2
2
  import { describe, expect, it, vi } from 'vitest';
3
3
  import * as fetchContentTypeModule from '../../../../../utils/fetchContentType';
4
4
  import type { TokenMetadata } from '../../../../_internal';
5
- import { CollectibleAsset } from '../collectible-asset/CollectibleAsset';
6
- import * as contentTypeUtils from '../collectible-asset/utils';
5
+ import { Media } from '../media/Media';
6
+ import * as contentTypeUtils from '../media/utils';
7
7
 
8
- describe('CollectibleAsset', () => {
8
+ describe('Media', () => {
9
9
  it('renders image content correctly with proper loading states and fallback', async () => {
10
10
  const originalImage = window.Image;
11
11
 
@@ -30,14 +30,11 @@ describe('CollectibleAsset', () => {
30
30
 
31
31
  // Initial render should show the loading skeleton
32
32
  const { rerender } = render(
33
- <CollectibleAsset
34
- name="Test Collectible"
35
- assets={[mockMetadata.image]}
36
- />,
33
+ <Media name="Test Collectible" assets={[mockMetadata.image]} />,
37
34
  );
38
35
 
39
36
  // check if skeleton is rendered during loading
40
- const skeleton = screen.getByTestId('collectible-asset-skeleton');
37
+ const skeleton = screen.getByTestId('media');
41
38
  expect(skeleton).toBeInTheDocument();
42
39
 
43
40
  // trigger the image load event to simulate successful loading
@@ -69,7 +66,7 @@ describe('CollectibleAsset', () => {
69
66
  };
70
67
 
71
68
  rerender(
72
- <CollectibleAsset
69
+ <Media
73
70
  name="Test Collectible"
74
71
  assets={[mockMetadataWithBadImage.image]}
75
72
  />,
@@ -127,10 +124,7 @@ describe('CollectibleAsset', () => {
127
124
  };
128
125
 
129
126
  render(
130
- <CollectibleAsset
131
- name="Video Collectible"
132
- assets={[mockVideoMetadata.video]}
133
- />,
127
+ <Media name="Video Collectible" assets={[mockVideoMetadata.video]} />,
134
128
  );
135
129
 
136
130
  await waitFor(() => {
@@ -192,7 +186,7 @@ describe('CollectibleAsset', () => {
192
186
  };
193
187
 
194
188
  render(
195
- <CollectibleAsset
189
+ <Media
196
190
  name="HTML Collectible"
197
191
  assets={[mockHtmlMetadata.animation_url]}
198
192
  />,
@@ -227,4 +221,44 @@ describe('CollectibleAsset', () => {
227
221
  getContentTypeSpy.mockRestore();
228
222
  fetchContentTypeSpy.mockRestore();
229
223
  });
224
+
225
+ it('shows loading state when isLoading prop is true', async () => {
226
+ const mockMetadata: Partial<TokenMetadata> = {
227
+ tokenId: '1',
228
+ name: 'Test Collectible',
229
+ image: 'https://example.com/test-image.png',
230
+ attributes: [],
231
+ };
232
+
233
+ // Render with isLoading=true
234
+ const { rerender } = render(
235
+ <Media
236
+ name="Test Collectible"
237
+ assets={[mockMetadata.image]}
238
+ isLoading={true}
239
+ />,
240
+ );
241
+
242
+ // Check if skeleton is rendered during loading
243
+ expect(screen.getByTestId('media')).toBeInTheDocument();
244
+
245
+ // Image should be invisible while loading
246
+ const imgElement = document.querySelector('img');
247
+ expect(imgElement?.className).toContain('invisible');
248
+
249
+ // Re-render with isLoading=false
250
+ rerender(
251
+ <Media
252
+ name="Test Collectible"
253
+ assets={[mockMetadata.image]}
254
+ isLoading={false}
255
+ />,
256
+ );
257
+
258
+ // After loading completes, trigger load event
259
+ imgElement?.dispatchEvent(new Event('load'));
260
+
261
+ // Image should become visible
262
+ expect(imgElement?.className).toContain('visible');
263
+ });
230
264
  });
@@ -1,2 +1,2 @@
1
1
  export * from './CollectibleCard';
2
- export * from './collectible-asset/CollectibleAsset';
2
+ export * from './media/Media';