@medialane/ui 0.341.0 → 0.343.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.
- package/dist/components/account/input-otp.d.cts +2 -2
- package/dist/components/account/input-otp.d.ts +2 -2
- package/dist/components/activities-feed.cjs +0 -47
- package/dist/components/activities-feed.cjs.map +1 -1
- package/dist/components/activities-feed.js +1 -38
- package/dist/components/activities-feed.js.map +1 -1
- package/dist/components/badge.d.cts +1 -1
- package/dist/components/badge.d.ts +1 -1
- package/dist/components/button.d.cts +2 -2
- package/dist/components/button.d.ts +2 -2
- package/dist/components/fast-mint/fast-mint.d.cts +2 -2
- package/dist/components/fast-mint/fast-mint.d.ts +2 -2
- package/dist/components/launchpad/edition-mint-schema.d.cts +4 -4
- package/dist/components/launchpad/edition-mint-schema.d.ts +4 -4
- package/dist/components/medialane-app.cjs.map +1 -1
- package/dist/components/medialane-app.d.cts +1 -0
- package/dist/components/medialane-app.d.ts +1 -0
- package/dist/components/medialane-app.js.map +1 -1
- package/dist/index.cjs +8 -24
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3 -6
- package/dist/index.d.ts +3 -6
- package/dist/index.js +6 -20
- package/dist/index.js.map +1 -1
- package/dist/utils/format-activity.cjs +2 -50
- package/dist/utils/format-activity.cjs.map +1 -1
- package/dist/utils/format-activity.d.cts +2 -5
- package/dist/utils/format-activity.d.ts +2 -5
- package/dist/utils/format-activity.js +1 -46
- package/dist/utils/format-activity.js.map +1 -1
- package/dist/utils/media-wallet/use-erc20-balance.d.cts +1 -1
- package/dist/utils/media-wallet/use-erc20-balance.d.ts +1 -1
- package/dist/utils/use-activities.cjs +2 -2
- package/dist/utils/use-activities.cjs.map +1 -1
- package/dist/utils/use-activities.js +2 -2
- package/dist/utils/use-activities.js.map +1 -1
- package/dist/utils/use-coin-price.cjs +1 -2
- package/dist/utils/use-coin-price.cjs.map +1 -1
- package/dist/utils/use-coin-price.js +1 -2
- package/dist/utils/use-coin-price.js.map +1 -1
- package/dist/utils/use-collections.cjs +1 -1
- package/dist/utils/use-collections.cjs.map +1 -1
- package/dist/utils/use-collections.js +1 -1
- package/dist/utils/use-collections.js.map +1 -1
- package/dist/utils/use-comments.cjs +1 -1
- package/dist/utils/use-comments.cjs.map +1 -1
- package/dist/utils/use-comments.js +1 -1
- package/dist/utils/use-comments.js.map +1 -1
- package/dist/utils/use-my-remix-offers.cjs +60 -0
- package/dist/utils/use-my-remix-offers.cjs.map +1 -0
- package/dist/utils/use-my-remix-offers.d.cts +12 -0
- package/dist/utils/use-my-remix-offers.d.ts +12 -0
- package/dist/utils/use-my-remix-offers.js +26 -0
- package/dist/utils/use-my-remix-offers.js.map +1 -0
- package/dist/utils/use-orders.cjs +4 -4
- package/dist/utils/use-orders.cjs.map +1 -1
- package/dist/utils/use-orders.js +4 -4
- package/dist/utils/use-orders.js.map +1 -1
- package/dist/utils/use-remix-offers.cjs +1 -1
- package/dist/utils/use-remix-offers.cjs.map +1 -1
- package/dist/utils/use-remix-offers.js +1 -1
- package/dist/utils/use-remix-offers.js.map +1 -1
- package/dist/utils/use-swap-quote.cjs +73 -0
- package/dist/utils/use-swap-quote.cjs.map +1 -0
- package/dist/utils/use-swap-quote.d.cts +15 -0
- package/dist/utils/use-swap-quote.d.ts +15 -0
- package/dist/utils/use-swap-quote.js +38 -0
- package/dist/utils/use-swap-quote.js.map +1 -0
- package/dist/utils/use-tokens-by-ip-type.cjs +1 -1
- package/dist/utils/use-tokens-by-ip-type.cjs.map +1 -1
- package/dist/utils/use-tokens-by-ip-type.js +1 -1
- package/dist/utils/use-tokens-by-ip-type.js.map +1 -1
- package/dist/utils/use-tokens.cjs +2 -2
- package/dist/utils/use-tokens.cjs.map +1 -1
- package/dist/utils/use-tokens.d.cts +1 -1
- package/dist/utils/use-tokens.d.ts +1 -1
- package/dist/utils/use-tokens.js +2 -2
- package/dist/utils/use-tokens.js.map +1 -1
- package/dist/utils/use-usd-prices.cjs +0 -1
- package/dist/utils/use-usd-prices.cjs.map +1 -1
- package/dist/utils/use-usd-prices.js +0 -1
- package/dist/utils/use-usd-prices.js.map +1 -1
- package/package.json +1 -1
- package/dist/components/notification-row.cjs +0 -117
- package/dist/components/notification-row.cjs.map +0 -1
- package/dist/components/notification-row.d.cts +0 -11
- package/dist/components/notification-row.d.ts +0 -11
- package/dist/components/notification-row.js +0 -83
- package/dist/components/notification-row.js.map +0 -1
- package/dist/data/notification-meta.cjs +0 -66
- package/dist/data/notification-meta.cjs.map +0 -1
- package/dist/data/notification-meta.d.cts +0 -7
- package/dist/data/notification-meta.d.ts +0 -7
- package/dist/data/notification-meta.js +0 -50
- package/dist/data/notification-meta.js.map +0 -1
- package/dist/data/notification.cjs +0 -17
- package/dist/data/notification.cjs.map +0 -1
- package/dist/data/notification.d.cts +0 -31
- package/dist/data/notification.d.ts +0 -31
- package/dist/data/notification.js +0 -1
- package/dist/data/notification.js.map +0 -1
- package/dist/utils/notification-readiness.cjs +0 -32
- package/dist/utils/notification-readiness.cjs.map +0 -1
- package/dist/utils/notification-readiness.d.cts +0 -9
- package/dist/utils/notification-readiness.d.ts +0 -9
- package/dist/utils/notification-readiness.js +0 -8
- package/dist/utils/notification-readiness.js.map +0 -1
- package/dist/utils/notification-storage.cjs +0 -52
- package/dist/utils/notification-storage.cjs.map +0 -1
- package/dist/utils/notification-storage.d.cts +0 -4
- package/dist/utils/notification-storage.d.ts +0 -4
- package/dist/utils/notification-storage.js +0 -27
- package/dist/utils/notification-storage.js.map +0 -1
- package/dist/utils/use-notifications.cjs +0 -182
- package/dist/utils/use-notifications.cjs.map +0 -1
- package/dist/utils/use-notifications.d.cts +0 -11
- package/dist/utils/use-notifications.d.ts +0 -11
- package/dist/utils/use-notifications.js +0 -153
- package/dist/utils/use-notifications.js.map +0 -1
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
CheckCircle2,
|
|
3
|
-
Gift,
|
|
4
|
-
HandCoins,
|
|
5
|
-
Megaphone,
|
|
6
|
-
Zap,
|
|
7
|
-
Tag,
|
|
8
|
-
Sparkles,
|
|
9
|
-
ArrowRightLeft,
|
|
10
|
-
X
|
|
11
|
-
} from "lucide-react";
|
|
12
|
-
const NOTIFICATION_ICON = {
|
|
13
|
-
offer_accepted: CheckCircle2,
|
|
14
|
-
asset_received: Gift,
|
|
15
|
-
offer: HandCoins,
|
|
16
|
-
sale: Zap,
|
|
17
|
-
listing: Tag,
|
|
18
|
-
mint: Sparkles,
|
|
19
|
-
transfer: ArrowRightLeft,
|
|
20
|
-
cancelled: X,
|
|
21
|
-
announcement: Megaphone
|
|
22
|
-
};
|
|
23
|
-
const NOTIFICATION_COLOR = {
|
|
24
|
-
offer_accepted: "text-emerald-400 bg-emerald-500/10",
|
|
25
|
-
asset_received: "text-teal-400 bg-teal-500/10",
|
|
26
|
-
offer: "text-amber-400 bg-amber-500/10",
|
|
27
|
-
sale: "text-violet-400 bg-violet-500/10",
|
|
28
|
-
listing: "text-sky-400 bg-sky-500/10",
|
|
29
|
-
mint: "text-emerald-400 bg-emerald-500/10",
|
|
30
|
-
transfer: "text-slate-400 bg-slate-500/10",
|
|
31
|
-
cancelled: "text-rose-400 bg-rose-500/10",
|
|
32
|
-
announcement: "text-purple-400 bg-purple-500/10"
|
|
33
|
-
};
|
|
34
|
-
const NOTIFICATION_LABEL = {
|
|
35
|
-
offer_accepted: "Offer accepted",
|
|
36
|
-
asset_received: "Asset received",
|
|
37
|
-
offer: "New offer",
|
|
38
|
-
sale: "Sale",
|
|
39
|
-
listing: "Listing",
|
|
40
|
-
mint: "Mint",
|
|
41
|
-
transfer: "Transfer",
|
|
42
|
-
cancelled: "Cancelled",
|
|
43
|
-
announcement: "Announcement"
|
|
44
|
-
};
|
|
45
|
-
export {
|
|
46
|
-
NOTIFICATION_COLOR,
|
|
47
|
-
NOTIFICATION_ICON,
|
|
48
|
-
NOTIFICATION_LABEL
|
|
49
|
-
};
|
|
50
|
-
//# sourceMappingURL=notification-meta.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/data/notification-meta.ts"],"sourcesContent":["import {\n CheckCircle2, Gift, HandCoins, Megaphone, Zap, Tag, Sparkles, ArrowRightLeft, X,\n} from \"lucide-react\";\nimport type { NotificationType } from \"./notification.js\";\n\nexport const NOTIFICATION_ICON: Record<NotificationType, React.ElementType> = {\n offer_accepted: CheckCircle2,\n asset_received: Gift,\n offer: HandCoins,\n sale: Zap,\n listing: Tag,\n mint: Sparkles,\n transfer: ArrowRightLeft,\n cancelled: X,\n announcement: Megaphone,\n};\n\nexport const NOTIFICATION_COLOR: Record<NotificationType, string> = {\n offer_accepted: \"text-emerald-400 bg-emerald-500/10\",\n asset_received: \"text-teal-400 bg-teal-500/10\",\n offer: \"text-amber-400 bg-amber-500/10\",\n sale: \"text-violet-400 bg-violet-500/10\",\n listing: \"text-sky-400 bg-sky-500/10\",\n mint: \"text-emerald-400 bg-emerald-500/10\",\n transfer: \"text-slate-400 bg-slate-500/10\",\n cancelled: \"text-rose-400 bg-rose-500/10\",\n announcement: \"text-purple-400 bg-purple-500/10\",\n};\n\nexport const NOTIFICATION_LABEL: Record<NotificationType, string> = {\n offer_accepted: \"Offer accepted\",\n asset_received: \"Asset received\",\n offer: \"New offer\",\n sale: \"Sale\",\n listing: \"Listing\",\n mint: \"Mint\",\n transfer: \"Transfer\",\n cancelled: \"Cancelled\",\n announcement: \"Announcement\",\n};\n"],"mappings":"AAAA;AAAA,EACE;AAAA,EAAc;AAAA,EAAM;AAAA,EAAW;AAAA,EAAW;AAAA,EAAK;AAAA,EAAK;AAAA,EAAU;AAAA,EAAgB;AAAA,OACzE;AAGA,MAAM,oBAAiE;AAAA,EAC5E,gBAAgB;AAAA,EAChB,gBAAgB;AAAA,EAChB,OAAgB;AAAA,EAChB,MAAgB;AAAA,EAChB,SAAgB;AAAA,EAChB,MAAgB;AAAA,EAChB,UAAgB;AAAA,EAChB,WAAgB;AAAA,EAChB,cAAgB;AAClB;AAEO,MAAM,qBAAuD;AAAA,EAClE,gBAAgB;AAAA,EAChB,gBAAgB;AAAA,EAChB,OAAgB;AAAA,EAChB,MAAgB;AAAA,EAChB,SAAgB;AAAA,EAChB,MAAgB;AAAA,EAChB,UAAgB;AAAA,EAChB,WAAgB;AAAA,EAChB,cAAgB;AAClB;AAEO,MAAM,qBAAuD;AAAA,EAClE,gBAAgB;AAAA,EAChB,gBAAgB;AAAA,EAChB,OAAgB;AAAA,EAChB,MAAgB;AAAA,EAChB,SAAgB;AAAA,EAChB,MAAgB;AAAA,EAChB,UAAgB;AAAA,EAChB,WAAgB;AAAA,EAChB,cAAgB;AAClB;","names":[]}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __copyProps = (to, from, except, desc) => {
|
|
7
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
8
|
-
for (let key of __getOwnPropNames(from))
|
|
9
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
10
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
11
|
-
}
|
|
12
|
-
return to;
|
|
13
|
-
};
|
|
14
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
15
|
-
var notification_exports = {};
|
|
16
|
-
module.exports = __toCommonJS(notification_exports);
|
|
17
|
-
//# sourceMappingURL=notification.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/data/notification.ts"],"sourcesContent":["export type NotificationType =\n | \"offer\"\n | \"offer_accepted\"\n | \"sale\"\n | \"listing\"\n | \"mint\"\n | \"transfer\"\n | \"asset_received\"\n | \"cancelled\"\n | \"announcement\";\n\nexport type NotificationPriority = \"normal\" | \"spotlight\";\n\nexport interface Notification {\n id: string;\n type: NotificationType;\n title: string;\n description: string;\n image: string | null;\n href: string;\n timestamp: string;\n isUnread: boolean;\n priority: NotificationPriority;\n\n celebratory?: boolean;\n\n metadata?: {\n amount?: string;\n currency?: string;\n txHash?: string;\n assetName?: string;\n };\n}\n\nexport interface Announcement {\n id: string;\n title: string;\n body: string;\n image: string | null;\n href: string;\n created_at: string;\n pinned?: boolean;\n}\n"],"mappings":";;;;;;;;;;;;;;AAAA;AAAA;","names":[]}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
type NotificationType = "offer" | "offer_accepted" | "sale" | "listing" | "mint" | "transfer" | "asset_received" | "cancelled" | "announcement";
|
|
2
|
-
type NotificationPriority = "normal" | "spotlight";
|
|
3
|
-
interface Notification {
|
|
4
|
-
id: string;
|
|
5
|
-
type: NotificationType;
|
|
6
|
-
title: string;
|
|
7
|
-
description: string;
|
|
8
|
-
image: string | null;
|
|
9
|
-
href: string;
|
|
10
|
-
timestamp: string;
|
|
11
|
-
isUnread: boolean;
|
|
12
|
-
priority: NotificationPriority;
|
|
13
|
-
celebratory?: boolean;
|
|
14
|
-
metadata?: {
|
|
15
|
-
amount?: string;
|
|
16
|
-
currency?: string;
|
|
17
|
-
txHash?: string;
|
|
18
|
-
assetName?: string;
|
|
19
|
-
};
|
|
20
|
-
}
|
|
21
|
-
interface Announcement {
|
|
22
|
-
id: string;
|
|
23
|
-
title: string;
|
|
24
|
-
body: string;
|
|
25
|
-
image: string | null;
|
|
26
|
-
href: string;
|
|
27
|
-
created_at: string;
|
|
28
|
-
pinned?: boolean;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
export type { Announcement, Notification, NotificationPriority, NotificationType };
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
type NotificationType = "offer" | "offer_accepted" | "sale" | "listing" | "mint" | "transfer" | "asset_received" | "cancelled" | "announcement";
|
|
2
|
-
type NotificationPriority = "normal" | "spotlight";
|
|
3
|
-
interface Notification {
|
|
4
|
-
id: string;
|
|
5
|
-
type: NotificationType;
|
|
6
|
-
title: string;
|
|
7
|
-
description: string;
|
|
8
|
-
image: string | null;
|
|
9
|
-
href: string;
|
|
10
|
-
timestamp: string;
|
|
11
|
-
isUnread: boolean;
|
|
12
|
-
priority: NotificationPriority;
|
|
13
|
-
celebratory?: boolean;
|
|
14
|
-
metadata?: {
|
|
15
|
-
amount?: string;
|
|
16
|
-
currency?: string;
|
|
17
|
-
txHash?: string;
|
|
18
|
-
assetName?: string;
|
|
19
|
-
};
|
|
20
|
-
}
|
|
21
|
-
interface Announcement {
|
|
22
|
-
id: string;
|
|
23
|
-
title: string;
|
|
24
|
-
body: string;
|
|
25
|
-
image: string | null;
|
|
26
|
-
href: string;
|
|
27
|
-
created_at: string;
|
|
28
|
-
pinned?: boolean;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
export type { Announcement, Notification, NotificationPriority, NotificationType };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
//# sourceMappingURL=notification.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
var notification_readiness_exports = {};
|
|
20
|
-
__export(notification_readiness_exports, {
|
|
21
|
-
notificationsAreLoading: () => notificationsAreLoading
|
|
22
|
-
});
|
|
23
|
-
module.exports = __toCommonJS(notification_readiness_exports);
|
|
24
|
-
function notificationsAreLoading(state) {
|
|
25
|
-
if (!state.hasAddress) return false;
|
|
26
|
-
return state.ordersLoading || state.receivedLoading || state.activitiesLoading;
|
|
27
|
-
}
|
|
28
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
29
|
-
0 && (module.exports = {
|
|
30
|
-
notificationsAreLoading
|
|
31
|
-
});
|
|
32
|
-
//# sourceMappingURL=notification-readiness.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/utils/notification-readiness.ts"],"sourcesContent":["export interface NotificationSourceState {\n ordersLoading: boolean;\n receivedLoading: boolean;\n activitiesLoading: boolean;\n hasAddress: boolean;\n}\n\nexport function notificationsAreLoading(state: NotificationSourceState): boolean {\n if (!state.hasAddress) return false;\n return state.ordersLoading || state.receivedLoading || state.activitiesLoading;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAOO,SAAS,wBAAwB,OAAyC;AAC/E,MAAI,CAAC,MAAM,WAAY,QAAO;AAC9B,SAAO,MAAM,iBAAiB,MAAM,mBAAmB,MAAM;AAC/D;","names":[]}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
interface NotificationSourceState {
|
|
2
|
-
ordersLoading: boolean;
|
|
3
|
-
receivedLoading: boolean;
|
|
4
|
-
activitiesLoading: boolean;
|
|
5
|
-
hasAddress: boolean;
|
|
6
|
-
}
|
|
7
|
-
declare function notificationsAreLoading(state: NotificationSourceState): boolean;
|
|
8
|
-
|
|
9
|
-
export { type NotificationSourceState, notificationsAreLoading };
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
interface NotificationSourceState {
|
|
2
|
-
ordersLoading: boolean;
|
|
3
|
-
receivedLoading: boolean;
|
|
4
|
-
activitiesLoading: boolean;
|
|
5
|
-
hasAddress: boolean;
|
|
6
|
-
}
|
|
7
|
-
declare function notificationsAreLoading(state: NotificationSourceState): boolean;
|
|
8
|
-
|
|
9
|
-
export { type NotificationSourceState, notificationsAreLoading };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/utils/notification-readiness.ts"],"sourcesContent":["export interface NotificationSourceState {\n ordersLoading: boolean;\n receivedLoading: boolean;\n activitiesLoading: boolean;\n hasAddress: boolean;\n}\n\nexport function notificationsAreLoading(state: NotificationSourceState): boolean {\n if (!state.hasAddress) return false;\n return state.ordersLoading || state.receivedLoading || state.activitiesLoading;\n}\n"],"mappings":"AAOO,SAAS,wBAAwB,OAAyC;AAC/E,MAAI,CAAC,MAAM,WAAY,QAAO;AAC9B,SAAO,MAAM,iBAAiB,MAAM,mBAAmB,MAAM;AAC/D;","names":[]}
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
var notification_storage_exports = {};
|
|
20
|
-
__export(notification_storage_exports, {
|
|
21
|
-
getReadIds: () => getReadIds,
|
|
22
|
-
markRead: () => markRead
|
|
23
|
-
});
|
|
24
|
-
module.exports = __toCommonJS(notification_storage_exports);
|
|
25
|
-
const KEY = "ml-notification-reads";
|
|
26
|
-
function getReadIds() {
|
|
27
|
-
if (typeof window === "undefined") return /* @__PURE__ */ new Set();
|
|
28
|
-
try {
|
|
29
|
-
const raw = localStorage.getItem(KEY);
|
|
30
|
-
const parsed = raw ? JSON.parse(raw) : [];
|
|
31
|
-
if (!Array.isArray(parsed)) return /* @__PURE__ */ new Set();
|
|
32
|
-
return new Set(parsed);
|
|
33
|
-
} catch {
|
|
34
|
-
return /* @__PURE__ */ new Set();
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
function markRead(ids) {
|
|
38
|
-
if (typeof window === "undefined") return;
|
|
39
|
-
try {
|
|
40
|
-
const existing = getReadIds();
|
|
41
|
-
ids.forEach((id) => existing.add(id));
|
|
42
|
-
const arr = [...existing].slice(-1e3);
|
|
43
|
-
localStorage.setItem(KEY, JSON.stringify(arr));
|
|
44
|
-
} catch {
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
48
|
-
0 && (module.exports = {
|
|
49
|
-
getReadIds,
|
|
50
|
-
markRead
|
|
51
|
-
});
|
|
52
|
-
//# sourceMappingURL=notification-storage.cjs.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;AAAA;AAAA;AAAA;AAAA;AAAA;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,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,4BAAuC;AACvC,kCAAqC;AACrC,oCAAwC;AACxC,6BAKO;AAEP,2BAA4B;AAE5B,eAAe,qBAA8C;AAC3D,QAAM,MAAM,MAAM,MAAM,oBAAoB;AAC5C,MAAI,CAAC,IAAI,GAAI,QAAO,CAAC;AACrB,SAAO,IAAI,KAAK;AAClB;AAEO,SAAS,iBACd,SACA;AACA,QAAM,mBAAe,kCAAY;AACjC,QAAM,CAAC,SAAS,UAAU,QAAI,uBAAsB,MAAM,oBAAI,IAAY,CAAC;AAE3E,8BAAU,MAAM;AACd,mBAAW,wCAAW,CAAC;AAAA,EACzB,GAAG,CAAC,CAAC;AA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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 };
|