@kite-copilot/chat-panel 0.2.48 → 0.2.50

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
@@ -52,6 +52,12 @@ const chat = createKiteChat({
52
52
  // Optional: Pass user info for session tracking in control center
53
53
  userName: 'John Doe',
54
54
  userEmail: 'john@example.com',
55
+ // Optional: Provide authentication headers for API requests
56
+ getAuthHeaders: async () => {
57
+ return {
58
+ Authorization: `Bearer ${await getCurrentToken()}`
59
+ };
60
+ },
55
61
  onNavigate: (page, subtab) => {
56
62
  router.push(`/${page}${subtab ? `?tab=${subtab}` : ''}`);
57
63
  },
@@ -320,6 +326,7 @@ Creates a new chat instance with explicit lifecycle control.
320
326
  | `theme` | `'light' \| 'dark' \| 'system'` | No | Theme preference |
321
327
  | `startingQuestions` | `StartingQuestion[]` | No | Custom starting questions |
322
328
  | `startingQuestionsEndpoint` | `string` | No | URL to fetch per-user questions |
329
+ | `getAuthHeaders` | `() => Promise<Record<string, string>>` | No | Async function to provide auth headers |
323
330
  | `onNavigate` | `(page: string, subtab?: string) => void` | No | Navigation callback |
324
331
  | `onActionComplete` | `(actionType: string, data: any) => void` | No | Action completion callback |
325
332
 
@@ -360,6 +367,7 @@ import { ChatPanelWithToggle } from '@kite-copilot/chat-panel';
360
367
  | `onOpenChange` | `(isOpen: boolean) => void` | - | Called when open state changes |
361
368
  | `startingQuestions` | `StartingQuestion[]` | - | Custom starting questions |
362
369
  | `startingQuestionsEndpoint` | `string` | - | URL to fetch questions |
370
+ | `getAuthHeaders` | `() => Promise<Record<string, string>>` | - | Async function to provide auth headers |
363
371
  | `onNavigate` | `(page, subtab?) => void` | - | Navigation callback |
364
372
  | `onActionComplete` | `(type, data) => void` | - | Action completion callback |
365
373
 
@@ -548,6 +556,36 @@ If upgrading from a previous version with overlay/floating panel:
548
556
  <ChatPanelWithToggle />
549
557
  ```
550
558
 
559
+ ## Local Development with Test Page
560
+
561
+ To test the embed script locally using the included test page:
562
+
563
+ 1. **Install dependencies:**
564
+ ```bash
565
+ npm install
566
+ ```
567
+
568
+ 2. **Build the embed script:**
569
+ ```bash
570
+ npm run build
571
+ ```
572
+
573
+ 3. **Serve the test page:**
574
+ ```bash
575
+ npx serve .
576
+ ```
577
+
578
+ 4. **Open in browser:**
579
+ Navigate to `http://localhost:3000/test/test-embed.html`
580
+
581
+ The test page (`test/test-embed.html`) provides:
582
+ - Interactive controls to open/close/toggle the panel
583
+ - Page context switching buttons
584
+ - Backend URL toggle (localhost vs production)
585
+ - Event logging for navigation and action callbacks
586
+
587
+ **Note:** Make sure your backend agent is running on `http://localhost:5002` (or toggle to production in the test page).
588
+
551
589
  ## License
552
590
 
553
591
  MIT © Kite