@fluid-app/portal-sdk 0.1.757 → 0.1.758
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/{MessagingScreen-CxX8SKBi.cjs → MessagingScreen--KcXmW3f.cjs} +1 -1
- package/dist/{MessagingScreen-02gtaS2n.mjs → MessagingScreen-BmtVCSrW.mjs} +1 -1
- package/dist/{MessagingScreen-Bg6b4oU5.cjs → MessagingScreen-CmOAd2El.cjs} +48 -35
- package/dist/{MessagingScreen-Bg6b4oU5.cjs.map → MessagingScreen-CmOAd2El.cjs.map} +1 -1
- package/dist/{MessagingScreen-CnwSwV_P.mjs → MessagingScreen-V95LvJRO.mjs} +48 -35
- package/dist/{MessagingScreen-CnwSwV_P.mjs.map → MessagingScreen-V95LvJRO.mjs.map} +1 -1
- package/dist/index.cjs +3 -3
- package/dist/index.mjs +3 -3
- package/package.json +1 -1
|
@@ -68,7 +68,7 @@ require("./translation-adapter-CNWV4qPx.cjs");
|
|
|
68
68
|
require("./translation-adapter-DFTj_Ydf.cjs");
|
|
69
69
|
require("./translation-adapter-BhsWM9YE.cjs");
|
|
70
70
|
require("./sidebar-BnZL8dM6.cjs");
|
|
71
|
-
const require_MessagingScreen = require("./MessagingScreen-
|
|
71
|
+
const require_MessagingScreen = require("./MessagingScreen-CmOAd2El.cjs");
|
|
72
72
|
require("./ScreenHeaderContext-fJKG4BUl.cjs");
|
|
73
73
|
require("./dist-CJZYdYE0.cjs");
|
|
74
74
|
require("./es-CX93V_6s.cjs");
|
|
@@ -67,7 +67,7 @@ import "./translation-adapter-C37avOSN.mjs";
|
|
|
67
67
|
import "./translation-adapter-D4UNUw8I.mjs";
|
|
68
68
|
import "./translation-adapter-BGwgAecf.mjs";
|
|
69
69
|
import "./sidebar-BqTwYEfE.mjs";
|
|
70
|
-
import { n as messagingScreenPropertySchema, t as MessagingScreen } from "./MessagingScreen-
|
|
70
|
+
import { n as messagingScreenPropertySchema, t as MessagingScreen } from "./MessagingScreen-V95LvJRO.mjs";
|
|
71
71
|
import "./ScreenHeaderContext-D7jhJX8j.mjs";
|
|
72
72
|
import "./dist-D8bAvP_X.mjs";
|
|
73
73
|
import "./es-C23yRFfb.mjs";
|
|
@@ -41157,15 +41157,9 @@ function useSaveDraft(conversationId, options) {
|
|
|
41157
41157
|
if (!result) return;
|
|
41158
41158
|
queryClient.setQueryData(MESSAGES_QUERY_KEYS.draft(conversationId), (current) => {
|
|
41159
41159
|
if (!current) return current;
|
|
41160
|
-
let updatedFiles = [...current.files];
|
|
41161
|
-
if (typeof result === "object" && result !== null && "attachments" in result && Array.isArray(result.attachments)) updatedFiles = updatedFiles.filter((file) => {
|
|
41162
|
-
return file.status !== "failed";
|
|
41163
|
-
});
|
|
41164
|
-
else updatedFiles = [];
|
|
41165
41160
|
const lastUpdatedAt = typeof result === "object" && result !== null && "updated_at" in result ? result.updated_at ?? null : null;
|
|
41166
41161
|
return {
|
|
41167
41162
|
...current,
|
|
41168
|
-
files: updatedFiles,
|
|
41169
41163
|
lastUpdatedAt
|
|
41170
41164
|
};
|
|
41171
41165
|
});
|
|
@@ -58705,8 +58699,26 @@ function convertMentionTokensInJson(node, users) {
|
|
|
58705
58699
|
//#region ../../messaging/ui/src/components/composer/useComposerActions.ts
|
|
58706
58700
|
function useComposerActions({ editor, onSend, onSaveScheduledEdit, isUploadingFiles, completedFiles, clearDebounce, saveImmediately, draft, mode, sendWithEnter, conversationType, conversationId, onScheduleSuccess, onScheduleComplete, onScheduleError }) {
|
|
58707
58701
|
const api = useMessagingApi();
|
|
58702
|
+
const isSendingRef = (0, react.useRef)(false);
|
|
58703
|
+
const canSend = conversationId > 0;
|
|
58704
|
+
const cleanupAfterSuccess = (0, react.useCallback)((markdown, sentFiles) => {
|
|
58705
|
+
sentFiles.forEach((file) => draft.removeFile(file.client_id));
|
|
58706
|
+
if (editor?.storage.markdown.getMarkdown() === markdown) {
|
|
58707
|
+
editor.commands.clearContent();
|
|
58708
|
+
draft.setBody("");
|
|
58709
|
+
}
|
|
58710
|
+
saveImmediately().catch((error) => {
|
|
58711
|
+
console.error("Failed to save draft after composer action:", error);
|
|
58712
|
+
});
|
|
58713
|
+
}, [
|
|
58714
|
+
draft,
|
|
58715
|
+
editor,
|
|
58716
|
+
saveImmediately
|
|
58717
|
+
]);
|
|
58708
58718
|
const handleSend = (0, react.useCallback)(async () => {
|
|
58719
|
+
if (isSendingRef.current) return;
|
|
58709
58720
|
if (!editor || !onSend) return;
|
|
58721
|
+
if (!canSend) return;
|
|
58710
58722
|
if (isUploadingFiles) return;
|
|
58711
58723
|
clearDebounce();
|
|
58712
58724
|
const markdown = editor.storage.markdown.getMarkdown();
|
|
@@ -58719,25 +58731,30 @@ function useComposerActions({ editor, onSend, onSaveScheduledEdit, isUploadingFi
|
|
|
58719
58731
|
content_size: file.content_size,
|
|
58720
58732
|
metadata: file.metadata ?? void 0
|
|
58721
58733
|
}));
|
|
58722
|
-
|
|
58723
|
-
|
|
58724
|
-
|
|
58725
|
-
|
|
58726
|
-
|
|
58727
|
-
console.error("Failed to
|
|
58728
|
-
|
|
58734
|
+
isSendingRef.current = true;
|
|
58735
|
+
try {
|
|
58736
|
+
if (mode === "editScheduled" && onSaveScheduledEdit) await onSaveScheduledEdit(markdown, attachments);
|
|
58737
|
+
else await onSend(markdown, attachments);
|
|
58738
|
+
} catch (error) {
|
|
58739
|
+
console.error("Failed to send message from composer:", error);
|
|
58740
|
+
return;
|
|
58741
|
+
} finally {
|
|
58742
|
+
isSendingRef.current = false;
|
|
58743
|
+
}
|
|
58744
|
+
cleanupAfterSuccess(markdown, completedFiles);
|
|
58729
58745
|
}, [
|
|
58730
58746
|
editor,
|
|
58731
58747
|
onSend,
|
|
58732
58748
|
onSaveScheduledEdit,
|
|
58733
58749
|
isUploadingFiles,
|
|
58734
58750
|
completedFiles,
|
|
58735
|
-
|
|
58736
|
-
draft,
|
|
58751
|
+
cleanupAfterSuccess,
|
|
58737
58752
|
mode,
|
|
58738
|
-
clearDebounce
|
|
58753
|
+
clearDebounce,
|
|
58754
|
+
canSend
|
|
58739
58755
|
]);
|
|
58740
58756
|
return {
|
|
58757
|
+
canSend,
|
|
58741
58758
|
handleSend,
|
|
58742
58759
|
handleKeyDown: (0, react.useCallback)((event) => {
|
|
58743
58760
|
if (mode === "editScheduled") return;
|
|
@@ -58756,6 +58773,7 @@ function useComposerActions({ editor, onSend, onSaveScheduledEdit, isUploadingFi
|
|
|
58756
58773
|
]),
|
|
58757
58774
|
handleSchedule: (0, react.useCallback)(async (scheduledAt) => {
|
|
58758
58775
|
if (!editor) return;
|
|
58776
|
+
if (!canSend) return;
|
|
58759
58777
|
if (isUploadingFiles) return;
|
|
58760
58778
|
clearDebounce();
|
|
58761
58779
|
const markdown = editor.storage.markdown.getMarkdown();
|
|
@@ -58788,11 +58806,7 @@ function useComposerActions({ editor, onSend, onSaveScheduledEdit, isUploadingFi
|
|
|
58788
58806
|
metadata: a.metadata ?? void 0
|
|
58789
58807
|
}))
|
|
58790
58808
|
} });
|
|
58791
|
-
|
|
58792
|
-
editor.commands.clearContent();
|
|
58793
|
-
saveImmediately().catch((error) => {
|
|
58794
|
-
console.error("Failed to save empty draft after schedule:", error);
|
|
58795
|
-
});
|
|
58809
|
+
cleanupAfterSuccess(markdown, completedFiles);
|
|
58796
58810
|
onScheduleSuccess?.(scheduledAt);
|
|
58797
58811
|
onScheduleComplete?.();
|
|
58798
58812
|
} catch (error) {
|
|
@@ -58801,13 +58815,13 @@ function useComposerActions({ editor, onSend, onSaveScheduledEdit, isUploadingFi
|
|
|
58801
58815
|
}
|
|
58802
58816
|
}, [
|
|
58803
58817
|
editor,
|
|
58818
|
+
canSend,
|
|
58804
58819
|
isUploadingFiles,
|
|
58805
58820
|
completedFiles,
|
|
58806
58821
|
conversationId,
|
|
58807
58822
|
conversationType,
|
|
58808
58823
|
api,
|
|
58809
|
-
|
|
58810
|
-
saveImmediately,
|
|
58824
|
+
cleanupAfterSuccess,
|
|
58811
58825
|
onScheduleSuccess,
|
|
58812
58826
|
onScheduleComplete,
|
|
58813
58827
|
onScheduleError,
|
|
@@ -58934,7 +58948,7 @@ function MessageComposer({ onSend, onScheduleSuccess, onSaveScheduledEdit, place
|
|
|
58934
58948
|
editor,
|
|
58935
58949
|
mentionableUsers
|
|
58936
58950
|
]);
|
|
58937
|
-
const { handleSend, handleKeyDown, handleSchedule } = useComposerActions({
|
|
58951
|
+
const { canSend, handleSend, handleKeyDown, handleSchedule } = useComposerActions({
|
|
58938
58952
|
editor,
|
|
58939
58953
|
onSend,
|
|
58940
58954
|
onSaveScheduledEdit,
|
|
@@ -58988,7 +59002,7 @@ function MessageComposer({ onSend, onScheduleSuccess, onSaveScheduledEdit, place
|
|
|
58988
59002
|
onSchedule: handleSchedule,
|
|
58989
59003
|
messageHasContent: hasContent,
|
|
58990
59004
|
canMentionUsers: !!mentionableUsers && mentionableUsers.length > 0,
|
|
58991
|
-
canSendMessage: hasContent && !isUploadingFiles && !disabled,
|
|
59005
|
+
canSendMessage: canSend && hasContent && !isUploadingFiles && !disabled,
|
|
58992
59006
|
mode,
|
|
58993
59007
|
onSaveEdit: mode === "editScheduled" ? handleSend : void 0,
|
|
58994
59008
|
canSchedule,
|
|
@@ -59479,7 +59493,7 @@ function MessagesView({ conversationId, messageId, saveDrafts, noDateResults, re
|
|
|
59479
59493
|
setEntryUnreadBaselineId(null);
|
|
59480
59494
|
baselineCapturedRef.current = true;
|
|
59481
59495
|
unresolvedBaselineOrdinalRef.current = 0;
|
|
59482
|
-
sendMessageMutation.
|
|
59496
|
+
return sendMessageMutation.mutateAsync({
|
|
59483
59497
|
body,
|
|
59484
59498
|
attachments
|
|
59485
59499
|
});
|
|
@@ -59490,8 +59504,8 @@ function MessagesView({ conversationId, messageId, saveDrafts, noDateResults, re
|
|
|
59490
59504
|
sendMessageMutation
|
|
59491
59505
|
]);
|
|
59492
59506
|
const handleSaveScheduledEdit = (0, react.useCallback)(async (body, attachments = []) => {
|
|
59493
|
-
if (!isEditingScheduled || !conversationMetadata)
|
|
59494
|
-
updateScheduledMutation.
|
|
59507
|
+
if (!isEditingScheduled || !conversationMetadata) throw new Error("Scheduled message edit is not ready to save");
|
|
59508
|
+
return updateScheduledMutation.mutateAsync({
|
|
59495
59509
|
body,
|
|
59496
59510
|
attachments
|
|
59497
59511
|
});
|
|
@@ -59544,8 +59558,7 @@ function MessagesView({ conversationId, messageId, saveDrafts, noDateResults, re
|
|
|
59544
59558
|
onSend: handleSend,
|
|
59545
59559
|
onSaveScheduledEdit: handleSaveScheduledEdit,
|
|
59546
59560
|
onScheduleSuccess: handleScheduleSuccess
|
|
59547
|
-
});
|
|
59548
|
-
if (isLoading) return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(MessagingLoadingSkeleton, { label: t("loading_messaging") }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", { children: composer }, "layer-2")] }, "layer-1");
|
|
59561
|
+
}, "composer-input");
|
|
59549
59562
|
if (isError || metadataError) {
|
|
59550
59563
|
const metaNotFound = metadataError && "status" in metadataError && metadataError.status === 404;
|
|
59551
59564
|
const messagesNotFound = messagesError && "status" in messagesError && messagesError.status === 404;
|
|
@@ -59558,7 +59571,7 @@ function MessagesView({ conversationId, messageId, saveDrafts, noDateResults, re
|
|
|
59558
59571
|
}
|
|
59559
59572
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
59560
59573
|
className: "flex h-full min-h-0 flex-col",
|
|
59561
|
-
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)(AnchoredItems, {
|
|
59574
|
+
children: [isLoading ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(MessagingLoadingSkeleton, { label: t("loading_messaging") }) : /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(AnchoredItems, {
|
|
59562
59575
|
scrollerRef,
|
|
59563
59576
|
scrollToKeyOnce: messageId ? `id:${messageId}` : void 0,
|
|
59564
59577
|
onCorrection: (correctionAmount) => issueCorrection(correctionAmount),
|
|
@@ -59637,15 +59650,15 @@ function MessagesView({ conversationId, messageId, saveDrafts, noDateResults, re
|
|
|
59637
59650
|
}, "watcher-bottom")
|
|
59638
59651
|
]
|
|
59639
59652
|
}), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
59640
|
-
className: "from-background sticky bottom-0 z-40 flex-shrink-0 bg-gradient-to-t to-transparent",
|
|
59653
|
+
className: isLoading ? void 0 : "from-background sticky bottom-0 z-40 flex-shrink-0 bg-gradient-to-t to-transparent",
|
|
59641
59654
|
children: [
|
|
59642
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(MessagesViewScheduledBanner, {
|
|
59655
|
+
!isLoading && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(MessagesViewScheduledBanner, {
|
|
59643
59656
|
optimisticScheduled,
|
|
59644
59657
|
scheduledData,
|
|
59645
59658
|
isEditingScheduled,
|
|
59646
59659
|
renderScheduledBanner
|
|
59647
59660
|
}),
|
|
59648
|
-
hasNewMessages && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
59661
|
+
!isLoading && hasNewMessages && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
59649
59662
|
className: "pointer-events-auto absolute bottom-full mb-2 flex w-full justify-center",
|
|
59650
59663
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
|
|
59651
59664
|
type: "button",
|
|
@@ -61244,4 +61257,4 @@ Object.defineProperty(exports, "useMessagingConfig", {
|
|
|
61244
61257
|
}
|
|
61245
61258
|
});
|
|
61246
61259
|
|
|
61247
|
-
//# sourceMappingURL=MessagingScreen-
|
|
61260
|
+
//# sourceMappingURL=MessagingScreen-CmOAd2El.cjs.map
|