@alxxsck/ai-assistant 2.22.3 → 2.24.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 (41) hide show
  1. package/README.md +50 -12
  2. package/dist/App.d.ts +5 -0
  3. package/dist/{Avatar-QuPBAhUu.js → Avatar-C6dvOio6.js} +1 -1
  4. package/dist/ChatWidgetContent-BYZ7Qq06.js +8059 -0
  5. package/dist/api/chat-attachments.api.d.ts +36 -0
  6. package/dist/api/messages.api.d.ts +3 -1
  7. package/dist/api/messages.api.types.d.ts +14 -1
  8. package/dist/bridge-ai-chat-widget.es.js +3 -3
  9. package/dist/context/ChatWidgetContext.d.ts +12 -3
  10. package/dist/domain/command/CommandRuntime.d.ts +10 -4
  11. package/dist/domain/command/command.types.d.ts +12 -0
  12. package/dist/domain/compact-preview/CompactPreviewController.d.ts +123 -0
  13. package/dist/domain/message/cable/CableContext.d.ts +16 -1
  14. package/dist/domain/message/cable/widget-frame.d.ts +9 -0
  15. package/dist/domain/message/chat-experience.d.ts +16 -1
  16. package/dist/domain/message/message.store.d.ts +3 -2
  17. package/dist/domain/message/unread.d.ts +1 -0
  18. package/dist/domain/scenario/ScenarioChoiceSubmissionController.d.ts +49 -0
  19. package/dist/domain/scenario/scenario-choice.d.ts +6 -0
  20. package/dist/domain/scenario-interaction/ScenarioInteractionRuntime.d.ts +7 -1
  21. package/dist/domain/scenario-interaction/presentation-observer.d.ts +6 -1
  22. package/dist/domain/scenario-interaction/scenario-interaction.types.d.ts +10 -0
  23. package/dist/domain/ui/ui.service.d.ts +6 -5
  24. package/dist/domain/ui/widget-geometry.d.ts +28 -0
  25. package/dist/i18n/messages.d.ts +63 -2
  26. package/dist/index-WDFSbfaV.js +2208 -0
  27. package/dist/index.types.d.ts +15 -4
  28. package/dist/{index-BBsPIKJB.js → mount-CXUq37eu.js} +8636 -7821
  29. package/dist/ui/attachment-preview.d.ts +10 -0
  30. package/dist/ui/components/ChatAttachmentList.d.ts +3 -1
  31. package/dist/ui/components/ChatAttachmentPreviewDialog.d.ts +9 -0
  32. package/dist/ui/components/ChatMessage.d.ts +3 -0
  33. package/dist/ui/components/ChatUnreadIndicator.d.ts +3 -1
  34. package/dist/ui/components/ChatWidgetFrame.d.ts +9 -1
  35. package/dist/ui/components/CompactPreviewSurface.d.ts +8 -0
  36. package/dist/ui/components/CompactScenarioPreview.d.ts +24 -0
  37. package/dist/ui/components/OptimisticCustomerMessage.d.ts +4 -1
  38. package/dist/ui/components/compact-preview-content.d.ts +10 -0
  39. package/dist/ui/hooks/useAttentionInterruption.d.ts +1 -0
  40. package/package.json +1 -1
  41. package/dist/ChatWidgetContent-CZdK6qrV.js +0 -6363
package/README.md CHANGED
@@ -89,6 +89,33 @@ latest requested state is applied when the UI is ready. Session replacement upda
89
89
  authenticated HTTP, realtime, message, voice, and command dependencies without
90
90
  recreating the public widget instance.
91
91
 
92
+ ## Compact scenario preview
93
+
94
+ Compact scenario previews are opt-in. Provide a stable, non-empty namespace that
95
+ identifies the host project and widget placement:
96
+
97
+ ```ts
98
+ const widget = new ChatWidgetInstance({
99
+ customerInteractionSession: session,
100
+ compactScenarioPreview: {
101
+ enabled: true,
102
+ storageNamespace: "casino-web/lola-main",
103
+ },
104
+ });
105
+ ```
106
+
107
+ The namespace scopes the persisted launcher dock and panel geometry, so two
108
+ widgets on the same origin never inherit each other's placement. TypeScript
109
+ requires it when the feature is enabled; JavaScript callers that omit it or pass
110
+ only whitespace still get the preview, but layout persistence is disabled. With
111
+ the option omitted or `enabled: false`, scenario messages retain their existing
112
+ in-chat behavior and the legacy origin-wide layout persistence remains unchanged.
113
+ When compact preview is first enabled, the first stable namespace on the origin
114
+ claims and copies the legacy layout once; other namespaces start from defaults.
115
+ The synchronous migration marker is deterministic within one document and
116
+ best-effort if separate tabs initialize different namespaces at exactly the same
117
+ time; persisted scoped layouts remain isolated in either case.
118
+
92
119
  ## Localization
93
120
 
94
121
  Pass the product's current locale directly to the widget. English is used when
@@ -186,32 +213,43 @@ Closing a hidden-launcher widget leaves it non-interactive until the product cal
186
213
 
187
214
  ## Attachments
188
215
 
189
- The composer is opt-in. Enable it with one option; without a transport it uses a
190
- local mock for visual QA and staged integration. The mock supports image previews,
191
- document cards, retry UI and downloads, but is never durable storage.
216
+ Attachment support is enabled by default and uses Lola Backend's
217
+ quarantine-and-scan pipeline. The picker and drag-and-drop target appear only when
218
+ the current server-authoritative responder presentation is `CURRENT` and human
219
+ support is `ASSIGNED`; they stay unavailable before a current human-support
220
+ assignment exists, including `NONE` and `ROUTING`. If that assignment is released
221
+ after a file was selected, the draft remains removable but is not sent while the
222
+ assignment is absent. The SDK sends only attachments that reach `READY`; uploaded
223
+ bytes never become durable message URLs. Set `attachments.enabled` to `false` only
224
+ when embedding against a legacy backend.
192
225
 
193
226
  ```ts
194
227
  const widget = new ChatWidgetInstance({
195
228
  customerInteractionSession: session,
196
- attachments: { enabled: true },
229
+ // Optional: attachments: { enabled: false },
197
230
  });
198
231
  ```
199
232
 
200
- For production, pass the signed-upload adapter owned by the product/backend. It
201
- returns a permanent attachment id and download URL. Enable `sendAttachmentIds`
202
- when the receiving endpoint has been rolled out; the SDK then includes the returned
203
- ids in the next message command and renders attachments from history and realtime
204
- frames.
233
+ The default adapter hashes the file, creates an upload intent, streams the bytes to
234
+ the presigned storage URL with progress, completes the upload, and waits for the
235
+ malware scan. Download and image/PDF preview grants are fetched only when the user
236
+ asks for them. Signed URLs are never retained in chat history.
237
+
238
+ For controlled demos or tests, a custom transport can replace that adapter. READY
239
+ attachment ids are sent by default; `sendAttachmentIds: false` is a temporary
240
+ legacy-backend escape hatch.
205
241
 
206
242
  ```ts
207
243
  attachments: {
208
244
  enabled: true,
209
- sendAttachmentIds: true, // enable once the receiving chat endpoint accepts them
245
+ sendAttachmentIds: true,
210
246
  transport: {
211
- upload: async ({ file, onProgress, signal }) => {
247
+ upload: async ({ file, conversationId, onProgress, onStage, signal }) => {
212
248
  // Create an upload session, PUT the file, then complete it.
213
- // Return { id, fileName, mediaType, size, kind, downloadUrl, previewUrl }.
249
+ // Return durable metadata: { id, fileName, mediaType, size, kind }.
214
250
  },
251
+ grant: async ({ attachmentId, conversationId }) => ({ url, expiresAt }),
252
+ revoke: async ({ attachmentId, conversationId }) => {},
215
253
  },
216
254
  }
217
255
  ```
package/dist/App.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ import { type CableServiceFactory } from "./domain/message/cable/CableContext";
1
2
  import type { OnAvatarReady } from "./types";
2
3
  import type { ExternallyAvailableActions } from "./avatar/Avatar";
3
4
  import type { WidgetConfig } from "./index.types";
@@ -24,5 +25,9 @@ type AppProps = {
24
25
  config: WidgetConfig;
25
26
  api: AppApi;
26
27
  };
28
+ export declare function ChatWidgetCableProvider({ config, api, children, createCableService, }: AppProps & {
29
+ children: React.ReactNode;
30
+ createCableService?: CableServiceFactory;
31
+ }): import("react/jsx-runtime").JSX.Element;
27
32
  export declare function App({ config, api }: AppProps): import("react/jsx-runtime").JSX.Element;
28
33
  export default App;
@@ -1,4 +1,4 @@
1
- import { a0 as $s } from "./index-BBsPIKJB.js";
1
+ import { l as $s } from "./index-WDFSbfaV.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) {