@webless/agent 0.9.2 → 0.9.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.
package/dist/embed.js CHANGED
@@ -9,7 +9,7 @@ import {
9
9
  resetAgentPanel,
10
10
  resolveAgentRuntimeConfig,
11
11
  submitAgentPanel
12
- } from "./chunk-3E632FNE.js";
12
+ } from "./chunk-JIM5AOVC.js";
13
13
 
14
14
  // src/embed/mount.tsx
15
15
  import { createRoot } from "react-dom/client";
package/dist/react.cjs CHANGED
@@ -4798,6 +4798,20 @@ function InteractiveBookingCard({
4798
4798
 
4799
4799
  // src/react/components/MessageBubble/MessageBubble.tsx
4800
4800
  var import_streamdown = require("streamdown");
4801
+
4802
+ // src/react/lib/resolve-message-url.ts
4803
+ function resolveMessageUrl(safeUrl, baseUrl) {
4804
+ if (!safeUrl || !baseUrl) return safeUrl;
4805
+ try {
4806
+ const base = new URL(baseUrl);
4807
+ if (base.protocol !== "https:" && base.protocol !== "http:") return "";
4808
+ return new URL(safeUrl, base).href;
4809
+ } catch {
4810
+ return "";
4811
+ }
4812
+ }
4813
+
4814
+ // src/react/components/MessageBubble/MessageBubble.tsx
4801
4815
  var import_styles = require("streamdown/styles.css");
4802
4816
  var import_jsx_runtime7 = require("react/jsx-runtime");
4803
4817
  function normalizeDedupeText(text2) {
@@ -4840,6 +4854,7 @@ function MessageBubble({
4840
4854
  brandLogoUrl,
4841
4855
  bookingDisabled = false,
4842
4856
  bookingReadOnly = false,
4857
+ linkBaseUrl,
4843
4858
  offer,
4844
4859
  onBook
4845
4860
  }) {
@@ -4872,6 +4887,10 @@ function MessageBubble({
4872
4887
  isAnimating: isStreaming,
4873
4888
  linkSafety: { enabled: false },
4874
4889
  mode: isStreaming ? "streaming" : "static",
4890
+ urlTransform: (url, key, node) => resolveMessageUrl(
4891
+ (0, import_streamdown.defaultUrlTransform)(url, key, node) ?? "",
4892
+ key === "href" ? linkBaseUrl : void 0
4893
+ ),
4875
4894
  skipHtml: true,
4876
4895
  children: displayText
4877
4896
  }
@@ -4889,7 +4908,8 @@ function MessageBubble({
4889
4908
  /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { children: citation.label })
4890
4909
  ] }) }, citation.id)) }) : null
4891
4910
  ] });
4892
- if (!displayText && !message.searchResults?.length && offers.length === 0) return null;
4911
+ if (!displayText && !message.searchResults?.length && offers.length === 0)
4912
+ return null;
4893
4913
  return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("article", { className: "message-bubble message-bubble--agent", children: [
4894
4914
  displayText || message.searchResults?.length ? showBrandLogo ? /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "message-bubble__agent-row", children: [
4895
4915
  /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "message-bubble__agent-avatar", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
@@ -7366,6 +7386,7 @@ function AgentTranscript({
7366
7386
  activities = [],
7367
7387
  theme,
7368
7388
  colorScheme,
7389
+ linkBaseUrl,
7369
7390
  agentLabel = "Agent",
7370
7391
  visitorLabel = "Visitor",
7371
7392
  label = "Conversation transcript",
@@ -7405,6 +7426,7 @@ function AgentTranscript({
7405
7426
  MessageBubble,
7406
7427
  {
7407
7428
  message: entry.role === "agent" ? { ...entry, streaming: false } : entry,
7429
+ linkBaseUrl,
7408
7430
  bookingReadOnly: true,
7409
7431
  bookingDisabled: true
7410
7432
  }