@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
68 lines (67 loc) • 1.94 kB
JavaScript
/**
* @license
*-------------------------------------------------------------------------------------------
* Copyright © 2025 Progress Software Corporation. All rights reserved.
* Licensed under commercial license. See LICENSE.md in the package root for more information
*-------------------------------------------------------------------------------------------
*/
import i from "react";
import { messages as n, chatSenderDeletedMessage as d, chatReceiverDeletedMessage as g } from "../messages/index.mjs";
const f = (t, o) => t && o.author && t.id === o.author.id, p = (t, o) => {
const s = o.toLanguageString(
"chatSender.deletedMessage",
n[d]
), e = o.toLanguageString(
"chatReceiver.deletedMessage",
n[g]
);
return t ? s : e;
}, m = (t) => {
navigator.clipboard.writeText(t);
}, T = (t, o) => t.find((s) => s.id === o), M = (t, o) => {
if (!o)
return;
const s = o.querySelector(`[data-message-id="${t}"]`);
if (!s)
return;
const e = o.querySelector(".k-message-list");
if (e) {
const c = e.getBoundingClientRect().top, a = s.getBoundingClientRect().top, l = e.scrollTop + (a - c);
e.scrollTo({
top: l,
behavior: "smooth"
});
} else
s.scrollIntoView({
behavior: "smooth",
block: "start"
});
}, r = /(https?:\/\/[^\s]+)/g, y = (t) => {
if (!t)
return [""];
const o = t.split(r), s = [];
return o.forEach((e) => {
e && r.test(e) ? (r.lastIndex = 0, s.push(
i.createElement(
"a",
{
key: e,
href: e,
target: "_blank",
rel: "noopener noreferrer",
style: { color: "inherit", textDecoration: "underline" }
},
e
)
)) : e && s.push(e);
}), s;
};
export {
r as URL_REGEX,
y as convertTextToLinkedContent,
m as copyToClipboard,
p as getDeletedMessageText,
T as getMessageById,
f as isAuthor,
M as scrollToMessageById
};