50 lines
2.0 KiB
TypeScript
50 lines
2.0 KiB
TypeScript
/**
|
|
* Feature flags.
|
|
*
|
|
* Flags MUST be short lived and SHALL be removed once enabled.
|
|
*/
|
|
export enum FeatureFlag {
|
|
BrowserFilelessImport = "browser-fileless-import",
|
|
ItemShare = "item-share",
|
|
FlexibleCollectionsV1 = "flexible-collections-v-1", // v-1 is intentional
|
|
VaultOnboarding = "vault-onboarding",
|
|
GeneratorToolsModernization = "generator-tools-modernization",
|
|
KeyRotationImprovements = "key-rotation-improvements",
|
|
FlexibleCollectionsMigration = "flexible-collections-migration",
|
|
ShowPaymentMethodWarningBanners = "show-payment-method-warning-banners",
|
|
EnableConsolidatedBilling = "enable-consolidated-billing",
|
|
AC1795_UpdatedSubscriptionStatusSection = "AC-1795_updated-subscription-status-section",
|
|
UnassignedItemsBanner = "unassigned-items-banner",
|
|
EnableDeleteProvider = "AC-1218-delete-provider",
|
|
}
|
|
|
|
export type AllowedFeatureFlagTypes = boolean | number | string;
|
|
|
|
// Helper to ensure the value is treated as a boolean.
|
|
const FALSE = false as boolean;
|
|
|
|
/**
|
|
* Default value for feature flags.
|
|
*
|
|
* DO NOT enable previously disabled flags, REMOVE them instead.
|
|
* We support true as a value as we prefer flags to "enable" not "disable".
|
|
*/
|
|
export const DefaultFeatureFlagValue = {
|
|
[FeatureFlag.BrowserFilelessImport]: FALSE,
|
|
[FeatureFlag.ItemShare]: FALSE,
|
|
[FeatureFlag.FlexibleCollectionsV1]: FALSE,
|
|
[FeatureFlag.VaultOnboarding]: FALSE,
|
|
[FeatureFlag.GeneratorToolsModernization]: FALSE,
|
|
[FeatureFlag.KeyRotationImprovements]: FALSE,
|
|
[FeatureFlag.FlexibleCollectionsMigration]: FALSE,
|
|
[FeatureFlag.ShowPaymentMethodWarningBanners]: FALSE,
|
|
[FeatureFlag.EnableConsolidatedBilling]: FALSE,
|
|
[FeatureFlag.AC1795_UpdatedSubscriptionStatusSection]: FALSE,
|
|
[FeatureFlag.UnassignedItemsBanner]: FALSE,
|
|
[FeatureFlag.EnableDeleteProvider]: FALSE,
|
|
} satisfies Record<FeatureFlag, AllowedFeatureFlagTypes>;
|
|
|
|
export type DefaultFeatureFlagValueType = typeof DefaultFeatureFlagValue;
|
|
|
|
export type FeatureFlagValueType<Flag extends FeatureFlag> = DefaultFeatureFlagValueType[Flag];
|