@alxxsck/ai-assistant 2.18.0 → 2.21.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 (32) hide show
  1. package/README.md +34 -7
  2. package/dist/App.d.ts +2 -0
  3. package/dist/{Avatar-DNRiUnuW.js → Avatar-CI9_caGl.js} +1 -1
  4. package/dist/{ChatWidgetContent-CWarBHsS.js → ChatWidgetContent-CBWyqiVF.js} +1873 -1700
  5. package/dist/api/messages.api.d.ts +11 -5
  6. package/dist/api/messages.api.types.d.ts +4 -0
  7. package/dist/bridge-ai-chat-widget.es.js +1 -1
  8. package/dist/context/ChatWidgetContext.d.ts +3 -0
  9. package/dist/domain/command/CommandRuntime.d.ts +26 -3
  10. package/dist/domain/command/command.types.d.ts +6 -0
  11. package/dist/domain/message/cable/CableContext.d.ts +2 -0
  12. package/dist/domain/message/cable/widget-frame.d.ts +1 -1
  13. package/dist/domain/message/chat-experience.d.ts +0 -9
  14. package/dist/domain/message/message.store.d.ts +18 -9
  15. package/dist/domain/message/typing/end-user-typing.client.d.ts +38 -0
  16. package/dist/domain/scenario-interaction/ScenarioInteractionCollector.d.ts +91 -0
  17. package/dist/domain/scenario-interaction/ScenarioInteractionRuntime.d.ts +28 -0
  18. package/dist/domain/scenario-interaction/SurfaceController.d.ts +13 -0
  19. package/dist/domain/scenario-interaction/presentation-observer.d.ts +12 -0
  20. package/dist/domain/scenario-interaction/scenario-interaction.context.d.ts +7 -0
  21. package/dist/domain/scenario-interaction/scenario-interaction.types.d.ts +84 -0
  22. package/dist/domain/scenario-interaction/useScenarioPresentation.d.ts +4 -0
  23. package/dist/domain/support-presentation/PresentationAvatarResolver.d.ts +2 -0
  24. package/dist/domain/support-presentation/support-presentation.reconciliation.d.ts +13 -0
  25. package/dist/domain/support-presentation/support-presentation.types.d.ts +15 -6
  26. package/dist/i18n/messages.d.ts +0 -1
  27. package/dist/{index-raaheNwM.js → index-o7DbTuwa.js} +7734 -5026
  28. package/dist/index.d.ts +1 -0
  29. package/dist/ui/components/ChatResponderIdentity.d.ts +2 -2
  30. package/dist/ui/components/PresentationAvatar.d.ts +4 -5
  31. package/dist/ui/hooks/usePresentedResponderPresentation.d.ts +10 -0
  32. package/package.json +1 -1
package/README.md CHANGED
@@ -135,17 +135,26 @@ const widget = new ChatWidgetInstance({
135
135
  No event subscription or listener cleanup is required. Parallel renewal signals
136
136
  are debounced, and replacing the session cancels a pending duplicate callback.
137
137
 
138
+ Scenario interaction observations never cross an `interactionSessionId`
139
+ boundary. A token replacement for the same session retries the same observation
140
+ IDs. Canonical renewal creates a new interaction session, so any unsent queue
141
+ owned by the previous session is discarded and sequencing starts again. This is
142
+ an intentional principal-isolation rule: old observations are never reauthenticated
143
+ with a new session token.
144
+
138
145
  ## Support identities and avatars
139
146
 
140
- Version 2.12.0 understands Support Presentations contract v1. Message bubbles use
141
- the immutable public author snapshot, while the header renders the backend-owned
142
- `responderPresentation`. Operator photos are resolved through short-lived,
147
+ Support Presentations contract v1 uses `responderPresentation` schema v2. Message
148
+ bubbles use the immutable public author snapshot, while the header renders this
149
+ backend-owned projection. Its `humanSupport` and `ai` fields are independent:
150
+ only a current Assignment can name an operator, while routing and ambiguous
151
+ assignments stay generic Support. Operator photos are resolved through short-lived,
143
152
  conversation-scoped grants; signed URLs stay in memory and are purged on session
144
153
  replacement, authorization loss, and `destroy()`.
145
154
 
146
155
  Integrations do not pass names, avatar URLs, CMS user IDs, or support status into
147
156
  the constructor. These values come from Lola Backend. Older backends still render
148
- with safe fallbacks, but exact historical photos and responder modes require CH-01
157
+ with safe fallbacks, but exact historical photos and responder presentation require CH-01
149
158
  contract v1. See [the support presentation guide](docs/support-presentations.ru.md)
150
159
  for the wire contract, fallback rules, and failure behavior.
151
160
 
@@ -219,16 +228,34 @@ const widget = new ChatWidgetInstance({
219
228
  handlers: {
220
229
  openPage: ({ route }) => productRouter.push(route),
221
230
  openModal: ({ modalName }) => productModals.open(modalName),
222
- highlight: ({ element, active }) => {
231
+ highlight: ({ element, active, reportActivation }) => {
223
232
  element?.classList.toggle("lola-highlight", active);
233
+ productHighlights.setAction(
234
+ element,
235
+ active
236
+ ? () => {
237
+ reportActivation();
238
+ productActions.openDeposit();
239
+ }
240
+ : null,
241
+ );
224
242
  },
225
243
  },
226
244
  });
227
245
  ```
228
246
 
247
+ `reportActivation()` is the authoritative signal that the product accepted the
248
+ user activation. Call it synchronously from the product-owned action handler,
249
+ before navigation can unmount the widget. It records the activation, not the
250
+ result of the product action. The attributed target remains observable until its
251
+ highlight is removed or replaced, including after the Scenario closes the chat.
252
+ The SDK observes target visibility, but never treats arbitrary host DOM clicks as
253
+ activation. Existing highlight handlers may ignore this callback.
254
+
229
255
  Page and modal targets arrive in canonical Lola command envelopes. The built-in
230
- element fallback resolves stable `[data-lola="..."]` attributes. CTA display,
231
- chat open/close, speech, voice conversations, and avatar animation stay internal.
256
+ element fallback resolves stable `[data-lola="..."]` attributes and reports only
257
+ visibility because it does not own the product action. CTA display, chat
258
+ open/close, speech, voice conversations, and avatar animation stay internal.
232
259
 
233
260
  Command lifecycle events are available as `command_received`,
234
261
  `command_succeeded`, `command_failed`, `command_expired`, and
package/dist/App.d.ts CHANGED
@@ -3,6 +3,7 @@ import type { ExternallyAvailableActions } from "./avatar/Avatar";
3
3
  import type { WidgetConfig } from "./index.types";
4
4
  import type { CustomerInteractionSession } from "./types";
5
5
  import type { CommandRuntime } from "./domain/command/CommandRuntime";
6
+ import type { ScenarioInteractionRuntime } from "./domain/scenario-interaction/ScenarioInteractionRuntime";
6
7
  export type AppApi = {
7
8
  onAvatarLoadStarted: () => {
8
9
  onAvatarReady: OnAvatarReady;
@@ -17,6 +18,7 @@ export type AppApi = {
17
18
  registerSetSession: (fn: ((session: CustomerInteractionSession) => void) | null) => void;
18
19
  registerSetLocale: (fn: ((locale: string) => void) | null) => void;
19
20
  commandRuntime: CommandRuntime;
21
+ scenarioInteractionRuntime: ScenarioInteractionRuntime;
20
22
  };
21
23
  type AppProps = {
22
24
  config: WidgetConfig;
@@ -1,4 +1,4 @@
1
- import { $ as $s } from "./index-raaheNwM.js";
1
+ import { a0 as $s } from "./index-o7DbTuwa.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) {