@droppii-org/chat-sdk 0.4.5 → 0.4.7
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/components/conversation/ConversationByGroupItem.d.ts.map +1 -1
- package/dist/components/conversation/ConversationByGroupItem.js +1 -0
- package/dist/components/conversation/ConversationBySessionItem.d.ts.map +1 -1
- package/dist/components/conversation/ConversationBySessionItem.js +1 -0
- package/dist/components/conversation-inbox/ConversationInboxItem.d.ts.map +1 -1
- package/dist/components/conversation-inbox/ConversationInboxItem.js +5 -1
- package/dist/components/message/item/MessageBubble.js +2 -2
- package/dist/components/message/item/index.js +2 -2
- package/dist/utils/common.d.ts +7 -5
- package/dist/utils/common.d.ts.map +1 -1
- package/dist/utils/common.js +5 -9
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConversationByGroupItem.d.ts","sourceRoot":"","sources":["../../../src/components/conversation/ConversationByGroupItem.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,yCAAyC,CAAC;AAC7E,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,qCAAqC,CAAC;AAQxF,UAAU,4BAA4B;IACpC,KAAK,EAAE,4BAA4B,CAAC;IACpC,aAAa,CAAC,EAAE,aAAa,CAAC;CAC/B;AAED,QAAA,MAAM,uBAAuB,GAAI,2BAG9B,4BAA4B,
|
|
1
|
+
{"version":3,"file":"ConversationByGroupItem.d.ts","sourceRoot":"","sources":["../../../src/components/conversation/ConversationByGroupItem.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,yCAAyC,CAAC;AAC7E,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,qCAAqC,CAAC;AAQxF,UAAU,4BAA4B;IACpC,KAAK,EAAE,4BAA4B,CAAC;IACpC,aAAa,CAAC,EAAE,aAAa,CAAC;CAC/B;AAED,QAAA,MAAM,uBAAuB,GAAI,2BAG9B,4BAA4B,4CA+D9B,CAAC;AAEF,eAAe,uBAAuB,CAAC"}
|
|
@@ -28,6 +28,7 @@ const ConversationByGroupItem = ({ group, latestPreview, }) => {
|
|
|
28
28
|
const latestMsgSendTime = (latestPreview === null || latestPreview === void 0 ? void 0 : latestPreview.latestMsgSendTime) || 0;
|
|
29
29
|
return (_jsx(ThreadCard, { onClick: handleClick, isSelected: isSelected, unreadCount: conversation.unreadCount, preview: parseLatestMessage(latestMsg, user === null || user === void 0 ? void 0 : user.userID, t, {
|
|
30
30
|
peerType: conversation.peerType,
|
|
31
|
+
conversationType: conversation.conversationType,
|
|
31
32
|
showName: conversation.showName,
|
|
32
33
|
}), mentionIndicator: _jsx(MentionIndicatorIcon, { groupAtType: conversation.groupAtType }), time: latestMsgSendTime > 0
|
|
33
34
|
? formatTimestamp(latestMsgSendTime, { hasTime: true })
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConversationBySessionItem.d.ts","sourceRoot":"","sources":["../../../src/components/conversation/ConversationBySessionItem.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,yCAAyC,CAAC;AAE7E,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAWhD,UAAU,8BAA8B;IACtC,WAAW,EAAE,gBAAgB,CAAC;IAC9B,aAAa,CAAC,EAAE,aAAa,CAAC;CAC/B;AAED,QAAA,MAAM,yBAAyB,GAAI,iCAGhC,8BAA8B,
|
|
1
|
+
{"version":3,"file":"ConversationBySessionItem.d.ts","sourceRoot":"","sources":["../../../src/components/conversation/ConversationBySessionItem.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,yCAAyC,CAAC;AAE7E,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAWhD,UAAU,8BAA8B;IACtC,WAAW,EAAE,gBAAgB,CAAC;IAC9B,aAAa,CAAC,EAAE,aAAa,CAAC;CAC/B;AAED,QAAA,MAAM,yBAAyB,GAAI,iCAGhC,8BAA8B,mDA8EhC,CAAC;AAEF,eAAe,yBAAyB,CAAC"}
|
|
@@ -39,6 +39,7 @@ const ConversationBySessionItem = ({ sessionItem, latestPreview, }) => {
|
|
|
39
39
|
return null;
|
|
40
40
|
return (_jsx(ThreadCard, { onClick: () => handleConversationClick(conversation), isSelected: isSelected, unreadCount: conversation.unreadCount, preview: parseLatestMessage(latestMsg, user === null || user === void 0 ? void 0 : user.userID, t, {
|
|
41
41
|
peerType: conversation.peerType,
|
|
42
|
+
conversationType: conversation.conversationType,
|
|
42
43
|
showName: conversation.showName,
|
|
43
44
|
}), mentionIndicator: _jsx(MentionIndicatorIcon, { groupAtType: conversation.groupAtType }), time: latestMsgSendTime > 0
|
|
44
45
|
? formatTimestamp(latestMsgSendTime, { hasTime: true })
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConversationInboxItem.d.ts","sourceRoot":"","sources":["../../../src/components/conversation-inbox/ConversationInboxItem.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAmBjE,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,
|
|
1
|
+
{"version":3,"file":"ConversationInboxItem.d.ts","sourceRoot":"","sources":["../../../src/components/conversation-inbox/ConversationInboxItem.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAmBjE,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,4CAmF3E,CAAC;AAEF,eAAe,qBAAqB,CAAC"}
|
|
@@ -30,7 +30,11 @@ const ConversationInboxItem = ({ item, onClick }) => {
|
|
|
30
30
|
const displayName = resolveConversationDisplayName(item, t);
|
|
31
31
|
const avatarUrl = useConversationAvatarUrl(item);
|
|
32
32
|
const badgeLabel = resolvePeerBadgeLabel(item.peerType, t);
|
|
33
|
-
const latestMessagePreview = parseLatestMessage(item.latestMsg, currentUserId, tCommon, {
|
|
33
|
+
const latestMessagePreview = parseLatestMessage(item.latestMsg, currentUserId, tCommon, {
|
|
34
|
+
peerType: item.peerType,
|
|
35
|
+
conversationType: item.conversationType,
|
|
36
|
+
showName: item.showName,
|
|
37
|
+
});
|
|
34
38
|
const latestMessageTime = formatLatestMessageTime(item.latestMsgSendTime || null);
|
|
35
39
|
const unreadCount = (_a = item.unreadCount) !== null && _a !== void 0 ? _a : 0;
|
|
36
40
|
const isMuted = isConversationMuted(item.recvMsgOpt);
|
|
@@ -13,7 +13,7 @@ const MessageBubble = ({ isMine, content, senderName, showSenderName, showTip =
|
|
|
13
13
|
const showTail = showTip && !isTransparent;
|
|
14
14
|
const [timeRevealed, setTimeRevealed] = useState(false);
|
|
15
15
|
const showTimeLabel = Boolean(timeLabel) && (showTip || timeRevealed);
|
|
16
|
-
const bubbleClass = clsx("relative max-w-full", isTransparent
|
|
16
|
+
const bubbleClass = clsx("relative min-w-0 max-w-full", isTransparent
|
|
17
17
|
? "bg-transparent p-0"
|
|
18
18
|
: clsx("p-2", showTip
|
|
19
19
|
? isMine
|
|
@@ -24,7 +24,7 @@ const MessageBubble = ({ isMine, content, senderName, showSenderName, showTip =
|
|
|
24
24
|
: isMine
|
|
25
25
|
? "bg-chat-bubble-mine/10"
|
|
26
26
|
: "bg-chat-bubble-neutral/10"));
|
|
27
|
-
return (_jsxs("div", { className: "relative flex items-end", "data-testid": "message-bubble", "data-cp-name": "MessageBubble", onClick: () => {
|
|
27
|
+
return (_jsxs("div", { className: "relative flex min-w-0 max-w-full items-end", "data-testid": "message-bubble", "data-cp-name": "MessageBubble", onClick: () => {
|
|
28
28
|
if (!showTip && timeLabel)
|
|
29
29
|
setTimeRevealed((prev) => !prev);
|
|
30
30
|
}, children: [!isMine && showTail && (_jsx(MessageBubbleTail, { isMine: isMine, isInternal: isInternal })), _jsx("div", { className: bubbleClass, id: id, children: _jsxs("div", { className: clsx("flex flex-col gap-1", !isTransparent && "px-1"), children: [showSenderName && senderName && (_jsx("span", { className: "text-[12px] font-medium leading-[160%] tracking-[0.12px] text-gray-400", children: senderName })), _jsx("div", { className: "flex flex-col gap-2", children: content })] }) }), isMine && showTail && (_jsx(MessageBubbleTail, { isMine: isMine, isInternal: isInternal })), showTimeLabel && (_jsx("span", { "data-testid": "message-time-label", className: clsx("absolute -bottom-2 flex h-[19px] w-[30px] items-center justify-center rounded-full bg-white text-[10px] text-gray-400 shadow-sm", isMine ? "right-1" : "left-1"), children: timeLabel }))] }));
|
|
@@ -173,12 +173,12 @@ const MessageItem = ({ message, allMessages, isGroupChat = false, forceHideTip =
|
|
|
173
173
|
const bubbleNode = (_jsx(MessageBubble, { isMine: isMine, isInternal: isInternalMessage, senderName: message === null || message === void 0 ? void 0 : message.senderNickname, showSenderName: showSenderName, showTip: showTip, id: `${MSG_ITEM_CONTENT_PREFIX}${message === null || message === void 0 ? void 0 : message.clientMsgID}`, content: renderBubbleContent(message, onPressQuoteMessage), isTransparent: isStickerMessage, timeLabel: dayjs.tz(message.sendTime).format("HH:mm") }));
|
|
174
174
|
const showPinnedBadge = Boolean(message === null || message === void 0 ? void 0 : message.isPinned);
|
|
175
175
|
const pinnedBadgeNode = showPinnedBadge ? (_jsx("span", { "data-testid": "message-pinned-badge", className: clsx("absolute -top-2.5 z-[1] flex h-[22px] w-[26px] items-center justify-center rounded-full border border-white bg-gray-25", isMine ? "left-0" : "right-0"), children: _jsx(Icon, { icon: "thumbtack-b", size: 12, className: "text-primary-400" }) })) : null;
|
|
176
|
-
const wrappedBubble = hasContextMenu ? (_jsx(Dropdown, { menu: { items: contextMenuItems }, trigger: ["contextMenu"], open: contextMenuOpen, onOpenChange: onContextMenuOpenChange, overlayClassName: MESSAGE_TOOLBOX_OVERLAY_CLASSNAME, children: _jsxs("div", { ref: bubbleWrapperRef, className: "relative min-w-0", children: [bubbleNode, pinnedBadgeNode] }) })) : (_jsxs("div", { className: "relative min-w-0", children: [bubbleNode, pinnedBadgeNode] }));
|
|
176
|
+
const wrappedBubble = hasContextMenu ? (_jsx(Dropdown, { menu: { items: contextMenuItems }, trigger: ["contextMenu"], open: contextMenuOpen, onOpenChange: onContextMenuOpenChange, overlayClassName: MESSAGE_TOOLBOX_OVERLAY_CLASSNAME, children: _jsxs("div", { ref: bubbleWrapperRef, className: "relative min-w-0 max-w-full", children: [bubbleNode, pinnedBadgeNode] }) })) : (_jsxs("div", { className: "relative min-w-0 max-w-full", children: [bubbleNode, pinnedBadgeNode] }));
|
|
177
177
|
return (_createElement("div", Object.assign({}, messageContainerProps, { key: message === null || message === void 0 ? void 0 : message.clientMsgID, "data-cp-name": "MessageItem" }),
|
|
178
178
|
timeBreakNode,
|
|
179
179
|
_jsxs("div", { className: clsx("flex min-w-0 items-end gap-1", isMine ? "justify-end pl-12 pr-3" : "justify-start pl-3 pr-12"), children: [!isMine &&
|
|
180
180
|
showPeerInfo &&
|
|
181
|
-
(showAvatar ? (_jsx(MessageAvatar, { avatarUrl: message === null || message === void 0 ? void 0 : message.senderFaceUrl, senderNickname: message === null || message === void 0 ? void 0 : message.senderNickname })) : (_jsx("div", { className: "h-6 w-6 shrink-0 self-end" }))), _jsxs("div", { className: clsx("flex min-w-0 max-w-[75%] flex-col gap-1", isMine ? "items-end" : "items-start"), children: [_jsxs("div", { className: clsx("flex items-end gap-1.5", showPinnedBadge && "mt-1.5"), children: [isMine && (_jsx(MessageStatusIndicator, { message: message, isLatest: isLatestMine })), wrappedBubble] }), isMine && message.status === MessageStatus.Failed && (_jsx("span", { className: "mt-1 text-xs text-red-500", children: isMediaResendable(message) ? (_jsx(Trans, { i18nKey: "message_send_failed", components: {
|
|
181
|
+
(showAvatar ? (_jsx(MessageAvatar, { avatarUrl: message === null || message === void 0 ? void 0 : message.senderFaceUrl, senderNickname: message === null || message === void 0 ? void 0 : message.senderNickname })) : (_jsx("div", { className: "h-6 w-6 shrink-0 self-end" }))), _jsxs("div", { className: clsx("flex min-w-0 max-w-[75%] flex-col gap-1", isMine ? "items-end" : "items-start"), children: [_jsxs("div", { className: clsx("flex min-w-0 max-w-full items-end gap-1.5", showPinnedBadge && "mt-1.5"), children: [isMine && (_jsx(MessageStatusIndicator, { message: message, isLatest: isLatestMine })), wrappedBubble] }), isMine && message.status === MessageStatus.Failed && (_jsx("span", { className: "mt-1 text-xs text-red-500", children: isMediaResendable(message) ? (_jsx(Trans, { i18nKey: "message_send_failed", components: {
|
|
182
182
|
bold: (_jsx("strong", { className: "cursor-pointer", onClick: () => resendMessage(message) })),
|
|
183
183
|
} })) : (t("message_send_failed_no_retry")) }))] })] })));
|
|
184
184
|
};
|
package/dist/utils/common.d.ts
CHANGED
|
@@ -1,7 +1,12 @@
|
|
|
1
|
-
import { ConversationItem, MessageType } from "@droppii-org/wasm-client-sdk";
|
|
1
|
+
import { ConversationItem, MessageType, SessionType } from "@droppii-org/wasm-client-sdk";
|
|
2
2
|
import { TFunction } from "i18next";
|
|
3
3
|
import { UrlMetadataInfo } from "../types/chat";
|
|
4
4
|
import { PeerType } from "../types/conversation";
|
|
5
|
+
export interface LatestMessageConversation {
|
|
6
|
+
peerType?: PeerType | string;
|
|
7
|
+
conversationType?: SessionType;
|
|
8
|
+
showName?: string;
|
|
9
|
+
}
|
|
5
10
|
export declare const formatMemberLabel: (displayName: string, username?: string) => string;
|
|
6
11
|
export declare const parseMessageContent: <T>(content?: string) => Partial<T>;
|
|
7
12
|
export declare const parseUrlMetadata: (ex?: string) => UrlMetadataInfo | undefined;
|
|
@@ -22,10 +27,7 @@ export declare const generateContentBasedOnMessageType: (contentType: MessageTyp
|
|
|
22
27
|
}) => string;
|
|
23
28
|
export declare const isInternalLatestMessage: (latestMsg?: string) => boolean;
|
|
24
29
|
export declare const ignoreInternalLatestMessage: (conversations: ConversationItem[], isCrm: boolean) => ConversationItem[];
|
|
25
|
-
export declare const parseLatestMessage: (latestMsg: string, currentUserId?: string, t?: TFunction, conversation?: {
|
|
26
|
-
peerType?: PeerType | string;
|
|
27
|
-
showName?: string;
|
|
28
|
-
}, options?: {
|
|
30
|
+
export declare const parseLatestMessage: (latestMsg: string, currentUserId?: string, t?: TFunction, conversation?: LatestMessageConversation, options?: {
|
|
29
31
|
includeSenderPrefix?: boolean;
|
|
30
32
|
}) => string;
|
|
31
33
|
export declare const highlightSearch: (text: string, keyword: string, maxLength?: number) => string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../src/utils/common.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,gBAAgB,EAEhB,WAAW,EACZ,MAAM,8BAA8B,CAAC;AAGtC,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AACpC,OAAO,EAAqB,eAAe,EAAE,MAAM,cAAc,CAAC;AAClE,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../src/utils/common.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,gBAAgB,EAEhB,WAAW,EACX,WAAW,EACZ,MAAM,8BAA8B,CAAC;AAGtC,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AACpC,OAAO,EAAqB,eAAe,EAAE,MAAM,cAAc,CAAC;AAClE,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAKhD,MAAM,WAAW,yBAAyB;IACxC,QAAQ,CAAC,EAAE,QAAQ,GAAG,MAAM,CAAC;IAC7B,gBAAgB,CAAC,EAAE,WAAW,CAAC;IAC/B,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAKD,eAAO,MAAM,iBAAiB,GAC5B,aAAa,MAAM,EACnB,WAAW,MAAM,KAChB,MAAmE,CAAC;AAEvE,eAAO,MAAM,mBAAmB,GAAI,CAAC,EAAE,UAAU,MAAM,KAAG,OAAO,CAAC,CAAC,CAQlE,CAAC;AAEF,eAAO,MAAM,gBAAgB,GAAI,KAAK,MAAM,KAAG,eAAe,GAAG,SAQhE,CAAC;AA+BF,wBAAgB,cAAc,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAItD;AAED,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAapD;AAED,UAAU,sBAAsB;IAC9B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,eAAO,MAAM,eAAe,GAC1B,OAAO,MAAM,EACb,UAAS,sBAA2B,WAoBrC,CAAC;AAEF,eAAO,MAAM,iCAAiC,GAC5C,aAAa,WAAW,EACxB,YAAY,MAAM,EAClB,IAAI,SAAS,EACb,YAAY;IAAE,QAAQ,CAAC,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;CAAE,EACpD,aAAa;IAAE,SAAS,CAAC,EAAE,MAAM,CAAC;IAAC,WAAW,CAAC,EAAE,MAAM,CAAA;CAAE,WAyC1D,CAAC;AAEF,eAAO,MAAM,uBAAuB,GAAI,YAAY,MAAM,KAAG,OAS5D,CAAC;AAEF,eAAO,MAAM,2BAA2B,GACtC,eAAe,gBAAgB,EAAE,EACjC,OAAO,OAAO,KACb,gBAAgB,EAMlB,CAAC;AAEF,eAAO,MAAM,kBAAkB,GAC7B,WAAW,MAAM,EACjB,gBAAgB,MAAM,EACtB,IAAI,SAAS,EACb,eAAe,yBAAyB,EACxC,UAAU;IAAE,mBAAmB,CAAC,EAAE,OAAO,CAAA;CAAE,WA6G5C,CAAC;AAEF,eAAO,MAAM,eAAe,GAC1B,MAAM,MAAM,EACZ,SAAS,MAAM,EACf,kBAAc,WA2Cf,CAAC;AAEF,UAAU,aAAa;IACrB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED,wBAAgB,eAAe,CAC7B,SAAS,EAAE,MAAM,EACjB,OAAO,CAAC,EAAE,aAAa,GACtB,MAAM,CAqBR;AAMD,wBAAgB,sBAAsB,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAiBhE;AAED,eAAO,MAAM,QAAQ,QAAiD,CAAC;AAEvE,wBAAgB,eAAe,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,CAqC3D;AAED,eAAO,MAAM,cAAc,GAAI,KAAK,MAAM,KAAG,MAAM,GAAG,IAOrD,CAAC;AAKF,eAAO,MAAM,iBAAiB,GAAI,MAAM,MAAM,KAAG,OACf,CAAC;AAEnC,eAAO,MAAM,SAAS,GAAI,MAAM,MAAM,KAAG,MAO9B,CAAC;AAEZ;;;;;;;;;;;GAWG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAoEjD"}
|
package/dist/utils/common.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { MessageType, } from "@droppii-org/wasm-client-sdk";
|
|
2
2
|
import dayjs from "dayjs";
|
|
3
3
|
import DOMPurify from "dompurify";
|
|
4
|
-
import { PeerType } from "../types/conversation";
|
|
5
4
|
import { CustomMessageType } from "../types/customMessage";
|
|
5
|
+
import { isGroupConversation } from "./imCommon";
|
|
6
6
|
import { getGroupNotificationText, getSystemLogMessageText } from "./messageLog";
|
|
7
7
|
// Group member pickers (create-group, add-member) can list several
|
|
8
8
|
// candidates that share the same display name — appending the username
|
|
@@ -36,18 +36,14 @@ export const parseUrlMetadata = (ex) => {
|
|
|
36
36
|
// callers to always thread a `t` through, or silently returning "".
|
|
37
37
|
const translateOrFallback = (t, key, fallback, options) => (t ? String(t(key, options)) : fallback);
|
|
38
38
|
const getSenderLabelForLatestPreview = (msgData, currentUserId, t, conversation) => {
|
|
39
|
-
var _a
|
|
39
|
+
var _a;
|
|
40
40
|
if (currentUserId && msgData.sendID === currentUserId) {
|
|
41
41
|
return translateOrFallback(t, "you", "Bạn");
|
|
42
42
|
}
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
return senderNickname;
|
|
46
|
-
}
|
|
47
|
-
if ((conversation === null || conversation === void 0 ? void 0 : conversation.peerType) === PeerType.BOT) {
|
|
48
|
-
return ((_b = conversation.showName) === null || _b === void 0 ? void 0 : _b.trim()) || undefined;
|
|
43
|
+
if (!isGroupConversation(conversation)) {
|
|
44
|
+
return undefined;
|
|
49
45
|
}
|
|
50
|
-
return undefined;
|
|
46
|
+
return ((_a = msgData.senderNickname) === null || _a === void 0 ? void 0 : _a.trim()) || undefined;
|
|
51
47
|
};
|
|
52
48
|
const formatWithSender = (sender, content) => sender ? `${sender}: ${content}` : content;
|
|
53
49
|
export function formatDuration(seconds) {
|