@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.cjs CHANGED
@@ -64,7 +64,7 @@ function submitAgentPanel(customerId, message, options) {
64
64
  }
65
65
 
66
66
  // src/react/components/AgentWidget/AgentWidget.tsx
67
- var import_react15 = require("react");
67
+ var import_react16 = require("react");
68
68
 
69
69
  // src/react/page-shift.ts
70
70
  var import_react = require("react");
@@ -3804,8 +3804,7 @@ function workSummary(steps, failed, brandLabel) {
3804
3804
  )}`;
3805
3805
  const active = [...steps].reverse().find((step) => step.state === "active");
3806
3806
  if (active?.kind === "search") return "Searching this site";
3807
- if (active)
3808
- return brandLabel ? `${brandLabel} is choosing the best way to help` : "Choosing the best way to help";
3807
+ if (active) return "Reviewing your details to find the best approach";
3809
3808
  if (failed) return "Couldn\u2019t complete this request";
3810
3809
  const hasError = steps.some((step) => step.state === "error");
3811
3810
  const specialists = steps.filter(
@@ -3914,7 +3913,7 @@ function AgentActivityBubble({
3914
3913
  }
3915
3914
  ),
3916
3915
  workSummary(steps, failed, brandLabel),
3917
- active ? "\u2026" : ""
3916
+ active ? "..." : ""
3918
3917
  ] }),
3919
3918
  !active ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "agent-activity-bubble__details", children: [
3920
3919
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
@@ -6889,6 +6888,7 @@ function AgentRail({
6889
6888
  }
6890
6889
 
6891
6890
  // src/react/components/AssistEdgeTab/AssistEdgeTab.tsx
6891
+ var import_react15 = require("react");
6892
6892
  var import_jsx_runtime18 = require("react/jsx-runtime");
6893
6893
  function ChatSparkIcon() {
6894
6894
  return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
@@ -6963,16 +6963,35 @@ function ChatSparkIcon() {
6963
6963
  }
6964
6964
  );
6965
6965
  }
6966
- function TabMarkIcon({ customIconUrl }) {
6967
- const url = customIconUrl?.trim();
6968
- if (url) {
6966
+ function TabMarkIcon({
6967
+ customIconUrl,
6968
+ logoUrl
6969
+ }) {
6970
+ const custom = customIconUrl?.trim();
6971
+ const logo = logoUrl?.trim();
6972
+ const [customFailed, setCustomFailed] = (0, import_react15.useState)(false);
6973
+ const [logoFailed, setLogoFailed] = (0, import_react15.useState)(false);
6974
+ if (custom && !customFailed) {
6969
6975
  return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
6970
6976
  "img",
6971
6977
  {
6972
6978
  alt: "",
6973
6979
  "aria-hidden": true,
6974
6980
  className: "assist-edge-tab__custom-icon",
6975
- src: url
6981
+ src: custom,
6982
+ onError: () => setCustomFailed(true)
6983
+ }
6984
+ );
6985
+ }
6986
+ if (logo && !logoFailed) {
6987
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
6988
+ "img",
6989
+ {
6990
+ alt: "",
6991
+ "aria-hidden": true,
6992
+ className: "assist-edge-tab__logo",
6993
+ src: logo,
6994
+ onError: () => setLogoFailed(true)
6976
6995
  }
6977
6996
  );
6978
6997
  }
@@ -7035,13 +7054,14 @@ function AssistEdgeTab({
7035
7054
  const visibleLabel = label?.trim() || copy.label;
7036
7055
  const visibleSubLabel = subLabel?.trim() || "";
7037
7056
  const pill = mobile || side === "bottom";
7057
+ const chromeScheme = pill ? "light" : resolvedColorScheme;
7038
7058
  const ariaLabel = visibleSubLabel ? `Open ${visibleLabel} \u2014 ${visibleSubLabel}` : `Open ${visibleLabel}`;
7039
7059
  const alignment = along < 50 ? "start" : along > 50 ? "end" : "center";
7040
- const showLogo = Boolean(logoUrl?.trim()) && !customIconUrl?.trim();
7041
- const resolvedBrandColor = brandColor ?? (resolvedColorScheme === "dark" ? defaultDarkAgentRailTheme.brand : void 0);
7042
- const resolvedBorderColor = resolvedColorScheme === "dark" ? defaultDarkAgentRailTheme.border : borderColor;
7043
- const resolvedSurfaceColor = resolvedColorScheme === "dark" ? defaultDarkAgentRailTheme.surface : surfaceColor;
7044
- const resolvedTextColor = resolvedColorScheme === "dark" ? defaultDarkAgentRailTheme.text : textColor;
7060
+ const resolvedBrandColor = brandColor ?? (chromeScheme === "dark" ? defaultDarkAgentRailTheme.brand : void 0);
7061
+ const resolvedBorderColor = chromeScheme === "dark" ? defaultDarkAgentRailTheme.border : borderColor;
7062
+ const resolvedSurfaceColor = chromeScheme === "dark" ? defaultDarkAgentRailTheme.surface : surfaceColor;
7063
+ const resolvedTextColor = chromeScheme === "dark" ? defaultDarkAgentRailTheme.text : textColor;
7064
+ const markSourceKey = `${customIconUrl?.trim() ?? ""}|${logoUrl?.trim() ?? ""}`;
7045
7065
  const style = {
7046
7066
  "--tab-along": `${along}%`,
7047
7067
  "--tab-inset": `${inset}px`,
@@ -7049,16 +7069,16 @@ function AssistEdgeTab({
7049
7069
  ...brandForeground ? { "--as-visitor-text": brandForeground } : {},
7050
7070
  ...resolvedBorderColor ? { "--as-border": resolvedBorderColor } : {},
7051
7071
  ...fontFamily ? { "--as-font-display": fontFamily } : {},
7052
- ...resolvedSurfaceColor ? { "--as-surface": resolvedSurfaceColor } : {},
7053
- ...resolvedTextColor ? { "--as-text": resolvedTextColor } : {},
7054
- colorScheme: resolvedColorScheme
7072
+ ...pill ? { "--as-surface": "#ffffff", "--as-text": "#171717" } : resolvedSurfaceColor ? { "--as-surface": resolvedSurfaceColor } : {},
7073
+ ...!pill && resolvedTextColor ? { "--as-text": resolvedTextColor } : {},
7074
+ colorScheme: chromeScheme
7055
7075
  };
7056
7076
  return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
7057
7077
  "button",
7058
7078
  {
7059
7079
  type: "button",
7060
7080
  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" : ""}`,
7061
- "data-color-scheme": resolvedColorScheme,
7081
+ "data-color-scheme": chromeScheme,
7062
7082
  style,
7063
7083
  "aria-label": ariaLabel,
7064
7084
  "aria-hidden": !visible,
@@ -7074,18 +7094,14 @@ function AssistEdgeTab({
7074
7094
  children: [
7075
7095
  /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "assist-edge-tab__wash assist-edge-tab__wash--light" }),
7076
7096
  /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "assist-edge-tab__wash assist-edge-tab__wash--cool" }),
7077
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(TabMarkIcon, { customIconUrl }),
7078
- showLogo ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
7079
- "img",
7097
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
7098
+ TabMarkIcon,
7080
7099
  {
7081
- className: "assist-edge-tab__logo",
7082
- src: logoUrl,
7083
- alt: "",
7084
- onError: (event) => {
7085
- event.currentTarget.hidden = true;
7086
- }
7087
- }
7088
- ) : null
7100
+ customIconUrl,
7101
+ logoUrl
7102
+ },
7103
+ markSourceKey
7104
+ )
7089
7105
  ]
7090
7106
  }
7091
7107
  ),
@@ -7094,20 +7110,14 @@ function AssistEdgeTab({
7094
7110
  visibleSubLabel ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "assist-edge-tab__sublabel", children: visibleSubLabel }) : null
7095
7111
  ] })
7096
7112
  ] }) : variant === "outline" ? /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_jsx_runtime18.Fragment, { children: [
7097
- /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("span", { className: "assist-edge-tab__mark", "aria-hidden": "true", children: [
7098
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(TabMarkIcon, { customIconUrl }),
7099
- showLogo ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
7100
- "img",
7101
- {
7102
- className: "assist-edge-tab__logo",
7103
- src: logoUrl,
7104
- alt: "",
7105
- onError: (event) => {
7106
- event.currentTarget.hidden = true;
7107
- }
7108
- }
7109
- ) : null
7110
- ] }),
7113
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "assist-edge-tab__mark", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
7114
+ TabMarkIcon,
7115
+ {
7116
+ customIconUrl,
7117
+ logoUrl
7118
+ },
7119
+ markSourceKey
7120
+ ) }),
7111
7121
  /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "assist-edge-tab__label", children: visibleLabel }),
7112
7122
  /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(ChevronDownIcon2, {})
7113
7123
  ] }) : null,
@@ -7117,20 +7127,14 @@ function AssistEdgeTab({
7117
7127
  /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(DragDots, {})
7118
7128
  ] }) : null,
7119
7129
  !pill && variant === "fill" ? /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_jsx_runtime18.Fragment, { children: [
7120
- /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("span", { className: "assist-edge-tab__mark", "aria-hidden": "true", children: [
7121
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(TabMarkIcon, { customIconUrl }),
7122
- showLogo ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
7123
- "img",
7124
- {
7125
- className: "assist-edge-tab__logo",
7126
- src: logoUrl,
7127
- alt: "",
7128
- onError: (event) => {
7129
- event.currentTarget.hidden = true;
7130
- }
7131
- }
7132
- ) : null
7133
- ] }),
7130
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "assist-edge-tab__mark", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
7131
+ TabMarkIcon,
7132
+ {
7133
+ customIconUrl,
7134
+ logoUrl
7135
+ },
7136
+ markSourceKey
7137
+ ) }),
7134
7138
  /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "assist-edge-tab__label", children: visibleLabel }),
7135
7139
  /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(ChevronLeftIcon, {})
7136
7140
  ] }) : null
@@ -7215,9 +7219,9 @@ function AgentWidget({
7215
7219
  }) {
7216
7220
  const isMobile = useIsMobile();
7217
7221
  const placement = normalizeAgentPlacement(placementInput);
7218
- const railSlotRef = (0, import_react15.useRef)(null);
7219
- const [railCollapsed, setRailCollapsed] = (0, import_react15.useState)(defaultCollapsed);
7220
- const [railExpanded, setRailExpanded] = (0, import_react15.useState)(false);
7222
+ const railSlotRef = (0, import_react16.useRef)(null);
7223
+ const [railCollapsed, setRailCollapsed] = (0, import_react16.useState)(defaultCollapsed);
7224
+ const [railExpanded, setRailExpanded] = (0, import_react16.useState)(false);
7221
7225
  const pageShiftActive = shouldApplyPageShift({
7222
7226
  pageShift,
7223
7227
  isMobile,
@@ -7270,7 +7274,7 @@ function AgentWidget({
7270
7274
  } : {},
7271
7275
  ...branding?.colors?.border ? { border: branding.colors.border } : {}
7272
7276
  };
7273
- (0, import_react15.useEffect)(() => {
7277
+ (0, import_react16.useEffect)(() => {
7274
7278
  if (!registerPanelController) return;
7275
7279
  registerAgentPanelController(customerId, {
7276
7280
  open: () => setRailCollapsed(false),
@@ -7305,7 +7309,7 @@ function AgentWidget({
7305
7309
  })
7306
7310
  );
7307
7311
  }
7308
- (0, import_react15.useEffect)(() => {
7312
+ (0, import_react16.useEffect)(() => {
7309
7313
  if (railCollapsed) return;
7310
7314
  const handleKeyDown = (event) => {
7311
7315
  if (event.key === "Tab" && (isMobile || railExpanded)) {