@alxxsck/ai-assistant 2.5.1 → 2.7.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 +33 -2
- package/dist/App.d.ts +1 -0
- package/dist/{Avatar-DklBomzT.js → Avatar-BBTR5vL8.js} +1 -1
- package/dist/{ChatWidgetContent-DbOTIErq.js → ChatWidgetContent-Dhn8opnF.js} +2474 -2136
- package/dist/api/messages.api.d.ts +6 -5
- package/dist/avatar/publicAnimations.d.ts +1 -1
- package/dist/bridge-ai-chat-widget.es.js +5 -4
- package/dist/domain/message/message.store.d.ts +14 -1
- package/dist/domain/voice/voice.store.d.ts +2 -0
- package/dist/i18n/I18nProvider.d.ts +4 -0
- package/dist/i18n/i18n-context.d.ts +9 -0
- package/dist/i18n/i18n.d.ts +3 -0
- package/dist/i18n/messages.d.ts +101 -0
- package/dist/i18n/useI18n.d.ts +2 -0
- package/dist/{index-D9W50u8W.js → index-Cyv8CKEt.js} +4834 -3380
- package/dist/index.d.ts +4 -0
- package/dist/index.types.d.ts +2 -0
- package/dist/ui/components/ChatPaginationSkeleton.d.ts +2 -0
- package/dist/ui/components/chat-list-timestamp.d.ts +2 -0
- package/dist/ui/error-messages.d.ts +15 -5
- package/dist/ui/hooks/useCursorPagination.d.ts +15 -0
- package/dist/ui/hooks/usePinnedAutoScroll.d.ts +2 -1
- package/dist/ui/hooks/usePrependScrollAnchor.d.ts +13 -0
- package/package.json +3 -1
package/README.md
CHANGED
|
@@ -41,6 +41,7 @@ const widget = new ChatWidgetInstance({
|
|
|
41
41
|
interactionSessionId: session.interactionSessionId,
|
|
42
42
|
expiresAt: session.expiresAt,
|
|
43
43
|
},
|
|
44
|
+
locale: productLocale,
|
|
44
45
|
onRenewSession: async () => {
|
|
45
46
|
const nextSession = await productApi.createLolaInteractionSession();
|
|
46
47
|
widget.setCustomerInteractionSession(nextSession);
|
|
@@ -77,6 +78,7 @@ The supported instance methods are:
|
|
|
77
78
|
|
|
78
79
|
```ts
|
|
79
80
|
widget.setOpen(true);
|
|
81
|
+
widget.setLocale(productLocale);
|
|
80
82
|
widget.setCustomerInteractionSession(nextSession);
|
|
81
83
|
await widget.track({ event: "Game Opened", params: { gameId: "42" } });
|
|
82
84
|
widget.destroy();
|
|
@@ -87,6 +89,35 @@ latest requested state is applied when the UI is ready. Session replacement upda
|
|
|
87
89
|
authenticated HTTP, realtime, message, voice, and command dependencies without
|
|
88
90
|
recreating the public widget instance.
|
|
89
91
|
|
|
92
|
+
## Localization
|
|
93
|
+
|
|
94
|
+
Pass the product's current locale directly to the widget. English is used when
|
|
95
|
+
`locale` is omitted, empty, invalid, or unsupported:
|
|
96
|
+
|
|
97
|
+
```ts
|
|
98
|
+
const widget = new ChatWidgetInstance({
|
|
99
|
+
customerInteractionSession: session,
|
|
100
|
+
locale: productLocale, // for example "es-MX" or "pt-BR"
|
|
101
|
+
});
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
When the product language changes, update the mounted widget in place:
|
|
105
|
+
|
|
106
|
+
```ts
|
|
107
|
+
widget.setLocale(nextProductLocale);
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
Regional tags are normalized to a supported base language. The widget currently
|
|
111
|
+
ships `ru`, `uz`, `en`, `it`, `es`, `de`, `fr`, `pl`, `pt`, `bn`, `sw`, `so`,
|
|
112
|
+
and `ar`; Arabic automatically enables right-to-left layout. Updating the locale
|
|
113
|
+
preserves the open route, messages, draft, active conversation, voice state, and
|
|
114
|
+
CTA state, and does not reconnect transports.
|
|
115
|
+
|
|
116
|
+
The locale controls only text owned by the widget. Assistant and backend content
|
|
117
|
+
is displayed as received; the assistant's response language follows the user's
|
|
118
|
+
messages. See [the localization guide](docs/localization.ru.md) for the complete
|
|
119
|
+
integration contract.
|
|
120
|
+
|
|
90
121
|
The widget calls `onRenewSession` before expiry and after supported authentication
|
|
91
122
|
failures. Refresh through the product backend and replace the session in the
|
|
92
123
|
callback:
|
|
@@ -171,12 +202,12 @@ surface. Remove these constructor properties from integrations:
|
|
|
171
202
|
|
|
172
203
|
- `mountElementId`, `agentId`, `customerId`, `configName`
|
|
173
204
|
- `apiUrl`, `wsUrl`
|
|
174
|
-
- `AIAvatar`, `background`, `footer`, `voiceEnabled`, `voiceConfig
|
|
205
|
+
- `AIAvatar`, `background`, `footer`, `voiceEnabled`, `voiceConfig`
|
|
175
206
|
- `manualOpen`, `avatarDebug`, `uiTargets`, `commandHandlers`
|
|
176
207
|
|
|
177
208
|
Replace `manualOpen` with `hideOpenButton: true` only when the standard launcher
|
|
178
209
|
must be hidden. Remove calls to `playAnimation`, `executeReaction`,
|
|
179
|
-
`sendServiceMessage`, `
|
|
210
|
+
`sendServiceMessage`, `registerUiTarget`, and
|
|
180
211
|
`registerCommandHandler`. Backend commands retain the supported assistant
|
|
181
212
|
behaviour internally.
|
|
182
213
|
|
package/dist/App.d.ts
CHANGED
|
@@ -15,6 +15,7 @@ export type AppApi = {
|
|
|
15
15
|
registerSetOpen: (fn: ((open: boolean) => void) | null) => void;
|
|
16
16
|
resolveAssetPath: (path: string) => string;
|
|
17
17
|
registerSetSession: (fn: ((session: CustomerInteractionSession) => void) | null) => void;
|
|
18
|
+
registerSetLocale: (fn: ((locale: string) => void) | null) => void;
|
|
18
19
|
commandRuntime: CommandRuntime;
|
|
19
20
|
};
|
|
20
21
|
type AppProps = {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { I as $s } from "./index-Cyv8CKEt.js";
|
|
2
2
|
var Fr = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
|
|
3
3
|
const Ul = "182", Hf = 0, bc = 1, Wf = 2, js = 1, Ku = 2, Gr = 3, di = 0, jt = 1, Zn = 2, $n = 0, ur = 1, Ac = 2, Ec = 3, wc = 4, Xf = 5, Ci = 100, qf = 101, Yf = 102, Kf = 103, Zf = 104, $f = 200, jf = 201, Jf = 202, Qf = 203, wo = 204, Ro = 205, ed = 206, td = 207, nd = 208, id = 209, rd = 210, sd = 211, ad = 212, od = 213, ld = 214, Co = 0, Po = 1, Io = 2, dr = 3, Do = 4, Lo = 5, Fo = 6, Uo = 7, xa = 0, cd = 1, ud = 2, Un = 0, Zu = 1, $u = 2, ju = 3, Ju = 4, Qu = 5, eh = 6, th = 7, Rc = "attached", hd = "detached", nh = 300, Oi = 301, pr = 302, aa = 303, No = 304, ya = 306, wt = 1e3, En = 1001, Oo = 1002, Lt = 1003, fd = 1004, Ss = 1005, kt = 1006, La = 1007, Ii = 1008, sn = 1009, ih = 1010, rh = 1011, ts = 1012, Nl = 1013, Bn = 1014, wn = 1015, Jn = 1016, Ol = 1017, Bl = 1018, ns = 1020, sh = 35902, ah = 35899, oh = 1021, lh = 1022, mn = 1023, Qn = 1026, Di = 1027, ch = 1028, kl = 1029, mr = 1030, Vl = 1031, zl = 1033, Js = 33776, Qs = 33777, ea = 33778, ta = 33779, Bo = 35840, ko = 35841, Vo = 35842, zo = 35843, Go = 36196, Ho = 37492, Wo = 37496, Xo = 37488, qo = 37489, Yo = 37490, Ko = 37491, Zo = 37808, $o = 37809, jo = 37810, Jo = 37811, Qo = 37812, el = 37813, tl = 37814, nl = 37815, il = 37816, rl = 37817, sl = 37818, al = 37819, ol = 37820, ll = 37821, cl = 36492, ul = 36494, hl = 36495, fl = 36283, dl = 36284, pl = 36285, ml = 36286, uh = 2200, dd = 2201, pd = 2202, oa = 2300, _l = 2301, Fa = 2302, sr = 2400, ar = 2401, la = 2402, Gl = 2500, md = 2501, _d = 3200, Sa = 0, gd = 1, ci = "", Ue = "srgb", _r = "srgb-linear", ca = "linear", nt = "srgb", Gi = 7680, Cc = 519, vd = 512, xd = 513, yd = 514, Hl = 515, Sd = 516, Md = 517, Wl = 518, Td = 519, Pc = 35044, Ic = "300 es", Fn = 2e3, ua = 2001;
|
|
4
4
|
function hh(s) {
|