whyuzeim 1.0.0 → 1.0.2

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.
Files changed (37) hide show
  1. package/cjs/AddMember/index.js +2 -2
  2. package/cjs/ChatBox/index.js +16 -1
  3. package/cjs/ContactList/index.js +41 -16
  4. package/cjs/CustomChatView/image/set.svg.js +5 -0
  5. package/cjs/CustomChatView/index.d.ts +3 -0
  6. package/cjs/CustomChatView/index.js +280 -17
  7. package/cjs/CustomChatView/style/index.scss +7 -0
  8. package/cjs/GroupDetail/GroupShareView/index.js +4 -2
  9. package/cjs/IM/style/index.scss +25 -1
  10. package/cjs/Sidebar/CreateGroup/index.js +55 -29
  11. package/cjs/Sidebar/CustomConversationItem/OperateBtn/index.js +4 -4
  12. package/cjs/Sidebar/GroupList/OperateBtn/index.js +11 -7
  13. package/cjs/Sidebar/GroupList/index.js +2 -3
  14. package/cjs/Sidebar/MobileCreateGroup/index.js +4 -4
  15. package/cjs/Sidebar/MobileCreateGroup/style/index.scss +6 -7
  16. package/cjs/Sidebar/Searchbox/index.js +47 -20
  17. package/cjs/Sidebar/index.js +7 -3
  18. package/cjs/TypeItem/OperateBtn/index.js +5 -5
  19. package/es/AddMember/index.js +2 -2
  20. package/es/ChatBox/index.js +16 -1
  21. package/es/ContactList/index.js +42 -17
  22. package/es/CustomChatView/image/set.svg.js +3 -0
  23. package/es/CustomChatView/index.d.ts +3 -0
  24. package/es/CustomChatView/index.js +282 -19
  25. package/es/CustomChatView/style/index.scss +7 -0
  26. package/es/GroupDetail/GroupShareView/index.js +4 -2
  27. package/es/IM/style/index.scss +25 -1
  28. package/es/Sidebar/CreateGroup/index.js +56 -30
  29. package/es/Sidebar/CustomConversationItem/OperateBtn/index.js +4 -4
  30. package/es/Sidebar/GroupList/OperateBtn/index.js +11 -7
  31. package/es/Sidebar/GroupList/index.js +2 -3
  32. package/es/Sidebar/MobileCreateGroup/index.js +4 -4
  33. package/es/Sidebar/MobileCreateGroup/style/index.scss +6 -7
  34. package/es/Sidebar/Searchbox/index.js +48 -21
  35. package/es/Sidebar/index.js +7 -3
  36. package/es/TypeItem/OperateBtn/index.js +5 -5
  37. package/package.json +15 -4
@@ -14,7 +14,7 @@ var index = require('../ContactList/index.js');
14
14
  var index$1 = require('../TypeItem/index.js');
15
15
  var context = require('../IM/context.js');
16
16
  var antd = require('antd');
17
- var usehooksTs = require('usehooks-ts');
17
+ var useDebounce = require('use-debounce');
18
18
  require('./style/index.scss');
19
19
 
20
20
  var AddMember = function AddMember() {
@@ -48,7 +48,7 @@ var AddMember = function AddMember() {
48
48
  }
49
49
  }, _callee);
50
50
  })), [http, memberids, setRightComponent]);
51
- var handleDebouncdAddMember = usehooksTs.useDebounceCallback(handleAddMember, 100);
51
+ var handleDebouncdAddMember = useDebounce.useDebouncedCallback(handleAddMember, 100);
52
52
  return /*#__PURE__*/React.createElement("div", {
53
53
  className: classNames("yuze-addMember w-full h-full")
54
54
  }, /*#__PURE__*/React.createElement("div", {
@@ -77,7 +77,10 @@ var Chatbox = function Chatbox(props) {
77
77
  reaction: false,
78
78
  select: false,
79
79
  thread: false,
80
- customAction: (_ref = type.commonMessageProps && (type.commonMessageProps === null || type.commonMessageProps === void 0 ? void 0 : type.commonMessageProps.customAction)) !== null && _ref !== void 0 ? _ref : undefined
80
+ customAction: (_ref = type.commonMessageProps && (type.commonMessageProps === null || type.commonMessageProps === void 0 ? void 0 : type.commonMessageProps.customAction)) !== null && _ref !== void 0 ? _ref : undefined,
81
+ renderUserProfile: function renderUserProfile() {
82
+ return null;
83
+ }
81
84
  });
82
85
  };
83
86
  var renderShareCardMsg = function renderShareCardMsg(msg) {
@@ -109,6 +112,9 @@ var Chatbox = function Chatbox(props) {
109
112
  select: false,
110
113
  thread: false,
111
114
  customAction: (_ref2 = type.commonMessageProps && (type.commonMessageProps === null || type.commonMessageProps === void 0 ? void 0 : type.commonMessageProps.customAction)) !== null && _ref2 !== void 0 ? _ref2 : undefined,
115
+ renderUserProfile: function renderUserProfile() {
116
+ return null;
117
+ },
112
118
  imageMessage: msg
113
119
  });
114
120
  } else if (msg.type === 'file') {
@@ -123,6 +129,9 @@ var Chatbox = function Chatbox(props) {
123
129
  padding: "10px 12px",
124
130
  color: "var(--im-msg-bubble-font-color)"
125
131
  },
132
+ renderUserProfile: function renderUserProfile() {
133
+ return null;
134
+ },
126
135
  customAction: (_ref3 = type.commonMessageProps && (type.commonMessageProps === null || type.commonMessageProps === void 0 ? void 0 : type.commonMessageProps.customAction)) !== null && _ref3 !== void 0 ? _ref3 : undefined,
127
136
  fileMessage: msg
128
137
  });
@@ -132,6 +141,9 @@ var Chatbox = function Chatbox(props) {
132
141
  reaction: false,
133
142
  select: false,
134
143
  thread: false,
144
+ renderUserProfile: function renderUserProfile() {
145
+ return null;
146
+ },
135
147
  customAction: (_ref4 = type.commonMessageProps && (type.commonMessageProps === null || type.commonMessageProps === void 0 ? void 0 : type.commonMessageProps.customAction)) !== null && _ref4 !== void 0 ? _ref4 : undefined,
136
148
  videoMessage: msg
137
149
  });
@@ -158,6 +170,9 @@ var Chatbox = function Chatbox(props) {
158
170
  select: false,
159
171
  thread: false,
160
172
  direction: isMySelf ? 'rtl' : 'ltr',
173
+ renderUserProfile: function renderUserProfile() {
174
+ return null;
175
+ },
161
176
  customAction: (_ref6 = type.commonMessageProps && (type.commonMessageProps === null || type.commonMessageProps === void 0 ? void 0 : type.commonMessageProps.customAction)) !== null && _ref6 !== void 0 ? _ref6 : undefined,
162
177
  children: renderShareCardMsg(msg)
163
178
  });
@@ -1,14 +1,17 @@
1
1
  'use strict';
2
2
 
3
+ var _toConsumableArray = require('@babel/runtime-corejs3/helpers/esm/toConsumableArray');
3
4
  var _asyncToGenerator = require('@babel/runtime-corejs3/helpers/esm/asyncToGenerator');
4
5
  var _slicedToArray = require('@babel/runtime-corejs3/helpers/esm/slicedToArray');
5
- var _mapInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/map');
6
6
  var _regeneratorRuntime = require('@babel/runtime-corejs3/regenerator');
7
+ var _concatInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/concat');
8
+ var _mapInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/map');
7
9
  var React = require('react');
10
+ var InfiniteScroll = require('react-infinite-scroll-component');
8
11
  require('./style/index.scss');
9
12
  var context = require('../IM/context.js');
10
13
  var agoraChatUikit = require('agora-chat-uikit');
11
- var usehooksTs = require('usehooks-ts');
14
+ var useDebounce = require('use-debounce');
12
15
  var classNames = require('classnames');
13
16
  var index = require('../NoData/index.js');
14
17
 
@@ -20,29 +23,39 @@ var ContactList = function ContactList(props) {
20
23
  _useState2 = _slicedToArray(_useState, 2),
21
24
  list = _useState2[0],
22
25
  setList = _useState2[1];
26
+ var listRef = React.useRef(null);
27
+ var _useState3 = React.useState(0),
28
+ _useState4 = _slicedToArray(_useState3, 2),
29
+ total = _useState4[0],
30
+ setTotal = _useState4[1];
31
+ var pageRef = React.useRef(0);
23
32
  var _useContext = React.useContext(context.Context),
24
33
  http = _useContext.http;
25
34
  var handleGetFrindList = React.useCallback(/*#__PURE__*/function () {
26
35
  var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(keyword) {
27
- var result, list;
28
- return _regeneratorRuntime.wrap(function _callee$(_context) {
29
- while (1) switch (_context.prev = _context.next) {
36
+ var _context;
37
+ var result, _result$data$data, data, total;
38
+ return _regeneratorRuntime.wrap(function _callee$(_context2) {
39
+ while (1) switch (_context2.prev = _context2.next) {
30
40
  case 0:
31
- _context.next = 2;
41
+ pageRef.current = pageRef.current + 1;
42
+ _context2.next = 3;
32
43
  return http.post("/capi/account/imsearch/findpage", {
33
44
  keyword: keyword,
34
45
  type: 2,
35
46
  userid: agoraChatUikit.rootStore.initConfig.userId,
36
47
  size: 10,
37
- page: 1
48
+ page: pageRef.current
38
49
  });
39
- case 2:
40
- result = _context.sent;
41
- list = result.data.data.list;
42
- setList(list);
43
- case 5:
50
+ case 3:
51
+ result = _context2.sent;
52
+ _result$data$data = result.data.data, data = _result$data$data.list, total = _result$data$data.total;
53
+ listRef.current = !listRef.current ? data : _concatInstanceProperty(_context = []).call(_context, _toConsumableArray(listRef.current), _toConsumableArray(data));
54
+ setList(listRef.current);
55
+ setTotal(total);
56
+ case 8:
44
57
  case "end":
45
- return _context.stop();
58
+ return _context2.stop();
46
59
  }
47
60
  }, _callee);
48
61
  }));
@@ -50,15 +63,27 @@ var ContactList = function ContactList(props) {
50
63
  return _ref.apply(this, arguments);
51
64
  };
52
65
  }(), [http]);
53
- var handleDebounceFriendList = usehooksTs.useDebounceCallback(handleGetFrindList, 500);
66
+ var handleDebounceFriendList = useDebounce.useDebouncedCallback(handleGetFrindList, 100);
54
67
  React.useEffect(function () {
68
+ pageRef.current = 0;
69
+ listRef.current = [];
55
70
  handleDebounceFriendList(keyword);
56
71
  }, [handleDebounceFriendList, keyword]);
57
72
  return /*#__PURE__*/React.createElement("div", {
58
- className: classNames("yuze-contactList w-full overflow-auto", className)
73
+ className: classNames("yuze-contactList w-full overflow-auto", className),
74
+ id: "contactList"
75
+ }, /*#__PURE__*/React.createElement(InfiniteScroll, {
76
+ dataLength: (list === null || list === void 0 ? void 0 : list.length) || 0,
77
+ next: handleGetFrindList,
78
+ inverse: false //
79
+ ,
80
+ hasMore: ((list === null || list === void 0 ? void 0 : list.length) || 0) < total,
81
+ scrollableTarget: "contactList",
82
+ loader: /*#__PURE__*/React.createElement(React.Fragment, null),
83
+ className: "h-full"
59
84
  }, list === null || list === void 0 ? void 0 : _mapInstanceProperty(list).call(list, function (item) {
60
85
  return renderItem(item);
61
- }), (list === null || list === void 0 ? void 0 : list.length) === 0 && /*#__PURE__*/React.createElement(index, null));
86
+ })), (list === null || list === void 0 ? void 0 : list.length) === 0 && /*#__PURE__*/React.createElement(index, null));
62
87
  };
63
88
 
64
89
  module.exports = ContactList;
@@ -0,0 +1,5 @@
1
+ 'use strict';
2
+
3
+ var img = "data:image/svg+xml,%3csvg width='16' height='17' viewBox='0 0 16 17' fill='none' xmlns='http://www.w3.org/2000/svg'%3e%3cg id='Config (%26%23233%3b%26%23133%3b%26%23141%3b%26%23231%3b%26%23189%3b%26%23174%3b)'%3e%3cpath id='Vector' d='M8.00016 1.83337L6.00016 3.83337H3.3335V6.50004L1.3335 8.50004L3.3335 10.5V13.1667H6.00016L8.00016 15.1667L10.0002 13.1667H12.6668V10.5L14.6668 8.50004L12.6668 6.50004V3.83337H10.0002L8.00016 1.83337Z' fill='black' fill-opacity='0.9' stroke='black' stroke-opacity='0.9' stroke-width='2' stroke-linejoin='round'/%3e%3cpath id='Vector_2' d='M8 10.5C9.10457 10.5 10 9.60457 10 8.5C10 7.39543 9.10457 6.5 8 6.5C6.89543 6.5 6 7.39543 6 8.5C6 9.60457 6.89543 10.5 8 10.5Z' fill='white' stroke='white' stroke-width='2' stroke-linejoin='round'/%3e%3c/g%3e%3c/svg%3e";
4
+
5
+ module.exports = img;
@@ -1,9 +1,12 @@
1
1
  import React from "react";
2
2
  import { ChatType } from "agora-chat-uikit/types/module/types/messageType";
3
+ import "./style/index.scss";
3
4
  export interface ICustomChatbox {
4
5
  conversationId: string;
5
6
  chatType: ChatType;
6
7
  className?: string;
8
+ tokenId?: string;
9
+ tokenName?: string;
7
10
  }
8
11
  declare const CustomChatView: React.FC<ICustomChatbox>;
9
12
  export default CustomChatView;
@@ -15,14 +15,17 @@ var _regeneratorRuntime = require('@babel/runtime-corejs3/regenerator');
15
15
  var _findInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/find');
16
16
  var _forEachInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/for-each');
17
17
  var _JSON$stringify = require('@babel/runtime-corejs3/core-js-stable/json/stringify');
18
+ var _mapInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/map');
18
19
  var React = require('react');
19
20
  var agoraChatUikit = require('agora-chat-uikit');
20
21
  var context = require('../IM/context.js');
21
22
  var antd = require('antd');
22
23
  var type = require('../type.js');
24
+ var set = require('./image/set.svg.js');
25
+ require('./style/index.scss');
23
26
 
24
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; }
25
- 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; }
28
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var _context10, _context11; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty(_context10 = ownKeys(Object(t), true)).call(_context10, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(e, _Object$getOwnPropertyDescriptors(t)) : _forEachInstanceProperty(_context11 = ownKeys(Object(t))).call(_context11, function (r) { _Object$defineProperty(e, r, _Object$getOwnPropertyDescriptor(t, r)); }); } return e; }
26
29
  var CustomChatView = function CustomChatView(props) {
27
30
  var _props$className;
28
31
  var _useContext = React.useContext(context.Context),
@@ -44,11 +47,14 @@ var CustomChatView = function CustomChatView(props) {
44
47
  headerImageURL: '',
45
48
  conversationName: '',
46
49
  memberCount: 0,
47
- chatType: 'singleChat'
50
+ chatType: 'singleChat',
51
+ conversationId: ''
48
52
  }),
49
53
  _useState6 = _slicedToArray(_useState5, 2),
50
54
  headerInfo = _useState6[0],
51
55
  setHeaderInfo = _useState6[1];
56
+ var _useSDK = agoraChatUikit.useSDK(),
57
+ MessageSDK = _useSDK.ChatSDK;
52
58
  var renderTxtMsg = function renderTxtMsg(msg) {
53
59
  var _userInfo$uid, _ref;
54
60
  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());
@@ -66,6 +72,9 @@ var CustomChatView = function CustomChatView(props) {
66
72
  reaction: false,
67
73
  select: false,
68
74
  thread: false,
75
+ renderUserProfile: function renderUserProfile() {
76
+ return null;
77
+ },
69
78
  customAction: (_ref = type.commonMessageProps && (type.commonMessageProps === null || type.commonMessageProps === void 0 ? void 0 : type.commonMessageProps.customAction)) !== null && _ref !== void 0 ? _ref : undefined
70
79
  });
71
80
  };
@@ -97,6 +106,9 @@ var CustomChatView = function CustomChatView(props) {
97
106
  reaction: false,
98
107
  select: false,
99
108
  thread: false,
109
+ renderUserProfile: function renderUserProfile() {
110
+ return null;
111
+ },
100
112
  customAction: (_ref2 = type.commonMessageProps && (type.commonMessageProps === null || type.commonMessageProps === void 0 ? void 0 : type.commonMessageProps.customAction)) !== null && _ref2 !== void 0 ? _ref2 : undefined,
101
113
  imageMessage: msg
102
114
  });
@@ -112,6 +124,9 @@ var CustomChatView = function CustomChatView(props) {
112
124
  reaction: false,
113
125
  select: false,
114
126
  thread: false,
127
+ renderUserProfile: function renderUserProfile() {
128
+ return null;
129
+ },
115
130
  customAction: (_ref3 = type.commonMessageProps && (type.commonMessageProps === null || type.commonMessageProps === void 0 ? void 0 : type.commonMessageProps.customAction)) !== null && _ref3 !== void 0 ? _ref3 : undefined,
116
131
  fileMessage: msg
117
132
  });
@@ -121,6 +136,9 @@ var CustomChatView = function CustomChatView(props) {
121
136
  reaction: false,
122
137
  select: false,
123
138
  thread: false,
139
+ renderUserProfile: function renderUserProfile() {
140
+ return null;
141
+ },
124
142
  customAction: (_ref4 = type.commonMessageProps && (type.commonMessageProps === null || type.commonMessageProps === void 0 ? void 0 : type.commonMessageProps.customAction)) !== null && _ref4 !== void 0 ? _ref4 : undefined,
125
143
  videoMessage: msg
126
144
  });
@@ -130,6 +148,9 @@ var CustomChatView = function CustomChatView(props) {
130
148
  reaction: false,
131
149
  select: false,
132
150
  thread: false,
151
+ renderUserProfile: function renderUserProfile() {
152
+ return null;
153
+ },
133
154
  customAction: (_ref5 = type.commonMessageProps && (type.commonMessageProps === null || type.commonMessageProps === void 0 ? void 0 : type.commonMessageProps.customAction)) !== null && _ref5 !== void 0 ? _ref5 : undefined,
134
155
  audioMessage: msg
135
156
  });
@@ -147,6 +168,9 @@ var CustomChatView = function CustomChatView(props) {
147
168
  select: false,
148
169
  thread: false,
149
170
  direction: isMySelf ? 'rtl' : 'ltr',
171
+ renderUserProfile: function renderUserProfile() {
172
+ return null;
173
+ },
150
174
  customAction: (_ref6 = type.commonMessageProps && (type.commonMessageProps === null || type.commonMessageProps === void 0 ? void 0 : type.commonMessageProps.customAction)) !== null && _ref6 !== void 0 ? _ref6 : undefined,
151
175
  children: renderShareCardMsg(msg)
152
176
  });
@@ -159,6 +183,7 @@ var CustomChatView = function CustomChatView(props) {
159
183
  var cvs = _findInstanceProperty(_context = agoraChatUikit.rootStore.conversationStore.conversationList).call(_context, function (cvs) {
160
184
  return cvs.conversationId === props.conversationId;
161
185
  });
186
+ console.log("----getHeaderInfo---", cvs);
162
187
  if (!cvs || !(cvs !== null && cvs !== void 0 && cvs.conversationId)) {
163
188
  return;
164
189
  }
@@ -226,18 +251,18 @@ var CustomChatView = function CustomChatView(props) {
226
251
  return _getShareGroupInfo.apply(this, arguments);
227
252
  }
228
253
  function _getShareGroupInfo() {
229
- _getShareGroupInfo = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee2(shareInfo, isJoined) {
254
+ _getShareGroupInfo = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee8(shareInfo, isJoined) {
230
255
  var params, response, data, groupInfo, waitJoinGroupinfo, conversation, _response$data2;
231
- return _regeneratorRuntime.wrap(function _callee2$(_context3) {
232
- while (1) switch (_context3.prev = _context3.next) {
256
+ return _regeneratorRuntime.wrap(function _callee8$(_context9) {
257
+ while (1) switch (_context9.prev = _context9.next) {
233
258
  case 0:
234
259
  params = {
235
260
  sendbirdid: shareInfo === null || shareInfo === void 0 ? void 0 : shareInfo.objectId
236
261
  };
237
- _context3.next = 3;
262
+ _context9.next = 3;
238
263
  return http.post("/capi/account/imchannel/getdetails", params);
239
264
  case 3:
240
- response = _context3.sent;
265
+ response = _context9.sent;
241
266
  data = response.data;
242
267
  if (data && data.code === 200 && data.data) {
243
268
  groupInfo = data.data;
@@ -274,9 +299,9 @@ var CustomChatView = function CustomChatView(props) {
274
299
  }
275
300
  case 6:
276
301
  case "end":
277
- return _context3.stop();
302
+ return _context9.stop();
278
303
  }
279
- }, _callee2);
304
+ }, _callee8);
280
305
  }));
281
306
  return _getShareGroupInfo.apply(this, arguments);
282
307
  }
@@ -360,29 +385,267 @@ var CustomChatView = function CustomChatView(props) {
360
385
  }
361
386
  getHeaderInfo();
362
387
  }, []);
388
+ var customHeader = function customHeader() {
389
+ return /*#__PURE__*/React.createElement("div", {
390
+ className: "flex h-20 items-center bg-[var(--im-main-backgroundColor)] border-b border-[var(--im-border-10)] mx-4 justify-between"
391
+ }, /*#__PURE__*/React.createElement("div", {
392
+ className: "flex items-center gap-4"
393
+ }, /*#__PURE__*/React.createElement("img", {
394
+ src: headerInfo.headerImageURL,
395
+ className: "w-12 h-12 ".concat(headerInfo.chatType === 'groupChat' ? 'rounded-md' : 'rounded-full', " bg-blue")
396
+ }), /*#__PURE__*/React.createElement("div", {
397
+ className: "flex flex-col overflow-hidden flex-1"
398
+ }, /*#__PURE__*/React.createElement("p", {
399
+ className: "text-[var(--im-main-fontColor)] text-base font-normal line-clamp-1 mr-[100px]"
400
+ }, headerInfo.conversationName), headerInfo.chatType === 'groupChat' && /*#__PURE__*/React.createElement("p", {
401
+ style: {
402
+ color: 'var(--im-third-fontColor)'
403
+ },
404
+ className: "text-sm"
405
+ }, headerInfo.memberCount, " members"))));
406
+ };
407
+ var _useState7 = React.useState([]),
408
+ _useState8 = _slicedToArray(_useState7, 2),
409
+ collectList = _useState8[0],
410
+ setCollectList = _useState8[1];
411
+ var _useState9 = React.useState(''),
412
+ _useState10 = _slicedToArray(_useState9, 2),
413
+ curAgentId = _useState10[0],
414
+ setCurAgentId = _useState10[1];
415
+ // 获取agent列表
416
+ var getCollectList = /*#__PURE__*/function () {
417
+ var _ref11 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
418
+ var _yield$http$get, data;
419
+ return _regeneratorRuntime.wrap(function _callee2$(_context3) {
420
+ while (1) switch (_context3.prev = _context3.next) {
421
+ case 0:
422
+ _context3.prev = 0;
423
+ _context3.next = 3;
424
+ return http.get("/api/agentcollect/myCollectAgent");
425
+ case 3:
426
+ _yield$http$get = _context3.sent;
427
+ data = _yield$http$get.data;
428
+ if (data.code == 200) {
429
+ if (data.data) {
430
+ setCollectList(data.data);
431
+ } else {
432
+ setCollectList([]);
433
+ }
434
+ }
435
+ _context3.next = 11;
436
+ break;
437
+ case 8:
438
+ _context3.prev = 8;
439
+ _context3.t0 = _context3["catch"](0);
440
+ console.log(_context3.t0);
441
+ case 11:
442
+ case "end":
443
+ return _context3.stop();
444
+ }
445
+ }, _callee2, null, [[0, 8]]);
446
+ }));
447
+ return function getCollectList() {
448
+ return _ref11.apply(this, arguments);
449
+ };
450
+ }();
451
+ var _useState11 = React.useState([]),
452
+ _useState12 = _slicedToArray(_useState11, 2),
453
+ agentTipList = _useState12[0],
454
+ setAgentTipList = _useState12[1];
455
+ var getTipsList = /*#__PURE__*/function () {
456
+ var _ref12 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee3() {
457
+ var _yield$http$get2, data;
458
+ return _regeneratorRuntime.wrap(function _callee3$(_context4) {
459
+ while (1) switch (_context4.prev = _context4.next) {
460
+ case 0:
461
+ _context4.prev = 0;
462
+ _context4.next = 3;
463
+ return http.get("/api/agentcollect/getAgentImReplyTxt");
464
+ case 3:
465
+ _yield$http$get2 = _context4.sent;
466
+ data = _yield$http$get2.data;
467
+ setAgentTipList(data.data.txtarr);
468
+ _context4.next = 11;
469
+ break;
470
+ case 8:
471
+ _context4.prev = 8;
472
+ _context4.t0 = _context4["catch"](0);
473
+ console.log(_context4.t0);
474
+ case 11:
475
+ case "end":
476
+ return _context4.stop();
477
+ }
478
+ }, _callee3, null, [[0, 8]]);
479
+ }));
480
+ return function getTipsList() {
481
+ return _ref12.apply(this, arguments);
482
+ };
483
+ }();
484
+ React.useEffect(function () {
485
+ setCurAgentId(props.conversationId);
486
+ getCollectList();
487
+ getTipsList();
488
+ }, []);
489
+ var changeAgent = /*#__PURE__*/function () {
490
+ var _ref13 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee4(val) {
491
+ var curAgent;
492
+ return _regeneratorRuntime.wrap(function _callee4$(_context5) {
493
+ while (1) switch (_context5.prev = _context5.next) {
494
+ case 0:
495
+ setCurAgentId(val);
496
+ curAgent = _findInstanceProperty(collectList).call(collectList, function (item) {
497
+ return item.imagentid == val;
498
+ });
499
+ setHeaderInfo({
500
+ headerImageURL: curAgent.imageurl,
501
+ conversationId: curAgent.imagentid,
502
+ memberCount: 0,
503
+ conversationName: curAgent.name,
504
+ chatType: 'singleChat'
505
+ });
506
+ case 3:
507
+ case "end":
508
+ return _context5.stop();
509
+ }
510
+ }, _callee4);
511
+ }));
512
+ return function changeAgent(_x4) {
513
+ return _ref13.apply(this, arguments);
514
+ };
515
+ }();
516
+ // 给agent 发送消息需要调用该接口
517
+ var sendAgentMsg = /*#__PURE__*/function () {
518
+ var _ref14 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee5() {
519
+ var userid,
520
+ content,
521
+ options,
522
+ _args5 = arguments;
523
+ return _regeneratorRuntime.wrap(function _callee5$(_context6) {
524
+ while (1) switch (_context6.prev = _context6.next) {
525
+ case 0:
526
+ userid = _args5.length > 0 && _args5[0] !== undefined ? _args5[0] : '';
527
+ content = _args5.length > 1 && _args5[1] !== undefined ? _args5[1] : '';
528
+ _context6.prev = 2;
529
+ options = {
530
+ userid: userid,
531
+ content: content,
532
+ contractaddress: props.tokenId
533
+ };
534
+ _context6.next = 6;
535
+ return http.post('/api/imchannel/sendagentmessage', options);
536
+ case 6:
537
+ _context6.next = 11;
538
+ break;
539
+ case 8:
540
+ _context6.prev = 8;
541
+ _context6.t0 = _context6["catch"](2);
542
+ console.log(_context6.t0);
543
+ case 11:
544
+ case "end":
545
+ return _context6.stop();
546
+ }
547
+ }, _callee5, null, [[2, 8]]);
548
+ }));
549
+ return function sendAgentMsg() {
550
+ return _ref14.apply(this, arguments);
551
+ };
552
+ }();
553
+ var postMessage = /*#__PURE__*/function () {
554
+ var _ref15 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee6(msg) {
555
+ var customMessage;
556
+ return _regeneratorRuntime.wrap(function _callee6$(_context7) {
557
+ while (1) switch (_context7.prev = _context7.next) {
558
+ case 0:
559
+ customMessage = MessageSDK.message.create({
560
+ type: 'txt',
561
+ msg: msg,
562
+ to: curAgentId || '',
563
+ // Need to be the user ID of the current conversation
564
+ chatType: 'singleChat'
565
+ });
566
+ _context7.next = 3;
567
+ return agoraChatUikit.rootStore.messageStore.sendMessage(customMessage);
568
+ case 3:
569
+ sendAgentMsg(curAgentId, msg);
570
+ case 4:
571
+ case "end":
572
+ return _context7.stop();
573
+ }
574
+ }, _callee6);
575
+ }));
576
+ return function postMessage(_x5) {
577
+ return _ref15.apply(this, arguments);
578
+ };
579
+ }();
580
+ var afterSendMsg = /*#__PURE__*/function () {
581
+ var _ref16 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee7(msgInfo) {
582
+ return _regeneratorRuntime.wrap(function _callee7$(_context8) {
583
+ while (1) switch (_context8.prev = _context8.next) {
584
+ case 0:
585
+ sendAgentMsg(curAgentId, msgInfo.msg);
586
+ case 1:
587
+ case "end":
588
+ return _context8.stop();
589
+ }
590
+ }, _callee7);
591
+ }));
592
+ return function afterSendMsg(_x6) {
593
+ return _ref16.apply(this, arguments);
594
+ };
595
+ }();
363
596
  return /*#__PURE__*/React.createElement("div", {
364
- className: "bg-[var(--im-main-backgroundColor)] ".concat((_props$className = props.className) !== null && _props$className !== void 0 ? _props$className : '', " w-full h-full overflow-hidden flex flex-col")
365
- }, /*#__PURE__*/React.createElement("div", {
366
- className: "h-16 text-white"
367
- }, headerInfo.conversationName), /*#__PURE__*/React.createElement(agoraChatUikit.MessageList, {
597
+ className: "bg-[var(--im-main-backgroundColor)] bg-pink ".concat((_props$className = props.className) !== null && _props$className !== void 0 ? _props$className : '', " w-full h-full overflow-hidden flex flex-col")
598
+ }, (collectList === null || collectList === void 0 ? void 0 : collectList.length) && /*#__PURE__*/React.createElement("div", {
599
+ className: "mb-2 mx-5 py-2 rounded-lg bg-[var(--im-main-bg-five)]"
600
+ }, /*#__PURE__*/React.createElement(antd.Select, {
601
+ className: "w-full !h-12 border-none rouded-lg agent-select",
602
+ popupClassName: "agent-select-popup",
603
+ value: curAgentId,
604
+ placeholder: "Select your agent to take actions on token",
605
+ prefix: /*#__PURE__*/React.createElement("img", {
606
+ className: "size-4",
607
+ src: set
608
+ }),
609
+ options: collectList,
610
+ fieldNames: {
611
+ label: 'name',
612
+ value: 'imagentid'
613
+ },
614
+ onChange: changeAgent
615
+ })), customHeader(), /*#__PURE__*/React.createElement(agoraChatUikit.MessageList, {
368
616
  className: "w-full flex-1",
369
617
  conversation: {
370
- conversationId: props.conversationId,
618
+ conversationId: curAgentId,
371
619
  chatType: props.chatType
372
620
  },
373
621
  renderMessage: function renderMessage(msg) {
374
622
  return _renderMessage(msg);
375
623
  },
376
624
  messageProps: _objectSpread({}, type.commonMessageProps)
377
- }), /*#__PURE__*/React.createElement(agoraChatUikit.MessageInput, _extends({
625
+ }), (agentTipList === null || agentTipList === void 0 ? void 0 : agentTipList.length) && /*#__PURE__*/React.createElement("div", {
626
+ className: "pb-1 pl-5 overflow-x-auto"
627
+ }, /*#__PURE__*/React.createElement("ul", {
628
+ className: "flex items-center gap-4"
629
+ }, _mapInstanceProperty(agentTipList).call(agentTipList, function (item, index) {
630
+ return /*#__PURE__*/React.createElement("li", {
631
+ className: "flex-shrink-0 py-1 px-2.5 text-xs text-[var(--im-five-fontColor)] border border-[var(--im-main-bg-ten)] rounded-sm cursor-pointer",
632
+ key: "tip".concat(index),
633
+ onClick: function onClick() {
634
+ postMessage(item);
635
+ }
636
+ }, item);
637
+ }))), /*#__PURE__*/React.createElement(agoraChatUikit.MessageInput, _extends({
378
638
  enabledTyping: true,
379
639
  placeHolder: '',
380
640
  conversation: {
381
- conversationId: props.conversationId,
641
+ conversationId: curAgentId,
382
642
  chatType: props.chatType
383
643
  }
384
644
  }, type.commonMessageInputConfig, {
385
- disabled: false
645
+ disabled: false,
646
+ onSendMessage: function onSendMessage(msg) {
647
+ afterSendMsg(msg);
648
+ }
386
649
  })));
387
650
  };
388
651
 
@@ -0,0 +1,7 @@
1
+ .agent-select{
2
+ .ant-select-selector{
3
+ background: transparent!important;
4
+ border: none!important;
5
+ box-shadow: none !important;
6
+ }
7
+ }
@@ -74,7 +74,9 @@ var GroupShareView = function GroupShareView(props) {
74
74
  imgUrl: props.shareObjImageurl
75
75
  }
76
76
  };
77
- customMessage = ChatSDK.message.create(option);
77
+ customMessage = ChatSDK.message.create({
78
+ option: option
79
+ });
78
80
  _context2.next = 4;
79
81
  return agoraChatUikit.rootStore.messageStore.sendMessage(customMessage);
80
82
  case 4:
@@ -120,7 +122,7 @@ var GroupShareView = function GroupShareView(props) {
120
122
  }, "Share")), /*#__PURE__*/React.createElement("p", {
121
123
  className: "text-[var(--im-main-fontColor)] text-base font-semibold text-center pt-6 px-4 pb-2.5 border-b border-[var(--im-main-bg-ten)]"
122
124
  }, "Groups"), /*#__PURE__*/React.createElement("div", {
123
- className: "flex flex-col mt-3 mx-4 gap-4 overflow-y-auto flex-1 min-h-0 pb-5"
125
+ className: "flex flex-col mt-3 mx-4 gap-4 overflow-y-auto flex-1 min-h-0 pb-5 no-scrollbar"
124
126
  }, _mapInstanceProperty(groupList).call(groupList, function (groupinfo, index) {
125
127
  var _groupinfo$name, _groupinfo$members;
126
128
  return /*#__PURE__*/React.createElement("div", {