@nualang/nualang-ui-components 0.1.1272 → 0.1.1273
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.
- package/dist/Assignments/AssignmentBotSelection/AssignmentBotSelection.js +3 -0
- package/dist/Assignments/AssignmentCardsList/AssignmentCardsList.js +25 -6
- package/dist/Assignments/AssignmentExerciseSelection/AssignmentExerciseSelection.js +6 -0
- package/dist/Cards/Classroom/Classroom.js +4 -0
- package/dist/Cards/Course/Course.js +6 -2
- package/dist/Chat/Chat.js +4 -2
- package/dist/Chat/ChatLoading/ChatLoading.js +3 -2
- package/dist/Chat/Messages/Message/Message.js +3 -2
- package/dist/Chat/Messages/Messages.js +3 -0
- package/dist/Dialogs/InviteDialog/InviteDialog.js +11 -22
- package/dist/Dialogs/UploadBotVars/UploadBotVars.js +56 -0
- package/dist/Dialogs/UploadPhrases/UploadPhrases.js +71 -27
- package/dist/Dialogs/UploadRoleplayScript/UploadRoleplayScript.js +61 -0
- package/dist/Editors/Bot/Bot.js +2 -2
- package/dist/Editors/Bot/Editor/BotDesigner/AlternativesList.js +2 -4
- package/dist/Editors/Bot/Editor/BotDesigner/SubList.js +2 -4
- package/dist/Editors/Bot/Editor/BotDesigner/TopicList.js +4 -8
- package/dist/Editors/Bot/Editor/BotDesigner/VarList.js +5 -10
- package/dist/Exercises/Bot/Bot.js +2 -1
- package/dist/Forms/UpdateBot/UpdateBot.js +6 -3
- package/dist/Lists/Exercises/Exercises.js +1 -1
- package/dist/Lists/Phrases/Phrases.js +89 -55
- package/dist/Misc/ImageLibrary/ImageLibrary.js +1 -2
- package/dist/Misc/ShareButton/ShareDrawer.js +1 -2
- package/dist/Misc/SignOut/SignOut.js +1 -1
- package/package.json +1 -1
|
@@ -57,14 +57,33 @@ const AssignmentCardsList = ({
|
|
|
57
57
|
},
|
|
58
58
|
display: "flex",
|
|
59
59
|
flexDirection: "column",
|
|
60
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.
|
|
61
|
-
|
|
62
|
-
|
|
60
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Box, {
|
|
61
|
+
display: "flex",
|
|
62
|
+
alignItems: "center",
|
|
63
63
|
sx: {
|
|
64
|
-
|
|
65
|
-
flexGrow: 1
|
|
64
|
+
width: "100%"
|
|
66
65
|
},
|
|
67
|
-
children:
|
|
66
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Box, {
|
|
67
|
+
sx: {
|
|
68
|
+
flexGrow: 1,
|
|
69
|
+
textAlign: "center",
|
|
70
|
+
marginLeft: 5
|
|
71
|
+
},
|
|
72
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
|
|
73
|
+
variant: "h5",
|
|
74
|
+
fontWeight: "bold",
|
|
75
|
+
children: t("no_assignments")
|
|
76
|
+
})
|
|
77
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Tooltip, {
|
|
78
|
+
placement: "left",
|
|
79
|
+
title: t("refresh_assignments"),
|
|
80
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.IconButton, {
|
|
81
|
+
onClick: refreshAssignments,
|
|
82
|
+
"aria-label": "refresh",
|
|
83
|
+
size: "large",
|
|
84
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Refresh.default, {})
|
|
85
|
+
})
|
|
86
|
+
})]
|
|
68
87
|
}), !isCreator ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
|
|
69
88
|
sx: {
|
|
70
89
|
textAlign: "center",
|
|
@@ -195,8 +195,14 @@ function Exercise({
|
|
|
195
195
|
secondary: t(description)
|
|
196
196
|
})
|
|
197
197
|
}), name.toLowerCase() === "roleplays" && /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.IconButton, {
|
|
198
|
+
sx: {
|
|
199
|
+
marginRight: "15px"
|
|
200
|
+
},
|
|
198
201
|
children: roleplaysOpen ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_ExpandLess.default, {}) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_ExpandMore.default, {})
|
|
199
202
|
}), name.toLowerCase() === "bots" && /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.IconButton, {
|
|
203
|
+
sx: {
|
|
204
|
+
marginRight: "15px"
|
|
205
|
+
},
|
|
200
206
|
children: botsOpen ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_ExpandLess.default, {}) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_ExpandMore.default, {})
|
|
201
207
|
}), (name.toLowerCase() === "listening" || name.toLowerCase() === "translation" || name.toLowerCase() === "pronunciation") && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.ListItemIcon, {
|
|
202
208
|
children: [useCase === "assignment-select" && /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Checkbox, {
|
|
@@ -221,6 +221,10 @@ function ClassroomCard({
|
|
|
221
221
|
visibility: visibility
|
|
222
222
|
})]
|
|
223
223
|
}), userImage ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_CardElements.CardAvatar, {
|
|
224
|
+
sx: theme => ({
|
|
225
|
+
backgroundColor: theme.palette.mode === "dark" ? "#ffffff" : "#bdbdbd",
|
|
226
|
+
color: theme.palette.mode === "dark" ? "#ffffff" : "#bdbdbd"
|
|
227
|
+
}),
|
|
224
228
|
"aria-label": `${t("go_to")} ${createdByName || `${classroomName} ${t("creator")}`} ${t("profile")}`,
|
|
225
229
|
title: createdByName || `${classroomName} creator`,
|
|
226
230
|
src: userImage,
|
|
@@ -380,6 +380,10 @@ function CourseCard({
|
|
|
380
380
|
isCourseHidden: isCourseHidden
|
|
381
381
|
})]
|
|
382
382
|
}), userImage ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_CardElements.CardAvatar, {
|
|
383
|
+
sx: theme => ({
|
|
384
|
+
backgroundColor: theme.palette.mode === "dark" ? "#ffffff" : "#bdbdbd",
|
|
385
|
+
color: theme.palette.mode === "dark" ? "#ffffff" : "#bdbdbd"
|
|
386
|
+
}),
|
|
383
387
|
"aria-label": `${t("go_to")} ${createdByName || `${courseName} ${t("creator")}`} ${t("profile")}`,
|
|
384
388
|
title: createdByName || `${courseName} creator`,
|
|
385
389
|
src: userImage,
|
|
@@ -398,7 +402,7 @@ function CourseCard({
|
|
|
398
402
|
}) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_CardElements.CardAvatar, {
|
|
399
403
|
sx: theme => ({
|
|
400
404
|
backgroundColor: theme.palette.mode === "dark" ? "#ffffff" : "#bdbdbd",
|
|
401
|
-
color: theme.palette.mode === "dark" ?
|
|
405
|
+
color: theme.palette.mode === "dark" ? "#ffffff" : "#bdbdbd"
|
|
402
406
|
}),
|
|
403
407
|
"aria-label": `${t("go_to")} ${createdByName || `${courseName} ${t("creator")}`} ${t("profile")}`,
|
|
404
408
|
title: createdByName || `${courseName} creator`,
|
|
@@ -506,7 +510,7 @@ function CourseCard({
|
|
|
506
510
|
disabled: checked,
|
|
507
511
|
"aria-label": "Select Course",
|
|
508
512
|
children: checked ? t("selected") : t("select")
|
|
509
|
-
}), isCreator && !isMember && !selectable && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
513
|
+
}), (isCreator || isCollaborator && !isMember) && !selectable && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
510
514
|
children: [!isClassroomArchived && /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Button, {
|
|
511
515
|
onClick: viewCourse,
|
|
512
516
|
color: "primary",
|
package/dist/Chat/Chat.js
CHANGED
|
@@ -98,7 +98,8 @@ function Chat({
|
|
|
98
98
|
siteLanguage,
|
|
99
99
|
answerCounts,
|
|
100
100
|
noAnswerCounts,
|
|
101
|
-
isDynamicResponsesEnabled
|
|
101
|
+
isDynamicResponsesEnabled,
|
|
102
|
+
isUserInternal
|
|
102
103
|
}) {
|
|
103
104
|
const {
|
|
104
105
|
classes
|
|
@@ -162,7 +163,8 @@ function Chat({
|
|
|
162
163
|
siteLanguage: siteLanguage,
|
|
163
164
|
answerCounts: answerCounts,
|
|
164
165
|
noAnswerCounts: noAnswerCounts,
|
|
165
|
-
isDynamicResponsesEnabled: isDynamicResponsesEnabled
|
|
166
|
+
isDynamicResponsesEnabled: isDynamicResponsesEnabled,
|
|
167
|
+
isUserInternal: isUserInternal
|
|
166
168
|
}), !hideBottomBar && !viewAttemptMode && /*#__PURE__*/(0, _jsxRuntime.jsx)(_BottomBar.default, {
|
|
167
169
|
t: t,
|
|
168
170
|
inputName: inputName,
|
|
@@ -138,7 +138,8 @@ function ChatLoading({
|
|
|
138
138
|
hideAvatar,
|
|
139
139
|
messages = [],
|
|
140
140
|
index,
|
|
141
|
-
isDynamicResponsesEnabled
|
|
141
|
+
isDynamicResponsesEnabled,
|
|
142
|
+
isUserInternal
|
|
142
143
|
}) {
|
|
143
144
|
const theme = (0, _styles.useTheme)();
|
|
144
145
|
const isSmallScreen = (0, _useMediaQuery.default)(theme.breakpoints.down("sm"));
|
|
@@ -157,7 +158,7 @@ function ChatLoading({
|
|
|
157
158
|
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
158
159
|
className: classes.message,
|
|
159
160
|
children: [userImage ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {
|
|
160
|
-
children: !isMyMessage && isDynamicResponsesEnabled === 'enable' ? /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
161
|
+
children: !isMyMessage && isDynamicResponsesEnabled === 'enable' && isUserInternal ? /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
161
162
|
style: {
|
|
162
163
|
position: "relative",
|
|
163
164
|
display: "inline-block"
|
|
@@ -300,7 +300,8 @@ function Message({
|
|
|
300
300
|
siteLanguage,
|
|
301
301
|
provided,
|
|
302
302
|
isEdited = false,
|
|
303
|
-
isDynamicResponsesEnabled
|
|
303
|
+
isDynamicResponsesEnabled,
|
|
304
|
+
isUserInternal
|
|
304
305
|
}) {
|
|
305
306
|
const theme = (0, _styles.useTheme)();
|
|
306
307
|
const messageContainerId = `message${messageIndex}`;
|
|
@@ -372,7 +373,7 @@ function Message({
|
|
|
372
373
|
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
373
374
|
className: classes.message,
|
|
374
375
|
children: [userImage ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {
|
|
375
|
-
children: !isMyMessage && isDynamicResponsesEnabled === 'enable' ? /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
376
|
+
children: !isMyMessage && isDynamicResponsesEnabled === 'enable' && isUserInternal ? /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
376
377
|
style: {
|
|
377
378
|
position: "relative",
|
|
378
379
|
display: "inline-block"
|
|
@@ -62,6 +62,7 @@ function Messages({
|
|
|
62
62
|
moveScriptItem,
|
|
63
63
|
voice,
|
|
64
64
|
isDynamicResponsesEnabled,
|
|
65
|
+
isUserInternal,
|
|
65
66
|
...otherProps
|
|
66
67
|
}) {
|
|
67
68
|
const {
|
|
@@ -228,6 +229,7 @@ function Messages({
|
|
|
228
229
|
index: i,
|
|
229
230
|
messages: messages,
|
|
230
231
|
isDynamicResponsesEnabled: isDynamicResponsesEnabled,
|
|
232
|
+
isUserInternal: isUserInternal,
|
|
231
233
|
...m,
|
|
232
234
|
...otherProps
|
|
233
235
|
}) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_Message.default, {
|
|
@@ -251,6 +253,7 @@ function Messages({
|
|
|
251
253
|
isLivePlayer: isLivePlayer,
|
|
252
254
|
siteLanguage: siteLanguage,
|
|
253
255
|
isDynamicResponsesEnabled: isDynamicResponsesEnabled,
|
|
256
|
+
isUserInternal: isUserInternal,
|
|
254
257
|
...m,
|
|
255
258
|
...otherProps
|
|
256
259
|
}, `messy_${i}`))]
|
|
@@ -338,8 +338,7 @@ function InviteDialog({
|
|
|
338
338
|
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.List, {
|
|
339
339
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_DialogContentText.default, {
|
|
340
340
|
children: t("or_invite_via")
|
|
341
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.
|
|
342
|
-
button: true,
|
|
341
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.ListItemButton, {
|
|
343
342
|
disableGutters: true,
|
|
344
343
|
onClick: toggleQRCodeDisplay,
|
|
345
344
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.ListItemAvatar, {
|
|
@@ -354,8 +353,7 @@ function InviteDialog({
|
|
|
354
353
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.ListItemText, {
|
|
355
354
|
primary: "QR Code"
|
|
356
355
|
})]
|
|
357
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.
|
|
358
|
-
button: true,
|
|
356
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.ListItemButton, {
|
|
359
357
|
disableGutters: true,
|
|
360
358
|
onClick: () => openWindow(`mailto:?subject=${t("invite_email_subject")} ${inviteTypeState.toLowerCase()}&body=${studentInstructionsEmailBody()}`),
|
|
361
359
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.ListItemAvatar, {
|
|
@@ -370,8 +368,7 @@ function InviteDialog({
|
|
|
370
368
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.ListItemText, {
|
|
371
369
|
primary: "Email"
|
|
372
370
|
})]
|
|
373
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.
|
|
374
|
-
button: true,
|
|
371
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.ListItemButton, {
|
|
375
372
|
disableGutters: true,
|
|
376
373
|
onClick: () => openWindow(googleClassroomLink),
|
|
377
374
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.ListItemAvatar, {
|
|
@@ -386,8 +383,7 @@ function InviteDialog({
|
|
|
386
383
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.ListItemText, {
|
|
387
384
|
primary: "Google Classroom"
|
|
388
385
|
})]
|
|
389
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.
|
|
390
|
-
button: true,
|
|
386
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.ListItemButton, {
|
|
391
387
|
disableGutters: true,
|
|
392
388
|
onClick: () => openWindow(facebookLink),
|
|
393
389
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.ListItemAvatar, {
|
|
@@ -402,8 +398,7 @@ function InviteDialog({
|
|
|
402
398
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.ListItemText, {
|
|
403
399
|
primary: "Facebook"
|
|
404
400
|
})]
|
|
405
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.
|
|
406
|
-
button: true,
|
|
401
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.ListItemButton, {
|
|
407
402
|
disableGutters: true,
|
|
408
403
|
onClick: () => openWindow(twitterLink),
|
|
409
404
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.ListItemAvatar, {
|
|
@@ -464,14 +459,13 @@ function InviteDialog({
|
|
|
464
459
|
picture,
|
|
465
460
|
courses
|
|
466
461
|
} = c;
|
|
467
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.
|
|
462
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.ListItemButton, {
|
|
468
463
|
onClick: async () => {
|
|
469
464
|
if (courses && Array.isArray(courses) && courses.includes(itemId)) {
|
|
470
465
|
setInviteStateType("classroom");
|
|
471
466
|
setSelectedClassroomId(classroomId);
|
|
472
467
|
}
|
|
473
468
|
},
|
|
474
|
-
button: true,
|
|
475
469
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.ListItemAvatar, {
|
|
476
470
|
children: picture ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Avatar, {
|
|
477
471
|
src: picture,
|
|
@@ -579,8 +573,7 @@ function InviteDialog({
|
|
|
579
573
|
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.List, {
|
|
580
574
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_DialogContentText.default, {
|
|
581
575
|
children: t("or_invite_via")
|
|
582
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.
|
|
583
|
-
button: true,
|
|
576
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.ListItemButton, {
|
|
584
577
|
disableGutters: true,
|
|
585
578
|
onClick: toggleQRCodeDisplay,
|
|
586
579
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.ListItemAvatar, {
|
|
@@ -595,8 +588,7 @@ function InviteDialog({
|
|
|
595
588
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.ListItemText, {
|
|
596
589
|
primary: "QR Code"
|
|
597
590
|
})]
|
|
598
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.
|
|
599
|
-
button: true,
|
|
591
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.ListItemButton, {
|
|
600
592
|
disableGutters: true,
|
|
601
593
|
onClick: () => openWindow(`mailto:?subject=${t("invite_email_subject")} ${inviteTypeState.toLowerCase()}&body=${studentInstructionsEmailBody()}`),
|
|
602
594
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.ListItemAvatar, {
|
|
@@ -611,8 +603,7 @@ function InviteDialog({
|
|
|
611
603
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.ListItemText, {
|
|
612
604
|
primary: "Email"
|
|
613
605
|
})]
|
|
614
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.
|
|
615
|
-
button: true,
|
|
606
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.ListItemButton, {
|
|
616
607
|
disableGutters: true,
|
|
617
608
|
onClick: () => openWindow(googleClassroomLink),
|
|
618
609
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.ListItemAvatar, {
|
|
@@ -627,8 +618,7 @@ function InviteDialog({
|
|
|
627
618
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.ListItemText, {
|
|
628
619
|
primary: "Google Classroom"
|
|
629
620
|
})]
|
|
630
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.
|
|
631
|
-
button: true,
|
|
621
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.ListItemButton, {
|
|
632
622
|
disableGutters: true,
|
|
633
623
|
onClick: () => openWindow(facebookLink),
|
|
634
624
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.ListItemAvatar, {
|
|
@@ -643,8 +633,7 @@ function InviteDialog({
|
|
|
643
633
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.ListItemText, {
|
|
644
634
|
primary: "Facebook"
|
|
645
635
|
})]
|
|
646
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.
|
|
647
|
-
button: true,
|
|
636
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.ListItemButton, {
|
|
648
637
|
disableGutters: true,
|
|
649
638
|
onClick: () => openWindow(twitterLink),
|
|
650
639
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.ListItemAvatar, {
|
|
@@ -15,6 +15,7 @@ var _material = require("@mui/material");
|
|
|
15
15
|
var _mui = require("tss-react/mui");
|
|
16
16
|
var _ParseScriptErrors = _interopRequireDefault(require("../../Lists/ParseScriptErrors/ParseScriptErrors"));
|
|
17
17
|
var _CSVUploader = _interopRequireDefault(require("../../Misc/CSVUploader"));
|
|
18
|
+
var _useDebounce = _interopRequireDefault(require("../../hooks/useDebounce"));
|
|
18
19
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
19
20
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
20
21
|
// components
|
|
@@ -35,6 +36,8 @@ function UploadBotVars({
|
|
|
35
36
|
} = useStyles();
|
|
36
37
|
const [vars, setVars] = (0, _react.useState)([]);
|
|
37
38
|
const [errors, setErrors] = (0, _react.useState)([]);
|
|
39
|
+
const [csvDataInput, setCsvDataInput] = (0, _react.useState)("");
|
|
40
|
+
const debouncedCsvDataInput = (0, _useDebounce.default)(csvDataInput, 2000);
|
|
38
41
|
const SpreadSheetImg = (0, _styles.styled)("img")(() => ({
|
|
39
42
|
display: "block",
|
|
40
43
|
maxHeight: "200px"
|
|
@@ -76,6 +79,42 @@ function UploadBotVars({
|
|
|
76
79
|
}
|
|
77
80
|
handleClose();
|
|
78
81
|
};
|
|
82
|
+
const formatBotVars = botVars => {
|
|
83
|
+
let varArray = {};
|
|
84
|
+
botVars.forEach((data, index) => {
|
|
85
|
+
if (!data.name || !data.value) {
|
|
86
|
+
setErrors(prevState => [...prevState, {
|
|
87
|
+
row: index + 1,
|
|
88
|
+
errorMessage: "Missing variable name or value"
|
|
89
|
+
}]);
|
|
90
|
+
} else {
|
|
91
|
+
varArray[data.name] = data.value;
|
|
92
|
+
}
|
|
93
|
+
});
|
|
94
|
+
setVars(varArray);
|
|
95
|
+
return varArray;
|
|
96
|
+
};
|
|
97
|
+
(0, _react.useEffect)(() => {
|
|
98
|
+
const handleUploadCsvDataText = async () => {
|
|
99
|
+
setErrors([]);
|
|
100
|
+
const lines = csvDataInput.trim().split('\n');
|
|
101
|
+
const headers = lines[0].split(',').map(h => h.trim());
|
|
102
|
+
const rows = lines.slice(1);
|
|
103
|
+
const jsonArray = rows.map(row => {
|
|
104
|
+
const values = row.match(/(".*?"|[^",\n]+)(?=\s*,|\s*$)/g).map(v => v.replace(/^"|"$/g, '').trim());
|
|
105
|
+
const entry = {};
|
|
106
|
+
headers.forEach((header, i) => {
|
|
107
|
+
entry[header] = values[i] ?? '';
|
|
108
|
+
});
|
|
109
|
+
return entry;
|
|
110
|
+
});
|
|
111
|
+
const formattedBotVars = formatBotVars(jsonArray);
|
|
112
|
+
setVars(formattedBotVars);
|
|
113
|
+
};
|
|
114
|
+
if (debouncedCsvDataInput !== "debouncedCsvDataInput") {
|
|
115
|
+
handleUploadCsvDataText();
|
|
116
|
+
}
|
|
117
|
+
}, [debouncedCsvDataInput]);
|
|
79
118
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_ResponsiveDialog.default, {
|
|
80
119
|
open: open,
|
|
81
120
|
handleClose: () => {
|
|
@@ -111,6 +150,23 @@ function UploadBotVars({
|
|
|
111
150
|
t: t,
|
|
112
151
|
handleUploadAccepted: handleUploadAccepted
|
|
113
152
|
})
|
|
153
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Divider, {
|
|
154
|
+
sx: {
|
|
155
|
+
my: 2
|
|
156
|
+
},
|
|
157
|
+
children: "OR"
|
|
158
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_Box.default, {
|
|
159
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.TextField, {
|
|
160
|
+
id: "csvDataInput",
|
|
161
|
+
name: "csvDataInput",
|
|
162
|
+
label: t("paste_your_csv_data"),
|
|
163
|
+
placeholder: `name, value\ntext1, "What is your favorite color?"\ntext2, "What is your favorite food?"`,
|
|
164
|
+
value: csvDataInput,
|
|
165
|
+
fullWidth: true,
|
|
166
|
+
multiline: true,
|
|
167
|
+
rows: 4,
|
|
168
|
+
onChange: e => setCsvDataInput(e.target.value)
|
|
169
|
+
})
|
|
114
170
|
}), errors && errors.length > 0 && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_Box.default, {
|
|
115
171
|
className: classes.parseErrorsBox,
|
|
116
172
|
py: 1,
|
|
@@ -30,6 +30,7 @@ var _Grow = _interopRequireDefault(require("@mui/material/Grow"));
|
|
|
30
30
|
var _ClickAwayListener = _interopRequireDefault(require("@mui/material/ClickAwayListener"));
|
|
31
31
|
var _MenuItem = _interopRequireDefault(require("@mui/material/MenuItem"));
|
|
32
32
|
var _MenuList = _interopRequireDefault(require("@mui/material/MenuList"));
|
|
33
|
+
var _useDebounce = _interopRequireDefault(require("../../hooks/useDebounce"));
|
|
33
34
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
34
35
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
35
36
|
const phrasesData = [{
|
|
@@ -122,6 +123,58 @@ function UploadPhrases({
|
|
|
122
123
|
const [errors, setErrors] = (0, _react.useState)([]);
|
|
123
124
|
const [isError, setisError] = (0, _react.useState)(false);
|
|
124
125
|
const [errorMessage, setErrorMessage] = (0, _react.useState)("");
|
|
126
|
+
const [csvDataInput, setCsvDataInput] = (0, _react.useState)("");
|
|
127
|
+
const debouncedCsvDataInput = (0, _useDebounce.default)(csvDataInput, 2000);
|
|
128
|
+
const formatPhrases = phrases => {
|
|
129
|
+
return phrases.map((data, index) => {
|
|
130
|
+
const rowErrors = validateRow(data.phrase, data.translations, index);
|
|
131
|
+
if (index !== phrases.length - 1 && !isRowEmpty(data)) {
|
|
132
|
+
if (rowErrors) {
|
|
133
|
+
setErrors(prevState => [...prevState, ...rowErrors]);
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
if (data.phrase) {
|
|
137
|
+
if (learnLang === forLang && (!data.translations || data.translations.trim() === "")) {
|
|
138
|
+
data.translations = data.phrase;
|
|
139
|
+
}
|
|
140
|
+
const {
|
|
141
|
+
primary,
|
|
142
|
+
alternatives
|
|
143
|
+
} = parsePhraseWithAlternatives(data.phrase);
|
|
144
|
+
const formattedTranslations = data.translations.split("|").map(t => t.trim().replace(/^"|"$/g, '').trim());
|
|
145
|
+
return {
|
|
146
|
+
phrase: primary,
|
|
147
|
+
alternativeVersions: alternatives,
|
|
148
|
+
translations: formattedTranslations,
|
|
149
|
+
image: data.image ? data.image.trim() : "",
|
|
150
|
+
voices: [],
|
|
151
|
+
idx: index
|
|
152
|
+
};
|
|
153
|
+
}
|
|
154
|
+
return null;
|
|
155
|
+
}).filter(phrase => !!phrase);
|
|
156
|
+
};
|
|
157
|
+
(0, _react.useEffect)(() => {
|
|
158
|
+
const handleUploadCsvDataText = async () => {
|
|
159
|
+
setErrors([]);
|
|
160
|
+
const lines = csvDataInput.trim().split('\n');
|
|
161
|
+
const headers = lines[0].split(',').map(h => h.trim());
|
|
162
|
+
const rows = lines.slice(1);
|
|
163
|
+
const jsonArray = rows.map(row => {
|
|
164
|
+
const values = row.match(/(".*?"|[^",\n]+)(?=\s*,|\s*$)/g).map(v => v.replace(/^"|"$/g, '').trim());
|
|
165
|
+
const entry = {};
|
|
166
|
+
headers.forEach((header, i) => {
|
|
167
|
+
entry[header] = values[i] ?? '';
|
|
168
|
+
});
|
|
169
|
+
return entry;
|
|
170
|
+
});
|
|
171
|
+
const formattedPhrases = formatPhrases(jsonArray);
|
|
172
|
+
setPhrases(formattedPhrases);
|
|
173
|
+
};
|
|
174
|
+
if (debouncedCsvDataInput !== "debouncedCsvDataInput") {
|
|
175
|
+
handleUploadCsvDataText();
|
|
176
|
+
}
|
|
177
|
+
}, [debouncedCsvDataInput]);
|
|
125
178
|
const handleUploadAccepted = async (results, file) => {
|
|
126
179
|
setErrors([]);
|
|
127
180
|
if (file.type !== "text/csv") {
|
|
@@ -141,33 +194,7 @@ function UploadPhrases({
|
|
|
141
194
|
setErrors(prevState => [...prevState, ...formattedErrors]);
|
|
142
195
|
return;
|
|
143
196
|
} else {
|
|
144
|
-
const formattedPhrases = results.data
|
|
145
|
-
const rowErrors = validateRow(data.phrase, data.translations, index);
|
|
146
|
-
if (index !== results.data.length - 1 && !isRowEmpty(data)) {
|
|
147
|
-
if (rowErrors) {
|
|
148
|
-
setErrors(prevState => [...prevState, ...rowErrors]);
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
if (data.phrase) {
|
|
152
|
-
if (learnLang === forLang && (!data.translations || data.translations.trim() === "")) {
|
|
153
|
-
data.translations = data.phrase;
|
|
154
|
-
}
|
|
155
|
-
const {
|
|
156
|
-
primary,
|
|
157
|
-
alternatives
|
|
158
|
-
} = parsePhraseWithAlternatives(data.phrase);
|
|
159
|
-
const formattedTranslations = data.translations.split("|").map(t => t.trim());
|
|
160
|
-
return {
|
|
161
|
-
phrase: primary,
|
|
162
|
-
alternativeVersions: alternatives,
|
|
163
|
-
translations: formattedTranslations,
|
|
164
|
-
image: data.image ? data.image.trim() : "",
|
|
165
|
-
voices: [],
|
|
166
|
-
idx: index
|
|
167
|
-
};
|
|
168
|
-
}
|
|
169
|
-
return null;
|
|
170
|
-
}).filter(phrase => !!phrase);
|
|
197
|
+
const formattedPhrases = formatPhrases(results.data);
|
|
171
198
|
setPhrases(formattedPhrases);
|
|
172
199
|
}
|
|
173
200
|
};
|
|
@@ -227,6 +254,23 @@ function UploadPhrases({
|
|
|
227
254
|
t: t,
|
|
228
255
|
handleUploadAccepted: handleUploadAccepted
|
|
229
256
|
})]
|
|
257
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Divider, {
|
|
258
|
+
sx: {
|
|
259
|
+
my: 2
|
|
260
|
+
},
|
|
261
|
+
children: "OR"
|
|
262
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Box, {
|
|
263
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.TextField, {
|
|
264
|
+
id: "csvDataInput",
|
|
265
|
+
name: "csvDataInput",
|
|
266
|
+
label: t("paste_your_csv_data"),
|
|
267
|
+
placeholder: `phrase, translations\n"Hola", "Hello | Hi"\n"Adios", "Goodbye"`,
|
|
268
|
+
value: csvDataInput,
|
|
269
|
+
fullWidth: true,
|
|
270
|
+
multiline: true,
|
|
271
|
+
rows: 4,
|
|
272
|
+
onChange: e => setCsvDataInput(e.target.value)
|
|
273
|
+
})
|
|
230
274
|
}), errors.length > 0 && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Box, {
|
|
231
275
|
className: classes.parseErrorsBox,
|
|
232
276
|
py: 1,
|
|
@@ -15,6 +15,7 @@ var _material = require("@mui/material");
|
|
|
15
15
|
var _mui = require("tss-react/mui");
|
|
16
16
|
var _ParseScriptErrors = _interopRequireDefault(require("../../Lists/ParseScriptErrors/ParseScriptErrors"));
|
|
17
17
|
var _CSVUploader = _interopRequireDefault(require("../../Misc/CSVUploader"));
|
|
18
|
+
var _useDebounce = _interopRequireDefault(require("../../hooks/useDebounce"));
|
|
18
19
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
19
20
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
20
21
|
// components
|
|
@@ -35,6 +36,8 @@ function UploadRoleplayScript({
|
|
|
35
36
|
} = useStyles();
|
|
36
37
|
const [script, setScript] = (0, _react.useState)([]);
|
|
37
38
|
const [errors, setErrors] = (0, _react.useState)([]);
|
|
39
|
+
const [csvDataInput, setCsvDataInput] = (0, _react.useState)("");
|
|
40
|
+
const debouncedCsvDataInput = (0, _useDebounce.default)(csvDataInput, 2000);
|
|
38
41
|
const formatData = data => {
|
|
39
42
|
if (data.Type && data.Type.toLowerCase().includes("actor")) {
|
|
40
43
|
const actorNumber = data.Type.substr(data.Type.length - 1);
|
|
@@ -171,6 +174,47 @@ function UploadRoleplayScript({
|
|
|
171
174
|
}
|
|
172
175
|
handleClose();
|
|
173
176
|
};
|
|
177
|
+
const formatRoleplayScript = roleplayScipt => {
|
|
178
|
+
let varArray = [];
|
|
179
|
+
roleplayScipt.forEach((data, index) => {
|
|
180
|
+
if (!data.Type || !data["Text/Question"]) {
|
|
181
|
+
setErrors(prevState => [...prevState, {
|
|
182
|
+
row: index + 1,
|
|
183
|
+
errorMessage: "Missing Type or Text/Question"
|
|
184
|
+
}]);
|
|
185
|
+
} else {
|
|
186
|
+
const actor = data.Type === "Actor1" ? 1 : data.Type === "Actor2" ? 2 : null;
|
|
187
|
+
if (actor) {
|
|
188
|
+
varArray.push({
|
|
189
|
+
actor: actor,
|
|
190
|
+
text: data["Text/Question"]
|
|
191
|
+
});
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
});
|
|
195
|
+
return varArray;
|
|
196
|
+
};
|
|
197
|
+
(0, _react.useEffect)(() => {
|
|
198
|
+
const handleUploadCsvDataText = async () => {
|
|
199
|
+
setErrors([]);
|
|
200
|
+
const lines = csvDataInput.trim().split('\n');
|
|
201
|
+
const headers = lines[0].split(',').map(h => h.trim());
|
|
202
|
+
const rows = lines.slice(1);
|
|
203
|
+
const jsonArray = rows.map(row => {
|
|
204
|
+
const values = row.match(/(".*?"|[^",\n]+)(?=\s*,|\s*$)/g).map(v => v.replace(/^"|"$/g, '').trim());
|
|
205
|
+
const entry = {};
|
|
206
|
+
headers.forEach((header, i) => {
|
|
207
|
+
entry[header] = values[i] ?? '';
|
|
208
|
+
});
|
|
209
|
+
return entry;
|
|
210
|
+
});
|
|
211
|
+
const formattedRoleplayScript = formatRoleplayScript(jsonArray);
|
|
212
|
+
setScript(formattedRoleplayScript);
|
|
213
|
+
};
|
|
214
|
+
if (debouncedCsvDataInput !== "debouncedCsvDataInput") {
|
|
215
|
+
handleUploadCsvDataText();
|
|
216
|
+
}
|
|
217
|
+
}, [debouncedCsvDataInput]);
|
|
174
218
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_ResponsiveDialog.default, {
|
|
175
219
|
open: open,
|
|
176
220
|
handleClose: () => {
|
|
@@ -205,6 +249,23 @@ function UploadRoleplayScript({
|
|
|
205
249
|
t: t,
|
|
206
250
|
handleUploadAccepted: handleUploadAccepted
|
|
207
251
|
})
|
|
252
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Divider, {
|
|
253
|
+
sx: {
|
|
254
|
+
my: 2
|
|
255
|
+
},
|
|
256
|
+
children: "OR"
|
|
257
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_Box.default, {
|
|
258
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.TextField, {
|
|
259
|
+
id: "csvDataInput",
|
|
260
|
+
name: "csvDataInput",
|
|
261
|
+
label: t("paste_your_csv_data"),
|
|
262
|
+
placeholder: `Type, Text/Question\nActor1, "How are you?"\nActor2, "I am fine, thank you!"`,
|
|
263
|
+
value: csvDataInput,
|
|
264
|
+
fullWidth: true,
|
|
265
|
+
multiline: true,
|
|
266
|
+
rows: 4,
|
|
267
|
+
onChange: e => setCsvDataInput(e.target.value)
|
|
268
|
+
})
|
|
208
269
|
}), errors && errors.length > 0 && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_Box.default, {
|
|
209
270
|
className: classes.parseErrorsBox,
|
|
210
271
|
py: 1,
|
package/dist/Editors/Bot/Bot.js
CHANGED
|
@@ -203,7 +203,7 @@ function Bot({
|
|
|
203
203
|
const isSmallScreen = (0, _useMediaQuery.default)(theme.breakpoints.down("md"));
|
|
204
204
|
const tabVariant = isSmallScreen ? "fullWidth" : null;
|
|
205
205
|
const [tabValue, setTabValue] = (0, _react.useState)(0);
|
|
206
|
-
const [simplified, setSimplified] = (0, _react.useState)(
|
|
206
|
+
const [simplified, setSimplified] = (0, _react.useState)(true);
|
|
207
207
|
const [disableInput, setDisableInput] = (0, _react.useState)(true);
|
|
208
208
|
const {
|
|
209
209
|
voice
|
|
@@ -563,7 +563,7 @@ function Bot({
|
|
|
563
563
|
if (codeParsed) {
|
|
564
564
|
await onSubmit({
|
|
565
565
|
riveFile: bot.riveFile,
|
|
566
|
-
editorMode:
|
|
566
|
+
editorMode: "simplified"
|
|
567
567
|
});
|
|
568
568
|
} else {
|
|
569
569
|
teardownBot();
|
|
@@ -75,8 +75,7 @@ function AlternativesList({
|
|
|
75
75
|
component: "nav",
|
|
76
76
|
"aria-label": "nested-list-subheader",
|
|
77
77
|
disablePadding: true,
|
|
78
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.
|
|
79
|
-
button: true,
|
|
78
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.ListItemButton, {
|
|
80
79
|
onClick: handleClick,
|
|
81
80
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.ListItemText, {
|
|
82
81
|
primary: t("alternatives"),
|
|
@@ -86,8 +85,7 @@ function AlternativesList({
|
|
|
86
85
|
in: open,
|
|
87
86
|
timeout: "auto",
|
|
88
87
|
unmountOnExit: true,
|
|
89
|
-
children: [!simplified && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.
|
|
90
|
-
button: true,
|
|
88
|
+
children: [!simplified && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.ListItemButton, {
|
|
91
89
|
className: classes.nested,
|
|
92
90
|
onClick: handleOpenAlternativesModal,
|
|
93
91
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.ListItemIcon, {
|
|
@@ -73,8 +73,7 @@ function SubList({
|
|
|
73
73
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.List, {
|
|
74
74
|
component: "nav",
|
|
75
75
|
disablePadding: true,
|
|
76
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.
|
|
77
|
-
button: true,
|
|
76
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.ListItemButton, {
|
|
78
77
|
onClick: handleClick,
|
|
79
78
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.ListItemText, {
|
|
80
79
|
primary: t("substitutions"),
|
|
@@ -84,8 +83,7 @@ function SubList({
|
|
|
84
83
|
in: open,
|
|
85
84
|
timeout: "auto",
|
|
86
85
|
unmountOnExit: true,
|
|
87
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.
|
|
88
|
-
button: true,
|
|
86
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.ListItemButton, {
|
|
89
87
|
className: classes.nested,
|
|
90
88
|
onClick: handleOpenSubstitutionModal,
|
|
91
89
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.ListItemIcon, {
|
|
@@ -126,9 +126,8 @@ function TopicListItem({
|
|
|
126
126
|
}
|
|
127
127
|
}, [open, selectedNode, topicName]);
|
|
128
128
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
129
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.
|
|
129
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.ListItemButton, {
|
|
130
130
|
className: classes.nested,
|
|
131
|
-
button: true,
|
|
132
131
|
onClick: handleClick,
|
|
133
132
|
selected: selectedNode && selectedNode.startsWith(`node${topicName}`),
|
|
134
133
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.ListItemText, {
|
|
@@ -155,8 +154,7 @@ function TopicListItem({
|
|
|
155
154
|
className: classes.nested2,
|
|
156
155
|
children: t("triggers")
|
|
157
156
|
}),
|
|
158
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.
|
|
159
|
-
button: true,
|
|
157
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.ListItemButton, {
|
|
160
158
|
className: classes.nested2,
|
|
161
159
|
onClick: e => {
|
|
162
160
|
setTopicName(topicName);
|
|
@@ -250,8 +248,7 @@ function TopicList({
|
|
|
250
248
|
disablePadding: true,
|
|
251
249
|
ref: topicsRef,
|
|
252
250
|
id: "topics",
|
|
253
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.
|
|
254
|
-
button: true,
|
|
251
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.ListItemButton, {
|
|
255
252
|
onClick: handleClick,
|
|
256
253
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.ListItemText, {
|
|
257
254
|
primary: t("topics"),
|
|
@@ -261,8 +258,7 @@ function TopicList({
|
|
|
261
258
|
in: open,
|
|
262
259
|
timeout: "auto",
|
|
263
260
|
unmountOnExit: true,
|
|
264
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.
|
|
265
|
-
button: true,
|
|
261
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.ListItemButton, {
|
|
266
262
|
className: classes.nested,
|
|
267
263
|
onClick: handleOpenTopicModal,
|
|
268
264
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.ListItemIcon, {
|
|
@@ -172,8 +172,7 @@ function VarListItem({
|
|
|
172
172
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_Box.default, {
|
|
173
173
|
my: 1,
|
|
174
174
|
width: "100%",
|
|
175
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.
|
|
176
|
-
button: true,
|
|
175
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.ListItemButton, {
|
|
177
176
|
onClick: e => {
|
|
178
177
|
e.target.value = `(${[...options, ""].join("|")})`;
|
|
179
178
|
e.target.name = varName;
|
|
@@ -255,8 +254,7 @@ function VarList({
|
|
|
255
254
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.List, {
|
|
256
255
|
component: "nav",
|
|
257
256
|
disablePadding: true,
|
|
258
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.
|
|
259
|
-
button: true,
|
|
257
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.ListItemButton, {
|
|
260
258
|
onClick: handleClick,
|
|
261
259
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.ListItemText, {
|
|
262
260
|
primary: t("variables"),
|
|
@@ -266,8 +264,7 @@ function VarList({
|
|
|
266
264
|
in: open,
|
|
267
265
|
timeout: "auto",
|
|
268
266
|
unmountOnExit: true,
|
|
269
|
-
children: [!simplified && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.
|
|
270
|
-
button: true,
|
|
267
|
+
children: [!simplified && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.ListItemButton, {
|
|
271
268
|
className: classes.nested,
|
|
272
269
|
onClick: handleOpenVariableModal,
|
|
273
270
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.ListItemIcon, {
|
|
@@ -277,8 +274,7 @@ function VarList({
|
|
|
277
274
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.ListItemText, {
|
|
278
275
|
primary: t("add_new")
|
|
279
276
|
})]
|
|
280
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.
|
|
281
|
-
button: true,
|
|
277
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.ListItemButton, {
|
|
282
278
|
className: classes.nested,
|
|
283
279
|
onClick: handleOpenVariableUpload,
|
|
284
280
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.ListItemIcon, {
|
|
@@ -286,8 +282,7 @@ function VarList({
|
|
|
286
282
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.ListItemText, {
|
|
287
283
|
primary: t("upload")
|
|
288
284
|
})]
|
|
289
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.
|
|
290
|
-
button: true,
|
|
285
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.ListItemButton, {
|
|
291
286
|
className: classes.nested,
|
|
292
287
|
onClick: () => {
|
|
293
288
|
(0, _handleBotVarsDownload.default)(varEntries, botName);
|
|
@@ -637,7 +637,8 @@ function Bot({
|
|
|
637
637
|
stopSpeaking: stopSpeaking,
|
|
638
638
|
isSpeaking: isSpeaking,
|
|
639
639
|
isSpeakingTextContainer: isSpeakingTextContainer,
|
|
640
|
-
isDynamicResponsesEnabled: isDynamicResponsesClassroomEnabled
|
|
640
|
+
isDynamicResponsesEnabled: isDynamicResponsesClassroomEnabled,
|
|
641
|
+
isUserInternal: isUserInternal
|
|
641
642
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ResponsiveDialog.default, {
|
|
642
643
|
open: instructionDialogOpen,
|
|
643
644
|
handleClose: handleCloseInstructions,
|
|
@@ -44,7 +44,8 @@ function UpdateBot({
|
|
|
44
44
|
studentInstructions: "",
|
|
45
45
|
tags: [],
|
|
46
46
|
phrasesToBoost: [],
|
|
47
|
-
isDynamicResponsesEnabled: "enable"
|
|
47
|
+
isDynamicResponsesEnabled: "enable",
|
|
48
|
+
isAdvancedBot: false
|
|
48
49
|
},
|
|
49
50
|
verificationStatus,
|
|
50
51
|
onSubmit,
|
|
@@ -81,7 +82,8 @@ function UpdateBot({
|
|
|
81
82
|
introMessage,
|
|
82
83
|
tags,
|
|
83
84
|
phrasesToBoost,
|
|
84
|
-
isDynamicResponsesEnabled
|
|
85
|
+
isDynamicResponsesEnabled,
|
|
86
|
+
isAdvancedBot
|
|
85
87
|
} = initialValues;
|
|
86
88
|
const difficultyOptions = difficulties.map((d, idx) => {
|
|
87
89
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_MenuItem.default, {
|
|
@@ -175,7 +177,8 @@ function UpdateBot({
|
|
|
175
177
|
visibility,
|
|
176
178
|
translationEnabled,
|
|
177
179
|
picture,
|
|
178
|
-
isDynamicResponsesEnabled
|
|
180
|
+
isDynamicResponsesEnabled,
|
|
181
|
+
isAdvancedBot
|
|
179
182
|
},
|
|
180
183
|
enableReinitialize: enableReinitialize,
|
|
181
184
|
validationSchema: _Steps.BotSettings.validationSchema,
|
|
@@ -671,7 +671,7 @@ function BotListItem({
|
|
|
671
671
|
onClick: markBotAsAdvanced,
|
|
672
672
|
"aria-label": isBotAdvanced ? "Unmark bot as advanced" : "Mark bot as advanced",
|
|
673
673
|
disabled: isCreator ? false : true,
|
|
674
|
-
children: isBotAdvanced ? /*#__PURE__*/(0, _jsxRuntime.jsx)(
|
|
674
|
+
children: isBotAdvanced ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_FlashOn.default, {}) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_FlashOff.default, {})
|
|
675
675
|
})
|
|
676
676
|
}) : null, isCreator && isLargeScreen && /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Tooltip, {
|
|
677
677
|
title: t("move_bot"),
|
|
@@ -21,6 +21,7 @@ var _utils = require("../../utils");
|
|
|
21
21
|
var _styles = require("@mui/material/styles");
|
|
22
22
|
var _useConfirm = _interopRequireDefault(require("../../hooks/useConfirm"));
|
|
23
23
|
var _sortable = require("@dnd-kit/sortable");
|
|
24
|
+
var _DragHandle = _interopRequireDefault(require("@mui/icons-material/DragHandle"));
|
|
24
25
|
var _dragAndDrop = require("../../utils/dragAndDrop/dragAndDrop");
|
|
25
26
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
26
27
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
@@ -79,9 +80,7 @@ function Phrase(props) {
|
|
|
79
80
|
siteLanguage,
|
|
80
81
|
selectedPhrases,
|
|
81
82
|
handleSelectPhrase,
|
|
82
|
-
verificationStatus
|
|
83
|
-
isDragDisabled,
|
|
84
|
-
setDisableDrag
|
|
83
|
+
verificationStatus
|
|
85
84
|
} = props;
|
|
86
85
|
const {
|
|
87
86
|
phrase = "",
|
|
@@ -113,7 +112,6 @@ function Phrase(props) {
|
|
|
113
112
|
const handleClickOpenListener = () => {
|
|
114
113
|
if (isbrowserSupported) {
|
|
115
114
|
setIsListenerOpen(true);
|
|
116
|
-
setDisableDrag(true);
|
|
117
115
|
} else {
|
|
118
116
|
setbrowserSupported(false);
|
|
119
117
|
window.alert("Native microphone recording is only supported in https. Please use localhost for testing purposes");
|
|
@@ -125,15 +123,12 @@ function Phrase(props) {
|
|
|
125
123
|
};
|
|
126
124
|
const handleCloseListener = () => {
|
|
127
125
|
setIsListenerOpen(false);
|
|
128
|
-
setDisableDrag(false);
|
|
129
126
|
};
|
|
130
127
|
const handleClickOpenUpdate = () => {
|
|
131
128
|
setIsUpdateOpen(true);
|
|
132
|
-
setDisableDrag(true);
|
|
133
129
|
};
|
|
134
130
|
const handleCloseUpdate = () => {
|
|
135
131
|
setIsUpdateOpen(false);
|
|
136
|
-
setDisableDrag(false);
|
|
137
132
|
};
|
|
138
133
|
const combinedVoices = props.phrase.voices && props.phrase.voices.length > 0 ? [{
|
|
139
134
|
label: "Uploaded",
|
|
@@ -275,18 +270,6 @@ function Phrase(props) {
|
|
|
275
270
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Delete.default, {})
|
|
276
271
|
})
|
|
277
272
|
})
|
|
278
|
-
}), !disableDragAndDrop && /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Tooltip, {
|
|
279
|
-
title: t("move_phrase"),
|
|
280
|
-
enterDelay: 300,
|
|
281
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.IconButton, {
|
|
282
|
-
style: {
|
|
283
|
-
cursor: "move"
|
|
284
|
-
},
|
|
285
|
-
"aria-label": "Move phrase",
|
|
286
|
-
disabled: isDragDisabled || disableDragAndDrop,
|
|
287
|
-
size: "large",
|
|
288
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_DragIndicator.default, {})
|
|
289
|
-
})
|
|
290
273
|
})]
|
|
291
274
|
})]
|
|
292
275
|
})]
|
|
@@ -359,7 +342,6 @@ function PhraseList({
|
|
|
359
342
|
const [confirm] = (0, _useConfirm.default)(t);
|
|
360
343
|
const [phrasesArray, setPhrasesArray] = (0, _react.useState)([]);
|
|
361
344
|
const [selectedPhrases, setSelectedPhrases] = (0, _react.useState)([]);
|
|
362
|
-
const [disableDrag, setDisableDrag] = (0, _react.useState)(false);
|
|
363
345
|
|
|
364
346
|
// Used for useEffect as dependency to check for a phrase
|
|
365
347
|
// update in array.
|
|
@@ -441,7 +423,7 @@ function PhraseList({
|
|
|
441
423
|
}, index))
|
|
442
424
|
});
|
|
443
425
|
}
|
|
444
|
-
return !
|
|
426
|
+
return !isDragDisabled ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_dragAndDrop.SortableDndContextWrapper, {
|
|
445
427
|
onDragEnd: onDragEnd,
|
|
446
428
|
items: phrasesArray.map(phrase => `phrase-${phrase.phraseId}`),
|
|
447
429
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.List, {
|
|
@@ -494,24 +476,50 @@ function PhraseList({
|
|
|
494
476
|
})]
|
|
495
477
|
})]
|
|
496
478
|
}),
|
|
497
|
-
children: phrasesArray.map((phrase, index) => /*#__PURE__*/(0, _jsxRuntime.jsx)(_dragAndDrop.
|
|
498
|
-
disabled: isDragDisabled,
|
|
479
|
+
children: phrasesArray.map((phrase, index) => /*#__PURE__*/(0, _jsxRuntime.jsx)(_dragAndDrop.SortableHandleOnly, {
|
|
499
480
|
sortId: `phrase-${phrase.phraseId}`,
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
481
|
+
index: phrase.phraseId,
|
|
482
|
+
renderHandle: ({
|
|
483
|
+
setActivatorNodeRef,
|
|
484
|
+
listeners
|
|
485
|
+
}) => isCreator && /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Tooltip, {
|
|
486
|
+
title: t("move_phrase"),
|
|
487
|
+
enterDelay: 300,
|
|
488
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.IconButton, {
|
|
489
|
+
size: "large",
|
|
490
|
+
"aria-label": "Drag Answer",
|
|
491
|
+
ref: setActivatorNodeRef,
|
|
492
|
+
...listeners,
|
|
493
|
+
disabled: isDragDisabled || disableDragAndDrop,
|
|
494
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_DragHandle.default, {})
|
|
495
|
+
})
|
|
496
|
+
}),
|
|
497
|
+
children: ({
|
|
498
|
+
renderHandle
|
|
499
|
+
}) => /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Box, {
|
|
500
|
+
display: "flex",
|
|
501
|
+
alignItems: "center",
|
|
502
|
+
justifyContent: "space-between",
|
|
503
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Box, {
|
|
504
|
+
flexGrow: 1,
|
|
505
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(Phrase, {
|
|
506
|
+
t: t,
|
|
507
|
+
phraseIndex: index,
|
|
508
|
+
phrase: phrase,
|
|
509
|
+
isCreator: isCreator,
|
|
510
|
+
disableGutters: disableGutters,
|
|
511
|
+
disableActions: disableActions,
|
|
512
|
+
disableDragAndDrop: disableDragAndDrop,
|
|
513
|
+
selectedPhrases: selectedPhrases,
|
|
514
|
+
handleSelectPhrase: handleSelectPhrase,
|
|
515
|
+
handleRemovePhrase: handleRemovePhrase,
|
|
516
|
+
handleDeletePhrases: handleDeletePhrases,
|
|
517
|
+
...otherProps
|
|
518
|
+
})
|
|
519
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Box, {
|
|
520
|
+
ml: isCreator ? -2 : undefined,
|
|
521
|
+
children: renderHandle && renderHandle()
|
|
522
|
+
})]
|
|
515
523
|
})
|
|
516
524
|
}, `phrase-${phrase.phraseId}`))
|
|
517
525
|
})
|
|
@@ -565,24 +573,50 @@ function PhraseList({
|
|
|
565
573
|
})]
|
|
566
574
|
})]
|
|
567
575
|
}),
|
|
568
|
-
children: phrasesArray.map((phrase, index) => /*#__PURE__*/(0, _jsxRuntime.jsx)(_dragAndDrop.
|
|
569
|
-
disabled: isDragDisabled,
|
|
576
|
+
children: phrasesArray.map((phrase, index) => /*#__PURE__*/(0, _jsxRuntime.jsx)(_dragAndDrop.SortableHandleOnly, {
|
|
570
577
|
sortId: `phrase-${phrase.phraseId}`,
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
578
|
+
index: phrase.phraseId,
|
|
579
|
+
renderHandle: ({
|
|
580
|
+
setActivatorNodeRef,
|
|
581
|
+
listeners
|
|
582
|
+
}) => isCreator && /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Tooltip, {
|
|
583
|
+
title: t("move_phrase"),
|
|
584
|
+
enterDelay: 300,
|
|
585
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.IconButton, {
|
|
586
|
+
size: "large",
|
|
587
|
+
"aria-label": "Drag Answer",
|
|
588
|
+
ref: setActivatorNodeRef,
|
|
589
|
+
...listeners,
|
|
590
|
+
disabled: isDragDisabled || disableDragAndDrop,
|
|
591
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_DragHandle.default, {})
|
|
592
|
+
})
|
|
593
|
+
}),
|
|
594
|
+
children: ({
|
|
595
|
+
renderHandle
|
|
596
|
+
}) => /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Box, {
|
|
597
|
+
display: "flex",
|
|
598
|
+
alignItems: "center",
|
|
599
|
+
justifyContent: "space-between",
|
|
600
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Box, {
|
|
601
|
+
flexGrow: 1,
|
|
602
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(Phrase, {
|
|
603
|
+
t: t,
|
|
604
|
+
phraseIndex: index,
|
|
605
|
+
phrase: phrase,
|
|
606
|
+
isCreator: isCreator,
|
|
607
|
+
disableGutters: disableGutters,
|
|
608
|
+
disableActions: disableActions,
|
|
609
|
+
disableDragAndDrop: disableDragAndDrop,
|
|
610
|
+
selectedPhrases: selectedPhrases,
|
|
611
|
+
handleSelectPhrase: handleSelectPhrase,
|
|
612
|
+
handleRemovePhrase: handleRemovePhrase,
|
|
613
|
+
handleDeletePhrases: handleDeletePhrases,
|
|
614
|
+
...otherProps
|
|
615
|
+
})
|
|
616
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Box, {
|
|
617
|
+
ml: isCreator ? -2 : undefined,
|
|
618
|
+
children: renderHandle && renderHandle()
|
|
619
|
+
})]
|
|
586
620
|
})
|
|
587
621
|
}, `phrase-${phrase.phraseId}`))
|
|
588
622
|
});
|
|
@@ -247,8 +247,7 @@ function ImageLibrary({
|
|
|
247
247
|
className: classes.list,
|
|
248
248
|
component: "nav",
|
|
249
249
|
disablePadding: true,
|
|
250
|
-
children: categories.map((category, i) => /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.
|
|
251
|
-
button: true,
|
|
250
|
+
children: categories.map((category, i) => /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.ListItemButton, {
|
|
252
251
|
selected: selectedCategory === category,
|
|
253
252
|
onClick: () => handleCategoryClick(category),
|
|
254
253
|
className: classes.listItem,
|
|
@@ -191,8 +191,7 @@ function ShareDrawer({
|
|
|
191
191
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.ListItemText, {
|
|
192
192
|
primary: "Google Classroom"
|
|
193
193
|
})]
|
|
194
|
-
}), subscription?.isPaidUser && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.
|
|
195
|
-
button: true,
|
|
194
|
+
}), subscription?.isPaidUser && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.ListItemButton, {
|
|
196
195
|
onClick: () => openWindow(googleClassroomLink),
|
|
197
196
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.ListItemAvatar, {
|
|
198
197
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Avatar, {
|
|
@@ -46,7 +46,7 @@ function SignOut({
|
|
|
46
46
|
alt: ""
|
|
47
47
|
}) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Avatar, {
|
|
48
48
|
sx: theme => ({
|
|
49
|
-
backgroundColor: theme.palette.mode === "dark" ? "
|
|
49
|
+
backgroundColor: theme.palette.mode === "dark" ? "#ffffff" : "#bdbdbd",
|
|
50
50
|
color: theme.palette.mode === "dark" ? theme.palette.background.default : ""
|
|
51
51
|
}),
|
|
52
52
|
alt: "",
|