@usecrow/ui 0.1.54 → 0.1.55

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.d.cts CHANGED
@@ -341,6 +341,8 @@ interface CrowWidgetProps {
341
341
  productId: string;
342
342
  /** API URL (defaults to relative path) */
343
343
  apiUrl?: string;
344
+ /** Subdomain for multi-endpoint routing */
345
+ subdomain?: string;
344
346
  /** Widget variant: floating (with bubble) or embedded (for preview) */
345
347
  variant?: "floating" | "embedded";
346
348
  /** Custom styles to override DB and default styles */
@@ -383,13 +385,15 @@ interface CrowWidgetProps {
383
385
  */
384
386
  toolRenderers?: ToolRenderers;
385
387
  }
386
- 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;
388
+ declare function CrowWidget({ productId, apiUrl, subdomain, variant, styles: propStyles, previewMode, showThinking: showThinkingProp, agentName: agentNameProp, welcomeMessage: welcomeMessageProp, onReady, onIdentify, tools, navigate, onToolResult, getIdentityToken, context, toolRenderers, }: CrowWidgetProps): react_jsx_runtime.JSX.Element;
387
389
 
388
390
  interface CrowCopilotProps {
389
391
  /** Product ID for this copilot */
390
392
  productId: string;
391
393
  /** API URL (defaults to relative path) */
392
394
  apiUrl?: string;
395
+ /** Subdomain for multi-endpoint routing */
396
+ subdomain?: string;
393
397
  /** Copilot variant: embedded (in-app) or floating (with toggle button) */
394
398
  variant?: "embedded" | "floating";
395
399
  /** Title shown in header (fallback if agentName not provided) */
@@ -459,7 +463,7 @@ interface CrowCopilotProps {
459
463
  */
460
464
  context?: Record<string, unknown>;
461
465
  }
462
- declare function CrowCopilot({ productId, apiUrl, variant, title, agentName: agentNameProp, welcomeMessage: welcomeMessageProp, position, width, defaultOpen, showClose, onClose, styles: propStyles, previewMode, className, onReady, navigate, onToolResult, toolRenderers, getIdentityToken, context, }: CrowCopilotProps): react_jsx_runtime.JSX.Element;
466
+ 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, }: CrowCopilotProps): react_jsx_runtime.JSX.Element;
463
467
 
464
468
  interface CrowProviderProps extends CrowClientConfig {
465
469
  children: React.ReactNode;
@@ -467,7 +471,7 @@ interface CrowProviderProps extends CrowClientConfig {
467
471
  /**
468
472
  * Provider component that creates and shares a CrowClient instance
469
473
  */
470
- declare function CrowProvider({ children, productId, apiUrl, model, }: CrowProviderProps): react_jsx_runtime.JSX.Element;
474
+ declare function CrowProvider({ children, productId, apiUrl, model, subdomain, }: CrowProviderProps): react_jsx_runtime.JSX.Element;
471
475
 
472
476
  /**
473
477
  * Default Widget and Copilot Styles
@@ -653,6 +657,8 @@ interface UseChatOptions {
653
657
  welcomeMessage?: string;
654
658
  /** AI model to use for this chat (defaults to DEFAULT_MODEL) */
655
659
  selectedModel?: string;
660
+ /** Subdomain for multi-endpoint products (routes to specific backend config) */
661
+ subdomain?: string;
656
662
  /** Per-tool consent settings — when a tool has requires_consent, show Allow/Deny before executing */
657
663
  toolConsentSettings?: Record<string, {
658
664
  requires_consent: boolean;
@@ -664,7 +670,7 @@ interface UseChatOptions {
664
670
  onToolResult?: (toolName: string, result: Record<string, unknown>) => void;
665
671
  onRestoredConversation?: (conversationId: string) => void;
666
672
  }
667
- declare function useChat({ productId, apiUrl, persistAnonymousConversations, welcomeMessage, selectedModel: initialSelectedModel, toolConsentSettings, onVerificationStatus, onConversationId, onWorkflowEvent, onToolCall, onToolResult, onRestoredConversation, }: UseChatOptions): {
673
+ declare function useChat({ productId, apiUrl, persistAnonymousConversations, welcomeMessage, selectedModel: initialSelectedModel, subdomain, toolConsentSettings, onVerificationStatus, onConversationId, onWorkflowEvent, onToolCall, onToolResult, onRestoredConversation, }: UseChatOptions): {
668
674
  messages: Message[];
669
675
  isLoading: boolean;
670
676
  activeToolCalls: ToolCall[];
package/dist/index.d.ts CHANGED
@@ -341,6 +341,8 @@ interface CrowWidgetProps {
341
341
  productId: string;
342
342
  /** API URL (defaults to relative path) */
343
343
  apiUrl?: string;
344
+ /** Subdomain for multi-endpoint routing */
345
+ subdomain?: string;
344
346
  /** Widget variant: floating (with bubble) or embedded (for preview) */
345
347
  variant?: "floating" | "embedded";
346
348
  /** Custom styles to override DB and default styles */
@@ -383,13 +385,15 @@ interface CrowWidgetProps {
383
385
  */
384
386
  toolRenderers?: ToolRenderers;
385
387
  }
386
- 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;
388
+ declare function CrowWidget({ productId, apiUrl, subdomain, variant, styles: propStyles, previewMode, showThinking: showThinkingProp, agentName: agentNameProp, welcomeMessage: welcomeMessageProp, onReady, onIdentify, tools, navigate, onToolResult, getIdentityToken, context, toolRenderers, }: CrowWidgetProps): react_jsx_runtime.JSX.Element;
387
389
 
388
390
  interface CrowCopilotProps {
389
391
  /** Product ID for this copilot */
390
392
  productId: string;
391
393
  /** API URL (defaults to relative path) */
392
394
  apiUrl?: string;
395
+ /** Subdomain for multi-endpoint routing */
396
+ subdomain?: string;
393
397
  /** Copilot variant: embedded (in-app) or floating (with toggle button) */
394
398
  variant?: "embedded" | "floating";
395
399
  /** Title shown in header (fallback if agentName not provided) */
@@ -459,7 +463,7 @@ interface CrowCopilotProps {
459
463
  */
460
464
  context?: Record<string, unknown>;
461
465
  }
462
- declare function CrowCopilot({ productId, apiUrl, variant, title, agentName: agentNameProp, welcomeMessage: welcomeMessageProp, position, width, defaultOpen, showClose, onClose, styles: propStyles, previewMode, className, onReady, navigate, onToolResult, toolRenderers, getIdentityToken, context, }: CrowCopilotProps): react_jsx_runtime.JSX.Element;
466
+ 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, }: CrowCopilotProps): react_jsx_runtime.JSX.Element;
463
467
 
464
468
  interface CrowProviderProps extends CrowClientConfig {
465
469
  children: React.ReactNode;
@@ -467,7 +471,7 @@ interface CrowProviderProps extends CrowClientConfig {
467
471
  /**
468
472
  * Provider component that creates and shares a CrowClient instance
469
473
  */
470
- declare function CrowProvider({ children, productId, apiUrl, model, }: CrowProviderProps): react_jsx_runtime.JSX.Element;
474
+ declare function CrowProvider({ children, productId, apiUrl, model, subdomain, }: CrowProviderProps): react_jsx_runtime.JSX.Element;
471
475
 
472
476
  /**
473
477
  * Default Widget and Copilot Styles
@@ -653,6 +657,8 @@ interface UseChatOptions {
653
657
  welcomeMessage?: string;
654
658
  /** AI model to use for this chat (defaults to DEFAULT_MODEL) */
655
659
  selectedModel?: string;
660
+ /** Subdomain for multi-endpoint products (routes to specific backend config) */
661
+ subdomain?: string;
656
662
  /** Per-tool consent settings — when a tool has requires_consent, show Allow/Deny before executing */
657
663
  toolConsentSettings?: Record<string, {
658
664
  requires_consent: boolean;
@@ -664,7 +670,7 @@ interface UseChatOptions {
664
670
  onToolResult?: (toolName: string, result: Record<string, unknown>) => void;
665
671
  onRestoredConversation?: (conversationId: string) => void;
666
672
  }
667
- declare function useChat({ productId, apiUrl, persistAnonymousConversations, welcomeMessage, selectedModel: initialSelectedModel, toolConsentSettings, onVerificationStatus, onConversationId, onWorkflowEvent, onToolCall, onToolResult, onRestoredConversation, }: UseChatOptions): {
673
+ declare function useChat({ productId, apiUrl, persistAnonymousConversations, welcomeMessage, selectedModel: initialSelectedModel, subdomain, toolConsentSettings, onVerificationStatus, onConversationId, onWorkflowEvent, onToolCall, onToolResult, onRestoredConversation, }: UseChatOptions): {
668
674
  messages: Message[];
669
675
  isLoading: boolean;
670
676
  activeToolCalls: ToolCall[];
package/dist/index.js CHANGED
@@ -44,6 +44,7 @@ function useChat({
44
44
  persistAnonymousConversations,
45
45
  welcomeMessage,
46
46
  selectedModel: initialSelectedModel,
47
+ subdomain,
47
48
  toolConsentSettings,
48
49
  onVerificationStatus,
49
50
  onConversationId,
@@ -126,6 +127,7 @@ function useChat({
126
127
  conversation_id: conversationId,
127
128
  identity_token: identityToken,
128
129
  model: selectedModel,
130
+ subdomain,
129
131
  user_timezone: Intl.DateTimeFormat().resolvedOptions().timeZone,
130
132
  user_local_time: (/* @__PURE__ */ new Date()).toLocaleString("en-US", { year: "numeric", month: "long", day: "numeric", hour: "numeric", minute: "numeric", hour12: true }),
131
133
  page_path: typeof window !== "undefined" ? window.location.pathname : void 0,
@@ -458,7 +460,7 @@ function useChat({
458
460
  abortControllerRef.current = null;
459
461
  }
460
462
  },
461
- [apiUrl, productId, conversationId, selectedModel, persistAnonymousConversations, onVerificationStatus, onConversationId, onWorkflowEvent, onToolCall, onToolResult]
463
+ [apiUrl, productId, conversationId, selectedModel, subdomain, persistAnonymousConversations, onVerificationStatus, onConversationId, onWorkflowEvent, onToolCall, onToolResult]
462
464
  );
463
465
  const sendMessage = useCallback(
464
466
  (content) => {
@@ -549,6 +551,7 @@ function useChat({
549
551
  result,
550
552
  identity_token: identityToken,
551
553
  model: selectedModel,
554
+ subdomain,
552
555
  user_timezone: Intl.DateTimeFormat().resolvedOptions().timeZone,
553
556
  user_local_time: (/* @__PURE__ */ new Date()).toLocaleString("en-US", { year: "numeric", month: "long", day: "numeric", hour: "numeric", minute: "numeric", hour12: true })
554
557
  })
@@ -827,7 +830,7 @@ function useChat({
827
830
  setIsLoading(false);
828
831
  }
829
832
  },
830
- [apiUrl, productId, conversationId, selectedModel]
833
+ [apiUrl, productId, conversationId, selectedModel, subdomain]
831
834
  );
832
835
  const addMessage = useCallback(
833
836
  async (role, content) => {
@@ -3487,6 +3490,7 @@ function injectStyles(target = document) {
3487
3490
  function CrowWidget({
3488
3491
  productId,
3489
3492
  apiUrl = "",
3493
+ subdomain,
3490
3494
  variant = "floating",
3491
3495
  styles: propStyles,
3492
3496
  previewMode = false,
@@ -3560,6 +3564,7 @@ function CrowWidget({
3560
3564
  persistAnonymousConversations,
3561
3565
  welcomeMessage,
3562
3566
  selectedModel,
3567
+ subdomain,
3563
3568
  toolConsentSettings,
3564
3569
  onVerificationStatus: (isVerified) => {
3565
3570
  setIsVerifiedUser(isVerified);
@@ -4303,6 +4308,7 @@ function CopilotContainer({
4303
4308
  function CrowCopilot({
4304
4309
  productId,
4305
4310
  apiUrl = "",
4311
+ subdomain,
4306
4312
  variant = "embedded",
4307
4313
  title = "Copilot",
4308
4314
  agentName: agentNameProp,
@@ -4526,6 +4532,7 @@ function CrowCopilot({
4526
4532
  persistAnonymousConversations,
4527
4533
  welcomeMessage,
4528
4534
  selectedModel,
4535
+ subdomain,
4529
4536
  toolConsentSettings,
4530
4537
  onVerificationStatus: (isVerified) => {
4531
4538
  setIsVerifiedUser(isVerified);
@@ -5413,11 +5420,12 @@ function CrowProvider({
5413
5420
  children,
5414
5421
  productId,
5415
5422
  apiUrl,
5416
- model
5423
+ model,
5424
+ subdomain
5417
5425
  }) {
5418
5426
  const clientRef = useRef(null);
5419
5427
  if (!clientRef.current) {
5420
- clientRef.current = new CrowClient({ productId, apiUrl, model });
5428
+ clientRef.current = new CrowClient({ productId, apiUrl, model, subdomain });
5421
5429
  }
5422
5430
  const client = clientRef.current;
5423
5431
  useEffect(() => {