diff --git a/composites/CoursesOverview/CardDetails.js b/composites/CoursesOverview/CardDetails.js index 21b01336..4901d5c3 100644 --- a/composites/CoursesOverview/CardDetails.js +++ b/composites/CoursesOverview/CardDetails.js @@ -123,7 +123,6 @@ class CardDetails extends React.Component { */ render() { const buttonType = this.props.ctaButtonData.ctaButtonType === "regular" ? CardRegularButton : CardUpsellButton; - const OutboundLinkButton = makeOutboundLink( buttonType ); return ( @@ -132,17 +131,39 @@ class CardDetails extends React.Component { dangerouslySetInnerHTML={ { __html: this.props.description } } /> - - - { this.props.ctaButtonData.ctaButtonCopy } - - - { this.props.readMoreLinkText } - - + { this.getActionBlock( buttonType, this.props.isBundle ) } ); } + + /** + * Returns the correct Action Block based on whether an item is a bundle or a single course. + * + * @param {string} buttonType The type of the button. Either regular or sale. + * @param {boolean} isBundle True when the it's a bundle. + * + * @returns {ReactElement} The ActionBlock component. + */ + getActionBlock( buttonType, isBundle ) { + const OutboundLinkButton = makeOutboundLink( buttonType ); + + // Bundles don't have an OutboundInfoLink and use a different property from the feed for the OutboundLinkButton. + if ( isBundle === "true" ) { + return + + { this.props.ctaButtonData.ctaButtonCopy } + + ; + } + return + + { this.props.ctaButtonData.ctaButtonCopy } + + + { this.props.readMoreLinkText } + + ; + } } export default CardDetails; @@ -152,6 +173,7 @@ CardDetails.propTypes = { courseUrl: PropTypes.string, ctaButtonData: PropTypes.object, readMoreLinkText: PropTypes.string, + isBundle: PropTypes.bool, }; CardDetails.defaultProps = { @@ -159,4 +181,5 @@ CardDetails.defaultProps = { courseUrl: "", ctaButtonData: {}, readMoreLinkText: "", + isBundle: false, }; diff --git a/utils/getCourseFeed.js b/utils/getCourseFeed.js index 0843da0f..af8e8b66 100644 --- a/utils/getCourseFeed.js +++ b/utils/getCourseFeed.js @@ -33,6 +33,7 @@ function parseCourseFeedItem( parsed, snapshot, nsResolver ) { item.ctaButtonUrl = getXPathText( "child::content:cta_button_url", parsed, snapshot, nsResolver ); item.readMoreLinkText = getXPathText( "child::content:read_more_link_text", parsed, snapshot, nsResolver ); item.isFree = getXPathText( "child::content:is_free", parsed, snapshot, nsResolver ); + item.isBundle = getXPathText( "child::content:is_bundle", parsed, snapshot, nsResolver ); return item; }