@blumessage/react-chat 1.0.8 → 1.0.10

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/README.md CHANGED
@@ -83,8 +83,9 @@ function App() {
83
83
  | `initialMessages` | `Message[]` | `[]` | Pre-populate with messages |
84
84
  | `conversationId` | `string` | - | Continue specific conversation |
85
85
  | `persistent` | `boolean` | `false` | Use localStorage vs sessionStorage |
86
- | `showTimestamps` | `boolean` | `false` | Display timestamps: today="14:00", older="17 July, 13:00" |
86
+ | `showTimestamps` | `boolean` | `false` | Display timestamps: today="2:00 PM", older="17 July, 1:00 PM" |
87
87
  | `typingText` | `string` | `"Agent is typing..."` | Custom text shown while waiting for assistant response |
88
+ | `emptyStateText` | `string` | `"Start a conversation!"` | Text shown when no messages are present |
88
89
  | **Event Callbacks** |
89
90
  | `onUserMessage` | `(message: Message) => void` | - | Called when user sends message |
90
91
  | `onAssistantMessage` | `(message: Message) => void` | - | Called when assistant responds |
@@ -162,20 +163,20 @@ const initialMessages = [
162
163
  ```tsx
163
164
  <BlumessageChat
164
165
  apiKey="your-api-key"
165
- showTimestamps={true} // Shows "14:00" or "17 July, 13:00"
166
+ showTimestamps={true} // Shows "2:00 PM" or "17 July, 1:00 PM"
166
167
  floating={false}
167
168
  initialMessages={[
168
169
  {
169
170
  id: '1',
170
171
  role: 'assistant' as const,
171
172
  content: 'Message from today',
172
- timestamp: Date.now() - (60 * 60 * 1000) // Shows: "14:00" (or "2:00 PM")
173
+ timestamp: Date.now() - (60 * 60 * 1000) // Shows: "2:00 PM" (or "14:00")
173
174
  },
174
175
  {
175
176
  id: '2',
176
177
  role: 'user' as const,
177
178
  content: 'Message from yesterday',
178
- timestamp: Date.now() - (24 * 60 * 60 * 1000) // Shows: "17 July, 13:00"
179
+ timestamp: Date.now() - (24 * 60 * 60 * 1000) // Shows: "17 July, 1:00 PM"
179
180
  }
180
181
  ]}
181
182
  />
@@ -193,6 +194,18 @@ const initialMessages = [
193
194
  />
194
195
  ```
195
196
 
197
+ ### Custom Empty State Text
198
+
199
+ ```tsx
200
+ <BlumessageChat
201
+ apiKey="your-api-key"
202
+ emptyStateText="Welcome! How can I help you today?" // Custom empty state message
203
+ // Or use different text for different contexts:
204
+ // emptyStateText="Ask me anything about our products..."
205
+ // emptyStateText="Ready to assist with your questions!"
206
+ />
207
+ ```
208
+
196
209
  ## Icon Options
197
210
 
198
211
  The `icon` prop accepts **any lucide-react icon name** with flexible naming patterns. The component intelligently matches your input to the appropriate lucide-react icon:
@@ -275,36 +288,6 @@ interface Message {
275
288
  }
276
289
  ```
277
290
 
278
- ## API Integration
279
-
280
- ### Message Sending
281
- ```
282
- POST https://api.blumessage.com/api/v1/conversations
283
- Content-Type: application/json
284
- Authorization: Bearer {API_KEY}
285
-
286
- {
287
- "message": "user input",
288
- "conversationId": "optional-existing-id"
289
- }
290
- ```
291
-
292
- ### Conversation History
293
- ```
294
- GET https://api.blumessage.com/api/v1/conversations/session/{conversationId}
295
- Authorization: {API_KEY}
296
- ```
297
-
298
- ### API Key Validation
299
- ```
300
- POST https://api.blumessage.com/api/v1/api-keys/validate
301
- Content-Type: application/json
302
-
303
- {
304
- "apiKey": "your-api-key"
305
- }
306
- ```
307
-
308
291
  ## Storage Behavior
309
292
 
310
293
  - **SessionStorage (default)**: Conversations persist until browser tab closes
@@ -324,4 +307,4 @@ ISC
324
307
 
325
308
  ## Support
326
309
 
327
- For issues and feature requests, please visit the [GitHub repository](https://github.com/Blumessage/react-chat).
310
+ For feature requests, technical support and assistance, please contact us at: **contact@blumessage.com**
@@ -101,24 +101,24 @@ var clearStoredConversationId = function (persistent) {
101
101
  }
102
102
  };
103
103
  export var BlumessageChat = function (_a) {
104
- 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,
104
+ 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,
105
105
  // Floating button props
106
- _l = _a.floating,
106
+ _m = _a.floating,
107
107
  // Floating button props
108
- floating = _l === void 0 ? true : _l, _m = _a.buttonText, buttonText = _m === void 0 ? "Chat with us" : _m, _o = _a.buttonPosition, buttonPosition = _o === void 0 ? 'bottom-right' : _o, buttonStyle = _a.buttonStyle, _p = _a.defaultOpen, defaultOpen = _p === void 0 ? false : _p, _q = _a.maximizeToggleButton, maximizeToggleButton = _q === void 0 ? true : _q, _r = _a.fullScreen, fullScreen = _r === void 0 ? false : _r, _s = _a.icon, icon = _s === void 0 ? 'message-circle' : _s,
108
+ 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,
109
109
  // Styling props
110
- _t = _a.primaryColor,
110
+ _u = _a.primaryColor,
111
111
  // Styling props
112
- primaryColor = _t === void 0 ? "linear-gradient(to right, #3b82f6,rgb(8, 98, 242))" : _t;
113
- var _u = useState(false), isInitialized = _u[0], setIsInitialized = _u[1];
114
- var _v = useState(null), error = _v[0], setError = _v[1];
115
- var _w = useState(initialMessages), messages = _w[0], setMessages = _w[1];
116
- var _x = useState(''), inputValue = _x[0], setInputValue = _x[1];
117
- var _y = useState(initialConversationId || getStoredConversationId(persistent)), conversationId = _y[0], setConversationId = _y[1];
118
- var _z = useState(defaultOpen), isOpen = _z[0], setIsOpen = _z[1];
119
- var _0 = useState(false), isAnimating = _0[0], setIsAnimating = _0[1];
120
- var _1 = useState(false), isLoading = _1[0], setIsLoading = _1[1];
121
- var _2 = useState(false), isMaximized = _2[0], setIsMaximized = _2[1];
112
+ primaryColor = _u === void 0 ? "linear-gradient(to right, #3b82f6,rgb(8, 98, 242))" : _u;
113
+ var _v = useState(false), isInitialized = _v[0], setIsInitialized = _v[1];
114
+ var _w = useState(null), error = _w[0], setError = _w[1];
115
+ var _x = useState(initialMessages), messages = _x[0], setMessages = _x[1];
116
+ var _y = useState(''), inputValue = _y[0], setInputValue = _y[1];
117
+ var _z = useState(initialConversationId || getStoredConversationId(persistent)), conversationId = _z[0], setConversationId = _z[1];
118
+ var _0 = useState(defaultOpen), isOpen = _0[0], setIsOpen = _0[1];
119
+ var _1 = useState(false), isAnimating = _1[0], setIsAnimating = _1[1];
120
+ var _2 = useState(false), isLoading = _2[0], setIsLoading = _2[1];
121
+ var _3 = useState(false), isMaximized = _3[0], setIsMaximized = _3[1];
122
122
  var messagesEndRef = useRef(null);
123
123
  var isInitialLoad = useRef(true);
124
124
  // Helper function to format timestamp
@@ -170,7 +170,7 @@ export var BlumessageChat = function (_a) {
170
170
  }
171
171
  return dimensions;
172
172
  };
173
- var _3 = getDimensions(), actualWidth = _3.width, actualHeight = _3.height;
173
+ var _4 = getDimensions(), actualWidth = _4.width, actualHeight = _4.height;
174
174
  // Function to update conversation ID and notify parent
175
175
  var updateConversationId = function (newConversationId) {
176
176
  setConversationId(newConversationId);
@@ -633,7 +633,7 @@ export var BlumessageChat = function (_a) {
633
633
  paddingRight: message.role === 'user' ? '16px' : '0'
634
634
  }, children: formatTimestamp(message.timestamp) }))] }) }, message.id)); }), isLoading && (_jsx("div", { className: "flex justify-start", children: _jsx("div", { className: "px-4 py-3 rounded-2xl max-w-[80%] text-sm leading-6 shadow-sm ".concat(theme === 'dark'
635
635
  ? 'bg-gray-700 text-gray-100 border border-gray-600'
636
- : 'bg-white text-gray-800 border border-gray-200'), children: _jsx("div", { className: "".concat(theme === 'dark' ? 'text-gray-300' : 'text-gray-600'), style: { fontStyle: 'italic' }, children: typingText }) }) })), messages.length === 0 && !isLoading && (_jsx("div", { className: "text-center text-sm py-8 ".concat(theme === 'dark' ? 'text-gray-400' : 'text-gray-500'), children: "No messages yet. Start a conversation!" })), _jsx("div", { ref: messagesEndRef })] }), _jsx("div", { className: "px-6 py-4 border-t ".concat(theme === 'dark'
636
+ : 'bg-white text-gray-800 border border-gray-200'), children: _jsx("div", { className: "".concat(theme === 'dark' ? 'text-gray-300' : 'text-gray-600'), style: { fontStyle: 'italic' }, children: typingText }) }) })), messages.length === 0 && !isLoading && (_jsx("div", { className: "text-center text-sm py-8 ".concat(theme === 'dark' ? 'text-gray-400' : 'text-gray-500'), children: emptyStateText })), _jsx("div", { ref: messagesEndRef })] }), _jsx("div", { className: "px-6 py-4 border-t ".concat(theme === 'dark'
637
637
  ? 'bg-gray-900 border-gray-700'
638
638
  : 'bg-white border-gray-100'), children: _jsxs("div", { className: "flex items-center rounded-full px-4 py-3 border ".concat(theme === 'dark'
639
639
  ? 'bg-gray-800 border-gray-600'
@@ -37,6 +37,7 @@ export interface BlumessageChatProps {
37
37
  persistent?: boolean;
38
38
  showTimestamps?: boolean;
39
39
  typingText?: string;
40
+ emptyStateText?: string;
40
41
  floating?: boolean;
41
42
  buttonText?: string;
42
43
  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.0.8",
3
+ "version": "1.0.10",
4
4
  "description": "A React TypeScript chat widget component with floating button, theming, and Blumessage API integration",
5
5
  "license": "MIT",
6
6
  "author": "Blumessage <contact@blumessage.com>",