@eshal-bot/chat-widget 0.1.109 → 0.1.111

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.
@@ -1 +1 @@
1
- export{S as default}from"./chat-widget-index-BeabB7Lu.esm.js";import"react";import"react-dom/client";import"react-dom";import"react/jsx-runtime";
1
+ export{S as default}from"./chat-widget-index-CiAFsZbh.esm.js";import"react";import"react-dom/client";import"react-dom";import"react/jsx-runtime";
@@ -8523,8 +8523,11 @@
8523
8523
  // unlocks at last-token time) and delivers the chips afterwards
8524
8524
  // as their own {type:'follow_up_prompts'} chunk on the same
8525
8525
  // stream. Attach them to the already-finalized assistant
8526
- // message. Turns where chip generation timed out simply never
8527
- // send this chunk.
8526
+ // message. EV-3081: this chunk now arrives on EVERY outcome and
8527
+ // carries `promptsStatus` ("delivered" | "empty" | "timeout" |
8528
+ // "error"); a dropped set arrives as the chunk with no `prompts`,
8529
+ // where it used to be no chunk at all. The empty guard below is
8530
+ // what keeps that a no-op here rather than a chip-clearing write.
8528
8531
  if (parsed.type === 'follow_up_prompts') {
8529
8532
  const latePrompts = Array.isArray(parsed.prompts) ? parsed.prompts : [];
8530
8533
  if (latePrompts.length > 0) {
@@ -9051,6 +9054,33 @@
9051
9054
  return question && question !== label ? question : label;
9052
9055
  };
9053
9056
 
9057
+ /**
9058
+ * EV-3014: the chip-strip scroll-edge math, identical (down to the
9059
+ * `Math.abs`/`- 1` tolerance) across the widget's PromptSuggestionsRow,
9060
+ * the Testing Lab preview's PromptSuggestionsBar, and the SDK's
9061
+ * FollowUpPromptsBar — three independent copies before this, one of the
9062
+ * concerns EV-2993 flagged as having "already diverged once" for the
9063
+ * chip strip generally. `Math.abs(scrollLeft)` is required because an
9064
+ * RTL container's `scrollLeft` counts DOWN from 0 rather than up.
9065
+ *
9066
+ * Extracted so each surface's copy has a name to be tested against
9067
+ * instead of re-deriving the same arithmetic — see
9068
+ * chipStripScrollParity.test.ts, which drives this export plus the
9069
+ * frontend preview's and the SDK's local equivalents through the same
9070
+ * matrix.
9071
+ *
9072
+ * @param {number} scrollLeft
9073
+ * @param {number} scrollWidth
9074
+ * @param {number} clientWidth
9075
+ * @returns {{atStart: boolean, atEnd: boolean}}
9076
+ */
9077
+ const computeChipScrollState = (scrollLeft, scrollWidth, clientWidth) => {
9078
+ return {
9079
+ atStart: Math.abs(scrollLeft) <= 1,
9080
+ atEnd: Math.abs(scrollLeft) + clientWidth >= scrollWidth - 1
9081
+ };
9082
+ };
9083
+
9054
9084
  /**
9055
9085
  * Constructs the voice WebSocket base URL.
9056
9086
  *
@@ -17314,8 +17344,12 @@
17314
17344
  scrollWidth,
17315
17345
  clientWidth
17316
17346
  } = el;
17317
- setCanScrollToStart(Math.abs(scrollLeft) > 1);
17318
- setCanScrollToEnd(Math.abs(scrollLeft) + clientWidth < scrollWidth - 1);
17347
+ const {
17348
+ atStart,
17349
+ atEnd
17350
+ } = computeChipScrollState(scrollLeft, scrollWidth, clientWidth);
17351
+ setCanScrollToStart(!atStart);
17352
+ setCanScrollToEnd(!atEnd);
17319
17353
  }, []);
17320
17354
  reactExports.useEffect(() => {
17321
17355
  updateScrollState();