@vettvangur/ai-sdk 0.9.0 → 0.10.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/README.md +23 -0
- package/dist/index.js +2 -2021
- package/dist/live-chat/livechat.js +1 -533
- package/dist/live-chat/omnichannel.js +1 -293
- package/dist/livechat.js +534 -0
- package/dist/mount.d.ts +22 -0
- package/dist/mount.js +56 -0
- package/dist/omnichannel.js +294 -0
- package/dist/window.js +2022 -0
- package/package.json +5 -1
package/README.md
CHANGED
|
@@ -241,6 +241,29 @@ import { liveChatFromRoot } from '@vettvangur/ai-sdk/live-chat/aichat'
|
|
|
241
241
|
const chat = bindChat(root, { liveChat: liveChatFromRoot })
|
|
242
242
|
```
|
|
243
243
|
|
|
244
|
+
## Mounting
|
|
245
|
+
|
|
246
|
+
`@vettvangur/ai-sdk/mount` binds a shell the way most hosts would, from its markup alone.
|
|
247
|
+
`mountAiChat(root, options)` binds `root`, or the first `[data-ai-chat]` in the document, once:
|
|
248
|
+
asked again for the same root, it returns the same binding, so a page chat and a launcher can both
|
|
249
|
+
ask for it. A root that is also `vv-ai-chat--window` gets `bindChatWindow` and the document's
|
|
250
|
+
`data-ai-launcher-teaser` through `bindLauncherTeaser`. `options` are `bindChat`'s, and a person
|
|
251
|
+
answers through `liveChatFromAttributes` unless they name a `liveChat`:
|
|
252
|
+
|
|
253
|
+
| Attributes on the root | Provider |
|
|
254
|
+
| --- | --- |
|
|
255
|
+
| `data-ai-chat-omnichannel-org-id`, `-org-url`, `-widget-id` | Omnichannel |
|
|
256
|
+
| `data-ai-chat-livechat-organization-id`, `-client-id`, optional `-group-id` | LiveChat |
|
|
257
|
+
| `data-ai-chat-live-endpoint` | The AiChat Live desk, as `liveChatFromRoot` |
|
|
258
|
+
|
|
259
|
+
```ts
|
|
260
|
+
import { createAiChatRegistry } from '@vettvangur/ai-sdk'
|
|
261
|
+
import { mountAiChat } from '@vettvangur/ai-sdk/mount'
|
|
262
|
+
|
|
263
|
+
const registry = createAiChatRegistry()
|
|
264
|
+
const chat = mountAiChat(null, { registry })
|
|
265
|
+
```
|
|
266
|
+
|
|
244
267
|
## Surfaces
|
|
245
268
|
|
|
246
269
|
`createTemplateItemSurface({ template, attribute, key })` shows one item from an authored list
|