Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
0ec2f85
bump client
ChristopherChudzicki Mar 25, 2026
65d0596
bump client
ChristopherChudzicki Mar 25, 2026
97b90bd
fix verified program enrollment API call to match updated client
ChristopherChudzicki Mar 25, 2026
61c2fa0
add ancestorPrograms prop for verified enrollment across program hier…
ChristopherChudzicki Mar 25, 2026
1111e4f
fix review issues: deduplicate render paths, move AncestorProgram typ…
ChristopherChudzicki Mar 25, 2026
aefff74
remove unnecessary factory overrides in enrollment display test
ChristopherChudzicki Mar 25, 2026
e094fe1
use EnrollmentModeEnum from API client instead of local redefinition
ChristopherChudzicki Mar 25, 2026
ab17767
simplify ancestor program props: ProgramAsCourseCard assembles IDs an…
ChristopherChudzicki Mar 25, 2026
41a148d
add some docstrings, minor refactor
ChristopherChudzicki Mar 25, 2026
d2da48c
remove hardcoded IDs and titles from ProgramAsCourseCard tests
ChristopherChudzicki Mar 25, 2026
230ed8a
simplify req_tree ordering test to reverse moduleCourses instead of r…
ChristopherChudzicki Mar 25, 2026
e13bc5b
improve test quality: add integration test, remove unnecessary overri…
ChristopherChudzicki Mar 25, 2026
fb303ba
fix typo: Courslike -> Courselike in docstring
ChristopherChudzicki Mar 25, 2026
07df11a
add isVerifiedEnrollmentMode helper
ChristopherChudzicki Mar 25, 2026
05f205e
use isVerifiedEnrollmentMode in legacy DashboardCard
ChristopherChudzicki Mar 25, 2026
f4c6e92
fix typo
ChristopherChudzicki Mar 25, 2026
761533f
update client
ChristopherChudzicki Mar 25, 2026
68dfe26
bump client
ChristopherChudzicki Mar 25, 2026
3985b02
invalidate program enrollments, too
ChristopherChudzicki Mar 25, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion frontends/api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"ol-test-utilities": "0.0.0"
},
"dependencies": {
"@mitodl/mitxonline-api-axios": "^2026.3.24",
"@mitodl/mitxonline-api-axios": "^2026.3.25",
"@tanstack/react-query": "^5.66.0",
"axios": "^1.12.2",
"tiny-invariant": "^1.3.3"
Expand Down
3 changes: 3 additions & 0 deletions frontends/api/src/mitxonline/hooks/enrollment/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,9 @@ const useCreateVerifiedProgramEnrollment = () => {
queryClient.invalidateQueries({
queryKey: enrollmentKeys.courseRunEnrollmentsList(),
})
queryClient.invalidateQueries({
queryKey: enrollmentKeys.programEnrollmentsList(),
})
},
})
}
Expand Down
4 changes: 2 additions & 2 deletions frontends/api/src/mitxonline/test-utils/urls.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,8 @@ const baskets = {
}

const verifiedProgramEnrollments = {
create: (programId: string, courserunId: string) =>
`${API_BASE_URL}/api/v2/verified_program_enrollments/${encodeURIComponent(programId)}/${encodeURIComponent(courserunId)}/`,
create: (courserunId: string) =>
`${API_BASE_URL}/api/v2/verified_program_enrollments/${encodeURIComponent(courserunId)}/`,
}

export {
Expand Down
2 changes: 1 addition & 1 deletion frontends/main/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"@emotion/styled": "^11.11.0",
"@floating-ui/react": "^0.27.16",
"@mitodl/course-search-utils": "^3.5.2",
"@mitodl/mitxonline-api-axios": "^2026.3.24",
"@mitodl/mitxonline-api-axios": "^2026.3.25",
"@mitodl/smoot-design": "^6.24.0",
"@mui/material": "^6.4.5",
"@mui/material-nextjs": "^6.4.3",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1209,10 +1209,7 @@ describe.each([

// Mock the enrollment endpoint
const programEnrollmentEndpoint =
mitxonline.urls.verifiedProgramEnrollments.create(
programEnrollment.program.readable_id,
run.courseware_id,
)
mitxonline.urls.verifiedProgramEnrollments.create(run.courseware_id)
setMockResponse.post(programEnrollmentEndpoint, {})

renderWithProviders(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,10 @@ import {
import { mitxUserQueries } from "api/mitxonline-hooks/user"
import { useQuery } from "@tanstack/react-query"
import { coursePageView, programPageView, programView } from "@/common/urls"
import { mitxonlineLegacyUrl } from "@/common/mitxonline"
import {
mitxonlineLegacyUrl,
isVerifiedEnrollmentMode,
} from "@/common/mitxonline"
import { useReplaceBasketItem } from "api/mitxonline-hooks/baskets"
import { EnrollmentStatus, getBestRun, getEnrollmentStatus } from "./helpers"
import {
Expand All @@ -45,12 +48,6 @@ import {
} from "@mitodl/mitxonline-api-axios/v2"
import CourseEnrollmentDialog from "@/page-components/EnrollmentDialogs/CourseEnrollmentDialog"

const EnrollmentMode = {
Audit: "audit",
Verified: "verified",
} as const
type EnrollmentMode = (typeof EnrollmentMode)[keyof typeof EnrollmentMode]

export const DashboardType = {
Course: "course",
CourseRunEnrollment: "courserun-enrollment",
Expand Down Expand Up @@ -335,7 +332,7 @@ const useEnrollmentHandler = () => {
return
}
createVerifiedProgramEnrollment.mutate(
{ courserun_id: readableId, program_id: programCoursewareId },
{ courserun_id: readableId, request_body: [programCoursewareId] },
{
onSuccess: () => {
window.location.href = href
Expand Down Expand Up @@ -688,15 +685,16 @@ const DashboardCard: React.FC<DashboardCardProps> = ({

const canUpgrade =
isCourseRunEnrollment &&
resource.data.enrollment_mode !== EnrollmentMode.Verified &&
!isVerifiedEnrollmentMode(resource.data.enrollment_mode) &&
(enrollmentRun?.is_upgradable ?? false) &&
(enrollmentRun?.upgrade_product_is_active ?? false)

// Handle enrollment click for courses
const handleEnrollmentClick = React.useCallback(() => {
if (isCourse) {
const isVerifiedProgramEnrollment =
programEnrollment?.enrollment_mode === EnrollmentMode.Verified
const isVerifiedProgramEnrollment = isVerifiedEnrollmentMode(
programEnrollment?.enrollment_mode,
)

enrollment.enroll({
course: resource.data,
Expand Down Expand Up @@ -770,7 +768,7 @@ const DashboardCard: React.FC<DashboardCardProps> = ({
</SubtitleLink>
) : null}
{isCourseRunEnrollment &&
resource.data.enrollment_mode !== EnrollmentMode.Verified &&
!isVerifiedEnrollmentMode(resource.data.enrollment_mode) &&
offerUpgrade ? (
<UpgradeBanner
data-testid="upgrade-root"
Expand Down
Loading
Loading