whyuzeim 1.1.150 → 1.1.152

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.
@@ -11,6 +11,7 @@ interface IBuyIM {
11
11
  tokenAddress: string;
12
12
  requiredAmount: number;
13
13
  };
14
+ onBuy?: (tokenAddress: string) => void;
14
15
  }
15
16
  declare const BuyIM: React.FC<IBuyIM>;
16
17
  export default BuyIM;
@@ -20,6 +20,7 @@ export interface IChatbox {
20
20
  onReportClick?: (report: AIReportMessageExts) => void;
21
21
  onLoginRequired?: () => void;
22
22
  onCustomMessageAction?: (messagetype: string, cus?: any) => void;
23
+ onBuy?: (tokenAddress: string) => void;
23
24
  }
24
25
  declare const Chatbox: React.FC<IChatbox>;
25
26
  export default Chatbox;
package/cjs/index.js CHANGED
@@ -137469,7 +137469,8 @@ var HighlyCustomChat = function HighlyCustomChat(props) {
137469
137469
 
137470
137470
  var BuyIM = function BuyIM(props) {
137471
137471
  var headerInfo = props.headerInfo,
137472
- tokenInfo = props.tokenInfo;
137472
+ tokenInfo = props.tokenInfo,
137473
+ onBuy = props.onBuy;
137473
137474
  return /*#__PURE__*/React.createElement("div", {
137474
137475
  className: "flex-1 default_chat_box flex flex-col justify-center items-center gap-3 !bg-[#f5f5f5]"
137475
137476
  }, /*#__PURE__*/React.createElement("svg", {
@@ -137512,7 +137513,10 @@ var BuyIM = function BuyIM(props) {
137512
137513
  }, "Private Chat Locked"), /*#__PURE__*/React.createElement("span", {
137513
137514
  className: "text-[#2C7CF5] text-[14px]"
137514
137515
  }, "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
+ className: "!bg-[#2C7CF5] !text-white !w-[320px] !h-[48px] mt-3",
137517
+ onClick: function onClick() {
137518
+ onBuy === null || onBuy === void 0 || onBuy(tokenInfo === null || tokenInfo === void 0 ? void 0 : tokenInfo.tokenAddress);
137519
+ }
137516
137520
  }, "Buy ", tokenInfo === null || tokenInfo === void 0 ? void 0 : tokenInfo.requiredAmount, " ", tokenInfo === null || tokenInfo === void 0 ? void 0 : tokenInfo.tokenSymbol, " to unlock"));
137517
137521
  };
137518
137522
 
@@ -137530,7 +137534,8 @@ var Chatbox = function Chatbox(props) {
137530
137534
  setMidComponent = _useContext.setMidComponent,
137531
137535
  theme = _useContext.theme,
137532
137536
  specialConversations = _useContext.specialConversations;
137533
- var onBack = props.onBack;
137537
+ var onBack = props.onBack,
137538
+ onBuy = props.onBuy;
137534
137539
  var _useConversationConte = B_e(),
137535
137540
  currentConversation = _useConversationConte.currentConversation;
137536
137541
  _useConversationConte.conversationList;
@@ -137544,8 +137549,8 @@ var Chatbox = function Chatbox(props) {
137544
137549
  contextHolder = _Modal$useModal2[1];
137545
137550
  var _useState3 = React.useState(undefined),
137546
137551
  _useState4 = _slicedToArray(_useState3, 2),
137547
- tokenInfo = _useState4[0];
137548
- _useState4[1];
137552
+ tokenInfo = _useState4[0],
137553
+ setTokenInfo = _useState4[1];
137549
137554
  var _useState5 = React.useState({
137550
137555
  headerImageURL: "",
137551
137556
  conversationName: "",
@@ -138047,18 +138052,20 @@ var Chatbox = function Chatbox(props) {
138047
138052
  }, [currentConversation]);
138048
138053
  var _useState11 = React.useState(true),
138049
138054
  _useState12 = _slicedToArray(_useState11, 2),
138050
- isFree = _useState12[0];
138051
- _useState12[1];
138052
- // useEffect(()=>{
138053
- // http.post('/api/agora/validatePrivateChatToken',{
138054
- // targetWalletAddress: currentConversation.conversationId
138055
- // }).then(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
+ isFree = _useState12[0],
138056
+ setIsFree = _useState12[1];
138057
+ React.useEffect(function () {
138058
+ if (currentConversation.chatType === 'singleChat') {
138059
+ http.post('/api/agora/validatePrivateChatToken', {
138060
+ targetWalletAddress: currentConversation.conversationId
138061
+ }).then(function (res) {
138062
+ if (res.data.code === 200) {
138063
+ setTokenInfo(res.data.data.tokenInfo);
138064
+ setIsFree(res.data.data.canChat);
138065
+ }
138066
+ });
138067
+ }
138068
+ }, [currentConversation.conversationId]);
138062
138069
  // useEffect(()=>{
138063
138070
  // const cuiScrollList = document.querySelector(".cui-messageList .cui-scrollList div");
138064
138071
  // const generatingLoader = document.querySelector("#agent-generating-loader");
@@ -138070,7 +138077,8 @@ var Chatbox = function Chatbox(props) {
138070
138077
  className: "yuze_chat_container w-full h-full overflow-hidden flex flex-col"
138071
138078
  }, currentConversation.conversationId && customHeader(), !isFree ? /*#__PURE__*/React.createElement(BuyIM, {
138072
138079
  headerInfo: headerInfo,
138073
- tokenInfo: tokenInfo
138080
+ tokenInfo: tokenInfo,
138081
+ onBuy: onBuy
138074
138082
  }) : /*#__PURE__*/React.createElement(HighlyCustomChat, _extends({
138075
138083
  conversationId: currentConversation.conversationId,
138076
138084
  chatType: currentConversation.chatType
@@ -11,6 +11,7 @@ interface IBuyIM {
11
11
  tokenAddress: string;
12
12
  requiredAmount: number;
13
13
  };
14
+ onBuy?: (tokenAddress: string) => void;
14
15
  }
15
16
  declare const BuyIM: React.FC<IBuyIM>;
16
17
  export default BuyIM;
@@ -20,6 +20,7 @@ export interface IChatbox {
20
20
  onReportClick?: (report: AIReportMessageExts) => void;
21
21
  onLoginRequired?: () => void;
22
22
  onCustomMessageAction?: (messagetype: string, cus?: any) => void;
23
+ onBuy?: (tokenAddress: string) => void;
23
24
  }
24
25
  declare const Chatbox: React.FC<IChatbox>;
25
26
  export default Chatbox;
package/es/index.js CHANGED
@@ -137448,7 +137448,8 @@ var HighlyCustomChat = function HighlyCustomChat(props) {
137448
137448
 
137449
137449
  var BuyIM = function BuyIM(props) {
137450
137450
  var headerInfo = props.headerInfo,
137451
- tokenInfo = props.tokenInfo;
137451
+ tokenInfo = props.tokenInfo,
137452
+ onBuy = props.onBuy;
137452
137453
  return /*#__PURE__*/React__default.createElement("div", {
137453
137454
  className: "flex-1 default_chat_box flex flex-col justify-center items-center gap-3 !bg-[#f5f5f5]"
137454
137455
  }, /*#__PURE__*/React__default.createElement("svg", {
@@ -137491,7 +137492,10 @@ var BuyIM = function BuyIM(props) {
137491
137492
  }, "Private Chat Locked"), /*#__PURE__*/React__default.createElement("span", {
137492
137493
  className: "text-[#2C7CF5] text-[14px]"
137493
137494
  }, "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
+ className: "!bg-[#2C7CF5] !text-white !w-[320px] !h-[48px] mt-3",
137496
+ onClick: function onClick() {
137497
+ onBuy === null || onBuy === void 0 || onBuy(tokenInfo === null || tokenInfo === void 0 ? void 0 : tokenInfo.tokenAddress);
137498
+ }
137495
137499
  }, "Buy ", tokenInfo === null || tokenInfo === void 0 ? void 0 : tokenInfo.requiredAmount, " ", tokenInfo === null || tokenInfo === void 0 ? void 0 : tokenInfo.tokenSymbol, " to unlock"));
137496
137500
  };
137497
137501
 
@@ -137509,7 +137513,8 @@ var Chatbox = function Chatbox(props) {
137509
137513
  setMidComponent = _useContext.setMidComponent,
137510
137514
  theme = _useContext.theme,
137511
137515
  specialConversations = _useContext.specialConversations;
137512
- var onBack = props.onBack;
137516
+ var onBack = props.onBack,
137517
+ onBuy = props.onBuy;
137513
137518
  var _useConversationConte = B_e(),
137514
137519
  currentConversation = _useConversationConte.currentConversation;
137515
137520
  _useConversationConte.conversationList;
@@ -137523,8 +137528,8 @@ var Chatbox = function Chatbox(props) {
137523
137528
  contextHolder = _Modal$useModal2[1];
137524
137529
  var _useState3 = useState(undefined),
137525
137530
  _useState4 = _slicedToArray(_useState3, 2),
137526
- tokenInfo = _useState4[0];
137527
- _useState4[1];
137531
+ tokenInfo = _useState4[0],
137532
+ setTokenInfo = _useState4[1];
137528
137533
  var _useState5 = useState({
137529
137534
  headerImageURL: "",
137530
137535
  conversationName: "",
@@ -138026,18 +138031,20 @@ var Chatbox = function Chatbox(props) {
138026
138031
  }, [currentConversation]);
138027
138032
  var _useState11 = useState(true),
138028
138033
  _useState12 = _slicedToArray(_useState11, 2),
138029
- isFree = _useState12[0];
138030
- _useState12[1];
138031
- // useEffect(()=>{
138032
- // http.post('/api/agora/validatePrivateChatToken',{
138033
- // targetWalletAddress: currentConversation.conversationId
138034
- // }).then(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
+ isFree = _useState12[0],
138035
+ setIsFree = _useState12[1];
138036
+ useEffect(function () {
138037
+ if (currentConversation.chatType === 'singleChat') {
138038
+ http.post('/api/agora/validatePrivateChatToken', {
138039
+ targetWalletAddress: currentConversation.conversationId
138040
+ }).then(function (res) {
138041
+ if (res.data.code === 200) {
138042
+ setTokenInfo(res.data.data.tokenInfo);
138043
+ setIsFree(res.data.data.canChat);
138044
+ }
138045
+ });
138046
+ }
138047
+ }, [currentConversation.conversationId]);
138041
138048
  // useEffect(()=>{
138042
138049
  // const cuiScrollList = document.querySelector(".cui-messageList .cui-scrollList div");
138043
138050
  // const generatingLoader = document.querySelector("#agent-generating-loader");
@@ -138049,7 +138056,8 @@ var Chatbox = function Chatbox(props) {
138049
138056
  className: "yuze_chat_container w-full h-full overflow-hidden flex flex-col"
138050
138057
  }, currentConversation.conversationId && customHeader(), !isFree ? /*#__PURE__*/React__default.createElement(BuyIM, {
138051
138058
  headerInfo: headerInfo,
138052
- tokenInfo: tokenInfo
138059
+ tokenInfo: tokenInfo,
138060
+ onBuy: onBuy
138053
138061
  }) : /*#__PURE__*/React__default.createElement(HighlyCustomChat, _extends({
138054
138062
  conversationId: currentConversation.conversationId,
138055
138063
  chatType: currentConversation.chatType
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "whyuzeim",
3
- "version": "1.1.150",
3
+ "version": "1.1.152",
4
4
  "description": "im componenets",
5
5
  "main": "cjs/index.js",
6
6
  "module": "es/index.js",