@droppii-org/chat-sdk 0.4.4 → 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.
@@ -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,4CA8D9B,CAAC;AAEF,eAAe,uBAAuB,CAAC"}
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,mDA6EhC,CAAC;AAEF,eAAe,yBAAyB,CAAC"}
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":"ConversationDetailInput.d.ts","sourceRoot":"","sources":["../../../src/components/conversation-detail/ConversationDetailInput.tsx"],"names":[],"mappings":"AAuBA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAiB/D,MAAM,WAAW,4BAA4B;IAC3C,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,aAAa,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACvC,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACxC,WAAW,CAAC,EAAE,gBAAgB,EAAE,CAAC;IACjC,aAAa,CAAC,EAAE,MAAM,IAAI,CAAC;CAC5B;AAED,QAAA,MAAM,uBAAuB,GAAI,4EAM9B,4BAA4B,4CAmlB9B,CAAC;AAEF,eAAe,uBAAuB,CAAC"}
1
+ {"version":3,"file":"ConversationDetailInput.d.ts","sourceRoot":"","sources":["../../../src/components/conversation-detail/ConversationDetailInput.tsx"],"names":[],"mappings":"AAuBA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAiB/D,MAAM,WAAW,4BAA4B;IAC3C,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,aAAa,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACvC,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACxC,WAAW,CAAC,EAAE,gBAAgB,EAAE,CAAC;IACjC,aAAa,CAAC,EAAE,MAAM,IAAI,CAAC;CAC5B;AAED,QAAA,MAAM,uBAAuB,GAAI,4EAM9B,4BAA4B,4CA0lB9B,CAAC;AAEF,eAAe,uBAAuB,CAAC"}
@@ -124,7 +124,12 @@ const ConversationDetailInput = ({ placeholder, onSendMessage, onInputChange, mo
124
124
  const coords = getCaretCoordinates(textarea, caretIndex, {
125
125
  viewportHeight: window.innerHeight,
126
126
  });
127
- setMentionMenuPosition({ top: coords.top, left: coords.left });
127
+ setMentionMenuPosition({
128
+ top: coords.top,
129
+ bottom: coords.bottom,
130
+ left: coords.left,
131
+ direction: coords.direction,
132
+ });
128
133
  }, [isMentionMenuOpen, caretIndex, value]);
129
134
  useEffect(() => {
130
135
  const textarea = textareaRef.current;
@@ -6,7 +6,9 @@ export interface BizMentionMenuProps {
6
6
  onHoverIndex: (index: number) => void;
7
7
  position: {
8
8
  top: number;
9
+ bottom: number;
9
10
  left: number;
11
+ direction: "up" | "down";
10
12
  };
11
13
  visible: boolean;
12
14
  }
@@ -1 +1 @@
1
- {"version":3,"file":"BizMentionMenu.d.ts","sourceRoot":"","sources":["../../../../src/components/conversation-detail/mention/BizMentionMenu.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uDAAuD,CAAC;AAE3F,MAAM,WAAW,mBAAmB;IAClC,OAAO,EAAE,aAAa,EAAE,CAAC;IACzB,aAAa,EAAE,MAAM,CAAC;IACtB,QAAQ,EAAE,CAAC,MAAM,EAAE,aAAa,KAAK,IAAI,CAAC;IAC1C,YAAY,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACtC,QAAQ,EAAE;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC;IACxC,OAAO,EAAE,OAAO,CAAC;CAClB;AAED,QAAA,MAAM,cAAc,GAAI,wEAOrB,mBAAmB,mDAgDrB,CAAC;AAEF,eAAe,cAAc,CAAC"}
1
+ {"version":3,"file":"BizMentionMenu.d.ts","sourceRoot":"","sources":["../../../../src/components/conversation-detail/mention/BizMentionMenu.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uDAAuD,CAAC;AAE3F,MAAM,WAAW,mBAAmB;IAClC,OAAO,EAAE,aAAa,EAAE,CAAC;IACzB,aAAa,EAAE,MAAM,CAAC;IACtB,QAAQ,EAAE,CAAC,MAAM,EAAE,aAAa,KAAK,IAAI,CAAC;IAC1C,YAAY,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACtC,QAAQ,EAAE;QACR,GAAG,EAAE,MAAM,CAAC;QACZ,MAAM,EAAE,MAAM,CAAC;QACf,IAAI,EAAE,MAAM,CAAC;QACb,SAAS,EAAE,IAAI,GAAG,MAAM,CAAC;KAC1B,CAAC;IACF,OAAO,EAAE,OAAO,CAAC;CAClB;AAED,QAAA,MAAM,cAAc,GAAI,wEAOrB,mBAAmB,mDA2DrB,CAAC;AAEF,eAAe,cAAc,CAAC"}
@@ -6,6 +6,15 @@ const BizMentionMenu = ({ options, selectedIndex, onSelect, onHoverIndex, positi
6
6
  const { t } = useTranslation();
7
7
  if (!visible)
8
8
  return null;
9
- return (_jsxs("div", { "data-cp-name": "BizMentionMenu", "data-testid": "biz-mention-menu", className: "fixed z-50 max-h-[220px] w-[260px] overflow-y-auto rounded-md border border-gray-200 bg-white py-1 shadow-lg", style: { top: position.top, left: position.left }, children: [_jsx("div", { className: "px-3 py-1 text-xs font-medium text-gray-400", children: t("mention.menu_title") }), options.length === 0 ? (_jsx("div", { className: "px-3 py-2 text-sm text-gray-500", children: t("mention.no_result") })) : (options.map((option, index) => (_jsxs("button", { type: "button", "data-selected": index === selectedIndex, className: `flex w-full items-center gap-2 px-3 py-2 text-left text-sm ${index === selectedIndex ? "bg-blue-50" : "hover:bg-gray-50"}`, onMouseEnter: () => onHoverIndex(index), onClick: () => onSelect(option), children: [option.isAtAll ? (_jsx("span", { className: "flex h-6 w-6 shrink-0 items-center justify-center rounded-full bg-gray-100 text-gray-500", children: "@" })) : (_jsx(Avatar, { size: 24, src: option.faceURL, children: option.displayName.charAt(0) })), _jsx("span", { className: "min-w-0 flex-1 truncate", children: option.displayName })] }, option.userID))))] }));
9
+ // `direction === "down"` anchors by `top` (grows downward from the caret
10
+ // line, as before). `"up"` anchors by `bottom` (viewport height minus the
11
+ // caret's top) instead of computing a `top` from the menu's height — the
12
+ // menu's real height isn't known until it renders (it depends on
13
+ // options.length), so anchoring from the bottom lets it grow upward by
14
+ // whatever height it actually ends up with, rather than a guessed one.
15
+ const anchorStyle = position.direction === "up"
16
+ ? { bottom: position.bottom, left: position.left }
17
+ : { top: position.top, left: position.left };
18
+ return (_jsxs("div", { "data-cp-name": "BizMentionMenu", "data-testid": "biz-mention-menu", className: "fixed z-50 max-h-[220px] w-[260px] overflow-y-auto rounded-md border border-gray-200 bg-white py-1 shadow-lg", style: anchorStyle, children: [_jsx("div", { className: "px-3 py-1 text-xs font-medium text-gray-400", children: t("mention.menu_title") }), options.length === 0 ? (_jsx("div", { className: "px-3 py-2 text-sm text-gray-500", children: t("mention.no_result") })) : (options.map((option, index) => (_jsxs("button", { type: "button", "data-selected": index === selectedIndex, className: `flex w-full items-center gap-2 px-3 py-2 text-left text-sm ${index === selectedIndex ? "bg-blue-50" : "hover:bg-gray-50"}`, onMouseEnter: () => onHoverIndex(index), onClick: () => onSelect(option), children: [option.isAtAll ? (_jsx("span", { className: "flex h-6 w-6 shrink-0 items-center justify-center rounded-full bg-gray-100 text-gray-500", children: "@" })) : (_jsx(Avatar, { size: 24, src: option.faceURL, children: option.displayName.charAt(0) })), _jsx("span", { className: "min-w-0 flex-1 truncate", children: option.displayName })] }, option.userID))))] }));
10
19
  };
11
20
  export default BizMentionMenu;
@@ -1,5 +1,6 @@
1
1
  export interface CaretPixelCoordinates {
2
2
  top: number;
3
+ bottom: number;
3
4
  left: number;
4
5
  direction: "up" | "down";
5
6
  }
@@ -1 +1 @@
1
- {"version":3,"file":"getCaretCoordinates.d.ts","sourceRoot":"","sources":["../../../../src/components/conversation-detail/mention/getCaretCoordinates.ts"],"names":[],"mappings":"AAkBA,MAAM,WAAW,qBAAqB;IACpC,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,IAAI,GAAG,MAAM,CAAC;CAC1B;AAED,MAAM,WAAW,0BAA0B;IACzC,cAAc,EAAE,MAAM,CAAC;CACxB;AAED,eAAO,MAAM,mBAAmB,GAC9B,UAAU,mBAAmB,EAC7B,UAAU,MAAM,EAChB,oBAAoB,0BAA0B,KAC7C,qBAsBF,CAAC;AAEF,eAAO,MAAM,uBAAuB,GAAI,UAAU,mBAAmB,KAAG,IAEvE,CAAC"}
1
+ {"version":3,"file":"getCaretCoordinates.d.ts","sourceRoot":"","sources":["../../../../src/components/conversation-detail/mention/getCaretCoordinates.ts"],"names":[],"mappings":"AAkBA,MAAM,WAAW,qBAAqB;IACpC,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,IAAI,GAAG,MAAM,CAAC;CAC1B;AAED,MAAM,WAAW,0BAA0B;IACzC,cAAc,EAAE,MAAM,CAAC;CACxB;AAED,eAAO,MAAM,mBAAmB,GAC9B,UAAU,mBAAmB,EAC7B,UAAU,MAAM,EAChB,oBAAoB,0BAA0B,KAC7C,qBAmCF,CAAC;AAEF,eAAO,MAAM,uBAAuB,GAAI,UAAU,mBAAmB,KAAG,IAEvE,CAAC"}
@@ -24,10 +24,23 @@ export const getCaretCoordinates = (textarea, position, { viewportHeight }) => {
24
24
  const left = rect.left + caret.left - textarea.scrollLeft;
25
25
  const caretTop = rect.top + caret.top - textarea.scrollTop;
26
26
  const belowTop = caretTop + lineHeight;
27
- const opensDown = belowTop + lineHeight <= viewportHeight;
27
+ // Menu height isn't known yet at this point (it hasn't rendered — it
28
+ // depends on options.length), so this can't check "does the full menu
29
+ // fit below" the way a naive viewport comparison would. Comparing against
30
+ // just one more line height made "opens down" true even when a mobile
31
+ // composer near the bottom of the screen had no real room left, which is
32
+ // what clipped the menu behind the bottom nav. Flip up whenever there's
33
+ // clearly more room above the caret than below it instead.
34
+ const spaceBelow = viewportHeight - belowTop;
35
+ const spaceAbove = caretTop;
36
+ const opensDown = spaceBelow >= spaceAbove;
28
37
  return {
29
38
  left,
30
39
  top: opensDown ? belowTop : caretTop,
40
+ // Only meaningful when direction is "up" — the caller anchors the menu
41
+ // by `bottom` (not `top`) in that case, so it grows upward by its own
42
+ // actual rendered height instead of a guessed one.
43
+ bottom: viewportHeight - caretTop,
31
44
  direction: opensDown ? "down" : "up",
32
45
  };
33
46
  };
@@ -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,4CA+E3E,CAAC;AAEF,eAAe,qBAAqB,CAAC"}
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, { peerType: item.peerType, showName: item.showName });
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);
@@ -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,"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AAO,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"}
@@ -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, _b;
39
+ var _a;
40
40
  if (currentUserId && msgData.sendID === currentUserId) {
41
41
  return translateOrFallback(t, "you", "Bạn");
42
42
  }
43
- const senderNickname = (_a = msgData.senderNickname) === null || _a === void 0 ? void 0 : _a.trim();
44
- if (senderNickname) {
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) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@droppii-org/chat-sdk",
3
- "version": "0.4.4",
3
+ "version": "0.4.6",
4
4
  "description": "Droppii React Chat SDK",
5
5
  "repository": {
6
6
  "type": "git",