@medialane/ui 0.200.1 → 0.201.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 (339) hide show
  1. package/dist/components/action-button.cjs +3 -3
  2. package/dist/components/action-button.cjs.map +1 -1
  3. package/dist/components/action-button.d.cts +1 -2
  4. package/dist/components/action-button.d.ts +1 -2
  5. package/dist/components/action-button.js +3 -3
  6. package/dist/components/action-button.js.map +1 -1
  7. package/dist/components/activities-feed.cjs +3 -3
  8. package/dist/components/activities-feed.cjs.map +1 -1
  9. package/dist/components/activities-feed.d.cts +2 -6
  10. package/dist/components/activities-feed.d.ts +2 -6
  11. package/dist/components/activities-feed.js +3 -3
  12. package/dist/components/activities-feed.js.map +1 -1
  13. package/dist/components/asset-comments-dialog.cjs +76 -0
  14. package/dist/components/asset-comments-dialog.cjs.map +1 -0
  15. package/dist/components/asset-comments-dialog.d.cts +26 -0
  16. package/dist/components/asset-comments-dialog.d.ts +26 -0
  17. package/dist/components/asset-comments-dialog.js +42 -0
  18. package/dist/components/asset-comments-dialog.js.map +1 -0
  19. package/dist/components/asset-marketplace-panel.cjs +80 -139
  20. package/dist/components/asset-marketplace-panel.cjs.map +1 -1
  21. package/dist/components/asset-marketplace-panel.d.cts +2 -5
  22. package/dist/components/asset-marketplace-panel.d.ts +2 -5
  23. package/dist/components/asset-marketplace-panel.js +81 -140
  24. package/dist/components/asset-marketplace-panel.js.map +1 -1
  25. package/dist/components/asset-owners-panel.cjs +38 -22
  26. package/dist/components/asset-owners-panel.cjs.map +1 -1
  27. package/dist/components/asset-owners-panel.d.cts +3 -1
  28. package/dist/components/asset-owners-panel.d.ts +3 -1
  29. package/dist/components/asset-owners-panel.js +38 -22
  30. package/dist/components/asset-owners-panel.js.map +1 -1
  31. package/dist/components/asset-page.cjs +324 -0
  32. package/dist/components/asset-page.cjs.map +1 -0
  33. package/dist/components/asset-page.d.cts +44 -0
  34. package/dist/components/asset-page.d.ts +44 -0
  35. package/dist/components/asset-page.js +298 -0
  36. package/dist/components/asset-page.js.map +1 -0
  37. package/dist/components/asset-provenance-tab.cjs +1 -3
  38. package/dist/components/asset-provenance-tab.cjs.map +1 -1
  39. package/dist/components/asset-provenance-tab.js +1 -3
  40. package/dist/components/asset-provenance-tab.js.map +1 -1
  41. package/dist/components/asset-top-sections.cjs +9 -1
  42. package/dist/components/asset-top-sections.cjs.map +1 -1
  43. package/dist/components/asset-top-sections.d.cts +3 -1
  44. package/dist/components/asset-top-sections.d.ts +3 -1
  45. package/dist/components/asset-top-sections.js +9 -1
  46. package/dist/components/asset-top-sections.js.map +1 -1
  47. package/dist/components/asset-type-panels.cjs +139 -0
  48. package/dist/components/asset-type-panels.cjs.map +1 -0
  49. package/dist/components/asset-type-panels.d.cts +11 -0
  50. package/dist/components/asset-type-panels.d.ts +11 -0
  51. package/dist/components/asset-type-panels.js +114 -0
  52. package/dist/components/asset-type-panels.js.map +1 -0
  53. package/dist/components/button.d.cts +1 -1
  54. package/dist/components/button.d.ts +1 -1
  55. package/dist/components/collection-activity-tab.cjs +2 -2
  56. package/dist/components/collection-activity-tab.cjs.map +1 -1
  57. package/dist/components/collection-activity-tab.d.cts +1 -3
  58. package/dist/components/collection-activity-tab.d.ts +1 -3
  59. package/dist/components/collection-activity-tab.js +2 -2
  60. package/dist/components/collection-activity-tab.js.map +1 -1
  61. package/dist/components/collection-filters-dialog.cjs +98 -0
  62. package/dist/components/collection-filters-dialog.cjs.map +1 -0
  63. package/dist/components/collection-filters-dialog.d.cts +13 -0
  64. package/dist/components/collection-filters-dialog.d.ts +13 -0
  65. package/dist/components/collection-filters-dialog.js +74 -0
  66. package/dist/components/collection-filters-dialog.js.map +1 -0
  67. package/dist/components/collection-header.cjs +82 -0
  68. package/dist/components/collection-header.cjs.map +1 -0
  69. package/dist/components/collection-header.d.cts +13 -0
  70. package/dist/components/collection-header.d.ts +13 -0
  71. package/dist/components/collection-header.js +58 -0
  72. package/dist/components/collection-header.js.map +1 -0
  73. package/dist/components/collection-page.cjs +274 -0
  74. package/dist/components/collection-page.cjs.map +1 -0
  75. package/dist/components/collection-page.d.cts +32 -0
  76. package/dist/components/collection-page.d.ts +32 -0
  77. package/dist/components/collection-page.js +239 -0
  78. package/dist/components/collection-page.js.map +1 -0
  79. package/dist/components/collection-traits-tab.cjs +2 -2
  80. package/dist/components/collection-traits-tab.cjs.map +1 -1
  81. package/dist/components/collection-traits-tab.d.cts +1 -3
  82. package/dist/components/collection-traits-tab.d.ts +1 -3
  83. package/dist/components/collection-traits-tab.js +2 -2
  84. package/dist/components/collection-traits-tab.js.map +1 -1
  85. package/dist/components/creator-chip.cjs +2 -2
  86. package/dist/components/creator-chip.cjs.map +1 -1
  87. package/dist/components/creator-chip.d.cts +1 -3
  88. package/dist/components/creator-chip.d.ts +1 -3
  89. package/dist/components/creator-chip.js +2 -2
  90. package/dist/components/creator-chip.js.map +1 -1
  91. package/dist/components/creator-header.cjs +80 -0
  92. package/dist/components/creator-header.cjs.map +1 -0
  93. package/dist/components/creator-header.d.cts +18 -0
  94. package/dist/components/creator-header.d.ts +18 -0
  95. package/dist/components/creator-header.js +56 -0
  96. package/dist/components/creator-header.js.map +1 -0
  97. package/dist/components/creator-score-inline.cjs +2 -2
  98. package/dist/components/creator-score-inline.cjs.map +1 -1
  99. package/dist/components/creator-score-inline.d.cts +1 -3
  100. package/dist/components/creator-score-inline.d.ts +1 -3
  101. package/dist/components/creator-score-inline.js +2 -2
  102. package/dist/components/creator-score-inline.js.map +1 -1
  103. package/dist/components/drop/create/drop-create.cjs +1 -1
  104. package/dist/components/drop/create/drop-create.cjs.map +1 -1
  105. package/dist/components/drop/create/drop-create.js +1 -1
  106. package/dist/components/drop/create/drop-create.js.map +1 -1
  107. package/dist/components/drop/drop-listing.cjs +1 -2
  108. package/dist/components/drop/drop-listing.cjs.map +1 -1
  109. package/dist/components/drop/drop-listing.d.cts +1 -3
  110. package/dist/components/drop/drop-listing.d.ts +1 -3
  111. package/dist/components/drop/drop-listing.js +1 -2
  112. package/dist/components/drop/drop-listing.js.map +1 -1
  113. package/dist/components/drop/my-drops.cjs +2 -2
  114. package/dist/components/drop/my-drops.cjs.map +1 -1
  115. package/dist/components/drop/my-drops.js +2 -2
  116. package/dist/components/drop/my-drops.js.map +1 -1
  117. package/dist/components/drop/page/drop-page.cjs +8 -8
  118. package/dist/components/drop/page/drop-page.cjs.map +1 -1
  119. package/dist/components/drop/page/drop-page.js +8 -8
  120. package/dist/components/drop/page/drop-page.js.map +1 -1
  121. package/dist/components/fast-mint/fast-mint.d.cts +2 -2
  122. package/dist/components/fast-mint/fast-mint.d.ts +2 -2
  123. package/dist/components/floating-comments-button.cjs +78 -0
  124. package/dist/components/floating-comments-button.cjs.map +1 -0
  125. package/dist/components/floating-comments-button.d.cts +9 -0
  126. package/dist/components/floating-comments-button.d.ts +9 -0
  127. package/dist/components/floating-comments-button.js +54 -0
  128. package/dist/components/floating-comments-button.js.map +1 -0
  129. package/dist/components/gated-content.cjs +142 -0
  130. package/dist/components/gated-content.cjs.map +1 -0
  131. package/dist/components/gated-content.d.cts +31 -0
  132. package/dist/components/gated-content.d.ts +31 -0
  133. package/dist/components/gated-content.js +117 -0
  134. package/dist/components/gated-content.js.map +1 -0
  135. package/dist/components/listing-card-menu.cjs +79 -0
  136. package/dist/components/listing-card-menu.cjs.map +1 -0
  137. package/dist/components/listing-card-menu.d.cts +8 -0
  138. package/dist/components/listing-card-menu.d.ts +8 -0
  139. package/dist/components/listing-card-menu.js +45 -0
  140. package/dist/components/listing-card-menu.js.map +1 -0
  141. package/dist/components/listing-card.cjs +2 -1
  142. package/dist/components/listing-card.cjs.map +1 -1
  143. package/dist/components/listing-card.js +2 -1
  144. package/dist/components/listing-card.js.map +1 -1
  145. package/dist/components/make-offer-picker.cjs +114 -0
  146. package/dist/components/make-offer-picker.cjs.map +1 -0
  147. package/dist/components/make-offer-picker.d.cts +9 -0
  148. package/dist/components/make-offer-picker.d.ts +9 -0
  149. package/dist/components/make-offer-picker.js +80 -0
  150. package/dist/components/make-offer-picker.js.map +1 -0
  151. package/dist/components/media-header.cjs +91 -0
  152. package/dist/components/media-header.cjs.map +1 -0
  153. package/dist/components/media-header.d.cts +23 -0
  154. package/dist/components/media-header.d.ts +23 -0
  155. package/dist/components/media-header.js +64 -0
  156. package/dist/components/media-header.js.map +1 -0
  157. package/dist/components/media-wallet/media-wallet-activity.cjs +3 -1
  158. package/dist/components/media-wallet/media-wallet-activity.cjs.map +1 -1
  159. package/dist/components/media-wallet/media-wallet-activity.js +3 -1
  160. package/dist/components/media-wallet/media-wallet-activity.js.map +1 -1
  161. package/dist/components/media-wallet/media-wallet-home.cjs +6 -6
  162. package/dist/components/media-wallet/media-wallet-home.cjs.map +1 -1
  163. package/dist/components/media-wallet/media-wallet-home.js +6 -6
  164. package/dist/components/media-wallet/media-wallet-home.js.map +1 -1
  165. package/dist/components/media-wallet/media-wallet-send.cjs +8 -6
  166. package/dist/components/media-wallet/media-wallet-send.cjs.map +1 -1
  167. package/dist/components/media-wallet/media-wallet-send.js +8 -6
  168. package/dist/components/media-wallet/media-wallet-send.js.map +1 -1
  169. package/dist/components/media-wallet/media-wallet-token-detail.cjs +4 -3
  170. package/dist/components/media-wallet/media-wallet-token-detail.cjs.map +1 -1
  171. package/dist/components/media-wallet/media-wallet-token-detail.js +4 -3
  172. package/dist/components/media-wallet/media-wallet-token-detail.js.map +1 -1
  173. package/dist/components/media-wallet/types.cjs.map +1 -1
  174. package/dist/components/media-wallet/types.d.cts +1 -2
  175. package/dist/components/media-wallet/types.d.ts +1 -2
  176. package/dist/components/media-wallet/types.js.map +1 -1
  177. package/dist/components/medialane-app.cjs.map +1 -1
  178. package/dist/components/medialane-app.d.cts +18 -2
  179. package/dist/components/medialane-app.d.ts +18 -2
  180. package/dist/components/medialane-app.js.map +1 -1
  181. package/dist/components/portfolio-activity.cjs +2 -2
  182. package/dist/components/portfolio-activity.cjs.map +1 -1
  183. package/dist/components/portfolio-activity.d.cts +1 -3
  184. package/dist/components/portfolio-activity.d.ts +1 -3
  185. package/dist/components/portfolio-activity.js +2 -2
  186. package/dist/components/portfolio-activity.js.map +1 -1
  187. package/dist/components/remixes-tab.cjs +2 -2
  188. package/dist/components/remixes-tab.cjs.map +1 -1
  189. package/dist/components/remixes-tab.d.cts +1 -3
  190. package/dist/components/remixes-tab.d.ts +1 -3
  191. package/dist/components/remixes-tab.js +2 -2
  192. package/dist/components/remixes-tab.js.map +1 -1
  193. package/dist/components/sheet.d.cts +1 -1
  194. package/dist/components/sheet.d.ts +1 -1
  195. package/dist/index.cjs +55 -3
  196. package/dist/index.cjs.map +1 -1
  197. package/dist/index.d.cts +18 -4
  198. package/dist/index.d.ts +18 -4
  199. package/dist/index.js +36 -3
  200. package/dist/index.js.map +1 -1
  201. package/dist/utils/asset-attributes.cjs +48 -0
  202. package/dist/utils/asset-attributes.cjs.map +1 -0
  203. package/dist/utils/asset-attributes.d.cts +13 -0
  204. package/dist/utils/asset-attributes.d.ts +13 -0
  205. package/dist/utils/asset-attributes.js +24 -0
  206. package/dist/utils/asset-attributes.js.map +1 -0
  207. package/dist/utils/asset-market-state.cjs +132 -0
  208. package/dist/utils/asset-market-state.cjs.map +1 -0
  209. package/dist/utils/asset-market-state.d.cts +33 -0
  210. package/dist/utils/asset-market-state.d.ts +33 -0
  211. package/dist/utils/asset-market-state.js +101 -0
  212. package/dist/utils/asset-market-state.js.map +1 -0
  213. package/dist/utils/media-wallet/use-erc20-balance.cjs +5 -3
  214. package/dist/utils/media-wallet/use-erc20-balance.cjs.map +1 -1
  215. package/dist/utils/media-wallet/use-erc20-balance.d.cts +3 -5
  216. package/dist/utils/media-wallet/use-erc20-balance.d.ts +3 -5
  217. package/dist/utils/media-wallet/use-erc20-balance.js +5 -3
  218. package/dist/utils/media-wallet/use-erc20-balance.js.map +1 -1
  219. package/dist/utils/use-activities.cjs +4 -4
  220. package/dist/utils/use-activities.cjs.map +1 -1
  221. package/dist/utils/use-activities.d.cts +2 -3
  222. package/dist/utils/use-activities.d.ts +2 -3
  223. package/dist/utils/use-activities.js +4 -4
  224. package/dist/utils/use-activities.js.map +1 -1
  225. package/dist/utils/use-coin-price.cjs +6 -6
  226. package/dist/utils/use-coin-price.cjs.map +1 -1
  227. package/dist/utils/use-coin-price.d.cts +2 -3
  228. package/dist/utils/use-coin-price.d.ts +2 -3
  229. package/dist/utils/use-coin-price.js +6 -6
  230. package/dist/utils/use-coin-price.js.map +1 -1
  231. package/dist/utils/use-collections.cjs +10 -10
  232. package/dist/utils/use-collections.cjs.map +1 -1
  233. package/dist/utils/use-collections.d.cts +5 -6
  234. package/dist/utils/use-collections.d.ts +5 -6
  235. package/dist/utils/use-collections.js +10 -10
  236. package/dist/utils/use-collections.js.map +1 -1
  237. package/dist/utils/use-comments.cjs +50 -0
  238. package/dist/utils/use-comments.cjs.map +1 -0
  239. package/dist/utils/use-comments.d.cts +12 -0
  240. package/dist/utils/use-comments.d.ts +12 -0
  241. package/dist/utils/use-comments.js +16 -0
  242. package/dist/utils/use-comments.js.map +1 -0
  243. package/dist/utils/use-creators.cjs +3 -1
  244. package/dist/utils/use-creators.cjs.map +1 -1
  245. package/dist/utils/use-creators.d.cts +1 -2
  246. package/dist/utils/use-creators.d.ts +1 -2
  247. package/dist/utils/use-creators.js +3 -1
  248. package/dist/utils/use-creators.js.map +1 -1
  249. package/dist/utils/use-drops.cjs +14 -14
  250. package/dist/utils/use-drops.cjs.map +1 -1
  251. package/dist/utils/use-drops.d.cts +7 -7
  252. package/dist/utils/use-drops.d.ts +7 -7
  253. package/dist/utils/use-drops.js +14 -14
  254. package/dist/utils/use-drops.js.map +1 -1
  255. package/dist/utils/use-full-token-data.cjs +50 -0
  256. package/dist/utils/use-full-token-data.cjs.map +1 -0
  257. package/dist/utils/use-full-token-data.d.cts +9 -0
  258. package/dist/utils/use-full-token-data.d.ts +9 -0
  259. package/dist/utils/use-full-token-data.js +16 -0
  260. package/dist/utils/use-full-token-data.js.map +1 -0
  261. package/dist/utils/use-medialane-client.cjs +3 -1
  262. package/dist/utils/use-medialane-client.cjs.map +1 -1
  263. package/dist/utils/use-medialane-client.d.cts +1 -1
  264. package/dist/utils/use-medialane-client.d.ts +1 -1
  265. package/dist/utils/use-medialane-client.js +3 -1
  266. package/dist/utils/use-medialane-client.js.map +1 -1
  267. package/dist/utils/use-notifications.cjs +4 -4
  268. package/dist/utils/use-notifications.cjs.map +1 -1
  269. package/dist/utils/use-notifications.d.cts +1 -2
  270. package/dist/utils/use-notifications.d.ts +1 -2
  271. package/dist/utils/use-notifications.js +4 -4
  272. package/dist/utils/use-notifications.js.map +1 -1
  273. package/dist/utils/use-orders.cjs +14 -14
  274. package/dist/utils/use-orders.cjs.map +1 -1
  275. package/dist/utils/use-orders.d.cts +7 -8
  276. package/dist/utils/use-orders.d.ts +7 -8
  277. package/dist/utils/use-orders.js +14 -14
  278. package/dist/utils/use-orders.js.map +1 -1
  279. package/dist/utils/use-platform-stats.cjs +2 -2
  280. package/dist/utils/use-platform-stats.cjs.map +1 -1
  281. package/dist/utils/use-platform-stats.d.cts +1 -2
  282. package/dist/utils/use-platform-stats.d.ts +1 -2
  283. package/dist/utils/use-platform-stats.js +2 -2
  284. package/dist/utils/use-platform-stats.js.map +1 -1
  285. package/dist/utils/use-pop.cjs +6 -6
  286. package/dist/utils/use-pop.cjs.map +1 -1
  287. package/dist/utils/use-pop.d.cts +3 -4
  288. package/dist/utils/use-pop.d.ts +3 -4
  289. package/dist/utils/use-pop.js +6 -6
  290. package/dist/utils/use-pop.js.map +1 -1
  291. package/dist/utils/use-profiles.cjs +5 -2
  292. package/dist/utils/use-profiles.cjs.map +1 -1
  293. package/dist/utils/use-profiles.d.cts +2 -3
  294. package/dist/utils/use-profiles.d.ts +2 -3
  295. package/dist/utils/use-profiles.js +5 -2
  296. package/dist/utils/use-profiles.js.map +1 -1
  297. package/dist/utils/use-remix-offers.cjs +2 -2
  298. package/dist/utils/use-remix-offers.cjs.map +1 -1
  299. package/dist/utils/use-remix-offers.d.cts +1 -2
  300. package/dist/utils/use-remix-offers.d.ts +1 -2
  301. package/dist/utils/use-remix-offers.js +2 -2
  302. package/dist/utils/use-remix-offers.js.map +1 -1
  303. package/dist/utils/use-rewards.cjs +11 -5
  304. package/dist/utils/use-rewards.cjs.map +1 -1
  305. package/dist/utils/use-rewards.d.cts +5 -6
  306. package/dist/utils/use-rewards.d.ts +5 -6
  307. package/dist/utils/use-rewards.js +11 -5
  308. package/dist/utils/use-rewards.js.map +1 -1
  309. package/dist/utils/use-sponsorship.cjs +14 -17
  310. package/dist/utils/use-sponsorship.cjs.map +1 -1
  311. package/dist/utils/use-sponsorship.d.cts +8 -9
  312. package/dist/utils/use-sponsorship.d.ts +8 -9
  313. package/dist/utils/use-sponsorship.js +14 -17
  314. package/dist/utils/use-sponsorship.js.map +1 -1
  315. package/dist/utils/use-tiers.cjs +16 -16
  316. package/dist/utils/use-tiers.cjs.map +1 -1
  317. package/dist/utils/use-tiers.d.cts +7 -8
  318. package/dist/utils/use-tiers.d.ts +7 -8
  319. package/dist/utils/use-tiers.js +16 -16
  320. package/dist/utils/use-tiers.js.map +1 -1
  321. package/dist/utils/use-tokens-by-ip-type.cjs +2 -2
  322. package/dist/utils/use-tokens-by-ip-type.cjs.map +1 -1
  323. package/dist/utils/use-tokens-by-ip-type.d.cts +1 -2
  324. package/dist/utils/use-tokens-by-ip-type.d.ts +1 -2
  325. package/dist/utils/use-tokens-by-ip-type.js +2 -2
  326. package/dist/utils/use-tokens-by-ip-type.js.map +1 -1
  327. package/dist/utils/use-tokens.cjs +19 -8
  328. package/dist/utils/use-tokens.cjs.map +1 -1
  329. package/dist/utils/use-tokens.d.cts +11 -6
  330. package/dist/utils/use-tokens.d.ts +11 -6
  331. package/dist/utils/use-tokens.js +18 -8
  332. package/dist/utils/use-tokens.js.map +1 -1
  333. package/package.json +3 -3
  334. package/dist/components/collection-hero-banner.cjs +0 -118
  335. package/dist/components/collection-hero-banner.cjs.map +0 -1
  336. package/dist/components/collection-hero-banner.d.cts +0 -20
  337. package/dist/components/collection-hero-banner.d.ts +0 -20
  338. package/dist/components/collection-hero-banner.js +0 -94
  339. package/dist/components/collection-hero-banner.js.map +0 -1
@@ -1,13 +1,12 @@
1
1
  import * as swr from 'swr';
2
- import { MedialaneClient } from '@medialane/sdk/starknet';
3
2
  import { ApiUserRewards, ApiRewardsLeaderboardEntry, ApiRewardsBatchEntry, ApiRewardsConfig, ApiPointEvent } from '@medialane/sdk';
4
3
 
5
4
  type UserRewards = ApiUserRewards;
6
5
  type LeaderboardEntry = ApiRewardsLeaderboardEntry;
7
6
  type BadgeSummary = ApiUserRewards["badges"][number];
8
7
  type LevelSummary = NonNullable<ApiUserRewards["nextLevel"]>;
9
- declare function useRewards(getClient: () => MedialaneClient, address: string | null | undefined): swr.SWRResponse<ApiUserRewards, any, swr.SWRConfiguration<ApiUserRewards, any, swr.BareFetcher<ApiUserRewards>> | undefined>;
10
- declare function useLeaderboard(getClient: () => MedialaneClient, page?: number, limit?: number): swr.SWRResponse<{
8
+ declare function useRewards(address: string | null | undefined): swr.SWRResponse<ApiUserRewards, any, swr.SWRConfiguration<ApiUserRewards, any, swr.BareFetcher<ApiUserRewards>> | undefined>;
9
+ declare function useLeaderboard(page?: number, limit?: number): swr.SWRResponse<{
11
10
  data: ApiRewardsLeaderboardEntry[];
12
11
  meta: {
13
12
  page: number;
@@ -29,7 +28,7 @@ declare function useLeaderboard(getClient: () => MedialaneClient, page?: number,
29
28
  total: number;
30
29
  };
31
30
  }>> | undefined>;
32
- declare function useRewardsEvents(getClient: () => MedialaneClient, address: string | null | undefined, page?: number, limit?: number): swr.SWRResponse<{
31
+ declare function useRewardsEvents(address: string | null | undefined, page?: number, limit?: number): swr.SWRResponse<{
33
32
  data: ApiPointEvent[];
34
33
  meta: {
35
34
  page: number;
@@ -51,7 +50,7 @@ declare function useRewardsEvents(getClient: () => MedialaneClient, address: str
51
50
  total: number;
52
51
  };
53
52
  }>> | undefined>;
54
- declare function useRewardsConfig(getClient: () => MedialaneClient): swr.SWRResponse<ApiRewardsConfig, any, swr.SWRConfiguration<ApiRewardsConfig, any, swr.BareFetcher<ApiRewardsConfig>> | undefined>;
55
- declare function useRewardsBatch(getClient: () => MedialaneClient, addresses: string[]): swr.SWRResponse<Map<string, ApiRewardsBatchEntry>, any, swr.SWRConfiguration<Map<string, ApiRewardsBatchEntry>, any, swr.BareFetcher<Map<string, ApiRewardsBatchEntry>>> | undefined>;
53
+ declare function useRewardsConfig(): swr.SWRResponse<ApiRewardsConfig, any, swr.SWRConfiguration<ApiRewardsConfig, any, swr.BareFetcher<ApiRewardsConfig>> | undefined>;
54
+ declare function useRewardsBatch(addresses: string[]): swr.SWRResponse<Map<string, ApiRewardsBatchEntry>, any, swr.SWRConfiguration<Map<string, ApiRewardsBatchEntry>, any, swr.BareFetcher<Map<string, ApiRewardsBatchEntry>>> | undefined>;
56
55
 
57
56
  export { type BadgeSummary, type LeaderboardEntry, type LevelSummary, type UserRewards, useLeaderboard, useRewards, useRewardsBatch, useRewardsConfig, useRewardsEvents };
@@ -1,13 +1,12 @@
1
1
  import * as swr from 'swr';
2
- import { MedialaneClient } from '@medialane/sdk/starknet';
3
2
  import { ApiUserRewards, ApiRewardsLeaderboardEntry, ApiRewardsBatchEntry, ApiRewardsConfig, ApiPointEvent } from '@medialane/sdk';
4
3
 
5
4
  type UserRewards = ApiUserRewards;
6
5
  type LeaderboardEntry = ApiRewardsLeaderboardEntry;
7
6
  type BadgeSummary = ApiUserRewards["badges"][number];
8
7
  type LevelSummary = NonNullable<ApiUserRewards["nextLevel"]>;
9
- declare function useRewards(getClient: () => MedialaneClient, address: string | null | undefined): swr.SWRResponse<ApiUserRewards, any, swr.SWRConfiguration<ApiUserRewards, any, swr.BareFetcher<ApiUserRewards>> | undefined>;
10
- declare function useLeaderboard(getClient: () => MedialaneClient, page?: number, limit?: number): swr.SWRResponse<{
8
+ declare function useRewards(address: string | null | undefined): swr.SWRResponse<ApiUserRewards, any, swr.SWRConfiguration<ApiUserRewards, any, swr.BareFetcher<ApiUserRewards>> | undefined>;
9
+ declare function useLeaderboard(page?: number, limit?: number): swr.SWRResponse<{
11
10
  data: ApiRewardsLeaderboardEntry[];
12
11
  meta: {
13
12
  page: number;
@@ -29,7 +28,7 @@ declare function useLeaderboard(getClient: () => MedialaneClient, page?: number,
29
28
  total: number;
30
29
  };
31
30
  }>> | undefined>;
32
- declare function useRewardsEvents(getClient: () => MedialaneClient, address: string | null | undefined, page?: number, limit?: number): swr.SWRResponse<{
31
+ declare function useRewardsEvents(address: string | null | undefined, page?: number, limit?: number): swr.SWRResponse<{
33
32
  data: ApiPointEvent[];
34
33
  meta: {
35
34
  page: number;
@@ -51,7 +50,7 @@ declare function useRewardsEvents(getClient: () => MedialaneClient, address: str
51
50
  total: number;
52
51
  };
53
52
  }>> | undefined>;
54
- declare function useRewardsConfig(getClient: () => MedialaneClient): swr.SWRResponse<ApiRewardsConfig, any, swr.SWRConfiguration<ApiRewardsConfig, any, swr.BareFetcher<ApiRewardsConfig>> | undefined>;
55
- declare function useRewardsBatch(getClient: () => MedialaneClient, addresses: string[]): swr.SWRResponse<Map<string, ApiRewardsBatchEntry>, any, swr.SWRConfiguration<Map<string, ApiRewardsBatchEntry>, any, swr.BareFetcher<Map<string, ApiRewardsBatchEntry>>> | undefined>;
53
+ declare function useRewardsConfig(): swr.SWRResponse<ApiRewardsConfig, any, swr.SWRConfiguration<ApiRewardsConfig, any, swr.BareFetcher<ApiRewardsConfig>> | undefined>;
54
+ declare function useRewardsBatch(addresses: string[]): swr.SWRResponse<Map<string, ApiRewardsBatchEntry>, any, swr.SWRConfiguration<Map<string, ApiRewardsBatchEntry>, any, swr.BareFetcher<Map<string, ApiRewardsBatchEntry>>> | undefined>;
56
55
 
57
56
  export { type BadgeSummary, type LeaderboardEntry, type LevelSummary, type UserRewards, useLeaderboard, useRewards, useRewardsBatch, useRewardsConfig, useRewardsEvents };
@@ -1,13 +1,16 @@
1
1
  "use client";
2
2
  import useSWR from "swr";
3
- function useRewards(getClient, address) {
3
+ import { useMedialaneApp } from "../components/medialane-app.js";
4
+ function useRewards(address) {
5
+ const { getClient } = useMedialaneApp();
4
6
  return useSWR(
5
7
  address ? `rewards:${address}` : null,
6
8
  () => getClient().api.getRewards(address),
7
9
  { revalidateOnFocus: false, dedupingInterval: 6e4 }
8
10
  );
9
11
  }
10
- function useLeaderboard(getClient, page = 1, limit = 50) {
12
+ function useLeaderboard(page = 1, limit = 50) {
13
+ const { getClient } = useMedialaneApp();
11
14
  return useSWR(
12
15
  `rewards-leaderboard:${page}:${limit}`,
13
16
  async () => {
@@ -20,7 +23,8 @@ function useLeaderboard(getClient, page = 1, limit = 50) {
20
23
  { revalidateOnFocus: false, dedupingInterval: 12e4 }
21
24
  );
22
25
  }
23
- function useRewardsEvents(getClient, address, page = 1, limit = 20) {
26
+ function useRewardsEvents(address, page = 1, limit = 20) {
27
+ const { getClient } = useMedialaneApp();
24
28
  return useSWR(
25
29
  address ? `rewards-events:${address}:${page}:${limit}` : null,
26
30
  async () => {
@@ -33,14 +37,16 @@ function useRewardsEvents(getClient, address, page = 1, limit = 20) {
33
37
  { revalidateOnFocus: false, dedupingInterval: 6e4 }
34
38
  );
35
39
  }
36
- function useRewardsConfig(getClient) {
40
+ function useRewardsConfig() {
41
+ const { getClient } = useMedialaneApp();
37
42
  return useSWR(
38
43
  "rewards-config",
39
44
  () => getClient().api.getRewardsConfig(),
40
45
  { revalidateOnFocus: false, dedupingInterval: 3e5 }
41
46
  );
42
47
  }
43
- function useRewardsBatch(getClient, addresses) {
48
+ function useRewardsBatch(addresses) {
49
+ const { getClient } = useMedialaneApp();
44
50
  const unique = [...new Set(addresses)].slice(0, 50);
45
51
  const key = unique.length ? `rewards-batch:${[...unique].sort().join(",")}` : null;
46
52
  return useSWR(
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/utils/use-rewards.ts"],"sourcesContent":["\"use client\";\n\nimport useSWR from \"swr\";\nimport type { MedialaneClient } from \"@medialane/sdk/starknet\";\nimport type {\n ApiUserRewards,\n ApiRewardsLeaderboardEntry,\n ApiRewardsConfig,\n ApiRewardsBatchEntry,\n ApiPointEvent,\n} from \"@medialane/sdk\";\n\nexport type UserRewards = ApiUserRewards;\nexport type LeaderboardEntry = ApiRewardsLeaderboardEntry;\nexport type BadgeSummary = ApiUserRewards[\"badges\"][number];\nexport type LevelSummary = NonNullable<ApiUserRewards[\"nextLevel\"]>;\n\nexport function useRewards(getClient: () => MedialaneClient, address: string | null | undefined) {\n return useSWR<ApiUserRewards>(\n address ? `rewards:${address}` : null,\n () => getClient().api.getRewards(address!),\n { revalidateOnFocus: false, dedupingInterval: 60_000 }\n );\n}\n\nexport function useLeaderboard(getClient: () => MedialaneClient, page = 1, limit = 50) {\n return useSWR<{ data: ApiRewardsLeaderboardEntry[]; meta: { page: number; limit: number; total: number } }>(\n `rewards-leaderboard:${page}:${limit}`,\n async () => {\n const res = await getClient().api.getRewardsLeaderboard(page, limit);\n return {\n data: res.data,\n meta: { page: res.meta?.page ?? page, limit: res.meta?.limit ?? limit, total: res.meta?.total ?? res.data.length },\n };\n },\n { revalidateOnFocus: false, dedupingInterval: 120_000 }\n );\n}\n\nexport function useRewardsEvents(\n getClient: () => MedialaneClient,\n address: string | null | undefined,\n page = 1,\n limit = 20\n) {\n return useSWR<{ data: ApiPointEvent[]; meta: { page: number; limit: number; total: number } }>(\n address ? `rewards-events:${address}:${page}:${limit}` : null,\n async () => {\n const res = await getClient().api.getRewardsEvents(address!, page, limit);\n return {\n data: res.data,\n meta: { page: res.meta?.page ?? page, limit: res.meta?.limit ?? limit, total: res.meta?.total ?? res.data.length },\n };\n },\n { revalidateOnFocus: false, dedupingInterval: 60_000 }\n );\n}\n\nexport function useRewardsConfig(getClient: () => MedialaneClient) {\n return useSWR<ApiRewardsConfig>(\n \"rewards-config\",\n () => getClient().api.getRewardsConfig(),\n { revalidateOnFocus: false, dedupingInterval: 300_000 }\n );\n}\n\nexport function useRewardsBatch(getClient: () => MedialaneClient, addresses: string[]) {\n const unique = [...new Set(addresses)].slice(0, 50);\n const key = unique.length ? `rewards-batch:${[...unique].sort().join(\",\")}` : null;\n return useSWR<Map<string, ApiRewardsBatchEntry>>(\n key,\n async () => {\n const entries = await getClient().api.getRewardsBatch(unique);\n return new Map(entries.map((e) => [e.address, e]));\n },\n { revalidateOnFocus: false, dedupingInterval: 120_000 }\n );\n}\n"],"mappings":";AAEA,OAAO,YAAY;AAeZ,SAAS,WAAW,WAAkC,SAAoC;AAC/F,SAAO;AAAA,IACL,UAAU,WAAW,OAAO,KAAK;AAAA,IACjC,MAAM,UAAU,EAAE,IAAI,WAAW,OAAQ;AAAA,IACzC,EAAE,mBAAmB,OAAO,kBAAkB,IAAO;AAAA,EACvD;AACF;AAEO,SAAS,eAAe,WAAkC,OAAO,GAAG,QAAQ,IAAI;AACrF,SAAO;AAAA,IACL,uBAAuB,IAAI,IAAI,KAAK;AAAA,IACpC,YAAY;AACV,YAAM,MAAM,MAAM,UAAU,EAAE,IAAI,sBAAsB,MAAM,KAAK;AACnE,aAAO;AAAA,QACL,MAAM,IAAI;AAAA,QACV,MAAM,EAAE,MAAM,IAAI,MAAM,QAAQ,MAAM,OAAO,IAAI,MAAM,SAAS,OAAO,OAAO,IAAI,MAAM,SAAS,IAAI,KAAK,OAAO;AAAA,MACnH;AAAA,IACF;AAAA,IACA,EAAE,mBAAmB,OAAO,kBAAkB,KAAQ;AAAA,EACxD;AACF;AAEO,SAAS,iBACd,WACA,SACA,OAAO,GACP,QAAQ,IACR;AACA,SAAO;AAAA,IACL,UAAU,kBAAkB,OAAO,IAAI,IAAI,IAAI,KAAK,KAAK;AAAA,IACzD,YAAY;AACV,YAAM,MAAM,MAAM,UAAU,EAAE,IAAI,iBAAiB,SAAU,MAAM,KAAK;AACxE,aAAO;AAAA,QACL,MAAM,IAAI;AAAA,QACV,MAAM,EAAE,MAAM,IAAI,MAAM,QAAQ,MAAM,OAAO,IAAI,MAAM,SAAS,OAAO,OAAO,IAAI,MAAM,SAAS,IAAI,KAAK,OAAO;AAAA,MACnH;AAAA,IACF;AAAA,IACA,EAAE,mBAAmB,OAAO,kBAAkB,IAAO;AAAA,EACvD;AACF;AAEO,SAAS,iBAAiB,WAAkC;AACjE,SAAO;AAAA,IACL;AAAA,IACA,MAAM,UAAU,EAAE,IAAI,iBAAiB;AAAA,IACvC,EAAE,mBAAmB,OAAO,kBAAkB,IAAQ;AAAA,EACxD;AACF;AAEO,SAAS,gBAAgB,WAAkC,WAAqB;AACrF,QAAM,SAAS,CAAC,GAAG,IAAI,IAAI,SAAS,CAAC,EAAE,MAAM,GAAG,EAAE;AAClD,QAAM,MAAM,OAAO,SAAS,iBAAiB,CAAC,GAAG,MAAM,EAAE,KAAK,EAAE,KAAK,GAAG,CAAC,KAAK;AAC9E,SAAO;AAAA,IACL;AAAA,IACA,YAAY;AACV,YAAM,UAAU,MAAM,UAAU,EAAE,IAAI,gBAAgB,MAAM;AAC5D,aAAO,IAAI,IAAI,QAAQ,IAAI,CAAC,MAAM,CAAC,EAAE,SAAS,CAAC,CAAC,CAAC;AAAA,IACnD;AAAA,IACA,EAAE,mBAAmB,OAAO,kBAAkB,KAAQ;AAAA,EACxD;AACF;","names":[]}
1
+ {"version":3,"sources":["../../src/utils/use-rewards.ts"],"sourcesContent":["\"use client\";\n\nimport useSWR from \"swr\";\nimport type {\n ApiUserRewards,\n ApiRewardsLeaderboardEntry,\n ApiRewardsConfig,\n ApiRewardsBatchEntry,\n ApiPointEvent,\n} from \"@medialane/sdk\";\nimport { useMedialaneApp } from \"../components/medialane-app.js\";\n\nexport type UserRewards = ApiUserRewards;\nexport type LeaderboardEntry = ApiRewardsLeaderboardEntry;\nexport type BadgeSummary = ApiUserRewards[\"badges\"][number];\nexport type LevelSummary = NonNullable<ApiUserRewards[\"nextLevel\"]>;\n\nexport function useRewards( address: string | null | undefined) {\n const { getClient } = useMedialaneApp();\n return useSWR<ApiUserRewards>(\n address ? `rewards:${address}` : null,\n () => getClient().api.getRewards(address!),\n { revalidateOnFocus: false, dedupingInterval: 60_000 }\n );\n}\n\nexport function useLeaderboard( page = 1, limit = 50) {\n const { getClient } = useMedialaneApp();\n return useSWR<{ data: ApiRewardsLeaderboardEntry[]; meta: { page: number; limit: number; total: number } }>(\n `rewards-leaderboard:${page}:${limit}`,\n async () => {\n const res = await getClient().api.getRewardsLeaderboard(page, limit);\n return {\n data: res.data,\n meta: { page: res.meta?.page ?? page, limit: res.meta?.limit ?? limit, total: res.meta?.total ?? res.data.length },\n };\n },\n { revalidateOnFocus: false, dedupingInterval: 120_000 }\n );\n}\n\nexport function useRewardsEvents(\n address: string | null | undefined,\n page = 1,\n limit = 20\n) {\n const { getClient } = useMedialaneApp();\n return useSWR<{ data: ApiPointEvent[]; meta: { page: number; limit: number; total: number } }>(\n address ? `rewards-events:${address}:${page}:${limit}` : null,\n async () => {\n const res = await getClient().api.getRewardsEvents(address!, page, limit);\n return {\n data: res.data,\n meta: { page: res.meta?.page ?? page, limit: res.meta?.limit ?? limit, total: res.meta?.total ?? res.data.length },\n };\n },\n { revalidateOnFocus: false, dedupingInterval: 60_000 }\n );\n}\n\nexport function useRewardsConfig() {\n const { getClient } = useMedialaneApp();\n return useSWR<ApiRewardsConfig>(\n \"rewards-config\",\n () => getClient().api.getRewardsConfig(),\n { revalidateOnFocus: false, dedupingInterval: 300_000 }\n );\n}\n\nexport function useRewardsBatch( addresses: string[]) {\n const { getClient } = useMedialaneApp();\n const unique = [...new Set(addresses)].slice(0, 50);\n const key = unique.length ? `rewards-batch:${[...unique].sort().join(\",\")}` : null;\n return useSWR<Map<string, ApiRewardsBatchEntry>>(\n key,\n async () => {\n const entries = await getClient().api.getRewardsBatch(unique);\n return new Map(entries.map((e) => [e.address, e]));\n },\n { revalidateOnFocus: false, dedupingInterval: 120_000 }\n );\n}\n"],"mappings":";AAEA,OAAO,YAAY;AAQnB,SAAS,uBAAuB;AAOzB,SAAS,WAAY,SAAoC;AAC9D,QAAM,EAAE,UAAU,I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IAAI,iBAAiB;AAAA,IACvC,EAAE,mBAAmB,OAAO,kBAAkB,IAAQ;AAAA,EACxD;AACF;AAEO,SAAS,gBAAiB,WAAqB;AACpD,QAAM,EAAE,UAAU,IAAI,gBAAgB;AACtC,QAAM,SAAS,CAAC,GAAG,IAAI,IAAI,SAAS,CAAC,EAAE,MAAM,GAAG,EAAE;AAClD,QAAM,MAAM,OAAO,SAAS,iBAAiB,CAAC,GAAG,MAAM,EAAE,KAAK,EAAE,KAAK,GAAG,CAAC,KAAK;AAC9E,SAAO;AAAA,IACL;AAAA,IACA,YAAY;AACV,YAAM,UAAU,MAAM,UAAU,EAAE,IAAI,gBAAgB,MAAM;AAC5D,aAAO,IAAI,IAAI,QAAQ,IAAI,CAAC,MAAM,CAAC,EAAE,SAAS,CAAC,CAAC,CAAC;AAAA,IACnD;AAAA,IACA,EAAE,mBAAmB,OAAO,kBAAkB,KAAQ;AAAA,EACxD;AACF;","names":[]}
@@ -41,9 +41,9 @@ __export(use_sponsorship_exports, {
41
41
  module.exports = __toCommonJS(use_sponsorship_exports);
42
42
  var import_swr = __toESM(require("swr"), 1);
43
43
  var import_use_medialane_client = require("./use-medialane-client.js");
44
- function useSponsorshipOffers(getClient, params) {
44
+ function useSponsorshipOffers(params) {
45
45
  const key = `sponsorship-offers-${JSON.stringify(params ?? {})}`;
46
- const client = (0, import_use_medialane_client.useMedialaneClient)(getClient);
46
+ const client = (0, import_use_medialane_client.useMedialaneClient)();
47
47
  const { data, error, isLoading, mutate } = (0, import_swr.default)(
48
48
  key,
49
49
  () => client.api.getSponsorshipOffers({ ...params, limit: 50 }),
@@ -51,8 +51,8 @@ function useSponsorshipOffers(getClient, params) {
51
51
  );
52
52
  return { offers: data?.data ?? [], meta: data?.meta, isLoading, error, mutate };
53
53
  }
54
- function useSponsorshipOffer(getClient, offerId) {
55
- const client = (0, import_use_medialane_client.useMedialaneClient)(getClient);
54
+ function useSponsorshipOffer(offerId) {
55
+ const client = (0, import_use_medialane_client.useMedialaneClient)();
56
56
  const { data, error, isLoading, mutate } = (0, import_swr.default)(
57
57
  offerId ? `sponsorship-offer-${offerId}` : null,
58
58
  () => client.api.getSponsorshipOffer(offerId),
@@ -60,8 +60,8 @@ function useSponsorshipOffer(getClient, offerId) {
60
60
  );
61
61
  return { offer: data ?? null, isLoading, error, mutate };
62
62
  }
63
- function useSponsorshipBids(getClient, offerId) {
64
- const client = (0, import_use_medialane_client.useMedialaneClient)(getClient);
63
+ function useSponsorshipBids(offerId) {
64
+ const client = (0, import_use_medialane_client.useMedialaneClient)();
65
65
  const { data, error, isLoading, mutate } = (0, import_swr.default)(
66
66
  offerId ? `sponsorship-bids-${offerId}` : null,
67
67
  () => client.api.getSponsorshipBids(offerId),
@@ -69,9 +69,9 @@ function useSponsorshipBids(getClient, offerId) {
69
69
  );
70
70
  return { bids: data ?? [], isLoading, error, mutate };
71
71
  }
72
- function useSponsorshipProposals(getClient, params) {
72
+ function useSponsorshipProposals(params) {
73
73
  const key = `sponsorship-proposals-${JSON.stringify(params ?? {})}`;
74
- const client = (0, import_use_medialane_client.useMedialaneClient)(getClient);
74
+ const client = (0, import_use_medialane_client.useMedialaneClient)();
75
75
  const { data, error, isLoading, mutate } = (0, import_swr.default)(
76
76
  key,
77
77
  () => client.api.getSponsorshipProposals({ ...params, limit: 50 }),
@@ -79,8 +79,8 @@ function useSponsorshipProposals(getClient, params) {
79
79
  );
80
80
  return { proposals: data?.data ?? [], meta: data?.meta, isLoading, error, mutate };
81
81
  }
82
- function useSponsorshipProposal(getClient, proposalId) {
83
- const client = (0, import_use_medialane_client.useMedialaneClient)(getClient);
82
+ function useSponsorshipProposal(proposalId) {
83
+ const client = (0, import_use_medialane_client.useMedialaneClient)();
84
84
  const { data, error, isLoading, mutate } = (0, import_swr.default)(
85
85
  proposalId ? `sponsorship-proposal-${proposalId}` : null,
86
86
  () => client.api.getSponsorshipProposal(proposalId),
@@ -88,16 +88,15 @@ function useSponsorshipProposal(getClient, proposalId) {
88
88
  );
89
89
  return { proposal: data ?? null, isLoading, error, mutate };
90
90
  }
91
- function usePendingProposalsForAsset(getClient, nftContract) {
91
+ function usePendingProposalsForAsset(nftContract) {
92
92
  const { proposals, isLoading, error, mutate } = useSponsorshipProposals(
93
- getClient,
94
93
  nftContract ? { nftContract, open: true } : void 0
95
94
  );
96
95
  return { proposals: nftContract ? proposals : [], isLoading, error, mutate };
97
96
  }
98
- function useSponsorshipLicenses(getClient, params) {
97
+ function useSponsorshipLicenses(params) {
99
98
  const key = `sponsorship-licenses-${JSON.stringify(params ?? {})}`;
100
- const client = (0, import_use_medialane_client.useMedialaneClient)(getClient);
99
+ const client = (0, import_use_medialane_client.useMedialaneClient)();
101
100
  const { data, error, isLoading, mutate } = (0, import_swr.default)(
102
101
  key,
103
102
  () => client.api.getSponsorshipLicenses({ ...params, limit: 50 }),
@@ -105,13 +104,11 @@ function useSponsorshipLicenses(getClient, params) {
105
104
  );
106
105
  return { licenses: data?.data ?? [], meta: data?.meta, isLoading, error, mutate };
107
106
  }
108
- function useMySponsorshipDealCounts(getClient, walletAddress) {
107
+ function useMySponsorshipDealCounts(walletAddress) {
109
108
  const { proposals, isLoading: proposalsLoading } = useSponsorshipProposals(
110
- getClient,
111
109
  walletAddress ? { owner: walletAddress, open: true } : void 0
112
110
  );
113
111
  const { offers, isLoading: offersLoading } = useSponsorshipOffers(
114
- getClient,
115
112
  walletAddress ? { author: walletAddress, open: true } : void 0
116
113
  );
117
114
  void offers;
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/utils/use-sponsorship.ts"],"sourcesContent":["\"use client\";\n\nimport useSWR from \"swr\";\nimport type { ApiSponsorshipOffer, ApiSponsorshipBid, ApiSponsorshipProposal, ApiSponsorshipLicense, ApiResponse } from \"@medialane/sdk\";\nimport type { MedialaneClient } from \"@medialane/sdk/starknet\";\nimport { useMedialaneClient } from \"./use-medialane-client.js\";\n\nexport type {\n ApiSponsorshipOffer as SponsorshipOffer,\n ApiSponsorshipBid as SponsorshipBid,\n ApiSponsorshipProposal as SponsorshipProposal,\n ApiSponsorshipLicense as SponsorshipLicense,\n} from \"@medialane/sdk\";\n\nexport function useSponsorshipOffers(getClient: () => MedialaneClient, params?: { nftContract?: string; author?: string; owner?: string; open?: boolean }) {\n const key = `sponsorship-offers-${JSON.stringify(params ?? {})}`;\n const client = useMedialaneClient(getClient);\n const { data, error, isLoading, mutate } = useSWR<ApiResponse<ApiSponsorshipOffer[]>>(\n key,\n () => client.api.getSponsorshipOffers({ ...params, limit: 50 }),\n { revalidateOnFocus: false }\n );\n\n return { offers: data?.data ?? [], meta: data?.meta, isLoading, error, mutate };\n}\n\nexport function useSponsorshipOffer(getClient: () => MedialaneClient, offerId: string | null) {\n const client = useMedialaneClient(getClient);\n const { data, error, isLoading, mutate } = useSWR<ApiSponsorshipOffer | null>(\n offerId ? `sponsorship-offer-${offerId}` : null,\n () => client.api.getSponsorshipOffer(offerId!),\n { revalidateOnFocus: false }\n );\n\n return { offer: data ?? null, isLoading, error, mutate };\n}\n\nexport function useSponsorshipBids(getClient: () => MedialaneClient, offerId: string | null) {\n const client = useMedialaneClient(getClient);\n const { data, error, isLoading, mutate } = useSWR<ApiSponsorshipBid[]>(\n offerId ? `sponsorship-bids-${offerId}` : null,\n () => client.api.getSponsorshipBids(offerId!),\n { revalidateOnFocus: false }\n );\n\n return { bids: data ?? [], isLoading, error, mutate };\n}\n\nexport function useSponsorshipProposals(getClient: () => MedialaneClient, params?: { nftContract?: string; proposer?: string; owner?: string; open?: boolean }) {\n const key = `sponsorship-proposals-${JSON.stringify(params ?? {})}`;\n const client = useMedialaneClient(getClient);\n const { data, error, isLoading, mutate } = useSWR<ApiResponse<ApiSponsorshipProposal[]>>(\n key,\n () => client.api.getSponsorshipProposals({ ...params, limit: 50 }),\n { revalidateOnFocus: false }\n );\n\n return { proposals: data?.data ?? [], meta: data?.meta, isLoading, error, mutate };\n}\n\nexport function useSponsorshipProposal(getClient: () => MedialaneClient, proposalId: string | null) {\n const client = useMedialaneClient(getClient);\n const { data, error, isLoading, mutate } = useSWR<ApiSponsorshipProposal | null>(\n proposalId ? `sponsorship-proposal-${proposalId}` : null,\n () => client.api.getSponsorshipProposal(proposalId!),\n { revalidateOnFocus: false }\n );\n\n return { proposal: data ?? null, isLoading, error, mutate };\n}\n\nexport function usePendingProposalsForAsset(getClient: () => MedialaneClient, nftContract: string | null) {\n const { proposals, isLoading, error, mutate } = useSponsorshipProposals(\n getClient,\n nftContract ? { nftContract, open: true } : undefined\n );\n return { proposals: nftContract ? proposals : [], isLoading, error, mutate };\n}\n\nexport function useSponsorshipLicenses(getClient: () => MedialaneClient, params?: { holder?: string; author?: string }) {\n const key = `sponsorship-licenses-${JSON.stringify(params ?? {})}`;\n const client = useMedialaneClient(getClient);\n const { data, error, isLoading, mutate } = useSWR<ApiResponse<ApiSponsorshipLicense[]>>(\n key,\n () => client.api.getSponsorshipLicenses({ ...params, limit: 50 }),\n { revalidateOnFocus: false }\n );\n\n return { licenses: data?.data ?? [], meta: data?.meta, isLoading, error, mutate };\n}\n\nexport function useMySponsorshipDealCounts(getClient: () => MedialaneClient, walletAddress: string | null) {\n const { proposals, isLoading: proposalsLoading } = useSponsorshipProposals(\n getClient,\n walletAddress ? { owner: walletAddress, open: true } : undefined\n );\n const { offers, isLoading: offersLoading } = useSponsorshipOffers(\n getClient,\n walletAddress ? { author: walletAddress, open: true } : undefined\n );\n\n void offers;\n return { pendingCount: proposals.length, isLoading: proposalsLoading || offersLoading };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,iBAAmB;AAGnB,kCAAmC;AAS5B,SAAS,qBAAqB,WAAkC,QAAoF;AACzJ,QAAM,MAAM,sBAAsB,KAAK,UAAU,UAAU,CAAC,CAAC,CAAC;AAC9D,QAAM,aAAS,gDAAmB,SAAS;AAC3C,QAAM,EAAE,MAAM,OAAO,WAAW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AC3C;AAAA,IACA,gBAAgB,EAAE,QAAQ,eAAe,MAAM,KAAK,IAAI;AAAA,EAC1D;AAEA,OAAK;AACL,SAAO,EAAE,cAAc,UAAU,QAAQ,WAAW,oBAAoB,cAAc;AACxF;","names":["useSWR"]}
1
+ {"version":3,"sources":["../../src/utils/use-sponsorship.ts"],"sourcesContent":["\"use client\";\n\nimport useSWR from \"swr\";\nimport type { ApiSponsorshipOffer, ApiSponsorshipBid, ApiSponsorshipProposal, ApiSponsorshipLicense, ApiResponse } from \"@medialane/sdk\";\nimport { useMedialaneClient } from \"./use-medialane-client.js\";\n\nexport type {\n ApiSponsorshipOffer as SponsorshipOffer,\n ApiSponsorshipBid as SponsorshipBid,\n ApiSponsorshipProposal as SponsorshipProposal,\n ApiSponsorshipLicense as SponsorshipLicense,\n} from \"@medialane/sdk\";\n\nexport function useSponsorshipOffers( params?: { nftContract?: string; author?: string; owner?: string; open?: boolean }) {\n const key = `sponsorship-offers-${JSON.stringify(params ?? {})}`;\n const client = useMedialaneClient();\n const { data, error, isLoading, mutate } = useSWR<ApiResponse<ApiSponsorshipOffer[]>>(\n key,\n () => client.api.getSponsorshipOffers({ ...params, limit: 50 }),\n { revalidateOnFocus: false }\n );\n\n return { offers: data?.data ?? [], meta: data?.meta, isLoading, error, mutate };\n}\n\nexport function useSponsorshipOffer( offerId: string | null) {\n const client = useMedialaneClient();\n const { data, error, isLoading, mutate } = useSWR<ApiSponsorshipOffer | null>(\n offerId ? `sponsorship-offer-${offerId}` : null,\n () => client.api.getSponsorshipOffer(offerId!),\n { revalidateOnFocus: false }\n );\n\n return { offer: data ?? null, isLoading, error, mutate };\n}\n\nexport function useSponsorshipBids( offerId: string | null) {\n const client = useMedialaneClient();\n const { data, error, isLoading, mutate } = useSWR<ApiSponsorshipBid[]>(\n offerId ? `sponsorship-bids-${offerId}` : null,\n () => client.api.getSponsorshipBids(offerId!),\n { revalidateOnFocus: false }\n );\n\n return { bids: data ?? [], isLoading, error, mutate };\n}\n\nexport function useSponsorshipProposals( params?: { nftContract?: string; proposer?: string; owner?: string; open?: boolean }) {\n const key = `sponsorship-proposals-${JSON.stringify(params ?? {})}`;\n const client = useMedialaneClient();\n const { data, error, isLoading, mutate } = useSWR<ApiResponse<ApiSponsorshipProposal[]>>(\n key,\n () => client.api.getSponsorshipProposals({ ...params, limit: 50 }),\n { revalidateOnFocus: false }\n );\n\n return { proposals: data?.data ?? [], meta: data?.meta, isLoading, error, mutate };\n}\n\nexport function useSponsorshipProposal( proposalId: string | null) {\n const client = useMedialaneClient();\n const { data, error, isLoading, mutate } = useSWR<ApiSponsorshipProposal | null>(\n proposalId ? `sponsorship-proposal-${proposalId}` : null,\n () => client.api.getSponsorshipProposal(proposalId!),\n { revalidateOnFocus: false }\n );\n\n return { proposal: data ?? null, isLoading, error, mutate };\n}\n\nexport function usePendingProposalsForAsset( nftContract: string | null) {\n const { proposals, isLoading, error, mutate } = useSponsorshipProposals(\n nftContract ? { nftContract, open: true } : undefined\n );\n return { proposals: nftContract ? proposals : [], isLoading, error, mutate };\n}\n\nexport function useSponsorshipLicenses( params?: { holder?: string; author?: string }) {\n const key = `sponsorship-licenses-${JSON.stringify(params ?? {})}`;\n const client = useMedialaneClient();\n const { data, error, isLoading, mutate } = useSWR<ApiResponse<ApiSponsorshipLicense[]>>(\n key,\n () => client.api.getSponsorshipLicenses({ ...params, limit: 50 }),\n { revalidateOnFocus: false }\n );\n\n return { licenses: data?.data ?? [], meta: data?.meta, isLoading, error, mutate };\n}\n\nexport function useMySponsorshipDealCounts( walletAddress: string | null) {\n const { proposals, isLoading: proposalsLoading } = useSponsorshipProposals(\n walletAddress ? { owner: walletAddress, open: true } : undefined\n );\n const { offers, isLoading: offersLoading } = useSponsorshipOffers(\n walletAddress ? { author: walletAddress, open: true } : undefined\n );\n\n void offers;\n return { pendingCount: proposals.length, isLoading: proposalsLoading || offersLoading };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;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AAiB,IAAI;AAAA,IACjD,gBAAgB,EAAE,OAAO,eAAe,MAAM,KAAK,IAAI;AAAA,EACzD;AACA,QAAM,EAAE,QAAQ,WAAW,cAAc,IAAI;AAAA,IAC3C,gBAAgB,EAAE,QAAQ,eAAe,MAAM,KAAK,IAAI;AAAA,EAC1D;AAEA,OAAK;AACL,SAAO,EAAE,cAAc,UAAU,QAAQ,WAAW,oBAAoB,cAAc;AACxF;","names":["useSWR"]}
@@ -2,9 +2,8 @@ import * as swr from 'swr';
2
2
  import * as _medialane_sdk from '@medialane/sdk';
3
3
  import { ApiSponsorshipProposal, ApiResponse, ApiSponsorshipBid, ApiSponsorshipLicense, ApiSponsorshipOffer } from '@medialane/sdk';
4
4
  export { ApiSponsorshipBid as SponsorshipBid, ApiSponsorshipLicense as SponsorshipLicense, ApiSponsorshipOffer as SponsorshipOffer, ApiSponsorshipProposal as SponsorshipProposal } from '@medialane/sdk';
5
- import { MedialaneClient } from '@medialane/sdk/starknet';
6
5
 
7
- declare function useSponsorshipOffers(getClient: () => MedialaneClient, params?: {
6
+ declare function useSponsorshipOffers(params?: {
8
7
  nftContract?: string;
9
8
  author?: string;
10
9
  owner?: string;
@@ -16,19 +15,19 @@ declare function useSponsorshipOffers(getClient: () => MedialaneClient, params?:
16
15
  error: any;
17
16
  mutate: swr.KeyedMutator<ApiResponse<ApiSponsorshipOffer[]>>;
18
17
  };
19
- declare function useSponsorshipOffer(getClient: () => MedialaneClient, offerId: string | null): {
18
+ declare function useSponsorshipOffer(offerId: string | null): {
20
19
  offer: ApiSponsorshipOffer | null;
21
20
  isLoading: boolean;
22
21
  error: any;
23
22
  mutate: swr.KeyedMutator<ApiSponsorshipOffer | null>;
24
23
  };
25
- declare function useSponsorshipBids(getClient: () => MedialaneClient, offerId: string | null): {
24
+ declare function useSponsorshipBids(offerId: string | null): {
26
25
  bids: ApiSponsorshipBid[];
27
26
  isLoading: boolean;
28
27
  error: any;
29
28
  mutate: swr.KeyedMutator<ApiSponsorshipBid[]>;
30
29
  };
31
- declare function useSponsorshipProposals(getClient: () => MedialaneClient, params?: {
30
+ declare function useSponsorshipProposals(params?: {
32
31
  nftContract?: string;
33
32
  proposer?: string;
34
33
  owner?: string;
@@ -40,19 +39,19 @@ declare function useSponsorshipProposals(getClient: () => MedialaneClient, param
40
39
  error: any;
41
40
  mutate: swr.KeyedMutator<ApiResponse<ApiSponsorshipProposal[]>>;
42
41
  };
43
- declare function useSponsorshipProposal(getClient: () => MedialaneClient, proposalId: string | null): {
42
+ declare function useSponsorshipProposal(proposalId: string | null): {
44
43
  proposal: ApiSponsorshipProposal | null;
45
44
  isLoading: boolean;
46
45
  error: any;
47
46
  mutate: swr.KeyedMutator<ApiSponsorshipProposal | null>;
48
47
  };
49
- declare function usePendingProposalsForAsset(getClient: () => MedialaneClient, nftContract: string | null): {
48
+ declare function usePendingProposalsForAsset(nftContract: string | null): {
50
49
  proposals: ApiSponsorshipProposal[];
51
50
  isLoading: boolean;
52
51
  error: any;
53
52
  mutate: swr.KeyedMutator<ApiResponse<ApiSponsorshipProposal[]>>;
54
53
  };
55
- declare function useSponsorshipLicenses(getClient: () => MedialaneClient, params?: {
54
+ declare function useSponsorshipLicenses(params?: {
56
55
  holder?: string;
57
56
  author?: string;
58
57
  }): {
@@ -62,7 +61,7 @@ declare function useSponsorshipLicenses(getClient: () => MedialaneClient, params
62
61
  error: any;
63
62
  mutate: swr.KeyedMutator<ApiResponse<ApiSponsorshipLicense[]>>;
64
63
  };
65
- declare function useMySponsorshipDealCounts(getClient: () => MedialaneClient, walletAddress: string | null): {
64
+ declare function useMySponsorshipDealCounts(walletAddress: string | null): {
66
65
  pendingCount: number;
67
66
  isLoading: boolean;
68
67
  };
@@ -2,9 +2,8 @@ import * as swr from 'swr';
2
2
  import * as _medialane_sdk from '@medialane/sdk';
3
3
  import { ApiSponsorshipProposal, ApiResponse, ApiSponsorshipBid, ApiSponsorshipLicense, ApiSponsorshipOffer } from '@medialane/sdk';
4
4
  export { ApiSponsorshipBid as SponsorshipBid, ApiSponsorshipLicense as SponsorshipLicense, ApiSponsorshipOffer as SponsorshipOffer, ApiSponsorshipProposal as SponsorshipProposal } from '@medialane/sdk';
5
- import { MedialaneClient } from '@medialane/sdk/starknet';
6
5
 
7
- declare function useSponsorshipOffers(getClient: () => MedialaneClient, params?: {
6
+ declare function useSponsorshipOffers(params?: {
8
7
  nftContract?: string;
9
8
  author?: string;
10
9
  owner?: string;
@@ -16,19 +15,19 @@ declare function useSponsorshipOffers(getClient: () => MedialaneClient, params?:
16
15
  error: any;
17
16
  mutate: swr.KeyedMutator<ApiResponse<ApiSponsorshipOffer[]>>;
18
17
  };
19
- declare function useSponsorshipOffer(getClient: () => MedialaneClient, offerId: string | null): {
18
+ declare function useSponsorshipOffer(offerId: string | null): {
20
19
  offer: ApiSponsorshipOffer | null;
21
20
  isLoading: boolean;
22
21
  error: any;
23
22
  mutate: swr.KeyedMutator<ApiSponsorshipOffer | null>;
24
23
  };
25
- declare function useSponsorshipBids(getClient: () => MedialaneClient, offerId: string | null): {
24
+ declare function useSponsorshipBids(offerId: string | null): {
26
25
  bids: ApiSponsorshipBid[];
27
26
  isLoading: boolean;
28
27
  error: any;
29
28
  mutate: swr.KeyedMutator<ApiSponsorshipBid[]>;
30
29
  };
31
- declare function useSponsorshipProposals(getClient: () => MedialaneClient, params?: {
30
+ declare function useSponsorshipProposals(params?: {
32
31
  nftContract?: string;
33
32
  proposer?: string;
34
33
  owner?: string;
@@ -40,19 +39,19 @@ declare function useSponsorshipProposals(getClient: () => MedialaneClient, param
40
39
  error: any;
41
40
  mutate: swr.KeyedMutator<ApiResponse<ApiSponsorshipProposal[]>>;
42
41
  };
43
- declare function useSponsorshipProposal(getClient: () => MedialaneClient, proposalId: string | null): {
42
+ declare function useSponsorshipProposal(proposalId: string | null): {
44
43
  proposal: ApiSponsorshipProposal | null;
45
44
  isLoading: boolean;
46
45
  error: any;
47
46
  mutate: swr.KeyedMutator<ApiSponsorshipProposal | null>;
48
47
  };
49
- declare function usePendingProposalsForAsset(getClient: () => MedialaneClient, nftContract: string | null): {
48
+ declare function usePendingProposalsForAsset(nftContract: string | null): {
50
49
  proposals: ApiSponsorshipProposal[];
51
50
  isLoading: boolean;
52
51
  error: any;
53
52
  mutate: swr.KeyedMutator<ApiResponse<ApiSponsorshipProposal[]>>;
54
53
  };
55
- declare function useSponsorshipLicenses(getClient: () => MedialaneClient, params?: {
54
+ declare function useSponsorshipLicenses(params?: {
56
55
  holder?: string;
57
56
  author?: string;
58
57
  }): {
@@ -62,7 +61,7 @@ declare function useSponsorshipLicenses(getClient: () => MedialaneClient, params
62
61
  error: any;
63
62
  mutate: swr.KeyedMutator<ApiResponse<ApiSponsorshipLicense[]>>;
64
63
  };
65
- declare function useMySponsorshipDealCounts(getClient: () => MedialaneClient, walletAddress: string | null): {
64
+ declare function useMySponsorshipDealCounts(walletAddress: string | null): {
66
65
  pendingCount: number;
67
66
  isLoading: boolean;
68
67
  };
@@ -1,9 +1,9 @@
1
1
  "use client";
2
2
  import useSWR from "swr";
3
3
  import { useMedialaneClient } from "./use-medialane-client.js";
4
- function useSponsorshipOffers(getClient, params) {
4
+ function useSponsorshipOffers(params) {
5
5
  const key = `sponsorship-offers-${JSON.stringify(params ?? {})}`;
6
- const client = useMedialaneClient(getClient);
6
+ const client = useMedialaneClient();
7
7
  const { data, error, isLoading, mutate } = useSWR(
8
8
  key,
9
9
  () => client.api.getSponsorshipOffers({ ...params, limit: 50 }),
@@ -11,8 +11,8 @@ function useSponsorshipOffers(getClient, params) {
11
11
  );
12
12
  return { offers: data?.data ?? [], meta: data?.meta, isLoading, error, mutate };
13
13
  }
14
- function useSponsorshipOffer(getClient, offerId) {
15
- const client = useMedialaneClient(getClient);
14
+ function useSponsorshipOffer(offerId) {
15
+ const client = useMedialaneClient();
16
16
  const { data, error, isLoading, mutate } = useSWR(
17
17
  offerId ? `sponsorship-offer-${offerId}` : null,
18
18
  () => client.api.getSponsorshipOffer(offerId),
@@ -20,8 +20,8 @@ function useSponsorshipOffer(getClient, offerId) {
20
20
  );
21
21
  return { offer: data ?? null, isLoading, error, mutate };
22
22
  }
23
- function useSponsorshipBids(getClient, offerId) {
24
- const client = useMedialaneClient(getClient);
23
+ function useSponsorshipBids(offerId) {
24
+ const client = useMedialaneClient();
25
25
  const { data, error, isLoading, mutate } = useSWR(
26
26
  offerId ? `sponsorship-bids-${offerId}` : null,
27
27
  () => client.api.getSponsorshipBids(offerId),
@@ -29,9 +29,9 @@ function useSponsorshipBids(getClient, offerId) {
29
29
  );
30
30
  return { bids: data ?? [], isLoading, error, mutate };
31
31
  }
32
- function useSponsorshipProposals(getClient, params) {
32
+ function useSponsorshipProposals(params) {
33
33
  const key = `sponsorship-proposals-${JSON.stringify(params ?? {})}`;
34
- const client = useMedialaneClient(getClient);
34
+ const client = useMedialaneClient();
35
35
  const { data, error, isLoading, mutate } = useSWR(
36
36
  key,
37
37
  () => client.api.getSponsorshipProposals({ ...params, limit: 50 }),
@@ -39,8 +39,8 @@ function useSponsorshipProposals(getClient, params) {
39
39
  );
40
40
  return { proposals: data?.data ?? [], meta: data?.meta, isLoading, error, mutate };
41
41
  }
42
- function useSponsorshipProposal(getClient, proposalId) {
43
- const client = useMedialaneClient(getClient);
42
+ function useSponsorshipProposal(proposalId) {
43
+ const client = useMedialaneClient();
44
44
  const { data, error, isLoading, mutate } = useSWR(
45
45
  proposalId ? `sponsorship-proposal-${proposalId}` : null,
46
46
  () => client.api.getSponsorshipProposal(proposalId),
@@ -48,16 +48,15 @@ function useSponsorshipProposal(getClient, proposalId) {
48
48
  );
49
49
  return { proposal: data ?? null, isLoading, error, mutate };
50
50
  }
51
- function usePendingProposalsForAsset(getClient, nftContract) {
51
+ function usePendingProposalsForAsset(nftContract) {
52
52
  const { proposals, isLoading, error, mutate } = useSponsorshipProposals(
53
- getClient,
54
53
  nftContract ? { nftContract, open: true } : void 0
55
54
  );
56
55
  return { proposals: nftContract ? proposals : [], isLoading, error, mutate };
57
56
  }
58
- function useSponsorshipLicenses(getClient, params) {
57
+ function useSponsorshipLicenses(params) {
59
58
  const key = `sponsorship-licenses-${JSON.stringify(params ?? {})}`;
60
- const client = useMedialaneClient(getClient);
59
+ const client = useMedialaneClient();
61
60
  const { data, error, isLoading, mutate } = useSWR(
62
61
  key,
63
62
  () => client.api.getSponsorshipLicenses({ ...params, limit: 50 }),
@@ -65,13 +64,11 @@ function useSponsorshipLicenses(getClient, params) {
65
64
  );
66
65
  return { licenses: data?.data ?? [], meta: data?.meta, isLoading, error, mutate };
67
66
  }
68
- function useMySponsorshipDealCounts(getClient, walletAddress) {
67
+ function useMySponsorshipDealCounts(walletAddress) {
69
68
  const { proposals, isLoading: proposalsLoading } = useSponsorshipProposals(
70
- getClient,
71
69
  walletAddress ? { owner: walletAddress, open: true } : void 0
72
70
  );
73
71
  const { offers, isLoading: offersLoading } = useSponsorshipOffers(
74
- getClient,
75
72
  walletAddress ? { author: walletAddress, open: true } : void 0
76
73
  );
77
74
  void offers;
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/utils/use-sponsorship.ts"],"sourcesContent":["\"use client\";\n\nimport useSWR from \"swr\";\nimport type { ApiSponsorshipOffer, ApiSponsorshipBid, ApiSponsorshipProposal, ApiSponsorshipLicense, ApiResponse } from \"@medialane/sdk\";\nimport type { MedialaneClient } from \"@medialane/sdk/starknet\";\nimport { useMedialaneClient } from \"./use-medialane-client.js\";\n\nexport type {\n ApiSponsorshipOffer as SponsorshipOffer,\n ApiSponsorshipBid as SponsorshipBid,\n ApiSponsorshipProposal as SponsorshipProposal,\n ApiSponsorshipLicense as SponsorshipLicense,\n} from \"@medialane/sdk\";\n\nexport function useSponsorshipOffers(getClient: () => MedialaneClient, params?: { nftContract?: string; author?: string; owner?: string; open?: boolean }) {\n const key = `sponsorship-offers-${JSON.stringify(params ?? {})}`;\n const client = useMedialaneClient(getClient);\n const { data, error, isLoading, mutate } = useSWR<ApiResponse<ApiSponsorshipOffer[]>>(\n key,\n () => client.api.getSponsorshipOffers({ ...params, limit: 50 }),\n { revalidateOnFocus: false }\n );\n\n return { offers: data?.data ?? [], meta: data?.meta, isLoading, error, mutate };\n}\n\nexport function useSponsorshipOffer(getClient: () => MedialaneClient, offerId: string | null) {\n const client = useMedialaneClient(getClient);\n const { data, error, isLoading, mutate } = useSWR<ApiSponsorshipOffer | null>(\n offerId ? `sponsorship-offer-${offerId}` : null,\n () => client.api.getSponsorshipOffer(offerId!),\n { revalidateOnFocus: false }\n );\n\n return { offer: data ?? null, isLoading, error, mutate };\n}\n\nexport function useSponsorshipBids(getClient: () => MedialaneClient, offerId: string | null) {\n const client = useMedialaneClient(getClient);\n const { data, error, isLoading, mutate } = useSWR<ApiSponsorshipBid[]>(\n offerId ? `sponsorship-bids-${offerId}` : null,\n () => client.api.getSponsorshipBids(offerId!),\n { revalidateOnFocus: false }\n );\n\n return { bids: data ?? [], isLoading, error, mutate };\n}\n\nexport function useSponsorshipProposals(getClient: () => MedialaneClient, params?: { nftContract?: string; proposer?: string; owner?: string; open?: boolean }) {\n const key = `sponsorship-proposals-${JSON.stringify(params ?? {})}`;\n const client = useMedialaneClient(getClient);\n const { data, error, isLoading, mutate } = useSWR<ApiResponse<ApiSponsorshipProposal[]>>(\n key,\n () => client.api.getSponsorshipProposals({ ...params, limit: 50 }),\n { revalidateOnFocus: false }\n );\n\n return { proposals: data?.data ?? [], meta: data?.meta, isLoading, error, mutate };\n}\n\nexport function useSponsorshipProposal(getClient: () => MedialaneClient, proposalId: string | null) {\n const client = useMedialaneClient(getClient);\n const { data, error, isLoading, mutate } = useSWR<ApiSponsorshipProposal | null>(\n proposalId ? `sponsorship-proposal-${proposalId}` : null,\n () => client.api.getSponsorshipProposal(proposalId!),\n { revalidateOnFocus: false }\n );\n\n return { proposal: data ?? null, isLoading, error, mutate };\n}\n\nexport function usePendingProposalsForAsset(getClient: () => MedialaneClient, nftContract: string | null) {\n const { proposals, isLoading, error, mutate } = useSponsorshipProposals(\n getClient,\n nftContract ? { nftContract, open: true } : undefined\n );\n return { proposals: nftContract ? proposals : [], isLoading, error, mutate };\n}\n\nexport function useSponsorshipLicenses(getClient: () => MedialaneClient, params?: { holder?: string; author?: string }) {\n const key = `sponsorship-licenses-${JSON.stringify(params ?? {})}`;\n const client = useMedialaneClient(getClient);\n const { data, error, isLoading, mutate } = useSWR<ApiResponse<ApiSponsorshipLicense[]>>(\n key,\n () => client.api.getSponsorshipLicenses({ ...params, limit: 50 }),\n { revalidateOnFocus: false }\n );\n\n return { licenses: data?.data ?? [], meta: data?.meta, isLoading, error, mutate };\n}\n\nexport function useMySponsorshipDealCounts(getClient: () => MedialaneClient, walletAddress: string | null) {\n const { proposals, isLoading: proposalsLoading } = useSponsorshipProposals(\n getClient,\n walletAddress ? { owner: walletAddress, open: true } : undefined\n );\n const { offers, isLoading: offersLoading } = useSponsorshipOffers(\n getClient,\n walletAddress ? { author: walletAddress, open: true } : undefined\n );\n\n void offers;\n return { pendingCount: proposals.length, isLoading: proposalsLoading || offersLoading };\n}\n"],"mappings":";AAEA,OAAO,YAAY;AAGnB,SAAS,0BAA0B;AAS5B,SAAS,qBAAqB,WAAkC,QAAoF;AACzJ,QAAM,MAAM,sBAAsB,KAAK,UAAU,UAAU,CAAC,CAAC,CAAC;AAC9D,QAAM,SAAS,mBAAmB,SAAS;AAC3C,QAAM,EAAE,MAAM,OAAO,WAAW,OAAO,IAAI;AAAA,IACzC;AAAA,IACA,MAAM,OAAO,IAAI,qBAAqB,EAAE,GAAG,QAAQ,OAAO,GAAG,CAAC;AAAA,IAC9D,EAAE,mBAAmB,MAAM;AAAA,EAC7B;AAEA,SAAO,EAAE,QAAQ,MAAM,QAAQ,CAAC,GAAG,MAAM,MAAM,MAAM,WAAW,OAAO,OAAO;AAChF;AAEO,SAAS,oBAAoB,WAAkC,SAAwB;AAC5F,QAAM,SAAS,mBAAmB,SAAS;AAC3C,QAAM,EAAE,MAAM,OAAO,WAAW,OAAO,IAAI;AAAA,IACzC,UAAU,qBAAqB,OAAO,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QAAM,EAAE,WAAW,WAAW,OAAO,OAAO,IAAI;AAAA,IAC9C;AAAA,IACA,cAAc,EAAE,aAAa,MAAM,KAAK,IAAI;AAAA,EAC9C;AACA,SAAO,EAAE,WAAW,cAAc,YAAY,CAAC,GAAG,WAAW,OAAO,OAAO;AAC7E;AAEO,SAAS,uBAAuB,WAAkC,QAA+C;AACtH,QAAM,MAAM,wBAAwB,KAAK,UAAU,UAAU,CAAC,CAAC,CAAC;AAChE,QAAM,SAAS,mBAAmB,SAAS;AAC3C,QAAM,EAAE,MAAM,OAAO,WAAW,OAAO,IAAI;AAAA,IACzC;AAAA,IACA,MAAM,OAAO,IAAI,uBAAuB,EAAE,GAAG,QAAQ,OAAO,GAAG,CAAC;AAAA,IAChE,EAAE,mBAAmB,MAAM;AAAA,EAC7B;AAEA,SAAO,EAAE,UAAU,MAAM,QAAQ,CAAC,GAAG,MAAM,MAAM,MAAM,WAAW,OAAO,OAAO;AAClF;AAEO,SAAS,2BAA2B,WAAkC,eAA8B;AACzG,QAAM,EAAE,WAAW,WAAW,iBAAiB,IAAI;AAAA,IACjD;AAAA,IACA,gBAAgB,EAAE,OAAO,eAAe,MAAM,KAAK,IAAI;AAAA,EACzD;AACA,QAAM,EAAE,QAAQ,WAAW,cAAc,IAAI;AAAA,IAC3C;AAAA,IACA,gBAAgB,EAAE,QAAQ,eAAe,MAAM,KAAK,IAAI;AAAA,EAC1D;AAEA,OAAK;AACL,SAAO,EAAE,cAAc,UAAU,QAAQ,WAAW,oBAAoB,cAAc;AACxF;","names":[]}
1
+ {"version":3,"sources":["../../src/utils/use-sponsorship.ts"],"sourcesContent":["\"use client\";\n\nimport useSWR from \"swr\";\nimport type { ApiSponsorshipOffer, ApiSponsorshipBid, ApiSponsorshipProposal, ApiSponsorshipLicense, ApiResponse } from \"@medialane/sdk\";\nimport { useMedialaneClient } from \"./use-medialane-client.js\";\n\nexport type {\n ApiSponsorshipOffer as SponsorshipOffer,\n ApiSponsorshipBid as SponsorshipBid,\n ApiSponsorshipProposal as SponsorshipProposal,\n ApiSponsorshipLicense as SponsorshipLicense,\n} from \"@medialane/sdk\";\n\nexport function useSponsorshipOffers( params?: { nftContract?: string; author?: string; owner?: string; open?: boolean }) {\n const key = `sponsorship-offers-${JSON.stringify(params ?? {})}`;\n const client = useMedialaneClient();\n const { data, error, isLoading, mutate } = useSWR<ApiResponse<ApiSponsorshipOffer[]>>(\n key,\n () => client.api.getSponsorshipOffers({ ...params, limit: 50 }),\n { revalidateOnFocus: false }\n );\n\n return { offers: data?.data ?? [], meta: data?.meta, isLoading, error, mutate };\n}\n\nexport function useSponsorshipOffer( offerId: string | null) {\n const client = useMedialaneClient();\n const { data, error, isLoading, mutate } = useSWR<ApiSponsorshipOffer | null>(\n offerId ? `sponsorship-offer-${offerId}` : null,\n () => client.api.getSponsorshipOffer(offerId!),\n { revalidateOnFocus: false }\n );\n\n return { offer: data ?? null, isLoading, error, mutate };\n}\n\nexport function useSponsorshipBids( offerId: string | null) {\n const client = useMedialaneClient();\n const { data, error, isLoading, mutate } = useSWR<ApiSponsorshipBid[]>(\n offerId ? `sponsorship-bids-${offerId}` : null,\n () => client.api.getSponsorshipBids(offerId!),\n { revalidateOnFocus: false }\n );\n\n return { bids: data ?? [], isLoading, error, mutate };\n}\n\nexport function useSponsorshipProposals( params?: { nftContract?: string; proposer?: string; owner?: string; open?: boolean }) {\n const key = `sponsorship-proposals-${JSON.stringify(params ?? {})}`;\n const client = useMedialaneClient();\n const { data, error, isLoading, mutate } = useSWR<ApiResponse<ApiSponsorshipProposal[]>>(\n key,\n () => client.api.getSponsorshipProposals({ ...params, limit: 50 }),\n { revalidateOnFocus: false }\n );\n\n return { proposals: data?.data ?? [], meta: data?.meta, isLoading, error, mutate };\n}\n\nexport function useSponsorshipProposal( proposalId: string | null) {\n const client = useMedialaneClient();\n const { data, error, isLoading, mutate } = useSWR<ApiSponsorshipProposal | null>(\n proposalId ? `sponsorship-proposal-${proposalId}` : null,\n () => client.api.getSponsorshipProposal(proposalId!),\n { revalidateOnFocus: false }\n );\n\n return { proposal: data ?? null, isLoading, error, mutate };\n}\n\nexport function usePendingProposalsForAsset( nftContract: string | null) {\n const { proposals, isLoading, error, mutate } = useSponsorshipProposals(\n nftContract ? { nftContract, open: true } : undefined\n );\n return { proposals: nftContract ? proposals : [], isLoading, error, mutate };\n}\n\nexport function useSponsorshipLicenses( params?: { holder?: string; author?: string }) {\n const key = `sponsorship-licenses-${JSON.stringify(params ?? {})}`;\n const client = useMedialaneClient();\n const { data, error, isLoading, mutate } = useSWR<ApiResponse<ApiSponsorshipLicense[]>>(\n key,\n () => client.api.getSponsorshipLicenses({ ...params, limit: 50 }),\n { revalidateOnFocus: false }\n );\n\n return { licenses: data?.data ?? [], meta: data?.meta, isLoading, error, mutate };\n}\n\nexport function useMySponsorshipDealCounts( walletAddress: string | null) {\n const { proposals, isLoading: proposalsLoading } = useSponsorshipProposals(\n walletAddress ? { owner: walletAddress, open: true } : undefined\n );\n const { offers, isLoading: offersLoading } = useSponsorshipOffers(\n walletAddress ? { author: walletAddress, open: true } : undefined\n );\n\n void offers;\n return { pendingCount: proposals.length, isLoading: proposalsLoading || offersLoading };\n}\n"],"mappings":";AAEA,OAAO,YAAY;AAEnB,SAAS,0BAA0B;AAS5B,SAAS,qBAAsB,QAAoF;AACxH,QAAM,MAAM,sBAAsB,KAAK,UAAU,UAAU,CAAC,CAAC,CAAC;AAC9D,QAAM,SAAS,mBAAmB;AAClC,QAAM,EAAE,MAAM,OAAO,WAAW,OAAO,IAAI;AAAA,IACzC;AAAA,IACA,MAAM,OAAO,IAAI,qBAAqB,EAAE,GAAG,QAAQ,OAAO,GAAG,CAAC;AAAA,IAC9D,EAAE,mBAAmB,MAAM;AAAA,EAC7B;AAEA,SAAO,EAAE,QAAQ,MAAM,QAAQ,CAAC,GAAG,MAAM,MAAM,MAAM,WAAW,OAAO,OAAO;AAChF;AAEO,SAAS,oBAAqB,SAAwB;AAC3D,QAAM,SAAS,mBAAmB;AA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SAAS,4BAA6B,aAA4B;AACvE,QAAM,EAAE,WAAW,WAAW,OAAO,OAAO,IAAI;AAAA,IAC9C,cAAc,EAAE,aAAa,MAAM,KAAK,IAAI;AAAA,EAC9C;AACA,SAAO,EAAE,WAAW,cAAc,YAAY,CAAC,GAAG,WAAW,OAAO,OAAO;AAC7E;AAEO,SAAS,uBAAwB,QAA+C;AACrF,QAAM,MAAM,wBAAwB,KAAK,UAAU,UAAU,CAAC,CAAC,CAAC;AAChE,QAAM,SAAS,mBAAmB;AAClC,QAAM,EAAE,MAAM,OAAO,WAAW,OAAO,IAAI;AAAA,IACzC;AAAA,IACA,MAAM,OAAO,IAAI,uBAAuB,EAAE,GAAG,QAAQ,OAAO,GAAG,CAAC;AAAA,IAChE,EAAE,mBAAmB,MAAM;AAAA,EAC7B;AAEA,SAAO,EAAE,UAAU,MAAM,QAAQ,CAAC,GAAG,MAAM,MAAM,MAAM,WAAW,OAAO,OAAO;AAClF;AAEO,SAAS,2BAA4B,eAA8B;AACxE,QAAM,EAAE,WAAW,WAAW,iBAAiB,IAAI;AAAA,IACjD,gBAAgB,EAAE,OAAO,eAAe,MAAM,KAAK,IAAI;AAAA,EACzD;AACA,QAAM,EAAE,QAAQ,WAAW,cAAc,IAAI;AAAA,IAC3C,gBAAgB,EAAE,QAAQ,eAAe,MAAM,KAAK,IAAI;AAAA,EAC1D;AAEA,OAAK;AACL,SAAO,EAAE,cAAc,UAAU,QAAQ,WAAW,oBAAoB,cAAc;AACxF;","names":[]}
@@ -56,8 +56,8 @@ async function readAll(count, read) {
56
56
  const tiers = await Promise.all(ids.map(read));
57
57
  return tiers.map((tier, i) => ({ id: ids[i], ...toTier(tier) }));
58
58
  }
59
- function useMyCollectionsOf(getClient, service, owner) {
60
- const client = (0, import_use_medialane_client.useMedialaneClient)(getClient);
59
+ function useMyCollectionsOf(service, owner) {
60
+ const client = (0, import_use_medialane_client.useMedialaneClient)();
61
61
  const { data, error, isLoading, mutate } = (0, import_swr.default)(
62
62
  owner ? `my-${service}-collections-${owner}` : null,
63
63
  async () => (await client.api.listCollections({ owner, service, limit: 50 })).data ?? [],
@@ -71,14 +71,14 @@ async function predictNextMembershipId(api, contract) {
71
71
  async function predictNextTicketId(api, contract) {
72
72
  return await api.getTicketCount(contract) + 1;
73
73
  }
74
- function useMyClubCollections(getClient, owner) {
75
- return useMyCollectionsOf(getClient, "ip-club", owner);
74
+ function useMyClubCollections(owner) {
75
+ return useMyCollectionsOf("ip-club", owner);
76
76
  }
77
- function useMyTicketCollections(getClient, owner) {
78
- return useMyCollectionsOf(getClient, "ip-tickets", owner);
77
+ function useMyTicketCollections(owner) {
78
+ return useMyCollectionsOf("ip-tickets", owner);
79
79
  }
80
- function useMembershipList(getClient, contract) {
81
- const client = (0, import_use_medialane_client.useMedialaneClient)(getClient);
80
+ function useMembershipList(contract) {
81
+ const client = (0, import_use_medialane_client.useMedialaneClient)();
82
82
  const { data, error, isLoading, mutate } = (0, import_swr.default)(
83
83
  contract ? `membership-list-${contract}` : null,
84
84
  async () => readAll(await client.api.getClubMembershipCount(contract), (id) => client.api.getClubMembership(contract, id)),
@@ -86,8 +86,8 @@ function useMembershipList(getClient, contract) {
86
86
  );
87
87
  return { memberships: data ?? [], isLoading, error, mutate };
88
88
  }
89
- function useTicketList(getClient, contract) {
90
- const client = (0, import_use_medialane_client.useMedialaneClient)(getClient);
89
+ function useTicketList(contract) {
90
+ const client = (0, import_use_medialane_client.useMedialaneClient)();
91
91
  const { data, error, isLoading, mutate } = (0, import_swr.default)(
92
92
  contract ? `ticket-list-${contract}` : null,
93
93
  async () => readAll(await client.api.getTicketCount(contract), (id) => client.api.getTicket(contract, id)),
@@ -95,8 +95,8 @@ function useTicketList(getClient, contract) {
95
95
  );
96
96
  return { tickets: data ?? [], isLoading, error, mutate };
97
97
  }
98
- function useMembershipOnchain(getClient, contract, tokenId) {
99
- const client = (0, import_use_medialane_client.useMedialaneClient)(getClient);
98
+ function useMembershipOnchain(contract, tokenId) {
99
+ const client = (0, import_use_medialane_client.useMedialaneClient)();
100
100
  const { data, error, isLoading } = (0, import_swr.default)(
101
101
  contract && tokenId ? `membership-onchain-${contract}-${tokenId}` : null,
102
102
  async () => toTier(await client.api.getClubMembership(contract, tokenId)),
@@ -104,8 +104,8 @@ function useMembershipOnchain(getClient, contract, tokenId) {
104
104
  );
105
105
  return { membership: data ?? null, isLoading, error };
106
106
  }
107
- function useTicketOnchain(getClient, contract, tokenId) {
108
- const client = (0, import_use_medialane_client.useMedialaneClient)(getClient);
107
+ function useTicketOnchain(contract, tokenId) {
108
+ const client = (0, import_use_medialane_client.useMedialaneClient)();
109
109
  const { data, error, isLoading } = (0, import_swr.default)(
110
110
  contract && tokenId ? `ticket-onchain-${contract}-${tokenId}` : null,
111
111
  async () => toTier(await client.api.getTicket(contract, tokenId)),
@@ -113,8 +113,8 @@ function useTicketOnchain(getClient, contract, tokenId) {
113
113
  );
114
114
  return { ticket: data ?? null, isLoading, error };
115
115
  }
116
- function useIsMemberOf(getClient, contract, tokenId, wallet) {
117
- const client = (0, import_use_medialane_client.useMedialaneClient)(getClient);
116
+ function useIsMemberOf(contract, tokenId, wallet) {
117
+ const client = (0, import_use_medialane_client.useMedialaneClient)();
118
118
  const { data, error, isLoading } = (0, import_swr.default)(
119
119
  contract && tokenId && wallet ? `is-member-of-${contract}-${tokenId}-${wallet}` : null,
120
120
  () => client.api.isClubMember(contract, tokenId, wallet),