whyuzeim 1.1.153 → 1.1.155

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.
@@ -97,9 +97,9 @@
97
97
 
98
98
  //override
99
99
  --im-msg-bubble-color-left: rgba(255, 255, 255, 0.05);
100
- --im-msg-bubble-color-right: #91CAFF;
100
+ --im-msg-bubble-color-right: rgba(144, 249, 38, 0.05);
101
101
  --im-msg-bubble-font-color: rgba(255, 255, 255, 1);
102
- --im-msg-bubble-right-font-color: rgba(0, 0, 0, 0.90);
102
+ --im-msg-bubble-right-font-color: rgba(144, 249, 38, 1);
103
103
 
104
104
  .cui-chat-dark {
105
105
  background-color: var(--im-main-backgroundColor);
package/cjs/index.js CHANGED
@@ -8,16 +8,12 @@ var classNames = require('classnames');
8
8
  var axios = require('axios');
9
9
  var _asyncToGenerator = require('@babel/runtime-corejs3/helpers/esm/asyncToGenerator');
10
10
  var _regeneratorRuntime = require('@babel/runtime-corejs3/regenerator');
11
- var jsrsasign = require('jsrsasign');
12
- var _typeof = require('@babel/runtime-corejs3/helpers/esm/typeof');
13
- require('@babel/runtime-corejs3/core-js-stable/json/stringify');
14
- var CryptoJS = require('crypto-js');
15
- var JSEncrypt = require('jsencrypt');
16
11
  var _sliceInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/slice');
17
12
  var _Array$from = require('@babel/runtime-corejs3/core-js-stable/array/from');
18
13
  var _Symbol = require('@babel/runtime-corejs3/core-js-stable/symbol');
19
14
  var _getIteratorMethod = require('@babel/runtime-corejs3/core-js/get-iterator-method');
20
15
  var _Array$isArray = require('@babel/runtime-corejs3/core-js-stable/array/is-array');
16
+ var _typeof = require('@babel/runtime-corejs3/helpers/esm/typeof');
21
17
  require('./IM/style/index.scss');
22
18
  var _Object$keys = require('@babel/runtime-corejs3/core-js-stable/object/keys');
23
19
  var _Object$getOwnPropertySymbols = require('@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols');
@@ -134943,34 +134939,6 @@ var Context = /*#__PURE__*/React.createContext({
134943
134939
  canSidebarExpand: true
134944
134940
  });
134945
134941
 
134946
- new JSEncrypt();
134947
- // 生成 AESKEY
134948
- var aesKey = createAesKey();
134949
- function createAesKey() {
134950
- var expect = 16;
134951
- var str = Math.random().toString(36).substr(2);
134952
- while (str.length < expect) {
134953
- str += Math.random().toString(36).substr(2);
134954
- }
134955
- str = str.substr(0, 16);
134956
- return str;
134957
- }
134958
- /**
134959
- * AES 解密
134960
- * @param word 待解密数据
134961
- * @param keyStr 解密 key
134962
- * @returns {string} 返回解密字符串
134963
- */
134964
- function aesDecrypt(word, keyStr) {
134965
- keyStr = keyStr || aesKey;
134966
- var key = CryptoJS.enc.Utf8.parse(keyStr);
134967
- var decrypt = CryptoJS.AES.decrypt(word, key, {
134968
- mode: CryptoJS.mode.ECB,
134969
- padding: CryptoJS.pad.Pkcs7
134970
- });
134971
- return decrypt.toString(CryptoJS.enc.Utf8);
134972
- }
134973
-
134974
134942
  var useGetAgoraToken = function useGetAgoraToken(http, uid) {
134975
134943
  var _useState = React.useState(""),
134976
134944
  _useState2 = _slicedToArray(_useState, 2),
@@ -134978,7 +134946,7 @@ var useGetAgoraToken = function useGetAgoraToken(http, uid) {
134978
134946
  setAgoraToken = _useState2[1];
134979
134947
  var client = z_e();
134980
134948
  var handleGetToken = React.useCallback(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
134981
- var result1, publickey, publicPemKey, pub, enc, result2, token;
134949
+ var result2;
134982
134950
  return _regeneratorRuntime.wrap(function _callee$(_context) {
134983
134951
  while (1) switch (_context.prev = _context.next) {
134984
134952
  case 0:
@@ -134990,29 +134958,14 @@ var useGetAgoraToken = function useGetAgoraToken(http, uid) {
134990
134958
  case 2:
134991
134959
  window.AGAIN_ENTER_IM_INIT = true;
134992
134960
  _context.next = 5;
134993
- return http.get("/capi/account/imuser/getkeypair", {
134994
- params: {
134995
- type: 2
134996
- }
134961
+ return http.get("/api/imchannel/getUserToken", {
134962
+ params: {}
134997
134963
  });
134998
134964
  case 5:
134999
- result1 = _context.sent;
135000
- publickey = result1.data.data.publickey; // const rsaStr = encryption.rsaEncrypt(this.aesKey, publickey)
135001
- publicPemKey = "-----BEGIN PUBLIC KEY-----\n" + publickey + "\n-----END PUBLIC KEY-----";
135002
- pub = jsrsasign.KEYUTIL.getKey(publicPemKey);
135003
- enc = jsrsasign.KJUR.crypto.Cipher.encrypt(aesKey, pub, "RSAOAEP");
135004
- _context.next = 12;
135005
- return http.get("/capi/account/imuser/getutoken", {
135006
- params: {
135007
- type: 2,
135008
- token: jsrsasign.hextob64(enc)
135009
- }
135010
- });
135011
- case 12:
135012
134965
  result2 = _context.sent;
135013
- token = aesDecrypt(result2.data.data.utoken, aesKey);
135014
- setAgoraToken(token);
135015
- case 15:
134966
+ // const token = aesDecrypt(result2.data.data.token, aesKey);
134967
+ setAgoraToken(result2.data.data.token);
134968
+ case 7:
135016
134969
  case "end":
135017
134970
  return _context.stop();
135018
134971
  }
@@ -136856,13 +136809,13 @@ var HighlyCustomChat = function HighlyCustomChat(props) {
136856
136809
  setIsAgent = _useState10[1];
136857
136810
  var renderTxtMsg = function renderTxtMsg(msg, onApply) {
136858
136811
  var _msg$from, _userInfo$uid;
136859
- var isMySelf = (msg === null || msg === void 0 ? void 0 : msg.bySelf) === true || (msg === null || msg === void 0 || (_msg$from = msg.from) === null || _msg$from === void 0 ? void 0 : _msg$from.toLowerCase()) === ((_userInfo$uid = userInfo.uid) === null || _userInfo$uid === void 0 ? void 0 : _userInfo$uid.toLowerCase());
136812
+ (msg === null || msg === void 0 ? void 0 : msg.bySelf) === true || (msg === null || msg === void 0 || (_msg$from = msg.from) === null || _msg$from === void 0 ? void 0 : _msg$from.toLowerCase()) === ((_userInfo$uid = userInfo.uid) === null || _userInfo$uid === void 0 ? void 0 : _userInfo$uid.toLowerCase());
136860
136813
  return /*#__PURE__*/React.createElement(qh, {
136861
136814
  bubbleType: "none",
136862
136815
  reaction: false,
136863
136816
  select: false,
136864
136817
  thread: false,
136865
- direction: isMySelf ? "rtl" : "ltr",
136818
+ direction: "ltr",
136866
136819
  renderUserProfile: function renderUserProfile() {
136867
136820
  return null;
136868
136821
  },
@@ -136873,8 +136826,8 @@ var HighlyCustomChat = function HighlyCustomChat(props) {
136873
136826
  visible: false,
136874
136827
  icon: null,
136875
136828
  actions: []
136876
- },
136877
- showAvatar: !isMySelf
136829
+ }
136830
+ // showAvatar={!isMySelf}
136878
136831
  // avatar={!isMySelf?<img src={headerInfo.headerImageURL||defaultAvatar} className="w-[48px] h-[48px] rounded-full overflow-hidden object-fit" />:undefined}
136879
136832
  ,
136880
136833
  children: renderLongTextMsg(msg, onApply)
@@ -136910,7 +136863,7 @@ var HighlyCustomChat = function HighlyCustomChat(props) {
136910
136863
  var isMySelf = (msg === null || msg === void 0 ? void 0 : msg.bySelf) === true || (msg === null || msg === void 0 || (_msg$from2 = msg.from) === null || _msg$from2 === void 0 ? void 0 : _msg$from2.toLowerCase()) === ((_userInfo$uid2 = userInfo.uid) === null || _userInfo$uid2 === void 0 ? void 0 : _userInfo$uid2.toLowerCase());
136911
136864
  // 复制代码到剪贴板
136912
136865
  return /*#__PURE__*/React.createElement("div", {
136913
- className: "text-[var(--im-main-fontColor)] flex flex-col gap-1 ".concat(isMySelf ? "items-end" : "items-start")
136866
+ className: "text-[var(--im-main-fontColor)] flex flex-col gap-1 ".concat("items-start")
136914
136867
  }, /*#__PURE__*/React.createElement("div", {
136915
136868
  style: {
136916
136869
  background: isMySelf ? "var(--im-msg-bubble-color-right)" : "var(--im-msg-bubble-color-left)",
@@ -97,9 +97,9 @@
97
97
 
98
98
  //override
99
99
  --im-msg-bubble-color-left: rgba(255, 255, 255, 0.05);
100
- --im-msg-bubble-color-right: #91CAFF;
100
+ --im-msg-bubble-color-right: rgba(144, 249, 38, 0.05);
101
101
  --im-msg-bubble-font-color: rgba(255, 255, 255, 1);
102
- --im-msg-bubble-right-font-color: rgba(0, 0, 0, 0.90);
102
+ --im-msg-bubble-right-font-color: rgba(144, 249, 38, 1);
103
103
 
104
104
  .cui-chat-dark {
105
105
  background-color: var(--im-main-backgroundColor);
package/es/index.js CHANGED
@@ -7,16 +7,12 @@ import classNames from 'classnames';
7
7
  import axios from 'axios';
8
8
  import _asyncToGenerator from '@babel/runtime-corejs3/helpers/esm/asyncToGenerator';
9
9
  import _regeneratorRuntime from '@babel/runtime-corejs3/regenerator';
10
- import jsrsasign from 'jsrsasign';
11
- import _typeof from '@babel/runtime-corejs3/helpers/esm/typeof';
12
- import '@babel/runtime-corejs3/core-js-stable/json/stringify';
13
- import CryptoJS from 'crypto-js';
14
- import JSEncrypt from 'jsencrypt';
15
10
  import _sliceInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/slice';
16
11
  import _Array$from from '@babel/runtime-corejs3/core-js-stable/array/from';
17
12
  import _Symbol from '@babel/runtime-corejs3/core-js-stable/symbol';
18
13
  import _getIteratorMethod from '@babel/runtime-corejs3/core-js/get-iterator-method';
19
14
  import _Array$isArray from '@babel/runtime-corejs3/core-js-stable/array/is-array';
15
+ import _typeof from '@babel/runtime-corejs3/helpers/esm/typeof';
20
16
  import './IM/style/index.scss';
21
17
  import _Object$keys from '@babel/runtime-corejs3/core-js-stable/object/keys';
22
18
  import _Object$getOwnPropertySymbols from '@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols';
@@ -134922,34 +134918,6 @@ var Context = /*#__PURE__*/React__default.createContext({
134922
134918
  canSidebarExpand: true
134923
134919
  });
134924
134920
 
134925
- new JSEncrypt();
134926
- // 生成 AESKEY
134927
- var aesKey = createAesKey();
134928
- function createAesKey() {
134929
- var expect = 16;
134930
- var str = Math.random().toString(36).substr(2);
134931
- while (str.length < expect) {
134932
- str += Math.random().toString(36).substr(2);
134933
- }
134934
- str = str.substr(0, 16);
134935
- return str;
134936
- }
134937
- /**
134938
- * AES 解密
134939
- * @param word 待解密数据
134940
- * @param keyStr 解密 key
134941
- * @returns {string} 返回解密字符串
134942
- */
134943
- function aesDecrypt(word, keyStr) {
134944
- keyStr = keyStr || aesKey;
134945
- var key = CryptoJS.enc.Utf8.parse(keyStr);
134946
- var decrypt = CryptoJS.AES.decrypt(word, key, {
134947
- mode: CryptoJS.mode.ECB,
134948
- padding: CryptoJS.pad.Pkcs7
134949
- });
134950
- return decrypt.toString(CryptoJS.enc.Utf8);
134951
- }
134952
-
134953
134921
  var useGetAgoraToken = function useGetAgoraToken(http, uid) {
134954
134922
  var _useState = useState(""),
134955
134923
  _useState2 = _slicedToArray(_useState, 2),
@@ -134957,7 +134925,7 @@ var useGetAgoraToken = function useGetAgoraToken(http, uid) {
134957
134925
  setAgoraToken = _useState2[1];
134958
134926
  var client = z_e();
134959
134927
  var handleGetToken = useCallback(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
134960
- var result1, publickey, publicPemKey, pub, enc, result2, token;
134928
+ var result2;
134961
134929
  return _regeneratorRuntime.wrap(function _callee$(_context) {
134962
134930
  while (1) switch (_context.prev = _context.next) {
134963
134931
  case 0:
@@ -134969,29 +134937,14 @@ var useGetAgoraToken = function useGetAgoraToken(http, uid) {
134969
134937
  case 2:
134970
134938
  window.AGAIN_ENTER_IM_INIT = true;
134971
134939
  _context.next = 5;
134972
- return http.get("/capi/account/imuser/getkeypair", {
134973
- params: {
134974
- type: 2
134975
- }
134940
+ return http.get("/api/imchannel/getUserToken", {
134941
+ params: {}
134976
134942
  });
134977
134943
  case 5:
134978
- result1 = _context.sent;
134979
- publickey = result1.data.data.publickey; // const rsaStr = encryption.rsaEncrypt(this.aesKey, publickey)
134980
- publicPemKey = "-----BEGIN PUBLIC KEY-----\n" + publickey + "\n-----END PUBLIC KEY-----";
134981
- pub = jsrsasign.KEYUTIL.getKey(publicPemKey);
134982
- enc = jsrsasign.KJUR.crypto.Cipher.encrypt(aesKey, pub, "RSAOAEP");
134983
- _context.next = 12;
134984
- return http.get("/capi/account/imuser/getutoken", {
134985
- params: {
134986
- type: 2,
134987
- token: jsrsasign.hextob64(enc)
134988
- }
134989
- });
134990
- case 12:
134991
134944
  result2 = _context.sent;
134992
- token = aesDecrypt(result2.data.data.utoken, aesKey);
134993
- setAgoraToken(token);
134994
- case 15:
134945
+ // const token = aesDecrypt(result2.data.data.token, aesKey);
134946
+ setAgoraToken(result2.data.data.token);
134947
+ case 7:
134995
134948
  case "end":
134996
134949
  return _context.stop();
134997
134950
  }
@@ -136835,13 +136788,13 @@ var HighlyCustomChat = function HighlyCustomChat(props) {
136835
136788
  setIsAgent = _useState10[1];
136836
136789
  var renderTxtMsg = function renderTxtMsg(msg, onApply) {
136837
136790
  var _msg$from, _userInfo$uid;
136838
- var isMySelf = (msg === null || msg === void 0 ? void 0 : msg.bySelf) === true || (msg === null || msg === void 0 || (_msg$from = msg.from) === null || _msg$from === void 0 ? void 0 : _msg$from.toLowerCase()) === ((_userInfo$uid = userInfo.uid) === null || _userInfo$uid === void 0 ? void 0 : _userInfo$uid.toLowerCase());
136791
+ (msg === null || msg === void 0 ? void 0 : msg.bySelf) === true || (msg === null || msg === void 0 || (_msg$from = msg.from) === null || _msg$from === void 0 ? void 0 : _msg$from.toLowerCase()) === ((_userInfo$uid = userInfo.uid) === null || _userInfo$uid === void 0 ? void 0 : _userInfo$uid.toLowerCase());
136839
136792
  return /*#__PURE__*/React__default.createElement(qh, {
136840
136793
  bubbleType: "none",
136841
136794
  reaction: false,
136842
136795
  select: false,
136843
136796
  thread: false,
136844
- direction: isMySelf ? "rtl" : "ltr",
136797
+ direction: "ltr",
136845
136798
  renderUserProfile: function renderUserProfile() {
136846
136799
  return null;
136847
136800
  },
@@ -136852,8 +136805,8 @@ var HighlyCustomChat = function HighlyCustomChat(props) {
136852
136805
  visible: false,
136853
136806
  icon: null,
136854
136807
  actions: []
136855
- },
136856
- showAvatar: !isMySelf
136808
+ }
136809
+ // showAvatar={!isMySelf}
136857
136810
  // avatar={!isMySelf?<img src={headerInfo.headerImageURL||defaultAvatar} className="w-[48px] h-[48px] rounded-full overflow-hidden object-fit" />:undefined}
136858
136811
  ,
136859
136812
  children: renderLongTextMsg(msg, onApply)
@@ -136889,7 +136842,7 @@ var HighlyCustomChat = function HighlyCustomChat(props) {
136889
136842
  var isMySelf = (msg === null || msg === void 0 ? void 0 : msg.bySelf) === true || (msg === null || msg === void 0 || (_msg$from2 = msg.from) === null || _msg$from2 === void 0 ? void 0 : _msg$from2.toLowerCase()) === ((_userInfo$uid2 = userInfo.uid) === null || _userInfo$uid2 === void 0 ? void 0 : _userInfo$uid2.toLowerCase());
136890
136843
  // 复制代码到剪贴板
136891
136844
  return /*#__PURE__*/React__default.createElement("div", {
136892
- className: "text-[var(--im-main-fontColor)] flex flex-col gap-1 ".concat(isMySelf ? "items-end" : "items-start")
136845
+ className: "text-[var(--im-main-fontColor)] flex flex-col gap-1 ".concat("items-start")
136893
136846
  }, /*#__PURE__*/React__default.createElement("div", {
136894
136847
  style: {
136895
136848
  background: isMySelf ? "var(--im-msg-bubble-color-right)" : "var(--im-msg-bubble-color-left)",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "whyuzeim",
3
- "version": "1.1.153",
3
+ "version": "1.1.155",
4
4
  "description": "im componenets",
5
5
  "main": "cjs/index.js",
6
6
  "module": "es/index.js",