@droppii-org/chat-sdk 0.0.50 → 0.0.52
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":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/message/item/index.tsx"],"names":[],"mappings":"AAIA,OAAO,EACL,WAAW,IAAI,eAAe,EAE/B,MAAM,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/message/item/index.tsx"],"names":[],"mappings":"AAIA,OAAO,EACL,WAAW,IAAI,eAAe,EAE/B,MAAM,yBAAyB,CAAC;AAejC,UAAU,gBAAgB;IACxB,OAAO,EAAE,eAAe,CAAC;IACzB,WAAW,EAAE,eAAe,EAAE,CAAC;CAChC;AAED,QAAA,MAAM,WAAW,GAAI,0BAA0B,gBAAgB,mDA4H9D,CAAC;AAEF,eAAe,WAAW,CAAC"}
|
|
@@ -11,10 +11,23 @@ import { getVisibleNeighbor, visibleTypeMessage, } from "../../../hooks/message/
|
|
|
11
11
|
import { MSG_ITEM_CONTENT_PREFIX, MSG_ITEM_PREFIX } from "../../../constants";
|
|
12
12
|
import { formatTimestamp } from "../../../utils/common";
|
|
13
13
|
import useAuthStore from "../../../store/auth";
|
|
14
|
+
import useConversationStore from "../../../store/conversation";
|
|
15
|
+
import { useMemo } from "react";
|
|
14
16
|
const MessageItem = ({ message, allMessages }) => {
|
|
15
17
|
var _a, _b, _c, _d;
|
|
16
|
-
const isCx = useAuthStore((state) => state.isCx);
|
|
17
18
|
const userID = useAuthStore((state) => state.userID);
|
|
19
|
+
const isCrm = useAuthStore((state) => state.isCrm);
|
|
20
|
+
const conversationData = useConversationStore((state) => state.conversationData);
|
|
21
|
+
const showSenderInfo = useMemo(() => {
|
|
22
|
+
var _a, _b, _c;
|
|
23
|
+
try {
|
|
24
|
+
const isChatSupport = (_c = (_b = (_a = JSON.parse((conversationData === null || conversationData === void 0 ? void 0 : conversationData.ex) || "{}")) === null || _a === void 0 ? void 0 : _a.sessionInfo) === null || _b === void 0 ? void 0 : _b.data) === null || _c === void 0 ? void 0 : _c.botId;
|
|
25
|
+
return isChatSupport && isCrm;
|
|
26
|
+
}
|
|
27
|
+
catch (_d) {
|
|
28
|
+
console.log("Failed to parse conversationData.ex");
|
|
29
|
+
}
|
|
30
|
+
}, [conversationData === null || conversationData === void 0 ? void 0 : conversationData.ex, isCrm]);
|
|
18
31
|
const isVisibleGroup = visibleTypeMessage.includes(message === null || message === void 0 ? void 0 : message.contentType);
|
|
19
32
|
const renderMessageByType = (message) => {
|
|
20
33
|
switch (message === null || message === void 0 ? void 0 : message.contentType) {
|
|
@@ -46,7 +59,7 @@ const MessageItem = ({ message, allMessages }) => {
|
|
|
46
59
|
const showSenderName = !prevSameUser && !isMine;
|
|
47
60
|
return (_jsxs("div", { className: "flex flex-col gap-2 py-1 px-3 sm:p x-4", id: `${MSG_ITEM_PREFIX}${message === null || message === void 0 ? void 0 : message.clientMsgID}`, children: [showTimeBreak && (_jsx("div", { className: "flex justify-center", children: _jsx("span", { className: "text-xs text-gray-600 text-center bg-neutral-100 px-2 py-1 rounded-full", children: formatTimestamp(message.sendTime, {
|
|
48
61
|
dateMonthFormat: "DD MMMM",
|
|
49
|
-
}) }) })), _jsx("div", { className: clsx("flex", isMine ? "justify-end" : "justify-start"), children: _jsxs("div", { className: clsx("flex flex-1 items-end gap-2", isMine ? "justify-end" : "justify-start"), children: [!isMine && (_jsx("div", { className: "flex items-center justify-center w-[32px] h-[32px]", children: showSenderAvatar && (_jsx(Avatar, { src: message === null || message === void 0 ? void 0 : message.senderFaceUrl, children: ((_b = (_a = message === null || message === void 0 ? void 0 : message.senderNickname) === null || _a === void 0 ? void 0 : _a.charAt) === null || _b === void 0 ? void 0 : _b.call(_a, 0)) || "A" })) })), _jsxs("div", { className: clsx("flex flex-col flex-[0.8]", isMine ? "items-end" : "items-start"), children: [showSenderName && (_jsx("span", { className: "text-xs text-gray-500 mb-1 px-3", children: message === null || message === void 0 ? void 0 : message.senderNickname })), _jsxs("div", { className: clsx("px-3 py-2 rounded-2xl max-w-full break-words flex flex-col flex-1 text-gray-900 gap-1", isMine ? "bg-blue-100" : "bg-white"), id: `${MSG_ITEM_CONTENT_PREFIX}${message === null || message === void 0 ? void 0 : message.clientMsgID}`, children: [(message === null || message === void 0 ? void 0 : message.contentType) === MessageType.MergeMessage ? (_jsxs("div", { children: [(_d = (_c = message === null || message === void 0 ? void 0 : message.mergeElem) === null || _c === void 0 ? void 0 : _c.multiMessage) === null || _d === void 0 ? void 0 : _d.map((item) => {
|
|
62
|
+
}) }) })), _jsx("div", { className: clsx("flex", isMine ? "justify-end" : "justify-start"), children: _jsxs("div", { className: clsx("flex flex-1 items-end gap-2", isMine ? "justify-end" : "justify-start"), children: [!isMine && showSenderInfo && (_jsx("div", { className: "flex items-center justify-center w-[32px] h-[32px]", children: showSenderAvatar && (_jsx(Avatar, { src: message === null || message === void 0 ? void 0 : message.senderFaceUrl, children: ((_b = (_a = message === null || message === void 0 ? void 0 : message.senderNickname) === null || _a === void 0 ? void 0 : _a.charAt) === null || _b === void 0 ? void 0 : _b.call(_a, 0)) || "A" })) })), _jsxs("div", { className: clsx("flex flex-col flex-[0.8]", isMine ? "items-end" : "items-start"), children: [showSenderName && showSenderInfo && (_jsx("span", { className: "text-xs text-gray-500 mb-1 px-3", children: message === null || message === void 0 ? void 0 : message.senderNickname })), _jsxs("div", { className: clsx("px-3 py-2 rounded-2xl max-w-full break-words flex flex-col flex-1 text-gray-900 gap-1", isMine ? "bg-blue-100" : "bg-white"), id: `${MSG_ITEM_CONTENT_PREFIX}${message === null || message === void 0 ? void 0 : message.clientMsgID}`, children: [(message === null || message === void 0 ? void 0 : message.contentType) === MessageType.MergeMessage ? (_jsxs("div", { children: [(_d = (_c = message === null || message === void 0 ? void 0 : message.mergeElem) === null || _c === void 0 ? void 0 : _c.multiMessage) === null || _d === void 0 ? void 0 : _d.map((item) => {
|
|
50
63
|
return renderMessageByType(item);
|
|
51
64
|
}), (message === null || message === void 0 ? void 0 : message.textElem) && _jsx(TextMessageItem, { message: message })] })) : (renderMessageByType(message)), _jsx("span", { className: clsx("text-xs text-gray-500 text-right"), children: dayjs(message === null || message === void 0 ? void 0 : message.sendTime).format("HH:mm") })] })] })] }) }, message === null || message === void 0 ? void 0 : message.clientMsgID)] }, message === null || message === void 0 ? void 0 : message.clientMsgID));
|
|
52
65
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export declare const coreWasmPath = "https://
|
|
1
|
+
export declare const coreWasmPath = "https://droppii.blob.core.windows.net/droppii-production-public/openIM.wasm";
|
|
2
2
|
export declare const PAGE_SIZE = 50;
|
|
3
3
|
export declare const MSG_ITEM_PREFIX = "msg-item-";
|
|
4
4
|
export declare const MSG_ITEM_CONTENT_PREFIX = "msg-item-content-";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/constants/index.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,YAAY,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/constants/index.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,YAAY,gFACsD,CAAC;AAEhF,eAAO,MAAM,SAAS,KAAK,CAAC;AAE5B,eAAO,MAAM,eAAe,cAAc,CAAC;AAC3C,eAAO,MAAM,uBAAuB,sBAAsB,CAAC"}
|
package/dist/constants/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export const coreWasmPath = "https://
|
|
1
|
+
export const coreWasmPath = "https://droppii.blob.core.windows.net/droppii-production-public/openIM.wasm";
|
|
2
2
|
export const PAGE_SIZE = 50;
|
|
3
3
|
export const MSG_ITEM_PREFIX = "msg-item-";
|
|
4
4
|
export const MSG_ITEM_CONTENT_PREFIX = "msg-item-content-";
|