@dsrcjs/ai-widget 1.0.5 → 1.0.6

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
@@ -48,16 +48,16 @@ the default modes and theme, `Access-Control-Allow-Origin: *`, so any site may e
48
48
  own branding, origins and higher limits gets a key and adds `site-key="…"` (see [Site key](#site-key)) from the ready snippet
49
49
  AI-Dana gives with the key.
50
50
 
51
- | Attribute | Meaning |
52
- | ------------------- | ----------------------------------------------------------------------------------------------------- |
53
- | `site-key` | Public key of the widget site; without it the anonymous tier |
54
- | `api-url` | Backend origin (required on other sites); absent or `""` = the page's own origin |
55
- | `launcher` | Launcher button + floating window. Without it only the window is rendered (size the element yourself) |
56
- | `lang` | `kk` \| `ru` \| `en` (observed) |
57
- | `theme` | `light` \| `dark` \| `auto` (observed) |
58
- | `position` | `bottom-right` (default) \| `bottom-left` |
59
- | `draggable="false"` | Pin the launcher |
60
- | `open` | Open on load |
51
+ | Attribute | Meaning |
52
+ | ------------------- | ----------------------------------------------------------------------------------------------------------- |
53
+ | `site-key` | Public key of the widget site; without it the anonymous tier |
54
+ | `api-url` | Backend origin, an absolute `http(s)` URL (required on other sites); absent or `""` = the page's own origin |
55
+ | `launcher` | Launcher button + floating window. Without it only the window is rendered (size the element yourself) |
56
+ | `lang` | `kk` \| `ru` \| `en` (observed) |
57
+ | `theme` | `light` \| `dark` \| `auto` (observed) |
58
+ | `position` | `bottom-right` (default) \| `bottom-left` |
59
+ | `draggable="false"` | Pin the launcher |
60
+ | `open` | Open on load |
61
61
 
62
62
  The element has `open()`, `close()`, `setTheme(theme)` and `setLang(lang)` and fires `openchange`
63
63
  (`event.detail.open`). The script also exposes the global `AiDanaChat` with `mountLauncher` and `mount`.
@@ -80,17 +80,17 @@ const inline = mount(document.getElementById('chat')!, { siteKey: 'YOUR_SITE_KEY
80
80
 
81
81
  ### Options
82
82
 
83
- | Option | Type | Default | Notes |
84
- | -------------- | --------------------------------- | ---------------------------------------- | -------------------------------------------------------------------------- |
85
- | `siteKey` | `string` | — (anonymous tier) | Only for sites that were given a key |
86
- | `apiUrl` | `string` | `''` (no address in the published build) | Backend origin; calls go to `{apiUrl}/api/v1/widget/…`; `''` = same origin |
87
- | `lang` | `'kk' \| 'ru' \| 'en'` | `<html lang>` → browser language → `ru` | |
88
- | `theme` | `ThemeOptions` | `{}` | Layer 2, see [Theming](#theming) |
89
- | `position` | `'bottom-right' \| 'bottom-left'` | `'bottom-right'` | Launcher corner |
90
- | `draggable` | `boolean` | `true` | Never draggable below 640px |
91
- | `defaultOpen` | `boolean` | `false` (`true` for `mount`) | |
92
- | `onOpenChange` | `(open: boolean) => void` | — | |
93
- | `visitorId` | `string` (UUID) | kept in `localStorage.aid_visitor` | Pass your own id to keep a visitor's history across devices |
83
+ | Option | Type | Default | Notes |
84
+ | -------------- | --------------------------------- | ---------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------- |
85
+ | `siteKey` | `string` | — (anonymous tier) | Only for sites that were given a key |
86
+ | `apiUrl` | `string` | `''` (no address in the published build) | Backend origin; calls go to `{apiUrl}/api/v1/widget/…`; `''` = same origin |
87
+ | `lang` | `'kk' \| 'ru' \| 'en'` | `<html lang>` → browser language → `ru` | |
88
+ | `theme` | `ThemeOptions` | `{}` | Layer 2, see [Theming](#theming) |
89
+ | `position` | `'bottom-right' \| 'bottom-left'` | `'bottom-right'` | Launcher corner |
90
+ | `draggable` | `boolean` | `true` | Never draggable below 640px |
91
+ | `defaultOpen` | `boolean` | `false` (`true` for `mount`) | |
92
+ | `onOpenChange` | `(open: boolean) => void` | — | |
93
+ | `visitorId` | `string` (UUID) | kept in `localStorage.aid_visitor` | Deprecated: the backend now issues and signs the visitor id itself; a passed id works only while the backend still accepts unsigned ids |
94
94
 
95
95
  ### Handle
96
96
 
@@ -153,7 +153,7 @@ interface ThemeOptions {
153
153
  }
154
154
  ```
155
155
 
156
- Dana is one drawn character with no colour options; `logoUrl` replaces her in the header only. Her pictures are
156
+ Dana is one drawn character with no colour options; `logoUrl` (https, a path on your own site or a `data:image/…` URL; sent without a Referer) replaces her in the header only. Her pictures are
157
157
  fetched from the backend (`<apiUrl>/static/avatars/dana/`). Site CSS can still style the box around her through
158
158
  `::part(avatar)`.
159
159
 
@@ -242,14 +242,14 @@ these are one list: the widget is tested to draw every part named here and to na
242
242
 
243
243
  ## Storage
244
244
 
245
- | `localStorage` key | Value |
246
- | ------------------ | ----------------------------------------------------- |
247
- | `aid_visitor` | Anonymous visitor UUID (unless `visitorId` is passed) |
248
- | `aid_pos` | Dragged launcher offset `{x, y}` from its corner |
249
- | `aid_mode` | Last selected mode slug |
250
- | `aid_prefs` | Visitor's settings `{lang, scheme}` |
251
- | `aid_sidebar` | `collapsed` / `expanded` |
252
- | `aid_intro_ack` | `1` once the intro notice was acknowledged |
245
+ | `localStorage` key | Value |
246
+ | ------------------ | ------------------------------------------------------- |
247
+ | `aid_visitor` | Visitor id signed by the backend (`<uuid>:<signature>`) |
248
+ | `aid_pos` | Dragged launcher offset `{x, y}` from its corner |
249
+ | `aid_mode` | Last selected mode slug |
250
+ | `aid_prefs` | Visitor's settings `{lang, scheme}` |
251
+ | `aid_sidebar` | `collapsed` / `expanded` |
252
+ | `aid_intro_ack` | `1` once the intro notice was acknowledged |
253
253
 
254
254
  No cookies are used. With blocked storage (sandboxed iframe, strict private mode) the widget works with a per-load
255
255
  visitor and forgets the position.