Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
5 changes: 5 additions & 0 deletions RELEASE.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
Release Notes
=============

Version 0.58.2
--------------

- use v3 enrollments endpoint on the dashboard (#3049)

Version 0.58.1 (Released March 18, 2026)
--------------

Expand Down
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.12",
"@mitodl/mitxonline-api-axios": "^2026.3.17",
"@tanstack/react-query": "^5.66.0",
"axios": "^1.12.2",
"tiny-invariant": "^1.3.3"
Expand Down
6 changes: 3 additions & 3 deletions frontends/api/src/mitxonline/hooks/enrollment/queries.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { queryOptions } from "@tanstack/react-query"
import type {
CourseRunEnrollmentRequestV2,
CourseRunEnrollmentV3,
V3UserProgramEnrollment,
} from "@mitodl/mitxonline-api-axios/v2"

Expand All @@ -26,9 +26,9 @@ const enrollmentQueries = {
courseRunEnrollmentsList: () =>
queryOptions({
queryKey: enrollmentKeys.courseRunEnrollmentsList(),
queryFn: async (): Promise<CourseRunEnrollmentRequestV2[]> => {
queryFn: async (): Promise<CourseRunEnrollmentV3[]> => {
return courseRunEnrollmentsApi
.userEnrollmentsListV2()
.userEnrollmentsListV3()
.then((res) => res.data)
},
}),
Expand Down
76 changes: 9 additions & 67 deletions frontends/api/src/mitxonline/test-utils/factories/enrollment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { faker } from "@faker-js/faker/locale/en"
import { mergeOverrides } from "ol-test-utilities"
import type { PartialFactory } from "ol-test-utilities"
import type {
CourseRunEnrollmentRequestV2,
CourseRunEnrollmentV3,
CourseRunGrade,
V3UserProgramEnrollment,
} from "@mitodl/mitxonline-api-axios/v2"
Expand All @@ -29,21 +29,20 @@ const grade: PartialFactory<CourseRunGrade> = (overrides = {}) => {
return mergeOverrides<CourseRunGrade>(defaults, overrides)
}

const courseEnrollment: PartialFactory<CourseRunEnrollmentRequestV2> = (
const courseEnrollment: PartialFactory<CourseRunEnrollmentV3> = (
overrides = {},
) => {
const title =
overrides.run?.title ?? overrides.run?.course?.title ?? faker.word.words(3)

const defaults: CourseRunEnrollmentRequestV2 = {
const defaults: CourseRunEnrollmentV3 = {
id: uniqueEnrollmentId.enforce(() => faker.number.int()),
b2b_contract_id: null, // Default to personal enrollment (not B2B)
b2b_organization_id: null, // Default to personal enrollment (not B2B)
certificate: {
uuid: faker.string.uuid(),
link: faker.internet.url(),
},
approved_flexible_price_exists: faker.datatype.boolean(),
grades: [],
enrollment_mode: faker.helpers.arrayElement(["audit", "verified"]),
edx_emails_subscription: faker.datatype.boolean(),
Expand All @@ -62,75 +61,18 @@ const courseEnrollment: PartialFactory<CourseRunEnrollmentRequestV2> = (
run_tag: faker.lorem.word(),
live: faker.datatype.boolean(),
course_number: faker.lorem.word(),
approved_flexible_price_exists: faker.datatype.boolean(),
products: [
{
id: faker.number.int(),
price: faker.commerce.price(),
description: faker.lorem.sentence(),
is_active: faker.datatype.boolean(),
},
],
upgrade_product_id: faker.number.int(),
upgrade_product_price: faker.commerce.price(),
upgrade_product_is_active: faker.datatype.boolean(),
course: {
id: uniqueCourseId.enforce(() => faker.number.int()),
title,
readable_id: faker.lorem.slug(),
next_run_id: faker.number.int(),
departments: [
{
name: faker.company.name(),
},
],
page: {
page_url: faker.internet.url(),
feature_image_src: faker.image.url(),
description: faker.lorem.paragraph(),
live: faker.datatype.boolean(),
length: `${faker.number.int({ min: 1, max: 12 })} weeks`,
effort: `${faker.number.int({ min: 1, max: 10 })} hours/week`,
financial_assistance_form_url: faker.internet.url(),
current_price: faker.number.int({ min: 0, max: 1000 }),
instructors: [
{
name: faker.person.fullName(),
bio: faker.lorem.paragraph(),
},
],
},
programs: null,
topics: faker.helpers.multiple(
() => ({ name: faker.lorem.word(), id: faker.number.int() }),
{ count: { min: 0, max: 5 } },
),
certificate_type: faker.helpers.arrayElement([
"completion",
"verified",
"professional",
"micromasters",
]),
required_prerequisites: faker.datatype.boolean(),
duration: `${faker.number.int({ min: 4, max: 16 })} weeks`,
min_weeks: faker.number.int({ min: 4, max: 8 }),
max_weeks: faker.number.int({ min: 12, max: 20 }),
min_price: faker.number.int({ min: 0, max: 500 }),
max_price: faker.number.int({ min: 500, max: 2000 }),
time_commitment: `${faker.number.int({ min: 2, max: 15 })} hours per week`,
availability: faker.helpers.arrayElement([
"current",
"starting_soon",
"upcoming",
"archived",
]),
min_weekly_hours: faker.number.int({ min: 2, max: 5 }).toString(),
max_weekly_hours: faker.number.int({ min: 8, max: 15 }).toString(),
include_in_learn_catalog: faker.datatype.boolean({ probability: 0.8 }),
ingest_content_files_for_ai: faker.datatype.boolean({
probability: 0.3,
}),
type: "course",
},
},
}
return mergeOverrides<CourseRunEnrollmentRequestV2>(defaults, overrides)
return mergeOverrides<CourseRunEnrollmentV3>(defaults, overrides)
}

const programEnrollmentV3: PartialFactory<V3UserProgramEnrollment> = (
Expand All @@ -152,7 +94,7 @@ const programEnrollmentV3: PartialFactory<V3UserProgramEnrollment> = (
}

// Not paginated
const courseEnrollments = (count: number): CourseRunEnrollmentRequestV2[] => {
const courseEnrollments = (count: number): CourseRunEnrollmentV3[] => {
return new Array(count).fill(null).map(() => courseEnrollment())
}

Expand Down
1 change: 1 addition & 0 deletions frontends/api/src/mitxonline/test-utils/urls.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ const enrollment = {
`${API_BASE_URL}/api/v1/enrollments/${id ? `${id}/` : ""}`,
enrollmentsListV1: () => `${API_BASE_URL}/api/v1/enrollments/`,
enrollmentsListV2: () => `${API_BASE_URL}/api/v2/enrollments/`,
enrollmentsListV3: () => `${API_BASE_URL}/api/v3/enrollments/`,
}

const programEnrollments = {
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.12",
"@mitodl/mitxonline-api-axios": "^2026.3.17",
"@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 @@ -24,7 +24,7 @@ const makeGrade = factories.enrollment.grade

describe("ContractContent", () => {
beforeEach(() => {
setMockResponse.get(urls.enrollment.enrollmentsListV2(), [])
setMockResponse.get(urls.enrollment.enrollmentsListV3(), [])
setMockResponse.get(urls.programEnrollments.enrollmentsListV3(), [])
setMockResponse.get(urls.contracts.contractsList(), [])
})
Expand Down Expand Up @@ -224,7 +224,7 @@ describe("ContractContent", () => {
}),
]
// Override the default empty enrollments for this test
setMockResponse.get(urls.enrollment.enrollmentsListV2(), enrollments)
setMockResponse.get(urls.enrollment.enrollmentsListV3(), enrollments)

renderWithProviders(
<ContractContent
Expand Down Expand Up @@ -1069,7 +1069,7 @@ describe("ContractContent", () => {
}),
]
// Override enrollments for this test
setMockResponse.get(urls.enrollment.enrollmentsListV2(), enrollments)
setMockResponse.get(urls.enrollment.enrollmentsListV3(), enrollments)

setupOrgDashboardMocks(
orgX,
Expand Down Expand Up @@ -1350,7 +1350,7 @@ describe("ContractContent", () => {
contracts,
)

setMockResponse.get(urls.enrollment.enrollmentsListV2(), [enrollment])
setMockResponse.get(urls.enrollment.enrollmentsListV3(), [enrollment])

renderWithProviders(
<ContractContent
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import {
} from "ol-components"
import graduateLogo from "@/public/images/dashboard/graduate.png"
import {
CourseRunEnrollmentRequestV2,
CourseRunEnrollmentV3,
ContractPage,
OrganizationPage,
V2ProgramCollection,
Expand Down Expand Up @@ -235,7 +235,7 @@ const useProgramCollectionCourses = (
const OrgProgramCollectionDisplay: React.FC<{
collection: V2ProgramCollection
contract: ContractPage
enrollments?: CourseRunEnrollmentRequestV2[]
enrollments?: CourseRunEnrollmentV3[]
}> = ({ collection, contract, enrollments }) => {
const { isLoading, programsWithCourses, hasAnyCourses } =
useProgramCollectionCourses(collection, contract.id)
Expand Down Expand Up @@ -350,7 +350,7 @@ const OrgProgramCollectionDisplay: React.FC<{
const OrgProgramDisplay: React.FC<{
program: V2Program
contract?: ContractPage
courseRunEnrollments?: CourseRunEnrollmentRequestV2[]
courseRunEnrollments?: CourseRunEnrollmentV3[]
programEnrollments?: V3UserProgramEnrollment[]
programLoading: boolean
orgId: number
Expand Down
Loading
Loading