@eshal-bot/chat-widget 0.2.2 → 0.2.3

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-C9e7Y35o.esm.js";import"react";import"react-dom/client";import"react/jsx-runtime";import"react-dom";
@@ -20444,6 +20444,25 @@
20444
20444
  });
20445
20445
  ToggleButton.displayName = "ToggleButton";
20446
20446
 
20447
+ /**
20448
+ * version.js - the widget's own version, reported to Eshal on mount.
20449
+ *
20450
+ * Deliberately a plain string literal rather than a build-time define
20451
+ * (`@rollup/plugin-replace` / Vite `define`). The widget ships as four
20452
+ * different bundles (ESM, UMD, IIFE embed, plus the Vite dev server) and is
20453
+ * also re-bundled by consumers who apply none of our build config - a define
20454
+ * would resolve to `undefined` in exactly those paths, and a bare reference
20455
+ * to an undeclared identifier is a hard ReferenceError that takes the whole
20456
+ * widget down. A literal survives every one of them.
20457
+ *
20458
+ * The cost is that this must be bumped alongside package.json. That drift is
20459
+ * not left to discipline: __tests__/version.test.js fails CI if the two ever
20460
+ * disagree, and packages/frontend's CDN_WIDGET_VERSION is held to the same
20461
+ * value by its own test (that constant sat at 0.1.113 while this package was
20462
+ * at 0.2.2 precisely because nothing enforced it - EV-2431).
20463
+ */
20464
+ const WIDGET_VERSION = '0.2.3';
20465
+
20447
20466
  const createSession = async config => {
20448
20467
  // Initialize chat session if needed
20449
20468
  if (config.sessionUrl) {
@@ -20487,7 +20506,7 @@
20487
20506
  }
20488
20507
  try {
20489
20508
  const base = apiBaseUrl.replace(/\/$/, '');
20490
- const url = "".concat(base, "/api/v1/deploy-agent");
20509
+ const url = WIDGET_VERSION ? "".concat(base, "/api/v1/deploy-agent?wv=").concat(encodeURIComponent(WIDGET_VERSION)) : "".concat(base, "/api/v1/deploy-agent");
20491
20510
  const headers = {
20492
20511
  "Content-Type": "application/json"
20493
20512
  };
@@ -21395,6 +21414,7 @@
21395
21414
  // Auto-initialize if config exists in window
21396
21415
  if (typeof window !== 'undefined') {
21397
21416
  window.ChatWidget = API;
21417
+ window.ChatWidget.version = WIDGET_VERSION;
21398
21418
 
21399
21419
  // Auto-init with window.ChatWidgetConfig
21400
21420
  if (window.ChatWidgetConfig) {