@usecrow/ui 0.1.65 → 0.1.66

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/index.cjs CHANGED
@@ -1263,6 +1263,16 @@ function useCrowAPI({ onIdentified, onReset } = {}) {
1263
1263
  }
1264
1264
  return client.crowAsk(opts);
1265
1265
  }
1266
+ case "setContextLabel":
1267
+ if (typeof options !== "string") {
1268
+ console.error("[Crow] setContextLabel() requires a string");
1269
+ return;
1270
+ }
1271
+ window.__crow_context_label = options || void 0;
1272
+ window.dispatchEvent(
1273
+ new CustomEvent("crow:setContextLabel", { detail: options })
1274
+ );
1275
+ break;
1266
1276
  case "setSuggestedActions":
1267
1277
  if (!Array.isArray(options)) {
1268
1278
  console.error("[Crow] setSuggestedActions() requires an array of { label, message }");
@@ -2464,7 +2474,8 @@ function WidgetHeader({
2464
2474
  onDragPointerDown,
2465
2475
  isDragging,
2466
2476
  hasCustomTransform,
2467
- onResetTransform
2477
+ onResetTransform,
2478
+ contextLabel
2468
2479
  }) {
2469
2480
  const { agentName, styles } = useWidgetStyleContext();
2470
2481
  return /* @__PURE__ */ jsxRuntime.jsxs(
@@ -2552,7 +2563,36 @@ function WidgetHeader({
2552
2563
  children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.X, { size: 18, className: "crow-text-gray-700" })
2553
2564
  }
2554
2565
  )
2555
- ] })
2566
+ ] }),
2567
+ contextLabel && /* @__PURE__ */ jsxRuntime.jsxs(
2568
+ "div",
2569
+ {
2570
+ className: "crow-flex crow-items-center crow-gap-1.5 crow-mt-1 crow-text-xs",
2571
+ style: { color: "#6b7280" },
2572
+ children: [
2573
+ /* @__PURE__ */ jsxRuntime.jsxs(
2574
+ "svg",
2575
+ {
2576
+ xmlns: "http://www.w3.org/2000/svg",
2577
+ width: "12",
2578
+ height: "12",
2579
+ viewBox: "0 0 24 24",
2580
+ fill: "none",
2581
+ stroke: "currentColor",
2582
+ strokeWidth: "2",
2583
+ strokeLinecap: "round",
2584
+ strokeLinejoin: "round",
2585
+ className: "crow-shrink-0",
2586
+ children: [
2587
+ /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M20 10c0 6-8 12-8 12s-8-6-8-12a8 8 0 0 1 16 0Z" }),
2588
+ /* @__PURE__ */ jsxRuntime.jsx("circle", { cx: "12", cy: "10", r: "3" })
2589
+ ]
2590
+ }
2591
+ ),
2592
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "crow-truncate", children: contextLabel })
2593
+ ]
2594
+ }
2595
+ )
2556
2596
  ]
2557
2597
  }
2558
2598
  );
@@ -4158,7 +4198,8 @@ function CrowWidget({
4158
4198
  context,
4159
4199
  toolRenderers,
4160
4200
  language,
4161
- customCss
4201
+ customCss,
4202
+ contextLabel: contextLabelProp
4162
4203
  }) {
4163
4204
  const effectiveGetIdentityToken = getIdentityToken || window.__crow_identity_token_fetcher;
4164
4205
  const effectiveOnToolResult = onToolResult || window.__crow_on_tool_result;
@@ -4199,6 +4240,15 @@ function CrowWidget({
4199
4240
  window.addEventListener("crow:setGreeting", handler);
4200
4241
  return () => window.removeEventListener("crow:setGreeting", handler);
4201
4242
  }, []);
4243
+ const [contextLabelFromAPI, setContextLabelFromAPI] = React3.useState(
4244
+ () => window.__crow_context_label
4245
+ );
4246
+ React3.useEffect(() => {
4247
+ const handler = (e) => setContextLabelFromAPI(e.detail || void 0);
4248
+ window.addEventListener("crow:setContextLabel", handler);
4249
+ return () => window.removeEventListener("crow:setContextLabel", handler);
4250
+ }, []);
4251
+ const contextLabel = contextLabelProp ?? contextLabelFromAPI;
4202
4252
  const agentName = agentNameProp ?? agentNameFromAPI;
4203
4253
  const welcomeMessage = greetingOverride ?? welcomeMessageProp ?? welcomeMessageFromAPI;
4204
4254
  const selectedModel = selectedModelFromAPI;
@@ -4689,7 +4739,8 @@ function CrowWidget({
4689
4739
  onDragPointerDown: variant === "floating" ? transform.onDragPointerDown : void 0,
4690
4740
  isDragging: transform.isDragging,
4691
4741
  hasCustomTransform: transform.hasCustomTransform,
4692
- onResetTransform: transform.resetTransform
4742
+ onResetTransform: transform.resetTransform,
4743
+ contextLabel
4693
4744
  }
4694
4745
  ),
4695
4746
  /* @__PURE__ */ jsxRuntime.jsx(framerMotion.AnimatePresence, { children: showConversationList && isVerifiedUser && /* @__PURE__ */ jsxRuntime.jsx(
@@ -5081,7 +5132,8 @@ function CrowCopilot({
5081
5132
  toolRenderers,
5082
5133
  getIdentityToken,
5083
5134
  context,
5084
- language
5135
+ language,
5136
+ contextLabel: contextLabelProp
5085
5137
  }) {
5086
5138
  const effectiveGetIdentityToken = getIdentityToken || window.__crow_identity_token_fetcher;
5087
5139
  const effectiveOnToolResult = onToolResult || window.__crow_on_tool_result;
@@ -5122,6 +5174,15 @@ function CrowCopilot({
5122
5174
  return () => window.removeEventListener("crow:setGreeting", handler);
5123
5175
  }, []);
5124
5176
  const welcomeMessage = greetingOverride ?? welcomeMessageProp ?? welcomeMessageFromAPI;
5177
+ const [contextLabelFromAPI, setContextLabelFromAPI] = React3.useState(
5178
+ () => window.__crow_context_label
5179
+ );
5180
+ React3.useEffect(() => {
5181
+ const handler = (e) => setContextLabelFromAPI(e.detail || void 0);
5182
+ window.addEventListener("crow:setContextLabel", handler);
5183
+ return () => window.removeEventListener("crow:setContextLabel", handler);
5184
+ }, []);
5185
+ const contextLabel = contextLabelProp ?? contextLabelFromAPI;
5125
5186
  const [autoTools, setAutoTools] = React3.useState({});
5126
5187
  const browserUseLoaded = autoTools.browser_use;
5127
5188
  React3.useEffect(() => {
@@ -5936,6 +5997,38 @@ function CrowCopilot({
5936
5997
  ]
5937
5998
  }
5938
5999
  ),
6000
+ contextLabel && /* @__PURE__ */ jsxRuntime.jsxs(
6001
+ "div",
6002
+ {
6003
+ className: "crow-flex crow-items-center crow-gap-1.5 crow-px-3 crow-py-1.5 crow-border-b crow-text-xs",
6004
+ style: {
6005
+ color: "#6b7280",
6006
+ borderColor: styles.colors.border
6007
+ },
6008
+ children: [
6009
+ /* @__PURE__ */ jsxRuntime.jsxs(
6010
+ "svg",
6011
+ {
6012
+ xmlns: "http://www.w3.org/2000/svg",
6013
+ width: "12",
6014
+ height: "12",
6015
+ viewBox: "0 0 24 24",
6016
+ fill: "none",
6017
+ stroke: "currentColor",
6018
+ strokeWidth: "2",
6019
+ strokeLinecap: "round",
6020
+ strokeLinejoin: "round",
6021
+ className: "crow-shrink-0",
6022
+ children: [
6023
+ /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M20 10c0 6-8 12-8 12s-8-6-8-12a8 8 0 0 1 16 0Z" }),
6024
+ /* @__PURE__ */ jsxRuntime.jsx("circle", { cx: "12", cy: "10", r: "3" })
6025
+ ]
6026
+ }
6027
+ ),
6028
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "crow-truncate", children: contextLabel })
6029
+ ]
6030
+ }
6031
+ ),
5939
6032
  /* @__PURE__ */ jsxRuntime.jsxs(framerMotion.AnimatePresence, { children: [
5940
6033
  showConversationList && isVerifiedUser && /* @__PURE__ */ jsxRuntime.jsx(
5941
6034
  ConversationList,