@medialane/ui 0.168.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 (99) hide show
  1. package/dist/components/fast-mint/fast-mint.cjs +4 -4
  2. package/dist/components/fast-mint/fast-mint.cjs.map +1 -1
  3. package/dist/components/fast-mint/fast-mint.js +4 -4
  4. package/dist/components/fast-mint/fast-mint.js.map +1 -1
  5. package/dist/components/remixes-tab.cjs +2 -2
  6. package/dist/components/remixes-tab.cjs.map +1 -1
  7. package/dist/components/remixes-tab.d.cts +3 -3
  8. package/dist/components/remixes-tab.d.ts +3 -3
  9. package/dist/components/remixes-tab.js +2 -2
  10. package/dist/components/remixes-tab.js.map +1 -1
  11. package/dist/index.cjs +68 -5
  12. package/dist/index.cjs.map +1 -1
  13. package/dist/index.d.cts +8 -1
  14. package/dist/index.d.ts +8 -1
  15. package/dist/index.js +63 -3
  16. package/dist/index.js.map +1 -1
  17. package/dist/utils/ipfs-upload.cjs +11 -31
  18. package/dist/utils/ipfs-upload.cjs.map +1 -1
  19. package/dist/utils/ipfs-upload.d.cts +5 -5
  20. package/dist/utils/ipfs-upload.d.ts +5 -5
  21. package/dist/utils/ipfs-upload.js +11 -31
  22. package/dist/utils/ipfs-upload.js.map +1 -1
  23. package/dist/utils/sitemap-data.cjs +55 -0
  24. package/dist/utils/sitemap-data.cjs.map +1 -0
  25. package/dist/utils/sitemap-data.d.cts +23 -0
  26. package/dist/utils/sitemap-data.d.ts +23 -0
  27. package/dist/utils/sitemap-data.js +31 -0
  28. package/dist/utils/sitemap-data.js.map +1 -0
  29. package/dist/utils/use-coin-price.cjs +88 -0
  30. package/dist/utils/use-coin-price.cjs.map +1 -0
  31. package/dist/utils/use-coin-price.d.cts +17 -0
  32. package/dist/utils/use-coin-price.d.ts +17 -0
  33. package/dist/utils/use-coin-price.js +53 -0
  34. package/dist/utils/use-coin-price.js.map +1 -0
  35. package/dist/utils/use-collections.cjs +2 -2
  36. package/dist/utils/use-collections.cjs.map +1 -1
  37. package/dist/utils/use-collections.js +2 -2
  38. package/dist/utils/use-collections.js.map +1 -1
  39. package/dist/utils/use-drops.cjs +94 -0
  40. package/dist/utils/use-drops.cjs.map +1 -0
  41. package/dist/utils/use-drops.d.cts +39 -0
  42. package/dist/utils/use-drops.d.ts +39 -0
  43. package/dist/utils/use-drops.js +56 -0
  44. package/dist/utils/use-drops.js.map +1 -0
  45. package/dist/utils/use-notifications.cjs +2 -2
  46. package/dist/utils/use-notifications.cjs.map +1 -1
  47. package/dist/utils/use-notifications.d.cts +1 -2
  48. package/dist/utils/use-notifications.d.ts +1 -2
  49. package/dist/utils/use-notifications.js +2 -2
  50. package/dist/utils/use-notifications.js.map +1 -1
  51. package/dist/utils/use-orders.cjs +3 -3
  52. package/dist/utils/use-orders.cjs.map +1 -1
  53. package/dist/utils/use-orders.d.cts +1 -2
  54. package/dist/utils/use-orders.d.ts +1 -2
  55. package/dist/utils/use-orders.js +3 -3
  56. package/dist/utils/use-orders.js.map +1 -1
  57. package/dist/utils/use-platform-stats.cjs +50 -0
  58. package/dist/utils/use-platform-stats.cjs.map +1 -0
  59. package/dist/utils/use-platform-stats.d.cts +9 -0
  60. package/dist/utils/use-platform-stats.d.ts +9 -0
  61. package/dist/utils/use-platform-stats.js +16 -0
  62. package/dist/utils/use-platform-stats.js.map +1 -0
  63. package/dist/utils/use-pop.cjs +72 -0
  64. package/dist/utils/use-pop.cjs.map +1 -0
  65. package/dist/utils/use-pop.d.cts +28 -0
  66. package/dist/utils/use-pop.d.ts +28 -0
  67. package/dist/utils/use-pop.js +36 -0
  68. package/dist/utils/use-pop.js.map +1 -0
  69. package/dist/utils/use-remix-offers.cjs +5 -4
  70. package/dist/utils/use-remix-offers.cjs.map +1 -1
  71. package/dist/utils/use-remix-offers.d.cts +4 -9
  72. package/dist/utils/use-remix-offers.d.ts +4 -9
  73. package/dist/utils/use-remix-offers.js +5 -4
  74. package/dist/utils/use-remix-offers.js.map +1 -1
  75. package/dist/utils/use-sponsorship.cjs +131 -0
  76. package/dist/utils/use-sponsorship.cjs.map +1 -0
  77. package/dist/utils/use-sponsorship.d.cts +70 -0
  78. package/dist/utils/use-sponsorship.d.ts +70 -0
  79. package/dist/utils/use-sponsorship.js +90 -0
  80. package/dist/utils/use-sponsorship.js.map +1 -0
  81. package/dist/utils/use-tiers.cjs +137 -0
  82. package/dist/utils/use-tiers.cjs.map +1 -0
  83. package/dist/utils/use-tiers.d.cts +60 -0
  84. package/dist/utils/use-tiers.d.ts +60 -0
  85. package/dist/utils/use-tiers.js +95 -0
  86. package/dist/utils/use-tiers.js.map +1 -0
  87. package/dist/utils/use-tokens-by-ip-type.cjs +50 -0
  88. package/dist/utils/use-tokens-by-ip-type.cjs.map +1 -0
  89. package/dist/utils/use-tokens-by-ip-type.d.cts +14 -0
  90. package/dist/utils/use-tokens-by-ip-type.d.ts +14 -0
  91. package/dist/utils/use-tokens-by-ip-type.js +16 -0
  92. package/dist/utils/use-tokens-by-ip-type.js.map +1 -0
  93. package/package.json +3 -3
  94. package/dist/utils/api-fetch.cjs +0 -65
  95. package/dist/utils/api-fetch.cjs.map +0 -1
  96. package/dist/utils/api-fetch.d.cts +0 -17
  97. package/dist/utils/api-fetch.d.ts +0 -17
  98. package/dist/utils/api-fetch.js +0 -40
  99. package/dist/utils/api-fetch.js.map +0 -1
@@ -1,8 +1,7 @@
1
1
  import { MedialaneClient } from '@medialane/sdk/starknet';
2
2
  import { Notification } from '../data/notification.cjs';
3
- import { ApiFetchConfig } from './api-fetch.cjs';
4
3
 
5
- declare function useNotifications(getClient: () => MedialaneClient, apiConfig: ApiFetchConfig, address: string | null | undefined): {
4
+ declare function useNotifications(getClient: () => MedialaneClient, address: string | null | undefined): {
6
5
  notifications: Notification[];
7
6
  unreadCount: number;
8
7
  isLoading: boolean;
@@ -1,8 +1,7 @@
1
1
  import { MedialaneClient } from '@medialane/sdk/starknet';
2
2
  import { Notification } from '../data/notification.js';
3
- import { ApiFetchConfig } from './api-fetch.js';
4
3
 
5
- declare function useNotifications(getClient: () => MedialaneClient, apiConfig: ApiFetchConfig, address: string | null | undefined): {
4
+ declare function useNotifications(getClient: () => MedialaneClient, address: string | null | undefined): {
6
5
  notifications: Notification[];
7
6
  unreadCount: number;
8
7
  isLoading: boolean;
@@ -17,13 +17,13 @@ async function fetchAnnouncements() {
17
17
  if (!res.ok) return [];
18
18
  return res.json();
19
19
  }
20
- function useNotifications(getClient, apiConfig, address) {
20
+ function useNotifications(getClient, address) {
21
21
  const [readIds, setReadIds] = useState(() => /* @__PURE__ */ new Set());
22
22
  useEffect(() => {
23
23
  setReadIds(getReadIds());
24
24
  }, []);
25
25
  const { orders: userOrders, isLoading: ordersLoading } = useUserOrders(getClient, address ?? null);
26
- const { orders: receivedOffers, isLoading: receivedLoading } = useReceivedOffers(apiConfig, address ?? null);
26
+ const { orders: receivedOffers, isLoading: receivedLoading } = useReceivedOffers(getClient, address ?? null);
27
27
  const { activities, isLoading: activitiesLoading } = useActivitiesByAddress(getClient, address ?? null);
28
28
  const { data: announcements = [] } = useSWR(
29
29
  "announcements",
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/utils/use-notifications.ts"],"sourcesContent":["\"use client\";\n\nimport { useCallback, useEffect, useMemo, useState } from \"react\";\nimport useSWR from \"swr\";\nimport { normalizeAddress } from \"@medialane/sdk\";\nimport type { ApiActivity } from \"@medialane/sdk\";\nimport type { MedialaneClient } from \"@medialane/sdk/starknet\";\nimport { useUserOrders, useReceivedOffers } from \"./use-orders.js\";\nimport { useActivitiesByAddress } from \"./use-activities.js\";\nimport { getReadIds, markRead } from \"./notification-storage.js\";\nimport { notificationsAreLoading } from \"./notification-readiness.js\";\nimport {\n formatActivity,\n formatOrderNotification,\n formatOfferAcceptedNotification,\n formatAssetReceivedNotification,\n} from \"./format-activity.js\";\nimport type { Notification, Announcement } from \"../data/notification.js\";\nimport type { ApiFetchConfig } from \"./api-fetch.js\";\n\nasync function fetchAnnouncements(): Promise<Announcement[]> {\n const res = await fetch(\"/api/announcements\");\n if (!res.ok) return [];\n return res.json();\n}\n\nexport function useNotifications(\n getClient: () => MedialaneClient,\n apiConfig: ApiFetchConfig,\n address: string | null | undefined\n) {\n const [readIds, setReadIds] = useState<Set<string>>(() => new Set<string>());\n\n useEffect(() => {\n setReadIds(getReadIds());\n }, []);\n\n const { orders: userOrders, isLoading: ordersLoading } = useUserOrders(getClient, address ?? null);\n\n const { orders: receivedOffers, isLoading: receivedLoading } = useReceivedOffers(apiConfig, address ?? null);\n const { activities, isLoading: activitiesLoading } = useActivitiesByAddress(getClient, address ?? null);\n const { data: announcements = [] } = useSWR<Announcement[]>(\n \"announcements\",\n fetchAnnouncements,\n { revalidateOnFocus: false, dedupingInterval: 60_000 }\n );\n\n const notifications: Notification[] = useMemo(() => {\n const items: Notification[] = [];\n\n userOrders\n .filter((o) => o.offer.itemType === \"ERC20\" && o.status === \"FULFILLED\")\n .forEach((order) => {\n const id = `offer-accepted-${order.orderHash}`;\n const fmt = formatOfferAcceptedNotification(order);\n items.push({\n id,\n type: \"offer_accepted\",\n priority: \"spotlight\",\n celebratory: true,\n ...fmt,\n timestamp: order.updatedAt ?? order.createdAt ?? new Date().toISOString(),\n isUnread: !readIds.has(id),\n metadata: {\n amount: order.price?.formatted ?? undefined,\n currency: order.price?.currency ?? undefined,\n txHash: order.txHash?.fulfilled ?? undefined,\n assetName: order.token?.name ?? undefined,\n },\n });\n });\n\n receivedOffers.forEach((order) => {\n const id = `order-${order.orderHash}`;\n const fmt = formatOrderNotification(order);\n items.push({\n id,\n type: \"offer\",\n priority: \"spotlight\",\n celebratory: false,\n ...fmt,\n timestamp: order.createdAt ?? new Date().toISOString(),\n isUnread: !readIds.has(id),\n metadata: {\n amount: order.price?.formatted ?? undefined,\n currency: order.price?.currency ?? undefined,\n assetName: order.token?.name ?? undefined,\n },\n });\n });\n\n (activities as ApiActivity[]).slice(0, 50).forEach((event) => {\n const id = `activity-${event.txHash}-${event.type}-${event.nftTokenId ?? \"\"}`;\n\n if (\n event.type === \"transfer\" &&\n address &&\n !!event.to && normalizeAddress(\"STARKNET\", event.to) === normalizeAddress(\"STARKNET\", address)\n ) {\n const fmt = formatAssetReceivedNotification(event);\n items.push({\n id,\n type: \"asset_received\",\n priority: \"spotlight\",\n celebratory: true,\n ...fmt,\n timestamp: event.timestamp ?? new Date().toISOString(),\n isUnread: !readIds.has(id),\n metadata: {\n txHash: event.txHash ?? undefined,\n assetName: event.token?.name ?? undefined,\n },\n });\n return;\n }\n\n const isMySale =\n event.type === \"sale\" &&\n address &&\n ((!!event.offerer && normalizeAddress(\"STARKNET\", event.offerer) === normalizeAddress(\"STARKNET\", address)) ||\n (!!event.from && normalizeAddress(\"STARKNET\", event.from) === normalizeAddress(\"STARKNET\", address)));\n\n const fmt = formatActivity(event);\n items.push({\n id,\n type: event.type as Notification[\"type\"],\n priority: isMySale ? \"spotlight\" : \"normal\",\n celebratory: !!isMySale,\n ...fmt,\n timestamp: event.timestamp ?? new Date().toISOString(),\n isUnread: !readIds.has(id),\n metadata: {\n amount: event.price?.formatted ?? undefined,\n currency: event.price?.currency ?? undefined,\n txHash: event.txHash ?? undefined,\n assetName: event.token?.name ?? undefined,\n },\n });\n });\n\n announcements.forEach((ann) => {\n const id = `ann-${ann.id}`;\n items.push({\n id,\n type: \"announcement\",\n priority: ann.pinned ? \"spotlight\" : \"normal\",\n celebratory: false,\n title: ann.title,\n description: ann.body,\n image: ann.image,\n href: ann.href,\n timestamp: ann.created_at,\n isUnread: !readIds.has(id),\n });\n });\n\n items.sort(\n (a, b) => new Date(b.timestamp).getTime() - new Date(a.timestamp).getTime()\n );\n\n return items;\n }, [userOrders, receivedOffers, activities, announcements, address, readIds]);\n\n const unreadCount = notifications.filter((n) => n.isUnread).length;\n\n const markNotificationsRead = useCallback((ids: string[]) => {\n markRead(ids);\n setReadIds(getReadIds());\n }, []);\n\n const isLoading = notificationsAreLoading({\n ordersLoading,\n receivedLoading,\n activitiesLoading,\n hasAddress: !!address,\n });\n\n return {\n notifications,\n unreadCount,\n isLoading,\n markAllRead: () => markNotificationsRead(notifications.map((n) => n.id)),\n markRead: (id: string) => markNotificationsRead([id]),\n };\n}\n"],"mappings":";AAEA,SAAS,aAAa,WAAW,SAAS,gBAAgB;AAC1D,OAAO,YAAY;AACnB,SAAS,wBAAwB;AAGjC,SAAS,eAAe,yBAAyB;AACjD,SAAS,8BAA8B;AACvC,SAAS,YAAY,gBAAgB;AACrC,SAAS,+BAA+B;AACxC;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAIP,eAAe,qBAA8C;AAC3D,QAAM,MAAM,MAAM,MAAM,oBAAoB;AAC5C,MAAI,CAAC,IAAI,GAAI,QAAO,CAAC;AACrB,SAAO,IAAI,KAAK;AAClB;AAEO,SAAS,iBACd,WACA,WACA,SACA;AACA,QAAM,CAAC,SAAS,UAAU,IAAI,SAAsB,MAAM,oBAAI,IAAY,CAAC;AAE3E,YAAU,MAAM;AACd,eAAW,WAAW,CAAC;AAAA,EACzB,GAAG,CAAC,CAAC;AAEL,QAAM,EAAE,QAAQ,YAAY,WAAW,cAAc,IAAI,cAAc,WAAW,WAAW,IAAI;AAEjG,QAAM,EAAE,QAAQ,gBAAgB,WAAW,gBAAgB,IAAI,kBAAkB,WAAW,WAAW,IAAI;AAC3G,QAAM,EAAE,YAAY,WAAW,kBAAkB,IAAI,uBAAuB,WAAW,WAAW,IAAI;AACtG,QAAM,EAAE,MAAM,gBAAgB,CAAC,EAAE,IAAI;AAAA,IACnC;AAAA,IACA;AAAA,IACA,EAAE,mBAAmB,OAAO,kBAAkB,IAAO;AAAA,EACvD;AAEA,QAAM,gBAAgC,QAAQ,MAAM;AAClD,UAAM,QAAwB,CAAC;AAE/B,eACG,OAAO,CAAC,MAAM,EAAE,MAAM,aAAa,WAAW,EAAE,WAAW,WAAW,EACtE,QAAQ,CAAC,UAAU;AAClB,YAAM,KAAK,kBAAkB,MAAM,SAAS;AA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ACV,WAAW,IAAI;AAAA,QACf,UAAU,CAAC,QAAQ,IAAI,EAAE;AAAA,MAC3B,CAAC;AAAA,IACH,CAAC;AAED,UAAM;AAAA,MACJ,CAAC,GAAG,MAAM,IAAI,KAAK,EAAE,SAAS,EAAE,QAAQ,IAAI,IAAI,KAAK,EAAE,SAAS,EAAE,QAAQ;AAAA,IAC5E;AAEA,WAAO;AAAA,EACT,GAAG,CAAC,YAAY,gBAAgB,YAAY,eAAe,SAAS,OAAO,CAAC;AAE5E,QAAM,cAAc,cAAc,OAAO,CAAC,MAAM,EAAE,QAAQ,EAAE;AAE5D,QAAM,wBAAwB,YAAY,CAAC,QAAkB;AAC3D,aAAS,GAAG;AACZ,eAAW,WAAW,CAAC;AAAA,EACzB,GAAG,CAAC,CAAC;AAEL,QAAM,YAAY,wBAAwB;AAAA,IACxC;AAAA,IACA;AAAA,IACA;AAAA,IACA,YAAY,CAAC,CAAC;AAAA,EAChB,CAAC;AAED,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA,aAAa,MAAM,sBAAsB,cAAc,IAAI,CAAC,MAAM,EAAE,EAAE,CAAC;AAAA,IACvE,UAAU,CAAC,OAAe,sBAAsB,CAAC,EAAE,CAAC;AAAA,EACtD;AACF;","names":["fmt"]}
1
+ {"version":3,"sources":["../../src/utils/use-notifications.ts"],"sourcesContent":["\"use client\";\n\nimport { useCallback, useEffect, useMemo, useState } from \"react\";\nimport useSWR from \"swr\";\nimport { normalizeAddress } from \"@medialane/sdk\";\nimport type { ApiActivity } from \"@medialane/sdk\";\nimport type { MedialaneClient } from \"@medialane/sdk/starknet\";\nimport { useUserOrders, useReceivedOffers } from \"./use-orders.js\";\nimport { useActivitiesByAddress } from \"./use-activities.js\";\nimport { getReadIds, markRead } from \"./notification-storage.js\";\nimport { notificationsAreLoading } from \"./notification-readiness.js\";\nimport {\n formatActivity,\n formatOrderNotification,\n formatOfferAcceptedNotification,\n formatAssetReceivedNotification,\n} from \"./format-activity.js\";\nimport type { Notification, Announcement } from \"../data/notification.js\";\n\nasync function fetchAnnouncements(): Promise<Announcement[]> {\n const res = await fetch(\"/api/announcements\");\n if (!res.ok) return [];\n return res.json();\n}\n\nexport function useNotifications(\n getClient: () => MedialaneClient,\n address: string | null | undefined\n) {\n const [readIds, setReadIds] = useState<Set<string>>(() => new Set<string>());\n\n useEffect(() => {\n setReadIds(getReadIds());\n }, []);\n\n const { orders: userOrders, isLoading: ordersLoading } = useUserOrders(getClient, address ?? null);\n\n const { orders: receivedOffers, isLoading: receivedLoading } = useReceivedOffers(getClient, address ?? null);\n const { activities, isLoading: activitiesLoading } = useActivitiesByAddress(getClient, address ?? null);\n const { data: announcements = [] } = useSWR<Announcement[]>(\n \"announcements\",\n fetchAnnouncements,\n { revalidateOnFocus: false, dedupingInterval: 60_000 }\n );\n\n const notifications: Notification[] = useMemo(() => {\n const items: Notification[] = [];\n\n userOrders\n .filter((o) => o.offer.itemType === \"ERC20\" && o.status === \"FULFILLED\")\n .forEach((order) => {\n const id = `offer-accepted-${order.orderHash}`;\n const fmt = formatOfferAcceptedNotification(order);\n items.push({\n id,\n type: \"offer_accepted\",\n priority: \"spotlight\",\n celebratory: true,\n ...fmt,\n timestamp: order.updatedAt ?? order.createdAt ?? new Date().toISOString(),\n isUnread: !readIds.has(id),\n metadata: {\n amount: order.price?.formatted ?? undefined,\n currency: order.price?.currency ?? undefined,\n txHash: order.txHash?.fulfilled ?? undefined,\n assetName: order.token?.name ?? undefined,\n },\n });\n });\n\n receivedOffers.forEach((order) => {\n const id = `order-${order.orderHash}`;\n const fmt = formatOrderNotification(order);\n items.push({\n id,\n type: \"offer\",\n priority: \"spotlight\",\n celebratory: false,\n ...fmt,\n timestamp: order.createdAt ?? new Date().toISOString(),\n isUnread: !readIds.has(id),\n metadata: {\n amount: order.price?.formatted ?? undefined,\n currency: order.price?.currency ?? undefined,\n assetName: order.token?.name ?? undefined,\n },\n });\n });\n\n (activities as ApiActivity[]).slice(0, 50).forEach((event) => {\n const id = `activity-${event.txHash}-${event.type}-${event.nftTokenId ?? \"\"}`;\n\n if (\n event.type === \"transfer\" &&\n address &&\n !!event.to && normalizeAddress(\"STARKNET\", event.to) === normalizeAddress(\"STARKNET\", address)\n ) {\n const fmt = formatAssetReceivedNotification(event);\n items.push({\n id,\n type: \"asset_received\",\n priority: \"spotlight\",\n celebratory: true,\n ...fmt,\n timestamp: event.timestamp ?? new Date().toISOString(),\n isUnread: !readIds.has(id),\n metadata: {\n txHash: event.txHash ?? undefined,\n assetName: event.token?.name ?? undefined,\n },\n });\n return;\n }\n\n const isMySale =\n event.type === \"sale\" &&\n address &&\n ((!!event.offerer && normalizeAddress(\"STARKNET\", event.offerer) === normalizeAddress(\"STARKNET\", address)) ||\n (!!event.from && normalizeAddress(\"STARKNET\", event.from) === normalizeAddress(\"STARKNET\", address)));\n\n const fmt = formatActivity(event);\n items.push({\n id,\n type: event.type as Notification[\"type\"],\n priority: isMySale ? \"spotlight\" : \"normal\",\n celebratory: !!isMySale,\n ...fmt,\n timestamp: event.timestamp ?? new Date().toISOString(),\n isUnread: !readIds.has(id),\n metadata: {\n amount: event.price?.formatted ?? undefined,\n currency: event.price?.currency ?? undefined,\n txHash: event.txHash ?? undefined,\n assetName: event.token?.name ?? undefined,\n },\n });\n });\n\n announcements.forEach((ann) => {\n const id = `ann-${ann.id}`;\n items.push({\n id,\n type: \"announcement\",\n priority: ann.pinned ? \"spotlight\" : \"normal\",\n celebratory: false,\n title: ann.title,\n description: ann.body,\n image: ann.image,\n href: ann.href,\n timestamp: ann.created_at,\n isUnread: !readIds.has(id),\n });\n });\n\n items.sort(\n (a, b) => new Date(b.timestamp).getTime() - new Date(a.timestamp).getTime()\n );\n\n return items;\n }, [userOrders, receivedOffers, activities, announcements, address, readIds]);\n\n const unreadCount = notifications.filter((n) => n.isUnread).length;\n\n const markNotificationsRead = useCallback((ids: string[]) => {\n markRead(ids);\n setReadIds(getReadIds());\n }, []);\n\n const isLoading = notificationsAreLoading({\n ordersLoading,\n receivedLoading,\n activitiesLoading,\n hasAddress: !!address,\n });\n\n return {\n notifications,\n unreadCount,\n isLoading,\n markAllRead: () => markNotificationsRead(notifications.map((n) => n.id)),\n markRead: (id: string) => markNotificationsRead([id]),\n };\n}\n"],"mappings":";AAEA,SAAS,aAAa,WAAW,SAAS,gBAAgB;AAC1D,OAAO,YAAY;AACnB,SAAS,wBAAwB;AAGjC,SAAS,eAAe,yBAAyB;AACjD,SAAS,8BAA8B;AACvC,SAAS,YAAY,gBAAgB;AACrC,SAAS,+BAA+B;AACxC;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAGP,eAAe,qBAA8C;AAC3D,QAAM,MAAM,MAAM,MAAM,oBAAoB;AAC5C,MAAI,CAAC,IAAI,GAAI,QAAO,CAAC;AACrB,SAAO,IAAI,KAAK;AAClB;AAEO,SAAS,iBACd,WACA,SACA;AACA,QAAM,CAAC,SAAS,UAAU,IAAI,SAAsB,MAAM,oBAAI,IAAY,CAAC;AAE3E,YAAU,MAAM;AACd,eAAW,WAAW,CAAC;AAAA,EACzB,GAAG,CAAC,CAAC;AAEL,QAAM,EAAE,QAAQ,YAAY,WAAW,cAAc,IAAI,cAAc,WAAW,WAAW,IAAI;AAEjG,QAAM,EAAE,QAAQ,gBAAgB,WAAW,gBAAgB,IAAI,kBAAkB,WAAW,WAAW,IAAI;AAC3G,QAAM,EAAE,YAAY,WAAW,kBAAkB,IAAI,uBAAuB,WAAW,WAAW,IAAI;AACtG,QAAM,EAAE,MAAM,gBAAgB,CAAC,EAAE,IAAI;AAAA,IACnC;AAAA,IACA;AAAA,IACA,EAAE,mBAAmB,OAAO,kBAAkB,IAAO;AAAA,EACvD;AAEA,QAAM,gBAAgC,QAAQ,MAAM;AAClD,UAAM,QAAwB,CAAC;AAE/B,eACG,OAAO,CAAC,MAAM,EAAE,MAAM,aAAa,WAAW,EAAE,WAAW,WAAW,EACtE,QAAQ,CAAC,UAAU;AAClB,YAAM,K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AA,QACX,MAAM,IAAI;AAAA,QACV,WAAW,IAAI;AAAA,QACf,UAAU,CAAC,QAAQ,IAAI,EAAE;AAAA,MAC3B,CAAC;AAAA,IACH,CAAC;AAED,UAAM;AAAA,MACJ,CAAC,GAAG,MAAM,IAAI,KAAK,EAAE,SAAS,EAAE,QAAQ,IAAI,IAAI,KAAK,EAAE,SAAS,EAAE,QAAQ;AAAA,IAC5E;AAEA,WAAO;AAAA,EACT,GAAG,CAAC,YAAY,gBAAgB,YAAY,eAAe,SAAS,OAAO,CAAC;AAE5E,QAAM,cAAc,cAAc,OAAO,CAAC,MAAM,EAAE,QAAQ,EAAE;AAE5D,QAAM,wBAAwB,YAAY,CAAC,QAAkB;AAC3D,aAAS,GAAG;AACZ,eAAW,WAAW,CAAC;AAAA,EACzB,GAAG,CAAC,CAAC;AAEL,QAAM,YAAY,wBAAwB;AAAA,IACxC;AAAA,IACA;AAAA,IACA;AAAA,IACA,YAAY,CAAC,CAAC;AAAA,EAChB,CAAC;AAED,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA,aAAa,MAAM,sBAAsB,cAAc,IAAI,CAAC,MAAM,EAAE,EAAE,CAAC;AAAA,IACvE,UAAU,CAAC,OAAe,sBAAsB,CAAC,EAAE,CAAC;AAAA,EACtD;AACF;","names":["fmt"]}
@@ -42,7 +42,6 @@ var import_swr = __toESM(require("swr"), 1);
42
42
  var import_sdk = require("@medialane/sdk");
43
43
  var import_use_medialane_client = require("./use-medialane-client.js");
44
44
  var import_query_keys = require("./query-keys.js");
45
- var import_api_fetch = require("./api-fetch.js");
46
45
  const ACTIVE_ORDER_REFRESH_INTERVAL = 6e4;
47
46
  const ACTIVE_ORDER_DEDUPING_INTERVAL = 1e4;
48
47
  function useOrders(getClient, query = {}) {
@@ -112,11 +111,12 @@ function useCounterOffers(getClient, {
112
111
  mutate
113
112
  };
114
113
  }
115
- function useReceivedOffers(apiConfig, address) {
114
+ function useReceivedOffers(getClient, address) {
115
+ const client = (0, import_use_medialane_client.useMedialaneClient)(getClient);
116
116
  const normalized = address ? (0, import_sdk.normalizeAddress)("STARKNET", address) : null;
117
117
  const { data, error, isLoading, mutate } = (0, import_swr.default)(
118
118
  normalized ? ["received-offers", normalized] : null,
119
- () => (0, import_api_fetch.apiFetch)(apiConfig, `/v1/orders/received/${normalized}?limit=50`),
119
+ () => client.api.getReceivedOffers(normalized, { limit: 50 }),
120
120
  { revalidateOnFocus: false, refreshInterval: ACTIVE_ORDER_REFRESH_INTERVAL, dedupingInterval: ACTIVE_ORDER_DEDUPING_INTERVAL }
121
121
  );
122
122
  return { orders: data?.data ?? [], isLoading, error, mutate };
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/utils/use-orders.ts"],"sourcesContent":["\"use client\";\n\nimport useSWR from \"swr\";\nimport { normalizeAddress } from \"@medialane/sdk\";\nimport type { MedialaneClient } from \"@medialane/sdk/starknet\";\nimport type { ApiOrdersQuery, ApiOrder, ApiResponse } from \"@medialane/sdk\";\nimport { useMedialaneClient } from \"./use-medialane-client.js\";\nimport { queryKeys } from \"./query-keys.js\";\nimport { apiFetch, type ApiFetchConfig } from \"./api-fetch.js\";\n\nconst ACTIVE_ORDER_REFRESH_INTERVAL = 60_000;\nconst ACTIVE_ORDER_DEDUPING_INTERVAL = 10_000;\n\nexport function useOrders(getClient: () => MedialaneClient, query: ApiOrdersQuery = {}) {\n const client = useMedialaneClient(getClient);\n const key = queryKeys.orders(query);\n\n const { data, error, isLoading, mutate } = useSWR<ApiResponse<ApiOrder[]>>(\n key,\n () => client.api.getOrders(query),\n { revalidateOnFocus: false, refreshInterval: 30000, dedupingInterval: 5000 }\n );\n\n return {\n orders: data?.data ?? [],\n meta: data?.meta,\n isLoading,\n error,\n mutate,\n };\n}\n\nexport function useOrder(getClient: () => MedialaneClient, orderHash: string | null) {\n const client = useMedialaneClient(getClient);\n\n const { data, error, isLoading } = useSWR(\n orderHash ? queryKeys.order(orderHash) : null,\n () => client.api.getOrder(orderHash!),\n { revalidateOnFocus: false }\n );\n\n return { order: data?.data ?? null, isLoading, error };\n}\n\nexport function useTokenListings(getClient: () => MedialaneClient, contract: string | null, tokenId: string | null) {\n const client = useMedialaneClient(getClient);\n\n const { data, error, isLoading, mutate } = useSWR(\n contract && tokenId ? queryKeys.listings(contract, tokenId) : null,\n () => client.api.getActiveOrdersForToken(contract!, tokenId!),\n { revalidateOnFocus: false, refreshInterval: ACTIVE_ORDER_REFRESH_INTERVAL, dedupingInterval: ACTIVE_ORDER_DEDUPING_INTERVAL }\n );\n\n return { listings: data?.data ?? [], isLoading, error, mutate };\n}\n\nexport function useUserOrders(getClient: () => MedialaneClient, address: string | null) {\n const client = useMedialaneClient(getClient);\n const normalized = address ? normalizeAddress(\"STARKNET\", address) : null;\n\n const { data, error, isLoading, mutate } = useSWR(\n normalized ? queryKeys.userOrders(normalized) : null,\n () => client.api.getOrdersByUser(normalized!),\n { revalidateOnFocus: false, refreshInterval: ACTIVE_ORDER_REFRESH_INTERVAL, dedupingInterval: ACTIVE_ORDER_DEDUPING_INTERVAL }\n );\n\n return { orders: data?.data ?? [], isLoading, error, mutate };\n}\n\nexport function useCounterOffers(\n getClient: () => MedialaneClient,\n {\n originalOrderHash,\n sellerAddress,\n }: {\n originalOrderHash?: string | null;\n sellerAddress?: string | null;\n }\n) {\n const client = useMedialaneClient(getClient);\n const normalized = sellerAddress ? normalizeAddress(\"STARKNET\", sellerAddress) : null;\n const key =\n originalOrderHash\n ? queryKeys.counterOffersByOrder(originalOrderHash)\n : normalized\n ? queryKeys.counterOffersBySeller(normalized)\n : null;\n\n const { data, error, isLoading, mutate } = useSWR<ApiResponse<ApiOrder[]>>(\n key,\n () => client.api.getCounterOffers({\n ...(originalOrderHash ? { originalOrderHash } : {}),\n ...(normalized ? { sellerAddress: normalized } : {}),\n }),\n { revalidateOnFocus: false, refreshInterval: ACTIVE_ORDER_REFRESH_INTERVAL, dedupingInterval: ACTIVE_ORDER_DEDUPING_INTERVAL }\n );\n\n return {\n counterOffers: data?.data ?? [],\n total: data?.meta?.total ?? 0,\n isLoading,\n error,\n mutate,\n };\n}\n\nexport function useReceivedOffers(apiConfig: ApiFetchConfig, address: string | null) {\n const normalized = address ? normalizeAddress(\"STARKNET\", address) : null;\n\n const { data, error, isLoading, mutate } = useSWR<ApiResponse<ApiOrder[]>>(\n normalized ? [\"received-offers\", normalized] : null,\n () => apiFetch<ApiResponse<ApiOrder[]>>(apiConfig, `/v1/orders/received/${normalized}?limit=50`),\n { revalidateOnFocus: false, refreshInterval: ACTIVE_ORDER_REFRESH_INTERVAL, dedupingInterval: ACTIVE_ORDER_DEDUPING_INTERVAL }\n );\n\n return { orders: data?.data ?? [], isLoading, error, mutate };\n}\n\nexport function useCollectionFloorListings(getClient: () => MedialaneClient, contract: string | null, limit = 20) {\n const client = useMedialaneClient(getClient);\n const key = contract ? queryKeys.floorListings(contract, limit) : null;\n\n const { data, error, isLoading } = useSWR<ApiResponse<ApiOrder[]>>(\n key,\n () =>\n client.api.getOrders({\n collection: contract!,\n status: \"ACTIVE\",\n sort: \"price_asc\",\n limit,\n }),\n { revalidateOnFocus: false, refreshInterval: ACTIVE_ORDER_REFRESH_INTERVAL }\n );\n\n return {\n listings: data?.data ?? [],\n isLoading,\n error,\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,iBAAmB;AACnB,iBAAiC;AAGjC,kCAAmC;AACnC,wBAA0B;AAC1B,uBAA8C;AAE9C,MAAM,gCAAgC;AACtC,MAAM,iCAAiC;AAEhC,SAAS,UAAU,WAAkC,QAAwB,CAAC,GAAG;AACtF,QAAM,aAAS,gDAAmB,SAAS;AAC3C,QAAM,MAAM,4BAAU,OAAO,KAAK;AAElC,QAAM,EAAE,MAAM,OAAO,WAAW,OAAO,QAAI,WAAAA;AAAA,IACzC;AAAA,IACA,MAAM,OAAO,IAAI,UAAU,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SAAS;AAC3C,QAAM,MAAM,WAAW,4BAAU,cAAc,UAAU,KAAK,IAAI;AAElE,QAAM,EAAE,MAAM,OAAO,UAAU,QAAI,WAAAA;AAAA,IACjC;AAAA,IACA,MACE,OAAO,IAAI,UAAU;AAAA,MACnB,YAAY;AAAA,MACZ,QAAQ;AAAA,MACR,MAAM;AAAA,MACN;AAAA,IACF,CAAC;AAAA,IACH,EAAE,mBAAmB,OAAO,iBAAiB,8BAA8B;AAAA,EAC7E;AAEA,SAAO;AAAA,IACL,UAAU,MAAM,QAAQ,CAAC;AAAA,IACzB;AAAA,IACA;AAAA,EACF;AACF;","names":["useSWR"]}
1
+ {"version":3,"sources":["../../src/utils/use-orders.ts"],"sourcesContent":["\"use client\";\n\nimport useSWR from \"swr\";\nimport { normalizeAddress } from \"@medialane/sdk\";\nimport type { MedialaneClient } from \"@medialane/sdk/starknet\";\nimport type { ApiOrdersQuery, ApiOrder, ApiResponse } from \"@medialane/sdk\";\nimport { useMedialaneClient } from \"./use-medialane-client.js\";\nimport { queryKeys } from \"./query-keys.js\";\n\nconst ACTIVE_ORDER_REFRESH_INTERVAL = 60_000;\nconst ACTIVE_ORDER_DEDUPING_INTERVAL = 10_000;\n\nexport function useOrders(getClient: () => MedialaneClient, query: ApiOrdersQuery = {}) {\n const client = useMedialaneClient(getClient);\n const key = queryKeys.orders(query);\n\n const { data, error, isLoading, mutate } = useSWR<ApiResponse<ApiOrder[]>>(\n key,\n () => client.api.getOrders(query),\n { revalidateOnFocus: false, refreshInterval: 30000, dedupingInterval: 5000 }\n );\n\n return {\n orders: data?.data ?? [],\n meta: data?.meta,\n isLoading,\n error,\n mutate,\n };\n}\n\nexport function useOrder(getClient: () => MedialaneClient, orderHash: string | null) {\n const client = useMedialaneClient(getClient);\n\n const { data, error, isLoading } = useSWR(\n orderHash ? queryKeys.order(orderHash) : null,\n () => client.api.getOrder(orderHash!),\n { revalidateOnFocus: false }\n );\n\n return { order: data?.data ?? null, isLoading, error };\n}\n\nexport function useTokenListings(getClient: () => MedialaneClient, contract: string | null, tokenId: string | null) {\n const client = useMedialaneClient(getClient);\n\n const { data, error, isLoading, mutate } = useSWR(\n contract && tokenId ? queryKeys.listings(contract, tokenId) : null,\n () => client.api.getActiveOrdersForToken(contract!, tokenId!),\n { revalidateOnFocus: false, refreshInterval: ACTIVE_ORDER_REFRESH_INTERVAL, dedupingInterval: ACTIVE_ORDER_DEDUPING_INTERVAL }\n );\n\n return { listings: data?.data ?? [], isLoading, error, mutate };\n}\n\nexport function useUserOrders(getClient: () => MedialaneClient, address: string | null) {\n const client = useMedialaneClient(getClient);\n const normalized = address ? normalizeAddress(\"STARKNET\", address) : null;\n\n const { data, error, isLoading, mutate } = useSWR(\n normalized ? queryKeys.userOrders(normalized) : null,\n () => client.api.getOrdersByUser(normalized!),\n { revalidateOnFocus: false, refreshInterval: ACTIVE_ORDER_REFRESH_INTERVAL, dedupingInterval: ACTIVE_ORDER_DEDUPING_INTERVAL }\n );\n\n return { orders: data?.data ?? [], isLoading, error, mutate };\n}\n\nexport function useCounterOffers(\n getClient: () => MedialaneClient,\n {\n originalOrderHash,\n sellerAddress,\n }: {\n originalOrderHash?: string | null;\n sellerAddress?: string | null;\n }\n) {\n const client = useMedialaneClient(getClient);\n const normalized = sellerAddress ? normalizeAddress(\"STARKNET\", sellerAddress) : null;\n const key =\n originalOrderHash\n ? queryKeys.counterOffersByOrder(originalOrderHash)\n : normalized\n ? queryKeys.counterOffersBySeller(normalized)\n : null;\n\n const { data, error, isLoading, mutate } = useSWR<ApiResponse<ApiOrder[]>>(\n key,\n () => client.api.getCounterOffers({\n ...(originalOrderHash ? { originalOrderHash } : {}),\n ...(normalized ? { sellerAddress: normalized } : {}),\n }),\n { revalidateOnFocus: false, refreshInterval: ACTIVE_ORDER_REFRESH_INTERVAL, dedupingInterval: ACTIVE_ORDER_DEDUPING_INTERVAL }\n );\n\n return {\n counterOffers: data?.data ?? [],\n total: data?.meta?.total ?? 0,\n isLoading,\n error,\n mutate,\n };\n}\n\nexport function useReceivedOffers(getClient: () => MedialaneClient, address: string | null) {\n const client = useMedialaneClient(getClient);\n const normalized = address ? normalizeAddress(\"STARKNET\", address) : null;\n\n const { data, error, isLoading, mutate } = useSWR<ApiResponse<ApiOrder[]>>(\n normalized ? [\"received-offers\", normalized] : null,\n () => client.api.getReceivedOffers(normalized!, { limit: 50 }),\n { revalidateOnFocus: false, refreshInterval: ACTIVE_ORDER_REFRESH_INTERVAL, dedupingInterval: ACTIVE_ORDER_DEDUPING_INTERVAL }\n );\n\n return { orders: data?.data ?? [], isLoading, error, mutate };\n}\n\nexport function useCollectionFloorListings(getClient: () => MedialaneClient, contract: string | null, limit = 20) {\n const client = useMedialaneClient(getClient);\n const key = contract ? queryKeys.floorListings(contract, limit) : null;\n\n const { data, error, isLoading } = useSWR<ApiResponse<ApiOrder[]>>(\n key,\n () =>\n client.api.getOrders({\n collection: contract!,\n status: \"ACTIVE\",\n sort: \"price_asc\",\n limit,\n }),\n { revalidateOnFocus: false, refreshInterval: ACTIVE_ORDER_REFRESH_INTERVAL }\n );\n\n return {\n listings: data?.data ?? [],\n isLoading,\n error,\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,iBAAmB;AACnB,iBAAiC;AAGjC,kCAAmC;AACnC,wBAA0B;AAE1B,MAAM,gCAAgC;AACtC,MAAM,iCAAiC;AAEhC,SAAS,UAAU,WAAkC,QAAwB,CAAC,GAAG;AACtF,QAAM,aAAS,gDAAmB,SAAS;AAC3C,QAAM,MAAM,4BAAU,OAAO,KAAK;AAElC,QAAM,EAAE,MAAM,OAAO,WAAW,OAAO,QAAI,WAAAA;AAAA,IACzC;AAAA,IACA,MAAM,OAAO,IAAI,UAAU,KAAK;AAAA,IAChC,EAAE,mBAAmB,OAAO,iBAAiB,KAAO,kBAAkB,IAAK;AAAA,EAC7E;AAEA,S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,cAAc,UAAU,KAAK,IAAI;AAElE,QAAM,EAAE,MAAM,OAAO,UAAU,QAAI,WAAAA;AAAA,IACjC;AAAA,IACA,MACE,OAAO,IAAI,UAAU;AAAA,MACnB,YAAY;AAAA,MACZ,QAAQ;AAAA,MACR,MAAM;AAAA,MACN;AAAA,IACF,CAAC;AAAA,IACH,EAAE,mBAAmB,OAAO,iBAAiB,8BAA8B;AAAA,EAC7E;AAEA,SAAO;AAAA,IACL,UAAU,MAAM,QAAQ,CAAC;AAAA,IACzB;AAAA,IACA;AAAA,EACF;AACF;","names":["useSWR"]}
@@ -2,7 +2,6 @@ import * as swr from 'swr';
2
2
  import * as _medialane_sdk from '@medialane/sdk';
3
3
  import { ApiOrder, ApiResponse, ApiOrdersQuery } from '@medialane/sdk';
4
4
  import { MedialaneClient } from '@medialane/sdk/starknet';
5
- import { ApiFetchConfig } from './api-fetch.cjs';
6
5
 
7
6
  declare function useOrders(getClient: () => MedialaneClient, query?: ApiOrdersQuery): {
8
7
  orders: ApiOrder[];
@@ -38,7 +37,7 @@ declare function useCounterOffers(getClient: () => MedialaneClient, { originalOr
38
37
  error: any;
39
38
  mutate: swr.KeyedMutator<ApiResponse<ApiOrder[]>>;
40
39
  };
41
- declare function useReceivedOffers(apiConfig: ApiFetchConfig, address: string | null): {
40
+ declare function useReceivedOffers(getClient: () => MedialaneClient, address: string | null): {
42
41
  orders: ApiOrder[];
43
42
  isLoading: boolean;
44
43
  error: any;
@@ -2,7 +2,6 @@ import * as swr from 'swr';
2
2
  import * as _medialane_sdk from '@medialane/sdk';
3
3
  import { ApiOrder, ApiResponse, ApiOrdersQuery } from '@medialane/sdk';
4
4
  import { MedialaneClient } from '@medialane/sdk/starknet';
5
- import { ApiFetchConfig } from './api-fetch.js';
6
5
 
7
6
  declare function useOrders(getClient: () => MedialaneClient, query?: ApiOrdersQuery): {
8
7
  orders: ApiOrder[];
@@ -38,7 +37,7 @@ declare function useCounterOffers(getClient: () => MedialaneClient, { originalOr
38
37
  error: any;
39
38
  mutate: swr.KeyedMutator<ApiResponse<ApiOrder[]>>;
40
39
  };
41
- declare function useReceivedOffers(apiConfig: ApiFetchConfig, address: string | null): {
40
+ declare function useReceivedOffers(getClient: () => MedialaneClient, address: string | null): {
42
41
  orders: ApiOrder[];
43
42
  isLoading: boolean;
44
43
  error: any;
@@ -3,7 +3,6 @@ import useSWR from "swr";
3
3
  import { normalizeAddress } from "@medialane/sdk";
4
4
  import { useMedialaneClient } from "./use-medialane-client.js";
5
5
  import { queryKeys } from "./query-keys.js";
6
- import { apiFetch } from "./api-fetch.js";
7
6
  const ACTIVE_ORDER_REFRESH_INTERVAL = 6e4;
8
7
  const ACTIVE_ORDER_DEDUPING_INTERVAL = 1e4;
9
8
  function useOrders(getClient, query = {}) {
@@ -73,11 +72,12 @@ function useCounterOffers(getClient, {
73
72
  mutate
74
73
  };
75
74
  }
76
- function useReceivedOffers(apiConfig, address) {
75
+ function useReceivedOffers(getClient, address) {
76
+ const client = useMedialaneClient(getClient);
77
77
  const normalized = address ? normalizeAddress("STARKNET", address) : null;
78
78
  const { data, error, isLoading, mutate } = useSWR(
79
79
  normalized ? ["received-offers", normalized] : null,
80
- () => apiFetch(apiConfig, `/v1/orders/received/${normalized}?limit=50`),
80
+ () => client.api.getReceivedOffers(normalized, { limit: 50 }),
81
81
  { revalidateOnFocus: false, refreshInterval: ACTIVE_ORDER_REFRESH_INTERVAL, dedupingInterval: ACTIVE_ORDER_DEDUPING_INTERVAL }
82
82
  );
83
83
  return { orders: data?.data ?? [], isLoading, error, mutate };
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/utils/use-orders.ts"],"sourcesContent":["\"use client\";\n\nimport useSWR from \"swr\";\nimport { normalizeAddress } from \"@medialane/sdk\";\nimport type { MedialaneClient } from \"@medialane/sdk/starknet\";\nimport type { ApiOrdersQuery, ApiOrder, ApiResponse } from \"@medialane/sdk\";\nimport { useMedialaneClient } from \"./use-medialane-client.js\";\nimport { queryKeys } from \"./query-keys.js\";\nimport { apiFetch, type ApiFetchConfig } from \"./api-fetch.js\";\n\nconst ACTIVE_ORDER_REFRESH_INTERVAL = 60_000;\nconst ACTIVE_ORDER_DEDUPING_INTERVAL = 10_000;\n\nexport function useOrders(getClient: () => MedialaneClient, query: ApiOrdersQuery = {}) {\n const client = useMedialaneClient(getClient);\n const key = queryKeys.orders(query);\n\n const { data, error, isLoading, mutate } = useSWR<ApiResponse<ApiOrder[]>>(\n key,\n () => client.api.getOrders(query),\n { revalidateOnFocus: false, refreshInterval: 30000, dedupingInterval: 5000 }\n );\n\n return {\n orders: data?.data ?? [],\n meta: data?.meta,\n isLoading,\n error,\n mutate,\n };\n}\n\nexport function useOrder(getClient: () => MedialaneClient, orderHash: string | null) {\n const client = useMedialaneClient(getClient);\n\n const { data, error, isLoading } = useSWR(\n orderHash ? queryKeys.order(orderHash) : null,\n () => client.api.getOrder(orderHash!),\n { revalidateOnFocus: false }\n );\n\n return { order: data?.data ?? null, isLoading, error };\n}\n\nexport function useTokenListings(getClient: () => MedialaneClient, contract: string | null, tokenId: string | null) {\n const client = useMedialaneClient(getClient);\n\n const { data, error, isLoading, mutate } = useSWR(\n contract && tokenId ? queryKeys.listings(contract, tokenId) : null,\n () => client.api.getActiveOrdersForToken(contract!, tokenId!),\n { revalidateOnFocus: false, refreshInterval: ACTIVE_ORDER_REFRESH_INTERVAL, dedupingInterval: ACTIVE_ORDER_DEDUPING_INTERVAL }\n );\n\n return { listings: data?.data ?? [], isLoading, error, mutate };\n}\n\nexport function useUserOrders(getClient: () => MedialaneClient, address: string | null) {\n const client = useMedialaneClient(getClient);\n const normalized = address ? normalizeAddress(\"STARKNET\", address) : null;\n\n const { data, error, isLoading, mutate } = useSWR(\n normalized ? queryKeys.userOrders(normalized) : null,\n () => client.api.getOrdersByUser(normalized!),\n { revalidateOnFocus: false, refreshInterval: ACTIVE_ORDER_REFRESH_INTERVAL, dedupingInterval: ACTIVE_ORDER_DEDUPING_INTERVAL }\n );\n\n return { orders: data?.data ?? [], isLoading, error, mutate };\n}\n\nexport function useCounterOffers(\n getClient: () => MedialaneClient,\n {\n originalOrderHash,\n sellerAddress,\n }: {\n originalOrderHash?: string | null;\n sellerAddress?: string | null;\n }\n) {\n const client = useMedialaneClient(getClient);\n const normalized = sellerAddress ? normalizeAddress(\"STARKNET\", sellerAddress) : null;\n const key =\n originalOrderHash\n ? queryKeys.counterOffersByOrder(originalOrderHash)\n : normalized\n ? queryKeys.counterOffersBySeller(normalized)\n : null;\n\n const { data, error, isLoading, mutate } = useSWR<ApiResponse<ApiOrder[]>>(\n key,\n () => client.api.getCounterOffers({\n ...(originalOrderHash ? { originalOrderHash } : {}),\n ...(normalized ? { sellerAddress: normalized } : {}),\n }),\n { revalidateOnFocus: false, refreshInterval: ACTIVE_ORDER_REFRESH_INTERVAL, dedupingInterval: ACTIVE_ORDER_DEDUPING_INTERVAL }\n );\n\n return {\n counterOffers: data?.data ?? [],\n total: data?.meta?.total ?? 0,\n isLoading,\n error,\n mutate,\n };\n}\n\nexport function useReceivedOffers(apiConfig: ApiFetchConfig, address: string | null) {\n const normalized = address ? normalizeAddress(\"STARKNET\", address) : null;\n\n const { data, error, isLoading, mutate } = useSWR<ApiResponse<ApiOrder[]>>(\n normalized ? [\"received-offers\", normalized] : null,\n () => apiFetch<ApiResponse<ApiOrder[]>>(apiConfig, `/v1/orders/received/${normalized}?limit=50`),\n { revalidateOnFocus: false, refreshInterval: ACTIVE_ORDER_REFRESH_INTERVAL, dedupingInterval: ACTIVE_ORDER_DEDUPING_INTERVAL }\n );\n\n return { orders: data?.data ?? [], isLoading, error, mutate };\n}\n\nexport function useCollectionFloorListings(getClient: () => MedialaneClient, contract: string | null, limit = 20) {\n const client = useMedialaneClient(getClient);\n const key = contract ? queryKeys.floorListings(contract, limit) : null;\n\n const { data, error, isLoading } = useSWR<ApiResponse<ApiOrder[]>>(\n key,\n () =>\n client.api.getOrders({\n collection: contract!,\n status: \"ACTIVE\",\n sort: \"price_asc\",\n limit,\n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wB;AACnF,QAAM,aAAa,UAAU,iBAAiB,YAAY,OAAO,IAAI;AAErE,QAAM,EAAE,MAAM,OAAO,WAAW,OAAO,IAAI;AAAA,IACzC,aAAa,CAAC,mBAAmB,UAAU,IAAI;AAAA,IAC/C,MAAM,SAAkC,WAAW,uBAAuB,UAAU,WAAW;AAAA,IAC/F,EAAE,mBAAmB,OAAO,iBAAiB,+BAA+B,kBAAkB,+BAA+B;AAAA,EAC/H;AAEA,SAAO,EAAE,QAAQ,MAAM,QAAQ,CAAC,GAAG,WAAW,OAAO,OAAO;AAC9D;AAEO,SAAS,2BAA2B,WAAkC,UAAyB,QAAQ,IAAI;AAChH,QAAM,SAAS,mBAAmB,SAAS;AAC3C,QAAM,MAAM,WAAW,UAAU,cAAc,UAAU,KAAK,IAAI;AAElE,QAAM,EAAE,MAAM,OAAO,UAAU,IAAI;AAAA,IACjC;AAAA,IACA,MACE,OAAO,IAAI,UAAU;AAAA,MACnB,YAAY;AAAA,MACZ,QAAQ;AAAA,MACR,MAAM;AAAA,MACN;AAAA,IACF,CAAC;AAAA,IACH,EAAE,mBAAmB,OAAO,iBAAiB,8BAA8B;AAAA,EAC7E;AAEA,SAAO;AAAA,IACL,UAAU,MAAM,QAAQ,CAAC;AAAA,IACzB;AAAA,IACA;AAAA,EACF;AACF;","names":[]}
1
+ {"version":3,"sources":["../../src/utils/use-orders.ts"],"sourcesContent":["\"use client\";\n\nimport useSWR from \"swr\";\nimport { normalizeAddress } from \"@medialane/sdk\";\nimport type { MedialaneClient } from \"@medialane/sdk/starknet\";\nimport type { ApiOrdersQuery, ApiOrder, ApiResponse } from \"@medialane/sdk\";\nimport { useMedialaneClient } from \"./use-medialane-client.js\";\nimport { queryKeys } from \"./query-keys.js\";\n\nconst ACTIVE_ORDER_REFRESH_INTERVAL = 60_000;\nconst ACTIVE_ORDER_DEDUPING_INTERVAL = 10_000;\n\nexport function useOrders(getClient: () => MedialaneClient, query: ApiOrdersQuery = {}) {\n const client = useMedialaneClient(getClient);\n const key = queryKeys.orders(query);\n\n const { data, error, isLoading, mutate } = useSWR<ApiResponse<ApiOrder[]>>(\n key,\n () => client.api.getOrders(query),\n { revalidateOnFocus: false, refreshInterval: 30000, dedupingInterval: 5000 }\n );\n\n return {\n orders: data?.data ?? [],\n meta: data?.meta,\n isLoading,\n error,\n mutate,\n };\n}\n\nexport function useOrder(getClient: () => MedialaneClient, orderHash: string | null) {\n const client = useMedialaneClient(getClient);\n\n const { data, error, isLoading } = useSWR(\n orderHash ? queryKeys.order(orderHash) : null,\n () => client.api.getOrder(orderHash!),\n { revalidateOnFocus: false }\n );\n\n return { order: data?.data ?? null, isLoading, error };\n}\n\nexport function useTokenListings(getClient: () => MedialaneClient, contract: string | null, tokenId: string | null) {\n const client = useMedialaneClient(getClient);\n\n const { data, error, isLoading, mutate } = useSWR(\n contract && tokenId ? queryKeys.listings(contract, tokenId) : null,\n () => client.api.getActiveOrdersForToken(contract!, tokenId!),\n { revalidateOnFocus: false, refreshInterval: ACTIVE_ORDER_REFRESH_INTERVAL, dedupingInterval: ACTIVE_ORDER_DEDUPING_INTERVAL }\n );\n\n return { listings: data?.data ?? [], isLoading, error, mutate };\n}\n\nexport function useUserOrders(getClient: () => MedialaneClient, address: string | null) {\n const client = useMedialaneClient(getClient);\n const normalized = address ? normalizeAddress(\"STARKNET\", address) : null;\n\n const { data, error, isLoading, mutate } = useSWR(\n normalized ? queryKeys.userOrders(normalized) : null,\n () => client.api.getOrdersByUser(normalized!),\n { revalidateOnFocus: false, refreshInterval: ACTIVE_ORDER_REFRESH_INTERVAL, dedupingInterval: ACTIVE_ORDER_DEDUPING_INTERVAL }\n );\n\n return { orders: data?.data ?? [], isLoading, error, mutate };\n}\n\nexport function useCounterOffers(\n getClient: () => MedialaneClient,\n {\n originalOrderHash,\n sellerAddress,\n }: {\n originalOrderHash?: string | null;\n sellerAddress?: string | null;\n }\n) {\n const client = useMedialaneClient(getClient);\n const normalized = sellerAddress ? normalizeAddress(\"STARKNET\", sellerAddress) : null;\n const key =\n originalOrderHash\n ? queryKeys.counterOffersByOrder(originalOrderHash)\n : normalized\n ? queryKeys.counterOffersBySeller(normalized)\n : null;\n\n const { data, error, isLoading, mutate } = useSWR<ApiResponse<ApiOrder[]>>(\n key,\n () => client.api.getCounterOffers({\n ...(originalOrderHash ? { originalOrderHash } : {}),\n ...(normalized ? { sellerAddress: normalized } : {}),\n }),\n { revalidateOnFocus: false, refreshInterval: ACTIVE_ORDER_REFRESH_INTERVAL, dedupingInterval: ACTIVE_ORDER_DEDUPING_INTERVAL }\n );\n\n return {\n counterOffers: data?.data ?? [],\n total: data?.meta?.total ?? 0,\n isLoading,\n error,\n mutate,\n };\n}\n\nexport function useReceivedOffers(getClient: () => MedialaneClient, address: string | null) {\n const client = useMedialaneClient(getClient);\n const normalized = address ? normalizeAddress(\"STARKNET\", address) : null;\n\n const { data, error, isLoading, mutate } = useSWR<ApiResponse<ApiOrder[]>>(\n normalized ? [\"received-offers\", normalized] : null,\n () => client.api.getReceivedOffers(normalized!, { limit: 50 }),\n { revalidateOnFocus: false, refreshInterval: ACTIVE_ORDER_REFRESH_INTERVAL, dedupingInterval: ACTIVE_ORDER_DEDUPING_INTERVAL }\n );\n\n return { orders: data?.data ?? [], isLoading, error, mutate };\n}\n\nexport function useCollectionFloorListings(getClient: () => MedialaneClient, contract: string | null, limit = 20) {\n const client = useMedialaneClient(getClient);\n const key = contract ? queryKeys.floorListings(contract, limit) : null;\n\n const { data, error, isLoading } = useSWR<ApiResponse<ApiOrder[]>>(\n key,\n () =>\n client.api.getOrders({\n collection: contract!,\n status: \"ACTIVE\",\n sort: \"price_asc\",\n limit,\n }),\n { revalidateOnFocus: false, refreshInterval: ACTIVE_ORDER_REFRESH_INTERVAL }\n );\n\n return {\n listings: data?.data ?? [],\n isLoading,\n error,\n };\n}\n"],"mappings":";AAEA,OAAO,YAAY;AACnB,SAAS,wBAAwB;AAGjC,SAAS,0BAA0B;AACnC,SAAS,iBAAiB;AAE1B,MAA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,OAAO,GAAG,CAAC;AAAA,IAC7D,EAAE,mBAAmB,OAAO,iBAAiB,+BAA+B,kBAAkB,+BAA+B;AAAA,EAC/H;AAEA,SAAO,EAAE,QAAQ,MAAM,QAAQ,CAAC,GAAG,WAAW,OAAO,OAAO;AAC9D;AAEO,SAAS,2BAA2B,WAAkC,UAAyB,QAAQ,IAAI;AAChH,QAAM,SAAS,mBAAmB,SAAS;AAC3C,QAAM,MAAM,WAAW,UAAU,cAAc,UAAU,KAAK,IAAI;AAElE,QAAM,EAAE,MAAM,OAAO,UAAU,IAAI;AAAA,IACjC;AAAA,IACA,MACE,OAAO,IAAI,UAAU;AAAA,MACnB,YAAY;AAAA,MACZ,QAAQ;AAAA,MACR,MAAM;AAAA,MACN;AAAA,IACF,CAAC;AAAA,IACH,EAAE,mBAAmB,OAAO,iBAAiB,8BAA8B;AAAA,EAC7E;AAEA,SAAO;AAAA,IACL,UAAU,MAAM,QAAQ,CAAC;AAAA,IACzB;AAAA,IACA;AAAA,EACF;AACF;","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 { revalidateOnFocus: false, shouldRetryOnError: false }\n );\n return { claimStatus: data ?? null, isLoading, error, mutate };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,iBAAmB;AAGnB,kCAAmC;AAE5B,SAAS,kBAAkB,WAAkC;AAClE,QAAM,aAAS,gDAAmB,SAAS;AAC3C,QAAM,EAAE,MAAM,OAAO,WAAW,OAAO,QAAI,WAAAA;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,aAAS,gDAAmB,SAAS;AAC3C,QAAM,EAAE,MAAM,OAAO,WAAW,OAAO,QAAI,WAAAA;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,aAAS,gDAAmB,SAAS;AAC3C,QAAM,EAAE,MAAM,OAAO,WAAW,OAAO,QAAI,WAAAA;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":["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":[]}
@@ -33,14 +33,15 @@ __export(use_remix_offers_exports, {
33
33
  });
34
34
  module.exports = __toCommonJS(use_remix_offers_exports);
35
35
  var import_swr = __toESM(require("swr"), 1);
36
- var import_api_fetch = require("./api-fetch.js");
37
- function useTokenRemixes(apiConfig, contract, tokenId) {
36
+ var import_use_medialane_client = require("./use-medialane-client.js");
37
+ function useTokenRemixes(getClient, contract, tokenId) {
38
+ const client = (0, import_use_medialane_client.useMedialaneClient)(getClient);
38
39
  const { data, error, isLoading, mutate } = (0, import_swr.default)(
39
40
  contract && tokenId ? `token-remixes-${contract}-${tokenId}` : null,
40
- () => (0, import_api_fetch.apiFetch)(apiConfig, `/v1/tokens/${contract}/${tokenId}/remixes`),
41
+ () => client.api.getTokenRemixes(contract, tokenId),
41
42
  { refreshInterval: 6e4, revalidateOnFocus: false }
42
43
  );
43
- return { remixes: data?.data ?? [], total: data?.meta.total ?? 0, isLoading, error, mutate };
44
+ return { remixes: data?.data ?? [], total: data?.meta?.total ?? 0, isLoading, error, mutate };
44
45
  }
45
46
  // Annotate the CommonJS export names for ESM import in node:
46
47
  0 && (module.exports = {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/utils/use-remix-offers.ts"],"sourcesContent":["\"use client\";\n\nimport useSWR from \"swr\";\nimport { apiFetch, type ApiFetchConfig } from \"./api-fetch.js\";\nimport type { ApiPublicRemix } from \"@medialane/sdk\";\n\nexport function useTokenRemixes(apiConfig: ApiFetchConfig, contract: string | null, tokenId: string | null) {\n const { data, error, isLoading, mutate } = useSWR<{ data: ApiPublicRemix[]; meta: { total: number } }>(\n contract && tokenId ? `token-remixes-${contract}-${tokenId}` : null,\n () => apiFetch(apiConfig, `/v1/tokens/${contract}/${tokenId}/remixes`),\n { refreshInterval: 60000, revalidateOnFocus: false }\n );\n\n return { remixes: data?.data ?? [], total: data?.meta.total ?? 0, isLoading, error, mutate };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,iBAAmB;AACnB,uBAA8C;AAGvC,SAAS,gBAAgB,WAA2B,UAAyB,SAAwB;AAC1G,QAAM,EAAE,MAAM,OAAO,WAAW,OAAO,QAAI,WAAAA;AAAA,IACzC,YAAY,UAAU,iBAAiB,QAAQ,IAAI,OAAO,KAAK;AAAA,IAC/D,UAAM,2BAAS,WAAW,cAAc,QAAQ,IAAI,OAAO,UAAU;AAAA,IACrE,EAAE,iBAAiB,KAAO,mBAAmB,MAAM;AAAA,EACrD;AAEA,SAAO,EAAE,SAAS,MAAM,QAAQ,CAAC,GAAG,OAAO,MAAM,KAAK,SAAS,GAAG,WAAW,OAAO,OAAO;AAC7F;","names":["useSWR"]}
1
+ {"version":3,"sources":["../../src/utils/use-remix-offers.ts"],"sourcesContent":["\"use client\";\n\nimport useSWR from \"swr\";\nimport type { MedialaneClient } from \"@medialane/sdk/starknet\";\nimport { useMedialaneClient } from \"./use-medialane-client.js\";\nimport type { ApiPublicRemix, ApiResponse } from \"@medialane/sdk\";\n\nexport function useTokenRemixes(getClient: () => MedialaneClient, contract: string | null, tokenId: string | null) {\n const client = useMedialaneClient(getClient);\n const { data, error, isLoading, mutate } = useSWR<ApiResponse<ApiPublicRemix[]>>(\n contract && tokenId ? `token-remixes-${contract}-${tokenId}` : null,\n () => client.api.getTokenRemixes(contract!, tokenId!),\n { refreshInterval: 60000, revalidateOnFocus: false }\n );\n\n return { remixes: data?.data ?? [], total: data?.meta?.total ?? 0, isLoading, error, mutate };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,iBAAmB;AAEnB,kCAAmC;AAG5B,SAAS,gBAAgB,WAAkC,UAAyB,SAAwB;AACjH,QAAM,aAAS,gDAAmB,SAAS;AAC3C,QAAM,EAAE,MAAM,OAAO,WAAW,OAAO,QAAI,WAAAA;AAAA,IACzC,YAAY,UAAU,iBAAiB,QAAQ,IAAI,OAAO,KAAK;AAAA,IAC/D,MAAM,OAAO,IAAI,gBAAgB,UAAW,OAAQ;AAAA,IACpD,EAAE,iBAAiB,KAAO,mBAAmB,MAAM;AAAA,EACrD;AAEA,SAAO,EAAE,SAAS,MAAM,QAAQ,CAAC,GAAG,OAAO,MAAM,MAAM,SAAS,GAAG,WAAW,OAAO,OAAO;AAC9F;","names":["useSWR"]}
@@ -1,18 +1,13 @@
1
1
  import * as swr from 'swr';
2
- import { ApiFetchConfig } from './api-fetch.cjs';
3
- import { ApiPublicRemix } from '@medialane/sdk';
2
+ import { MedialaneClient } from '@medialane/sdk/starknet';
3
+ import { ApiPublicRemix, ApiResponse } from '@medialane/sdk';
4
4
 
5
- declare function useTokenRemixes(apiConfig: ApiFetchConfig, contract: string | null, tokenId: string | null): {
5
+ declare function useTokenRemixes(getClient: () => MedialaneClient, contract: string | null, tokenId: string | null): {
6
6
  remixes: ApiPublicRemix[];
7
7
  total: number;
8
8
  isLoading: boolean;
9
9
  error: any;
10
- mutate: swr.KeyedMutator<{
11
- data: ApiPublicRemix[];
12
- meta: {
13
- total: number;
14
- };
15
- }>;
10
+ mutate: swr.KeyedMutator<ApiResponse<ApiPublicRemix[]>>;
16
11
  };
17
12
 
18
13
  export { useTokenRemixes };
@@ -1,18 +1,13 @@
1
1
  import * as swr from 'swr';
2
- import { ApiFetchConfig } from './api-fetch.js';
3
- import { ApiPublicRemix } from '@medialane/sdk';
2
+ import { MedialaneClient } from '@medialane/sdk/starknet';
3
+ import { ApiPublicRemix, ApiResponse } from '@medialane/sdk';
4
4
 
5
- declare function useTokenRemixes(apiConfig: ApiFetchConfig, contract: string | null, tokenId: string | null): {
5
+ declare function useTokenRemixes(getClient: () => MedialaneClient, contract: string | null, tokenId: string | null): {
6
6
  remixes: ApiPublicRemix[];
7
7
  total: number;
8
8
  isLoading: boolean;
9
9
  error: any;
10
- mutate: swr.KeyedMutator<{
11
- data: ApiPublicRemix[];
12
- meta: {
13
- total: number;
14
- };
15
- }>;
10
+ mutate: swr.KeyedMutator<ApiResponse<ApiPublicRemix[]>>;
16
11
  };
17
12
 
18
13
  export { useTokenRemixes };