whyuzeim 1.1.18 → 1.1.20
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.
- package/cjs/HighlyCustomChat/index.d.ts +1 -0
- package/cjs/HighlyCustomChat/index.js +56 -6
- package/cjs/HighlyCustomChat/style/index.scss +16 -0
- package/cjs/IM/hooks/useGetAgoraToken.js +6 -5
- package/cjs/IM/index.js +1 -0
- package/es/HighlyCustomChat/index.d.ts +1 -0
- package/es/HighlyCustomChat/index.js +57 -7
- package/es/HighlyCustomChat/style/index.scss +16 -0
- package/es/IM/hooks/useGetAgoraToken.js +6 -5
- package/es/IM/index.js +1 -0
- package/package.json +1 -1
|
@@ -2,6 +2,7 @@ import React from "react";
|
|
|
2
2
|
import { Conversation } from "agora-chat-uikit";
|
|
3
3
|
import { ChatSDK } from "agora-chat-uikit/types/module/SDK";
|
|
4
4
|
import { ChatType } from "agora-chat-uikit/types/module/types/messageType";
|
|
5
|
+
import "./style/index.scss";
|
|
5
6
|
export interface IHighlyCustomChat {
|
|
6
7
|
conversationId: string;
|
|
7
8
|
chatType: ChatType;
|
|
@@ -18,10 +18,13 @@ 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');
|
|
27
|
+
require('./style/index.scss');
|
|
25
28
|
|
|
26
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; }
|
|
27
30
|
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; }
|
|
@@ -35,6 +38,7 @@ var HighlyCustomChat = function HighlyCustomChat(props) {
|
|
|
35
38
|
onLoginSuccess = props.onLoginSuccess;
|
|
36
39
|
var _useSDK = agoraChatUikit.useSDK(),
|
|
37
40
|
MessageSDK = _useSDK.ChatSDK;
|
|
41
|
+
var manulLoginRef = React.useRef(false);
|
|
38
42
|
var _useContext = React.useContext(context.Context),
|
|
39
43
|
http = _useContext.http,
|
|
40
44
|
userInfo = _useContext.userInfo;
|
|
@@ -60,6 +64,7 @@ var HighlyCustomChat = function HighlyCustomChat(props) {
|
|
|
60
64
|
_useState8 = _slicedToArray(_useState7, 2);
|
|
61
65
|
_useState8[0];
|
|
62
66
|
var setIsAgent = _useState8[1];
|
|
67
|
+
React.useRef(null);
|
|
63
68
|
var renderTxtMsg = function renderTxtMsg(msg) {
|
|
64
69
|
var _userInfo$uid;
|
|
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());
|
|
@@ -308,6 +313,34 @@ var HighlyCustomChat = function HighlyCustomChat(props) {
|
|
|
308
313
|
// 初始检查登录状态
|
|
309
314
|
var currentLoginState = agoraChatUikit.rootStore.loginState;
|
|
310
315
|
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: {
|
|
320
|
+
type: 2
|
|
321
|
+
}
|
|
322
|
+
}).then(function (result1) {
|
|
323
|
+
var publickey = result1.data.data.publickey;
|
|
324
|
+
// const rsaStr = encryption.rsaEncrypt(this.aesKey, publickey)
|
|
325
|
+
var publicPemKey = "-----BEGIN PUBLIC KEY-----\n" + publickey + "\n-----END PUBLIC KEY-----";
|
|
326
|
+
var pub = jsrsasign.KEYUTIL.getKey(publicPemKey);
|
|
327
|
+
var enc = jsrsasign.KJUR.crypto.Cipher.encrypt(encryption.aesKey, pub, "RSAOAEP");
|
|
328
|
+
http.get("/capi/account/imuser/getutoken", {
|
|
329
|
+
params: {
|
|
330
|
+
type: 2,
|
|
331
|
+
token: jsrsasign.hextob64(enc)
|
|
332
|
+
}
|
|
333
|
+
}).then(function (result2) {
|
|
334
|
+
var token = encryption.aesDecrypt(result2.data.data.utoken, encryption.aesKey);
|
|
335
|
+
client.open({
|
|
336
|
+
user: userInfo.uid,
|
|
337
|
+
accessToken: token
|
|
338
|
+
});
|
|
339
|
+
})["catch"](function (error) {
|
|
340
|
+
console.log(error, 'rewrew');
|
|
341
|
+
});
|
|
342
|
+
});
|
|
343
|
+
}
|
|
311
344
|
if (currentLoginState && props.conversationId) {
|
|
312
345
|
initConversation();
|
|
313
346
|
getHeaderInfo();
|
|
@@ -343,7 +376,7 @@ var HighlyCustomChat = function HighlyCustomChat(props) {
|
|
|
343
376
|
}, [getHeaderInfo, initConversation, props.conversationId]);
|
|
344
377
|
var handleSendMessage = /*#__PURE__*/function () {
|
|
345
378
|
var _ref3 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(text) {
|
|
346
|
-
var txtMessage;
|
|
379
|
+
var txtMessage, cuiScrollList, cuiScrollListWrap, htmlString, template, node;
|
|
347
380
|
return _regeneratorRuntime.wrap(function _callee$(_context2) {
|
|
348
381
|
while (1) switch (_context2.prev = _context2.next) {
|
|
349
382
|
case 0:
|
|
@@ -364,18 +397,35 @@ var HighlyCustomChat = function HighlyCustomChat(props) {
|
|
|
364
397
|
_context2.next = 6;
|
|
365
398
|
return agoraChatUikit.rootStore.messageStore.sendMessage(txtMessage);
|
|
366
399
|
case 6:
|
|
400
|
+
cuiScrollList = document.querySelector(".cui-scrollList div");
|
|
401
|
+
cuiScrollListWrap = document.querySelector(".cui-scrollList");
|
|
402
|
+
if (cuiScrollList) {
|
|
403
|
+
htmlString = "<div 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=\"https://static.moonpump.ai/avatars/1.png\" 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
|
+
template = document.createElement('template');
|
|
405
|
+
template.innerHTML = _trimInstanceProperty(htmlString).call(htmlString);
|
|
406
|
+
node = template.content.firstChild;
|
|
407
|
+
if (node) {
|
|
408
|
+
cuiScrollList.appendChild(node);
|
|
409
|
+
cuiScrollListWrap === null || cuiScrollListWrap === void 0 || cuiScrollListWrap.scrollTo({
|
|
410
|
+
top: 1000000000
|
|
411
|
+
});
|
|
412
|
+
}
|
|
413
|
+
// cuiScrollList.appendChild(`
|
|
414
|
+
// <div 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="https://static.moonpump.ai/avatars/1.png" 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 class=""><span class="cui-message-text">32132654</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>
|
|
415
|
+
// `)
|
|
416
|
+
}
|
|
367
417
|
afterSendMsg(txtMessage);
|
|
368
|
-
_context2.next =
|
|
418
|
+
_context2.next = 15;
|
|
369
419
|
break;
|
|
370
|
-
case
|
|
371
|
-
_context2.prev =
|
|
420
|
+
case 12:
|
|
421
|
+
_context2.prev = 12;
|
|
372
422
|
_context2.t0 = _context2["catch"](2);
|
|
373
423
|
console.log("send txt message failed", _context2.t0);
|
|
374
|
-
case
|
|
424
|
+
case 15:
|
|
375
425
|
case "end":
|
|
376
426
|
return _context2.stop();
|
|
377
427
|
}
|
|
378
|
-
}, _callee, null, [[2,
|
|
428
|
+
}, _callee, null, [[2, 12]]);
|
|
379
429
|
}));
|
|
380
430
|
return function handleSendMessage(_x) {
|
|
381
431
|
return _ref3.apply(this, arguments);
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
.generating-loader {
|
|
2
|
+
width: 4px;
|
|
3
|
+
aspect-ratio: 1;
|
|
4
|
+
border-radius: 50%;
|
|
5
|
+
animation: l5 1s infinite linear alternate;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
@keyframes l5 {
|
|
9
|
+
0% { box-shadow: 8px 0 #000, -8px 0 #0002; background: #000; }
|
|
10
|
+
33% { box-shadow: 8px 0 #000, -8px 0 #0002; background: #0002; }
|
|
11
|
+
88% { box-shadow: 8px 0 #0002, -8px 0 #000; background: #0002; }
|
|
12
|
+
100% { box-shadow: 8px 0 #0002, -8px 0 #000; background: #000; }
|
|
13
|
+
}
|
|
14
|
+
.generating-loader-wrap{
|
|
15
|
+
margin: 0 12px 0 8px;
|
|
16
|
+
}
|
|
@@ -23,30 +23,31 @@ var useGetAgoraToken = function useGetAgoraToken(http, uid) {
|
|
|
23
23
|
}
|
|
24
24
|
return _context.abrupt("return");
|
|
25
25
|
case 2:
|
|
26
|
-
|
|
26
|
+
window.AGAIN_ENTER_IM_INIT = true;
|
|
27
|
+
_context.next = 5;
|
|
27
28
|
return http.get("/capi/account/imuser/getkeypair", {
|
|
28
29
|
params: {
|
|
29
30
|
type: 2
|
|
30
31
|
}
|
|
31
32
|
});
|
|
32
|
-
case
|
|
33
|
+
case 5:
|
|
33
34
|
result1 = _context.sent;
|
|
34
35
|
publickey = result1.data.data.publickey; // const rsaStr = encryption.rsaEncrypt(this.aesKey, publickey)
|
|
35
36
|
publicPemKey = "-----BEGIN PUBLIC KEY-----\n" + publickey + "\n-----END PUBLIC KEY-----";
|
|
36
37
|
pub = jsrsasign.KEYUTIL.getKey(publicPemKey);
|
|
37
38
|
enc = jsrsasign.KJUR.crypto.Cipher.encrypt(encryption.aesKey, pub, "RSAOAEP");
|
|
38
|
-
_context.next =
|
|
39
|
+
_context.next = 12;
|
|
39
40
|
return http.get("/capi/account/imuser/getutoken", {
|
|
40
41
|
params: {
|
|
41
42
|
type: 2,
|
|
42
43
|
token: jsrsasign.hextob64(enc)
|
|
43
44
|
}
|
|
44
45
|
});
|
|
45
|
-
case
|
|
46
|
+
case 12:
|
|
46
47
|
result2 = _context.sent;
|
|
47
48
|
token = encryption.aesDecrypt(result2.data.data.utoken, encryption.aesKey);
|
|
48
49
|
setAgoraToken(token);
|
|
49
|
-
case
|
|
50
|
+
case 15:
|
|
50
51
|
case "end":
|
|
51
52
|
return _context.stop();
|
|
52
53
|
}
|
package/cjs/IM/index.js
CHANGED
|
@@ -32,6 +32,7 @@ var IM = function IM(props) {
|
|
|
32
32
|
onAdditionalConversationClick = props.onAdditionalConversationClick,
|
|
33
33
|
onRenderConversationItem = props.onRenderConversationItem,
|
|
34
34
|
canSidebarExpand = props.canSidebarExpand;
|
|
35
|
+
window.AGAIN_ENTER_IM_INIT = false;
|
|
35
36
|
console.log("the useinfo is", userInfo);
|
|
36
37
|
var agoraToken = useGetAgoraToken.useGetAgoraToken(http, userInfo.uid);
|
|
37
38
|
var _useState = React.useState(),
|
|
@@ -2,6 +2,7 @@ import React from "react";
|
|
|
2
2
|
import { Conversation } from "agora-chat-uikit";
|
|
3
3
|
import { ChatSDK } from "agora-chat-uikit/types/module/SDK";
|
|
4
4
|
import { ChatType } from "agora-chat-uikit/types/module/types/messageType";
|
|
5
|
+
import "./style/index.scss";
|
|
5
6
|
export interface IHighlyCustomChat {
|
|
6
7
|
conversationId: string;
|
|
7
8
|
chatType: ChatType;
|
|
@@ -14,12 +14,15 @@ import _findInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instanc
|
|
|
14
14
|
import _forEachInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/for-each';
|
|
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
|
-
import React, { useContext, useState, useCallback, useEffect } from 'react';
|
|
17
|
+
import React, { useRef, useContext, useState, useCallback, useEffect } from 'react';
|
|
18
18
|
import { useClient, useSDK, 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';
|
|
25
|
+
import './style/index.scss';
|
|
23
26
|
|
|
24
27
|
function ownKeys(e, r) { var t = _Object$keys(e); if (_Object$getOwnPropertySymbols) { var o = _Object$getOwnPropertySymbols(e); r && (o = _filterInstanceProperty(o).call(o, function (r) { return _Object$getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
25
28
|
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; }
|
|
@@ -33,6 +36,7 @@ var HighlyCustomChat = function HighlyCustomChat(props) {
|
|
|
33
36
|
onLoginSuccess = props.onLoginSuccess;
|
|
34
37
|
var _useSDK = useSDK(),
|
|
35
38
|
MessageSDK = _useSDK.ChatSDK;
|
|
39
|
+
var manulLoginRef = useRef(false);
|
|
36
40
|
var _useContext = useContext(Context),
|
|
37
41
|
http = _useContext.http,
|
|
38
42
|
userInfo = _useContext.userInfo;
|
|
@@ -58,6 +62,7 @@ var HighlyCustomChat = function HighlyCustomChat(props) {
|
|
|
58
62
|
_useState8 = _slicedToArray(_useState7, 2);
|
|
59
63
|
_useState8[0];
|
|
60
64
|
var setIsAgent = _useState8[1];
|
|
65
|
+
useRef(null);
|
|
61
66
|
var renderTxtMsg = function renderTxtMsg(msg) {
|
|
62
67
|
var _userInfo$uid;
|
|
63
68
|
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());
|
|
@@ -306,6 +311,34 @@ var HighlyCustomChat = function HighlyCustomChat(props) {
|
|
|
306
311
|
// 初始检查登录状态
|
|
307
312
|
var currentLoginState = rootStore.loginState;
|
|
308
313
|
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: {
|
|
318
|
+
type: 2
|
|
319
|
+
}
|
|
320
|
+
}).then(function (result1) {
|
|
321
|
+
var publickey = result1.data.data.publickey;
|
|
322
|
+
// const rsaStr = encryption.rsaEncrypt(this.aesKey, publickey)
|
|
323
|
+
var publicPemKey = "-----BEGIN PUBLIC KEY-----\n" + publickey + "\n-----END PUBLIC KEY-----";
|
|
324
|
+
var pub = jsrsasign.KEYUTIL.getKey(publicPemKey);
|
|
325
|
+
var enc = jsrsasign.KJUR.crypto.Cipher.encrypt(aesKey, pub, "RSAOAEP");
|
|
326
|
+
http.get("/capi/account/imuser/getutoken", {
|
|
327
|
+
params: {
|
|
328
|
+
type: 2,
|
|
329
|
+
token: jsrsasign.hextob64(enc)
|
|
330
|
+
}
|
|
331
|
+
}).then(function (result2) {
|
|
332
|
+
var token = aesDecrypt(result2.data.data.utoken, aesKey);
|
|
333
|
+
client.open({
|
|
334
|
+
user: userInfo.uid,
|
|
335
|
+
accessToken: token
|
|
336
|
+
});
|
|
337
|
+
})["catch"](function (error) {
|
|
338
|
+
console.log(error, 'rewrew');
|
|
339
|
+
});
|
|
340
|
+
});
|
|
341
|
+
}
|
|
309
342
|
if (currentLoginState && props.conversationId) {
|
|
310
343
|
initConversation();
|
|
311
344
|
getHeaderInfo();
|
|
@@ -341,7 +374,7 @@ var HighlyCustomChat = function HighlyCustomChat(props) {
|
|
|
341
374
|
}, [getHeaderInfo, initConversation, props.conversationId]);
|
|
342
375
|
var handleSendMessage = /*#__PURE__*/function () {
|
|
343
376
|
var _ref3 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(text) {
|
|
344
|
-
var txtMessage;
|
|
377
|
+
var txtMessage, cuiScrollList, cuiScrollListWrap, htmlString, template, node;
|
|
345
378
|
return _regeneratorRuntime.wrap(function _callee$(_context2) {
|
|
346
379
|
while (1) switch (_context2.prev = _context2.next) {
|
|
347
380
|
case 0:
|
|
@@ -362,18 +395,35 @@ var HighlyCustomChat = function HighlyCustomChat(props) {
|
|
|
362
395
|
_context2.next = 6;
|
|
363
396
|
return rootStore.messageStore.sendMessage(txtMessage);
|
|
364
397
|
case 6:
|
|
398
|
+
cuiScrollList = document.querySelector(".cui-scrollList div");
|
|
399
|
+
cuiScrollListWrap = document.querySelector(".cui-scrollList");
|
|
400
|
+
if (cuiScrollList) {
|
|
401
|
+
htmlString = "<div 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=\"https://static.moonpump.ai/avatars/1.png\" 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>";
|
|
402
|
+
template = document.createElement('template');
|
|
403
|
+
template.innerHTML = _trimInstanceProperty(htmlString).call(htmlString);
|
|
404
|
+
node = template.content.firstChild;
|
|
405
|
+
if (node) {
|
|
406
|
+
cuiScrollList.appendChild(node);
|
|
407
|
+
cuiScrollListWrap === null || cuiScrollListWrap === void 0 || cuiScrollListWrap.scrollTo({
|
|
408
|
+
top: 1000000000
|
|
409
|
+
});
|
|
410
|
+
}
|
|
411
|
+
// cuiScrollList.appendChild(`
|
|
412
|
+
// <div 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="https://static.moonpump.ai/avatars/1.png" 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 class=""><span class="cui-message-text">32132654</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>
|
|
413
|
+
// `)
|
|
414
|
+
}
|
|
365
415
|
afterSendMsg(txtMessage);
|
|
366
|
-
_context2.next =
|
|
416
|
+
_context2.next = 15;
|
|
367
417
|
break;
|
|
368
|
-
case
|
|
369
|
-
_context2.prev =
|
|
418
|
+
case 12:
|
|
419
|
+
_context2.prev = 12;
|
|
370
420
|
_context2.t0 = _context2["catch"](2);
|
|
371
421
|
console.log("send txt message failed", _context2.t0);
|
|
372
|
-
case
|
|
422
|
+
case 15:
|
|
373
423
|
case "end":
|
|
374
424
|
return _context2.stop();
|
|
375
425
|
}
|
|
376
|
-
}, _callee, null, [[2,
|
|
426
|
+
}, _callee, null, [[2, 12]]);
|
|
377
427
|
}));
|
|
378
428
|
return function handleSendMessage(_x) {
|
|
379
429
|
return _ref3.apply(this, arguments);
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
.generating-loader {
|
|
2
|
+
width: 4px;
|
|
3
|
+
aspect-ratio: 1;
|
|
4
|
+
border-radius: 50%;
|
|
5
|
+
animation: l5 1s infinite linear alternate;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
@keyframes l5 {
|
|
9
|
+
0% { box-shadow: 8px 0 #000, -8px 0 #0002; background: #000; }
|
|
10
|
+
33% { box-shadow: 8px 0 #000, -8px 0 #0002; background: #0002; }
|
|
11
|
+
88% { box-shadow: 8px 0 #0002, -8px 0 #000; background: #0002; }
|
|
12
|
+
100% { box-shadow: 8px 0 #0002, -8px 0 #000; background: #000; }
|
|
13
|
+
}
|
|
14
|
+
.generating-loader-wrap{
|
|
15
|
+
margin: 0 12px 0 8px;
|
|
16
|
+
}
|
|
@@ -21,30 +21,31 @@ var useGetAgoraToken = function useGetAgoraToken(http, uid) {
|
|
|
21
21
|
}
|
|
22
22
|
return _context.abrupt("return");
|
|
23
23
|
case 2:
|
|
24
|
-
|
|
24
|
+
window.AGAIN_ENTER_IM_INIT = true;
|
|
25
|
+
_context.next = 5;
|
|
25
26
|
return http.get("/capi/account/imuser/getkeypair", {
|
|
26
27
|
params: {
|
|
27
28
|
type: 2
|
|
28
29
|
}
|
|
29
30
|
});
|
|
30
|
-
case
|
|
31
|
+
case 5:
|
|
31
32
|
result1 = _context.sent;
|
|
32
33
|
publickey = result1.data.data.publickey; // const rsaStr = encryption.rsaEncrypt(this.aesKey, publickey)
|
|
33
34
|
publicPemKey = "-----BEGIN PUBLIC KEY-----\n" + publickey + "\n-----END PUBLIC KEY-----";
|
|
34
35
|
pub = jsrsasign.KEYUTIL.getKey(publicPemKey);
|
|
35
36
|
enc = jsrsasign.KJUR.crypto.Cipher.encrypt(aesKey, pub, "RSAOAEP");
|
|
36
|
-
_context.next =
|
|
37
|
+
_context.next = 12;
|
|
37
38
|
return http.get("/capi/account/imuser/getutoken", {
|
|
38
39
|
params: {
|
|
39
40
|
type: 2,
|
|
40
41
|
token: jsrsasign.hextob64(enc)
|
|
41
42
|
}
|
|
42
43
|
});
|
|
43
|
-
case
|
|
44
|
+
case 12:
|
|
44
45
|
result2 = _context.sent;
|
|
45
46
|
token = aesDecrypt(result2.data.data.utoken, aesKey);
|
|
46
47
|
setAgoraToken(token);
|
|
47
|
-
case
|
|
48
|
+
case 15:
|
|
48
49
|
case "end":
|
|
49
50
|
return _context.stop();
|
|
50
51
|
}
|
package/es/IM/index.js
CHANGED
|
@@ -30,6 +30,7 @@ var IM = function IM(props) {
|
|
|
30
30
|
onAdditionalConversationClick = props.onAdditionalConversationClick,
|
|
31
31
|
onRenderConversationItem = props.onRenderConversationItem,
|
|
32
32
|
canSidebarExpand = props.canSidebarExpand;
|
|
33
|
+
window.AGAIN_ENTER_IM_INIT = false;
|
|
33
34
|
console.log("the useinfo is", userInfo);
|
|
34
35
|
var agoraToken = useGetAgoraToken(http, userInfo.uid);
|
|
35
36
|
var _useState = useState(),
|