* HXCS-3659 copy feature-flags lib * HXCS-3659 remove hxps reference * HXCS-3659 update component selectors * HXCS-3659 replace word overridability with override * HXCS-3659 remove commented/dead code * HXCS-3659 rename files * HXCS-3659 fix imports after renaming files * HXCS-3659 update names to not refer ng 14 * HXCS-3659 update license header * HXCS-3659 remove unused param * HXCS-3659 test StorageFesturesService * HXCS-3659 test DummyFesturesService * HXCS-3659 test DebugFeaturesService in debug mode * HXCS-3659 test DebugFeaturesService in debug mode * HXCS-3659 test DebugFeaturesService not in debug mode * HXCS-3659 test FlagSetParser * HXCS-3659 test feature flags directives * HXCS-3659 test flags component * HXCS-3659 update readme * HXCS-3659 link docs into readme * HXCS-3659 update adf-feature-flags-wrapper css rules * HXCS-3659 update Directive selectors * HXCS-3659 add i18n * HXCS-3659 update FlagsComponent css * HXCS-3659 update directives @Input property names * HXCS-3659 provides guards in the root * HXCS-3659 remove deprecated method getFlagsSnapshot --------- Co-authored-by: Adriano Costa <Adriano.Costa@hyland.comgit>
@alfresco/adf-core/feature-flags
Secondary entry point of @alfresco/adf-core
. It can be used by importing from @alfresco/adf-core/feature-flags
.
Feature flags (aka feature toggles) are a concept that allow product owners to control the availability of a feature in a particular environment. A product manager may use feature flags to hide a feature that isn't complete yet, roll out a feature to a select set of end-users in order to gather feedback, or coordinate a feature "go live" with marketing and other departments. From a developer perspective, feature flags are an important tool that allows them to continually commit their code even if a feature is not complete, thus a proper feature flag capability is essential to a functional continuous delivery model.
Because this library system is BE/Framework agnostic, it's required to implement the service that manages the retrieval of FeatureFlags and provide it to the AppModule:
@NgModule({
declarations: [AppComponent],
providers: [
{ provide: OverridableFeaturesServiceToken, useClass: <YourCustomFeaturesService> },
{ provide: FeaturesServiceToken, useExisting: OverridableFeaturesServiceToken },
{ provide: FeaturesServiceConfigToken, useValue: <CustomConfiguration> }
],
bootstrap: [AppComponent],
})
export class AppModule {}
<YourCustomFeaturesService>
is a service that implements the IFeaturesService
interface:
interface IFeaturesService<T = FlagChangeset> {
init(): Observable<T>;
isOn$(key: string): Observable<boolean>;
isOff$(key: string): Observable<boolean>;
getFlags$(): Observable<T>;
}
A FlagChangeset
is an Object in which keys are Feature Flag names, and values are the current and previous enabled status for that particular flag. The previous status can be null.
interface FlagChangeset {
[key: string]: {
current: boolean;
previous: boolean | null;
};
}
Optionally, is possible to provide a <CustomConfiguration>
{
storageKey?: string;
helperExposeKeyOnDocument?: string;
}
storageKey
: Local Storage key to save feature flags (default: 'feature-flags'
)
helperExposeKeyOnDocument
: browser document key to add commands to enable or disable feature flags from the browser console.
Furher reading: https://hyland.atlassian.net/wiki/spaces/HXP/pages/1308017277/Studio+Management+of+Feature+Flags https://hyland.atlassian.net/wiki/spaces/HXP/pages/1308031390/Developing+frontend+apps+libs+e2es+with+feature+flags