diff --git a/src/components/catalogNoResultsDeck/CatalogNoResultsDeck.jsx b/src/components/catalogNoResultsDeck/CatalogNoResultsDeck.jsx
index 2801b987..a3f4639d 100644
--- a/src/components/catalogNoResultsDeck/CatalogNoResultsDeck.jsx
+++ b/src/components/catalogNoResultsDeck/CatalogNoResultsDeck.jsx
@@ -7,6 +7,7 @@ import PropTypes from 'prop-types';
import {
CONTENT_TYPE_COURSE,
CONTENT_TYPE_PROGRAM,
+ EDX_COURSES_COURSE_TYPES,
NO_RESULTS_DECK_ITEM_COUNT,
NO_RESULTS_PAGE_SIZE,
NO_RESULTS_PAGE_ITEM_COUNT,
@@ -23,6 +24,7 @@ function CatalogNoResultsDeck({
columns,
renderCardComponent,
contentType,
+ courseType,
}) {
const [defaultData, setDefaultData] = useState([]);
const [apiError, setApiError] = useState(false);
@@ -37,6 +39,10 @@ function CatalogNoResultsDeck({
useEffect(() => {
const defaultCoursesRefinements = { enterprise_catalog_query_titles: selectedCatalog, content_type: contentType };
+ if (contentType === CONTENT_TYPE_COURSE) {
+ // if a course type is not specified, default to edx course content
+ defaultCoursesRefinements.course_type = courseType !== null ? [courseType] : EDX_COURSES_COURSE_TYPES;
+ }
EnterpriseCatalogApiService.fetchDefaultCoursesInCatalogWithFacets(defaultCoursesRefinements).then(response => {
setDefaultData(response.default_content || []);
setApiError(false);
@@ -44,7 +50,7 @@ function CatalogNoResultsDeck({
setApiError(true);
logError(err);
});
- }, [selectedCatalog, contentType]);
+ }, [selectedCatalog, contentType, courseType]);
let defaultDeckTitle;
let alertText;
@@ -100,10 +106,12 @@ CatalogNoResultsDeck.defaultProps = {
renderCardComponent: () => {},
columns: [],
contentType: '',
+ courseType: null,
};
CatalogNoResultsDeck.propTypes = {
contentType: PropTypes.string,
+ courseType: PropTypes.string,
intl: intlShape.isRequired,
setCardView: PropTypes.func,
renderCardComponent: PropTypes.func,
diff --git a/src/components/catalogSearchResults/CatalogSearchResults.jsx b/src/components/catalogSearchResults/CatalogSearchResults.jsx
index 020896c9..aa491e81 100644
--- a/src/components/catalogSearchResults/CatalogSearchResults.jsx
+++ b/src/components/catalogSearchResults/CatalogSearchResults.jsx
@@ -65,6 +65,7 @@ export function BaseCatalogSearchResults({
error,
paginationComponent: PaginationComponent,
contentType,
+ courseType,
setNoCourses,
setNoPrograms,
preview,
@@ -296,6 +297,7 @@ export function BaseCatalogSearchResults({
columns={contentType === CONTENT_TYPE_COURSE ? courseColumns : programColumns}
renderCardComponent={renderCardComponent}
contentType={contentType}
+ courseType={courseType}
/>
)}
{(searchResults?.nbHits !== 0) && (
@@ -344,6 +346,7 @@ BaseCatalogSearchResults.defaultProps = {
preview: false,
setNoCourses: () => {},
setNoPrograms: () => {},
+ courseType: null,
};
BaseCatalogSearchResults.propTypes = {
@@ -372,6 +375,7 @@ BaseCatalogSearchResults.propTypes = {
// eslint-disable-next-line react/no-unused-prop-types
row: PropTypes.string,
contentType: PropTypes.string.isRequired,
+ courseType: PropTypes.string,
preview: PropTypes.bool,
setNoCourses: PropTypes.func,
setNoPrograms: PropTypes.func,
diff --git a/src/components/catalogs/CatalogSearch.jsx b/src/components/catalogs/CatalogSearch.jsx
index 1fdbd09c..a333c851 100644
--- a/src/components/catalogs/CatalogSearch.jsx
+++ b/src/components/catalogs/CatalogSearch.jsx
@@ -9,7 +9,12 @@ import { useAlgoliaIndex } from './data/hooks';
import PageWrapper from '../PageWrapper';
import {
- CONTENT_TYPE_COURSE, CONTENT_TYPE_PROGRAM, NUM_RESULTS_COURSE, NUM_RESULTS_PROGRAM, NUM_RESULTS_PER_PAGE,
+ CONTENT_TYPE_COURSE,
+ CONTENT_TYPE_PROGRAM,
+ EXECUTIVE_EDUCATION_2U_COURSE_TYPE,
+ NUM_RESULTS_COURSE,
+ NUM_RESULTS_PROGRAM,
+ NUM_RESULTS_PER_PAGE,
} from '../../constants';
import CatalogSearchResults from '../catalogSearchResults/CatalogSearchResults';
import CatalogInfoModal from '../catalogInfoModal/CatalogInfoModal';
@@ -19,7 +24,7 @@ import messages from '../catalogSearchResults/CatalogSearchResults.messages';
function CatalogSearch(intl) {
const { refinements: { content_type: contentType } } = useContext(SearchContext);
const { algoliaIndexName, searchClient } = useAlgoliaIndex();
- const courseFilter = `content_type:${CONTENT_TYPE_COURSE}`;
+ const courseFilter = `content_type:${CONTENT_TYPE_COURSE} AND NOT course_type:${EXECUTIVE_EDUCATION_2U_COURSE_TYPE}`;
const programFilter = `content_type:${CONTENT_TYPE_PROGRAM}`;
const combinedFilter = `content_type:${CONTENT_TYPE_COURSE} OR content_type:${CONTENT_TYPE_PROGRAM}`;
const [noCourseResults, setNoCourseResults] = useState(false);
@@ -110,7 +115,11 @@ function CatalogSearch(intl) {
filters={courseFilter}
facetingAfterDistinct
/>
-
+
-
+
>
)}
@@ -160,17 +173,17 @@ function CatalogSearch(intl) {
)}
+ {(specifiedContentType === CONTENT_TYPE_COURSE) && (
+
+
+
+
+ )}
>
- {(specifiedContentType === CONTENT_TYPE_COURSE) && (
-
-
-
-
- )}
diff --git a/src/constants.js b/src/constants.js
index 9055f668..560dca35 100644
--- a/src/constants.js
+++ b/src/constants.js
@@ -26,6 +26,15 @@ export const PROGRAM_TITLE = 'Programs';
export const NO_RESULTS_DECK_ITEM_COUNT = 4;
export const NO_RESULTS_PAGE_ITEM_COUNT = 1;
export const NO_RESULTS_PAGE_SIZE = 4;
+const AUDIT_COURSE_TYPE = 'audit';
+const VERIFIED_AUDIT_COURSE_TYPE = 'verified-audit';
+const PROFESSIONAL_COURSE_TYPE = 'professional';
+const CREDIT_VERIFIED_AUDIT_COURSE_TYPE = 'credit-verified-audit';
+export const EXECUTIVE_EDUCATION_2U_COURSE_TYPE = 'executive-education-2u';
+export const TWOU_COURSE_TYPES = [EXECUTIVE_EDUCATION_2U_COURSE_TYPE];
+export const EDX_COURSES_COURSE_TYPES = [
+ AUDIT_COURSE_TYPE, VERIFIED_AUDIT_COURSE_TYPE, PROFESSIONAL_COURSE_TYPE, CREDIT_VERIFIED_AUDIT_COURSE_TYPE,
+];
const OVERRIDE_FACET_FILTERS = [];
if (features.PROGRAM_TYPE_FACET) {
diff --git a/src/data/services/EnterpriseCatalogAPIService.js b/src/data/services/EnterpriseCatalogAPIService.js
index 96fe4ad6..fb905778 100644
--- a/src/data/services/EnterpriseCatalogAPIService.js
+++ b/src/data/services/EnterpriseCatalogAPIService.js
@@ -28,7 +28,7 @@ class EnterpriseCatalogApiService {
}
static fetchDefaultCoursesInCatalog(options) {
- const enterpriseListUrl = `${EnterpriseCatalogApiService.enterpriseCatalogServiceApiUrl}/default_course_set/?${qs.stringify(options)}`;
+ const enterpriseListUrl = `${EnterpriseCatalogApiService.enterpriseCatalogServiceApiUrl}/default_course_set?${qs.stringify(options)}`;
return EnterpriseCatalogApiService.apiClient().get(enterpriseListUrl);
}