Skip to content

Advertise parent programs on course product pages#3029

Open
ChristopherChudzicki wants to merge 29 commits intomainfrom
cc/program-bundle-upsell-2
Open

Advertise parent programs on course product pages#3029
ChristopherChudzicki wants to merge 29 commits intomainfrom
cc/program-bundle-upsell-2

Conversation

@ChristopherChudzicki
Copy link
Contributor

@ChristopherChudzicki ChristopherChudzicki commented Mar 9, 2026

What are the relevant tickets?

Closes https://github.com/mitodl/hq/issues/10434

Description (What does it do?)

Program Bundle Upsell: When a course belongs to one or more MITx programs, shows a "Best value" upsell below the course metadata with the program price, required course count, and a "View Program" link.

Unified HTML structure: The info box sidebar uses a single HTML structure with CSS-only responsive behavior instead of separate DOM trees per breakpoint.

InfoBox refactor: Introduced InfoBoxCourse and InfoBoxProgram wrapper components that own the full sidebar card composition (summary + enrollment button + upsell), with shared styled primitives in InfoBoxParts. ProductPageTemplate now takes a single infoBox prop instead of separate sidebar-related props.

Screenshots (if appropriate):

Note

Enrollment likely to be removed from mobile/tablet infobox, but will wait until it has been merged into banner.

desktop tablet mobile

How can this be tested?

Prerequisites:

Now:

  1. Navigate to a course that belongs to a program; if using Option 1, http://open.odl.local:8062/courses/course-v1:MITxT+14.100x is a good candidate. (Note: This course has no available runs, but still displays the program upsell correctly.)
    • Desktop: Sticky sidebar with metadata, enrollment button, bundle upsell ("Best value", course count, bold program title, price, "(19% off)", "View Program")
    • Tablet: Two-column metadata with column-rule divider, horizontal upsell (text left, button right), enrollment button
    • Mobile: Single-column metadata, centered upsell, enrollment button
  • Check a course that is not in any programs; it should have no program upsel.
  • Check no navigation links on course/program page
  • ⚠️ You may notice that the product image only shows on Desktop, not mobile/tablet. This will be resolved as part of https://github.com/mitodl/hq/issues/10435

Additional Context

  • Bundle discount "(19% off)" is a hardcoded value that matches our business pricing rules. Not ideal, but requested.

ChristopherChudzicki and others added 28 commits March 9, 2026 11:24
Reorder the sidebar card so the enroll button appears after the summary
info rows rather than before them, matching the Figma design.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Replace the "Course is part of the following programs" info row with a
ProgramBundleUpsell component that fetches each parent program's details
and shows a bundle pricing card with a "View Program" link, ordered after
the enroll button.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…borders/padding

Replace three separate DOM structures (desktop/tablet/mobile) in the product page
info box with a single HTML structure using CSS grid for responsive layout. Fixes
program bundle upsell border on tablet by resetting bleed margins and adding direct
border; adjusts SummaryRoot padding per breakpoint; adds AskTIM placeholder button.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
… AskTIM placeholder

- Split SummaryRoot into SummaryCard (border/shadow wrapper) and
  SummaryContent (padded metadata area) so the bundle upsell can span
  edge-to-edge without negative margins
- Delete unused ProductNavbar.tsx
- Add temporary AskTIM button placeholder using smoot-design Button
- Add TODO comment for hardcoded 1.2x strike price
- Add comment explaining per-program detail fetches

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…psell

- Remove grid-based tablet layout (RightCol, ActionsArea) from template
- Enrollment button desktop-only via DesktopEnrollArea; AskTIM outside card
- SummaryContent is now just a padding wrapper; gap/layout owned by SummaryRows
- SummaryRows: flex-column on desktop/mobile, column-count:2 on tablet
- Bundle upsell: row layout on tablet (text left, button right), skip if no price
- Add separator borders between multiple upsell items

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Sticky position on SummaryCol so AskTIM scrolls with the card
- align-self: flex-start required for sticky in flex parent
- Replace magic top offset with HEADER_HEIGHT constant
- Add column-rule divider between tablet metadata columns

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Use avoidCents for bundle price formatting (whole dollars)
- Show required course count in upsell title ("Get all 5 ...")
- Bold program title, normal weight for rest of upsell text
- Replace strikethrough price with static "(19% off)" discount
- Replace "Want a program certificate?" with "Best value"
- Make AskTIM button full width, match Figma shadow opacity
- Adjust bundle spacing to match Figma (8px header gap, 24px item gap)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Replace DesktopEnrollArea (md-only) with EnrollArea (always visible)
- Tablet enrollment button: max-width 50%, center-aligned
- Update ProgramBundleUpsell tests for new copy ("Best value", course
  count, avoidCents price, "(19% off)") and add no-price test case

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- ProgramBundleUpsell waits for all queries to load and filters to
  programs with prices before rendering, preventing an empty "Best
  value" header
- AskTIM button text uses productNoun prop ("course" or "program")
- enrollButton is now a required prop on ProductPageTemplate
- Remove console.log placeholder from AskTIM onClick
- Clean up BundleUpsellContainer border styles per breakpoint

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Use monthsFromNow() helper so tests don't rot as calendar time passes.
Past dates for "Anytime" logic use negative offsets; ordering tests use
spaced-out future offsets; display-only tests let the factory decide.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…ises

Add test verifying the upsell renders nothing when the program detail
fetch fails. Use Promise.withResolvers() to control mock response timing
in both no-price and error tests, replacing the fragile
queryClient.isFetching() polling pattern.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Show structured skeleton placeholders (title, price, button) while
program details load, then render real content or unmount if no priced
programs. Tests now verify the full loading→removed lifecycle using
waitForElementToBeRemoved and use distinct prices for multi-program
assertions.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Replace sidebarSummary, enrollButton, programUpsell, summaryTitle, and
productNoun props with a single infoBox prop. CoursePage uses
CourseInfoBox, ProgramPage uses ProgramInfoBox.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Rather than silently returning null when all program detail fetches
fail, log a console.warn to aid debugging. Add allowConsoleErrors()
to the error-state test to accommodate jest-fail-on-console.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Rename CourseInfoBox → InfoBoxCourse, ProgramInfoBox → InfoBoxProgram
for alphabetical grouping with InfoBoxParts. Extract shared styled
components (now InfoBoxCard, InfoBoxContent, InfoBoxEnrollArea,
AskTimButton) into InfoBoxParts so InfoBoxProgram no longer depends
on InfoBoxCourse for shared primitives.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Move ProgramBundleUpsell component and all its styled components out
of ProductSummary.tsx into ProgramBundleUpsell.tsx, with tests moved
to ProgramBundleUpsell.test.tsx.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Remove dedicated InfoBoxCourse and InfoBoxProgram test files — their
coverage is better placed at the page level. Rename section headings
to "Course Information" / "Program Information". Add a CoursePage
test asserting the program bundle upsell renders when the course
belongs to a program.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Remove redundant fragment wrappers in InfoBoxCourse and InfoBoxProgram
- Use V2ProgramDetail instead of V2Program for RequirementsSection prop type
- Remove no-op `& {}` intersection on CourseCertificateBox
- Clarify bundle upsell smoke test name in CoursePage.test
- Fix misleading `courses` variable name in ProgramPage 404 test
- Batch program detail fetches into single programsList query

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
On tablet, use flex + justify-end instead of centering the enrollment
button. Also remove unnecessary width: 100% and WideButtonLink wrapper
from enrollment button components.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Remove "Best value" header, use h5 bold for full title line, and
regroup price + button into BundleUpsellActions so price sits above
the button on tablet (single HTML structure, CSS-only responsive).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@ChristopherChudzicki ChristopherChudzicki changed the title Cc/program bundle upsell 2 Advertise parent programs on course product pages Mar 9, 2026
@ChristopherChudzicki ChristopherChudzicki marked this pull request as ready for review March 9, 2026 16:19
@ChristopherChudzicki ChristopherChudzicki added the Needs Review An open Pull Request that is ready for review label Mar 9, 2026
@gumaerc gumaerc self-assigned this Mar 10, 2026
Copy link
Contributor

@gumaerc gumaerc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good and functioned properly for me once I got the test data set up, but I have a few questions:

...others
}) => {
if (!course.programs || course.programs.length === 0) return null
const label = `Part of the following ${pluralize("program", course.programs.length)}`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Question:

This would previously display even for programs that do not have a price. The new ProgramBundleUpsell component does not display if a program doesn't have a price. This text is still shown to the side of the upsell examples here in Figma:

https://www.figma.com/design/Eux3guSenAFVvNHGi1Y9Wm/MIT-Design-System?node-id=34395-88815&m=dev

I'm not sure if it's intended to be kept though, so maybe worth asking Steve / Bilal?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, good point:

  • we now have enrollment_modes
  • Previously, if a program had no price enrollment_modes=["audit"] , we still showed the parent program "Part of the following programs".
  • Now if a program is free-only, we do not show parent program.

☝️ also applies to programs with "verified" enrollment mode but no corresponding product.

I'd call this an expected behavior change and in practice it probably doesn't matter. I think all programs will have verified/product options.

We could add a "Part of " version of the upsell for free-only programs, but... I don't know if we need it. I would say ... we do NOT need it for now.

cc @pdpinch @steven-hatch

width: "100%",
},
!href && {
pointerEvents: "none",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Previously when there was no href available, the pointer on this button would be intentionally set to the normal pointer to indicate that it wasn't clickable. Now, the button looks clickable but doesn't do anything. Is this intentional?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was somewhat intentional... I didn't think a style override was worth handling bad-data.

But I think I'll restore it for now. We can build this behavior into smoot-design later.

[theme.breakpoints.between("sm", "md")]: {
display: "flex",
justifyContent: "flex-end",
"> *": { flex: "0 1 50%" },
Copy link
Contributor

@gumaerc gumaerc Mar 10, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we need to change this here but I'm a bit confused as to the scope of the changes here. This PR is supposed to be about the program upsell but seems to be doing a lot of change to the layout, but doesn't completely align it with the current Figma.

Image

The tablet view is rendering the enrollment button inside the info box here, but it seems it's supposed to be in the image area. I imagine that work is being saved for a future PR?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The scope of this PR is "Program Bundle Upsell" / "Unified HTML structure" / " InfoBox refactor".

The banner updates are handled in

Let me confirm the enrollment button removal with Steve/Bilal tomorrow. I suspect that's finalized now, and since the banner PR is pretty much ready, we can remove it now. (Figma still shows it for Mobile, but that may be a mistake; we will keep it in the infobox on desktop.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Needs Review An open Pull Request that is ready for review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants