@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.
- package/lib/AutoBeChatMain.d.ts +16 -0
- package/lib/AutoBeChatMain.js +51 -0
- package/lib/AutoBeChatMain.js.map +1 -0
- package/lib/banner/AutoBeAgentInformation.d.ts +15 -0
- package/lib/banner/AutoBeAgentInformation.js +41 -0
- package/lib/banner/AutoBeAgentInformation.js.map +1 -0
- package/lib/banner/AutoBeChatBanner.d.ts +15 -0
- package/lib/banner/AutoBeChatBanner.js +29 -0
- package/lib/banner/AutoBeChatBanner.js.map +1 -0
- package/lib/banner/AutoBeChatState.d.ts +6 -0
- package/lib/banner/AutoBeChatState.js +80 -0
- package/lib/banner/AutoBeChatState.js.map +1 -0
- package/lib/banner/AutoBeTokenUsage.d.ts +14 -0
- package/lib/banner/AutoBeTokenUsage.js +60 -0
- package/lib/banner/AutoBeTokenUsage.js.map +1 -0
- package/lib/banner/index.d.ts +4 -0
- package/lib/banner/index.js +21 -0
- package/lib/banner/index.js.map +1 -0
- package/lib/common/Collapsible.d.ts +15 -0
- package/lib/common/Collapsible.js +45 -0
- package/lib/common/Collapsible.js.map +1 -0
- package/lib/common/index.d.ts +2 -0
- package/lib/common/index.js +19 -0
- package/lib/common/index.js.map +1 -0
- package/lib/constant/color.d.ts +18 -0
- package/lib/constant/color.js +25 -0
- package/lib/constant/color.js.map +1 -0
- package/lib/events/AutoBeEventMovie.d.ts +8 -0
- package/lib/events/AutoBeEventMovie.js +84 -0
- package/lib/events/AutoBeEventMovie.js.map +1 -0
- package/lib/events/index.d.ts +2 -1
- package/lib/events/index.js +5 -3
- package/lib/events/index.js.map +1 -1
- package/lib/hooks/index.d.ts +2 -0
- package/lib/hooks/index.js +19 -0
- package/lib/hooks/index.js.map +1 -0
- package/lib/hooks/useIsomorphicLayoutEffect.d.ts +6 -0
- package/lib/hooks/useIsomorphicLayoutEffect.js +10 -0
- package/lib/hooks/useIsomorphicLayoutEffect.js.map +1 -0
- package/lib/hooks/useMediaQuery.d.ts +11 -0
- package/lib/hooks/useMediaQuery.js +52 -0
- package/lib/hooks/useMediaQuery.js.map +1 -0
- package/lib/index.d.ts +5 -3
- package/lib/index.js +8 -7
- package/lib/index.js.map +1 -1
- package/lib/structure/AutoBeListener.d.ts +17 -0
- package/lib/structure/AutoBeListener.js +250 -0
- package/lib/structure/AutoBeListener.js.map +1 -0
- package/lib/structure/AutoBeListenerState.d.ts +14 -0
- package/lib/structure/AutoBeListenerState.js +39 -0
- package/lib/structure/AutoBeListenerState.js.map +1 -0
- package/lib/structure/IAutoBeEventGroup.d.ts +5 -0
- package/lib/structure/IAutoBeEventGroup.js +3 -0
- package/lib/structure/IAutoBeEventGroup.js.map +1 -0
- package/lib/structure/index.d.ts +3 -0
- package/lib/structure/index.js +20 -0
- package/lib/structure/index.js.map +1 -0
- package/lib/upload/AutoBeChatUploadBox.d.ts +31 -0
- package/lib/upload/AutoBeChatUploadBox.js +221 -0
- package/lib/upload/AutoBeChatUploadBox.js.map +1 -0
- package/lib/upload/AutoBeChatUploadSendButton.js.map +1 -0
- package/lib/upload/AutoBeFileUploadBox.d.ts +8 -0
- package/lib/upload/AutoBeFileUploadBox.js.map +1 -0
- package/lib/upload/AutoBeUploadConfig.d.ts +9 -0
- package/lib/upload/AutoBeUploadConfig.js +3 -0
- package/lib/upload/AutoBeUploadConfig.js.map +1 -0
- package/lib/{AutoBeVoiceRecoderButton.js → upload/AutoBeVoiceRecoderButton.js} +2 -2
- package/lib/upload/AutoBeVoiceRecoderButton.js.map +1 -0
- package/lib/upload/index.d.ts +5 -0
- package/lib/upload/index.js +22 -0
- package/lib/upload/index.js.map +1 -0
- package/lib/utils/index.d.ts +1 -0
- package/lib/utils/index.js +1 -0
- package/lib/utils/index.js.map +1 -1
- package/lib/utils/number.d.ts +1 -0
- package/lib/utils/number.js +20 -0
- package/lib/utils/number.js.map +1 -0
- package/package.json +6 -10
- package/src/AutoBeChatMain.tsx +123 -0
- package/src/banner/AutoBeAgentInformation.tsx +102 -0
- package/src/banner/AutoBeChatBanner.tsx +72 -0
- package/src/banner/AutoBeChatState.tsx +152 -0
- package/src/banner/AutoBeTokenUsage.tsx +152 -0
- package/src/banner/index.ts +4 -0
- package/src/common/Collapsible.tsx +95 -0
- package/src/common/index.ts +2 -0
- package/src/constant/color.ts +24 -0
- package/src/events/AutoBeEventMovie.tsx +114 -0
- package/src/events/README.md +150 -19
- package/src/events/index.ts +2 -4
- package/src/hooks/index.ts +2 -0
- package/src/hooks/useIsomorphicLayoutEffect.ts +8 -0
- package/src/hooks/useMediaQuery.ts +68 -0
- package/src/index.ts +5 -6
- package/src/structure/AutoBeListener.ts +263 -0
- package/src/structure/AutoBeListenerState.ts +53 -0
- package/src/structure/IAutoBeEventGroup.ts +6 -0
- package/src/structure/index.ts +3 -0
- package/src/upload/AutoBeChatUploadBox.tsx +372 -0
- package/src/{AutoBeFileUploadBox.tsx → upload/AutoBeFileUploadBox.tsx} +7 -8
- package/src/upload/AutoBeUploadConfig.ts +5 -0
- package/src/{AutoBeVoiceRecoderButton.tsx → upload/AutoBeVoiceRecoderButton.tsx} +2 -2
- package/src/upload/index.ts +5 -0
- package/src/utils/index.ts +1 -0
- package/src/utils/number.ts +17 -0
- package/tsconfig.json +2 -1
- package/lib/AutoBeChatUploadSendButton.js.map +0 -1
- package/lib/AutoBeFileUploadBox.d.ts +0 -10
- package/lib/AutoBeFileUploadBox.js.map +0 -1
- package/lib/AutoBeVoiceRecoderButton.js.map +0 -1
- /package/lib/{AutoBeChatUploadSendButton.d.ts → upload/AutoBeChatUploadSendButton.d.ts} +0 -0
- /package/lib/{AutoBeChatUploadSendButton.js → upload/AutoBeChatUploadSendButton.js} +0 -0
- /package/lib/{AutoBeFileUploadBox.js → upload/AutoBeFileUploadBox.js} +0 -0
- /package/lib/{AutoBeVoiceRecoderButton.d.ts → upload/AutoBeVoiceRecoderButton.d.ts} +0 -0
- /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;
|
package/src/events/README.md
CHANGED
|
@@ -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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
|
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
|
|
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
|
-
- 🎯 **
|
|
164
|
-
- 📱 **Responsive**: Works on all screen sizes
|
|
165
|
-
- 🔄 **
|
|
166
|
-
- 📊 **Statistics**:
|
|
167
|
-
- 🎨 **
|
|
168
|
-
- 💎 **TypeScript**:
|
|
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
|
package/src/events/index.ts
CHANGED
|
@@ -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,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 {
|
|
5
|
+
export { default as AutoBeChatMain } from "./AutoBeChatMain";
|
|
10
6
|
export type {
|
|
11
7
|
IChatBubbleProps,
|
|
12
8
|
IContentRendererProps,
|
|
13
9
|
} from "./common/ChatBubble";
|
|
14
|
-
export {
|
|
10
|
+
export { AutoBeFileUploader } from "./utils";
|
|
11
|
+
export * from "./upload";
|
|
12
|
+
export * from "./banner";
|
|
13
|
+
export * from "./structure";
|