@nualang/nualang-ui-components 0.1.1268 → 0.1.1270

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.
@@ -45,7 +45,7 @@ function OverflowMenu({
45
45
  keepMounted: true,
46
46
  open: Boolean(anchorEl),
47
47
  onClose: handleClose,
48
- children: [isCreator && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.MenuItem, {
48
+ children: [isCreator && !isMember && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.MenuItem, {
49
49
  onClick: handleClickOpenMembers,
50
50
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_CardElements.CardMenuIcon, {
51
51
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Group.default, {
@@ -64,7 +64,7 @@ function OverflowMenu({
64
64
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
65
65
  children: t("join_classroom")
66
66
  })]
67
- }), !isCreator && isMember && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.MenuItem, {
67
+ }), isMember && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.MenuItem, {
68
68
  onClick: leaveClassroom,
69
69
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_CardElements.CardMenuIcon, {
70
70
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_ExitToApp.default, {
@@ -44,6 +44,8 @@ function OverflowMenu({
44
44
  handleClose,
45
45
  handleClickOpenMembers,
46
46
  isCreator,
47
+ isClassroomCreator,
48
+ isTeacher,
47
49
  isMember,
48
50
  startCourse,
49
51
  leaveCourse,
@@ -56,8 +58,7 @@ function OverflowMenu({
56
58
  classroomId,
57
59
  isClassroomArchived = false,
58
60
  canDuplicateCourse,
59
- hiddenCourses = [],
60
- isTeacher
61
+ hiddenCourses = []
61
62
  }) {
62
63
  return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Menu, {
63
64
  id: `card-menu-${courseId}`,
@@ -92,7 +93,7 @@ function OverflowMenu({
92
93
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
93
94
  children: t("leave_course")
94
95
  })]
95
- }), isCreator && classroomId && !isClassroomArchived && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.MenuItem, {
96
+ }), isClassroomCreator && classroomId && !isClassroomArchived && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.MenuItem, {
96
97
  onClick: () => {
97
98
  localStorage.setItem("focusCourseSettings", true);
98
99
  window.location.hash = "Settings";
@@ -104,7 +105,7 @@ function OverflowMenu({
104
105
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
105
106
  children: t("change_settings")
106
107
  })]
107
- }), !isClassroomArchived && isTeacher && /*#__PURE__*/(0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {
108
+ }), !isClassroomArchived && isTeacher && (isCreator || isMember) && /*#__PURE__*/(0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {
108
109
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Tooltip, {
109
110
  title: !canDuplicateCourse ? t("duplicate_disabled_tooltip") : "",
110
111
  disableHoverListener: canDuplicateCourse,
@@ -125,7 +126,7 @@ function OverflowMenu({
125
126
  })
126
127
  })
127
128
  })
128
- }), handleHideCourse && !hiddenCourses.includes(courseId) && !isClassroomArchived && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.MenuItem, {
129
+ }), isClassroomCreator && handleHideCourse && !hiddenCourses.includes(courseId) && !isClassroomArchived && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.MenuItem, {
129
130
  onClick: () => handleHideCourse(courseId),
130
131
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_CardElements.CardMenuIcon, {
131
132
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_VisibilityOff.default, {
@@ -134,7 +135,7 @@ function OverflowMenu({
134
135
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
135
136
  children: t("hide_from_students")
136
137
  })]
137
- }), handleUnhideCourse && hiddenCourses.includes(courseId) && !isClassroomArchived && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.MenuItem, {
138
+ }), isClassroomCreator && handleUnhideCourse && hiddenCourses.includes(courseId) && !isClassroomArchived && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.MenuItem, {
138
139
  onClick: () => handleUnhideCourse(courseId),
139
140
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_CardElements.CardMenuIcon, {
140
141
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Visibility.default, {
@@ -143,7 +144,7 @@ function OverflowMenu({
143
144
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
144
145
  children: t("show_to_students")
145
146
  })]
146
- }), handleRemoveCourse && !isClassroomArchived && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.MenuItem, {
147
+ }), isClassroomCreator && handleRemoveCourse && !isClassroomArchived && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.MenuItem, {
147
148
  onClick: () => handleRemoveCourse(courseId),
148
149
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_CardElements.CardMenuIcon, {
149
150
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Close.default, {
@@ -245,7 +246,8 @@ function CourseCard({
245
246
  isClassroomArchived = false,
246
247
  email,
247
248
  isTeacher,
248
- hiddenCourses = []
249
+ hiddenCourses = [],
250
+ isClassroomCreator = null
249
251
  }) {
250
252
  const [placeholderRef, visible] = (0, _reactIntersectionObserver.useInView)({
251
253
  rootMargin: "320px",
@@ -372,7 +374,7 @@ function CourseCard({
372
374
  highQualitySrc: visible || !pictureXs ? cardPicture || picture || _index.default.course : null,
373
375
  lowQualitySrc: pictureXs,
374
376
  placeholderRef: placeholderRef
375
- }), isCreator && /*#__PURE__*/(0, _jsxRuntime.jsx)(_CardElements.CardVisibility, {
377
+ }), (isClassroomCreator ?? isCreator) && /*#__PURE__*/(0, _jsxRuntime.jsx)(_CardElements.CardVisibility, {
376
378
  t: t,
377
379
  visibility: visibility,
378
380
  isCourseHidden: isCourseHidden
@@ -504,7 +506,7 @@ function CourseCard({
504
506
  disabled: checked,
505
507
  "aria-label": "Select Course",
506
508
  children: checked ? t("selected") : t("select")
507
- }), isCreator && !selectable && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
509
+ }), isCreator && !isMember && !selectable && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
508
510
  children: [!isClassroomArchived && /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Button, {
509
511
  onClick: viewCourse,
510
512
  color: "primary",
@@ -558,6 +560,7 @@ function CourseCard({
558
560
  handleClose: handleCloseMenu,
559
561
  handleClickOpenMembers: handleClickOpenMembers,
560
562
  isCreator: isCreator,
563
+ isClassroomCreator: isClassroomCreator,
561
564
  isMember: isMember,
562
565
  isAdmin: isAdmin,
563
566
  viewCourse: viewCourse,
@@ -579,7 +582,7 @@ function CourseCard({
579
582
  dialogTitle: courseName,
580
583
  open: isMembersOpen,
581
584
  handleClose: handleCloseMembers,
582
- isCreator: isCreator,
585
+ isCreator: isClassroomCreator ?? isCreator,
583
586
  isCourseMember: true,
584
587
  members: membersQuery.isSuccess ? membersQuery.data.Items : [],
585
588
  ...membersProps
@@ -274,7 +274,7 @@ function CreateQuestion({
274
274
  })
275
275
  })]
276
276
  })
277
- }, `${idx}-${a.text}`))
277
+ }, idx))
278
278
  })
279
279
  })]
280
280
  });
@@ -61,7 +61,24 @@ function ExerciseMenu({
61
61
  }
62
62
  return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
63
63
  className: classes.buttonStyle,
64
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Button, {
64
+ children: dataCypress === "view_report" && disabled ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Tooltip, {
65
+ placement: "right",
66
+ title: "Reports are not available during assignments. You can review your attempts in the Progress tab.",
67
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
68
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Button, {
69
+ ref: ref => {
70
+ buttonRefs[i].current = ref;
71
+ },
72
+ "data-cy": dataCypress,
73
+ variant: variant,
74
+ color: color,
75
+ onClick: onClick,
76
+ disabled: disabled,
77
+ fullWidth: true,
78
+ children: text
79
+ })
80
+ })
81
+ }) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Button, {
65
82
  ref: ref => {
66
83
  buttonRefs[i].current = ref;
67
84
  },
@@ -47,7 +47,7 @@ function CompletedExerciseMenu({
47
47
  variant: "outlined",
48
48
  color: "primary",
49
49
  onClick: viewReport,
50
- disabled: disableViewReport
50
+ disabled: disableViewReport || assignmentId
51
51
  }, ...(assignmentId ? [{
52
52
  dataCypress: "go_back_to_assignments",
53
53
  text: t("go_back_to_assignments"),
@@ -33,6 +33,7 @@ var _useRecognition = _interopRequireDefault(require("../../hooks/useRecognition
33
33
  var _constants = require("../../utils/constants");
34
34
  var _useExerciseState = _interopRequireDefault(require("../../hooks/useExerciseState"));
35
35
  var _rivescript = _interopRequireDefault(require("rivescript"));
36
+ var _config = _interopRequireDefault(require("../../config"));
36
37
  var _jsxRuntime = require("react/jsx-runtime");
37
38
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
38
39
  function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
@@ -117,7 +118,8 @@ function Bot({
117
118
  topicId,
118
119
  initialTopicGoal,
119
120
  isUserInternal,
120
- verificationStatus
121
+ verificationStatus,
122
+ handleMessageBot
121
123
  }) {
122
124
  const {
123
125
  recognitionState,
@@ -133,19 +135,36 @@ function Bot({
133
135
  finalTranscript,
134
136
  recognizing
135
137
  } = recognitionState;
138
+ const [bot, setBot] = (0, _react.useState)(initialValues);
139
+ const [isDynamicResponsesEnabled, setIsDynamicResponsesEnabled] = (0, _react.useState)('disable');
140
+ const languageInformation = _config.default.languages[learnLang];
141
+ const languageTag = languageInformation.Code;
136
142
  const exerciseState = (0, _useExerciseState.default)({
137
143
  t,
138
144
  open: false,
139
145
  handleClose,
140
146
  handleSpeak,
141
147
  handleStopSpeaking,
142
- learnLang
148
+ learnLang,
149
+ isDynamicResponsesEnabled,
150
+ isUserInternal,
151
+ resetTranscript,
152
+ openSnackbar,
153
+ bot,
154
+ aiChatbotConversationHistory: [],
155
+ handleMessageBot
143
156
  });
144
157
  const {
145
158
  speak,
146
159
  stopSpeaking,
147
160
  isSpeaking,
148
- isSpeakingTextContainer
161
+ isSpeakingTextContainer,
162
+ handleSubmitBotMessage,
163
+ botMessages,
164
+ setBotMessages,
165
+ setBotText,
166
+ botText,
167
+ resetConversationHistory
149
168
  } = exerciseState;
150
169
  const handleMic = () => {
151
170
  const {
@@ -175,7 +194,6 @@ function Bot({
175
194
  classes
176
195
  } = useStyles();
177
196
  const [text, setText] = (0, _react.useState)("");
178
- const [bot, setBot] = (0, _react.useState)(initialValues);
179
197
  const [botJSON, setBotJSON] = (0, _react.useState)(null);
180
198
  const [debug] = (0, _react.useState)(false);
181
199
  const [utf8] = (0, _react.useState)(true);
@@ -186,6 +204,7 @@ function Bot({
186
204
  const tabVariant = isSmallScreen ? "fullWidth" : null;
187
205
  const [tabValue, setTabValue] = (0, _react.useState)(0);
188
206
  const [simplified, setSimplified] = (0, _react.useState)(initialValues.editorMode === "advanced" ? false : true);
207
+ const [disableInput, setDisableInput] = (0, _react.useState)(true);
189
208
  const {
190
209
  voice
191
210
  } = bot;
@@ -269,6 +288,15 @@ function Bot({
269
288
  setText(`${interimTranscript}${finalTranscript}`);
270
289
  }
271
290
  }, [isBotRunning, finalTranscript]);
291
+ (0, _react.useEffect)(() => {
292
+ if (open) {
293
+ if (finalTranscript || interimTranscript) {
294
+ setBotText(`${finalTranscript || ""} ${interimTranscript || ""}`);
295
+ } else if (botText !== "") {
296
+ setBotText("");
297
+ }
298
+ }
299
+ }, [open, finalTranscript, interimTranscript]);
272
300
  (0, _react.useEffect)(() => {
273
301
  if (!open && isBotRunning) {
274
302
  teardownBot();
@@ -294,6 +322,9 @@ function Bot({
294
322
  }
295
323
  setTabValue(newValue);
296
324
  };
325
+ (0, _react.useEffect)(() => {
326
+ setIsDynamicResponsesEnabled(bot?.isDynamicResponsesEnabled);
327
+ }, [bot]);
297
328
 
298
329
  // Debounce rivefile so that it only gives us latest value ...
299
330
  // ... if rivefile has not been updated within last 3000ms.
@@ -339,6 +370,13 @@ function Bot({
339
370
  setMessages([]);
340
371
  }
341
372
  }, [isBotRunning]);
373
+ (0, _react.useEffect)(() => {
374
+ if (isBotRunning) {
375
+ setDisableInput(false);
376
+ } else {
377
+ setDisableInput(true);
378
+ }
379
+ }, [isBotRunning]);
342
380
  const onError = error => {
343
381
  if (error.includes(`Invalid format for !Definition line: must be '! type name = value' OR '! type = value' at stream()`)) {
344
382
  openSnackbar("Syntax Error: Text field cannot be empty", "error");
@@ -408,8 +446,9 @@ function Bot({
408
446
  const target = event.target;
409
447
  const value = target.type === "checkbox" ? target.checked : target.value;
410
448
  const name = target.name;
411
- if (name === "text") {
449
+ if (name === "botText") {
412
450
  setText(value);
451
+ setBotText(value);
413
452
  }
414
453
  if (name === "riveFile") {
415
454
  setBot(prevState => ({
@@ -422,6 +461,8 @@ function Bot({
422
461
  const handleReset = () => {
423
462
  stopListening();
424
463
  resetTranscript();
464
+ setBotMessages([]);
465
+ resetConversationHistory();
425
466
  };
426
467
  const updateRivescriptJSON = rs => {
427
468
  const riveFileJSON = (0, _index.rivescriptToJson)(rs, {
@@ -556,16 +597,16 @@ function Bot({
556
597
  })
557
598
  });
558
599
  const BotPreview = /*#__PURE__*/(0, _jsxRuntime.jsx)(_Chat.default, {
600
+ languageTag: languageTag,
559
601
  t: t,
560
602
  translationEnabled: translationEnabled,
561
603
  topBarActions: topBarActions,
562
- messages: messages,
563
604
  topbarTitle: t(`preview`),
564
605
  handleInputChange: handleInputChange,
565
- inputName: "text",
566
- inputValue: text,
606
+ inputName: "botText",
607
+ inputValue: isDynamicResponsesEnabled === 'enable' ? botText : text,
567
608
  handleTranslate: handleTranslate,
568
- handleSend: handleSubmitText,
609
+ handleSend: isDynamicResponsesEnabled === 'enable' ? handleSubmitBotMessage : handleSubmitText,
569
610
  isListening: recognizing,
570
611
  browserSupportsSpeechRecognition: browserSupportsSpeechRecognition,
571
612
  handleRecord: browserSupportsSpeechRecognition && isBotRunning && learnLang !== "irish" ? () => handleMic() : null,
@@ -575,14 +616,17 @@ function Bot({
575
616
  handleKeyPress: e => {
576
617
  if (e.key === "Enter") {
577
618
  e.preventDefault();
578
- handleSubmitText();
619
+ isDynamicResponsesEnabled === 'enable' ? handleSubmitBotMessage() : handleSubmitText();
579
620
  }
580
621
  },
581
622
  speak: speak,
582
623
  stopSpeaking: stopSpeaking,
583
624
  isSpeaking: isSpeaking,
584
625
  isSpeakingTextContainer: isSpeakingTextContainer,
585
- voice: voice
626
+ voice: voice,
627
+ messages: isDynamicResponsesEnabled === 'enable' ? botMessages : messages,
628
+ setBotMessages: isDynamicResponsesEnabled === 'enable' ? setBotMessages : null,
629
+ disableInput: disableInput
586
630
  });
587
631
  const tabs = [{
588
632
  label: t("editor")
@@ -5,10 +5,12 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.default = void 0;
7
7
  var _material = require("@mui/material");
8
+ var _Help = _interopRequireDefault(require("@mui/icons-material/Help"));
8
9
  var _mui = require("tss-react/mui");
9
10
  var Yup = _interopRequireWildcard(require("yup"));
10
11
  var _jsxRuntime = require("react/jsx-runtime");
11
12
  function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
13
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
12
14
  const useStyles = (0, _mui.makeStyles)()(() => ({
13
15
  group: {
14
16
  flexDirection: "row"
@@ -146,9 +148,21 @@ function BotSettings({
146
148
  size: 12,
147
149
  children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.FormControl, {
148
150
  component: "fieldset",
149
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.FormLabel, {
151
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.FormLabel, {
150
152
  component: "legend",
151
- children: t("dynamic_response")
153
+ children: [t("dynamic_response"), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Tooltip, {
154
+ title: t("dynamic_responses_info"),
155
+ placement: "right",
156
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.IconButton, {
157
+ sx: {
158
+ padding: 0,
159
+ marginLeft: 1
160
+ },
161
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Help.default, {
162
+ fontSize: "small"
163
+ })
164
+ })
165
+ })]
152
166
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
153
167
  color: "textSecondary",
154
168
  children: t("dynamic_response_desc")
@@ -8,6 +8,7 @@ var _react = require("react");
8
8
  var _material = require("@mui/material");
9
9
  var _ExpandMore = _interopRequireDefault(require("@mui/icons-material/ExpandMore"));
10
10
  var _ExpandLess = _interopRequireDefault(require("@mui/icons-material/ExpandLess"));
11
+ var _Help = _interopRequireDefault(require("@mui/icons-material/Help"));
11
12
  var _jsxRuntime = require("react/jsx-runtime");
12
13
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
13
14
  function Settings({
@@ -177,9 +178,21 @@ function Settings({
177
178
  },
178
179
  children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.FormControl, {
179
180
  component: "fieldset",
180
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.FormLabel, {
181
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.FormLabel, {
181
182
  component: "legend",
182
- children: t("dynamic_response")
183
+ children: [t("dynamic_response"), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Tooltip, {
184
+ title: t("dynamic_responses_info"),
185
+ placement: "right",
186
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.IconButton, {
187
+ sx: {
188
+ padding: 0,
189
+ marginLeft: 1
190
+ },
191
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Help.default, {
192
+ fontSize: "small"
193
+ })
194
+ })
195
+ })]
183
196
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
184
197
  color: "textSecondary",
185
198
  children: t("dynamic_response_desc")
@@ -894,7 +894,8 @@ function Classroom({
894
894
  isClassroomArchived: isArchived,
895
895
  hiddenCourses: hiddenCourses,
896
896
  email: email,
897
- isTeacher: isTeacher
897
+ isTeacher: isTeacher,
898
+ isClassroomCreator: isCreator
898
899
  }) : /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
899
900
  id: "add-courses-fab",
900
901
  children: isCreator ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_ClassCourses.default, {
@@ -1554,6 +1554,10 @@ function useExerciseState({
1554
1554
  lng: langCode
1555
1555
  });
1556
1556
  };
1557
+ const resetConversationHistory = () => {
1558
+ setConversationHistory([]);
1559
+ setIsFirstMessage(true);
1560
+ };
1557
1561
  const handleSubmitBotMessage = async () => {
1558
1562
  try {
1559
1563
  const method = `${finalTranscript || ""} ${interimTranscript || ""}`.trim() === botText.trim() ? "voice" : "text";
@@ -1608,19 +1612,27 @@ function useExerciseState({
1608
1612
  const viewReport = () => {
1609
1613
  handleClose();
1610
1614
  if (exerciseName === "bot") {
1611
- if (courseId && sectionId && topicId) {
1615
+ if (classroomId && courseId && sectionId && topicId) {
1616
+ navigate(`/classrooms/${classroomId}/${courseId}/${sectionId}/${topicId}/activity/${exerciseName}?botId=${bot.botId}`);
1617
+ } else if (courseId && sectionId && topicId) {
1612
1618
  navigate(`/courses/${courseId}/${sectionId}/${topicId}/activity/${exerciseName}?botId=${bot.botId}`);
1613
1619
  } else if (bot.botId) {
1614
1620
  navigate(`/bots/${bot.botId}/activity`);
1615
1621
  }
1616
1622
  } else if (exerciseName === "roleplay") {
1617
- if (courseId && sectionId && topicId) {
1623
+ if (classroomId && courseId && sectionId && topicId) {
1624
+ navigate(`/classrooms/${classroomId}/${courseId}/${sectionId}/${topicId}/activity/${exerciseName}?roleplayId=${roleplay.roleplayId}`);
1625
+ } else if (courseId && sectionId && topicId) {
1618
1626
  navigate(`/courses/${courseId}/${sectionId}/${topicId}/activity/${exerciseName}?roleplayId=${roleplay.roleplayId}`);
1619
1627
  } else if (roleplay.roleplayId) {
1620
1628
  navigate(`/roleplays/${roleplay.roleplayId}/activity/${roleplay.createdBy}/${roleplayCreatedAtId}`);
1621
1629
  }
1622
1630
  } else {
1623
- navigate(`/courses/${courseId}/${sectionId}/${topicId}/activity/${exerciseName}`);
1631
+ if (classroomId) {
1632
+ navigate(`/classrooms/${classroomId}/${courseId}/${sectionId}/${topicId}/activity/${exerciseName}`);
1633
+ } else {
1634
+ navigate(`/courses/${courseId}/${sectionId}/${topicId}/activity/${exerciseName}`);
1635
+ }
1624
1636
  }
1625
1637
  };
1626
1638
  const handleCloseClicked = () => {
@@ -2047,6 +2059,7 @@ function useExerciseState({
2047
2059
  setIsWordBankAttemptChanged,
2048
2060
  isKeyboardHidden,
2049
2061
  setWordOptions,
2050
- setIsAssignmentExercise
2062
+ setIsAssignmentExercise,
2063
+ resetConversationHistory
2051
2064
  };
2052
2065
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nualang/nualang-ui-components",
3
- "version": "0.1.1268",
3
+ "version": "0.1.1270",
4
4
  "main": "dist/index.js",
5
5
  "files": [
6
6
  "dist",