@atlaskit/tmp-editor-statsig 2.1.15 → 2.2.1

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.
@@ -1,5 +1,7 @@
1
+ /// <reference types="jest" />
1
2
  import { type EditorExperimentOverrides } from './setup';
2
3
  import { type EditorExperimentsConfig } from './experiments-config';
4
+ type DescribeBody = Parameters<typeof describe>[1];
3
5
  /**
4
6
  * This is a utility function for testing editor experiments.
5
7
  *
@@ -7,11 +9,11 @@ import { type EditorExperimentsConfig } from './experiments-config';
7
9
  * ```ts
8
10
  * eeTest('example-boolean', {
9
11
  * true: () => {
10
- * expect(editorExperiment('example-boolean', true)).toBe(true);
11
- * expect(editorExperiment('example-boolean', false)).toBe(false);
12
+ * expect(editorExperiment('example-boolean', true)).toBe(true);
13
+ * expect(editorExperiment('example-boolean', false)).toBe(false);
12
14
  * },
13
15
  * false: () => {
14
- * expect(editorExperiment('example-boolean', false)).toBe(true);
16
+ * expect(editorExperiment('example-boolean', false)).toBe(true);
15
17
  * expect(editorExperiment('example-boolean', true)).toBe(false);
16
18
  * },
17
19
  * })
@@ -21,21 +23,225 @@ import { type EditorExperimentsConfig } from './experiments-config';
21
23
  * ```ts
22
24
  * eeTest('example-multivariate', {
23
25
  * one: () => {
24
- * expect(editorExperiment('example-multivariate', 'one')).toBe(true);
25
- * expect(editorExperiment('example-multivariate', 'two')).toBe(false);
26
+ * expect(editorExperiment('example-multivariate', 'one')).toBe(true);
27
+ * expect(editorExperiment('example-multivariate', 'two')).toBe(false);
26
28
  * },
27
29
  * two: () => {
28
- * expect(editorExperiment('example-multivariate', 'two')).toBe(true);
29
- * expect(editorExperiment('example-multivariate', 'one')).toBe(false);
30
+ * expect(editorExperiment('example-multivariate', 'two')).toBe(true);
31
+ * expect(editorExperiment('example-multivariate', 'one')).toBe(false);
30
32
  * },
31
33
  * three: () => {
32
- * expect(editorExperiment('example-multivariate', 'three')).toBe(true);
33
- * expect(editorExperiment('example-multivariate', 'one')).toBe(false);
34
+ * expect(editorExperiment('example-multivariate', 'three')).toBe(true);
35
+ * expect(editorExperiment('example-multivariate', 'one')).toBe(false);
34
36
  * },
35
37
  * })
36
38
  * ```
39
+ *
40
+ * API based on Legacy ffTest API
41
+ * - https://hello.atlassian.net/wiki/spaces/AF/pages/2569505829/Task+Testing+your+feature+flag+in+platform+and+product#Legacy-API-lEGACY
37
42
  */
38
- export declare function eeTest<ExperimentName extends keyof EditorExperimentsConfig>(experimentName: ExperimentName, cases: EditorExperimentsConfig[ExperimentName]['defaultValue'] extends string ? Record<EditorExperimentsConfig[ExperimentName]['defaultValue'], () => void | Promise<void>> : {
39
- true: () => void | Promise<void>;
40
- false: () => void | Promise<void>;
43
+ declare function eeTest<ExperimentName extends keyof EditorExperimentsConfig>(experimentName: ExperimentName, cases: EditorExperimentsConfig[ExperimentName]['defaultValue'] extends string ? Record<EditorExperimentsConfig[ExperimentName]['defaultValue'], DescribeBody> : {
44
+ true: DescribeBody;
45
+ false: DescribeBody;
41
46
  }, otherExperiments?: EditorExperimentOverrides): void;
47
+ declare namespace eeTest {
48
+ var describe: <ExperimentName extends "example-boolean" | "example-multivariate" | "test-new-experiments-package" | "basic-text-transformations" | "platform_editor_ai_command_palate_improvement" | "dnd-input-performance-optimisation" | "element-level-templates" | "add-media-from-url" | "nested-dnd" | "table-nested-dnd" | "insert-menu-in-right-rail" | "platform_editor_empty_line_prompt" | "support_table_in_comment" | "platform_editor_exp_lazy_node_views" | "platform_editor_ai_ai_button_block_elements" | "platform_renderer_table_sticky_scrollbar" | "nest-media-and-codeblock-in-quote" | "nested-expand-in-expand" | "platform_editor_ai_command_palette_post_ga" | "platform_editor_table_use_shared_state_hook" | "editor_ai_-_multi_prompts" | "platform_editor_ai_additional_editor_prompts" | "comment_on_bodied_extensions" | "platform_editor_ai_floating_toolbar_v2">(experimentName: ExperimentName, describeName: string) => {
49
+ variant: (value: {
50
+ 'example-boolean': {
51
+ productKeys: {
52
+ confluence: string;
53
+ };
54
+ param: string;
55
+ typeGuard: typeof import("./type-guards").isBoolean;
56
+ defaultValue: boolean;
57
+ };
58
+ 'example-multivariate': {
59
+ productKeys: {
60
+ confluence: string;
61
+ };
62
+ param: string;
63
+ typeGuard: (value: unknown) => value is "one" | "two" | "three";
64
+ defaultValue: "one" | "two" | "three";
65
+ };
66
+ 'test-new-experiments-package': {
67
+ productKeys: {
68
+ confluence: string;
69
+ jira: string;
70
+ };
71
+ param: string;
72
+ typeGuard: typeof import("./type-guards").isBoolean;
73
+ defaultValue: boolean;
74
+ };
75
+ 'basic-text-transformations': {
76
+ productKeys: {
77
+ confluence: string;
78
+ };
79
+ param: string;
80
+ typeGuard: typeof import("./type-guards").isBoolean;
81
+ defaultValue: boolean;
82
+ };
83
+ platform_editor_ai_command_palate_improvement: {
84
+ productKeys: {
85
+ confluence: string;
86
+ };
87
+ param: string;
88
+ typeGuard: (value: unknown) => value is "test" | "control";
89
+ defaultValue: "test" | "control";
90
+ };
91
+ 'dnd-input-performance-optimisation': {
92
+ productKeys: {
93
+ confluence: string;
94
+ };
95
+ param: string;
96
+ typeGuard: typeof import("./type-guards").isBoolean;
97
+ defaultValue: boolean;
98
+ };
99
+ 'element-level-templates': {
100
+ productKeys: {
101
+ confluence: string;
102
+ };
103
+ param: string;
104
+ typeGuard: typeof import("./type-guards").isBoolean;
105
+ defaultValue: boolean;
106
+ };
107
+ 'add-media-from-url': {
108
+ productKeys: {
109
+ confluence: string;
110
+ };
111
+ param: string;
112
+ typeGuard: typeof import("./type-guards").isBoolean;
113
+ defaultValue: boolean;
114
+ };
115
+ 'nested-dnd': {
116
+ productKeys: {
117
+ confluence: string;
118
+ };
119
+ param: string;
120
+ typeGuard: typeof import("./type-guards").isBoolean;
121
+ defaultValue: boolean;
122
+ };
123
+ 'table-nested-dnd': {
124
+ productKeys: {
125
+ confluence: string;
126
+ };
127
+ param: string;
128
+ typeGuard: typeof import("./type-guards").isBoolean;
129
+ defaultValue: boolean;
130
+ };
131
+ 'insert-menu-in-right-rail': {
132
+ productKeys: {
133
+ confluence: string;
134
+ };
135
+ param: string;
136
+ typeGuard: typeof import("./type-guards").isBoolean;
137
+ defaultValue: boolean;
138
+ };
139
+ platform_editor_empty_line_prompt: {
140
+ productKeys: {
141
+ confluence: string;
142
+ };
143
+ param: string;
144
+ typeGuard: typeof import("./type-guards").isBoolean;
145
+ defaultValue: boolean;
146
+ };
147
+ support_table_in_comment: {
148
+ productKeys: {
149
+ confluence: string;
150
+ };
151
+ param: string;
152
+ typeGuard: typeof import("./type-guards").isBoolean;
153
+ defaultValue: boolean;
154
+ };
155
+ platform_editor_exp_lazy_node_views: {
156
+ productKeys: {
157
+ confluence: string;
158
+ };
159
+ param: string;
160
+ typeGuard: typeof import("./type-guards").isBoolean;
161
+ defaultValue: boolean;
162
+ };
163
+ platform_editor_ai_ai_button_block_elements: {
164
+ productKeys: {
165
+ confluence: string;
166
+ };
167
+ param: string;
168
+ typeGuard: (value: unknown) => value is "test" | "control";
169
+ defaultValue: "test" | "control";
170
+ };
171
+ platform_renderer_table_sticky_scrollbar: {
172
+ productKeys: {
173
+ confluence: string;
174
+ };
175
+ param: string;
176
+ typeGuard: typeof import("./type-guards").isBoolean;
177
+ defaultValue: boolean;
178
+ };
179
+ 'nest-media-and-codeblock-in-quote': {
180
+ productKeys: {
181
+ confluence: string;
182
+ };
183
+ param: string;
184
+ typeGuard: typeof import("./type-guards").isBoolean;
185
+ defaultValue: boolean;
186
+ };
187
+ 'nested-expand-in-expand': {
188
+ productKeys: {
189
+ confluence: string;
190
+ };
191
+ param: string;
192
+ typeGuard: typeof import("./type-guards").isBoolean;
193
+ defaultValue: boolean;
194
+ };
195
+ platform_editor_ai_command_palette_post_ga: {
196
+ productKeys: {
197
+ confluence: string;
198
+ };
199
+ param: string;
200
+ typeGuard: (value: unknown) => value is "test" | "control";
201
+ defaultValue: "test" | "control";
202
+ };
203
+ platform_editor_table_use_shared_state_hook: {
204
+ productKeys: {
205
+ confluence: string;
206
+ };
207
+ param: string;
208
+ typeGuard: typeof import("./type-guards").isBoolean;
209
+ defaultValue: boolean;
210
+ };
211
+ 'editor_ai_-_multi_prompts': {
212
+ productKeys: {
213
+ confluence: string;
214
+ };
215
+ param: string;
216
+ typeGuard: (value: unknown) => value is "test" | "control";
217
+ defaultValue: "test" | "control";
218
+ };
219
+ platform_editor_ai_additional_editor_prompts: {
220
+ productKeys: {
221
+ confluence: string;
222
+ };
223
+ param: string;
224
+ typeGuard: (value: unknown) => value is "test" | "control";
225
+ defaultValue: "test" | "control";
226
+ };
227
+ comment_on_bodied_extensions: {
228
+ productKeys: {
229
+ confluence: string;
230
+ };
231
+ param: string;
232
+ typeGuard: typeof import("./type-guards").isBoolean;
233
+ defaultValue: boolean;
234
+ };
235
+ platform_editor_ai_floating_toolbar_v2: {
236
+ productKeys: {
237
+ confluence: string;
238
+ };
239
+ param: string;
240
+ typeGuard: typeof import("./type-guards").isBoolean;
241
+ defaultValue: boolean;
242
+ };
243
+ }[ExperimentName]["defaultValue"], describeBody: jest.EmptyFunction) => void;
244
+ each: (describeBody: jest.EmptyFunction) => void;
245
+ };
246
+ }
247
+ export { eeTest };
@@ -1,4 +1,4 @@
1
- declare function isBoolean(value: unknown): value is boolean;
1
+ import { isBoolean } from './type-guards';
2
2
  export type EditorExperimentsConfig = typeof editorExperimentsConfig;
3
3
  /**
4
4
  * When adding a new experiment, you need to add it here.
@@ -44,16 +44,8 @@ export declare const editorExperimentsConfig: {
44
44
  confluence: string;
45
45
  };
46
46
  param: string;
47
- typeGuard: (value: unknown) => value is "control" | "test";
48
- defaultValue: "control" | "test";
49
- };
50
- 'platform-editor-ai-condensed-floating-toobar': {
51
- productKeys: {
52
- confluence: string;
53
- };
54
- param: string;
55
- typeGuard: (value: unknown) => value is "control" | "dropdown" | "editor_ai_button";
56
- defaultValue: "control" | "dropdown" | "editor_ai_button";
47
+ typeGuard: (value: unknown) => value is "test" | "control";
48
+ defaultValue: "test" | "control";
57
49
  };
58
50
  'dnd-input-performance-optimisation': {
59
51
  productKeys: {
@@ -132,8 +124,8 @@ export declare const editorExperimentsConfig: {
132
124
  confluence: string;
133
125
  };
134
126
  param: string;
135
- typeGuard: (value: unknown) => value is "control" | "test";
136
- defaultValue: "control" | "test";
127
+ typeGuard: (value: unknown) => value is "test" | "control";
128
+ defaultValue: "test" | "control";
137
129
  };
138
130
  platform_renderer_table_sticky_scrollbar: {
139
131
  productKeys: {
@@ -164,8 +156,8 @@ export declare const editorExperimentsConfig: {
164
156
  confluence: string;
165
157
  };
166
158
  param: string;
167
- typeGuard: (value: unknown) => value is "control" | "test";
168
- defaultValue: "control" | "test";
159
+ typeGuard: (value: unknown) => value is "test" | "control";
160
+ defaultValue: "test" | "control";
169
161
  };
170
162
  platform_editor_table_use_shared_state_hook: {
171
163
  productKeys: {
@@ -180,8 +172,31 @@ export declare const editorExperimentsConfig: {
180
172
  confluence: string;
181
173
  };
182
174
  param: string;
183
- typeGuard: (value: unknown) => value is "control" | "test";
184
- defaultValue: "control" | "test";
175
+ typeGuard: (value: unknown) => value is "test" | "control";
176
+ defaultValue: "test" | "control";
177
+ };
178
+ platform_editor_ai_additional_editor_prompts: {
179
+ productKeys: {
180
+ confluence: string;
181
+ };
182
+ param: string;
183
+ typeGuard: (value: unknown) => value is "test" | "control";
184
+ defaultValue: "test" | "control";
185
+ };
186
+ comment_on_bodied_extensions: {
187
+ productKeys: {
188
+ confluence: string;
189
+ };
190
+ param: string;
191
+ typeGuard: typeof isBoolean;
192
+ defaultValue: boolean;
193
+ };
194
+ platform_editor_ai_floating_toolbar_v2: {
195
+ productKeys: {
196
+ confluence: string;
197
+ };
198
+ param: string;
199
+ typeGuard: typeof isBoolean;
200
+ defaultValue: boolean;
185
201
  };
186
202
  };
187
- export {};
@@ -7,8 +7,7 @@ export declare let _overrides: Partial<{
7
7
  'example-multivariate': "one" | "two" | "three";
8
8
  'test-new-experiments-package': boolean;
9
9
  'basic-text-transformations': boolean;
10
- platform_editor_ai_command_palate_improvement: "control" | "test";
11
- 'platform-editor-ai-condensed-floating-toobar': "control" | "dropdown" | "editor_ai_button";
10
+ platform_editor_ai_command_palate_improvement: "test" | "control";
12
11
  'dnd-input-performance-optimisation': boolean;
13
12
  'element-level-templates': boolean;
14
13
  'add-media-from-url': boolean;
@@ -18,13 +17,16 @@ export declare let _overrides: Partial<{
18
17
  platform_editor_empty_line_prompt: boolean;
19
18
  support_table_in_comment: boolean;
20
19
  platform_editor_exp_lazy_node_views: boolean;
21
- platform_editor_ai_ai_button_block_elements: "control" | "test";
20
+ platform_editor_ai_ai_button_block_elements: "test" | "control";
22
21
  platform_renderer_table_sticky_scrollbar: boolean;
23
22
  'nest-media-and-codeblock-in-quote': boolean;
24
23
  'nested-expand-in-expand': boolean;
25
- platform_editor_ai_command_palette_post_ga: "control" | "test";
24
+ platform_editor_ai_command_palette_post_ga: "test" | "control";
26
25
  platform_editor_table_use_shared_state_hook: boolean;
27
- 'editor_ai_-_multi_prompts': "control" | "test";
26
+ 'editor_ai_-_multi_prompts': "test" | "control";
27
+ platform_editor_ai_additional_editor_prompts: "test" | "control";
28
+ comment_on_bodied_extensions: boolean;
29
+ platform_editor_ai_floating_toolbar_v2: boolean;
28
30
  }>;
29
31
  export declare let _product: 'confluence' | 'jira' | 'test' | undefined;
30
32
  /**
@@ -0,0 +1,2 @@
1
+ export declare function isBoolean(value: unknown): value is boolean;
2
+ export declare function oneOf<T extends string>(values: T[]): (value: unknown) => value is T;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/tmp-editor-statsig",
3
- "version": "2.1.15",
3
+ "version": "2.2.1",
4
4
  "description": "Temp plugin to ease use of statsig feature flags until platform feature flags are available",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",