Commit 77023b2
Product pages, Purchasable Programs + enrollment_modes (#2995)
* bump mitxonline client
* fix tests and ts errors
* use new cart apis
* bump client
* bump client version
* update summary price display
* show financial aid pricing in course summary
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* update enrollment buttons for paid enrollment and financial aid
Show "Enroll Now—$X" for paid-only offerings. When financial aid is
applied to a course, display the discounted price with the original
price stricken. Disable the button when no price is available.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* update enrollment dialogs and buttons for enrollment mode support
- ProgramEnrollmentDialog: remove course picker, enroll in program directly;
add certificate upsell (with Add to Cart) for "both" enrollment modes
- CourseEnrollmentDialog: add hideUpsell prop for free-only courses
- ProgramEnrollmentButton: branch on enrollmentType — free enrolls directly,
paid goes straight to cart, both opens dialog
- CourseEnrollmentButton: branch on enrollmentType — free opens dialog with
upsell hidden, paid goes straight to cart, both opens full dialog
- Add useCreateProgramEnrollment hook to mitxonline enrollment hooks
- Update tests for all new behaviors; remove 100x repeat from ProgramEnrollmentButton.test.tsx
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* hide enrollment upsell based on run/program enrollment modes
CourseEnrollmentDialog now derives upsell visibility from the selected
run's enrollment_modes rather than a hideUpsell prop, so the upsell
reacts dynamically as the user changes their run selection. Removes the
hideUpsell prop entirely.
ProgramEnrollmentDialog now checks program.enrollment_modes and only
renders the certificate upsell when the program offers both free and
paid options.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* make flakey test detection easier
* unify price formatting: drop .00 for whole-dollar amounts
Add formatPrice() utility that uses minimumFractionDigits:0 so whole
dollar amounts render as "$900" rather than "$900.00". Use it in program
components (ProgramEnrollmentButton, ProgramPriceRow, ProgramCertificateBox)
which previously used raw template literals. Update all affected tests.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* test: add click-action coverage for free/both enrollment modes
Add test.each covering free-only and both-modes cases that clicking
'Enroll for Free' as an authenticated user opens CourseEnrollmentDialog.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* fix: paid enrollment loading state, error handling, and price formatting
- Show loading spinner (endIcon) while basket API calls are in flight,
keeping button text visible and disabling the button
- Catch errors from clearBasket/addToBasket mutateAsync and surface them
via an Alert below the button; same for free program enrollment
- Fix inconsistent price formatting in ProgramCertificateUpsell: use
formatPrice() instead of template literal to drop unnecessary .00
- Collapse redundant free/both branches in CourseEnrollmentButton click handler
- Add tests for loading and error states in both enrollment buttons
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* unify clear+add basket logic
* make onReset optional
* fix copy
* add a test covering successful enrollment redirection
* handle errors in dialogs
* no redundant resets
* simplify: use mutate+onSuccess chaining in useReplaceBasketItem; remove redundant reset calls and try/catch at call sites
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* reset during combined mutation, remove a comment
* remove unncessary comparison
* fix a rebasing issue
* disable enrollment button when enrollment_modes is empty
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* show cents except on button
* open enrollment dialog for multi-run or upsell; direct enroll otherwise
- Open dialog when enrollmentType is "both" (upsell) or multiple enrollable runs exist
- For paid-only + single run, go directly to checkout (unchanged)
- For free-only + single run, enroll directly and redirect to dashboard home
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* be defensive in dialog: hide/disable upsell+free button for bad enrollment data
- confirmText now requires enrollmentType to be "free" or "both" (not just not-paid),
so it's hidden for "none" (bad data) as well as "paid"
- isFreeOnly now true for any type that isn't "paid" or "both", so the upsell
is disabled for "none" in addition to "free"
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* update mitxonline-api-axios to semver release
* remove isFreeOnly from upsell props
---------
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>1 parent 187d942 commit 77023b2
27 files changed
Lines changed: 1758 additions & 1007 deletions
File tree
- frontends
- api
- src/mitxonline
- hooks
- baskets
- enrollment
- programs
- test-utils/factories
- main
- src
- app-pages
- DashboardPage/CoursewareDisplay
- ProductPages
- common
- page-components/EnrollmentDialogs
- ol-components/src/components
- Dialog
- FormDialog
- scripts/test
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
32 | | - | |
| 32 | + | |
33 | 33 | | |
34 | 34 | | |
35 | 35 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
26 | | - | |
27 | 26 | | |
28 | 27 | | |
29 | 28 | | |
| |||
50 | 49 | | |
51 | 50 | | |
52 | 51 | | |
53 | | - | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
4 | 8 | | |
5 | 9 | | |
6 | 10 | | |
7 | 11 | | |
| 12 | + | |
8 | 13 | | |
9 | 14 | | |
10 | 15 | | |
| |||
65 | 70 | | |
66 | 71 | | |
67 | 72 | | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
68 | 87 | | |
69 | 88 | | |
70 | 89 | | |
71 | 90 | | |
72 | 91 | | |
73 | 92 | | |
74 | 93 | | |
| 94 | + | |
75 | 95 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
4 | | - | |
| 4 | + | |
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| |||
37 | 37 | | |
38 | 38 | | |
39 | 39 | | |
40 | | - | |
| 40 | + | |
41 | 41 | | |
42 | 42 | | |
43 | 43 | | |
| |||
Lines changed: 25 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| 8 | + | |
8 | 9 | | |
9 | 10 | | |
10 | 11 | | |
| |||
13 | 14 | | |
14 | 15 | | |
15 | 16 | | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
16 | 26 | | |
17 | 27 | | |
18 | 28 | | |
| |||
70 | 80 | | |
71 | 81 | | |
72 | 82 | | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
73 | 86 | | |
74 | 87 | | |
75 | 88 | | |
| |||
110 | 123 | | |
111 | 124 | | |
112 | 125 | | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
113 | 129 | | |
114 | 130 | | |
115 | 131 | | |
| |||
183 | 199 | | |
184 | 200 | | |
185 | 201 | | |
186 | | - | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
Lines changed: 5 additions & 71 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
5 | | - | |
6 | 5 | | |
7 | 6 | | |
8 | | - | |
9 | 7 | | |
10 | 8 | | |
11 | 9 | | |
12 | | - | |
| 10 | + | |
| 11 | + | |
13 | 12 | | |
14 | 13 | | |
15 | 14 | | |
| |||
49 | 48 | | |
50 | 49 | | |
51 | 50 | | |
| 51 | + | |
52 | 52 | | |
53 | 53 | | |
54 | 54 | | |
| |||
134 | 134 | | |
135 | 135 | | |
136 | 136 | | |
137 | | - | |
138 | | - | |
139 | | - | |
140 | | - | |
141 | | - | |
142 | | - | |
143 | | - | |
144 | | - | |
145 | | - | |
146 | | - | |
147 | | - | |
148 | | - | |
149 | | - | |
150 | | - | |
151 | | - | |
152 | | - | |
153 | | - | |
154 | | - | |
155 | | - | |
156 | | - | |
157 | | - | |
158 | | - | |
159 | | - | |
160 | | - | |
161 | | - | |
162 | | - | |
163 | | - | |
164 | | - | |
165 | | - | |
166 | | - | |
167 | | - | |
168 | | - | |
169 | | - | |
170 | | - | |
171 | | - | |
172 | | - | |
173 | | - | |
174 | | - | |
175 | | - | |
176 | | - | |
177 | | - | |
178 | | - | |
179 | | - | |
180 | | - | |
181 | | - | |
182 | | - | |
183 | | - | |
184 | | - | |
185 | | - | |
186 | | - | |
187 | | - | |
188 | | - | |
189 | | - | |
190 | | - | |
191 | | - | |
192 | | - | |
193 | | - | |
194 | | - | |
195 | | - | |
196 | | - | |
197 | 137 | | |
198 | 138 | | |
199 | 139 | | |
200 | | - | |
| 140 | + | |
201 | 141 | | |
202 | 142 | | |
203 | 143 | | |
| |||
217 | 157 | | |
218 | 158 | | |
219 | 159 | | |
220 | | - | |
221 | | - | |
222 | | - | |
223 | | - | |
224 | | - | |
225 | | - | |
226 | | - | |
| 160 | + | |
Lines changed: 23 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | | - | |
| 2 | + | |
3 | 3 | | |
4 | | - | |
| 4 | + | |
5 | 5 | | |
| 6 | + | |
6 | 7 | | |
7 | 8 | | |
8 | 9 | | |
9 | 10 | | |
| 11 | + | |
10 | 12 | | |
11 | 13 | | |
12 | 14 | | |
13 | | - | |
14 | | - | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
15 | 30 | | |
16 | 31 | | |
17 | 32 | | |
| |||
77 | 92 | | |
78 | 93 | | |
79 | 94 | | |
| 95 | + | |
80 | 96 | | |
| 97 | + | |
81 | 98 | | |
82 | 99 | | |
83 | | - | |
| 100 | + | |
84 | 101 | | |
85 | 102 | | |
86 | 103 | | |
| |||
122 | 139 | | |
123 | 140 | | |
124 | 141 | | |
125 | | - | |
| 142 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
1 | 2 | | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
2 | 10 | | |
3 | 11 | | |
4 | 12 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
17 | | - | |
| 17 | + | |
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
| |||
Lines changed: 3 additions & 9 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
35 | 35 | | |
36 | 36 | | |
37 | 37 | | |
38 | | - | |
| 38 | + | |
39 | 39 | | |
40 | 40 | | |
41 | 41 | | |
| |||
527 | 527 | | |
528 | 528 | | |
529 | 529 | | |
530 | | - | |
531 | | - | |
| 530 | + | |
532 | 531 | | |
533 | 532 | | |
534 | 533 | | |
535 | 534 | | |
536 | 535 | | |
537 | 536 | | |
538 | | - | |
539 | | - | |
540 | | - | |
541 | | - | |
542 | | - | |
543 | | - | |
| 537 | + | |
544 | 538 | | |
545 | 539 | | |
546 | 540 | | |
| |||
0 commit comments