From aabb5422bef13c02d9a7df8d1f37df78e8b36472 Mon Sep 17 00:00:00 2001 From: Ganesh Kotagiri Date: Tue, 8 Feb 2022 06:19:02 +0000 Subject: [PATCH] Merged PR 1314: Implementing Feature Flags Before submitting this PR, please make ensure you've completed the following: - [ ] Your code builds clean without any errors **or warnings**. - [ ] All unused code has been deleted. - [ ] All TODOs in the code base have an associated ticket in ADO. - [ ] Your squash commit to main has a short descriptive commit message. Describe your PR: Please find below Task Id's 1)TASK 3847 If submitting to the FrontEnd UI, include a screenshot of the change: Implementing Feature Flags Related work items: #3847 --- Converge/ClientApp/FEATURE FLAGS.md | 7 +++++++ Converge/ClientApp/package-lock.json | 15 +++++++++++++++ Converge/ClientApp/package.json | 1 + Converge/ClientApp/src/featureFlag.js | 8 ++++++++ Converge/ClientApp/yarn.lock | 7 ++++++- 5 files changed, 37 insertions(+), 1 deletion(-) create mode 100644 Converge/ClientApp/FEATURE FLAGS.md create mode 100644 Converge/ClientApp/src/featureFlag.js diff --git a/Converge/ClientApp/FEATURE FLAGS.md b/Converge/ClientApp/FEATURE FLAGS.md new file mode 100644 index 0000000..35af8d8 --- /dev/null +++ b/Converge/ClientApp/FEATURE FLAGS.md @@ -0,0 +1,7 @@ +# FEATURE FLAGS SETUP + +1. Install it from npm (npm i flagged). +2. Import the FlagsProvider in your code and wrap your application around it.(import { FlagsProvider } from 'flagged’) +3. The features prop you pass to FlagsProvider could be an array of strings or an object. If you decide to use an object you could also pass nested objects to group feature flags together(). +4. Import the Feature in your code and wrap your application around it(import { Feature } from 'flagged'). +5. Pass the name of the feature you want to check for and a children value and it will not render the children if the feature is enabled.. \ No newline at end of file diff --git a/Converge/ClientApp/package-lock.json b/Converge/ClientApp/package-lock.json index ca6182d..69abff7 100644 --- a/Converge/ClientApp/package-lock.json +++ b/Converge/ClientApp/package-lock.json @@ -32,6 +32,7 @@ "axios-cache-adapter": "2.7.3", "bingmaps": "2.0.3", "dayjs": "1.10.5", + "flagged": "^2.0.1", "lodash": "4.17.21", "office-ui-fabric-react": "7.170.3", "react": "16.10", @@ -10137,6 +10138,14 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/flagged": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/flagged/-/flagged-2.0.1.tgz", + "integrity": "sha512-cKkJdbHruBbi4CAufayqDs1X6PYMKE+MZmG/3mYBPZw1M0dY+tA14tDTkg5+TISQwZ7tTIzwubFZNv4lm7XENw==", + "peerDependencies": { + "react": ">=16" + } + }, "node_modules/flat-cache": { "version": "3.0.4", "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-3.0.4.tgz", @@ -27925,6 +27934,12 @@ "path-exists": "^4.0.0" } }, + "flagged": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/flagged/-/flagged-2.0.1.tgz", + "integrity": "sha512-cKkJdbHruBbi4CAufayqDs1X6PYMKE+MZmG/3mYBPZw1M0dY+tA14tDTkg5+TISQwZ7tTIzwubFZNv4lm7XENw==", + "requires": {} + }, "flat-cache": { "version": "3.0.4", "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-3.0.4.tgz", diff --git a/Converge/ClientApp/package.json b/Converge/ClientApp/package.json index 8d91ced..84cff35 100644 --- a/Converge/ClientApp/package.json +++ b/Converge/ClientApp/package.json @@ -27,6 +27,7 @@ "axios-cache-adapter": "2.7.3", "bingmaps": "2.0.3", "dayjs": "1.10.5", + "flagged": "^2.0.1", "lodash": "4.17.21", "office-ui-fabric-react": "7.170.3", "react": "16.10", diff --git a/Converge/ClientApp/src/featureFlag.js b/Converge/ClientApp/src/featureFlag.js new file mode 100644 index 0000000..60878e2 --- /dev/null +++ b/Converge/ClientApp/src/featureFlag.js @@ -0,0 +1,8 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +const flags = { + vipOnly: true, + adminOnly: true, +}; +export default flags; diff --git a/Converge/ClientApp/yarn.lock b/Converge/ClientApp/yarn.lock index 35f2dcf..b783fdd 100644 --- a/Converge/ClientApp/yarn.lock +++ b/Converge/ClientApp/yarn.lock @@ -5679,6 +5679,11 @@ "locate-path" "^6.0.0" "path-exists" "^4.0.0" +"flagged@^2.0.1": + "integrity" "sha512-cKkJdbHruBbi4CAufayqDs1X6PYMKE+MZmG/3mYBPZw1M0dY+tA14tDTkg5+TISQwZ7tTIzwubFZNv4lm7XENw==" + "resolved" "https://registry.npmjs.org/flagged/-/flagged-2.0.1.tgz" + "version" "2.0.1" + "flat-cache@^3.0.4": "integrity" "sha512-dm9s5Pw7Jc0GvMYbshN6zchCA9RgQlzzEZX3vylR9IqFfS8XciblUXOKfW6SiuJ0e13eDYZoZV5wdrev7P3Nwg==" "resolved" "https://registry.npmjs.org/flat-cache/-/flat-cache-3.0.4.tgz" @@ -8915,7 +8920,7 @@ "loose-envify" "^1.4.0" "prop-types" "^15.6.2" -"react@*", "react@^0.14.0 || ^15.0.0 || ^16.0.0 || ^17.0.0", "react@^16.0.0", "react@^16.3.0", "react@^16.8.0", "react@^16.8.0 || ^17", "react@^17.0.1", "react@>= 16", "react@>=0.14.9", "react@>=15", "react@>=16.6.0", "react@>=16.8.0 <17.0.0", "react@>=16.8.0 <18.0.0", "react@16.10": +"react@*", "react@^0.14.0 || ^15.0.0 || ^16.0.0 || ^17.0.0", "react@^16.0.0", "react@^16.3.0", "react@^16.8.0", "react@^16.8.0 || ^17", "react@^17.0.1", "react@>= 16", "react@>=0.14.9", "react@>=15", "react@>=16", "react@>=16.6.0", "react@>=16.8.0 <17.0.0", "react@>=16.8.0 <18.0.0", "react@16.10": "integrity" "sha512-MFVIq0DpIhrHFyqLU0S3+4dIcBhhOvBE8bJ/5kHPVOVaGdo0KuiQzpcjCPsf585WvhypqtrMILyoE2th6dT+Lw==" "resolved" "https://registry.npmjs.org/react/-/react-16.10.2.tgz" "version" "16.10.2"