whyuzeim 1.1.61 → 1.1.63

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.
@@ -40,8 +40,8 @@ var CustomChatView = function CustomChatView(props) {
40
40
  _useState2 = _slicedToArray(_useState, 2),
41
41
  headerInfo = _useState2[0],
42
42
  setHeaderInfo = _useState2[1];
43
- var _useSDK = agoraChatUikit.useSDK(),
44
- MessageSDK = _useSDK.ChatSDK;
43
+ var _useSDK = agoraChatUikit.useSDK();
44
+ _useSDK.ChatSDK;
45
45
  var getHeaderInfo = function getHeaderInfo() {
46
46
  var _context;
47
47
  var cvs = _findInstanceProperty(_context = agoraChatUikit.rootStore.conversationStore.conversationList).call(_context, function (cvs) {
@@ -292,23 +292,19 @@ var CustomChatView = function CustomChatView(props) {
292
292
  };
293
293
  }();
294
294
  var postMessage = /*#__PURE__*/function () {
295
- var _ref8 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee5(msg) {
296
- var customMessage;
295
+ var _ref8 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee5(msgInfo) {
297
296
  return _regeneratorRuntime.wrap(function _callee5$(_context6) {
298
297
  while (1) switch (_context6.prev = _context6.next) {
299
298
  case 0:
300
- customMessage = MessageSDK.message.create({
301
- type: 'txt',
302
- msg: msg,
303
- to: curAgentId || '',
304
- // Need to be the user ID of the current conversation
305
- chatType: 'singleChat'
306
- });
307
- _context6.next = 3;
308
- return agoraChatUikit.rootStore.messageStore.sendMessage(customMessage);
309
- case 3:
310
- sendAgentMsg(curAgentId, msg);
311
- case 4:
299
+ // const customMessage = MessageSDK.message.create({
300
+ // type: 'txt',
301
+ // msg,
302
+ // to: curAgentId || '', // Need to be the user ID of the current conversation
303
+ // chatType: 'singleChat'
304
+ // });
305
+ // await rootStore.messageStore.sendMessage(customMessage)
306
+ sendAgentMsg(curAgentId, msgInfo.msg);
307
+ case 1:
312
308
  case "end":
313
309
  return _context6.stop();
314
310
  }
@@ -18,6 +18,7 @@ var _setInterval = require('@babel/runtime-corejs3/core-js-stable/set-interval')
18
18
  var _trimInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/trim');
19
19
  var React = require('react');
20
20
  var agoraChatUikit = require('agora-chat-uikit');
21
+ var ReactMarkdown = require('react-markdown');
21
22
  var jsrsasign = require('jsrsasign');
22
23
  var context = require('../IM/context.js');
23
24
  var type = require('../type.js');
@@ -138,7 +139,7 @@ var HighlyCustomChat = function HighlyCustomChat(props) {
138
139
  className: "inline-block"
139
140
  }, /*#__PURE__*/React.createElement("span", {
140
141
  className: "cui-message-text"
141
- }, msg.msg)), /*#__PURE__*/React.createElement("span", {
142
+ }, /*#__PURE__*/React.createElement(ReactMarkdown, null, msg.msg))), /*#__PURE__*/React.createElement("span", {
142
143
  className: "cui-message-base-time"
143
144
  }, formatMessageTime(msg.time)));
144
145
  };
@@ -38,8 +38,8 @@ var CustomChatView = function CustomChatView(props) {
38
38
  _useState2 = _slicedToArray(_useState, 2),
39
39
  headerInfo = _useState2[0],
40
40
  setHeaderInfo = _useState2[1];
41
- var _useSDK = useSDK(),
42
- MessageSDK = _useSDK.ChatSDK;
41
+ var _useSDK = useSDK();
42
+ _useSDK.ChatSDK;
43
43
  var getHeaderInfo = function getHeaderInfo() {
44
44
  var _context;
45
45
  var cvs = _findInstanceProperty(_context = rootStore.conversationStore.conversationList).call(_context, function (cvs) {
@@ -290,23 +290,19 @@ var CustomChatView = function CustomChatView(props) {
290
290
  };
291
291
  }();
292
292
  var postMessage = /*#__PURE__*/function () {
293
- var _ref8 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee5(msg) {
294
- var customMessage;
293
+ var _ref8 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee5(msgInfo) {
295
294
  return _regeneratorRuntime.wrap(function _callee5$(_context6) {
296
295
  while (1) switch (_context6.prev = _context6.next) {
297
296
  case 0:
298
- customMessage = MessageSDK.message.create({
299
- type: 'txt',
300
- msg: msg,
301
- to: curAgentId || '',
302
- // Need to be the user ID of the current conversation
303
- chatType: 'singleChat'
304
- });
305
- _context6.next = 3;
306
- return rootStore.messageStore.sendMessage(customMessage);
307
- case 3:
308
- sendAgentMsg(curAgentId, msg);
309
- case 4:
297
+ // const customMessage = MessageSDK.message.create({
298
+ // type: 'txt',
299
+ // msg,
300
+ // to: curAgentId || '', // Need to be the user ID of the current conversation
301
+ // chatType: 'singleChat'
302
+ // });
303
+ // await rootStore.messageStore.sendMessage(customMessage)
304
+ sendAgentMsg(curAgentId, msgInfo.msg);
305
+ case 1:
310
306
  case "end":
311
307
  return _context6.stop();
312
308
  }
@@ -16,6 +16,7 @@ import _setInterval from '@babel/runtime-corejs3/core-js-stable/set-interval';
16
16
  import _trimInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/trim';
17
17
  import React, { useRef, useContext, useState, useCallback, useEffect } from 'react';
18
18
  import { useClient, useSDK, useConversationContext, rootStore, MessageList, MessageInput, ImageMessage, FileMessage, VideoMessage, BaseMessage } from 'agora-chat-uikit';
19
+ import ReactMarkdown from 'react-markdown';
19
20
  import jsrsasign from 'jsrsasign';
20
21
  import { Context } from '../IM/context.js';
21
22
  import { commonMessageInputConfig, commonMessageProps } from '../type.js';
@@ -136,7 +137,7 @@ var HighlyCustomChat = function HighlyCustomChat(props) {
136
137
  className: "inline-block"
137
138
  }, /*#__PURE__*/React.createElement("span", {
138
139
  className: "cui-message-text"
139
- }, msg.msg)), /*#__PURE__*/React.createElement("span", {
140
+ }, /*#__PURE__*/React.createElement(ReactMarkdown, null, msg.msg))), /*#__PURE__*/React.createElement("span", {
140
141
  className: "cui-message-base-time"
141
142
  }, formatMessageTime(msg.time)));
142
143
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "whyuzeim",
3
- "version": "1.1.61",
3
+ "version": "1.1.63",
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 };