@cuemath/leap 3.3.21 → 3.3.22
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/features/milestone/create/comps/add-custom-chapter/add-custom-chapter.js +42 -40
- package/dist/features/milestone/create/comps/add-custom-chapter/add-custom-chapter.js.map +1 -1
- package/dist/features/milestone/create/comps/add-custom-chapter/course-catalog.js +70 -64
- 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 +54 -29
- 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 +48 -28
- 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/chapters-selection-step.js +79 -76
- package/dist/features/milestone/create/comps/chapters-selection-step/chapters-selection-step.js.map +1 -1
- package/dist/features/milestone/create/comps/chapters-selection-step/utils.js +97 -94
- 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 +160 -143
- 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 +22 -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 +64 -59
- package/dist/features/milestone/create/comps/test-type-step/test-type-step.js.map +1 -1
- package/dist/features/milestone/create/milestone-create-container.js +17 -15
- package/dist/features/milestone/create/milestone-create-container.js.map +1 -1
- package/dist/features/milestone/create/milestone-create-helpers.js +170 -153
- package/dist/features/milestone/create/milestone-create-helpers.js.map +1 -1
- package/dist/features/milestone/create/milestone-create-styled.js +1 -1
- package/dist/features/milestone/create/milestone-create-styled.js.map +1 -1
- package/dist/features/milestone/create/milestone-create.js +19 -17
- package/dist/features/milestone/create/milestone-create.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/node_modules/query-string/base.js +1 -1
- package/dist/node_modules/query-string/node_modules/decode-uri-component/index.js.map +1 -0
- package/dist/node_modules/uuid/dist/esm-browser/regex.js +5 -0
- package/dist/node_modules/uuid/dist/esm-browser/regex.js.map +1 -0
- package/dist/node_modules/uuid/dist/esm-browser/rng.js +2 -3
- package/dist/node_modules/uuid/dist/esm-browser/rng.js.map +1 -1
- package/dist/node_modules/uuid/dist/esm-browser/stringify.js +10 -6
- package/dist/node_modules/uuid/dist/esm-browser/stringify.js.map +1 -1
- package/dist/node_modules/uuid/dist/esm-browser/v4.js +9 -12
- package/dist/node_modules/uuid/dist/esm-browser/v4.js.map +1 -1
- package/dist/node_modules/uuid/dist/esm-browser/validate.js +8 -0
- package/dist/node_modules/uuid/dist/esm-browser/validate.js.map +1 -0
- package/package.json +1 -1
- package/dist/node_modules/decode-uri-component/index.js.map +0 -1
- package/dist/node_modules/uuid/dist/esm-browser/native.js +0 -7
- package/dist/node_modules/uuid/dist/esm-browser/native.js.map +0 -1
- /package/dist/node_modules/{decode-uri-component → query-string/node_modules/decode-uri-component}/index.js +0 -0
|
@@ -1,19 +1,28 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { memo as E, useCallback as
|
|
1
|
+
import { jsx as i } from "react/jsx-runtime";
|
|
2
|
+
import { memo as E, useCallback as G, 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
|
-
import { getSelectedGoalCategoryData as F, computeChangeDetection as R, computeChapterGoalCategoryOnGradeNBoard as
|
|
7
|
-
import
|
|
8
|
-
import { CategoryContainerWrapper as
|
|
9
|
-
const
|
|
10
|
-
const {
|
|
6
|
+
import { getSelectedGoalCategoryData as F, computeChangeDetection as R, computeChapterGoalCategoryOnGradeNBoard as b } from "../../utils.js";
|
|
7
|
+
import y from "./category-card.js";
|
|
8
|
+
import { CategoryContainerWrapper as k } from "./chapter-category-styled.js";
|
|
9
|
+
const q = E((_) => {
|
|
10
|
+
const {
|
|
11
|
+
onFormDataChange: p,
|
|
12
|
+
config: t,
|
|
13
|
+
formData: D,
|
|
14
|
+
onChapterExitWarning: r,
|
|
15
|
+
courseStream: a,
|
|
16
|
+
enrollmentType: n,
|
|
17
|
+
isTeacherTrainingAccount: c
|
|
18
|
+
} = _, { flow: m } = x(), { chapterGoalCategory: A, grade: C, board: d, testType: u, region: f, primaryChaptersList: h } = D, { primaryGoalCategory: e } = A || {}, s = G(
|
|
11
19
|
(o) => {
|
|
12
20
|
const l = F({
|
|
13
21
|
goalCode: o,
|
|
14
22
|
config: t,
|
|
15
23
|
courseStream: a,
|
|
16
|
-
enrollmentType: n
|
|
24
|
+
enrollmentType: n,
|
|
25
|
+
isTeacherTrainingAccount: c
|
|
17
26
|
});
|
|
18
27
|
p({
|
|
19
28
|
chapterGoalCategory: {
|
|
@@ -21,45 +30,56 @@ const X = E((y) => {
|
|
|
21
30
|
}
|
|
22
31
|
});
|
|
23
32
|
},
|
|
24
|
-
[t, a, n, p]
|
|
25
|
-
), N =
|
|
33
|
+
[t, a, n, c, p]
|
|
34
|
+
), N = G(
|
|
26
35
|
(o) => {
|
|
27
36
|
if (o === (e == null ? void 0 : e.goal_code)) return null;
|
|
28
|
-
R(
|
|
37
|
+
R(h, e) ? r == null || r({
|
|
29
38
|
description: $.GOAL_CHANGE_WARNING,
|
|
30
39
|
onSuccess: () => {
|
|
31
|
-
|
|
40
|
+
s(o);
|
|
32
41
|
}
|
|
33
|
-
}) :
|
|
42
|
+
}) : s(o);
|
|
34
43
|
},
|
|
35
|
-
[
|
|
44
|
+
[s, h, e, r]
|
|
36
45
|
), S = M(
|
|
37
|
-
() =>
|
|
46
|
+
() => b({
|
|
38
47
|
config: t,
|
|
39
|
-
testType:
|
|
48
|
+
testType: u,
|
|
40
49
|
courseStream: a,
|
|
41
50
|
enrollmentType: n,
|
|
42
51
|
grade: C,
|
|
43
|
-
board:
|
|
44
|
-
region:
|
|
45
|
-
flow:
|
|
52
|
+
board: d,
|
|
53
|
+
region: f,
|
|
54
|
+
flow: m,
|
|
55
|
+
isTeacherTrainingAccount: c
|
|
46
56
|
}),
|
|
47
|
-
[
|
|
57
|
+
[
|
|
58
|
+
t,
|
|
59
|
+
u,
|
|
60
|
+
a,
|
|
61
|
+
n,
|
|
62
|
+
C,
|
|
63
|
+
d,
|
|
64
|
+
f,
|
|
65
|
+
m,
|
|
66
|
+
c
|
|
67
|
+
]
|
|
48
68
|
);
|
|
49
|
-
return e ? /* @__PURE__ */
|
|
50
|
-
const { goal_name:
|
|
51
|
-
return /* @__PURE__ */
|
|
69
|
+
return e ? /* @__PURE__ */ i(k, { $widthX: 12.25, children: m === "CREATE" ? S.map((o, l) => {
|
|
70
|
+
const { goal_name: T, goal_code: g } = o, w = g === e.goal_code;
|
|
71
|
+
return /* @__PURE__ */ i(
|
|
52
72
|
O,
|
|
53
73
|
{
|
|
54
|
-
onClick: () => N(
|
|
74
|
+
onClick: () => N(g),
|
|
55
75
|
$width: "100%",
|
|
56
|
-
children: /* @__PURE__ */
|
|
76
|
+
children: /* @__PURE__ */ i(y, { selected: w, title: T })
|
|
57
77
|
},
|
|
58
|
-
`${
|
|
78
|
+
`${g}_${l}`
|
|
59
79
|
);
|
|
60
|
-
}) : /* @__PURE__ */
|
|
80
|
+
}) : /* @__PURE__ */ i(y, { selected: !0, title: e.goal_name }) }) : null;
|
|
61
81
|
});
|
|
62
82
|
export {
|
|
63
|
-
|
|
83
|
+
q as default
|
|
64
84
|
};
|
|
65
85
|
//# sourceMappingURL=chapter-category-container.js.map
|
|
@@ -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 {
|
|
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 {\n onFormDataChange,\n config,\n formData,\n onChapterExitWarning,\n courseStream,\n enrollmentType,\n isTeacherTrainingAccount,\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 isTeacherTrainingAccount,\n });\n\n onFormDataChange({\n chapterGoalCategory: {\n primaryGoalCategory: goalCategoryData,\n },\n });\n },\n [config, courseStream, enrollmentType, isTeacherTrainingAccount, 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 isTeacherTrainingAccount,\n }),\n [\n config,\n testType,\n courseStream,\n enrollmentType,\n grade,\n board,\n region,\n flow,\n isTeacherTrainingAccount,\n ],\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","isTeacherTrainingAccount","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;AACrE,QAAA;AAAA,IACJ,kBAAAC;AAAA,IACA,QAAAC;AAAA,IACA,UAAAC;AAAA,IACA,sBAAAC;AAAA,IACA,cAAAC;AAAA,IACA,gBAAAC;AAAA,IACA,0BAAAC;AAAA,EACE,IAAAP,GAEE,EAAE,MAAAQ,MAASC,KAEX,EAAE,qBAAAC,GAAqB,OAAAC,GAAO,OAAAC,GAAO,UAAAC,GAAU,QAAAC,GAAQ,qBAAAC,EAAwB,IAAAZ,GAC/E,EAAE,qBAAAa,EAAA,IAAwBN,KAAuB,IAEjDO,IAAyBC;AAAA,IAC7B,CAACC,MAAqB;AACpB,YAAMC,IAAmBC,EAA4B;AAAA,QACnD,UAAAF;AAAA,QACA,QAAAjB;AAAA,QACA,cAAAG;AAAA,QACA,gBAAAC;AAAA,QACA,0BAAAC;AAAA,MAAA,CACD;AAEgB,MAAAN,EAAA;AAAA,QACf,qBAAqB;AAAA,UACnB,qBAAqBmB;AAAA,QACvB;AAAA,MAAA,CACD;AAAA,IACH;AAAA,IACA,CAAClB,GAAQG,GAAcC,GAAgBC,GAA0BN,CAAgB;AAAA,EAAA,GAG7EqB,IAAwBJ;AAAA,IAC5B,CAACC,MAAqB;AAChB,UAAAA,OAAaH,KAAA,gBAAAA,EAAqB,WAAkB,QAAA;AAIxD,MAFyBO,EAAuBR,GAAqBC,CAAmB,IAG/DZ,KAAA,QAAAA,EAAA;AAAA,QACrB,aAAaoB,EAAiB;AAAA,QAC9B,WAAW,MAAM;AACf,UAAAP,EAAuBE,CAAQ;AAAA,QACjC;AAAA,MAAA,KAGFF,EAAuBE,CAAQ;AAAA,IAEnC;AAAA,IACA,CAACF,GAAwBF,GAAqBC,GAAqBZ,CAAoB;AAAA,EAAA,GAGnFqB,IAA4BC;AAAA,IAChC,MACEC,EAAwC;AAAA,MACtC,QAAAzB;AAAA,MACA,UAAAW;AAAA,MACA,cAAAR;AAAA,MACA,gBAAAC;AAAA,MACA,OAAAK;AAAA,MACA,OAAAC;AAAA,MACA,QAAAE;AAAA,MACA,MAAAN;AAAA,MACA,0BAAAD;AAAA,IAAA,CACD;AAAA,IACH;AAAA,MACEL;AAAA,MACAW;AAAA,MACAR;AAAA,MACAC;AAAA,MACAK;AAAA,MACAC;AAAA,MACAE;AAAA,MACAN;AAAA,MACAD;AAAA,IACF;AAAA,EAAA;AAGE,SAACS,IAGF,gBAAAY,EAAAC,GAAA,EAAgC,SAAS,OACvC,UAASrB,MAAA,WACRiB,EAA0B,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;"}
|
package/dist/features/milestone/create/comps/chapters-selection-step/chapters-selection-step.js
CHANGED
|
@@ -1,27 +1,27 @@
|
|
|
1
|
-
import { jsx as t, jsxs as
|
|
2
|
-
import { memo as
|
|
3
|
-
import
|
|
4
|
-
import
|
|
1
|
+
import { jsx as t, jsxs as k } from "react/jsx-runtime";
|
|
2
|
+
import { memo as V, useContext as J, useMemo as K, useCallback as u } from "react";
|
|
3
|
+
import Q from "../../../../../assets/line-icons/icons/bin2.js";
|
|
4
|
+
import Y from "../../../../../assets/line-icons/icons/plus.js";
|
|
5
5
|
import f from "../../../../ui/arrow-tooltip/arrow-tooltip.js";
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import { useUIContext as
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import { WARNING_MESSAGES as
|
|
12
|
-
import { GOAL_EDIT_FLOWS as
|
|
13
|
-
import
|
|
14
|
-
import
|
|
15
|
-
import
|
|
16
|
-
import
|
|
17
|
-
import { BinIconWrapper as de, ButtonWrapper as
|
|
18
|
-
import { useChapterListUpdate as
|
|
19
|
-
import { computeChangeDetection as
|
|
20
|
-
const
|
|
6
|
+
import Z from "../../../../ui/buttons/button/button.js";
|
|
7
|
+
import P from "../../../../ui/buttons/icon-button/icon-button.js";
|
|
8
|
+
import { useUIContext as ee } from "../../../../ui/context/context.js";
|
|
9
|
+
import R from "../../../../ui/layout/flex-view.js";
|
|
10
|
+
import te from "../../../../ui/text/text.js";
|
|
11
|
+
import { WARNING_MESSAGES as oe } from "../../../constants.js";
|
|
12
|
+
import { GOAL_EDIT_FLOWS as re } from "../../milestone-create-constants.js";
|
|
13
|
+
import ne from "../../milestone-create-context.js";
|
|
14
|
+
import se from "../body-layout/body-layout.js";
|
|
15
|
+
import ae from "../class-details-step/class-details-step.js";
|
|
16
|
+
import ie from "./chapter-selection-step-v2/chapter-selection.js";
|
|
17
|
+
import { BinIconWrapper as de, ButtonWrapper as G } from "./chapters-selection-step-styled.js";
|
|
18
|
+
import { useChapterListUpdate as le } from "./use-chapter-list-update.js";
|
|
19
|
+
import { computeChangeDetection as ce } from "./utils.js";
|
|
20
|
+
const ke = V((N) => {
|
|
21
21
|
const {
|
|
22
22
|
currentStep: g,
|
|
23
23
|
onFormDataChange: s,
|
|
24
|
-
onChapterExitWarning:
|
|
24
|
+
onChapterExitWarning: i,
|
|
25
25
|
formData: l,
|
|
26
26
|
studentName: A,
|
|
27
27
|
studentId: I,
|
|
@@ -31,26 +31,27 @@ const $e = q((G) => {
|
|
|
31
31
|
courseStream: _,
|
|
32
32
|
classRatio: b,
|
|
33
33
|
enrollmentType: C,
|
|
34
|
-
canDeleteGoal:
|
|
35
|
-
onDeleteGoal:
|
|
36
|
-
|
|
34
|
+
canDeleteGoal: L,
|
|
35
|
+
onDeleteGoal: X,
|
|
36
|
+
isTeacherTrainingAccount: D
|
|
37
|
+
} = N, { flow: o } = J(ne), { onEvent: S } = ee(), {
|
|
37
38
|
action_plan: {
|
|
38
|
-
green: { share_message_template:
|
|
39
|
+
green: { share_message_template: E }
|
|
39
40
|
}
|
|
40
|
-
} = m, { buttonLabel:
|
|
41
|
-
step:
|
|
42
|
-
}, { testType:
|
|
41
|
+
} = m, { buttonLabel: z, name: x, title: F } = g, O = {
|
|
42
|
+
step: x
|
|
43
|
+
}, { testType: j, primaryChaptersList: e, board: T, major: w, region: B, chapterGoalCategory: y } = l, { primaryGoalCategory: r } = y || {}, M = L && (o === "DRAFT_EDIT" || o === "EDIT"), { isProcessing: p, isProcessed: W } = le({
|
|
43
44
|
formData: l,
|
|
44
45
|
onFormDataChange: s,
|
|
45
46
|
studentId: I
|
|
46
|
-
}),
|
|
47
|
-
const n = e == null ? void 0 : e.filter((
|
|
48
|
-
(
|
|
49
|
-
).length) ?? 0,
|
|
50
|
-
|
|
47
|
+
}), $ = K(() => e ? e.some((n) => n.added) : !1, [e]), v = u(() => {
|
|
48
|
+
const n = e == null ? void 0 : e.filter((d) => !!d.added), h = (e == null ? void 0 : e.filter(
|
|
49
|
+
(d) => d.program_id !== (r == null ? void 0 : r.program_code) && d.added
|
|
50
|
+
).length) ?? 0, q = (e == null ? void 0 : e.filter((d) => d.program_id === (r == null ? void 0 : r.program_id)).length) ?? 0;
|
|
51
|
+
S("CHAPTER_DETAILS_ADDED", {
|
|
51
52
|
total_chapter_added: (n == null ? void 0 : n.length) ?? 0,
|
|
52
53
|
searched_chapter_added: h,
|
|
53
|
-
suggested_chapter_added:
|
|
54
|
+
suggested_chapter_added: q
|
|
54
55
|
}), a ? s({
|
|
55
56
|
primaryChaptersList: e,
|
|
56
57
|
selectedChaptersList: n,
|
|
@@ -60,24 +61,24 @@ const $e = q((G) => {
|
|
|
60
61
|
selectedChaptersList: !0,
|
|
61
62
|
chapterSubStages: !0,
|
|
62
63
|
grade: !0,
|
|
63
|
-
board: !!
|
|
64
|
-
major: !!
|
|
65
|
-
region: !!
|
|
64
|
+
board: !!T,
|
|
65
|
+
major: !!w,
|
|
66
|
+
region: !!B
|
|
66
67
|
}
|
|
67
|
-
}) : o && (c == null || c({ isDraftPlan: !1, flow: o, submitBaseMessage:
|
|
68
|
+
}) : o && (c == null || c({ isDraftPlan: !1, flow: o, submitBaseMessage: E }));
|
|
68
69
|
}, [
|
|
69
70
|
e,
|
|
70
|
-
x,
|
|
71
71
|
T,
|
|
72
72
|
w,
|
|
73
|
-
|
|
73
|
+
B,
|
|
74
|
+
S,
|
|
74
75
|
s,
|
|
75
76
|
c,
|
|
76
77
|
o,
|
|
77
78
|
a,
|
|
78
|
-
|
|
79
|
+
E,
|
|
79
80
|
r
|
|
80
|
-
]),
|
|
81
|
+
]), H = u(() => {
|
|
81
82
|
s({
|
|
82
83
|
chapterSubStages: "custom-chapters",
|
|
83
84
|
selectedChaptersList: void 0,
|
|
@@ -86,25 +87,25 @@ const $e = q((G) => {
|
|
|
86
87
|
selectedChaptersList: !1
|
|
87
88
|
}
|
|
88
89
|
});
|
|
89
|
-
}, [s]),
|
|
90
|
+
}, [s]), U = u(
|
|
90
91
|
(n) => {
|
|
91
92
|
if (!o) return null;
|
|
92
|
-
const h =
|
|
93
|
-
|
|
93
|
+
const h = ce(e, r);
|
|
94
|
+
re.includes(o) || !(e != null && e.length) || !h ? n() : i == null || i({
|
|
94
95
|
onSuccess: n,
|
|
95
|
-
description:
|
|
96
|
+
description: oe.CHAPTER_EXIT_WARNING
|
|
96
97
|
});
|
|
97
98
|
},
|
|
98
|
-
[
|
|
99
|
+
[i, o, e, r]
|
|
99
100
|
);
|
|
100
101
|
return /* @__PURE__ */ t(
|
|
101
|
-
|
|
102
|
+
se,
|
|
102
103
|
{
|
|
103
|
-
stepName:
|
|
104
|
-
headerElement: /* @__PURE__ */
|
|
105
|
-
/* @__PURE__ */ t(
|
|
104
|
+
stepName: x,
|
|
105
|
+
headerElement: /* @__PURE__ */ k(R, { $flexDirection: "row", $alignItems: "center", $flexGapX: 1, $width: "100%", children: [
|
|
106
|
+
/* @__PURE__ */ t(te, { $renderAs: "ab2", children: a ? F : "Chapters" }),
|
|
106
107
|
a && o === "CREATE" && /* @__PURE__ */ t(
|
|
107
|
-
|
|
108
|
+
ae,
|
|
108
109
|
{
|
|
109
110
|
studentName: A,
|
|
110
111
|
studentId: I,
|
|
@@ -114,11 +115,12 @@ const $e = q((G) => {
|
|
|
114
115
|
courseStream: _,
|
|
115
116
|
classRatio: b,
|
|
116
117
|
onFormDataChange: s,
|
|
117
|
-
onChapterExitWarning:
|
|
118
|
-
enrollmentType: C
|
|
118
|
+
onChapterExitWarning: i,
|
|
119
|
+
enrollmentType: C,
|
|
120
|
+
isTeacherTrainingAccount: D
|
|
119
121
|
}
|
|
120
122
|
),
|
|
121
|
-
a &&
|
|
123
|
+
a && M && /* @__PURE__ */ t(de, { children: /* @__PURE__ */ t(
|
|
122
124
|
f,
|
|
123
125
|
{
|
|
124
126
|
renderAs: "primary",
|
|
@@ -127,38 +129,39 @@ const $e = q((G) => {
|
|
|
127
129
|
zIndex: 10,
|
|
128
130
|
widthX: 6,
|
|
129
131
|
children: /* @__PURE__ */ t(
|
|
130
|
-
|
|
132
|
+
P,
|
|
131
133
|
{
|
|
132
134
|
size: "xsmall",
|
|
133
135
|
renderAs: "tertiary",
|
|
134
|
-
Icon:
|
|
136
|
+
Icon: Q,
|
|
135
137
|
analyticsLabel: "delete_goal_plan",
|
|
136
|
-
onClick:
|
|
138
|
+
onClick: X
|
|
137
139
|
}
|
|
138
140
|
)
|
|
139
141
|
}
|
|
140
142
|
) })
|
|
141
143
|
] }),
|
|
142
144
|
bodyHeight: "100%",
|
|
143
|
-
onBackButtonClick:
|
|
145
|
+
onBackButtonClick: U,
|
|
144
146
|
bodyElement: /* @__PURE__ */ t(
|
|
145
|
-
|
|
147
|
+
ie,
|
|
146
148
|
{
|
|
147
149
|
config: m,
|
|
148
150
|
classRatio: b,
|
|
149
151
|
isGoalCreation: a,
|
|
150
152
|
formData: l,
|
|
151
153
|
studentName: A,
|
|
152
|
-
isProcessed:
|
|
154
|
+
isProcessed: W,
|
|
153
155
|
isProcessing: p,
|
|
154
156
|
courseStream: _,
|
|
155
157
|
onFormDataChange: s,
|
|
156
|
-
onChapterExitWarning:
|
|
157
|
-
enrollmentType: C
|
|
158
|
+
onChapterExitWarning: i,
|
|
159
|
+
enrollmentType: C,
|
|
160
|
+
isTeacherTrainingAccount: D
|
|
158
161
|
}
|
|
159
162
|
),
|
|
160
|
-
footerElement: /* @__PURE__ */
|
|
161
|
-
(!a ||
|
|
163
|
+
footerElement: /* @__PURE__ */ k(R, { $flexDirection: "row", $flexGap: 12, $alignItems: "center", children: [
|
|
164
|
+
(!a || j === "no-test") && /* @__PURE__ */ t(
|
|
162
165
|
f,
|
|
163
166
|
{
|
|
164
167
|
renderAs: "primary",
|
|
@@ -166,14 +169,14 @@ const $e = q((G) => {
|
|
|
166
169
|
widthX: 6.5,
|
|
167
170
|
zIndex: 20,
|
|
168
171
|
tooltipItem: "Add a chapter",
|
|
169
|
-
children: /* @__PURE__ */ t(
|
|
170
|
-
|
|
172
|
+
children: /* @__PURE__ */ t(G, { $borderRadius: 50, children: /* @__PURE__ */ t(
|
|
173
|
+
P,
|
|
171
174
|
{
|
|
172
175
|
renderAs: "secondary",
|
|
173
176
|
analyticsLabel: "Add custom chapters",
|
|
174
|
-
Icon:
|
|
177
|
+
Icon: Y,
|
|
175
178
|
disabled: p,
|
|
176
|
-
onClick:
|
|
179
|
+
onClick: H
|
|
177
180
|
}
|
|
178
181
|
) })
|
|
179
182
|
}
|
|
@@ -186,20 +189,20 @@ const $e = q((G) => {
|
|
|
186
189
|
widthX: 11,
|
|
187
190
|
zIndex: 20,
|
|
188
191
|
tooltipItem: "Please select atleast one chapter",
|
|
189
|
-
hidden:
|
|
190
|
-
children: /* @__PURE__ */ t(
|
|
191
|
-
|
|
192
|
+
hidden: $,
|
|
193
|
+
children: /* @__PURE__ */ t(G, { children: /* @__PURE__ */ t(
|
|
194
|
+
Z,
|
|
192
195
|
{
|
|
193
196
|
renderAs: "primary",
|
|
194
197
|
size: "small",
|
|
195
198
|
shape: "square",
|
|
196
199
|
widthX: 9,
|
|
197
|
-
label:
|
|
198
|
-
onClick:
|
|
200
|
+
label: z,
|
|
201
|
+
onClick: v,
|
|
199
202
|
iconPosition: "right",
|
|
200
203
|
busy: p,
|
|
201
|
-
disabled:
|
|
202
|
-
analyticsProps:
|
|
204
|
+
disabled: !$,
|
|
205
|
+
analyticsProps: O
|
|
203
206
|
}
|
|
204
207
|
) })
|
|
205
208
|
}
|
|
@@ -209,6 +212,6 @@ const $e = q((G) => {
|
|
|
209
212
|
);
|
|
210
213
|
});
|
|
211
214
|
export {
|
|
212
|
-
|
|
215
|
+
ke as default
|
|
213
216
|
};
|
|
214
217
|
//# sourceMappingURL=chapters-selection-step.js.map
|
package/dist/features/milestone/create/comps/chapters-selection-step/chapters-selection-step.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chapters-selection-step.js","sources":["../../../../../../src/features/milestone/create/comps/chapters-selection-step/chapters-selection-step.tsx"],"sourcesContent":["import type { IFormStepProps } from '../../milestone-create-types';\nimport type { FC } from 'react';\n\nimport { memo, useCallback, useContext, useMemo } from 'react';\n\nimport Bin2Icon from '../../../../../assets/line-icons/icons/bin2';\nimport PlusIcon from '../../../../../assets/line-icons/icons/plus';\nimport ArrowTooltip from '../../../../ui/arrow-tooltip/arrow-tooltip';\nimport Button from '../../../../ui/buttons/button/button';\nimport IconButton from '../../../../ui/buttons/icon-button/icon-button';\nimport { useUIContext } from '../../../../ui/context/context';\nimport FlexView from '../../../../ui/layout/flex-view';\nimport Text from '../../../../ui/text/text';\nimport { WARNING_MESSAGES } from '../../../constants';\nimport { GOAL_EDIT_FLOWS } from '../../milestone-create-constants';\nimport MilestoneCreateContext from '../../milestone-create-context';\nimport BodyLayout from '../body-layout/body-layout';\nimport ClassDetailsStep from '../class-details-step/class-details-step';\nimport ChapterSelection from './chapter-selection-step-v2/chapter-selection';\nimport * as Styled from './chapters-selection-step-styled';\nimport { useChapterListUpdate } from './use-chapter-list-update';\nimport { computeChangeDetection } from './utils';\n\nconst ChaptersSelectionStep: FC<IFormStepProps> = memo(props => {\n const {\n currentStep,\n onFormDataChange,\n onChapterExitWarning,\n formData,\n studentName,\n studentId,\n config,\n isGoalCreation,\n onPreSubmit,\n courseStream,\n classRatio,\n enrollmentType,\n canDeleteGoal,\n onDeleteGoal,\n } = props;\n const { flow } = useContext(MilestoneCreateContext);\n const { onEvent: trackEvent } = useUIContext();\n\n const {\n action_plan: {\n green: { share_message_template: submitBaseMessage },\n },\n } = config;\n const { buttonLabel, name, title } = currentStep;\n const analyticsProps = {\n step: name,\n };\n const { testType, primaryChaptersList, board, major, region, chapterGoalCategory } = formData;\n\n const { primaryGoalCategory } = chapterGoalCategory || {};\n\n const goalEditFlow = canDeleteGoal && (flow === 'DRAFT_EDIT' || flow === 'EDIT');\n\n //* Hook that handles making api call for cue_chapters updating primaryChapterList.\n const { isProcessing, isProcessed } = useChapterListUpdate({\n formData,\n onFormDataChange,\n studentId,\n });\n\n const isAtleastOneChapterAdded = useMemo(() => {\n if (primaryChaptersList) {\n return primaryChaptersList.some(chapter => chapter.added);\n }\n\n return false;\n }, [primaryChaptersList]);\n\n const handleNext = useCallback(() => {\n const selectedChaptersList = primaryChaptersList?.filter(chapter => {\n return Boolean(chapter.added);\n });\n\n const searchedAndAddedChapterLength =\n primaryChaptersList?.filter(\n chapter => chapter.program_id !== primaryGoalCategory?.program_code && chapter.added,\n ).length ?? 0;\n\n const suggestedChaptersLength =\n primaryChaptersList?.filter(chapter => chapter.program_id === primaryGoalCategory?.program_id)\n .length ?? 0;\n\n trackEvent('CHAPTER_DETAILS_ADDED', {\n total_chapter_added: selectedChaptersList?.length ?? 0,\n searched_chapter_added: searchedAndAddedChapterLength,\n suggested_chapter_added: suggestedChaptersLength,\n });\n\n if (isGoalCreation) {\n onFormDataChange({\n primaryChaptersList: primaryChaptersList,\n selectedChaptersList: selectedChaptersList,\n searchedChaptersList: [],\n chapterSubStages: 'date-selection',\n committed: {\n selectedChaptersList: true,\n chapterSubStages: true,\n grade: true,\n board: !!board,\n major: !!major,\n region: !!region,\n },\n });\n } else if (flow) {\n onPreSubmit?.({ isDraftPlan: false, flow, submitBaseMessage });\n }\n }, [\n primaryChaptersList,\n board,\n major,\n region,\n trackEvent,\n onFormDataChange,\n onPreSubmit,\n flow,\n isGoalCreation,\n submitBaseMessage,\n primaryGoalCategory,\n ]);\n\n const handleOnAddCustomChapter = useCallback(() => {\n onFormDataChange({\n chapterSubStages: 'custom-chapters',\n selectedChaptersList: undefined,\n committed: {\n chapterSubStages: true,\n selectedChaptersList: false,\n },\n });\n }, [onFormDataChange]);\n\n const handleOnBackButtonClick = useCallback(\n (handleBack: () => void) => {\n if (!flow) return null;\n\n const isChangeDetected = computeChangeDetection(primaryChaptersList, primaryGoalCategory);\n\n if (GOAL_EDIT_FLOWS.includes(flow) || !primaryChaptersList?.length || !isChangeDetected) {\n handleBack();\n } else {\n onChapterExitWarning?.({\n onSuccess: handleBack,\n description: WARNING_MESSAGES.CHAPTER_EXIT_WARNING,\n });\n }\n },\n [onChapterExitWarning, flow, primaryChaptersList, primaryGoalCategory],\n );\n\n return (\n <BodyLayout\n stepName={name}\n headerElement={\n <FlexView $flexDirection=\"row\" $alignItems=\"center\" $flexGapX={1} $width=\"100%\">\n <Text $renderAs=\"ab2\">{isGoalCreation ? title : 'Chapters'}</Text>\n\n {isGoalCreation && flow === 'CREATE' && (\n <ClassDetailsStep\n studentName={studentName}\n studentId={studentId}\n currentStep={currentStep}\n config={config}\n formData={formData}\n courseStream={courseStream}\n classRatio={classRatio}\n onFormDataChange={onFormDataChange}\n onChapterExitWarning={onChapterExitWarning}\n enrollmentType={enrollmentType}\n />\n )}\n\n {isGoalCreation && goalEditFlow && (\n <Styled.BinIconWrapper>\n <ArrowTooltip\n renderAs=\"primary\"\n position=\"bottom\"\n tooltipItem=\"Delete goal\"\n zIndex={10}\n widthX={6}\n >\n <IconButton\n size=\"xsmall\"\n renderAs=\"tertiary\"\n Icon={Bin2Icon}\n analyticsLabel=\"delete_goal_plan\"\n onClick={onDeleteGoal}\n />\n </ArrowTooltip>\n </Styled.BinIconWrapper>\n )}\n </FlexView>\n }\n bodyHeight=\"100%\"\n onBackButtonClick={handleOnBackButtonClick}\n bodyElement={\n <ChapterSelection\n config={config}\n classRatio={classRatio}\n isGoalCreation={isGoalCreation}\n formData={formData}\n studentName={studentName}\n isProcessed={isProcessed}\n isProcessing={isProcessing}\n courseStream={courseStream}\n onFormDataChange={onFormDataChange}\n onChapterExitWarning={onChapterExitWarning}\n enrollmentType={enrollmentType}\n />\n }\n footerElement={\n <FlexView $flexDirection=\"row\" $flexGap={12} $alignItems=\"center\">\n {(!isGoalCreation || testType === 'no-test') && (\n <ArrowTooltip\n renderAs=\"primary\"\n position=\"top\"\n widthX={6.5}\n zIndex={20}\n tooltipItem=\"Add a chapter\"\n >\n <Styled.ButtonWrapper $borderRadius={50}>\n <IconButton\n renderAs=\"secondary\"\n analyticsLabel=\"Add custom chapters\"\n Icon={PlusIcon}\n disabled={isProcessing}\n onClick={handleOnAddCustomChapter}\n />\n </Styled.ButtonWrapper>\n </ArrowTooltip>\n )}\n <ArrowTooltip\n renderAs=\"primary\"\n position=\"top\"\n widthX={11}\n zIndex={20}\n tooltipItem=\"Please select atleast one chapter\"\n hidden={isAtleastOneChapterAdded}\n >\n <Styled.ButtonWrapper>\n <Button\n renderAs=\"primary\"\n size=\"small\"\n shape=\"square\"\n widthX={9}\n label={buttonLabel}\n onClick={handleNext}\n iconPosition=\"right\"\n busy={isProcessing}\n disabled={!isAtleastOneChapterAdded}\n analyticsProps={analyticsProps}\n />\n </Styled.ButtonWrapper>\n </ArrowTooltip>\n </FlexView>\n }\n />\n );\n});\n\nexport default ChaptersSelectionStep;\n"],"names":["ChaptersSelectionStep","memo","props","currentStep","onFormDataChange","onChapterExitWarning","formData","studentName","studentId","config","isGoalCreation","onPreSubmit","courseStream","classRatio","enrollmentType","canDeleteGoal","onDeleteGoal","flow","useContext","MilestoneCreateContext","trackEvent","useUIContext","submitBaseMessage","buttonLabel","name","title","analyticsProps","testType","primaryChaptersList","board","major","region","chapterGoalCategory","primaryGoalCategory","goalEditFlow","isProcessing","isProcessed","useChapterListUpdate","isAtleastOneChapterAdded","useMemo","chapter","handleNext","useCallback","selectedChaptersList","searchedAndAddedChapterLength","suggestedChaptersLength","handleOnAddCustomChapter","handleOnBackButtonClick","handleBack","isChangeDetected","computeChangeDetection","GOAL_EDIT_FLOWS","WARNING_MESSAGES","jsx","BodyLayout","jsxs","FlexView","Text","ClassDetailsStep","Styled.BinIconWrapper","ArrowTooltip","IconButton","Bin2Icon","ChapterSelection","Styled.ButtonWrapper","PlusIcon","Button"],"mappings":";;;;;;;;;;;;;;;;;;;AAuBM,MAAAA,KAA4CC,EAAK,CAASC,MAAA;AACxD,QAAA;AAAA,IACJ,aAAAC;AAAA,IACA,kBAAAC;AAAA,IACA,sBAAAC;AAAA,IACA,UAAAC;AAAA,IACA,aAAAC;AAAA,IACA,WAAAC;AAAA,IACA,QAAAC;AAAA,IACA,gBAAAC;AAAA,IACA,aAAAC;AAAA,IACA,cAAAC;AAAA,IACA,YAAAC;AAAA,IACA,gBAAAC;AAAA,IACA,eAAAC;AAAA,IACA,cAAAC;AAAA,EACE,IAAAd,GACE,EAAE,M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,gBAAA0B;AAAA,UAACO;AAAA,UAAA;AAAA,YACC,UAAS;AAAA,YACT,UAAS;AAAA,YACT,QAAQ;AAAA,YACR,QAAQ;AAAA,YACR,aAAY;AAAA,YAEZ,UAAC,gBAAAP,EAAAW,GAAA,EAAqB,eAAe,IACnC,UAAA,gBAAAX;AAAA,cAACQ;AAAA,cAAA;AAAA,gBACC,UAAS;AAAA,gBACT,gBAAe;AAAA,gBACf,MAAMI;AAAA,gBACN,UAAU9B;AAAA,gBACV,SAASW;AAAA,cAAA;AAAA,YAAA,GAEb;AAAA,UAAA;AAAA,QACF;AAAA,QAEF,gBAAAO;AAAA,UAACO;AAAA,UAAA;AAAA,YACC,UAAS;AAAA,YACT,UAAS;AAAA,YACT,QAAQ;AAAA,YACR,QAAQ;AAAA,YACR,aAAY;AAAA,YACZ,QAAQtB;AAAA,YAER,UAAA,gBAAAe,EAACW,GAAA,EACC,UAAA,gBAAAX;AAAA,cAACa;AAAA,cAAA;AAAA,gBACC,UAAS;AAAA,gBACT,MAAK;AAAA,gBACL,OAAM;AAAA,gBACN,QAAQ;AAAA,gBACR,OAAO3C;AAAA,gBACP,SAASkB;AAAA,gBACT,cAAa;AAAA,gBACb,MAAMN;AAAA,gBACN,UAAU,CAACG;AAAA,gBACX,gBAAAZ;AAAA,cAAA;AAAA,YAAA,GAEJ;AAAA,UAAA;AAAA,QACF;AAAA,MAAA,GACF;AAAA,IAAA;AAAA,EAAA;AAIR,CAAC;"}
|
|
1
|
+
{"version":3,"file":"chapters-selection-step.js","sources":["../../../../../../src/features/milestone/create/comps/chapters-selection-step/chapters-selection-step.tsx"],"sourcesContent":["import type { IFormStepProps } from '../../milestone-create-types';\nimport type { FC } from 'react';\n\nimport { memo, useCallback, useContext, useMemo } from 'react';\n\nimport Bin2Icon from '../../../../../assets/line-icons/icons/bin2';\nimport PlusIcon from '../../../../../assets/line-icons/icons/plus';\nimport ArrowTooltip from '../../../../ui/arrow-tooltip/arrow-tooltip';\nimport Button from '../../../../ui/buttons/button/button';\nimport IconButton from '../../../../ui/buttons/icon-button/icon-button';\nimport { useUIContext } from '../../../../ui/context/context';\nimport FlexView from '../../../../ui/layout/flex-view';\nimport Text from '../../../../ui/text/text';\nimport { WARNING_MESSAGES } from '../../../constants';\nimport { GOAL_EDIT_FLOWS } from '../../milestone-create-constants';\nimport MilestoneCreateContext from '../../milestone-create-context';\nimport BodyLayout from '../body-layout/body-layout';\nimport ClassDetailsStep from '../class-details-step/class-details-step';\nimport ChapterSelection from './chapter-selection-step-v2/chapter-selection';\nimport * as Styled from './chapters-selection-step-styled';\nimport { useChapterListUpdate } from './use-chapter-list-update';\nimport { computeChangeDetection } from './utils';\n\nconst ChaptersSelectionStep: FC<IFormStepProps> = memo(props => {\n const {\n currentStep,\n onFormDataChange,\n onChapterExitWarning,\n formData,\n studentName,\n studentId,\n config,\n isGoalCreation,\n onPreSubmit,\n courseStream,\n classRatio,\n enrollmentType,\n canDeleteGoal,\n onDeleteGoal,\n isTeacherTrainingAccount,\n } = props;\n const { flow } = useContext(MilestoneCreateContext);\n const { onEvent: trackEvent } = useUIContext();\n\n const {\n action_plan: {\n green: { share_message_template: submitBaseMessage },\n },\n } = config;\n const { buttonLabel, name, title } = currentStep;\n const analyticsProps = {\n step: name,\n };\n const { testType, primaryChaptersList, board, major, region, chapterGoalCategory } = formData;\n\n const { primaryGoalCategory } = chapterGoalCategory || {};\n\n const goalEditFlow = canDeleteGoal && (flow === 'DRAFT_EDIT' || flow === 'EDIT');\n\n //* Hook that handles making api call for cue_chapters updating primaryChapterList.\n const { isProcessing, isProcessed } = useChapterListUpdate({\n formData,\n onFormDataChange,\n studentId,\n });\n\n const isAtleastOneChapterAdded = useMemo(() => {\n if (primaryChaptersList) {\n return primaryChaptersList.some(chapter => chapter.added);\n }\n\n return false;\n }, [primaryChaptersList]);\n\n const handleNext = useCallback(() => {\n const selectedChaptersList = primaryChaptersList?.filter(chapter => {\n return Boolean(chapter.added);\n });\n\n const searchedAndAddedChapterLength =\n primaryChaptersList?.filter(\n chapter => chapter.program_id !== primaryGoalCategory?.program_code && chapter.added,\n ).length ?? 0;\n\n const suggestedChaptersLength =\n primaryChaptersList?.filter(chapter => chapter.program_id === primaryGoalCategory?.program_id)\n .length ?? 0;\n\n trackEvent('CHAPTER_DETAILS_ADDED', {\n total_chapter_added: selectedChaptersList?.length ?? 0,\n searched_chapter_added: searchedAndAddedChapterLength,\n suggested_chapter_added: suggestedChaptersLength,\n });\n\n if (isGoalCreation) {\n onFormDataChange({\n primaryChaptersList: primaryChaptersList,\n selectedChaptersList: selectedChaptersList,\n searchedChaptersList: [],\n chapterSubStages: 'date-selection',\n committed: {\n selectedChaptersList: true,\n chapterSubStages: true,\n grade: true,\n board: !!board,\n major: !!major,\n region: !!region,\n },\n });\n } else if (flow) {\n onPreSubmit?.({ isDraftPlan: false, flow, submitBaseMessage });\n }\n }, [\n primaryChaptersList,\n board,\n major,\n region,\n trackEvent,\n onFormDataChange,\n onPreSubmit,\n flow,\n isGoalCreation,\n submitBaseMessage,\n primaryGoalCategory,\n ]);\n\n const handleOnAddCustomChapter = useCallback(() => {\n onFormDataChange({\n chapterSubStages: 'custom-chapters',\n selectedChaptersList: undefined,\n committed: {\n chapterSubStages: true,\n selectedChaptersList: false,\n },\n });\n }, [onFormDataChange]);\n\n const handleOnBackButtonClick = useCallback(\n (handleBack: () => void) => {\n if (!flow) return null;\n\n const isChangeDetected = computeChangeDetection(primaryChaptersList, primaryGoalCategory);\n\n if (GOAL_EDIT_FLOWS.includes(flow) || !primaryChaptersList?.length || !isChangeDetected) {\n handleBack();\n } else {\n onChapterExitWarning?.({\n onSuccess: handleBack,\n description: WARNING_MESSAGES.CHAPTER_EXIT_WARNING,\n });\n }\n },\n [onChapterExitWarning, flow, primaryChaptersList, primaryGoalCategory],\n );\n\n return (\n <BodyLayout\n stepName={name}\n headerElement={\n <FlexView $flexDirection=\"row\" $alignItems=\"center\" $flexGapX={1} $width=\"100%\">\n <Text $renderAs=\"ab2\">{isGoalCreation ? title : 'Chapters'}</Text>\n\n {isGoalCreation && flow === 'CREATE' && (\n <ClassDetailsStep\n studentName={studentName}\n studentId={studentId}\n currentStep={currentStep}\n config={config}\n formData={formData}\n courseStream={courseStream}\n classRatio={classRatio}\n onFormDataChange={onFormDataChange}\n onChapterExitWarning={onChapterExitWarning}\n enrollmentType={enrollmentType}\n isTeacherTrainingAccount={isTeacherTrainingAccount}\n />\n )}\n\n {isGoalCreation && goalEditFlow && (\n <Styled.BinIconWrapper>\n <ArrowTooltip\n renderAs=\"primary\"\n position=\"bottom\"\n tooltipItem=\"Delete goal\"\n zIndex={10}\n widthX={6}\n >\n <IconButton\n size=\"xsmall\"\n renderAs=\"tertiary\"\n Icon={Bin2Icon}\n analyticsLabel=\"delete_goal_plan\"\n onClick={onDeleteGoal}\n />\n </ArrowTooltip>\n </Styled.BinIconWrapper>\n )}\n </FlexView>\n }\n bodyHeight=\"100%\"\n onBackButtonClick={handleOnBackButtonClick}\n bodyElement={\n <ChapterSelection\n config={config}\n classRatio={classRatio}\n isGoalCreation={isGoalCreation}\n formData={formData}\n studentName={studentName}\n isProcessed={isProcessed}\n isProcessing={isProcessing}\n courseStream={courseStream}\n onFormDataChange={onFormDataChange}\n onChapterExitWarning={onChapterExitWarning}\n enrollmentType={enrollmentType}\n isTeacherTrainingAccount={isTeacherTrainingAccount}\n />\n }\n footerElement={\n <FlexView $flexDirection=\"row\" $flexGap={12} $alignItems=\"center\">\n {(!isGoalCreation || testType === 'no-test') && (\n <ArrowTooltip\n renderAs=\"primary\"\n position=\"top\"\n widthX={6.5}\n zIndex={20}\n tooltipItem=\"Add a chapter\"\n >\n <Styled.ButtonWrapper $borderRadius={50}>\n <IconButton\n renderAs=\"secondary\"\n analyticsLabel=\"Add custom chapters\"\n Icon={PlusIcon}\n disabled={isProcessing}\n onClick={handleOnAddCustomChapter}\n />\n </Styled.ButtonWrapper>\n </ArrowTooltip>\n )}\n <ArrowTooltip\n renderAs=\"primary\"\n position=\"top\"\n widthX={11}\n zIndex={20}\n tooltipItem=\"Please select atleast one chapter\"\n hidden={isAtleastOneChapterAdded}\n >\n <Styled.ButtonWrapper>\n <Button\n renderAs=\"primary\"\n size=\"small\"\n shape=\"square\"\n widthX={9}\n label={buttonLabel}\n onClick={handleNext}\n iconPosition=\"right\"\n busy={isProcessing}\n disabled={!isAtleastOneChapterAdded}\n analyticsProps={analyticsProps}\n />\n </Styled.ButtonWrapper>\n </ArrowTooltip>\n </FlexView>\n }\n />\n );\n});\n\nexport default ChaptersSelectionStep;\n"],"names":["ChaptersSelectionStep","memo","props","currentStep","onFormDataChange","onChapterExitWarning","formData","studentName","studentId","config","isGoalCreation","onPreSubmit","courseStream","classRatio","enrollmentType","canDeleteGoal","onDeleteGoal","isTeacherTrainingAccount","flow","useContext","MilestoneCreateContext","trackEvent","useUIContext","submitBaseMessage","buttonLabel","name","title","analyticsProps","testType","primaryChaptersList","board","major","region","chapterGoalCategory","primaryGoalCategory","goalEditFlow","isProcessing","isProcessed","useChapterListUpdate","isAtleastOneChapterAdded","useMemo","chapter","handleNext","useCallback","selectedChaptersList","searchedAndAddedChapterLength","suggestedChaptersLength","handleOnAddCustomChapter","handleOnBackButtonClick","handleBack","isChangeDetected","computeChangeDetection","GOAL_EDIT_FLOWS","WARNING_MESSAGES","jsx","BodyLayout","jsxs","FlexView","Text","ClassDetailsStep","Styled.BinIconWrapper","ArrowTooltip","IconButton","Bin2Icon","ChapterSelection","Styled.ButtonWrapper","PlusIcon","Button"],"mappings":";;;;;;;;;;;;;;;;;;;AAuBM,MAAAA,KAA4CC,EAAK,CAASC,MAAA;AACxD,QAAA;AAAA,IACJ,aAAAC;AAAA,IACA,kBAAAC;AAAA,IACA,sBAAAC;AAAA,IACA,UAAAC;AAAA,IACA,aAAAC;AAAA,IACA,WAAAC;AAAA,IACA,QAAAC;AAAA,IACA,gBAAAC;AAAA,IACA,aAAAC;AAAA,IACA,cAAAC;AAAA,IACA,YAAAC;AAAA,IACA,gBAAAC;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