@sksharma72000/ai-chat-websdk 1.1.1 → 1.2.0

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sksharma72000/ai-chat-websdk",
3
- "version": "1.1.1",
3
+ "version": "1.2.0",
4
4
  "description": "@sksharma72000/ai-chat-websdk is an embeddable, fully themeable AI chat widget for web apps. Supports JWT authentication with auto-refresh, rich content rendering (tables, code blocks, markdown), theming via CSS custom properties, and framework-agnostic mounting.",
5
5
  "main": "./ai-chat-websdk.umd.js",
6
6
  "module": "./ai-chat-websdk.es.js",
package/types/config.d.ts CHANGED
@@ -22,6 +22,13 @@ export interface SDKTheme {
22
22
  export interface SDKConfig {
23
23
  /** Base URL of the AI server, e.g. 'http://localhost:4001' */
24
24
  apiUrl: string;
25
+ /**
26
+ * Caller-supplied session identifier. When `initialize()` is called again
27
+ * with a different `chatID` the SDK creates a new `ai_sdk_correlation_id`
28
+ * so the conversation starts fresh. Repeated calls with the same `chatID`
29
+ * are no-ops (the existing session is preserved).
30
+ */
31
+ chatID?: string;
25
32
  /**
26
33
  * JWT token (full Authorization header value, e.g. 'Bearer eyJ…').
27
34
  * Sent as `Authorization` header on every API request.
@@ -9,12 +9,15 @@ export declare class CorrelationIdManager {
9
9
  private static readonly SESSIONS_KEY;
10
10
  /** Key for the permanent browser-level identifier (never changes, survives session resets). */
11
11
  private static readonly BROWSER_SESSION_KEY;
12
+ private static readonly CHAT_ID_KEY;
12
13
  /**
13
14
  * Returns the permanent browser session token.
14
15
  * Created once and stored in localStorage forever — sent as the `browser-session` header
15
16
  * on every API request so the backend can group all chat sessions for this browser.
16
17
  */
17
18
  static getBrowserSession(): string;
19
+ static getChatId(): string | null;
20
+ static setChatId(chatId: string): void;
18
21
  static getCorrelationId(): string;
19
22
  /** Save the current session into the persisted list with a display name. */
20
23
  static saveCurrentSession(name: string): void;