@burdenoff/microfe-notification 2026.1127.1 → 2026.1129.1

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 (53) hide show
  1. package/dist/NotificationRoutes.d.ts +10 -0
  2. package/dist/NotificationRoutes.js +76 -71
  3. package/dist/NotificationRoutes.js.map +1 -1
  4. package/dist/generated/global-operations.d.ts +58 -3
  5. package/dist/generated/global-operations.js +31 -23
  6. package/dist/generated/global-operations.js.map +1 -1
  7. package/dist/generated/global-types.d.ts +10933 -581
  8. package/dist/hooks/useNotificationAnalytics.d.ts +1 -1
  9. package/dist/hooks/useNotificationAnalytics.js.map +1 -1
  10. package/dist/hooks/useNotifications.d.ts +7 -0
  11. package/dist/hooks/useNotifications.js +1 -1
  12. package/dist/hooks/useNotifications.js.map +1 -1
  13. package/dist/translations/en.d.ts +80 -0
  14. package/dist/types/index.d.ts +2 -1
  15. package/dist/v2/ArchivedRedirect.d.ts +1 -0
  16. package/dist/v2/ArchivedRedirect.js +14 -0
  17. package/dist/v2/ArchivedRedirect.js.map +1 -0
  18. package/dist/v2/InboxPage.d.ts +1 -0
  19. package/dist/v2/InboxPage.js +191 -0
  20. package/dist/v2/InboxPage.js.map +1 -0
  21. package/dist/v2/InboxRows.d.ts +10 -0
  22. package/dist/v2/InboxRows.js +101 -0
  23. package/dist/v2/InboxRows.js.map +1 -0
  24. package/dist/v2/KindIcon.d.ts +4 -0
  25. package/dist/v2/KindIcon.js +33 -0
  26. package/dist/v2/KindIcon.js.map +1 -0
  27. package/dist/v2/NotificationDetailPanel.d.ts +7 -0
  28. package/dist/v2/NotificationDetailPanel.js +200 -0
  29. package/dist/v2/NotificationDetailPanel.js.map +1 -0
  30. package/dist/v2/PreferencesPage.d.ts +1 -0
  31. package/dist/v2/PreferencesPage.js +139 -0
  32. package/dist/v2/PreferencesPage.js.map +1 -0
  33. package/dist/v2/__tests__/routeShapes.d.ts +13 -0
  34. package/dist/v2/model/days.d.ts +9 -0
  35. package/dist/v2/model/days.js +25 -0
  36. package/dist/v2/model/days.js.map +1 -0
  37. package/dist/v2/model/events.d.ts +17 -0
  38. package/dist/v2/model/events.js +72 -0
  39. package/dist/v2/model/events.js.map +1 -0
  40. package/dist/v2/model/icons.d.ts +6 -0
  41. package/dist/v2/model/icons.js +19 -0
  42. package/dist/v2/model/icons.js.map +1 -0
  43. package/dist/v2/model/inbox.d.ts +15 -0
  44. package/dist/v2/model/inbox.js +22 -0
  45. package/dist/v2/model/inbox.js.map +1 -0
  46. package/dist/v2/model/thing.d.ts +16 -0
  47. package/dist/v2/model/thing.js +41 -0
  48. package/dist/v2/model/thing.js.map +1 -0
  49. package/dist/v2/model/tr.d.ts +2 -0
  50. package/dist/v2/useNotificationDetail.d.ts +19 -0
  51. package/dist/v2/useNotificationDetail.js +65 -0
  52. package/dist/v2/useNotificationDetail.js.map +1 -0
  53. package/package.json +2 -2
@@ -4,7 +4,7 @@ interface NotificationAnalyticsPayload {
4
4
  source?: 'center' | 'panel' | 'history' | 'preferences' | 'admin_history' | 'composer' | 'template_editor';
5
5
  action?: 'open' | 'set' | 'reset' | 'send' | 'create' | 'update' | 'cancel' | 'reschedule';
6
6
  interaction?: 'card' | 'primary_action' | 'custom_action';
7
- scope?: 'GLOBAL' | 'CHANNEL' | 'TYPE' | 'TOPIC';
7
+ scope?: 'GLOBAL' | 'CHANNEL' | 'TYPE' | 'TOPIC' | 'CATEGORY';
8
8
  channel?: string;
9
9
  type?: string;
10
10
  priority?: string;
@@ -1 +1 @@
1
- {"version":3,"file":"useNotificationAnalytics.js","names":["toNotificationOpenPayload","notification","useNotificationAnalytics","eventBus","useEventBus","emit","useCallback","name","payload","source","interaction","input"],"sources":["../../src/hooks/useNotificationAnalytics.ts"],"sourcesContent":["import { useCallback } from 'react';\nimport { useEventBus } from '@burdenoff/fe-libs/shared/events';\nimport type { Notification, NotificationPreferenceScope } from '../types';\nimport type {\n NotificationChannelType,\n NotificationPriorityEnum,\n NotificationTypeEnum,\n} from './useSendNotification';\n\ntype NotificationAnalyticsName =\n | 'notification.item.opened'\n | 'notification.preference.updated'\n | 'notification.admin.sent'\n | 'notification.template.saved'\n | 'notification.schedule.updated';\n\ninterface NotificationAnalyticsPayload {\n source?:\n | 'center'\n | 'panel'\n | 'history'\n | 'preferences'\n | 'admin_history'\n | 'composer'\n | 'template_editor';\n action?: 'open' | 'set' | 'reset' | 'send' | 'create' | 'update' | 'cancel' | 'reschedule';\n interaction?: 'card' | 'primary_action' | 'custom_action';\n scope?: 'GLOBAL' | 'CHANNEL' | 'TYPE' | 'TOPIC';\n channel?: string;\n type?: string;\n priority?: string;\n mode?: 'compose' | 'template';\n recipientSource?: 'manual' | 'directory';\n recipientCount?: number;\n successCount?: number;\n failedCount?: number;\n scheduled?: boolean;\n includeInApp?: boolean;\n enabled?: boolean;\n hasActions?: boolean;\n hasMedia?: boolean;\n hasHtml?: boolean;\n variableCount?: number;\n}\n\ninterface NotificationAnalyticsEventBus {\n emit: (\n name: NotificationAnalyticsName,\n payload: NotificationAnalyticsPayload,\n options?: { component?: string }\n ) => void;\n}\n\ntype NotificationAnalyticsSource = NonNullable<NotificationAnalyticsPayload['source']>;\ntype NotificationAnalyticsAction = NonNullable<NotificationAnalyticsPayload['action']>;\ntype NotificationInteraction = NonNullable<NotificationAnalyticsPayload['interaction']>;\n\ninterface NotificationSentInput {\n mode: 'compose' | 'template';\n channel: NotificationChannelType;\n type?: NotificationTypeEnum | string;\n priority?: NotificationPriorityEnum | string;\n recipientSource: 'manual' | 'directory';\n recipientCount: number;\n successCount?: number;\n failedCount?: number;\n scheduled: boolean;\n includeInApp: boolean;\n hasActions: boolean;\n hasMedia: boolean;\n}\n\ninterface TemplateSavedInput {\n action: Extract<NotificationAnalyticsAction, 'create' | 'update'>;\n channel?: string;\n type?: string;\n variableCount: number;\n hasHtml?: boolean;\n}\n\ninterface PreferenceUpdatedInput {\n action: Extract<NotificationAnalyticsAction, 'set' | 'reset'>;\n scope: NotificationPreferenceScope;\n channel?: string;\n type?: string;\n enabled?: boolean;\n}\n\ninterface ScheduleUpdatedInput {\n action: Extract<NotificationAnalyticsAction, 'cancel' | 'reschedule'>;\n}\n\nfunction toNotificationOpenPayload(\n notification: Notification,\n source: NotificationAnalyticsSource,\n interaction: NotificationInteraction\n): NotificationAnalyticsPayload {\n return {\n source,\n action: 'open',\n interaction,\n channel: notification.channel,\n type: notification.type,\n priority: notification.priority,\n hasActions: Boolean(notification.actionUrl || notification.actions.length > 0),\n hasMedia: notification.media.length > 0,\n };\n}\n\nexport function useNotificationAnalytics() {\n const eventBus = useEventBus();\n\n const emit = useCallback(\n (name: NotificationAnalyticsName, payload: NotificationAnalyticsPayload) => {\n // The runtime event bus accepts string names; this local typed facade keeps\n // notification emissions constrained to the sparse Rybbit allowlist while\n // consuming app shells roll forward to the updated fe-libs event registry.\n const notificationEventBus = eventBus as unknown as NotificationAnalyticsEventBus;\n notificationEventBus.emit(name, payload, { component: 'microfe-notification' });\n },\n [eventBus]\n );\n\n const trackNotificationOpened = useCallback(\n (\n notification: Notification,\n source: NotificationAnalyticsSource,\n interaction: NotificationInteraction\n ) =>\n emit(\n 'notification.item.opened',\n toNotificationOpenPayload(notification, source, interaction)\n ),\n [emit]\n );\n\n const trackPreferenceUpdated = useCallback(\n (input: PreferenceUpdatedInput) =>\n emit('notification.preference.updated', {\n source: 'preferences',\n action: input.action,\n scope: input.scope,\n channel: input.channel,\n type: input.type,\n enabled: input.enabled,\n }),\n [emit]\n );\n\n const trackNotificationSent = useCallback(\n (input: NotificationSentInput) =>\n emit('notification.admin.sent', {\n source: 'composer',\n action: 'send',\n mode: input.mode,\n channel: input.channel,\n type: input.type,\n priority: input.priority,\n recipientSource: input.recipientSource,\n recipientCount: input.recipientCount,\n successCount: input.successCount,\n failedCount: input.failedCount,\n scheduled: input.scheduled,\n includeInApp: input.includeInApp,\n hasActions: input.hasActions,\n hasMedia: input.hasMedia,\n }),\n [emit]\n );\n\n const trackTemplateSaved = useCallback(\n (input: TemplateSavedInput) =>\n emit('notification.template.saved', {\n source: 'template_editor',\n action: input.action,\n channel: input.channel,\n type: input.type,\n variableCount: input.variableCount,\n hasHtml: input.hasHtml,\n }),\n [emit]\n );\n\n const trackScheduleUpdated = useCallback(\n (input: ScheduleUpdatedInput) =>\n emit('notification.schedule.updated', {\n source: 'admin_history',\n action: input.action,\n scheduled: input.action === 'reschedule',\n }),\n [emit]\n );\n\n return {\n trackNotificationOpened,\n trackPreferenceUpdated,\n trackNotificationSent,\n trackTemplateSaved,\n trackScheduleUpdated,\n };\n}\n"],"mappings":";;;AA4FA,SAASA,EACP,GACA,GACA,GAC8B;CAC9B,OAAO;EACL;EACA,QAAQ;EACR;EACA,SAASC,EAAa;EACtB,MAAMA,EAAa;EACnB,UAAUA,EAAa;EACvB,YAAY,GAAQA,EAAa,aAAaA,EAAa,QAAQ,SAAS;EAC5E,UAAUA,EAAa,MAAM,SAAS;CACxC;AACF;AAEA,SAAgBC,IAA2B;CACzC,IAAMC,IAAWC,EAAY,GAEvBC,IAAOC,GACV,GAAiC,MAA0C;EAK1E,EAAqB,KAAKC,GAAMC,GAAS,EAAE,WAAW,uBAAuB,CAAC;CAChF,GACA,CAACL,CAAQ,CACX;CAwEA,OAAO;EACL,yBAvE8BG,GAE5B,GACA,GACA,MAEAD,EACE,4BACAL,EAA0BC,GAAcQ,GAAQC,CAAW,CAC7D,GACF,CAACL,CAAI,CA6DL;EACA,wBA3D6BC,GAC5B,MACCD,EAAK,mCAAmC;GACtC,QAAQ;GACR,QAAQM,EAAM;GACd,OAAOA,EAAM;GACb,SAASA,EAAM;GACf,MAAMA,EAAM;GACZ,SAASA,EAAM;EACjB,CAAC,GACH,CAACN,CAAI,CAiDL;EACA,uBA/C4BC,GAC3B,MACCD,EAAK,2BAA2B;GAC9B,QAAQ;GACR,QAAQ;GACR,MAAMM,EAAM;GACZ,SAASA,EAAM;GACf,MAAMA,EAAM;GACZ,UAAUA,EAAM;GAChB,iBAAiBA,EAAM;GACvB,gBAAgBA,EAAM;GACtB,cAAcA,EAAM;GACpB,aAAaA,EAAM;GACnB,WAAWA,EAAM;GACjB,cAAcA,EAAM;GACpB,YAAYA,EAAM;GAClB,UAAUA,EAAM;EAClB,CAAC,GACH,CAACN,CAAI,CA6BL;EACA,oBA3ByBC,GACxB,MACCD,EAAK,+BAA+B;GAClC,QAAQ;GACR,QAAQM,EAAM;GACd,SAASA,EAAM;GACf,MAAMA,EAAM;GACZ,eAAeA,EAAM;GACrB,SAASA,EAAM;EACjB,CAAC,GACH,CAACN,CAAI,CAiBL;EACA,sBAf2BC,GAC1B,MACCD,EAAK,iCAAiC;GACpC,QAAQ;GACR,QAAQM,EAAM;GACd,WAAWA,EAAM,WAAW;EAC9B,CAAC,GACH,CAACN,CAAI,CAQL;CACF;AACF"}
1
+ {"version":3,"file":"useNotificationAnalytics.js","names":["toNotificationOpenPayload","notification","useNotificationAnalytics","eventBus","useEventBus","emit","useCallback","name","payload","source","interaction","input"],"sources":["../../src/hooks/useNotificationAnalytics.ts"],"sourcesContent":["import { useCallback } from 'react';\nimport { useEventBus } from '@burdenoff/fe-libs/shared/events';\nimport type { Notification, NotificationPreferenceScope } from '../types';\nimport type {\n NotificationChannelType,\n NotificationPriorityEnum,\n NotificationTypeEnum,\n} from './useSendNotification';\n\ntype NotificationAnalyticsName =\n | 'notification.item.opened'\n | 'notification.preference.updated'\n | 'notification.admin.sent'\n | 'notification.template.saved'\n | 'notification.schedule.updated';\n\ninterface NotificationAnalyticsPayload {\n source?:\n | 'center'\n | 'panel'\n | 'history'\n | 'preferences'\n | 'admin_history'\n | 'composer'\n | 'template_editor';\n action?: 'open' | 'set' | 'reset' | 'send' | 'create' | 'update' | 'cancel' | 'reschedule';\n interaction?: 'card' | 'primary_action' | 'custom_action';\n scope?: 'GLOBAL' | 'CHANNEL' | 'TYPE' | 'TOPIC' | 'CATEGORY';\n channel?: string;\n type?: string;\n priority?: string;\n mode?: 'compose' | 'template';\n recipientSource?: 'manual' | 'directory';\n recipientCount?: number;\n successCount?: number;\n failedCount?: number;\n scheduled?: boolean;\n includeInApp?: boolean;\n enabled?: boolean;\n hasActions?: boolean;\n hasMedia?: boolean;\n hasHtml?: boolean;\n variableCount?: number;\n}\n\ninterface NotificationAnalyticsEventBus {\n emit: (\n name: NotificationAnalyticsName,\n payload: NotificationAnalyticsPayload,\n options?: { component?: string }\n ) => void;\n}\n\ntype NotificationAnalyticsSource = NonNullable<NotificationAnalyticsPayload['source']>;\ntype NotificationAnalyticsAction = NonNullable<NotificationAnalyticsPayload['action']>;\ntype NotificationInteraction = NonNullable<NotificationAnalyticsPayload['interaction']>;\n\ninterface NotificationSentInput {\n mode: 'compose' | 'template';\n channel: NotificationChannelType;\n type?: NotificationTypeEnum | string;\n priority?: NotificationPriorityEnum | string;\n recipientSource: 'manual' | 'directory';\n recipientCount: number;\n successCount?: number;\n failedCount?: number;\n scheduled: boolean;\n includeInApp: boolean;\n hasActions: boolean;\n hasMedia: boolean;\n}\n\ninterface TemplateSavedInput {\n action: Extract<NotificationAnalyticsAction, 'create' | 'update'>;\n channel?: string;\n type?: string;\n variableCount: number;\n hasHtml?: boolean;\n}\n\ninterface PreferenceUpdatedInput {\n action: Extract<NotificationAnalyticsAction, 'set' | 'reset'>;\n scope: NotificationPreferenceScope;\n channel?: string;\n type?: string;\n enabled?: boolean;\n}\n\ninterface ScheduleUpdatedInput {\n action: Extract<NotificationAnalyticsAction, 'cancel' | 'reschedule'>;\n}\n\nfunction toNotificationOpenPayload(\n notification: Notification,\n source: NotificationAnalyticsSource,\n interaction: NotificationInteraction\n): NotificationAnalyticsPayload {\n return {\n source,\n action: 'open',\n interaction,\n channel: notification.channel,\n type: notification.type,\n priority: notification.priority,\n hasActions: Boolean(notification.actionUrl || notification.actions.length > 0),\n hasMedia: notification.media.length > 0,\n };\n}\n\nexport function useNotificationAnalytics() {\n const eventBus = useEventBus();\n\n const emit = useCallback(\n (name: NotificationAnalyticsName, payload: NotificationAnalyticsPayload) => {\n // The runtime event bus accepts string names; this local typed facade keeps\n // notification emissions constrained to the sparse Rybbit allowlist while\n // consuming app shells roll forward to the updated fe-libs event registry.\n const notificationEventBus = eventBus as unknown as NotificationAnalyticsEventBus;\n notificationEventBus.emit(name, payload, { component: 'microfe-notification' });\n },\n [eventBus]\n );\n\n const trackNotificationOpened = useCallback(\n (\n notification: Notification,\n source: NotificationAnalyticsSource,\n interaction: NotificationInteraction\n ) =>\n emit(\n 'notification.item.opened',\n toNotificationOpenPayload(notification, source, interaction)\n ),\n [emit]\n );\n\n const trackPreferenceUpdated = useCallback(\n (input: PreferenceUpdatedInput) =>\n emit('notification.preference.updated', {\n source: 'preferences',\n action: input.action,\n scope: input.scope,\n channel: input.channel,\n type: input.type,\n enabled: input.enabled,\n }),\n [emit]\n );\n\n const trackNotificationSent = useCallback(\n (input: NotificationSentInput) =>\n emit('notification.admin.sent', {\n source: 'composer',\n action: 'send',\n mode: input.mode,\n channel: input.channel,\n type: input.type,\n priority: input.priority,\n recipientSource: input.recipientSource,\n recipientCount: input.recipientCount,\n successCount: input.successCount,\n failedCount: input.failedCount,\n scheduled: input.scheduled,\n includeInApp: input.includeInApp,\n hasActions: input.hasActions,\n hasMedia: input.hasMedia,\n }),\n [emit]\n );\n\n const trackTemplateSaved = useCallback(\n (input: TemplateSavedInput) =>\n emit('notification.template.saved', {\n source: 'template_editor',\n action: input.action,\n channel: input.channel,\n type: input.type,\n variableCount: input.variableCount,\n hasHtml: input.hasHtml,\n }),\n [emit]\n );\n\n const trackScheduleUpdated = useCallback(\n (input: ScheduleUpdatedInput) =>\n emit('notification.schedule.updated', {\n source: 'admin_history',\n action: input.action,\n scheduled: input.action === 'reschedule',\n }),\n [emit]\n );\n\n return {\n trackNotificationOpened,\n trackPreferenceUpdated,\n trackNotificationSent,\n trackTemplateSaved,\n trackScheduleUpdated,\n };\n}\n"],"mappings":";;;AA4FA,SAASA,EACP,GACA,GACA,GAC8B;CAC9B,OAAO;EACL;EACA,QAAQ;E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,WAAWA,EAAM,WAAW;EAC9B,CAAC,GACH,CAACN,CAAI,CAQL;CACF;AACF"}
@@ -1,8 +1,15 @@
1
1
  import { Notification, NotificationFilter } from '../types';
2
+ import { NotificationFieldsFragment } from '../generated/global-operations';
3
+ /**
4
+ * Backend Notification item type derived from the generated query
5
+ */
6
+ type BackendNotification = NotificationFieldsFragment;
2
7
  interface UseNotificationsOptions {
3
8
  baseFilter?: Partial<NotificationFilter>;
4
9
  unreadFilter?: Record<string, unknown>;
5
10
  }
11
+ /** The GraphQL notification as the module's `Notification` (also used by the v2 detail panel). */
12
+ export declare function mapBackendToMfeNotification(n: BackendNotification): Notification;
6
13
  /**
7
14
  * Hook to manage notifications with real GraphQL backend integration.
8
15
  *
@@ -401,6 +401,6 @@ function C(v = {}) {
401
401
  loadMore: le
402
402
  };
403
403
  }
404
- export { C as useNotifications };
404
+ export { _ as mapBackendToMfeNotification, C as useNotifications };
405
405
 
406
406
  //# sourceMappingURL=useNotifications.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"useNotifications.js","names":["NotificationOps.GetNotificationsDocument","NotificationOps.GetMyUnreadNotificationCountDocument","NotificationOps.MarkNotificationAsReadDocument","NotificationOps.MarkAllMyNotificationsAsReadDocument","NotificationOps.ArchiveNotificationDocument","NotificationOps.ArchiveNotificationsDocument","NotificationOps.UnarchiveNotificationDocument","NotificationOps.RecordNotificationActionDocument","NotificationOps.NotificationReceivedDocument","NotificationOps.UnreadCountUpdatedDocument","mapBackendToMfeNotification","n","mapNotificationType","mapPriority","action","item","mapStatus","t","p","s","buildBackendFilter","backend","filter","mergeNotificationFilter","baseFilter","useNotifications","useNotification","setStoreUnreadCount","useNotificationStore","notifications","setNotifications","useState","selectedNotification","setSelectedNotification","isLoading","setIsLoading","error","setError","hasMore","setHasMore","total","setTotal","isLoadingMore","setIsLoadingMore","loadingMoreRef","useRef","listGenerationRef","pagedIdsRef","refreshSeqRef","replacingListRef","notificationsRef","effectiveFilter","useMemo","notificationFilter","options","debouncedFilter","setDebouncedFilter","timeout","getClient","useCallback","getGlobalNotificationClient","apiGatewayUrl","authToken","fetchNotifications","generation","setIsLoadingNotifications","result","USER_NOTIFICATION_CONTEXT","GetNotificationsDocument","mapped","notification","err","message","fetchUnreadCount","GetMyUnreadNotificationCountDocument","loadMore","pageWindow","nextNotificationWindow","more","appendNotificationPage","prev","refreshFirstPage","refresh","freshTotal","firstPageHasMore","firstPage","items","merged","mergeRefreshedFirstPage","handleMarkAsRead","MarkNotificationAsReadDocument","notificationId","unreadCount","handleMarkAllAsRead","MarkAllMyNotificationsAsReadDocument","handleArchive","ArchiveNotificationDocument","handleBulkArchive","ArchiveNotificationsDocument","idsSet","notificationIds","handleUnarchive","UnarchiveNotificationDocument","handleRecordAction","RecordNotificationActionDocument","useEffect","currentUser","client","notificationSubscription","NotificationReceivedDocument","eventBus","unreadSubscription","UnreadCountUpdatedDocument","nextCount","handleVisibilityChange","updateNotificationFilter","resetNotificationFilter"],"sources":["../../src/hooks/useNotifications.ts"],"sourcesContent":["import { useState, useCallback, useEffect, useMemo, useRef } from 'react';\nimport { useNotification } from '../providers/NotificationProvider';\nimport { getGlobalNotificationClient, USER_NOTIFICATION_CONTEXT } from '../graphql/global-client';\nimport { useNotificationStore } from '../store/notificationStore';\nimport type { Notification, NotificationFilter } from '../types';\nimport {\n NOTIFICATION_PAGE_SIZE,\n appendNotificationPage,\n mergeRefreshedFirstPage,\n nextNotificationWindow,\n} from './notificationPaging';\nimport * as NotificationOps from '../generated/global-operations';\nimport type {\n GetNotificationsQuery,\n GetMyUnreadNotificationCountQuery,\n NotificationFieldsFragment,\n NotificationReceivedSubscription,\n UnreadCountUpdatedSubscription,\n} from '../generated/global-operations';\n\n// ---------------------------------------------------------------------------\n// GraphQL Operations — using generated Document nodes from global-operations\n// ---------------------------------------------------------------------------\n\n/**\n * Backend Notification item type derived from the generated query\n */\ntype BackendNotification = NotificationFieldsFragment;\n\ninterface UseNotificationsOptions {\n baseFilter?: Partial<NotificationFilter>;\n unreadFilter?: Record<string, unknown>;\n}\n\n// ---------------------------------------------------------------------------\n// Mapping helpers — backend → MFE types\n// ---------------------------------------------------------------------------\n\nfunction mapBackendToMfeNotification(n: BackendNotification): Notification {\n return {\n id: n.id,\n type: mapNotificationType(n.type),\n priority: mapPriority(n.priority),\n title: n.title,\n body: n.message,\n actionUrl: n.redirectUrl ?? undefined,\n actions: (n.actions || []).map((action) => ({\n id: action.id,\n label: action.label,\n url: action.url,\n style: action.style ?? undefined,\n actionType: action.actionType ?? undefined,\n metadata: action.metadata ?? undefined,\n })),\n appName: n.appName ?? undefined,\n archivedAt: n.archivedAt ?? undefined,\n channel: n.channel as Notification['channel'],\n clickedAt: n.clickedAt ?? undefined,\n deliveredAt: n.deliveredAt ?? undefined,\n deliveryStatus: n.deliveryStatus ?? undefined,\n htmlBody: n.htmlMessage ?? undefined,\n media: (n.media || []).map((item) => ({\n url: item.url,\n label: item.label ?? undefined,\n kind: item.kind ?? undefined,\n contentType: item.contentType ?? undefined,\n thumbnailUrl: item.thumbnailUrl ?? undefined,\n })),\n openedAt: n.openedAt ?? undefined,\n recipientEmail: n.recipientEmail ?? undefined,\n recipientPhone: n.recipientPhone ?? undefined,\n scheduledFor: n.scheduledFor ?? undefined,\n scheduledNotification: n.scheduledNotification\n ? {\n id: n.scheduledNotification.id,\n scheduledFor: n.scheduledNotification.scheduledFor,\n status: n.scheduledNotification.status,\n timezone: n.scheduledNotification.timezone ?? undefined,\n }\n : undefined,\n sentAt: n.sentAt ?? undefined,\n status: mapStatus(n.status),\n readAt: n.readAt ?? undefined,\n createdAt: n.createdAt,\n channels: [\n {\n id: n.id,\n channel: n.channel as Notification['channel'],\n status: mapStatus(n.status),\n sentAt: n.sentAt ?? undefined,\n deliveredAt: n.deliveredAt ?? undefined,\n failedAt: n.failedAt ?? undefined,\n errorCode: n.errorCode ?? undefined,\n errorMessage: n.errorMessage ?? undefined,\n },\n ],\n metadata: n.metadata ?? undefined,\n topic: n.topic\n ? {\n id: n.topic.id,\n name: n.topic.name,\n slug: n.topic.slug,\n type: mapNotificationType(n.topic.type),\n }\n : undefined,\n topicId: n.topicId ?? undefined,\n };\n}\n\nfunction mapNotificationType(t: string) {\n const map: Record<string, Notification['type']> = {\n SYSTEM: 'SYSTEM',\n TRANSACTIONAL: 'TRANSACTIONAL',\n MARKETING: 'MARKETING',\n ALERT: 'ALERT',\n };\n return map[t] || 'SYSTEM';\n}\n\nfunction mapPriority(p: string) {\n const map: Record<string, Notification['priority']> = {\n LOW: 'LOW',\n MEDIUM: 'NORMAL',\n HIGH: 'HIGH',\n URGENT: 'URGENT',\n };\n return map[p] || 'NORMAL';\n}\n\nfunction mapStatus(s: string) {\n const map: Record<string, Notification['status']> = {\n DRAFT: 'PENDING',\n PENDING: 'PENDING',\n SCHEDULED: 'PENDING',\n TRIGGERED: 'SENT',\n SENT: 'SENT',\n DELIVERED: 'DELIVERED',\n READ: 'DELIVERED',\n FAILED: 'FAILED',\n CANCELLED: 'ARCHIVED',\n EXPIRED: 'ARCHIVED',\n };\n return map[s] || 'PENDING';\n}\n\n// ---------------------------------------------------------------------------\n// Build the backend filter from the MFE NotificationFilter shape\n// ---------------------------------------------------------------------------\n\nfunction buildBackendFilter(filter: NotificationFilter) {\n const backend: Record<string, unknown> = {};\n\n // Type filter — map MFE type names to backend enum\n if (filter.type !== 'ALL') {\n const typeMap: Record<string, string> = {\n SYSTEM: 'SYSTEM',\n ACTIVITY: 'TRANSACTIONAL',\n BILLING: 'TRANSACTIONAL',\n SECURITY: 'ALERT',\n SOCIAL: 'MARKETING',\n REMINDER: 'SYSTEM',\n };\n backend.type = typeMap[filter.type] || filter.type;\n }\n\n // Priority filter\n if (filter.priority !== 'ALL') {\n const prioMap: Record<string, string> = {\n LOW: 'LOW',\n NORMAL: 'MEDIUM',\n HIGH: 'HIGH',\n URGENT: 'URGENT',\n };\n backend.priority = prioMap[filter.priority] || filter.priority;\n }\n\n // Read/unread filter — coerce null to undefined\n if (filter.isRead !== null && filter.isRead !== undefined) {\n backend.isRead = filter.isRead;\n }\n\n if (filter.topicId) {\n backend.topicId = filter.topicId;\n }\n\n if (filter.channel && filter.channel !== 'ALL') {\n backend.channel = filter.channel;\n }\n\n if (filter.archived !== null && filter.archived !== undefined) {\n backend.archived = filter.archived;\n }\n\n if (filter.search) {\n backend.search = filter.search;\n }\n\n // Date range\n if (filter.dateRange.start) {\n backend.startDate = filter.dateRange.start.toISOString();\n }\n if (filter.dateRange.end) {\n backend.endDate = filter.dateRange.end.toISOString();\n }\n\n return Object.keys(backend).length > 0 ? backend : undefined;\n}\n\nfunction mergeNotificationFilter(\n filter: NotificationFilter,\n baseFilter?: Partial<NotificationFilter>\n): NotificationFilter {\n if (!baseFilter) return filter;\n\n return {\n ...filter,\n ...baseFilter,\n dateRange: {\n ...filter.dateRange,\n ...(baseFilter.dateRange || {}),\n },\n };\n}\n\n// ---------------------------------------------------------------------------\n// Hook\n// ---------------------------------------------------------------------------\n\n/**\n * Hook to manage notifications with real GraphQL backend integration.\n *\n * Uses the global Apollo client to query the notification service via the\n * public gateway (https://gw-global.local.burdenoff.com/global/graphql).\n *\n * @example\n * ```tsx\n * const { notifications, unreadCount, markAsRead } = useNotifications();\n * ```\n */\nexport function useNotifications(options: UseNotificationsOptions = {}) {\n const { authToken, apiGatewayUrl, currentUser, eventBus } = useNotification();\n const {\n notificationFilter,\n updateNotificationFilter,\n resetNotificationFilter,\n unreadCount,\n setUnreadCount: setStoreUnreadCount,\n setIsLoadingNotifications,\n } = useNotificationStore();\n\n const [notifications, setNotifications] = useState<Notification[]>([]);\n const [selectedNotification, setSelectedNotification] = useState<Notification | null>(null);\n const [isLoading, setIsLoading] = useState(false);\n const [error, setError] = useState<string | null>(null);\n const [hasMore, setHasMore] = useState(false);\n const [total, setTotal] = useState(0);\n const [isLoadingMore, setIsLoadingMore] = useState(false);\n // One \"load more\" at a time; the state drives the list's loading row.\n const loadingMoreRef = useRef(false);\n // Bumped whenever the list starts over (a new filter, a refetch), so a page\n // that was requested for the previous list is dropped instead of appended.\n const listGenerationRef = useRef(0);\n // Ids that came from the server's pages for the current list, as opposed to\n // the live feed; only these set where the next page starts.\n const pagedIdsRef = useRef<Set<string>>(new Set());\n // Each tab-refresh gets a number; only the latest one's answer is used.\n const refreshSeqRef = useRef(0);\n // A new first page (new filter, refetch) is on its way: the loaded list is\n // about to be replaced, so no page may be added after it meanwhile.\n const replacingListRef = useRef(false);\n // The loaded list as of the last render, for the tab-refresh merge below.\n const notificationsRef = useRef<Notification[]>([]);\n useEffect(() => {\n notificationsRef.current = notifications;\n }, [notifications]);\n const effectiveFilter = useMemo(\n () => mergeNotificationFilter(notificationFilter, options.baseFilter),\n [notificationFilter, options.baseFilter]\n );\n const [debouncedFilter, setDebouncedFilter] = useState(effectiveFilter);\n\n useEffect(() => {\n const timeout = window.setTimeout(() => setDebouncedFilter(effectiveFilter), 250);\n return () => window.clearTimeout(timeout);\n }, [effectiveFilter]);\n\n // Client accessor — coerce null/undefined authToken to undefined\n const getClient = useCallback(() => {\n return getGlobalNotificationClient(apiGatewayUrl ?? undefined, authToken ?? undefined);\n }, [apiGatewayUrl, authToken]);\n\n // ---- Fetch notifications ------------------------------------------------\n\n const fetchNotifications = useCallback(async () => {\n listGenerationRef.current += 1;\n const generation = listGenerationRef.current;\n replacingListRef.current = true;\n setIsLoading(true);\n setIsLoadingNotifications(true);\n setError(null);\n\n try {\n const client = getClient();\n const result = await client.query<GetNotificationsQuery>({\n context: USER_NOTIFICATION_CONTEXT,\n query: NotificationOps.GetNotificationsDocument,\n variables: {\n filter: buildBackendFilter(debouncedFilter),\n limit: NOTIFICATION_PAGE_SIZE,\n offset: 0,\n },\n fetchPolicy: 'network-only',\n });\n\n if (result.data?.notifications && generation === listGenerationRef.current) {\n const mapped = result.data.notifications.items.map(mapBackendToMfeNotification);\n pagedIdsRef.current = new Set(mapped.map((notification) => notification.id));\n setNotifications(mapped);\n setTotal(result.data.notifications.total);\n setHasMore(result.data.notifications.hasMore);\n }\n } catch (err: unknown) {\n const message = err instanceof Error ? err.message : 'Failed to fetch notifications';\n console.error('[useNotifications] Failed to fetch notifications:', err);\n setError(message);\n // The list on screen was loaded for an earlier filter: do not page it.\n if (generation === listGenerationRef.current) setHasMore(false);\n } finally {\n if (generation === listGenerationRef.current) replacingListRef.current = false;\n setIsLoading(false);\n setIsLoadingNotifications(false);\n }\n }, [debouncedFilter, getClient, setIsLoadingNotifications]);\n\n // ---- Fetch unread count -------------------------------------------------\n\n const fetchUnreadCount = useCallback(async () => {\n try {\n const client = getClient();\n const result = await client.query<GetMyUnreadNotificationCountQuery>({\n context: USER_NOTIFICATION_CONTEXT,\n query: NotificationOps.GetMyUnreadNotificationCountDocument,\n variables: { filter: options.unreadFilter || { channel: 'IN_APP' } },\n fetchPolicy: 'network-only',\n });\n if (result.data) {\n setStoreUnreadCount(result.data.myUnreadNotificationCount);\n }\n } catch (err: unknown) {\n console.error('[useNotifications] Failed to fetch unread count:', err);\n }\n }, [getClient, options.unreadFilter, setStoreUnreadCount]);\n\n // ---- Load more ----------------------------------------------------------\n\n const loadMore = useCallback(async () => {\n if (!hasMore || loadingMoreRef.current || replacingListRef.current) return;\n const pageWindow = nextNotificationWindow(notifications, pagedIdsRef.current, debouncedFilter);\n if (!pageWindow) return;\n loadingMoreRef.current = true;\n setIsLoadingMore(true);\n const generation = listGenerationRef.current;\n\n try {\n const client = getClient();\n const result = await client.query<GetNotificationsQuery>({\n context: USER_NOTIFICATION_CONTEXT,\n query: NotificationOps.GetNotificationsDocument,\n variables: {\n // Everything at or before the oldest loaded notification (the\n // filter's own end date is never earlier than that).\n filter: buildBackendFilter({\n ...debouncedFilter,\n dateRange: { ...debouncedFilter.dateRange, end: pageWindow.before },\n }),\n limit: pageWindow.limit,\n offset: pageWindow.offset,\n },\n fetchPolicy: 'network-only',\n });\n\n // The list started over (new filter or refetch) while this page loaded.\n if (generation !== listGenerationRef.current) return;\n if (result.data?.notifications) {\n const more = result.data.notifications.items.map(mapBackendToMfeNotification);\n for (const notification of more) pagedIdsRef.current.add(notification.id);\n setNotifications((prev) => appendNotificationPage(prev, more));\n // `total` here counts only the window, so the list's total stays as\n // the first page reported it.\n setHasMore(result.data.notifications.hasMore);\n }\n } catch (err: unknown) {\n const message = err instanceof Error ? err.message : 'Failed to load more notifications';\n console.error('[useNotifications] Failed to load more:', err);\n setError(message);\n } finally {\n loadingMoreRef.current = false;\n setIsLoadingMore(false);\n }\n }, [debouncedFilter, getClient, hasMore, notifications]);\n\n // Coming back to the tab: fetch the first page again for anything new, and\n // keep the older pages already scrolled through.\n const refreshFirstPage = useCallback(async () => {\n const generation = listGenerationRef.current;\n refreshSeqRef.current += 1;\n const refresh = refreshSeqRef.current;\n try {\n const client = getClient();\n const result = await client.query<GetNotificationsQuery>({\n context: USER_NOTIFICATION_CONTEXT,\n query: NotificationOps.GetNotificationsDocument,\n variables: {\n filter: buildBackendFilter(debouncedFilter),\n limit: NOTIFICATION_PAGE_SIZE,\n offset: 0,\n },\n fetchPolicy: 'network-only',\n });\n // The list started over, or a later refresh superseded this one.\n if (\n generation !== listGenerationRef.current ||\n refresh !== refreshSeqRef.current ||\n !result.data?.notifications\n ) {\n return;\n }\n const { items, total: freshTotal, hasMore: firstPageHasMore } = result.data.notifications;\n const firstPage = items.map(mapBackendToMfeNotification);\n const merged = mergeRefreshedFirstPage(\n notificationsRef.current,\n firstPage,\n firstPageHasMore,\n pagedIdsRef.current\n );\n if (merged.continued) {\n // The older pages carry on after the fresh one: keep them, and\n // whether more exist is still what the last of them said.\n for (const notification of firstPage) pagedIdsRef.current.add(notification.id);\n setNotifications(merged.list);\n } else {\n // The list starts over from the fresh first page; a page still\n // loading belongs to the old list and is dropped when it arrives.\n listGenerationRef.current += 1;\n pagedIdsRef.current = new Set(firstPage.map((notification) => notification.id));\n setNotifications(merged.list);\n setHasMore(firstPageHasMore);\n }\n setTotal(freshTotal);\n } catch (err: unknown) {\n console.error('[useNotifications] Failed to refresh notifications:', err);\n }\n }, [debouncedFilter, getClient]);\n\n // ---- Mutations ----------------------------------------------------------\n\n const handleMarkAsRead = useCallback(\n async (notificationId: string) => {\n try {\n const client = getClient();\n await client.mutate({\n context: USER_NOTIFICATION_CONTEXT,\n mutation: NotificationOps.MarkNotificationAsReadDocument,\n variables: { id: notificationId },\n });\n // Optimistic: update local state\n setNotifications((prev) =>\n prev.map((n) =>\n n.id === notificationId ? { ...n, readAt: new Date().toISOString() } : n\n )\n );\n setStoreUnreadCount(Math.max(0, unreadCount - 1));\n } catch (err: unknown) {\n console.error('[useNotifications] Failed to mark as read:', err);\n setError('Failed to mark notification as read');\n }\n },\n [getClient, setStoreUnreadCount, unreadCount]\n );\n\n const handleMarkAllAsRead = useCallback(async () => {\n try {\n const client = getClient();\n await client.mutate({\n context: USER_NOTIFICATION_CONTEXT,\n mutation: NotificationOps.MarkAllMyNotificationsAsReadDocument,\n });\n // Optimistic: update all local\n setNotifications((prev) =>\n prev.map((n) => ({ ...n, readAt: n.readAt || new Date().toISOString() }))\n );\n setStoreUnreadCount(0);\n } catch (err: unknown) {\n console.error('[useNotifications] Failed to mark all as read:', err);\n setError('Failed to mark all notifications as read');\n }\n }, [getClient, setStoreUnreadCount]);\n\n const handleArchive = useCallback(\n async (notificationId: string) => {\n try {\n const client = getClient();\n await client.mutate({\n context: USER_NOTIFICATION_CONTEXT,\n mutation: NotificationOps.ArchiveNotificationDocument,\n variables: { id: notificationId },\n });\n setNotifications((prev) =>\n prev.map((n) =>\n n.id === notificationId ? { ...n, archivedAt: new Date().toISOString() } : n\n )\n );\n } catch (err: unknown) {\n console.error('[useNotifications] Failed to archive notification:', err);\n setError('Failed to archive notification');\n }\n },\n [getClient]\n );\n\n const handleBulkArchive = useCallback(\n async (notificationIds: string[]) => {\n try {\n const client = getClient();\n await client.mutate({\n context: USER_NOTIFICATION_CONTEXT,\n mutation: NotificationOps.ArchiveNotificationsDocument,\n variables: { notificationIds },\n });\n const idsSet = new Set(notificationIds);\n setNotifications((prev) =>\n prev.map((n) => (idsSet.has(n.id) ? { ...n, archivedAt: new Date().toISOString() } : n))\n );\n } catch (err: unknown) {\n console.error('[useNotifications] Failed to bulk archive:', err);\n setError('Failed to archive notifications');\n }\n },\n [getClient]\n );\n\n const handleUnarchive = useCallback(\n async (notificationId: string) => {\n try {\n const client = getClient();\n await client.mutate({\n context: USER_NOTIFICATION_CONTEXT,\n mutation: NotificationOps.UnarchiveNotificationDocument,\n variables: { id: notificationId },\n });\n\n setNotifications((prev) =>\n prev.map((n) => (n.id === notificationId ? { ...n, archivedAt: undefined } : n))\n );\n } catch (err: unknown) {\n console.error('[useNotifications] Failed to unarchive notification:', err);\n setError('Failed to restore notification');\n }\n },\n [getClient]\n );\n\n const handleRecordAction = useCallback(\n async (notificationId: string, actionId?: string) => {\n try {\n const client = getClient();\n await client.mutate({\n context: USER_NOTIFICATION_CONTEXT,\n mutation: NotificationOps.RecordNotificationActionDocument,\n variables: { input: { notificationId, actionId } },\n });\n\n setNotifications((prev) =>\n prev.map((n) =>\n n.id === notificationId\n ? {\n ...n,\n clickedAt: new Date().toISOString(),\n readAt: n.readAt || new Date().toISOString(),\n }\n : n\n )\n );\n } catch (err: unknown) {\n console.error('[useNotifications] Failed to record notification action:', err);\n setError('Failed to record notification action');\n }\n },\n [getClient]\n );\n\n // ---- Initial fetch on mount + when filter changes -----------------------\n\n useEffect(() => {\n fetchNotifications();\n }, [fetchNotifications]);\n\n useEffect(() => {\n fetchUnreadCount();\n }, [fetchUnreadCount]);\n\n // ---- Live notification subscriptions ------------------------------------\n\n useEffect(() => {\n if (!currentUser?.id) return undefined;\n\n const client = getClient();\n const notificationSubscription = client\n .subscribe<NotificationReceivedSubscription>({\n query: NotificationOps.NotificationReceivedDocument,\n variables: { userId: currentUser.id },\n })\n .subscribe({\n next: (result) => {\n const notification = result.data?.notificationReceived;\n if (!notification) return;\n const mapped = mapBackendToMfeNotification(notification);\n setNotifications((prev) => [mapped, ...prev.filter((item) => item.id !== mapped.id)]);\n eventBus?.emit('notification:received', { notification: mapped });\n },\n error: (err) => {\n console.error('[useNotifications] Notification subscription failed:', err);\n },\n });\n\n const unreadSubscription = client\n .subscribe<UnreadCountUpdatedSubscription>({\n query: NotificationOps.UnreadCountUpdatedDocument,\n variables: { userId: currentUser.id },\n })\n .subscribe({\n next: (result) => {\n const nextCount = result.data?.unreadCountUpdated;\n if (typeof nextCount === 'number') {\n setStoreUnreadCount(nextCount);\n eventBus?.emit('notification:unread-count-updated', { unreadCount: nextCount });\n }\n },\n error: (err) => {\n console.error('[useNotifications] Unread count subscription failed:', err);\n },\n });\n\n return () => {\n notificationSubscription.unsubscribe();\n unreadSubscription.unsubscribe();\n };\n }, [currentUser?.id, eventBus, getClient, setStoreUnreadCount]);\n\n useEffect(() => {\n const handleVisibilityChange = () => {\n if (document.visibilityState === 'visible') {\n void refreshFirstPage();\n fetchUnreadCount();\n }\n };\n\n document.addEventListener('visibilitychange', handleVisibilityChange);\n return () => document.removeEventListener('visibilitychange', handleVisibilityChange);\n }, [refreshFirstPage, fetchUnreadCount]);\n\n const visibleNotifications = useMemo(\n () =>\n notifications.filter((notification) => {\n if (notification.deliveryStatus === 'UNSUBSCRIBED') {\n return false;\n }\n\n if (notification.status === 'ARCHIVED' && !notification.archivedAt) {\n return false;\n }\n\n if (effectiveFilter.archived === true) {\n return Boolean(notification.archivedAt);\n }\n\n if (effectiveFilter.archived === false) {\n return !notification.archivedAt;\n }\n\n return true;\n }),\n [effectiveFilter.archived, notifications]\n );\n\n return {\n notifications: visibleNotifications,\n allNotifications: notifications,\n unreadCount,\n selectedNotification,\n notificationFilter: effectiveFilter,\n isLoading,\n /** A further page is loading (infinite scroll). */\n isLoadingMore,\n error,\n hasMore,\n total,\n markAsRead: handleMarkAsRead,\n markAllAsRead: handleMarkAllAsRead,\n archiveNotification: handleArchive,\n bulkArchive: handleBulkArchive,\n unarchiveNotification: handleUnarchive,\n recordAction: handleRecordAction,\n setSelectedNotification,\n updateFilter: updateNotificationFilter,\n resetFilter: resetNot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B,AAAI,OAAO+C,KAAc,aACvBtF,EAAoBsF,CAAS,GAC7BH,GAAU,KAAK,qCAAqC,EAAE,aAAaG,EAAU,CAAC;GAElF;GACA,QAAQ,MAAQ;IACd,QAAQ,MAAM,wDAAwD1C,CAAG;GAC3E;EACF,CAAC;EAEH,aAAa;GAEX,AADAqC,EAAyB,YAAY,GACrCG,EAAmB,YAAY;EACjC;CACF,GAAG;EAACL,GAAa;EAAII;EAAUpD;EAAW/B;CAAmB,CAAC,GAE9D8E,QAAgB;EACd,IAAMS,UAA+B;GACnC,AAAI,SAAS,oBAAoB,cAC/BjC,EAAsB,GACtBR,EAAiB;EAErB;EAGA,OADA,SAAS,iBAAiB,oBAAoByC,CAAsB,SACvD,SAAS,oBAAoB,oBAAoBA,CAAsB;CACtF,GAAG,CAACjC,GAAkBR,CAAgB,CAAC,GA0BhC;EACL,eAzB2BrB,QAEzBvB,EAAc,QAAQ,MAChByC,EAAa,mBAAmB,kBAIhCA,EAAa,WAAW,cAAc,CAACA,EAAa,aAC/C,KAGLnB,EAAgB,aAAa,KACxB,EAAQmB,EAAa,aAG1BnB,EAAgB,aAAa,MACxB,CAACmB,EAAa,UAIxB,GACH,CAACnB,EAAgB,UAAUtB,CAAa,CAIzB;EACf,kBAAkBA;EAClB;EACA;EACA,oBAAoBsB;EACpB;EAEA;EACA;EACA;EACA;EACA,YAAYsC;EACZ,eAAeI;EACf,qBAAqBE;EACrB,aAAaE;EACb,uBAAuBI;EACvB,cAAcE;EACd;EACA,cAAcY;EACd,aAAaC;EACb,SAASrD;EACT;CACF;AACF"}
1
+ {"version":3,"file":"useNotifications.js","names":["NotificationOps.GetNotificationsDocument","NotificationOps.GetMyUnreadNotificationCountDocument","NotificationOps.MarkNotificationAsReadDocument","NotificationOps.MarkAllMyNotificationsAsReadDocument","NotificationOps.ArchiveNotificationDocument","NotificationOps.ArchiveNotificationsDocument","NotificationOps.UnarchiveNotificationDocument","NotificationOps.RecordNotificationActionDocument","NotificationOps.NotificationReceivedDocument","NotificationOps.UnreadCountUpdatedDocument","mapBackendToMfeNotification","n","mapNotificationType","mapPriority","action","item","mapStatus","t","p","s","buildBackendFilter","backend","filter","mergeNotificationFilter","baseFilter","useNotifications","useNotification","setStoreUnreadCount","useNotificationStore","notifications","setNotifications","useState","selectedNotification","setSelectedNotification","isLoading","setIsLoading","error","setError","hasMore","setHasMore","total","setTotal","isLoadingMore","setIsLoadingMore","loadingMoreRef","useRef","listGenerationRef","pagedIdsRef","refreshSeqRef","replacingListRef","notificationsRef","effectiveFilter","useMemo","notificationFilter","options","debouncedFilter","setDebouncedFilter","timeout","getClient","useCallback","getGlobalNotificationClient","apiGatewayUrl","authToken","fetchNotifications","generation","setIsLoadingNotifications","result","USER_NOTIFICATION_CONTEXT","GetNotificationsDocument","mapped","notification","err","message","fetchUnreadCount","GetMyUnreadNotificationCountDocument","loadMore","pageWindow","nextNotificationWindow","more","appendNotificationPage","prev","refreshFirstPage","refresh","freshTotal","firstPageHasMore","firstPage","items","merged","mergeRefreshedFirstPage","handleMarkAsRead","MarkNotificationAsReadDocument","notificationId","unreadCount","handleMarkAllAsRead","MarkAllMyNotificationsAsReadDocument","handleArchive","ArchiveNotificationDocument","handleBulkArchive","ArchiveNotificationsDocument","idsSet","notificationIds","handleUnarchive","UnarchiveNotificationDocument","handleRecordAction","RecordNotificationActionDocument","useEffect","currentUser","client","notificationSubscription","NotificationReceivedDocument","eventBus","unreadSubscription","UnreadCountUpdatedDocument","nextCount","handleVisibilityChange","updateNotificationFilter","resetNotificationFilter"],"sources":["../../src/hooks/useNotifications.ts"],"sourcesContent":["import { useState, useCallback, useEffect, useMemo, useRef } from 'react';\nimport { useNotification } from '../providers/NotificationProvider';\nimport { getGlobalNotificationClient, USER_NOTIFICATION_CONTEXT } from '../graphql/global-client';\nimport { useNotificationStore } from '../store/notificationStore';\nimport type { Notification, NotificationFilter } from '../types';\nimport {\n NOTIFICATION_PAGE_SIZE,\n appendNotificationPage,\n mergeRefreshedFirstPage,\n nextNotificationWindow,\n} from './notificationPaging';\nimport * as NotificationOps from '../generated/global-operations';\nimport type {\n GetNotificationsQuery,\n GetMyUnreadNotificationCountQuery,\n NotificationFieldsFragment,\n NotificationReceivedSubscription,\n UnreadCountUpdatedSubscription,\n} from '../generated/global-operations';\n\n// ---------------------------------------------------------------------------\n// GraphQL Operations — using generated Document nodes from global-operations\n// ---------------------------------------------------------------------------\n\n/**\n * Backend Notification item type derived from the generated query\n */\ntype BackendNotification = NotificationFieldsFragment;\n\ninterface UseNotificationsOptions {\n baseFilter?: Partial<NotificationFilter>;\n unreadFilter?: Record<string, unknown>;\n}\n\n// ---------------------------------------------------------------------------\n// Mapping helpers — backend → MFE types\n// ---------------------------------------------------------------------------\n\n/** The GraphQL notification as the module's `Notification` (also used by the v2 detail panel). */\nexport function mapBackendToMfeNotification(n: BackendNotification): Notification {\n return {\n id: n.id,\n type: mapNotificationType(n.type),\n priority: mapPriority(n.priority),\n title: n.title,\n body: n.message,\n actionUrl: n.redirectUrl ?? undefined,\n actions: (n.actions || []).map((action) => ({\n id: action.id,\n label: action.label,\n url: action.url,\n style: action.style ?? undefined,\n actionType: action.actionType ?? undefined,\n metadata: action.metadata ?? undefined,\n })),\n appName: n.appName ?? undefined,\n archivedAt: n.archivedAt ?? undefined,\n channel: n.channel as Notification['channel'],\n clickedAt: n.clickedAt ?? undefined,\n deliveredAt: n.deliveredAt ?? undefined,\n deliveryStatus: n.deliveryStatus ?? undefined,\n htmlBody: n.htmlMessage ?? undefined,\n media: (n.media || []).map((item) => ({\n url: item.url,\n label: item.label ?? undefined,\n kind: item.kind ?? undefined,\n contentType: item.contentType ?? undefined,\n thumbnailUrl: item.thumbnailUrl ?? undefined,\n })),\n openedAt: n.openedAt ?? undefined,\n recipientEmail: n.recipientEmail ?? undefined,\n recipientPhone: n.recipientPhone ?? undefined,\n scheduledFor: n.scheduledFor ?? undefined,\n scheduledNotification: n.scheduledNotification\n ? {\n id: n.scheduledNotification.id,\n scheduledFor: n.scheduledNotification.scheduledFor,\n status: n.scheduledNotification.status,\n timezone: n.scheduledNotification.timezone ?? undefined,\n }\n : undefined,\n sentAt: n.sentAt ?? undefined,\n status: mapStatus(n.status),\n readAt: n.readAt ?? undefined,\n createdAt: n.createdAt,\n channels: [\n {\n id: n.id,\n channel: n.channel as Notification['channel'],\n status: mapStatus(n.status),\n sentAt: n.sentAt ?? undefined,\n deliveredAt: n.deliveredAt ?? undefined,\n failedAt: n.failedAt ?? undefined,\n errorCode: n.errorCode ?? undefined,\n errorMessage: n.errorMessage ?? undefined,\n },\n ],\n metadata: n.metadata ?? undefined,\n topic: n.topic\n ? {\n id: n.topic.id,\n name: n.topic.name,\n slug: n.topic.slug,\n type: mapNotificationType(n.topic.type),\n }\n : undefined,\n topicId: n.topicId ?? undefined,\n };\n}\n\nfunction mapNotificationType(t: string) {\n const map: Record<string, Notification['type']> = {\n SYSTEM: 'SYSTEM',\n TRANSACTIONAL: 'TRANSACTIONAL',\n MARKETING: 'MARKETING',\n ALERT: 'ALERT',\n };\n return map[t] || 'SYSTEM';\n}\n\nfunction mapPriority(p: string) {\n const map: Record<string, Notification['priority']> = {\n LOW: 'LOW',\n MEDIUM: 'NORMAL',\n HIGH: 'HIGH',\n URGENT: 'URGENT',\n };\n return map[p] || 'NORMAL';\n}\n\nfunction mapStatus(s: string) {\n const map: Record<string, Notification['status']> = {\n DRAFT: 'PENDING',\n PENDING: 'PENDING',\n SCHEDULED: 'PENDING',\n TRIGGERED: 'SENT',\n SENT: 'SENT',\n DELIVERED: 'DELIVERED',\n READ: 'DELIVERED',\n FAILED: 'FAILED',\n CANCELLED: 'ARCHIVED',\n EXPIRED: 'ARCHIVED',\n };\n return map[s] || 'PENDING';\n}\n\n// ---------------------------------------------------------------------------\n// Build the backend filter from the MFE NotificationFilter shape\n// ---------------------------------------------------------------------------\n\nfunction buildBackendFilter(filter: NotificationFilter) {\n const backend: Record<string, unknown> = {};\n\n // Type filter — map MFE type names to backend enum\n if (filter.type !== 'ALL') {\n const typeMap: Record<string, string> = {\n SYSTEM: 'SYSTEM',\n ACTIVITY: 'TRANSACTIONAL',\n BILLING: 'TRANSACTIONAL',\n SECURITY: 'ALERT',\n SOCIAL: 'MARKETING',\n REMINDER: 'SYSTEM',\n };\n backend.type = typeMap[filter.type] || filter.type;\n }\n\n // Priority filter\n if (filter.priority !== 'ALL') {\n const prioMap: Record<string, string> = {\n LOW: 'LOW',\n NORMAL: 'MEDIUM',\n HIGH: 'HIGH',\n URGENT: 'URGENT',\n };\n backend.priority = prioMap[filter.priority] || filter.priority;\n }\n\n // Read/unread filter — coerce null to undefined\n if (filter.isRead !== null && filter.isRead !== undefined) {\n backend.isRead = filter.isRead;\n }\n\n if (filter.topicId) {\n backend.topicId = filter.topicId;\n }\n\n if (filter.channel && filter.channel !== 'ALL') {\n backend.channel = filter.channel;\n }\n\n if (filter.archived !== null && filter.archived !== undefined) {\n backend.archived = filter.archived;\n }\n\n if (filter.search) {\n backend.search = filter.search;\n }\n\n // Date range\n if (filter.dateRange.start) {\n backend.startDate = filter.dateRange.start.toISOString();\n }\n if (filter.dateRange.end) {\n backend.endDate = filter.dateRange.end.toISOString();\n }\n\n return Object.keys(backend).length > 0 ? backend : undefined;\n}\n\nfunction mergeNotificationFilter(\n filter: NotificationFilter,\n baseFilter?: Partial<NotificationFilter>\n): NotificationFilter {\n if (!baseFilter) return filter;\n\n return {\n ...filter,\n ...baseFilter,\n dateRange: {\n ...filter.dateRange,\n ...(baseFilter.dateRange || {}),\n },\n };\n}\n\n// ---------------------------------------------------------------------------\n// Hook\n// ---------------------------------------------------------------------------\n\n/**\n * Hook to manage notifications with real GraphQL backend integration.\n *\n * Uses the global Apollo client to query the notification service via the\n * public gateway (https://gw-global.local.burdenoff.com/global/graphql).\n *\n * @example\n * ```tsx\n * const { notifications, unreadCount, markAsRead } = useNotifications();\n * ```\n */\nexport function useNotifications(options: UseNotificationsOptions = {}) {\n const { authToken, apiGatewayUrl, currentUser, eventBus } = useNotification();\n const {\n notificationFilter,\n updateNotificationFilter,\n resetNotificationFilter,\n unreadCount,\n setUnreadCount: setStoreUnreadCount,\n setIsLoadingNotifications,\n } = useNotificationStore();\n\n const [notifications, setNotifications] = useState<Notification[]>([]);\n const [selectedNotification, setSelectedNotification] = useState<Notification | null>(null);\n const [isLoading, setIsLoading] = useState(false);\n const [error, setError] = useState<string | null>(null);\n const [hasMore, setHasMore] = useState(false);\n const [total, setTotal] = useState(0);\n const [isLoadingMore, setIsLoadingMore] = useState(false);\n // One \"load more\" at a time; the state drives the list's loading row.\n const loadingMoreRef = useRef(false);\n // Bumped whenever the list starts over (a new filter, a refetch), so a page\n // that was requested for the previous list is dropped instead of appended.\n const listGenerationRef = useRef(0);\n // Ids that came from the server's pages for the current list, as opposed to\n // the live feed; only these set where the next page starts.\n const pagedIdsRef = useRef<Set<string>>(new Set());\n // Each tab-refresh gets a number; only the latest one's answer is used.\n const refreshSeqRef = useRef(0);\n // A new first page (new filter, refetch) is on its way: the loaded list is\n // about to be replaced, so no page may be added after it meanwhile.\n const replacingListRef = useRef(false);\n // The loaded list as of the last render, for the tab-refresh merge below.\n const notificationsRef = useRef<Notification[]>([]);\n useEffect(() => {\n notificationsRef.current = notifications;\n }, [notifications]);\n const effectiveFilter = useMemo(\n () => mergeNotificationFilter(notificationFilter, options.baseFilter),\n [notificationFilter, options.baseFilter]\n );\n const [debouncedFilter, setDebouncedFilter] = useState(effectiveFilter);\n\n useEffect(() => {\n const timeout = window.setTimeout(() => setDebouncedFilter(effectiveFilter), 250);\n return () => window.clearTimeout(timeout);\n }, [effectiveFilter]);\n\n // Client accessor — coerce null/undefined authToken to undefined\n const getClient = useCallback(() => {\n return getGlobalNotificationClient(apiGatewayUrl ?? undefined, authToken ?? undefined);\n }, [apiGatewayUrl, authToken]);\n\n // ---- Fetch notifications ------------------------------------------------\n\n const fetchNotifications = useCallback(async () => {\n listGenerationRef.current += 1;\n const generation = listGenerationRef.current;\n replacingListRef.current = true;\n setIsLoading(true);\n setIsLoadingNotifications(true);\n setError(null);\n\n try {\n const client = getClient();\n const result = await client.query<GetNotificationsQuery>({\n context: USER_NOTIFICATION_CONTEXT,\n query: NotificationOps.GetNotificationsDocument,\n variables: {\n filter: buildBackendFilter(debouncedFilter),\n limit: NOTIFICATION_PAGE_SIZE,\n offset: 0,\n },\n fetchPolicy: 'network-only',\n });\n\n if (result.data?.notifications && generation === listGenerationRef.current) {\n const mapped = result.data.notifications.items.map(mapBackendToMfeNotification);\n pagedIdsRef.current = new Set(mapped.map((notification) => notification.id));\n setNotifications(mapped);\n setTotal(result.data.notifications.total);\n setHasMore(result.data.notifications.hasMore);\n }\n } catch (err: unknown) {\n const message = err instanceof Error ? err.message : 'Failed to fetch notifications';\n console.error('[useNotifications] Failed to fetch notifications:', err);\n setError(message);\n // The list on screen was loaded for an earlier filter: do not page it.\n if (generation === listGenerationRef.current) setHasMore(false);\n } finally {\n if (generation === listGenerationRef.current) replacingListRef.current = false;\n setIsLoading(false);\n setIsLoadingNotifications(false);\n }\n }, [debouncedFilter, getClient, setIsLoadingNotifications]);\n\n // ---- Fetch unread count -------------------------------------------------\n\n const fetchUnreadCount = useCallback(async () => {\n try {\n const client = getClient();\n const result = await client.query<GetMyUnreadNotificationCountQuery>({\n context: USER_NOTIFICATION_CONTEXT,\n query: NotificationOps.GetMyUnreadNotificationCountDocument,\n variables: { filter: options.unreadFilter || { channel: 'IN_APP' } },\n fetchPolicy: 'network-only',\n });\n if (result.data) {\n setStoreUnreadCount(result.data.myUnreadNotificationCount);\n }\n } catch (err: unknown) {\n console.error('[useNotifications] Failed to fetch unread count:', err);\n }\n }, [getClient, options.unreadFilter, setStoreUnreadCount]);\n\n // ---- Load more ----------------------------------------------------------\n\n const loadMore = useCallback(async () => {\n if (!hasMore || loadingMoreRef.current || replacingListRef.current) return;\n const pageWindow = nextNotificationWindow(notifications, pagedIdsRef.current, debouncedFilter);\n if (!pageWindow) return;\n loadingMoreRef.current = true;\n setIsLoadingMore(true);\n const generation = listGenerationRef.current;\n\n try {\n const client = getClient();\n const result = await client.query<GetNotificationsQuery>({\n context: USER_NOTIFICATION_CONTEXT,\n query: NotificationOps.GetNotificationsDocument,\n variables: {\n // Everything at or before the oldest loaded notification (the\n // filter's own end date is never earlier than that).\n filter: buildBackendFilter({\n ...debouncedFilter,\n dateRange: { ...debouncedFilter.dateRange, end: pageWindow.before },\n }),\n limit: pageWindow.limit,\n offset: pageWindow.offset,\n },\n fetchPolicy: 'network-only',\n });\n\n // The list started over (new filter or refetch) while this page loaded.\n if (generation !== listGenerationRef.current) return;\n if (result.data?.notifications) {\n const more = result.data.notifications.items.map(mapBackendToMfeNotification);\n for (const notification of more) pagedIdsRef.current.add(notification.id);\n setNotifications((prev) => appendNotificationPage(prev, more));\n // `total` here counts only the window, so the list's total stays as\n // the first page reported it.\n setHasMore(result.data.notifications.hasMore);\n }\n } catch (err: unknown) {\n const message = err instanceof Error ? err.message : 'Failed to load more notifications';\n console.error('[useNotifications] Failed to load more:', err);\n setError(message);\n } finally {\n loadingMoreRef.current = false;\n setIsLoadingMore(false);\n }\n }, [debouncedFilter, getClient, hasMore, notifications]);\n\n // Coming back to the tab: fetch the first page again for anything new, and\n // keep the older pages already scrolled through.\n const refreshFirstPage = useCallback(async () => {\n const generation = listGenerationRef.current;\n refreshSeqRef.current += 1;\n const refresh = refreshSeqRef.current;\n try {\n const client = getClient();\n const result = await client.query<GetNotificationsQuery>({\n context: USER_NOTIFICATION_CONTEXT,\n query: NotificationOps.GetNotificationsDocument,\n variables: {\n filter: buildBackendFilter(debouncedFilter),\n limit: NOTIFICATION_PAGE_SIZE,\n offset: 0,\n },\n fetchPolicy: 'network-only',\n });\n // The list started over, or a later refresh superseded this one.\n if (\n generation !== listGenerationRef.current ||\n refresh !== refreshSeqRef.current ||\n !result.data?.notifications\n ) {\n return;\n }\n const { items, total: freshTotal, hasMore: firstPageHasMore } = result.data.notifications;\n const firstPage = items.map(mapBackendToMfeNotification);\n const merged = mergeRefreshedFirstPage(\n notificationsRef.current,\n firstPage,\n firstPageHasMore,\n pagedIdsRef.current\n );\n if (merged.continued) {\n // The older pages carry on after the fresh one: keep them, and\n // whether more exist is still what the last of them said.\n for (const notification of firstPage) pagedIdsRef.current.add(notification.id);\n setNotifications(merged.list);\n } else {\n // The list starts over from the fresh first page; a page still\n // loading belongs to the old list and is dropped when it arrives.\n listGenerationRef.current += 1;\n pagedIdsRef.current = new Set(firstPage.map((notification) => notification.id));\n setNotifications(merged.list);\n setHasMore(firstPageHasMore);\n }\n setTotal(freshTotal);\n } catch (err: unknown) {\n console.error('[useNotifications] Failed to refresh notifications:', err);\n }\n }, [debouncedFilter, getClient]);\n\n // ---- Mutations ----------------------------------------------------------\n\n const handleMarkAsRead = useCallback(\n async (notificationId: string) => {\n try {\n const client = getClient();\n await client.mutate({\n context: USER_NOTIFICATION_CONTEXT,\n mutation: NotificationOps.MarkNotificationAsReadDocument,\n variables: { id: notificationId },\n });\n // Optimistic: update local state\n setNotifications((prev) =>\n prev.map((n) =>\n n.id === notificationId ? { ...n, readAt: new Date().toISOString() } : n\n )\n );\n setStoreUnreadCount(Math.max(0, unreadCount - 1));\n } catch (err: unknown) {\n console.error('[useNotifications] Failed to mark as read:', err);\n setError('Failed to mark notification as read');\n }\n },\n [getClient, setStoreUnreadCount, unreadCount]\n );\n\n const handleMarkAllAsRead = useCallback(async () => {\n try {\n const client = getClient();\n await client.mutate({\n context: USER_NOTIFICATION_CONTEXT,\n mutation: NotificationOps.MarkAllMyNotificationsAsReadDocument,\n });\n // Optimistic: update all local\n setNotifications((prev) =>\n prev.map((n) => ({ ...n, readAt: n.readAt || new Date().toISOString() }))\n );\n setStoreUnreadCount(0);\n } catch (err: unknown) {\n console.error('[useNotifications] Failed to mark all as read:', err);\n setError('Failed to mark all notifications as read');\n }\n }, [getClient, setStoreUnreadCount]);\n\n const handleArchive = useCallback(\n async (notificationId: string) => {\n try {\n const client = getClient();\n await client.mutate({\n context: USER_NOTIFICATION_CONTEXT,\n mutation: NotificationOps.ArchiveNotificationDocument,\n variables: { id: notificationId },\n });\n setNotifications((prev) =>\n prev.map((n) =>\n n.id === notificationId ? { ...n, archivedAt: new Date().toISOString() } : n\n )\n );\n } catch (err: unknown) {\n console.error('[useNotifications] Failed to archive notification:', err);\n setError('Failed to archive notification');\n }\n },\n [getClient]\n );\n\n const handleBulkArchive = useCallback(\n async (notificationIds: string[]) => {\n try {\n const client = getClient();\n await client.mutate({\n context: USER_NOTIFICATION_CONTEXT,\n mutation: NotificationOps.ArchiveNotificationsDocument,\n variables: { notificationIds },\n });\n const idsSet = new Set(notificationIds);\n setNotifications((prev) =>\n prev.map((n) => (idsSet.has(n.id) ? { ...n, archivedAt: new Date().toISOString() } : n))\n );\n } catch (err: unknown) {\n console.error('[useNotifications] Failed to bulk archive:', err);\n setError('Failed to archive notifications');\n }\n },\n [getClient]\n );\n\n const handleUnarchive = useCallback(\n async (notificationId: string) => {\n try {\n const client = getClient();\n await client.mutate({\n context: USER_NOTIFICATION_CONTEXT,\n mutation: NotificationOps.UnarchiveNotificationDocument,\n variables: { id: notificationId },\n });\n\n setNotifications((prev) =>\n prev.map((n) => (n.id === notificationId ? { ...n, archivedAt: undefined } : n))\n );\n } catch (err: unknown) {\n console.error('[useNotifications] Failed to unarchive notification:', err);\n setError('Failed to restore notification');\n }\n },\n [getClient]\n );\n\n const handleRecordAction = useCallback(\n async (notificationId: string, actionId?: string) => {\n try {\n const client = getClient();\n await client.mutate({\n context: USER_NOTIFICATION_CONTEXT,\n mutation: NotificationOps.RecordNotificationActionDocument,\n variables: { input: { notificationId, actionId } },\n });\n\n setNotifications((prev) =>\n prev.map((n) =>\n n.id === notificationId\n ? {\n ...n,\n clickedAt: new Date().toISOString(),\n readAt: n.readAt || new Date().toISOString(),\n }\n : n\n )\n );\n } catch (err: unknown) {\n console.error('[useNotifications] Failed to record notification action:', err);\n setError('Failed to record notification action');\n }\n },\n [getClient]\n );\n\n // ---- Initial fetch on mount + when filter changes -----------------------\n\n useEffect(() => {\n fetchNotifications();\n }, [fetchNotifications]);\n\n useEffect(() => {\n fetchUnreadCount();\n }, [fetchUnreadCount]);\n\n // ---- Live notification subscriptions ------------------------------------\n\n useEffect(() => {\n if (!currentUser?.id) return undefined;\n\n const client = getClient();\n const notificationSubscription = client\n .subscribe<NotificationReceivedSubscription>({\n query: NotificationOps.NotificationReceivedDocument,\n variables: { userId: currentUser.id },\n })\n .subscribe({\n next: (result) => {\n const notification = result.data?.notificationReceived;\n if (!notification) return;\n const mapped = mapBackendToMfeNotification(notification);\n setNotifications((prev) => [mapped, ...prev.filter((item) => item.id !== mapped.id)]);\n eventBus?.emit('notification:received', { notification: mapped });\n },\n error: (err) => {\n console.error('[useNotifications] Notification subscription failed:', err);\n },\n });\n\n const unreadSubscription = client\n .subscribe<UnreadCountUpdatedSubscription>({\n query: NotificationOps.UnreadCountUpdatedDocument,\n variables: { userId: currentUser.id },\n })\n .subscribe({\n next: (result) => {\n const nextCount = result.data?.unreadCountUpdated;\n if (typeof nextCount === 'number') {\n setStoreUnreadCount(nextCount);\n eventBus?.emit('notification:unread-count-updated', { unreadCount: nextCount });\n }\n },\n error: (err) => {\n console.error('[useNotifications] Unread count subscription failed:', err);\n },\n });\n\n return () => {\n notificationSubscription.unsubscribe();\n unreadSubscription.unsubscribe();\n };\n }, [currentUser?.id, eventBus, getClient, setStoreUnreadCount]);\n\n useEffect(() => {\n const handleVisibilityChange = () => {\n if (document.visibilityState === 'visible') {\n void refreshFirstPage();\n fetchUnreadCount();\n }\n };\n\n document.addEventListener('visibilitychange', handleVisibilityChange);\n return () => document.removeEventListener('visibilitychange', handleVisibilityChange);\n }, [refreshFirstPage, fetchUnreadCount]);\n\n const visibleNotifications = useMemo(\n () =>\n notifications.filter((notification) => {\n if (notification.deliveryStatus === 'UNSUBSCRIBED') {\n return false;\n }\n\n if (notification.status === 'ARCHIVED' && !notification.archivedAt) {\n return false;\n }\n\n if (effectiveFilter.archived === true) {\n return Boolean(notification.archivedAt);\n }\n\n if (effectiveFilter.archived === false) {\n return !notification.archivedAt;\n }\n\n return true;\n }),\n [effectiveFilter.archived, notifications]\n );\n\n return {\n notifications: visibleNotifications,\n allNotifications: notifications,\n unreadCount,\n selectedNotification,\n notificationFilter: effectiveFilter,\n isLoading,\n /** A further page is loading (infinite scroll). */\n isLoadingMore,\n error,\n hasMore,\n total,\n markAsRead: handleMarkAsRead,\n markAllAsRead: handleMarkAllAsRead,\n archiveNotification: handleArchive,\n bulkArchive: handleBulkArchive,\n unarchiveNotification: handleUnarchive,\n recordAction: handleRecordAction,\n setSelectedNotification,\n updateFilter: updateNotificationFilter,\n resetFilter: resetNotificationFilter,\n refetch: fetchNotifications,\n loadMore,\n };\n}\n"],"mappings":";;;;;;;AAuCA,SAAgBU,EAA4B,GAAsC;CAChF,OAAO;EACL,IAAIC,EAAE;EACN,MAAMC,EAAoBD,EAAE,IAAI;EAChC,UAAUE,EAAYF,EAAE,QAAQ;EAChC,OAAOA,EAAE;EACT,MAAMA,EAAE;EACR,WAAWA,EAAE,eAAe,KAAA;EAC5B,UAAUA,EAAE,WAAW,CAAC,EAAA,CAAG,KAAK,OAAY;GAC1C,IAAIG,EAAO;GACX,OAAOA,EAAO;GACd,KAAKA,EAAO;GACZ,OAAOA,EAAO,SAAS,KAAA;GACvB,YAAYA,EAAO,cAAc,KAAA;GACjC,UAAUA,EAAO,YAAY,KAAA;EAC/B,EAAE;EACF,SAASH,EAAE,WAAW,KAAA;EACtB,YAAYA,EAAE,cAAc,KAAA;EAC5B,SAASA,EAAE;EACX,WAAWA,EAAE,aAAa,KAAA;EAC1B,aAAaA,EAAE,eAAe,KAAA;EAC9B,gBAAgBA,EAAE,kBAAkB,KAAA;EACpC,UAAUA,EAAE,eAAe,KAAA;EAC3B,QAAQA,EAAE,SAAS,CAAC,EAAA,CAAG,KAAK,OAAU;GACpC,KAAKI,EAAK;GACV,OAAOA,EAAK,SAAS,KAAA;GACrB,MAAMA,EAAK,QAAQ,KAAA;GACnB,aAAaA,E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EACA;EACA,YAAYsC;EACZ,eAAeI;EACf,qBAAqBE;EACrB,aAAaE;EACb,uBAAuBI;EACvB,cAAcE;EACd;EACA,cAAcY;EACd,aAAaC;EACb,SAASrD;EACT;CACF;AACF"}
@@ -467,5 +467,85 @@ export declare const enTranslations: {
467
467
  usingTemplate: string;
468
468
  view: string;
469
469
  youHave: string;
470
+ v3: {
471
+ actionsFor: string;
472
+ archive: string;
473
+ empty: {
474
+ actionBody: string;
475
+ actionTitle: string;
476
+ allBody: string;
477
+ allTitle: string;
478
+ archivedBody: string;
479
+ archivedTitle: string;
480
+ searchBody: string;
481
+ searchTitle: string;
482
+ unreadTitle: string;
483
+ };
484
+ event: {
485
+ bounced: string;
486
+ cancelled: string;
487
+ clicked: string;
488
+ complained: string;
489
+ created: string;
490
+ delivered: string;
491
+ expired: string;
492
+ failed: string;
493
+ opened: string;
494
+ other: string;
495
+ retry: string;
496
+ scheduled: string;
497
+ sent: string;
498
+ unsubscribed: string;
499
+ };
500
+ markAll: string;
501
+ markedAll: string;
502
+ markRead: string;
503
+ markUnread: string;
504
+ more: string;
505
+ needsYou: string;
506
+ panel: {
507
+ close: string;
508
+ loading: string;
509
+ missing: string;
510
+ open: string;
511
+ what: string;
512
+ };
513
+ prefs: {
514
+ openInbox: string;
515
+ pause: string;
516
+ pausedNow: string;
517
+ pauseHelp: string;
518
+ pauseTitle: string;
519
+ purpose: string;
520
+ topicsTitle: string;
521
+ useDefault: string;
522
+ whatTitle: string;
523
+ whereTitle: string;
524
+ };
525
+ purpose: string;
526
+ read: string;
527
+ restore: string;
528
+ search: string;
529
+ settings: string;
530
+ tab: {
531
+ action: string;
532
+ all: string;
533
+ archived: string;
534
+ unread: string;
535
+ };
536
+ thing: {
537
+ affectedRuns: string;
538
+ attempt: string;
539
+ firstSeen: string;
540
+ label: string;
541
+ openRun: string;
542
+ step: string;
543
+ };
544
+ timeline: string;
545
+ title: string;
546
+ today: string;
547
+ unread: string;
548
+ yesterday: string;
549
+ };
470
550
  };
471
551
  };
@@ -188,7 +188,8 @@ export interface NotificationTopicSubscription {
188
188
  topicId: string;
189
189
  userId: string;
190
190
  }
191
- export type NotificationPreferenceScope = 'GLOBAL' | 'CHANNEL' | 'TYPE' | 'TOPIC';
191
+ /** CATEGORY: a feature category such as "proactive" (global-notification-svc, BOFF-13164). */
192
+ export type NotificationPreferenceScope = 'GLOBAL' | 'CHANNEL' | 'TYPE' | 'TOPIC' | 'CATEGORY';
192
193
  export type NotificationPreferenceFrequency = 'IMMEDIATE' | 'DAILY_DIGEST' | 'WEEKLY_DIGEST' | 'NEVER';
193
194
  export interface NotificationPreference {
194
195
  id: string;
@@ -0,0 +1 @@
1
+ export declare function ArchivedRedirect(): import('react').JSX.Element;
@@ -0,0 +1,14 @@
1
+ import { useNotificationPaths as e } from "../navigation-v2/paths.js";
2
+ import { Navigate as t } from "react-router";
3
+ import { jsx as n } from "react/jsx-runtime";
4
+ // src/v2/ArchivedRedirect.tsx
5
+ function r() {
6
+ let r = e();
7
+ return /* @__PURE__ */ n(t, {
8
+ to: `${r.inbox}?tab=archived`,
9
+ replace: !0
10
+ });
11
+ }
12
+ export { r as ArchivedRedirect };
13
+
14
+ //# sourceMappingURL=ArchivedRedirect.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ArchivedRedirect.js","names":["ArchivedRedirect","paths","useNotificationPaths","Navigate"],"sources":["../../src/v2/ArchivedRedirect.tsx"],"sourcesContent":["/**\n * `/notifications/history` under fe-libs' `accountPagesV2` (BOFF-16785, C1): the inbox's Archived\n * tab. Only rendered under the opt-in.\n */\nimport { Navigate } from 'react-router';\nimport { useNotificationPaths } from '../navigation-v2/paths';\n\nexport function ArchivedRedirect() {\n const paths = useNotificationPaths();\n return <Navigate to={`${paths.inbox}?tab=archived`} replace />;\n}\n"],"mappings":";;;;AAOA,SAAgBA,IAAmB;CACjC,IAAMC,IAAQC,EAAqB;CACnC,OAAO,kBAACC,GAAD;EAAU,IAAI,GAAGF,EAAM,MAAM;EAAgB,SAAA;CAAS,CAAA;AAC/D"}
@@ -0,0 +1 @@
1
+ export declare function InboxPage(): import('react').JSX.Element;
@@ -0,0 +1,191 @@
1
+ import { useNotifications as e } from "../hooks/useNotifications.js";
2
+ import { useTr as t } from "../shared/hooks/useTr.js";
3
+ import { useNotificationPaths as n } from "../navigation-v2/paths.js";
4
+ import { useAdminTools as r } from "../navigation-v2/useAdminTools.js";
5
+ import { INBOX_TABS as i, isUnread as a, needsAction as o, readInboxTab as s } from "./model/inbox.js";
6
+ import { InboxRows as c } from "./InboxRows.js";
7
+ import { NotificationDetailPanel as l } from "./NotificationDetailPanel.js";
8
+ import { useMarkUnread as u } from "./useNotificationDetail.js";
9
+ import { useMemo as d } from "react";
10
+ import { CheckCheck as f, Search as p } from "lucide-react";
11
+ import { Navigate as m, useNavigate as h, useSearchParams as g } from "react-router";
12
+ import { jsx as _, jsxs as v } from "react/jsx-runtime";
13
+ import { PageHeader as y } from "@burdenoff/fe-libs/chrome";
14
+ import { Button as b, EmptyState as x, Input as S, LoadError as C, PageTabs as w, useNotify as T } from "@burdenoff/fe-libs/ui";
15
+ // src/v2/InboxPage.tsx
16
+ var E = {
17
+ all: {
18
+ archived: !1,
19
+ channel: "IN_APP"
20
+ },
21
+ unread: {
22
+ archived: !1,
23
+ channel: "IN_APP",
24
+ isRead: !1
25
+ },
26
+ action: {
27
+ archived: !1,
28
+ channel: "IN_APP"
29
+ },
30
+ archived: {
31
+ archived: !0,
32
+ channel: "IN_APP"
33
+ }
34
+ }, D = { channel: "IN_APP" };
35
+ function O(e, t) {
36
+ return e === "send" ? t.send : e === "templates" ? t.templates : e === "topics" ? t.topics : e === "history" ? t.deliveryLog : null;
37
+ }
38
+ function k() {
39
+ let e = n(), [t] = g(), r = O(t.get("tab"), e);
40
+ return r ? /* @__PURE__ */ _(m, {
41
+ to: r,
42
+ replace: !0
43
+ }) : /* @__PURE__ */ _(A, {});
44
+ }
45
+ function A() {
46
+ let m = t(), x = h(), O = T(), k = n(), { tools: A } = r(), [M, N] = g(), P = s(M.get("tab")), F = M.get("open"), I = e({
47
+ baseFilter: E[P],
48
+ unreadFilter: D
49
+ }), L = u(), R = d(() => P === "action" ? I.notifications.filter(o) : I.notifications, [I.notifications, P]), z = I.notificationFilter.search ?? "", B = (e) => {
50
+ let t = new URLSearchParams(M);
51
+ e ? t.set("open", e) : t.delete("open"), N(t);
52
+ }, V = async () => {
53
+ let e = I.allNotifications.filter(a).map((e) => e.id), t = e.length >= I.unreadCount;
54
+ await I.markAllAsRead(), O({
55
+ title: m("notifications.v3.markedAll", "Marked {{count}} as read", { count: I.unreadCount || e.length }),
56
+ tone: "success",
57
+ undo: t && e.length > 0 ? async () => {
58
+ await L(e), await I.refetch();
59
+ } : void 0
60
+ });
61
+ }, H = {
62
+ all: m("notifications.v3.tab.all", "All"),
63
+ unread: m("notifications.v3.tab.unread", "Unread"),
64
+ action: m("notifications.v3.tab.action", "Needs action"),
65
+ archived: m("notifications.v3.tab.archived", "Archived")
66
+ };
67
+ return /* @__PURE__ */ v("div", {
68
+ "data-account-pages-v2": "notifications",
69
+ className: "flex w-full min-w-0 flex-col",
70
+ children: [
71
+ /* @__PURE__ */ _(y, {
72
+ variant: "compact",
73
+ title: m("notifications.v3.title", "Notifications"),
74
+ description: m("notifications.v3.purpose", "Everything that needs you, and everything you were told."),
75
+ primary: /* @__PURE__ */ v(b, {
76
+ variant: "outline",
77
+ disabled: I.unreadCount === 0,
78
+ onClick: () => void V(),
79
+ "data-testid": "inbox-mark-all",
80
+ children: [/* @__PURE__ */ _(f, { "aria-hidden": "true" }), m("notifications.v3.markAll", "Mark all as read")]
81
+ }),
82
+ settings: {
83
+ label: m("notifications.v3.settings", "Notification settings"),
84
+ onClick: () => x(k.preferences)
85
+ },
86
+ more: A.map((e) => ({
87
+ id: e.id,
88
+ label: e.label,
89
+ onSelect: () => x(e.href)
90
+ }))
91
+ }),
92
+ /* @__PURE__ */ _(w, {
93
+ ariaLabel: m("notifications.v3.title", "Notifications"),
94
+ activeId: P,
95
+ tabs: i.map((e) => ({
96
+ id: e,
97
+ label: H[e],
98
+ href: `?tab=${e}`,
99
+ badge: e === "unread" && I.unreadCount > 0 ? I.unreadCount : void 0
100
+ }))
101
+ }),
102
+ /* @__PURE__ */ v("div", {
103
+ className: "mt-4 flex flex-col gap-3",
104
+ children: [
105
+ /* @__PURE__ */ v("label", {
106
+ className: "relative block max-w-md",
107
+ children: [
108
+ /* @__PURE__ */ _("span", {
109
+ className: "sr-only",
110
+ children: m("notifications.v3.search", "Search notifications")
111
+ }),
112
+ /* @__PURE__ */ _(p, {
113
+ className: "pointer-events-none absolute top-1/2 left-3 size-4 -translate-y-1/2 text-text-muted",
114
+ "aria-hidden": "true"
115
+ }),
116
+ /* @__PURE__ */ _(S, {
117
+ type: "search",
118
+ className: "pl-9",
119
+ value: z,
120
+ placeholder: m("notifications.v3.search", "Search notifications"),
121
+ onChange: (e) => I.updateFilter({ search: e.target.value }),
122
+ "data-testid": "inbox-search"
123
+ })
124
+ ]
125
+ }),
126
+ I.error && R.length === 0 ? /* @__PURE__ */ _(C, {
127
+ what: m("notifications.v3.title", "Notifications"),
128
+ error: I.error,
129
+ onRetry: () => void I.refetch()
130
+ }) : !I.isLoading && R.length === 0 ? /* @__PURE__ */ _(j, {
131
+ tab: P,
132
+ searching: !!z.trim()
133
+ }) : /* @__PURE__ */ _(c, {
134
+ notifications: R,
135
+ loading: I.isLoading && R.length === 0,
136
+ onOpen: (e) => {
137
+ B(e);
138
+ let t = R.find((t) => t.id === e);
139
+ t && a(t) && I.markAsRead(e);
140
+ },
141
+ onMarkRead: (e) => void I.markAsRead(e),
142
+ onMarkUnread: (e) => void L([e]).then(() => I.refetch()),
143
+ onArchive: (e) => void I.archiveNotification(e),
144
+ onRestore: (e) => void I.unarchiveNotification(e)
145
+ }),
146
+ I.hasMore ? /* @__PURE__ */ _("div", {
147
+ className: "flex justify-center",
148
+ children: /* @__PURE__ */ _(b, {
149
+ variant: "ghost",
150
+ busy: I.isLoadingMore,
151
+ onClick: () => void I.loadMore(),
152
+ "data-testid": "inbox-more",
153
+ children: m("notifications.v3.more", "Show more")
154
+ })
155
+ }) : null
156
+ ]
157
+ }),
158
+ /* @__PURE__ */ _(l, {
159
+ id: F,
160
+ onClose: () => B(null),
161
+ onMarkUnread: (e) => void L([e]).then(() => I.refetch()),
162
+ onArchive: (e) => {
163
+ I.archiveNotification(e), B(null);
164
+ },
165
+ onRestore: (e) => void I.unarchiveNotification(e)
166
+ })
167
+ ]
168
+ });
169
+ }
170
+ function j({ tab: e, searching: n }) {
171
+ let r = t();
172
+ if (n) return /* @__PURE__ */ _(x, {
173
+ kind: "no-results",
174
+ title: r("notifications.v3.empty.searchTitle", "No notifications match"),
175
+ description: r("notifications.v3.empty.searchBody", "Try other words.")
176
+ });
177
+ let [i, a] = {
178
+ all: [r("notifications.v3.empty.allTitle", "You’re all caught up"), r("notifications.v3.empty.allBody", "New notifications show up here and on the bell.")],
179
+ unread: [r("notifications.v3.empty.unreadTitle", "Nothing unread"), r("notifications.v3.empty.allBody", "New notifications show up here and on the bell.")],
180
+ action: [r("notifications.v3.empty.actionTitle", "Nothing waiting for you"), r("notifications.v3.empty.actionBody", "Approvals and requests show up here.")],
181
+ archived: [r("notifications.v3.empty.archivedTitle", "Nothing archived"), r("notifications.v3.empty.archivedBody", "Archive a notification to keep it out of the way. It stays here.")]
182
+ }[e];
183
+ return /* @__PURE__ */ _(x, {
184
+ kind: e === "archived" ? "first-use" : "all-done",
185
+ title: i,
186
+ description: a
187
+ });
188
+ }
189
+ export { k as InboxPage };
190
+
191
+ //# sourceMappingURL=InboxPage.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"InboxPage.js","names":["Inbox","TAB_FILTERS","UNREAD_FILTER","oldTabTarget","tab","paths","InboxPage","useNotificationPaths","params","useSearchParams","target","Navigate","Inbox$1","tr","useTr","navigate","useNavigate","notify","useNotify","useAdminTools","setParams","readInboxTab","openId","inbox","useNotifications","markUnread","useMarkUnread","shown","useMemo","needsAction","search","open","next","id","markAll","unreadIds","isUnread","n","everyOne","tabLabel","PageHeader","Button","CheckCheck","tools","tool","PageTabs","INBOX_TABS","Search","Input","event","LoadError","InboxEmpty","InboxRows","notification","NotificationDetailPanel","searching","EmptyState","title","description"],"sources":["../../src/v2/InboxPage.tsx"],"sourcesContent":["/**\n * Notifications (BOFF-16785, C1; the mockup's `notif`), under fe-libs' `accountPagesV2`: the inbox\n * at the list width, tabs All · Unread · Needs action · Archived (`?tab=`), compact rows grouped by\n * day, \"Mark all as read\" with Undo, the settings under the gear and, for admins, Send, Templates,\n * Topics and the Delivery log in ⋯. A row opens its panel (`?open=<id>`, decision 10). The same\n * queries as the inbox today (`useNotifications`).\n */\nimport { useMemo } from 'react';\nimport { Navigate, useNavigate, useSearchParams } from 'react-router';\nimport { CheckCheck, Search } from 'lucide-react';\nimport { PageHeader } from '@burdenoff/fe-libs/chrome';\nimport { Button, EmptyState, Input, LoadError, PageTabs, useNotify } from '@burdenoff/fe-libs/ui';\nimport { useNotifications } from '../hooks';\nimport type { NotificationFilter } from '../types';\nimport { useTr } from '../shared/hooks/useTr';\nimport { useNotificationPaths } from '../navigation-v2/paths';\nimport { useAdminTools } from '../navigation-v2/useAdminTools';\nimport { INBOX_TABS, isUnread, needsAction, readInboxTab, type InboxTab } from './model/inbox';\nimport { InboxRows } from './InboxRows';\nimport { NotificationDetailPanel } from './NotificationDetailPanel';\nimport { useMarkUnread } from './useNotificationDetail';\n\n/** What each tab asks the service for: the in-app inbox, archived or not, unread or not. */\nconst TAB_FILTERS: Record<InboxTab, Partial<NotificationFilter>> = {\n all: { archived: false, channel: 'IN_APP' },\n unread: { archived: false, channel: 'IN_APP', isRead: false },\n action: { archived: false, channel: 'IN_APP' },\n archived: { archived: true, channel: 'IN_APP' },\n};\nconst UNREAD_FILTER = { channel: 'IN_APP' };\n\n/** Where today's `?tab=` values still go (the round-1 landing's links). */\nfunction oldTabTarget(\n tab: string | null,\n paths: ReturnType<typeof useNotificationPaths>\n): string | null {\n if (tab === 'send') return paths.send;\n if (tab === 'templates') return paths.templates;\n if (tab === 'topics') return paths.topics;\n if (tab === 'history') return paths.deliveryLog;\n return null;\n}\n\nexport function InboxPage() {\n const paths = useNotificationPaths();\n const [params] = useSearchParams();\n const target = oldTabTarget(params.get('tab'), paths);\n if (target) return <Navigate to={target} replace />;\n return <Inbox />;\n}\n\nfunction Inbox() {\n const tr = useTr();\n const navigate = useNavigate();\n const notify = useNotify();\n const paths = useNotificationPaths();\n const { tools } = useAdminTools();\n const [params, setParams] = useSearchParams();\n const tab = readInboxTab(params.get('tab'));\n const openId = params.get('open');\n const inbox = useNotifications({ baseFilter: TAB_FILTERS[tab], unreadFilter: UNREAD_FILTER });\n const markUnread = useMarkUnread();\n const shown = useMemo(\n () => (tab === 'action' ? inbox.notifications.filter(needsAction) : inbox.notifications),\n [inbox.notifications, tab]\n );\n const search = inbox.notificationFilter.search ?? '';\n\n const open = (id: string | null) => {\n const next = new URLSearchParams(params);\n if (id) next.set('open', id);\n else next.delete('open');\n setParams(next);\n };\n\n const markAll = async () => {\n // Undo can only bring back what's loaded: offer it when every unread one is on the page.\n const unreadIds = inbox.allNotifications.filter(isUnread).map((n) => n.id);\n const everyOne = unreadIds.length >= inbox.unreadCount;\n await inbox.markAllAsRead();\n notify({\n title: tr('notifications.v3.markedAll', 'Marked {{count}} as read', {\n count: inbox.unreadCount || unreadIds.length,\n }),\n tone: 'success',\n undo:\n everyOne && unreadIds.length > 0\n ? async () => {\n await markUnread(unreadIds);\n await inbox.refetch();\n }\n : undefined,\n });\n };\n\n const tabLabel: Record<InboxTab, string> = {\n all: tr('notifications.v3.tab.all', 'All'),\n unread: tr('notifications.v3.tab.unread', 'Unread'),\n action: tr('notifications.v3.tab.action', 'Needs action'),\n archived: tr('notifications.v3.tab.archived', 'Archived'),\n };\n\n return (\n <div data-account-pages-v2=\"notifications\" className=\"flex w-full min-w-0 flex-col\">\n <PageHeader\n variant=\"compact\"\n title={tr('notifications.v3.title', 'Notifications')}\n description={tr(\n 'notifications.v3.purpose',\n 'Everything that needs you, and everything you were told.'\n )}\n primary={\n <Button\n variant=\"outline\"\n disabled={inbox.unreadCount === 0}\n onClick={() => void markAll()}\n data-testid=\"inbox-mark-all\"\n >\n <CheckCheck aria-hidden=\"true\" />\n {tr('notifications.v3.markAll', 'Mark all as read')}\n </Button>\n }\n settings={{\n label: tr('notifications.v3.settings', 'Notification settings'),\n onClick: () => navigate(paths.preferences),\n }}\n more={tools.map((tool) => ({\n id: tool.id,\n label: tool.label,\n onSelect: () => navigate(tool.href),\n }))}\n />\n <PageTabs\n ariaLabel={tr('notifications.v3.title', 'Notifications')}\n activeId={tab}\n tabs={INBOX_TABS.map((id) => ({\n id,\n label: tabLabel[id],\n href: `?tab=${id}`,\n badge: id === 'unread' && inbox.unreadCount > 0 ? inbox.unreadCount : undefined,\n }))}\n />\n <div className=\"mt-4 flex flex-col gap-3\">\n <label className=\"relative block max-w-md\">\n <span className=\"sr-only\">{tr('notifications.v3.search', 'Search notifications')}</span>\n <Search\n className=\"pointer-events-none absolute top-1/2 left-3 size-4 -translate-y-1/2 text-text-muted\"\n aria-hidden=\"true\"\n />\n <Input\n type=\"search\"\n className=\"pl-9\"\n value={search}\n placeholder={tr('notifications.v3.search', 'Search notifications')}\n onChange={(event) => inbox.updateFilter({ search: event.target.value })}\n data-testid=\"inbox-search\"\n />\n </label>\n {inbox.error && shown.length === 0 ? (\n <LoadError\n what={tr('notifications.v3.title', 'Notifications')}\n error={inbox.error}\n onRetry={() => void inbox.refetch()}\n />\n ) : !inbox.isLoading && shown.length === 0 ? (\n <InboxEmpty tab={tab} searching={Boolean(search.trim())} />\n ) : (\n <InboxRows\n notifications={shown}\n loading={inbox.isLoading && shown.length === 0}\n onOpen={(id) => {\n open(id);\n const notification = shown.find((n) => n.id === id);\n if (notification && isUnread(notification)) void inbox.markAsRead(id);\n }}\n onMarkRead={(id) => void inbox.markAsRead(id)}\n onMarkUnread={(id) => void markUnread([id]).then(() => inbox.refetch())}\n onArchive={(id) => void inbox.archiveNotification(id)}\n onRestore={(id) => void inbox.unarchiveNotification(id)}\n />\n )}\n {inbox.hasMore ? (\n <div className=\"flex justify-center\">\n <Button\n variant=\"ghost\"\n busy={inbox.isLoadingMore}\n onClick={() => void inbox.loadMore()}\n data-testid=\"inbox-more\"\n >\n {tr('notifications.v3.more', 'Show more')}\n </Button>\n </div>\n ) : null}\n </div>\n <NotificationDetailPanel\n id={openId}\n onClose={() => open(null)}\n onMarkUnread={(id) => void markUnread([id]).then(() => inbox.refetch())}\n onArchive={(id) => {\n void inbox.archiveNotification(id);\n open(null);\n }}\n onRestore={(id) => void inbox.unarchiveNotification(id)}\n />\n </div>\n );\n}\n\nfunction InboxEmpty({ tab, searching }: { tab: InboxTab; searching: boolean }) {\n const tr = useTr();\n if (searching) {\n return (\n <EmptyState\n kind=\"no-results\"\n title={tr('notifications.v3.empty.searchTitle', 'No notifications match')}\n description={tr('notifications.v3.empty.searchBody', 'Try other words.')}\n />\n );\n }\n const words: Record<InboxTab, [string, string]> = {\n all: [\n tr('notifications.v3.empty.allTitle', 'You’re all caught up'),\n tr('notifications.v3.empty.allBody', 'New notifications show up here and on the bell.'),\n ],\n unread: [\n tr('notifications.v3.empty.unreadTitle', 'Nothing unread'),\n tr('notifications.v3.empty.allBody', 'New notifications show up here and on the bell.'),\n ],\n action: [\n tr('notifications.v3.empty.actionTitle', 'Nothing waiting for you'),\n tr('notifications.v3.empty.actionBody', 'Approvals and requests show up here.'),\n ],\n archived: [\n tr('notifications.v3.empty.archivedTitle', 'Nothing archived'),\n tr(\n 'notifications.v3.empty.archivedBody',\n 'Archive a notification to keep it out of the way. It stays here.'\n ),\n ],\n };\n const [title, description] = words[tab];\n return (\n <EmptyState\n kind={tab === 'archived' ? 'first-use' : 'all-done'}\n title={title}\n description={description}\n />\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;AAuBA,IAAMC,IAA6D;CACjE,KAAK;EAAE,U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