whyuzeim 1.1.7 → 1.1.8

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.
@@ -23,6 +23,7 @@ var antd = require('antd');
23
23
  var index = require('./JoinGroupDialog/index.js');
24
24
  var index$1 = require('../AddMember/index.js');
25
25
  var type = require('../type.js');
26
+ var tools = require('../tools.js');
26
27
 
27
28
  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; }
28
29
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var _context7, _context8; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty(_context7 = ownKeys(Object(t), true)).call(_context7, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(e, _Object$getOwnPropertyDescriptors(t)) : _forEachInstanceProperty(_context8 = ownKeys(Object(t))).call(_context8, function (r) { _Object$defineProperty(e, r, _Object$getOwnPropertyDescriptor(t, r)); }); } return e; }
@@ -62,6 +63,10 @@ var Chatbox = function Chatbox(props) {
62
63
  _useState8 = _slicedToArray(_useState7, 2),
63
64
  headerInfo = _useState8[0],
64
65
  setHeaderInfo = _useState8[1];
66
+ var _useState9 = React.useState(true),
67
+ _useState10 = _slicedToArray(_useState9, 2),
68
+ isAgent = _useState10[0],
69
+ setIsAgent = _useState10[1];
65
70
  var renderTxtMsg = function renderTxtMsg(msg) {
66
71
  var _userInfo$uid, _ref;
67
72
  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());
@@ -401,6 +406,7 @@ var Chatbox = function Chatbox(props) {
401
406
  var _userInfo = agoraChatUikit.rootStore.addressStore.appUsersInfo[cvs.conversationId];
402
407
  if (!_userInfo || !_userInfo.avatarurl || !_userInfo.name) {
403
408
  client.fetchUserInfoById([cvs.conversationId], ["nickname", "avatarurl", "mail", "phone", "gender", "sign", "birth", "ext"]).then(function (res) {
409
+ var _res$data$cvs$convers;
404
410
  setHeaderInfo(function (prevState) {
405
411
  return _objectSpread(_objectSpread({}, prevState), {}, {
406
412
  headerImageURL: res.data[cvs.conversationId].avatarurl,
@@ -413,6 +419,10 @@ var Chatbox = function Chatbox(props) {
413
419
  name: res.data[cvs.conversationId].nickname,
414
420
  avatarurl: res.data[cvs.conversationId].avatarurl
415
421
  });
422
+ tools.reportAgentInUse(http, cvs.conversationId, res.data[cvs.conversationId]);
423
+ var customObj = JSON.parse((_res$data$cvs$convers = res.data[cvs.conversationId]) === null || _res$data$cvs$convers === void 0 ? void 0 : _res$data$cvs$convers.ext);
424
+ // 假设有一个字段 shouldShowInList 来判断是否展示
425
+ setIsAgent((customObj === null || customObj === void 0 ? void 0 : customObj.certification) === "1");
416
426
  });
417
427
  } else {
418
428
  setHeaderInfo(function (prevState) {
@@ -421,6 +431,10 @@ var Chatbox = function Chatbox(props) {
421
431
  conversationName: _userInfo.name
422
432
  });
423
433
  });
434
+ tools.reportAgentInUse(http, cvs.conversationId, _userInfo);
435
+ var customObj = JSON.parse(_userInfo === null || _userInfo === void 0 ? void 0 : _userInfo.ext);
436
+ // 假设有一个字段 shouldShowInList 来判断是否展示
437
+ setIsAgent((customObj === null || customObj === void 0 ? void 0 : customObj.certification) === "1");
424
438
  }
425
439
  }
426
440
  };
@@ -549,32 +563,20 @@ var Chatbox = function Chatbox(props) {
549
563
  var _ref12 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee4() {
550
564
  var userid,
551
565
  content,
552
- options,
553
566
  _args4 = arguments;
554
567
  return _regeneratorRuntime.wrap(function _callee4$(_context4) {
555
568
  while (1) switch (_context4.prev = _context4.next) {
556
569
  case 0:
557
570
  userid = _args4.length > 0 && _args4[0] !== undefined ? _args4[0] : "";
558
571
  content = _args4.length > 1 && _args4[1] !== undefined ? _args4[1] : "";
559
- _context4.prev = 2;
560
- options = {
561
- userid: userid,
562
- content: content
563
- };
564
- _context4.next = 6;
565
- return http.post("/api/imchannel/sendagentmessage", options);
566
- case 6:
567
- _context4.next = 11;
568
- break;
569
- case 8:
570
- _context4.prev = 8;
571
- _context4.t0 = _context4["catch"](2);
572
- console.log(_context4.t0);
573
- case 11:
572
+ if (isAgent) {
573
+ tools.reportAgentMsg(http, userid, content);
574
+ }
575
+ case 3:
574
576
  case "end":
575
577
  return _context4.stop();
576
578
  }
577
- }, _callee4, null, [[2, 8]]);
579
+ }, _callee4);
578
580
  }));
579
581
  return function sendAgentMsg() {
580
582
  return _ref12.apply(this, arguments);
@@ -20,21 +20,23 @@ var React = require('react');
20
20
  var agoraChatUikit = require('agora-chat-uikit');
21
21
  var context = require('../IM/context.js');
22
22
  var type = require('../type.js');
23
+ var tools = require('../tools.js');
23
24
 
24
25
  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
26
  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; }
26
27
  var HighlyCustomChat = function HighlyCustomChat(props) {
27
28
  var _props$className;
28
29
  // 设置默认值
30
+ var client = agoraChatUikit.useClient();
29
31
  var _props$showHeader = props.showHeader,
30
32
  showHeader = _props$showHeader === void 0 ? true : _props$showHeader,
31
33
  renderQuestionList = props.renderQuestionList,
32
34
  onLoginSuccess = props.onLoginSuccess;
33
35
  var _useSDK = agoraChatUikit.useSDK(),
34
36
  MessageSDK = _useSDK.ChatSDK;
35
- var _useContext = React.useContext(context.Context);
36
- _useContext.http;
37
- var userInfo = _useContext.userInfo;
37
+ var _useContext = React.useContext(context.Context),
38
+ http = _useContext.http,
39
+ userInfo = _useContext.userInfo;
38
40
  var _useState = React.useState(true),
39
41
  _useState2 = _slicedToArray(_useState, 2),
40
42
  loading = _useState2[0],
@@ -53,6 +55,10 @@ var HighlyCustomChat = function HighlyCustomChat(props) {
53
55
  _useState6 = _slicedToArray(_useState5, 2),
54
56
  currentConversation = _useState6[0],
55
57
  setCurrentConversation = _useState6[1];
58
+ var _useState7 = React.useState(true),
59
+ _useState8 = _slicedToArray(_useState7, 2);
60
+ _useState8[0];
61
+ var setIsAgent = _useState8[1];
56
62
  var renderTxtMsg = function renderTxtMsg(msg) {
57
63
  var _userInfo$uid;
58
64
  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());
@@ -216,33 +222,38 @@ var HighlyCustomChat = function HighlyCustomChat(props) {
216
222
  }
217
223
  });
218
224
  } else {
219
- var appUsersInfo = agoraChatUikit.rootStore.addressStore.appUsersInfo[cvs.conversationId];
220
- if (!appUsersInfo) {
221
- agoraChatUikit.rootStore.addressStore.getUserInfo(cvs.conversationId);
222
- agoraChatUikit.rootStore.addressStore.getUserInfo(cvs.conversationId).then(function (value) {
223
- if (value) {
224
- var _value$avatarurl, _value$name;
225
- var imageurl = (_value$avatarurl = value === null || value === void 0 ? void 0 : value.avatarurl) !== null && _value$avatarurl !== void 0 ? _value$avatarurl : "";
226
- var name = (_value$name = value === null || value === void 0 ? void 0 : value.name) !== null && _value$name !== void 0 ? _value$name : cvs.name;
227
- console.log("the user info fecthed", name, imageurl);
228
- setHeaderInfo(function (prevState) {
229
- return _objectSpread(_objectSpread({}, prevState), {}, {
230
- headerImageURL: imageurl,
231
- conversationName: name
232
- });
225
+ var _userInfo = agoraChatUikit.rootStore.addressStore.appUsersInfo[cvs.conversationId];
226
+ if (!_userInfo || !_userInfo.avatarurl || !_userInfo.name) {
227
+ client.fetchUserInfoById([cvs.conversationId], ["nickname", "avatarurl", "mail", "phone", "gender", "sign", "birth", "ext"]).then(function (res) {
228
+ var _res$data$cvs$convers;
229
+ setHeaderInfo(function (prevState) {
230
+ return _objectSpread(_objectSpread({}, prevState), {}, {
231
+ headerImageURL: res.data[cvs.conversationId].avatarurl,
232
+ conversationName: res.data[cvs.conversationId].nickname
233
233
  });
234
- }
234
+ });
235
+ var tempUserInfo = agoraChatUikit.rootStore.addressStore.appUsersInfo[cvs.conversationId];
236
+ agoraChatUikit.rootStore.addressStore.appUsersInfo[cvs.conversationId] = _objectSpread(_objectSpread({}, tempUserInfo || {}), {}, {
237
+ userId: cvs.conversationId,
238
+ name: res.data[cvs.conversationId].nickname,
239
+ avatarurl: res.data[cvs.conversationId].avatarurl
240
+ });
241
+ tools.reportAgentInUse(http, cvs.conversationId, res.data[cvs.conversationId]);
242
+ var customObj = JSON.parse((_res$data$cvs$convers = res.data[cvs.conversationId]) === null || _res$data$cvs$convers === void 0 ? void 0 : _res$data$cvs$convers.ext);
243
+ // 假设有一个字段 shouldShowInList 来判断是否展示
244
+ setIsAgent((customObj === null || customObj === void 0 ? void 0 : customObj.certification) === "1");
235
245
  });
236
246
  } else {
237
- var _appUsersInfo$avataru, _ref3, _appUsersInfo$name;
238
- var imageurl = (_appUsersInfo$avataru = appUsersInfo === null || appUsersInfo === void 0 ? void 0 : appUsersInfo.avatarurl) !== null && _appUsersInfo$avataru !== void 0 ? _appUsersInfo$avataru : "";
239
- var name = (_ref3 = (_appUsersInfo$name = appUsersInfo === null || appUsersInfo === void 0 ? void 0 : appUsersInfo.name) !== null && _appUsersInfo$name !== void 0 ? _appUsersInfo$name : cvs.name) !== null && _ref3 !== void 0 ? _ref3 : "";
240
247
  setHeaderInfo(function (prevState) {
241
248
  return _objectSpread(_objectSpread({}, prevState), {}, {
242
- headerImageURL: imageurl,
243
- conversationName: name
249
+ headerImageURL: _userInfo.avatarurl,
250
+ conversationName: _userInfo.name
244
251
  });
245
252
  });
253
+ tools.reportAgentInUse(http, cvs.conversationId, _userInfo);
254
+ var customObj = JSON.parse(_userInfo === null || _userInfo === void 0 ? void 0 : _userInfo.ext);
255
+ // 假设有一个字段 shouldShowInList 来判断是否展示
256
+ setIsAgent((customObj === null || customObj === void 0 ? void 0 : customObj.certification) === "1");
246
257
  }
247
258
  }
248
259
  }, [props.conversationId]);
@@ -324,7 +335,7 @@ var HighlyCustomChat = function HighlyCustomChat(props) {
324
335
  };
325
336
  }, [getHeaderInfo, initConversation, props.conversationId]);
326
337
  var handleSendMessage = /*#__PURE__*/function () {
327
- var _ref4 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(text) {
338
+ var _ref3 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(text) {
328
339
  var txtMessage;
329
340
  return _regeneratorRuntime.wrap(function _callee$(_context2) {
330
341
  while (1) switch (_context2.prev = _context2.next) {
@@ -360,11 +371,11 @@ var HighlyCustomChat = function HighlyCustomChat(props) {
360
371
  }, _callee, null, [[2, 9]]);
361
372
  }));
362
373
  return function handleSendMessage(_x) {
363
- return _ref4.apply(this, arguments);
374
+ return _ref3.apply(this, arguments);
364
375
  };
365
376
  }();
366
377
  var afterSendMsg = /*#__PURE__*/function () {
367
- var _ref5 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee2(msgInfo) {
378
+ var _ref4 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee2(msgInfo) {
368
379
  return _regeneratorRuntime.wrap(function _callee2$(_context3) {
369
380
  while (1) switch (_context3.prev = _context3.next) {
370
381
  case 0:
@@ -376,7 +387,7 @@ var HighlyCustomChat = function HighlyCustomChat(props) {
376
387
  }, _callee2);
377
388
  }));
378
389
  return function afterSendMsg(_x2) {
379
- return _ref5.apply(this, arguments);
390
+ return _ref4.apply(this, arguments);
380
391
  };
381
392
  }();
382
393
  return /*#__PURE__*/React.createElement("div", {
@@ -1,11 +1,5 @@
1
1
  'use strict';
2
2
 
3
- var _asyncToGenerator = require('@babel/runtime-corejs3/helpers/esm/asyncToGenerator');
4
- var _defineProperty = require('@babel/runtime-corejs3/helpers/esm/defineProperty');
5
- var _slicedToArray = require('@babel/runtime-corejs3/helpers/esm/slicedToArray');
6
- var _regeneratorRuntime = require('@babel/runtime-corejs3/regenerator');
7
- var _findInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/find');
8
- var _concatInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/concat');
9
3
  var _Object$keys = require('@babel/runtime-corejs3/core-js-stable/object/keys');
10
4
  var _Object$getOwnPropertySymbols = require('@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols');
11
5
  var _filterInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/filter');
@@ -19,6 +13,12 @@ var _Array$from = require('@babel/runtime-corejs3/core-js-stable/array/from');
19
13
  var _Symbol = require('@babel/runtime-corejs3/core-js-stable/symbol');
20
14
  var _getIteratorMethod = require('@babel/runtime-corejs3/core-js/get-iterator-method');
21
15
  var _Array$isArray = require('@babel/runtime-corejs3/core-js-stable/array/is-array');
16
+ var _asyncToGenerator = require('@babel/runtime-corejs3/helpers/esm/asyncToGenerator');
17
+ var _defineProperty = require('@babel/runtime-corejs3/helpers/esm/defineProperty');
18
+ var _slicedToArray = require('@babel/runtime-corejs3/helpers/esm/slicedToArray');
19
+ var _regeneratorRuntime = require('@babel/runtime-corejs3/regenerator');
20
+ var _findInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/find');
21
+ var _concatInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/concat');
22
22
  var React = require('react');
23
23
  require('./style/index.scss');
24
24
  var agoraChatUikit = require('agora-chat-uikit');
@@ -26,10 +26,10 @@ var context = require('../../IM/context.js');
26
26
  var index = require('./OperateBtn/index.js');
27
27
 
28
28
  function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof _Symbol && _getIteratorMethod(r) || r["@@iterator"]; if (!t) { if (_Array$isArray(r) || (t = _unsupportedIterableToArray(r)) || e) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: true } : { done: false, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = true, u = false; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = true, o = r; }, f: function f() { try { a || null == t["return"] || t["return"](); } finally { if (u) throw o; } } }; }
29
- function _unsupportedIterableToArray(r, a) { if (r) { var _context9; if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = _sliceInstanceProperty(_context9 = {}.toString.call(r)).call(_context9, 8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? _Array$from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
29
+ function _unsupportedIterableToArray(r, a) { if (r) { var _context7; if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = _sliceInstanceProperty(_context7 = {}.toString.call(r)).call(_context7, 8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? _Array$from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
30
30
  function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
31
31
  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; }
32
- function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var _context7, _context8; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty(_context7 = ownKeys(Object(t), true)).call(_context7, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(e, _Object$getOwnPropertyDescriptors(t)) : _forEachInstanceProperty(_context8 = ownKeys(Object(t))).call(_context8, function (r) { _Object$defineProperty(e, r, _Object$getOwnPropertyDescriptor(t, r)); }); } return e; }
32
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var _context5, _context6; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty(_context5 = ownKeys(Object(t), true)).call(_context5, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(e, _Object$getOwnPropertyDescriptors(t)) : _forEachInstanceProperty(_context6 = ownKeys(Object(t))).call(_context6, function (r) { _Object$defineProperty(e, r, _Object$getOwnPropertyDescriptor(t, r)); }); } return e; }
33
33
  var CustomConversationItem = function CustomConversationItem(props) {
34
34
  var cvs = props.cvs,
35
35
  _onClick = props.onClick;
@@ -82,11 +82,10 @@ var CustomConversationItem = function CustomConversationItem(props) {
82
82
  setAvatar(res.data[cvs.conversationId].avatarurl);
83
83
  setName(res.data[cvs.conversationId].nickname);
84
84
  if ((_res$data$cvs$convers = res.data[cvs.conversationId]) !== null && _res$data$cvs$convers !== void 0 && _res$data$cvs$convers.ext) {
85
- var _res$data$cvs$convers2, _context2, _context3;
85
+ var _res$data$cvs$convers2;
86
86
  var customObj = JSON.parse((_res$data$cvs$convers2 = res.data[cvs.conversationId]) === null || _res$data$cvs$convers2 === void 0 ? void 0 : _res$data$cvs$convers2.ext);
87
87
  // 假设有一个字段 shouldShowInList 来判断是否展示
88
88
  setCanShow((customObj === null || customObj === void 0 ? void 0 : customObj.certification) !== "2");
89
- console.log(_concatInstanceProperty(_context2 = _concatInstanceProperty(_context3 = "request finished:current conversation name is ".concat(res.data[cvs.conversationId].nickname, ", certif\n ication is ")).call(_context3, customObj === null || customObj === void 0 ? void 0 : customObj.certification, ", canshow is ")).call(_context2, (customObj === null || customObj === void 0 ? void 0 : customObj.certification) !== "2"));
90
89
  }
91
90
  var tempUserInfo = agoraChatUikit.rootStore.addressStore.appUsersInfo[cvs.conversationId];
92
91
  agoraChatUikit.rootStore.addressStore.appUsersInfo[cvs.conversationId] = _objectSpread(_objectSpread({}, tempUserInfo || {}), {}, {
@@ -100,11 +99,11 @@ var CustomConversationItem = function CustomConversationItem(props) {
100
99
  setAvatar(userInfo.avatarurl);
101
100
  setName(userInfo.name);
102
101
  if (userInfo !== null && userInfo !== void 0 && userInfo.ext) {
103
- var _context4, _context5;
102
+ var _context2, _context3;
104
103
  var customObj = JSON.parse(userInfo.ext);
105
104
  // 假设有一个字段 shouldShowInList 来判断是否展示
106
105
  setCanShow((customObj === null || customObj === void 0 ? void 0 : customObj.certification) !== "2");
107
- console.log(_concatInstanceProperty(_context4 = _concatInstanceProperty(_context5 = "cache:current conversation name is ".concat(userInfo.name, ", certif\n ication is ")).call(_context5, customObj === null || customObj === void 0 ? void 0 : customObj.certification, ", canshow is ")).call(_context4, (customObj === null || customObj === void 0 ? void 0 : customObj.certification) !== "2"));
106
+ console.log(_concatInstanceProperty(_context2 = _concatInstanceProperty(_context3 = "cache:current conversation name is ".concat(userInfo.name, ", certif\n ication is ")).call(_context3, customObj === null || customObj === void 0 ? void 0 : customObj.certification, ", canshow is ")).call(_context2, (customObj === null || customObj === void 0 ? void 0 : customObj.certification) !== "2"));
108
107
  }
109
108
  }
110
109
  }
@@ -112,60 +111,60 @@ var CustomConversationItem = function CustomConversationItem(props) {
112
111
  var clickConversationItem = /*#__PURE__*/function () {
113
112
  var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
114
113
  var handleDefaultBehavir, _iterator, _step, item, isJump;
115
- return _regeneratorRuntime.wrap(function _callee$(_context6) {
116
- while (1) switch (_context6.prev = _context6.next) {
114
+ return _regeneratorRuntime.wrap(function _callee$(_context4) {
115
+ while (1) switch (_context4.prev = _context4.next) {
117
116
  case 0:
118
117
  handleDefaultBehavir = true;
119
118
  _iterator = _createForOfIteratorHelper(additionalConversations || []);
120
- _context6.prev = 2;
119
+ _context4.prev = 2;
121
120
  _iterator.s();
122
121
  case 4:
123
122
  if ((_step = _iterator.n()).done) {
124
- _context6.next = 19;
123
+ _context4.next = 19;
125
124
  break;
126
125
  }
127
126
  item = _step.value;
128
127
  if (!(item.conversationId === cvs.conversationId)) {
129
- _context6.next = 17;
128
+ _context4.next = 17;
130
129
  break;
131
130
  }
132
131
  if (!onAdditionalConversationClick) {
133
- _context6.next = 17;
132
+ _context4.next = 17;
134
133
  break;
135
134
  }
136
- _context6.next = 10;
135
+ _context4.next = 10;
137
136
  return onAdditionalConversationClick(item);
138
137
  case 10:
139
- isJump = _context6.sent;
138
+ isJump = _context4.sent;
140
139
  if (!isJump) {
141
- _context6.next = 16;
140
+ _context4.next = 16;
142
141
  break;
143
142
  }
144
143
  setCurrentConversation(cvs);
145
144
  handleDefaultBehavir = false;
146
- _context6.next = 17;
145
+ _context4.next = 17;
147
146
  break;
148
147
  case 16:
149
- return _context6.abrupt("return");
148
+ return _context4.abrupt("return");
150
149
  case 17:
151
- _context6.next = 4;
150
+ _context4.next = 4;
152
151
  break;
153
152
  case 19:
154
- _context6.next = 24;
153
+ _context4.next = 24;
155
154
  break;
156
155
  case 21:
157
- _context6.prev = 21;
158
- _context6.t0 = _context6["catch"](2);
159
- _iterator.e(_context6.t0);
156
+ _context4.prev = 21;
157
+ _context4.t0 = _context4["catch"](2);
158
+ _iterator.e(_context4.t0);
160
159
  case 24:
161
- _context6.prev = 24;
160
+ _context4.prev = 24;
162
161
  _iterator.f();
163
- return _context6.finish(24);
162
+ return _context4.finish(24);
164
163
  case 27:
165
164
  if (handleDefaultBehavir) setCurrentConversation(cvs);
166
165
  case 28:
167
166
  case "end":
168
- return _context6.stop();
167
+ return _context4.stop();
169
168
  }
170
169
  }, _callee, null, [[2, 21, 24, 27]]);
171
170
  }));
@@ -310,35 +310,7 @@ var Sidebar = function Sidebar(props) {
310
310
  className: "text-xl"
311
311
  }, "Messages")), /*#__PURE__*/React.createElement("div", {
312
312
  className: classNames("yuze-conversationList-header-right flex justify-center items-center gap-6")
313
- }, /*#__PURE__*/React.createElement(antd.Tooltip, {
314
- placement: "bottomLeft",
315
- title: /*#__PURE__*/React.createElement("div", {
316
- className: "yuze-conversationList-header-right-tooltip flex flex-col"
317
- }, /*#__PURE__*/React.createElement("div", {
318
- className: "yuze-conversationList-header-right-tooltip-item flex flex-row items-center gap-3 cursor-pointer",
319
- onClick: function onClick() {
320
- setComponentType("group");
321
- }
322
- }, /*#__PURE__*/React.createElement("img", {
323
- src: group,
324
- alt: ""
325
- }), /*#__PURE__*/React.createElement("span", {
326
- className: "text-sm"
327
- }, "Groups")), /*#__PURE__*/React.createElement("div", {
328
- className: "yuze-conversationList-header-right-tooltip-item flex flex-row items-center gap-3 cursor-pointer",
329
- onClick: function onClick() {
330
- setOpenCreateGroup(true);
331
- }
332
- }, /*#__PURE__*/React.createElement("img", {
333
- src: create,
334
- alt: ""
335
- }), /*#__PURE__*/React.createElement("span", {
336
- className: "text-sm"
337
- }, "Create Group")))
338
- }, /*#__PURE__*/React.createElement("img", {
339
- src: theme === "light" ? ic_menu_light : ic_menu,
340
- className: "cursor-pointer"
341
- })), renderIcon())), /*#__PURE__*/React.createElement(index, {
313
+ }, renderIcon())), /*#__PURE__*/React.createElement(index, {
342
314
  className: "sm:hidden",
343
315
  leftIcon: renderMobileIcon(),
344
316
  rightIcon: renderMobileRight(),
package/cjs/tools.d.ts ADDED
@@ -0,0 +1,3 @@
1
+ import { AxiosInstance } from "axios";
2
+ export declare const reportAgentInUse: (httpclient: AxiosInstance, agentId: string, userInfo: any) => Promise<void>;
3
+ export declare const reportAgentMsg: (httpclient: AxiosInstance, userid?: string, content?: string) => Promise<void>;
package/cjs/tools.js ADDED
@@ -0,0 +1,84 @@
1
+ 'use strict';
2
+
3
+ var _asyncToGenerator = require('@babel/runtime-corejs3/helpers/esm/asyncToGenerator');
4
+ var _regeneratorRuntime = require('@babel/runtime-corejs3/regenerator');
5
+ var _JSON$stringify = require('@babel/runtime-corejs3/core-js-stable/json/stringify');
6
+
7
+ var reportAgentInUse = /*#__PURE__*/function () {
8
+ var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(httpclient, agentId, userInfo) {
9
+ var customObj;
10
+ return _regeneratorRuntime.wrap(function _callee$(_context) {
11
+ while (1) switch (_context.prev = _context.next) {
12
+ case 0:
13
+ console.log('need report: the userinfo is', userInfo, _JSON$stringify(userInfo));
14
+ _context.prev = 1;
15
+ if (userInfo !== null && userInfo !== void 0 && userInfo.ext) {
16
+ _context.next = 4;
17
+ break;
18
+ }
19
+ return _context.abrupt("return");
20
+ case 4:
21
+ customObj = JSON.parse(userInfo.ext); // 假设有一个字段 shouldShowInList 来判断是否展示
22
+ if (!((customObj === null || customObj === void 0 ? void 0 : customObj.certification) === "1")) {
23
+ _context.next = 8;
24
+ break;
25
+ }
26
+ _context.next = 8;
27
+ return httpclient.post("/api/agentcollect/agentUsed", {
28
+ agentid: agentId
29
+ });
30
+ case 8:
31
+ _context.next = 12;
32
+ break;
33
+ case 10:
34
+ _context.prev = 10;
35
+ _context.t0 = _context["catch"](1);
36
+ case 12:
37
+ case "end":
38
+ return _context.stop();
39
+ }
40
+ }, _callee, null, [[1, 10]]);
41
+ }));
42
+ return function reportAgentInUse(_x, _x2, _x3) {
43
+ return _ref.apply(this, arguments);
44
+ };
45
+ }();
46
+ var reportAgentMsg = /*#__PURE__*/function () {
47
+ var _ref2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee2(httpclient) {
48
+ var userid,
49
+ content,
50
+ options,
51
+ _args2 = arguments;
52
+ return _regeneratorRuntime.wrap(function _callee2$(_context2) {
53
+ while (1) switch (_context2.prev = _context2.next) {
54
+ case 0:
55
+ userid = _args2.length > 1 && _args2[1] !== undefined ? _args2[1] : "";
56
+ content = _args2.length > 2 && _args2[2] !== undefined ? _args2[2] : "";
57
+ _context2.prev = 2;
58
+ console.log('need report: the userid is', userid);
59
+ options = {
60
+ userid: userid,
61
+ content: content
62
+ };
63
+ _context2.next = 7;
64
+ return httpclient.post("/api/imchannel/sendagentmessage", options);
65
+ case 7:
66
+ _context2.next = 12;
67
+ break;
68
+ case 9:
69
+ _context2.prev = 9;
70
+ _context2.t0 = _context2["catch"](2);
71
+ console.log(_context2.t0);
72
+ case 12:
73
+ case "end":
74
+ return _context2.stop();
75
+ }
76
+ }, _callee2, null, [[2, 9]]);
77
+ }));
78
+ return function reportAgentMsg(_x4) {
79
+ return _ref2.apply(this, arguments);
80
+ };
81
+ }();
82
+
83
+ exports.reportAgentInUse = reportAgentInUse;
84
+ exports.reportAgentMsg = reportAgentMsg;
@@ -21,6 +21,7 @@ import { Modal, Button, message } from 'antd';
21
21
  import JoinGroupDialog from './JoinGroupDialog/index.js';
22
22
  import AddMember from '../AddMember/index.js';
23
23
  import { commonMessageInputConfig, commonMessageProps } from '../type.js';
24
+ import { reportAgentInUse, reportAgentMsg } from '../tools.js';
24
25
 
25
26
  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; }
26
27
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var _context7, _context8; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty(_context7 = ownKeys(Object(t), true)).call(_context7, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(e, _Object$getOwnPropertyDescriptors(t)) : _forEachInstanceProperty(_context8 = ownKeys(Object(t))).call(_context8, function (r) { _Object$defineProperty(e, r, _Object$getOwnPropertyDescriptor(t, r)); }); } return e; }
@@ -60,6 +61,10 @@ var Chatbox = function Chatbox(props) {
60
61
  _useState8 = _slicedToArray(_useState7, 2),
61
62
  headerInfo = _useState8[0],
62
63
  setHeaderInfo = _useState8[1];
64
+ var _useState9 = useState(true),
65
+ _useState10 = _slicedToArray(_useState9, 2),
66
+ isAgent = _useState10[0],
67
+ setIsAgent = _useState10[1];
63
68
  var renderTxtMsg = function renderTxtMsg(msg) {
64
69
  var _userInfo$uid, _ref;
65
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());
@@ -399,6 +404,7 @@ var Chatbox = function Chatbox(props) {
399
404
  var _userInfo = rootStore.addressStore.appUsersInfo[cvs.conversationId];
400
405
  if (!_userInfo || !_userInfo.avatarurl || !_userInfo.name) {
401
406
  client.fetchUserInfoById([cvs.conversationId], ["nickname", "avatarurl", "mail", "phone", "gender", "sign", "birth", "ext"]).then(function (res) {
407
+ var _res$data$cvs$convers;
402
408
  setHeaderInfo(function (prevState) {
403
409
  return _objectSpread(_objectSpread({}, prevState), {}, {
404
410
  headerImageURL: res.data[cvs.conversationId].avatarurl,
@@ -411,6 +417,10 @@ var Chatbox = function Chatbox(props) {
411
417
  name: res.data[cvs.conversationId].nickname,
412
418
  avatarurl: res.data[cvs.conversationId].avatarurl
413
419
  });
420
+ reportAgentInUse(http, cvs.conversationId, res.data[cvs.conversationId]);
421
+ var customObj = JSON.parse((_res$data$cvs$convers = res.data[cvs.conversationId]) === null || _res$data$cvs$convers === void 0 ? void 0 : _res$data$cvs$convers.ext);
422
+ // 假设有一个字段 shouldShowInList 来判断是否展示
423
+ setIsAgent((customObj === null || customObj === void 0 ? void 0 : customObj.certification) === "1");
414
424
  });
415
425
  } else {
416
426
  setHeaderInfo(function (prevState) {
@@ -419,6 +429,10 @@ var Chatbox = function Chatbox(props) {
419
429
  conversationName: _userInfo.name
420
430
  });
421
431
  });
432
+ reportAgentInUse(http, cvs.conversationId, _userInfo);
433
+ var customObj = JSON.parse(_userInfo === null || _userInfo === void 0 ? void 0 : _userInfo.ext);
434
+ // 假设有一个字段 shouldShowInList 来判断是否展示
435
+ setIsAgent((customObj === null || customObj === void 0 ? void 0 : customObj.certification) === "1");
422
436
  }
423
437
  }
424
438
  };
@@ -547,32 +561,20 @@ var Chatbox = function Chatbox(props) {
547
561
  var _ref12 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee4() {
548
562
  var userid,
549
563
  content,
550
- options,
551
564
  _args4 = arguments;
552
565
  return _regeneratorRuntime.wrap(function _callee4$(_context4) {
553
566
  while (1) switch (_context4.prev = _context4.next) {
554
567
  case 0:
555
568
  userid = _args4.length > 0 && _args4[0] !== undefined ? _args4[0] : "";
556
569
  content = _args4.length > 1 && _args4[1] !== undefined ? _args4[1] : "";
557
- _context4.prev = 2;
558
- options = {
559
- userid: userid,
560
- content: content
561
- };
562
- _context4.next = 6;
563
- return http.post("/api/imchannel/sendagentmessage", options);
564
- case 6:
565
- _context4.next = 11;
566
- break;
567
- case 8:
568
- _context4.prev = 8;
569
- _context4.t0 = _context4["catch"](2);
570
- console.log(_context4.t0);
571
- case 11:
570
+ if (isAgent) {
571
+ reportAgentMsg(http, userid, content);
572
+ }
573
+ case 3:
572
574
  case "end":
573
575
  return _context4.stop();
574
576
  }
575
- }, _callee4, null, [[2, 8]]);
577
+ }, _callee4);
576
578
  }));
577
579
  return function sendAgentMsg() {
578
580
  return _ref12.apply(this, arguments);
@@ -15,24 +15,26 @@ import _forEachInstanceProperty from '@babel/runtime-corejs3/core-js-stable/inst
15
15
  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, { useContext, useState, useCallback, useEffect } from 'react';
18
- import { useSDK, rootStore, MessageList, MessageInput, ImageMessage, FileMessage, VideoMessage, BaseMessage } from 'agora-chat-uikit';
18
+ import { useClient, useSDK, rootStore, MessageList, MessageInput, ImageMessage, FileMessage, VideoMessage, BaseMessage } from 'agora-chat-uikit';
19
19
  import { Context } from '../IM/context.js';
20
20
  import { commonMessageInputConfig, commonMessageProps } from '../type.js';
21
+ import { reportAgentInUse } from '../tools.js';
21
22
 
22
23
  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; }
23
24
  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; }
24
25
  var HighlyCustomChat = function HighlyCustomChat(props) {
25
26
  var _props$className;
26
27
  // 设置默认值
28
+ var client = useClient();
27
29
  var _props$showHeader = props.showHeader,
28
30
  showHeader = _props$showHeader === void 0 ? true : _props$showHeader,
29
31
  renderQuestionList = props.renderQuestionList,
30
32
  onLoginSuccess = props.onLoginSuccess;
31
33
  var _useSDK = useSDK(),
32
34
  MessageSDK = _useSDK.ChatSDK;
33
- var _useContext = useContext(Context);
34
- _useContext.http;
35
- var userInfo = _useContext.userInfo;
35
+ var _useContext = useContext(Context),
36
+ http = _useContext.http,
37
+ userInfo = _useContext.userInfo;
36
38
  var _useState = useState(true),
37
39
  _useState2 = _slicedToArray(_useState, 2),
38
40
  loading = _useState2[0],
@@ -51,6 +53,10 @@ var HighlyCustomChat = function HighlyCustomChat(props) {
51
53
  _useState6 = _slicedToArray(_useState5, 2),
52
54
  currentConversation = _useState6[0],
53
55
  setCurrentConversation = _useState6[1];
56
+ var _useState7 = useState(true),
57
+ _useState8 = _slicedToArray(_useState7, 2);
58
+ _useState8[0];
59
+ var setIsAgent = _useState8[1];
54
60
  var renderTxtMsg = function renderTxtMsg(msg) {
55
61
  var _userInfo$uid;
56
62
  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());
@@ -214,33 +220,38 @@ var HighlyCustomChat = function HighlyCustomChat(props) {
214
220
  }
215
221
  });
216
222
  } else {
217
- var appUsersInfo = rootStore.addressStore.appUsersInfo[cvs.conversationId];
218
- if (!appUsersInfo) {
219
- rootStore.addressStore.getUserInfo(cvs.conversationId);
220
- rootStore.addressStore.getUserInfo(cvs.conversationId).then(function (value) {
221
- if (value) {
222
- var _value$avatarurl, _value$name;
223
- var imageurl = (_value$avatarurl = value === null || value === void 0 ? void 0 : value.avatarurl) !== null && _value$avatarurl !== void 0 ? _value$avatarurl : "";
224
- var name = (_value$name = value === null || value === void 0 ? void 0 : value.name) !== null && _value$name !== void 0 ? _value$name : cvs.name;
225
- console.log("the user info fecthed", name, imageurl);
226
- setHeaderInfo(function (prevState) {
227
- return _objectSpread(_objectSpread({}, prevState), {}, {
228
- headerImageURL: imageurl,
229
- conversationName: name
230
- });
223
+ var _userInfo = rootStore.addressStore.appUsersInfo[cvs.conversationId];
224
+ if (!_userInfo || !_userInfo.avatarurl || !_userInfo.name) {
225
+ client.fetchUserInfoById([cvs.conversationId], ["nickname", "avatarurl", "mail", "phone", "gender", "sign", "birth", "ext"]).then(function (res) {
226
+ var _res$data$cvs$convers;
227
+ setHeaderInfo(function (prevState) {
228
+ return _objectSpread(_objectSpread({}, prevState), {}, {
229
+ headerImageURL: res.data[cvs.conversationId].avatarurl,
230
+ conversationName: res.data[cvs.conversationId].nickname
231
231
  });
232
- }
232
+ });
233
+ var tempUserInfo = rootStore.addressStore.appUsersInfo[cvs.conversationId];
234
+ rootStore.addressStore.appUsersInfo[cvs.conversationId] = _objectSpread(_objectSpread({}, tempUserInfo || {}), {}, {
235
+ userId: cvs.conversationId,
236
+ name: res.data[cvs.conversationId].nickname,
237
+ avatarurl: res.data[cvs.conversationId].avatarurl
238
+ });
239
+ reportAgentInUse(http, cvs.conversationId, res.data[cvs.conversationId]);
240
+ var customObj = JSON.parse((_res$data$cvs$convers = res.data[cvs.conversationId]) === null || _res$data$cvs$convers === void 0 ? void 0 : _res$data$cvs$convers.ext);
241
+ // 假设有一个字段 shouldShowInList 来判断是否展示
242
+ setIsAgent((customObj === null || customObj === void 0 ? void 0 : customObj.certification) === "1");
233
243
  });
234
244
  } else {
235
- var _appUsersInfo$avataru, _ref3, _appUsersInfo$name;
236
- var imageurl = (_appUsersInfo$avataru = appUsersInfo === null || appUsersInfo === void 0 ? void 0 : appUsersInfo.avatarurl) !== null && _appUsersInfo$avataru !== void 0 ? _appUsersInfo$avataru : "";
237
- var name = (_ref3 = (_appUsersInfo$name = appUsersInfo === null || appUsersInfo === void 0 ? void 0 : appUsersInfo.name) !== null && _appUsersInfo$name !== void 0 ? _appUsersInfo$name : cvs.name) !== null && _ref3 !== void 0 ? _ref3 : "";
238
245
  setHeaderInfo(function (prevState) {
239
246
  return _objectSpread(_objectSpread({}, prevState), {}, {
240
- headerImageURL: imageurl,
241
- conversationName: name
247
+ headerImageURL: _userInfo.avatarurl,
248
+ conversationName: _userInfo.name
242
249
  });
243
250
  });
251
+ reportAgentInUse(http, cvs.conversationId, _userInfo);
252
+ var customObj = JSON.parse(_userInfo === null || _userInfo === void 0 ? void 0 : _userInfo.ext);
253
+ // 假设有一个字段 shouldShowInList 来判断是否展示
254
+ setIsAgent((customObj === null || customObj === void 0 ? void 0 : customObj.certification) === "1");
244
255
  }
245
256
  }
246
257
  }, [props.conversationId]);
@@ -322,7 +333,7 @@ var HighlyCustomChat = function HighlyCustomChat(props) {
322
333
  };
323
334
  }, [getHeaderInfo, initConversation, props.conversationId]);
324
335
  var handleSendMessage = /*#__PURE__*/function () {
325
- var _ref4 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(text) {
336
+ var _ref3 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(text) {
326
337
  var txtMessage;
327
338
  return _regeneratorRuntime.wrap(function _callee$(_context2) {
328
339
  while (1) switch (_context2.prev = _context2.next) {
@@ -358,11 +369,11 @@ var HighlyCustomChat = function HighlyCustomChat(props) {
358
369
  }, _callee, null, [[2, 9]]);
359
370
  }));
360
371
  return function handleSendMessage(_x) {
361
- return _ref4.apply(this, arguments);
372
+ return _ref3.apply(this, arguments);
362
373
  };
363
374
  }();
364
375
  var afterSendMsg = /*#__PURE__*/function () {
365
- var _ref5 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee2(msgInfo) {
376
+ var _ref4 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee2(msgInfo) {
366
377
  return _regeneratorRuntime.wrap(function _callee2$(_context3) {
367
378
  while (1) switch (_context3.prev = _context3.next) {
368
379
  case 0:
@@ -374,7 +385,7 @@ var HighlyCustomChat = function HighlyCustomChat(props) {
374
385
  }, _callee2);
375
386
  }));
376
387
  return function afterSendMsg(_x2) {
377
- return _ref5.apply(this, arguments);
388
+ return _ref4.apply(this, arguments);
378
389
  };
379
390
  }();
380
391
  return /*#__PURE__*/React.createElement("div", {
@@ -1,9 +1,3 @@
1
- import _asyncToGenerator from '@babel/runtime-corejs3/helpers/esm/asyncToGenerator';
2
- import _defineProperty from '@babel/runtime-corejs3/helpers/esm/defineProperty';
3
- import _slicedToArray from '@babel/runtime-corejs3/helpers/esm/slicedToArray';
4
- import _regeneratorRuntime from '@babel/runtime-corejs3/regenerator';
5
- import _findInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/find';
6
- import _concatInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/concat';
7
1
  import _Object$keys from '@babel/runtime-corejs3/core-js-stable/object/keys';
8
2
  import _Object$getOwnPropertySymbols from '@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols';
9
3
  import _filterInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/filter';
@@ -17,6 +11,12 @@ import _Array$from from '@babel/runtime-corejs3/core-js-stable/array/from';
17
11
  import _Symbol from '@babel/runtime-corejs3/core-js-stable/symbol';
18
12
  import _getIteratorMethod from '@babel/runtime-corejs3/core-js/get-iterator-method';
19
13
  import _Array$isArray from '@babel/runtime-corejs3/core-js-stable/array/is-array';
14
+ import _asyncToGenerator from '@babel/runtime-corejs3/helpers/esm/asyncToGenerator';
15
+ import _defineProperty from '@babel/runtime-corejs3/helpers/esm/defineProperty';
16
+ import _slicedToArray from '@babel/runtime-corejs3/helpers/esm/slicedToArray';
17
+ import _regeneratorRuntime from '@babel/runtime-corejs3/regenerator';
18
+ import _findInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/find';
19
+ import _concatInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/concat';
20
20
  import React, { useContext, useState, useEffect } from 'react';
21
21
  import './style/index.scss';
22
22
  import { useConversationContext, useClient, rootStore, ConversationItem, Avatar } from 'agora-chat-uikit';
@@ -24,10 +24,10 @@ import { Context } from '../../IM/context.js';
24
24
  import OperateBtn from './OperateBtn/index.js';
25
25
 
26
26
  function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof _Symbol && _getIteratorMethod(r) || r["@@iterator"]; if (!t) { if (_Array$isArray(r) || (t = _unsupportedIterableToArray(r)) || e) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: true } : { done: false, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = true, u = false; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = true, o = r; }, f: function f() { try { a || null == t["return"] || t["return"](); } finally { if (u) throw o; } } }; }
27
- function _unsupportedIterableToArray(r, a) { if (r) { var _context9; if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = _sliceInstanceProperty(_context9 = {}.toString.call(r)).call(_context9, 8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? _Array$from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
27
+ function _unsupportedIterableToArray(r, a) { if (r) { var _context7; if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = _sliceInstanceProperty(_context7 = {}.toString.call(r)).call(_context7, 8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? _Array$from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
28
28
  function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
29
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; }
30
- function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var _context7, _context8; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty(_context7 = ownKeys(Object(t), true)).call(_context7, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(e, _Object$getOwnPropertyDescriptors(t)) : _forEachInstanceProperty(_context8 = ownKeys(Object(t))).call(_context8, function (r) { _Object$defineProperty(e, r, _Object$getOwnPropertyDescriptor(t, r)); }); } return e; }
30
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var _context5, _context6; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty(_context5 = ownKeys(Object(t), true)).call(_context5, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(e, _Object$getOwnPropertyDescriptors(t)) : _forEachInstanceProperty(_context6 = ownKeys(Object(t))).call(_context6, function (r) { _Object$defineProperty(e, r, _Object$getOwnPropertyDescriptor(t, r)); }); } return e; }
31
31
  var CustomConversationItem = function CustomConversationItem(props) {
32
32
  var cvs = props.cvs,
33
33
  _onClick = props.onClick;
@@ -80,11 +80,10 @@ var CustomConversationItem = function CustomConversationItem(props) {
80
80
  setAvatar(res.data[cvs.conversationId].avatarurl);
81
81
  setName(res.data[cvs.conversationId].nickname);
82
82
  if ((_res$data$cvs$convers = res.data[cvs.conversationId]) !== null && _res$data$cvs$convers !== void 0 && _res$data$cvs$convers.ext) {
83
- var _res$data$cvs$convers2, _context2, _context3;
83
+ var _res$data$cvs$convers2;
84
84
  var customObj = JSON.parse((_res$data$cvs$convers2 = res.data[cvs.conversationId]) === null || _res$data$cvs$convers2 === void 0 ? void 0 : _res$data$cvs$convers2.ext);
85
85
  // 假设有一个字段 shouldShowInList 来判断是否展示
86
86
  setCanShow((customObj === null || customObj === void 0 ? void 0 : customObj.certification) !== "2");
87
- console.log(_concatInstanceProperty(_context2 = _concatInstanceProperty(_context3 = "request finished:current conversation name is ".concat(res.data[cvs.conversationId].nickname, ", certif\n ication is ")).call(_context3, customObj === null || customObj === void 0 ? void 0 : customObj.certification, ", canshow is ")).call(_context2, (customObj === null || customObj === void 0 ? void 0 : customObj.certification) !== "2"));
88
87
  }
89
88
  var tempUserInfo = rootStore.addressStore.appUsersInfo[cvs.conversationId];
90
89
  rootStore.addressStore.appUsersInfo[cvs.conversationId] = _objectSpread(_objectSpread({}, tempUserInfo || {}), {}, {
@@ -98,11 +97,11 @@ var CustomConversationItem = function CustomConversationItem(props) {
98
97
  setAvatar(userInfo.avatarurl);
99
98
  setName(userInfo.name);
100
99
  if (userInfo !== null && userInfo !== void 0 && userInfo.ext) {
101
- var _context4, _context5;
100
+ var _context2, _context3;
102
101
  var customObj = JSON.parse(userInfo.ext);
103
102
  // 假设有一个字段 shouldShowInList 来判断是否展示
104
103
  setCanShow((customObj === null || customObj === void 0 ? void 0 : customObj.certification) !== "2");
105
- console.log(_concatInstanceProperty(_context4 = _concatInstanceProperty(_context5 = "cache:current conversation name is ".concat(userInfo.name, ", certif\n ication is ")).call(_context5, customObj === null || customObj === void 0 ? void 0 : customObj.certification, ", canshow is ")).call(_context4, (customObj === null || customObj === void 0 ? void 0 : customObj.certification) !== "2"));
104
+ console.log(_concatInstanceProperty(_context2 = _concatInstanceProperty(_context3 = "cache:current conversation name is ".concat(userInfo.name, ", certif\n ication is ")).call(_context3, customObj === null || customObj === void 0 ? void 0 : customObj.certification, ", canshow is ")).call(_context2, (customObj === null || customObj === void 0 ? void 0 : customObj.certification) !== "2"));
106
105
  }
107
106
  }
108
107
  }
@@ -110,60 +109,60 @@ var CustomConversationItem = function CustomConversationItem(props) {
110
109
  var clickConversationItem = /*#__PURE__*/function () {
111
110
  var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
112
111
  var handleDefaultBehavir, _iterator, _step, item, isJump;
113
- return _regeneratorRuntime.wrap(function _callee$(_context6) {
114
- while (1) switch (_context6.prev = _context6.next) {
112
+ return _regeneratorRuntime.wrap(function _callee$(_context4) {
113
+ while (1) switch (_context4.prev = _context4.next) {
115
114
  case 0:
116
115
  handleDefaultBehavir = true;
117
116
  _iterator = _createForOfIteratorHelper(additionalConversations || []);
118
- _context6.prev = 2;
117
+ _context4.prev = 2;
119
118
  _iterator.s();
120
119
  case 4:
121
120
  if ((_step = _iterator.n()).done) {
122
- _context6.next = 19;
121
+ _context4.next = 19;
123
122
  break;
124
123
  }
125
124
  item = _step.value;
126
125
  if (!(item.conversationId === cvs.conversationId)) {
127
- _context6.next = 17;
126
+ _context4.next = 17;
128
127
  break;
129
128
  }
130
129
  if (!onAdditionalConversationClick) {
131
- _context6.next = 17;
130
+ _context4.next = 17;
132
131
  break;
133
132
  }
134
- _context6.next = 10;
133
+ _context4.next = 10;
135
134
  return onAdditionalConversationClick(item);
136
135
  case 10:
137
- isJump = _context6.sent;
136
+ isJump = _context4.sent;
138
137
  if (!isJump) {
139
- _context6.next = 16;
138
+ _context4.next = 16;
140
139
  break;
141
140
  }
142
141
  setCurrentConversation(cvs);
143
142
  handleDefaultBehavir = false;
144
- _context6.next = 17;
143
+ _context4.next = 17;
145
144
  break;
146
145
  case 16:
147
- return _context6.abrupt("return");
146
+ return _context4.abrupt("return");
148
147
  case 17:
149
- _context6.next = 4;
148
+ _context4.next = 4;
150
149
  break;
151
150
  case 19:
152
- _context6.next = 24;
151
+ _context4.next = 24;
153
152
  break;
154
153
  case 21:
155
- _context6.prev = 21;
156
- _context6.t0 = _context6["catch"](2);
157
- _iterator.e(_context6.t0);
154
+ _context4.prev = 21;
155
+ _context4.t0 = _context4["catch"](2);
156
+ _iterator.e(_context4.t0);
158
157
  case 24:
159
- _context6.prev = 24;
158
+ _context4.prev = 24;
160
159
  _iterator.f();
161
- return _context6.finish(24);
160
+ return _context4.finish(24);
162
161
  case 27:
163
162
  if (handleDefaultBehavir) setCurrentConversation(cvs);
164
163
  case 28:
165
164
  case "end":
166
- return _context6.stop();
165
+ return _context4.stop();
167
166
  }
168
167
  }, _callee, null, [[2, 21, 24, 27]]);
169
168
  }));
@@ -6,15 +6,15 @@ import _forEachInstanceProperty from '@babel/runtime-corejs3/core-js-stable/inst
6
6
  import _setInterval from '@babel/runtime-corejs3/core-js-stable/set-interval';
7
7
  import React, { useState, useRef, useContext, useCallback, useEffect } from 'react';
8
8
  import { useConversationContext, rootStore, ConversationList } from 'agora-chat-uikit';
9
- import { Tooltip, Button } from 'antd';
10
- import img$8 from './image/ic_search.svg.js';
11
- import img$4 from './image/ic_menu.svg.js';
12
- import img$7 from './image/ic_search_light.svg.js';
13
- import img$3 from './image/ic_menu_light.svg.js';
14
- import img$6 from './image/ic_close.svg.js';
15
- import img$5 from './image/ic_close_light.svg.js';
16
- import img$1 from './image/group.svg.js';
17
- import img$2 from './image/create.svg.js';
9
+ import { Button, Tooltip } from 'antd';
10
+ import img$4 from './image/ic_search.svg.js';
11
+ import img$8 from './image/ic_menu.svg.js';
12
+ import img$3 from './image/ic_search_light.svg.js';
13
+ import img$7 from './image/ic_menu_light.svg.js';
14
+ import img$2 from './image/ic_close.svg.js';
15
+ import img$1 from './image/ic_close_light.svg.js';
16
+ import img$5 from './image/group.svg.js';
17
+ import img$6 from './image/create.svg.js';
18
18
  import img from './image/message.svg.js';
19
19
  import classNames from 'classnames';
20
20
  import Searchbox from './Searchbox/index.js';
@@ -167,7 +167,7 @@ var Sidebar = function Sidebar(props) {
167
167
  var renderIcon = function renderIcon() {
168
168
  if (componentType !== "default") {
169
169
  return /*#__PURE__*/React.createElement("img", {
170
- src: theme === "light" ? img$5 : img$6,
170
+ src: theme === "light" ? img$1 : img$2,
171
171
  className: "cursor-pointer",
172
172
  onClick: function onClick() {
173
173
  setComponentType("default");
@@ -175,7 +175,7 @@ var Sidebar = function Sidebar(props) {
175
175
  });
176
176
  }
177
177
  return /*#__PURE__*/React.createElement("img", {
178
- src: theme === "light" ? img$7 : img$8,
178
+ src: theme === "light" ? img$3 : img$4,
179
179
  className: "cursor-pointer",
180
180
  onClick: function onClick() {
181
181
  setComponentType("search");
@@ -185,7 +185,7 @@ var Sidebar = function Sidebar(props) {
185
185
  var renderMobileIcon = function renderMobileIcon() {
186
186
  if (componentType !== "default") {
187
187
  return /*#__PURE__*/React.createElement("img", {
188
- src: img$6,
188
+ src: img$2,
189
189
  className: "cursor-pointer",
190
190
  onClick: function onClick() {
191
191
  var _mobileCreateGroup$cu3, _mobileCreateGroup$cu4;
@@ -195,7 +195,7 @@ var Sidebar = function Sidebar(props) {
195
195
  });
196
196
  }
197
197
  return /*#__PURE__*/React.createElement("img", {
198
- src: theme === "light" ? img$7 : img$8,
198
+ src: theme === "light" ? img$3 : img$4,
199
199
  className: "cursor-pointer",
200
200
  onClick: function onClick() {
201
201
  setComponentType("search");
@@ -241,7 +241,7 @@ var Sidebar = function Sidebar(props) {
241
241
  setComponentType("group");
242
242
  }
243
243
  }, /*#__PURE__*/React.createElement("img", {
244
- src: img$1,
244
+ src: img$5,
245
245
  alt: ""
246
246
  }), /*#__PURE__*/React.createElement("span", {
247
247
  className: "text-sm"
@@ -251,13 +251,13 @@ var Sidebar = function Sidebar(props) {
251
251
  setComponentType("createGroup");
252
252
  }
253
253
  }, /*#__PURE__*/React.createElement("img", {
254
- src: img$2,
254
+ src: img$6,
255
255
  alt: ""
256
256
  }), /*#__PURE__*/React.createElement("span", {
257
257
  className: "text-sm"
258
258
  }, "Create Group")))
259
259
  }, /*#__PURE__*/React.createElement("img", {
260
- src: theme === "light" ? img$3 : img$4,
260
+ src: theme === "light" ? img$7 : img$8,
261
261
  className: "cursor-pointer menu",
262
262
  onClick: function onClick() {
263
263
  setTooltipOpen(!tooltipOpen);
@@ -308,35 +308,7 @@ var Sidebar = function Sidebar(props) {
308
308
  className: "text-xl"
309
309
  }, "Messages")), /*#__PURE__*/React.createElement("div", {
310
310
  className: classNames("yuze-conversationList-header-right flex justify-center items-center gap-6")
311
- }, /*#__PURE__*/React.createElement(Tooltip, {
312
- placement: "bottomLeft",
313
- title: /*#__PURE__*/React.createElement("div", {
314
- className: "yuze-conversationList-header-right-tooltip flex flex-col"
315
- }, /*#__PURE__*/React.createElement("div", {
316
- className: "yuze-conversationList-header-right-tooltip-item flex flex-row items-center gap-3 cursor-pointer",
317
- onClick: function onClick() {
318
- setComponentType("group");
319
- }
320
- }, /*#__PURE__*/React.createElement("img", {
321
- src: img$1,
322
- alt: ""
323
- }), /*#__PURE__*/React.createElement("span", {
324
- className: "text-sm"
325
- }, "Groups")), /*#__PURE__*/React.createElement("div", {
326
- className: "yuze-conversationList-header-right-tooltip-item flex flex-row items-center gap-3 cursor-pointer",
327
- onClick: function onClick() {
328
- setOpenCreateGroup(true);
329
- }
330
- }, /*#__PURE__*/React.createElement("img", {
331
- src: img$2,
332
- alt: ""
333
- }), /*#__PURE__*/React.createElement("span", {
334
- className: "text-sm"
335
- }, "Create Group")))
336
- }, /*#__PURE__*/React.createElement("img", {
337
- src: theme === "light" ? img$3 : img$4,
338
- className: "cursor-pointer"
339
- })), renderIcon())), /*#__PURE__*/React.createElement(MobileHeader, {
311
+ }, renderIcon())), /*#__PURE__*/React.createElement(MobileHeader, {
340
312
  className: "sm:hidden",
341
313
  leftIcon: renderMobileIcon(),
342
314
  rightIcon: renderMobileRight(),
package/es/tools.d.ts ADDED
@@ -0,0 +1,3 @@
1
+ import { AxiosInstance } from "axios";
2
+ export declare const reportAgentInUse: (httpclient: AxiosInstance, agentId: string, userInfo: any) => Promise<void>;
3
+ export declare const reportAgentMsg: (httpclient: AxiosInstance, userid?: string, content?: string) => Promise<void>;
package/es/tools.js ADDED
@@ -0,0 +1,81 @@
1
+ import _asyncToGenerator from '@babel/runtime-corejs3/helpers/esm/asyncToGenerator';
2
+ import _regeneratorRuntime from '@babel/runtime-corejs3/regenerator';
3
+ import _JSON$stringify from '@babel/runtime-corejs3/core-js-stable/json/stringify';
4
+
5
+ var reportAgentInUse = /*#__PURE__*/function () {
6
+ var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(httpclient, agentId, userInfo) {
7
+ var customObj;
8
+ return _regeneratorRuntime.wrap(function _callee$(_context) {
9
+ while (1) switch (_context.prev = _context.next) {
10
+ case 0:
11
+ console.log('need report: the userinfo is', userInfo, _JSON$stringify(userInfo));
12
+ _context.prev = 1;
13
+ if (userInfo !== null && userInfo !== void 0 && userInfo.ext) {
14
+ _context.next = 4;
15
+ break;
16
+ }
17
+ return _context.abrupt("return");
18
+ case 4:
19
+ customObj = JSON.parse(userInfo.ext); // 假设有一个字段 shouldShowInList 来判断是否展示
20
+ if (!((customObj === null || customObj === void 0 ? void 0 : customObj.certification) === "1")) {
21
+ _context.next = 8;
22
+ break;
23
+ }
24
+ _context.next = 8;
25
+ return httpclient.post("/api/agentcollect/agentUsed", {
26
+ agentid: agentId
27
+ });
28
+ case 8:
29
+ _context.next = 12;
30
+ break;
31
+ case 10:
32
+ _context.prev = 10;
33
+ _context.t0 = _context["catch"](1);
34
+ case 12:
35
+ case "end":
36
+ return _context.stop();
37
+ }
38
+ }, _callee, null, [[1, 10]]);
39
+ }));
40
+ return function reportAgentInUse(_x, _x2, _x3) {
41
+ return _ref.apply(this, arguments);
42
+ };
43
+ }();
44
+ var reportAgentMsg = /*#__PURE__*/function () {
45
+ var _ref2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee2(httpclient) {
46
+ var userid,
47
+ content,
48
+ options,
49
+ _args2 = arguments;
50
+ return _regeneratorRuntime.wrap(function _callee2$(_context2) {
51
+ while (1) switch (_context2.prev = _context2.next) {
52
+ case 0:
53
+ userid = _args2.length > 1 && _args2[1] !== undefined ? _args2[1] : "";
54
+ content = _args2.length > 2 && _args2[2] !== undefined ? _args2[2] : "";
55
+ _context2.prev = 2;
56
+ console.log('need report: the userid is', userid);
57
+ options = {
58
+ userid: userid,
59
+ content: content
60
+ };
61
+ _context2.next = 7;
62
+ return httpclient.post("/api/imchannel/sendagentmessage", options);
63
+ case 7:
64
+ _context2.next = 12;
65
+ break;
66
+ case 9:
67
+ _context2.prev = 9;
68
+ _context2.t0 = _context2["catch"](2);
69
+ console.log(_context2.t0);
70
+ case 12:
71
+ case "end":
72
+ return _context2.stop();
73
+ }
74
+ }, _callee2, null, [[2, 9]]);
75
+ }));
76
+ return function reportAgentMsg(_x4) {
77
+ return _ref2.apply(this, arguments);
78
+ };
79
+ }();
80
+
81
+ export { reportAgentInUse, reportAgentMsg };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "whyuzeim",
3
- "version": "1.1.7",
3
+ "version": "1.1.8",
4
4
  "description": "im componenets",
5
5
  "main": "cjs/index.js",
6
6
  "module": "es/index.js",