@fluid-app/portal-sdk 0.1.761 → 0.1.763

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.
@@ -1654,6 +1654,7 @@ function generateSortedEmojiStringFromArray(emojis) {
1654
1654
  }
1655
1655
  //#endregion
1656
1656
  //#region ../../messaging/core/src/utils/messaging.ts
1657
+ const GROUP_DM_NAME_PATTERN = / & \d+ others?$/;
1657
1658
  function mapConversationTypeToMessageType(conversationType) {
1658
1659
  switch (conversationType) {
1659
1660
  case "DirectConversation": return "DirectMessage";
@@ -1673,7 +1674,7 @@ function mapConversationTypeToMessageType(conversationType) {
1673
1674
  * @returns the type of channel
1674
1675
  */
1675
1676
  const getMessageType = (item) => {
1676
- if (item.type === "GroupConversation" && item.name.toLowerCase().includes("other")) return {
1677
+ if (item.type === "GroupConversation" && (GROUP_DM_NAME_PATTERN.test(item.name) || item.name === "Deserted Conversation")) return {
1677
1678
  isChannel: false,
1678
1679
  type: "group-direct-message"
1679
1680
  };
@@ -2261,7 +2262,7 @@ function useUpdateScheduledMessage$1(params, callbacks) {
2261
2262
  const api = useMessagingApi();
2262
2263
  const queryClient = useQueryClient();
2263
2264
  return useMutation({
2264
- mutationFn: async ({ body, attachments }) => {
2265
+ mutationFn: async ({ body, attachments, scheduledAt }) => {
2265
2266
  if (!editScheduledMessage) throw new Error("Scheduled message must be loaded before editing");
2266
2267
  const mappedAttachments = (attachments || []).map((a) => {
2267
2268
  const { data: kind } = ServerFileKindEnum$1.safeParse(a.kind);
@@ -2287,7 +2288,8 @@ function useUpdateScheduledMessage$1(params, callbacks) {
2287
2288
  }));
2288
2289
  await api.updateScheduledMessage(conversationId, editScheduledId, { scheduled_message: {
2289
2290
  body,
2290
- attachments_attributes: [...removedAttachments, ...addedAttachments]
2291
+ attachments_attributes: [...removedAttachments, ...addedAttachments],
2292
+ scheduled_at: scheduledAt
2291
2293
  } });
2292
2294
  },
2293
2295
  onSuccess: () => {
@@ -55680,7 +55682,7 @@ function ScheduleMessageDialog({ open, onOpenChange, onApply, initialDate = null
55680
55682
  const title = titleProp ?? t("composer_schedule");
55681
55683
  const applyLabel = applyLabelProp ?? t("composer_schedule");
55682
55684
  const [now, setNow] = useState(() => /* @__PURE__ */ new Date());
55683
- const effectiveMin = useMemo(() => minDateTime ?? addMinutes(now, 1), [minDateTime, open]);
55685
+ const effectiveMin = useMemo(() => minDateTime ?? addMinutes(now, 1), [minDateTime, now]);
55684
55686
  useEffect(() => {
55685
55687
  const interval = setInterval(() => {
55686
55688
  setNow(/* @__PURE__ */ new Date());
@@ -57850,6 +57852,16 @@ function ScheduledMessageConfirmDialog({ open, onOpenChange, title, description,
57850
57852
  });
57851
57853
  }
57852
57854
  //#endregion
57855
+ //#region ../../messaging/core/src/utils/scheduled-message-status.ts
57856
+ /** The 2-hour threshold matches the Rails sender's ScheduledMessage::RANGE_TO_CONSIDER. */
57857
+ function scheduledMessageStatus(scheduledAt, now) {
57858
+ if (!scheduledAt) return null;
57859
+ const millisecondsLate = now - Date.parse(scheduledAt);
57860
+ if (millisecondsLate > 7200 * 1e3) return "failed";
57861
+ if (millisecondsLate > 600 * 1e3) return "overdue";
57862
+ return null;
57863
+ }
57864
+ //#endregion
57853
57865
  //#region ../../messaging/ui/src/components/ScheduledMessageBadges.tsx
57854
57866
  function MessageTypeBadge({ messageKind, messageType }) {
57855
57867
  if (messageKind === "sms" || messageType === "SmsMessage") return /* @__PURE__ */ jsx("div", {
@@ -57876,13 +57888,9 @@ function MessageTypeBadge({ messageKind, messageType }) {
57876
57888
  }
57877
57889
  function OverdueBadge({ scheduledAt }) {
57878
57890
  const { t } = useMessagingTranslation();
57879
- if (!scheduledAt) return null;
57880
- const when = Date.parse(scheduledAt);
57881
- if (Number.isNaN(when)) return null;
57882
- const msAgo = Date.now() - when;
57883
- const failed = msAgo > 7200 * 1e3;
57884
- if (!(msAgo > 600 * 1e3 && msAgo <= 7200 * 1e3) && !failed) return null;
57885
- if (failed) return /* @__PURE__ */ jsxs("span", {
57891
+ const status = scheduledMessageStatus(scheduledAt, Date.now());
57892
+ if (!status) return null;
57893
+ if (status === "failed") return /* @__PURE__ */ jsxs("span", {
57886
57894
  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",
57887
57895
  children: [/* @__PURE__ */ jsx(CalendarClock, { className: "-mt-[1px] h-3 w-3 text-red-700" }), t("scheduled_badge_failed")]
57888
57896
  });
@@ -58661,4 +58669,4 @@ const messagingScreenPropertySchema = {
58661
58669
  //#endregion
58662
58670
  export { BottomNavVisibilityProvider as a, useMessagingAuth as i, messagingScreenPropertySchema as n, useBottomNavHidden as o, useMessagingConfig as r, MessagingScreen as t };
58663
58671
 
58664
- //# sourceMappingURL=MessagingScreen-V95LvJRO.mjs.map
58672
+ //# sourceMappingURL=MessagingScreen-BrI2GbhQ.mjs.map