diff --git a/src/components/app/data/hooks/useEnterpriseFeatures.test.jsx b/src/components/app/data/hooks/useEnterpriseFeatures.test.jsx index b000eb500a..41f98dd617 100644 --- a/src/components/app/data/hooks/useEnterpriseFeatures.test.jsx +++ b/src/components/app/data/hooks/useEnterpriseFeatures.test.jsx @@ -18,9 +18,6 @@ const mockEnterpriseLearnerData = { activeEnterpriseCustomer: null, activeEnterpriseCustomerUserRoleAssignments: [], allLinkedEnterpriseCustomerUsers: [], - enterpriseFeatures: { - featurePrequerySearchSuggestions: true, - }, staffEnterpriseCustomer: null, }; const mockEnterpriseFeatures = mockEnterpriseLearnerData.enterpriseFeatures; diff --git a/src/components/search/Search.jsx b/src/components/search/Search.jsx index 1c392493dd..c5885c3ed6 100644 --- a/src/components/search/Search.jsx +++ b/src/components/search/Search.jsx @@ -19,12 +19,10 @@ import SearchPathway from './SearchPathway'; import PathwayModal from '../pathway/PathwayModal'; import SearchAcademy from './SearchAcademy'; import AssignmentsOnlyEmptyState from './AssignmentsOnlyEmptyState'; -import { EVENTS, isExperimentVariant, pushEvent } from '../../utils/optimizely'; import { useCanOnlyViewHighlights, useDefaultSearchFilters, useEnterpriseCustomer, - useEnterpriseFeatures, useEnterpriseOffers, useIsAssignmentsOnlyLearner, useSubscriptions, @@ -35,14 +33,6 @@ import SearchVideo from './SearchVideo'; import { hasActivatedAndCurrentSubscription } from './utils'; import VideoBanner from '../microlearning/VideoBanner'; -export const sendPushEvent = (isPreQueryEnabled, courseKeyMetadata) => { - if (isPreQueryEnabled) { - pushEvent(EVENTS.PREQUERY_SUGGESTION_CLICK, { courseKeyMetadata }); - } else { - pushEvent(EVENTS.SEARCH_SUGGESTION_CLICK, { courseKeyMetadata }); - } -}; - function useSearchPathwayModal() { const [isLearnerPathwayModalOpen, openLearnerPathwayModal, close] = useToggle(false); const { pathwayUUID } = useParams(); @@ -63,7 +53,6 @@ function useSearchPathwayModal() { const Search = () => { const config = getConfig(); const { data: enterpriseCustomer } = useEnterpriseCustomer(); - const { data: enterpriseFeatures } = useEnterpriseFeatures(); const intl = useIntl(); const navigate = useNavigate(); @@ -89,11 +78,6 @@ const Search = () => { closePathwayModal, } = useSearchPathwayModal(); - const isExperimentVariation = isExperimentVariant( - config.PREQUERY_SEARCH_EXPERIMENT_ID, - config.PREQUERY_SEARCH_EXPERIMENT_VARIANT_ID, - ); - const { data: { subscriptionLicense } } = useSubscriptions(); const enableVideos = ( canOnlyViewHighlightSets === false @@ -127,16 +111,6 @@ const Search = () => { const { content_type: contentType } = refinements; const hasRefinements = Object.keys(refinements).filter(refinement => refinement !== 'showAll').length > 0 && (contentType !== undefined ? contentType.length > 0 : true); - const isPreQueryEnabled = enterpriseFeatures?.featurePrequerySearchSuggestions - && isExperimentVariation; - - const optimizelySuggestionClickHandler = (courseKey) => { - // Programs pass in a list of keys. Optimizely does not accept array values - // so we are joining the items in the array. - const courseKeyMetadata = Array.isArray(courseKey) ? courseKey.join(', ') : courseKey; - sendPushEvent(isPreQueryEnabled, courseKeyMetadata); - }; - return ( <> @@ -160,8 +134,6 @@ const Search = () => { index={searchIndex} filters={filters} enterpriseConfig={enterpriseCustomer} - optimizelySuggestionClickHandler={optimizelySuggestionClickHandler} - isPreQueryEnabled={isPreQueryEnabled} /> )} diff --git a/src/components/search/tests/Search.test.jsx b/src/components/search/tests/Search.test.jsx index b5d0686807..7a4e7a4cb3 100644 --- a/src/components/search/tests/Search.test.jsx +++ b/src/components/search/tests/Search.test.jsx @@ -8,7 +8,7 @@ import '../../skills-quiz/__mocks__/react-instantsearch-dom'; import { queryClient, renderWithRouter } from '../../../utils/tests'; import '@testing-library/jest-dom'; import Search from '../Search'; -import { useDefaultSearchFilters, useEnterpriseFeatures, useEnterpriseCustomer } from '../../app/data'; +import { useDefaultSearchFilters, useEnterpriseCustomer } from '../../app/data'; import { useAlgoliaSearch } from '../../../utils/hooks'; import { enterpriseCustomerFactory } from '../../app/data/services/data/__factories__'; import { features } from '../../../config'; @@ -31,7 +31,6 @@ jest.mock('../../app/data', () => ({ useContentHighlightsConfiguration: jest.fn(() => ({ data: {} })), useCanOnlyViewHighlights: jest.fn(() => ({ data: false })), useIsAssignmentsOnlyLearner: jest.fn().mockReturnValue(false), - useEnterpriseFeatures: jest.fn(), useDefaultSearchFilters: jest.fn(), })); jest.mock('../../../utils/hooks', () => ({ @@ -76,7 +75,6 @@ describe('', () => { beforeEach(() => { jest.clearAllMocks(); useEnterpriseCustomer.mockReturnValue({ data: mockEnterpriseCustomer }); - useEnterpriseFeatures.mockReturnValue({ data: { featurePrequerySearchSuggestions: false } }); useDefaultSearchFilters.mockReturnValue(mockFilter); useAlgoliaSearch.mockReturnValue([{ search: jest.fn(), appId: 'test-app-id' }, { indexName: 'mock-index-name' }]); }); diff --git a/src/components/search/tests/SearchSections.test.jsx b/src/components/search/tests/SearchSections.test.jsx index a2944bef7d..2e4fd6f709 100644 --- a/src/components/search/tests/SearchSections.test.jsx +++ b/src/components/search/tests/SearchSections.test.jsx @@ -10,9 +10,8 @@ import { queryClient, renderWithRouter } from '../../../utils/tests'; import '@testing-library/jest-dom'; import SearchProgram from '../SearchProgram'; import SearchPathway from '../SearchPathway'; -import Search, { sendPushEvent } from '../Search'; -import { EVENTS, pushEvent } from '../../../utils/optimizely'; -import { useDefaultSearchFilters, useEnterpriseFeatures, useEnterpriseCustomer } from '../../app/data'; +import Search from '../Search'; +import { useDefaultSearchFilters, useEnterpriseCustomer } from '../../app/data'; import { useAlgoliaSearch } from '../../../utils/hooks'; import { enterpriseCustomerFactory } from '../../app/data/services/data/__factories__'; import SearchVideo from '../SearchVideo'; @@ -86,7 +85,6 @@ describe('', () => { beforeEach(() => { jest.clearAllMocks(); useEnterpriseCustomer.mockReturnValue({ data: mockEnterpriseCustomer }); - useEnterpriseFeatures.mockReturnValue({ data: { featurePrequerySearchSuggestions: false } }); useDefaultSearchFilters.mockReturnValue(mockFilter); useAlgoliaSearch.mockReturnValue([{ search: jest.fn(), appId: 'test-app-id' }, { indexName: 'mock-index-name' }]); }); @@ -163,14 +161,4 @@ describe('', () => { ); expect(screen.getByText('Pathways (2 results)')).toBeInTheDocument(); }); - - describe('pushEvent', () => { - test.each([ - [true, 'test-course-101', EVENTS.PREQUERY_SUGGESTION_CLICK], - [false, 'test-course-102', EVENTS.SEARCH_SUGGESTION_CLICK], - ])('if isPrequeryEnabled is %p with course metadata %p, submit event %p', (isPrequeryEnabled, courseKeyMetadata, event) => { - sendPushEvent(isPrequeryEnabled, courseKeyMetadata); - expect(pushEvent).toHaveBeenCalledWith(event, { courseKeyMetadata }); - }); - }); }); diff --git a/src/index.jsx b/src/index.jsx index 548abe2365..8f4c764ff7 100644 --- a/src/index.jsx +++ b/src/index.jsx @@ -57,8 +57,6 @@ initialize({ ENTERPRISE_SUBSIDY_BASE_URL: process.env.ENTERPRISE_SUBSIDY_BASE_URL || null, EXPERIMENT_2_ID: process.env.EXPERIMENT_2_ID || null, EXPERIMENT_2_VARIANT_2_ID: process.env.EXPERIMENT_2_VARIANT_2_ID || null, - PREQUERY_SEARCH_EXPERIMENT_ID: process.env.PREQUERY_SEARCH_EXPERIMENT_ID || null, - PREQUERY_SEARCH_EXPERIMENT_VARIANT_ID: process.env.PREQUERY_SEARCH_EXPERIMENT_VARIANT_ID || null, }); }, }, diff --git a/src/utils/optimizely.js b/src/utils/optimizely.js index 60605a83d6..404863e634 100644 --- a/src/utils/optimizely.js +++ b/src/utils/optimizely.js @@ -1,7 +1,6 @@ export const EVENTS = { ENROLLMENT_CLICK: 'enterprise_learner_portal_enrollment_click', FIRST_ENROLLMENT_CLICK: 'enterprise_learner_portal_first_enrollment_click', - PREQUERY_SUGGESTION_CLICK: 'enterprise_learner_portal_prequery_suggestions_click', SEARCH_SUGGESTION_CLICK: 'enterprise_learner_portal_search_suggestions_click', };