@droppii-org/chat-sdk 0.1.67 → 0.1.69

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":"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;AAShD,UAAU,8BAA8B;IACtC,WAAW,EAAE,gBAAgB,CAAC;IAC9B,aAAa,CAAC,EAAE,aAAa,CAAC;CAC/B;AAED,QAAA,MAAM,yBAAyB,GAAI,iCAGhC,8BAA8B,mDA8DhC,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;AAShD,UAAU,8BAA8B;IACtC,WAAW,EAAE,gBAAgB,CAAC;IAC9B,aAAa,CAAC,EAAE,aAAa,CAAC;CAC/B;AAED,QAAA,MAAM,yBAAyB,GAAI,iCAGhC,8BAA8B,mDAiEhC,CAAC;AAEF,eAAe,yBAAyB,CAAC"}
@@ -35,7 +35,10 @@ const ConversationBySessionItem = ({ sessionItem, latestPreview, }) => {
35
35
  const latestMsgSendTime = (latestPreview === null || latestPreview === void 0 ? void 0 : latestPreview.latestMsgSendTime) || 0;
36
36
  if (!conversation)
37
37
  return null;
38
- return (_jsx(ThreadCard, { onClick: () => handleConversationClick(conversation), isSelected: isSelected, unreadCount: conversation.unreadCount, preview: parseLatestMessage(latestMsg, user === null || user === void 0 ? void 0 : user.userID, t), time: latestMsgSendTime > 0
38
+ return (_jsx(ThreadCard, { onClick: () => handleConversationClick(conversation), isSelected: isSelected, unreadCount: conversation.unreadCount, preview: parseLatestMessage(latestMsg, user === null || user === void 0 ? void 0 : user.userID, t, {
39
+ peerType: conversation.peerType,
40
+ showName: conversation.showName,
41
+ }), time: latestMsgSendTime > 0
39
42
  ? formatTimestamp(latestMsgSendTime, { hasTime: true })
40
43
  : undefined, avatar: _jsx(Avatar, { size: 48, src: avatar, children: ((_a = displayName === null || displayName === void 0 ? void 0 : displayName.charAt) === null || _a === void 0 ? void 0 : _a.call(displayName, 0)) || "A" }), title: _jsx("h3", { className: "truncate text-sm font-semibold text-gray-900", children: displayName }) }));
41
44
  };
@@ -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;AAYjE,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,4CA0C3E,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;AAYjE,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,4CA2C3E,CAAC;AAEF,eAAe,qBAAqB,CAAC"}
@@ -23,7 +23,7 @@ const ConversationInboxItem = ({ item, onClick }) => {
23
23
  const displayName = resolveConversationDisplayName(item, t);
24
24
  const avatarUrl = useConversationAvatarUrl(item);
25
25
  const badgeLabel = resolvePeerBadgeLabel(item.peerType, t);
26
- const latestMessagePreview = parseLatestMessage(item.latestMsg, currentUserId, tCommon);
26
+ const latestMessagePreview = parseLatestMessage(item.latestMsg, currentUserId, tCommon, { peerType: item.peerType, showName: item.showName });
27
27
  const latestMessageTime = formatLatestMessageTime(item.latestMsgSendTime || null);
28
28
  const unreadCount = (_a = item.unreadCount) !== null && _a !== void 0 ? _a : 0;
29
29
  return (_jsx(ThreadCard, { testId: "conversation-inbox-thread-card", onClick: () => onClick(item), unreadCount: unreadCount, time: latestMessageTime, preview: latestMessagePreview, avatar: _jsx(ConversationPeerAvatar, { peerType: item.peerType, displayName: displayName, avatarUrl: avatarUrl, badgeLabel: badgeLabel }), title: _jsx(ConversationInboxTitle, { peerType: item.peerType, displayName: displayName, hasUnread: unreadCount > 0 }) }));
@@ -0,0 +1,7 @@
1
+ import { MessageItem } from "@openim/wasm-client-sdk";
2
+ interface CustomMessageItemProps {
3
+ message: MessageItem;
4
+ }
5
+ declare const CustomMessageItem: ({ message }: CustomMessageItemProps) => import("react/jsx-runtime").JSX.Element | null;
6
+ export default CustomMessageItem;
7
+ //# sourceMappingURL=CustomMessage.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CustomMessage.d.ts","sourceRoot":"","sources":["../../../../src/components/message/item/CustomMessage.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAMtD,UAAU,sBAAsB;IAC9B,OAAO,EAAE,WAAW,CAAC;CACtB;AAED,QAAA,MAAM,iBAAiB,GAAI,aAAa,sBAAsB,mDAwC7D,CAAC;AAEF,eAAe,iBAAiB,CAAC"}
@@ -0,0 +1,26 @@
1
+ "use client";
2
+ import { Fragment as _Fragment, jsx as _jsx } from "react/jsx-runtime";
3
+ import clsx from "clsx";
4
+ import { useTranslation } from "react-i18next";
5
+ import { useChatContext } from "../../../context/ChatContext";
6
+ import { parseCustomMessagePayload } from "../../../utils/customMessage";
7
+ import { MESSAGE_TEXT_CLASS } from "./textStyle";
8
+ const CustomMessageItem = ({ message }) => {
9
+ var _a, _b;
10
+ const { t } = useTranslation();
11
+ const { renderCustomMessage } = useChatContext();
12
+ const payload = parseCustomMessagePayload(message);
13
+ const renderedContent = renderCustomMessage === null || renderCustomMessage === void 0 ? void 0 : renderCustomMessage({ message, payload });
14
+ if (renderedContent) {
15
+ return _jsx(_Fragment, { children: renderedContent });
16
+ }
17
+ const fallbackText = ((_a = message === null || message === void 0 ? void 0 : message.textElem) === null || _a === void 0 ? void 0 : _a.content) || ((_b = message === null || message === void 0 ? void 0 : message.quoteElem) === null || _b === void 0 ? void 0 : _b.text);
18
+ if (fallbackText) {
19
+ return (_jsx("p", { className: clsx("min-w-0 whitespace-pre-wrap [overflow-wrap:anywhere]", MESSAGE_TEXT_CLASS), children: fallbackText }));
20
+ }
21
+ if (!payload) {
22
+ return null;
23
+ }
24
+ return (_jsx("p", { className: clsx("min-w-0 whitespace-pre-wrap [overflow-wrap:anywhere]", MESSAGE_TEXT_CLASS), children: t("invalid_message") }));
25
+ };
26
+ export default CustomMessageItem;
@@ -0,0 +1,7 @@
1
+ import { type UseSendMessageOptions } from "../../hooks/message/useSendMessage";
2
+ export declare const useSendCustomMessage: (options?: UseSendMessageOptions) => {
3
+ sendCustomMessage: (payload: import("../..").CustomMessagePayload, sendOptions?: {
4
+ currentSession?: import("../../types/dto").ISessionResponse;
5
+ }) => Promise<boolean>;
6
+ };
7
+ //# sourceMappingURL=useSendCustomMessage.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useSendCustomMessage.d.ts","sourceRoot":"","sources":["../../../src/hooks/message/useSendCustomMessage.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,qBAAqB,EAC3B,MAAM,gCAAgC,CAAC;AAExC,eAAO,MAAM,oBAAoB,GAAI,UAAU,qBAAqB;;sBAK84a,CAAC;;CADl9a,CAAC"}
@@ -0,0 +1,5 @@
1
+ import { useSendMessage, } from "../../hooks/message/useSendMessage";
2
+ export const useSendCustomMessage = (options) => {
3
+ const { sendCustomMessage } = useSendMessage(options);
4
+ return { sendCustomMessage };
5
+ };