@realtimexsco/live-chat 1.3.1 → 1.3.3
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/README.md +26 -1809
- package/dist/index.cjs +114 -104
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +114 -104
- package/dist/index.mjs.map +1 -1
- package/package.json +4 -2
package/dist/index.cjs
CHANGED
|
@@ -565,7 +565,7 @@ var init_group_display_helpers = __esm({
|
|
|
565
565
|
});
|
|
566
566
|
|
|
567
567
|
// src/store/helpers/message.helpers.ts
|
|
568
|
-
var getMessageSenderId, extractMessageData, mergeLastMessage, messageHasPreviewBody, getLatestMessageFromList, isOwnMessage, getMessageContent, getMessageTimestamp,
|
|
568
|
+
var getMessageSenderId, extractMessageData, statusRank, preferHigherStatus, mergeLastMessage, messageHasPreviewBody, getLatestMessageFromList, isOwnMessage, getMessageContent, getMessageTimestamp, resolveMessageStatus, mergeChatMessages;
|
|
569
569
|
var init_message_helpers = __esm({
|
|
570
570
|
"src/store/helpers/message.helpers.ts"() {
|
|
571
571
|
getMessageSenderId = (message) => String(message?.sender?._id || message?.sender?.id || message?.senderId || message?.fromUserId || message?.sender || "");
|
|
@@ -580,21 +580,32 @@ var init_message_helpers = __esm({
|
|
|
580
580
|
const caption = payload.caption ?? payload.message?.caption ?? null;
|
|
581
581
|
return { messageId, content, conversationId, status, isPinned, isStarred, attachmentId, caption };
|
|
582
582
|
};
|
|
583
|
+
statusRank = { sent: 0, delivered: 1, read: 2 };
|
|
584
|
+
preferHigherStatus = (base, incoming) => {
|
|
585
|
+
const baseRank = statusRank[base?.status] ?? 0;
|
|
586
|
+
const incomingRank = statusRank[incoming?.status] ?? 0;
|
|
587
|
+
if (incomingRank > baseRank) {
|
|
588
|
+
return { ...base, status: incoming.status };
|
|
589
|
+
}
|
|
590
|
+
return base;
|
|
591
|
+
};
|
|
583
592
|
mergeLastMessage = (existing, incoming) => {
|
|
584
593
|
if (!incoming) return existing ?? null;
|
|
585
594
|
if (!existing) return incoming;
|
|
586
595
|
const content = incoming.content?.trim() ? incoming.content : existing.content;
|
|
587
596
|
const createdAt = incoming.createdAt ?? incoming.timestamp ?? existing.createdAt ?? existing.timestamp;
|
|
588
|
-
const
|
|
589
|
-
const
|
|
590
|
-
const newer = incomingTime >= existingTime ? incoming : existing;
|
|
597
|
+
const incomingSenderId = getMessageSenderId(incoming);
|
|
598
|
+
const resolvedSender = incomingSenderId ? incoming.sender ?? incoming.senderId ?? incoming.fromUserId : existing.sender ?? existing.senderId ?? existing.fromUserId ?? incoming.sender;
|
|
591
599
|
return {
|
|
592
600
|
...existing,
|
|
593
601
|
...incoming,
|
|
594
602
|
...content !== void 0 ? { content } : {},
|
|
595
603
|
...createdAt !== void 0 ? { createdAt } : {},
|
|
596
604
|
attachments: incoming.attachments?.length ? incoming.attachments : existing.attachments,
|
|
597
|
-
status:
|
|
605
|
+
status: preferHigherStatus(existing, incoming).status ?? existing.status ?? incoming.status,
|
|
606
|
+
...resolvedSender !== void 0 ? { sender: resolvedSender } : {},
|
|
607
|
+
senderId: incoming.senderId ?? existing.senderId,
|
|
608
|
+
fromUserId: incoming.fromUserId ?? existing.fromUserId
|
|
598
609
|
};
|
|
599
610
|
};
|
|
600
611
|
messageHasPreviewBody = (message) => Boolean(String(message?.content || "").trim()) || Array.isArray(message?.attachments) && message.attachments.length > 0;
|
|
@@ -617,15 +628,6 @@ var init_message_helpers = __esm({
|
|
|
617
628
|
const time = value ? new Date(value).getTime() : NaN;
|
|
618
629
|
return Number.isFinite(time) ? time : 0;
|
|
619
630
|
};
|
|
620
|
-
statusRank = { sent: 0, delivered: 1, read: 2 };
|
|
621
|
-
preferHigherStatus = (base, incoming) => {
|
|
622
|
-
const baseRank = statusRank[base?.status] ?? 0;
|
|
623
|
-
const incomingRank = statusRank[incoming?.status] ?? 0;
|
|
624
|
-
if (incomingRank > baseRank) {
|
|
625
|
-
return { ...base, status: incoming.status };
|
|
626
|
-
}
|
|
627
|
-
return base;
|
|
628
|
-
};
|
|
629
631
|
resolveMessageStatus = (message, conversation, loggedUserId) => {
|
|
630
632
|
const existing = message?.status || "sent";
|
|
631
633
|
if (!loggedUserId || !isOwnMessage(message, loggedUserId)) return existing;
|
|
@@ -800,7 +802,7 @@ var init_unread_helpers = __esm({
|
|
|
800
802
|
});
|
|
801
803
|
|
|
802
804
|
// src/store/helpers/conversation.helpers.ts
|
|
803
|
-
var findConversationIdByMessageId, isGroupConversation, normalizeConversationRecord, resolveConversationLastMessage, syncConversationLastMessage, upsertConversationInList, findConversationById, findConversationForChannel, resolveConversationIdForChannel;
|
|
805
|
+
var findConversationIdByMessageId, applyMessageStatusToStore, isGroupConversation, normalizeConversationRecord, resolveConversationLastMessage, syncConversationLastMessage, upsertConversationInList, findConversationById, findConversationIdByLastMessageId, findConversationForChannel, resolveConversationIdForChannel;
|
|
804
806
|
var init_conversation_helpers = __esm({
|
|
805
807
|
"src/store/helpers/conversation.helpers.ts"() {
|
|
806
808
|
init_group_display_helpers();
|
|
@@ -814,6 +816,40 @@ var init_conversation_helpers = __esm({
|
|
|
814
816
|
)
|
|
815
817
|
);
|
|
816
818
|
};
|
|
819
|
+
applyMessageStatusToStore = (state, messageId, status, conversationId) => {
|
|
820
|
+
const normalizedMessageId = String(messageId);
|
|
821
|
+
const resolvedConversationId = conversationId ? String(conversationId) : findConversationIdByMessageId(state.messagesByConversation, normalizedMessageId) || findConversationIdByLastMessageId(state.conversations, normalizedMessageId) || null;
|
|
822
|
+
const nextConversations = state.conversations.map((conversation) => {
|
|
823
|
+
const lastMessageId = String(
|
|
824
|
+
conversation?.lastMessage?._id || conversation?.lastMessage?.id || ""
|
|
825
|
+
);
|
|
826
|
+
if (lastMessageId !== normalizedMessageId) return conversation;
|
|
827
|
+
return {
|
|
828
|
+
...conversation,
|
|
829
|
+
lastMessage: mergeLastMessage(conversation.lastMessage, { status })
|
|
830
|
+
};
|
|
831
|
+
});
|
|
832
|
+
const nextMessagesByConversation = { ...state.messagesByConversation };
|
|
833
|
+
const patchMessages = (messages) => messages.map(
|
|
834
|
+
(message) => String(message._id || message.id) === normalizedMessageId ? preferHigherStatus(message, { status }) : message
|
|
835
|
+
);
|
|
836
|
+
if (resolvedConversationId && nextMessagesByConversation[resolvedConversationId]) {
|
|
837
|
+
nextMessagesByConversation[resolvedConversationId] = patchMessages(
|
|
838
|
+
nextMessagesByConversation[resolvedConversationId]
|
|
839
|
+
);
|
|
840
|
+
} else {
|
|
841
|
+
for (const cid of Object.keys(nextMessagesByConversation)) {
|
|
842
|
+
const patched = patchMessages(nextMessagesByConversation[cid]);
|
|
843
|
+
if (patched !== nextMessagesByConversation[cid]) {
|
|
844
|
+
nextMessagesByConversation[cid] = patched;
|
|
845
|
+
}
|
|
846
|
+
}
|
|
847
|
+
}
|
|
848
|
+
return {
|
|
849
|
+
conversations: nextConversations,
|
|
850
|
+
messagesByConversation: nextMessagesByConversation
|
|
851
|
+
};
|
|
852
|
+
};
|
|
817
853
|
isGroupConversation = (conversation) => {
|
|
818
854
|
if (!conversation) return false;
|
|
819
855
|
return conversation.conversationType === "group" || !!conversation.isGroup;
|
|
@@ -903,6 +939,14 @@ var init_conversation_helpers = __esm({
|
|
|
903
939
|
if (!conversationId) return void 0;
|
|
904
940
|
return conversations.find((c) => String(c._id) === String(conversationId));
|
|
905
941
|
};
|
|
942
|
+
findConversationIdByLastMessageId = (conversations, messageId) => {
|
|
943
|
+
if (!messageId) return null;
|
|
944
|
+
const normalizedMessageId = String(messageId);
|
|
945
|
+
const match = conversations.find(
|
|
946
|
+
(conversation) => String(conversation?.lastMessage?._id || conversation?.lastMessage?.id || "") === normalizedMessageId
|
|
947
|
+
);
|
|
948
|
+
return match?._id ? String(match._id) : null;
|
|
949
|
+
};
|
|
906
950
|
findConversationForChannel = (channel, loggedUserId, conversations) => {
|
|
907
951
|
if (!channel || !loggedUserId) return void 0;
|
|
908
952
|
if (channel.conversationId) {
|
|
@@ -2975,28 +3019,16 @@ var init_dm_actions = __esm({
|
|
|
2975
3019
|
},
|
|
2976
3020
|
receivedStatusUpdate: (payload) => {
|
|
2977
3021
|
const data = extractMessageData(payload);
|
|
2978
|
-
let { conversationId } = data;
|
|
2979
3022
|
const { messageId, status } = data;
|
|
2980
|
-
|
|
3023
|
+
let { conversationId } = data;
|
|
3024
|
+
if (!messageId || !status) return;
|
|
2981
3025
|
set({ lastStatusUpdate: payload });
|
|
2982
3026
|
if (!conversationId) {
|
|
2983
|
-
conversationId = findConversationIdByMessageId(get().messagesByConversation, messageId);
|
|
3027
|
+
conversationId = findConversationIdByMessageId(get().messagesByConversation, messageId) || findConversationIdByLastMessageId(get().conversations, messageId) || void 0;
|
|
2984
3028
|
}
|
|
2985
|
-
|
|
2986
|
-
|
|
2987
|
-
|
|
2988
|
-
return {
|
|
2989
|
-
messagesByConversation: {
|
|
2990
|
-
...state.messagesByConversation,
|
|
2991
|
-
[conversationId]: messages.map(
|
|
2992
|
-
(m) => String(m._id || m.id) === String(messageId) ? preferHigherStatus(m, { status }) : m
|
|
2993
|
-
)
|
|
2994
|
-
},
|
|
2995
|
-
conversations: state.conversations.map(
|
|
2996
|
-
(c) => String(c._id) === String(conversationId) && c.lastMessage && String(c.lastMessage._id || c.lastMessage.id) === String(messageId) ? { ...c, lastMessage: mergeLastMessage(c.lastMessage, { status }) } : c
|
|
2997
|
-
)
|
|
2998
|
-
};
|
|
2999
|
-
});
|
|
3029
|
+
set((state) => ({
|
|
3030
|
+
...applyMessageStatusToStore(state, String(messageId), status, conversationId)
|
|
3031
|
+
}));
|
|
3000
3032
|
},
|
|
3001
3033
|
receivedDMMarkRead: (payload) => {
|
|
3002
3034
|
const { conversationId } = payload;
|
|
@@ -3257,25 +3289,14 @@ var init_group_actions2 = __esm({
|
|
|
3257
3289
|
let { conversationId } = data;
|
|
3258
3290
|
const { messageId, status } = data;
|
|
3259
3291
|
set({ lastStatusUpdate: payload });
|
|
3292
|
+
if (!status) return;
|
|
3260
3293
|
if (messageId) {
|
|
3261
3294
|
if (!conversationId) {
|
|
3262
|
-
conversationId = findConversationIdByMessageId(get().messagesByConversation, messageId);
|
|
3295
|
+
conversationId = findConversationIdByMessageId(get().messagesByConversation, messageId) || findConversationIdByLastMessageId(get().conversations, messageId) || void 0;
|
|
3263
3296
|
}
|
|
3264
|
-
|
|
3265
|
-
|
|
3266
|
-
|
|
3267
|
-
return {
|
|
3268
|
-
messagesByConversation: {
|
|
3269
|
-
...state.messagesByConversation,
|
|
3270
|
-
[conversationId]: messages.map(
|
|
3271
|
-
(m) => String(m._id || m.id) === String(messageId) ? { ...m, status } : m
|
|
3272
|
-
)
|
|
3273
|
-
},
|
|
3274
|
-
conversations: state.conversations.map(
|
|
3275
|
-
(c) => String(c._id) === String(conversationId) && c.lastMessage && String(c.lastMessage._id || c.lastMessage.id) === String(messageId) ? { ...c, lastMessage: { ...c.lastMessage, status } } : c
|
|
3276
|
-
)
|
|
3277
|
-
};
|
|
3278
|
-
});
|
|
3297
|
+
set((state) => ({
|
|
3298
|
+
...applyMessageStatusToStore(state, String(messageId), status, conversationId)
|
|
3299
|
+
}));
|
|
3279
3300
|
return;
|
|
3280
3301
|
}
|
|
3281
3302
|
if (conversationId && status === "read") {
|
|
@@ -3290,7 +3311,7 @@ var init_group_actions2 = __esm({
|
|
|
3290
3311
|
if (String(c._id) !== String(conversationId)) return c;
|
|
3291
3312
|
let nextLastMessage = c.lastMessage;
|
|
3292
3313
|
if (nextLastMessage && String(nextLastMessage.sender?._id || nextLastMessage.sender) === String(myId)) {
|
|
3293
|
-
nextLastMessage =
|
|
3314
|
+
nextLastMessage = mergeLastMessage(nextLastMessage, { status: "read" });
|
|
3294
3315
|
}
|
|
3295
3316
|
return { ...c, lastMessage: nextLastMessage };
|
|
3296
3317
|
});
|
|
@@ -6805,15 +6826,13 @@ function useChannelList({ debouncedSearch = "" }) {
|
|
|
6805
6826
|
}
|
|
6806
6827
|
}
|
|
6807
6828
|
const draftPreview = getConversationDraftPreview(conversationId);
|
|
6808
|
-
const
|
|
6809
|
-
|
|
6810
|
-
);
|
|
6811
|
-
const
|
|
6812
|
-
|
|
6813
|
-
resolvedLastMessage
|
|
6814
|
-
|
|
6815
|
-
loggedUserDetails?._id
|
|
6816
|
-
);
|
|
6829
|
+
const storedLastMessage = c.lastMessage;
|
|
6830
|
+
const storedLastMessageId = String(storedLastMessage?._id || storedLastMessage?.id || "");
|
|
6831
|
+
const resolvedLastMessageId = String(resolvedLastMessage?._id || resolvedLastMessage?.id || "");
|
|
6832
|
+
const lastMessageStatus = storedLastMessageId && resolvedLastMessageId && storedLastMessageId === resolvedLastMessageId ? preferHigherStatus(
|
|
6833
|
+
{ status: storedLastMessage?.status },
|
|
6834
|
+
{ status: resolvedLastMessage?.status }
|
|
6835
|
+
).status ?? storedLastMessage?.status ?? resolvedLastMessage?.status : storedLastMessage?.status;
|
|
6817
6836
|
return {
|
|
6818
6837
|
id: isGroup ? conversationId : otherParticipantId,
|
|
6819
6838
|
conversationId,
|
|
@@ -6827,12 +6846,11 @@ function useChannelList({ debouncedSearch = "" }) {
|
|
|
6827
6846
|
unreadCount,
|
|
6828
6847
|
isTyping,
|
|
6829
6848
|
draftPreview,
|
|
6830
|
-
isOwnLastMessage,
|
|
6831
6849
|
pinnedCount: c.pinnedCount,
|
|
6832
6850
|
starredCount: c.starredCount,
|
|
6833
6851
|
lastMessage: {
|
|
6834
6852
|
content: lastMessageContent,
|
|
6835
|
-
timestamp: resolvedLastMessage?.createdAt ? formatSidebarTime(resolvedLastMessage.createdAt) : "",
|
|
6853
|
+
timestamp: resolvedLastMessage?.createdAt ? formatSidebarTime(resolvedLastMessage.createdAt) : c.lastMessage?.createdAt ? formatSidebarTime(c.lastMessage.createdAt) : "",
|
|
6836
6854
|
status: lastMessageStatus,
|
|
6837
6855
|
sender: "User"
|
|
6838
6856
|
}
|
|
@@ -6861,7 +6879,7 @@ function useChannelList({ debouncedSearch = "" }) {
|
|
|
6861
6879
|
init_store_helpers();
|
|
6862
6880
|
function ChannelListItem({ channel, activeChannel, onChannelSelect }) {
|
|
6863
6881
|
const isActive = activeChannel?.conversationId ? String(activeChannel.conversationId) === String(channel.conversationId) : activeChannel?.id === channel.id;
|
|
6864
|
-
const showReadReceipt = channel.
|
|
6882
|
+
const showReadReceipt = !!channel.lastMessage?.status && !channel.unreadCount && !channel.isTyping && !channel.draftPreview;
|
|
6865
6883
|
const lastStatus = channel.lastMessage?.status;
|
|
6866
6884
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
6867
6885
|
"div",
|
|
@@ -8530,24 +8548,11 @@ function GroupSenderName({ name, className }) {
|
|
|
8530
8548
|
}
|
|
8531
8549
|
|
|
8532
8550
|
// src/chat/lib/chat-message-bubble.ts
|
|
8533
|
-
function getBubbleCornerClasses(
|
|
8534
|
-
|
|
8535
|
-
return cn(
|
|
8536
|
-
"rounded-tl-[18px] rounded-bl-[18px]",
|
|
8537
|
-
isGroupedWithPrev ? "rounded-tr-[6px]" : "rounded-tr-[18px]",
|
|
8538
|
-
isGroupedWithNext ? "rounded-br-[6px]" : "rounded-br-[4px]"
|
|
8539
|
-
);
|
|
8540
|
-
}
|
|
8541
|
-
return cn(
|
|
8542
|
-
"rounded-tr-[18px] rounded-br-[18px]",
|
|
8543
|
-
isGroupedWithPrev ? "rounded-tl-[6px]" : "rounded-tl-[18px]",
|
|
8544
|
-
isGroupedWithNext ? "rounded-bl-[6px]" : "rounded-bl-[4px]"
|
|
8545
|
-
);
|
|
8551
|
+
function getBubbleCornerClasses() {
|
|
8552
|
+
return "rounded-tl-[18px] rounded-tr-[18px] rounded-br-[18px] rounded-bl-none";
|
|
8546
8553
|
}
|
|
8547
8554
|
function getChatBubbleClasses({
|
|
8548
8555
|
isSender = false,
|
|
8549
|
-
isGroupedWithPrev = false,
|
|
8550
|
-
isGroupedWithNext = false,
|
|
8551
8556
|
surface,
|
|
8552
8557
|
className
|
|
8553
8558
|
}) {
|
|
@@ -8555,7 +8560,7 @@ function getChatBubbleClasses({
|
|
|
8555
8560
|
const isNeutral = resolvedSurface === "neutral";
|
|
8556
8561
|
return cn(
|
|
8557
8562
|
"relative",
|
|
8558
|
-
getBubbleCornerClasses(
|
|
8563
|
+
getBubbleCornerClasses(),
|
|
8559
8564
|
resolvedSurface === "sent" && "chat-bubble-sent bg-(--chat-theme) text-white",
|
|
8560
8565
|
resolvedSurface === "received" && "chat-bubble-received border border-(--chat-border)/60 bg-(--chat-incoming-bubble) text-(--chat-incoming-text)",
|
|
8561
8566
|
isNeutral && "chat-bubble-received border border-(--chat-border)/60 bg-(--chat-incoming-bubble) text-(--chat-incoming-text)",
|
|
@@ -10349,11 +10354,12 @@ function MessageAttachmentsView({
|
|
|
10349
10354
|
const isImageOnlyBubble = isBubbleLayout && nonImages.length === 0 && images.length > 0;
|
|
10350
10355
|
const showImageMetaOverlay = isImageOnlyBubble && !hasMessageCaption && !anyImageHasCaption && !attachmentSelectionMode;
|
|
10351
10356
|
const showCaptionBar = showBottomBar && (!isImageOnlyBubble || hasMessageCaption);
|
|
10352
|
-
const
|
|
10357
|
+
const canShowSenderName = !!isGroup && !isSender && !!showSenderLabel && !!senderName;
|
|
10358
|
+
const showForwardedInHeader = isBubbleLayout && isForwarded;
|
|
10359
|
+
const bubbleSurface = !isBubbleLayout ? void 0 : isImageOnlyBubble && !hasMessageCaption && !anyImageHasCaption && !isForwarded && !canShowSenderName ? "media" : isSender ? "sent" : "received";
|
|
10353
10360
|
const metaTimeClass = showImageMetaOverlay ? "text-white/90" : isSender ? "text-white/70" : "text-(--chat-muted)";
|
|
10354
10361
|
const metaBorderClass = isSender ? "border-white/15" : "border-(--chat-border)/40";
|
|
10355
10362
|
const metaBadgeVariant = showImageMetaOverlay || isBubbleLayout && isSender ? "on-dark" : "default";
|
|
10356
|
-
const isForwardedImageOnly = isBubbleLayout && isForwarded && isImageOnlyBubble;
|
|
10357
10363
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
10358
10364
|
"div",
|
|
10359
10365
|
{
|
|
@@ -10370,33 +10376,38 @@ function MessageAttachmentsView({
|
|
|
10370
10376
|
"relative w-full",
|
|
10371
10377
|
isBubbleLayout && getChatBubbleClasses({
|
|
10372
10378
|
isSender,
|
|
10373
|
-
isGroupedWithPrev,
|
|
10374
|
-
isGroupedWithNext,
|
|
10375
10379
|
surface: bubbleSurface,
|
|
10376
10380
|
className: cn(
|
|
10377
|
-
isImageOnlyBubble ? "p-0" : isForwarded ? "px-2 py-0.5" : "px-2.5 py-1"
|
|
10381
|
+
isImageOnlyBubble ? "overflow-hidden p-0" : isForwarded || canShowSenderName ? "px-2 py-0.5" : "px-2.5 py-1"
|
|
10378
10382
|
)
|
|
10379
10383
|
})
|
|
10380
10384
|
),
|
|
10381
10385
|
children: [
|
|
10382
|
-
|
|
10383
|
-
|
|
10386
|
+
(canShowSenderName || showForwardedInHeader) && /* @__PURE__ */ jsxRuntime.jsxs(
|
|
10387
|
+
"div",
|
|
10388
|
+
{
|
|
10389
|
+
className: cn(
|
|
10390
|
+
"relative z-10 flex min-w-0 flex-col gap-0.5",
|
|
10391
|
+
isImageOnlyBubble ? "px-2.5 pt-1.5 pb-1" : "px-0.5 pb-0.5"
|
|
10392
|
+
),
|
|
10393
|
+
children: [
|
|
10394
|
+
canShowSenderName ? /* @__PURE__ */ jsxRuntime.jsx(GroupSenderName, { name: senderName }) : null,
|
|
10395
|
+
showForwardedInHeader ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
10396
|
+
MessageForwardedLabel,
|
|
10397
|
+
{
|
|
10398
|
+
isSender,
|
|
10399
|
+
className: "px-0 pt-0 pb-0"
|
|
10400
|
+
}
|
|
10401
|
+
) : null
|
|
10402
|
+
]
|
|
10403
|
+
}
|
|
10404
|
+
),
|
|
10384
10405
|
isBubbleLayout && replySnippet ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "px-2 pb-1", children: replySnippet }) : null,
|
|
10385
10406
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: cn(
|
|
10386
10407
|
"flex w-full flex-col",
|
|
10387
10408
|
!isImageOnlyBubble && "gap-0",
|
|
10388
|
-
isImageOnlyBubble && "relative overflow-hidden
|
|
10409
|
+
isImageOnlyBubble && "relative overflow-hidden"
|
|
10389
10410
|
), children: [
|
|
10390
|
-
isForwardedImageOnly && /* @__PURE__ */ jsxRuntime.jsx(
|
|
10391
|
-
"div",
|
|
10392
|
-
{
|
|
10393
|
-
className: cn(
|
|
10394
|
-
"pointer-events-none absolute inset-x-0 top-0 z-20 px-2 py-0.5",
|
|
10395
|
-
isSender ? "bg-linear-to-b from-(--chat-theme)/95 via-(--chat-theme)/55 to-transparent" : "bg-linear-to-b from-(--chat-incoming-bubble)/95 via-(--chat-incoming-bubble)/55 to-transparent"
|
|
10396
|
-
),
|
|
10397
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(MessageForwardedLabel, { isSender, overlay: true, className: "px-0 pt-0 pb-0" })
|
|
10398
|
-
}
|
|
10399
|
-
),
|
|
10400
10411
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
10401
10412
|
MessageAttachmentsImageSection,
|
|
10402
10413
|
{
|
|
@@ -13832,10 +13843,9 @@ function MessageItemTextBubble({
|
|
|
13832
13843
|
}) {
|
|
13833
13844
|
const bubbleClasses = (extra) => getChatBubbleClasses({
|
|
13834
13845
|
isSender,
|
|
13835
|
-
isGroupedWithPrev,
|
|
13836
|
-
isGroupedWithNext,
|
|
13837
13846
|
className: extra
|
|
13838
13847
|
});
|
|
13848
|
+
const canShowSenderName = !!isGroup && !isSender && !!showSenderLabel && !!senderName;
|
|
13839
13849
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
13840
13850
|
"div",
|
|
13841
13851
|
{
|
|
@@ -13843,15 +13853,17 @@ function MessageItemTextBubble({
|
|
|
13843
13853
|
bubbleClasses(
|
|
13844
13854
|
cn(
|
|
13845
13855
|
"flex min-w-[72px] flex-col transition-all duration-200",
|
|
13846
|
-
isForwarded ? "gap-0.5 px-2.5 py-1.5 text-[13px]" : "gap-1 px-3.5 py-2.5 text-[14px]"
|
|
13856
|
+
canShowSenderName ? "gap-0.5 px-2.5 py-1.5 text-[14px]" : isForwarded ? "gap-0.5 px-2.5 py-1.5 text-[13px]" : "gap-1 px-3.5 py-2.5 text-[14px]"
|
|
13847
13857
|
)
|
|
13848
13858
|
),
|
|
13849
13859
|
isPending && "opacity-70",
|
|
13850
13860
|
isHighlighted && (isSender ? "ring-2 ring-amber-300/60" : "ring-2 ring-amber-200/60")
|
|
13851
13861
|
),
|
|
13852
13862
|
children: [
|
|
13853
|
-
isForwarded && /* @__PURE__ */ jsxRuntime.
|
|
13854
|
-
|
|
13863
|
+
(canShowSenderName || isForwarded) && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex min-w-0 flex-col gap-0.5", children: [
|
|
13864
|
+
canShowSenderName ? /* @__PURE__ */ jsxRuntime.jsx(GroupSenderName, { name: senderName }) : null,
|
|
13865
|
+
isForwarded ? /* @__PURE__ */ jsxRuntime.jsx(MessageForwardedLabel, { isSender, className: "px-0 pt-0 pb-0" }) : null
|
|
13866
|
+
] }),
|
|
13855
13867
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
13856
13868
|
MessageReplySnippet_default,
|
|
13857
13869
|
{
|
|
@@ -14126,8 +14138,6 @@ function MessageItemView(props) {
|
|
|
14126
14138
|
const showMessageSelectionRadio = selectionMode && !isDeletedForEveryone && !!mid && !hasMultiAttachments;
|
|
14127
14139
|
const bubbleClasses = (extra) => getChatBubbleClasses({
|
|
14128
14140
|
isSender,
|
|
14129
|
-
isGroupedWithPrev,
|
|
14130
|
-
isGroupedWithNext,
|
|
14131
14141
|
className: extra
|
|
14132
14142
|
});
|
|
14133
14143
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
@@ -16881,7 +16891,7 @@ var DefaultChannelListItem = ({
|
|
|
16881
16891
|
onSelect
|
|
16882
16892
|
}) => {
|
|
16883
16893
|
const { slotClassName } = useChatCustomizationOptional();
|
|
16884
|
-
const showReadReceipt = channel.
|
|
16894
|
+
const showReadReceipt = !!channel.lastMessage?.status && !channel.unreadCount && !channel.isTyping && !channel.draftPreview;
|
|
16885
16895
|
const lastStatus = channel.lastMessage?.status;
|
|
16886
16896
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
16887
16897
|
"div",
|