keyring-chatbot-agent-sdk-test 0.2.0 → 0.2.1
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/dist/chat-widget.es.js
CHANGED
package/dist/chat-widget.umd.js
CHANGED
|
@@ -477,7 +477,7 @@ $${re(M?.price||0).decimalPlaces(4).toFormat()} (${M.price_change_percentage_24h
|
|
|
477
477
|
`:"🖼️ ";return`${_+1}. ${P}**${oe}**${V}
|
|
478
478
|
${U.symbol||U.contract_type} | Token ID: ${U.token_id}`}).join(`
|
|
479
479
|
|
|
480
|
-
`);await Xe(500),v(!1),l(`${r("nftCollectionHeader",{count:String(le.length),list:M})}${K&&K>0&&Z.length>K?r("nftMoreItems",{count:String(Z.length-K)}):""}${a("nftSelectBelow")}`,"bot",void 0,W),K&&K>0&&Z.length>K&&l(r("sendOtherNfts",{link
|
|
480
|
+
`);await Xe(500),v(!1),l(`${r("nftCollectionHeader",{count:String(le.length),list:M})}${K&&K>0&&Z.length>K?r("nftMoreItems",{count:String(Z.length-K)}):""}${a("nftSelectBelow")}`,"bot",void 0,W),K&&K>0&&Z.length>K&&l(r("sendOtherNfts",{link:"https://nft.keyring.app/"}),"bot")}else v(!1),l(a("nftNoCollection"),"bot")}catch(H){console.error("Error fetching NFTs:",H),v(!1),l(a("nftFetchError"),"bot")}},[u?.address,h,l,a,r]),ot=te.useCallback(async()=>{try{v(!0);const R=await je({address:u?.address||"",chain:h});if(R?.success&&R?.data?.result&&R.data.result.length>0){const K=R.data.result,H=K.flatMap(le=>[{id:`send-${le.token_address}`,text:r("buttonSendToken",{symbol:le.symbol}),value:r("buttonSendToken",{symbol:le.symbol}),action:"suggested_action",fullWidth:!!Ft.isMobile},{id:`buy-more-${le.token_address}`,text:r("buttonBuyMoreToken",{symbol:le.symbol}),value:r("buttonBuyMoreToken",{symbol:le.symbol}),action:"suggested_action",fullWidth:!!Ft.isMobile}]),Z=K.map((le,W)=>{const M=le.usd_value!==void 0?` ≈ $${re(le.usd_value).decimalPlaces(2).toFormat()}`:"";return`${W+1}. **${le.name}** (${le.symbol})
|
|
481
481
|
Balance: ${le.balance_formatted}${M}`}).join(`
|
|
482
482
|
|
|
483
483
|
`);await Xe(500),v(!1),l(r("viewBalancesHeader",{chain:g?.name||"this chain",list:Z}),"bot",void 0,H)}else v(!1),l(a("viewBalancesEmpty"),"bot")}catch(R){console.error("Error fetching balances:",R),v(!1),l(a("viewBalancesFetchError"),"bot")}},[u?.address,h,l,g?.name,a,r]),Ve=te.useMemo(()=>[{id:"ask",icon:"❓",text:a("suggestionAskText"),action:async()=>{y(!1),v(!0),l(a("suggestionAskUserMessage"),"user"),await Xe(1e3),v(!1),l(a("suggestionAskBotReply"),"bot")}},{id:"buy",icon:"💰",text:a("suggestionBuyText"),action:async()=>{y(!1),l(a("suggestionBuyText"),"user"),Re(u?.address||"")&&I?await qe():(v(!0),await Xe(1e3),Re(u?.address||"")&&!I?l(a("walletConnectedChainUnsupported"),"bot"):l(a("walletNotConnected"),"bot"),v(!1))}}],[l,u?.address,qe,a,I]),st=R=>{if(R===0)return!0;const K=i[R],H=i[R-1],Z=new Date(K.timestamp),le=new Date(H.timestamp);return Z.setHours(0,0,0,0),le.setHours(0,0,0,0),Z.getTime()!==le.getTime()};te.useEffect(()=>{he.current?.scrollIntoView({behavior:"smooth"})},[i]),te.useEffect(()=>{e?(Ee.current&&Ft.isDesktop&&Ee.current.focus(),he.current?.scrollIntoView({behavior:"instant"}),p.current&&d.current?Date.now()-d.current>5e3&&y(!0):y(!0),d.current=null,p.current=!1,setTimeout(()=>{he.current?.scrollIntoView({behavior:"smooth"})},50)):(d.current=Date.now(),p.current=!C.current)},[e]),te.useEffect(()=>{const R=K=>{K.key==="Escape"&&e&&t()};return document.addEventListener("keydown",R),()=>document.removeEventListener("keydown",R)},[e,t]);const Be=te.useCallback(async()=>{if(x?.trim()===""||S)return;const R=J,K=l(x?.trim(),"user",J?.id);B(""),Q(null),v(!0),y(!1),v(!0);try{let H,Z;const le=i.slice(-20);let W="";if(le.length>0){W=`
|