@nualang/nualang-ui-components 0.1.1226 → 0.1.1228

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.
@@ -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
- let newText = "";
653
- if (selectionStart !== selectionEnd) {
654
- const selectedText = currentText.slice(selectionStart, selectionEnd);
655
- newText = [currentText.slice(0, selectionStart), `${start}${selectedText}${end}`, currentText.slice(selectionEnd)].join("");
656
- newRivescriptJSON.begin[type][name] = newText;
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 = [currentText.slice(0, selectionStart), `${start}${t("")}${end}`, currentText.slice(selectionStart)].join("");
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
- let newText = "";
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 = [currentText.slice(0, selectionStart), `${start}${end}`, currentText.slice(selectionStart)].join("");
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 = async ({
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 insertLink = () => {
787
- setLinkModalOpen(true);
788
- };
789
- const insertPhoto = () => {
790
- setImageModalOpen(true);
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
- addSpecialCharacter("", character);
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.jsx)(_material.Tooltip, {
1099
- title: t("undo_action"),
1100
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
1101
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.IconButton, {
1102
- color: "inherit",
1103
- "aria-label": t("undo_action"),
1104
- onClick: undo,
1105
- disabled: !editor,
1106
- size: "large",
1107
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Undo.default, {})
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
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Tooltip, {
1111
- title: t("redo_action"),
1112
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
1113
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.IconButton, {
1114
- color: "inherit",
1115
- "aria-label": t("redo_action"),
1116
- onClick: redo,
1117
- disabled: !editor,
1118
- size: "large",
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
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Divider, {
1123
- orientation: "vertical",
1124
- flexItem: true,
1125
- variant: "middle"
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: handleOpenLinkModal,
1337
+ handleAddLink: handleAddLink,
1389
1338
  verificationStatus: verificationStatus
1390
1339
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_SwitchEditorModal.default, {
1391
1340
  t: t,
@@ -25,7 +25,8 @@ function CreateClassroom({
25
25
  isUpgradePossible: true
26
26
  },
27
27
  learnLang,
28
- verificationStatus
28
+ verificationStatus,
29
+ isVideoChatEnabled
29
30
  }) {
30
31
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_MultiStepForm.default, {
31
32
  initialValues: {
@@ -50,7 +51,8 @@ function CreateClassroom({
50
51
  forLanguages: forLanguages,
51
52
  fileSizeLimit: fileSizeLimit,
52
53
  subscription: subscription,
53
- verificationStatus: verificationStatus
54
+ verificationStatus: verificationStatus,
55
+ isVideoChatEnabled: isVideoChatEnabled
54
56
  });
55
57
  }
56
58
  CreateClassroom.propTypes = {};
@@ -25,21 +25,17 @@ function ClassroomSettings({
25
25
  classroomId,
26
26
  isUpdateClassroom = false,
27
27
  scrollToDiscuss = false,
28
- setScrollToDiscuss
28
+ setScrollToDiscuss,
29
+ isVideoChatEnabled
29
30
  }) {
30
31
  const {
31
32
  visibility,
32
33
  enrolmentKey,
33
34
  allowedDomains,
34
35
  collaborators,
35
- vchatEnabledInSettings,
36
- vchatEnabled
36
+ vchatEnabledInSettings
37
37
  } = values;
38
38
  const vchatEnabledInSettingsRef = (0, _react.useRef)(null);
39
- const [isWaysideClassroom, setIsWaysideClassroom] = (0, _react.useState)(false);
40
- if (!isWaysideClassroom && classroomId && classroomId.toLowerCase().includes("wayside")) {
41
- setIsWaysideClassroom(true);
42
- }
43
39
  const generateRandomEnrolmentKey = () => {
44
40
  return String(Math.floor(Math.random() * 90000) + 10000);
45
41
  };
@@ -236,7 +232,7 @@ function ClassroomSettings({
236
232
  fullWidth: true
237
233
  })]
238
234
  })]
239
- }), isWaysideClassroom && vchatEnabled !== false && /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Grid, {
235
+ }), isVideoChatEnabled && /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Grid, {
240
236
  item: true,
241
237
  xs: 12,
242
238
  md: 12,
@@ -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,
@@ -47,7 +47,8 @@ function UpdateClassroom({
47
47
  scrollToDiscuss,
48
48
  setScrollToDiscuss,
49
49
  isClassroomArchived = false,
50
- verificationStatus
50
+ verificationStatus,
51
+ isVideoChatEnabled
51
52
  }) {
52
53
  const {
53
54
  classes
@@ -217,6 +218,7 @@ function UpdateClassroom({
217
218
  values: values,
218
219
  scrollToDiscuss: scrollToDiscuss,
219
220
  setScrollToDiscuss: setScrollToDiscuss,
221
+ isVideoChatEnabled: isVideoChatEnabled,
220
222
  ...otherProps
221
223
  })
222
224
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Divider, {}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.CardActions, {
@@ -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); }
@@ -430,7 +431,9 @@ function Classroom({
430
431
  setSelectedDiscussion,
431
432
  meetingRecsData,
432
433
  hasBadLanguage,
433
- handleArchiveSubmissions
434
+ handleArchiveSubmissions,
435
+ isVideoChatEnabled,
436
+ isVideoChatEnabledInSettings
434
437
  } = vchatProps;
435
438
  const isSmallScreen = (0, _useMediaQuery.default)("(max-width:410px)");
436
439
  const {
@@ -443,10 +446,19 @@ function Classroom({
443
446
  const [isPictureDialogOpen, setIsPictureDialogOpen] = (0, _react.useState)(false);
444
447
  const [overwriteValue, setOverwriteValue] = (0, _react.useState)(null);
445
448
  const [scrollToDiscuss, setScrollToDiscuss] = (0, _react.useState)(false);
446
- const [isWaysideClassroom, setIsWaysideClassroom] = (0, _react.useState)(false);
447
- const [isVideoChatEnabled, setIsVideoChatEnabled] = (0, _react.useState)(false);
448
- const [isVideoChatEnabledInSettings, setIsVideoChatEnabledInSettings] = (0, _react.useState)(false);
449
+ const isWaysideClassroom = classroom?.classroomId?.toLowerCase().includes("wayside");
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, {
@@ -702,8 +721,6 @@ function Classroom({
702
721
  picture,
703
722
  pictureXs,
704
723
  isCreator,
705
- vchatEnabled,
706
- vchatEnabledInSettings,
707
724
  createdBy,
708
725
  userImage,
709
726
  verificationStatus,
@@ -727,6 +744,12 @@ function Classroom({
727
744
  handleSignIn();
728
745
  }
729
746
  };
747
+ const handleOpenUpgradePlans = () => {
748
+ navigate("/settings#Subscription");
749
+ };
750
+ const handleReturnToClassrooms = () => {
751
+ navigate("/classrooms");
752
+ };
730
753
  const removeCourse = async course => {
731
754
  const confirmed = await confirm(t("remove_course"), t("remove_course_confirmation"));
732
755
  if (confirmed) {
@@ -773,15 +796,6 @@ function Classroom({
773
796
  window.location.hash = "#Settings";
774
797
  setScrollToDiscuss(true);
775
798
  };
776
- if (!isWaysideClassroom && classroomId && classroomId.toLowerCase().includes("wayside")) {
777
- setIsWaysideClassroom(true);
778
- }
779
- if (!isVideoChatEnabled && (vchatEnabled === true || localStorage.getItem("vchat-enabled") === "true" || isCreator && vchatEnabled !== false || isMember && vchatEnabled !== false && vchatEnabledInSettings)) {
780
- setIsVideoChatEnabled(true);
781
- }
782
- if (!isVideoChatEnabledInSettings && (isVideoChatEnabled && (vchatEnabledInSettings === true || vchatEnabled === true && isWaysideClassroom && vchatEnabledInSettings !== false) || localStorage.getItem("vchat-enabled") === "true")) {
783
- setIsVideoChatEnabledInSettings(true);
784
- }
785
799
  tabs = [{
786
800
  label: t("courses"),
787
801
  id: "Courses",
@@ -827,11 +841,15 @@ function Classroom({
827
841
  description: t("join_classroom_to_access"),
828
842
  buttonText: t("join"),
829
843
  onClick: handleJoin
844
+ }), isMember && isSubscriptionExpired && /*#__PURE__*/(0, _jsxRuntime.jsx)(_Overlay.default, {
845
+ description: t("classroom_creator_subscription_expired"),
846
+ buttonText: t("return_to_classrooms"),
847
+ onClick: handleReturnToClassrooms
830
848
  })]
831
849
  }, `tab-content-courses`)
832
850
  }, {
833
851
  label: t("progress"),
834
- disabled: !(isMember || isCreator),
852
+ disabled: !(isMember || isCreator) || isMember && isSubscriptionExpired,
835
853
  id: "Progress",
836
854
  TabContent: /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Box, {
837
855
  py: 1,
@@ -854,6 +872,7 @@ function Classroom({
854
872
  }, `tab-content-progress`)
855
873
  }, ...(process.env.REACT_APP_STAGE === "dev" ? [{
856
874
  label: t("assignments"),
875
+ disabled: isMember && isSubscriptionExpired,
857
876
  id: "Assignments",
858
877
  TabContent: /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Box, {
859
878
  py: 1,
@@ -877,7 +896,7 @@ function Classroom({
877
896
  refreshAssignments: refreshAssignments
878
897
  })
879
898
  }, `tab-content-assignments`)
880
- }] : []), ...(isWaysideClassroom && isVideoChatEnabled && isNualangLiveEnabled && (isMember && isVideoChatEnabledInSettings || isCreator) ? [{
899
+ }] : []), ...(isVideoChatEnabled && isNualangLiveEnabled && (isMember && isVideoChatEnabledInSettings || isCreator) ? [{
881
900
  label: t("discuss"),
882
901
  id: "Discuss",
883
902
  disabled: false,
@@ -1054,7 +1073,8 @@ function Classroom({
1054
1073
  setScrollToDiscuss: setScrollToDiscuss,
1055
1074
  isClassroomArchived: isArchived,
1056
1075
  classroomMembers: classroomMembers,
1057
- verificationStatus: verificationStatus
1076
+ verificationStatus: verificationStatus,
1077
+ isVideoChatEnabled: isVideoChatEnabled
1058
1078
  })
1059
1079
  }, `tab-content-settings`)
1060
1080
  }] : [])];
@@ -1326,6 +1346,15 @@ function Classroom({
1326
1346
  t: t,
1327
1347
  open: isCreatorNotSubscribedOpen,
1328
1348
  handleClose: handleCloseCreatorNotSubscribedModal
1349
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_CreatorNotSubscribedUpgrade.default, {
1350
+ t: t,
1351
+ open: isCreatorNotSubscribedUpgradeOpen,
1352
+ handleClose: handleCloseCreatorNotSubscribedUpgradeModal,
1353
+ submitText: t("upgrade"),
1354
+ closeText: t("close"),
1355
+ handleSubmit: handleOpenUpgradePlans,
1356
+ dialogTitle: t("creator_not_subscribed_upgrade_title"),
1357
+ descriptions: ["creator_not_subscribed_upgrade_description", "creator_not_subscribed_upgrade_description2", "creator_not_subscribed_upgrade_description3"]
1329
1358
  })]
1330
1359
  })]
1331
1360
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
@@ -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]",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nualang/nualang-ui-components",
3
- "version": "0.1.1226",
3
+ "version": "0.1.1228",
4
4
  "main": "dist/index.js",
5
5
  "files": [
6
6
  "dist",