@ttt-productions/notification-core 0.11.0 → 0.13.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 (34) hide show
  1. package/README.md +3 -3
  2. package/dist/index.d.ts +1 -1
  3. package/dist/index.d.ts.map +1 -1
  4. package/dist/react/components/NotificationList.d.ts +1 -1
  5. package/dist/react/components/NotificationList.d.ts.map +1 -1
  6. package/dist/react/components/NotificationList.js +11 -7
  7. package/dist/react/components/NotificationList.js.map +1 -1
  8. package/dist/react/components/index.d.ts +0 -1
  9. package/dist/react/components/index.d.ts.map +1 -1
  10. package/dist/react/components/index.js +0 -1
  11. package/dist/react/components/index.js.map +1 -1
  12. package/dist/react/hooks/index.d.ts +0 -1
  13. package/dist/react/hooks/index.d.ts.map +1 -1
  14. package/dist/react/hooks/index.js +0 -1
  15. package/dist/react/hooks/index.js.map +1 -1
  16. package/dist/react/hooks/useArchiveAllNotifications.d.ts +19 -8
  17. package/dist/react/hooks/useArchiveAllNotifications.d.ts.map +1 -1
  18. package/dist/react/hooks/useArchiveAllNotifications.js +54 -31
  19. package/dist/react/hooks/useArchiveAllNotifications.js.map +1 -1
  20. package/dist/react/index.d.ts +2 -2
  21. package/dist/react/index.d.ts.map +1 -1
  22. package/dist/react/index.js +2 -2
  23. package/dist/react/index.js.map +1 -1
  24. package/dist/types.d.ts +70 -65
  25. package/dist/types.d.ts.map +1 -1
  26. package/package.json +1 -1
  27. package/dist/react/components/NotificationHistoryList.d.ts +0 -7
  28. package/dist/react/components/NotificationHistoryList.d.ts.map +0 -1
  29. package/dist/react/components/NotificationHistoryList.js +0 -41
  30. package/dist/react/components/NotificationHistoryList.js.map +0 -1
  31. package/dist/react/hooks/useNotificationHistory.d.ts +0 -16
  32. package/dist/react/hooks/useNotificationHistory.d.ts.map +0 -1
  33. package/dist/react/hooks/useNotificationHistory.js +0 -35
  34. 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 (carrying an `ArchivalInfo` audit trail,
22
- and an app-supplied `expireAt` on the history doc to back native TTL). History
23
- docs extend the active shape with `expireAt`.
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, NotificationHistoryDoc, ArchivalInfo, PendingNotification, NotificationCategoryConfig, NotificationTypeConfig, NotificationSystemConfig, UseActiveNotificationsOptions, UseUnreadCountOptions, UseArchiveNotificationOptions, UseArchiveAllNotificationsOptions, ArchiveAllResult, ArchiveAllLoopResult, UseNotificationHistoryOptions, NotificationListProps, NotificationEmptyStateProps, NotificationHistoryListProps, NotificationUnreadBadgeProps, } from './types.js';
1
+ export type { NotificationDoc, PendingNotification, NotificationCategoryConfig, NotificationTypeConfig, NotificationSystemConfig, UseActiveNotificationsOptions, UseUnreadCountOptions, UseArchiveNotificationOptions, UseArchiveAllNotificationsOptions, ArchiveAllJobStatus, EnqueueArchiveAllResult, ArchiveAllJobSnapshot, ArchiveAllPollResult, NotificationListProps, NotificationEmptyStateProps, NotificationUnreadBadgeProps, } from './types.js';
2
2
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,eAAe,EACf,sBAAsB,EACtB,YAAY,EACZ,mBAAmB,EACnB,0BAA0B,EAC1B,sBAAsB,EACtB,wBAAwB,EACxB,6BAA6B,EAC7B,qBAAqB,EACrB,6BAA6B,EAC7B,iCAAiC,EACjC,gBAAgB,EAChB,oBAAoB,EACpB,6BAA6B,EAC7B,qBAAqB,EACrB,2BAA2B,EAC3B,4BAA4B,EAC5B,4BAA4B,GAC7B,MAAM,YAAY,CAAC"}
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,mBAAmB,EACnB,uBAAuB,EACvB,qBAAqB,EACrB,oBAAoB,EACpB,qBAAqB,EACrB,2BAA2B,EAC3B,4BAA4B,GAC7B,MAAM,YAAY,CAAC"}
@@ -2,5 +2,5 @@ import type { NotificationListProps } from '../../types.js';
2
2
  /**
3
3
  * Scrollable list of active notifications with click-to-archive and clear-all.
4
4
  */
5
- export declare function NotificationList({ config, userId, category, onNotificationClick, archiveFn, archiveAllFn, onClearAll, refetchInterval, emptyText, }: NotificationListProps): import("react").JSX.Element;
5
+ export declare function NotificationList({ config, userId, category, onNotificationClick, archiveFn, enqueueArchiveAllFn, getArchiveAllStatusFn, onClearAll, refetchInterval, emptyText, }: NotificationListProps): import("react").JSX.Element;
6
6
  //# sourceMappingURL=NotificationList.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"NotificationList.d.ts","sourceRoot":"","sources":["../../../src/react/components/NotificationList.tsx"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAmB,qBAAqB,EAAE,MAAM,gBAAgB,CAAC;AAE7E;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,EAC/B,MAAM,EACN,MAAM,EACN,QAAQ,EACR,mBAAmB,EACnB,SAAS,EACT,YAAY,EACZ,UAAU,EACV,eAAe,EACf,SAAS,GACV,EAAE,qBAAqB,+BA2IvB"}
1
+ {"version":3,"file":"NotificationList.d.ts","sourceRoot":"","sources":["../../../src/react/components/NotificationList.tsx"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAmB,qBAAqB,EAAE,MAAM,gBAAgB,CAAC;AAE7E;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,EAC/B,MAAM,EACN,MAAM,EACN,QAAQ,EACR,mBAAmB,EACnB,SAAS,EACT,mBAAmB,EACnB,qBAAqB,EACrB,UAAU,EACV,eAAe,EACf,SAAS,GACV,EAAE,qBAAqB,+BA+IvB"}
@@ -10,7 +10,7 @@ import { formatRelativeTime } from './relative-time.js';
10
10
  /**
11
11
  * Scrollable list of active notifications with click-to-archive and clear-all.
12
12
  */
13
- export function NotificationList({ config, userId, category, onNotificationClick, archiveFn, archiveAllFn, onClearAll, refetchInterval, emptyText, }) {
13
+ export function NotificationList({ config, userId, category, onNotificationClick, archiveFn, enqueueArchiveAllFn, getArchiveAllStatusFn, onClearAll, refetchInterval, emptyText, }) {
14
14
  const { data: notifications, isLoading, hasNextPage, nextPage, } = useActiveNotifications({
15
15
  config,
16
16
  userId,
@@ -25,7 +25,8 @@ export function NotificationList({ config, userId, category, onNotificationClick
25
25
  const archiveAllMutation = useArchiveAllNotifications({
26
26
  userId,
27
27
  category,
28
- archiveAllFn,
28
+ enqueueArchiveAllFn,
29
+ getArchiveAllStatusFn,
29
30
  });
30
31
  const handleNotificationClick = useCallback(async (notification) => {
31
32
  try {
@@ -36,9 +37,11 @@ export function NotificationList({ config, userId, category, onNotificationClick
36
37
  }
37
38
  onNotificationClick(notification);
38
39
  }, [archiveMutation, onNotificationClick]);
39
- // I3: surface a failed/incomplete clear instead of swallowing it. `onClearAll` (and the
40
- // tray-closing side effects the app wires to it) fires ONLY when the active set was fully
41
- // drained — otherwise the user keeps the "notifications remain — try again" affordance.
40
+ // Surface a failed/incomplete clear instead of swallowing it. `onClearAll` (and the tray-closing
41
+ // side effects the app wires to it) fires ONLY when the server job fully drained the category —
42
+ // otherwise the user keeps the "notifications remain — try again" affordance. The poller resolves
43
+ // with an explicit terminal result (`complete` | `incomplete` | `failed`) and only rejects on a
44
+ // hard enqueue/poll throw.
42
45
  const [clearIncomplete, setClearIncomplete] = useState(false);
43
46
  const handleClearAll = useCallback(async () => {
44
47
  setClearIncomplete(false);
@@ -47,12 +50,13 @@ export function NotificationList({ config, userId, category, onNotificationClick
47
50
  result = await archiveAllMutation.mutateAsync();
48
51
  }
49
52
  catch {
50
- // Hard failure: do not fire onClearAll; surface the retry affordance.
53
+ // Hard failure (enqueue/poll threw): do not fire onClearAll; surface the retry affordance.
51
54
  setClearIncomplete(true);
52
55
  return;
53
56
  }
54
57
  if (!result.complete) {
55
- // Resolved but the active set was not fully drained — keep notifications, prompt a retry.
58
+ // Job terminated without fully draining the category (incomplete/failed) — keep the
59
+ // notifications and prompt a retry.
56
60
  setClearIncomplete(true);
57
61
  return;
58
62
  }
@@ -1 +1 @@
1
- {"version":3,"file":"NotificationList.js","sourceRoot":"","sources":["../../../src/react/components/NotificationList.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC9C,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,gCAAgC,CAAC;AAC1E,OAAO,EAAE,sBAAsB,EAAE,MAAM,oCAAoC,CAAC;AAC5E,OAAO,EAAE,sBAAsB,EAAE,MAAM,oCAAoC,CAAC;AAC5E,OAAO,EAAE,0BAA0B,EAAE,MAAM,wCAAwC,CAAC;AACpF,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AACrE,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAGxD;;GAEG;AACH,MAAM,UAAU,gBAAgB,CAAC,EAC/B,MAAM,EACN,MAAM,EACN,QAAQ,EACR,mBAAmB,EACnB,SAAS,EACT,YAAY,EACZ,UAAU,EACV,eAAe,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EAAE,CAAC,EACX,OAAO,EAAE,GAAG,EAAE,CAAC,uBAAuB,CAAC,YAAY,CAAC,EACpD,SAAS,EAAE,CAAC,CAAC,EAAE,EAAE;gCACf,IAAI,CAAC,CAAC,GAAG,KAAK,OAAO,IAAI,CAAC,CAAC,GAAG,KAAK,GAAG,EAAE,CAAC;oCACvC,CAAC,CAAC,cAAc,EAAE,CAAC;oCACnB,uBAAuB,CAAC,YAAY,CAAC,CAAC;gCACxC,CAAC;4BACH,CAAC,aAED,cAAK,SAAS,EAAC,eAAe,YAC3B,WAAW,CAAC,YAAY,CAAC,IAAI,CAAC,GAC3B,EACN,eAAK,SAAS,EAAC,kBAAkB,aAC/B,cAAK,SAAS,EAAC,gBAAgB,YAAE,YAAY,CAAC,KAAK,GAAO,EAC1D,cAAK,SAAS,EAAC,kBAAkB,YAAE,YAAY,CAAC,OAAO,GAAO,EAC9D,cAAK,SAAS,EAAC,oBAAoB,YAChC,kBAAkB,CAAC,YAAY,CAAC,SAAS,CAAC,GACvC,IACF,EACL,YAAY,CAAC,KAAK,GAAG,CAAC,IAAI,CACzB,cAAK,SAAS,EAAC,gBAAgB,YAC7B,MAAC,KAAK,IAAC,OAAO,EAAC,WAAW,uBAAG,YAAY,CAAC,KAAK,IAAS,GACpD,CACP,KA1BI,YAAY,CAAC,EAAE,CA2BhB,CACP,CAAC,EACD,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,IACA,CACJ,GACK,IACF,CACP,CAAC;AACJ,CAAC"}
1
+ {"version":3,"file":"NotificationList.js","sourceRoot":"","sources":["../../../src/react/components/NotificationList.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC9C,OAAO,EAAE,KAAK,EAA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C,gBAAgB,YAC7B,MAAC,KAAK,IAAC,OAAO,EAAC,WAAW,uBAAG,YAAY,CAAC,KAAK,IAAS,GACpD,CACP,KA1BI,YAAY,CAAC,EAAE,CA2BhB,CACP,CAAC,EACD,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,IACA,CACJ,GACK,IACF,CACP,CAAC;AACJ,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;AACvE,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;AACvE,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;AAC7E,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,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;AAC7E,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,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"}
@@ -1,22 +1,33 @@
1
- import type { ArchiveAllLoopResult, UseArchiveAllNotificationsOptions } from '../../types.js';
1
+ import type { ArchiveAllPollResult, UseArchiveAllNotificationsOptions } from '../../types.js';
2
2
  /**
3
- * Archive the caller's whole category through an app-supplied callable adapter.
3
+ * Trigger + poll a SERVER-OWNED archive-all job for one notification category.
4
4
  *
5
- * Like {@link useArchiveNotification}, this performs no client Firestore writes
6
- * paging + ownership-checked deletion happen server-side via the callable the
7
- * app wires into `archiveAllFn`. On success it invalidates the read keys.
5
+ * This is a THIN STATUS POLLER, not a client loop. It:
6
+ * 1. enqueues ONE server job via `enqueueArchiveAllFn(category)` (the category the tab the tray
7
+ * was invoked on — flows into the job, preserving per-tab scoping: the worker archives ONLY
8
+ * that category's active cards, never all tabs);
9
+ * 2. polls `getArchiveAllStatusFn(jobId)` until the job reaches a terminal state
10
+ * (`complete` | `incomplete` | `failed`);
11
+ * 3. resolves an {@link ArchiveAllPollResult} the caller gates side effects on, and invalidates
12
+ * the read keys on a completed drain.
13
+ *
14
+ * All paging + ownership-checked per-card deletion happen server-side. The hook performs no client
15
+ * Firestore writes and never chains archive calls. The generic package hardcodes no callable name —
16
+ * the app injects both adapters.
8
17
  *
9
18
  * @example
10
19
  * ```tsx
11
- * const archiveNotification = httpsCallable(functions, 'archiveNotification');
20
+ * const enqueue = httpsCallable(functions, 'enqueueArchiveAll');
21
+ * const getStatus = httpsCallable(functions, 'getArchiveAllStatus');
12
22
  * const archiveAll = useArchiveAllNotifications({
13
23
  * userId: user.uid,
14
24
  * category: 'user',
15
- * archiveAllFn: () => archiveNotification({ category: 'user', scope: { kind: 'all' } }),
25
+ * enqueueArchiveAllFn: (category) => enqueue({ category }).then((r) => r.data),
26
+ * getArchiveAllStatusFn: (jobId) => getStatus({ jobId }).then((r) => r.data),
16
27
  * });
17
28
  *
18
29
  * archiveAll.mutate();
19
30
  * ```
20
31
  */
21
- export declare function useArchiveAllNotifications({ userId, category, archiveAllFn, invalidateKeys, }: UseArchiveAllNotificationsOptions): import("@tanstack/react-query").UseMutationResult<ArchiveAllLoopResult, Error, void, unknown>;
32
+ export declare function useArchiveAllNotifications({ userId, category, enqueueArchiveAllFn, getArchiveAllStatusFn, pollIntervalMs, maxPolls, invalidateKeys, }: UseArchiveAllNotificationsOptions): import("@tanstack/react-query").UseMutationResult<ArchiveAllPollResult, Error, void, unknown>;
22
33
  //# sourceMappingURL=useArchiveAllNotifications.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"useArchiveAllNotifications.d.ts","sourceRoot":"","sources":["../../../src/react/hooks/useArchiveAllNotifications.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,oBAAoB,EAAE,iCAAiC,EAAE,MAAM,gBAAgB,CAAC;AAE9F;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,0BAA0B,CAAC,EACzC,MAAM,EACN,QAAQ,EACR,YAAY,EACZ,cAAc,GACf,EAAE,iCAAiC,iGA0CnC"}
1
+ {"version":3,"file":"useArchiveAllNotifications.d.ts","sourceRoot":"","sources":["../../../src/react/hooks/useArchiveAllNotifications.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,oBAAoB,EACpB,iCAAiC,EAClC,MAAM,gBAAgB,CAAC;AASxB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,wBAAgB,0BAA0B,CAAC,EACzC,MAAM,EACN,QAAQ,EACR,mBAAmB,EACnB,qBAAqB,EACrB,cAAyC,EACzC,QAA4B,EAC5B,cAAc,GACf,EAAE,iCAAiC,iGAqDnC"}
@@ -1,25 +1,41 @@
1
1
  'use client';
2
2
  import { useMutation, useQueryClient } from '@tanstack/react-query';
3
+ const DEFAULT_POLL_INTERVAL_MS = 1500;
4
+ const DEFAULT_MAX_POLLS = 120; // ~3 min at the default interval
5
+ function sleep(ms) {
6
+ return new Promise((resolve) => setTimeout(resolve, ms));
7
+ }
3
8
  /**
4
- * Archive the caller's whole category through an app-supplied callable adapter.
9
+ * Trigger + poll a SERVER-OWNED archive-all job for one notification category.
10
+ *
11
+ * This is a THIN STATUS POLLER, not a client loop. It:
12
+ * 1. enqueues ONE server job via `enqueueArchiveAllFn(category)` (the category — the tab the tray
13
+ * was invoked on — flows into the job, preserving per-tab scoping: the worker archives ONLY
14
+ * that category's active cards, never all tabs);
15
+ * 2. polls `getArchiveAllStatusFn(jobId)` until the job reaches a terminal state
16
+ * (`complete` | `incomplete` | `failed`);
17
+ * 3. resolves an {@link ArchiveAllPollResult} the caller gates side effects on, and invalidates
18
+ * the read keys on a completed drain.
5
19
  *
6
- * Like {@link useArchiveNotification}, this performs no client Firestore writes
7
- * paging + ownership-checked deletion happen server-side via the callable the
8
- * app wires into `archiveAllFn`. On success it invalidates the read keys.
20
+ * All paging + ownership-checked per-card deletion happen server-side. The hook performs no client
21
+ * Firestore writes and never chains archive calls. The generic package hardcodes no callable name —
22
+ * the app injects both adapters.
9
23
  *
10
24
  * @example
11
25
  * ```tsx
12
- * const archiveNotification = httpsCallable(functions, 'archiveNotification');
26
+ * const enqueue = httpsCallable(functions, 'enqueueArchiveAll');
27
+ * const getStatus = httpsCallable(functions, 'getArchiveAllStatus');
13
28
  * const archiveAll = useArchiveAllNotifications({
14
29
  * userId: user.uid,
15
30
  * category: 'user',
16
- * archiveAllFn: () => archiveNotification({ category: 'user', scope: { kind: 'all' } }),
31
+ * enqueueArchiveAllFn: (category) => enqueue({ category }).then((r) => r.data),
32
+ * getArchiveAllStatusFn: (jobId) => getStatus({ jobId }).then((r) => r.data),
17
33
  * });
18
34
  *
19
35
  * archiveAll.mutate();
20
36
  * ```
21
37
  */
22
- export function useArchiveAllNotifications({ userId, category, archiveAllFn, invalidateKeys, }) {
38
+ export function useArchiveAllNotifications({ userId, category, enqueueArchiveAllFn, getArchiveAllStatusFn, pollIntervalMs = DEFAULT_POLL_INTERVAL_MS, maxPolls = DEFAULT_MAX_POLLS, invalidateKeys, }) {
23
39
  const queryClient = useQueryClient();
24
40
  const defaultInvalidateKeys = [
25
41
  ['notifications', 'active', category, userId],
@@ -27,37 +43,44 @@ export function useArchiveAllNotifications({ userId, category, archiveAllFn, inv
27
43
  ['notifications', 'history', category, userId],
28
44
  ];
29
45
  return useMutation({
30
- // I3: "Clear All" must actually clear ALL but it must also report HONESTLY when it could not.
31
- // The server bounds each call to a small page and returns `hasMore`; loop the adapter until the
32
- // active set is drained (bounded so a pathological tray can't run forever). The loop resolves on
33
- // an incomplete drain rather than throwing, so it returns an explicit `complete` flag the caller
34
- // gates side effects on (it is NOT a plain success — see ArchiveAllLoopResult).
46
+ // Server-owned archive-all: enqueue ONE job scoped to `category`, then poll its status until it
47
+ // reaches a terminal state. No browser loop, no chain of archive transactions. The mutation
48
+ // resolves with an explicit terminal result (never throws for an incomplete drain) `complete`
49
+ // is the load-bearing flag callers gate post-clear side effects on.
35
50
  mutationFn: async () => {
36
- const MAX_PASSES = 25; // bound: 25 × the server page cap — far beyond any real tray
37
- let archived = 0;
38
- let hasMore = true;
39
- let pass = 0;
40
- while (hasMore && pass < MAX_PASSES) {
41
- const r = await archiveAllFn();
42
- archived += r.archived;
43
- hasMore = r.hasMore;
44
- pass += 1;
45
- // No-progress guard: a pass that archived nothing yet still reports `hasMore` cannot make
46
- // progress on the next pass either (e.g. a generation-less head card the server can never
47
- // advance past) — looping would livelock to the pass bound. Stop now and report incomplete.
48
- if (r.archived === 0 && hasMore)
49
- break;
51
+ const { jobId } = await enqueueArchiveAllFn(category);
52
+ // Poll until terminal or until the guard bound is hit. A job that never terminates resolves
53
+ // `incomplete` (mirrors the old loop's honest "some remain" result) rather than hanging. The
54
+ // first poll happens immediately so a fast/already-complete job resolves without a delay.
55
+ let lastArchived = 0;
56
+ for (let poll = 0; poll < maxPolls; poll += 1) {
57
+ const snap = await getArchiveAllStatusFn(jobId);
58
+ lastArchived = snap.archived ?? 0;
59
+ if (snap.state === 'complete') {
60
+ return { status: 'complete', category, archived: lastArchived, complete: true };
61
+ }
62
+ if (snap.state === 'incomplete') {
63
+ return { status: 'incomplete', category, archived: lastArchived, complete: false };
64
+ }
65
+ if (snap.state === 'failed') {
66
+ return { status: 'failed', category, archived: lastArchived, complete: false, error: snap.error };
67
+ }
68
+ // Still in-progress — wait before the next poll unless this was the last allowed poll.
69
+ if (poll < maxPolls - 1)
70
+ await sleep(pollIntervalMs);
50
71
  }
51
- // `complete` is true ONLY when the active set was fully drained (`hasMore` is false). Hitting
52
- // the pass bound or the no-progress guard with `hasMore` still true returns an EXPLICIT
53
- // incomplete result, never a plain success.
54
- return { archived, hasMore, complete: !hasMore };
72
+ // Guard: the job never reached a terminal state within the poll budget report incomplete.
73
+ return { status: 'incomplete', category, archived: lastArchived, complete: false };
55
74
  },
56
- onSuccess: () => {
75
+ onSuccess: (result) => {
76
+ // Only a completed drain changed the active set; still invalidate on an incomplete drain since
77
+ // SOME cards were archived. A hard enqueue/poll failure rejects the mutation (onError), so this
78
+ // never runs for `failed`.
57
79
  const keysToInvalidate = invalidateKeys ?? defaultInvalidateKeys;
58
80
  keysToInvalidate.forEach((key) => {
59
81
  queryClient.invalidateQueries({ queryKey: [...key], exact: false });
60
82
  });
83
+ void result;
61
84
  },
62
85
  });
63
86
  }
@@ -1 +1 @@
1
- {"version":3,"file":"useArchiveAllNotifications.js","sourceRoot":"","sources":["../../../src/react/hooks/useArchiveAllNotifications.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAEb,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAGpE;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,UAAU,0BAA0B,CAAC,EACzC,MAAM,EACN,QAAQ,EACR,YAAY,EACZ,cAAc,GACoB;IAClC,MAAM,WAAW,GAAG,cAAc,EAAE,CAAC;IAErC,MAAM,qBAAqB,GAAG;QAC5B,CAAC,eAAe,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,CAAC;QAC7C,CAAC,eAAe,EAAE,cAAc,EAAE,QAAQ,EAAE,MAAM,CAAC;QACnD,CAAC,eAAe,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,CAAC;KAC/C,CAAC;IAEF,OAAO,WAAW,CAAC;QACjB,gGAAgG;QAChG,gGAAgG;QAChG,iGAAiG;QACjG,iGAAiG;QACjG,gFAAgF;QAChF,U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chiveAllNotifications, useNotificationHistory, } from './hooks/index.js';
2
- export { NotificationList, NotificationEmptyState, NotificationHistoryList, NotificationUnreadBadge, } from './components/index.js';
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,EAC1B,sBAAsB,GACvB,MAAM,kBAAkB,CAAC;AAG1B,OAAO,EACL,gBAAgB,EAChB,sBAAsB,EACtB,uBAAuB,EACvB,uBAAuB,GACxB,MAAM,uBAAuB,CAAC"}
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"}
@@ -1,6 +1,6 @@
1
1
  "use client";
2
2
  // Hooks
3
- export { useActiveNotifications, useUnreadCount, useArchiveNotification, useArchiveAllNotifications, useNotificationHistory, } from './hooks/index.js';
3
+ export { useActiveNotifications, useUnreadCount, useArchiveNotification, useArchiveAllNotifications, } from './hooks/index.js';
4
4
  // Components
5
- export { NotificationList, NotificationEmptyState, NotificationHistoryList, NotificationUnreadBadge, } from './components/index.js';
5
+ export { NotificationList, NotificationEmptyState, NotificationUnreadBadge, } from './components/index.js';
6
6
  //# sourceMappingURL=index.js.map
@@ -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,EAC1B,sBAAsB,GACvB,MAAM,kBAAkB,CAAC;AAE1B,aAAa;AACb,OAAO,EACL,gBAAgB,EAChB,sBAAsB,EACtB,uBAAuB,EACvB,uBAAuB,GACxB,MAAM,uBAAuB,CAAC"}
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
  */
@@ -193,51 +168,81 @@ export interface UseArchiveNotificationOptions {
193
168
  invalidateKeys?: readonly unknown[][];
194
169
  }
195
170
  /**
196
- * Result of ONE archive-all server call. `hasMore` is true when the server hit its per-invocation
197
- * cap and the caller's active set was NOT fully drained — `useArchiveAllNotifications` loops the
198
- * adapter until `hasMore` is false so "Clear All" actually clears all (I3).
171
+ * Terminal + transient states of a server-owned archive-all job, as surfaced to the UI.
199
172
  *
200
- * NOTE: the loop's aggregate result carries the same `archived`/`hasMore` shape PLUS a `complete`
201
- * flag (`ArchiveAllLoopResult`); a single server page does not know whether the WHOLE active set
202
- * was drained, so the per-call shape here intentionally has no `complete`.
173
+ * - `idle` — nothing enqueued yet (initial / reset state).
174
+ * - `enqueuing` the enqueue adapter is in flight (job not yet acknowledged).
175
+ * - `in-progress` the job is enqueued/running; the worker is still draining the category.
176
+ * - `complete` — TERMINAL: the worker fully drained the category's active set.
177
+ * - `incomplete` — TERMINAL: the job stopped without draining everything (e.g. hit its own
178
+ * bound / a non-advanceable card). The tray keeps a "some remain — try again"
179
+ * affordance, mirroring the old loop's incomplete result.
180
+ * - `failed` — TERMINAL: the enqueue call threw, or the job dead-lettered / reported failure.
203
181
  */
204
- export interface ArchiveAllResult {
205
- archived: number;
206
- hasMore: boolean;
182
+ export type ArchiveAllJobStatus = 'idle' | 'enqueuing' | 'in-progress' | 'complete' | 'incomplete' | 'failed';
183
+ /**
184
+ * Result of the INJECTED enqueue adapter — triggers exactly one server-owned archive-all job for
185
+ * the given category and returns immediately with the job's id (idempotent per user+category+request
186
+ * on the app side). The app wires this to its `httpsCallable(functions, 'enqueueArchiveAll')`
187
+ * (or equivalent); the generic package never names the callable.
188
+ */
189
+ export interface EnqueueArchiveAllResult {
190
+ /** Server job id the poller then polls via the status adapter. */
191
+ jobId: string;
192
+ }
193
+ /**
194
+ * Snapshot of a server-owned archive-all job, returned by the INJECTED status-query adapter.
195
+ * The poller maps `state` → {@link ArchiveAllJobStatus} and stops polling on any terminal state.
196
+ * `category` echoes the tab/category the job was enqueued for so the UI can assert per-tab scoping.
197
+ */
198
+ export interface ArchiveAllJobSnapshot {
199
+ /** Job lifecycle state as owned by the server worker. */
200
+ state: 'in-progress' | 'complete' | 'incomplete' | 'failed';
201
+ /** The notification category/tab this job is scoped to (must match the enqueue category). */
202
+ category: string;
203
+ /** Cards archived so far (monotonic); optional progress for the UI. */
204
+ archived?: number;
205
+ /** Human-readable failure reason when `state === 'failed'` (optional). */
206
+ error?: string;
207
207
  }
208
208
  /**
209
- * Aggregate result of the `useArchiveAllNotifications` continuation loop (I3). `complete` is the
210
- * load-bearing completion contract: it is `true` ONLY when the active set was fully drained
211
- * (`hasMore` reached `false`). It is `false` when the loop stopped early either the no-progress
212
- * guard tripped (a pass archived nothing yet still reported `hasMore`, e.g. a generation-less head
213
- * card that can't advance) or the per-mutation pass bound was hit with `hasMore` still `true`.
214
- * Callers MUST gate post-clear side effects (closing the tray, `onClearAll`) on `complete`, not on
215
- * mere resolution — the mutation resolves on an incomplete drain rather than throwing.
209
+ * Aggregate result the poller resolves with once the job reaches a terminal state.
210
+ * `complete` is the load-bearing completion contract (true ONLY when the whole category was
211
+ * drained), preserved from the old loop so callers gate side effects the same way.
216
212
  */
217
- export interface ArchiveAllLoopResult {
213
+ export interface ArchiveAllPollResult {
214
+ status: Extract<ArchiveAllJobStatus, 'complete' | 'incomplete' | 'failed'>;
215
+ category: string;
218
216
  archived: number;
219
- hasMore: boolean;
220
217
  complete: boolean;
218
+ error?: string;
221
219
  }
222
220
  export interface UseArchiveAllNotificationsOptions {
223
221
  userId: string;
224
222
  category: string;
225
223
  /**
226
- * App-supplied adapter that archives ONE bounded page of the caller's whole category — typically
227
- * an `httpsCallable(functions, 'archiveNotification')` invoked with the `{ kind: 'all' }` scope.
228
- * Returns `{ archived, hasMore }`; the hook re-invokes it while `hasMore` is true. No client
229
- * Firestore writes.
224
+ * App-supplied adapter that ENQUEUES one server-owned archive-all job scoped to `category` and
225
+ * returns its `jobId`. The `category` is passed so the app callable can carry the tab/source into
226
+ * the job (per-tab scoping is REQUIRED — the worker archives only that category's active cards).
227
+ * Typically `(category) => enqueueArchiveAll({ category })` over an `httpsCallable`.
230
228
  */
231
- archiveAllFn: () => Promise<ArchiveAllResult>;
229
+ enqueueArchiveAllFn: (category: string) => Promise<EnqueueArchiveAllResult>;
230
+ /**
231
+ * App-supplied adapter that returns the current {@link ArchiveAllJobSnapshot} for a job id — the
232
+ * hook polls it until the job reaches a terminal state. Typically
233
+ * `(jobId) => getArchiveAllStatus({ jobId })` over an `httpsCallable`, or a Firestore read of the
234
+ * job doc. No client Firestore writes.
235
+ */
236
+ getArchiveAllStatusFn: (jobId: string) => Promise<ArchiveAllJobSnapshot>;
237
+ /** Poll interval in ms while the job is in-progress (default 1500). */
238
+ pollIntervalMs?: number;
239
+ /**
240
+ * Max number of status polls before the poller gives up and resolves `incomplete` (guards a job
241
+ * that never reaches a terminal state — default 120, i.e. ~3 min at the default interval).
242
+ */
243
+ maxPolls?: number;
232
244
  invalidateKeys?: readonly unknown[][];
233
245
  }
234
- export interface UseNotificationHistoryOptions {
235
- config: NotificationSystemConfig;
236
- userId: string;
237
- category: string;
238
- enabled?: boolean;
239
- pageSize?: number;
240
- }
241
246
  export interface NotificationListProps {
242
247
  config: NotificationSystemConfig;
243
248
  userId: string;
@@ -249,11 +254,17 @@ export interface NotificationListProps {
249
254
  */
250
255
  archiveFn: (notificationId: string) => Promise<unknown>;
251
256
  /**
252
- * Adapter that archives ONE bounded page of the caller's whole category (returns
253
- * `{ archived, hasMore }`). Passed straight through to `useArchiveAllNotifications`, which loops
254
- * it until fully drained; the app wires it to its callable.
257
+ * Adapter that ENQUEUES one server-owned archive-all job scoped to `category` and returns its
258
+ * `jobId`. Passed straight through to `useArchiveAllNotifications`; the app wires it to its
259
+ * enqueue callable. Per-tab scoping: the category flows through to the job.
260
+ */
261
+ enqueueArchiveAllFn: (category: string) => Promise<EnqueueArchiveAllResult>;
262
+ /**
263
+ * Adapter that returns the current status snapshot for an archive-all `jobId`. Passed straight
264
+ * through to `useArchiveAllNotifications`, which polls it until the job is terminal; the app wires
265
+ * it to its status callable / job-doc read.
255
266
  */
256
- archiveAllFn: () => Promise<ArchiveAllResult>;
267
+ getArchiveAllStatusFn: (jobId: string) => Promise<ArchiveAllJobSnapshot>;
257
268
  onClearAll?: () => void;
258
269
  refetchInterval?: number;
259
270
  emptyText?: string;
@@ -261,12 +272,6 @@ export interface NotificationListProps {
261
272
  export interface NotificationEmptyStateProps {
262
273
  text?: string;
263
274
  }
264
- export interface NotificationHistoryListProps {
265
- config: NotificationSystemConfig;
266
- userId: string;
267
- category: string;
268
- onNotificationClick?: (notification: NotificationHistoryDoc) => void;
269
- }
270
275
  export interface NotificationUnreadBadgeProps {
271
276
  config: NotificationSystemConfig;
272
277
  userId: string;
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAMH;;;GAGG;AACH,MAAM,WAAW,eAAe;IAC9B,uBAAuB;IACvB,EAAE,EAAE,MAAM,CAAC;IACX,iEAAiE;IACjE,IAAI,EAAE,MAAM,CAAC;IACb,yEAAyE;IACzE,QAAQ,EAAE,MAAM,CAAC;IACjB,8CAA8C;IAC9C,QAAQ,EAAE,MAAM,CAAC;IAGjB,4DAA4D;IAC5D,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IAG5B,yBAAyB;IACzB,KAAK,EAAE,MAAM,CAAC;IACd,wBAAwB;IACxB,OAAO,EAAE,MAAM,CAAC;IAGhB,gCAAgC;IAChC,KAAK,EAAE,MAAM,CAAC;IACd;;;;OAIG;IACH,cAAc,EAAE,MAAM,EAAE,CAAC;IAGzB,iEAAiE;IACjE,UAAU,EAAE,MAAM,CAAC;IACnB,yDAAyD;IACzD,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAGlC;;;;;;;OAOG;IACH,MAAM,EAAE,MAAM,CAAC;IAEf;;;;;;;OAOG;IACH,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,2EAA2E;IAC3E,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAG1B,uBAAuB;IACvB,SAAS,EAAE,MAAM,CAAC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CAAC;IACzE,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.11.0",
3
+ "version": "0.13.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,MAAM,EACN,QAAQ,EACR,mBAAmB,GACU;IAC7B,MAAM,EACJ,IAAI,EAAE,OAAO,EACb,SAAS,EACT,WAAW,EACX,QAAQ,GACT,GAAG,sBAAsB,CAAC;QACzB,MAAM;QACN,MAAM;QACN,QAAQ;KACT,CAAC,CAAC;IAEH,MAAM,WAAW,GAAG,CAAC,IAAY,EAAE,EAAE;QACnC,MAAM,UAAU,GAAG,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QACtC,OAAO,UAAU,EAAE,IAAI,IAAI,IAAI,CAAC;IAClC,CAAC,CAAC;IAEF,IAAI,SAAS,EAAE,CAAC;QACd,OAAO,cAAK,SAAS,EAAC,aAAa,mCAAyB,CAAC;IAC/D,CAAC;IAED,IAAI,CAAC,OAAO,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACrC,OAAO,CACL,cAAK,SAAS,EAAC,WAAW,YACxB,YAAG,SAAS,EAAC,gBAAgB,wCAA4B,GACrD,CACP,CAAC;IACJ,CAAC;IAED,OAAO,CACL,eAAK,SAAS,EAAC,UAAU,aACvB,cAAK,SAAS,EAAC,iBAAiB,YAC9B,eAAM,SAAS,EAAC,uBAAuB,wBAAe,GAClD,EACN,KAAC,SAAS,KAAG,EAEZ,OAAO,CAAC,GAAG,CAAC,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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"}