@atlaskit/tmp-editor-statsig 148.0.0 → 149.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +47 -0
- package/dist/cjs/create-boolean-experiment.js +20 -0
- package/dist/cjs/{experiment-builders.js → create-multivariate-experiment.js} +2 -13
- package/dist/cjs/editor-experiment.js +107 -0
- package/dist/cjs/exp-val-no-exposure.js +15 -0
- package/dist/cjs/exp-val.js +31 -0
- package/dist/cjs/expVal.js +29 -49
- package/dist/cjs/experiments-config.js +298 -306
- package/dist/cjs/experiments.js +12 -127
- package/dist/cjs/is-boolean.js +9 -0
- package/dist/cjs/one-of.js +20 -0
- package/dist/cjs/type-guards.js +1 -27
- package/dist/cjs/unstable-editor-experiment-param.js +37 -0
- package/dist/es2019/create-boolean-experiment.js +11 -0
- package/dist/es2019/{experiment-builders.js → create-multivariate-experiment.js} +1 -12
- package/dist/es2019/editor-experiment.js +100 -0
- package/dist/es2019/exp-val-no-exposure.js +9 -0
- package/dist/es2019/exp-val.js +26 -0
- package/dist/es2019/expVal.js +11 -44
- package/dist/es2019/experiments-config.js +3 -11
- package/dist/es2019/experiments.js +5 -119
- package/dist/es2019/is-boolean.js +3 -0
- package/dist/es2019/one-of.js +14 -0
- package/dist/es2019/type-guards.js +0 -20
- package/dist/es2019/unstable-editor-experiment-param.js +31 -0
- package/dist/esm/create-boolean-experiment.js +13 -0
- package/dist/esm/{experiment-builders.js → create-multivariate-experiment.js} +1 -11
- package/dist/esm/editor-experiment.js +101 -0
- package/dist/esm/exp-val-no-exposure.js +9 -0
- package/dist/esm/exp-val.js +26 -0
- package/dist/esm/expVal.js +11 -44
- package/dist/esm/experiments-config.js +3 -11
- package/dist/esm/experiments.js +5 -120
- package/dist/esm/is-boolean.js +3 -0
- package/dist/esm/one-of.js +14 -0
- package/dist/esm/type-guards.js +0 -20
- package/dist/esm/unstable-editor-experiment-param.js +31 -0
- package/dist/types/create-boolean-experiment.d.ts +11 -0
- package/dist/types/create-multivariate-experiment.d.ts +11 -0
- package/dist/types/editor-experiment.d.ts +52 -0
- package/dist/types/exp-val-no-exposure.d.ts +2 -0
- package/dist/types/exp-val.d.ts +18 -0
- package/dist/types/expVal.d.ts +11 -26
- package/dist/types/experiments-config.d.ts +1 -7
- package/dist/types/experiments.d.ts +4 -63
- package/dist/types/is-boolean.d.ts +1 -0
- package/dist/types/one-of.d.ts +1 -0
- package/dist/types/type-guards.d.ts +8 -2
- package/dist/types/unstable-editor-experiment-param.d.ts +15 -0
- package/package.json +1 -1
- package/dist/types/experiment-builders.d.ts +0 -21
package/dist/types/expVal.d.ts
CHANGED
|
@@ -1,30 +1,15 @@
|
|
|
1
1
|
import type { EditorExperimentsConfig } from './experiments-config';
|
|
2
|
+
export declare function expValInternal<ExperimentName extends keyof EditorExperimentsConfig, DefaultValue extends string | number | boolean>({ experimentName, experimentParam, defaultValue, fireExperimentExposure, }: {
|
|
3
|
+
defaultValue: DefaultValue;
|
|
4
|
+
experimentName: ExperimentName;
|
|
5
|
+
experimentParam: string;
|
|
6
|
+
fireExperimentExposure: boolean;
|
|
7
|
+
}): DefaultValue;
|
|
2
8
|
/**
|
|
3
|
-
* Use
|
|
4
|
-
*
|
|
5
|
-
* **Note**: this will return the default value when the experiment;
|
|
6
|
-
* - is not being served to the client (ie. pre start)
|
|
7
|
-
* - or is not configured in experiments-config
|
|
8
|
-
*
|
|
9
|
-
* If you need to check a param value without an exposure check see {@link expValNoExposure}
|
|
10
|
-
*
|
|
11
|
-
* @example
|
|
12
|
-
* ```ts
|
|
13
|
-
* const delay = expVal('experiment-name', 'param-name', defaultValue)
|
|
14
|
-
* await new Promise(res => setTimeout(res, delay)
|
|
15
|
-
* ```
|
|
9
|
+
* @deprecated Use `import { expVal } from '@atlaskit/tmp-editor-statsig/expVal'` instead.
|
|
16
10
|
*/
|
|
17
|
-
export
|
|
18
|
-
|
|
19
|
-
*
|
|
20
|
-
* **Note**: this will return the default value when the experiment;
|
|
21
|
-
* - is not being served to the client (ie. pre start)
|
|
22
|
-
* - or is not configured in experiments-config
|
|
23
|
-
*
|
|
24
|
-
* @example
|
|
25
|
-
* ```ts
|
|
26
|
-
* const delay = expParamEqualsNoExposure('experiment-name', 'param-name', defaultValue)
|
|
27
|
-
* await new Promise(res => setTimeout(res, delay)
|
|
28
|
-
* ```
|
|
11
|
+
export { expVal } from './exp-val';
|
|
12
|
+
/**
|
|
13
|
+
* @deprecated Use `import { expValNoExposure } from '@atlaskit/tmp-editor-statsig/expVal'` instead.
|
|
29
14
|
*/
|
|
30
|
-
export
|
|
15
|
+
export { expValNoExposure } from './exp-val-no-exposure';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { isBoolean } from './
|
|
1
|
+
import { isBoolean } from './is-boolean';
|
|
2
2
|
import type { ProductKeys } from './types';
|
|
3
3
|
type IsBooleanType = typeof isBoolean;
|
|
4
4
|
export type EditorExperimentsConfig = typeof editorExperimentsConfig;
|
|
@@ -792,12 +792,6 @@ export declare const editorExperimentsConfig: {
|
|
|
792
792
|
productKeys?: ProductKeys;
|
|
793
793
|
typeGuard: IsBooleanType;
|
|
794
794
|
};
|
|
795
|
-
platform_synced_block: {
|
|
796
|
-
defaultValue: boolean;
|
|
797
|
-
param: string;
|
|
798
|
-
productKeys?: ProductKeys;
|
|
799
|
-
typeGuard: IsBooleanType;
|
|
800
|
-
};
|
|
801
795
|
platform_editor_sync_block_activation: {
|
|
802
796
|
defaultValue: boolean;
|
|
803
797
|
param: string;
|
|
@@ -1,67 +1,8 @@
|
|
|
1
|
-
import type { EditorExperimentsConfig } from './experiments-config';
|
|
2
1
|
/**
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
* Note: By default this will not fire an [exposure event](https://hello.atlassian.net/wiki/spaces/~732385844/pages/3187295823/Exposure+Events+101).
|
|
6
|
-
*
|
|
7
|
-
* You need explicitly call it using the exposure property when you need an exposure event to be fired (all experiments should fire exposure events).
|
|
8
|
-
*
|
|
9
|
-
* @example Boolean experiment
|
|
10
|
-
* ```ts
|
|
11
|
-
* if (editorExperiment('example-boolean', true)) {
|
|
12
|
-
* // Run code for on variant
|
|
13
|
-
* } else {
|
|
14
|
-
* // Run code for off variant
|
|
15
|
-
* }
|
|
16
|
-
* ```
|
|
17
|
-
*
|
|
18
|
-
* @example Multivariate experiment
|
|
19
|
-
* ```ts
|
|
20
|
-
* switch (true) {
|
|
21
|
-
* case editorExperiment('example-multivariate', 'one'):
|
|
22
|
-
* // Run code for variant one
|
|
23
|
-
* break;
|
|
24
|
-
* case editorExperiment('example-multivariate', 'two'):
|
|
25
|
-
* // Run code for variant two
|
|
26
|
-
* break;
|
|
27
|
-
* case editorExperiment('example-multivariate', 'three'):
|
|
28
|
-
* // Run code for variant three
|
|
29
|
-
* break;
|
|
30
|
-
* }
|
|
31
|
-
* }
|
|
32
|
-
*```
|
|
33
|
-
|
|
34
|
-
@example Experiment with exposure event
|
|
35
|
-
* ```ts
|
|
36
|
-
* // Inside feature surface where either the control or variant should be shown
|
|
37
|
-
* if (editorExperiment('example-boolean', true, { exposure: true })) {
|
|
38
|
-
* // Run code for on variant
|
|
39
|
-
* } else {
|
|
40
|
-
* // Run code for off variant
|
|
41
|
-
* }
|
|
42
|
-
* ```
|
|
43
|
-
*
|
|
44
|
-
* @private
|
|
45
|
-
* @deprecated This utility is deprecated in favour of using `expValEquals` from `@atlaskit/tmp-editor-statsig/exp-val-equals`.
|
|
46
|
-
* ExpValEquals fires exposure events by default preventing cases when consumers of exitorExperiment forget to pass the `exposure` option.
|
|
47
|
-
* It also closely aligns with similar utilities in other Atlassian products.
|
|
48
|
-
* For no exposure option use `expValEqualsNoExposure` from `@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure`.
|
|
2
|
+
* @deprecated Use `import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments'` instead.
|
|
49
3
|
*/
|
|
50
|
-
export
|
|
51
|
-
exposure: boolean;
|
|
52
|
-
}): boolean;
|
|
53
|
-
type Unstable_EditorExperimentParams = {};
|
|
4
|
+
export { editorExperiment } from './editor-experiment';
|
|
54
5
|
/**
|
|
55
|
-
* @
|
|
56
|
-
* and has limited associated test tooling.
|
|
57
|
-
*
|
|
58
|
-
* It also only works for experiments where the key matches the productKey used.
|
|
59
|
-
*
|
|
60
|
-
* The typeguard and default value is also expected to move to the experiment config
|
|
6
|
+
* @deprecated Use `import { unstable_editorExperimentParam } from '@atlaskit/tmp-editor-statsig/experiments'` instead.
|
|
61
7
|
*/
|
|
62
|
-
export
|
|
63
|
-
defaultValue: ParamValue;
|
|
64
|
-
exposure?: boolean;
|
|
65
|
-
typeGuard: (value: unknown) => value is ParamValue;
|
|
66
|
-
}): ParamValue;
|
|
67
|
-
export {};
|
|
8
|
+
export { unstable_editorExperimentParam } from './unstable-editor-experiment-param';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function isBoolean(value: unknown): value is boolean;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function oneOf<T extends string>(values: T[]): (value: unknown) => value is T;
|
|
@@ -1,2 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
type Global = globalThis.Window & typeof globalThis & {
|
|
2
|
+
process: {
|
|
3
|
+
env: {
|
|
4
|
+
JEST_WORKER_ID: string;
|
|
5
|
+
NODE_ENV: string;
|
|
6
|
+
};
|
|
7
|
+
};
|
|
8
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
type Unstable_EditorExperimentParams = {};
|
|
2
|
+
/**
|
|
3
|
+
* @warning This currently lacks type safety on the param names and return values
|
|
4
|
+
* and has limited associated test tooling.
|
|
5
|
+
*
|
|
6
|
+
* It also only works for experiments where the key matches the productKey used.
|
|
7
|
+
*
|
|
8
|
+
* The typeguard and default value is also expected to move to the experiment config
|
|
9
|
+
*/
|
|
10
|
+
export declare function unstable_editorExperimentParam<ExperimentName extends keyof Unstable_EditorExperimentParams, ParamKey extends Unstable_EditorExperimentParams[ExperimentName]['params'], ParamValue = unknown>(experimentName: ExperimentName, paramName: ParamKey, options: {
|
|
11
|
+
defaultValue: ParamValue;
|
|
12
|
+
exposure?: boolean;
|
|
13
|
+
typeGuard: (value: unknown) => value is ParamValue;
|
|
14
|
+
}): ParamValue;
|
|
15
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { isBoolean } from './type-guards';
|
|
2
|
-
import type { BooleanExperimentConfig, MultivariateExperimentConfig, ProductKeys } from './types';
|
|
3
|
-
/**
|
|
4
|
-
* Helper to create a boolean experiment configuration
|
|
5
|
-
*/
|
|
6
|
-
export declare function createBooleanExperiment(config: BooleanExperimentConfig): {
|
|
7
|
-
defaultValue: boolean;
|
|
8
|
-
param: string;
|
|
9
|
-
productKeys?: ProductKeys;
|
|
10
|
-
typeGuard: typeof isBoolean;
|
|
11
|
-
};
|
|
12
|
-
/**
|
|
13
|
-
* Helper to create a multivariate experiment configuration
|
|
14
|
-
*/
|
|
15
|
-
export declare function createMultivariateExperiment<T extends string[]>(config: MultivariateExperimentConfig<T>): {
|
|
16
|
-
defaultValue: T[number];
|
|
17
|
-
param: string;
|
|
18
|
-
productKeys?: ProductKeys;
|
|
19
|
-
typeGuard: (value: unknown) => value is T[number];
|
|
20
|
-
values: [...T][number][];
|
|
21
|
-
};
|