@moveo-ai/web-client 0.108.0 → 0.109.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 +164 -69
- package/dist/63.min.js +2 -0
- package/dist/{329.min.js.LICENSE.txt → 63.min.js.LICENSE.txt} +1 -1
- package/dist/752.min.js +2 -0
- package/dist/{147.min.js.LICENSE.txt → 752.min.js.LICENSE.txt} +1 -1
- package/dist/882.min.js +1 -1
- package/dist/882.min.js.LICENSE.txt +1 -1
- package/dist/929.min.js +1 -1
- package/dist/929.min.js.LICENSE.txt +1 -1
- package/dist/audio-client.min.js +1 -1
- package/dist/audio-client.min.js.LICENSE.txt +20 -10
- package/dist/iframe.min.js +1 -1
- package/dist/iframe.min.js.LICENSE.txt +24 -27
- package/dist/index.html +1 -7
- package/dist/preview/index.html +16 -14
- package/dist/preview-telnyx/index.html +79 -0
- package/dist/preview.css.min.js +1 -1
- package/dist/preview.css.min.js.LICENSE.txt +1 -1
- package/dist/telnyx-client.min.js +1 -1
- package/dist/telnyx-client.min.js.LICENSE.txt +20 -10
- package/dist/web-client.min.js +1 -1
- package/dist/web-client.min.js.LICENSE.txt +1 -1
- package/dist/webrtc-client.min.js +1 -1
- package/dist/webrtc-client.min.js.LICENSE.txt +20 -10
- package/package.json +108 -99
- package/web-client.d.ts +152 -0
- package/dist/147.min.js +0 -2
- package/dist/147.min.js.map +0 -1
- package/dist/329.min.js +0 -2
- package/dist/329.min.js.map +0 -1
- package/dist/882.min.js.map +0 -1
- package/dist/929.min.js.map +0 -1
- package/dist/954.min.js +0 -2
- package/dist/954.min.js.LICENSE.txt +0 -6
- package/dist/954.min.js.map +0 -1
- package/dist/audio-client.min.js.map +0 -1
- package/dist/iframe.min.js.map +0 -1
- package/dist/iframe.v2.min.js +0 -2
- package/dist/iframe.v2.min.js.LICENSE.txt +0 -63
- package/dist/iframe.v2.min.js.map +0 -1
- package/dist/preview.css.min.js.map +0 -1
- package/dist/telnyx-client.min.js.map +0 -1
- package/dist/web-client.min.js.map +0 -1
- package/dist/webrtc-client.min.js.map +0 -1
package/README.md
CHANGED
|
@@ -14,7 +14,7 @@ Embeddable chat widget for integrating [Moveo.ai](https://moveo.ai) AI Agents in
|
|
|
14
14
|
|
|
15
15
|
- Real-time chat with AI Agents
|
|
16
16
|
- Customizable appearance and theming
|
|
17
|
-
- Multi-language support (
|
|
17
|
+
- Multi-language support (26 locales)
|
|
18
18
|
- File upload and media sharing
|
|
19
19
|
- Mobile-responsive design
|
|
20
20
|
- Secure iframe-based isolation
|
|
@@ -28,7 +28,7 @@ Embeddable chat widget for integrating [Moveo.ai](https://moveo.ai) AI Agents in
|
|
|
28
28
|
- [Configuration](#configuration)
|
|
29
29
|
- [TypeScript Support](#typescript-support)
|
|
30
30
|
- [Browser Support](#browser-support)
|
|
31
|
-
- [
|
|
31
|
+
- [Contributing](#contributing)
|
|
32
32
|
- [License](#license)
|
|
33
33
|
|
|
34
34
|
## Quick Start
|
|
@@ -58,12 +58,12 @@ npm install @moveo-ai/web-client
|
|
|
58
58
|
```
|
|
59
59
|
|
|
60
60
|
```typescript
|
|
61
|
-
import
|
|
61
|
+
import { init } from '@moveo-ai/web-client';
|
|
62
62
|
|
|
63
|
-
|
|
63
|
+
init({ integrationId: 'YOUR_INTEGRATION_ID' });
|
|
64
64
|
```
|
|
65
65
|
|
|
66
|
-
**Requirements:** Node.js
|
|
66
|
+
**Requirements:** Node.js 20+
|
|
67
67
|
|
|
68
68
|
## Usage
|
|
69
69
|
|
|
@@ -88,68 +88,168 @@ MoveoAI.init({ integrationId: 'YOUR_INTEGRATION_ID' });
|
|
|
88
88
|
</html>
|
|
89
89
|
```
|
|
90
90
|
|
|
91
|
-
###
|
|
91
|
+
### Programmatic Control
|
|
92
|
+
|
|
93
|
+
`init` resolves to a `WidgetController` once the widget is ready:
|
|
92
94
|
|
|
93
95
|
```javascript
|
|
94
|
-
MoveoAI.init({
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
96
|
+
MoveoAI.init({ integrationId: 'YOUR_INTEGRATION_ID' }).then((controller) => {
|
|
97
|
+
// Open the chat window
|
|
98
|
+
controller.openWindow();
|
|
99
|
+
|
|
100
|
+
// Close the chat window
|
|
101
|
+
controller.closeWindow();
|
|
102
|
+
|
|
103
|
+
// Send a message programmatically
|
|
104
|
+
controller.sendMessage({ text: 'Hello!' });
|
|
105
|
+
|
|
106
|
+
// Update the conversation context
|
|
107
|
+
controller.updateContext({ custom_field: 'custom_value' });
|
|
108
|
+
|
|
109
|
+
// Destroy the widget
|
|
110
|
+
controller.destroy();
|
|
102
111
|
});
|
|
103
112
|
```
|
|
104
113
|
|
|
105
|
-
###
|
|
114
|
+
### More examples
|
|
115
|
+
|
|
116
|
+
<details>
|
|
117
|
+
<summary>Check analytics events during development</summary>
|
|
118
|
+
|
|
119
|
+
Log every event the widget tracks to verify your integration before wiring it
|
|
120
|
+
into an analytics tool:
|
|
106
121
|
|
|
107
122
|
```javascript
|
|
108
|
-
|
|
123
|
+
MoveoAI.init({ integrationId: 'YOUR_INTEGRATION_ID' }).then((controller) => {
|
|
124
|
+
controller.onAnalyticsEvent(({ timestamp, event, session_id, properties }) => {
|
|
125
|
+
console.debug('[moveo]', timestamp, event, session_id, properties);
|
|
126
|
+
});
|
|
127
|
+
});
|
|
128
|
+
```
|
|
109
129
|
|
|
110
|
-
|
|
111
|
-
controller.open();
|
|
130
|
+
</details>
|
|
112
131
|
|
|
113
|
-
|
|
114
|
-
|
|
132
|
+
<details>
|
|
133
|
+
<summary>Identify a logged-in user and open the chat</summary>
|
|
115
134
|
|
|
116
|
-
|
|
117
|
-
|
|
135
|
+
```javascript
|
|
136
|
+
MoveoAI.init({ integrationId: 'YOUR_INTEGRATION_ID' }).then((controller) => {
|
|
137
|
+
controller.updateContext({
|
|
138
|
+
user: { display_name: 'Jane Doe', email: 'jane@example.com' },
|
|
139
|
+
tags: ['premium'],
|
|
140
|
+
plan: 'business', // any other key becomes a context variable
|
|
141
|
+
});
|
|
142
|
+
|
|
143
|
+
document.querySelector('#help-button').addEventListener('click', () => {
|
|
144
|
+
controller.openWindow();
|
|
145
|
+
});
|
|
146
|
+
});
|
|
147
|
+
```
|
|
118
148
|
|
|
119
|
-
|
|
120
|
-
controller.sendMessage('Hello!');
|
|
149
|
+
</details>
|
|
121
150
|
|
|
122
|
-
|
|
123
|
-
|
|
151
|
+
<details>
|
|
152
|
+
<summary>Mirror the unread indicator in your own UI</summary>
|
|
124
153
|
|
|
125
|
-
|
|
126
|
-
|
|
154
|
+
```javascript
|
|
155
|
+
MoveoAI.init({ integrationId: 'YOUR_INTEGRATION_ID' }).then((controller) => {
|
|
156
|
+
const badge = document.querySelector('#chat-badge');
|
|
157
|
+
|
|
158
|
+
controller.onUnreadMessages(() => badge.classList.add('visible'));
|
|
159
|
+
controller.onNoUnreadMessages(() => badge.classList.remove('visible'));
|
|
160
|
+
});
|
|
127
161
|
```
|
|
128
162
|
|
|
163
|
+
</details>
|
|
164
|
+
|
|
129
165
|
## API Reference
|
|
130
166
|
|
|
131
167
|
### MoveoAI.init(config)
|
|
132
168
|
|
|
133
169
|
Initializes the chat widget.
|
|
134
170
|
|
|
135
|
-
| Parameter | Type
|
|
136
|
-
| --------------- |
|
|
137
|
-
| `integrationId` | `string`
|
|
138
|
-
| `
|
|
139
|
-
| `
|
|
171
|
+
| Parameter | Type | Required | Description |
|
|
172
|
+
| --------------- | ----------------------- | -------- | -------------------------------------------------------- |
|
|
173
|
+
| `integrationId` | `string` | Yes | Your Moveo.ai integration ID |
|
|
174
|
+
| `host` | `string` | No | Regional channels host, when it differs from the default |
|
|
175
|
+
| `element` | `HTMLElement \| string` | No | Embed target, required for the `embed` widget position |
|
|
176
|
+
| `identityToken` | `string` | No | Signed token that verifies the user's identity on the session |
|
|
177
|
+
| `voiceIntegrationId` | `string` | No | Voice pairing override for the in-widget call |
|
|
178
|
+
| `variant` | `'default' \| 'nbg' \| 'alpha' \| 'fiserv'` | No | Visual variant |
|
|
179
|
+
|
|
180
|
+
Any other key passes through as a widget-config override for the loaded integration.
|
|
140
181
|
|
|
141
|
-
**Returns:** `WidgetController
|
|
182
|
+
**Returns:** `Promise<WidgetController>` - resolves once the widget is ready
|
|
142
183
|
|
|
143
184
|
### WidgetController Methods
|
|
144
185
|
|
|
145
|
-
| Method
|
|
146
|
-
|
|
|
147
|
-
| `
|
|
148
|
-
| `
|
|
149
|
-
| `
|
|
150
|
-
| `sendMessage(text
|
|
151
|
-
| `
|
|
152
|
-
| `
|
|
186
|
+
| Method | Description |
|
|
187
|
+
| ------------------------------- | ------------------------------------------------------ |
|
|
188
|
+
| `openWindow()` | Opens the chat window |
|
|
189
|
+
| `closeWindow()` | Closes the chat window |
|
|
190
|
+
| `closeConversation({ hide })` | Ends the conversation; the widget hides unless `hide: false` |
|
|
191
|
+
| `sendMessage({ text })` | Sends a message to the agent |
|
|
192
|
+
| `showTeaserMessage(message?)` | Shows the teaser bubble |
|
|
193
|
+
| `updateContext(ctx)` | Updates the conversation context |
|
|
194
|
+
| `setCSSVariables(vars)` | Overrides widget CSS variables |
|
|
195
|
+
| `setLocale(locale)` | Switches the widget language |
|
|
196
|
+
| `destroy()` | Removes the widget from the page |
|
|
197
|
+
|
|
198
|
+
### WidgetController Events
|
|
199
|
+
|
|
200
|
+
Register a callback per event. Every callback returns nothing and receives the
|
|
201
|
+
payload listed below.
|
|
202
|
+
|
|
203
|
+
| Method | Fires when | Payload |
|
|
204
|
+
| ----------------------------- | ---------------------------------------------- | ---------------------------------------------------- |
|
|
205
|
+
| `onSessionCreated(cb)` | A new session opens | `{ user_id, session_id, display_name }` |
|
|
206
|
+
| `onSessionReconnected(cb)` | An existing session reconnects | `{ user_id, session_id, display_name }` |
|
|
207
|
+
| `onSessionClosed(cb)` | The session closes | — |
|
|
208
|
+
| `onConversationClosed(cb)` | The user ends the conversation | — |
|
|
209
|
+
| `onWebchatOpened(cb)` | The user opens the widget | `{ isFull, is_mobile? }` |
|
|
210
|
+
| `onWebchatClosed(cb)` | The user closes the widget | `{ isFull }` |
|
|
211
|
+
| `onLinkClicked(cb)` | The user clicks a link inside the chat | `{ url }` |
|
|
212
|
+
| `onUnreadMessages(cb)` | Unread messages exist while the widget is shut | — |
|
|
213
|
+
| `onNoUnreadMessages(cb)` | The unread indicator clears | — |
|
|
214
|
+
| `onUserActivity(cb)` | The visitor interacts with the widget | — |
|
|
215
|
+
| `onMemberLeave(cb)` | An agent leaves the conversation | — |
|
|
216
|
+
| `onAnalyticsEvent(cb)` | Any interaction event (see below) | `{ timestamp, event, session_id?, properties }` |
|
|
217
|
+
|
|
218
|
+
`onAnalyticsEvent` receives every interaction the widget tracks, identified by
|
|
219
|
+
the `event` field: `session_start`, `session_end`, `message_sent` (the user sent
|
|
220
|
+
a message — never carries the text), `launcher_clicked`, `rating_submitted`, and
|
|
221
|
+
the rest of the `AnalyticsEvent` enum in `src/hooks/useAnalytics.ts`.
|
|
222
|
+
|
|
223
|
+
### Forward widget events into your analytics
|
|
224
|
+
|
|
225
|
+
The widget never writes into your analytics tools. If you want chat activity in
|
|
226
|
+
them, forward the events above from your own page — you control what is sent
|
|
227
|
+
and where. With Quantum Metric, for example:
|
|
228
|
+
|
|
229
|
+
```javascript
|
|
230
|
+
MoveoAI.init({ integrationId: 'YOUR_INTEGRATION_ID' }).then((controller) => {
|
|
231
|
+
// Event ids must exist in your Quantum Metric configuration first:
|
|
232
|
+
// sendEvent() silently drops ids that are not defined for the page.
|
|
233
|
+
const QM_MOVEO_SESSION = 901; // example ids — define your own
|
|
234
|
+
const QM_MOVEO_MESSAGE = 902;
|
|
235
|
+
|
|
236
|
+
controller.onSessionCreated(({ session_id }) => {
|
|
237
|
+
// The Moveo session id becomes searchable on the QM session,
|
|
238
|
+
// joining every replay to its Moveo conversation.
|
|
239
|
+
window.QuantumMetricAPI?.sendEvent(QM_MOVEO_SESSION, 0, session_id);
|
|
240
|
+
});
|
|
241
|
+
|
|
242
|
+
controller.onAnalyticsEvent(({ event, session_id }) => {
|
|
243
|
+
if (event === 'message_sent') {
|
|
244
|
+
window.QuantumMetricAPI?.sendEvent(QM_MOVEO_MESSAGE, 0, session_id);
|
|
245
|
+
}
|
|
246
|
+
});
|
|
247
|
+
});
|
|
248
|
+
```
|
|
249
|
+
|
|
250
|
+
The same pattern works for Tealium (`utag.link(...)`), Google Tag Manager
|
|
251
|
+
(`dataLayer.push(...)`), or any library already on your page. Note that Quantum
|
|
252
|
+
Metric rate-limits `sendEvent` to 50 calls per 200 ms.
|
|
153
253
|
|
|
154
254
|
## Configuration
|
|
155
255
|
|
|
@@ -178,7 +278,7 @@ MoveoAI.init({
|
|
|
178
278
|
|
|
179
279
|
### Supported Languages
|
|
180
280
|
|
|
181
|
-
The widget supports
|
|
281
|
+
The widget supports 26 locales including: English, Spanish, French, German, Italian, Portuguese, Dutch, Greek, Arabic, Hebrew, and more.
|
|
182
282
|
|
|
183
283
|
```javascript
|
|
184
284
|
MoveoAI.init({
|
|
@@ -189,44 +289,39 @@ MoveoAI.init({
|
|
|
189
289
|
|
|
190
290
|
## TypeScript Support
|
|
191
291
|
|
|
192
|
-
|
|
292
|
+
The package ships type declarations for the documented API surface
|
|
293
|
+
(`web-client.d.ts`):
|
|
193
294
|
|
|
194
295
|
```typescript
|
|
195
|
-
import
|
|
296
|
+
import { init, UserConfig, WidgetController } from '@moveo-ai/web-client';
|
|
196
297
|
|
|
197
|
-
const config:
|
|
198
|
-
|
|
199
|
-
context: {
|
|
200
|
-
user_id: 'user-123',
|
|
201
|
-
},
|
|
202
|
-
};
|
|
298
|
+
const config: UserConfig = { integrationId: 'YOUR_INTEGRATION_ID' };
|
|
299
|
+
const controller: WidgetController = await init(config);
|
|
203
300
|
|
|
204
|
-
|
|
301
|
+
controller.onSessionCreated(({ session_id }) => {
|
|
302
|
+
console.log('session', session_id);
|
|
303
|
+
});
|
|
205
304
|
```
|
|
206
305
|
|
|
207
306
|
## Browser Support
|
|
208
307
|
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
- Edge (latest)
|
|
213
|
-
- Mobile browsers (iOS Safari, Android Chrome)
|
|
308
|
+
The widget ships ES2020 and targets the browsers resolved from
|
|
309
|
+
`.browserslistrc` (`defaults`, excluding IE 11, dead browsers, Opera Mini and
|
|
310
|
+
KaiOS 2.5). In practice:
|
|
214
311
|
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
The dev server runs on HTTPS. To avoid browser security warnings, generate locally-trusted certificates:
|
|
220
|
-
|
|
221
|
-
```bash
|
|
222
|
-
npm run setup:certs
|
|
223
|
-
```
|
|
312
|
+
- Chrome, Edge, Firefox, Safari: current and recent versions
|
|
313
|
+
- iOS Safari and Android Chrome: current and recent versions
|
|
314
|
+
- Opera Mini and KaiOS 2.5 are not supported; they cannot run the bundle
|
|
224
315
|
|
|
225
|
-
|
|
316
|
+
Run `npx browserslist` to print the exact resolved list for the current
|
|
317
|
+
`caniuse-lite` data.
|
|
226
318
|
|
|
227
|
-
|
|
319
|
+
## Contributing
|
|
228
320
|
|
|
229
|
-
|
|
321
|
+
Development setup, commands, architecture notes and the full development
|
|
322
|
+
documentation index live in
|
|
323
|
+
[CONTRIBUTING.md](https://github.com/moveo-ai/web-client/blob/main/CONTRIBUTING.md)
|
|
324
|
+
in the GitHub repository.
|
|
230
325
|
|
|
231
326
|
## Support
|
|
232
327
|
|