whyuzeim 1.1.38 → 1.1.40

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.
@@ -62,9 +62,9 @@ var HighlyCustomChat = function HighlyCustomChat(props) {
62
62
  currentConversation = _useState6[0],
63
63
  setCurrentConversation = _useState6[1];
64
64
  var _useState7 = React.useState(true),
65
- _useState8 = _slicedToArray(_useState7, 2);
66
- _useState8[0];
67
- var setIsAgent = _useState8[1];
65
+ _useState8 = _slicedToArray(_useState7, 2),
66
+ isAgent = _useState8[0],
67
+ setIsAgent = _useState8[1];
68
68
  var renderTxtMsg = function renderTxtMsg(msg) {
69
69
  var _userInfo$uid;
70
70
  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());
@@ -376,7 +376,7 @@ var HighlyCustomChat = function HighlyCustomChat(props) {
376
376
  }, [getHeaderInfo, initConversation, props.conversationId]);
377
377
  var handleSendMessage = /*#__PURE__*/function () {
378
378
  var _ref3 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(text) {
379
- var txtMessage;
379
+ var txtMessage, cuiScrollList, cuiScrollListWrap, htmlString, template, node;
380
380
  return _regeneratorRuntime.wrap(function _callee$(_context2) {
381
381
  while (1) switch (_context2.prev = _context2.next) {
382
382
  case 0:
@@ -397,6 +397,22 @@ var HighlyCustomChat = function HighlyCustomChat(props) {
397
397
  _context2.next = 6;
398
398
  return agoraChatUikit.rootStore.messageStore.sendMessage(txtMessage);
399
399
  case 6:
400
+ if (isAgent) {
401
+ cuiScrollList = document.querySelector(".cui-scrollList div");
402
+ cuiScrollListWrap = document.querySelector(".cui-scrollList");
403
+ if (cuiScrollList) {
404
+ htmlString = "<div id=\"agent-generating-loader\" class=\"cui-messageList-msgItem\"><div><div class=\"thread-container\"><div id=\"1393207307050949578\" class=\"cui-message-base cui-message-base-left cui-message-base-hasAvatar cui-message-base-secondly cui-message-base-square cui-message-base-dark\"><img src=\"/icon/im/avatar_default.svg\" class=\"w-[48px] h-[48px] rounded-full overflow-hidden object-fit\"><div class=\"cui-message-base-box\"><div class=\"cui-message-base-info\"></div><div class=\"cui-message-base-body\"><div class=\"cui-message-base-content\" style=\"background: var(--im-msg-bubble-color-left); border-radius: 9px; padding: 10px 12px; color: var(--im-msg-bubble-font-color);\"><div style=\"display:flex;align-items:center\"><div class=\"generating-loader-wrap\"><div class=\"generating-loader\"></div></div><span class=\"cui-message-text\">Generating</span></div></div><div class=\"cui-message-base-time-and-status-box\"><span class=\"cui-message-status cui-message-status-icon\"></span><span class=\"cui-message-base-time\">Mar</span></div></div></div></div></div></div><div class=\"cui-modal-root\"><div tabindex=\"-1\" class=\"cui-modal-wrap modify-message-modal\" style=\"display: none;\"></div></div></div>";
405
+ template = document.createElement('template');
406
+ template.innerHTML = _trimInstanceProperty(htmlString).call(htmlString);
407
+ node = template.content.firstChild;
408
+ if (node) {
409
+ cuiScrollList.appendChild(node);
410
+ cuiScrollListWrap === null || cuiScrollListWrap === void 0 || cuiScrollListWrap.scrollTo({
411
+ top: 1000000000
412
+ });
413
+ }
414
+ }
415
+ }
400
416
  afterSendMsg(txtMessage);
401
417
  _context2.next = 13;
402
418
  break;
@@ -60,9 +60,9 @@ var HighlyCustomChat = function HighlyCustomChat(props) {
60
60
  currentConversation = _useState6[0],
61
61
  setCurrentConversation = _useState6[1];
62
62
  var _useState7 = useState(true),
63
- _useState8 = _slicedToArray(_useState7, 2);
64
- _useState8[0];
65
- var setIsAgent = _useState8[1];
63
+ _useState8 = _slicedToArray(_useState7, 2),
64
+ isAgent = _useState8[0],
65
+ setIsAgent = _useState8[1];
66
66
  var renderTxtMsg = function renderTxtMsg(msg) {
67
67
  var _userInfo$uid;
68
68
  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());
@@ -374,7 +374,7 @@ var HighlyCustomChat = function HighlyCustomChat(props) {
374
374
  }, [getHeaderInfo, initConversation, props.conversationId]);
375
375
  var handleSendMessage = /*#__PURE__*/function () {
376
376
  var _ref3 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(text) {
377
- var txtMessage;
377
+ var txtMessage, cuiScrollList, cuiScrollListWrap, htmlString, template, node;
378
378
  return _regeneratorRuntime.wrap(function _callee$(_context2) {
379
379
  while (1) switch (_context2.prev = _context2.next) {
380
380
  case 0:
@@ -395,6 +395,22 @@ var HighlyCustomChat = function HighlyCustomChat(props) {
395
395
  _context2.next = 6;
396
396
  return rootStore.messageStore.sendMessage(txtMessage);
397
397
  case 6:
398
+ if (isAgent) {
399
+ cuiScrollList = document.querySelector(".cui-scrollList div");
400
+ cuiScrollListWrap = document.querySelector(".cui-scrollList");
401
+ if (cuiScrollList) {
402
+ htmlString = "<div id=\"agent-generating-loader\" class=\"cui-messageList-msgItem\"><div><div class=\"thread-container\"><div id=\"1393207307050949578\" class=\"cui-message-base cui-message-base-left cui-message-base-hasAvatar cui-message-base-secondly cui-message-base-square cui-message-base-dark\"><img src=\"/icon/im/avatar_default.svg\" class=\"w-[48px] h-[48px] rounded-full overflow-hidden object-fit\"><div class=\"cui-message-base-box\"><div class=\"cui-message-base-info\"></div><div class=\"cui-message-base-body\"><div class=\"cui-message-base-content\" style=\"background: var(--im-msg-bubble-color-left); border-radius: 9px; padding: 10px 12px; color: var(--im-msg-bubble-font-color);\"><div style=\"display:flex;align-items:center\"><div class=\"generating-loader-wrap\"><div class=\"generating-loader\"></div></div><span class=\"cui-message-text\">Generating</span></div></div><div class=\"cui-message-base-time-and-status-box\"><span class=\"cui-message-status cui-message-status-icon\"></span><span class=\"cui-message-base-time\">Mar</span></div></div></div></div></div></div><div class=\"cui-modal-root\"><div tabindex=\"-1\" class=\"cui-modal-wrap modify-message-modal\" style=\"display: none;\"></div></div></div>";
403
+ template = document.createElement('template');
404
+ template.innerHTML = _trimInstanceProperty(htmlString).call(htmlString);
405
+ node = template.content.firstChild;
406
+ if (node) {
407
+ cuiScrollList.appendChild(node);
408
+ cuiScrollListWrap === null || cuiScrollListWrap === void 0 || cuiScrollListWrap.scrollTo({
409
+ top: 1000000000
410
+ });
411
+ }
412
+ }
413
+ }
398
414
  afterSendMsg(txtMessage);
399
415
  _context2.next = 13;
400
416
  break;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "whyuzeim",
3
- "version": "1.1.38",
3
+ "version": "1.1.40",
4
4
  "description": "im componenets",
5
5
  "main": "cjs/index.js",
6
6
  "module": "es/index.js",