@eshal-bot/chat-widget 0.2.52 → 0.2.53

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-BZbPoQVV.esm.js";import"react";import"react-dom/client";import"react/jsx-runtime";import"react-dom";
1
+ export{S as default}from"./chat-widget-index-bgKYLm2D.esm.js";import"react";import"react-dom/client";import"react/jsx-runtime";import"react-dom";
@@ -13398,10 +13398,35 @@
13398
13398
  const line = lines[i];
13399
13399
  if (line.role !== "assistant") continue;
13400
13400
  if (line.a2ui) return line.a2ui;
13401
- if (!line.isProcessing && (line.content || "").trim()) return "";
13401
+ if (!line.isProcessing && (line.content || "").trim()) {
13402
+ // A verify card still waiting for its code stays (dev, 12 Nov 2026: the caller said "Hello" while
13403
+ // the code box was up and heard "please confirm the box on your screen", with the box gone).
13404
+ const older = lines.slice(0, i).reverse().find(l => l.role === "assistant" && l.a2ui);
13405
+ return older && waitsForCode(older) ? older.a2ui || "" : "";
13406
+ }
13402
13407
  }
13403
13408
  return "";
13404
13409
  }
13410
+ const VERIFY_CARD = /"type"\s*:\s*"verification"/;
13411
+
13412
+ /** A verification code card (VerifyCard) whose code is not confirmed yet. */
13413
+ function waitsForCode(line) {
13414
+ return Boolean(line?.a2ui && VERIFY_CARD.test(line.a2ui) && !line.cardDone);
13415
+ }
13416
+
13417
+ /**
13418
+ * The lines with the verify card of this held call marked done, once its code is confirmed: the card
13419
+ * then goes like any other, when a newer answer has words of its own.
13420
+ * Mirrors packages/frontend/src/components/chatbot-preview/voiceCard.ts.
13421
+ */
13422
+ function markCodeConfirmed(lines, card) {
13423
+ const id = String(card?.tool_call_id || "").trim();
13424
+ if (!id) return lines;
13425
+ return lines.map(l => l.a2ui && VERIFY_CARD.test(l.a2ui) && l.a2ui.includes(id) ? {
13426
+ ...l,
13427
+ cardDone: true
13428
+ } : l);
13429
+ }
13405
13430
  const CARD_FENCE = /```[ \t]*(?:eshal-ui|eshal-chart|chart)\b[^\n]*\n[\s\S]*?(?:```|$)/g;
13406
13431
 
13407
13432
  /**
@@ -17036,6 +17061,8 @@
17036
17061
  ws.send(message);
17037
17062
  updateActivity(organizationId);
17038
17063
  setIsLoading(true);
17064
+ // The card's code is confirmed: it may go once the resumed answer speaks.
17065
+ setBidiMessages(prev => markCodeConfirmed(prev, card));
17039
17066
  }, []);
17040
17067
 
17041
17068
  // Cleanup on unmount
@@ -25397,7 +25424,7 @@
25397
25424
  * value by its own test (that constant sat at 0.1.113 while this package was
25398
25425
  * at 0.2.2 precisely because nothing enforced it - EV-2431).
25399
25426
  */
25400
- const WIDGET_VERSION = '0.2.52';
25427
+ const WIDGET_VERSION = '0.2.53';
25401
25428
 
25402
25429
  /**
25403
25430
  * API utility functions