@nualang/nualang-ui-components 0.1.1202 → 0.1.1204

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (34) hide show
  1. package/dist/Containers/App/App.js +6 -3
  2. package/dist/Dialogs/CreateAssignment/package.json +7 -0
  3. package/dist/Dialogs/CreatePhrase/CreatePhrase.js +6 -19
  4. package/dist/Dialogs/ImageLibrary/ImageLibrary.js +2 -0
  5. package/dist/Editors/Bot/Bot.js +4 -2
  6. package/dist/Editors/Bot/Editor/BotDesigner/BotDesigner.js +4 -2
  7. package/dist/Exercises/Listener/Listener.js +14 -10
  8. package/dist/Exercises/Pronouncer/Pronouncer.js +14 -10
  9. package/dist/Exercises/Translator/Translator.js +14 -10
  10. package/dist/Forms/CreateBot/CreateBot.js +4 -2
  11. package/dist/Forms/CreateBot/Steps/BotSettings/BotSettings.js +1 -1
  12. package/dist/Forms/CreateBot/Steps/Confirmation/Confirmation.js +1 -1
  13. package/dist/Forms/CreateClassroom/CreateClassroom.js +4 -2
  14. package/dist/Forms/CreateClassroom/Steps/Customization/Customization.js +5 -2
  15. package/dist/Forms/CreateCourse/CreateCourse.js +3 -1
  16. package/dist/Forms/CreateCourse/Steps/Customization/Customization.js +6 -3
  17. package/dist/Forms/CreateRoleplay/CreateRoleplay.js +4 -2
  18. package/dist/Forms/CreateRoleplayHook/CreateRoleplayHook.js +4 -2
  19. package/dist/Forms/CreateRoleplayHook/Steps/RoleplayInformation/RoleplayInformation.js +4 -2
  20. package/dist/Forms/CreateTopic/Steps/Customization/Customization.js +6 -3
  21. package/dist/Forms/CreateTopic/Steps/TopicInformation/TopicInformation.js +1 -1
  22. package/dist/Forms/UpdateClassroom/UpdateClassroom.js +4 -2
  23. package/dist/Forms/UpdateCourse/UpdateCourse.js +3 -1
  24. package/dist/Forms/UpdateTopic/UpdateTopic.js +3 -1
  25. package/dist/Lists/Exercises/Exercises.js +1 -1
  26. package/dist/Lists/RoleplaySelection/RoleplaySelection.js +1 -1
  27. package/dist/Live/LiveListener/LiveListener.js +14 -10
  28. package/dist/Live/LiveTranslator/LiveTranslator.js +16 -12
  29. package/dist/Misc/HoverText/HoverText.js +2 -2
  30. package/dist/Screens/Classrooms/ViewClassroom/ViewClassroom.js +2 -1
  31. package/dist/Screens/Courses/ViewCourse/ViewCourse.js +2 -1
  32. package/dist/Screens/Courses/ViewCourse/ViewTopic/ViewTopic.js +4 -2
  33. package/dist/utils/voiceImages.js +22 -0
  34. package/package.json +1 -1
@@ -263,6 +263,10 @@ function App({
263
263
  navigate("/courses/create");
264
264
  handleCloseCreate();
265
265
  };
266
+ const handleCreateAssignment = () => {
267
+ navigate("/assignments/create");
268
+ handleCloseCreate();
269
+ };
266
270
  const hiddenStyle = {
267
271
  position: "absolute",
268
272
  left: "-10000px",
@@ -400,9 +404,8 @@ function App({
400
404
  "data-cy": "appbar-create-course",
401
405
  children: t("course")
402
406
  })]
403
- }), process.env.REACT_APP_STAGE === "dev" && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.MenuItem
404
- // onClick={handleCreateAssignment}
405
- , {
407
+ }), process.env.REACT_APP_STAGE === "dev" && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.MenuItem, {
408
+ onClick: handleCreateAssignment,
406
409
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.ListItemIcon, {
407
410
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_School.default, {})
408
411
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.ListItemText, {
@@ -0,0 +1,7 @@
1
+ {
2
+ "name": "CreateAssignment",
3
+ "version": "0.0.0",
4
+ "private": true,
5
+ "main": "./CreateAssignment.js"
6
+ }
7
+
@@ -223,27 +223,13 @@ function CreatePhrase({
223
223
 
224
224
  const autoFillTranslation = async () => {
225
225
  try {
226
- const activePrompt = `Translate the following phrase "${phrase}" from ${learnLang} to ${forLang}. Provide all the acceptable alternative translations if the phrase has multiple interpretations. Format the response as a JSON array, where each translation is a string.`;
227
- const chatGptResponse = await makeChatGptApiRequest({
226
+ const activePrompt = `Translate the following phrase "${phrase}" from ${learnLang} to ${forLang}. Provide all the acceptable translations if the phrase has multiple interpretations. Format the response as a valid JSON array with each translation as a string inside the array.`;
227
+ let chatGptResponse = await makeChatGptApiRequest({
228
228
  model: "gpt-3.5-turbo",
229
229
  prompt: activePrompt
230
230
  });
231
-
232
- // Ensure the response is an array
233
- let translations = chatGptResponse;
234
-
235
- // If response is not an array, parse it
236
- if (!Array.isArray(translations)) {
237
- if (typeof chatGptResponse === "string") {
238
- try {
239
- translations = JSON.parse(chatGptResponse);
240
- } catch (error) {
241
- throw new Error("Failed to parse OpenAI response into JSON.");
242
- }
243
- } else {
244
- throw new Error("Invalid response format from OpenAI.");
245
- }
246
- }
231
+ chatGptResponse = chatGptResponse.replaceAll("```", '').replaceAll("json", '');
232
+ const translations = JSON.parse(chatGptResponse);
247
233
  setTranslationList(prevTranslationList => {
248
234
  const newTranslations = translations.filter(text => !prevTranslationList.includes(text));
249
235
  return [...prevTranslationList, ...newTranslations];
@@ -599,7 +585,8 @@ function CreatePhrase({
599
585
  autoCrop: true,
600
586
  autoSuggest: true,
601
587
  autoSuggestedImages: autoSuggestedImages,
602
- selectedImage: selectedImage
588
+ selectedImage: selectedImage,
589
+ verificationStatus: verificationStatus
603
590
  })
604
591
  })]
605
592
  })]
@@ -21,6 +21,7 @@ const useStyles = (0, _mui.makeStyles)()(() => ({
21
21
  function ImageLibraryDialog({
22
22
  open,
23
23
  handleClose,
24
+ verificationStatus,
24
25
  ...otherProps
25
26
  }) {
26
27
  const {
@@ -33,6 +34,7 @@ function ImageLibraryDialog({
33
34
  maxWidth: "xl",
34
35
  dialogContentClassName: classes.dialogContent,
35
36
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_ImageLibrary.default, {
37
+ verificationStatus: verificationStatus,
36
38
  ...otherProps
37
39
  })
38
40
  });
@@ -117,7 +117,8 @@ function Bot({
117
117
  sectionId,
118
118
  topicId,
119
119
  initialTopicGoal,
120
- isUserInternal
120
+ isUserInternal,
121
+ verificationStatus
121
122
  }) {
122
123
  const {
123
124
  recognitionState,
@@ -750,7 +751,8 @@ function Bot({
750
751
  onSubmit: onSubmit,
751
752
  subscription: subscription,
752
753
  handleBotInstructionsImageUpload: handleBotInstructionsImageUpload,
753
- isUserInternal: isUserInternal
754
+ isUserInternal: isUserInternal,
755
+ verificationStatus: verificationStatus
754
756
  })
755
757
  }) : null]
756
758
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ResponsiveDialog.default, {
@@ -68,7 +68,8 @@ function BotDesigner(props) {
68
68
  handleUploadBotExerciseImage,
69
69
  botId,
70
70
  simplified,
71
- handleOnBlur
71
+ handleOnBlur,
72
+ verificationStatus
72
73
  } = props;
73
74
  return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
74
75
  children: [rivescriptJSON && rivescriptJSON.begin.var && /*#__PURE__*/(0, _jsxRuntime.jsx)(_VarList.default, {
@@ -87,7 +88,8 @@ function BotDesigner(props) {
87
88
  handleUploadBotExerciseImage: handleUploadBotExerciseImage,
88
89
  botId: botId,
89
90
  simplified: simplified,
90
- handleOnBlur: handleOnBlur
91
+ handleOnBlur: handleOnBlur,
92
+ verificationStatus: verificationStatus
91
93
  }), rivescriptJSON && rivescriptJSON.begin.sub && !simplified && /*#__PURE__*/(0, _jsxRuntime.jsx)(_SubList.default, {
92
94
  t: t,
93
95
  subs: rivescriptJSON.begin.sub,
@@ -32,6 +32,7 @@ var _styles = require("@mui/material/styles");
32
32
  var _reactBeautifulDnd = require("react-beautiful-dnd");
33
33
  var _index = require("../../utils/index");
34
34
  var _useWordBankFocus = _interopRequireDefault(require("../../hooks/useWordBankFocus"));
35
+ var _voiceImages = _interopRequireDefault(require("../../utils/voiceImages"));
35
36
  var _jsxRuntime = require("react/jsx-runtime");
36
37
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
37
38
  function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
@@ -343,20 +344,23 @@ function Listener({
343
344
  voiceLanguageCode,
344
345
  voicePitch
345
346
  } = topicInfo;
347
+ const voiceMap = (0, _voiceImages.default)(voices || []);
346
348
  const getVoiceImage = () => {
347
- let voiceOptionsArray = voiceLanguageCode && voices[voiceLanguageCode] ? voices[voiceLanguageCode].voiceOptions : [];
348
- for (let i = 0; i < voiceOptionsArray.length; i++) {
349
- if (voiceOptionsArray[i].name === voice) {
350
- return voiceOptionsArray[i].speakingImage;
351
- }
349
+ try {
350
+ const exerciseVoice = voiceMap.get(voice) || {};
351
+ return exerciseVoice.speakingImage || null;
352
+ } catch (error) {
353
+ console.error('Error retrieving voice image:', error);
354
+ return null;
352
355
  }
353
356
  };
354
357
  const getNualaCelebratingImage = () => {
355
- let voiceOptionsArray = voiceLanguageCode && voices[voiceLanguageCode] ? voices[voiceLanguageCode].voiceOptions : [];
356
- for (let i = 0; i < voiceOptionsArray.length; i++) {
357
- if (voiceOptionsArray[i].name === voice) {
358
- return voiceOptionsArray[i].celebratingImage;
359
- }
358
+ try {
359
+ const exerciseVoice = voiceMap.get(voice) || {};
360
+ return exerciseVoice.celebratingImage || null;
361
+ } catch (error) {
362
+ console.error('Error retrieving celebrating image:', error);
363
+ return null;
360
364
  }
361
365
  };
362
366
  const joyrideSteps = [{
@@ -33,6 +33,7 @@ var _ReportProblem = _interopRequireDefault(require("../../Misc/ReportProblem"))
33
33
  var _ChatBubble = _interopRequireDefault(require("../../Misc/ChatBubble/ChatBubble"));
34
34
  var _WaveFormLite = _interopRequireDefault(require("../../Misc/WaveFormLite"));
35
35
  var _utils = require("../../utils");
36
+ var _voiceImages = _interopRequireDefault(require("../../utils/voiceImages"));
36
37
  var _jsxRuntime = require("react/jsx-runtime");
37
38
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
38
39
  function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
@@ -441,20 +442,23 @@ function Pronouncer({
441
442
  voiceLanguageCode,
442
443
  voicePitch
443
444
  } = topicInfo;
445
+ const voiceMap = (0, _voiceImages.default)(voices || []);
444
446
  const getVoiceImage = () => {
445
- let voiceOptionsArray = voiceLanguageCode && voices[voiceLanguageCode] ? voices[voiceLanguageCode].voiceOptions : [];
446
- for (let i = 0; i < voiceOptionsArray.length; i++) {
447
- if (voiceOptionsArray[i].name === voice) {
448
- return voiceOptionsArray[i].speakingImage;
449
- }
447
+ try {
448
+ const exerciseVoice = voiceMap.get(voice) || {};
449
+ return exerciseVoice.speakingImage || null;
450
+ } catch (error) {
451
+ console.error('Error retrieving voice image:', error);
452
+ return null;
450
453
  }
451
454
  };
452
455
  const getNualaCelebratingImage = () => {
453
- let voiceOptionsArray = voiceLanguageCode && voices[voiceLanguageCode] ? voices[voiceLanguageCode].voiceOptions : [];
454
- for (let i = 0; i < voiceOptionsArray.length; i++) {
455
- if (voiceOptionsArray[i].name === voice) {
456
- return voiceOptionsArray[i].celebratingImage;
457
- }
456
+ try {
457
+ const exerciseVoice = voiceMap.get(voice) || {};
458
+ return exerciseVoice.celebratingImage || null;
459
+ } catch (error) {
460
+ console.error('Error retrieving celebrating image:', error);
461
+ return null;
458
462
  }
459
463
  };
460
464
  const isListeningIndicatorTextVisible = recognizing && interimTranscript === "" && finalTranscript === "" ? true : false;
@@ -32,6 +32,7 @@ var _ChatBubble = _interopRequireDefault(require("../../Misc/ChatBubble/ChatBubb
32
32
  var _WaveFormLite = _interopRequireDefault(require("../../Misc/WaveFormLite"));
33
33
  var _styles = require("@mui/material/styles");
34
34
  var _reactBeautifulDnd = require("react-beautiful-dnd");
35
+ var _voiceImages = _interopRequireDefault(require("../../utils/voiceImages"));
35
36
  var _index = require("../../utils/index");
36
37
  var _useWordBankFocus = _interopRequireDefault(require("../../hooks/useWordBankFocus"));
37
38
  var _jsxRuntime = require("react/jsx-runtime");
@@ -485,20 +486,23 @@ function Translator({
485
486
  voiceLanguageCode,
486
487
  voicePitch
487
488
  } = topicInfo;
489
+ const voiceMap = (0, _voiceImages.default)(voices || []);
488
490
  const getVoiceImage = () => {
489
- let voiceOptionsArray = voiceLanguageCode && voices[voiceLanguageCode] ? voices[voiceLanguageCode].voiceOptions : [];
490
- for (let i = 0; i < voiceOptionsArray.length; i++) {
491
- if (voiceOptionsArray[i].name === voice) {
492
- return voiceOptionsArray[i].speakingImage;
493
- }
491
+ try {
492
+ const exerciseVoice = voiceMap.get(voice) || {};
493
+ return exerciseVoice.speakingImage || null;
494
+ } catch (error) {
495
+ console.error('Error retrieving voice image:', error);
496
+ return null;
494
497
  }
495
498
  };
496
499
  const getNualaCelebratingImage = () => {
497
- let voiceOptionsArray = voiceLanguageCode && voices[voiceLanguageCode] ? voices[voiceLanguageCode].voiceOptions : [];
498
- for (let i = 0; i < voiceOptionsArray.length; i++) {
499
- if (voiceOptionsArray[i].name === voice) {
500
- return voiceOptionsArray[i].celebratingImage;
501
- }
500
+ try {
501
+ const exerciseVoice = voiceMap.get(voice) || {};
502
+ return exerciseVoice.celebratingImage || null;
503
+ } catch (error) {
504
+ console.error('Error retrieving celebrating image:', error);
505
+ return null;
502
506
  }
503
507
  };
504
508
  const handleKeyDown = event => {
@@ -50,7 +50,8 @@ function CreateBot({
50
50
  isUpgradePossible: true
51
51
  },
52
52
  langChar,
53
- isUserInternal
53
+ isUserInternal,
54
+ verificationStatus
54
55
  }) {
55
56
  const difficultyOptions = difficulties.map((d, idx) => {
56
57
  const keyId = `creabotvoicx_${(0, _index.randomId)()}${idx}`;
@@ -72,7 +73,8 @@ function CreateBot({
72
73
  subscription: subscription,
73
74
  voiceOptions: voices,
74
75
  langChar: langChar,
75
- isUserInternal: isUserInternal
76
+ isUserInternal: isUserInternal,
77
+ verificationStatus: verificationStatus
76
78
  });
77
79
  }
78
80
  CreateBot.propTypes = {};
@@ -107,7 +107,7 @@ function BotSettings({
107
107
  })]
108
108
  })]
109
109
  })]
110
- }), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Grid, {
110
+ }), process.env.REACT_APP_STAGE === "dev" && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Grid, {
111
111
  item: true,
112
112
  xs: 12,
113
113
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
@@ -150,7 +150,7 @@ function Confirmation({
150
150
  gutterBottom: true,
151
151
  display: "block",
152
152
  children: t("advanced_bot_desc")
153
- }), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.FormControl, {
153
+ }), process.env.REACT_APP_STAGE === "dev" && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.FormControl, {
154
154
  component: "fieldset",
155
155
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.FormLabel, {
156
156
  component: "legend",
@@ -24,7 +24,8 @@ function CreateClassroom({
24
24
  subscription = {
25
25
  isUpgradePossible: true
26
26
  },
27
- learnLang
27
+ learnLang,
28
+ verificationStatus
28
29
  }) {
29
30
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_MultiStepForm.default, {
30
31
  initialValues: {
@@ -49,7 +50,8 @@ function CreateClassroom({
49
50
  languages: languages,
50
51
  forLanguages: forLanguages,
51
52
  fileSizeLimit: fileSizeLimit,
52
- subscription: subscription
53
+ subscription: subscription,
54
+ verificationStatus: verificationStatus
53
55
  });
54
56
  }
55
57
  CreateClassroom.propTypes = {};
@@ -17,6 +17,7 @@ function Customization({
17
17
  handleChange,
18
18
  values,
19
19
  fileSizeLimit,
20
+ verificationStatus,
20
21
  isUpdateClassroom = false
21
22
  }) {
22
23
  const {
@@ -45,7 +46,8 @@ function Customization({
45
46
  handleChange: handleChange,
46
47
  fileSizeLimit: fileSizeLimit,
47
48
  previewComponent: _PreviewCard.default,
48
- isBanner: false
49
+ isBanner: false,
50
+ verificationStatus: verificationStatus
49
51
  })
50
52
  })]
51
53
  }), isUpdateClassroom ? /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Grid, {
@@ -65,7 +67,8 @@ function Customization({
65
67
  fileSizeLimit: fileSizeLimit,
66
68
  previewComponent: _PreviewCard.default,
67
69
  isBanner: true,
68
- aspect: 16 / 2.5
70
+ aspect: 16 / 2.5,
71
+ verificationStatus: verificationStatus
69
72
  })
70
73
  })]
71
74
  }) : null]
@@ -24,6 +24,7 @@ function CreateCourse({
24
24
  forLanguages = {},
25
25
  fileSizeLimit,
26
26
  userImage,
27
+ verificationStatus,
27
28
  subscription = {
28
29
  isUpgradePossible: true
29
30
  },
@@ -58,7 +59,8 @@ function CreateCourse({
58
59
  languageOptions: languages,
59
60
  forLanguageOptions: forLanguages,
60
61
  fileSizeLimit: fileSizeLimit,
61
- subscription: subscription
62
+ subscription: subscription,
63
+ verificationStatus: verificationStatus
62
64
  });
63
65
  }
64
66
  CreateCourse.propTypes = {};
@@ -17,7 +17,8 @@ function Customization({
17
17
  handleChange,
18
18
  values,
19
19
  fileSizeLimit,
20
- isUpdateCourse = false
20
+ isUpdateCourse = false,
21
+ verificationStatus
21
22
  }) {
22
23
  const {
23
24
  picture,
@@ -45,7 +46,8 @@ function Customization({
45
46
  handleChange: handleChange,
46
47
  fileSizeLimit: fileSizeLimit,
47
48
  previewComponent: _PreviewCard.default,
48
- isBanner: false
49
+ isBanner: false,
50
+ verificationStatus: verificationStatus
49
51
  })
50
52
  })]
51
53
  }), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Grid, {
@@ -65,7 +67,8 @@ function Customization({
65
67
  fileSizeLimit: fileSizeLimit,
66
68
  previewComponent: _PreviewCard.default,
67
69
  isBanner: true,
68
- aspect: 16 / 2.5
70
+ aspect: 16 / 2.5,
71
+ verificationStatus: verificationStatus
69
72
  })
70
73
  })]
71
74
  })]
@@ -62,7 +62,8 @@ function CreateRoleplay({
62
62
  isUpgradePossible: true
63
63
  },
64
64
  langChar,
65
- isUserInternal
65
+ isUserInternal,
66
+ verificationStatus
66
67
  }) {
67
68
  const difficultyOptions = difficulties.map((d, idx) => {
68
69
  const keyId = `crearolax${(0, _index.randomId)()}${idx}`;
@@ -85,7 +86,8 @@ function CreateRoleplay({
85
86
  fileSizeLimit: fileSizeLimit,
86
87
  subscription: subscription,
87
88
  langChar: langChar,
88
- isUserInternal: isUserInternal
89
+ isUserInternal: isUserInternal,
90
+ verificationStatus: verificationStatus
89
91
  });
90
92
  }
91
93
  CreateRoleplay.propTypes = {};
@@ -60,7 +60,8 @@ function CreateRoleplayHook({
60
60
  fileSizeLimit,
61
61
  subscription = {
62
62
  isUpgradePossible: true
63
- }
63
+ },
64
+ verificationStatus
64
65
  }) {
65
66
  const difficultyOptions = difficulties.map((d, idx) => {
66
67
  const keyId = `crearolax${(0, _index.randomId)()}${idx}`;
@@ -81,7 +82,8 @@ function CreateRoleplayHook({
81
82
  avatars: avatars,
82
83
  difficultyOptions: difficultyOptions,
83
84
  fileSizeLimit: fileSizeLimit,
84
- subscription: subscription
85
+ subscription: subscription,
86
+ verificationStatus: verificationStatus
85
87
  });
86
88
  }
87
89
  CreateRoleplayHook.propTypes = {};
@@ -225,7 +225,8 @@ function RoleplayInformation({
225
225
  handleSpeak,
226
226
  avatars,
227
227
  fileSizeLimit,
228
- isUserInternal
228
+ isUserInternal,
229
+ verificationStatus
229
230
  }) {
230
231
  const formContext = (0, _reactHookForm.useFormContext)();
231
232
  const {
@@ -335,7 +336,8 @@ function RoleplayInformation({
335
336
  value: value,
336
337
  handleChange: onChange,
337
338
  fileSizeLimit: fileSizeLimit,
338
- previewComponent: _PreviewCard.default
339
+ previewComponent: _PreviewCard.default,
340
+ verificationStatus: verificationStatus
339
341
  })
340
342
  })
341
343
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Grid, {
@@ -17,7 +17,8 @@ function Customization({
17
17
  handleChange,
18
18
  values,
19
19
  fileSizeLimit,
20
- isUpdateTopic = false
20
+ isUpdateTopic = false,
21
+ verificationStatus
21
22
  }) {
22
23
  const {
23
24
  picture,
@@ -45,7 +46,8 @@ function Customization({
45
46
  handleChange: handleChange,
46
47
  fileSizeLimit: fileSizeLimit,
47
48
  previewComponent: _PreviewCard.default,
48
- isBanner: false
49
+ isBanner: false,
50
+ verificationStatus: verificationStatus
49
51
  })
50
52
  })]
51
53
  }), isUpdateTopic ? /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Grid, {
@@ -65,7 +67,8 @@ function Customization({
65
67
  fileSizeLimit: fileSizeLimit,
66
68
  previewComponent: _PreviewCard.default,
67
69
  isBanner: true,
68
- aspect: 16 / 2.5
70
+ aspect: 16 / 2.5,
71
+ verificationStatus: verificationStatus
69
72
  })
70
73
  })]
71
74
  }) : null]
@@ -191,7 +191,7 @@ TopicInformation.label = "topic_information";
191
191
  TopicInformation.validationSchema = Yup.object().shape({
192
192
  topicName: Yup.string().required("required").test("noSpecialChars", "no_special_characters", value => !(0, _utils.containsInvalidSymbols)(value)),
193
193
  description: Yup.string().required("required").test("noSpecialChars", "no_special_characters", value => !(0, _utils.containsInvalidSymbols)(value)),
194
- topicGoal: Yup.string().test("noSpecialChars", "no_special_characters", value => !(0, _utils.containsInvalidSymbols)(value)),
194
+ topicGoal: Yup.string().test("noSpecialChars", "no_special_characters", value => !(0, _utils.containsInvalidSymbols)(value)).nullable(),
195
195
  difficulty: Yup.string().required("required"),
196
196
  picture: Yup.string().nullable(),
197
197
  tags: Yup.array(Yup.string().test("noSpecialChars", "no_special_characters", value => !(0, _utils.containsInvalidSymbols)(value))).nullable()
@@ -47,7 +47,8 @@ function UpdateClassroom({
47
47
  courses,
48
48
  scrollToDiscuss,
49
49
  setScrollToDiscuss,
50
- isClassroomArchived = false
50
+ isClassroomArchived = false,
51
+ verificationStatus
51
52
  }) {
52
53
  const {
53
54
  classes
@@ -278,7 +279,8 @@ function UpdateClassroom({
278
279
  values: values,
279
280
  fileSizeLimit: fileSizeLimit,
280
281
  isUpdateClassroom: true,
281
- ...otherProps
282
+ ...otherProps,
283
+ verificationStatus: verificationStatus
282
284
  })
283
285
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Divider, {}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.CardActions, {
284
286
  className: classes.padding,
@@ -40,7 +40,8 @@ function UpdateCourse({
40
40
  languages,
41
41
  forLanguages,
42
42
  fileSizeLimit,
43
- subscription
43
+ subscription,
44
+ verificationStatus
44
45
  }) {
45
46
  const difficultyOptions = difficulties.map((d, idx) => {
46
47
  const keyId = `crearolax${(0, _index.randomId)()}${idx}`;
@@ -229,6 +230,7 @@ function UpdateCourse({
229
230
  values: values,
230
231
  fileSizeLimit: fileSizeLimit,
231
232
  isUpdateCourse: true,
233
+ verificationStatus: verificationStatus,
232
234
  ...otherProps
233
235
  })
234
236
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Divider, {}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.CardActions, {
@@ -55,7 +55,8 @@ function UpdateTopic({
55
55
  voices = {},
56
56
  handleSpeak,
57
57
  learnLang,
58
- isUserInternal
58
+ isUserInternal,
59
+ verificationStatus
59
60
  }) {
60
61
  const {
61
62
  classes
@@ -251,6 +252,7 @@ function UpdateTopic({
251
252
  values: values,
252
253
  fileSizeLimit: fileSizeLimit,
253
254
  isUpdateTopic: true,
255
+ verificationStatus: verificationStatus,
254
256
  ...otherProps
255
257
  })
256
258
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_Divider.default, {}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_CardActions.default, {
@@ -662,7 +662,7 @@ function BotListItem({
662
662
  children: isBotHiddenState ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_VisibilityOff.default, {}) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_Visibility.default, {})
663
663
  })
664
664
  })
665
- }), isCreator && isLargeScreen ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Tooltip, {
665
+ }), isCreator && isLargeScreen && process.env.REACT_APP_STAGE === "dev" ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Tooltip, {
666
666
  title: isBotAdvanced ? t("unmark_as_advanced_bot") : t("mark_as_advanced_bot"),
667
667
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.IconButton, {
668
668
  "data-cy": "mark_advanced_bot",
@@ -204,7 +204,7 @@ function Roleplay({
204
204
  })
205
205
  })]
206
206
  })) : /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.ListItemButton, {
207
- onClick: () => handleRoleplaySelected("roleplay-story"),
207
+ onClick: handleRoleplaySelected("roleplay-story"),
208
208
  disabled: isRoleplaySelected || isExerciseSelected || !isRoleplayValid,
209
209
  sx: {
210
210
  display: "flex",
@@ -20,6 +20,7 @@ var _reactCountdownCircleTimer = require("react-countdown-circle-timer");
20
20
  var _PlayArrow = _interopRequireDefault(require("@mui/icons-material/PlayArrow"));
21
21
  var _Pause = _interopRequireDefault(require("@mui/icons-material/Pause"));
22
22
  var _reactBeautifulDnd = require("react-beautiful-dnd");
23
+ var _voiceImages = _interopRequireDefault(require("../../utils/voiceImages"));
23
24
  var _index = require("../../utils/index");
24
25
  var _useWordBankFocus = _interopRequireDefault(require("../../hooks/useWordBankFocus"));
25
26
  var _jsxRuntime = require("react/jsx-runtime");
@@ -182,20 +183,23 @@ function LiveListener({
182
183
  speak(currentQuestion.phrase, voice, false, "#currentPhrase", voiceLanguageCode, false, voicePitch, handleFinishedInitialSpeaking);
183
184
  }
184
185
  }, [currentQuestion?.phrase, isCreator]);
186
+ const voiceMap = (0, _voiceImages.default)(voices || []);
185
187
  const getVoiceImage = () => {
186
- let voiceOptionsArray = voiceLanguageCode && voices[voiceLanguageCode] ? voices[voiceLanguageCode].voiceOptions : [];
187
- for (let i = 0; i < voiceOptionsArray.length; i++) {
188
- if (voiceOptionsArray[i].name === voice) {
189
- return voiceOptionsArray[i].speakingImage;
190
- }
188
+ try {
189
+ const exerciseVoice = voiceMap.get(voice) || {};
190
+ return exerciseVoice.speakingImage || null;
191
+ } catch (error) {
192
+ console.error('Error retrieving voice image:', error);
193
+ return null;
191
194
  }
192
195
  };
193
196
  const getNualaCelebratingImage = () => {
194
- let voiceOptionsArray = voiceLanguageCode && voices[voiceLanguageCode] ? voices[voiceLanguageCode].voiceOptions : [];
195
- for (let i = 0; i < voiceOptionsArray.length; i++) {
196
- if (voiceOptionsArray[i].name === voice) {
197
- return voiceOptionsArray[i].celebratingImage;
198
- }
197
+ try {
198
+ const exerciseVoice = voiceMap.get(voice) || {};
199
+ return exerciseVoice.celebratingImage || null;
200
+ } catch (error) {
201
+ console.error('Error retrieving celebrating image:', error);
202
+ return null;
199
203
  }
200
204
  };
201
205
  const handleOnDragEnd = result => {
@@ -7,6 +7,8 @@ exports.default = void 0;
7
7
  var _react = require("react");
8
8
  var _material = require("@mui/material");
9
9
  var _mui = require("tss-react/mui");
10
+ var _Pause = _interopRequireDefault(require("@mui/icons-material/Pause"));
11
+ var _PlayArrow = _interopRequireDefault(require("@mui/icons-material/PlayArrow"));
10
12
  var _AccountBalance = _interopRequireDefault(require("@mui/icons-material/AccountBalance"));
11
13
  var _InputHelper = _interopRequireDefault(require("../../Forms/InputHelper"));
12
14
  var _AnswerResult = _interopRequireDefault(require("../../Misc/AnswerResult"));
@@ -20,8 +22,7 @@ var _reactCountdownCircleTimer = require("react-countdown-circle-timer");
20
22
  var _styles = require("@mui/material/styles");
21
23
  var _reactBeautifulDnd = require("react-beautiful-dnd");
22
24
  var _index = require("../../utils/index");
23
- var _Pause = _interopRequireDefault(require("@mui/icons-material/Pause"));
24
- var _PlayArrow = _interopRequireDefault(require("@mui/icons-material/PlayArrow"));
25
+ var _voiceImages = _interopRequireDefault(require("../../utils/voiceImages"));
25
26
  var _jsxRuntime = require("react/jsx-runtime");
26
27
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
27
28
  // utils
@@ -207,20 +208,23 @@ function LiveTranslator({
207
208
  speak(currentQuestion.phrase, voice, false, "#currentPhrase", voiceLanguageCode, false, voicePitch, handleFinishedInitialSpeaking);
208
209
  }
209
210
  }, [currentQuestion?.phrase, isCreator]);
211
+ const voiceMap = (0, _voiceImages.default)(voices || []);
210
212
  const getVoiceImage = () => {
211
- let voiceOptionsArray = voiceLanguageCode && voices[voiceLanguageCode] ? voices[voiceLanguageCode].voiceOptions : [];
212
- for (let i = 0; i < voiceOptionsArray.length; i++) {
213
- if (voiceOptionsArray[i].name === voice) {
214
- return voiceOptionsArray[i].speakingImage;
215
- }
213
+ try {
214
+ const exerciseVoice = voiceMap.get(voice) || {};
215
+ return exerciseVoice.speakingImage || null;
216
+ } catch (error) {
217
+ console.error('Error retrieving voice image:', error);
218
+ return null;
216
219
  }
217
220
  };
218
221
  const getNualaCelebratingImage = () => {
219
- let voiceOptionsArray = voiceLanguageCode && voices[voiceLanguageCode] ? voices[voiceLanguageCode].voiceOptions : [];
220
- for (let i = 0; i < voiceOptionsArray.length; i++) {
221
- if (voiceOptionsArray[i].name === voice) {
222
- return voiceOptionsArray[i].celebratingImage;
223
- }
222
+ try {
223
+ const exerciseVoice = voiceMap.get(voice) || {};
224
+ return exerciseVoice.celebratingImage || null;
225
+ } catch (error) {
226
+ console.error('Error retrieving celebrating image:', error);
227
+ return null;
224
228
  }
225
229
  };
226
230
  const handleOnDragEnd = result => {
@@ -239,9 +239,9 @@ function HoverText({
239
239
  voicePitch: voicePitch,
240
240
  voiceSpeed: voiceSpeed,
241
241
  muteSound: muteSound
242
- }, index)), formattedSource && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactMarkdown.default, {
242
+ }, index)), formattedSource && /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactMarkdown.default, {
243
243
  components: components,
244
- children: [" ", formattedSource, " "]
244
+ children: formattedSource
245
245
  })]
246
246
  })
247
247
  });
@@ -1098,7 +1098,8 @@ function Classroom({
1098
1098
  scrollToDiscuss: scrollToDiscuss,
1099
1099
  setScrollToDiscuss: setScrollToDiscuss,
1100
1100
  isClassroomArchived: isArchived,
1101
- classroomMembers: classroomMembers
1101
+ classroomMembers: classroomMembers,
1102
+ verificationStatus: verificationStatus
1102
1103
  })
1103
1104
  }, `tab-content-settings`)
1104
1105
  }] : [])];
@@ -751,7 +751,8 @@ function Course({
751
751
  forLanguages: forLanguages,
752
752
  onSubmit: handleUpdateCourse,
753
753
  fileSizeLimit: fileSizeLimit,
754
- subscription: subscription
754
+ subscription: subscription,
755
+ verificationStatus: verificationStatus
755
756
  })
756
757
  }, `tab-content-settings`)
757
758
  }] : [])];
@@ -785,7 +785,8 @@ function Topic({
785
785
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Box, {
786
786
  py: 1,
787
787
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Phrases.default, {
788
- t: t
788
+ t: t,
789
+ verificationStatus: verificationStatus
789
790
  })
790
791
  })]
791
792
  })]
@@ -1249,7 +1250,8 @@ function Topic({
1249
1250
  voices: voices,
1250
1251
  handleSpeak: handleSpeak,
1251
1252
  learnLang: learnLang,
1252
- isUserInternal: isUserInternal
1253
+ isUserInternal: isUserInternal,
1254
+ verificationStatus: verificationStatus
1253
1255
  })
1254
1256
  })]
1255
1257
  }), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Grid, {
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = getVoiceImages;
7
+ function getVoiceImages(voices) {
8
+ const voiceMap = Object.values(voices || []).flatMap(language => language.voiceOptions || []).reduce((acc, voice) => {
9
+ if (voice && voice.name) {
10
+ acc.set(voice.name, {
11
+ speakingImage: voice.speakingImage || null,
12
+ celebratingImage: voice.celebratingImage || null,
13
+ userImage: voice.userImage || null,
14
+ engine: voice.engine || '',
15
+ provider: voice.provider || '',
16
+ isNeuralOnly: voice.isNeuralOnly || false
17
+ });
18
+ }
19
+ return acc;
20
+ }, new Map());
21
+ return voiceMap;
22
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nualang/nualang-ui-components",
3
- "version": "0.1.1202",
3
+ "version": "0.1.1204",
4
4
  "main": "dist/index.js",
5
5
  "files": [
6
6
  "dist",