@nualang/nualang-ui-components 0.1.1282 → 0.1.1284

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.
@@ -38,7 +38,11 @@ const useStyles = (0, _mui.makeStyles)()((theme, {
38
38
  color: isPrimaryColor ? theme.palette.primary.contrastText : null
39
39
  },
40
40
  root: {
41
- flexShrink: 0
41
+ flexShrink: 0,
42
+ alignItems: "flex-start",
43
+ minHeight: "auto",
44
+ paddingTop: theme.spacing(1),
45
+ paddingBottom: theme.spacing(1)
42
46
  },
43
47
  micButton: {
44
48
  color: isListening ? theme.palette.error.main : "inherit"
@@ -95,7 +99,8 @@ function BottomBar({
95
99
  handleOpenConfidence,
96
100
  finalTranscript,
97
101
  inputRef,
98
- authenticated
102
+ authenticated,
103
+ isChallengeBot = false
99
104
  }) {
100
105
  const {
101
106
  classes
@@ -114,6 +119,7 @@ function BottomBar({
114
119
  };
115
120
  const textInput = (0, _react.useRef)(null);
116
121
  const activeRef = inputRef ? inputRef : textInput;
122
+ const isSmallScreen = (0, _useMediaQuery.default)(theme.breakpoints.down("md"));
117
123
  const TextInput = /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
118
124
  className: classes.input,
119
125
  id: "keyboardInput",
@@ -127,7 +133,7 @@ function BottomBar({
127
133
  onKeyPress: handleKeyPress,
128
134
  placeholder: placeholder,
129
135
  inputProps: {
130
- maxLength: 200,
136
+ maxLength: isChallengeBot ? 600 : 200,
131
137
  sx: theme => ({
132
138
  "&::placeholder": {
133
139
  color: theme.palette.mode === "light" ? _colors.grey[200] : _colors.grey[800],
@@ -137,6 +143,7 @@ function BottomBar({
137
143
  },
138
144
  disableUnderline: true,
139
145
  multiline: true,
146
+ rows: isChallengeBot ? 3 : 1,
140
147
  autoComplete: autoComplete,
141
148
  inputRef: activeRef,
142
149
  onClick: handleSelectCurrentInput,
@@ -146,18 +153,30 @@ function BottomBar({
146
153
  fontWeight: 800
147
154
  }
148
155
  }),
149
- endAdornment: /*#__PURE__*/(0, _jsxRuntime.jsx)(_InputHelper.Adornment, {
150
- t: t,
151
- emoji: true,
152
- name: inputName,
153
- value: inputValue,
154
- onChange: handleInputChange,
155
- adornmentPosition: "end",
156
- iconButtonEdge: false,
157
- characters: characters,
158
- activeRef: activeRef,
159
- whiteIcon: true,
160
- whiteCharacters: (disableInput || isListening) && theme.palette.mode === "dark" ? true : false
156
+ endAdornment: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
157
+ children: [!isSmallScreen && /*#__PURE__*/(0, _jsxRuntime.jsx)(_Typography.default, {
158
+ variant: "caption",
159
+ sx: {
160
+ color: "inherit",
161
+ opacity: inputValue.length >= (isChallengeBot ? 600 : 200) ? 1 : 0.7,
162
+ marginRight: 1,
163
+ fontWeight: 700,
164
+ fontSize: "0.75rem"
165
+ },
166
+ children: `${inputValue.length}/${isChallengeBot ? 600 : 200}`
167
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_InputHelper.Adornment, {
168
+ t: t,
169
+ emoji: true,
170
+ name: inputName,
171
+ value: inputValue,
172
+ onChange: handleInputChange,
173
+ adornmentPosition: "end",
174
+ iconButtonEdge: false,
175
+ characters: characters,
176
+ activeRef: activeRef,
177
+ whiteIcon: true,
178
+ whiteCharacters: (disableInput || isListening) && theme.palette.mode === "dark" ? true : false
179
+ })]
161
180
  }),
162
181
  classes: {
163
182
  root: classes.inputRoot,
@@ -165,7 +184,6 @@ function BottomBar({
165
184
  }
166
185
  })
167
186
  });
168
- const isSmallScreen = (0, _useMediaQuery.default)(theme.breakpoints.down("md"));
169
187
  const buttonRef = (0, _react.useRef)(null);
170
188
  (0, _react.useEffect)(() => {
171
189
  const handleEnterKey = event => {
@@ -186,8 +204,6 @@ function BottomBar({
186
204
  (0, _react.useEffect)(() => {
187
205
  if (activeRef.current) {
188
206
  activeRef.current.focus();
189
- const length = inputValue.length;
190
- activeRef.current.setSelectionRange(length, length);
191
207
  }
192
208
  }, [inputValue]);
193
209
  return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_Paper.default, {
package/dist/Chat/Chat.js CHANGED
@@ -99,11 +99,21 @@ function Chat({
99
99
  answerCounts,
100
100
  noAnswerCounts,
101
101
  isDynamicResponsesEnabled,
102
- isUserInternal
102
+ isUserInternal,
103
+ isChallengeBot = false
103
104
  }) {
104
105
  const {
105
106
  classes
106
107
  } = useStyles();
108
+ const [isMessageLoading, setIsMessageLoading] = (0, _react.useState)(false);
109
+ (0, _react.useEffect)(() => {
110
+ if (!Array.isArray(messages) || messages.length === 0) {
111
+ setIsMessageLoading(false);
112
+ return;
113
+ }
114
+ const hasLoadingMessage = messages.some(message => typeof message === 'object' && message?.isLoading === true);
115
+ setIsMessageLoading(hasLoadingMessage);
116
+ }, [messages]);
107
117
  return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
108
118
  className: classes.root,
109
119
  children: [!viewAttemptMode && !isLiveGame && /*#__PURE__*/(0, _jsxRuntime.jsx)(_TopBar.default, {
@@ -169,7 +179,7 @@ function Chat({
169
179
  t: t,
170
180
  inputName: inputName,
171
181
  inputValue: inputValue,
172
- disableInput: disableInput,
182
+ disableInput: disableInput || isMessageLoading,
173
183
  focusInput: focusInput,
174
184
  handleInputChange: handleInputChange,
175
185
  isListening: isListening,
@@ -191,7 +201,8 @@ function Chat({
191
201
  finalTranscript: finalTranscript,
192
202
  inputRef: inputRef,
193
203
  authenticated: authenticated,
194
- placeholder: placeholder
204
+ placeholder: placeholder,
205
+ isChallengeBot: isChallengeBot
195
206
  })]
196
207
  });
197
208
  }
@@ -61,6 +61,9 @@ function SelectClassroom({
61
61
  button: true,
62
62
  component: _reactRouterDom.Link,
63
63
  to: path,
64
+ sx: {
65
+ color: 'inherit'
66
+ },
64
67
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_ListItemAvatar.default, {
65
68
  children: picture ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_Avatar.default, {
66
69
  src: picture,
@@ -203,7 +203,15 @@ function VarListItem({
203
203
  type: "text",
204
204
  multiline: true,
205
205
  fullWidth: true,
206
- onChange: handleUpdateVariable,
206
+ onChange: e => {
207
+ const cleaned = e.target.value.replace(/\s+/g, " ").trim();
208
+ handleUpdateVariable({
209
+ target: {
210
+ name: varName,
211
+ value: cleaned
212
+ }
213
+ });
214
+ },
207
215
  onBlur: handleOnBlur,
208
216
  onFocus: handleSelectCurrentInput,
209
217
  inputProps: {
@@ -647,7 +647,8 @@ function Bot({
647
647
  isSpeaking: isSpeaking,
648
648
  isSpeakingTextContainer: isSpeakingTextContainer,
649
649
  isDynamicResponsesEnabled: isDynamicResponsesClassroomEnabled,
650
- isUserInternal: isUserInternal
650
+ isUserInternal: isUserInternal,
651
+ isChallengeBot: bot.isChallengeBot
651
652
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ResponsiveDialog.default, {
652
653
  open: instructionDialogOpen,
653
654
  handleClose: handleCloseInstructions,
@@ -400,7 +400,7 @@ function Listener({
400
400
  })]
401
401
  }),
402
402
  spotlightPadding: 8,
403
- target: "#listeningText"
403
+ target: "#listeningTextAnchor"
404
404
  }, {
405
405
  content: /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
406
406
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("h2", {
@@ -420,7 +420,8 @@ function Listener({
420
420
  })]
421
421
  }),
422
422
  spotlightPadding: 8,
423
- target: "#skipButton"
423
+ target: "#skipButton",
424
+ disableScrollParentFix: false
424
425
  }, {
425
426
  content: /*#__PURE__*/(0, _jsxRuntime.jsx)("h2", {
426
427
  children: t("change_voice_speed")
@@ -842,30 +843,36 @@ function Listener({
842
843
  width: "100%",
843
844
  maxWidth: `250px !important`
844
845
  },
845
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_InputHelper.default, {
846
- t: t,
847
- value: listeningText,
848
- onChange: handleInputChange,
849
- onKeyDown: e => {
850
- if (e.key === "Enter") {
851
- handleContinue(false);
852
- e.stopPropagation();
853
- }
846
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
847
+ id: "listeningTextAnchor",
848
+ style: {
849
+ position: "relative"
854
850
  },
855
- id: "listeningText",
856
- name: "listeningText",
857
- label: t("language_phrase", {
858
- language: (0, _index.capitalize)(t(learnLang.toLowerCase()))
859
- }),
860
- type: "text",
861
- role: "textbox",
862
- "aria-multiline": "true",
863
- "aria-labelledby": "what-do-you-hear",
864
- variant: "outlined",
865
- fullWidth: true,
866
- multiline: true,
867
- autoComplete: "off",
868
- characters: learnLangCharacters ? learnLangCharacters : null
851
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_InputHelper.default, {
852
+ t: t,
853
+ value: listeningText,
854
+ onChange: handleInputChange,
855
+ onKeyDown: e => {
856
+ if (e.key === "Enter") {
857
+ handleContinue(false);
858
+ e.stopPropagation();
859
+ }
860
+ },
861
+ id: "listeningText",
862
+ name: "listeningText",
863
+ label: t("language_phrase", {
864
+ language: (0, _index.capitalize)(t(learnLang.toLowerCase()))
865
+ }),
866
+ type: "text",
867
+ role: "textbox",
868
+ "aria-multiline": "true",
869
+ "aria-labelledby": "what-do-you-hear",
870
+ variant: "outlined",
871
+ fullWidth: true,
872
+ multiline: true,
873
+ autoComplete: "off",
874
+ characters: learnLangCharacters ? learnLangCharacters : null
875
+ })
869
876
  })
870
877
  }), isWordBankEnabled && /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Grid, {
871
878
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Tooltip, {
@@ -989,6 +996,7 @@ function Listener({
989
996
  showSkipButton: true,
990
997
  steps: steps,
991
998
  scrollOffset: 100,
999
+ disableScrollParentFix: true,
992
1000
  styles: {
993
1001
  options: {
994
1002
  zIndex: 10000,
@@ -61,7 +61,8 @@ const useStyles = (0, _mui.makeStyles)()(theme => ({
61
61
  },
62
62
  flexGrow: 1,
63
63
  width: "100%",
64
- padding: theme.spacing(4)
64
+ padding: theme.spacing(4),
65
+ boxSizing: "border-box"
65
66
  },
66
67
  progress: {
67
68
  width: "100%",
@@ -383,7 +384,7 @@ function Translator({
383
384
  })]
384
385
  }),
385
386
  spotlightPadding: 8,
386
- target: "#translationText"
387
+ target: "#translationTextAnchor"
387
388
  }, {
388
389
  content: /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
389
390
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("h2", {
@@ -403,7 +404,8 @@ function Translator({
403
404
  })]
404
405
  }),
405
406
  spotlightPadding: 8,
406
- target: "#skipButton"
407
+ target: "#skipButton",
408
+ disableScrollParentFix: false
407
409
  }, {
408
410
  content: /*#__PURE__*/(0, _jsxRuntime.jsx)("h2", {
409
411
  children: t("change_voice_speed")
@@ -862,43 +864,49 @@ function Translator({
862
864
  })]
863
865
  })]
864
866
  }), !isKeyboardHidden && !useWordBank && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
865
- children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Grid, {
867
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Grid, {
866
868
  sx: {
867
869
  width: "100%",
868
870
  maxWidth: `250px !important`
869
871
  },
870
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
871
- className: classes.srOnly,
872
- children: translationText
873
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_InputHelper.default, {
874
- t: t,
875
- value: translationText,
876
- onChange: handleInputChange,
877
- onKeyDown: e => {
878
- if (e.key === "Enter") {
879
- handleContinue(false);
880
- e.stopPropagation();
881
- }
872
+ children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
873
+ id: "translationTextAnchor",
874
+ style: {
875
+ position: "relative"
882
876
  },
883
- id: "translationText",
884
- name: "translationText",
885
- "aria-label": t("language_translation", {
886
- language: (0, _index.capitalize)(t(forLang.toLowerCase()))
887
- }),
888
- "data-cy": "translationText",
889
- label: t("language_translation", {
890
- language: (0, _index.capitalize)(t(forLang.toLowerCase()))
891
- }),
892
- type: "text",
893
- role: "textbox",
894
- "aria-multiline": "true",
895
- "aria-autocomplete": "none",
896
- variant: "outlined",
897
- multiline: true,
898
- fullWidth: true,
899
- autoComplete: "off",
900
- characters: forLangCharacters ? forLangCharacters : null
901
- })]
877
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
878
+ className: classes.srOnly,
879
+ children: translationText
880
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_InputHelper.default, {
881
+ t: t,
882
+ value: translationText,
883
+ onChange: handleInputChange,
884
+ onKeyDown: e => {
885
+ if (e.key === "Enter") {
886
+ handleContinue(false);
887
+ e.stopPropagation();
888
+ }
889
+ },
890
+ id: "translationText",
891
+ name: "translationText",
892
+ "aria-label": t("language_translation", {
893
+ language: (0, _index.capitalize)(t(forLang.toLowerCase()))
894
+ }),
895
+ "data-cy": "translationText",
896
+ label: t("language_translation", {
897
+ language: (0, _index.capitalize)(t(forLang.toLowerCase()))
898
+ }),
899
+ type: "text",
900
+ role: "textbox",
901
+ "aria-multiline": "true",
902
+ "aria-autocomplete": "none",
903
+ variant: "outlined",
904
+ multiline: true,
905
+ fullWidth: true,
906
+ autoComplete: "off",
907
+ characters: forLangCharacters ? forLangCharacters : null
908
+ })]
909
+ })
902
910
  }), isWordBankEnabled && /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Grid, {
903
911
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Tooltip, {
904
912
  title: t("use_wordbank_if_stuck"),
@@ -995,6 +1003,7 @@ function Translator({
995
1003
  showSkipButton: true,
996
1004
  steps: steps,
997
1005
  scrollOffset: 100,
1006
+ disableScrollParentFix: true,
998
1007
  styles: {
999
1008
  options: {
1000
1009
  zIndex: 10000,
@@ -43,7 +43,7 @@ function CreateBot({
43
43
  botAvatar: "",
44
44
  tags: [],
45
45
  phrasesToBoost: [],
46
- isAdvancedBot: false,
46
+ isChallengeBot: false,
47
47
  isDynamicResponsesEnabled: "enable"
48
48
  },
49
49
  learnLang,
@@ -32,7 +32,7 @@ function BotSettings({
32
32
  const {
33
33
  visibility,
34
34
  translationEnabled,
35
- isAdvancedBot,
35
+ isChallengeBot,
36
36
  isDynamicResponsesEnabled
37
37
  } = values;
38
38
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {
@@ -119,20 +119,19 @@ function BotSettings({
119
119
  component: "fieldset",
120
120
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.FormLabel, {
121
121
  component: "legend",
122
- children: t("advanced_bot")
122
+ children: t("challenge_bot")
123
123
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
124
124
  color: "textSecondary",
125
- children: t("advanced_bot_desc")
125
+ children: t("challenge_bot_desc")
126
126
  }), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.RadioGroup, {
127
127
  row: true,
128
128
  className: classes.group,
129
- "aria-label": "advancedBot",
130
- name: "isAdvancedBot",
131
- value: isAdvancedBot,
129
+ name: "isChallengeBot",
130
+ value: isChallengeBot,
132
131
  onChange: handleChange,
133
132
  onBlur: handleBlur,
134
- helperText: touched.isAdvancedBot ? errors.isAdvancedBot : "",
135
- error: touched.isAdvancedBot && Boolean(errors.isAdvancedBot),
133
+ helperText: touched.isChallengeBot ? errors.isChallengeBot : "",
134
+ error: touched.isChallengeBot && Boolean(errors.isChallengeBot),
136
135
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.FormControlLabel, {
137
136
  value: true,
138
137
  control: /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Radio, {}),
@@ -59,7 +59,7 @@ function Confirmation({
59
59
  visibility,
60
60
  translationEnabled,
61
61
  studentInstructions,
62
- isAdvancedBot,
62
+ isChallengeBot,
63
63
  isDynamicResponsesEnabled
64
64
  } = values;
65
65
  const [open, setOpen] = (0, _react.useState)(false);
@@ -151,17 +151,16 @@ function Confirmation({
151
151
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
152
152
  gutterBottom: true,
153
153
  display: "block",
154
- children: t("advanced_bot_desc")
154
+ children: t("challenge_bot_desc")
155
155
  }), process.env.REACT_APP_STAGE === "dev" && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.FormControl, {
156
156
  component: "fieldset",
157
157
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.FormLabel, {
158
158
  component: "legend",
159
- children: t("advanced_bot")
159
+ children: t("challenge_bot")
160
160
  }), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.RadioGroup, {
161
161
  className: classes.group,
162
- "aria-label": "advancedBot",
163
- name: "isAdvancedBot",
164
- value: isAdvancedBot,
162
+ name: "isChallengeBot",
163
+ value: isChallengeBot,
165
164
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.FormControlLabel, {
166
165
  disabled: true,
167
166
  value: true,
@@ -45,7 +45,7 @@ function UpdateBot({
45
45
  tags: [],
46
46
  phrasesToBoost: [],
47
47
  isDynamicResponsesEnabled: "enable",
48
- isAdvancedBot: false
48
+ isChallengeBot: false
49
49
  },
50
50
  verificationStatus,
51
51
  onSubmit,
@@ -83,7 +83,7 @@ function UpdateBot({
83
83
  tags,
84
84
  phrasesToBoost,
85
85
  isDynamicResponsesEnabled,
86
- isAdvancedBot
86
+ isChallengeBot
87
87
  } = initialValues;
88
88
  const difficultyOptions = difficulties.map((d, idx) => {
89
89
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_MenuItem.default, {
@@ -178,7 +178,7 @@ function UpdateBot({
178
178
  translationEnabled,
179
179
  picture,
180
180
  isDynamicResponsesEnabled,
181
- isAdvancedBot
181
+ isChallengeBot
182
182
  },
183
183
  enableReinitialize: enableReinitialize,
184
184
  validationSchema: _Steps.BotSettings.validationSchema,
@@ -27,6 +27,7 @@ var _immutabilityHelper = _interopRequireDefault(require("immutability-helper"))
27
27
  var _utils = require("../../utils");
28
28
  var _FlashOn = _interopRequireDefault(require("@mui/icons-material/FlashOn"));
29
29
  var _FlashOff = _interopRequireDefault(require("@mui/icons-material/FlashOff"));
30
+ var _Tooltip = require("@mui/material/Tooltip");
30
31
  var _Add = _interopRequireDefault(require("@mui/icons-material/Add"));
31
32
  var _RecordVoiceOver = _interopRequireDefault(require("@mui/icons-material/RecordVoiceOver"));
32
33
  var _SwapHoriz = _interopRequireDefault(require("@mui/icons-material/SwapHoriz"));
@@ -508,11 +509,11 @@ function BotListItem({
508
509
  } = params;
509
510
  const [anchorEl, setAnchorEl] = (0, _react.useState)(null);
510
511
  const [isBotHiddenState, setIsBotHiddenState] = (0, _react.useState)(bot.isBotHidden);
511
- const [isBotAdvanced, setIsBotAdvanced] = (0, _react.useState)(bot.isAdvancedBot || false);
512
+ const [isBotChallenge, setIsBotChallenge] = (0, _react.useState)(bot.isChallengeBot || false);
512
513
  const [isSelectClassroomDialogOpen, setIsSelectClassroomDialogOpen] = (0, _react.useState)(false);
513
514
  (0, _react.useEffect)(() => {
514
- setIsBotAdvanced(bot.isAdvancedBot);
515
- }, [bot.isAdvancedBot]);
515
+ setIsBotChallenge(bot.isChallengeBot);
516
+ }, [bot.isChallengeBot]);
516
517
  const ref = (0, _react.useRef)(null);
517
518
  const [{
518
519
  handlerId
@@ -607,14 +608,61 @@ function BotListItem({
607
608
  isBotHidden: !isBotHidden
608
609
  });
609
610
  };
610
- const markBotAsAdvanced = async () => {
611
+ const markBotAsChallenge = async () => {
611
612
  await handleUpdateBot(bot, {
612
- isAdvancedBot: !isBotAdvanced
613
+ isChallengeBot: !isBotChallenge
613
614
  });
614
- setIsBotAdvanced(!isBotAdvanced);
615
+ setIsBotChallenge(!isBotChallenge);
615
616
  };
616
617
  const botCompletions = numberOfBotCompletions(completions, bot.botId);
617
618
  const navigate = (0, _reactRouterDom.useNavigate)();
619
+ const ChallengeBotHtmlTooltip = (0, _system.styled)(({
620
+ className,
621
+ ...props
622
+ }) => /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Tooltip, {
623
+ ...props,
624
+ classes: {
625
+ popper: className
626
+ },
627
+ title: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_react.Fragment, {
628
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
629
+ style: {
630
+ fontWeight: "bold",
631
+ marginBottom: "8px"
632
+ },
633
+ children: t("challenge_mode")
634
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
635
+ style: {
636
+ marginBottom: "8px"
637
+ },
638
+ children: t("challenge_bot_desc")
639
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
640
+ style: {
641
+ fontSize: "12px"
642
+ },
643
+ children: t("freely_changed")
644
+ })]
645
+ })
646
+ }))(({
647
+ theme
648
+ }) => ({
649
+ [`& .${_Tooltip.tooltipClasses.tooltip}`]: {
650
+ padding: theme.spacing(2),
651
+ backgroundColor: theme.palette.background.paper,
652
+ color: theme.palette.text.primary,
653
+ fontSize: theme.typography.pxToRem(12),
654
+ border: `1px solid ${theme.palette.divider}`
655
+ },
656
+ [`& ul`]: {
657
+ listStyleType: "disc",
658
+ paddingLeft: theme.spacing(2),
659
+ margin: 0
660
+ },
661
+ [`& li`]: {
662
+ display: "list-item",
663
+ marginBottom: theme.spacing(0.5)
664
+ }
665
+ }));
618
666
  return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
619
667
  children: [(!isBotHiddenState || isCreator) && /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.ListItem, {
620
668
  ref: ref,
@@ -665,13 +713,13 @@ function BotListItem({
665
713
  })
666
714
  })
667
715
  }), isCreator && isLargeScreen && process.env.REACT_APP_STAGE === "dev" ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Tooltip, {
668
- title: isBotAdvanced ? t("unmark_as_advanced_bot") : t("mark_as_advanced_bot"),
716
+ title: isBotChallenge ? t("unmark_as_challenge_bot") : t("mark_as_challenge_bot"),
669
717
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.IconButton, {
670
- "data-cy": "mark_advanced_bot",
671
- onClick: markBotAsAdvanced,
672
- "aria-label": isBotAdvanced ? "Unmark bot as advanced" : "Mark bot as advanced",
718
+ "data-cy": "mark_challenge_bot",
719
+ onClick: markBotAsChallenge,
720
+ "aria-label": isBotChallenge ? t("unmark_as_challenge_bot") : t("mark_as_challenge_bot"),
673
721
  disabled: isCreator ? false : true,
674
- children: isBotAdvanced ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_FlashOn.default, {}) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_FlashOff.default, {})
722
+ children: isBotChallenge ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_FlashOn.default, {}) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_FlashOff.default, {})
675
723
  })
676
724
  }) : null, isCreator && isLargeScreen && /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Tooltip, {
677
725
  title: t("move_bot"),
@@ -709,7 +757,31 @@ function BotListItem({
709
757
  alt: ""
710
758
  })
711
759
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.ListItemText, {
712
- primary: isLargeScreen ? bot.botName || "" : /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
760
+ primary: isLargeScreen ? !isBotChallenge ? bot.botName || "" : /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Box, {
761
+ display: "flex",
762
+ alignItems: "center",
763
+ gap: "8px",
764
+ children: [bot.botName || "", /*#__PURE__*/(0, _jsxRuntime.jsx)(ChallengeBotHtmlTooltip, {
765
+ placement: "right",
766
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Chip, {
767
+ label: t("challenge_mode"),
768
+ size: "small",
769
+ variant: "outlined",
770
+ color: "primary"
771
+ })
772
+ })]
773
+ }) : !isBotChallenge ? /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
774
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Box, {
775
+ mb: 1,
776
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Avatar, {
777
+ src: bot.picture || bot.botAvatar || _index.default.bot,
778
+ alt: ""
779
+ })
780
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_Typography.default, {
781
+ variant: "body1",
782
+ children: bot.botName || ""
783
+ })]
784
+ }) : /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
713
785
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Box, {
714
786
  mb: 1,
715
787
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Avatar, {
@@ -719,6 +791,14 @@ function BotListItem({
719
791
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_Typography.default, {
720
792
  variant: "body1",
721
793
  children: bot.botName || ""
794
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(ChallengeBotHtmlTooltip, {
795
+ placement: "right",
796
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Chip, {
797
+ label: t("challenge_mode"),
798
+ size: "small",
799
+ variant: "outlined",
800
+ color: "primary"
801
+ })
722
802
  })]
723
803
  }),
724
804
  secondary: isLargeScreen ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Box, {
@@ -874,7 +954,7 @@ function Exercises(props) {
874
954
  trackRecommendedEvent,
875
955
  parentClassroom,
876
956
  isHeritageSpeaker,
877
- isAdvancedStudent
957
+ isChallengeModeStudent
878
958
  } = props;
879
959
  const params = (0, _reactRouterDom.useParams)();
880
960
  const {
@@ -1060,10 +1140,10 @@ function Exercises(props) {
1060
1140
  }
1061
1141
  }, [bots, botsStringified]);
1062
1142
  (0, _react.useEffect)(() => {
1063
- if (!isAdvancedStudent && !isCreator) {
1064
- setBotsArray(bots.filter(bot => !bot.isAdvancedBot || bot.isAdvancedBot === false));
1143
+ if (!isChallengeModeStudent && !isCreator) {
1144
+ setBotsArray(bots.filter(bot => !bot.isChallengeBot || bot.isChallengeBot === false));
1065
1145
  }
1066
- }, [bots, isAdvancedStudent, isCreator]);
1146
+ }, [bots, isChallengeModeStudent, isCreator]);
1067
1147
  const moveBot = (0, _react.useCallback)((dragIndex, hoverIndex) => {
1068
1148
  const dragBot = botsArray[dragIndex];
1069
1149
  const newBots = (0, _immutabilityHelper.default)(botsArray, {
@@ -137,7 +137,7 @@ function Member(props) {
137
137
  marginBottom: theme.spacing(0.5)
138
138
  }
139
139
  }));
140
- const AdvancedStudentHtmlTooltip = (0, _styles.styled)(({
140
+ const ChallengeModeHtmlTooltip = (0, _styles.styled)(({
141
141
  className,
142
142
  ...props
143
143
  }) => /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Tooltip, {
@@ -151,12 +151,12 @@ function Member(props) {
151
151
  fontWeight: "bold",
152
152
  marginBottom: "8px"
153
153
  },
154
- children: t("advanced_student")
154
+ children: t("challenge_student")
155
155
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
156
156
  style: {
157
157
  marginBottom: "8px"
158
158
  },
159
- children: t("advanced_student_desc")
159
+ children: t("challenge_student_desc")
160
160
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
161
161
  style: {
162
162
  fontSize: "12px"
@@ -213,14 +213,14 @@ function Member(props) {
213
213
  })
214
214
  })
215
215
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.ListItemText, {
216
- primary: featureFlags.heritageSpeakers && featureFlags.advancedStudents && member.isHeritageSpeaker && member.assignedLabels?.isAdvancedStudent ? /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Box, {
216
+ primary: featureFlags.classroomModes.readWrite && featureFlags.classroomModes.challenge && member.isHeritageSpeaker && member.assignedLabels?.isChallengeModeStudent ? /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Box, {
217
217
  display: "flex",
218
218
  alignItems: "center",
219
219
  gap: "8px",
220
- children: [member.username, /*#__PURE__*/(0, _jsxRuntime.jsx)(AdvancedStudentHtmlTooltip, {
220
+ children: [member.username, /*#__PURE__*/(0, _jsxRuntime.jsx)(ChallengeModeHtmlTooltip, {
221
221
  placement: "right",
222
222
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Chip, {
223
- label: t("advanced_student"),
223
+ label: t("challenge_student"),
224
224
  size: "small",
225
225
  variant: "outlined",
226
226
  color: "primary"
@@ -234,7 +234,7 @@ function Member(props) {
234
234
  color: "primary"
235
235
  })
236
236
  })]
237
- }) : featureFlags.heritageSpeakers && member.isHeritageSpeaker ? /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Box, {
237
+ }) : featureFlags.classroomModes.readWrite && member.isHeritageSpeaker ? /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Box, {
238
238
  display: "flex",
239
239
  alignItems: "center",
240
240
  gap: "8px",
@@ -247,14 +247,14 @@ function Member(props) {
247
247
  color: "primary"
248
248
  })
249
249
  })]
250
- }) : featureFlags.advancedStudents && member.assignedLabels?.isAdvancedStudent ? /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Box, {
250
+ }) : featureFlags.classroomModes.challenge && member.assignedLabels?.isChallengeModeStudent ? /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Box, {
251
251
  display: "flex",
252
252
  alignItems: "center",
253
253
  gap: "8px",
254
- children: [member.username, /*#__PURE__*/(0, _jsxRuntime.jsx)(AdvancedStudentHtmlTooltip, {
254
+ children: [member.username, /*#__PURE__*/(0, _jsxRuntime.jsx)(ChallengeModeHtmlTooltip, {
255
255
  placement: "right",
256
256
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Chip, {
257
- label: t("advanced_student"),
257
+ label: t("challenge_student"),
258
258
  size: "small",
259
259
  variant: "outlined",
260
260
  color: "primary"
@@ -276,7 +276,7 @@ function Member(props) {
276
276
  }), /*#__PURE__*/(0, _jsxRuntime.jsxs)(OverflowMenu, {
277
277
  anchorEl: anchorEl,
278
278
  handleClose: handleCloseMenu,
279
- children: [featureFlags.heritageSpeakers && (member.isHeritageSpeaker ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.MenuItem, {
279
+ children: [featureFlags.classroomModes.readWrite && (member.isHeritageSpeaker ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.MenuItem, {
280
280
  onClick: () => {
281
281
  handleUpdateClassroomMember(member.classroomId, member.memberId, {
282
282
  isHeritageSpeaker: false
@@ -299,31 +299,31 @@ function Member(props) {
299
299
  primary: t("mark_as_heritage_speaker")
300
300
  })
301
301
  })
302
- })), featureFlags.advancedStudents && (member.assignedLabels?.isAdvancedStudent ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.MenuItem, {
302
+ })), featureFlags.classroomModes.challenge && (member.assignedLabels?.isChallengeModeStudent ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.MenuItem, {
303
303
  onClick: () => {
304
304
  handleUpdateClassroomMember(member.classroomId, member.memberId, {
305
305
  assignedLabels: {
306
- isAdvancedStudent: false
306
+ isChallengeModeStudent: false
307
307
  }
308
308
  });
309
309
  },
310
- "aria-label": `Unmark as advanced student: ${member.username}`,
310
+ "aria-label": `Unmark as challenge student: ${member.username}`,
311
311
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.ListItemText, {
312
- primary: t("unmark_as_advanced_student")
312
+ primary: t("unmark_as_challenge_student")
313
313
  })
314
- }) : /*#__PURE__*/(0, _jsxRuntime.jsx)(AdvancedStudentHtmlTooltip, {
314
+ }) : /*#__PURE__*/(0, _jsxRuntime.jsx)(ChallengeModeHtmlTooltip, {
315
315
  placement: "right",
316
316
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.MenuItem, {
317
317
  onClick: () => {
318
318
  handleUpdateClassroomMember(member.classroomId, member.memberId, {
319
319
  assignedLabels: {
320
- isAdvancedStudent: true
320
+ isChallengeModeStudent: true
321
321
  }
322
322
  });
323
323
  },
324
- "aria-label": `Mark as advanced student: ${member.username}`,
324
+ "aria-label": `Mark as challenge student: ${member.username}`,
325
325
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.ListItemText, {
326
- primary: t("mark_as_advanced_student")
326
+ primary: t("mark_as_challenge_student")
327
327
  })
328
328
  })
329
329
  })), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.MenuItem, {
@@ -14,7 +14,9 @@ const useStyles = (0, _mui.makeStyles)()(theme => ({
14
14
  footer: {
15
15
  padding: theme.spacing(2),
16
16
  borderTop: `2px solid ${theme.palette.grey[300]}`,
17
- width: "100%"
17
+ width: "100%",
18
+ position: "sticky",
19
+ bottom: 0
18
20
  }
19
21
  }));
20
22
  function ExerciseBottomBar({
@@ -561,8 +561,6 @@ function Classroom({
561
561
  const [scheduledDynamicAi, setScheduledDynamicAi] = (0, _react.useState)(false);
562
562
  const isWaysideClassroom = classroom?.classroomId?.toLowerCase().includes("wayside");
563
563
  const [isSubscriptionExpired, setIsSubscriptionExpired] = (0, _react.useState)(false);
564
-
565
- // Joyride steps & state must be declared before any useEffect that reads `run`
566
564
  const joyrideSteps = [{
567
565
  content: /*#__PURE__*/(0, _jsxRuntime.jsx)("h2", {
568
566
  children: t(`${classroomCreatorWelcome}`)
@@ -628,7 +626,6 @@ function Classroom({
628
626
  if (scheduledDynamicAi && !run && !isPictureDialogOpen) {
629
627
  setDisplayDynamicAiDialog(true);
630
628
  setScheduledDynamicAi(false);
631
- // mark as displayed so it won't re-run on future page loads
632
629
  localStorage.setItem("displayDynamicAiDialog", "true");
633
630
  }
634
631
  }, [scheduledDynamicAi, run, isPictureDialogOpen]);
@@ -578,7 +578,7 @@ function Topic({
578
578
  topicGoal,
579
579
  isUserInternal,
580
580
  isHeritageSpeaker = false,
581
- isAdvancedStudent = false,
581
+ isChallengeModeStudent = false,
582
582
  ...otherProps
583
583
  }) {
584
584
  const {
@@ -769,7 +769,7 @@ function Topic({
769
769
  courseSettings: courseSettings,
770
770
  trackRecommendedEvent: trackRecommendedEvent,
771
771
  isHeritageSpeaker: isHeritageSpeaker,
772
- isAdvancedStudent: isAdvancedStudent
772
+ isChallengeModeStudent: isChallengeModeStudent
773
773
  })
774
774
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Box, {
775
775
  py: 1,
@@ -1106,7 +1106,7 @@ function Topic({
1106
1106
  handleDuplicateRoleplay: handleDuplicateRoleplay,
1107
1107
  isCreator: isCreator,
1108
1108
  isMember: isMember,
1109
- isAdvancedStudent: isAdvancedStudent,
1109
+ isChallengeModeStudent: isChallengeModeStudent,
1110
1110
  phrases: phrases,
1111
1111
  completions: completions,
1112
1112
  roleplays: roleplays,
@@ -1395,7 +1395,7 @@ function ViewTopic({
1395
1395
  topicGoal,
1396
1396
  isUserInternal,
1397
1397
  isHeritageSpeaker,
1398
- isAdvancedStudent,
1398
+ isChallengeModeStudent,
1399
1399
  ...otherProps
1400
1400
  }) {
1401
1401
  const {
@@ -1431,7 +1431,7 @@ function ViewTopic({
1431
1431
  topicGoal: topicGoal,
1432
1432
  isUserInternal: isUserInternal,
1433
1433
  isHeritageSpeaker: isHeritageSpeaker,
1434
- isAdvancedStudent: isAdvancedStudent,
1434
+ isChallengeModeStudent: isChallengeModeStudent,
1435
1435
  ...otherProps
1436
1436
  })
1437
1437
  }), !isLoading && !topic && /*#__PURE__*/(0, _jsxRuntime.jsx)(_Topic.default, {
@@ -720,7 +720,7 @@ function TableRow({
720
720
  sx: {
721
721
  fontWeight: "bold"
722
722
  },
723
- children: featureFlags.heritageSpeakers && member.isHeritageSpeaker ? /*#__PURE__*/(0, _jsxRuntime.jsxs)(_Box.default, {
723
+ children: featureFlags.classroomModes.readWrite && member.isHeritageSpeaker ? /*#__PURE__*/(0, _jsxRuntime.jsxs)(_Box.default, {
724
724
  display: "flex",
725
725
  alignItems: "center",
726
726
  gap: "8px",
@@ -21,7 +21,7 @@ function useClassroomState({
21
21
  const queryClient = useQueryClient();
22
22
  const classroomMemberData = queryClient.getQueryData(_Queries.classrooms.classroomKeys.itemMember(classroomId, username, memberId));
23
23
  const [isMember, setIsMember] = (0, _react.useState)(classroomMemberData?.Item ? true : false);
24
- const [isAdvancedStudent, setIsAdvancedStudent] = (0, _react.useState)(classroomMemberData?.Item?.assignedLabels && classroomMemberData?.Item?.assignedLabels.isAdvancedStudent === true);
24
+ const [isChallengeModeStudent, setisChallengeModeStudent] = (0, _react.useState)(classroomMemberData?.Item?.assignedLabels && classroomMemberData?.Item?.assignedLabels.isChallengeModeStudent === true);
25
25
  let filters = {
26
26
  limit: _config.config.limits.classroomMembers
27
27
  };
@@ -42,15 +42,15 @@ function useClassroomState({
42
42
  (0, _react.useEffect)(() => {
43
43
  if (memberQuery.isSuccess) {
44
44
  const isClassroomMember = memberQuery.data && memberQuery.data.Item ? true : false;
45
- const isAdvancedStudent = memberQuery.data?.Item?.assignedLabels && memberQuery.data?.Item?.assignedLabels.isAdvancedStudent === true;
45
+ const isChallengeModeStudent = memberQuery.data?.Item?.assignedLabels && memberQuery.data?.Item?.assignedLabels.isChallengeModeStudent === true;
46
46
  setIsMember(isClassroomMember);
47
- setIsAdvancedStudent(isAdvancedStudent);
47
+ setisChallengeModeStudent(isChallengeModeStudent);
48
48
  }
49
49
  }, [memberQuery.data, memberQuery.isSuccess, memberId]);
50
50
  return {
51
51
  isMember,
52
52
  membersQuery,
53
53
  memberQuery,
54
- isAdvancedStudent
54
+ isChallengeModeStudent
55
55
  };
56
56
  }
@@ -922,6 +922,8 @@ function useExerciseState({
922
922
  setBotVars(null);
923
923
  setBotText("");
924
924
  setBotMessages([]);
925
+ setConversationHistory([]);
926
+ setIsFirstMessage(true);
925
927
  deleteProgress();
926
928
  setChecked(false);
927
929
  setActorHasBeenSelected(false);
@@ -945,6 +947,8 @@ function useExerciseState({
945
947
  setBotVars(null);
946
948
  setBotText("");
947
949
  setBotMessages([]);
950
+ setConversationHistory([]);
951
+ setIsFirstMessage(true);
948
952
  deleteProgress();
949
953
  if (exerciseName === "roleplay" && !gameId.startsWith("act-it-out")) {
950
954
  // if act-it-out need to select actor
@@ -230,17 +230,19 @@ const calcTopicCompletions = (topic, completions = [], isSectionHidden, assignme
230
230
  let completedBots = 0;
231
231
  const roleplays = topic.roleplays.map(roleplay => {
232
232
  const {
233
- isActItOutHidden = false,
234
- isActItOutListeningHidden = false,
235
- isActItOutListeningSpeakingHidden = false,
236
- isActItOutSpeakingHidden = false
233
+ isFillInTheBlanksHidden = "false",
234
+ isActItOutHidden = "false",
235
+ isActItOutListeningHidden = "false",
236
+ isActItOutListeningSpeakingHidden = "false",
237
+ isActItOutSpeakingHidden = "false"
237
238
  } = roleplay;
238
239
  const trueCount = Object.values({
240
+ isFillInTheBlanksHidden,
239
241
  isActItOutHidden,
240
242
  isActItOutListeningHidden,
241
243
  isActItOutListeningSpeakingHidden,
242
244
  isActItOutSpeakingHidden
243
- }).filter(Boolean).length;
245
+ }).filter(value => value === "true").length;
244
246
  const numberOfUnhiddenGames = 6 - trueCount;
245
247
  const isUnassignedRoleplay = assignmentExercises ? assignmentExercises && !assignmentExercises.some(e => e.roleplayId === roleplay.roleplayId) : false;
246
248
  if (isRoleplaysHidden || roleplay.isRoleplayHidden || isSectionHidden || topic.isTopicHidden || isUnassignedRoleplay) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nualang/nualang-ui-components",
3
- "version": "0.1.1282",
3
+ "version": "0.1.1284",
4
4
  "main": "dist/index.js",
5
5
  "files": [
6
6
  "dist",