@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.
Files changed (44) hide show
  1. package/README.md +164 -69
  2. package/dist/63.min.js +2 -0
  3. package/dist/{329.min.js.LICENSE.txt → 63.min.js.LICENSE.txt} +1 -1
  4. package/dist/752.min.js +2 -0
  5. package/dist/{147.min.js.LICENSE.txt → 752.min.js.LICENSE.txt} +1 -1
  6. package/dist/882.min.js +1 -1
  7. package/dist/882.min.js.LICENSE.txt +1 -1
  8. package/dist/929.min.js +1 -1
  9. package/dist/929.min.js.LICENSE.txt +1 -1
  10. package/dist/audio-client.min.js +1 -1
  11. package/dist/audio-client.min.js.LICENSE.txt +20 -10
  12. package/dist/iframe.min.js +1 -1
  13. package/dist/iframe.min.js.LICENSE.txt +24 -27
  14. package/dist/index.html +1 -7
  15. package/dist/preview/index.html +16 -14
  16. package/dist/preview-telnyx/index.html +79 -0
  17. package/dist/preview.css.min.js +1 -1
  18. package/dist/preview.css.min.js.LICENSE.txt +1 -1
  19. package/dist/telnyx-client.min.js +1 -1
  20. package/dist/telnyx-client.min.js.LICENSE.txt +20 -10
  21. package/dist/web-client.min.js +1 -1
  22. package/dist/web-client.min.js.LICENSE.txt +1 -1
  23. package/dist/webrtc-client.min.js +1 -1
  24. package/dist/webrtc-client.min.js.LICENSE.txt +20 -10
  25. package/package.json +108 -99
  26. package/web-client.d.ts +152 -0
  27. package/dist/147.min.js +0 -2
  28. package/dist/147.min.js.map +0 -1
  29. package/dist/329.min.js +0 -2
  30. package/dist/329.min.js.map +0 -1
  31. package/dist/882.min.js.map +0 -1
  32. package/dist/929.min.js.map +0 -1
  33. package/dist/954.min.js +0 -2
  34. package/dist/954.min.js.LICENSE.txt +0 -6
  35. package/dist/954.min.js.map +0 -1
  36. package/dist/audio-client.min.js.map +0 -1
  37. package/dist/iframe.min.js.map +0 -1
  38. package/dist/iframe.v2.min.js +0 -2
  39. package/dist/iframe.v2.min.js.LICENSE.txt +0 -63
  40. package/dist/iframe.v2.min.js.map +0 -1
  41. package/dist/preview.css.min.js.map +0 -1
  42. package/dist/telnyx-client.min.js.map +0 -1
  43. package/dist/web-client.min.js.map +0 -1
  44. 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 (22 languages)
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
- - [Local Development](#local-development)
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 MoveoAI from '@moveo-ai/web-client';
61
+ import { init } from '@moveo-ai/web-client';
62
62
 
63
- MoveoAI.init({ integrationId: 'YOUR_INTEGRATION_ID' });
63
+ init({ integrationId: 'YOUR_INTEGRATION_ID' });
64
64
  ```
65
65
 
66
- **Requirements:** Node.js 18+
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
- ### With Configuration Options
91
+ ### Programmatic Control
92
+
93
+ `init` resolves to a `WidgetController` once the widget is ready:
92
94
 
93
95
  ```javascript
94
- MoveoAI.init({
95
- integrationId: 'YOUR_INTEGRATION_ID',
96
- context: {
97
- user_id: 'user-123',
98
- user_name: 'John Doe',
99
- user_email: 'john@example.com',
100
- },
101
- language: 'en',
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
- ### Programmatic Control
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
- const controller = MoveoAI.init({ integrationId: 'YOUR_INTEGRATION_ID' });
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
- // Open the chat widget
111
- controller.open();
130
+ </details>
112
131
 
113
- // Close the chat widget
114
- controller.close();
132
+ <details>
133
+ <summary>Identify a logged-in user and open the chat</summary>
115
134
 
116
- // Toggle the widget
117
- controller.toggle();
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
- // Send a message programmatically
120
- controller.sendMessage('Hello!');
149
+ </details>
121
150
 
122
- // Update context
123
- controller.updateContext({ user_id: 'new-user-456' });
151
+ <details>
152
+ <summary>Mirror the unread indicator in your own UI</summary>
124
153
 
125
- // Destroy the widget
126
- controller.destroy();
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 | Required | Description |
136
- | --------------- | -------- | -------- | ----------------------------------------- |
137
- | `integrationId` | `string` | Yes | Your Moveo.ai integration ID |
138
- | `context` | `object` | No | Custom context variables for the AI Agent |
139
- | `language` | `string` | No | Widget language (ISO 639-1 code) |
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` - Controller instance for programmatic control
182
+ **Returns:** `Promise<WidgetController>` - resolves once the widget is ready
142
183
 
143
184
  ### WidgetController Methods
144
185
 
145
- | Method | Description |
146
- | ---------------------------- | -------------------------------- |
147
- | `open()` | Opens the chat widget |
148
- | `close()` | Closes the chat widget |
149
- | `toggle()` | Toggles the widget open/closed |
150
- | `sendMessage(text: string)` | Sends a message to the agent |
151
- | `updateContext(ctx: object)` | Updates the conversation context |
152
- | `destroy()` | Removes the widget from the page |
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 22 languages including: English, Spanish, French, German, Italian, Portuguese, Dutch, Greek, Arabic, Hebrew, and more.
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
- Full TypeScript definitions are included:
292
+ The package ships type declarations for the documented API surface
293
+ (`web-client.d.ts`):
193
294
 
194
295
  ```typescript
195
- import MoveoAI, { WidgetController, WidgetConfig } from '@moveo-ai/web-client';
296
+ import { init, UserConfig, WidgetController } from '@moveo-ai/web-client';
196
297
 
197
- const config: WidgetConfig = {
198
- integrationId: 'YOUR_INTEGRATION_ID',
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
- const controller: WidgetController = MoveoAI.init(config);
301
+ controller.onSessionCreated(({ session_id }) => {
302
+ console.log('session', session_id);
303
+ });
205
304
  ```
206
305
 
207
306
  ## Browser Support
208
307
 
209
- - Chrome (latest)
210
- - Firefox (latest)
211
- - Safari (latest)
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
- ## Local Development
216
-
217
- ### HTTPS Setup
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
- This generates certificates in `.certs/` and attempts to install the CA into your system trust store (requires `sudo` on macOS/Linux). Restart your browser after running.
316
+ Run `npx browserslist` to print the exact resolved list for the current
317
+ `caniuse-lite` data.
226
318
 
227
- > **Firefox users:** Go to `about:preferences#privacy` → Certificates → View Certificates → Authorities → Import, and add `.certs/ca.crt`.
319
+ ## Contributing
228
320
 
229
- If the CA was not auto-installed, run the platform command printed by the script to add it manually.
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