@burdenoff/microfe-notification 2026.1029.2 → 2026.1113.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 (261) hide show
  1. package/dist/AdminNotificationRoot.d.ts +33 -0
  2. package/dist/AdminNotificationRoot.js +9 -6
  3. package/dist/AdminNotificationRoot.js.map +1 -1
  4. package/dist/AdminNotificationRoutes.d.ts +1 -0
  5. package/dist/AdminNotificationRoutes.js +22 -23
  6. package/dist/AdminNotificationRoutes.js.map +1 -1
  7. package/dist/NotificationRoot.d.ts +29 -0
  8. package/dist/NotificationRoot.js +9 -6
  9. package/dist/NotificationRoot.js.map +1 -1
  10. package/dist/NotificationRoutes.d.ts +18 -0
  11. package/dist/NotificationRoutes.js +109 -38
  12. package/dist/NotificationRoutes.js.map +1 -1
  13. package/dist/UserNotificationRoot.d.ts +32 -0
  14. package/dist/UserNotificationRoot.js +9 -6
  15. package/dist/UserNotificationRoot.js.map +1 -1
  16. package/dist/UserNotificationRoutes.d.ts +16 -0
  17. package/dist/UserNotificationRoutes.js +9 -10
  18. package/dist/UserNotificationRoutes.js.map +1 -1
  19. package/dist/components/ConfirmDeleteDialog.d.ts +17 -0
  20. package/dist/components/ConfirmDeleteDialog.js +22 -0
  21. package/dist/components/ConfirmDeleteDialog.js.map +1 -0
  22. package/dist/components/FeatureDisabledPage.d.ts +6 -0
  23. package/dist/components/FeatureDisabledPage.js +1 -2
  24. package/dist/components/FeatureDisabledPage.js.map +1 -1
  25. package/dist/components/NotificationBell.d.ts +13 -0
  26. package/dist/components/NotificationBell.js +6 -7
  27. package/dist/components/NotificationBell.js.map +1 -1
  28. package/dist/components/NotificationCard.d.ts +27 -0
  29. package/dist/components/NotificationCard.js +106 -76
  30. package/dist/components/NotificationCard.js.map +1 -1
  31. package/dist/components/NotificationPanel.d.ts +10 -0
  32. package/dist/components/NotificationPanel.js +5 -6
  33. package/dist/components/NotificationPanel.js.map +1 -1
  34. package/dist/components/RecipientSelector.d.ts +32 -0
  35. package/dist/components/RecipientSelector.js +2 -3
  36. package/dist/components/RecipientSelector.js.map +1 -1
  37. package/dist/components/TemplatePreview.d.ts +21 -0
  38. package/dist/components/TemplatePreview.js +3 -4
  39. package/dist/components/TemplatePreview.js.map +1 -1
  40. package/dist/components/VariableInserter.d.ts +11 -0
  41. package/dist/components/index.d.ts +3 -0
  42. package/dist/components/index.js +4 -3
  43. package/dist/constants/permissions.d.ts +23 -0
  44. package/dist/constants/permissions.js +1 -2
  45. package/dist/constants/permissions.js.map +1 -1
  46. package/dist/dev/main.d.ts +0 -0
  47. package/dist/generated/global-operations.d.ts +2119 -0
  48. package/dist/generated/global-operations.js +80 -69
  49. package/dist/generated/global-operations.js.map +1 -1
  50. package/dist/generated/global-types.d.ts +23507 -0
  51. package/dist/generated/wspace-operations.d.ts +4 -0
  52. package/dist/generated/wspace-types.d.ts +57831 -0
  53. package/dist/graphql/global-client.d.ts +32 -0
  54. package/dist/graphql/global-client.js +23 -30
  55. package/dist/graphql/global-client.js.map +1 -1
  56. package/dist/hooks/index.d.ts +7 -0
  57. package/dist/hooks/index.js +7 -6
  58. package/dist/hooks/useNotificationAdmin.d.ts +46 -0
  59. package/dist/hooks/useNotificationAdmin.js +18 -17
  60. package/dist/hooks/useNotificationAdmin.js.map +1 -1
  61. package/dist/hooks/useNotificationAnalytics.d.ts +65 -0
  62. package/dist/hooks/useNotificationAnalytics.js +1 -2
  63. package/dist/hooks/useNotificationAnalytics.js.map +1 -1
  64. package/dist/hooks/useNotificationPreferences.d.ts +10 -0
  65. package/dist/hooks/useNotificationPreferences.js +7 -7
  66. package/dist/hooks/useNotificationPreferences.js.map +1 -1
  67. package/dist/hooks/useNotificationTemplates.d.ts +131 -0
  68. package/dist/hooks/useNotificationTemplates.js +1 -2
  69. package/dist/hooks/useNotificationTemplates.js.map +1 -1
  70. package/dist/hooks/useNotificationTopics.d.ts +35 -0
  71. package/dist/hooks/useNotificationTopics.js +22 -22
  72. package/dist/hooks/useNotificationTopics.js.map +1 -1
  73. package/dist/hooks/useNotifications.d.ts +39 -0
  74. package/dist/hooks/useNotifications.js +6 -4
  75. package/dist/hooks/useNotifications.js.map +1 -1
  76. package/dist/hooks/usePreferenceToggles.d.ts +27 -0
  77. package/dist/hooks/usePreferenceToggles.js +84 -0
  78. package/dist/hooks/usePreferenceToggles.js.map +1 -0
  79. package/dist/hooks/useSendNotification.d.ts +158 -0
  80. package/dist/hooks/useSendNotification.js +12 -10
  81. package/dist/hooks/useSendNotification.js.map +1 -1
  82. package/dist/hooks/useUserSearch.d.ts +26 -0
  83. package/dist/hooks/useUserSearch.js +8 -10
  84. package/dist/hooks/useUserSearch.js.map +1 -1
  85. package/dist/index.d.ts +36 -0
  86. package/dist/index.js +8 -8
  87. package/dist/navigation-v2/AdminPageV2.d.ts +14 -0
  88. package/dist/navigation-v2/AdminPageV2.js +51 -0
  89. package/dist/navigation-v2/AdminPageV2.js.map +1 -0
  90. package/dist/navigation-v2/AdminToolsMenu.d.ts +6 -0
  91. package/dist/navigation-v2/AdminToolsMenu.js +32 -0
  92. package/dist/navigation-v2/AdminToolsMenu.js.map +1 -0
  93. package/dist/navigation-v2/BackToNotifications.d.ts +2 -0
  94. package/dist/navigation-v2/BackToNotifications.js +20 -0
  95. package/dist/navigation-v2/BackToNotifications.js.map +1 -0
  96. package/dist/navigation-v2/FilterControls.d.ts +25 -0
  97. package/dist/navigation-v2/FilterControls.js +64 -0
  98. package/dist/navigation-v2/FilterControls.js.map +1 -0
  99. package/dist/navigation-v2/NotificationArchivedV2.d.ts +9 -0
  100. package/dist/navigation-v2/NotificationArchivedV2.js +174 -0
  101. package/dist/navigation-v2/NotificationArchivedV2.js.map +1 -0
  102. package/dist/navigation-v2/NotificationInboxV2.d.ts +9 -0
  103. package/dist/navigation-v2/NotificationInboxV2.js +309 -0
  104. package/dist/navigation-v2/NotificationInboxV2.js.map +1 -0
  105. package/dist/navigation-v2/NotificationSettingsV2.d.ts +9 -0
  106. package/dist/navigation-v2/NotificationSettingsV2.js +203 -0
  107. package/dist/navigation-v2/NotificationSettingsV2.js.map +1 -0
  108. package/dist/navigation-v2/NotificationsV2Landing.d.ts +9 -0
  109. package/dist/navigation-v2/NotificationsV2Landing.js +37 -0
  110. package/dist/navigation-v2/NotificationsV2Landing.js.map +1 -0
  111. package/dist/navigation-v2/__tests__/uiMocks.d.ts +71 -0
  112. package/dist/navigation-v2/inboxFilters.d.ts +8 -0
  113. package/dist/navigation-v2/inboxFilters.js +10 -0
  114. package/dist/navigation-v2/inboxFilters.js.map +1 -0
  115. package/dist/navigation-v2/paths.d.ts +24 -0
  116. package/dist/navigation-v2/paths.js +31 -0
  117. package/dist/navigation-v2/paths.js.map +1 -0
  118. package/dist/navigation-v2/settingsOptions.d.ts +12 -0
  119. package/dist/navigation-v2/settingsOptions.js +58 -0
  120. package/dist/navigation-v2/settingsOptions.js.map +1 -0
  121. package/dist/navigation-v2/useAdminTools.d.ts +22 -0
  122. package/dist/navigation-v2/useAdminTools.js +76 -0
  123. package/dist/navigation-v2/useAdminTools.js.map +1 -0
  124. package/dist/node_modules/@apollo/client/errors/CombinedGraphQLErrors.js +1 -2
  125. package/dist/node_modules/@apollo/client/errors/CombinedGraphQLErrors.js.map +1 -1
  126. package/dist/node_modules/@apollo/client/errors/utils.js +1 -2
  127. package/dist/node_modules/@apollo/client/errors/utils.js.map +1 -1
  128. package/dist/node_modules/@apollo/client/link/core/ApolloLink.js +7 -8
  129. package/dist/node_modules/@apollo/client/link/core/ApolloLink.js.map +1 -1
  130. package/dist/node_modules/@apollo/client/link/subscriptions/index.js +9 -10
  131. package/dist/node_modules/@apollo/client/link/subscriptions/index.js.map +1 -1
  132. package/dist/node_modules/@apollo/client/link/utils/createOperation.js +5 -6
  133. package/dist/node_modules/@apollo/client/link/utils/createOperation.js.map +1 -1
  134. package/dist/node_modules/@apollo/client/utilities/caching/sizes.js +0 -1
  135. package/dist/node_modules/@apollo/client/utilities/caching/sizes.js.map +1 -1
  136. package/dist/node_modules/@apollo/client/utilities/graphql/print.js +4 -5
  137. package/dist/node_modules/@apollo/client/utilities/graphql/print.js.map +1 -1
  138. package/dist/node_modules/@apollo/client/utilities/internal/caches.js +1 -2
  139. package/dist/node_modules/@apollo/client/utilities/internal/caches.js.map +1 -1
  140. package/dist/node_modules/@apollo/client/utilities/internal/checkDocument.js +1 -2
  141. package/dist/node_modules/@apollo/client/utilities/internal/checkDocument.js.map +1 -1
  142. package/dist/node_modules/@apollo/client/utilities/internal/getMainDefinition.js +2 -3
  143. package/dist/node_modules/@apollo/client/utilities/internal/getMainDefinition.js.map +1 -1
  144. package/dist/node_modules/@apollo/client/utilities/internal/getMemoryInternals.js +1 -2
  145. package/dist/node_modules/@apollo/client/utilities/internal/getMemoryInternals.js.map +1 -1
  146. package/dist/node_modules/@apollo/client/utilities/internal/getOperationDefinition.js +1 -2
  147. package/dist/node_modules/@apollo/client/utilities/internal/getOperationDefinition.js.map +1 -1
  148. package/dist/node_modules/@apollo/client/utilities/internal/getOperationName.js +1 -2
  149. package/dist/node_modules/@apollo/client/utilities/internal/getOperationName.js.map +1 -1
  150. package/dist/node_modules/@apollo/client/utilities/internal/globals/global.js +1 -2
  151. package/dist/node_modules/@apollo/client/utilities/internal/globals/global.js.map +1 -1
  152. package/dist/node_modules/@apollo/client/utilities/internal/globals/maybe.js +1 -2
  153. package/dist/node_modules/@apollo/client/utilities/internal/globals/maybe.js.map +1 -1
  154. package/dist/node_modules/@apollo/client/utilities/internal/isNonNullObject.js +1 -2
  155. package/dist/node_modules/@apollo/client/utilities/internal/isNonNullObject.js.map +1 -1
  156. package/dist/node_modules/@apollo/client/utilities/internal/makeUniqueId.js +1 -2
  157. package/dist/node_modules/@apollo/client/utilities/internal/makeUniqueId.js.map +1 -1
  158. package/dist/node_modules/@apollo/client/utilities/internal/memoize.js +1 -2
  159. package/dist/node_modules/@apollo/client/utilities/internal/memoize.js.map +1 -1
  160. package/dist/node_modules/@apollo/client/utilities/internal/stringifyForDisplay.js +1 -2
  161. package/dist/node_modules/@apollo/client/utilities/internal/stringifyForDisplay.js.map +1 -1
  162. package/dist/node_modules/@apollo/client/utilities/invariant/index.js +2 -3
  163. package/dist/node_modules/@apollo/client/utilities/invariant/index.js.map +1 -1
  164. package/dist/node_modules/@apollo/client/version.js +2 -3
  165. package/dist/node_modules/@apollo/client/version.js.map +1 -1
  166. package/dist/node_modules/@wry/caches/lib/weak.js +1 -2
  167. package/dist/node_modules/@wry/caches/lib/weak.js.map +1 -1
  168. package/dist/node_modules/@wry/trie/lib/index.js +2 -3
  169. package/dist/node_modules/@wry/trie/lib/index.js.map +1 -1
  170. package/dist/node_modules/graphql-ws/dist/client.js +76 -69
  171. package/dist/node_modules/graphql-ws/dist/client.js.map +1 -1
  172. package/dist/node_modules/graphql-ws/dist/common-CGW11Fyb.js +2 -3
  173. package/dist/node_modules/graphql-ws/dist/common-CGW11Fyb.js.map +1 -1
  174. package/dist/node_modules/rxjs/dist/esm5/internal/NotificationFactories.js +2 -3
  175. package/dist/node_modules/rxjs/dist/esm5/internal/NotificationFactories.js.map +1 -1
  176. package/dist/node_modules/rxjs/dist/esm5/internal/Observable.js +41 -42
  177. package/dist/node_modules/rxjs/dist/esm5/internal/Observable.js.map +1 -1
  178. package/dist/node_modules/rxjs/dist/esm5/internal/Subscriber.js +14 -15
  179. package/dist/node_modules/rxjs/dist/esm5/internal/Subscriber.js.map +1 -1
  180. package/dist/node_modules/rxjs/dist/esm5/internal/Subscription.js +21 -18
  181. package/dist/node_modules/rxjs/dist/esm5/internal/Subscription.js.map +1 -1
  182. package/dist/node_modules/rxjs/dist/esm5/internal/config.js +1 -2
  183. package/dist/node_modules/rxjs/dist/esm5/internal/config.js.map +1 -1
  184. package/dist/node_modules/rxjs/dist/esm5/internal/observable/empty.js +1 -2
  185. package/dist/node_modules/rxjs/dist/esm5/internal/observable/empty.js.map +1 -1
  186. package/dist/node_modules/rxjs/dist/esm5/internal/scheduler/timeoutProvider.js +2 -3
  187. package/dist/node_modules/rxjs/dist/esm5/internal/scheduler/timeoutProvider.js.map +1 -1
  188. package/dist/node_modules/rxjs/dist/esm5/internal/symbol/observable.js +1 -2
  189. package/dist/node_modules/rxjs/dist/esm5/internal/symbol/observable.js.map +1 -1
  190. package/dist/node_modules/rxjs/dist/esm5/internal/util/UnsubscriptionError.js +1 -2
  191. package/dist/node_modules/rxjs/dist/esm5/internal/util/UnsubscriptionError.js.map +1 -1
  192. package/dist/node_modules/rxjs/dist/esm5/internal/util/arrRemove.js +1 -2
  193. package/dist/node_modules/rxjs/dist/esm5/internal/util/arrRemove.js.map +1 -1
  194. package/dist/node_modules/rxjs/dist/esm5/internal/util/createErrorClass.js +1 -2
  195. package/dist/node_modules/rxjs/dist/esm5/internal/util/createErrorClass.js.map +1 -1
  196. package/dist/node_modules/rxjs/dist/esm5/internal/util/errorContext.js +1 -2
  197. package/dist/node_modules/rxjs/dist/esm5/internal/util/errorContext.js.map +1 -1
  198. package/dist/node_modules/rxjs/dist/esm5/internal/util/identity.js +1 -2
  199. package/dist/node_modules/rxjs/dist/esm5/internal/util/identity.js.map +1 -1
  200. package/dist/node_modules/rxjs/dist/esm5/internal/util/isFunction.js +1 -2
  201. package/dist/node_modules/rxjs/dist/esm5/internal/util/isFunction.js.map +1 -1
  202. package/dist/node_modules/rxjs/dist/esm5/internal/util/noop.js +1 -2
  203. package/dist/node_modules/rxjs/dist/esm5/internal/util/noop.js.map +1 -1
  204. package/dist/node_modules/rxjs/dist/esm5/internal/util/pipe.js +1 -2
  205. package/dist/node_modules/rxjs/dist/esm5/internal/util/pipe.js.map +1 -1
  206. package/dist/node_modules/rxjs/dist/esm5/internal/util/reportUnhandledError.js +1 -2
  207. package/dist/node_modules/rxjs/dist/esm5/internal/util/reportUnhandledError.js.map +1 -1
  208. package/dist/node_modules/{rxjs/node_modules/tslib → tslib}/tslib.es6.js +1 -2
  209. package/dist/node_modules/tslib/tslib.es6.js.map +1 -0
  210. package/dist/pages/CreateNotificationPage.d.ts +5 -0
  211. package/dist/pages/CreateNotificationPage.js +591 -573
  212. package/dist/pages/CreateNotificationPage.js.map +1 -1
  213. package/dist/pages/NotificationCenterPage.d.ts +8 -0
  214. package/dist/pages/NotificationCenterPage.js +87 -83
  215. package/dist/pages/NotificationCenterPage.js.map +1 -1
  216. package/dist/pages/NotificationHistoryAdminPage.d.ts +2 -0
  217. package/dist/pages/NotificationHistoryAdminPage.js +7 -8
  218. package/dist/pages/NotificationHistoryAdminPage.js.map +1 -1
  219. package/dist/pages/NotificationHistoryPage.d.ts +6 -0
  220. package/dist/pages/NotificationHistoryPage.js +59 -55
  221. package/dist/pages/NotificationHistoryPage.js.map +1 -1
  222. package/dist/pages/NotificationLandingPage.d.ts +10 -0
  223. package/dist/pages/NotificationLandingPage.js +5 -6
  224. package/dist/pages/NotificationLandingPage.js.map +1 -1
  225. package/dist/pages/NotificationPreferencesPage.d.ts +5 -0
  226. package/dist/pages/NotificationPreferencesPage.js +97 -159
  227. package/dist/pages/NotificationPreferencesPage.js.map +1 -1
  228. package/dist/pages/NotificationTemplatesPage.d.ts +7 -0
  229. package/dist/pages/NotificationTemplatesPage.js +192 -172
  230. package/dist/pages/NotificationTemplatesPage.js.map +1 -1
  231. package/dist/pages/NotificationTopicsPage.d.ts +1 -0
  232. package/dist/pages/NotificationTopicsPage.js +126 -112
  233. package/dist/pages/NotificationTopicsPage.js.map +1 -1
  234. package/dist/pages/TemplateEditorPage.d.ts +12 -0
  235. package/dist/pages/TemplateEditorPage.js +381 -341
  236. package/dist/pages/TemplateEditorPage.js.map +1 -1
  237. package/dist/providers/NotificationProvider.d.ts +11 -0
  238. package/dist/providers/NotificationProvider.js +7 -7
  239. package/dist/providers/NotificationProvider.js.map +1 -1
  240. package/dist/shared/hooks/useTr.d.ts +13 -0
  241. package/dist/shared/hooks/useTr.js +1 -2
  242. package/dist/shared/hooks/useTr.js.map +1 -1
  243. package/dist/store/notificationStore.d.ts +30 -0
  244. package/dist/store/notificationStore.js +1 -2
  245. package/dist/store/notificationStore.js.map +1 -1
  246. package/dist/test/happydom.d.ts +1 -0
  247. package/dist/translations/en.d.ts +468 -0
  248. package/dist/types/index.d.ts +257 -0
  249. package/dist/utils/inAppNavigation.d.ts +37 -0
  250. package/dist/utils/inAppNavigation.js +2 -3
  251. package/dist/utils/inAppNavigation.js.map +1 -1
  252. package/dist/utils/index.d.ts +68 -0
  253. package/dist/utils/index.js +1 -2
  254. package/dist/utils/index.js.map +1 -1
  255. package/dist/utils/nativeBridge.d.ts +2 -0
  256. package/dist/utils/nativeBridge.js +1 -2
  257. package/dist/utils/notificationHistoryExport.d.ts +12 -0
  258. package/dist/utils/notificationHistoryExport.js +1 -2
  259. package/dist/utils/notificationHistoryExport.js.map +1 -1
  260. package/package.json +67 -49
  261. package/dist/node_modules/rxjs/node_modules/tslib/tslib.es6.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"useUserSearch.js","names":[],"sources":["../../src/hooks/useUserSearch.ts"],"sourcesContent":["import { useState, useEffect, useCallback, useRef } from 'react';\nimport { useNotification } from '../providers/NotificationProvider';\nimport { getGlobalNotificationClient } from '../graphql/global-client';\nimport * as NotificationOps from '../generated/global-operations';\nimport type { SearchUsersQuery } from '../generated/global-operations';\n\nexport interface User {\n id: string;\n name: string;\n email: string;\n phoneNumber?: string;\n role?: string;\n status?: string;\n username?: string;\n}\n\nexport interface UserSearchFilter {\n search?: string;\n role?: string;\n status?: string;\n}\n\n/**\n * Hook for searching users via the global auth service.\n * Uses the Apollo client from notification context (not raw fetch).\n */\nexport function useUserSearch() {\n const { authToken, apiGatewayUrl } = useNotification();\n const [isLoading, setIsLoading] = useState(false);\n const [error, setError] = useState<string | null>(null);\n const [results, setResults] = useState<User[]>([]);\n const debounceTimer = useRef<ReturnType<typeof setTimeout> | null>(null);\n\n const getClient = useCallback(() => {\n return getGlobalNotificationClient(apiGatewayUrl ?? undefined, authToken ?? undefined);\n }, [apiGatewayUrl, authToken]);\n\n // Debounced search function\n const runQuery = useCallback(\n async (filter: UserSearchFilter, limit = 10, offset = 0): Promise<User[]> => {\n const client = getClient();\n const result = await client.query<SearchUsersQuery>({\n query: NotificationOps.SearchUsersDocument,\n variables: {\n filter: {\n ...(filter.search ? { search: filter.search.trim() } : {}),\n ...(filter.role ? { role: filter.role } : {}),\n ...(filter.status ? { status: filter.status } : {}),\n },\n pagination: { limit, offset },\n },\n fetchPolicy: 'network-only',\n });\n\n return (result.data?.users?.users || []).map((u) => ({\n id: u.id,\n name: u.name || '',\n email: u.email,\n phoneNumber: u.phoneNumber ?? undefined,\n role: (u as { role?: string }).role,\n status: (u as { status?: string }).status,\n username: u.username,\n }));\n },\n [getClient]\n );\n\n const searchUsers = useCallback(\n (query: string, extraFilter?: Omit<UserSearchFilter, 'search'>) => {\n if (debounceTimer.current) {\n clearTimeout(debounceTimer.current);\n }\n\n if (!query.trim() && !extraFilter?.role && !extraFilter?.status) {\n setResults([]);\n return;\n }\n\n debounceTimer.current = setTimeout(async () => {\n setIsLoading(true);\n setError(null);\n\n try {\n const users = await runQuery({ search: query.trim(), ...extraFilter }, 20, 0);\n setResults(users);\n } catch (err) {\n console.error('User search error:', err);\n setError(err instanceof Error ? err.message : 'Failed to search users');\n setResults([]);\n } finally {\n setIsLoading(false);\n }\n }, 300);\n },\n [runQuery]\n );\n\n const fetchAllUsers = useCallback(\n async (filter: UserSearchFilter): Promise<User[]> => {\n setIsLoading(true);\n setError(null);\n\n try {\n const pageSize = 100;\n let offset = 0;\n let hasMore = true;\n const allUsers: User[] = [];\n\n while (hasMore) {\n const page = await runQuery(filter, pageSize, offset);\n allUsers.push(...page);\n hasMore = page.length === pageSize;\n offset += pageSize;\n }\n\n return allUsers;\n } catch (err) {\n console.error('Fetch all users error:', err);\n const message = err instanceof Error ? err.message : 'Failed to fetch users';\n setError(message);\n return [];\n } finally {\n setIsLoading(false);\n }\n },\n [runQuery]\n );\n\n // Clear timer on unmount\n useEffect(() => {\n return () => {\n if (debounceTimer.current) {\n clearTimeout(debounceTimer.current);\n }\n };\n }, []);\n\n return {\n searchUsers,\n fetchAllUsers,\n results,\n isLoading,\n error,\n clearResults: () => setResults([]),\n };\n}\n"],"mappings":";;;;;AA0BA,SAAgB,IAAgB;CAC9B,IAAM,EAAE,cAAW,qBAAkB,GAAiB,EAChD,CAAC,GAAW,KAAgB,EAAS,GAAM,EAC3C,CAAC,GAAO,KAAY,EAAwB,KAAK,EACjD,CAAC,GAAS,KAAc,EAAiB,EAAE,CAAC,EAC5C,IAAgB,EAA6C,KAAK,EAElE,IAAY,QACT,EAA4B,KAAiB,KAAA,GAAW,KAAa,KAAA,EAAU,EACrF,CAAC,GAAe,EAAU,CAAC,EAGxB,IAAW,EACf,OAAO,GAA0B,IAAQ,IAAI,IAAS,QAErC,MADA,GAAW,CACE,MAAwB;EAClD,OAAO;EACP,WAAW;GACT,QAAQ;IACN,GAAI,EAAO,SAAS,EAAE,QAAQ,EAAO,OAAO,MAAM,EAAE,GAAG,EAAE;IACzD,GAAI,EAAO,OAAO,EAAE,MAAM,EAAO,MAAM,GAAG,EAAE;IAC5C,GAAI,EAAO,SAAS,EAAE,QAAQ,EAAO,QAAQ,GAAG,EAAE;IACnD;GACD,YAAY;IAAE;IAAO;IAAQ;GAC9B;EACD,aAAa;EACd,CAAC,EAEa,MAAM,OAAO,SAAS,EAAE,EAAE,KAAK,OAAO;EACnD,IAAI,EAAE;EACN,MAAM,EAAE,QAAQ;EAChB,OAAO,EAAE;EACT,aAAa,EAAE,eAAe,KAAA;EAC9B,MAAO,EAAwB;EAC/B,QAAS,EAA0B;EACnC,UAAU,EAAE;EACb,EAAE,EAEL,CAAC,EAAU,CACZ,EAEK,IAAc,GACjB,GAAe,MAAmD;AAKjE,MAJI,EAAc,WAChB,aAAa,EAAc,QAAQ,EAGjC,CAAC,EAAM,MAAM,IAAI,CAAC,GAAa,QAAQ,CAAC,GAAa,QAAQ;AAC/D,KAAW,EAAE,CAAC;AACd;;AAGF,IAAc,UAAU,WAAW,YAAY;AAE7C,GADA,EAAa,GAAK,EAClB,EAAS,KAAK;AAEd,OAAI;AAEF,MADc,MAAM,EAAS;KAAE,QAAQ,EAAM,MAAM;KAAE,GAAG;KAAa,EAAE,IAAI,EAAE,CAC5D;YACV,GAAK;AAGZ,IAFA,QAAQ,MAAM,sBAAsB,EAAI,EACxC,EAAS,aAAe,QAAQ,EAAI,UAAU,yBAAyB,EACvE,EAAW,EAAE,CAAC;aACN;AACR,MAAa,GAAM;;KAEpB,IAAI;IAET,CAAC,EAAS,CACX,EAEK,IAAgB,EACpB,OAAO,MAA8C;AAEnD,EADA,EAAa,GAAK,EAClB,EAAS,KAAK;AAEd,MAAI;GACF,IACI,IAAS,GACT,IAAU,IACR,IAAmB,EAAE;AAE3B,UAAO,IAAS;IACd,IAAM,IAAO,MAAM,EAAS,GAAQ,KAAU,EAAO;AAGrD,IAFA,EAAS,KAAK,GAAG,EAAK,EACtB,IAAU,EAAK,WAAW,KAC1B,KAAU;;AAGZ,UAAO;WACA,GAAK;AAIZ,UAHA,QAAQ,MAAM,0BAA0B,EAAI,EAE5C,EADgB,aAAe,QAAQ,EAAI,UAAU,wBACpC,EACV,EAAE;YACD;AACR,KAAa,GAAM;;IAGvB,CAAC,EAAS,CACX;AAWD,QARA,cACe;AACX,EAAI,EAAc,WAChB,aAAa,EAAc,QAAQ;IAGtC,EAAE,CAAC,EAEC;EACL;EACA;EACA;EACA;EACA;EACA,oBAAoB,EAAW,EAAE,CAAC;EACnC"}
1
+ {"version":3,"file":"useUserSearch.js","names":["NotificationOps.SearchUsersDocument","useUserSearch","useNotification","isLoading","setIsLoading","useState","error","setError","results","setResults","debounceTimer","useRef","getClient","useCallback","getGlobalNotificationClient","apiGatewayUrl","authToken","runQuery","SearchUsersDocument","filter","u","searchUsers","query","extraFilter","users","err","fetchAllUsers","offset","hasMore","allUsers","page","message","useEffect"],"sources":["../../src/hooks/useUserSearch.ts"],"sourcesContent":["import { useState, useEffect, useCallback, useRef } from 'react';\nimport { useNotification } from '../providers/NotificationProvider';\nimport { getGlobalNotificationClient } from '../graphql/global-client';\nimport * as NotificationOps from '../generated/global-operations';\nimport type { SearchUsersQuery } from '../generated/global-operations';\n\nexport interface User {\n id: string;\n name: string;\n email: string;\n phoneNumber?: string;\n role?: string;\n status?: string;\n username?: string;\n}\n\nexport interface UserSearchFilter {\n search?: string;\n role?: string;\n status?: string;\n}\n\n/**\n * Hook for searching users via the global auth service.\n * Uses the Apollo client from notification context (not raw fetch).\n */\nexport function useUserSearch() {\n const { authToken, apiGatewayUrl } = useNotification();\n const [isLoading, setIsLoading] = useState(false);\n const [error, setError] = useState<string | null>(null);\n const [results, setResults] = useState<User[]>([]);\n const debounceTimer = useRef<ReturnType<typeof setTimeout> | null>(null);\n\n const getClient = useCallback(() => {\n return getGlobalNotificationClient(apiGatewayUrl ?? undefined, authToken ?? undefined);\n }, [apiGatewayUrl, authToken]);\n\n // Debounced search function\n const runQuery = useCallback(\n async (filter: UserSearchFilter, limit = 10, offset = 0): Promise<User[]> => {\n const client = getClient();\n const result = await client.query<SearchUsersQuery>({\n query: NotificationOps.SearchUsersDocument,\n variables: {\n filter: {\n ...(filter.search ? { search: filter.search.trim() } : {}),\n ...(filter.role ? { role: filter.role } : {}),\n ...(filter.status ? { status: filter.status } : {}),\n },\n pagination: { limit, offset },\n },\n fetchPolicy: 'network-only',\n });\n\n return (result.data?.users?.users || []).map((u) => ({\n id: u.id,\n name: u.name || '',\n email: u.email,\n phoneNumber: u.phoneNumber ?? undefined,\n role: (u as { role?: string }).role,\n status: (u as { status?: string }).status,\n username: u.username,\n }));\n },\n [getClient]\n );\n\n const searchUsers = useCallback(\n (query: string, extraFilter?: Omit<UserSearchFilter, 'search'>) => {\n if (debounceTimer.current) {\n clearTimeout(debounceTimer.current);\n }\n\n if (!query.trim() && !extraFilter?.role && !extraFilter?.status) {\n setResults([]);\n return;\n }\n\n debounceTimer.current = setTimeout(async () => {\n setIsLoading(true);\n setError(null);\n\n try {\n const users = await runQuery({ search: query.trim(), ...extraFilter }, 20, 0);\n setResults(users);\n } catch (err) {\n console.error('User search error:', err);\n setError(err instanceof Error ? err.message : 'Failed to search users');\n setResults([]);\n } finally {\n setIsLoading(false);\n }\n }, 300);\n },\n [runQuery]\n );\n\n const fetchAllUsers = useCallback(\n async (filter: UserSearchFilter): Promise<User[]> => {\n setIsLoading(true);\n setError(null);\n\n try {\n const pageSize = 100;\n let offset = 0;\n let hasMore = true;\n const allUsers: User[] = [];\n\n while (hasMore) {\n const page = await runQuery(filter, pageSize, offset);\n allUsers.push(...page);\n hasMore = page.length === pageSize;\n offset += pageSize;\n }\n\n return allUsers;\n } catch (err) {\n console.error('Fetch all users error:', err);\n const message = err instanceof Error ? err.message : 'Failed to fetch users';\n setError(message);\n return [];\n } finally {\n setIsLoading(false);\n }\n },\n [runQuery]\n );\n\n // Clear timer on unmount\n useEffect(() => {\n return () => {\n if (debounceTimer.current) {\n clearTimeout(debounceTimer.current);\n }\n };\n }, []);\n\n return {\n searchUsers,\n fetchAllUsers,\n results,\n isLoading,\n error,\n clearResults: () => setResults([]),\n };\n}\n"],"mappings":";;;;;AA0BA,SAAgBC,IAAgB;CAC9B,IAAM,EAAE,cAAW,qBAAkBC,EAAgB,GAC/C,CAACC,GAAWC,KAAgBC,EAAS,EAAK,GAC1C,CAACC,GAAOC,KAAYF,EAAwB,IAAI,GAChD,CAACG,GAASC,KAAcJ,EAAiB,CAAC,CAAC,GAC3CK,IAAgBC,EAA6C,IAAI,GAEjEC,IAAYC,QACTC,EAA4BC,KAAiB,KAAA,GAAWC,KAAa,KAAA,CAAS,GACpF,CAACD,GAAeC,CAAS,CAAC,GAGvBC,IAAWJ,EACf,OAAO,GAA0B,IAAQ,IAAI,IAAS,QAe5C,MAdOD,EACM,CAAA,CAAO,MAAwB;EAClD,OAAOZ;EACP,WAAW;GACT,QAAQ;IACN,GAAImB,EAAO,SAAS,EAAE,QAAQA,EAAO,OAAO,KAAK,EAAE,IAAI,CAAC;IACxD,GAAIA,EAAO,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E,EAAS,KAAK,GAAGC,CAAI,GACrB,IAAUA,EAAK,WAAW,KAC1B,KAAU;GACZ;GAEA,OAAOD;EACT,SAASJ,GAAK;GACZ,QAAQ,MAAM,0BAA0BA,CAAG;GAC3C,IAAMM,IAAUN,aAAe,QAAQA,EAAI,UAAU;GAErD,OADAlB,EAASwB,CAAO,GACT,CAAC;EACV,UAAU;GACR,EAAa,EAAK;EACpB;CACF,GACA,CAACd,CAAQ,CACX;CAWA,OARAe,cACe;EACX,AAAItB,EAAc,WAChB,aAAaA,EAAc,OAAO;CAEtC,GACC,CAAC,CAAC,GAEE;EACL;EACA;EACA;EACA;EACA;EACA,oBAAoBD,EAAW,CAAC,CAAC;CACnC;AACF"}
@@ -0,0 +1,36 @@
1
+ /**
2
+ * Notification Microfrontend
3
+ *
4
+ * Provides a UI for managing multi-channel notifications,
5
+ * notification history, and notification templates.
6
+ * This is a GLOBAL module that integrates with the global API gateway (gw-global.local.burdenoff.com).
7
+ *
8
+ * @example
9
+ * ```tsx
10
+ * import { NotificationRoot, type NotificationRootProps } from '@burdenoff/micro-fe/notification';
11
+ *
12
+ * function App() {
13
+ * const props: NotificationRootProps = {
14
+ * basePath: '/notifications',
15
+ * navigate: (path) => router.push(path),
16
+ * currentUser: { id: '1', email: 'user@example.com' },
17
+ * workspaceId: 'ws-123',
18
+ * apiGatewayUrl: 'https://gw-global.local.burdenoff.com/global/graphql',
19
+ * authToken: 'token',
20
+ * registerNavItems: (items) => { return () => {}; },
21
+ * onNotificationClick: (notification) => console.log('Clicked:', notification),
22
+ * };
23
+ *
24
+ * return <NotificationRoot {...props} />;
25
+ * }
26
+ * ```
27
+ *
28
+ * @module @burdenoff/micro-fe/notification
29
+ */
30
+ export { NotificationRoot } from './NotificationRoot';
31
+ export { UserNotificationRoot } from './UserNotificationRoot';
32
+ export { AdminNotificationRoot } from './AdminNotificationRoot';
33
+ export type { NotificationRootProps, NavItem, FooterItem, Notification, NotificationType, NotificationPriority, NotificationStatus, NotificationChannel, NotificationTemplate, NotificationFilter, } from './types';
34
+ export { useNotifications, useNotificationStore, useNotification } from './hooks';
35
+ export { NotificationBell, NotificationCard, NotificationPanel } from './components';
36
+ export { formatRelativeTime, getPriorityColor, getPriorityIcon, getNotificationTypeLabel, getNotificationTypeIcon, filterNotifications, sortNotificationsByDate, groupNotificationsByDate, truncateText, validateTemplateVariables, substituteTemplateVariables, } from './utils';
package/dist/index.js CHANGED
@@ -1,13 +1,13 @@
1
1
  import { useNotification as e } from "./providers/NotificationProvider.js";
2
2
  import { useNotificationStore as t } from "./store/notificationStore.js";
3
3
  import { useNotifications as n } from "./hooks/useNotifications.js";
4
- import { filterNotifications as r, formatRelativeTime as i, getNotificationTypeIcon as a, getNotificationTypeLabel as o, getPriorityColor as s, getPriorityIcon as c, groupNotificationsByDate as l, sortNotificationsByDate as u, substituteTemplateVariables as d, truncateText as f, validateTemplateVariables as p } from "./utils/index.js";
4
+ import { NotificationRoot as r } from "./NotificationRoot.js";
5
+ import { UserNotificationRoot as i } from "./UserNotificationRoot.js";
6
+ import { NotificationCard as a } from "./components/NotificationCard.js";
7
+ import { AdminNotificationRoot as o } from "./AdminNotificationRoot.js";
5
8
  import "./hooks/index.js";
6
- import { NotificationCard as m } from "./components/NotificationCard.js";
7
- import { NotificationRoot as h } from "./NotificationRoot.js";
8
- import { UserNotificationRoot as g } from "./UserNotificationRoot.js";
9
- import { AdminNotificationRoot as _ } from "./AdminNotificationRoot.js";
10
- import { NotificationBell as v } from "./components/NotificationBell.js";
11
- import { NotificationPanel as y } from "./components/NotificationPanel.js";
12
9
  import "./components/index.js";
13
- export { _ as AdminNotificationRoot, v as NotificationBell, m as NotificationCard, y as NotificationPanel, h as NotificationRoot, g as UserNotificationRoot, r as filterNotifications, i as formatRelativeTime, a as getNotificationTypeIcon, o as getNotificationTypeLabel, s as getPriorityColor, c as getPriorityIcon, l as groupNotificationsByDate, u as sortNotificationsByDate, d as substituteTemplateVariables, f as truncateText, e as useNotification, t as useNotificationStore, n as useNotifications, p as validateTemplateVariables };
10
+ import { NotificationBell as s } from "./components/NotificationBell.js";
11
+ import { NotificationPanel as c } from "./components/NotificationPanel.js";
12
+ import { filterNotifications as l, formatRelativeTime as u, getNotificationTypeIcon as d, getNotificationTypeLabel as f, getPriorityColor as p, getPriorityIcon as m, groupNotificationsByDate as h, sortNotificationsByDate as g, substituteTemplateVariables as _, truncateText as v, validateTemplateVariables as y } from "./utils/index.js";
13
+ export { o as AdminNotificationRoot, s as NotificationBell, a as NotificationCard, c as NotificationPanel, r as NotificationRoot, i as UserNotificationRoot, l as filterNotifications, u as formatRelativeTime, d as getNotificationTypeIcon, f as getNotificationTypeLabel, p as getPriorityColor, m as getPriorityIcon, h as groupNotificationsByDate, g as sortNotificationsByDate, _ as substituteTemplateVariables, v as truncateText, e as useNotification, t as useNotificationStore, n as useNotifications, y as validateTemplateVariables };
@@ -0,0 +1,14 @@
1
+ import { ReactNode } from 'react';
2
+ import { AdminToolId } from './useAdminTools';
3
+ /**
4
+ * A Navigation v2 admin page (BOFF-11872): "‹ Notifications" above it, and a
5
+ * route-level gate (§8 item 1). Someone without the permission sees "You need
6
+ * access" instead of loading a page they cannot use; the page's own in-page
7
+ * checks stay as they are.
8
+ */
9
+ export declare function AdminPageV2({ tool, children, back, }: {
10
+ tool: AdminToolId;
11
+ children: ReactNode;
12
+ /** False for a page with its own back button (Send). */
13
+ back?: boolean;
14
+ }): import('react').JSX.Element;
@@ -0,0 +1,51 @@
1
+ import { useTr as e } from "../shared/hooks/useTr.js";
2
+ import { BackToNotifications as t } from "./BackToNotifications.js";
3
+ import { holdsAdminToolPermission as n } from "./useAdminTools.js";
4
+ import { usePermissions as r } from "@burdenoff/fe-libs/shared/providers/shell";
5
+ import { jsx as i, jsxs as a } from "react/jsx-runtime";
6
+ import { AccessGate as o } from "@burdenoff/fe-libs/ui";
7
+ // src/navigation-v2/AdminPageV2.tsx
8
+ function s() {
9
+ return /* @__PURE__ */ i("div", {
10
+ className: "flex h-64 items-center justify-center",
11
+ children: /* @__PURE__ */ i("div", { className: "h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent" })
12
+ });
13
+ }
14
+ var c = {
15
+ send: {
16
+ key: "notifications.v2.admin.send",
17
+ fallback: "Send"
18
+ },
19
+ deliveryLog: {
20
+ key: "notifications.v2.admin.deliveryLog",
21
+ fallback: "Delivery log"
22
+ },
23
+ templates: {
24
+ key: "notifications.v2.admin.templates",
25
+ fallback: "Templates"
26
+ },
27
+ topics: {
28
+ key: "notifications.v2.admin.topics",
29
+ fallback: "Topics"
30
+ }
31
+ };
32
+ function l({ tool: l, children: u, back: d = !0 }) {
33
+ let f = e(), { hasPermission: p, isLoading: m } = r(), h = f(c[l].key, c[l].fallback), g = u;
34
+ return m ? g = /* @__PURE__ */ i(s, {}) : n(l, p) || (g = /* @__PURE__ */ i(o, {
35
+ className: "py-16",
36
+ message: f("notifications.v2.needAccess", "You need access to {{page}}", { page: h }),
37
+ granterHint: f("notifications.v2.needAccessHint", "Ask a workspace admin to give your role this permission.")
38
+ })), /* @__PURE__ */ a("div", {
39
+ className: "flex h-full flex-col",
40
+ children: [d && /* @__PURE__ */ i("div", {
41
+ className: "px-3 pt-2 sm:px-4",
42
+ children: /* @__PURE__ */ i(t, {})
43
+ }), /* @__PURE__ */ i("div", {
44
+ className: "min-h-0 flex-1",
45
+ children: g
46
+ })]
47
+ });
48
+ }
49
+ export { l as AdminPageV2 };
50
+
51
+ //# sourceMappingURL=AdminPageV2.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AdminPageV2.js","names":["PageLoader","PAGE_NAMES","AdminPageV2","tr","useTr","usePermissions","name","tool","body","children","isLoading","holdsAdminToolPermission","hasPermission","AccessGate","back","BackToNotifications"],"sources":["../../src/navigation-v2/AdminPageV2.tsx"],"sourcesContent":["import type { ReactNode } from 'react';\nimport { usePermissions } from '@burdenoff/fe-libs/shared/providers/shell';\nimport { AccessGate } from '@burdenoff/fe-libs/ui';\nimport { useTr } from '../shared/hooks/useTr';\nimport { BackToNotifications } from './BackToNotifications';\nimport { holdsAdminToolPermission, type AdminToolId } from './useAdminTools';\n\nfunction PageLoader() {\n return (\n <div className=\"flex h-64 items-center justify-center\">\n <div className=\"h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent\" />\n </div>\n );\n}\n\nconst PAGE_NAMES: Record<AdminToolId, { key: string; fallback: string }> = {\n send: { key: 'notifications.v2.admin.send', fallback: 'Send' },\n deliveryLog: { key: 'notifications.v2.admin.deliveryLog', fallback: 'Delivery log' },\n templates: { key: 'notifications.v2.admin.templates', fallback: 'Templates' },\n topics: { key: 'notifications.v2.admin.topics', fallback: 'Topics' },\n};\n\n/**\n * A Navigation v2 admin page (BOFF-11872): \"‹ Notifications\" above it, and a\n * route-level gate (§8 item 1). Someone without the permission sees \"You need\n * access\" instead of loading a page they cannot use; the page's own in-page\n * checks stay as they are.\n */\nexport function AdminPageV2({\n tool,\n children,\n back = true,\n}: {\n tool: AdminToolId;\n children: ReactNode;\n /** False for a page with its own back button (Send). */\n back?: boolean;\n}) {\n const tr = useTr();\n const { hasPermission, isLoading } = usePermissions();\n const name = tr(PAGE_NAMES[tool].key, PAGE_NAMES[tool].fallback);\n let body: ReactNode = children;\n if (isLoading) body = <PageLoader />;\n else if (!holdsAdminToolPermission(tool, hasPermission)) {\n body = (\n <AccessGate\n className=\"py-16\"\n message={tr('notifications.v2.needAccess', 'You need access to {{page}}', { page: name })}\n granterHint={tr(\n 'notifications.v2.needAccessHint',\n 'Ask a workspace admin to give your role this permission.'\n )}\n />\n );\n }\n return (\n <div className=\"flex h-full flex-col\">\n {back && (\n <div className=\"px-3 pt-2 sm:px-4\">\n <BackToNotifications />\n </div>\n )}\n <div className=\"min-h-0 flex-1\">{body}</div>\n </div>\n );\n}\n"],"mappings":";;;;;;;AAOA,SAASA,IAAa;CACpB,OACE,kBAAC,OAAD;EAAK,WAAU;EACb,UAAA,kBAAC,OAAD,EAAK,WAAU,iFAAkF,CAAA;CAC9F,CAAA;AAET;AAEA,IAAMC,IAAqE;CACzE,MAAM;EAAE,KAAK;EAA+B,UAAU;CAAO;CAC7D,aAAa;EAAE,KAAK;EAAsC,UAAU;CAAe;CACnF,WAAW;EAAE,KAAK;EAAoC,UAAU;CAAY;CAC5E,QAAQ;EAAE,KAAK;EAAiC,UAAU;CAAS;AACrE;AAQA,SAAgBC,EAAY,EAC1B,SACA,aACA,UAAO,MAMN;CACD,IAAMC,IAAKC,EAAM,GACX,EAAE,kBAAe,iBAAcC,EAAe,GAC9CC,IAAOH,EAAGF,EAAWM,EAAK,CAAC,KAAKN,EAAWM,EAAK,CAAC,QAAQ,GAC3DC,IAAkBC;CActB,OAbIC,IAAW,IAAO,kBAACV,GAAD,CAAa,CAAA,IACzBW,EAAyBJ,GAAMK,CAAa,MACpD,IACE,kBAACC,GAAD;EACE,WAAU;EACV,SAASV,EAAG,+BAA+B,+BAA+B,EAAE,MAAMG,EAAK,CAAC;EACxF,aAAaH,EACX,mCACA,0DACF;CACD,CAAA,IAIH,kBAAC,OAAD;EAAK,WAAU;EAAf,UAAA,CACGW,KACC,kBAAC,OAAD;GAAK,WAAU;GACb,UAAA,kBAACC,GAAD,CAAsB,CAAA;EACnB,CAAA,GAEP,kBAAC,OAAD;GAAK,WAAU;GAAkB,UAAAP;EAAU,CAAA,CACxC;;AAET"}
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Notifications › More ▾ (BOFF-11872): Send, Delivery log, Templates and
3
+ * Topics, one click away. Renders nothing for someone who holds none of them,
4
+ * so a regular person never sees an admin tool they cannot use.
5
+ */
6
+ export declare function AdminToolsMenu(): import('react').JSX.Element | null;
@@ -0,0 +1,32 @@
1
+ import { useTr as e } from "../shared/hooks/useTr.js";
2
+ import { useAdminTools as t } from "./useAdminTools.js";
3
+ import { ChevronDown as n } from "lucide-react";
4
+ import { useNavigate as r } from "react-router";
5
+ import { jsx as i, jsxs as a } from "react/jsx-runtime";
6
+ import { Button as o, DropdownMenu as s, DropdownMenuContent as c, DropdownMenuItem as l, DropdownMenuTrigger as u } from "@burdenoff/fe-libs/ui";
7
+ // src/navigation-v2/AdminToolsMenu.tsx
8
+ function d() {
9
+ let d = e(), f = r(), { tools: p } = t();
10
+ return p.length === 0 ? null : /* @__PURE__ */ a(s, { children: [/* @__PURE__ */ i(u, {
11
+ asChild: !0,
12
+ children: /* @__PURE__ */ a(o, {
13
+ variant: "outline",
14
+ className: "gap-1",
15
+ "data-testid": "notifications-admin-more",
16
+ children: [d("notifications.v2.more", "More"), /* @__PURE__ */ i(n, {
17
+ size: 16,
18
+ "aria-hidden": "true"
19
+ })]
20
+ })
21
+ }), /* @__PURE__ */ i(c, {
22
+ align: "end",
23
+ children: p.map((e) => /* @__PURE__ */ i(l, {
24
+ "data-testid": `notifications-admin-${e.id}`,
25
+ onSelect: () => void f(e.href),
26
+ children: e.label
27
+ }, e.id))
28
+ })] });
29
+ }
30
+ export { d as AdminToolsMenu };
31
+
32
+ //# sourceMappingURL=AdminToolsMenu.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AdminToolsMenu.js","names":["AdminToolsMenu","tr","useTr","navigate","useNavigate","useAdminTools","tools","DropdownMenu","DropdownMenuTrigger","Button","ChevronDown","DropdownMenuContent","DropdownMenuItem","tool"],"sources":["../../src/navigation-v2/AdminToolsMenu.tsx"],"sourcesContent":["import { ChevronDown } from 'lucide-react';\nimport { useNavigate } from 'react-router';\nimport {\n Button,\n DropdownMenu,\n DropdownMenuContent,\n DropdownMenuItem,\n DropdownMenuTrigger,\n} from '@burdenoff/fe-libs/ui';\nimport { useTr } from '../shared/hooks/useTr';\nimport { useAdminTools } from './useAdminTools';\n\n/**\n * Notifications › More ▾ (BOFF-11872): Send, Delivery log, Templates and\n * Topics, one click away. Renders nothing for someone who holds none of them,\n * so a regular person never sees an admin tool they cannot use.\n */\nexport function AdminToolsMenu() {\n const tr = useTr();\n const navigate = useNavigate();\n const { tools } = useAdminTools();\n if (tools.length === 0) return null;\n return (\n <DropdownMenu>\n <DropdownMenuTrigger asChild>\n <Button variant=\"outline\" className=\"gap-1\" data-testid=\"notifications-admin-more\">\n {tr('notifications.v2.more', 'More')}\n <ChevronDown size={16} aria-hidden=\"true\" />\n </Button>\n </DropdownMenuTrigger>\n <DropdownMenuContent align=\"end\">\n {tools.map((tool) => (\n <DropdownMenuItem\n key={tool.id}\n data-testid={`notifications-admin-${tool.id}`}\n onSelect={() => void navigate(tool.href)}\n >\n {tool.label}\n </DropdownMenuItem>\n ))}\n </DropdownMenuContent>\n </DropdownMenu>\n );\n}\n"],"mappings":";;;;;;;AAiBA,SAAgBA,IAAiB;CAC/B,IAAMC,IAAKC,EAAM,GACXC,IAAWC,EAAY,GACvB,EAAE,aAAUC,EAAc;CAEhC,OADIC,EAAM,WAAW,IAAU,OAE7B,kBAACC,GAAD,EAAA,UAAA,CACE,kBAACC,GAAD;EAAqB,SAAA;EACnB,UAAA,kBAACC,GAAD;GAAQ,SAAQ;GAAU,WAAU;GAAQ,eAAY;GAAxD,UAAA,CACGR,EAAG,yBAAyB,MAAM,GACnC,kBAACS,GAAD;IAAa,MAAM;IAAI,eAAY;GAAQ,CAAA,CACrC;;CACW,CAAA,GACrB,kBAACC,GAAD;EAAqB,OAAM;EACxB,UAAAL,EAAM,KAAK,MACV,kBAACM,GAAD;GAEE,eAAa,uBAAuBC,EAAK;GACzC,gBAAgB,KAAKV,EAASU,EAAK,IAAI;GAEtC,UAAAA,EAAK;EACU,GALXA,EAAK,EAKM,CACnB;CACkB,CAAA,CACT,EAAA,CAAA;AAElB"}
@@ -0,0 +1,2 @@
1
+ /** "‹ Notifications": how a level-2 page leads back to the inbox. */
2
+ export declare function BackToNotifications(): import('react').JSX.Element;
@@ -0,0 +1,20 @@
1
+ import { useTr as e } from "../shared/hooks/useTr.js";
2
+ import { useNotificationPaths as t } from "./paths.js";
3
+ import { ArrowLeft as n } from "lucide-react";
4
+ import { Link as r } from "react-router";
5
+ import { jsx as i, jsxs as a } from "react/jsx-runtime";
6
+ // src/navigation-v2/BackToNotifications.tsx
7
+ function o() {
8
+ let o = e(), { inbox: s } = t();
9
+ return /* @__PURE__ */ a(r, {
10
+ to: s,
11
+ className: "inline-flex min-h-11 items-center gap-1.5 rounded-md px-2 text-sm text-text-secondary hover:text-text-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--color-focus-ring)]",
12
+ children: [/* @__PURE__ */ i(n, {
13
+ size: 16,
14
+ "aria-hidden": "true"
15
+ }), o("notifications.v2.backToNotifications", "Notifications")]
16
+ });
17
+ }
18
+ export { o as BackToNotifications };
19
+
20
+ //# sourceMappingURL=BackToNotifications.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BackToNotifications.js","names":["BackToNotifications","tr","useTr","useNotificationPaths","Link","inbox","ArrowLeft"],"sources":["../../src/navigation-v2/BackToNotifications.tsx"],"sourcesContent":["import { ArrowLeft } from 'lucide-react';\nimport { Link } from 'react-router';\nimport { useTr } from '../shared/hooks/useTr';\nimport { useNotificationPaths } from './paths';\n\n/** \"‹ Notifications\": how a level-2 page leads back to the inbox. */\nexport function BackToNotifications() {\n const tr = useTr();\n const { inbox } = useNotificationPaths();\n return (\n <Link\n to={inbox}\n className=\"inline-flex min-h-11 items-center gap-1.5 rounded-md px-2 text-sm text-text-secondary hover:text-text-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--color-focus-ring)]\"\n >\n <ArrowLeft size={16} aria-hidden=\"true\" />\n {tr('notifications.v2.backToNotifications', 'Notifications')}\n </Link>\n );\n}\n"],"mappings":";;;;;;AAMA,SAAgBA,IAAsB;CACpC,IAAMC,IAAKC,EAAM,GACX,EAAE,aAAUC,EAAqB;CACvC,OACE,kBAACC,GAAD;EACE,IAAIC;EACJ,WAAU;EAFZ,UAAA,CAIE,kBAACC,GAAD;GAAW,MAAM;GAAI,eAAY;EAAQ,CAAA,GACxCL,EAAG,wCAAwC,eAAe,CACvD;;AAEV"}
@@ -0,0 +1,25 @@
1
+ /** The search box that leads a Navigation v2 list. */
2
+ export declare function SearchField({ value, label, onChange, tour, }: {
3
+ value: string;
4
+ /** Already translated; also the placeholder. */
5
+ label: string;
6
+ onChange: (value: string) => void;
7
+ tour?: string;
8
+ }): import('react').JSX.Element;
9
+ /** A level-1 chip group ("All · Unread · Needs action"). */
10
+ export declare function ViewChips<T extends string>({ chips, value, onChange, testIdPrefix, }: {
11
+ chips: Array<{
12
+ id: T;
13
+ label: string;
14
+ }>;
15
+ value: T | null;
16
+ onChange: (id: T) => void;
17
+ testIdPrefix: string;
18
+ }): import('react').JSX.Element;
19
+ /** "More filters": opens the level-2 filter panel; a dot shows when any of them is set. */
20
+ export declare function MoreFiltersButton({ open, active, controls, onToggle, }: {
21
+ open: boolean;
22
+ active: boolean;
23
+ controls: string;
24
+ onToggle: () => void;
25
+ }): import('react').JSX.Element;
@@ -0,0 +1,64 @@
1
+ import { useTr as e } from "../shared/hooks/useTr.js";
2
+ import { Search as t, SlidersHorizontal as n } from "lucide-react";
3
+ import { jsx as r, jsxs as i } from "react/jsx-runtime";
4
+ import { Button as a, Input as o } from "@burdenoff/fe-libs/ui";
5
+ // src/navigation-v2/FilterControls.tsx
6
+ function s({ value: e, label: n, onChange: a, tour: s }) {
7
+ return /* @__PURE__ */ i("div", {
8
+ className: "relative flex-1",
9
+ children: [/* @__PURE__ */ r(t, {
10
+ size: 16,
11
+ className: "pointer-events-none absolute left-3 top-1/2 -translate-y-1/2 text-text-tertiary",
12
+ "aria-hidden": "true"
13
+ }), /* @__PURE__ */ r(o, {
14
+ "data-tour": s,
15
+ type: "search",
16
+ "aria-label": n,
17
+ placeholder: n,
18
+ value: e,
19
+ onChange: (e) => a(e.target.value),
20
+ className: "pl-9"
21
+ })]
22
+ });
23
+ }
24
+ function c({ chips: t, value: n, onChange: i, testIdPrefix: a }) {
25
+ let o = e();
26
+ return /* @__PURE__ */ r("div", {
27
+ role: "group",
28
+ "aria-label": o("notifications.v2.show", "Show"),
29
+ className: "inline-flex rounded-lg border border-border-default p-0.5",
30
+ children: t.map((e) => /* @__PURE__ */ r("button", {
31
+ type: "button",
32
+ "aria-pressed": n === e.id,
33
+ "data-testid": `${a}-${e.id}`,
34
+ onClick: () => i(e.id),
35
+ className: `min-h-9 rounded-md px-3 text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--color-focus-ring)] ${n === e.id ? "bg-action-primary-bg text-text-inverse" : "text-text-secondary hover:bg-bg-sunken hover:text-text-primary"}`,
36
+ children: e.label
37
+ }, e.id))
38
+ });
39
+ }
40
+ function l({ open: t, active: o, controls: s, onToggle: c }) {
41
+ let l = e();
42
+ return /* @__PURE__ */ i(a, {
43
+ type: "button",
44
+ variant: "ghost",
45
+ "aria-expanded": t,
46
+ "aria-controls": s,
47
+ onClick: c,
48
+ className: "gap-2",
49
+ children: [
50
+ /* @__PURE__ */ r(n, {
51
+ size: 16,
52
+ "aria-hidden": "true"
53
+ }),
54
+ l("notifications.v2.moreFilters", "More filters"),
55
+ o && /* @__PURE__ */ r("span", {
56
+ className: "h-2 w-2 rounded-full bg-accent-primary",
57
+ "aria-hidden": "true"
58
+ })
59
+ ]
60
+ });
61
+ }
62
+ export { l as MoreFiltersButton, s as SearchField, c as ViewChips };
63
+
64
+ //# sourceMappingURL=FilterControls.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FilterControls.js","names":["SearchField","Search","Input","tour","label","onChange","ViewChips","tr","useTr","chips","value","chip","testIdPrefix","MoreFiltersButton","Button","open","controls","onToggle","SlidersHorizontal","active"],"sources":["../../src/navigation-v2/FilterControls.tsx"],"sourcesContent":["import { Search, SlidersHorizontal } from 'lucide-react';\nimport { Button, Input } from '@burdenoff/fe-libs/ui';\nimport { useTr } from '../shared/hooks/useTr';\n\n/** The search box that leads a Navigation v2 list. */\nexport function SearchField({\n value,\n label,\n onChange,\n tour,\n}: {\n value: string;\n /** Already translated; also the placeholder. */\n label: string;\n onChange: (value: string) => void;\n tour?: string;\n}) {\n return (\n <div className=\"relative flex-1\">\n <Search\n size={16}\n className=\"pointer-events-none absolute left-3 top-1/2 -translate-y-1/2 text-text-tertiary\"\n aria-hidden=\"true\"\n />\n <Input\n data-tour={tour}\n type=\"search\"\n aria-label={label}\n placeholder={label}\n value={value}\n onChange={(e) => onChange(e.target.value)}\n className=\"pl-9\"\n />\n </div>\n );\n}\n\n/** A level-1 chip group (\"All · Unread · Needs action\"). */\nexport function ViewChips<T extends string>({\n chips,\n value,\n onChange,\n testIdPrefix,\n}: {\n chips: Array<{ id: T; label: string }>;\n value: T | null;\n onChange: (id: T) => void;\n testIdPrefix: string;\n}) {\n const tr = useTr();\n return (\n <div\n role=\"group\"\n aria-label={tr('notifications.v2.show', 'Show')}\n className=\"inline-flex rounded-lg border border-border-default p-0.5\"\n >\n {chips.map((chip) => (\n <button\n key={chip.id}\n type=\"button\"\n aria-pressed={value === chip.id}\n data-testid={`${testIdPrefix}-${chip.id}`}\n onClick={() => onChange(chip.id)}\n className={`min-h-9 rounded-md px-3 text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--color-focus-ring)] ${\n value === chip.id\n ? 'bg-action-primary-bg text-text-inverse'\n : 'text-text-secondary hover:bg-bg-sunken hover:text-text-primary'\n }`}\n >\n {chip.label}\n </button>\n ))}\n </div>\n );\n}\n\n/** \"More filters\": opens the level-2 filter panel; a dot shows when any of them is set. */\nexport function MoreFiltersButton({\n open,\n active,\n controls,\n onToggle,\n}: {\n open: boolean;\n active: boolean;\n controls: string;\n onToggle: () => void;\n}) {\n const tr = useTr();\n return (\n <Button\n type=\"button\"\n variant=\"ghost\"\n aria-expanded={open}\n aria-controls={controls}\n onClick={onToggle}\n className=\"gap-2\"\n >\n <SlidersHorizontal size={16} aria-hidden=\"true\" />\n {tr('notifications.v2.moreFilters', 'More filters')}\n {active && <span className=\"h-2 w-2 rounded-full bg-accent-primary\" aria-hidden=\"true\" />}\n </Button>\n );\n}\n"],"mappings":";;;;;AAKA,SAAgBA,EAAY,EAC1B,UACA,UACA,aACA,WAOC;CACD,OACE,kBAAC,OAAD;EAAK,WAAU;EAAf,UAAA,CACE,kBAACC,GAAD;GACE,MAAM;GACN,WAAU;GACV,eAAY;EACb,CAAA,GACD,kBAACC,GAAD;GACE,aAAWC;GACX,MAAK;GACL,cAAYC;GACZ,aAAaA;GACN;GACP,WAAW,MAAMC,EAAS,EAAE,OAAO,KAAK;GACxC,WAAU;EACX,CAAA,CACE;;AAET;AAGA,SAAgBC,EAA4B,EAC1C,UACA,UACA,aACA,mBAMC;CACD,IAAMC,IAAKC,EAAM;CACjB,OACE,kBAAC,OAAD;EACE,MAAK;EACL,cAAYD,EAAG,yBAAyB,MAAM;EAC9C,WAAU;EAET,UAAAE,EAAM,KAAK,MACV,kBAAC,UAAD;GAEE,MAAK;GACL,gBAAcC,MAAUC,EAAK;GAC7B,eAAa,GAAGC,EAAa,GAAGD,EAAK;GACrC,eAAeN,EAASM,EAAK,EAAE;GAC/B,WAAW,8JACTD,MAAUC,EAAK,KACX,2CACA;GAGL,UAAAA,EAAK;EACA,GAZDA,EAAK,EAYJ,CACT;CACE,CAAA;AAET;AAGA,SAAgBE,EAAkB,EAChC,SACA,WACA,aACA,eAMC;CACD,IAAMN,IAAKC,EAAM;CACjB,OACE,kBAACM,GAAD;EACE,MAAK;EACL,SAAQ;EACR,iBAAeC;EACf,iBAAeC;EACf,SAASC;EACT,WAAU;EANZ,UAAA;GAQE,kBAACC,GAAD;IAAmB,MAAM;IAAI,eAAY;GAAQ,CAAA;GAChDX,EAAG,gCAAgC,cAAc;GACjDY,KAAU,kBAAC,QAAD;IAAM,WAAU;IAAyC,eAAY;GAAQ,CAAA;EAClF;;AAEZ"}
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Archived, Navigation v2 (BOFF-11872; today's personal Notification
3
+ * History). Same query as the classic page (every channel, archived or
4
+ * not); the "Archived" chip, on by default, shows what you archived and
5
+ * "Everything" shows the full history. Restore on each archived row, search
6
+ * at level 1, topic and dates under "More filters", and "Download as
7
+ * spreadsheet" in "⋯".
8
+ */
9
+ export declare function NotificationArchivedV2(): import('react').JSX.Element;
@@ -0,0 +1,174 @@
1
+ import { NotificationCard as e } from "../components/NotificationCard.js";
2
+ import { useNotifications as t } from "../hooks/useNotifications.js";
3
+ import { useNotificationTopics as n } from "../hooks/useNotificationTopics.js";
4
+ import { NOTIFICATION_PERMISSIONS as r } from "../constants/permissions.js";
5
+ import "../hooks/index.js";
6
+ import { useNotification as i } from "../providers/NotificationProvider.js";
7
+ import { useTr as a } from "../shared/hooks/useTr.js";
8
+ import { inArchivedView as o } from "./inboxFilters.js";
9
+ import { exportNotificationsAsCsv as s } from "../utils/notificationHistoryExport.js";
10
+ import { BackToNotifications as c } from "./BackToNotifications.js";
11
+ import { MoreFiltersButton as l, SearchField as u, ViewChips as d } from "./FilterControls.js";
12
+ import { useMemo as f, useState as p } from "react";
13
+ import { usePermissions as m } from "@burdenoff/fe-libs/shared/providers/shell";
14
+ import { Download as h, MoreHorizontal as g } from "lucide-react";
15
+ import { jsx as _, jsxs as v } from "react/jsx-runtime";
16
+ import { Button as y, DropdownMenu as b, DropdownMenuContent as x, DropdownMenuItem as S, DropdownMenuTrigger as C, IllustratedEmptyState as w, Input as T, NativeSelect as E, useRememberedOpen as D } from "@burdenoff/fe-libs/ui";
17
+ // src/navigation-v2/NotificationArchivedV2.tsx
18
+ var O = {
19
+ archived: null,
20
+ channel: "ALL"
21
+ }, k = "ALL";
22
+ function A(e) {
23
+ return e ? e.toISOString().split("T")[0] : "";
24
+ }
25
+ function j() {
26
+ let j = a(), { hasPermission: M, isLoading: N } = m(), { currentUser: P } = i(), { topics: F } = n({ isActive: !0 }), { notifications: I, notificationFilter: L, updateFilter: R, archiveNotification: z, unarchiveNotification: B, recordAction: V } = t({ baseFilter: O }), [H, U] = p("archived"), [W, G] = D("notifications.archived.moreFilters", !1), K = f(() => I.filter((e) => o(e, H)), [I, H]), q = !!(L.topicId || L.dateRange.start || L.dateRange.end), J = !!L.search || q;
27
+ if (N) return /* @__PURE__ */ _("div", {
28
+ className: "flex h-64 items-center justify-center",
29
+ children: /* @__PURE__ */ _("div", { className: "h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent" })
30
+ });
31
+ if (!M(r.NOTIFICATION_LIST) && !P?.id) return /* @__PURE__ */ _("div", {
32
+ className: "p-8 text-center text-text-secondary",
33
+ children: j("notifications.noPermissionHistory", "You don't have permission to view notification history.")
34
+ });
35
+ let Y = [{
36
+ id: "archived",
37
+ label: j("notifications.v2.archived", "Archived")
38
+ }, {
39
+ id: "everything",
40
+ label: j("notifications.v2.everything", "Everything")
41
+ }], X = [{
42
+ value: k,
43
+ label: j("notifications.allTopics", "All Topics")
44
+ }, ...F.map((e) => ({
45
+ value: e.id,
46
+ label: e.name
47
+ }))];
48
+ return /* @__PURE__ */ v("div", {
49
+ className: "mx-auto w-full max-w-5xl space-y-4 p-3 animate-in fade-in duration-200 sm:space-y-5 sm:p-6",
50
+ children: [
51
+ /* @__PURE__ */ _(c, {}),
52
+ /* @__PURE__ */ v("header", {
53
+ "data-tour": "notification-history-header",
54
+ className: "flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between",
55
+ children: [/* @__PURE__ */ v("div", { children: [/* @__PURE__ */ _("h1", {
56
+ className: "text-xl font-semibold text-text-primary sm:text-2xl",
57
+ children: j("notifications.v2.archivedTitle", "Archived")
58
+ }), /* @__PURE__ */ _("p", {
59
+ className: "mt-1 text-sm text-text-secondary",
60
+ children: j("notifications.v2.archivedSubtitle", "Notifications you archived. Restore one to put it back in your inbox.")
61
+ })] }), /* @__PURE__ */ v(b, { children: [/* @__PURE__ */ _(C, {
62
+ asChild: !0,
63
+ children: /* @__PURE__ */ _(y, {
64
+ variant: "ghost",
65
+ size: "icon",
66
+ "aria-label": j("notifications.v2.moreActions", "More actions"),
67
+ "data-testid": "notifications-archived-overflow",
68
+ children: /* @__PURE__ */ _(g, {
69
+ size: 18,
70
+ "aria-hidden": "true"
71
+ })
72
+ })
73
+ }), /* @__PURE__ */ _(x, {
74
+ align: "end",
75
+ children: /* @__PURE__ */ v(S, {
76
+ "data-tour": "notification-history-export",
77
+ disabled: I.length === 0,
78
+ onSelect: () => s(j, I),
79
+ children: [/* @__PURE__ */ _(h, {
80
+ size: 16,
81
+ "aria-hidden": "true"
82
+ }), j("notifications.v2.downloadSpreadsheet", "Download as spreadsheet")]
83
+ })
84
+ })] })]
85
+ }),
86
+ /* @__PURE__ */ v("section", {
87
+ "aria-label": j("notifications.v2.filters", "Filters"),
88
+ className: "space-y-3",
89
+ children: [/* @__PURE__ */ v("div", {
90
+ className: "flex flex-col gap-3 sm:flex-row sm:items-center",
91
+ children: [/* @__PURE__ */ _(u, {
92
+ label: j("notifications.searchByTitleOrContent", "Search by title or content..."),
93
+ value: L.search,
94
+ onChange: (e) => R({ search: e })
95
+ }), /* @__PURE__ */ v("div", {
96
+ className: "flex flex-wrap items-center gap-2",
97
+ children: [/* @__PURE__ */ _(d, {
98
+ chips: Y,
99
+ value: H,
100
+ onChange: U,
101
+ testIdPrefix: "notifications-archived-view"
102
+ }), /* @__PURE__ */ _(l, {
103
+ open: W,
104
+ active: q,
105
+ controls: "notifications-archived-more-filters",
106
+ onToggle: () => G(!W)
107
+ })]
108
+ })]
109
+ }), /* @__PURE__ */ v("div", {
110
+ id: "notifications-archived-more-filters",
111
+ hidden: !W,
112
+ className: "grid gap-3 rounded-lg border border-border-seam bg-bg-surface p-3 sm:grid-cols-3",
113
+ children: [
114
+ /* @__PURE__ */ _(E, {
115
+ "aria-label": j("notifications.v2.topicFilter", "Topic"),
116
+ options: X,
117
+ value: L.topicId || k,
118
+ onValueChange: (e) => R({ topicId: e === k ? void 0 : e })
119
+ }),
120
+ /* @__PURE__ */ _(T, {
121
+ type: "date",
122
+ "aria-label": j("notifications.startDate", "Start date"),
123
+ value: A(L.dateRange.start),
124
+ onChange: (e) => R({ dateRange: {
125
+ ...L.dateRange,
126
+ start: e.target.value ? new Date(e.target.value) : null
127
+ } })
128
+ }),
129
+ /* @__PURE__ */ _(T, {
130
+ type: "date",
131
+ "aria-label": j("notifications.endDate", "End date"),
132
+ value: A(L.dateRange.end),
133
+ onChange: (e) => R({ dateRange: {
134
+ ...L.dateRange,
135
+ end: e.target.value ? new Date(e.target.value) : null
136
+ } })
137
+ })
138
+ ]
139
+ })]
140
+ }),
141
+ /* @__PURE__ */ _("div", {
142
+ className: "space-y-2",
143
+ children: K.length > 0 ? K.map((t) => /* @__PURE__ */ v("div", {
144
+ className: "space-y-2",
145
+ children: [/* @__PURE__ */ _(e, {
146
+ notification: t,
147
+ onArchive: t.archivedAt ? void 0 : z,
148
+ onAction: V,
149
+ showArchivedState: !0,
150
+ analyticsSource: "history",
151
+ navigationV2: !0,
152
+ showTopic: W
153
+ }), t.archivedAt && /* @__PURE__ */ _("div", {
154
+ className: "flex justify-end",
155
+ children: /* @__PURE__ */ _(y, {
156
+ type: "button",
157
+ variant: "outline",
158
+ size: "sm",
159
+ onClick: () => B(t.id),
160
+ children: j("notifications.restore", "Restore")
161
+ })
162
+ })]
163
+ }, t.id)) : /* @__PURE__ */ _(w, {
164
+ illustration: J ? "empty-search" : "empty-notifications",
165
+ title: J ? j("notifications.noNotificationsFound", "No notifications found") : H === "archived" ? j("notifications.v2.archivedEmptyTitle", "Nothing archived") : j("notifications.historyEmptyTitle", "No history yet"),
166
+ description: J ? j("notifications.adjustSearchOrDateRange", "Try adjusting your filters") : H === "archived" ? j("notifications.v2.archivedEmptyDescription", "Archive a notification from your inbox and it moves here.") : j("notifications.historyEmptyDescription", "Notifications you receive will be archived here so you can always find them again.")
167
+ })
168
+ })
169
+ ]
170
+ });
171
+ }
172
+ export { j as NotificationArchivedV2 };
173
+
174
+ //# sourceMappingURL=NotificationArchivedV2.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"NotificationArchivedV2.js","names":["HISTORY_FILTER","ALL","toDateInput","value","NotificationArchivedV2","tr","useTr","permissionsLoading","usePermissions","useNotification","useNotificationTopics","useNotifications","view","setView","useState","moreFiltersOpen","setMoreFiltersOpen","useRememberedOpen","visible","useMemo","notifications","inArchivedView","notification","moreFiltersActive","notificationFilter","hasActiveFilters","hasPermission","NOTIFICATION_PERMISSIONS","currentUser","chips","topicOptions","topics","topic","BackToNotifications","DropdownMenu","DropdownMenuTrigger","Button","MoreHorizontal","DropdownMenuContent","DropdownMenuItem","exportNotificationsAsCsv","Download","SearchField","updateFilter","ViewChips","MoreFiltersButton","NativeSelect","Input","NotificationCard","archiveNotification","recordAction","unarchiveNotification","IllustratedEmptyState"],"sources":["../../src/navigation-v2/NotificationArchivedV2.tsx"],"sourcesContent":["import { useMemo, useState } from 'react';\nimport { Download, MoreHorizontal } from 'lucide-react';\nimport { usePermissions } from '@burdenoff/fe-libs/shared/providers/shell';\nimport {\n Button,\n DropdownMenu,\n DropdownMenuContent,\n DropdownMenuItem,\n DropdownMenuTrigger,\n IllustratedEmptyState,\n Input,\n NativeSelect,\n useRememberedOpen,\n} from '@burdenoff/fe-libs/ui';\nimport { NotificationCard } from '../components/NotificationCard';\nimport { NOTIFICATION_PERMISSIONS } from '../constants/permissions';\nimport { useNotifications, useNotificationTopics } from '../hooks';\nimport { useNotification } from '../providers/NotificationProvider';\nimport { useTr } from '../shared/hooks/useTr';\nimport { inArchivedView, type ArchivedView } from './inboxFilters';\nimport { exportNotificationsAsCsv } from '../utils/notificationHistoryExport';\nimport { BackToNotifications } from './BackToNotifications';\nimport { MoreFiltersButton, SearchField, ViewChips } from './FilterControls';\n\nconst HISTORY_FILTER = { archived: null, channel: 'ALL' as const };\nconst ALL = 'ALL';\n\nfunction toDateInput(value: Date | null): string {\n return value ? value.toISOString().split('T')[0] : '';\n}\n\n/**\n * Archived, Navigation v2 (BOFF-11872; today's personal Notification\n * History). Same query as the classic page (every channel, archived or\n * not); the \"Archived\" chip, on by default, shows what you archived and\n * \"Everything\" shows the full history. Restore on each archived row, search\n * at level 1, topic and dates under \"More filters\", and \"Download as\n * spreadsheet\" in \"⋯\".\n */\nexport function NotificationArchivedV2() {\n const tr = useTr();\n const { hasPermission, isLoading: permissionsLoading } = usePermissions();\n const { currentUser } = useNotification();\n const { topics } = useNotificationTopics({ isActive: true });\n const {\n notifications,\n notificationFilter,\n updateFilter,\n archiveNotification,\n unarchiveNotification,\n recordAction,\n } = useNotifications({ baseFilter: HISTORY_FILTER });\n const [view, setView] = useState<ArchivedView>('archived');\n const [moreFiltersOpen, setMoreFiltersOpen] = useRememberedOpen(\n 'notifications.archived.moreFilters',\n false\n );\n\n const visible = useMemo(\n () => notifications.filter((notification) => inArchivedView(notification, view)),\n [notifications, view]\n );\n\n const moreFiltersActive = Boolean(\n notificationFilter.topicId ||\n notificationFilter.dateRange.start ||\n notificationFilter.dateRange.end\n );\n const hasActiveFilters = Boolean(notificationFilter.search) || moreFiltersActive;\n\n if (permissionsLoading) {\n return (\n <div className=\"flex h-64 items-center justify-center\">\n <div className=\"h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent\" />\n </div>\n );\n }\n\n if (!hasPermission(NOTIFICATION_PERMISSIONS.NOTIFICATION_LIST) && !currentUser?.id) {\n return (\n <div className=\"p-8 text-center text-text-secondary\">\n {tr(\n 'notifications.noPermissionHistory',\n \"You don't have permission to view notification history.\"\n )}\n </div>\n );\n }\n\n const chips: Array<{ id: ArchivedView; label: string }> = [\n { id: 'archived', label: tr('notifications.v2.archived', 'Archived') },\n { id: 'everything', label: tr('notifications.v2.everything', 'Everything') },\n ];\n const topicOptions = [\n { value: ALL, label: tr('notifications.allTopics', 'All Topics') },\n ...topics.map((topic) => ({ value: topic.id, label: topic.name })),\n ];\n\n return (\n <div className=\"mx-auto w-full max-w-5xl space-y-4 p-3 animate-in fade-in duration-200 sm:space-y-5 sm:p-6\">\n <BackToNotifications />\n <header\n data-tour=\"notification-history-header\"\n className=\"flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between\"\n >\n <div>\n <h1 className=\"text-xl font-semibold text-text-primary sm:text-2xl\">\n {tr('notifications.v2.archivedTitle', 'Archived')}\n </h1>\n <p className=\"mt-1 text-sm text-text-secondary\">\n {tr(\n 'notifications.v2.archivedSubtitle',\n 'Notifications you archived. Restore one to put it back in your inbox.'\n )}\n </p>\n </div>\n <DropdownMenu>\n <DropdownMenuTrigger asChild>\n <Button\n variant=\"ghost\"\n size=\"icon\"\n aria-label={tr('notifications.v2.moreActions', 'More actions')}\n data-testid=\"notifications-archived-overflow\"\n >\n <MoreHorizontal size={18} aria-hidden=\"true\" />\n </Button>\n </DropdownMenuTrigger>\n <DropdownMenuContent align=\"end\">\n <DropdownMenuItem\n data-tour=\"notification-history-export\"\n disabled={notifications.length === 0}\n onSelect={() => exportNotificationsAsCsv(tr, notifications)}\n >\n <Download size={16} aria-hidden=\"true\" />\n {tr('notifications.v2.downloadSpreadsheet', 'Download as spreadsheet')}\n </DropdownMenuItem>\n </DropdownMenuContent>\n </DropdownMenu>\n </header>\n\n <section aria-label={tr('notifications.v2.filters', 'Filters')} className=\"space-y-3\">\n <div className=\"flex flex-col gap-3 sm:flex-row sm:items-center\">\n <SearchField\n label={tr('notifications.searchByTitleOrContent', 'Search by title or content...')}\n value={notificationFilter.search}\n onChange={(search) => updateFilter({ search })}\n />\n <div className=\"flex flex-wrap items-center gap-2\">\n <ViewChips\n chips={chips}\n value={view}\n onChange={setView}\n testIdPrefix=\"notifications-archived-view\"\n />\n <MoreFiltersButton\n open={moreFiltersOpen}\n active={moreFiltersActive}\n controls=\"notifications-archived-more-filters\"\n onToggle={() => setMoreFiltersOpen(!moreFiltersOpen)}\n />\n </div>\n </div>\n <div\n id=\"notifications-archived-more-filters\"\n hidden={!moreFiltersOpen}\n className=\"grid gap-3 rounded-lg border border-border-seam bg-bg-surface p-3 sm:grid-cols-3\"\n >\n <NativeSelect\n aria-label={tr('notifications.v2.topicFilter', 'Topic')}\n options={topicOptions}\n value={notificationFilter.topicId || ALL}\n onValueChange={(value) => updateFilter({ topicId: value === ALL ? undefined : value })}\n />\n <Input\n type=\"date\"\n aria-label={tr('notifications.startDate', 'Start date')}\n value={toDateInput(notificationFilter.dateRange.start)}\n onChange={(e) =>\n updateFilter({\n dateRange: {\n ...notificationFilter.dateRange,\n start: e.target.value ? new Date(e.target.value) : null,\n },\n })\n }\n />\n <Input\n type=\"date\"\n aria-label={tr('notifications.endDate', 'End date')}\n value={toDateInput(notificationFilter.dateRange.end)}\n onChange={(e) =>\n updateFilter({\n dateRange: {\n ...notificationFilter.dateRange,\n end: e.target.value ? new Date(e.target.value) : null,\n },\n })\n }\n />\n </div>\n </section>\n\n <div className=\"space-y-2\">\n {visible.length > 0 ? (\n visible.map((notification) => (\n <div key={notification.id} className=\"space-y-2\">\n <NotificationCard\n notification={notification}\n onArchive={notification.archivedAt ? undefined : archiveNotification}\n onAction={recordAction}\n showArchivedState\n analyticsSource=\"history\"\n navigationV2\n showTopic={moreFiltersOpen}\n />\n {notification.archivedAt && (\n <div className=\"flex justify-end\">\n <Button\n type=\"button\"\n variant=\"outline\"\n size=\"sm\"\n onClick={() => unarchiveNotification(notification.id)}\n >\n {tr('notifications.restore', 'Restore')}\n </Button>\n </div>\n )}\n </div>\n ))\n ) : (\n <IllustratedEmptyState\n illustration={hasActiveFilters ? 'empty-search' : 'empty-notifications'}\n title={\n hasActiveFilters\n ? tr('notifications.noNotificationsFound', 'No notifications found')\n : view === 'archived'\n ? tr('notifications.v2.archivedEmptyTitle', 'Nothing archived')\n : tr('notifications.historyEmptyTitle', 'No history yet')\n }\n description={\n hasActiveFilters\n ? tr('notifications.adjustSearchOrDateRange', 'Try adjusting your filters')\n : view === 'archived'\n ? tr(\n 'notifications.v2.archivedEmptyDescription',\n 'Archive a notification from your inbox and it moves here.'\n )\n : tr(\n 'notifications.historyEmptyDescription',\n 'Notifications you receive will be archived here so you can always find them again.'\n )\n }\n />\n )}\n </div>\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AAwBA,IAAMA,IAAiB;CAAE,UAAU;CAAM,SAAS;AAAe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MACb,UAAA,kBAACc,GAAD;OACE,MAAK;OACL,SAAQ;OACR,MAAK;OACL,eAAee,EAAsB7B,EAAa,EAAE;OAEnD,UAAAjB,EAAG,yBAAyB,SAAS;MAChC,CAAA;KACL,CAAA,CAEJ;IAtBK,GAAAiB,EAAa,EAsBlB,CACN,IAED,kBAAC8B,GAAD;KACE,cAAc3B,IAAmB,iBAAiB;KAClD,OACEA,IACIpB,EAAG,sCAAsC,wBAAwB,IACjEO,MAAS,aACPP,EAAG,uCAAuC,kBAAkB,IAC5DA,EAAG,mCAAmC,gBAAgB;KAE9D,aACEoB,IACIpB,EAAG,yCAAyC,4BAA4B,IACxEO,MAAS,aACPP,EACE,6CACA,2DACF,IACAA,EACE,yCACA,oFACF;IAET,CAAA;GAEA,CAAA;EACF;;AAET"}
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Notifications, Navigation v2 (BOFF-11872, mockup 41). Level 1: the title
3
+ * with the unread count, "Mark all as read", "Notification settings",
4
+ * "Archived", search and the All · Unread · Needs action chips. Level 2: the
5
+ * admin tools under "More", and Type, Priority, Topic and the full read state
6
+ * under "More filters" (remembered per profile). Same queries as the classic
7
+ * Notification Center.
8
+ */
9
+ export declare function NotificationInboxV2(): import('react').JSX.Element;