Skip to content

Commit

Permalink
feat: show video section to learners with active subscription
Browse files Browse the repository at this point in the history
  • Loading branch information
Maham Akif authored and Maham Akif committed Aug 5, 2024
1 parent beeacc8 commit f39b0af
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
Expand Up @@ -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) {
Expand Down Expand Up @@ -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

Check warning on line 99 in src/components/search/Search.jsx

View check run for this annotation

Codecov / codecov/patch

src/components/search/Search.jsx#L99

Added line #L99 was not covered by tests
);
const enableVideoCatalog = (
canOnlyViewHighlightSets === false
&& features.FEATURE_ENABLE_VIDEO_CATALOG
&& hasActiveSubscription

Check warning on line 104 in src/components/search/Search.jsx

View check run for this annotation

Codecov / codecov/patch

src/components/search/Search.jsx#L103-L104

Added lines #L103 - L104 were not covered by tests
);

const PAGE_TITLE = intl.formatMessage({
id: 'enterprise.search.page.title',
defaultMessage: 'Search Courses and Programs - {enterpriseName}',
Expand Down Expand Up @@ -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 */}
Expand Down

0 comments on commit f39b0af

Please sign in to comment.