@saar-ai/web-widget 0.13.1 → 0.14.1

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 (47) hide show
  1. package/dist/chunks/{chat-R7z4DtMM.js → chat-CrbRIHVN.js} +18 -5
  2. package/dist/chunks/{esm-DSxqq2-d.js → esm-D2iq2DjO.js} +6 -6
  3. package/dist/chunks/{host-widget-iQ-2t8vu.js → host-widget-DlFlAZYq.js} +561 -179
  4. package/dist/chunks/{schemas-B2B3k74u.js → schemas-DC_oWrTO.js} +51 -19
  5. package/dist/chunks/starters-pick-noq7o_W8.js +139 -0
  6. package/dist/chunks/{telemetry-3f--vvdX.js → telemetry-UHSrhVyf.js} +1 -1
  7. package/dist/concierge-shell.css +1 -1
  8. package/dist/consent/consent-prompt-dom.d.ts.map +1 -1
  9. package/dist/dock/dock-caption.d.ts.map +1 -1
  10. package/dist/dock/dock-drag.d.ts +0 -2
  11. package/dist/dock/dock-drag.d.ts.map +1 -1
  12. package/dist/dock/dock-motion.d.ts +0 -1
  13. package/dist/dock/dock-motion.d.ts.map +1 -1
  14. package/dist/dock/dock-state.d.ts +0 -52
  15. package/dist/dock/dock-state.d.ts.map +1 -1
  16. package/dist/dock/dock.d.ts +0 -18
  17. package/dist/dock/dock.d.ts.map +1 -1
  18. package/dist/generated/concierge-shell-css.d.ts.map +1 -1
  19. package/dist/generated/widget-css.d.ts.map +1 -1
  20. package/dist/host-widget.d.ts +9 -1
  21. package/dist/host-widget.d.ts.map +1 -1
  22. package/dist/index.js +4 -4
  23. package/dist/message-limit.d.ts +10 -0
  24. package/dist/message-limit.d.ts.map +1 -0
  25. package/dist/messages.d.ts +16 -0
  26. package/dist/messages.d.ts.map +1 -1
  27. package/dist/next/index.js +1 -1
  28. package/dist/starters-pick.d.ts +16 -0
  29. package/dist/starters-pick.d.ts.map +1 -0
  30. package/dist/text-direction.d.ts +11 -45
  31. package/dist/text-direction.d.ts.map +1 -1
  32. package/dist/use-chat-session.d.ts +73 -13
  33. package/dist/use-chat-session.d.ts.map +1 -1
  34. package/dist/voice-widget.d.ts +13 -1
  35. package/dist/voice-widget.d.ts.map +1 -1
  36. package/dist/widget/concierge-shell.d.ts +7 -1
  37. package/dist/widget/concierge-shell.d.ts.map +1 -1
  38. package/dist/widget/open-state.d.ts +3 -0
  39. package/dist/widget/open-state.d.ts.map +1 -0
  40. package/dist/widget/shell-renderer.d.ts +1 -1
  41. package/dist/widget/shell-renderer.d.ts.map +1 -1
  42. package/dist/widget/transcript-geometry.d.ts +12 -6
  43. package/dist/widget/transcript-geometry.d.ts.map +1 -1
  44. package/dist/widget-markdown.d.ts +8 -0
  45. package/dist/widget-markdown.d.ts.map +1 -1
  46. package/dist/widget.css +1 -1
  47. package/package.json +9 -9
@@ -1,6 +1,6 @@
1
1
  import { a as CAPTURE_CARD_INPUTS, i as CAPTURE_CARD_FIELD_PATTERN, n as CAPTURE_CARD_CONSENT_MAX, o as CAPTURE_CARD_REGION_PATTERN, r as CAPTURE_CARD_EVENT_TYPE, s as CAPTURE_CARD_VALUE_MAX, t as CAPTURE_CARD_CONSENT_CHANNELS } from "./capture-card-BlJ6EkWn.js";
2
2
  import { a as isSafeFormSelector, i as isSafeFillValue, r as isSafeControlName, t as FILL_FORM_EVENT_TYPE } from "./form-fill-B-h6Uw1t.js";
3
- import { a as httpUrl, c as number, d as string, f as union, i as discriminatedUnion, l as object, n as array, o as literal, p as uuid, r as boolean, t as _enum, u as record } from "./schemas-B2B3k74u.js";
3
+ import { a as httpUrl, c as number, d as string, f as union, i as discriminatedUnion, l as object, n as array, o as literal, p as uuid, r as boolean, t as _enum, u as record } from "./schemas-DC_oWrTO.js";
4
4
  //#region ../widget-protocol/dist/act.js
5
5
  /**
6
6
  * ACT EVENTS — the concierge moving the store, rather than only describing it.
@@ -326,7 +326,7 @@ var WidgetChatFillFormEventSchema = object({
326
326
  * why it must not be reachable from `@saar-ai/web-widget`'s published bundle
327
327
  * via a `@wesence/*` import path at all (docs/PACKAGE_DISTRIBUTION.md).
328
328
  *
329
- * ## The seven event types, and why cards/checkout are separate events from text
329
+ * ## The event types, and why cards/checkout are separate events from text
330
330
  *
331
331
  * A reply may interleave prose with product/price/checkout data. Prices,
332
332
  * stock, and product attributes are NEVER stated as text by the model (see
@@ -350,6 +350,12 @@ var WidgetChatFillFormEventSchema = object({
350
350
  * - `capture-card` — a small form for one contact detail (`./capture.ts`).
351
351
  * - `fill-form` — fill, and maybe send, the host page's own enquiry form
352
352
  * with the visitor's confirmed details (`./form-fill-event.ts`).
353
+ * - `resumed` — the concierge is answering again after a person held
354
+ * the conversation: this is the first AI turn since a release back to the
355
+ * AI. The widget leaves its escalated state. The FALLBACK for the widget
356
+ * room's `desk:ownership` push (`./desk-ownership.ts`), which a visitor
357
+ * with no live socket never receives. A lifecycle event: no tool may emit
358
+ * it.
353
359
  * - `done` — the turn is over. Carries the turn id so the widget can
354
360
  * correlate a later `/widget/messages` page against what it already
355
361
  * rendered inline.
@@ -362,7 +368,7 @@ var WidgetChatFillFormEventSchema = object({
362
368
  * to ask the chat loop to forward one of these events verbatim, alongside the
363
369
  * tool's own return value the model sees. Only `cards`, `escalated`,
364
370
  * `checkout` and `add-to-cart` are valid sidecar events —
365
- * `text-delta`/`done`/`error` are lifecycle events the runtime itself owns and
371
+ * `text-delta`/`resumed`/`done`/`error` are lifecycle events the runtime itself owns and
366
372
  * a tool must never emit.
367
373
  */
368
374
  /** Bound for a display string a card renders. Never free-form model prose. */
@@ -633,6 +639,12 @@ var WidgetChatAddToCartEventSchema = object({
633
639
  type: literal("add-to-cart"),
634
640
  item: WidgetChatCardSchema
635
641
  });
642
+ /**
643
+ * First AI turn after a release back to the AI — see the module doc comment.
644
+ * Carries nothing: the widget only needs to know that it happened, and when
645
+ * (it arrives ahead of the reply's text on the same stream).
646
+ */
647
+ var WidgetChatResumedEventSchema = object({ type: literal("resumed") });
636
648
  var WidgetChatDoneEventSchema = object({
637
649
  type: literal("done"),
638
650
  turnId: string().min(1)
@@ -652,13 +664,14 @@ var WidgetChatSseEventSchema = discriminatedUnion("type", [
652
664
  ...ACT_EVENT_SCHEMAS,
653
665
  WidgetChatCaptureCardEventSchema,
654
666
  WidgetChatFillFormEventSchema,
667
+ WidgetChatResumedEventSchema,
655
668
  WidgetChatDoneEventSchema,
656
669
  WidgetChatErrorEventSchema
657
670
  ]);
658
671
  /**
659
672
  * What a tool result may carry, under an `output.widgetEvent` key, to ask the
660
673
  * chat loop to forward one of these as its own SSE event. Deliberately a
661
- * NARROWER union than {@link WidgetChatSseEventSchema} — `text-delta`,
674
+ * NARROWER union than {@link WidgetChatSseEventSchema} — `text-delta`, `resumed`,
662
675
  * `done`, and `error` are lifecycle events the runtime alone controls; a tool
663
676
  * asserting one of those could inject a fake "done" mid-stream or spoof a
664
677
  * fake error to the visitor.
@@ -1099,4 +1112,4 @@ function parseWidgetChatCart(value) {
1099
1112
  return parsed.success ? parsed.data : null;
1100
1113
  }
1101
1114
  //#endregion
1102
- export { CART_LINE_PLATFORM_VARIANT_ID_PATTERN, CART_LINE_VARIANT_ID_PATTERN, DROPPABLE_CARD_FIELDS, MAX_CARDS_PER_EVENT, MAX_CART_LINES, WidgetCartAddFailedReportSchema, WidgetCartAddReportSchema, WidgetChatAddToCartEventSchema, WidgetChatCardSchema, WidgetChatCardsEventSchema, WidgetChatCartLineSchema, WidgetChatCartSchema, WidgetChatCartSourceSchema, WidgetChatCheckoutEventSchema, WidgetChatDoneEventSchema, WidgetChatErrorEventSchema, WidgetChatEscalatedEventSchema, WidgetChatReportSchema, WidgetChatSseEventSchema, WidgetChatTextDeltaEventSchema, WidgetToolEventSchema, WidgetVariantChoiceRequestReportSchema, buildWidgetChatCard, buildWidgetChatCardsEvent, buildWithDroppableFields, extractWidgetToolEvent, parseWidgetChatCart, parseWidgetChatReport };
1115
+ export { CART_LINE_PLATFORM_VARIANT_ID_PATTERN, CART_LINE_VARIANT_ID_PATTERN, DROPPABLE_CARD_FIELDS, MAX_CARDS_PER_EVENT, MAX_CART_LINES, WidgetCartAddFailedReportSchema, WidgetCartAddReportSchema, WidgetChatAddToCartEventSchema, WidgetChatCardSchema, WidgetChatCardsEventSchema, WidgetChatCartLineSchema, WidgetChatCartSchema, WidgetChatCartSourceSchema, WidgetChatCheckoutEventSchema, WidgetChatDoneEventSchema, WidgetChatErrorEventSchema, WidgetChatEscalatedEventSchema, WidgetChatReportSchema, WidgetChatResumedEventSchema, WidgetChatSseEventSchema, WidgetChatTextDeltaEventSchema, WidgetToolEventSchema, WidgetVariantChoiceRequestReportSchema, buildWidgetChatCard, buildWidgetChatCardsEvent, buildWithDroppableFields, extractWidgetToolEvent, parseWidgetChatCart, parseWidgetChatReport };
@@ -1705,7 +1705,7 @@ var Socket$1 = class extends SocketWithUpgrade {
1705
1705
  };
1706
1706
  Socket$1.protocol;
1707
1707
  //#endregion
1708
- //#region ../../node_modules/.pnpm/socket.io-client@4.8.3/node_modules/socket.io-client/build/esm/url.js
1708
+ //#region ../../node_modules/.pnpm/socket.io-client@4.8.4/node_modules/socket.io-client/build/esm/url.js
1709
1709
  /**
1710
1710
  * URL parser.
1711
1711
  *
@@ -2093,7 +2093,7 @@ function isPacketValid(packet) {
2093
2093
  return isNamespaceValid(packet.nsp) && isAckIdValid(packet.id) && isDataValid(packet.type, packet.data);
2094
2094
  }
2095
2095
  //#endregion
2096
- //#region ../../node_modules/.pnpm/socket.io-client@4.8.3/node_modules/socket.io-client/build/esm/on.js
2096
+ //#region ../../node_modules/.pnpm/socket.io-client@4.8.4/node_modules/socket.io-client/build/esm/on.js
2097
2097
  function on(obj, ev, fn) {
2098
2098
  obj.on(ev, fn);
2099
2099
  return function subDestroy() {
@@ -2101,7 +2101,7 @@ function on(obj, ev, fn) {
2101
2101
  };
2102
2102
  }
2103
2103
  //#endregion
2104
- //#region ../../node_modules/.pnpm/socket.io-client@4.8.3/node_modules/socket.io-client/build/esm/socket.js
2104
+ //#region ../../node_modules/.pnpm/socket.io-client@4.8.4/node_modules/socket.io-client/build/esm/socket.js
2105
2105
  /**
2106
2106
  * Internal events.
2107
2107
  * These events can't be emitted by the user.
@@ -2887,7 +2887,7 @@ var Socket = class extends Emitter {
2887
2887
  }
2888
2888
  };
2889
2889
  //#endregion
2890
- //#region ../../node_modules/.pnpm/socket.io-client@4.8.3/node_modules/socket.io-client/build/esm/contrib/backo2.js
2890
+ //#region ../../node_modules/.pnpm/socket.io-client@4.8.4/node_modules/socket.io-client/build/esm/contrib/backo2.js
2891
2891
  /**
2892
2892
  * Initialize backoff timer with `opts`.
2893
2893
  *
@@ -2955,7 +2955,7 @@ Backoff.prototype.setJitter = function(jitter) {
2955
2955
  this.jitter = jitter;
2956
2956
  };
2957
2957
  //#endregion
2958
- //#region ../../node_modules/.pnpm/socket.io-client@4.8.3/node_modules/socket.io-client/build/esm/manager.js
2958
+ //#region ../../node_modules/.pnpm/socket.io-client@4.8.4/node_modules/socket.io-client/build/esm/manager.js
2959
2959
  var Manager = class extends Emitter {
2960
2960
  constructor(uri, opts) {
2961
2961
  var _a;
@@ -3263,7 +3263,7 @@ var Manager = class extends Emitter {
3263
3263
  }
3264
3264
  };
3265
3265
  //#endregion
3266
- //#region ../../node_modules/.pnpm/socket.io-client@4.8.3/node_modules/socket.io-client/build/esm/index.js
3266
+ //#region ../../node_modules/.pnpm/socket.io-client@4.8.4/node_modules/socket.io-client/build/esm/index.js
3267
3267
  /**
3268
3268
  * Managers cache.
3269
3269
  */