@xapp/chat-widget 1.84.2 → 1.84.3

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.js CHANGED
@@ -32744,9 +32744,10 @@ typeof process !== "undefined" &&
32744
32744
  * This allows preview mode to use the existing message rendering infrastructure.
32745
32745
  *
32746
32746
  * @param messages - Array of preview messages to convert
32747
+ * @param config - Widget configuration containing avatarUrl and botName
32747
32748
  * @returns Array of ChatDetail objects suitable for MessageList rendering
32748
32749
  */
32749
- function convertPreviewMessagesToChatDetails(messages) {
32750
+ function convertPreviewMessagesToChatDetails(messages, config) {
32750
32751
  var timestamp = Date.now();
32751
32752
  return messages.map(function (msg, index) {
32752
32753
  var _a;
@@ -32754,7 +32755,8 @@ function convertPreviewMessagesToChatDetails(messages) {
32754
32755
  type: "chat.msg",
32755
32756
  user: {
32756
32757
  nick: "agent:robot",
32757
- display_name: "Assistant",
32758
+ display_name: (config === null || config === void 0 ? void 0 : config.botName) || "Assistant",
32759
+ avatarPath: config === null || config === void 0 ? void 0 : config.avatarUrl,
32758
32760
  },
32759
32761
  timestamp: timestamp + index,
32760
32762
  msg: {
@@ -32804,8 +32806,8 @@ var ChatWidgetPreview = function (props) {
32804
32806
  var mode = (_a = props.mode) !== null && _a !== void 0 ? _a : "preview";
32805
32807
  // Memoize preview message conversion to avoid recalculating on every render
32806
32808
  var previewChatDetails = require$$1.useMemo(function () {
32807
- return convertPreviewMessagesToChatDetails(props.previewMessages || []);
32808
- }, [props.previewMessages]);
32809
+ return convertPreviewMessagesToChatDetails(props.previewMessages || [], props.config);
32810
+ }, [props.previewMessages, props.config]);
32809
32811
  return (require$$0.jsx(StaticMessagesChatWidgetContainer, { messages: previewChatDetails, mode: mode, config: props.config, disableAutoScroll: props.disableAutoScroll, preview: true }));
32810
32812
  };
32811
32813
  /**