@autobe/ui 0.30.2 → 0.30.4-dev.20260324

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 (69) hide show
  1. package/LICENSE +661 -661
  2. package/README.md +261 -0
  3. package/lib/components/AutoBeChatMain.d.ts +6 -0
  4. package/lib/components/AutoBeChatMain.js +46 -37
  5. package/lib/components/AutoBeChatMain.js.map +1 -1
  6. package/lib/components/AutoBeConfigModal.js +9 -9
  7. package/lib/components/events/AutoBeEventMovie.js +0 -4
  8. package/lib/components/events/AutoBeEventMovie.js.map +1 -1
  9. package/lib/components/events/AutoBeProgressEventMovie.js +0 -10
  10. package/lib/components/events/AutoBeProgressEventMovie.js.map +1 -1
  11. package/lib/components/upload/AutoBeChatUploadBox.d.ts +1 -0
  12. package/lib/components/upload/AutoBeChatUploadBox.js +11 -16
  13. package/lib/components/upload/AutoBeChatUploadBox.js.map +1 -1
  14. package/lib/context/AutoBeAgentContext.js +78 -30
  15. package/lib/context/AutoBeAgentContext.js.map +1 -1
  16. package/lib/context/SearchParamsContext.js +1 -1
  17. package/lib/context/SearchParamsContext.js.map +1 -1
  18. package/lib/structure/AutoBeListener.d.ts +1 -0
  19. package/lib/structure/AutoBeListener.js +9 -11
  20. package/lib/structure/AutoBeListener.js.map +1 -1
  21. package/package.json +2 -2
  22. package/src/components/AutoBeAssistantMessageMovie.tsx +22 -22
  23. package/src/components/AutoBeChatMain.tsx +394 -376
  24. package/src/components/AutoBeChatSidebar.tsx +414 -414
  25. package/src/components/AutoBeConfigButton.tsx +83 -83
  26. package/src/components/AutoBeConfigModal.tsx +443 -443
  27. package/src/components/AutoBeStatusButton.tsx +75 -75
  28. package/src/components/AutoBeStatusModal.tsx +486 -486
  29. package/src/components/AutoBeUserMessageMovie.tsx +27 -27
  30. package/src/components/common/ActionButton.tsx +205 -205
  31. package/src/components/common/ActionButtonGroup.tsx +80 -80
  32. package/src/components/common/AutoBeConfigInput.tsx +185 -185
  33. package/src/components/common/ChatBubble.tsx +119 -119
  34. package/src/components/common/Collapsible.tsx +95 -95
  35. package/src/components/common/CompactSessionIndicator.tsx +73 -73
  36. package/src/components/common/CompactSessionList.tsx +82 -82
  37. package/src/components/common/openai/OpenAIContent.tsx +53 -53
  38. package/src/components/common/openai/OpenAIUserAudioContent.tsx +70 -70
  39. package/src/components/common/openai/OpenAIUserFileContent.tsx +76 -76
  40. package/src/components/common/openai/OpenAIUserImageContent.tsx +34 -34
  41. package/src/components/common/openai/OpenAIUserTextContent.tsx +15 -15
  42. package/src/components/events/AutoBeCompleteEventMovie.tsx +402 -402
  43. package/src/components/events/AutoBeCorrectEventMovie.tsx +354 -354
  44. package/src/components/events/AutoBeEventGroupMovie.tsx +18 -18
  45. package/src/components/events/AutoBeEventMovie.tsx +154 -158
  46. package/src/components/events/AutoBeProgressEventMovie.tsx +207 -217
  47. package/src/components/events/AutoBeScenarioEventMovie.tsx +135 -135
  48. package/src/components/events/AutoBeStartEventMovie.tsx +82 -82
  49. package/src/components/events/AutoBeValidateEventMovie.tsx +249 -249
  50. package/src/components/events/README.md +300 -300
  51. package/src/components/events/common/CollapsibleEventGroup.tsx +211 -211
  52. package/src/components/events/common/EventCard.tsx +61 -61
  53. package/src/components/events/common/EventContent.tsx +31 -31
  54. package/src/components/events/common/EventHeader.tsx +85 -85
  55. package/src/components/events/common/EventIcon.tsx +82 -82
  56. package/src/components/events/common/ProgressBar.tsx +64 -64
  57. package/src/components/events/groups/CorrectEventGroup.tsx +183 -183
  58. package/src/components/events/groups/ValidateEventGroup.tsx +143 -143
  59. package/src/components/events/utils/eventGrouper.tsx +116 -116
  60. package/src/components/upload/AutoBeChatUploadBox.tsx +433 -425
  61. package/src/components/upload/AutoBeChatUploadSendButton.tsx +66 -66
  62. package/src/components/upload/AutoBeFileUploadBox.tsx +123 -123
  63. package/src/components/upload/AutoBeVoiceRecoderButton.tsx +100 -100
  64. package/src/context/AutoBeAgentContext.tsx +301 -245
  65. package/src/context/AutoBeAgentSessionList.tsx +58 -58
  66. package/src/context/SearchParamsContext.tsx +49 -49
  67. package/src/icons/Receipt.tsx +74 -74
  68. package/src/structure/AutoBeListener.ts +368 -373
  69. package/tsconfig.json +9 -9
@@ -1,211 +1,211 @@
1
- import { ReactNode, useState } from "react";
2
-
3
- import { EventCard } from "./EventCard";
4
- import { EventContent } from "./EventContent";
5
- import { EventIcon, EventIconType } from "./EventIcon";
6
-
7
- export interface ICollapsibleEventGroupProps<T = unknown> {
8
- /** Array of events of the same type */
9
- events: T[];
10
- /** Title for the group */
11
- title: string;
12
- /** Icon type for the group header */
13
- iconType: EventIconType;
14
- /** Function to render individual events */
15
- renderEvent: (event: T, index: number) => ReactNode;
16
- /** Function to get timestamp from event (for header) */
17
- getTimestamp: (event: T) => string;
18
- /** Optional custom summary content */
19
- renderSummary?: (events: T[]) => ReactNode;
20
- /** Initial collapsed state */
21
- defaultCollapsed?: boolean;
22
- /** Custom group description */
23
- description?: string;
24
- /** Card variant based on event status */
25
- variant?: "default" | "success" | "error" | "warning";
26
- }
27
-
28
- /**
29
- * Collapsible event group component Groups multiple events of the same type
30
- * with expand/collapse functionality
31
- */
32
- export const CollapsibleEventGroup = <T,>(
33
- props: ICollapsibleEventGroupProps<T>,
34
- ) => {
35
- const {
36
- events,
37
- title,
38
- iconType,
39
- renderEvent,
40
- getTimestamp,
41
- renderSummary,
42
- defaultCollapsed = true,
43
- description,
44
- variant = "default",
45
- } = props;
46
-
47
- const [isCollapsed, setIsCollapsed] = useState(defaultCollapsed);
48
-
49
- if (events.length === 0) {
50
- return null;
51
- }
52
-
53
- // Use the latest event's timestamp for the group header
54
- const latestTimestamp = getTimestamp(events[events.length - 1]);
55
-
56
- const toggleCollapse = () => {
57
- setIsCollapsed(!isCollapsed);
58
- };
59
-
60
- const defaultSummary = (
61
- <>
62
- {description && (
63
- <>
64
- {description}
65
- <br />
66
- <br />
67
- </>
68
- )}
69
- <strong>Total Events:</strong> {events.length}
70
- <br />
71
- <strong>Status:</strong> {isCollapsed ? "Collapsed" : "Expanded"}
72
- </>
73
- );
74
-
75
- return (
76
- <EventCard variant={variant}>
77
- {/* Header */}
78
- <div
79
- style={{
80
- display: "flex",
81
- alignItems: "center",
82
- justifyContent: "space-between",
83
- marginBottom: "1rem",
84
- }}
85
- >
86
- <div
87
- style={{
88
- display: "flex",
89
- alignItems: "center",
90
- gap: "0.75rem",
91
- }}
92
- >
93
- <EventIcon type={iconType} />
94
-
95
- <div>
96
- <h3
97
- style={{
98
- fontSize: "1.125rem",
99
- fontWeight: "600",
100
- color: "#1e293b",
101
- margin: 0,
102
- marginBottom: "0.25rem",
103
- }}
104
- >
105
- {title}
106
- </h3>
107
- <div
108
- style={{
109
- fontSize: "0.75rem",
110
- color: "#64748b",
111
- }}
112
- >
113
- {events.length} event{events.length !== 1 ? "s" : ""}
114
- </div>
115
- </div>
116
- </div>
117
-
118
- <div
119
- style={{
120
- fontSize: "0.75rem",
121
- color: "#64748b",
122
- textAlign: "right",
123
- }}
124
- >
125
- {latestTimestamp}
126
- </div>
127
- </div>
128
-
129
- {/* Summary content when collapsed */}
130
- {isCollapsed && (
131
- <EventContent>
132
- {renderSummary ? renderSummary(events) : defaultSummary}
133
- </EventContent>
134
- )}
135
-
136
- {/* Individual events when expanded */}
137
- {!isCollapsed && (
138
- <div
139
- style={{
140
- display: "flex",
141
- flexDirection: "column",
142
- gap: "0.5rem",
143
- }}
144
- >
145
- {events.map((event, index) => (
146
- <div key={index}>{renderEvent(event, index)}</div>
147
- ))}
148
- </div>
149
- )}
150
-
151
- {/* Expand/Collapse Button */}
152
- <div
153
- style={{
154
- display: "flex",
155
- justifyContent: "center",
156
- marginTop: "1rem",
157
- }}
158
- >
159
- <button
160
- onClick={toggleCollapse}
161
- style={{
162
- display: "flex",
163
- alignItems: "center",
164
- gap: "0.5rem",
165
- padding: "0.5rem 1rem",
166
- backgroundColor: "#f8fafc",
167
- border: "1px solid #e2e8f0",
168
- borderRadius: "0.5rem",
169
- cursor: "pointer",
170
- fontSize: "0.875rem",
171
- color: "#64748b",
172
- transition: "all 0.2s ease",
173
- }}
174
- onMouseEnter={(e) => {
175
- e.currentTarget.style.backgroundColor = "#f1f5f9";
176
- e.currentTarget.style.borderColor = "#cbd5e1";
177
- }}
178
- onMouseLeave={(e) => {
179
- e.currentTarget.style.backgroundColor = "#f8fafc";
180
- e.currentTarget.style.borderColor = "#e2e8f0";
181
- }}
182
- >
183
- <span>{isCollapsed ? "Expand" : "Collapse"}</span>
184
- <div
185
- style={{
186
- width: "1rem",
187
- height: "1rem",
188
- display: "flex",
189
- alignItems: "center",
190
- justifyContent: "center",
191
- transition: "transform 0.2s ease",
192
- transform: isCollapsed ? "rotate(0deg)" : "rotate(180deg)",
193
- }}
194
- >
195
- <svg
196
- width="12"
197
- height="12"
198
- viewBox="0 0 24 24"
199
- fill="currentColor"
200
- style={{ color: "#64748b" }}
201
- >
202
- <path d="M7 10l5 5 5-5z" />
203
- </svg>
204
- </div>
205
- </button>
206
- </div>
207
- </EventCard>
208
- );
209
- };
210
-
211
- export default CollapsibleEventGroup;
1
+ import { ReactNode, useState } from "react";
2
+
3
+ import { EventCard } from "./EventCard";
4
+ import { EventContent } from "./EventContent";
5
+ import { EventIcon, EventIconType } from "./EventIcon";
6
+
7
+ export interface ICollapsibleEventGroupProps<T = unknown> {
8
+ /** Array of events of the same type */
9
+ events: T[];
10
+ /** Title for the group */
11
+ title: string;
12
+ /** Icon type for the group header */
13
+ iconType: EventIconType;
14
+ /** Function to render individual events */
15
+ renderEvent: (event: T, index: number) => ReactNode;
16
+ /** Function to get timestamp from event (for header) */
17
+ getTimestamp: (event: T) => string;
18
+ /** Optional custom summary content */
19
+ renderSummary?: (events: T[]) => ReactNode;
20
+ /** Initial collapsed state */
21
+ defaultCollapsed?: boolean;
22
+ /** Custom group description */
23
+ description?: string;
24
+ /** Card variant based on event status */
25
+ variant?: "default" | "success" | "error" | "warning";
26
+ }
27
+
28
+ /**
29
+ * Collapsible event group component Groups multiple events of the same type
30
+ * with expand/collapse functionality
31
+ */
32
+ export const CollapsibleEventGroup = <T,>(
33
+ props: ICollapsibleEventGroupProps<T>,
34
+ ) => {
35
+ const {
36
+ events,
37
+ title,
38
+ iconType,
39
+ renderEvent,
40
+ getTimestamp,
41
+ renderSummary,
42
+ defaultCollapsed = true,
43
+ description,
44
+ variant = "default",
45
+ } = props;
46
+
47
+ const [isCollapsed, setIsCollapsed] = useState(defaultCollapsed);
48
+
49
+ if (events.length === 0) {
50
+ return null;
51
+ }
52
+
53
+ // Use the latest event's timestamp for the group header
54
+ const latestTimestamp = getTimestamp(events[events.length - 1]);
55
+
56
+ const toggleCollapse = () => {
57
+ setIsCollapsed(!isCollapsed);
58
+ };
59
+
60
+ const defaultSummary = (
61
+ <>
62
+ {description && (
63
+ <>
64
+ {description}
65
+ <br />
66
+ <br />
67
+ </>
68
+ )}
69
+ <strong>Total Events:</strong> {events.length}
70
+ <br />
71
+ <strong>Status:</strong> {isCollapsed ? "Collapsed" : "Expanded"}
72
+ </>
73
+ );
74
+
75
+ return (
76
+ <EventCard variant={variant}>
77
+ {/* Header */}
78
+ <div
79
+ style={{
80
+ display: "flex",
81
+ alignItems: "center",
82
+ justifyContent: "space-between",
83
+ marginBottom: "1rem",
84
+ }}
85
+ >
86
+ <div
87
+ style={{
88
+ display: "flex",
89
+ alignItems: "center",
90
+ gap: "0.75rem",
91
+ }}
92
+ >
93
+ <EventIcon type={iconType} />
94
+
95
+ <div>
96
+ <h3
97
+ style={{
98
+ fontSize: "1.125rem",
99
+ fontWeight: "600",
100
+ color: "#1e293b",
101
+ margin: 0,
102
+ marginBottom: "0.25rem",
103
+ }}
104
+ >
105
+ {title}
106
+ </h3>
107
+ <div
108
+ style={{
109
+ fontSize: "0.75rem",
110
+ color: "#64748b",
111
+ }}
112
+ >
113
+ {events.length} event{events.length !== 1 ? "s" : ""}
114
+ </div>
115
+ </div>
116
+ </div>
117
+
118
+ <div
119
+ style={{
120
+ fontSize: "0.75rem",
121
+ color: "#64748b",
122
+ textAlign: "right",
123
+ }}
124
+ >
125
+ {latestTimestamp}
126
+ </div>
127
+ </div>
128
+
129
+ {/* Summary content when collapsed */}
130
+ {isCollapsed && (
131
+ <EventContent>
132
+ {renderSummary ? renderSummary(events) : defaultSummary}
133
+ </EventContent>
134
+ )}
135
+
136
+ {/* Individual events when expanded */}
137
+ {!isCollapsed && (
138
+ <div
139
+ style={{
140
+ display: "flex",
141
+ flexDirection: "column",
142
+ gap: "0.5rem",
143
+ }}
144
+ >
145
+ {events.map((event, index) => (
146
+ <div key={index}>{renderEvent(event, index)}</div>
147
+ ))}
148
+ </div>
149
+ )}
150
+
151
+ {/* Expand/Collapse Button */}
152
+ <div
153
+ style={{
154
+ display: "flex",
155
+ justifyContent: "center",
156
+ marginTop: "1rem",
157
+ }}
158
+ >
159
+ <button
160
+ onClick={toggleCollapse}
161
+ style={{
162
+ display: "flex",
163
+ alignItems: "center",
164
+ gap: "0.5rem",
165
+ padding: "0.5rem 1rem",
166
+ backgroundColor: "#f8fafc",
167
+ border: "1px solid #e2e8f0",
168
+ borderRadius: "0.5rem",
169
+ cursor: "pointer",
170
+ fontSize: "0.875rem",
171
+ color: "#64748b",
172
+ transition: "all 0.2s ease",
173
+ }}
174
+ onMouseEnter={(e) => {
175
+ e.currentTarget.style.backgroundColor = "#f1f5f9";
176
+ e.currentTarget.style.borderColor = "#cbd5e1";
177
+ }}
178
+ onMouseLeave={(e) => {
179
+ e.currentTarget.style.backgroundColor = "#f8fafc";
180
+ e.currentTarget.style.borderColor = "#e2e8f0";
181
+ }}
182
+ >
183
+ <span>{isCollapsed ? "Expand" : "Collapse"}</span>
184
+ <div
185
+ style={{
186
+ width: "1rem",
187
+ height: "1rem",
188
+ display: "flex",
189
+ alignItems: "center",
190
+ justifyContent: "center",
191
+ transition: "transform 0.2s ease",
192
+ transform: isCollapsed ? "rotate(0deg)" : "rotate(180deg)",
193
+ }}
194
+ >
195
+ <svg
196
+ width="12"
197
+ height="12"
198
+ viewBox="0 0 24 24"
199
+ fill="currentColor"
200
+ style={{ color: "#64748b" }}
201
+ >
202
+ <path d="M7 10l5 5 5-5z" />
203
+ </svg>
204
+ </div>
205
+ </button>
206
+ </div>
207
+ </EventCard>
208
+ );
209
+ };
210
+
211
+ export default CollapsibleEventGroup;
@@ -1,61 +1,61 @@
1
- import { ReactNode } from "react";
2
-
3
- export interface IEventCardProps {
4
- children: ReactNode;
5
- style?: React.CSSProperties;
6
- className?: string;
7
- variant?: "default" | "success" | "error" | "warning";
8
- }
9
-
10
- /**
11
- * Common event card container component Provides consistent styling across all
12
- * event components
13
- */
14
- export const EventCard = (props: IEventCardProps) => {
15
- const { variant = "default" } = props;
16
-
17
- const getVariantStyles = () => {
18
- switch (variant) {
19
- case "success":
20
- return {
21
- backgroundColor: "#f0fdf4",
22
- border: "1px solid #bbf7d0",
23
- boxShadow: "0 1px 3px 0 rgb(34 197 94 / 0.1)",
24
- };
25
- case "error":
26
- return {
27
- backgroundColor: "#fef2f2",
28
- border: "1px solid #fecaca",
29
- boxShadow: "0 1px 3px 0 rgb(239 68 68 / 0.1)",
30
- };
31
- case "warning":
32
- return {
33
- backgroundColor: "#fffbeb",
34
- border: "1px solid #fed7aa",
35
- boxShadow: "0 1px 3px 0 rgb(245 158 11 / 0.1)",
36
- };
37
- default:
38
- return {
39
- backgroundColor: "#f8fafc",
40
- border: "1px solid #e2e8f0",
41
- boxShadow: "0 1px 3px 0 rgb(0 0 0 / 0.1)",
42
- };
43
- }
44
- };
45
-
46
- return (
47
- <div
48
- className={props.className}
49
- style={{
50
- ...getVariantStyles(),
51
- borderRadius: "0.75rem",
52
- padding: "1.5rem",
53
- ...props.style,
54
- }}
55
- >
56
- {props.children}
57
- </div>
58
- );
59
- };
60
-
61
- export default EventCard;
1
+ import { ReactNode } from "react";
2
+
3
+ export interface IEventCardProps {
4
+ children: ReactNode;
5
+ style?: React.CSSProperties;
6
+ className?: string;
7
+ variant?: "default" | "success" | "error" | "warning";
8
+ }
9
+
10
+ /**
11
+ * Common event card container component Provides consistent styling across all
12
+ * event components
13
+ */
14
+ export const EventCard = (props: IEventCardProps) => {
15
+ const { variant = "default" } = props;
16
+
17
+ const getVariantStyles = () => {
18
+ switch (variant) {
19
+ case "success":
20
+ return {
21
+ backgroundColor: "#f0fdf4",
22
+ border: "1px solid #bbf7d0",
23
+ boxShadow: "0 1px 3px 0 rgb(34 197 94 / 0.1)",
24
+ };
25
+ case "error":
26
+ return {
27
+ backgroundColor: "#fef2f2",
28
+ border: "1px solid #fecaca",
29
+ boxShadow: "0 1px 3px 0 rgb(239 68 68 / 0.1)",
30
+ };
31
+ case "warning":
32
+ return {
33
+ backgroundColor: "#fffbeb",
34
+ border: "1px solid #fed7aa",
35
+ boxShadow: "0 1px 3px 0 rgb(245 158 11 / 0.1)",
36
+ };
37
+ default:
38
+ return {
39
+ backgroundColor: "#f8fafc",
40
+ border: "1px solid #e2e8f0",
41
+ boxShadow: "0 1px 3px 0 rgb(0 0 0 / 0.1)",
42
+ };
43
+ }
44
+ };
45
+
46
+ return (
47
+ <div
48
+ className={props.className}
49
+ style={{
50
+ ...getVariantStyles(),
51
+ borderRadius: "0.75rem",
52
+ padding: "1.5rem",
53
+ ...props.style,
54
+ }}
55
+ >
56
+ {props.children}
57
+ </div>
58
+ );
59
+ };
60
+
61
+ export default EventCard;
@@ -1,31 +1,31 @@
1
- import { ReactNode } from "react";
2
-
3
- export interface IEventContentProps {
4
- children: ReactNode;
5
- style?: React.CSSProperties;
6
- }
7
-
8
- /**
9
- * Common event content component Provides consistent content area styling
10
- * across all event components
11
- */
12
- export const EventContent = (props: IEventContentProps) => {
13
- return (
14
- <div
15
- style={{
16
- fontSize: "0.875rem",
17
- lineHeight: "1.5",
18
- color: "#475569",
19
- backgroundColor: "#ffffff",
20
- padding: "1rem",
21
- borderRadius: "0.5rem",
22
- border: "1px solid #e2e8f0",
23
- ...props.style,
24
- }}
25
- >
26
- {props.children}
27
- </div>
28
- );
29
- };
30
-
31
- export default EventContent;
1
+ import { ReactNode } from "react";
2
+
3
+ export interface IEventContentProps {
4
+ children: ReactNode;
5
+ style?: React.CSSProperties;
6
+ }
7
+
8
+ /**
9
+ * Common event content component Provides consistent content area styling
10
+ * across all event components
11
+ */
12
+ export const EventContent = (props: IEventContentProps) => {
13
+ return (
14
+ <div
15
+ style={{
16
+ fontSize: "0.875rem",
17
+ lineHeight: "1.5",
18
+ color: "#475569",
19
+ backgroundColor: "#ffffff",
20
+ padding: "1rem",
21
+ borderRadius: "0.5rem",
22
+ border: "1px solid #e2e8f0",
23
+ ...props.style,
24
+ }}
25
+ >
26
+ {props.children}
27
+ </div>
28
+ );
29
+ };
30
+
31
+ export default EventContent;