@nualang/nualang-ui-components 0.1.1226 → 0.1.1227
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/Dialogs/CreatorNotSubscribedUpgrade/CreatorNotSubscribedUpgrade.js +57 -0
- package/dist/Editors/Bot/Editor/BotDesigner/VarList.js +8 -9
- package/dist/Editors/Bot/Editor/Editor.js +68 -119
- package/dist/Forms/InputHelper/InputHelper.js +1 -1
- package/dist/Screens/Classrooms/ViewClassroom/ViewClassroom.js +40 -1
- package/dist/utils/index.js +5 -2
- package/package.json +1 -1
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _DialogContentText = _interopRequireDefault(require("@mui/material/DialogContentText"));
|
|
8
|
+
var _ResponsiveDialog = _interopRequireDefault(require("../ResponsiveDialog/ResponsiveDialog"));
|
|
9
|
+
var _material = require("@mui/material");
|
|
10
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
11
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
12
|
+
function CreatorNotSubscribedUpgrade({
|
|
13
|
+
t = text => text,
|
|
14
|
+
open,
|
|
15
|
+
handleClose,
|
|
16
|
+
closeText,
|
|
17
|
+
handleSubmit,
|
|
18
|
+
submitText,
|
|
19
|
+
descriptions = [],
|
|
20
|
+
dialogTitle
|
|
21
|
+
}) {
|
|
22
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_ResponsiveDialog.default, {
|
|
23
|
+
open: open,
|
|
24
|
+
handleClose: handleClose,
|
|
25
|
+
closeText: closeText,
|
|
26
|
+
handleSubmit: handleSubmit,
|
|
27
|
+
submitText: submitText,
|
|
28
|
+
dialogTitle: dialogTitle,
|
|
29
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_DialogContentText.default, {
|
|
30
|
+
component: "div",
|
|
31
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Box, {
|
|
32
|
+
sx: {
|
|
33
|
+
paddingBottom: 1
|
|
34
|
+
},
|
|
35
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("p", {
|
|
36
|
+
children: t("creator_not_subscribed_upgrade")
|
|
37
|
+
})
|
|
38
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Box, {
|
|
39
|
+
component: "ul",
|
|
40
|
+
sx: {
|
|
41
|
+
listStyleType: "disc",
|
|
42
|
+
paddingLeft: 3,
|
|
43
|
+
"& li": {
|
|
44
|
+
marginBottom: "8px",
|
|
45
|
+
fontSize: "1rem",
|
|
46
|
+
lineHeight: "1.5"
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
children: descriptions.map((desc, index) => /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Box, {
|
|
50
|
+
component: "li",
|
|
51
|
+
children: t(desc)
|
|
52
|
+
}, index))
|
|
53
|
+
})]
|
|
54
|
+
})
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
var _default = exports.default = CreatorNotSubscribedUpgrade;
|
|
@@ -17,13 +17,11 @@ var _Add = _interopRequireDefault(require("@mui/icons-material/Add"));
|
|
|
17
17
|
var _handleBotVarsDownload = _interopRequireDefault(require("../../../../hooks/handleBotVarsDownload"));
|
|
18
18
|
var _UploadBotVars = _interopRequireDefault(require("../../../../Dialogs/UploadBotVars/UploadBotVars"));
|
|
19
19
|
var _ImageSelector = _interopRequireDefault(require("../../../../Forms/ImageSelector"));
|
|
20
|
+
var _index = require("../../../../utils/index");
|
|
20
21
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
21
22
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
22
23
|
// Components
|
|
23
24
|
|
|
24
|
-
const markdownLinkRegex = /\[(.*)\]\(([^ ]+?)( "(.+)")?\)/;
|
|
25
|
-
const markdownImageLinkRegex = /!\[(.*)\]\(([^ ]+?)( "(.+)")?\)/;
|
|
26
|
-
const multipleOptionsRegex = /^\((.*)\)$/;
|
|
27
25
|
const DEFAULT_BOT_IMAGE = `${process.env.REACT_APP_API}/image-creator/848/480/691f89/ffffff/fa-images?fontSize=200`;
|
|
28
26
|
function VarListItem({
|
|
29
27
|
t,
|
|
@@ -38,9 +36,9 @@ function VarListItem({
|
|
|
38
36
|
botId
|
|
39
37
|
}) {
|
|
40
38
|
const [selectedImage, setSelectedImage] = (0, _react.useState)("");
|
|
41
|
-
if (varValue && markdownImageLinkRegex.test(varValue)) {
|
|
39
|
+
if (varValue && _index.markdownImageLinkRegex.test(varValue)) {
|
|
42
40
|
// Image Variable
|
|
43
|
-
const url = varValue.match(markdownImageLinkRegex)[2];
|
|
41
|
+
const url = varValue.match(_index.markdownImageLinkRegex)[2];
|
|
44
42
|
const handleImageChange = event => {
|
|
45
43
|
setSelectedImage(event.target.value);
|
|
46
44
|
};
|
|
@@ -88,7 +86,7 @@ function VarListItem({
|
|
|
88
86
|
})
|
|
89
87
|
})]
|
|
90
88
|
});
|
|
91
|
-
} else if (varValue && markdownLinkRegex.test(varValue)) {
|
|
89
|
+
} else if (varValue && _index.markdownLinkRegex.test(varValue)) {
|
|
92
90
|
// Link Variable
|
|
93
91
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_Box.default, {
|
|
94
92
|
px: 2,
|
|
@@ -110,9 +108,9 @@ function VarListItem({
|
|
|
110
108
|
}
|
|
111
109
|
})
|
|
112
110
|
});
|
|
113
|
-
} else if (varValue && multipleOptionsRegex.test(varValue)) {
|
|
111
|
+
} else if (varValue && _index.multipleOptionsRegex.test(varValue)) {
|
|
114
112
|
// Multiple Options Variable
|
|
115
|
-
const options = varValue.match(multipleOptionsRegex)[1].split("|");
|
|
113
|
+
const options = varValue.match(_index.multipleOptionsRegex)[1].split("|");
|
|
116
114
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_Box.default, {
|
|
117
115
|
px: 2,
|
|
118
116
|
className: classes.nested,
|
|
@@ -149,7 +147,8 @@ function VarListItem({
|
|
|
149
147
|
onClick: handleSelectCurrentInput,
|
|
150
148
|
autoFocus: option === "",
|
|
151
149
|
inputProps: {
|
|
152
|
-
"data-type": "var"
|
|
150
|
+
"data-type": "var",
|
|
151
|
+
"data-option-index": index
|
|
153
152
|
}
|
|
154
153
|
})
|
|
155
154
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Grid, {
|
|
@@ -46,6 +46,7 @@ require("codemirror/addon/search/search.js");
|
|
|
46
46
|
require("codemirror/addon/search/jump-to-line.js");
|
|
47
47
|
require("codemirror/addon/dialog/dialog.js");
|
|
48
48
|
require("codemirror/addon/dialog/dialog.css");
|
|
49
|
+
var _index = require("../../../utils/index");
|
|
49
50
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
50
51
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
51
52
|
// import AddCommentIcon from '@mui/icons-material/AddComment';
|
|
@@ -558,6 +559,7 @@ function Editor({
|
|
|
558
559
|
const handleSwitchEditor = () => {
|
|
559
560
|
setSimplified(false);
|
|
560
561
|
handleCloseEditorModal();
|
|
562
|
+
setFormattingOptionsAnchorEl(null);
|
|
561
563
|
};
|
|
562
564
|
(0, _react.useEffect)(() => {
|
|
563
565
|
const createdChart = createBotFlowChart(debouncedBotJSON, {
|
|
@@ -584,6 +586,7 @@ function Editor({
|
|
|
584
586
|
};
|
|
585
587
|
const handleChangeView = event => {
|
|
586
588
|
setIsEditView(event.target.checked);
|
|
589
|
+
setFormattingOptionsAnchorEl(null);
|
|
587
590
|
};
|
|
588
591
|
const [isDisabled, setIsDisabled] = (0, _react.useState)(true);
|
|
589
592
|
const [isButtonClicked, setIsButtonClicked] = (0, _react.useState)(false);
|
|
@@ -612,6 +615,16 @@ function Editor({
|
|
|
612
615
|
};
|
|
613
616
|
const undo = () => editor.undo();
|
|
614
617
|
const redo = () => editor.redo();
|
|
618
|
+
const wrapTextSelection = (start, end, currentText, selectionStart, selectionEnd) => {
|
|
619
|
+
let newText = "";
|
|
620
|
+
if (selectionStart !== selectionEnd) {
|
|
621
|
+
const selectedText = currentText.slice(selectionStart, selectionEnd);
|
|
622
|
+
newText = [currentText.slice(0, selectionStart), `${start}${selectedText}${end}`, currentText.slice(selectionEnd)].join("");
|
|
623
|
+
} else {
|
|
624
|
+
newText = [currentText.slice(0, selectionStart), `${start}${t("")}${end}`, currentText.slice(selectionStart)].join("");
|
|
625
|
+
}
|
|
626
|
+
return newText;
|
|
627
|
+
};
|
|
615
628
|
const toggleAround = (start, end) => {
|
|
616
629
|
if (isEditView) {
|
|
617
630
|
const cm = editor.doc.cm;
|
|
@@ -644,19 +657,22 @@ function Editor({
|
|
|
644
657
|
dataset
|
|
645
658
|
} = currentInput;
|
|
646
659
|
const {
|
|
647
|
-
type
|
|
660
|
+
type,
|
|
661
|
+
optionIndex
|
|
648
662
|
} = dataset;
|
|
649
663
|
const newRivescriptJSON = botJSON;
|
|
650
664
|
if (["var", "sub", "array"].includes(type)) {
|
|
651
665
|
const currentText = newRivescriptJSON.begin[type][name];
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
const
|
|
655
|
-
|
|
656
|
-
|
|
666
|
+
if (_index.multipleOptionsRegex.test(currentText)) {
|
|
667
|
+
// Multiple Options Variable
|
|
668
|
+
const options = currentText.match(_index.multipleOptionsRegex)[1].split("|");
|
|
669
|
+
let currentOptionText = options[optionIndex];
|
|
670
|
+
const newText = wrapTextSelection(start, end, currentOptionText, selectionStart, selectionEnd);
|
|
671
|
+
options[optionIndex] = newText;
|
|
672
|
+
newRivescriptJSON.begin[type][name] = `(${options.join("|")})`;
|
|
657
673
|
handleBotJSONChange(newRivescriptJSON);
|
|
658
674
|
} else {
|
|
659
|
-
const newText =
|
|
675
|
+
const newText = wrapTextSelection(start, end, currentText, selectionStart, selectionEnd);
|
|
660
676
|
newRivescriptJSON.begin[type][name] = newText;
|
|
661
677
|
handleBotJSONChange(newRivescriptJSON);
|
|
662
678
|
}
|
|
@@ -666,82 +682,7 @@ function Editor({
|
|
|
666
682
|
triggerIndex
|
|
667
683
|
} = dataset;
|
|
668
684
|
const currentText = newRivescriptJSON.topics[topicName][triggerIndex].trigger;
|
|
669
|
-
|
|
670
|
-
if (selectionStart !== selectionEnd) {
|
|
671
|
-
const selectedText = currentText.slice(selectionStart, selectionEnd);
|
|
672
|
-
newText = [currentText.slice(0, selectionStart), `${start}${selectedText}${end}`, currentText.slice(selectionEnd)].join("");
|
|
673
|
-
newRivescriptJSON.topics[topicName][triggerIndex].trigger = newText;
|
|
674
|
-
handleBotJSONChange(newRivescriptJSON);
|
|
675
|
-
} else {
|
|
676
|
-
newText = [currentText.slice(0, selectionStart), `${start}${t("")}${end}`, currentText.slice(selectionStart)].join("");
|
|
677
|
-
newRivescriptJSON.topics[topicName][triggerIndex].trigger = newText;
|
|
678
|
-
handleBotJSONChange(newRivescriptJSON);
|
|
679
|
-
}
|
|
680
|
-
} else if (type === "reply") {
|
|
681
|
-
const {
|
|
682
|
-
topicName,
|
|
683
|
-
triggerIndex,
|
|
684
|
-
replyIndex
|
|
685
|
-
} = dataset;
|
|
686
|
-
const currentText = newRivescriptJSON.topics[topicName][triggerIndex].reply[replyIndex];
|
|
687
|
-
let newText = "";
|
|
688
|
-
if (selectionStart !== selectionEnd) {
|
|
689
|
-
const selectedText = currentText.slice(selectionStart, selectionEnd);
|
|
690
|
-
newText = [currentText.slice(0, selectionStart), `${start}${selectedText}${end}`, currentText.slice(selectionEnd)].join("");
|
|
691
|
-
newRivescriptJSON.topics[topicName][triggerIndex].reply[replyIndex] = newText;
|
|
692
|
-
handleBotJSONChange(newRivescriptJSON);
|
|
693
|
-
} else {
|
|
694
|
-
newText = [currentText.slice(0, selectionStart), `${start}${t("")}${end}`, currentText.slice(selectionStart)].join("");
|
|
695
|
-
newRivescriptJSON.topics[topicName][triggerIndex].reply[replyIndex] = newText;
|
|
696
|
-
handleBotJSONChange(newRivescriptJSON);
|
|
697
|
-
}
|
|
698
|
-
}
|
|
699
|
-
currentInput.focus();
|
|
700
|
-
}
|
|
701
|
-
};
|
|
702
|
-
const addSpecialCharacter = (start, end) => {
|
|
703
|
-
const multipleOptionsRegex = /^\((.*)\)$/;
|
|
704
|
-
if (isEditView) {
|
|
705
|
-
const cm = editor.doc.cm;
|
|
706
|
-
cm.focus();
|
|
707
|
-
const doc = cm.getDoc();
|
|
708
|
-
const cursor = doc.getCursor();
|
|
709
|
-
doc.replaceRange(start + end, {
|
|
710
|
-
line: cursor.line,
|
|
711
|
-
ch: cursor.ch
|
|
712
|
-
});
|
|
713
|
-
doc.setCursor({
|
|
714
|
-
line: cursor.line,
|
|
715
|
-
ch: cursor.ch + start.length
|
|
716
|
-
});
|
|
717
|
-
} else if (currentInput && currentInput.name) {
|
|
718
|
-
const {
|
|
719
|
-
name,
|
|
720
|
-
selectionStart,
|
|
721
|
-
dataset
|
|
722
|
-
} = currentInput;
|
|
723
|
-
const {
|
|
724
|
-
type
|
|
725
|
-
} = dataset;
|
|
726
|
-
const newRivescriptJSON = botJSON;
|
|
727
|
-
if (["var", "sub"].includes(type)) {
|
|
728
|
-
const currentText = newRivescriptJSON.begin[type][name];
|
|
729
|
-
const updatedSelectionStart = multipleOptionsRegex.test(currentText) ? selectionStart + 1 : selectionStart;
|
|
730
|
-
const newText = [currentText.slice(0, updatedSelectionStart), `${start}${end}`, currentText.slice(updatedSelectionStart)].join("");
|
|
731
|
-
newRivescriptJSON.begin[type][name] = newText;
|
|
732
|
-
handleBotJSONChange(newRivescriptJSON);
|
|
733
|
-
} else if (type === "array") {
|
|
734
|
-
const currentText = newRivescriptJSON.begin[type][name];
|
|
735
|
-
const newText = [[currentText.slice(0, selectionStart), `${start}${end}`, currentText.slice(selectionStart)].join("")];
|
|
736
|
-
newRivescriptJSON.begin[type][name] = newText;
|
|
737
|
-
handleBotJSONChange(newRivescriptJSON);
|
|
738
|
-
} else if (type === "trigger") {
|
|
739
|
-
const {
|
|
740
|
-
topicName,
|
|
741
|
-
triggerIndex
|
|
742
|
-
} = dataset;
|
|
743
|
-
const currentText = newRivescriptJSON.topics[topicName][triggerIndex].trigger;
|
|
744
|
-
const newText = [currentText.slice(0, selectionStart), `${start}${end}`, currentText.slice(selectionStart)].join("");
|
|
685
|
+
const newText = wrapTextSelection(start, end, currentText, selectionStart, selectionEnd);
|
|
745
686
|
newRivescriptJSON.topics[topicName][triggerIndex].trigger = newText;
|
|
746
687
|
handleBotJSONChange(newRivescriptJSON);
|
|
747
688
|
} else if (type === "reply") {
|
|
@@ -751,7 +692,7 @@ function Editor({
|
|
|
751
692
|
replyIndex
|
|
752
693
|
} = dataset;
|
|
753
694
|
const currentText = newRivescriptJSON.topics[topicName][triggerIndex].reply[replyIndex];
|
|
754
|
-
const newText =
|
|
695
|
+
const newText = wrapTextSelection(start, end, currentText, selectionStart, selectionEnd);
|
|
755
696
|
newRivescriptJSON.topics[topicName][triggerIndex].reply[replyIndex] = newText;
|
|
756
697
|
handleBotJSONChange(newRivescriptJSON);
|
|
757
698
|
}
|
|
@@ -772,7 +713,7 @@ function Editor({
|
|
|
772
713
|
setImageModalOpen(false);
|
|
773
714
|
setIsDisabled(true);
|
|
774
715
|
};
|
|
775
|
-
const handleAddImage =
|
|
716
|
+
const handleAddImage = ({
|
|
776
717
|
name,
|
|
777
718
|
value
|
|
778
719
|
}) => {
|
|
@@ -783,17 +724,24 @@ function Editor({
|
|
|
783
724
|
console.error("error", error);
|
|
784
725
|
}
|
|
785
726
|
};
|
|
786
|
-
const
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
727
|
+
const handleAddLink = ({
|
|
728
|
+
name,
|
|
729
|
+
value
|
|
730
|
+
}) => {
|
|
731
|
+
handleCloseLinkModal();
|
|
732
|
+
try {
|
|
733
|
+
toggleAround(`[${name}`, `](${value})`);
|
|
734
|
+
} catch (error) {
|
|
735
|
+
console.error("error", error);
|
|
736
|
+
}
|
|
791
737
|
};
|
|
792
738
|
const bold = () => {
|
|
793
739
|
toggleAround("**", "**");
|
|
740
|
+
handleToggleFormattingOptions();
|
|
794
741
|
};
|
|
795
742
|
const italicize = () => {
|
|
796
743
|
toggleAround("*", "*");
|
|
744
|
+
handleToggleFormattingOptions();
|
|
797
745
|
};
|
|
798
746
|
|
|
799
747
|
// const insertTopic = () => {
|
|
@@ -810,7 +758,7 @@ function Editor({
|
|
|
810
758
|
|
|
811
759
|
const specialCharacter = e => {
|
|
812
760
|
const character = e.target.value;
|
|
813
|
-
|
|
761
|
+
toggleAround("", character);
|
|
814
762
|
};
|
|
815
763
|
|
|
816
764
|
// const handleTopicTrigger = (e) => {
|
|
@@ -1087,7 +1035,6 @@ function Editor({
|
|
|
1087
1035
|
style: {
|
|
1088
1036
|
zIndex: 1400
|
|
1089
1037
|
},
|
|
1090
|
-
transition: true,
|
|
1091
1038
|
disablePortal: true,
|
|
1092
1039
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Paper, {
|
|
1093
1040
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Toolbar, {
|
|
@@ -1095,34 +1042,34 @@ function Editor({
|
|
|
1095
1042
|
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Box, {
|
|
1096
1043
|
display: "flex",
|
|
1097
1044
|
width: "100%",
|
|
1098
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1045
|
+
children: [isEditView && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
1046
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Tooltip, {
|
|
1047
|
+
title: t("undo_action"),
|
|
1048
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
1049
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.IconButton, {
|
|
1050
|
+
color: "inherit",
|
|
1051
|
+
"aria-label": t("undo_action"),
|
|
1052
|
+
onClick: undo,
|
|
1053
|
+
size: "large",
|
|
1054
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Undo.default, {})
|
|
1055
|
+
})
|
|
1108
1056
|
})
|
|
1109
|
-
})
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Redo.default, {})
|
|
1057
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Tooltip, {
|
|
1058
|
+
title: t("redo_action"),
|
|
1059
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
1060
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.IconButton, {
|
|
1061
|
+
color: "inherit",
|
|
1062
|
+
"aria-label": t("redo_action"),
|
|
1063
|
+
onClick: redo,
|
|
1064
|
+
size: "large",
|
|
1065
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Redo.default, {})
|
|
1066
|
+
})
|
|
1120
1067
|
})
|
|
1121
|
-
})
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1068
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Divider, {
|
|
1069
|
+
orientation: "vertical",
|
|
1070
|
+
flexItem: true,
|
|
1071
|
+
variant: "middle"
|
|
1072
|
+
})]
|
|
1126
1073
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Tooltip, {
|
|
1127
1074
|
title: t("insert_bold"),
|
|
1128
1075
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.IconButton, {
|
|
@@ -1162,6 +1109,7 @@ function Editor({
|
|
|
1162
1109
|
onClick: () => {
|
|
1163
1110
|
handleChangeSimplified(true);
|
|
1164
1111
|
setIsEditView(false);
|
|
1112
|
+
setFormattingOptionsAnchorEl(null);
|
|
1165
1113
|
},
|
|
1166
1114
|
startIcon: /*#__PURE__*/(0, _jsxRuntime.jsx)(_ArrowBack.default, {}),
|
|
1167
1115
|
variant: "outlined",
|
|
@@ -1177,6 +1125,7 @@ function Editor({
|
|
|
1177
1125
|
className: classes.formattingOptionsButton,
|
|
1178
1126
|
size: "large",
|
|
1179
1127
|
disabled: isDisabled && !isEditView,
|
|
1128
|
+
onMouseDown: () => setIsButtonClicked(true),
|
|
1180
1129
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_TextFormat.default, {})
|
|
1181
1130
|
})
|
|
1182
1131
|
})
|
|
@@ -1385,7 +1334,7 @@ function Editor({
|
|
|
1385
1334
|
t: t,
|
|
1386
1335
|
open: linkModalOpen,
|
|
1387
1336
|
onClose: handleCloseLinkModal,
|
|
1388
|
-
handleAddLink:
|
|
1337
|
+
handleAddLink: handleAddLink,
|
|
1389
1338
|
verificationStatus: verificationStatus
|
|
1390
1339
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_SwitchEditorModal.default, {
|
|
1391
1340
|
t: t,
|
|
@@ -53,7 +53,7 @@ function Adornment(props) {
|
|
|
53
53
|
const toggleEmojiPicker = () => setShowEmojiPicker(prev => !prev);
|
|
54
54
|
const handleEmojiClose = () => setShowEmojiPicker(false);
|
|
55
55
|
const onEmojiClick = event => {
|
|
56
|
-
const newText = [value.slice(0, activeRef.current.selectionStart), `${event.emoji}`, value.slice(activeRef.current.selectionStart)].join("");
|
|
56
|
+
const newText = activeRef ? [value.slice(0, activeRef.current.selectionStart), `${event.emoji}`, value.slice(activeRef.current.selectionStart)].join("") : event.emoji;
|
|
57
57
|
onChange({
|
|
58
58
|
target: {
|
|
59
59
|
name: name,
|
|
@@ -57,6 +57,7 @@ var _Close = _interopRequireDefault(require("@mui/icons-material/Close"));
|
|
|
57
57
|
var _ExitToApp = _interopRequireDefault(require("@mui/icons-material/ExitToApp"));
|
|
58
58
|
var _AssignmentCardsList = _interopRequireDefault(require("../../../Assignments/AssignmentCardsList/AssignmentCardsList"));
|
|
59
59
|
var _Lightbulb = _interopRequireDefault(require("@mui/icons-material/Lightbulb"));
|
|
60
|
+
var _CreatorNotSubscribedUpgrade = _interopRequireDefault(require("../../../Dialogs/CreatorNotSubscribedUpgrade/CreatorNotSubscribedUpgrade"));
|
|
60
61
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
61
62
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
62
63
|
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); }
|
|
@@ -446,7 +447,18 @@ function Classroom({
|
|
|
446
447
|
const [isWaysideClassroom, setIsWaysideClassroom] = (0, _react.useState)(false);
|
|
447
448
|
const [isVideoChatEnabled, setIsVideoChatEnabled] = (0, _react.useState)(false);
|
|
448
449
|
const [isVideoChatEnabledInSettings, setIsVideoChatEnabledInSettings] = (0, _react.useState)(false);
|
|
450
|
+
const [isSubscriptionExpired, setIsSubscriptionExpired] = (0, _react.useState)(false);
|
|
449
451
|
let tabs;
|
|
452
|
+
(0, _react.useEffect)(() => {
|
|
453
|
+
if (creatorSubscription?.isPaidUser === false) {
|
|
454
|
+
setIsSubscriptionExpired(true);
|
|
455
|
+
}
|
|
456
|
+
}, [creatorSubscription]);
|
|
457
|
+
(0, _react.useEffect)(() => {
|
|
458
|
+
if (classroom && classroom.isCreator && creatorSubscription?.isPaidUser === false) {
|
|
459
|
+
handleOpenCreatorNotSubscribedUpgradeModal();
|
|
460
|
+
}
|
|
461
|
+
}, [creatorSubscription]);
|
|
450
462
|
(0, _react.useEffect)(() => {
|
|
451
463
|
const handleHashChange = () => {
|
|
452
464
|
if (window.location.hash === "#Settings" && tabs) {
|
|
@@ -601,6 +613,13 @@ function Classroom({
|
|
|
601
613
|
const handleCloseCreatorNotSubscribedModal = () => {
|
|
602
614
|
setIsCreatorNotSubscribedOpen(false);
|
|
603
615
|
};
|
|
616
|
+
const [isCreatorNotSubscribedUpgradeOpen, setIsCreatorNotSubscribedUpgradeOpen] = (0, _react.useState)(false);
|
|
617
|
+
const handleOpenCreatorNotSubscribedUpgradeModal = () => {
|
|
618
|
+
setIsCreatorNotSubscribedUpgradeOpen(true);
|
|
619
|
+
};
|
|
620
|
+
const handleCloseCreatorNotSubscribedUpgradeModal = () => {
|
|
621
|
+
setIsCreatorNotSubscribedUpgradeOpen(false);
|
|
622
|
+
};
|
|
604
623
|
const [avatarOptionClicked, setAvatarOptionClicked] = (0, _react.useState)(false);
|
|
605
624
|
if (!classroom) {
|
|
606
625
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
@@ -727,6 +746,12 @@ function Classroom({
|
|
|
727
746
|
handleSignIn();
|
|
728
747
|
}
|
|
729
748
|
};
|
|
749
|
+
const handleOpenUpgradePlans = () => {
|
|
750
|
+
navigate("/settings#Subscription");
|
|
751
|
+
};
|
|
752
|
+
const handleReturnToClassrooms = () => {
|
|
753
|
+
navigate("/classrooms");
|
|
754
|
+
};
|
|
730
755
|
const removeCourse = async course => {
|
|
731
756
|
const confirmed = await confirm(t("remove_course"), t("remove_course_confirmation"));
|
|
732
757
|
if (confirmed) {
|
|
@@ -827,11 +852,15 @@ function Classroom({
|
|
|
827
852
|
description: t("join_classroom_to_access"),
|
|
828
853
|
buttonText: t("join"),
|
|
829
854
|
onClick: handleJoin
|
|
855
|
+
}), isMember && isSubscriptionExpired && /*#__PURE__*/(0, _jsxRuntime.jsx)(_Overlay.default, {
|
|
856
|
+
description: t("classroom_creator_subscription_expired"),
|
|
857
|
+
buttonText: t("return_to_classrooms"),
|
|
858
|
+
onClick: handleReturnToClassrooms
|
|
830
859
|
})]
|
|
831
860
|
}, `tab-content-courses`)
|
|
832
861
|
}, {
|
|
833
862
|
label: t("progress"),
|
|
834
|
-
disabled: !(isMember || isCreator),
|
|
863
|
+
disabled: !(isMember || isCreator) || isMember && isSubscriptionExpired,
|
|
835
864
|
id: "Progress",
|
|
836
865
|
TabContent: /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Box, {
|
|
837
866
|
py: 1,
|
|
@@ -854,6 +883,7 @@ function Classroom({
|
|
|
854
883
|
}, `tab-content-progress`)
|
|
855
884
|
}, ...(process.env.REACT_APP_STAGE === "dev" ? [{
|
|
856
885
|
label: t("assignments"),
|
|
886
|
+
disabled: isMember && isSubscriptionExpired,
|
|
857
887
|
id: "Assignments",
|
|
858
888
|
TabContent: /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Box, {
|
|
859
889
|
py: 1,
|
|
@@ -1326,6 +1356,15 @@ function Classroom({
|
|
|
1326
1356
|
t: t,
|
|
1327
1357
|
open: isCreatorNotSubscribedOpen,
|
|
1328
1358
|
handleClose: handleCloseCreatorNotSubscribedModal
|
|
1359
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_CreatorNotSubscribedUpgrade.default, {
|
|
1360
|
+
t: t,
|
|
1361
|
+
open: isCreatorNotSubscribedUpgradeOpen,
|
|
1362
|
+
handleClose: handleCloseCreatorNotSubscribedUpgradeModal,
|
|
1363
|
+
submitText: t("upgrade"),
|
|
1364
|
+
closeText: t("close"),
|
|
1365
|
+
handleSubmit: handleOpenUpgradePlans,
|
|
1366
|
+
dialogTitle: t("creator_not_subscribed_upgrade_title"),
|
|
1367
|
+
descriptions: ["creator_not_subscribed_upgrade_description", "creator_not_subscribed_upgrade_description2", "creator_not_subscribed_upgrade_description3"]
|
|
1329
1368
|
})]
|
|
1330
1369
|
})]
|
|
1331
1370
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
package/dist/utils/index.js
CHANGED
|
@@ -7,9 +7,9 @@ exports.formatCourseMemberCompletions = exports.downsampleBuffer = exports.domai
|
|
|
7
7
|
exports.formatCurrency = formatCurrency;
|
|
8
8
|
exports.formatNumberTotal = exports.formatMarkdownNewlines = exports.formatFileSize = void 0;
|
|
9
9
|
exports.getBase64ImageFromUrl = getBase64ImageFromUrl;
|
|
10
|
-
exports.localeCompareCase = exports.localeCompare = exports.jsonToRivescript = exports.getMicrophoneInfo = exports.getMachineInfo = exports.getBrowserInfo = void 0;
|
|
10
|
+
exports.markdownLinkRegex = exports.markdownImageLinkRegex = exports.localeCompareCase = exports.localeCompare = exports.jsonToRivescript = exports.getMicrophoneInfo = exports.getMachineInfo = exports.getBrowserInfo = void 0;
|
|
11
11
|
exports.moveDecimal = moveDecimal;
|
|
12
|
-
exports.searchStringToObj = exports.rivescriptToJson = exports.replaceWordWithBlank = exports.removeSymbols = exports.removeExtraWhiteSpaces = exports.removeAllSymbolsFillInBlanks = exports.removeAllSymbols = exports.randomId = exports.propsAreEqual = exports.objToSearchString = void 0;
|
|
12
|
+
exports.searchStringToObj = exports.rivescriptToJson = exports.replaceWordWithBlank = exports.removeSymbols = exports.removeExtraWhiteSpaces = exports.removeAllSymbolsFillInBlanks = exports.removeAllSymbols = exports.randomId = exports.propsAreEqual = exports.objToSearchString = exports.multipleOptionsRegex = void 0;
|
|
13
13
|
exports.shuffle = shuffle;
|
|
14
14
|
exports.validateDomain = exports.supportsAudioType = void 0;
|
|
15
15
|
var _deepEqual = _interopRequireDefault(require("deep-equal"));
|
|
@@ -22,6 +22,9 @@ const capitalize = (text = "") => text.charAt(0).toUpperCase() + text.slice(1);
|
|
|
22
22
|
exports.capitalize = capitalize;
|
|
23
23
|
const convertToAlphanumeric = (str = "") => str.trim().replace(/[^a-zA-Z0-9 ]/g, "");
|
|
24
24
|
exports.convertToAlphanumeric = convertToAlphanumeric;
|
|
25
|
+
const markdownLinkRegex = exports.markdownLinkRegex = /\[(.*)\]\(([^ ]+?)( "(.+)")?\)/;
|
|
26
|
+
const markdownImageLinkRegex = exports.markdownImageLinkRegex = /!\[(.*)\]\(([^ ]+?)( "(.+)")?\)/;
|
|
27
|
+
const multipleOptionsRegex = exports.multipleOptionsRegex = /^\((.*)\)$/;
|
|
25
28
|
const ranges = ["\ud83c[\udf00-\udfff]",
|
|
26
29
|
// U+1F300 to U+1F3FF
|
|
27
30
|
"\ud83d[\udc00-\ude4f]",
|