Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: show video section to only those learners who have active subsc…
Browse files Browse the repository at this point in the history
…ription
Maham Akif authored and Maham Akif committed Aug 5, 2024
1 parent beeacc8 commit 88ac21d
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions src/components/search/Search.jsx
Original file line number Diff line number Diff line change
@@ -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) && <SearchPathway filter={filters} />}
{features.ENABLE_PROGRAMS && (canOnlyViewHighlightSets === false) && <SearchProgram filter={filters} />}
{canOnlyViewHighlightSets === false && <SearchCourse filter={filters} /> }
{canOnlyViewHighlightSets === false
&& (features.FEATURE_ENABLE_VIDEO_CATALOG) && <SearchVideo filter={filters} /> }
{enableVideoCatalog && <SearchVideo filter={filters} /> }
</Stack>
)}
{/* render a single contentType if the refinement exist and is either a course, program or learnerpathway */}

0 comments on commit 88ac21d

Please sign in to comment.