@ttt-productions/notification-core 0.11.0 → 0.12.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/README.md +3 -3
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/react/components/index.d.ts +0 -1
- package/dist/react/components/index.d.ts.map +1 -1
- package/dist/react/components/index.js +0 -1
- package/dist/react/components/index.js.map +1 -1
- package/dist/react/hooks/index.d.ts +0 -1
- package/dist/react/hooks/index.d.ts.map +1 -1
- package/dist/react/hooks/index.js +0 -1
- package/dist/react/hooks/index.js.map +1 -1
- package/dist/react/index.d.ts +2 -2
- package/dist/react/index.d.ts.map +1 -1
- package/dist/react/index.js +2 -2
- package/dist/react/index.js.map +1 -1
- package/dist/types.d.ts +0 -38
- package/dist/types.d.ts.map +1 -1
- package/package.json +1 -1
- package/dist/react/components/NotificationHistoryList.d.ts +0 -7
- package/dist/react/components/NotificationHistoryList.d.ts.map +0 -1
- package/dist/react/components/NotificationHistoryList.js +0 -41
- package/dist/react/components/NotificationHistoryList.js.map +0 -1
- package/dist/react/hooks/useNotificationHistory.d.ts +0 -16
- package/dist/react/hooks/useNotificationHistory.d.ts.map +0 -1
- package/dist/react/hooks/useNotificationHistory.js +0 -35
- package/dist/react/hooks/useNotificationHistory.js.map +0 -1
package/README.md
CHANGED
|
@@ -18,9 +18,9 @@ active docs carry a `seenAt` field (`0` = unseen). Opening the tray marks items
|
|
|
18
18
|
seen (the consuming app stamps `seenAt` via `markNotificationSeenWithGeneration`),
|
|
19
19
|
which clears the unread badge **without** archiving — so "seen" and "dismissed"
|
|
20
20
|
are distinct states. Archiving is the explicit dismiss: it moves a notification
|
|
21
|
-
from the active collection to history
|
|
22
|
-
|
|
23
|
-
|
|
21
|
+
from the active collection to history. The history doc is a wrapper — the archived
|
|
22
|
+
notification is nested under `archivedSnapshot`, alongside archive metadata and an
|
|
23
|
+
app-supplied `expireAt` Timestamp on the history doc to back native TTL.
|
|
24
24
|
|
|
25
25
|
Duplicate triggers for the same `dedupKey` increment a single active doc's
|
|
26
26
|
`count`, append the actor, and reset `seenAt` to `0` so new activity re-lights
|
package/dist/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export type { NotificationDoc,
|
|
1
|
+
export type { NotificationDoc, PendingNotification, NotificationCategoryConfig, NotificationTypeConfig, NotificationSystemConfig, UseActiveNotificationsOptions, UseUnreadCountOptions, UseArchiveNotificationOptions, UseArchiveAllNotificationsOptions, ArchiveAllResult, ArchiveAllLoopResult, NotificationListProps, NotificationEmptyStateProps, NotificationUnreadBadgeProps, } from './types.js';
|
|
2
2
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,eAAe,EACf,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,eAAe,EACf,mBAAmB,EACnB,0BAA0B,EAC1B,sBAAsB,EACtB,wBAAwB,EACxB,6BAA6B,EAC7B,qBAAqB,EACrB,6BAA6B,EAC7B,iCAAiC,EACjC,gBAAgB,EAChB,oBAAoB,EACpB,qBAAqB,EACrB,2BAA2B,EAC3B,4BAA4B,GAC7B,MAAM,YAAY,CAAC"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
export { NotificationList } from './NotificationList.js';
|
|
2
2
|
export { NotificationEmptyState } from './NotificationEmptyState.js';
|
|
3
|
-
export { NotificationHistoryList } from './NotificationHistoryList.js';
|
|
4
3
|
export { NotificationUnreadBadge } from './NotificationUnreadBadge.js';
|
|
5
4
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/react/components/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AACrE,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/react/components/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AACrE,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
export { NotificationList } from './NotificationList.js';
|
|
2
2
|
export { NotificationEmptyState } from './NotificationEmptyState.js';
|
|
3
|
-
export { NotificationHistoryList } from './NotificationHistoryList.js';
|
|
4
3
|
export { NotificationUnreadBadge } from './NotificationUnreadBadge.js';
|
|
5
4
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/react/components/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AACrE,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/react/components/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AACrE,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC"}
|
|
@@ -2,5 +2,4 @@ export { useActiveNotifications } from './useActiveNotifications.js';
|
|
|
2
2
|
export { useUnreadCount } from './useUnreadCount.js';
|
|
3
3
|
export { useArchiveNotification } from './useArchiveNotification.js';
|
|
4
4
|
export { useArchiveAllNotifications } from './useArchiveAllNotifications.js';
|
|
5
|
-
export { useNotificationHistory } from './useNotificationHistory.js';
|
|
6
5
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/react/hooks/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AACrE,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AACrE,OAAO,EAAE,0BAA0B,EAAE,MAAM,iCAAiC,CAAC
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/react/hooks/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AACrE,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AACrE,OAAO,EAAE,0BAA0B,EAAE,MAAM,iCAAiC,CAAC"}
|
|
@@ -2,5 +2,4 @@ export { useActiveNotifications } from './useActiveNotifications.js';
|
|
|
2
2
|
export { useUnreadCount } from './useUnreadCount.js';
|
|
3
3
|
export { useArchiveNotification } from './useArchiveNotification.js';
|
|
4
4
|
export { useArchiveAllNotifications } from './useArchiveAllNotifications.js';
|
|
5
|
-
export { useNotificationHistory } from './useNotificationHistory.js';
|
|
6
5
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/react/hooks/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AACrE,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AACrE,OAAO,EAAE,0BAA0B,EAAE,MAAM,iCAAiC,CAAC
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/react/hooks/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AACrE,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AACrE,OAAO,EAAE,0BAA0B,EAAE,MAAM,iCAAiC,CAAC"}
|
package/dist/react/index.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { useActiveNotifications, useUnreadCount, useArchiveNotification, useArchiveAllNotifications,
|
|
2
|
-
export { NotificationList, NotificationEmptyState,
|
|
1
|
+
export { useActiveNotifications, useUnreadCount, useArchiveNotification, useArchiveAllNotifications, } from './hooks/index.js';
|
|
2
|
+
export { NotificationList, NotificationEmptyState, NotificationUnreadBadge, } from './components/index.js';
|
|
3
3
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/react/index.ts"],"names":[],"mappings":"AAGA,OAAO,EACL,sBAAsB,EACtB,cAAc,EACd,sBAAsB,EACtB,0BAA0B,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/react/index.ts"],"names":[],"mappings":"AAGA,OAAO,EACL,sBAAsB,EACtB,cAAc,EACd,sBAAsB,EACtB,0BAA0B,GAC3B,MAAM,kBAAkB,CAAC;AAG1B,OAAO,EACL,gBAAgB,EAChB,sBAAsB,EACtB,uBAAuB,GACxB,MAAM,uBAAuB,CAAC"}
|
package/dist/react/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
// Hooks
|
|
3
|
-
export { useActiveNotifications, useUnreadCount, useArchiveNotification, useArchiveAllNotifications,
|
|
3
|
+
export { useActiveNotifications, useUnreadCount, useArchiveNotification, useArchiveAllNotifications, } from './hooks/index.js';
|
|
4
4
|
// Components
|
|
5
|
-
export { NotificationList, NotificationEmptyState,
|
|
5
|
+
export { NotificationList, NotificationEmptyState, NotificationUnreadBadge, } from './components/index.js';
|
|
6
6
|
//# sourceMappingURL=index.js.map
|
package/dist/react/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/react/index.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAEb,QAAQ;AACR,OAAO,EACL,sBAAsB,EACtB,cAAc,EACd,sBAAsB,EACtB,0BAA0B,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/react/index.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAEb,QAAQ;AACR,OAAO,EACL,sBAAsB,EACtB,cAAc,EACd,sBAAsB,EACtB,0BAA0B,GAC3B,MAAM,kBAAkB,CAAC;AAE1B,aAAa;AACb,OAAO,EACL,gBAAgB,EAChB,sBAAsB,EACtB,uBAAuB,GACxB,MAAM,uBAAuB,CAAC"}
|
package/dist/types.d.ts
CHANGED
|
@@ -60,31 +60,6 @@ export interface NotificationDoc {
|
|
|
60
60
|
/** Latest occurrence */
|
|
61
61
|
updatedAt: number;
|
|
62
62
|
}
|
|
63
|
-
/**
|
|
64
|
-
* Archival audit trail — stored on every history doc.
|
|
65
|
-
*/
|
|
66
|
-
export interface ArchivalInfo {
|
|
67
|
-
/** userId who clicked/dismissed */
|
|
68
|
-
archivedBy: string;
|
|
69
|
-
/** Epoch ms */
|
|
70
|
-
archivedAt: number;
|
|
71
|
-
}
|
|
72
|
-
/**
|
|
73
|
-
* History document — extends active with archival info.
|
|
74
|
-
*/
|
|
75
|
-
export interface NotificationHistoryDoc extends NotificationDoc {
|
|
76
|
-
/** Who/when/how it was archived */
|
|
77
|
-
archival: ArchivalInfo;
|
|
78
|
-
/**
|
|
79
|
-
* Epoch ms after which native Firestore TTL may delete this history doc.
|
|
80
|
-
* The retention window is app policy (set by the consuming app at archive
|
|
81
|
-
* time); the helper just persists whatever value it is handed. Generic
|
|
82
|
-
* field — no domain knowledge.
|
|
83
|
-
*/
|
|
84
|
-
expireAt: number;
|
|
85
|
-
/** Admin userId (admin history only, quick-access field) */
|
|
86
|
-
handledBy?: string;
|
|
87
|
-
}
|
|
88
63
|
/**
|
|
89
64
|
* Pending notification — queue item for the batch processor.
|
|
90
65
|
*/
|
|
@@ -231,13 +206,6 @@ export interface UseArchiveAllNotificationsOptions {
|
|
|
231
206
|
archiveAllFn: () => Promise<ArchiveAllResult>;
|
|
232
207
|
invalidateKeys?: readonly unknown[][];
|
|
233
208
|
}
|
|
234
|
-
export interface UseNotificationHistoryOptions {
|
|
235
|
-
config: NotificationSystemConfig;
|
|
236
|
-
userId: string;
|
|
237
|
-
category: string;
|
|
238
|
-
enabled?: boolean;
|
|
239
|
-
pageSize?: number;
|
|
240
|
-
}
|
|
241
209
|
export interface NotificationListProps {
|
|
242
210
|
config: NotificationSystemConfig;
|
|
243
211
|
userId: string;
|
|
@@ -261,12 +229,6 @@ export interface NotificationListProps {
|
|
|
261
229
|
export interface NotificationEmptyStateProps {
|
|
262
230
|
text?: string;
|
|
263
231
|
}
|
|
264
|
-
export interface NotificationHistoryListProps {
|
|
265
|
-
config: NotificationSystemConfig;
|
|
266
|
-
userId: string;
|
|
267
|
-
category: string;
|
|
268
|
-
onNotificationClick?: (notification: NotificationHistoryDoc) => void;
|
|
269
|
-
}
|
|
270
232
|
export interface NotificationUnreadBadgeProps {
|
|
271
233
|
config: NotificationSystemConfig;
|
|
272
234
|
userId: string;
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG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;IACpC,MAAM,EAAE,wBAAwB,CAAC;IACjC,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,mBAAmB,EAAE,CAAC,YAAY,EAAE,eAAe,KAAK,IAAI,CAAC;IAC7D;;;OAGG;IACH,SAAS,EAAE,CAAC,cAAc,EAAE,MAAM,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;IACxD;;;;OAIG;IACH,YAAY,EAAE,MAAM,OAAO,CAAC,gBAAgB,CAAC,CAAC;IAC9C,UAAU,CAAC,EAAE,MAAM,IAAI,CAAC;IACxB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,2BAA2B;IAC1C,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,4BAA4B;IAC3C,MAAM,EAAE,wBAAwB,CAAC;IACjC,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ttt-productions/notification-core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.12.0",
|
|
4
4
|
"description": "Shared notification system for TTT Productions apps — active/history two-tier architecture with dedup, batch processing, and themed UI components",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import type { NotificationHistoryListProps } from '../../types.js';
|
|
2
|
-
/**
|
|
3
|
-
* Paginated list of archived notifications. Read-only (no clear all).
|
|
4
|
-
* Supports optional re-navigation on click.
|
|
5
|
-
*/
|
|
6
|
-
export declare function NotificationHistoryList({ config, userId, category, onNotificationClick, }: NotificationHistoryListProps): import("react").JSX.Element;
|
|
7
|
-
//# sourceMappingURL=NotificationHistoryList.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"NotificationHistoryList.d.ts","sourceRoot":"","sources":["../../../src/react/components/NotificationHistoryList.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAA0B,4BAA4B,EAAE,MAAM,gBAAgB,CAAC;AAE3F;;;GAGG;AACH,wBAAgB,uBAAuB,CAAC,EACtC,MAAM,EACN,MAAM,EACN,QAAQ,EACR,mBAAmB,GACpB,EAAE,4BAA4B,+BAwF9B"}
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { Badge, Button, Separator } from '@ttt-productions/ui-core/react';
|
|
4
|
-
import { useNotificationHistory } from '../hooks/useNotificationHistory.js';
|
|
5
|
-
import { formatRelativeTime } from './relative-time.js';
|
|
6
|
-
/**
|
|
7
|
-
* Paginated list of archived notifications. Read-only (no clear all).
|
|
8
|
-
* Supports optional re-navigation on click.
|
|
9
|
-
*/
|
|
10
|
-
export function NotificationHistoryList({ config, userId, category, onNotificationClick, }) {
|
|
11
|
-
const { data: history, isLoading, hasNextPage, nextPage, } = useNotificationHistory({
|
|
12
|
-
config,
|
|
13
|
-
userId,
|
|
14
|
-
category,
|
|
15
|
-
});
|
|
16
|
-
const getTypeIcon = (type) => {
|
|
17
|
-
const typeConfig = config.types[type];
|
|
18
|
-
return typeConfig?.icon ?? '🔔';
|
|
19
|
-
};
|
|
20
|
-
if (isLoading) {
|
|
21
|
-
return _jsx("div", { className: "ntf-loading", children: "Loading history..." });
|
|
22
|
-
}
|
|
23
|
-
if (!history || history.length === 0) {
|
|
24
|
-
return (_jsx("div", { className: "ntf-empty", children: _jsx("p", { className: "ntf-empty-text", children: "No notification history" }) }));
|
|
25
|
-
}
|
|
26
|
-
return (_jsxs("div", { className: "ntf-list", children: [_jsx("div", { className: "ntf-list-header", children: _jsx("span", { className: "ntf-list-header-title", children: "History" }) }), _jsx(Separator, {}), history.map((item) => {
|
|
27
|
-
const isClickable = !!onNotificationClick;
|
|
28
|
-
const className = isClickable
|
|
29
|
-
? 'ntf-history-item ntf-history-item--clickable'
|
|
30
|
-
: 'ntf-history-item';
|
|
31
|
-
return (_jsxs("div", { className: className, role: isClickable ? 'button' : undefined, tabIndex: isClickable ? 0 : undefined, onClick: isClickable ? () => onNotificationClick(item) : undefined, onKeyDown: isClickable
|
|
32
|
-
? (e) => {
|
|
33
|
-
if (e.key === 'Enter' || e.key === ' ') {
|
|
34
|
-
e.preventDefault();
|
|
35
|
-
onNotificationClick(item);
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
: undefined, children: [_jsx("div", { className: "ntf-item-icon", children: getTypeIcon(item.type) }), _jsxs("div", { className: "ntf-item-content", children: [_jsx("div", { className: "ntf-item-title", children: item.title }), _jsx("div", { className: "ntf-item-message", children: item.message }), _jsx("div", { className: "ntf-item-timestamp", children: formatRelativeTime(item.archival.archivedAt) })] }), item.count > 1 && (_jsx("div", { className: "ntf-item-count", children: _jsxs(Badge, { variant: "secondary", children: ["\u00D7", item.count] }) }))] }, item.id));
|
|
39
|
-
}), hasNextPage && (_jsx("div", { className: "ntf-list-footer", children: _jsx(Button, { variant: "ghost", size: "sm", onClick: nextPage, children: "Load more" }) }))] }));
|
|
40
|
-
}
|
|
41
|
-
//# sourceMappingURL=NotificationHistoryList.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"NotificationHistoryList.js","sourceRoot":"","sources":["../../../src/react/components/NotificationHistoryList.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,gCAAgC,CAAC;AAC1E,OAAO,EAAE,sBAAsB,EAAE,MAAM,oCAAoC,CAAC;AAC5E,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAGxD;;;GAGG;AACH,MAAM,UAAU,uBAAuB,CAAC,EACtC,MAAM,EACN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AAC,mBAAmB,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,SAAS,EAClE,SAAS,EACP,WAAW;wBACT,CAAC,CAAC,CAAC,CAAC,EAAE,EAAE;4BACJ,IAAI,CAAC,CAAC,GAAG,KAAK,OAAO,IAAI,CAAC,CAAC,GAAG,KAAK,GAAG,EAAE,CAAC;gCACvC,CAAC,CAAC,cAAc,EAAE,CAAC;gCACnB,mBAAmB,CAAC,IAAI,CAAC,CAAC;4BAC5B,CAAC;wBACH,CAAC;wBACH,CAAC,CAAC,SAAS,aAGf,cAAK,SAAS,EAAC,eAAe,YAC3B,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,GACnB,EACN,eAAK,SAAS,EAAC,kBAAkB,aAC/B,cAAK,SAAS,EAAC,gBAAgB,YAAE,IAAI,CAAC,KAAK,GAAO,EAClD,cAAK,SAAS,EAAC,kBAAkB,YAAE,IAAI,CAAC,OAAO,GAAO,EACtD,cAAK,SAAS,EAAC,oBAAoB,YAChC,kBAAkB,CAAC,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAC,GACzC,IACF,EACL,IAAI,CAAC,KAAK,GAAG,CAAC,IAAI,CACjB,cAAK,SAAS,EAAC,gBAAgB,YAC7B,MAAC,KAAK,IAAC,OAAO,EAAC,WAAW,uBAAG,IAAI,CAAC,KAAK,IAAS,GAC5C,CACP,KA9BI,IAAI,CAAC,EAAE,CA+BR,CACP,CAAC;YACJ,CAAC,CAAC,EAED,WAAW,IAAI,CACd,cAAK,SAAS,EAAC,iBAAiB,YAC9B,KAAC,MAAM,IAAC,OAAO,EAAC,OAAO,EAAC,IAAI,EAAC,IAAI,EAAC,OAAO,EAAE,QAAQ,0BAE1C,GACL,CACP,IACG,CACP,CAAC;AACJ,CAAC"}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import type { NotificationHistoryDoc, UseNotificationHistoryOptions } from '../../types.js';
|
|
2
|
-
/**
|
|
3
|
-
* Paginated fetch of notification history (archived notifications).
|
|
4
|
-
* No polling — history is a static archive.
|
|
5
|
-
*
|
|
6
|
-
* @example
|
|
7
|
-
* ```tsx
|
|
8
|
-
* const { data, page, nextPage, hasNextPage } = useNotificationHistory({
|
|
9
|
-
* config: TTT_NOTIFICATION_CONFIG,
|
|
10
|
-
* userId: user.uid,
|
|
11
|
-
* category: 'user',
|
|
12
|
-
* });
|
|
13
|
-
* ```
|
|
14
|
-
*/
|
|
15
|
-
export declare function useNotificationHistory({ config, userId, category, enabled, pageSize, }: UseNotificationHistoryOptions): import("@ttt-productions/query-core/react").UseFirestorePaginatedResult<NotificationHistoryDoc>;
|
|
16
|
-
//# sourceMappingURL=useNotificationHistory.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useNotificationHistory.d.ts","sourceRoot":"","sources":["../../../src/react/hooks/useNotificationHistory.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,sBAAsB,EAAE,6BAA6B,EAAE,MAAM,gBAAgB,CAAC;AAI5F;;;;;;;;;;;;GAYG;AACH,wBAAgB,sBAAsB,CAAC,EACrC,MAAM,EACN,MAAM,EACN,QAAQ,EACR,OAAc,EACd,QAA4B,GAC7B,EAAE,6BAA6B,mGAmB/B"}
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
import { useFirestorePaginated } from '@ttt-productions/query-core/react';
|
|
3
|
-
import { orderBy } from 'firebase/firestore';
|
|
4
|
-
const DEFAULT_PAGE_SIZE = 20;
|
|
5
|
-
/**
|
|
6
|
-
* Paginated fetch of notification history (archived notifications).
|
|
7
|
-
* No polling — history is a static archive.
|
|
8
|
-
*
|
|
9
|
-
* @example
|
|
10
|
-
* ```tsx
|
|
11
|
-
* const { data, page, nextPage, hasNextPage } = useNotificationHistory({
|
|
12
|
-
* config: TTT_NOTIFICATION_CONFIG,
|
|
13
|
-
* userId: user.uid,
|
|
14
|
-
* category: 'user',
|
|
15
|
-
* });
|
|
16
|
-
* ```
|
|
17
|
-
*/
|
|
18
|
-
export function useNotificationHistory({ config, userId, category, enabled = true, pageSize = DEFAULT_PAGE_SIZE, }) {
|
|
19
|
-
const categoryConfig = config.categories[category];
|
|
20
|
-
if (!categoryConfig) {
|
|
21
|
-
throw new Error(`[notification-core] Unknown category: ${category}`);
|
|
22
|
-
}
|
|
23
|
-
const collectionPath = categoryConfig.historyPath(userId);
|
|
24
|
-
const constraints = [
|
|
25
|
-
orderBy('archival.archivedAt', 'desc'),
|
|
26
|
-
];
|
|
27
|
-
return useFirestorePaginated({
|
|
28
|
-
collectionPath,
|
|
29
|
-
queryKey: ['notifications', 'history', category, userId, { pageSize }],
|
|
30
|
-
constraints,
|
|
31
|
-
pageSize,
|
|
32
|
-
enabled: enabled && !!userId,
|
|
33
|
-
});
|
|
34
|
-
}
|
|
35
|
-
//# sourceMappingURL=useNotificationHistory.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useNotificationHistory.js","sourceRoot":"","sources":["../../../src/react/hooks/useNotificationHistory.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAEb,OAAO,EAAE,qBAAqB,EAAE,MAAM,mCAAmC,CAAC;AAC1E,OAAO,EAAE,OAAO,EAAwB,MAAM,oBAAoB,CAAC;AAGnE,MAAM,iBAAiB,GAAG,EAAE,CAAC;AAE7B;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,sBAAsB,CAAC,EACrC,MAAM,EACN,MAAM,EACN,QAAQ,EACR,OAAO,GAAG,IAAI,EACd,QAAQ,GAAG,iBAAiB,GACE;IAC9B,MAAM,cAAc,GAAG,MAAM,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC;IACnD,IAAI,CAAC,cAAc,EAAE,CAAC;QACpB,MAAM,IAAI,KAAK,CAAC,yCAAyC,QAAQ,EAAE,CAAC,CAAC;IACvE,CAAC;IAED,MAAM,cAAc,GAAG,cAAc,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC;IAE1D,MAAM,WAAW,GAAsB;QACrC,OAAO,CAAC,qBAAqB,EAAE,MAAM,CAAC;KACvC,CAAC;IAEF,OAAO,qBAAqB,CAAyB;QACnD,cAAc;QACd,QAAQ,EAAE,CAAC,eAAe,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,QAAQ,EAAE,CAAC;QACtE,WAAW;QACX,QAAQ;QACR,OAAO,EAAE,OAAO,IAAI,CAAC,CAAC,MAAM;KAC7B,CAAC,CAAC;AACL,CAAC"}
|