whyuzeim 1.1.154 → 1.1.156
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/cjs/IM/context.d.ts +5 -0
- package/cjs/IM/style/index.scss +2 -2
- package/cjs/index.js +200 -40
- package/es/IM/context.d.ts +5 -0
- package/es/IM/style/index.scss +2 -2
- package/es/index.js +200 -40
- package/package.json +1 -1
package/cjs/IM/context.d.ts
CHANGED
package/cjs/IM/style/index.scss
CHANGED
|
@@ -97,9 +97,9 @@
|
|
|
97
97
|
|
|
98
98
|
//override
|
|
99
99
|
--im-msg-bubble-color-left: rgba(255, 255, 255, 0.05);
|
|
100
|
-
--im-msg-bubble-color-right:
|
|
100
|
+
--im-msg-bubble-color-right: rgba(144, 249, 38, 0.05);
|
|
101
101
|
--im-msg-bubble-font-color: rgba(255, 255, 255, 1);
|
|
102
|
-
--im-msg-bubble-right-font-color: rgba(
|
|
102
|
+
--im-msg-bubble-right-font-color: rgba(144, 249, 38, 1);
|
|
103
103
|
|
|
104
104
|
.cui-chat-dark {
|
|
105
105
|
background-color: var(--im-main-backgroundColor);
|
package/cjs/index.js
CHANGED
|
@@ -42,6 +42,8 @@ require('./TypeItem/style/index.scss');
|
|
|
42
42
|
require('./AddMember/style/index.scss');
|
|
43
43
|
var _objectWithoutProperties = require('@babel/runtime-corejs3/helpers/esm/objectWithoutProperties');
|
|
44
44
|
var _includesInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/includes');
|
|
45
|
+
var _Set = require('@babel/runtime-corejs3/core-js-stable/set');
|
|
46
|
+
var _JSON$stringify = require('@babel/runtime-corejs3/core-js-stable/json/stringify');
|
|
45
47
|
var _setInterval = require('@babel/runtime-corejs3/core-js-stable/set-interval');
|
|
46
48
|
var remarkGfm = require('remark-gfm');
|
|
47
49
|
var ReactMarkdown = require('react-markdown');
|
|
@@ -136756,7 +136758,7 @@ var SystemNotificationMsg = function SystemNotificationMsg(props) {
|
|
|
136756
136758
|
var _excluded = ["children"],
|
|
136757
136759
|
_excluded2 = ["className", "children"];
|
|
136758
136760
|
function ownKeys$4(e, r) { var t = _Object$keys(e); if (_Object$getOwnPropertySymbols) { var o = _Object$getOwnPropertySymbols(e); r && (o = _filterInstanceProperty(o).call(o, function (r) { return _Object$getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
136759
|
-
function _objectSpread$4(e) { for (var r = 1; r < arguments.length; r++) { var
|
|
136761
|
+
function _objectSpread$4(e) { for (var r = 1; r < arguments.length; r++) { var _context9, _context10; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty(_context9 = ownKeys$4(Object(t), true)).call(_context9, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(e, _Object$getOwnPropertyDescriptors(t)) : _forEachInstanceProperty(_context10 = ownKeys$4(Object(t))).call(_context10, function (r) { _Object$defineProperty(e, r, _Object$getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
136760
136762
|
var HighlyCustomChat = function HighlyCustomChat(props) {
|
|
136761
136763
|
var _props$className, _props$className2, _props$className3;
|
|
136762
136764
|
var _useTranslation = useTranslation(),
|
|
@@ -136807,34 +136809,156 @@ var HighlyCustomChat = function HighlyCustomChat(props) {
|
|
|
136807
136809
|
_useState10 = _slicedToArray(_useState9, 2),
|
|
136808
136810
|
isAgent = _useState10[0],
|
|
136809
136811
|
setIsAgent = _useState10[1];
|
|
136810
|
-
|
|
136812
|
+
// 用于跟踪正在获取的用户信息,避免重复请求
|
|
136813
|
+
var _useState11 = React.useState(new _Set()),
|
|
136814
|
+
_useState12 = _slicedToArray(_useState11, 2),
|
|
136815
|
+
fetchingUsers = _useState12[0],
|
|
136816
|
+
setFetchingUsers = _useState12[1];
|
|
136817
|
+
// 昵称脱敏函数:显示前6位和后4位,中间用...连接
|
|
136818
|
+
var maskUsername = function maskUsername(username) {
|
|
136819
|
+
var _context;
|
|
136820
|
+
if (!username) return '';
|
|
136821
|
+
if (username.length <= 10) return username; // 如果长度小于等于10,不脱敏
|
|
136822
|
+
return _concatInstanceProperty(_context = "".concat(_sliceInstanceProperty(username).call(username, 0, 6), "...")).call(_context, _sliceInstanceProperty(username).call(username, -4));
|
|
136823
|
+
};
|
|
136824
|
+
// 获取用户level:参考 CustomConversationItem 的逻辑,从ext字段中解析
|
|
136825
|
+
var getUserLevel = function getUserLevel(user) {
|
|
136826
|
+
var _user$metadata;
|
|
136827
|
+
// 优先从 metadata 中获取(新格式)
|
|
136828
|
+
if ((user === null || user === void 0 || (_user$metadata = user.metadata) === null || _user$metadata === void 0 ? void 0 : _user$metadata.level) !== undefined) {
|
|
136829
|
+
return Number(user.metadata.level);
|
|
136830
|
+
}
|
|
136831
|
+
// 从 ext 字段中解析(和 certification 一样的逻辑)
|
|
136832
|
+
if (user !== null && user !== void 0 && user.ext) {
|
|
136833
|
+
try {
|
|
136834
|
+
var extStr = typeof user.ext === 'string' ? user.ext : _JSON$stringify(user.ext);
|
|
136835
|
+
var customObj = JSON.parse(extStr);
|
|
136836
|
+
if ((customObj === null || customObj === void 0 ? void 0 : customObj.level) !== undefined) {
|
|
136837
|
+
var level = Number(customObj.level);
|
|
136838
|
+
return isNaN(level) ? 1 : level;
|
|
136839
|
+
}
|
|
136840
|
+
} catch (e) {
|
|
136841
|
+
// 解析失败,忽略
|
|
136842
|
+
}
|
|
136843
|
+
}
|
|
136844
|
+
return 1; // 默认值
|
|
136845
|
+
};
|
|
136846
|
+
// 获取发送者信息:如果是自己的消息返回当前用户信息,否则尝试从rootStore获取发送者信息
|
|
136847
|
+
var getSenderInfo = function getSenderInfo(msg) {
|
|
136811
136848
|
var _msg$from, _userInfo$uid;
|
|
136812
136849
|
var isMySelf = (msg === null || msg === void 0 ? void 0 : msg.bySelf) === true || (msg === null || msg === void 0 || (_msg$from = msg.from) === null || _msg$from === void 0 ? void 0 : _msg$from.toLowerCase()) === ((_userInfo$uid = userInfo.uid) === null || _userInfo$uid === void 0 ? void 0 : _userInfo$uid.toLowerCase());
|
|
136850
|
+
if (isMySelf) {
|
|
136851
|
+
// 自己的消息,返回当前用户信息
|
|
136852
|
+
// 如果 userInfo 没有 ext,尝试从 rootStore 获取
|
|
136853
|
+
var currentUserInfo = Ut.addressStore.appUsersInfo[userInfo.uid];
|
|
136854
|
+
if (currentUserInfo && currentUserInfo.ext && !userInfo.ext) {
|
|
136855
|
+
return _objectSpread$4(_objectSpread$4({}, userInfo), {}, {
|
|
136856
|
+
ext: currentUserInfo.ext
|
|
136857
|
+
});
|
|
136858
|
+
}
|
|
136859
|
+
return userInfo;
|
|
136860
|
+
} else {
|
|
136861
|
+
// 他人的消息,尝试从rootStore获取发送者信息
|
|
136862
|
+
var senderId = msg === null || msg === void 0 ? void 0 : msg.from;
|
|
136863
|
+
if (senderId) {
|
|
136864
|
+
var senderInfo = Ut.addressStore.appUsersInfo[senderId];
|
|
136865
|
+
if (senderInfo) {
|
|
136866
|
+
// 构造符合IUserInfo格式的对象,保留 ext 字段以便 getUserLevel 解析
|
|
136867
|
+
return {
|
|
136868
|
+
uid: senderId,
|
|
136869
|
+
username: senderInfo.name || senderInfo.nickname || senderId,
|
|
136870
|
+
avatar: senderInfo.avatarurl,
|
|
136871
|
+
ext: senderInfo.ext,
|
|
136872
|
+
// 保留 ext 字段,让 getUserLevel 可以解析
|
|
136873
|
+
metadata: senderInfo.ext ? function () {
|
|
136874
|
+
try {
|
|
136875
|
+
var extObj = typeof senderInfo.ext === 'string' ? JSON.parse(senderInfo.ext) : senderInfo.ext;
|
|
136876
|
+
return {
|
|
136877
|
+
level: extObj === null || extObj === void 0 ? void 0 : extObj.level
|
|
136878
|
+
};
|
|
136879
|
+
} catch (_unused) {
|
|
136880
|
+
return undefined;
|
|
136881
|
+
}
|
|
136882
|
+
}() : undefined
|
|
136883
|
+
};
|
|
136884
|
+
} else {
|
|
136885
|
+
// 如果没有获取到用户信息,尝试从服务器获取
|
|
136886
|
+
// 参考 CustomConversationItem 的逻辑
|
|
136887
|
+
if (!fetchingUsers.has(senderId)) {
|
|
136888
|
+
setFetchingUsers(function (prev) {
|
|
136889
|
+
return new _Set(prev).add(senderId);
|
|
136890
|
+
});
|
|
136891
|
+
client.fetchUserInfoById([senderId], ["nickname", "avatarurl", "mail", "phone", "gender", "sign", "birth", "ext"]).then(function (res) {
|
|
136892
|
+
var _res$data$senderId;
|
|
136893
|
+
// 将获取到的用户信息存储到 rootStore
|
|
136894
|
+
var tempUserInfo = Ut.addressStore.appUsersInfo[senderId];
|
|
136895
|
+
Ut.addressStore.appUsersInfo[senderId] = _objectSpread$4(_objectSpread$4({}, tempUserInfo || {}), {}, {
|
|
136896
|
+
userId: senderId,
|
|
136897
|
+
name: res.data[senderId].nickname,
|
|
136898
|
+
avatarurl: res.data[senderId].avatarurl,
|
|
136899
|
+
ext: (_res$data$senderId = res.data[senderId]) === null || _res$data$senderId === void 0 ? void 0 : _res$data$senderId.ext
|
|
136900
|
+
});
|
|
136901
|
+
// 从 fetchingUsers 中移除,并触发重新渲染
|
|
136902
|
+
setFetchingUsers(function (prev) {
|
|
136903
|
+
var next = new _Set(prev);
|
|
136904
|
+
next["delete"](senderId);
|
|
136905
|
+
return next;
|
|
136906
|
+
});
|
|
136907
|
+
})["catch"](function (err) {
|
|
136908
|
+
// 从 fetchingUsers 中移除
|
|
136909
|
+
setFetchingUsers(function (prev) {
|
|
136910
|
+
var next = new _Set(prev);
|
|
136911
|
+
next["delete"](senderId);
|
|
136912
|
+
return next;
|
|
136913
|
+
});
|
|
136914
|
+
});
|
|
136915
|
+
}
|
|
136916
|
+
}
|
|
136917
|
+
}
|
|
136918
|
+
// 如果获取不到,返回一个基于消息的基本信息
|
|
136919
|
+
return {
|
|
136920
|
+
uid: senderId || '',
|
|
136921
|
+
username: senderId || '',
|
|
136922
|
+
metadata: {
|
|
136923
|
+
level: 1
|
|
136924
|
+
}
|
|
136925
|
+
};
|
|
136926
|
+
}
|
|
136927
|
+
};
|
|
136928
|
+
var renderTxtMsg = function renderTxtMsg(msg, onApply) {
|
|
136929
|
+
var _msg$from2, _userInfo$uid2, _context2;
|
|
136930
|
+
(msg === null || msg === void 0 ? void 0 : msg.bySelf) === true || (msg === null || msg === void 0 || (_msg$from2 = msg.from) === null || _msg$from2 === void 0 ? void 0 : _msg$from2.toLowerCase()) === ((_userInfo$uid2 = userInfo.uid) === null || _userInfo$uid2 === void 0 ? void 0 : _userInfo$uid2.toLowerCase());
|
|
136931
|
+
// 获取发送者信息并格式化昵称+level
|
|
136932
|
+
var senderInfo = getSenderInfo(msg);
|
|
136933
|
+
var displayUsername = (senderInfo === null || senderInfo === void 0 ? void 0 : senderInfo.username) || (senderInfo === null || senderInfo === void 0 ? void 0 : senderInfo.uid) || '';
|
|
136934
|
+
var maskedUsername = displayUsername ? maskUsername(displayUsername) : '';
|
|
136935
|
+
var level = getUserLevel(senderInfo);
|
|
136936
|
+
var nickNameWithLevel = maskedUsername ? _concatInstanceProperty(_context2 = "".concat(maskedUsername, " Lv")).call(_context2, level) : undefined;
|
|
136813
136937
|
return /*#__PURE__*/React.createElement(qh, {
|
|
136814
136938
|
bubbleType: "none",
|
|
136815
136939
|
reaction: false,
|
|
136816
136940
|
select: false,
|
|
136817
136941
|
thread: false,
|
|
136818
|
-
direction:
|
|
136942
|
+
direction: "ltr",
|
|
136819
136943
|
renderUserProfile: function renderUserProfile() {
|
|
136820
136944
|
return null;
|
|
136821
136945
|
},
|
|
136822
|
-
nickName:
|
|
136946
|
+
nickName: nickNameWithLevel,
|
|
136823
136947
|
showMessageInfo: false,
|
|
136824
136948
|
message: msg,
|
|
136825
136949
|
customAction: {
|
|
136826
136950
|
visible: false,
|
|
136827
136951
|
icon: null,
|
|
136828
136952
|
actions: []
|
|
136829
|
-
}
|
|
136830
|
-
showAvatar
|
|
136953
|
+
}
|
|
136954
|
+
// showAvatar={!isMySelf}
|
|
136831
136955
|
// avatar={!isMySelf?<img src={headerInfo.headerImageURL||defaultAvatar} className="w-[48px] h-[48px] rounded-full overflow-hidden object-fit" />:undefined}
|
|
136832
136956
|
,
|
|
136833
136957
|
children: renderLongTextMsg(msg, onApply)
|
|
136834
136958
|
});
|
|
136835
136959
|
};
|
|
136836
136960
|
var renderLongTextMsg = function renderLongTextMsg(msg, onApply) {
|
|
136837
|
-
var _msg$
|
|
136961
|
+
var _msg$from3, _userInfo$uid3;
|
|
136838
136962
|
// 格式化消息时间
|
|
136839
136963
|
var formatMessageTime = function formatMessageTime(timestamp) {
|
|
136840
136964
|
if (!timestamp) return "";
|
|
@@ -136860,11 +136984,38 @@ var HighlyCustomChat = function HighlyCustomChat(props) {
|
|
|
136860
136984
|
});
|
|
136861
136985
|
}
|
|
136862
136986
|
};
|
|
136863
|
-
var isMySelf = (msg === null || msg === void 0 ? void 0 : msg.bySelf) === true || (msg === null || msg === void 0 || (_msg$
|
|
136987
|
+
var isMySelf = (msg === null || msg === void 0 ? void 0 : msg.bySelf) === true || (msg === null || msg === void 0 || (_msg$from3 = msg.from) === null || _msg$from3 === void 0 ? void 0 : _msg$from3.toLowerCase()) === ((_userInfo$uid3 = userInfo.uid) === null || _userInfo$uid3 === void 0 ? void 0 : _userInfo$uid3.toLowerCase());
|
|
136864
136988
|
// 复制代码到剪贴板
|
|
136865
136989
|
return /*#__PURE__*/React.createElement("div", {
|
|
136866
|
-
className: "text-[var(--im-main-fontColor)] flex flex-col gap-1 ".concat(
|
|
136867
|
-
},
|
|
136990
|
+
className: "text-[var(--im-main-fontColor)] flex flex-col gap-1 ".concat("items-start")
|
|
136991
|
+
}, function () {
|
|
136992
|
+
var senderInfo = getSenderInfo(msg);
|
|
136993
|
+
var displayUsername = (senderInfo === null || senderInfo === void 0 ? void 0 : senderInfo.username) || (senderInfo === null || senderInfo === void 0 ? void 0 : senderInfo.uid) || '';
|
|
136994
|
+
if (displayUsername) {
|
|
136995
|
+
var maskedUsername = maskUsername(displayUsername);
|
|
136996
|
+
var level = getUserLevel(senderInfo);
|
|
136997
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
136998
|
+
className: "text-xs mb-1 px-1",
|
|
136999
|
+
style: {
|
|
137000
|
+
color: 'var(--im-third-fontColor)',
|
|
137001
|
+
opacity: 0.8,
|
|
137002
|
+
fontWeight: 'normal',
|
|
137003
|
+
display: 'block',
|
|
137004
|
+
lineHeight: '1.2',
|
|
137005
|
+
minHeight: '14px'
|
|
137006
|
+
}
|
|
137007
|
+
}, maskedUsername, ' ', /*#__PURE__*/React.createElement("span", {
|
|
137008
|
+
style: {
|
|
137009
|
+
background: 'linear-gradient(90deg, #90F926 0%, #FFD61E 100%)',
|
|
137010
|
+
WebkitBackgroundClip: 'text',
|
|
137011
|
+
WebkitTextFillColor: 'transparent',
|
|
137012
|
+
backgroundClip: 'text',
|
|
137013
|
+
fontWeight: 'normal'
|
|
137014
|
+
}
|
|
137015
|
+
}, "Lv", level));
|
|
137016
|
+
}
|
|
137017
|
+
return null;
|
|
137018
|
+
}(), /*#__PURE__*/React.createElement("div", {
|
|
136868
137019
|
style: {
|
|
136869
137020
|
background: isMySelf ? "var(--im-msg-bubble-color-right)" : "var(--im-msg-bubble-color-left)",
|
|
136870
137021
|
borderRadius: "9px",
|
|
@@ -136913,8 +137064,14 @@ var HighlyCustomChat = function HighlyCustomChat(props) {
|
|
|
136913
137064
|
}, formatMessageTime(msg.time)));
|
|
136914
137065
|
};
|
|
136915
137066
|
var _renderMessage = function renderMessage(msg) {
|
|
136916
|
-
var _msg$
|
|
136917
|
-
var isMySelf = (msg === null || msg === void 0 ? void 0 : msg.bySelf) === true || (msg === null || msg === void 0 || (_msg$
|
|
137067
|
+
var _msg$from4, _userInfo$uid4, _context3;
|
|
137068
|
+
var isMySelf = (msg === null || msg === void 0 ? void 0 : msg.bySelf) === true || (msg === null || msg === void 0 || (_msg$from4 = msg.from) === null || _msg$from4 === void 0 ? void 0 : _msg$from4.toLowerCase()) === ((_userInfo$uid4 = userInfo.uid) === null || _userInfo$uid4 === void 0 ? void 0 : _userInfo$uid4.toLowerCase());
|
|
137069
|
+
// 获取发送者信息并格式化昵称+level
|
|
137070
|
+
var senderInfo = getSenderInfo(msg);
|
|
137071
|
+
var displayUsername = (senderInfo === null || senderInfo === void 0 ? void 0 : senderInfo.username) || (senderInfo === null || senderInfo === void 0 ? void 0 : senderInfo.uid) || '';
|
|
137072
|
+
var maskedUsername = displayUsername ? maskUsername(displayUsername) : '';
|
|
137073
|
+
var level = getUserLevel(senderInfo);
|
|
137074
|
+
var nickNameWithLevel = maskedUsername ? _concatInstanceProperty(_context3 = "".concat(maskedUsername, " Lv")).call(_context3, level) : undefined;
|
|
136918
137075
|
if (msg.type === "txt") {
|
|
136919
137076
|
return renderTxtMsg(msg, props.onApply);
|
|
136920
137077
|
} else if (msg.type === "img") {
|
|
@@ -136925,6 +137082,7 @@ var HighlyCustomChat = function HighlyCustomChat(props) {
|
|
|
136925
137082
|
renderUserProfile: function renderUserProfile() {
|
|
136926
137083
|
return null;
|
|
136927
137084
|
},
|
|
137085
|
+
nickName: nickNameWithLevel,
|
|
136928
137086
|
customAction: {
|
|
136929
137087
|
visible: false,
|
|
136930
137088
|
icon: null,
|
|
@@ -136946,6 +137104,7 @@ var HighlyCustomChat = function HighlyCustomChat(props) {
|
|
|
136946
137104
|
renderUserProfile: function renderUserProfile() {
|
|
136947
137105
|
return null;
|
|
136948
137106
|
},
|
|
137107
|
+
nickName: nickNameWithLevel,
|
|
136949
137108
|
customAction: {
|
|
136950
137109
|
visible: false,
|
|
136951
137110
|
icon: null,
|
|
@@ -136961,6 +137120,7 @@ var HighlyCustomChat = function HighlyCustomChat(props) {
|
|
|
136961
137120
|
renderUserProfile: function renderUserProfile() {
|
|
136962
137121
|
return null;
|
|
136963
137122
|
},
|
|
137123
|
+
nickName: nickNameWithLevel,
|
|
136964
137124
|
customAction: {
|
|
136965
137125
|
visible: false,
|
|
136966
137126
|
icon: null,
|
|
@@ -137057,8 +137217,8 @@ var HighlyCustomChat = function HighlyCustomChat(props) {
|
|
|
137057
137217
|
};
|
|
137058
137218
|
// 使用 useCallback 包装 getHeaderInfo 函数
|
|
137059
137219
|
var getHeaderInfo = React.useCallback(function () {
|
|
137060
|
-
var
|
|
137061
|
-
var cvs = _findInstanceProperty(
|
|
137220
|
+
var _context4;
|
|
137221
|
+
var cvs = _findInstanceProperty(_context4 = Ut.conversationStore.conversationList).call(_context4, function (cvs) {
|
|
137062
137222
|
return cvs.conversationId === props.conversationId;
|
|
137063
137223
|
});
|
|
137064
137224
|
if (!cvs || !(cvs !== null && cvs !== void 0 && cvs.conversationId)) {
|
|
@@ -137075,18 +137235,18 @@ var HighlyCustomChat = function HighlyCustomChat(props) {
|
|
|
137075
137235
|
var fetchGroupInfo = /*#__PURE__*/function () {
|
|
137076
137236
|
var _ref4 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
137077
137237
|
var _cvs$conversationId, response, data, groupInfo, _groupInfo$headimgurl, _groupInfo$members, _ref5, _groupInfo$name, imageurl, member, name;
|
|
137078
|
-
return _regeneratorRuntime.wrap(function _callee$(
|
|
137079
|
-
while (1) switch (
|
|
137238
|
+
return _regeneratorRuntime.wrap(function _callee$(_context5) {
|
|
137239
|
+
while (1) switch (_context5.prev = _context5.next) {
|
|
137080
137240
|
case 0:
|
|
137081
137241
|
//需要请求群信息
|
|
137082
137242
|
console.log('the group info fetched');
|
|
137083
|
-
|
|
137084
|
-
|
|
137243
|
+
_context5.prev = 1;
|
|
137244
|
+
_context5.next = 4;
|
|
137085
137245
|
return http.post("/capi/account/imchannel/getdetails", {
|
|
137086
137246
|
sendbirdid: (_cvs$conversationId = cvs.conversationId) !== null && _cvs$conversationId !== void 0 ? _cvs$conversationId : ''
|
|
137087
137247
|
});
|
|
137088
137248
|
case 4:
|
|
137089
|
-
response =
|
|
137249
|
+
response = _context5.sent;
|
|
137090
137250
|
data = response.data;
|
|
137091
137251
|
if (data && data.code === 200) {
|
|
137092
137252
|
groupInfo = data === null || data === void 0 ? void 0 : data.data;
|
|
@@ -137103,14 +137263,14 @@ var HighlyCustomChat = function HighlyCustomChat(props) {
|
|
|
137103
137263
|
});
|
|
137104
137264
|
}
|
|
137105
137265
|
}
|
|
137106
|
-
|
|
137266
|
+
_context5.next = 11;
|
|
137107
137267
|
break;
|
|
137108
137268
|
case 9:
|
|
137109
|
-
|
|
137110
|
-
|
|
137269
|
+
_context5.prev = 9;
|
|
137270
|
+
_context5.t0 = _context5["catch"](1);
|
|
137111
137271
|
case 11:
|
|
137112
137272
|
case "end":
|
|
137113
|
-
return
|
|
137273
|
+
return _context5.stop();
|
|
137114
137274
|
}
|
|
137115
137275
|
}, _callee, null, [[1, 9]]);
|
|
137116
137276
|
}));
|
|
@@ -137124,8 +137284,8 @@ var HighlyCustomChat = function HighlyCustomChat(props) {
|
|
|
137124
137284
|
var _ref6 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee2(group) {
|
|
137125
137285
|
var _group$info;
|
|
137126
137286
|
var _group$info2, _customObj$headimgurl, _group$info$affiliati, _group$info3, _ref7, _ref8, _group$name, _group$info4, customObj, imageurl, member, name;
|
|
137127
|
-
return _regeneratorRuntime.wrap(function _callee2$(
|
|
137128
|
-
while (1) switch (
|
|
137287
|
+
return _regeneratorRuntime.wrap(function _callee2$(_context6) {
|
|
137288
|
+
while (1) switch (_context6.prev = _context6.next) {
|
|
137129
137289
|
case 0:
|
|
137130
137290
|
// @ts-ignore
|
|
137131
137291
|
if (cvs.conversationId == (group === null || group === void 0 ? void 0 : group.groupid) && group !== null && group !== void 0 && (_group$info = group.info) !== null && _group$info !== void 0 && _group$info.custom) {
|
|
@@ -137149,7 +137309,7 @@ var HighlyCustomChat = function HighlyCustomChat(props) {
|
|
|
137149
137309
|
}
|
|
137150
137310
|
case 1:
|
|
137151
137311
|
case "end":
|
|
137152
|
-
return
|
|
137312
|
+
return _context6.stop();
|
|
137153
137313
|
}
|
|
137154
137314
|
}, _callee2);
|
|
137155
137315
|
}));
|
|
@@ -137272,16 +137432,16 @@ var HighlyCustomChat = function HighlyCustomChat(props) {
|
|
|
137272
137432
|
var handleSendMessage = /*#__PURE__*/function () {
|
|
137273
137433
|
var _ref9 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee3(text, extInfo) {
|
|
137274
137434
|
var txtMessage, cuiScrollList, cuiScrollListWrap, htmlString, template, node;
|
|
137275
|
-
return _regeneratorRuntime.wrap(function _callee3$(
|
|
137276
|
-
while (1) switch (
|
|
137435
|
+
return _regeneratorRuntime.wrap(function _callee3$(_context7) {
|
|
137436
|
+
while (1) switch (_context7.prev = _context7.next) {
|
|
137277
137437
|
case 0:
|
|
137278
137438
|
if (_trimInstanceProperty(text).call(text)) {
|
|
137279
|
-
|
|
137439
|
+
_context7.next = 2;
|
|
137280
137440
|
break;
|
|
137281
137441
|
}
|
|
137282
|
-
return
|
|
137442
|
+
return _context7.abrupt("return");
|
|
137283
137443
|
case 2:
|
|
137284
|
-
|
|
137444
|
+
_context7.prev = 2;
|
|
137285
137445
|
// 普通文本消息
|
|
137286
137446
|
txtMessage = MessageSDK.message.create({
|
|
137287
137447
|
type: "txt",
|
|
@@ -137289,7 +137449,7 @@ var HighlyCustomChat = function HighlyCustomChat(props) {
|
|
|
137289
137449
|
to: props.conversationId,
|
|
137290
137450
|
chatType: headerInfo.chatType
|
|
137291
137451
|
});
|
|
137292
|
-
|
|
137452
|
+
_context7.next = 6;
|
|
137293
137453
|
return Ut.messageStore.sendMessage(txtMessage);
|
|
137294
137454
|
case 6:
|
|
137295
137455
|
afterSendMsg(txtMessage, extInfo);
|
|
@@ -137309,15 +137469,15 @@ var HighlyCustomChat = function HighlyCustomChat(props) {
|
|
|
137309
137469
|
}
|
|
137310
137470
|
}
|
|
137311
137471
|
}
|
|
137312
|
-
|
|
137472
|
+
_context7.next = 13;
|
|
137313
137473
|
break;
|
|
137314
137474
|
case 10:
|
|
137315
|
-
|
|
137316
|
-
|
|
137317
|
-
console.log("send txt message failed",
|
|
137475
|
+
_context7.prev = 10;
|
|
137476
|
+
_context7.t0 = _context7["catch"](2);
|
|
137477
|
+
console.log("send txt message failed", _context7.t0);
|
|
137318
137478
|
case 13:
|
|
137319
137479
|
case "end":
|
|
137320
|
-
return
|
|
137480
|
+
return _context7.stop();
|
|
137321
137481
|
}
|
|
137322
137482
|
}, _callee3, null, [[2, 10]]);
|
|
137323
137483
|
}));
|
|
@@ -137327,13 +137487,13 @@ var HighlyCustomChat = function HighlyCustomChat(props) {
|
|
|
137327
137487
|
}();
|
|
137328
137488
|
var afterSendMsg = /*#__PURE__*/function () {
|
|
137329
137489
|
var _ref10 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee4(msgInfo, extInfo) {
|
|
137330
|
-
return _regeneratorRuntime.wrap(function _callee4$(
|
|
137331
|
-
while (1) switch (
|
|
137490
|
+
return _regeneratorRuntime.wrap(function _callee4$(_context8) {
|
|
137491
|
+
while (1) switch (_context8.prev = _context8.next) {
|
|
137332
137492
|
case 0:
|
|
137333
137493
|
props.sendMessageSuccessCallback && props.sendMessageSuccessCallback(msgInfo, extInfo);
|
|
137334
137494
|
case 1:
|
|
137335
137495
|
case "end":
|
|
137336
|
-
return
|
|
137496
|
+
return _context8.stop();
|
|
137337
137497
|
}
|
|
137338
137498
|
}, _callee4);
|
|
137339
137499
|
}));
|
package/es/IM/context.d.ts
CHANGED
package/es/IM/style/index.scss
CHANGED
|
@@ -97,9 +97,9 @@
|
|
|
97
97
|
|
|
98
98
|
//override
|
|
99
99
|
--im-msg-bubble-color-left: rgba(255, 255, 255, 0.05);
|
|
100
|
-
--im-msg-bubble-color-right:
|
|
100
|
+
--im-msg-bubble-color-right: rgba(144, 249, 38, 0.05);
|
|
101
101
|
--im-msg-bubble-font-color: rgba(255, 255, 255, 1);
|
|
102
|
-
--im-msg-bubble-right-font-color: rgba(
|
|
102
|
+
--im-msg-bubble-right-font-color: rgba(144, 249, 38, 1);
|
|
103
103
|
|
|
104
104
|
.cui-chat-dark {
|
|
105
105
|
background-color: var(--im-main-backgroundColor);
|
package/es/index.js
CHANGED
|
@@ -41,6 +41,8 @@ import './TypeItem/style/index.scss';
|
|
|
41
41
|
import './AddMember/style/index.scss';
|
|
42
42
|
import _objectWithoutProperties from '@babel/runtime-corejs3/helpers/esm/objectWithoutProperties';
|
|
43
43
|
import _includesInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/includes';
|
|
44
|
+
import _Set from '@babel/runtime-corejs3/core-js-stable/set';
|
|
45
|
+
import _JSON$stringify from '@babel/runtime-corejs3/core-js-stable/json/stringify';
|
|
44
46
|
import _setInterval from '@babel/runtime-corejs3/core-js-stable/set-interval';
|
|
45
47
|
import remarkGfm from 'remark-gfm';
|
|
46
48
|
import ReactMarkdown from 'react-markdown';
|
|
@@ -136735,7 +136737,7 @@ var SystemNotificationMsg = function SystemNotificationMsg(props) {
|
|
|
136735
136737
|
var _excluded = ["children"],
|
|
136736
136738
|
_excluded2 = ["className", "children"];
|
|
136737
136739
|
function ownKeys$4(e, r) { var t = _Object$keys(e); if (_Object$getOwnPropertySymbols) { var o = _Object$getOwnPropertySymbols(e); r && (o = _filterInstanceProperty(o).call(o, function (r) { return _Object$getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
136738
|
-
function _objectSpread$4(e) { for (var r = 1; r < arguments.length; r++) { var
|
|
136740
|
+
function _objectSpread$4(e) { for (var r = 1; r < arguments.length; r++) { var _context9, _context10; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty(_context9 = ownKeys$4(Object(t), true)).call(_context9, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(e, _Object$getOwnPropertyDescriptors(t)) : _forEachInstanceProperty(_context10 = ownKeys$4(Object(t))).call(_context10, function (r) { _Object$defineProperty(e, r, _Object$getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
136739
136741
|
var HighlyCustomChat = function HighlyCustomChat(props) {
|
|
136740
136742
|
var _props$className, _props$className2, _props$className3;
|
|
136741
136743
|
var _useTranslation = useTranslation(),
|
|
@@ -136786,34 +136788,156 @@ var HighlyCustomChat = function HighlyCustomChat(props) {
|
|
|
136786
136788
|
_useState10 = _slicedToArray(_useState9, 2),
|
|
136787
136789
|
isAgent = _useState10[0],
|
|
136788
136790
|
setIsAgent = _useState10[1];
|
|
136789
|
-
|
|
136791
|
+
// 用于跟踪正在获取的用户信息,避免重复请求
|
|
136792
|
+
var _useState11 = useState(new _Set()),
|
|
136793
|
+
_useState12 = _slicedToArray(_useState11, 2),
|
|
136794
|
+
fetchingUsers = _useState12[0],
|
|
136795
|
+
setFetchingUsers = _useState12[1];
|
|
136796
|
+
// 昵称脱敏函数:显示前6位和后4位,中间用...连接
|
|
136797
|
+
var maskUsername = function maskUsername(username) {
|
|
136798
|
+
var _context;
|
|
136799
|
+
if (!username) return '';
|
|
136800
|
+
if (username.length <= 10) return username; // 如果长度小于等于10,不脱敏
|
|
136801
|
+
return _concatInstanceProperty(_context = "".concat(_sliceInstanceProperty(username).call(username, 0, 6), "...")).call(_context, _sliceInstanceProperty(username).call(username, -4));
|
|
136802
|
+
};
|
|
136803
|
+
// 获取用户level:参考 CustomConversationItem 的逻辑,从ext字段中解析
|
|
136804
|
+
var getUserLevel = function getUserLevel(user) {
|
|
136805
|
+
var _user$metadata;
|
|
136806
|
+
// 优先从 metadata 中获取(新格式)
|
|
136807
|
+
if ((user === null || user === void 0 || (_user$metadata = user.metadata) === null || _user$metadata === void 0 ? void 0 : _user$metadata.level) !== undefined) {
|
|
136808
|
+
return Number(user.metadata.level);
|
|
136809
|
+
}
|
|
136810
|
+
// 从 ext 字段中解析(和 certification 一样的逻辑)
|
|
136811
|
+
if (user !== null && user !== void 0 && user.ext) {
|
|
136812
|
+
try {
|
|
136813
|
+
var extStr = typeof user.ext === 'string' ? user.ext : _JSON$stringify(user.ext);
|
|
136814
|
+
var customObj = JSON.parse(extStr);
|
|
136815
|
+
if ((customObj === null || customObj === void 0 ? void 0 : customObj.level) !== undefined) {
|
|
136816
|
+
var level = Number(customObj.level);
|
|
136817
|
+
return isNaN(level) ? 1 : level;
|
|
136818
|
+
}
|
|
136819
|
+
} catch (e) {
|
|
136820
|
+
// 解析失败,忽略
|
|
136821
|
+
}
|
|
136822
|
+
}
|
|
136823
|
+
return 1; // 默认值
|
|
136824
|
+
};
|
|
136825
|
+
// 获取发送者信息:如果是自己的消息返回当前用户信息,否则尝试从rootStore获取发送者信息
|
|
136826
|
+
var getSenderInfo = function getSenderInfo(msg) {
|
|
136790
136827
|
var _msg$from, _userInfo$uid;
|
|
136791
136828
|
var isMySelf = (msg === null || msg === void 0 ? void 0 : msg.bySelf) === true || (msg === null || msg === void 0 || (_msg$from = msg.from) === null || _msg$from === void 0 ? void 0 : _msg$from.toLowerCase()) === ((_userInfo$uid = userInfo.uid) === null || _userInfo$uid === void 0 ? void 0 : _userInfo$uid.toLowerCase());
|
|
136829
|
+
if (isMySelf) {
|
|
136830
|
+
// 自己的消息,返回当前用户信息
|
|
136831
|
+
// 如果 userInfo 没有 ext,尝试从 rootStore 获取
|
|
136832
|
+
var currentUserInfo = Ut.addressStore.appUsersInfo[userInfo.uid];
|
|
136833
|
+
if (currentUserInfo && currentUserInfo.ext && !userInfo.ext) {
|
|
136834
|
+
return _objectSpread$4(_objectSpread$4({}, userInfo), {}, {
|
|
136835
|
+
ext: currentUserInfo.ext
|
|
136836
|
+
});
|
|
136837
|
+
}
|
|
136838
|
+
return userInfo;
|
|
136839
|
+
} else {
|
|
136840
|
+
// 他人的消息,尝试从rootStore获取发送者信息
|
|
136841
|
+
var senderId = msg === null || msg === void 0 ? void 0 : msg.from;
|
|
136842
|
+
if (senderId) {
|
|
136843
|
+
var senderInfo = Ut.addressStore.appUsersInfo[senderId];
|
|
136844
|
+
if (senderInfo) {
|
|
136845
|
+
// 构造符合IUserInfo格式的对象,保留 ext 字段以便 getUserLevel 解析
|
|
136846
|
+
return {
|
|
136847
|
+
uid: senderId,
|
|
136848
|
+
username: senderInfo.name || senderInfo.nickname || senderId,
|
|
136849
|
+
avatar: senderInfo.avatarurl,
|
|
136850
|
+
ext: senderInfo.ext,
|
|
136851
|
+
// 保留 ext 字段,让 getUserLevel 可以解析
|
|
136852
|
+
metadata: senderInfo.ext ? function () {
|
|
136853
|
+
try {
|
|
136854
|
+
var extObj = typeof senderInfo.ext === 'string' ? JSON.parse(senderInfo.ext) : senderInfo.ext;
|
|
136855
|
+
return {
|
|
136856
|
+
level: extObj === null || extObj === void 0 ? void 0 : extObj.level
|
|
136857
|
+
};
|
|
136858
|
+
} catch (_unused) {
|
|
136859
|
+
return undefined;
|
|
136860
|
+
}
|
|
136861
|
+
}() : undefined
|
|
136862
|
+
};
|
|
136863
|
+
} else {
|
|
136864
|
+
// 如果没有获取到用户信息,尝试从服务器获取
|
|
136865
|
+
// 参考 CustomConversationItem 的逻辑
|
|
136866
|
+
if (!fetchingUsers.has(senderId)) {
|
|
136867
|
+
setFetchingUsers(function (prev) {
|
|
136868
|
+
return new _Set(prev).add(senderId);
|
|
136869
|
+
});
|
|
136870
|
+
client.fetchUserInfoById([senderId], ["nickname", "avatarurl", "mail", "phone", "gender", "sign", "birth", "ext"]).then(function (res) {
|
|
136871
|
+
var _res$data$senderId;
|
|
136872
|
+
// 将获取到的用户信息存储到 rootStore
|
|
136873
|
+
var tempUserInfo = Ut.addressStore.appUsersInfo[senderId];
|
|
136874
|
+
Ut.addressStore.appUsersInfo[senderId] = _objectSpread$4(_objectSpread$4({}, tempUserInfo || {}), {}, {
|
|
136875
|
+
userId: senderId,
|
|
136876
|
+
name: res.data[senderId].nickname,
|
|
136877
|
+
avatarurl: res.data[senderId].avatarurl,
|
|
136878
|
+
ext: (_res$data$senderId = res.data[senderId]) === null || _res$data$senderId === void 0 ? void 0 : _res$data$senderId.ext
|
|
136879
|
+
});
|
|
136880
|
+
// 从 fetchingUsers 中移除,并触发重新渲染
|
|
136881
|
+
setFetchingUsers(function (prev) {
|
|
136882
|
+
var next = new _Set(prev);
|
|
136883
|
+
next["delete"](senderId);
|
|
136884
|
+
return next;
|
|
136885
|
+
});
|
|
136886
|
+
})["catch"](function (err) {
|
|
136887
|
+
// 从 fetchingUsers 中移除
|
|
136888
|
+
setFetchingUsers(function (prev) {
|
|
136889
|
+
var next = new _Set(prev);
|
|
136890
|
+
next["delete"](senderId);
|
|
136891
|
+
return next;
|
|
136892
|
+
});
|
|
136893
|
+
});
|
|
136894
|
+
}
|
|
136895
|
+
}
|
|
136896
|
+
}
|
|
136897
|
+
// 如果获取不到,返回一个基于消息的基本信息
|
|
136898
|
+
return {
|
|
136899
|
+
uid: senderId || '',
|
|
136900
|
+
username: senderId || '',
|
|
136901
|
+
metadata: {
|
|
136902
|
+
level: 1
|
|
136903
|
+
}
|
|
136904
|
+
};
|
|
136905
|
+
}
|
|
136906
|
+
};
|
|
136907
|
+
var renderTxtMsg = function renderTxtMsg(msg, onApply) {
|
|
136908
|
+
var _msg$from2, _userInfo$uid2, _context2;
|
|
136909
|
+
(msg === null || msg === void 0 ? void 0 : msg.bySelf) === true || (msg === null || msg === void 0 || (_msg$from2 = msg.from) === null || _msg$from2 === void 0 ? void 0 : _msg$from2.toLowerCase()) === ((_userInfo$uid2 = userInfo.uid) === null || _userInfo$uid2 === void 0 ? void 0 : _userInfo$uid2.toLowerCase());
|
|
136910
|
+
// 获取发送者信息并格式化昵称+level
|
|
136911
|
+
var senderInfo = getSenderInfo(msg);
|
|
136912
|
+
var displayUsername = (senderInfo === null || senderInfo === void 0 ? void 0 : senderInfo.username) || (senderInfo === null || senderInfo === void 0 ? void 0 : senderInfo.uid) || '';
|
|
136913
|
+
var maskedUsername = displayUsername ? maskUsername(displayUsername) : '';
|
|
136914
|
+
var level = getUserLevel(senderInfo);
|
|
136915
|
+
var nickNameWithLevel = maskedUsername ? _concatInstanceProperty(_context2 = "".concat(maskedUsername, " Lv")).call(_context2, level) : undefined;
|
|
136792
136916
|
return /*#__PURE__*/React__default.createElement(qh, {
|
|
136793
136917
|
bubbleType: "none",
|
|
136794
136918
|
reaction: false,
|
|
136795
136919
|
select: false,
|
|
136796
136920
|
thread: false,
|
|
136797
|
-
direction:
|
|
136921
|
+
direction: "ltr",
|
|
136798
136922
|
renderUserProfile: function renderUserProfile() {
|
|
136799
136923
|
return null;
|
|
136800
136924
|
},
|
|
136801
|
-
nickName:
|
|
136925
|
+
nickName: nickNameWithLevel,
|
|
136802
136926
|
showMessageInfo: false,
|
|
136803
136927
|
message: msg,
|
|
136804
136928
|
customAction: {
|
|
136805
136929
|
visible: false,
|
|
136806
136930
|
icon: null,
|
|
136807
136931
|
actions: []
|
|
136808
|
-
}
|
|
136809
|
-
showAvatar
|
|
136932
|
+
}
|
|
136933
|
+
// showAvatar={!isMySelf}
|
|
136810
136934
|
// avatar={!isMySelf?<img src={headerInfo.headerImageURL||defaultAvatar} className="w-[48px] h-[48px] rounded-full overflow-hidden object-fit" />:undefined}
|
|
136811
136935
|
,
|
|
136812
136936
|
children: renderLongTextMsg(msg, onApply)
|
|
136813
136937
|
});
|
|
136814
136938
|
};
|
|
136815
136939
|
var renderLongTextMsg = function renderLongTextMsg(msg, onApply) {
|
|
136816
|
-
var _msg$
|
|
136940
|
+
var _msg$from3, _userInfo$uid3;
|
|
136817
136941
|
// 格式化消息时间
|
|
136818
136942
|
var formatMessageTime = function formatMessageTime(timestamp) {
|
|
136819
136943
|
if (!timestamp) return "";
|
|
@@ -136839,11 +136963,38 @@ var HighlyCustomChat = function HighlyCustomChat(props) {
|
|
|
136839
136963
|
});
|
|
136840
136964
|
}
|
|
136841
136965
|
};
|
|
136842
|
-
var isMySelf = (msg === null || msg === void 0 ? void 0 : msg.bySelf) === true || (msg === null || msg === void 0 || (_msg$
|
|
136966
|
+
var isMySelf = (msg === null || msg === void 0 ? void 0 : msg.bySelf) === true || (msg === null || msg === void 0 || (_msg$from3 = msg.from) === null || _msg$from3 === void 0 ? void 0 : _msg$from3.toLowerCase()) === ((_userInfo$uid3 = userInfo.uid) === null || _userInfo$uid3 === void 0 ? void 0 : _userInfo$uid3.toLowerCase());
|
|
136843
136967
|
// 复制代码到剪贴板
|
|
136844
136968
|
return /*#__PURE__*/React__default.createElement("div", {
|
|
136845
|
-
className: "text-[var(--im-main-fontColor)] flex flex-col gap-1 ".concat(
|
|
136846
|
-
},
|
|
136969
|
+
className: "text-[var(--im-main-fontColor)] flex flex-col gap-1 ".concat("items-start")
|
|
136970
|
+
}, function () {
|
|
136971
|
+
var senderInfo = getSenderInfo(msg);
|
|
136972
|
+
var displayUsername = (senderInfo === null || senderInfo === void 0 ? void 0 : senderInfo.username) || (senderInfo === null || senderInfo === void 0 ? void 0 : senderInfo.uid) || '';
|
|
136973
|
+
if (displayUsername) {
|
|
136974
|
+
var maskedUsername = maskUsername(displayUsername);
|
|
136975
|
+
var level = getUserLevel(senderInfo);
|
|
136976
|
+
return /*#__PURE__*/React__default.createElement("div", {
|
|
136977
|
+
className: "text-xs mb-1 px-1",
|
|
136978
|
+
style: {
|
|
136979
|
+
color: 'var(--im-third-fontColor)',
|
|
136980
|
+
opacity: 0.8,
|
|
136981
|
+
fontWeight: 'normal',
|
|
136982
|
+
display: 'block',
|
|
136983
|
+
lineHeight: '1.2',
|
|
136984
|
+
minHeight: '14px'
|
|
136985
|
+
}
|
|
136986
|
+
}, maskedUsername, ' ', /*#__PURE__*/React__default.createElement("span", {
|
|
136987
|
+
style: {
|
|
136988
|
+
background: 'linear-gradient(90deg, #90F926 0%, #FFD61E 100%)',
|
|
136989
|
+
WebkitBackgroundClip: 'text',
|
|
136990
|
+
WebkitTextFillColor: 'transparent',
|
|
136991
|
+
backgroundClip: 'text',
|
|
136992
|
+
fontWeight: 'normal'
|
|
136993
|
+
}
|
|
136994
|
+
}, "Lv", level));
|
|
136995
|
+
}
|
|
136996
|
+
return null;
|
|
136997
|
+
}(), /*#__PURE__*/React__default.createElement("div", {
|
|
136847
136998
|
style: {
|
|
136848
136999
|
background: isMySelf ? "var(--im-msg-bubble-color-right)" : "var(--im-msg-bubble-color-left)",
|
|
136849
137000
|
borderRadius: "9px",
|
|
@@ -136892,8 +137043,14 @@ var HighlyCustomChat = function HighlyCustomChat(props) {
|
|
|
136892
137043
|
}, formatMessageTime(msg.time)));
|
|
136893
137044
|
};
|
|
136894
137045
|
var _renderMessage = function renderMessage(msg) {
|
|
136895
|
-
var _msg$
|
|
136896
|
-
var isMySelf = (msg === null || msg === void 0 ? void 0 : msg.bySelf) === true || (msg === null || msg === void 0 || (_msg$
|
|
137046
|
+
var _msg$from4, _userInfo$uid4, _context3;
|
|
137047
|
+
var isMySelf = (msg === null || msg === void 0 ? void 0 : msg.bySelf) === true || (msg === null || msg === void 0 || (_msg$from4 = msg.from) === null || _msg$from4 === void 0 ? void 0 : _msg$from4.toLowerCase()) === ((_userInfo$uid4 = userInfo.uid) === null || _userInfo$uid4 === void 0 ? void 0 : _userInfo$uid4.toLowerCase());
|
|
137048
|
+
// 获取发送者信息并格式化昵称+level
|
|
137049
|
+
var senderInfo = getSenderInfo(msg);
|
|
137050
|
+
var displayUsername = (senderInfo === null || senderInfo === void 0 ? void 0 : senderInfo.username) || (senderInfo === null || senderInfo === void 0 ? void 0 : senderInfo.uid) || '';
|
|
137051
|
+
var maskedUsername = displayUsername ? maskUsername(displayUsername) : '';
|
|
137052
|
+
var level = getUserLevel(senderInfo);
|
|
137053
|
+
var nickNameWithLevel = maskedUsername ? _concatInstanceProperty(_context3 = "".concat(maskedUsername, " Lv")).call(_context3, level) : undefined;
|
|
136897
137054
|
if (msg.type === "txt") {
|
|
136898
137055
|
return renderTxtMsg(msg, props.onApply);
|
|
136899
137056
|
} else if (msg.type === "img") {
|
|
@@ -136904,6 +137061,7 @@ var HighlyCustomChat = function HighlyCustomChat(props) {
|
|
|
136904
137061
|
renderUserProfile: function renderUserProfile() {
|
|
136905
137062
|
return null;
|
|
136906
137063
|
},
|
|
137064
|
+
nickName: nickNameWithLevel,
|
|
136907
137065
|
customAction: {
|
|
136908
137066
|
visible: false,
|
|
136909
137067
|
icon: null,
|
|
@@ -136925,6 +137083,7 @@ var HighlyCustomChat = function HighlyCustomChat(props) {
|
|
|
136925
137083
|
renderUserProfile: function renderUserProfile() {
|
|
136926
137084
|
return null;
|
|
136927
137085
|
},
|
|
137086
|
+
nickName: nickNameWithLevel,
|
|
136928
137087
|
customAction: {
|
|
136929
137088
|
visible: false,
|
|
136930
137089
|
icon: null,
|
|
@@ -136940,6 +137099,7 @@ var HighlyCustomChat = function HighlyCustomChat(props) {
|
|
|
136940
137099
|
renderUserProfile: function renderUserProfile() {
|
|
136941
137100
|
return null;
|
|
136942
137101
|
},
|
|
137102
|
+
nickName: nickNameWithLevel,
|
|
136943
137103
|
customAction: {
|
|
136944
137104
|
visible: false,
|
|
136945
137105
|
icon: null,
|
|
@@ -137036,8 +137196,8 @@ var HighlyCustomChat = function HighlyCustomChat(props) {
|
|
|
137036
137196
|
};
|
|
137037
137197
|
// 使用 useCallback 包装 getHeaderInfo 函数
|
|
137038
137198
|
var getHeaderInfo = useCallback(function () {
|
|
137039
|
-
var
|
|
137040
|
-
var cvs = _findInstanceProperty(
|
|
137199
|
+
var _context4;
|
|
137200
|
+
var cvs = _findInstanceProperty(_context4 = Ut.conversationStore.conversationList).call(_context4, function (cvs) {
|
|
137041
137201
|
return cvs.conversationId === props.conversationId;
|
|
137042
137202
|
});
|
|
137043
137203
|
if (!cvs || !(cvs !== null && cvs !== void 0 && cvs.conversationId)) {
|
|
@@ -137054,18 +137214,18 @@ var HighlyCustomChat = function HighlyCustomChat(props) {
|
|
|
137054
137214
|
var fetchGroupInfo = /*#__PURE__*/function () {
|
|
137055
137215
|
var _ref4 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
137056
137216
|
var _cvs$conversationId, response, data, groupInfo, _groupInfo$headimgurl, _groupInfo$members, _ref5, _groupInfo$name, imageurl, member, name;
|
|
137057
|
-
return _regeneratorRuntime.wrap(function _callee$(
|
|
137058
|
-
while (1) switch (
|
|
137217
|
+
return _regeneratorRuntime.wrap(function _callee$(_context5) {
|
|
137218
|
+
while (1) switch (_context5.prev = _context5.next) {
|
|
137059
137219
|
case 0:
|
|
137060
137220
|
//需要请求群信息
|
|
137061
137221
|
console.log('the group info fetched');
|
|
137062
|
-
|
|
137063
|
-
|
|
137222
|
+
_context5.prev = 1;
|
|
137223
|
+
_context5.next = 4;
|
|
137064
137224
|
return http.post("/capi/account/imchannel/getdetails", {
|
|
137065
137225
|
sendbirdid: (_cvs$conversationId = cvs.conversationId) !== null && _cvs$conversationId !== void 0 ? _cvs$conversationId : ''
|
|
137066
137226
|
});
|
|
137067
137227
|
case 4:
|
|
137068
|
-
response =
|
|
137228
|
+
response = _context5.sent;
|
|
137069
137229
|
data = response.data;
|
|
137070
137230
|
if (data && data.code === 200) {
|
|
137071
137231
|
groupInfo = data === null || data === void 0 ? void 0 : data.data;
|
|
@@ -137082,14 +137242,14 @@ var HighlyCustomChat = function HighlyCustomChat(props) {
|
|
|
137082
137242
|
});
|
|
137083
137243
|
}
|
|
137084
137244
|
}
|
|
137085
|
-
|
|
137245
|
+
_context5.next = 11;
|
|
137086
137246
|
break;
|
|
137087
137247
|
case 9:
|
|
137088
|
-
|
|
137089
|
-
|
|
137248
|
+
_context5.prev = 9;
|
|
137249
|
+
_context5.t0 = _context5["catch"](1);
|
|
137090
137250
|
case 11:
|
|
137091
137251
|
case "end":
|
|
137092
|
-
return
|
|
137252
|
+
return _context5.stop();
|
|
137093
137253
|
}
|
|
137094
137254
|
}, _callee, null, [[1, 9]]);
|
|
137095
137255
|
}));
|
|
@@ -137103,8 +137263,8 @@ var HighlyCustomChat = function HighlyCustomChat(props) {
|
|
|
137103
137263
|
var _ref6 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee2(group) {
|
|
137104
137264
|
var _group$info;
|
|
137105
137265
|
var _group$info2, _customObj$headimgurl, _group$info$affiliati, _group$info3, _ref7, _ref8, _group$name, _group$info4, customObj, imageurl, member, name;
|
|
137106
|
-
return _regeneratorRuntime.wrap(function _callee2$(
|
|
137107
|
-
while (1) switch (
|
|
137266
|
+
return _regeneratorRuntime.wrap(function _callee2$(_context6) {
|
|
137267
|
+
while (1) switch (_context6.prev = _context6.next) {
|
|
137108
137268
|
case 0:
|
|
137109
137269
|
// @ts-ignore
|
|
137110
137270
|
if (cvs.conversationId == (group === null || group === void 0 ? void 0 : group.groupid) && group !== null && group !== void 0 && (_group$info = group.info) !== null && _group$info !== void 0 && _group$info.custom) {
|
|
@@ -137128,7 +137288,7 @@ var HighlyCustomChat = function HighlyCustomChat(props) {
|
|
|
137128
137288
|
}
|
|
137129
137289
|
case 1:
|
|
137130
137290
|
case "end":
|
|
137131
|
-
return
|
|
137291
|
+
return _context6.stop();
|
|
137132
137292
|
}
|
|
137133
137293
|
}, _callee2);
|
|
137134
137294
|
}));
|
|
@@ -137251,16 +137411,16 @@ var HighlyCustomChat = function HighlyCustomChat(props) {
|
|
|
137251
137411
|
var handleSendMessage = /*#__PURE__*/function () {
|
|
137252
137412
|
var _ref9 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee3(text, extInfo) {
|
|
137253
137413
|
var txtMessage, cuiScrollList, cuiScrollListWrap, htmlString, template, node;
|
|
137254
|
-
return _regeneratorRuntime.wrap(function _callee3$(
|
|
137255
|
-
while (1) switch (
|
|
137414
|
+
return _regeneratorRuntime.wrap(function _callee3$(_context7) {
|
|
137415
|
+
while (1) switch (_context7.prev = _context7.next) {
|
|
137256
137416
|
case 0:
|
|
137257
137417
|
if (_trimInstanceProperty(text).call(text)) {
|
|
137258
|
-
|
|
137418
|
+
_context7.next = 2;
|
|
137259
137419
|
break;
|
|
137260
137420
|
}
|
|
137261
|
-
return
|
|
137421
|
+
return _context7.abrupt("return");
|
|
137262
137422
|
case 2:
|
|
137263
|
-
|
|
137423
|
+
_context7.prev = 2;
|
|
137264
137424
|
// 普通文本消息
|
|
137265
137425
|
txtMessage = MessageSDK.message.create({
|
|
137266
137426
|
type: "txt",
|
|
@@ -137268,7 +137428,7 @@ var HighlyCustomChat = function HighlyCustomChat(props) {
|
|
|
137268
137428
|
to: props.conversationId,
|
|
137269
137429
|
chatType: headerInfo.chatType
|
|
137270
137430
|
});
|
|
137271
|
-
|
|
137431
|
+
_context7.next = 6;
|
|
137272
137432
|
return Ut.messageStore.sendMessage(txtMessage);
|
|
137273
137433
|
case 6:
|
|
137274
137434
|
afterSendMsg(txtMessage, extInfo);
|
|
@@ -137288,15 +137448,15 @@ var HighlyCustomChat = function HighlyCustomChat(props) {
|
|
|
137288
137448
|
}
|
|
137289
137449
|
}
|
|
137290
137450
|
}
|
|
137291
|
-
|
|
137451
|
+
_context7.next = 13;
|
|
137292
137452
|
break;
|
|
137293
137453
|
case 10:
|
|
137294
|
-
|
|
137295
|
-
|
|
137296
|
-
console.log("send txt message failed",
|
|
137454
|
+
_context7.prev = 10;
|
|
137455
|
+
_context7.t0 = _context7["catch"](2);
|
|
137456
|
+
console.log("send txt message failed", _context7.t0);
|
|
137297
137457
|
case 13:
|
|
137298
137458
|
case "end":
|
|
137299
|
-
return
|
|
137459
|
+
return _context7.stop();
|
|
137300
137460
|
}
|
|
137301
137461
|
}, _callee3, null, [[2, 10]]);
|
|
137302
137462
|
}));
|
|
@@ -137306,13 +137466,13 @@ var HighlyCustomChat = function HighlyCustomChat(props) {
|
|
|
137306
137466
|
}();
|
|
137307
137467
|
var afterSendMsg = /*#__PURE__*/function () {
|
|
137308
137468
|
var _ref10 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee4(msgInfo, extInfo) {
|
|
137309
|
-
return _regeneratorRuntime.wrap(function _callee4$(
|
|
137310
|
-
while (1) switch (
|
|
137469
|
+
return _regeneratorRuntime.wrap(function _callee4$(_context8) {
|
|
137470
|
+
while (1) switch (_context8.prev = _context8.next) {
|
|
137311
137471
|
case 0:
|
|
137312
137472
|
props.sendMessageSuccessCallback && props.sendMessageSuccessCallback(msgInfo, extInfo);
|
|
137313
137473
|
case 1:
|
|
137314
137474
|
case "end":
|
|
137315
|
-
return
|
|
137475
|
+
return _context8.stop();
|
|
137316
137476
|
}
|
|
137317
137477
|
}, _callee4);
|
|
137318
137478
|
}));
|