@fluid-app/portal-sdk 0.1.761 → 0.1.762

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.
@@ -1659,6 +1659,7 @@ function generateSortedEmojiStringFromArray(emojis) {
1659
1659
  }
1660
1660
  //#endregion
1661
1661
  //#region ../../messaging/core/src/utils/messaging.ts
1662
+ const GROUP_DM_NAME_PATTERN = / & \d+ others?$/;
1662
1663
  function mapConversationTypeToMessageType(conversationType) {
1663
1664
  switch (conversationType) {
1664
1665
  case "DirectConversation": return "DirectMessage";
@@ -1678,7 +1679,7 @@ function mapConversationTypeToMessageType(conversationType) {
1678
1679
  * @returns the type of channel
1679
1680
  */
1680
1681
  const getMessageType = (item) => {
1681
- if (item.type === "GroupConversation" && item.name.toLowerCase().includes("other")) return {
1682
+ if (item.type === "GroupConversation" && (GROUP_DM_NAME_PATTERN.test(item.name) || item.name === "Deserted Conversation")) return {
1682
1683
  isChannel: false,
1683
1684
  type: "group-direct-message"
1684
1685
  };
@@ -2266,7 +2267,7 @@ function useUpdateScheduledMessage$1(params, callbacks) {
2266
2267
  const api = useMessagingApi();
2267
2268
  const queryClient = (0, _tanstack_react_query.useQueryClient)();
2268
2269
  return (0, _tanstack_react_query.useMutation)({
2269
- mutationFn: async ({ body, attachments }) => {
2270
+ mutationFn: async ({ body, attachments, scheduledAt }) => {
2270
2271
  if (!editScheduledMessage) throw new Error("Scheduled message must be loaded before editing");
2271
2272
  const mappedAttachments = (attachments || []).map((a) => {
2272
2273
  const { data: kind } = ServerFileKindEnum$1.safeParse(a.kind);
@@ -2292,7 +2293,8 @@ function useUpdateScheduledMessage$1(params, callbacks) {
2292
2293
  }));
2293
2294
  await api.updateScheduledMessage(conversationId, editScheduledId, { scheduled_message: {
2294
2295
  body,
2295
- attachments_attributes: [...removedAttachments, ...addedAttachments]
2296
+ attachments_attributes: [...removedAttachments, ...addedAttachments],
2297
+ scheduled_at: scheduledAt
2296
2298
  } });
2297
2299
  },
2298
2300
  onSuccess: () => {
@@ -58241,7 +58243,7 @@ function ScheduleMessageDialog({ open, onOpenChange, onApply, initialDate = null
58241
58243
  const title = titleProp ?? t("composer_schedule");
58242
58244
  const applyLabel = applyLabelProp ?? t("composer_schedule");
58243
58245
  const [now, setNow] = (0, react.useState)(() => /* @__PURE__ */ new Date());
58244
- const effectiveMin = (0, react.useMemo)(() => minDateTime ?? addMinutes(now, 1), [minDateTime, open]);
58246
+ const effectiveMin = (0, react.useMemo)(() => minDateTime ?? addMinutes(now, 1), [minDateTime, now]);
58245
58247
  (0, react.useEffect)(() => {
58246
58248
  const interval = setInterval(() => {
58247
58249
  setNow(/* @__PURE__ */ new Date());
@@ -60411,6 +60413,16 @@ function ScheduledMessageConfirmDialog({ open, onOpenChange, title, description,
60411
60413
  });
60412
60414
  }
60413
60415
  //#endregion
60416
+ //#region ../../messaging/core/src/utils/scheduled-message-status.ts
60417
+ /** The 2-hour threshold matches the Rails sender's ScheduledMessage::RANGE_TO_CONSIDER. */
60418
+ function scheduledMessageStatus(scheduledAt, now) {
60419
+ if (!scheduledAt) return null;
60420
+ const millisecondsLate = now - Date.parse(scheduledAt);
60421
+ if (millisecondsLate > 7200 * 1e3) return "failed";
60422
+ if (millisecondsLate > 600 * 1e3) return "overdue";
60423
+ return null;
60424
+ }
60425
+ //#endregion
60414
60426
  //#region ../../messaging/ui/src/components/ScheduledMessageBadges.tsx
60415
60427
  function MessageTypeBadge({ messageKind, messageType }) {
60416
60428
  if (messageKind === "sms" || messageType === "SmsMessage") return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
@@ -60437,13 +60449,9 @@ function MessageTypeBadge({ messageKind, messageType }) {
60437
60449
  }
60438
60450
  function OverdueBadge({ scheduledAt }) {
60439
60451
  const { t } = useMessagingTranslation();
60440
- if (!scheduledAt) return null;
60441
- const when = Date.parse(scheduledAt);
60442
- if (Number.isNaN(when)) return null;
60443
- const msAgo = Date.now() - when;
60444
- const failed = msAgo > 7200 * 1e3;
60445
- if (!(msAgo > 600 * 1e3 && msAgo <= 7200 * 1e3) && !failed) return null;
60446
- if (failed) return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
60452
+ const status = scheduledMessageStatus(scheduledAt, Date.now());
60453
+ if (!status) return null;
60454
+ if (status === "failed") return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
60447
60455
  className: "inline-flex items-center gap-1 rounded-md border border-red-200 bg-red-50 px-1.5 py-0.5 text-[10px] leading-3 font-semibold text-red-800",
60448
60456
  children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.CalendarClock, { className: "-mt-[1px] h-3 w-3 text-red-700" }), t("scheduled_badge_failed")]
60449
60457
  });
@@ -61257,4 +61265,4 @@ Object.defineProperty(exports, "useMessagingConfig", {
61257
61265
  }
61258
61266
  });
61259
61267
 
61260
- //# sourceMappingURL=MessagingScreen-CmOAd2El.cjs.map
61268
+ //# sourceMappingURL=MessagingScreen-Ctfvxg4y.cjs.map