whyuzeim 1.1.20 → 1.1.22

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.
@@ -61,10 +61,9 @@ var HighlyCustomChat = function HighlyCustomChat(props) {
61
61
  currentConversation = _useState6[0],
62
62
  setCurrentConversation = _useState6[1];
63
63
  var _useState7 = React.useState(true),
64
- _useState8 = _slicedToArray(_useState7, 2);
65
- _useState8[0];
66
- var setIsAgent = _useState8[1];
67
- React.useRef(null);
64
+ _useState8 = _slicedToArray(_useState7, 2),
65
+ isAgent = _useState8[0],
66
+ setIsAgent = _useState8[1];
68
67
  var renderTxtMsg = function renderTxtMsg(msg) {
69
68
  var _userInfo$uid;
70
69
  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());
@@ -137,6 +136,11 @@ var HighlyCustomChat = function HighlyCustomChat(props) {
137
136
  }, formatMessageTime(msg.time)));
138
137
  };
139
138
  var _renderMessage = function renderMessage(msg) {
139
+ var cuiScrollList = document.querySelector(".cui-scrollList div");
140
+ var generatingLoader = document.querySelector("#agent-generating-loader");
141
+ if (cuiScrollList && generatingLoader) {
142
+ cuiScrollList.removeChild(generatingLoader);
143
+ }
140
144
  if (msg.type === "txt") {
141
145
  return renderTxtMsg(msg);
142
146
  } else if (msg.type === "img") {
@@ -376,7 +380,7 @@ var HighlyCustomChat = function HighlyCustomChat(props) {
376
380
  }, [getHeaderInfo, initConversation, props.conversationId]);
377
381
  var handleSendMessage = /*#__PURE__*/function () {
378
382
  var _ref3 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(text) {
379
- var txtMessage, cuiScrollList, cuiScrollListWrap, htmlString, template, node;
383
+ var txtMessage;
380
384
  return _regeneratorRuntime.wrap(function _callee$(_context2) {
381
385
  while (1) switch (_context2.prev = _context2.next) {
382
386
  case 0:
@@ -397,35 +401,22 @@ var HighlyCustomChat = function HighlyCustomChat(props) {
397
401
  _context2.next = 6;
398
402
  return agoraChatUikit.rootStore.messageStore.sendMessage(txtMessage);
399
403
  case 6:
400
- cuiScrollList = document.querySelector(".cui-scrollList div");
401
- cuiScrollListWrap = document.querySelector(".cui-scrollList");
402
- if (cuiScrollList) {
403
- htmlString = "<div 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=\"https://static.moonpump.ai/avatars/1.png\" 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>";
404
- template = document.createElement('template');
405
- template.innerHTML = _trimInstanceProperty(htmlString).call(htmlString);
406
- node = template.content.firstChild;
407
- if (node) {
408
- cuiScrollList.appendChild(node);
409
- cuiScrollListWrap === null || cuiScrollListWrap === void 0 || cuiScrollListWrap.scrollTo({
410
- top: 1000000000
411
- });
412
- }
413
- // cuiScrollList.appendChild(`
414
- // <div 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="https://static.moonpump.ai/avatars/1.png" 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 class=""><span class="cui-message-text">32132654</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>
415
- // `)
404
+ if (isAgent) {
405
+ document.querySelector(".cui-scrollList div");
406
+ document.querySelector(".cui-scrollList");
416
407
  }
417
408
  afterSendMsg(txtMessage);
418
- _context2.next = 15;
409
+ _context2.next = 13;
419
410
  break;
420
- case 12:
421
- _context2.prev = 12;
411
+ case 10:
412
+ _context2.prev = 10;
422
413
  _context2.t0 = _context2["catch"](2);
423
414
  console.log("send txt message failed", _context2.t0);
424
- case 15:
415
+ case 13:
425
416
  case "end":
426
417
  return _context2.stop();
427
418
  }
428
- }, _callee, null, [[2, 12]]);
419
+ }, _callee, null, [[2, 10]]);
429
420
  }));
430
421
  return function handleSendMessage(_x) {
431
422
  return _ref3.apply(this, arguments);
@@ -59,10 +59,9 @@ var HighlyCustomChat = function HighlyCustomChat(props) {
59
59
  currentConversation = _useState6[0],
60
60
  setCurrentConversation = _useState6[1];
61
61
  var _useState7 = useState(true),
62
- _useState8 = _slicedToArray(_useState7, 2);
63
- _useState8[0];
64
- var setIsAgent = _useState8[1];
65
- useRef(null);
62
+ _useState8 = _slicedToArray(_useState7, 2),
63
+ isAgent = _useState8[0],
64
+ setIsAgent = _useState8[1];
66
65
  var renderTxtMsg = function renderTxtMsg(msg) {
67
66
  var _userInfo$uid;
68
67
  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());
@@ -135,6 +134,11 @@ var HighlyCustomChat = function HighlyCustomChat(props) {
135
134
  }, formatMessageTime(msg.time)));
136
135
  };
137
136
  var _renderMessage = function renderMessage(msg) {
137
+ var cuiScrollList = document.querySelector(".cui-scrollList div");
138
+ var generatingLoader = document.querySelector("#agent-generating-loader");
139
+ if (cuiScrollList && generatingLoader) {
140
+ cuiScrollList.removeChild(generatingLoader);
141
+ }
138
142
  if (msg.type === "txt") {
139
143
  return renderTxtMsg(msg);
140
144
  } else if (msg.type === "img") {
@@ -374,7 +378,7 @@ var HighlyCustomChat = function HighlyCustomChat(props) {
374
378
  }, [getHeaderInfo, initConversation, props.conversationId]);
375
379
  var handleSendMessage = /*#__PURE__*/function () {
376
380
  var _ref3 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(text) {
377
- var txtMessage, cuiScrollList, cuiScrollListWrap, htmlString, template, node;
381
+ var txtMessage;
378
382
  return _regeneratorRuntime.wrap(function _callee$(_context2) {
379
383
  while (1) switch (_context2.prev = _context2.next) {
380
384
  case 0:
@@ -395,35 +399,22 @@ var HighlyCustomChat = function HighlyCustomChat(props) {
395
399
  _context2.next = 6;
396
400
  return rootStore.messageStore.sendMessage(txtMessage);
397
401
  case 6:
398
- cuiScrollList = document.querySelector(".cui-scrollList div");
399
- cuiScrollListWrap = document.querySelector(".cui-scrollList");
400
- if (cuiScrollList) {
401
- htmlString = "<div 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=\"https://static.moonpump.ai/avatars/1.png\" 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>";
402
- template = document.createElement('template');
403
- template.innerHTML = _trimInstanceProperty(htmlString).call(htmlString);
404
- node = template.content.firstChild;
405
- if (node) {
406
- cuiScrollList.appendChild(node);
407
- cuiScrollListWrap === null || cuiScrollListWrap === void 0 || cuiScrollListWrap.scrollTo({
408
- top: 1000000000
409
- });
410
- }
411
- // cuiScrollList.appendChild(`
412
- // <div 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="https://static.moonpump.ai/avatars/1.png" 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 class=""><span class="cui-message-text">32132654</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>
413
- // `)
402
+ if (isAgent) {
403
+ document.querySelector(".cui-scrollList div");
404
+ document.querySelector(".cui-scrollList");
414
405
  }
415
406
  afterSendMsg(txtMessage);
416
- _context2.next = 15;
407
+ _context2.next = 13;
417
408
  break;
418
- case 12:
419
- _context2.prev = 12;
409
+ case 10:
410
+ _context2.prev = 10;
420
411
  _context2.t0 = _context2["catch"](2);
421
412
  console.log("send txt message failed", _context2.t0);
422
- case 15:
413
+ case 13:
423
414
  case "end":
424
415
  return _context2.stop();
425
416
  }
426
- }, _callee, null, [[2, 12]]);
417
+ }, _callee, null, [[2, 10]]);
427
418
  }));
428
419
  return function handleSendMessage(_x) {
429
420
  return _ref3.apply(this, arguments);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "whyuzeim",
3
- "version": "1.1.20",
3
+ "version": "1.1.22",
4
4
  "description": "im componenets",
5
5
  "main": "cjs/index.js",
6
6
  "module": "es/index.js",