@webless/agent 0.10.0 → 0.10.1

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-6OCODDRO.js";
12
+ } from "./chunk-ZYTNNMZS.js";
13
13
 
14
14
  // src/embed/mount.tsx
15
15
  import { createRoot } from "react-dom/client";
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_react15 = require("react");
49
+ var import_react16 = require("react");
50
50
 
51
51
  // src/react/page-shift.ts
52
52
  var import_react = require("react");
@@ -3802,8 +3802,7 @@ function workSummary(steps, failed, brandLabel) {
3802
3802
  )}`;
3803
3803
  const active = [...steps].reverse().find((step) => step.state === "active");
3804
3804
  if (active?.kind === "search") return "Searching this site";
3805
- if (active)
3806
- return brandLabel ? `${brandLabel} is choosing the best way to help` : "Choosing the best way to help";
3805
+ if (active) return "Reviewing your details to find the best approach";
3807
3806
  if (failed) return "Couldn\u2019t complete this request";
3808
3807
  const hasError = steps.some((step) => step.state === "error");
3809
3808
  const specialists = steps.filter(
@@ -3912,7 +3911,7 @@ function AgentActivityBubble({
3912
3911
  }
3913
3912
  ),
3914
3913
  workSummary(steps, failed, brandLabel),
3915
- active ? "\u2026" : ""
3914
+ active ? "..." : ""
3916
3915
  ] }),
3917
3916
  !active ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "agent-activity-bubble__details", children: [
3918
3917
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
@@ -6887,6 +6886,7 @@ function AgentRail({
6887
6886
  }
6888
6887
 
6889
6888
  // src/react/components/AssistEdgeTab/AssistEdgeTab.tsx
6889
+ var import_react15 = require("react");
6890
6890
  var import_jsx_runtime18 = require("react/jsx-runtime");
6891
6891
  function ChatSparkIcon() {
6892
6892
  return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
@@ -6961,16 +6961,35 @@ function ChatSparkIcon() {
6961
6961
  }
6962
6962
  );
6963
6963
  }
6964
- function TabMarkIcon({ customIconUrl }) {
6965
- const url = customIconUrl?.trim();
6966
- if (url) {
6964
+ function TabMarkIcon({
6965
+ customIconUrl,
6966
+ logoUrl
6967
+ }) {
6968
+ const custom = customIconUrl?.trim();
6969
+ const logo = logoUrl?.trim();
6970
+ const [customFailed, setCustomFailed] = (0, import_react15.useState)(false);
6971
+ const [logoFailed, setLogoFailed] = (0, import_react15.useState)(false);
6972
+ if (custom && !customFailed) {
6967
6973
  return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
6968
6974
  "img",
6969
6975
  {
6970
6976
  alt: "",
6971
6977
  "aria-hidden": true,
6972
6978
  className: "assist-edge-tab__custom-icon",
6973
- src: url
6979
+ src: custom,
6980
+ onError: () => setCustomFailed(true)
6981
+ }
6982
+ );
6983
+ }
6984
+ if (logo && !logoFailed) {
6985
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
6986
+ "img",
6987
+ {
6988
+ alt: "",
6989
+ "aria-hidden": true,
6990
+ className: "assist-edge-tab__logo",
6991
+ src: logo,
6992
+ onError: () => setLogoFailed(true)
6974
6993
  }
6975
6994
  );
6976
6995
  }
@@ -7033,13 +7052,14 @@ function AssistEdgeTab({
7033
7052
  const visibleLabel = label?.trim() || copy.label;
7034
7053
  const visibleSubLabel = subLabel?.trim() || "";
7035
7054
  const pill = mobile || side === "bottom";
7055
+ const chromeScheme = pill ? "light" : resolvedColorScheme;
7036
7056
  const ariaLabel = visibleSubLabel ? `Open ${visibleLabel} \u2014 ${visibleSubLabel}` : `Open ${visibleLabel}`;
7037
7057
  const alignment = along < 50 ? "start" : along > 50 ? "end" : "center";
7038
- const showLogo = Boolean(logoUrl?.trim()) && !customIconUrl?.trim();
7039
- const resolvedBrandColor = brandColor ?? (resolvedColorScheme === "dark" ? defaultDarkAgentRailTheme.brand : void 0);
7040
- const resolvedBorderColor = resolvedColorScheme === "dark" ? defaultDarkAgentRailTheme.border : borderColor;
7041
- const resolvedSurfaceColor = resolvedColorScheme === "dark" ? defaultDarkAgentRailTheme.surface : surfaceColor;
7042
- const resolvedTextColor = resolvedColorScheme === "dark" ? defaultDarkAgentRailTheme.text : textColor;
7058
+ const resolvedBrandColor = brandColor ?? (chromeScheme === "dark" ? defaultDarkAgentRailTheme.brand : void 0);
7059
+ const resolvedBorderColor = chromeScheme === "dark" ? defaultDarkAgentRailTheme.border : borderColor;
7060
+ const resolvedSurfaceColor = chromeScheme === "dark" ? defaultDarkAgentRailTheme.surface : surfaceColor;
7061
+ const resolvedTextColor = chromeScheme === "dark" ? defaultDarkAgentRailTheme.text : textColor;
7062
+ const markSourceKey = `${customIconUrl?.trim() ?? ""}|${logoUrl?.trim() ?? ""}`;
7043
7063
  const style = {
7044
7064
  "--tab-along": `${along}%`,
7045
7065
  "--tab-inset": `${inset}px`,
@@ -7047,16 +7067,16 @@ function AssistEdgeTab({
7047
7067
  ...brandForeground ? { "--as-visitor-text": brandForeground } : {},
7048
7068
  ...resolvedBorderColor ? { "--as-border": resolvedBorderColor } : {},
7049
7069
  ...fontFamily ? { "--as-font-display": fontFamily } : {},
7050
- ...resolvedSurfaceColor ? { "--as-surface": resolvedSurfaceColor } : {},
7051
- ...resolvedTextColor ? { "--as-text": resolvedTextColor } : {},
7052
- colorScheme: resolvedColorScheme
7070
+ ...pill ? { "--as-surface": "#ffffff", "--as-text": "#171717" } : resolvedSurfaceColor ? { "--as-surface": resolvedSurfaceColor } : {},
7071
+ ...!pill && resolvedTextColor ? { "--as-text": resolvedTextColor } : {},
7072
+ colorScheme: chromeScheme
7053
7073
  };
7054
7074
  return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
7055
7075
  "button",
7056
7076
  {
7057
7077
  type: "button",
7058
7078
  className: `assist-edge-tab assist-edge-tab--${variant} assist-edge-tab--${side} assist-edge-tab--align-${alignment}${mobile ? " assist-edge-tab--mobile" : ""}${visible ? " is-visible" : ""}`,
7059
- "data-color-scheme": resolvedColorScheme,
7079
+ "data-color-scheme": chromeScheme,
7060
7080
  style,
7061
7081
  "aria-label": ariaLabel,
7062
7082
  "aria-hidden": !visible,
@@ -7072,18 +7092,14 @@ function AssistEdgeTab({
7072
7092
  children: [
7073
7093
  /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "assist-edge-tab__wash assist-edge-tab__wash--light" }),
7074
7094
  /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "assist-edge-tab__wash assist-edge-tab__wash--cool" }),
7075
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(TabMarkIcon, { customIconUrl }),
7076
- showLogo ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
7077
- "img",
7095
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
7096
+ TabMarkIcon,
7078
7097
  {
7079
- className: "assist-edge-tab__logo",
7080
- src: logoUrl,
7081
- alt: "",
7082
- onError: (event) => {
7083
- event.currentTarget.hidden = true;
7084
- }
7085
- }
7086
- ) : null
7098
+ customIconUrl,
7099
+ logoUrl
7100
+ },
7101
+ markSourceKey
7102
+ )
7087
7103
  ]
7088
7104
  }
7089
7105
  ),
@@ -7092,20 +7108,14 @@ function AssistEdgeTab({
7092
7108
  visibleSubLabel ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "assist-edge-tab__sublabel", children: visibleSubLabel }) : null
7093
7109
  ] })
7094
7110
  ] }) : variant === "outline" ? /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_jsx_runtime18.Fragment, { children: [
7095
- /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("span", { className: "assist-edge-tab__mark", "aria-hidden": "true", children: [
7096
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(TabMarkIcon, { customIconUrl }),
7097
- showLogo ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
7098
- "img",
7099
- {
7100
- className: "assist-edge-tab__logo",
7101
- src: logoUrl,
7102
- alt: "",
7103
- onError: (event) => {
7104
- event.currentTarget.hidden = true;
7105
- }
7106
- }
7107
- ) : null
7108
- ] }),
7111
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "assist-edge-tab__mark", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
7112
+ TabMarkIcon,
7113
+ {
7114
+ customIconUrl,
7115
+ logoUrl
7116
+ },
7117
+ markSourceKey
7118
+ ) }),
7109
7119
  /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "assist-edge-tab__label", children: visibleLabel }),
7110
7120
  /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(ChevronDownIcon2, {})
7111
7121
  ] }) : null,
@@ -7115,20 +7125,14 @@ function AssistEdgeTab({
7115
7125
  /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(DragDots, {})
7116
7126
  ] }) : null,
7117
7127
  !pill && variant === "fill" ? /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_jsx_runtime18.Fragment, { children: [
7118
- /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("span", { className: "assist-edge-tab__mark", "aria-hidden": "true", children: [
7119
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(TabMarkIcon, { customIconUrl }),
7120
- showLogo ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
7121
- "img",
7122
- {
7123
- className: "assist-edge-tab__logo",
7124
- src: logoUrl,
7125
- alt: "",
7126
- onError: (event) => {
7127
- event.currentTarget.hidden = true;
7128
- }
7129
- }
7130
- ) : null
7131
- ] }),
7128
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "assist-edge-tab__mark", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
7129
+ TabMarkIcon,
7130
+ {
7131
+ customIconUrl,
7132
+ logoUrl
7133
+ },
7134
+ markSourceKey
7135
+ ) }),
7132
7136
  /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "assist-edge-tab__label", children: visibleLabel }),
7133
7137
  /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(ChevronLeftIcon, {})
7134
7138
  ] }) : null
@@ -7213,9 +7217,9 @@ function AgentWidget({
7213
7217
  }) {
7214
7218
  const isMobile = useIsMobile();
7215
7219
  const placement = normalizeAgentPlacement(placementInput);
7216
- const railSlotRef = (0, import_react15.useRef)(null);
7217
- const [railCollapsed, setRailCollapsed] = (0, import_react15.useState)(defaultCollapsed);
7218
- const [railExpanded, setRailExpanded] = (0, import_react15.useState)(false);
7220
+ const railSlotRef = (0, import_react16.useRef)(null);
7221
+ const [railCollapsed, setRailCollapsed] = (0, import_react16.useState)(defaultCollapsed);
7222
+ const [railExpanded, setRailExpanded] = (0, import_react16.useState)(false);
7219
7223
  const pageShiftActive = shouldApplyPageShift({
7220
7224
  pageShift,
7221
7225
  isMobile,
@@ -7268,7 +7272,7 @@ function AgentWidget({
7268
7272
  } : {},
7269
7273
  ...branding?.colors?.border ? { border: branding.colors.border } : {}
7270
7274
  };
7271
- (0, import_react15.useEffect)(() => {
7275
+ (0, import_react16.useEffect)(() => {
7272
7276
  if (!registerPanelController) return;
7273
7277
  registerAgentPanelController(customerId, {
7274
7278
  open: () => setRailCollapsed(false),
@@ -7303,7 +7307,7 @@ function AgentWidget({
7303
7307
  })
7304
7308
  );
7305
7309
  }
7306
- (0, import_react15.useEffect)(() => {
7310
+ (0, import_react16.useEffect)(() => {
7307
7311
  if (railCollapsed) return;
7308
7312
  const handleKeyDown = (event) => {
7309
7313
  if (event.key === "Tab" && (isMobile || railExpanded)) {
@@ -7413,7 +7417,7 @@ function AgentWidget({
7413
7417
  }
7414
7418
 
7415
7419
  // src/react/components/AgentTranscript/AgentTranscript.tsx
7416
- var import_react16 = require("react");
7420
+ var import_react17 = require("react");
7417
7421
 
7418
7422
  // src/react/components/AgentTranscript/TranscriptActivity.tsx
7419
7423
  var import_jsx_runtime20 = require("react/jsx-runtime");
@@ -7534,7 +7538,7 @@ function AgentTranscript({
7534
7538
  const previous = entries[index - 1];
7535
7539
  const validTimestamp = Number.isFinite(date.getTime());
7536
7540
  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);
7537
- return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(import_react16.Fragment, { children: [
7541
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(import_react17.Fragment, { children: [
7538
7542
  showTimestamp ? /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("li", { className: "agent-transcript__time-marker", children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("time", { dateTime: date.toISOString(), children: formatTimestamp(entry.createdAt) }) }) : null,
7539
7543
  entry.kind === "activity" ? /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(TranscriptActivity, { activity: entry }) : /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
7540
7544
  "li",