@usecrow/ui 0.1.43 → 0.1.45
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 +419 -51
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +89 -65
- package/dist/index.d.ts +89 -65
- package/dist/index.js +419 -51
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.d.cts
CHANGED
|
@@ -198,65 +198,6 @@ interface WidgetConfigResponse {
|
|
|
198
198
|
}>;
|
|
199
199
|
}
|
|
200
200
|
|
|
201
|
-
/** Identity data passed to the identify function */
|
|
202
|
-
interface IdentifyData {
|
|
203
|
-
/** JWT token from your backend */
|
|
204
|
-
token: string;
|
|
205
|
-
/** User's display name */
|
|
206
|
-
name?: string;
|
|
207
|
-
/** Additional metadata */
|
|
208
|
-
[key: string]: unknown;
|
|
209
|
-
}
|
|
210
|
-
/** Function to identify a user */
|
|
211
|
-
type IdentifyFunction = (data: IdentifyData) => void;
|
|
212
|
-
/** Client-side tool handler */
|
|
213
|
-
type ToolHandler = (args: Record<string, unknown>) => Promise<unknown> | unknown;
|
|
214
|
-
/** Map of tool names to handlers */
|
|
215
|
-
type ToolsMap = Record<string, ToolHandler>;
|
|
216
|
-
interface CrowWidgetProps {
|
|
217
|
-
/** Product ID for this widget */
|
|
218
|
-
productId: string;
|
|
219
|
-
/** API URL (defaults to relative path) */
|
|
220
|
-
apiUrl?: string;
|
|
221
|
-
/** Widget variant: floating (with bubble) or embedded (for preview) */
|
|
222
|
-
variant?: "floating" | "embedded";
|
|
223
|
-
/** Custom styles to override DB and default styles */
|
|
224
|
-
styles?: Partial<WidgetStyleConfig>;
|
|
225
|
-
/** Skip fetching styles from API (use for preview mode with local state) */
|
|
226
|
-
previewMode?: boolean;
|
|
227
|
-
/** Whether to show AI thinking/reasoning to users (overrides API setting if provided) */
|
|
228
|
-
showThinking?: boolean;
|
|
229
|
-
/** Custom agent name shown in header (overrides API setting if provided) */
|
|
230
|
-
agentName?: string;
|
|
231
|
-
/** Custom welcome message (overrides API setting if provided) */
|
|
232
|
-
welcomeMessage?: string;
|
|
233
|
-
/** Callback when widget is ready */
|
|
234
|
-
onReady?: () => void;
|
|
235
|
-
/**
|
|
236
|
-
* Callback to identify the user. Called with an identify function
|
|
237
|
-
* that you should call with the user's token when available.
|
|
238
|
-
*/
|
|
239
|
-
onIdentify?: (identify: IdentifyFunction) => void;
|
|
240
|
-
/** Client-side tools the agent can call */
|
|
241
|
-
tools?: ToolsMap;
|
|
242
|
-
/** Custom navigation function for SPA-safe page navigation (e.g. router.push from Next.js or React Router) */
|
|
243
|
-
navigate?: (path: string) => void;
|
|
244
|
-
/** Callback fired when a server-side tool completes, with the tool name and full result data */
|
|
245
|
-
onToolResult?: (toolName: string, result: Record<string, unknown>) => void;
|
|
246
|
-
/**
|
|
247
|
-
* Async function that returns a JWT for user identity verification.
|
|
248
|
-
* Called on mount and automatically on 401 (token refresh).
|
|
249
|
-
* Preferred over onIdentify for simpler integration.
|
|
250
|
-
*/
|
|
251
|
-
getIdentityToken?: () => Promise<string>;
|
|
252
|
-
/**
|
|
253
|
-
* Page context data sent with every message. Reactive — updates whenever
|
|
254
|
-
* the object reference changes. Replaces window.crow('setContext', ...).
|
|
255
|
-
*/
|
|
256
|
-
context?: Record<string, unknown>;
|
|
257
|
-
}
|
|
258
|
-
declare function CrowWidget({ productId, apiUrl, variant, styles: propStyles, previewMode, showThinking: showThinkingProp, agentName: agentNameProp, welcomeMessage: welcomeMessageProp, onReady, onIdentify, tools, navigate, onToolResult, getIdentityToken, context, }: CrowWidgetProps): react_jsx_runtime.JSX.Element;
|
|
259
|
-
|
|
260
201
|
/**
|
|
261
202
|
* Shared TypeScript interfaces for the widget and copilot
|
|
262
203
|
*/
|
|
@@ -300,14 +241,18 @@ interface ToolCall {
|
|
|
300
241
|
timestamp: Date;
|
|
301
242
|
}
|
|
302
243
|
/**
|
|
303
|
-
* Map of tool name → custom
|
|
304
|
-
*
|
|
305
|
-
*
|
|
244
|
+
* Map of tool name → custom renderer for inline tool results.
|
|
245
|
+
*
|
|
246
|
+
* Return types:
|
|
247
|
+
* - ReactNode (React SDK) — rendered directly
|
|
248
|
+
* - string (script tag) — sanitized HTML rendered via innerHTML
|
|
249
|
+
* - HTMLElement (script tag) — mounted into a container (for Chart.js, D3, etc.)
|
|
306
250
|
*/
|
|
251
|
+
type ToolRendererResult = ReactNode | string | HTMLElement;
|
|
307
252
|
type ToolRenderers = Record<string, (props: {
|
|
308
253
|
result: unknown;
|
|
309
254
|
status: string;
|
|
310
|
-
}) =>
|
|
255
|
+
}) => ToolRendererResult>;
|
|
311
256
|
interface WorkflowTodo {
|
|
312
257
|
id: string;
|
|
313
258
|
text: string;
|
|
@@ -359,9 +304,76 @@ declare global {
|
|
|
359
304
|
__crow_journey_callback?: (event: JourneyEvent) => void;
|
|
360
305
|
__crow_client_tools?: Record<string, ClientToolHandler>;
|
|
361
306
|
__crow_page_context?: Record<string, unknown>;
|
|
307
|
+
__crow_identity_token_fetcher?: () => Promise<string>;
|
|
308
|
+
__crow_on_tool_result?: (toolName: string, result: Record<string, unknown>) => void;
|
|
309
|
+
__crow_tool_renderers?: ToolRenderers;
|
|
362
310
|
}
|
|
363
311
|
}
|
|
364
312
|
|
|
313
|
+
/** Identity data passed to the identify function */
|
|
314
|
+
interface IdentifyData {
|
|
315
|
+
/** JWT token from your backend */
|
|
316
|
+
token: string;
|
|
317
|
+
/** User's display name */
|
|
318
|
+
name?: string;
|
|
319
|
+
/** Additional metadata */
|
|
320
|
+
[key: string]: unknown;
|
|
321
|
+
}
|
|
322
|
+
/** Function to identify a user */
|
|
323
|
+
type IdentifyFunction = (data: IdentifyData) => void;
|
|
324
|
+
/** Client-side tool handler */
|
|
325
|
+
type ToolHandler = (args: Record<string, unknown>) => Promise<unknown> | unknown;
|
|
326
|
+
/** Map of tool names to handlers */
|
|
327
|
+
type ToolsMap = Record<string, ToolHandler>;
|
|
328
|
+
interface CrowWidgetProps {
|
|
329
|
+
/** Product ID for this widget */
|
|
330
|
+
productId: string;
|
|
331
|
+
/** API URL (defaults to relative path) */
|
|
332
|
+
apiUrl?: string;
|
|
333
|
+
/** Widget variant: floating (with bubble) or embedded (for preview) */
|
|
334
|
+
variant?: "floating" | "embedded";
|
|
335
|
+
/** Custom styles to override DB and default styles */
|
|
336
|
+
styles?: Partial<WidgetStyleConfig>;
|
|
337
|
+
/** Skip fetching styles from API (use for preview mode with local state) */
|
|
338
|
+
previewMode?: boolean;
|
|
339
|
+
/** Whether to show AI thinking/reasoning to users (overrides API setting if provided) */
|
|
340
|
+
showThinking?: boolean;
|
|
341
|
+
/** Custom agent name shown in header (overrides API setting if provided) */
|
|
342
|
+
agentName?: string;
|
|
343
|
+
/** Custom welcome message (overrides API setting if provided) */
|
|
344
|
+
welcomeMessage?: string;
|
|
345
|
+
/** Callback when widget is ready */
|
|
346
|
+
onReady?: () => void;
|
|
347
|
+
/**
|
|
348
|
+
* Callback to identify the user. Called with an identify function
|
|
349
|
+
* that you should call with the user's token when available.
|
|
350
|
+
*/
|
|
351
|
+
onIdentify?: (identify: IdentifyFunction) => void;
|
|
352
|
+
/** Client-side tools the agent can call */
|
|
353
|
+
tools?: ToolsMap;
|
|
354
|
+
/** Custom navigation function for SPA-safe page navigation (e.g. router.push from Next.js or React Router) */
|
|
355
|
+
navigate?: (path: string) => void;
|
|
356
|
+
/** Callback fired when a server-side tool completes, with the tool name and full result data */
|
|
357
|
+
onToolResult?: (toolName: string, result: Record<string, unknown>) => void;
|
|
358
|
+
/**
|
|
359
|
+
* Async function that returns a JWT for user identity verification.
|
|
360
|
+
* Called on mount and automatically on 401 (token refresh).
|
|
361
|
+
* Preferred over onIdentify for simpler integration.
|
|
362
|
+
*/
|
|
363
|
+
getIdentityToken?: () => Promise<string>;
|
|
364
|
+
/**
|
|
365
|
+
* Page context data sent with every message. Reactive — updates whenever
|
|
366
|
+
* the object reference changes. Replaces window.crow('setContext', ...).
|
|
367
|
+
*/
|
|
368
|
+
context?: Record<string, unknown>;
|
|
369
|
+
/**
|
|
370
|
+
* Custom renderers for tool results. When a tool completes and a renderer
|
|
371
|
+
* exists for its name, that component is rendered inline in the chat.
|
|
372
|
+
*/
|
|
373
|
+
toolRenderers?: ToolRenderers;
|
|
374
|
+
}
|
|
375
|
+
declare function CrowWidget({ productId, apiUrl, variant, styles: propStyles, previewMode, showThinking: showThinkingProp, agentName: agentNameProp, welcomeMessage: welcomeMessageProp, onReady, onIdentify, tools, navigate, onToolResult, getIdentityToken, context, toolRenderers, }: CrowWidgetProps): react_jsx_runtime.JSX.Element;
|
|
376
|
+
|
|
365
377
|
interface CrowCopilotProps {
|
|
366
378
|
/** Product ID for this copilot */
|
|
367
379
|
productId: string;
|
|
@@ -1063,13 +1075,24 @@ declare function WidgetHeader({ isVerifiedUser, showConversationList, onNewChat,
|
|
|
1063
1075
|
|
|
1064
1076
|
/**
|
|
1065
1077
|
* CopilotToggleButton - Edge toggle button for floating copilot
|
|
1078
|
+
*
|
|
1079
|
+
* Supports dual interaction:
|
|
1080
|
+
* - Click: toggle sidebar open/close
|
|
1081
|
+
* - Drag: resize sidebar width (when open)
|
|
1082
|
+
*
|
|
1083
|
+
* Forwards ref to the <button> so CopilotContainer can directly
|
|
1084
|
+
* manipulate its style.transition during drag for zero-lag resizing.
|
|
1066
1085
|
*/
|
|
1067
1086
|
interface CopilotToggleButtonProps {
|
|
1068
1087
|
isOpen: boolean;
|
|
1069
1088
|
position: "left" | "right";
|
|
1070
1089
|
onClick: () => void;
|
|
1090
|
+
/** Called on mousedown to initiate potential drag-to-resize */
|
|
1091
|
+
onMouseDown?: (e: React.MouseEvent) => void;
|
|
1092
|
+
/** Whether the user is actively dragging to resize */
|
|
1093
|
+
isDragging?: boolean;
|
|
1071
1094
|
}
|
|
1072
|
-
declare
|
|
1095
|
+
declare const CopilotToggleButton: react.ForwardRefExoticComponent<CopilotToggleButtonProps & react.RefAttributes<HTMLButtonElement>>;
|
|
1073
1096
|
|
|
1074
1097
|
interface CopilotContainerProps {
|
|
1075
1098
|
position: "left" | "right";
|
|
@@ -1077,8 +1100,9 @@ interface CopilotContainerProps {
|
|
|
1077
1100
|
defaultOpen: boolean;
|
|
1078
1101
|
children: (controls: {
|
|
1079
1102
|
close: () => void;
|
|
1103
|
+
currentWidth: number;
|
|
1080
1104
|
}) => ReactNode;
|
|
1081
1105
|
}
|
|
1082
|
-
declare function CopilotContainer({ position, width, defaultOpen, children, }: CopilotContainerProps): react_jsx_runtime.JSX.Element;
|
|
1106
|
+
declare function CopilotContainer({ position, width: initialWidth, defaultOpen, children, }: CopilotContainerProps): react_jsx_runtime.JSX.Element;
|
|
1083
1107
|
|
|
1084
1108
|
export { AVAILABLE_MODELS, type ActiveWorkflow, type AnimationsConfig, CSS_VAR_NAMES, ChatBubble, type Citation, type ClientToolHandler, type ColorsConfig, type Conversation, ConversationList, type CopilotBrandingConfig, CopilotContainer, type CopilotDimensionsConfig, type CopilotPositionConfig, type CopilotStyleConfig, CopilotStyleProvider, CopilotToggleButton, CrowCopilot, type CrowCopilotProps, CrowProvider, CrowWidget, type CrowWidgetProps, DEFAULT_COPILOT_STYLES, DEFAULT_MODEL, DEFAULT_WELCOME_MESSAGE, DEFAULT_WIDGET_STYLES, type IdentifyData, type IdentifyFunction, type JourneyEvent, LoadingHistory, MESSAGES_CONTAINER_ID, type Message, MessageBubble, MessageList, MessagesContainer, type Model, ModelSelector, PoweredByBadge, PromptInputBox, ReasoningTrace, type ResolvedCopilotStyles, type ResolvedWidgetStyles, ShadowContainer, StreamingText, ThinkingIndicator, type ToolCall, type ToolHandler, type ToolRenderers, type ToolsMap, type TypographyConfig, WIDGET_CSS, type WidgetBrandingConfig, type WidgetBubbleConfig, type WidgetConfigResponse, type WidgetDimensionsConfig, WidgetHeader, type WidgetPositionConfig, type WidgetProps, type WidgetShadowsConfig, WidgetShell, type WidgetStyleConfig, WidgetStyleProvider, WorkflowPanel, type WorkflowTodo, clearStyleCache, getCssVar, injectStyles, mergeCopilotStyles, mergeWidgetStyles, stylesToCSSVariables, stylesToCssVars, useChat, useConversations, useCopilotStyleContext, useCopilotStyles$1 as useCopilotStyles, useCopilotStyles as useCopilotStylesContext, useCrowAPI, usePreviewCopilotStyles, usePreviewWidgetStyles, useWidgetStyleContext, useWidgetStyles$1 as useWidgetStyles, useWidgetStyles as useWidgetStylesContext, useWorkflow };
|
package/dist/index.d.ts
CHANGED
|
@@ -198,65 +198,6 @@ interface WidgetConfigResponse {
|
|
|
198
198
|
}>;
|
|
199
199
|
}
|
|
200
200
|
|
|
201
|
-
/** Identity data passed to the identify function */
|
|
202
|
-
interface IdentifyData {
|
|
203
|
-
/** JWT token from your backend */
|
|
204
|
-
token: string;
|
|
205
|
-
/** User's display name */
|
|
206
|
-
name?: string;
|
|
207
|
-
/** Additional metadata */
|
|
208
|
-
[key: string]: unknown;
|
|
209
|
-
}
|
|
210
|
-
/** Function to identify a user */
|
|
211
|
-
type IdentifyFunction = (data: IdentifyData) => void;
|
|
212
|
-
/** Client-side tool handler */
|
|
213
|
-
type ToolHandler = (args: Record<string, unknown>) => Promise<unknown> | unknown;
|
|
214
|
-
/** Map of tool names to handlers */
|
|
215
|
-
type ToolsMap = Record<string, ToolHandler>;
|
|
216
|
-
interface CrowWidgetProps {
|
|
217
|
-
/** Product ID for this widget */
|
|
218
|
-
productId: string;
|
|
219
|
-
/** API URL (defaults to relative path) */
|
|
220
|
-
apiUrl?: string;
|
|
221
|
-
/** Widget variant: floating (with bubble) or embedded (for preview) */
|
|
222
|
-
variant?: "floating" | "embedded";
|
|
223
|
-
/** Custom styles to override DB and default styles */
|
|
224
|
-
styles?: Partial<WidgetStyleConfig>;
|
|
225
|
-
/** Skip fetching styles from API (use for preview mode with local state) */
|
|
226
|
-
previewMode?: boolean;
|
|
227
|
-
/** Whether to show AI thinking/reasoning to users (overrides API setting if provided) */
|
|
228
|
-
showThinking?: boolean;
|
|
229
|
-
/** Custom agent name shown in header (overrides API setting if provided) */
|
|
230
|
-
agentName?: string;
|
|
231
|
-
/** Custom welcome message (overrides API setting if provided) */
|
|
232
|
-
welcomeMessage?: string;
|
|
233
|
-
/** Callback when widget is ready */
|
|
234
|
-
onReady?: () => void;
|
|
235
|
-
/**
|
|
236
|
-
* Callback to identify the user. Called with an identify function
|
|
237
|
-
* that you should call with the user's token when available.
|
|
238
|
-
*/
|
|
239
|
-
onIdentify?: (identify: IdentifyFunction) => void;
|
|
240
|
-
/** Client-side tools the agent can call */
|
|
241
|
-
tools?: ToolsMap;
|
|
242
|
-
/** Custom navigation function for SPA-safe page navigation (e.g. router.push from Next.js or React Router) */
|
|
243
|
-
navigate?: (path: string) => void;
|
|
244
|
-
/** Callback fired when a server-side tool completes, with the tool name and full result data */
|
|
245
|
-
onToolResult?: (toolName: string, result: Record<string, unknown>) => void;
|
|
246
|
-
/**
|
|
247
|
-
* Async function that returns a JWT for user identity verification.
|
|
248
|
-
* Called on mount and automatically on 401 (token refresh).
|
|
249
|
-
* Preferred over onIdentify for simpler integration.
|
|
250
|
-
*/
|
|
251
|
-
getIdentityToken?: () => Promise<string>;
|
|
252
|
-
/**
|
|
253
|
-
* Page context data sent with every message. Reactive — updates whenever
|
|
254
|
-
* the object reference changes. Replaces window.crow('setContext', ...).
|
|
255
|
-
*/
|
|
256
|
-
context?: Record<string, unknown>;
|
|
257
|
-
}
|
|
258
|
-
declare function CrowWidget({ productId, apiUrl, variant, styles: propStyles, previewMode, showThinking: showThinkingProp, agentName: agentNameProp, welcomeMessage: welcomeMessageProp, onReady, onIdentify, tools, navigate, onToolResult, getIdentityToken, context, }: CrowWidgetProps): react_jsx_runtime.JSX.Element;
|
|
259
|
-
|
|
260
201
|
/**
|
|
261
202
|
* Shared TypeScript interfaces for the widget and copilot
|
|
262
203
|
*/
|
|
@@ -300,14 +241,18 @@ interface ToolCall {
|
|
|
300
241
|
timestamp: Date;
|
|
301
242
|
}
|
|
302
243
|
/**
|
|
303
|
-
* Map of tool name → custom
|
|
304
|
-
*
|
|
305
|
-
*
|
|
244
|
+
* Map of tool name → custom renderer for inline tool results.
|
|
245
|
+
*
|
|
246
|
+
* Return types:
|
|
247
|
+
* - ReactNode (React SDK) — rendered directly
|
|
248
|
+
* - string (script tag) — sanitized HTML rendered via innerHTML
|
|
249
|
+
* - HTMLElement (script tag) — mounted into a container (for Chart.js, D3, etc.)
|
|
306
250
|
*/
|
|
251
|
+
type ToolRendererResult = ReactNode | string | HTMLElement;
|
|
307
252
|
type ToolRenderers = Record<string, (props: {
|
|
308
253
|
result: unknown;
|
|
309
254
|
status: string;
|
|
310
|
-
}) =>
|
|
255
|
+
}) => ToolRendererResult>;
|
|
311
256
|
interface WorkflowTodo {
|
|
312
257
|
id: string;
|
|
313
258
|
text: string;
|
|
@@ -359,9 +304,76 @@ declare global {
|
|
|
359
304
|
__crow_journey_callback?: (event: JourneyEvent) => void;
|
|
360
305
|
__crow_client_tools?: Record<string, ClientToolHandler>;
|
|
361
306
|
__crow_page_context?: Record<string, unknown>;
|
|
307
|
+
__crow_identity_token_fetcher?: () => Promise<string>;
|
|
308
|
+
__crow_on_tool_result?: (toolName: string, result: Record<string, unknown>) => void;
|
|
309
|
+
__crow_tool_renderers?: ToolRenderers;
|
|
362
310
|
}
|
|
363
311
|
}
|
|
364
312
|
|
|
313
|
+
/** Identity data passed to the identify function */
|
|
314
|
+
interface IdentifyData {
|
|
315
|
+
/** JWT token from your backend */
|
|
316
|
+
token: string;
|
|
317
|
+
/** User's display name */
|
|
318
|
+
name?: string;
|
|
319
|
+
/** Additional metadata */
|
|
320
|
+
[key: string]: unknown;
|
|
321
|
+
}
|
|
322
|
+
/** Function to identify a user */
|
|
323
|
+
type IdentifyFunction = (data: IdentifyData) => void;
|
|
324
|
+
/** Client-side tool handler */
|
|
325
|
+
type ToolHandler = (args: Record<string, unknown>) => Promise<unknown> | unknown;
|
|
326
|
+
/** Map of tool names to handlers */
|
|
327
|
+
type ToolsMap = Record<string, ToolHandler>;
|
|
328
|
+
interface CrowWidgetProps {
|
|
329
|
+
/** Product ID for this widget */
|
|
330
|
+
productId: string;
|
|
331
|
+
/** API URL (defaults to relative path) */
|
|
332
|
+
apiUrl?: string;
|
|
333
|
+
/** Widget variant: floating (with bubble) or embedded (for preview) */
|
|
334
|
+
variant?: "floating" | "embedded";
|
|
335
|
+
/** Custom styles to override DB and default styles */
|
|
336
|
+
styles?: Partial<WidgetStyleConfig>;
|
|
337
|
+
/** Skip fetching styles from API (use for preview mode with local state) */
|
|
338
|
+
previewMode?: boolean;
|
|
339
|
+
/** Whether to show AI thinking/reasoning to users (overrides API setting if provided) */
|
|
340
|
+
showThinking?: boolean;
|
|
341
|
+
/** Custom agent name shown in header (overrides API setting if provided) */
|
|
342
|
+
agentName?: string;
|
|
343
|
+
/** Custom welcome message (overrides API setting if provided) */
|
|
344
|
+
welcomeMessage?: string;
|
|
345
|
+
/** Callback when widget is ready */
|
|
346
|
+
onReady?: () => void;
|
|
347
|
+
/**
|
|
348
|
+
* Callback to identify the user. Called with an identify function
|
|
349
|
+
* that you should call with the user's token when available.
|
|
350
|
+
*/
|
|
351
|
+
onIdentify?: (identify: IdentifyFunction) => void;
|
|
352
|
+
/** Client-side tools the agent can call */
|
|
353
|
+
tools?: ToolsMap;
|
|
354
|
+
/** Custom navigation function for SPA-safe page navigation (e.g. router.push from Next.js or React Router) */
|
|
355
|
+
navigate?: (path: string) => void;
|
|
356
|
+
/** Callback fired when a server-side tool completes, with the tool name and full result data */
|
|
357
|
+
onToolResult?: (toolName: string, result: Record<string, unknown>) => void;
|
|
358
|
+
/**
|
|
359
|
+
* Async function that returns a JWT for user identity verification.
|
|
360
|
+
* Called on mount and automatically on 401 (token refresh).
|
|
361
|
+
* Preferred over onIdentify for simpler integration.
|
|
362
|
+
*/
|
|
363
|
+
getIdentityToken?: () => Promise<string>;
|
|
364
|
+
/**
|
|
365
|
+
* Page context data sent with every message. Reactive — updates whenever
|
|
366
|
+
* the object reference changes. Replaces window.crow('setContext', ...).
|
|
367
|
+
*/
|
|
368
|
+
context?: Record<string, unknown>;
|
|
369
|
+
/**
|
|
370
|
+
* Custom renderers for tool results. When a tool completes and a renderer
|
|
371
|
+
* exists for its name, that component is rendered inline in the chat.
|
|
372
|
+
*/
|
|
373
|
+
toolRenderers?: ToolRenderers;
|
|
374
|
+
}
|
|
375
|
+
declare function CrowWidget({ productId, apiUrl, variant, styles: propStyles, previewMode, showThinking: showThinkingProp, agentName: agentNameProp, welcomeMessage: welcomeMessageProp, onReady, onIdentify, tools, navigate, onToolResult, getIdentityToken, context, toolRenderers, }: CrowWidgetProps): react_jsx_runtime.JSX.Element;
|
|
376
|
+
|
|
365
377
|
interface CrowCopilotProps {
|
|
366
378
|
/** Product ID for this copilot */
|
|
367
379
|
productId: string;
|
|
@@ -1063,13 +1075,24 @@ declare function WidgetHeader({ isVerifiedUser, showConversationList, onNewChat,
|
|
|
1063
1075
|
|
|
1064
1076
|
/**
|
|
1065
1077
|
* CopilotToggleButton - Edge toggle button for floating copilot
|
|
1078
|
+
*
|
|
1079
|
+
* Supports dual interaction:
|
|
1080
|
+
* - Click: toggle sidebar open/close
|
|
1081
|
+
* - Drag: resize sidebar width (when open)
|
|
1082
|
+
*
|
|
1083
|
+
* Forwards ref to the <button> so CopilotContainer can directly
|
|
1084
|
+
* manipulate its style.transition during drag for zero-lag resizing.
|
|
1066
1085
|
*/
|
|
1067
1086
|
interface CopilotToggleButtonProps {
|
|
1068
1087
|
isOpen: boolean;
|
|
1069
1088
|
position: "left" | "right";
|
|
1070
1089
|
onClick: () => void;
|
|
1090
|
+
/** Called on mousedown to initiate potential drag-to-resize */
|
|
1091
|
+
onMouseDown?: (e: React.MouseEvent) => void;
|
|
1092
|
+
/** Whether the user is actively dragging to resize */
|
|
1093
|
+
isDragging?: boolean;
|
|
1071
1094
|
}
|
|
1072
|
-
declare
|
|
1095
|
+
declare const CopilotToggleButton: react.ForwardRefExoticComponent<CopilotToggleButtonProps & react.RefAttributes<HTMLButtonElement>>;
|
|
1073
1096
|
|
|
1074
1097
|
interface CopilotContainerProps {
|
|
1075
1098
|
position: "left" | "right";
|
|
@@ -1077,8 +1100,9 @@ interface CopilotContainerProps {
|
|
|
1077
1100
|
defaultOpen: boolean;
|
|
1078
1101
|
children: (controls: {
|
|
1079
1102
|
close: () => void;
|
|
1103
|
+
currentWidth: number;
|
|
1080
1104
|
}) => ReactNode;
|
|
1081
1105
|
}
|
|
1082
|
-
declare function CopilotContainer({ position, width, defaultOpen, children, }: CopilotContainerProps): react_jsx_runtime.JSX.Element;
|
|
1106
|
+
declare function CopilotContainer({ position, width: initialWidth, defaultOpen, children, }: CopilotContainerProps): react_jsx_runtime.JSX.Element;
|
|
1083
1107
|
|
|
1084
1108
|
export { AVAILABLE_MODELS, type ActiveWorkflow, type AnimationsConfig, CSS_VAR_NAMES, ChatBubble, type Citation, type ClientToolHandler, type ColorsConfig, type Conversation, ConversationList, type CopilotBrandingConfig, CopilotContainer, type CopilotDimensionsConfig, type CopilotPositionConfig, type CopilotStyleConfig, CopilotStyleProvider, CopilotToggleButton, CrowCopilot, type CrowCopilotProps, CrowProvider, CrowWidget, type CrowWidgetProps, DEFAULT_COPILOT_STYLES, DEFAULT_MODEL, DEFAULT_WELCOME_MESSAGE, DEFAULT_WIDGET_STYLES, type IdentifyData, type IdentifyFunction, type JourneyEvent, LoadingHistory, MESSAGES_CONTAINER_ID, type Message, MessageBubble, MessageList, MessagesContainer, type Model, ModelSelector, PoweredByBadge, PromptInputBox, ReasoningTrace, type ResolvedCopilotStyles, type ResolvedWidgetStyles, ShadowContainer, StreamingText, ThinkingIndicator, type ToolCall, type ToolHandler, type ToolRenderers, type ToolsMap, type TypographyConfig, WIDGET_CSS, type WidgetBrandingConfig, type WidgetBubbleConfig, type WidgetConfigResponse, type WidgetDimensionsConfig, WidgetHeader, type WidgetPositionConfig, type WidgetProps, type WidgetShadowsConfig, WidgetShell, type WidgetStyleConfig, WidgetStyleProvider, WorkflowPanel, type WorkflowTodo, clearStyleCache, getCssVar, injectStyles, mergeCopilotStyles, mergeWidgetStyles, stylesToCSSVariables, stylesToCssVars, useChat, useConversations, useCopilotStyleContext, useCopilotStyles$1 as useCopilotStyles, useCopilotStyles as useCopilotStylesContext, useCrowAPI, usePreviewCopilotStyles, usePreviewWidgetStyles, useWidgetStyleContext, useWidgetStyles$1 as useWidgetStyles, useWidgetStyles as useWidgetStylesContext, useWorkflow };
|