@blumessage/react-chat 1.1.1 → 1.1.2

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.
@@ -103,24 +103,24 @@ var clearStoredConversationId = function (persistent) {
103
103
  }
104
104
  };
105
105
  export var BlumessageChat = function (_a) {
106
- var apiKey = _a.apiKey, _b = _a.placeholder, placeholder = _b === void 0 ? "Type your message..." : _b, _c = _a.theme, theme = _c === void 0 ? 'light' : _c, width = _a.width, height = _a.height, _d = _a.size, size = _d === void 0 ? 'medium' : _d, _e = _a.name, name = _e === void 0 ? "Blumessage AI" : _e, _f = _a.subtitle, subtitle = _f === void 0 ? "Online • Instant responses" : _f, _g = _a.initialMessages, initialMessages = _g === void 0 ? [] : _g, onUserMessage = _a.onUserMessage, onAssistantMessage = _a.onAssistantMessage, initialConversationId = _a.conversationId, onConversationIdChange = _a.onConversationIdChange, onChatWidgetOpen = _a.onChatWidgetOpen, onChatWidgetClosed = _a.onChatWidgetClosed, onError = _a.onError, _h = _a.persistent, persistent = _h === void 0 ? false : _h, _j = _a.showTimestamps, showTimestamps = _j === void 0 ? false : _j, _k = _a.typingText, typingText = _k === void 0 ? "Agent is typing..." : _k, _l = _a.emptyStateText, emptyStateText = _l === void 0 ? "Start a conversation!" : _l,
106
+ var apiKey = _a.apiKey, _b = _a.placeholder, placeholder = _b === void 0 ? "Type your message..." : _b, _c = _a.theme, theme = _c === void 0 ? 'light' : _c, width = _a.width, height = _a.height, _d = _a.size, size = _d === void 0 ? 'medium' : _d, _e = _a.name, name = _e === void 0 ? "Blumessage AI" : _e, _f = _a.subtitle, subtitle = _f === void 0 ? "Online • Instant responses" : _f, _g = _a.initialMessages, initialMessages = _g === void 0 ? [] : _g, onUserMessage = _a.onUserMessage, onAssistantMessage = _a.onAssistantMessage, initialConversationId = _a.conversationId, onConversationIdChange = _a.onConversationIdChange, onChatWidgetOpen = _a.onChatWidgetOpen, onChatWidgetClosed = _a.onChatWidgetClosed, onError = _a.onError, _h = _a.persistent, persistent = _h === void 0 ? false : _h, _j = _a.showTimestamps, showTimestamps = _j === void 0 ? false : _j, _k = _a.typingText, typingText = _k === void 0 ? "Agent is typing..." : _k, _l = _a.emptyStateText, emptyStateText = _l === void 0 ? "Start a conversation!" : _l, _m = _a.markdown, markdown = _m === void 0 ? true : _m,
107
107
  // Floating button props
108
- _m = _a.floating,
108
+ _o = _a.floating,
109
109
  // Floating button props
110
- floating = _m === void 0 ? true : _m, _o = _a.buttonText, buttonText = _o === void 0 ? "Chat with us" : _o, _p = _a.buttonPosition, buttonPosition = _p === void 0 ? 'bottom-right' : _p, buttonStyle = _a.buttonStyle, _q = _a.defaultOpen, defaultOpen = _q === void 0 ? false : _q, _r = _a.maximizeToggleButton, maximizeToggleButton = _r === void 0 ? true : _r, _s = _a.fullScreen, fullScreen = _s === void 0 ? false : _s, _t = _a.icon, icon = _t === void 0 ? 'message-circle' : _t,
110
+ floating = _o === void 0 ? true : _o, _p = _a.buttonText, buttonText = _p === void 0 ? "Chat with us" : _p, _q = _a.buttonPosition, buttonPosition = _q === void 0 ? 'bottom-right' : _q, buttonStyle = _a.buttonStyle, _r = _a.defaultOpen, defaultOpen = _r === void 0 ? false : _r, _s = _a.maximizeToggleButton, maximizeToggleButton = _s === void 0 ? true : _s, _t = _a.fullScreen, fullScreen = _t === void 0 ? false : _t, _u = _a.icon, icon = _u === void 0 ? 'message-circle' : _u,
111
111
  // Styling props
112
- _u = _a.primaryColor,
112
+ _v = _a.primaryColor,
113
113
  // Styling props
114
- primaryColor = _u === void 0 ? "linear-gradient(to right, #3b82f6,rgb(8, 98, 242))" : _u;
115
- var _v = useState(false), isInitialized = _v[0], setIsInitialized = _v[1];
116
- var _w = useState(null), error = _w[0], setError = _w[1];
117
- var _x = useState(initialMessages), messages = _x[0], setMessages = _x[1];
118
- var _y = useState(''), inputValue = _y[0], setInputValue = _y[1];
119
- var _z = useState(initialConversationId || getStoredConversationId(persistent)), conversationId = _z[0], setConversationId = _z[1];
120
- var _0 = useState(defaultOpen), isOpen = _0[0], setIsOpen = _0[1];
121
- var _1 = useState(false), isAnimating = _1[0], setIsAnimating = _1[1];
122
- var _2 = useState(false), isLoading = _2[0], setIsLoading = _2[1];
123
- var _3 = useState(false), isMaximized = _3[0], setIsMaximized = _3[1];
114
+ primaryColor = _v === void 0 ? "linear-gradient(to right, #3b82f6,rgb(8, 98, 242))" : _v;
115
+ var _w = useState(false), isInitialized = _w[0], setIsInitialized = _w[1];
116
+ var _x = useState(null), error = _x[0], setError = _x[1];
117
+ var _y = useState(initialMessages), messages = _y[0], setMessages = _y[1];
118
+ var _z = useState(''), inputValue = _z[0], setInputValue = _z[1];
119
+ var _0 = useState(initialConversationId || getStoredConversationId(persistent)), conversationId = _0[0], setConversationId = _0[1];
120
+ var _1 = useState(defaultOpen), isOpen = _1[0], setIsOpen = _1[1];
121
+ var _2 = useState(false), isAnimating = _2[0], setIsAnimating = _2[1];
122
+ var _3 = useState(false), isLoading = _3[0], setIsLoading = _3[1];
123
+ var _4 = useState(false), isMaximized = _4[0], setIsMaximized = _4[1];
124
124
  var messagesEndRef = useRef(null);
125
125
  var isInitialLoad = useRef(true);
126
126
  // Helper function to format timestamp
@@ -172,7 +172,7 @@ export var BlumessageChat = function (_a) {
172
172
  }
173
173
  return dimensions;
174
174
  };
175
- var _4 = getDimensions(), actualWidth = _4.width, actualHeight = _4.height;
175
+ var _5 = getDimensions(), actualWidth = _5.width, actualHeight = _5.height;
176
176
  // Function to update conversation ID and notify parent
177
177
  var updateConversationId = function (newConversationId) {
178
178
  setConversationId(newConversationId);
@@ -606,7 +606,7 @@ export var BlumessageChat = function (_a) {
606
606
  ? 'blumessage-bg-gradient-to-r blumessage-from-blue-500 blumessage-to-purple-600 blumessage-text-white'
607
607
  : theme === 'light'
608
608
  ? 'blumessage-bg-gray-100'
609
- : 'blumessage-bg-gray-700'), children: message.role === 'assistant' ? (_jsx("div", { className: "blumessage-prose ".concat(theme === 'dark' ? 'blumessage-text-white' : 'blumessage-text-gray-900'), children: _jsx(ReactMarkdown, { remarkPlugins: [remarkGfm], children: message.content }) })) : (_jsx("p", { className: "blumessage-text-sm blumessage-whitespace-pre-wrap", children: message.content })) }), showTimestamps && (_jsx("span", { className: "blumessage-text-xs blumessage-text-gray-500", children: formatTimestamp(message.timestamp) }))] }) }, message.id));
609
+ : 'blumessage-bg-gray-700'), children: message.role === 'assistant' ? (_jsx("div", { className: "blumessage-prose ".concat(theme === 'dark' ? 'blumessage-text-white' : 'blumessage-text-gray-900'), children: markdown ? (_jsx(ReactMarkdown, { remarkPlugins: [remarkGfm], children: message.content })) : (_jsx("p", { className: "blumessage-text-sm blumessage-whitespace-pre-wrap", children: message.content })) })) : (_jsx("div", { className: "blumessage-text-sm blumessage-whitespace-pre-wrap blumessage-text-white", children: markdown ? (_jsx(ReactMarkdown, { remarkPlugins: [remarkGfm], children: message.content })) : (_jsx("p", { className: "blumessage-text-sm blumessage-whitespace-pre-wrap", children: message.content })) })) }), showTimestamps && (_jsx("span", { className: "blumessage-text-xs blumessage-text-gray-500", children: formatTimestamp(message.timestamp) }))] }) }, message.id));
610
610
  };
611
611
  // Render chat window component
612
612
  var renderChatWindow = function () {
@@ -636,7 +636,7 @@ export var BlumessageChat = function (_a) {
636
636
  ? 'text-white'
637
637
  : theme === 'dark'
638
638
  ? 'bg-gray-700 text-gray-100 border border-gray-600 shadow-sm'
639
- : 'bg-white text-gray-800 border border-gray-200 shadow-sm'), style: message.role === 'user' ? { backgroundImage: primaryColor } : {}, children: [message.role === 'assistant' ? (_jsx(ReactMarkdown, { remarkPlugins: [remarkGfm], children: message.content })) : (_jsx("div", { className: "inline-block", children: message.content })), showTimestamps && (_jsx("div", { className: "text-[10px] mt-1 opacity-75 ".concat(message.role === 'user'
639
+ : 'bg-white text-gray-800 border border-gray-200 shadow-sm'), style: message.role === 'user' ? { backgroundImage: primaryColor } : {}, children: [message.role === 'assistant' ? (markdown ? (_jsx(ReactMarkdown, { remarkPlugins: [remarkGfm], children: message.content })) : (_jsx("div", { className: "whitespace-pre-wrap", children: message.content }))) : (_jsx("div", { className: "inline-block", children: markdown ? (_jsx(ReactMarkdown, { remarkPlugins: [remarkGfm], children: message.content })) : (_jsx("div", { className: "whitespace-pre-wrap", children: message.content })) })), showTimestamps && (_jsx("div", { className: "text-[10px] mt-1 opacity-75 ".concat(message.role === 'user'
640
640
  ? 'text-white/75'
641
641
  : theme === 'dark'
642
642
  ? 'text-gray-400'
@@ -38,6 +38,7 @@ export interface BlumessageChatProps {
38
38
  showTimestamps?: boolean;
39
39
  typingText?: string;
40
40
  emptyStateText?: string;
41
+ markdown?: boolean;
41
42
  floating?: boolean;
42
43
  buttonText?: string;
43
44
  buttonPosition?: 'bottom-right' | 'bottom-left' | 'top-right' | 'top-left';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blumessage/react-chat",
3
- "version": "1.1.1",
3
+ "version": "1.1.2",
4
4
  "description": "A React TypeScript chat widget component with floating button, theming, and Blumessage API integration",
5
5
  "license": "UNLICENSED",
6
6
  "author": "Blumessage <contact@blumessage.com>",