whyuzeim 1.1.48 → 1.1.50

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.
@@ -13,6 +13,8 @@ var _slicedToArray = require('@babel/runtime-corejs3/helpers/esm/slicedToArray')
13
13
  var _regeneratorRuntime = require('@babel/runtime-corejs3/regenerator');
14
14
  var _forEachInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/for-each');
15
15
  var _Date$now = require('@babel/runtime-corejs3/core-js-stable/date/now');
16
+ var _trimInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/trim');
17
+ var _findInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/find');
16
18
  var React = require('react');
17
19
  var agoraChatUikit = require('agora-chat-uikit');
18
20
  require('./style/index.scss');
@@ -40,7 +42,8 @@ var Chatbox = function Chatbox(props) {
40
42
  theme = _useContext.theme;
41
43
  var onBack = props.onBack;
42
44
  var _useConversationConte = agoraChatUikit.useConversationContext(),
43
- currentConversation = _useConversationConte.currentConversation;
45
+ currentConversation = _useConversationConte.currentConversation,
46
+ conversationList = _useConversationConte.conversationList;
44
47
  var _useState = React.useState(false),
45
48
  _useState2 = _slicedToArray(_useState, 2),
46
49
  isTopMenuOpen = _useState2[0],
@@ -587,6 +590,11 @@ var Chatbox = function Chatbox(props) {
587
590
  var _ref12 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee4() {
588
591
  var userid,
589
592
  content,
593
+ cuiScrollList,
594
+ cuiScrollListWrap,
595
+ htmlString,
596
+ template,
597
+ node,
590
598
  _args4 = arguments;
591
599
  return _regeneratorRuntime.wrap(function _callee4$(_context4) {
592
600
  while (1) switch (_context4.prev = _context4.next) {
@@ -594,6 +602,20 @@ var Chatbox = function Chatbox(props) {
594
602
  userid = _args4.length > 0 && _args4[0] !== undefined ? _args4[0] : "";
595
603
  content = _args4.length > 1 && _args4[1] !== undefined ? _args4[1] : "";
596
604
  if (isAgent) {
605
+ cuiScrollList = document.querySelector(".cui-scrollList div");
606
+ cuiScrollListWrap = document.querySelector(".cui-scrollList");
607
+ if (cuiScrollList) {
608
+ 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\"></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>";
609
+ template = document.createElement('template');
610
+ template.innerHTML = _trimInstanceProperty(htmlString).call(htmlString);
611
+ node = template.content.firstChild;
612
+ if (node) {
613
+ cuiScrollList.appendChild(node);
614
+ cuiScrollListWrap === null || cuiScrollListWrap === void 0 || cuiScrollListWrap.scrollTo({
615
+ top: 1000000000
616
+ });
617
+ }
618
+ }
597
619
  tools.reportAgentMsg(http, userid, content);
598
620
  }
599
621
  case 3:
@@ -632,6 +654,16 @@ var Chatbox = function Chatbox(props) {
632
654
  setRightComponent && setRightComponent(undefined);
633
655
  }
634
656
  }, [currentConversation]);
657
+ React.useEffect(function () {
658
+ var _conversationList$fin;
659
+ var cuiScrollList = document.querySelector(".cui-scrollList div");
660
+ var generatingLoader = document.querySelector("#agent-generating-loader");
661
+ if (cuiScrollList && generatingLoader && ((_conversationList$fin = _findInstanceProperty(conversationList).call(conversationList, function (item) {
662
+ return item.conversationId === agoraChatUikit.rootStore.conversationStore.currentCvs.conversationId;
663
+ })) === null || _conversationList$fin === void 0 || (_conversationList$fin = _conversationList$fin.lastMessage) === null || _conversationList$fin === void 0 ? void 0 : _conversationList$fin.to) !== agoraChatUikit.rootStore.conversationStore.currentCvs.conversationId) {
664
+ cuiScrollList.removeChild(generatingLoader);
665
+ }
666
+ }, [conversationList]);
635
667
  return /*#__PURE__*/React.createElement("div", {
636
668
  className: "yuze_chat_container w-full h-full overflow-hidden flex flex-col"
637
669
  }, currentConversation.conversationId && customHeader(), /*#__PURE__*/React.createElement(agoraChatUikit.Chat, {
@@ -44,9 +44,9 @@ var CodeMsg = function CodeMsg(props) {
44
44
  padding: "10px 12px",
45
45
  color: "var(--im-msg-bubble-font-color)"
46
46
  },
47
- className: "inline-block"
47
+ className: "inline-block w-full"
48
48
  }, /*#__PURE__*/React.createElement("div", {
49
- className: "p-4 flex justify-between items-center flex-shrink-0"
49
+ className: "flex-1 flex justify-between items-center"
50
50
  }, /*#__PURE__*/React.createElement("div", {
51
51
  className: "flex items-center gap-1 text-white text-[10px] font-normal"
52
52
  }, /*#__PURE__*/React.createElement("svg", {
@@ -61,14 +61,14 @@ var CodeMsg = function CodeMsg(props) {
61
61
  d: "M8 0.0214844H2.58333V2.5396H0.0214844V8.01198H2.58333V10.5301H8V8.01198H10.5618V2.5396H8V0.0214844Z",
62
62
  fill: "#0083FF"
63
63
  })), /*#__PURE__*/React.createElement("span", {
64
- className: "text-[#000]"
64
+ className: "text-[#fff]"
65
65
  }, "main.py")), /*#__PURE__*/React.createElement("button", {
66
66
  onClick: function onClick() {
67
67
  onApply && onApply(msg.customExts.code);
68
68
  },
69
69
  className: "flex items-center h-6 px-2 py-1 bg-white rounded text-black/90 text-[10px] font-normal"
70
70
  }, "Apply")), /*#__PURE__*/React.createElement("div", {
71
- className: "flex-1 px-4 pt-2 pb-4 gap-2 flex flex-col justify-between h-full overflow-hidden"
71
+ className: "flex-1 gap-2 flex flex-col justify-between h-full overflow-hidden"
72
72
  }, /*#__PURE__*/React.createElement("div", {
73
73
  className: "code-scroll-container w-full max-h-[300px] overflow-y-auto"
74
74
  }, /*#__PURE__*/React.createElement("pre", {
@@ -204,7 +204,7 @@ var HighlyCustomChat = function HighlyCustomChat(props) {
204
204
  isMySelf: isMySelf,
205
205
  avatar: !isMySelf ? /*#__PURE__*/React.createElement("img", {
206
206
  src: headerInfo.headerImageURL || avatar_default,
207
- className: "w-[48px] h-[48px] rounded-full overflow-hidden object-fit"
207
+ className: "shrink-0 w-[48px] h-[48px] rounded-full overflow-hidden object-fit"
208
208
  }) : undefined
209
209
  });
210
210
  } else if (msg.type === "custom" && (msg === null || msg === void 0 ? void 0 : msg.customEvent) === "custom_coding") {
@@ -214,7 +214,7 @@ var HighlyCustomChat = function HighlyCustomChat(props) {
214
214
  isMySelf: isMySelf,
215
215
  avatar: !isMySelf ? /*#__PURE__*/React.createElement("img", {
216
216
  src: headerInfo.headerImageURL || avatar_default,
217
- className: "w-[48px] h-[48px] rounded-full overflow-hidden object-fit"
217
+ className: "shrink-0 w-[48px] h-[48px] rounded-full overflow-hidden object-fit"
218
218
  }) : undefined
219
219
  });
220
220
  } else if (msg.type === "custom" && (msg === null || msg === void 0 ? void 0 : msg.customEvent) === "custom_qa_guidance") {
@@ -226,7 +226,7 @@ var HighlyCustomChat = function HighlyCustomChat(props) {
226
226
  isMySelf: isMySelf,
227
227
  avatar: !isMySelf ? /*#__PURE__*/React.createElement("img", {
228
228
  src: headerInfo.headerImageURL || avatar_default,
229
- className: "w-[48px] h-[48px] rounded-full overflow-hidden object-fit"
229
+ className: "shrink-0 w-[48px] h-[48px] rounded-full overflow-hidden object-fit"
230
230
  }) : undefined
231
231
  });
232
232
  } else {
@@ -11,8 +11,10 @@ import _slicedToArray from '@babel/runtime-corejs3/helpers/esm/slicedToArray';
11
11
  import _regeneratorRuntime from '@babel/runtime-corejs3/regenerator';
12
12
  import _forEachInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/for-each';
13
13
  import _Date$now from '@babel/runtime-corejs3/core-js-stable/date/now';
14
+ import _trimInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/trim';
15
+ import _findInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/find';
14
16
  import React, { useContext, useState, useEffect } from 'react';
15
- import { useClient, useConversationContext, Chat, MessageList, rootStore, Tooltip, ImageMessage, FileMessage, VideoMessage, AudioMessage, BaseMessage, TextMessage } from 'agora-chat-uikit';
17
+ import { useClient, useConversationContext, rootStore, Chat, MessageList, Tooltip, ImageMessage, FileMessage, VideoMessage, AudioMessage, BaseMessage, TextMessage } from 'agora-chat-uikit';
16
18
  import './style/index.scss';
17
19
  import img$2 from './image/ic_more.svg.js';
18
20
  import img from './image/ic_chat_back.svg.js';
@@ -38,7 +40,8 @@ var Chatbox = function Chatbox(props) {
38
40
  theme = _useContext.theme;
39
41
  var onBack = props.onBack;
40
42
  var _useConversationConte = useConversationContext(),
41
- currentConversation = _useConversationConte.currentConversation;
43
+ currentConversation = _useConversationConte.currentConversation,
44
+ conversationList = _useConversationConte.conversationList;
42
45
  var _useState = useState(false),
43
46
  _useState2 = _slicedToArray(_useState, 2),
44
47
  isTopMenuOpen = _useState2[0],
@@ -585,6 +588,11 @@ var Chatbox = function Chatbox(props) {
585
588
  var _ref12 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee4() {
586
589
  var userid,
587
590
  content,
591
+ cuiScrollList,
592
+ cuiScrollListWrap,
593
+ htmlString,
594
+ template,
595
+ node,
588
596
  _args4 = arguments;
589
597
  return _regeneratorRuntime.wrap(function _callee4$(_context4) {
590
598
  while (1) switch (_context4.prev = _context4.next) {
@@ -592,6 +600,20 @@ var Chatbox = function Chatbox(props) {
592
600
  userid = _args4.length > 0 && _args4[0] !== undefined ? _args4[0] : "";
593
601
  content = _args4.length > 1 && _args4[1] !== undefined ? _args4[1] : "";
594
602
  if (isAgent) {
603
+ cuiScrollList = document.querySelector(".cui-scrollList div");
604
+ cuiScrollListWrap = document.querySelector(".cui-scrollList");
605
+ if (cuiScrollList) {
606
+ 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\"></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>";
607
+ template = document.createElement('template');
608
+ template.innerHTML = _trimInstanceProperty(htmlString).call(htmlString);
609
+ node = template.content.firstChild;
610
+ if (node) {
611
+ cuiScrollList.appendChild(node);
612
+ cuiScrollListWrap === null || cuiScrollListWrap === void 0 || cuiScrollListWrap.scrollTo({
613
+ top: 1000000000
614
+ });
615
+ }
616
+ }
595
617
  reportAgentMsg(http, userid, content);
596
618
  }
597
619
  case 3:
@@ -630,6 +652,16 @@ var Chatbox = function Chatbox(props) {
630
652
  setRightComponent && setRightComponent(undefined);
631
653
  }
632
654
  }, [currentConversation]);
655
+ useEffect(function () {
656
+ var _conversationList$fin;
657
+ var cuiScrollList = document.querySelector(".cui-scrollList div");
658
+ var generatingLoader = document.querySelector("#agent-generating-loader");
659
+ if (cuiScrollList && generatingLoader && ((_conversationList$fin = _findInstanceProperty(conversationList).call(conversationList, function (item) {
660
+ return item.conversationId === rootStore.conversationStore.currentCvs.conversationId;
661
+ })) === null || _conversationList$fin === void 0 || (_conversationList$fin = _conversationList$fin.lastMessage) === null || _conversationList$fin === void 0 ? void 0 : _conversationList$fin.to) !== rootStore.conversationStore.currentCvs.conversationId) {
662
+ cuiScrollList.removeChild(generatingLoader);
663
+ }
664
+ }, [conversationList]);
633
665
  return /*#__PURE__*/React.createElement("div", {
634
666
  className: "yuze_chat_container w-full h-full overflow-hidden flex flex-col"
635
667
  }, currentConversation.conversationId && customHeader(), /*#__PURE__*/React.createElement(Chat, {
@@ -42,9 +42,9 @@ var CodeMsg = function CodeMsg(props) {
42
42
  padding: "10px 12px",
43
43
  color: "var(--im-msg-bubble-font-color)"
44
44
  },
45
- className: "inline-block"
45
+ className: "inline-block w-full"
46
46
  }, /*#__PURE__*/React.createElement("div", {
47
- className: "p-4 flex justify-between items-center flex-shrink-0"
47
+ className: "flex-1 flex justify-between items-center"
48
48
  }, /*#__PURE__*/React.createElement("div", {
49
49
  className: "flex items-center gap-1 text-white text-[10px] font-normal"
50
50
  }, /*#__PURE__*/React.createElement("svg", {
@@ -59,14 +59,14 @@ var CodeMsg = function CodeMsg(props) {
59
59
  d: "M8 0.0214844H2.58333V2.5396H0.0214844V8.01198H2.58333V10.5301H8V8.01198H10.5618V2.5396H8V0.0214844Z",
60
60
  fill: "#0083FF"
61
61
  })), /*#__PURE__*/React.createElement("span", {
62
- className: "text-[#000]"
62
+ className: "text-[#fff]"
63
63
  }, "main.py")), /*#__PURE__*/React.createElement("button", {
64
64
  onClick: function onClick() {
65
65
  onApply && onApply(msg.customExts.code);
66
66
  },
67
67
  className: "flex items-center h-6 px-2 py-1 bg-white rounded text-black/90 text-[10px] font-normal"
68
68
  }, "Apply")), /*#__PURE__*/React.createElement("div", {
69
- className: "flex-1 px-4 pt-2 pb-4 gap-2 flex flex-col justify-between h-full overflow-hidden"
69
+ className: "flex-1 gap-2 flex flex-col justify-between h-full overflow-hidden"
70
70
  }, /*#__PURE__*/React.createElement("div", {
71
71
  className: "code-scroll-container w-full max-h-[300px] overflow-y-auto"
72
72
  }, /*#__PURE__*/React.createElement("pre", {
@@ -202,7 +202,7 @@ var HighlyCustomChat = function HighlyCustomChat(props) {
202
202
  isMySelf: isMySelf,
203
203
  avatar: !isMySelf ? /*#__PURE__*/React.createElement("img", {
204
204
  src: headerInfo.headerImageURL || img,
205
- className: "w-[48px] h-[48px] rounded-full overflow-hidden object-fit"
205
+ className: "shrink-0 w-[48px] h-[48px] rounded-full overflow-hidden object-fit"
206
206
  }) : undefined
207
207
  });
208
208
  } else if (msg.type === "custom" && (msg === null || msg === void 0 ? void 0 : msg.customEvent) === "custom_coding") {
@@ -212,7 +212,7 @@ var HighlyCustomChat = function HighlyCustomChat(props) {
212
212
  isMySelf: isMySelf,
213
213
  avatar: !isMySelf ? /*#__PURE__*/React.createElement("img", {
214
214
  src: headerInfo.headerImageURL || img,
215
- className: "w-[48px] h-[48px] rounded-full overflow-hidden object-fit"
215
+ className: "shrink-0 w-[48px] h-[48px] rounded-full overflow-hidden object-fit"
216
216
  }) : undefined
217
217
  });
218
218
  } else if (msg.type === "custom" && (msg === null || msg === void 0 ? void 0 : msg.customEvent) === "custom_qa_guidance") {
@@ -224,7 +224,7 @@ var HighlyCustomChat = function HighlyCustomChat(props) {
224
224
  isMySelf: isMySelf,
225
225
  avatar: !isMySelf ? /*#__PURE__*/React.createElement("img", {
226
226
  src: headerInfo.headerImageURL || img,
227
- className: "w-[48px] h-[48px] rounded-full overflow-hidden object-fit"
227
+ className: "shrink-0 w-[48px] h-[48px] rounded-full overflow-hidden object-fit"
228
228
  }) : undefined
229
229
  });
230
230
  } else {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "whyuzeim",
3
- "version": "1.1.48",
3
+ "version": "1.1.50",
4
4
  "description": "im componenets",
5
5
  "main": "cjs/index.js",
6
6
  "module": "es/index.js",