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 1e64434
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 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,13 @@ const Search = () => {
config.PREQUERY_SEARCH_EXPERIMENT_VARIANT_ID,
);

const { data: { subscriptionLicense } } = useSubscriptions();
// The video section will be available only to learners with an active subscription.
const enableVideos = (
subscriptionLicense?.status === LICENSE_STATUS.ACTIVATED
&& subscriptionLicense?.subscriptionPlan?.isCurrent

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

View check run for this annotation

Codecov / codecov/patch

src/components/search/Search.jsx#L100

Added line #L100 was not covered by tests
);

const PAGE_TITLE = intl.formatMessage({
id: 'enterprise.search.page.title',
defaultMessage: 'Search Courses and Programs - {enterpriseName}',
Expand Down Expand Up @@ -152,6 +161,7 @@ const Search = () => {
enterpriseConfig={enterpriseCustomer}
optimizelySuggestionClickHandler={optimizelySuggestionClickHandler}
isPreQueryEnabled={isPreQueryEnabled}
enableVideos={enableVideos}
/>
</div>
)}
Expand Down

0 comments on commit 1e64434

Please sign in to comment.