@alxxsck/ai-assistant 1.2.0 → 1.4.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 +17 -11
- package/dist/bridge-ai-chat-widget.es.js +1564 -1420
- package/dist/domain/command/CommandRuntime.d.ts +2 -8
- package/dist/domain/command/UiCommandService.d.ts +24 -0
- package/dist/domain/command/command.errors.d.ts +5 -0
- package/dist/domain/command/command.types.d.ts +70 -6
- package/dist/index.types.d.ts +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -268,8 +268,15 @@ The widget consumes Lola Backend `command.created` envelopes from the AnyCable
|
|
|
268
268
|
deduplicates `commandId` during reconnect replay. Updating the interaction session
|
|
269
269
|
now reconnects REST and AnyCable without remounting the widget.
|
|
270
270
|
|
|
271
|
-
|
|
272
|
-
|
|
271
|
+
The complete frontend integration and rollout guide is available in
|
|
272
|
+
[`docs/ui-actions-sdk.ru.md`](docs/ui-actions-sdk.ru.md).
|
|
273
|
+
|
|
274
|
+
The previous callback fields (`url`, `target`, `commandType`,
|
|
275
|
+
`targetDefinition`, and `modalId`) remain as deprecated aliases for a
|
|
276
|
+
zero-downtime host migration.
|
|
277
|
+
|
|
278
|
+
Canonical page routes and modal names arrive in `data.target`; the host only
|
|
279
|
+
provides typed callbacks:
|
|
273
280
|
|
|
274
281
|
```ts
|
|
275
282
|
const widget = new ChatWidgetInstance({
|
|
@@ -280,6 +287,11 @@ const widget = new ChatWidgetInstance({
|
|
|
280
287
|
sessionId,
|
|
281
288
|
expiresAt,
|
|
282
289
|
},
|
|
290
|
+
handlers: {
|
|
291
|
+
openModal: ({ modalName }) => modalRegistry.open(modalName),
|
|
292
|
+
openPage: ({ route }) => router.push(route),
|
|
293
|
+
},
|
|
294
|
+
// Temporary fallback for legacy commands without data.target.
|
|
283
295
|
uiTargets: {
|
|
284
296
|
deposit_button: {
|
|
285
297
|
kind: "button",
|
|
@@ -287,7 +299,7 @@ const widget = new ChatWidgetInstance({
|
|
|
287
299
|
},
|
|
288
300
|
deposit_modal: {
|
|
289
301
|
kind: "modal",
|
|
290
|
-
|
|
302
|
+
modalName: "deposit",
|
|
291
303
|
},
|
|
292
304
|
account_page: {
|
|
293
305
|
kind: "page",
|
|
@@ -295,11 +307,6 @@ const widget = new ChatWidgetInstance({
|
|
|
295
307
|
query: { source: "lola" },
|
|
296
308
|
},
|
|
297
309
|
},
|
|
298
|
-
handlers: {
|
|
299
|
-
openModal: ({ modalCode, payload }) =>
|
|
300
|
-
modalRegistry.open(modalCode!, payload),
|
|
301
|
-
openPage: ({ url }) => router.push(url!),
|
|
302
|
-
},
|
|
303
310
|
});
|
|
304
311
|
```
|
|
305
312
|
|
|
@@ -315,9 +322,8 @@ by an element's `overflow` or container bounds and follows resize and scroll. A
|
|
|
315
322
|
URL fallback uses `history.pushState` and emits `popstate`, so an explicitly
|
|
316
323
|
configured query such as `?lola_modal=deposit` can be handled without reloading the
|
|
317
324
|
host SPA. A registered modal selector can also open a native `HTMLDialogElement`.
|
|
318
|
-
|
|
319
|
-
`
|
|
320
|
-
`pageCode`). If no safe handler/fallback exists, the widget sends
|
|
325
|
+
`data.target` is authoritative. Legacy commands without it are resolved through
|
|
326
|
+
`payload.modalId`/`pageId` and `uiTargets`. If no safe handler/fallback exists, the widget sends
|
|
321
327
|
`unsupported` and emits `command_unsupported`; other lifecycle events are
|
|
322
328
|
`command_received`, `command_succeeded`, `command_failed`, and `command_expired`.
|
|
323
329
|
|