@webless/agent 0.13.2 → 0.14.0

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/react.cjs CHANGED
@@ -46,7 +46,7 @@ __export(react_exports, {
46
46
  module.exports = __toCommonJS(react_exports);
47
47
 
48
48
  // src/react/components/AgentWidget/AgentWidget.tsx
49
- var import_react20 = require("react");
49
+ var import_react19 = require("react");
50
50
 
51
51
  // src/react/page-shift.ts
52
52
  var import_react = require("react");
@@ -4219,7 +4219,7 @@ function unregisterAgentPanelController(customerId) {
4219
4219
  }
4220
4220
 
4221
4221
  // src/react/components/AgentRail/AgentRail.tsx
4222
- var import_react18 = require("react");
4222
+ var import_react17 = require("react");
4223
4223
 
4224
4224
  // src/react/types/conversation.ts
4225
4225
  var defaultAgentRailTheme = {
@@ -4231,7 +4231,7 @@ var defaultAgentRailTheme = {
4231
4231
  surfaceMuted: "#f4f6fb",
4232
4232
  text: "#171b2a",
4233
4233
  textMuted: "#5a6378",
4234
- textSubtle: "#8a94a8",
4234
+ textSubtle: "#6b7280",
4235
4235
  border: "rgb(42 51 70 / 0.1)",
4236
4236
  visitorBubble: "#f3edff",
4237
4237
  visitorText: "#171b2a",
@@ -4260,9 +4260,146 @@ var defaultDarkAgentRailTheme = {
4260
4260
  };
4261
4261
 
4262
4262
  // src/react/lib/agent-theme.ts
4263
+ var HEX_COLOR_PATTERN = /^#(?:[\dA-Fa-f]{3}|[\dA-Fa-f]{6})$/;
4264
+ var NAMED_COLOR_HEX = Object.fromEntries(
4265
+ "aliceblue:#f0f8ff,antiquewhite:#faebd7,aqua:#00ffff,aquamarine:#7fffd4,azure:#f0ffff,beige:#f5f5dc,bisque:#ffe4c4,black:#000000,blanchedalmond:#ffebcd,blue:#0000ff,blueviolet:#8a2be2,brown:#a52a2a,burlywood:#deb887,cadetblue:#5f9ea0,chartreuse:#7fff00,chocolate:#d2691e,coral:#ff7f50,cornflowerblue:#6495ed,cornsilk:#fff8dc,crimson:#dc143c,cyan:#00ffff,darkblue:#00008b,darkcyan:#008b8b,darkgoldenrod:#b8860b,darkgray:#a9a9a9,darkgreen:#006400,darkgrey:#a9a9a9,darkkhaki:#bdb76b,darkmagenta:#8b008b,darkolivegreen:#556b2f,darkorange:#ff8c00,darkorchid:#9932cc,darkred:#8b0000,darksalmon:#e9967a,darkseagreen:#8fbc8f,darkslateblue:#483d8b,darkslategray:#2f4f4f,darkslategrey:#2f4f4f,darkturquoise:#00ced1,darkviolet:#9400d3,deeppink:#ff1493,deepskyblue:#00bfff,dimgray:#696969,dimgrey:#696969,dodgerblue:#1e90ff,firebrick:#b22222,floralwhite:#fffaf0,forestgreen:#228b22,fuchsia:#ff00ff,gainsboro:#dcdcdc,ghostwhite:#f8f8ff,gold:#ffd700,goldenrod:#daa520,gray:#808080,green:#008000,greenyellow:#adff2f,grey:#808080,honeydew:#f0fff0,hotpink:#ff69b4,indianred:#cd5c5c,indigo:#4b0082,ivory:#fffff0,khaki:#f0e68c,lavender:#e6e6fa,lavenderblush:#fff0f5,lawngreen:#7cfc00,lemonchiffon:#fffacd,lightblue:#add8e6,lightcoral:#f08080,lightcyan:#e0ffff,lightgoldenrodyellow:#fafad2,lightgray:#d3d3d3,lightgreen:#90ee90,lightgrey:#d3d3d3,lightpink:#ffb6c1,lightsalmon:#ffa07a,lightseagreen:#20b2aa,lightskyblue:#87cefa,lightslategray:#778899,lightslategrey:#778899,lightsteelblue:#b0c4de,lightyellow:#ffffe0,lime:#00ff00,limegreen:#32cd32,linen:#faf0e6,magenta:#ff00ff,maroon:#800000,mediumaquamarine:#66cdaa,mediumblue:#0000cd,mediumorchid:#ba55d3,mediumpurple:#9370db,mediumseagreen:#3cb371,mediumslateblue:#7b68ee,mediumspringgreen:#00fa9a,mediumturquoise:#48d1cc,mediumvioletred:#c71585,midnightblue:#191970,mintcream:#f5fffa,mistyrose:#ffe4e1,moccasin:#ffe4b5,navajowhite:#ffdead,navy:#000080,oldlace:#fdf5e6,olive:#808000,olivedrab:#6b8e23,orange:#ffa500,orangered:#ff4500,orchid:#da70d6,palegoldenrod:#eee8aa,palegreen:#98fb98,paleturquoise:#afeeee,palevioletred:#db7093,papayawhip:#ffefd5,peachpuff:#ffdab9,peru:#cd853f,pink:#ffc0cb,plum:#dda0dd,powderblue:#b0e0e6,purple:#800080,rebeccapurple:#663399,red:#ff0000,rosybrown:#bc8f8f,royalblue:#4169e1,saddlebrown:#8b4513,salmon:#fa8072,sandybrown:#f4a460,seagreen:#2e8b57,seashell:#fff5ee,sienna:#a0522d,silver:#c0c0c0,skyblue:#87ceeb,slateblue:#6a5acd,slategray:#708090,slategrey:#708090,snow:#fffafa,springgreen:#00ff7f,steelblue:#4682b4,tan:#d2b48c,teal:#008080,thistle:#d8bfd8,tomato:#ff6347,turquoise:#40e0d0,violet:#ee82ee,wheat:#f5deb3,white:#ffffff,whitesmoke:#f5f5f5,yellow:#ffff00,yellowgreen:#9acd32".split(",").map((entry) => entry.split(":"))
4266
+ );
4267
+ function rgbLuminance(r, g, b) {
4268
+ const [lr = 0, lg = 0, lb = 0] = [r, g, b].map((channel) => {
4269
+ const normalized = channel / 255;
4270
+ return normalized <= 0.03928 ? normalized / 12.92 : Math.pow((normalized + 0.055) / 1.055, 2.4);
4271
+ });
4272
+ return 0.2126 * lr + 0.7152 * lg + 0.0722 * lb;
4273
+ }
4274
+ function hexColorLuminance(value) {
4275
+ const normalized = value.trim();
4276
+ if (!HEX_COLOR_PATTERN.test(normalized)) return null;
4277
+ const raw = normalized.slice(1);
4278
+ const full = raw.length === 3 ? raw.split("").map((channel) => channel + channel).join("") : raw;
4279
+ const [r = 0, g = 0, b = 0] = [0, 2, 4].map(
4280
+ (index) => parseInt(full.slice(index, index + 2), 16)
4281
+ );
4282
+ return rgbLuminance(r, g, b);
4283
+ }
4284
+ function splitColorBody(body) {
4285
+ let colorPart = body;
4286
+ let alphaToken;
4287
+ const slashIndex = body.lastIndexOf("/");
4288
+ if (slashIndex >= 0) {
4289
+ colorPart = body.slice(0, slashIndex);
4290
+ alphaToken = body.slice(slashIndex + 1);
4291
+ }
4292
+ const parts = colorPart.includes(",") ? colorPart.split(",") : colorPart.trim().split(/\s+/);
4293
+ if (colorPart.includes(",") && parts.length === 4) {
4294
+ alphaToken = parts.pop();
4295
+ }
4296
+ return { parts, alphaToken };
4297
+ }
4298
+ function parseAlpha(token) {
4299
+ if (token === void 0) return 1;
4300
+ const trimmed = token.trim();
4301
+ if (!trimmed) return 1;
4302
+ return trimmed.endsWith("%") ? parseFloat(trimmed) / 100 : parseFloat(trimmed);
4303
+ }
4304
+ function parseRgbChannels(value) {
4305
+ const match = /^rgba?\(\s*([^)]*?)\s*\)$/i.exec(value);
4306
+ if (!match) return null;
4307
+ const { parts, alphaToken } = splitColorBody(match[1] ?? "");
4308
+ if (parts.length < 3) return null;
4309
+ const alpha = parseAlpha(alphaToken);
4310
+ const channels = parts.slice(0, 3).map((part) => {
4311
+ const token = part.trim();
4312
+ return token.endsWith("%") ? parseFloat(token) / 100 * 255 : parseFloat(token);
4313
+ });
4314
+ if ([...channels, alpha].some((channel) => Number.isNaN(channel))) {
4315
+ return null;
4316
+ }
4317
+ return [channels[0] ?? 0, channels[1] ?? 0, channels[2] ?? 0, alpha];
4318
+ }
4319
+ function parseHslChannels(value) {
4320
+ const match = /^hsla?\(\s*([^)]*?)\s*\)$/i.exec(value);
4321
+ if (!match) return null;
4322
+ const { parts, alphaToken } = splitColorBody(match[1] ?? "");
4323
+ if (parts.length < 3) return null;
4324
+ const alpha = parseAlpha(alphaToken);
4325
+ const hueToken = (parts[0] ?? "").trim().toLowerCase();
4326
+ const hueRaw = parseFloat(hueToken);
4327
+ const saturation = parseFloat(parts[1] ?? "");
4328
+ const lightness = parseFloat(parts[2] ?? "");
4329
+ if ([hueRaw, saturation, lightness, alpha].some((n) => Number.isNaN(n))) {
4330
+ return null;
4331
+ }
4332
+ const hueDeg = hueToken.endsWith("turn") ? hueRaw * 360 : hueToken.endsWith("rad") ? hueRaw * 180 / Math.PI : hueRaw;
4333
+ const s = saturation / 100;
4334
+ const l = lightness / 100;
4335
+ const chroma = (1 - Math.abs(2 * l - 1)) * s;
4336
+ const huePrime = (hueDeg % 360 + 360) % 360 / 60;
4337
+ const x = chroma * (1 - Math.abs(huePrime % 2 - 1));
4338
+ const pairs = [
4339
+ [chroma, x, 0],
4340
+ [x, chroma, 0],
4341
+ [0, chroma, x],
4342
+ [0, x, chroma],
4343
+ [x, 0, chroma],
4344
+ [chroma, 0, x]
4345
+ ];
4346
+ const [r1 = 0, g1 = 0, b1 = 0] = pairs[Math.floor(huePrime) % 6] ?? [];
4347
+ const m = l - chroma / 2;
4348
+ return [(r1 + m) * 255, (g1 + m) * 255, (b1 + m) * 255, alpha];
4349
+ }
4350
+ var colorProbeElement = null;
4351
+ function normalizeColorWithDom(value) {
4352
+ if (typeof document === "undefined") return null;
4353
+ colorProbeElement ??= document.createElement("span");
4354
+ colorProbeElement.style.color = "";
4355
+ colorProbeElement.style.color = value;
4356
+ return colorProbeElement.style.color || null;
4357
+ }
4358
+ var LIGHT_SURFACE_LUMINANCE_THRESHOLD = 0.35;
4359
+ function channelsLuminance([r, g, b, alpha]) {
4360
+ if (alpha >= 1) return rgbLuminance(r, g, b);
4361
+ if (alpha <= 0) return null;
4362
+ const overBlack = rgbLuminance(r * alpha, g * alpha, b * alpha);
4363
+ const overWhite = rgbLuminance(
4364
+ r * alpha + (1 - alpha) * 255,
4365
+ g * alpha + (1 - alpha) * 255,
4366
+ b * alpha + (1 - alpha) * 255
4367
+ );
4368
+ const blackIsLight = overBlack > LIGHT_SURFACE_LUMINANCE_THRESHOLD;
4369
+ const whiteIsLight = overWhite > LIGHT_SURFACE_LUMINANCE_THRESHOLD;
4370
+ if (blackIsLight !== whiteIsLight) return null;
4371
+ return blackIsLight ? Math.min(overBlack, overWhite) : Math.max(overBlack, overWhite);
4372
+ }
4373
+ function cssColorLuminance(value) {
4374
+ const trimmed = value.trim();
4375
+ if (!trimmed) return null;
4376
+ const namedHex = NAMED_COLOR_HEX[trimmed.toLowerCase()];
4377
+ const hex = hexColorLuminance(namedHex ?? trimmed);
4378
+ if (hex !== null) return hex;
4379
+ const channels = parseRgbChannels(trimmed) ?? parseHslChannels(trimmed);
4380
+ if (channels) return channelsLuminance(channels);
4381
+ const normalized = normalizeColorWithDom(trimmed);
4382
+ if (!normalized || normalized === trimmed) return null;
4383
+ const normalizedHex = hexColorLuminance(normalized);
4384
+ if (normalizedHex !== null) return normalizedHex;
4385
+ const normalizedChannels = parseRgbChannels(normalized) ?? parseHslChannels(normalized);
4386
+ return normalizedChannels ? channelsLuminance(normalizedChannels) : null;
4387
+ }
4388
+ function resolveEffectiveColorScheme(theme, resolvedColorScheme) {
4389
+ if (resolvedColorScheme !== "dark") return "light";
4390
+ const surface = theme?.surface?.trim();
4391
+ if (!surface) return "dark";
4392
+ const luminance = cssColorLuminance(surface);
4393
+ if (luminance === null) return "dark";
4394
+ return luminance > LIGHT_SURFACE_LUMINANCE_THRESHOLD ? "light" : "dark";
4395
+ }
4263
4396
  function agentThemeStyle(theme, resolvedColorScheme) {
4264
4397
  const brandedTheme = { ...defaultAgentRailTheme, ...theme };
4265
- const resolvedTheme = resolvedColorScheme === "dark" ? {
4398
+ const effectiveColorScheme = resolveEffectiveColorScheme(
4399
+ theme,
4400
+ resolvedColorScheme
4401
+ );
4402
+ const resolvedTheme = effectiveColorScheme === "dark" ? {
4266
4403
  ...brandedTheme,
4267
4404
  brand: theme?.brand ?? defaultDarkAgentRailTheme.brand,
4268
4405
  brandDeep: theme?.brandDeep ?? defaultDarkAgentRailTheme.brandDeep,
@@ -4297,7 +4434,7 @@ function agentThemeStyle(theme, resolvedColorScheme) {
4297
4434
  "--as-danger": resolvedTheme.danger,
4298
4435
  "--as-font-body": resolvedTheme.fontBody,
4299
4436
  "--as-font-display": resolvedTheme.fontDisplay,
4300
- colorScheme: resolvedColorScheme
4437
+ colorScheme: effectiveColorScheme
4301
4438
  };
4302
4439
  }
4303
4440
 
@@ -4501,114 +4638,11 @@ function AgentActivityBubble({
4501
4638
  ] });
4502
4639
  }
4503
4640
 
4504
- // src/react/components/LearnMore/LearnMore.tsx
4641
+ // src/react/components/SearchReferences/SearchReferences.tsx
4505
4642
  var import_react7 = require("react");
4506
4643
  var import_jsx_runtime2 = require("react/jsx-runtime");
4507
- function QuestionIcon() {
4508
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
4509
- "svg",
4510
- {
4511
- viewBox: "0 0 24 24",
4512
- width: "18",
4513
- height: "18",
4514
- fill: "none",
4515
- stroke: "currentColor",
4516
- strokeWidth: "1.5",
4517
- strokeLinecap: "round",
4518
- strokeLinejoin: "round",
4519
- "aria-hidden": "true",
4520
- children: [
4521
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("path", { d: "M7.9 20A9 9 0 1 0 4 16.1L2 22Z" }),
4522
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("path", { d: "M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3" }),
4523
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("path", { d: "M12 17h.01" })
4524
- ]
4525
- }
4526
- );
4527
- }
4528
- function LearnMore({
4529
- results,
4530
- disabled,
4531
- onSelect
4532
- }) {
4533
- const headingId = (0, import_react7.useId)();
4534
- const panelId = (0, import_react7.useId)();
4535
- const [open, setOpen] = (0, import_react7.useState)(true);
4536
- const questions = [
4537
- ...new Set(results.flatMap((result) => result.suggestions ?? []))
4538
- ].slice(0, 3);
4539
- if (!questions.length) return null;
4540
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("section", { className: "learn-more", "aria-labelledby": headingId, children: [
4541
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("h3", { id: headingId, className: "learn-more__heading", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
4542
- "button",
4543
- {
4544
- type: "button",
4545
- className: "learn-more__toggle",
4546
- "aria-expanded": open,
4547
- "aria-controls": panelId,
4548
- onClick: () => setOpen((current) => !current),
4549
- children: [
4550
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { children: "Learn more" }),
4551
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
4552
- "svg",
4553
- {
4554
- className: "learn-more__chevron",
4555
- viewBox: "0 0 16 16",
4556
- fill: "none",
4557
- "aria-hidden": "true",
4558
- children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
4559
- "path",
4560
- {
4561
- d: "M4 6.5l4 4 4-4",
4562
- stroke: "currentColor",
4563
- strokeWidth: "1.6",
4564
- strokeLinecap: "round",
4565
- strokeLinejoin: "round"
4566
- }
4567
- )
4568
- }
4569
- )
4570
- ]
4571
- }
4572
- ) }),
4573
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
4574
- "div",
4575
- {
4576
- id: panelId,
4577
- className: `learn-more__panel${open ? " learn-more__panel--open" : ""}`,
4578
- children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "learn-more__panel-inner", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("ul", { className: "learn-more__questions", children: questions.map((question) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("li", { children: /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
4579
- "button",
4580
- {
4581
- type: "button",
4582
- disabled,
4583
- onClick: () => onSelect(question),
4584
- children: [
4585
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "learn-more__question-icon", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(QuestionIcon, {}) }),
4586
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "learn-more__question-text", children: question }),
4587
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
4588
- "svg",
4589
- {
4590
- className: "learn-more__question-arrow",
4591
- viewBox: "0 0 24 24",
4592
- fill: "none",
4593
- stroke: "currentColor",
4594
- strokeWidth: "1.5",
4595
- "aria-hidden": "true",
4596
- children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("path", { d: "M4 12h16m-7-7 7 7-7 7" })
4597
- }
4598
- )
4599
- ]
4600
- }
4601
- ) }, question)) }) })
4602
- }
4603
- )
4604
- ] });
4605
- }
4606
-
4607
- // src/react/components/SearchReferences/SearchReferences.tsx
4608
- var import_react8 = require("react");
4609
- var import_jsx_runtime3 = require("react/jsx-runtime");
4610
4644
  function SiteIcon() {
4611
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
4645
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
4612
4646
  "svg",
4613
4647
  {
4614
4648
  viewBox: "0 0 24 24",
@@ -4619,15 +4653,15 @@ function SiteIcon() {
4619
4653
  strokeWidth: "1.5",
4620
4654
  "aria-hidden": "true",
4621
4655
  children: [
4622
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("circle", { cx: "12", cy: "12", r: "9" }),
4623
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("ellipse", { cx: "12", cy: "12", rx: "4", ry: "9" }),
4624
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("path", { d: "M3 12h18M5 6.5h14M5 17.5h14" })
4656
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("circle", { cx: "12", cy: "12", r: "9" }),
4657
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("ellipse", { cx: "12", cy: "12", rx: "4", ry: "9" }),
4658
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("path", { d: "M3 12h18M5 6.5h14M5 17.5h14" })
4625
4659
  ]
4626
4660
  }
4627
4661
  );
4628
4662
  }
4629
4663
  function SourceFavicon({ url }) {
4630
- const [failed, setFailed] = (0, import_react8.useState)(false);
4664
+ const [failed, setFailed] = (0, import_react7.useState)(false);
4631
4665
  let faviconUrl = null;
4632
4666
  if (url) {
4633
4667
  try {
@@ -4636,8 +4670,8 @@ function SourceFavicon({ url }) {
4636
4670
  faviconUrl = null;
4637
4671
  }
4638
4672
  }
4639
- if (!faviconUrl || failed) return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(SiteIcon, {});
4640
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
4673
+ if (!faviconUrl || failed) return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(SiteIcon, {});
4674
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
4641
4675
  "img",
4642
4676
  {
4643
4677
  src: faviconUrl,
@@ -4657,37 +4691,53 @@ function searchSources(results) {
4657
4691
  return [{ ...source, url, key }];
4658
4692
  });
4659
4693
  }
4660
- function SearchReferences({
4661
- results,
4662
- mode = "default"
4663
- }) {
4664
- const sources = searchSources(results);
4694
+ function searchActions(results) {
4665
4695
  const seenActions = /* @__PURE__ */ new Set();
4666
- const actions = results.flatMap((result) => {
4696
+ return results.flatMap((result) => {
4667
4697
  const url = safeSearchUrl(result.cta?.url);
4668
4698
  if (!url || !result.cta || seenActions.has(url)) return [];
4669
4699
  seenActions.add(url);
4670
4700
  return [{ label: result.cta.label, url }];
4671
4701
  });
4702
+ }
4703
+ function searchSuggestions(results) {
4704
+ return [
4705
+ ...new Set(results.flatMap((result) => result.suggestions ?? []))
4706
+ ].slice(0, 3);
4707
+ }
4708
+ function searchActionLinkTitle(url) {
4709
+ try {
4710
+ const hostname = new URL(url).hostname.replace(/^www\./, "");
4711
+ return hostname ? `Opens ${hostname} in a new tab` : "Opens in a new tab";
4712
+ } catch {
4713
+ return "Opens in a new tab";
4714
+ }
4715
+ }
4716
+ function SearchReferences({
4717
+ results,
4718
+ mode = "default"
4719
+ }) {
4720
+ const sources = searchSources(results);
4721
+ const actions = searchActions(results);
4672
4722
  if (!(mode !== "actions" && sources.length) && !(mode !== "sources" && actions.length))
4673
4723
  return null;
4674
4724
  const Container = mode === "default" ? "details" : "div";
4675
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "search-references", children: [
4676
- mode !== "actions" && sources.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
4725
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "search-references", children: [
4726
+ mode !== "actions" && sources.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
4677
4727
  Container,
4678
4728
  {
4679
4729
  className: "search-references__disclosure",
4680
4730
  "aria-label": "Sources",
4681
4731
  children: [
4682
- mode === "default" ? /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("summary", { className: "search-references__heading", children: [
4732
+ mode === "default" ? /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("summary", { className: "search-references__heading", children: [
4683
4733
  "Sources (",
4684
4734
  sources.length,
4685
4735
  ")"
4686
4736
  ] }) : null,
4687
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("ul", { className: "search-references__list", children: sources.map((source) => {
4688
- const content = /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_jsx_runtime3.Fragment, { children: [
4689
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "search-references__icon", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(SourceFavicon, { url: source.url }) }),
4690
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
4737
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("ul", { className: "search-references__list", children: sources.map((source) => {
4738
+ const content = /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_jsx_runtime2.Fragment, { children: [
4739
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "search-references__icon", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(SourceFavicon, { url: source.url }) }),
4740
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
4691
4741
  "span",
4692
4742
  {
4693
4743
  className: "search-references__title",
@@ -4695,7 +4745,7 @@ function SearchReferences({
4695
4745
  children: source.title
4696
4746
  }
4697
4747
  ),
4698
- source.url ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
4748
+ source.url ? /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
4699
4749
  "svg",
4700
4750
  {
4701
4751
  className: "search-references__row-arrow",
@@ -4703,12 +4753,17 @@ function SearchReferences({
4703
4753
  fill: "none",
4704
4754
  stroke: "currentColor",
4705
4755
  strokeWidth: "1.5",
4756
+ strokeLinecap: "round",
4757
+ strokeLinejoin: "round",
4706
4758
  "aria-hidden": "true",
4707
- children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("path", { d: "M4 12h16m-7-7 7 7-7 7" })
4759
+ children: [
4760
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("path", { d: "M7 17 17 7" }),
4761
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("path", { d: "M8 7h9v9" })
4762
+ ]
4708
4763
  }
4709
4764
  ) : null
4710
4765
  ] });
4711
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("li", { children: source.url ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
4766
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("li", { children: source.url ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
4712
4767
  "a",
4713
4768
  {
4714
4769
  className: "search-references__source",
@@ -4717,12 +4772,12 @@ function SearchReferences({
4717
4772
  rel: "noopener noreferrer",
4718
4773
  children: content
4719
4774
  }
4720
- ) : /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "search-references__source", children: content }) }, source.key);
4775
+ ) : /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "search-references__source", children: content }) }, source.key);
4721
4776
  }) })
4722
4777
  ]
4723
4778
  }
4724
4779
  ) : null,
4725
- mode !== "sources" && actions.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "search-references__actions", children: actions.map((action) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
4780
+ mode !== "sources" && actions.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "search-references__actions", children: actions.map((action) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
4726
4781
  "a",
4727
4782
  {
4728
4783
  className: "search-references__cta",
@@ -4736,18 +4791,91 @@ function SearchReferences({
4736
4791
  ] });
4737
4792
  }
4738
4793
 
4794
+ // src/react/components/ExploreMore/ExploreMore.tsx
4795
+ var import_jsx_runtime3 = require("react/jsx-runtime");
4796
+ function QuestionIcon() {
4797
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
4798
+ "svg",
4799
+ {
4800
+ viewBox: "0 0 24 24",
4801
+ width: "18",
4802
+ height: "18",
4803
+ fill: "none",
4804
+ stroke: "currentColor",
4805
+ strokeWidth: "1.5",
4806
+ strokeLinecap: "round",
4807
+ strokeLinejoin: "round",
4808
+ "aria-hidden": "true",
4809
+ children: [
4810
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("path", { d: "M7.9 20A9 9 0 1 0 4 16.1L2 22Z" }),
4811
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("path", { d: "M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3" }),
4812
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("path", { d: "M12 17h.01" })
4813
+ ]
4814
+ }
4815
+ );
4816
+ }
4817
+ function ExploreMore({
4818
+ results,
4819
+ disabled,
4820
+ onSelectQuestion,
4821
+ showLearnMore = true,
4822
+ showSources = true
4823
+ }) {
4824
+ const sources = showSources ? searchSources(results) : [];
4825
+ const questions = showLearnMore ? searchSuggestions(results) : [];
4826
+ if (!sources.length && !questions.length) return null;
4827
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "explore-more", children: [
4828
+ sources.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "explore-more__section", children: [
4829
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("p", { className: "explore-more__label", children: [
4830
+ "Based on ",
4831
+ sources.length,
4832
+ " ",
4833
+ sources.length === 1 ? "page" : "pages"
4834
+ ] }),
4835
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(SearchReferences, { results, mode: "sources" })
4836
+ ] }) : null,
4837
+ questions.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "explore-more__section", children: [
4838
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("p", { className: "explore-more__label", children: "Learn more" }),
4839
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("ul", { className: "explore-more__questions", children: questions.map((question) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("li", { children: /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
4840
+ "button",
4841
+ {
4842
+ type: "button",
4843
+ disabled,
4844
+ onClick: () => onSelectQuestion(question),
4845
+ children: [
4846
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "explore-more__question-icon", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(QuestionIcon, {}) }),
4847
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "explore-more__question-text", children: question }),
4848
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
4849
+ "svg",
4850
+ {
4851
+ className: "explore-more__question-arrow",
4852
+ viewBox: "0 0 24 24",
4853
+ fill: "none",
4854
+ stroke: "currentColor",
4855
+ strokeWidth: "1.5",
4856
+ "aria-hidden": "true",
4857
+ children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("path", { d: "M4 12h16m-7-7 7 7-7 7" })
4858
+ }
4859
+ )
4860
+ ]
4861
+ }
4862
+ ) }, question)) })
4863
+ ] }) : null
4864
+ ] });
4865
+ }
4866
+
4739
4867
  // src/react/components/AnswerReceiptDialog/AnswerReceiptDialog.tsx
4740
- var import_react10 = require("react");
4868
+ var import_react9 = require("react");
4741
4869
  var import_react_dom = require("react-dom");
4742
4870
 
4743
4871
  // src/react/components/AgentRail/AgentRailOverlayContext.tsx
4744
- var import_react9 = require("react");
4745
- var AgentRailOverlayContext = (0, import_react9.createContext)(null);
4872
+ var import_react8 = require("react");
4873
+ var AgentRailOverlayContext = (0, import_react8.createContext)(null);
4746
4874
  function useAgentRailPortalRoots() {
4747
- return (0, import_react9.useContext)(AgentRailOverlayContext);
4875
+ return (0, import_react8.useContext)(AgentRailOverlayContext);
4748
4876
  }
4749
4877
  function useAgentRailMenuPortalRoot() {
4750
- return (0, import_react9.useContext)(AgentRailOverlayContext)?.railRef ?? null;
4878
+ return (0, import_react8.useContext)(AgentRailOverlayContext)?.railRef ?? null;
4751
4879
  }
4752
4880
 
4753
4881
  // src/react/components/AnswerReceiptDialog/AnswerReceiptDialog.tsx
@@ -4772,13 +4900,13 @@ function AnswerReceiptDialog({
4772
4900
  summary,
4773
4901
  children
4774
4902
  }) {
4775
- const titleId = (0, import_react10.useId)();
4903
+ const titleId = (0, import_react9.useId)();
4776
4904
  const portalRoots = useAgentRailPortalRoots();
4777
4905
  const overlayRoot = portalRoots?.overlayRef ?? null;
4778
- const cardRef = (0, import_react10.useRef)(null);
4779
- const closeButtonRef = (0, import_react10.useRef)(null);
4780
- const previouslyFocusedRef = (0, import_react10.useRef)(null);
4781
- (0, import_react10.useEffect)(() => {
4906
+ const cardRef = (0, import_react9.useRef)(null);
4907
+ const closeButtonRef = (0, import_react9.useRef)(null);
4908
+ const previouslyFocusedRef = (0, import_react9.useRef)(null);
4909
+ (0, import_react9.useEffect)(() => {
4782
4910
  previouslyFocusedRef.current = document.activeElement instanceof HTMLElement ? document.activeElement : null;
4783
4911
  closeButtonRef.current?.focus({ preventScroll: true });
4784
4912
  const handleKeyDown = (event) => {
@@ -4854,7 +4982,7 @@ function AnswerReceiptDialog({
4854
4982
  }
4855
4983
 
4856
4984
  // src/react/components/Composer/Composer.tsx
4857
- var import_react11 = require("react");
4985
+ var import_react10 = require("react");
4858
4986
  var import_jsx_runtime5 = require("react/jsx-runtime");
4859
4987
  var FORM_SUBMITTED_MESSAGE = "Shared my details";
4860
4988
  function SendIcon() {
@@ -4909,6 +5037,7 @@ function createDraft(form) {
4909
5037
  };
4910
5038
  }
4911
5039
  function Composer({
5040
+ actions,
4912
5041
  disabled = false,
4913
5042
  placeholder = "Ask anything\u2026",
4914
5043
  variant = "default",
@@ -4916,23 +5045,24 @@ function Composer({
4916
5045
  allowFormResume = true,
4917
5046
  onSubmit
4918
5047
  }) {
4919
- const [value, setValue] = (0, import_react11.useState)("");
4920
- const [draft, setDraft] = (0, import_react11.useState)(() => createDraft(form));
4921
- const [multiline, setMultiline] = (0, import_react11.useState)(false);
4922
- const inputRef = (0, import_react11.useRef)(null);
4923
- const firstFieldRef = (0, import_react11.useRef)(null);
4924
- const formRef = (0, import_react11.useRef)(null);
4925
- const formId = (0, import_react11.useId)();
5048
+ const [value, setValue] = (0, import_react10.useState)("");
5049
+ const [draft, setDraft] = (0, import_react10.useState)(() => createDraft(form));
5050
+ const [multiline, setMultiline] = (0, import_react10.useState)(false);
5051
+ const inputRef = (0, import_react10.useRef)(null);
5052
+ const firstFieldRef = (0, import_react10.useRef)(null);
5053
+ const formRef = (0, import_react10.useRef)(null);
5054
+ const formId = (0, import_react10.useId)();
4926
5055
  if (form && form.id !== draft.form?.id) setDraft(createDraft(form));
4927
5056
  const savedForm = allowFormResume && !draft.submitted ? draft.form : null;
4928
5057
  const activeForm = !disabled && draft.expanded ? savedForm : null;
5058
+ const showResumeBadge = Boolean(savedForm) && !activeForm;
4929
5059
  const canSend = !disabled && Boolean(value.trim() || activeForm);
4930
- (0, import_react11.useEffect)(() => {
5060
+ (0, import_react10.useEffect)(() => {
4931
5061
  if (activeForm) firstFieldRef.current?.focus();
4932
5062
  else if ((savedForm || draft.submitted) && !disabled)
4933
5063
  inputRef.current?.focus();
4934
5064
  }, [activeForm?.id, disabled, savedForm?.id, draft.submitted]);
4935
- (0, import_react11.useEffect)(() => {
5065
+ (0, import_react10.useEffect)(() => {
4936
5066
  const input = inputRef.current;
4937
5067
  if (!input) return;
4938
5068
  const check = () => {
@@ -5054,15 +5184,17 @@ function Composer({
5054
5184
  ].filter(Boolean).join(" "),
5055
5185
  onSubmit: handleSubmit,
5056
5186
  children: [
5057
- savedForm ? /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "composer__resume", children: [
5058
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { children: "Share your details and we'll reach out shortly" }),
5059
- !activeForm ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
5187
+ actions || showResumeBadge ? /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "composer__actions", children: [
5188
+ actions,
5189
+ showResumeBadge ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
5060
5190
  "button",
5061
5191
  {
5062
5192
  type: "button",
5193
+ className: "composer__action-badge",
5063
5194
  disabled,
5195
+ title: "Share your details and we'll reach out shortly",
5064
5196
  onClick: () => setDraft((current) => ({ ...current, expanded: true })),
5065
- children: "Request follow-up"
5197
+ children: "Review follow-up"
5066
5198
  }
5067
5199
  ) : null
5068
5200
  ] }) : null,
@@ -5202,10 +5334,10 @@ function FollowUpChips({
5202
5334
  }
5203
5335
 
5204
5336
  // src/react/components/MessageBubble/MessageBubble.tsx
5205
- var import_react13 = require("react");
5337
+ var import_react12 = require("react");
5206
5338
 
5207
5339
  // src/react/components/BookingCard/BookingCard.tsx
5208
- var import_react12 = require("react");
5340
+ var import_react11 = require("react");
5209
5341
  var import_jsx_runtime7 = require("react/jsx-runtime");
5210
5342
  var BOOKING_STEPS = [
5211
5343
  { id: "date", label: "Date" },
@@ -5260,27 +5392,27 @@ function InteractiveBookingCard({
5260
5392
  offer,
5261
5393
  onBook
5262
5394
  }) {
5263
- const fieldId = (0, import_react12.useId)();
5395
+ const fieldId = (0, import_react11.useId)();
5264
5396
  const defaultType = offer.eventTypes[0]?.uri ?? offer.slots[0]?.eventTypeUri ?? "";
5265
- const [step, setStep] = (0, import_react12.useState)("date");
5266
- const [eventTypeUri, setEventTypeUri] = (0, import_react12.useState)(defaultType);
5267
- const [selectedDate, setSelectedDate] = (0, import_react12.useState)("");
5268
- const [startTime, setStartTime] = (0, import_react12.useState)("");
5269
- const [name, setName] = (0, import_react12.useState)("");
5270
- const [email, setEmail] = (0, import_react12.useState)("");
5271
- const activeStepRef = (0, import_react12.useRef)(null);
5272
- const previousStepRef = (0, import_react12.useRef)(step);
5397
+ const [step, setStep] = (0, import_react11.useState)("date");
5398
+ const [eventTypeUri, setEventTypeUri] = (0, import_react11.useState)(defaultType);
5399
+ const [selectedDate, setSelectedDate] = (0, import_react11.useState)("");
5400
+ const [startTime, setStartTime] = (0, import_react11.useState)("");
5401
+ const [name, setName] = (0, import_react11.useState)("");
5402
+ const [email, setEmail] = (0, import_react11.useState)("");
5403
+ const activeStepRef = (0, import_react11.useRef)(null);
5404
+ const previousStepRef = (0, import_react11.useRef)(step);
5273
5405
  const stepIndex = BOOKING_STEPS.findIndex((item) => item.id === step);
5274
- (0, import_react12.useEffect)(() => {
5406
+ (0, import_react11.useEffect)(() => {
5275
5407
  if (previousStepRef.current === step) return;
5276
5408
  previousStepRef.current = step;
5277
5409
  activeStepRef.current?.scrollIntoView({ block: "nearest" });
5278
5410
  }, [step]);
5279
- const slots = (0, import_react12.useMemo)(
5411
+ const slots = (0, import_react11.useMemo)(
5280
5412
  () => bookingSlotsForEventType(offer.slots, eventTypeUri),
5281
5413
  [eventTypeUri, offer.slots]
5282
5414
  );
5283
- const availableByDate = (0, import_react12.useMemo)(() => {
5415
+ const availableByDate = (0, import_react11.useMemo)(() => {
5284
5416
  const next = /* @__PURE__ */ new Map();
5285
5417
  for (const slot of slots) {
5286
5418
  const key = slotDateKey(slot.startTime);
@@ -5288,7 +5420,7 @@ function InteractiveBookingCard({
5288
5420
  }
5289
5421
  return next;
5290
5422
  }, [slots]);
5291
- const [visibleMonth, setVisibleMonth] = (0, import_react12.useState)(
5423
+ const [visibleMonth, setVisibleMonth] = (0, import_react11.useState)(
5292
5424
  () => firstAvailableBookingMonth(slots)
5293
5425
  );
5294
5426
  function selectEventType(nextType) {
@@ -5301,7 +5433,7 @@ function InteractiveBookingCard({
5301
5433
  )
5302
5434
  );
5303
5435
  }
5304
- const daySlots = (0, import_react12.useMemo)(
5436
+ const daySlots = (0, import_react11.useMemo)(
5305
5437
  () => slots.filter((slot) => slotDateKey(slot.startTime) === selectedDate),
5306
5438
  [selectedDate, slots]
5307
5439
  );
@@ -5310,7 +5442,7 @@ function InteractiveBookingCard({
5310
5442
  );
5311
5443
  const selectedSample = availableByDate.get(selectedDate) ?? startTime;
5312
5444
  const timeZone = formatSlotTimeZone(slots[0]?.startTime ?? selectedSample);
5313
- const weekdays = (0, import_react12.useMemo)(() => weekdayLabels(), []);
5445
+ const weekdays = (0, import_react11.useMemo)(() => weekdayLabels(), []);
5314
5446
  const cells = calendarCells(visibleMonth.year, visibleMonth.month);
5315
5447
  const canPrevMonth = [...availableByDate.keys()].some((key) => {
5316
5448
  const month = monthFromKey(key);
@@ -5674,9 +5806,9 @@ function MessageBubble({
5674
5806
  onBook
5675
5807
  }) {
5676
5808
  const resolvedLogoUrl = brandLogoUrl?.trim();
5677
- const [failedLogoUrl, setFailedLogoUrl] = (0, import_react13.useState)(null);
5678
- const [logoDisplay, setLogoDisplay] = (0, import_react13.useState)(null);
5679
- (0, import_react13.useEffect)(() => {
5809
+ const [failedLogoUrl, setFailedLogoUrl] = (0, import_react12.useState)(null);
5810
+ const [logoDisplay, setLogoDisplay] = (0, import_react12.useState)(null);
5811
+ (0, import_react12.useEffect)(() => {
5680
5812
  setFailedLogoUrl(null);
5681
5813
  }, [resolvedLogoUrl]);
5682
5814
  const activeLogoDisplay = logoDisplay?.url === resolvedLogoUrl ? logoDisplay : null;
@@ -5827,7 +5959,7 @@ function MessageBubble({
5827
5959
  }
5828
5960
 
5829
5961
  // src/react/components/MessageActions/MessageActions.tsx
5830
- var import_react14 = require("react");
5962
+ var import_react13 = require("react");
5831
5963
  var import_react_dom2 = require("react-dom");
5832
5964
 
5833
5965
  // src/react/lib/speech.ts
@@ -6223,26 +6355,26 @@ function MessageActions({
6223
6355
  speechText
6224
6356
  }) {
6225
6357
  const menuPortalRoot = useAgentRailMenuPortalRoot();
6226
- const [copied, setCopied] = (0, import_react14.useState)(false);
6227
- const [rating, setRating] = (0, import_react14.useState)(null);
6228
- const [menuOpen, setMenuOpen] = (0, import_react14.useState)(false);
6229
- const [menuPosition, setMenuPosition] = (0, import_react14.useState)(null);
6230
- const [speaking, setSpeaking] = (0, import_react14.useState)(false);
6231
- const [speechSupported, setSpeechSupported] = (0, import_react14.useState)(null);
6232
- const copyTimerRef = (0, import_react14.useRef)(null);
6233
- const menuRef = (0, import_react14.useRef)(null);
6234
- const portaledMenuRef = (0, import_react14.useRef)(null);
6235
- const moreButtonRef = (0, import_react14.useRef)(null);
6358
+ const [copied, setCopied] = (0, import_react13.useState)(false);
6359
+ const [rating, setRating] = (0, import_react13.useState)(null);
6360
+ const [menuOpen, setMenuOpen] = (0, import_react13.useState)(false);
6361
+ const [menuPosition, setMenuPosition] = (0, import_react13.useState)(null);
6362
+ const [speaking, setSpeaking] = (0, import_react13.useState)(false);
6363
+ const [speechSupported, setSpeechSupported] = (0, import_react13.useState)(null);
6364
+ const copyTimerRef = (0, import_react13.useRef)(null);
6365
+ const menuRef = (0, import_react13.useRef)(null);
6366
+ const portaledMenuRef = (0, import_react13.useRef)(null);
6367
+ const moreButtonRef = (0, import_react13.useRef)(null);
6236
6368
  const answeredLabel = formatAnsweredAt(answeredAt ?? 0);
6237
6369
  const resolvedSpeechText = speechText ?? toSpeechText(copyText);
6238
6370
  const canOpenReceipt = Boolean(receiptSteps) && Boolean(onOpenReceipt);
6239
6371
  const readAloudEligible = Boolean(readAloud && resolvedSpeechText);
6240
6372
  const canReadAloud = readAloudEligible && speechSupported === true;
6241
6373
  const showMenu = canOpenReceipt || (speechSupported === null ? readAloudEligible : canReadAloud);
6242
- (0, import_react14.useLayoutEffect)(() => {
6374
+ (0, import_react13.useLayoutEffect)(() => {
6243
6375
  setSpeechSupported(isSpeechSupported());
6244
6376
  }, []);
6245
- (0, import_react14.useLayoutEffect)(() => {
6377
+ (0, import_react13.useLayoutEffect)(() => {
6246
6378
  if (!menuOpen || !moreButtonRef.current || !portaledMenuRef.current) {
6247
6379
  setMenuPosition(null);
6248
6380
  return;
@@ -6259,7 +6391,7 @@ function MessageActions({
6259
6391
  })
6260
6392
  );
6261
6393
  }, [menuOpen, menuPortalRoot]);
6262
- (0, import_react14.useEffect)(() => {
6394
+ (0, import_react13.useEffect)(() => {
6263
6395
  const unsubscribe = subscribeSpeechInterrupts(() => setSpeaking(false));
6264
6396
  return () => {
6265
6397
  unsubscribe();
@@ -6269,7 +6401,7 @@ function MessageActions({
6269
6401
  stopSpeech();
6270
6402
  };
6271
6403
  }, []);
6272
- (0, import_react14.useEffect)(() => {
6404
+ (0, import_react13.useEffect)(() => {
6273
6405
  if (!menuOpen) return;
6274
6406
  const handlePointerDown = (event) => {
6275
6407
  const target = event.target;
@@ -6438,7 +6570,7 @@ function MessageActions({
6438
6570
  }
6439
6571
 
6440
6572
  // src/react/components/HumanInputCard/HumanInputCard.tsx
6441
- var import_react16 = require("react");
6573
+ var import_react15 = require("react");
6442
6574
 
6443
6575
  // src/react/components/ConfirmationCard/ConfirmationCard.tsx
6444
6576
  var import_jsx_runtime10 = require("react/jsx-runtime");
@@ -6480,7 +6612,7 @@ function ConfirmationCard({
6480
6612
  }
6481
6613
 
6482
6614
  // src/react/components/ToolInputCard/ToolInputCard.tsx
6483
- var import_react15 = require("react");
6615
+ var import_react14 = require("react");
6484
6616
  var import_jsx_runtime11 = require("react/jsx-runtime");
6485
6617
  function isRecord5(value) {
6486
6618
  return value !== null && typeof value === "object" && !Array.isArray(value);
@@ -6811,11 +6943,11 @@ function ToolInputCard({
6811
6943
  surface,
6812
6944
  onSubmit
6813
6945
  }) {
6814
- const [values, setValues] = (0, import_react15.useState)(
6946
+ const [values, setValues] = (0, import_react14.useState)(
6815
6947
  () => initialValues(surface)
6816
6948
  );
6817
- const [touched, setTouched] = (0, import_react15.useState)(() => /* @__PURE__ */ new Set());
6818
- const [submitted, setSubmitted] = (0, import_react15.useState)(false);
6949
+ const [touched, setTouched] = (0, import_react14.useState)(() => /* @__PURE__ */ new Set());
6950
+ const [submitted, setSubmitted] = (0, import_react14.useState)(false);
6819
6951
  const errors = Object.fromEntries(
6820
6952
  surface.fields.map((field) => [
6821
6953
  field.path,
@@ -6908,7 +7040,7 @@ function HumanInputCard({
6908
7040
  request,
6909
7041
  onRespond
6910
7042
  }) {
6911
- const [text3, setText] = (0, import_react16.useState)("");
7043
+ const [text3, setText] = (0, import_react15.useState)("");
6912
7044
  const options = request.options ?? [];
6913
7045
  const showText = request.display === "text" || request.allowFreeform && options.length === 0;
6914
7046
  if (request.ui) {
@@ -6966,7 +7098,7 @@ function HumanInputCard({
6966
7098
  }
6967
7099
 
6968
7100
  // src/react/components/LocationConsent/LocationConsent.tsx
6969
- var import_react17 = require("react");
7101
+ var import_react16 = require("react");
6970
7102
 
6971
7103
  // src/runtime/location-consent.ts
6972
7104
  function isLocationConsentRequest(request) {
@@ -7014,16 +7146,16 @@ function LocationConsent({
7014
7146
  request,
7015
7147
  onRespond
7016
7148
  }) {
7017
- const [preference, setPreference] = (0, import_react17.useState)("unset");
7018
- const [locating, setLocating] = (0, import_react17.useState)(false);
7019
- const [error, setError] = (0, import_react17.useState)(null);
7020
- const respond = (0, import_react17.useRef)(onRespond);
7021
- const answered = (0, import_react17.useRef)(null);
7149
+ const [preference, setPreference] = (0, import_react16.useState)("unset");
7150
+ const [locating, setLocating] = (0, import_react16.useState)(false);
7151
+ const [error, setError] = (0, import_react16.useState)(null);
7152
+ const respond = (0, import_react16.useRef)(onRespond);
7153
+ const answered = (0, import_react16.useRef)(null);
7022
7154
  const requestId = request?.requestId;
7023
- (0, import_react17.useEffect)(() => {
7155
+ (0, import_react16.useEffect)(() => {
7024
7156
  respond.current = onRespond;
7025
7157
  }, [onRespond]);
7026
- (0, import_react17.useEffect)(() => {
7158
+ (0, import_react16.useEffect)(() => {
7027
7159
  if (!requestId || preference === "unset" || answered.current === requestId || !respond.current)
7028
7160
  return;
7029
7161
  if (preference === "off") {
@@ -7405,24 +7537,24 @@ function AgentRail({
7405
7537
  onInputResponse,
7406
7538
  onToolInput
7407
7539
  }) {
7408
- const railRef = (0, import_react18.useRef)(null);
7409
- const overlayRef = (0, import_react18.useRef)(null);
7410
- const transcriptRef = (0, import_react18.useRef)(null);
7411
- const responseRef = (0, import_react18.useRef)(null);
7412
- const threadRef = (0, import_react18.useRef)(null);
7413
- const lastScrolledVisitorIdRef = (0, import_react18.useRef)(void 0);
7414
- const pinnedToBottomRef = (0, import_react18.useRef)(true);
7415
- const smoothScrollToLatestRef = (0, import_react18.useRef)(false);
7416
- const lockedTranscriptScrollTopRef = (0, import_react18.useRef)(null);
7417
- const [showJumpToLatest, setShowJumpToLatest] = (0, import_react18.useState)(false);
7418
- const [receiptOpen, setReceiptOpen] = (0, import_react18.useState)(false);
7419
- const [expandedSourcesMessageId, setExpandedSourcesMessageId] = (0, import_react18.useState)(null);
7540
+ const railRef = (0, import_react17.useRef)(null);
7541
+ const overlayRef = (0, import_react17.useRef)(null);
7542
+ const transcriptRef = (0, import_react17.useRef)(null);
7543
+ const responseRef = (0, import_react17.useRef)(null);
7544
+ const threadRef = (0, import_react17.useRef)(null);
7545
+ const lastScrolledVisitorIdRef = (0, import_react17.useRef)(void 0);
7546
+ const pinnedToBottomRef = (0, import_react17.useRef)(true);
7547
+ const smoothScrollToLatestRef = (0, import_react17.useRef)(false);
7548
+ const lockedTranscriptScrollTopRef = (0, import_react17.useRef)(null);
7549
+ const [showJumpToLatest, setShowJumpToLatest] = (0, import_react17.useState)(false);
7550
+ const [receiptOpen, setReceiptOpen] = (0, import_react17.useState)(false);
7551
+ const [expandedSourcesMessageId, setExpandedSourcesMessageId] = (0, import_react17.useState)(null);
7420
7552
  const resolvedBrandLabel = brandLabel.trim();
7421
7553
  const resolvedBrandLogoUrl = brandLogoUrl?.trim();
7422
7554
  const resolvedDisclaimerLabel = disclaimerLabel === void 0 ? DEFAULT_DISCLAIMER_LABEL : disclaimerLabel;
7423
- const [failedLogoUrl, setFailedLogoUrl] = (0, import_react18.useState)(null);
7424
- const [brandLogoDisplay, setBrandLogoDisplay] = (0, import_react18.useState)(null);
7425
- (0, import_react18.useEffect)(() => {
7555
+ const [failedLogoUrl, setFailedLogoUrl] = (0, import_react17.useState)(null);
7556
+ const [brandLogoDisplay, setBrandLogoDisplay] = (0, import_react17.useState)(null);
7557
+ (0, import_react17.useEffect)(() => {
7426
7558
  setFailedLogoUrl(null);
7427
7559
  }, [resolvedBrandLogoUrl]);
7428
7560
  const activeBrandLogoDisplay = brandLogoDisplay?.url === resolvedBrandLogoUrl ? brandLogoDisplay : null;
@@ -7531,12 +7663,40 @@ function AgentRail({
7531
7663
  ...visibleVisitorToolResults
7532
7664
  ].reverse().find((result) => result.kind !== "input")?.id;
7533
7665
  const receiptSteps = answerReceipt && state.toolSteps.length > 0 ? state.toolSteps : void 0;
7534
- (0, import_react18.useEffect)(() => {
7666
+ const latestAgentMessage = lastAgentIndex >= 0 ? visibleMessages[lastAgentIndex] : void 0;
7667
+ const composerCtaActions = !handoffActive && state.phase === "complete" && latestAgentMessage?.role === "agent" && !latestAgentMessage.streaming ? searchActions(latestAgentMessage.searchResults ?? []) : [];
7668
+ const showHandoffAction = Boolean(handoff?.page?.enabled) && handoffStatus === "ai";
7669
+ const composerActions = /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(import_jsx_runtime19.Fragment, { children: [
7670
+ composerCtaActions.map((action) => /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
7671
+ "a",
7672
+ {
7673
+ className: "composer__action-badge",
7674
+ href: action.url,
7675
+ target: "_blank",
7676
+ rel: "noopener noreferrer",
7677
+ title: searchActionLinkTitle(action.url),
7678
+ children: action.label
7679
+ },
7680
+ action.url
7681
+ )),
7682
+ showHandoffAction && handoff ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
7683
+ "button",
7684
+ {
7685
+ type: "button",
7686
+ className: "composer__action-badge",
7687
+ disabled: handoff.busy || handoff.hasPending || isBusy,
7688
+ title: "Chat with a human representative",
7689
+ onClick: () => void handoff.start(),
7690
+ children: "Talk to a person"
7691
+ }
7692
+ ) : null
7693
+ ] });
7694
+ (0, import_react17.useEffect)(() => {
7535
7695
  if (state.phase !== "complete") {
7536
7696
  setReceiptOpen(false);
7537
7697
  }
7538
7698
  }, [state.phase]);
7539
- (0, import_react18.useEffect)(() => {
7699
+ (0, import_react17.useEffect)(() => {
7540
7700
  if (state.phase !== "complete" || !showSources) {
7541
7701
  setExpandedSourcesMessageId(null);
7542
7702
  }
@@ -7563,7 +7723,7 @@ function AgentRail({
7563
7723
  else onSubmit?.(label);
7564
7724
  }
7565
7725
  const latestVisitorId = visibleMessages[lastVisitorIndex]?.id;
7566
- (0, import_react18.useEffect)(() => {
7726
+ (0, import_react17.useEffect)(() => {
7567
7727
  const node = transcriptRef.current;
7568
7728
  if (!node) return;
7569
7729
  if (latestVisitorId !== lastScrolledVisitorIdRef.current) {
@@ -7593,7 +7753,7 @@ function AgentRail({
7593
7753
  state.followUps,
7594
7754
  state.journey
7595
7755
  ]);
7596
- (0, import_react18.useEffect)(() => {
7756
+ (0, import_react17.useEffect)(() => {
7597
7757
  const node = transcriptRef.current;
7598
7758
  if (!node) return;
7599
7759
  const handleScroll = () => {
@@ -7607,7 +7767,7 @@ function AgentRail({
7607
7767
  handleScroll();
7608
7768
  return () => node.removeEventListener("scroll", handleScroll);
7609
7769
  }, []);
7610
- (0, import_react18.useEffect)(() => {
7770
+ (0, import_react17.useEffect)(() => {
7611
7771
  if (!receiptOpen) {
7612
7772
  lockedTranscriptScrollTopRef.current = null;
7613
7773
  return;
@@ -7796,9 +7956,11 @@ function AgentRail({
7796
7956
  ))
7797
7957
  ] }) : null,
7798
7958
  transcriptMessages.map((message, index) => {
7799
- const messageSourceCount = message.role === "agent" ? searchSources(message.searchResults ?? []).length : 0;
7959
+ const messageResults = message.role === "agent" ? message.searchResults ?? [] : [];
7960
+ const messageSourceCount = showSources ? searchSources(messageResults).length : 0;
7961
+ const messageQuestionCount = index === lastAgentIndex && showLearnMore && !handoffActive ? searchSuggestions(messageResults).length : 0;
7800
7962
  const showAnswerActions = message.role === "agent" && index === lastAgentIndex && showMessageActions;
7801
- const showSourcesToggle = message.role === "agent" && showSources && state.phase === "complete" && !message.streaming && messageSourceCount > 0;
7963
+ const showExploreToggle = message.role === "agent" && state.phase === "complete" && !message.streaming && (messageSourceCount > 0 || messageQuestionCount > 0);
7802
7964
  return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
7803
7965
  "div",
7804
7966
  {
@@ -7824,7 +7986,7 @@ function AgentRail({
7824
7986
  onBook
7825
7987
  }
7826
7988
  ),
7827
- showAnswerActions || showSourcesToggle ? /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "agent-rail__answer-footer", children: [
7989
+ showAnswerActions || showExploreToggle ? /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "agent-rail__answer-footer", children: [
7828
7990
  /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "agent-rail__answer-actions", children: [
7829
7991
  showAnswerActions ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
7830
7992
  MessageActions,
@@ -7838,7 +8000,7 @@ function AgentRail({
7838
8000
  onFeedback: onFeedback ? (rating) => onFeedback(rating, message) : void 0
7839
8001
  }
7840
8002
  ) : null,
7841
- showSourcesToggle ? /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
8003
+ showExploreToggle ? /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
7842
8004
  "button",
7843
8005
  {
7844
8006
  className: "agent-rail__sources-button",
@@ -7849,7 +8011,7 @@ function AgentRail({
7849
8011
  (current) => current === message.id ? null : message.id
7850
8012
  ),
7851
8013
  children: [
7852
- "Explore More",
8014
+ "Explore more",
7853
8015
  /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
7854
8016
  "span",
7855
8017
  {
@@ -7862,38 +8024,26 @@ function AgentRail({
7862
8024
  }
7863
8025
  ) : null
7864
8026
  ] }),
7865
- showSourcesToggle ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
8027
+ showExploreToggle ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
7866
8028
  "div",
7867
8029
  {
7868
8030
  id: `agent-rail-sources-${message.id}`,
7869
8031
  className: `agent-rail__sources-panel${expandedSourcesMessageId === message.id ? " agent-rail__sources-panel--open" : ""}`,
7870
8032
  role: "region",
7871
- "aria-label": "Explore More",
8033
+ "aria-label": "Explore more",
7872
8034
  children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: "agent-rail__sources-panel-inner", children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
7873
- SearchReferences,
8035
+ ExploreMore,
7874
8036
  {
7875
8037
  results: message.searchResults ?? [],
7876
- mode: "sources"
8038
+ disabled: isBusy || !(onFollowUpSelect || onSubmit),
8039
+ showLearnMore: showLearnMore && index === lastAgentIndex && !handoffActive,
8040
+ showSources,
8041
+ onSelectQuestion: handleFollowUpSelect
7877
8042
  }
7878
8043
  ) })
7879
8044
  }
7880
8045
  ) : null
7881
8046
  ] }) : null,
7882
- message.role === "agent" && !message.streaming ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
7883
- SearchReferences,
7884
- {
7885
- results: message.searchResults ?? [],
7886
- mode: "actions"
7887
- }
7888
- ) : null,
7889
- showAnswerActions && !handoffActive && showLearnMore ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
7890
- LearnMore,
7891
- {
7892
- results: message.searchResults ?? [],
7893
- disabled: isBusy || !(onFollowUpSelect || onSubmit),
7894
- onSelect: handleFollowUpSelect
7895
- }
7896
- ) : null,
7897
8047
  index === lastVisitorIndex ? /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(import_jsx_runtime19.Fragment, { children: [
7898
8048
  showActivity ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
7899
8049
  AgentActivityBubble,
@@ -7936,7 +8086,7 @@ function AgentRail({
7936
8086
  onRetry ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("button", { type: "button", onClick: onRetry, children: "Try again" }) : null
7937
8087
  ] }) : null
7938
8088
  ] }) }),
7939
- handoff && (handoff.page?.enabled || handoffActive) ? /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "agent-rail__handoff", children: [
8089
+ handoff && (handoff.page?.enabled || handoffActive) && handoffStatus !== "ai" ? /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "agent-rail__handoff", children: [
7940
8090
  handoffStatus === "human" || handoffStatus === "queued" || handoffStatus === "requesting" ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "agent-rail__handoff-dot", "aria-hidden": "true" }) : null,
7941
8091
  /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
7942
8092
  "p",
@@ -7947,16 +8097,6 @@ function AgentRail({
7947
8097
  children: !handoff.page ? "Checking conversation\u2026" : handoffStatus === "human" ? "Connected with support" : handoffStatus === "queued" ? "Waiting for a representative" : handoffStatus === "requesting" ? "Connecting you to support\u2026" : handoffStatus === "resolved" ? "Your conversation with support has ended" : handoffStatus === "failed" ? "We couldn\u2019t connect you to support" : "Need a person?"
7948
8098
  }
7949
8099
  ),
7950
- handoffStatus === "ai" ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
7951
- "button",
7952
- {
7953
- type: "button",
7954
- className: "agent-rail__handoff-cta",
7955
- disabled: handoff.busy || handoff.hasPending || isBusy,
7956
- onClick: () => void handoff.start(),
7957
- children: "Talk to a person"
7958
- }
7959
- ) : null,
7960
8100
  handoffStatus === "resolved" ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
7961
8101
  "button",
7962
8102
  {
@@ -7991,15 +8131,6 @@ function AgentRail({
7991
8131
  )
7992
8132
  ] }) : null
7993
8133
  ] }) : null,
7994
- showDisclaimerLabel ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: "agent-rail__disclaimer", children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("p", { children: disclaimerLink ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
7995
- "a",
7996
- {
7997
- href: disclaimerLink,
7998
- rel: "noopener noreferrer",
7999
- target: "_blank",
8000
- children: resolvedDisclaimerLabel
8001
- }
8002
- ) : resolvedDisclaimerLabel }) }) : null,
8003
8134
  /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "agent-rail__composer-wrap", children: [
8004
8135
  /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
8005
8136
  LocationConsent,
@@ -8023,6 +8154,7 @@ function AgentRail({
8023
8154
  /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
8024
8155
  Composer,
8025
8156
  {
8157
+ actions: composerCtaActions.length > 0 || showHandoffAction ? composerActions : void 0,
8026
8158
  variant: expanded || mobileFullscreen ? "dock" : "default",
8027
8159
  disabled: isBusy || Boolean(handoff?.busy || handoff?.hasPending) || handoffActive && !["requesting", "queued", "human"].includes(
8028
8160
  handoffStatus ?? ""
@@ -8037,6 +8169,15 @@ function AgentRail({
8037
8169
  },
8038
8170
  `${state.messages.find((message) => message.role === "visitor")?.id ?? "empty"}:${latestResultId ?? ""}`
8039
8171
  ),
8172
+ showDisclaimerLabel ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: "agent-rail__disclaimer", children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("p", { children: disclaimerLink ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
8173
+ "a",
8174
+ {
8175
+ href: disclaimerLink,
8176
+ rel: "noopener noreferrer",
8177
+ target: "_blank",
8178
+ children: resolvedDisclaimerLabel
8179
+ }
8180
+ ) : resolvedDisclaimerLabel }) }) : null,
8040
8181
  poweredByLabel ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: "agent-rail__footer", children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("p", { children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { children: poweredByLabel }) }) }) : null
8041
8182
  ] })
8042
8183
  ] }),
@@ -8055,7 +8196,7 @@ function AgentRail({
8055
8196
  }
8056
8197
 
8057
8198
  // src/react/components/AssistEdgeTab/AssistEdgeTab.tsx
8058
- var import_react19 = require("react");
8199
+ var import_react18 = require("react");
8059
8200
  var import_jsx_runtime20 = require("react/jsx-runtime");
8060
8201
  function ChatSparkIcon() {
8061
8202
  return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
@@ -8137,9 +8278,9 @@ function TabMarkIcon({
8137
8278
  }) {
8138
8279
  const custom = customIconUrl?.trim();
8139
8280
  const logo = logoUrl?.trim();
8140
- const [customFailed, setCustomFailed] = (0, import_react19.useState)(false);
8141
- const [logoFailed, setLogoFailed] = (0, import_react19.useState)(false);
8142
- const [markDisplay, setMarkDisplay] = (0, import_react19.useState)(null);
8281
+ const [customFailed, setCustomFailed] = (0, import_react18.useState)(false);
8282
+ const [logoFailed, setLogoFailed] = (0, import_react18.useState)(false);
8283
+ const [markDisplay, setMarkDisplay] = (0, import_react18.useState)(null);
8143
8284
  function applyLauncherLogoSize(img, sourceUrl) {
8144
8285
  if (!chip) return;
8145
8286
  const display = snapBrandLogoDisplaySize({
@@ -8423,9 +8564,9 @@ function AgentWidget({
8423
8564
  }) {
8424
8565
  const isMobile = useIsMobile();
8425
8566
  const placement = normalizeAgentPlacement(placementInput);
8426
- const railSlotRef = (0, import_react20.useRef)(null);
8427
- const [railCollapsed, setRailCollapsed] = (0, import_react20.useState)(defaultCollapsed);
8428
- const [railExpanded, setRailExpanded] = (0, import_react20.useState)(false);
8567
+ const railSlotRef = (0, import_react19.useRef)(null);
8568
+ const [railCollapsed, setRailCollapsed] = (0, import_react19.useState)(defaultCollapsed);
8569
+ const [railExpanded, setRailExpanded] = (0, import_react19.useState)(false);
8429
8570
  const pageShiftActive = shouldApplyPageShift({
8430
8571
  pageShift,
8431
8572
  isMobile,
@@ -8480,7 +8621,7 @@ function AgentWidget({
8480
8621
  } : {},
8481
8622
  ...branding?.colors?.border ? { border: branding.colors.border } : {}
8482
8623
  };
8483
- (0, import_react20.useEffect)(() => {
8624
+ (0, import_react19.useEffect)(() => {
8484
8625
  if (!registerPanelController) return;
8485
8626
  registerAgentPanelController(customerId, {
8486
8627
  open: () => setRailCollapsed(false),
@@ -8515,7 +8656,7 @@ function AgentWidget({
8515
8656
  })
8516
8657
  );
8517
8658
  }
8518
- (0, import_react20.useEffect)(() => {
8659
+ (0, import_react19.useEffect)(() => {
8519
8660
  if (railCollapsed) return;
8520
8661
  const handleKeyDown = (event) => {
8521
8662
  if (event.key === "Tab" && (isMobile || railExpanded)) {
@@ -8613,9 +8754,9 @@ function AgentWidget({
8613
8754
  subLabel: branding?.tabSubLabel,
8614
8755
  customIconUrl: branding?.tabIconUrl,
8615
8756
  logoUrl: branding?.logoUrl,
8616
- brandColor: branding?.colors?.primary,
8617
- brandForeground: branding?.colors?.primaryForeground,
8618
- borderColor: branding?.colors?.border,
8757
+ brandColor: branding?.colors?.launcherPrimary ?? branding?.colors?.primary,
8758
+ brandForeground: branding?.colors?.launcherPrimaryForeground ?? branding?.colors?.primaryForeground,
8759
+ borderColor: branding?.colors?.launcherBorder ?? branding?.colors?.border,
8619
8760
  fontFamily: branding?.fontFamily,
8620
8761
  mobile: isMobile,
8621
8762
  surfaceColor: branding?.colors?.surface,
@@ -8628,7 +8769,7 @@ function AgentWidget({
8628
8769
  }
8629
8770
 
8630
8771
  // src/react/components/AgentTranscript/AgentTranscript.tsx
8631
- var import_react21 = require("react");
8772
+ var import_react20 = require("react");
8632
8773
 
8633
8774
  // src/react/components/AgentTranscript/TranscriptActivity.tsx
8634
8775
  var import_jsx_runtime22 = require("react/jsx-runtime");
@@ -8749,7 +8890,7 @@ function AgentTranscript({
8749
8890
  const previous = entries[index - 1];
8750
8891
  const validTimestamp = Number.isFinite(date.getTime());
8751
8892
  const showTimestamp = validTimestamp && (previous ? entry.createdAt - previous.createdAt >= 5 * 60 * 1e3 || date.toISOString().slice(0, 10) !== new Date(previous.createdAt).toJSON()?.slice(0, 10) : showInitialTimestamp);
8752
- return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(import_react21.Fragment, { children: [
8893
+ return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(import_react20.Fragment, { children: [
8753
8894
  showTimestamp ? /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("li", { className: "agent-transcript__time-marker", children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("time", { dateTime: date.toISOString(), children: formatTimestamp(entry.createdAt) }) }) : null,
8754
8895
  entry.kind === "activity" ? /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(TranscriptActivity, { activity: entry }) : /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
8755
8896
  "li",