@burdenoff/fe-libs 2026.527.2 → 2026.527.4

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 (161) hide show
  1. package/dist/button/Button.js +18 -16
  2. package/dist/chrome/AccountSwitcher.js +10 -7
  3. package/dist/chrome/AutoBreadcrumbs.js +2 -0
  4. package/dist/chrome/Breadcrumbs.js +2 -0
  5. package/dist/chrome/CommandPalette.js +5 -3
  6. package/dist/chrome/ContextSwitcher.js +90 -338
  7. package/dist/chrome/DynamicFooter.js +7 -7
  8. package/dist/chrome/Footer.js +5 -5
  9. package/dist/chrome/GeographySwitcher.js +3 -3
  10. package/dist/chrome/GlobalSearch.js +73 -448
  11. package/dist/chrome/HeaderBar.js +6 -1
  12. package/dist/chrome/LanguagePickerSheet.js +1 -1
  13. package/dist/chrome/LanguageSwitcher.js +2 -2
  14. package/dist/chrome/NotificationCenter.js +69 -694
  15. package/dist/chrome/PanelTabs.js +7 -4
  16. package/dist/chrome/PluginContextMenuTarget.js +1 -1
  17. package/dist/chrome/ProductPickerSheet.js +4 -4
  18. package/dist/chrome/ProductSideNav.js +1 -1
  19. package/dist/chrome/ProductSwitcher.js +3 -3
  20. package/dist/chrome/ProfileSwitcher.js +13 -8
  21. package/dist/chrome/ShortcutHelpDialog.js +2 -1
  22. package/dist/chrome/SideNavigation.js +75 -239
  23. package/dist/chrome/Sidebar.js +1 -0
  24. package/dist/chrome/contextSwitcher/EmptyState.js +32 -0
  25. package/dist/chrome/contextSwitcher/OrganizationList.js +34 -0
  26. package/dist/chrome/contextSwitcher/ProjectList.js +34 -0
  27. package/dist/chrome/contextSwitcher/SearchInput.js +50 -0
  28. package/dist/chrome/contextSwitcher/TabButton.js +9 -0
  29. package/dist/chrome/contextSwitcher/TriggerButton.js +38 -0
  30. package/dist/chrome/contextSwitcher/WorkspaceList.js +34 -0
  31. package/dist/chrome/contextSwitcher/icons.js +58 -0
  32. package/dist/chrome/contextSwitcher/useIsMobile.js +11 -0
  33. package/dist/chrome/globalSearch/AdvancedFiltersPanel.js +253 -0
  34. package/dist/chrome/globalSearch/CategoryTabs.js +28 -0
  35. package/dist/chrome/globalSearch/ResultsList.js +58 -0
  36. package/dist/chrome/globalSearch/SearchInput.js +28 -0
  37. package/dist/chrome/globalSearch/SearchModeBar.js +36 -0
  38. package/dist/chrome/globalSearch/useAdvancedFilters.js +78 -0
  39. package/dist/chrome/globalSearch/utils.js +22 -0
  40. package/dist/chrome/notificationCenter/BellButton.js +27 -0
  41. package/dist/chrome/notificationCenter/NotificationCardItem.js +129 -0
  42. package/dist/chrome/notificationCenter/NotificationFilters.js +67 -0
  43. package/dist/chrome/notificationCenter/NotificationFooter.js +23 -0
  44. package/dist/chrome/notificationCenter/NotificationHeader.js +75 -0
  45. package/dist/chrome/notificationCenter/NotificationList.js +75 -0
  46. package/dist/chrome/notificationCenter/NotificationPanel.js +19 -0
  47. package/dist/chrome/notificationCenter/SkeletonCard.js +18 -0
  48. package/dist/chrome/notificationCenter/constants.js +93 -0
  49. package/dist/chrome/notificationCenter/gql.js +58 -0
  50. package/dist/chrome/notificationCenter/useNotificationCenter.js +149 -0
  51. package/dist/chrome/notificationCenter/usePanelChrome.js +36 -0
  52. package/dist/chrome/sideNavigation/CollapseToggle.js +29 -0
  53. package/dist/chrome/sideNavigation/MobileActionsBar.js +25 -0
  54. package/dist/chrome/sideNavigation/NavItemRenderer.js +79 -0
  55. package/dist/chrome/sideNavigation/SidebarHeader.js +29 -0
  56. package/dist/chrome/sideNavigation/helpers.js +19 -0
  57. package/dist/chrome/sideNavigation/useSideNavigationState.js +45 -0
  58. package/dist/form/Checkbox.js +17 -15
  59. package/dist/form/FormDescription.js +9 -10
  60. package/dist/form/FormField.js +11 -12
  61. package/dist/form/FormLabel.js +13 -13
  62. package/dist/form/FormMessage.js +10 -11
  63. package/dist/form/Input.js +11 -10
  64. package/dist/form/Radio.js +25 -21
  65. package/dist/form/Select.js +81 -66
  66. package/dist/form/Textarea.js +10 -9
  67. package/dist/shared/components/AccessDenied.js +8 -4
  68. package/dist/shared/components/AppErrorBoundary.js +2 -0
  69. package/dist/shared/components/ContextConversationWidget.js +173 -767
  70. package/dist/shared/components/ErrorFallback.js +3 -0
  71. package/dist/shared/components/PWAInstallBanner.js +8 -4
  72. package/dist/shared/components/RequireAuth.js +4 -4
  73. package/dist/shared/components/SSORedirectGuard.js +1 -1
  74. package/dist/shared/components/contextConversationWidget/Composer.js +66 -0
  75. package/dist/shared/components/contextConversationWidget/MessageItem.js +124 -0
  76. package/dist/shared/components/contextConversationWidget/MessageList.js +32 -0
  77. package/dist/shared/components/contextConversationWidget/NoWorkspaceCard.js +19 -0
  78. package/dist/shared/components/contextConversationWidget/PendingAttachmentsBar.js +28 -0
  79. package/dist/shared/components/contextConversationWidget/ReplyBanner.js +32 -0
  80. package/dist/shared/components/contextConversationWidget/WidgetHeader.js +70 -0
  81. package/dist/shared/components/contextConversationWidget/queries.js +197 -0
  82. package/dist/shared/components/contextConversationWidget/types.js +10 -0
  83. package/dist/shared/components/contextConversationWidget/useAttachmentUpload.js +57 -0
  84. package/dist/shared/components/contextConversationWidget/useConversationSubscriptions.js +26 -0
  85. package/dist/shared/components/contextConversationWidget/useMessageActions.js +34 -0
  86. package/dist/shared/components/contextConversationWidget/useSendMessage.js +45 -0
  87. package/dist/shared/components/contextConversationWidget/useWidgetMessages.js +44 -0
  88. package/dist/shared/components/contextConversationWidget/utils.js +56 -0
  89. package/dist/shared/feature-flags/FeatureFlagProvider.js +21 -21
  90. package/dist/shared/geography/GeographyProvider.js +20 -20
  91. package/dist/shared/graphql/GatewayContext.js +1 -1
  92. package/dist/shared/motion/MotionList.js +1 -1
  93. package/dist/shared/pages/AiPage.js +3 -3
  94. package/dist/shared/pages/SearchPage.js +293 -1071
  95. package/dist/shared/pages/searchPage/ActiveFilterChips.js +176 -0
  96. package/dist/shared/pages/searchPage/FiltersPanel.js +329 -0
  97. package/dist/shared/pages/searchPage/ResultsList.js +119 -0
  98. package/dist/shared/pages/searchPage/ResultsStatus.js +32 -0
  99. package/dist/shared/pages/searchPage/SearchInput.js +31 -0
  100. package/dist/shared/pages/searchPage/SearchPagination.js +37 -0
  101. package/dist/shared/pages/searchPage/SearchToolbar.js +58 -0
  102. package/dist/shared/pages/searchPage/constants.js +155 -0
  103. package/dist/shared/pages/searchPage/utils.js +24 -0
  104. package/dist/shared/plugins/PluginRuntimeProvider.js +1 -1
  105. package/dist/shared/providers/shell/ActiveContextProvider.js +12 -12
  106. package/dist/shared/providers/shell/AppShellContext.js +1 -1
  107. package/dist/shared/providers/shell/AuthProvider.js +130 -384
  108. package/dist/shared/providers/shell/AuthTokenProvider.js +6 -6
  109. package/dist/shared/providers/shell/ContextManagerProvider.js +1 -1
  110. package/dist/shared/providers/shell/FeatureFlagsProvider.js +5 -5
  111. package/dist/shared/providers/shell/GlobalUiProvider.js +17 -17
  112. package/dist/shared/providers/shell/I18nProvider.js +15 -15
  113. package/dist/shared/providers/shell/PageConversationContextProvider.js +14 -14
  114. package/dist/shared/providers/shell/PermissionProvider.js +16 -16
  115. package/dist/shared/providers/shell/ShellUiProvider.js +13 -13
  116. package/dist/shared/providers/shell/ThemeProvider.js +9 -9
  117. package/dist/shared/providers/shell/authProvider/bridgeStateSync.js +34 -0
  118. package/dist/shared/providers/shell/authProvider/jwt.js +13 -0
  119. package/dist/shared/providers/shell/authProvider/ssoRelay.js +38 -0
  120. package/dist/shared/providers/shell/authProvider/useAuthActions.js +170 -0
  121. package/dist/shared/providers/shell/authProvider/useBridgeInitialization.js +86 -0
  122. package/dist/shared/providers/shell/authProvider/useRemoteSLO.js +32 -0
  123. package/dist/shared/providers/shell/authProvider/useStorageSync.js +35 -0
  124. package/dist/shared/providers/shell/authProvider/useTokenExpiryTimer.js +37 -0
  125. package/dist/shared/tours/TourPlayer.js +1 -0
  126. package/dist/shared/tours/TourPlayerProvider.js +1 -1
  127. package/dist/shared/tours/TourTooltip.js +3 -0
  128. package/dist/shared/tours/TourTrigger.js +86 -259
  129. package/dist/shared/tours/ToursContext.js +108 -398
  130. package/dist/shared/tours/tourTrigger/DesktopTourDropdown.js +48 -0
  131. package/dist/shared/tours/tourTrigger/MobileTourSheet.js +68 -0
  132. package/dist/shared/tours/tourTrigger/TourListItemDesktop.js +36 -0
  133. package/dist/shared/tours/tourTrigger/TourListItemMobile.js +47 -0
  134. package/dist/shared/tours/tourTrigger/TourStatusChip.js +30 -0
  135. package/dist/shared/tours/tourTrigger/TourTriggerButton.js +22 -0
  136. package/dist/shared/tours/toursContext/errors.js +18 -0
  137. package/dist/shared/tours/toursContext/gql.js +152 -0
  138. package/dist/shared/tours/toursContext/route.js +20 -0
  139. package/dist/shared/tours/toursContext/session.js +19 -0
  140. package/dist/shared/tours/toursContext/useIdleReady.js +18 -0
  141. package/dist/shared/tours/toursContext/useTourMutations.js +118 -0
  142. package/dist/shared-events.js +3 -3
  143. package/dist/shared-hooks.js +1 -1
  144. package/dist/storage/SaveToFilesButton.js +3 -3
  145. package/dist/storage/SaveToFilesDialog.js +1 -1
  146. package/dist/tag/TagBadge.js +1 -1
  147. package/dist/tag/TagsWidget.js +81 -226
  148. package/dist/tag/tagsWidget/AddTagTrigger.js +14 -0
  149. package/dist/tag/tagsWidget/TagBadgeList.js +17 -0
  150. package/dist/tag/tagsWidget/TagSearchPopover.js +80 -0
  151. package/dist/tag/tagsWidget/operations.js +64 -0
  152. package/dist/tag/tagsWidget/useVocabResolver.js +30 -0
  153. package/dist/ui/card.js +44 -39
  154. package/dist/ui/dropdown-menu.js +82 -66
  155. package/dist/ui/input.js +10 -10
  156. package/dist/ui/label.js +13 -11
  157. package/dist/ui/select.js +80 -66
  158. package/dist/ui/table.js +61 -54
  159. package/dist/ui/textarea.js +9 -9
  160. package/dist/ui/tooltip.js +13 -11
  161. package/package.json +1 -1
@@ -1,705 +1,80 @@
1
- import { useCallback as e, useEffect as t, useRef as n, useState as r } from "react";
2
- import { Fragment as i, jsx as a, jsxs as o } from "react/jsx-runtime";
3
- import { gql as s } from "@apollo/client";
1
+ import { BellButton as e } from "./notificationCenter/BellButton.js";
2
+ import { sortNotifications as t } from "./notificationCenter/constants.js";
3
+ import { NotificationFilters as n } from "./notificationCenter/NotificationFilters.js";
4
+ import { NotificationFooter as r } from "./notificationCenter/NotificationFooter.js";
5
+ import { NotificationHeader as i } from "./notificationCenter/NotificationHeader.js";
6
+ import { NotificationList as a } from "./notificationCenter/NotificationList.js";
7
+ import { NotificationPanel as o } from "./notificationCenter/NotificationPanel.js";
8
+ import { useNotificationCenter as s } from "./notificationCenter/useNotificationCenter.js";
9
+ import { useEscapeClose as c, useOutsideClickClose as l, usePanelChrome as u } from "./notificationCenter/usePanelChrome.js";
10
+ import { useCallback as d, useRef as f, useState as p } from "react";
11
+ import { jsx as m, jsxs as h } from "react/jsx-runtime";
4
12
  //#region src/chrome/NotificationCenter.tsx
5
- var c = s`
6
- query GetNotifications($filter: NotificationFilterInput, $limit: Int, $offset: Int) {
7
- notifications(filter: $filter, limit: $limit, offset: $offset) {
8
- items {
9
- id
10
- title
11
- message
12
- type
13
- priority
14
- status
15
- channel
16
- appName
17
- redirectUrl
18
- isRead
19
- readAt
20
- createdAt
21
- }
22
- total
23
- hasMore
24
- }
25
- }
26
- `, l = s`
27
- query GetMyUnreadNotificationCount($filter: NotificationFilterInput) {
28
- myUnreadNotificationCount(filter: $filter)
29
- }
30
- `, u = s`
31
- subscription MyUnreadNotificationCountStream($filter: NotificationFilterInput) {
32
- myUnreadNotificationCountStream(filter: $filter)
33
- }
34
- `, d = s`
35
- query MyCountsByApp {
36
- myNotificationCountsByApp
37
- }
38
- `, f = s`
39
- mutation MarkAsRead($id: ID!) {
40
- markNotificationAsRead(id: $id) {
41
- id
42
- isRead
43
- readAt
44
- status
45
- }
46
- }
47
- `, p = s`
48
- mutation MarkAllRead {
49
- markAllMyNotificationsAsRead {
50
- success
51
- count
52
- }
53
- }
54
- `, m = s`
55
- mutation DeleteNotification($id: ID!) {
56
- deleteNotification(id: $id)
57
- }
58
- `, h = {
59
- URGENT: {
60
- color: "text-status-error-text",
61
- bgColor: "bg-status-error-bg",
62
- label: "Urgent",
63
- order: 0
64
- },
65
- HIGH: {
66
- color: "text-status-warning-text",
67
- bgColor: "bg-status-warning-bg",
68
- label: "High",
69
- order: 1
70
- },
71
- MEDIUM: {
72
- color: "text-status-info-text",
73
- bgColor: "bg-status-info-bg",
74
- label: "Medium",
75
- order: 2
76
- },
77
- LOW: {
78
- color: "text-text-tertiary",
79
- bgColor: "bg-bg-muted",
80
- label: "Low",
81
- order: 3
82
- }
83
- }, g = {
84
- SYSTEM: {
85
- icon: "⚙️",
86
- label: "System"
87
- },
88
- ALERT: {
89
- icon: "⚠️",
90
- label: "Alert"
91
- },
92
- TRANSACTIONAL: {
93
- icon: "📋",
94
- label: "Transaction"
95
- },
96
- MARKETING: {
97
- icon: "📣",
98
- label: "Marketing"
99
- }
100
- }, _ = [
101
- {
102
- value: "all",
103
- label: "All"
104
- },
105
- {
106
- value: "unread",
107
- label: "Unread"
108
- },
109
- {
110
- value: "read",
111
- label: "Read"
112
- }
113
- ], v = [
114
- {
115
- value: "ALL",
116
- label: "All"
117
- },
118
- {
119
- value: "SYSTEM",
120
- label: "System"
121
- },
122
- {
123
- value: "ALERT",
124
- label: "Alert"
125
- },
126
- {
127
- value: "TRANSACTIONAL",
128
- label: "Transactional"
129
- },
130
- {
131
- value: "MARKETING",
132
- label: "Marketing"
133
- }
134
- ];
135
- function y(e) {
136
- let t = Date.now() - new Date(e).getTime(), n = Math.floor(t / 1e3), r = Math.floor(n / 60), i = Math.floor(r / 60), a = Math.floor(i / 24);
137
- return n < 60 ? "Just now" : r < 60 ? `${r}m ago` : i < 24 ? `${i}h ago` : a < 7 ? `${a}d ago` : new Date(e).toLocaleDateString();
138
- }
139
- function ee(e, t) {
140
- let n = [...e];
141
- switch (t) {
142
- case "newest": return n.sort((e, t) => new Date(t.createdAt).getTime() - new Date(e.createdAt).getTime());
143
- case "oldest": return n.sort((e, t) => new Date(e.createdAt).getTime() - new Date(t.createdAt).getTime());
144
- case "priority": return n.sort((e, t) => (h[e.priority]?.order ?? 99) - (h[t.priority]?.order ?? 99));
145
- default: return n;
146
- }
147
- }
148
- var te = ({ notification: e, onMarkAsRead: t, onDelete: n, onRedirect: r }) => {
149
- let { id: i, title: s, message: c, type: l, priority: u, appName: d, redirectUrl: f, isRead: p, createdAt: m } = e, _ = h[u] ?? h.MEDIUM, v = g[l] ?? {
150
- icon: "🔔",
151
- label: l
152
- };
153
- return /* @__PURE__ */ o("div", {
154
- className: `group relative flex gap-3 p-3 rounded-card border transition-all duration-150 cursor-pointer ${p ? "bg-bg-canvas border-border-subtle" : "bg-bg-elevated border-border-default shadow-sm"} hover:bg-action-ghost-bg-hover`,
155
- onClick: () => {
156
- p || t(i), f && r(f);
157
- },
158
- role: "button",
159
- tabIndex: 0,
160
- onKeyDown: (e) => {
161
- (e.key === "Enter" || e.key === " ") && (e.preventDefault(), p || t(i), f && r(f));
162
- },
163
- children: [
164
- !p && /* @__PURE__ */ a("div", { className: "absolute top-3 left-1.5 w-2 h-2 rounded-full bg-action-primary-bg" }),
165
- /* @__PURE__ */ a("div", {
166
- className: "flex-shrink-0 mt-0.5 ml-2",
167
- children: /* @__PURE__ */ a("span", {
168
- className: "text-base",
169
- "aria-hidden": "true",
170
- children: v.icon
171
- })
172
- }),
173
- /* @__PURE__ */ o("div", {
174
- className: "flex-1 min-w-0",
175
- children: [
176
- /* @__PURE__ */ o("div", {
177
- className: "flex items-start justify-between gap-2",
178
- children: [/* @__PURE__ */ a("h4", {
179
- className: `text-sm truncate ${p ? "font-normal text-text-secondary" : "font-semibold text-text-primary"}`,
180
- children: s
181
- }), /* @__PURE__ */ o("div", {
182
- className: "flex-shrink-0 flex items-center gap-0.5 opacity-0 group-hover:opacity-100 transition-opacity",
183
- children: [!p && /* @__PURE__ */ a("button", {
184
- onClick: (e) => {
185
- e.stopPropagation(), t(i);
186
- },
187
- className: "p-1 rounded hover:bg-bg-muted text-text-tertiary hover:text-text-primary",
188
- title: "Mark as read",
189
- "aria-label": "Mark as read",
190
- children: /* @__PURE__ */ a("svg", {
191
- className: "w-3.5 h-3.5",
192
- fill: "none",
193
- stroke: "currentColor",
194
- viewBox: "0 0 24 24",
195
- children: /* @__PURE__ */ a("path", {
196
- strokeLinecap: "round",
197
- strokeLinejoin: "round",
198
- strokeWidth: 2,
199
- d: "M5 13l4 4L19 7"
200
- })
201
- })
202
- }), /* @__PURE__ */ a("button", {
203
- onClick: (e) => {
204
- e.stopPropagation(), n(i);
205
- },
206
- className: "p-1 rounded hover:bg-bg-muted text-text-tertiary hover:text-status-error-text",
207
- title: "Dismiss",
208
- "aria-label": "Dismiss notification",
209
- children: /* @__PURE__ */ a("svg", {
210
- className: "w-3.5 h-3.5",
211
- fill: "none",
212
- stroke: "currentColor",
213
- viewBox: "0 0 24 24",
214
- children: /* @__PURE__ */ a("path", {
215
- strokeLinecap: "round",
216
- strokeLinejoin: "round",
217
- strokeWidth: 2,
218
- d: "M6 18L18 6M6 6l12 12"
219
- })
220
- })
221
- })]
222
- })]
223
- }),
224
- /* @__PURE__ */ a("p", {
225
- className: "text-xs text-text-secondary line-clamp-2 mt-0.5",
226
- children: c
227
- }),
228
- /* @__PURE__ */ o("div", {
229
- className: "flex items-center gap-2 mt-1.5 flex-wrap",
230
- children: [
231
- /* @__PURE__ */ a("span", {
232
- className: `inline-flex items-center px-1.5 py-0.5 text-[10px] font-medium rounded ${_.bgColor} ${_.color}`,
233
- children: _.label
234
- }),
235
- d && /* @__PURE__ */ a("span", {
236
- className: "inline-flex items-center px-1.5 py-0.5 text-[10px] font-medium rounded bg-bg-muted text-text-tertiary",
237
- children: d
238
- }),
239
- /* @__PURE__ */ a("span", {
240
- className: "text-[10px] text-text-tertiary",
241
- children: y(m)
242
- }),
243
- f && /* @__PURE__ */ o("button", {
244
- onClick: (e) => {
245
- e.stopPropagation(), r(f);
246
- },
247
- className: "inline-flex items-center gap-0.5 text-[10px] text-action-primary-bg hover:underline",
248
- "aria-label": "Open link",
249
- children: ["Open", /* @__PURE__ */ a("svg", {
250
- className: "w-2.5 h-2.5",
251
- fill: "none",
252
- stroke: "currentColor",
253
- viewBox: "0 0 24 24",
254
- children: /* @__PURE__ */ a("path", {
255
- strokeLinecap: "round",
256
- strokeLinejoin: "round",
257
- strokeWidth: 2,
258
- d: "M10 6H6a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2v-4M14 4h6m0 0v6m0-6L10 14"
259
- })
260
- })]
261
- })
262
- ]
263
- })
264
- ]
265
- })
266
- ]
267
- });
268
- }, b = () => /* @__PURE__ */ o("div", {
269
- className: "flex gap-3 p-3 rounded-card border border-border-subtle animate-pulse",
270
- children: [/* @__PURE__ */ a("div", { className: "w-6 h-6 rounded bg-bg-muted flex-shrink-0" }), /* @__PURE__ */ o("div", {
271
- className: "flex-1 space-y-2",
272
- children: [
273
- /* @__PURE__ */ a("div", { className: "h-4 bg-bg-muted rounded w-3/4" }),
274
- /* @__PURE__ */ a("div", { className: "h-3 bg-bg-muted rounded w-full" }),
275
- /* @__PURE__ */ o("div", {
276
- className: "flex gap-2",
277
- children: [/* @__PURE__ */ a("div", { className: "h-3 bg-bg-muted rounded w-12" }), /* @__PURE__ */ a("div", { className: "h-3 bg-bg-muted rounded w-16" })]
278
- })
279
- ]
280
- })]
281
- }), ne = ({ client: s, onViewAll: h, compact: y = !1, pollInterval: ne = 3e4, lazy: x = !1 }) => {
282
- let S = n(null), [C, w] = r(!1), [T, E] = r(!1), [D, O] = r([]), [k, A] = r(0), [j, M] = r({}), [N, P] = r(0), [F, I] = r(!1), [L, R] = r(null), [z, B] = r("all"), [V, H] = r("ALL"), [U, W] = r("ALL"), [G, re] = r("newest");
283
- t(() => {
284
- let e = window.matchMedia("(max-width: 767px)");
285
- E(e.matches);
286
- let t = (e) => E(e.matches);
287
- return e.addEventListener("change", t), () => e.removeEventListener("change", t);
288
- }, []), t(() => {
289
- if (!C || T) return;
290
- let e = (e) => {
291
- S.current && !S.current.contains(e.target) && w(!1);
292
- };
293
- return document.addEventListener("mousedown", e), () => document.removeEventListener("mousedown", e);
294
- }, [C, T]), t(() => {
295
- if (!C) return;
296
- let e = (e) => {
297
- e.key === "Escape" && w(!1);
298
- };
299
- return document.addEventListener("keydown", e), () => document.removeEventListener("keydown", e);
300
- }, [C]);
301
- let K = n(s);
302
- t(() => {
303
- K.current = s;
304
- }, [s]);
305
- let q = e(async () => {
306
- try {
307
- let e = (await K.current.query({
308
- query: l,
309
- variables: { filter: {
310
- channel: "IN_APP",
311
- archived: !1
312
- } },
313
- fetchPolicy: "network-only"
314
- })).data;
315
- A(e?.myUnreadNotificationCount ?? 0);
316
- } catch {}
317
- }, []), [J, ie] = r(!1);
318
- t(() => {
319
- let e = () => ie(!0);
320
- if (typeof window < "u" && "requestIdleCallback" in window) {
321
- let t = window.requestIdleCallback(e, { timeout: 2e3 });
322
- return () => {
323
- window.cancelIdleCallback?.(t);
324
- };
325
- }
326
- let t = setTimeout(e, 500);
327
- return () => clearTimeout(t);
328
- }, []), t(() => {
329
- if (x || !J) return;
330
- q();
331
- let e = K.current.subscribe({
332
- query: u,
333
- variables: { filter: {
334
- channel: "IN_APP",
335
- archived: !1
336
- } },
337
- fetchPolicy: "no-cache"
338
- }).subscribe({
339
- next: (e) => {
340
- let t = e.data;
341
- typeof t?.myUnreadNotificationCountStream == "number" && A(t.myUnreadNotificationCountStream);
342
- },
343
- error: () => {}
344
- }), t = setInterval(q, 300 * 1e3);
345
- return () => {
346
- e.unsubscribe(), clearInterval(t);
347
- };
348
- }, [
349
- q,
350
- x,
351
- J
352
- ]);
353
- let Y = e(async () => {
354
- I(!0), R(null);
355
- try {
356
- let e = {
357
- channel: "IN_APP",
358
- archived: !1
359
- };
360
- z === "unread" && (e.isRead = !1), z === "read" && (e.isRead = !0), V !== "ALL" && (e.type = V), U !== "ALL" && (e.appName = U);
361
- let t = (await K.current.query({
362
- query: c,
363
- variables: {
364
- filter: e,
365
- limit: 20,
366
- offset: 0
367
- },
368
- fetchPolicy: "network-only"
369
- })).data?.notifications;
370
- t && (O(t.items ?? []), P(t.total ?? 0));
371
- } catch (e) {
372
- R(e instanceof Error ? e.message : "Failed to load notifications");
373
- } finally {
374
- I(!1);
375
- }
376
- }, [
377
- z,
378
- V,
379
- U
380
- ]), X = e(async () => {
381
- try {
382
- let e = (await K.current.query({
383
- query: d,
384
- fetchPolicy: "network-only"
385
- })).data;
386
- M(e?.myNotificationCountsByApp ?? {});
387
- } catch {}
388
- }, []);
389
- t(() => {
390
- C && (x && q(), Y(), X(), q());
391
- }, [
392
- C,
393
- Y,
394
- X,
395
- q,
396
- x
397
- ]);
398
- let ae = e(() => {
399
- w((e) => !e);
400
- }, []), oe = e(async (e) => {
401
- try {
402
- await K.current.mutate({
403
- mutation: f,
404
- variables: { id: e }
405
- }), O((t) => t.map((t) => t.id === e ? {
406
- ...t,
407
- isRead: !0,
408
- readAt: (/* @__PURE__ */ new Date()).toISOString()
409
- } : t)), A((e) => Math.max(0, e - 1));
410
- } catch (e) {
411
- console.error("Failed to mark notification as read:", e);
412
- }
413
- }, []), se = e(async () => {
414
- try {
415
- await K.current.mutate({ mutation: p }), O((e) => e.map((e) => ({
416
- ...e,
417
- isRead: !0,
418
- readAt: e.readAt || (/* @__PURE__ */ new Date()).toISOString()
419
- }))), A(0);
420
- } catch (e) {
421
- console.error("Failed to mark all notifications as read:", e);
422
- }
423
- }, []), ce = e(async (e) => {
424
- try {
425
- await K.current.mutate({
426
- mutation: m,
427
- variables: { id: e }
428
- });
429
- let t = D.find((t) => t.id === e);
430
- O((t) => t.filter((t) => t.id !== e)), P((e) => Math.max(0, e - 1)), t && !t.isRead && A((e) => Math.max(0, e - 1));
431
- } catch (e) {
432
- console.error("Failed to delete notification:", e);
433
- }
434
- }, [D]), le = e((e) => {
13
+ var g = ({ client: g, onViewAll: _, compact: v = !1, pollInterval: y = 3e4, lazy: b = !1 }) => {
14
+ let x = f(null), [S, C] = p(!1), [w, T] = p("all"), [E, D] = p("ALL"), [O, k] = p("ALL"), [A, j] = p("newest"), M = d(() => C(!1), []), N = d(() => C((e) => !e), []), { isMobile: P } = u();
15
+ l(S, P, x, M), c(S, M);
16
+ let { notifications: F, unreadCount: I, countsByApp: L, totalCount: R, loading: z, error: B, fetchNotifications: V, handleMarkAsRead: H, handleMarkAllAsRead: U, handleDelete: W } = s({
17
+ client: g,
18
+ isOpen: S,
19
+ lazy: b,
20
+ filterTab: w,
21
+ typeFilter: E,
22
+ appFilter: O
23
+ }), G = d((e) => {
435
24
  window.open(e, "_blank", "noopener,noreferrer");
436
- }, []), ue = e(() => {
437
- w(!1), h?.();
438
- }, [h]), Z = ee(D, G), Q = Object.entries(j).filter(([e]) => e && e !== "null").sort((e, t) => t[1] - e[1]), $ = /* @__PURE__ */ o("div", {
439
- className: "flex flex-col h-full",
440
- children: [
441
- /* @__PURE__ */ o("div", {
442
- className: "flex items-center justify-between p-4 border-b border-border-subtle",
443
- children: [/* @__PURE__ */ o("div", {
444
- className: "flex items-center gap-2",
445
- children: [
446
- T && /* @__PURE__ */ a("button", {
447
- onClick: () => w(!1),
448
- className: "p-1 rounded-button hover:bg-action-ghost-bg-hover text-text-primary",
449
- "aria-label": "Close",
450
- children: /* @__PURE__ */ a("svg", {
451
- className: "w-5 h-5",
452
- fill: "none",
453
- stroke: "currentColor",
454
- viewBox: "0 0 24 24",
455
- children: /* @__PURE__ */ a("path", {
456
- strokeLinecap: "round",
457
- strokeLinejoin: "round",
458
- strokeWidth: 2,
459
- d: "M15 19l-7-7 7-7"
460
- })
461
- })
462
- }),
463
- /* @__PURE__ */ a("svg", {
464
- className: "w-5 h-5 text-text-primary",
465
- fill: "none",
466
- stroke: "currentColor",
467
- viewBox: "0 0 24 24",
468
- children: /* @__PURE__ */ a("path", {
469
- strokeLinecap: "round",
470
- strokeLinejoin: "round",
471
- strokeWidth: 2,
472
- d: "M15 17h5l-1.405-1.405A2.032 2.032 0 0118 14.158V11a6.002 6.002 0 00-4-5.659V5a2 2 0 10-4 0v.341C7.67 6.165 6 8.388 6 11v3.159c0 .538-.214 1.055-.595 1.436L4 17h5m6 0v1a3 3 0 11-6 0v-1m6 0H9"
473
- })
474
- }),
475
- /* @__PURE__ */ a("h2", {
476
- className: "text-sm font-semibold text-text-primary",
477
- children: "Notifications"
478
- }),
479
- k > 0 && /* @__PURE__ */ a("span", {
480
- className: "inline-flex items-center justify-center min-w-[20px] h-5 px-1.5 text-xs font-semibold text-action-primary-text bg-action-primary-bg rounded-full",
481
- children: k > 9 ? "9+" : k
482
- })
483
- ]
484
- }), /* @__PURE__ */ o("div", {
485
- className: "flex items-center gap-2",
486
- children: [k > 0 && /* @__PURE__ */ a("button", {
487
- onClick: se,
488
- className: "text-xs text-action-primary-bg hover:underline font-medium",
489
- children: "Mark all read"
490
- }), !T && /* @__PURE__ */ a("button", {
491
- onClick: () => w(!1),
492
- className: "p-1 rounded-button hover:bg-action-ghost-bg-hover text-text-tertiary",
493
- "aria-label": "Close panel",
494
- children: /* @__PURE__ */ a("svg", {
495
- className: "w-4 h-4",
496
- fill: "none",
497
- stroke: "currentColor",
498
- viewBox: "0 0 24 24",
499
- children: /* @__PURE__ */ a("path", {
500
- strokeLinecap: "round",
501
- strokeLinejoin: "round",
502
- strokeWidth: 2,
503
- d: "M6 18L18 6M6 6l12 12"
504
- })
505
- })
506
- })]
507
- })]
508
- }),
509
- /* @__PURE__ */ o("div", {
510
- className: "px-4 pt-3 pb-2 space-y-2 border-b border-border-subtle",
25
+ }, []), K = d(() => {
26
+ C(!1), _?.();
27
+ }, [_]), q = t(F, A), J = Object.entries(L).filter(([e]) => e && e !== "null").sort((e, t) => t[1] - e[1]);
28
+ return /* @__PURE__ */ h("div", {
29
+ ref: x,
30
+ className: "relative",
31
+ children: [/* @__PURE__ */ m(e, {
32
+ unreadCount: I,
33
+ isOpen: S,
34
+ onToggle: N
35
+ }), S && /* @__PURE__ */ m(o, {
36
+ isMobile: P,
37
+ onClose: M,
38
+ children: /* @__PURE__ */ h("div", {
39
+ className: "flex flex-col h-full",
511
40
  children: [
512
- /* @__PURE__ */ a("div", {
513
- className: "flex gap-1",
514
- children: _.map((e) => /* @__PURE__ */ a("button", {
515
- onClick: () => B(e.value),
516
- className: `px-3 py-1 text-xs font-medium rounded-full transition-colors ${z === e.value ? "bg-action-primary-bg text-action-primary-text" : "bg-bg-muted text-text-secondary hover:bg-action-ghost-bg-hover"}`,
517
- children: e.label
518
- }, e.value))
41
+ /* @__PURE__ */ m(i, {
42
+ isMobile: P,
43
+ unreadCount: I,
44
+ onClose: M,
45
+ onMarkAllAsRead: U
46
+ }),
47
+ /* @__PURE__ */ m(n, {
48
+ filterTab: w,
49
+ typeFilter: E,
50
+ appFilter: O,
51
+ sortBy: A,
52
+ appNames: J,
53
+ onFilterTabChange: T,
54
+ onTypeFilterChange: D,
55
+ onAppFilterChange: k,
56
+ onSortByChange: j
519
57
  }),
520
- /* @__PURE__ */ o("div", {
521
- className: "flex flex-wrap items-center gap-1",
522
- children: [v.map((e) => /* @__PURE__ */ o("button", {
523
- onClick: () => H(e.value),
524
- className: `px-2 py-0.5 text-[11px] font-medium rounded-full whitespace-nowrap transition-colors ${V === e.value ? "bg-bg-elevated text-text-primary border border-border-default" : "text-text-tertiary hover:text-text-secondary hover:bg-bg-muted"}`,
525
- children: [e.value !== "ALL" && g[e.value] && /* @__PURE__ */ a("span", {
526
- className: "mr-0.5",
527
- children: g[e.value].icon
528
- }), e.label]
529
- }, e.value)), /* @__PURE__ */ o("select", {
530
- value: G,
531
- onChange: (e) => re(e.target.value),
532
- className: "ml-auto text-[11px] text-text-secondary bg-transparent border-none cursor-pointer focus:outline-none",
533
- "aria-label": "Sort notifications",
534
- children: [
535
- /* @__PURE__ */ a("option", {
536
- value: "newest",
537
- children: "Newest"
538
- }),
539
- /* @__PURE__ */ a("option", {
540
- value: "oldest",
541
- children: "Oldest"
542
- }),
543
- /* @__PURE__ */ a("option", {
544
- value: "priority",
545
- children: "Priority"
546
- })
547
- ]
548
- })]
58
+ /* @__PURE__ */ m(a, {
59
+ loading: z,
60
+ error: B,
61
+ notifications: q,
62
+ filterTab: w,
63
+ typeFilter: E,
64
+ appFilter: O,
65
+ onRetry: V,
66
+ onMarkAsRead: H,
67
+ onDelete: W,
68
+ onRedirect: G
549
69
  }),
550
- Q.length > 1 && /* @__PURE__ */ o("div", {
551
- className: "flex flex-wrap gap-1",
552
- children: [/* @__PURE__ */ a("button", {
553
- onClick: () => W("ALL"),
554
- className: `px-2 py-0.5 text-[11px] font-medium rounded-full whitespace-nowrap transition-colors ${U === "ALL" ? "bg-bg-elevated text-text-primary border border-border-default" : "text-text-tertiary hover:text-text-secondary hover:bg-bg-muted"}`,
555
- children: "All Apps"
556
- }), Q.map(([e, t]) => /* @__PURE__ */ o("button", {
557
- onClick: () => W(e),
558
- className: `px-2 py-0.5 text-[11px] font-medium rounded-full whitespace-nowrap transition-colors ${U === e ? "bg-bg-elevated text-text-primary border border-border-default" : "text-text-tertiary hover:text-text-secondary hover:bg-bg-muted"}`,
559
- children: [e, /* @__PURE__ */ o("span", {
560
- className: "ml-1 text-text-tertiary",
561
- children: [
562
- "(",
563
- t,
564
- ")"
565
- ]
566
- })]
567
- }, e))]
70
+ q.length > 0 && /* @__PURE__ */ m(r, {
71
+ totalCount: R,
72
+ onViewAll: _ ? K : void 0
568
73
  })
569
74
  ]
570
- }),
571
- /* @__PURE__ */ a("div", {
572
- className: "flex-1 overflow-y-auto",
573
- children: F ? /* @__PURE__ */ o("div", {
574
- className: "p-3 space-y-2",
575
- children: [
576
- /* @__PURE__ */ a(b, {}),
577
- /* @__PURE__ */ a(b, {}),
578
- /* @__PURE__ */ a(b, {})
579
- ]
580
- }) : L ? /* @__PURE__ */ o("div", {
581
- className: "flex flex-col items-center justify-center p-8 text-center",
582
- children: [
583
- /* @__PURE__ */ a("svg", {
584
- className: "w-10 h-10 text-status-error-text mb-3",
585
- fill: "none",
586
- stroke: "currentColor",
587
- viewBox: "0 0 24 24",
588
- children: /* @__PURE__ */ a("path", {
589
- strokeLinecap: "round",
590
- strokeLinejoin: "round",
591
- strokeWidth: 2,
592
- d: "M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-2.5L13.732 4c-.77-.833-1.964-.833-2.732 0L4.082 16.5c-.77.833.192 2.5 1.732 2.5z"
593
- })
594
- }),
595
- /* @__PURE__ */ a("p", {
596
- className: "text-sm text-text-secondary mb-2",
597
- children: "Failed to load notifications"
598
- }),
599
- /* @__PURE__ */ a("button", {
600
- onClick: Y,
601
- className: "text-xs text-action-primary-bg hover:underline font-medium",
602
- children: "Try again"
603
- })
604
- ]
605
- }) : Z.length === 0 ? /* @__PURE__ */ o("div", {
606
- className: "flex flex-col items-center justify-center p-8 text-center",
607
- children: [
608
- /* @__PURE__ */ a("svg", {
609
- className: "w-12 h-12 text-text-tertiary mb-3",
610
- fill: "none",
611
- stroke: "currentColor",
612
- viewBox: "0 0 24 24",
613
- children: /* @__PURE__ */ a("path", {
614
- strokeLinecap: "round",
615
- strokeLinejoin: "round",
616
- strokeWidth: 1.5,
617
- d: "M15 17h5l-1.405-1.405A2.032 2.032 0 0118 14.158V11a6.002 6.002 0 00-4-5.659V5a2 2 0 10-4 0v.341C7.67 6.165 6 8.388 6 11v3.159c0 .538-.214 1.055-.595 1.436L4 17h5m6 0v1a3 3 0 11-6 0v-1m6 0H9"
618
- })
619
- }),
620
- /* @__PURE__ */ a("p", {
621
- className: "text-sm font-medium text-text-primary",
622
- children: "You're all caught up!"
623
- }),
624
- /* @__PURE__ */ a("p", {
625
- className: "text-xs text-text-tertiary mt-1",
626
- children: z !== "all" || V !== "ALL" || U !== "ALL" ? "No notifications match your filters" : "No notifications yet"
627
- })
628
- ]
629
- }) : /* @__PURE__ */ a("div", {
630
- className: "p-2 space-y-1.5",
631
- children: Z.map((e) => /* @__PURE__ */ a(te, {
632
- notification: e,
633
- onMarkAsRead: oe,
634
- onDelete: ce,
635
- onRedirect: le
636
- }, e.id))
637
- })
638
- }),
639
- Z.length > 0 && /* @__PURE__ */ a("div", {
640
- className: "p-3 border-t border-border-subtle",
641
- children: /* @__PURE__ */ o("div", {
642
- className: "flex items-center justify-between",
643
- children: [/* @__PURE__ */ o("span", {
644
- className: "text-[11px] text-text-tertiary",
645
- children: [
646
- N,
647
- " notification",
648
- N === 1 ? "" : "s"
649
- ]
650
- }), h && /* @__PURE__ */ a("button", {
651
- onClick: ue,
652
- className: "text-xs text-action-primary-bg hover:underline font-medium",
653
- children: "View All"
654
- })]
655
- })
656
75
  })
657
- ]
658
- });
659
- return /* @__PURE__ */ o("div", {
660
- ref: S,
661
- className: "relative",
662
- children: [
663
- /* @__PURE__ */ o("button", {
664
- onClick: ae,
665
- className: "relative p-2 hover:bg-action-ghost-bg-hover rounded-button text-text-primary",
666
- "aria-label": `Notifications${k > 0 ? ` (${k} unread)` : ""}`,
667
- "aria-expanded": C,
668
- "aria-haspopup": "true",
669
- children: [/* @__PURE__ */ a("svg", {
670
- className: "w-icon-md h-icon-md",
671
- fill: "none",
672
- stroke: "currentColor",
673
- viewBox: "0 0 24 24",
674
- children: /* @__PURE__ */ a("path", {
675
- strokeLinecap: "round",
676
- strokeLinejoin: "round",
677
- strokeWidth: 2,
678
- d: "M15 17h5l-1.405-1.405A2.032 2.032 0 0118 14.158V11a6.002 6.002 0 00-4-5.659V5a2 2 0 10-4 0v.341C7.67 6.165 6 8.388 6 11v3.159c0 .538-.214 1.055-.595 1.436L4 17h5m6 0v1a3 3 0 11-6 0v-1m6 0H9"
679
- })
680
- }), k > 0 && /* @__PURE__ */ a("span", {
681
- className: "absolute -top-0.5 -right-0.5 flex items-center justify-center min-w-[18px] h-[18px] px-1 text-[10px] font-bold text-action-primary-text bg-action-primary-bg rounded-full border-2 border-bg-elevated",
682
- children: k > 9 ? "9+" : k
683
- })]
684
- }),
685
- C && !T && /* @__PURE__ */ a("div", {
686
- className: "absolute right-0 top-full mt-2 w-[calc(100vw-1.5rem)] sm:w-[420px] max-h-[600px] bg-bg-elevated border border-border-subtle rounded-card shadow-popover z-50 overflow-hidden flex flex-col",
687
- role: "dialog",
688
- "aria-label": "Notifications panel",
689
- children: $
690
- }),
691
- C && T && /* @__PURE__ */ o(i, { children: [/* @__PURE__ */ a("div", {
692
- className: "fixed inset-0 bg-black/50 z-[60]",
693
- onClick: () => w(!1),
694
- "aria-hidden": "true"
695
- }), /* @__PURE__ */ a("div", {
696
- className: "fixed inset-x-0 bottom-0 top-0 bg-bg-elevated z-[70] flex flex-col",
697
- role: "dialog",
698
- "aria-label": "Notifications panel",
699
- children: $
700
- })] })
701
- ]
76
+ })]
702
77
  });
703
78
  };
704
79
  //#endregion
705
- export { ne as NotificationCenter };
80
+ export { g as NotificationCenter };