easemob-chat-uikit 1.2.0 → 1.2.1-beta.1
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/ChatUI.esm.js +172 -59
- package/ChatUI.js +172 -59
- package/ChatUI.umd.js +172 -59
- package/package.json +1 -1
- package/style/repliedMessage/style/msg.scss +1 -1
- package/style/textMessage/style/style.scss +1 -1
- package/style.css +2 -1
- package/types/eventHandler/index.d.ts +16 -60
- package/types/module/chat/Chat.d.ts +3 -0
- package/types/module/conversation/ConversationList.d.ts +1 -0
- package/types/module/messageInput/emoji/emojiConfig.d.ts +1 -1
- package/types/module/messageInput/textarea/util.d.ts +1 -1
- package/types/module/reaction/emojiConfig.d.ts +2 -2
- package/types/module/store/Provider.d.ts +4 -0
- package/types/module/store/rootContext.d.ts +4 -0
- package/types/module/userSelect/UserSelect.d.ts +2 -0
package/ChatUI.esm.js
CHANGED
|
@@ -21306,11 +21306,15 @@ class MessageStore {
|
|
|
21306
21306
|
});
|
|
21307
21307
|
}
|
|
21308
21308
|
receiveMessage(message2) {
|
|
21309
|
-
var _a3;
|
|
21309
|
+
var _a3, _b, _c;
|
|
21310
21310
|
const curCvs = this.rootStore.conversationStore.currentCvs;
|
|
21311
21311
|
if (curCvs && curCvs.chatType === message2.chatType && curCvs.conversationId === message2.from && message2.chatType != "chatRoom") {
|
|
21312
21312
|
this.sendChannelAck(curCvs);
|
|
21313
21313
|
}
|
|
21314
|
+
const isChatbot = (_b = (_a3 = message2.from) == null ? void 0 : _a3.includes) == null ? void 0 : _b.call(_a3, "chatbot_");
|
|
21315
|
+
if (isChatbot) {
|
|
21316
|
+
message2.printed = false;
|
|
21317
|
+
}
|
|
21314
21318
|
this.message.byId[message2.id] = message2;
|
|
21315
21319
|
if (message2.from !== this.rootStore.client.user) {
|
|
21316
21320
|
message2.bySelf = false;
|
|
@@ -21389,7 +21393,7 @@ class MessageStore {
|
|
|
21389
21393
|
cvs.lastMessage = message2;
|
|
21390
21394
|
this.rootStore.conversationStore.topConversation({ ...cvs });
|
|
21391
21395
|
if (!isCurrentCvs && message2.type === "txt") {
|
|
21392
|
-
let mentionList = (
|
|
21396
|
+
let mentionList = (_c = message2 == null ? void 0 : message2.ext) == null ? void 0 : _c.em_at_list;
|
|
21393
21397
|
if (mentionList && message2.from !== this.rootStore.client.user) {
|
|
21394
21398
|
if (mentionList === AT_ALL || mentionList.includes(this.rootStore.client.user)) {
|
|
21395
21399
|
this.rootStore.conversationStore.setAtType(
|
|
@@ -21573,25 +21577,27 @@ class MessageStore {
|
|
|
21573
21577
|
const messages2 = getMessages(cvs);
|
|
21574
21578
|
const messageIndex = getMessageIndex(messages2, messageId);
|
|
21575
21579
|
if (messageIndex > -1) {
|
|
21576
|
-
|
|
21577
|
-
|
|
21578
|
-
|
|
21579
|
-
reaction2
|
|
21580
|
-
|
|
21581
|
-
|
|
21582
|
-
|
|
21583
|
-
const newAction = {
|
|
21584
|
-
count: 1,
|
|
21585
|
-
isAddedBySelf: true,
|
|
21586
|
-
reaction: emoji2,
|
|
21587
|
-
userList: [this.rootStore.client.user]
|
|
21588
|
-
};
|
|
21589
|
-
if (Array.isArray(message2.reactions)) {
|
|
21590
|
-
messages2[messageIndex].reactions.push(newAction);
|
|
21580
|
+
runInAction(() => {
|
|
21581
|
+
const message2 = messages2[messageIndex];
|
|
21582
|
+
const reaction2 = getReactionByEmoji(message2, emoji2);
|
|
21583
|
+
if (reaction2) {
|
|
21584
|
+
reaction2.count += 1;
|
|
21585
|
+
reaction2.isAddedBySelf = true;
|
|
21586
|
+
reaction2.userList.unshift(this.rootStore.client.user);
|
|
21591
21587
|
} else {
|
|
21592
|
-
|
|
21588
|
+
const newAction = {
|
|
21589
|
+
count: 1,
|
|
21590
|
+
isAddedBySelf: true,
|
|
21591
|
+
reaction: emoji2,
|
|
21592
|
+
userList: [this.rootStore.client.user]
|
|
21593
|
+
};
|
|
21594
|
+
if (Array.isArray(message2.reactions)) {
|
|
21595
|
+
messages2[messageIndex].reactions.push(newAction);
|
|
21596
|
+
} else {
|
|
21597
|
+
messages2[messageIndex].reactions = [newAction];
|
|
21598
|
+
}
|
|
21593
21599
|
}
|
|
21594
|
-
}
|
|
21600
|
+
});
|
|
21595
21601
|
}
|
|
21596
21602
|
eventHandler.dispatchSuccess("addReaction");
|
|
21597
21603
|
}).catch((err) => {
|
|
@@ -47668,6 +47674,10 @@ class AddressStore {
|
|
|
47668
47674
|
initial = "#";
|
|
47669
47675
|
}
|
|
47670
47676
|
runInAction(() => {
|
|
47677
|
+
let found2 = this.contacts.find((item) => item.userId === userId);
|
|
47678
|
+
if (found2) {
|
|
47679
|
+
return;
|
|
47680
|
+
}
|
|
47671
47681
|
this.contacts.push({
|
|
47672
47682
|
userId,
|
|
47673
47683
|
nickname: userInfo.nickname,
|
|
@@ -48486,7 +48496,7 @@ const emoji$3 = {
|
|
|
48486
48496
|
"\u{1F60E}": "U+1F60E.png",
|
|
48487
48497
|
"\u{1F971}": "U+1F971.png",
|
|
48488
48498
|
"\u{1F974}": "U+1F974.png",
|
|
48489
|
-
"\u263A": "U+263A.png",
|
|
48499
|
+
"\u263A\uFE0F": "U+263A.png",
|
|
48490
48500
|
"\u{1F641}": "U+1F641.png",
|
|
48491
48501
|
"\u{1F62D}": "U+1F62D.png",
|
|
48492
48502
|
"\u{1F610}": "U+1F610.png",
|
|
@@ -80094,7 +80104,7 @@ const Modal = (props) => {
|
|
|
80094
80104
|
maskTransitionName: getTransitionName(rootPrefixCls, "fade", props.maskTransitionName)
|
|
80095
80105
|
});
|
|
80096
80106
|
};
|
|
80097
|
-
const convertToMessage = (e) => {
|
|
80107
|
+
const convertToMessage = (e, plainText = true) => {
|
|
80098
80108
|
var t2 = function() {
|
|
80099
80109
|
var t22 = [], r2 = document.createElement("div");
|
|
80100
80110
|
r2.innerHTML = e.replace(/\\/g, "###h###");
|
|
@@ -80103,10 +80113,18 @@ const convertToMessage = (e) => {
|
|
|
80103
80113
|
n2[i2].parentNode.insertBefore(s2, n2[i2]);
|
|
80104
80114
|
n2[i2].parentNode.removeChild(n2[i2]);
|
|
80105
80115
|
}
|
|
80106
|
-
for (; o2--; )
|
|
80116
|
+
for (; o2--; ) {
|
|
80107
80117
|
t22.push(a2[o2].innerHTML), a2[o2].parentNode.removeChild(a2[o2]);
|
|
80118
|
+
}
|
|
80108
80119
|
var c2 = (t22 = t22.reverse()).length ? "\n" + t22.join("\n") : t22.join("\n");
|
|
80109
|
-
|
|
80120
|
+
if (plainText) {
|
|
80121
|
+
return (r2.innerText + c2).replace(/###h###/g, "\").replace(/<br>/g, "\n").replace(/&/g, "&");
|
|
80122
|
+
}
|
|
80123
|
+
if (r2.innerHTML.indexOf("</span>")) {
|
|
80124
|
+
r2.innerHTML = r2.innerHTML.replace(/<span.*?>/g, "");
|
|
80125
|
+
r2.innerHTML = r2.innerHTML.replace(/<\/span>/g, "");
|
|
80126
|
+
}
|
|
80127
|
+
return (r2.innerHTML + c2).replace(/###h###/g, "\\").replace(/<br>/g, "\n").replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">");
|
|
80110
80128
|
}();
|
|
80111
80129
|
return t2.replace(/ /g, " ").trim();
|
|
80112
80130
|
};
|
|
@@ -80294,7 +80312,7 @@ let Textarea = forwardRef((props, ref) => {
|
|
|
80294
80312
|
const [isTyping, setIsTyping] = useState$1(false);
|
|
80295
80313
|
const handleInputChange = (e) => {
|
|
80296
80314
|
const value = e.target.innerHTML;
|
|
80297
|
-
const str = convertToMessage(value).trim();
|
|
80315
|
+
const str = convertToMessage(value, false).trim();
|
|
80298
80316
|
setTextValue(str);
|
|
80299
80317
|
onChange == null ? void 0 : onChange(str);
|
|
80300
80318
|
if (usedCvs.chatType == "singleChat" && !isTyping && enabledTyping) {
|
|
@@ -80302,7 +80320,7 @@ let Textarea = forwardRef((props, ref) => {
|
|
|
80302
80320
|
messageStore.sendTypingCmd(usedCvs);
|
|
80303
80321
|
setTimeout(() => {
|
|
80304
80322
|
setIsTyping(false);
|
|
80305
|
-
},
|
|
80323
|
+
}, 5e3);
|
|
80306
80324
|
}
|
|
80307
80325
|
};
|
|
80308
80326
|
const _sendMessage = (message2) => {
|
|
@@ -80312,6 +80330,17 @@ let Textarea = forwardRef((props, ref) => {
|
|
|
80312
80330
|
divRef.current.innerHTML = "";
|
|
80313
80331
|
setTextValue("");
|
|
80314
80332
|
onChange == null ? void 0 : onChange("");
|
|
80333
|
+
if (usedCvs.chatType == "singleChat" && usedCvs.conversationId.includes("chatbot_")) {
|
|
80334
|
+
const visibleOut = rootStore2.messageStore.typing[usedCvs.conversationId];
|
|
80335
|
+
if (visibleOut) {
|
|
80336
|
+
messageStore.setTyping(usedCvs, false);
|
|
80337
|
+
setTimeout(() => {
|
|
80338
|
+
messageStore.setTyping(usedCvs, true);
|
|
80339
|
+
}, 200);
|
|
80340
|
+
} else {
|
|
80341
|
+
messageStore.setTyping(usedCvs, true);
|
|
80342
|
+
}
|
|
80343
|
+
}
|
|
80315
80344
|
};
|
|
80316
80345
|
const sendMessage = () => {
|
|
80317
80346
|
var _a3;
|
|
@@ -80516,6 +80545,7 @@ const TextMessage = (props) => {
|
|
|
80516
80545
|
const { translationTargetLanguage } = initConfig;
|
|
80517
80546
|
const targetLng = targetLanguage || translationTargetLanguage || "en";
|
|
80518
80547
|
const [modifyMessageVisible, setModifyMessageVisible] = useState$1(false);
|
|
80548
|
+
const [text2, setText] = useState$1("");
|
|
80519
80549
|
let urlTxtClass = "";
|
|
80520
80550
|
if (((_a3 = urlData == null ? void 0 : urlData.images) == null ? void 0 : _a3.length) > 0) {
|
|
80521
80551
|
urlTxtClass = "message-text-hasImage";
|
|
@@ -80760,6 +80790,25 @@ const TextMessage = (props) => {
|
|
|
80760
80790
|
rootStore.threadStore.getChatThreadDetail(((_b2 = textMessage2 == null ? void 0 : textMessage2.chatThreadOverview) == null ? void 0 : _b2.id) || "");
|
|
80761
80791
|
onOpenThreadPanel == null ? void 0 : onOpenThreadPanel(((_c2 = textMessage2.chatThreadOverview) == null ? void 0 : _c2.id) || "");
|
|
80762
80792
|
};
|
|
80793
|
+
useEffect(() => {
|
|
80794
|
+
if (textMessage2.printed != false) {
|
|
80795
|
+
return;
|
|
80796
|
+
}
|
|
80797
|
+
const msgArr = renderTxt(msg, true);
|
|
80798
|
+
const message2 = msgArr.length > 1 ? msgArr : msgArr[0] || "";
|
|
80799
|
+
let currentIndex = 0;
|
|
80800
|
+
const typingInterval = setInterval(() => {
|
|
80801
|
+
setText((prevMessage) => prevMessage + (message2 == null ? void 0 : message2[currentIndex]));
|
|
80802
|
+
currentIndex++;
|
|
80803
|
+
if (currentIndex >= message2.length - 1) {
|
|
80804
|
+
clearInterval(typingInterval);
|
|
80805
|
+
textMessage2.printed = true;
|
|
80806
|
+
}
|
|
80807
|
+
}, 50);
|
|
80808
|
+
return () => {
|
|
80809
|
+
clearInterval(typingInterval);
|
|
80810
|
+
};
|
|
80811
|
+
}, [msg]);
|
|
80763
80812
|
return /* @__PURE__ */ React__default$1.createElement(React__default$1.Fragment, null, onlyContent ? /* @__PURE__ */ React__default$1.createElement("div", null, /* @__PURE__ */ React__default$1.createElement("span", {
|
|
80764
80813
|
className: classString
|
|
80765
80814
|
}, renderTxt(msg, true)), !!((urlData == null ? void 0 : urlData.title) || (urlData == null ? void 0 : urlData.description)) && /* @__PURE__ */ React__default$1.createElement(UrlMessage, {
|
|
@@ -80812,7 +80861,7 @@ const TextMessage = (props) => {
|
|
|
80812
80861
|
}, /* @__PURE__ */ React__default$1.createElement("div", null, /* @__PURE__ */ React__default$1.createElement("span", {
|
|
80813
80862
|
className: classString,
|
|
80814
80863
|
style: { ...style2 }
|
|
80815
|
-
}, renderTxt(msg, true)), !!((urlData == null ? void 0 : urlData.title) || (urlData == null ? void 0 : urlData.description)) && /* @__PURE__ */ React__default$1.createElement(UrlMessage, {
|
|
80864
|
+
}, textMessage2.printed == false ? text2 : renderTxt(msg, true)), !!((urlData == null ? void 0 : urlData.title) || (urlData == null ? void 0 : urlData.description)) && /* @__PURE__ */ React__default$1.createElement(UrlMessage, {
|
|
80816
80865
|
...urlData,
|
|
80817
80866
|
isLoading: isFetching
|
|
80818
80867
|
}), (textMessage2 == null ? void 0 : textMessage2.modifiedInfo) ? /* @__PURE__ */ React__default$1.createElement("div", {
|
|
@@ -82868,7 +82917,7 @@ const emoji$2 = {
|
|
|
82868
82917
|
"\u{1F60E}": "U+1F60E.png",
|
|
82869
82918
|
"\u{1F971}": "U+1F971.png",
|
|
82870
82919
|
"\u{1F974}": "U+1F974.png",
|
|
82871
|
-
"\u263A": "U+263A.png",
|
|
82920
|
+
"\u263A\uFE0F": "U+263A.png",
|
|
82872
82921
|
"\u{1F641}": "U+1F641.png",
|
|
82873
82922
|
"\u{1F62D}": "U+1F62D.png",
|
|
82874
82923
|
"\u{1F610}": "U+1F610.png",
|
|
@@ -82974,7 +83023,7 @@ const emoji$2 = {
|
|
|
82974
83023
|
"\u{1F60E}": "U+1F60E.png",
|
|
82975
83024
|
"\u{1F971}": "U+1F971.png",
|
|
82976
83025
|
"\u{1F974}": "U+1F974.png",
|
|
82977
|
-
"\u263A": "U+263A.png",
|
|
83026
|
+
"\u263A\uFE0F": "U+263A.png",
|
|
82978
83027
|
"\u{1F641}": "U+1F641.png",
|
|
82979
83028
|
"\u{1F62D}": "U+1F62D.png",
|
|
82980
83029
|
"\u{1F610}": "U+1F610.png",
|
|
@@ -84986,6 +85035,8 @@ const useContacts = () => {
|
|
|
84986
85035
|
const useUserInfo = (userList, withPresence) => {
|
|
84987
85036
|
const rootStore2 = useContext(RootContext).rootStore;
|
|
84988
85037
|
useEffect(() => {
|
|
85038
|
+
if (!rootStore2.loginState)
|
|
85039
|
+
return;
|
|
84989
85040
|
let keys = Object.keys(rootStore2.addressStore.appUsersInfo);
|
|
84990
85041
|
let cvsUserIds = rootStore2.conversationStore.conversationList.filter((item) => item.chatType === "singleChat" && !keys.includes(item.conversationId)).map((cvs) => cvs.conversationId);
|
|
84991
85042
|
let contactsUserIds = rootStore2.addressStore.contacts.filter((item) => {
|
|
@@ -84995,7 +85046,11 @@ const useUserInfo = (userList, withPresence) => {
|
|
|
84995
85046
|
userIdList: userList == "conversation" ? cvsUserIds : contactsUserIds,
|
|
84996
85047
|
withPresence
|
|
84997
85048
|
});
|
|
84998
|
-
}, [
|
|
85049
|
+
}, [
|
|
85050
|
+
rootStore2.conversationStore.conversationList.length,
|
|
85051
|
+
rootStore2.addressStore.contacts.length,
|
|
85052
|
+
rootStore2.loginState
|
|
85053
|
+
]);
|
|
84999
85054
|
};
|
|
85000
85055
|
const useGroups = () => {
|
|
85001
85056
|
const pageSize2 = 200;
|
|
@@ -85215,7 +85270,11 @@ let ContactList = (props) => {
|
|
|
85215
85270
|
useUserInfo("contacts");
|
|
85216
85271
|
}
|
|
85217
85272
|
const { getJoinedGroupList } = useGroups();
|
|
85218
|
-
|
|
85273
|
+
useEffect(() => {
|
|
85274
|
+
if (!rootStore2.loginState)
|
|
85275
|
+
return;
|
|
85276
|
+
getJoinedGroupList();
|
|
85277
|
+
}, [rootStore2.loginState]);
|
|
85219
85278
|
const [itemActiveKey, setItemActiveKey] = useState$1("");
|
|
85220
85279
|
const [isSearch, setIsSearch] = useState$1(false);
|
|
85221
85280
|
const handleCheckboxChange = (checked, data2) => {
|
|
@@ -85549,7 +85608,7 @@ const ContactDetail = (props) => {
|
|
|
85549
85608
|
type: "BUBBLE_FILL",
|
|
85550
85609
|
width: 24,
|
|
85551
85610
|
height: 24
|
|
85552
|
-
}), t2("message")), "|", /* @__PURE__ */ React__default$1.createElement(Button$1, {
|
|
85611
|
+
}), t2("message")), data2.id.includes("chatbot_") ? null : /* @__PURE__ */ React__default$1.createElement(React__default$1.Fragment, null, "|", /* @__PURE__ */ React__default$1.createElement(Button$1, {
|
|
85553
85612
|
type: "text",
|
|
85554
85613
|
className: `${prefixCls}-content-btn`,
|
|
85555
85614
|
onClick: handleClickBtn("audio")
|
|
@@ -85565,7 +85624,7 @@ const ContactDetail = (props) => {
|
|
|
85565
85624
|
type: "VIDEO_CAMERA",
|
|
85566
85625
|
width: 24,
|
|
85567
85626
|
height: 24
|
|
85568
|
-
}), t2("videoCall")))))) : /* @__PURE__ */ React__default$1.createElement(Empty, {
|
|
85627
|
+
}), t2("videoCall"))))))) : /* @__PURE__ */ React__default$1.createElement(Empty, {
|
|
85569
85628
|
text: t2("no contact"),
|
|
85570
85629
|
icon: /* @__PURE__ */ React__default$1.createElement(Icon$1, {
|
|
85571
85630
|
type: "EMPTY",
|
|
@@ -85613,9 +85672,26 @@ const UserSelect = (props) => {
|
|
|
85613
85672
|
);
|
|
85614
85673
|
useState$1(open);
|
|
85615
85674
|
const [selectedUsers, setSelectedUsers] = useState$1([]);
|
|
85675
|
+
const chatbotIds = rootStore2.addressStore.contacts.filter((item) => {
|
|
85676
|
+
if (item.userId.indexOf("chatbot_") > -1)
|
|
85677
|
+
return true;
|
|
85678
|
+
});
|
|
85616
85679
|
useEffect(() => {
|
|
85617
85680
|
if (!open) {
|
|
85618
85681
|
setSelectedUsers([]);
|
|
85682
|
+
} else {
|
|
85683
|
+
if (!users) {
|
|
85684
|
+
setSelectedUsers(chatbotIds);
|
|
85685
|
+
if (chatbotIds.length > 0) {
|
|
85686
|
+
onUserSelect == null ? void 0 : onUserSelect(
|
|
85687
|
+
{
|
|
85688
|
+
...chatbotIds[0],
|
|
85689
|
+
type: "add"
|
|
85690
|
+
},
|
|
85691
|
+
chatbotIds
|
|
85692
|
+
);
|
|
85693
|
+
}
|
|
85694
|
+
}
|
|
85619
85695
|
}
|
|
85620
85696
|
}, [open]);
|
|
85621
85697
|
const handleSelect = (checked, userInfo) => {
|
|
@@ -85669,6 +85745,8 @@ const UserSelect = (props) => {
|
|
|
85669
85745
|
}
|
|
85670
85746
|
};
|
|
85671
85747
|
const handleItemClose = (userInfo) => {
|
|
85748
|
+
if (userInfo.userId.indexOf("chatbot_") > -1)
|
|
85749
|
+
return;
|
|
85672
85750
|
setSelectedUsers((value) => {
|
|
85673
85751
|
const userArr = value.filter((user2) => {
|
|
85674
85752
|
return user2.userId !== userInfo.userId;
|
|
@@ -85731,6 +85809,8 @@ const UserSelect = (props) => {
|
|
|
85731
85809
|
onCheckboxChange: handleSelect,
|
|
85732
85810
|
onItemClick: (data2) => {
|
|
85733
85811
|
var _a3, _b;
|
|
85812
|
+
if (data2.id.indexOf("chatbot_") > -1)
|
|
85813
|
+
return;
|
|
85734
85814
|
const disabled2 = defaultCheckedUsers == null ? void 0 : defaultCheckedUsers.find((item) => item.id === data2.id);
|
|
85735
85815
|
if (disabled2)
|
|
85736
85816
|
return;
|
|
@@ -85768,7 +85848,7 @@ const UserSelect = (props) => {
|
|
|
85768
85848
|
key: user2.userId,
|
|
85769
85849
|
data: user2,
|
|
85770
85850
|
checked: true,
|
|
85771
|
-
closeable:
|
|
85851
|
+
closeable: user2.userId.indexOf("chatbot_") === -1,
|
|
85772
85852
|
onClose: handleItemClose,
|
|
85773
85853
|
onClick: (data2) => {
|
|
85774
85854
|
handleItemClose(user2);
|
|
@@ -85782,7 +85862,7 @@ const UserSelect = (props) => {
|
|
|
85782
85862
|
style: { marginRight: "24px", width: "68px" },
|
|
85783
85863
|
type: "primary",
|
|
85784
85864
|
onClick: (e) => {
|
|
85785
|
-
onOk == null ? void 0 : onOk(
|
|
85865
|
+
onOk == null ? void 0 : onOk(selectedUsers);
|
|
85786
85866
|
},
|
|
85787
85867
|
disabled: selectedUsers.length === 0
|
|
85788
85868
|
}, (others == null ? void 0 : others.okText) || t2("confirmBtn")), /* @__PURE__ */ React__default$1.createElement(Button$1, {
|
|
@@ -87404,24 +87484,26 @@ let MessageList = (props) => {
|
|
|
87404
87484
|
MessageList = observer(MessageList);
|
|
87405
87485
|
const style$f = "";
|
|
87406
87486
|
const Typing = (props) => {
|
|
87487
|
+
var _a3, _b;
|
|
87407
87488
|
const { prefix: customizePrefixCls, className, style: style2, onHide, onShow, conversation } = props;
|
|
87408
87489
|
const { getPrefixCls } = React__default$1.useContext(ConfigContext);
|
|
87409
87490
|
const prefixCls = getPrefixCls("typing", customizePrefixCls);
|
|
87410
87491
|
const classString = classNames(prefixCls, className);
|
|
87411
87492
|
const visibleOut = rootStore.messageStore.typing[conversation.conversationId];
|
|
87412
87493
|
const [visible, setVisible] = useState$1(false);
|
|
87413
|
-
let timer2;
|
|
87494
|
+
let timer2 = useRef();
|
|
87414
87495
|
const show2 = () => {
|
|
87415
87496
|
setVisible(true);
|
|
87416
87497
|
onShow == null ? void 0 : onShow();
|
|
87417
|
-
timer2 && clearTimeout(timer2);
|
|
87418
|
-
timer2 = setTimeout(() => {
|
|
87498
|
+
timer2.current && clearTimeout(timer2.current);
|
|
87499
|
+
timer2.current = setTimeout(() => {
|
|
87419
87500
|
hide2();
|
|
87420
87501
|
}, 5e3);
|
|
87421
87502
|
};
|
|
87422
87503
|
const hide2 = () => {
|
|
87423
87504
|
setVisible(false);
|
|
87424
87505
|
onHide == null ? void 0 : onHide();
|
|
87506
|
+
timer2.current && clearTimeout(timer2.current);
|
|
87425
87507
|
};
|
|
87426
87508
|
useEffect(() => {
|
|
87427
87509
|
if (visibleOut) {
|
|
@@ -87430,13 +87512,16 @@ const Typing = (props) => {
|
|
|
87430
87512
|
hide2();
|
|
87431
87513
|
}
|
|
87432
87514
|
}, [visibleOut]);
|
|
87515
|
+
const avatarUrl = (_a3 = rootStore.addressStore.appUsersInfo[conversation.conversationId]) == null ? void 0 : _a3.avatarurl;
|
|
87516
|
+
const nickName = (_b = rootStore.addressStore.appUsersInfo[conversation.conversationId]) == null ? void 0 : _b.nickname;
|
|
87433
87517
|
return /* @__PURE__ */ React__default$1.createElement("div", {
|
|
87434
87518
|
className: classString,
|
|
87435
87519
|
style: { ...style2, display: visible ? "flex" : "none" }
|
|
87436
87520
|
}, /* @__PURE__ */ React__default$1.createElement(Avatar$1, {
|
|
87437
87521
|
size: 16,
|
|
87438
|
-
|
|
87439
|
-
|
|
87522
|
+
src: avatarUrl,
|
|
87523
|
+
style: { fontSize: "12px" }
|
|
87524
|
+
}, nickName || conversation.conversationId), /* @__PURE__ */ React__default$1.createElement("div", {
|
|
87440
87525
|
className: "loading"
|
|
87441
87526
|
}, /* @__PURE__ */ React__default$1.createElement("div", {
|
|
87442
87527
|
className: "loading-dot"
|
|
@@ -130005,7 +130090,7 @@ const getChatAvatarUrl = (cvs) => {
|
|
|
130005
130090
|
}
|
|
130006
130091
|
};
|
|
130007
130092
|
const Chat = forwardRef((props, ref) => {
|
|
130008
|
-
var _a3, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o;
|
|
130093
|
+
var _a3, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p;
|
|
130009
130094
|
const {
|
|
130010
130095
|
prefix: customizePrefixCls,
|
|
130011
130096
|
className,
|
|
@@ -130022,7 +130107,8 @@ const Chat = forwardRef((props, ref) => {
|
|
|
130022
130107
|
onOpenThread,
|
|
130023
130108
|
onOpenThreadList,
|
|
130024
130109
|
onAudioCall,
|
|
130025
|
-
onVideoCall
|
|
130110
|
+
onVideoCall,
|
|
130111
|
+
renderRepliedMessage
|
|
130026
130112
|
} = props;
|
|
130027
130113
|
const { t: t2 } = useTranslation();
|
|
130028
130114
|
const { getPrefixCls } = React__default$1.useContext(ConfigContext);
|
|
@@ -130285,7 +130371,7 @@ const Chat = forwardRef((props, ref) => {
|
|
|
130285
130371
|
};
|
|
130286
130372
|
}
|
|
130287
130373
|
messageProps.customAction.actions = messageProps.customAction.actions.filter((item) => {
|
|
130288
|
-
var _a4, _b2, _c2, _d2, _e2, _f2;
|
|
130374
|
+
var _a4, _b2, _c2, _d2, _e2, _f2, _g2, _h2;
|
|
130289
130375
|
if (((_a4 = globalConfig == null ? void 0 : globalConfig.message) == null ? void 0 : _a4.reply) == false && item.content == "REPLY") {
|
|
130290
130376
|
return false;
|
|
130291
130377
|
}
|
|
@@ -130304,6 +130390,12 @@ const Chat = forwardRef((props, ref) => {
|
|
|
130304
130390
|
if (((_f2 = globalConfig == null ? void 0 : globalConfig.message) == null ? void 0 : _f2.select) == false && item.content == "SELECT") {
|
|
130305
130391
|
return false;
|
|
130306
130392
|
}
|
|
130393
|
+
if (((_g2 = globalConfig == null ? void 0 : globalConfig.message) == null ? void 0 : _g2.forward) == false && item.content == "FORWARD") {
|
|
130394
|
+
return false;
|
|
130395
|
+
}
|
|
130396
|
+
if (((_h2 = globalConfig == null ? void 0 : globalConfig.message) == null ? void 0 : _h2.report) == false && item.content == "REPORT") {
|
|
130397
|
+
return false;
|
|
130398
|
+
}
|
|
130307
130399
|
return true;
|
|
130308
130400
|
});
|
|
130309
130401
|
}
|
|
@@ -130364,13 +130456,19 @@ const Chat = forwardRef((props, ref) => {
|
|
|
130364
130456
|
return true;
|
|
130365
130457
|
});
|
|
130366
130458
|
messageInputConfig.customActions = (_l = messageInputConfig.customActions) == null ? void 0 : _l.filter((item) => {
|
|
130367
|
-
var _a4, _b2;
|
|
130459
|
+
var _a4, _b2, _c2, _d2;
|
|
130368
130460
|
if (item.content == "IMAGE" && ((_a4 = globalConfig == null ? void 0 : globalConfig.messageInput) == null ? void 0 : _a4.picture) == false) {
|
|
130369
130461
|
return false;
|
|
130370
130462
|
}
|
|
130371
130463
|
if (item.content == "FILE" && ((_b2 = globalConfig == null ? void 0 : globalConfig.messageInput) == null ? void 0 : _b2.file) == false) {
|
|
130372
130464
|
return false;
|
|
130373
130465
|
}
|
|
130466
|
+
if (item.content == "VIDEO" && ((_c2 = globalConfig == null ? void 0 : globalConfig.messageInput) == null ? void 0 : _c2.video) == false) {
|
|
130467
|
+
return false;
|
|
130468
|
+
}
|
|
130469
|
+
if (item.content == "CARD" && ((_d2 = globalConfig == null ? void 0 : globalConfig.messageInput) == null ? void 0 : _d2.contactCard) == false) {
|
|
130470
|
+
return false;
|
|
130471
|
+
}
|
|
130374
130472
|
return true;
|
|
130375
130473
|
});
|
|
130376
130474
|
}
|
|
@@ -130582,6 +130680,10 @@ const Chat = forwardRef((props, ref) => {
|
|
|
130582
130680
|
showVideoCall = false;
|
|
130583
130681
|
showAudioCall = false;
|
|
130584
130682
|
}
|
|
130683
|
+
if (((_o = CVS.conversationId) == null ? void 0 : _o.indexOf("chatbot_")) > -1) {
|
|
130684
|
+
showVideoCall = false;
|
|
130685
|
+
showAudioCall = false;
|
|
130686
|
+
}
|
|
130585
130687
|
const [reportMessageId, setReportMessageId] = useState$1("");
|
|
130586
130688
|
const [reportOpen, setReportOpen] = useState$1(false);
|
|
130587
130689
|
const [checkedType, setCheckedType] = useState$1("");
|
|
@@ -130651,9 +130753,9 @@ const Chat = forwardRef((props, ref) => {
|
|
|
130651
130753
|
onHide: () => {
|
|
130652
130754
|
rootStore2.messageStore.setTyping(rootStore2.conversationStore.currentCvs, false);
|
|
130653
130755
|
}
|
|
130654
|
-
}), showReply && /* @__PURE__ */ React__default$1.createElement(UnsentRepliedMsg, {
|
|
130756
|
+
}), showReply && (renderRepliedMessage ? renderRepliedMessage(rootStore2.messageStore.repliedMessage) : /* @__PURE__ */ React__default$1.createElement(UnsentRepliedMsg, {
|
|
130655
130757
|
type: "summary"
|
|
130656
|
-
}), renderMessageInput ? renderMessageInput() : /* @__PURE__ */ React__default$1.createElement(MessageInput$1, {
|
|
130758
|
+
})), renderMessageInput ? renderMessageInput() : /* @__PURE__ */ React__default$1.createElement(MessageInput$1, {
|
|
130657
130759
|
...messageInputConfig,
|
|
130658
130760
|
...messageInputProps
|
|
130659
130761
|
}), modalOpen && /* @__PURE__ */ React__default$1.createElement(ThreadModal, {
|
|
@@ -130674,7 +130776,7 @@ const Chat = forwardRef((props, ref) => {
|
|
|
130674
130776
|
onAddPerson: showInvite,
|
|
130675
130777
|
onStateChange: handleCallStateChange,
|
|
130676
130778
|
onInvite: handleInvite,
|
|
130677
|
-
contactAvatar: (
|
|
130779
|
+
contactAvatar: (_p = rootStore2.addressStore.appUsersInfo[currentCall.targetId]) == null ? void 0 : _p.avatarurl,
|
|
130678
130780
|
groupAvatar: /* @__PURE__ */ React__default$1.createElement(Avatar$1, {
|
|
130679
130781
|
className: "cui-callkit-groupAvatar",
|
|
130680
130782
|
src: rtcConfig == null ? void 0 : rtcConfig.groupAvatar
|
|
@@ -130947,7 +131049,7 @@ const Badge = ({
|
|
|
130947
131049
|
}));
|
|
130948
131050
|
};
|
|
130949
131051
|
let ConversationItem = (props) => {
|
|
130950
|
-
var _a3, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
131052
|
+
var _a3, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k;
|
|
130951
131053
|
let {
|
|
130952
131054
|
prefix: customizePrefixCls,
|
|
130953
131055
|
className,
|
|
@@ -131128,16 +131230,16 @@ let ConversationItem = (props) => {
|
|
|
131128
131230
|
break;
|
|
131129
131231
|
}
|
|
131130
131232
|
if (data2.chatType == "groupChat") {
|
|
131131
|
-
let msgFrom = data2.lastMessage.from || "";
|
|
131233
|
+
let msgFrom = ((_e = data2.lastMessage) == null ? void 0 : _e.from) || "";
|
|
131132
131234
|
let from = msgFrom && msgFrom !== rootStore2.client.context.userId ? `${msgFrom}: ` : "";
|
|
131133
131235
|
const groupItem = getGroupItemFromGroupsById(data2.conversationId);
|
|
131134
131236
|
if (groupItem) {
|
|
131135
|
-
const memberIdx = (
|
|
131136
|
-
const ease_chat_uikit_user_info = (
|
|
131237
|
+
const memberIdx = (_f = getGroupMemberIndexByUserId(groupItem, msgFrom)) != null ? _f : -1;
|
|
131238
|
+
const ease_chat_uikit_user_info = (_h = (_g = data2.lastMessage) == null ? void 0 : _g.ext) == null ? void 0 : _h.ease_chat_uikit_user_info;
|
|
131137
131239
|
if (ease_chat_uikit_user_info && ease_chat_uikit_user_info.nickname) {
|
|
131138
131240
|
from = `${ease_chat_uikit_user_info.nickname}: `;
|
|
131139
131241
|
} else if (memberIdx > -1) {
|
|
131140
|
-
let memberItem = (
|
|
131242
|
+
let memberItem = (_i = groupItem == null ? void 0 : groupItem.members) == null ? void 0 : _i[memberIdx];
|
|
131141
131243
|
from = `${getGroupMemberNickName(memberItem)}: `;
|
|
131142
131244
|
}
|
|
131143
131245
|
}
|
|
@@ -131169,7 +131271,7 @@ let ConversationItem = (props) => {
|
|
|
131169
131271
|
className: `${prefixCls}-info`
|
|
131170
131272
|
}, /* @__PURE__ */ React__default$1.createElement("span", {
|
|
131171
131273
|
className: `${prefixCls}-time`
|
|
131172
|
-
}, (formatDateTime == null ? void 0 : formatDateTime((
|
|
131274
|
+
}, (formatDateTime == null ? void 0 : formatDateTime((_j = data2.lastMessage) == null ? void 0 : _j.time)) || getConversationTime((_k = data2.lastMessage) == null ? void 0 : _k.time)), showMore ? /* @__PURE__ */ React__default$1.createElement(Tooltip, {
|
|
131173
131275
|
title: menuNode,
|
|
131174
131276
|
trigger: "click",
|
|
131175
131277
|
placement: "bottomRight"
|
|
@@ -131204,7 +131306,8 @@ let Conversations = (props) => {
|
|
|
131204
131306
|
headerProps = {},
|
|
131205
131307
|
itemProps = {},
|
|
131206
131308
|
style: style2 = {},
|
|
131207
|
-
presence
|
|
131309
|
+
presence,
|
|
131310
|
+
showSearchList
|
|
131208
131311
|
} = props;
|
|
131209
131312
|
const { getPrefixCls } = React__default$1.useContext(ConfigContext);
|
|
131210
131313
|
const prefixCls = getPrefixCls("conversationList", customizePrefixCls);
|
|
@@ -131252,7 +131355,7 @@ let Conversations = (props) => {
|
|
|
131252
131355
|
}
|
|
131253
131356
|
}, [cvsStore.currentCvs]);
|
|
131254
131357
|
useEffect(() => {
|
|
131255
|
-
if (isSearch) {
|
|
131358
|
+
if (isSearch || showSearchList) {
|
|
131256
131359
|
setRenderData(cvsStore.searchList);
|
|
131257
131360
|
} else {
|
|
131258
131361
|
const renderData2 = cvsStore.conversationList.map((item) => {
|
|
@@ -131297,8 +131400,10 @@ let Conversations = (props) => {
|
|
|
131297
131400
|
const handleSearch = (e) => {
|
|
131298
131401
|
const value = e.target.value;
|
|
131299
131402
|
const returnValue = onSearch == null ? void 0 : onSearch(e);
|
|
131300
|
-
if (returnValue === false)
|
|
131403
|
+
if (returnValue === false) {
|
|
131404
|
+
setIsSearch(value.length > 0 ? true : false);
|
|
131301
131405
|
return;
|
|
131406
|
+
}
|
|
131302
131407
|
const searchList = initRenderData.filter((cvs) => {
|
|
131303
131408
|
var _a4;
|
|
131304
131409
|
if (cvs.conversationId.includes(value) || ((_a4 = cvs.name) == null ? void 0 : _a4.includes(value))) {
|
|
@@ -131438,7 +131543,7 @@ const GroupMember = (props) => {
|
|
|
131438
131543
|
prefix: prefix2,
|
|
131439
131544
|
onItemClick,
|
|
131440
131545
|
checkable,
|
|
131441
|
-
groupMembers: groupMembers2,
|
|
131546
|
+
groupMembers: groupMembers2 = [],
|
|
131442
131547
|
onPrivateChat,
|
|
131443
131548
|
onAddContact,
|
|
131444
131549
|
onClickBack,
|
|
@@ -131466,6 +131571,13 @@ const GroupMember = (props) => {
|
|
|
131466
131571
|
className
|
|
131467
131572
|
);
|
|
131468
131573
|
rootStore2.addressStore.groups.find((item) => item.groupid == groupId);
|
|
131574
|
+
const chatbotIds = groupMembers2.filter((item) => {
|
|
131575
|
+
if (item.userId.indexOf("chatbot_") > -1) {
|
|
131576
|
+
return {
|
|
131577
|
+
userId: item.userId
|
|
131578
|
+
};
|
|
131579
|
+
}
|
|
131580
|
+
});
|
|
131469
131581
|
const privateChat2 = (userId) => {
|
|
131470
131582
|
var _a3, _b;
|
|
131471
131583
|
const result = onPrivateChat == null ? void 0 : onPrivateChat(userId);
|
|
@@ -131721,7 +131833,8 @@ const GroupMember = (props) => {
|
|
|
131721
131833
|
checkedUsers: addMemberData.type == "add" ? groupMembers2 : [
|
|
131722
131834
|
{
|
|
131723
131835
|
userId: rootStore2.client.user
|
|
131724
|
-
}
|
|
131836
|
+
},
|
|
131837
|
+
...chatbotIds
|
|
131725
131838
|
]
|
|
131726
131839
|
}));
|
|
131727
131840
|
};
|
|
@@ -135660,7 +135773,7 @@ const userCard = "Contact Card";
|
|
|
135660
135773
|
const videoBtn = "Video";
|
|
135661
135774
|
const custom = "Custom message";
|
|
135662
135775
|
const combine = "Combined message";
|
|
135663
|
-
const noConversation = "No
|
|
135776
|
+
const noConversation = "No Conversations";
|
|
135664
135777
|
const recording = "Recording";
|
|
135665
135778
|
const you = "You";
|
|
135666
135779
|
const yourself = "Yourself";
|
|
@@ -135901,7 +136014,7 @@ const en = {
|
|
|
135901
136014
|
newRequests,
|
|
135902
136015
|
contacts,
|
|
135903
136016
|
groups,
|
|
135904
|
-
"no contact": "No
|
|
136017
|
+
"no contact": "No Contacts",
|
|
135905
136018
|
addGroupMembers,
|
|
135906
136019
|
removeGroupMembers,
|
|
135907
136020
|
privateChat,
|