@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,810 +1,216 @@
1
- import { Button as e } from "../../ui/button.js";
2
- import { useGatewayClient as t } from "../graphql/GatewayContext.js";
1
+ import { useGatewayClient as e } from "../graphql/GatewayContext.js";
3
2
  import "../../shared-graphql.js";
4
- import { useAuth as n } from "../providers/shell/AuthProvider.js";
5
- import { useActiveContext as r } from "../providers/shell/ActiveContextProvider.js";
6
- import { Badge as i } from "../../ui/badge.js";
7
- import { Card as a, CardContent as o, CardHeader as s, CardTitle as ee } from "../../ui/card.js";
8
- import { Textarea as te } from "../../ui/textarea.js";
3
+ import { useAuth as t } from "../providers/shell/AuthProvider.js";
4
+ import { useActiveContext as n } from "../providers/shell/ActiveContextProvider.js";
5
+ import { Card as r, CardContent as ee } from "../../ui/card.js";
9
6
  import "../../ui.js";
10
- import { useI18n as ne } from "../providers/shell/I18nProvider.js";
11
- import { usePageConversationContext as re } from "../providers/shell/PageConversationContextProvider.js";
7
+ import { useI18n as te } from "../providers/shell/I18nProvider.js";
8
+ import { usePageConversationContext as ne } from "../providers/shell/PageConversationContextProvider.js";
12
9
  import "../../shared-providers-shell.js";
13
- import { useEffect as c, useMemo as l, useRef as ie, useState as u } from "react";
14
- import { ChevronDown as ae, ChevronUp as oe, ExternalLink as se, Loader2 as ce, MessageCircle as le, Paperclip as ue, Pencil as de, Pin as fe, PinOff as pe, Reply as me, SendHorizontal as he, SmilePlus as ge, Trash2 as _e, X as ve } from "lucide-react";
15
- import { Fragment as ye, jsx as d, jsxs as f } from "react/jsx-runtime";
16
- import { gql as p } from "@apollo/client";
17
- import { useMutation as m, useQuery as h, useSubscription as g } from "@apollo/client/react";
18
- import { useNavigate as be } from "react-router-dom";
10
+ import { Composer as i } from "./contextConversationWidget/Composer.js";
11
+ import { getSourceContext as a, getString as o, normalizeThreadSegment as s, sourceContextMatches as re } from "./contextConversationWidget/utils.js";
12
+ import { MessageList as c } from "./contextConversationWidget/MessageList.js";
13
+ import { NoWorkspaceCard as l } from "./contextConversationWidget/NoWorkspaceCard.js";
14
+ import { PendingAttachmentsBar as ie } from "./contextConversationWidget/PendingAttachmentsBar.js";
15
+ import { GET_CONTEXT_CONVERSATIONS as ae, GET_WIDGET_CONVERSATION as oe, GET_WIDGET_MESSAGES as se } from "./contextConversationWidget/queries.js";
16
+ import { ReplyBanner as ce } from "./contextConversationWidget/ReplyBanner.js";
17
+ import { useAttachmentUpload as le } from "./contextConversationWidget/useAttachmentUpload.js";
18
+ import { useConversationSubscriptions as ue } from "./contextConversationWidget/useConversationSubscriptions.js";
19
+ import { useMessageActions as de } from "./contextConversationWidget/useMessageActions.js";
20
+ import { useSendMessage as fe } from "./contextConversationWidget/useSendMessage.js";
21
+ import { useWidgetMessages as pe } from "./contextConversationWidget/useWidgetMessages.js";
22
+ import { WidgetHeader as me } from "./contextConversationWidget/WidgetHeader.js";
23
+ import { useEffect as u, useMemo as d, useRef as he, useState as f } from "react";
24
+ import { jsx as p, jsxs as m } from "react/jsx-runtime";
25
+ import { useQuery as h } from "@apollo/client/react";
26
+ import { useNavigate as ge } from "react-router-dom";
19
27
  //#region src/shared/components/ContextConversationWidget.tsx
20
- var xe = p`
21
- mutation ContextConversationWidget_SendContextMessage(
22
- $input: SendContextConversationMessageInput!
23
- ) {
24
- sendContextMessage(input: $input) {
25
- success
26
- message {
27
- id
28
- conversationId
29
- }
30
- }
31
- }
32
- `, Se = p`
33
- query ContextConversationWidget_GetConversation($id: ID!) {
34
- conversation(id: $id) {
35
- id
36
- title
37
- description
38
- settings
39
- updatedAt
40
- features {
41
- threads
42
- reactions
43
- mentions
44
- }
45
- currentUserMembership {
46
- unreadCount
47
- }
48
- }
49
- }
50
- `, Ce = p`
51
- query ContextConversationWidget_GetContextConversations($first: Int) {
52
- conversations(first: $first) {
53
- edges {
54
- node {
55
- id
56
- settings
57
- }
58
- }
59
- }
60
- }
61
- `, _ = p`
62
- query ContextConversationWidget_GetMessages($conversationId: ID!, $first: Int) {
63
- messages(conversationId: $conversationId, first: $first) {
64
- edges {
65
- node {
66
- id
67
- conversationId
68
- type
69
- status
70
- content
71
- authorId
72
- authorType
73
- parentMessageId
74
- threadRootId
75
- threadLevel
76
- isEdited
77
- editedAt
78
- isPinned
79
- createdAt
80
- updatedAt
81
- replyCount
82
- permissions {
83
- canEdit
84
- canDelete
85
- canReact
86
- canReply
87
- canPin
88
- }
89
- reactions {
90
- id
91
- emoji
92
- userId
93
- createdAt
94
- }
95
- attachments {
96
- id
97
- fileId
98
- fileName
99
- fileSize
100
- mimeType
101
- downloadUrl
102
- thumbnail
103
- width
104
- height
105
- duration
106
- }
107
- }
108
- }
109
- }
110
- }
111
- `, we = p`
112
- subscription ContextConversationWidget_MessageAdded($conversationId: ID!) {
113
- messageAdded(conversationId: $conversationId) {
114
- id
115
- conversationId
116
- type
117
- status
118
- content
119
- authorId
120
- authorType
121
- parentMessageId
122
- threadRootId
123
- threadLevel
124
- isEdited
125
- editedAt
126
- isPinned
127
- createdAt
128
- updatedAt
129
- replyCount
130
- }
131
- }
132
- `, Te = p`
133
- subscription ContextConversationWidget_MessageUpdated($conversationId: ID!) {
134
- messageUpdated(conversationId: $conversationId) {
135
- id
136
- conversationId
137
- content
138
- isEdited
139
- editedAt
140
- updatedAt
141
- }
142
- }
143
- `, Ee = p`
144
- subscription ContextConversationWidget_MessageDeleted($conversationId: ID!) {
145
- messageDeleted(conversationId: $conversationId) {
146
- messageId
147
- conversationId
148
- }
149
- }
150
- `, De = p`
151
- mutation ContextConversationWidget_EditMessage($input: EditMessageInput!) {
152
- editMessage(input: $input) {
153
- id
154
- content
155
- isEdited
156
- editedAt
157
- updatedAt
158
- }
159
- }
160
- `, Oe = p`
161
- mutation ContextConversationWidget_DeleteMessage($id: ID!, $hard: Boolean) {
162
- deleteMessage(id: $id, hard: $hard) {
163
- success
164
- }
165
- }
166
- `, ke = p`
167
- mutation ContextConversationWidget_AddReaction($messageId: ID!, $emoji: String!) {
168
- addReaction(messageId: $messageId, emoji: $emoji) {
169
- id
170
- }
171
- }
172
- `, Ae = p`
173
- mutation ContextConversationWidget_RemoveReaction($messageId: ID!, $emoji: String!) {
174
- removeReaction(messageId: $messageId, emoji: $emoji) {
175
- success
176
- }
177
- }
178
- `, je = p`
179
- mutation ContextConversationWidget_PinMessage($messageId: ID!) {
180
- pinMessage(messageId: $messageId) {
181
- id
182
- }
183
- }
184
- `, Me = p`
185
- mutation ContextConversationWidget_UnpinMessage($messageId: ID!) {
186
- unpinMessage(messageId: $messageId) {
187
- id
188
- }
189
- }
190
- `, Ne = p`
191
- mutation ContextConversationWidget_InitiateUpload($input: InitiateUploadInput!) {
192
- initiateUpload(input: $input) {
193
- uploadUrl
194
- session {
195
- id
196
- }
197
- }
198
- }
199
- `, Pe = p`
200
- mutation ContextConversationWidget_CompleteUpload($input: CompleteUploadInput!) {
201
- completeUpload(input: $input) {
202
- fileId
203
- file {
204
- id
205
- name
206
- mimeType
207
- size
208
- downloadUrl
209
- }
210
- }
211
- }
212
- `, Fe = [
213
- "👍",
214
- "❤️",
215
- "🎉",
216
- "👀",
217
- "✅"
218
- ], Ie = 5 * 1024 * 1024;
219
- function v(e) {
220
- return e.trim().toLowerCase().replace(/[^a-z0-9:_/-]+/g, "-").replace(/-+/g, "-").replace(/^-|-$/g, "");
221
- }
222
- function y(e) {
223
- if (typeof e != "string" || !e.trim()) return null;
224
- try {
225
- let t = typeof window < "u" ? window.location.origin : "http://local";
226
- return v(new URL(e, t).pathname);
227
- } catch {
228
- return v(e.split(/[?#]/)[0] ?? e);
229
- }
230
- }
231
- function b(e) {
232
- return typeof e == "string" && e.trim() ? e : null;
233
- }
234
- function Le(e) {
235
- if (!e || typeof e != "object" || Array.isArray(e)) return null;
236
- let t = e.metadata;
237
- if (!t || typeof t != "object" || Array.isArray(t)) return null;
238
- let n = t.sourceContext;
239
- return n && typeof n == "object" && !Array.isArray(n) ? n : null;
240
- }
241
- function Re(e, t) {
242
- if (!e) return !1;
243
- let n = b(e.product);
244
- if (n && n !== t.product) return !1;
245
- let r = b(e.widgetKey);
246
- if (r && r !== t.widgetKey) return !1;
247
- if (b(e.threadKey) === t.threadKey) return !0;
248
- let i = b(e.entityType), a = b(e.entityId);
249
- if (i && a && i === t.entityType && a === t.entityId) return !0;
250
- let o = [y(e.pagePath), y(e.contextHref)].filter((e) => !!e), s = [y(t.pagePath), y(t.contextHref)].filter((e) => !!e);
251
- return o.some((e) => s.includes(e));
252
- }
253
- function ze(e) {
254
- if (typeof e == "string") return e;
255
- if (e && typeof e == "object") {
256
- let t = e;
257
- if (typeof t.text == "string") return t.text;
258
- if (typeof t.markdown == "string") return t.markdown;
259
- if (typeof t.html == "string") return t.html;
260
- }
261
- return "";
262
- }
263
- function Be(e) {
264
- return e < 1024 ? `${e} B` : e < 1024 * 1024 ? `${(e / 1024).toFixed(1)} KB` : `${(e / (1024 * 1024)).toFixed(1)} MB`;
265
- }
266
- function Ve(e) {
267
- return new Date(e).toLocaleTimeString([], {
268
- hour: "2-digit",
269
- minute: "2-digit"
270
- });
271
- }
272
- function x({ className: p, widgetKey: y }) {
273
- let { t: x } = ne(), { workspaceId: S } = r(), C = n(), w = re(), T = t("workspace"), E = be(), [D, O] = u(null), [He, k] = u(null), [A, j] = u(""), [M, Ue] = u(() => typeof window < "u" ? window.innerWidth < 768 : !1), [N, P] = u(null), [F, I] = u(null), [L, R] = u(""), [z, We] = u(!1), [B, V] = u([]), [Ge, H] = u(null), [Ke, qe] = u([]), [Je, Ye] = u(!1), U = ie(null), Xe = ie(null), W = l(() => (e, t) => {
274
- let n = x(e);
28
+ function g({ className: g, widgetKey: _ }) {
29
+ let { t: v } = te(), { workspaceId: y } = n(), b = t(), x = ne(), S = e("workspace"), C = ge(), [w, T] = f(null), [E, D] = f(null), [O, k] = f(""), [A, _e] = f(() => typeof window < "u" ? window.innerWidth < 768 : !1), [j, M] = f(null), [N, P] = f(null), [F, I] = f(""), [L, R] = f(null), [z, B] = f([]), V = he(null), H = d(() => (e, t) => {
30
+ let n = v(e);
275
31
  return n === e ? t : n;
276
- }, [x]), G = C.user?.id ?? null, K = y ?? w.widgetKey ?? "default", q = T, J = l(() => {
277
- let e = v(w.entityType && w.entityId ? `${w.entityType}:${w.entityId}` : w.pagePath || w.contextHref), t = v(K);
32
+ }, [v]), U = b.user?.id ?? null, W = _ ?? x.widgetKey ?? "default", G = d(() => {
33
+ let e = x.entityType && x.entityId ? `${x.entityType}:${x.entityId}` : x.pagePath || x.contextHref;
278
34
  return {
279
- ...w,
280
- widgetKey: K,
281
- threadKey: `${w.product}:${S}:${e}:widget:${t}`
35
+ ...x,
36
+ widgetKey: W,
37
+ threadKey: `${x.product}:${y}:${s(e)}:widget:${s(W)}`
282
38
  };
283
39
  }, [
284
- K,
285
- w,
286
- S
40
+ W,
41
+ x,
42
+ y
287
43
  ]);
288
- c(() => {
289
- O(null), k(null), P(null), I(null), R(""), H(null);
290
- }, [J.threadKey]);
291
- let [Ze] = m(De, { client: q }), [Qe] = m(Oe, { client: q }), [$e] = m(ke, { client: q }), [et] = m(Ae, { client: q }), [tt] = m(je, { client: q }), [nt] = m(Me, { client: q }), [rt] = m(Ne, { client: T }), [it] = m(Pe, { client: T }), Y = h(Se, {
292
- client: q,
293
- variables: { id: D },
294
- skip: !D,
44
+ u(() => {
45
+ T(null), D(null), M(null), P(null), I(""), R(null);
46
+ }, [G.threadKey]);
47
+ let K = h(oe, {
48
+ client: S,
49
+ variables: { id: w },
50
+ skip: !w,
295
51
  pollInterval: 3e5,
296
52
  fetchPolicy: "cache-and-network"
297
- }), at = h(Ce, {
298
- client: q,
53
+ }), q = h(ae, {
54
+ client: S,
299
55
  variables: { first: 100 },
300
- skip: !S || !G || !!D,
56
+ skip: !y || !U || !!w,
301
57
  fetchPolicy: "cache-and-network"
302
- }), X = h(_, {
303
- client: q,
58
+ }), J = h(se, {
59
+ client: S,
304
60
  variables: {
305
- conversationId: D,
61
+ conversationId: w,
306
62
  first: 100
307
63
  },
308
- skip: !D,
64
+ skip: !w,
309
65
  fetchPolicy: "cache-and-network"
310
66
  });
311
- g(we, {
312
- client: q,
313
- variables: { conversationId: D || "" },
314
- skip: !D,
315
- onData: ({ data: e, client: t }) => {
316
- e.data?.messageAdded && t.refetchQueries({ include: [_] });
317
- }
318
- }), g(Te, {
319
- client: q,
320
- variables: { conversationId: D || "" },
321
- skip: !D
322
- }), g(Ee, {
323
- client: q,
324
- variables: { conversationId: D || "" },
325
- skip: !D,
326
- onData: ({ client: e }) => {
327
- e.refetchQueries({ include: [_] });
328
- }
329
- });
330
- let ot = (Y.data?.conversation?.settings ?? {}).metadata?.sourceContext, st = typeof ot?.contextHref == "string" ? ot.contextHref : J.contextHref, Z = l(() => (X.data?.messages?.edges ?? []).map((e) => {
331
- let t = e.node;
332
- return {
333
- id: String(t.id ?? ""),
334
- conversationId: String(t.conversationId ?? ""),
335
- content: ze(t.content),
336
- authorId: String(t.authorId ?? ""),
337
- parentMessageId: t.parentMessageId ? String(t.parentMessageId) : void 0,
338
- threadLevel: Number(t.threadLevel ?? 0),
339
- replyCount: Number(t.replyCount ?? 0),
340
- createdAt: String(t.createdAt ?? (/* @__PURE__ */ new Date()).toISOString()),
341
- updatedAt: String(t.updatedAt ?? (/* @__PURE__ */ new Date()).toISOString()),
342
- isEdited: !!t.isEdited,
343
- isPinned: !!t.isPinned,
344
- permissions: {
345
- canEdit: !!t.permissions?.canEdit,
346
- canDelete: !!t.permissions?.canDelete,
347
- canReact: !!(t.permissions?.canReact ?? !0),
348
- canReply: !!(t.permissions?.canReply ?? !0),
349
- canPin: !!t.permissions?.canPin
350
- },
351
- reactions: (t.reactions ?? []).map((e) => ({
352
- id: String(e.id ?? ""),
353
- emoji: String(e.emoji ?? ""),
354
- userId: String(e.userId ?? "")
355
- })),
356
- attachments: (t.attachments ?? []).map((e) => ({
357
- id: String(e.id ?? ""),
358
- fileId: String(e.fileId ?? ""),
359
- fileName: String(e.fileName ?? e.fileId ?? "Attachment"),
360
- fileSize: Number(e.fileSize ?? 0),
361
- mimeType: String(e.mimeType ?? "application/octet-stream"),
362
- downloadUrl: e.downloadUrl ? String(e.downloadUrl) : null,
363
- thumbnail: e.thumbnail ? String(e.thumbnail) : null
364
- }))
365
- };
366
- }), [X.data]);
367
- c(() => {
368
- if (D) return;
369
- let e = (at.data?.conversations?.edges ?? []).find((e) => Re(Le(e.node?.settings), J)), t = e?.node?.id;
370
- t && (O(t), k(b(Le(e.node?.settings)?.threadKey) ?? J.threadKey));
67
+ ue(S, w);
68
+ let Y = le({
69
+ workspaceClient: S,
70
+ onError: R
71
+ }), X = de({
72
+ client: S,
73
+ currentUserId: U,
74
+ refetchMessages: () => J.refetch()
75
+ }), Z = fe({
76
+ client: S,
77
+ workspaceId: y,
78
+ onError: R
79
+ }), Q = pe(J.data), ve = d(() => {
80
+ let e = (K.data?.conversation?.settings ?? {}).metadata?.sourceContext;
81
+ return typeof e?.contextHref == "string" ? e.contextHref : G.contextHref;
82
+ }, [K.data, G.contextHref]);
83
+ u(() => {
84
+ if (w) return;
85
+ let e = (q.data?.conversations?.edges ?? []).find((e) => re(a(e.node?.settings), G));
86
+ e?.node?.id && (T(e.node.id), D(o(a(e.node?.settings)?.threadKey) ?? G.threadKey));
371
87
  }, [
372
- at.data,
373
- D,
374
- J
88
+ q.data,
89
+ w,
90
+ G
375
91
  ]);
376
- let ct = l(() => {
377
- let e = /* @__PURE__ */ new Map();
378
- G && e.set(G, {
379
- id: G,
380
- label: C.user?.name || C.user?.email || G
92
+ let ye = d(() => {
93
+ let e = O.match(/(^|\s)@([^\s@]*)$/)?.[2]?.toLowerCase() ?? null;
94
+ if (!e) return [];
95
+ let t = /* @__PURE__ */ new Map();
96
+ U && t.set(U, {
97
+ id: U,
98
+ label: b.user?.name || b.user?.email || U
381
99
  });
382
- for (let t of Z) e.has(t.authorId) || e.set(t.authorId, {
383
- id: t.authorId,
384
- label: t.authorId
100
+ for (let e of Q) t.has(e.authorId) || t.set(e.authorId, {
101
+ id: e.authorId,
102
+ label: e.authorId
385
103
  });
386
- return Array.from(e.values());
104
+ return Array.from(t.values()).filter((t) => `${t.label} ${t.id}`.toLowerCase().includes(e));
387
105
  }, [
388
- C.user?.email,
389
- C.user?.name,
390
- G,
391
- Z
392
- ]), Q = l(() => A.match(/(^|\s)@([^\s@]*)$/)?.[2]?.toLowerCase() ?? null, [A]), lt = l(() => Q ? ct.filter((e) => `${e.label} ${e.id}`.toLowerCase().includes(Q)) : [], [Q, ct]), $ = l(() => {
393
- let e = Y.data?.conversation?.features;
106
+ O,
107
+ b.user?.email,
108
+ b.user?.name,
109
+ U,
110
+ Q
111
+ ]), $ = d(() => {
112
+ let e = K.data?.conversation?.features;
394
113
  return {
395
114
  threads: !!(e?.threads ?? !0),
396
115
  reactions: !!(e?.reactions ?? !0),
397
116
  mentions: !!(e?.mentions ?? !0)
398
117
  };
399
- }, [Y.data]);
400
- if (c(() => {
401
- Xe.current?.scrollIntoView({ behavior: "smooth" });
402
- }, [Z.length, M]), !G) return null;
403
- if (!S) return /* @__PURE__ */ f(a, {
404
- className: p,
405
- children: [/* @__PURE__ */ d(s, { children: /* @__PURE__ */ f(ee, {
406
- className: "flex items-center gap-2 text-base",
407
- children: [/* @__PURE__ */ d(le, { className: "h-4 w-4" }), W("conversationWidget.title", "Page conversation")]
408
- }) }), /* @__PURE__ */ d(o, { children: /* @__PURE__ */ d("p", {
409
- className: "text-sm text-muted-foreground",
410
- children: W("conversationWidget.noWorkspace", "Select a workspace to enable contextual conversations on this page.")
411
- }) })]
118
+ }, [K.data]);
119
+ if (u(() => {
120
+ V.current?.scrollIntoView({ behavior: "smooth" });
121
+ }, [Q.length, A]), !U) return null;
122
+ if (!y) return /* @__PURE__ */ p(l, {
123
+ className: g,
124
+ tr: H
412
125
  });
413
- let ut = async (e) => {
414
- if (!(!e || e.length === 0)) {
415
- We(!0), H(null);
416
- try {
417
- let t = [];
418
- for (let n of Array.from(e)) {
419
- if (n.size > Ie) throw Error(`${n.name} exceeds the 5 MB widget upload limit.`);
420
- let e = n.name.includes(".") ? n.name.split(".").pop() ?? "bin" : "bin", r = await rt({ variables: { input: {
421
- fileName: n.name,
422
- fileSize: n.size,
423
- mimeType: n.type || "application/octet-stream",
424
- extension: e,
425
- visibility: "PRIVATE"
426
- } } }), i = r.data?.initiateUpload?.uploadUrl, a = r.data?.initiateUpload?.session?.id;
427
- if (!i || !a) throw Error(`Unable to create an upload session for ${n.name}`);
428
- if (!(await fetch(i, {
429
- method: "PUT",
430
- body: n,
431
- headers: { "Content-Type": n.type || "application/octet-stream" }
432
- })).ok) throw Error(`Upload failed for ${n.name}`);
433
- let o = (await it({ variables: { input: { sessionId: a } } })).data?.completeUpload;
434
- if (!o?.fileId) throw Error(`Failed to finalize ${n.name}`);
435
- t.push({
436
- fileId: o.fileId,
437
- fileName: o.file?.name ?? n.name,
438
- fileSize: Number(o.file?.size ?? n.size),
439
- mimeType: o.file?.mimeType ?? n.type,
440
- downloadUrl: o.file?.downloadUrl ?? null
441
- });
442
- }
443
- V((e) => [...e, ...t]);
444
- } catch (e) {
445
- H(e instanceof Error ? e.message : "File upload failed");
446
- } finally {
447
- We(!1), U.current && (U.current.value = "");
448
- }
449
- }
450
- }, dt = async () => {
451
- if (!(!S || !A.trim())) {
452
- H(null), Ye(!0);
453
- try {
454
- let e = await q.mutate({
455
- mutation: xe,
456
- errorPolicy: "none",
457
- variables: { input: {
458
- workspaceId: S,
459
- sourceContext: {
460
- ...J,
461
- threadKey: He ?? J.threadKey
462
- },
463
- content: { text: A.trim() },
464
- type: "TEXT",
465
- parentMessageId: N?.id,
466
- mentionUserIds: Array.from(new Set(Ke)),
467
- attachments: B.map((e) => ({
468
- fileId: e.fileId,
469
- fileName: e.fileName,
470
- fileSize: e.fileSize,
471
- mimeType: e.mimeType,
472
- downloadUrl: e.downloadUrl
473
- }))
474
- } }
475
- });
476
- if (!e.data?.sendContextMessage?.success) throw Error("Failed to send message");
477
- let t = e.data.sendContextMessage.message?.conversationId;
478
- t && (O(String(t)), k(He ?? J.threadKey)), j(""), P(null), V([]), qe([]), D && (await X.refetch(), await Y.refetch());
479
- } catch (e) {
480
- H(e instanceof Error ? e.message : "Failed to send message");
481
- } finally {
482
- Ye(!1);
483
- }
484
- }
485
- }, ft = (e) => {
486
- j((t) => t.replace(/(^|\s)@([^\s@]*)$/, `$1@${e.label} `)), qe((t) => Array.from(new Set([...t, e.id])));
487
- }, pt = async () => {
488
- !F || !L.trim() || (await Ze({ variables: { input: {
489
- id: F,
490
- content: { text: L.trim() }
491
- } } }), I(null), R(""), await X.refetch());
492
- }, mt = async (e, t) => {
493
- e.reactions.some((e) => e.emoji === t && e.userId === G) ? await et({ variables: {
494
- messageId: e.id,
495
- emoji: t
496
- } }) : await $e({ variables: {
497
- messageId: e.id,
498
- emoji: t
499
- } }), await X.refetch();
500
- }, ht = async (e) => {
501
- e.isPinned ? await nt({ variables: { messageId: e.id } }) : await tt({ variables: { messageId: e.id } }), await X.refetch();
126
+ let be = async () => {
127
+ R(null);
128
+ let e = await Z.send({
129
+ resolvedContext: G,
130
+ conversationThreadKey: E,
131
+ text: O,
132
+ parentMessageId: j?.id,
133
+ mentionUserIds: z,
134
+ attachments: Y.pendingAttachments
135
+ });
136
+ e === null && !O.trim() || (e && (T(e), D(E ?? G.threadKey)), k(""), M(null), Y.clearPendingAttachments(), B([]), w && (await J.refetch(), await K.refetch()));
137
+ }, xe = (e) => {
138
+ k((t) => t.replace(/(^|\s)@([^\s@]*)$/, `$1@${e.label} `)), B((t) => Array.from(new Set([...t, e.id])));
139
+ }, Se = async () => {
140
+ !N || !F.trim() || (await X.saveEdit(N, F.trim()), P(null), I(""));
502
141
  };
503
- return /* @__PURE__ */ f(a, {
504
- className: p,
505
- children: [/* @__PURE__ */ f(s, {
506
- className: "space-y-3",
507
- children: [/* @__PURE__ */ f("div", {
508
- className: "flex flex-col gap-3 md:flex-row md:items-start md:justify-between",
509
- children: [/* @__PURE__ */ f("div", {
510
- className: "space-y-1",
511
- children: [/* @__PURE__ */ f(ee, {
512
- className: "flex items-center gap-2 text-base",
513
- children: [/* @__PURE__ */ d(le, { className: "h-4 w-4" }), Y.data?.conversation?.title || w.contextTitle || W("conversationWidget.title", "Page conversation")]
514
- }), /* @__PURE__ */ d("p", {
515
- className: "text-sm text-muted-foreground truncate whitespace-nowrap overflow-hidden max-w-full",
516
- title: w.entityType && w.entityId ? `${w.entityType} · ${w.entityId}` : w.pagePath,
517
- children: w.entityType && w.entityId ? `${w.entityType} · ${w.entityId}` : w.pagePath
518
- })]
519
- }), /* @__PURE__ */ f("div", {
520
- className: "flex flex-wrap items-center gap-2 md:justify-end",
521
- children: [
522
- /* @__PURE__ */ f(e, {
523
- type: "button",
524
- variant: "outline",
525
- size: "sm",
526
- onClick: () => {
527
- try {
528
- let e = new URL(st);
529
- E(`${e.pathname}${e.search}${e.hash}`);
530
- } catch {
531
- E(w.pagePath);
532
- }
533
- },
534
- children: [/* @__PURE__ */ d(se, { className: "mr-2 h-4 w-4" }), W("conversationWidget.openContext", "Open context")]
535
- }),
536
- /* @__PURE__ */ d(e, {
537
- type: "button",
538
- "data-tour": "page-discussion-open-full",
539
- variant: "outline",
540
- size: "sm",
541
- onClick: () => {
542
- D && E(`/conversations/${D}`);
543
- },
544
- disabled: !D,
545
- children: W("conversationWidget.openInbox", "Open in conversations")
546
- }),
547
- /* @__PURE__ */ d(e, {
548
- type: "button",
549
- variant: "ghost",
550
- size: "icon",
551
- onClick: () => Ue((e) => !e),
552
- "aria-label": M ? W("conversationWidget.expand", "Expand page conversation") : W("conversationWidget.collapse", "Collapse page conversation"),
553
- children: d(M ? ae : oe, { className: "h-4 w-4" })
554
- })
555
- ]
556
- })]
557
- }), /* @__PURE__ */ f("div", {
558
- className: "flex flex-wrap items-center gap-2",
559
- children: [
560
- /* @__PURE__ */ d(i, {
561
- variant: "secondary",
562
- children: J.widgetKey
563
- }),
564
- J.activeTab ? /* @__PURE__ */ d(i, {
565
- variant: "outline",
566
- children: J.activeTab
567
- }) : null,
568
- Y.data?.conversation?.currentUserMembership?.unreadCount ? /* @__PURE__ */ f(i, { children: [Y.data.conversation.currentUserMembership.unreadCount, " unread"] }) : null
569
- ]
570
- })]
571
- }), !M && /* @__PURE__ */ f(o, {
142
+ return /* @__PURE__ */ m(r, {
143
+ className: g,
144
+ children: [/* @__PURE__ */ p(me, {
145
+ conversationTitle: K.data?.conversation?.title,
146
+ pageContext: x,
147
+ resolvedContext: G,
148
+ unreadCount: K.data?.conversation?.currentUserMembership?.unreadCount,
149
+ conversationId: w,
150
+ collapsed: A,
151
+ onToggleCollapsed: () => _e((e) => !e),
152
+ onOpenContext: () => {
153
+ try {
154
+ let e = new URL(ve);
155
+ C(`${e.pathname}${e.search}${e.hash}`);
156
+ } catch {
157
+ C(x.pagePath);
158
+ }
159
+ },
160
+ onOpenInbox: () => w && C(`/conversations/${w}`),
161
+ tr: H
162
+ }), !A && /* @__PURE__ */ m(ee, {
572
163
  className: "space-y-4",
573
164
  children: [
574
- Ge && /* @__PURE__ */ d("div", {
165
+ L && /* @__PURE__ */ p("div", {
575
166
  className: "rounded-md border border-destructive/20 bg-destructive/10 px-3 py-2 text-sm text-destructive",
576
- children: Ge
167
+ children: L
577
168
  }),
578
- /* @__PURE__ */ d("div", {
579
- className: "max-h-[24rem] overflow-y-auto rounded-lg border border-border bg-muted/20",
580
- children: /* @__PURE__ */ f("div", {
581
- className: "space-y-3 p-4",
582
- children: [Z.length === 0 ? /* @__PURE__ */ d("div", {
583
- className: "rounded-lg border border-dashed border-border bg-background/70 px-4 py-5 text-sm text-muted-foreground",
584
- children: W("conversationWidget.empty", "No messages yet. Start the conversation in context.")
585
- }) : Z.map((t) => {
586
- let n = t.authorId === G;
587
- return /* @__PURE__ */ d("div", {
588
- className: `flex ${n ? "justify-end" : "justify-start"}`,
589
- children: /* @__PURE__ */ f("div", {
590
- className: `w-full max-w-full rounded-xl border px-3 py-2 text-sm shadow-sm sm:max-w-[92%] ${n ? "border-primary/20 bg-primary/5" : "border-border bg-background"}`,
591
- children: [
592
- /* @__PURE__ */ f("div", {
593
- className: "mb-1 flex items-center justify-between gap-2",
594
- children: [/* @__PURE__ */ f("div", {
595
- className: "flex items-center gap-2 text-xs text-muted-foreground",
596
- children: [
597
- /* @__PURE__ */ d("span", {
598
- className: "font-medium text-foreground",
599
- children: n ? W("conversationWidget.you", "You") : t.authorId
600
- }),
601
- /* @__PURE__ */ d("span", { children: Ve(t.createdAt) }),
602
- t.isEdited ? /* @__PURE__ */ d("span", { children: W("conversationWidget.edited", "edited") }) : null,
603
- t.isPinned ? /* @__PURE__ */ d(fe, { className: "h-3 w-3" }) : null
604
- ]
605
- }), /* @__PURE__ */ d("div", {
606
- className: "flex items-center gap-1",
607
- children: $.reactions && t.permissions.canReact ? Fe.map((e) => {
608
- let n = t.reactions.filter((t) => t.emoji === e).length;
609
- return /* @__PURE__ */ f("button", {
610
- type: "button",
611
- className: `min-h-9 rounded-full px-2.5 py-1 text-xs transition-colors ${t.reactions.some((t) => t.emoji === e && t.userId === G) ? "bg-primary text-primary-foreground" : "bg-muted text-muted-foreground hover:bg-muted/80"}`,
612
- onClick: () => void mt(t, e),
613
- children: [e, n > 0 ? ` ${n}` : ""]
614
- }, `${t.id}-${e}`);
615
- }) : null
616
- })]
617
- }),
618
- F === t.id ? /* @__PURE__ */ f("div", {
619
- className: "space-y-2",
620
- children: [/* @__PURE__ */ d(te, {
621
- value: L,
622
- onChange: (e) => R(e.target.value),
623
- rows: 3
624
- }), /* @__PURE__ */ f("div", {
625
- className: "flex flex-wrap items-center justify-end gap-2",
626
- children: [/* @__PURE__ */ d(e, {
627
- type: "button",
628
- variant: "outline",
629
- size: "sm",
630
- onClick: () => I(null),
631
- children: W("conversationWidget.cancel", "Cancel")
632
- }), /* @__PURE__ */ d(e, {
633
- type: "button",
634
- size: "sm",
635
- onClick: () => void pt(),
636
- children: W("conversationWidget.save", "Save")
637
- })]
638
- })]
639
- }) : /* @__PURE__ */ f(ye, { children: [t.parentMessageId ? /* @__PURE__ */ d("p", {
640
- className: "mb-1 text-xs text-muted-foreground",
641
- children: W("conversationWidget.replyingInThread", "Reply in thread")
642
- }) : null, /* @__PURE__ */ d("p", {
643
- className: "whitespace-pre-wrap break-words text-sm text-foreground",
644
- children: t.content
645
- })] }),
646
- t.attachments.length > 0 ? /* @__PURE__ */ d("div", {
647
- className: "mt-3 flex flex-col gap-2",
648
- children: t.attachments.map((e) => /* @__PURE__ */ f("a", {
649
- href: e.downloadUrl ?? "#",
650
- target: e.downloadUrl ? "_blank" : void 0,
651
- rel: e.downloadUrl ? "noreferrer" : void 0,
652
- className: "flex items-center justify-between gap-2 rounded-md border border-border bg-muted/40 px-3 py-2 text-xs",
653
- children: [/* @__PURE__ */ d("span", {
654
- className: "truncate",
655
- children: e.fileName
656
- }), /* @__PURE__ */ d("span", {
657
- className: "text-muted-foreground",
658
- children: Be(e.fileSize)
659
- })]
660
- }, e.id))
661
- }) : null,
662
- /* @__PURE__ */ f("div", {
663
- className: "mt-3 flex flex-wrap items-center gap-2 text-xs",
664
- children: [
665
- $.threads && t.permissions.canReply ? /* @__PURE__ */ f(e, {
666
- type: "button",
667
- variant: "ghost",
668
- size: "sm",
669
- onClick: () => P(t),
670
- children: [/* @__PURE__ */ d(me, { className: "mr-2 h-3 w-3" }), W("conversationWidget.reply", "Reply")]
671
- }) : null,
672
- t.permissions.canEdit && F !== t.id ? /* @__PURE__ */ f(e, {
673
- type: "button",
674
- variant: "ghost",
675
- size: "sm",
676
- onClick: () => {
677
- I(t.id), R(t.content);
678
- },
679
- children: [/* @__PURE__ */ d(de, { className: "mr-2 h-3 w-3" }), W("conversationWidget.edit", "Edit")]
680
- }) : null,
681
- t.permissions.canDelete ? /* @__PURE__ */ f(e, {
682
- type: "button",
683
- variant: "ghost",
684
- size: "sm",
685
- onClick: async () => {
686
- await Qe({ variables: {
687
- id: t.id,
688
- hard: !1
689
- } }), await X.refetch();
690
- },
691
- children: [/* @__PURE__ */ d(_e, { className: "mr-2 h-3 w-3" }), W("conversationWidget.delete", "Delete")]
692
- }) : null,
693
- t.permissions.canPin ? /* @__PURE__ */ f(e, {
694
- type: "button",
695
- variant: "ghost",
696
- size: "sm",
697
- onClick: () => void ht(t),
698
- children: [t.isPinned ? /* @__PURE__ */ d(pe, { className: "mr-2 h-3 w-3" }) : /* @__PURE__ */ d(fe, { className: "mr-2 h-3 w-3" }), t.isPinned ? W("conversationWidget.unpin", "Unpin") : W("conversationWidget.pin", "Pin")]
699
- }) : null
700
- ]
701
- })
702
- ]
703
- })
704
- }, t.id);
705
- }), /* @__PURE__ */ d("div", { ref: Xe })]
706
- })
169
+ /* @__PURE__ */ p(c, {
170
+ messages: Q,
171
+ currentUserId: U,
172
+ featureFlags: $,
173
+ editingMessageId: N,
174
+ editingValue: F,
175
+ messageEndRef: V,
176
+ onEditValueChange: I,
177
+ onStartEdit: (e) => {
178
+ P(e.id), I(e.content);
179
+ },
180
+ onCancelEdit: () => P(null),
181
+ onSaveEdit: () => void Se(),
182
+ onSetReplyTarget: M,
183
+ onToggleReaction: (e, t) => void X.toggleReaction(e, t),
184
+ onDelete: (e) => void X.deleteMessageAction(e),
185
+ onTogglePin: (e) => void X.togglePin(e),
186
+ tr: H
707
187
  }),
708
- N ? /* @__PURE__ */ f("div", {
709
- className: "flex items-center justify-between gap-2 rounded-md border border-border bg-muted/40 px-3 py-2 text-sm",
710
- children: [/* @__PURE__ */ f("div", {
711
- className: "min-w-0",
712
- children: [/* @__PURE__ */ f("p", {
713
- className: "text-xs text-muted-foreground",
714
- children: [
715
- W("conversationWidget.replyingTo", "Replying to"),
716
- " ",
717
- N.authorId
718
- ]
719
- }), /* @__PURE__ */ d("p", {
720
- className: "truncate",
721
- children: N.content
722
- })]
723
- }), /* @__PURE__ */ d(e, {
724
- type: "button",
725
- variant: "ghost",
726
- size: "icon",
727
- onClick: () => P(null),
728
- children: /* @__PURE__ */ d(ve, { className: "h-4 w-4" })
729
- })]
188
+ j ? /* @__PURE__ */ p(ce, {
189
+ replyTarget: j,
190
+ onClear: () => M(null),
191
+ tr: H
730
192
  }) : null,
731
- B.length > 0 ? /* @__PURE__ */ d("div", {
732
- className: "flex flex-wrap gap-2",
733
- children: B.map((e) => /* @__PURE__ */ f(i, {
734
- variant: "secondary",
735
- className: "gap-2 py-1.5",
736
- children: [
737
- /* @__PURE__ */ d(ue, { className: "h-3 w-3" }),
738
- /* @__PURE__ */ d("span", {
739
- className: "max-w-[14rem] truncate",
740
- children: e.fileName
741
- }),
742
- /* @__PURE__ */ d("button", {
743
- type: "button",
744
- onClick: () => V((t) => t.filter((t) => t.fileId !== e.fileId)),
745
- children: /* @__PURE__ */ d(ve, { className: "h-3 w-3" })
746
- })
747
- ]
748
- }, e.fileId))
193
+ Y.pendingAttachments.length > 0 ? /* @__PURE__ */ p(ie, {
194
+ attachments: Y.pendingAttachments,
195
+ onRemove: Y.removePendingAttachment
749
196
  }) : null,
750
- /* @__PURE__ */ f("div", {
751
- "data-tour": "page-discussion-composer",
752
- className: "space-y-3 rounded-lg border border-border bg-background/80 p-3",
753
- children: [
754
- /* @__PURE__ */ d(te, {
755
- value: A,
756
- onChange: (e) => j(e.target.value),
757
- rows: 3,
758
- placeholder: W("conversationWidget.placeholder", "Discuss this page in context…"),
759
- className: "border-0 bg-transparent px-0 shadow-none focus-visible:ring-0"
760
- }),
761
- $.mentions && lt.length > 0 ? /* @__PURE__ */ f("div", {
762
- className: "flex flex-wrap gap-2 rounded-md border border-border bg-muted/20 p-2",
763
- children: [/* @__PURE__ */ d(ge, { className: "mt-0.5 h-4 w-4 text-muted-foreground" }), lt.map((t) => /* @__PURE__ */ f(e, {
764
- type: "button",
765
- variant: "outline",
766
- size: "sm",
767
- onClick: () => ft(t),
768
- children: ["@", t.label]
769
- }, t.id))]
770
- }) : null,
771
- /* @__PURE__ */ f("div", {
772
- className: "flex flex-col gap-3 md:flex-row md:items-center md:justify-between",
773
- children: [/* @__PURE__ */ f("div", {
774
- className: "flex flex-wrap items-center gap-2",
775
- children: [
776
- /* @__PURE__ */ d("input", {
777
- ref: U,
778
- type: "file",
779
- multiple: !0,
780
- className: "hidden",
781
- onChange: (e) => void ut(e.target.files)
782
- }),
783
- /* @__PURE__ */ f(e, {
784
- type: "button",
785
- variant: "outline",
786
- size: "sm",
787
- onClick: () => U.current?.click(),
788
- disabled: z,
789
- children: [z ? /* @__PURE__ */ d(ce, { className: "mr-2 h-4 w-4 animate-spin" }) : /* @__PURE__ */ d(ue, { className: "mr-2 h-4 w-4" }), W("conversationWidget.attach", "Attach files")]
790
- }),
791
- $.mentions ? /* @__PURE__ */ d(i, {
792
- variant: "outline",
793
- children: W("conversationWidget.mentionsHint", "Type @ to mention participants")
794
- }) : null
795
- ]
796
- }), /* @__PURE__ */ f(e, {
797
- type: "button",
798
- onClick: () => void dt(),
799
- disabled: Je || z || !A.trim(),
800
- children: [Je ? /* @__PURE__ */ d(ce, { className: "mr-2 h-4 w-4 animate-spin" }) : /* @__PURE__ */ d(he, { className: "mr-2 h-4 w-4" }), W("conversationWidget.send", "Send")]
801
- })]
802
- })
803
- ]
197
+ /* @__PURE__ */ p(i, {
198
+ composerValue: O,
199
+ onComposerChange: k,
200
+ fileInputRef: Y.fileInputRef,
201
+ onFilesSelected: (e) => void Y.handleUploadFiles(e),
202
+ onAttachClick: () => Y.fileInputRef.current?.click(),
203
+ onSend: () => void be(),
204
+ uploading: Y.uploading,
205
+ isSendingMessage: Z.isSending,
206
+ featureFlags: $,
207
+ mentionSuggestions: ye,
208
+ onSelectMention: xe,
209
+ tr: H
804
210
  })
805
211
  ]
806
212
  })]
807
213
  });
808
214
  }
809
215
  //#endregion
810
- export { x as ContextConversationWidget };
216
+ export { g as ContextConversationWidget };