@fluid-app/portal-sdk 0.1.718 → 0.1.719
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-D0jlx_CG.cjs → MessagingScreen-Bv8A4A3H.cjs} +55 -51
- package/dist/MessagingScreen-Bv8A4A3H.cjs.map +1 -0
- package/dist/{MessagingScreen-C4bTu8C2.mjs → MessagingScreen-CCDcfckz.mjs} +55 -51
- package/dist/MessagingScreen-CCDcfckz.mjs.map +1 -0
- package/dist/{MessagingScreen-DVAzsQP0.cjs → MessagingScreen-CixARTag.cjs} +1 -1
- package/dist/{MessagingScreen-CUQcGflb.mjs → MessagingScreen-NWNa14aM.mjs} +1 -1
- package/dist/index.cjs +3 -3
- package/dist/index.d.cts +15 -1
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +15 -1
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +3 -3
- package/package.json +1 -1
- package/dist/MessagingScreen-C4bTu8C2.mjs.map +0 -1
- package/dist/MessagingScreen-D0jlx_CG.cjs.map +0 -1
|
@@ -958,6 +958,22 @@ const scheduledMessageInputSchema = zod.z.strictObject({ scheduled_message: zod.
|
|
|
958
958
|
attachments_attributes: zod.z.array(AttachmentInputSchema).optional(),
|
|
959
959
|
type: zod.z.string().optional()
|
|
960
960
|
}) });
|
|
961
|
+
const updateScheduledMessageInputSchema = zod.z.strictObject({ scheduled_message: zod.z.strictObject({
|
|
962
|
+
body: zod.z.string().optional(),
|
|
963
|
+
theme: zod.z.string().optional(),
|
|
964
|
+
scheduled_at: zod.z.string().datetime({ offset: true }).optional(),
|
|
965
|
+
attachments_attributes: zod.z.array(zod.z.strictObject({
|
|
966
|
+
url: zod.z.string().url().optional(),
|
|
967
|
+
filename: zod.z.string().optional(),
|
|
968
|
+
kind: zod.z.string().optional(),
|
|
969
|
+
content_type: zod.z.string().optional(),
|
|
970
|
+
content_size: zod.z.number().optional(),
|
|
971
|
+
metadata: AttachmentInputMetadataSchema.optional(),
|
|
972
|
+
id: zod.z.number().optional(),
|
|
973
|
+
_destroy: zod.z.boolean().optional()
|
|
974
|
+
})).optional(),
|
|
975
|
+
type: zod.z.string().optional()
|
|
976
|
+
}) });
|
|
961
977
|
async function createScheduledMessage(config, conversation_id, input) {
|
|
962
978
|
return fetchMessaging(config, {
|
|
963
979
|
endpoint: `/v1/messaging/conversations/${conversation_id}/scheduled_messages`,
|
|
@@ -972,7 +988,14 @@ async function updateScheduledMessage(config, conversation_id, id, input) {
|
|
|
972
988
|
endpoint: `/v1/messaging/conversations/${conversation_id}/scheduled_messages/${id}`,
|
|
973
989
|
method: "PUT",
|
|
974
990
|
input,
|
|
975
|
-
inputSchema:
|
|
991
|
+
inputSchema: updateScheduledMessageInputSchema,
|
|
992
|
+
outputSchema: MessageItemSchema$1
|
|
993
|
+
});
|
|
994
|
+
}
|
|
995
|
+
async function deliverScheduledMessage(config, conversation_id, id) {
|
|
996
|
+
return fetchMessaging(config, {
|
|
997
|
+
endpoint: `/v1/messaging/conversations/${conversation_id}/scheduled_messages/${id}/deliver`,
|
|
998
|
+
method: "POST",
|
|
976
999
|
outputSchema: MessageItemSchema$1
|
|
977
1000
|
});
|
|
978
1001
|
}
|
|
@@ -1037,6 +1060,7 @@ function createMessagingApi(config) {
|
|
|
1037
1060
|
listScheduledMessages: (cid, input) => listScheduledMessages(config, cid, input),
|
|
1038
1061
|
createScheduledMessage: (cid, input) => createScheduledMessage(config, cid, input),
|
|
1039
1062
|
updateScheduledMessage: (cid, id, input) => updateScheduledMessage(config, cid, id, input),
|
|
1063
|
+
deliverScheduledMessage: (cid, id) => deliverScheduledMessage(config, cid, id),
|
|
1040
1064
|
destroyScheduledMessage: (cid, id) => destroyScheduledMessage(config, cid, id),
|
|
1041
1065
|
listMyScheduledMessages: (input) => listMyScheduledMessages(config, input),
|
|
1042
1066
|
saveDraft: (cid, input) => saveDraft(config, cid, input),
|
|
@@ -2238,11 +2262,12 @@ function useSendMessage$1(conversationId, user, options) {
|
|
|
2238
2262
|
//#endregion
|
|
2239
2263
|
//#region ../../messaging/core/src/hooks/useUpdateScheduledMessage.ts
|
|
2240
2264
|
function useUpdateScheduledMessage$1(params, callbacks) {
|
|
2241
|
-
const { conversationId, editScheduledId, editScheduledMessage
|
|
2265
|
+
const { conversationId, editScheduledId, editScheduledMessage } = params;
|
|
2242
2266
|
const api = useMessagingApi();
|
|
2243
2267
|
const queryClient = (0, _tanstack_react_query.useQueryClient)();
|
|
2244
2268
|
return (0, _tanstack_react_query.useMutation)({
|
|
2245
2269
|
mutationFn: async ({ body, attachments }) => {
|
|
2270
|
+
if (!editScheduledMessage) throw new Error("Scheduled message must be loaded before editing");
|
|
2246
2271
|
const mappedAttachments = (attachments || []).map((a) => {
|
|
2247
2272
|
const { data: kind } = ServerFileKindEnum$1.safeParse(a.kind);
|
|
2248
2273
|
return {
|
|
@@ -2254,25 +2279,31 @@ function useUpdateScheduledMessage$1(params, callbacks) {
|
|
|
2254
2279
|
metadata: a.metadata ?? void 0
|
|
2255
2280
|
};
|
|
2256
2281
|
});
|
|
2257
|
-
const
|
|
2258
|
-
|
|
2259
|
-
|
|
2260
|
-
|
|
2282
|
+
const unmatchedOriginals = [...editScheduledMessage.attachments ?? []];
|
|
2283
|
+
const addedAttachments = mappedAttachments.filter(({ url }) => {
|
|
2284
|
+
const matchIndex = unmatchedOriginals.findIndex((original) => original.url === url);
|
|
2285
|
+
if (matchIndex === -1) return true;
|
|
2286
|
+
unmatchedOriginals.splice(matchIndex, 1);
|
|
2287
|
+
return false;
|
|
2288
|
+
});
|
|
2289
|
+
const removedAttachments = unmatchedOriginals.map(({ id }) => ({
|
|
2290
|
+
id,
|
|
2291
|
+
_destroy: true
|
|
2292
|
+
}));
|
|
2293
|
+
await api.updateScheduledMessage(conversationId, editScheduledId, { scheduled_message: {
|
|
2261
2294
|
body,
|
|
2262
|
-
|
|
2263
|
-
scheduled_at: new Date(scheduledAtISO).toISOString(),
|
|
2264
|
-
type: messageType,
|
|
2265
|
-
attachments_attributes: mappedAttachments
|
|
2295
|
+
attachments_attributes: [...removedAttachments, ...addedAttachments]
|
|
2266
2296
|
} });
|
|
2267
|
-
await api.destroyScheduledMessage(conversationId, editScheduledId);
|
|
2268
2297
|
},
|
|
2269
|
-
onSuccess:
|
|
2270
|
-
await Promise.all([queryClient.invalidateQueries({ queryKey: MESSAGES_QUERY_KEYS.listScheduledMessages(conversationId) }), queryClient.invalidateQueries({ queryKey: MESSAGES_QUERY_KEYS.listMyScheduledMessages() })]);
|
|
2298
|
+
onSuccess: () => {
|
|
2271
2299
|
callbacks?.onSuccess?.();
|
|
2272
2300
|
},
|
|
2273
2301
|
onError: (err) => {
|
|
2274
2302
|
console.error(err);
|
|
2275
2303
|
callbacks?.onError?.(err);
|
|
2304
|
+
},
|
|
2305
|
+
onSettled: async () => {
|
|
2306
|
+
await Promise.all([queryClient.invalidateQueries({ queryKey: MESSAGES_QUERY_KEYS.listScheduledMessages(conversationId) }), queryClient.invalidateQueries({ queryKey: MESSAGES_QUERY_KEYS.listMyScheduledMessages() })]);
|
|
2276
2307
|
}
|
|
2277
2308
|
});
|
|
2278
2309
|
}
|
|
@@ -59206,7 +59237,6 @@ function MessagesView({ conversationId, messageId, saveDrafts, noDateResults, re
|
|
|
59206
59237
|
conversationId,
|
|
59207
59238
|
editScheduledId,
|
|
59208
59239
|
editScheduledMessage,
|
|
59209
|
-
conversationType: conversationMetadata?.type,
|
|
59210
59240
|
onSuccess: () => {
|
|
59211
59241
|
navigation.navigate({ view: "scheduled" });
|
|
59212
59242
|
onToast?.(t("scheduled_message_updated"), "success");
|
|
@@ -59648,12 +59678,11 @@ function useSendMessage({ conversationId, user, onSuccess, onError }) {
|
|
|
59648
59678
|
function useScheduledMessages(conversationId) {
|
|
59649
59679
|
return useScheduledMessages$1(conversationId, 50);
|
|
59650
59680
|
}
|
|
59651
|
-
function useUpdateScheduledMessage({ conversationId, editScheduledId, editScheduledMessage,
|
|
59681
|
+
function useUpdateScheduledMessage({ conversationId, editScheduledId, editScheduledMessage, onSuccess, onError }) {
|
|
59652
59682
|
return useUpdateScheduledMessage$1({
|
|
59653
59683
|
conversationId,
|
|
59654
59684
|
editScheduledId,
|
|
59655
|
-
editScheduledMessage
|
|
59656
|
-
conversationType
|
|
59685
|
+
editScheduledMessage
|
|
59657
59686
|
}, {
|
|
59658
59687
|
onSuccess,
|
|
59659
59688
|
onError
|
|
@@ -60642,40 +60671,19 @@ function ScheduledMessageRow({ message, onToast }) {
|
|
|
60642
60671
|
return name;
|
|
60643
60672
|
})();
|
|
60644
60673
|
const sendNowMutation = (0, _tanstack_react_query.useMutation)({
|
|
60645
|
-
mutationFn:
|
|
60646
|
-
if (!fullConversation) throw new Error("Conversation not loaded");
|
|
60647
|
-
const mappedAttachments = (message.attachments || []).map((att) => {
|
|
60648
|
-
const a = att;
|
|
60649
|
-
const { data: kind } = ServerFileKindEnum$1.safeParse(a.kind);
|
|
60650
|
-
return {
|
|
60651
|
-
filename: a.filename,
|
|
60652
|
-
url: a.url,
|
|
60653
|
-
kind: kind ?? "docx",
|
|
60654
|
-
content_type: a.content_type || "application/octet-stream",
|
|
60655
|
-
content_size: a.content_size ?? 0,
|
|
60656
|
-
metadata: a.metadata ?? void 0
|
|
60657
|
-
};
|
|
60658
|
-
});
|
|
60659
|
-
const typeFromConversation = mapConversationTypeToMessageType(fullConversation.type);
|
|
60660
|
-
await api.createMessage(conversationId, { message: {
|
|
60661
|
-
type: typeFromConversation,
|
|
60662
|
-
body: message.body || "",
|
|
60663
|
-
attachments_attributes: mappedAttachments
|
|
60664
|
-
} });
|
|
60665
|
-
await api.destroyScheduledMessage(conversationId, message.id);
|
|
60666
|
-
},
|
|
60674
|
+
mutationFn: () => api.deliverScheduledMessage(conversationId, message.id),
|
|
60667
60675
|
onSuccess: async () => {
|
|
60668
|
-
await
|
|
60669
|
-
queryClient.invalidateQueries({ queryKey: MESSAGES_QUERY_KEYS.listMessages(conversationId) }),
|
|
60670
|
-
queryClient.invalidateQueries({ queryKey: MESSAGES_QUERY_KEYS.listScheduledMessages(conversationId) }),
|
|
60671
|
-
queryClient.invalidateQueries({ queryKey: MESSAGES_QUERY_KEYS.listMyScheduledMessages() })
|
|
60672
|
-
]);
|
|
60676
|
+
await queryClient.invalidateQueries({ queryKey: MESSAGES_QUERY_KEYS.listMessages(conversationId) });
|
|
60673
60677
|
navigate({
|
|
60674
60678
|
view: "conversation",
|
|
60675
60679
|
conversationId
|
|
60676
60680
|
});
|
|
60677
60681
|
},
|
|
60678
|
-
|
|
60682
|
+
onError: () => onToast?.(t("send_failed"), "error"),
|
|
60683
|
+
onSettled: async () => {
|
|
60684
|
+
await Promise.all([queryClient.invalidateQueries({ queryKey: MESSAGES_QUERY_KEYS.listScheduledMessages(conversationId) }), queryClient.invalidateQueries({ queryKey: MESSAGES_QUERY_KEYS.listMyScheduledMessages() })]);
|
|
60685
|
+
setOpenConfirm(false);
|
|
60686
|
+
}
|
|
60679
60687
|
});
|
|
60680
60688
|
const deleteMutation = (0, _tanstack_react_query.useMutation)({
|
|
60681
60689
|
mutationFn: async () => {
|
|
@@ -60798,11 +60806,7 @@ function ScheduledMessageRow({ message, onToast }) {
|
|
|
60798
60806
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(ScheduleMessageDialog, {
|
|
60799
60807
|
open: openReschedule,
|
|
60800
60808
|
onOpenChange: setOpenReschedule,
|
|
60801
|
-
onApply: (dt) =>
|
|
60802
|
-
const iso = new Date(dt).toISOString();
|
|
60803
|
-
setRescheduleAtValue(iso);
|
|
60804
|
-
rescheduleMutation.mutate(iso);
|
|
60805
|
-
},
|
|
60809
|
+
onApply: (dt) => rescheduleMutation.mutate(dt.toISOString()),
|
|
60806
60810
|
initialDate: rescheduleAtValue ? new Date(rescheduleAtValue) : scheduledAt ? parseISO(scheduledAt) : void 0,
|
|
60807
60811
|
title: t("scheduled_reschedule_title"),
|
|
60808
60812
|
applyLabel: t("scheduled_reschedule_save"),
|
|
@@ -61240,4 +61244,4 @@ Object.defineProperty(exports, "useMessagingConfig", {
|
|
|
61240
61244
|
}
|
|
61241
61245
|
});
|
|
61242
61246
|
|
|
61243
|
-
//# sourceMappingURL=MessagingScreen-
|
|
61247
|
+
//# sourceMappingURL=MessagingScreen-Bv8A4A3H.cjs.map
|