@nualang/nualang-ui-components 0.1.1261 → 0.1.1262

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.
@@ -616,6 +616,7 @@ function Topic({
616
616
  }), useCase === "assignment-select" && /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.ListItemIcon, {
617
617
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Checkbox, {
618
618
  checked: selectedCount === totalCount,
619
+ indeterminate: selectedCount > 0 && selectedCount < totalCount,
619
620
  onClick: event => {
620
621
  event.stopPropagation();
621
622
  },
@@ -91,9 +91,7 @@ function Roleplay({
91
91
  assignment,
92
92
  memberCourseCompletions,
93
93
  topicProgress,
94
- isCreator,
95
- lastClickedExerciseId,
96
- topics
94
+ lastClickedExerciseId
97
95
  }) {
98
96
  const navigate = (0, _reactRouterDom.useNavigate)();
99
97
  const params = (0, _reactRouterDom.useParams)();
@@ -101,8 +99,9 @@ function Roleplay({
101
99
  classroomId
102
100
  } = params;
103
101
  const [selectedGames, setSelectedGames] = (0, _react.useState)([]);
102
+ const [indeterminate, setIndeterminate] = (0, _react.useState)(false);
104
103
  const [courseId, sectionId, topicId] = courseSectionTopicId ? courseSectionTopicId.split("|") : "";
105
- const [lasClickedCourseId, lasClickedSectionId, lasClickedTopicId, lastClickedAssignmentId, lastClickedRoleplayId] = lastClickedExerciseId?.split("|") || [];
104
+ const [lastClickedAssignmentId, lastClickedRoleplayId] = lastClickedExerciseId?.split("|") || [];
106
105
  const addSearchParams = exercise => {
107
106
  if (!classroomId || !courseId || !sectionId || !topicId || !roleplay?.roleplayId) {
108
107
  console.error("Missing required parameters for navigation");
@@ -118,8 +117,9 @@ function Roleplay({
118
117
  const games = ["roleplay-story", "roleplay-fill-in-the-blanks", "roleplay-act-it-out", "roleplay-act-it-out-listening", "roleplay-act-it-out-speaking", "roleplay-act-it-out-listening-speaking"];
119
118
  const [isSelectAllChecked, setIsSelectAllChecked] = (0, _react.useState)(false);
120
119
  (0, _react.useEffect)(() => {
121
- const count = selectedExercises?.filter(exercise => exercise.roleplayId === roleplay.roleplayId).length;
120
+ const count = selectedExercises?.filter(exercise => exercise.roleplayId === roleplay.roleplayId).length || 0;
122
121
  setIsSelectAllChecked(count === games.length);
122
+ setIndeterminate(count > 0 && count < games.length);
123
123
  const roleplayNames = selectedExercises?.filter(ex => ex.roleplayId === roleplay.roleplayId).map(ex => ex.name);
124
124
  setSelectedGames(roleplayNames);
125
125
  }, [selectedExercises, roleplay.roleplayId]);
@@ -130,6 +130,8 @@ function Roleplay({
130
130
  name: name
131
131
  }));
132
132
  handleSelectExercise(removeExercises);
133
+ setIsSelectAllChecked(false);
134
+ setIndeterminate(false);
133
135
  } else {
134
136
  let gamesToAdd = [];
135
137
  games.forEach(name => {
@@ -143,6 +145,8 @@ function Roleplay({
143
145
  }
144
146
  });
145
147
  handleSelectExercise(gamesToAdd);
148
+ setIsSelectAllChecked(true);
149
+ setIndeterminate(false);
146
150
  }
147
151
  };
148
152
  const isRoleplayEmpty = roleplay?.script?.length === 0 || !roleplay?.script?.some(line => line.text !== undefined);
@@ -271,6 +275,7 @@ function Roleplay({
271
275
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.ListItemIcon, {
272
276
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Checkbox, {
273
277
  checked: isSelectAllChecked,
278
+ indeterminate: indeterminate,
274
279
  onChange: handleSelectAll,
275
280
  onClick: event => {
276
281
  event.stopPropagation();
@@ -77,6 +77,7 @@ function CreateAssignmentDialog({
77
77
  exercises: submittedExercises,
78
78
  ...initialData
79
79
  });
80
+ const [isTitleEdited, setIsTitleEdited] = (0, _react.useState)(Boolean(initialData.title));
80
81
  const classroomQuery = useQueries({
81
82
  queries: (Array.isArray(assignment.classroomId) ? assignment.classroomId : [assignment.classroomId]).map(cId => ({
82
83
  queryKey: _Queries.classrooms.classroomKeys.item(cId, username),
@@ -176,20 +177,26 @@ function CreateAssignmentDialog({
176
177
  }, [coursesQuery.data, coursesQuery.isSuccess, classrooms, assignment.classroomId]);
177
178
  (0, _react.useEffect)(() => {
178
179
  let filteredCourses = selectedCourses.filter(course => submittedExercises.some(exercise => exercise.courseSectionTopicId?.split("|")[0] === course.courseId));
179
- setAssignment({
180
- ...assignment,
180
+ setAssignment(prev => ({
181
+ ...prev,
181
182
  courses: filteredCourses
182
- });
183
+ }));
183
184
  const selectedTopicIds = new Set(submittedExercises.map(ex => ex.courseSectionTopicId));
184
185
  const topicNames = Array.from(new Set(filteredCourses.flatMap(course => course.sections?.flatMap(section => section.topics?.flatMap(topic => {
185
186
  const topicKey = `${course.courseId}|${section.sectionId}|${topic.topicId}`;
186
187
  return selectedTopicIds.has(topicKey) ? topic.topicName : [];
187
188
  }))).filter(Boolean)));
188
- setAssignment(prev => ({
189
- ...prev,
190
- title: topicNames.length ? topicNames.join(", ") : undefined
191
- }));
192
- }, [selectedCourses, submittedExercises]);
189
+ setAssignment(prev => {
190
+ const newTitle = topicNames.length ? topicNames.join(", ") : undefined;
191
+ if (isTitleEdited && prev.title) {
192
+ return prev;
193
+ }
194
+ return {
195
+ ...prev,
196
+ title: newTitle
197
+ };
198
+ });
199
+ }, [selectedCourses, submittedExercises, isTitleEdited]);
193
200
  const classroomMembers = async uniqueClassroomMembers => {
194
201
  const formattedMembers = await getMemberDetails(uniqueClassroomMembers);
195
202
  setMembers(formattedMembers);
@@ -221,31 +228,36 @@ function CreateAssignmentDialog({
221
228
  };
222
229
  const handleChange = field => event => {
223
230
  let value = event?.target?.value ?? event;
224
- setAssignment(prev => {
225
- if (field === "assignedStudents") {
226
- return {
227
- ...prev,
228
- assignedStudents: typeof value === "string" ? value.split(",") : value
229
- };
230
- }
231
- if (field === "classroomId") {
232
- return {
233
- ...prev,
234
- classroomId: typeof value === "string" ? value.split(",") : value
235
- };
236
- }
237
- if (field === "classroom") {
238
- return {
239
- ...prev,
240
- classroomId: value,
241
- assignedStudents: []
242
- };
231
+ if (field === "title") {
232
+ setIsTitleEdited(true);
233
+ }
234
+ if (field === "assignedStudents") {
235
+ if (value.includes("select-all")) {
236
+ const allSelected = assignment.assignedStudents.length === members.length;
237
+ value = allSelected ? [] : members.map(m => m.memberId);
243
238
  }
244
- return {
239
+ return setAssignment(prev => ({
245
240
  ...prev,
246
- [field]: value
247
- };
248
- });
241
+ assignedStudents: typeof value === "string" ? value.split(",") : value
242
+ }));
243
+ }
244
+ if (field === "classroomId") {
245
+ return setAssignment(prev => ({
246
+ ...prev,
247
+ classroomId: typeof value === "string" ? value.split(",") : value
248
+ }));
249
+ }
250
+ if (field === "classroom") {
251
+ return setAssignment(prev => ({
252
+ ...prev,
253
+ classroomId: value,
254
+ assignedStudents: []
255
+ }));
256
+ }
257
+ return setAssignment(prev => ({
258
+ ...prev,
259
+ [field]: value
260
+ }));
249
261
  };
250
262
  const handleCreateAssignment = async () => {
251
263
  try {
@@ -462,18 +474,46 @@ function CreateAssignmentDialog({
462
474
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.InputLabel, {
463
475
  id: "members-label",
464
476
  required: true,
465
- children: t("select_members")
466
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Select, {
477
+ children: t("assign_to")
478
+ }), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Select, {
467
479
  labelId: "members-label",
468
480
  id: "assignedStudents",
469
481
  "data-cy": "assignment-members-selector",
470
- label: t("select_members"),
482
+ label: t("assign_to"),
471
483
  multiple: true,
472
484
  required: true,
473
485
  value: assignment.assignedStudents,
474
486
  onChange: handleChange("assignedStudents"),
475
- renderValue: selected => selected?.map(memberId => members?.find(member => member.memberId === memberId))?.map(member => member?.username).join(", "),
476
- children: members?.map(member => /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.MenuItem, {
487
+ renderValue: selected => assignment.assignedStudents.length === members.length ? t("all_students") : selected?.map(memberId => members?.find(member => member.memberId === memberId))?.map(member => member?.username).join(", "),
488
+ MenuProps: {
489
+ PaperProps: {
490
+ sx: {
491
+ maxHeight: 300
492
+ }
493
+ },
494
+ MenuListProps: {
495
+ disablePadding: true
496
+ },
497
+ autoFocus: false,
498
+ disableAutoFocusItem: true
499
+ },
500
+ children: [members.length > 0 && /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.MenuItem, {
501
+ value: "select-all",
502
+ children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Box, {
503
+ sx: {
504
+ display: "flex",
505
+ alignItems: "center",
506
+ justifyContent: "space-between",
507
+ width: "100%"
508
+ },
509
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.ListItemText, {
510
+ primary: t("all_students")
511
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Checkbox, {
512
+ checked: assignment.assignedStudents.length === members.length,
513
+ indeterminate: assignment.assignedStudents.length > 0 && assignment.assignedStudents.length < members.length
514
+ })]
515
+ })
516
+ }), members.map(member => /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.MenuItem, {
477
517
  value: member.memberId,
478
518
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Avatar, {
479
519
  src: member.userImage,
@@ -485,7 +525,7 @@ function CreateAssignmentDialog({
485
525
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Checkbox, {
486
526
  checked: assignment.assignedStudents?.includes(member.memberId)
487
527
  })]
488
- }, member.memberId))
528
+ }, member.memberId))]
489
529
  })]
490
530
  }), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Box, {
491
531
  sx: {
@@ -114,7 +114,7 @@ function OverflowMenu({
114
114
  onClick: async () => {
115
115
  await handleDuplicateCourse(course, classroomId);
116
116
  },
117
- disabled: !canDuplicateCourse || course.duplicated,
117
+ disabled: !canDuplicateCourse || course.duplicated && course.duplicatedBy !== 'creator',
118
118
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_CardElements.CardMenuIcon, {
119
119
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_FileCopy.default, {
120
120
  fontSize: "small"
@@ -1211,16 +1211,6 @@ function Editor({
1211
1211
  topicPhrases: topicPhrases,
1212
1212
  updateRivescriptJSON: updateRivescriptJSON,
1213
1213
  initialTopicGoal: initialTopicGoal
1214
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Box, {
1215
- display: "flex",
1216
- alignItems: "center",
1217
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_DefaultColourButton.default, {
1218
- size: "small",
1219
- onClick: handleOpenEditorModal,
1220
- endIcon: /*#__PURE__*/(0, _jsxRuntime.jsx)(_ArrowForward.default, {}),
1221
- variant: "outlined",
1222
- children: t("advanced_editor")
1223
- })
1224
1214
  })]
1225
1215
  }) : null]
1226
1216
  })
@@ -103,7 +103,11 @@ function Bot({
103
103
  parentClassroom,
104
104
  isHeritageSpeaker,
105
105
  classroomId,
106
- assignment
106
+ assignment,
107
+ i18nLanguage,
108
+ isDynamicResponsesEnabled,
109
+ aiChatbotConversationHistory,
110
+ isUserInternal
107
111
  }) {
108
112
  const theme = (0, _styles.useTheme)();
109
113
  const {
@@ -181,7 +185,11 @@ function Bot({
181
185
  clearQueue,
182
186
  stopAudio,
183
187
  isHeritageSpeaker,
184
- classroomId
188
+ classroomId,
189
+ i18nLanguage,
190
+ isDynamicResponsesEnabled,
191
+ aiChatbotConversationHistory,
192
+ isUserInternal
185
193
  });
186
194
  const {
187
195
  muteSound,
@@ -43,7 +43,8 @@ function CreateBot({
43
43
  botAvatar: "",
44
44
  tags: [],
45
45
  phrasesToBoost: [],
46
- isAdvancedBot: false
46
+ isAdvancedBot: false,
47
+ isDynamicResponsesEnabled: "enable"
47
48
  },
48
49
  learnLang,
49
50
  subscription = {
@@ -21,7 +21,8 @@ function BotSettings({
21
21
  errors,
22
22
  handleChange,
23
23
  handleBlur,
24
- subscription
24
+ subscription,
25
+ isUserInternal
25
26
  }) {
26
27
  const {
27
28
  classes
@@ -29,7 +30,8 @@ function BotSettings({
29
30
  const {
30
31
  visibility,
31
32
  translationEnabled,
32
- isAdvancedBot
33
+ isAdvancedBot,
34
+ isDynamicResponsesEnabled
33
35
  } = values;
34
36
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {
35
37
  children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Grid, {
@@ -137,6 +139,36 @@ function BotSettings({
137
139
  })]
138
140
  })]
139
141
  })]
142
+ }), isUserInternal && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Grid, {
143
+ size: 12,
144
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
145
+ gutterBottom: true,
146
+ children: t("dynamic_response_desc")
147
+ }), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.FormControl, {
148
+ component: "fieldset",
149
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.FormLabel, {
150
+ component: "legend",
151
+ children: t("dynamic_response")
152
+ }), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.RadioGroup, {
153
+ className: classes.group,
154
+ "aria-label": "isDynamicResponsesEnabled",
155
+ name: "isDynamicResponsesEnabled",
156
+ value: isDynamicResponsesEnabled,
157
+ onChange: handleChange,
158
+ onBlur: handleBlur,
159
+ helperText: touched.isDynamicResponsesEnabled ? errors.isDynamicResponsesEnabled : "",
160
+ error: touched.isDynamicResponsesEnabled && Boolean(errors.isDynamicResponsesEnabled),
161
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.FormControlLabel, {
162
+ value: "enable",
163
+ control: /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Radio, {}),
164
+ label: t("enable")
165
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.FormControlLabel, {
166
+ value: "disable",
167
+ control: /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Radio, {}),
168
+ label: t("disable")
169
+ })]
170
+ })]
171
+ })]
140
172
  })]
141
173
  })
142
174
  });
@@ -49,7 +49,8 @@ const useStyles = (0, _mui.makeStyles)()(theme => ({
49
49
  function Confirmation({
50
50
  t = text => text,
51
51
  values,
52
- subscription
52
+ subscription,
53
+ isUserInternal
53
54
  }) {
54
55
  const {
55
56
  classes
@@ -58,7 +59,8 @@ function Confirmation({
58
59
  visibility,
59
60
  translationEnabled,
60
61
  studentInstructions,
61
- isAdvancedBot
62
+ isAdvancedBot,
63
+ isDynamicResponsesEnabled
62
64
  } = values;
63
65
  const [open, setOpen] = (0, _react.useState)(false);
64
66
  const templateProps = {
@@ -83,7 +85,7 @@ function Confirmation({
83
85
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("br", {}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Grid, {
84
86
  container: true,
85
87
  sx: {
86
- width: '100%'
88
+ width: "100%"
87
89
  },
88
90
  spacing: 1,
89
91
  children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Grid, {
@@ -173,6 +175,35 @@ function Confirmation({
173
175
  })]
174
176
  })]
175
177
  })]
178
+ }), isUserInternal && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Grid, {
179
+ size: 12,
180
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
181
+ gutterBottom: true,
182
+ display: "block",
183
+ children: t("dynamic_response_desc")
184
+ }), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.FormControl, {
185
+ component: "fieldset",
186
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.FormLabel, {
187
+ component: "legend",
188
+ children: t("dynamic_response")
189
+ }), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.RadioGroup, {
190
+ className: classes.group,
191
+ "aria-label": "isDynamicResponsesEnabled",
192
+ name: "isDynamicResponsesEnabled",
193
+ value: isDynamicResponsesEnabled,
194
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.FormControlLabel, {
195
+ disabled: true,
196
+ value: "enable",
197
+ control: /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Radio, {}),
198
+ label: t("enable")
199
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.FormControlLabel, {
200
+ disabled: true,
201
+ value: "disable",
202
+ control: /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Radio, {}),
203
+ label: t("disable")
204
+ })]
205
+ })]
206
+ })]
176
207
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)("br", {}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Grid, {
177
208
  size: {
178
209
  xs: 12,
@@ -29,7 +29,8 @@ function CourseSettings({
29
29
  allowedDomains,
30
30
  collaborators,
31
31
  isShareable,
32
- duplicated
32
+ duplicated,
33
+ duplicatedBy
33
34
  } = values;
34
35
  const {
35
36
  email
@@ -92,43 +93,12 @@ function CourseSettings({
92
93
  value: "public",
93
94
  control: /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Radio, {}),
94
95
  label: t("public"),
95
- disabled: duplicated
96
+ disabled: duplicatedBy === 'community' && duplicated
96
97
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.FormControlLabel, {
97
98
  value: "private",
98
99
  control: /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Radio, {}),
99
100
  label: t("private"),
100
- disabled: duplicated
101
- })]
102
- })]
103
- })
104
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Grid, {
105
- size: {
106
- xs: 12,
107
- md: 12
108
- },
109
- children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.FormControl, {
110
- component: "fieldset",
111
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.FormLabel, {
112
- component: "legend",
113
- children: t("duplication")
114
- }), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.RadioGroup, {
115
- "aria-label": "duplication",
116
- name: "isShareable",
117
- value: isShareable,
118
- onChange: handleChange,
119
- onBlur: handleBlur,
120
- helperText: touched.isShareable ? errors.isShareable : "",
121
- error: touched.isShareable && Boolean(errors.isShareable),
122
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.FormControlLabel, {
123
- value: "everyone",
124
- control: /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Radio, {}),
125
- label: t("everyone"),
126
- disabled: duplicated
127
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.FormControlLabel, {
128
- value: "collaborators",
129
- control: /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Radio, {}),
130
- label: t("collaborators_only"),
131
- disabled: duplicated
101
+ disabled: duplicatedBy === 'community' && duplicated
132
102
  })]
133
103
  })]
134
104
  })
@@ -184,6 +154,37 @@ function CourseSettings({
184
154
  fullWidth: true
185
155
  })]
186
156
  })]
157
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Grid, {
158
+ size: {
159
+ xs: 12,
160
+ md: 12
161
+ },
162
+ children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.FormControl, {
163
+ component: "fieldset",
164
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.FormLabel, {
165
+ component: "legend",
166
+ children: t("duplication")
167
+ }), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.RadioGroup, {
168
+ "aria-label": "duplication",
169
+ name: "isShareable",
170
+ value: isShareable,
171
+ onChange: handleChange,
172
+ onBlur: handleBlur,
173
+ helperText: touched.isShareable ? errors.isShareable : "",
174
+ error: touched.isShareable && Boolean(errors.isShareable),
175
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.FormControlLabel, {
176
+ value: "everyone",
177
+ control: /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Radio, {}),
178
+ label: t("everyone"),
179
+ disabled: duplicatedBy === 'community' && duplicated
180
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.FormControlLabel, {
181
+ value: "collaborators",
182
+ control: /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Radio, {}),
183
+ label: t("collaborators_only"),
184
+ disabled: duplicatedBy === 'community' && duplicated
185
+ })]
186
+ })]
187
+ })
187
188
  })]
188
189
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)("br", {}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
189
190
  children: t("add_collaborators")
@@ -216,7 +217,7 @@ function CourseSettings({
216
217
  variant: "outlined",
217
218
  multiline: true,
218
219
  fullWidth: true,
219
- restrictCollaboratorDomains: duplicated,
220
+ restrictCollaboratorDomains: duplicatedBy === 'community' && duplicated,
220
221
  userEmail: email
221
222
  }), !subscription.isPaidUser && /*#__PURE__*/(0, _jsxRuntime.jsx)(_Tooltip.default, {
222
223
  title: subscription.isUpgradePossible ? t("upgrade_plan_explanation") : t("upgrade_subscription_student"),
@@ -237,7 +238,7 @@ function CourseSettings({
237
238
  variant: "outlined",
238
239
  multiline: true,
239
240
  fullWidth: true,
240
- restrictCollaboratorDomains: duplicated,
241
+ restrictCollaboratorDomains: duplicatedBy === 'community' && duplicated,
241
242
  userEmail: email
242
243
  })
243
244
  })]
@@ -43,7 +43,8 @@ function UpdateBot({
43
43
  creatorInstructions: "",
44
44
  studentInstructions: "",
45
45
  tags: [],
46
- phrasesToBoost: []
46
+ phrasesToBoost: [],
47
+ isDynamicResponsesEnabled: "enable"
47
48
  },
48
49
  verificationStatus,
49
50
  onSubmit,
@@ -79,7 +80,8 @@ function UpdateBot({
79
80
  studentInstructions,
80
81
  introMessage,
81
82
  tags,
82
- phrasesToBoost
83
+ phrasesToBoost,
84
+ isDynamicResponsesEnabled
83
85
  } = initialValues;
84
86
  const difficultyOptions = difficulties.map((d, idx) => {
85
87
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_MenuItem.default, {
@@ -172,7 +174,8 @@ function UpdateBot({
172
174
  initialValues: {
173
175
  visibility,
174
176
  translationEnabled,
175
- picture
177
+ picture,
178
+ isDynamicResponsesEnabled
176
179
  },
177
180
  enableReinitialize: enableReinitialize,
178
181
  validationSchema: _Steps.BotSettings.validationSchema,
@@ -213,7 +216,8 @@ function UpdateBot({
213
216
  values: values,
214
217
  ...otherProps,
215
218
  isUpdating: true,
216
- subscription: subscription
219
+ subscription: subscription,
220
+ isUserInternal: isUserInternal
217
221
  })
218
222
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_Divider.default, {}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_CardActions.default, {
219
223
  className: classes.padding,
@@ -33,7 +33,8 @@ function UpdateCourse({
33
33
  collaborators: [],
34
34
  picture: null,
35
35
  isShareable: "",
36
- duplicated: false
36
+ duplicated: false,
37
+ duplicatedBy: ""
37
38
  },
38
39
  difficulties = ["A1", "A2", "B1", "B2", "C1", "C2"],
39
40
  onSubmit,
@@ -69,7 +70,8 @@ function UpdateCourse({
69
70
  tags,
70
71
  collaborators,
71
72
  isShareable,
72
- duplicated
73
+ duplicated,
74
+ duplicatedBy
73
75
  } = initialValues;
74
76
  return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
75
77
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_formik.Formik, {
@@ -144,7 +146,8 @@ function UpdateCourse({
144
146
  allowedDomains,
145
147
  collaborators,
146
148
  isShareable: isShareable ?? "collaborators",
147
- duplicated
149
+ duplicated,
150
+ duplicatedBy
148
151
  },
149
152
  enableReinitialize: enableReinitialize,
150
153
  validationSchema: _Steps.CourseSettings.validationSchema,
@@ -64,7 +64,8 @@ function Courses({
64
64
  username,
65
65
  memberId,
66
66
  handleDuplicateCourse,
67
- email
67
+ email,
68
+ isTeacher
68
69
  }) {
69
70
  const {
70
71
  classes
@@ -138,7 +139,8 @@ function Courses({
138
139
  username: username,
139
140
  handleDuplicateCourse: handleDuplicateCourse,
140
141
  cardTitleComponent: "h2",
141
- email: email
142
+ email: email,
143
+ isTeacher: isTeacher
142
144
  }) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Box, {
143
145
  py: 2,
144
146
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Courses2.default, {
@@ -176,7 +178,8 @@ function Courses({
176
178
  memberId: memberId,
177
179
  username: username,
178
180
  handleDuplicateCourse: handleDuplicateCourse,
179
- cardTitleComponent: "h2"
181
+ cardTitleComponent: "h2",
182
+ isTeacher: isTeacher
180
183
  }) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Box, {
181
184
  py: 2,
182
185
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Courses2.default, {
@@ -68,7 +68,11 @@ function useExerciseState({
68
68
  isCreator,
69
69
  isKeyboardHiddenTranslation,
70
70
  isHeritageSpeaker = false,
71
- classroomId
71
+ classroomId,
72
+ i18nLanguage,
73
+ isDynamicResponsesEnabled,
74
+ aiChatbotConversationHistory,
75
+ isUserInternal
72
76
  }) {
73
77
  const navigate = (0, _reactRouterDom.useNavigate)();
74
78
  const [questions, setQuestions] = (0, _react.useState)([]);
@@ -122,6 +126,8 @@ function useExerciseState({
122
126
  const [isWordBankAttemptChanged, setIsWordBankAttemptChanged] = (0, _react.useState)(false);
123
127
  const [isKeyboardHidden, setIsKeyboardHidden] = (0, _react.useState)(false);
124
128
  const [isAssignmentExercise, setIsAssignmentExercise] = (0, _react.useState)(false);
129
+ const [isFirstMessage, setIsFirstMessage] = (0, _react.useState)(true);
130
+ const [conversationHistory, setConversationHistory] = (0, _react.useState)([]);
125
131
  (0, _react.useEffect)(() => {
126
132
  if (isLiveGame && existingMessages && existingMessages.length > 0) {
127
133
  setRoleplayMessages(existingMessages);
@@ -1154,7 +1160,6 @@ function useExerciseState({
1154
1160
  if (isSkipped === true) {
1155
1161
  handleExerciseSkip(answerAttempt);
1156
1162
  }
1157
- console.log("answerAttempt is", answerAttempt);
1158
1163
  if (isCorrect && isCaseCorrect) {
1159
1164
  handleCorrect(answerAttempt);
1160
1165
  } else if (correctWordCounter >= 1 && !isCaseCorrect) {
@@ -1528,7 +1533,13 @@ function useExerciseState({
1528
1533
  resetTranscript();
1529
1534
  const body = {
1530
1535
  message: botText,
1531
- vars: botVars
1536
+ vars: botVars,
1537
+ isFirstMessage: aiChatbotConversationHistory.length !== 0 ? false : isFirstMessage,
1538
+ i18nLanguage,
1539
+ isDynamicResponsesEnabled: isUserInternal ? isDynamicResponsesEnabled === "enable" ? true : false : false,
1540
+ conversationHistory,
1541
+ botProgess: aiChatbotConversationHistory,
1542
+ botTemplate: bot.selectedTemplate ? bot.selectedTemplate : ''
1532
1543
  };
1533
1544
  const response = await handleMessageBot(bot.botId, body);
1534
1545
  if (response.errorMessage) {
@@ -1539,11 +1550,13 @@ function useExerciseState({
1539
1550
  if (response && response.reply) {
1540
1551
  setBotText("");
1541
1552
  setBotVars(response.vars);
1553
+ setConversationHistory(response.conversationHistory);
1542
1554
  handleReset();
1543
1555
  if (clearAttemptAudio) {
1544
1556
  clearAttemptAudio();
1545
1557
  }
1546
1558
  addBotMessage(response.reply, false, true);
1559
+ setIsFirstMessage(false);
1547
1560
  }
1548
1561
  } catch (error) {
1549
1562
  console.error(error);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nualang/nualang-ui-components",
3
- "version": "0.1.1261",
3
+ "version": "0.1.1262",
4
4
  "main": "dist/index.js",
5
5
  "files": [
6
6
  "dist",