@atlaskit/tmp-editor-statsig 101.0.0 → 103.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 +25 -0
- package/dist/cjs/experiments-config.js +0 -33
- package/dist/es2019/experiments-config.js +0 -33
- package/dist/esm/experiments-config.js +0 -33
- package/dist/types/experiments-config.d.ts +0 -24
- package/dynamic-config-value-contains/package.json +1 -8
- package/editor-experiments-test-utils/package.json +1 -8
- package/exp-val-equals/package.json +1 -8
- package/exp-val-equals-no-exposure/package.json +1 -8
- package/expVal/package.json +1 -8
- package/experiments/package.json +1 -8
- package/experiments-config/package.json +1 -8
- package/package.json +1 -1
- package/setup/package.json +1 -8
- package/dist/types-ts4.5/dynamic-config-value-contains.d.ts +0 -7
- package/dist/types-ts4.5/editor-experiments-test-utils.d.ts +0 -61
- package/dist/types-ts4.5/exp-test-overrides.d.ts +0 -12
- package/dist/types-ts4.5/exp-val-equals-internal.d.ts +0 -17
- package/dist/types-ts4.5/exp-val-equals-no-exposure.d.ts +0 -30
- package/dist/types-ts4.5/exp-val-equals.d.ts +0 -30
- package/dist/types-ts4.5/expVal.d.ts +0 -30
- package/dist/types-ts4.5/experiment-builders.d.ts +0 -23
- package/dist/types-ts4.5/experiments-config.d.ts +0 -1687
- package/dist/types-ts4.5/experiments.d.ts +0 -67
- package/dist/types-ts4.5/index.d.ts +0 -1
- package/dist/types-ts4.5/setup.d.ts +0 -40
- package/dist/types-ts4.5/type-guards.d.ts +0 -2
- package/dist/types-ts4.5/types.d.ts +0 -32
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
import type { EditorExperimentsConfig } from './experiments-config';
|
|
2
|
-
/**
|
|
3
|
-
* Check the value of an editor experiment.
|
|
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`.
|
|
49
|
-
*/
|
|
50
|
-
export declare function editorExperiment<ExperimentName extends keyof EditorExperimentsConfig>(experimentName: ExperimentName, expectedExperimentValue: EditorExperimentsConfig[ExperimentName]['defaultValue'], options?: {
|
|
51
|
-
exposure: boolean;
|
|
52
|
-
}): boolean;
|
|
53
|
-
type Unstable_EditorExperimentParams = {};
|
|
54
|
-
/**
|
|
55
|
-
* @warning This currently lacks type safety on the param names and return values
|
|
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
|
|
61
|
-
*/
|
|
62
|
-
export declare function unstable_editorExperimentParam<ExperimentName extends keyof Unstable_EditorExperimentParams, ParamKey extends Unstable_EditorExperimentParams[ExperimentName]['params'], ParamValue = unknown>(experimentName: ExperimentName, paramName: ParamKey, options: {
|
|
63
|
-
defaultValue: ParamValue;
|
|
64
|
-
exposure?: boolean;
|
|
65
|
-
typeGuard: (value: unknown) => value is ParamValue;
|
|
66
|
-
}): ParamValue;
|
|
67
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import { editorExperimentsConfig } from './experiments-config';
|
|
2
|
-
export type EditorExperimentOverrides = Partial<{
|
|
3
|
-
[ExperimentName in keyof typeof editorExperimentsConfig]: (typeof editorExperimentsConfig)[ExperimentName]['defaultValue'];
|
|
4
|
-
}>;
|
|
5
|
-
export type EditorExperimentParamOverrides = {
|
|
6
|
-
[experimentName: string]: {
|
|
7
|
-
[paramName: string]: any;
|
|
8
|
-
};
|
|
9
|
-
};
|
|
10
|
-
export declare let _overrides: EditorExperimentOverrides;
|
|
11
|
-
export declare let _paramOverrides: EditorExperimentParamOverrides;
|
|
12
|
-
export declare let _product: 'bitbucket' | 'confluence' | 'jira' | 'test' | undefined;
|
|
13
|
-
/**
|
|
14
|
-
* This function is used to set up the editor experiments for testing purposes.
|
|
15
|
-
* It should be called before running code that depends on editor experiments.
|
|
16
|
-
*
|
|
17
|
-
* @example
|
|
18
|
-
* ```ts
|
|
19
|
-
* setupEditorExperiments('confluence', {
|
|
20
|
-
* 'experiment-name': 'value',
|
|
21
|
-
* });
|
|
22
|
-
* ```
|
|
23
|
-
*/
|
|
24
|
-
export declare function setupEditorExperiments(product: 'bitbucket' | 'confluence' | 'jira' | 'test',
|
|
25
|
-
/**
|
|
26
|
-
* Overrides are used to set the group of an experiment for testing purposes.
|
|
27
|
-
* This is useful when you want to test a specific experiment group.
|
|
28
|
-
*/
|
|
29
|
-
groupOverrides?: EditorExperimentOverrides,
|
|
30
|
-
/**
|
|
31
|
-
* Param overrides are used to set the experiment parameters for testing purposes.
|
|
32
|
-
* This is useful when you want to tweak the experiment parameters for testing.
|
|
33
|
-
*/
|
|
34
|
-
paramOverrides?: EditorExperimentParamOverrides, options?: {
|
|
35
|
-
/**
|
|
36
|
-
* By default, boolean experiments are enabled when using `product === test`
|
|
37
|
-
* This option allows you to disable this behaviour (ie. for examples)
|
|
38
|
-
*/
|
|
39
|
-
disableTestOverrides?: boolean;
|
|
40
|
-
}): void;
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Used only for documentation/testing purpose
|
|
3
|
-
*/
|
|
4
|
-
export type ProductKeys = {
|
|
5
|
-
bitbucket?: string;
|
|
6
|
-
confluence?: string;
|
|
7
|
-
jira?: string;
|
|
8
|
-
test?: string;
|
|
9
|
-
};
|
|
10
|
-
export type ExperimentConfigValue = {
|
|
11
|
-
param: string;
|
|
12
|
-
productKeys?: ProductKeys;
|
|
13
|
-
typeGuard: (value: unknown) => boolean;
|
|
14
|
-
} & ({
|
|
15
|
-
defaultValue: boolean;
|
|
16
|
-
} | {
|
|
17
|
-
defaultValue: string;
|
|
18
|
-
values: string[];
|
|
19
|
-
});
|
|
20
|
-
export type BooleanExperimentConfig = {
|
|
21
|
-
defaultValue: boolean;
|
|
22
|
-
param: string;
|
|
23
|
-
productKeys?: ProductKeys;
|
|
24
|
-
};
|
|
25
|
-
export type MultivariateExperimentConfig<T extends string[]> = {
|
|
26
|
-
defaultValue: T[number];
|
|
27
|
-
param: string;
|
|
28
|
-
productKeys?: ProductKeys;
|
|
29
|
-
values: [
|
|
30
|
-
...T
|
|
31
|
-
];
|
|
32
|
-
};
|