@nualang/nualang-ui-components 0.1.1298 → 0.1.1300
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/dist/Assignments/AssignmentCard/AssignmentCard.js +3 -27
- package/dist/Assignments/AssignmentCourseSelection/AssignmentCourseSelection.js +6 -1
- package/dist/Assignments/AssignmentExerciseSelection/AssignmentExerciseSelection.js +6 -2
- package/dist/Assignments/AssignmentExerciseSelector/AssignmentExerciseSelector.js +2 -0
- package/dist/Assignments/AssignmentSelectExercise/AssignmentSelectExercise.js +2 -0
- package/dist/Assignments/CreateAssignmentDialog/CreateAssignmentDialog.js +15 -11
- package/dist/Cards/Classroom/Classroom.js +1 -1
- package/dist/Dialogs/BotPreview/BotPreview.js +1 -1
- package/dist/Dialogs/RecordingDialog/RecordingDialog.js +34 -57
- package/dist/Editors/Bot/Bot.js +11 -22
- package/dist/Editors/Bot/Editor/BotDesigner/AlternativesList.js +3 -15
- package/dist/Editors/Bot/Editor/BotDesigner/BotDesigner.js +4 -69
- package/dist/Editors/Bot/Editor/BotDesigner/BotDesigner.test.js +8 -1
- package/dist/Editors/Bot/Editor/BotDesigner/VarList.js +5 -21
- package/dist/Editors/Bot/Editor/Editor.js +27 -768
- package/dist/Editors/Roleplay/Roleplay.js +3 -3
- package/dist/Exercises/Bot/Bot.js +1 -1
- package/dist/Forms/CreateBot/CreateBot.js +3 -1
- package/dist/Forms/FeedbackForm/FeedbackForm.js +9 -1
- package/dist/Forms/InputHelper/InputHelper.js +1 -2
- package/dist/Lists/CourseOutline/CourseOutline.js +31 -6
- package/dist/Lists/Exercises/Exercises.js +5 -5
- package/dist/Lists/Members/Members.js +34 -24
- package/dist/Screens/Classrooms/ViewClassroom/ViewClassroom.js +2 -0
- package/dist/Screens/Courses/ViewCourse/ViewCourse.js +1 -1
- package/dist/Screens/Courses/ViewCourse/ViewTopic/ViewTopic.js +4 -1
- package/dist/Tables/MeetingPrompstList/MeetingPromptsList.js +196 -73
- package/dist/Tables/Progress/Progress.js +1 -1
- package/dist/Tables/Progress/ProgressTable.js +12 -9
- package/dist/Tables/Progress/utils.js +4 -4
- package/dist/utils/index.js +81 -7
- package/package.json +27 -31
- package/dist/Editors/Bot/Editor/BotDesigner/AddSubstitutionModal/AddSubstitutionModal.js +0 -94
- package/dist/Editors/Bot/Editor/BotDesigner/AddSubstitutionModal/AddSubstitutionModal.test.js +0 -12
- package/dist/Editors/Bot/Editor/BotDesigner/AddSubstitutionModal/package.json +0 -6
- package/dist/Editors/Bot/Editor/BotDesigner/AddTopicModal/AddTopicModal.js +0 -77
- package/dist/Editors/Bot/Editor/BotDesigner/AddTopicModal/AddTopicModal.test.js +0 -17
- package/dist/Editors/Bot/Editor/BotDesigner/AddTopicModal/package.json +0 -6
- package/dist/Editors/Bot/Editor/BotDesigner/AddTriggerModal/AddTriggerModal.js +0 -161
- package/dist/Editors/Bot/Editor/BotDesigner/AddTriggerModal/AddTriggerModal.test.js +0 -12
- package/dist/Editors/Bot/Editor/BotDesigner/AddTriggerModal/package.json +0 -6
- package/dist/Editors/Bot/Editor/BotDesigner/AddVariableModal/AddVariableModal.js +0 -92
- package/dist/Editors/Bot/Editor/BotDesigner/AddVariableModal/AddVariableModal.test.js +0 -12
- package/dist/Editors/Bot/Editor/BotDesigner/AddVariableModal/package.json +0 -6
- package/dist/Editors/Bot/Editor/BotDesigner/SubList.js +0 -93
- package/dist/Editors/Bot/Editor/BotDesigner/SwitchEditorModal/SwitchEditorModal.js +0 -32
- package/dist/Editors/Bot/Editor/BotDesigner/SwitchEditorModal/package.json +0 -6
- package/dist/Editors/Bot/Editor/BotDesigner/TopicList.js +0 -268
- package/dist/Editors/Bot/Editor/BotFlow/BotFlow.js +0 -145
- package/dist/Editors/Bot/Editor/BotFlow/package.json +0 -6
- package/dist/Editors/Bot/Editor/themes/nualang-dark.css +0 -134
|
@@ -7,6 +7,7 @@ import { courses as courseQuerys, ReactQuery } from "@nualang/nualang-api-and-qu
|
|
|
7
7
|
import useConfirm from "../../hooks/useConfirm";
|
|
8
8
|
import { Delete } from "@mui/icons-material";
|
|
9
9
|
import { Edit } from "@mui/icons-material";
|
|
10
|
+
import dayjs from "dayjs";
|
|
10
11
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
11
12
|
export default function AssignmentCard({
|
|
12
13
|
t = text => text,
|
|
@@ -40,32 +41,6 @@ export default function AssignmentCard({
|
|
|
40
41
|
await deleteAssignment(classroomId, assignmentId);
|
|
41
42
|
}
|
|
42
43
|
};
|
|
43
|
-
const calculateDaysUntilDue = (dueDate, scheduledDate, t) => {
|
|
44
|
-
const now = new Date();
|
|
45
|
-
const due = new Date(dueDate);
|
|
46
|
-
const scheduled = new Date(scheduledDate);
|
|
47
|
-
if (scheduled > now) {
|
|
48
|
-
const daysUntilScheduled = Math.ceil((scheduled - now) / (1000 * 60 * 60 * 24));
|
|
49
|
-
if (daysUntilScheduled === 1) {
|
|
50
|
-
return t("available_tomorrow");
|
|
51
|
-
} else if (daysUntilScheduled === 0) {
|
|
52
|
-
return t("available_today");
|
|
53
|
-
} else {
|
|
54
|
-
return `${t("available_in")} ${daysUntilScheduled} ${t("days")}`;
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
const diffTime = due - now;
|
|
58
|
-
const diffDays = Math.ceil(diffTime / (1000 * 60 * 60 * 24));
|
|
59
|
-
if (diffDays < 0) {
|
|
60
|
-
return t("overdue");
|
|
61
|
-
} else if (diffDays === 0) {
|
|
62
|
-
return t("due_today");
|
|
63
|
-
} else if (diffDays === 1) {
|
|
64
|
-
return t("due_tomorrow");
|
|
65
|
-
} else {
|
|
66
|
-
return `${t("due_in")} ${diffDays} ${t("days")}`;
|
|
67
|
-
}
|
|
68
|
-
};
|
|
69
44
|
const {
|
|
70
45
|
uniqueCourses
|
|
71
46
|
} = useMemo(() => {
|
|
@@ -147,10 +122,11 @@ export default function AssignmentCard({
|
|
|
147
122
|
})]
|
|
148
123
|
})
|
|
149
124
|
}), /*#__PURE__*/_jsx(Grid, {
|
|
125
|
+
textAlign: "right",
|
|
150
126
|
children: /*#__PURE__*/_jsx(Typography, {
|
|
151
127
|
variant: "button",
|
|
152
128
|
color: "text.secondary",
|
|
153
|
-
children:
|
|
129
|
+
children: dayjs(assignment.scheduleDate).isAfter(dayjs()) ? `${t("available_from")} ${dayjs(assignment.scheduleDate).format("DD MMM YYYY • h:mm A")}` : `${t("due")} ${dayjs(assignment.dueDate).format("DD MMM YYYY • h:mm A")}`
|
|
154
130
|
})
|
|
155
131
|
}), isCreator && /*#__PURE__*/_jsxs(Grid, {
|
|
156
132
|
children: [/*#__PURE__*/_jsx(Tooltip, {
|
|
@@ -31,6 +31,7 @@ function Course({
|
|
|
31
31
|
lastClickedExerciseId,
|
|
32
32
|
handleRemoveExercise,
|
|
33
33
|
isPreview,
|
|
34
|
+
isChallengeModeEnabled = false,
|
|
34
35
|
isChallengeModeStudent
|
|
35
36
|
}) {
|
|
36
37
|
const numOfIds = lastClickedExerciseId ? lastClickedExerciseId.split("|") : [];
|
|
@@ -87,7 +88,7 @@ function Course({
|
|
|
87
88
|
}
|
|
88
89
|
});
|
|
89
90
|
if (courseSections && memberCourseCompletions && selectedExercises) {
|
|
90
|
-
const sectionsWithProgress = calcCompletions(courseSections.filter(section => assignedSectionIds.has(section.sectionId)), memberCourseCompletions, selectedExercises);
|
|
91
|
+
const sectionsWithProgress = calcCompletions(courseSections.filter(section => assignedSectionIds.has(section.sectionId)), memberCourseCompletions, selectedExercises, true);
|
|
91
92
|
const percentCompletion = calcPercentageCompletion(sectionsWithProgress);
|
|
92
93
|
setCourseSectionCompletion(percentCompletion);
|
|
93
94
|
}
|
|
@@ -176,6 +177,7 @@ function Course({
|
|
|
176
177
|
progressHelpers: progressHelpers,
|
|
177
178
|
memberCourseCompletions: memberCourseCompletions,
|
|
178
179
|
lastClickedExerciseId: lastClickedExerciseId,
|
|
180
|
+
isChallengeModeEnabled: isChallengeModeEnabled,
|
|
179
181
|
isChallengeModeStudent: isChallengeModeStudent
|
|
180
182
|
})
|
|
181
183
|
})
|
|
@@ -206,6 +208,7 @@ function Course({
|
|
|
206
208
|
course: course,
|
|
207
209
|
handleRemoveExercise: handleRemoveExercise,
|
|
208
210
|
isPreview: isPreview,
|
|
211
|
+
isChallengeModeEnabled: isChallengeModeEnabled,
|
|
209
212
|
isChallengeModeStudent: isChallengeModeStudent
|
|
210
213
|
})
|
|
211
214
|
})
|
|
@@ -233,6 +236,7 @@ function AssignmentCourseSelection({
|
|
|
233
236
|
lastClickedExerciseId,
|
|
234
237
|
handleRemoveExercise,
|
|
235
238
|
isPreview,
|
|
239
|
+
isChallengeModeEnabled = false,
|
|
236
240
|
isChallengeModeStudent,
|
|
237
241
|
...otherProps
|
|
238
242
|
}) {
|
|
@@ -260,6 +264,7 @@ function AssignmentCourseSelection({
|
|
|
260
264
|
lastClickedExerciseId: lastClickedExerciseId,
|
|
261
265
|
handleRemoveExercise: handleRemoveExercise,
|
|
262
266
|
isPreview: isPreview,
|
|
267
|
+
isChallengeModeEnabled: isChallengeModeEnabled,
|
|
263
268
|
isChallengeModeStudent: isChallengeModeStudent
|
|
264
269
|
}, course.courseId || index))
|
|
265
270
|
});
|
|
@@ -48,6 +48,7 @@ function Exercise({
|
|
|
48
48
|
lastClickedExerciseId,
|
|
49
49
|
isPreview,
|
|
50
50
|
handleRemoveExercise = null,
|
|
51
|
+
isChallengeModeEnabled = false,
|
|
51
52
|
isChallengeModeStudent
|
|
52
53
|
}) {
|
|
53
54
|
const [listeningHidden, setListeningHidden] = useState(false);
|
|
@@ -268,7 +269,8 @@ function Exercise({
|
|
|
268
269
|
isCreator: isCreator,
|
|
269
270
|
lastClickedExerciseId: lastClickedExerciseId,
|
|
270
271
|
handleRemoveExercise: handleRemoveExercise,
|
|
271
|
-
isPreview: isPreview
|
|
272
|
+
isPreview: isPreview,
|
|
273
|
+
isChallengeModeEnabled: isChallengeModeEnabled
|
|
272
274
|
})
|
|
273
275
|
})
|
|
274
276
|
}), name.toLowerCase() === "bots" && /*#__PURE__*/_jsx(Collapse, {
|
|
@@ -296,6 +298,7 @@ function Exercise({
|
|
|
296
298
|
lastClickedExerciseId: lastClickedExerciseId,
|
|
297
299
|
handleRemoveExercise: handleRemoveExercise,
|
|
298
300
|
isPreview: isPreview,
|
|
301
|
+
isChallengeModeEnabled: isChallengeModeEnabled,
|
|
299
302
|
isChallengeModeStudent: isChallengeModeStudent
|
|
300
303
|
})
|
|
301
304
|
})
|
|
@@ -882,13 +885,14 @@ function SectionList({
|
|
|
882
885
|
course,
|
|
883
886
|
handleRemoveExercise,
|
|
884
887
|
isPreview,
|
|
888
|
+
isChallengeModeEnabled = false,
|
|
885
889
|
isChallengeModeStudent,
|
|
886
890
|
...otherProps
|
|
887
891
|
}) {
|
|
888
892
|
const [courseSectionWithProgress, setCourseSectionWithProgress] = useState([]);
|
|
889
893
|
useEffect(() => {
|
|
890
894
|
if (sections && memberCourseCompletions && selectedExercises) {
|
|
891
|
-
const sectionsWithProgress = calcCompletions(sections, memberCourseCompletions, selectedExercises);
|
|
895
|
+
const sectionsWithProgress = calcCompletions(sections, memberCourseCompletions, true, selectedExercises);
|
|
892
896
|
setCourseSectionWithProgress(sectionsWithProgress);
|
|
893
897
|
}
|
|
894
898
|
}, [sections, memberCourseCompletions, selectedExercises]);
|
|
@@ -20,6 +20,7 @@ function AssignmentExerciseSelector({
|
|
|
20
20
|
lastClickedExerciseId,
|
|
21
21
|
handleRemoveExercise,
|
|
22
22
|
isPreview,
|
|
23
|
+
isChallengeModeEnabled = false,
|
|
23
24
|
isChallengeModeStudent
|
|
24
25
|
}) {
|
|
25
26
|
return /*#__PURE__*/_jsx(Box, {
|
|
@@ -42,6 +43,7 @@ function AssignmentExerciseSelector({
|
|
|
42
43
|
lastClickedExerciseId: lastClickedExerciseId,
|
|
43
44
|
handleRemoveExercise: handleRemoveExercise,
|
|
44
45
|
isPreview: isPreview,
|
|
46
|
+
isChallengeModeEnabled: isChallengeModeEnabled,
|
|
45
47
|
isChallengeModeStudent: isChallengeModeStudent
|
|
46
48
|
})
|
|
47
49
|
});
|
|
@@ -20,6 +20,7 @@ function AssignmentSelectExercise({
|
|
|
20
20
|
preferred_username,
|
|
21
21
|
progressHelpers,
|
|
22
22
|
memberCourseCompletions,
|
|
23
|
+
isChallengeModeEnabled = false,
|
|
23
24
|
isChallengeModeStudent
|
|
24
25
|
}) {
|
|
25
26
|
const [isExerciseSelected, setIsExerciseSelected] = useState(false);
|
|
@@ -93,6 +94,7 @@ function AssignmentSelectExercise({
|
|
|
93
94
|
preferred_username: preferred_username,
|
|
94
95
|
progressHelpers: progressHelpers,
|
|
95
96
|
memberCourseCompletions: memberCourseCompletions,
|
|
97
|
+
isChallengeModeEnabled: isChallengeModeEnabled,
|
|
96
98
|
isChallengeModeStudent: isChallengeModeStudent
|
|
97
99
|
})
|
|
98
100
|
})]
|
|
@@ -6,7 +6,7 @@ import AddIcon from "@mui/icons-material/Add";
|
|
|
6
6
|
import Close from "@mui/icons-material/Close";
|
|
7
7
|
import { AdapterDayjs } from "@mui/x-date-pickers/AdapterDayjs";
|
|
8
8
|
import { LocalizationProvider } from "@mui/x-date-pickers/LocalizationProvider";
|
|
9
|
-
import {
|
|
9
|
+
import { DateTimePicker } from "@mui/x-date-pickers/DateTimePicker";
|
|
10
10
|
import { makeStyles } from "tss-react/mui";
|
|
11
11
|
import dayjs from "dayjs";
|
|
12
12
|
import AssignmentSelectExercise from "../AssignmentSelectExercise/AssignmentSelectExercise";
|
|
@@ -50,7 +50,8 @@ export default function CreateAssignmentDialog({
|
|
|
50
50
|
initialData = {},
|
|
51
51
|
dialogTitle,
|
|
52
52
|
userEmail = "",
|
|
53
|
-
assignedStudents
|
|
53
|
+
assignedStudents,
|
|
54
|
+
isChallengeModeEnabled = false
|
|
54
55
|
}) {
|
|
55
56
|
const {
|
|
56
57
|
classes
|
|
@@ -67,7 +68,7 @@ export default function CreateAssignmentDialog({
|
|
|
67
68
|
title: initialData.title ? initialData.title : undefined,
|
|
68
69
|
instructions: initialData.instructions ? initialData.instructions : t("default_assignment_instructions"),
|
|
69
70
|
type: "assignment",
|
|
70
|
-
scheduleDate: dayjs().
|
|
71
|
+
scheduleDate: dayjs().add(1, "minute"),
|
|
71
72
|
dueDate: dayjs().add(1, "day").endOf("day"),
|
|
72
73
|
exercises: submittedExercises,
|
|
73
74
|
...initialData
|
|
@@ -446,7 +447,8 @@ export default function CreateAssignmentDialog({
|
|
|
446
447
|
viewOnly: true,
|
|
447
448
|
useCase: "assignment-view",
|
|
448
449
|
handleRemoveExercise: handleRemoveExercise,
|
|
449
|
-
isPreview: true
|
|
450
|
+
isPreview: true,
|
|
451
|
+
isChallengeModeEnabled: isChallengeModeEnabled
|
|
450
452
|
})]
|
|
451
453
|
})
|
|
452
454
|
}), /*#__PURE__*/_jsx(Card, {
|
|
@@ -553,7 +555,7 @@ export default function CreateAssignmentDialog({
|
|
|
553
555
|
},
|
|
554
556
|
children: [/*#__PURE__*/_jsx(LocalizationProvider, {
|
|
555
557
|
dateAdapter: AdapterDayjs,
|
|
556
|
-
children: /*#__PURE__*/_jsx(
|
|
558
|
+
children: /*#__PURE__*/_jsx(DateTimePicker, {
|
|
557
559
|
label: t("assign_date"),
|
|
558
560
|
value: assignment.scheduleDate,
|
|
559
561
|
onChange: date => setAssignment(prev => ({
|
|
@@ -561,18 +563,18 @@ export default function CreateAssignmentDialog({
|
|
|
561
563
|
scheduleDate: date
|
|
562
564
|
})),
|
|
563
565
|
disablePast: true,
|
|
564
|
-
|
|
566
|
+
maxDateTime: assignment.dueDate,
|
|
565
567
|
sx: {
|
|
566
568
|
width: "45%"
|
|
567
569
|
},
|
|
568
|
-
format: "DD MMM YYYY"
|
|
570
|
+
format: "DD MMM YYYY HH:mm"
|
|
569
571
|
})
|
|
570
572
|
}), /*#__PURE__*/_jsx(Typography, {
|
|
571
573
|
variant: "h4",
|
|
572
574
|
children: "-"
|
|
573
|
-
}),
|
|
575
|
+
}), /*#__PURE__*/_jsx(LocalizationProvider, {
|
|
574
576
|
dateAdapter: AdapterDayjs,
|
|
575
|
-
children: /*#__PURE__*/_jsx(
|
|
577
|
+
children: /*#__PURE__*/_jsx(DateTimePicker, {
|
|
576
578
|
"data-cy": "assignment-date-picker",
|
|
577
579
|
label: t("due"),
|
|
578
580
|
value: assignment.dueDate,
|
|
@@ -581,10 +583,11 @@ export default function CreateAssignmentDialog({
|
|
|
581
583
|
...prev,
|
|
582
584
|
dueDate: date
|
|
583
585
|
})),
|
|
586
|
+
minDateTime: assignment.scheduleDate,
|
|
584
587
|
sx: {
|
|
585
588
|
width: "45%"
|
|
586
589
|
},
|
|
587
|
-
format: "DD MMM YYYY"
|
|
590
|
+
format: "DD MMM YYYY HH:mm"
|
|
588
591
|
})
|
|
589
592
|
})]
|
|
590
593
|
})]
|
|
@@ -634,7 +637,8 @@ export default function CreateAssignmentDialog({
|
|
|
634
637
|
useCase: "assignment-select",
|
|
635
638
|
selectedExercises: selectedExercises,
|
|
636
639
|
setSelectedExercises: setSelectedExercises,
|
|
637
|
-
setSubmittedExercises: setSubmittedExercises
|
|
640
|
+
setSubmittedExercises: setSubmittedExercises,
|
|
641
|
+
isChallengeModeEnabled: isChallengeModeEnabled
|
|
638
642
|
})]
|
|
639
643
|
});
|
|
640
644
|
}
|
|
@@ -193,7 +193,7 @@ function ClassroomCard({
|
|
|
193
193
|
joinClassroom();
|
|
194
194
|
}
|
|
195
195
|
};
|
|
196
|
-
const memberCount = membersQuery.isSuccess ? membersQuery.data.Items.length : 0;
|
|
196
|
+
const memberCount = membersQuery.isSuccess ? (membersQuery.data.Items || []).length : 0;
|
|
197
197
|
const isInviteFeatureDisabled = classroomId && classroomId.toLowerCase().includes("wayside");
|
|
198
198
|
return /*#__PURE__*/_jsxs(CardContainer, {
|
|
199
199
|
sx: disableRaised ? {} : classes.hover,
|
|
@@ -6,6 +6,7 @@ import Replay from "@mui/icons-material/Replay";
|
|
|
6
6
|
import VolumeOff from "@mui/icons-material/VolumeOff";
|
|
7
7
|
import VolumeUp from "@mui/icons-material/VolumeUp";
|
|
8
8
|
import InfoOutlined from "@mui/icons-material/InfoOutlined";
|
|
9
|
+
import RiveScript from "@nualang/rivescript";
|
|
9
10
|
|
|
10
11
|
// components
|
|
11
12
|
import Chat from "../../Chat/Chat";
|
|
@@ -16,7 +17,6 @@ import useRecognition from "../../hooks/useRecognition";
|
|
|
16
17
|
import useExerciseState from "../../hooks/useExerciseState";
|
|
17
18
|
import { removeExtraWhiteSpaces } from "../../utils";
|
|
18
19
|
import CloseBotPreview from "../ExerciseMenu/Menus/CloseBotPreview/CloseBotPreview";
|
|
19
|
-
import RiveScript from "rivescript";
|
|
20
20
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
21
21
|
const useStyles = makeStyles()(() => ({
|
|
22
22
|
descriptionWrapper: {
|
|
@@ -22,69 +22,46 @@ function TranscriptViewer({
|
|
|
22
22
|
height: "150px",
|
|
23
23
|
wordBreak: "break-word",
|
|
24
24
|
padding: "10px",
|
|
25
|
-
marginTop: "20px"
|
|
25
|
+
marginTop: "20px",
|
|
26
|
+
width: "100%",
|
|
27
|
+
boxSizing: "border-box"
|
|
26
28
|
},
|
|
27
29
|
children: conversation && Object.keys(conversation).length > 0 ? conversation.map((sentence, i) => {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
const
|
|
31
|
-
|
|
32
|
-
// console.log({ sentence, attendee, userImage, conversation })
|
|
33
|
-
return /*#__PURE__*/_jsx(Box, {
|
|
34
|
-
"aria-label": "go to time in recording",
|
|
30
|
+
const identifier = sentence.userId || sentence.username || sentence.user || sentence.speaker || sentence.name;
|
|
31
|
+
const attendee = attendeesData.find(item => item.memberId === identifier || item.username?.toLowerCase() === identifier?.toLowerCase());
|
|
32
|
+
const userImage = attendee?.userImage || null;
|
|
33
|
+
return /*#__PURE__*/_jsxs(Box, {
|
|
35
34
|
onClick: () => goToTimestamp(sentence.start_time, sentence.end_time),
|
|
36
|
-
sx: {
|
|
35
|
+
sx: theme => ({
|
|
36
|
+
display: "flex",
|
|
37
|
+
alignItems: "center",
|
|
38
|
+
mb: 1,
|
|
37
39
|
cursor: "pointer",
|
|
38
|
-
|
|
40
|
+
p: 1,
|
|
41
|
+
borderRadius: 1,
|
|
39
42
|
"&:hover": {
|
|
40
|
-
backgroundColor: "#
|
|
43
|
+
backgroundColor: theme.palette.mode === "dark" ? theme.palette.primary.main : "#f9f9f9"
|
|
41
44
|
}
|
|
42
|
-
},
|
|
43
|
-
children: /*#__PURE__*/
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
height: 24,
|
|
63
|
-
marginRight: "8px"
|
|
64
|
-
}
|
|
65
|
-
}), sentence?.user && /*#__PURE__*/_jsx("span", {
|
|
66
|
-
style: {
|
|
67
|
-
fontWeight: "bold",
|
|
68
|
-
marginRight: "8px"
|
|
69
|
-
},
|
|
70
|
-
children: `${sentence.user}:`
|
|
71
|
-
})]
|
|
72
|
-
})
|
|
73
|
-
}), /*#__PURE__*/_jsx(Grid, {
|
|
74
|
-
size: {
|
|
75
|
-
xs: 8,
|
|
76
|
-
md: 9
|
|
77
|
-
},
|
|
78
|
-
sx: {
|
|
79
|
-
display: "flex",
|
|
80
|
-
flexDirection: "column",
|
|
81
|
-
alignItems: "left"
|
|
82
|
-
},
|
|
83
|
-
children: /*#__PURE__*/_jsx(Typography, {
|
|
84
|
-
children: sentence.text
|
|
85
|
-
})
|
|
86
|
-
})]
|
|
87
|
-
})
|
|
45
|
+
}),
|
|
46
|
+
children: [/*#__PURE__*/_jsx(Avatar, {
|
|
47
|
+
alt: sentence?.username,
|
|
48
|
+
src: userImage,
|
|
49
|
+
sx: {
|
|
50
|
+
width: 24,
|
|
51
|
+
height: 24,
|
|
52
|
+
mr: 1
|
|
53
|
+
}
|
|
54
|
+
}), sentence?.user && /*#__PURE__*/_jsx(Typography, {
|
|
55
|
+
variant: "subtitle2",
|
|
56
|
+
fontWeight: "bold",
|
|
57
|
+
sx: {
|
|
58
|
+
mr: 1
|
|
59
|
+
},
|
|
60
|
+
children: `${sentence.user}:`
|
|
61
|
+
}), /*#__PURE__*/_jsx(Typography, {
|
|
62
|
+
variant: "body2",
|
|
63
|
+
children: sentence.text
|
|
64
|
+
})]
|
|
88
65
|
}, `conversation-${i}`);
|
|
89
66
|
}) : /*#__PURE__*/_jsx(Typography, {
|
|
90
67
|
variant: "body2",
|
package/dist/Editors/Bot/Bot.js
CHANGED
|
@@ -7,23 +7,22 @@ import { Slide, IconButton, Button, Dialog, AppBar, Toolbar, Typography } from "
|
|
|
7
7
|
import LightbulbIcon from "@mui/icons-material/Lightbulb";
|
|
8
8
|
import CloseIcon from "@mui/icons-material/Close";
|
|
9
9
|
import InfoOutlined from "@mui/icons-material/InfoOutlined";
|
|
10
|
-
import "codemirror/lib/codemirror.css";
|
|
11
|
-
import "codemirror/mode/markdown/markdown";
|
|
12
|
-
import Editor from "./Editor";
|
|
13
10
|
import { Tabs, Tab, Box, Tooltip } from "@mui/material";
|
|
14
11
|
import ArrowDropDownIcon from "@mui/icons-material/ArrowDropDown";
|
|
15
12
|
import ArrowDropUpIcon from "@mui/icons-material/ArrowDropUp";
|
|
16
13
|
import PlayCircleFilledIcon from "@mui/icons-material/PlayCircleFilled";
|
|
17
14
|
import Share from "@mui/icons-material/Share";
|
|
18
15
|
import Help from "@mui/icons-material/Help";
|
|
16
|
+
import RiveScript from "@nualang/rivescript";
|
|
19
17
|
import ResponsiveDialog from "../../Dialogs/ResponsiveDialog/ResponsiveDialog";
|
|
20
18
|
import ReactMarkdown from "react-markdown";
|
|
21
19
|
import BotNualaImage from "../../img/bot-error.svg";
|
|
22
20
|
|
|
23
21
|
// components
|
|
24
22
|
import Chat from "../../Chat/Chat";
|
|
25
|
-
import UpdateBot from "../../Forms/UpdateBot";
|
|
23
|
+
import UpdateBot from "../../Forms/UpdateBot/UpdateBot";
|
|
26
24
|
import Tutorial from "./Tutorial";
|
|
25
|
+
import Editor from "./Editor/Editor";
|
|
27
26
|
|
|
28
27
|
// utils
|
|
29
28
|
import { jsonToRivescript, rivescriptToJson } from "../../utils/index";
|
|
@@ -32,7 +31,7 @@ import useRecognition from "../../hooks/useRecognition";
|
|
|
32
31
|
import { botErrorMessage } from "../../utils/constants";
|
|
33
32
|
import useExerciseState from "../../hooks/useExerciseState";
|
|
34
33
|
import { randomId } from "../../utils/index";
|
|
35
|
-
|
|
34
|
+
|
|
36
35
|
// The RiveScript bot instance, on the window scope so it can be debugged.
|
|
37
36
|
window.rs = null;
|
|
38
37
|
import config from "../../config";
|
|
@@ -130,7 +129,7 @@ function Bot({
|
|
|
130
129
|
recognizing
|
|
131
130
|
} = recognitionState;
|
|
132
131
|
const [bot, setBot] = useState(initialValues);
|
|
133
|
-
const [isDynamicResponsesEnabled, setIsDynamicResponsesEnabled] = useState(
|
|
132
|
+
const [isDynamicResponsesEnabled, setIsDynamicResponsesEnabled] = useState("disable");
|
|
134
133
|
const languageInformation = config.languages[learnLang];
|
|
135
134
|
const languageTag = languageInformation.Code;
|
|
136
135
|
const exerciseState = useExerciseState({
|
|
@@ -197,7 +196,6 @@ function Bot({
|
|
|
197
196
|
const isSmallScreen = useMediaQuery(theme.breakpoints.down("md"));
|
|
198
197
|
const tabVariant = isSmallScreen ? "fullWidth" : null;
|
|
199
198
|
const [tabValue, setTabValue] = useState(0);
|
|
200
|
-
const [simplified, setSimplified] = useState(true);
|
|
201
199
|
const [disableInput, setDisableInput] = useState(true);
|
|
202
200
|
const {
|
|
203
201
|
voice
|
|
@@ -337,7 +335,7 @@ function Bot({
|
|
|
337
335
|
// Debounce botJSON so that it only gives us latest value ...
|
|
338
336
|
// ... if botJSON has not been updated within last 3000ms.
|
|
339
337
|
// The goal is to only have the bot flow chart fire when user stops typing ...
|
|
340
|
-
|
|
338
|
+
|
|
341
339
|
useEffect(() => {
|
|
342
340
|
if (!isSmallScreen && tabValue === 2) {
|
|
343
341
|
setTabValue(0);
|
|
@@ -598,9 +596,9 @@ function Bot({
|
|
|
598
596
|
topbarTitle: t(`preview`),
|
|
599
597
|
handleInputChange: handleInputChange,
|
|
600
598
|
inputName: "botText",
|
|
601
|
-
inputValue: isDynamicResponsesEnabled ===
|
|
599
|
+
inputValue: isDynamicResponsesEnabled === "enable" ? botText : text,
|
|
602
600
|
handleTranslate: handleTranslate,
|
|
603
|
-
handleSend: isDynamicResponsesEnabled ===
|
|
601
|
+
handleSend: isDynamicResponsesEnabled === "enable" ? handleSubmitBotMessage : handleSubmitText,
|
|
604
602
|
isListening: recognizing,
|
|
605
603
|
browserSupportsSpeechRecognition: browserSupportsSpeechRecognition,
|
|
606
604
|
handleRecord: browserSupportsSpeechRecognition && isBotRunning && learnLang !== "irish" ? () => handleMic() : null,
|
|
@@ -610,7 +608,7 @@ function Bot({
|
|
|
610
608
|
handleKeyPress: e => {
|
|
611
609
|
if (e.key === "Enter") {
|
|
612
610
|
e.preventDefault();
|
|
613
|
-
isDynamicResponsesEnabled ===
|
|
611
|
+
isDynamicResponsesEnabled === "enable" ? handleSubmitBotMessage() : handleSubmitText();
|
|
614
612
|
}
|
|
615
613
|
},
|
|
616
614
|
speak: speak,
|
|
@@ -618,8 +616,8 @@ function Bot({
|
|
|
618
616
|
isSpeaking: isSpeaking,
|
|
619
617
|
isSpeakingTextContainer: isSpeakingTextContainer,
|
|
620
618
|
voice: voice,
|
|
621
|
-
messages: isDynamicResponsesEnabled ===
|
|
622
|
-
setBotMessages: isDynamicResponsesEnabled ===
|
|
619
|
+
messages: isDynamicResponsesEnabled === "enable" ? botMessages : messages,
|
|
620
|
+
setBotMessages: isDynamicResponsesEnabled === "enable" ? setBotMessages : null,
|
|
623
621
|
disableInput: disableInput
|
|
624
622
|
});
|
|
625
623
|
const tabs = [{
|
|
@@ -747,19 +745,10 @@ function Bot({
|
|
|
747
745
|
t: t,
|
|
748
746
|
bot: bot,
|
|
749
747
|
botJSON: botJSON,
|
|
750
|
-
debouncedBotJSON: debouncedBotJSON || botJSON,
|
|
751
|
-
isBotRunning: isBotRunning,
|
|
752
|
-
handleInputChange: handleInputChange,
|
|
753
|
-
handleSaveBot: handleSaveBot,
|
|
754
|
-
isDirty: initialValues !== bot,
|
|
755
748
|
learnLangCharacters: learnLangCharacters,
|
|
756
749
|
handleBotJSONChange: handleBotJSONChange,
|
|
757
750
|
hidden: hidden,
|
|
758
|
-
handleTranslate: handleTranslate,
|
|
759
|
-
handleSpeak: handleSpeak,
|
|
760
751
|
handleUploadBotExerciseImage: handleUploadBotExerciseImage,
|
|
761
|
-
simplified: simplified,
|
|
762
|
-
setSimplified: setSimplified,
|
|
763
752
|
makeChatGptApiRequest: makeChatGptApiRequest,
|
|
764
753
|
handleUpdateBot: handleUpdateBot,
|
|
765
754
|
generateRiveFile: generateRiveFile,
|
|
@@ -40,12 +40,10 @@ function AlternativesList({
|
|
|
40
40
|
classes,
|
|
41
41
|
isCourseCreator,
|
|
42
42
|
alternatives,
|
|
43
|
-
handleOpenAlternativesModal,
|
|
44
43
|
handleRemoveAlternatives,
|
|
45
44
|
handleUpdateAlternatives,
|
|
46
45
|
showModal,
|
|
47
|
-
handleSelectCurrentInput
|
|
48
|
-
simplified
|
|
46
|
+
handleSelectCurrentInput
|
|
49
47
|
}) {
|
|
50
48
|
const [open, setOpen] = useState(false);
|
|
51
49
|
const handleClick = () => {
|
|
@@ -75,21 +73,11 @@ function AlternativesList({
|
|
|
75
73
|
primary: t("alternatives"),
|
|
76
74
|
secondary: t("alternatives_desc")
|
|
77
75
|
}), open ? /*#__PURE__*/_jsx(ExpandLess, {}) : /*#__PURE__*/_jsx(ExpandMore, {})]
|
|
78
|
-
}), /*#__PURE__*/
|
|
76
|
+
}), /*#__PURE__*/_jsx(Collapse, {
|
|
79
77
|
in: open,
|
|
80
78
|
timeout: "auto",
|
|
81
79
|
unmountOnExit: true,
|
|
82
|
-
children:
|
|
83
|
-
className: classes.nested,
|
|
84
|
-
onClick: handleOpenAlternativesModal,
|
|
85
|
-
children: [/*#__PURE__*/_jsx(ListItemIcon, {
|
|
86
|
-
children: /*#__PURE__*/_jsx(Add, {
|
|
87
|
-
className: classes.greenColor
|
|
88
|
-
})
|
|
89
|
-
}), /*#__PURE__*/_jsx(ListItemText, {
|
|
90
|
-
primary: t("add_new")
|
|
91
|
-
})]
|
|
92
|
-
}), alternativesList]
|
|
80
|
+
children: alternativesList
|
|
93
81
|
})]
|
|
94
82
|
});
|
|
95
83
|
}
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import PropTypes from "prop-types";
|
|
2
2
|
import { withStyles } from "tss-react/mui";
|
|
3
3
|
import VarList from "./VarList";
|
|
4
|
-
import SubList from "./SubList";
|
|
5
4
|
import AlternativesList from "./AlternativesList";
|
|
6
|
-
import TopicList from "./TopicList";
|
|
7
5
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
8
6
|
const styles = theme => ({
|
|
9
7
|
nested: {
|
|
@@ -32,37 +30,13 @@ function BotDesigner(props) {
|
|
|
32
30
|
rivescriptJSON,
|
|
33
31
|
learnLangCharacters,
|
|
34
32
|
handleSelectCurrentInput,
|
|
35
|
-
handleOpenVariableModal,
|
|
36
|
-
handleRemoveVariable,
|
|
37
|
-
handleUpdateVariable,
|
|
38
|
-
handleAddVariable,
|
|
39
|
-
handleOpenSubstitutionModal,
|
|
40
|
-
handleRemoveSubstitution,
|
|
41
|
-
handleUpdateSubstitution,
|
|
42
|
-
handleAddSubstitution,
|
|
43
|
-
handleOpenAlternativesModal,
|
|
44
33
|
handleUpdateAlternatives,
|
|
45
|
-
|
|
46
|
-
handleRemoveTopic,
|
|
47
|
-
handleUpdateTopic,
|
|
48
|
-
handleAddTopic,
|
|
49
|
-
handleOpenTriggerModal,
|
|
50
|
-
handleRemoveTrigger,
|
|
51
|
-
handleUpdateTrigger,
|
|
52
|
-
handleAddTrigger,
|
|
53
|
-
handleUpdateTriggerReply,
|
|
54
|
-
setTopicName,
|
|
55
|
-
triggerAndReplyRefs,
|
|
56
|
-
selectedNode,
|
|
57
|
-
topicsRef,
|
|
58
|
-
handleVariableSubmit,
|
|
34
|
+
handleUpdateVariable,
|
|
59
35
|
botName,
|
|
60
36
|
handleUpdateAllVariables,
|
|
61
37
|
handleUploadBotExerciseImage,
|
|
62
38
|
botId,
|
|
63
|
-
|
|
64
|
-
handleOnBlur,
|
|
65
|
-
verificationStatus
|
|
39
|
+
handleOnBlur
|
|
66
40
|
} = props;
|
|
67
41
|
return /*#__PURE__*/_jsxs(_Fragment, {
|
|
68
42
|
children: [rivescriptJSON && rivescriptJSON.begin.var && /*#__PURE__*/_jsx(VarList, {
|
|
@@ -71,57 +45,18 @@ function BotDesigner(props) {
|
|
|
71
45
|
vars: rivescriptJSON.begin.var,
|
|
72
46
|
classes: classes,
|
|
73
47
|
botName: botName,
|
|
74
|
-
learnLangCharacters: learnLangCharacters,
|
|
75
|
-
handleOpenVariableModal: handleOpenVariableModal,
|
|
76
|
-
handleRemoveVariable: handleRemoveVariable,
|
|
77
|
-
handleUpdateVariable: handleUpdateVariable,
|
|
78
|
-
handleAddVariable: handleAddVariable,
|
|
79
48
|
handleSelectCurrentInput: handleSelectCurrentInput,
|
|
80
|
-
handleVariableSubmit: handleVariableSubmit,
|
|
81
49
|
handleUploadBotExerciseImage: handleUploadBotExerciseImage,
|
|
82
50
|
botId: botId,
|
|
83
|
-
simplified: simplified,
|
|
84
51
|
handleOnBlur: handleOnBlur,
|
|
85
|
-
|
|
86
|
-
}), rivescriptJSON && rivescriptJSON.begin.sub && !simplified && /*#__PURE__*/_jsx(SubList, {
|
|
87
|
-
t: t,
|
|
88
|
-
subs: rivescriptJSON.begin.sub,
|
|
89
|
-
classes: classes,
|
|
90
|
-
learnLangCharacters: learnLangCharacters,
|
|
91
|
-
handleOpenSubstitutionModal: handleOpenSubstitutionModal,
|
|
92
|
-
handleRemoveSubstitution: handleRemoveSubstitution,
|
|
93
|
-
handleUpdateSubstitution: handleUpdateSubstitution,
|
|
94
|
-
handleAddSubstitution: handleAddSubstitution,
|
|
95
|
-
handleSelectCurrentInput: handleSelectCurrentInput
|
|
52
|
+
handleUpdateVariable: handleUpdateVariable
|
|
96
53
|
}), rivescriptJSON && rivescriptJSON.begin.array && /*#__PURE__*/_jsx(AlternativesList, {
|
|
97
54
|
t: t,
|
|
98
55
|
alternatives: rivescriptJSON.begin.array,
|
|
99
56
|
classes: classes,
|
|
100
57
|
learnLangCharacters: learnLangCharacters,
|
|
101
|
-
handleOpenAlternativesModal: handleOpenAlternativesModal,
|
|
102
58
|
handleUpdateAlternatives: handleUpdateAlternatives,
|
|
103
|
-
handleSelectCurrentInput: handleSelectCurrentInput
|
|
104
|
-
simplified: simplified
|
|
105
|
-
}), rivescriptJSON && !simplified && /*#__PURE__*/_jsx(TopicList, {
|
|
106
|
-
t: t,
|
|
107
|
-
topics: rivescriptJSON.topics,
|
|
108
|
-
vars: rivescriptJSON.begin.var,
|
|
109
|
-
classes: classes,
|
|
110
|
-
learnLangCharacters: learnLangCharacters,
|
|
111
|
-
handleOpenTopicModal: handleOpenTopicModal,
|
|
112
|
-
handleRemoveTopic: handleRemoveTopic,
|
|
113
|
-
handleUpdateTopic: handleUpdateTopic,
|
|
114
|
-
handleAddTopic: handleAddTopic,
|
|
115
|
-
handleRemoveTrigger: handleRemoveTrigger,
|
|
116
|
-
handleUpdateTrigger: handleUpdateTrigger,
|
|
117
|
-
handleOpenTriggerModal: handleOpenTriggerModal,
|
|
118
|
-
handleAddTrigger: handleAddTrigger,
|
|
119
|
-
handleUpdateTriggerReply: handleUpdateTriggerReply,
|
|
120
|
-
handleSelectCurrentInput: handleSelectCurrentInput,
|
|
121
|
-
setTopicName: setTopicName,
|
|
122
|
-
triggerAndReplyRefs: triggerAndReplyRefs,
|
|
123
|
-
selectedNode: selectedNode,
|
|
124
|
-
topicsRef: topicsRef
|
|
59
|
+
handleSelectCurrentInput: handleSelectCurrentInput
|
|
125
60
|
})]
|
|
126
61
|
});
|
|
127
62
|
}
|