whyuzeim 1.1.55 → 1.1.56

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.
@@ -425,7 +425,7 @@ var HighlyCustomChat = function HighlyCustomChat(props) {
425
425
  }, [getHeaderInfo, initConversation, props.conversationId]);
426
426
  var handleSendMessage = /*#__PURE__*/function () {
427
427
  var _ref3 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(text, extInfo) {
428
- var txtMessage, cuiScrollList, cuiScrollListWrap, existingLoader, htmlString, template, node;
428
+ var txtMessage, cuiScrollList, cuiScrollListWrap, htmlString, template, node;
429
429
  return _regeneratorRuntime.wrap(function _callee$(_context2) {
430
430
  while (1) switch (_context2.prev = _context2.next) {
431
431
  case 0:
@@ -447,26 +447,19 @@ var HighlyCustomChat = function HighlyCustomChat(props) {
447
447
  return agoraChatUikit.rootStore.messageStore.sendMessage(txtMessage);
448
448
  case 6:
449
449
  if (isAgent) {
450
- try {
451
- cuiScrollList = document.querySelector(".cui-scrollList div");
452
- cuiScrollListWrap = document.querySelector(".cui-scrollList"); // 确保不存在现有的加载指示器,防止重复添加
453
- existingLoader = document.querySelector("#agent-generating-loader");
454
- if (cuiScrollList && !existingLoader) {
455
- 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>";
456
- template = document.createElement('template');
457
- template.innerHTML = _trimInstanceProperty(htmlString).call(htmlString);
458
- node = template.content.firstChild;
459
- if (node) {
460
- cuiScrollList.appendChild(node);
461
- if (cuiScrollListWrap) {
462
- cuiScrollListWrap.scrollTo({
463
- top: 1000000000
464
- });
465
- }
466
- }
450
+ cuiScrollList = document.querySelector(".cui-messageList .cui-scrollList div");
451
+ cuiScrollListWrap = document.querySelector(".cui-scrollList");
452
+ if (cuiScrollList) {
453
+ 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>";
454
+ template = document.createElement('template');
455
+ template.innerHTML = _trimInstanceProperty(htmlString).call(htmlString);
456
+ node = template.content.firstChild;
457
+ if (node) {
458
+ cuiScrollList.appendChild(node);
459
+ cuiScrollListWrap === null || cuiScrollListWrap === void 0 || cuiScrollListWrap.scrollTo({
460
+ top: 1000000000
461
+ });
467
462
  }
468
- } catch (error) {
469
- console.error("Error adding generating loader:", error);
470
463
  }
471
464
  }
472
465
  afterSendMsg(txtMessage, extInfo);
@@ -503,22 +496,13 @@ var HighlyCustomChat = function HighlyCustomChat(props) {
503
496
  };
504
497
  }();
505
498
  React.useEffect(function () {
506
- try {
507
- var _conversationList$fin;
508
- var cuiScrollList = document.querySelector(".cui-scrollList div");
509
- var generatingLoader = document.querySelector("#agent-generating-loader");
510
- // 确保元素存在且需要移除loader
511
- if (cuiScrollList && generatingLoader && ((_conversationList$fin = _findInstanceProperty(conversationList).call(conversationList, function (item) {
512
- return item.conversationId === props.conversationId;
513
- })) === null || _conversationList$fin === void 0 || (_conversationList$fin = _conversationList$fin.lastMessage) === null || _conversationList$fin === void 0 ? void 0 : _conversationList$fin.to) !== props.conversationId) {
514
- // 使用contains方法安全地检查父子关系
515
- if (cuiScrollList.contains(generatingLoader)) {
516
- generatingLoader.remove(); // 更安全的移除方法
517
- }
518
- }
519
- } catch (error) {
520
- // 捕获并记录任何DOM操作错误,防止应用崩溃
521
- console.error("Error handling generating loader:", error);
499
+ var _conversationList$fin;
500
+ var cuiScrollList = document.querySelector(".cui-messageList .cui-scrollList div");
501
+ var generatingLoader = document.querySelector("#agent-generating-loader");
502
+ if (cuiScrollList && generatingLoader && ((_conversationList$fin = _findInstanceProperty(conversationList).call(conversationList, function (item) {
503
+ return item.conversationId === props.conversationId;
504
+ })) === null || _conversationList$fin === void 0 || (_conversationList$fin = _conversationList$fin.lastMessage) === null || _conversationList$fin === void 0 ? void 0 : _conversationList$fin.to) !== props.conversationId) {
505
+ cuiScrollList.removeChild(generatingLoader);
522
506
  }
523
507
  }, [conversationList, props.conversationId]);
524
508
  return /*#__PURE__*/React.createElement("div", {
@@ -423,7 +423,7 @@ var HighlyCustomChat = function HighlyCustomChat(props) {
423
423
  }, [getHeaderInfo, initConversation, props.conversationId]);
424
424
  var handleSendMessage = /*#__PURE__*/function () {
425
425
  var _ref3 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(text, extInfo) {
426
- var txtMessage, cuiScrollList, cuiScrollListWrap, existingLoader, htmlString, template, node;
426
+ var txtMessage, cuiScrollList, cuiScrollListWrap, htmlString, template, node;
427
427
  return _regeneratorRuntime.wrap(function _callee$(_context2) {
428
428
  while (1) switch (_context2.prev = _context2.next) {
429
429
  case 0:
@@ -445,26 +445,19 @@ var HighlyCustomChat = function HighlyCustomChat(props) {
445
445
  return rootStore.messageStore.sendMessage(txtMessage);
446
446
  case 6:
447
447
  if (isAgent) {
448
- try {
449
- cuiScrollList = document.querySelector(".cui-scrollList div");
450
- cuiScrollListWrap = document.querySelector(".cui-scrollList"); // 确保不存在现有的加载指示器,防止重复添加
451
- existingLoader = document.querySelector("#agent-generating-loader");
452
- if (cuiScrollList && !existingLoader) {
453
- 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>";
454
- template = document.createElement('template');
455
- template.innerHTML = _trimInstanceProperty(htmlString).call(htmlString);
456
- node = template.content.firstChild;
457
- if (node) {
458
- cuiScrollList.appendChild(node);
459
- if (cuiScrollListWrap) {
460
- cuiScrollListWrap.scrollTo({
461
- top: 1000000000
462
- });
463
- }
464
- }
448
+ cuiScrollList = document.querySelector(".cui-messageList .cui-scrollList div");
449
+ cuiScrollListWrap = document.querySelector(".cui-scrollList");
450
+ if (cuiScrollList) {
451
+ 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>";
452
+ template = document.createElement('template');
453
+ template.innerHTML = _trimInstanceProperty(htmlString).call(htmlString);
454
+ node = template.content.firstChild;
455
+ if (node) {
456
+ cuiScrollList.appendChild(node);
457
+ cuiScrollListWrap === null || cuiScrollListWrap === void 0 || cuiScrollListWrap.scrollTo({
458
+ top: 1000000000
459
+ });
465
460
  }
466
- } catch (error) {
467
- console.error("Error adding generating loader:", error);
468
461
  }
469
462
  }
470
463
  afterSendMsg(txtMessage, extInfo);
@@ -501,22 +494,13 @@ var HighlyCustomChat = function HighlyCustomChat(props) {
501
494
  };
502
495
  }();
503
496
  useEffect(function () {
504
- try {
505
- var _conversationList$fin;
506
- var cuiScrollList = document.querySelector(".cui-scrollList div");
507
- var generatingLoader = document.querySelector("#agent-generating-loader");
508
- // 确保元素存在且需要移除loader
509
- if (cuiScrollList && generatingLoader && ((_conversationList$fin = _findInstanceProperty(conversationList).call(conversationList, function (item) {
510
- return item.conversationId === props.conversationId;
511
- })) === null || _conversationList$fin === void 0 || (_conversationList$fin = _conversationList$fin.lastMessage) === null || _conversationList$fin === void 0 ? void 0 : _conversationList$fin.to) !== props.conversationId) {
512
- // 使用contains方法安全地检查父子关系
513
- if (cuiScrollList.contains(generatingLoader)) {
514
- generatingLoader.remove(); // 更安全的移除方法
515
- }
516
- }
517
- } catch (error) {
518
- // 捕获并记录任何DOM操作错误,防止应用崩溃
519
- console.error("Error handling generating loader:", error);
497
+ var _conversationList$fin;
498
+ var cuiScrollList = document.querySelector(".cui-messageList .cui-scrollList div");
499
+ var generatingLoader = document.querySelector("#agent-generating-loader");
500
+ if (cuiScrollList && generatingLoader && ((_conversationList$fin = _findInstanceProperty(conversationList).call(conversationList, function (item) {
501
+ return item.conversationId === props.conversationId;
502
+ })) === null || _conversationList$fin === void 0 || (_conversationList$fin = _conversationList$fin.lastMessage) === null || _conversationList$fin === void 0 ? void 0 : _conversationList$fin.to) !== props.conversationId) {
503
+ cuiScrollList.removeChild(generatingLoader);
520
504
  }
521
505
  }, [conversationList, props.conversationId]);
522
506
  return /*#__PURE__*/React.createElement("div", {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "whyuzeim",
3
- "version": "1.1.55",
3
+ "version": "1.1.56",
4
4
  "description": "im componenets",
5
5
  "main": "cjs/index.js",
6
6
  "module": "es/index.js",
@@ -1,5 +0,0 @@
1
- 'use strict';
2
-
3
- var img = "data:image/svg+xml,%3csvg width='20' height='20' viewBox='0 0 20 20' fill='none' xmlns='http://www.w3.org/2000/svg'%3e%3cpath d='M2.02273 10C2.02273 5.59427 5.59427 2.02273 10 2.02273C12.7648 2.02273 15.2025 3.42934 16.6342 5.56818H15.3182V7.34091H19.75V2.90909H17.9773V4.39303C16.2134 1.88804 13.2987 0.25 10 0.25C4.61522 0.25 0.25 4.61522 0.25 10H2.02273Z' fill='white' fill-opacity='0.4'/%3e%3cpath d='M9.99995 19.75C15.3847 19.75 19.75 15.3848 19.75 10H17.9772C17.9772 14.4057 14.4057 17.9773 9.99995 17.9773C7.23516 17.9773 4.79749 16.5707 3.36579 14.4318H4.68182V12.6591H0.25V17.0909H2.02273V15.607C3.7866 18.112 6.70132 19.75 9.99995 19.75Z' fill='white' fill-opacity='0.4'/%3e%3cpath fill-rule='evenodd' clip-rule='evenodd' d='M9.30758 5.23249L6.40385 13.4225C6.37904 13.5052 6.40799 13.5466 6.49072 13.5466H8.11631C8.19904 13.5466 8.25281 13.5052 8.27763 13.4225L8.74917 11.9458H11.7025L12.1865 13.4225C12.2113 13.5052 12.2651 13.5466 12.3478 13.5466H13.961C14.0437 13.5466 14.0727 13.5052 14.0479 13.4225L11.1938 5.23249C11.1689 5.14976 11.1152 5.1084 11.0324 5.1084H9.4689C9.38617 5.1084 9.3324 5.14976 9.30758 5.23249ZM11.2062 10.3947H9.25795L10.2134 7.44131H10.2507L11.2062 10.3947Z' fill='white' fill-opacity='0.4'/%3e%3c/svg%3e";
4
-
5
- module.exports = img;
@@ -1,5 +0,0 @@
1
- 'use strict';
2
-
3
- var img = "data:image/svg+xml,%3csvg width='24' height='24' viewBox='0 0 24 24' fill='none' xmlns='http://www.w3.org/2000/svg'%3e%3cpath d='M3 4H21V6H3V4ZM3 11H21V13H3V11ZM3 18H21V20H3V18Z' fill='black'/%3e%3c/svg%3e";
4
-
5
- module.exports = img;
@@ -1,5 +0,0 @@
1
- 'use strict';
2
-
3
- var img = "data:image/svg+xml,%3csvg width='24' height='24' viewBox='0 0 24 24' fill='none' xmlns='http://www.w3.org/2000/svg'%3e%3cg id='ic_search'%3e%3cpath id='Vector' d='M18.031 16.6168L22.3137 20.8995L20.8995 22.3137L16.6168 18.031C15.0769 19.263 13.124 20 11 20C6.032 20 2 15.968 2 11C2 6.032 6.032 2 11 2C15.968 2 20 6.032 20 11C20 13.124 19.263 15.0769 18.031 16.6168ZM16.0247 15.8748C17.2475 14.6146 18 12.8956 18 11C18 7.1325 14.8675 4 11 4C7.1325 4 4 7.1325 4 11C4 14.8675 7.1325 18 11 18C12.8956 18 14.6146 17.2475 15.8748 16.0247L16.0247 15.8748Z' fill='black'/%3e%3c/g%3e%3c/svg%3e";
4
-
5
- module.exports = img;
package/cjs/utility.d.ts DELETED
@@ -1,4 +0,0 @@
1
- import { NoticeMessageBody } from "agora-chat-uikit/types/module/noticeMessage/NoticeMessage";
2
- export declare class IMUtility {
3
- static isFromSelfWithMessage(msg: ChatSDK.MessageBody | NoticeMessageBody, userUid?: string): boolean;
4
- }
package/cjs/utility.js DELETED
@@ -1,56 +0,0 @@
1
- 'use strict';
2
-
3
- var _asyncToGenerator = require('@babel/runtime-corejs3/helpers/esm/asyncToGenerator');
4
- var _classCallCheck = require('@babel/runtime-corejs3/helpers/esm/classCallCheck');
5
- var _createClass = require('@babel/runtime-corejs3/helpers/esm/createClass');
6
- var _regeneratorRuntime = require('@babel/runtime-corejs3/regenerator');
7
- var agoraChatUikit = require('agora-chat-uikit');
8
- var SDK = require('agora-chat-uikit/types/module/SDK');
9
-
10
- var IMUtility = /*#__PURE__*/function () {
11
- function IMUtility() {
12
- _classCallCheck(this, IMUtility);
13
- }
14
- return _createClass(IMUtility, null, [{
15
- key: "isFromSelfWithMessage",
16
- value: function isFromSelfWithMessage(msg, userUid) {
17
- return (msg === null || msg === void 0 ? void 0 : msg.bySelf) === true || (msg === null || msg === void 0 ? void 0 : msg.from.toLowerCase()) === (userUid === null || userUid === void 0 ? void 0 : userUid.toLowerCase());
18
- }
19
- /*发送文本消息
20
- * @param chatChat - 私聊 or 群聊
21
- * @param msg - 消息内容
22
- * @param to - 发送目标对象(私聊用户ID或群ID)
23
- * @param ext - 扩展数据*/
24
- }, {
25
- key: "sendTxtMessage",
26
- value: (function () {
27
- var _sendTxtMessage = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(chatType, msg, to, ext) {
28
- var customMessage;
29
- return _regeneratorRuntime.wrap(function _callee$(_context) {
30
- while (1) switch (_context.prev = _context.next) {
31
- case 0:
32
- customMessage = SDK.ChatSDK.message.create({
33
- type: 'txt',
34
- msg: msg,
35
- to: to,
36
- // Need to be the user ID of the current conversation
37
- chatType: chatType,
38
- ext: ext
39
- });
40
- _context.next = 3;
41
- return agoraChatUikit.rootStore.messageStore.sendMessage(customMessage);
42
- case 3:
43
- case "end":
44
- return _context.stop();
45
- }
46
- }, _callee);
47
- }));
48
- function sendTxtMessage(_x, _x2, _x3, _x4) {
49
- return _sendTxtMessage.apply(this, arguments);
50
- }
51
- return sendTxtMessage;
52
- }())
53
- }]);
54
- }();
55
-
56
- exports.IMUtility = IMUtility;
@@ -1,3 +0,0 @@
1
- var img = "data:image/svg+xml,%3csvg width='20' height='20' viewBox='0 0 20 20' fill='none' xmlns='http://www.w3.org/2000/svg'%3e%3cpath d='M2.02273 10C2.02273 5.59427 5.59427 2.02273 10 2.02273C12.7648 2.02273 15.2025 3.42934 16.6342 5.56818H15.3182V7.34091H19.75V2.90909H17.9773V4.39303C16.2134 1.88804 13.2987 0.25 10 0.25C4.61522 0.25 0.25 4.61522 0.25 10H2.02273Z' fill='white' fill-opacity='0.4'/%3e%3cpath d='M9.99995 19.75C15.3847 19.75 19.75 15.3848 19.75 10H17.9772C17.9772 14.4057 14.4057 17.9773 9.99995 17.9773C7.23516 17.9773 4.79749 16.5707 3.36579 14.4318H4.68182V12.6591H0.25V17.0909H2.02273V15.607C3.7866 18.112 6.70132 19.75 9.99995 19.75Z' fill='white' fill-opacity='0.4'/%3e%3cpath fill-rule='evenodd' clip-rule='evenodd' d='M9.30758 5.23249L6.40385 13.4225C6.37904 13.5052 6.40799 13.5466 6.49072 13.5466H8.11631C8.19904 13.5466 8.25281 13.5052 8.27763 13.4225L8.74917 11.9458H11.7025L12.1865 13.4225C12.2113 13.5052 12.2651 13.5466 12.3478 13.5466H13.961C14.0437 13.5466 14.0727 13.5052 14.0479 13.4225L11.1938 5.23249C11.1689 5.14976 11.1152 5.1084 11.0324 5.1084H9.4689C9.38617 5.1084 9.3324 5.14976 9.30758 5.23249ZM11.2062 10.3947H9.25795L10.2134 7.44131H10.2507L11.2062 10.3947Z' fill='white' fill-opacity='0.4'/%3e%3c/svg%3e";
2
-
3
- export { img as default };
@@ -1,3 +0,0 @@
1
- var img = "data:image/svg+xml,%3csvg width='24' height='24' viewBox='0 0 24 24' fill='none' xmlns='http://www.w3.org/2000/svg'%3e%3cpath d='M3 4H21V6H3V4ZM3 11H21V13H3V11ZM3 18H21V20H3V18Z' fill='black'/%3e%3c/svg%3e";
2
-
3
- export { img as default };
@@ -1,3 +0,0 @@
1
- var img = "data:image/svg+xml,%3csvg width='24' height='24' viewBox='0 0 24 24' fill='none' xmlns='http://www.w3.org/2000/svg'%3e%3cg id='ic_search'%3e%3cpath id='Vector' d='M18.031 16.6168L22.3137 20.8995L20.8995 22.3137L16.6168 18.031C15.0769 19.263 13.124 20 11 20C6.032 20 2 15.968 2 11C2 6.032 6.032 2 11 2C15.968 2 20 6.032 20 11C20 13.124 19.263 15.0769 18.031 16.6168ZM16.0247 15.8748C17.2475 14.6146 18 12.8956 18 11C18 7.1325 14.8675 4 11 4C7.1325 4 4 7.1325 4 11C4 14.8675 7.1325 18 11 18C12.8956 18 14.6146 17.2475 15.8748 16.0247L16.0247 15.8748Z' fill='black'/%3e%3c/g%3e%3c/svg%3e";
2
-
3
- export { img as default };
package/es/utility.d.ts DELETED
@@ -1,4 +0,0 @@
1
- import { NoticeMessageBody } from "agora-chat-uikit/types/module/noticeMessage/NoticeMessage";
2
- export declare class IMUtility {
3
- static isFromSelfWithMessage(msg: ChatSDK.MessageBody | NoticeMessageBody, userUid?: string): boolean;
4
- }
package/es/utility.js DELETED
@@ -1,54 +0,0 @@
1
- import _asyncToGenerator from '@babel/runtime-corejs3/helpers/esm/asyncToGenerator';
2
- import _classCallCheck from '@babel/runtime-corejs3/helpers/esm/classCallCheck';
3
- import _createClass from '@babel/runtime-corejs3/helpers/esm/createClass';
4
- import _regeneratorRuntime from '@babel/runtime-corejs3/regenerator';
5
- import { rootStore } from 'agora-chat-uikit';
6
- import { ChatSDK } from 'agora-chat-uikit/types/module/SDK';
7
-
8
- var IMUtility = /*#__PURE__*/function () {
9
- function IMUtility() {
10
- _classCallCheck(this, IMUtility);
11
- }
12
- return _createClass(IMUtility, null, [{
13
- key: "isFromSelfWithMessage",
14
- value: function isFromSelfWithMessage(msg, userUid) {
15
- return (msg === null || msg === void 0 ? void 0 : msg.bySelf) === true || (msg === null || msg === void 0 ? void 0 : msg.from.toLowerCase()) === (userUid === null || userUid === void 0 ? void 0 : userUid.toLowerCase());
16
- }
17
- /*发送文本消息
18
- * @param chatChat - 私聊 or 群聊
19
- * @param msg - 消息内容
20
- * @param to - 发送目标对象(私聊用户ID或群ID)
21
- * @param ext - 扩展数据*/
22
- }, {
23
- key: "sendTxtMessage",
24
- value: (function () {
25
- var _sendTxtMessage = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(chatType, msg, to, ext) {
26
- var customMessage;
27
- return _regeneratorRuntime.wrap(function _callee$(_context) {
28
- while (1) switch (_context.prev = _context.next) {
29
- case 0:
30
- customMessage = ChatSDK.message.create({
31
- type: 'txt',
32
- msg: msg,
33
- to: to,
34
- // Need to be the user ID of the current conversation
35
- chatType: chatType,
36
- ext: ext
37
- });
38
- _context.next = 3;
39
- return rootStore.messageStore.sendMessage(customMessage);
40
- case 3:
41
- case "end":
42
- return _context.stop();
43
- }
44
- }, _callee);
45
- }));
46
- function sendTxtMessage(_x, _x2, _x3, _x4) {
47
- return _sendTxtMessage.apply(this, arguments);
48
- }
49
- return sendTxtMessage;
50
- }())
51
- }]);
52
- }();
53
-
54
- export { IMUtility };