@atlaskit/tmp-editor-statsig

中文文档
259.0.0发布于 2026/11/07Apache-2.0TypeScriptESM + CJS近 30 天下载 113.3万

Temp plugin to ease use of statsig feature flags until platform feature flags are available

原始使用文档
文档目录3 节
  1. Usage
  2. Experiments
  3. Configuration

@atlaskit/tmp-editor-statsig

Temp plugin to ease use of statsig feature flags until platform feature flags are available Temp plugin to ease use of statsig experiment until a platform solution is available.

Warning: This is a temporary solution and will be removed once there is a platform solution for statsig experiments.

Warning: This requires per product setup via the `setupEditorExperiments` api (products without this setup will receive the default value setup for experiments).

Usage

Experiments

All experiments must be registered in the `editorExperimentsConfig` object in the experiments.ts file.

Once they are registered, they can be accessed using the `editorExperiment` function from `@atlaskit/tmp-editor-statsig/experiments`.

Boolean experiments

import { editorExperiment } from '@atlaskit/editor-statsig-tmp/experiments';

if (editorExperiment('editor_inline_comments_on_inline_nodes', true)) {
    // do something
} else {
    // do something else
}

Multivariate experiments

import { editorExperiment } from '@atlaskit/editor-statsig-tmp/experiments';

switch (true) {
    case editorExperiment('editor_new_control_variants', 'variant-one'): {
        // do something for variant one
        return
    }
    case editorExperiment('editor_new_control_variants', 'variant-two'): {
        // do something for variant two
        return
    }
    case editorExperiment('editor_new_control_variants', 'variant-three'): {
        // do something for variant three
        return
    }
}
`}


### Testing experiments

#### Atlaskit examples

Not yet supported.

#### Jest tests
##### Boolean experiments

```tsx
import { eeTest } from '@atlaskit/tmp-editor-statsig/editor-experiments-test-utils';

eeTest('example-boolean', {
    true: () => {
        expect(editorExperiment('example-boolean', true)).toBe(true);
    },
    false: () => {
        expect(editorExperiment('example-boolean', false)).toBe(false);
    },
});
Multivariate experiments
import { eeTest } from '@atlaskit/tmp-editor-statsig/editor-experiments-test-utils';

eeTest('example-multivariate', {
    one: () => {
        expect(editorExperiment('example-boolean')).toBe('variant-one');
    },
    two: () => {
        expect(editorExperiment('example-boolean')).toBe('variant-two');
    },
    three: () => {
        expect(editorExperiment('example-boolean')).toBe('variant-three');
    },
});

Playwright tests

Editor Experiments are setup similar to platformFeatureFlags.

test.use({
    adf: exampleAdf,
    platformFeatureFlags: {
        // ...
    },
    editorExperiments: {
        'example-boolean': true,
        'example-multivariate': 'variant',
    },
});

Configuration

import { setupEditorExperiments } from '@atlaskit/tmp-editor-statsig/experiments';

// Example confluence setup
setupEditorExperiments('confluence');

// Example dev util setup -- takes overrides as a second param (and otherwise defaults all experiments to their default values)
setupEditorExperiments('test', { 'example-boolean': true });
```tsx


## Usage

Detailed docs and example usage can be found
[here](https://atlaskit.atlassian.com/packages/editor/tmp-editor-feature-gate-js-client).

版本与发布记录

@atlaskit/tmp-editor-statsig 共发布 892 个版本,首次发布于 2024/06/19;过去 12 个月发布了 607 个版本。

版本发布日期距今
259.0.0latest2026/11/07今天
258.0.12026/11/061 天前
258.0.02026/11/061 天前
257.0.02026/11/061 天前
256.0.02026/11/061 天前
255.0.02026/11/062 天前

关于 @atlaskit/tmp-editor-statsig 的常见问题

@atlaskit/tmp-editor-statsig 是什么?

Temp plugin to ease use of statsig feature flags until platform feature flags are available

如何安装 @atlaskit/tmp-editor-statsig?

在项目目录运行 npm install @atlaskit/tmp-editor-statsig,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:react(^18.2.0 || ^19.2.0)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。

@atlaskit/tmp-editor-statsig 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@atlaskit/tmp-editor-statsig 支持 ESM 还是 CommonJS?

同时提供 ES Module 与 CommonJS 入口,import 和 require() 都可以使用,打包工具会自动选择合适的版本。

@atlaskit/tmp-editor-statsig 可以商用吗?

@atlaskit/tmp-editor-statsig 使用 Apache-2.0 许可。宽松许可:允许商业使用、修改和再分发,并附带明确的专利授权;分发时需保留许可与 NOTICE 文件,修改过的文件要注明改动。以上为概括,不构成法律意见,请以许可原文为准。

@atlaskit/tmp-editor-statsig 的下载量有多少?

根据 npm 官方下载统计,@atlaskit/tmp-editor-statsig 在 2026/10/07 – 2026/11/05 这 30 天内被下载 1,133,034 次,日均约 37,768 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@atlaskit/tmp-editor-statsig 还在维护吗?

最新版本 259.0.0 发布于 2026/11/07(今天);至今共发布 892 个版本,其中过去 12 个月发布了 607 个;首次发布于 2024/06/19。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。