diff --git a/src/components/search/Search.jsx b/src/components/search/Search.jsx index bf96bb8e45..ee9f92ec1a 100644 --- a/src/components/search/Search.jsx +++ b/src/components/search/Search.jsx @@ -27,10 +27,12 @@ import { useEnterpriseFeatures, useEnterpriseOffers, useIsAssignmentsOnlyLearner, + useSubscriptions, } from '../app/data'; import { useAlgoliaSearch } from '../../utils/hooks'; import ContentTypeSearchResultsContainer from './ContentTypeSearchResultsContainer'; import SearchVideo from './SearchVideo'; +import { LICENSE_STATUS } from '../enterprise-user-subsidy/data/constants'; export const sendPushEvent = (isPreQueryEnabled, courseKeyMetadata) => { if (isPreQueryEnabled) { @@ -91,6 +93,17 @@ const Search = () => { config.PREQUERY_SEARCH_EXPERIMENT_VARIANT_ID, ); + const { data: { subscriptionLicense } } = useSubscriptions(); + const hasActiveSubscription = ( + subscriptionLicense?.status === LICENSE_STATUS.ACTIVATED + && subscriptionLicense?.subscriptionPlan.isCurrent + ); + const enableVideoCatalog = ( + canOnlyViewHighlightSets === false + && features.FEATURE_ENABLE_VIDEO_CATALOG + && hasActiveSubscription + ); + const PAGE_TITLE = intl.formatMessage({ id: 'enterprise.search.page.title', defaultMessage: 'Search Courses and Programs - {enterpriseName}', @@ -175,8 +188,7 @@ const Search = () => { {features.ENABLE_PATHWAYS && (canOnlyViewHighlightSets === false) && } {features.ENABLE_PROGRAMS && (canOnlyViewHighlightSets === false) && } {canOnlyViewHighlightSets === false && } - {canOnlyViewHighlightSets === false - && (features.FEATURE_ENABLE_VIDEO_CATALOG) && } + {enableVideoCatalog && } )} {/* render a single contentType if the refinement exist and is either a course, program or learnerpathway */}