@atlaskit/editor-plugin-insert-block 8.3.2 → 8.4.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 CHANGED
@@ -1,5 +1,26 @@
1
1
  # @atlaskit/editor-plugin-insert-block
2
2
 
3
+ ## 8.4.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [`7b679117f4605`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/7b679117f4605) -
8
+ [ux] Productionizes `confluence-whiteboards-quick-insert-eligible` and
9
+ `confluence-whiteboards-quick-insert-l10n-eligible` feature gates and
10
+ `confluence_whiteboards_quick_insert_localised` experiment. Ship "Diagram" variant.
11
+
12
+ ### Patch Changes
13
+
14
+ - Updated dependencies
15
+
16
+ ## 8.3.3
17
+
18
+ ### Patch Changes
19
+
20
+ - [`6431f5f6492ae`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/6431f5f6492ae) -
21
+ Remove unused platform_editor_toolbar_aifc_ga_blockers feature gate
22
+ - Updated dependencies
23
+
3
24
  ## 8.3.2
4
25
 
5
26
  ### Patch Changes
@@ -4,7 +4,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
4
4
  Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
- exports.filterForPinWhiteboardsExperiment = exports.default = exports.DEFAULT_HEIGHT = void 0;
7
+ exports.filterForPinWhiteboards = exports.default = exports.DEFAULT_HEIGHT = void 0;
8
8
  var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
9
9
  var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
10
10
  var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
@@ -20,10 +20,7 @@ var _hooks = require("@atlaskit/editor-common/hooks");
20
20
  var _quickInsert = require("@atlaskit/editor-common/quick-insert");
21
21
  var _uiReact = require("@atlaskit/editor-common/ui-react");
22
22
  var _editorPluginConnectivity = require("@atlaskit/editor-plugin-connectivity");
23
- var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
24
23
  var _colors = require("@atlaskit/theme/colors");
25
- var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
26
- var _expVal = require("@atlaskit/tmp-editor-statsig/expVal");
27
24
  var _excluded = ["children"];
28
25
  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; }
29
26
  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; } /**
@@ -38,98 +35,29 @@ var DEFAULT_HEIGHT = exports.DEFAULT_HEIGHT = 560;
38
35
  method that can be used to get suggestions -> once all experiments are cleaned up,
39
36
  they should be unified through `pluginInjectionApi?.quickInsert?.actions.getSuggestions`
40
37
  */
41
- var filterForPinWhiteboardsExperiment = exports.filterForPinWhiteboardsExperiment = function filterForPinWhiteboardsExperiment(featuredItems, formatMessage) {
42
- // Legacy path fallback -- prior comments as follows:
43
- /**
44
- * // Part of ATLAS-95399 to pin whiteboards to the top of the InsertMenu
45
- // Need to check if whiteboard options are available, and filter for the cohort
46
- // Takes the original featuredItems list and returns one with the right whiteboard option at the top
47
- */
48
- if ((0, _platformFeatureFlags.fg)('confluence-whiteboards-quick-insert-eligible')) {
49
- var DIAGRAM_TITLE = 'Create diagram',
50
- BLANK_TITLE = 'Create whiteboard';
51
- var featuredWhiteboardsPresent = featuredItems.filter(function (item) {
52
- return [DIAGRAM_TITLE, BLANK_TITLE].includes(item.title);
53
- }).length === 2;
54
- if (featuredWhiteboardsPresent) {
55
- var pinWhiteboardActionToTop = function pinWhiteboardActionToTop(items, title) {
56
- // find the requested item by title, give it the appropriate description, and bring it to the top of the list
57
- var index = items.findIndex(function (item) {
58
- return item.title === title;
59
- });
60
- var filteredList = items.filter(function (item) {
61
- return ![DIAGRAM_TITLE, BLANK_TITLE].includes(item.title);
62
- });
63
- if (index === -1) {
64
- return filteredList;
65
- }
66
- var featuredItem = _objectSpread({}, items[index]);
67
- featuredItem.description = formatMessage(_quickInsert.messages.featuredWhiteboardDescription);
68
- return [featuredItem].concat((0, _toConsumableArray2.default)(filteredList));
69
- };
70
- return pinWhiteboardActionToTop(featuredItems, DIAGRAM_TITLE);
71
- } else {
72
- if ((0, _platformFeatureFlags.fg)('confluence-whiteboards-quick-insert-l10n-eligible')) {
73
- // Fire exposure for confluence_whiteboards_quick_insert_localised_aa
74
- // https://switcheroo.atlassian.com/ui/gates/ccd80d32-28a1-4dcf-b3f9-dbdc02a046ff/key/confluence_whiteboards_quick_insert_localised_aa
75
- (0, _expVal.expVal)('confluence_whiteboards_quick_insert_localised_aa', 'cohort', 'test_diagram');
76
-
77
- /** BEGIN locale agnostic path */
78
-
79
- /**
80
- * EXTREMELY IMPORTANT: we must not drop diagram for those who already receive
81
- * the 'insert diagram to the top' treatment.
82
- *
83
- * Our heuristic to check that this is only targeting users where they haven't
84
- * gotten the experience, is if we _cannot_ find the blank board experience in
85
- * the list, matching purely on title.
86
- *
87
- * e.g. `featuredWhiteboardsPresent` = false, given it matches on title.
88
- *
89
- * The side-effect of this, is that there's a small chance/edge case of users
90
- * who toggle between locales, and receive different experiences.
91
- *
92
- * Hopefully we can make a call early on this experiment, and eliminate this
93
- * code path.
94
- */
95
- var WHITEBOARD_KEY = 'whiteboard-extension:create-whiteboard';
96
- var DIAGRAM_KEY = 'whiteboard-extension:create-diagram';
97
- var isBlank = function isBlank(item) {
98
- return item.key === WHITEBOARD_KEY;
99
- };
100
- var isDiagram = function isDiagram(item) {
101
- return item.key === DIAGRAM_KEY;
102
- };
103
- var hasBoth = featuredItems.some(isBlank) && featuredItems.some(isDiagram);
104
- if (hasBoth) {
105
- var pin = function pin(key) {
106
- var idx = featuredItems.findIndex(function (item) {
107
- return item.key === key;
108
- });
109
- var filtered = featuredItems.filter(function (item) {
110
- return !isBlank(item) && !isDiagram(item);
111
- });
112
- if (idx === -1) {
113
- return filtered;
114
- }
115
- var picked = _objectSpread(_objectSpread({}, featuredItems[idx]), {}, {
116
- description: formatMessage(_quickInsert.messages.featuredWhiteboardDescription)
117
- });
118
- return [picked].concat((0, _toConsumableArray2.default)(filtered));
119
- };
120
- if ((0, _expValEquals.expValEquals)('confluence_whiteboards_quick_insert_localised', 'cohort', 'test_blank')) {
121
- return pin(WHITEBOARD_KEY);
122
- }
123
- if ((0, _expValEquals.expValEquals)('confluence_whiteboards_quick_insert_localised', 'cohort', 'test_diagram')) {
124
- return pin(DIAGRAM_KEY);
125
- }
126
- if ((0, _expValEquals.expValEquals)('confluence_whiteboards_quick_insert_localised', 'cohort', 'control')) {
127
- return featuredItems;
128
- }
129
- }
38
+ var filterForPinWhiteboards = exports.filterForPinWhiteboards = function filterForPinWhiteboards(featuredItems, formatMessage) {
39
+ var DIAGRAM_KEY = 'whiteboard-extension:create-diagram';
40
+ var isDiagram = function isDiagram(item) {
41
+ return item.key === DIAGRAM_KEY;
42
+ };
43
+ var featuredWhiteboardsPresent = featuredItems.some(isDiagram);
44
+ if (featuredWhiteboardsPresent) {
45
+ var pin = function pin(key) {
46
+ var idx = featuredItems.findIndex(function (item) {
47
+ return item.key === key;
48
+ });
49
+ var filtered = featuredItems.filter(function (item) {
50
+ return !isDiagram(item);
51
+ });
52
+ if (idx === -1) {
53
+ return filtered;
130
54
  }
131
- /** END locale agnostic path */
132
- }
55
+ var picked = _objectSpread(_objectSpread({}, featuredItems[idx]), {}, {
56
+ description: formatMessage(_quickInsert.messages.featuredWhiteboardDescription)
57
+ });
58
+ return [picked].concat((0, _toConsumableArray2.default)(filtered));
59
+ };
60
+ return pin(DIAGRAM_KEY);
133
61
  }
134
62
  return featuredItems;
135
63
  };
@@ -243,7 +171,7 @@ var InsertMenu = function InsertMenu(_ref) {
243
171
  })) !== null && _pluginInjectionApi$q4 !== void 0 ? _pluginInjectionApi$q4 : [];
244
172
  var unfilteredResult = quickInsertDropdownItems.concat(featuredQuickInsertSuggestions);
245
173
  // need to filter on the concatenated list so whiteboards are at the top
246
- result = filterForPinWhiteboardsExperiment(unfilteredResult, formatMessage);
174
+ result = filterForPinWhiteboards(unfilteredResult, formatMessage);
247
175
  }
248
176
  setItemCount(result.length);
249
177
  return result;
@@ -279,166 +279,131 @@ var getToolbarComponents = exports.getToolbarComponents = function getToolbarCom
279
279
  });
280
280
  };
281
281
  };
282
- if ((0, _platformFeatureFlags.fg)('platform_editor_toolbar_aifc_ga_blockers')) {
283
- components.push({
282
+ components.push({
283
+ type: _toolbar.INSERT_GROUP.type,
284
+ key: "".concat(_toolbar.INSERT_GROUP.key, "-none"),
285
+ parents: [{
286
+ type: _toolbar.INSERT_BLOCK_SECTION.type,
287
+ key: _toolbar.INSERT_BLOCK_SECTION.key,
288
+ rank: _toolbar.INSERT_BLOCK_SECTION_RANK[_toolbar.INSERT_GROUP.key]
289
+ }],
290
+ component: function component(_ref3) {
291
+ var children = _ref3.children;
292
+ return /*#__PURE__*/_react.default.createElement(_editorToolbar.Show, {
293
+ below: "sm"
294
+ }, /*#__PURE__*/_react.default.createElement(_editorToolbar.ToolbarButtonGroup, null, children));
295
+ }
296
+ });
297
+ components.push({
298
+ type: _toolbar.INSERT_BUTTON.type,
299
+ key: _toolbar.INSERT_BUTTON.key,
300
+ parents: [{
284
301
  type: _toolbar.INSERT_GROUP.type,
285
302
  key: "".concat(_toolbar.INSERT_GROUP.key, "-none"),
286
- parents: [{
287
- type: _toolbar.INSERT_BLOCK_SECTION.type,
288
- key: _toolbar.INSERT_BLOCK_SECTION.key,
289
- rank: _toolbar.INSERT_BLOCK_SECTION_RANK[_toolbar.INSERT_GROUP.key]
290
- }],
291
- component: function component(_ref3) {
292
- var children = _ref3.children;
293
- return /*#__PURE__*/_react.default.createElement(_editorToolbar.Show, {
294
- below: "sm"
295
- }, /*#__PURE__*/_react.default.createElement(_editorToolbar.ToolbarButtonGroup, null, children));
296
- }
297
- });
298
- components.push({
299
- type: _toolbar.INSERT_BUTTON.type,
300
- key: _toolbar.INSERT_BUTTON.key,
301
- parents: [{
302
- type: _toolbar.INSERT_GROUP.type,
303
- key: "".concat(_toolbar.INSERT_GROUP.key, "-none"),
304
- rank: _toolbar.INSERT_GROUP_RANK[_toolbar.INSERT_BUTTON.key]
305
- }],
306
- component: createInsertButtonComponent(null)
307
- });
308
- components.push({
303
+ rank: _toolbar.INSERT_GROUP_RANK[_toolbar.INSERT_BUTTON.key]
304
+ }],
305
+ component: createInsertButtonComponent(null)
306
+ });
307
+ components.push({
308
+ type: _toolbar.INSERT_GROUP.type,
309
+ key: "".concat(_toolbar.INSERT_GROUP.key, "-sm"),
310
+ parents: [{
311
+ type: _toolbar.INSERT_BLOCK_SECTION.type,
312
+ key: _toolbar.INSERT_BLOCK_SECTION.key,
313
+ rank: _toolbar.INSERT_BLOCK_SECTION_RANK[_toolbar.INSERT_GROUP.key]
314
+ }],
315
+ component: function component(_ref4) {
316
+ var children = _ref4.children;
317
+ return /*#__PURE__*/_react.default.createElement(_editorToolbar.Show, {
318
+ only: "sm"
319
+ }, /*#__PURE__*/_react.default.createElement(_editorToolbar.ToolbarButtonGroup, null, children));
320
+ }
321
+ });
322
+ components.push({
323
+ type: _toolbar.INSERT_BUTTON.type,
324
+ key: _toolbar.INSERT_BUTTON.key,
325
+ parents: [{
309
326
  type: _toolbar.INSERT_GROUP.type,
310
327
  key: "".concat(_toolbar.INSERT_GROUP.key, "-sm"),
311
- parents: [{
312
- type: _toolbar.INSERT_BLOCK_SECTION.type,
313
- key: _toolbar.INSERT_BLOCK_SECTION.key,
314
- rank: _toolbar.INSERT_BLOCK_SECTION_RANK[_toolbar.INSERT_GROUP.key]
315
- }],
316
- component: function component(_ref4) {
317
- var children = _ref4.children;
318
- return /*#__PURE__*/_react.default.createElement(_editorToolbar.Show, {
319
- only: "sm"
320
- }, /*#__PURE__*/_react.default.createElement(_editorToolbar.ToolbarButtonGroup, null, children));
321
- }
322
- });
323
- components.push({
324
- type: _toolbar.INSERT_BUTTON.type,
325
- key: _toolbar.INSERT_BUTTON.key,
326
- parents: [{
327
- type: _toolbar.INSERT_GROUP.type,
328
- key: "".concat(_toolbar.INSERT_GROUP.key, "-sm"),
329
- rank: _toolbar.INSERT_GROUP_RANK[_toolbar.INSERT_BUTTON.key]
330
- }],
331
- component: createInsertButtonComponent('sm')
332
- });
333
- components.push({
328
+ rank: _toolbar.INSERT_GROUP_RANK[_toolbar.INSERT_BUTTON.key]
329
+ }],
330
+ component: createInsertButtonComponent('sm')
331
+ });
332
+ components.push({
333
+ type: _toolbar.INSERT_GROUP.type,
334
+ key: "".concat(_toolbar.INSERT_GROUP.key, "-md"),
335
+ parents: [{
336
+ type: _toolbar.INSERT_BLOCK_SECTION.type,
337
+ key: _toolbar.INSERT_BLOCK_SECTION.key,
338
+ rank: _toolbar.INSERT_BLOCK_SECTION_RANK[_toolbar.INSERT_GROUP.key]
339
+ }],
340
+ component: function component(_ref5) {
341
+ var children = _ref5.children;
342
+ return /*#__PURE__*/_react.default.createElement(_editorToolbar.Show, {
343
+ only: "md"
344
+ }, /*#__PURE__*/_react.default.createElement(_editorToolbar.ToolbarButtonGroup, null, children));
345
+ }
346
+ });
347
+ components.push({
348
+ type: _toolbar.INSERT_BUTTON.type,
349
+ key: _toolbar.INSERT_BUTTON.key,
350
+ parents: [{
334
351
  type: _toolbar.INSERT_GROUP.type,
335
352
  key: "".concat(_toolbar.INSERT_GROUP.key, "-md"),
336
- parents: [{
337
- type: _toolbar.INSERT_BLOCK_SECTION.type,
338
- key: _toolbar.INSERT_BLOCK_SECTION.key,
339
- rank: _toolbar.INSERT_BLOCK_SECTION_RANK[_toolbar.INSERT_GROUP.key]
340
- }],
341
- component: function component(_ref5) {
342
- var children = _ref5.children;
343
- return /*#__PURE__*/_react.default.createElement(_editorToolbar.Show, {
344
- only: "md"
345
- }, /*#__PURE__*/_react.default.createElement(_editorToolbar.ToolbarButtonGroup, null, children));
346
- }
347
- });
348
- components.push({
349
- type: _toolbar.INSERT_BUTTON.type,
350
- key: _toolbar.INSERT_BUTTON.key,
351
- parents: [{
352
- type: _toolbar.INSERT_GROUP.type,
353
- key: "".concat(_toolbar.INSERT_GROUP.key, "-md"),
354
- rank: _toolbar.INSERT_GROUP_RANK[_toolbar.INSERT_BUTTON.key]
355
- }],
356
- component: createInsertButtonComponent('md')
357
- });
358
- components.push({
353
+ rank: _toolbar.INSERT_GROUP_RANK[_toolbar.INSERT_BUTTON.key]
354
+ }],
355
+ component: createInsertButtonComponent('md')
356
+ });
357
+ components.push({
358
+ type: _toolbar.INSERT_GROUP.type,
359
+ key: "".concat(_toolbar.INSERT_GROUP.key, "-lg"),
360
+ parents: [{
361
+ type: _toolbar.INSERT_BLOCK_SECTION.type,
362
+ key: _toolbar.INSERT_BLOCK_SECTION.key,
363
+ rank: _toolbar.INSERT_BLOCK_SECTION_RANK[_toolbar.INSERT_GROUP.key]
364
+ }],
365
+ component: function component(_ref6) {
366
+ var children = _ref6.children;
367
+ return /*#__PURE__*/_react.default.createElement(_editorToolbar.Show, {
368
+ only: "lg"
369
+ }, /*#__PURE__*/_react.default.createElement(_editorToolbar.ToolbarButtonGroup, null, children));
370
+ }
371
+ });
372
+ components.push({
373
+ type: _toolbar.INSERT_BUTTON.type,
374
+ key: _toolbar.INSERT_BUTTON.key,
375
+ parents: [{
359
376
  type: _toolbar.INSERT_GROUP.type,
360
377
  key: "".concat(_toolbar.INSERT_GROUP.key, "-lg"),
361
- parents: [{
362
- type: _toolbar.INSERT_BLOCK_SECTION.type,
363
- key: _toolbar.INSERT_BLOCK_SECTION.key,
364
- rank: _toolbar.INSERT_BLOCK_SECTION_RANK[_toolbar.INSERT_GROUP.key]
365
- }],
366
- component: function component(_ref6) {
367
- var children = _ref6.children;
368
- return /*#__PURE__*/_react.default.createElement(_editorToolbar.Show, {
369
- only: "lg"
370
- }, /*#__PURE__*/_react.default.createElement(_editorToolbar.ToolbarButtonGroup, null, children));
371
- }
372
- });
373
- components.push({
374
- type: _toolbar.INSERT_BUTTON.type,
375
- key: _toolbar.INSERT_BUTTON.key,
376
- parents: [{
377
- type: _toolbar.INSERT_GROUP.type,
378
- key: "".concat(_toolbar.INSERT_GROUP.key, "-lg"),
379
- rank: _toolbar.INSERT_GROUP_RANK[_toolbar.INSERT_BUTTON.key]
380
- }],
381
- component: createInsertButtonComponent('lg')
382
- });
383
- components.push({
378
+ rank: _toolbar.INSERT_GROUP_RANK[_toolbar.INSERT_BUTTON.key]
379
+ }],
380
+ component: createInsertButtonComponent('lg')
381
+ });
382
+ components.push({
383
+ type: _toolbar.INSERT_GROUP.type,
384
+ key: "".concat(_toolbar.INSERT_GROUP.key, "-xl"),
385
+ parents: [{
386
+ type: _toolbar.INSERT_BLOCK_SECTION.type,
387
+ key: _toolbar.INSERT_BLOCK_SECTION.key,
388
+ rank: _toolbar.INSERT_BLOCK_SECTION_RANK[_toolbar.INSERT_GROUP.key]
389
+ }],
390
+ component: function component(_ref7) {
391
+ var children = _ref7.children;
392
+ return /*#__PURE__*/_react.default.createElement(_editorToolbar.Show, {
393
+ only: "xl"
394
+ }, /*#__PURE__*/_react.default.createElement(_editorToolbar.ToolbarButtonGroup, null, children));
395
+ }
396
+ });
397
+ components.push({
398
+ type: _toolbar.INSERT_BUTTON.type,
399
+ key: _toolbar.INSERT_BUTTON.key,
400
+ parents: [{
384
401
  type: _toolbar.INSERT_GROUP.type,
385
402
  key: "".concat(_toolbar.INSERT_GROUP.key, "-xl"),
386
- parents: [{
387
- type: _toolbar.INSERT_BLOCK_SECTION.type,
388
- key: _toolbar.INSERT_BLOCK_SECTION.key,
389
- rank: _toolbar.INSERT_BLOCK_SECTION_RANK[_toolbar.INSERT_GROUP.key]
390
- }],
391
- component: function component(_ref7) {
392
- var children = _ref7.children;
393
- return /*#__PURE__*/_react.default.createElement(_editorToolbar.Show, {
394
- only: "xl"
395
- }, /*#__PURE__*/_react.default.createElement(_editorToolbar.ToolbarButtonGroup, null, children));
396
- }
397
- });
398
- components.push({
399
- type: _toolbar.INSERT_BUTTON.type,
400
- key: _toolbar.INSERT_BUTTON.key,
401
- parents: [{
402
- type: _toolbar.INSERT_GROUP.type,
403
- key: "".concat(_toolbar.INSERT_GROUP.key, "-xl"),
404
- rank: _toolbar.INSERT_GROUP_RANK[_toolbar.INSERT_BUTTON.key]
405
- }],
406
- component: createInsertButtonComponent('xl')
407
- });
408
- } else {
409
- components.push({
410
- type: _toolbar.INSERT_GROUP.type,
411
- key: _toolbar.INSERT_GROUP.key,
412
- parents: [{
413
- type: _toolbar.INSERT_BLOCK_SECTION.type,
414
- key: _toolbar.INSERT_BLOCK_SECTION.key,
415
- rank: _toolbar.INSERT_BLOCK_SECTION_RANK[_toolbar.INSERT_GROUP.key]
416
- }]
417
- });
418
- components.push({
419
- type: _toolbar.INSERT_BUTTON.type,
420
- key: _toolbar.INSERT_BUTTON.key,
421
- parents: [{
422
- type: _toolbar.INSERT_GROUP.type,
423
- key: _toolbar.INSERT_GROUP.key,
424
- rank: _toolbar.INSERT_GROUP_RANK[_toolbar.INSERT_BUTTON.key]
425
- }],
426
- component: function component() {
427
- return /*#__PURE__*/_react.default.createElement(_InsertButton.InsertButton, {
428
- api: api,
429
- toolbarConfig: config,
430
- showElementBrowserLink: options.showElementBrowserLink,
431
- tableSelectorSupported: options.tableSelectorSupported,
432
- onInsertBlockType: onInsertBlockType,
433
- nativeStatusSupported: options.nativeStatusSupported,
434
- horizontalRuleEnabled: options.horizontalRuleEnabled,
435
- expandEnabled: options.allowExpand,
436
- insertMenuItems: options.insertMenuItems,
437
- numberOfButtons: 7 // TODO: ED-28759 - Default to 7 buttons - Remove this once we have a proper way to do toolbar responsiveness
438
- });
439
- }
440
- });
441
- }
403
+ rank: _toolbar.INSERT_GROUP_RANK[_toolbar.INSERT_BUTTON.key]
404
+ }],
405
+ component: createInsertButtonComponent('xl')
406
+ });
442
407
  }
443
408
  return components;
444
409
  };
@@ -16,10 +16,7 @@ import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks'
16
16
  import { messages, IconCode, IconDate, IconDecision, IconDivider, IconExpand, IconPanel, IconQuote, IconStatus } from '@atlaskit/editor-common/quick-insert';
17
17
  import { OutsideClickTargetRefContext, withReactEditorViewOuterListeners as withOuterListeners } from '@atlaskit/editor-common/ui-react';
18
18
  import { isOfflineMode } from '@atlaskit/editor-plugin-connectivity';
19
- import { fg } from '@atlaskit/platform-feature-flags';
20
19
  import { N0, N30A, N60A } from '@atlaskit/theme/colors';
21
- import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
22
- import { expVal } from '@atlaskit/tmp-editor-statsig/expVal';
23
20
  export const DEFAULT_HEIGHT = 560;
24
21
 
25
22
  /**
@@ -28,86 +25,24 @@ export const DEFAULT_HEIGHT = 560;
28
25
  method that can be used to get suggestions -> once all experiments are cleaned up,
29
26
  they should be unified through `pluginInjectionApi?.quickInsert?.actions.getSuggestions`
30
27
  */
31
- export const filterForPinWhiteboardsExperiment = (featuredItems, formatMessage) => {
32
- // Legacy path fallback -- prior comments as follows:
33
- /**
34
- * // Part of ATLAS-95399 to pin whiteboards to the top of the InsertMenu
35
- // Need to check if whiteboard options are available, and filter for the cohort
36
- // Takes the original featuredItems list and returns one with the right whiteboard option at the top
37
- */
38
- if (fg('confluence-whiteboards-quick-insert-eligible')) {
39
- const [DIAGRAM_TITLE, BLANK_TITLE] = ['Create diagram', 'Create whiteboard'];
40
- const featuredWhiteboardsPresent = featuredItems.filter(item => [DIAGRAM_TITLE, BLANK_TITLE].includes(item.title)).length === 2;
41
- if (featuredWhiteboardsPresent) {
42
- const pinWhiteboardActionToTop = (items, title) => {
43
- // find the requested item by title, give it the appropriate description, and bring it to the top of the list
44
- const index = items.findIndex(item => item.title === title);
45
- const filteredList = items.filter(item => ![DIAGRAM_TITLE, BLANK_TITLE].includes(item.title));
46
- if (index === -1) {
47
- return filteredList;
48
- }
49
- const featuredItem = {
50
- ...items[index]
51
- };
52
- featuredItem.description = formatMessage(messages.featuredWhiteboardDescription);
53
- return [featuredItem, ...filteredList];
54
- };
55
- return pinWhiteboardActionToTop(featuredItems, DIAGRAM_TITLE);
56
- } else {
57
- if (fg('confluence-whiteboards-quick-insert-l10n-eligible')) {
58
- // Fire exposure for confluence_whiteboards_quick_insert_localised_aa
59
- // https://switcheroo.atlassian.com/ui/gates/ccd80d32-28a1-4dcf-b3f9-dbdc02a046ff/key/confluence_whiteboards_quick_insert_localised_aa
60
- expVal('confluence_whiteboards_quick_insert_localised_aa', 'cohort', 'test_diagram');
61
-
62
- /** BEGIN locale agnostic path */
63
-
64
- /**
65
- * EXTREMELY IMPORTANT: we must not drop diagram for those who already receive
66
- * the 'insert diagram to the top' treatment.
67
- *
68
- * Our heuristic to check that this is only targeting users where they haven't
69
- * gotten the experience, is if we _cannot_ find the blank board experience in
70
- * the list, matching purely on title.
71
- *
72
- * e.g. `featuredWhiteboardsPresent` = false, given it matches on title.
73
- *
74
- * The side-effect of this, is that there's a small chance/edge case of users
75
- * who toggle between locales, and receive different experiences.
76
- *
77
- * Hopefully we can make a call early on this experiment, and eliminate this
78
- * code path.
79
- */
80
- const WHITEBOARD_KEY = 'whiteboard-extension:create-whiteboard';
81
- const DIAGRAM_KEY = 'whiteboard-extension:create-diagram';
82
- const isBlank = item => item.key === WHITEBOARD_KEY;
83
- const isDiagram = item => item.key === DIAGRAM_KEY;
84
- const hasBoth = featuredItems.some(isBlank) && featuredItems.some(isDiagram);
85
- if (hasBoth) {
86
- const pin = key => {
87
- const idx = featuredItems.findIndex(item => item.key === key);
88
- const filtered = featuredItems.filter(item => !isBlank(item) && !isDiagram(item));
89
- if (idx === -1) {
90
- return filtered;
91
- }
92
- const picked = {
93
- ...featuredItems[idx],
94
- description: formatMessage(messages.featuredWhiteboardDescription)
95
- };
96
- return [picked, ...filtered];
97
- };
98
- if (expValEquals('confluence_whiteboards_quick_insert_localised', 'cohort', 'test_blank')) {
99
- return pin(WHITEBOARD_KEY);
100
- }
101
- if (expValEquals('confluence_whiteboards_quick_insert_localised', 'cohort', 'test_diagram')) {
102
- return pin(DIAGRAM_KEY);
103
- }
104
- if (expValEquals('confluence_whiteboards_quick_insert_localised', 'cohort', 'control')) {
105
- return featuredItems;
106
- }
107
- }
28
+ export const filterForPinWhiteboards = (featuredItems, formatMessage) => {
29
+ const DIAGRAM_KEY = 'whiteboard-extension:create-diagram';
30
+ const isDiagram = item => item.key === DIAGRAM_KEY;
31
+ const featuredWhiteboardsPresent = featuredItems.some(isDiagram);
32
+ if (featuredWhiteboardsPresent) {
33
+ const pin = key => {
34
+ const idx = featuredItems.findIndex(item => item.key === key);
35
+ const filtered = featuredItems.filter(item => !isDiagram(item));
36
+ if (idx === -1) {
37
+ return filtered;
108
38
  }
109
- /** END locale agnostic path */
110
- }
39
+ const picked = {
40
+ ...featuredItems[idx],
41
+ description: formatMessage(messages.featuredWhiteboardDescription)
42
+ };
43
+ return [picked, ...filtered];
44
+ };
45
+ return pin(DIAGRAM_KEY);
111
46
  }
112
47
  return featuredItems;
113
48
  };
@@ -208,7 +143,7 @@ const InsertMenu = ({
208
143
  } : item)) !== null && _pluginInjectionApi$q5 !== void 0 ? _pluginInjectionApi$q5 : [];
209
144
  const unfilteredResult = quickInsertDropdownItems.concat(featuredQuickInsertSuggestions);
210
145
  // need to filter on the concatenated list so whiteboards are at the top
211
- result = filterForPinWhiteboardsExperiment(unfilteredResult, formatMessage);
146
+ result = filterForPinWhiteboards(unfilteredResult, formatMessage);
212
147
  }
213
148
  setItemCount(result.length);
214
149
  return result;