whyuzeim 1.1.46 → 1.1.48
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.
|
@@ -7,12 +7,15 @@ var React = require('react');
|
|
|
7
7
|
|
|
8
8
|
/* eslint-disable @typescript-eslint/no-unused-expressions */
|
|
9
9
|
var CodeMsg = function CodeMsg(props) {
|
|
10
|
-
var _msg$customExts;
|
|
10
|
+
var _msg$customExts, _msg$customExts2;
|
|
11
11
|
var msg = props.msg,
|
|
12
12
|
isMySelf = props.isMySelf,
|
|
13
13
|
avatar = props.avatar,
|
|
14
14
|
onApply = props.onApply;
|
|
15
|
-
|
|
15
|
+
if (!((_msg$customExts = msg.customExts) !== null && _msg$customExts !== void 0 && _msg$customExts.code)) {
|
|
16
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null);
|
|
17
|
+
}
|
|
18
|
+
var rawCode = (_msg$customExts2 = msg.customExts) === null || _msg$customExts2 === void 0 || (_msg$customExts2 = _msg$customExts2.code) === null || _msg$customExts2 === void 0 || (_msg$customExts2 = _msg$customExts2.replace(/\\n/g, "\n")) === null || _msg$customExts2 === void 0 || (_msg$customExts2 = _msg$customExts2.replace(/\\"/g, '"')) === null || _msg$customExts2 === void 0 ? void 0 : _msg$customExts2.replace(/\\\\/g, "\\");
|
|
16
19
|
// 修改高亮代码的函数
|
|
17
20
|
return /*#__PURE__*/React.createElement(agoraChatUikit.BaseMessage, {
|
|
18
21
|
bubbleType: "none",
|
|
@@ -71,8 +71,8 @@ var HighlyCustomChat = function HighlyCustomChat(props) {
|
|
|
71
71
|
isAgent = _useState8[0],
|
|
72
72
|
setIsAgent = _useState8[1];
|
|
73
73
|
var renderTxtMsg = function renderTxtMsg(msg) {
|
|
74
|
-
var _userInfo$uid;
|
|
75
|
-
var isMySelf = (msg === null || msg === void 0 ? void 0 : msg.bySelf) === true || (msg === null || msg === void 0 ? void 0 :
|
|
74
|
+
var _msg$from, _userInfo$uid;
|
|
75
|
+
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());
|
|
76
76
|
return /*#__PURE__*/React.createElement(agoraChatUikit.BaseMessage, {
|
|
77
77
|
bubbleType: "none",
|
|
78
78
|
reaction: false,
|
|
@@ -98,7 +98,7 @@ var HighlyCustomChat = function HighlyCustomChat(props) {
|
|
|
98
98
|
});
|
|
99
99
|
};
|
|
100
100
|
var renderLongTextMsg = function renderLongTextMsg(msg) {
|
|
101
|
-
var _userInfo$uid2;
|
|
101
|
+
var _msg$from2, _userInfo$uid2;
|
|
102
102
|
// 格式化消息时间
|
|
103
103
|
var formatMessageTime = function formatMessageTime(timestamp) {
|
|
104
104
|
if (!timestamp) return "";
|
|
@@ -124,7 +124,7 @@ var HighlyCustomChat = function HighlyCustomChat(props) {
|
|
|
124
124
|
});
|
|
125
125
|
}
|
|
126
126
|
};
|
|
127
|
-
var isMySelf = (msg === null || msg === void 0 ? void 0 : msg.bySelf) === true || (msg === null || msg === void 0 ? void 0 :
|
|
127
|
+
var isMySelf = (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());
|
|
128
128
|
return /*#__PURE__*/React.createElement("div", {
|
|
129
129
|
className: "text-[var(--im-main-fontColor)] flex flex-col gap-1 ".concat(isMySelf ? "items-end" : "items-start")
|
|
130
130
|
}, /*#__PURE__*/React.createElement("div", {
|
|
@@ -142,8 +142,8 @@ var HighlyCustomChat = function HighlyCustomChat(props) {
|
|
|
142
142
|
}, formatMessageTime(msg.time)));
|
|
143
143
|
};
|
|
144
144
|
var _renderMessage = function renderMessage(msg) {
|
|
145
|
-
var _userInfo$uid3;
|
|
146
|
-
var isMySelf = (msg === null || msg === void 0 ? void 0 : msg.bySelf) === true || (msg === null || msg === void 0 ? void 0 :
|
|
145
|
+
var _msg$from3, _userInfo$uid3;
|
|
146
|
+
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());
|
|
147
147
|
if (msg.type === "txt") {
|
|
148
148
|
return renderTxtMsg(msg);
|
|
149
149
|
} else if (msg.type === "img") {
|
|
@@ -5,12 +5,15 @@ import React from 'react';
|
|
|
5
5
|
|
|
6
6
|
/* eslint-disable @typescript-eslint/no-unused-expressions */
|
|
7
7
|
var CodeMsg = function CodeMsg(props) {
|
|
8
|
-
var _msg$customExts;
|
|
8
|
+
var _msg$customExts, _msg$customExts2;
|
|
9
9
|
var msg = props.msg,
|
|
10
10
|
isMySelf = props.isMySelf,
|
|
11
11
|
avatar = props.avatar,
|
|
12
12
|
onApply = props.onApply;
|
|
13
|
-
|
|
13
|
+
if (!((_msg$customExts = msg.customExts) !== null && _msg$customExts !== void 0 && _msg$customExts.code)) {
|
|
14
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null);
|
|
15
|
+
}
|
|
16
|
+
var rawCode = (_msg$customExts2 = msg.customExts) === null || _msg$customExts2 === void 0 || (_msg$customExts2 = _msg$customExts2.code) === null || _msg$customExts2 === void 0 || (_msg$customExts2 = _msg$customExts2.replace(/\\n/g, "\n")) === null || _msg$customExts2 === void 0 || (_msg$customExts2 = _msg$customExts2.replace(/\\"/g, '"')) === null || _msg$customExts2 === void 0 ? void 0 : _msg$customExts2.replace(/\\\\/g, "\\");
|
|
14
17
|
// 修改高亮代码的函数
|
|
15
18
|
return /*#__PURE__*/React.createElement(BaseMessage, {
|
|
16
19
|
bubbleType: "none",
|
|
@@ -69,8 +69,8 @@ var HighlyCustomChat = function HighlyCustomChat(props) {
|
|
|
69
69
|
isAgent = _useState8[0],
|
|
70
70
|
setIsAgent = _useState8[1];
|
|
71
71
|
var renderTxtMsg = function renderTxtMsg(msg) {
|
|
72
|
-
var _userInfo$uid;
|
|
73
|
-
var isMySelf = (msg === null || msg === void 0 ? void 0 : msg.bySelf) === true || (msg === null || msg === void 0 ? void 0 :
|
|
72
|
+
var _msg$from, _userInfo$uid;
|
|
73
|
+
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());
|
|
74
74
|
return /*#__PURE__*/React.createElement(BaseMessage, {
|
|
75
75
|
bubbleType: "none",
|
|
76
76
|
reaction: false,
|
|
@@ -96,7 +96,7 @@ var HighlyCustomChat = function HighlyCustomChat(props) {
|
|
|
96
96
|
});
|
|
97
97
|
};
|
|
98
98
|
var renderLongTextMsg = function renderLongTextMsg(msg) {
|
|
99
|
-
var _userInfo$uid2;
|
|
99
|
+
var _msg$from2, _userInfo$uid2;
|
|
100
100
|
// 格式化消息时间
|
|
101
101
|
var formatMessageTime = function formatMessageTime(timestamp) {
|
|
102
102
|
if (!timestamp) return "";
|
|
@@ -122,7 +122,7 @@ var HighlyCustomChat = function HighlyCustomChat(props) {
|
|
|
122
122
|
});
|
|
123
123
|
}
|
|
124
124
|
};
|
|
125
|
-
var isMySelf = (msg === null || msg === void 0 ? void 0 : msg.bySelf) === true || (msg === null || msg === void 0 ? void 0 :
|
|
125
|
+
var isMySelf = (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());
|
|
126
126
|
return /*#__PURE__*/React.createElement("div", {
|
|
127
127
|
className: "text-[var(--im-main-fontColor)] flex flex-col gap-1 ".concat(isMySelf ? "items-end" : "items-start")
|
|
128
128
|
}, /*#__PURE__*/React.createElement("div", {
|
|
@@ -140,8 +140,8 @@ var HighlyCustomChat = function HighlyCustomChat(props) {
|
|
|
140
140
|
}, formatMessageTime(msg.time)));
|
|
141
141
|
};
|
|
142
142
|
var _renderMessage = function renderMessage(msg) {
|
|
143
|
-
var _userInfo$uid3;
|
|
144
|
-
var isMySelf = (msg === null || msg === void 0 ? void 0 : msg.bySelf) === true || (msg === null || msg === void 0 ? void 0 :
|
|
143
|
+
var _msg$from3, _userInfo$uid3;
|
|
144
|
+
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());
|
|
145
145
|
if (msg.type === "txt") {
|
|
146
146
|
return renderTxtMsg(msg);
|
|
147
147
|
} else if (msg.type === "img") {
|