@cuemath/leap 3.1.6-j1 → 3.1.6
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/lib/lib.js +1 -1
- package/dist/assets/lib/lib.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 +33 -57
- 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 +21 -27
- 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 +32 -33
- 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/constants/constants.js +33 -3
- package/dist/features/cue-canvas/constants/constants.js.map +1 -1
- 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 +137 -114
- package/dist/features/cue-canvas/cue-canvas-core.js.map +1 -1
- package/dist/features/cue-canvas/cue-canvas-helpers.js +48 -38
- package/dist/features/cue-canvas/cue-canvas-helpers.js.map +1 -1
- package/dist/features/cue-canvas/cue-canvas-provider.js +21 -21
- package/dist/features/cue-canvas/cue-canvas-provider.js.map +1 -1
- package/dist/features/cue-canvas/cue-canvas.js +70 -62
- package/dist/features/cue-canvas/cue-canvas.js.map +1 -1
- package/dist/features/cue-canvas/cue-cavas-styled.js +48 -47
- package/dist/features/cue-canvas/cue-cavas-styled.js.map +1 -1
- package/dist/features/cue-canvas/hooks/use-canvas-sync-broker.js +47 -44
- package/dist/features/cue-canvas/hooks/use-canvas-sync-broker.js.map +1 -1
- package/dist/features/cue-canvas/hooks/use-config-updater.js +13 -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-height-extender.js +12 -10
- package/dist/features/cue-canvas/hooks/use-height-extender.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/color-palette.js +42 -33
- package/dist/features/cue-canvas/toolbar/color-palette.js.map +1 -1
- package/dist/features/cue-canvas/toolbar/color-picker-menu.js +28 -25
- package/dist/features/cue-canvas/toolbar/color-picker-menu.js.map +1 -1
- 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/pen-tool-menu.js +24 -35
- package/dist/features/cue-canvas/toolbar/pen-tool-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/cue-canvas/toolbar/toolbar.js +17 -18
- package/dist/features/cue-canvas/toolbar/toolbar.js.map +1 -1
- package/dist/features/cue-canvas/toolbar/whiteboard-toolbar.js +13 -11
- package/dist/features/cue-canvas/toolbar/whiteboard-toolbar.js.map +1 -1
- package/dist/features/homework/hw-card-list/api/get-homeworks.js +1 -1
- package/dist/features/homework/hw-card-list/api/get-homeworks.js.map +1 -1
- package/dist/features/homework/hw-card-list/hw-card-list-utils.js +8 -0
- package/dist/features/homework/hw-card-list/hw-card-list-utils.js.map +1 -0
- package/dist/features/homework/hw-card-list/hw-card-list-view.js +144 -112
- package/dist/features/homework/hw-card-list/hw-card-list-view.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/journey/hooks/use-home-page-journey/home-page-homeworks-mock.js +199 -262
- package/dist/features/journey/hooks/use-home-page-journey/home-page-homeworks-mock.js.map +1 -1
- package/dist/features/journey/hooks/use-home-page-journey/use-home-page-journey.js +15 -15
- package/dist/features/journey/hooks/use-home-page-journey/use-home-page-journey.js.map +1 -1
- 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/milestone/edit/comps/edit-milestone-modal/index.js +48 -47
- package/dist/features/milestone/edit/comps/edit-milestone-modal/index.js.map +1 -1
- package/dist/features/milestone/milestone-list-container/api/get-past-milestone-count.js +18 -0
- package/dist/features/milestone/milestone-list-container/api/get-past-milestone-count.js.map +1 -0
- package/dist/features/milestone/milestone-list-container/milestone-list/milestone-list.js +100 -121
- package/dist/features/milestone/milestone-list-container/milestone-list/milestone-list.js.map +1 -1
- package/dist/features/milestone/milestone-list-container/milestone-list/milestone-widget/milestone-widget-styled.js +15 -14
- package/dist/features/milestone/milestone-list-container/milestone-list/milestone-widget/milestone-widget-styled.js.map +1 -1
- package/dist/features/milestone/milestone-list-container/milestone-list-container.js +52 -51
- package/dist/features/milestone/milestone-list-container/milestone-list-container.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/features/worksheet/worksheet/worksheet-container.js +26 -26
- package/dist/features/worksheet/worksheet/worksheet-container.js.map +1 -1
- package/dist/index.d.ts +104 -35
- package/dist/index.js +323 -321
- package/dist/index.js.map +1 -1
- package/dist/static/ellipse-clip.dfb25608.svg +1 -0
- package/dist/static/lib/{polypad-4.5.4.js → polypad-4.5.4.v1.js} +8 -1
- 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-viewport.js +0 -21
- package/dist/features/hooks/use-viewport.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 +1 @@
|
|
1
|
-
{"version":3,"file":"use-home-page-journey.js","sources":["../../../../../src/features/journey/hooks/use-home-page-journey/use-home-page-journey.tsx"],"sourcesContent":["import type { INodeDataProps } from '../../../chapters-v2/comps/node-card/node-card-types';\nimport type { IChapterDataProps } from '../../../chapters/chapter/chapter-types';\nimport type { TCourseStream } from '../../../milestone/create/milestone-create-types';\nimport type { IArrowTooltipProps } from '../../../ui/arrow-tooltip/arrow-tooltip-types';\nimport type { ICoachmarkProps } from '../../use-journey/journey-context-types';\nimport type { IHomepageStartJourneyProps } from './homepage-journey-types';\n\nimport { useCallback, useEffect, useMemo, useRef } from 'react';\n\nimport ChapterItem from '../../../chapters/chapters-list/chapter-item/chapter-item';\nimport HomeworkCard from '../../../homework/homework-card';\nimport HwCardListView from '../../../homework/hw-card-list/hw-card-list-view';\nimport MilestoneListContainer from '../../../milestone/milestone-list-container/milestone-list-container';\nimport FlexView from '../../../ui/layout/flex-view';\nimport Text from '../../../ui/text/text';\nimport { JOURNEY_ID_STUDENT } from '../../journey-id/journey-id-student';\nimport { IndicatorType } from '../../use-journey/constants';\nimport { useJourney } from '../../use-journey/use-journey';\nimport { HOMEWORK_DETAILS } from './home-page-homeworks-mock';\nimport { RECENT_CHAPTERS } from './recent-chapters-mock';\nimport { ChaptersWrapper, ELementWrapper } from './styles';\nimport TooltipItem from './tooltip-item';\n\nexport const useHomePageJourney = () => {\n const journeyId = JOURNEY_ID_STUDENT.HOMEPAGE_JOURNEY;\n\n const homepageRef = useRef<HTMLDivElement>(null);\n const homeworkRef = useRef<HTMLDivElement>(null);\n const recentChaptersRef = useRef<HTMLDivElement>(null);\n const timerRefs = useRef<ReturnType<typeof setTimeout>[]>([]);\n const { nextCoachmark, setJourney, endJourney } = useJourney();\n\n const emptyFunction = useCallback(() => null, []);\n\n const handleEndJourney = useCallback(() => {\n endJourney(journeyId);\n document.body.style.overflow = 'unset';\n }, [endJourney, journeyId]);\n\n const handleNextCoachmark = useCallback(() => {\n nextCoachmark(journeyId, false, 0, true);\n }, [nextCoachmark, journeyId]);\n\n const startJourney = useCallback(\n ({ studentId, stream, userType }: IHomepageStartJourneyProps) => {\n const { title, subtext } = HOMEWORK_DETAILS[0] as INodeDataProps;\n const isStudent = userType === 'STUDENT';\n\n if (!homepageRef?.current || !homeworkRef?.current) {\n return;\n }\n\n const homepageSteps: ICoachmarkProps[] = [\n {\n originalElementToHighlightRef: homepageRef,\n isActive: false,\n type: IndicatorType.TOOLTIP,\n elementToHighlight: (\n <FlexView\n $flexGapX={2.5}\n $marginBottomX={8}\n $background=\"WHITE\"\n $widthX={47}\n $gutterX={1}\n >\n <HwCardListView\n userType={userType}\n studentId={studentId}\n isHwProcessing={false}\n hwDetails={HOMEWORK_DETAILS as INodeDataProps[]}\n onTestStart={emptyFunction}\n onNodeAttempt={emptyFunction}\n onTestPreview={emptyFunction}\n onNodeView={emptyFunction}\n onTestReview={emptyFunction}\n onNodeReview={emptyFunction}\n onNodeUnassign={emptyFunction}\n />\n <FlexView $flexRowGapX={1} ref={recentChaptersRef}>\n <Text $renderAs=\"ac4-black\" $color=\"BLACK_T_60\">\n Recent Chapters ({RECENT_CHAPTERS?.length})\n </Text>\n <ChaptersWrapper>\n {RECENT_CHAPTERS.map((chapter, idx) => (\n <ChapterItem\n key={chapter.id}\n chapter={chapter as unknown as IChapterDataProps}\n onChapterClick={emptyFunction}\n itemIndex={idx}\n />\n ))}\n </ChaptersWrapper>\n </FlexView>\n <MilestoneListContainer\n milestoneType=\"ACTIVE\"\n activeMilestoneId={''}\n activeTabId={''}\n canCreatePlan={false}\n courseStream={stream as TCourseStream}\n isClassOngoing={false}\n isStudentPresent={false}\n parentName={''}\n studentId={studentId}\n studentName={''}\n teacherName={''}\n userType={userType}\n //* Callbacks\n onAddChapter={emptyFunction}\n onAddOutcome={emptyFunction}\n onChapterClick={emptyFunction}\n onCreatePlan={emptyFunction}\n onDelete={emptyFunction}\n onDraftPublish={emptyFunction}\n onEdit={emptyFunction}\n onExpandPastMilestones={emptyFunction}\n onNodeView={emptyFunction}\n onNodeReview={emptyFunction}\n onWidgetTabSelection={emptyFunction}\n //* Resource callbacks\n onAssignResources={emptyFunction}\n onNodeReset={emptyFunction}\n onNodeUnassign={emptyFunction}\n //* Tests callbacks\n onCreateMilestoneTest={emptyFunction}\n onTestPreview={emptyFunction}\n onTestReview={emptyFunction}\n />\n </FlexView>\n ),\n indicator: {\n position: 'top',\n tooltipXCoOrdinates: 0,\n tooltipYCoOrdinates: 0,\n backgroundColor: 'BLUE_4',\n borderColor: 'BLACK',\n arrowColor: 'BLACK',\n arrowSize: 12,\n width: 264,\n tooltipItem: (\n <TooltipItem\n text={`Welcome to the all new ${isStudent ? 'learning' : 'tutoring'} homepage.`}\n buttonLabel=\"Next\"\n onButtonClick={handleNextCoachmark}\n />\n ),\n } as IArrowTooltipProps,\n },\n {\n originalElementToHighlightRef: homeworkRef,\n elementToHighlight: (\n <ELementWrapper>\n <HwCardListView\n userType={userType}\n studentId={studentId}\n isHwProcessing={false}\n hwDetails={HOMEWORK_DETAILS as INodeDataProps[]}\n onTestStart={emptyFunction}\n onNodeAttempt={emptyFunction}\n onTestPreview={emptyFunction}\n onNodeView={emptyFunction}\n onTestReview={emptyFunction}\n onNodeReview={emptyFunction}\n onNodeUnassign={emptyFunction}\n />\n </ELementWrapper>\n ),\n type: IndicatorType.TOOLTIP,\n indicator: {\n position: 'top',\n tooltipXCoOrdinates: -197,\n tooltipYCoOrdinates: -12,\n arrowXCoOrdinates: -110,\n backgroundColor: 'GREEN_4',\n borderColor: 'BLACK',\n arrowColor: 'BLACK',\n width: 264,\n arrowSize: 12,\n tooltipItem: (\n <TooltipItem\n text={`Homework is now easy to access and easy to ${\n isStudent ? 'complete' : 'review'\n }!`}\n buttonLabel=\"Next\"\n onButtonClick={handleNextCoachmark}\n />\n ),\n } as IArrowTooltipProps,\n isActive: false,\n },\n {\n originalElementToHighlightRef: homeworkRef,\n elementToHighlight: (\n <ELementWrapper>\n <HomeworkCard\n isInQueue={false}\n userType={userType}\n header={title}\n subHeader={subtext || ''}\n nodeData={HOMEWORK_DETAILS[0] as INodeDataProps}\n renderAs=\"homework\"\n studentId={studentId}\n shouldOpenOnRight={false}\n />\n </ELementWrapper>\n ),\n type: IndicatorType.TOOLTIP,\n indicator: {\n position: 'top',\n tooltipXCoOrdinates: -35,\n tooltipYCoOrdinates: -7,\n backgroundColor: 'PURPLE_4',\n borderColor: 'BLACK',\n arrowColor: 'BLACK',\n arrowXCoOrdinates: -97,\n arrowSize: 12,\n width: 264,\n tooltipItem: (\n <TooltipItem\n text=\"Track homework status and their due dates.\"\n buttonLabel=\"Next\"\n onButtonClick={handleNextCoachmark}\n />\n ),\n } as IArrowTooltipProps,\n isActive: false,\n },\n {\n originalElementToHighlightRef: homepageRef,\n elementToHighlight: (\n <ELementWrapper>\n <FlexView $flexRowGapX={1}>\n <Text $renderAs=\"ac4-black\" $color=\"BLACK_T_60\">\n Recent Chapters ({RECENT_CHAPTERS?.length})\n </Text>\n <ChaptersWrapper>\n {RECENT_CHAPTERS.map((chapter, idx) => (\n <ChapterItem\n key={chapter.id}\n chapter={chapter as unknown as IChapterDataProps}\n onChapterClick={emptyFunction}\n itemIndex={idx}\n />\n ))}\n </ChaptersWrapper>\n </FlexView>\n </ELementWrapper>\n ),\n type: IndicatorType.TOOLTIP,\n indicator: {\n position: 'top',\n tooltipXCoOrdinates: -200,\n tooltipYCoOrdinates: -10,\n backgroundColor: 'YELLOW_4',\n borderColor: 'BLACK',\n arrowColor: 'BLACK',\n arrowXCoOrdinates: -97,\n arrowSize: 12,\n width: 264,\n tooltipItem: (\n <TooltipItem\n text=\"Access all your recent chapters in one place.\"\n buttonLabel=\"Got it\"\n onButtonClick={handleEndJourney}\n />\n ),\n } as IArrowTooltipProps,\n isActive: false,\n },\n ];\n\n setJourney(journeyId, homepageSteps);\n\n const delayBeforeStart = setTimeout(() => {\n clearTimeout(delayBeforeStart);\n if (userType === 'STUDENT') {\n window.scrollTo(0, 0);\n } else {\n document.getElementById('tab-content-container')?.scrollTo(0, 0);\n }\n document.body.style.overflow = 'hidden';\n handleNextCoachmark();\n }, 200);\n\n timerRefs.current.push(delayBeforeStart); // Store to cleanup later\n },\n [handleEndJourney, emptyFunction, handleNextCoachmark, journeyId, setJourney],\n );\n\n const data = useMemo(\n () => ({\n homepageRef,\n homeworkRef,\n startJourney,\n }),\n [startJourney],\n );\n\n // Cleanup on unmount\n useEffect(() => {\n return () => {\n timerRefs.current.forEach(timer => clearTimeout(timer));\n timerRefs.current = [];\n };\n }, []);\n\n return data;\n};\n"],"names":["useHomePageJourney","journeyId","JOURNEY_ID_STUDENT","homepageRef","useRef","homeworkRef","recentChaptersRef","timerRefs","nextCoachmark","setJourney","endJourney","useJourney","emptyFunction","useCallback","handleEndJourney","handleNextCoachmark","startJourney","studentId","stream","userType","title","subtext","HOMEWORK_DETAILS","isStudent","homepageSteps","IndicatorType","jsxs","FlexView","jsx","HwCardListView","Text","_a","RECENT_CHAPTERS","ChaptersWrapper","chapter","idx","ChapterItem","MilestoneListContainer","TooltipItem","ELementWrapper","HomeworkCard","_b","delayBeforeStart","data","useMemo","useEffect","timer"],"mappings":";;;;;;;;;;;;;;;AAuBO,MAAMA,KAAqB,MAAM;AACtC,QAAMC,IAAYC,EAAmB,kBAE/BC,IAAcC,EAAuB,IAAI,GACzCC,IAAcD,EAAuB,IAAI,GACzCE,IAAoBF,EAAuB,IAAI,GAC/CG,IAAYH,EAAwC,CAAA,CAAE,GACtD,EAAE,eAAAI,GAAe,YAAAC,GAAY,YAAAC,MAAeC,EAAW,GAEvDC,IAAgBC,EAAY,MAAM,MAAM,CAAE,CAAA,GAE1CC,IAAmBD,EAAY,MAAM;AACzC,IAAAH,EAAWT,CAAS,GACX,SAAA,KAAK,MAAM,WAAW;AAAA,EAAA,GAC9B,CAACS,GAAYT,CAAS,CAAC,GAEpBc,IAAsBF,EAAY,MAAM;AAC9B,IAAAL,EAAAP,GAAW,IAAO,GAAG,EAAI;AAAA,EAAA,GACtC,CAACO,GAAeP,CAAS,CAAC,GAEvBe,IAAeH;AAAA,IACnB,CAAC,EAAE,WAAAI,GAAW,QAAAC,GAAQ,UAAAC,QAA2C;;AAC/D,YAAM,EAAE,OAAAC,GAAO,SAAAC,EAAQ,IAAIC,EAAiB,CAAC,GACvCC,IAAYJ,MAAa;AAE/B,UAAI,EAAChB,KAAA,QAAAA,EAAa,Y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ACA,cAAAW;AAAA,IAAA;AAAA,IAEF,CAACA,CAAY;AAAA,EAAA;AAIf,SAAA6B,EAAU,MACD,MAAM;AACX,IAAAtC,EAAU,QAAQ,QAAQ,CAASuC,MAAA,aAAaA,CAAK,CAAC,GACtDvC,EAAU,UAAU;EAAC,GAEtB,CAAE,CAAA,GAEEoC;AACT;"}
|
1
|
+
{"version":3,"file":"use-home-page-journey.js","sources":["../../../../../src/features/journey/hooks/use-home-page-journey/use-home-page-journey.tsx"],"sourcesContent":["import type { INodeDataProps } from '../../../chapters-v2/comps/node-card/node-card-types';\nimport type { IChapterDataProps } from '../../../chapters/chapter/chapter-types';\nimport type { TCourseStream } from '../../../milestone/create/milestone-create-types';\nimport type { IArrowTooltipProps } from '../../../ui/arrow-tooltip/arrow-tooltip-types';\nimport type { ICoachmarkProps } from '../../use-journey/journey-context-types';\nimport type { IHomepageStartJourneyProps } from './homepage-journey-types';\n\nimport { useCallback, useEffect, useMemo, useRef } from 'react';\n\nimport ChapterItem from '../../../chapters/chapters-list/chapter-item/chapter-item';\nimport HomeworkCard from '../../../homework/homework-card';\nimport HwCardListView from '../../../homework/hw-card-list/hw-card-list-view';\nimport MilestoneListContainer from '../../../milestone/milestone-list-container/milestone-list-container';\nimport FlexView from '../../../ui/layout/flex-view';\nimport Text from '../../../ui/text/text';\nimport { JOURNEY_ID_STUDENT } from '../../journey-id/journey-id-student';\nimport { IndicatorType } from '../../use-journey/constants';\nimport { useJourney } from '../../use-journey/use-journey';\nimport { HOMEWORK_DETAILS } from './home-page-homeworks-mock';\nimport { RECENT_CHAPTERS } from './recent-chapters-mock';\nimport { ChaptersWrapper, ELementWrapper } from './styles';\nimport TooltipItem from './tooltip-item';\n\nexport const useHomePageJourney = () => {\n const journeyId = JOURNEY_ID_STUDENT.HOMEPAGE_JOURNEY;\n\n const homepageRef = useRef<HTMLDivElement>(null);\n const homeworkRef = useRef<HTMLDivElement>(null);\n const recentChaptersRef = useRef<HTMLDivElement>(null);\n const timerRefs = useRef<ReturnType<typeof setTimeout>[]>([]);\n const { nextCoachmark, setJourney, endJourney } = useJourney();\n\n const emptyFunction = useCallback(() => null, []);\n\n const handleEndJourney = useCallback(() => {\n endJourney(journeyId);\n document.body.style.overflow = 'unset';\n }, [endJourney, journeyId]);\n\n const handleNextCoachmark = useCallback(() => {\n nextCoachmark(journeyId, false, 0, true);\n }, [nextCoachmark, journeyId]);\n\n const startJourney = useCallback(\n ({ studentId, stream, userType }: IHomepageStartJourneyProps) => {\n const { title = '', subtext = '' } = HOMEWORK_DETAILS.assigned_homeworks[0] || {};\n const isStudent = userType === 'STUDENT';\n\n if (!homepageRef?.current || !homeworkRef?.current) {\n return;\n }\n\n const homepageSteps: ICoachmarkProps[] = [\n {\n originalElementToHighlightRef: homepageRef,\n isActive: false,\n type: IndicatorType.TOOLTIP,\n elementToHighlight: (\n <FlexView\n $flexGapX={2.5}\n $marginBottomX={8}\n $background=\"WHITE\"\n $widthX={47}\n $gutterX={1}\n >\n <HwCardListView\n userType={userType}\n studentId={studentId}\n isHwProcessing={false}\n hwDetails={HOMEWORK_DETAILS}\n onTestStart={emptyFunction}\n onNodeAttempt={emptyFunction}\n onTestPreview={emptyFunction}\n onNodeView={emptyFunction}\n onTestReview={emptyFunction}\n onNodeReview={emptyFunction}\n onNodeUnassign={emptyFunction}\n />\n <FlexView $flexRowGapX={1} ref={recentChaptersRef}>\n <Text $renderAs=\"ac4-black\" $color=\"BLACK_T_60\">\n Recent Chapters ({RECENT_CHAPTERS?.length})\n </Text>\n <ChaptersWrapper>\n {RECENT_CHAPTERS.map((chapter, idx) => (\n <ChapterItem\n key={chapter.id}\n chapter={chapter as unknown as IChapterDataProps}\n onChapterClick={emptyFunction}\n itemIndex={idx}\n />\n ))}\n </ChaptersWrapper>\n </FlexView>\n <MilestoneListContainer\n milestoneType=\"ACTIVE\"\n activeMilestoneId={''}\n activeTabId={''}\n canCreatePlan={false}\n courseStream={stream as TCourseStream}\n isClassOngoing={false}\n isStudentPresent={false}\n parentName={''}\n studentId={studentId}\n studentName={''}\n teacherName={''}\n userType={userType}\n //* Callbacks\n onAddChapter={emptyFunction}\n onAddOutcome={emptyFunction}\n onChapterClick={emptyFunction}\n onCreatePlan={emptyFunction}\n onDelete={emptyFunction}\n onDraftPublish={emptyFunction}\n onEdit={emptyFunction}\n onExpandPastMilestones={emptyFunction}\n onNodeView={emptyFunction}\n onNodeReview={emptyFunction}\n onWidgetTabSelection={emptyFunction}\n //* Resource callbacks\n onAssignResources={emptyFunction}\n onNodeReset={emptyFunction}\n onNodeUnassign={emptyFunction}\n //* Tests callbacks\n onCreateMilestoneTest={emptyFunction}\n onTestPreview={emptyFunction}\n onTestReview={emptyFunction}\n />\n </FlexView>\n ),\n indicator: {\n position: 'top',\n tooltipXCoOrdinates: 0,\n tooltipYCoOrdinates: 0,\n backgroundColor: 'BLUE_4',\n borderColor: 'BLACK',\n arrowColor: 'BLACK',\n arrowSize: 12,\n width: 264,\n tooltipItem: (\n <TooltipItem\n text={`Welcome to the all new ${isStudent ? 'learning' : 'tutoring'} homepage.`}\n buttonLabel=\"Next\"\n onButtonClick={handleNextCoachmark}\n />\n ),\n } as IArrowTooltipProps,\n },\n {\n originalElementToHighlightRef: homeworkRef,\n elementToHighlight: (\n <ELementWrapper>\n <HwCardListView\n userType={userType}\n studentId={studentId}\n isHwProcessing={false}\n hwDetails={HOMEWORK_DETAILS}\n onTestStart={emptyFunction}\n onNodeAttempt={emptyFunction}\n onTestPreview={emptyFunction}\n onNodeView={emptyFunction}\n onTestReview={emptyFunction}\n onNodeReview={emptyFunction}\n onNodeUnassign={emptyFunction}\n />\n </ELementWrapper>\n ),\n type: IndicatorType.TOOLTIP,\n indicator: {\n position: 'top',\n tooltipXCoOrdinates: -197,\n tooltipYCoOrdinates: -12,\n arrowXCoOrdinates: -110,\n backgroundColor: 'GREEN_4',\n borderColor: 'BLACK',\n arrowColor: 'BLACK',\n width: 264,\n arrowSize: 12,\n tooltipItem: (\n <TooltipItem\n text={`Homework is now easy to access and easy to ${\n isStudent ? 'complete' : 'review'\n }!`}\n buttonLabel=\"Next\"\n onButtonClick={handleNextCoachmark}\n />\n ),\n } as IArrowTooltipProps,\n isActive: false,\n },\n {\n originalElementToHighlightRef: homeworkRef,\n elementToHighlight: (\n <ELementWrapper>\n <HomeworkCard\n isInQueue={false}\n userType={userType}\n header={title}\n subHeader={subtext || ''}\n nodeData={HOMEWORK_DETAILS.assigned_homeworks[0] as INodeDataProps}\n renderAs=\"homework\"\n studentId={studentId}\n shouldOpenOnRight={false}\n />\n </ELementWrapper>\n ),\n type: IndicatorType.TOOLTIP,\n indicator: {\n position: 'top',\n tooltipXCoOrdinates: -35,\n tooltipYCoOrdinates: -7,\n backgroundColor: 'PURPLE_4',\n borderColor: 'BLACK',\n arrowColor: 'BLACK',\n arrowXCoOrdinates: -97,\n arrowSize: 12,\n width: 264,\n tooltipItem: (\n <TooltipItem\n text=\"Track homework status and their due dates.\"\n buttonLabel=\"Next\"\n onButtonClick={handleNextCoachmark}\n />\n ),\n } as IArrowTooltipProps,\n isActive: false,\n },\n {\n originalElementToHighlightRef: homepageRef,\n elementToHighlight: (\n <ELementWrapper>\n <FlexView $flexRowGapX={1}>\n <Text $renderAs=\"ac4-black\" $color=\"BLACK_T_60\">\n Recent Chapters ({RECENT_CHAPTERS?.length})\n </Text>\n <ChaptersWrapper>\n {RECENT_CHAPTERS.map((chapter, idx) => (\n <ChapterItem\n key={chapter.id}\n chapter={chapter as unknown as IChapterDataProps}\n onChapterClick={emptyFunction}\n itemIndex={idx}\n />\n ))}\n </ChaptersWrapper>\n </FlexView>\n </ELementWrapper>\n ),\n type: IndicatorType.TOOLTIP,\n indicator: {\n position: 'top',\n tooltipXCoOrdinates: -200,\n tooltipYCoOrdinates: -10,\n backgroundColor: 'YELLOW_4',\n borderColor: 'BLACK',\n arrowColor: 'BLACK',\n arrowXCoOrdinates: -97,\n arrowSize: 12,\n width: 264,\n tooltipItem: (\n <TooltipItem\n text=\"Access all your recent chapters in one place.\"\n buttonLabel=\"Got it\"\n onButtonClick={handleEndJourney}\n />\n ),\n } as IArrowTooltipProps,\n isActive: false,\n },\n ];\n\n setJourney(journeyId, homepageSteps);\n\n const delayBeforeStart = setTimeout(() => {\n clearTimeout(delayBeforeStart);\n if (userType === 'STUDENT') {\n window.scrollTo(0, 0);\n } else {\n document.getElementById('tab-content-container')?.scrollTo(0, 0);\n }\n document.body.style.overflow = 'hidden';\n handleNextCoachmark();\n }, 200);\n\n timerRefs.current.push(delayBeforeStart); // Store to cleanup later\n },\n [handleEndJourney, emptyFunction, handleNextCoachmark, journeyId, setJourney],\n );\n\n const data = useMemo(\n () => ({\n homepageRef,\n homeworkRef,\n startJourney,\n }),\n [startJourney],\n );\n\n // Cleanup on unmount\n useEffect(() => {\n return () => {\n timerRefs.current.forEach(timer => clearTimeout(timer));\n timerRefs.current = [];\n };\n }, []);\n\n return data;\n};\n"],"names":["useHomePageJourney","journeyId","JOURNEY_ID_STUDENT","homepageRef","useRef","homeworkRef","recentChaptersRef","timerRefs","nextCoachmark","setJourney","endJourney","useJourney","emptyFunction","useCallback","handleEndJourney","handleNextCoachmark","startJourney","studentId","stream","userType","title","subtext","HOMEWORK_DETAILS","isStudent","homepageSteps","IndicatorType","jsxs","FlexView","jsx","HwCardListView","Text","_a","RECENT_CHAPTERS","ChaptersWrapper","chapter","idx","ChapterItem","MilestoneListContainer","TooltipItem","ELementWrapper","HomeworkCard","_b","delayBeforeStart","data","useMemo","useEffect","timer"],"mappings":";;;;;;;;;;;;;;;AAuBO,MAAMA,KAAqB,MAAM;AACtC,QAAMC,IAAYC,EAAmB,kBAE/BC,IAAcC,EAAuB,IAAI,GACzCC,IAAcD,EAAuB,IAAI,GACzCE,IAAoBF,EAAuB,IAAI,GAC/CG,IAAYH,EAAwC,CAAA,CAAE,GACtD,EAAE,eAAAI,GAAe,YAAAC,GAAY,YAAAC,MAAeC,EAAW,GAEvDC,IAAgBC,EAAY,MAAM,MAAM,CAAE,CAAA,G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AAU;AAAA,QACZ;AAAA,MAAA;AAGF,MAAAL,EAAWR,GAAWuB,CAAa;AAE7B,YAAAkB,IAAmB,WAAW,MAAM;;AACxC,qBAAaA,CAAgB,GACzBvB,MAAa,YACR,OAAA,SAAS,GAAG,CAAC,KAEpBY,IAAA,SAAS,eAAe,uBAAuB,MAA/C,QAAAA,EAAkD,SAAS,GAAG,IAEvD,SAAA,KAAK,MAAM,WAAW,UACXhB;SACnB,GAAG;AAEI,MAAAR,EAAA,QAAQ,KAAKmC,CAAgB;AAAA,IACzC;AAAA,IACA,CAAC5B,GAAkBF,GAAeG,GAAqBd,GAAWQ,CAAU;AAAA,EAAA,GAGxEkC,IAAOC;AAAA,IACX,OAAO;AAAA,MACL,aAAAzC;AAAA,MACA,aAAAE;AAAA,MACA,cAAAW;AAAA,IAAA;AAAA,IAEF,CAACA,CAAY;AAAA,EAAA;AAIf,SAAA6B,EAAU,MACD,MAAM;AACX,IAAAtC,EAAU,QAAQ,QAAQ,CAASuC,MAAA,aAAaA,CAAK,CAAC,GACtDvC,EAAU,UAAU;EAAC,GAEtB,CAAE,CAAA,GAEEoC;AACT;"}
|
@@ -1,34 +1,35 @@
|
|
1
|
-
import { jsxs as
|
2
|
-
import { memo as
|
3
|
-
import
|
4
|
-
import { GOAL_CATEGORY as
|
1
|
+
import { jsxs as b, Fragment as v, jsx as f } from "react/jsx-runtime";
|
2
|
+
import { memo as L, useMemo as A, useCallback as G, useEffect as S } from "react";
|
3
|
+
import E from "../../../../ui/inputs/select-input/select-input.js";
|
4
|
+
import { GOAL_CATEGORY as h } from "../../../constants.js";
|
5
5
|
import { useMilestoneContext as z } from "../../milestone-create-context.js";
|
6
6
|
import { getCurriculumStandardsFromConfig as H } from "../../milestone-create-helpers.js";
|
7
7
|
import { getGradeBoardAndMajorBasedProgramCode as P } from "../chapters-selection-step/utils.js";
|
8
|
-
import { useCatalogHelpers as
|
9
|
-
const Q =
|
8
|
+
import { useCatalogHelpers as R } from "./hooks/use-catalog-helpers.js";
|
9
|
+
const Q = L(
|
10
10
|
({
|
11
11
|
config: s,
|
12
12
|
region: t = "",
|
13
13
|
courseStream: o,
|
14
14
|
classRatio: C,
|
15
15
|
searchChapterFields: e,
|
16
|
-
getCatalogChapters:
|
16
|
+
getCatalogChapters: O,
|
17
17
|
onFormDataChange: r,
|
18
18
|
enrollmentType: u
|
19
19
|
}) => {
|
20
|
-
const { mode:
|
20
|
+
const { mode: j } = z(), {
|
21
21
|
selectedCurriculum: a = "",
|
22
22
|
selectedGrade: m = "",
|
23
23
|
selectedCourse: n = ""
|
24
|
-
} = e, { grades:
|
24
|
+
} = e, { grades: w, boards: M, majors: p } = R({
|
25
25
|
config: s,
|
26
26
|
region: t,
|
27
27
|
searchChapterFields: e,
|
28
28
|
courseStream: o,
|
29
29
|
classRatio: C,
|
30
|
-
enrollmentType: u
|
31
|
-
|
30
|
+
enrollmentType: u,
|
31
|
+
flow: "CREATE"
|
32
|
+
}), c = A(() => p.length > 1, [p]), k = G(
|
32
33
|
(d) => {
|
33
34
|
r({
|
34
35
|
searchChapterFields: {
|
@@ -38,22 +39,23 @@ const Q = w(
|
|
38
39
|
});
|
39
40
|
},
|
40
41
|
[e, r]
|
41
|
-
),
|
42
|
+
), y = G(
|
42
43
|
(d) => {
|
43
|
-
var
|
44
|
-
let
|
45
|
-
(d === "-1" || d === "0") && (
|
44
|
+
var _;
|
45
|
+
let x = e.selectedCurriculum;
|
46
|
+
(d === "-1" || d === "0") && (x = (_ = H(s, {
|
46
47
|
countryCode: t ?? "",
|
47
48
|
grade: d,
|
48
|
-
goalCategory:
|
49
|
+
goalCategory: h.SCHOOL_SUCCESS,
|
49
50
|
courseStream: o,
|
50
51
|
enrollmentType: u,
|
51
|
-
classRatio: C
|
52
|
-
|
52
|
+
classRatio: C,
|
53
|
+
flow: "CREATE"
|
54
|
+
})[0]) == null ? void 0 : _.id), r({
|
53
55
|
searchChapterFields: {
|
54
56
|
...e,
|
55
57
|
selectedGrade: d,
|
56
|
-
selectedCurriculum:
|
58
|
+
selectedCurriculum: x
|
57
59
|
}
|
58
60
|
});
|
59
61
|
},
|
@@ -66,7 +68,7 @@ const Q = w(
|
|
66
68
|
u,
|
67
69
|
C
|
68
70
|
]
|
69
|
-
),
|
71
|
+
), B = G(
|
70
72
|
(d) => {
|
71
73
|
r({
|
72
74
|
searchChapterFields: {
|
@@ -76,14 +78,14 @@ const Q = w(
|
|
76
78
|
});
|
77
79
|
},
|
78
80
|
[r, e]
|
79
|
-
), i =
|
81
|
+
), i = A(
|
80
82
|
() => P(s, {
|
81
83
|
grade: m,
|
82
84
|
board: a,
|
83
85
|
major: n,
|
84
86
|
majorsPresent: c,
|
85
87
|
countryCode: t ?? "",
|
86
|
-
selectedCategory:
|
88
|
+
selectedCategory: h.SCHOOL_SUCCESS,
|
87
89
|
courseStream: o,
|
88
90
|
enrollmentType: u
|
89
91
|
}),
|
@@ -97,34 +99,34 @@ const Q = w(
|
|
97
99
|
a,
|
98
100
|
m
|
99
101
|
]
|
100
|
-
), l =
|
101
|
-
return
|
102
|
-
l &&
|
102
|
+
), l = A(() => (i == null ? void 0 : i.program_code) ?? "", [i]);
|
103
|
+
return S(() => {
|
104
|
+
l && j === "edit" && O({
|
103
105
|
filter_type: "PROGRAM_CODE",
|
104
106
|
program_code: l
|
105
107
|
});
|
106
|
-
}, [
|
108
|
+
}, [O, j, l, c]), S(() => {
|
107
109
|
l || r({
|
108
110
|
searchedChaptersList: []
|
109
111
|
});
|
110
|
-
}, [l, r]), /* @__PURE__ */ v
|
112
|
+
}, [l, r]), /* @__PURE__ */ b(v, { children: [
|
111
113
|
/* @__PURE__ */ f(
|
112
|
-
|
114
|
+
E,
|
113
115
|
{
|
114
116
|
renderAs: "primary",
|
115
117
|
label: "Grade",
|
116
118
|
value: m,
|
117
|
-
options:
|
118
|
-
onChange:
|
119
|
+
options: w,
|
120
|
+
onChange: y,
|
119
121
|
widthX: 9,
|
120
122
|
size: "xsmall",
|
121
123
|
theme: "dark",
|
122
124
|
shape: "curved"
|
123
125
|
}
|
124
126
|
),
|
125
|
-
m && /* @__PURE__ */ v
|
127
|
+
m && /* @__PURE__ */ b(v, { children: [
|
126
128
|
/* @__PURE__ */ f(
|
127
|
-
|
129
|
+
E,
|
128
130
|
{
|
129
131
|
widthX: 18,
|
130
132
|
renderAs: "primary",
|
@@ -132,20 +134,20 @@ const Q = w(
|
|
132
134
|
theme: "dark",
|
133
135
|
size: "xsmall",
|
134
136
|
label: "Curriculum",
|
135
|
-
options:
|
137
|
+
options: M,
|
136
138
|
renderOptionsAs: "section-list",
|
137
139
|
value: a,
|
138
|
-
onChange:
|
140
|
+
onChange: k
|
139
141
|
}
|
140
142
|
),
|
141
143
|
c && /* @__PURE__ */ f(
|
142
|
-
|
144
|
+
E,
|
143
145
|
{
|
144
146
|
renderAs: "primary",
|
145
147
|
label: "Course",
|
146
148
|
options: p,
|
147
149
|
value: n,
|
148
|
-
onChange:
|
150
|
+
onChange: B,
|
149
151
|
widthX: 9,
|
150
152
|
size: "xsmall",
|
151
153
|
theme: "dark",
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"course-catalog.js","sources":["../../../../../../src/features/milestone/create/comps/add-custom-chapter/course-catalog.tsx"],"sourcesContent":["import type { ICourseCatalog } from './add-custom-chapters';\nimport type { FC } from 'react';\n\nimport { useEffect, useMemo, useCallback, memo } from 'react';\n\nimport SelectInput from '../../../../ui/inputs/select-input/select-input';\nimport { GOAL_CATEGORY } from '../../../constants';\nimport { useMilestoneContext } from '../../milestone-create-context';\nimport { getCurriculumStandardsFromConfig } from '../../milestone-create-helpers';\nimport { getGradeBoardAndMajorBasedProgramCode } from '../chapters-selection-step/utils';\nimport { useCatalogHelpers } from './hooks/use-catalog-helpers';\n\nconst CourseCatalog: FC<ICourseCatalog> = memo(\n ({\n config,\n region = '',\n courseStream,\n classRatio,\n searchChapterFields,\n getCatalogChapters,\n onFormDataChange,\n enrollmentType,\n }) => {\n const { mode } = useMilestoneContext();\n\n const {\n selectedCurriculum = '',\n selectedGrade = '',\n selectedCourse = '',\n } = searchChapterFields;\n\n const { grades, boards, majors } = useCatalogHelpers({\n config,\n region,\n searchChapterFields,\n courseStream,\n classRatio,\n enrollmentType,\n });\n\n const majorsPresent = useMemo(() => majors.length > 1, [majors]);\n\n const handleCurriculumChange = useCallback(\n (curriculumValue: string) => {\n onFormDataChange({\n searchChapterFields: {\n ...searchChapterFields,\n selectedCurriculum: curriculumValue,\n },\n });\n },\n [searchChapterFields, onFormDataChange],\n );\n\n const handleGradeChange = useCallback(\n (gradeValue: string) => {\n let updatedCurriculum = searchChapterFields.selectedCurriculum;\n\n if (gradeValue === '-1' || gradeValue === '0') {\n const currentGradeBoards = getCurriculumStandardsFromConfig(config, {\n countryCode: region ?? '',\n grade: gradeValue,\n goalCategory: GOAL_CATEGORY.SCHOOL_SUCCESS,\n courseStream,\n enrollmentType,\n classRatio,\n });\n\n updatedCurriculum = currentGradeBoards[0]?.id;\n }\n\n onFormDataChange({\n searchChapterFields: {\n ...searchChapterFields,\n selectedGrade: gradeValue,\n selectedCurriculum: updatedCurriculum,\n },\n });\n },\n [\n searchChapterFields,\n onFormDataChange,\n config,\n region,\n courseStream,\n enrollmentType,\n classRatio,\n ],\n );\n\n const handleMajorChange = useCallback(\n (majorValue: string) => {\n onFormDataChange({\n searchChapterFields: {\n ...searchChapterFields,\n selectedCourse: majorValue,\n },\n });\n },\n [onFormDataChange, searchChapterFields],\n );\n\n const programInfo = useMemo(\n () =>\n getGradeBoardAndMajorBasedProgramCode(config, {\n grade: selectedGrade,\n board: selectedCurriculum,\n major: selectedCourse,\n majorsPresent,\n countryCode: region ?? '',\n selectedCategory: GOAL_CATEGORY.SCHOOL_SUCCESS,\n courseStream,\n enrollmentType,\n }),\n [\n config,\n courseStream,\n enrollmentType,\n majorsPresent,\n region,\n selectedCourse,\n selectedCurriculum,\n selectedGrade,\n ],\n );\n\n const programCode = useMemo(() => programInfo?.program_code ?? '', [programInfo]);\n\n useEffect(() => {\n if (programCode && mode === 'edit') {\n getCatalogChapters({\n filter_type: 'PROGRAM_CODE',\n program_code: programCode,\n });\n }\n }, [getCatalogChapters, mode, programCode, majorsPresent]);\n\n useEffect(() => {\n if (!programCode) {\n onFormDataChange({\n searchedChaptersList: [],\n });\n }\n }, [programCode, onFormDataChange]);\n\n return (\n <>\n <SelectInput\n renderAs=\"primary\"\n label=\"Grade\"\n value={selectedGrade}\n options={grades}\n onChange={handleGradeChange}\n widthX={9}\n size=\"xsmall\"\n theme=\"dark\"\n shape=\"curved\"\n />\n\n {selectedGrade && (\n <>\n <SelectInput\n widthX={18}\n renderAs=\"primary\"\n shape=\"curved\"\n theme=\"dark\"\n size=\"xsmall\"\n label=\"Curriculum\"\n options={boards}\n renderOptionsAs=\"section-list\"\n value={selectedCurriculum}\n onChange={handleCurriculumChange}\n />\n\n {majorsPresent && (\n <SelectInput\n renderAs=\"primary\"\n label=\"Course\"\n options={majors}\n value={selectedCourse}\n onChange={handleMajorChange}\n widthX={9}\n size=\"xsmall\"\n theme=\"dark\"\n shape=\"curved\"\n />\n )}\n </>\n )}\n </>\n );\n },\n);\n\nexport default CourseCatalog;\n"],"names":["CourseCatalog","memo","config","region","courseStream","classRatio","searchChapterFields","getCatalogChapters","onFormDataChange","enrollmentType","mode","useMilestoneContext","selectedCurriculum","selectedGrade","selectedCourse","grades","boards","majors","useCatalogHelpers","majorsPresent","useMemo","handleCurriculumChange","useCallback","curriculumValue","handleGradeChange","gradeValue","updatedCurriculum","_a","getCurriculumStandardsFromConfig","GOAL_CATEGORY","handleMajorChange","majorValue","programInfo","getGradeBoardAndMajorBasedProgramCode","programCode","useEffect","jsxs","Fragment","jsx","SelectInput"],"mappings":";;;;;;;;AAYA,MAAMA,IAAoCC;AAAA,EACxC,CAAC;AAAA,IACC,QAAAC;AAAA,IACA,QAAAC,IAAS;AAAA,IACT,cAAAC;AAAA,IACA,YAAAC;AAAA,IACA,qBAAAC;AAAA,IACA,oBAAAC;AAAA,IACA,kBAAAC;AAAA,IACA,gBAAAC;AAAA,EAAA,MACI;AACE,UAAA,EAAE,MAAAC,MAASC,KAEX;AAAA,MACJ,oBAAAC,IAAqB;AAAA,MACrB,eAAAC,IAAgB;AAAA,MAChB,gBAAAC,IAAiB;AAAA,IACf,IAAAR,GAEE,EAAE,QAAAS,GAAQ,QAAAC,GAAQ,QAAAC,EAAA,IAAWC,EAAkB;AAAA,MACnD,QAAAhB;AAAA,MACA,QAAAC;AAAA,MACA,qBAAAG;AAAA,MACA,cAAAF;AAAA,MACA,YAAAC;AAAA,MACA,gBAAAI;AAAA,IAAA,
|
1
|
+
{"version":3,"file":"course-catalog.js","sources":["../../../../../../src/features/milestone/create/comps/add-custom-chapter/course-catalog.tsx"],"sourcesContent":["import type { ICourseCatalog } from './add-custom-chapters';\nimport type { FC } from 'react';\n\nimport { useEffect, useMemo, useCallback, memo } from 'react';\n\nimport SelectInput from '../../../../ui/inputs/select-input/select-input';\nimport { GOAL_CATEGORY } from '../../../constants';\nimport { useMilestoneContext } from '../../milestone-create-context';\nimport { getCurriculumStandardsFromConfig } from '../../milestone-create-helpers';\nimport { getGradeBoardAndMajorBasedProgramCode } from '../chapters-selection-step/utils';\nimport { useCatalogHelpers } from './hooks/use-catalog-helpers';\n\nconst CourseCatalog: FC<ICourseCatalog> = memo(\n ({\n config,\n region = '',\n courseStream,\n classRatio,\n searchChapterFields,\n getCatalogChapters,\n onFormDataChange,\n enrollmentType,\n }) => {\n const { mode } = useMilestoneContext();\n\n const {\n selectedCurriculum = '',\n selectedGrade = '',\n selectedCourse = '',\n } = searchChapterFields;\n\n const { grades, boards, majors } = useCatalogHelpers({\n config,\n region,\n searchChapterFields,\n courseStream,\n classRatio,\n enrollmentType,\n flow: 'CREATE',\n });\n\n const majorsPresent = useMemo(() => majors.length > 1, [majors]);\n\n const handleCurriculumChange = useCallback(\n (curriculumValue: string) => {\n onFormDataChange({\n searchChapterFields: {\n ...searchChapterFields,\n selectedCurriculum: curriculumValue,\n },\n });\n },\n [searchChapterFields, onFormDataChange],\n );\n\n const handleGradeChange = useCallback(\n (gradeValue: string) => {\n let updatedCurriculum = searchChapterFields.selectedCurriculum;\n\n if (gradeValue === '-1' || gradeValue === '0') {\n const currentGradeBoards = getCurriculumStandardsFromConfig(config, {\n countryCode: region ?? '',\n grade: gradeValue,\n goalCategory: GOAL_CATEGORY.SCHOOL_SUCCESS,\n courseStream,\n enrollmentType,\n classRatio,\n flow: 'CREATE',\n });\n\n updatedCurriculum = currentGradeBoards[0]?.id;\n }\n\n onFormDataChange({\n searchChapterFields: {\n ...searchChapterFields,\n selectedGrade: gradeValue,\n selectedCurriculum: updatedCurriculum,\n },\n });\n },\n [\n searchChapterFields,\n onFormDataChange,\n config,\n region,\n courseStream,\n enrollmentType,\n classRatio,\n ],\n );\n\n const handleMajorChange = useCallback(\n (majorValue: string) => {\n onFormDataChange({\n searchChapterFields: {\n ...searchChapterFields,\n selectedCourse: majorValue,\n },\n });\n },\n [onFormDataChange, searchChapterFields],\n );\n\n const programInfo = useMemo(\n () =>\n getGradeBoardAndMajorBasedProgramCode(config, {\n grade: selectedGrade,\n board: selectedCurriculum,\n major: selectedCourse,\n majorsPresent,\n countryCode: region ?? '',\n selectedCategory: GOAL_CATEGORY.SCHOOL_SUCCESS,\n courseStream,\n enrollmentType,\n }),\n [\n config,\n courseStream,\n enrollmentType,\n majorsPresent,\n region,\n selectedCourse,\n selectedCurriculum,\n selectedGrade,\n ],\n );\n\n const programCode = useMemo(() => programInfo?.program_code ?? '', [programInfo]);\n\n useEffect(() => {\n if (programCode && mode === 'edit') {\n getCatalogChapters({\n filter_type: 'PROGRAM_CODE',\n program_code: programCode,\n });\n }\n }, [getCatalogChapters, mode, programCode, majorsPresent]);\n\n useEffect(() => {\n if (!programCode) {\n onFormDataChange({\n searchedChaptersList: [],\n });\n }\n }, [programCode, onFormDataChange]);\n\n return (\n <>\n <SelectInput\n renderAs=\"primary\"\n label=\"Grade\"\n value={selectedGrade}\n options={grades}\n onChange={handleGradeChange}\n widthX={9}\n size=\"xsmall\"\n theme=\"dark\"\n shape=\"curved\"\n />\n\n {selectedGrade && (\n <>\n <SelectInput\n widthX={18}\n renderAs=\"primary\"\n shape=\"curved\"\n theme=\"dark\"\n size=\"xsmall\"\n label=\"Curriculum\"\n options={boards}\n renderOptionsAs=\"section-list\"\n value={selectedCurriculum}\n onChange={handleCurriculumChange}\n />\n\n {majorsPresent && (\n <SelectInput\n renderAs=\"primary\"\n label=\"Course\"\n options={majors}\n value={selectedCourse}\n onChange={handleMajorChange}\n widthX={9}\n size=\"xsmall\"\n theme=\"dark\"\n shape=\"curved\"\n />\n )}\n </>\n )}\n </>\n );\n },\n);\n\nexport default CourseCatalog;\n"],"names":["CourseCatalog","memo","config","region","courseStream","classRatio","searchChapterFields","getCatalogChapters","onFormDataChange","enrollmentType","mode","useMilestoneContext","selectedCurriculum","selectedGrade","selectedCourse","grades","boards","majors","useCatalogHelpers","majorsPresent","useMemo","handleCurriculumChange","useCallback","curriculumValue","handleGradeChange","gradeValue","updatedCurriculum","_a","getCurriculumStandardsFromConfig","GOAL_CATEGORY","handleMajorChange","majorValue","programInfo","getGradeBoardAndMajorBasedProgramCode","programCode","useEffect","jsxs","Fragment","jsx","SelectInput"],"mappings":";;;;;;;;AAYA,MAAMA,IAAoCC;AAAA,EACxC,CAAC;AAAA,IACC,QAAAC;AAAA,IACA,QAAAC,IAAS;AAAA,IACT,cAAAC;AAAA,IACA,YAAAC;AAAA,IACA,qBAAAC;AAAA,IACA,oBAAAC;AAAA,IACA,kBAAAC;AAAA,IACA,gBAAAC;AAAA,EAAA,MACI;AACE,UAAA,EAAE,MAAAC,MAASC,KAEX;AAAA,MACJ,oBAAAC,IAAqB;AAAA,MACrB,eAAAC,IAAgB;AAAA,MAChB,gBAAAC,IAAiB;AAAA,IACf,IAAAR,GAEE,EAAE,QAAAS,GAAQ,QAAAC,GAAQ,QAAAC,EAAA,IAAWC,EAAkB;AAAA,MACnD,QAAAhB;AAAA,MAC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AA,YAChB,OAAOJ;AAAA,YACP,UAAUS;AAAA,UAAA;AAAA,QACZ;AAAA,QAECF,KACC,gBAAAmB;AAAA,UAACC;AAAA,UAAA;AAAA,YACC,UAAS;AAAA,YACT,OAAM;AAAA,YACN,SAAStB;AAAA,YACT,OAAOH;AAAA,YACP,UAAUgB;AAAA,YACV,QAAQ;AAAA,YACR,MAAK;AAAA,YACL,OAAM;AAAA,YACN,OAAM;AAAA,UAAA;AAAA,QACR;AAAA,MAAA,GAEJ;AAAA,IAEJ,EAAA,CAAA;AAAA,EAEJ;AACF;"}
|
package/dist/features/milestone/create/comps/add-custom-chapter/hooks/use-catalog-helpers.js
CHANGED
@@ -1,39 +1,41 @@
|
|
1
1
|
import { useMemo as t } from "react";
|
2
|
-
import { GOAL_CATEGORY as
|
3
|
-
import { getGradesBasedOnGoalAvailability as
|
4
|
-
import { getCategorizedCurriculumStandards as
|
5
|
-
const
|
2
|
+
import { GOAL_CATEGORY as S } from "../../../../constants.js";
|
3
|
+
import { getGradesBasedOnGoalAvailability as e, getMajorsFromConfigBasedOnBoardAndGrade as m } from "../../../milestone-create-helpers.js";
|
4
|
+
import { getCategorizedCurriculumStandards as B } from "../../class-details-step/class-details-utils.js";
|
5
|
+
const b = ({
|
6
6
|
config: r,
|
7
|
-
searchChapterFields:
|
8
|
-
region:
|
7
|
+
searchChapterFields: G,
|
8
|
+
region: s,
|
9
9
|
courseStream: d,
|
10
|
-
classRatio:
|
11
|
-
enrollmentType: a
|
10
|
+
classRatio: o,
|
11
|
+
enrollmentType: a,
|
12
|
+
flow: O
|
12
13
|
}) => {
|
13
|
-
const { selectedCurriculum:
|
14
|
-
() =>
|
15
|
-
countryCode:
|
14
|
+
const { selectedCurriculum: u = "", selectedGrade: C = "" } = G, g = t(() => e(r, "SCHOOL_SUCCESS", d, a), [r, d, a]), i = t(
|
15
|
+
() => B(r, {
|
16
|
+
countryCode: s ?? "",
|
16
17
|
grade: C,
|
17
|
-
goalCategory:
|
18
|
+
goalCategory: S.SCHOOL_SUCCESS,
|
18
19
|
courseStream: d,
|
19
|
-
classRatio:
|
20
|
-
enrollmentType: a
|
20
|
+
classRatio: o,
|
21
|
+
enrollmentType: a,
|
22
|
+
flow: O
|
21
23
|
}),
|
22
|
-
[r,
|
23
|
-
),
|
24
|
+
[r, s, C, d, o, a, O]
|
25
|
+
), A = t(() => m(
|
24
26
|
r,
|
25
|
-
|
27
|
+
u,
|
26
28
|
C,
|
27
29
|
d,
|
28
30
|
a
|
29
|
-
), [C, a,
|
31
|
+
), [C, a, u, r, d]);
|
30
32
|
return {
|
31
|
-
grades:
|
32
|
-
boards:
|
33
|
-
majors:
|
33
|
+
grades: g,
|
34
|
+
boards: i,
|
35
|
+
majors: A
|
34
36
|
};
|
35
37
|
};
|
36
38
|
export {
|
37
|
-
|
39
|
+
b as useCatalogHelpers
|
38
40
|
};
|
39
41
|
//# sourceMappingURL=use-catalog-helpers.js.map
|
package/dist/features/milestone/create/comps/add-custom-chapter/hooks/use-catalog-helpers.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"use-catalog-helpers.js","sources":["../../../../../../../src/features/milestone/create/comps/add-custom-chapter/hooks/use-catalog-helpers.ts"],"sourcesContent":["import type { ISectionOption } from '../../../../../ui/section-list/section-list-types';\nimport type {\n IMilestoneConfig,\n ISearchChapterFields,\n TCourseStream,\n TCurriculumStandardOption,\n TEnrollmentTypes,\n} from '../../../milestone-create-types';\n\nimport { useMemo } from 'react';\n\nimport { GOAL_CATEGORY } from '../../../../constants';\nimport {\n getGradesBasedOnGoalAvailability,\n getMajorsFromConfigBasedOnBoardAndGrade,\n} from '../../../milestone-create-helpers';\nimport { getCategorizedCurriculumStandards } from '../../class-details-step/class-details-utils';\n\ntype TOptions = { id: string; label: string };\n\ninterface IUseCatalogHelpers {\n (args: {\n config: IMilestoneConfig;\n searchChapterFields: Partial<ISearchChapterFields>;\n region: string;\n courseStream: TCourseStream;\n classRatio: number;\n enrollmentType: TEnrollmentTypes;\n }): {\n grades: TOptions[];\n boards: ISectionOption<TCurriculumStandardOption>[];\n majors: TOptions[];\n };\n}\n\nconst useCatalogHelpers: IUseCatalogHelpers = ({\n config,\n searchChapterFields,\n region,\n courseStream,\n classRatio,\n enrollmentType,\n}) => {\n const { selectedCurriculum = '', selectedGrade = '' } = searchChapterFields;\n\n const grades = useMemo(() => {\n //* We don't allow to add custom chapters to TEST_PREP & ENRICHMENT\n return getGradesBasedOnGoalAvailability(config, 'SCHOOL_SUCCESS', courseStream, enrollmentType);\n }, [config, courseStream, enrollmentType]);\n\n const boards = useMemo(\n () =>\n getCategorizedCurriculumStandards(config, {\n countryCode: region ?? '',\n grade: selectedGrade,\n goalCategory: GOAL_CATEGORY.SCHOOL_SUCCESS,\n courseStream,\n classRatio,\n enrollmentType,\n }),\n [config, region, selectedGrade, courseStream, classRatio, enrollmentType],\n );\n\n const majors = useMemo(() => {\n return getMajorsFromConfigBasedOnBoardAndGrade(\n config,\n selectedCurriculum,\n selectedGrade,\n courseStream,\n enrollmentType,\n );\n }, [selectedGrade, enrollmentType, selectedCurriculum, config, courseStream]);\n\n return {\n grades,\n boards,\n majors,\n };\n};\n\nexport { useCatalogHelpers };\n"],"names":["useCatalogHelpers","config","searchChapterFields","region","courseStream","classRatio","enrollmentType","selectedCurriculum","selectedGrade","grades","useMemo","getGradesBasedOnGoalAvailability","boards","getCategorizedCurriculumStandards","GOAL_CATEGORY","majors","getMajorsFromConfigBasedOnBoardAndGrade"],"mappings":";;;;
|
1
|
+
{"version":3,"file":"use-catalog-helpers.js","sources":["../../../../../../../src/features/milestone/create/comps/add-custom-chapter/hooks/use-catalog-helpers.ts"],"sourcesContent":["import type { ISectionOption } from '../../../../../ui/section-list/section-list-types';\nimport type {\n IMilestoneConfig,\n ISearchChapterFields,\n TCourseStream,\n TCurriculumStandardOption,\n TEnrollmentTypes,\n TMilestoneFormFlow,\n} from '../../../milestone-create-types';\n\nimport { useMemo } from 'react';\n\nimport { GOAL_CATEGORY } from '../../../../constants';\nimport {\n getGradesBasedOnGoalAvailability,\n getMajorsFromConfigBasedOnBoardAndGrade,\n} from '../../../milestone-create-helpers';\nimport { getCategorizedCurriculumStandards } from '../../class-details-step/class-details-utils';\n\ntype TOptions = { id: string; label: string };\n\ninterface IUseCatalogHelpers {\n (args: {\n config: IMilestoneConfig;\n searchChapterFields: Partial<ISearchChapterFields>;\n region: string;\n courseStream: TCourseStream;\n classRatio: number;\n enrollmentType: TEnrollmentTypes;\n flow?: TMilestoneFormFlow | null;\n }): {\n grades: TOptions[];\n boards: ISectionOption<TCurriculumStandardOption>[];\n majors: TOptions[];\n };\n}\n\nconst useCatalogHelpers: IUseCatalogHelpers = ({\n config,\n searchChapterFields,\n region,\n courseStream,\n classRatio,\n enrollmentType,\n flow,\n}) => {\n const { selectedCurriculum = '', selectedGrade = '' } = searchChapterFields;\n\n const grades = useMemo(() => {\n //* We don't allow to add custom chapters to TEST_PREP & ENRICHMENT\n return getGradesBasedOnGoalAvailability(config, 'SCHOOL_SUCCESS', courseStream, enrollmentType);\n }, [config, courseStream, enrollmentType]);\n\n const boards = useMemo(\n () =>\n getCategorizedCurriculumStandards(config, {\n countryCode: region ?? '',\n grade: selectedGrade,\n goalCategory: GOAL_CATEGORY.SCHOOL_SUCCESS,\n courseStream,\n classRatio,\n enrollmentType,\n flow,\n }),\n [config, region, selectedGrade, courseStream, classRatio, enrollmentType, flow],\n );\n\n const majors = useMemo(() => {\n return getMajorsFromConfigBasedOnBoardAndGrade(\n config,\n selectedCurriculum,\n selectedGrade,\n courseStream,\n enrollmentType,\n );\n }, [selectedGrade, enrollmentType, selectedCurriculum, config, courseStream]);\n\n return {\n grades,\n boards,\n majors,\n };\n};\n\nexport { useCatalogHelpers };\n"],"names":["useCatalogHelpers","config","searchChapterFields","region","courseStream","classRatio","enrollmentType","flow","selectedCurriculum","selectedGrade","grades","useMemo","getGradesBasedOnGoalAvailability","boards","getCategorizedCurriculumStandards","GOAL_CATEGORY","majors","getMajorsFromConfigBasedOnBoardAndGrade"],"mappings":";;;;AAqCA,MAAMA,IAAwC,CAAC;AAAA,EAC7C,QAAAC;AAAA,EACA,qBAAAC;AAAA,EACA,QAAAC;AAAA,EACA,cAAAC;AAAA,EACA,YAAAC;AAAA,EACA,gBAAAC;AAAA,EACA,MAAAC;AACF,MAAM;AACJ,QAAM,EAAE,oBAAAC,IAAqB,IAAI,eAAAC,IAAgB,OAAOP,GAElDQ,IAASC,EAAQ,MAEdC,EAAiCX,GAAQ,kBAAkBG,GAAcE,CAAc,GAC7F,CAACL,GAAQG,GAAcE,CAAc,CAAC,GAEnCO,IAASF;AAAA,IACb,MACEG,EAAkCb,GAAQ;AAAA,MACxC,aAAaE,KAAU;AAAA,MACvB,OAAOM;AAAA,MACP,cAAcM,EAAc;AAAA,MAC5B,cAAAX;AAAA,MACA,YAAAC;AAAA,MACA,gBAAAC;AAAA,MACA,MAAAC;AAAA,IAAA,CACD;AAAA,IACH,CAACN,GAAQE,GAAQM,GAAeL,GAAcC,GAAYC,GAAgBC,CAAI;AAAA,EAAA,GAG1ES,IAASL,EAAQ,MACdM;AAAA,IACLhB;AAAA,IACAO;AAAA,IACAC;AAAA,IACAL;AAAA,IACAE;AAAA,EAAA,GAED,CAACG,GAAeH,GAAgBE,GAAoBP,GAAQG,CAAY,CAAC;AAErE,SAAA;AAAA,IACL,QAAAM;AAAA,IACA,QAAAG;AAAA,IACA,QAAAG;AAAA,EAAA;AAEJ;"}
|
@@ -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,MAASC,KAEX,EAAE,qBAAAC,GAAqB,OAAAC,GAAO,OAAAC,GAAO,UAAAC,GAAU,QAAAC,GAAQ,qBAAAC,EAAwB,IAAAX,GAC/E,EAAE,qBAAAY,EAAA,IAAwBN,KAAuB,IAEjDO,IAAyBC;AAAA,IAC7B,CAACC,MAAqB;AACpB,YAAMC,IAAmBC,EAA4B;AAAA,QACnD,UAAAF;AAAA,QACA,QAAAhB;AAAA,QACA,cAAAG;AAAA,QACA,gBAAAC;AAAA,MAAA,CACD;AAEgB,MAAAL,EAAA;AAAA,QACf,qBAAqB;AAAA,UACnB,qBAAqBkB;AAAA,QACvB;AAAA,MAAA,CACD;AAAA,IACH;AAAA,IACA,CAACjB,GAAQG,GAAcC,GAAgBL,CAAgB;AAAA,EAAA,GAGnDoB,IAAwBJ;AAAA,IAC5B,CAACC,MAAqB;AAChB,UAAAA,OAAaH,KAAA,gBAAAA,EAAqB,WAAkB,QAAA;AAIxD,MAFyBO,EAAuBR,GAAqBC,CAAmB,IAG/DX,KAAA,QAAAA,EAAA;AAAA,QACrB,aAAamB,EAAiB;AAAA,QAC9B,WAAW,MAAM;AACf,UAAAP,EAAuBE,CAAQ;AAAA,QACjC;AAAA,MAAA,KAGFF,EAAuBE,CAAQ;AAAA,IAEnC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