@useknest/widget-web 0.1.0-beta.9 → 0.1.1

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
@@ -21,11 +21,28 @@ yarn add @useknest/widget-web
21
21
 
22
22
  ## Attributes
23
23
 
24
- | Attribute | Type | Required | Default | Description |
25
- | --------------------- | ---------------------- | -------- | ---------- | ---------------------------------------------------------- |
26
- | `publishable-api-key` | `string` | Yes | - | Your project's publishable API key |
27
- | `mode` | `'inline' \| 'bubble'` | No | `'inline'` | Display mode: inline or floating bubble button |
28
- | `default-open` | `boolean` | No | `false` | Whether the chat starts open (only applies to bubble mode) |
24
+ | Attribute | Type | Required | Default | Description |
25
+ | --------------------- | ---------------------- | -------- | ---------- | ---------------------------------------------------------------- |
26
+ | `publishable-api-key` | `string` | Yes | - | Your project's publishable API key |
27
+ | `mode` | `'inline' \| 'bubble'` | No | `'inline'` | Display mode: inline or floating bubble button |
28
+ | `default-open` | `boolean` | No | `false` | Whether the chat starts open (only applies to bubble mode) |
29
+ | `user` | `WidgetUser` (object) | No | - | Identifies the logged-in user; requires at least `id` or `email` |
30
+
31
+ The `user` attribute must be set as a JavaScript property (not an HTML attribute) since it is an object:
32
+
33
+ ```js
34
+ const widget = document.querySelector('knest-chat');
35
+ widget.user = { id: currentUser.id, email: currentUser.email, fullName: currentUser.name };
36
+ ```
37
+
38
+ ```ts
39
+ interface WidgetUser {
40
+ id?: string; // Your system's user ID (cross-device dedup key)
41
+ email?: string;
42
+ fullName?: string;
43
+ metadata?: Record<string, unknown>; // Custom attributes (e.g. plan, company)
44
+ }
45
+ ```
29
46
 
30
47
  ## Features
31
48