@saar-ai/web-widget 0.21.0 → 0.23.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 (40) hide show
  1. package/dist/avatar-face.d.ts +4 -1
  2. package/dist/avatar-face.d.ts.map +1 -1
  3. package/dist/chunks/{chat-DrpWeT5w.js → chat-BBmFAzkg.js} +57 -1
  4. package/dist/chunks/{host-widget-D675mXsN.js → host-widget-BARJFMPt.js} +492 -137
  5. package/dist/concierge-shell.css +1 -1
  6. package/dist/dock/dock-renderer.d.ts +1 -1
  7. package/dist/dock/dock-renderer.d.ts.map +1 -1
  8. package/dist/dock/dock.d.ts +5 -0
  9. package/dist/dock/dock.d.ts.map +1 -1
  10. package/dist/generated/concierge-shell-css.d.ts.map +1 -1
  11. package/dist/generated/widget-css.d.ts.map +1 -1
  12. package/dist/host-widget.d.ts.map +1 -1
  13. package/dist/index.d.ts +1 -0
  14. package/dist/index.d.ts.map +1 -1
  15. package/dist/index.js +4 -4
  16. package/dist/messages.d.ts +15 -0
  17. package/dist/messages.d.ts.map +1 -1
  18. package/dist/next/index.js +1 -1
  19. package/dist/use-chat-session.d.ts +15 -3
  20. package/dist/use-chat-session.d.ts.map +1 -1
  21. package/dist/use-voice-session.d.ts +19 -0
  22. package/dist/use-voice-session.d.ts.map +1 -1
  23. package/dist/variant-option-groups.d.ts +44 -0
  24. package/dist/variant-option-groups.d.ts.map +1 -0
  25. package/dist/variant-options.d.ts +34 -0
  26. package/dist/variant-options.d.ts.map +1 -0
  27. package/dist/voice-widget.d.ts +16 -3
  28. package/dist/voice-widget.d.ts.map +1 -1
  29. package/dist/widget/call-view.d.ts +42 -7
  30. package/dist/widget/call-view.d.ts.map +1 -1
  31. package/dist/widget/concierge-shell.d.ts +8 -4
  32. package/dist/widget/concierge-shell.d.ts.map +1 -1
  33. package/dist/widget/shell-renderer.d.ts +1 -1
  34. package/dist/widget/shell-renderer.d.ts.map +1 -1
  35. package/dist/widget.css +1 -1
  36. package/package.json +1 -1
  37. package/src/styles/call-view.css +104 -30
  38. package/src/styles/concierge-shell-entry.css +1 -0
  39. package/src/styles/mark.css +39 -5
  40. package/src/styles/widget-panel.css +29 -26
@@ -1,3 +1,4 @@
1
+ import { type MarkState } from './widget/mark.js';
1
2
  import type { WidgetAvatar } from './avatar.js';
2
3
  import type { BotState } from './bot-state.js';
3
4
  /**
@@ -34,6 +35,8 @@ export interface AvatarFaceProps {
34
35
  readonly muted?: boolean;
35
36
  /** Mark-only: the diameter, for a slot that draws the mark at its own size. */
36
37
  readonly markSize?: number;
38
+ /** Mark-only: a state `BotState` cannot say (the call view's `connecting`). Wins over `state`. */
39
+ readonly markState?: MarkState;
37
40
  }
38
- export declare function AvatarFace({ avatar, state, size, label, messageArrived, tightenKey, name, muted, markSize, }: AvatarFaceProps): import("react").JSX.Element;
41
+ export declare function AvatarFace({ avatar, state, size, label, messageArrived, tightenKey, name, muted, markSize, markState, }: AvatarFaceProps): import("react").JSX.Element;
39
42
  //# sourceMappingURL=avatar-face.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"avatar-face.d.ts","sourceRoot":"","sources":["../src/avatar-face.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAChD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAE/C;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,MAAM,EAAE,YAAY,CAAC;IAC9B,QAAQ,CAAC,KAAK,EAAE,QAAQ,CAAC;IACzB,QAAQ,CAAC,IAAI,EAAE,IAAI,GAAG,IAAI,CAAC;IAC3B,gFAAgF;IAChF,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IACxB,mFAAmF;IACnF,QAAQ,CAAC,cAAc,CAAC,EAAE,OAAO,CAAC;IAClC,iFAAiF;IACjF,QAAQ,CAAC,UAAU,CAAC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IAClG,QAAQ,CAAC,SAAS,CAAC,EAAE,SAAS,CAAC;CAChC;AAKD,wBAAgB,UAAU,CAAC,EACzB,MAAM,EACN,KAAK,EACL,IAAI,EACJ,KAAK,EACL,cAAc,EACd,UAAU,EACV,IAAI,EACJ,KAAK,EACL,QAAQ,EACR,SAAS,GACV,EAAE,eAAe,+BAyBjB"}
@@ -379,6 +379,8 @@ var WidgetFormFillReportSchema = object({
379
379
  * shopper's cart, for a shopper who asked for it in words rather than by
380
380
  * pressing a card's button. The server never touches a cart itself — see
381
381
  * {@link WidgetChatAddToCartEventSchema} for why that is structural.
382
+ * - `variant-options` — the variants the shopper can pick, drawn as chips
383
+ * with prices (SAA-509) — {@link WidgetChatVariantOptionsEventSchema}.
382
384
  * - `capture-card` — a small form for one contact detail (`./capture.ts`).
383
385
  * - `capture-saved` — that detail was saved from the conversation while its
384
386
  * form was open; the widget closes the form as answered (`./capture.ts`).
@@ -673,6 +675,58 @@ var WidgetChatAddToCartEventSchema = object({
673
675
  type: literal("add-to-cart"),
674
676
  item: WidgetChatCardSchema
675
677
  });
678
+ /** The most variants one `variant-options` event carries — the same cap `add_to_cart` hands the model. */
679
+ var MAX_VARIANT_OPTIONS = 20;
680
+ /** The most option pairs (Size, Colour…) one variant carries. */
681
+ var MAX_VARIANT_OPTION_PAIRS = 10;
682
+ var VariantOptionTextSchema = string().trim().min(1).max(100);
683
+ /**
684
+ * One variant the shopper can pick, as a chip (SAA-509). In stock by
685
+ * construction: there is no availability field, because the owner's rule is
686
+ * that a sold-out value is never drawn or announced.
687
+ */
688
+ var WidgetChatVariantOptionSchema = object({
689
+ /** The INTERNAL catalog UUID, as on a card. */
690
+ variantId: string().min(1).max(ID_MAX),
691
+ /** The platform-native id a `'platform'`-space bridge adds by — see {@link WidgetChatCardSchema}. */
692
+ platformVariantId: string().min(1).max(ID_MAX).optional(),
693
+ /** The variant's own title: the chip label when it has no option pairs. */
694
+ title: VariantOptionTextSchema,
695
+ options: array(object({
696
+ name: VariantOptionTextSchema,
697
+ value: VariantOptionTextSchema
698
+ })).max(10),
699
+ /** ISO 4217 minor units, in the product's `currency`. */
700
+ priceMinor: number().int().min(0)
701
+ });
702
+ /**
703
+ * The concierge asking the shopper to pick a variant (SAA-509): the widget
704
+ * draws each option as a tappable chip with its price, grouped per option
705
+ * name, under the line that asks ("Which size?").
706
+ *
707
+ * Emitted by `add_to_cart` when it answers `needs_variant_choice` (several
708
+ * in-stock variants, none chosen) or `sold_out` (the shopper asked for one
709
+ * that is sold out: `variants` is then the nearest in-stock alternatives).
710
+ * Structured so the model never has to list values in prose, and so the
711
+ * price on each chip is the catalogue's integer, never a number the model
712
+ * recited.
713
+ *
714
+ * `product` is the card fields a cart line needs, minus every variant
715
+ * field: the representative variant a card is priced with is exactly what
716
+ * must not be added. A chip tap builds the cart item from `product` plus the
717
+ * chosen variant, and adds it through the same path every add takes.
718
+ */
719
+ var WidgetChatVariantOptionsEventSchema = object({
720
+ type: literal("variant-options"),
721
+ product: WidgetChatCardSchema.pick({
722
+ productId: true,
723
+ title: true,
724
+ imageUrl: true,
725
+ handle: true,
726
+ currency: true
727
+ }),
728
+ variants: array(WidgetChatVariantOptionSchema).min(1).max(20)
729
+ });
676
730
  /**
677
731
  * First AI turn after a release back to the AI — see the module doc comment.
678
732
  * Carries nothing: the widget only needs to know that it happened, and when
@@ -701,6 +755,7 @@ var WidgetChatSseEventSchema = discriminatedUnion("type", [
701
755
  WidgetChatEscalatedEventSchema,
702
756
  WidgetChatCheckoutEventSchema,
703
757
  WidgetChatAddToCartEventSchema,
758
+ WidgetChatVariantOptionsEventSchema,
704
759
  ...ACT_EVENT_SCHEMAS,
705
760
  WidgetChatCaptureCardEventSchema,
706
761
  WidgetChatCaptureSavedEventSchema,
@@ -723,6 +778,7 @@ var WidgetToolEventSchema = discriminatedUnion("type", [
723
778
  WidgetChatEscalatedEventSchema,
724
779
  WidgetChatCheckoutEventSchema,
725
780
  WidgetChatAddToCartEventSchema,
781
+ WidgetChatVariantOptionsEventSchema,
726
782
  ...ACT_EVENT_SCHEMAS,
727
783
  WidgetChatCaptureCardEventSchema,
728
784
  WidgetChatCaptureSavedEventSchema,
@@ -1156,4 +1212,4 @@ function parseWidgetChatCart(value) {
1156
1212
  return parsed.success ? parsed.data : null;
1157
1213
  }
1158
1214
  //#endregion
1159
- 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, WidgetChatReadEventSchema, WidgetChatReportSchema, WidgetChatResumedEventSchema, WidgetChatSseEventSchema, WidgetChatTextDeltaEventSchema, WidgetToolEventSchema, WidgetVariantChoiceRequestReportSchema, buildWidgetChatCard, buildWidgetChatCardsEvent, buildWithDroppableFields, extractWidgetToolEvent, parseWidgetChatCart, parseWidgetChatReport };
1215
+ export { CART_LINE_PLATFORM_VARIANT_ID_PATTERN, CART_LINE_VARIANT_ID_PATTERN, DROPPABLE_CARD_FIELDS, MAX_CARDS_PER_EVENT, MAX_CART_LINES, MAX_VARIANT_OPTIONS, MAX_VARIANT_OPTION_PAIRS, WidgetCartAddFailedReportSchema, WidgetCartAddReportSchema, WidgetChatAddToCartEventSchema, WidgetChatCardSchema, WidgetChatCardsEventSchema, WidgetChatCartLineSchema, WidgetChatCartSchema, WidgetChatCartSourceSchema, WidgetChatCheckoutEventSchema, WidgetChatDoneEventSchema, WidgetChatErrorEventSchema, WidgetChatEscalatedEventSchema, WidgetChatReadEventSchema, WidgetChatReportSchema, WidgetChatResumedEventSchema, WidgetChatSseEventSchema, WidgetChatTextDeltaEventSchema, WidgetChatVariantOptionSchema, WidgetChatVariantOptionsEventSchema, WidgetToolEventSchema, WidgetVariantChoiceRequestReportSchema, buildWidgetChatCard, buildWidgetChatCardsEvent, buildWithDroppableFields, extractWidgetToolEvent, parseWidgetChatCart, parseWidgetChatReport };