@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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,21 @@
1
1
  # @atlaskit/editor-statsig-tmp
2
2
 
3
+ ## 2.2.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [#149419](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/149419)
8
+ [`9c2e5e1e4cdc9`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/9c2e5e1e4cdc9) -
9
+ [ux] Update Floating toolbar to new UX designs
10
+
11
+ ## 2.2.0
12
+
13
+ ### Minor Changes
14
+
15
+ - [#147660](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/147660)
16
+ [`a407a8fbc874b`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/a407a8fbc874b) -
17
+ ED-24365 Support commenting inside bodied extension content in the Renderer
18
+
3
19
  ## 2.1.15
4
20
 
5
21
  ### Patch Changes
@@ -10,6 +10,9 @@ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/de
10
10
  var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
11
11
  var _setup = require("./setup");
12
12
  var _experimentsConfig = require("./experiments-config");
13
+ function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t.return || t.return(); } finally { if (u) throw o; } } }; }
14
+ function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
15
+ function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
13
16
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
14
17
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; } // This is loosely based on the `ffTest` util from `@atlassian/feature-flags-test-utils` package.
15
18
  /**
@@ -19,11 +22,11 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
19
22
  * ```ts
20
23
  * eeTest('example-boolean', {
21
24
  * true: () => {
22
- * expect(editorExperiment('example-boolean', true)).toBe(true);
23
- * expect(editorExperiment('example-boolean', false)).toBe(false);
25
+ * expect(editorExperiment('example-boolean', true)).toBe(true);
26
+ * expect(editorExperiment('example-boolean', false)).toBe(false);
24
27
  * },
25
28
  * false: () => {
26
- * expect(editorExperiment('example-boolean', false)).toBe(true);
29
+ * expect(editorExperiment('example-boolean', false)).toBe(true);
27
30
  * expect(editorExperiment('example-boolean', true)).toBe(false);
28
31
  * },
29
32
  * })
@@ -33,19 +36,22 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
33
36
  * ```ts
34
37
  * eeTest('example-multivariate', {
35
38
  * one: () => {
36
- * expect(editorExperiment('example-multivariate', 'one')).toBe(true);
37
- * expect(editorExperiment('example-multivariate', 'two')).toBe(false);
39
+ * expect(editorExperiment('example-multivariate', 'one')).toBe(true);
40
+ * expect(editorExperiment('example-multivariate', 'two')).toBe(false);
38
41
  * },
39
42
  * two: () => {
40
- * expect(editorExperiment('example-multivariate', 'two')).toBe(true);
41
- * expect(editorExperiment('example-multivariate', 'one')).toBe(false);
43
+ * expect(editorExperiment('example-multivariate', 'two')).toBe(true);
44
+ * expect(editorExperiment('example-multivariate', 'one')).toBe(false);
42
45
  * },
43
46
  * three: () => {
44
- * expect(editorExperiment('example-multivariate', 'three')).toBe(true);
45
- * expect(editorExperiment('example-multivariate', 'one')).toBe(false);
47
+ * expect(editorExperiment('example-multivariate', 'three')).toBe(true);
48
+ * expect(editorExperiment('example-multivariate', 'one')).toBe(false);
46
49
  * },
47
50
  * })
48
51
  * ```
52
+ *
53
+ * API based on Legacy ffTest API
54
+ * - https://hello.atlassian.net/wiki/spaces/AF/pages/2569505829/Task+Testing+your+feature+flag+in+platform+and+product#Legacy-API-lEGACY
49
55
  */
50
56
  function eeTest(experimentName, cases, otherExperiments) {
51
57
  (0, _setup.setupEditorExperiments)('test', {});
@@ -80,4 +86,75 @@ function eeTest(experimentName, cases, otherExperiments) {
80
86
  };
81
87
  }());
82
88
  });
83
- }
89
+ }
90
+
91
+ /**
92
+ * eeTest.describe() Wrapper utility for describe() that runs a test with a editor experiment overides.
93
+ *
94
+ * @example Single experiment
95
+ * ```ts
96
+ * eeTest.describe('Description of test "suite" containing nested suites and tests.', { 'example-boolean': true }, () => {
97
+ * it('should do the thing', () => {
98
+ * expect(editorExperiment('example-boolean', true)).toBe(true);
99
+ * });
100
+ * });
101
+ * ```
102
+ *
103
+ *
104
+ * @example Multiple experiment
105
+ * ```ts
106
+ * eeTest.describe('Description of test "suite" containing nested suites and tests.', { 'example-boolean': true, 'example-multivariate': 'three' }, () => {
107
+ * it('should do the thing', () => {
108
+ * expect(editorExperiment('example-boolean', true)).toBe(true);
109
+ * });
110
+ * });
111
+ * ```
112
+ *
113
+ * API based on next gen ffTest API
114
+ * - https://hello.atlassian.net/wiki/spaces/AF/pages/2569505829/Task+Testing+your+feature+flag+in+platform+and+product#Next-Generation-API-%E2%9C%A8
115
+ */
116
+ eeTest.describe = function eeTestDescribe(experimentName, describeName) {
117
+ function eeTest(value) {
118
+ var describeBody = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : function () {};
119
+ describe("".concat(describeName, " [").concat(value, "]"), function () {
120
+ beforeEach(function () {
121
+ (0, _setup.setupEditorExperiments)('test', (0, _defineProperty2.default)({}, experimentName, value));
122
+ });
123
+ afterEach(function () {
124
+ (0, _setup.setupEditorExperiments)('test', {});
125
+ });
126
+ describeBody();
127
+ });
128
+ (0, _setup.setupEditorExperiments)('test', {});
129
+ }
130
+ function variant(value, describeBody) {
131
+ eeTest(value, describeBody);
132
+ }
133
+ function each(describeBody) {
134
+ var possibleValues =
135
+ // @ts-ignore
136
+ _experimentsConfig.editorExperimentsConfig[experimentName].typeGuard.values;
137
+ if (possibleValues) {
138
+ var _iterator = _createForOfIteratorHelper(possibleValues),
139
+ _step;
140
+ try {
141
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
142
+ var value = _step.value;
143
+ eeTest(value, describeBody);
144
+ }
145
+ } catch (err) {
146
+ _iterator.e(err);
147
+ } finally {
148
+ _iterator.f();
149
+ }
150
+ } else {
151
+ // if there are no possible values, it's a boolean experiment
152
+ eeTest(true, describeBody);
153
+ eeTest(false, describeBody);
154
+ }
155
+ }
156
+ return {
157
+ variant: variant,
158
+ each: each
159
+ };
160
+ };
@@ -4,14 +4,7 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.editorExperimentsConfig = void 0;
7
- function isBoolean(value) {
8
- return typeof value === 'boolean';
9
- }
10
- function oneOf(values) {
11
- return function (value) {
12
- return values.includes(value);
13
- };
14
- }
7
+ var _typeGuards = require("./type-guards");
15
8
  /**
16
9
  * When adding a new experiment, you need to add it here.
17
10
  * Please follow the pattern established in the examples and any
@@ -24,7 +17,7 @@ var editorExperimentsConfig = exports.editorExperimentsConfig = {
24
17
  confluence: 'confluence_editor_experiment_test_new_package_boolean'
25
18
  },
26
19
  param: 'isEnabled',
27
- typeGuard: isBoolean,
20
+ typeGuard: _typeGuards.isBoolean,
28
21
  // Note -- you need to set the type to boolean for the default value
29
22
  defaultValue: false
30
23
  },
@@ -34,7 +27,7 @@ var editorExperimentsConfig = exports.editorExperimentsConfig = {
34
27
  confluence: 'confluence_editor_experiment_test_new_package_multivariate'
35
28
  },
36
29
  param: 'variant',
37
- typeGuard: oneOf(['one', 'two', 'three']),
30
+ typeGuard: (0, _typeGuards.oneOf)(['one', 'two', 'three']),
38
31
  // Note -- you need to specify the type of the default value as the union of all possible values
39
32
  // This is used to provide type safety on consumption
40
33
  defaultValue: 'one'
@@ -46,7 +39,7 @@ var editorExperimentsConfig = exports.editorExperimentsConfig = {
46
39
  jira: 'jira_editor_experiment_test_new_package'
47
40
  },
48
41
  param: 'isEnabled',
49
- typeGuard: isBoolean,
42
+ typeGuard: _typeGuards.isBoolean,
50
43
  defaultValue: false
51
44
  },
52
45
  // Add 2024-08-14
@@ -55,7 +48,7 @@ var editorExperimentsConfig = exports.editorExperimentsConfig = {
55
48
  confluence: 'platform_editor_basic_text_transformations'
56
49
  },
57
50
  param: 'isEnabled',
58
- typeGuard: isBoolean,
51
+ typeGuard: _typeGuards.isBoolean,
59
52
  defaultValue: false
60
53
  },
61
54
  // Add 2024-08-27
@@ -65,16 +58,7 @@ var editorExperimentsConfig = exports.editorExperimentsConfig = {
65
58
  confluence: 'platform_editor_ai_command_palate_improvement'
66
59
  },
67
60
  param: 'cohort',
68
- typeGuard: oneOf(['control', 'test']),
69
- defaultValue: 'control'
70
- },
71
- // Added 2024-08-23
72
- 'platform-editor-ai-condensed-floating-toobar': {
73
- productKeys: {
74
- confluence: 'platform_editor_ai_condensed_floating_toobar'
75
- },
76
- param: 'cohort',
77
- typeGuard: oneOf(['control', 'dropdown', 'editor_ai_button']),
61
+ typeGuard: (0, _typeGuards.oneOf)(['control', 'test']),
78
62
  defaultValue: 'control'
79
63
  },
80
64
  // Added 2024-08-27
@@ -83,7 +67,7 @@ var editorExperimentsConfig = exports.editorExperimentsConfig = {
83
67
  confluence: 'platform_editor_dnd_input_performance_optimisation'
84
68
  },
85
69
  param: 'isEnabled',
86
- typeGuard: isBoolean,
70
+ typeGuard: _typeGuards.isBoolean,
87
71
  defaultValue: false
88
72
  },
89
73
  // Added 2024-08-28
@@ -92,7 +76,7 @@ var editorExperimentsConfig = exports.editorExperimentsConfig = {
92
76
  confluence: 'platform_editor_element_level_templates'
93
77
  },
94
78
  param: 'isEnabled',
95
- typeGuard: isBoolean,
79
+ typeGuard: _typeGuards.isBoolean,
96
80
  defaultValue: false
97
81
  },
98
82
  // Added 2024-08-29
@@ -101,7 +85,7 @@ var editorExperimentsConfig = exports.editorExperimentsConfig = {
101
85
  confluence: 'platform_editor_add_media_from_url'
102
86
  },
103
87
  param: 'isEnabled',
104
- typeGuard: isBoolean,
88
+ typeGuard: _typeGuards.isBoolean,
105
89
  defaultValue: false
106
90
  },
107
91
  // Added 2024-08-30
@@ -110,7 +94,7 @@ var editorExperimentsConfig = exports.editorExperimentsConfig = {
110
94
  confluence: 'platform_editor_element_drag_and_drop_nested'
111
95
  },
112
96
  param: 'isEnabled',
113
- typeGuard: isBoolean,
97
+ typeGuard: _typeGuards.isBoolean,
114
98
  defaultValue: false
115
99
  },
116
100
  // Add 2024-08-27
@@ -119,7 +103,7 @@ var editorExperimentsConfig = exports.editorExperimentsConfig = {
119
103
  confluence: 'platform_editor_elements_dnd_nested_table'
120
104
  },
121
105
  param: 'isEnabled',
122
- typeGuard: isBoolean,
106
+ typeGuard: _typeGuards.isBoolean,
123
107
  defaultValue: false
124
108
  },
125
109
  // Added 2024-08-29
@@ -128,7 +112,7 @@ var editorExperimentsConfig = exports.editorExperimentsConfig = {
128
112
  confluence: 'platform_editor_insert_menu_in_right_rail'
129
113
  },
130
114
  param: 'isEnabled',
131
- typeGuard: isBoolean,
115
+ typeGuard: _typeGuards.isBoolean,
132
116
  defaultValue: false
133
117
  },
134
118
  // Added 2024-09-02
@@ -137,7 +121,7 @@ var editorExperimentsConfig = exports.editorExperimentsConfig = {
137
121
  confluence: 'platform_editor_empty_line_prompt'
138
122
  },
139
123
  param: 'isEnabled',
140
- typeGuard: isBoolean,
124
+ typeGuard: _typeGuards.isBoolean,
141
125
  defaultValue: false
142
126
  },
143
127
  // Added 2024-09-05
@@ -146,7 +130,7 @@ var editorExperimentsConfig = exports.editorExperimentsConfig = {
146
130
  confluence: 'platform_editor_support_table_in_comment_exp'
147
131
  },
148
132
  param: 'isEnabled',
149
- typeGuard: isBoolean,
133
+ typeGuard: _typeGuards.isBoolean,
150
134
  defaultValue: false
151
135
  },
152
136
  // Added 2024-09-07
@@ -155,7 +139,7 @@ var editorExperimentsConfig = exports.editorExperimentsConfig = {
155
139
  confluence: 'platform_editor_exp_lazy_node_views'
156
140
  },
157
141
  param: 'isEnabled',
158
- typeGuard: isBoolean,
142
+ typeGuard: _typeGuards.isBoolean,
159
143
  defaultValue: false
160
144
  },
161
145
  // Add 2024-09-16
@@ -165,7 +149,7 @@ var editorExperimentsConfig = exports.editorExperimentsConfig = {
165
149
  confluence: 'platform_editor_ai_ai_button_block_elements'
166
150
  },
167
151
  param: 'cohort',
168
- typeGuard: oneOf(['control', 'test']),
152
+ typeGuard: (0, _typeGuards.oneOf)(['control', 'test']),
169
153
  defaultValue: 'control'
170
154
  },
171
155
  // Added 2024-09-18
@@ -174,7 +158,7 @@ var editorExperimentsConfig = exports.editorExperimentsConfig = {
174
158
  confluence: 'platform_renderer_table_sticky_scrollbar'
175
159
  },
176
160
  param: 'isEnabled',
177
- typeGuard: isBoolean,
161
+ typeGuard: _typeGuards.isBoolean,
178
162
  defaultValue: false
179
163
  },
180
164
  // Added 2024-09-18
@@ -184,7 +168,7 @@ var editorExperimentsConfig = exports.editorExperimentsConfig = {
184
168
  confluence: 'platform_editor_nest_media_and_codeblock_in_quotes'
185
169
  },
186
170
  param: 'isEnabled',
187
- typeGuard: isBoolean,
171
+ typeGuard: _typeGuards.isBoolean,
188
172
  defaultValue: false
189
173
  },
190
174
  // Added 2024-09-18
@@ -194,7 +178,7 @@ var editorExperimentsConfig = exports.editorExperimentsConfig = {
194
178
  confluence: 'platform_editor_nest_nested_expand_in_expand'
195
179
  },
196
180
  param: 'isEnabled',
197
- typeGuard: isBoolean,
181
+ typeGuard: _typeGuards.isBoolean,
198
182
  defaultValue: false
199
183
  },
200
184
  // Added 2024-09-24
@@ -203,16 +187,15 @@ var editorExperimentsConfig = exports.editorExperimentsConfig = {
203
187
  confluence: 'platform_editor_ai_command_palette_post_ga'
204
188
  },
205
189
  param: 'cohort',
206
- typeGuard: oneOf(['control', 'test']),
190
+ typeGuard: (0, _typeGuards.oneOf)(['control', 'test']),
207
191
  defaultValue: 'control'
208
192
  },
209
- // Added 2024-09-26
210
193
  platform_editor_table_use_shared_state_hook: {
211
194
  productKeys: {
212
195
  confluence: 'platform_editor_table_use_shared_state_hook'
213
196
  },
214
197
  param: 'isEnabled',
215
- typeGuard: isBoolean,
198
+ typeGuard: _typeGuards.isBoolean,
216
199
  defaultValue: false
217
200
  },
218
201
  // Added 2024-09-23
@@ -222,7 +205,35 @@ var editorExperimentsConfig = exports.editorExperimentsConfig = {
222
205
  confluence: 'editor_ai_-_multi_prompts'
223
206
  },
224
207
  param: 'cohort',
225
- typeGuard: oneOf(['control', 'test']),
208
+ typeGuard: (0, _typeGuards.oneOf)(['control', 'test']),
209
+ defaultValue: 'control'
210
+ },
211
+ // Added 2024-10-02
212
+ // https://console.statsig.com/LqivKg6ADZZaGczRfBKfX/experiments/platform_editor_ai_additional_editor_prompts/setup
213
+ platform_editor_ai_additional_editor_prompts: {
214
+ productKeys: {
215
+ confluence: 'platform_editor_ai_additional_editor_prompts'
216
+ },
217
+ param: 'cohort',
218
+ typeGuard: (0, _typeGuards.oneOf)(['control', 'test']),
226
219
  defaultValue: 'control'
220
+ },
221
+ // Added 2024-10-01
222
+ comment_on_bodied_extensions: {
223
+ productKeys: {
224
+ confluence: 'platform_editor_comment_on_bodied_extensions'
225
+ },
226
+ param: 'isEnabled',
227
+ typeGuard: _typeGuards.isBoolean,
228
+ defaultValue: false
229
+ },
230
+ // Added 2024-10-01
231
+ platform_editor_ai_floating_toolbar_v2: {
232
+ productKeys: {
233
+ confluence: 'platform_editor_ai_floating_toolbar_v2'
234
+ },
235
+ param: 'isEnabled',
236
+ typeGuard: _typeGuards.isBoolean,
237
+ defaultValue: false
227
238
  }
228
239
  };
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.isBoolean = isBoolean;
7
+ exports.oneOf = oneOf;
8
+ function isBoolean(value) {
9
+ return typeof value === 'boolean';
10
+ }
11
+ function oneOf(values) {
12
+ function typeGuard(value) {
13
+ return values.includes(value);
14
+ }
15
+ /**
16
+ * This is used by test utils to get the variants when running describe.each
17
+ */
18
+ if (IS_TESTING_ENV) {
19
+ typeGuard.values = values;
20
+ }
21
+ return typeGuard;
22
+ }
23
+
24
+ // @ts-ignore
25
+
26
+ var IS_TESTING_ENV = process.env.NODE_ENV === 'test' || process.env.JEST_WORKER_ID !== undefined;
@@ -2,7 +2,6 @@
2
2
 
3
3
  import { setupEditorExperiments } from './setup';
4
4
  import { editorExperimentsConfig } from './experiments-config';
5
-
6
5
  /**
7
6
  * This is a utility function for testing editor experiments.
8
7
  *
@@ -10,11 +9,11 @@ import { editorExperimentsConfig } from './experiments-config';
10
9
  * ```ts
11
10
  * eeTest('example-boolean', {
12
11
  * true: () => {
13
- * expect(editorExperiment('example-boolean', true)).toBe(true);
14
- * expect(editorExperiment('example-boolean', false)).toBe(false);
12
+ * expect(editorExperiment('example-boolean', true)).toBe(true);
13
+ * expect(editorExperiment('example-boolean', false)).toBe(false);
15
14
  * },
16
15
  * false: () => {
17
- * expect(editorExperiment('example-boolean', false)).toBe(true);
16
+ * expect(editorExperiment('example-boolean', false)).toBe(true);
18
17
  * expect(editorExperiment('example-boolean', true)).toBe(false);
19
18
  * },
20
19
  * })
@@ -24,21 +23,24 @@ import { editorExperimentsConfig } from './experiments-config';
24
23
  * ```ts
25
24
  * eeTest('example-multivariate', {
26
25
  * one: () => {
27
- * expect(editorExperiment('example-multivariate', 'one')).toBe(true);
28
- * expect(editorExperiment('example-multivariate', 'two')).toBe(false);
26
+ * expect(editorExperiment('example-multivariate', 'one')).toBe(true);
27
+ * expect(editorExperiment('example-multivariate', 'two')).toBe(false);
29
28
  * },
30
29
  * two: () => {
31
- * expect(editorExperiment('example-multivariate', 'two')).toBe(true);
32
- * expect(editorExperiment('example-multivariate', 'one')).toBe(false);
30
+ * expect(editorExperiment('example-multivariate', 'two')).toBe(true);
31
+ * expect(editorExperiment('example-multivariate', 'one')).toBe(false);
33
32
  * },
34
33
  * three: () => {
35
- * expect(editorExperiment('example-multivariate', 'three')).toBe(true);
36
- * expect(editorExperiment('example-multivariate', 'one')).toBe(false);
34
+ * expect(editorExperiment('example-multivariate', 'three')).toBe(true);
35
+ * expect(editorExperiment('example-multivariate', 'one')).toBe(false);
37
36
  * },
38
37
  * })
39
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
40
42
  */
41
- export function eeTest(experimentName, cases, otherExperiments) {
43
+ function eeTest(experimentName, cases, otherExperiments) {
42
44
  setupEditorExperiments('test', {});
43
45
  describe(`eeTest: ${experimentName}`, () => {
44
46
  afterEach(() => {
@@ -63,4 +65,68 @@ export function eeTest(experimentName, cases, otherExperiments) {
63
65
  await Promise.resolve(testCase());
64
66
  });
65
67
  });
66
- }
68
+ }
69
+
70
+ /**
71
+ * eeTest.describe() Wrapper utility for describe() that runs a test with a editor experiment overides.
72
+ *
73
+ * @example Single experiment
74
+ * ```ts
75
+ * eeTest.describe('Description of test "suite" containing nested suites and tests.', { 'example-boolean': true }, () => {
76
+ * it('should do the thing', () => {
77
+ * expect(editorExperiment('example-boolean', true)).toBe(true);
78
+ * });
79
+ * });
80
+ * ```
81
+ *
82
+ *
83
+ * @example Multiple experiment
84
+ * ```ts
85
+ * eeTest.describe('Description of test "suite" containing nested suites and tests.', { 'example-boolean': true, 'example-multivariate': 'three' }, () => {
86
+ * it('should do the thing', () => {
87
+ * expect(editorExperiment('example-boolean', true)).toBe(true);
88
+ * });
89
+ * });
90
+ * ```
91
+ *
92
+ * API based on next gen ffTest API
93
+ * - https://hello.atlassian.net/wiki/spaces/AF/pages/2569505829/Task+Testing+your+feature+flag+in+platform+and+product#Next-Generation-API-%E2%9C%A8
94
+ */
95
+ eeTest.describe = function eeTestDescribe(experimentName, describeName) {
96
+ function eeTest(value, describeBody = () => {}) {
97
+ describe(`${describeName} [${value}]`, () => {
98
+ beforeEach(() => {
99
+ setupEditorExperiments('test', {
100
+ [experimentName]: value
101
+ });
102
+ });
103
+ afterEach(() => {
104
+ setupEditorExperiments('test', {});
105
+ });
106
+ describeBody();
107
+ });
108
+ setupEditorExperiments('test', {});
109
+ }
110
+ function variant(value, describeBody) {
111
+ eeTest(value, describeBody);
112
+ }
113
+ function each(describeBody) {
114
+ let possibleValues =
115
+ // @ts-ignore
116
+ editorExperimentsConfig[experimentName].typeGuard.values;
117
+ if (possibleValues) {
118
+ for (const value of possibleValues) {
119
+ eeTest(value, describeBody);
120
+ }
121
+ } else {
122
+ // if there are no possible values, it's a boolean experiment
123
+ eeTest(true, describeBody);
124
+ eeTest(false, describeBody);
125
+ }
126
+ }
127
+ return {
128
+ variant,
129
+ each
130
+ };
131
+ };
132
+ export { eeTest };
@@ -1,11 +1,4 @@
1
- function isBoolean(value) {
2
- return typeof value === 'boolean';
3
- }
4
- function oneOf(values) {
5
- return value => {
6
- return values.includes(value);
7
- };
8
- }
1
+ import { isBoolean, oneOf } from './type-guards';
9
2
  /**
10
3
  * When adding a new experiment, you need to add it here.
11
4
  * Please follow the pattern established in the examples and any
@@ -62,15 +55,6 @@ export const editorExperimentsConfig = {
62
55
  typeGuard: oneOf(['control', 'test']),
63
56
  defaultValue: 'control'
64
57
  },
65
- // Added 2024-08-23
66
- 'platform-editor-ai-condensed-floating-toobar': {
67
- productKeys: {
68
- confluence: 'platform_editor_ai_condensed_floating_toobar'
69
- },
70
- param: 'cohort',
71
- typeGuard: oneOf(['control', 'dropdown', 'editor_ai_button']),
72
- defaultValue: 'control'
73
- },
74
58
  // Added 2024-08-27
75
59
  'dnd-input-performance-optimisation': {
76
60
  productKeys: {
@@ -200,7 +184,6 @@ export const editorExperimentsConfig = {
200
184
  typeGuard: oneOf(['control', 'test']),
201
185
  defaultValue: 'control'
202
186
  },
203
- // Added 2024-09-26
204
187
  platform_editor_table_use_shared_state_hook: {
205
188
  productKeys: {
206
189
  confluence: 'platform_editor_table_use_shared_state_hook'
@@ -218,5 +201,33 @@ export const editorExperimentsConfig = {
218
201
  param: 'cohort',
219
202
  typeGuard: oneOf(['control', 'test']),
220
203
  defaultValue: 'control'
204
+ },
205
+ // Added 2024-10-02
206
+ // https://console.statsig.com/LqivKg6ADZZaGczRfBKfX/experiments/platform_editor_ai_additional_editor_prompts/setup
207
+ platform_editor_ai_additional_editor_prompts: {
208
+ productKeys: {
209
+ confluence: 'platform_editor_ai_additional_editor_prompts'
210
+ },
211
+ param: 'cohort',
212
+ typeGuard: oneOf(['control', 'test']),
213
+ defaultValue: 'control'
214
+ },
215
+ // Added 2024-10-01
216
+ comment_on_bodied_extensions: {
217
+ productKeys: {
218
+ confluence: 'platform_editor_comment_on_bodied_extensions'
219
+ },
220
+ param: 'isEnabled',
221
+ typeGuard: isBoolean,
222
+ defaultValue: false
223
+ },
224
+ // Added 2024-10-01
225
+ platform_editor_ai_floating_toolbar_v2: {
226
+ productKeys: {
227
+ confluence: 'platform_editor_ai_floating_toolbar_v2'
228
+ },
229
+ param: 'isEnabled',
230
+ typeGuard: isBoolean,
231
+ defaultValue: false
221
232
  }
222
233
  };
@@ -0,0 +1,19 @@
1
+ export function isBoolean(value) {
2
+ return typeof value === 'boolean';
3
+ }
4
+ export function oneOf(values) {
5
+ function typeGuard(value) {
6
+ return values.includes(value);
7
+ }
8
+ /**
9
+ * This is used by test utils to get the variants when running describe.each
10
+ */
11
+ if (IS_TESTING_ENV) {
12
+ typeGuard.values = values;
13
+ }
14
+ return typeGuard;
15
+ }
16
+
17
+ // @ts-ignore
18
+
19
+ const IS_TESTING_ENV = process.env.NODE_ENV === 'test' || process.env.JEST_WORKER_ID !== undefined;