@0xsequence/marketplace-sdk 0.8.6 → 0.8.8

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 (138) hide show
  1. package/CHANGELOG.md +32 -0
  2. package/dist/chunk-2PSNAIAT.js +1 -0
  3. package/dist/chunk-2PSNAIAT.js.map +1 -0
  4. package/dist/{chunk-WXKV5N4T.js → chunk-35WWD5V6.js} +3 -3
  5. package/dist/{chunk-ZSCZLHKX.js → chunk-4XLXOEXQ.js} +2 -2
  6. package/dist/{chunk-TGFX3TMV.js → chunk-7IYKUVC3.js} +314 -147
  7. package/dist/chunk-7IYKUVC3.js.map +1 -0
  8. package/dist/{chunk-BB2PTJHI.js → chunk-D7RVSZAQ.js} +131 -83
  9. package/dist/chunk-D7RVSZAQ.js.map +1 -0
  10. package/dist/chunk-DWTLVJAW.js +42 -0
  11. package/dist/chunk-DWTLVJAW.js.map +1 -0
  12. package/dist/{chunk-SJU6QZHM.js → chunk-EODKQL6Y.js} +2 -2
  13. package/dist/{chunk-6SEJI7YS.js → chunk-G3447GIP.js} +39 -20
  14. package/dist/chunk-G3447GIP.js.map +1 -0
  15. package/dist/{chunk-QMWMJVTX.js → chunk-HHYNOPPI.js} +2 -2
  16. package/dist/{chunk-ALICO7NG.js → chunk-KGM2WLSP.js} +15 -158
  17. package/dist/chunk-KGM2WLSP.js.map +1 -0
  18. package/dist/chunk-MAD64DLJ.js +81 -0
  19. package/dist/chunk-MAD64DLJ.js.map +1 -0
  20. package/dist/chunk-N7BPFK46.js +1 -0
  21. package/dist/chunk-N7BPFK46.js.map +1 -0
  22. package/dist/chunk-NX52D7NX.js +135 -0
  23. package/dist/chunk-NX52D7NX.js.map +1 -0
  24. package/dist/chunk-O34GCB47.js +32 -0
  25. package/dist/chunk-O34GCB47.js.map +1 -0
  26. package/dist/{chunk-LDZZUYG7.js → chunk-YALXP2PW.js} +3 -3
  27. package/dist/{chunk-V3NVAVHV.js → chunk-YBOFRP65.js} +2 -2
  28. package/dist/{chunk-BGY4WXER.js → chunk-YEGD7PWE.js} +3 -2
  29. package/dist/{chunk-BGY4WXER.js.map → chunk-YEGD7PWE.js.map} +1 -1
  30. package/dist/{create-config-qDML4ZNn.d.ts → create-config-DwrnzwpM.d.ts} +2 -2
  31. package/dist/{index-DtWR0b_l.d.ts → index-DGsVBflk.d.ts} +3 -12
  32. package/dist/index.css +7 -5
  33. package/dist/index.css.map +1 -1
  34. package/dist/index.d.ts +13 -4
  35. package/dist/index.js +14 -6
  36. package/dist/{lowestListing-W7P4EkC3.d.ts → lowestListing-BQHIuvNF.d.ts} +2 -2
  37. package/dist/{marketplace.gen-DS-MmGEB.d.ts → marketplace.gen-DQzWciwC.d.ts} +5 -4
  38. package/dist/marketplaceConfig-B4Fdsmxu.d.ts +17 -0
  39. package/dist/react/_internal/api/index.d.ts +3 -3
  40. package/dist/react/_internal/api/index.js +4 -3
  41. package/dist/react/_internal/databeat/index.d.ts +2 -1
  42. package/dist/react/_internal/databeat/index.js +13 -9
  43. package/dist/react/_internal/index.d.ts +6 -6
  44. package/dist/react/_internal/index.js +13 -10
  45. package/dist/react/_internal/wagmi/index.d.ts +6 -5
  46. package/dist/react/_internal/wagmi/index.js +2 -2
  47. package/dist/react/hooks/index.d.ts +9 -8
  48. package/dist/react/hooks/index.js +12 -8
  49. package/dist/react/hooks/options/index.d.ts +4 -4
  50. package/dist/react/hooks/options/index.js +7 -4
  51. package/dist/react/index.css +2650 -0
  52. package/dist/react/index.css.map +1 -1
  53. package/dist/react/index.d.ts +8 -8
  54. package/dist/react/index.js +19 -14
  55. package/dist/react/queries/index.d.ts +3 -3
  56. package/dist/react/queries/index.js +6 -3
  57. package/dist/react/ssr/index.d.ts +3 -3
  58. package/dist/react/ssr/index.js +6 -3
  59. package/dist/react/ssr/index.js.map +1 -1
  60. package/dist/react/ui/components/collectible-card/index.css +2650 -0
  61. package/dist/react/ui/components/collectible-card/index.css.map +1 -1
  62. package/dist/react/ui/components/collectible-card/index.d.ts +1 -1
  63. package/dist/react/ui/components/collectible-card/index.js +17 -12
  64. package/dist/react/ui/icons/index.js +8 -5
  65. package/dist/react/ui/index.css +2650 -0
  66. package/dist/react/ui/index.css.map +1 -1
  67. package/dist/react/ui/index.d.ts +2 -1
  68. package/dist/react/ui/index.js +17 -12
  69. package/dist/react/ui/modals/_internal/components/actionModal/index.js +13 -9
  70. package/dist/sdk-config-txlivEKe.d.ts +133 -0
  71. package/dist/{services-BOX67E7W.d.ts → services-BI_w8Eq4.d.ts} +4 -4
  72. package/dist/types/index.d.ts +5 -4
  73. package/dist/types/index.js +9 -6
  74. package/dist/{types-CJLhc2VZ.d.ts → types-isjvwapz.d.ts} +3 -3
  75. package/dist/utils/index.d.ts +1 -1
  76. package/dist/utils/index.js +6 -3
  77. package/package.json +3 -3
  78. package/src/index.ts +1 -0
  79. package/src/react/{hooks/options/__mocks__/marketplaceConfig.msw.ts → _internal/api/__mocks__/builder.msw.ts} +70 -63
  80. package/src/react/_internal/api/__mocks__/metadata.msw.ts +30 -10
  81. package/src/react/_internal/api/builder-api.ts +32 -0
  82. package/src/react/_internal/api/builder.gen.ts +215 -0
  83. package/src/react/_internal/api/marketplace.gen.ts +6 -6
  84. package/src/react/_internal/api/services.ts +9 -2
  85. package/src/react/_internal/databeat/types.ts +1 -0
  86. package/src/react/_internal/wagmi/__tests__/create-config.test.ts +16 -41
  87. package/src/react/_internal/wagmi/create-config.ts +3 -16
  88. package/src/react/_internal/wagmi/get-connectors.ts +31 -21
  89. package/src/react/_internal/wallet/__tests__/wallet.test.ts +30 -0
  90. package/src/react/_internal/wallet/wallet.ts +25 -2
  91. package/src/react/hooks/__tests__/__snapshots__/useMarketplaceConfig.test.tsx.snap +96 -0
  92. package/src/react/hooks/__tests__/useCollection.test.tsx +4 -5
  93. package/src/react/hooks/__tests__/useCurrencies.test.tsx +1 -1
  94. package/src/react/hooks/__tests__/useInventory.test.tsx +15 -16
  95. package/src/react/hooks/__tests__/useListCollections.test.tsx +18 -163
  96. package/src/react/hooks/__tests__/useMarketplaceConfig.test.tsx +10 -11
  97. package/src/react/hooks/options/index.ts +1 -1
  98. package/src/react/hooks/useAutoSelectFeeOption.tsx +1 -0
  99. package/src/react/hooks/useMarketplaceConfig.tsx +2 -2
  100. package/src/react/queries/marketplaceConfig.ts +101 -0
  101. package/src/react/ssr/__tests__/__snapshots__/create-ssr-client.test.ts.snap +1 -0
  102. package/src/react/ssr/create-ssr-client.ts +1 -1
  103. package/src/react/ui/components/collectible-card/CollectibleCard.tsx +2 -2
  104. package/src/react/ui/components/collectible-card/__tests__/CollectibleAsset.test.tsx +72 -42
  105. package/src/react/ui/components/collectible-card/{CollectibleAsset.tsx → collectible-asset/CollectibleAsset.tsx} +44 -44
  106. package/src/react/ui/components/collectible-card/collectible-asset/CollectibleAssetSkeleton.tsx +14 -0
  107. package/src/react/ui/components/collectible-card/collectible-asset/utils.ts +36 -0
  108. package/src/react/ui/modals/BuyModal/hooks/usePaymentModalParams.ts +6 -1
  109. package/src/react/ui/modals/BuyModal/store.ts +1 -0
  110. package/src/react/ui/modals/CreateListingModal/hooks/useTransactionSteps.tsx +20 -2
  111. package/src/react/ui/modals/MakeOfferModal/hooks/useTransactionSteps.tsx +17 -1
  112. package/src/react/ui/modals/SellModal/hooks/useTransactionSteps.tsx +4 -0
  113. package/src/react/ui/modals/_internal/components/actionModal/ActionModal.test.tsx +7 -1
  114. package/src/types/index.ts +7 -1
  115. package/src/types/sdk-config.ts +4 -9
  116. package/src/utils/fetchContentType.ts +101 -0
  117. package/src/utils/getMarketplaceDetails.ts +2 -1
  118. package/src/utils/getSequenceMarketRequestId.ts +32 -0
  119. package/test/mocks/wallet.ts +3 -1
  120. package/test/test-utils.tsx +1 -1
  121. package/tsconfig.tsbuildinfo +1 -1
  122. package/dist/builder-types-BY6eD6vD.d.ts +0 -82
  123. package/dist/chunk-6SEJI7YS.js.map +0 -1
  124. package/dist/chunk-ALICO7NG.js.map +0 -1
  125. package/dist/chunk-BB2PTJHI.js.map +0 -1
  126. package/dist/chunk-HGKWWZWY.js +0 -58
  127. package/dist/chunk-HGKWWZWY.js.map +0 -1
  128. package/dist/chunk-TGFX3TMV.js.map +0 -1
  129. package/dist/sdk-config-DIzJk_tI.d.ts +0 -26
  130. package/src/react/hooks/options/__tests__/marketplaceConfigOptions.test.tsx +0 -134
  131. package/src/react/hooks/options/marketplaceConfigOptions.ts +0 -71
  132. package/src/types/builder-types.ts +0 -88
  133. /package/dist/{chunk-WXKV5N4T.js.map → chunk-35WWD5V6.js.map} +0 -0
  134. /package/dist/{chunk-ZSCZLHKX.js.map → chunk-4XLXOEXQ.js.map} +0 -0
  135. /package/dist/{chunk-SJU6QZHM.js.map → chunk-EODKQL6Y.js.map} +0 -0
  136. /package/dist/{chunk-QMWMJVTX.js.map → chunk-HHYNOPPI.js.map} +0 -0
  137. /package/dist/{chunk-LDZZUYG7.js.map → chunk-YALXP2PW.js.map} +0 -0
  138. /package/dist/{chunk-V3NVAVHV.js.map → chunk-YBOFRP65.js.map} +0 -0
@@ -1,26 +0,0 @@
1
- type Env = 'development' | 'next' | 'production';
2
- type SdkConfig = {
3
- projectAccessKey: string;
4
- projectId: string;
5
- wallet?: {
6
- walletConnectProjectId?: string;
7
- embedded?: {
8
- waasConfigKey: string;
9
- googleClientId?: string;
10
- appleClientId?: string;
11
- appleRedirectURI?: string;
12
- };
13
- };
14
- _internal?: {
15
- devAccessKey?: string;
16
- nextAccessKey?: string;
17
- builderEnv?: Env;
18
- marketplaceEnv?: Env;
19
- nodeGatewayEnv?: Env;
20
- metadataEnv?: Env;
21
- indexerEnv?: Env;
22
- sequenceWalletEnv?: Env;
23
- };
24
- };
25
-
26
- export type { Env as E, SdkConfig as S };
@@ -1,134 +0,0 @@
1
- import type { QueryFunctionContext } from '@tanstack/react-query';
2
- import { renderHook, server, waitFor } from '@test';
3
- import { describe, expect, it } from 'vitest';
4
- import {
5
- createErrorHandler,
6
- createStylesErrorHandler,
7
- mockConfig,
8
- mockStyles,
9
- } from '../__mocks__/marketplaceConfig.msw';
10
- import { marketplaceConfigOptions } from '../marketplaceConfigOptions';
11
-
12
- type MarketplaceConfigQueryKey = ['configs', 'marketplace', string, string];
13
- type MarketplaceConfigContext = QueryFunctionContext<MarketplaceConfigQueryKey>;
14
-
15
- describe('marketplaceConfigOptions', () => {
16
- it('should fetch marketplace config and styles successfully', async () => {
17
- const { result } = renderHook(() =>
18
- marketplaceConfigOptions({
19
- projectId: 'test-project',
20
- }),
21
- );
22
-
23
- await waitFor(() => {
24
- expect(result.current.queryKey).toEqual([
25
- 'configs',
26
- 'marketplace',
27
- 'production',
28
- 'test-project',
29
- ]);
30
- expect(result.current.queryFn).toBeDefined();
31
- });
32
-
33
- const data = await result.current.queryFn?.({
34
- queryKey: ['configs', 'marketplace', 'production', 'test-project'],
35
- } as MarketplaceConfigContext);
36
- expect(data).toEqual({
37
- ...mockConfig,
38
- cssString: mockStyles.replaceAll(/['"]/g, ''),
39
- manifestUrl: expect.stringContaining('/manifest.json'),
40
- });
41
- });
42
-
43
- it('should use custom environment and dev access key when provided', async () => {
44
- const { result } = renderHook(() =>
45
- marketplaceConfigOptions({
46
- projectId: 'test-project',
47
- _internal: {
48
- builderEnv: 'development',
49
- devAccessKey: 'test-dev-access-key',
50
- },
51
- }),
52
- );
53
-
54
- await waitFor(() => {
55
- expect(result.current.queryKey).toEqual([
56
- 'configs',
57
- 'marketplace',
58
- 'development',
59
- 'test-project',
60
- ]);
61
- expect(result.current.queryFn).toBeDefined();
62
- });
63
-
64
- const data = await result.current.queryFn?.({
65
- queryKey: ['configs', 'marketplace', 'development', 'test-project'],
66
- } as MarketplaceConfigContext);
67
- expect(data).toEqual({
68
- ...mockConfig,
69
- cssString: mockStyles.replaceAll(/['"]/g, ''),
70
- manifestUrl: expect.stringContaining('/manifest.json'),
71
- });
72
- });
73
-
74
- it('should handle error responses', async () => {
75
- // Override handler to return an error
76
- server.use(createErrorHandler());
77
-
78
- const { result } = renderHook(() =>
79
- marketplaceConfigOptions({
80
- projectId: 'non-existent-project',
81
- }),
82
- );
83
-
84
- await waitFor(() => {
85
- expect(result.current.queryKey).toEqual([
86
- 'configs',
87
- 'marketplace',
88
- 'production',
89
- 'non-existent-project',
90
- ]);
91
- expect(result.current.queryFn).toBeDefined();
92
- });
93
-
94
- await expect(
95
- result.current.queryFn?.({
96
- queryKey: [
97
- 'configs',
98
- 'marketplace',
99
- 'production',
100
- 'non-existent-project',
101
- ],
102
- } as MarketplaceConfigContext),
103
- ).rejects.toThrow('Project not found');
104
- });
105
-
106
- it('should handle network errors when fetching styles', async () => {
107
- server.use(createStylesErrorHandler());
108
-
109
- const { result } = renderHook(() =>
110
- marketplaceConfigOptions({
111
- projectId: 'test-project',
112
- }),
113
- );
114
-
115
- await waitFor(() => {
116
- expect(result.current.queryKey).toEqual([
117
- 'configs',
118
- 'marketplace',
119
- 'production',
120
- 'test-project',
121
- ]);
122
- expect(result.current.queryFn).toBeDefined();
123
- });
124
-
125
- const data = await result.current.queryFn?.({
126
- queryKey: ['configs', 'marketplace', 'production', 'test-project'],
127
- } as MarketplaceConfigContext);
128
- expect(data).toEqual({
129
- ...mockConfig,
130
- cssString: '',
131
- manifestUrl: expect.stringContaining('/manifest.json'),
132
- });
133
- });
134
- });
@@ -1,71 +0,0 @@
1
- import { queryOptions } from '@tanstack/react-query';
2
- import type {
3
- Env,
4
- MarketplaceConfig,
5
- MarketplaceSettings,
6
- SdkConfig,
7
- } from '../../../types';
8
- import {
9
- MarketplaceConfigFetchError,
10
- ProjectNotFoundError,
11
- } from '../../../utils/_internal/error/transaction';
12
- import { builderMarketplaceApi, configKeys } from '../../_internal';
13
-
14
- const fetchBuilderConfig = async (projectId: string, env: Env) => {
15
- const url = `${builderMarketplaceApi(projectId, env)}`;
16
- const response = await fetch(`${url}/settings.json`);
17
-
18
- const json = await response.json();
19
- if (!response.ok) {
20
- console.error('Failed to fetch marketplace config:', response.status, json);
21
- //@ts-ignore
22
- switch (json.code) {
23
- case 3000: // Throws 3000 if the project is not found
24
- throw new ProjectNotFoundError(projectId, url);
25
- default:
26
- //@ts-ignore
27
- throw new MarketplaceConfigFetchError(json.msg);
28
- }
29
- }
30
- return json as MarketplaceSettings;
31
- };
32
-
33
- const fetchStyles = async (projectId: string, env: Env) => {
34
- const response = await fetch(
35
- `${builderMarketplaceApi(projectId, env)}/styles.css`,
36
- );
37
- const styles = await response.text();
38
- // React sanitizes this string, so we need to remove all quotes, they are not needed anyway
39
- return styles.replaceAll(/['"]/g, '');
40
- };
41
-
42
- const fetchMarketplaceConfig = async (
43
- env: Env,
44
- projectId: string,
45
- ): Promise<MarketplaceConfig> => {
46
- const [marketplaceConfig, cssString] = await Promise.all([
47
- fetchBuilderConfig(projectId, env),
48
- fetchStyles(projectId, env),
49
- ]);
50
-
51
- return {
52
- ...marketplaceConfig,
53
- cssString,
54
- manifestUrl: `${builderMarketplaceApi(projectId, env)}/manifest.json`,
55
- };
56
- };
57
-
58
- export const marketplaceConfigOptions = (
59
- config: Pick<SdkConfig, 'projectId'> | SdkConfig,
60
- ) => {
61
- let env: Env = 'production';
62
- if ('_internal' in config && config._internal !== undefined) {
63
- env = config._internal.builderEnv ?? env;
64
- }
65
-
66
- const projectId = config.projectId;
67
- return queryOptions({
68
- queryKey: [...configKeys.marketplace, env, projectId],
69
- queryFn: () => fetchMarketplaceConfig(env, projectId),
70
- });
71
- };
@@ -1,88 +0,0 @@
1
- import type { OrderbookKind } from '../react/_internal/api/marketplace.gen';
2
-
3
- // Manual copy of the types from builder
4
- export enum MarketplaceWallet {
5
- UNIVERSAL = 'UNIVERSAL',
6
- EMBEDDED = 'EMBEDDED',
7
- ECOSYSTEM = 'ECOSYSTEM',
8
- }
9
-
10
- export enum FilterCondition {
11
- ENTIRE_KEY = 'ENTIRE_KEY',
12
- SPECIFIC_VALUE = 'SPECIFIC_VALUE',
13
- }
14
-
15
- export enum MarketplaceType { // This is only used for marketplace v1
16
- AMM = 'AMM',
17
- P2P = 'P2P',
18
- SEQUENCE = 'SEQUENCE',
19
- ORDERBOOK = 'ORDERBOOK',
20
- }
21
-
22
- export interface EcosystemWalletSettings {
23
- walletUrl: string;
24
- walletAppName: string;
25
- logoLightUrl?: string;
26
- logoDarkUrl?: string;
27
- }
28
- export interface MarketplaceWalletOptions {
29
- walletType: MarketplaceWallet;
30
- oidcIssuers: { [key: string]: string };
31
- connectors: Array<string>;
32
- includeEIP6963Wallets: boolean;
33
- ecosystem?: EcosystemWalletSettings;
34
- }
35
-
36
- export interface MetadataFilterRule {
37
- key: string;
38
- condition: FilterCondition;
39
- value?: string;
40
- }
41
-
42
- export interface CollectionFilterSettings {
43
- filterOrder: Array<string>;
44
- exclusions: Array<MetadataFilterRule>;
45
- }
46
-
47
- export interface MarketplaceCollection {
48
- marketplaceType: MarketplaceType;
49
- chainId: number;
50
- address: string;
51
- exchanges: Array<string>;
52
- bannerUrl: string;
53
- feePercentage: number;
54
- currencyOptions: Array<string>;
55
- destinationMarketplace: OrderbookKind;
56
- filterSettings?: CollectionFilterSettings;
57
- isLAOSERC721?: boolean;
58
- }
59
-
60
- export interface MarketplaceSocials {
61
- twitter: string;
62
- discord: string;
63
- website: string;
64
- tiktok: string;
65
- instagram: string;
66
- youtube: string;
67
- }
68
-
69
- export interface MarketplaceSettings {
70
- publisherId: string;
71
- title: string;
72
- shortDescription: string;
73
- socials: MarketplaceSocials;
74
- faviconUrl: string;
75
- landingBannerUrl: string;
76
- collections: Array<MarketplaceCollection>;
77
- walletOptions: MarketplaceWalletOptions;
78
- landingPageLayout: string;
79
- logoUrl: string;
80
- bannerUrl: string;
81
- fontUrl?: string;
82
- ogImage?: string;
83
- }
84
-
85
- export interface MarketplaceConfig extends MarketplaceSettings {
86
- cssString: string;
87
- manifestUrl: string;
88
- }