@moveo-ai/web-client 0.109.0 → 0.110.0-true.2
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 +127 -37
- package/dist/63.min.js.LICENSE.txt +1 -1
- package/dist/752.min.js.LICENSE.txt +1 -1
- package/dist/882.min.js.LICENSE.txt +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 +1 -1
- package/dist/iframe.min.js +1 -1
- package/dist/iframe.min.js.LICENSE.txt +1 -1
- package/dist/index.html +2 -6
- package/dist/preview/index.html +2 -2
- package/dist/preview.css.min.js.LICENSE.txt +1 -1
- package/dist/public/locales/ar.json +37 -36
- package/dist/public/locales/bg.json +37 -36
- package/dist/public/locales/cs.json +37 -36
- package/dist/public/locales/da.json +37 -36
- package/dist/public/locales/de.json +37 -36
- package/dist/public/locales/el.json +70 -57
- package/dist/public/locales/en.json +37 -39
- package/dist/public/locales/es.json +71 -58
- package/dist/public/locales/fr.json +37 -36
- package/dist/public/locales/id.json +37 -36
- package/dist/public/locales/it.json +37 -36
- package/dist/public/locales/ja.json +37 -36
- package/dist/public/locales/me.json +37 -36
- package/dist/public/locales/nl-be.json +37 -36
- package/dist/public/locales/nl.json +37 -36
- package/dist/public/locales/pl.json +37 -36
- package/dist/public/locales/pt-br.json +63 -50
- package/dist/public/locales/pt.json +37 -36
- package/dist/public/locales/ro.json +37 -36
- package/dist/public/locales/ru.json +37 -36
- package/dist/public/locales/sq.json +37 -36
- package/dist/public/locales/sr.json +37 -36
- package/dist/public/locales/sv.json +37 -36
- package/dist/public/locales/tl.json +37 -36
- package/dist/public/locales/tr.json +37 -36
- package/dist/public/locales/zh.json +37 -36
- package/dist/telnyx-client.min.js +1 -1
- package/dist/telnyx-client.min.js.LICENSE.txt +1 -1
- 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 +1 -1
- package/package.json +8 -6
package/README.md
CHANGED
|
@@ -121,9 +121,11 @@ into an analytics tool:
|
|
|
121
121
|
|
|
122
122
|
```javascript
|
|
123
123
|
MoveoAI.init({ integrationId: 'YOUR_INTEGRATION_ID' }).then((controller) => {
|
|
124
|
-
controller.onAnalyticsEvent(
|
|
125
|
-
|
|
126
|
-
|
|
124
|
+
controller.onAnalyticsEvent(
|
|
125
|
+
({ timestamp, event, session_id, properties }) => {
|
|
126
|
+
console.debug('[moveo]', timestamp, event, session_id, properties);
|
|
127
|
+
}
|
|
128
|
+
);
|
|
127
129
|
});
|
|
128
130
|
```
|
|
129
131
|
|
|
@@ -168,14 +170,14 @@ MoveoAI.init({ integrationId: 'YOUR_INTEGRATION_ID' }).then((controller) => {
|
|
|
168
170
|
|
|
169
171
|
Initializes the chat widget.
|
|
170
172
|
|
|
171
|
-
| Parameter
|
|
172
|
-
|
|
|
173
|
-
| `integrationId`
|
|
174
|
-
| `host`
|
|
175
|
-
| `element`
|
|
176
|
-
| `identityToken`
|
|
177
|
-
| `voiceIntegrationId` | `string`
|
|
178
|
-
| `variant`
|
|
173
|
+
| Parameter | Type | Required | Description |
|
|
174
|
+
| -------------------- | ------------------------------------------- | -------- | ------------------------------------------------------------- |
|
|
175
|
+
| `integrationId` | `string` | Yes | Your Moveo.ai integration ID |
|
|
176
|
+
| `host` | `string` | No | Regional channels host, when it differs from the default |
|
|
177
|
+
| `element` | `HTMLElement \| string` | No | Embed target, required for the `embed` widget position |
|
|
178
|
+
| `identityToken` | `string` | No | Signed token that verifies the user's identity on the session |
|
|
179
|
+
| `voiceIntegrationId` | `string` | No | Voice pairing override for the in-widget call |
|
|
180
|
+
| `variant` | `'default' \| 'nbg' \| 'alpha' \| 'fiserv'` | No | Visual variant |
|
|
179
181
|
|
|
180
182
|
Any other key passes through as a widget-config override for the loaded integration.
|
|
181
183
|
|
|
@@ -183,43 +185,50 @@ Any other key passes through as a widget-config override for the loaded integrat
|
|
|
183
185
|
|
|
184
186
|
### WidgetController Methods
|
|
185
187
|
|
|
186
|
-
| Method
|
|
187
|
-
|
|
|
188
|
-
| `openWindow()`
|
|
189
|
-
| `closeWindow()`
|
|
190
|
-
| `closeConversation({ hide })`
|
|
191
|
-
| `sendMessage({ text })`
|
|
192
|
-
| `showTeaserMessage(message?)`
|
|
193
|
-
| `updateContext(ctx)`
|
|
194
|
-
| `setCSSVariables(vars)`
|
|
195
|
-
| `setLocale(locale)`
|
|
196
|
-
| `destroy()`
|
|
188
|
+
| Method | Description |
|
|
189
|
+
| ----------------------------- | ------------------------------------------------------------ |
|
|
190
|
+
| `openWindow()` | Opens the chat window |
|
|
191
|
+
| `closeWindow()` | Closes the chat window |
|
|
192
|
+
| `closeConversation({ hide })` | Ends the conversation; the widget hides unless `hide: false` |
|
|
193
|
+
| `sendMessage({ text })` | Sends a message to the agent |
|
|
194
|
+
| `showTeaserMessage(message?)` | Shows the teaser bubble |
|
|
195
|
+
| `updateContext(ctx)` | Updates the conversation context |
|
|
196
|
+
| `setCSSVariables(vars)` | Overrides widget CSS variables |
|
|
197
|
+
| `setLocale(locale)` | Switches the widget language |
|
|
198
|
+
| `destroy()` | Removes the widget from the page |
|
|
197
199
|
|
|
198
200
|
### WidgetController Events
|
|
199
201
|
|
|
200
202
|
Register a callback per event. Every callback returns nothing and receives the
|
|
201
203
|
payload listed below.
|
|
202
204
|
|
|
203
|
-
| Method
|
|
204
|
-
|
|
|
205
|
-
| `onSessionCreated(cb)`
|
|
206
|
-
| `onSessionReconnected(cb)`
|
|
207
|
-
| `onSessionClosed(cb)`
|
|
208
|
-
| `onConversationClosed(cb)`
|
|
209
|
-
| `onWebchatOpened(cb)`
|
|
210
|
-
| `onWebchatClosed(cb)`
|
|
211
|
-
| `onLinkClicked(cb)`
|
|
212
|
-
| `onUnreadMessages(cb)`
|
|
213
|
-
| `onNoUnreadMessages(cb)`
|
|
214
|
-
| `onUserActivity(cb)`
|
|
215
|
-
| `onMemberLeave(cb)`
|
|
216
|
-
| `onAnalyticsEvent(cb)`
|
|
205
|
+
| Method | Fires when | Payload |
|
|
206
|
+
| -------------------------- | ---------------------------------------------- | ----------------------------------------------- |
|
|
207
|
+
| `onSessionCreated(cb)` | A new session opens | `{ user_id, session_id, display_name }` |
|
|
208
|
+
| `onSessionReconnected(cb)` | An existing session reconnects | `{ user_id, session_id, display_name }` |
|
|
209
|
+
| `onSessionClosed(cb)` | The session closes | — |
|
|
210
|
+
| `onConversationClosed(cb)` | The user ends the conversation | — |
|
|
211
|
+
| `onWebchatOpened(cb)` | The user opens the widget | `{ isFull, is_mobile? }` |
|
|
212
|
+
| `onWebchatClosed(cb)` | The user closes the widget | `{ isFull }` |
|
|
213
|
+
| `onLinkClicked(cb)` | The user clicks a link inside the chat | `{ url }` |
|
|
214
|
+
| `onUnreadMessages(cb)` | Unread messages exist while the widget is shut | — |
|
|
215
|
+
| `onNoUnreadMessages(cb)` | The unread indicator clears | — |
|
|
216
|
+
| `onUserActivity(cb)` | The visitor interacts with the widget | — |
|
|
217
|
+
| `onMemberLeave(cb)` | An agent leaves the conversation | — |
|
|
218
|
+
| `onAnalyticsEvent(cb)` | The widget loads, and every interaction | `{ timestamp, event, session_id?, properties }` |
|
|
217
219
|
|
|
218
220
|
`onAnalyticsEvent` receives every interaction the widget tracks, identified by
|
|
219
221
|
the `event` field: `session_start`, `session_end`, `message_sent` (the user sent
|
|
220
222
|
a message — never carries the text), `launcher_clicked`, `rating_submitted`, and
|
|
221
223
|
the rest of the `AnalyticsEvent` enum in `src/hooks/useAnalytics.ts`.
|
|
222
224
|
|
|
225
|
+
It also receives one event that is not an interaction: **`widget_loaded`**,
|
|
226
|
+
raised as soon as the widget renders on the page. It carries no `session_id`,
|
|
227
|
+
because a session opens only when the visitor opens the chat. Register the
|
|
228
|
+
callback at any time — a callback added after the widget loaded still receives
|
|
229
|
+
`widget_loaded` on registration, so the event cannot be missed in the race
|
|
230
|
+
between `init()` resolving and your `.then()` running.
|
|
231
|
+
|
|
223
232
|
### Forward widget events into your analytics
|
|
224
233
|
|
|
225
234
|
The widget never writes into your analytics tools. If you want chat activity in
|
|
@@ -230,9 +239,17 @@ and where. With Quantum Metric, for example:
|
|
|
230
239
|
MoveoAI.init({ integrationId: 'YOUR_INTEGRATION_ID' }).then((controller) => {
|
|
231
240
|
// Event ids must exist in your Quantum Metric configuration first:
|
|
232
241
|
// sendEvent() silently drops ids that are not defined for the page.
|
|
233
|
-
const
|
|
242
|
+
const QM_MOVEO_LOADED = 900; // example ids — define your own
|
|
243
|
+
const QM_MOVEO_SESSION = 901;
|
|
234
244
|
const QM_MOVEO_MESSAGE = 902;
|
|
235
245
|
|
|
246
|
+
controller.onAnalyticsEvent(({ event }) => {
|
|
247
|
+
if (event === 'widget_loaded') {
|
|
248
|
+
// Fires on every page that carries the widget, with no visitor action.
|
|
249
|
+
window.QuantumMetricAPI?.sendEvent(QM_MOVEO_LOADED, 0, '');
|
|
250
|
+
}
|
|
251
|
+
});
|
|
252
|
+
|
|
236
253
|
controller.onSessionCreated(({ session_id }) => {
|
|
237
254
|
// The Moveo session id becomes searchable on the QM session,
|
|
238
255
|
// joining every replay to its Moveo conversation.
|
|
@@ -276,6 +293,79 @@ MoveoAI.init({
|
|
|
276
293
|
});
|
|
277
294
|
```
|
|
278
295
|
|
|
296
|
+
### CSS Variables
|
|
297
|
+
|
|
298
|
+
Pass any of these to `setCSSVariables()` to restyle the widget. Every value is
|
|
299
|
+
a plain CSS value, applied inside the widget iframe.
|
|
300
|
+
|
|
301
|
+
```javascript
|
|
302
|
+
const widget = await MoveoAI.init({ integrationId: 'YOUR_INTEGRATION_ID' });
|
|
303
|
+
|
|
304
|
+
widget.setCSSVariables({
|
|
305
|
+
'--moveo-border-radius-surface': '8px',
|
|
306
|
+
'--moveo-font-primary': "'Roboto', sans-serif",
|
|
307
|
+
});
|
|
308
|
+
```
|
|
309
|
+
|
|
310
|
+
| Variable | Default | Controls |
|
|
311
|
+
| ------------------------------- | ---------------------------- | -------------------------------------------------------------- |
|
|
312
|
+
| `--moveo-font-primary` | unset, see below | The widget font family |
|
|
313
|
+
| `--moveo-border-radius-surface` | `16px` | Corner radius of the chat panel, dialogs and the webview sheet |
|
|
314
|
+
| `--moveo-border-radius-base` | `5px` | Corner radius of inline media and the launcher teaser pill |
|
|
315
|
+
| `--moveo-header-height` | `68px` | Header height, and the offset every screen below it starts at |
|
|
316
|
+
| `--moveo-header-background` | from the theme | Header background; `theme_colors.header_color` sets it too |
|
|
317
|
+
| `--moveo-header-text-color` | from the theme | Header text and icon colour |
|
|
318
|
+
| `--moveo-shadow-bubble` | `0px 0px 10px 0px #10182824` | Launcher bubble shadow |
|
|
319
|
+
| `--moveo-loadingIcon-size` | `1rem` | Size of the loading spinner |
|
|
320
|
+
| `--moveo-modal-tall-height` | `min(600px, 100%)` | Height of a `tall` webview dialog; never exceeds the widget |
|
|
321
|
+
| `--moveo-modal-tall-width` | `min(400px, 100%)` | Width of a `tall` webview dialog; never exceeds the widget |
|
|
322
|
+
| `--moveo-expanded-chat-width` | `672px` | Panel width in the expanded layout |
|
|
323
|
+
| `--moveo-chat-width` | from the config | Panel width; the `chatWindow` config sets it |
|
|
324
|
+
| `--moveo-chat-height` | from the config | Panel height; the `chatWindow` config sets it |
|
|
325
|
+
| `--moveo-z-index` | `10022` | Stacking of the widget against your page. See below |
|
|
326
|
+
|
|
327
|
+
#### Fonts
|
|
328
|
+
|
|
329
|
+
`--moveo-font-primary` is unset by default. The widget then uses the font its
|
|
330
|
+
configuration loads — the `font_family` setting, or the font that ships with
|
|
331
|
+
your variant. Set the variable to override that, at any time and from either
|
|
332
|
+
`setCSSVariables()` or your own stylesheet. The widget never writes it back, so
|
|
333
|
+
your value survives a font that finishes loading later.
|
|
334
|
+
|
|
335
|
+
#### Stacking order
|
|
336
|
+
|
|
337
|
+
The widget renders in an iframe on your page, so its stacking is decided by
|
|
338
|
+
your document, not by anything inside the widget. Raise it above a header or a
|
|
339
|
+
cookie banner either from your own stylesheet:
|
|
340
|
+
|
|
341
|
+
```css
|
|
342
|
+
:root {
|
|
343
|
+
--moveo-z-index: 999999;
|
|
344
|
+
}
|
|
345
|
+
```
|
|
346
|
+
|
|
347
|
+
or through the API, which applies it to the iframe on your page:
|
|
348
|
+
|
|
349
|
+
```javascript
|
|
350
|
+
widget.setCSSVariables({ '--moveo-z-index': '999999' });
|
|
351
|
+
```
|
|
352
|
+
|
|
353
|
+
Every other variable in the table applies inside the widget iframe.
|
|
354
|
+
|
|
355
|
+
`--nbg-bg` also exists, for one account's variant styling. It is not part of
|
|
356
|
+
the supported surface.
|
|
357
|
+
|
|
358
|
+
Colours are better set through the integration's `theme_colors` config, which
|
|
359
|
+
drives the accent, background, border, text, launcher, rating, send-icon, link
|
|
360
|
+
and swimmlane colours for the light and dark themes.
|
|
361
|
+
|
|
362
|
+
#### Renamed variables
|
|
363
|
+
|
|
364
|
+
`--moveo-new-header-height` and `--moveo-new-border-radius-base` are the former
|
|
365
|
+
names of `--moveo-header-height` and `--moveo-border-radius-surface`. Setting
|
|
366
|
+
either still works, so existing integrations need no change, but use the names
|
|
367
|
+
in the table above.
|
|
368
|
+
|
|
279
369
|
### Supported Languages
|
|
280
370
|
|
|
281
371
|
The widget supports 26 locales including: English, Spanish, French, German, Italian, Portuguese, Dutch, Greek, Arabic, Hebrew, and more.
|