@jazzmine-ui/react 0.1.4 → 0.1.7

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
@@ -17,6 +17,14 @@ Peer dependencies:
17
17
 
18
18
  - react
19
19
  - react-dom
20
+ - react-markdown
21
+ - remark-gfm
22
+
23
+ If your project does not already include peer dependencies, install everything together:
24
+
25
+ ```bash
26
+ npm install @jazzmine-ui/react react react-dom react-markdown remark-gfm
27
+ ```
20
28
 
21
29
  ## Styles
22
30
 
@@ -35,6 +43,7 @@ Components:
35
43
  - MessageList
36
44
  - FloatingChatWidget
37
45
  - JazzmineChat
46
+ - SearchModal
38
47
 
39
48
  Types:
40
49
 
@@ -43,6 +52,7 @@ Types:
43
52
  - MessageListProps
44
53
  - FloatingChatWidgetProps
45
54
  - JazzmineChatProps
55
+ - SearchModalProps
46
56
  - IJazzmineClient
47
57
  - Message
48
58
  - Chat
@@ -56,6 +66,7 @@ import {
56
66
  MessageList,
57
67
  FloatingChatWidget,
58
68
  JazzmineChat,
69
+ SearchModal,
59
70
  } from '@jazzmine-ui/react';
60
71
 
61
72
  import type {
@@ -64,6 +75,7 @@ import type {
64
75
  MessageListProps,
65
76
  FloatingChatWidgetProps,
66
77
  JazzmineChatProps,
78
+ SearchModalProps,
67
79
  IJazzmineClient,
68
80
  Message,
69
81
  Chat,
@@ -77,8 +89,11 @@ It manages:
77
89
 
78
90
  - conversation creation
79
91
  - message sending
92
+ - explicit context forwarding
80
93
  - loading state
81
94
  - conversation deletion
95
+ - conversation search modal (live search)
96
+ - message history loading on conversation selection
82
97
  - basic error fallback behavior
83
98
 
84
99
  You provide a client that matches IJazzmineClient.
@@ -112,6 +127,7 @@ export function App() {
112
127
  JazzmineChatProps:
113
128
 
114
129
  - client: IJazzmineClient (required)
130
+ - userId: string (default: 'user')
115
131
  - assistantName: string
116
132
  - placeholder: string
117
133
  - className: string
@@ -204,7 +220,12 @@ ChatInterfaceProps:
204
220
  - onSend: (text: string, contexts?: Context[]) => void
205
221
  - onNewChat: () => void
206
222
  - onSelectChat: (chatId: string) => void
223
+ - onRenameChat: (chatId: string, newTitle?: string) => void
207
224
  - onDeleteChat: (chatId: string) => void
225
+ - onSearchClick: () => void
226
+ - onLoadMore: () => void
227
+ - hasMore: boolean
228
+ - isLoadingChats: boolean
208
229
  - loadingText: string
209
230
  - loadingVariant: text-and-dots | dots-only
210
231
  - isLoading: boolean
@@ -290,9 +311,16 @@ SidebarProps:
290
311
  - chatActions: ChatAction[]
291
312
  - onNewChat: () => void
292
313
  - onSelectChat: (chatId: string) => void
293
- - onRenameChat: (chatId: string) => void
314
+ - onRenameChat: (chatId: string, newTitle?: string) => void
294
315
  - onDeleteChat: (chatId: string) => void
295
316
  - onArchiveChat: (chatId: string) => void
317
+ - onSearchClick: () => void
318
+ - onLoadMore: () => void
319
+ - hasMore: boolean
320
+ - isLoadingChats: boolean
321
+ - isSearchOpen: boolean
322
+ - searchQuery: string
323
+ - onSearchQueryChange: (query: string) => void
296
324
  - className: string
297
325
  - collapsed: boolean
298
326
  - onToggleCollapse: (value?: boolean) => void
@@ -329,6 +357,45 @@ MessageListProps:
329
357
  - onAddContext: (context: Context) => void
330
358
  - scrollRef: ref object or callback ref
331
359
 
360
+ ## 6) SearchModal
361
+
362
+ SearchModal is exported for standalone usage when you want a full-overlay
363
+ conversation picker.
364
+
365
+ ```tsx
366
+ import React from 'react';
367
+ import { SearchModal } from '@jazzmine-ui/react';
368
+ import type { Chat } from '@jazzmine-ui/react';
369
+
370
+ export function SearchModalDemo() {
371
+ const [isOpen, setIsOpen] = React.useState(true);
372
+ const [query, setQuery] = React.useState('');
373
+ const [results, setResults] = React.useState<Chat[]>([]);
374
+
375
+ return (
376
+ <SearchModal
377
+ isOpen={isOpen}
378
+ onClose={() => setIsOpen(false)}
379
+ onSelectConversation={(conversationId) => console.log(conversationId)}
380
+ searchQuery={query}
381
+ onSearchQueryChange={setQuery}
382
+ results={results}
383
+ isSearching={false}
384
+ />
385
+ );
386
+ }
387
+ ```
388
+
389
+ SearchModalProps:
390
+
391
+ - isOpen: boolean
392
+ - onClose: () => void
393
+ - onSelectConversation: (conversationId: string) => void
394
+ - searchQuery: string
395
+ - onSearchQueryChange: (query: string) => void
396
+ - results: Chat[]
397
+ - isSearching: boolean
398
+
332
399
  ## Exported Core Types
333
400
 
334
401
  Message:
@@ -370,6 +437,7 @@ interface IJazzmineClient {
370
437
  conversationId?: string;
371
438
  autoCreateConversation?: boolean;
372
439
  conversationTitle?: string;
440
+ explicitContext?: string[];
373
441
  }
374
442
  ): Promise<{
375
443
  response: {
@@ -393,6 +461,66 @@ interface IJazzmineClient {
393
461
  deleted: boolean;
394
462
  }>;
395
463
 
464
+ listConversations(params: {
465
+ userId: string;
466
+ limit?: number;
467
+ offset?: number;
468
+ }): Promise<{
469
+ conversations: Array<{
470
+ conversation_id: string;
471
+ title: string;
472
+ last_updated_at: number;
473
+ }>;
474
+ total: number;
475
+ hasMore: boolean;
476
+ offset: number;
477
+ limit: number;
478
+ }>;
479
+
480
+ searchConversations(params: {
481
+ userId: string;
482
+ query: string;
483
+ limit?: number;
484
+ offset?: number;
485
+ }): Promise<{
486
+ conversations: Array<{
487
+ conversation_id: string;
488
+ title: string;
489
+ last_updated_at: number;
490
+ }>;
491
+ total: number;
492
+ hasMore: boolean;
493
+ offset: number;
494
+ limit: number;
495
+ query?: string;
496
+ }>;
497
+
498
+ updateConversation(
499
+ conversationId: string,
500
+ payload: { title: string }
501
+ ): Promise<{
502
+ conversation_id: string;
503
+ title: string;
504
+ last_updated_at: number;
505
+ }>;
506
+
507
+ getConversationMessages(params: {
508
+ conversationId: string;
509
+ limit?: number;
510
+ offset?: number;
511
+ }): Promise<{
512
+ conversation_id: string;
513
+ messages: Array<{
514
+ id: string;
515
+ role: 'user' | 'assistant' | 'colleague_assistant' | 'system';
516
+ original_content: string;
517
+ enhanced_message: string;
518
+ timestamp: number;
519
+ }>;
520
+ total: number;
521
+ hasMore: boolean;
522
+ }>;
523
+
396
524
  getHealth(): Promise<{
397
525
  status: string;
398
526
  agent_name: string;
@@ -405,6 +533,7 @@ interface IJazzmineClient {
405
533
  - This package does not import from @jazzmine-ui/sdk directly.
406
534
  - Any SDK client that structurally matches IJazzmineClient works.
407
535
  - JazzmineChat is a client-side component and includes a use client directive.
536
+ - react-markdown and remark-gfm are externalized and must be present in the consuming app.
408
537
 
409
538
  ## Development
410
539
 
@@ -8,7 +8,15 @@ export interface ChatInterfaceProps {
8
8
  onSend: (text: string, contexts?: Context[]) => void;
9
9
  onNewChat: () => void;
10
10
  onSelectChat: (chatId: string) => void;
11
+ onRenameChat?: (chatId: string, newTitle?: string) => void;
11
12
  onDeleteChat?: (chatId: string) => void;
13
+ onSearchClick?: () => void;
14
+ onLoadMore?: () => void;
15
+ hasMore?: boolean;
16
+ isLoadingChats?: boolean;
17
+ isSearchOpen?: boolean;
18
+ searchQuery?: string;
19
+ onSearchQueryChange?: (query: string) => void;
12
20
  loadingText?: string;
13
21
  loadingVariant?: "text-and-dots" | "dots-only";
14
22
  isLoading?: boolean;
@@ -2,6 +2,8 @@ import type { IJazzmineClient } from '../../types/client';
2
2
  export interface JazzmineChatProps {
3
3
  /** A JazzmineClient instance from @jazzmine-ui/sdk */
4
4
  client: IJazzmineClient;
5
+ /** User identifier used for listing and searching conversations. Default: 'user' */
6
+ userId?: string;
5
7
  /** Displayed as the assistant's name in the UI. Default: agent name from /health */
6
8
  assistantName?: string;
7
9
  /** Placeholder text for the message input */
@@ -0,0 +1,3 @@
1
+ import React from 'react';
2
+ import type { SearchModalProps } from './types';
3
+ export declare const SearchModal: React.FC<SearchModalProps>;
@@ -0,0 +1,2 @@
1
+ export { SearchModal } from './SearchModal';
2
+ export type { SearchModalProps } from './types';
@@ -0,0 +1,10 @@
1
+ import type { Chat } from '../../types';
2
+ export interface SearchModalProps {
3
+ isOpen: boolean;
4
+ onClose: () => void;
5
+ onSelectConversation: (conversationId: string) => void;
6
+ searchQuery: string;
7
+ onSearchQueryChange: (query: string) => void;
8
+ results: Chat[];
9
+ isSearching: boolean;
10
+ }
@@ -14,9 +14,23 @@ export interface SidebarProps {
14
14
  chatActions?: ChatAction[];
15
15
  onNewChat: () => void;
16
16
  onSelectChat: (chatId: string) => void;
17
- onRenameChat?: (chatId: string) => void;
17
+ onRenameChat?: (chatId: string, newTitle?: string) => void;
18
18
  onDeleteChat?: (chatId: string) => void;
19
19
  onArchiveChat?: (chatId: string) => void;
20
+ /** Called when the search button is clicked */
21
+ onSearchClick?: () => void;
22
+ /** Called when user scrolls to the bottom of the chat list (infinite scroll) */
23
+ onLoadMore?: () => void;
24
+ /** Whether more conversations are available to load */
25
+ hasMore?: boolean;
26
+ /** Whether conversations are currently being loaded */
27
+ isLoadingChats?: boolean;
28
+ /** Whether conversation search input is visible */
29
+ isSearchOpen?: boolean;
30
+ /** Current conversation search query */
31
+ searchQuery?: string;
32
+ /** Called when search query changes */
33
+ onSearchQueryChange?: (query: string) => void;
20
34
  className?: string;
21
35
  collapsed?: boolean;
22
36
  onToggleCollapse?: (value?: boolean) => void;
package/dist/index.d.ts CHANGED
@@ -3,10 +3,12 @@ export { Sidebar } from './components/Sidebar';
3
3
  export { MessageList } from './components/MessageList';
4
4
  export { FloatingChatWidget } from './components/FloatingChatWidget';
5
5
  export { JazzmineChat } from './components/JazzmineChat';
6
+ export { SearchModal } from './components/SearchModal';
6
7
  export type { ChatInterfaceProps } from './components/ChatInterface';
7
8
  export type { SidebarProps } from './components/Sidebar';
8
9
  export type { MessageListProps } from './components/MessageList';
9
10
  export type { FloatingChatWidgetProps } from './components/FloatingChatWidget';
10
11
  export type { JazzmineChatProps } from './components/JazzmineChat';
12
+ export type { SearchModalProps } from './components/SearchModal';
11
13
  export type { IJazzmineClient } from './types/client';
12
14
  export type { Message, Chat } from './types';