Skip to content

Commit

Permalink
feat: added Optimizely experiment for skill quiz components (#920)
Browse files Browse the repository at this point in the history
  • Loading branch information
jajjibhai008 authored Jan 15, 2024
1 parent 4e2a4bc commit 5403d62
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/components/skills-quiz/SkillsQuiz.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,23 @@ import { SearchData } from '@edx/frontend-enterprise-catalog-search';
import { AppContext } from '@edx/frontend-platform/react';

import { Container, Row } from '@edx/paragon';
import { hasFeatureFlagEnabled } from '@edx/frontend-enterprise-utils';

import { getConfig } from '@edx/frontend-platform/config';
import { hasFeatureFlagEnabled } from '@edx/frontend-enterprise-utils';
import { MainContent } from '../layout';
import SkillsQuizStepper from './SkillsQuizStepper';
import { SkillsContextProvider } from './SkillsContextProvider';
import SkillsQuizV2 from '../skills-quiz-v2/SkillsQuiz';
import { isExperimentVariant } from '../../utils/optimizely';

const SkillsQuiz = () => {
const { enterpriseConfig } = useContext(AppContext);
const PAGE_TITLE = `Skills Quiz - ${enterpriseConfig.name}`;
const config = getConfig();
const isExperimentVariationB = isExperimentVariant(
config.EXPERIMENT_2_ID,
config.EXPERIMENT_2_VARIANT_2_ID,
);
const v2 = hasFeatureFlagEnabled('ENABLE_SKILLS_QUIZ_V2'); // Enable the skills quiz v2 design only when enabled via query parameter.
return (
<>
Expand All @@ -24,7 +31,7 @@ const SkillsQuiz = () => {
<MainContent>
<SearchData>
<SkillsContextProvider>
{v2 ? (
{(isExperimentVariationB || v2) ? (
<SkillsQuizV2 isStyleAutoSuggest />
) : (
<SkillsQuizStepper isStyleAutoSuggest={false} />
Expand Down
2 changes: 2 additions & 0 deletions src/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ initialize({
FEATURE_CONTENT_HIGHLIGHTS: process.env.FEATURE_CONTENT_HIGHLIGHTS || null,
FEATURE_ENABLE_EMET_REDEMPTION: process.env.FEATURE_ENABLE_EMET_REDEMPTION || null,
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,
});
},
},
Expand Down

0 comments on commit 5403d62

Please sign in to comment.