UNPKG

@progress/kendo-react-conversational-ui

Version:

React Chat component allows the user to participate in chat sessions with users or chat bots. KendoReact Conversational UI components

9 lines (8 loc) 1.63 kB
/** * @license *------------------------------------------------------------------------------------------- * Copyright © 2025 Progress Software Corporation. All rights reserved. * Licensed under commercial license. See LICENSE.md in the package root for more information *------------------------------------------------------------------------------------------- */ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("react"),n=require("../messages/index.js"),d=(t,s)=>t&&s.author&&t.id===s.author.id,g=(t,s)=>{const o=s.toLanguageString("chatSender.deletedMessage",n.messages[n.chatSenderDeletedMessage]),e=s.toLanguageString("chatReceiver.deletedMessage",n.messages[n.chatReceiverDeletedMessage]);return t?o:e},u=t=>{navigator.clipboard.writeText(t)},h=(t,s)=>t.find(o=>o.id===s),T=(t,s)=>{if(!s)return;const o=s.querySelector(`[data-message-id="${t}"]`);if(!o)return;const e=s.querySelector(".k-message-list");if(e){const c=e.getBoundingClientRect().top,a=o.getBoundingClientRect().top,l=e.scrollTop+(a-c);e.scrollTo({top:l,behavior:"smooth"})}else o.scrollIntoView({behavior:"smooth",block:"start"})},r=/(https?:\/\/[^\s]+)/g,p=t=>{if(!t)return[""];const s=t.split(r),o=[];return s.forEach(e=>{e&&r.test(e)?(r.lastIndex=0,o.push(i.createElement("a",{key:e,href:e,target:"_blank",rel:"noopener noreferrer",style:{color:"inherit",textDecoration:"underline"}},e))):e&&o.push(e)}),o};exports.URL_REGEX=r;exports.convertTextToLinkedContent=p;exports.copyToClipboard=u;exports.getDeletedMessageText=g;exports.getMessageById=h;exports.isAuthor=d;exports.scrollToMessageById=T;