catchup-library-web 1.5.1 → 1.5.3

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/index.d.mts CHANGED
@@ -190,7 +190,7 @@ declare const OrderingActivityContent: ({ answer, data, canAnswerQuestion, chang
190
190
 
191
191
  declare const TrueFalseActivityContent: ({ answer, data, canAnswerQuestion, changeAnswer, isPreview, showCorrectAnswer, isFullScreen, }: ITrueFalseActivityProps) => react_jsx_runtime.JSX.Element;
192
192
 
193
- declare const ActivitySolutionContent: ({ activityTemplateType, data, }: IActivitySolutionProps) => react_jsx_runtime.JSX.Element | undefined;
193
+ declare const ActivitySolutionContent: ({ activityTemplateType, data, }: IActivitySolutionProps) => react_jsx_runtime.JSX.Element | null;
194
194
 
195
195
  declare const ActivityPreviewByData: ({ data, showType, showDescription, lockedType, typeOptionList, showSolution, showEvaluationRubric, showTaxonomy, isFullScreen, }: IActivityPreviewByDataProps) => react_jsx_runtime.JSX.Element | undefined;
196
196
 
package/dist/index.d.ts CHANGED
@@ -190,7 +190,7 @@ declare const OrderingActivityContent: ({ answer, data, canAnswerQuestion, chang
190
190
 
191
191
  declare const TrueFalseActivityContent: ({ answer, data, canAnswerQuestion, changeAnswer, isPreview, showCorrectAnswer, isFullScreen, }: ITrueFalseActivityProps) => react_jsx_runtime.JSX.Element;
192
192
 
193
- declare const ActivitySolutionContent: ({ activityTemplateType, data, }: IActivitySolutionProps) => react_jsx_runtime.JSX.Element | undefined;
193
+ declare const ActivitySolutionContent: ({ activityTemplateType, data, }: IActivitySolutionProps) => react_jsx_runtime.JSX.Element | null;
194
194
 
195
195
  declare const ActivityPreviewByData: ({ data, showType, showDescription, lockedType, typeOptionList, showSolution, showEvaluationRubric, showTaxonomy, isFullScreen, }: IActivityPreviewByDataProps) => react_jsx_runtime.JSX.Element | undefined;
196
196
 
package/dist/index.js CHANGED
@@ -6239,60 +6239,52 @@ var ActivitySolutionContent = ({
6239
6239
  activityTemplateType,
6240
6240
  data
6241
6241
  }) => {
6242
- if (!activityTemplateType) return;
6243
- let solutionMapString = "";
6244
- if (activityTemplateType === "ORDERING") {
6245
- if (data["orderingSolutionMap"])
6246
- solutionMapString = data["orderingSolutionMap"];
6247
- } else if (activityTemplateType === "DROPDOWN") {
6248
- if (data["dropdownSolutionMap"])
6249
- solutionMapString = data["dropdownSolutionMap"];
6250
- } else if (activityTemplateType === "MCSA") {
6251
- if (data["MCSASolutionMap"]) solutionMapString = data["MCSASolutionMap"];
6252
- } else if (activityTemplateType === "MCMA") {
6253
- if (data["MCMASolutionMap"]) solutionMapString = data["MCMASolutionMap"];
6254
- } else if (activityTemplateType === "MATCHING") {
6255
- if (data["matchingSolutionMap"])
6256
- solutionMapString = data["matchingSolutionMap"];
6257
- } else if (activityTemplateType === "GROUPING") {
6258
- if (data["groupingSolutionMap"])
6259
- solutionMapString = data["groupingSolutionMap"];
6260
- } else if (activityTemplateType === "FILL_IN_THE_BLANKS") {
6261
- if (data["fillInTheBlanksSolutionMap"])
6262
- solutionMapString = data["fillInTheBlanksSolutionMap"];
6263
- } else if (activityTemplateType === "OPEN_ENDED") {
6264
- if (data["openEndedSolutionMap"])
6265
- solutionMapString = data["openEndedSolutionMap"];
6266
- } else if (activityTemplateType === "TRUE_FALSE") {
6267
- if (data["trueFalseSolutionMap"])
6268
- solutionMapString = data["trueFalseSolutionMap"];
6242
+ if (!activityTemplateType) return null;
6243
+ const solutionMapKeys = {
6244
+ ORDERING: "orderingSolutionMap",
6245
+ DROPDOWN: "dropdownSolutionMap",
6246
+ MCSA: "MCSASolutionMap",
6247
+ MCMA: "MCMASolutionMap",
6248
+ MATCHING: "matchingSolutionMap",
6249
+ GROUPING: "groupingSolutionMap",
6250
+ FILL_IN_THE_BLANKS: "fillInTheBlanksSolutionMap",
6251
+ OPEN_ENDED: "openEndedSolutionMap",
6252
+ TRUE_FALSE: "trueFalseSolutionMap"
6253
+ };
6254
+ const solutionMapKey = solutionMapKeys[activityTemplateType];
6255
+ if (!solutionMapKey) return null;
6256
+ const solutionMapString = data[solutionMapKey];
6257
+ if (!solutionMapString || !solutionMapString.includes("[ONAYLI CEVAP]"))
6258
+ return null;
6259
+ let solutionMap;
6260
+ try {
6261
+ solutionMap = JSON.parse(solutionMapString);
6262
+ } catch (error) {
6263
+ console.error("Error parsing solution map:", error);
6264
+ return null;
6269
6265
  }
6270
- if (!solutionMapString.includes("[ONAYLI CEVAP]")) return;
6271
- const solutionMap = JSON.parse(solutionMapString);
6272
- if (!solutionMap) return;
6273
- if (Object.keys(solutionMap).length === 0) return;
6266
+ if (!solutionMap || Object.keys(solutionMap).length === 0) return null;
6274
6267
  return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("div", { className: "mx-2", children: /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("div", { className: "p-4 border-catchup-blue border-2 rounded-catchup-xlarge", children: [
6275
6268
  /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("p", { className: "text-xl font-bold text-center mb-3", children: i18n_default.t("solution") }),
6276
- Object.keys(solutionMap).map((key, index) => {
6277
- const currentItem = JSON.parse(solutionMap[key]);
6269
+ Object.keys(solutionMap).map((key) => {
6270
+ let currentItem;
6271
+ try {
6272
+ currentItem = JSON.parse(solutionMap[key]);
6273
+ } catch (error) {
6274
+ console.error(`Error parsing solution item at key ${key}:`, error);
6275
+ return null;
6276
+ }
6278
6277
  const { value } = currentItem;
6279
- return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("p", { className: "my-3", children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
6280
- "span",
6281
- {
6282
- className: "text-xl whitespace-pre-wrap",
6283
- children: constructInputWithSpecialExpressionList(value).map(
6284
- (inputPart, index2) => /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
6285
- "span",
6286
- {
6287
- className: `${inputPart.isBold ? "font-bold" : ""} ${inputPart.isUnderline ? "underline" : ""}`,
6288
- children: inputPart.isEquation ? /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("span", { className: "text-2xl", children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_react_katex10.InlineMath, { math: inputPart.value }) }) : inputPart.value
6289
- },
6290
- index2
6291
- )
6292
- )
6293
- },
6294
- `${key}_${index}`
6295
- ) });
6278
+ return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("div", { className: "my-3", children: constructInputWithSpecialExpressionList(value).map(
6279
+ (inputPart, partIndex) => /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
6280
+ "span",
6281
+ {
6282
+ className: `${inputPart.isBold ? "font-bold" : ""} ${inputPart.isUnderline ? "underline" : ""}`,
6283
+ children: inputPart.isEquation ? /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("span", { className: "text-2xl", children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_react_katex10.InlineMath, { math: inputPart.value }) }) : inputPart.value
6284
+ },
6285
+ `${key}_part_${partIndex}`
6286
+ )
6287
+ ) }, key);
6296
6288
  })
6297
6289
  ] }) });
6298
6290
  };
@@ -7366,7 +7358,7 @@ var filterUserRoleOptionList = (accountType, userProfileRole) => {
7366
7358
  } else {
7367
7359
  if (userProfileRole === "STAFF") {
7368
7360
  return retrieveUserRoleOptionList().filter(
7369
- (userRoleOption) => userRoleOption.value === "STAFF" || userRoleOption.value === "LEARNER"
7361
+ (userRoleOption) => userRoleOption.value === "STAFF" || userRoleOption.value === "LEARNER" || userRoleOption.value === "CONTENT_CREATOR"
7370
7362
  );
7371
7363
  } else if (userProfileRole === "INDIVIDUAL") {
7372
7364
  return retrieveUserRoleOptionList().filter(
package/dist/index.mjs CHANGED
@@ -6047,60 +6047,52 @@ var ActivitySolutionContent = ({
6047
6047
  activityTemplateType,
6048
6048
  data
6049
6049
  }) => {
6050
- if (!activityTemplateType) return;
6051
- let solutionMapString = "";
6052
- if (activityTemplateType === "ORDERING") {
6053
- if (data["orderingSolutionMap"])
6054
- solutionMapString = data["orderingSolutionMap"];
6055
- } else if (activityTemplateType === "DROPDOWN") {
6056
- if (data["dropdownSolutionMap"])
6057
- solutionMapString = data["dropdownSolutionMap"];
6058
- } else if (activityTemplateType === "MCSA") {
6059
- if (data["MCSASolutionMap"]) solutionMapString = data["MCSASolutionMap"];
6060
- } else if (activityTemplateType === "MCMA") {
6061
- if (data["MCMASolutionMap"]) solutionMapString = data["MCMASolutionMap"];
6062
- } else if (activityTemplateType === "MATCHING") {
6063
- if (data["matchingSolutionMap"])
6064
- solutionMapString = data["matchingSolutionMap"];
6065
- } else if (activityTemplateType === "GROUPING") {
6066
- if (data["groupingSolutionMap"])
6067
- solutionMapString = data["groupingSolutionMap"];
6068
- } else if (activityTemplateType === "FILL_IN_THE_BLANKS") {
6069
- if (data["fillInTheBlanksSolutionMap"])
6070
- solutionMapString = data["fillInTheBlanksSolutionMap"];
6071
- } else if (activityTemplateType === "OPEN_ENDED") {
6072
- if (data["openEndedSolutionMap"])
6073
- solutionMapString = data["openEndedSolutionMap"];
6074
- } else if (activityTemplateType === "TRUE_FALSE") {
6075
- if (data["trueFalseSolutionMap"])
6076
- solutionMapString = data["trueFalseSolutionMap"];
6050
+ if (!activityTemplateType) return null;
6051
+ const solutionMapKeys = {
6052
+ ORDERING: "orderingSolutionMap",
6053
+ DROPDOWN: "dropdownSolutionMap",
6054
+ MCSA: "MCSASolutionMap",
6055
+ MCMA: "MCMASolutionMap",
6056
+ MATCHING: "matchingSolutionMap",
6057
+ GROUPING: "groupingSolutionMap",
6058
+ FILL_IN_THE_BLANKS: "fillInTheBlanksSolutionMap",
6059
+ OPEN_ENDED: "openEndedSolutionMap",
6060
+ TRUE_FALSE: "trueFalseSolutionMap"
6061
+ };
6062
+ const solutionMapKey = solutionMapKeys[activityTemplateType];
6063
+ if (!solutionMapKey) return null;
6064
+ const solutionMapString = data[solutionMapKey];
6065
+ if (!solutionMapString || !solutionMapString.includes("[ONAYLI CEVAP]"))
6066
+ return null;
6067
+ let solutionMap;
6068
+ try {
6069
+ solutionMap = JSON.parse(solutionMapString);
6070
+ } catch (error) {
6071
+ console.error("Error parsing solution map:", error);
6072
+ return null;
6077
6073
  }
6078
- if (!solutionMapString.includes("[ONAYLI CEVAP]")) return;
6079
- const solutionMap = JSON.parse(solutionMapString);
6080
- if (!solutionMap) return;
6081
- if (Object.keys(solutionMap).length === 0) return;
6074
+ if (!solutionMap || Object.keys(solutionMap).length === 0) return null;
6082
6075
  return /* @__PURE__ */ jsx40("div", { className: "mx-2", children: /* @__PURE__ */ jsxs30("div", { className: "p-4 border-catchup-blue border-2 rounded-catchup-xlarge", children: [
6083
6076
  /* @__PURE__ */ jsx40("p", { className: "text-xl font-bold text-center mb-3", children: i18n_default.t("solution") }),
6084
- Object.keys(solutionMap).map((key, index) => {
6085
- const currentItem = JSON.parse(solutionMap[key]);
6077
+ Object.keys(solutionMap).map((key) => {
6078
+ let currentItem;
6079
+ try {
6080
+ currentItem = JSON.parse(solutionMap[key]);
6081
+ } catch (error) {
6082
+ console.error(`Error parsing solution item at key ${key}:`, error);
6083
+ return null;
6084
+ }
6086
6085
  const { value } = currentItem;
6087
- return /* @__PURE__ */ jsx40("p", { className: "my-3", children: /* @__PURE__ */ jsx40(
6088
- "span",
6089
- {
6090
- className: "text-xl whitespace-pre-wrap",
6091
- children: constructInputWithSpecialExpressionList(value).map(
6092
- (inputPart, index2) => /* @__PURE__ */ jsx40(
6093
- "span",
6094
- {
6095
- className: `${inputPart.isBold ? "font-bold" : ""} ${inputPart.isUnderline ? "underline" : ""}`,
6096
- children: inputPart.isEquation ? /* @__PURE__ */ jsx40("span", { className: "text-2xl", children: /* @__PURE__ */ jsx40(InlineMath10, { math: inputPart.value }) }) : inputPart.value
6097
- },
6098
- index2
6099
- )
6100
- )
6101
- },
6102
- `${key}_${index}`
6103
- ) });
6086
+ return /* @__PURE__ */ jsx40("div", { className: "my-3", children: constructInputWithSpecialExpressionList(value).map(
6087
+ (inputPart, partIndex) => /* @__PURE__ */ jsx40(
6088
+ "span",
6089
+ {
6090
+ className: `${inputPart.isBold ? "font-bold" : ""} ${inputPart.isUnderline ? "underline" : ""}`,
6091
+ children: inputPart.isEquation ? /* @__PURE__ */ jsx40("span", { className: "text-2xl", children: /* @__PURE__ */ jsx40(InlineMath10, { math: inputPart.value }) }) : inputPart.value
6092
+ },
6093
+ `${key}_part_${partIndex}`
6094
+ )
6095
+ ) }, key);
6104
6096
  })
6105
6097
  ] }) });
6106
6098
  };
@@ -7174,7 +7166,7 @@ var filterUserRoleOptionList = (accountType, userProfileRole) => {
7174
7166
  } else {
7175
7167
  if (userProfileRole === "STAFF") {
7176
7168
  return retrieveUserRoleOptionList().filter(
7177
- (userRoleOption) => userRoleOption.value === "STAFF" || userRoleOption.value === "LEARNER"
7169
+ (userRoleOption) => userRoleOption.value === "STAFF" || userRoleOption.value === "LEARNER" || userRoleOption.value === "CONTENT_CREATOR"
7178
7170
  );
7179
7171
  } else if (userProfileRole === "INDIVIDUAL") {
7180
7172
  return retrieveUserRoleOptionList().filter(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "catchup-library-web",
3
- "version": "1.5.1",
3
+ "version": "1.5.3",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
@@ -7,75 +7,78 @@ const ActivitySolutionContent = ({
7
7
  activityTemplateType,
8
8
  data,
9
9
  }: IActivitySolutionProps) => {
10
- if (!activityTemplateType) return;
10
+ if (!activityTemplateType) return null;
11
11
 
12
- let solutionMapString = "";
13
- if (activityTemplateType === "ORDERING") {
14
- if (data["orderingSolutionMap"])
15
- solutionMapString = data["orderingSolutionMap"];
16
- } else if (activityTemplateType === "DROPDOWN") {
17
- if (data["dropdownSolutionMap"])
18
- solutionMapString = data["dropdownSolutionMap"];
19
- } else if (activityTemplateType === "MCSA") {
20
- if (data["MCSASolutionMap"]) solutionMapString = data["MCSASolutionMap"];
21
- } else if (activityTemplateType === "MCMA") {
22
- if (data["MCMASolutionMap"]) solutionMapString = data["MCMASolutionMap"];
23
- } else if (activityTemplateType === "MATCHING") {
24
- if (data["matchingSolutionMap"])
25
- solutionMapString = data["matchingSolutionMap"];
26
- } else if (activityTemplateType === "GROUPING") {
27
- if (data["groupingSolutionMap"])
28
- solutionMapString = data["groupingSolutionMap"];
29
- } else if (activityTemplateType === "FILL_IN_THE_BLANKS") {
30
- if (data["fillInTheBlanksSolutionMap"])
31
- solutionMapString = data["fillInTheBlanksSolutionMap"];
32
- } else if (activityTemplateType === "OPEN_ENDED") {
33
- if (data["openEndedSolutionMap"])
34
- solutionMapString = data["openEndedSolutionMap"];
35
- } else if (activityTemplateType === "TRUE_FALSE") {
36
- if (data["trueFalseSolutionMap"])
37
- solutionMapString = data["trueFalseSolutionMap"];
12
+ // Map activity types to their corresponding solution map keys
13
+ const solutionMapKeys: any = {
14
+ ORDERING: "orderingSolutionMap",
15
+ DROPDOWN: "dropdownSolutionMap",
16
+ MCSA: "MCSASolutionMap",
17
+ MCMA: "MCMASolutionMap",
18
+ MATCHING: "matchingSolutionMap",
19
+ GROUPING: "groupingSolutionMap",
20
+ FILL_IN_THE_BLANKS: "fillInTheBlanksSolutionMap",
21
+ OPEN_ENDED: "openEndedSolutionMap",
22
+ TRUE_FALSE: "trueFalseSolutionMap",
23
+ };
24
+
25
+ const solutionMapKey = solutionMapKeys[activityTemplateType];
26
+
27
+ if (!solutionMapKey) return null;
28
+
29
+ const solutionMapString = data[solutionMapKey];
30
+
31
+ if (!solutionMapString || !solutionMapString.includes("[ONAYLI CEVAP]"))
32
+ return null;
33
+
34
+ let solutionMap;
35
+ try {
36
+ solutionMap = JSON.parse(solutionMapString);
37
+ } catch (error) {
38
+ console.error("Error parsing solution map:", error);
39
+ return null;
38
40
  }
39
- if (!solutionMapString.includes("[ONAYLI CEVAP]")) return;
40
- const solutionMap = JSON.parse(solutionMapString);
41
- if (!solutionMap) return;
42
41
 
43
- if (Object.keys(solutionMap).length === 0) return;
42
+ if (!solutionMap || Object.keys(solutionMap).length === 0) return null;
43
+
44
44
  return (
45
45
  <div className="mx-2">
46
46
  <div className="p-4 border-catchup-blue border-2 rounded-catchup-xlarge">
47
47
  <p className="text-xl font-bold text-center mb-3">
48
48
  {i18n.t("solution")}
49
49
  </p>
50
- {Object.keys(solutionMap).map((key, index) => {
51
- const currentItem = JSON.parse(solutionMap[key]);
50
+ {Object.keys(solutionMap).map((key) => {
51
+ let currentItem;
52
+ try {
53
+ currentItem = JSON.parse(solutionMap[key]);
54
+ } catch (error) {
55
+ console.error(`Error parsing solution item at key ${key}:`, error);
56
+ return null;
57
+ }
58
+
52
59
  const { value } = currentItem;
60
+
53
61
  return (
54
- <p className="my-3">
55
- <span
56
- key={`${key}_${index}`}
57
- className="text-xl whitespace-pre-wrap"
58
- >
59
- {constructInputWithSpecialExpressionList(value).map(
60
- (inputPart, index) => (
61
- <span
62
- key={index}
63
- className={`${inputPart.isBold ? "font-bold" : ""} ${
64
- inputPart.isUnderline ? "underline" : ""
65
- }`}
66
- >
67
- {inputPart.isEquation ? (
68
- <span className="text-2xl">
69
- <InlineMath math={inputPart.value} />
70
- </span>
71
- ) : (
72
- inputPart.value
73
- )}
74
- </span>
75
- )
76
- )}
77
- </span>
78
- </p>
62
+ <div key={key} className="my-3">
63
+ {constructInputWithSpecialExpressionList(value).map(
64
+ (inputPart, partIndex) => (
65
+ <span
66
+ key={`${key}_part_${partIndex}`}
67
+ className={`${inputPart.isBold ? "font-bold" : ""} ${
68
+ inputPart.isUnderline ? "underline" : ""
69
+ }`}
70
+ >
71
+ {inputPart.isEquation ? (
72
+ <span className="text-2xl">
73
+ <InlineMath math={inputPart.value} />
74
+ </span>
75
+ ) : (
76
+ inputPart.value
77
+ )}
78
+ </span>
79
+ )
80
+ )}
81
+ </div>
79
82
  );
80
83
  })}
81
84
  </div>
@@ -541,7 +541,9 @@ export const filterUserRoleOptionList = (
541
541
  if (userProfileRole === "STAFF") {
542
542
  return retrieveUserRoleOptionList().filter(
543
543
  (userRoleOption) =>
544
- userRoleOption.value === "STAFF" || userRoleOption.value === "LEARNER"
544
+ userRoleOption.value === "STAFF" ||
545
+ userRoleOption.value === "LEARNER" ||
546
+ userRoleOption.value === "CONTENT_CREATOR"
545
547
  );
546
548
  } else if (userProfileRole === "INDIVIDUAL") {
547
549
  return retrieveUserRoleOptionList().filter(