@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 +98 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +16 -3
- package/dist/index.d.ts +16 -3
- package/dist/index.js +98 -5
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -320,6 +320,7 @@ declare global {
|
|
|
320
320
|
__crow_identity_token_fetcher?: () => Promise<string>;
|
|
321
321
|
__crow_on_tool_result?: (toolName: string, result: Record<string, unknown>) => void;
|
|
322
322
|
__crow_tool_renderers?: ToolRenderers;
|
|
323
|
+
__crow_context_label?: string;
|
|
323
324
|
}
|
|
324
325
|
}
|
|
325
326
|
|
|
@@ -396,8 +397,13 @@ interface CrowWidgetProps {
|
|
|
396
397
|
* Appended after default styles, allowing overrides.
|
|
397
398
|
*/
|
|
398
399
|
customCss?: string;
|
|
400
|
+
/**
|
|
401
|
+
* Label shown at the top of the widget indicating what page/context the AI
|
|
402
|
+
* is aware of. Prop takes priority over window.crow('setContextLabel', ...).
|
|
403
|
+
*/
|
|
404
|
+
contextLabel?: string;
|
|
399
405
|
}
|
|
400
|
-
declare function CrowWidget({ productId, apiUrl, subdomain, variant, styles: propStyles, previewMode, showThinking: showThinkingProp, agentName: agentNameProp, welcomeMessage: welcomeMessageProp, onReady, onIdentify, tools, navigate, onToolResult, getIdentityToken, context, toolRenderers, language, customCss, }: CrowWidgetProps): react_jsx_runtime.JSX.Element;
|
|
406
|
+
declare function CrowWidget({ productId, apiUrl, subdomain, variant, styles: propStyles, previewMode, showThinking: showThinkingProp, agentName: agentNameProp, welcomeMessage: welcomeMessageProp, onReady, onIdentify, tools, navigate, onToolResult, getIdentityToken, context, toolRenderers, language, customCss, contextLabel: contextLabelProp, }: CrowWidgetProps): react_jsx_runtime.JSX.Element;
|
|
401
407
|
|
|
402
408
|
interface CrowCopilotProps {
|
|
403
409
|
/** Product ID for this copilot */
|
|
@@ -479,8 +485,13 @@ interface CrowCopilotProps {
|
|
|
479
485
|
* responds in that language and the welcome message is translated.
|
|
480
486
|
*/
|
|
481
487
|
language?: string;
|
|
488
|
+
/**
|
|
489
|
+
* Label shown at the top of the copilot indicating what page/context the AI
|
|
490
|
+
* is aware of. Prop takes priority over window.crow('setContextLabel', ...).
|
|
491
|
+
*/
|
|
492
|
+
contextLabel?: string;
|
|
482
493
|
}
|
|
483
|
-
declare function CrowCopilot({ productId, apiUrl, subdomain, variant, title, agentName: agentNameProp, welcomeMessage: welcomeMessageProp, position, width, defaultOpen, showClose, onClose, styles: propStyles, previewMode, className, onReady, navigate, onToolResult, toolRenderers, getIdentityToken, context, language, }: CrowCopilotProps): react_jsx_runtime.JSX.Element;
|
|
494
|
+
declare function CrowCopilot({ productId, apiUrl, subdomain, variant, title, agentName: agentNameProp, welcomeMessage: welcomeMessageProp, position, width, defaultOpen, showClose, onClose, styles: propStyles, previewMode, className, onReady, navigate, onToolResult, toolRenderers, getIdentityToken, context, language, contextLabel: contextLabelProp, }: CrowCopilotProps): react_jsx_runtime.JSX.Element;
|
|
484
495
|
|
|
485
496
|
interface CrowProviderProps extends CrowClientConfig {
|
|
486
497
|
children: React.ReactNode;
|
|
@@ -1183,8 +1194,10 @@ interface WidgetHeaderProps {
|
|
|
1183
1194
|
hasCustomTransform?: boolean;
|
|
1184
1195
|
/** Reset position & size to defaults */
|
|
1185
1196
|
onResetTransform?: () => void;
|
|
1197
|
+
/** Context label displayed below the header row */
|
|
1198
|
+
contextLabel?: string;
|
|
1186
1199
|
}
|
|
1187
|
-
declare function WidgetHeader({ isVerifiedUser, showConversationList, onNewChat, onToggleHistory, showMinimize, onToggleMinimize, onDragPointerDown, isDragging, hasCustomTransform, onResetTransform, }: WidgetHeaderProps): react_jsx_runtime.JSX.Element;
|
|
1200
|
+
declare function WidgetHeader({ isVerifiedUser, showConversationList, onNewChat, onToggleHistory, showMinimize, onToggleMinimize, onDragPointerDown, isDragging, hasCustomTransform, onResetTransform, contextLabel, }: WidgetHeaderProps): react_jsx_runtime.JSX.Element;
|
|
1188
1201
|
|
|
1189
1202
|
/**
|
|
1190
1203
|
* CopilotToggleButton - Edge toggle button for floating copilot
|
package/dist/index.d.ts
CHANGED
|
@@ -320,6 +320,7 @@ declare global {
|
|
|
320
320
|
__crow_identity_token_fetcher?: () => Promise<string>;
|
|
321
321
|
__crow_on_tool_result?: (toolName: string, result: Record<string, unknown>) => void;
|
|
322
322
|
__crow_tool_renderers?: ToolRenderers;
|
|
323
|
+
__crow_context_label?: string;
|
|
323
324
|
}
|
|
324
325
|
}
|
|
325
326
|
|
|
@@ -396,8 +397,13 @@ interface CrowWidgetProps {
|
|
|
396
397
|
* Appended after default styles, allowing overrides.
|
|
397
398
|
*/
|
|
398
399
|
customCss?: string;
|
|
400
|
+
/**
|
|
401
|
+
* Label shown at the top of the widget indicating what page/context the AI
|
|
402
|
+
* is aware of. Prop takes priority over window.crow('setContextLabel', ...).
|
|
403
|
+
*/
|
|
404
|
+
contextLabel?: string;
|
|
399
405
|
}
|
|
400
|
-
declare function CrowWidget({ productId, apiUrl, subdomain, variant, styles: propStyles, previewMode, showThinking: showThinkingProp, agentName: agentNameProp, welcomeMessage: welcomeMessageProp, onReady, onIdentify, tools, navigate, onToolResult, getIdentityToken, context, toolRenderers, language, customCss, }: CrowWidgetProps): react_jsx_runtime.JSX.Element;
|
|
406
|
+
declare function CrowWidget({ productId, apiUrl, subdomain, variant, styles: propStyles, previewMode, showThinking: showThinkingProp, agentName: agentNameProp, welcomeMessage: welcomeMessageProp, onReady, onIdentify, tools, navigate, onToolResult, getIdentityToken, context, toolRenderers, language, customCss, contextLabel: contextLabelProp, }: CrowWidgetProps): react_jsx_runtime.JSX.Element;
|
|
401
407
|
|
|
402
408
|
interface CrowCopilotProps {
|
|
403
409
|
/** Product ID for this copilot */
|
|
@@ -479,8 +485,13 @@ interface CrowCopilotProps {
|
|
|
479
485
|
* responds in that language and the welcome message is translated.
|
|
480
486
|
*/
|
|
481
487
|
language?: string;
|
|
488
|
+
/**
|
|
489
|
+
* Label shown at the top of the copilot indicating what page/context the AI
|
|
490
|
+
* is aware of. Prop takes priority over window.crow('setContextLabel', ...).
|
|
491
|
+
*/
|
|
492
|
+
contextLabel?: string;
|
|
482
493
|
}
|
|
483
|
-
declare function CrowCopilot({ productId, apiUrl, subdomain, variant, title, agentName: agentNameProp, welcomeMessage: welcomeMessageProp, position, width, defaultOpen, showClose, onClose, styles: propStyles, previewMode, className, onReady, navigate, onToolResult, toolRenderers, getIdentityToken, context, language, }: CrowCopilotProps): react_jsx_runtime.JSX.Element;
|
|
494
|
+
declare function CrowCopilot({ productId, apiUrl, subdomain, variant, title, agentName: agentNameProp, welcomeMessage: welcomeMessageProp, position, width, defaultOpen, showClose, onClose, styles: propStyles, previewMode, className, onReady, navigate, onToolResult, toolRenderers, getIdentityToken, context, language, contextLabel: contextLabelProp, }: CrowCopilotProps): react_jsx_runtime.JSX.Element;
|
|
484
495
|
|
|
485
496
|
interface CrowProviderProps extends CrowClientConfig {
|
|
486
497
|
children: React.ReactNode;
|
|
@@ -1183,8 +1194,10 @@ interface WidgetHeaderProps {
|
|
|
1183
1194
|
hasCustomTransform?: boolean;
|
|
1184
1195
|
/** Reset position & size to defaults */
|
|
1185
1196
|
onResetTransform?: () => void;
|
|
1197
|
+
/** Context label displayed below the header row */
|
|
1198
|
+
contextLabel?: string;
|
|
1186
1199
|
}
|
|
1187
|
-
declare function WidgetHeader({ isVerifiedUser, showConversationList, onNewChat, onToggleHistory, showMinimize, onToggleMinimize, onDragPointerDown, isDragging, hasCustomTransform, onResetTransform, }: WidgetHeaderProps): react_jsx_runtime.JSX.Element;
|
|
1200
|
+
declare function WidgetHeader({ isVerifiedUser, showConversationList, onNewChat, onToggleHistory, showMinimize, onToggleMinimize, onDragPointerDown, isDragging, hasCustomTransform, onResetTransform, contextLabel, }: WidgetHeaderProps): react_jsx_runtime.JSX.Element;
|
|
1188
1201
|
|
|
1189
1202
|
/**
|
|
1190
1203
|
* CopilotToggleButton - Edge toggle button for floating copilot
|
package/dist/index.js
CHANGED
|
@@ -1237,6 +1237,16 @@ function useCrowAPI({ onIdentified, onReset } = {}) {
|
|
|
1237
1237
|
}
|
|
1238
1238
|
return crowAsk(opts);
|
|
1239
1239
|
}
|
|
1240
|
+
case "setContextLabel":
|
|
1241
|
+
if (typeof options !== "string") {
|
|
1242
|
+
console.error("[Crow] setContextLabel() requires a string");
|
|
1243
|
+
return;
|
|
1244
|
+
}
|
|
1245
|
+
window.__crow_context_label = options || void 0;
|
|
1246
|
+
window.dispatchEvent(
|
|
1247
|
+
new CustomEvent("crow:setContextLabel", { detail: options })
|
|
1248
|
+
);
|
|
1249
|
+
break;
|
|
1240
1250
|
case "setSuggestedActions":
|
|
1241
1251
|
if (!Array.isArray(options)) {
|
|
1242
1252
|
console.error("[Crow] setSuggestedActions() requires an array of { label, message }");
|
|
@@ -2438,7 +2448,8 @@ function WidgetHeader({
|
|
|
2438
2448
|
onDragPointerDown,
|
|
2439
2449
|
isDragging,
|
|
2440
2450
|
hasCustomTransform,
|
|
2441
|
-
onResetTransform
|
|
2451
|
+
onResetTransform,
|
|
2452
|
+
contextLabel
|
|
2442
2453
|
}) {
|
|
2443
2454
|
const { agentName, styles } = useWidgetStyleContext();
|
|
2444
2455
|
return /* @__PURE__ */ jsxs(
|
|
@@ -2526,7 +2537,36 @@ function WidgetHeader({
|
|
|
2526
2537
|
children: /* @__PURE__ */ jsx(X, { size: 18, className: "crow-text-gray-700" })
|
|
2527
2538
|
}
|
|
2528
2539
|
)
|
|
2529
|
-
] })
|
|
2540
|
+
] }),
|
|
2541
|
+
contextLabel && /* @__PURE__ */ jsxs(
|
|
2542
|
+
"div",
|
|
2543
|
+
{
|
|
2544
|
+
className: "crow-flex crow-items-center crow-gap-1.5 crow-mt-1 crow-text-xs",
|
|
2545
|
+
style: { color: "#6b7280" },
|
|
2546
|
+
children: [
|
|
2547
|
+
/* @__PURE__ */ jsxs(
|
|
2548
|
+
"svg",
|
|
2549
|
+
{
|
|
2550
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
2551
|
+
width: "12",
|
|
2552
|
+
height: "12",
|
|
2553
|
+
viewBox: "0 0 24 24",
|
|
2554
|
+
fill: "none",
|
|
2555
|
+
stroke: "currentColor",
|
|
2556
|
+
strokeWidth: "2",
|
|
2557
|
+
strokeLinecap: "round",
|
|
2558
|
+
strokeLinejoin: "round",
|
|
2559
|
+
className: "crow-shrink-0",
|
|
2560
|
+
children: [
|
|
2561
|
+
/* @__PURE__ */ jsx("path", { d: "M20 10c0 6-8 12-8 12s-8-6-8-12a8 8 0 0 1 16 0Z" }),
|
|
2562
|
+
/* @__PURE__ */ jsx("circle", { cx: "12", cy: "10", r: "3" })
|
|
2563
|
+
]
|
|
2564
|
+
}
|
|
2565
|
+
),
|
|
2566
|
+
/* @__PURE__ */ jsx("span", { className: "crow-truncate", children: contextLabel })
|
|
2567
|
+
]
|
|
2568
|
+
}
|
|
2569
|
+
)
|
|
2530
2570
|
]
|
|
2531
2571
|
}
|
|
2532
2572
|
);
|
|
@@ -4132,7 +4172,8 @@ function CrowWidget({
|
|
|
4132
4172
|
context,
|
|
4133
4173
|
toolRenderers,
|
|
4134
4174
|
language,
|
|
4135
|
-
customCss
|
|
4175
|
+
customCss,
|
|
4176
|
+
contextLabel: contextLabelProp
|
|
4136
4177
|
}) {
|
|
4137
4178
|
const effectiveGetIdentityToken = getIdentityToken || window.__crow_identity_token_fetcher;
|
|
4138
4179
|
const effectiveOnToolResult = onToolResult || window.__crow_on_tool_result;
|
|
@@ -4173,6 +4214,15 @@ function CrowWidget({
|
|
|
4173
4214
|
window.addEventListener("crow:setGreeting", handler);
|
|
4174
4215
|
return () => window.removeEventListener("crow:setGreeting", handler);
|
|
4175
4216
|
}, []);
|
|
4217
|
+
const [contextLabelFromAPI, setContextLabelFromAPI] = useState(
|
|
4218
|
+
() => window.__crow_context_label
|
|
4219
|
+
);
|
|
4220
|
+
useEffect(() => {
|
|
4221
|
+
const handler = (e) => setContextLabelFromAPI(e.detail || void 0);
|
|
4222
|
+
window.addEventListener("crow:setContextLabel", handler);
|
|
4223
|
+
return () => window.removeEventListener("crow:setContextLabel", handler);
|
|
4224
|
+
}, []);
|
|
4225
|
+
const contextLabel = contextLabelProp ?? contextLabelFromAPI;
|
|
4176
4226
|
const agentName = agentNameProp ?? agentNameFromAPI;
|
|
4177
4227
|
const welcomeMessage = greetingOverride ?? welcomeMessageProp ?? welcomeMessageFromAPI;
|
|
4178
4228
|
const selectedModel = selectedModelFromAPI;
|
|
@@ -4663,7 +4713,8 @@ function CrowWidget({
|
|
|
4663
4713
|
onDragPointerDown: variant === "floating" ? transform.onDragPointerDown : void 0,
|
|
4664
4714
|
isDragging: transform.isDragging,
|
|
4665
4715
|
hasCustomTransform: transform.hasCustomTransform,
|
|
4666
|
-
onResetTransform: transform.resetTransform
|
|
4716
|
+
onResetTransform: transform.resetTransform,
|
|
4717
|
+
contextLabel
|
|
4667
4718
|
}
|
|
4668
4719
|
),
|
|
4669
4720
|
/* @__PURE__ */ jsx(AnimatePresence, { children: showConversationList && isVerifiedUser && /* @__PURE__ */ jsx(
|
|
@@ -5055,7 +5106,8 @@ function CrowCopilot({
|
|
|
5055
5106
|
toolRenderers,
|
|
5056
5107
|
getIdentityToken,
|
|
5057
5108
|
context,
|
|
5058
|
-
language
|
|
5109
|
+
language,
|
|
5110
|
+
contextLabel: contextLabelProp
|
|
5059
5111
|
}) {
|
|
5060
5112
|
const effectiveGetIdentityToken = getIdentityToken || window.__crow_identity_token_fetcher;
|
|
5061
5113
|
const effectiveOnToolResult = onToolResult || window.__crow_on_tool_result;
|
|
@@ -5096,6 +5148,15 @@ function CrowCopilot({
|
|
|
5096
5148
|
return () => window.removeEventListener("crow:setGreeting", handler);
|
|
5097
5149
|
}, []);
|
|
5098
5150
|
const welcomeMessage = greetingOverride ?? welcomeMessageProp ?? welcomeMessageFromAPI;
|
|
5151
|
+
const [contextLabelFromAPI, setContextLabelFromAPI] = useState(
|
|
5152
|
+
() => window.__crow_context_label
|
|
5153
|
+
);
|
|
5154
|
+
useEffect(() => {
|
|
5155
|
+
const handler = (e) => setContextLabelFromAPI(e.detail || void 0);
|
|
5156
|
+
window.addEventListener("crow:setContextLabel", handler);
|
|
5157
|
+
return () => window.removeEventListener("crow:setContextLabel", handler);
|
|
5158
|
+
}, []);
|
|
5159
|
+
const contextLabel = contextLabelProp ?? contextLabelFromAPI;
|
|
5099
5160
|
const [autoTools, setAutoTools] = useState({});
|
|
5100
5161
|
const browserUseLoaded = autoTools.browser_use;
|
|
5101
5162
|
useEffect(() => {
|
|
@@ -5910,6 +5971,38 @@ function CrowCopilot({
|
|
|
5910
5971
|
]
|
|
5911
5972
|
}
|
|
5912
5973
|
),
|
|
5974
|
+
contextLabel && /* @__PURE__ */ jsxs(
|
|
5975
|
+
"div",
|
|
5976
|
+
{
|
|
5977
|
+
className: "crow-flex crow-items-center crow-gap-1.5 crow-px-3 crow-py-1.5 crow-border-b crow-text-xs",
|
|
5978
|
+
style: {
|
|
5979
|
+
color: "#6b7280",
|
|
5980
|
+
borderColor: styles.colors.border
|
|
5981
|
+
},
|
|
5982
|
+
children: [
|
|
5983
|
+
/* @__PURE__ */ jsxs(
|
|
5984
|
+
"svg",
|
|
5985
|
+
{
|
|
5986
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
5987
|
+
width: "12",
|
|
5988
|
+
height: "12",
|
|
5989
|
+
viewBox: "0 0 24 24",
|
|
5990
|
+
fill: "none",
|
|
5991
|
+
stroke: "currentColor",
|
|
5992
|
+
strokeWidth: "2",
|
|
5993
|
+
strokeLinecap: "round",
|
|
5994
|
+
strokeLinejoin: "round",
|
|
5995
|
+
className: "crow-shrink-0",
|
|
5996
|
+
children: [
|
|
5997
|
+
/* @__PURE__ */ jsx("path", { d: "M20 10c0 6-8 12-8 12s-8-6-8-12a8 8 0 0 1 16 0Z" }),
|
|
5998
|
+
/* @__PURE__ */ jsx("circle", { cx: "12", cy: "10", r: "3" })
|
|
5999
|
+
]
|
|
6000
|
+
}
|
|
6001
|
+
),
|
|
6002
|
+
/* @__PURE__ */ jsx("span", { className: "crow-truncate", children: contextLabel })
|
|
6003
|
+
]
|
|
6004
|
+
}
|
|
6005
|
+
),
|
|
5913
6006
|
/* @__PURE__ */ jsxs(AnimatePresence, { children: [
|
|
5914
6007
|
showConversationList && isVerifiedUser && /* @__PURE__ */ jsx(
|
|
5915
6008
|
ConversationList,
|