Skip to content

Commit

Permalink
fix: remove rebrand experiment from authn (#1187)
Browse files Browse the repository at this point in the history
Description:
Remove rebrand experiment code from Authn
VAN-1858
  • Loading branch information
ahtesham-quraish authored Mar 4, 2024
1 parent 56bab26 commit 488644f
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 40 deletions.
4 changes: 0 additions & 4 deletions src/base-container/data/constants.js

This file was deleted.

21 changes: 2 additions & 19 deletions src/base-container/index.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useEffect, useState } from 'react';
import React from 'react';

import { getConfig } from '@edx/frontend-platform';
import { breakpoints } from '@openedx/paragon';
Expand All @@ -11,28 +11,11 @@ import {
ImageExtraSmallLayout, ImageLargeLayout, ImageMediumLayout, ImageSmallLayout,
} from './components/image-layout';
import { AuthLargeLayout, AuthMediumLayout, AuthSmallLayout } from './components/welcome-page-layout';
import { DEFAULT_LAYOUT, IMAGE_LAYOUT } from './data/constants';

const BaseContainer = ({ children, showWelcomeBanner, fullName }) => {
const [baseContainerVersion, setBaseContainerVersion] = useState(DEFAULT_LAYOUT);
const enableImageLayout = getConfig().ENABLE_IMAGE_LAYOUT;

useEffect(() => {
const initRebrandExperiment = () => {
if (window.experiments?.rebrandExperiment) {
setBaseContainerVersion(window.experiments?.rebrandExperiment?.variation);
} else {
window.experiments = window.experiments || {};
window.experiments.rebrandExperiment = {};
window.experiments.rebrandExperiment.handleLoaded = () => {
setBaseContainerVersion(window.experiments?.rebrandExperiment?.variation);
};
}
};
initRebrandExperiment();
}, []);

if (baseContainerVersion === IMAGE_LAYOUT || enableImageLayout) {
if (enableImageLayout) {
return (
<div className="layout">
<MediaQuery maxWidth={breakpoints.extraSmall.maxWidth - 1}>
Expand Down
17 changes: 0 additions & 17 deletions src/base-container/tests/BaseContainer.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,23 +25,6 @@ describe('Base component tests', () => {
expect(container.querySelector('.large-screen-svg-primary')).toBeDefined();
});

it('[experiment] should show image layout for treatment group', () => {
window.experiments = {
rebrandExperiment: {
variation: 'image-layout',
},
};

const { container } = render(
<IntlProvider locale="en">
<BaseContainer />
</IntlProvider>,
LargeScreen,
);

expect(container.querySelector('.banner__image')).toBeDefined();
});

it('renders Image layout when ENABLE_IMAGE_LAYOUT configuration is enabled', () => {
mergeConfig({
ENABLE_IMAGE_LAYOUT: true,
Expand Down

0 comments on commit 488644f

Please sign in to comment.