@eshal-bot/chat-widget 0.1.113 → 0.1.115

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-DWLdojrt.esm.js";import"react";import"react-dom/client";import"react-dom";import"react/jsx-runtime";
1
+ export{S as default}from"./chat-widget-index-DryngjDK.esm.js";import"react";import"react-dom/client";import"react-dom";import"react/jsx-runtime";
@@ -12051,7 +12051,7 @@
12051
12051
  * See the LICENSE file in the root directory of this source tree.
12052
12052
  */
12053
12053
 
12054
- const __iconNode$i = [["path", {
12054
+ const __iconNode$j = [["path", {
12055
12055
  d: "M2 10v3",
12056
12056
  key: "1fnikh"
12057
12057
  }], ["path", {
@@ -12070,7 +12070,20 @@
12070
12070
  d: "M22 10v3",
12071
12071
  key: "154ddg"
12072
12072
  }]];
12073
- const AudioLines = createLucideIcon("audio-lines", __iconNode$i);
12073
+ const AudioLines = createLucideIcon("audio-lines", __iconNode$j);
12074
+
12075
+ /**
12076
+ * @license lucide-react v0.575.0 - ISC
12077
+ *
12078
+ * This source code is licensed under the ISC license.
12079
+ * See the LICENSE file in the root directory of this source tree.
12080
+ */
12081
+
12082
+ const __iconNode$i = [["path", {
12083
+ d: "M20 6 9 17l-5-5",
12084
+ key: "1gmf2c"
12085
+ }]];
12086
+ const Check = createLucideIcon("check", __iconNode$i);
12074
12087
 
12075
12088
  /**
12076
12089
  * @license lucide-react v0.575.0 - ISC
@@ -15070,13 +15083,53 @@
15070
15083
  downloadingKey
15071
15084
  };
15072
15085
  }
15073
- const AssistantMessage = _ref8 => {
15086
+
15087
+ // EV-2719: per-message copy, alongside the header's existing whole-chat
15088
+ // "Copy Chat" action. Styled to match the thumbs up/down buttons below
15089
+ // (same size/color classes) and always visible rather than hover-only -
15090
+ // this widget runs on customer sites where touch devices with no hover
15091
+ // state are common, unlike the desktop-first admin Inbox.
15092
+ function CopyMessageButton(_ref8) {
15093
+ let {
15094
+ content,
15095
+ isDark
15096
+ } = _ref8;
15097
+ const [copied, setCopied] = reactExports.useState(false);
15098
+ const handleCopy = reactExports.useCallback(() => {
15099
+ var _navigator$clipboard;
15100
+ if (!content) return;
15101
+ (_navigator$clipboard = navigator.clipboard) === null || _navigator$clipboard === void 0 || _navigator$clipboard.writeText(content).catch(() => {});
15102
+ setCopied(true);
15103
+ setTimeout(() => setCopied(false), 1500);
15104
+ }, [content]);
15105
+ return /*#__PURE__*/jsxRuntimeExports.jsx("button", {
15106
+ type: "button",
15107
+ onClick: handleCopy,
15108
+ className: "p-0.5 rounded transition-colors ".concat(isDark ? "text-gray-500 hover:text-gray-300" : "text-gray-400 hover:text-gray-600"),
15109
+ style: {
15110
+ border: "none",
15111
+ background: "transparent",
15112
+ appearance: "none",
15113
+ WebkitAppearance: "none",
15114
+ cursor: "pointer"
15115
+ },
15116
+ "aria-label": copied ? "Copied" : "Copy message",
15117
+ title: copied ? "Copied" : "Copy message",
15118
+ children: copied ? /*#__PURE__*/jsxRuntimeExports.jsx(Check, {
15119
+ className: "w-3 h-3 text-green-500"
15120
+ }) : /*#__PURE__*/jsxRuntimeExports.jsx(Copy, {
15121
+ className: "w-3 h-3"
15122
+ })
15123
+ });
15124
+ }
15125
+ const AssistantMessage = _ref9 => {
15074
15126
  let {
15075
15127
  message,
15076
15128
  formatTime,
15077
15129
  isDark,
15078
15130
  primaryColor,
15079
15131
  agentMessageBubbleColor,
15132
+ resolvedAgentBubbleColor,
15080
15133
  textColor,
15081
15134
  assistantTextColor,
15082
15135
  fontFamily,
@@ -15095,7 +15148,7 @@
15095
15148
  provideCitations = true,
15096
15149
  onFeedback,
15097
15150
  headerTextColor
15098
- } = _ref8;
15151
+ } = _ref9;
15099
15152
  const rawContent = typeof message.content === "string" ? message.content : "";
15100
15153
  // 2026-07-14 - `[N]` markers are preserved verbatim in `displayContent`
15101
15154
  // so the ReactMarkdown pipeline's `rehypeCitations` plugin can spot
@@ -15188,7 +15241,14 @@
15188
15241
  setPendingFeedback(null);
15189
15242
  }, []);
15190
15243
  const isError = (message === null || message === void 0 ? void 0 : message.isError) === true;
15191
- const bubbleColor = isError ? isDark ? "rgba(239,68,68,0.15)" : "#fee2e2" : agentMessageBubbleColor !== undefined && agentMessageBubbleColor !== null ? agentMessageBubbleColor : isDark ? "#1f2937" : "#FFFFFF";
15244
+ // EV-2677: ChatWindow computes resolvedAgentBubbleColor (dark-mode-aware -
15245
+ // see its useMemo) but this used to fall through to agentMessageBubbleColor
15246
+ // (raw) / a hardcoded isDark ternary instead, same dead-path bug already
15247
+ // fixed for resolvedUserMessageColor above. No visible symptom today since
15248
+ // ChatWindow's dark-mode default (#1f2937) coincidentally matches this
15249
+ // component's own fallback, but wiring it through removes the duplicate,
15250
+ // independently-maintained color logic.
15251
+ const bubbleColor = isError ? isDark ? "rgba(239,68,68,0.15)" : "#fee2e2" : resolvedAgentBubbleColor !== undefined && resolvedAgentBubbleColor !== null ? resolvedAgentBubbleColor : agentMessageBubbleColor !== undefined && agentMessageBubbleColor !== null ? agentMessageBubbleColor : isDark ? "#1f2937" : "#FFFFFF";
15192
15252
  const hasCustomBubbleColor = agentMessageBubbleColor !== undefined && agentMessageBubbleColor !== null && agentMessageBubbleColor !== "#ffffff" && agentMessageBubbleColor !== "#FFFFFF" && agentMessageBubbleColor !== "#1f2937";
15193
15253
  const messageTextColor = isError ? isDark ? "#fca5a5" : "#991b1b" : assistantTextColor !== undefined && assistantTextColor !== null ? assistantTextColor : textColor !== undefined && textColor !== null ? textColor : isDark ? "#f3f4f6" : "#1A1A1A";
15194
15254
  const messageFontFamily = agentMessageBubbleFontFamily !== undefined && agentMessageBubbleFontFamily !== null ? agentMessageBubbleFontFamily : fontFamily !== undefined && fontFamily !== null ? fontFamily : "Inter";
@@ -15311,6 +15371,9 @@
15311
15371
  className: "text-xs leading-none ".concat(isDark ? "text-gray-400" : "text-gray-500"),
15312
15372
  dir: "auto",
15313
15373
  children: formatTime(message.timestamp)
15374
+ }), !isTypingMessage && !message.isProcessing && displayContent && /*#__PURE__*/jsxRuntimeExports.jsx(CopyMessageButton, {
15375
+ content: displayContent,
15376
+ isDark: isDark
15314
15377
  }), allowFeedback !== false && onFeedback && !isTypingMessage && !message.isProcessing && displayContent && message.type !== 'welcome' && !message.isWelcome && /*#__PURE__*/jsxRuntimeExports.jsxs("div", {
15315
15378
  className: "flex items-center gap-0.5 ml-0.5",
15316
15379
  children: [/*#__PURE__*/jsxRuntimeExports.jsx("button", {
@@ -15400,7 +15463,7 @@
15400
15463
  })
15401
15464
  );
15402
15465
  };
15403
- const UserMessage = _ref9 => {
15466
+ const UserMessage = _ref0 => {
15404
15467
  let {
15405
15468
  message,
15406
15469
  formatTime,
@@ -15415,7 +15478,7 @@
15415
15478
  fontSize,
15416
15479
  isDark,
15417
15480
  isRtl
15418
- } = _ref9;
15481
+ } = _ref0;
15419
15482
  const primary = resolvedUserMessageColor !== undefined && resolvedUserMessageColor !== null ? resolvedUserMessageColor : userMessageBoxColor !== undefined && userMessageBoxColor !== null ? userMessageBoxColor : primaryColor !== undefined && primaryColor !== null ? primaryColor : "#2563eb";
15420
15483
  const messageTextColor = userTextColor !== undefined && userTextColor !== null ? userTextColor : textColor !== undefined && textColor !== null ? textColor : "#FFFFFF";
15421
15484
  const messageFontFamily = userMessageBubbleFontFamily !== undefined && userMessageBubbleFontFamily !== null ? userMessageBubbleFontFamily : fontFamily !== undefined && fontFamily !== null ? fontFamily : "Inter";
@@ -15505,15 +15568,21 @@
15505
15568
  },
15506
15569
  children: message.content
15507
15570
  })
15508
- }), /*#__PURE__*/jsxRuntimeExports.jsx("p", {
15509
- className: "text-xs mt-1.5 px-1 ".concat(isDark ? "text-gray-400" : "text-gray-500"),
15510
- dir: "auto",
15511
- children: formatTime(message.timestamp)
15571
+ }), /*#__PURE__*/jsxRuntimeExports.jsxs("div", {
15572
+ className: "flex items-center gap-1.5 mt-1.5 px-1",
15573
+ children: [/*#__PURE__*/jsxRuntimeExports.jsx("p", {
15574
+ className: "text-xs leading-none ".concat(isDark ? "text-gray-400" : "text-gray-500"),
15575
+ dir: "auto",
15576
+ children: formatTime(message.timestamp)
15577
+ }), message.content && message.content.trim() !== "" && /*#__PURE__*/jsxRuntimeExports.jsx(CopyMessageButton, {
15578
+ content: message.content,
15579
+ isDark: isDark
15580
+ })]
15512
15581
  })]
15513
15582
  })
15514
15583
  });
15515
15584
  };
15516
- const MessageBubble = _ref0 => {
15585
+ const MessageBubble = _ref1 => {
15517
15586
  let {
15518
15587
  message,
15519
15588
  isDark,
@@ -15544,7 +15613,7 @@
15544
15613
  provideCitations,
15545
15614
  onFeedback,
15546
15615
  headerTextColor
15547
- } = _ref0;
15616
+ } = _ref1;
15548
15617
  if (!message) {
15549
15618
  return null;
15550
15619
  }
@@ -15571,6 +15640,7 @@
15571
15640
  isDark: isDark,
15572
15641
  primaryColor: primaryColor,
15573
15642
  agentMessageBubbleColor: agentMessageBubbleColor,
15643
+ resolvedAgentBubbleColor: resolvedAgentBubbleColor,
15574
15644
  textColor: textColor,
15575
15645
  assistantTextColor: assistantTextColor,
15576
15646
  fontFamily: fontFamily,
@@ -16657,6 +16727,7 @@
16657
16727
  isDark: isDark,
16658
16728
  primaryColor: primaryColor,
16659
16729
  agentMessageBubbleColor: agentMessageBubbleColor,
16730
+ resolvedAgentBubbleColor: resolvedAgentBubbleColor,
16660
16731
  userMessageBoxColor: userMessageBoxColor,
16661
16732
  textColor: textColor,
16662
16733
  assistantTextColor: assistantTextColor,
@@ -17537,6 +17608,7 @@
17537
17608
  onboardingEnabled = false,
17538
17609
  userMessageBubbleFontSize,
17539
17610
  userMessageBoxColor,
17611
+ resolvedUserMessageColor,
17540
17612
  userTextColor,
17541
17613
  promptSuggestions,
17542
17614
  onPromptSuggestionClick,
@@ -17813,8 +17885,11 @@
17813
17885
  };
17814
17886
  }, []);
17815
17887
 
17816
- // Match UserMessage styling for prompt suggestion pills
17817
- const promptPrimary = userMessageBoxColor !== undefined && userMessageBoxColor !== null ? userMessageBoxColor : primaryColor !== undefined && primaryColor !== null ? primaryColor : "#2563eb";
17888
+ // EV-2677: match UserMessage styling for prompt suggestion pills - it reads
17889
+ // resolvedUserMessageColor first (see MessageBubble.jsx's UserMessage), so
17890
+ // this must too, or an unconfigured org gets gray message bubbles but blue
17891
+ // suggestion pills.
17892
+ const promptPrimary = resolvedUserMessageColor !== undefined && resolvedUserMessageColor !== null ? resolvedUserMessageColor : userMessageBoxColor !== undefined && userMessageBoxColor !== null ? userMessageBoxColor : primaryColor !== undefined && primaryColor !== null ? primaryColor : "#2563eb";
17818
17893
  const promptTextColor = userTextColor !== undefined && userTextColor !== null ? userTextColor : textColor !== undefined && textColor !== null ? textColor : "#FFFFFF";
17819
17894
  const promptFontFamily = userMessageBubbleFontFamily !== undefined && userMessageBubbleFontFamily !== null ? userMessageBubbleFontFamily : fontFamily !== undefined && fontFamily !== null ? fontFamily : "Inter";
17820
17895
  const promptFontSize = userMessageBubbleFontSize !== undefined && userMessageBubbleFontSize !== null ? userMessageBubbleFontSize : fontSize !== undefined && fontSize !== null ? fontSize : "14px";
@@ -20105,6 +20180,7 @@
20105
20180
  onboardingCompleted: onboardingCompleted,
20106
20181
  onboardingEnabled: onboardingEnabled,
20107
20182
  userMessageBoxColor: userMessageBoxColor,
20183
+ resolvedUserMessageColor: resolvedUserMessageColor,
20108
20184
  userTextColor: userTextColor,
20109
20185
  promptSuggestions: showResolveForm || isConversationResolved || autoPromptEnabled === false || isLoading ? [] : stablePromptSuggestions,
20110
20186
  onPromptSuggestionClick: stableOnPromptSuggestionClick,