@@ -68,100 +68,50 @@ export function SupportWidget() {
6868
6969Fired when a new conversation is created.
7070
71- <TypeTable
71+ <auto-type-table
72+ path = " packages/react/src/support/context/events.tsx"
73+ name = " ConversationStartEvent"
7274 variant = " parameter"
73- type = { {
74- conversationId: {
75- description: " Unique identifier of the new conversation" ,
76- type: " string" ,
77- required: true ,
78- },
79- conversation: {
80- description: " Full conversation object (if available)" ,
81- type: " Conversation" ,
82- required: false ,
83- },
84- }}
8575/>
8676
8777### onConversationEnd
8878
8979Fired when a conversation is closed or resolved.
9080
91- <TypeTable
81+ <auto-type-table
82+ path = " packages/react/src/support/context/events.tsx"
83+ name = " ConversationEndEvent"
9284 variant = " parameter"
93- type = { {
94- conversationId: {
95- description: " Unique identifier of the ended conversation" ,
96- type: " string" ,
97- required: true ,
98- },
99- conversation: {
100- description: " Full conversation object (if available)" ,
101- type: " Conversation" ,
102- required: false ,
103- },
104- }}
10585/>
10686
10787### onMessageSent
10888
10989Fired when the visitor sends a message.
11090
111- <TypeTable
91+ <auto-type-table
92+ path = " packages/react/src/support/context/events.tsx"
93+ name = " MessageSentEvent"
11294 variant = " parameter"
113- type = { {
114- conversationId: {
115- description: " Conversation the message was sent to" ,
116- type: " string" ,
117- required: true ,
118- },
119- message: {
120- description: " The sent message object" ,
121- type: " TimelineItem" ,
122- required: true ,
123- },
124- }}
12595/>
12696
12797### onMessageReceived
12898
12999Fired when a message is received from an agent (human or AI).
130100
131- <TypeTable
101+ <auto-type-table
102+ path = " packages/react/src/support/context/events.tsx"
103+ name = " MessageReceivedEvent"
132104 variant = " parameter"
133- type = { {
134- conversationId: {
135- description: " Conversation the message was received in" ,
136- type: " string" ,
137- required: true ,
138- },
139- message: {
140- description: " The received message object" ,
141- type: " TimelineItem" ,
142- required: true ,
143- },
144- }}
145105/>
146106
147107### onError
148108
149109Fired when an error occurs within the widget.
150110
151- <TypeTable
111+ <auto-type-table
112+ path = " packages/react/src/support/context/events.tsx"
113+ name = " ErrorEvent"
152114 variant = " parameter"
153- type = { {
154- error: {
155- description: " The error object" ,
156- type: " Error" ,
157- required: true ,
158- },
159- context: {
160- description: " Additional context about where the error occurred" ,
161- type: " string" ,
162- required: false ,
163- },
164- }}
165115/>
166116
167117## Programmatic Event Handling
@@ -326,7 +276,9 @@ export function SupportWithSegment() {
326276 analytics .track (" Support Message Sent" , {
327277 conversationId ,
328278 messageId: message .id ,
329- hasAttachments: message .attachments ?.length > 0 ,
279+ hasAttachments: message .parts .some (
280+ (part ) => part .type === " image" || part .type === " file"
281+ ),
330282 });
331283 }}
332284 />
@@ -379,23 +331,9 @@ import type {
379331} from " @cossistant/next/support" ;
380332```
381333
382- <TypeTable
334+ <auto-type-table
335+ path = " packages/react/src/support/context/events.tsx"
336+ name = " EventTypeExports"
337+ type = " { SupportEvent: SupportEvent; SupportEventType: SupportEventType; SupportEventCallbacks: SupportEventCallbacks }"
383338 variant = " property"
384- type = { {
385- SupportEvent: {
386- description: " Union type of all possible events" ,
387- type: " ConversationStartEvent | ConversationEndEvent | MessageSentEvent | MessageReceivedEvent | ErrorEvent" ,
388- required: true ,
389- },
390- SupportEventType: {
391- description: " String literal type of event names" ,
392- type: ' "conversationStart" | "conversationEnd" | "messageSent" | "messageReceived" | "error"' ,
393- required: true ,
394- },
395- SupportEventCallbacks: {
396- description: " Object type for all callback props" ,
397- type: " { onConversationStart?, onConversationEnd?, onMessageSent?, onMessageReceived?, onError? }" ,
398- required: true ,
399- },
400- }}
401339/>
0 commit comments