@facto-to/notifications 0.0.0-stage → 0.1.0-beta.2

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/ui.d.ts ADDED
@@ -0,0 +1,335 @@
1
+ import * as react from 'react';
2
+ import { ButtonHTMLAttributes, ReactNode } from 'react';
3
+
4
+ interface NotificationBellProps extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'aria-label'> {
5
+ variant?: 'dot' | 'count';
6
+ unreadCount: number;
7
+ hasCritical?: boolean;
8
+ ariaLabel?: string;
9
+ open?: boolean;
10
+ size?: 'sm' | 'md' | 'lg';
11
+ }
12
+ /**
13
+ * Topbar notification trigger built on `@facto-to/design-system` `IconButton`
14
+ * with a `44px` accessible touch target and subtle dot or count indicator.
15
+ */
16
+ declare const NotificationBell: react.ForwardRefExoticComponent<NotificationBellProps & react.RefAttributes<HTMLButtonElement>>;
17
+
18
+ interface EventScope {
19
+ environment?: string;
20
+ accountRealm?: string;
21
+ deploymentTarget?: string;
22
+ organizationId?: string;
23
+ userWallet?: string;
24
+ chainId?: number;
25
+ }
26
+ interface EventMeta {
27
+ eventId: string;
28
+ eventType: string;
29
+ schemaVersion: number;
30
+ occurredAt: string;
31
+ correlationId?: string;
32
+ producer: string;
33
+ scope: EventScope;
34
+ }
35
+ type InAppMessageMode = 'inbox' | 'mandatory_security' | 'live_signal';
36
+ type InAppSeverity = 'info' | 'success' | 'warning' | 'critical';
37
+ interface InAppMessageEnvelope<TPayload = Record<string, unknown>> {
38
+ meta: EventMeta;
39
+ cursor?: string;
40
+ mode: InAppMessageMode;
41
+ severity: InAppSeverity;
42
+ category: string;
43
+ aggregationKey?: string;
44
+ deepLink?: string;
45
+ invalidateKeys: string[];
46
+ payload: TPayload;
47
+ }
48
+ type RealtimeStreamStatus = 'idle' | 'connecting' | 'open' | 'reconnecting' | 'revoked' | 'closed';
49
+
50
+ type NotificationAmountTone = 'neutral' | 'positive' | 'danger';
51
+ type NotificationStatusTone = 'neutral' | 'success' | 'warning' | 'danger';
52
+ type NotificationClaimStatus = 'open' | 'claimed' | 'resolved' | 'suppressed';
53
+ interface NotificationLogoSlot {
54
+ src?: string;
55
+ alt?: string;
56
+ fallback?: string;
57
+ }
58
+ interface NotificationStateTransition {
59
+ from: string;
60
+ to: string;
61
+ toTone?: NotificationStatusTone;
62
+ meta?: string;
63
+ }
64
+ interface NotificationAttachment {
65
+ name: string;
66
+ meta?: string;
67
+ href?: string;
68
+ }
69
+ interface NotificationItem {
70
+ id: string;
71
+ eventId?: string;
72
+ aggregationKey?: string;
73
+ mode: InAppMessageMode;
74
+ severity: InAppSeverity;
75
+ category: string;
76
+ title: string;
77
+ subtitle?: string;
78
+ description?: string;
79
+ actorName?: string;
80
+ actorAvatarUrl?: string;
81
+ contextLabel?: string;
82
+ timestamp: string;
83
+ dayGroup?: string;
84
+ unread: boolean;
85
+ mandatory?: boolean;
86
+ deepLink?: string;
87
+ amountDisplay?: string;
88
+ amountTone?: NotificationAmountTone;
89
+ counterparty?: string;
90
+ counterpartyLabel?: string;
91
+ statusLabel?: string;
92
+ statusTone?: NotificationStatusTone;
93
+ logos?: readonly NotificationLogoSlot[];
94
+ stateTransition?: NotificationStateTransition;
95
+ quoteBody?: string;
96
+ quoteMention?: string;
97
+ attachment?: NotificationAttachment;
98
+ claimStatus?: NotificationClaimStatus;
99
+ claimedBy?: string;
100
+ occurrenceCount?: number;
101
+ meta?: Record<string, unknown>;
102
+ }
103
+ interface NotificationLiveEvent {
104
+ envelope?: InAppMessageEnvelope;
105
+ item?: NotificationItem | null;
106
+ }
107
+
108
+ interface TransactionNotificationCardProps {
109
+ item: NotificationItem;
110
+ onSelect?: (item: NotificationItem) => void;
111
+ highlighted?: boolean;
112
+ className?: string;
113
+ }
114
+ /**
115
+ * Family A notification card for transaction-centric activity feeds.
116
+ * Renders a hairline surface card with overlapping `LogoStack` marks,
117
+ * tabular timestamp/amount alignment, and muted danger styling on failures.
118
+ */
119
+ declare function TransactionNotificationCard({ item, onSelect, highlighted, className, }: TransactionNotificationCardProps): react.JSX.Element;
120
+ interface TransactionNotificationGroupProps {
121
+ items: readonly NotificationItem[];
122
+ onSelect?: (item: NotificationItem) => void;
123
+ highlightedKey?: string | null;
124
+ defaultDayLabel?: string;
125
+ emptyTitle?: ReactNode;
126
+ emptyDescription?: ReactNode;
127
+ className?: string;
128
+ }
129
+ /**
130
+ * Groups `TransactionNotificationCard` entries by `dayGroup` preserving input order.
131
+ */
132
+ declare function TransactionNotificationGroup({ items, onSelect, highlightedKey, defaultDayLabel, emptyTitle, emptyDescription, className, }: TransactionNotificationGroupProps): react.JSX.Element;
133
+
134
+ interface NotificationRowAction {
135
+ label: string;
136
+ variant?: 'primary' | 'secondary' | 'danger' | 'text';
137
+ onClick: (item: NotificationItem) => void;
138
+ disabled?: boolean;
139
+ loading?: boolean;
140
+ }
141
+ interface NotificationRowProps {
142
+ item: NotificationItem;
143
+ highlighted?: boolean;
144
+ inlineActions?: readonly NotificationRowAction[];
145
+ onSelect?: (item: NotificationItem) => void;
146
+ onAttachmentClick?: (item: NotificationItem) => void;
147
+ onReplySubmit?: (item: NotificationItem, message: string) => void;
148
+ replyPlaceholder?: string;
149
+ className?: string;
150
+ }
151
+ /**
152
+ * Family B hairline-separated notification row with leading Avatar + status badge
153
+ * and 4 optional contextual slots: quote box, inline actions, state transition,
154
+ * and evidence attachment strip.
155
+ */
156
+ declare function NotificationRow({ item, highlighted, inlineActions, onSelect, onAttachmentClick, onReplySubmit, replyPlaceholder, className, }: NotificationRowProps): react.JSX.Element;
157
+
158
+ interface WorkspaceNotificationTab {
159
+ id: string;
160
+ label: string;
161
+ count?: number;
162
+ critical?: boolean;
163
+ filter?: (item: NotificationItem) => boolean;
164
+ }
165
+ interface WorkspaceNotificationFeedProps {
166
+ title?: ReactNode;
167
+ items: readonly NotificationItem[];
168
+ tabs?: readonly WorkspaceNotificationTab[];
169
+ activeTab?: string;
170
+ defaultTab?: string;
171
+ onTabChange?: (tabId: string) => void;
172
+ onMarkAllRead?: () => void;
173
+ markAllReadLabel?: string;
174
+ markAllReadDisabled?: boolean;
175
+ loading?: boolean;
176
+ error?: ReactNode;
177
+ onRetry?: () => void;
178
+ emptyTitle?: ReactNode;
179
+ emptyDescription?: ReactNode;
180
+ highlightedKey?: string | null;
181
+ renderRow?: (item: NotificationItem) => ReactNode;
182
+ getRowActions?: (item: NotificationItem) => readonly NotificationRowAction[];
183
+ onSelectItem?: (item: NotificationItem) => void;
184
+ onAttachmentClick?: (item: NotificationItem) => void;
185
+ onReplySubmit?: (item: NotificationItem, message: string) => void;
186
+ headerEnd?: ReactNode;
187
+ className?: string;
188
+ }
189
+ /**
190
+ * Family B workspace notification feed with hairline-separated rows,
191
+ * underline category tabs, and DS loading/error/empty states.
192
+ */
193
+ declare function WorkspaceNotificationFeed({ title, items, tabs, activeTab, defaultTab, onTabChange, onMarkAllRead, markAllReadLabel, markAllReadDisabled, loading, error, onRetry, emptyTitle, emptyDescription, highlightedKey, renderRow, getRowActions, onSelectItem, onAttachmentClick, onReplySubmit, headerEnd, className, }: WorkspaceNotificationFeedProps): react.JSX.Element;
194
+
195
+ interface ActionQueueCardProps {
196
+ item: NotificationItem;
197
+ currentOperator?: string;
198
+ onClaim?: (id: string) => void;
199
+ onResolve?: (id: string) => void;
200
+ onSelect?: (item: NotificationItem) => void;
201
+ busy?: boolean;
202
+ claimLabel?: string;
203
+ resolveLabel?: string;
204
+ className?: string;
205
+ }
206
+ /**
207
+ * Claimable operational queue card with occurrence count pill, claimer badge,
208
+ * and Claim / Resolve actions (`>= 44px` touch targets).
209
+ */
210
+ declare function ActionQueueCard({ item, currentOperator, onClaim, onResolve, onSelect, busy, claimLabel, resolveLabel, className, }: ActionQueueCardProps): react.JSX.Element;
211
+
212
+ interface IncidentBannerProps {
213
+ tone?: 'danger' | 'warning' | 'info';
214
+ title: ReactNode;
215
+ description?: ReactNode;
216
+ occurrenceCount?: number;
217
+ occurrenceLabel?: string;
218
+ actionLabel?: string;
219
+ onAction?: () => void;
220
+ actionDisabled?: boolean;
221
+ secondaryAction?: ReactNode;
222
+ className?: string;
223
+ }
224
+ /**
225
+ * Operational incident banner wrapping `@facto-to/design-system` `Notice`
226
+ * with an inline-flex actions row (occurrence count pill + primary action).
227
+ */
228
+ declare function IncidentBanner({ tone, title, description, occurrenceCount, occurrenceLabel, actionLabel, onAction, actionDisabled, secondaryAction, className, }: IncidentBannerProps): react.JSX.Element;
229
+
230
+ interface NotificationDrawerPanelProps {
231
+ title?: ReactNode;
232
+ titleNode?: ReactNode;
233
+ descriptionNode?: ReactNode;
234
+ closeNode?: ReactNode;
235
+ variant?: 'transactions' | 'workspace';
236
+ items: readonly NotificationItem[];
237
+ streamStatus?: RealtimeStreamStatus;
238
+ loading?: boolean;
239
+ error?: ReactNode;
240
+ onRetry?: () => void;
241
+ onMarkAllRead?: () => void;
242
+ markAllReadLabel?: string;
243
+ onSelectItem?: (item: NotificationItem) => void;
244
+ onAttachmentClick?: (item: NotificationItem) => void;
245
+ onReplySubmit?: (item: NotificationItem, message: string) => void;
246
+ tabs?: readonly WorkspaceNotificationTab[];
247
+ activeTab?: string;
248
+ defaultTab?: string;
249
+ onTabChange?: (tabId: string) => void;
250
+ getRowActions?: (item: NotificationItem) => readonly NotificationRowAction[];
251
+ renderItem?: (item: NotificationItem) => ReactNode;
252
+ emptyTitle?: ReactNode;
253
+ emptyDescription?: ReactNode;
254
+ highlightedKey?: string | null;
255
+ footer?: ReactNode;
256
+ className?: string;
257
+ }
258
+ /**
259
+ * Presentational panel layout rendered inside `NotificationDrawer`.
260
+ * Exported separately so SSR and static previews can render the drawer surface directly.
261
+ */
262
+ declare function NotificationDrawerPanel({ title, titleNode, descriptionNode, closeNode, variant, items, streamStatus, loading, error, onRetry, onMarkAllRead, markAllReadLabel, onSelectItem, onAttachmentClick, onReplySubmit, tabs, activeTab, defaultTab, onTabChange, getRowActions, renderItem, emptyTitle, emptyDescription, highlightedKey, footer, className, }: NotificationDrawerPanelProps): react.JSX.Element;
263
+ interface NotificationDrawerProps {
264
+ open: boolean;
265
+ onOpenChange: (open: boolean) => void;
266
+ title?: ReactNode;
267
+ description?: ReactNode;
268
+ variant?: 'transactions' | 'workspace';
269
+ items?: readonly NotificationItem[];
270
+ streamStatus?: RealtimeStreamStatus;
271
+ loading?: boolean;
272
+ error?: ReactNode;
273
+ onRetry?: () => void;
274
+ onMarkAllRead?: () => void;
275
+ markAllReadLabel?: string;
276
+ onSelectItem?: (item: NotificationItem) => void;
277
+ onAttachmentClick?: (item: NotificationItem) => void;
278
+ onReplySubmit?: (item: NotificationItem, message: string) => void;
279
+ tabs?: readonly WorkspaceNotificationTab[];
280
+ activeTab?: string;
281
+ defaultTab?: string;
282
+ onTabChange?: (tabId: string) => void;
283
+ getRowActions?: (item: NotificationItem) => readonly NotificationRowAction[];
284
+ renderItem?: (item: NotificationItem) => ReactNode;
285
+ emptyTitle?: ReactNode;
286
+ emptyDescription?: ReactNode;
287
+ highlightedKey?: string | null;
288
+ footer?: ReactNode;
289
+ closeLabel?: string;
290
+ className?: string;
291
+ }
292
+ /**
293
+ * Right-side responsive notification drawer built on `@facto-to/design-system`
294
+ * `Sheet` (`width: min(440px, 100vw)`). Automatically reads from
295
+ * `NotificationCenterProvider` when present, or works standalone via props.
296
+ */
297
+ declare function NotificationDrawer({ open, onOpenChange, title, description, variant, items, streamStatus, loading, error, onRetry, onMarkAllRead, markAllReadLabel, onSelectItem, onAttachmentClick, onReplySubmit, tabs, activeTab, defaultTab, onTabChange, getRowActions, renderItem, emptyTitle, emptyDescription, highlightedKey, footer, closeLabel, className, }: NotificationDrawerProps): react.JSX.Element;
298
+
299
+ interface NotificationToastContent {
300
+ title: ReactNode;
301
+ description?: ReactNode;
302
+ tone?: 'success' | 'error' | 'warning' | 'info';
303
+ duration?: number;
304
+ }
305
+ interface NotificationToastBridgeProps {
306
+ /** Optional standalone envelope to evaluate outside NotificationCenterProvider. */
307
+ envelope?: InAppMessageEnvelope | null;
308
+ /** Optional standalone item to evaluate outside NotificationCenterProvider. */
309
+ item?: NotificationItem | null;
310
+ /**
311
+ * Noise policy predicate. Defaults to emitting toasts only for
312
+ * `mandatory_security` mode or `critical` severity.
313
+ */
314
+ shouldToast?: (event: NotificationLiveEvent) => boolean;
315
+ /** Formats the toast content emitted via `@facto-to/design-system` `useToast()`. */
316
+ formatToast?: (event: NotificationLiveEvent) => NotificationToastContent;
317
+ /** Bounded deduplication set capacity. Defaults to `500`. */
318
+ dedupeCapacity?: number;
319
+ /** Disables toast dispatch completely when `true`. */
320
+ disabled?: boolean;
321
+ /** Optional action button label inside the toast. */
322
+ actionLabel?: string;
323
+ /** Optional action callback invoked when the toast action button is clicked. */
324
+ onAction?: (event: NotificationLiveEvent) => void;
325
+ }
326
+ declare function defaultShouldToast({ envelope, item, }: NotificationLiveEvent): boolean;
327
+ /**
328
+ * Headless bridge that forwards qualifying realtime notifications into
329
+ * `@facto-to/design-system`'s `useToast()` queue with bounded `LruDedupeSet`
330
+ * deduplication and a restrained default noise policy.
331
+ */
332
+ declare function NotificationToastBridge({ envelope, item, shouldToast, formatToast, dedupeCapacity, disabled, actionLabel, onAction, }: NotificationToastBridgeProps): null;
333
+
334
+ export { ActionQueueCard, IncidentBanner, NotificationBell, NotificationDrawer, NotificationDrawerPanel, NotificationRow, NotificationToastBridge, TransactionNotificationCard, TransactionNotificationGroup, WorkspaceNotificationFeed, defaultShouldToast };
335
+ export type { ActionQueueCardProps, IncidentBannerProps, NotificationBellProps, NotificationDrawerPanelProps, NotificationDrawerProps, NotificationRowAction, NotificationRowProps, NotificationToastBridgeProps, NotificationToastContent, TransactionNotificationCardProps, TransactionNotificationGroupProps, WorkspaceNotificationFeedProps, WorkspaceNotificationTab };