@cuemath/leap 3.1.2-j2 → 3.1.2
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/assets/illustrations/illustrations.js +2 -1
- package/dist/assets/illustrations/illustrations.js.map +1 -1
- package/dist/assets/line-icons/icons/check.js +3 -3
- package/dist/assets/line-icons/icons/check.js.map +1 -1
- package/dist/assets/line-icons/icons/puzzle-icon.js +51 -0
- package/dist/assets/line-icons/icons/puzzle-icon.js.map +1 -0
- package/dist/assets/line-icons/icons/share.js +48 -0
- package/dist/assets/line-icons/icons/share.js.map +1 -0
- package/dist/assets/line-icons/icons/tile.js +54 -0
- package/dist/assets/line-icons/icons/tile.js.map +1 -0
- package/dist/features/auth/account-selector/account-selector.js +36 -56
- package/dist/features/auth/account-selector/account-selector.js.map +1 -1
- package/dist/features/auth/comps/auth-page-layout/auth-page-layout-styles.js +12 -0
- package/dist/features/auth/comps/auth-page-layout/auth-page-layout-styles.js.map +1 -0
- package/dist/features/auth/comps/auth-page-layout/auth-page-layout.js +9 -8
- package/dist/features/auth/comps/auth-page-layout/auth-page-layout.js.map +1 -1
- package/dist/features/auth/comps/auth-static-panel/auth-static-panel.js +1 -1
- package/dist/features/auth/comps/auth-static-panel/auth-static-panel.js.map +1 -1
- package/dist/features/auth/forgot-password/forgot-password-styled.js +3 -15
- package/dist/features/auth/forgot-password/forgot-password-styled.js.map +1 -1
- package/dist/features/auth/forgot-password/otp-form/otp-form.js +29 -29
- package/dist/features/auth/forgot-password/otp-form/otp-form.js.map +1 -1
- package/dist/features/auth/forgot-password/reset-password-form/reset-password-form.js +18 -14
- package/dist/features/auth/forgot-password/reset-password-form/reset-password-form.js.map +1 -1
- package/dist/features/auth/forgot-password/user-identifier-form/user-identifier-form.js +24 -23
- package/dist/features/auth/forgot-password/user-identifier-form/user-identifier-form.js.map +1 -1
- package/dist/features/auth/login/identifier-otp-form/identifier-otp-form-styled.js +2 -4
- package/dist/features/auth/login/identifier-otp-form/identifier-otp-form-styled.js.map +1 -1
- package/dist/features/auth/login/identifier-otp-form/identifier-otp-form.js +75 -85
- package/dist/features/auth/login/identifier-otp-form/identifier-otp-form.js.map +1 -1
- package/dist/features/auth/login/social-account-not-found/social-account-not-found.js +20 -26
- package/dist/features/auth/login/social-account-not-found/social-account-not-found.js.map +1 -1
- package/dist/features/auth/login/social-login-methods/social-login-methods.js +34 -43
- package/dist/features/auth/login/social-login-methods/social-login-methods.js.map +1 -1
- package/dist/features/auth/login/username-password-form/username-password-form.js +21 -22
- package/dist/features/auth/login/username-password-form/username-password-form.js.map +1 -1
- package/dist/features/auth/user-list/user-item/user-item.js +24 -25
- package/dist/features/auth/user-list/user-item/user-item.js.map +1 -1
- package/dist/features/auth/user-list/user-list.js +51 -60
- package/dist/features/auth/user-list/user-list.js.map +1 -1
- package/dist/features/circle-games/hooks/use-circle-sounds/use-circle-sounds.js +74 -74
- package/dist/features/circle-games/hooks/use-circle-sounds/use-circle-sounds.js.map +1 -1
- package/dist/features/cue-canvas/bottombar/homework-controls.js +73 -0
- package/dist/features/cue-canvas/bottombar/homework-controls.js.map +1 -0
- package/dist/features/cue-canvas/cue-canvas-context.js +8 -5
- package/dist/features/cue-canvas/cue-canvas-context.js.map +1 -1
- package/dist/features/cue-canvas/cue-canvas-core.js +84 -74
- package/dist/features/cue-canvas/cue-canvas-core.js.map +1 -1
- package/dist/features/cue-canvas/cue-canvas-helpers.js +31 -25
- package/dist/features/cue-canvas/cue-canvas-helpers.js.map +1 -1
- package/dist/features/cue-canvas/cue-canvas-provider.js +14 -12
- package/dist/features/cue-canvas/cue-canvas-provider.js.map +1 -1
- package/dist/features/cue-canvas/cue-canvas.js +66 -59
- package/dist/features/cue-canvas/cue-canvas.js.map +1 -1
- package/dist/features/cue-canvas/cue-cavas-styled.js +45 -42
- package/dist/features/cue-canvas/cue-cavas-styled.js.map +1 -1
- package/dist/features/cue-canvas/hooks/use-canvas-sync-broker.js +61 -54
- package/dist/features/cue-canvas/hooks/use-canvas-sync-broker.js.map +1 -1
- package/dist/features/cue-canvas/hooks/use-config-updater.js +12 -0
- package/dist/features/cue-canvas/hooks/use-config-updater.js.map +1 -0
- package/dist/features/cue-canvas/hooks/use-cue-canvas-actions.js +18 -14
- package/dist/features/cue-canvas/hooks/use-cue-canvas-actions.js.map +1 -1
- package/dist/features/cue-canvas/hooks/use-upload-helper.js +23 -0
- package/dist/features/cue-canvas/hooks/use-upload-helper.js.map +1 -0
- package/dist/features/cue-canvas/sidebar/homework/helper.js +20 -0
- package/dist/features/cue-canvas/sidebar/homework/helper.js.map +1 -0
- package/dist/features/cue-canvas/sidebar/homework/homework-menu.js +33 -0
- package/dist/features/cue-canvas/sidebar/homework/homework-menu.js.map +1 -0
- package/dist/features/cue-canvas/sidebar/homework/homework-request.js +68 -0
- package/dist/features/cue-canvas/sidebar/homework/homework-request.js.map +1 -0
- package/dist/features/cue-canvas/sidebar/homework/homework-styled.js +25 -0
- package/dist/features/cue-canvas/sidebar/homework/homework-styled.js.map +1 -0
- package/dist/features/cue-canvas/sidebar/homework/homework.js +39 -0
- package/dist/features/cue-canvas/sidebar/homework/homework.js.map +1 -0
- package/dist/features/cue-canvas/sidebar/puzzles/api/get-puzzles.js +13 -0
- package/dist/features/cue-canvas/sidebar/puzzles/api/get-puzzles.js.map +1 -0
- package/dist/features/cue-canvas/sidebar/puzzles/filter-selection-menu.js +60 -0
- package/dist/features/cue-canvas/sidebar/puzzles/filter-selection-menu.js.map +1 -0
- package/dist/features/cue-canvas/sidebar/puzzles/filters-section.js +44 -0
- package/dist/features/cue-canvas/sidebar/puzzles/filters-section.js.map +1 -0
- package/dist/features/cue-canvas/sidebar/puzzles/filters.js +107 -0
- package/dist/features/cue-canvas/sidebar/puzzles/filters.js.map +1 -0
- package/dist/features/cue-canvas/sidebar/puzzles/hooks/use-fetch-cue-canvas-activity.js +42 -0
- package/dist/features/cue-canvas/sidebar/puzzles/hooks/use-fetch-cue-canvas-activity.js.map +1 -0
- package/dist/features/cue-canvas/sidebar/puzzles/launch-puzzle.js +84 -0
- package/dist/features/cue-canvas/sidebar/puzzles/launch-puzzle.js.map +1 -0
- package/dist/features/cue-canvas/sidebar/puzzles/puzzle-menu-header.js +36 -0
- package/dist/features/cue-canvas/sidebar/puzzles/puzzle-menu-header.js.map +1 -0
- package/dist/features/cue-canvas/sidebar/puzzles/puzzle-menu.js +133 -0
- package/dist/features/cue-canvas/sidebar/puzzles/puzzle-menu.js.map +1 -0
- package/dist/features/cue-canvas/sidebar/puzzles/puzzles-styled.js +96 -0
- package/dist/features/cue-canvas/sidebar/puzzles/puzzles-styled.js.map +1 -0
- package/dist/features/cue-canvas/sidebar/puzzles/puzzles.js +29 -0
- package/dist/features/cue-canvas/sidebar/puzzles/puzzles.js.map +1 -0
- package/dist/features/cue-canvas/sidebar/puzzles/utils.js +120 -0
- package/dist/features/cue-canvas/sidebar/puzzles/utils.js.map +1 -0
- package/dist/features/cue-canvas/sidebar/sidebar-styled.js +32 -0
- package/dist/features/cue-canvas/sidebar/sidebar-styled.js.map +1 -0
- package/dist/features/cue-canvas/sidebar/sidebar.js +29 -0
- package/dist/features/cue-canvas/sidebar/sidebar.js.map +1 -0
- package/dist/features/cue-canvas/sidebar/tiles/tile.js +16 -0
- package/dist/features/cue-canvas/sidebar/tiles/tile.js.map +1 -0
- package/dist/features/cue-canvas/toolbar/grid-menu.js +13 -13
- package/dist/features/cue-canvas/toolbar/grid-menu.js.map +1 -1
- package/dist/features/cue-canvas/toolbar/tool.js +22 -20
- package/dist/features/cue-canvas/toolbar/tool.js.map +1 -1
- package/dist/features/homework/styles.js +5 -4
- package/dist/features/homework/styles.js.map +1 -1
- package/dist/features/hooks/use-debounce.js +16 -0
- package/dist/features/hooks/use-debounce.js.map +1 -0
- package/dist/features/milestone/create/comps/add-custom-chapter/course-catalog.js +38 -36
- package/dist/features/milestone/create/comps/add-custom-chapter/course-catalog.js.map +1 -1
- package/dist/features/milestone/create/comps/add-custom-chapter/hooks/use-catalog-helpers.js +24 -22
- package/dist/features/milestone/create/comps/add-custom-chapter/hooks/use-catalog-helpers.js.map +1 -1
- package/dist/features/milestone/create/comps/chapters-selection-step/chapter-selection-step-v2/chapter-category/chapter-category-container.js +23 -22
- package/dist/features/milestone/create/comps/chapters-selection-step/chapter-selection-step-v2/chapter-category/chapter-category-container.js.map +1 -1
- package/dist/features/milestone/create/comps/chapters-selection-step/utils.js +49 -47
- package/dist/features/milestone/create/comps/chapters-selection-step/utils.js.map +1 -1
- package/dist/features/milestone/create/comps/class-details-step/class-details-step.js +94 -87
- package/dist/features/milestone/create/comps/class-details-step/class-details-step.js.map +1 -1
- package/dist/features/milestone/create/comps/class-details-step/class-details-utils.js +13 -12
- package/dist/features/milestone/create/comps/class-details-step/class-details-utils.js.map +1 -1
- package/dist/features/milestone/create/comps/test-type-step/test-type-step.js +23 -21
- package/dist/features/milestone/create/comps/test-type-step/test-type-step.js.map +1 -1
- package/dist/features/milestone/create/milestone-create-helpers.js +165 -162
- package/dist/features/milestone/create/milestone-create-helpers.js.map +1 -1
- package/dist/features/trial-session/comps/pricing/india-pricing/index.js +96 -0
- package/dist/features/trial-session/comps/pricing/india-pricing/index.js.map +1 -0
- package/dist/features/trial-session/comps/pricing/india-pricing/india-pricing-styled.js +59 -0
- package/dist/features/trial-session/comps/pricing/india-pricing/india-pricing-styled.js.map +1 -0
- package/dist/features/trial-session/comps/pricing/pricing.js +36 -35
- package/dist/features/trial-session/comps/pricing/pricing.js.map +1 -1
- package/dist/features/ui/buttons/button/button-styled.js +29 -29
- package/dist/features/ui/buttons/button/button-styled.js.map +1 -1
- package/dist/features/ui/stepper/stepper.js +7 -7
- package/dist/features/worksheet/worksheet/hooks/use-s3-helper.js +22 -19
- package/dist/features/worksheet/worksheet/hooks/use-s3-helper.js.map +1 -1
- package/dist/index.d.ts +54 -24
- package/dist/index.js +202 -202
- package/dist/static/ellipse-clip.dfb25608.svg +1 -0
- package/package.json +1 -1
- package/dist/features/auth/account-selector/account-selector-styled.js +0 -9
- package/dist/features/auth/account-selector/account-selector-styled.js.map +0 -1
- package/dist/features/auth/comps/auth-page-layout/auth-page-layout-styled.js +0 -21
- package/dist/features/auth/comps/auth-page-layout/auth-page-layout-styled.js.map +0 -1
- package/dist/features/auth/login/login-styled.js +0 -13
- package/dist/features/auth/login/login-styled.js.map +0 -1
- package/dist/features/auth/login/social-login-methods/social-login-methods-styled.js +0 -9
- package/dist/features/auth/login/social-login-methods/social-login-methods-styled.js.map +0 -1
- package/dist/features/hooks/use-device-type.js +0 -25
- package/dist/features/hooks/use-device-type.js.map +0 -1
- package/dist/features/utils/media.js +0 -16
- package/dist/features/utils/media.js.map +0 -1
- package/dist/static/cuemath-app-qr-code.7205ee79.svg +0 -1
@@ -1,13 +1,13 @@
|
|
1
1
|
import { jsx as c } from "react/jsx-runtime";
|
2
|
-
import { memo as E, useCallback as
|
2
|
+
import { memo as E, useCallback as h, useMemo as M } from "react";
|
3
3
|
import O from "../../../../../../ui/layout/flex-view.js";
|
4
4
|
import { WARNING_MESSAGES as $ } from "../../../../../constants.js";
|
5
5
|
import { useMilestoneContext as x } from "../../../../milestone-create-context.js";
|
6
6
|
import { getSelectedGoalCategoryData as F, computeChangeDetection as R, computeChapterGoalCategoryOnGradeNBoard as T } from "../../utils.js";
|
7
|
-
import
|
7
|
+
import G from "./category-card.js";
|
8
8
|
import { CategoryContainerWrapper as b } from "./chapter-category-styled.js";
|
9
|
-
const X = E((
|
10
|
-
const { onFormDataChange:
|
9
|
+
const X = E((y) => {
|
10
|
+
const { onFormDataChange: p, config: t, formData: _, onChapterExitWarning: r, courseStream: a, enrollmentType: n } = y, { flow: i } = x(), { chapterGoalCategory: D, grade: C, board: g, testType: d, region: u, primaryChaptersList: f } = _, { primaryGoalCategory: e } = D || {}, m = h(
|
11
11
|
(o) => {
|
12
12
|
const l = F({
|
13
13
|
goalCode: o,
|
@@ -15,48 +15,49 @@ const X = E((G) => {
|
|
15
15
|
courseStream: a,
|
16
16
|
enrollmentType: n
|
17
17
|
});
|
18
|
-
|
18
|
+
p({
|
19
19
|
chapterGoalCategory: {
|
20
20
|
primaryGoalCategory: l
|
21
21
|
}
|
22
22
|
});
|
23
23
|
},
|
24
|
-
[t, a, n,
|
25
|
-
), N =
|
24
|
+
[t, a, n, p]
|
25
|
+
), N = h(
|
26
26
|
(o) => {
|
27
27
|
if (o === (e == null ? void 0 : e.goal_code)) return null;
|
28
|
-
R(
|
28
|
+
R(f, e) ? r == null || r({
|
29
29
|
description: $.GOAL_CHANGE_WARNING,
|
30
30
|
onSuccess: () => {
|
31
|
-
|
31
|
+
m(o);
|
32
32
|
}
|
33
|
-
}) :
|
33
|
+
}) : m(o);
|
34
34
|
},
|
35
|
-
[
|
35
|
+
[m, f, e, r]
|
36
36
|
), S = M(
|
37
37
|
() => T({
|
38
38
|
config: t,
|
39
|
-
testType:
|
39
|
+
testType: d,
|
40
40
|
courseStream: a,
|
41
41
|
enrollmentType: n,
|
42
|
-
grade:
|
43
|
-
board:
|
44
|
-
region:
|
42
|
+
grade: C,
|
43
|
+
board: g,
|
44
|
+
region: u,
|
45
|
+
flow: i
|
45
46
|
}),
|
46
|
-
[t,
|
47
|
+
[t, d, a, n, C, g, u, i]
|
47
48
|
);
|
48
|
-
return e ? /* @__PURE__ */ c(b, { $widthX: 12.25, children:
|
49
|
-
const { goal_name: A, goal_code:
|
49
|
+
return e ? /* @__PURE__ */ c(b, { $widthX: 12.25, children: i === "CREATE" ? S.map((o, l) => {
|
50
|
+
const { goal_name: A, goal_code: s } = o, w = s === e.goal_code;
|
50
51
|
return /* @__PURE__ */ c(
|
51
52
|
O,
|
52
53
|
{
|
53
|
-
onClick: () => N(
|
54
|
+
onClick: () => N(s),
|
54
55
|
$width: "100%",
|
55
|
-
children: /* @__PURE__ */ c(
|
56
|
+
children: /* @__PURE__ */ c(G, { selected: w, title: A })
|
56
57
|
},
|
57
|
-
`${
|
58
|
+
`${s}_${l}`
|
58
59
|
);
|
59
|
-
}) : /* @__PURE__ */ c(
|
60
|
+
}) : /* @__PURE__ */ c(G, { selected: !0, title: e.goal_name }) }) : null;
|
60
61
|
});
|
61
62
|
export {
|
62
63
|
X as default
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"chapter-category-container.js","sources":["../../../../../../../../src/features/milestone/create/comps/chapters-selection-step/chapter-selection-step-v2/chapter-category/chapter-category-container.tsx"],"sourcesContent":["import type { IChapterSelectionWrapper } from '../chapter-selection-step-types';\nimport type { FC } from 'react';\n\nimport { memo, useCallback, useMemo } from 'react';\n\nimport FlexView from '../../../../../../ui/layout/flex-view';\nimport { WARNING_MESSAGES } from '../../../../../constants';\nimport { useMilestoneContext } from '../../../../milestone-create-context';\nimport {\n computeChangeDetection,\n computeChapterGoalCategoryOnGradeNBoard,\n getSelectedGoalCategoryData,\n} from '../../utils';\nimport CategoryCard from './category-card';\nimport * as Styled from './chapter-category-styled';\n\nconst ChapterCategoryContainer: FC<IChapterSelectionWrapper> = memo(props => {\n const { onFormDataChange, config, formData, onChapterExitWarning, courseStream, enrollmentType } =\n props;\n\n const { flow } = useMilestoneContext();\n\n const { chapterGoalCategory, grade, board, testType, region, primaryChaptersList } = formData;\n const { primaryGoalCategory } = chapterGoalCategory || {};\n\n const handleOnFormDataChange = useCallback(\n (goalCode: string) => {\n const goalCategoryData = getSelectedGoalCategoryData({\n goalCode,\n config,\n courseStream,\n enrollmentType,\n });\n\n onFormDataChange({\n chapterGoalCategory: {\n primaryGoalCategory: goalCategoryData,\n },\n });\n },\n [config, courseStream, enrollmentType, onFormDataChange],\n );\n\n const handleOnGoalSelection = useCallback(\n (goalCode: string) => {\n if (goalCode === primaryGoalCategory?.goal_code) return null;\n\n const isChangeDetected = computeChangeDetection(primaryChaptersList, primaryGoalCategory);\n\n if (isChangeDetected) {\n onChapterExitWarning?.({\n description: WARNING_MESSAGES.GOAL_CHANGE_WARNING,\n onSuccess: () => {\n handleOnFormDataChange(goalCode);\n },\n });\n } else {\n handleOnFormDataChange(goalCode);\n }\n },\n [handleOnFormDataChange, primaryChaptersList, primaryGoalCategory, onChapterExitWarning],\n );\n\n const filteredGoalCurriculumMap = useMemo(\n () =>\n computeChapterGoalCategoryOnGradeNBoard({\n config,\n testType,\n courseStream,\n enrollmentType,\n grade,\n board,\n region,\n }),\n [config, testType,
|
1
|
+
{"version":3,"file":"chapter-category-container.js","sources":["../../../../../../../../src/features/milestone/create/comps/chapters-selection-step/chapter-selection-step-v2/chapter-category/chapter-category-container.tsx"],"sourcesContent":["import type { IChapterSelectionWrapper } from '../chapter-selection-step-types';\nimport type { FC } from 'react';\n\nimport { memo, useCallback, useMemo } from 'react';\n\nimport FlexView from '../../../../../../ui/layout/flex-view';\nimport { WARNING_MESSAGES } from '../../../../../constants';\nimport { useMilestoneContext } from '../../../../milestone-create-context';\nimport {\n computeChangeDetection,\n computeChapterGoalCategoryOnGradeNBoard,\n getSelectedGoalCategoryData,\n} from '../../utils';\nimport CategoryCard from './category-card';\nimport * as Styled from './chapter-category-styled';\n\nconst ChapterCategoryContainer: FC<IChapterSelectionWrapper> = memo(props => {\n const { onFormDataChange, config, formData, onChapterExitWarning, courseStream, enrollmentType } =\n props;\n\n const { flow } = useMilestoneContext();\n\n const { chapterGoalCategory, grade, board, testType, region, primaryChaptersList } = formData;\n const { primaryGoalCategory } = chapterGoalCategory || {};\n\n const handleOnFormDataChange = useCallback(\n (goalCode: string) => {\n const goalCategoryData = getSelectedGoalCategoryData({\n goalCode,\n config,\n courseStream,\n enrollmentType,\n });\n\n onFormDataChange({\n chapterGoalCategory: {\n primaryGoalCategory: goalCategoryData,\n },\n });\n },\n [config, courseStream, enrollmentType, onFormDataChange],\n );\n\n const handleOnGoalSelection = useCallback(\n (goalCode: string) => {\n if (goalCode === primaryGoalCategory?.goal_code) return null;\n\n const isChangeDetected = computeChangeDetection(primaryChaptersList, primaryGoalCategory);\n\n if (isChangeDetected) {\n onChapterExitWarning?.({\n description: WARNING_MESSAGES.GOAL_CHANGE_WARNING,\n onSuccess: () => {\n handleOnFormDataChange(goalCode);\n },\n });\n } else {\n handleOnFormDataChange(goalCode);\n }\n },\n [handleOnFormDataChange, primaryChaptersList, primaryGoalCategory, onChapterExitWarning],\n );\n\n const filteredGoalCurriculumMap = useMemo(\n () =>\n computeChapterGoalCategoryOnGradeNBoard({\n config,\n testType,\n courseStream,\n enrollmentType,\n grade,\n board,\n region,\n flow,\n }),\n [config, testType, courseStream, enrollmentType, grade, board, region, flow],\n );\n\n if (!primaryGoalCategory) return null;\n\n return (\n <Styled.CategoryContainerWrapper $widthX={12.25}>\n {flow === 'CREATE' ? (\n filteredGoalCurriculumMap.map((goalCurriculum, idx) => {\n const { goal_name: goalName, goal_code: goalCode } = goalCurriculum;\n const selected = goalCode === primaryGoalCategory.goal_code;\n\n return (\n <FlexView\n key={`${goalCode}_${idx}`}\n onClick={() => handleOnGoalSelection(goalCode)}\n $width=\"100%\"\n >\n <CategoryCard selected={selected} title={goalName} />\n </FlexView>\n );\n })\n ) : (\n <CategoryCard selected={true} title={primaryGoalCategory.goal_name} />\n )}\n </Styled.CategoryContainerWrapper>\n );\n});\n\nexport default ChapterCategoryContainer;\n"],"names":["ChapterCategoryContainer","memo","props","onFormDataChange","config","formData","onChapterExitWarning","courseStream","enrollmentType","flow","useMilestoneContext","chapterGoalCategory","grade","board","testType","region","primaryChaptersList","primaryGoalCategory","handleOnFormDataChange","useCallback","goalCode","goalCategoryData","getSelectedGoalCategoryData","handleOnGoalSelection","computeChangeDetection","WARNING_MESSAGES","filteredGoalCurriculumMap","useMemo","computeChapterGoalCategoryOnGradeNBoard","jsx","Styled.CategoryContainerWrapper","goalCurriculum","idx","goalName","selected","FlexView","CategoryCard"],"mappings":";;;;;;;;AAgBM,MAAAA,IAAyDC,EAAK,CAASC,MAAA;AAC3E,QAAM,EAAE,kBAAAC,GAAkB,QAAAC,GAAQ,UAAAC,GAAU,sBAAAC,GAAsB,cAAAC,GAAc,gBAAAC,EAC9E,IAAAN,GAEI,EAAE,MAAAO,M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,IAAI,CAACK,GAAgBC,MAAQ;AACrD,UAAM,EAAE,WAAWC,GAAU,WAAWb,MAAaW,GAC/CG,IAAWd,MAAaH,EAAoB;AAGhD,WAAA,gBAAAY;AAAA,MAACM;AAAA,MAAA;AAAA,QAEC,SAAS,MAAMZ,EAAsBH,CAAQ;AAAA,QAC7C,QAAO;AAAA,QAEP,UAAC,gBAAAS,EAAAO,GAAA,EAAa,UAAAF,GAAoB,OAAOD,GAAU;AAAA,MAAA;AAAA,MAJ9C,GAAGb,CAAQ,IAAIY,CAAG;AAAA,IAAA;AAAA,EAO5B,CAAA,IAEA,gBAAAH,EAAAO,GAAA,EAAa,UAAU,IAAM,OAAOnB,EAAoB,WAAW,EAExE,CAAA,IAtB+B;AAwBnC,CAAC;"}
|
@@ -1,20 +1,20 @@
|
|
1
1
|
import { GOAL_CATEGORY as M } from "../../../constants.js";
|
2
|
-
import { checkEnrollmentAvailable as
|
3
|
-
const
|
2
|
+
import { checkEnrollmentAvailable as h, getTestTypeBasedCategory as R } from "../test-type-step/test-type-utils.js";
|
3
|
+
const T = (e, t, o) => {
|
4
4
|
const a = e.some(
|
5
5
|
(l) => l === o
|
6
6
|
), n = t.length > 0 ? t.some(
|
7
7
|
(l) => l === o
|
8
8
|
) : !0;
|
9
9
|
return !a && n;
|
10
|
-
},
|
10
|
+
}, N = ({
|
11
11
|
goalCode: e,
|
12
12
|
config: t,
|
13
13
|
courseStream: o,
|
14
14
|
enrollmentType: a
|
15
15
|
}) => {
|
16
16
|
const { goal_curriculum_map: n } = t;
|
17
|
-
return n.find((r) => r.goal_code !== e || r.course_stream !== o ? !1 :
|
17
|
+
return n.find((r) => r.goal_code !== e || r.course_stream !== o ? !1 : h(r, a));
|
18
18
|
}, B = ({
|
19
19
|
goalCurriculumStandard: e,
|
20
20
|
referenceStandard: t
|
@@ -25,28 +25,30 @@ const h = (e, t, o) => {
|
|
25
25
|
enrollmentType: a,
|
26
26
|
grade: n,
|
27
27
|
board: l,
|
28
|
-
region: r
|
28
|
+
region: r,
|
29
|
+
flow: _
|
29
30
|
}) => {
|
30
|
-
const { goal_curriculum_map:
|
31
|
-
return
|
31
|
+
const { goal_curriculum_map: u } = e, c = R(t);
|
32
|
+
return u.filter((C) => {
|
32
33
|
const {
|
33
|
-
available_grades:
|
34
|
-
available_countries:
|
35
|
-
goal_curriculum_standard:
|
36
|
-
goal_category:
|
37
|
-
blocked_enrollment_types:
|
38
|
-
available_enrollment_types:
|
39
|
-
|
40
|
-
|
34
|
+
available_grades: d,
|
35
|
+
available_countries: g,
|
36
|
+
goal_curriculum_standard: b,
|
37
|
+
goal_category: f,
|
38
|
+
blocked_enrollment_types: v,
|
39
|
+
available_enrollment_types: s,
|
40
|
+
is_live: i
|
41
|
+
} = C, A = _ === "CREATE" ? i : !0, p = d.some((m) => m === n), E = g.some((m) => m === r), k = B({
|
42
|
+
goalCurriculumStandard: b,
|
41
43
|
referenceStandard: l
|
42
|
-
}),
|
43
|
-
|
44
|
-
|
44
|
+
}), S = f === c, y = C.course_stream === o, G = T(
|
45
|
+
v,
|
46
|
+
s,
|
45
47
|
a
|
46
48
|
);
|
47
|
-
return c === M.SCHOOL_SUCCESS ?
|
49
|
+
return c === M.SCHOOL_SUCCESS ? A && G && y && p && k && S : A && G && y && p && S && (g.length > 0 ? E : !0);
|
48
50
|
});
|
49
|
-
},
|
51
|
+
}, O = (e, t, o) => {
|
50
52
|
if (!e)
|
51
53
|
return {
|
52
54
|
customChaptersList: [],
|
@@ -73,51 +75,51 @@ const h = (e, t, o) => {
|
|
73
75
|
majorsPresent: n,
|
74
76
|
countryCode: l,
|
75
77
|
selectedCategory: r,
|
76
|
-
courseStream:
|
77
|
-
enrollmentType:
|
78
|
+
courseStream: _,
|
79
|
+
enrollmentType: u
|
78
80
|
}) => {
|
79
|
-
const { goal_curriculum_map:
|
80
|
-
return
|
81
|
+
const { goal_curriculum_map: c } = e;
|
82
|
+
return c.find((d) => {
|
81
83
|
const {
|
82
|
-
goal_curriculum_standard:
|
84
|
+
goal_curriculum_standard: g,
|
83
85
|
available_grades: b,
|
84
|
-
program_code:
|
85
|
-
available_countries:
|
86
|
+
program_code: f,
|
87
|
+
available_countries: v,
|
86
88
|
goal_category: s,
|
87
89
|
available_enrollment_types: i,
|
88
90
|
blocked_enrollment_types: A
|
89
91
|
} = d;
|
90
92
|
if (s !== r) return;
|
91
|
-
const p =
|
93
|
+
const p = T(
|
92
94
|
A,
|
93
95
|
i,
|
94
|
-
|
95
|
-
),
|
96
|
-
goalCurriculumStandard:
|
96
|
+
u
|
97
|
+
), E = b.some((m) => m === t), k = v.length > 0 ? v.some((m) => m === l) : !0, S = B({
|
98
|
+
goalCurriculumStandard: g,
|
97
99
|
referenceStandard: o
|
98
|
-
}),
|
99
|
-
return n ? a ? p &&
|
100
|
+
}), y = a === f, G = d.course_stream === _;
|
101
|
+
return n ? a ? p && G && k && E && S && y : void 0 : p && G && k && E && S;
|
100
102
|
});
|
101
103
|
}, D = (e, t, o, a, n, l) => {
|
102
104
|
if (!n && !o) return {};
|
103
|
-
const { country_code_to_name_map: r, goal_curriculum_map:
|
104
|
-
let
|
105
|
-
return
|
105
|
+
const { country_code_to_name_map: r, goal_curriculum_map: _ } = t;
|
106
|
+
let u = {};
|
107
|
+
return _.filter((c) => c.course_stream !== e ? !1 : h(c, a)).forEach((c) => {
|
106
108
|
const {
|
107
|
-
available_grades:
|
109
|
+
available_grades: C,
|
108
110
|
available_countries: d,
|
109
|
-
blocked_countries:
|
111
|
+
blocked_countries: g,
|
110
112
|
goal_category: b
|
111
|
-
} =
|
112
|
-
!
|
113
|
+
} = c, f = C.some((s) => s === n);
|
114
|
+
!g.some(
|
113
115
|
(s) => s === l
|
114
|
-
) &&
|
116
|
+
) && f && b === o && (d.length > 0 ? d.reduce((s, i) => (s[i] || (s[i] = r[i] ?? ""), s), u) : u = {
|
115
117
|
...r,
|
116
|
-
...
|
118
|
+
...u
|
117
119
|
});
|
118
|
-
}),
|
120
|
+
}), u;
|
119
121
|
}, H = (e, t) => {
|
120
|
-
const { recommendedChaptersList: o, customChaptersList: a } =
|
122
|
+
const { recommendedChaptersList: o, customChaptersList: a } = O(
|
121
123
|
e,
|
122
124
|
t,
|
123
125
|
!0
|
@@ -127,11 +129,11 @@ const h = (e, t, o) => {
|
|
127
129
|
export {
|
128
130
|
H as computeChangeDetection,
|
129
131
|
j as computeChapterGoalCategoryOnGradeNBoard,
|
130
|
-
|
132
|
+
O as computeRecommendedNCustomChapters,
|
131
133
|
D as getCountriesWhereCurrentGradeNCategoryIsAvailable,
|
132
134
|
x as getGradeBoardAndMajorBasedProgramCode,
|
133
135
|
B as getIfGoalCurriculumStandardIsAccessible,
|
134
|
-
|
135
|
-
|
136
|
+
N as getSelectedGoalCategoryData,
|
137
|
+
T as getStudentEnrollmentSupported
|
136
138
|
};
|
137
139
|
//# sourceMappingURL=utils.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"utils.js","sources":["../../../../../../src/features/milestone/create/comps/chapters-selection-step/utils.ts"],"sourcesContent":["import type { TTestType } from '../../../types';\nimport type {\n IGoalCurriculumMap,\n IMilestoneConfig,\n TCourseStream,\n TEnrollmentTypes,\n TGoalCategory,\n} from '../../milestone-create-types';\nimport type { IChapter } from '../chapter-item/chapter-item-types';\nimport type { TGradeBasedBoardInfo } from './types';\n\nimport { GOAL_CATEGORY } from '../../../constants';\nimport {\n getTestTypeBasedCategory,\n checkEnrollmentAvailable,\n} from '../test-type-step/test-type-utils';\n\nconst getStudentEnrollmentSupported = (\n blockedEnrollmentTypes: TEnrollmentTypes[],\n availableEnrollmentTypes: TEnrollmentTypes[],\n enrollmentType: TEnrollmentTypes,\n) => {\n const isBlocked = blockedEnrollmentTypes.some(\n blockedEnrollment => blockedEnrollment === enrollmentType,\n );\n\n const isAvailable =\n availableEnrollmentTypes.length > 0\n ? availableEnrollmentTypes.some(\n availableEnrollmentType => availableEnrollmentType === enrollmentType,\n )\n : true;\n\n return !isBlocked && isAvailable;\n};\n\ninterface IgetSelectedGoalCategoryData {\n goalCode: string;\n config: IMilestoneConfig;\n courseStream: TCourseStream;\n enrollmentType: TEnrollmentTypes;\n}\n\nconst getSelectedGoalCategoryData = ({\n goalCode,\n config,\n courseStream,\n enrollmentType,\n}: IgetSelectedGoalCategoryData) => {\n const { goal_curriculum_map: goalCurriculumMap } = config;\n\n const selectedGoalCategoryInfo = goalCurriculumMap.find(goalInfo => {\n if (goalInfo.goal_code !== goalCode) return false;\n\n if (goalInfo.course_stream !== courseStream) return false;\n\n return checkEnrollmentAvailable(goalInfo, enrollmentType);\n });\n\n return selectedGoalCategoryInfo;\n};\n\nconst getIfGoalCurriculumStandardIsAccessible = ({\n goalCurriculumStandard,\n referenceStandard,\n}: {\n goalCurriculumStandard?: string;\n referenceStandard?: string;\n}) => {\n if (!goalCurriculumStandard) return true;\n\n return goalCurriculumStandard === referenceStandard;\n};\n\ninterface IcomputeChapterGoalCategoryOnGradeNBoard {\n config: IMilestoneConfig;\n testType: TTestType;\n courseStream: TCourseStream;\n enrollmentType: TEnrollmentTypes;\n grade?: string;\n board?: string;\n region?: string;\n}\n\nconst computeChapterGoalCategoryOnGradeNBoard = ({\n config,\n testType,\n courseStream,\n enrollmentType,\n grade,\n board,\n region,\n}: IcomputeChapterGoalCategoryOnGradeNBoard) => {\n const { goal_curriculum_map: goalCurriculumMap } = config;\n const selectedGoalCategory = getTestTypeBasedCategory(testType);\n\n return goalCurriculumMap.filter(goalInfo => {\n const {\n available_grades: availableGrades,\n available_countries: availableCountries,\n goal_curriculum_standard: goalCurriculumStandard,\n goal_category: goalCategory,\n blocked_enrollment_types: blockedEnrollmentTypes,\n available_enrollment_types: availableEnrollmentTypes,\n } = goalInfo;\n const gradePresent = availableGrades.some(gradeInfo => gradeInfo === grade);\n const regionPresent = availableCountries.some(country => country === region);\n const boardPreset = getIfGoalCurriculumStandardIsAccessible({\n goalCurriculumStandard,\n referenceStandard: board,\n });\n const selectedCategoryIsPresent = goalCategory === selectedGoalCategory;\n const isSameCourse = goalInfo.course_stream === courseStream;\n const isStudentEnrollmentTypeSupported = getStudentEnrollmentSupported(\n blockedEnrollmentTypes,\n availableEnrollmentTypes,\n enrollmentType,\n );\n\n if (selectedGoalCategory === GOAL_CATEGORY.SCHOOL_SUCCESS) {\n return (\n isStudentEnrollmentTypeSupported &&\n isSameCourse &&\n gradePresent &&\n boardPreset &&\n selectedCategoryIsPresent\n );\n }\n\n return (\n isStudentEnrollmentTypeSupported &&\n isSameCourse &&\n gradePresent &&\n selectedCategoryIsPresent &&\n (availableCountries.length > 0 ? regionPresent : true)\n );\n });\n};\n\nconst computeRecommendedNCustomChapters = (\n primaryChaptersList?: IChapter[],\n primaryGoalCategory?: IGoalCurriculumMap,\n isGoalCreation?: boolean,\n) => {\n if (!primaryChaptersList) {\n return {\n customChaptersList: [],\n recommendedChaptersList: [],\n };\n }\n\n //* To compensate old milestone flow during edit stage.\n if (!isGoalCreation) {\n return {\n customChaptersList: primaryChaptersList.filter(chapter => chapter.search_and_added),\n recommendedChaptersList: primaryChaptersList.filter(chapter => !chapter.search_and_added),\n };\n }\n\n const { program_id: programId } = primaryGoalCategory || {};\n\n const customChaptersList = primaryChaptersList?.filter(\n chapter => chapter.program_id !== programId,\n );\n const recommendedChaptersList = primaryChaptersList?.filter(\n chapter => chapter.program_id === programId,\n );\n\n return {\n customChaptersList,\n recommendedChaptersList,\n };\n};\n\ninterface IGetGradeBoardAndMajorBasedProgramCode {\n (\n config: IMilestoneConfig,\n props: {\n grade: string;\n board: string;\n major: string;\n countryCode: string;\n majorsPresent: boolean;\n selectedCategory: TGoalCategory;\n courseStream: TCourseStream;\n enrollmentType: TEnrollmentTypes;\n },\n ): IGoalCurriculumMap | undefined;\n}\n\nconst getGradeBoardAndMajorBasedProgramCode: IGetGradeBoardAndMajorBasedProgramCode = (\n config,\n {\n grade,\n board,\n major,\n majorsPresent,\n countryCode,\n selectedCategory,\n courseStream,\n enrollmentType,\n },\n) => {\n const { goal_curriculum_map: goalCurriculumMap } = config;\n\n const programInfo = goalCurriculumMap.find(goalData => {\n const {\n goal_curriculum_standard: goalCurriculumStandard,\n available_grades: availableGrades,\n program_code: programCode,\n available_countries: availableCountries,\n goal_category: goalCategory,\n available_enrollment_types: availableEnrollmentTypes,\n blocked_enrollment_types: blockedEnrollmentTypes,\n } = goalData;\n\n if (goalCategory !== selectedCategory) return undefined;\n\n const isStudentEnrollmentTypeSupported = getStudentEnrollmentSupported(\n blockedEnrollmentTypes,\n availableEnrollmentTypes,\n enrollmentType,\n );\n\n const isGradeAvailable = availableGrades.some(availableGrade => availableGrade === grade);\n const isRegionAvailable =\n availableCountries.length > 0\n ? availableCountries.some(country => country === countryCode)\n : true;\n const isBoardAvailable = getIfGoalCurriculumStandardIsAccessible({\n goalCurriculumStandard,\n referenceStandard: board,\n });\n const isMajorAvailable = major === programCode;\n const isSameCourse = goalData.course_stream === courseStream;\n\n if (majorsPresent) {\n if (major)\n return (\n isStudentEnrollmentTypeSupported &&\n isSameCourse &&\n isRegionAvailable &&\n isGradeAvailable &&\n isBoardAvailable &&\n isMajorAvailable\n );\n\n return undefined;\n }\n\n return (\n isStudentEnrollmentTypeSupported &&\n isSameCourse &&\n isRegionAvailable &&\n isGradeAvailable &&\n isBoardAvailable\n );\n });\n\n return programInfo;\n};\n\nconst getProgramCodeBasedOnGradeAndBoard = (\n gradeBasedBoardInfo: TGradeBasedBoardInfo,\n grade: string,\n board: string,\n course?: string,\n) => {\n const { gradeSyllabusMap } = gradeBasedBoardInfo[board] || {};\n\n if (gradeSyllabusMap) {\n const programInfo = gradeSyllabusMap[grade];\n\n if (programInfo) {\n if (programInfo.majors) {\n return course;\n }\n\n return programInfo.program_code;\n }\n }\n\n return undefined;\n};\n\nconst getCountriesWhereCurrentGradeNCategoryIsAvailable = (\n courseStream: TCourseStream,\n config: IMilestoneConfig,\n selectedGoalCategory: string | undefined,\n enrollmentType: TEnrollmentTypes,\n grade?: string,\n currentCountryCode?: string,\n) => {\n if (!grade && !selectedGoalCategory) return {};\n\n const { country_code_to_name_map: countryCodeToNameMap, goal_curriculum_map: goalCurriculumMap } =\n config;\n let countries: Record<string, string> = {};\n\n goalCurriculumMap\n .filter(goalInfo => {\n if (goalInfo.course_stream !== courseStream) return false;\n\n return checkEnrollmentAvailable(goalInfo, enrollmentType);\n })\n .forEach(goalData => {\n const {\n available_grades: availableGrades,\n available_countries: availableCountries,\n blocked_countries: blockedCountries,\n goal_category: goalCategory,\n } = goalData;\n const isGradeAvailable = availableGrades.some(availableGrade => availableGrade === grade);\n const isStudentRegionBlocked = blockedCountries.some(\n country => country === currentCountryCode,\n );\n\n if (!isStudentRegionBlocked && isGradeAvailable && goalCategory === selectedGoalCategory) {\n if (availableCountries.length > 0) {\n availableCountries.reduce((acc, countryInfo) => {\n if (!acc[countryInfo]) {\n acc[countryInfo] = countryCodeToNameMap[countryInfo] ?? '';\n }\n\n return acc;\n }, countries);\n } else {\n countries = {\n ...countryCodeToNameMap,\n ...countries,\n };\n }\n }\n });\n\n return countries;\n};\n\nconst computeChangeDetection = (\n primaryProgramList?: IChapter[],\n primaryGoalCategory?: IGoalCurriculumMap,\n) => {\n const { recommendedChaptersList, customChaptersList } = computeRecommendedNCustomChapters(\n primaryProgramList,\n primaryGoalCategory,\n true,\n );\n\n //* This will compensate if any new chapter was added.\n if (customChaptersList.length > 0) return true;\n\n //* This will compensate if any chapter was deselected.\n return recommendedChaptersList.some(chapter => !chapter.added);\n};\n\nexport {\n getSelectedGoalCategoryData,\n computeChapterGoalCategoryOnGradeNBoard,\n computeRecommendedNCustomChapters,\n getGradeBoardAndMajorBasedProgramCode,\n getProgramCodeBasedOnGradeAndBoard,\n getCountriesWhereCurrentGradeNCategoryIsAvailable,\n computeChangeDetection,\n getIfGoalCurriculumStandardIsAccessible,\n getStudentEnrollmentSupported,\n};\n"],"names":["getStudentEnrollmentSupported","blockedEnrollmentTypes","availableEnrollmentTypes","enrollmentType","isBlocked","blockedEnrollment","isAvailable","availableEnrollmentType","getSelectedGoalCategoryData","goalCode","config","courseStream","goalCurriculumMap","goalInfo","checkEnrollmentAvailable","getIfGoalCurriculumStandardIsAccessible","goalCurriculumStandard","referenceStandard","computeChapterGoalCategoryOnGradeNBoard","testType","grade","board","region","selectedGoalCategory","getTestTypeBasedCategory","availableGrades","availableCountries","goalCategory","gradePresent","gradeInfo","regionPresent","country","boardPreset","selectedCategoryIsPresent","isSameCourse","isStudentEnrollmentTypeSupported","GOAL_CATEGORY","computeRecommendedNCustomChapters","primaryChaptersList","primaryGoalCategory","isGoalCreation","chapter","programId","customChaptersList","recommendedChaptersList","getGradeBoardAndMajorBasedProgramCode","major","majorsPresent","countryCode","selectedCategory","goalData","programCode","isGradeAvailable","availableGrade","isRegionAvailable","isBoardAvailable","isMajorAvailable","getCountriesWhereCurrentGradeNCategoryIsAvailable","currentCountryCode","countryCodeToNameMap","countries","blockedCountries","acc","countryInfo","computeChangeDetection","primaryProgramList"],"mappings":";;AAiBA,MAAMA,IAAgC,CACpCC,GACAC,GACAC,MACG;AACH,QAAMC,IAAYH,EAAuB;AAAA,IACvC,OAAqBI,MAAsBF;AAAA,EAAA,GAGvCG,IACJJ,EAAyB,SAAS,IAC9BA,EAAyB;AAAA,IACvB,OAA2BK,MAA4BJ;AAAA,EAEzD,IAAA;AAEN,SAAO,CAACC,KAAaE;AACvB,GASME,IAA8B,CAAC;AAAA,EACnC,UAAAC;AAAA,EACA,QAAAC;AAAA,EACA,cAAAC;AAAA,EACA,gBAAAR;AACF,MAAoC;AAC5B,QAAA,EAAE,qBAAqBS,EAAsB,IAAAF;AAU5C,SAR0BE,EAAkB,KAAK,CAAYC,MAC9DA,EAAS,cAAcJ,KAEvBI,EAAS,kBAAkBF,IAAqB,KAE7CG,EAAyBD,GAAUV,CAAc,CACzD;AAGH,GAEMY,IAA0C,CAAC;AAAA,EAC/C,wBAAAC;AAAA,EACA,mBAAAC;AACF,MAIOD,IAEEA,MAA2BC,IAFE,IAehCC,IAA0C,CAAC;AAAA,EAC/C,Q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,GACAD,GACAa,GACApB,GACAiB,GACAsC,MACG;AACH,MAAI,CAACtC,KAAS,CAACG,UAA6B,CAAA;AAE5C,QAAM,EAAE,0BAA0BoC,GAAsB,qBAAqB/C,MAC3EF;AACF,MAAIkD,IAAoC,CAAA;AAExC,SAAAhD,EACG,OAAO,CAAYC,MACdA,EAAS,kBAAkBF,IAAqB,KAE7CG,EAAyBD,GAAUV,CAAc,CACzD,EACA,QAAQ,CAAY+C,MAAA;AACb,UAAA;AAAA,MACJ,kBAAkBzB;AAAA,MAClB,qBAAqBC;AAAA,MACrB,mBAAmBmC;AAAA,MACnB,eAAelC;AAAA,IACb,IAAAuB,GACEE,IAAmB3B,EAAgB,KAAK,CAAA4B,MAAkBA,MAAmBjC,CAAK;AAKxF,IAAI,CAJ2ByC,EAAiB;AAAA,MAC9C,OAAW9B,MAAY2B;AAAA,IAAA,KAGMN,KAAoBzB,MAAiBJ,MAC9DG,EAAmB,SAAS,IACXA,EAAA,OAAO,CAACoC,GAAKC,OACzBD,EAAIC,CAAW,MAClBD,EAAIC,CAAW,IAAIJ,EAAqBI,CAAW,KAAK,KAGnDD,IACNF,CAAS,IAEAA,IAAA;AAAA,MACV,GAAGD;AAAA,MACH,GAAGC;AAAA,IAAA;AAAA,EAGT,CACD,GAEIA;AACT,GAEMI,IAAyB,CAC7BC,GACA1B,MACG;AACG,QAAA,EAAE,yBAAAK,GAAyB,oBAAAD,EAAA,IAAuBN;AAAA,IACtD4B;AAAA,IACA1B;AAAA,IACA;AAAA,EAAA;AAIE,SAAAI,EAAmB,SAAS,IAAU,KAGnCC,EAAwB,KAAK,CAAWH,MAAA,CAACA,EAAQ,KAAK;AAC/D;"}
|
1
|
+
{"version":3,"file":"utils.js","sources":["../../../../../../src/features/milestone/create/comps/chapters-selection-step/utils.ts"],"sourcesContent":["import type { TTestType } from '../../../types';\nimport type {\n IGoalCurriculumMap,\n IMilestoneConfig,\n TCourseStream,\n TEnrollmentTypes,\n TGoalCategory,\n TMilestoneFormFlow,\n} from '../../milestone-create-types';\nimport type { IChapter } from '../chapter-item/chapter-item-types';\nimport type { TGradeBasedBoardInfo } from './types';\n\nimport { GOAL_CATEGORY } from '../../../constants';\nimport {\n getTestTypeBasedCategory,\n checkEnrollmentAvailable,\n} from '../test-type-step/test-type-utils';\n\nconst getStudentEnrollmentSupported = (\n blockedEnrollmentTypes: TEnrollmentTypes[],\n availableEnrollmentTypes: TEnrollmentTypes[],\n enrollmentType: TEnrollmentTypes,\n) => {\n const isBlocked = blockedEnrollmentTypes.some(\n blockedEnrollment => blockedEnrollment === enrollmentType,\n );\n\n const isAvailable =\n availableEnrollmentTypes.length > 0\n ? availableEnrollmentTypes.some(\n availableEnrollmentType => availableEnrollmentType === enrollmentType,\n )\n : true;\n\n return !isBlocked && isAvailable;\n};\n\ninterface IgetSelectedGoalCategoryData {\n goalCode: string;\n config: IMilestoneConfig;\n courseStream: TCourseStream;\n enrollmentType: TEnrollmentTypes;\n}\n\nconst getSelectedGoalCategoryData = ({\n goalCode,\n config,\n courseStream,\n enrollmentType,\n}: IgetSelectedGoalCategoryData) => {\n const { goal_curriculum_map: goalCurriculumMap } = config;\n\n const selectedGoalCategoryInfo = goalCurriculumMap.find(goalInfo => {\n if (goalInfo.goal_code !== goalCode) return false;\n\n if (goalInfo.course_stream !== courseStream) return false;\n\n return checkEnrollmentAvailable(goalInfo, enrollmentType);\n });\n\n return selectedGoalCategoryInfo;\n};\n\nconst getIfGoalCurriculumStandardIsAccessible = ({\n goalCurriculumStandard,\n referenceStandard,\n}: {\n goalCurriculumStandard?: string;\n referenceStandard?: string;\n}) => {\n if (!goalCurriculumStandard) return true;\n\n return goalCurriculumStandard === referenceStandard;\n};\n\ninterface IcomputeChapterGoalCategoryOnGradeNBoard {\n config: IMilestoneConfig;\n testType: TTestType;\n courseStream: TCourseStream;\n enrollmentType: TEnrollmentTypes;\n grade?: string;\n board?: string;\n region?: string;\n flow?: TMilestoneFormFlow | null;\n}\n\nconst computeChapterGoalCategoryOnGradeNBoard = ({\n config,\n testType,\n courseStream,\n enrollmentType,\n grade,\n board,\n region,\n flow,\n}: IcomputeChapterGoalCategoryOnGradeNBoard) => {\n const { goal_curriculum_map: goalCurriculumMap } = config;\n const selectedGoalCategory = getTestTypeBasedCategory(testType);\n\n return goalCurriculumMap.filter(goalInfo => {\n const {\n available_grades: availableGrades,\n available_countries: availableCountries,\n goal_curriculum_standard: goalCurriculumStandard,\n goal_category: goalCategory,\n blocked_enrollment_types: blockedEnrollmentTypes,\n available_enrollment_types: availableEnrollmentTypes,\n is_live: isLive,\n } = goalInfo;\n const canIncludeGoal = flow === 'CREATE' ? isLive : true;\n const gradePresent = availableGrades.some(gradeInfo => gradeInfo === grade);\n const regionPresent = availableCountries.some(country => country === region);\n const boardPreset = getIfGoalCurriculumStandardIsAccessible({\n goalCurriculumStandard,\n referenceStandard: board,\n });\n const selectedCategoryIsPresent = goalCategory === selectedGoalCategory;\n const isSameCourse = goalInfo.course_stream === courseStream;\n const isStudentEnrollmentTypeSupported = getStudentEnrollmentSupported(\n blockedEnrollmentTypes,\n availableEnrollmentTypes,\n enrollmentType,\n );\n\n if (selectedGoalCategory === GOAL_CATEGORY.SCHOOL_SUCCESS) {\n return (\n canIncludeGoal &&\n isStudentEnrollmentTypeSupported &&\n isSameCourse &&\n gradePresent &&\n boardPreset &&\n selectedCategoryIsPresent\n );\n }\n\n return (\n canIncludeGoal &&\n isStudentEnrollmentTypeSupported &&\n isSameCourse &&\n gradePresent &&\n selectedCategoryIsPresent &&\n (availableCountries.length > 0 ? regionPresent : true)\n );\n });\n};\n\nconst computeRecommendedNCustomChapters = (\n primaryChaptersList?: IChapter[],\n primaryGoalCategory?: IGoalCurriculumMap,\n isGoalCreation?: boolean,\n) => {\n if (!primaryChaptersList) {\n return {\n customChaptersList: [],\n recommendedChaptersList: [],\n };\n }\n\n //* To compensate old milestone flow during edit stage.\n if (!isGoalCreation) {\n return {\n customChaptersList: primaryChaptersList.filter(chapter => chapter.search_and_added),\n recommendedChaptersList: primaryChaptersList.filter(chapter => !chapter.search_and_added),\n };\n }\n\n const { program_id: programId } = primaryGoalCategory || {};\n\n const customChaptersList = primaryChaptersList?.filter(\n chapter => chapter.program_id !== programId,\n );\n const recommendedChaptersList = primaryChaptersList?.filter(\n chapter => chapter.program_id === programId,\n );\n\n return {\n customChaptersList,\n recommendedChaptersList,\n };\n};\n\ninterface IGetGradeBoardAndMajorBasedProgramCode {\n (\n config: IMilestoneConfig,\n props: {\n grade: string;\n board: string;\n major: string;\n countryCode: string;\n majorsPresent: boolean;\n selectedCategory: TGoalCategory;\n courseStream: TCourseStream;\n enrollmentType: TEnrollmentTypes;\n },\n ): IGoalCurriculumMap | undefined;\n}\n\nconst getGradeBoardAndMajorBasedProgramCode: IGetGradeBoardAndMajorBasedProgramCode = (\n config,\n {\n grade,\n board,\n major,\n majorsPresent,\n countryCode,\n selectedCategory,\n courseStream,\n enrollmentType,\n },\n) => {\n const { goal_curriculum_map: goalCurriculumMap } = config;\n\n const programInfo = goalCurriculumMap.find(goalData => {\n const {\n goal_curriculum_standard: goalCurriculumStandard,\n available_grades: availableGrades,\n program_code: programCode,\n available_countries: availableCountries,\n goal_category: goalCategory,\n available_enrollment_types: availableEnrollmentTypes,\n blocked_enrollment_types: blockedEnrollmentTypes,\n } = goalData;\n\n if (goalCategory !== selectedCategory) return undefined;\n\n const isStudentEnrollmentTypeSupported = getStudentEnrollmentSupported(\n blockedEnrollmentTypes,\n availableEnrollmentTypes,\n enrollmentType,\n );\n\n const isGradeAvailable = availableGrades.some(availableGrade => availableGrade === grade);\n const isRegionAvailable =\n availableCountries.length > 0\n ? availableCountries.some(country => country === countryCode)\n : true;\n const isBoardAvailable = getIfGoalCurriculumStandardIsAccessible({\n goalCurriculumStandard,\n referenceStandard: board,\n });\n const isMajorAvailable = major === programCode;\n const isSameCourse = goalData.course_stream === courseStream;\n\n if (majorsPresent) {\n if (major)\n return (\n isStudentEnrollmentTypeSupported &&\n isSameCourse &&\n isRegionAvailable &&\n isGradeAvailable &&\n isBoardAvailable &&\n isMajorAvailable\n );\n\n return undefined;\n }\n\n return (\n isStudentEnrollmentTypeSupported &&\n isSameCourse &&\n isRegionAvailable &&\n isGradeAvailable &&\n isBoardAvailable\n );\n });\n\n return programInfo;\n};\n\nconst getProgramCodeBasedOnGradeAndBoard = (\n gradeBasedBoardInfo: TGradeBasedBoardInfo,\n grade: string,\n board: string,\n course?: string,\n) => {\n const { gradeSyllabusMap } = gradeBasedBoardInfo[board] || {};\n\n if (gradeSyllabusMap) {\n const programInfo = gradeSyllabusMap[grade];\n\n if (programInfo) {\n if (programInfo.majors) {\n return course;\n }\n\n return programInfo.program_code;\n }\n }\n\n return undefined;\n};\n\nconst getCountriesWhereCurrentGradeNCategoryIsAvailable = (\n courseStream: TCourseStream,\n config: IMilestoneConfig,\n selectedGoalCategory: string | undefined,\n enrollmentType: TEnrollmentTypes,\n grade?: string,\n currentCountryCode?: string,\n) => {\n if (!grade && !selectedGoalCategory) return {};\n\n const { country_code_to_name_map: countryCodeToNameMap, goal_curriculum_map: goalCurriculumMap } =\n config;\n let countries: Record<string, string> = {};\n\n goalCurriculumMap\n .filter(goalInfo => {\n if (goalInfo.course_stream !== courseStream) return false;\n\n return checkEnrollmentAvailable(goalInfo, enrollmentType);\n })\n .forEach(goalData => {\n const {\n available_grades: availableGrades,\n available_countries: availableCountries,\n blocked_countries: blockedCountries,\n goal_category: goalCategory,\n } = goalData;\n const isGradeAvailable = availableGrades.some(availableGrade => availableGrade === grade);\n const isStudentRegionBlocked = blockedCountries.some(\n country => country === currentCountryCode,\n );\n\n if (!isStudentRegionBlocked && isGradeAvailable && goalCategory === selectedGoalCategory) {\n if (availableCountries.length > 0) {\n availableCountries.reduce((acc, countryInfo) => {\n if (!acc[countryInfo]) {\n acc[countryInfo] = countryCodeToNameMap[countryInfo] ?? '';\n }\n\n return acc;\n }, countries);\n } else {\n countries = {\n ...countryCodeToNameMap,\n ...countries,\n };\n }\n }\n });\n\n return countries;\n};\n\nconst computeChangeDetection = (\n primaryProgramList?: IChapter[],\n primaryGoalCategory?: IGoalCurriculumMap,\n) => {\n const { recommendedChaptersList, customChaptersList } = computeRecommendedNCustomChapters(\n primaryProgramList,\n primaryGoalCategory,\n true,\n );\n\n //* This will compensate if any new chapter was added.\n if (customChaptersList.length > 0) return true;\n\n //* This will compensate if any chapter was deselected.\n return recommendedChaptersList.some(chapter => !chapter.added);\n};\n\nexport {\n getSelectedGoalCategoryData,\n computeChapterGoalCategoryOnGradeNBoard,\n computeRecommendedNCustomChapters,\n getGradeBoardAndMajorBasedProgramCode,\n getProgramCodeBasedOnGradeAndBoard,\n getCountriesWhereCurrentGradeNCategoryIsAvailable,\n computeChangeDetection,\n getIfGoalCurriculumStandardIsAccessible,\n getStudentEnrollmentSupported,\n};\n"],"names":["getStudentEnrollmentSupported","blockedEnrollmentTypes","availableEnrollmentTypes","enrollmentType","isBlocked","blockedEnrollment","isAvailable","availableEnrollmentType","getSelectedGoalCategoryData","goalCode","config","courseStream","goalCurriculumMap","goalInfo","checkEnrollmentAvailable","getIfGoalCurriculumStandardIsAccessible","goalCurriculumStandard","referenceStandard","computeChapterGoalCategoryOnGradeNBoard","testType","grade","board","region","flow","selectedGoalCategory","getTestTypeBasedCategory","availableGrades","availableCountries","goalCategory","isLive","canIncludeGoal","gradePresent","gradeInfo","regionPresent","country","boardPreset","selectedCategoryIsPresent","isSameCourse","isStudentEnrollmentTypeSupported","GOAL_CATEGORY","computeRecommendedNCustomChapters","primaryChaptersList","primaryGoalCategory","isGoalCreation","chapter","programId","customChaptersList","recommendedChaptersList","getGradeBoardAndMajorBasedProgramCode","major","majorsPresent","countryCode","selectedCategory","goalData","programCode","isGradeAvailable","availableGrade","isRegionAvailable","isBoardAvailable","isMajorAvailable","getCountriesWhereCurrentGradeNCategoryIsAvailable","currentCountryCode","countryCodeToNameMap","countries","blockedCountries","acc","countryInfo","computeChangeDetection","primaryProgramList"],"mappings":";;AAkBA,MAAMA,IAAgC,C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,OAAW9B,MAAY2B;AAAA,IAAA,KAGMN,KAAoB3B,MAAiBJ,MAC9DG,EAAmB,SAAS,IACXA,EAAA,OAAO,CAACsC,GAAKC,OACzBD,EAAIC,CAAW,MAClBD,EAAIC,CAAW,IAAIJ,EAAqBI,CAAW,KAAK,KAGnDD,IACNF,CAAS,IAEAA,IAAA;AAAA,MACV,GAAGD;AAAA,MACH,GAAGC;AAAA,IAAA;AAAA,EAGT,CACD,GAEIA;AACT,GAEMI,IAAyB,CAC7BC,GACA1B,MACG;AACG,QAAA,EAAE,yBAAAK,GAAyB,oBAAAD,EAAA,IAAuBN;AAAA,IACtD4B;AAAA,IACA1B;AAAA,IACA;AAAA,EAAA;AAIE,SAAAI,EAAmB,SAAS,IAAU,KAGnCC,EAAwB,KAAK,CAAWH,MAAA,CAACA,EAAQ,KAAK;AAC/D;"}
|
@@ -1,140 +1,147 @@
|
|
1
|
-
import { jsx as
|
2
|
-
import { memo as
|
3
|
-
import { convertToTitleCase as
|
4
|
-
import { useUIContext as
|
5
|
-
import { WARNING_MESSAGES as
|
6
|
-
import
|
7
|
-
import {
|
8
|
-
import {
|
9
|
-
import
|
10
|
-
import
|
11
|
-
|
1
|
+
import { jsx as X } from "react/jsx-runtime";
|
2
|
+
import { memo as Y, useContext as Z, useMemo as C, useCallback as i } from "react";
|
3
|
+
import { convertToTitleCase as M } from "../../../../../helpers/label-text.js";
|
4
|
+
import { useUIContext as $ } from "../../../../ui/context/context.js";
|
5
|
+
import { WARNING_MESSAGES as I } from "../../../constants.js";
|
6
|
+
import h from "../../milestone-create-context.js";
|
7
|
+
import { getGradesBasedOnGoalAvailability as n, appendPrimaryGoalCategoryToFormState as v } from "../../milestone-create-helpers.js";
|
8
|
+
import { computeChangeDetection as T, getCountriesWhereCurrentGradeNCategoryIsAvailable as E } from "../chapters-selection-step/utils.js";
|
9
|
+
import { getTestTypeBasedCategory as x } from "../test-type-step/test-type-utils.js";
|
10
|
+
import W from "./class-details-selectors.js";
|
11
|
+
import { getCategorizedCurriculumStandards as ee } from "./class-details-utils.js";
|
12
|
+
const ye = Y(
|
12
13
|
({
|
13
14
|
config: s,
|
14
15
|
formData: g,
|
15
16
|
currentStep: j,
|
16
17
|
courseStream: r,
|
17
|
-
classRatio:
|
18
|
+
classRatio: U,
|
18
19
|
onChapterExitWarning: o,
|
19
|
-
onFormDataChange:
|
20
|
+
onFormDataChange: _,
|
20
21
|
enrollmentType: a
|
21
22
|
}) => {
|
22
|
-
const { onEvent:
|
23
|
-
testType:
|
23
|
+
const { onEvent: D } = $(), { flow: c } = Z(h), {
|
24
|
+
testType: u,
|
24
25
|
grade: d,
|
25
|
-
board:
|
26
|
+
board: m,
|
26
27
|
schoolInfo: B,
|
27
28
|
region: H,
|
28
|
-
primaryChaptersList:
|
29
|
-
chapterGoalCategory:
|
30
|
-
} = g, { primaryGoalCategory:
|
29
|
+
primaryChaptersList: P,
|
30
|
+
chapterGoalCategory: R = {}
|
31
|
+
} = g, { primaryGoalCategory: k } = R, G = x(u), { countryCode: F } = B || {}, t = H || F, { name: L } = j, y = T(P, k), O = C(
|
31
32
|
() => ({
|
32
|
-
step:
|
33
|
+
step: L
|
33
34
|
}),
|
34
|
-
[
|
35
|
-
),
|
36
|
-
() =>
|
35
|
+
[L]
|
36
|
+
), S = C(
|
37
|
+
() => ee(s, {
|
37
38
|
grade: d ?? "",
|
38
39
|
countryCode: t ?? "",
|
39
|
-
goalCategory:
|
40
|
+
goalCategory: G,
|
40
41
|
courseStream: r,
|
41
|
-
classRatio:
|
42
|
-
enrollmentType: a
|
42
|
+
classRatio: U,
|
43
|
+
enrollmentType: a,
|
44
|
+
flow: c
|
43
45
|
}),
|
44
46
|
[
|
45
|
-
|
47
|
+
U,
|
46
48
|
s,
|
47
49
|
r,
|
48
50
|
t,
|
49
51
|
d,
|
50
52
|
a,
|
51
|
-
|
53
|
+
G,
|
54
|
+
c
|
52
55
|
]
|
53
|
-
), f =
|
54
|
-
() =>
|
56
|
+
), f = C(
|
57
|
+
() => E(
|
55
58
|
r,
|
56
59
|
s,
|
57
|
-
|
60
|
+
G,
|
58
61
|
a,
|
59
62
|
d,
|
60
63
|
t
|
61
64
|
),
|
62
|
-
[r, s,
|
63
|
-
),
|
65
|
+
[r, s, G, a, d, t]
|
66
|
+
), w = C(() => n(
|
64
67
|
s,
|
65
|
-
|
68
|
+
G,
|
66
69
|
r,
|
67
70
|
a
|
68
|
-
), [s, r, a,
|
71
|
+
), [s, r, a, G]), z = C(() => {
|
69
72
|
var e;
|
70
|
-
return (e = Object.entries(f)) == null ? void 0 : e.map(([p,
|
73
|
+
return (e = Object.entries(f)) == null ? void 0 : e.map(([p, A]) => ({
|
71
74
|
id: p,
|
72
|
-
label:
|
73
|
-
})).sort((p,
|
74
|
-
}, [f]), q =
|
75
|
+
label: M(A)
|
76
|
+
})).sort((p, A) => p.label.localeCompare(A.label));
|
77
|
+
}, [f]), q = C(() => t && f[t] ? M(f[t] ?? "") : "", [f, t]), l = i(
|
75
78
|
({
|
76
79
|
updatedData: e,
|
77
80
|
gradeUpdated: p,
|
78
|
-
boardUpdated:
|
79
|
-
countryUpdated:
|
81
|
+
boardUpdated: A,
|
82
|
+
countryUpdated: V
|
80
83
|
}) => {
|
81
|
-
let
|
82
|
-
p ? (
|
84
|
+
let N, b;
|
85
|
+
p ? (N = v(
|
83
86
|
s,
|
84
|
-
|
87
|
+
u,
|
85
88
|
e,
|
86
89
|
r,
|
87
90
|
a,
|
88
|
-
|
89
|
-
t
|
90
|
-
|
91
|
+
m,
|
92
|
+
t,
|
93
|
+
c
|
94
|
+
), b = {
|
91
95
|
grade: e
|
92
|
-
}) :
|
96
|
+
}) : A ? (N = v(
|
93
97
|
s,
|
94
|
-
|
98
|
+
u,
|
95
99
|
d,
|
96
100
|
r,
|
97
101
|
a,
|
98
102
|
e,
|
99
|
-
t
|
100
|
-
|
103
|
+
t,
|
104
|
+
c
|
105
|
+
), b = {
|
101
106
|
board: e,
|
102
107
|
major: void 0
|
103
|
-
}) :
|
108
|
+
}) : V && (N = v(
|
104
109
|
s,
|
105
|
-
|
110
|
+
u,
|
106
111
|
d,
|
107
112
|
r,
|
108
113
|
a,
|
109
|
-
|
110
|
-
e
|
111
|
-
|
114
|
+
m,
|
115
|
+
e,
|
116
|
+
c
|
117
|
+
), b = {
|
112
118
|
region: e
|
113
|
-
}),
|
114
|
-
...
|
119
|
+
}), D("onchange", O), _({
|
120
|
+
...b,
|
115
121
|
chapterGoalCategory: {
|
116
|
-
primaryGoalCategory:
|
122
|
+
primaryGoalCategory: N
|
117
123
|
},
|
118
124
|
primaryChaptersList: void 0
|
119
125
|
});
|
120
126
|
},
|
121
127
|
[
|
122
|
-
|
123
|
-
|
128
|
+
O,
|
129
|
+
m,
|
124
130
|
s,
|
125
131
|
r,
|
126
132
|
t,
|
127
133
|
a,
|
128
134
|
d,
|
129
|
-
|
130
|
-
|
131
|
-
|
135
|
+
_,
|
136
|
+
u,
|
137
|
+
D,
|
138
|
+
c
|
132
139
|
]
|
133
|
-
),
|
140
|
+
), J = i(
|
134
141
|
(e) => {
|
135
142
|
if (e === d) return null;
|
136
|
-
|
137
|
-
description:
|
143
|
+
y ? o == null || o({
|
144
|
+
description: I.GOAL_CHANGE_WARNING,
|
138
145
|
onSuccess: () => {
|
139
146
|
l({
|
140
147
|
updatedData: e,
|
@@ -146,12 +153,12 @@ const ce = X(
|
|
146
153
|
gradeUpdated: !0
|
147
154
|
});
|
148
155
|
},
|
149
|
-
[o, l, d,
|
150
|
-
),
|
156
|
+
[o, l, d, y]
|
157
|
+
), K = i(
|
151
158
|
(e) => {
|
152
|
-
if (e ===
|
153
|
-
|
154
|
-
description:
|
159
|
+
if (e === m) return null;
|
160
|
+
y ? o == null || o({
|
161
|
+
description: I.GOAL_CHANGE_WARNING,
|
155
162
|
onSuccess: () => {
|
156
163
|
l({
|
157
164
|
updatedData: e,
|
@@ -163,12 +170,12 @@ const ce = X(
|
|
163
170
|
boardUpdated: !0
|
164
171
|
});
|
165
172
|
},
|
166
|
-
[o, l,
|
167
|
-
),
|
173
|
+
[o, l, m, y]
|
174
|
+
), Q = i(
|
168
175
|
(e) => {
|
169
176
|
if (e === t) return null;
|
170
|
-
|
171
|
-
description:
|
177
|
+
y ? o == null || o({
|
178
|
+
description: I.GOAL_CHANGE_WARNING,
|
172
179
|
onSuccess: () => {
|
173
180
|
l({
|
174
181
|
updatedData: e,
|
@@ -180,27 +187,27 @@ const ce = X(
|
|
180
187
|
countryUpdated: !0
|
181
188
|
});
|
182
189
|
},
|
183
|
-
[o, l, t,
|
190
|
+
[o, l, t, y]
|
184
191
|
);
|
185
|
-
return /* @__PURE__ */
|
186
|
-
|
192
|
+
return /* @__PURE__ */ X(
|
193
|
+
W,
|
187
194
|
{
|
188
|
-
testType:
|
195
|
+
testType: u,
|
189
196
|
grade: d,
|
190
|
-
grades:
|
191
|
-
board:
|
192
|
-
boards:
|
197
|
+
grades: w,
|
198
|
+
board: m,
|
199
|
+
boards: S,
|
193
200
|
countryLabel: q,
|
194
201
|
countries: z,
|
195
202
|
currentCountryCode: t,
|
196
|
-
handleCountryChange:
|
197
|
-
handleBoardChange:
|
198
|
-
handleGradeSelect:
|
203
|
+
handleCountryChange: Q,
|
204
|
+
handleBoardChange: K,
|
205
|
+
handleGradeSelect: J
|
199
206
|
}
|
200
207
|
);
|
201
208
|
}
|
202
209
|
);
|
203
210
|
export {
|
204
|
-
|
211
|
+
ye as default
|
205
212
|
};
|
206
213
|
//# sourceMappingURL=class-details-step.js.map
|