@fluid-app/portal-sdk 0.1.718 → 0.1.720
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
|
@@ -953,6 +953,22 @@ const scheduledMessageInputSchema = z.strictObject({ scheduled_message: z.strict
|
|
|
953
953
|
attachments_attributes: z.array(AttachmentInputSchema).optional(),
|
|
954
954
|
type: z.string().optional()
|
|
955
955
|
}) });
|
|
956
|
+
const updateScheduledMessageInputSchema = z.strictObject({ scheduled_message: z.strictObject({
|
|
957
|
+
body: z.string().optional(),
|
|
958
|
+
theme: z.string().optional(),
|
|
959
|
+
scheduled_at: z.string().datetime({ offset: true }).optional(),
|
|
960
|
+
attachments_attributes: z.array(z.strictObject({
|
|
961
|
+
url: z.string().url().optional(),
|
|
962
|
+
filename: z.string().optional(),
|
|
963
|
+
kind: z.string().optional(),
|
|
964
|
+
content_type: z.string().optional(),
|
|
965
|
+
content_size: z.number().optional(),
|
|
966
|
+
metadata: AttachmentInputMetadataSchema.optional(),
|
|
967
|
+
id: z.number().optional(),
|
|
968
|
+
_destroy: z.boolean().optional()
|
|
969
|
+
})).optional(),
|
|
970
|
+
type: z.string().optional()
|
|
971
|
+
}) });
|
|
956
972
|
async function createScheduledMessage(config, conversation_id, input) {
|
|
957
973
|
return fetchMessaging(config, {
|
|
958
974
|
endpoint: `/v1/messaging/conversations/${conversation_id}/scheduled_messages`,
|
|
@@ -967,7 +983,14 @@ async function updateScheduledMessage(config, conversation_id, id, input) {
|
|
|
967
983
|
endpoint: `/v1/messaging/conversations/${conversation_id}/scheduled_messages/${id}`,
|
|
968
984
|
method: "PUT",
|
|
969
985
|
input,
|
|
970
|
-
inputSchema:
|
|
986
|
+
inputSchema: updateScheduledMessageInputSchema,
|
|
987
|
+
outputSchema: MessageItemSchema$1
|
|
988
|
+
});
|
|
989
|
+
}
|
|
990
|
+
async function deliverScheduledMessage(config, conversation_id, id) {
|
|
991
|
+
return fetchMessaging(config, {
|
|
992
|
+
endpoint: `/v1/messaging/conversations/${conversation_id}/scheduled_messages/${id}/deliver`,
|
|
993
|
+
method: "POST",
|
|
971
994
|
outputSchema: MessageItemSchema$1
|
|
972
995
|
});
|
|
973
996
|
}
|
|
@@ -1032,6 +1055,7 @@ function createMessagingApi(config) {
|
|
|
1032
1055
|
listScheduledMessages: (cid, input) => listScheduledMessages(config, cid, input),
|
|
1033
1056
|
createScheduledMessage: (cid, input) => createScheduledMessage(config, cid, input),
|
|
1034
1057
|
updateScheduledMessage: (cid, id, input) => updateScheduledMessage(config, cid, id, input),
|
|
1058
|
+
deliverScheduledMessage: (cid, id) => deliverScheduledMessage(config, cid, id),
|
|
1035
1059
|
destroyScheduledMessage: (cid, id) => destroyScheduledMessage(config, cid, id),
|
|
1036
1060
|
listMyScheduledMessages: (input) => listMyScheduledMessages(config, input),
|
|
1037
1061
|
saveDraft: (cid, input) => saveDraft(config, cid, input),
|
|
@@ -2233,11 +2257,12 @@ function useSendMessage$1(conversationId, user, options) {
|
|
|
2233
2257
|
//#endregion
|
|
2234
2258
|
//#region ../../messaging/core/src/hooks/useUpdateScheduledMessage.ts
|
|
2235
2259
|
function useUpdateScheduledMessage$1(params, callbacks) {
|
|
2236
|
-
const { conversationId, editScheduledId, editScheduledMessage
|
|
2260
|
+
const { conversationId, editScheduledId, editScheduledMessage } = params;
|
|
2237
2261
|
const api = useMessagingApi();
|
|
2238
2262
|
const queryClient = useQueryClient();
|
|
2239
2263
|
return useMutation({
|
|
2240
2264
|
mutationFn: async ({ body, attachments }) => {
|
|
2265
|
+
if (!editScheduledMessage) throw new Error("Scheduled message must be loaded before editing");
|
|
2241
2266
|
const mappedAttachments = (attachments || []).map((a) => {
|
|
2242
2267
|
const { data: kind } = ServerFileKindEnum$1.safeParse(a.kind);
|
|
2243
2268
|
return {
|
|
@@ -2249,25 +2274,31 @@ function useUpdateScheduledMessage$1(params, callbacks) {
|
|
|
2249
2274
|
metadata: a.metadata ?? void 0
|
|
2250
2275
|
};
|
|
2251
2276
|
});
|
|
2252
|
-
const
|
|
2253
|
-
|
|
2254
|
-
|
|
2255
|
-
|
|
2277
|
+
const unmatchedOriginals = [...editScheduledMessage.attachments ?? []];
|
|
2278
|
+
const addedAttachments = mappedAttachments.filter(({ url }) => {
|
|
2279
|
+
const matchIndex = unmatchedOriginals.findIndex((original) => original.url === url);
|
|
2280
|
+
if (matchIndex === -1) return true;
|
|
2281
|
+
unmatchedOriginals.splice(matchIndex, 1);
|
|
2282
|
+
return false;
|
|
2283
|
+
});
|
|
2284
|
+
const removedAttachments = unmatchedOriginals.map(({ id }) => ({
|
|
2285
|
+
id,
|
|
2286
|
+
_destroy: true
|
|
2287
|
+
}));
|
|
2288
|
+
await api.updateScheduledMessage(conversationId, editScheduledId, { scheduled_message: {
|
|
2256
2289
|
body,
|
|
2257
|
-
|
|
2258
|
-
scheduled_at: new Date(scheduledAtISO).toISOString(),
|
|
2259
|
-
type: messageType,
|
|
2260
|
-
attachments_attributes: mappedAttachments
|
|
2290
|
+
attachments_attributes: [...removedAttachments, ...addedAttachments]
|
|
2261
2291
|
} });
|
|
2262
|
-
await api.destroyScheduledMessage(conversationId, editScheduledId);
|
|
2263
2292
|
},
|
|
2264
|
-
onSuccess:
|
|
2265
|
-
await Promise.all([queryClient.invalidateQueries({ queryKey: MESSAGES_QUERY_KEYS.listScheduledMessages(conversationId) }), queryClient.invalidateQueries({ queryKey: MESSAGES_QUERY_KEYS.listMyScheduledMessages() })]);
|
|
2293
|
+
onSuccess: () => {
|
|
2266
2294
|
callbacks?.onSuccess?.();
|
|
2267
2295
|
},
|
|
2268
2296
|
onError: (err) => {
|
|
2269
2297
|
console.error(err);
|
|
2270
2298
|
callbacks?.onError?.(err);
|
|
2299
|
+
},
|
|
2300
|
+
onSettled: async () => {
|
|
2301
|
+
await Promise.all([queryClient.invalidateQueries({ queryKey: MESSAGES_QUERY_KEYS.listScheduledMessages(conversationId) }), queryClient.invalidateQueries({ queryKey: MESSAGES_QUERY_KEYS.listMyScheduledMessages() })]);
|
|
2271
2302
|
}
|
|
2272
2303
|
});
|
|
2273
2304
|
}
|
|
@@ -56645,7 +56676,6 @@ function MessagesView({ conversationId, messageId, saveDrafts, noDateResults, re
|
|
|
56645
56676
|
conversationId,
|
|
56646
56677
|
editScheduledId,
|
|
56647
56678
|
editScheduledMessage,
|
|
56648
|
-
conversationType: conversationMetadata?.type,
|
|
56649
56679
|
onSuccess: () => {
|
|
56650
56680
|
navigation.navigate({ view: "scheduled" });
|
|
56651
56681
|
onToast?.(t("scheduled_message_updated"), "success");
|
|
@@ -57087,12 +57117,11 @@ function useSendMessage({ conversationId, user, onSuccess, onError }) {
|
|
|
57087
57117
|
function useScheduledMessages(conversationId) {
|
|
57088
57118
|
return useScheduledMessages$1(conversationId, 50);
|
|
57089
57119
|
}
|
|
57090
|
-
function useUpdateScheduledMessage({ conversationId, editScheduledId, editScheduledMessage,
|
|
57120
|
+
function useUpdateScheduledMessage({ conversationId, editScheduledId, editScheduledMessage, onSuccess, onError }) {
|
|
57091
57121
|
return useUpdateScheduledMessage$1({
|
|
57092
57122
|
conversationId,
|
|
57093
57123
|
editScheduledId,
|
|
57094
|
-
editScheduledMessage
|
|
57095
|
-
conversationType
|
|
57124
|
+
editScheduledMessage
|
|
57096
57125
|
}, {
|
|
57097
57126
|
onSuccess,
|
|
57098
57127
|
onError
|
|
@@ -58081,40 +58110,19 @@ function ScheduledMessageRow({ message, onToast }) {
|
|
|
58081
58110
|
return name;
|
|
58082
58111
|
})();
|
|
58083
58112
|
const sendNowMutation = useMutation({
|
|
58084
|
-
mutationFn:
|
|
58085
|
-
if (!fullConversation) throw new Error("Conversation not loaded");
|
|
58086
|
-
const mappedAttachments = (message.attachments || []).map((att) => {
|
|
58087
|
-
const a = att;
|
|
58088
|
-
const { data: kind } = ServerFileKindEnum$1.safeParse(a.kind);
|
|
58089
|
-
return {
|
|
58090
|
-
filename: a.filename,
|
|
58091
|
-
url: a.url,
|
|
58092
|
-
kind: kind ?? "docx",
|
|
58093
|
-
content_type: a.content_type || "application/octet-stream",
|
|
58094
|
-
content_size: a.content_size ?? 0,
|
|
58095
|
-
metadata: a.metadata ?? void 0
|
|
58096
|
-
};
|
|
58097
|
-
});
|
|
58098
|
-
const typeFromConversation = mapConversationTypeToMessageType(fullConversation.type);
|
|
58099
|
-
await api.createMessage(conversationId, { message: {
|
|
58100
|
-
type: typeFromConversation,
|
|
58101
|
-
body: message.body || "",
|
|
58102
|
-
attachments_attributes: mappedAttachments
|
|
58103
|
-
} });
|
|
58104
|
-
await api.destroyScheduledMessage(conversationId, message.id);
|
|
58105
|
-
},
|
|
58113
|
+
mutationFn: () => api.deliverScheduledMessage(conversationId, message.id),
|
|
58106
58114
|
onSuccess: async () => {
|
|
58107
|
-
await
|
|
58108
|
-
queryClient.invalidateQueries({ queryKey: MESSAGES_QUERY_KEYS.listMessages(conversationId) }),
|
|
58109
|
-
queryClient.invalidateQueries({ queryKey: MESSAGES_QUERY_KEYS.listScheduledMessages(conversationId) }),
|
|
58110
|
-
queryClient.invalidateQueries({ queryKey: MESSAGES_QUERY_KEYS.listMyScheduledMessages() })
|
|
58111
|
-
]);
|
|
58115
|
+
await queryClient.invalidateQueries({ queryKey: MESSAGES_QUERY_KEYS.listMessages(conversationId) });
|
|
58112
58116
|
navigate({
|
|
58113
58117
|
view: "conversation",
|
|
58114
58118
|
conversationId
|
|
58115
58119
|
});
|
|
58116
58120
|
},
|
|
58117
|
-
|
|
58121
|
+
onError: () => onToast?.(t("send_failed"), "error"),
|
|
58122
|
+
onSettled: async () => {
|
|
58123
|
+
await Promise.all([queryClient.invalidateQueries({ queryKey: MESSAGES_QUERY_KEYS.listScheduledMessages(conversationId) }), queryClient.invalidateQueries({ queryKey: MESSAGES_QUERY_KEYS.listMyScheduledMessages() })]);
|
|
58124
|
+
setOpenConfirm(false);
|
|
58125
|
+
}
|
|
58118
58126
|
});
|
|
58119
58127
|
const deleteMutation = useMutation({
|
|
58120
58128
|
mutationFn: async () => {
|
|
@@ -58237,11 +58245,7 @@ function ScheduledMessageRow({ message, onToast }) {
|
|
|
58237
58245
|
/* @__PURE__ */ jsx(ScheduleMessageDialog, {
|
|
58238
58246
|
open: openReschedule,
|
|
58239
58247
|
onOpenChange: setOpenReschedule,
|
|
58240
|
-
onApply: (dt) =>
|
|
58241
|
-
const iso = new Date(dt).toISOString();
|
|
58242
|
-
setRescheduleAtValue(iso);
|
|
58243
|
-
rescheduleMutation.mutate(iso);
|
|
58244
|
-
},
|
|
58248
|
+
onApply: (dt) => rescheduleMutation.mutate(dt.toISOString()),
|
|
58245
58249
|
initialDate: rescheduleAtValue ? new Date(rescheduleAtValue) : scheduledAt ? parseISO(scheduledAt) : void 0,
|
|
58246
58250
|
title: t("scheduled_reschedule_title"),
|
|
58247
58251
|
applyLabel: t("scheduled_reschedule_save"),
|
|
@@ -58644,4 +58648,4 @@ const messagingScreenPropertySchema = {
|
|
|
58644
58648
|
//#endregion
|
|
58645
58649
|
export { BottomNavVisibilityProvider as a, useMessagingAuth as i, messagingScreenPropertySchema as n, useBottomNavHidden as o, useMessagingConfig as r, MessagingScreen as t };
|
|
58646
58650
|
|
|
58647
|
-
//# sourceMappingURL=MessagingScreen-
|
|
58651
|
+
//# sourceMappingURL=MessagingScreen-CCDcfckz.mjs.map
|