@medialane/ui 0.341.0 → 0.342.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 (101) hide show
  1. package/dist/components/account/input-otp.d.cts +2 -2
  2. package/dist/components/account/input-otp.d.ts +2 -2
  3. package/dist/components/activities-feed.cjs +0 -47
  4. package/dist/components/activities-feed.cjs.map +1 -1
  5. package/dist/components/activities-feed.js +1 -38
  6. package/dist/components/activities-feed.js.map +1 -1
  7. package/dist/components/badge.d.cts +1 -1
  8. package/dist/components/badge.d.ts +1 -1
  9. package/dist/components/button.d.cts +2 -2
  10. package/dist/components/button.d.ts +2 -2
  11. package/dist/components/launchpad/edition-mint-schema.d.cts +2 -2
  12. package/dist/components/launchpad/edition-mint-schema.d.ts +2 -2
  13. package/dist/components/sheet.d.cts +1 -1
  14. package/dist/components/sheet.d.ts +1 -1
  15. package/dist/index.cjs +0 -24
  16. package/dist/index.cjs.map +1 -1
  17. package/dist/index.d.cts +1 -6
  18. package/dist/index.d.ts +1 -6
  19. package/dist/index.js +1 -20
  20. package/dist/index.js.map +1 -1
  21. package/dist/utils/format-activity.cjs +2 -50
  22. package/dist/utils/format-activity.cjs.map +1 -1
  23. package/dist/utils/format-activity.d.cts +2 -5
  24. package/dist/utils/format-activity.d.ts +2 -5
  25. package/dist/utils/format-activity.js +1 -46
  26. package/dist/utils/format-activity.js.map +1 -1
  27. package/dist/utils/use-activities.cjs +2 -2
  28. package/dist/utils/use-activities.cjs.map +1 -1
  29. package/dist/utils/use-activities.js +2 -2
  30. package/dist/utils/use-activities.js.map +1 -1
  31. package/dist/utils/use-coin-price.cjs +1 -2
  32. package/dist/utils/use-coin-price.cjs.map +1 -1
  33. package/dist/utils/use-coin-price.js +1 -2
  34. package/dist/utils/use-coin-price.js.map +1 -1
  35. package/dist/utils/use-collections.cjs +1 -1
  36. package/dist/utils/use-collections.cjs.map +1 -1
  37. package/dist/utils/use-collections.js +1 -1
  38. package/dist/utils/use-collections.js.map +1 -1
  39. package/dist/utils/use-comments.cjs +1 -1
  40. package/dist/utils/use-comments.cjs.map +1 -1
  41. package/dist/utils/use-comments.js +1 -1
  42. package/dist/utils/use-comments.js.map +1 -1
  43. package/dist/utils/use-orders.cjs +4 -4
  44. package/dist/utils/use-orders.cjs.map +1 -1
  45. package/dist/utils/use-orders.js +4 -4
  46. package/dist/utils/use-orders.js.map +1 -1
  47. package/dist/utils/use-remix-offers.cjs +1 -1
  48. package/dist/utils/use-remix-offers.cjs.map +1 -1
  49. package/dist/utils/use-remix-offers.js +1 -1
  50. package/dist/utils/use-remix-offers.js.map +1 -1
  51. package/dist/utils/use-tokens-by-ip-type.cjs +1 -1
  52. package/dist/utils/use-tokens-by-ip-type.cjs.map +1 -1
  53. package/dist/utils/use-tokens-by-ip-type.js +1 -1
  54. package/dist/utils/use-tokens-by-ip-type.js.map +1 -1
  55. package/dist/utils/use-tokens.cjs +2 -2
  56. package/dist/utils/use-tokens.cjs.map +1 -1
  57. package/dist/utils/use-tokens.d.cts +1 -1
  58. package/dist/utils/use-tokens.d.ts +1 -1
  59. package/dist/utils/use-tokens.js +2 -2
  60. package/dist/utils/use-tokens.js.map +1 -1
  61. package/dist/utils/use-usd-prices.cjs +0 -1
  62. package/dist/utils/use-usd-prices.cjs.map +1 -1
  63. package/dist/utils/use-usd-prices.js +0 -1
  64. package/dist/utils/use-usd-prices.js.map +1 -1
  65. package/package.json +1 -1
  66. package/dist/components/notification-row.cjs +0 -117
  67. package/dist/components/notification-row.cjs.map +0 -1
  68. package/dist/components/notification-row.d.cts +0 -11
  69. package/dist/components/notification-row.d.ts +0 -11
  70. package/dist/components/notification-row.js +0 -83
  71. package/dist/components/notification-row.js.map +0 -1
  72. package/dist/data/notification-meta.cjs +0 -66
  73. package/dist/data/notification-meta.cjs.map +0 -1
  74. package/dist/data/notification-meta.d.cts +0 -7
  75. package/dist/data/notification-meta.d.ts +0 -7
  76. package/dist/data/notification-meta.js +0 -50
  77. package/dist/data/notification-meta.js.map +0 -1
  78. package/dist/data/notification.cjs +0 -17
  79. package/dist/data/notification.cjs.map +0 -1
  80. package/dist/data/notification.d.cts +0 -31
  81. package/dist/data/notification.d.ts +0 -31
  82. package/dist/data/notification.js +0 -1
  83. package/dist/data/notification.js.map +0 -1
  84. package/dist/utils/notification-readiness.cjs +0 -32
  85. package/dist/utils/notification-readiness.cjs.map +0 -1
  86. package/dist/utils/notification-readiness.d.cts +0 -9
  87. package/dist/utils/notification-readiness.d.ts +0 -9
  88. package/dist/utils/notification-readiness.js +0 -8
  89. package/dist/utils/notification-readiness.js.map +0 -1
  90. package/dist/utils/notification-storage.cjs +0 -52
  91. package/dist/utils/notification-storage.cjs.map +0 -1
  92. package/dist/utils/notification-storage.d.cts +0 -4
  93. package/dist/utils/notification-storage.d.ts +0 -4
  94. package/dist/utils/notification-storage.js +0 -27
  95. package/dist/utils/notification-storage.js.map +0 -1
  96. package/dist/utils/use-notifications.cjs +0 -182
  97. package/dist/utils/use-notifications.cjs.map +0 -1
  98. package/dist/utils/use-notifications.d.cts +0 -11
  99. package/dist/utils/use-notifications.d.ts +0 -11
  100. package/dist/utils/use-notifications.js +0 -153
  101. package/dist/utils/use-notifications.js.map +0 -1
@@ -1,27 +0,0 @@
1
- const KEY = "ml-notification-reads";
2
- function getReadIds() {
3
- if (typeof window === "undefined") return /* @__PURE__ */ new Set();
4
- try {
5
- const raw = localStorage.getItem(KEY);
6
- const parsed = raw ? JSON.parse(raw) : [];
7
- if (!Array.isArray(parsed)) return /* @__PURE__ */ new Set();
8
- return new Set(parsed);
9
- } catch {
10
- return /* @__PURE__ */ new Set();
11
- }
12
- }
13
- function markRead(ids) {
14
- if (typeof window === "undefined") return;
15
- try {
16
- const existing = getReadIds();
17
- ids.forEach((id) => existing.add(id));
18
- const arr = [...existing].slice(-1e3);
19
- localStorage.setItem(KEY, JSON.stringify(arr));
20
- } catch {
21
- }
22
- }
23
- export {
24
- getReadIds,
25
- markRead
26
- };
27
- //# sourceMappingURL=notification-storage.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/utils/notification-storage.ts"],"sourcesContent":["const KEY = \"ml-notification-reads\";\n\nexport function getReadIds(): Set<string> {\n if (typeof window === \"undefined\") return new Set();\n try {\n const raw = localStorage.getItem(KEY);\n const parsed: unknown = raw ? JSON.parse(raw) : [];\n if (!Array.isArray(parsed)) return new Set();\n return new Set(parsed as string[]);\n } catch {\n return new Set();\n }\n}\n\nexport function markRead(ids: string[]): void {\n if (typeof window === \"undefined\") return;\n try {\n const existing = getReadIds();\n ids.forEach((id) => existing.add(id));\n\n const arr = [...existing].slice(-1000);\n localStorage.setItem(KEY, JSON.stringify(arr));\n } catch { }\n}\n"],"mappings":"AAAA,MAAM,MAAM;AAEL,SAAS,aAA0B;AACxC,MAAI,OAAO,WAAW,YAAa,QAAO,oBAAI,IAAI;AAClD,MAAI;AACF,UAAM,MAAM,aAAa,QAAQ,GAAG;AACpC,UAAM,SAAkB,MAAM,KAAK,MAAM,GAAG,IAAI,CAAC;AACjD,QAAI,CAAC,MAAM,QAAQ,MAAM,EAAG,QAAO,oBAAI,IAAI;AAC3C,WAAO,IAAI,IAAI,MAAkB;AAAA,EACnC,QAAQ;AACN,WAAO,oBAAI,IAAI;AAAA,EACjB;AACF;AAEO,SAAS,SAAS,KAAqB;AAC5C,MAAI,OAAO,WAAW,YAAa;AACnC,MAAI;AACF,UAAM,WAAW,WAAW;AAC5B,QAAI,QAAQ,CAAC,OAAO,SAAS,IAAI,EAAE,CAAC;AAEpC,UAAM,MAAM,CAAC,GAAG,QAAQ,EAAE,MAAM,IAAK;AACrC,iBAAa,QAAQ,KAAK,KAAK,UAAU,GAAG,CAAC;AAAA,EAC/C,QAAQ;AAAA,EAAG;AACb;","names":[]}
@@ -1,182 +0,0 @@
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_notifications_exports = {};
31
- __export(use_notifications_exports, {
32
- useNotifications: () => useNotifications
33
- });
34
- module.exports = __toCommonJS(use_notifications_exports);
35
- var import_react = require("react");
36
- var import_swr = __toESM(require("swr"), 1);
37
- var import_sdk = require("@medialane/sdk");
38
- var import_use_orders = require("./use-orders.js");
39
- var import_use_activities = require("./use-activities.js");
40
- var import_notification_storage = require("./notification-storage.js");
41
- var import_notification_readiness = require("./notification-readiness.js");
42
- var import_format_activity = require("./format-activity.js");
43
- var import_use_image_url = require("./use-image-url.js");
44
- async function fetchAnnouncements() {
45
- const res = await fetch("/api/announcements");
46
- if (!res.ok) return [];
47
- return res.json();
48
- }
49
- function useNotifications(address) {
50
- const resolveImage = (0, import_use_image_url.useImageUrl)();
51
- const [readIds, setReadIds] = (0, import_react.useState)(() => /* @__PURE__ */ new Set());
52
- (0, import_react.useEffect)(() => {
53
- setReadIds((0, import_notification_storage.getReadIds)());
54
- }, []);
55
- const { orders: userOrders, isLoading: ordersLoading } = (0, import_use_orders.useUserOrders)(address ?? null);
56
- const { orders: receivedOffers, isLoading: receivedLoading } = (0, import_use_orders.useReceivedOffers)(address ?? null);
57
- const { activities, isLoading: activitiesLoading } = (0, import_use_activities.useActivitiesByAddress)(address ?? null);
58
- const { data: announcements = [] } = (0, import_swr.default)(
59
- "announcements",
60
- fetchAnnouncements,
61
- { revalidateOnFocus: false, dedupingInterval: 6e4 }
62
- );
63
- const notifications = (0, import_react.useMemo)(() => {
64
- const items = [];
65
- userOrders.filter((o) => o.offer.itemType === "ERC20" && o.status === "FULFILLED").forEach((order) => {
66
- const id = `offer-accepted-${order.orderHash}`;
67
- const fmt = (0, import_format_activity.formatOfferAcceptedNotification)(order, resolveImage);
68
- items.push({
69
- id,
70
- type: "offer_accepted",
71
- priority: "spotlight",
72
- celebratory: true,
73
- ...fmt,
74
- timestamp: order.updatedAt ?? order.createdAt ?? (/* @__PURE__ */ new Date()).toISOString(),
75
- isUnread: !readIds.has(id),
76
- metadata: {
77
- amount: order.price?.formatted ?? void 0,
78
- currency: order.price?.currency ?? void 0,
79
- txHash: order.txHash?.fulfilled ?? void 0,
80
- assetName: order.token?.name ?? void 0
81
- }
82
- });
83
- });
84
- receivedOffers.forEach((order) => {
85
- const id = `order-${order.orderHash}`;
86
- const fmt = (0, import_format_activity.formatOrderNotification)(order, resolveImage);
87
- items.push({
88
- id,
89
- type: "offer",
90
- priority: "spotlight",
91
- celebratory: false,
92
- ...fmt,
93
- timestamp: order.createdAt ?? (/* @__PURE__ */ new Date()).toISOString(),
94
- isUnread: !readIds.has(id),
95
- metadata: {
96
- amount: order.price?.formatted ?? void 0,
97
- currency: order.price?.currency ?? void 0,
98
- assetName: order.token?.name ?? void 0
99
- }
100
- });
101
- });
102
- activities.slice(0, 50).forEach((event) => {
103
- const id = `activity-${event.txHash}-${event.type}-${event.nftTokenId ?? ""}`;
104
- if (event.type === "transfer" && address && !!event.to && (0, import_sdk.normalizeAddress)("STARKNET", event.to) === (0, import_sdk.normalizeAddress)("STARKNET", address)) {
105
- const fmt2 = (0, import_format_activity.formatAssetReceivedNotification)(event, resolveImage);
106
- items.push({
107
- id,
108
- type: "asset_received",
109
- priority: "spotlight",
110
- celebratory: true,
111
- ...fmt2,
112
- timestamp: event.timestamp ?? (/* @__PURE__ */ new Date()).toISOString(),
113
- isUnread: !readIds.has(id),
114
- metadata: {
115
- txHash: event.txHash ?? void 0,
116
- assetName: event.token?.name ?? void 0
117
- }
118
- });
119
- return;
120
- }
121
- const isMySale = event.type === "sale" && address && (!!event.offerer && (0, import_sdk.normalizeAddress)("STARKNET", event.offerer) === (0, import_sdk.normalizeAddress)("STARKNET", address) || !!event.from && (0, import_sdk.normalizeAddress)("STARKNET", event.from) === (0, import_sdk.normalizeAddress)("STARKNET", address));
122
- const fmt = (0, import_format_activity.formatActivity)(event, resolveImage);
123
- items.push({
124
- id,
125
- type: event.type,
126
- priority: isMySale ? "spotlight" : "normal",
127
- celebratory: !!isMySale,
128
- ...fmt,
129
- timestamp: event.timestamp ?? (/* @__PURE__ */ new Date()).toISOString(),
130
- isUnread: !readIds.has(id),
131
- metadata: {
132
- amount: event.price?.formatted ?? void 0,
133
- currency: event.price?.currency ?? void 0,
134
- txHash: event.txHash ?? void 0,
135
- assetName: event.token?.name ?? void 0
136
- }
137
- });
138
- });
139
- announcements.forEach((ann) => {
140
- const id = `ann-${ann.id}`;
141
- items.push({
142
- id,
143
- type: "announcement",
144
- priority: ann.pinned ? "spotlight" : "normal",
145
- celebratory: false,
146
- title: ann.title,
147
- description: ann.body,
148
- image: ann.image,
149
- href: ann.href,
150
- timestamp: ann.created_at,
151
- isUnread: !readIds.has(id)
152
- });
153
- });
154
- items.sort(
155
- (a, b) => new Date(b.timestamp).getTime() - new Date(a.timestamp).getTime()
156
- );
157
- return items;
158
- }, [userOrders, receivedOffers, activities, announcements, address, readIds, resolveImage]);
159
- const unreadCount = notifications.filter((n) => n.isUnread).length;
160
- const markNotificationsRead = (0, import_react.useCallback)((ids) => {
161
- (0, import_notification_storage.markRead)(ids);
162
- setReadIds((0, import_notification_storage.getReadIds)());
163
- }, []);
164
- const isLoading = (0, import_notification_readiness.notificationsAreLoading)({
165
- ordersLoading,
166
- receivedLoading,
167
- activitiesLoading,
168
- hasAddress: !!address
169
- });
170
- return {
171
- notifications,
172
- unreadCount,
173
- isLoading,
174
- markAllRead: () => markNotificationsRead(notifications.map((n) => n.id)),
175
- markRead: (id) => markNotificationsRead([id])
176
- };
177
- }
178
- // Annotate the CommonJS export names for ESM import in node:
179
- 0 && (module.exports = {
180
- useNotifications
181
- });
182
- //# sourceMappingURL=use-notifications.cjs.map
@@ -1 +0,0 @@
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 { 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 { useImageUrl } from \"./use-image-url.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 address: string | null | undefined\n) {\n const resolveImage = useImageUrl();\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(address ?? null);\n\n const { orders: receivedOffers, isLoading: receivedLoading } = useReceivedOffers(address ?? null);\n const { activities, isLoading: activitiesLoading } = useActivitiesByAddress(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, resolveImage);\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, resolveImage);\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, resolveImage);\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, resolveImage);\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, resolveImage]);\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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,mBAA0D;AAC1D,iBAAmB;AACnB,iBAAiC;AAEjC,wBAAiD;AACjD,4B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AAY,gBAAgB,YAAY,eAAe,SAAS,SAAS,YAAY,CAAC;AAE1F,QAAM,cAAc,cAAc,OAAO,CAAC,MAAM,EAAE,QAAQ,EAAE;AAE5D,QAAM,4BAAwB,0BAAY,CAAC,QAAkB;AAC3D,8CAAS,GAAG;AACZ,mBAAW,wCAAW,CAAC;AAAA,EACzB,GAAG,CAAC,CAAC;AAEL,QAAM,gBAAY,uDAAwB;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":["useSWR","fmt"]}
@@ -1,11 +0,0 @@
1
- import { Notification } from '../data/notification.cjs';
2
-
3
- declare function useNotifications(address: string | null | undefined): {
4
- notifications: Notification[];
5
- unreadCount: number;
6
- isLoading: boolean;
7
- markAllRead: () => void;
8
- markRead: (id: string) => void;
9
- };
10
-
11
- export { useNotifications };
@@ -1,11 +0,0 @@
1
- import { Notification } from '../data/notification.js';
2
-
3
- declare function useNotifications(address: string | null | undefined): {
4
- notifications: Notification[];
5
- unreadCount: number;
6
- isLoading: boolean;
7
- markAllRead: () => void;
8
- markRead: (id: string) => void;
9
- };
10
-
11
- export { useNotifications };
@@ -1,153 +0,0 @@
1
- "use client";
2
- import { useCallback, useEffect, useMemo, useState } from "react";
3
- import useSWR from "swr";
4
- import { normalizeAddress } from "@medialane/sdk";
5
- import { useUserOrders, useReceivedOffers } from "./use-orders.js";
6
- import { useActivitiesByAddress } from "./use-activities.js";
7
- import { getReadIds, markRead } from "./notification-storage.js";
8
- import { notificationsAreLoading } from "./notification-readiness.js";
9
- import {
10
- formatActivity,
11
- formatOrderNotification,
12
- formatOfferAcceptedNotification,
13
- formatAssetReceivedNotification
14
- } from "./format-activity.js";
15
- import { useImageUrl } from "./use-image-url.js";
16
- async function fetchAnnouncements() {
17
- const res = await fetch("/api/announcements");
18
- if (!res.ok) return [];
19
- return res.json();
20
- }
21
- function useNotifications(address) {
22
- const resolveImage = useImageUrl();
23
- const [readIds, setReadIds] = useState(() => /* @__PURE__ */ new Set());
24
- useEffect(() => {
25
- setReadIds(getReadIds());
26
- }, []);
27
- const { orders: userOrders, isLoading: ordersLoading } = useUserOrders(address ?? null);
28
- const { orders: receivedOffers, isLoading: receivedLoading } = useReceivedOffers(address ?? null);
29
- const { activities, isLoading: activitiesLoading } = useActivitiesByAddress(address ?? null);
30
- const { data: announcements = [] } = useSWR(
31
- "announcements",
32
- fetchAnnouncements,
33
- { revalidateOnFocus: false, dedupingInterval: 6e4 }
34
- );
35
- const notifications = useMemo(() => {
36
- const items = [];
37
- userOrders.filter((o) => o.offer.itemType === "ERC20" && o.status === "FULFILLED").forEach((order) => {
38
- const id = `offer-accepted-${order.orderHash}`;
39
- const fmt = formatOfferAcceptedNotification(order, resolveImage);
40
- items.push({
41
- id,
42
- type: "offer_accepted",
43
- priority: "spotlight",
44
- celebratory: true,
45
- ...fmt,
46
- timestamp: order.updatedAt ?? order.createdAt ?? (/* @__PURE__ */ new Date()).toISOString(),
47
- isUnread: !readIds.has(id),
48
- metadata: {
49
- amount: order.price?.formatted ?? void 0,
50
- currency: order.price?.currency ?? void 0,
51
- txHash: order.txHash?.fulfilled ?? void 0,
52
- assetName: order.token?.name ?? void 0
53
- }
54
- });
55
- });
56
- receivedOffers.forEach((order) => {
57
- const id = `order-${order.orderHash}`;
58
- const fmt = formatOrderNotification(order, resolveImage);
59
- items.push({
60
- id,
61
- type: "offer",
62
- priority: "spotlight",
63
- celebratory: false,
64
- ...fmt,
65
- timestamp: order.createdAt ?? (/* @__PURE__ */ new Date()).toISOString(),
66
- isUnread: !readIds.has(id),
67
- metadata: {
68
- amount: order.price?.formatted ?? void 0,
69
- currency: order.price?.currency ?? void 0,
70
- assetName: order.token?.name ?? void 0
71
- }
72
- });
73
- });
74
- activities.slice(0, 50).forEach((event) => {
75
- const id = `activity-${event.txHash}-${event.type}-${event.nftTokenId ?? ""}`;
76
- if (event.type === "transfer" && address && !!event.to && normalizeAddress("STARKNET", event.to) === normalizeAddress("STARKNET", address)) {
77
- const fmt2 = formatAssetReceivedNotification(event, resolveImage);
78
- items.push({
79
- id,
80
- type: "asset_received",
81
- priority: "spotlight",
82
- celebratory: true,
83
- ...fmt2,
84
- timestamp: event.timestamp ?? (/* @__PURE__ */ new Date()).toISOString(),
85
- isUnread: !readIds.has(id),
86
- metadata: {
87
- txHash: event.txHash ?? void 0,
88
- assetName: event.token?.name ?? void 0
89
- }
90
- });
91
- return;
92
- }
93
- const isMySale = event.type === "sale" && address && (!!event.offerer && normalizeAddress("STARKNET", event.offerer) === normalizeAddress("STARKNET", address) || !!event.from && normalizeAddress("STARKNET", event.from) === normalizeAddress("STARKNET", address));
94
- const fmt = formatActivity(event, resolveImage);
95
- items.push({
96
- id,
97
- type: event.type,
98
- priority: isMySale ? "spotlight" : "normal",
99
- celebratory: !!isMySale,
100
- ...fmt,
101
- timestamp: event.timestamp ?? (/* @__PURE__ */ new Date()).toISOString(),
102
- isUnread: !readIds.has(id),
103
- metadata: {
104
- amount: event.price?.formatted ?? void 0,
105
- currency: event.price?.currency ?? void 0,
106
- txHash: event.txHash ?? void 0,
107
- assetName: event.token?.name ?? void 0
108
- }
109
- });
110
- });
111
- announcements.forEach((ann) => {
112
- const id = `ann-${ann.id}`;
113
- items.push({
114
- id,
115
- type: "announcement",
116
- priority: ann.pinned ? "spotlight" : "normal",
117
- celebratory: false,
118
- title: ann.title,
119
- description: ann.body,
120
- image: ann.image,
121
- href: ann.href,
122
- timestamp: ann.created_at,
123
- isUnread: !readIds.has(id)
124
- });
125
- });
126
- items.sort(
127
- (a, b) => new Date(b.timestamp).getTime() - new Date(a.timestamp).getTime()
128
- );
129
- return items;
130
- }, [userOrders, receivedOffers, activities, announcements, address, readIds, resolveImage]);
131
- const unreadCount = notifications.filter((n) => n.isUnread).length;
132
- const markNotificationsRead = useCallback((ids) => {
133
- markRead(ids);
134
- setReadIds(getReadIds());
135
- }, []);
136
- const isLoading = notificationsAreLoading({
137
- ordersLoading,
138
- receivedLoading,
139
- activitiesLoading,
140
- hasAddress: !!address
141
- });
142
- return {
143
- notifications,
144
- unreadCount,
145
- isLoading,
146
- markAllRead: () => markNotificationsRead(notifications.map((n) => n.id)),
147
- markRead: (id) => markNotificationsRead([id])
148
- };
149
- }
150
- export {
151
- useNotifications
152
- };
153
- //# sourceMappingURL=use-notifications.js.map
@@ -1 +0,0 @@
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 { 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 { useImageUrl } from \"./use-image-url.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 address: string | null | undefined\n) {\n const resolveImage = useImageUrl();\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(address ?? null);\n\n const { orders: receivedOffers, isLoading: receivedLoading } = useReceivedOffers(address ?? null);\n const { activities, isLoading: activitiesLoading } = useActivitiesByAddress(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, resolveImage);\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, resolveImage);\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, resolveImage);\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, resolveImage);\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, resolveImage]);\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;AAEjC,SAAS,eAAe,yBAAyB;AACjD,SAAS,8BAA8B;AACvC,SAAS,YAAY,gBAAgB;AACrC,SAAS,+BAA+B;AACxC;AAAA,EACE;AAAA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