@21st-sdk/react 0.1.3 → 0.1.4

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/src/types.ts CHANGED
@@ -1,15 +1,15 @@
1
1
  import type React from "react"
2
2
  import type { UIMessage, ChatStatus } from "ai"
3
3
 
4
- /** Theme JSON generated by the AN playground */
5
- export interface AnTheme {
4
+ /** Theme JSON generated by the playground */
5
+ export interface ChatTheme {
6
6
  theme: Record<string, string>
7
7
  light: Record<string, string>
8
8
  dark: Record<string, string>
9
9
  }
10
10
 
11
11
  /** Per-element CSS class overrides */
12
- export interface AnClassNames {
12
+ export interface ChatClassNames {
13
13
  root: string
14
14
  messageList: string
15
15
  userMessage: string
@@ -28,7 +28,7 @@ export interface AnClassNames {
28
28
  }
29
29
 
30
30
  /** Component slot overrides */
31
- export interface AnSlots {
31
+ export interface ChatSlots {
32
32
  InputBar: React.ComponentType<any>
33
33
  UserMessage: React.ComponentType<any>
34
34
  AssistantMessage: React.ComponentType<any>
@@ -36,8 +36,8 @@ export interface AnSlots {
36
36
  MessageActions: React.ComponentType<any>
37
37
  }
38
38
 
39
- /** Props for createAnChat() */
40
- export interface CreateAnChatOptions {
39
+ /** Props for createAgentChat() */
40
+ export interface CreateAgentChatOptions {
41
41
  agent: string
42
42
  /** Provide either tokenUrl (simple) or getToken (full control) */
43
43
  tokenUrl?: string
@@ -54,10 +54,10 @@ export interface CreateAnChatOptions {
54
54
  *
55
55
  * @example
56
56
  * // Per-user sandbox
57
- * createAnChat({ agent: "my-agent", tokenUrl: "/api/an/token", sandboxId: `user-${userId}` })
57
+ * createAgentChat({ agent: "my-agent", tokenUrl: "/api/an/token", sandboxId: `user-${userId}` })
58
58
  *
59
59
  * // Continue existing sandbox
60
- * createAnChat({ agent: "my-agent", tokenUrl: "/api/an/token", sandboxId: sandbox.id })
60
+ * createAgentChat({ agent: "my-agent", tokenUrl: "/api/an/token", sandboxId: sandbox.id })
61
61
  */
62
62
  sandboxId?: string
63
63
  /**
@@ -78,25 +78,25 @@ export interface CustomToolRendererProps {
78
78
  }
79
79
 
80
80
  /** A model option for the model selector */
81
- export interface AnModelOption {
81
+ export interface ModelOption {
82
82
  id: string
83
83
  name: string
84
84
  version?: string
85
85
  }
86
86
 
87
- /** Props for the <AnAgentChat> drop-in component */
88
- export interface AnAgentChatProps {
87
+ /** Props for the <AgentChat> drop-in component */
88
+ export interface AgentChatProps {
89
89
  messages: UIMessage[]
90
90
  onSend: (message: { role: "user"; content: string }) => void
91
91
  status: ChatStatus
92
92
  onStop: () => void
93
93
  error?: Error
94
94
 
95
- theme?: AnTheme
95
+ theme?: ChatTheme
96
96
  colorMode?: "light" | "dark" | "auto"
97
97
 
98
- classNames?: Partial<AnClassNames>
99
- slots?: Partial<AnSlots>
98
+ classNames?: Partial<ChatClassNames>
99
+ slots?: Partial<ChatSlots>
100
100
  toolRenderers?: Record<string, React.ComponentType<CustomToolRendererProps>>
101
101
 
102
102
  /** Show window chrome header (traffic lights + agent indicator) */
@@ -104,7 +104,7 @@ export interface AnAgentChatProps {
104
104
 
105
105
  /** Model selector configuration */
106
106
  modelSelector?: {
107
- models: AnModelOption[]
107
+ models: ModelOption[]
108
108
  activeModelId?: string
109
109
  onModelChange?: (id: string) => void
110
110
  display?: "popover" | "badge"
@@ -133,3 +133,11 @@ export interface AnAgentChatProps {
133
133
  className?: string
134
134
  style?: React.CSSProperties
135
135
  }
136
+
137
+ // Legacy type aliases kept for compatibility.
138
+ export type AnTheme = ChatTheme
139
+ export type AnClassNames = ChatClassNames
140
+ export type AnSlots = ChatSlots
141
+ export type CreateAnChatOptions = CreateAgentChatOptions
142
+ export type AnModelOption = ModelOption
143
+ export type AnAgentChatProps = AgentChatProps