UNPKG

@mtdt.temp/browser-core

Version:
43 lines 2.03 kB
/** * LIMITATION: * For NPM setup, this feature flag singleton is shared between RUM and Logs product. * This means that an experimental flag set on the RUM product will be set on the Logs product. * So keep in mind that in certain configurations, your experimental feature flag may affect other products. * * FORMAT: * All feature flags should be snake_cased */ // We want to use a real enum (i.e. not a const enum) here, to be able to check whether an arbitrary // string is an expected feature flag import { objectHasValue } from './utils/objectUtils'; // eslint-disable-next-line no-restricted-syntax export var ExperimentalFeature; (function (ExperimentalFeature) { ExperimentalFeature["TRACK_INTAKE_REQUESTS"] = "track_intake_requests"; ExperimentalFeature["WRITABLE_RESOURCE_GRAPHQL"] = "writable_resource_graphql"; ExperimentalFeature["EARLY_REQUEST_COLLECTION"] = "early_request_collection"; ExperimentalFeature["WATCH_COOKIE_WITHOUT_LOCK"] = "watch_cookie_without_lock"; ExperimentalFeature["USE_TREE_WALKER_FOR_ACTION_NAME"] = "use_tree_walker_for_action_name"; ExperimentalFeature["SHORT_SESSION_INVESTIGATION"] = "short_session_investigation"; })(ExperimentalFeature || (ExperimentalFeature = {})); const enabledExperimentalFeatures = new Set(); export function initFeatureFlags(enableExperimentalFeatures) { if (Array.isArray(enableExperimentalFeatures)) { addExperimentalFeatures(enableExperimentalFeatures.filter((flag) => objectHasValue(ExperimentalFeature, flag))); } } export function addExperimentalFeatures(enabledFeatures) { enabledFeatures.forEach((flag) => { enabledExperimentalFeatures.add(flag); }); } export function isExperimentalFeatureEnabled(featureName) { return enabledExperimentalFeatures.has(featureName); } export function resetExperimentalFeatures() { enabledExperimentalFeatures.clear(); } export function getExperimentalFeatures() { return enabledExperimentalFeatures; } //# sourceMappingURL=experimentalFeatures.js.map