From bc92a386ffca35c911ca34b21a20696de33caf04 Mon Sep 17 00:00:00 2001 From: Jody Bailey Date: Sat, 8 Jul 2023 09:37:45 +0200 Subject: [PATCH 01/10] feat: Implemented product recommendations experiment --- src/App.jsx | 7 +- src/App.test.jsx | 6 +- src/__snapshots__/App.test.jsx.snap | 4 +- .../WidgetContainers/LoadedSidebar/index.jsx | 4 +- .../LoadedSidebar/index.test.jsx | 18 +- .../NoCoursesSidebar/index.jsx | 4 +- .../NoCoursesSidebar/index.test.jsx | 18 +- .../WidgetContainers/WidgetFooter/index.jsx | 5 +- .../WidgetFooter/index.test.jsx | 17 +- src/experimentContext.jsx | 74 ++++++ src/experimentContext.test.jsx | 158 +++++++++++++ src/setupTest.jsx | 1 + src/test/app.test.jsx | 5 + src/widgets/ProductRecommendations/api.js | 4 + .../ProductRecommendations/api.test.js | 10 +- .../components/ProductCard.jsx | 89 +++++--- .../components/ProductCard.test.jsx | 80 +++++-- .../components/ProductCardContainer.jsx | 6 +- .../components/ProductCardContainer.test.jsx | 3 +- .../components/ProductCardHeader.jsx | 24 +- .../components/ProductCardHeader.test.jsx | 43 +++- .../__snapshots__/ProductCard.test.jsx.snap | 1 + .../ProductCardContainer.test.jsx.snap | 6 + .../ProductCardHeader.test.jsx.snap | 3 +- .../ProductRecommendations/constants.js | 7 + src/widgets/ProductRecommendations/hooks.js | 93 +++++++- .../ProductRecommendations/hooks.test.js | 211 +++++++++++++++++- .../optimizelyExperiment.js | 5 +- .../optimizelyExperiment.test.js | 20 +- .../ProductRecommendations/testData.js | 7 +- src/widgets/ProductRecommendations/track.js | 8 +- .../ProductRecommendations/track.test.js | 30 ++- src/widgets/ProductRecommendations/utils.js | 23 +- 33 files changed, 852 insertions(+), 142 deletions(-) create mode 100644 src/experimentContext.jsx create mode 100644 src/experimentContext.test.jsx create mode 100644 src/widgets/ProductRecommendations/constants.js diff --git a/src/App.jsx b/src/App.jsx index 5adba841..51ec36e7 100755 --- a/src/App.jsx +++ b/src/App.jsx @@ -19,6 +19,7 @@ import { import { reduxHooks } from 'hooks'; import Dashboard from 'containers/Dashboard'; import ZendeskFab from 'components/ZendeskFab'; +import { ExperimentProvider } from 'experimentContext'; import track from 'tracking'; @@ -84,7 +85,11 @@ export const App = () => { - ) : ()} + ) : ( + + + + )}