@nimbusai/webchat-sdk 1.0.0 → 1.0.2
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 +8 -8
- package/dist/index.d.mts +10 -38
- package/dist/index.d.ts +10 -38
- package/dist/index.js +4 -4
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +4 -4
- package/dist/index.mjs.map +1 -1
- package/dist/nimbus-chat.umd.global.js +4 -4
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -89,7 +89,7 @@ pnpm add @nimbusai/webchat-sdk
|
|
|
89
89
|
import { NimbusChat } from "@nimbusai/webchat-sdk";
|
|
90
90
|
|
|
91
91
|
const chat = new NimbusChat({
|
|
92
|
-
|
|
92
|
+
agent_version_id: "550e8400-e29b-41d4-a716-446655440000",
|
|
93
93
|
});
|
|
94
94
|
|
|
95
95
|
chat.open();
|
|
@@ -101,7 +101,7 @@ chat.open();
|
|
|
101
101
|
<script src="https://cdn.nimbus.ai/sdk/nimbus-chat.umd.global.js"></script>
|
|
102
102
|
<script>
|
|
103
103
|
NimbusChat.init({
|
|
104
|
-
|
|
104
|
+
agent_version_id: "550e8400-e29b-41d4-a716-446655440000",
|
|
105
105
|
});
|
|
106
106
|
</script>
|
|
107
107
|
```
|
|
@@ -112,7 +112,7 @@ The CDN bundle exposes a global `NimbusChat` object with a singleton `init()` me
|
|
|
112
112
|
|
|
113
113
|
```typescript
|
|
114
114
|
const chat = new NimbusChat({
|
|
115
|
-
|
|
115
|
+
agent_version_id: "550e8400-e29b-41d4-a716-446655440000",
|
|
116
116
|
style: { position: "bottom-right" }
|
|
117
117
|
});
|
|
118
118
|
```
|
|
@@ -144,13 +144,13 @@ const chat = NimbusChat.init(config);
|
|
|
144
144
|
|
|
145
145
|
## Configuration Reference
|
|
146
146
|
|
|
147
|
-
The SDK provides extensive configuration options to customize every aspect of the chat widget. All properties are optional except `
|
|
147
|
+
The SDK provides extensive configuration options to customize every aspect of the chat widget. All properties are optional except `agent_version_id`.
|
|
148
148
|
|
|
149
149
|
### Required Configuration
|
|
150
150
|
|
|
151
151
|
| Property | Type | Description |
|
|
152
152
|
|----------|------|-------------|
|
|
153
|
-
| `
|
|
153
|
+
| `agent_version_id` | `string` | **Required** - Your agent ID (UUID) |
|
|
154
154
|
|
|
155
155
|
### Core Settings
|
|
156
156
|
|
|
@@ -522,7 +522,7 @@ interface ColorPair {
|
|
|
522
522
|
```javascript
|
|
523
523
|
const chat = new NimbusChat({
|
|
524
524
|
// Required
|
|
525
|
-
|
|
525
|
+
agent_version_id: "550e8400-e29b-41d4-a716-446655440000",
|
|
526
526
|
|
|
527
527
|
// Core Settings
|
|
528
528
|
dns: "api.nimbus.ai/api/v1/chat/ws",
|
|
@@ -694,7 +694,7 @@ Enable comprehensive logging for development and troubleshooting:
|
|
|
694
694
|
|
|
695
695
|
```javascript
|
|
696
696
|
const chat = new NimbusChat({
|
|
697
|
-
|
|
697
|
+
agent_version_id: "your-uuid-here",
|
|
698
698
|
debug: true
|
|
699
699
|
});
|
|
700
700
|
```
|
|
@@ -853,7 +853,7 @@ NimbusChat (orchestrator)
|
|
|
853
853
|
|
|
854
854
|
### Connection Lifecycle
|
|
855
855
|
|
|
856
|
-
1. **Initial Connection**: Client opens WebSocket with `
|
|
856
|
+
1. **Initial Connection**: Client opens WebSocket with `agent_version_id` (and `flow_id` if available from localStorage)
|
|
857
857
|
2. **Connected**: Server responds with `{ "type": "connected", "flow_id": "uuid" }`
|
|
858
858
|
3. **Persistence**: `flow_id` is always stored in localStorage and reused on reconnect
|
|
859
859
|
4. **History Loading**: If `resumeConversation: true`, fetches message history via REST API after connection
|
package/dist/index.d.mts
CHANGED
|
@@ -165,34 +165,6 @@ interface SendButtonConfig {
|
|
|
165
165
|
/** If true, align input and send button horizontally on the same row. Default: false */
|
|
166
166
|
align?: boolean;
|
|
167
167
|
}
|
|
168
|
-
interface ErrorButtonConfig {
|
|
169
|
-
/** Background color of the button */
|
|
170
|
-
background?: string;
|
|
171
|
-
/** Text configuration for the button */
|
|
172
|
-
text?: TextConfig;
|
|
173
|
-
/** Icon configuration for the button. Pass null to hide. */
|
|
174
|
-
icon?: IconConfig | null;
|
|
175
|
-
}
|
|
176
|
-
interface ErrorStyleConfig {
|
|
177
|
-
/** Background color for the error message */
|
|
178
|
-
background?: string;
|
|
179
|
-
/** Title configuration for the error message. Pass null to use default. */
|
|
180
|
-
title?: TextElement | null;
|
|
181
|
-
/** Subtitle configuration for the error message. Pass null to use default. */
|
|
182
|
-
subtitle?: TextElement | null;
|
|
183
|
-
/** Button configuration for the error */
|
|
184
|
-
button?: ErrorButtonConfig;
|
|
185
|
-
}
|
|
186
|
-
interface ErrorConfig {
|
|
187
|
-
/** Styling for inactivity timeout errors */
|
|
188
|
-
inactivity?: ErrorStyleConfig;
|
|
189
|
-
/** Styling for session conflict errors */
|
|
190
|
-
conflict?: ErrorStyleConfig;
|
|
191
|
-
/** Styling for session TTL expiration errors */
|
|
192
|
-
session_ttl?: ErrorStyleConfig;
|
|
193
|
-
/** Styling for unauthorized access errors */
|
|
194
|
-
unauthorized?: ErrorStyleConfig;
|
|
195
|
-
}
|
|
196
168
|
interface BubbleConfig {
|
|
197
169
|
/** Position of the floating bubble. Default: "bottom-right" */
|
|
198
170
|
position?: BubblePosition;
|
|
@@ -202,8 +174,8 @@ interface BubbleConfig {
|
|
|
202
174
|
icon?: IconConfig | null;
|
|
203
175
|
}
|
|
204
176
|
interface NimbusChatConfig {
|
|
205
|
-
/** Required — the agent ID (UUID) for this chat instance */
|
|
206
|
-
|
|
177
|
+
/** Required — the agent version ID (UUID) for this chat instance */
|
|
178
|
+
agent_version_id: string;
|
|
207
179
|
/** DNS endpoint for chat services. Default: "api.nimbus.ai/api/v1/webchat" */
|
|
208
180
|
dns?: string;
|
|
209
181
|
/** Whether to resume previous conversation on reconnect. Default: false */
|
|
@@ -228,8 +200,8 @@ interface NimbusChatConfig {
|
|
|
228
200
|
sendButton?: SendButtonConfig;
|
|
229
201
|
/** Welcome message configuration shown when chat is empty. */
|
|
230
202
|
welcome?: WelcomeConfig;
|
|
231
|
-
/**
|
|
232
|
-
|
|
203
|
+
/** Enable test mode. When true, appends ?test=True to WebSocket connection. Default: false */
|
|
204
|
+
test?: boolean;
|
|
233
205
|
/** Enable debug logging to console. Default: false */
|
|
234
206
|
debug?: boolean;
|
|
235
207
|
/** Reconnection configuration for unexpected disconnections */
|
|
@@ -244,7 +216,7 @@ interface NimbusChatConfig {
|
|
|
244
216
|
showMore?: ShowMoreConfig;
|
|
245
217
|
}
|
|
246
218
|
interface ResolvedConfig {
|
|
247
|
-
|
|
219
|
+
agent_version_id: string;
|
|
248
220
|
dns: string;
|
|
249
221
|
resumeConversation: boolean;
|
|
250
222
|
style: {
|
|
@@ -284,7 +256,7 @@ interface ResolvedConfig {
|
|
|
284
256
|
};
|
|
285
257
|
sendButton: Required<Pick<SendButtonConfig, "align">> & Pick<SendButtonConfig, "icon">;
|
|
286
258
|
welcome: WelcomeConfig;
|
|
287
|
-
|
|
259
|
+
test: boolean;
|
|
288
260
|
debug: boolean;
|
|
289
261
|
reconnect: ReconnectConfig;
|
|
290
262
|
allowNewChat: boolean;
|
|
@@ -314,11 +286,11 @@ declare const ICON_SIZES: {
|
|
|
314
286
|
* Main SDK orchestrator.
|
|
315
287
|
*
|
|
316
288
|
* Usage (npm):
|
|
317
|
-
* const chat = new NimbusChat({
|
|
289
|
+
* const chat = new NimbusChat({ agent_version_id: "550e8400-e29b-41d4-a716-446655440000" });
|
|
318
290
|
* chat.open();
|
|
319
291
|
*
|
|
320
292
|
* Usage (CDN):
|
|
321
|
-
* NimbusChat.init({
|
|
293
|
+
* NimbusChat.init({ agent_version_id: "550e8400-e29b-41d4-a716-446655440000" });
|
|
322
294
|
*/
|
|
323
295
|
declare class NimbusChat {
|
|
324
296
|
private config;
|
|
@@ -389,7 +361,7 @@ type ConnectionState = "idle" | "connecting" | "connected" | "disconnected";
|
|
|
389
361
|
* Initialize the NimbusChat widget (singleton pattern).
|
|
390
362
|
* Use this when loading via CDN <script> tag.
|
|
391
363
|
*
|
|
392
|
-
* NimbusChat.init({
|
|
364
|
+
* NimbusChat.init({ agent_version_id: "550e8400-e29b-41d4-a716-446655440000" });
|
|
393
365
|
*/
|
|
394
366
|
declare function init(config: NimbusChatConfig): NimbusChat;
|
|
395
367
|
/**
|
|
@@ -403,4 +375,4 @@ declare const _default: {
|
|
|
403
375
|
getInstance: typeof getInstance;
|
|
404
376
|
};
|
|
405
377
|
|
|
406
|
-
export { type BubbleConfig, type BubblePosition, type ChatMessage, type ChatPosition, type ColorPair, type ConnectionState, type
|
|
378
|
+
export { type BubbleConfig, type BubblePosition, type ChatMessage, type ChatPosition, type ColorPair, type ConnectionState, type HeaderConfig, ICON_NAMES, ICON_SIZES, type IconConfig, type InputConfig, type MessageConfig, type MessageType, NimbusChat, type NimbusChatConfig, type ResolvedConfig, type SendButtonConfig, type ServerMessage, type TextConfig, type TextElement, type ThemeConfig, type UserMessage, type WelcomeConfig, _default as default, getInstance, init };
|
package/dist/index.d.ts
CHANGED
|
@@ -165,34 +165,6 @@ interface SendButtonConfig {
|
|
|
165
165
|
/** If true, align input and send button horizontally on the same row. Default: false */
|
|
166
166
|
align?: boolean;
|
|
167
167
|
}
|
|
168
|
-
interface ErrorButtonConfig {
|
|
169
|
-
/** Background color of the button */
|
|
170
|
-
background?: string;
|
|
171
|
-
/** Text configuration for the button */
|
|
172
|
-
text?: TextConfig;
|
|
173
|
-
/** Icon configuration for the button. Pass null to hide. */
|
|
174
|
-
icon?: IconConfig | null;
|
|
175
|
-
}
|
|
176
|
-
interface ErrorStyleConfig {
|
|
177
|
-
/** Background color for the error message */
|
|
178
|
-
background?: string;
|
|
179
|
-
/** Title configuration for the error message. Pass null to use default. */
|
|
180
|
-
title?: TextElement | null;
|
|
181
|
-
/** Subtitle configuration for the error message. Pass null to use default. */
|
|
182
|
-
subtitle?: TextElement | null;
|
|
183
|
-
/** Button configuration for the error */
|
|
184
|
-
button?: ErrorButtonConfig;
|
|
185
|
-
}
|
|
186
|
-
interface ErrorConfig {
|
|
187
|
-
/** Styling for inactivity timeout errors */
|
|
188
|
-
inactivity?: ErrorStyleConfig;
|
|
189
|
-
/** Styling for session conflict errors */
|
|
190
|
-
conflict?: ErrorStyleConfig;
|
|
191
|
-
/** Styling for session TTL expiration errors */
|
|
192
|
-
session_ttl?: ErrorStyleConfig;
|
|
193
|
-
/** Styling for unauthorized access errors */
|
|
194
|
-
unauthorized?: ErrorStyleConfig;
|
|
195
|
-
}
|
|
196
168
|
interface BubbleConfig {
|
|
197
169
|
/** Position of the floating bubble. Default: "bottom-right" */
|
|
198
170
|
position?: BubblePosition;
|
|
@@ -202,8 +174,8 @@ interface BubbleConfig {
|
|
|
202
174
|
icon?: IconConfig | null;
|
|
203
175
|
}
|
|
204
176
|
interface NimbusChatConfig {
|
|
205
|
-
/** Required — the agent ID (UUID) for this chat instance */
|
|
206
|
-
|
|
177
|
+
/** Required — the agent version ID (UUID) for this chat instance */
|
|
178
|
+
agent_version_id: string;
|
|
207
179
|
/** DNS endpoint for chat services. Default: "api.nimbus.ai/api/v1/webchat" */
|
|
208
180
|
dns?: string;
|
|
209
181
|
/** Whether to resume previous conversation on reconnect. Default: false */
|
|
@@ -228,8 +200,8 @@ interface NimbusChatConfig {
|
|
|
228
200
|
sendButton?: SendButtonConfig;
|
|
229
201
|
/** Welcome message configuration shown when chat is empty. */
|
|
230
202
|
welcome?: WelcomeConfig;
|
|
231
|
-
/**
|
|
232
|
-
|
|
203
|
+
/** Enable test mode. When true, appends ?test=True to WebSocket connection. Default: false */
|
|
204
|
+
test?: boolean;
|
|
233
205
|
/** Enable debug logging to console. Default: false */
|
|
234
206
|
debug?: boolean;
|
|
235
207
|
/** Reconnection configuration for unexpected disconnections */
|
|
@@ -244,7 +216,7 @@ interface NimbusChatConfig {
|
|
|
244
216
|
showMore?: ShowMoreConfig;
|
|
245
217
|
}
|
|
246
218
|
interface ResolvedConfig {
|
|
247
|
-
|
|
219
|
+
agent_version_id: string;
|
|
248
220
|
dns: string;
|
|
249
221
|
resumeConversation: boolean;
|
|
250
222
|
style: {
|
|
@@ -284,7 +256,7 @@ interface ResolvedConfig {
|
|
|
284
256
|
};
|
|
285
257
|
sendButton: Required<Pick<SendButtonConfig, "align">> & Pick<SendButtonConfig, "icon">;
|
|
286
258
|
welcome: WelcomeConfig;
|
|
287
|
-
|
|
259
|
+
test: boolean;
|
|
288
260
|
debug: boolean;
|
|
289
261
|
reconnect: ReconnectConfig;
|
|
290
262
|
allowNewChat: boolean;
|
|
@@ -314,11 +286,11 @@ declare const ICON_SIZES: {
|
|
|
314
286
|
* Main SDK orchestrator.
|
|
315
287
|
*
|
|
316
288
|
* Usage (npm):
|
|
317
|
-
* const chat = new NimbusChat({
|
|
289
|
+
* const chat = new NimbusChat({ agent_version_id: "550e8400-e29b-41d4-a716-446655440000" });
|
|
318
290
|
* chat.open();
|
|
319
291
|
*
|
|
320
292
|
* Usage (CDN):
|
|
321
|
-
* NimbusChat.init({
|
|
293
|
+
* NimbusChat.init({ agent_version_id: "550e8400-e29b-41d4-a716-446655440000" });
|
|
322
294
|
*/
|
|
323
295
|
declare class NimbusChat {
|
|
324
296
|
private config;
|
|
@@ -389,7 +361,7 @@ type ConnectionState = "idle" | "connecting" | "connected" | "disconnected";
|
|
|
389
361
|
* Initialize the NimbusChat widget (singleton pattern).
|
|
390
362
|
* Use this when loading via CDN <script> tag.
|
|
391
363
|
*
|
|
392
|
-
* NimbusChat.init({
|
|
364
|
+
* NimbusChat.init({ agent_version_id: "550e8400-e29b-41d4-a716-446655440000" });
|
|
393
365
|
*/
|
|
394
366
|
declare function init(config: NimbusChatConfig): NimbusChat;
|
|
395
367
|
/**
|
|
@@ -403,4 +375,4 @@ declare const _default: {
|
|
|
403
375
|
getInstance: typeof getInstance;
|
|
404
376
|
};
|
|
405
377
|
|
|
406
|
-
export { type BubbleConfig, type BubblePosition, type ChatMessage, type ChatPosition, type ColorPair, type ConnectionState, type
|
|
378
|
+
export { type BubbleConfig, type BubblePosition, type ChatMessage, type ChatPosition, type ColorPair, type ConnectionState, type HeaderConfig, ICON_NAMES, ICON_SIZES, type IconConfig, type InputConfig, type MessageConfig, type MessageType, NimbusChat, type NimbusChatConfig, type ResolvedConfig, type SendButtonConfig, type ServerMessage, type TextConfig, type TextElement, type ThemeConfig, type UserMessage, type WelcomeConfig, _default as default, getInstance, init };
|