This repository was archived by the owner on Jul 9, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 374
feat: Adding feature flag infrastructure #4428
Merged
Merged
Changes from 10 commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
101243c
initial front end feature flag implementation
pavolumMsft 912d101
Merging latest
pavolumMsft a1d73da
Initial server implementation
pavolumMsft a788f58
Converting state to object over array
pavolumMsft 239a45b
Cleaning up dev test changes
pavolumMsft 19a1561
created HOC to abstract feature flag checking for UI features. Change…
pavolumMsft f65cf8a
Added feature flag value population for hidden feature flags via env …
pavolumMsft 7e24fce
Making PR changes: variable and file name changes, general clean up, …
pavolumMsft 8a4684e
adding format message for feature flag strings
pavolumMsft bb97679
moving ComposerFeature HOC to client workspace so it is implicitly aw…
pavolumMsft ecf4f25
changed default feature flags to function for format message, created…
pavolumMsft 76008bf
merging latest
pavolumMsft 08da677
adding selector for feature flag filtered template state, created fea…
pavolumMsft f1ec8c8
removing unneeded div
pavolumMsft 7f1b773
Adding util functions and reusing hook in HOC
pavolumMsft 45ae235
Updating UI for electron and web view of feature flag toggle per desi…
pavolumMsft 5c4373a
Added feature flag documentation
pavolumMsft 3bf1f67
Merging latest
pavolumMsft be7db2a
removing unused imports and variables
pavolumMsft 1101fe5
Updated unit tests, added build locale
pavolumMsft 7f5511f
Merge branch 'main' into pavolum/featureFlags
cwhitten File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
Composer/packages/client/src/components/ComposerFeature.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| // Copyright (c) Microsoft Corporation. | ||
| // Licensed under the MIT License. | ||
| import { FeatureFlagKey } from '@bfc/shared'; | ||
| import React, { Fragment } from 'react'; | ||
| import { useRecoilValue } from 'recoil'; | ||
|
|
||
| import { featureFlagsState } from '../recoilModel'; | ||
|
|
||
| type ComposerFeatureProps = { | ||
| featureFlagKey: FeatureFlagKey; | ||
| }; | ||
|
|
||
| export const ComposerFeature: React.FC<ComposerFeatureProps> = (props) => { | ||
| const { featureFlagKey } = props; | ||
| const featureFlags = useRecoilValue(featureFlagsState); | ||
| return ( | ||
| <Fragment>{featureFlags[featureFlagKey] && featureFlags[featureFlagKey].enabled ? props.children : null}</Fragment> | ||
| ); | ||
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletions
40
Composer/packages/client/src/pages/setting/app-settings/FeatureFlagCheckBox.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,40 @@ | ||
| // Copyright (c) Microsoft Corporation. | ||
| // Licensed under the MIT License. | ||
|
|
||
| /** @jsx jsx */ | ||
| import { jsx } from '@emotion/core'; | ||
| import React from 'react'; | ||
| import { Checkbox } from 'office-ui-fabric-react/lib/Checkbox'; | ||
| import { FeatureFlagKey } from '@bfc/shared'; | ||
|
|
||
| import * as styles from './styles'; | ||
|
|
||
| type FeatureFlagCheckBoxProps = { | ||
| featureFlagKey: FeatureFlagKey; | ||
| featureFlagName: string; | ||
| description: string; | ||
| enabled: boolean; | ||
| toggleFeatureFlag: (FeatureFlagKey: string, enabled: boolean) => void; | ||
| }; | ||
|
|
||
| const renderLabel = (featureName: string, description: string) => () => ( | ||
| <span> | ||
| <span css={styles.featureFlagTitle}>{`${featureName}.`}</span> | ||
| {` ${description}`} | ||
| </span> | ||
| ); | ||
|
|
||
| export const FeatureFlagCheckBox: React.FC<FeatureFlagCheckBoxProps> = (props) => { | ||
| return ( | ||
| <Checkbox | ||
| checked={props.enabled} | ||
| css={styles.featureFlagContainer} | ||
| onChange={(e: any, checked?: boolean) => { | ||
| if (checked !== undefined) { | ||
| props.toggleFeatureFlag(props.featureFlagKey, checked); | ||
| } | ||
| }} | ||
| onRenderLabel={renderLabel(props.featureFlagName, props.description)} | ||
| /> | ||
| ); | ||
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 12 additions & 0 deletions
12
...oser/packages/client/src/pages/setting/app-settings/images/preview-features.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
Composer/packages/lib/shared/src/featureFlagUtils/index.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| // Copyright (c) Microsoft Corporation. | ||
| // Licensed under the MIT License. | ||
|
|
||
| import formatMessage from 'format-message'; | ||
|
|
||
| export type FeatureFlag = { | ||
| // Name to be displayed for this features toggle UI in app settings page | ||
| displayName: string; | ||
| // Description to be displayed for this features toggle UI in app settings page | ||
| description: string; | ||
| // Indicates whether or not the feature flag toggle will be visible to the user through the settings page UI | ||
| // Hidden feature flags are intended for features not ready for public preview | ||
| isHidden: boolean; | ||
| enabled: boolean; | ||
| }; | ||
|
|
||
| export type FeatureFlagKey = 'VA_CREATION' | 'SHOW_FORM_DIALOG'; | ||
|
|
||
| export type FeatureFlagMap = Record<FeatureFlagKey, FeatureFlag>; | ||
|
|
||
| export const defaultFeatureFlags: FeatureFlagMap = { | ||
| VA_CREATION: { | ||
| displayName: formatMessage('VA Creation'), | ||
| description: formatMessage('VA template made available in new bot flow.'), | ||
| isHidden: false, | ||
| enabled: false, | ||
| }, | ||
| SHOW_FORM_DIALOG: { | ||
| displayName: formatMessage('Show Form Dialog'), | ||
| description: formatMessage('Show form dialog editor in the canvas'), | ||
| isHidden: true, | ||
| enabled: false, | ||
| }, | ||
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.