@kite-copilot/chat-panel 0.2.32 → 0.2.34

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
@@ -49,6 +49,10 @@ const chat = createKiteChat({
49
49
  userId: 'user-123',
50
50
  orgId: 'org-456',
51
51
  agentUrl: 'https://your-api.example.com',
52
+ // Optional: Pass user info for session tracking in control center
53
+ userName: 'John Doe',
54
+ userEmail: 'john@example.com',
55
+ userOrganization: 'Acme Inc',
52
56
  onNavigate: (page, subtab) => {
53
57
  router.push(`/${page}${subtab ? `?tab=${subtab}` : ''}`);
54
58
  },
@@ -197,8 +201,13 @@ function App() {
197
201
  <>
198
202
  <YourExistingApp />
199
203
  {/* Just add this - no layout changes needed */}
200
- <ChatPanelWithToggle
204
+ <ChatPanelWithToggle
201
205
  agentUrl="https://your-api.example.com"
206
+ userId="user-123"
207
+ orgId="org-456"
208
+ userName="John Doe"
209
+ userEmail="john@example.com"
210
+ userOrganization="Acme Inc"
202
211
  onNavigate={(page) => router.push(`/${page}`)}
203
212
  />
204
213
  </>
@@ -279,6 +288,29 @@ The endpoint should return:
279
288
  ]
280
289
  ```
281
290
 
291
+ ## User Info & Session Tracking
292
+
293
+ Pass user information to enable session tracking in the control center. This allows support agents to see who they're chatting with when conversations are escalated.
294
+
295
+ ```ts
296
+ const chat = createKiteChat({
297
+ userId: 'user-123',
298
+ orgId: 'org-456',
299
+ // Optional user info for control center display
300
+ userName: 'John Doe',
301
+ userEmail: 'john@example.com',
302
+ userOrganization: 'Acme Inc',
303
+ });
304
+ ```
305
+
306
+ | Field | Description |
307
+ |-------|-------------|
308
+ | `userName` | Displayed in conversations list and live chat |
309
+ | `userEmail` | Shown in user details panel |
310
+ | `userOrganization` | Helps support agents identify the customer's company |
311
+
312
+ **Note:** If user info is not provided, placeholder values ("Anonymous User", "Not provided", "Unknown") will be displayed in the control center.
313
+
282
314
  ## API Reference
283
315
 
284
316
  ### createKiteChat(config)
@@ -293,6 +325,9 @@ Creates a new chat instance with explicit lifecycle control.
293
325
  | `orgId` | `string` | Yes | Organization identifier |
294
326
  | `agentUrl` | `string` | No | Backend agent API URL |
295
327
  | `currentPage` | `string` | No | Current page context |
328
+ | `userName` | `string` | No | User's display name (for control center) |
329
+ | `userEmail` | `string` | No | User's email address (for control center) |
330
+ | `userOrganization` | `string` | No | User's organization name (for control center) |
296
331
  | `theme` | `'light' \| 'dark' \| 'system'` | No | Theme preference |
297
332
  | `startingQuestions` | `StartingQuestion[]` | No | Custom starting questions |
298
333
  | `startingQuestionsEndpoint` | `string` | No | URL to fetch per-user questions |
@@ -327,6 +362,11 @@ import { ChatPanelWithToggle } from '@kite-copilot/chat-panel';
327
362
  |------|------|---------|-------------|
328
363
  | `agentUrl` | `string` | `localhost:5002` | Backend agent URL |
329
364
  | `currentPage` | `string` | - | Current page for context |
365
+ | `userId` | `string` | - | Unique user identifier |
366
+ | `orgId` | `string` | - | Organization identifier |
367
+ | `userName` | `string` | - | User's display name (for control center) |
368
+ | `userEmail` | `string` | - | User's email address (for control center) |
369
+ | `userOrganization` | `string` | - | User's organization name (for control center) |
330
370
  | `defaultOpen` | `boolean` | `false` | Initial open state (uncontrolled) |
331
371
  | `isOpen` | `boolean` | - | Controlled open state |
332
372
  | `onOpenChange` | `(isOpen: boolean) => void` | - | Called when open state changes |
@@ -421,7 +461,10 @@ Main chat endpoint for streaming responses.
421
461
  "user_id": "user-123",
422
462
  "org_id": "org-456",
423
463
  "message": "user message",
424
- "current_page": "dashboard"
464
+ "current_page": "dashboard",
465
+ "user_name": "John Doe",
466
+ "user_email": "john@example.com",
467
+ "user_organization": "Acme Inc"
425
468
  }
426
469
  ```
427
470
 
package/dist/auto.cjs CHANGED
@@ -1313,7 +1313,12 @@ function ChatPanel({
1313
1313
  currentPage,
1314
1314
  agentUrl = DEFAULT_AGENT_URL,
1315
1315
  startingQuestions: startingQuestionsProp,
1316
- startingQuestionsEndpoint
1316
+ startingQuestionsEndpoint,
1317
+ userId,
1318
+ orgId,
1319
+ userName,
1320
+ userEmail,
1321
+ userOrganization
1317
1322
  } = {}) {
1318
1323
  const [messages, setMessages] = React4.useState(initialMessages);
1319
1324
  const [input, setInput] = React4.useState("");
@@ -1884,7 +1889,12 @@ function ChatPanel({
1884
1889
  body: JSON.stringify({
1885
1890
  session_id: sessionId,
1886
1891
  message: userText,
1887
- current_page: currentPage || "dashboard"
1892
+ current_page: currentPage || "dashboard",
1893
+ user_id: userId,
1894
+ user_name: userName,
1895
+ user_email: userEmail,
1896
+ user_organization: userOrganization,
1897
+ org_id: orgId
1888
1898
  }),
1889
1899
  signal: controller.signal
1890
1900
  });
@@ -2144,6 +2154,7 @@ ${userText}`
2144
2154
  formData.append("message", userText);
2145
2155
  formData.append("session_id", sessionId);
2146
2156
  formData.append("current_page", currentPage || "dashboard");
2157
+ if (orgId) formData.append("org_id", orgId);
2147
2158
  const controller = new AbortController();
2148
2159
  const timeoutId = setTimeout(() => controller.abort(), 12e4);
2149
2160
  const response = await fetch(`${agentUrl}/chat/bulk/stream`, {
@@ -2861,7 +2872,7 @@ ${userText}`
2861
2872
  size: "sm",
2862
2873
  className: "h-7 w-7 p-0 text-gray-400 hover:text-gray-600 hover:bg-gray-100 rounded-full",
2863
2874
  onClick: () => onClose?.(),
2864
- children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_lucide_react4.X, { className: "h-3.5 w-3.5" })
2875
+ children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_lucide_react4.Minus, { className: "h-3.5 w-3.5" })
2865
2876
  }
2866
2877
  )
2867
2878
  ] })
@@ -4148,7 +4159,12 @@ function ChatPanelWithToggle({
4148
4159
  startingQuestionsEndpoint,
4149
4160
  defaultOpen = false,
4150
4161
  isOpen: controlledIsOpen,
4151
- onOpenChange
4162
+ onOpenChange,
4163
+ userId,
4164
+ orgId,
4165
+ userName,
4166
+ userEmail,
4167
+ userOrganization
4152
4168
  }) {
4153
4169
  const [internalIsOpen, setInternalIsOpen] = React4.useState(defaultOpen);
4154
4170
  const isOpen = controlledIsOpen !== void 0 ? controlledIsOpen : internalIsOpen;
@@ -4179,7 +4195,12 @@ function ChatPanelWithToggle({
4179
4195
  currentPage,
4180
4196
  agentUrl,
4181
4197
  startingQuestions,
4182
- startingQuestionsEndpoint
4198
+ startingQuestionsEndpoint,
4199
+ userId,
4200
+ orgId,
4201
+ userName,
4202
+ userEmail,
4203
+ userOrganization
4183
4204
  }
4184
4205
  );
4185
4206
  }
@@ -4232,7 +4253,12 @@ function KiteChatWrapper({
4232
4253
  onNavigate: (page, subtab) => config.onNavigate?.(page, subtab),
4233
4254
  onActionComplete: config.onActionComplete,
4234
4255
  startingQuestions: config.startingQuestions,
4235
- startingQuestionsEndpoint: config.startingQuestionsEndpoint
4256
+ startingQuestionsEndpoint: config.startingQuestionsEndpoint,
4257
+ userId: config.userId,
4258
+ orgId: config.orgId,
4259
+ userName: config.userName,
4260
+ userEmail: config.userEmail,
4261
+ userOrganization: config.userOrganization
4236
4262
  }
4237
4263
  );
4238
4264
  }
package/dist/auto.d.cts CHANGED
@@ -1,4 +1,4 @@
1
- import { K as KiteChatConfig, a as KiteChatInstance } from './createKiteChat-CyoN-YV4.cjs';
1
+ import { K as KiteChatConfig, a as KiteChatInstance } from './createKiteChat-DPFkdPqV.cjs';
2
2
  import 'react/jsx-runtime';
3
3
 
4
4
  /**
package/dist/auto.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { K as KiteChatConfig, a as KiteChatInstance } from './createKiteChat-CyoN-YV4.js';
1
+ import { K as KiteChatConfig, a as KiteChatInstance } from './createKiteChat-DPFkdPqV.js';
2
2
  import 'react/jsx-runtime';
3
3
 
4
4
  /**
package/dist/auto.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  createKiteChat
3
- } from "./chunk-5NNBNZBS.js";
3
+ } from "./chunk-URD5MNZI.js";
4
4
 
5
5
  // src/auto.ts
6
6
  function mountKiteChat(config) {
@@ -883,7 +883,7 @@ function DataRenderer({ type, data }) {
883
883
 
884
884
  // src/ChatPanel.tsx
885
885
  import * as React4 from "react";
886
- import { ArrowLeft, ArrowUp, Command, CornerDownLeft, CheckCircle2 as CheckCircle23, SquarePen, Paperclip, X, FileSpreadsheet, Loader2 as Loader22, ChevronLeft, ChevronRight, Sparkles } from "lucide-react";
886
+ import { ArrowLeft, ArrowUp, Command, CornerDownLeft, CheckCircle2 as CheckCircle23, SquarePen, Paperclip, X, FileSpreadsheet, Loader2 as Loader22, ChevronLeft, ChevronRight, Sparkles, Minus } from "lucide-react";
887
887
  import { Fragment as Fragment2, jsx as jsx9, jsxs as jsxs5 } from "react/jsx-runtime";
888
888
  var DEFAULT_AGENT_URL = "http://localhost:5002";
889
889
  var PANEL_WIDTH = 340;
@@ -1312,7 +1312,12 @@ function ChatPanel({
1312
1312
  currentPage,
1313
1313
  agentUrl = DEFAULT_AGENT_URL,
1314
1314
  startingQuestions: startingQuestionsProp,
1315
- startingQuestionsEndpoint
1315
+ startingQuestionsEndpoint,
1316
+ userId,
1317
+ orgId,
1318
+ userName,
1319
+ userEmail,
1320
+ userOrganization
1316
1321
  } = {}) {
1317
1322
  const [messages, setMessages] = React4.useState(initialMessages);
1318
1323
  const [input, setInput] = React4.useState("");
@@ -1883,7 +1888,12 @@ function ChatPanel({
1883
1888
  body: JSON.stringify({
1884
1889
  session_id: sessionId,
1885
1890
  message: userText,
1886
- current_page: currentPage || "dashboard"
1891
+ current_page: currentPage || "dashboard",
1892
+ user_id: userId,
1893
+ user_name: userName,
1894
+ user_email: userEmail,
1895
+ user_organization: userOrganization,
1896
+ org_id: orgId
1887
1897
  }),
1888
1898
  signal: controller.signal
1889
1899
  });
@@ -2143,6 +2153,7 @@ ${userText}`
2143
2153
  formData.append("message", userText);
2144
2154
  formData.append("session_id", sessionId);
2145
2155
  formData.append("current_page", currentPage || "dashboard");
2156
+ if (orgId) formData.append("org_id", orgId);
2146
2157
  const controller = new AbortController();
2147
2158
  const timeoutId = setTimeout(() => controller.abort(), 12e4);
2148
2159
  const response = await fetch(`${agentUrl}/chat/bulk/stream`, {
@@ -2860,7 +2871,7 @@ ${userText}`
2860
2871
  size: "sm",
2861
2872
  className: "h-7 w-7 p-0 text-gray-400 hover:text-gray-600 hover:bg-gray-100 rounded-full",
2862
2873
  onClick: () => onClose?.(),
2863
- children: /* @__PURE__ */ jsx9(X, { className: "h-3.5 w-3.5" })
2874
+ children: /* @__PURE__ */ jsx9(Minus, { className: "h-3.5 w-3.5" })
2864
2875
  }
2865
2876
  )
2866
2877
  ] })
@@ -4167,7 +4178,12 @@ function ChatPanelWithToggle({
4167
4178
  startingQuestionsEndpoint,
4168
4179
  defaultOpen = false,
4169
4180
  isOpen: controlledIsOpen,
4170
- onOpenChange
4181
+ onOpenChange,
4182
+ userId,
4183
+ orgId,
4184
+ userName,
4185
+ userEmail,
4186
+ userOrganization
4171
4187
  }) {
4172
4188
  const [internalIsOpen, setInternalIsOpen] = React4.useState(defaultOpen);
4173
4189
  const isOpen = controlledIsOpen !== void 0 ? controlledIsOpen : internalIsOpen;
@@ -4198,7 +4214,12 @@ function ChatPanelWithToggle({
4198
4214
  currentPage,
4199
4215
  agentUrl,
4200
4216
  startingQuestions,
4201
- startingQuestionsEndpoint
4217
+ startingQuestionsEndpoint,
4218
+ userId,
4219
+ orgId,
4220
+ userName,
4221
+ userEmail,
4222
+ userOrganization
4202
4223
  }
4203
4224
  );
4204
4225
  }
@@ -4265,7 +4286,12 @@ function KiteChatWrapper({
4265
4286
  onNavigate: (page, subtab) => config.onNavigate?.(page, subtab),
4266
4287
  onActionComplete: config.onActionComplete,
4267
4288
  startingQuestions: config.startingQuestions,
4268
- startingQuestionsEndpoint: config.startingQuestionsEndpoint
4289
+ startingQuestionsEndpoint: config.startingQuestionsEndpoint,
4290
+ userId: config.userId,
4291
+ orgId: config.orgId,
4292
+ userName: config.userName,
4293
+ userEmail: config.userEmail,
4294
+ userOrganization: config.userOrganization
4269
4295
  }
4270
4296
  );
4271
4297
  }
@@ -98,8 +98,18 @@ interface ChatPanelProps {
98
98
  startingQuestions?: StartingQuestion[];
99
99
  /** API endpoint to fetch starting questions */
100
100
  startingQuestionsEndpoint?: string;
101
+ /** Unique identifier for the current user */
102
+ userId?: string;
103
+ /** Organization identifier */
104
+ orgId?: string;
105
+ /** User's display name (for personalization and support) */
106
+ userName?: string;
107
+ /** User's email address (for support agent context) */
108
+ userEmail?: string;
109
+ /** User's organization/company name (for support agent context) */
110
+ userOrganization?: string;
101
111
  }
102
- declare function ChatPanel({ isOpen, onClose, onOpen, onBack, onNavigate, onActionComplete, currentPage, agentUrl, startingQuestions: startingQuestionsProp, startingQuestionsEndpoint, }?: ChatPanelProps): react_jsx_runtime.JSX.Element;
112
+ declare function ChatPanel({ isOpen, onClose, onOpen, onBack, onNavigate, onActionComplete, currentPage, agentUrl, startingQuestions: startingQuestionsProp, startingQuestionsEndpoint, userId, orgId, userName, userEmail, userOrganization, }?: ChatPanelProps): react_jsx_runtime.JSX.Element;
103
113
  /**
104
114
  * PanelToggle - An arrow button on the right edge that toggles the side panel
105
115
  * Shows left arrow when closed (click to open), right arrow when open (click to close)
@@ -144,8 +154,18 @@ interface ChatPanelWithToggleProps {
144
154
  isOpen?: boolean;
145
155
  /** Callback when panel open state changes */
146
156
  onOpenChange?: (isOpen: boolean) => void;
157
+ /** Unique identifier for the current user */
158
+ userId?: string;
159
+ /** Organization identifier */
160
+ orgId?: string;
161
+ /** User's display name (for personalization and support) */
162
+ userName?: string;
163
+ /** User's email address (for support agent context) */
164
+ userEmail?: string;
165
+ /** User's organization/company name (for support agent context) */
166
+ userOrganization?: string;
147
167
  }
148
- declare function ChatPanelWithToggle({ onNavigate, onActionComplete, currentPage, agentUrl, startingQuestions, startingQuestionsEndpoint, defaultOpen, isOpen: controlledIsOpen, onOpenChange, }: ChatPanelWithToggleProps): react_jsx_runtime.JSX.Element;
168
+ declare function ChatPanelWithToggle({ onNavigate, onActionComplete, currentPage, agentUrl, startingQuestions, startingQuestionsEndpoint, defaultOpen, isOpen: controlledIsOpen, onOpenChange, userId, orgId, userName, userEmail, userOrganization, }: ChatPanelWithToggleProps): react_jsx_runtime.JSX.Element;
149
169
  /**
150
170
  * @deprecated Use ChatPanelWithToggle instead for the new side panel UX
151
171
  */
@@ -206,6 +226,12 @@ interface KiteChatConfig {
206
226
  startingQuestions?: StartingQuestion[];
207
227
  /** API endpoint to fetch starting questions */
208
228
  startingQuestionsEndpoint?: string;
229
+ /** User's display name (optional - for personalization and support) */
230
+ userName?: string;
231
+ /** User's email address (optional - for support agent context) */
232
+ userEmail?: string;
233
+ /** User's organization/company name (optional - for support agent context) */
234
+ userOrganization?: string;
209
235
  }
210
236
  /**
211
237
  * Instance returned by createKiteChat with lifecycle control methods.
@@ -98,8 +98,18 @@ interface ChatPanelProps {
98
98
  startingQuestions?: StartingQuestion[];
99
99
  /** API endpoint to fetch starting questions */
100
100
  startingQuestionsEndpoint?: string;
101
+ /** Unique identifier for the current user */
102
+ userId?: string;
103
+ /** Organization identifier */
104
+ orgId?: string;
105
+ /** User's display name (for personalization and support) */
106
+ userName?: string;
107
+ /** User's email address (for support agent context) */
108
+ userEmail?: string;
109
+ /** User's organization/company name (for support agent context) */
110
+ userOrganization?: string;
101
111
  }
102
- declare function ChatPanel({ isOpen, onClose, onOpen, onBack, onNavigate, onActionComplete, currentPage, agentUrl, startingQuestions: startingQuestionsProp, startingQuestionsEndpoint, }?: ChatPanelProps): react_jsx_runtime.JSX.Element;
112
+ declare function ChatPanel({ isOpen, onClose, onOpen, onBack, onNavigate, onActionComplete, currentPage, agentUrl, startingQuestions: startingQuestionsProp, startingQuestionsEndpoint, userId, orgId, userName, userEmail, userOrganization, }?: ChatPanelProps): react_jsx_runtime.JSX.Element;
103
113
  /**
104
114
  * PanelToggle - An arrow button on the right edge that toggles the side panel
105
115
  * Shows left arrow when closed (click to open), right arrow when open (click to close)
@@ -144,8 +154,18 @@ interface ChatPanelWithToggleProps {
144
154
  isOpen?: boolean;
145
155
  /** Callback when panel open state changes */
146
156
  onOpenChange?: (isOpen: boolean) => void;
157
+ /** Unique identifier for the current user */
158
+ userId?: string;
159
+ /** Organization identifier */
160
+ orgId?: string;
161
+ /** User's display name (for personalization and support) */
162
+ userName?: string;
163
+ /** User's email address (for support agent context) */
164
+ userEmail?: string;
165
+ /** User's organization/company name (for support agent context) */
166
+ userOrganization?: string;
147
167
  }
148
- declare function ChatPanelWithToggle({ onNavigate, onActionComplete, currentPage, agentUrl, startingQuestions, startingQuestionsEndpoint, defaultOpen, isOpen: controlledIsOpen, onOpenChange, }: ChatPanelWithToggleProps): react_jsx_runtime.JSX.Element;
168
+ declare function ChatPanelWithToggle({ onNavigate, onActionComplete, currentPage, agentUrl, startingQuestions, startingQuestionsEndpoint, defaultOpen, isOpen: controlledIsOpen, onOpenChange, userId, orgId, userName, userEmail, userOrganization, }: ChatPanelWithToggleProps): react_jsx_runtime.JSX.Element;
149
169
  /**
150
170
  * @deprecated Use ChatPanelWithToggle instead for the new side panel UX
151
171
  */
@@ -206,6 +226,12 @@ interface KiteChatConfig {
206
226
  startingQuestions?: StartingQuestion[];
207
227
  /** API endpoint to fetch starting questions */
208
228
  startingQuestionsEndpoint?: string;
229
+ /** User's display name (optional - for personalization and support) */
230
+ userName?: string;
231
+ /** User's email address (optional - for support agent context) */
232
+ userEmail?: string;
233
+ /** User's organization/company name (optional - for support agent context) */
234
+ userOrganization?: string;
209
235
  }
210
236
  /**
211
237
  * Instance returned by createKiteChat with lifecycle control methods.