@eshal-bot/chat-widget 0.1.69 → 0.1.70

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.
@@ -8777,21 +8777,20 @@
8777
8777
  };
8778
8778
 
8779
8779
  /**
8780
- * Constructs the voice WebSocket base URL — ALWAYS derived from the API
8781
- * base URL the widget is embedded with, as `wss://{host}/voice/ws`.
8780
+ * Constructs the voice WebSocket base URL.
8782
8781
  *
8783
- * `/voice/ws/{org}/{session}` is terminated by the frontend custom server
8784
- * (packages/frontend/server.js), which proxies it in-cluster to
8785
- * knowledge-api on `/ws`. The widget always talks to the same origin it
8786
- * loaded its config from, so the WS endpoint is fully determined by
8787
- * `apiBaseUrl`. There is intentionally NO override parameter: voice can
8788
- * never be pointed at the (no-longer-public) knowledge-api LoadBalancer by
8789
- * a stale embed option or backend config value.
8782
+ * If wsBaseUrl is provided (from agentConfig.wsBaseUrl in the deploy-agent
8783
+ * response), use it directly — it points at the eshal frontend /voice/ws
8784
+ * endpoint which proxies in-cluster to knowledge-api.
8785
+ *
8786
+ * For in-app use (apiBaseUrl IS the eshal frontend), derives from apiBaseUrl.
8790
8787
  *
8791
8788
  * @param {string} apiBaseUrl - Frontend base URL, e.g. https://demo.eshal.ai
8792
- * @returns {string} Voice WS base, e.g. wss://demo.eshal.ai/voice/ws
8789
+ * @param {string} [wsBaseUrl] - Override from agentConfig, e.g. wss://dev.eshal.ai/voice/ws
8790
+ * @returns {string} Voice WS base URL
8793
8791
  */
8794
- const getWebSocketUrl = apiBaseUrl => {
8792
+ const getWebSocketUrl = (apiBaseUrl, wsBaseUrl) => {
8793
+ if (wsBaseUrl) return wsBaseUrl.replace(/\/$/, '');
8795
8794
  if (!apiBaseUrl) {
8796
8795
  return 'wss://dev.eshal.ai/voice/ws';
8797
8796
  }
@@ -9142,6 +9141,7 @@
9142
9141
  welcomeMessage,
9143
9142
  quickQuestions = [],
9144
9143
  apiBaseUrl,
9144
+ wsBaseUrl,
9145
9145
  apiKey,
9146
9146
  organizationId,
9147
9147
  getAuthToken,
@@ -9312,9 +9312,9 @@
9312
9312
  const visitorProfileRef = reactExports.useRef(null);
9313
9313
  const websocketUrl = reactExports.useMemo(() => {
9314
9314
  if (!organizationId) return null;
9315
- const resolvedWsBaseUrl = getWebSocketUrl(apiBaseUrl);
9315
+ const resolvedWsBaseUrl = getWebSocketUrl(apiBaseUrl, wsBaseUrl);
9316
9316
  return "".concat(resolvedWsBaseUrl, "/").concat(organizationId, "/").concat(bidiSessionId);
9317
- }, [apiBaseUrl, organizationId, bidiSessionId]);
9317
+ }, [apiBaseUrl, wsBaseUrl, organizationId, bidiSessionId]);
9318
9318
  const getNextMessageId = reactExports.useCallback(() => {
9319
9319
  const id = "msg-".concat(messageIdRef.current);
9320
9320
  messageIdRef.current += 1;
@@ -100726,7 +100726,7 @@
100726
100726
 
100727
100727
  // Map API response to widget props (use props as overrides if provided)
100728
100728
  const widgetConfig = reactExports.useMemo(() => {
100729
- var _agentConfig$config, _cfg$identity, _cfg$branding, _cfg$typography, _cfg$messages, _cfg$voice, _cfg$onboarding, _cfg$disclaimer, _cfg$csat, _cfg$inactivity, _cfg$behavior, _cfg$security, _cfg$layout, _ref2, _messages$bundles$loc, _messages$bundles, _messages$bundles$en, _messages$bundles2, _ref3, _ref4, _ref5, _ref6, _branding$chatbotAvat, _branding$chatbotAvat2, _ref7, _ref8, _ref9, _ref0, _ref1, _ref10, _ref11, _ref12, _typography$headerTex, _ref13, _ref14, _ref15, _ref16, _ref17, _ref18, _inactivity$timeoutVa, _inactivity$timeoutUn, _ref19, _ref20, _ref21, _ref22, _ref23, _ref24, _ref25, _ref26, _csat$enabled, _csat$format, _csat$prompt, _csat$triggerType, _csat$idleTimeoutMins, _csat$followUpEnabled, _csat$followUpPrompt, _behavior$autoPromptE, _behavior$allowFeedba, _behavior$provideCita, _agentConfig$organiza;
100729
+ var _agentConfig$config, _cfg$identity, _cfg$branding, _cfg$typography, _cfg$messages, _cfg$voice, _cfg$onboarding, _cfg$disclaimer, _cfg$csat, _cfg$inactivity, _cfg$behavior, _cfg$security, _cfg$layout, _ref2, _messages$bundles$loc, _messages$bundles, _messages$bundles$en, _messages$bundles2, _ref3, _ref4, _ref5, _ref6, _branding$chatbotAvat, _branding$chatbotAvat2, _ref7, _ref8, _ref9, _ref0, _ref1, _ref10, _ref11, _ref12, _typography$headerTex, _ref13, _ref14, _ref15, _ref16, _ref17, _ref18, _inactivity$timeoutVa, _inactivity$timeoutUn, _ref19, _ref20, _ref21, _ref22, _ref23, _ref24, _ref25, _ref26, _csat$enabled, _csat$format, _csat$prompt, _csat$triggerType, _csat$idleTimeoutMins, _csat$followUpEnabled, _csat$followUpPrompt, _behavior$autoPromptE, _behavior$allowFeedba, _behavior$provideCita, _agentConfig$organiza, _agentConfig$wsBaseUr;
100730
100730
  if (!agentConfig) {
100731
100731
  return null;
100732
100732
  }
@@ -100824,7 +100824,8 @@
100824
100824
  provideCitations: (_behavior$provideCita = behavior.provideCitations) !== null && _behavior$provideCita !== void 0 ? _behavior$provideCita : true,
100825
100825
  // organizationId from the backend response — used internally for
100826
100826
  // session isolation (localStorage keys) and WS paths. Not a user prop.
100827
- organizationId: (_agentConfig$organiza = agentConfig.organizationId) !== null && _agentConfig$organiza !== void 0 ? _agentConfig$organiza : null
100827
+ organizationId: (_agentConfig$organiza = agentConfig.organizationId) !== null && _agentConfig$organiza !== void 0 ? _agentConfig$organiza : null,
100828
+ wsBaseUrl: (_agentConfig$wsBaseUr = agentConfig.wsBaseUrl) !== null && _agentConfig$wsBaseUr !== void 0 ? _agentConfig$wsBaseUr : null
100828
100829
  };
100829
100830
  }, [agentConfig, darkMode, primaryColor, position, companyName, conciergeName, companyLogo, welcomeMessage, quickQuestions, quickQuestionsEnabled, textColor, agentMessageBubbleColor, userMessageBoxColor, assistantTextColor, userTextColor, fontFamily, fontSize, defaultLanguage, headerTextBold, headerTextItalic, enableVoiceInteraction, disclaimerEnabled, disclaimerText, disclaimerPosition, disclaimerLinkLabel, disclaimerLinkUrl, showPoweredBy, onboardingQuestions, onboardingEnabled, collectionPrompt, allowedDomains, agentMessageBubbleFontFamily, agentMessageBubbleFontSize, userMessageBubbleFontFamily, userMessageBubbleFontSize
100830
100831
  // CSAT dependencies
@@ -100895,6 +100896,7 @@
100895
100896
  welcomeMessage: widgetConfig.welcomeMessage,
100896
100897
  quickQuestions: widgetConfig.quickQuestions,
100897
100898
  apiBaseUrl,
100899
+ wsBaseUrl: widgetConfig.wsBaseUrl,
100898
100900
  apiKey,
100899
100901
  organizationId: widgetConfig.organizationId,
100900
100902
  getAuthToken,