@cas0570/chat-widget 0.0.5 → 0.0.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
@@ -175,8 +175,8 @@ export default function Page() {
175
175
  apiUrl="https://api.geoapps.nl/api/v1/chat"
176
176
  onOpen={() => analytics.track('chat_opened')}
177
177
  onClose={() => analytics.track('chat_closed')}
178
- onMessage={(msg) => console.log('Message:', msg)}
179
- onError={(err) => console.error('Chat error:', err)}
178
+ onMessageSent={(msg) => console.log('Message:', msg)}
179
+ onResponseReceived={(res) => console.log('Response:', res)}
180
180
  />
181
181
  ```
182
182
 
@@ -216,22 +216,6 @@ export default function Page() {
216
216
  }
217
217
  ```
218
218
 
219
- ### Custom Chat Bubble
220
-
221
- ```tsx
222
- import { ChatWidget, ChatBubble } from '@geoapps/chat-widget'
223
-
224
- // Use custom trigger button
225
- <ChatWidget
226
- apiUrl="..."
227
- renderTrigger={({ isOpen, toggle }) => (
228
- <button onClick={toggle}>
229
- {isOpen ? 'Close Chat' : 'Need Help?'}
230
- </button>
231
- )}
232
- />
233
- ```
234
-
235
219
  ---
236
220
 
237
221
  ## Project Structure
@@ -1,4 +1,4 @@
1
- import { Message, WidgetSize } from '../types';
1
+ import { Message, WidgetSize, SessionSummaryResponse } from '../types';
2
2
 
3
3
  interface ChatWindowProps {
4
4
  title: string;
@@ -12,8 +12,13 @@ interface ChatWindowProps {
12
12
  onClear: () => void;
13
13
  onSizeChange: (size: WidgetSize) => void;
14
14
  onPopout: () => void;
15
+ onNewSession: () => void;
16
+ onSelectSession: (sessionId: string) => void;
17
+ onListSessions: () => Promise<SessionSummaryResponse[]>;
18
+ onDeleteSession: (sessionId: string) => Promise<void>;
19
+ currentSessionId: string | null;
15
20
  primaryColor: string;
16
21
  size: WidgetSize;
17
22
  }
18
- export declare function ChatWindow({ title, subtitle, placeholder, messages, isLoading, isLoadingSession, onSendMessage, onClose, onClear, onSizeChange, onPopout, primaryColor, size, }: ChatWindowProps): import("react/jsx-runtime").JSX.Element;
23
+ export declare function ChatWindow({ title, subtitle, placeholder, messages, isLoading, isLoadingSession, onSendMessage, onClose, onClear, onSizeChange, onPopout, onNewSession, onSelectSession, onListSessions, onDeleteSession, currentSessionId, primaryColor, size, }: ChatWindowProps): import("react/jsx-runtime").JSX.Element;
19
24
  export {};
@@ -0,0 +1,11 @@
1
+ interface ConfirmModalProps {
2
+ title: string;
3
+ message: string;
4
+ confirmLabel?: string;
5
+ cancelLabel?: string;
6
+ onConfirm: () => void;
7
+ onCancel: () => void;
8
+ variant?: 'danger' | 'default';
9
+ }
10
+ export declare function ConfirmModal({ title, message, confirmLabel, cancelLabel, onConfirm, onCancel, variant, }: ConfirmModalProps): import("react/jsx-runtime").JSX.Element;
11
+ export {};
@@ -0,0 +1,12 @@
1
+ import { WidgetSize } from '../types';
2
+
3
+ interface HeaderMenuProps {
4
+ size: WidgetSize;
5
+ onCycleSize: () => void;
6
+ onPopout: () => void;
7
+ onClear: () => void;
8
+ onNewSession: () => void;
9
+ onShowHistory: () => void;
10
+ }
11
+ export declare function HeaderMenu({ size, onCycleSize, onPopout, onClear, onNewSession, onShowHistory }: HeaderMenuProps): import("react/jsx-runtime").JSX.Element;
12
+ export {};
@@ -23,4 +23,13 @@ export declare function TrashIcon({ className }: {
23
23
  export declare function ChatIcon({ className }: {
24
24
  className?: string;
25
25
  }): import("react/jsx-runtime").JSX.Element;
26
+ export declare function NewChatIcon({ className }: {
27
+ className?: string;
28
+ }): import("react/jsx-runtime").JSX.Element;
29
+ export declare function HistoryIcon({ className }: {
30
+ className?: string;
31
+ }): import("react/jsx-runtime").JSX.Element;
32
+ export declare function ArrowLeftIcon({ className }: {
33
+ className?: string;
34
+ }): import("react/jsx-runtime").JSX.Element;
26
35
  export {};
@@ -1,6 +1,6 @@
1
- import { Message, WidgetSize } from '../types';
1
+ import { Message } from '../types';
2
2
 
3
- interface PopoutConfig {
3
+ export interface PopoutConfig {
4
4
  apiUrl: string;
5
5
  tenantId?: string;
6
6
  title: string;
@@ -11,15 +11,7 @@ interface PopoutConfig {
11
11
  messages: Message[];
12
12
  headers?: Record<string, string>;
13
13
  }
14
- interface UsePopoutReturn {
15
- isPoppedOut: boolean;
16
- openPopout: () => void;
17
- closePopout: () => void;
18
- focusPopout: () => void;
19
- }
20
14
  /**
21
- * Hook to manage the popout window state
15
+ * Generate the HTML for the popout window
22
16
  */
23
- export declare function usePopout(config: PopoutConfig, size: WidgetSize, onPopoutClose?: () => void): UsePopoutReturn;
24
- export declare function ChatWindowStandalone(): null;
25
- export {};
17
+ export declare function getPopoutHTML(config: PopoutConfig): string;
@@ -0,0 +1,13 @@
1
+ import { SessionSummaryResponse } from '../types';
2
+
3
+ interface SessionHistoryProps {
4
+ currentSessionId: string | null;
5
+ onBack: () => void;
6
+ onSelectSession: (sessionId: string) => void;
7
+ onNewSession: () => void;
8
+ onDeleteSession: (sessionId: string) => Promise<void>;
9
+ onListSessions: () => Promise<SessionSummaryResponse[]>;
10
+ primaryColor: string;
11
+ }
12
+ export declare function SessionHistory({ currentSessionId, onBack, onSelectSession, onNewSession, onDeleteSession, onListSessions, primaryColor, }: SessionHistoryProps): import("react/jsx-runtime").JSX.Element;
13
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -4,6 +4,12 @@ export { ChatBubble } from './ChatBubble';
4
4
  export { MessageList } from './MessageList';
5
5
  export { MessageInput } from './MessageInput';
6
6
  export { ToggleButton } from './ToggleButton';
7
+ export { SessionHistory } from './SessionHistory';
8
+ export { ConfirmModal } from './ConfirmModal';
7
9
  export { MarkdownRenderer } from './MarkdownRenderer';
8
- export { usePopout } from './PopoutWindow';
9
- export { ResizeIcon, ExpandIcon, ContractIcon, PopoutIcon, CloseIcon, TrashIcon, ChatIcon } from './Icons';
10
+ export { usePopout } from '../hooks/usePopout';
11
+ export { getPopoutHTML } from './PopoutWindow';
12
+ export { TypingIndicator } from './TypingIndicator';
13
+ export { HeaderMenu } from './HeaderMenu';
14
+ export { ResizeIcon, ExpandIcon, ContractIcon, PopoutIcon, CloseIcon, TrashIcon, ChatIcon, NewChatIcon, HistoryIcon, ArrowLeftIcon, } from './Icons';
15
+ export type { PopoutConfig } from './PopoutWindow';