whyuzeim 1.1.40 → 1.1.42

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.
@@ -18,10 +18,12 @@ var _setInterval = require('@babel/runtime-corejs3/core-js-stable/set-interval')
18
18
  var _trimInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/trim');
19
19
  var React = require('react');
20
20
  var agoraChatUikit = require('agora-chat-uikit');
21
+ var jsrsasign = require('jsrsasign');
21
22
  var context = require('../IM/context.js');
22
23
  var type = require('../type.js');
23
24
  var tools = require('../tools.js');
24
25
  var avatar_default = require('../Icon/avatar_default.svg.js');
26
+ var encryption = require('../IM/encryption.js');
25
27
  require('./style/index.scss');
26
28
 
27
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; }
@@ -313,34 +315,6 @@ var HighlyCustomChat = function HighlyCustomChat(props) {
313
315
  // 初始检查登录状态
314
316
  var currentLoginState = agoraChatUikit.rootStore.loginState;
315
317
  setLoading(!currentLoginState);
316
- if (!agoraChatUikit.rootStore.loginState && !manulLoginRef.current && !window.AGAIN_ENTER_IM_INIT) {
317
- manulLoginRef.current = true;
318
- // http.get("/capi/account/imuser/getkeypair", {
319
- // params: { type: 2 },
320
- // }).then((result1)=>{
321
- // const publickey = result1.data.data.publickey;
322
- // // const rsaStr = encryption.rsaEncrypt(this.aesKey, publickey)
323
- // const publicPemKey =
324
- // "-----BEGIN PUBLIC KEY-----\n" + publickey + "\n-----END PUBLIC KEY-----";
325
- // const pub = jsrsasign.KEYUTIL.getKey(publicPemKey);
326
- // const enc = jsrsasign.KJUR.crypto.Cipher.encrypt(
327
- // aesKey,
328
- // pub as jsrsasign.RSAKey,
329
- // "RSAOAEP"
330
- // );
331
- // http.get("/capi/account/imuser/getutoken", {
332
- // params: { type: 2, token: jsrsasign.hextob64(enc) },
333
- // }).then((result2)=>{
334
- // const token = aesDecrypt(result2.data.data.utoken, aesKey);
335
- // client.open({
336
- // user: userInfo.uid,
337
- // accessToken:token,
338
- // })
339
- // }).catch(error=>{
340
- // console.log(error,'rewrew')
341
- // })
342
- // })
343
- }
344
318
  if (currentLoginState && props.conversationId) {
345
319
  initConversation();
346
320
  getHeaderInfo();
@@ -348,6 +322,34 @@ var HighlyCustomChat = function HighlyCustomChat(props) {
348
322
  var intervalId = _setInterval(function () {
349
323
  // 如果登录状态发生变化
350
324
  console.log("Agora login state:", agoraChatUikit.rootStore.loginState);
325
+ if (!agoraChatUikit.rootStore.loginState && !manulLoginRef.current && !window.AGAIN_ENTER_IM_INIT) {
326
+ manulLoginRef.current = true;
327
+ http.get("/capi/account/imuser/getkeypair", {
328
+ params: {
329
+ type: 2
330
+ }
331
+ }).then(function (result1) {
332
+ var publickey = result1.data.data.publickey;
333
+ // const rsaStr = encryption.rsaEncrypt(this.aesKey, publickey)
334
+ var publicPemKey = "-----BEGIN PUBLIC KEY-----\n" + publickey + "\n-----END PUBLIC KEY-----";
335
+ var pub = jsrsasign.KEYUTIL.getKey(publicPemKey);
336
+ var enc = jsrsasign.KJUR.crypto.Cipher.encrypt(encryption.aesKey, pub, "RSAOAEP");
337
+ http.get("/capi/account/imuser/getutoken", {
338
+ params: {
339
+ type: 2,
340
+ token: jsrsasign.hextob64(enc)
341
+ }
342
+ }).then(function (result2) {
343
+ var token = encryption.aesDecrypt(result2.data.data.utoken, encryption.aesKey);
344
+ client.open({
345
+ user: userInfo.uid,
346
+ accessToken: token
347
+ });
348
+ })["catch"](function (error) {
349
+ console.log(error, 'rewrew');
350
+ });
351
+ });
352
+ }
351
353
  if (agoraChatUikit.rootStore.loginState) {
352
354
  if (onLoginSuccess) {
353
355
  onLoginSuccess();
@@ -401,7 +403,7 @@ var HighlyCustomChat = function HighlyCustomChat(props) {
401
403
  cuiScrollList = document.querySelector(".cui-scrollList div");
402
404
  cuiScrollListWrap = document.querySelector(".cui-scrollList");
403
405
  if (cuiScrollList) {
404
- htmlString = "<div id=\"agent-generating-loader\" class=\"cui-messageList-msgItem\"><div><div class=\"thread-container\"><div id=\"1393207307050949578\" class=\"cui-message-base cui-message-base-left cui-message-base-hasAvatar cui-message-base-secondly cui-message-base-square cui-message-base-dark\"><img src=\"/icon/im/avatar_default.svg\" class=\"w-[48px] h-[48px] rounded-full overflow-hidden object-fit\"><div class=\"cui-message-base-box\"><div class=\"cui-message-base-info\"></div><div class=\"cui-message-base-body\"><div class=\"cui-message-base-content\" style=\"background: var(--im-msg-bubble-color-left); border-radius: 9px; padding: 10px 12px; color: var(--im-msg-bubble-font-color);\"><div style=\"display:flex;align-items:center\"><div class=\"generating-loader-wrap\"><div class=\"generating-loader\"></div></div><span class=\"cui-message-text\">Generating</span></div></div><div class=\"cui-message-base-time-and-status-box\"><span class=\"cui-message-status cui-message-status-icon\"></span><span class=\"cui-message-base-time\">Mar</span></div></div></div></div></div></div><div class=\"cui-modal-root\"><div tabindex=\"-1\" class=\"cui-modal-wrap modify-message-modal\" style=\"display: none;\"></div></div></div>";
406
+ htmlString = "<div id=\"agent-generating-loader\" class=\"cui-messageList-msgItem\"><div><div class=\"thread-container\"><div id=\"1393207307050949578\" class=\"cui-message-base cui-message-base-left cui-message-base-hasAvatar cui-message-base-secondly cui-message-base-square cui-message-base-dark\"><img src=\"/icon/im/avatar_default.svg\" class=\"w-[48px] h-[48px] rounded-full overflow-hidden object-fit\"><div class=\"cui-message-base-box\"><div class=\"cui-message-base-info\"></div><div class=\"cui-message-base-body\"><div class=\"cui-message-base-content\" style=\"background: var(--im-msg-bubble-color-left); border-radius: 9px; padding: 10px 12px; color: var(--im-msg-bubble-font-color);\"><div style=\"display:flex;align-items:center\"><div class=\"generating-loader-wrap\"><div class=\"generating-loader\"></div></div><span class=\"cui-message-text\">Generating</span></div></div><div class=\"cui-message-base-time-and-status-box\"><span class=\"cui-message-status cui-message-status-icon\"></span><span class=\"cui-message-base-time\"></span></div></div></div></div></div></div><div class=\"cui-modal-root\"><div tabindex=\"-1\" class=\"cui-modal-wrap modify-message-modal\" style=\"display: none;\"></div></div></div>";
405
407
  template = document.createElement('template');
406
408
  template.innerHTML = _trimInstanceProperty(htmlString).call(htmlString);
407
409
  node = template.content.firstChild;
@@ -16,10 +16,12 @@ import _setInterval from '@babel/runtime-corejs3/core-js-stable/set-interval';
16
16
  import _trimInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/trim';
17
17
  import React, { useRef, useContext, useState, useCallback, useEffect } from 'react';
18
18
  import { useClient, useSDK, useConversationContext, rootStore, MessageList, MessageInput, ImageMessage, FileMessage, VideoMessage, BaseMessage } from 'agora-chat-uikit';
19
+ import jsrsasign from 'jsrsasign';
19
20
  import { Context } from '../IM/context.js';
20
21
  import { commonMessageInputConfig, commonMessageProps } from '../type.js';
21
22
  import { reportAgentInUse } from '../tools.js';
22
23
  import img from '../Icon/avatar_default.svg.js';
24
+ import { aesKey, aesDecrypt } from '../IM/encryption.js';
23
25
  import './style/index.scss';
24
26
 
25
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; }
@@ -311,34 +313,6 @@ var HighlyCustomChat = function HighlyCustomChat(props) {
311
313
  // 初始检查登录状态
312
314
  var currentLoginState = rootStore.loginState;
313
315
  setLoading(!currentLoginState);
314
- if (!rootStore.loginState && !manulLoginRef.current && !window.AGAIN_ENTER_IM_INIT) {
315
- manulLoginRef.current = true;
316
- // http.get("/capi/account/imuser/getkeypair", {
317
- // params: { type: 2 },
318
- // }).then((result1)=>{
319
- // const publickey = result1.data.data.publickey;
320
- // // const rsaStr = encryption.rsaEncrypt(this.aesKey, publickey)
321
- // const publicPemKey =
322
- // "-----BEGIN PUBLIC KEY-----\n" + publickey + "\n-----END PUBLIC KEY-----";
323
- // const pub = jsrsasign.KEYUTIL.getKey(publicPemKey);
324
- // const enc = jsrsasign.KJUR.crypto.Cipher.encrypt(
325
- // aesKey,
326
- // pub as jsrsasign.RSAKey,
327
- // "RSAOAEP"
328
- // );
329
- // http.get("/capi/account/imuser/getutoken", {
330
- // params: { type: 2, token: jsrsasign.hextob64(enc) },
331
- // }).then((result2)=>{
332
- // const token = aesDecrypt(result2.data.data.utoken, aesKey);
333
- // client.open({
334
- // user: userInfo.uid,
335
- // accessToken:token,
336
- // })
337
- // }).catch(error=>{
338
- // console.log(error,'rewrew')
339
- // })
340
- // })
341
- }
342
316
  if (currentLoginState && props.conversationId) {
343
317
  initConversation();
344
318
  getHeaderInfo();
@@ -346,6 +320,34 @@ var HighlyCustomChat = function HighlyCustomChat(props) {
346
320
  var intervalId = _setInterval(function () {
347
321
  // 如果登录状态发生变化
348
322
  console.log("Agora login state:", rootStore.loginState);
323
+ if (!rootStore.loginState && !manulLoginRef.current && !window.AGAIN_ENTER_IM_INIT) {
324
+ manulLoginRef.current = true;
325
+ http.get("/capi/account/imuser/getkeypair", {
326
+ params: {
327
+ type: 2
328
+ }
329
+ }).then(function (result1) {
330
+ var publickey = result1.data.data.publickey;
331
+ // const rsaStr = encryption.rsaEncrypt(this.aesKey, publickey)
332
+ var publicPemKey = "-----BEGIN PUBLIC KEY-----\n" + publickey + "\n-----END PUBLIC KEY-----";
333
+ var pub = jsrsasign.KEYUTIL.getKey(publicPemKey);
334
+ var enc = jsrsasign.KJUR.crypto.Cipher.encrypt(aesKey, pub, "RSAOAEP");
335
+ http.get("/capi/account/imuser/getutoken", {
336
+ params: {
337
+ type: 2,
338
+ token: jsrsasign.hextob64(enc)
339
+ }
340
+ }).then(function (result2) {
341
+ var token = aesDecrypt(result2.data.data.utoken, aesKey);
342
+ client.open({
343
+ user: userInfo.uid,
344
+ accessToken: token
345
+ });
346
+ })["catch"](function (error) {
347
+ console.log(error, 'rewrew');
348
+ });
349
+ });
350
+ }
349
351
  if (rootStore.loginState) {
350
352
  if (onLoginSuccess) {
351
353
  onLoginSuccess();
@@ -399,7 +401,7 @@ var HighlyCustomChat = function HighlyCustomChat(props) {
399
401
  cuiScrollList = document.querySelector(".cui-scrollList div");
400
402
  cuiScrollListWrap = document.querySelector(".cui-scrollList");
401
403
  if (cuiScrollList) {
402
- htmlString = "<div id=\"agent-generating-loader\" class=\"cui-messageList-msgItem\"><div><div class=\"thread-container\"><div id=\"1393207307050949578\" class=\"cui-message-base cui-message-base-left cui-message-base-hasAvatar cui-message-base-secondly cui-message-base-square cui-message-base-dark\"><img src=\"/icon/im/avatar_default.svg\" class=\"w-[48px] h-[48px] rounded-full overflow-hidden object-fit\"><div class=\"cui-message-base-box\"><div class=\"cui-message-base-info\"></div><div class=\"cui-message-base-body\"><div class=\"cui-message-base-content\" style=\"background: var(--im-msg-bubble-color-left); border-radius: 9px; padding: 10px 12px; color: var(--im-msg-bubble-font-color);\"><div style=\"display:flex;align-items:center\"><div class=\"generating-loader-wrap\"><div class=\"generating-loader\"></div></div><span class=\"cui-message-text\">Generating</span></div></div><div class=\"cui-message-base-time-and-status-box\"><span class=\"cui-message-status cui-message-status-icon\"></span><span class=\"cui-message-base-time\">Mar</span></div></div></div></div></div></div><div class=\"cui-modal-root\"><div tabindex=\"-1\" class=\"cui-modal-wrap modify-message-modal\" style=\"display: none;\"></div></div></div>";
404
+ htmlString = "<div id=\"agent-generating-loader\" class=\"cui-messageList-msgItem\"><div><div class=\"thread-container\"><div id=\"1393207307050949578\" class=\"cui-message-base cui-message-base-left cui-message-base-hasAvatar cui-message-base-secondly cui-message-base-square cui-message-base-dark\"><img src=\"/icon/im/avatar_default.svg\" class=\"w-[48px] h-[48px] rounded-full overflow-hidden object-fit\"><div class=\"cui-message-base-box\"><div class=\"cui-message-base-info\"></div><div class=\"cui-message-base-body\"><div class=\"cui-message-base-content\" style=\"background: var(--im-msg-bubble-color-left); border-radius: 9px; padding: 10px 12px; color: var(--im-msg-bubble-font-color);\"><div style=\"display:flex;align-items:center\"><div class=\"generating-loader-wrap\"><div class=\"generating-loader\"></div></div><span class=\"cui-message-text\">Generating</span></div></div><div class=\"cui-message-base-time-and-status-box\"><span class=\"cui-message-status cui-message-status-icon\"></span><span class=\"cui-message-base-time\"></span></div></div></div></div></div></div><div class=\"cui-modal-root\"><div tabindex=\"-1\" class=\"cui-modal-wrap modify-message-modal\" style=\"display: none;\"></div></div></div>";
403
405
  template = document.createElement('template');
404
406
  template.innerHTML = _trimInstanceProperty(htmlString).call(htmlString);
405
407
  node = template.content.firstChild;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "whyuzeim",
3
- "version": "1.1.40",
3
+ "version": "1.1.42",
4
4
  "description": "im componenets",
5
5
  "main": "cjs/index.js",
6
6
  "module": "es/index.js",