@droppii-org/chat-sdk 0.6.30 → 0.6.32
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConversationInboxItem.d.ts","sourceRoot":"","sources":["../../../src/components/conversation-inbox/ConversationInboxItem.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ConversationInboxItem.d.ts","sourceRoot":"","sources":["../../../src/components/conversation-inbox/ConversationInboxItem.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAoBjE,MAAM,WAAW,0BAA0B;IACzC,IAAI,EAAE,oBAAoB,CAAC;IAC3B,OAAO,EAAE,CAAC,IAAI,EAAE,oBAAoB,KAAK,IAAI,CAAC;CAC/C;AAQD,QAAA,MAAM,qBAAqB,GAAI,mBAAmB,0BAA0B,4CA4F3E,CAAC;AAEF,eAAe,qBAAqB,CAAC"}
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { useMemo } from "react";
|
|
3
4
|
import dayjs from "dayjs";
|
|
4
5
|
import { useTranslation } from "react-i18next";
|
|
5
6
|
import useAuthStore from "../../store/auth";
|
|
6
7
|
import { formatTimestamp, parseLatestMessage } from "../../utils/common";
|
|
8
|
+
import { isSessionEventMessage } from "../../utils/messageLog";
|
|
7
9
|
import { resolvePeerBadgeLabel, resolveConversationDisplayName, } from "../../utils/conversation";
|
|
8
10
|
import { useConversationAvatarUrl } from "../../hooks/conversation/useConversationAvatarUrl";
|
|
9
11
|
import { useIsJoinedGroup } from "../../hooks/session/useIsJoinedGroup";
|
|
@@ -30,11 +32,26 @@ const ConversationInboxItem = ({ item, onClick }) => {
|
|
|
30
32
|
const displayName = resolveConversationDisplayName(item, t);
|
|
31
33
|
const avatarUrl = useConversationAvatarUrl(item);
|
|
32
34
|
const badgeLabel = resolvePeerBadgeLabel(item.peerType, t);
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
35
|
+
// A session boundary event ("Phiên chat đã bắt đầu/kết thúc") is a state
|
|
36
|
+
// marker, not real dialogue, so it must never become the card's preview —
|
|
37
|
+
// same rule chat-mobile's ThreadCard applies to its own noise messages.
|
|
38
|
+
const isSessionEventPreview = useMemo(() => {
|
|
39
|
+
if (!item.latestMsg)
|
|
40
|
+
return false;
|
|
41
|
+
try {
|
|
42
|
+
return isSessionEventMessage(JSON.parse(item.latestMsg));
|
|
43
|
+
}
|
|
44
|
+
catch (_a) {
|
|
45
|
+
return false;
|
|
46
|
+
}
|
|
47
|
+
}, [item.latestMsg]);
|
|
48
|
+
const latestMessagePreview = isSessionEventPreview
|
|
49
|
+
? ""
|
|
50
|
+
: parseLatestMessage(item.latestMsg, currentUserId, tCommon, {
|
|
51
|
+
peerType: item.peerType,
|
|
52
|
+
conversationType: item.conversationType,
|
|
53
|
+
showName: item.showName,
|
|
54
|
+
});
|
|
38
55
|
const latestMessageTime = formatLatestMessageTime(item.latestMsgSendTime || null);
|
|
39
56
|
const unreadCount = (_a = item.unreadCount) !== null && _a !== void 0 ? _a : 0;
|
|
40
57
|
const isMuted = isConversationMuted(item.recvMsgOpt);
|