@droppii-org/chat-sdk 0.4.5 → 0.4.6
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/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);
|
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,MAA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EF,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) {
|