catchup-library-web 2.7.11 → 2.7.13

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
@@ -255,9 +255,13 @@ declare const OrderingActivityContent: ({ answerMap, data, canAnswerQuestion, ch
255
255
 
256
256
  declare const TrueFalseActivityContent: ({ answerMap, data, canAnswerQuestion, changeAnswer, isPreview, showCorrectAnswer, isFullScreen, }: ITrueFalseActivityProps) => react_jsx_runtime.JSX.Element;
257
257
 
258
- declare const ActivitySolutionContent: ({ activityTemplateType, data, }: IActivitySolutionProps) => react_jsx_runtime.JSX.Element | null;
258
+ declare const ActivitySolutionContent: ({ activityTemplateType, data, hideTitleAndBorder, }: IActivitySolutionProps & {
259
+ hideTitleAndBorder?: boolean;
260
+ }) => react_jsx_runtime.JSX.Element | null;
259
261
 
260
- declare const ActivityEvaluationRubricContent: ({ activityTemplateType, data, }: IActivityEvaluationRubricProps) => react_jsx_runtime.JSX.Element | null | undefined;
262
+ declare const ActivityEvaluationRubricContent: ({ activityTemplateType, data, hideTitleAndBorder, }: IActivityEvaluationRubricProps & {
263
+ hideTitleAndBorder?: boolean;
264
+ }) => react_jsx_runtime.JSX.Element | null | undefined;
261
265
 
262
266
  declare const ActivityPreviewByData: ({ data, changeAnswer, answerType, showType, showDescription, typeList, showSolution, showEvaluationRubric, showDifficulty, isFullScreen, showCorrectAnswer, showMaterialContent, isPreview, }: IActivityPreviewByDataProps) => react_jsx_runtime.JSX.Element | null;
263
267
 
@@ -872,7 +876,16 @@ declare const filterCoterieTypeByDistinctOptionList: (distinctCoterieTypeOptionL
872
876
  value: string;
873
877
  includes: string[];
874
878
  }[];
875
- declare const findAISettingsFromCurrentProfile: (userProfileBrand: any, userProfileCampus: any, userProfileInstitution: any) => any;
879
+ declare const findAISettingsFromCurrentProfile: (userProfileBrand: any, userProfileCampus: any, userProfileInstitution: any) => {
880
+ canImportActivity: any;
881
+ canGenerateActivity: any;
882
+ canEvaluateOpenEnded: any;
883
+ canSolveActivityTemplate: any;
884
+ canGenerateRubric: any;
885
+ canGenerateLessonPlan: any;
886
+ canGenerateImage: any;
887
+ canGeneratePodcast: any;
888
+ };
876
889
  declare const formatPriceWithCommas: (number: number, language: string) => string;
877
890
  declare const retrieveInstitutionTypeByLevel: (level: number) => "EAST_PRIMARY" | "EAST_SECONDARY" | "HIGH_SCHOOL" | undefined;
878
891
 
package/dist/index.d.ts CHANGED
@@ -255,9 +255,13 @@ declare const OrderingActivityContent: ({ answerMap, data, canAnswerQuestion, ch
255
255
 
256
256
  declare const TrueFalseActivityContent: ({ answerMap, data, canAnswerQuestion, changeAnswer, isPreview, showCorrectAnswer, isFullScreen, }: ITrueFalseActivityProps) => react_jsx_runtime.JSX.Element;
257
257
 
258
- declare const ActivitySolutionContent: ({ activityTemplateType, data, }: IActivitySolutionProps) => react_jsx_runtime.JSX.Element | null;
258
+ declare const ActivitySolutionContent: ({ activityTemplateType, data, hideTitleAndBorder, }: IActivitySolutionProps & {
259
+ hideTitleAndBorder?: boolean;
260
+ }) => react_jsx_runtime.JSX.Element | null;
259
261
 
260
- declare const ActivityEvaluationRubricContent: ({ activityTemplateType, data, }: IActivityEvaluationRubricProps) => react_jsx_runtime.JSX.Element | null | undefined;
262
+ declare const ActivityEvaluationRubricContent: ({ activityTemplateType, data, hideTitleAndBorder, }: IActivityEvaluationRubricProps & {
263
+ hideTitleAndBorder?: boolean;
264
+ }) => react_jsx_runtime.JSX.Element | null | undefined;
261
265
 
262
266
  declare const ActivityPreviewByData: ({ data, changeAnswer, answerType, showType, showDescription, typeList, showSolution, showEvaluationRubric, showDifficulty, isFullScreen, showCorrectAnswer, showMaterialContent, isPreview, }: IActivityPreviewByDataProps) => react_jsx_runtime.JSX.Element | null;
263
267
 
@@ -872,7 +876,16 @@ declare const filterCoterieTypeByDistinctOptionList: (distinctCoterieTypeOptionL
872
876
  value: string;
873
877
  includes: string[];
874
878
  }[];
875
- declare const findAISettingsFromCurrentProfile: (userProfileBrand: any, userProfileCampus: any, userProfileInstitution: any) => any;
879
+ declare const findAISettingsFromCurrentProfile: (userProfileBrand: any, userProfileCampus: any, userProfileInstitution: any) => {
880
+ canImportActivity: any;
881
+ canGenerateActivity: any;
882
+ canEvaluateOpenEnded: any;
883
+ canSolveActivityTemplate: any;
884
+ canGenerateRubric: any;
885
+ canGenerateLessonPlan: any;
886
+ canGenerateImage: any;
887
+ canGeneratePodcast: any;
888
+ };
876
889
  declare const formatPriceWithCommas: (number: number, language: string) => string;
877
890
  declare const retrieveInstitutionTypeByLevel: (level: number) => "EAST_PRIMARY" | "EAST_SECONDARY" | "HIGH_SCHOOL" | undefined;
878
891
 
package/dist/index.js CHANGED
@@ -4891,7 +4891,8 @@ var DropdownActivityMaterialContent = ({
4891
4891
  /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "flex-1 min-h-0 overflow-y-auto", children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "w-full flex flex-row flex-wrap", children: Object.keys(displayAnswerMap).map(
4892
4892
  (materialKey, index) => {
4893
4893
  const answerKey = Object.keys(materialMap[materialKey])[0];
4894
- const learnerAnswerState = !isPreview ? null : !showCorrectAnswer ? null : checkAnswerState(answerKey, displayAnswerMap[materialKey]);
4894
+ const currentAnswer = displayAnswerMap[materialKey];
4895
+ const learnerAnswerState = !isPreview ? null : !currentAnswer || currentAnswer === "DEFAULT_OPTION" ? null : checkAnswerState(answerKey, currentAnswer);
4895
4896
  return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "w-full md:w-1/2", children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "mx-2", children: /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "w-full flex flex-row my-2 gap-x-2", children: [
4896
4897
  /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "my-auto", children: /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("p", { className: "text-xl", children: [
4897
4898
  parseFloat(materialKey) + 1,
@@ -5305,9 +5306,10 @@ var FillInTheBlanksActivityMaterialContent = ({
5305
5306
  )
5306
5307
  ) }),
5307
5308
  /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: "w-full flex flex-row flex-wrap", children: Object.keys(displayAnswerMap).map((materialKey, index) => {
5308
- const learnerAnswerState = !isPreview ? null : !showCorrectAnswer ? null : checkAnswerState(
5309
+ const currentAnswer = displayAnswerMap[materialKey];
5310
+ const learnerAnswerState = !isPreview ? null : !currentAnswer || currentAnswer === "" || currentAnswer === "DEFAULT_OPTION" ? null : checkAnswerState(
5309
5311
  JSON.parse(materialMap[materialKey]),
5310
- displayAnswerMap[materialKey]
5312
+ currentAnswer
5311
5313
  );
5312
5314
  return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: "w-full md:w-1/2", children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: "mx-2", children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
5313
5315
  "div",
@@ -7101,7 +7103,7 @@ var OrderingActivityMaterialContent = ({
7101
7103
  }
7102
7104
  ),
7103
7105
  /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("div", { className: "flex-1 min-h-0 overflow-y-auto", children: Object.keys(displayAnswerMap).map((materialKey, index) => {
7104
- const learnerAnswerState = !isPreview ? null : !showCorrectAnswer ? null : checkAnswerState(displayAnswerMap[materialKey] + "", index + "");
7106
+ const learnerAnswerState = !isPreview ? null : checkAnswerState(displayAnswerMap[materialKey] + "", index + "");
7105
7107
  return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("div", { className: "w-full", children: /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(
7106
7108
  "div",
7107
7109
  {
@@ -7277,7 +7279,8 @@ var TrueFalseActivityMaterialContent = ({
7277
7279
  const learnerAnswer = displayAnswerMap.trueList.find(
7278
7280
  (trueItem) => trueItem === shuffleOption
7279
7281
  ) !== void 0 ? "TRUE" : "FALSE";
7280
- const learnerAnswerState = !isPreview ? null : !showCorrectAnswer ? null : checkAnswerState(correctAnswer, learnerAnswer);
7282
+ const hasAnswered = displayAnswerMap.trueList.includes(shuffleOption) || displayAnswerMap.falseList.includes(shuffleOption);
7283
+ const learnerAnswerState = !isPreview ? null : !hasAnswered ? null : checkAnswerState(correctAnswer, learnerAnswer);
7281
7284
  return /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(
7282
7285
  "div",
7283
7286
  {
@@ -7420,7 +7423,8 @@ var import_react_katex11 = require("react-katex");
7420
7423
  var import_jsx_runtime46 = require("react/jsx-runtime");
7421
7424
  var ActivitySolutionContent = ({
7422
7425
  activityTemplateType,
7423
- data
7426
+ data,
7427
+ hideTitleAndBorder = false
7424
7428
  }) => {
7425
7429
  if (!activityTemplateType) return null;
7426
7430
  const solutionMapKeys = {
@@ -7449,28 +7453,32 @@ var ActivitySolutionContent = ({
7449
7453
  return null;
7450
7454
  }
7451
7455
  if (!solutionMap || Object.keys(solutionMap).length === 0) return null;
7456
+ const renderContent = () => /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(import_jsx_runtime46.Fragment, { children: Object.keys(solutionMap).map((key) => {
7457
+ let currentItem;
7458
+ try {
7459
+ currentItem = JSON.parse(solutionMap[key]);
7460
+ } catch (error) {
7461
+ console.error(`Error parsing solution item at key ${key}:`, error);
7462
+ return null;
7463
+ }
7464
+ const { value } = currentItem;
7465
+ return /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("div", { className: "my-3 text-xl", children: constructInputWithSpecialExpressionList(value).map(
7466
+ (inputPart, partIndex) => /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
7467
+ "span",
7468
+ {
7469
+ className: `${inputPart.isBold ? "font-bold" : ""} ${inputPart.isUnderline ? "underline" : ""}`,
7470
+ children: inputPart.isEquation ? /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("span", { className: "text-xl", children: /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(import_react_katex11.InlineMath, { math: inputPart.value }) }) : inputPart.value
7471
+ },
7472
+ `${key}_part_${partIndex}`
7473
+ )
7474
+ ) }, key);
7475
+ }) });
7476
+ if (hideTitleAndBorder) {
7477
+ return renderContent();
7478
+ }
7452
7479
  return /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("div", { className: "mx-2", children: /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("div", { className: "p-4 border-catchup-blue border-2 rounded-catchup-xlarge", children: [
7453
7480
  /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("p", { className: "text-xl font-bold text-center mb-3", children: i18n_default.t("solution") }),
7454
- Object.keys(solutionMap).map((key) => {
7455
- let currentItem;
7456
- try {
7457
- currentItem = JSON.parse(solutionMap[key]);
7458
- } catch (error) {
7459
- console.error(`Error parsing solution item at key ${key}:`, error);
7460
- return null;
7461
- }
7462
- const { value } = currentItem;
7463
- return /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("div", { className: "my-3 text-xl", children: constructInputWithSpecialExpressionList(value).map(
7464
- (inputPart, partIndex) => /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
7465
- "span",
7466
- {
7467
- className: `${inputPart.isBold ? "font-bold" : ""} ${inputPart.isUnderline ? "underline" : ""}`,
7468
- children: inputPart.isEquation ? /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("span", { className: "text-xl", children: /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(import_react_katex11.InlineMath, { math: inputPart.value }) }) : inputPart.value
7469
- },
7470
- `${key}_part_${partIndex}`
7471
- )
7472
- ) }, key);
7473
- })
7481
+ renderContent()
7474
7482
  ] }) });
7475
7483
  };
7476
7484
  var ActivitySolutionContent_default = ActivitySolutionContent;
@@ -7480,7 +7488,8 @@ var import_react_katex12 = require("react-katex");
7480
7488
  var import_jsx_runtime47 = require("react/jsx-runtime");
7481
7489
  var ActivityEvaluationRubricContent = ({
7482
7490
  activityTemplateType,
7483
- data
7491
+ data,
7492
+ hideTitleAndBorder = false
7484
7493
  }) => {
7485
7494
  if (!activityTemplateType) return;
7486
7495
  const evaluationRubricMapKeys = {
@@ -7507,36 +7516,40 @@ var ActivityEvaluationRubricContent = ({
7507
7516
  }
7508
7517
  if (!evaluationRubricMap || Object.keys(evaluationRubricMap).length === 0)
7509
7518
  return null;
7519
+ const renderContent = () => /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_jsx_runtime47.Fragment, { children: Object.keys(evaluationRubricMap).map((key, index) => {
7520
+ const currentItem = JSON.parse(evaluationRubricMap[key]);
7521
+ const { value } = currentItem;
7522
+ const matchedRegex = value.match(/\[(\d+)\]\s*([\s\S]*)/);
7523
+ let points = 0;
7524
+ let evaluationRubric = value;
7525
+ if (matchedRegex) {
7526
+ points = parseFloat(matchedRegex[1]);
7527
+ evaluationRubric = matchedRegex[2];
7528
+ }
7529
+ return /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("div", { className: "my-2 flex flex-row gap-x-3", children: [
7530
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("div", { className: "font-bold text-xl whitespace-nowrap", children: [
7531
+ points,
7532
+ " ",
7533
+ i18n_default.t("points")
7534
+ ] }),
7535
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("p", { className: "flex-1 text-xl whitespace-pre-wrap", children: constructInputWithSpecialExpressionList(evaluationRubric).map(
7536
+ (inputPart, inputIndex) => /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
7537
+ "span",
7538
+ {
7539
+ className: `${inputPart.isBold ? "font-bold" : ""} ${inputPart.isUnderline ? "underline" : ""}`,
7540
+ children: inputPart.isEquation ? /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("span", { className: "text-xl", children: /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_react_katex12.InlineMath, { math: inputPart.value }) }) : inputPart.value
7541
+ },
7542
+ inputIndex
7543
+ )
7544
+ ) })
7545
+ ] }, `${key}_${index}`);
7546
+ }) });
7547
+ if (hideTitleAndBorder) {
7548
+ return renderContent();
7549
+ }
7510
7550
  return /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("div", { className: "p-4 border-catchup-gray-400 border-2 rounded-catchup-xlarge", children: [
7511
7551
  /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("p", { className: "text-xl font-bold text-center mb-3", children: i18n_default.t("evaluation_rubric") }),
7512
- Object.keys(evaluationRubricMap).map((key, index) => {
7513
- const currentItem = JSON.parse(evaluationRubricMap[key]);
7514
- const { value } = currentItem;
7515
- const matchedRegex = value.match(/\[(\d+)\]\s*([\s\S]*)/);
7516
- let points = 0;
7517
- let evaluationRubric = value;
7518
- if (matchedRegex) {
7519
- points = parseFloat(matchedRegex[1]);
7520
- evaluationRubric = matchedRegex[2];
7521
- }
7522
- return /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("div", { className: "my-2 flex flex-row gap-x-3", children: [
7523
- /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("div", { className: "font-bold text-xl whitespace-nowrap", children: [
7524
- points,
7525
- " ",
7526
- i18n_default.t("points")
7527
- ] }),
7528
- /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("p", { className: "flex-1 text-xl whitespace-pre-wrap", children: constructInputWithSpecialExpressionList(evaluationRubric).map(
7529
- (inputPart, inputIndex) => /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
7530
- "span",
7531
- {
7532
- className: `${inputPart.isBold ? "font-bold" : ""} ${inputPart.isUnderline ? "underline" : ""}`,
7533
- children: inputPart.isEquation ? /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("span", { className: "text-xl", children: /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_react_katex12.InlineMath, { math: inputPart.value }) }) : inputPart.value
7534
- },
7535
- inputIndex
7536
- )
7537
- ) })
7538
- ] }, `${key}_${index}`);
7539
- })
7552
+ renderContent()
7540
7553
  ] });
7541
7554
  };
7542
7555
  var ActivityEvaluationRubricContent_default = ActivityEvaluationRubricContent;
@@ -9414,23 +9427,24 @@ var filterCoterieTypeByDistinctOptionList = (distinctCoterieTypeOptionList) => {
9414
9427
  );
9415
9428
  };
9416
9429
  var findAISettingsFromCurrentProfile = (userProfileBrand, userProfileCampus, userProfileInstitution) => {
9417
- if (userProfileInstitution) {
9418
- const { institutionSettingsDTO } = userProfileInstitution;
9419
- const { institutionAISettingsDTO } = institutionSettingsDTO;
9420
- return institutionAISettingsDTO;
9421
- } else {
9422
- if (userProfileCampus) {
9423
- const { campusSettingsDTO } = userProfileCampus;
9424
- const { campusAISettingsDTO } = campusSettingsDTO;
9425
- return campusAISettingsDTO;
9426
- } else {
9427
- if (userProfileBrand) {
9428
- const { brandSettingsDTO } = userProfileBrand;
9429
- const { brandAISettingsDTO } = brandSettingsDTO;
9430
- return brandAISettingsDTO;
9431
- }
9432
- }
9433
- }
9430
+ var _a, _b, _c;
9431
+ const brandSettings = (_a = userProfileBrand == null ? void 0 : userProfileBrand.brandSettingsDTO) == null ? void 0 : _a.brandAISettingsDTO;
9432
+ const campusSettings = (_b = userProfileCampus == null ? void 0 : userProfileCampus.campusSettingsDTO) == null ? void 0 : _b.campusAISettingsDTO;
9433
+ const instSettings = (_c = userProfileInstitution == null ? void 0 : userProfileInstitution.institutionSettingsDTO) == null ? void 0 : _c.institutionAISettingsDTO;
9434
+ const resolve = (field) => {
9435
+ var _a2, _b2, _c2;
9436
+ return (_c2 = (_b2 = (_a2 = instSettings == null ? void 0 : instSettings[field]) != null ? _a2 : campusSettings == null ? void 0 : campusSettings[field]) != null ? _b2 : brandSettings == null ? void 0 : brandSettings[field]) != null ? _c2 : false;
9437
+ };
9438
+ return {
9439
+ canImportActivity: resolve("canImportActivity"),
9440
+ canGenerateActivity: resolve("canGenerateActivity"),
9441
+ canEvaluateOpenEnded: resolve("canEvaluateOpenEnded"),
9442
+ canSolveActivityTemplate: resolve("canSolveActivityTemplate"),
9443
+ canGenerateRubric: resolve("canGenerateRubric"),
9444
+ canGenerateLessonPlan: resolve("canGenerateLessonPlan"),
9445
+ canGenerateImage: resolve("canGenerateImage"),
9446
+ canGeneratePodcast: resolve("canGeneratePodcast")
9447
+ };
9434
9448
  };
9435
9449
  var formatPriceWithCommas = (number, language) => {
9436
9450
  return number.toLocaleString(language, {
package/dist/index.mjs CHANGED
@@ -4651,7 +4651,8 @@ var DropdownActivityMaterialContent = ({
4651
4651
  /* @__PURE__ */ jsx28("div", { className: "flex-1 min-h-0 overflow-y-auto", children: /* @__PURE__ */ jsx28("div", { className: "w-full flex flex-row flex-wrap", children: Object.keys(displayAnswerMap).map(
4652
4652
  (materialKey, index) => {
4653
4653
  const answerKey = Object.keys(materialMap[materialKey])[0];
4654
- const learnerAnswerState = !isPreview ? null : !showCorrectAnswer ? null : checkAnswerState(answerKey, displayAnswerMap[materialKey]);
4654
+ const currentAnswer = displayAnswerMap[materialKey];
4655
+ const learnerAnswerState = !isPreview ? null : !currentAnswer || currentAnswer === "DEFAULT_OPTION" ? null : checkAnswerState(answerKey, currentAnswer);
4655
4656
  return /* @__PURE__ */ jsx28("div", { className: "w-full md:w-1/2", children: /* @__PURE__ */ jsx28("div", { className: "mx-2", children: /* @__PURE__ */ jsxs18("div", { className: "w-full flex flex-row my-2 gap-x-2", children: [
4656
4657
  /* @__PURE__ */ jsx28("div", { className: "my-auto", children: /* @__PURE__ */ jsxs18("p", { className: "text-xl", children: [
4657
4658
  parseFloat(materialKey) + 1,
@@ -5065,9 +5066,10 @@ var FillInTheBlanksActivityMaterialContent = ({
5065
5066
  )
5066
5067
  ) }),
5067
5068
  /* @__PURE__ */ jsx30("div", { className: "w-full flex flex-row flex-wrap", children: Object.keys(displayAnswerMap).map((materialKey, index) => {
5068
- const learnerAnswerState = !isPreview ? null : !showCorrectAnswer ? null : checkAnswerState(
5069
+ const currentAnswer = displayAnswerMap[materialKey];
5070
+ const learnerAnswerState = !isPreview ? null : !currentAnswer || currentAnswer === "" || currentAnswer === "DEFAULT_OPTION" ? null : checkAnswerState(
5069
5071
  JSON.parse(materialMap[materialKey]),
5070
- displayAnswerMap[materialKey]
5072
+ currentAnswer
5071
5073
  );
5072
5074
  return /* @__PURE__ */ jsx30("div", { className: "w-full md:w-1/2", children: /* @__PURE__ */ jsx30("div", { className: "mx-2", children: /* @__PURE__ */ jsx30(
5073
5075
  "div",
@@ -6861,7 +6863,7 @@ var OrderingActivityMaterialContent = ({
6861
6863
  }
6862
6864
  ),
6863
6865
  /* @__PURE__ */ jsx42("div", { className: "flex-1 min-h-0 overflow-y-auto", children: Object.keys(displayAnswerMap).map((materialKey, index) => {
6864
- const learnerAnswerState = !isPreview ? null : !showCorrectAnswer ? null : checkAnswerState(displayAnswerMap[materialKey] + "", index + "");
6866
+ const learnerAnswerState = !isPreview ? null : checkAnswerState(displayAnswerMap[materialKey] + "", index + "");
6865
6867
  return /* @__PURE__ */ jsx42("div", { className: "w-full", children: /* @__PURE__ */ jsxs32(
6866
6868
  "div",
6867
6869
  {
@@ -7037,7 +7039,8 @@ var TrueFalseActivityMaterialContent = ({
7037
7039
  const learnerAnswer = displayAnswerMap.trueList.find(
7038
7040
  (trueItem) => trueItem === shuffleOption
7039
7041
  ) !== void 0 ? "TRUE" : "FALSE";
7040
- const learnerAnswerState = !isPreview ? null : !showCorrectAnswer ? null : checkAnswerState(correctAnswer, learnerAnswer);
7042
+ const hasAnswered = displayAnswerMap.trueList.includes(shuffleOption) || displayAnswerMap.falseList.includes(shuffleOption);
7043
+ const learnerAnswerState = !isPreview ? null : !hasAnswered ? null : checkAnswerState(correctAnswer, learnerAnswer);
7041
7044
  return /* @__PURE__ */ jsxs34(
7042
7045
  "div",
7043
7046
  {
@@ -7177,10 +7180,11 @@ var TrueFalseActivityContent_default = TrueFalseActivityContent;
7177
7180
 
7178
7181
  // src/components/activities/solution-contents/ActivitySolutionContent.tsx
7179
7182
  import { InlineMath as InlineMath11 } from "react-katex";
7180
- import { jsx as jsx46, jsxs as jsxs36 } from "react/jsx-runtime";
7183
+ import { Fragment as Fragment8, jsx as jsx46, jsxs as jsxs36 } from "react/jsx-runtime";
7181
7184
  var ActivitySolutionContent = ({
7182
7185
  activityTemplateType,
7183
- data
7186
+ data,
7187
+ hideTitleAndBorder = false
7184
7188
  }) => {
7185
7189
  if (!activityTemplateType) return null;
7186
7190
  const solutionMapKeys = {
@@ -7209,38 +7213,43 @@ var ActivitySolutionContent = ({
7209
7213
  return null;
7210
7214
  }
7211
7215
  if (!solutionMap || Object.keys(solutionMap).length === 0) return null;
7216
+ const renderContent = () => /* @__PURE__ */ jsx46(Fragment8, { children: Object.keys(solutionMap).map((key) => {
7217
+ let currentItem;
7218
+ try {
7219
+ currentItem = JSON.parse(solutionMap[key]);
7220
+ } catch (error) {
7221
+ console.error(`Error parsing solution item at key ${key}:`, error);
7222
+ return null;
7223
+ }
7224
+ const { value } = currentItem;
7225
+ return /* @__PURE__ */ jsx46("div", { className: "my-3 text-xl", children: constructInputWithSpecialExpressionList(value).map(
7226
+ (inputPart, partIndex) => /* @__PURE__ */ jsx46(
7227
+ "span",
7228
+ {
7229
+ className: `${inputPart.isBold ? "font-bold" : ""} ${inputPart.isUnderline ? "underline" : ""}`,
7230
+ children: inputPart.isEquation ? /* @__PURE__ */ jsx46("span", { className: "text-xl", children: /* @__PURE__ */ jsx46(InlineMath11, { math: inputPart.value }) }) : inputPart.value
7231
+ },
7232
+ `${key}_part_${partIndex}`
7233
+ )
7234
+ ) }, key);
7235
+ }) });
7236
+ if (hideTitleAndBorder) {
7237
+ return renderContent();
7238
+ }
7212
7239
  return /* @__PURE__ */ jsx46("div", { className: "mx-2", children: /* @__PURE__ */ jsxs36("div", { className: "p-4 border-catchup-blue border-2 rounded-catchup-xlarge", children: [
7213
7240
  /* @__PURE__ */ jsx46("p", { className: "text-xl font-bold text-center mb-3", children: i18n_default.t("solution") }),
7214
- Object.keys(solutionMap).map((key) => {
7215
- let currentItem;
7216
- try {
7217
- currentItem = JSON.parse(solutionMap[key]);
7218
- } catch (error) {
7219
- console.error(`Error parsing solution item at key ${key}:`, error);
7220
- return null;
7221
- }
7222
- const { value } = currentItem;
7223
- return /* @__PURE__ */ jsx46("div", { className: "my-3 text-xl", children: constructInputWithSpecialExpressionList(value).map(
7224
- (inputPart, partIndex) => /* @__PURE__ */ jsx46(
7225
- "span",
7226
- {
7227
- className: `${inputPart.isBold ? "font-bold" : ""} ${inputPart.isUnderline ? "underline" : ""}`,
7228
- children: inputPart.isEquation ? /* @__PURE__ */ jsx46("span", { className: "text-xl", children: /* @__PURE__ */ jsx46(InlineMath11, { math: inputPart.value }) }) : inputPart.value
7229
- },
7230
- `${key}_part_${partIndex}`
7231
- )
7232
- ) }, key);
7233
- })
7241
+ renderContent()
7234
7242
  ] }) });
7235
7243
  };
7236
7244
  var ActivitySolutionContent_default = ActivitySolutionContent;
7237
7245
 
7238
7246
  // src/components/activities/evaluation-rubric-contents/ActivityEvaluationRubricContent.tsx
7239
7247
  import { InlineMath as InlineMath12 } from "react-katex";
7240
- import { jsx as jsx47, jsxs as jsxs37 } from "react/jsx-runtime";
7248
+ import { Fragment as Fragment9, jsx as jsx47, jsxs as jsxs37 } from "react/jsx-runtime";
7241
7249
  var ActivityEvaluationRubricContent = ({
7242
7250
  activityTemplateType,
7243
- data
7251
+ data,
7252
+ hideTitleAndBorder = false
7244
7253
  }) => {
7245
7254
  if (!activityTemplateType) return;
7246
7255
  const evaluationRubricMapKeys = {
@@ -7267,36 +7276,40 @@ var ActivityEvaluationRubricContent = ({
7267
7276
  }
7268
7277
  if (!evaluationRubricMap || Object.keys(evaluationRubricMap).length === 0)
7269
7278
  return null;
7279
+ const renderContent = () => /* @__PURE__ */ jsx47(Fragment9, { children: Object.keys(evaluationRubricMap).map((key, index) => {
7280
+ const currentItem = JSON.parse(evaluationRubricMap[key]);
7281
+ const { value } = currentItem;
7282
+ const matchedRegex = value.match(/\[(\d+)\]\s*([\s\S]*)/);
7283
+ let points = 0;
7284
+ let evaluationRubric = value;
7285
+ if (matchedRegex) {
7286
+ points = parseFloat(matchedRegex[1]);
7287
+ evaluationRubric = matchedRegex[2];
7288
+ }
7289
+ return /* @__PURE__ */ jsxs37("div", { className: "my-2 flex flex-row gap-x-3", children: [
7290
+ /* @__PURE__ */ jsxs37("div", { className: "font-bold text-xl whitespace-nowrap", children: [
7291
+ points,
7292
+ " ",
7293
+ i18n_default.t("points")
7294
+ ] }),
7295
+ /* @__PURE__ */ jsx47("p", { className: "flex-1 text-xl whitespace-pre-wrap", children: constructInputWithSpecialExpressionList(evaluationRubric).map(
7296
+ (inputPart, inputIndex) => /* @__PURE__ */ jsx47(
7297
+ "span",
7298
+ {
7299
+ className: `${inputPart.isBold ? "font-bold" : ""} ${inputPart.isUnderline ? "underline" : ""}`,
7300
+ children: inputPart.isEquation ? /* @__PURE__ */ jsx47("span", { className: "text-xl", children: /* @__PURE__ */ jsx47(InlineMath12, { math: inputPart.value }) }) : inputPart.value
7301
+ },
7302
+ inputIndex
7303
+ )
7304
+ ) })
7305
+ ] }, `${key}_${index}`);
7306
+ }) });
7307
+ if (hideTitleAndBorder) {
7308
+ return renderContent();
7309
+ }
7270
7310
  return /* @__PURE__ */ jsxs37("div", { className: "p-4 border-catchup-gray-400 border-2 rounded-catchup-xlarge", children: [
7271
7311
  /* @__PURE__ */ jsx47("p", { className: "text-xl font-bold text-center mb-3", children: i18n_default.t("evaluation_rubric") }),
7272
- Object.keys(evaluationRubricMap).map((key, index) => {
7273
- const currentItem = JSON.parse(evaluationRubricMap[key]);
7274
- const { value } = currentItem;
7275
- const matchedRegex = value.match(/\[(\d+)\]\s*([\s\S]*)/);
7276
- let points = 0;
7277
- let evaluationRubric = value;
7278
- if (matchedRegex) {
7279
- points = parseFloat(matchedRegex[1]);
7280
- evaluationRubric = matchedRegex[2];
7281
- }
7282
- return /* @__PURE__ */ jsxs37("div", { className: "my-2 flex flex-row gap-x-3", children: [
7283
- /* @__PURE__ */ jsxs37("div", { className: "font-bold text-xl whitespace-nowrap", children: [
7284
- points,
7285
- " ",
7286
- i18n_default.t("points")
7287
- ] }),
7288
- /* @__PURE__ */ jsx47("p", { className: "flex-1 text-xl whitespace-pre-wrap", children: constructInputWithSpecialExpressionList(evaluationRubric).map(
7289
- (inputPart, inputIndex) => /* @__PURE__ */ jsx47(
7290
- "span",
7291
- {
7292
- className: `${inputPart.isBold ? "font-bold" : ""} ${inputPart.isUnderline ? "underline" : ""}`,
7293
- children: inputPart.isEquation ? /* @__PURE__ */ jsx47("span", { className: "text-xl", children: /* @__PURE__ */ jsx47(InlineMath12, { math: inputPart.value }) }) : inputPart.value
7294
- },
7295
- inputIndex
7296
- )
7297
- ) })
7298
- ] }, `${key}_${index}`);
7299
- })
7312
+ renderContent()
7300
7313
  ] });
7301
7314
  };
7302
7315
  var ActivityEvaluationRubricContent_default = ActivityEvaluationRubricContent;
@@ -7342,7 +7355,7 @@ var SelectionBox = ({
7342
7355
  var SelectionBox_default = SelectionBox;
7343
7356
 
7344
7357
  // src/components/activities/ActivityPreviewByData.tsx
7345
- import { Fragment as Fragment8, jsx as jsx49, jsxs as jsxs39 } from "react/jsx-runtime";
7358
+ import { Fragment as Fragment10, jsx as jsx49, jsxs as jsxs39 } from "react/jsx-runtime";
7346
7359
  var ACTIVITY_TEMPLATE_LIST = [
7347
7360
  { type: "ORDERING", materialMap: "orderingMaterialMap" },
7348
7361
  { type: "DROPDOWN", materialMap: "dropdownMaterialMap" },
@@ -7455,42 +7468,42 @@ var ActivityPreviewByData = ({
7455
7468
  }
7456
7469
  switch (selectedType) {
7457
7470
  case "ORDERING":
7458
- return data.orderingBodyMap && data.orderingMaterialMap ? /* @__PURE__ */ jsxs39(Fragment8, { children: [
7471
+ return data.orderingBodyMap && data.orderingMaterialMap ? /* @__PURE__ */ jsxs39(Fragment10, { children: [
7459
7472
  isEmpty && /* @__PURE__ */ jsx49(ActivityEmptyContent_default, {}),
7460
7473
  /* @__PURE__ */ jsx49(OrderingActivityContent_default, __spreadValues({}, commonProps))
7461
7474
  ] }) : null;
7462
7475
  case "DROPDOWN":
7463
- return data.dropdownBodyMap && data.dropdownMaterialMap ? /* @__PURE__ */ jsxs39(Fragment8, { children: [
7476
+ return data.dropdownBodyMap && data.dropdownMaterialMap ? /* @__PURE__ */ jsxs39(Fragment10, { children: [
7464
7477
  isEmpty && /* @__PURE__ */ jsx49(ActivityEmptyContent_default, {}),
7465
7478
  /* @__PURE__ */ jsx49(DropdownActivityContent_default, __spreadValues({}, commonProps))
7466
7479
  ] }) : null;
7467
7480
  case "MCSA":
7468
- return data.MCSABodyMap && data.MCSAMaterialMap ? /* @__PURE__ */ jsxs39(Fragment8, { children: [
7481
+ return data.MCSABodyMap && data.MCSAMaterialMap ? /* @__PURE__ */ jsxs39(Fragment10, { children: [
7469
7482
  isEmpty && /* @__PURE__ */ jsx49(ActivityEmptyContent_default, {}),
7470
7483
  /* @__PURE__ */ jsx49(MCSAActivityContent_default, __spreadValues({}, commonProps))
7471
7484
  ] }) : null;
7472
7485
  case "MCMA":
7473
- return data.MCMABodyMap && data.MCMAMaterialMap ? /* @__PURE__ */ jsxs39(Fragment8, { children: [
7486
+ return data.MCMABodyMap && data.MCMAMaterialMap ? /* @__PURE__ */ jsxs39(Fragment10, { children: [
7474
7487
  isEmpty && /* @__PURE__ */ jsx49(ActivityEmptyContent_default, {}),
7475
7488
  /* @__PURE__ */ jsx49(MCMAActivityContent_default, __spreadValues({}, commonProps))
7476
7489
  ] }) : null;
7477
7490
  case "MATCHING":
7478
- return data.matchingBodyMap && data.matchingMaterialMap ? /* @__PURE__ */ jsxs39(Fragment8, { children: [
7491
+ return data.matchingBodyMap && data.matchingMaterialMap ? /* @__PURE__ */ jsxs39(Fragment10, { children: [
7479
7492
  isEmpty && /* @__PURE__ */ jsx49(ActivityEmptyContent_default, {}),
7480
7493
  /* @__PURE__ */ jsx49(MatchingActivityContent_default, __spreadValues({}, commonProps))
7481
7494
  ] }) : null;
7482
7495
  case "GROUPING":
7483
- return data.groupingBodyMap && data.groupingMaterialMap ? /* @__PURE__ */ jsxs39(Fragment8, { children: [
7496
+ return data.groupingBodyMap && data.groupingMaterialMap ? /* @__PURE__ */ jsxs39(Fragment10, { children: [
7484
7497
  isEmpty && /* @__PURE__ */ jsx49(ActivityEmptyContent_default, {}),
7485
7498
  /* @__PURE__ */ jsx49(GroupingActivityContent_default, __spreadValues({}, commonProps))
7486
7499
  ] }) : null;
7487
7500
  case "FILL_IN_THE_BLANKS":
7488
- return data.fillInTheBlanksBodyMap && data.fillInTheBlanksMaterialMap ? /* @__PURE__ */ jsxs39(Fragment8, { children: [
7501
+ return data.fillInTheBlanksBodyMap && data.fillInTheBlanksMaterialMap ? /* @__PURE__ */ jsxs39(Fragment10, { children: [
7489
7502
  isEmpty && /* @__PURE__ */ jsx49(ActivityEmptyContent_default, {}),
7490
7503
  /* @__PURE__ */ jsx49(FillInTheBlanksActivityContent_default, __spreadValues({}, commonProps))
7491
7504
  ] }) : null;
7492
7505
  case "OPEN_ENDED":
7493
- return data.openEndedBodyMap ? /* @__PURE__ */ jsxs39(Fragment8, { children: [
7506
+ return data.openEndedBodyMap ? /* @__PURE__ */ jsxs39(Fragment10, { children: [
7494
7507
  isEmpty && /* @__PURE__ */ jsx49(ActivityEmptyContent_default, {}),
7495
7508
  /* @__PURE__ */ jsx49(
7496
7509
  OpenEndedActivityContent_default,
@@ -7500,7 +7513,7 @@ var ActivityPreviewByData = ({
7500
7513
  )
7501
7514
  ] }) : null;
7502
7515
  case "TRUE_FALSE":
7503
- return data.trueFalseBodyMap && data.trueFalseMaterialMap ? /* @__PURE__ */ jsxs39(Fragment8, { children: [
7516
+ return data.trueFalseBodyMap && data.trueFalseMaterialMap ? /* @__PURE__ */ jsxs39(Fragment10, { children: [
7504
7517
  isEmpty && /* @__PURE__ */ jsx49(ActivityEmptyContent_default, {}),
7505
7518
  /* @__PURE__ */ jsx49(TrueFalseActivityContent_default, __spreadValues({}, commonProps))
7506
7519
  ] }) : null;
@@ -7510,7 +7523,7 @@ var ActivityPreviewByData = ({
7510
7523
  };
7511
7524
  if (!data) return null;
7512
7525
  return /* @__PURE__ */ jsxs39("div", { children: [
7513
- showType && optionList.length > 0 ? /* @__PURE__ */ jsxs39(Fragment8, { children: [
7526
+ showType && optionList.length > 0 ? /* @__PURE__ */ jsxs39(Fragment10, { children: [
7514
7527
  /* @__PURE__ */ jsxs39("div", { className: "mb-2", children: [
7515
7528
  showDescription ? /* @__PURE__ */ jsx49("div", { className: "my-2", children: /* @__PURE__ */ jsx49("p", { className: "font-semibold text-lg", children: i18n_default.t("activity_template") }) }) : null,
7516
7529
  /* @__PURE__ */ jsx49(
@@ -9174,23 +9187,24 @@ var filterCoterieTypeByDistinctOptionList = (distinctCoterieTypeOptionList) => {
9174
9187
  );
9175
9188
  };
9176
9189
  var findAISettingsFromCurrentProfile = (userProfileBrand, userProfileCampus, userProfileInstitution) => {
9177
- if (userProfileInstitution) {
9178
- const { institutionSettingsDTO } = userProfileInstitution;
9179
- const { institutionAISettingsDTO } = institutionSettingsDTO;
9180
- return institutionAISettingsDTO;
9181
- } else {
9182
- if (userProfileCampus) {
9183
- const { campusSettingsDTO } = userProfileCampus;
9184
- const { campusAISettingsDTO } = campusSettingsDTO;
9185
- return campusAISettingsDTO;
9186
- } else {
9187
- if (userProfileBrand) {
9188
- const { brandSettingsDTO } = userProfileBrand;
9189
- const { brandAISettingsDTO } = brandSettingsDTO;
9190
- return brandAISettingsDTO;
9191
- }
9192
- }
9193
- }
9190
+ var _a, _b, _c;
9191
+ const brandSettings = (_a = userProfileBrand == null ? void 0 : userProfileBrand.brandSettingsDTO) == null ? void 0 : _a.brandAISettingsDTO;
9192
+ const campusSettings = (_b = userProfileCampus == null ? void 0 : userProfileCampus.campusSettingsDTO) == null ? void 0 : _b.campusAISettingsDTO;
9193
+ const instSettings = (_c = userProfileInstitution == null ? void 0 : userProfileInstitution.institutionSettingsDTO) == null ? void 0 : _c.institutionAISettingsDTO;
9194
+ const resolve = (field) => {
9195
+ var _a2, _b2, _c2;
9196
+ return (_c2 = (_b2 = (_a2 = instSettings == null ? void 0 : instSettings[field]) != null ? _a2 : campusSettings == null ? void 0 : campusSettings[field]) != null ? _b2 : brandSettings == null ? void 0 : brandSettings[field]) != null ? _c2 : false;
9197
+ };
9198
+ return {
9199
+ canImportActivity: resolve("canImportActivity"),
9200
+ canGenerateActivity: resolve("canGenerateActivity"),
9201
+ canEvaluateOpenEnded: resolve("canEvaluateOpenEnded"),
9202
+ canSolveActivityTemplate: resolve("canSolveActivityTemplate"),
9203
+ canGenerateRubric: resolve("canGenerateRubric"),
9204
+ canGenerateLessonPlan: resolve("canGenerateLessonPlan"),
9205
+ canGenerateImage: resolve("canGenerateImage"),
9206
+ canGeneratePodcast: resolve("canGeneratePodcast")
9207
+ };
9194
9208
  };
9195
9209
  var formatPriceWithCommas = (number, language) => {
9196
9210
  return number.toLocaleString(language, {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "catchup-library-web",
3
- "version": "2.7.11",
3
+ "version": "2.7.13",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
@@ -6,7 +6,8 @@ import { constructInputWithSpecialExpressionList } from "../../../utilization/Ca
6
6
  const ActivityEvaluationRubricContent = ({
7
7
  activityTemplateType,
8
8
  data,
9
- }: IActivityEvaluationRubricProps) => {
9
+ hideTitleAndBorder = false,
10
+ }: IActivityEvaluationRubricProps & { hideTitleAndBorder?: boolean }) => {
10
11
  if (!activityTemplateType) return;
11
12
 
12
13
  const evaluationRubricMapKeys: any = {
@@ -35,11 +36,8 @@ const ActivityEvaluationRubricContent = ({
35
36
  if (!evaluationRubricMap || Object.keys(evaluationRubricMap).length === 0)
36
37
  return null;
37
38
 
38
- return (
39
- <div className="p-4 border-catchup-gray-400 border-2 rounded-catchup-xlarge">
40
- <p className="text-xl font-bold text-center mb-3">
41
- {i18n.t("evaluation_rubric")}
42
- </p>
39
+ const renderContent = () => (
40
+ <>
43
41
  {Object.keys(evaluationRubricMap).map((key, index) => {
44
42
  const currentItem = JSON.parse(evaluationRubricMap[key]);
45
43
  const { value } = currentItem;
@@ -80,6 +78,19 @@ const ActivityEvaluationRubricContent = ({
80
78
  </div>
81
79
  );
82
80
  })}
81
+ </>
82
+ );
83
+
84
+ if (hideTitleAndBorder) {
85
+ return renderContent();
86
+ }
87
+
88
+ return (
89
+ <div className="p-4 border-catchup-gray-400 border-2 rounded-catchup-xlarge">
90
+ <p className="text-xl font-bold text-center mb-3">
91
+ {i18n.t("evaluation_rubric")}
92
+ </p>
93
+ {renderContent()}
83
94
  </div>
84
95
  );
85
96
  };
@@ -53,11 +53,12 @@ const DropdownActivityMaterialContent = ({
53
53
  {Object.keys(displayAnswerMap).map(
54
54
  (materialKey: string, index: number) => {
55
55
  const answerKey = Object.keys(materialMap[materialKey])[0];
56
+ const currentAnswer = displayAnswerMap[materialKey];
56
57
  const learnerAnswerState = !isPreview
57
58
  ? null
58
- : !showCorrectAnswer
59
+ : !currentAnswer || currentAnswer === "DEFAULT_OPTION"
59
60
  ? null
60
- : checkAnswerState(answerKey, displayAnswerMap[materialKey]);
61
+ : checkAnswerState(answerKey, currentAnswer);
61
62
  return (
62
63
  <div key={index} className="w-full md:w-1/2">
63
64
  <div className="mx-2">
@@ -309,13 +309,14 @@ const FillInTheBlanksActivityMaterialContent = ({
309
309
  </div>
310
310
  <div className="w-full flex flex-row flex-wrap">
311
311
  {Object.keys(displayAnswerMap).map((materialKey, index) => {
312
+ const currentAnswer = displayAnswerMap[materialKey];
312
313
  const learnerAnswerState = !isPreview
313
314
  ? null
314
- : !showCorrectAnswer
315
+ : !currentAnswer || currentAnswer === "" || currentAnswer === "DEFAULT_OPTION"
315
316
  ? null
316
317
  : checkAnswerState(
317
318
  JSON.parse(materialMap[materialKey]),
318
- displayAnswerMap[materialKey],
319
+ currentAnswer,
319
320
  );
320
321
  return (
321
322
  <div key={index} className="w-full md:w-1/2">
@@ -256,9 +256,7 @@ const OrderingActivityMaterialContent = ({
256
256
  {Object.keys(displayAnswerMap).map((materialKey, index) => {
257
257
  const learnerAnswerState = !isPreview
258
258
  ? null
259
- : !showCorrectAnswer
260
- ? null
261
- : checkAnswerState(displayAnswerMap[materialKey] + "", index + "");
259
+ : checkAnswerState(displayAnswerMap[materialKey] + "", index + "");
262
260
  return (
263
261
  <div className="w-full" key={index}>
264
262
  <div
@@ -81,9 +81,12 @@ const TrueFalseActivityMaterialContent = ({
81
81
  ? "TRUE"
82
82
  : "FALSE";
83
83
 
84
+ const hasAnswered =
85
+ displayAnswerMap.trueList.includes(shuffleOption) ||
86
+ displayAnswerMap.falseList.includes(shuffleOption);
84
87
  const learnerAnswerState = !isPreview
85
88
  ? null
86
- : !showCorrectAnswer
89
+ : !hasAnswered
87
90
  ? null
88
91
  : checkAnswerState(correctAnswer, learnerAnswer);
89
92
 
@@ -6,7 +6,8 @@ import { IActivitySolutionProps } from "../../../properties/ActivityProperties";
6
6
  const ActivitySolutionContent = ({
7
7
  activityTemplateType,
8
8
  data,
9
- }: IActivitySolutionProps) => {
9
+ hideTitleAndBorder = false,
10
+ }: IActivitySolutionProps & { hideTitleAndBorder?: boolean }) => {
10
11
  if (!activityTemplateType) return null;
11
12
 
12
13
  const solutionMapKeys: any = {
@@ -56,13 +57,9 @@ const ActivitySolutionContent = ({
56
57
 
57
58
  if (!solutionMap || Object.keys(solutionMap).length === 0) return null;
58
59
 
59
- return (
60
- <div className="mx-2">
61
- <div className="p-4 border-catchup-blue border-2 rounded-catchup-xlarge">
62
- <p className="text-xl font-bold text-center mb-3">
63
- {i18n.t("solution")}
64
- </p>
65
- {Object.keys(solutionMap).map((key) => {
60
+ const renderContent = () => (
61
+ <>
62
+ {Object.keys(solutionMap).map((key) => {
66
63
  let currentItem;
67
64
  try {
68
65
  currentItem = JSON.parse(solutionMap[key]);
@@ -96,6 +93,20 @@ const ActivitySolutionContent = ({
96
93
  </div>
97
94
  );
98
95
  })}
96
+ </>
97
+ );
98
+
99
+ if (hideTitleAndBorder) {
100
+ return renderContent();
101
+ }
102
+
103
+ return (
104
+ <div className="mx-2">
105
+ <div className="p-4 border-catchup-blue border-2 rounded-catchup-xlarge">
106
+ <p className="text-xl font-bold text-center mb-3">
107
+ {i18n.t("solution")}
108
+ </p>
109
+ {renderContent()}
99
110
  </div>
100
111
  </div>
101
112
  );
@@ -1250,25 +1250,25 @@ export const findAISettingsFromCurrentProfile = (
1250
1250
  userProfileCampus: any,
1251
1251
  userProfileInstitution: any,
1252
1252
  ) => {
1253
- if (userProfileInstitution) {
1254
- const { institutionSettingsDTO } = userProfileInstitution;
1255
- const { institutionAISettingsDTO } = institutionSettingsDTO;
1256
- return institutionAISettingsDTO;
1257
- // const { canConvertActivityTemplate } = institutionAISettingsDTO;
1258
- // if (!canConvertActivityTemplate) return false;
1259
- } else {
1260
- if (userProfileCampus) {
1261
- const { campusSettingsDTO } = userProfileCampus;
1262
- const { campusAISettingsDTO } = campusSettingsDTO;
1263
- return campusAISettingsDTO;
1264
- } else {
1265
- if (userProfileBrand) {
1266
- const { brandSettingsDTO } = userProfileBrand;
1267
- const { brandAISettingsDTO } = brandSettingsDTO;
1268
- return brandAISettingsDTO;
1269
- }
1270
- }
1271
- }
1253
+ const brandSettings = userProfileBrand?.brandSettingsDTO?.brandAISettingsDTO;
1254
+ const campusSettings =
1255
+ userProfileCampus?.campusSettingsDTO?.campusAISettingsDTO;
1256
+ const instSettings =
1257
+ userProfileInstitution?.institutionSettingsDTO?.institutionAISettingsDTO;
1258
+
1259
+ const resolve = (field: string) =>
1260
+ instSettings?.[field] ?? campusSettings?.[field] ?? brandSettings?.[field] ?? false;
1261
+
1262
+ return {
1263
+ canImportActivity: resolve("canImportActivity"),
1264
+ canGenerateActivity: resolve("canGenerateActivity"),
1265
+ canEvaluateOpenEnded: resolve("canEvaluateOpenEnded"),
1266
+ canSolveActivityTemplate: resolve("canSolveActivityTemplate"),
1267
+ canGenerateRubric: resolve("canGenerateRubric"),
1268
+ canGenerateLessonPlan: resolve("canGenerateLessonPlan"),
1269
+ canGenerateImage: resolve("canGenerateImage"),
1270
+ canGeneratePodcast: resolve("canGeneratePodcast"),
1271
+ };
1272
1272
  };
1273
1273
 
1274
1274
  export const formatPriceWithCommas = (number: number, language: string) => {