@nualang/nualang-ui-components 0.1.1270 → 0.1.1272

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.
@@ -16,6 +16,7 @@ var _ExpandMore = _interopRequireDefault(require("@mui/icons-material/ExpandMore
16
16
  var _ExpandLess = _interopRequireDefault(require("@mui/icons-material/ExpandLess"));
17
17
  var _RecordVoiceOver = _interopRequireDefault(require("@mui/icons-material/RecordVoiceOver"));
18
18
  var _Forum = _interopRequireDefault(require("@mui/icons-material/Forum"));
19
+ var _Face = _interopRequireDefault(require("@mui/icons-material/Face"));
19
20
  var _OndemandVideo = _interopRequireDefault(require("@mui/icons-material/OndemandVideo"));
20
21
  var _AssignmentRoleplaySelection = _interopRequireDefault(require("../AssignmentRoleplaySelection/AssignmentRoleplaySelection"));
21
22
  var _CardElements = require("../../Cards/CardElements");
@@ -186,7 +187,7 @@ function Exercise({
186
187
  }), name.toLowerCase() === "roleplays" && /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.ListItemIcon, {
187
188
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Forum.default, {})
188
189
  }), name.toLowerCase() === "bots" && /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.ListItemIcon, {
189
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Forum.default, {})
190
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Face.default, {})
190
191
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Box, {
191
192
  width: "100%",
192
193
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.ListItemText, {
@@ -502,7 +503,7 @@ function Topic({
502
503
  handleSelectExercise(removeExercises);
503
504
  } else {
504
505
  let exercisesToAdd = [];
505
- exercises?.filter(e => e.name !== "roleplays").forEach(exercise => {
506
+ exercises?.filter(e => e.name !== "roleplays" && e.name !== "bots").forEach(exercise => {
506
507
  if (!selectedExercises?.some(e => e.courseSectionTopicId === courseSectionTopicId && e.name === exercise.name)) {
507
508
  exercisesToAdd.push({
508
509
  courseSectionTopicId: courseSectionTopicId,
package/dist/Chat/Chat.js CHANGED
@@ -97,7 +97,8 @@ function Chat({
97
97
  roleplayImage,
98
98
  siteLanguage,
99
99
  answerCounts,
100
- noAnswerCounts
100
+ noAnswerCounts,
101
+ isDynamicResponsesEnabled
101
102
  }) {
102
103
  const {
103
104
  classes
@@ -160,7 +161,8 @@ function Chat({
160
161
  roleplayImage: roleplayImage,
161
162
  siteLanguage: siteLanguage,
162
163
  answerCounts: answerCounts,
163
- noAnswerCounts: noAnswerCounts
164
+ noAnswerCounts: noAnswerCounts,
165
+ isDynamicResponsesEnabled: isDynamicResponsesEnabled
164
166
  }), !hideBottomBar && !viewAttemptMode && /*#__PURE__*/(0, _jsxRuntime.jsx)(_BottomBar.default, {
165
167
  t: t,
166
168
  inputName: inputName,
@@ -12,6 +12,8 @@ var _Typography = _interopRequireDefault(require("@mui/material/Typography"));
12
12
  var _Person = _interopRequireDefault(require("@mui/icons-material/Person"));
13
13
  var _material = require("@mui/material");
14
14
  var _Grid = _interopRequireDefault(require("@mui/material/Grid"));
15
+ var _useMediaQuery = _interopRequireDefault(require("@mui/material/useMediaQuery"));
16
+ var _AiExperienceIcon = _interopRequireDefault(require("../../Misc/AiExperienceIcon/AiExperienceIcon"));
15
17
  var _jsxRuntime = require("react/jsx-runtime");
16
18
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
17
19
  const useStyles = (0, _mui.makeStyles)()((theme, {
@@ -135,9 +137,11 @@ function ChatLoading({
135
137
  botMessageIndex,
136
138
  hideAvatar,
137
139
  messages = [],
138
- index
140
+ index,
141
+ isDynamicResponsesEnabled
139
142
  }) {
140
143
  const theme = (0, _styles.useTheme)();
144
+ const isSmallScreen = (0, _useMediaQuery.default)(theme.breakpoints.down("sm"));
141
145
  const messageContainerId = `message${botMessageIndex}`;
142
146
  const {
143
147
  classes
@@ -152,16 +156,35 @@ function ChatLoading({
152
156
  className: classes.root,
153
157
  children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
154
158
  className: classes.message,
155
- children: [userImage ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_Avatar.default, {
156
- className: classes.avatar,
157
- src: userImage,
158
- alt: ""
159
+ children: [userImage ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {
160
+ children: !isMyMessage && isDynamicResponsesEnabled === 'enable' ? /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
161
+ style: {
162
+ position: "relative",
163
+ display: "inline-block"
164
+ },
165
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_Avatar.default, {
166
+ className: classes.avatar,
167
+ src: userImage,
168
+ alt: ""
169
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_AiExperienceIcon.default, {
170
+ aiExperienceInfoText: t('ai_chatbot_message_generating_info'),
171
+ sx: {
172
+ bottom: isSmallScreen ? "23px" : "23px",
173
+ right: isSmallScreen ? "-11px" : "-21px",
174
+ transform: isSmallScreen ? "scale(0.33)" : "scale(0.43)"
175
+ }
176
+ })]
177
+ }) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_Avatar.default, {
178
+ className: classes.avatar,
179
+ src: userImage,
180
+ alt: ""
181
+ })
159
182
  }) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_Avatar.default, {
160
183
  className: classes.avatar,
161
- sx: {
184
+ sx: theme => ({
162
185
  backgroundColor: theme.palette.mode === "dark" ? "white" : "",
163
186
  color: theme.palette.mode === "dark" ? theme.palette.background.default : ""
164
- },
187
+ }),
165
188
  alt: "",
166
189
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Person.default, {
167
190
  fontSize: "large"
@@ -188,7 +211,6 @@ function ChatLoading({
188
211
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Typography.default, {
189
212
  variant: "subtitle2",
190
213
  component: "h4",
191
- gutterBottom: true,
192
214
  fontWeight: "bold",
193
215
  align: "left",
194
216
  children: name
@@ -26,6 +26,7 @@ var _useMediaQuery = _interopRequireDefault(require("@mui/material/useMediaQuery
26
26
  var _DragIndicator = _interopRequireDefault(require("@mui/icons-material/DragIndicator"));
27
27
  var _Grid = _interopRequireDefault(require("@mui/material/Grid"));
28
28
  var _BorderColor = _interopRequireDefault(require("@mui/icons-material/BorderColor"));
29
+ var _AiExperienceIcon = _interopRequireDefault(require("../../../Misc/AiExperienceIcon/AiExperienceIcon"));
29
30
  var _jsxRuntime = require("react/jsx-runtime");
30
31
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
31
32
  const useStyles = (0, _mui.makeStyles)()((theme, {
@@ -298,7 +299,8 @@ function Message({
298
299
  isLivePlayer = false,
299
300
  siteLanguage,
300
301
  provided,
301
- isEdited = false
302
+ isEdited = false,
303
+ isDynamicResponsesEnabled
302
304
  }) {
303
305
  const theme = (0, _styles.useTheme)();
304
306
  const messageContainerId = `message${messageIndex}`;
@@ -369,10 +371,30 @@ function Message({
369
371
  className: classes.root,
370
372
  children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
371
373
  className: classes.message,
372
- children: [userImage ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_Avatar.default, {
373
- className: classes.avatar,
374
- src: userImage,
375
- alt: ""
374
+ children: [userImage ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {
375
+ children: !isMyMessage && isDynamicResponsesEnabled === 'enable' ? /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
376
+ style: {
377
+ position: "relative",
378
+ display: "inline-block"
379
+ },
380
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_Avatar.default, {
381
+ className: classes.avatar,
382
+ src: userImage,
383
+ alt: ""
384
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_AiExperienceIcon.default, {
385
+ aiExperienceInfoText: t('ai_chatbot_message_info'),
386
+ isCurrentMessagePlaying: isCurrentMessagePlaying,
387
+ sx: {
388
+ bottom: isSmallScreen ? "23px" : "23px",
389
+ right: isSmallScreen ? "-11px" : "-21px",
390
+ transform: isSmallScreen ? "scale(0.33)" : "scale(0.43)"
391
+ }
392
+ })]
393
+ }) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_Avatar.default, {
394
+ className: classes.avatar,
395
+ src: userImage,
396
+ alt: ""
397
+ })
376
398
  }) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_Avatar.default, {
377
399
  className: classes.avatar,
378
400
  sx: theme => ({
@@ -457,13 +479,18 @@ function Message({
457
479
  },
458
480
  spacing: 4,
459
481
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_Grid.default, {
460
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Typography.default, {
461
- variant: "subtitle2",
462
- component: "h4",
463
- gutterBottom: true,
464
- fontWeight: "bold",
465
- align: "left",
466
- children: name
482
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Box, {
483
+ sx: {
484
+ display: "flex",
485
+ alignItems: "center"
486
+ },
487
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Typography.default, {
488
+ variant: "subtitle2",
489
+ component: "h4",
490
+ fontWeight: "bold",
491
+ align: "left",
492
+ children: name
493
+ })
467
494
  })
468
495
  }), isEdited && /*#__PURE__*/(0, _jsxRuntime.jsx)(_Grid.default, {
469
496
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Tooltip.default, {
@@ -61,6 +61,7 @@ function Messages({
61
61
  noAnswerCounts,
62
62
  moveScriptItem,
63
63
  voice,
64
+ isDynamicResponsesEnabled,
64
65
  ...otherProps
65
66
  }) {
66
67
  const {
@@ -196,6 +197,7 @@ function Messages({
196
197
  isLivePlayer: isLivePlayer,
197
198
  siteLanguage: siteLanguage,
198
199
  moveScriptItem: moveScriptItem,
200
+ isDynamicResponsesEnabled: isDynamicResponsesEnabled,
199
201
  ...m,
200
202
  ...otherProps
201
203
  }, `messy_${i}`)
@@ -225,6 +227,7 @@ function Messages({
225
227
  t: t,
226
228
  index: i,
227
229
  messages: messages,
230
+ isDynamicResponsesEnabled: isDynamicResponsesEnabled,
228
231
  ...m,
229
232
  ...otherProps
230
233
  }) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_Message.default, {
@@ -247,6 +250,7 @@ function Messages({
247
250
  speak: speak,
248
251
  isLivePlayer: isLivePlayer,
249
252
  siteLanguage: siteLanguage,
253
+ isDynamicResponsesEnabled: isDynamicResponsesEnabled,
250
254
  ...m,
251
255
  ...otherProps
252
256
  }, `messy_${i}`))]
@@ -20,6 +20,7 @@ var _dragAndDrop = require("../../utils/dragAndDrop/dragAndDrop");
20
20
  var _ResponsiveDialog = _interopRequireDefault(require("../ResponsiveDialog"));
21
21
  var _InputHelper = _interopRequireDefault(require("../../Forms/InputHelper"));
22
22
  var _debounce = _interopRequireDefault(require("lodash/debounce"));
23
+ var _uuid = require("uuid");
23
24
  var _jsxRuntime = require("react/jsx-runtime");
24
25
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
25
26
  // components
@@ -63,7 +64,10 @@ function CreateQuestion({
63
64
  }) {
64
65
  const [question, setQuestion] = (0, _react.useState)(initialQuestion);
65
66
  const [answer, setAnswer] = (0, _react.useState)(initialAnswerState);
66
- const [answerList, setAnswerList] = (0, _react.useState)(answers);
67
+ const [answerList, setAnswerList] = (0, _react.useState)(() => (answers || []).map(a => ({
68
+ ...a,
69
+ id: a.id || (0, _uuid.v4)()
70
+ })));
67
71
  const [error, setError] = (0, _react.useState)("");
68
72
  const handleAnswerInputChange = event => {
69
73
  const target = event.target;
@@ -84,7 +88,8 @@ function CreateQuestion({
84
88
  } else {
85
89
  setAnswerList(prevAnswerList => [...prevAnswerList, {
86
90
  ...answer,
87
- text: answer.text.trim()
91
+ text: answer.text.trim(),
92
+ id: (0, _uuid.v4)()
88
93
  }]);
89
94
  setAnswer(initialAnswerState);
90
95
  setError("");
@@ -131,12 +136,10 @@ function CreateQuestion({
131
136
  active,
132
137
  over
133
138
  } = result;
134
- if (!over) {
135
- return;
136
- }
139
+ if (!over) return;
137
140
  if (active.id !== over.id) {
138
- const oldIndex = answerList.findIndex((item, index) => `${index}-${item.text}` === active.id);
139
- const newIndex = answerList.findIndex((item, index) => `${index}-${item.text}` === over.id);
141
+ const oldIndex = answerList.findIndex(item => item.id === active.id);
142
+ const newIndex = answerList.findIndex(item => item.id === over.id);
140
143
  const updatedAnswerList = (0, _sortable.arrayMove)(answerList, oldIndex, newIndex);
141
144
  setAnswerList(updatedAnswerList);
142
145
  }
@@ -204,10 +207,10 @@ function CreateQuestion({
204
207
  })]
205
208
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
206
209
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_dragAndDrop.SortableDndContextWrapper, {
207
- items: answerList.map((a, index) => `${index}-${a.text}`),
210
+ items: answerList.map(a => a.id),
208
211
  onDragEnd: handleOnDragEnd,
209
212
  children: answerList.map((a, idx) => /*#__PURE__*/(0, _jsxRuntime.jsx)(_dragAndDrop.SortableHandleOnly, {
210
- sortId: `${idx}-${a.text}`,
213
+ sortId: a.id,
211
214
  index: idx,
212
215
  renderHandle: ({
213
216
  setActivatorNodeRef,
@@ -237,7 +240,7 @@ function CreateQuestion({
237
240
  value: a.text,
238
241
  onChange: handleExistingAnswerInputChange(idx),
239
242
  margin: "none",
240
- id: `answer-${idx}`,
243
+ id: `answer-${a.id}`,
241
244
  name: "text",
242
245
  type: "text",
243
246
  fullWidth: true,
@@ -274,7 +277,7 @@ function CreateQuestion({
274
277
  })
275
278
  })]
276
279
  })
277
- }, idx))
280
+ }, a.id))
278
281
  })
279
282
  })]
280
283
  });
@@ -266,8 +266,8 @@ function GenerateBotDialog({
266
266
  required: true,
267
267
  onChange: handleChange,
268
268
  multiline: true,
269
- rows: 3,
270
- maxLength: 200
269
+ rows: 3
270
+ // maxLength={200}
271
271
  })
272
272
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Grid, {
273
273
  size: 12,
@@ -286,10 +286,9 @@ function GenerateBotDialog({
286
286
  sx: {
287
287
  marginBottom: 5
288
288
  },
289
- onChange: e => setTopicGoal(e.target.value),
290
- inputProps: {
291
- maxLength: 300
292
- },
289
+ onChange: e => setTopicGoal(e.target.value)
290
+ // inputProps={{ maxLength: 300 }}
291
+ ,
293
292
  InputProps: {
294
293
  endAdornment: /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.InputAdornment, {
295
294
  position: "end",
@@ -244,8 +244,8 @@ function GeneratePhrases({
244
244
  required: true,
245
245
  onChange: handleChange,
246
246
  multiline: true,
247
- rows: 3,
248
- maxLength: 300
247
+ rows: 3
248
+ // maxLength={300}
249
249
  })
250
250
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Grid, {
251
251
  mb: 2,
@@ -261,10 +261,9 @@ function GeneratePhrases({
261
261
  margin: "normal",
262
262
  variant: "outlined",
263
263
  fullWidth: true,
264
- onChange: handleChange,
265
- inputProps: {
266
- maxLength: 200
267
- },
264
+ onChange: handleChange
265
+ // inputProps={{ maxLength: 200 }}
266
+ ,
268
267
  InputProps: {
269
268
  endAdornment: /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.InputAdornment, {
270
269
  position: "end",
@@ -394,8 +394,8 @@ function GenerateRoleplayDialog({
394
394
  required: true,
395
395
  onChange: handleChange,
396
396
  multiline: true,
397
- rows: 3,
398
- maxLength: 300
397
+ rows: 3
398
+ // maxLength={300}
399
399
  })
400
400
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Grid, {
401
401
  size: 12,
@@ -413,10 +413,9 @@ function GenerateRoleplayDialog({
413
413
  sx: {
414
414
  marginBottom: 5
415
415
  },
416
- onChange: e => setTopicGoal(e.target.value),
417
- inputProps: {
418
- maxLength: 300
419
- },
416
+ onChange: e => setTopicGoal(e.target.value)
417
+ // inputProps={{ maxLength: 300 }}
418
+ ,
420
419
  InputProps: {
421
420
  endAdornment: /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.InputAdornment, {
422
421
  position: "end",
@@ -636,7 +636,8 @@ function Bot({
636
636
  speak: speak,
637
637
  stopSpeaking: stopSpeaking,
638
638
  isSpeaking: isSpeaking,
639
- isSpeakingTextContainer: isSpeakingTextContainer
639
+ isSpeakingTextContainer: isSpeakingTextContainer,
640
+ isDynamicResponsesEnabled: isDynamicResponsesClassroomEnabled
640
641
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ResponsiveDialog.default, {
641
642
  open: instructionDialogOpen,
642
643
  handleClose: handleCloseInstructions,
@@ -0,0 +1,134 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = AiExperienceIcon;
7
+ var _react = require("@emotion/react");
8
+ var _material = require("@mui/material");
9
+ var _AutoAwesome = _interopRequireDefault(require("@mui/icons-material/AutoAwesome"));
10
+ var _jsxRuntime = require("react/jsx-runtime");
11
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
12
+ // Icon shimmer on hover
13
+ const shimmerIcon = (0, _react.keyframes)`
14
+ 0%, 100% {
15
+ opacity: 1;
16
+ transform: scale(1);
17
+ filter: brightness(1);
18
+ }
19
+ 50% {
20
+ opacity: 0.8;
21
+ transform: scale(1.15);
22
+ filter: brightness(1.8);
23
+ }
24
+ `;
25
+
26
+ // Background shine animation
27
+ const shine = (0, _react.keyframes)`
28
+ 0% {
29
+ transform: translateX(-150%) rotate(25deg);
30
+ opacity: 0;
31
+ }
32
+ 50% {
33
+ opacity: 0.5;
34
+ }
35
+ 100% {
36
+ transform: translateX(150%) rotate(25deg);
37
+ opacity: 0;
38
+ }
39
+ `;
40
+
41
+ // Pulse animation
42
+ const pulse = (0, _react.keyframes)`
43
+ 0%, 100% {
44
+ transform: scale(0.96);
45
+ }
46
+ 50% {
47
+ transform: scale(1);
48
+ }
49
+ `;
50
+ function AiExperienceIcon({
51
+ sx,
52
+ aiExperienceInfoText,
53
+ isCurrentMessagePlaying
54
+ }) {
55
+ const theme = (0, _material.useTheme)();
56
+ const backgroundGradient = `linear-gradient(145deg, rgba(72, 32, 120, 0.68) 40%, rgba(0, 102, 255, 0.76) 90%)`;
57
+ const boxShadow = `0 0 40px rgba(0, 102, 255, 0.95), 0 0 25px rgba(72, 32, 120, 0.85)`;
58
+ const shimmerGradient = `linear-gradient(120deg, transparent, rgba(0, 102, 255, 1), transparent)`;
59
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {
60
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Box, {
61
+ sx: {
62
+ width: 45,
63
+ height: 45,
64
+ display: "flex",
65
+ alignItems: "center",
66
+ justifyContent: "center",
67
+ pointerEvents: "auto"
68
+ },
69
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Box, {
70
+ sx: {
71
+ width: "100%",
72
+ height: "100%",
73
+ animation: isCurrentMessagePlaying ? `${pulse} 1.6s ease-in-out infinite` : "none",
74
+ transformOrigin: "center center"
75
+ },
76
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Box, {
77
+ sx: {
78
+ width: "100%",
79
+ height: "100%",
80
+ borderRadius: "50%",
81
+ display: "flex",
82
+ alignItems: "center",
83
+ justifyContent: "center",
84
+ backdropFilter: "blur(8px)",
85
+ background: backgroundGradient,
86
+ position: "relative",
87
+ overflow: "hidden",
88
+ boxShadow,
89
+ border: `1.5px solid ${theme.palette.background.paper}`,
90
+ "::before": {
91
+ content: '""',
92
+ position: "absolute",
93
+ top: 0,
94
+ left: 0,
95
+ width: "200%",
96
+ height: "100%",
97
+ background: shimmerGradient,
98
+ animation: `${shine} 2s infinite linear`,
99
+ borderRadius: "50%",
100
+ pointerEvents: "none",
101
+ zIndex: 1
102
+ },
103
+ "&:hover > .shimmer-icon": {
104
+ animation: `${shimmerIcon} 3s ease-in-out infinite`
105
+ },
106
+ ...sx
107
+ },
108
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Tooltip, {
109
+ title: aiExperienceInfoText,
110
+ arrow: true,
111
+ placement: "bottom",
112
+ slotProps: {
113
+ popper: {
114
+ modifiers: [{
115
+ name: "flip",
116
+ enabled: false
117
+ }]
118
+ }
119
+ },
120
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_AutoAwesome.default, {
121
+ className: "shimmer-icon",
122
+ sx: {
123
+ zIndex: 2,
124
+ color: "#ffffff !important",
125
+ filter: "drop-shadow(0 0 6px #00E5FF) drop-shadow(0 0 8px #8A2BE2)",
126
+ fontSize: 28
127
+ }
128
+ })
129
+ })
130
+ })
131
+ })
132
+ })
133
+ });
134
+ }
@@ -1560,48 +1560,50 @@ function useExerciseState({
1560
1560
  };
1561
1561
  const handleSubmitBotMessage = async () => {
1562
1562
  try {
1563
- const method = `${finalTranscript || ""} ${interimTranscript || ""}`.trim() === botText.trim() ? "voice" : "text";
1564
- addBotMessage(botText, true, false, method, false, finalTranscript);
1565
- resetTranscript();
1566
- const loadingMessage = {
1567
- isMyMessage: false,
1568
- userImage: bot && bot.botAvatar ? bot.botAvatar : null,
1569
- name: bot && bot.name ? bot.name : "Bot",
1570
- text: "Loading ...",
1571
- isLoading: true
1572
- };
1573
- setBotMessages(prevMessages => [...prevMessages, loadingMessage]);
1574
- const intialStudentGreeting = getInitialStudentGreeting(learnLang);
1575
- const intialBotGreeting = getInitialBotGreeting(learnLang, bot.name);
1576
- const body = {
1577
- message: botText,
1578
- vars: botVars,
1579
- isFirstMessage: Array.isArray(aiChatbotConversationHistory) && aiChatbotConversationHistory.length !== 0 ? false : isFirstMessage,
1580
- i18nLanguage,
1581
- isDynamicResponsesEnabled: isUserInternal ? isDynamicResponsesEnabled === "enable" ? true : false : false,
1582
- conversationHistory,
1583
- botProgess: aiChatbotConversationHistory,
1584
- botTemplate: bot.selectedTemplate ? bot.selectedTemplate : "",
1585
- intialStudentGreeting,
1586
- intialBotGreeting
1587
- };
1588
- const response = await handleMessageBot(bot.botId, body);
1589
- if (response.errorMessage) {
1590
- openSnackbar("problem_getting_reply", "error");
1591
- } else if (typeof response === "string" && response.startsWith("Syntax error:")) {
1592
- openSnackbar(response, "error");
1593
- }
1594
- if (response && response.reply) {
1595
- setBotText("");
1596
- setBotVars(response.vars);
1597
- setConversationHistory(response.conversationHistory);
1598
- handleReset();
1599
- if (clearAttemptAudio) {
1600
- clearAttemptAudio();
1563
+ if (botText && botText.trim() !== '') {
1564
+ const method = `${finalTranscript || ""} ${interimTranscript || ""}`.trim() === botText.trim() ? "voice" : "text";
1565
+ addBotMessage(botText, true, false, method, false, finalTranscript);
1566
+ resetTranscript();
1567
+ const loadingMessage = {
1568
+ isMyMessage: false,
1569
+ userImage: bot && bot.botAvatar ? bot.botAvatar : null,
1570
+ name: bot && bot.name ? bot.name : "Bot",
1571
+ text: "Loading ...",
1572
+ isLoading: true
1573
+ };
1574
+ setBotMessages(prevMessages => [...prevMessages, loadingMessage]);
1575
+ const intialStudentGreeting = getInitialStudentGreeting(learnLang);
1576
+ const intialBotGreeting = getInitialBotGreeting(learnLang, bot.name);
1577
+ const body = {
1578
+ message: botText,
1579
+ vars: botVars,
1580
+ isFirstMessage: Array.isArray(aiChatbotConversationHistory) && aiChatbotConversationHistory.length !== 0 ? false : isFirstMessage,
1581
+ i18nLanguage,
1582
+ isDynamicResponsesEnabled: isUserInternal ? isDynamicResponsesEnabled === "enable" ? true : false : false,
1583
+ conversationHistory,
1584
+ botProgess: aiChatbotConversationHistory,
1585
+ botTemplate: bot.selectedTemplate ? bot.selectedTemplate : "",
1586
+ intialStudentGreeting,
1587
+ intialBotGreeting
1588
+ };
1589
+ const response = await handleMessageBot(bot.botId, body);
1590
+ if (response.errorMessage) {
1591
+ openSnackbar("problem_getting_reply", "error");
1592
+ } else if (typeof response === "string" && response.startsWith("Syntax error:")) {
1593
+ openSnackbar(response, "error");
1594
+ }
1595
+ if (response && response.reply) {
1596
+ setBotText("");
1597
+ setBotVars(response.vars);
1598
+ setConversationHistory(response.conversationHistory);
1599
+ handleReset();
1600
+ if (clearAttemptAudio) {
1601
+ clearAttemptAudio();
1602
+ }
1603
+ setBotMessages(prevMessages => prevMessages.filter(message => message.isLoading !== true));
1604
+ addBotMessage(response.reply, false, true);
1605
+ setIsFirstMessage(false);
1601
1606
  }
1602
- setBotMessages(prevMessages => prevMessages.filter(message => message.isLoading !== true));
1603
- addBotMessage(response.reply, false, true);
1604
- setIsFirstMessage(false);
1605
1607
  }
1606
1608
  } catch (error) {
1607
1609
  console.error(error);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nualang/nualang-ui-components",
3
- "version": "0.1.1270",
3
+ "version": "0.1.1272",
4
4
  "main": "dist/index.js",
5
5
  "files": [
6
6
  "dist",