@verba-ai/chat-sdk 1.0.2 → 1.0.4

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
@@ -4,41 +4,37 @@ A lightweight, TypeScript SDK for embedding the Verba AI chat widget into any we
4
4
 
5
5
  The SDK acts as a secure, high-performance orchestration layer that manages the injection and lifecycle of the Verba chat `iframe`. It supports both floating and inline mounting strategies.
6
6
 
7
- ## Installation
8
-
9
- Install via your preferred package manager:
10
-
11
- ```bash
12
- npm install @verba-ai/chat-sdk
13
- # or
14
- yarn add @verba-ai/chat-sdk
15
- # or
16
- pnpm add @verba-ai/chat-sdk
17
- ```
18
-
19
- ---
20
-
21
7
  ## Usage
22
8
 
23
9
  ### 1. Floating Bubble (Default)
10
+
24
11
  The easiest way to integrate the chat. It creates a fixed-position action button in the bottom corner of your screen that toggles the chat window.
25
12
 
26
13
  ```typescript
27
- import { ChatSDK } from '@verba-ai/chat-sdk';
14
+ import { ChatSDK } from "@verba-ai/chat-sdk";
28
15
 
29
16
  const chat = new ChatSDK({
30
17
  // Required: Your unique Verba tenant ID
31
- tenant: 'your-tenant-id',
32
-
33
- // Optional: Simple theme selection
34
- theme: 'dark',
35
-
36
- // Optional: Position of the bubble
37
- position: 'bottom-right'
18
+ tenant: "your-tenant-id",
19
+
20
+ // Optional
21
+ theme: {
22
+ primaryColor: "#6366f1",
23
+ backgroundColor: "#080b14",
24
+ textColor: "#f1f5f9",
25
+ },
26
+
27
+ // Optional: Configuration for the floating bubble
28
+ bubble: {
29
+ position: "bottom-right",
30
+ color: "#8b5cf6", // custom background gradient/color
31
+ size: 56, // size in pixels
32
+ icon: "<link>", // src to <img> tag
33
+ },
38
34
  });
39
35
 
40
36
  // Inject the bubble into the DOM
41
- chat.init();
37
+ chat.init();
42
38
 
43
39
  // Optional programmatic controls
44
40
  // chat.show();
@@ -47,47 +43,48 @@ chat.init();
47
43
  ```
48
44
 
49
45
  ### 2. Inline Mounting
46
+
50
47
  If you want to render the chat inside a specific part of your page (like a dashboard panel or a dedicated contact page).
51
48
 
52
49
  ```typescript
53
- import { ChatSDK } from '@verba-ai/chat-sdk';
50
+ import { ChatSDK } from "@verba-ai/chat-sdk";
54
51
 
55
52
  // Ensure the container exists in your DOM
56
53
  // <div id="my-chat-container" style="height: 600px;"></div>
57
54
 
58
55
  const chat = new ChatSDK({
59
- tenant: 'your-tenant-id',
60
-
56
+ tenant: "your-tenant-id",
57
+
61
58
  // Target a CSS selector or pass an HTMLElement directly
62
- container: '#my-chat-container',
63
-
59
+ container: "#my-chat-container",
60
+
64
61
  // Optional: Advanced visual theming
65
62
  theme: {
66
- primaryColor: '#6366f1',
67
- backgroundColor: '#080b14',
68
- textColor: '#f1f5f9',
69
- borderRadius: '12px'
70
- }
63
+ primaryColor: "#6366f1",
64
+ backgroundColor: "#080b14",
65
+ textColor: "#f1f5f9",
66
+ },
71
67
  });
72
68
 
73
69
  chat.init();
74
70
  ```
75
71
 
76
72
  ### 3. Usage via CDN (UMD)
73
+
77
74
  If you aren't using a bundler (Webpack/Vite/Rollup), you can load the SDK directly via a script tag.
78
75
 
79
76
  ```html
80
77
  <script src="https://unpkg.com/@verba-ai/chat-sdk@latest/dist/chat-sdk.umd.cjs"></script>
81
78
  <script>
82
79
  const { ChatSDK } = window.VerbaChatSDK;
83
-
84
- new ChatSDK({ tenant: 'your-tenant-id' }).init();
80
+
81
+ new ChatSDK({ tenant: "your-tenant-id" }).init();
85
82
  </script>
86
83
  ```
87
84
 
88
85
  ---
89
86
 
90
- ## 📚 API Reference
87
+ ## API Reference
91
88
 
92
89
  ### `ChatSDK` Class
93
90
 
@@ -95,12 +92,12 @@ The main entry point for the widget.
95
92
 
96
93
  #### Methods
97
94
 
98
- | Method | Description |
99
- | :--- | :--- |
100
- | `init()` | Injects the CSS and iframe into the DOM. Resolves the SDK state to `ready`. |
101
- | `show()` | Makes the widget visible (animates the iframe open in floating mode). |
102
- | `hide()` | Hides the widget (animates the iframe closed in floating mode). |
103
- | `destroy()`| Completely tears down the SDK, removing all injected DOM elements, styles, and events. |
95
+ | Method | Description |
96
+ | :---------- | :------------------------------------------------------------------------------------- |
97
+ | `init()` | Injects the CSS and iframe into the DOM. |
98
+ | `show()` | Makes the widget visible (animates the iframe open in floating mode). |
99
+ | `hide()` | Hides the widget (animates the iframe closed in floating mode). |
100
+ | `destroy()` | Completely tears down the SDK, removing all injected DOM elements, styles, and events. |
104
101
 
105
102
  ---
106
103
 
@@ -112,18 +109,36 @@ The main entry point for the widget.
112
109
  interface ChatSDKConfig {
113
110
  /** Your Verba tenant ID (Required) */
114
111
  tenant: string;
115
-
112
+
116
113
  /** Where to mount the widget. Omit for floating bubble. */
117
114
  container?: string | HTMLElement;
118
-
115
+
119
116
  /** Visual theme. String preset or detailed config. */
120
- theme?: 'light' | 'dark' | ThemeConfig;
121
-
122
- /** Position of the floating bubble (Default: 'bottom-right') */
123
- position?: 'bottom-right' | 'bottom-left';
124
-
125
- /** Arbitrary metadata to pass to the widget */
126
- userMetadata?: Record<string, unknown>;
117
+ theme?: "light" | "dark" | ThemeConfig;
118
+
119
+ /** Configuration for the floating bubble. */
120
+ bubble?: ChatBubbleConfig;
121
+ }
122
+ ```
123
+
124
+ #### `ChatBubbleConfig`
125
+
126
+ ```typescript
127
+ interface ChatBubbleConfig {
128
+ /** Corner position of the floating bubble (Default: 'bottom-right') */
129
+ position?: "bottom-right" | "bottom-left";
130
+
131
+ /** Background color of the bubble (Default: '#ffffff') */
132
+ color?: string;
133
+
134
+ /** Size of the bubble in pixels (Default: 56) */
135
+ size?: number;
136
+
137
+ /** SVG string for a custom open (chat) icon */
138
+ icon?: string;
139
+
140
+ /** Color of the close (X) icon (Default: '#ffffff') */
141
+ closeIconColor?: string;
127
142
  }
128
143
  ```
129
144
 
@@ -135,7 +150,5 @@ interface ThemeConfig {
135
150
  textColor?: string;
136
151
  backgroundColor?: string;
137
152
  fontFamily?: string;
138
- borderRadius?: string | number;
139
153
  }
140
154
  ```
141
-