@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.
- package/dist/button/Button.js +18 -16
- package/dist/chrome/AccountSwitcher.js +10 -7
- package/dist/chrome/AutoBreadcrumbs.js +2 -0
- package/dist/chrome/Breadcrumbs.js +2 -0
- package/dist/chrome/CommandPalette.js +5 -3
- package/dist/chrome/ContextSwitcher.js +90 -338
- package/dist/chrome/DynamicFooter.js +7 -7
- package/dist/chrome/Footer.js +5 -5
- package/dist/chrome/GeographySwitcher.js +3 -3
- package/dist/chrome/GlobalSearch.js +73 -448
- package/dist/chrome/HeaderBar.js +6 -1
- package/dist/chrome/LanguagePickerSheet.js +1 -1
- package/dist/chrome/LanguageSwitcher.js +2 -2
- package/dist/chrome/NotificationCenter.js +69 -694
- package/dist/chrome/PanelTabs.js +7 -4
- package/dist/chrome/PluginContextMenuTarget.js +1 -1
- package/dist/chrome/ProductPickerSheet.js +4 -4
- package/dist/chrome/ProductSideNav.js +1 -1
- package/dist/chrome/ProductSwitcher.js +3 -3
- package/dist/chrome/ProfileSwitcher.js +13 -8
- package/dist/chrome/ShortcutHelpDialog.js +2 -1
- package/dist/chrome/SideNavigation.js +75 -239
- package/dist/chrome/Sidebar.js +1 -0
- package/dist/chrome/contextSwitcher/EmptyState.js +32 -0
- package/dist/chrome/contextSwitcher/OrganizationList.js +34 -0
- package/dist/chrome/contextSwitcher/ProjectList.js +34 -0
- package/dist/chrome/contextSwitcher/SearchInput.js +50 -0
- package/dist/chrome/contextSwitcher/TabButton.js +9 -0
- package/dist/chrome/contextSwitcher/TriggerButton.js +38 -0
- package/dist/chrome/contextSwitcher/WorkspaceList.js +34 -0
- package/dist/chrome/contextSwitcher/icons.js +58 -0
- package/dist/chrome/contextSwitcher/useIsMobile.js +11 -0
- package/dist/chrome/globalSearch/AdvancedFiltersPanel.js +253 -0
- package/dist/chrome/globalSearch/CategoryTabs.js +28 -0
- package/dist/chrome/globalSearch/ResultsList.js +58 -0
- package/dist/chrome/globalSearch/SearchInput.js +28 -0
- package/dist/chrome/globalSearch/SearchModeBar.js +36 -0
- package/dist/chrome/globalSearch/useAdvancedFilters.js +78 -0
- package/dist/chrome/globalSearch/utils.js +22 -0
- package/dist/chrome/notificationCenter/BellButton.js +27 -0
- package/dist/chrome/notificationCenter/NotificationCardItem.js +129 -0
- package/dist/chrome/notificationCenter/NotificationFilters.js +67 -0
- package/dist/chrome/notificationCenter/NotificationFooter.js +23 -0
- package/dist/chrome/notificationCenter/NotificationHeader.js +75 -0
- package/dist/chrome/notificationCenter/NotificationList.js +75 -0
- package/dist/chrome/notificationCenter/NotificationPanel.js +19 -0
- package/dist/chrome/notificationCenter/SkeletonCard.js +18 -0
- package/dist/chrome/notificationCenter/constants.js +93 -0
- package/dist/chrome/notificationCenter/gql.js +58 -0
- package/dist/chrome/notificationCenter/useNotificationCenter.js +149 -0
- package/dist/chrome/notificationCenter/usePanelChrome.js +36 -0
- package/dist/chrome/sideNavigation/CollapseToggle.js +29 -0
- package/dist/chrome/sideNavigation/MobileActionsBar.js +25 -0
- package/dist/chrome/sideNavigation/NavItemRenderer.js +79 -0
- package/dist/chrome/sideNavigation/SidebarHeader.js +29 -0
- package/dist/chrome/sideNavigation/helpers.js +19 -0
- package/dist/chrome/sideNavigation/useSideNavigationState.js +45 -0
- package/dist/form/Checkbox.js +17 -15
- package/dist/form/FormDescription.js +9 -10
- package/dist/form/FormField.js +11 -12
- package/dist/form/FormLabel.js +13 -13
- package/dist/form/FormMessage.js +10 -11
- package/dist/form/Input.js +11 -10
- package/dist/form/Radio.js +25 -21
- package/dist/form/Select.js +81 -66
- package/dist/form/Textarea.js +10 -9
- package/dist/shared/components/AccessDenied.js +8 -4
- package/dist/shared/components/AppErrorBoundary.js +2 -0
- package/dist/shared/components/ContextConversationWidget.js +173 -767
- package/dist/shared/components/ErrorFallback.js +3 -0
- package/dist/shared/components/PWAInstallBanner.js +8 -4
- package/dist/shared/components/RequireAuth.js +4 -4
- package/dist/shared/components/SSORedirectGuard.js +1 -1
- package/dist/shared/components/contextConversationWidget/Composer.js +66 -0
- package/dist/shared/components/contextConversationWidget/MessageItem.js +124 -0
- package/dist/shared/components/contextConversationWidget/MessageList.js +32 -0
- package/dist/shared/components/contextConversationWidget/NoWorkspaceCard.js +19 -0
- package/dist/shared/components/contextConversationWidget/PendingAttachmentsBar.js +28 -0
- package/dist/shared/components/contextConversationWidget/ReplyBanner.js +32 -0
- package/dist/shared/components/contextConversationWidget/WidgetHeader.js +70 -0
- package/dist/shared/components/contextConversationWidget/queries.js +197 -0
- package/dist/shared/components/contextConversationWidget/types.js +10 -0
- package/dist/shared/components/contextConversationWidget/useAttachmentUpload.js +57 -0
- package/dist/shared/components/contextConversationWidget/useConversationSubscriptions.js +26 -0
- package/dist/shared/components/contextConversationWidget/useMessageActions.js +34 -0
- package/dist/shared/components/contextConversationWidget/useSendMessage.js +45 -0
- package/dist/shared/components/contextConversationWidget/useWidgetMessages.js +44 -0
- package/dist/shared/components/contextConversationWidget/utils.js +56 -0
- package/dist/shared/feature-flags/FeatureFlagProvider.js +21 -21
- package/dist/shared/geography/GeographyProvider.js +20 -20
- package/dist/shared/graphql/GatewayContext.js +1 -1
- package/dist/shared/motion/MotionList.js +1 -1
- package/dist/shared/pages/AiPage.js +3 -3
- package/dist/shared/pages/SearchPage.js +293 -1071
- package/dist/shared/pages/searchPage/ActiveFilterChips.js +176 -0
- package/dist/shared/pages/searchPage/FiltersPanel.js +329 -0
- package/dist/shared/pages/searchPage/ResultsList.js +119 -0
- package/dist/shared/pages/searchPage/ResultsStatus.js +32 -0
- package/dist/shared/pages/searchPage/SearchInput.js +31 -0
- package/dist/shared/pages/searchPage/SearchPagination.js +37 -0
- package/dist/shared/pages/searchPage/SearchToolbar.js +58 -0
- package/dist/shared/pages/searchPage/constants.js +155 -0
- package/dist/shared/pages/searchPage/utils.js +24 -0
- package/dist/shared/plugins/PluginRuntimeProvider.js +1 -1
- package/dist/shared/providers/shell/ActiveContextProvider.js +12 -12
- package/dist/shared/providers/shell/AppShellContext.js +1 -1
- package/dist/shared/providers/shell/AuthProvider.js +130 -384
- package/dist/shared/providers/shell/AuthTokenProvider.js +6 -6
- package/dist/shared/providers/shell/ContextManagerProvider.js +1 -1
- package/dist/shared/providers/shell/FeatureFlagsProvider.js +5 -5
- package/dist/shared/providers/shell/GlobalUiProvider.js +17 -17
- package/dist/shared/providers/shell/I18nProvider.js +15 -15
- package/dist/shared/providers/shell/PageConversationContextProvider.js +14 -14
- package/dist/shared/providers/shell/PermissionProvider.js +16 -16
- package/dist/shared/providers/shell/ShellUiProvider.js +13 -13
- package/dist/shared/providers/shell/ThemeProvider.js +9 -9
- package/dist/shared/providers/shell/authProvider/bridgeStateSync.js +34 -0
- package/dist/shared/providers/shell/authProvider/jwt.js +13 -0
- package/dist/shared/providers/shell/authProvider/ssoRelay.js +38 -0
- package/dist/shared/providers/shell/authProvider/useAuthActions.js +170 -0
- package/dist/shared/providers/shell/authProvider/useBridgeInitialization.js +86 -0
- package/dist/shared/providers/shell/authProvider/useRemoteSLO.js +32 -0
- package/dist/shared/providers/shell/authProvider/useStorageSync.js +35 -0
- package/dist/shared/providers/shell/authProvider/useTokenExpiryTimer.js +37 -0
- package/dist/shared/tours/TourPlayer.js +1 -0
- package/dist/shared/tours/TourPlayerProvider.js +1 -1
- package/dist/shared/tours/TourTooltip.js +3 -0
- package/dist/shared/tours/TourTrigger.js +86 -259
- package/dist/shared/tours/ToursContext.js +108 -398
- package/dist/shared/tours/tourTrigger/DesktopTourDropdown.js +48 -0
- package/dist/shared/tours/tourTrigger/MobileTourSheet.js +68 -0
- package/dist/shared/tours/tourTrigger/TourListItemDesktop.js +36 -0
- package/dist/shared/tours/tourTrigger/TourListItemMobile.js +47 -0
- package/dist/shared/tours/tourTrigger/TourStatusChip.js +30 -0
- package/dist/shared/tours/tourTrigger/TourTriggerButton.js +22 -0
- package/dist/shared/tours/toursContext/errors.js +18 -0
- package/dist/shared/tours/toursContext/gql.js +152 -0
- package/dist/shared/tours/toursContext/route.js +20 -0
- package/dist/shared/tours/toursContext/session.js +19 -0
- package/dist/shared/tours/toursContext/useIdleReady.js +18 -0
- package/dist/shared/tours/toursContext/useTourMutations.js +118 -0
- package/dist/shared-events.js +3 -3
- package/dist/shared-hooks.js +1 -1
- package/dist/storage/SaveToFilesButton.js +3 -3
- package/dist/storage/SaveToFilesDialog.js +1 -1
- package/dist/tag/TagBadge.js +1 -1
- package/dist/tag/TagsWidget.js +81 -226
- package/dist/tag/tagsWidget/AddTagTrigger.js +14 -0
- package/dist/tag/tagsWidget/TagBadgeList.js +17 -0
- package/dist/tag/tagsWidget/TagSearchPopover.js +80 -0
- package/dist/tag/tagsWidget/operations.js +64 -0
- package/dist/tag/tagsWidget/useVocabResolver.js +30 -0
- package/dist/ui/card.js +44 -39
- package/dist/ui/dropdown-menu.js +82 -66
- package/dist/ui/input.js +10 -10
- package/dist/ui/label.js +13 -11
- package/dist/ui/select.js +80 -66
- package/dist/ui/table.js +61 -54
- package/dist/ui/textarea.js +9 -9
- package/dist/ui/tooltip.js +13 -11
- package/package.json +1 -1
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
import { gql as e } from "@apollo/client";
|
|
2
|
+
//#region src/shared/components/contextConversationWidget/queries.ts
|
|
3
|
+
var t = e`
|
|
4
|
+
mutation ContextConversationWidget_SendContextMessage(
|
|
5
|
+
$input: SendContextConversationMessageInput!
|
|
6
|
+
) {
|
|
7
|
+
sendContextMessage(input: $input) {
|
|
8
|
+
success
|
|
9
|
+
message {
|
|
10
|
+
id
|
|
11
|
+
conversationId
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
`, n = e`
|
|
16
|
+
query ContextConversationWidget_GetConversation($id: ID!) {
|
|
17
|
+
conversation(id: $id) {
|
|
18
|
+
id
|
|
19
|
+
title
|
|
20
|
+
description
|
|
21
|
+
settings
|
|
22
|
+
updatedAt
|
|
23
|
+
features {
|
|
24
|
+
threads
|
|
25
|
+
reactions
|
|
26
|
+
mentions
|
|
27
|
+
}
|
|
28
|
+
currentUserMembership {
|
|
29
|
+
unreadCount
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
`, r = e`
|
|
34
|
+
query ContextConversationWidget_GetContextConversations($first: Int) {
|
|
35
|
+
conversations(first: $first) {
|
|
36
|
+
edges {
|
|
37
|
+
node {
|
|
38
|
+
id
|
|
39
|
+
settings
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
`, i = e`
|
|
45
|
+
query ContextConversationWidget_GetMessages($conversationId: ID!, $first: Int) {
|
|
46
|
+
messages(conversationId: $conversationId, first: $first) {
|
|
47
|
+
edges {
|
|
48
|
+
node {
|
|
49
|
+
id
|
|
50
|
+
conversationId
|
|
51
|
+
type
|
|
52
|
+
status
|
|
53
|
+
content
|
|
54
|
+
authorId
|
|
55
|
+
authorType
|
|
56
|
+
parentMessageId
|
|
57
|
+
threadRootId
|
|
58
|
+
threadLevel
|
|
59
|
+
isEdited
|
|
60
|
+
editedAt
|
|
61
|
+
isPinned
|
|
62
|
+
createdAt
|
|
63
|
+
updatedAt
|
|
64
|
+
replyCount
|
|
65
|
+
permissions {
|
|
66
|
+
canEdit
|
|
67
|
+
canDelete
|
|
68
|
+
canReact
|
|
69
|
+
canReply
|
|
70
|
+
canPin
|
|
71
|
+
}
|
|
72
|
+
reactions {
|
|
73
|
+
id
|
|
74
|
+
emoji
|
|
75
|
+
userId
|
|
76
|
+
createdAt
|
|
77
|
+
}
|
|
78
|
+
attachments {
|
|
79
|
+
id
|
|
80
|
+
fileId
|
|
81
|
+
fileName
|
|
82
|
+
fileSize
|
|
83
|
+
mimeType
|
|
84
|
+
downloadUrl
|
|
85
|
+
thumbnail
|
|
86
|
+
width
|
|
87
|
+
height
|
|
88
|
+
duration
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
`, a = e`
|
|
95
|
+
subscription ContextConversationWidget_MessageAdded($conversationId: ID!) {
|
|
96
|
+
messageAdded(conversationId: $conversationId) {
|
|
97
|
+
id
|
|
98
|
+
conversationId
|
|
99
|
+
type
|
|
100
|
+
status
|
|
101
|
+
content
|
|
102
|
+
authorId
|
|
103
|
+
authorType
|
|
104
|
+
parentMessageId
|
|
105
|
+
threadRootId
|
|
106
|
+
threadLevel
|
|
107
|
+
isEdited
|
|
108
|
+
editedAt
|
|
109
|
+
isPinned
|
|
110
|
+
createdAt
|
|
111
|
+
updatedAt
|
|
112
|
+
replyCount
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
`, o = e`
|
|
116
|
+
subscription ContextConversationWidget_MessageUpdated($conversationId: ID!) {
|
|
117
|
+
messageUpdated(conversationId: $conversationId) {
|
|
118
|
+
id
|
|
119
|
+
conversationId
|
|
120
|
+
content
|
|
121
|
+
isEdited
|
|
122
|
+
editedAt
|
|
123
|
+
updatedAt
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
`, s = e`
|
|
127
|
+
subscription ContextConversationWidget_MessageDeleted($conversationId: ID!) {
|
|
128
|
+
messageDeleted(conversationId: $conversationId) {
|
|
129
|
+
messageId
|
|
130
|
+
conversationId
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
`, c = e`
|
|
134
|
+
mutation ContextConversationWidget_EditMessage($input: EditMessageInput!) {
|
|
135
|
+
editMessage(input: $input) {
|
|
136
|
+
id
|
|
137
|
+
content
|
|
138
|
+
isEdited
|
|
139
|
+
editedAt
|
|
140
|
+
updatedAt
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
`, l = e`
|
|
144
|
+
mutation ContextConversationWidget_DeleteMessage($id: ID!, $hard: Boolean) {
|
|
145
|
+
deleteMessage(id: $id, hard: $hard) {
|
|
146
|
+
success
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
`, u = e`
|
|
150
|
+
mutation ContextConversationWidget_AddReaction($messageId: ID!, $emoji: String!) {
|
|
151
|
+
addReaction(messageId: $messageId, emoji: $emoji) {
|
|
152
|
+
id
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
`, d = e`
|
|
156
|
+
mutation ContextConversationWidget_RemoveReaction($messageId: ID!, $emoji: String!) {
|
|
157
|
+
removeReaction(messageId: $messageId, emoji: $emoji) {
|
|
158
|
+
success
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
`, f = e`
|
|
162
|
+
mutation ContextConversationWidget_PinMessage($messageId: ID!) {
|
|
163
|
+
pinMessage(messageId: $messageId) {
|
|
164
|
+
id
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
`, p = e`
|
|
168
|
+
mutation ContextConversationWidget_UnpinMessage($messageId: ID!) {
|
|
169
|
+
unpinMessage(messageId: $messageId) {
|
|
170
|
+
id
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
`, m = e`
|
|
174
|
+
mutation ContextConversationWidget_InitiateUpload($input: InitiateUploadInput!) {
|
|
175
|
+
initiateUpload(input: $input) {
|
|
176
|
+
uploadUrl
|
|
177
|
+
session {
|
|
178
|
+
id
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
`, h = e`
|
|
183
|
+
mutation ContextConversationWidget_CompleteUpload($input: CompleteUploadInput!) {
|
|
184
|
+
completeUpload(input: $input) {
|
|
185
|
+
fileId
|
|
186
|
+
file {
|
|
187
|
+
id
|
|
188
|
+
name
|
|
189
|
+
mimeType
|
|
190
|
+
size
|
|
191
|
+
downloadUrl
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
`;
|
|
196
|
+
//#endregion
|
|
197
|
+
export { u as ADD_REACTION, h as COMPLETE_UPLOAD, l as DELETE_MESSAGE, c as EDIT_MESSAGE, r as GET_CONTEXT_CONVERSATIONS, n as GET_WIDGET_CONVERSATION, i as GET_WIDGET_MESSAGES, m as INITIATE_UPLOAD, a as MESSAGE_ADDED_SUBSCRIPTION, s as MESSAGE_DELETED_SUBSCRIPTION, o as MESSAGE_UPDATED_SUBSCRIPTION, f as PIN_MESSAGE, d as REMOVE_REACTION, t as SEND_CONTEXT_MESSAGE, p as UNPIN_MESSAGE };
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import "./types.js";
|
|
2
|
+
import { COMPLETE_UPLOAD as e, INITIATE_UPLOAD as t } from "./queries.js";
|
|
3
|
+
import { useRef as n, useState as r } from "react";
|
|
4
|
+
import { useMutation as i } from "@apollo/client/react";
|
|
5
|
+
//#region src/shared/components/contextConversationWidget/useAttachmentUpload.ts
|
|
6
|
+
function a({ workspaceClient: a, onError: o }) {
|
|
7
|
+
let [s, c] = r(!1), [l, u] = r([]), d = n(null), [f] = i(t, { client: a }), [p] = i(e, { client: a });
|
|
8
|
+
return {
|
|
9
|
+
uploading: s,
|
|
10
|
+
pendingAttachments: l,
|
|
11
|
+
fileInputRef: d,
|
|
12
|
+
handleUploadFiles: async (e) => {
|
|
13
|
+
if (!(!e || e.length === 0)) {
|
|
14
|
+
c(!0);
|
|
15
|
+
try {
|
|
16
|
+
let t = [];
|
|
17
|
+
for (let n of Array.from(e)) {
|
|
18
|
+
if (n.size > 5242880) throw Error(`${n.name} exceeds the 5 MB widget upload limit.`);
|
|
19
|
+
let e = n.name.includes(".") ? n.name.split(".").pop() ?? "bin" : "bin", r = await f({ variables: { input: {
|
|
20
|
+
fileName: n.name,
|
|
21
|
+
fileSize: n.size,
|
|
22
|
+
mimeType: n.type || "application/octet-stream",
|
|
23
|
+
extension: e,
|
|
24
|
+
visibility: "PRIVATE"
|
|
25
|
+
} } }), i = r.data?.initiateUpload?.uploadUrl, a = r.data?.initiateUpload?.session?.id;
|
|
26
|
+
if (!i || !a) throw Error(`Unable to create an upload session for ${n.name}`);
|
|
27
|
+
if (!(await fetch(i, {
|
|
28
|
+
method: "PUT",
|
|
29
|
+
body: n,
|
|
30
|
+
headers: { "Content-Type": n.type || "application/octet-stream" }
|
|
31
|
+
})).ok) throw Error(`Upload failed for ${n.name}`);
|
|
32
|
+
let o = (await p({ variables: { input: { sessionId: a } } })).data?.completeUpload;
|
|
33
|
+
if (!o?.fileId) throw Error(`Failed to finalize ${n.name}`);
|
|
34
|
+
t.push({
|
|
35
|
+
fileId: o.fileId,
|
|
36
|
+
fileName: o.file?.name ?? n.name,
|
|
37
|
+
fileSize: Number(o.file?.size ?? n.size),
|
|
38
|
+
mimeType: o.file?.mimeType ?? n.type,
|
|
39
|
+
downloadUrl: o.file?.downloadUrl ?? null
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
u((e) => [...e, ...t]);
|
|
43
|
+
} catch (e) {
|
|
44
|
+
o(e instanceof Error ? e.message : "File upload failed");
|
|
45
|
+
} finally {
|
|
46
|
+
c(!1), d.current && (d.current.value = "");
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
},
|
|
50
|
+
removePendingAttachment: (e) => {
|
|
51
|
+
u((t) => t.filter((t) => t.fileId !== e));
|
|
52
|
+
},
|
|
53
|
+
clearPendingAttachments: () => u([])
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
//#endregion
|
|
57
|
+
export { a as useAttachmentUpload };
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { GET_WIDGET_MESSAGES as e, MESSAGE_ADDED_SUBSCRIPTION as t, MESSAGE_DELETED_SUBSCRIPTION as n, MESSAGE_UPDATED_SUBSCRIPTION as r } from "./queries.js";
|
|
2
|
+
import { useSubscription as i } from "@apollo/client/react";
|
|
3
|
+
//#region src/shared/components/contextConversationWidget/useConversationSubscriptions.ts
|
|
4
|
+
function a(a, o) {
|
|
5
|
+
i(t, {
|
|
6
|
+
client: a,
|
|
7
|
+
variables: { conversationId: o || "" },
|
|
8
|
+
skip: !o,
|
|
9
|
+
onData: ({ data: t, client: n }) => {
|
|
10
|
+
t.data?.messageAdded && n.refetchQueries({ include: [e] });
|
|
11
|
+
}
|
|
12
|
+
}), i(r, {
|
|
13
|
+
client: a,
|
|
14
|
+
variables: { conversationId: o || "" },
|
|
15
|
+
skip: !o
|
|
16
|
+
}), i(n, {
|
|
17
|
+
client: a,
|
|
18
|
+
variables: { conversationId: o || "" },
|
|
19
|
+
skip: !o,
|
|
20
|
+
onData: ({ client: t }) => {
|
|
21
|
+
t.refetchQueries({ include: [e] });
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
//#endregion
|
|
26
|
+
export { a as useConversationSubscriptions };
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { ADD_REACTION as e, DELETE_MESSAGE as t, EDIT_MESSAGE as n, PIN_MESSAGE as r, REMOVE_REACTION as i, UNPIN_MESSAGE as a } from "./queries.js";
|
|
2
|
+
import { useMutation as o } from "@apollo/client/react";
|
|
3
|
+
//#region src/shared/components/contextConversationWidget/useMessageActions.ts
|
|
4
|
+
function s({ client: s, currentUserId: c, refetchMessages: l }) {
|
|
5
|
+
let [u] = o(n, { client: s }), [d] = o(t, { client: s }), [f] = o(e, { client: s }), [p] = o(i, { client: s }), [m] = o(r, { client: s }), [h] = o(a, { client: s });
|
|
6
|
+
return {
|
|
7
|
+
saveEdit: async (e, t) => {
|
|
8
|
+
await u({ variables: { input: {
|
|
9
|
+
id: e,
|
|
10
|
+
content: { text: t }
|
|
11
|
+
} } }), await l();
|
|
12
|
+
},
|
|
13
|
+
toggleReaction: async (e, t) => {
|
|
14
|
+
e.reactions.some((e) => e.emoji === t && e.userId === c) ? await p({ variables: {
|
|
15
|
+
messageId: e.id,
|
|
16
|
+
emoji: t
|
|
17
|
+
} }) : await f({ variables: {
|
|
18
|
+
messageId: e.id,
|
|
19
|
+
emoji: t
|
|
20
|
+
} }), await l();
|
|
21
|
+
},
|
|
22
|
+
togglePin: async (e) => {
|
|
23
|
+
e.isPinned ? await h({ variables: { messageId: e.id } }) : await m({ variables: { messageId: e.id } }), await l();
|
|
24
|
+
},
|
|
25
|
+
deleteMessageAction: async (e) => {
|
|
26
|
+
await d({ variables: {
|
|
27
|
+
id: e.id,
|
|
28
|
+
hard: !1
|
|
29
|
+
} }), await l();
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
//#endregion
|
|
34
|
+
export { s as useMessageActions };
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { SEND_CONTEXT_MESSAGE as e } from "./queries.js";
|
|
2
|
+
import { useState as t } from "react";
|
|
3
|
+
//#region src/shared/components/contextConversationWidget/useSendMessage.ts
|
|
4
|
+
function n({ client: n, workspaceId: r, onError: i }) {
|
|
5
|
+
let [a, o] = t(!1);
|
|
6
|
+
return {
|
|
7
|
+
isSending: a,
|
|
8
|
+
send: async (t) => {
|
|
9
|
+
if (!r || !t.text.trim()) return null;
|
|
10
|
+
o(!0);
|
|
11
|
+
try {
|
|
12
|
+
let i = await n.mutate({
|
|
13
|
+
mutation: e,
|
|
14
|
+
errorPolicy: "none",
|
|
15
|
+
variables: { input: {
|
|
16
|
+
workspaceId: r,
|
|
17
|
+
sourceContext: {
|
|
18
|
+
...t.resolvedContext,
|
|
19
|
+
threadKey: t.conversationThreadKey ?? t.resolvedContext.threadKey
|
|
20
|
+
},
|
|
21
|
+
content: { text: t.text.trim() },
|
|
22
|
+
type: "TEXT",
|
|
23
|
+
parentMessageId: t.parentMessageId,
|
|
24
|
+
mentionUserIds: Array.from(new Set(t.mentionUserIds)),
|
|
25
|
+
attachments: t.attachments.map((e) => ({
|
|
26
|
+
fileId: e.fileId,
|
|
27
|
+
fileName: e.fileName,
|
|
28
|
+
fileSize: e.fileSize,
|
|
29
|
+
mimeType: e.mimeType,
|
|
30
|
+
downloadUrl: e.downloadUrl
|
|
31
|
+
}))
|
|
32
|
+
} }
|
|
33
|
+
});
|
|
34
|
+
if (!i.data?.sendContextMessage?.success) throw Error("Failed to send message");
|
|
35
|
+
return i.data.sendContextMessage.message?.conversationId ? String(i.data.sendContextMessage.message.conversationId) : null;
|
|
36
|
+
} catch (e) {
|
|
37
|
+
return i(e instanceof Error ? e.message : "Failed to send message"), null;
|
|
38
|
+
} finally {
|
|
39
|
+
o(!1);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
//#endregion
|
|
45
|
+
export { n as useSendMessage };
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { extractTextContent as e } from "./utils.js";
|
|
2
|
+
import { useMemo as t } from "react";
|
|
3
|
+
//#region src/shared/components/contextConversationWidget/useWidgetMessages.ts
|
|
4
|
+
function n(n) {
|
|
5
|
+
return t(() => (n?.messages?.edges ?? []).map((t) => {
|
|
6
|
+
let n = t.node, r = n.permissions;
|
|
7
|
+
return {
|
|
8
|
+
id: String(n.id ?? ""),
|
|
9
|
+
conversationId: String(n.conversationId ?? ""),
|
|
10
|
+
content: e(n.content),
|
|
11
|
+
authorId: String(n.authorId ?? ""),
|
|
12
|
+
parentMessageId: n.parentMessageId ? String(n.parentMessageId) : void 0,
|
|
13
|
+
threadLevel: Number(n.threadLevel ?? 0),
|
|
14
|
+
replyCount: Number(n.replyCount ?? 0),
|
|
15
|
+
createdAt: String(n.createdAt ?? (/* @__PURE__ */ new Date()).toISOString()),
|
|
16
|
+
updatedAt: String(n.updatedAt ?? (/* @__PURE__ */ new Date()).toISOString()),
|
|
17
|
+
isEdited: !!n.isEdited,
|
|
18
|
+
isPinned: !!n.isPinned,
|
|
19
|
+
permissions: {
|
|
20
|
+
canEdit: !!r?.canEdit,
|
|
21
|
+
canDelete: !!r?.canDelete,
|
|
22
|
+
canReact: !!(r?.canReact ?? !0),
|
|
23
|
+
canReply: !!(r?.canReply ?? !0),
|
|
24
|
+
canPin: !!r?.canPin
|
|
25
|
+
},
|
|
26
|
+
reactions: (n.reactions ?? []).map((e) => ({
|
|
27
|
+
id: String(e.id ?? ""),
|
|
28
|
+
emoji: String(e.emoji ?? ""),
|
|
29
|
+
userId: String(e.userId ?? "")
|
|
30
|
+
})),
|
|
31
|
+
attachments: (n.attachments ?? []).map((e) => ({
|
|
32
|
+
id: String(e.id ?? ""),
|
|
33
|
+
fileId: String(e.fileId ?? ""),
|
|
34
|
+
fileName: String(e.fileName ?? e.fileId ?? "Attachment"),
|
|
35
|
+
fileSize: Number(e.fileSize ?? 0),
|
|
36
|
+
mimeType: String(e.mimeType ?? "application/octet-stream"),
|
|
37
|
+
downloadUrl: e.downloadUrl ? String(e.downloadUrl) : null,
|
|
38
|
+
thumbnail: e.thumbnail ? String(e.thumbnail) : null
|
|
39
|
+
}))
|
|
40
|
+
};
|
|
41
|
+
}), [n]);
|
|
42
|
+
}
|
|
43
|
+
//#endregion
|
|
44
|
+
export { n as useWidgetMessages };
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
//#region src/shared/components/contextConversationWidget/utils.ts
|
|
2
|
+
function e(e) {
|
|
3
|
+
return e.trim().toLowerCase().replace(/[^a-z0-9:_/-]+/g, "-").replace(/-+/g, "-").replace(/^-|-$/g, "");
|
|
4
|
+
}
|
|
5
|
+
function t(t) {
|
|
6
|
+
if (typeof t != "string" || !t.trim()) return null;
|
|
7
|
+
try {
|
|
8
|
+
let n = typeof window < "u" ? window.location.origin : "http://local";
|
|
9
|
+
return e(new URL(t, n).pathname);
|
|
10
|
+
} catch {
|
|
11
|
+
return e(t.split(/[?#]/)[0] ?? t);
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
function n(e) {
|
|
15
|
+
return typeof e == "string" && e.trim() ? e : null;
|
|
16
|
+
}
|
|
17
|
+
function r(e) {
|
|
18
|
+
if (!e || typeof e != "object" || Array.isArray(e)) return null;
|
|
19
|
+
let t = e.metadata;
|
|
20
|
+
if (!t || typeof t != "object" || Array.isArray(t)) return null;
|
|
21
|
+
let n = t.sourceContext;
|
|
22
|
+
return n && typeof n == "object" && !Array.isArray(n) ? n : null;
|
|
23
|
+
}
|
|
24
|
+
function i(e, r) {
|
|
25
|
+
if (!e) return !1;
|
|
26
|
+
let i = n(e.product);
|
|
27
|
+
if (i && i !== r.product) return !1;
|
|
28
|
+
let a = n(e.widgetKey);
|
|
29
|
+
if (a && a !== r.widgetKey) return !1;
|
|
30
|
+
if (n(e.threadKey) === r.threadKey) return !0;
|
|
31
|
+
let o = n(e.entityType), s = n(e.entityId);
|
|
32
|
+
if (o && s && o === r.entityType && s === r.entityId) return !0;
|
|
33
|
+
let c = [t(e.pagePath), t(e.contextHref)].filter((e) => !!e), l = [t(r.pagePath), t(r.contextHref)].filter((e) => !!e);
|
|
34
|
+
return c.some((e) => l.includes(e));
|
|
35
|
+
}
|
|
36
|
+
function a(e) {
|
|
37
|
+
if (typeof e == "string") return e;
|
|
38
|
+
if (e && typeof e == "object") {
|
|
39
|
+
let t = e;
|
|
40
|
+
if (typeof t.text == "string") return t.text;
|
|
41
|
+
if (typeof t.markdown == "string") return t.markdown;
|
|
42
|
+
if (typeof t.html == "string") return t.html;
|
|
43
|
+
}
|
|
44
|
+
return "";
|
|
45
|
+
}
|
|
46
|
+
function o(e) {
|
|
47
|
+
return e < 1024 ? `${e} B` : e < 1024 * 1024 ? `${(e / 1024).toFixed(1)} KB` : `${(e / (1024 * 1024)).toFixed(1)} MB`;
|
|
48
|
+
}
|
|
49
|
+
function s(e) {
|
|
50
|
+
return new Date(e).toLocaleTimeString([], {
|
|
51
|
+
hour: "2-digit",
|
|
52
|
+
minute: "2-digit"
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
//#endregion
|
|
56
|
+
export { a as extractTextContent, o as formatFileSize, s as formatTimestamp, r as getSourceContext, n as getString, e as normalizeThreadSegment, i as sourceContextMatches };
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { graphqlFetch as e } from "../graphql/fetch.js";
|
|
2
|
-
import { createContext as t,
|
|
2
|
+
import { createContext as t, use as n, useCallback as r, useEffect as i, useMemo as a, useRef as o, useState as s } from "react";
|
|
3
3
|
import { jsx as c } from "react/jsx-runtime";
|
|
4
4
|
//#region src/shared/feature-flags/FeatureFlagProvider.tsx
|
|
5
5
|
var l = "\n query EvaluateFeatureFlags($input: EvaluateFeatureFlagsInput!) {\n evaluateFeatureFlags(input: $input) {\n evaluations {\n key\n value\n variant\n reason\n flagType\n errorCode\n }\n }\n }\n", u = t(null);
|
|
6
|
-
function d({ children: t, workspaceId:
|
|
7
|
-
let [_, v] = s(/* @__PURE__ */ new Map()), [y, b] = s(!1), [x, S] = s(null), C = o(0), w = o(null), T =
|
|
8
|
-
if (!
|
|
6
|
+
function d({ children: t, workspaceId: n, gateway: d = "global", flagKeys: f, refreshInterval: p = 300 * 1e3, staleTime: m = 300 * 1e3, debug: h = !1, defaultEnabled: g = !0 }) {
|
|
7
|
+
let [_, v] = s(/* @__PURE__ */ new Map()), [y, b] = s(!1), [x, S] = s(null), C = o(0), w = o(null), T = r(async (t = !1) => {
|
|
8
|
+
if (!n) {
|
|
9
9
|
h && console.log("[FeatureFlagProvider] No workspaceId, skipping fetch"), v(/* @__PURE__ */ new Map()), S(null);
|
|
10
10
|
return;
|
|
11
11
|
}
|
|
@@ -14,21 +14,21 @@ function d({ children: t, workspaceId: r, gateway: d = "global", flagKeys: f, re
|
|
|
14
14
|
return;
|
|
15
15
|
}
|
|
16
16
|
w.current && w.current.abort();
|
|
17
|
-
let
|
|
18
|
-
w.current =
|
|
17
|
+
let r = new AbortController();
|
|
18
|
+
w.current = r, b(!0);
|
|
19
19
|
try {
|
|
20
|
-
h && console.log("[FeatureFlagProvider] Fetching flags for workspace:",
|
|
20
|
+
h && console.log("[FeatureFlagProvider] Fetching flags for workspace:", n);
|
|
21
21
|
let t = await e({
|
|
22
22
|
gateway: d,
|
|
23
23
|
query: l,
|
|
24
24
|
variables: { input: {
|
|
25
|
-
workspaceId:
|
|
25
|
+
workspaceId: n,
|
|
26
26
|
...f && f.length > 0 ? { keys: f } : {}
|
|
27
27
|
} },
|
|
28
28
|
operationName: "EvaluateFeatureFlags",
|
|
29
|
-
signal:
|
|
29
|
+
signal: r.signal
|
|
30
30
|
});
|
|
31
|
-
if (
|
|
31
|
+
if (r.signal.aborted) return;
|
|
32
32
|
if (t.errors?.length) {
|
|
33
33
|
let e = t.errors[0].message;
|
|
34
34
|
throw h && console.error("[FeatureFlagProvider] GraphQL errors:", t.errors), Error(e);
|
|
@@ -41,10 +41,10 @@ function d({ children: t, workspaceId: r, gateway: d = "global", flagKeys: f, re
|
|
|
41
41
|
let t = e instanceof Error ? e : Error(String(e));
|
|
42
42
|
S(t), h && console.error("[FeatureFlagProvider] Fetch error:", t);
|
|
43
43
|
} finally {
|
|
44
|
-
|
|
44
|
+
r.signal.aborted || b(!1);
|
|
45
45
|
}
|
|
46
46
|
}, [
|
|
47
|
-
|
|
47
|
+
n,
|
|
48
48
|
d,
|
|
49
49
|
f,
|
|
50
50
|
m,
|
|
@@ -53,27 +53,27 @@ function d({ children: t, workspaceId: r, gateway: d = "global", flagKeys: f, re
|
|
|
53
53
|
i(() => (C.current = 0, T(!0), () => {
|
|
54
54
|
w.current && w.current.abort();
|
|
55
55
|
}), [T]), i(() => {
|
|
56
|
-
if (!p || p <= 0 || !
|
|
56
|
+
if (!p || p <= 0 || !n) return;
|
|
57
57
|
let e = setInterval(() => {
|
|
58
58
|
T(!0);
|
|
59
59
|
}, p);
|
|
60
60
|
return () => clearInterval(e);
|
|
61
61
|
}, [
|
|
62
62
|
p,
|
|
63
|
-
|
|
63
|
+
n,
|
|
64
64
|
T
|
|
65
65
|
]);
|
|
66
|
-
let E =
|
|
66
|
+
let E = r((e) => {
|
|
67
67
|
let t = _.get(e);
|
|
68
68
|
return t ? (t.flagType, !!t.value) : g;
|
|
69
|
-
}, [_, g]), D =
|
|
69
|
+
}, [_, g]), D = r((e, t) => {
|
|
70
70
|
let n = _.get(e);
|
|
71
71
|
return n ? n.value : t;
|
|
72
|
-
}, [_]), O =
|
|
72
|
+
}, [_]), O = r((e) => _.get(e), [_]), k = r(() => {
|
|
73
73
|
let e = {};
|
|
74
74
|
for (let [t, n] of _) e[t] = n.value;
|
|
75
75
|
return e;
|
|
76
|
-
}, [_]), A =
|
|
76
|
+
}, [_]), A = r(async () => {
|
|
77
77
|
h && console.log("[FeatureFlagProvider] Manual refresh requested"), await T(!0);
|
|
78
78
|
}, [T, h]), j = a(() => ({
|
|
79
79
|
evaluations: _,
|
|
@@ -84,7 +84,7 @@ function d({ children: t, workspaceId: r, gateway: d = "global", flagKeys: f, re
|
|
|
84
84
|
getEvaluation: O,
|
|
85
85
|
getAllFlags: k,
|
|
86
86
|
refreshFlags: A,
|
|
87
|
-
workspaceId:
|
|
87
|
+
workspaceId: n
|
|
88
88
|
}), [
|
|
89
89
|
_,
|
|
90
90
|
y,
|
|
@@ -94,7 +94,7 @@ function d({ children: t, workspaceId: r, gateway: d = "global", flagKeys: f, re
|
|
|
94
94
|
O,
|
|
95
95
|
k,
|
|
96
96
|
A,
|
|
97
|
-
|
|
97
|
+
n
|
|
98
98
|
]);
|
|
99
99
|
return /* @__PURE__ */ c(u.Provider, {
|
|
100
100
|
value: j,
|
|
@@ -102,7 +102,7 @@ function d({ children: t, workspaceId: r, gateway: d = "global", flagKeys: f, re
|
|
|
102
102
|
});
|
|
103
103
|
}
|
|
104
104
|
function f() {
|
|
105
|
-
let e =
|
|
105
|
+
let e = n(u);
|
|
106
106
|
if (!e) throw Error("useFeatureFlags must be used within a FeatureFlagProvider");
|
|
107
107
|
return e;
|
|
108
108
|
}
|