andy-widget-react 2.3.1 → 3.0.0-next.1

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.
@@ -1,235 +0,0 @@
1
- /**
2
- * Type definitions for andy-widget-react
3
- */
4
-
5
- // Welcome popup configuration
6
- export interface WelcomePopupConfig {
7
- enabled: boolean
8
- seconds: number
9
- message?: string
10
- }
11
-
12
- // User info collection configuration
13
- export interface CollectUserInfoConfig {
14
- enabled: boolean
15
- message?: string
16
- }
17
-
18
- // Predefined question
19
- export interface PredefinedQuestion {
20
- order: number
21
- question: string
22
- }
23
-
24
- // FAQ item
25
- export interface FAQItem {
26
- question: string
27
- answer: string
28
- }
29
-
30
- // Core chatbot configuration (matches API response)
31
- export interface ChatbotConfig {
32
- id: string | null
33
- name: string
34
- theme: 'light' | 'dark' | 'auto'
35
- logoUrl: string
36
- headline: string
37
- brandColor: string
38
- description: string
39
- orientation: 'left' | 'right'
40
- bubbleStyle: 'icon' | 'pill'
41
- bubbleLabel: string | null
42
- useBrandColor: boolean
43
- defaultLang: 'en' | 'es'
44
- showBranding: boolean
45
- welcomeMessage: string
46
- showWelcomePopup: WelcomePopupConfig
47
- collectUserInfo: CollectUserInfoConfig
48
- predefinedQuestions: PredefinedQuestion[]
49
- faqs: FAQItem[]
50
- bootstrap?: {
51
- convexUrl: string
52
- surfaceKey: string
53
- surfaceProof: string
54
- surfaceProofExpiresAt: number
55
- }
56
- }
57
-
58
- // Message in the chat
59
- export interface Message {
60
- id: string | number
61
- content: string
62
- sender: 'user' | 'bot'
63
- timestamp: string
64
- isForm?: boolean
65
- isLoading?: boolean
66
- isError?: boolean
67
- isHuman?: boolean
68
- isWaiting?: boolean
69
- isStreaming?: boolean
70
- }
71
-
72
- // User info for form submission
73
- export interface UserInfo {
74
- name: string
75
- email: string
76
- }
77
-
78
- // Main AndyChat component props
79
- export interface SalesAndyChatProps {
80
- mode?: 'sales'
81
- /** Required chatbot embed ID (not required if previewMode is true) */
82
- embedId?: string
83
- /** Optional tooltip text for the chat bubble */
84
- tooltip?: string
85
- /** Optional bot name (overrides API value) */
86
- name?: string
87
- /** Optional headline/subtitle (overrides API value) */
88
- headline?: string
89
- /** Optional description (overrides API value) */
90
- description?: string
91
- /** Optional welcome message (overrides API value) */
92
- welcomeMessage?: string
93
- /** Optional custom label for pill-style bubble (overrides default) */
94
- bubbleLabel?: string
95
- /** Optional UI language for the widget's own chrome, overrides the Agent's defaultLang */
96
- lang?: 'en' | 'es'
97
- /** Optional starter questions (overrides API value) */
98
- predefinedQuestions?: PredefinedQuestion[]
99
- /** Optional theme ('light' | 'dark' | 'auto') */
100
- theme?: 'light' | 'dark' | 'auto'
101
- /** Optional position ('left' | 'right') */
102
- orientation?: 'left' | 'right'
103
- /** Optional brand color hex (e.g., '#3B82F6') */
104
- brandColor?: string
105
- /** Optional bubble style ('icon' | 'pill') */
106
- bubbleStyle?: 'icon' | 'pill'
107
- /** Optional whether to use brand color */
108
- useBrandColor?: boolean
109
- /** Optional logo URL */
110
- logoUrl?: string
111
- /** If true, skip API fetch and use props directly as config */
112
- previewMode?: boolean
113
- /** If true, start with chat window open */
114
- initialOpen?: boolean
115
- }
116
-
117
- export interface SupportAndyChatProps {
118
- mode: 'support'
119
- support: import('andy-widget-core').SupportOptions
120
- lang?: 'es' | 'en'
121
- orientation?: 'left' | 'right'
122
- initialOpen?: boolean
123
- tooltip?: string
124
- }
125
- export type AndyChatProps = SalesAndyChatProps | SupportAndyChatProps
126
-
127
- // FAQ Item component props
128
- export interface FaqItemProps {
129
- question: string
130
- answer: string
131
- }
132
-
133
- // Chat Bubble component props
134
- export interface ChatBubbleProps {
135
- isOpen: boolean
136
- onClick: () => void
137
- tooltip?: string
138
- logoUrl?: string
139
- bubbleStyle?: 'icon' | 'pill'
140
- bubbleLabel?: string
141
- theme?: 'light' | 'dark' | 'auto'
142
- useBrandColor?: boolean
143
- }
144
-
145
- // Chat Window component props
146
- export interface ChatWindowProps {
147
- isOpen: boolean
148
- config: ChatbotConfig | null
149
- messages: Message[]
150
- isLoading: boolean
151
- showPredefinedQuestions: boolean
152
- isCollectingUserInfo: boolean
153
- onClose: () => void
154
- onSendMessage: (message: string) => void
155
- onPredefinedQuestion: (question: string) => void
156
- onUserInfoSubmit: (e: React.FormEvent<HTMLFormElement>) => void
157
- }
158
-
159
- // Message List component props
160
- export interface MessageListProps {
161
- messages: Message[]
162
- config: ChatbotConfig | null
163
- isLoading: boolean
164
- isCollectingUserInfo: boolean
165
- onUserInfoSubmit: (e: React.FormEvent<HTMLFormElement>) => void
166
- }
167
-
168
- // Message Input component props
169
- export interface MessageInputProps {
170
- onSendMessage: (message: string) => void
171
- disabled?: boolean
172
- placeholder?: string
173
- }
174
-
175
- // FAQ component props
176
- export interface FAQProps {
177
- faqs: FAQItem[]
178
- onBack: () => void
179
- }
180
-
181
- // Welcome Popup component props
182
- export interface WelcomePopupProps {
183
- message: string
184
- orientation?: 'left' | 'right'
185
- onClose: () => void
186
- }
187
-
188
- // User Info Form component props
189
- export interface UserInfoFormProps {
190
- message?: string
191
- onSubmit: (e: React.FormEvent<HTMLFormElement>) => void
192
- }
193
-
194
- // useAndyChat hook return type
195
- export interface UseAndyChatReturn {
196
- // State
197
- config: Partial<ChatbotConfig>
198
- isLoading: boolean
199
- isOpen: boolean
200
- showingFaq: boolean
201
- showingWelcomePopup: boolean
202
- showingUserInfoForm: boolean
203
- messages: Message[]
204
- userInfoCollected: boolean
205
- sessionId: string
206
- error: string | null
207
-
208
- // Actions
209
- initializeChatbot: () => Promise<void>
210
- toggleChat: () => void
211
- sendMessage: (messageText: string) => Promise<unknown>
212
- showFaq: () => void
213
- hideFaq: () => void
214
- showWelcomePopup: () => void
215
- hideWelcomePopup: () => void
216
- showUserInfoForm: () => void
217
- hideUserInfoForm: () => void
218
- submitUserInfo: (userInfo: UserInfo) => Promise<void>
219
- startNewSession: () => void
220
- addMessage: (message: Message) => void
221
- }
222
-
223
- // Stylesheet options for getFullStylesheet
224
- export interface StylesheetOptions {
225
- color?: string
226
- useBrandColor?: boolean
227
- theme?: 'light' | 'dark' | 'auto'
228
- orientation?: 'left' | 'right'
229
- }
230
-
231
- // Host class options for getHostClasses
232
- export interface HostClassOptions {
233
- theme?: 'light' | 'dark' | 'auto'
234
- orientation?: 'left' | 'right'
235
- }