whyuzeim 1.1.19 → 1.1.20
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/HighlyCustomChat/index.d.ts +1 -0
- package/cjs/HighlyCustomChat/index.js +25 -6
- package/cjs/HighlyCustomChat/style/index.scss +16 -0
- package/es/HighlyCustomChat/index.d.ts +1 -0
- package/es/HighlyCustomChat/index.js +25 -6
- package/es/HighlyCustomChat/style/index.scss +16 -0
- package/package.json +1 -1
|
@@ -2,6 +2,7 @@ import React from "react";
|
|
|
2
2
|
import { Conversation } from "agora-chat-uikit";
|
|
3
3
|
import { ChatSDK } from "agora-chat-uikit/types/module/SDK";
|
|
4
4
|
import { ChatType } from "agora-chat-uikit/types/module/types/messageType";
|
|
5
|
+
import "./style/index.scss";
|
|
5
6
|
export interface IHighlyCustomChat {
|
|
6
7
|
conversationId: string;
|
|
7
8
|
chatType: ChatType;
|
|
@@ -24,6 +24,7 @@ var type = require('../type.js');
|
|
|
24
24
|
var tools = require('../tools.js');
|
|
25
25
|
var avatar_default = require('../Icon/avatar_default.svg.js');
|
|
26
26
|
var encryption = require('../IM/encryption.js');
|
|
27
|
+
require('./style/index.scss');
|
|
27
28
|
|
|
28
29
|
function ownKeys(e, r) { var t = _Object$keys(e); if (_Object$getOwnPropertySymbols) { var o = _Object$getOwnPropertySymbols(e); r && (o = _filterInstanceProperty(o).call(o, function (r) { return _Object$getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
29
30
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var _context4, _context5; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty(_context4 = ownKeys(Object(t), true)).call(_context4, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(e, _Object$getOwnPropertyDescriptors(t)) : _forEachInstanceProperty(_context5 = ownKeys(Object(t))).call(_context5, function (r) { _Object$defineProperty(e, r, _Object$getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
@@ -63,6 +64,7 @@ var HighlyCustomChat = function HighlyCustomChat(props) {
|
|
|
63
64
|
_useState8 = _slicedToArray(_useState7, 2);
|
|
64
65
|
_useState8[0];
|
|
65
66
|
var setIsAgent = _useState8[1];
|
|
67
|
+
React.useRef(null);
|
|
66
68
|
var renderTxtMsg = function renderTxtMsg(msg) {
|
|
67
69
|
var _userInfo$uid;
|
|
68
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());
|
|
@@ -374,7 +376,7 @@ var HighlyCustomChat = function HighlyCustomChat(props) {
|
|
|
374
376
|
}, [getHeaderInfo, initConversation, props.conversationId]);
|
|
375
377
|
var handleSendMessage = /*#__PURE__*/function () {
|
|
376
378
|
var _ref3 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(text) {
|
|
377
|
-
var txtMessage;
|
|
379
|
+
var txtMessage, cuiScrollList, cuiScrollListWrap, htmlString, template, node;
|
|
378
380
|
return _regeneratorRuntime.wrap(function _callee$(_context2) {
|
|
379
381
|
while (1) switch (_context2.prev = _context2.next) {
|
|
380
382
|
case 0:
|
|
@@ -395,18 +397,35 @@ var HighlyCustomChat = function HighlyCustomChat(props) {
|
|
|
395
397
|
_context2.next = 6;
|
|
396
398
|
return agoraChatUikit.rootStore.messageStore.sendMessage(txtMessage);
|
|
397
399
|
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
|
+
// `)
|
|
416
|
+
}
|
|
398
417
|
afterSendMsg(txtMessage);
|
|
399
|
-
_context2.next =
|
|
418
|
+
_context2.next = 15;
|
|
400
419
|
break;
|
|
401
|
-
case
|
|
402
|
-
_context2.prev =
|
|
420
|
+
case 12:
|
|
421
|
+
_context2.prev = 12;
|
|
403
422
|
_context2.t0 = _context2["catch"](2);
|
|
404
423
|
console.log("send txt message failed", _context2.t0);
|
|
405
|
-
case
|
|
424
|
+
case 15:
|
|
406
425
|
case "end":
|
|
407
426
|
return _context2.stop();
|
|
408
427
|
}
|
|
409
|
-
}, _callee, null, [[2,
|
|
428
|
+
}, _callee, null, [[2, 12]]);
|
|
410
429
|
}));
|
|
411
430
|
return function handleSendMessage(_x) {
|
|
412
431
|
return _ref3.apply(this, arguments);
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
.generating-loader {
|
|
2
|
+
width: 4px;
|
|
3
|
+
aspect-ratio: 1;
|
|
4
|
+
border-radius: 50%;
|
|
5
|
+
animation: l5 1s infinite linear alternate;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
@keyframes l5 {
|
|
9
|
+
0% { box-shadow: 8px 0 #000, -8px 0 #0002; background: #000; }
|
|
10
|
+
33% { box-shadow: 8px 0 #000, -8px 0 #0002; background: #0002; }
|
|
11
|
+
88% { box-shadow: 8px 0 #0002, -8px 0 #000; background: #0002; }
|
|
12
|
+
100% { box-shadow: 8px 0 #0002, -8px 0 #000; background: #000; }
|
|
13
|
+
}
|
|
14
|
+
.generating-loader-wrap{
|
|
15
|
+
margin: 0 12px 0 8px;
|
|
16
|
+
}
|
|
@@ -2,6 +2,7 @@ import React from "react";
|
|
|
2
2
|
import { Conversation } from "agora-chat-uikit";
|
|
3
3
|
import { ChatSDK } from "agora-chat-uikit/types/module/SDK";
|
|
4
4
|
import { ChatType } from "agora-chat-uikit/types/module/types/messageType";
|
|
5
|
+
import "./style/index.scss";
|
|
5
6
|
export interface IHighlyCustomChat {
|
|
6
7
|
conversationId: string;
|
|
7
8
|
chatType: ChatType;
|
|
@@ -22,6 +22,7 @@ import { commonMessageInputConfig, commonMessageProps } from '../type.js';
|
|
|
22
22
|
import { reportAgentInUse } from '../tools.js';
|
|
23
23
|
import img from '../Icon/avatar_default.svg.js';
|
|
24
24
|
import { aesKey, aesDecrypt } from '../IM/encryption.js';
|
|
25
|
+
import './style/index.scss';
|
|
25
26
|
|
|
26
27
|
function ownKeys(e, r) { var t = _Object$keys(e); if (_Object$getOwnPropertySymbols) { var o = _Object$getOwnPropertySymbols(e); r && (o = _filterInstanceProperty(o).call(o, function (r) { return _Object$getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
27
28
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var _context4, _context5; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty(_context4 = ownKeys(Object(t), true)).call(_context4, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(e, _Object$getOwnPropertyDescriptors(t)) : _forEachInstanceProperty(_context5 = ownKeys(Object(t))).call(_context5, function (r) { _Object$defineProperty(e, r, _Object$getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
@@ -61,6 +62,7 @@ var HighlyCustomChat = function HighlyCustomChat(props) {
|
|
|
61
62
|
_useState8 = _slicedToArray(_useState7, 2);
|
|
62
63
|
_useState8[0];
|
|
63
64
|
var setIsAgent = _useState8[1];
|
|
65
|
+
useRef(null);
|
|
64
66
|
var renderTxtMsg = function renderTxtMsg(msg) {
|
|
65
67
|
var _userInfo$uid;
|
|
66
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());
|
|
@@ -372,7 +374,7 @@ var HighlyCustomChat = function HighlyCustomChat(props) {
|
|
|
372
374
|
}, [getHeaderInfo, initConversation, props.conversationId]);
|
|
373
375
|
var handleSendMessage = /*#__PURE__*/function () {
|
|
374
376
|
var _ref3 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(text) {
|
|
375
|
-
var txtMessage;
|
|
377
|
+
var txtMessage, cuiScrollList, cuiScrollListWrap, htmlString, template, node;
|
|
376
378
|
return _regeneratorRuntime.wrap(function _callee$(_context2) {
|
|
377
379
|
while (1) switch (_context2.prev = _context2.next) {
|
|
378
380
|
case 0:
|
|
@@ -393,18 +395,35 @@ var HighlyCustomChat = function HighlyCustomChat(props) {
|
|
|
393
395
|
_context2.next = 6;
|
|
394
396
|
return rootStore.messageStore.sendMessage(txtMessage);
|
|
395
397
|
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
|
+
// `)
|
|
414
|
+
}
|
|
396
415
|
afterSendMsg(txtMessage);
|
|
397
|
-
_context2.next =
|
|
416
|
+
_context2.next = 15;
|
|
398
417
|
break;
|
|
399
|
-
case
|
|
400
|
-
_context2.prev =
|
|
418
|
+
case 12:
|
|
419
|
+
_context2.prev = 12;
|
|
401
420
|
_context2.t0 = _context2["catch"](2);
|
|
402
421
|
console.log("send txt message failed", _context2.t0);
|
|
403
|
-
case
|
|
422
|
+
case 15:
|
|
404
423
|
case "end":
|
|
405
424
|
return _context2.stop();
|
|
406
425
|
}
|
|
407
|
-
}, _callee, null, [[2,
|
|
426
|
+
}, _callee, null, [[2, 12]]);
|
|
408
427
|
}));
|
|
409
428
|
return function handleSendMessage(_x) {
|
|
410
429
|
return _ref3.apply(this, arguments);
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
.generating-loader {
|
|
2
|
+
width: 4px;
|
|
3
|
+
aspect-ratio: 1;
|
|
4
|
+
border-radius: 50%;
|
|
5
|
+
animation: l5 1s infinite linear alternate;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
@keyframes l5 {
|
|
9
|
+
0% { box-shadow: 8px 0 #000, -8px 0 #0002; background: #000; }
|
|
10
|
+
33% { box-shadow: 8px 0 #000, -8px 0 #0002; background: #0002; }
|
|
11
|
+
88% { box-shadow: 8px 0 #0002, -8px 0 #000; background: #0002; }
|
|
12
|
+
100% { box-shadow: 8px 0 #0002, -8px 0 #000; background: #000; }
|
|
13
|
+
}
|
|
14
|
+
.generating-loader-wrap{
|
|
15
|
+
margin: 0 12px 0 8px;
|
|
16
|
+
}
|