@medialane/ui 0.169.0 → 0.170.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (67) hide show
  1. package/dist/components/badge.d.cts +1 -1
  2. package/dist/components/badge.d.ts +1 -1
  3. package/dist/components/button.d.cts +2 -2
  4. package/dist/components/button.d.ts +2 -2
  5. package/dist/components/fast-mint/fast-mint.d.cts +2 -2
  6. package/dist/components/fast-mint/fast-mint.d.ts +2 -2
  7. package/dist/components/sheet.d.cts +1 -1
  8. package/dist/components/sheet.d.ts +1 -1
  9. package/dist/index.cjs +68 -0
  10. package/dist/index.cjs.map +1 -1
  11. package/dist/index.d.cts +8 -0
  12. package/dist/index.d.ts +8 -0
  13. package/dist/index.js +63 -0
  14. package/dist/index.js.map +1 -1
  15. package/dist/utils/sitemap-data.cjs +55 -0
  16. package/dist/utils/sitemap-data.cjs.map +1 -0
  17. package/dist/utils/sitemap-data.d.cts +23 -0
  18. package/dist/utils/sitemap-data.d.ts +23 -0
  19. package/dist/utils/sitemap-data.js +31 -0
  20. package/dist/utils/sitemap-data.js.map +1 -0
  21. package/dist/utils/use-coin-price.cjs +88 -0
  22. package/dist/utils/use-coin-price.cjs.map +1 -0
  23. package/dist/utils/use-coin-price.d.cts +17 -0
  24. package/dist/utils/use-coin-price.d.ts +17 -0
  25. package/dist/utils/use-coin-price.js +53 -0
  26. package/dist/utils/use-coin-price.js.map +1 -0
  27. package/dist/utils/use-collections.cjs +2 -2
  28. package/dist/utils/use-collections.cjs.map +1 -1
  29. package/dist/utils/use-collections.js +2 -2
  30. package/dist/utils/use-collections.js.map +1 -1
  31. package/dist/utils/use-drops.cjs +94 -0
  32. package/dist/utils/use-drops.cjs.map +1 -0
  33. package/dist/utils/use-drops.d.cts +39 -0
  34. package/dist/utils/use-drops.d.ts +39 -0
  35. package/dist/utils/use-drops.js +56 -0
  36. package/dist/utils/use-drops.js.map +1 -0
  37. package/dist/utils/use-platform-stats.cjs +50 -0
  38. package/dist/utils/use-platform-stats.cjs.map +1 -0
  39. package/dist/utils/use-platform-stats.d.cts +9 -0
  40. package/dist/utils/use-platform-stats.d.ts +9 -0
  41. package/dist/utils/use-platform-stats.js +16 -0
  42. package/dist/utils/use-platform-stats.js.map +1 -0
  43. package/dist/utils/use-pop.cjs +72 -0
  44. package/dist/utils/use-pop.cjs.map +1 -0
  45. package/dist/utils/use-pop.d.cts +28 -0
  46. package/dist/utils/use-pop.d.ts +28 -0
  47. package/dist/utils/use-pop.js +36 -0
  48. package/dist/utils/use-pop.js.map +1 -0
  49. package/dist/utils/use-sponsorship.cjs +131 -0
  50. package/dist/utils/use-sponsorship.cjs.map +1 -0
  51. package/dist/utils/use-sponsorship.d.cts +70 -0
  52. package/dist/utils/use-sponsorship.d.ts +70 -0
  53. package/dist/utils/use-sponsorship.js +90 -0
  54. package/dist/utils/use-sponsorship.js.map +1 -0
  55. package/dist/utils/use-tiers.cjs +137 -0
  56. package/dist/utils/use-tiers.cjs.map +1 -0
  57. package/dist/utils/use-tiers.d.cts +60 -0
  58. package/dist/utils/use-tiers.d.ts +60 -0
  59. package/dist/utils/use-tiers.js +95 -0
  60. package/dist/utils/use-tiers.js.map +1 -0
  61. package/dist/utils/use-tokens-by-ip-type.cjs +50 -0
  62. package/dist/utils/use-tokens-by-ip-type.cjs.map +1 -0
  63. package/dist/utils/use-tokens-by-ip-type.d.cts +14 -0
  64. package/dist/utils/use-tokens-by-ip-type.d.ts +14 -0
  65. package/dist/utils/use-tokens-by-ip-type.js +16 -0
  66. package/dist/utils/use-tokens-by-ip-type.js.map +1 -0
  67. package/package.json +3 -3
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/utils/use-collections.ts"],"sourcesContent":["\"use client\";\n\nimport useSWR from \"swr\";\nimport { useMedialaneClient } from \"./use-medialane-client.js\";\nimport type { MedialaneClient } from \"@medialane/sdk/starknet\";\nimport type { ApiCollection, ApiResponse, CollectionTokensSort } from \"@medialane/sdk\";\nimport { queryKeys } from \"./query-keys.js\";\n\nexport type CollectionSort = \"recent\" | \"supply\" | \"floor\" | \"volume\" | \"name\";\n\nexport function useCollections(\n getClient: () => MedialaneClient,\n page = 1,\n limit = 20,\n isFeatured?: boolean,\n sort: CollectionSort = \"recent\",\n hideEmpty = true,\n service?: string,\n\n standard?: string,\n\n fallback?: ApiCollection[]\n) {\n const client = useMedialaneClient(getClient);\n const key = `${queryKeys.collections(page, limit, isFeatured, sort, hideEmpty, service)}-${standard ?? \"\"}`;\n\n const { data, error, isLoading, mutate } = useSWR<ApiResponse<ApiCollection[]>>(\n key,\n async () => {\n const res = await client.api.getCollections(page, limit, isFeatured, sort, service, undefined, standard);\n return hideEmpty\n ? { ...res, data: res.data.filter((collection) => (collection.totalSupply ?? 0) > 0) }\n : res;\n },\n {\n revalidateOnFocus: false,\n ...(fallback ? { fallbackData: { data: fallback } as ApiResponse<ApiCollection[]> } : {}),\n }\n );\n\n return {\n collections: data?.data ?? [],\n meta: data?.meta,\n isLoading,\n error,\n mutate,\n };\n}\n\nexport function useCollection(getClient: () => MedialaneClient, contract: string | null) {\n const client = useMedialaneClient(getClient);\n\n const { data, error, isLoading } = useSWR(\n contract ? queryKeys.collection(contract) : null,\n () => client.api.getCollection(contract!),\n { revalidateOnFocus: false }\n );\n\n return { collection: data?.data ?? null, isLoading, error };\n}\n\nexport function useCollectionsByOwner(getClient: () => MedialaneClient, owner: string | null) {\n const client = useMedialaneClient(getClient);\n\n const { data, error, isLoading, mutate } = useSWR(\n owner ? queryKeys.collectionsOwner(owner) : null,\n () => client.api.getCollectionsByOwner(owner!),\n { revalidateOnFocus: false, refreshInterval: 60_000 }\n );\n\n return { collections: data?.data ?? [], isLoading, error, mutate };\n}\n\nexport function useCollectionTokens(\n getClient: () => MedialaneClient,\n contract: string | null,\n page = 1,\n limit = 24,\n sort: CollectionTokensSort = \"recent\"\n) {\n const client = useMedialaneClient(getClient);\n\n const { data, error, isLoading, mutate } = useSWR(\n contract ? queryKeys.collectionTokens(contract, page, limit, sort) : null,\n () => client.api.getCollectionTokens(contract!, page, limit, sort),\n { revalidateOnFocus: false }\n );\n\n return { tokens: data?.data ?? [], meta: data?.meta, isLoading, error, mutate };\n}\n\nfunction pickNearbyTokens<T extends { tokenId: string }>(\n tokens: T[],\n currentTokenId: string | null,\n count: number\n): T[] {\n if (!currentTokenId) return tokens.slice(0, count);\n const idx = tokens.findIndex((t) => String(t.tokenId) === String(currentTokenId));\n if (idx === -1) return tokens.slice(0, count);\n\n const picked: T[] = [];\n let after = idx + 1;\n let before = idx - 1;\n while (picked.length < count && (after < tokens.length || before >= 0)) {\n if (after < tokens.length) picked.push(tokens[after++]);\n if (picked.length < count && before >= 0) picked.push(tokens[before--]);\n }\n return picked.sort((a, b) => Number(a.tokenId) - Number(b.tokenId));\n}\n\nexport function useNearbyCollectionTokens(\n getClient: () => MedialaneClient,\n contract: string | null,\n currentTokenId: string | null,\n count = 4,\n poolSize = 60\n) {\n const { tokens, isLoading, error } = useCollectionTokens(getClient, contract, 1, poolSize, \"oldest\");\n return { tokens: pickNearbyTokens(tokens, currentTokenId, count), isLoading, error };\n}\n"],"mappings":";AAEA,OAAO,YAAY;AACnB,SAAS,0BAA0B;AAGnC,SAAS,iBAAiB;AAInB,SAAS,eACd,WACA,OAAO,GACP,QAAQ,IACR,YACA,OAAuB,UACvB,YAAY,MACZ,SAEA,UAEA,UACA;AACA,QAAM,SAAS,mBAAmB,SAAS;AAC3C,QAAM,MAAM,GAAG,UAAU,YAAY,MAAM,OAAO,YAAY,MAAM,WAAW,OAAO,CAAC,IAAI,YAAY,EAAE;AAEzG,QAAM,EAAE,MAAM,OAAO,WAAW,OAAO,IAAI;AAAA,IACzC;AAAA,IACA,YAAY;AACV,YAAM,MAAM,MAAM,OAAO,IAAI,eAAe,MAAM,OAAO,YAAY,MAAM,SAAS,QAAW,QAAQ;AACvG,aAAO,YACH,EAAE,GAAG,KAAK,MAAM,IAAI,KAAK,OAAO,CAAC,gBAAgB,WAAW,eA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AAM;AAAA,EAC7B;AAEA,SAAO,EAAE,QAAQ,MAAM,QAAQ,CAAC,GAAG,MAAM,MAAM,MAAM,WAAW,OAAO,OAAO;AAChF;AAEA,SAAS,iBACP,QACA,gBACA,OACK;AACL,MAAI,CAAC,eAAgB,QAAO,OAAO,MAAM,GAAG,KAAK;AACjD,QAAM,MAAM,OAAO,UAAU,CAAC,MAAM,OAAO,EAAE,OAAO,MAAM,OAAO,cAAc,CAAC;AAChF,MAAI,QAAQ,GAAI,QAAO,OAAO,MAAM,GAAG,KAAK;AAE5C,QAAM,SAAc,CAAC;AACrB,MAAI,QAAQ,MAAM;AAClB,MAAI,SAAS,MAAM;AACnB,SAAO,OAAO,SAAS,UAAU,QAAQ,OAAO,UAAU,UAAU,IAAI;AACtE,QAAI,QAAQ,OAAO,OAAQ,QAAO,KAAK,OAAO,OAAO,CAAC;AACtD,QAAI,OAAO,SAAS,SAAS,UAAU,EAAG,QAAO,KAAK,OAAO,QAAQ,CAAC;AAAA,EACxE;AACA,SAAO,OAAO,KAAK,CAAC,GAAG,MAAM,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,OAAO,CAAC;AACpE;AAEO,SAAS,0BACd,WACA,UACA,gBACA,QAAQ,GACR,WAAW,IACX;AACA,QAAM,EAAE,QAAQ,WAAW,MAAM,IAAI,oBAAoB,WAAW,UAAU,GAAG,UAAU,QAAQ;AACnG,SAAO,EAAE,QAAQ,iBAAiB,QAAQ,gBAAgB,KAAK,GAAG,WAAW,MAAM;AACrF;","names":[]}
1
+ {"version":3,"sources":["../../src/utils/use-collections.ts"],"sourcesContent":["\"use client\";\n\nimport useSWR from \"swr\";\nimport { useMedialaneClient } from \"./use-medialane-client.js\";\nimport type { MedialaneClient } from \"@medialane/sdk/starknet\";\nimport type { ApiCollection, ApiResponse, CollectionTokensSort } from \"@medialane/sdk\";\nimport { queryKeys } from \"./query-keys.js\";\n\nexport type CollectionSort = \"recent\" | \"supply\" | \"floor\" | \"volume\" | \"name\";\n\nexport function useCollections(\n getClient: () => MedialaneClient,\n page = 1,\n limit = 20,\n isFeatured?: boolean,\n sort: CollectionSort = \"recent\",\n hideEmpty = true,\n service?: string,\n\n standard?: string,\n\n fallback?: ApiCollection[]\n) {\n const client = useMedialaneClient(getClient);\n const key = `${queryKeys.collections(page, limit, isFeatured, sort, hideEmpty, service)}-${standard ?? \"\"}`;\n\n const { data, error, isLoading, mutate } = useSWR<ApiResponse<ApiCollection[]>>(\n key,\n async () => {\n const res = await client.api.listCollections({ page, limit, isFeatured, sort, service, standard });\n return hideEmpty\n ? { ...res, data: res.data.filter((collection) => (collection.totalSupply ?? 0) > 0) }\n : res;\n },\n {\n revalidateOnFocus: false,\n ...(fallback ? { fallbackData: { data: fallback } as ApiResponse<ApiCollection[]> } : {}),\n }\n );\n\n return {\n collections: data?.data ?? [],\n meta: data?.meta,\n isLoading,\n error,\n mutate,\n };\n}\n\nexport function useCollection(getClient: () => MedialaneClient, contract: string | null) {\n const client = useMedialaneClient(getClient);\n\n const { data, error, isLoading } = useSWR(\n contract ? queryKeys.collection(contract) : null,\n () => client.api.getCollection(contract!),\n { revalidateOnFocus: false }\n );\n\n return { collection: data?.data ?? null, isLoading, error };\n}\n\nexport function useCollectionsByOwner(getClient: () => MedialaneClient, owner: string | null) {\n const client = useMedialaneClient(getClient);\n\n const { data, error, isLoading, mutate } = useSWR(\n owner ? queryKeys.collectionsOwner(owner) : null,\n () => client.api.listCollections({ owner: owner!, limit: 50 }),\n { revalidateOnFocus: false, refreshInterval: 60_000 }\n );\n\n return { collections: data?.data ?? [], isLoading, error, mutate };\n}\n\nexport function useCollectionTokens(\n getClient: () => MedialaneClient,\n contract: string | null,\n page = 1,\n limit = 24,\n sort: CollectionTokensSort = \"recent\"\n) {\n const client = useMedialaneClient(getClient);\n\n const { data, error, isLoading, mutate } = useSWR(\n contract ? queryKeys.collectionTokens(contract, page, limit, sort) : null,\n () => client.api.getCollectionTokens(contract!, page, limit, sort),\n { revalidateOnFocus: false }\n );\n\n return { tokens: data?.data ?? [], meta: data?.meta, isLoading, error, mutate };\n}\n\nfunction pickNearbyTokens<T extends { tokenId: string }>(\n tokens: T[],\n currentTokenId: string | null,\n count: number\n): T[] {\n if (!currentTokenId) return tokens.slice(0, count);\n const idx = tokens.findIndex((t) => String(t.tokenId) === String(currentTokenId));\n if (idx === -1) return tokens.slice(0, count);\n\n const picked: T[] = [];\n let after = idx + 1;\n let before = idx - 1;\n while (picked.length < count && (after < tokens.length || before >= 0)) {\n if (after < tokens.length) picked.push(tokens[after++]);\n if (picked.length < count && before >= 0) picked.push(tokens[before--]);\n }\n return picked.sort((a, b) => Number(a.tokenId) - Number(b.tokenId));\n}\n\nexport function useNearbyCollectionTokens(\n getClient: () => MedialaneClient,\n contract: string | null,\n currentTokenId: string | null,\n count = 4,\n poolSize = 60\n) {\n const { tokens, isLoading, error } = useCollectionTokens(getClient, contract, 1, poolSize, \"oldest\");\n return { tokens: pickNearbyTokens(tokens, currentTokenId, count), isLoading, error };\n}\n"],"mappings":";AAEA,OAAO,YAAY;AACnB,SAAS,0BAA0B;AAGnC,SAAS,iBAAiB;AAInB,SAAS,eACd,WACA,OAAO,GACP,QAAQ,IACR,YACA,OAAuB,UACvB,YAAY,MACZ,SAEA,UAEA,UACA;AACA,QAAM,SAAS,mBAAmB,SAAS;AAC3C,QAAM,MAAM,GAAG,UAAU,YAAY,MAAM,OAAO,YAAY,MAAM,WAAW,OAAO,CAAC,IAAI,YAAY,EAAE;AAEzG,QAAM,EAAE,MAAM,OAAO,WAAW,OAAO,IAAI;AAAA,IACzC;AAAA,IACA,YAAY;AACV,YAAM,MAAM,MAAM,OAAO,IAAI,gBAAgB,EAAE,MAAM,OAAO,YAAY,MAAM,SAAS,SAAS,CAAC;AACjG,aAAO,YACH,EAAE,GAAG,KAAK,MAAM,IAAI,KAAK,OAAO,CAAC,gBAAgB,WAAW,eAAe,KAAK,CAAC,EAAE,IACnF;AAAA,IACN;AAAA,IACA;AAAA,MACE,mBAAmB;A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AM,QAAQ,CAAC,GAAG,MAAM,MAAM,MAAM,WAAW,OAAO,OAAO;AAChF;AAEA,SAAS,iBACP,QACA,gBACA,OACK;AACL,MAAI,CAAC,eAAgB,QAAO,OAAO,MAAM,GAAG,KAAK;AACjD,QAAM,MAAM,OAAO,UAAU,CAAC,MAAM,OAAO,EAAE,OAAO,MAAM,OAAO,cAAc,CAAC;AAChF,MAAI,QAAQ,GAAI,QAAO,OAAO,MAAM,GAAG,KAAK;AAE5C,QAAM,SAAc,CAAC;AACrB,MAAI,QAAQ,MAAM;AAClB,MAAI,SAAS,MAAM;AACnB,SAAO,OAAO,SAAS,UAAU,QAAQ,OAAO,UAAU,UAAU,IAAI;AACtE,QAAI,QAAQ,OAAO,OAAQ,QAAO,KAAK,OAAO,OAAO,CAAC;AACtD,QAAI,OAAO,SAAS,SAAS,UAAU,EAAG,QAAO,KAAK,OAAO,QAAQ,CAAC;AAAA,EACxE;AACA,SAAO,OAAO,KAAK,CAAC,GAAG,MAAM,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,OAAO,CAAC;AACpE;AAEO,SAAS,0BACd,WACA,UACA,gBACA,QAAQ,GACR,WAAW,IACX;AACA,QAAM,EAAE,QAAQ,WAAW,MAAM,IAAI,oBAAoB,WAAW,UAAU,GAAG,UAAU,QAAQ;AACnG,SAAO,EAAE,QAAQ,iBAAiB,QAAQ,gBAAgB,KAAK,GAAG,WAAW,MAAM;AACrF;","names":[]}
@@ -0,0 +1,94 @@
1
+ "use strict";
2
+ "use client";
3
+ var __create = Object.create;
4
+ var __defProp = Object.defineProperty;
5
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
+ var __getOwnPropNames = Object.getOwnPropertyNames;
7
+ var __getProtoOf = Object.getPrototypeOf;
8
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
9
+ var __export = (target, all) => {
10
+ for (var name in all)
11
+ __defProp(target, name, { get: all[name], enumerable: true });
12
+ };
13
+ var __copyProps = (to, from, except, desc) => {
14
+ if (from && typeof from === "object" || typeof from === "function") {
15
+ for (let key of __getOwnPropNames(from))
16
+ if (!__hasOwnProp.call(to, key) && key !== except)
17
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
18
+ }
19
+ return to;
20
+ };
21
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
22
+ // If the importer is in node compatibility mode or this is not an ESM
23
+ // file that has been converted to a CommonJS file using a Babel-
24
+ // compatible transform (i.e. "__esModule" has not been set), then set
25
+ // "default" to the CommonJS "module.exports" for node compatibility.
26
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
27
+ mod
28
+ ));
29
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
30
+ var use_drops_exports = {};
31
+ __export(use_drops_exports, {
32
+ useDropCollections: () => useDropCollections,
33
+ useDropInfo: () => useDropInfo,
34
+ useDropMintStatus: () => useDropMintStatus,
35
+ useMyDrops: () => useMyDrops,
36
+ useOnChainDropState: () => useOnChainDropState
37
+ });
38
+ module.exports = __toCommonJS(use_drops_exports);
39
+ var import_swr = __toESM(require("swr"), 1);
40
+ var import_use_medialane_client = require("./use-medialane-client.js");
41
+ function useDropCollections(getClient) {
42
+ const client = (0, import_use_medialane_client.useMedialaneClient)(getClient);
43
+ const { data, error, isLoading, mutate } = (0, import_swr.default)(
44
+ "drop-collections",
45
+ () => client.api.listCollections({ service: "drop-collection", hideEmpty: false, limit: 50 }),
46
+ { revalidateOnFocus: false }
47
+ );
48
+ return { collections: data?.data ?? [], meta: data?.meta, isLoading, error, mutate };
49
+ }
50
+ function useMyDrops(getClient, owner) {
51
+ const client = (0, import_use_medialane_client.useMedialaneClient)(getClient);
52
+ const { data, error, isLoading, mutate } = (0, import_swr.default)(
53
+ owner ? `my-drops-${owner}` : null,
54
+ async () => (await client.api.listCollections({ service: "drop-collection", owner, limit: 50 })).data ?? [],
55
+ { revalidateOnFocus: false }
56
+ );
57
+ return { drops: data ?? [], isLoading, error, mutate };
58
+ }
59
+ function useDropMintStatus(getClient, collection, wallet) {
60
+ const client = (0, import_use_medialane_client.useMedialaneClient)(getClient);
61
+ const { data, error, isLoading, mutate } = (0, import_swr.default)(
62
+ collection && wallet ? `drop-mint-status-${collection}-${wallet}` : null,
63
+ () => client.api.getDropMintStatus(collection, wallet),
64
+ { revalidateOnFocus: false, shouldRetryOnError: false }
65
+ );
66
+ return { mintStatus: data ?? null, isLoading, error, mutate };
67
+ }
68
+ function useDropInfo(getClient, contract) {
69
+ const client = (0, import_use_medialane_client.useMedialaneClient)(getClient);
70
+ const { data, error, isLoading } = (0, import_swr.default)(
71
+ contract ? `drop-info-${contract}` : null,
72
+ () => client.api.getDropInfo(contract),
73
+ { revalidateOnFocus: false, shouldRetryOnError: false }
74
+ );
75
+ return { dropInfo: data ?? null, isLoading, error };
76
+ }
77
+ function useOnChainDropState(getClient, contract) {
78
+ const client = (0, import_use_medialane_client.useMedialaneClient)(getClient);
79
+ const { data, error, isLoading, mutate } = (0, import_swr.default)(
80
+ contract ? `drop-onchain-${contract}` : null,
81
+ () => client.api.getDropState(contract),
82
+ { revalidateOnFocus: false, refreshInterval: 3e4, shouldRetryOnError: false }
83
+ );
84
+ return { state: data ?? null, isLoading, error, mutate };
85
+ }
86
+ // Annotate the CommonJS export names for ESM import in node:
87
+ 0 && (module.exports = {
88
+ useDropCollections,
89
+ useDropInfo,
90
+ useDropMintStatus,
91
+ useMyDrops,
92
+ useOnChainDropState
93
+ });
94
+ //# sourceMappingURL=use-drops.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/utils/use-drops.ts"],"sourcesContent":["\"use client\";\n\nimport useSWR from \"swr\";\nimport type { ApiCollection, ApiDropInfo, ApiDropState, ApiMeta, DropMintStatus } from \"@medialane/sdk\";\nimport type { MedialaneClient } from \"@medialane/sdk/starknet\";\nimport { useMedialaneClient } from \"./use-medialane-client.js\";\n\nexport function useDropCollections(getClient: () => MedialaneClient) {\n const client = useMedialaneClient(getClient);\n const { data, error, isLoading, mutate } = useSWR<{ data: ApiCollection[]; meta?: ApiMeta }>(\n \"drop-collections\",\n () => client.api.listCollections({ service: \"drop-collection\", hideEmpty: false, limit: 50 }),\n { revalidateOnFocus: false }\n );\n return { collections: data?.data ?? [], meta: data?.meta, isLoading, error, mutate };\n}\n\nexport function useMyDrops(getClient: () => MedialaneClient, owner: string | null) {\n const client = useMedialaneClient(getClient);\n const { data, error, isLoading, mutate } = useSWR<ApiCollection[]>(\n owner ? `my-drops-${owner}` : null,\n async () => (await client.api.listCollections({ service: \"drop-collection\", owner: owner!, limit: 50 })).data ?? [],\n { revalidateOnFocus: false }\n );\n return { drops: data ?? [], isLoading, error, mutate };\n}\n\nexport function useDropMintStatus(getClient: () => MedialaneClient, collection: string | null, wallet: string | null) {\n const client = useMedialaneClient(getClient);\n const { data, error, isLoading, mutate } = useSWR<DropMintStatus>(\n collection && wallet ? `drop-mint-status-${collection}-${wallet}` : null,\n () => client.api.getDropMintStatus(collection!, wallet!),\n { revalidateOnFocus: false, shouldRetryOnError: false }\n );\n return { mintStatus: data ?? null, isLoading, error, mutate };\n}\n\nexport function useDropInfo(getClient: () => MedialaneClient, contract: string | null) {\n const client = useMedialaneClient(getClient);\n const { data, error, isLoading } = useSWR<ApiDropInfo | null>(\n contract ? `drop-info-${contract}` : null,\n () => client.api.getDropInfo(contract!),\n { revalidateOnFocus: false, shouldRetryOnError: false }\n );\n return { dropInfo: data ?? null, isLoading, error };\n}\n\nexport function useOnChainDropState(getClient: () => MedialaneClient, contract: string | null) {\n const client = useMedialaneClient(getClient);\n const { data, error, isLoading, mutate } = useSWR<ApiDropState>(\n contract ? `drop-onchain-${contract}` : null,\n () => client.api.getDropState(contract!),\n { revalidateOnFocus: false, refreshInterval: 30_000, shouldRetryOnError: false }\n );\n return { state: data ?? null, isLoading, error, mutate };\n}\n"],"mappings":";;;;;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UAAyB;AACrF,QAAM,aAAS,gDAAmB,SAAS;AAC3C,QAAM,EAAE,MAAM,OAAO,UAAU,QAAI,WAAAA;AAAA,IACjC,WAAW,aAAa,QAAQ,KAAK;AAAA,IACrC,MAAM,OAAO,IAAI,YAAY,QAAS;AAAA,IACtC,EAAE,mBAAmB,OAAO,oBAAoB,MAAM;AAAA,EACxD;AACA,SAAO,EAAE,UAAU,QAAQ,MAAM,WAAW,MAAM;AACpD;AAEO,SAAS,oBAAoB,WAAkC,UAAyB;AAC7F,QAAM,aAAS,gDAAmB,SAAS;AAC3C,QAAM,EAAE,MAAM,OAAO,WAAW,OAAO,QAAI,WAAAA;AAAA,IACzC,WAAW,gBAAgB,QAAQ,KAAK;AAAA,IACxC,MAAM,OAAO,IAAI,aAAa,QAAS;AAAA,IACvC,EAAE,mBAAmB,OAAO,iBAAiB,KAAQ,oBAAoB,MAAM;AAAA,EACjF;AACA,SAAO,EAAE,OAAO,QAAQ,MAAM,WAAW,OAAO,OAAO;AACzD;","names":["useSWR"]}
@@ -0,0 +1,39 @@
1
+ import * as swr from 'swr';
2
+ import { ApiCollection, ApiMeta, ApiDropInfo, DropMintStatus, ApiDropState } from '@medialane/sdk';
3
+ import { MedialaneClient } from '@medialane/sdk/starknet';
4
+
5
+ declare function useDropCollections(getClient: () => MedialaneClient): {
6
+ collections: ApiCollection[];
7
+ meta: ApiMeta | undefined;
8
+ isLoading: boolean;
9
+ error: any;
10
+ mutate: swr.KeyedMutator<{
11
+ data: ApiCollection[];
12
+ meta?: ApiMeta;
13
+ }>;
14
+ };
15
+ declare function useMyDrops(getClient: () => MedialaneClient, owner: string | null): {
16
+ drops: ApiCollection[];
17
+ isLoading: boolean;
18
+ error: any;
19
+ mutate: swr.KeyedMutator<ApiCollection[]>;
20
+ };
21
+ declare function useDropMintStatus(getClient: () => MedialaneClient, collection: string | null, wallet: string | null): {
22
+ mintStatus: DropMintStatus | null;
23
+ isLoading: boolean;
24
+ error: any;
25
+ mutate: swr.KeyedMutator<DropMintStatus>;
26
+ };
27
+ declare function useDropInfo(getClient: () => MedialaneClient, contract: string | null): {
28
+ dropInfo: ApiDropInfo | null;
29
+ isLoading: boolean;
30
+ error: any;
31
+ };
32
+ declare function useOnChainDropState(getClient: () => MedialaneClient, contract: string | null): {
33
+ state: ApiDropState | null;
34
+ isLoading: boolean;
35
+ error: any;
36
+ mutate: swr.KeyedMutator<ApiDropState>;
37
+ };
38
+
39
+ export { useDropCollections, useDropInfo, useDropMintStatus, useMyDrops, useOnChainDropState };
@@ -0,0 +1,39 @@
1
+ import * as swr from 'swr';
2
+ import { ApiCollection, ApiMeta, ApiDropInfo, DropMintStatus, ApiDropState } from '@medialane/sdk';
3
+ import { MedialaneClient } from '@medialane/sdk/starknet';
4
+
5
+ declare function useDropCollections(getClient: () => MedialaneClient): {
6
+ collections: ApiCollection[];
7
+ meta: ApiMeta | undefined;
8
+ isLoading: boolean;
9
+ error: any;
10
+ mutate: swr.KeyedMutator<{
11
+ data: ApiCollection[];
12
+ meta?: ApiMeta;
13
+ }>;
14
+ };
15
+ declare function useMyDrops(getClient: () => MedialaneClient, owner: string | null): {
16
+ drops: ApiCollection[];
17
+ isLoading: boolean;
18
+ error: any;
19
+ mutate: swr.KeyedMutator<ApiCollection[]>;
20
+ };
21
+ declare function useDropMintStatus(getClient: () => MedialaneClient, collection: string | null, wallet: string | null): {
22
+ mintStatus: DropMintStatus | null;
23
+ isLoading: boolean;
24
+ error: any;
25
+ mutate: swr.KeyedMutator<DropMintStatus>;
26
+ };
27
+ declare function useDropInfo(getClient: () => MedialaneClient, contract: string | null): {
28
+ dropInfo: ApiDropInfo | null;
29
+ isLoading: boolean;
30
+ error: any;
31
+ };
32
+ declare function useOnChainDropState(getClient: () => MedialaneClient, contract: string | null): {
33
+ state: ApiDropState | null;
34
+ isLoading: boolean;
35
+ error: any;
36
+ mutate: swr.KeyedMutator<ApiDropState>;
37
+ };
38
+
39
+ export { useDropCollections, useDropInfo, useDropMintStatus, useMyDrops, useOnChainDropState };
@@ -0,0 +1,56 @@
1
+ "use client";
2
+ import useSWR from "swr";
3
+ import { useMedialaneClient } from "./use-medialane-client.js";
4
+ function useDropCollections(getClient) {
5
+ const client = useMedialaneClient(getClient);
6
+ const { data, error, isLoading, mutate } = useSWR(
7
+ "drop-collections",
8
+ () => client.api.listCollections({ service: "drop-collection", hideEmpty: false, limit: 50 }),
9
+ { revalidateOnFocus: false }
10
+ );
11
+ return { collections: data?.data ?? [], meta: data?.meta, isLoading, error, mutate };
12
+ }
13
+ function useMyDrops(getClient, owner) {
14
+ const client = useMedialaneClient(getClient);
15
+ const { data, error, isLoading, mutate } = useSWR(
16
+ owner ? `my-drops-${owner}` : null,
17
+ async () => (await client.api.listCollections({ service: "drop-collection", owner, limit: 50 })).data ?? [],
18
+ { revalidateOnFocus: false }
19
+ );
20
+ return { drops: data ?? [], isLoading, error, mutate };
21
+ }
22
+ function useDropMintStatus(getClient, collection, wallet) {
23
+ const client = useMedialaneClient(getClient);
24
+ const { data, error, isLoading, mutate } = useSWR(
25
+ collection && wallet ? `drop-mint-status-${collection}-${wallet}` : null,
26
+ () => client.api.getDropMintStatus(collection, wallet),
27
+ { revalidateOnFocus: false, shouldRetryOnError: false }
28
+ );
29
+ return { mintStatus: data ?? null, isLoading, error, mutate };
30
+ }
31
+ function useDropInfo(getClient, contract) {
32
+ const client = useMedialaneClient(getClient);
33
+ const { data, error, isLoading } = useSWR(
34
+ contract ? `drop-info-${contract}` : null,
35
+ () => client.api.getDropInfo(contract),
36
+ { revalidateOnFocus: false, shouldRetryOnError: false }
37
+ );
38
+ return { dropInfo: data ?? null, isLoading, error };
39
+ }
40
+ function useOnChainDropState(getClient, contract) {
41
+ const client = useMedialaneClient(getClient);
42
+ const { data, error, isLoading, mutate } = useSWR(
43
+ contract ? `drop-onchain-${contract}` : null,
44
+ () => client.api.getDropState(contract),
45
+ { revalidateOnFocus: false, refreshInterval: 3e4, shouldRetryOnError: false }
46
+ );
47
+ return { state: data ?? null, isLoading, error, mutate };
48
+ }
49
+ export {
50
+ useDropCollections,
51
+ useDropInfo,
52
+ useDropMintStatus,
53
+ useMyDrops,
54
+ useOnChainDropState
55
+ };
56
+ //# sourceMappingURL=use-drops.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/utils/use-drops.ts"],"sourcesContent":["\"use client\";\n\nimport useSWR from \"swr\";\nimport type { ApiCollection, ApiDropInfo, ApiDropState, ApiMeta, DropMintStatus } from \"@medialane/sdk\";\nimport type { MedialaneClient } from \"@medialane/sdk/starknet\";\nimport { useMedialaneClient } from \"./use-medialane-client.js\";\n\nexport function useDropCollections(getClient: () => MedialaneClient) {\n const client = useMedialaneClient(getClient);\n const { data, error, isLoading, mutate } = useSWR<{ data: ApiCollection[]; meta?: ApiMeta }>(\n \"drop-collections\",\n () => client.api.listCollections({ service: \"drop-collection\", hideEmpty: false, limit: 50 }),\n { revalidateOnFocus: false }\n );\n return { collections: data?.data ?? [], meta: data?.meta, isLoading, error, mutate };\n}\n\nexport function useMyDrops(getClient: () => MedialaneClient, owner: string | null) {\n const client = useMedialaneClient(getClient);\n const { data, error, isLoading, mutate } = useSWR<ApiCollection[]>(\n owner ? `my-drops-${owner}` : null,\n async () => (await client.api.listCollections({ service: \"drop-collection\", owner: owner!, limit: 50 })).data ?? [],\n { revalidateOnFocus: false }\n );\n return { drops: data ?? [], isLoading, error, mutate };\n}\n\nexport function useDropMintStatus(getClient: () => MedialaneClient, collection: string | null, wallet: string | null) {\n const client = useMedialaneClient(getClient);\n const { data, error, isLoading, mutate } = useSWR<DropMintStatus>(\n collection && wallet ? `drop-mint-status-${collection}-${wallet}` : null,\n () => client.api.getDropMintStatus(collection!, wallet!),\n { revalidateOnFocus: false, shouldRetryOnError: false }\n );\n return { mintStatus: data ?? null, isLoading, error, mutate };\n}\n\nexport function useDropInfo(getClient: () => MedialaneClient, contract: string | null) {\n const client = useMedialaneClient(getClient);\n const { data, error, isLoading } = useSWR<ApiDropInfo | null>(\n contract ? `drop-info-${contract}` : null,\n () => client.api.getDropInfo(contract!),\n { revalidateOnFocus: false, shouldRetryOnError: false }\n );\n return { dropInfo: data ?? null, isLoading, error };\n}\n\nexport function useOnChainDropState(getClient: () => MedialaneClient, contract: string | null) {\n const client = useMedialaneClient(getClient);\n const { data, error, isLoading, mutate } = useSWR<ApiDropState>(\n contract ? `drop-onchain-${contract}` : null,\n () => client.api.getDropState(contract!),\n { revalidateOnFocus: false, refreshInterval: 30_000, shouldRetryOnError: false }\n );\n return { state: data ?? null, isLoading, error, mutate };\n}\n"],"mappings":";AAEA,OAAO,YAAY;AAGnB,SAAS,0BAA0B;AAE5B,SAAS,mBAAmB,WAAkC;AACnE,QAAM,SAAS,mBAAmB,SAAS;AAC3C,QAAM,EAAE,MAAM,OAAO,WAAW,OAAO,IAAI;AAAA,IACzC;AAAA,IACA,MAAM,OAAO,IAAI,gBAAgB,EAAE,SAAS,mBAAmB,WAAW,OAAO,OAAO,GAAG,CAAC;AAAA,IAC5F,EAAE,mBAAmB,MAAM;AAAA,EAC7B;AACA,SAAO,EAAE,aAAa,MAAM,QAAQ,CAAC,GAAG,MAAM,MAAM,MAAM,WAAW,OAAO,OAAO;AACrF;AAEO,SAAS,WAAW,WAAkC,OAAsB;AACjF,QAAM,SAAS,mBAAmB,SAAS;AAC3C,QAAM,EAAE,MAAM,OAAO,WAAW,OAAO,IAAI;AAAA,IACzC,QAAQ,YAAY,KAAK,KAAK;AAAA,IAC9B,aAAa,MAAM,OAAO,IAAI,gBAAgB,EAAE,SAAS,mBAAmB,OAAe,OAAO,GAAG,CAAC,GAAG,QAAQ,CAAC;AAAA,IAClH,EAAE,mBAAmB,MAAM;AAAA,EAC7B;AACA,SAAO,EAAE,OAAO,QAAQ,CAAC,GAAG,WAAW,OAAO,OAAO;AACvD;AAEO,SAAS,kBAAkB,WAAkC,YAA2B,QAAuB;AACpH,QAAM,SAAS,mBAAmB,SAAS;AAC3C,QAAM,EAAE,MAAM,OAAO,WAAW,OAAO,IAAI;AAAA,IACzC,cAAc,SAAS,oBAAoB,UAAU,IAAI,MAAM,KAAK;AAAA,IACpE,MAAM,OAAO,IAAI,kBAAkB,YAAa,MAAO;AAAA,IACvD,EAAE,mBAAmB,OAAO,oBAAoB,MAAM;AAAA,EACxD;AACA,SAAO,EAAE,YAAY,QAAQ,MAAM,WAAW,OAAO,OAAO;AAC9D;AAEO,SAAS,YAAY,WAAkC,UAAyB;AACrF,QAAM,SAAS,mBAAmB,SAAS;AAC3C,QAAM,EAAE,MAAM,OAAO,UAAU,IAAI;AAAA,IACjC,WAAW,aAAa,QAAQ,KAAK;AAAA,IACrC,MAAM,OAAO,IAAI,YAAY,QAAS;AAAA,IACtC,EAAE,mBAAmB,OAAO,oBAAoB,MAAM;AAAA,EACxD;AACA,SAAO,EAAE,UAAU,QAAQ,MAAM,WAAW,MAAM;AACpD;AAEO,SAAS,oBAAoB,WAAkC,UAAyB;AAC7F,QAAM,SAAS,mBAAmB,SAAS;AAC3C,QAAM,EAAE,MAAM,OAAO,WAAW,OAAO,IAAI;AAAA,IACzC,WAAW,gBAAgB,QAAQ,KAAK;AAAA,IACxC,MAAM,OAAO,IAAI,aAAa,QAAS;AAAA,IACvC,EAAE,mBAAmB,OAAO,iBAAiB,KAAQ,oBAAoB,MAAM;AAAA,EACjF;AACA,SAAO,EAAE,OAAO,QAAQ,MAAM,WAAW,OAAO,OAAO;AACzD;","names":[]}
@@ -0,0 +1,50 @@
1
+ "use strict";
2
+ "use client";
3
+ var __create = Object.create;
4
+ var __defProp = Object.defineProperty;
5
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
+ var __getOwnPropNames = Object.getOwnPropertyNames;
7
+ var __getProtoOf = Object.getPrototypeOf;
8
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
9
+ var __export = (target, all) => {
10
+ for (var name in all)
11
+ __defProp(target, name, { get: all[name], enumerable: true });
12
+ };
13
+ var __copyProps = (to, from, except, desc) => {
14
+ if (from && typeof from === "object" || typeof from === "function") {
15
+ for (let key of __getOwnPropNames(from))
16
+ if (!__hasOwnProp.call(to, key) && key !== except)
17
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
18
+ }
19
+ return to;
20
+ };
21
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
22
+ // If the importer is in node compatibility mode or this is not an ESM
23
+ // file that has been converted to a CommonJS file using a Babel-
24
+ // compatible transform (i.e. "__esModule" has not been set), then set
25
+ // "default" to the CommonJS "module.exports" for node compatibility.
26
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
27
+ mod
28
+ ));
29
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
30
+ var use_platform_stats_exports = {};
31
+ __export(use_platform_stats_exports, {
32
+ usePlatformStats: () => usePlatformStats
33
+ });
34
+ module.exports = __toCommonJS(use_platform_stats_exports);
35
+ var import_swr = __toESM(require("swr"), 1);
36
+ var import_use_medialane_client = require("./use-medialane-client.js");
37
+ function usePlatformStats(getClient) {
38
+ const client = (0, import_use_medialane_client.useMedialaneClient)(getClient);
39
+ const { data, isLoading } = (0, import_swr.default)(
40
+ "platform-stats",
41
+ () => client.api.getPlatformStats(),
42
+ { revalidateOnFocus: false, dedupingInterval: 6e4 }
43
+ );
44
+ return { stats: data ?? null, isLoading };
45
+ }
46
+ // Annotate the CommonJS export names for ESM import in node:
47
+ 0 && (module.exports = {
48
+ usePlatformStats
49
+ });
50
+ //# sourceMappingURL=use-platform-stats.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/utils/use-platform-stats.ts"],"sourcesContent":["\"use client\";\n\nimport useSWR from \"swr\";\nimport type { ApiPlatformStats } from \"@medialane/sdk\";\nimport type { MedialaneClient } from \"@medialane/sdk/starknet\";\nimport { useMedialaneClient } from \"./use-medialane-client.js\";\n\nexport function usePlatformStats(getClient: () => MedialaneClient) {\n const client = useMedialaneClient(getClient);\n const { data, isLoading } = useSWR<ApiPlatformStats>(\n \"platform-stats\",\n () => client.api.getPlatformStats(),\n { revalidateOnFocus: false, dedupingInterval: 60_000 }\n );\n return { stats: data ?? null, isLoading };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,iBAAmB;AAGnB,kCAAmC;AAE5B,SAAS,iBAAiB,WAAkC;AACjE,QAAM,aAAS,gDAAmB,SAAS;AAC3C,QAAM,EAAE,MAAM,UAAU,QAAI,WAAAA;AAAA,IAC1B;AAAA,IACA,MAAM,OAAO,IAAI,iBAAiB;AAAA,IAClC,EAAE,mBAAmB,OAAO,kBAAkB,IAAO;AAAA,EACvD;AACA,SAAO,EAAE,OAAO,QAAQ,MAAM,UAAU;AAC1C;","names":["useSWR"]}
@@ -0,0 +1,9 @@
1
+ import { ApiPlatformStats } from '@medialane/sdk';
2
+ import { MedialaneClient } from '@medialane/sdk/starknet';
3
+
4
+ declare function usePlatformStats(getClient: () => MedialaneClient): {
5
+ stats: ApiPlatformStats | null;
6
+ isLoading: boolean;
7
+ };
8
+
9
+ export { usePlatformStats };
@@ -0,0 +1,9 @@
1
+ import { ApiPlatformStats } from '@medialane/sdk';
2
+ import { MedialaneClient } from '@medialane/sdk/starknet';
3
+
4
+ declare function usePlatformStats(getClient: () => MedialaneClient): {
5
+ stats: ApiPlatformStats | null;
6
+ isLoading: boolean;
7
+ };
8
+
9
+ export { usePlatformStats };
@@ -0,0 +1,16 @@
1
+ "use client";
2
+ import useSWR from "swr";
3
+ import { useMedialaneClient } from "./use-medialane-client.js";
4
+ function usePlatformStats(getClient) {
5
+ const client = useMedialaneClient(getClient);
6
+ const { data, isLoading } = useSWR(
7
+ "platform-stats",
8
+ () => client.api.getPlatformStats(),
9
+ { revalidateOnFocus: false, dedupingInterval: 6e4 }
10
+ );
11
+ return { stats: data ?? null, isLoading };
12
+ }
13
+ export {
14
+ usePlatformStats
15
+ };
16
+ //# sourceMappingURL=use-platform-stats.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/utils/use-platform-stats.ts"],"sourcesContent":["\"use client\";\n\nimport useSWR from \"swr\";\nimport type { ApiPlatformStats } from \"@medialane/sdk\";\nimport type { MedialaneClient } from \"@medialane/sdk/starknet\";\nimport { useMedialaneClient } from \"./use-medialane-client.js\";\n\nexport function usePlatformStats(getClient: () => MedialaneClient) {\n const client = useMedialaneClient(getClient);\n const { data, isLoading } = useSWR<ApiPlatformStats>(\n \"platform-stats\",\n () => client.api.getPlatformStats(),\n { revalidateOnFocus: false, dedupingInterval: 60_000 }\n );\n return { stats: data ?? null, isLoading };\n}\n"],"mappings":";AAEA,OAAO,YAAY;AAGnB,SAAS,0BAA0B;AAE5B,SAAS,iBAAiB,WAAkC;AACjE,QAAM,SAAS,mBAAmB,SAAS;AAC3C,QAAM,EAAE,MAAM,UAAU,IAAI;AAAA,IAC1B;AAAA,IACA,MAAM,OAAO,IAAI,iBAAiB;AAAA,IAClC,EAAE,mBAAmB,OAAO,kBAAkB,IAAO;AAAA,EACvD;AACA,SAAO,EAAE,OAAO,QAAQ,MAAM,UAAU;AAC1C;","names":[]}
@@ -0,0 +1,72 @@
1
+ "use strict";
2
+ "use client";
3
+ var __create = Object.create;
4
+ var __defProp = Object.defineProperty;
5
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
+ var __getOwnPropNames = Object.getOwnPropertyNames;
7
+ var __getProtoOf = Object.getPrototypeOf;
8
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
9
+ var __export = (target, all) => {
10
+ for (var name in all)
11
+ __defProp(target, name, { get: all[name], enumerable: true });
12
+ };
13
+ var __copyProps = (to, from, except, desc) => {
14
+ if (from && typeof from === "object" || typeof from === "function") {
15
+ for (let key of __getOwnPropNames(from))
16
+ if (!__hasOwnProp.call(to, key) && key !== except)
17
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
18
+ }
19
+ return to;
20
+ };
21
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
22
+ // If the importer is in node compatibility mode or this is not an ESM
23
+ // file that has been converted to a CommonJS file using a Babel-
24
+ // compatible transform (i.e. "__esModule" has not been set), then set
25
+ // "default" to the CommonJS "module.exports" for node compatibility.
26
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
27
+ mod
28
+ ));
29
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
30
+ var use_pop_exports = {};
31
+ __export(use_pop_exports, {
32
+ useMyPopEvents: () => useMyPopEvents,
33
+ usePopClaimStatus: () => usePopClaimStatus,
34
+ usePopCollections: () => usePopCollections
35
+ });
36
+ module.exports = __toCommonJS(use_pop_exports);
37
+ var import_swr = __toESM(require("swr"), 1);
38
+ var import_use_medialane_client = require("./use-medialane-client.js");
39
+ function usePopCollections(getClient) {
40
+ const client = (0, import_use_medialane_client.useMedialaneClient)(getClient);
41
+ const { data, error, isLoading, mutate } = (0, import_swr.default)(
42
+ "pop-collections",
43
+ () => client.api.listCollections({ service: "pop-protocol", hideEmpty: false, limit: 50 }),
44
+ { revalidateOnFocus: false }
45
+ );
46
+ return { collections: data?.data ?? [], meta: data?.meta, isLoading, error, mutate };
47
+ }
48
+ function useMyPopEvents(getClient, owner) {
49
+ const client = (0, import_use_medialane_client.useMedialaneClient)(getClient);
50
+ const { data, error, isLoading, mutate } = (0, import_swr.default)(
51
+ owner ? `my-pop-events-${owner}` : null,
52
+ async () => (await client.api.listCollections({ service: "pop-protocol", owner, limit: 50 })).data ?? [],
53
+ { revalidateOnFocus: false }
54
+ );
55
+ return { events: data ?? [], isLoading, error, mutate };
56
+ }
57
+ function usePopClaimStatus(getClient, collection, wallet) {
58
+ const client = (0, import_use_medialane_client.useMedialaneClient)(getClient);
59
+ const { data, error, isLoading, mutate } = (0, import_swr.default)(
60
+ collection && wallet ? `pop-eligibility-${collection}-${wallet}` : null,
61
+ () => client.api.getPopEligibility(collection, wallet),
62
+ { revalidateOnFocus: false, shouldRetryOnError: false }
63
+ );
64
+ return { claimStatus: data ?? null, isLoading, error, mutate };
65
+ }
66
+ // Annotate the CommonJS export names for ESM import in node:
67
+ 0 && (module.exports = {
68
+ useMyPopEvents,
69
+ usePopClaimStatus,
70
+ usePopCollections
71
+ });
72
+ //# sourceMappingURL=use-pop.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/utils/use-pop.ts"],"sourcesContent":["\"use client\";\n\nimport useSWR from \"swr\";\nimport type { ApiCollection, ApiMeta, PopClaimStatus } from \"@medialane/sdk\";\nimport type { MedialaneClient } from \"@medialane/sdk/starknet\";\nimport { useMedialaneClient } from \"./use-medialane-client.js\";\n\nexport function usePopCollections(getClient: () => MedialaneClient) {\n const client = useMedialaneClient(getClient);\n const { data, error, isLoading, mutate } = useSWR<{ data: ApiCollection[]; meta?: ApiMeta }>(\n \"pop-collections\",\n () => client.api.listCollections({ service: \"pop-protocol\", hideEmpty: false, limit: 50 }),\n { revalidateOnFocus: false }\n );\n return { collections: data?.data ?? [], meta: data?.meta, isLoading, error, mutate };\n}\n\nexport function useMyPopEvents(getClient: () => MedialaneClient, owner: string | null) {\n const client = useMedialaneClient(getClient);\n const { data, error, isLoading, mutate } = useSWR<ApiCollection[]>(\n owner ? `my-pop-events-${owner}` : null,\n async () => (await client.api.listCollections({ service: \"pop-protocol\", owner: owner!, limit: 50 })).data ?? [],\n { revalidateOnFocus: false }\n );\n return { events: data ?? [], isLoading, error, mutate };\n}\n\nexport function usePopClaimStatus(getClient: () => MedialaneClient, collection: string | null, wallet: string | null) {\n const client = useMedialaneClient(getClient);\n const { data, error, isLoading, mutate } = useSWR<PopClaimStatus>(\n collection && wallet ? `pop-eligibility-${collection}-${wallet}` : null,\n () => client.api.getPopEligibility(collection!, wallet!),\n { revalidateO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aAAa,QAAQ,MAAM,WAAW,OAAO,OAAO;AAC/D;","names":["useSWR"]}
@@ -0,0 +1,28 @@
1
+ import * as swr from 'swr';
2
+ import { ApiCollection, PopClaimStatus, ApiMeta } from '@medialane/sdk';
3
+ import { MedialaneClient } from '@medialane/sdk/starknet';
4
+
5
+ declare function usePopCollections(getClient: () => MedialaneClient): {
6
+ collections: ApiCollection[];
7
+ meta: ApiMeta | undefined;
8
+ isLoading: boolean;
9
+ error: any;
10
+ mutate: swr.KeyedMutator<{
11
+ data: ApiCollection[];
12
+ meta?: ApiMeta;
13
+ }>;
14
+ };
15
+ declare function useMyPopEvents(getClient: () => MedialaneClient, owner: string | null): {
16
+ events: ApiCollection[];
17
+ isLoading: boolean;
18
+ error: any;
19
+ mutate: swr.KeyedMutator<ApiCollection[]>;
20
+ };
21
+ declare function usePopClaimStatus(getClient: () => MedialaneClient, collection: string | null, wallet: string | null): {
22
+ claimStatus: PopClaimStatus | null;
23
+ isLoading: boolean;
24
+ error: any;
25
+ mutate: swr.KeyedMutator<PopClaimStatus>;
26
+ };
27
+
28
+ export { useMyPopEvents, usePopClaimStatus, usePopCollections };
@@ -0,0 +1,28 @@
1
+ import * as swr from 'swr';
2
+ import { ApiCollection, PopClaimStatus, ApiMeta } from '@medialane/sdk';
3
+ import { MedialaneClient } from '@medialane/sdk/starknet';
4
+
5
+ declare function usePopCollections(getClient: () => MedialaneClient): {
6
+ collections: ApiCollection[];
7
+ meta: ApiMeta | undefined;
8
+ isLoading: boolean;
9
+ error: any;
10
+ mutate: swr.KeyedMutator<{
11
+ data: ApiCollection[];
12
+ meta?: ApiMeta;
13
+ }>;
14
+ };
15
+ declare function useMyPopEvents(getClient: () => MedialaneClient, owner: string | null): {
16
+ events: ApiCollection[];
17
+ isLoading: boolean;
18
+ error: any;
19
+ mutate: swr.KeyedMutator<ApiCollection[]>;
20
+ };
21
+ declare function usePopClaimStatus(getClient: () => MedialaneClient, collection: string | null, wallet: string | null): {
22
+ claimStatus: PopClaimStatus | null;
23
+ isLoading: boolean;
24
+ error: any;
25
+ mutate: swr.KeyedMutator<PopClaimStatus>;
26
+ };
27
+
28
+ export { useMyPopEvents, usePopClaimStatus, usePopCollections };
@@ -0,0 +1,36 @@
1
+ "use client";
2
+ import useSWR from "swr";
3
+ import { useMedialaneClient } from "./use-medialane-client.js";
4
+ function usePopCollections(getClient) {
5
+ const client = useMedialaneClient(getClient);
6
+ const { data, error, isLoading, mutate } = useSWR(
7
+ "pop-collections",
8
+ () => client.api.listCollections({ service: "pop-protocol", hideEmpty: false, limit: 50 }),
9
+ { revalidateOnFocus: false }
10
+ );
11
+ return { collections: data?.data ?? [], meta: data?.meta, isLoading, error, mutate };
12
+ }
13
+ function useMyPopEvents(getClient, owner) {
14
+ const client = useMedialaneClient(getClient);
15
+ const { data, error, isLoading, mutate } = useSWR(
16
+ owner ? `my-pop-events-${owner}` : null,
17
+ async () => (await client.api.listCollections({ service: "pop-protocol", owner, limit: 50 })).data ?? [],
18
+ { revalidateOnFocus: false }
19
+ );
20
+ return { events: data ?? [], isLoading, error, mutate };
21
+ }
22
+ function usePopClaimStatus(getClient, collection, wallet) {
23
+ const client = useMedialaneClient(getClient);
24
+ const { data, error, isLoading, mutate } = useSWR(
25
+ collection && wallet ? `pop-eligibility-${collection}-${wallet}` : null,
26
+ () => client.api.getPopEligibility(collection, wallet),
27
+ { revalidateOnFocus: false, shouldRetryOnError: false }
28
+ );
29
+ return { claimStatus: data ?? null, isLoading, error, mutate };
30
+ }
31
+ export {
32
+ useMyPopEvents,
33
+ usePopClaimStatus,
34
+ usePopCollections
35
+ };
36
+ //# sourceMappingURL=use-pop.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/utils/use-pop.ts"],"sourcesContent":["\"use client\";\n\nimport useSWR from \"swr\";\nimport type { ApiCollection, ApiMeta, PopClaimStatus } from \"@medialane/sdk\";\nimport type { MedialaneClient } from \"@medialane/sdk/starknet\";\nimport { useMedialaneClient } from \"./use-medialane-client.js\";\n\nexport function usePopCollections(getClient: () => MedialaneClient) {\n const client = useMedialaneClient(getClient);\n const { data, error, isLoading, mutate } = useSWR<{ data: ApiCollection[]; meta?: ApiMeta }>(\n \"pop-collections\",\n () => client.api.listCollections({ service: \"pop-protocol\", hideEmpty: false, limit: 50 }),\n { revalidateOnFocus: false }\n );\n return { collections: data?.data ?? [], meta: data?.meta, isLoading, error, mutate };\n}\n\nexport function useMyPopEvents(getClient: () => MedialaneClient, owner: string | null) {\n const client = useMedialaneClient(getClient);\n const { data, error, isLoading, mutate } = useSWR<ApiCollection[]>(\n owner ? `my-pop-events-${owner}` : null,\n async () => (await client.api.listCollections({ service: \"pop-protocol\", owner: owner!, limit: 50 })).data ?? [],\n { revalidateOnFocus: false }\n );\n return { events: data ?? [], isLoading, error, mutate };\n}\n\nexport function usePopClaimStatus(getClient: () => MedialaneClient, collection: string | null, wallet: string | null) {\n const client = useMedialaneClient(getClient);\n const { data, error, isLoading, mutate } = useSWR<PopClaimStatus>(\n collection && wallet ? `pop-eligibility-${collection}-${wallet}` : null,\n () => client.api.getPopEligibility(collection!, wallet!),\n { revalidateOnFocus: false, shouldRetryOnError: false }\n );\n return { claimStatus: data ?? null, isLoading, error, mutate };\n}\n"],"mappings":";AAEA,OAAO,YAAY;AAGnB,SAAS,0BAA0B;AAE5B,SAAS,kBAAkB,WAAkC;AAClE,QAAM,SAAS,mBAAmB,SAAS;AAC3C,QAAM,EAAE,MAAM,OAAO,WAAW,OAAO,IAAI;AAAA,IACzC;AAAA,IACA,MAAM,OAAO,IAAI,gBAAgB,EAAE,SAAS,gBAAgB,WAAW,OAAO,OAAO,GAAG,CAAC;AAAA,IACzF,EAAE,mBAAmB,MAAM;AAAA,EAC7B;AACA,SAAO,EAAE,aAAa,MAAM,QAAQ,CAAC,GAAG,MAAM,MAAM,MAAM,WAAW,OAAO,OAAO;AACrF;AAEO,SAAS,eAAe,WAAkC,OAAsB;AACrF,QAAM,SAAS,mBAAmB,SAAS;AAC3C,QAAM,EAAE,MAAM,OAAO,WAAW,OAAO,IAAI;AAAA,IACzC,QAAQ,iBAAiB,KAAK,KAAK;AAAA,IACnC,aAAa,MAAM,OAAO,IAAI,gBAAgB,EAAE,SAAS,gBAAgB,OAAe,OAAO,GAAG,CAAC,GAAG,QAAQ,CAAC;AAAA,IAC/G,EAAE,mBAAmB,MAAM;AAAA,EAC7B;AACA,SAAO,EAAE,QAAQ,QAAQ,CAAC,GAAG,WAAW,OAAO,OAAO;AACxD;AAEO,SAAS,kBAAkB,WAAkC,YAA2B,QAAuB;AACpH,QAAM,SAAS,mBAAmB,SAAS;AAC3C,QAAM,EAAE,MAAM,OAAO,WAAW,OAAO,IAAI;AAAA,IACzC,cAAc,SAAS,mBAAmB,UAAU,IAAI,MAAM,KAAK;AAAA,IACnE,MAAM,OAAO,IAAI,kBAAkB,YAAa,MAAO;AAAA,IACvD,EAAE,mBAAmB,OAAO,oBAAoB,MAAM;AAAA,EACxD;AACA,SAAO,EAAE,aAAa,QAAQ,MAAM,WAAW,OAAO,OAAO;AAC/D;","names":[]}