source dump of claude code
at main 25 lines 1.1 kB view raw
1import { getDynamicConfig_CACHED_MAY_BE_STALE } from './growthbook.js' 2 3// Mangled name: per-sink analytics killswitch 4const SINK_KILLSWITCH_CONFIG_NAME = 'tengu_frond_boric' 5 6export type SinkName = 'datadog' | 'firstParty' 7 8/** 9 * GrowthBook JSON config that disables individual analytics sinks. 10 * Shape: { datadog?: boolean, firstParty?: boolean } 11 * A value of true for a key stops all dispatch to that sink. 12 * Default {} (nothing killed). Fail-open: missing/malformed config = sink stays on. 13 * 14 * NOTE: Must NOT be called from inside is1PEventLoggingEnabled() - 15 * growthbook.ts:isGrowthBookEnabled() calls that, so a lookup here would recurse. 16 * Call at per-event dispatch sites instead. 17 */ 18export function isSinkKilled(sink: SinkName): boolean { 19 const config = getDynamicConfig_CACHED_MAY_BE_STALE< 20 Partial<Record<SinkName, boolean>> 21 >(SINK_KILLSWITCH_CONFIG_NAME, {}) 22 // getFeatureValue_CACHED_MAY_BE_STALE guards on `!== undefined`, so a 23 // cached JSON null leaks through instead of falling back to {}. 24 return config?.[sink] === true 25}