@autobe/ui 0.30.0-dev.20260315 → 0.30.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.
Files changed (86) hide show
  1. package/LICENSE +661 -661
  2. package/lib/components/AutoBeChatMain.js +5 -5
  3. package/lib/components/AutoBeConfigModal.js +9 -9
  4. package/package.json +2 -2
  5. package/src/components/AutoBeAssistantMessageMovie.tsx +22 -22
  6. package/src/components/AutoBeChatMain.tsx +376 -376
  7. package/src/components/AutoBeChatSidebar.tsx +414 -414
  8. package/src/components/AutoBeConfigButton.tsx +83 -83
  9. package/src/components/AutoBeConfigModal.tsx +443 -443
  10. package/src/components/AutoBeStatusButton.tsx +75 -75
  11. package/src/components/AutoBeStatusModal.tsx +486 -486
  12. package/src/components/AutoBeUserMessageMovie.tsx +27 -27
  13. package/src/components/common/ActionButton.tsx +205 -205
  14. package/src/components/common/ActionButtonGroup.tsx +80 -80
  15. package/src/components/common/AutoBeConfigInput.tsx +185 -185
  16. package/src/components/common/ChatBubble.tsx +119 -119
  17. package/src/components/common/Collapsible.tsx +95 -95
  18. package/src/components/common/CompactSessionIndicator.tsx +73 -73
  19. package/src/components/common/CompactSessionList.tsx +82 -82
  20. package/src/components/common/index.ts +8 -8
  21. package/src/components/common/openai/OpenAIContent.tsx +53 -53
  22. package/src/components/common/openai/OpenAIUserAudioContent.tsx +70 -70
  23. package/src/components/common/openai/OpenAIUserFileContent.tsx +76 -76
  24. package/src/components/common/openai/OpenAIUserImageContent.tsx +34 -34
  25. package/src/components/common/openai/OpenAIUserTextContent.tsx +15 -15
  26. package/src/components/common/openai/index.ts +5 -5
  27. package/src/components/events/AutoBeCompleteEventMovie.tsx +402 -402
  28. package/src/components/events/AutoBeCorrectEventMovie.tsx +354 -354
  29. package/src/components/events/AutoBeEventGroupMovie.tsx +18 -18
  30. package/src/components/events/AutoBeEventMovie.tsx +158 -158
  31. package/src/components/events/AutoBeProgressEventMovie.tsx +217 -217
  32. package/src/components/events/AutoBeScenarioEventMovie.tsx +135 -135
  33. package/src/components/events/AutoBeStartEventMovie.tsx +82 -82
  34. package/src/components/events/AutoBeValidateEventMovie.tsx +249 -249
  35. package/src/components/events/README.md +300 -300
  36. package/src/components/events/common/CollapsibleEventGroup.tsx +211 -211
  37. package/src/components/events/common/EventCard.tsx +61 -61
  38. package/src/components/events/common/EventContent.tsx +31 -31
  39. package/src/components/events/common/EventHeader.tsx +85 -85
  40. package/src/components/events/common/EventIcon.tsx +82 -82
  41. package/src/components/events/common/ProgressBar.tsx +64 -64
  42. package/src/components/events/common/index.ts +13 -13
  43. package/src/components/events/groups/CorrectEventGroup.tsx +183 -183
  44. package/src/components/events/groups/ValidateEventGroup.tsx +143 -143
  45. package/src/components/events/groups/index.ts +8 -8
  46. package/src/components/events/index.ts +16 -16
  47. package/src/components/events/utils/eventGrouper.tsx +116 -116
  48. package/src/components/events/utils/index.ts +1 -1
  49. package/src/components/index.ts +13 -13
  50. package/src/components/upload/AutoBeChatUploadBox.tsx +425 -425
  51. package/src/components/upload/AutoBeChatUploadSendButton.tsx +66 -66
  52. package/src/components/upload/AutoBeFileUploadBox.tsx +123 -123
  53. package/src/components/upload/AutoBeUploadConfig.ts +5 -5
  54. package/src/components/upload/AutoBeVoiceRecoderButton.tsx +100 -100
  55. package/src/components/upload/index.ts +5 -5
  56. package/src/constant/color.ts +28 -28
  57. package/src/context/AutoBeAgentContext.tsx +245 -245
  58. package/src/context/AutoBeAgentSessionList.tsx +58 -58
  59. package/src/context/SearchParamsContext.tsx +49 -49
  60. package/src/hooks/index.ts +3 -3
  61. package/src/hooks/useEscapeKey.ts +24 -24
  62. package/src/hooks/useIsomorphicLayoutEffect.ts +8 -8
  63. package/src/hooks/useMediaQuery.ts +73 -73
  64. package/src/hooks/useSessionStorage.ts +10 -10
  65. package/src/icons/Receipt.tsx +74 -74
  66. package/src/index.ts +9 -9
  67. package/src/strategy/AutoBeAgentSessionStorageStrategy.ts +127 -127
  68. package/src/structure/AutoBeListener.ts +373 -373
  69. package/src/structure/AutoBeListenerState.ts +53 -53
  70. package/src/structure/IAutoBeAgentSessionStorageStrategy.ts +87 -87
  71. package/src/structure/IAutoBeEventGroup.ts +6 -6
  72. package/src/structure/index.ts +4 -4
  73. package/src/types/config.ts +44 -44
  74. package/src/types/index.ts +1 -1
  75. package/src/utils/AutoBeFileUploader.ts +279 -279
  76. package/src/utils/AutoBeVoiceRecorder.ts +95 -95
  77. package/src/utils/__tests__/crypto.test.ts +286 -286
  78. package/src/utils/__tests__/storage.test.ts +229 -229
  79. package/src/utils/crypto.ts +95 -95
  80. package/src/utils/index.ts +6 -6
  81. package/src/utils/number.ts +17 -17
  82. package/src/utils/storage.ts +96 -96
  83. package/src/utils/time.ts +14 -14
  84. package/tsconfig.json +9 -9
  85. package/vitest.config.ts +15 -15
  86. package/README.md +0 -261
@@ -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;