whyuzeim 1.1.145 → 1.1.147

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (163) hide show
  1. package/cjs/ChatBox/BuyIM/index.d.ts +16 -0
  2. package/cjs/index.js +92 -82
  3. package/es/ChatBox/BuyIM/index.d.ts +16 -0
  4. package/es/index.js +92 -82
  5. package/package.json +1 -1
  6. package/cjs/AddMember/image/ic_close.svg.js +0 -5
  7. package/cjs/AddMember/index.js +0 -171
  8. package/cjs/ChatBox/JoinGroupDialog/index.js +0 -102
  9. package/cjs/ChatBox/image/ic_chat_back.svg.js +0 -5
  10. package/cjs/ChatBox/image/ic_chat_back_light.svg.js +0 -5
  11. package/cjs/ChatBox/image/ic_more.svg.js +0 -5
  12. package/cjs/ChatBox/index.js +0 -589
  13. package/cjs/ContactList/index.js +0 -106
  14. package/cjs/CustomChatView/image/set.svg.js +0 -5
  15. package/cjs/CustomChatView/index.js +0 -397
  16. package/cjs/Exit/index.js +0 -17
  17. package/cjs/GroupDetail/GroupDetailEditView/index.js +0 -268
  18. package/cjs/GroupDetail/GroupShareView/index.js +0 -156
  19. package/cjs/GroupDetail/image/ic_close.svg.js +0 -5
  20. package/cjs/GroupDetail/image/ic_group_edit.svg.js +0 -5
  21. package/cjs/GroupDetail/image/ic_messages.svg.js +0 -5
  22. package/cjs/GroupDetail/image/ic_share.svg.js +0 -5
  23. package/cjs/GroupDetail/index.js +0 -264
  24. package/cjs/HighlyCustomChat/ ShareMsg/index.js +0 -191
  25. package/cjs/HighlyCustomChat/AIReportMsg/index.js +0 -102
  26. package/cjs/HighlyCustomChat/CodeMsg/index.js +0 -136
  27. package/cjs/HighlyCustomChat/QuestionButton/index.js +0 -63
  28. package/cjs/HighlyCustomChat/TokenMsg/image/copy_link.svg.js +0 -5
  29. package/cjs/HighlyCustomChat/TokenMsg/image/token_chart.svg.js +0 -5
  30. package/cjs/HighlyCustomChat/TokenMsg/index.js +0 -276
  31. package/cjs/HighlyCustomChat/index.js +0 -741
  32. package/cjs/IM/DefaultIMLayout/index.js +0 -29
  33. package/cjs/IM/MainContent/index.js +0 -89
  34. package/cjs/IM/context.js +0 -14
  35. package/cjs/IM/encryption.js +0 -38
  36. package/cjs/IM/hooks/useGetAgoraToken.js +0 -73
  37. package/cjs/IM/index.js +0 -243
  38. package/cjs/Icon/avatar_default.svg.js +0 -5
  39. package/cjs/Icon/im_notlogin_dark.svg.js +0 -5
  40. package/cjs/Icon/im_notlogin_light.svg.js +0 -5
  41. package/cjs/NoData/image/no-data.svg.js +0 -5
  42. package/cjs/NoData/index.js +0 -27
  43. package/cjs/Sharebox/index.js +0 -14
  44. package/cjs/Sidebar/CreateGroup/index.js +0 -259
  45. package/cjs/Sidebar/CustomConversationItem/OperateBtn/image/delete.svg.js +0 -5
  46. package/cjs/Sidebar/CustomConversationItem/OperateBtn/image/logout.svg.js +0 -5
  47. package/cjs/Sidebar/CustomConversationItem/OperateBtn/image/more.svg.js +0 -5
  48. package/cjs/Sidebar/CustomConversationItem/OperateBtn/image/muted.svg.js +0 -5
  49. package/cjs/Sidebar/CustomConversationItem/OperateBtn/index.js +0 -238
  50. package/cjs/Sidebar/CustomConversationItem/index.js +0 -215
  51. package/cjs/Sidebar/GroupList/OperateBtn/image/delete.svg.js +0 -5
  52. package/cjs/Sidebar/GroupList/OperateBtn/image/logout.svg.js +0 -5
  53. package/cjs/Sidebar/GroupList/OperateBtn/image/more.svg.js +0 -5
  54. package/cjs/Sidebar/GroupList/OperateBtn/image/muted.svg.js +0 -5
  55. package/cjs/Sidebar/GroupList/OperateBtn/index.js +0 -246
  56. package/cjs/Sidebar/GroupList/index.js +0 -148
  57. package/cjs/Sidebar/MobileCreateGroup/index.js +0 -225
  58. package/cjs/Sidebar/Searchbox/image/ic_messages.svg.js +0 -5
  59. package/cjs/Sidebar/Searchbox/index.js +0 -199
  60. package/cjs/Sidebar/image/ic_close.svg.js +0 -5
  61. package/cjs/Sidebar/image/ic_close_light.svg.js +0 -5
  62. package/cjs/Sidebar/image/ic_search.svg.js +0 -5
  63. package/cjs/Sidebar/image/ic_search_light.svg.js +0 -5
  64. package/cjs/Sidebar/image/message.svg.js +0 -5
  65. package/cjs/Sidebar/index.js +0 -231
  66. package/cjs/TypeItem/OperateBtn/image/ban.svg.js +0 -5
  67. package/cjs/TypeItem/OperateBtn/image/block.svg.js +0 -5
  68. package/cjs/TypeItem/OperateBtn/image/logout.svg.js +0 -5
  69. package/cjs/TypeItem/OperateBtn/image/more.svg.js +0 -5
  70. package/cjs/TypeItem/OperateBtn/index.js +0 -169
  71. package/cjs/TypeItem/index.js +0 -86
  72. package/cjs/UserProfile/image/ic_close.svg.js +0 -5
  73. package/cjs/UserProfile/image/ic_share.svg.js +0 -5
  74. package/cjs/UserProfile/image/icon_translation.svg.js +0 -5
  75. package/cjs/UserProfile/index.js +0 -182
  76. package/cjs/contexts/LocaleContext.js +0 -163
  77. package/cjs/locales/en.js +0 -160
  78. package/cjs/locales/ja.js +0 -160
  79. package/cjs/locales/ko.js +0 -160
  80. package/cjs/locales/ru.js +0 -160
  81. package/cjs/locales/vi.js +0 -160
  82. package/cjs/locales/zh-TW.js +0 -160
  83. package/cjs/tools.js +0 -81
  84. package/cjs/type.js +0 -86
  85. package/es/AddMember/image/ic_close.svg.js +0 -3
  86. package/es/AddMember/index.js +0 -169
  87. package/es/ChatBox/JoinGroupDialog/index.js +0 -100
  88. package/es/ChatBox/image/ic_chat_back.svg.js +0 -3
  89. package/es/ChatBox/image/ic_chat_back_light.svg.js +0 -3
  90. package/es/ChatBox/image/ic_more.svg.js +0 -3
  91. package/es/ChatBox/index.js +0 -587
  92. package/es/ContactList/index.js +0 -104
  93. package/es/CustomChatView/image/set.svg.js +0 -3
  94. package/es/CustomChatView/index.js +0 -395
  95. package/es/Exit/index.js +0 -15
  96. package/es/GroupDetail/GroupDetailEditView/index.js +0 -266
  97. package/es/GroupDetail/GroupShareView/index.js +0 -154
  98. package/es/GroupDetail/image/ic_close.svg.js +0 -3
  99. package/es/GroupDetail/image/ic_group_edit.svg.js +0 -3
  100. package/es/GroupDetail/image/ic_messages.svg.js +0 -3
  101. package/es/GroupDetail/image/ic_share.svg.js +0 -3
  102. package/es/GroupDetail/index.js +0 -262
  103. package/es/HighlyCustomChat/ ShareMsg/index.js +0 -189
  104. package/es/HighlyCustomChat/AIReportMsg/index.js +0 -100
  105. package/es/HighlyCustomChat/CodeMsg/index.js +0 -134
  106. package/es/HighlyCustomChat/QuestionButton/index.js +0 -61
  107. package/es/HighlyCustomChat/TokenMsg/image/copy_link.svg.js +0 -3
  108. package/es/HighlyCustomChat/TokenMsg/image/token_chart.svg.js +0 -3
  109. package/es/HighlyCustomChat/TokenMsg/index.js +0 -274
  110. package/es/HighlyCustomChat/index.js +0 -739
  111. package/es/IM/DefaultIMLayout/index.js +0 -27
  112. package/es/IM/MainContent/index.js +0 -87
  113. package/es/IM/context.js +0 -12
  114. package/es/IM/encryption.js +0 -34
  115. package/es/IM/hooks/useGetAgoraToken.js +0 -71
  116. package/es/IM/index.js +0 -241
  117. package/es/Icon/avatar_default.svg.js +0 -3
  118. package/es/Icon/im_notlogin_dark.svg.js +0 -3
  119. package/es/Icon/im_notlogin_light.svg.js +0 -3
  120. package/es/NoData/image/no-data.svg.js +0 -3
  121. package/es/NoData/index.js +0 -25
  122. package/es/Sharebox/index.js +0 -12
  123. package/es/Sidebar/CreateGroup/index.js +0 -257
  124. package/es/Sidebar/CustomConversationItem/OperateBtn/image/delete.svg.js +0 -3
  125. package/es/Sidebar/CustomConversationItem/OperateBtn/image/logout.svg.js +0 -3
  126. package/es/Sidebar/CustomConversationItem/OperateBtn/image/more.svg.js +0 -3
  127. package/es/Sidebar/CustomConversationItem/OperateBtn/image/muted.svg.js +0 -3
  128. package/es/Sidebar/CustomConversationItem/OperateBtn/index.js +0 -236
  129. package/es/Sidebar/CustomConversationItem/index.js +0 -213
  130. package/es/Sidebar/GroupList/OperateBtn/image/delete.svg.js +0 -3
  131. package/es/Sidebar/GroupList/OperateBtn/image/logout.svg.js +0 -3
  132. package/es/Sidebar/GroupList/OperateBtn/image/more.svg.js +0 -3
  133. package/es/Sidebar/GroupList/OperateBtn/image/muted.svg.js +0 -3
  134. package/es/Sidebar/GroupList/OperateBtn/index.js +0 -244
  135. package/es/Sidebar/GroupList/index.js +0 -146
  136. package/es/Sidebar/MobileCreateGroup/index.js +0 -223
  137. package/es/Sidebar/Searchbox/image/ic_messages.svg.js +0 -3
  138. package/es/Sidebar/Searchbox/index.js +0 -197
  139. package/es/Sidebar/image/ic_close.svg.js +0 -3
  140. package/es/Sidebar/image/ic_close_light.svg.js +0 -3
  141. package/es/Sidebar/image/ic_search.svg.js +0 -3
  142. package/es/Sidebar/image/ic_search_light.svg.js +0 -3
  143. package/es/Sidebar/image/message.svg.js +0 -3
  144. package/es/Sidebar/index.js +0 -229
  145. package/es/TypeItem/OperateBtn/image/ban.svg.js +0 -3
  146. package/es/TypeItem/OperateBtn/image/block.svg.js +0 -3
  147. package/es/TypeItem/OperateBtn/image/logout.svg.js +0 -3
  148. package/es/TypeItem/OperateBtn/image/more.svg.js +0 -3
  149. package/es/TypeItem/OperateBtn/index.js +0 -167
  150. package/es/TypeItem/index.js +0 -84
  151. package/es/UserProfile/image/ic_close.svg.js +0 -3
  152. package/es/UserProfile/image/ic_share.svg.js +0 -3
  153. package/es/UserProfile/image/icon_translation.svg.js +0 -3
  154. package/es/UserProfile/index.js +0 -180
  155. package/es/contexts/LocaleContext.js +0 -157
  156. package/es/locales/en.js +0 -158
  157. package/es/locales/ja.js +0 -158
  158. package/es/locales/ko.js +0 -158
  159. package/es/locales/ru.js +0 -158
  160. package/es/locales/vi.js +0 -158
  161. package/es/locales/zh-TW.js +0 -158
  162. package/es/tools.js +0 -78
  163. package/es/type.js +0 -80
@@ -0,0 +1,16 @@
1
+ import React from "react";
2
+ interface IBuyIM {
3
+ headerInfo: {
4
+ headerImageURL: string;
5
+ conversationName: string;
6
+ memberCount: number;
7
+ chatType: string;
8
+ };
9
+ tokenInfo: {
10
+ tokenSymbol: string;
11
+ tokenAddress: string;
12
+ requiredAmount: number;
13
+ };
14
+ }
15
+ declare const BuyIM: React.FC<IBuyIM>;
16
+ export default BuyIM;
package/cjs/index.js CHANGED
@@ -10,7 +10,7 @@ var _asyncToGenerator = require('@babel/runtime-corejs3/helpers/esm/asyncToGener
10
10
  var _regeneratorRuntime = require('@babel/runtime-corejs3/regenerator');
11
11
  var jsrsasign = require('jsrsasign');
12
12
  var _typeof = require('@babel/runtime-corejs3/helpers/esm/typeof');
13
- var _JSON$stringify = require('@babel/runtime-corejs3/core-js-stable/json/stringify');
13
+ require('@babel/runtime-corejs3/core-js-stable/json/stringify');
14
14
  var CryptoJS = require('crypto-js');
15
15
  var JSEncrypt = require('jsencrypt');
16
16
  var _sliceInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/slice');
@@ -137318,7 +137318,7 @@ var HighlyCustomChat = function HighlyCustomChat(props) {
137318
137318
  }, [getHeaderInfo, initConversation, props.conversationId]);
137319
137319
  var handleSendMessage = /*#__PURE__*/function () {
137320
137320
  var _ref9 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee3(text, extInfo) {
137321
- var systemOption, systemMessage, badgeOption, badgeMessage, txtMessage, cuiScrollList, cuiScrollListWrap, htmlString, template, node;
137321
+ var txtMessage, cuiScrollList, cuiScrollListWrap, htmlString, template, node;
137322
137322
  return _regeneratorRuntime.wrap(function _callee3$(_context4) {
137323
137323
  while (1) switch (_context4.prev = _context4.next) {
137324
137324
  case 0:
@@ -137328,67 +137328,7 @@ var HighlyCustomChat = function HighlyCustomChat(props) {
137328
137328
  }
137329
137329
  return _context4.abrupt("return");
137330
137330
  case 2:
137331
- if (!(text === '/test-system')) {
137332
- _context4.next = 9;
137333
- break;
137334
- }
137335
- // 发送一个系统消息用于测试SystemNotificationMsg组件
137336
- systemOption = {
137337
- chatType: headerInfo.chatType,
137338
- type: 'custom',
137339
- to: props.conversationId,
137340
- customEvent: 'custom_system_notice',
137341
- msg: '[system notice]',
137342
- customExts: {
137343
- type: 0,
137344
- // NFT_ACTIVATION
137345
- obj: _JSON$stringify({
137346
- title: "NFT Activation Available",
137347
- content: "You have a new NFT ready for activation.\nClick the button below to activate your NFT and unlock exclusive features.",
137348
- operation: 0,
137349
- // 显示激活按钮
137350
- objectId: "nft_12345"
137351
- })
137352
- }
137353
- };
137354
- systemMessage = MessageSDK.message.create(systemOption);
137355
- _context4.next = 7;
137356
- return Ut.messageStore.sendMessage(systemMessage);
137357
- case 7:
137358
- afterSendMsg(systemMessage, extInfo);
137359
- return _context4.abrupt("return");
137360
- case 9:
137361
- if (!(text === '/test-system-badge')) {
137362
- _context4.next = 16;
137363
- break;
137364
- }
137365
- // 发送一个徽章激活系统消息
137366
- badgeOption = {
137367
- chatType: headerInfo.chatType,
137368
- type: 'custom',
137369
- to: props.conversationId,
137370
- customEvent: 'custom_system_notice',
137371
- msg: '[badge notice]',
137372
- customExts: {
137373
- type: 1,
137374
- // BADGE_ACTIVATION
137375
- obj: _JSON$stringify({
137376
- title: "Achievement Unlocked",
137377
- content: "Congratulations! You've earned a new badge.\nThis badge represents your contribution to the community.",
137378
- operation: 1,
137379
- // 不显示按钮
137380
- objectId: "badge_67890"
137381
- })
137382
- }
137383
- };
137384
- badgeMessage = MessageSDK.message.create(badgeOption);
137385
- _context4.next = 14;
137386
- return Ut.messageStore.sendMessage(badgeMessage);
137387
- case 14:
137388
- afterSendMsg(badgeMessage, extInfo);
137389
- return _context4.abrupt("return");
137390
- case 16:
137391
- _context4.prev = 16;
137331
+ _context4.prev = 2;
137392
137332
  // 普通文本消息
137393
137333
  txtMessage = MessageSDK.message.create({
137394
137334
  type: "txt",
@@ -137396,9 +137336,9 @@ var HighlyCustomChat = function HighlyCustomChat(props) {
137396
137336
  to: props.conversationId,
137397
137337
  chatType: headerInfo.chatType
137398
137338
  });
137399
- _context4.next = 20;
137339
+ _context4.next = 6;
137400
137340
  return Ut.messageStore.sendMessage(txtMessage);
137401
- case 20:
137341
+ case 6:
137402
137342
  afterSendMsg(txtMessage, extInfo);
137403
137343
  if (isAgent) {
137404
137344
  cuiScrollList = document.querySelector(".cui-messageList .cui-scrollList div");
@@ -137416,17 +137356,17 @@ var HighlyCustomChat = function HighlyCustomChat(props) {
137416
137356
  }
137417
137357
  }
137418
137358
  }
137419
- _context4.next = 27;
137359
+ _context4.next = 13;
137420
137360
  break;
137421
- case 24:
137422
- _context4.prev = 24;
137423
- _context4.t0 = _context4["catch"](16);
137361
+ case 10:
137362
+ _context4.prev = 10;
137363
+ _context4.t0 = _context4["catch"](2);
137424
137364
  console.log("send txt message failed", _context4.t0);
137425
- case 27:
137365
+ case 13:
137426
137366
  case "end":
137427
137367
  return _context4.stop();
137428
137368
  }
137429
- }, _callee3, null, [[16, 24]]);
137369
+ }, _callee3, null, [[2, 10]]);
137430
137370
  }));
137431
137371
  return function handleSendMessage(_x2, _x3) {
137432
137372
  return _ref9.apply(this, arguments);
@@ -137527,6 +137467,55 @@ var HighlyCustomChat = function HighlyCustomChat(props) {
137527
137467
  }()));
137528
137468
  };
137529
137469
 
137470
+ var BuyIM = function BuyIM(props) {
137471
+ var headerInfo = props.headerInfo,
137472
+ tokenInfo = props.tokenInfo;
137473
+ return /*#__PURE__*/React.createElement("div", {
137474
+ className: "flex-1 default_chat_box flex flex-col justify-center items-center gap-3 !bg-[#f5f5f5]"
137475
+ }, /*#__PURE__*/React.createElement("svg", {
137476
+ width: "48",
137477
+ height: "48",
137478
+ viewBox: "0 0 48 48",
137479
+ fill: "none",
137480
+ xmlns: "http://www.w3.org/2000/svg"
137481
+ }, /*#__PURE__*/React.createElement("path", {
137482
+ d: "M40 22H8C6.89543 22 6 22.8954 6 24V42C6 43.1046 6.89543 44 8 44H40C41.1046 44 42 43.1046 42 42V24C42 22.8954 41.1046 22 40 22Z",
137483
+ fill: "black",
137484
+ "fill-opacity": "0.9",
137485
+ stroke: "black",
137486
+ "stroke-opacity": "0.9",
137487
+ "stroke-width": "4",
137488
+ "stroke-linejoin": "round"
137489
+ }), /*#__PURE__*/React.createElement("path", {
137490
+ d: "M14 22V14C14 8.47715 18.4772 4 24 4C29.5228 4 34 8.47715 34 14V22",
137491
+ stroke: "black",
137492
+ "stroke-opacity": "0.9",
137493
+ "stroke-width": "4",
137494
+ "stroke-linecap": "round",
137495
+ "stroke-linejoin": "round"
137496
+ }), /*#__PURE__*/React.createElement("path", {
137497
+ d: "M24 30V36",
137498
+ stroke: "white",
137499
+ "stroke-width": "4",
137500
+ "stroke-linecap": "round",
137501
+ "stroke-linejoin": "round"
137502
+ })), /*#__PURE__*/React.createElement("div", {
137503
+ className: "flex flex-row items-center gap-1"
137504
+ }, /*#__PURE__*/React.createElement("img", {
137505
+ src: headerInfo.headerImageURL,
137506
+ alt: "headerImageURL",
137507
+ className: "w-[24px] h-[24px] rounded-full"
137508
+ }), /*#__PURE__*/React.createElement("span", {
137509
+ className: "text-black text-[16px] font-medium"
137510
+ }, headerInfo.conversationName)), /*#__PURE__*/React.createElement("span", {
137511
+ className: "text-black text-[24px] font-semibold"
137512
+ }, "Private Chat Locked"), /*#__PURE__*/React.createElement("span", {
137513
+ className: "text-[#2C7CF5] text-[14px]"
137514
+ }, "Private chat with username requires holding at least ", tokenInfo === null || tokenInfo === void 0 ? void 0 : tokenInfo.requiredAmount, " ", tokenInfo === null || tokenInfo === void 0 ? void 0 : tokenInfo.tokenSymbol), /*#__PURE__*/React.createElement(antd.Button, {
137515
+ className: "!bg-[#2C7CF5] !text-white !w-[320px] !h-[48px] mt-3"
137516
+ }, "Buy ", tokenInfo === null || tokenInfo === void 0 ? void 0 : tokenInfo.requiredAmount, " ", tokenInfo === null || tokenInfo === void 0 ? void 0 : tokenInfo.tokenSymbol, " to unlock"));
137517
+ };
137518
+
137530
137519
  function ownKeys$3(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; }
137531
137520
  function _objectSpread$3(e) { for (var r = 1; r < arguments.length; r++) { var _context7, _context8; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty(_context7 = ownKeys$3(Object(t), true)).call(_context7, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(e, _Object$getOwnPropertyDescriptors(t)) : _forEachInstanceProperty(_context8 = ownKeys$3(Object(t))).call(_context8, function (r) { _Object$defineProperty(e, r, _Object$getOwnPropertyDescriptor(t, r)); }); } return e; }
137532
137521
  var Chatbox = function Chatbox(props) {
@@ -137553,23 +137542,27 @@ var Chatbox = function Chatbox(props) {
137553
137542
  _Modal$useModal2 = _slicedToArray(_Modal$useModal, 2),
137554
137543
  modal = _Modal$useModal2[0],
137555
137544
  contextHolder = _Modal$useModal2[1];
137556
- var _useState3 = React.useState({
137545
+ var _useState3 = React.useState(undefined),
137546
+ _useState4 = _slicedToArray(_useState3, 2),
137547
+ tokenInfo = _useState4[0],
137548
+ setTokenInfo = _useState4[1];
137549
+ var _useState5 = React.useState({
137557
137550
  headerImageURL: "",
137558
137551
  conversationName: "",
137559
137552
  memberCount: 0,
137560
137553
  chatType: "singleChat"
137561
137554
  }),
137562
- _useState4 = _slicedToArray(_useState3, 2),
137563
- headerInfo = _useState4[0],
137564
- setHeaderInfo = _useState4[1];
137565
- var _useState5 = React.useState(true),
137566
137555
  _useState6 = _slicedToArray(_useState5, 2),
137567
- isAgent = _useState6[0],
137568
- setIsAgent = _useState6[1];
137569
- var _useState7 = React.useState(undefined),
137556
+ headerInfo = _useState6[0],
137557
+ setHeaderInfo = _useState6[1];
137558
+ var _useState7 = React.useState(true),
137570
137559
  _useState8 = _slicedToArray(_useState7, 2),
137571
- specialConversation = _useState8[0],
137572
- setSpecialConversation = _useState8[1];
137560
+ isAgent = _useState8[0],
137561
+ setIsAgent = _useState8[1];
137562
+ var _useState9 = React.useState(undefined),
137563
+ _useState10 = _slicedToArray(_useState9, 2),
137564
+ specialConversation = _useState10[0],
137565
+ setSpecialConversation = _useState10[1];
137573
137566
  var handleConfirmRemove = /*#__PURE__*/function () {
137574
137567
  var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
137575
137568
  return _regeneratorRuntime.wrap(function _callee$(_context) {
@@ -138052,6 +138045,20 @@ var Chatbox = function Chatbox(props) {
138052
138045
  setRightComponent && setRightComponent(undefined);
138053
138046
  }
138054
138047
  }, [currentConversation]);
138048
+ var _useState11 = React.useState(false),
138049
+ _useState12 = _slicedToArray(_useState11, 2),
138050
+ isFree = _useState12[0],
138051
+ setIsFree = _useState12[1];
138052
+ React.useEffect(function () {
138053
+ http.post('/api/agora/validatePrivateChatToken', {
138054
+ targetWalletAddress: currentConversation.conversationId
138055
+ }).then(function (res) {
138056
+ if (res.data.code === 200) {
138057
+ setTokenInfo(res.data.data.tokenInfo);
138058
+ setIsFree(res.data.data.canChat);
138059
+ }
138060
+ });
138061
+ }, [currentConversation.conversationId]);
138055
138062
  // useEffect(()=>{
138056
138063
  // const cuiScrollList = document.querySelector(".cui-messageList .cui-scrollList div");
138057
138064
  // const generatingLoader = document.querySelector("#agent-generating-loader");
@@ -138061,7 +138068,10 @@ var Chatbox = function Chatbox(props) {
138061
138068
  // },[conversationList])
138062
138069
  return /*#__PURE__*/React.createElement("div", {
138063
138070
  className: "yuze_chat_container w-full h-full overflow-hidden flex flex-col"
138064
- }, currentConversation.conversationId && customHeader(), /*#__PURE__*/React.createElement(HighlyCustomChat, _extends({
138071
+ }, currentConversation.conversationId && customHeader(), !isFree ? /*#__PURE__*/React.createElement(BuyIM, {
138072
+ headerInfo: headerInfo,
138073
+ tokenInfo: tokenInfo
138074
+ }) : /*#__PURE__*/React.createElement(HighlyCustomChat, _extends({
138065
138075
  conversationId: currentConversation.conversationId,
138066
138076
  chatType: currentConversation.chatType
138067
138077
  }, props, {
@@ -0,0 +1,16 @@
1
+ import React from "react";
2
+ interface IBuyIM {
3
+ headerInfo: {
4
+ headerImageURL: string;
5
+ conversationName: string;
6
+ memberCount: number;
7
+ chatType: string;
8
+ };
9
+ tokenInfo: {
10
+ tokenSymbol: string;
11
+ tokenAddress: string;
12
+ requiredAmount: number;
13
+ };
14
+ }
15
+ declare const BuyIM: React.FC<IBuyIM>;
16
+ export default BuyIM;
package/es/index.js CHANGED
@@ -9,7 +9,7 @@ import _asyncToGenerator from '@babel/runtime-corejs3/helpers/esm/asyncToGenerat
9
9
  import _regeneratorRuntime from '@babel/runtime-corejs3/regenerator';
10
10
  import jsrsasign from 'jsrsasign';
11
11
  import _typeof from '@babel/runtime-corejs3/helpers/esm/typeof';
12
- import _JSON$stringify from '@babel/runtime-corejs3/core-js-stable/json/stringify';
12
+ import '@babel/runtime-corejs3/core-js-stable/json/stringify';
13
13
  import CryptoJS from 'crypto-js';
14
14
  import JSEncrypt from 'jsencrypt';
15
15
  import _sliceInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/slice';
@@ -137297,7 +137297,7 @@ var HighlyCustomChat = function HighlyCustomChat(props) {
137297
137297
  }, [getHeaderInfo, initConversation, props.conversationId]);
137298
137298
  var handleSendMessage = /*#__PURE__*/function () {
137299
137299
  var _ref9 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee3(text, extInfo) {
137300
- var systemOption, systemMessage, badgeOption, badgeMessage, txtMessage, cuiScrollList, cuiScrollListWrap, htmlString, template, node;
137300
+ var txtMessage, cuiScrollList, cuiScrollListWrap, htmlString, template, node;
137301
137301
  return _regeneratorRuntime.wrap(function _callee3$(_context4) {
137302
137302
  while (1) switch (_context4.prev = _context4.next) {
137303
137303
  case 0:
@@ -137307,67 +137307,7 @@ var HighlyCustomChat = function HighlyCustomChat(props) {
137307
137307
  }
137308
137308
  return _context4.abrupt("return");
137309
137309
  case 2:
137310
- if (!(text === '/test-system')) {
137311
- _context4.next = 9;
137312
- break;
137313
- }
137314
- // 发送一个系统消息用于测试SystemNotificationMsg组件
137315
- systemOption = {
137316
- chatType: headerInfo.chatType,
137317
- type: 'custom',
137318
- to: props.conversationId,
137319
- customEvent: 'custom_system_notice',
137320
- msg: '[system notice]',
137321
- customExts: {
137322
- type: 0,
137323
- // NFT_ACTIVATION
137324
- obj: _JSON$stringify({
137325
- title: "NFT Activation Available",
137326
- content: "You have a new NFT ready for activation.\nClick the button below to activate your NFT and unlock exclusive features.",
137327
- operation: 0,
137328
- // 显示激活按钮
137329
- objectId: "nft_12345"
137330
- })
137331
- }
137332
- };
137333
- systemMessage = MessageSDK.message.create(systemOption);
137334
- _context4.next = 7;
137335
- return Ut.messageStore.sendMessage(systemMessage);
137336
- case 7:
137337
- afterSendMsg(systemMessage, extInfo);
137338
- return _context4.abrupt("return");
137339
- case 9:
137340
- if (!(text === '/test-system-badge')) {
137341
- _context4.next = 16;
137342
- break;
137343
- }
137344
- // 发送一个徽章激活系统消息
137345
- badgeOption = {
137346
- chatType: headerInfo.chatType,
137347
- type: 'custom',
137348
- to: props.conversationId,
137349
- customEvent: 'custom_system_notice',
137350
- msg: '[badge notice]',
137351
- customExts: {
137352
- type: 1,
137353
- // BADGE_ACTIVATION
137354
- obj: _JSON$stringify({
137355
- title: "Achievement Unlocked",
137356
- content: "Congratulations! You've earned a new badge.\nThis badge represents your contribution to the community.",
137357
- operation: 1,
137358
- // 不显示按钮
137359
- objectId: "badge_67890"
137360
- })
137361
- }
137362
- };
137363
- badgeMessage = MessageSDK.message.create(badgeOption);
137364
- _context4.next = 14;
137365
- return Ut.messageStore.sendMessage(badgeMessage);
137366
- case 14:
137367
- afterSendMsg(badgeMessage, extInfo);
137368
- return _context4.abrupt("return");
137369
- case 16:
137370
- _context4.prev = 16;
137310
+ _context4.prev = 2;
137371
137311
  // 普通文本消息
137372
137312
  txtMessage = MessageSDK.message.create({
137373
137313
  type: "txt",
@@ -137375,9 +137315,9 @@ var HighlyCustomChat = function HighlyCustomChat(props) {
137375
137315
  to: props.conversationId,
137376
137316
  chatType: headerInfo.chatType
137377
137317
  });
137378
- _context4.next = 20;
137318
+ _context4.next = 6;
137379
137319
  return Ut.messageStore.sendMessage(txtMessage);
137380
- case 20:
137320
+ case 6:
137381
137321
  afterSendMsg(txtMessage, extInfo);
137382
137322
  if (isAgent) {
137383
137323
  cuiScrollList = document.querySelector(".cui-messageList .cui-scrollList div");
@@ -137395,17 +137335,17 @@ var HighlyCustomChat = function HighlyCustomChat(props) {
137395
137335
  }
137396
137336
  }
137397
137337
  }
137398
- _context4.next = 27;
137338
+ _context4.next = 13;
137399
137339
  break;
137400
- case 24:
137401
- _context4.prev = 24;
137402
- _context4.t0 = _context4["catch"](16);
137340
+ case 10:
137341
+ _context4.prev = 10;
137342
+ _context4.t0 = _context4["catch"](2);
137403
137343
  console.log("send txt message failed", _context4.t0);
137404
- case 27:
137344
+ case 13:
137405
137345
  case "end":
137406
137346
  return _context4.stop();
137407
137347
  }
137408
- }, _callee3, null, [[16, 24]]);
137348
+ }, _callee3, null, [[2, 10]]);
137409
137349
  }));
137410
137350
  return function handleSendMessage(_x2, _x3) {
137411
137351
  return _ref9.apply(this, arguments);
@@ -137506,6 +137446,55 @@ var HighlyCustomChat = function HighlyCustomChat(props) {
137506
137446
  }()));
137507
137447
  };
137508
137448
 
137449
+ var BuyIM = function BuyIM(props) {
137450
+ var headerInfo = props.headerInfo,
137451
+ tokenInfo = props.tokenInfo;
137452
+ return /*#__PURE__*/React__default.createElement("div", {
137453
+ className: "flex-1 default_chat_box flex flex-col justify-center items-center gap-3 !bg-[#f5f5f5]"
137454
+ }, /*#__PURE__*/React__default.createElement("svg", {
137455
+ width: "48",
137456
+ height: "48",
137457
+ viewBox: "0 0 48 48",
137458
+ fill: "none",
137459
+ xmlns: "http://www.w3.org/2000/svg"
137460
+ }, /*#__PURE__*/React__default.createElement("path", {
137461
+ d: "M40 22H8C6.89543 22 6 22.8954 6 24V42C6 43.1046 6.89543 44 8 44H40C41.1046 44 42 43.1046 42 42V24C42 22.8954 41.1046 22 40 22Z",
137462
+ fill: "black",
137463
+ "fill-opacity": "0.9",
137464
+ stroke: "black",
137465
+ "stroke-opacity": "0.9",
137466
+ "stroke-width": "4",
137467
+ "stroke-linejoin": "round"
137468
+ }), /*#__PURE__*/React__default.createElement("path", {
137469
+ d: "M14 22V14C14 8.47715 18.4772 4 24 4C29.5228 4 34 8.47715 34 14V22",
137470
+ stroke: "black",
137471
+ "stroke-opacity": "0.9",
137472
+ "stroke-width": "4",
137473
+ "stroke-linecap": "round",
137474
+ "stroke-linejoin": "round"
137475
+ }), /*#__PURE__*/React__default.createElement("path", {
137476
+ d: "M24 30V36",
137477
+ stroke: "white",
137478
+ "stroke-width": "4",
137479
+ "stroke-linecap": "round",
137480
+ "stroke-linejoin": "round"
137481
+ })), /*#__PURE__*/React__default.createElement("div", {
137482
+ className: "flex flex-row items-center gap-1"
137483
+ }, /*#__PURE__*/React__default.createElement("img", {
137484
+ src: headerInfo.headerImageURL,
137485
+ alt: "headerImageURL",
137486
+ className: "w-[24px] h-[24px] rounded-full"
137487
+ }), /*#__PURE__*/React__default.createElement("span", {
137488
+ className: "text-black text-[16px] font-medium"
137489
+ }, headerInfo.conversationName)), /*#__PURE__*/React__default.createElement("span", {
137490
+ className: "text-black text-[24px] font-semibold"
137491
+ }, "Private Chat Locked"), /*#__PURE__*/React__default.createElement("span", {
137492
+ className: "text-[#2C7CF5] text-[14px]"
137493
+ }, "Private chat with username requires holding at least ", tokenInfo === null || tokenInfo === void 0 ? void 0 : tokenInfo.requiredAmount, " ", tokenInfo === null || tokenInfo === void 0 ? void 0 : tokenInfo.tokenSymbol), /*#__PURE__*/React__default.createElement(Button, {
137494
+ className: "!bg-[#2C7CF5] !text-white !w-[320px] !h-[48px] mt-3"
137495
+ }, "Buy ", tokenInfo === null || tokenInfo === void 0 ? void 0 : tokenInfo.requiredAmount, " ", tokenInfo === null || tokenInfo === void 0 ? void 0 : tokenInfo.tokenSymbol, " to unlock"));
137496
+ };
137497
+
137509
137498
  function ownKeys$3(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; }
137510
137499
  function _objectSpread$3(e) { for (var r = 1; r < arguments.length; r++) { var _context7, _context8; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty(_context7 = ownKeys$3(Object(t), true)).call(_context7, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(e, _Object$getOwnPropertyDescriptors(t)) : _forEachInstanceProperty(_context8 = ownKeys$3(Object(t))).call(_context8, function (r) { _Object$defineProperty(e, r, _Object$getOwnPropertyDescriptor(t, r)); }); } return e; }
137511
137500
  var Chatbox = function Chatbox(props) {
@@ -137532,23 +137521,27 @@ var Chatbox = function Chatbox(props) {
137532
137521
  _Modal$useModal2 = _slicedToArray(_Modal$useModal, 2),
137533
137522
  modal = _Modal$useModal2[0],
137534
137523
  contextHolder = _Modal$useModal2[1];
137535
- var _useState3 = useState({
137524
+ var _useState3 = useState(undefined),
137525
+ _useState4 = _slicedToArray(_useState3, 2),
137526
+ tokenInfo = _useState4[0],
137527
+ setTokenInfo = _useState4[1];
137528
+ var _useState5 = useState({
137536
137529
  headerImageURL: "",
137537
137530
  conversationName: "",
137538
137531
  memberCount: 0,
137539
137532
  chatType: "singleChat"
137540
137533
  }),
137541
- _useState4 = _slicedToArray(_useState3, 2),
137542
- headerInfo = _useState4[0],
137543
- setHeaderInfo = _useState4[1];
137544
- var _useState5 = useState(true),
137545
137534
  _useState6 = _slicedToArray(_useState5, 2),
137546
- isAgent = _useState6[0],
137547
- setIsAgent = _useState6[1];
137548
- var _useState7 = useState(undefined),
137535
+ headerInfo = _useState6[0],
137536
+ setHeaderInfo = _useState6[1];
137537
+ var _useState7 = useState(true),
137549
137538
  _useState8 = _slicedToArray(_useState7, 2),
137550
- specialConversation = _useState8[0],
137551
- setSpecialConversation = _useState8[1];
137539
+ isAgent = _useState8[0],
137540
+ setIsAgent = _useState8[1];
137541
+ var _useState9 = useState(undefined),
137542
+ _useState10 = _slicedToArray(_useState9, 2),
137543
+ specialConversation = _useState10[0],
137544
+ setSpecialConversation = _useState10[1];
137552
137545
  var handleConfirmRemove = /*#__PURE__*/function () {
137553
137546
  var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
137554
137547
  return _regeneratorRuntime.wrap(function _callee$(_context) {
@@ -138031,6 +138024,20 @@ var Chatbox = function Chatbox(props) {
138031
138024
  setRightComponent && setRightComponent(undefined);
138032
138025
  }
138033
138026
  }, [currentConversation]);
138027
+ var _useState11 = useState(false),
138028
+ _useState12 = _slicedToArray(_useState11, 2),
138029
+ isFree = _useState12[0],
138030
+ setIsFree = _useState12[1];
138031
+ useEffect(function () {
138032
+ http.post('/api/agora/validatePrivateChatToken', {
138033
+ targetWalletAddress: currentConversation.conversationId
138034
+ }).then(function (res) {
138035
+ if (res.data.code === 200) {
138036
+ setTokenInfo(res.data.data.tokenInfo);
138037
+ setIsFree(res.data.data.canChat);
138038
+ }
138039
+ });
138040
+ }, [currentConversation.conversationId]);
138034
138041
  // useEffect(()=>{
138035
138042
  // const cuiScrollList = document.querySelector(".cui-messageList .cui-scrollList div");
138036
138043
  // const generatingLoader = document.querySelector("#agent-generating-loader");
@@ -138040,7 +138047,10 @@ var Chatbox = function Chatbox(props) {
138040
138047
  // },[conversationList])
138041
138048
  return /*#__PURE__*/React__default.createElement("div", {
138042
138049
  className: "yuze_chat_container w-full h-full overflow-hidden flex flex-col"
138043
- }, currentConversation.conversationId && customHeader(), /*#__PURE__*/React__default.createElement(HighlyCustomChat, _extends({
138050
+ }, currentConversation.conversationId && customHeader(), !isFree ? /*#__PURE__*/React__default.createElement(BuyIM, {
138051
+ headerInfo: headerInfo,
138052
+ tokenInfo: tokenInfo
138053
+ }) : /*#__PURE__*/React__default.createElement(HighlyCustomChat, _extends({
138044
138054
  conversationId: currentConversation.conversationId,
138045
138055
  chatType: currentConversation.chatType
138046
138056
  }, props, {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "whyuzeim",
3
- "version": "1.1.145",
3
+ "version": "1.1.147",
4
4
  "description": "im componenets",
5
5
  "main": "cjs/index.js",
6
6
  "module": "es/index.js",
@@ -1,5 +0,0 @@
1
- 'use strict';
2
-
3
- var img = "data:image/svg+xml,%3csvg width='24' height='24' viewBox='0 0 24 24' fill='none' xmlns='http://www.w3.org/2000/svg'%3e%3cpath d='M12.0007 10.5865L16.9504 5.63672L18.3646 7.05093L13.4149 12.0007L18.3646 16.9504L16.9504 18.3646L12.0007 13.4149L7.05093 18.3646L5.63672 16.9504L10.5865 12.0007L5.63672 7.05093L7.05093 5.63672L12.0007 10.5865Z' fill='white' fill-opacity='0.4'/%3e%3c/svg%3e";
4
-
5
- module.exports = img;