catchup-library-web 2.7.12 → 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
@@ -7423,7 +7423,8 @@ var import_react_katex11 = require("react-katex");
7423
7423
  var import_jsx_runtime46 = require("react/jsx-runtime");
7424
7424
  var ActivitySolutionContent = ({
7425
7425
  activityTemplateType,
7426
- data
7426
+ data,
7427
+ hideTitleAndBorder = false
7427
7428
  }) => {
7428
7429
  if (!activityTemplateType) return null;
7429
7430
  const solutionMapKeys = {
@@ -7452,28 +7453,32 @@ var ActivitySolutionContent = ({
7452
7453
  return null;
7453
7454
  }
7454
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
+ }
7455
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: [
7456
7480
  /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("p", { className: "text-xl font-bold text-center mb-3", children: i18n_default.t("solution") }),
7457
- Object.keys(solutionMap).map((key) => {
7458
- let currentItem;
7459
- try {
7460
- currentItem = JSON.parse(solutionMap[key]);
7461
- } catch (error) {
7462
- console.error(`Error parsing solution item at key ${key}:`, error);
7463
- return null;
7464
- }
7465
- const { value } = currentItem;
7466
- return /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("div", { className: "my-3 text-xl", children: constructInputWithSpecialExpressionList(value).map(
7467
- (inputPart, partIndex) => /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
7468
- "span",
7469
- {
7470
- className: `${inputPart.isBold ? "font-bold" : ""} ${inputPart.isUnderline ? "underline" : ""}`,
7471
- 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
7472
- },
7473
- `${key}_part_${partIndex}`
7474
- )
7475
- ) }, key);
7476
- })
7481
+ renderContent()
7477
7482
  ] }) });
7478
7483
  };
7479
7484
  var ActivitySolutionContent_default = ActivitySolutionContent;
@@ -7483,7 +7488,8 @@ var import_react_katex12 = require("react-katex");
7483
7488
  var import_jsx_runtime47 = require("react/jsx-runtime");
7484
7489
  var ActivityEvaluationRubricContent = ({
7485
7490
  activityTemplateType,
7486
- data
7491
+ data,
7492
+ hideTitleAndBorder = false
7487
7493
  }) => {
7488
7494
  if (!activityTemplateType) return;
7489
7495
  const evaluationRubricMapKeys = {
@@ -7510,36 +7516,40 @@ var ActivityEvaluationRubricContent = ({
7510
7516
  }
7511
7517
  if (!evaluationRubricMap || Object.keys(evaluationRubricMap).length === 0)
7512
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
+ }
7513
7550
  return /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("div", { className: "p-4 border-catchup-gray-400 border-2 rounded-catchup-xlarge", children: [
7514
7551
  /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("p", { className: "text-xl font-bold text-center mb-3", children: i18n_default.t("evaluation_rubric") }),
7515
- Object.keys(evaluationRubricMap).map((key, index) => {
7516
- const currentItem = JSON.parse(evaluationRubricMap[key]);
7517
- const { value } = currentItem;
7518
- const matchedRegex = value.match(/\[(\d+)\]\s*([\s\S]*)/);
7519
- let points = 0;
7520
- let evaluationRubric = value;
7521
- if (matchedRegex) {
7522
- points = parseFloat(matchedRegex[1]);
7523
- evaluationRubric = matchedRegex[2];
7524
- }
7525
- return /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("div", { className: "my-2 flex flex-row gap-x-3", children: [
7526
- /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("div", { className: "font-bold text-xl whitespace-nowrap", children: [
7527
- points,
7528
- " ",
7529
- i18n_default.t("points")
7530
- ] }),
7531
- /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("p", { className: "flex-1 text-xl whitespace-pre-wrap", children: constructInputWithSpecialExpressionList(evaluationRubric).map(
7532
- (inputPart, inputIndex) => /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
7533
- "span",
7534
- {
7535
- className: `${inputPart.isBold ? "font-bold" : ""} ${inputPart.isUnderline ? "underline" : ""}`,
7536
- 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
7537
- },
7538
- inputIndex
7539
- )
7540
- ) })
7541
- ] }, `${key}_${index}`);
7542
- })
7552
+ renderContent()
7543
7553
  ] });
7544
7554
  };
7545
7555
  var ActivityEvaluationRubricContent_default = ActivityEvaluationRubricContent;
@@ -9417,23 +9427,24 @@ var filterCoterieTypeByDistinctOptionList = (distinctCoterieTypeOptionList) => {
9417
9427
  );
9418
9428
  };
9419
9429
  var findAISettingsFromCurrentProfile = (userProfileBrand, userProfileCampus, userProfileInstitution) => {
9420
- if (userProfileInstitution) {
9421
- const { institutionSettingsDTO } = userProfileInstitution;
9422
- const { institutionAISettingsDTO } = institutionSettingsDTO;
9423
- return institutionAISettingsDTO;
9424
- } else {
9425
- if (userProfileCampus) {
9426
- const { campusSettingsDTO } = userProfileCampus;
9427
- const { campusAISettingsDTO } = campusSettingsDTO;
9428
- return campusAISettingsDTO;
9429
- } else {
9430
- if (userProfileBrand) {
9431
- const { brandSettingsDTO } = userProfileBrand;
9432
- const { brandAISettingsDTO } = brandSettingsDTO;
9433
- return brandAISettingsDTO;
9434
- }
9435
- }
9436
- }
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
+ };
9437
9448
  };
9438
9449
  var formatPriceWithCommas = (number, language) => {
9439
9450
  return number.toLocaleString(language, {
package/dist/index.mjs CHANGED
@@ -7180,10 +7180,11 @@ var TrueFalseActivityContent_default = TrueFalseActivityContent;
7180
7180
 
7181
7181
  // src/components/activities/solution-contents/ActivitySolutionContent.tsx
7182
7182
  import { InlineMath as InlineMath11 } from "react-katex";
7183
- 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";
7184
7184
  var ActivitySolutionContent = ({
7185
7185
  activityTemplateType,
7186
- data
7186
+ data,
7187
+ hideTitleAndBorder = false
7187
7188
  }) => {
7188
7189
  if (!activityTemplateType) return null;
7189
7190
  const solutionMapKeys = {
@@ -7212,38 +7213,43 @@ var ActivitySolutionContent = ({
7212
7213
  return null;
7213
7214
  }
7214
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
+ }
7215
7239
  return /* @__PURE__ */ jsx46("div", { className: "mx-2", children: /* @__PURE__ */ jsxs36("div", { className: "p-4 border-catchup-blue border-2 rounded-catchup-xlarge", children: [
7216
7240
  /* @__PURE__ */ jsx46("p", { className: "text-xl font-bold text-center mb-3", children: i18n_default.t("solution") }),
7217
- Object.keys(solutionMap).map((key) => {
7218
- let currentItem;
7219
- try {
7220
- currentItem = JSON.parse(solutionMap[key]);
7221
- } catch (error) {
7222
- console.error(`Error parsing solution item at key ${key}:`, error);
7223
- return null;
7224
- }
7225
- const { value } = currentItem;
7226
- return /* @__PURE__ */ jsx46("div", { className: "my-3 text-xl", children: constructInputWithSpecialExpressionList(value).map(
7227
- (inputPart, partIndex) => /* @__PURE__ */ jsx46(
7228
- "span",
7229
- {
7230
- className: `${inputPart.isBold ? "font-bold" : ""} ${inputPart.isUnderline ? "underline" : ""}`,
7231
- children: inputPart.isEquation ? /* @__PURE__ */ jsx46("span", { className: "text-xl", children: /* @__PURE__ */ jsx46(InlineMath11, { math: inputPart.value }) }) : inputPart.value
7232
- },
7233
- `${key}_part_${partIndex}`
7234
- )
7235
- ) }, key);
7236
- })
7241
+ renderContent()
7237
7242
  ] }) });
7238
7243
  };
7239
7244
  var ActivitySolutionContent_default = ActivitySolutionContent;
7240
7245
 
7241
7246
  // src/components/activities/evaluation-rubric-contents/ActivityEvaluationRubricContent.tsx
7242
7247
  import { InlineMath as InlineMath12 } from "react-katex";
7243
- 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";
7244
7249
  var ActivityEvaluationRubricContent = ({
7245
7250
  activityTemplateType,
7246
- data
7251
+ data,
7252
+ hideTitleAndBorder = false
7247
7253
  }) => {
7248
7254
  if (!activityTemplateType) return;
7249
7255
  const evaluationRubricMapKeys = {
@@ -7270,36 +7276,40 @@ var ActivityEvaluationRubricContent = ({
7270
7276
  }
7271
7277
  if (!evaluationRubricMap || Object.keys(evaluationRubricMap).length === 0)
7272
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
+ }
7273
7310
  return /* @__PURE__ */ jsxs37("div", { className: "p-4 border-catchup-gray-400 border-2 rounded-catchup-xlarge", children: [
7274
7311
  /* @__PURE__ */ jsx47("p", { className: "text-xl font-bold text-center mb-3", children: i18n_default.t("evaluation_rubric") }),
7275
- Object.keys(evaluationRubricMap).map((key, index) => {
7276
- const currentItem = JSON.parse(evaluationRubricMap[key]);
7277
- const { value } = currentItem;
7278
- const matchedRegex = value.match(/\[(\d+)\]\s*([\s\S]*)/);
7279
- let points = 0;
7280
- let evaluationRubric = value;
7281
- if (matchedRegex) {
7282
- points = parseFloat(matchedRegex[1]);
7283
- evaluationRubric = matchedRegex[2];
7284
- }
7285
- return /* @__PURE__ */ jsxs37("div", { className: "my-2 flex flex-row gap-x-3", children: [
7286
- /* @__PURE__ */ jsxs37("div", { className: "font-bold text-xl whitespace-nowrap", children: [
7287
- points,
7288
- " ",
7289
- i18n_default.t("points")
7290
- ] }),
7291
- /* @__PURE__ */ jsx47("p", { className: "flex-1 text-xl whitespace-pre-wrap", children: constructInputWithSpecialExpressionList(evaluationRubric).map(
7292
- (inputPart, inputIndex) => /* @__PURE__ */ jsx47(
7293
- "span",
7294
- {
7295
- className: `${inputPart.isBold ? "font-bold" : ""} ${inputPart.isUnderline ? "underline" : ""}`,
7296
- children: inputPart.isEquation ? /* @__PURE__ */ jsx47("span", { className: "text-xl", children: /* @__PURE__ */ jsx47(InlineMath12, { math: inputPart.value }) }) : inputPart.value
7297
- },
7298
- inputIndex
7299
- )
7300
- ) })
7301
- ] }, `${key}_${index}`);
7302
- })
7312
+ renderContent()
7303
7313
  ] });
7304
7314
  };
7305
7315
  var ActivityEvaluationRubricContent_default = ActivityEvaluationRubricContent;
@@ -7345,7 +7355,7 @@ var SelectionBox = ({
7345
7355
  var SelectionBox_default = SelectionBox;
7346
7356
 
7347
7357
  // src/components/activities/ActivityPreviewByData.tsx
7348
- 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";
7349
7359
  var ACTIVITY_TEMPLATE_LIST = [
7350
7360
  { type: "ORDERING", materialMap: "orderingMaterialMap" },
7351
7361
  { type: "DROPDOWN", materialMap: "dropdownMaterialMap" },
@@ -7458,42 +7468,42 @@ var ActivityPreviewByData = ({
7458
7468
  }
7459
7469
  switch (selectedType) {
7460
7470
  case "ORDERING":
7461
- return data.orderingBodyMap && data.orderingMaterialMap ? /* @__PURE__ */ jsxs39(Fragment8, { children: [
7471
+ return data.orderingBodyMap && data.orderingMaterialMap ? /* @__PURE__ */ jsxs39(Fragment10, { children: [
7462
7472
  isEmpty && /* @__PURE__ */ jsx49(ActivityEmptyContent_default, {}),
7463
7473
  /* @__PURE__ */ jsx49(OrderingActivityContent_default, __spreadValues({}, commonProps))
7464
7474
  ] }) : null;
7465
7475
  case "DROPDOWN":
7466
- return data.dropdownBodyMap && data.dropdownMaterialMap ? /* @__PURE__ */ jsxs39(Fragment8, { children: [
7476
+ return data.dropdownBodyMap && data.dropdownMaterialMap ? /* @__PURE__ */ jsxs39(Fragment10, { children: [
7467
7477
  isEmpty && /* @__PURE__ */ jsx49(ActivityEmptyContent_default, {}),
7468
7478
  /* @__PURE__ */ jsx49(DropdownActivityContent_default, __spreadValues({}, commonProps))
7469
7479
  ] }) : null;
7470
7480
  case "MCSA":
7471
- return data.MCSABodyMap && data.MCSAMaterialMap ? /* @__PURE__ */ jsxs39(Fragment8, { children: [
7481
+ return data.MCSABodyMap && data.MCSAMaterialMap ? /* @__PURE__ */ jsxs39(Fragment10, { children: [
7472
7482
  isEmpty && /* @__PURE__ */ jsx49(ActivityEmptyContent_default, {}),
7473
7483
  /* @__PURE__ */ jsx49(MCSAActivityContent_default, __spreadValues({}, commonProps))
7474
7484
  ] }) : null;
7475
7485
  case "MCMA":
7476
- return data.MCMABodyMap && data.MCMAMaterialMap ? /* @__PURE__ */ jsxs39(Fragment8, { children: [
7486
+ return data.MCMABodyMap && data.MCMAMaterialMap ? /* @__PURE__ */ jsxs39(Fragment10, { children: [
7477
7487
  isEmpty && /* @__PURE__ */ jsx49(ActivityEmptyContent_default, {}),
7478
7488
  /* @__PURE__ */ jsx49(MCMAActivityContent_default, __spreadValues({}, commonProps))
7479
7489
  ] }) : null;
7480
7490
  case "MATCHING":
7481
- return data.matchingBodyMap && data.matchingMaterialMap ? /* @__PURE__ */ jsxs39(Fragment8, { children: [
7491
+ return data.matchingBodyMap && data.matchingMaterialMap ? /* @__PURE__ */ jsxs39(Fragment10, { children: [
7482
7492
  isEmpty && /* @__PURE__ */ jsx49(ActivityEmptyContent_default, {}),
7483
7493
  /* @__PURE__ */ jsx49(MatchingActivityContent_default, __spreadValues({}, commonProps))
7484
7494
  ] }) : null;
7485
7495
  case "GROUPING":
7486
- return data.groupingBodyMap && data.groupingMaterialMap ? /* @__PURE__ */ jsxs39(Fragment8, { children: [
7496
+ return data.groupingBodyMap && data.groupingMaterialMap ? /* @__PURE__ */ jsxs39(Fragment10, { children: [
7487
7497
  isEmpty && /* @__PURE__ */ jsx49(ActivityEmptyContent_default, {}),
7488
7498
  /* @__PURE__ */ jsx49(GroupingActivityContent_default, __spreadValues({}, commonProps))
7489
7499
  ] }) : null;
7490
7500
  case "FILL_IN_THE_BLANKS":
7491
- return data.fillInTheBlanksBodyMap && data.fillInTheBlanksMaterialMap ? /* @__PURE__ */ jsxs39(Fragment8, { children: [
7501
+ return data.fillInTheBlanksBodyMap && data.fillInTheBlanksMaterialMap ? /* @__PURE__ */ jsxs39(Fragment10, { children: [
7492
7502
  isEmpty && /* @__PURE__ */ jsx49(ActivityEmptyContent_default, {}),
7493
7503
  /* @__PURE__ */ jsx49(FillInTheBlanksActivityContent_default, __spreadValues({}, commonProps))
7494
7504
  ] }) : null;
7495
7505
  case "OPEN_ENDED":
7496
- return data.openEndedBodyMap ? /* @__PURE__ */ jsxs39(Fragment8, { children: [
7506
+ return data.openEndedBodyMap ? /* @__PURE__ */ jsxs39(Fragment10, { children: [
7497
7507
  isEmpty && /* @__PURE__ */ jsx49(ActivityEmptyContent_default, {}),
7498
7508
  /* @__PURE__ */ jsx49(
7499
7509
  OpenEndedActivityContent_default,
@@ -7503,7 +7513,7 @@ var ActivityPreviewByData = ({
7503
7513
  )
7504
7514
  ] }) : null;
7505
7515
  case "TRUE_FALSE":
7506
- return data.trueFalseBodyMap && data.trueFalseMaterialMap ? /* @__PURE__ */ jsxs39(Fragment8, { children: [
7516
+ return data.trueFalseBodyMap && data.trueFalseMaterialMap ? /* @__PURE__ */ jsxs39(Fragment10, { children: [
7507
7517
  isEmpty && /* @__PURE__ */ jsx49(ActivityEmptyContent_default, {}),
7508
7518
  /* @__PURE__ */ jsx49(TrueFalseActivityContent_default, __spreadValues({}, commonProps))
7509
7519
  ] }) : null;
@@ -7513,7 +7523,7 @@ var ActivityPreviewByData = ({
7513
7523
  };
7514
7524
  if (!data) return null;
7515
7525
  return /* @__PURE__ */ jsxs39("div", { children: [
7516
- showType && optionList.length > 0 ? /* @__PURE__ */ jsxs39(Fragment8, { children: [
7526
+ showType && optionList.length > 0 ? /* @__PURE__ */ jsxs39(Fragment10, { children: [
7517
7527
  /* @__PURE__ */ jsxs39("div", { className: "mb-2", children: [
7518
7528
  showDescription ? /* @__PURE__ */ jsx49("div", { className: "my-2", children: /* @__PURE__ */ jsx49("p", { className: "font-semibold text-lg", children: i18n_default.t("activity_template") }) }) : null,
7519
7529
  /* @__PURE__ */ jsx49(
@@ -9177,23 +9187,24 @@ var filterCoterieTypeByDistinctOptionList = (distinctCoterieTypeOptionList) => {
9177
9187
  );
9178
9188
  };
9179
9189
  var findAISettingsFromCurrentProfile = (userProfileBrand, userProfileCampus, userProfileInstitution) => {
9180
- if (userProfileInstitution) {
9181
- const { institutionSettingsDTO } = userProfileInstitution;
9182
- const { institutionAISettingsDTO } = institutionSettingsDTO;
9183
- return institutionAISettingsDTO;
9184
- } else {
9185
- if (userProfileCampus) {
9186
- const { campusSettingsDTO } = userProfileCampus;
9187
- const { campusAISettingsDTO } = campusSettingsDTO;
9188
- return campusAISettingsDTO;
9189
- } else {
9190
- if (userProfileBrand) {
9191
- const { brandSettingsDTO } = userProfileBrand;
9192
- const { brandAISettingsDTO } = brandSettingsDTO;
9193
- return brandAISettingsDTO;
9194
- }
9195
- }
9196
- }
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
+ };
9197
9208
  };
9198
9209
  var formatPriceWithCommas = (number, language) => {
9199
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.12",
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
  };
@@ -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) => {