@spteck/react-controls-v2 2.0.14 → 2.0.15

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/index.mjs CHANGED
@@ -25754,6 +25754,40 @@ const AIAssistant = (props) => {
25754
25754
  }
25755
25755
  );
25756
25756
  }
25757
+ const renderMessageContent = (message) => {
25758
+ if (typeof message !== "string") {
25759
+ return message;
25760
+ }
25761
+ const trimmedMessage = message.trim();
25762
+ try {
25763
+ const parsed = JSON.parse(trimmedMessage);
25764
+ if (parsed.type === "AdaptiveCard" && parsed.version) {
25765
+ return /* @__PURE__ */ jsx$2(
25766
+ AdaptiveCardHost,
25767
+ {
25768
+ card: parsed,
25769
+ context,
25770
+ onInvokeAction: (action) => {
25771
+ console.log("Adaptive Card action:", action);
25772
+ },
25773
+ onError: (error2) => {
25774
+ console.error("Adaptive Card error:", error2);
25775
+ }
25776
+ }
25777
+ );
25778
+ }
25779
+ } catch {
25780
+ }
25781
+ return /* @__PURE__ */ jsx$2("pre", { style: {
25782
+ whiteSpace: "pre-wrap",
25783
+ wordWrap: "break-word",
25784
+ fontFamily: "inherit",
25785
+ fontSize: "inherit",
25786
+ margin: 0,
25787
+ maxWidth: "100%",
25788
+ overflow: "auto"
25789
+ }, children: message });
25790
+ };
25757
25791
  return /* @__PURE__ */ jsxs$1("div", { id: "aiAssistant", className: styles2.chatAIAssistantRoot, children: [
25758
25792
  /* @__PURE__ */ jsx$2(Chat, { className: styles2.chatList, ref: chatListRef, children: messages.map(
25759
25793
  (message, index) => message.senderName === "User" ? /* @__PURE__ */ jsx$2(
@@ -25780,7 +25814,7 @@ const AIAssistant = (props) => {
25780
25814
  ),
25781
25815
  author: message.senderName,
25782
25816
  timestamp: message.timeStamp,
25783
- children: message.message
25817
+ children: renderMessageContent(message.message)
25784
25818
  },
25785
25819
  index
25786
25820
  )