From 103a67654c8095d33b7b213930b457a4cb81ee9f Mon Sep 17 00:00:00 2001 From: Jody Bailey <110463597+JodyBaileyy@users.noreply.github.com> Date: Tue, 11 Jul 2023 16:45:14 +0200 Subject: [PATCH] feat: Implemented product recommendations experiment (#174) --- src/App.jsx | 7 +- src/App.test.jsx | 6 +- src/ExperimentContext.jsx | 64 ++++++ src/ExperimentContext.test.jsx | 123 ++++++++++ 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/test/app.test.jsx | 5 + src/widgets/ProductRecommendations/api.js | 4 + .../ProductRecommendations/api.test.js | 10 +- .../components/ProductCard.jsx | 102 ++++++--- .../components/ProductCard.test.jsx | 88 +++++-- .../components/ProductCardContainer.jsx | 8 +- .../components/ProductCardContainer.test.jsx | 3 +- .../components/ProductCardHeader.jsx | 26 ++- .../components/ProductCardHeader.test.jsx | 43 +++- .../__snapshots__/ProductCard.test.jsx.snap | 1 + .../ProductCardContainer.test.jsx.snap | 18 +- .../ProductCardHeader.test.jsx.snap | 3 +- .../ProductRecommendations/constants.js | 7 + src/widgets/ProductRecommendations/hooks.js | 93 +++++++- .../ProductRecommendations/hooks.test.js | 215 +++++++++++++++++- .../optimizelyExperiment.js | 5 +- .../optimizelyExperiment.test.js | 20 +- .../ProductRecommendations/testData.js | 15 +- src/widgets/ProductRecommendations/track.js | 8 +- .../ProductRecommendations/track.test.js | 30 ++- src/widgets/ProductRecommendations/utils.js | 25 +- 32 files changed, 845 insertions(+), 154 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..353340c2 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 = () => { - ) : ()} + ) : ( + + + + )}