@cas0570/chat-widget 0.0.4 → 0.0.6
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 +2 -18
- package/dist/components/ChatWindow.d.ts +2 -1
- package/dist/components/HeaderMenu.d.ts +10 -0
- package/dist/components/MessageList.d.ts +2 -1
- package/dist/geoapps-chat-widget.js +527 -507
- package/dist/geoapps-chat-widget.umd.cjs +9 -10
- package/dist/hooks/useChat.d.ts +6 -0
- package/dist/index.d.ts +1 -1
- package/dist/types.d.ts +35 -8
- package/dist/utils/chatPersistence.d.ts +15 -24
- package/dist/utils/index.d.ts +1 -1
- package/package.json +1 -1
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
|
-
|
|
179
|
-
|
|
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
|
|
@@ -6,6 +6,7 @@ interface ChatWindowProps {
|
|
|
6
6
|
placeholder: string;
|
|
7
7
|
messages: Message[];
|
|
8
8
|
isLoading: boolean;
|
|
9
|
+
isLoadingSession?: boolean;
|
|
9
10
|
onSendMessage: (content: string) => void;
|
|
10
11
|
onClose: () => void;
|
|
11
12
|
onClear: () => void;
|
|
@@ -14,5 +15,5 @@ interface ChatWindowProps {
|
|
|
14
15
|
primaryColor: string;
|
|
15
16
|
size: WidgetSize;
|
|
16
17
|
}
|
|
17
|
-
export declare function ChatWindow({ title, subtitle, placeholder, messages, isLoading, onSendMessage, onClose, onClear, onSizeChange, onPopout, primaryColor, size, }: ChatWindowProps): import("react/jsx-runtime").JSX.Element;
|
|
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;
|
|
18
19
|
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { WidgetSize } from '../types';
|
|
2
|
+
|
|
3
|
+
interface HeaderMenuProps {
|
|
4
|
+
size: WidgetSize;
|
|
5
|
+
onCycleSize: () => void;
|
|
6
|
+
onPopout: () => void;
|
|
7
|
+
onClear: () => void;
|
|
8
|
+
}
|
|
9
|
+
export declare function HeaderMenu({ size, onCycleSize, onPopout, onClear }: HeaderMenuProps): import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
export {};
|
|
@@ -3,7 +3,8 @@ import { Message } from '../types';
|
|
|
3
3
|
interface MessageListProps {
|
|
4
4
|
messages: Message[];
|
|
5
5
|
isLoading: boolean;
|
|
6
|
+
isLoadingSession?: boolean;
|
|
6
7
|
primaryColor: string;
|
|
7
8
|
}
|
|
8
|
-
export declare function MessageList({ messages, isLoading, primaryColor }: MessageListProps): import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
export declare function MessageList({ messages, isLoading, isLoadingSession, primaryColor }: MessageListProps): import("react/jsx-runtime").JSX.Element;
|
|
9
10
|
export {};
|