{"version":3,"file":"experimentalFeatures.mjs","names":[],"sources":["../../src/tools/experimentalFeatures.ts"],"sourcesContent":["/**\n * LIMITATION:\n * For NPM setup, this feature flag singleton is shared between RUM and Logs product.\n * This means that an experimental flag set on the RUM product will be set on the Logs product.\n * So keep in mind that in certain configurations, your experimental feature flag may affect other products.\n *\n * FORMAT:\n * All feature flags should be snake_cased\n */\n// We want to use a real enum (i.e. not a const enum) here, to be able to check whether an arbitrary\n// string is an expected feature flag\n\nimport { objectHasValue } from './utils/objectUtils'\n\n// eslint-disable-next-line no-restricted-syntax\nexport enum ExperimentalFeature {\n  TRACK_INTAKE_REQUESTS = 'track_intake_requests',\n  PARTIAL_VIEW_UPDATES = 'partial_view_updates',\n}\n\nconst enabledExperimentalFeatures: Set<ExperimentalFeature> = new Set()\n\nexport function initFeatureFlags(enableExperimentalFeatures: string[] | undefined) {\n  if (Array.isArray(enableExperimentalFeatures)) {\n    addExperimentalFeatures(\n      enableExperimentalFeatures.filter((flag): flag is ExperimentalFeature =>\n        objectHasValue(ExperimentalFeature, flag)\n      )\n    )\n  }\n}\n\nexport function addExperimentalFeatures(enabledFeatures: ExperimentalFeature[]): void {\n  enabledFeatures.forEach((flag) => {\n    enabledExperimentalFeatures.add(flag)\n  })\n}\n\nexport function isExperimentalFeatureEnabled(featureName: ExperimentalFeature): boolean {\n  return enabledExperimentalFeatures.has(featureName)\n}\n\nexport function resetExperimentalFeatures(): void {\n  enabledExperimentalFeatures.clear()\n}\n\nexport function getExperimentalFeatures(): Set<ExperimentalFeature> {\n  return enabledExperimentalFeatures\n}\n"],"mappings":";;;;;;;;;;;AAeA,IAAY,sBAAL,yBAAA,qBAAA;CACL,oBAAA,2BAAA;CACA,oBAAA,0BAAA;;AACF,EAAA,CAAA,CAAA;AAEA,MAAM,8CAAwD,IAAI,IAAI;AAEtE,SAAgB,iBAAiB,4BAAkD;CACjF,IAAI,MAAM,QAAQ,0BAA0B,GAC1C,wBACE,2BAA2B,QAAQ,SACjC,eAAe,qBAAqB,IAAI,CAC1C,CACF;AAEJ;AAEA,SAAgB,wBAAwB,iBAA8C;CACpF,gBAAgB,SAAS,SAAS;EAChC,4BAA4B,IAAI,IAAI;CACtC,CAAC;AACH;AAEA,SAAgB,6BAA6B,aAA2C;CACtF,OAAO,4BAA4B,IAAI,WAAW;AACpD;AAMA,SAAgB,0BAAoD;CAClE,OAAO;AACT"}