@autobe/ui 0.20.0 → 0.21.0

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.
Files changed (115) hide show
  1. package/lib/AutoBeChatMain.d.ts +16 -0
  2. package/lib/AutoBeChatMain.js +51 -0
  3. package/lib/AutoBeChatMain.js.map +1 -0
  4. package/lib/banner/AutoBeAgentInformation.d.ts +15 -0
  5. package/lib/banner/AutoBeAgentInformation.js +41 -0
  6. package/lib/banner/AutoBeAgentInformation.js.map +1 -0
  7. package/lib/banner/AutoBeChatBanner.d.ts +15 -0
  8. package/lib/banner/AutoBeChatBanner.js +29 -0
  9. package/lib/banner/AutoBeChatBanner.js.map +1 -0
  10. package/lib/banner/AutoBeChatState.d.ts +6 -0
  11. package/lib/banner/AutoBeChatState.js +80 -0
  12. package/lib/banner/AutoBeChatState.js.map +1 -0
  13. package/lib/banner/AutoBeTokenUsage.d.ts +14 -0
  14. package/lib/banner/AutoBeTokenUsage.js +60 -0
  15. package/lib/banner/AutoBeTokenUsage.js.map +1 -0
  16. package/lib/banner/index.d.ts +4 -0
  17. package/lib/banner/index.js +21 -0
  18. package/lib/banner/index.js.map +1 -0
  19. package/lib/common/Collapsible.d.ts +15 -0
  20. package/lib/common/Collapsible.js +45 -0
  21. package/lib/common/Collapsible.js.map +1 -0
  22. package/lib/common/index.d.ts +2 -0
  23. package/lib/common/index.js +19 -0
  24. package/lib/common/index.js.map +1 -0
  25. package/lib/constant/color.d.ts +18 -0
  26. package/lib/constant/color.js +25 -0
  27. package/lib/constant/color.js.map +1 -0
  28. package/lib/events/AutoBeEventMovie.d.ts +8 -0
  29. package/lib/events/AutoBeEventMovie.js +84 -0
  30. package/lib/events/AutoBeEventMovie.js.map +1 -0
  31. package/lib/events/index.d.ts +2 -1
  32. package/lib/events/index.js +5 -3
  33. package/lib/events/index.js.map +1 -1
  34. package/lib/hooks/index.d.ts +2 -0
  35. package/lib/hooks/index.js +19 -0
  36. package/lib/hooks/index.js.map +1 -0
  37. package/lib/hooks/useIsomorphicLayoutEffect.d.ts +6 -0
  38. package/lib/hooks/useIsomorphicLayoutEffect.js +10 -0
  39. package/lib/hooks/useIsomorphicLayoutEffect.js.map +1 -0
  40. package/lib/hooks/useMediaQuery.d.ts +11 -0
  41. package/lib/hooks/useMediaQuery.js +52 -0
  42. package/lib/hooks/useMediaQuery.js.map +1 -0
  43. package/lib/index.d.ts +5 -3
  44. package/lib/index.js +8 -7
  45. package/lib/index.js.map +1 -1
  46. package/lib/structure/AutoBeListener.d.ts +17 -0
  47. package/lib/structure/AutoBeListener.js +250 -0
  48. package/lib/structure/AutoBeListener.js.map +1 -0
  49. package/lib/structure/AutoBeListenerState.d.ts +14 -0
  50. package/lib/structure/AutoBeListenerState.js +39 -0
  51. package/lib/structure/AutoBeListenerState.js.map +1 -0
  52. package/lib/structure/IAutoBeEventGroup.d.ts +5 -0
  53. package/lib/structure/IAutoBeEventGroup.js +3 -0
  54. package/lib/structure/IAutoBeEventGroup.js.map +1 -0
  55. package/lib/structure/index.d.ts +3 -0
  56. package/lib/structure/index.js +20 -0
  57. package/lib/structure/index.js.map +1 -0
  58. package/lib/upload/AutoBeChatUploadBox.d.ts +31 -0
  59. package/lib/upload/AutoBeChatUploadBox.js +221 -0
  60. package/lib/upload/AutoBeChatUploadBox.js.map +1 -0
  61. package/lib/upload/AutoBeChatUploadSendButton.js.map +1 -0
  62. package/lib/upload/AutoBeFileUploadBox.d.ts +8 -0
  63. package/lib/upload/AutoBeFileUploadBox.js.map +1 -0
  64. package/lib/upload/AutoBeUploadConfig.d.ts +9 -0
  65. package/lib/upload/AutoBeUploadConfig.js +3 -0
  66. package/lib/upload/AutoBeUploadConfig.js.map +1 -0
  67. package/lib/{AutoBeVoiceRecoderButton.js → upload/AutoBeVoiceRecoderButton.js} +2 -2
  68. package/lib/upload/AutoBeVoiceRecoderButton.js.map +1 -0
  69. package/lib/upload/index.d.ts +5 -0
  70. package/lib/upload/index.js +22 -0
  71. package/lib/upload/index.js.map +1 -0
  72. package/lib/utils/index.d.ts +1 -0
  73. package/lib/utils/index.js +1 -0
  74. package/lib/utils/index.js.map +1 -1
  75. package/lib/utils/number.d.ts +1 -0
  76. package/lib/utils/number.js +20 -0
  77. package/lib/utils/number.js.map +1 -0
  78. package/package.json +6 -10
  79. package/src/AutoBeChatMain.tsx +123 -0
  80. package/src/banner/AutoBeAgentInformation.tsx +102 -0
  81. package/src/banner/AutoBeChatBanner.tsx +72 -0
  82. package/src/banner/AutoBeChatState.tsx +152 -0
  83. package/src/banner/AutoBeTokenUsage.tsx +152 -0
  84. package/src/banner/index.ts +4 -0
  85. package/src/common/Collapsible.tsx +95 -0
  86. package/src/common/index.ts +2 -0
  87. package/src/constant/color.ts +24 -0
  88. package/src/events/AutoBeEventMovie.tsx +114 -0
  89. package/src/events/README.md +150 -19
  90. package/src/events/index.ts +2 -4
  91. package/src/hooks/index.ts +2 -0
  92. package/src/hooks/useIsomorphicLayoutEffect.ts +8 -0
  93. package/src/hooks/useMediaQuery.ts +68 -0
  94. package/src/index.ts +5 -6
  95. package/src/structure/AutoBeListener.ts +263 -0
  96. package/src/structure/AutoBeListenerState.ts +53 -0
  97. package/src/structure/IAutoBeEventGroup.ts +6 -0
  98. package/src/structure/index.ts +3 -0
  99. package/src/upload/AutoBeChatUploadBox.tsx +372 -0
  100. package/src/{AutoBeFileUploadBox.tsx → upload/AutoBeFileUploadBox.tsx} +7 -8
  101. package/src/upload/AutoBeUploadConfig.ts +5 -0
  102. package/src/{AutoBeVoiceRecoderButton.tsx → upload/AutoBeVoiceRecoderButton.tsx} +2 -2
  103. package/src/upload/index.ts +5 -0
  104. package/src/utils/index.ts +1 -0
  105. package/src/utils/number.ts +17 -0
  106. package/tsconfig.json +2 -1
  107. package/lib/AutoBeChatUploadSendButton.js.map +0 -1
  108. package/lib/AutoBeFileUploadBox.d.ts +0 -10
  109. package/lib/AutoBeFileUploadBox.js.map +0 -1
  110. package/lib/AutoBeVoiceRecoderButton.js.map +0 -1
  111. /package/lib/{AutoBeChatUploadSendButton.d.ts → upload/AutoBeChatUploadSendButton.d.ts} +0 -0
  112. /package/lib/{AutoBeChatUploadSendButton.js → upload/AutoBeChatUploadSendButton.js} +0 -0
  113. /package/lib/{AutoBeFileUploadBox.js → upload/AutoBeFileUploadBox.js} +0 -0
  114. /package/lib/{AutoBeVoiceRecoderButton.d.ts → upload/AutoBeVoiceRecoderButton.d.ts} +0 -0
  115. /package/src/{AutoBeChatUploadSendButton.tsx → upload/AutoBeChatUploadSendButton.tsx} +0 -0
@@ -0,0 +1,24 @@
1
+ /** Color tokens for consistent styling */
2
+ export const COLORS = {
3
+ // Gray scale
4
+ GRAY_BORDER: "#d1d5db",
5
+ GRAY_BACKGROUND: "#f9fafb",
6
+ GRAY_BORDER_LIGHT: "#e5e7eb",
7
+ GRAY_TEXT_DARK: "#1f2937",
8
+ GRAY_TEXT_MEDIUM: "#4b5563",
9
+
10
+ // Token value colors
11
+ TOKEN_INPUT: "#2563eb", // Blue
12
+ TOKEN_OUTPUT: "#16a34a", // Green
13
+ TOKEN_TOTAL: "#9333ea", // Purple
14
+
15
+ // Table colors
16
+ TABLE_BORDER: "#eee",
17
+ TABLE_BORDER_THICK: "#ddd",
18
+ TABLE_HEADER_BG: "#f5f5f5",
19
+ } as const;
20
+
21
+ /** Shadow styles */
22
+ export const SHADOWS = {
23
+ CARD: "0 1px 2px 0 rgba(0, 0, 0, 0.05)",
24
+ } as const;
@@ -0,0 +1,114 @@
1
+ import { AutoBeEvent, IAutoBeGetFilesOptions } from "@autobe/interface";
2
+
3
+ import {
4
+ AutoBeCompleteEventMovie,
5
+ AutoBeProgressEventMovie,
6
+ AutoBeScenarioEventMovie,
7
+ AutoBeStartEventMovie,
8
+ AutoBeValidateEventMovie,
9
+ IValidateEventGroupProps,
10
+ ValidateEventGroup,
11
+ } from ".";
12
+ import { AutoBeAssistantMessageMovie, AutoBeUserMessageMovie } from "..";
13
+
14
+ export interface IAutoBeEventMovieProps<Event extends AutoBeEvent> {
15
+ getFiles: (
16
+ options?: Partial<IAutoBeGetFilesOptions>,
17
+ ) => Promise<Record<string, string>>;
18
+ events: Event[];
19
+ last: boolean;
20
+ }
21
+
22
+ export function AutoBeEventMovie<Event extends AutoBeEvent>(
23
+ props: IAutoBeEventMovieProps<Event>,
24
+ ) {
25
+ const back: Event = props.events[props.events.length - 1]!;
26
+ switch (back.type) {
27
+ case "userMessage":
28
+ return <AutoBeUserMessageMovie message={back.contents} />;
29
+ case "assistantMessage":
30
+ return (
31
+ <AutoBeAssistantMessageMovie
32
+ text={back.text}
33
+ isoTimestamp={back.created_at}
34
+ />
35
+ );
36
+ // START EVENTS
37
+ case "analyzeStart":
38
+ case "prismaStart":
39
+ case "interfaceStart":
40
+ case "testStart":
41
+ case "realizeStart":
42
+ case "realizeTestStart":
43
+ case "realizeAuthorizationStart":
44
+ return <AutoBeStartEventMovie event={back} />;
45
+ // SCENARIO EVENTS
46
+ case "analyzeScenario":
47
+ case "prismaComponents":
48
+ case "interfaceGroups":
49
+ case "realizeTestReset":
50
+ return <AutoBeScenarioEventMovie event={back} />;
51
+ // PROGRESS EVENTS
52
+ case "analyzeWrite":
53
+ case "analyzeReview":
54
+ case "interfaceEndpoints":
55
+ case "prismaSchemas":
56
+ case "prismaReview":
57
+ case "interfaceOperations":
58
+ case "interfaceOperationsReview":
59
+ case "interfaceAuthorization":
60
+ case "interfaceSchemas":
61
+ case "interfaceSchemasReview":
62
+ case "testWrite":
63
+ case "testScenarios":
64
+ case "realizeWrite":
65
+ case "realizeAuthorizationWrite":
66
+ case "realizeTestOperation":
67
+ return <AutoBeProgressEventMovie event={back} />;
68
+ // VALIDATE EVENTS
69
+ case "prismaInsufficient":
70
+ case "prismaValidate":
71
+ case "interfaceComplement":
72
+ case "testValidate":
73
+ case "realizeValidate":
74
+ case "realizeAuthorizationValidate":
75
+ if (props.events.length === 1) {
76
+ return <AutoBeValidateEventMovie event={back} />;
77
+ }
78
+
79
+ return (
80
+ <ValidateEventGroup
81
+ events={props.events as IValidateEventGroupProps["events"]}
82
+ defaultCollapsed={true}
83
+ />
84
+ );
85
+ // COMPLETE EVENTS
86
+ case "analyzeComplete":
87
+ case "prismaComplete":
88
+ case "interfaceComplete":
89
+ case "testComplete":
90
+ case "realizeComplete":
91
+ return (
92
+ <AutoBeCompleteEventMovie getFiles={props.getFiles} event={back} />
93
+ );
94
+ // DISCARD
95
+ case "prismaCorrect":
96
+ case "interfaceEndpointsReview":
97
+ case "testCorrect":
98
+ case "realizeAuthorizationCorrect":
99
+ case "realizeCorrect":
100
+ case "realizeTestComplete":
101
+ case "realizeAuthorizationComplete":
102
+ case "vendorRequest":
103
+ case "vendorResponse":
104
+ case "jsonParseError":
105
+ case "jsonValidateError":
106
+ case "consentFunctionCall":
107
+ return null;
108
+ default:
109
+ back satisfies never;
110
+ return null;
111
+ }
112
+ }
113
+
114
+ export default AutoBeEventMovie;
@@ -1,11 +1,38 @@
1
1
  # AutoBe Event Components
2
2
 
3
- Event UI components for the AutoBe platform with grouping and collapsible functionality.
3
+ Event UI components for the AutoBe platform with comprehensive event handling, grouping, and collapsible functionality.
4
+
5
+ ## Overview
6
+
7
+ The AutoBe Event system provides a complete solution for displaying various types of events in the AutoBe workflow. The main entry point is `AutoBeEventMovie`, which intelligently routes different event types to their appropriate components.
8
+
9
+ ## Main Event Router
10
+
11
+ ### AutoBeEventMovie
12
+ The central component that handles all event types and routes them to appropriate sub-components.
13
+
14
+ ```tsx
15
+ import { AutoBeEventMovie } from "@autobe/ui/events";
16
+
17
+ <AutoBeEventMovie
18
+ service={rpcService}
19
+ events={eventArray}
20
+ last={isLastEvent}
21
+ />
22
+ ```
23
+
24
+ **Supported Event Types:**
25
+ - **Message Events**: `userMessage`, `assistantMessage`
26
+ - **Start Events**: `analyzeStart`, `prismaStart`, `interfaceStart`, `testStart`, `realizeStart`, `realizeTestStart`, `realizeAuthorizationStart`
27
+ - **Scenario Events**: `analyzeScenario`, `prismaComponents`, `interfaceGroups`, `realizeTestReset`
28
+ - **Progress Events**: `analyzeWrite`, `analyzeReview`, `interfaceEndpoints`, `prismaSchemas`, `prismaReview`, `interfaceOperations`, `interfaceOperationsReview`, `interfaceAuthorization`, `interfaceSchemas`, `interfaceSchemasReview`, `testWrite`, `testScenarios`, `realizeWrite`, `realizeAuthorizationWrite`, `realizeTestOperation`
29
+ - **Validate Events**: `prismaInsufficient`, `prismaValidate`, `interfaceComplement`, `testValidate`, `realizeValidate`, `realizeAuthorizationValidate`
30
+ - **Complete Events**: `analyzeComplete`, `prismaComplete`, `interfaceComplete`, `testComplete`, `realizeComplete`
4
31
 
5
32
  ## Individual Event Components
6
33
 
7
34
  ### AutoBeProgressEventMovie
8
- Shows progress tracking events with progress bars.
35
+ Shows progress tracking events with animated progress bars and status indicators.
9
36
 
10
37
  ```tsx
11
38
  import { AutoBeProgressEventMovie } from "@autobe/ui/events";
@@ -14,7 +41,7 @@ import { AutoBeProgressEventMovie } from "@autobe/ui/events";
14
41
  ```
15
42
 
16
43
  ### AutoBeValidateEventMovie
17
- Shows validation events with error/success states.
44
+ Displays validation events with detailed error/success states and validation results.
18
45
 
19
46
  ```tsx
20
47
  import { AutoBeValidateEventMovie } from "@autobe/ui/events";
@@ -23,7 +50,7 @@ import { AutoBeValidateEventMovie } from "@autobe/ui/events";
23
50
  ```
24
51
 
25
52
  ### AutoBeScenarioEventMovie
26
- Shows scenario analysis and component generation events.
53
+ Shows scenario analysis and component generation events with structured data display.
27
54
 
28
55
  ```tsx
29
56
  import { AutoBeScenarioEventMovie } from "@autobe/ui/events";
@@ -32,7 +59,7 @@ import { AutoBeScenarioEventMovie } from "@autobe/ui/events";
32
59
  ```
33
60
 
34
61
  ### AutoBeStartEventMovie
35
- Shows pipeline start events with simple status display.
62
+ Displays pipeline start events with clean status indicators and timing information.
36
63
 
37
64
  ```tsx
38
65
  import { AutoBeStartEventMovie } from "@autobe/ui/events";
@@ -40,10 +67,22 @@ import { AutoBeStartEventMovie } from "@autobe/ui/events";
40
67
  <AutoBeStartEventMovie event={startEvent} />
41
68
  ```
42
69
 
70
+ ### AutoBeCompleteEventMovie
71
+ Shows completion events with file download capabilities and summary statistics.
72
+
73
+ ```tsx
74
+ import { AutoBeCompleteEventMovie } from "@autobe/ui/events";
75
+
76
+ <AutoBeCompleteEventMovie
77
+ event={completeEvent}
78
+ getFiles={service.getFiles}
79
+ />
80
+ ```
81
+
43
82
  ## Grouped Event Components
44
83
 
45
84
  ### ValidateEventGroup
46
- Groups validation events with success rate statistics.
85
+ Intelligently groups validation events with success rate statistics and collapsible interface.
47
86
 
48
87
  ```tsx
49
88
  import { ValidateEventGroup } from "@autobe/ui/events";
@@ -54,6 +93,36 @@ import { ValidateEventGroup } from "@autobe/ui/events";
54
93
  />
55
94
  ```
56
95
 
96
+ **Features:**
97
+ - Automatic success/failure rate calculation
98
+ - Collapsible interface for better UX
99
+ - Grouped display for multiple validation events
100
+ - Individual event access when expanded
101
+
102
+ ## Message Components
103
+
104
+ ### AutoBeUserMessageMovie
105
+ Displays user messages with support for various content types (text, files, images, audio).
106
+
107
+ ```tsx
108
+ import { AutoBeUserMessageMovie } from "@autobe/ui";
109
+
110
+ <AutoBeUserMessageMovie message={userMessageContents} />
111
+ ```
112
+
113
+ ### AutoBeAssistantMessageMovie
114
+ Shows assistant responses with timestamps and custom assistant names.
115
+
116
+ ```tsx
117
+ import { AutoBeAssistantMessageMovie } from "@autobe/ui";
118
+
119
+ <AutoBeAssistantMessageMovie
120
+ text={responseText}
121
+ isoTimestamp={timestamp}
122
+ assistantName="AutoBe"
123
+ />
124
+ ```
125
+
57
126
  ## Automatic Event Grouping
58
127
 
59
128
  Use the `groupEvents` utility to automatically group events by type:
@@ -98,7 +167,7 @@ import { CollapsibleEventGroup } from "@autobe/ui/events";
98
167
  ## Common Components
99
168
 
100
169
  ### EventCard
101
- Basic card container for consistent styling.
170
+ Basic card container for consistent styling across all event types.
102
171
 
103
172
  ```tsx
104
173
  import { EventCard } from "@autobe/ui/events";
@@ -109,7 +178,7 @@ import { EventCard } from "@autobe/ui/events";
109
178
  ```
110
179
 
111
180
  ### EventHeader
112
- Standardized header with icon, title, and timestamp.
181
+ Standardized header with icon, title, timestamp, and step numbering.
113
182
 
114
183
  ```tsx
115
184
  import { EventHeader } from "@autobe/ui/events";
@@ -123,7 +192,7 @@ import { EventHeader } from "@autobe/ui/events";
123
192
  ```
124
193
 
125
194
  ### EventContent
126
- Consistent content area styling.
195
+ Consistent content area styling with proper spacing and typography.
127
196
 
128
197
  ```tsx
129
198
  import { EventContent } from "@autobe/ui/events";
@@ -134,7 +203,7 @@ import { EventContent } from "@autobe/ui/events";
134
203
  ```
135
204
 
136
205
  ### EventIcon
137
- Consistent icons for different event states.
206
+ Consistent icons for different event states with customizable sizes.
138
207
 
139
208
  ```tsx
140
209
  import { EventIcon } from "@autobe/ui/events";
@@ -142,10 +211,10 @@ import { EventIcon } from "@autobe/ui/events";
142
211
  <EventIcon type="success" size={16} />
143
212
  ```
144
213
 
145
- Available icon types: `success`, `progress`, `warning`, `error`, `info`, `start`
214
+ **Available icon types:** `success`, `progress`, `warning`, `error`, `info`, `start`
146
215
 
147
216
  ### ProgressBar
148
- Reusable progress bar component.
217
+ Reusable progress bar component with customizable styling.
149
218
 
150
219
  ```tsx
151
220
  import { ProgressBar } from "@autobe/ui/events";
@@ -158,12 +227,74 @@ import { ProgressBar } from "@autobe/ui/events";
158
227
  />
159
228
  ```
160
229
 
230
+ ## Event Flow Architecture
231
+
232
+ The AutoBe event system follows a predictable flow:
233
+
234
+ 1. **Start Events** → Initialize pipeline stages
235
+ 2. **Scenario Events** → Analyze and plan components
236
+ 3. **Progress Events** → Track ongoing operations
237
+ 4. **Validate Events** → Verify outputs and handle errors
238
+ 5. **Complete Events** → Finalize and provide results
239
+
240
+ ## Advanced Usage
241
+
242
+ ### Custom Event Handlers
243
+
244
+ ```tsx
245
+ import { AutoBeEventMovie, IAutoBeEventMovieProps } from "@autobe/ui/events";
246
+
247
+ const CustomEventHandler = ({ events, service, last }: IAutoBeEventMovieProps<AutoBeEvent>) => {
248
+ // Pre-process events if needed
249
+ const processedEvents = preprocessEvents(events);
250
+
251
+ return (
252
+ <AutoBeEventMovie
253
+ events={processedEvents}
254
+ service={service}
255
+ last={last}
256
+ />
257
+ );
258
+ };
259
+ ```
260
+
261
+ ### Event Filtering
262
+
263
+ ```tsx
264
+ const filteredEvents = events.filter(event =>
265
+ !['vendorRequest', 'vendorResponse', 'jsonParseError'].includes(event.type)
266
+ );
267
+ ```
268
+
269
+ ## TypeScript Support
270
+
271
+ All components are fully typed with comprehensive interfaces:
272
+
273
+ ```tsx
274
+ interface IAutoBeEventMovieProps<Event extends AutoBeEvent> {
275
+ service: IAutoBeRpcService;
276
+ events: Event[];
277
+ last: boolean;
278
+ }
279
+ ```
280
+
161
281
  ## Features
162
282
 
163
- - 🎯 **Consistent Design**: All components follow the same design system
164
- - 📱 **Responsive**: Works on all screen sizes
165
- - 🔄 **Collapsible**: Group events to reduce visual clutter
166
- - 📊 **Statistics**: Automatic progress and error rate calculations
167
- - 🎨 **Customizable**: Easy to extend and customize
168
- - 💎 **TypeScript**: Full type safety and IntelliSense support
169
- - ⚡ **Performance**: Efficient rendering with minimal re-renders
283
+ - 🎯 **Intelligent Routing**: Automatic event type detection and routing
284
+ - 📱 **Responsive Design**: Works seamlessly on all screen sizes
285
+ - 🔄 **Smart Grouping**: Automatic grouping of related events
286
+ - 📊 **Rich Statistics**: Built-in progress and error rate calculations
287
+ - 🎨 **Consistent Styling**: Unified design system across all components
288
+ - 💎 **Full TypeScript**: Complete type safety and IntelliSense support
289
+ - ⚡ **Optimized Performance**: Efficient rendering with minimal re-renders
290
+ - 🔧 **Highly Customizable**: Easy to extend and customize for specific needs
291
+ - 🎪 **Animation Support**: Smooth transitions and progress animations
292
+ - 📁 **File Management**: Built-in file download and management capabilities
293
+
294
+ ## Best Practices
295
+
296
+ 1. **Always use AutoBeEventMovie** as the main entry point for event rendering
297
+ 2. **Group related validation events** for better user experience
298
+ 3. **Provide meaningful timestamps** for all events
299
+ 4. **Use consistent naming** for custom event types
300
+ 5. **Handle edge cases** gracefully with null returns for unsupported events
@@ -1,11 +1,9 @@
1
1
  export { default as AutoBeStartEventMovie } from "./AutoBeStartEventMovie";
2
2
  export { default as AutoBeScenarioEventMovie } from "./AutoBeScenarioEventMovie";
3
3
  export { default as AutoBeProgressEventMovie } from "./AutoBeProgressEventMovie";
4
+ export { default as AutoBeCompleteEventMovie } from "./AutoBeCompleteEventMovie";
4
5
  export { default as AutoBeValidateEventMovie } from "./AutoBeValidateEventMovie";
5
- export {
6
- default as AutoBeCompleteEventMovie,
7
- type IAutoBeCompleteEventMovieProps,
8
- } from "./AutoBeCompleteEventMovie";
6
+ export { default as AutoBeEventMovie } from "./AutoBeEventMovie";
9
7
 
10
8
  // Common components
11
9
  export * from "./common";
@@ -0,0 +1,2 @@
1
+ export * from "./useIsomorphicLayoutEffect";
2
+ export * from "./useMediaQuery";
@@ -0,0 +1,8 @@
1
+ /**
2
+ * From usehooks-ts
3
+ * https://usehooks-ts.com/react-hook/use-isomorphic-layout-effect
4
+ */
5
+ import { useEffect, useLayoutEffect } from "react";
6
+
7
+ export const useIsomorphicLayoutEffect =
8
+ typeof window !== "undefined" ? useLayoutEffect : useEffect;
@@ -0,0 +1,68 @@
1
+ /** From usehooks-ts https://usehooks-ts.com/react-hook/use-media-query */
2
+ import { useState } from "react";
3
+
4
+ import { useIsomorphicLayoutEffect } from "./useIsomorphicLayoutEffect";
5
+
6
+ type UseMediaQueryOptions = {
7
+ defaultValue?: boolean;
8
+ initializeWithValue?: boolean;
9
+ };
10
+
11
+ const IS_SERVER = typeof window === "undefined";
12
+
13
+ export function useMediaQuery(
14
+ query: string,
15
+ {
16
+ defaultValue = false,
17
+ initializeWithValue = true,
18
+ }: UseMediaQueryOptions = {},
19
+ ): boolean {
20
+ const getMatches = (query: string): boolean => {
21
+ if (IS_SERVER) {
22
+ return defaultValue;
23
+ }
24
+ return window.matchMedia(query).matches;
25
+ };
26
+
27
+ const [matches, setMatches] = useState<boolean>(() => {
28
+ if (initializeWithValue) {
29
+ return getMatches(query);
30
+ }
31
+ return defaultValue;
32
+ });
33
+
34
+ // Handles the change event of the media query.
35
+ function handleChange() {
36
+ setMatches(getMatches(query));
37
+ }
38
+
39
+ useIsomorphicLayoutEffect(() => {
40
+ const matchMedia = window.matchMedia(query);
41
+
42
+ // Triggered at the first client-side load and if query changes
43
+ handleChange();
44
+
45
+ // Use deprecated `addListener` and `removeListener` to support Safari < 14 (#135)
46
+ if (matchMedia.addListener) {
47
+ matchMedia.addListener(handleChange);
48
+ } else {
49
+ matchMedia.addEventListener("change", handleChange);
50
+ }
51
+
52
+ return () => {
53
+ if (matchMedia.removeListener) {
54
+ matchMedia.removeListener(handleChange);
55
+ } else {
56
+ matchMedia.removeEventListener("change", handleChange);
57
+ }
58
+ };
59
+ }, [query]);
60
+
61
+ return matches;
62
+ }
63
+
64
+ export namespace useMediaQuery {
65
+ export const MIN_WIDTH_LG = "(min-width: 1200px)";
66
+ export const MIN_WIDTH_MD = "(min-width: 900px)";
67
+ export const MIN_WIDTH_SM = "(min-width: 600px)";
68
+ }
package/src/index.ts CHANGED
@@ -1,14 +1,13 @@
1
1
  export * from "./events";
2
2
  export { default as AutoBeAssistantMessageMovie } from "./AutoBeAssistantMessageMovie";
3
3
  export { default as AutoBeUserMessageMovie } from "./AutoBeUserMessageMovie";
4
- export {
5
- default as AutoBeFileUploadBox,
6
- type AutoBeFileUploadBox as IAutoBeFileUploadBox,
7
- } from "./AutoBeFileUploadBox";
8
4
  export { default as ChatBubble } from "./common/ChatBubble";
9
- export { AutoBeChatUploadSendButton } from "./AutoBeChatUploadSendButton";
5
+ export { default as AutoBeChatMain } from "./AutoBeChatMain";
10
6
  export type {
11
7
  IChatBubbleProps,
12
8
  IContentRendererProps,
13
9
  } from "./common/ChatBubble";
14
- export { AutoBeVoiceRecoderButton } from "./AutoBeVoiceRecoderButton";
10
+ export { AutoBeFileUploader } from "./utils";
11
+ export * from "./upload";
12
+ export * from "./banner";
13
+ export * from "./structure";