From a479c7c55c8c89131ad7d3cc2305189c10a77dd0 Mon Sep 17 00:00:00 2001 From: Martin McKeaveney Date: Wed, 8 Jun 2022 10:20:47 +0100 Subject: [PATCH] Beta tab initial test for E2E, needs styled --- packages/builder/src/components/beta/BetaTab.svelte | 6 +++--- packages/builder/src/stores/backend/flags.js | 3 +++ packages/frontend-core/src/api/flags.js | 9 +++++++++ 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/packages/builder/src/components/beta/BetaTab.svelte b/packages/builder/src/components/beta/BetaTab.svelte index e8c484eba1..145fcf9b68 100644 --- a/packages/builder/src/components/beta/BetaTab.svelte +++ b/packages/builder/src/components/beta/BetaTab.svelte @@ -1,13 +1,13 @@ diff --git a/packages/builder/src/stores/backend/flags.js b/packages/builder/src/stores/backend/flags.js index 449d010640..9f1652676c 100644 --- a/packages/builder/src/stores/backend/flags.js +++ b/packages/builder/src/stores/backend/flags.js @@ -16,6 +16,9 @@ export function createFlagsStore() { }) await actions.fetch() }, + toggleUiFeature: async feature => { + await API.toggleUiFeature({ value: feature }) + }, } return { diff --git a/packages/frontend-core/src/api/flags.js b/packages/frontend-core/src/api/flags.js index bb545e83b9..16adeb7b5d 100644 --- a/packages/frontend-core/src/api/flags.js +++ b/packages/frontend-core/src/api/flags.js @@ -22,4 +22,13 @@ export const buildFlagEndpoints = API => ({ }, }) }, + /** + * Allows us to experimentally toggle a beta UI feature through a cookie. + * @param value the feature to toggle + */ + toggleUiFeature: async ({ value }) => { + return await API.post({ + url: `/api/beta/${value}`, + }) + }, })