whyuzeim 1.0.13 → 1.0.15
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/ChatBox/index.d.ts +1 -1
- package/cjs/ChatBox/index.js +42 -60
- package/cjs/CustomChatView/index.js +88 -20
- package/cjs/IM/index.js +2 -1
- package/cjs/Sidebar/CustomConversationItem/index.js +13 -16
- package/cjs/Sidebar/index.js +1 -0
- package/cjs/UserProfile/index.js +19 -29
- package/es/ChatBox/index.d.ts +1 -1
- package/es/ChatBox/index.js +43 -61
- package/es/CustomChatView/index.js +89 -21
- package/es/IM/index.js +2 -1
- package/es/Sidebar/CustomConversationItem/index.js +14 -17
- package/es/Sidebar/index.js +1 -0
- package/es/UserProfile/index.js +20 -30
- package/package.json +1 -1
package/cjs/ChatBox/index.d.ts
CHANGED
package/cjs/ChatBox/index.js
CHANGED
|
@@ -28,6 +28,7 @@ function ownKeys(e, r) { var t = _Object$keys(e); if (_Object$getOwnPropertySymb
|
|
|
28
28
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var _context7, _context8; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty(_context7 = ownKeys(Object(t), true)).call(_context7, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(e, _Object$getOwnPropertyDescriptors(t)) : _forEachInstanceProperty(_context8 = ownKeys(Object(t))).call(_context8, function (r) { _Object$defineProperty(e, r, _Object$getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
29
29
|
var Chatbox = function Chatbox(props) {
|
|
30
30
|
var _userInfo$uid3;
|
|
31
|
+
var client = agoraChatUikit.useClient();
|
|
31
32
|
var _useContext = React.useContext(context.Context),
|
|
32
33
|
http = _useContext.http,
|
|
33
34
|
setRightComponent = _useContext.setRightComponent,
|
|
@@ -52,10 +53,10 @@ var Chatbox = function Chatbox(props) {
|
|
|
52
53
|
modal = _Modal$useModal2[0],
|
|
53
54
|
contextHolder = _Modal$useModal2[1];
|
|
54
55
|
var _useState7 = React.useState({
|
|
55
|
-
headerImageURL:
|
|
56
|
-
conversationName:
|
|
56
|
+
headerImageURL: "",
|
|
57
|
+
conversationName: "",
|
|
57
58
|
memberCount: 0,
|
|
58
|
-
chatType:
|
|
59
|
+
chatType: "singleChat"
|
|
59
60
|
}),
|
|
60
61
|
_useState8 = _slicedToArray(_useState7, 2),
|
|
61
62
|
headerInfo = _useState8[0],
|
|
@@ -106,7 +107,7 @@ var Chatbox = function Chatbox(props) {
|
|
|
106
107
|
var renderMessage = function renderMessage(msg) {
|
|
107
108
|
if (msg.type === "txt") {
|
|
108
109
|
return renderTxtMsg(msg);
|
|
109
|
-
} else if (msg.type ===
|
|
110
|
+
} else if (msg.type === "img") {
|
|
110
111
|
var _ref2;
|
|
111
112
|
return /*#__PURE__*/React.createElement(agoraChatUikit.ImageMessage, {
|
|
112
113
|
reaction: false,
|
|
@@ -118,7 +119,7 @@ var Chatbox = function Chatbox(props) {
|
|
|
118
119
|
},
|
|
119
120
|
imageMessage: msg
|
|
120
121
|
});
|
|
121
|
-
} else if (msg.type ===
|
|
122
|
+
} else if (msg.type === "file") {
|
|
122
123
|
var _ref3;
|
|
123
124
|
return /*#__PURE__*/React.createElement(agoraChatUikit.FileMessage, {
|
|
124
125
|
reaction: false,
|
|
@@ -136,7 +137,7 @@ var Chatbox = function Chatbox(props) {
|
|
|
136
137
|
customAction: (_ref3 = type.commonMessageProps && (type.commonMessageProps === null || type.commonMessageProps === void 0 ? void 0 : type.commonMessageProps.customAction)) !== null && _ref3 !== void 0 ? _ref3 : undefined,
|
|
137
138
|
fileMessage: msg
|
|
138
139
|
});
|
|
139
|
-
} else if (msg.type ===
|
|
140
|
+
} else if (msg.type === "video") {
|
|
140
141
|
var _ref4;
|
|
141
142
|
return /*#__PURE__*/React.createElement(agoraChatUikit.VideoMessage, {
|
|
142
143
|
reaction: false,
|
|
@@ -148,7 +149,7 @@ var Chatbox = function Chatbox(props) {
|
|
|
148
149
|
customAction: (_ref4 = type.commonMessageProps && (type.commonMessageProps === null || type.commonMessageProps === void 0 ? void 0 : type.commonMessageProps.customAction)) !== null && _ref4 !== void 0 ? _ref4 : undefined,
|
|
149
150
|
videoMessage: msg
|
|
150
151
|
});
|
|
151
|
-
} else if (msg.type ===
|
|
152
|
+
} else if (msg.type === "audio") {
|
|
152
153
|
var _ref5;
|
|
153
154
|
return /*#__PURE__*/React.createElement(agoraChatUikit.AudioMessage, {
|
|
154
155
|
reaction: false,
|
|
@@ -157,7 +158,7 @@ var Chatbox = function Chatbox(props) {
|
|
|
157
158
|
customAction: (_ref5 = type.commonMessageProps && (type.commonMessageProps === null || type.commonMessageProps === void 0 ? void 0 : type.commonMessageProps.customAction)) !== null && _ref5 !== void 0 ? _ref5 : undefined,
|
|
158
159
|
audioMessage: msg
|
|
159
160
|
});
|
|
160
|
-
} else if (msg.type ===
|
|
161
|
+
} else if (msg.type === "custom" && ((msg === null || msg === void 0 ? void 0 : msg.customEvent) === "im_group_share" || (msg === null || msg === void 0 ? void 0 : msg.customEvent) === "personcenter_share")) {
|
|
161
162
|
var _userInfo$uid2, _ref6;
|
|
162
163
|
var isMySelf = (msg === null || msg === void 0 ? void 0 : msg.bySelf) === true || (msg === null || msg === void 0 ? void 0 : msg.from.toLowerCase()) === (userInfo === null || userInfo === void 0 || (_userInfo$uid2 = userInfo.uid) === null || _userInfo$uid2 === void 0 ? void 0 : _userInfo$uid2.toLowerCase());
|
|
163
164
|
return /*#__PURE__*/React.createElement(agoraChatUikit.BaseMessage, {
|
|
@@ -170,7 +171,7 @@ var Chatbox = function Chatbox(props) {
|
|
|
170
171
|
reaction: false,
|
|
171
172
|
select: false,
|
|
172
173
|
thread: false,
|
|
173
|
-
direction: isMySelf ?
|
|
174
|
+
direction: isMySelf ? "rtl" : "ltr",
|
|
174
175
|
renderUserProfile: function renderUserProfile() {
|
|
175
176
|
return null;
|
|
176
177
|
},
|
|
@@ -190,7 +191,7 @@ var Chatbox = function Chatbox(props) {
|
|
|
190
191
|
return modal.confirm({
|
|
191
192
|
content: /*#__PURE__*/React.createElement("span", {
|
|
192
193
|
className: "text-sm "
|
|
193
|
-
}, "Are you sure you want to delete and leave the group ", headerInfo.conversationName, " ?"),
|
|
194
|
+
}, "Are you sure you want to delete and leave the group", " ", headerInfo.conversationName, " ?"),
|
|
194
195
|
footer: /*#__PURE__*/React.createElement("div", {
|
|
195
196
|
className: "yuze-confirm-footer flex justify-center gap-5 mt-4"
|
|
196
197
|
}, /*#__PURE__*/React.createElement(antd.Button, {
|
|
@@ -231,7 +232,7 @@ var Chatbox = function Chatbox(props) {
|
|
|
231
232
|
sendbirdid: groupid
|
|
232
233
|
};
|
|
233
234
|
_context2.next = 4;
|
|
234
|
-
return http.post(
|
|
235
|
+
return http.post("/capi/account/imchannel/exitchannel", params);
|
|
235
236
|
case 4:
|
|
236
237
|
response = _context2.sent;
|
|
237
238
|
_response$data = response.data, code = _response$data.code, msg = _response$data.msg;
|
|
@@ -266,7 +267,7 @@ var Chatbox = function Chatbox(props) {
|
|
|
266
267
|
var customHeader = function customHeader() {
|
|
267
268
|
var menuNode = /*#__PURE__*/React.createElement("ul", {
|
|
268
269
|
className: "cui-header-more"
|
|
269
|
-
}, agoraChatUikit.rootStore.conversationStore.currentCvs.chatType ===
|
|
270
|
+
}, agoraChatUikit.rootStore.conversationStore.currentCvs.chatType === "groupChat" && /*#__PURE__*/React.createElement("li", {
|
|
270
271
|
className: "cui-li-dark",
|
|
271
272
|
onClick: function onClick() {
|
|
272
273
|
setRightComponent && setRightComponent(/*#__PURE__*/React.createElement(index$1, null));
|
|
@@ -297,7 +298,7 @@ var Chatbox = function Chatbox(props) {
|
|
|
297
298
|
});
|
|
298
299
|
setMidComponent && setMidComponent(undefined);
|
|
299
300
|
}
|
|
300
|
-
}, "Delete Chat"), agoraChatUikit.rootStore.conversationStore.currentCvs.chatType ===
|
|
301
|
+
}, "Delete Chat"), agoraChatUikit.rootStore.conversationStore.currentCvs.chatType === "groupChat" && /*#__PURE__*/React.createElement("li", {
|
|
301
302
|
className: "cui-li-dark",
|
|
302
303
|
onClick: function onClick() {
|
|
303
304
|
setIsTopMenuOpen(false);
|
|
@@ -310,7 +311,7 @@ var Chatbox = function Chatbox(props) {
|
|
|
310
311
|
onClick: function onClick() {
|
|
311
312
|
return props.onClickHeaderBack({
|
|
312
313
|
conversationId: agoraChatUikit.rootStore.conversationStore.currentCvs.conversationId,
|
|
313
|
-
chatType: agoraChatUikit.rootStore.conversationStore.currentCvs.chatType ===
|
|
314
|
+
chatType: agoraChatUikit.rootStore.conversationStore.currentCvs.chatType === "groupChat" ? "groupChat" : "singleChat"
|
|
314
315
|
});
|
|
315
316
|
},
|
|
316
317
|
className: "flex items-center gap-2"
|
|
@@ -325,14 +326,14 @@ var Chatbox = function Chatbox(props) {
|
|
|
325
326
|
}
|
|
326
327
|
}), !mobile && /*#__PURE__*/React.createElement("img", {
|
|
327
328
|
src: headerInfo.headerImageURL,
|
|
328
|
-
className: "w-12 h-12 ".concat(headerInfo.chatType ===
|
|
329
|
+
className: "w-12 h-12 ".concat(headerInfo.chatType === "groupChat" ? "rounded-md" : "rounded-full", " bg-blue")
|
|
329
330
|
}), !mobile && /*#__PURE__*/React.createElement("div", {
|
|
330
331
|
className: "flex flex-col overflow-hidden mx-5 flex-1"
|
|
331
332
|
}, /*#__PURE__*/React.createElement("p", {
|
|
332
333
|
className: "text-[var(--im-main-fontColor)] text-base font-normal line-clamp-1 mr-[100px]"
|
|
333
|
-
}, headerInfo.conversationName), headerInfo.chatType ===
|
|
334
|
+
}, headerInfo.conversationName), headerInfo.chatType === "groupChat" && /*#__PURE__*/React.createElement("p", {
|
|
334
335
|
style: {
|
|
335
|
-
color:
|
|
336
|
+
color: "var(--im-third-fontColor)"
|
|
336
337
|
},
|
|
337
338
|
className: "text-sm"
|
|
338
339
|
}, headerInfo.memberCount, " members"))), mobile && /*#__PURE__*/React.createElement("div", {
|
|
@@ -340,10 +341,10 @@ var Chatbox = function Chatbox(props) {
|
|
|
340
341
|
onClick: function onClick() {
|
|
341
342
|
return props.onClickHeaderBack({
|
|
342
343
|
conversationId: agoraChatUikit.rootStore.conversationStore.currentCvs.conversationId,
|
|
343
|
-
chatType: agoraChatUikit.rootStore.conversationStore.currentCvs.chatType ===
|
|
344
|
+
chatType: agoraChatUikit.rootStore.conversationStore.currentCvs.chatType === "groupChat" ? "groupChat" : "singleChat"
|
|
344
345
|
});
|
|
345
346
|
}
|
|
346
|
-
}, /*#__PURE__*/React.createElement("span", null, headerInfo.conversationName, headerInfo.chatType ===
|
|
347
|
+
}, /*#__PURE__*/React.createElement("span", null, headerInfo.conversationName, headerInfo.chatType === "groupChat" ? "(".concat(headerInfo.memberCount, ")") : "")), /*#__PURE__*/React.createElement(agoraChatUikit.Tooltip, {
|
|
347
348
|
title: menuNode,
|
|
348
349
|
trigger: "click",
|
|
349
350
|
placement: "bottom",
|
|
@@ -375,9 +376,9 @@ var Chatbox = function Chatbox(props) {
|
|
|
375
376
|
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) {
|
|
376
377
|
var _group$info2, _customObj$headimgurl, _group$info$affiliati, _group$info3, _ref9, _ref10, _group$name, _group$info4;
|
|
377
378
|
var customObj = JSON.parse(group === null || group === void 0 || (_group$info2 = group.info) === null || _group$info2 === void 0 ? void 0 : _group$info2.custom);
|
|
378
|
-
var imageurl = (_customObj$headimgurl = customObj === null || customObj === void 0 ? void 0 : customObj.headimgurl) !== null && _customObj$headimgurl !== void 0 ? _customObj$headimgurl :
|
|
379
|
+
var imageurl = (_customObj$headimgurl = customObj === null || customObj === void 0 ? void 0 : customObj.headimgurl) !== null && _customObj$headimgurl !== void 0 ? _customObj$headimgurl : "";
|
|
379
380
|
var member = (_group$info$affiliati = group === null || group === void 0 || (_group$info3 = group.info) === null || _group$info3 === void 0 ? void 0 : _group$info3.affiliations_count) !== null && _group$info$affiliati !== void 0 ? _group$info$affiliati : 0;
|
|
380
|
-
var name = (_ref9 = (_ref10 = (_group$name = group === null || group === void 0 ? void 0 : group.name) !== null && _group$name !== void 0 ? _group$name : group === null || group === void 0 || (_group$info4 = group.info) === null || _group$info4 === void 0 ? void 0 : _group$info4.name) !== null && _ref10 !== void 0 ? _ref10 : cvs.name) !== null && _ref9 !== void 0 ? _ref9 :
|
|
381
|
+
var name = (_ref9 = (_ref10 = (_group$name = group === null || group === void 0 ? void 0 : group.name) !== null && _group$name !== void 0 ? _group$name : group === null || group === void 0 || (_group$info4 = group.info) === null || _group$info4 === void 0 ? void 0 : _group$info4.name) !== null && _ref10 !== void 0 ? _ref10 : cvs.name) !== null && _ref9 !== void 0 ? _ref9 : "";
|
|
381
382
|
setHeaderInfo(function (prevState) {
|
|
382
383
|
return _objectSpread(_objectSpread({}, prevState), {}, {
|
|
383
384
|
headerImageURL: imageurl,
|
|
@@ -391,33 +392,14 @@ var Chatbox = function Chatbox(props) {
|
|
|
391
392
|
}
|
|
392
393
|
});
|
|
393
394
|
} else {
|
|
394
|
-
|
|
395
|
-
if (!appUsersInfo) {
|
|
396
|
-
agoraChatUikit.rootStore.addressStore.getUserInfo(cvs.conversationId);
|
|
397
|
-
agoraChatUikit.rootStore.addressStore.getUserInfo(cvs.conversationId).then(function (value) {
|
|
398
|
-
if (value) {
|
|
399
|
-
var _value$avatarurl, _value$name;
|
|
400
|
-
var imageurl = (_value$avatarurl = value === null || value === void 0 ? void 0 : value.avatarurl) !== null && _value$avatarurl !== void 0 ? _value$avatarurl : '';
|
|
401
|
-
var name = (_value$name = value === null || value === void 0 ? void 0 : value.name) !== null && _value$name !== void 0 ? _value$name : cvs.name;
|
|
402
|
-
setHeaderInfo(function (prevState) {
|
|
403
|
-
return _objectSpread(_objectSpread({}, prevState), {}, {
|
|
404
|
-
headerImageURL: imageurl,
|
|
405
|
-
conversationName: name
|
|
406
|
-
});
|
|
407
|
-
});
|
|
408
|
-
}
|
|
409
|
-
});
|
|
410
|
-
} else {
|
|
411
|
-
var _appUsersInfo$avataru, _ref11, _appUsersInfo$name;
|
|
412
|
-
var imageurl = (_appUsersInfo$avataru = appUsersInfo === null || appUsersInfo === void 0 ? void 0 : appUsersInfo.avatarurl) !== null && _appUsersInfo$avataru !== void 0 ? _appUsersInfo$avataru : '';
|
|
413
|
-
var name = (_ref11 = (_appUsersInfo$name = appUsersInfo === null || appUsersInfo === void 0 ? void 0 : appUsersInfo.name) !== null && _appUsersInfo$name !== void 0 ? _appUsersInfo$name : cvs.name) !== null && _ref11 !== void 0 ? _ref11 : '';
|
|
395
|
+
client.fetchUserInfoById([cvs.conversationId], ["nickname", "avatarurl", "mail", "phone", "gender", "sign", "birth", "ext"]).then(function (res) {
|
|
414
396
|
setHeaderInfo(function (prevState) {
|
|
415
397
|
return _objectSpread(_objectSpread({}, prevState), {}, {
|
|
416
|
-
headerImageURL:
|
|
417
|
-
conversationName:
|
|
398
|
+
headerImageURL: res.data[cvs.conversationId].avatarurl,
|
|
399
|
+
conversationName: res.data[cvs.conversationId].nickname
|
|
418
400
|
});
|
|
419
401
|
});
|
|
420
|
-
}
|
|
402
|
+
});
|
|
421
403
|
}
|
|
422
404
|
};
|
|
423
405
|
function getShareGroupInfo(_x2, _x3) {
|
|
@@ -453,7 +435,7 @@ var Chatbox = function Chatbox(props) {
|
|
|
453
435
|
} else {
|
|
454
436
|
//显示指定的群
|
|
455
437
|
conversation = {
|
|
456
|
-
chatType:
|
|
438
|
+
chatType: "groupChat",
|
|
457
439
|
conversationId: groupInfo === null || groupInfo === void 0 ? void 0 : groupInfo.sendbirdid,
|
|
458
440
|
lastMessage: {},
|
|
459
441
|
unreadCount: 0,
|
|
@@ -463,7 +445,7 @@ var Chatbox = function Chatbox(props) {
|
|
|
463
445
|
agoraChatUikit.rootStore.conversationStore.addConversation(conversation);
|
|
464
446
|
agoraChatUikit.rootStore.conversationStore.setCurrentCvs({
|
|
465
447
|
conversationId: groupInfo === null || groupInfo === void 0 ? void 0 : groupInfo.sendbirdid,
|
|
466
|
-
chatType:
|
|
448
|
+
chatType: "groupChat"
|
|
467
449
|
});
|
|
468
450
|
}
|
|
469
451
|
} else {
|
|
@@ -478,7 +460,7 @@ var Chatbox = function Chatbox(props) {
|
|
|
478
460
|
return _getShareGroupInfo.apply(this, arguments);
|
|
479
461
|
}
|
|
480
462
|
var clickCustomGroupCardMsg = /*#__PURE__*/function () {
|
|
481
|
-
var
|
|
463
|
+
var _ref11 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee3(msg) {
|
|
482
464
|
var params, _response$data2, response, _msg$customExts3, _msg$customExts4, _msg$customExts5, _msg$customExts6, conversation;
|
|
483
465
|
return _regeneratorRuntime.wrap(function _callee3$(_context3) {
|
|
484
466
|
while (1) switch (_context3.prev = _context3.next) {
|
|
@@ -489,7 +471,7 @@ var Chatbox = function Chatbox(props) {
|
|
|
489
471
|
}
|
|
490
472
|
return _context3.abrupt("return");
|
|
491
473
|
case 2:
|
|
492
|
-
if (!(msg.customEvent ==
|
|
474
|
+
if (!(msg.customEvent == "im_group_share")) {
|
|
493
475
|
_context3.next = 15;
|
|
494
476
|
break;
|
|
495
477
|
}
|
|
@@ -518,7 +500,7 @@ var Chatbox = function Chatbox(props) {
|
|
|
518
500
|
break;
|
|
519
501
|
case 15:
|
|
520
502
|
conversation = {
|
|
521
|
-
chatType:
|
|
503
|
+
chatType: "singleChat",
|
|
522
504
|
conversationId: (_msg$customExts3 = msg.customExts) === null || _msg$customExts3 === void 0 ? void 0 : _msg$customExts3.objectId,
|
|
523
505
|
lastMessage: {},
|
|
524
506
|
unreadCount: 0,
|
|
@@ -528,7 +510,7 @@ var Chatbox = function Chatbox(props) {
|
|
|
528
510
|
agoraChatUikit.rootStore.conversationStore.addConversation(conversation);
|
|
529
511
|
agoraChatUikit.rootStore.conversationStore.setCurrentCvs({
|
|
530
512
|
conversationId: msg === null || msg === void 0 || (_msg$customExts6 = msg.customExts) === null || _msg$customExts6 === void 0 ? void 0 : _msg$customExts6.objectId,
|
|
531
|
-
chatType:
|
|
513
|
+
chatType: "singleChat"
|
|
532
514
|
});
|
|
533
515
|
case 18:
|
|
534
516
|
case "end":
|
|
@@ -537,12 +519,12 @@ var Chatbox = function Chatbox(props) {
|
|
|
537
519
|
}, _callee3, null, [[4, 11]]);
|
|
538
520
|
}));
|
|
539
521
|
return function clickCustomGroupCardMsg(_x4) {
|
|
540
|
-
return
|
|
522
|
+
return _ref11.apply(this, arguments);
|
|
541
523
|
};
|
|
542
524
|
}();
|
|
543
525
|
// 给agent 发送消息需要调用该接口
|
|
544
526
|
var sendAgentMsg = /*#__PURE__*/function () {
|
|
545
|
-
var
|
|
527
|
+
var _ref12 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee4() {
|
|
546
528
|
var userid,
|
|
547
529
|
content,
|
|
548
530
|
options,
|
|
@@ -550,15 +532,15 @@ var Chatbox = function Chatbox(props) {
|
|
|
550
532
|
return _regeneratorRuntime.wrap(function _callee4$(_context4) {
|
|
551
533
|
while (1) switch (_context4.prev = _context4.next) {
|
|
552
534
|
case 0:
|
|
553
|
-
userid = _args4.length > 0 && _args4[0] !== undefined ? _args4[0] :
|
|
554
|
-
content = _args4.length > 1 && _args4[1] !== undefined ? _args4[1] :
|
|
535
|
+
userid = _args4.length > 0 && _args4[0] !== undefined ? _args4[0] : "";
|
|
536
|
+
content = _args4.length > 1 && _args4[1] !== undefined ? _args4[1] : "";
|
|
555
537
|
_context4.prev = 2;
|
|
556
538
|
options = {
|
|
557
539
|
userid: userid,
|
|
558
540
|
content: content
|
|
559
541
|
};
|
|
560
542
|
_context4.next = 6;
|
|
561
|
-
return http.post(
|
|
543
|
+
return http.post("/api/imchannel/sendagentmessage", options);
|
|
562
544
|
case 6:
|
|
563
545
|
_context4.next = 11;
|
|
564
546
|
break;
|
|
@@ -573,15 +555,15 @@ var Chatbox = function Chatbox(props) {
|
|
|
573
555
|
}, _callee4, null, [[2, 8]]);
|
|
574
556
|
}));
|
|
575
557
|
return function sendAgentMsg() {
|
|
576
|
-
return
|
|
558
|
+
return _ref12.apply(this, arguments);
|
|
577
559
|
};
|
|
578
560
|
}();
|
|
579
561
|
var afterSendMsg = /*#__PURE__*/function () {
|
|
580
|
-
var
|
|
562
|
+
var _ref13 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee5(msgInfo) {
|
|
581
563
|
return _regeneratorRuntime.wrap(function _callee5$(_context5) {
|
|
582
564
|
while (1) switch (_context5.prev = _context5.next) {
|
|
583
565
|
case 0:
|
|
584
|
-
if (agoraChatUikit.rootStore.conversationStore.currentCvs.chatType ===
|
|
566
|
+
if (agoraChatUikit.rootStore.conversationStore.currentCvs.chatType === "singleChat") {
|
|
585
567
|
sendAgentMsg(agoraChatUikit.rootStore.conversationStore.currentCvs.conversationId, msgInfo.msg);
|
|
586
568
|
}
|
|
587
569
|
case 1:
|
|
@@ -591,7 +573,7 @@ var Chatbox = function Chatbox(props) {
|
|
|
591
573
|
}, _callee5);
|
|
592
574
|
}));
|
|
593
575
|
return function afterSendMsg(_x5) {
|
|
594
|
-
return
|
|
576
|
+
return _ref13.apply(this, arguments);
|
|
595
577
|
};
|
|
596
578
|
}();
|
|
597
579
|
React.useEffect(function () {
|
|
@@ -627,7 +609,7 @@ var Chatbox = function Chatbox(props) {
|
|
|
627
609
|
onClose: function onClose() {
|
|
628
610
|
return setShowJoinGroupDialog(false);
|
|
629
611
|
},
|
|
630
|
-
userId: (_userInfo$uid3 = userInfo.uid) !== null && _userInfo$uid3 !== void 0 ? _userInfo$uid3 :
|
|
612
|
+
userId: (_userInfo$uid3 = userInfo.uid) !== null && _userInfo$uid3 !== void 0 ? _userInfo$uid3 : "",
|
|
631
613
|
visible: showJoinGroupDialog,
|
|
632
614
|
shareGroupInfo: joinGroupInfo
|
|
633
615
|
}));
|
|
@@ -57,25 +57,44 @@ var CustomChatView = function CustomChatView(props) {
|
|
|
57
57
|
var renderTxtMsg = function renderTxtMsg(msg) {
|
|
58
58
|
var _userInfo$uid;
|
|
59
59
|
var isMySelf = (msg === null || msg === void 0 ? void 0 : msg.bySelf) === true || (msg === null || msg === void 0 ? void 0 : msg.from.toLowerCase()) === ((_userInfo$uid = userInfo.uid) === null || _userInfo$uid === void 0 ? void 0 : _userInfo$uid.toLowerCase());
|
|
60
|
-
return
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
60
|
+
// return (
|
|
61
|
+
// <TextMessage
|
|
62
|
+
// bubbleStyle={{ background: isMySelf ? "var(--im-msg-bubble-color-right)" : "var(--im-msg-bubble-color-left)", borderRadius: "9px", padding:"10px 12px", color: "var(--im-msg-bubble-font-color)" }}
|
|
63
|
+
// shape="square"
|
|
64
|
+
// arrow={false}
|
|
65
|
+
// status={msg.status}
|
|
66
|
+
// textMessage={msg}
|
|
67
|
+
// reaction={false}
|
|
68
|
+
// select={false}
|
|
69
|
+
// thread={false}
|
|
70
|
+
// showTranslation={false}
|
|
71
|
+
// renderUserProfile={() => null}
|
|
72
|
+
// customAction={
|
|
73
|
+
// {
|
|
74
|
+
// visible: false,
|
|
75
|
+
// icon: null,
|
|
76
|
+
// actions: []
|
|
77
|
+
// }
|
|
78
|
+
// }
|
|
79
|
+
// ></TextMessage>
|
|
80
|
+
// );
|
|
81
|
+
return /*#__PURE__*/React.createElement(agoraChatUikit.BaseMessage, {
|
|
82
|
+
bubbleType: 'none',
|
|
71
83
|
reaction: false,
|
|
72
84
|
select: false,
|
|
73
85
|
thread: false,
|
|
74
|
-
|
|
86
|
+
direction: isMySelf ? 'rtl' : 'ltr',
|
|
75
87
|
renderUserProfile: function renderUserProfile() {
|
|
76
88
|
return null;
|
|
77
89
|
},
|
|
78
|
-
|
|
90
|
+
nickName: undefined,
|
|
91
|
+
showMessageInfo: false,
|
|
92
|
+
customAction: {
|
|
93
|
+
visible: false,
|
|
94
|
+
icon: null,
|
|
95
|
+
actions: []
|
|
96
|
+
},
|
|
97
|
+
children: renderLongTextMsg(msg)
|
|
79
98
|
});
|
|
80
99
|
};
|
|
81
100
|
var renderShareCardMsg = function renderShareCardMsg(msg) {
|
|
@@ -97,6 +116,35 @@ var CustomChatView = function CustomChatView(props) {
|
|
|
97
116
|
className: "ml-2 text-base font-semibold leading-normal ellipsis"
|
|
98
117
|
}, msg.customExts.title)));
|
|
99
118
|
};
|
|
119
|
+
var renderLongTextMsg = function renderLongTextMsg(msg) {
|
|
120
|
+
var _userInfo$uid2;
|
|
121
|
+
// 格式化消息时间
|
|
122
|
+
var formatMessageTime = function formatMessageTime(timestamp) {
|
|
123
|
+
if (!timestamp) return '';
|
|
124
|
+
var date = new Date(timestamp);
|
|
125
|
+
return date.toLocaleString('zh-CN', {
|
|
126
|
+
hour: '2-digit',
|
|
127
|
+
minute: '2-digit',
|
|
128
|
+
hour12: false
|
|
129
|
+
});
|
|
130
|
+
};
|
|
131
|
+
var isMySelf = (msg === null || msg === void 0 ? void 0 : msg.bySelf) === true || (msg === null || msg === void 0 ? void 0 : msg.from.toLowerCase()) === ((_userInfo$uid2 = userInfo.uid) === null || _userInfo$uid2 === void 0 ? void 0 : _userInfo$uid2.toLowerCase());
|
|
132
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
133
|
+
className: "text-[var(--im-main-fontColor)] flex flex-col gap-1 ".concat(isMySelf ? 'items-end' : 'items-start')
|
|
134
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
135
|
+
style: {
|
|
136
|
+
background: isMySelf ? "var(--im-msg-bubble-color-right)" : "var(--im-msg-bubble-color-left)",
|
|
137
|
+
borderRadius: "9px",
|
|
138
|
+
padding: "10px 12px",
|
|
139
|
+
color: "var(--im-msg-bubble-font-color)"
|
|
140
|
+
},
|
|
141
|
+
className: "inline-block"
|
|
142
|
+
}, /*#__PURE__*/React.createElement("span", {
|
|
143
|
+
className: "cui-message-text"
|
|
144
|
+
}, msg.msg)), /*#__PURE__*/React.createElement("span", {
|
|
145
|
+
className: "cui-message-base-time"
|
|
146
|
+
}, formatMessageTime(msg.time)));
|
|
147
|
+
};
|
|
100
148
|
var _renderMessage = function renderMessage(msg) {
|
|
101
149
|
if (msg.type === "txt") {
|
|
102
150
|
return renderTxtMsg(msg);
|
|
@@ -108,7 +156,11 @@ var CustomChatView = function CustomChatView(props) {
|
|
|
108
156
|
renderUserProfile: function renderUserProfile() {
|
|
109
157
|
return null;
|
|
110
158
|
},
|
|
111
|
-
customAction:
|
|
159
|
+
customAction: {
|
|
160
|
+
visible: false,
|
|
161
|
+
icon: null,
|
|
162
|
+
actions: []
|
|
163
|
+
},
|
|
112
164
|
imageMessage: msg
|
|
113
165
|
});
|
|
114
166
|
} else if (msg.type === 'file') {
|
|
@@ -125,7 +177,11 @@ var CustomChatView = function CustomChatView(props) {
|
|
|
125
177
|
renderUserProfile: function renderUserProfile() {
|
|
126
178
|
return null;
|
|
127
179
|
},
|
|
128
|
-
customAction:
|
|
180
|
+
customAction: {
|
|
181
|
+
visible: false,
|
|
182
|
+
icon: null,
|
|
183
|
+
actions: []
|
|
184
|
+
},
|
|
129
185
|
fileMessage: msg
|
|
130
186
|
});
|
|
131
187
|
} else if (msg.type === 'video') {
|
|
@@ -136,7 +192,11 @@ var CustomChatView = function CustomChatView(props) {
|
|
|
136
192
|
renderUserProfile: function renderUserProfile() {
|
|
137
193
|
return null;
|
|
138
194
|
},
|
|
139
|
-
customAction:
|
|
195
|
+
customAction: {
|
|
196
|
+
visible: false,
|
|
197
|
+
icon: null,
|
|
198
|
+
actions: []
|
|
199
|
+
},
|
|
140
200
|
videoMessage: msg
|
|
141
201
|
});
|
|
142
202
|
} else if (msg.type === 'audio') {
|
|
@@ -147,12 +207,16 @@ var CustomChatView = function CustomChatView(props) {
|
|
|
147
207
|
renderUserProfile: function renderUserProfile() {
|
|
148
208
|
return null;
|
|
149
209
|
},
|
|
150
|
-
customAction:
|
|
210
|
+
customAction: {
|
|
211
|
+
visible: false,
|
|
212
|
+
icon: null,
|
|
213
|
+
actions: []
|
|
214
|
+
},
|
|
151
215
|
audioMessage: msg
|
|
152
216
|
});
|
|
153
217
|
} else if (msg.type === 'custom' && ((msg === null || msg === void 0 ? void 0 : msg.customEvent) === 'im_group_share' || (msg === null || msg === void 0 ? void 0 : msg.customEvent) === 'personcenter_share')) {
|
|
154
|
-
var _userInfo$
|
|
155
|
-
var isMySelf = (msg === null || msg === void 0 ? void 0 : msg.bySelf) === true || (msg === null || msg === void 0 ? void 0 : msg.from.toLowerCase()) === (userInfo === null || userInfo === void 0 || (_userInfo$
|
|
218
|
+
var _userInfo$uid3;
|
|
219
|
+
var isMySelf = (msg === null || msg === void 0 ? void 0 : msg.bySelf) === true || (msg === null || msg === void 0 ? void 0 : msg.from.toLowerCase()) === (userInfo === null || userInfo === void 0 || (_userInfo$uid3 = userInfo.uid) === null || _userInfo$uid3 === void 0 ? void 0 : _userInfo$uid3.toLowerCase());
|
|
156
220
|
return /*#__PURE__*/React.createElement(agoraChatUikit.BaseMessage, {
|
|
157
221
|
bubbleStyle: {
|
|
158
222
|
background: isMySelf ? "var(--im-msg-bubble-color-right)" : "var(--im-msg-bubble-color-left)",
|
|
@@ -167,7 +231,11 @@ var CustomChatView = function CustomChatView(props) {
|
|
|
167
231
|
renderUserProfile: function renderUserProfile() {
|
|
168
232
|
return null;
|
|
169
233
|
},
|
|
170
|
-
customAction:
|
|
234
|
+
customAction: {
|
|
235
|
+
visible: false,
|
|
236
|
+
icon: null,
|
|
237
|
+
actions: []
|
|
238
|
+
},
|
|
171
239
|
children: renderShareCardMsg(msg)
|
|
172
240
|
});
|
|
173
241
|
} else {
|
package/cjs/IM/index.js
CHANGED
|
@@ -28,6 +28,7 @@ var IM = function IM(props) {
|
|
|
28
28
|
_props$mobile = props.mobile,
|
|
29
29
|
mobile = _props$mobile === void 0 ? false : _props$mobile,
|
|
30
30
|
onChatIconClick = props.onChatIconClick;
|
|
31
|
+
console.log('the useinfo is', userInfo);
|
|
31
32
|
var agoraToken = useGetAgoraToken.useGetAgoraToken(http, userInfo.uid);
|
|
32
33
|
var _useState = React.useState(),
|
|
33
34
|
_useState2 = _slicedToArray(_useState, 2),
|
|
@@ -84,7 +85,7 @@ var IM = function IM(props) {
|
|
|
84
85
|
}
|
|
85
86
|
}, /*#__PURE__*/React.createElement(agoraChatUikit.UIKitProvider, {
|
|
86
87
|
initConfig: {
|
|
87
|
-
userId: userInfo.uid
|
|
88
|
+
userId: userInfo.uid,
|
|
88
89
|
appKey: appKey,
|
|
89
90
|
token: agoraToken
|
|
90
91
|
},
|
|
@@ -28,8 +28,13 @@ var CustomConversationItem = function CustomConversationItem(props) {
|
|
|
28
28
|
_useState2 = _slicedToArray(_useState, 2),
|
|
29
29
|
avatar = _useState2[0],
|
|
30
30
|
setAvatar = _useState2[1];
|
|
31
|
+
var _useState3 = React.useState(""),
|
|
32
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
33
|
+
name = _useState4[0],
|
|
34
|
+
setName = _useState4[1];
|
|
31
35
|
var _useConversationConte = agoraChatUikit.useConversationContext(),
|
|
32
36
|
setCurrentConversation = _useConversationConte.setCurrentConversation;
|
|
37
|
+
var client = agoraChatUikit.useClient();
|
|
33
38
|
cvs.chatType === "groupChat" && agoraChatUikit.rootStore.addressStore.getGroupInfo(cvs.conversationId);
|
|
34
39
|
React.useEffect(function () {
|
|
35
40
|
if (cvs.chatType === "groupChat") {
|
|
@@ -50,25 +55,15 @@ var CustomConversationItem = function CustomConversationItem(props) {
|
|
|
50
55
|
}
|
|
51
56
|
}
|
|
52
57
|
} else {
|
|
53
|
-
var imageUrl = "";
|
|
54
58
|
if (!cvs || !cvs.conversationId) {
|
|
55
59
|
return;
|
|
56
60
|
}
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
var _value$avatarurl;
|
|
62
|
-
imageUrl = (_value$avatarurl = value === null || value === void 0 ? void 0 : value.avatarurl) !== null && _value$avatarurl !== void 0 ? _value$avatarurl : "";
|
|
63
|
-
}
|
|
64
|
-
});
|
|
65
|
-
} else {
|
|
66
|
-
var _appUsersInfo$avataru;
|
|
67
|
-
imageUrl = (_appUsersInfo$avataru = appUsersInfo === null || appUsersInfo === void 0 ? void 0 : appUsersInfo.avatarurl) !== null && _appUsersInfo$avataru !== void 0 ? _appUsersInfo$avataru : "";
|
|
68
|
-
}
|
|
69
|
-
setAvatar(imageUrl);
|
|
61
|
+
client.fetchUserInfoById([cvs.conversationId], ["nickname", "avatarurl", "mail", "phone", "gender", "sign", "birth", "ext"]).then(function (res) {
|
|
62
|
+
setAvatar(res.data[cvs.conversationId].avatarurl);
|
|
63
|
+
setName(res.data[cvs.conversationId].nickname);
|
|
64
|
+
});
|
|
70
65
|
}
|
|
71
|
-
}, [cvs, cvs.chatType, cvs.conversationId, http]);
|
|
66
|
+
}, [client, cvs, cvs.chatType, cvs.conversationId, http]);
|
|
72
67
|
return /*#__PURE__*/React.createElement(agoraChatUikit.ConversationItem, {
|
|
73
68
|
className: "yuze-conversationItem",
|
|
74
69
|
avatar: /*#__PURE__*/React.createElement("div", {
|
|
@@ -82,7 +77,9 @@ var CustomConversationItem = function CustomConversationItem(props) {
|
|
|
82
77
|
}), cvs.unreadCount > 0 && /*#__PURE__*/React.createElement("div", {
|
|
83
78
|
className: "text-sm absolute yuze-conversationItem-avatar-notice"
|
|
84
79
|
}, cvs.unreadCount > 99 ? "99+" : cvs.unreadCount)),
|
|
85
|
-
data: _objectSpread({}, cvs),
|
|
80
|
+
data: _objectSpread(_objectSpread({}, cvs), {}, {
|
|
81
|
+
name: name
|
|
82
|
+
}),
|
|
86
83
|
moreAction: {
|
|
87
84
|
actions: [],
|
|
88
85
|
visible: true,
|
package/cjs/Sidebar/index.js
CHANGED