@eshal-bot/chat-widget 0.2.2 → 0.2.4

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-Da4GAL7R.esm.js";import"react";import"react-dom/client";import"react/jsx-runtime";import"react-dom";
1
+ export{S as default}from"./chat-widget-index-CBTM7rwy.esm.js";import"react";import"react-dom/client";import"react/jsx-runtime";import"react-dom";
@@ -15346,10 +15346,17 @@
15346
15346
  });
15347
15347
  const citationCtxValue = reactExports.useMemo(() => ({
15348
15348
  sources: message.sources || [],
15349
+ // EV-3535: the EARLY {type:'sources'} frame is PRELIMINARY (pre-answer,
15350
+ // pre-fallback). Rendering committed pills off it, then clearing them
15351
+ // when the authoritative `complete` list comes back empty (a no-info
15352
+ // fallback), is the reported appear-then-vanish. Pass the flag through so
15353
+ // CitationPill DEFERS the pill while preliminary and commits it only from
15354
+ // the authoritative frame - pills appear once, never vanish.
15355
+ sourcesPreliminary: !!message.sourcesPreliminary,
15349
15356
  onSourceActivate,
15350
15357
  downloadingKey,
15351
15358
  textColor: messageTextColor
15352
- }), [message.sources, onSourceActivate, downloadingKey, messageTextColor]);
15359
+ }), [message.sources, message.sourcesPreliminary, onSourceActivate, downloadingKey, messageTextColor]);
15353
15360
  return (
15354
15361
  /*#__PURE__*/
15355
15362
  // `min-w-0` on the outer flex-row mirrors the same guard in the
@@ -20444,6 +20451,25 @@
20444
20451
  });
20445
20452
  ToggleButton.displayName = "ToggleButton";
20446
20453
 
20454
+ /**
20455
+ * version.js - the widget's own version, reported to Eshal on mount.
20456
+ *
20457
+ * Deliberately a plain string literal rather than a build-time define
20458
+ * (`@rollup/plugin-replace` / Vite `define`). The widget ships as four
20459
+ * different bundles (ESM, UMD, IIFE embed, plus the Vite dev server) and is
20460
+ * also re-bundled by consumers who apply none of our build config - a define
20461
+ * would resolve to `undefined` in exactly those paths, and a bare reference
20462
+ * to an undeclared identifier is a hard ReferenceError that takes the whole
20463
+ * widget down. A literal survives every one of them.
20464
+ *
20465
+ * The cost is that this must be bumped alongside package.json. That drift is
20466
+ * not left to discipline: __tests__/version.test.js fails CI if the two ever
20467
+ * disagree, and packages/frontend's CDN_WIDGET_VERSION is held to the same
20468
+ * value by its own test (that constant sat at 0.1.113 while this package was
20469
+ * at 0.2.2 precisely because nothing enforced it - EV-2431).
20470
+ */
20471
+ const WIDGET_VERSION = '0.2.3';
20472
+
20447
20473
  const createSession = async config => {
20448
20474
  // Initialize chat session if needed
20449
20475
  if (config.sessionUrl) {
@@ -20487,7 +20513,7 @@
20487
20513
  }
20488
20514
  try {
20489
20515
  const base = apiBaseUrl.replace(/\/$/, '');
20490
- const url = "".concat(base, "/api/v1/deploy-agent");
20516
+ const url = WIDGET_VERSION ? "".concat(base, "/api/v1/deploy-agent?wv=").concat(encodeURIComponent(WIDGET_VERSION)) : "".concat(base, "/api/v1/deploy-agent");
20491
20517
  const headers = {
20492
20518
  "Content-Type": "application/json"
20493
20519
  };
@@ -21395,6 +21421,7 @@
21395
21421
  // Auto-initialize if config exists in window
21396
21422
  if (typeof window !== 'undefined') {
21397
21423
  window.ChatWidget = API;
21424
+ window.ChatWidget.version = WIDGET_VERSION;
21398
21425
 
21399
21426
  // Auto-init with window.ChatWidgetConfig
21400
21427
  if (window.ChatWidgetConfig) {